@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.
- package/README.md +1 -1
- package/dist/cjs/components/AddOn.js +2 -18
- package/dist/cjs/components/ComponentAnimation.js +2 -17
- package/dist/cjs/components/ComponentToolbarPreview.js +2 -752
- package/dist/cjs/components/ComponentWrapper.js +2 -61
- package/dist/cjs/components/ComponentWrapperPreview.js +2 -213
- package/dist/cjs/components/Empty.js +2 -7
- package/dist/cjs/components/InteractionSuffix.js +2 -42
- package/dist/cjs/components/Render.js +2 -75
- package/dist/cjs/components/Render.liquid.js +16 -307
- package/dist/cjs/components/RenderBlock.js +2 -54
- package/dist/cjs/components/RenderCustomCode.js +4 -59
- package/dist/cjs/components/RenderPreview.js +2 -67
- package/dist/cjs/components/RenderSection.js +2 -23
- package/dist/cjs/components/ai-generator/AIContentGenerator.js +2 -252
- package/dist/cjs/components/ai-generator/AIGenContentLoading.js +2 -85
- package/dist/cjs/components/ai-generator/components/PickProduct.js +2 -220
- package/dist/cjs/components/ai-generator/components/ToneAndVoice.js +2 -77
- package/dist/cjs/components/ai-generator/hooks/useCheckingProductInside.js +1 -47
- package/dist/cjs/components/ai-generator/hooks/useFlipPopup.js +1 -110
- package/dist/cjs/components/ai-generator/hooks/useGettingGenerateRequest.js +1 -37
- package/dist/cjs/components/ai-generator/hooks/useListenEventGenerate.js +1 -70
- package/dist/cjs/components/ai-generator/icons/AIIcon.js +2 -67
- package/dist/cjs/components/ai-generator/icons/CloseIcon.js +2 -19
- package/dist/cjs/components/ai-generator/icons/DropdownIcon.js +2 -37
- package/dist/cjs/components/ai-generator/icons/SearchIcon.js +2 -21
- package/dist/cjs/components/ai-generator/icons/ShowMoreIcon.js +2 -21
- package/dist/cjs/components/ai-generator/icons/UpgradeIcon.js +2 -27
- package/dist/cjs/components/ai-generator/icons/WarningIcon.js +2 -31
- package/dist/cjs/components/constant.js +1 -82
- package/dist/cjs/components/resize/Resize.js +2 -16
- package/dist/cjs/components/resize/Spacing.js +2 -260
- package/dist/cjs/components/src/product/helpers/variant-presets.js +1 -56
- package/dist/cjs/components/theme-section/CreateThemeSection.js +2 -123
- package/dist/cjs/components/theme-section/ThemeSectionStatus.js +2 -45
- package/dist/cjs/components/theme-section/ThemeSectionTooltip.js +2 -126
- package/dist/cjs/components/toolbar/Tooltip.js +2 -28
- package/dist/cjs/constants/device.js +1 -0
- package/dist/cjs/contexts/AddonContext.js +2 -36
- package/dist/cjs/contexts/ArticleContext.js +2 -39
- package/dist/cjs/contexts/ArticleListContext.js +2 -31
- package/dist/cjs/contexts/BuilderComponent.js +2 -34
- package/dist/cjs/contexts/BuilderContext.js +2 -39
- package/dist/cjs/contexts/BuilderPreviewContext.js +2 -482
- package/dist/cjs/contexts/CartLineContext.js +2 -29
- package/dist/cjs/contexts/CollectionContext.js +2 -38
- package/dist/cjs/contexts/I18nContext.js +2 -0
- package/dist/cjs/contexts/ModalContext.js +2 -47
- package/dist/cjs/contexts/PageContext.js +2 -111
- package/dist/cjs/contexts/ProductContext.js +2 -182
- package/dist/cjs/contexts/ProductListContext.js +2 -32
- package/dist/cjs/contexts/SectionContext.js +2 -53
- package/dist/cjs/contexts/ShopContext.js +2 -107
- package/dist/cjs/graphql/fragments/analytic.generated.js +2 -6
- package/dist/cjs/graphql/fragments/collection-detail.generated.js +2 -6
- package/dist/cjs/graphql/fragments/collection-product.generated.js +2 -6
- package/dist/cjs/graphql/fragments/collection.generated.js +2 -6
- package/dist/cjs/graphql/fragments/custom-code.generated.js +2 -6
- package/dist/cjs/graphql/fragments/custom-font.generated.js +7 -7
- package/dist/cjs/graphql/fragments/data-seo.generated.js +2 -6
- package/dist/cjs/graphql/fragments/media.generated.js +2 -6
- package/dist/cjs/graphql/fragments/preview-theme-page.generated.js +6 -6
- package/dist/cjs/graphql/fragments/product-little.generated.js +2 -6
- package/dist/cjs/graphql/fragments/product-option-value.generated.js +2 -6
- package/dist/cjs/graphql/fragments/product-option.generated.js +2 -6
- package/dist/cjs/graphql/fragments/product.generated.js +2 -6
- package/dist/cjs/graphql/fragments/published-custom-section.generated.js +2 -6
- package/dist/cjs/graphql/fragments/published-page-section.generated.js +2 -6
- package/dist/cjs/graphql/fragments/published-theme-page.generated.js +4 -18
- package/dist/cjs/graphql/fragments/published-theme-style.generated.js +2 -6
- package/dist/cjs/graphql/fragments/selected-option.generated.js +2 -6
- package/dist/cjs/graphql/fragments/variant.generated.js +2 -6
- package/dist/cjs/graphql/mutations/page-view-up.generated.js +2 -6
- package/dist/cjs/graphql/queries/articles.generated.js +2 -6
- package/dist/cjs/graphql/queries/blogs.generated.js +2 -6
- package/dist/cjs/graphql/queries/collection-detail-filter.generated.js +2 -16
- package/dist/cjs/graphql/queries/collection.generated.js +2 -14
- package/dist/cjs/graphql/queries/collections.generated.js +2 -9
- package/dist/cjs/graphql/queries/preview-page.generated.js +2 -12
- package/dist/cjs/graphql/queries/product-little-detail.generated.js +2 -11
- package/dist/cjs/graphql/queries/product-medias.generated.js +2 -8
- package/dist/cjs/graphql/queries/product-value-label.generated.js +2 -6
- package/dist/cjs/graphql/queries/product-variants.generated.js +3 -11
- package/dist/cjs/graphql/queries/products.generated.js +3 -17
- package/dist/cjs/graphql/queries/{published-shop-metas.js → published-shop-metas.generated.js} +2 -6
- package/dist/cjs/graphql/queries/published-theme-pages.generated.js +3 -19
- package/dist/cjs/graphql/queries/shop-shopify.generated.js +2 -6
- package/dist/cjs/graphql/queries/store-property.generated.js +2 -6
- package/dist/cjs/graphql-app-api/queries/LibrarySaleFunnelDiscount.generated.js +2 -6
- package/dist/cjs/graphql-app-api/queries/LibraryTemplate.generated.js +2 -6
- package/dist/cjs/graphql-app-api/queries/SaleFunnelDiscounts.generated.js +2 -6
- package/dist/cjs/graphql-app-api/queries/SaleFunnelOffer.generated.js +2 -6
- package/dist/cjs/graphql-app-api/queries/ShopLibraryPage.generated.js +2 -6
- package/dist/cjs/graphql-app-api/queries/ThemePage.generated.js +2 -6
- package/dist/cjs/helpers/GlobalEvent.js +1 -19
- package/dist/cjs/helpers/align.js +1 -37
- package/dist/cjs/helpers/animations.js +1 -222
- package/dist/cjs/helpers/background.js +1 -236
- package/dist/cjs/helpers/backgroundImage.js +1 -0
- package/dist/cjs/helpers/borders.js +4 -198
- package/dist/cjs/helpers/carousel.js +1 -55
- package/dist/cjs/helpers/clone-deep.js +1 -5
- package/dist/cjs/helpers/cls.js +1 -16
- package/dist/cjs/helpers/colors.js +1 -184
- package/dist/cjs/helpers/compose-advance-style.js +1 -323
- package/dist/cjs/helpers/composeClasses.js +1 -0
- package/dist/cjs/helpers/const.js +1 -0
- package/dist/cjs/helpers/constant.js +1 -23
- package/dist/cjs/helpers/convert.js +1 -7
- package/dist/cjs/helpers/covert-entities-html.js +1 -19
- package/dist/cjs/helpers/css-variable.js +1 -7
- package/dist/cjs/helpers/email.js +1 -11
- package/dist/cjs/helpers/filter-styles.js +1 -0
- package/dist/cjs/helpers/filter-toolbar-preview.js +2 -14
- package/dist/cjs/helpers/flatten-connection.js +1 -9
- package/dist/cjs/helpers/get-resonsive-value.js +1 -36
- package/dist/cjs/helpers/get-shortname.js +1 -92
- package/dist/cjs/helpers/icon-list.js +1 -61
- package/dist/cjs/helpers/interaction/index.js +2 -134
- package/dist/cjs/helpers/is-browser.js +1 -9
- package/dist/cjs/helpers/is-defined.js +1 -7
- package/dist/cjs/helpers/is-empty-children.js +2 -15
- package/dist/cjs/helpers/is-safari.js +1 -9
- package/dist/cjs/helpers/layout.js +1 -76
- package/dist/cjs/helpers/load-script.js +1 -31
- package/dist/cjs/helpers/loop-component.js +1 -16
- package/dist/cjs/helpers/make-style.js +1 -163
- package/dist/cjs/helpers/normalize-builder-data.js +1 -23
- package/dist/cjs/helpers/pascal-to-kebab-case.js +1 -7
- package/dist/cjs/helpers/prefetch-queries.js +1 -78
- package/dist/cjs/helpers/product.js +1 -48
- package/dist/cjs/helpers/queries/get-collection.js +1 -226
- package/dist/cjs/helpers/queries/get-collections.js +1 -21
- package/dist/cjs/helpers/queries/get-product-by-slug.js +1 -125
- package/dist/cjs/helpers/queries/get-product.js +1 -154
- package/dist/cjs/helpers/queries/get-products.js +1 -214
- package/dist/cjs/helpers/query.js +1 -29
- package/dist/cjs/helpers/radius.js +6 -140
- package/dist/cjs/helpers/render.js +1 -91
- package/dist/cjs/helpers/shadow.js +1 -69
- package/dist/cjs/helpers/size.js +4 -228
- package/dist/cjs/helpers/spacing.js +1 -43
- package/dist/cjs/helpers/third-party/addAppBlockId.js +1 -20
- package/dist/cjs/helpers/third-party/appConfig.js +1 -416
- package/dist/cjs/helpers/third-party/appSetting.js +1 -1324
- package/dist/cjs/helpers/third-party/composeAppBlockId.js +1 -11
- package/dist/cjs/helpers/third-party/constant.js +1 -69
- package/dist/cjs/helpers/third-party/generateAppBlockConfigs.js +1 -34
- package/dist/cjs/helpers/third-party/getAppBlockConfig.js +1 -55
- package/dist/cjs/helpers/third-party/getAppBlockType.js +1 -12
- package/dist/cjs/helpers/third-party/getAppBlocks.js +1 -30
- package/dist/cjs/helpers/third-party/mergeBlock.js +1 -19
- package/dist/cjs/helpers/third-party/mergeBlockOrder.js +1 -47
- package/dist/cjs/helpers/third-party/removeGPAppItems.js +1 -18
- package/dist/cjs/helpers/tracking/fpixel.js +1 -28
- package/dist/cjs/helpers/tracking/gtag.js +1 -93
- package/dist/cjs/helpers/tracking/tiktokpixel.js +1 -17
- package/dist/cjs/helpers/typography.js +19 -160
- package/dist/cjs/helpers/variant.js +1 -11
- package/dist/cjs/hooks/animation/useAnimationActions.js +2 -39
- package/dist/cjs/hooks/animation/useAnimationConfig.js +2 -30
- package/dist/cjs/hooks/animation/useAnimationPreview.js +2 -31
- package/dist/cjs/hooks/animation/useAnimationTarget.js +2 -122
- package/dist/cjs/hooks/animation/useApplyAnimation.js +2 -89
- package/dist/cjs/hooks/articles/useArticlesQuery.js +2 -33
- package/dist/cjs/hooks/cart/use-add-to-cart.js +2 -20
- package/dist/cjs/hooks/cart/use-cart-data.js +2 -28
- package/dist/cjs/hooks/cart/use-cart-discount-codes-update.js +2 -20
- package/dist/cjs/hooks/cart/use-cart-note-update.js +2 -20
- package/dist/cjs/hooks/cart/use-create-cart.js +2 -22
- package/dist/cjs/hooks/cart/use-remove-cart-item.js +2 -20
- package/dist/cjs/hooks/cart/use-update-cart-item.js +2 -20
- package/dist/cjs/hooks/shop/use-collection-query.js +2 -22
- package/dist/cjs/hooks/shop/use-collections-query.js +2 -17
- package/dist/cjs/hooks/shop/use-product-query.js +2 -22
- package/dist/cjs/hooks/shop/use-products-query.js +2 -63
- package/dist/cjs/hooks/shop/useShopifyLink.js +2 -0
- package/dist/cjs/hooks/shop.js +2 -135
- package/dist/cjs/hooks/use-current-device.js +2 -30
- package/dist/cjs/hooks/use-lazy-video.js +2 -15
- package/dist/cjs/hooks/useAnimations.js +2 -29
- package/dist/cjs/hooks/useCartId.js +2 -44
- package/dist/cjs/hooks/useCartLine.js +2 -11
- package/dist/cjs/hooks/useCartUI.js +2 -48
- package/dist/cjs/hooks/useCollection.js +2 -9
- package/dist/cjs/hooks/useFetchHandle.js +2 -13
- package/dist/cjs/hooks/useFormatMoney.js +2 -75
- package/dist/cjs/hooks/useI18n.js +2 -0
- package/dist/cjs/hooks/useInitialSwatchesOptions.js +2 -127
- package/dist/cjs/hooks/useInteraction.js +2 -19
- package/dist/cjs/hooks/useIsomorphicLayoutEffect.js +2 -10
- package/dist/cjs/hooks/useLoadScript.js +2 -32
- package/dist/cjs/hooks/useMoney.js +2 -84
- package/dist/cjs/hooks/usePrevious.js +2 -19
- package/dist/cjs/hooks/useProduct.js +2 -250
- package/dist/cjs/hooks/useProductList.js +2 -21
- package/dist/cjs/hooks/useStickyStore.js +1 -0
- package/dist/cjs/hooks/useSuspenseFetch.js +2 -27
- package/dist/cjs/hooks/useSwatchesOptions.js +2 -41
- package/dist/cjs/hooks/useToolbarPostPurchase.js +2 -89
- package/dist/cjs/index.js +1 -425
- package/dist/cjs/types/animations.js +1 -49
- package/dist/cjs/types/appAPI.js +1 -2
- package/dist/cjs/types/custom.js +1 -52
- package/dist/cjs/types/global-style.js +1 -15
- package/dist/cjs/types/shop.js +1 -2
- package/dist/esm/components/AddOn.js +2 -14
- package/dist/esm/components/ComponentAnimation.js +2 -13
- package/dist/esm/components/ComponentToolbarPreview.js +2 -748
- package/dist/esm/components/ComponentWrapper.js +2 -57
- package/dist/esm/components/ComponentWrapperPreview.js +2 -209
- package/dist/esm/components/Empty.js +2 -3
- package/dist/esm/components/InteractionSuffix.js +2 -40
- package/dist/esm/components/Render.js +2 -71
- package/dist/esm/components/Render.liquid.js +16 -301
- package/dist/esm/components/RenderBlock.js +2 -50
- package/dist/esm/components/RenderCustomCode.js +4 -55
- package/dist/esm/components/RenderPreview.js +2 -63
- package/dist/esm/components/RenderSection.js +2 -19
- package/dist/esm/components/ai-generator/AIContentGenerator.js +2 -250
- package/dist/esm/components/ai-generator/AIGenContentLoading.js +2 -83
- package/dist/esm/components/ai-generator/components/PickProduct.js +2 -218
- package/dist/esm/components/ai-generator/components/ToneAndVoice.js +2 -75
- package/dist/esm/components/ai-generator/hooks/useCheckingProductInside.js +1 -45
- package/dist/esm/components/ai-generator/hooks/useFlipPopup.js +1 -108
- package/dist/esm/components/ai-generator/hooks/useGettingGenerateRequest.js +1 -35
- package/dist/esm/components/ai-generator/hooks/useListenEventGenerate.js +1 -68
- package/dist/esm/components/ai-generator/icons/AIIcon.js +2 -65
- package/dist/esm/components/ai-generator/icons/CloseIcon.js +2 -17
- package/dist/esm/components/ai-generator/icons/DropdownIcon.js +2 -34
- package/dist/esm/components/ai-generator/icons/SearchIcon.js +2 -19
- package/dist/esm/components/ai-generator/icons/ShowMoreIcon.js +2 -19
- package/dist/esm/components/ai-generator/icons/UpgradeIcon.js +2 -25
- package/dist/esm/components/ai-generator/icons/WarningIcon.js +2 -29
- package/dist/esm/components/constant.js +1 -75
- package/dist/esm/components/resize/Resize.js +2 -12
- package/dist/esm/components/resize/Spacing.js +2 -256
- package/dist/esm/components/src/product/helpers/variant-presets.js +1 -54
- package/dist/esm/components/theme-section/CreateThemeSection.js +2 -121
- package/dist/esm/components/theme-section/ThemeSectionStatus.js +2 -43
- package/dist/esm/components/theme-section/ThemeSectionTooltip.js +2 -124
- package/dist/esm/components/toolbar/Tooltip.js +2 -24
- package/dist/esm/constants/device.js +1 -0
- package/dist/esm/contexts/AddonContext.js +2 -32
- package/dist/esm/contexts/ArticleContext.js +2 -36
- package/dist/esm/contexts/ArticleListContext.js +2 -27
- package/dist/esm/contexts/BuilderComponent.js +2 -31
- package/dist/esm/contexts/BuilderContext.js +2 -36
- package/dist/esm/contexts/BuilderPreviewContext.js +2 -479
- package/dist/esm/contexts/CartLineContext.js +2 -26
- package/dist/esm/contexts/CollectionContext.js +2 -35
- package/dist/esm/contexts/I18nContext.js +2 -0
- package/dist/esm/contexts/ModalContext.js +2 -44
- package/dist/esm/contexts/PageContext.js +2 -108
- package/dist/esm/contexts/ProductContext.js +2 -179
- package/dist/esm/contexts/ProductListContext.js +2 -28
- package/dist/esm/contexts/SectionContext.js +2 -49
- package/dist/esm/contexts/ShopContext.js +2 -104
- package/dist/esm/graphql/fragments/analytic.generated.js +2 -4
- package/dist/esm/graphql/fragments/collection-detail.generated.js +2 -4
- package/dist/esm/graphql/fragments/collection-product.generated.js +2 -4
- package/dist/esm/graphql/fragments/collection.generated.js +2 -4
- package/dist/esm/graphql/fragments/custom-code.generated.js +2 -4
- package/dist/esm/graphql/fragments/custom-font.generated.js +7 -5
- package/dist/esm/graphql/fragments/data-seo.generated.js +2 -4
- package/dist/esm/graphql/fragments/media.generated.js +2 -4
- package/dist/esm/graphql/fragments/preview-theme-page.generated.js +6 -4
- package/dist/esm/graphql/fragments/product-little.generated.js +2 -4
- package/dist/esm/graphql/fragments/product-option-value.generated.js +2 -4
- package/dist/esm/graphql/fragments/product-option.generated.js +2 -4
- package/dist/esm/graphql/fragments/product.generated.js +2 -4
- package/dist/esm/graphql/fragments/published-custom-section.generated.js +2 -4
- package/dist/esm/graphql/fragments/published-page-section.generated.js +2 -4
- package/dist/esm/graphql/fragments/published-theme-page.generated.js +4 -16
- package/dist/esm/graphql/fragments/published-theme-style.generated.js +2 -4
- package/dist/esm/graphql/fragments/selected-option.generated.js +2 -4
- package/dist/esm/graphql/fragments/variant.generated.js +2 -4
- package/dist/esm/graphql/mutations/page-view-up.generated.js +2 -4
- package/dist/esm/graphql/queries/articles.generated.js +2 -4
- package/dist/esm/graphql/queries/blogs.generated.js +2 -4
- package/dist/esm/graphql/queries/collection-detail-filter.generated.js +10 -22
- package/dist/esm/graphql/queries/collection.generated.js +8 -18
- package/dist/esm/graphql/queries/collections.generated.js +3 -8
- package/dist/esm/graphql/queries/preview-page.generated.js +6 -14
- package/dist/esm/graphql/queries/product-little-detail.generated.js +5 -12
- package/dist/esm/graphql/queries/product-medias.generated.js +2 -6
- package/dist/esm/graphql/queries/product-value-label.generated.js +2 -4
- package/dist/esm/graphql/queries/product-variants.generated.js +5 -11
- package/dist/esm/graphql/queries/products.generated.js +9 -20
- package/dist/esm/graphql/queries/{published-shop-metas.js → published-shop-metas.generated.js} +2 -4
- package/dist/esm/graphql/queries/published-theme-pages.generated.js +6 -20
- package/dist/esm/graphql/queries/shop-shopify.generated.js +2 -4
- package/dist/esm/graphql/queries/store-property.generated.js +2 -4
- package/dist/esm/graphql-app-api/queries/LibrarySaleFunnelDiscount.generated.js +2 -4
- package/dist/esm/graphql-app-api/queries/LibraryTemplate.generated.js +2 -4
- package/dist/esm/graphql-app-api/queries/SaleFunnelDiscounts.generated.js +2 -4
- package/dist/esm/graphql-app-api/queries/SaleFunnelOffer.generated.js +2 -4
- package/dist/esm/graphql-app-api/queries/ShopLibraryPage.generated.js +2 -4
- package/dist/esm/graphql-app-api/queries/ThemePage.generated.js +2 -4
- package/dist/esm/helpers/GlobalEvent.js +1 -15
- package/dist/esm/helpers/align.js +1 -34
- package/dist/esm/helpers/animations.js +1 -220
- package/dist/esm/helpers/background.js +1 -227
- package/dist/esm/helpers/backgroundImage.js +1 -0
- package/dist/esm/helpers/borders.js +4 -189
- package/dist/esm/helpers/carousel.js +1 -51
- package/dist/esm/helpers/clone-deep.js +1 -3
- package/dist/esm/helpers/cls.js +1 -14
- package/dist/esm/helpers/colors.js +1 -169
- package/dist/esm/helpers/compose-advance-style.js +1 -315
- package/dist/esm/helpers/composeClasses.js +1 -0
- package/dist/esm/helpers/const.js +1 -0
- package/dist/esm/helpers/constant.js +1 -19
- package/dist/esm/helpers/convert.js +1 -4
- package/dist/esm/helpers/covert-entities-html.js +1 -17
- package/dist/esm/helpers/css-variable.js +1 -5
- package/dist/esm/helpers/email.js +1 -6
- package/dist/esm/helpers/filter-styles.js +1 -0
- package/dist/esm/helpers/filter-toolbar-preview.js +2 -9
- package/dist/esm/helpers/flatten-connection.js +1 -7
- package/dist/esm/helpers/get-resonsive-value.js +1 -31
- package/dist/esm/helpers/get-shortname.js +1 -90
- package/dist/esm/helpers/icon-list.js +1 -58
- package/dist/esm/helpers/interaction/index.js +2 -132
- package/dist/esm/helpers/is-browser.js +1 -5
- package/dist/esm/helpers/is-defined.js +1 -5
- package/dist/esm/helpers/is-empty-children.js +2 -10
- package/dist/esm/helpers/is-safari.js +1 -5
- package/dist/esm/helpers/layout.js +1 -70
- package/dist/esm/helpers/load-script.js +1 -29
- package/dist/esm/helpers/loop-component.js +1 -14
- package/dist/esm/helpers/make-style.js +1 -149
- package/dist/esm/helpers/normalize-builder-data.js +1 -21
- package/dist/esm/helpers/pascal-to-kebab-case.js +1 -5
- package/dist/esm/helpers/prefetch-queries.js +1 -76
- package/dist/esm/helpers/product.js +1 -44
- package/dist/esm/helpers/queries/get-collection.js +1 -223
- package/dist/esm/helpers/queries/get-collections.js +1 -19
- package/dist/esm/helpers/queries/get-product-by-slug.js +1 -123
- package/dist/esm/helpers/queries/get-product.js +1 -150
- package/dist/esm/helpers/queries/get-products.js +1 -210
- package/dist/esm/helpers/query.js +1 -25
- package/dist/esm/helpers/radius.js +6 -132
- package/dist/esm/helpers/render.js +1 -82
- package/dist/esm/helpers/shadow.js +1 -63
- package/dist/esm/helpers/size.js +4 -213
- package/dist/esm/helpers/spacing.js +1 -40
- package/dist/esm/helpers/third-party/addAppBlockId.js +1 -18
- package/dist/esm/helpers/third-party/appConfig.js +1 -356
- package/dist/esm/helpers/third-party/appSetting.js +1 -1321
- package/dist/esm/helpers/third-party/composeAppBlockId.js +1 -9
- package/dist/esm/helpers/third-party/constant.js +1 -66
- package/dist/esm/helpers/third-party/generateAppBlockConfigs.js +1 -32
- package/dist/esm/helpers/third-party/getAppBlockConfig.js +1 -53
- package/dist/esm/helpers/third-party/getAppBlockType.js +1 -10
- package/dist/esm/helpers/third-party/getAppBlocks.js +1 -28
- package/dist/esm/helpers/third-party/mergeBlock.js +1 -17
- package/dist/esm/helpers/third-party/mergeBlockOrder.js +1 -45
- package/dist/esm/helpers/third-party/removeGPAppItems.js +1 -15
- package/dist/esm/helpers/tracking/fpixel.js +1 -24
- package/dist/esm/helpers/tracking/gtag.js +1 -87
- package/dist/esm/helpers/tracking/tiktokpixel.js +1 -15
- package/dist/esm/helpers/typography.js +19 -149
- package/dist/esm/helpers/variant.js +1 -9
- package/dist/esm/hooks/animation/useAnimationActions.js +2 -37
- package/dist/esm/hooks/animation/useAnimationConfig.js +2 -28
- package/dist/esm/hooks/animation/useAnimationPreview.js +2 -29
- package/dist/esm/hooks/animation/useAnimationTarget.js +2 -120
- package/dist/esm/hooks/animation/useApplyAnimation.js +2 -85
- package/dist/esm/hooks/articles/useArticlesQuery.js +2 -30
- package/dist/esm/hooks/cart/use-add-to-cart.js +2 -18
- package/dist/esm/hooks/cart/use-cart-data.js +2 -26
- package/dist/esm/hooks/cart/use-cart-discount-codes-update.js +2 -18
- package/dist/esm/hooks/cart/use-cart-note-update.js +2 -18
- package/dist/esm/hooks/cart/use-create-cart.js +2 -20
- package/dist/esm/hooks/cart/use-remove-cart-item.js +2 -18
- package/dist/esm/hooks/cart/use-update-cart-item.js +2 -18
- package/dist/esm/hooks/shop/use-collection-query.js +2 -20
- package/dist/esm/hooks/shop/use-collections-query.js +2 -15
- package/dist/esm/hooks/shop/use-product-query.js +2 -20
- package/dist/esm/hooks/shop/use-products-query.js +2 -59
- package/dist/esm/hooks/shop/useShopifyLink.js +2 -0
- package/dist/esm/hooks/shop.js +2 -119
- package/dist/esm/hooks/use-current-device.js +2 -28
- package/dist/esm/hooks/use-lazy-video.js +2 -13
- package/dist/esm/hooks/useAnimations.js +2 -27
- package/dist/esm/hooks/useCartId.js +2 -40
- package/dist/esm/hooks/useCartLine.js +2 -7
- package/dist/esm/hooks/useCartUI.js +2 -44
- package/dist/esm/hooks/useCollection.js +2 -7
- package/dist/esm/hooks/useFetchHandle.js +2 -11
- package/dist/esm/hooks/useFormatMoney.js +2 -71
- package/dist/esm/hooks/useI18n.js +2 -0
- package/dist/esm/hooks/useInitialSwatchesOptions.js +2 -123
- package/dist/esm/hooks/useInteraction.js +2 -17
- package/dist/esm/hooks/useIsomorphicLayoutEffect.js +2 -6
- package/dist/esm/hooks/useLoadScript.js +2 -28
- package/dist/esm/hooks/useMoney.js +2 -80
- package/dist/esm/hooks/usePrevious.js +2 -17
- package/dist/esm/hooks/useProduct.js +2 -233
- package/dist/esm/hooks/useProductList.js +2 -16
- package/dist/esm/hooks/useStickyStore.js +1 -0
- package/dist/esm/hooks/useSuspenseFetch.js +2 -23
- package/dist/esm/hooks/useSwatchesOptions.js +2 -37
- package/dist/esm/hooks/useToolbarPostPurchase.js +2 -87
- package/dist/esm/index.js +1 -119
- package/dist/esm/types/animations.js +1 -49
- package/dist/esm/types/custom.js +1 -52
- package/dist/esm/types/global-style.js +1 -12
- package/dist/types/index.d.ts +12025 -8969
- package/package.json +6 -6
- package/dist/cjs/web-components/src/helpers/styles/constant.js +0 -9
- package/dist/esm/web-components/src/helpers/styles/constant.js +0 -7
|
@@ -1,80 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
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
|
-
|
|
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
|
-
|
|
2
|
-
import {
|
|
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
|
-
|
|
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
|
-
|
|
2
|
-
|
|
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
|
-
|
|
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
|
-
|
|
2
|
-
import {
|
|
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};
|