@faststore/core 2.0.101-alpha.0 → 2.0.103-alpha.0

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 (160) hide show
  1. package/.turbo/turbo-build.log +6 -6
  2. package/CHANGELOG.md +12 -0
  3. package/cypress/integration/analytics.test.js +2 -2
  4. package/cypress/integration/cart.test.js +4 -4
  5. package/package.json +4 -4
  6. package/src/components/cart/CartSidebar/CartSidebar.tsx +16 -40
  7. package/src/components/cart/OrderSummary/OrderSummary.tsx +2 -6
  8. package/src/components/sections/ProductDetails/ProductDetails.tsx +1 -1
  9. package/src/components/ui/ImageGallery/ImageGallery.tsx +28 -24
  10. package/src/components/ui/ImageGallery/index.ts +2 -4
  11. package/.next/BUILD_ID +0 -1
  12. package/.next/build-manifest.json +0 -99
  13. package/.next/cache/.tsbuildinfo +0 -1
  14. package/.next/cache/config.json +0 -7
  15. package/.next/cache/eslint/.cache_1gneedd +0 -1
  16. package/.next/cache/next-server.js.nft.json +0 -1
  17. package/.next/cache/webpack/client-production/0.pack +0 -0
  18. package/.next/cache/webpack/client-production/index.pack +0 -0
  19. package/.next/cache/webpack/server-production/0.pack +0 -0
  20. package/.next/cache/webpack/server-production/index.pack +0 -0
  21. package/.next/export-marker.json +0 -1
  22. package/.next/images-manifest.json +0 -1
  23. package/.next/next-server.js.nft.json +0 -1
  24. package/.next/package.json +0 -1
  25. package/.next/prerender-manifest.json +0 -1
  26. package/.next/react-loadable-manifest.json +0 -44
  27. package/.next/required-server-files.json +0 -1
  28. package/.next/routes-manifest.json +0 -1
  29. package/.next/server/chunks/120.js +0 -435
  30. package/.next/server/chunks/123.js +0 -58
  31. package/.next/server/chunks/1394.js +0 -3801
  32. package/.next/server/chunks/1608.js +0 -515
  33. package/.next/server/chunks/2154.js +0 -206
  34. package/.next/server/chunks/247.js +0 -61
  35. package/.next/server/chunks/2914.js +0 -95
  36. package/.next/server/chunks/2922.js +0 -7293
  37. package/.next/server/chunks/3264.js +0 -67
  38. package/.next/server/chunks/3431.js +0 -7241
  39. package/.next/server/chunks/350.js +0 -142
  40. package/.next/server/chunks/3746.js +0 -237
  41. package/.next/server/chunks/3898.js +0 -240
  42. package/.next/server/chunks/4312.js +0 -674
  43. package/.next/server/chunks/4371.js +0 -1473
  44. package/.next/server/chunks/5098.js +0 -124
  45. package/.next/server/chunks/5576.js +0 -72
  46. package/.next/server/chunks/6280.js +0 -322
  47. package/.next/server/chunks/6465.js +0 -91
  48. package/.next/server/chunks/676.js +0 -32
  49. package/.next/server/chunks/6859.js +0 -959
  50. package/.next/server/chunks/6881.js +0 -320
  51. package/.next/server/chunks/6898.js +0 -149
  52. package/.next/server/chunks/7104.js +0 -196
  53. package/.next/server/chunks/7181.js +0 -658
  54. package/.next/server/chunks/7183.js +0 -72
  55. package/.next/server/chunks/7992.js +0 -570
  56. package/.next/server/chunks/8098.js +0 -246
  57. package/.next/server/chunks/810.js +0 -432
  58. package/.next/server/chunks/8287.js +0 -58
  59. package/.next/server/chunks/9143.js +0 -106
  60. package/.next/server/chunks/9152.js +0 -213
  61. package/.next/server/chunks/953.js +0 -646
  62. package/.next/server/chunks/9557.js +0 -117
  63. package/.next/server/chunks/9854.js +0 -72
  64. package/.next/server/chunks/font-manifest.json +0 -1
  65. package/.next/server/font-manifest.json +0 -1
  66. package/.next/server/middleware-build-manifest.js +0 -1
  67. package/.next/server/middleware-manifest.json +0 -6
  68. package/.next/server/middleware-react-loadable-manifest.js +0 -1
  69. package/.next/server/pages/404.js.nft.json +0 -1
  70. package/.next/server/pages/500.js.nft.json +0 -1
  71. package/.next/server/pages/[...slug].js +0 -671
  72. package/.next/server/pages/[...slug].js.nft.json +0 -1
  73. package/.next/server/pages/[slug]/p.js +0 -2393
  74. package/.next/server/pages/[slug]/p.js.nft.json +0 -1
  75. package/.next/server/pages/_app.js +0 -2369
  76. package/.next/server/pages/_app.js.nft.json +0 -1
  77. package/.next/server/pages/_document.js +0 -304
  78. package/.next/server/pages/_document.js.nft.json +0 -1
  79. package/.next/server/pages/_error.js +0 -164
  80. package/.next/server/pages/_error.js.nft.json +0 -1
  81. package/.next/server/pages/account.js.nft.json +0 -1
  82. package/.next/server/pages/api/graphql.js +0 -315
  83. package/.next/server/pages/api/graphql.js.nft.json +0 -1
  84. package/.next/server/pages/api/preview.js +0 -118
  85. package/.next/server/pages/api/preview.js.nft.json +0 -1
  86. package/.next/server/pages/checkout.js.nft.json +0 -1
  87. package/.next/server/pages/en-US/404.html +0 -81
  88. package/.next/server/pages/en-US/500.html +0 -81
  89. package/.next/server/pages/en-US/account.html +0 -81
  90. package/.next/server/pages/en-US/checkout.html +0 -81
  91. package/.next/server/pages/en-US/login.html +0 -81
  92. package/.next/server/pages/en-US/s.html +0 -81
  93. package/.next/server/pages/en-US.html +0 -81
  94. package/.next/server/pages/en-US.json +0 -1
  95. package/.next/server/pages/index.js +0 -428
  96. package/.next/server/pages/index.js.nft.json +0 -1
  97. package/.next/server/pages/login.js.nft.json +0 -1
  98. package/.next/server/pages/s.js.nft.json +0 -1
  99. package/.next/server/pages-manifest.json +0 -16
  100. package/.next/server/webpack-api-runtime.js +0 -229
  101. package/.next/server/webpack-runtime.js +0 -229
  102. package/.next/static/V0z729OIqsX7azqcAGJ5Q/_buildManifest.js +0 -1
  103. package/.next/static/V0z729OIqsX7azqcAGJ5Q/_ssgManifest.js +0 -1
  104. package/.next/static/chunks/143.dd8a556e6957baa1.js +0 -1
  105. package/.next/static/chunks/152.57849458d8337a92.js +0 -1
  106. package/.next/static/chunks/264-6dc2258a751b3d74.js +0 -1
  107. package/.next/static/chunks/351-a4e28d64f48c5269.js +0 -1
  108. package/.next/static/chunks/608.59e69b83f35d9c44.js +0 -1
  109. package/.next/static/chunks/651.7142f31ce1e052b3.js +0 -1
  110. package/.next/static/chunks/686.6c345856d484363b.js +0 -1
  111. package/.next/static/chunks/741.52f7fb873418346f.js +0 -1
  112. package/.next/static/chunks/781-7df372b5b56e3f96.js +0 -1
  113. package/.next/static/chunks/843.e1d0f9260a52f32c.js +0 -1
  114. package/.next/static/chunks/98.97381d2021f86cd9.js +0 -1
  115. package/.next/static/chunks/996.64460309250b214c.js +0 -1
  116. package/.next/static/chunks/framework-dfd14d7ce6600b03.js +0 -1
  117. package/.next/static/chunks/main-9746772201fe3ac1.js +0 -1
  118. package/.next/static/chunks/pages/404-ba608a2a9f0c420a.js +0 -1
  119. package/.next/static/chunks/pages/500-910883c20541d9ce.js +0 -1
  120. package/.next/static/chunks/pages/[...slug]-417e3b51bda1f5f3.js +0 -1
  121. package/.next/static/chunks/pages/[slug]/p-cbb4ca8d57bafa9f.js +0 -1
  122. package/.next/static/chunks/pages/_app-6dc7b0c168e15d5c.js +0 -1
  123. package/.next/static/chunks/pages/_error-a7a0c1d9bfbb4f38.js +0 -1
  124. package/.next/static/chunks/pages/account-b8fc5222ffe89b60.js +0 -1
  125. package/.next/static/chunks/pages/checkout-f8cb7cb22225ef9d.js +0 -1
  126. package/.next/static/chunks/pages/index-9ea3f7868f5ed138.js +0 -1
  127. package/.next/static/chunks/pages/login-33954810b200eca8.js +0 -1
  128. package/.next/static/chunks/pages/s-ba2868e14fedb65b.js +0 -1
  129. package/.next/static/chunks/polyfills-c67a75d1b6f99dc8.js +0 -1
  130. package/.next/static/chunks/webpack-65b155971f3eac57.js +0 -1
  131. package/.next/static/css/10db3bc7ecdf0556.css +0 -1
  132. package/.next/static/css/43d61b402f41569b.css +0 -1
  133. package/.next/static/css/4899c3cc356704f9.css +0 -1
  134. package/.next/static/css/6507cb48401e73a4.css +0 -1
  135. package/.next/static/css/8ea129ea90e49e98.css +0 -1
  136. package/.next/static/css/b2f16bd4b93e0aca.css +0 -1
  137. package/.next/static/css/db63ea05e98cb7e8.css +0 -1
  138. package/.next/static/css/ea60a7e6c07ee644.css +0 -1
  139. package/.next/static/media/brandless-neutral.76ddf63a.png +0 -0
  140. package/.next/trace +0 -65
  141. package/public/~partytown/debug/partytown-atomics.js +0 -556
  142. package/public/~partytown/debug/partytown-media.js +0 -374
  143. package/public/~partytown/debug/partytown-sandbox-sw.js +0 -543
  144. package/public/~partytown/debug/partytown-sw.js +0 -59
  145. package/public/~partytown/debug/partytown-ww-atomics.js +0 -1789
  146. package/public/~partytown/debug/partytown-ww-sw.js +0 -1781
  147. package/public/~partytown/debug/partytown.js +0 -72
  148. package/public/~partytown/partytown-atomics.js +0 -2
  149. package/public/~partytown/partytown-media.js +0 -2
  150. package/public/~partytown/partytown-sw.js +0 -2
  151. package/public/~partytown/partytown.js +0 -2
  152. package/src/components/cart/CartItem/CartItem.stories.mdx +0 -134
  153. package/src/components/cart/CartSidebar/CartSidebar.stories.mdx +0 -105
  154. package/src/components/cart/CartSidebar/cart-sidebar.module.scss +0 -57
  155. package/src/components/cart/OrderSummary/order-summary.module.scss +0 -22
  156. package/src/components/ui/ImageGallery/ImageGallery.stories.mdx +0 -173
  157. package/src/components/ui/ImageGallery/ImageGallerySelector.tsx +0 -121
  158. package/src/components/ui/ImageGallery/ImageZoom.tsx +0 -12
  159. package/src/components/ui/ImageGallery/image-gallery-selector.module.scss +0 -137
  160. package/src/components/ui/ImageGallery/image-gallery.module.scss +0 -56
@@ -27,8 +27,8 @@ Route (pages) Size First Load JS
27
27
  ├ /_app 0 B 96.7 kB
28
28
  ├ ● /[...slug] 9.48 kB 122 kB
29
29
  ├ └ css/8ea129ea90e49e98.css 1.83 kB
30
- ├ ● /[slug]/p 16.8 kB 125 kB
31
- ├ └ css/4899c3cc356704f9.css 2.82 kB
30
+ ├ ● /[slug]/p 16.9 kB 125 kB
31
+ ├ └ css/8d4cc2151b8e3693.css 1.99 kB
32
32
  ├ ○ /404 431 B 102 kB
33
33
  ├ ○ /500 439 B 102 kB
34
34
  ├ ○ /account 383 B 102 kB
@@ -38,12 +38,12 @@ Route (pages) Size First Load JS
38
38
  ├ ○ /login 385 B 102 kB
39
39
  └ ○ /s 895 B 113 kB
40
40
  └ css/db63ea05e98cb7e8.css 1.63 kB
41
- + First Load JS shared by all 119 kB
41
+ + First Load JS shared by all 120 kB
42
42
  ├ chunks/framework-dfd14d7ce6600b03.js 45.3 kB
43
43
  ├ chunks/main-9746772201fe3ac1.js 23.9 kB
44
- ├ chunks/pages/_app-6dc7b0c168e15d5c.js 25.3 kB
45
- ├ chunks/webpack-65b155971f3eac57.js 2.18 kB
46
- └ css/ea60a7e6c07ee644.css 22 kB
44
+ ├ chunks/pages/_app-97338478d9610735.js 25.3 kB
45
+ ├ chunks/webpack-83d8a1e4ecde9dde.js 2.19 kB
46
+ └ css/3802630cd2375b43.css 23.1 kB
47
47
 
48
48
  λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
49
49
  ○ (Static) automatically rendered as static HTML (uses no initial props)
package/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.0.103-alpha.0](https://github.com/vtex/faststore/compare/v2.0.102-alpha.0...v2.0.103-alpha.0) (2023-04-06)
7
+
8
+ ### Features
9
+
10
+ - Add `ImageGallery` components ([#1681](https://github.com/vtex/faststore/issues/1681)) ([b44101c](https://github.com/vtex/faststore/commit/b44101c932b0758f9c1b09ee001d3221c338cf93)), closes [starter.store#37](https://github.com/vtex/starter.store/issues/37)
11
+
12
+ ## [2.0.102-alpha.0](https://github.com/vtex/faststore/compare/v2.0.101-alpha.0...v2.0.102-alpha.0) (2023-04-06)
13
+
14
+ ### Features
15
+
16
+ - Adds `CartSidebar` and `OrderSummary` ([#1704](https://github.com/vtex/faststore/issues/1704)) ([a16e168](https://github.com/vtex/faststore/commit/a16e1683816ef84866de4cd7f8d8a64f951b98c6))
17
+
6
18
  ## [2.0.101-alpha.0](https://github.com/vtex/faststore/compare/v2.0.100-alpha.0...v2.0.101-alpha.0) (2023-04-05)
7
19
 
8
20
  ### Bug Fixes
@@ -375,7 +375,7 @@ describe('view_cart event', () => {
375
375
  cy.waitForHydration()
376
376
 
377
377
  cy.getById('cart-toggle').click()
378
- cy.getById('cart-sidebar').should('be.visible')
378
+ cy.getById('fs-cart-sidebar').should('be.visible')
379
379
 
380
380
  dataLayerHasEvent('view_cart')
381
381
 
@@ -398,7 +398,7 @@ describe('view_cart event', () => {
398
398
  .scrollIntoView({ duration: 500 })
399
399
  .then(() => {
400
400
  cy.getById('buy-button').click({ force: true })
401
- cy.getById('cart-sidebar').should('be.visible')
401
+ cy.getById('fs-cart-sidebar').should('be.visible')
402
402
 
403
403
  dataLayerHasEvent('view_cart')
404
404
 
@@ -19,9 +19,9 @@ describe('Cart Sidebar', () => {
19
19
  cy.waitForHydration()
20
20
 
21
21
  cy.getById('cart-toggle').first().click()
22
- cy.getById('cart-sidebar').should('exist')
23
- cy.getById('cart-sidebar-button-close').first().click()
24
- cy.getById('cart-sidebar').should('not.exist')
22
+ cy.getById('fs-cart-sidebar').should('exist')
23
+ cy.getById('fs-cart-sidebar-button-close').first().click()
24
+ cy.getById('fs-cart-sidebar').should('not.exist')
25
25
  })
26
26
 
27
27
  context('when opening the cart sidebar', () => {
@@ -31,7 +31,7 @@ describe('Cart Sidebar', () => {
31
31
 
32
32
  // window scrolls to keep cart-toggle on the screen initially
33
33
  cy.getById('cart-toggle').click()
34
- cy.getById('cart-sidebar').should('exist')
34
+ cy.getById('fs-cart-sidebar').should('exist')
35
35
 
36
36
  // simulate touch scroll. Do not use window.scrollTo
37
37
  cy.get('[data-fs-empty-state]')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/core",
3
- "version": "2.0.101-alpha.0",
3
+ "version": "2.0.103-alpha.0",
4
4
  "license": "MIT",
5
5
  "browserslist": "supports es6-module and not dead",
6
6
  "scripts": {
@@ -30,10 +30,10 @@
30
30
  "@envelop/parser-cache": "^2.2.0",
31
31
  "@envelop/validation-cache": "^2.2.0",
32
32
  "@faststore/api": "^2.0.97-alpha.0",
33
- "@faststore/components": "^2.0.101-alpha.0",
33
+ "@faststore/components": "^2.0.103-alpha.0",
34
34
  "@faststore/graphql-utils": "^2.0.3-alpha.0",
35
35
  "@faststore/sdk": "^2.0.3-alpha.0",
36
- "@faststore/ui": "^2.0.99-alpha.0",
36
+ "@faststore/ui": "^2.0.103-alpha.0",
37
37
  "@types/react": "^18.0.14",
38
38
  "@vtex/client-cms": "^0.2.12",
39
39
  "autoprefixer": "^10.4.0",
@@ -108,5 +108,5 @@
108
108
  "msw": {
109
109
  "workerDirectory": "public"
110
110
  },
111
- "gitHead": "b7378bff2215b1edab942092e8c4faffbe9b1572"
111
+ "gitHead": "cac804588d1f91794f39bf7b7ce8e18234a7286a"
112
112
  }
@@ -1,11 +1,9 @@
1
1
  import { sendAnalyticsEvent } from '@faststore/sdk'
2
2
  import {
3
- Alert as UIAlert,
4
- Badge as UIBadge,
3
+ CartSidebar as UICartSidebar,
4
+ CartSidebarList as UICartSidebarList,
5
+ CartSidebarFooter as UICartSidebarFooter,
5
6
  Button as UIButton,
6
- List as UIList,
7
- SlideOver as UISlideOver,
8
- SlideOverHeader as UISlideOverHeader,
9
7
  } from '@faststore/ui'
10
8
 
11
9
  import type { CurrencyCode, ViewCartEvent } from '@faststore/sdk'
@@ -20,14 +18,13 @@ import Gift from '../../ui/Gift'
20
18
  import CartItem from '../CartItem'
21
19
  import EmptyCart from '../EmptyCart'
22
20
  import OrderSummary from '../OrderSummary'
23
- import styles from './cart-sidebar.module.scss'
24
21
 
25
22
  function CartSidebar() {
26
23
  const { currency } = useSession()
27
24
  const btnProps = useCheckoutButton()
28
25
  const cart = useCart()
29
- const { cart: displayCart, closeCart } = useUI()
30
- const { fade, fadeOut } = useFadeEffect()
26
+ const { closeCart } = useUI()
27
+ const { fadeOut } = useFadeEffect()
31
28
 
32
29
  const { items, gifts, totalItems, isValidating, subTotal, total } = cart
33
30
 
@@ -56,38 +53,18 @@ function CartSidebar() {
56
53
  // eslint-disable-next-line react-hooks/exhaustive-deps
57
54
  }, [])
58
55
 
59
- const closeBtnProps = {
60
- testId: 'cart-sidebar-button-close',
61
- }
62
-
63
56
  return (
64
- <UISlideOver
65
- fade={fade}
66
- isOpen={displayCart}
67
- onDismiss={() => fadeOut()}
68
- size="partial"
69
- direction="rightSide"
70
- className={styles.fsCartSidebar}
71
- onTransitionEnd={() => fade === 'out' && closeCart()}
72
- data-testid="cart-sidebar"
57
+ <UICartSidebar
58
+ totalItems={totalItems}
59
+ alertIcon={<Icon name="Truck" />}
60
+ alertText="Free shipping starts at $300"
61
+ onClose={fadeOut}
73
62
  >
74
- <UISlideOverHeader closeBtnProps={closeBtnProps} onClose={fadeOut}>
75
- <div data-fs-cart-sidebar-title>
76
- <p data-fs-cart-sidebar-title-text className="text__lead">
77
- Your Cart
78
- </p>
79
- <UIBadge variant="info">{totalItems}</UIBadge>
80
- </div>
81
- </UISlideOverHeader>
82
- <UIAlert icon={<Icon name="Truck" />}>
83
- Free shipping starts at $300
84
- </UIAlert>
85
-
86
63
  {isEmpty ? (
87
- <EmptyCart onDismiss={fadeOut} />
64
+ <EmptyCart onDismiss={closeCart} />
88
65
  ) : (
89
66
  <>
90
- <UIList data-fs-cart-sidebar-list>
67
+ <UICartSidebarList>
91
68
  {items.map((item) => (
92
69
  <li key={item.id}>
93
70
  <CartItem item={item} />
@@ -102,16 +79,15 @@ function CartSidebar() {
102
79
  ))}
103
80
  </>
104
81
  )}
105
- </UIList>
82
+ </UICartSidebarList>
106
83
 
107
- <footer data-fs-cart-sidebar-footer>
84
+ <UICartSidebarFooter>
108
85
  <OrderSummary
109
86
  subTotal={subTotal}
110
87
  total={total}
111
88
  numberOfItems={totalItems}
112
89
  checkoutButton={
113
90
  <UIButton
114
- data-fs-cart-sidebar-checkout-button
115
91
  variant="primary"
116
92
  icon={
117
93
  !isValidating && (
@@ -125,10 +101,10 @@ function CartSidebar() {
125
101
  </UIButton>
126
102
  }
127
103
  />
128
- </footer>
104
+ </UICartSidebarFooter>
129
105
  </>
130
106
  )}
131
- </UISlideOver>
107
+ </UICartSidebar>
132
108
  )
133
109
  }
134
110
 
@@ -3,8 +3,6 @@ import type { ReactNode } from 'react'
3
3
 
4
4
  import { useFormattedPrice } from 'src/sdk/product/useFormattedPrice'
5
5
 
6
- import styles from './order-summary.module.scss'
7
-
8
6
  interface OrderSummaryProps {
9
7
  subTotal: number
10
8
  total: number
@@ -22,17 +20,15 @@ function OrderSummary({
22
20
  const formattedDiscount = useFormattedPrice(discount)
23
21
 
24
22
  return (
25
- <div className={styles.fsOrderSummary}>
23
+ <>
26
24
  <UIOrderSummary
27
25
  subtotalLabel={`Subtotal (${numberOfItems} products)`}
28
26
  subtotalValue={useFormattedPrice(subTotal)}
29
- discountLabel="Discount"
30
27
  discountValue={discount > 0 ? `-${formattedDiscount}` : undefined}
31
- totalLabel="Total"
32
28
  totalValue={useFormattedPrice(total)}
33
29
  />
34
30
  {checkoutButton}
35
- </div>
31
+ </>
36
32
  )
37
33
  }
38
34
 
@@ -13,7 +13,7 @@ import {
13
13
  import type { ProductDetailsFragment_ProductFragment } from '@generated/graphql'
14
14
  import OutOfStock from 'src/components/product/OutOfStock'
15
15
  import Breadcrumb from 'src/components/ui/Breadcrumb'
16
- import { ImageGallery } from 'src/components/ui/ImageGallery'
16
+ import ImageGallery from 'src/components/ui/ImageGallery'
17
17
  import ShippingSimulation from 'src/components/ui/ShippingSimulation'
18
18
  import Selectors from 'src/components/ui/SkuSelector'
19
19
  import type { AnalyticsItem } from 'src/sdk/analytics/types'
@@ -1,29 +1,40 @@
1
- import type { HTMLAttributes } from 'react'
2
- import { useState } from 'react'
1
+ import { useEffect, useState } from 'react'
2
+ import {
3
+ ImageGallery as UIImageGallery,
4
+ ImageElementData,
5
+ ImageZoom,
6
+ } from '@faststore/ui'
3
7
 
4
8
  import { Image } from 'src/components/ui/Image'
5
- import styles from 'src/components/ui/ImageGallery/image-gallery.module.scss'
9
+ import { useRouter } from 'next/router'
6
10
 
7
- import { ImageGallerySelector, ImageZoom } from '.'
11
+ const ImageComponent = ({ url, alternateName }) => (
12
+ <Image
13
+ src={url}
14
+ alt={alternateName}
15
+ sizes="(max-width: 72px) 25vw, 30vw"
16
+ width={72}
17
+ height={72}
18
+ />
19
+ )
8
20
 
9
- export interface ImageElementData {
10
- url: string
11
- alternateName: string
12
- }
13
-
14
- interface ImageGalleryProps extends HTMLAttributes<HTMLDivElement> {
21
+ export interface ImageGalleryProps {
15
22
  images: ImageElementData[]
16
23
  }
17
24
 
18
- function ImageGallery({ images, ...otherProps }: ImageGalleryProps) {
25
+ const ImageGallery = ({ images, ...otherProps }: ImageGalleryProps) => {
19
26
  const [selectedImageIdx, setSelectedImageIdx] = useState(0)
20
- const currentImage = images[selectedImageIdx]
21
- const hasSelector = images.length > 1
27
+ const currentImage = images[selectedImageIdx] ?? images[0]
28
+ const dynamicRoute = useRouter().asPath
29
+
30
+ useEffect(() => setSelectedImageIdx(0), [dynamicRoute])
22
31
 
23
32
  return (
24
- <section
25
- data-fs-image-gallery={hasSelector ? 'with-selector' : 'without-selector'}
26
- className={styles.fsImageGallery}
33
+ <UIImageGallery
34
+ images={images}
35
+ ImageComponent={ImageComponent}
36
+ selectedImageIdx={selectedImageIdx}
37
+ setSelectedImageIdx={setSelectedImageIdx}
27
38
  {...otherProps}
28
39
  >
29
40
  <ImageZoom>
@@ -37,14 +48,7 @@ function ImageGallery({ images, ...otherProps }: ImageGalleryProps) {
37
48
  priority
38
49
  />
39
50
  </ImageZoom>
40
- {hasSelector && (
41
- <ImageGallerySelector
42
- images={images}
43
- currentImageIdx={selectedImageIdx}
44
- onSelect={setSelectedImageIdx}
45
- />
46
- )}
47
- </section>
51
+ </UIImageGallery>
48
52
  )
49
53
  }
50
54
 
@@ -1,4 +1,2 @@
1
- export { default as ImageGallerySelector } from './ImageGallerySelector'
2
- export { default as ImageGallery } from './ImageGallery'
3
- export { default as ImageZoom } from './ImageZoom'
4
- export type { ImageElementData } from './ImageGallery'
1
+ export { default } from './ImageGallery'
2
+ export type { ImageGalleryProps } from './ImageGallery'
package/.next/BUILD_ID DELETED
@@ -1 +0,0 @@
1
- V0z729OIqsX7azqcAGJ5Q
@@ -1,99 +0,0 @@
1
- {
2
- "polyfillFiles": [
3
- "static/chunks/polyfills-c67a75d1b6f99dc8.js"
4
- ],
5
- "devFiles": [],
6
- "ampDevFiles": [],
7
- "lowPriorityFiles": [
8
- "static/V0z729OIqsX7azqcAGJ5Q/_buildManifest.js",
9
- "static/V0z729OIqsX7azqcAGJ5Q/_ssgManifest.js"
10
- ],
11
- "rootMainFiles": [],
12
- "pages": {
13
- "/": [
14
- "static/chunks/webpack-65b155971f3eac57.js",
15
- "static/chunks/framework-dfd14d7ce6600b03.js",
16
- "static/chunks/main-9746772201fe3ac1.js",
17
- "static/chunks/351-a4e28d64f48c5269.js",
18
- "static/chunks/781-7df372b5b56e3f96.js",
19
- "static/css/43d61b402f41569b.css",
20
- "static/chunks/pages/index-9ea3f7868f5ed138.js"
21
- ],
22
- "/404": [
23
- "static/chunks/webpack-65b155971f3eac57.js",
24
- "static/chunks/framework-dfd14d7ce6600b03.js",
25
- "static/chunks/main-9746772201fe3ac1.js",
26
- "static/chunks/351-a4e28d64f48c5269.js",
27
- "static/chunks/pages/404-ba608a2a9f0c420a.js"
28
- ],
29
- "/500": [
30
- "static/chunks/webpack-65b155971f3eac57.js",
31
- "static/chunks/framework-dfd14d7ce6600b03.js",
32
- "static/chunks/main-9746772201fe3ac1.js",
33
- "static/chunks/351-a4e28d64f48c5269.js",
34
- "static/chunks/pages/500-910883c20541d9ce.js"
35
- ],
36
- "/[...slug]": [
37
- "static/chunks/webpack-65b155971f3eac57.js",
38
- "static/chunks/framework-dfd14d7ce6600b03.js",
39
- "static/chunks/main-9746772201fe3ac1.js",
40
- "static/chunks/351-a4e28d64f48c5269.js",
41
- "static/chunks/264-6dc2258a751b3d74.js",
42
- "static/css/8ea129ea90e49e98.css",
43
- "static/chunks/pages/[...slug]-417e3b51bda1f5f3.js"
44
- ],
45
- "/[slug]/p": [
46
- "static/chunks/webpack-65b155971f3eac57.js",
47
- "static/chunks/framework-dfd14d7ce6600b03.js",
48
- "static/chunks/main-9746772201fe3ac1.js",
49
- "static/chunks/351-a4e28d64f48c5269.js",
50
- "static/chunks/781-7df372b5b56e3f96.js",
51
- "static/css/4899c3cc356704f9.css",
52
- "static/chunks/pages/[slug]/p-cbb4ca8d57bafa9f.js"
53
- ],
54
- "/_app": [
55
- "static/chunks/webpack-65b155971f3eac57.js",
56
- "static/chunks/framework-dfd14d7ce6600b03.js",
57
- "static/chunks/main-9746772201fe3ac1.js",
58
- "static/css/ea60a7e6c07ee644.css",
59
- "static/chunks/pages/_app-6dc7b0c168e15d5c.js"
60
- ],
61
- "/_error": [
62
- "static/chunks/webpack-65b155971f3eac57.js",
63
- "static/chunks/framework-dfd14d7ce6600b03.js",
64
- "static/chunks/main-9746772201fe3ac1.js",
65
- "static/chunks/pages/_error-a7a0c1d9bfbb4f38.js"
66
- ],
67
- "/account": [
68
- "static/chunks/webpack-65b155971f3eac57.js",
69
- "static/chunks/framework-dfd14d7ce6600b03.js",
70
- "static/chunks/main-9746772201fe3ac1.js",
71
- "static/chunks/351-a4e28d64f48c5269.js",
72
- "static/chunks/pages/account-b8fc5222ffe89b60.js"
73
- ],
74
- "/checkout": [
75
- "static/chunks/webpack-65b155971f3eac57.js",
76
- "static/chunks/framework-dfd14d7ce6600b03.js",
77
- "static/chunks/main-9746772201fe3ac1.js",
78
- "static/chunks/351-a4e28d64f48c5269.js",
79
- "static/chunks/pages/checkout-f8cb7cb22225ef9d.js"
80
- ],
81
- "/login": [
82
- "static/chunks/webpack-65b155971f3eac57.js",
83
- "static/chunks/framework-dfd14d7ce6600b03.js",
84
- "static/chunks/main-9746772201fe3ac1.js",
85
- "static/chunks/351-a4e28d64f48c5269.js",
86
- "static/chunks/pages/login-33954810b200eca8.js"
87
- ],
88
- "/s": [
89
- "static/chunks/webpack-65b155971f3eac57.js",
90
- "static/chunks/framework-dfd14d7ce6600b03.js",
91
- "static/chunks/main-9746772201fe3ac1.js",
92
- "static/chunks/351-a4e28d64f48c5269.js",
93
- "static/chunks/264-6dc2258a751b3d74.js",
94
- "static/css/db63ea05e98cb7e8.css",
95
- "static/chunks/pages/s-ba2868e14fedb65b.js"
96
- ]
97
- },
98
- "ampFirstPages": []
99
- }