@gem-sdk/core 2.0.0-dev.896 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/AddOn.js +18 -1
- package/dist/cjs/components/ComponentAnimation.js +17 -0
- package/dist/cjs/components/ComponentToolbarPreview.js +752 -1
- package/dist/cjs/components/ComponentWrapper.js +61 -1
- package/dist/cjs/components/ComponentWrapperPreview.js +213 -1
- package/dist/cjs/components/Empty.js +7 -1
- package/dist/cjs/components/InteractionSuffix.js +42 -0
- package/dist/cjs/components/Render.js +75 -1
- package/dist/cjs/components/Render.liquid.js +313 -17
- package/dist/cjs/components/RenderBlock.js +54 -1
- package/dist/cjs/components/RenderCustomCode.js +59 -3
- package/dist/cjs/components/RenderPreview.js +67 -1
- package/dist/cjs/components/RenderSection.js +23 -1
- package/dist/cjs/components/ai-generator/AIContentGenerator.js +252 -1
- package/dist/cjs/components/ai-generator/AIGenContentLoading.js +85 -1
- package/dist/cjs/components/ai-generator/components/PickProduct.js +220 -1
- package/dist/cjs/components/ai-generator/components/ToneAndVoice.js +77 -1
- package/dist/cjs/components/ai-generator/hooks/useCheckingProductInside.js +47 -0
- package/dist/cjs/components/ai-generator/hooks/useFlipPopup.js +110 -0
- package/dist/cjs/components/ai-generator/hooks/useGettingGenerateRequest.js +37 -1
- package/dist/cjs/components/ai-generator/hooks/useListenEventGenerate.js +70 -1
- package/dist/cjs/components/ai-generator/icons/AIIcon.js +67 -1
- package/dist/cjs/components/ai-generator/icons/CloseIcon.js +19 -1
- package/dist/cjs/components/ai-generator/icons/DropdownIcon.js +37 -1
- package/dist/cjs/components/ai-generator/icons/SearchIcon.js +21 -1
- package/dist/cjs/components/ai-generator/icons/ShowMoreIcon.js +21 -1
- package/dist/cjs/components/ai-generator/icons/UpgradeIcon.js +27 -0
- package/dist/cjs/components/ai-generator/icons/WarningIcon.js +31 -0
- package/dist/cjs/components/constant.js +83 -1
- package/dist/cjs/components/resize/Resize.js +16 -1
- package/dist/cjs/components/resize/Spacing.js +260 -1
- package/dist/cjs/components/src/product/helpers/variant-presets.js +56 -1
- package/dist/cjs/components/theme-section/CreateThemeSection.js +123 -1
- package/dist/cjs/components/theme-section/ThemeSectionStatus.js +45 -1
- package/dist/cjs/components/theme-section/ThemeSectionTooltip.js +126 -1
- package/dist/cjs/components/toolbar/Tooltip.js +28 -1
- package/dist/cjs/contexts/AddonContext.js +36 -1
- package/dist/cjs/contexts/ArticleContext.js +39 -1
- package/dist/cjs/contexts/ArticleListContext.js +31 -1
- package/dist/cjs/contexts/BuilderComponent.js +34 -1
- package/dist/cjs/contexts/BuilderContext.js +39 -1
- package/dist/cjs/contexts/BuilderPreviewContext.js +486 -1
- package/dist/cjs/contexts/CartLineContext.js +29 -1
- package/dist/cjs/contexts/CollectionContext.js +38 -1
- package/dist/cjs/contexts/ModalContext.js +47 -1
- package/dist/cjs/contexts/PageContext.js +104 -1
- package/dist/cjs/contexts/ProductContext.js +177 -1
- package/dist/cjs/contexts/ProductListContext.js +32 -1
- package/dist/cjs/contexts/SectionContext.js +53 -1
- package/dist/cjs/contexts/ShopContext.js +107 -1
- package/dist/cjs/graphql/fragments/analytic.generated.js +6 -2
- package/dist/cjs/graphql/fragments/collection-detail.generated.js +6 -2
- package/dist/cjs/graphql/fragments/collection-product.generated.js +6 -2
- package/dist/cjs/graphql/fragments/collection.generated.js +6 -2
- package/dist/cjs/graphql/fragments/custom-code.generated.js +6 -2
- package/dist/cjs/graphql/fragments/custom-font.generated.js +6 -2
- package/dist/cjs/graphql/fragments/data-seo.generated.js +6 -2
- package/dist/cjs/graphql/fragments/media.generated.js +6 -2
- package/dist/cjs/graphql/fragments/preview-theme-page.generated.js +39 -0
- package/dist/cjs/graphql/fragments/product-little.generated.js +7 -2
- package/dist/cjs/graphql/fragments/product-option-value.generated.js +6 -2
- package/dist/cjs/graphql/fragments/product-option.generated.js +6 -2
- package/dist/cjs/graphql/fragments/product.generated.js +6 -2
- package/dist/cjs/graphql/fragments/published-custom-section.generated.js +6 -2
- package/dist/cjs/graphql/fragments/published-page-section.generated.js +6 -2
- package/dist/cjs/graphql/fragments/published-theme-page.generated.js +10 -28
- package/dist/cjs/graphql/fragments/published-theme-style.generated.js +6 -2
- package/dist/cjs/graphql/fragments/selected-option.generated.js +6 -2
- package/dist/cjs/graphql/fragments/variant.generated.js +6 -2
- package/dist/cjs/graphql/mutations/page-view-up.generated.js +8 -4
- package/dist/cjs/graphql/queries/articles.generated.js +61 -0
- package/dist/cjs/graphql/queries/blogs.generated.js +69 -0
- package/dist/cjs/graphql/queries/collection-detail-filter.generated.js +16 -2
- package/dist/cjs/graphql/queries/collection.generated.js +14 -2
- package/dist/cjs/graphql/queries/collections.generated.js +9 -2
- package/dist/cjs/graphql/queries/preview-page.generated.js +16 -8
- package/dist/cjs/graphql/queries/product-little-detail.generated.js +11 -2
- package/dist/cjs/graphql/queries/product-medias.generated.js +8 -2
- package/dist/cjs/graphql/queries/product-value-label.generated.js +6 -2
- package/dist/cjs/graphql/queries/product-variants.generated.js +10 -2
- package/dist/cjs/graphql/queries/products.generated.js +17 -3
- package/dist/cjs/graphql/queries/published-shop-metas.js +15 -0
- package/dist/cjs/graphql/queries/published-theme-pages.generated.js +15 -2
- package/dist/cjs/graphql/queries/store-property.generated.js +6 -2
- package/dist/cjs/graphql-app-api/queries/LibrarySaleFunnelDiscount.generated.js +6 -2
- package/dist/cjs/graphql-app-api/queries/LibraryTemplate.generated.js +6 -2
- package/dist/cjs/graphql-app-api/queries/SaleFunnelDiscounts.generated.js +6 -2
- package/dist/cjs/graphql-app-api/queries/ShopLibraryPage.generated.js +17 -0
- package/dist/cjs/graphql-app-api/queries/ThemePage.generated.js +6 -2
- package/dist/cjs/helpers/GlobalEvent.js +19 -1
- package/dist/cjs/helpers/align.js +19 -0
- package/dist/cjs/helpers/animations.js +222 -1
- package/dist/cjs/helpers/background.js +235 -1
- package/dist/cjs/helpers/borders.js +198 -4
- package/dist/cjs/helpers/carousel.js +55 -1
- package/dist/cjs/helpers/clone-deep.js +5 -1
- package/dist/cjs/helpers/cls.js +16 -1
- package/dist/cjs/helpers/colors.js +184 -1
- package/dist/cjs/helpers/compose-advance-style.js +327 -1
- package/dist/cjs/helpers/constant.js +23 -1
- package/dist/cjs/helpers/convert.js +7 -1
- package/dist/cjs/helpers/covert-entities-html.js +19 -1
- package/dist/cjs/helpers/css-variable.js +7 -1
- package/dist/cjs/helpers/email.js +11 -1
- package/dist/cjs/helpers/filter-toolbar-preview.js +14 -1
- package/dist/cjs/helpers/flatten-connection.js +9 -1
- package/dist/cjs/helpers/get-resonsive-value.js +36 -1
- package/dist/cjs/helpers/get-shortname.js +92 -1
- package/dist/cjs/helpers/icon-list.js +61 -1
- package/dist/cjs/helpers/interaction/index.js +134 -0
- package/dist/cjs/helpers/is-browser.js +9 -1
- package/dist/cjs/helpers/is-defined.js +7 -1
- package/dist/cjs/helpers/is-empty-children.js +15 -1
- package/dist/cjs/helpers/is-safari.js +9 -1
- package/dist/cjs/helpers/layout.js +59 -1
- package/dist/cjs/helpers/load-script.js +31 -1
- package/dist/cjs/helpers/loop-component.js +16 -0
- package/dist/cjs/helpers/make-style.js +163 -1
- package/dist/cjs/helpers/normalize-builder-data.js +23 -1
- package/dist/cjs/helpers/pascal-to-kebab-case.js +7 -0
- package/dist/cjs/helpers/prefetch-queries.js +78 -1
- package/dist/cjs/helpers/product.js +48 -1
- package/dist/cjs/helpers/queries/get-collection.js +226 -1
- package/dist/cjs/helpers/queries/get-collections.js +21 -1
- package/dist/cjs/helpers/queries/get-product-by-slug.js +125 -1
- package/dist/cjs/helpers/queries/get-product.js +154 -1
- package/dist/cjs/helpers/queries/get-products.js +214 -1
- package/dist/cjs/helpers/query.js +29 -1
- package/dist/cjs/helpers/radius.js +140 -6
- package/dist/cjs/helpers/render.js +78 -1
- package/dist/cjs/helpers/shadow.js +69 -1
- package/dist/cjs/helpers/size.js +206 -4
- package/dist/cjs/helpers/spacing.js +43 -1
- package/dist/cjs/helpers/third-party/addAppBlockId.js +20 -0
- package/dist/cjs/helpers/third-party/appConfig.js +234 -0
- package/dist/cjs/helpers/third-party/appSetting.js +661 -0
- package/dist/cjs/helpers/third-party/composeAppBlockId.js +11 -0
- package/dist/cjs/helpers/third-party/constant.js +43 -0
- package/dist/cjs/helpers/third-party/generateAppBlockConfigs.js +34 -0
- package/dist/cjs/helpers/third-party/getAppBlockConfig.js +47 -0
- package/dist/cjs/helpers/third-party/getAppBlockType.js +12 -0
- package/dist/cjs/helpers/third-party/getAppBlocks.js +30 -0
- package/dist/cjs/helpers/third-party/mergeBlock.js +19 -0
- package/dist/cjs/helpers/third-party/mergeBlockOrder.js +47 -0
- package/dist/cjs/helpers/third-party/removeGPAppItems.js +18 -0
- package/dist/cjs/helpers/tracking/fpixel.js +28 -1
- package/dist/cjs/helpers/tracking/gtag.js +93 -1
- package/dist/cjs/helpers/tracking/tiktokpixel.js +17 -1
- package/dist/cjs/helpers/typography.js +160 -17
- package/dist/cjs/helpers/variant.js +11 -1
- package/dist/cjs/hooks/animation/useAnimationActions.js +39 -1
- package/dist/cjs/hooks/animation/useAnimationConfig.js +30 -1
- package/dist/cjs/hooks/animation/useAnimationPreview.js +31 -1
- package/dist/cjs/hooks/animation/useAnimationTarget.js +122 -1
- package/dist/cjs/hooks/animation/useApplyAnimation.js +89 -1
- package/dist/cjs/hooks/articles/useArticlesQuery.js +33 -1
- package/dist/cjs/hooks/cart/use-add-to-cart.js +20 -1
- package/dist/cjs/hooks/cart/use-cart-data.js +28 -1
- package/dist/cjs/hooks/cart/use-cart-discount-codes-update.js +20 -1
- package/dist/cjs/hooks/cart/use-cart-note-update.js +20 -1
- package/dist/cjs/hooks/cart/use-create-cart.js +22 -1
- package/dist/cjs/hooks/cart/use-remove-cart-item.js +20 -1
- package/dist/cjs/hooks/cart/use-update-cart-item.js +20 -1
- package/dist/cjs/hooks/shop/use-collection-query.js +22 -1
- package/dist/cjs/hooks/shop/use-collections-query.js +17 -1
- package/dist/cjs/hooks/shop/use-product-query.js +22 -1
- package/dist/cjs/hooks/shop/use-products-query.js +63 -1
- package/dist/cjs/hooks/shop.js +126 -1
- package/dist/cjs/hooks/use-current-device.js +30 -1
- package/dist/cjs/hooks/use-lazy-video.js +15 -1
- package/dist/cjs/hooks/useAnimations.js +29 -1
- package/dist/cjs/hooks/useCartId.js +44 -1
- package/dist/cjs/hooks/useCartLine.js +11 -1
- package/dist/cjs/hooks/useCartUI.js +48 -1
- package/dist/cjs/hooks/useCollection.js +9 -1
- package/dist/cjs/hooks/useFetchHandle.js +13 -1
- package/dist/cjs/hooks/useFormatMoney.js +75 -1
- package/dist/cjs/hooks/useInitialSwatchesOptions.js +128 -1
- package/dist/cjs/hooks/useInteraction.js +19 -0
- package/dist/cjs/hooks/useIsomorphicLayoutEffect.js +10 -1
- package/dist/cjs/hooks/useLoadScript.js +32 -1
- package/dist/cjs/hooks/useMoney.js +84 -1
- package/dist/cjs/hooks/usePrevious.js +19 -1
- package/dist/cjs/hooks/useProduct.js +245 -1
- package/dist/cjs/hooks/useProductList.js +21 -1
- package/dist/cjs/hooks/useSuspenseFetch.js +27 -1
- package/dist/cjs/hooks/useSwatchesOptions.js +41 -1
- package/dist/cjs/hooks/useToolbarPostPurchase.js +89 -1
- package/dist/cjs/index.js +416 -1
- package/dist/cjs/types/animations.js +49 -1
- package/dist/cjs/types/appAPI.js +2 -1
- package/dist/cjs/types/custom.js +52 -0
- package/dist/cjs/types/global-style.js +15 -1
- package/dist/cjs/types/shop.js +2 -1
- package/dist/cjs/web-components/src/helpers/styles/constant.js +9 -1
- package/dist/esm/components/AddOn.js +14 -1
- package/dist/esm/components/ComponentAnimation.js +13 -0
- package/dist/esm/components/ComponentToolbarPreview.js +748 -1
- package/dist/esm/components/ComponentWrapper.js +57 -1
- package/dist/esm/components/ComponentWrapperPreview.js +209 -1
- package/dist/esm/components/Empty.js +3 -1
- package/dist/esm/components/InteractionSuffix.js +40 -0
- package/dist/esm/components/Render.js +71 -1
- package/dist/esm/components/Render.liquid.js +307 -17
- package/dist/esm/components/RenderBlock.js +50 -1
- package/dist/esm/components/RenderCustomCode.js +55 -3
- package/dist/esm/components/RenderPreview.js +63 -1
- package/dist/esm/components/RenderSection.js +19 -1
- package/dist/esm/components/ai-generator/AIContentGenerator.js +250 -1
- package/dist/esm/components/ai-generator/AIGenContentLoading.js +83 -1
- package/dist/esm/components/ai-generator/components/PickProduct.js +218 -1
- package/dist/esm/components/ai-generator/components/ToneAndVoice.js +75 -1
- package/dist/esm/components/ai-generator/hooks/useCheckingProductInside.js +45 -0
- package/dist/esm/components/ai-generator/hooks/useFlipPopup.js +108 -0
- package/dist/esm/components/ai-generator/hooks/useGettingGenerateRequest.js +35 -1
- package/dist/esm/components/ai-generator/hooks/useListenEventGenerate.js +68 -1
- package/dist/esm/components/ai-generator/icons/AIIcon.js +65 -1
- package/dist/esm/components/ai-generator/icons/CloseIcon.js +17 -1
- package/dist/esm/components/ai-generator/icons/DropdownIcon.js +34 -1
- package/dist/esm/components/ai-generator/icons/SearchIcon.js +19 -1
- package/dist/esm/components/ai-generator/icons/ShowMoreIcon.js +19 -1
- package/dist/esm/components/ai-generator/icons/UpgradeIcon.js +25 -0
- package/dist/esm/components/ai-generator/icons/WarningIcon.js +29 -0
- package/dist/esm/components/constant.js +76 -1
- package/dist/esm/components/resize/Resize.js +12 -1
- package/dist/esm/components/resize/Spacing.js +256 -1
- package/dist/esm/components/src/product/helpers/variant-presets.js +54 -1
- package/dist/esm/components/theme-section/CreateThemeSection.js +121 -1
- package/dist/esm/components/theme-section/ThemeSectionStatus.js +43 -1
- package/dist/esm/components/theme-section/ThemeSectionTooltip.js +124 -1
- package/dist/esm/components/toolbar/Tooltip.js +24 -1
- package/dist/esm/contexts/AddonContext.js +32 -1
- package/dist/esm/contexts/ArticleContext.js +36 -1
- package/dist/esm/contexts/ArticleListContext.js +27 -1
- package/dist/esm/contexts/BuilderComponent.js +31 -1
- package/dist/esm/contexts/BuilderContext.js +36 -1
- package/dist/esm/contexts/BuilderPreviewContext.js +483 -1
- package/dist/esm/contexts/CartLineContext.js +26 -1
- package/dist/esm/contexts/CollectionContext.js +35 -1
- package/dist/esm/contexts/ModalContext.js +44 -1
- package/dist/esm/contexts/PageContext.js +101 -1
- package/dist/esm/contexts/ProductContext.js +174 -1
- package/dist/esm/contexts/ProductListContext.js +28 -1
- package/dist/esm/contexts/SectionContext.js +49 -1
- package/dist/esm/contexts/ShopContext.js +104 -1
- package/dist/esm/graphql/fragments/analytic.generated.js +4 -2
- package/dist/esm/graphql/fragments/collection-detail.generated.js +4 -2
- package/dist/esm/graphql/fragments/collection-product.generated.js +4 -2
- package/dist/esm/graphql/fragments/collection.generated.js +4 -2
- package/dist/esm/graphql/fragments/custom-code.generated.js +4 -2
- package/dist/esm/graphql/fragments/custom-font.generated.js +4 -2
- package/dist/esm/graphql/fragments/data-seo.generated.js +4 -2
- package/dist/esm/graphql/fragments/media.generated.js +4 -2
- package/dist/esm/graphql/fragments/preview-theme-page.generated.js +37 -0
- package/dist/esm/graphql/fragments/product-little.generated.js +5 -2
- package/dist/esm/graphql/fragments/product-option-value.generated.js +4 -2
- package/dist/esm/graphql/fragments/product-option.generated.js +4 -2
- package/dist/esm/graphql/fragments/product.generated.js +4 -2
- package/dist/esm/graphql/fragments/published-custom-section.generated.js +4 -2
- package/dist/esm/graphql/fragments/published-page-section.generated.js +4 -2
- package/dist/esm/graphql/fragments/published-theme-page.generated.js +8 -28
- package/dist/esm/graphql/fragments/published-theme-style.generated.js +4 -2
- package/dist/esm/graphql/fragments/selected-option.generated.js +4 -2
- package/dist/esm/graphql/fragments/variant.generated.js +4 -2
- package/dist/esm/graphql/mutations/page-view-up.generated.js +6 -4
- package/dist/esm/graphql/queries/articles.generated.js +59 -0
- package/dist/esm/graphql/queries/blogs.generated.js +67 -0
- package/dist/esm/graphql/queries/collection-detail-filter.generated.js +22 -10
- package/dist/esm/graphql/queries/collection.generated.js +18 -8
- package/dist/esm/graphql/queries/collections.generated.js +8 -3
- package/dist/esm/graphql/queries/preview-page.generated.js +16 -10
- package/dist/esm/graphql/queries/product-little-detail.generated.js +12 -5
- package/dist/esm/graphql/queries/product-medias.generated.js +6 -2
- package/dist/esm/graphql/queries/product-value-label.generated.js +4 -2
- package/dist/esm/graphql/queries/product-variants.generated.js +10 -4
- package/dist/esm/graphql/queries/products.generated.js +20 -9
- package/dist/esm/graphql/queries/published-shop-metas.js +13 -0
- package/dist/esm/graphql/queries/published-theme-pages.generated.js +20 -9
- package/dist/esm/graphql/queries/store-property.generated.js +4 -2
- package/dist/esm/graphql-app-api/queries/LibrarySaleFunnelDiscount.generated.js +4 -2
- package/dist/esm/graphql-app-api/queries/LibraryTemplate.generated.js +4 -2
- package/dist/esm/graphql-app-api/queries/SaleFunnelDiscounts.generated.js +4 -2
- package/dist/esm/graphql-app-api/queries/ShopLibraryPage.generated.js +15 -0
- package/dist/esm/graphql-app-api/queries/ThemePage.generated.js +4 -2
- package/dist/esm/helpers/GlobalEvent.js +15 -1
- package/dist/esm/helpers/align.js +17 -0
- package/dist/esm/helpers/animations.js +220 -1
- package/dist/esm/helpers/background.js +226 -1
- package/dist/esm/helpers/borders.js +189 -4
- package/dist/esm/helpers/carousel.js +51 -1
- package/dist/esm/helpers/clone-deep.js +3 -1
- package/dist/esm/helpers/cls.js +14 -1
- package/dist/esm/helpers/colors.js +169 -1
- package/dist/esm/helpers/compose-advance-style.js +319 -1
- package/dist/esm/helpers/constant.js +19 -1
- package/dist/esm/helpers/convert.js +4 -1
- package/dist/esm/helpers/covert-entities-html.js +17 -1
- package/dist/esm/helpers/css-variable.js +5 -1
- package/dist/esm/helpers/email.js +6 -1
- package/dist/esm/helpers/filter-toolbar-preview.js +9 -1
- package/dist/esm/helpers/flatten-connection.js +7 -1
- package/dist/esm/helpers/get-resonsive-value.js +31 -1
- package/dist/esm/helpers/get-shortname.js +90 -1
- package/dist/esm/helpers/icon-list.js +58 -1
- package/dist/esm/helpers/interaction/index.js +132 -0
- package/dist/esm/helpers/is-browser.js +5 -1
- package/dist/esm/helpers/is-defined.js +5 -1
- package/dist/esm/helpers/is-empty-children.js +10 -1
- package/dist/esm/helpers/is-safari.js +5 -1
- package/dist/esm/helpers/layout.js +54 -1
- package/dist/esm/helpers/load-script.js +29 -1
- package/dist/esm/helpers/loop-component.js +14 -0
- package/dist/esm/helpers/make-style.js +149 -1
- package/dist/esm/helpers/normalize-builder-data.js +21 -1
- package/dist/esm/helpers/pascal-to-kebab-case.js +5 -0
- package/dist/esm/helpers/prefetch-queries.js +76 -1
- package/dist/esm/helpers/product.js +44 -1
- package/dist/esm/helpers/queries/get-collection.js +223 -1
- package/dist/esm/helpers/queries/get-collections.js +19 -1
- package/dist/esm/helpers/queries/get-product-by-slug.js +123 -1
- package/dist/esm/helpers/queries/get-product.js +150 -1
- package/dist/esm/helpers/queries/get-products.js +210 -1
- package/dist/esm/helpers/query.js +25 -1
- package/dist/esm/helpers/radius.js +132 -6
- package/dist/esm/helpers/render.js +70 -1
- package/dist/esm/helpers/shadow.js +63 -1
- package/dist/esm/helpers/size.js +192 -4
- package/dist/esm/helpers/spacing.js +40 -1
- package/dist/esm/helpers/third-party/addAppBlockId.js +18 -0
- package/dist/esm/helpers/third-party/appConfig.js +200 -0
- package/dist/esm/helpers/third-party/appSetting.js +658 -0
- package/dist/esm/helpers/third-party/composeAppBlockId.js +9 -0
- package/dist/esm/helpers/third-party/constant.js +40 -0
- package/dist/esm/helpers/third-party/generateAppBlockConfigs.js +32 -0
- package/dist/esm/helpers/third-party/getAppBlockConfig.js +45 -0
- package/dist/esm/helpers/third-party/getAppBlockType.js +10 -0
- package/dist/esm/helpers/third-party/getAppBlocks.js +28 -0
- package/dist/esm/helpers/third-party/mergeBlock.js +17 -0
- package/dist/esm/helpers/third-party/mergeBlockOrder.js +45 -0
- package/dist/esm/helpers/third-party/removeGPAppItems.js +15 -0
- package/dist/esm/helpers/tracking/fpixel.js +24 -1
- package/dist/esm/helpers/tracking/gtag.js +87 -1
- package/dist/esm/helpers/tracking/tiktokpixel.js +15 -1
- package/dist/esm/helpers/typography.js +149 -17
- package/dist/esm/helpers/variant.js +9 -1
- package/dist/esm/hooks/animation/useAnimationActions.js +37 -1
- package/dist/esm/hooks/animation/useAnimationConfig.js +28 -1
- package/dist/esm/hooks/animation/useAnimationPreview.js +29 -1
- package/dist/esm/hooks/animation/useAnimationTarget.js +120 -1
- package/dist/esm/hooks/animation/useApplyAnimation.js +85 -1
- package/dist/esm/hooks/articles/useArticlesQuery.js +30 -1
- package/dist/esm/hooks/cart/use-add-to-cart.js +18 -1
- package/dist/esm/hooks/cart/use-cart-data.js +26 -1
- package/dist/esm/hooks/cart/use-cart-discount-codes-update.js +18 -1
- package/dist/esm/hooks/cart/use-cart-note-update.js +18 -1
- package/dist/esm/hooks/cart/use-create-cart.js +20 -1
- package/dist/esm/hooks/cart/use-remove-cart-item.js +18 -1
- package/dist/esm/hooks/cart/use-update-cart-item.js +18 -1
- package/dist/esm/hooks/shop/use-collection-query.js +20 -1
- package/dist/esm/hooks/shop/use-collections-query.js +15 -1
- package/dist/esm/hooks/shop/use-product-query.js +20 -1
- package/dist/esm/hooks/shop/use-products-query.js +59 -1
- package/dist/esm/hooks/shop.js +111 -1
- package/dist/esm/hooks/use-current-device.js +28 -1
- package/dist/esm/hooks/use-lazy-video.js +13 -1
- package/dist/esm/hooks/useAnimations.js +27 -1
- package/dist/esm/hooks/useCartId.js +40 -1
- package/dist/esm/hooks/useCartLine.js +7 -1
- package/dist/esm/hooks/useCartUI.js +44 -1
- package/dist/esm/hooks/useCollection.js +7 -1
- package/dist/esm/hooks/useFetchHandle.js +11 -1
- package/dist/esm/hooks/useFormatMoney.js +71 -1
- package/dist/esm/hooks/useInitialSwatchesOptions.js +124 -1
- package/dist/esm/hooks/useInteraction.js +17 -0
- package/dist/esm/hooks/useIsomorphicLayoutEffect.js +6 -1
- package/dist/esm/hooks/useLoadScript.js +28 -1
- package/dist/esm/hooks/useMoney.js +80 -1
- package/dist/esm/hooks/usePrevious.js +17 -1
- package/dist/esm/hooks/useProduct.js +228 -1
- package/dist/esm/hooks/useProductList.js +16 -1
- package/dist/esm/hooks/useSuspenseFetch.js +23 -1
- package/dist/esm/hooks/useSwatchesOptions.js +37 -1
- package/dist/esm/hooks/useToolbarPostPurchase.js +87 -1
- package/dist/esm/index.js +117 -1
- package/dist/esm/types/animations.js +49 -1
- package/dist/esm/types/custom.js +52 -0
- package/dist/esm/types/global-style.js +12 -1
- package/dist/esm/web-components/src/helpers/styles/constant.js +7 -1
- package/dist/types/index.d.ts +23183 -17335
- package/package.json +5 -3
- package/dist/cjs/components/animation/AnimationWrapper.js +0 -1
- package/dist/cjs/hooks/animation/animations.js +0 -1
- package/dist/cjs/hooks/animation/useLivePageAnimation.js +0 -1
- package/dist/esm/components/animation/AnimationWrapper.js +0 -1
- package/dist/esm/hooks/animation/animations.js +0 -1
- package/dist/esm/hooks/animation/useLivePageAnimation.js +0 -1
|
@@ -1 +1,84 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var react = require('react');
|
|
6
|
+
var shop = require('./shop.js');
|
|
7
|
+
|
|
8
|
+
const useMoney = (amount)=>{
|
|
9
|
+
const { locale } = shop.useLocale();
|
|
10
|
+
const { currency } = shop.useCurrency();
|
|
11
|
+
const options = react.useMemo(()=>({
|
|
12
|
+
style: 'currency',
|
|
13
|
+
currency: currency
|
|
14
|
+
}), [
|
|
15
|
+
currency
|
|
16
|
+
]);
|
|
17
|
+
const defaultFormatter = useLazyFormatter(locale, options);
|
|
18
|
+
const nameFormatter = useLazyFormatter(locale, {
|
|
19
|
+
...options,
|
|
20
|
+
currencyDisplay: 'name'
|
|
21
|
+
});
|
|
22
|
+
const narrowSymbolFormatter = useLazyFormatter(locale, {
|
|
23
|
+
...options,
|
|
24
|
+
currencyDisplay: 'narrowSymbol'
|
|
25
|
+
});
|
|
26
|
+
const withoutTrailingZerosFormatter = useLazyFormatter(locale, {
|
|
27
|
+
...options,
|
|
28
|
+
minimumFractionDigits: 0,
|
|
29
|
+
maximumFractionDigits: 0
|
|
30
|
+
});
|
|
31
|
+
const withoutCurrencyFormatter = useLazyFormatter(locale);
|
|
32
|
+
const withoutTrailingZerosOrCurrencyFormatter = useLazyFormatter(locale, {
|
|
33
|
+
minimumFractionDigits: 0,
|
|
34
|
+
maximumFractionDigits: 0
|
|
35
|
+
});
|
|
36
|
+
const isPartCurrency = (part)=>part.type === 'currency';
|
|
37
|
+
// By wrapping these properties in functions, we only
|
|
38
|
+
// create formatters if they are going to be used.
|
|
39
|
+
const lazyFormatters = react.useMemo(()=>({
|
|
40
|
+
currencyCode: ()=>currency,
|
|
41
|
+
localizedString: ()=>defaultFormatter().format(amount),
|
|
42
|
+
parts: ()=>defaultFormatter().formatToParts(amount),
|
|
43
|
+
withoutTrailingZeros: ()=>amount % 1 === 0 ? withoutTrailingZerosFormatter().format(amount) : defaultFormatter().format(amount),
|
|
44
|
+
withoutTrailingZerosAndCurrency: ()=>amount % 1 === 0 ? withoutTrailingZerosOrCurrencyFormatter().format(amount) : withoutCurrencyFormatter().format(amount),
|
|
45
|
+
currencyName: ()=>nameFormatter().formatToParts(amount).find(isPartCurrency)?.value ?? currency,
|
|
46
|
+
currencySymbol: ()=>defaultFormatter().formatToParts(amount).find(isPartCurrency)?.value ?? currency,
|
|
47
|
+
currencyNarrowSymbol: ()=>narrowSymbolFormatter().formatToParts(amount).find(isPartCurrency)?.value ?? '',
|
|
48
|
+
amount: ()=>defaultFormatter().formatToParts(amount).filter((part)=>[
|
|
49
|
+
'decimal',
|
|
50
|
+
'fraction',
|
|
51
|
+
'group',
|
|
52
|
+
'integer',
|
|
53
|
+
'literal'
|
|
54
|
+
].includes(part.type)).map((part)=>part.value).join('')
|
|
55
|
+
}), [
|
|
56
|
+
currency,
|
|
57
|
+
amount,
|
|
58
|
+
nameFormatter,
|
|
59
|
+
defaultFormatter,
|
|
60
|
+
narrowSymbolFormatter,
|
|
61
|
+
withoutCurrencyFormatter,
|
|
62
|
+
withoutTrailingZerosFormatter,
|
|
63
|
+
withoutTrailingZerosOrCurrencyFormatter
|
|
64
|
+
]);
|
|
65
|
+
// Call functions automatically when the properties are accessed
|
|
66
|
+
// to keep these functions as an implementation detail.
|
|
67
|
+
return react.useMemo(()=>new Proxy(lazyFormatters, {
|
|
68
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
|
69
|
+
get: (target, key)=>Reflect.get(target, key)?.call(null)
|
|
70
|
+
}), [
|
|
71
|
+
lazyFormatters
|
|
72
|
+
]);
|
|
73
|
+
};
|
|
74
|
+
function useLazyFormatter(locale, options) {
|
|
75
|
+
return react.useMemo(()=>{
|
|
76
|
+
let memoized;
|
|
77
|
+
return ()=>memoized ??= new Intl.NumberFormat(locale, options);
|
|
78
|
+
}, [
|
|
79
|
+
locale,
|
|
80
|
+
options
|
|
81
|
+
]);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
exports.default = useMoney;
|
|
@@ -1 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('react');
|
|
4
|
+
|
|
5
|
+
const usePrevious = (value)=>{
|
|
6
|
+
// The ref object is a generic container whose current property is mutable ...
|
|
7
|
+
// ... and can hold any value, similar to an instance property on a class
|
|
8
|
+
const ref = react.useRef();
|
|
9
|
+
// Store current value in ref
|
|
10
|
+
react.useEffect(()=>{
|
|
11
|
+
ref.current = value;
|
|
12
|
+
}, [
|
|
13
|
+
value
|
|
14
|
+
]); // Only re-run if value changes
|
|
15
|
+
// Return previous value (happens before update in useEffect above)
|
|
16
|
+
return ref.current;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
exports.usePrevious = usePrevious;
|
|
@@ -1 +1,245 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('react');
|
|
4
|
+
var ProductContext = require('../contexts/ProductContext.js');
|
|
5
|
+
require('react/jsx-runtime');
|
|
6
|
+
require('zustand');
|
|
7
|
+
var PageContext = require('../contexts/PageContext.js');
|
|
8
|
+
require('swr');
|
|
9
|
+
require('@gem-sdk/adapter-shopify');
|
|
10
|
+
require('swr/mutation');
|
|
11
|
+
require('swr/infinite');
|
|
12
|
+
require('vanilla-lazyload');
|
|
13
|
+
require('./useCartUI.js');
|
|
14
|
+
var variant = require('../helpers/variant.js');
|
|
15
|
+
require('react-transition-group');
|
|
16
|
+
require('@gem-sdk/core');
|
|
17
|
+
require('classnames');
|
|
18
|
+
require('dayjs');
|
|
19
|
+
var flattenConnection = require('../helpers/flatten-connection.js');
|
|
20
|
+
require('../helpers/convert.js');
|
|
21
|
+
var product = require('../helpers/product.js');
|
|
22
|
+
|
|
23
|
+
const useUniqProductID = ()=>{
|
|
24
|
+
return ProductContext.useProductStore((s)=>s.uiqueId);
|
|
25
|
+
};
|
|
26
|
+
const useProduct = ()=>{
|
|
27
|
+
return ProductContext.useProductStore((s)=>s.product);
|
|
28
|
+
};
|
|
29
|
+
const useFeaturedImageGlobal = ()=>{
|
|
30
|
+
return ProductContext.useProductStore((s)=>s.featuredImageGlobal);
|
|
31
|
+
};
|
|
32
|
+
const useProductProperties = ()=>{
|
|
33
|
+
return ProductContext.useProductStore((s)=>s.properties);
|
|
34
|
+
};
|
|
35
|
+
const useIsSyncProduct = ()=>{
|
|
36
|
+
return ProductContext.useProductStore((s)=>s.isSyncProduct);
|
|
37
|
+
};
|
|
38
|
+
const useProductBundleDiscount = ()=>{
|
|
39
|
+
const useProductCompareAtPrice = ProductContext.useProductStore((s)=>s.useProductCompareAtPrice);
|
|
40
|
+
const seUseProductCompareAtPrice = ProductContext.useProductStore((s)=>s.setUseProductCompareAtPrice);
|
|
41
|
+
return {
|
|
42
|
+
useProductCompareAtPrice,
|
|
43
|
+
seUseProductCompareAtPrice
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
const useQuantity = ()=>{
|
|
47
|
+
const quantity = ProductContext.useProductStore((s)=>s.quantity);
|
|
48
|
+
const hasUpdatePrice = ProductContext.useProductStore((s)=>s.updatePrice);
|
|
49
|
+
const decrement = ProductContext.useProductStore((s)=>s.decrementQuantity);
|
|
50
|
+
const increment = ProductContext.useProductStore((s)=>s.incrementQuantity);
|
|
51
|
+
const updateQuantity = ProductContext.useProductStore((s)=>s.setQuantity);
|
|
52
|
+
const updatePrice = ProductContext.useProductStore((s)=>s.setHasUpdatePriceFollowQuantity);
|
|
53
|
+
const isSyncProduct = ProductContext.useProductStore((s)=>s.isSyncProduct);
|
|
54
|
+
const product = ProductContext.useProductStore((s)=>s.product);
|
|
55
|
+
const productId = product?.id;
|
|
56
|
+
const reset = react.useCallback(()=>{
|
|
57
|
+
updateQuantity(1);
|
|
58
|
+
}, [
|
|
59
|
+
updateQuantity
|
|
60
|
+
]);
|
|
61
|
+
react.useEffect(()=>{
|
|
62
|
+
if (isSyncProduct) {
|
|
63
|
+
const setOption = new CustomEvent('set-product-quantity', {
|
|
64
|
+
bubbles: true,
|
|
65
|
+
cancelable: true,
|
|
66
|
+
composed: true,
|
|
67
|
+
detail: {
|
|
68
|
+
quantity,
|
|
69
|
+
productId
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
window.dispatchEvent(setOption);
|
|
73
|
+
}
|
|
74
|
+
}, [
|
|
75
|
+
quantity,
|
|
76
|
+
isSyncProduct,
|
|
77
|
+
productId
|
|
78
|
+
]);
|
|
79
|
+
return react.useMemo(()=>({
|
|
80
|
+
quantity,
|
|
81
|
+
hasUpdatePrice,
|
|
82
|
+
increment,
|
|
83
|
+
decrement,
|
|
84
|
+
reset,
|
|
85
|
+
setQuantity: updateQuantity,
|
|
86
|
+
setUpdatePrice: updatePrice
|
|
87
|
+
}), [
|
|
88
|
+
decrement,
|
|
89
|
+
increment,
|
|
90
|
+
quantity,
|
|
91
|
+
reset,
|
|
92
|
+
updateQuantity,
|
|
93
|
+
updatePrice,
|
|
94
|
+
hasUpdatePrice
|
|
95
|
+
]);
|
|
96
|
+
};
|
|
97
|
+
const useHasPreSelected = ()=>{
|
|
98
|
+
const hasPreSelected = ProductContext.useProductStore((s)=>s.hasPreSelected);
|
|
99
|
+
const setHasPreSelected = ProductContext.useProductStore((s)=>s.setHasPreSelected);
|
|
100
|
+
return react.useMemo(()=>({
|
|
101
|
+
hasPreSelected,
|
|
102
|
+
setHasPreSelected
|
|
103
|
+
}), [
|
|
104
|
+
hasPreSelected,
|
|
105
|
+
setHasPreSelected
|
|
106
|
+
]);
|
|
107
|
+
};
|
|
108
|
+
const useSelectedOption = ()=>{
|
|
109
|
+
const setSelectedOption = ProductContext.useProductStore((s)=>s.setSelectedOption);
|
|
110
|
+
const selectedOptions = ProductContext.useProductStore((s)=>s.selectedOptions);
|
|
111
|
+
const forceSelectedOption = ProductContext.useProductStore((s)=>s.forceSelectedOption);
|
|
112
|
+
const isSyncProduct = ProductContext.useProductStore((s)=>s.isSyncProduct);
|
|
113
|
+
const updateOption = react.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
|
+
}, [
|
|
129
|
+
setSelectedOption,
|
|
130
|
+
isSyncProduct
|
|
131
|
+
]);
|
|
132
|
+
const forceOption = react.useCallback((selectedOption, productId, noEmit)=>{
|
|
133
|
+
if (!noEmit && isSyncProduct) {
|
|
134
|
+
const forceOption = new CustomEvent('force-selected-option', {
|
|
135
|
+
bubbles: true,
|
|
136
|
+
cancelable: true,
|
|
137
|
+
composed: true,
|
|
138
|
+
detail: {
|
|
139
|
+
selectedOption,
|
|
140
|
+
productId
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
window.dispatchEvent(forceOption);
|
|
144
|
+
}
|
|
145
|
+
forceSelectedOption(selectedOption);
|
|
146
|
+
}, [
|
|
147
|
+
forceSelectedOption,
|
|
148
|
+
isSyncProduct
|
|
149
|
+
]);
|
|
150
|
+
return react.useMemo(()=>({
|
|
151
|
+
selectedOptions,
|
|
152
|
+
setSelectedOption: updateOption,
|
|
153
|
+
forceSelectedOption: forceOption
|
|
154
|
+
}), [
|
|
155
|
+
selectedOptions,
|
|
156
|
+
updateOption,
|
|
157
|
+
forceOption
|
|
158
|
+
]);
|
|
159
|
+
};
|
|
160
|
+
const useVariants = ()=>{
|
|
161
|
+
const variants = ProductContext.useProductStore((s)=>s.product?.variants);
|
|
162
|
+
return flattenConnection.flattenConnection(variants);
|
|
163
|
+
};
|
|
164
|
+
const useVariant = (id)=>{
|
|
165
|
+
const variants = useVariants();
|
|
166
|
+
return react.useMemo(()=>variants?.find((v)=>v?.id === id), [
|
|
167
|
+
id,
|
|
168
|
+
variants
|
|
169
|
+
]);
|
|
170
|
+
};
|
|
171
|
+
const useCurrentVariant = ()=>{
|
|
172
|
+
const { selectedOptions } = useSelectedOption();
|
|
173
|
+
const variants = useVariants();
|
|
174
|
+
return react.useMemo(()=>product.getSelectedVariant(variants, selectedOptions), [
|
|
175
|
+
selectedOptions,
|
|
176
|
+
variants
|
|
177
|
+
]);
|
|
178
|
+
};
|
|
179
|
+
const useCurrentVariantInStock = ()=>{
|
|
180
|
+
const currentVariant = useCurrentVariant();
|
|
181
|
+
const currentProduct = useProduct();
|
|
182
|
+
return variant.checkInStock(currentVariant, currentProduct);
|
|
183
|
+
};
|
|
184
|
+
const useVariantOutStock = (optionId, optionValue, options)=>{
|
|
185
|
+
const { selectedOptions } = useSelectedOption();
|
|
186
|
+
const variants = useVariants();
|
|
187
|
+
const lastPos = options.optionNumber - 1;
|
|
188
|
+
if (options.position < lastPos) {
|
|
189
|
+
return variants.some((variant$1)=>{
|
|
190
|
+
if (variant$1) {
|
|
191
|
+
const { selectedOptions } = variant$1;
|
|
192
|
+
const opt = selectedOptions?.some((option)=>option?.name === optionId && option.value === optionValue);
|
|
193
|
+
const isInStock = variant.checkInStock(variant$1);
|
|
194
|
+
return opt && isInStock;
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
const matchedVariant = product.getSelectedVariant(variants, {
|
|
199
|
+
...selectedOptions,
|
|
200
|
+
[optionId]: optionValue
|
|
201
|
+
});
|
|
202
|
+
return variant.checkInStock(matchedVariant);
|
|
203
|
+
};
|
|
204
|
+
const useCheckAvailableVariantInStock = (optionId, optionValue)=>{
|
|
205
|
+
const variants = useVariants();
|
|
206
|
+
return variants ? variants.some((item)=>{
|
|
207
|
+
if (item) {
|
|
208
|
+
const { selectedOptions } = item;
|
|
209
|
+
const opt = selectedOptions?.some((option)=>option?.name === optionId && option.value === optionValue);
|
|
210
|
+
const isInStock = variant.checkInStock(item);
|
|
211
|
+
return opt && isInStock;
|
|
212
|
+
}
|
|
213
|
+
return false;
|
|
214
|
+
}) : false;
|
|
215
|
+
};
|
|
216
|
+
const useProductOfferDiscount = ()=>{
|
|
217
|
+
const productOffers = PageContext.usePageStore((s)=>s.productOffers);
|
|
218
|
+
const currentProduct = useProduct();
|
|
219
|
+
const currentVariant = useCurrentVariant();
|
|
220
|
+
const currentOffer = productOffers?.find((item)=>item?.node?.objectBaseID === currentProduct?.baseID)?.node;
|
|
221
|
+
if (!currentOffer || !currentOffer.isEnabled) return 0;
|
|
222
|
+
let currentDiscount = currentOffer?.value;
|
|
223
|
+
if (currentOffer && currentOffer.valueType === 'PERCENTAGE' && currentDiscount) {
|
|
224
|
+
const price = currentVariant?.price || 0;
|
|
225
|
+
currentDiscount = currentDiscount * price / 100;
|
|
226
|
+
}
|
|
227
|
+
return currentDiscount || 0;
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
exports.useCheckAvailableVariantInStock = useCheckAvailableVariantInStock;
|
|
231
|
+
exports.useCurrentVariant = useCurrentVariant;
|
|
232
|
+
exports.useCurrentVariantInStock = useCurrentVariantInStock;
|
|
233
|
+
exports.useFeaturedImageGlobal = useFeaturedImageGlobal;
|
|
234
|
+
exports.useHasPreSelected = useHasPreSelected;
|
|
235
|
+
exports.useIsSyncProduct = useIsSyncProduct;
|
|
236
|
+
exports.useProduct = useProduct;
|
|
237
|
+
exports.useProductBundleDiscount = useProductBundleDiscount;
|
|
238
|
+
exports.useProductOfferDiscount = useProductOfferDiscount;
|
|
239
|
+
exports.useProductProperties = useProductProperties;
|
|
240
|
+
exports.useQuantity = useQuantity;
|
|
241
|
+
exports.useSelectedOption = useSelectedOption;
|
|
242
|
+
exports.useUniqProductID = useUniqProductID;
|
|
243
|
+
exports.useVariant = useVariant;
|
|
244
|
+
exports.useVariantOutStock = useVariantOutStock;
|
|
245
|
+
exports.useVariants = useVariants;
|
|
@@ -1 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ProductListContext = require('../contexts/ProductListContext.js');
|
|
4
|
+
|
|
5
|
+
const useProductList = ()=>{
|
|
6
|
+
return ProductListContext.useProductListStore((s)=>s.collection);
|
|
7
|
+
};
|
|
8
|
+
const useProductListProducts = ()=>{
|
|
9
|
+
return ProductListContext.useProductListStore((s)=>s.products);
|
|
10
|
+
};
|
|
11
|
+
const useProductListSettings = ()=>{
|
|
12
|
+
return ProductListContext.useProductListStore((s)=>s.settings);
|
|
13
|
+
};
|
|
14
|
+
const useProductListStyles = ()=>{
|
|
15
|
+
return ProductListContext.useProductListStore((s)=>s.styles);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
exports.useProductList = useProductList;
|
|
19
|
+
exports.useProductListProducts = useProductListProducts;
|
|
20
|
+
exports.useProductListSettings = useProductListSettings;
|
|
21
|
+
exports.useProductListStyles = useProductListStyles;
|
|
@@ -1 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const cache = new Map();
|
|
6
|
+
const useSuspenseFetch = (key, promise)=>{
|
|
7
|
+
const value = cache.get(key) || {
|
|
8
|
+
status: 'new',
|
|
9
|
+
data: null
|
|
10
|
+
};
|
|
11
|
+
if (value.status === 'resolved') {
|
|
12
|
+
return {
|
|
13
|
+
data: value.data
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
promise().then((data)=>{
|
|
17
|
+
value.status = 'resolved';
|
|
18
|
+
value.data = data;
|
|
19
|
+
cache.set(key, value);
|
|
20
|
+
}).catch(()=>{
|
|
21
|
+
value.status = 'error';
|
|
22
|
+
value.data = null;
|
|
23
|
+
});
|
|
24
|
+
throw promise();
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
exports.default = useSuspenseFetch;
|
|
@@ -1 +1,41 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var shop = require('./shop.js');
|
|
6
|
+
|
|
7
|
+
const initialSwatchOptionValue = {
|
|
8
|
+
label: '',
|
|
9
|
+
colors: [],
|
|
10
|
+
imageUrl: ''
|
|
11
|
+
};
|
|
12
|
+
const initialGlobalSwatchesData = {
|
|
13
|
+
optionTitle: '',
|
|
14
|
+
optionType: '',
|
|
15
|
+
optionValues: []
|
|
16
|
+
};
|
|
17
|
+
const useSwatchesOptions = (options)=>{
|
|
18
|
+
const { swatches } = shop.useSwatches();
|
|
19
|
+
if (!options) return [];
|
|
20
|
+
return options?.map((option)=>{
|
|
21
|
+
const swatchOption = swatches?.find((sw)=>sw?.optionTitle === option?.name) || {
|
|
22
|
+
...initialGlobalSwatchesData
|
|
23
|
+
};
|
|
24
|
+
return {
|
|
25
|
+
...option,
|
|
26
|
+
optionType: swatchOption ? swatchOption.optionType : '',
|
|
27
|
+
values: option.values?.map((val)=>{
|
|
28
|
+
const swatchValue = swatchOption && swatchOption?.optionValues?.find((swatOp)=>swatOp?.label === val?.label) || {
|
|
29
|
+
...initialSwatchOptionValue
|
|
30
|
+
};
|
|
31
|
+
return {
|
|
32
|
+
...val,
|
|
33
|
+
colors: swatchValue?.colors || [],
|
|
34
|
+
imageUrl: swatchValue?.imageUrl || ''
|
|
35
|
+
};
|
|
36
|
+
})
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
exports.default = useSwatchesOptions;
|
|
@@ -1 +1,89 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var constant = require('../components/constant.js');
|
|
4
|
+
var ShopContext = require('../contexts/ShopContext.js');
|
|
5
|
+
|
|
6
|
+
const usePostPurchase = (uid, tag)=>{
|
|
7
|
+
const editingPageType = ShopContext.useShopStore((s)=>s.pageType);
|
|
8
|
+
const getElementCountInPage = (tagParam, root)=>{
|
|
9
|
+
const tagUsed = tagParam || tag;
|
|
10
|
+
let count = 0;
|
|
11
|
+
const elements = (root || document).querySelectorAll(`[data-component-tag="${tagUsed}"]`);
|
|
12
|
+
if (tagUsed === 'PostPurchaseProductOffer') {
|
|
13
|
+
return elements.length;
|
|
14
|
+
}
|
|
15
|
+
let isCountedWrapper = '';
|
|
16
|
+
elements.forEach((element)=>{
|
|
17
|
+
const isWrappedByProductOffer = element.closest('[data-component-tag="PostPurchaseProductOffer"]');
|
|
18
|
+
const productId = isWrappedByProductOffer?.getAttribute('data-uid') || '';
|
|
19
|
+
const productWrapper = element.closest('[data-component-tag="Product"]');
|
|
20
|
+
const elementCounted = productWrapper?.querySelectorAll(`[data-component-tag="${tagUsed}"]`).length || 0;
|
|
21
|
+
const offset = isWrappedByProductOffer ? productId !== isCountedWrapper ? elementCounted : 0 : 1;
|
|
22
|
+
if (isWrappedByProductOffer) {
|
|
23
|
+
isCountedWrapper = productId;
|
|
24
|
+
}
|
|
25
|
+
count += offset;
|
|
26
|
+
});
|
|
27
|
+
return count;
|
|
28
|
+
};
|
|
29
|
+
const verifyRequireElement = ()=>{
|
|
30
|
+
const count = getElementCountInPage();
|
|
31
|
+
return count <= 1;
|
|
32
|
+
};
|
|
33
|
+
const verifyWrapContainsRequireElement = ()=>{
|
|
34
|
+
const $component = document.body.querySelector('#storefront')?.querySelector(`[data-uid="${uid}"]`);
|
|
35
|
+
if (!$component) return false;
|
|
36
|
+
for (const requiredElementTag of constant.postPurchaseRequiredElements){
|
|
37
|
+
const countElementInsidePage = getElementCountInPage(requiredElementTag);
|
|
38
|
+
const countElementInsideWrap = getElementCountInPage(requiredElementTag, $component);
|
|
39
|
+
if (countElementInsideWrap > 0 && countElementInsidePage - countElementInsideWrap < 1) {
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return false;
|
|
44
|
+
};
|
|
45
|
+
const countRequiredElement = ()=>{
|
|
46
|
+
return constant.postPurchaseRequiredElements.reduce((acc, requiredElementTag)=>{
|
|
47
|
+
const $component = document.body.querySelector('#storefront')?.querySelector(`[data-uid="${uid}"]`);
|
|
48
|
+
if (!$component) return 0;
|
|
49
|
+
const count = $component.querySelectorAll(`[data-component-tag="${requiredElementTag}"]`).length;
|
|
50
|
+
return acc + count;
|
|
51
|
+
}, 0);
|
|
52
|
+
};
|
|
53
|
+
const checkDisableDelete = ()=>{
|
|
54
|
+
if (editingPageType !== 'POST_PURCHASE') return false;
|
|
55
|
+
let isUnable = false;
|
|
56
|
+
if (constant.postPurchaseRequiredElements.includes(tag)) {
|
|
57
|
+
isUnable = verifyRequireElement();
|
|
58
|
+
if (isUnable) return isUnable;
|
|
59
|
+
}
|
|
60
|
+
if (constant.postPurchaseWrapElements.includes(tag) && countRequiredElement() > 0) {
|
|
61
|
+
return verifyWrapContainsRequireElement();
|
|
62
|
+
}
|
|
63
|
+
return false;
|
|
64
|
+
};
|
|
65
|
+
const checkDisableDuplicate = ()=>{
|
|
66
|
+
return editingPageType === 'GP_FUNNEL_PAGE' && tag === 'ProductList';
|
|
67
|
+
};
|
|
68
|
+
const getTooltipText = ()=>{
|
|
69
|
+
if (constant.postPurchaseRequiredElements.includes(tag)) {
|
|
70
|
+
return {
|
|
71
|
+
text: 'This element is required <br> and can’t be deleted',
|
|
72
|
+
width: '175px'
|
|
73
|
+
};
|
|
74
|
+
} else {
|
|
75
|
+
const elmName = tag === 'Section' ? 'section' : 'element';
|
|
76
|
+
return {
|
|
77
|
+
text: `This ${elmName} contains required <br> elements and cannot be deleted`,
|
|
78
|
+
width: '206px'
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
return {
|
|
83
|
+
checkDisableDelete,
|
|
84
|
+
getTooltipText,
|
|
85
|
+
checkDisableDuplicate
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
exports.usePostPurchase = usePostPurchase;
|