@gem-sdk/core 3.0.0-pre-production.15 → 3.0.6

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 (413) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/components/AddOn.js +2 -18
  3. package/dist/cjs/components/ComponentAnimation.js +2 -17
  4. package/dist/cjs/components/ComponentToolbarPreview.js +2 -752
  5. package/dist/cjs/components/ComponentWrapper.js +2 -61
  6. package/dist/cjs/components/ComponentWrapperPreview.js +2 -213
  7. package/dist/cjs/components/Empty.js +2 -7
  8. package/dist/cjs/components/InteractionSuffix.js +2 -42
  9. package/dist/cjs/components/Render.js +2 -75
  10. package/dist/cjs/components/Render.liquid.js +16 -307
  11. package/dist/cjs/components/RenderBlock.js +2 -54
  12. package/dist/cjs/components/RenderCustomCode.js +4 -59
  13. package/dist/cjs/components/RenderPreview.js +2 -67
  14. package/dist/cjs/components/RenderSection.js +2 -23
  15. package/dist/cjs/components/ai-generator/AIContentGenerator.js +2 -252
  16. package/dist/cjs/components/ai-generator/AIGenContentLoading.js +2 -85
  17. package/dist/cjs/components/ai-generator/components/PickProduct.js +2 -220
  18. package/dist/cjs/components/ai-generator/components/ToneAndVoice.js +2 -77
  19. package/dist/cjs/components/ai-generator/hooks/useCheckingProductInside.js +1 -47
  20. package/dist/cjs/components/ai-generator/hooks/useFlipPopup.js +1 -110
  21. package/dist/cjs/components/ai-generator/hooks/useGettingGenerateRequest.js +1 -37
  22. package/dist/cjs/components/ai-generator/hooks/useListenEventGenerate.js +1 -70
  23. package/dist/cjs/components/ai-generator/icons/AIIcon.js +2 -67
  24. package/dist/cjs/components/ai-generator/icons/CloseIcon.js +2 -19
  25. package/dist/cjs/components/ai-generator/icons/DropdownIcon.js +2 -37
  26. package/dist/cjs/components/ai-generator/icons/SearchIcon.js +2 -21
  27. package/dist/cjs/components/ai-generator/icons/ShowMoreIcon.js +2 -21
  28. package/dist/cjs/components/ai-generator/icons/UpgradeIcon.js +2 -27
  29. package/dist/cjs/components/ai-generator/icons/WarningIcon.js +2 -31
  30. package/dist/cjs/components/constant.js +1 -82
  31. package/dist/cjs/components/resize/Resize.js +2 -16
  32. package/dist/cjs/components/resize/Spacing.js +2 -260
  33. package/dist/cjs/components/src/product/helpers/variant-presets.js +1 -56
  34. package/dist/cjs/components/theme-section/CreateThemeSection.js +2 -123
  35. package/dist/cjs/components/theme-section/ThemeSectionStatus.js +2 -45
  36. package/dist/cjs/components/theme-section/ThemeSectionTooltip.js +2 -126
  37. package/dist/cjs/components/toolbar/Tooltip.js +2 -28
  38. package/dist/cjs/constants/device.js +1 -0
  39. package/dist/cjs/contexts/AddonContext.js +2 -36
  40. package/dist/cjs/contexts/ArticleContext.js +2 -39
  41. package/dist/cjs/contexts/ArticleListContext.js +2 -31
  42. package/dist/cjs/contexts/BuilderComponent.js +2 -34
  43. package/dist/cjs/contexts/BuilderContext.js +2 -39
  44. package/dist/cjs/contexts/BuilderPreviewContext.js +2 -482
  45. package/dist/cjs/contexts/CartLineContext.js +2 -29
  46. package/dist/cjs/contexts/CollectionContext.js +2 -38
  47. package/dist/cjs/contexts/I18nContext.js +2 -0
  48. package/dist/cjs/contexts/ModalContext.js +2 -47
  49. package/dist/cjs/contexts/PageContext.js +2 -111
  50. package/dist/cjs/contexts/ProductContext.js +2 -182
  51. package/dist/cjs/contexts/ProductListContext.js +2 -32
  52. package/dist/cjs/contexts/SectionContext.js +2 -53
  53. package/dist/cjs/contexts/ShopContext.js +2 -107
  54. package/dist/cjs/graphql/fragments/analytic.generated.js +2 -6
  55. package/dist/cjs/graphql/fragments/collection-detail.generated.js +2 -6
  56. package/dist/cjs/graphql/fragments/collection-product.generated.js +2 -6
  57. package/dist/cjs/graphql/fragments/collection.generated.js +2 -6
  58. package/dist/cjs/graphql/fragments/custom-code.generated.js +2 -6
  59. package/dist/cjs/graphql/fragments/custom-font.generated.js +7 -7
  60. package/dist/cjs/graphql/fragments/data-seo.generated.js +2 -6
  61. package/dist/cjs/graphql/fragments/media.generated.js +2 -6
  62. package/dist/cjs/graphql/fragments/preview-theme-page.generated.js +6 -6
  63. package/dist/cjs/graphql/fragments/product-little.generated.js +2 -6
  64. package/dist/cjs/graphql/fragments/product-option-value.generated.js +2 -6
  65. package/dist/cjs/graphql/fragments/product-option.generated.js +2 -6
  66. package/dist/cjs/graphql/fragments/product.generated.js +2 -6
  67. package/dist/cjs/graphql/fragments/published-custom-section.generated.js +2 -6
  68. package/dist/cjs/graphql/fragments/published-page-section.generated.js +2 -6
  69. package/dist/cjs/graphql/fragments/published-theme-page.generated.js +4 -18
  70. package/dist/cjs/graphql/fragments/published-theme-style.generated.js +2 -6
  71. package/dist/cjs/graphql/fragments/selected-option.generated.js +2 -6
  72. package/dist/cjs/graphql/fragments/variant.generated.js +2 -6
  73. package/dist/cjs/graphql/mutations/page-view-up.generated.js +2 -6
  74. package/dist/cjs/graphql/queries/articles.generated.js +2 -6
  75. package/dist/cjs/graphql/queries/blogs.generated.js +2 -6
  76. package/dist/cjs/graphql/queries/collection-detail-filter.generated.js +2 -16
  77. package/dist/cjs/graphql/queries/collection.generated.js +2 -14
  78. package/dist/cjs/graphql/queries/collections.generated.js +2 -9
  79. package/dist/cjs/graphql/queries/preview-page.generated.js +2 -12
  80. package/dist/cjs/graphql/queries/product-little-detail.generated.js +2 -11
  81. package/dist/cjs/graphql/queries/product-medias.generated.js +2 -8
  82. package/dist/cjs/graphql/queries/product-value-label.generated.js +2 -6
  83. package/dist/cjs/graphql/queries/product-variants.generated.js +3 -11
  84. package/dist/cjs/graphql/queries/products.generated.js +3 -17
  85. package/dist/cjs/graphql/queries/{published-shop-metas.js → published-shop-metas.generated.js} +2 -6
  86. package/dist/cjs/graphql/queries/published-theme-pages.generated.js +3 -19
  87. package/dist/cjs/graphql/queries/shop-shopify.generated.js +2 -6
  88. package/dist/cjs/graphql/queries/store-property.generated.js +2 -6
  89. package/dist/cjs/graphql-app-api/queries/LibrarySaleFunnelDiscount.generated.js +2 -6
  90. package/dist/cjs/graphql-app-api/queries/LibraryTemplate.generated.js +2 -6
  91. package/dist/cjs/graphql-app-api/queries/SaleFunnelDiscounts.generated.js +2 -6
  92. package/dist/cjs/graphql-app-api/queries/SaleFunnelOffer.generated.js +2 -6
  93. package/dist/cjs/graphql-app-api/queries/ShopLibraryPage.generated.js +2 -6
  94. package/dist/cjs/graphql-app-api/queries/ThemePage.generated.js +2 -6
  95. package/dist/cjs/helpers/GlobalEvent.js +1 -19
  96. package/dist/cjs/helpers/align.js +1 -37
  97. package/dist/cjs/helpers/animations.js +1 -222
  98. package/dist/cjs/helpers/background.js +1 -236
  99. package/dist/cjs/helpers/backgroundImage.js +1 -0
  100. package/dist/cjs/helpers/borders.js +4 -198
  101. package/dist/cjs/helpers/carousel.js +1 -55
  102. package/dist/cjs/helpers/clone-deep.js +1 -5
  103. package/dist/cjs/helpers/cls.js +1 -16
  104. package/dist/cjs/helpers/colors.js +1 -184
  105. package/dist/cjs/helpers/compose-advance-style.js +1 -323
  106. package/dist/cjs/helpers/composeClasses.js +1 -0
  107. package/dist/cjs/helpers/const.js +1 -0
  108. package/dist/cjs/helpers/constant.js +1 -23
  109. package/dist/cjs/helpers/convert.js +1 -7
  110. package/dist/cjs/helpers/covert-entities-html.js +1 -19
  111. package/dist/cjs/helpers/css-variable.js +1 -7
  112. package/dist/cjs/helpers/email.js +1 -11
  113. package/dist/cjs/helpers/filter-styles.js +1 -0
  114. package/dist/cjs/helpers/filter-toolbar-preview.js +2 -14
  115. package/dist/cjs/helpers/flatten-connection.js +1 -9
  116. package/dist/cjs/helpers/get-resonsive-value.js +1 -36
  117. package/dist/cjs/helpers/get-shortname.js +1 -92
  118. package/dist/cjs/helpers/icon-list.js +1 -61
  119. package/dist/cjs/helpers/interaction/index.js +2 -134
  120. package/dist/cjs/helpers/is-browser.js +1 -9
  121. package/dist/cjs/helpers/is-defined.js +1 -7
  122. package/dist/cjs/helpers/is-empty-children.js +2 -15
  123. package/dist/cjs/helpers/is-safari.js +1 -9
  124. package/dist/cjs/helpers/layout.js +1 -76
  125. package/dist/cjs/helpers/load-script.js +1 -31
  126. package/dist/cjs/helpers/loop-component.js +1 -16
  127. package/dist/cjs/helpers/make-style.js +1 -163
  128. package/dist/cjs/helpers/normalize-builder-data.js +1 -23
  129. package/dist/cjs/helpers/pascal-to-kebab-case.js +1 -7
  130. package/dist/cjs/helpers/prefetch-queries.js +1 -78
  131. package/dist/cjs/helpers/product.js +1 -48
  132. package/dist/cjs/helpers/queries/get-collection.js +1 -226
  133. package/dist/cjs/helpers/queries/get-collections.js +1 -21
  134. package/dist/cjs/helpers/queries/get-product-by-slug.js +1 -125
  135. package/dist/cjs/helpers/queries/get-product.js +1 -154
  136. package/dist/cjs/helpers/queries/get-products.js +1 -214
  137. package/dist/cjs/helpers/query.js +1 -29
  138. package/dist/cjs/helpers/radius.js +6 -140
  139. package/dist/cjs/helpers/render.js +1 -91
  140. package/dist/cjs/helpers/shadow.js +1 -69
  141. package/dist/cjs/helpers/size.js +4 -228
  142. package/dist/cjs/helpers/spacing.js +1 -43
  143. package/dist/cjs/helpers/third-party/addAppBlockId.js +1 -20
  144. package/dist/cjs/helpers/third-party/appConfig.js +1 -416
  145. package/dist/cjs/helpers/third-party/appSetting.js +1 -1324
  146. package/dist/cjs/helpers/third-party/composeAppBlockId.js +1 -11
  147. package/dist/cjs/helpers/third-party/constant.js +1 -69
  148. package/dist/cjs/helpers/third-party/generateAppBlockConfigs.js +1 -34
  149. package/dist/cjs/helpers/third-party/getAppBlockConfig.js +1 -55
  150. package/dist/cjs/helpers/third-party/getAppBlockType.js +1 -12
  151. package/dist/cjs/helpers/third-party/getAppBlocks.js +1 -30
  152. package/dist/cjs/helpers/third-party/mergeBlock.js +1 -19
  153. package/dist/cjs/helpers/third-party/mergeBlockOrder.js +1 -47
  154. package/dist/cjs/helpers/third-party/removeGPAppItems.js +1 -18
  155. package/dist/cjs/helpers/tracking/fpixel.js +1 -28
  156. package/dist/cjs/helpers/tracking/gtag.js +1 -93
  157. package/dist/cjs/helpers/tracking/tiktokpixel.js +1 -17
  158. package/dist/cjs/helpers/typography.js +19 -160
  159. package/dist/cjs/helpers/variant.js +1 -11
  160. package/dist/cjs/hooks/animation/useAnimationActions.js +2 -39
  161. package/dist/cjs/hooks/animation/useAnimationConfig.js +2 -30
  162. package/dist/cjs/hooks/animation/useAnimationPreview.js +2 -31
  163. package/dist/cjs/hooks/animation/useAnimationTarget.js +2 -122
  164. package/dist/cjs/hooks/animation/useApplyAnimation.js +2 -89
  165. package/dist/cjs/hooks/articles/useArticlesQuery.js +2 -33
  166. package/dist/cjs/hooks/cart/use-add-to-cart.js +2 -20
  167. package/dist/cjs/hooks/cart/use-cart-data.js +2 -28
  168. package/dist/cjs/hooks/cart/use-cart-discount-codes-update.js +2 -20
  169. package/dist/cjs/hooks/cart/use-cart-note-update.js +2 -20
  170. package/dist/cjs/hooks/cart/use-create-cart.js +2 -22
  171. package/dist/cjs/hooks/cart/use-remove-cart-item.js +2 -20
  172. package/dist/cjs/hooks/cart/use-update-cart-item.js +2 -20
  173. package/dist/cjs/hooks/shop/use-collection-query.js +2 -22
  174. package/dist/cjs/hooks/shop/use-collections-query.js +2 -17
  175. package/dist/cjs/hooks/shop/use-product-query.js +2 -22
  176. package/dist/cjs/hooks/shop/use-products-query.js +2 -63
  177. package/dist/cjs/hooks/shop/useShopifyLink.js +2 -0
  178. package/dist/cjs/hooks/shop.js +2 -135
  179. package/dist/cjs/hooks/use-current-device.js +2 -30
  180. package/dist/cjs/hooks/use-lazy-video.js +2 -15
  181. package/dist/cjs/hooks/useAnimations.js +2 -29
  182. package/dist/cjs/hooks/useCartId.js +2 -44
  183. package/dist/cjs/hooks/useCartLine.js +2 -11
  184. package/dist/cjs/hooks/useCartUI.js +2 -48
  185. package/dist/cjs/hooks/useCollection.js +2 -9
  186. package/dist/cjs/hooks/useFetchHandle.js +2 -13
  187. package/dist/cjs/hooks/useFormatMoney.js +2 -75
  188. package/dist/cjs/hooks/useI18n.js +2 -0
  189. package/dist/cjs/hooks/useInitialSwatchesOptions.js +2 -127
  190. package/dist/cjs/hooks/useInteraction.js +2 -19
  191. package/dist/cjs/hooks/useIsomorphicLayoutEffect.js +2 -10
  192. package/dist/cjs/hooks/useLoadScript.js +2 -32
  193. package/dist/cjs/hooks/useMoney.js +2 -84
  194. package/dist/cjs/hooks/usePrevious.js +2 -19
  195. package/dist/cjs/hooks/useProduct.js +2 -250
  196. package/dist/cjs/hooks/useProductList.js +2 -21
  197. package/dist/cjs/hooks/useStickyStore.js +1 -0
  198. package/dist/cjs/hooks/useSuspenseFetch.js +2 -27
  199. package/dist/cjs/hooks/useSwatchesOptions.js +2 -41
  200. package/dist/cjs/hooks/useToolbarPostPurchase.js +2 -89
  201. package/dist/cjs/index.js +1 -425
  202. package/dist/cjs/types/animations.js +1 -49
  203. package/dist/cjs/types/appAPI.js +1 -2
  204. package/dist/cjs/types/custom.js +1 -52
  205. package/dist/cjs/types/global-style.js +1 -15
  206. package/dist/cjs/types/shop.js +1 -2
  207. package/dist/esm/components/AddOn.js +2 -14
  208. package/dist/esm/components/ComponentAnimation.js +2 -13
  209. package/dist/esm/components/ComponentToolbarPreview.js +2 -748
  210. package/dist/esm/components/ComponentWrapper.js +2 -57
  211. package/dist/esm/components/ComponentWrapperPreview.js +2 -209
  212. package/dist/esm/components/Empty.js +2 -3
  213. package/dist/esm/components/InteractionSuffix.js +2 -40
  214. package/dist/esm/components/Render.js +2 -71
  215. package/dist/esm/components/Render.liquid.js +16 -301
  216. package/dist/esm/components/RenderBlock.js +2 -50
  217. package/dist/esm/components/RenderCustomCode.js +4 -55
  218. package/dist/esm/components/RenderPreview.js +2 -63
  219. package/dist/esm/components/RenderSection.js +2 -19
  220. package/dist/esm/components/ai-generator/AIContentGenerator.js +2 -250
  221. package/dist/esm/components/ai-generator/AIGenContentLoading.js +2 -83
  222. package/dist/esm/components/ai-generator/components/PickProduct.js +2 -218
  223. package/dist/esm/components/ai-generator/components/ToneAndVoice.js +2 -75
  224. package/dist/esm/components/ai-generator/hooks/useCheckingProductInside.js +1 -45
  225. package/dist/esm/components/ai-generator/hooks/useFlipPopup.js +1 -108
  226. package/dist/esm/components/ai-generator/hooks/useGettingGenerateRequest.js +1 -35
  227. package/dist/esm/components/ai-generator/hooks/useListenEventGenerate.js +1 -68
  228. package/dist/esm/components/ai-generator/icons/AIIcon.js +2 -65
  229. package/dist/esm/components/ai-generator/icons/CloseIcon.js +2 -17
  230. package/dist/esm/components/ai-generator/icons/DropdownIcon.js +2 -34
  231. package/dist/esm/components/ai-generator/icons/SearchIcon.js +2 -19
  232. package/dist/esm/components/ai-generator/icons/ShowMoreIcon.js +2 -19
  233. package/dist/esm/components/ai-generator/icons/UpgradeIcon.js +2 -25
  234. package/dist/esm/components/ai-generator/icons/WarningIcon.js +2 -29
  235. package/dist/esm/components/constant.js +1 -75
  236. package/dist/esm/components/resize/Resize.js +2 -12
  237. package/dist/esm/components/resize/Spacing.js +2 -256
  238. package/dist/esm/components/src/product/helpers/variant-presets.js +1 -54
  239. package/dist/esm/components/theme-section/CreateThemeSection.js +2 -121
  240. package/dist/esm/components/theme-section/ThemeSectionStatus.js +2 -43
  241. package/dist/esm/components/theme-section/ThemeSectionTooltip.js +2 -124
  242. package/dist/esm/components/toolbar/Tooltip.js +2 -24
  243. package/dist/esm/constants/device.js +1 -0
  244. package/dist/esm/contexts/AddonContext.js +2 -32
  245. package/dist/esm/contexts/ArticleContext.js +2 -36
  246. package/dist/esm/contexts/ArticleListContext.js +2 -27
  247. package/dist/esm/contexts/BuilderComponent.js +2 -31
  248. package/dist/esm/contexts/BuilderContext.js +2 -36
  249. package/dist/esm/contexts/BuilderPreviewContext.js +2 -479
  250. package/dist/esm/contexts/CartLineContext.js +2 -26
  251. package/dist/esm/contexts/CollectionContext.js +2 -35
  252. package/dist/esm/contexts/I18nContext.js +2 -0
  253. package/dist/esm/contexts/ModalContext.js +2 -44
  254. package/dist/esm/contexts/PageContext.js +2 -108
  255. package/dist/esm/contexts/ProductContext.js +2 -179
  256. package/dist/esm/contexts/ProductListContext.js +2 -28
  257. package/dist/esm/contexts/SectionContext.js +2 -49
  258. package/dist/esm/contexts/ShopContext.js +2 -104
  259. package/dist/esm/graphql/fragments/analytic.generated.js +2 -4
  260. package/dist/esm/graphql/fragments/collection-detail.generated.js +2 -4
  261. package/dist/esm/graphql/fragments/collection-product.generated.js +2 -4
  262. package/dist/esm/graphql/fragments/collection.generated.js +2 -4
  263. package/dist/esm/graphql/fragments/custom-code.generated.js +2 -4
  264. package/dist/esm/graphql/fragments/custom-font.generated.js +7 -5
  265. package/dist/esm/graphql/fragments/data-seo.generated.js +2 -4
  266. package/dist/esm/graphql/fragments/media.generated.js +2 -4
  267. package/dist/esm/graphql/fragments/preview-theme-page.generated.js +6 -4
  268. package/dist/esm/graphql/fragments/product-little.generated.js +2 -4
  269. package/dist/esm/graphql/fragments/product-option-value.generated.js +2 -4
  270. package/dist/esm/graphql/fragments/product-option.generated.js +2 -4
  271. package/dist/esm/graphql/fragments/product.generated.js +2 -4
  272. package/dist/esm/graphql/fragments/published-custom-section.generated.js +2 -4
  273. package/dist/esm/graphql/fragments/published-page-section.generated.js +2 -4
  274. package/dist/esm/graphql/fragments/published-theme-page.generated.js +4 -16
  275. package/dist/esm/graphql/fragments/published-theme-style.generated.js +2 -4
  276. package/dist/esm/graphql/fragments/selected-option.generated.js +2 -4
  277. package/dist/esm/graphql/fragments/variant.generated.js +2 -4
  278. package/dist/esm/graphql/mutations/page-view-up.generated.js +2 -4
  279. package/dist/esm/graphql/queries/articles.generated.js +2 -4
  280. package/dist/esm/graphql/queries/blogs.generated.js +2 -4
  281. package/dist/esm/graphql/queries/collection-detail-filter.generated.js +10 -22
  282. package/dist/esm/graphql/queries/collection.generated.js +8 -18
  283. package/dist/esm/graphql/queries/collections.generated.js +3 -8
  284. package/dist/esm/graphql/queries/preview-page.generated.js +6 -14
  285. package/dist/esm/graphql/queries/product-little-detail.generated.js +5 -12
  286. package/dist/esm/graphql/queries/product-medias.generated.js +2 -6
  287. package/dist/esm/graphql/queries/product-value-label.generated.js +2 -4
  288. package/dist/esm/graphql/queries/product-variants.generated.js +5 -11
  289. package/dist/esm/graphql/queries/products.generated.js +9 -20
  290. package/dist/esm/graphql/queries/{published-shop-metas.js → published-shop-metas.generated.js} +2 -4
  291. package/dist/esm/graphql/queries/published-theme-pages.generated.js +6 -20
  292. package/dist/esm/graphql/queries/shop-shopify.generated.js +2 -4
  293. package/dist/esm/graphql/queries/store-property.generated.js +2 -4
  294. package/dist/esm/graphql-app-api/queries/LibrarySaleFunnelDiscount.generated.js +2 -4
  295. package/dist/esm/graphql-app-api/queries/LibraryTemplate.generated.js +2 -4
  296. package/dist/esm/graphql-app-api/queries/SaleFunnelDiscounts.generated.js +2 -4
  297. package/dist/esm/graphql-app-api/queries/SaleFunnelOffer.generated.js +2 -4
  298. package/dist/esm/graphql-app-api/queries/ShopLibraryPage.generated.js +2 -4
  299. package/dist/esm/graphql-app-api/queries/ThemePage.generated.js +2 -4
  300. package/dist/esm/helpers/GlobalEvent.js +1 -15
  301. package/dist/esm/helpers/align.js +1 -34
  302. package/dist/esm/helpers/animations.js +1 -220
  303. package/dist/esm/helpers/background.js +1 -227
  304. package/dist/esm/helpers/backgroundImage.js +1 -0
  305. package/dist/esm/helpers/borders.js +4 -189
  306. package/dist/esm/helpers/carousel.js +1 -51
  307. package/dist/esm/helpers/clone-deep.js +1 -3
  308. package/dist/esm/helpers/cls.js +1 -14
  309. package/dist/esm/helpers/colors.js +1 -169
  310. package/dist/esm/helpers/compose-advance-style.js +1 -315
  311. package/dist/esm/helpers/composeClasses.js +1 -0
  312. package/dist/esm/helpers/const.js +1 -0
  313. package/dist/esm/helpers/constant.js +1 -19
  314. package/dist/esm/helpers/convert.js +1 -4
  315. package/dist/esm/helpers/covert-entities-html.js +1 -17
  316. package/dist/esm/helpers/css-variable.js +1 -5
  317. package/dist/esm/helpers/email.js +1 -6
  318. package/dist/esm/helpers/filter-styles.js +1 -0
  319. package/dist/esm/helpers/filter-toolbar-preview.js +2 -9
  320. package/dist/esm/helpers/flatten-connection.js +1 -7
  321. package/dist/esm/helpers/get-resonsive-value.js +1 -31
  322. package/dist/esm/helpers/get-shortname.js +1 -90
  323. package/dist/esm/helpers/icon-list.js +1 -58
  324. package/dist/esm/helpers/interaction/index.js +2 -132
  325. package/dist/esm/helpers/is-browser.js +1 -5
  326. package/dist/esm/helpers/is-defined.js +1 -5
  327. package/dist/esm/helpers/is-empty-children.js +2 -10
  328. package/dist/esm/helpers/is-safari.js +1 -5
  329. package/dist/esm/helpers/layout.js +1 -70
  330. package/dist/esm/helpers/load-script.js +1 -29
  331. package/dist/esm/helpers/loop-component.js +1 -14
  332. package/dist/esm/helpers/make-style.js +1 -149
  333. package/dist/esm/helpers/normalize-builder-data.js +1 -21
  334. package/dist/esm/helpers/pascal-to-kebab-case.js +1 -5
  335. package/dist/esm/helpers/prefetch-queries.js +1 -76
  336. package/dist/esm/helpers/product.js +1 -44
  337. package/dist/esm/helpers/queries/get-collection.js +1 -223
  338. package/dist/esm/helpers/queries/get-collections.js +1 -19
  339. package/dist/esm/helpers/queries/get-product-by-slug.js +1 -123
  340. package/dist/esm/helpers/queries/get-product.js +1 -150
  341. package/dist/esm/helpers/queries/get-products.js +1 -210
  342. package/dist/esm/helpers/query.js +1 -25
  343. package/dist/esm/helpers/radius.js +6 -132
  344. package/dist/esm/helpers/render.js +1 -82
  345. package/dist/esm/helpers/shadow.js +1 -63
  346. package/dist/esm/helpers/size.js +4 -213
  347. package/dist/esm/helpers/spacing.js +1 -40
  348. package/dist/esm/helpers/third-party/addAppBlockId.js +1 -18
  349. package/dist/esm/helpers/third-party/appConfig.js +1 -356
  350. package/dist/esm/helpers/third-party/appSetting.js +1 -1321
  351. package/dist/esm/helpers/third-party/composeAppBlockId.js +1 -9
  352. package/dist/esm/helpers/third-party/constant.js +1 -66
  353. package/dist/esm/helpers/third-party/generateAppBlockConfigs.js +1 -32
  354. package/dist/esm/helpers/third-party/getAppBlockConfig.js +1 -53
  355. package/dist/esm/helpers/third-party/getAppBlockType.js +1 -10
  356. package/dist/esm/helpers/third-party/getAppBlocks.js +1 -28
  357. package/dist/esm/helpers/third-party/mergeBlock.js +1 -17
  358. package/dist/esm/helpers/third-party/mergeBlockOrder.js +1 -45
  359. package/dist/esm/helpers/third-party/removeGPAppItems.js +1 -15
  360. package/dist/esm/helpers/tracking/fpixel.js +1 -24
  361. package/dist/esm/helpers/tracking/gtag.js +1 -87
  362. package/dist/esm/helpers/tracking/tiktokpixel.js +1 -15
  363. package/dist/esm/helpers/typography.js +19 -149
  364. package/dist/esm/helpers/variant.js +1 -9
  365. package/dist/esm/hooks/animation/useAnimationActions.js +2 -37
  366. package/dist/esm/hooks/animation/useAnimationConfig.js +2 -28
  367. package/dist/esm/hooks/animation/useAnimationPreview.js +2 -29
  368. package/dist/esm/hooks/animation/useAnimationTarget.js +2 -120
  369. package/dist/esm/hooks/animation/useApplyAnimation.js +2 -85
  370. package/dist/esm/hooks/articles/useArticlesQuery.js +2 -30
  371. package/dist/esm/hooks/cart/use-add-to-cart.js +2 -18
  372. package/dist/esm/hooks/cart/use-cart-data.js +2 -26
  373. package/dist/esm/hooks/cart/use-cart-discount-codes-update.js +2 -18
  374. package/dist/esm/hooks/cart/use-cart-note-update.js +2 -18
  375. package/dist/esm/hooks/cart/use-create-cart.js +2 -20
  376. package/dist/esm/hooks/cart/use-remove-cart-item.js +2 -18
  377. package/dist/esm/hooks/cart/use-update-cart-item.js +2 -18
  378. package/dist/esm/hooks/shop/use-collection-query.js +2 -20
  379. package/dist/esm/hooks/shop/use-collections-query.js +2 -15
  380. package/dist/esm/hooks/shop/use-product-query.js +2 -20
  381. package/dist/esm/hooks/shop/use-products-query.js +2 -59
  382. package/dist/esm/hooks/shop/useShopifyLink.js +2 -0
  383. package/dist/esm/hooks/shop.js +2 -119
  384. package/dist/esm/hooks/use-current-device.js +2 -28
  385. package/dist/esm/hooks/use-lazy-video.js +2 -13
  386. package/dist/esm/hooks/useAnimations.js +2 -27
  387. package/dist/esm/hooks/useCartId.js +2 -40
  388. package/dist/esm/hooks/useCartLine.js +2 -7
  389. package/dist/esm/hooks/useCartUI.js +2 -44
  390. package/dist/esm/hooks/useCollection.js +2 -7
  391. package/dist/esm/hooks/useFetchHandle.js +2 -11
  392. package/dist/esm/hooks/useFormatMoney.js +2 -71
  393. package/dist/esm/hooks/useI18n.js +2 -0
  394. package/dist/esm/hooks/useInitialSwatchesOptions.js +2 -123
  395. package/dist/esm/hooks/useInteraction.js +2 -17
  396. package/dist/esm/hooks/useIsomorphicLayoutEffect.js +2 -6
  397. package/dist/esm/hooks/useLoadScript.js +2 -28
  398. package/dist/esm/hooks/useMoney.js +2 -80
  399. package/dist/esm/hooks/usePrevious.js +2 -17
  400. package/dist/esm/hooks/useProduct.js +2 -233
  401. package/dist/esm/hooks/useProductList.js +2 -16
  402. package/dist/esm/hooks/useStickyStore.js +1 -0
  403. package/dist/esm/hooks/useSuspenseFetch.js +2 -23
  404. package/dist/esm/hooks/useSwatchesOptions.js +2 -37
  405. package/dist/esm/hooks/useToolbarPostPurchase.js +2 -87
  406. package/dist/esm/index.js +1 -119
  407. package/dist/esm/types/animations.js +1 -49
  408. package/dist/esm/types/custom.js +1 -52
  409. package/dist/esm/types/global-style.js +1 -12
  410. package/dist/types/index.d.ts +12025 -8969
  411. package/package.json +6 -6
  412. package/dist/cjs/web-components/src/helpers/styles/constant.js +0 -9
  413. package/dist/esm/web-components/src/helpers/styles/constant.js +0 -7
@@ -1,80 +1,2 @@
1
- import { useMemo } from 'react';
2
- import { useLocale, useCurrency } from './shop.js';
3
-
4
- const useMoney = (amount)=>{
5
- const { locale } = useLocale();
6
- const { currency } = useCurrency();
7
- const options = useMemo(()=>({
8
- style: 'currency',
9
- currency: currency
10
- }), [
11
- currency
12
- ]);
13
- const defaultFormatter = useLazyFormatter(locale, options);
14
- const nameFormatter = useLazyFormatter(locale, {
15
- ...options,
16
- currencyDisplay: 'name'
17
- });
18
- const narrowSymbolFormatter = useLazyFormatter(locale, {
19
- ...options,
20
- currencyDisplay: 'narrowSymbol'
21
- });
22
- const withoutTrailingZerosFormatter = useLazyFormatter(locale, {
23
- ...options,
24
- minimumFractionDigits: 0,
25
- maximumFractionDigits: 0
26
- });
27
- const withoutCurrencyFormatter = useLazyFormatter(locale);
28
- const withoutTrailingZerosOrCurrencyFormatter = useLazyFormatter(locale, {
29
- minimumFractionDigits: 0,
30
- maximumFractionDigits: 0
31
- });
32
- const isPartCurrency = (part)=>part.type === 'currency';
33
- // By wrapping these properties in functions, we only
34
- // create formatters if they are going to be used.
35
- const lazyFormatters = useMemo(()=>({
36
- currencyCode: ()=>currency,
37
- localizedString: ()=>defaultFormatter().format(amount),
38
- parts: ()=>defaultFormatter().formatToParts(amount),
39
- withoutTrailingZeros: ()=>amount % 1 === 0 ? withoutTrailingZerosFormatter().format(amount) : defaultFormatter().format(amount),
40
- withoutTrailingZerosAndCurrency: ()=>amount % 1 === 0 ? withoutTrailingZerosOrCurrencyFormatter().format(amount) : withoutCurrencyFormatter().format(amount),
41
- currencyName: ()=>nameFormatter().formatToParts(amount).find(isPartCurrency)?.value ?? currency,
42
- currencySymbol: ()=>defaultFormatter().formatToParts(amount).find(isPartCurrency)?.value ?? currency,
43
- currencyNarrowSymbol: ()=>narrowSymbolFormatter().formatToParts(amount).find(isPartCurrency)?.value ?? '',
44
- amount: ()=>defaultFormatter().formatToParts(amount).filter((part)=>[
45
- 'decimal',
46
- 'fraction',
47
- 'group',
48
- 'integer',
49
- 'literal'
50
- ].includes(part.type)).map((part)=>part.value).join('')
51
- }), [
52
- currency,
53
- amount,
54
- nameFormatter,
55
- defaultFormatter,
56
- narrowSymbolFormatter,
57
- withoutCurrencyFormatter,
58
- withoutTrailingZerosFormatter,
59
- withoutTrailingZerosOrCurrencyFormatter
60
- ]);
61
- // Call functions automatically when the properties are accessed
62
- // to keep these functions as an implementation detail.
63
- return useMemo(()=>new Proxy(lazyFormatters, {
64
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
65
- get: (target, key)=>Reflect.get(target, key)?.call(null)
66
- }), [
67
- lazyFormatters
68
- ]);
69
- };
70
- function useLazyFormatter(locale, options) {
71
- return useMemo(()=>{
72
- let memoized;
73
- return ()=>memoized ??= new Intl.NumberFormat(locale, options);
74
- }, [
75
- locale,
76
- options
77
- ]);
78
- }
79
-
80
- export { useMoney as default };
1
+ 'use client';
2
+ import{useMemo as r}from"react";import{useLocale as t,useCurrency as e}from"./shop.js";let useMoney=a=>{let{locale:o}=t(),{currency:m}=e(),i=r(()=>({style:"currency",currency:m}),[m]),n=useLazyFormatter(o,i),u=useLazyFormatter(o,{...i,currencyDisplay:"name"}),c=useLazyFormatter(o,{...i,currencyDisplay:"narrowSymbol"}),l=useLazyFormatter(o,{...i,minimumFractionDigits:0,maximumFractionDigits:0}),s=useLazyFormatter(o),y=useLazyFormatter(o,{minimumFractionDigits:0,maximumFractionDigits:0}),f=r=>"currency"===r.type,F=r(()=>({currencyCode:()=>m,localizedString:()=>n().format(a),parts:()=>n().formatToParts(a),withoutTrailingZeros:()=>a%1==0?l().format(a):n().format(a),withoutTrailingZerosAndCurrency:()=>a%1==0?y().format(a):s().format(a),currencyName:()=>u().formatToParts(a).find(f)?.value??m,currencySymbol:()=>n().formatToParts(a).find(f)?.value??m,currencyNarrowSymbol:()=>c().formatToParts(a).find(f)?.value??"",amount:()=>n().formatToParts(a).filter(r=>["decimal","fraction","group","integer","literal"].includes(r.type)).map(r=>r.value).join("")}),[m,a,u,n,c,s,l,y]);return r(()=>new Proxy(F,{get:(r,t)=>Reflect.get(r,t)?.call(null)}),[F])};function useLazyFormatter(t,e){return r(()=>{let r;return()=>r??(r=new Intl.NumberFormat(t,e))},[t,e])}export{useMoney as default};
@@ -1,17 +1,2 @@
1
- import { useRef, useEffect } from 'react';
2
-
3
- const usePrevious = (value)=>{
4
- // The ref object is a generic container whose current property is mutable ...
5
- // ... and can hold any value, similar to an instance property on a class
6
- const ref = useRef();
7
- // Store current value in ref
8
- useEffect(()=>{
9
- ref.current = value;
10
- }, [
11
- value
12
- ]); // Only re-run if value changes
13
- // Return previous value (happens before update in useEffect above)
14
- return ref.current;
15
- };
16
-
17
- export { usePrevious };
1
+ 'use client';
2
+ import{useRef as r,useEffect as e}from"react";let usePrevious=t=>{let u=r();return e(()=>{u.current=t},[t]),u.current};export{usePrevious};
@@ -1,233 +1,2 @@
1
- import { useCallback, useEffect, useMemo } from 'react';
2
- import { useProductStore } from '../contexts/ProductContext.js';
3
- import 'react/jsx-runtime';
4
- import 'zustand';
5
- import { usePageStore } from '../contexts/PageContext.js';
6
- import 'swr';
7
- import '@gem-sdk/adapter-shopify';
8
- import 'swr/mutation';
9
- import 'swr/infinite';
10
- import 'vanilla-lazyload';
11
- import './useCartUI.js';
12
- import { checkInStock } from '../helpers/variant.js';
13
- import 'react-transition-group';
14
- import '@gem-sdk/core';
15
- import 'classnames';
16
- import 'dayjs';
17
- import { flattenConnection } from '../helpers/flatten-connection.js';
18
- import '../helpers/convert.js';
19
- import { getSelectedVariant } from '../helpers/product.js';
20
-
21
- const useUniqProductID = ()=>{
22
- return useProductStore((s)=>s.uiqueId);
23
- };
24
- const useProduct = ()=>{
25
- return useProductStore((s)=>s.product);
26
- };
27
- const useFeaturedImageGlobal = ()=>{
28
- return useProductStore((s)=>s.featuredImageGlobal);
29
- };
30
- const useProductProperties = ()=>{
31
- return useProductStore((s)=>s.properties);
32
- };
33
- const useIsSyncProduct = ()=>{
34
- return useProductStore((s)=>s.isSyncProduct);
35
- };
36
- const useProductBundleDiscount = ()=>{
37
- const useProductCompareAtPrice = useProductStore((s)=>s.useProductCompareAtPrice);
38
- const seUseProductCompareAtPrice = useProductStore((s)=>s.setUseProductCompareAtPrice);
39
- return {
40
- useProductCompareAtPrice,
41
- seUseProductCompareAtPrice
42
- };
43
- };
44
- const useQuantity = ()=>{
45
- const quantity = useProductStore((s)=>s.quantity);
46
- const hasUpdatePrice = useProductStore((s)=>s.updatePrice);
47
- const decrement = useProductStore((s)=>s.decrementQuantity);
48
- const increment = useProductStore((s)=>s.incrementQuantity);
49
- const updateQuantity = useProductStore((s)=>s.setQuantity);
50
- const updatePrice = useProductStore((s)=>s.setHasUpdatePriceFollowQuantity);
51
- const isSyncProduct = useProductStore((s)=>s.isSyncProduct);
52
- const product = useProductStore((s)=>s.product);
53
- const productId = product?.id;
54
- const reset = useCallback(()=>{
55
- updateQuantity(1);
56
- }, [
57
- updateQuantity
58
- ]);
59
- useEffect(()=>{
60
- if (isSyncProduct) {
61
- const setOption = new CustomEvent('set-product-quantity', {
62
- bubbles: true,
63
- cancelable: true,
64
- composed: true,
65
- detail: {
66
- quantity,
67
- productId
68
- }
69
- });
70
- window.dispatchEvent(setOption);
71
- }
72
- }, [
73
- quantity,
74
- isSyncProduct,
75
- productId
76
- ]);
77
- return useMemo(()=>({
78
- quantity,
79
- hasUpdatePrice,
80
- increment,
81
- decrement,
82
- reset,
83
- setQuantity: updateQuantity,
84
- setUpdatePrice: updatePrice
85
- }), [
86
- decrement,
87
- increment,
88
- quantity,
89
- reset,
90
- updateQuantity,
91
- updatePrice,
92
- hasUpdatePrice
93
- ]);
94
- };
95
- const useHasPreSelected = ()=>{
96
- const hasPreSelected = useProductStore((s)=>s.hasPreSelected);
97
- const setHasPreSelected = useProductStore((s)=>s.setHasPreSelected);
98
- return useMemo(()=>({
99
- hasPreSelected,
100
- setHasPreSelected
101
- }), [
102
- hasPreSelected,
103
- setHasPreSelected
104
- ]);
105
- };
106
- const useSelectedOption = ()=>{
107
- const setSelectedOption = useProductStore((s)=>s.setSelectedOption);
108
- const selectedOptions = useProductStore((s)=>s.selectedOptions);
109
- const forceSelectedOption = useProductStore((s)=>s.forceSelectedOption);
110
- const isSyncProduct = useProductStore((s)=>s.isSyncProduct);
111
- const isChangeSelectedOption = useProductStore((s)=>s.isChangeSelectedOption);
112
- const setIsChangeSelectedOption = useProductStore((s)=>s.setIsChangeSelectedOption);
113
- const updateOption = useCallback((optionId, optionValue, productId, noEmit)=>{
114
- if (!noEmit && isSyncProduct) {
115
- const setOption = new CustomEvent('set-selected-option', {
116
- bubbles: true,
117
- cancelable: true,
118
- composed: true,
119
- detail: {
120
- optionId,
121
- optionValue,
122
- productId
123
- }
124
- });
125
- window.dispatchEvent(setOption);
126
- }
127
- setSelectedOption(optionId, optionValue);
128
- setIsChangeSelectedOption(true);
129
- }, [
130
- isSyncProduct,
131
- setSelectedOption,
132
- setIsChangeSelectedOption
133
- ]);
134
- const forceOption = useCallback((selectedOption, productId, noEmit)=>{
135
- if (!noEmit && isSyncProduct) {
136
- const forceOption = new CustomEvent('force-selected-option', {
137
- bubbles: true,
138
- cancelable: true,
139
- composed: true,
140
- detail: {
141
- selectedOption,
142
- productId
143
- }
144
- });
145
- window.dispatchEvent(forceOption);
146
- }
147
- forceSelectedOption(selectedOption);
148
- }, [
149
- forceSelectedOption,
150
- isSyncProduct
151
- ]);
152
- return useMemo(()=>({
153
- isChangeSelectedOption,
154
- selectedOptions,
155
- setSelectedOption: updateOption,
156
- forceSelectedOption: forceOption
157
- }), [
158
- selectedOptions,
159
- updateOption,
160
- forceOption
161
- ]);
162
- };
163
- const useVariants = ()=>{
164
- const variants = useProductStore((s)=>s.product?.variants);
165
- return flattenConnection(variants);
166
- };
167
- const useVariant = (id)=>{
168
- const variants = useVariants();
169
- return useMemo(()=>variants?.find((v)=>v?.id === id), [
170
- id,
171
- variants
172
- ]);
173
- };
174
- const useCurrentVariant = ()=>{
175
- const { selectedOptions } = useSelectedOption();
176
- const variants = useVariants();
177
- return useMemo(()=>getSelectedVariant(variants, selectedOptions), [
178
- selectedOptions,
179
- variants
180
- ]);
181
- };
182
- const useCurrentVariantInStock = ()=>{
183
- const currentVariant = useCurrentVariant();
184
- const currentProduct = useProduct();
185
- return checkInStock(currentVariant, currentProduct);
186
- };
187
- const useVariantOutStock = (optionId, optionValue, options)=>{
188
- const { selectedOptions } = useSelectedOption();
189
- const variants = useVariants();
190
- const lastPos = options.optionNumber - 1;
191
- if (options.position < lastPos) {
192
- return variants.some((variant)=>{
193
- if (variant) {
194
- const { selectedOptions } = variant;
195
- const opt = selectedOptions?.some((option)=>option?.name === optionId && option.value === optionValue);
196
- const isInStock = checkInStock(variant);
197
- return opt && isInStock;
198
- }
199
- });
200
- }
201
- const matchedVariant = getSelectedVariant(variants, {
202
- ...selectedOptions,
203
- [optionId]: optionValue
204
- });
205
- return checkInStock(matchedVariant);
206
- };
207
- const useCheckAvailableVariantInStock = (optionId, optionValue)=>{
208
- const variants = useVariants();
209
- return variants ? variants.some((item)=>{
210
- if (item) {
211
- const { selectedOptions } = item;
212
- const opt = selectedOptions?.some((option)=>option?.name === optionId && option.value === optionValue);
213
- const isInStock = checkInStock(item);
214
- return opt && isInStock;
215
- }
216
- return false;
217
- }) : false;
218
- };
219
- const useProductOfferDiscount = ()=>{
220
- const productOffers = usePageStore((s)=>s.productOffers);
221
- const currentProduct = useProduct();
222
- const currentVariant = useCurrentVariant();
223
- const currentOffer = productOffers?.find((item)=>item?.node?.objectBaseID === currentProduct?.baseID)?.node;
224
- if (!currentOffer || !currentOffer.isEnabled) return 0;
225
- let currentDiscount = currentOffer?.value;
226
- if (currentOffer && currentOffer.valueType === 'PERCENTAGE' && currentDiscount) {
227
- const price = currentVariant?.price || 0;
228
- currentDiscount = currentDiscount * price / 100;
229
- }
230
- return currentDiscount || 0;
231
- };
232
-
233
- export { useCheckAvailableVariantInStock, useCurrentVariant, useCurrentVariantInStock, useFeaturedImageGlobal, useHasPreSelected, useIsSyncProduct, useProduct, useProductBundleDiscount, useProductOfferDiscount, useProductProperties, useQuantity, useSelectedOption, useUniqProductID, useVariant, useVariantOutStock, useVariants };
1
+ 'use client';
2
+ import{useCallback as e,useEffect as t,useMemo as r}from"react";import{useProductStore as s}from"../contexts/ProductContext.js";import"react/jsx-runtime";import"zustand";import{usePageStore as o}from"../contexts/PageContext.js";import"swr";import"@gem-sdk/adapter-shopify";import"swr/mutation";import"swr/infinite";import"vanilla-lazyload";import"./useCartUI.js";import"./useStickyStore.js";import{checkInStock as u}from"../helpers/variant.js";import{useShopifyLink as n}from"./shop/useShopifyLink.js";import"react-transition-group";import"@gem-sdk/core";import"classnames";import"dayjs";import{flattenConnection as i}from"../helpers/flatten-connection.js";import"../helpers/convert.js";import{getSelectedVariant as a}from"../helpers/product.js";let useUniqProductID=()=>s(e=>e.uiqueId),useProduct=()=>s(e=>e.product),useFeaturedImageGlobal=()=>s(e=>e.featuredImageGlobal),useProductProperties=()=>s(e=>e.properties),useIsSyncProduct=()=>s(e=>e.isSyncProduct),useProductBundleDiscount=()=>{let e=s(e=>e.useProductCompareAtPrice),t=s(e=>e.setUseProductCompareAtPrice);return{useProductCompareAtPrice:e,seUseProductCompareAtPrice:t}},useProductShopifyEditLink=()=>{let e=s(e=>e.product),t=e?.baseID?.replace("gid://shopify/Product/",""),{linkEditProduct:r}=n({productId:t}),o=()=>{r&&window.open(r,"_blank")};return{linkEditProduct:r,redirectProductShopifyLink:o}},useQuantity=()=>{let o=s(e=>e.quantity),u=s(e=>e.updatePrice),n=s(e=>e.decrementQuantity),i=s(e=>e.incrementQuantity),a=s(e=>e.setQuantity),c=s(e=>e.setHasUpdatePriceFollowQuantity),d=s(e=>e.isSyncProduct),l=s(e=>e.product),p=l?.id,m=e(()=>{a(1)},[a]);return t(()=>{if(d){let e=new CustomEvent("set-product-quantity",{bubbles:!0,cancelable:!0,composed:!0,detail:{quantity:o,productId:p}});window.dispatchEvent(e)}},[o,d,p]),r(()=>({quantity:o,hasUpdatePrice:u,increment:i,decrement:n,reset:m,setQuantity:a,setUpdatePrice:c}),[n,i,o,m,a,c,u])},useHasPreSelected=()=>{let e=s(e=>e.hasPreSelected),t=s(e=>e.setHasPreSelected);return r(()=>({hasPreSelected:e,setHasPreSelected:t}),[e,t])},useSelectedOption=()=>{let t=s(e=>e.setSelectedOption),o=s(e=>e.selectedOptions),u=s(e=>e.forceSelectedOption),n=s(e=>e.isSyncProduct),i=s(e=>e.isChangeSelectedOption),a=s(e=>e.setIsChangeSelectedOption),c=e((e,r,s,o)=>{if(!o&&n){let t=new CustomEvent("set-selected-option",{bubbles:!0,cancelable:!0,composed:!0,detail:{optionId:e,optionValue:r,productId:s,isManualChange:!0}});window.dispatchEvent(t)}t(e,r),a(!0)},[n,t,a]),d=e((e,t,r,s)=>{if(!r&&n){let r=new CustomEvent("force-selected-option",{bubbles:!0,cancelable:!0,composed:!0,detail:{selectedOption:e,productId:t,isManualChange:s}});window.dispatchEvent(r)}u(e)},[u,n]);return r(()=>({isChangeSelectedOption:i,selectedOptions:o,setSelectedOption:c,forceSelectedOption:d}),[o,c,d])},useVariants=()=>{let e=s(e=>e.product?.variants);return i(e)},useVariant=e=>{let t=useVariants();return r(()=>t?.find(t=>t?.id===e),[e,t])},useCurrentVariant=()=>{let{selectedOptions:e}=useSelectedOption(),t=useVariants();return r(()=>a(t,e),[e,t])},useCurrentVariantInStock=()=>{let e=useCurrentVariant(),t=useProduct();return u(e,t)},useVariantOutStock=(e,t,r)=>{let{selectedOptions:s}=useSelectedOption(),o=useVariants(),n=r.optionNumber-1;if(r.position<n)return o.some(r=>{if(r){let{selectedOptions:s}=r,o=s?.some(r=>r?.name===e&&r.value===t),n=u(r);return o&&n}});let i=a(o,{...s,[e]:t});return u(i)},useCheckAvailableVariantInStock=(e,t)=>{let r=useVariants();return!!r&&r.some(r=>{if(r){let{selectedOptions:s}=r,o=s?.some(r=>r?.name===e&&r.value===t),n=u(r);return o&&n}return!1})},useProductOfferDiscount=()=>{let e=o(e=>e.productOffers),t=useProduct(),r=useCurrentVariant(),s=e?.find(e=>e?.node?.objectBaseID===t?.baseID)?.node;if(!s||!s.isEnabled)return 0;let u=s?.value;if(s&&"PERCENTAGE"===s.valueType&&u){let e=r?.price||0;u=u*e/100}return u||0};export{useCheckAvailableVariantInStock,useCurrentVariant,useCurrentVariantInStock,useFeaturedImageGlobal,useHasPreSelected,useIsSyncProduct,useProduct,useProductBundleDiscount,useProductOfferDiscount,useProductProperties,useProductShopifyEditLink,useQuantity,useSelectedOption,useUniqProductID,useVariant,useVariantOutStock,useVariants};
@@ -1,16 +1,2 @@
1
- import { useProductListStore } from '../contexts/ProductListContext.js';
2
-
3
- const useProductList = ()=>{
4
- return useProductListStore((s)=>s.collection);
5
- };
6
- const useProductListProducts = ()=>{
7
- return useProductListStore((s)=>s.products);
8
- };
9
- const useProductListSettings = ()=>{
10
- return useProductListStore((s)=>s.settings);
11
- };
12
- const useProductListStyles = ()=>{
13
- return useProductListStore((s)=>s.styles);
14
- };
15
-
16
- export { useProductList, useProductListProducts, useProductListSettings, useProductListStyles };
1
+ 'use client';
2
+ import{useProductListStore as t}from"../contexts/ProductListContext.js";let useProductList=()=>t(t=>t.collection),useProductListProducts=()=>t(t=>t.products),useProductListSettings=()=>t(t=>t.settings),useProductListStyles=()=>t(t=>t.styles);export{useProductList,useProductListProducts,useProductListSettings,useProductListStyles};
@@ -0,0 +1 @@
1
+ import{create as i}from"zustand";let useStickyStore=i(i=>({isStickyVisible:!1,setStickyVisible:t=>i({isStickyVisible:t})}));export{useStickyStore};
@@ -1,23 +1,2 @@
1
- const cache = new Map();
2
- const useSuspenseFetch = (key, promise)=>{
3
- const value = cache.get(key) || {
4
- status: 'new',
5
- data: null
6
- };
7
- if (value.status === 'resolved') {
8
- return {
9
- data: value.data
10
- };
11
- }
12
- promise().then((data)=>{
13
- value.status = 'resolved';
14
- value.data = data;
15
- cache.set(key, value);
16
- }).catch(()=>{
17
- value.status = 'error';
18
- value.data = null;
19
- });
20
- throw promise();
21
- };
22
-
23
- export { useSuspenseFetch as default };
1
+ 'use client';
2
+ let cache=new Map,useSuspenseFetch=(e,t)=>{let a=cache.get(e)||{status:"new",data:null};if("resolved"===a.status)return{data:a.data};throw t().then(t=>{a.status="resolved",a.data=t,cache.set(e,a)}).catch(()=>{a.status="error",a.data=null}),t()};export{useSuspenseFetch as default};
@@ -1,37 +1,2 @@
1
- import { useSwatches } from './shop.js';
2
-
3
- const initialSwatchOptionValue = {
4
- label: '',
5
- colors: [],
6
- imageUrl: ''
7
- };
8
- const initialGlobalSwatchesData = {
9
- optionTitle: '',
10
- optionType: '',
11
- optionValues: []
12
- };
13
- const useSwatchesOptions = (options)=>{
14
- const { swatches } = useSwatches();
15
- if (!options) return [];
16
- return options?.map((option)=>{
17
- const swatchOption = swatches?.find((sw)=>sw?.optionTitle === option?.name) || {
18
- ...initialGlobalSwatchesData
19
- };
20
- return {
21
- ...option,
22
- optionType: swatchOption ? swatchOption.optionType : '',
23
- values: option.values?.map((val)=>{
24
- const swatchValue = swatchOption && swatchOption?.optionValues?.find((swatOp)=>swatOp?.label === val?.label) || {
25
- ...initialSwatchOptionValue
26
- };
27
- return {
28
- ...val,
29
- colors: swatchValue?.colors || [],
30
- imageUrl: swatchValue?.imageUrl || ''
31
- };
32
- })
33
- };
34
- });
35
- };
36
-
37
- export { useSwatchesOptions as default };
1
+ 'use client';
2
+ import{useSwatches as t}from"./shop.js";let initialSwatchOptionValue={label:"",colors:[],imageUrl:""},initialGlobalSwatchesData={optionTitle:"",optionType:"",optionValues:[]},useSwatchesOptions=a=>{let{swatches:e}=t();return a?a?.map(t=>{let a=e?.find(a=>a?.optionTitle===t?.name)||{...initialGlobalSwatchesData};return{...t,optionType:a?a.optionType:"",values:t.values?.map(t=>{let e=a&&a?.optionValues?.find(a=>a?.label===t?.label)||{...initialSwatchOptionValue};return{...t,colors:e?.colors||[],imageUrl:e?.imageUrl||""}})}}):[]};export{useSwatchesOptions as default};
@@ -1,87 +1,2 @@
1
- import { postPurchaseRequiredElements, postPurchaseWrapElements } from '../components/constant.js';
2
- import { useShopStore } from '../contexts/ShopContext.js';
3
-
4
- const usePostPurchase = (uid, tag)=>{
5
- const editingPageType = useShopStore((s)=>s.pageType);
6
- const getElementCountInPage = (tagParam, root)=>{
7
- const tagUsed = tagParam || tag;
8
- let count = 0;
9
- const elements = (root || document).querySelectorAll(`[data-component-tag="${tagUsed}"]`);
10
- if (tagUsed === 'PostPurchaseProductOffer') {
11
- return elements.length;
12
- }
13
- let isCountedWrapper = '';
14
- elements.forEach((element)=>{
15
- const isWrappedByProductOffer = element.closest('[data-component-tag="PostPurchaseProductOffer"]');
16
- const productId = isWrappedByProductOffer?.getAttribute('data-uid') || '';
17
- const productWrapper = element.closest('[data-component-tag="Product"]');
18
- const elementCounted = productWrapper?.querySelectorAll(`[data-component-tag="${tagUsed}"]`).length || 0;
19
- const offset = isWrappedByProductOffer ? productId !== isCountedWrapper ? elementCounted : 0 : 1;
20
- if (isWrappedByProductOffer) {
21
- isCountedWrapper = productId;
22
- }
23
- count += offset;
24
- });
25
- return count;
26
- };
27
- const verifyRequireElement = ()=>{
28
- const count = getElementCountInPage();
29
- return count <= 1;
30
- };
31
- const verifyWrapContainsRequireElement = ()=>{
32
- const $component = document.body.querySelector('#storefront')?.querySelector(`[data-uid="${uid}"]`);
33
- if (!$component) return false;
34
- for (const requiredElementTag of postPurchaseRequiredElements){
35
- const countElementInsidePage = getElementCountInPage(requiredElementTag);
36
- const countElementInsideWrap = getElementCountInPage(requiredElementTag, $component);
37
- if (countElementInsideWrap > 0 && countElementInsidePage - countElementInsideWrap < 1) {
38
- return true;
39
- }
40
- }
41
- return false;
42
- };
43
- const countRequiredElement = ()=>{
44
- return postPurchaseRequiredElements.reduce((acc, requiredElementTag)=>{
45
- const $component = document.body.querySelector('#storefront')?.querySelector(`[data-uid="${uid}"]`);
46
- if (!$component) return 0;
47
- const count = $component.querySelectorAll(`[data-component-tag="${requiredElementTag}"]`).length;
48
- return acc + count;
49
- }, 0);
50
- };
51
- const checkDisableDelete = ()=>{
52
- if (editingPageType !== 'POST_PURCHASE') return false;
53
- let isUnable = false;
54
- if (postPurchaseRequiredElements.includes(tag)) {
55
- isUnable = verifyRequireElement();
56
- if (isUnable) return isUnable;
57
- }
58
- if (postPurchaseWrapElements.includes(tag) && countRequiredElement() > 0) {
59
- return verifyWrapContainsRequireElement();
60
- }
61
- return false;
62
- };
63
- const checkDisableDuplicate = ()=>{
64
- return editingPageType === 'GP_FUNNEL_PAGE' && tag === 'ProductList';
65
- };
66
- const getTooltipText = ()=>{
67
- if (postPurchaseRequiredElements.includes(tag)) {
68
- return {
69
- text: 'This element is required <br> and can’t be deleted',
70
- width: '175px'
71
- };
72
- } else {
73
- const elmName = tag === 'Section' ? 'section' : 'element';
74
- return {
75
- text: `This ${elmName} contains required <br> elements and cannot be deleted`,
76
- width: '206px'
77
- };
78
- }
79
- };
80
- return {
81
- checkDisableDelete,
82
- getTooltipText,
83
- checkDisableDuplicate
84
- };
85
- };
86
-
87
- export { usePostPurchase };
1
+ 'use client';
2
+ import{postPurchaseRequiredElements as e,postPurchaseWrapElements as t}from"../components/constant.js";import{useShopStore as r}from"../contexts/ShopContext.js";let usePostPurchase=(o,n)=>{let u=r(e=>e.pageType),c=(e,t)=>{let r=e||n,o=0,u=(t||document).querySelectorAll(`[data-component-tag="${r}"]`);if("PostPurchaseProductOffer"===r)return u.length;let c="";return u.forEach(e=>{let t=e.closest('[data-component-tag="PostPurchaseProductOffer"]'),n=t?.getAttribute("data-uid")||"",u=e.closest('[data-component-tag="Product"]'),l=u?.querySelectorAll(`[data-component-tag="${r}"]`).length||0,a=t?n!==c?l:0:1;t&&(c=n),o+=a}),o},l=()=>{let e=c();return e<=1},a=()=>{let t=document.body.querySelector("#storefront")?.querySelector(`[data-uid="${o}"]`);if(!t)return!1;for(let r of e){let e=c(r),o=c(r,t);if(o>0&&e-o<1)return!0}return!1},d=()=>e.reduce((e,t)=>{let r=document.body.querySelector("#storefront")?.querySelector(`[data-uid="${o}"]`);if(!r)return 0;let n=r.querySelectorAll(`[data-component-tag="${t}"]`).length;return e+n},0),s=()=>{if("POST_PURCHASE"!==u)return!1;let r=!1;return e.includes(n)&&(r=l())?r:!!(t.includes(n)&&d()>0)&&a()},i=()=>{if(e.includes(n))return{text:"This element is required <br> and can’t be deleted",width:"175px"};{let e="Section"===n?"section":"element";return{text:`This ${e} contains required <br> elements and cannot be deleted`,width:"206px"}}};return{checkDisableDelete:s,getTooltipText:i,checkDisableDuplicate:()=>"GP_FUNNEL_PAGE"===u&&"ProductList"===n}};export{usePostPurchase};