@faststore/core 2.2.14 → 2.2.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +45 -45
  3. package/.next/cache/.tsbuildinfo +1 -1
  4. package/.next/cache/config.json +3 -3
  5. package/.next/cache/eslint/.cache_1gneedd +1 -1
  6. package/.next/cache/next-server.js.nft.json +1 -1
  7. package/.next/cache/webpack/client-production/0.pack +0 -0
  8. package/.next/cache/webpack/client-production/index.pack +0 -0
  9. package/.next/cache/webpack/server-production/0.pack +0 -0
  10. package/.next/cache/webpack/server-production/index.pack +0 -0
  11. package/.next/next-server.js.nft.json +1 -1
  12. package/.next/prerender-manifest.json +1 -1
  13. package/.next/react-loadable-manifest.json +1 -1
  14. package/.next/required-server-files.json +1 -1
  15. package/.next/routes-manifest.json +1 -1
  16. package/.next/server/chunks/390.js +2 -2
  17. package/.next/server/chunks/398.js +2 -2
  18. package/.next/server/chunks/732.js +2 -2
  19. package/.next/server/chunks/74.js +194 -92
  20. package/.next/server/chunks/863.js +2 -2
  21. package/.next/server/chunks/979.js +6 -6
  22. package/.next/server/middleware-build-manifest.js +1 -1
  23. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  24. package/.next/server/pages/404.js.nft.json +1 -1
  25. package/.next/server/pages/500.js.nft.json +1 -1
  26. package/.next/server/pages/[...slug].js.nft.json +1 -1
  27. package/.next/server/pages/[slug]/p.js +2 -2
  28. package/.next/server/pages/[slug]/p.js.nft.json +1 -1
  29. package/.next/server/pages/_app.js.nft.json +1 -1
  30. package/.next/server/pages/account.js.nft.json +1 -1
  31. package/.next/server/pages/api/graphql.js.nft.json +1 -1
  32. package/.next/server/pages/checkout.js.nft.json +1 -1
  33. package/.next/server/pages/en-US/404.html +2 -2
  34. package/.next/server/pages/en-US/404.json +1 -1
  35. package/.next/server/pages/en-US/500.html +2 -2
  36. package/.next/server/pages/en-US/500.json +1 -1
  37. package/.next/server/pages/en-US/account.html +2 -2
  38. package/.next/server/pages/en-US/account.json +1 -1
  39. package/.next/server/pages/en-US/checkout.html +2 -2
  40. package/.next/server/pages/en-US/checkout.json +1 -1
  41. package/.next/server/pages/en-US/login.html +2 -2
  42. package/.next/server/pages/en-US/login.json +1 -1
  43. package/.next/server/pages/en-US/s.html +2 -2
  44. package/.next/server/pages/en-US/s.json +1 -1
  45. package/.next/server/pages/en-US.html +3 -3
  46. package/.next/server/pages/en-US.json +1 -1
  47. package/.next/server/pages/index.js.nft.json +1 -1
  48. package/.next/server/pages/login.js.nft.json +1 -1
  49. package/.next/server/pages/s.js.nft.json +1 -1
  50. package/.next/server/pages-manifest.json +5 -5
  51. package/.next/static/chunks/{400-7ce14b0f942135d1.js → 400-a09ccc622ec96daa.js} +1 -1
  52. package/.next/static/chunks/469-7259b855711d4ad3.js +1 -0
  53. package/.next/static/chunks/{783-864ba18fdcdc2649.js → 783-a67df4e98c1ac27b.js} +1 -1
  54. package/.next/static/chunks/pages/{404-d186c22d910fecbb.js → 404-6763ce07878a1456.js} +1 -1
  55. package/.next/static/chunks/pages/{500-c6f28e1de16c5aab.js → 500-0f4374f30595d27c.js} +1 -1
  56. package/.next/static/chunks/pages/{[...slug]-c7c8e53be9021135.js → [...slug]-111f89162eff5029.js} +1 -1
  57. package/.next/static/chunks/pages/[slug]/{p-fc8a69c60752c685.js → p-0b6789ab8718bdf0.js} +1 -1
  58. package/.next/static/chunks/pages/{account-46edcd73944d7924.js → account-9eb6fab139286c66.js} +1 -1
  59. package/.next/static/chunks/pages/{checkout-49faa1acf04be10c.js → checkout-7cd7b110c7cf2f10.js} +1 -1
  60. package/.next/static/chunks/pages/{index-5088cf4fabfe4812.js → index-3d5c756be5ce8fc7.js} +1 -1
  61. package/.next/static/chunks/pages/{login-e944d38d65d2eea5.js → login-5fd09e6402f47896.js} +1 -1
  62. package/.next/static/chunks/pages/{s-b8438313905eaef8.js → s-8e32a9b170819fa9.js} +1 -1
  63. package/.next/static/chunks/{webpack-66a77a46f9162613.js → webpack-4ccaf6613cbd7224.js} +1 -1
  64. package/.next/static/css/29868543c76bc6fd.css +1 -0
  65. package/.next/static/css/e84fc497732ea596.css +1 -0
  66. package/.next/static/luZLa4ba7yxTMds9tGCac/_buildManifest.js +1 -0
  67. package/.next/trace +78 -77
  68. package/.turbo/turbo-build.log +6 -6
  69. package/.turbo/turbo-test.log +10 -10
  70. package/index.ts +1 -0
  71. package/package.json +9 -9
  72. package/src/components/cart/CartSidebar/section.module.scss +19 -17
  73. package/src/components/cms/GlobalSections.tsx +1 -1
  74. package/src/components/common/Alert/Alert.tsx +3 -1
  75. package/src/components/common/Alert/section.module.scss +8 -6
  76. package/src/components/common/Toast/section.module.scss +5 -3
  77. package/src/components/navigation/NavbarSlider/section.module.scss +13 -11
  78. package/src/components/sections/Alert/Alert.tsx +8 -17
  79. package/src/components/sections/Alert/DefaultComponents.ts +6 -0
  80. package/src/components/sections/Alert/OverriddenDefaultAlert.ts +12 -0
  81. package/src/components/sections/BannerText/Overrides.tsx +3 -3
  82. package/src/components/sections/Breadcrumb/Overrides.tsx +3 -3
  83. package/src/components/sections/EmptyState/Overrides.tsx +3 -3
  84. package/src/components/sections/Hero/Overrides.tsx +3 -3
  85. package/src/components/sections/Navbar/Overrides.tsx +3 -3
  86. package/src/components/sections/Newsletter/Overrides.tsx +3 -3
  87. package/src/components/sections/ProductDetails/Overrides.tsx +3 -3
  88. package/src/components/sections/ProductGallery/Overrides.tsx +3 -3
  89. package/src/components/sections/ProductShelf/Overrides.tsx +3 -3
  90. package/src/components/sections/RegionBar/Overrides.tsx +3 -3
  91. package/src/components/sections/Section/Section.tsx +8 -1
  92. package/src/sdk/overrides/OverrideContext.tsx +27 -0
  93. package/src/sdk/overrides/getOverriddenSection.tsx +70 -0
  94. package/src/{utils → sdk/overrides}/overrides.ts +13 -14
  95. package/src/sdk/overrides/sections.tsx +18 -0
  96. package/src/typings/overrides.ts +25 -68
  97. package/src/typings/overridesDefinition.ts +52 -0
  98. package/.next/static/chunks/520-5a9ae7339f19a163.js +0 -1
  99. package/.next/static/css/6e1a7434f061d0ef.css +0 -1
  100. package/.next/static/css/8f93a4630936c20b.css +0 -1
  101. package/.next/static/qdhHoILxfnVChWyMteJto/_buildManifest.js +0 -1
  102. package/src/components/sections/Alert/Overrides.tsx +0 -15
  103. package/src/typings/overrideDefinitionUtils.ts +0 -40
  104. /package/.next/static/{qdhHoILxfnVChWyMteJto → luZLa4ba7yxTMds9tGCac}/_ssgManifest.js +0 -0
@@ -1,7 +1,7 @@
1
1
  $ yarn partytown & yarn generate && next build
2
+ $ faststore generate-graphql -c
2
3
  $ partytown copylib ./public/~partytown
3
4
  Partytown lib copied to: /home/runner/work/faststore/faststore/packages/core/public/~partytown
4
- $ faststore generate-graphql -c
5
5
  success - GraphQL schema, types, and optimizations successfully generated 🎉
6
6
  warn - You have enabled experimental feature (scrollRestoration) in next.config.js.
7
7
  warn - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk.
@@ -23,8 +23,8 @@ warn - AlertSectionIcon not found. Add a new component for this section or remov
23
23
  info - Generating static pages (1/7)
24
24
  warn - AlertSectionIcon not found. Add a new component for this section or remove it from the CMS
25
25
  warn - AlertSectionIcon not found. Add a new component for this section or remove it from the CMS
26
- info - Generating static pages (3/7)
27
26
  warn - AlertSectionIcon not found. Add a new component for this section or remove it from the CMS
27
+ info - Generating static pages (3/7)
28
28
  warn - AlertSectionIcon not found. Add a new component for this section or remove it from the CMS
29
29
  info - Generating static pages (5/7)
30
30
  warn - AlertSectionIcon not found. Add a new component for this section or remove it from the CMS
@@ -40,20 +40,20 @@ Route (pages) Size First Load JS
40
40
  ├ ● /[slug]/p 10.9 kB 135 kB
41
41
  ├ └ css/d7bbfbd552f407e9.css 11.3 kB
42
42
  ├ ○ /404 1.19 kB 111 kB
43
- ├ ● /500 1.2 kB 111 kB
44
- ├ ● /account 670 B 110 kB
43
+ ├ ● /500 1.21 kB 111 kB
44
+ ├ ● /account 669 B 111 kB
45
45
  ├ λ /api/graphql 0 B 78.6 kB
46
46
  ├ λ /api/health/live 0 B 78.6 kB
47
47
  ├ λ /api/health/ready 0 B 78.6 kB
48
48
  ├ λ /api/preview 0 B 78.6 kB
49
- ├ ● /checkout 657 B 110 kB
49
+ ├ ● /checkout 657 B 111 kB
50
50
  ├ ● /login 1.14 kB 111 kB
51
51
  └ ● /s 4.57 kB 125 kB
52
52
  + First Load JS shared by all 81.7 kB
53
53
  ├ chunks/framework-dfd14d7ce6600b03.js 45.3 kB
54
54
  ├ chunks/main-e4e873ee741162eb.js 24.1 kB
55
55
  ├ chunks/pages/_app-48d56037a2534a44.js 6.99 kB
56
- ├ chunks/webpack-66a77a46f9162613.js 2.25 kB
56
+ ├ chunks/webpack-4ccaf6613cbd7224.js 2.25 kB
57
57
  └ css/5d1f64b61ea581f4.css 3.06 kB
58
58
 
59
59
  λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
@@ -1,25 +1,25 @@
1
1
  $ tsdx test
2
2
  ts-jest[versions] (WARN) Version 29.1.0 of jest installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=25.0.0 <26.0.0). Please do not report issues in ts-jest if you are using unsupported versions.
3
3
  ts-jest[versions] (WARN) Version 4.9.4 of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=3.4.0 <4.0.0). Please do not report issues in ts-jest if you are using unsupported versions.
4
- PASS test/server/index.test.ts (11.482s)
4
+ PASS test/server/index.test.ts (6.392s)
5
5
  FastStore GraphQL Layer
6
6
  @faststore/api
7
- ✓ should return a valid GraphQL schema (9ms)
8
- ✓ should return a valid GraphQL schema contain all expected types (20ms)
7
+ ✓ should return a valid GraphQL schema (5ms)
8
+ ✓ should return a valid GraphQL schema contain all expected types (8ms)
9
9
  ✓ should return a valid GraphQL schema contain all expected queries (1ms)
10
- ✓ should return a valid GraphQL schema contain all expected mutations (1ms)
10
+ ✓ should return a valid GraphQL schema contain all expected mutations
11
11
  VTEX API Extension
12
- ✓ getTypeDefsFromFolder function should return an Array (9ms)
12
+ ✓ getTypeDefsFromFolder function should return an Array (6ms)
13
13
  Third Party API Extension
14
- ✓ getTypeDefsFromFolder function should return an Array (7ms)
14
+ ✓ getTypeDefsFromFolder function should return an Array (5ms)
15
15
  Final Schema after merging
16
- ✓ should return a valid merged GraphQL schema (42ms)
16
+ ✓ should return a valid merged GraphQL schema (27ms)
17
17
  Envelop
18
- ✓ should exist with its plugins (40ms)
19
- ✓ should handle options and execute (439ms)
18
+ ✓ should exist with its plugins (26ms)
19
+ ✓ should handle options and execute (499ms)
20
20
 
21
21
  Test Suites: 1 passed, 1 total
22
22
  Tests: 9 passed, 9 total
23
23
  Snapshots: 0 total
24
- Time: 12.618s
24
+ Time: 6.814s
25
25
  Ran all test suites.
package/index.ts CHANGED
@@ -17,3 +17,4 @@ export type {
17
17
  export { useProductsQuery } from './src/sdk/product/useProductsQuery'
18
18
 
19
19
  export * from './src/typings/overrides'
20
+ export { getOverriddenSection } from './src/sdk/overrides/getOverriddenSection'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/core",
3
- "version": "2.2.14",
3
+ "version": "2.2.16",
4
4
  "license": "MIT",
5
5
  "browserslist": "supports es6-module and not dead",
6
6
  "exports": {
@@ -38,11 +38,11 @@
38
38
  "@envelop/graphql-jit": "^1.1.1",
39
39
  "@envelop/parser-cache": "^2.2.0",
40
40
  "@envelop/validation-cache": "^2.2.0",
41
- "@faststore/api": "^2.2.0",
42
- "@faststore/components": "^2.2.13",
43
- "@faststore/graphql-utils": "^2.2.0",
44
- "@faststore/sdk": "^2.2.0",
45
- "@faststore/ui": "^2.2.13",
41
+ "@faststore/api": "^2.2.16",
42
+ "@faststore/components": "^2.2.16",
43
+ "@faststore/graphql-utils": "^2.2.16",
44
+ "@faststore/sdk": "^2.2.16",
45
+ "@faststore/ui": "^2.2.16",
46
46
  "@graphql-codegen/cli": "^3.3.1",
47
47
  "@graphql-codegen/typescript": "^3.0.4",
48
48
  "@graphql-codegen/typescript-operations": "^3.0.4",
@@ -80,8 +80,8 @@
80
80
  "devDependencies": {
81
81
  "@cypress/code-coverage": "^3.12.1",
82
82
  "@envelop/testing": "^6.0.0",
83
- "@faststore/cli": "^2.2.12",
84
- "@faststore/eslint-config": "^2.2.0",
83
+ "@faststore/cli": "^2.2.16",
84
+ "@faststore/eslint-config": "^2.2.16",
85
85
  "@faststore/lighthouse": "^1.12.32",
86
86
  "@lhci/cli": "^0.9.0",
87
87
  "@storybook/addon-a11y": "^6.5.9",
@@ -129,5 +129,5 @@
129
129
  "msw": {
130
130
  "workerDirectory": "public"
131
131
  },
132
- "gitHead": "7a4cb8aa2f45be7ffa0cee67f247b1d781ee73c2"
132
+ "gitHead": "4ecdc351834e7d73981508a3b22e3fc04cb19b2c"
133
133
  }
@@ -1,18 +1,20 @@
1
- .section {
2
- @import "@faststore/ui/src/components/atoms/Icon/styles.scss";
3
- @import "@faststore/ui/src/components/atoms/Overlay/styles.scss";
4
- @import "@faststore/ui/src/components/atoms/Badge/styles.scss";
5
- @import "@faststore/ui/src/components/atoms/Button/styles.scss";
6
- @import "@faststore/ui/src/components/atoms/Link/styles.scss";
7
- @import "@faststore/ui/src/components/atoms/List/styles.scss";
8
- @import "@faststore/ui/src/components/atoms/Price/styles.scss";
9
- @import "@faststore/ui/src/components/molecules/Alert/styles.scss";
10
- @import "@faststore/ui/src/components/molecules/Modal/styles.scss";
11
- @import "@faststore/ui/src/components/molecules/CartItem/styles.scss";
12
- @import "@faststore/ui/src/components/molecules/Gift/styles.scss";
13
- @import "@faststore/ui/src/components/molecules/QuantitySelector/styles.scss";
14
- @import "@faststore/ui/src/components/molecules/OrderSummary/styles.scss";
15
- @import "@faststore/ui/src/components/organisms/EmptyState/styles.scss";
16
- @import "@faststore/ui/src/components/organisms/SlideOver/styles.scss";
17
- @import "@faststore/ui/src/components/organisms/CartSidebar/styles.scss";
1
+ @layer components {
2
+ .section {
3
+ @import "@faststore/ui/src/components/atoms/Icon/styles.scss";
4
+ @import "@faststore/ui/src/components/atoms/Overlay/styles.scss";
5
+ @import "@faststore/ui/src/components/atoms/Badge/styles.scss";
6
+ @import "@faststore/ui/src/components/atoms/Button/styles.scss";
7
+ @import "@faststore/ui/src/components/atoms/Link/styles.scss";
8
+ @import "@faststore/ui/src/components/atoms/List/styles.scss";
9
+ @import "@faststore/ui/src/components/atoms/Price/styles.scss";
10
+ @import "@faststore/ui/src/components/molecules/Alert/styles.scss";
11
+ @import "@faststore/ui/src/components/molecules/Modal/styles.scss";
12
+ @import "@faststore/ui/src/components/molecules/CartItem/styles.scss";
13
+ @import "@faststore/ui/src/components/molecules/Gift/styles.scss";
14
+ @import "@faststore/ui/src/components/molecules/QuantitySelector/styles.scss";
15
+ @import "@faststore/ui/src/components/molecules/OrderSummary/styles.scss";
16
+ @import "@faststore/ui/src/components/organisms/EmptyState/styles.scss";
17
+ @import "@faststore/ui/src/components/organisms/SlideOver/styles.scss";
18
+ @import "@faststore/ui/src/components/organisms/CartSidebar/styles.scss";
19
+ }
18
20
  }
@@ -7,7 +7,7 @@ import { PageContentType, getPage } from 'src/server/cms'
7
7
  import Toast from 'src/components/common/Toast'
8
8
  import RenderSections from './RenderSections'
9
9
 
10
- import Alert from 'src/components/sections/Alert'
10
+ import { OverriddenDefaultAlert as Alert } from 'src/components/sections/Alert/OverriddenDefaultAlert'
11
11
  import Footer from 'src/components/sections/Footer'
12
12
  import Navbar from 'src/components/sections/Navbar'
13
13
  import RegionBar from 'src/components/sections/RegionBar'
@@ -7,7 +7,7 @@ import { mark } from 'src/sdk/tests/mark'
7
7
  import Section from 'src/components/sections/Section/Section'
8
8
  import styles from './section.module.scss'
9
9
 
10
- import { Alert as AlertWrapper } from 'src/components/sections/Alert/Overrides'
10
+ import { useOverrideComponents } from 'src/sdk/overrides/OverrideContext'
11
11
 
12
12
  export interface AlertProps extends UIAlertProps {
13
13
  /**
@@ -18,11 +18,13 @@ export interface AlertProps extends UIAlertProps {
18
18
  */
19
19
  content?: ReactNode
20
20
  }
21
+
21
22
  function Alert({
22
23
  content,
23
24
  children,
24
25
  ...otherProps
25
26
  }: PropsWithChildren<AlertProps>) {
27
+ const { Alert: AlertWrapper } = useOverrideComponents<'Alert'>()
26
28
  const [displayAlert, setDisplayAlert] = useState(true)
27
29
 
28
30
  const onAlertClose = useCallback(
@@ -1,8 +1,10 @@
1
- .section {
2
- [data-fs-content="alert"] { @include layout-content-full; }
1
+ @layer components {
2
+ .section {
3
+ [data-fs-content="alert"] { @include layout-content-full; }
3
4
 
4
- @import "@faststore/ui/src/components/atoms/Icon/styles.scss";
5
- @import "@faststore/ui/src/components/atoms/Button/styles.scss";
6
- @import "@faststore/ui/src/components/atoms/Link/styles.scss";
7
- @import "@faststore/ui/src/components/molecules/Alert/styles.scss";
5
+ @import "@faststore/ui/src/components/atoms/Icon/styles.scss";
6
+ @import "@faststore/ui/src/components/atoms/Button/styles.scss";
7
+ @import "@faststore/ui/src/components/atoms/Link/styles.scss";
8
+ @import "@faststore/ui/src/components/molecules/Alert/styles.scss";
9
+ }
8
10
  }
@@ -1,4 +1,6 @@
1
- .section {
2
- @import "@faststore/ui/src/components/atoms/Icon/styles.scss";
3
- @import "@faststore/ui/src/components/molecules/Toast/styles.scss";
1
+ @layer components {
2
+ .section {
3
+ @import "@faststore/ui/src/components/atoms/Icon/styles.scss";
4
+ @import "@faststore/ui/src/components/molecules/Toast/styles.scss";
5
+ }
4
6
  }
@@ -1,12 +1,14 @@
1
- .section {
2
- @import "@faststore/ui/src/components/atoms/Button/styles.scss";
3
- @import "@faststore/ui/src/components/atoms/Icon/styles.scss";
4
- @import "@faststore/ui/src/components/atoms/Link/styles.scss";
5
- @import "@faststore/ui/src/components/atoms/List/styles.scss";
6
- @import "@faststore/ui/src/components/atoms/Logo/styles.scss";
7
- @import "@faststore/ui/src/components/molecules/LinkButton/styles.scss";
8
- @import "@faststore/ui/src/components/molecules/Modal/styles.scss";
9
- @import "@faststore/ui/src/components/molecules/NavbarLinks/styles.scss";
10
- @import "@faststore/ui/src/components/organisms/SlideOver/styles.scss";
11
- @import "@faststore/ui/src/components/organisms/NavbarSlider/styles.scss";
1
+ @layer components {
2
+ .section {
3
+ @import "@faststore/ui/src/components/atoms/Button/styles.scss";
4
+ @import "@faststore/ui/src/components/atoms/Icon/styles.scss";
5
+ @import "@faststore/ui/src/components/atoms/Link/styles.scss";
6
+ @import "@faststore/ui/src/components/atoms/List/styles.scss";
7
+ @import "@faststore/ui/src/components/atoms/Logo/styles.scss";
8
+ @import "@faststore/ui/src/components/molecules/LinkButton/styles.scss";
9
+ @import "@faststore/ui/src/components/molecules/Modal/styles.scss";
10
+ @import "@faststore/ui/src/components/molecules/NavbarLinks/styles.scss";
11
+ @import "@faststore/ui/src/components/organisms/SlideOver/styles.scss";
12
+ @import "@faststore/ui/src/components/organisms/NavbarSlider/styles.scss";
13
+ }
12
14
  }
@@ -1,10 +1,7 @@
1
1
  import { ReactNode } from 'react'
2
2
 
3
3
  import CommonAlert from 'src/components/common/Alert'
4
- import {
5
- Alert as AlertWrapper,
6
- Icon,
7
- } from 'src/components/sections/Alert/Overrides'
4
+ import { useOverrideComponents } from 'src/sdk/overrides/OverrideContext'
8
5
 
9
6
  export interface AlertProps {
10
7
  icon: string
@@ -18,26 +15,20 @@ export interface AlertProps {
18
15
  }
19
16
 
20
17
  // TODO: Change actionPath and actionLabel with Link
21
- function Alert({
22
- icon = Icon.props.name,
23
- content,
24
- link: {
25
- text = AlertWrapper.props.link?.children,
26
- to = AlertWrapper.props.link?.href,
27
- },
28
- dismissible = AlertWrapper.props.dismissible,
29
- }: AlertProps) {
18
+ function Alert({ icon, content, link: { text, to }, dismissible }: AlertProps) {
19
+ const { Alert: AlertWrapper, Icon } = useOverrideComponents<'Alert'>()
20
+
30
21
  return (
31
22
  <CommonAlert
32
- icon={<Icon.Component {...Icon.props} name={icon} />}
23
+ icon={<Icon.Component {...Icon.props} name={icon ?? Icon.props.name} />}
33
24
  {...AlertWrapper.props}
34
25
  link={{
35
26
  ...(AlertWrapper.props.link ?? {}),
36
- children: text,
37
- href: to,
27
+ children: text ?? AlertWrapper.props.link?.children,
28
+ href: to ?? AlertWrapper.props.link?.href,
38
29
  target: AlertWrapper.props.link?.target ?? '_self',
39
30
  }}
40
- dismissible={dismissible}
31
+ dismissible={dismissible ?? AlertWrapper.props.dismissible}
41
32
  >
42
33
  {content}
43
34
  </CommonAlert>
@@ -0,0 +1,6 @@
1
+ import { Alert as UIAlert, Icon as UIIcon } from '@faststore/ui'
2
+
3
+ export const AlertDefaultComponents = {
4
+ Alert: UIAlert,
5
+ Icon: UIIcon,
6
+ } as const
@@ -0,0 +1,12 @@
1
+ import { override } from 'src/customizations/src/components/overrides/Alert'
2
+ import { getOverriddenSection } from 'src/sdk/overrides/getOverriddenSection'
3
+ import type { SectionOverrideDefinition } from 'src/typings/overridesDefinition'
4
+
5
+ /**
6
+ * This component exists to support overrides 1.0
7
+ *
8
+ * This allows users to override the default Alert section present in the Headless CMS
9
+ */
10
+ export const OverriddenDefaultAlert = getOverriddenSection(
11
+ override as SectionOverrideDefinition<'Alert'>
12
+ )
@@ -3,16 +3,16 @@ import {
3
3
  BannerTextContent as UIBannerTextContent,
4
4
  } from '@faststore/ui'
5
5
 
6
- import { getSectionOverrides } from 'src/utils/overrides'
6
+ import { getSectionOverrides } from 'src/sdk/overrides/overrides'
7
7
  import { override } from 'src/customizations/src/components/overrides/BannerText'
8
- import type { BannerTextOverrideDefinition } from 'src/typings/overrides'
8
+ import type { SectionOverrideDefinition } from 'src/typings/overridesDefinition'
9
9
 
10
10
  const { BannerText, BannerTextContent } = getSectionOverrides(
11
11
  {
12
12
  BannerText: UIBannerText,
13
13
  BannerTextContent: UIBannerTextContent,
14
14
  },
15
- override as BannerTextOverrideDefinition
15
+ override as SectionOverrideDefinition<'BannerText'>
16
16
  )
17
17
 
18
18
  export { BannerText, BannerTextContent }
@@ -1,15 +1,15 @@
1
1
  import { Breadcrumb as UIBreadcrumb, Icon as UIIcon } from '@faststore/ui'
2
2
 
3
- import { getSectionOverrides } from 'src/utils/overrides'
3
+ import { getSectionOverrides } from 'src/sdk/overrides/overrides'
4
4
  import { override } from 'src/customizations/src/components/overrides/Breadcrumb'
5
- import type { BreadcrumbOverrideDefinition } from 'src/typings/overrides'
5
+ import type { SectionOverrideDefinition } from 'src/typings/overridesDefinition'
6
6
 
7
7
  const { Breadcrumb, Icon } = getSectionOverrides(
8
8
  {
9
9
  Breadcrumb: UIBreadcrumb,
10
10
  Icon: UIIcon,
11
11
  },
12
- override as BreadcrumbOverrideDefinition
12
+ override as SectionOverrideDefinition<'Breadcrumb'>
13
13
  )
14
14
 
15
15
  export { Breadcrumb, Icon }
@@ -1,14 +1,14 @@
1
1
  import { EmptyState as UIEmptyState } from '@faststore/ui'
2
2
 
3
- import { getSectionOverrides } from 'src/utils/overrides'
3
+ import { getSectionOverrides } from 'src/sdk/overrides/overrides'
4
4
  import { override } from 'src/customizations/src/components/overrides/EmptyState'
5
- import type { EmptyStateOverrideDefinition } from 'src/typings/overrides'
5
+ import type { SectionOverrideDefinition } from 'src/typings/overridesDefinition'
6
6
 
7
7
  const { EmptyState } = getSectionOverrides(
8
8
  {
9
9
  EmptyState: UIEmptyState,
10
10
  },
11
- override as EmptyStateOverrideDefinition
11
+ override as SectionOverrideDefinition<'EmptyState'>
12
12
  )
13
13
 
14
14
  export { EmptyState }
@@ -4,9 +4,9 @@ import {
4
4
  HeroHeader as UIHeroHeader,
5
5
  } from '@faststore/ui'
6
6
 
7
- import { getSectionOverrides } from 'src/utils/overrides'
7
+ import { getSectionOverrides } from 'src/sdk/overrides/overrides'
8
8
  import { override } from 'src/customizations/src/components/overrides/Hero'
9
- import type { HeroOverrideDefinition } from 'src/typings/overrides'
9
+ import type { SectionOverrideDefinition } from 'src/typings/overridesDefinition'
10
10
 
11
11
  const { Hero, HeroImage, HeroHeader } = getSectionOverrides(
12
12
  {
@@ -14,7 +14,7 @@ const { Hero, HeroImage, HeroHeader } = getSectionOverrides(
14
14
  HeroImage: UIHeroImage,
15
15
  HeroHeader: UIHeroHeader,
16
16
  },
17
- override as HeroOverrideDefinition
17
+ override as SectionOverrideDefinition<'Hero'>
18
18
  )
19
19
 
20
20
  export { Hero, HeroImage, HeroHeader }
@@ -12,9 +12,9 @@ import {
12
12
  IconButton as UIIconButton,
13
13
  } from '@faststore/ui'
14
14
 
15
- import { getSectionOverrides } from 'src/utils/overrides'
15
+ import { getSectionOverrides } from 'src/sdk/overrides/overrides'
16
16
  import { override } from 'src/customizations/src/components/overrides/Navbar'
17
- import type { NavbarOverrideDefinition } from 'src/typings/overrides'
17
+ import type { SectionOverrideDefinition } from 'src/typings/overridesDefinition'
18
18
 
19
19
  const {
20
20
  Navbar,
@@ -42,7 +42,7 @@ const {
42
42
  NavbarButtons: UINavbarButtons,
43
43
  IconButton: UIIconButton,
44
44
  },
45
- override as NavbarOverrideDefinition
45
+ override as SectionOverrideDefinition<'Navbar'>
46
46
  )
47
47
 
48
48
  export {
@@ -5,9 +5,9 @@ import {
5
5
  } from '@faststore/ui'
6
6
  import { NewsletterAddendum } from 'src/components/ui/Newsletter/NewsletterAddendum'
7
7
 
8
- import { getSectionOverrides } from 'src/utils/overrides'
8
+ import { getSectionOverrides } from 'src/sdk/overrides/overrides'
9
9
  import { override } from 'src/customizations/src/components/overrides/Newsletter'
10
- import type { NewsletterOverrideDefinition } from 'src/typings/overrides'
10
+ import type { SectionOverrideDefinition } from 'src/typings/overridesDefinition'
11
11
 
12
12
  const {
13
13
  ToastIconSuccess,
@@ -27,7 +27,7 @@ const {
27
27
  Button: UIButton,
28
28
  __experimentalNewsletterAddendum: NewsletterAddendum,
29
29
  },
30
- override as NewsletterOverrideDefinition
30
+ override as SectionOverrideDefinition<'Newsletter'>
31
31
  )
32
32
 
33
33
  export {
@@ -16,9 +16,9 @@ import LocalShippingSimulation from 'src/components/ui/ShippingSimulation/Shippi
16
16
  import { Image } from 'src/components/ui/Image'
17
17
  import LocalNotAvailableButton from 'src/components/product/NotAvailableButton'
18
18
 
19
- import { getSectionOverrides } from 'src/utils/overrides'
19
+ import { getSectionOverrides } from 'src/sdk/overrides/overrides'
20
20
  import { override } from 'src/customizations/src/components/overrides/ProductDetails'
21
- import type { ProductDetailsOverrideDefinition } from 'src/typings/overrides'
21
+ import type { SectionOverrideDefinition } from 'src/typings/overridesDefinition'
22
22
 
23
23
  const {
24
24
  ProductTitle,
@@ -52,7 +52,7 @@ const {
52
52
  __experimentalShippingSimulation: LocalShippingSimulation,
53
53
  __experimentalNotAvailableButton: LocalNotAvailableButton,
54
54
  },
55
- override as ProductDetailsOverrideDefinition
55
+ override as SectionOverrideDefinition<'ProductDetails'>
56
56
  )
57
57
 
58
58
  export {
@@ -13,9 +13,9 @@ const FilterSlider = lazy(
13
13
  () => import('src/components/search/Filter/FilterSlider')
14
14
  )
15
15
 
16
- import { getSectionOverrides } from 'src/utils/overrides'
16
+ import { getSectionOverrides } from 'src/sdk/overrides/overrides'
17
17
  import { override } from 'src/customizations/src/components/overrides/ProductGallery'
18
- import type { ProductGalleryOverrideDefinition } from 'src/typings/overrides'
18
+ import type { SectionOverrideDefinition } from 'src/typings/overridesDefinition'
19
19
 
20
20
  const {
21
21
  MobileFilterButton,
@@ -43,7 +43,7 @@ const {
43
43
  __experimentalFilterSlider: FilterSlider,
44
44
  __experimentalProductCard: ProductCard,
45
45
  },
46
- override as ProductGalleryOverrideDefinition
46
+ override as SectionOverrideDefinition<'ProductGallery'>
47
47
  )
48
48
 
49
49
  export {
@@ -3,9 +3,9 @@ import { ProductShelf as UIProductShelf } from '@faststore/ui'
3
3
  import ProductCard from 'src/components/product/ProductCard'
4
4
  import Carousel from 'src/components/ui/Carousel'
5
5
 
6
- import { getSectionOverrides } from 'src/utils/overrides'
6
+ import { getSectionOverrides } from 'src/sdk/overrides/overrides'
7
7
  import { override } from 'src/customizations/src/components/overrides/ProductShelf'
8
- import type { ProductShelfOverrideDefinition } from 'src/typings/overrides'
8
+ import type { SectionOverrideDefinition } from 'src/typings/overridesDefinition'
9
9
 
10
10
  const { ProductShelf, __experimentalCarousel, __experimentalProductCard } =
11
11
  getSectionOverrides(
@@ -14,7 +14,7 @@ const { ProductShelf, __experimentalCarousel, __experimentalProductCard } =
14
14
  __experimentalCarousel: Carousel,
15
15
  __experimentalProductCard: ProductCard,
16
16
  },
17
- override as ProductShelfOverrideDefinition
17
+ override as SectionOverrideDefinition<'ProductShelf'>
18
18
  )
19
19
 
20
20
  export { ProductShelf, __experimentalCarousel, __experimentalProductCard }
@@ -1,8 +1,8 @@
1
1
  import { RegionBar as UIRegionBar, Icon as UIIcon } from '@faststore/ui'
2
2
 
3
- import { getSectionOverrides } from 'src/utils/overrides'
3
+ import { getSectionOverrides } from 'src/sdk/overrides/overrides'
4
4
  import { override } from 'src/customizations/src/components/overrides/RegionBar'
5
- import type { RegionBarOverrideDefinition } from 'src/typings/overrides'
5
+ import type { SectionOverrideDefinition } from 'src/typings/overridesDefinition'
6
6
 
7
7
  const { RegionBar, LocationIcon, ButtonIcon } = getSectionOverrides(
8
8
  {
@@ -10,7 +10,7 @@ const { RegionBar, LocationIcon, ButtonIcon } = getSectionOverrides(
10
10
  LocationIcon: UIIcon,
11
11
  ButtonIcon: UIIcon,
12
12
  },
13
- override as RegionBarOverrideDefinition
13
+ override as SectionOverrideDefinition<'RegionBar'>
14
14
  )
15
15
 
16
16
  export { RegionBar, LocationIcon, ButtonIcon }
@@ -1,6 +1,8 @@
1
1
  import { forwardRef } from 'react'
2
2
  import type { DetailedHTMLProps, HTMLAttributes } from 'react'
3
3
 
4
+ import { useOverrideClassName } from 'src/sdk/overrides/OverrideContext'
5
+
4
6
  type BaseProps = DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>
5
7
 
6
8
  type SectionProps = BaseProps & {
@@ -11,10 +13,15 @@ const Section = forwardRef<HTMLDivElement, SectionProps>(function Section(
11
13
  { as, className = '', ...otherProps },
12
14
  ref
13
15
  ) {
16
+ const overrideClassName = useOverrideClassName() ?? ''
14
17
  const Component = as ?? 'section'
15
18
 
16
19
  return (
17
- <Component ref={ref} className={`section ${className}`} {...otherProps} />
20
+ <Component
21
+ ref={ref}
22
+ className={`section ${className} ${overrideClassName}`.trim()}
23
+ {...otherProps}
24
+ />
18
25
  )
19
26
  })
20
27
 
@@ -0,0 +1,27 @@
1
+ import { createContext, useContext } from 'react'
2
+
3
+ import type { OverriddenComponents } from '../../typings/overridesDefinition'
4
+ import type { SectionsOverrides } from '../../typings/overrides'
5
+
6
+ type OverrideContextType<
7
+ SectionName extends keyof SectionsOverrides = keyof SectionsOverrides
8
+ > = {
9
+ className?: string
10
+ components: OverriddenComponents<SectionName>
11
+ }
12
+
13
+ const OverrideContext = createContext<OverrideContextType>(null)
14
+
15
+ export const OverrideProvider = OverrideContext.Provider
16
+
17
+ export const useOverrideContext = <
18
+ SectionName extends keyof SectionsOverrides = keyof SectionsOverrides
19
+ >() => useContext(OverrideContext) as OverrideContextType<SectionName>
20
+
21
+ export const useOverrideComponents = <
22
+ SectionName extends keyof SectionsOverrides = keyof SectionsOverrides
23
+ >() =>
24
+ useContext(OverrideContext)
25
+ .components as OverrideContextType<SectionName>['components']
26
+
27
+ export const useOverrideClassName = () => useContext(OverrideContext)?.className