diff --git a/.storybook/main.ts b/.storybook/main.ts index ca904d3b..5698df3c 100644 --- a/.storybook/main.ts +++ b/.storybook/main.ts @@ -1,7 +1,4 @@ import type { StorybookConfig } from "@storybook/react-vite"; - -const CHROMATIC_BASE_URL = process.env.CHROMATIC_BASE_URL || "https://www.chromatic.com"; - const config: StorybookConfig = { addons: [ { @@ -17,16 +14,13 @@ const config: StorybookConfig = { name: "../dist/index.js", options: { projectToken: "chpt_c4206d1157d8947", + projectId: "6480e1b0042842f149cfd74c", // Default to the the production project of this addon - WILL BE MOVED TO preview.tsx since we can't access options in the manager. }, }, ], docs: { autodocs: "tag", }, - env: (config) => ({ - ...config, - CHROMATIC_BASE_URL, - }), framework: { name: "@storybook/react-vite", options: {}, @@ -35,5 +29,4 @@ const config: StorybookConfig = { stories: ["../src/**/*.stories.@(js|jsx|ts|tsx)"], logLevel: "debug", }; - export default config; diff --git a/package.json b/package.json index 1caf85ab..d5db8597 100644 --- a/package.json +++ b/package.json @@ -51,9 +51,11 @@ "lint": "eslint src --max-warnings 0 --report-unused-disable-directives", "release": "pnpm run build && auto shipit", "start": "run-p build:watch 'storybook --quiet'", - "storybook": "storybook dev -p 6006" + "prerelease": "zx scripts/prepublish-checks.mjs", + "storybook": "CHROMATIC_ADDON_NAME='../dist/index.js' storybook dev -p 6006" }, "dependencies": { + "@storybook/csf-tools": "^7.1.0-alpha.34", "@storybook/design-system": "^7.15.11", "chromatic": "^6.19.8", "date-fns": "^2.30.0", @@ -63,6 +65,7 @@ "devDependencies": { "@graphql-codegen/cli": "^4.0.1", "@graphql-codegen/client-preset": "^4.0.1", + "@graphql-typed-document-node/core": "^3.2.0", "@storybook/addon-actions": "^7.1.0-alpha.34", "@storybook/addon-essentials": "^7.1.0-alpha.34", "@storybook/addon-interactions": "^7.1.0-alpha.34", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 180534b5..d42afe19 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -23,6 +23,9 @@ dependencies: '@storybook/core-events': specifier: ^7.1.0-alpha.34 version: 7.1.0-alpha.34 + '@storybook/csf-tools': + specifier: ^7.1.0-alpha.34 + version: 7.1.0-alpha.34 '@storybook/design-system': specifier: ^7.15.11 version: 7.15.11(react-dom@18.0.0)(react@18.0.0) @@ -52,6 +55,9 @@ devDependencies: '@graphql-codegen/client-preset': specifier: ^4.0.1 version: 4.0.1(graphql@16.6.0) + '@graphql-typed-document-node/core': + specifier: ^3.2.0 + version: 3.2.0(graphql@16.6.0) '@storybook/addon-actions': specifier: ^7.1.0-alpha.34 version: 7.1.0-alpha.34(react-dom@18.0.0)(react@18.0.0) @@ -332,7 +338,6 @@ packages: engines: {node: '>=6.9.0'} dependencies: '@babel/highlight': 7.22.5 - dev: true /@babel/compat-data@7.22.5: resolution: {integrity: sha512-4Jc/YuIaYqKnDDz892kPIledykKg12Aw1PYX5i/TY28anJtacvM1Rrr8wbieB9GfEJwlzqT0hUEao0CxEebiDA==} @@ -380,7 +385,6 @@ packages: '@jridgewell/gen-mapping': 0.3.3 '@jridgewell/trace-mapping': 0.3.18 jsesc: 2.5.2 - dev: true /@babel/helper-annotate-as-pure@7.22.5: resolution: {integrity: sha512-LvBTxu8bQSQkcyKOU+a1btnNFQ1dMAd0R6PyW3arXes06F6QLWLIrd681bxRPIXlrMGR3XYnW9JyML7dP3qgxg==} @@ -461,7 +465,6 @@ packages: /@babel/helper-environment-visitor@7.22.5: resolution: {integrity: sha512-XGmhECfVA/5sAt+H+xpSg0mfrHq6FzNr9Oxh7PSEBBRUb/mL7Kz3NICXb194rCqAEdxkhPT1a88teizAFyvk8Q==} engines: {node: '>=6.9.0'} - dev: true /@babel/helper-function-name@7.22.5: resolution: {integrity: sha512-wtHSq6jMRE3uF2otvfuD3DIvVhOsSNshQl0Qrd7qC9oQJzHvOL4qQXlQn2916+CXGywIjpGuIkoyZRRxHPiNQQ==} @@ -469,14 +472,12 @@ packages: dependencies: '@babel/template': 7.22.5 '@babel/types': 7.22.5 - dev: true /@babel/helper-hoist-variables@7.22.5: resolution: {integrity: sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==} engines: {node: '>=6.9.0'} dependencies: '@babel/types': 7.22.5 - dev: true /@babel/helper-member-expression-to-functions@7.22.5: resolution: {integrity: sha512-aBiH1NKMG0H2cGZqspNvsaBe6wNGjbJjuLy29aU+eDZjSbbN53BaxlpB02xm9v34pLTZ1nIQPFYn2qMZoa5BQQ==} @@ -568,7 +569,6 @@ packages: engines: {node: '>=6.9.0'} dependencies: '@babel/types': 7.22.5 - dev: true /@babel/helper-string-parser@7.22.5: resolution: {integrity: sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==} @@ -613,7 +613,6 @@ packages: '@babel/helper-validator-identifier': 7.22.5 chalk: 2.4.2 js-tokens: 4.0.0 - dev: true /@babel/parser@7.21.9: resolution: {integrity: sha512-q5PNg/Bi1OpGgx5jYlvWZwAorZepEudDMCLtj967aeS7WMont7dUZI46M2XwcIQqvUlMxWfdLFu4S/qSxeUu5g==} @@ -1719,7 +1718,6 @@ packages: '@babel/code-frame': 7.22.5 '@babel/parser': 7.22.5 '@babel/types': 7.22.5 - dev: true /@babel/traverse@7.21.5: resolution: {integrity: sha512-AhQoI3YjWi6u/y/ntv7k48mcrCXmus0t79J9qPNlk/lAsFlCiJ047RmbfMOawySTHtywXhbXgpx/8nXMYd+oFw==} @@ -1755,7 +1753,6 @@ packages: globals: 11.12.0 transitivePeerDependencies: - supports-color - dev: true /@babel/types@7.21.5: resolution: {integrity: sha512-m4AfNvVF2mVC/F7fDEdH2El3HzUg9It/XsCxZiOTTA3m3qYfcSVSbTfM6Q9xG+hYDniZssYhlXKKUMD5m8tF4Q==} @@ -3336,32 +3333,26 @@ packages: '@jridgewell/set-array': 1.1.2 '@jridgewell/sourcemap-codec': 1.4.15 '@jridgewell/trace-mapping': 0.3.18 - dev: true /@jridgewell/resolve-uri@3.1.0: resolution: {integrity: sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==} engines: {node: '>=6.0.0'} - dev: true /@jridgewell/set-array@1.1.2: resolution: {integrity: sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==} engines: {node: '>=6.0.0'} - dev: true /@jridgewell/sourcemap-codec@1.4.14: resolution: {integrity: sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==} - dev: true /@jridgewell/sourcemap-codec@1.4.15: resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==} - dev: true /@jridgewell/trace-mapping@0.3.18: resolution: {integrity: sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==} dependencies: '@jridgewell/resolve-uri': 3.1.0 '@jridgewell/sourcemap-codec': 1.4.14 - dev: true /@juggle/resize-observer@3.4.0: resolution: {integrity: sha512-dfLbk+PwWvFzSxwk3n5ySL0hfBog779o8h68wK/7/APo/7cgyWp5jcXockbxdk5kFRkbeXWm4Fbi9FrdN381sA==} @@ -4134,11 +4125,11 @@ packages: '@storybook/channels': 7.1.0-alpha.34 '@storybook/client-logger': 7.1.0-alpha.34 - /@storybook/channel-postmessage@7.1.0-beta.1: - resolution: {integrity: sha512-0tz/kRI1uCtrVt9eeo/UI82yFIt8JTfcSv68DzErQO11k2HDAy7UrYZASghRfeAj5gH/p/pZ5txEBrPr7WfN8g==} + /@storybook/channel-postmessage@7.1.0-rc.2: + resolution: {integrity: sha512-XQQFN9xYdUwAdWcQopBaNPkj65bSwyBsGEDKFQd1zvwvEv4QKiMWqQVnx84yXfEUu9b4jVolyyB5tQGLS4/6Fw==} dependencies: - '@storybook/channels': 7.1.0-beta.1 - '@storybook/client-logger': 7.1.0-beta.1 + '@storybook/channels': 7.1.0-rc.2 + '@storybook/client-logger': 7.1.0-rc.2 dev: true /@storybook/channels@7.0.21: @@ -4155,11 +4146,11 @@ packages: telejson: 7.1.0 tiny-invariant: 1.3.1 - /@storybook/channels@7.1.0-beta.1: - resolution: {integrity: sha512-QhmhEOjpeuhJ6vcwZhQmzjVu9Djcmhdh0t4UnHSb6DFfEnb/UtuUAyuk5pewjCIZxBtCDbg0V4AQa9dJkac93w==} + /@storybook/channels@7.1.0-rc.2: + resolution: {integrity: sha512-P9u0l5T0N2zMo387f0+eRBZ29Jg2+mfalBcsvTs2TYR9Kb/plQlEXhvIRxJm3W/OeEvS2vxixN2YOFeZGWlUYg==} dependencies: - '@storybook/client-logger': 7.1.0-beta.1 - '@storybook/core-events': 7.1.0-beta.1 + '@storybook/client-logger': 7.1.0-rc.2 + '@storybook/core-events': 7.1.0-rc.2 '@storybook/global': 5.0.0 qs: 6.11.2 telejson: 7.1.0 @@ -4225,8 +4216,8 @@ packages: dependencies: '@storybook/global': 5.0.0 - /@storybook/client-logger@7.1.0-beta.1: - resolution: {integrity: sha512-ddIY35dCRf9YaLztOCJibtI3fmPimjdhJfvYl/z5KPgDsl0x7pqE9Wu22EWkk41R06hQxsZdmjKDaKp+m3hAig==} + /@storybook/client-logger@7.1.0-rc.2: + resolution: {integrity: sha512-O0JLRCFrL7YLMd8sBHdLCqbJBLxW8nCrj7cOwkxt1HY73vy4u/VRujmVZbElaG5QJIoZNUZERyL+oSChthKWlg==} dependencies: '@storybook/global': 5.0.0 dev: true @@ -4335,8 +4326,8 @@ packages: /@storybook/core-events@7.1.0-alpha.34: resolution: {integrity: sha512-b9+2dm8kz7d1DzyhCjhgWAwbOSvKakI/Jcnp/ml4CEZhOTx77fHgfRxEPwxMc1g+xHM8YZGSLgAb857ShJwfEw==} - /@storybook/core-events@7.1.0-beta.1: - resolution: {integrity: sha512-5Wjf9nOEv0EfVTS2LIO2xIBfXeddv5aB/VVrnjH9752NBOv0OqicN2mYoh4f+JTtYkhfT7CMbHZBDK2iM06EIA==} + /@storybook/core-events@7.1.0-rc.2: + resolution: {integrity: sha512-qoYLet2G2vNxpVKPTqLovGNoNSNjID7V2vk9hdUis51osOiVHlgJwXxkz33fUOI18y1JbYoVRM8LZaFaMHGF2g==} dev: true /@storybook/core-server@7.1.0-alpha.34: @@ -4439,7 +4430,6 @@ packages: ts-dedent: 2.2.0 transitivePeerDependencies: - supports-color - dev: true /@storybook/csf@0.1.1: resolution: {integrity: sha512-4hE3AlNVxR60Wc5KSC68ASYzUobjPqtSKyhV6G+ge0FIXU55N5nTY7dXGRZHQGDBPq+XqchMkIdlkHPRs8nTHg==} @@ -4530,14 +4520,14 @@ packages: '@storybook/preview-api': 7.1.0-alpha.34 dev: true - /@storybook/instrumenter@7.1.0-beta.1: - resolution: {integrity: sha512-St56g0Mb2XdMmnC0o0YoSOut/rQwrBZimTC3iJspoCTODxhVi9xk2O2y2t1hc7ros/1YimGpx2EnlbgqhP0qKQ==} + /@storybook/instrumenter@7.1.0-rc.2: + resolution: {integrity: sha512-xmtSNDfSWRkaMIcAlm3ga6ZjHoZgs0xBR3wEgDBtcygaWewvTtuBK4MxgT5NpJjPxGpjVakzjxGoITLQgrk0Kw==} dependencies: - '@storybook/channels': 7.1.0-beta.1 - '@storybook/client-logger': 7.1.0-beta.1 - '@storybook/core-events': 7.1.0-beta.1 + '@storybook/channels': 7.1.0-rc.2 + '@storybook/client-logger': 7.1.0-rc.2 + '@storybook/core-events': 7.1.0-rc.2 '@storybook/global': 5.0.0 - '@storybook/preview-api': 7.1.0-beta.1 + '@storybook/preview-api': 7.1.0-rc.2 dev: true /@storybook/linter-config@3.1.2(@typescript-eslint/parser@5.59.11)(eslint@8.42.0)(prettier@2.8.8)(remark@13.0.0)(typescript@4.9.5): @@ -4694,16 +4684,16 @@ packages: ts-dedent: 2.2.0 util-deprecate: 1.0.2 - /@storybook/preview-api@7.1.0-beta.1: - resolution: {integrity: sha512-dxr7BMAfNk/z7t9XTMccXOCAPOp3bHsZ2PQSetbFMxShpB0JoEKon0qKhguAHPau06td4748241xUaJup12M0g==} + /@storybook/preview-api@7.1.0-rc.2: + resolution: {integrity: sha512-E+X5I1BzFF5aTmclkmoVBYQB+JMx1SUCdkzl+GGX9Wxh5JmyTQDI90ynv0k1aJNvPmC5mS2EMmeqcYoz+AuYZA==} dependencies: - '@storybook/channel-postmessage': 7.1.0-beta.1 - '@storybook/channels': 7.1.0-beta.1 - '@storybook/client-logger': 7.1.0-beta.1 - '@storybook/core-events': 7.1.0-beta.1 + '@storybook/channel-postmessage': 7.1.0-rc.2 + '@storybook/channels': 7.1.0-rc.2 + '@storybook/client-logger': 7.1.0-rc.2 + '@storybook/core-events': 7.1.0-rc.2 '@storybook/csf': 0.1.1 '@storybook/global': 5.0.0 - '@storybook/types': 7.1.0-beta.1 + '@storybook/types': 7.1.0-rc.2 '@types/qs': 6.9.7 dequal: 2.0.3 lodash: 4.17.21 @@ -4846,8 +4836,8 @@ packages: /@storybook/testing-library@0.0.14-next.1: resolution: {integrity: sha512-1CAl40IKIhcPaCC4pYCG0b9IiYNymktfV/jTrX7ctquRY3akaN7f4A1SippVHosksft0M+rQTFE0ccfWW581fw==} dependencies: - '@storybook/client-logger': 7.1.0-beta.1 - '@storybook/instrumenter': 7.1.0-beta.1 + '@storybook/client-logger': 7.1.0-rc.2 + '@storybook/instrumenter': 7.1.0-rc.2 '@testing-library/dom': 8.20.0 '@testing-library/user-event': 13.5.0(@testing-library/dom@8.20.0) ts-dedent: 2.2.0 @@ -4883,10 +4873,10 @@ packages: '@types/express': 4.17.17 file-system-cache: 2.3.0 - /@storybook/types@7.1.0-beta.1: - resolution: {integrity: sha512-TyhnLEdFrwuNJS/MBpjKhrY9eoHwKgGWSpHrpv/YK6f7SXSCjropnHvulVoaevSYh0r/WIHlVVYFh6n0gLGUHQ==} + /@storybook/types@7.1.0-rc.2: + resolution: {integrity: sha512-pd19JdNEE+yuqBNlvk61423ZWQHrbsVafEmiJLD0wL4oWBZts7dijZPYiyrw+Fhw/EuXWsLg0edizBk2Id+JmA==} dependencies: - '@storybook/channels': 7.1.0-beta.1 + '@storybook/channels': 7.1.0-rc.2 '@types/babel__core': 7.20.1 '@types/express': 4.17.17 file-system-cache: 2.3.0 @@ -5748,7 +5738,6 @@ packages: engines: {node: '>=4'} dependencies: color-convert: 1.9.3 - dev: true /ansi-styles@4.3.0: resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} @@ -5905,7 +5894,6 @@ packages: is-nan: 1.3.2 object-is: 1.1.5 util: 0.12.5 - dev: true /ast-types-flow@0.0.7: resolution: {integrity: sha512-eBvWn1lvIApYMhzQMsu9ciLfkBY499mFZlNqG+/9WR7PVlroQw0vG30cOQQbaKz3sCEc44TAOu2ykzqXSNnwag==} @@ -5930,7 +5918,6 @@ packages: engines: {node: '>=4'} dependencies: tslib: 2.5.3 - dev: true /astral-regex@2.0.0: resolution: {integrity: sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==} @@ -5984,7 +5971,6 @@ packages: /available-typed-arrays@1.0.5: resolution: {integrity: sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==} engines: {node: '>= 0.4'} - dev: true /await-to-js@2.1.1: resolution: {integrity: sha512-CHBC6gQGCIzjZ09tJ+XmpQoZOn4GdWePB4qUweCaKNJ0D3f115YdhmYVTZ4rMVpiJ3cFzZcTYK1VMYEICV4YXw==} @@ -6431,7 +6417,6 @@ packages: ansi-styles: 3.2.1 escape-string-regexp: 1.0.5 supports-color: 5.5.0 - dev: true /chalk@3.0.0: resolution: {integrity: sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==} @@ -6651,7 +6636,6 @@ packages: resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==} dependencies: color-name: 1.1.3 - dev: true /color-convert@2.0.1: resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} @@ -6661,7 +6645,6 @@ packages: /color-name@1.1.3: resolution: {integrity: sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==} - dev: true /color-name@1.1.4: resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} @@ -7344,7 +7327,6 @@ packages: /es6-object-assign@1.1.0: resolution: {integrity: sha512-MEl9uirslVwqQU369iHNWZXsI8yaZYGg/D65aOgZkeyFJwHYSxilf7rQzXKI7DdDuBPrBXbfk3sl9hJhmd5AUw==} - dev: true /esbuild-plugin-alias@0.2.1: resolution: {integrity: sha512-jyfL/pwPqaFXyKnj8lP8iLk6Z0m099uXR45aSN8Av1XD4vhvQutxxPzgA2bTcAwQpa1zCXDcWOlhFgyP3GKqhQ==} @@ -7472,7 +7454,6 @@ packages: /escape-string-regexp@1.0.5: resolution: {integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==} engines: {node: '>=0.8.0'} - dev: true /escape-string-regexp@2.0.0: resolution: {integrity: sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==} @@ -7891,7 +7872,6 @@ packages: resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} engines: {node: '>=4'} hasBin: true - dev: true /esquery@1.5.0: resolution: {integrity: sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==} @@ -8275,7 +8255,6 @@ packages: resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==} dependencies: is-callable: 1.2.7 - dev: true /foreground-child@2.0.0: resolution: {integrity: sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA==} @@ -8560,7 +8539,6 @@ packages: /globals@11.12.0: resolution: {integrity: sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==} engines: {node: '>=4'} - dev: true /globals@13.20.0: resolution: {integrity: sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==} @@ -8618,7 +8596,6 @@ packages: resolution: {integrity: sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==} dependencies: get-intrinsic: 1.2.1 - dev: true /graceful-fs@4.2.11: resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} @@ -8730,7 +8707,6 @@ packages: /has-flag@3.0.0: resolution: {integrity: sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==} engines: {node: '>=4'} - dev: true /has-flag@4.0.0: resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} @@ -9068,7 +9044,6 @@ packages: /is-callable@1.2.7: resolution: {integrity: sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==} engines: {node: '>= 0.4'} - dev: true /is-core-module@2.12.1: resolution: {integrity: sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg==} @@ -9119,7 +9094,6 @@ packages: engines: {node: '>= 0.4'} dependencies: has-tostringtag: 1.0.0 - dev: true /is-glob@4.0.3: resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} @@ -9154,7 +9128,6 @@ packages: dependencies: call-bind: 1.0.2 define-properties: 1.2.0 - dev: true /is-negative-zero@2.0.2: resolution: {integrity: sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==} @@ -9252,7 +9225,6 @@ packages: for-each: 0.3.3 gopd: 1.0.1 has-tostringtag: 1.0.0 - dev: true /is-unc-path@1.0.0: resolution: {integrity: sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==} @@ -9865,7 +9837,6 @@ packages: resolution: {integrity: sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==} engines: {node: '>=4'} hasBin: true - dev: true /json-parse-better-errors@1.0.2: resolution: {integrity: sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==} @@ -11589,7 +11560,6 @@ packages: esprima: 4.0.1 source-map: 0.6.1 tslib: 2.5.3 - dev: true /reduce-flatten@2.0.0: resolution: {integrity: sha512-EJ4UNY/U1t2P/2k6oqotuX2Cc3T6nxJwsM0N0asT7dhrtH1ltUxDn4NalSYmPE2rCkVpcf/X6R0wDwcFpzhd4w==} @@ -12568,7 +12538,6 @@ packages: engines: {node: '>=4'} dependencies: has-flag: 3.0.0 - dev: true /supports-color@6.1.0: resolution: {integrity: sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==} @@ -12833,7 +12802,6 @@ packages: /tslib@2.5.3: resolution: {integrity: sha512-mSxlJJwl3BMEQCUNnxXBU9jP4JBktcEGhURcPR6VQVlnP0FdDEsIaz0C35dXNGLyRfrATNofF0F5p2KPxQgB+w==} - dev: true /tsup@6.6.3(typescript@4.9.5): resolution: {integrity: sha512-OLx/jFllYlVeZQ7sCHBuRVEQBBa1tFbouoc/gbYakyipjVQdWy/iQOvmExUA/ewap9iQ7tbJf9pW0PgcEFfJcQ==} @@ -13260,7 +13228,6 @@ packages: is-generator-function: 1.0.10 is-typed-array: 1.1.10 which-typed-array: 1.1.9 - dev: true /utils-merge@1.0.1: resolution: {integrity: sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==} @@ -13520,7 +13487,6 @@ packages: gopd: 1.0.1 has-tostringtag: 1.0.0 is-typed-array: 1.1.10 - dev: true /which@1.3.1: resolution: {integrity: sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==} diff --git a/scripts/prepublish-checks.mjs b/scripts/prepublish-checks.mjs index 5860052a..9546d906 100644 --- a/scripts/prepublish-checks.mjs +++ b/scripts/prepublish-checks.mjs @@ -55,4 +55,4 @@ if ((await $`cat README.md | grep -E ${readmeTestStrings}`.exitCode) == 0) { exitCode = 1; } -process.exit(exitCode); \ No newline at end of file +process.exit(exitCode); diff --git a/src/Panel.tsx b/src/Panel.tsx index c125bf6a..df5e5de9 100644 --- a/src/Panel.tsx +++ b/src/Panel.tsx @@ -3,16 +3,22 @@ import React, { useCallback } from "react"; import { ADDON_ID, PANEL_ID, START_BUILD } from "./constants"; import { Authentication } from "./screens/Authentication/Authentication"; +import { LinkedProject } from "./screens/LinkProject/LinkedProject"; +import { LinkProject } from "./screens/LinkProject/LinkProject"; import { VisualTests } from "./screens/VisualTests/VisualTests"; import { AddonState } from "./types"; import { client, Provider, useAccessToken } from "./utils/graphQLClient"; +import { useProjectId } from "./utils/useProjectId"; interface PanelProps { active: boolean; } +const { GIT_BRANCH, GIT_SLUG } = process.env; + export const Panel = ({ active }: PanelProps) => { const [accessToken, setAccessToken] = useAccessToken(); + const [state, setAddonState] = useAddonState(ADDON_ID, { isOutdated: true }); const { storyId } = useStorybookState(); @@ -33,6 +39,8 @@ export const Panel = ({ active }: PanelProps) => { emit(START_BUILD); }, [emit, state, setAddonState]); + const [projectId, updateProject, projectIdChanged, clearProjectIdChanged] = useProjectId(); + // Render a hidden element when the addon panel is not active. // Storybook's AddonPanel component does the same but it's not styleable so we don't use it. if (!active) return