@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,26 @@
|
|
|
1
|
-
import{jsx
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useStore, createStore } from 'zustand';
|
|
3
|
+
import { useContext, createContext } from 'react';
|
|
4
|
+
|
|
5
|
+
const CartLineContext = /*#__PURE__*/ createContext(null);
|
|
6
|
+
const createCartLineStore = (data)=>createStore(()=>({
|
|
7
|
+
...data
|
|
8
|
+
}));
|
|
9
|
+
const CartLineProvider = ({ children, line })=>{
|
|
10
|
+
return /*#__PURE__*/ jsx(CartLineContext.Provider, {
|
|
11
|
+
value: createCartLineStore({
|
|
12
|
+
line
|
|
13
|
+
}),
|
|
14
|
+
children: children
|
|
15
|
+
}, `${line.id}-${line.quantity}`);
|
|
16
|
+
};
|
|
17
|
+
// export const useCartLineStore = useStore;
|
|
18
|
+
const useCartLineStore = (selector, equalityFn)=>{
|
|
19
|
+
const store = useContext(CartLineContext);
|
|
20
|
+
if (!store) {
|
|
21
|
+
throw new Error('useCartLineStore must be used within a CartLineProvider');
|
|
22
|
+
}
|
|
23
|
+
return useStore(store, selector, equalityFn);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export { CartLineProvider, useCartLineStore };
|
|
@@ -1 +1,35 @@
|
|
|
1
|
-
import{jsx
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useMemo, useContext, createContext } from 'react';
|
|
3
|
+
import { useStore, createStore } from 'zustand';
|
|
4
|
+
|
|
5
|
+
const CollectionContext = /*#__PURE__*/ createContext(null);
|
|
6
|
+
const createCollectionProvider = (data)=>createStore((set)=>({
|
|
7
|
+
...data,
|
|
8
|
+
changeCollectionStore: ({ collection })=>{
|
|
9
|
+
set({
|
|
10
|
+
collection: collection
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
}));
|
|
14
|
+
const CollectionProvider = ({ collection, children })=>{
|
|
15
|
+
const store = useMemo(()=>{
|
|
16
|
+
return createCollectionProvider({
|
|
17
|
+
collection
|
|
18
|
+
});
|
|
19
|
+
}, [
|
|
20
|
+
collection
|
|
21
|
+
]);
|
|
22
|
+
return /*#__PURE__*/ jsx(CollectionContext.Provider, {
|
|
23
|
+
value: store,
|
|
24
|
+
children: children
|
|
25
|
+
}, collection?.id);
|
|
26
|
+
};
|
|
27
|
+
const useCollectionStore = (selector, equalityFn)=>{
|
|
28
|
+
const store = useContext(CollectionContext);
|
|
29
|
+
if (!store) {
|
|
30
|
+
throw new Error('useCollectionStore must be used within a useCollectionStore');
|
|
31
|
+
}
|
|
32
|
+
return useStore(store, selector, equalityFn);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export { CollectionProvider, useCollectionStore };
|
|
@@ -1 +1,44 @@
|
|
|
1
|
-
import{jsx
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useContext, createContext } from 'react';
|
|
3
|
+
import { useStore, createStore } from 'zustand';
|
|
4
|
+
|
|
5
|
+
const ModalContext = /*#__PURE__*/ createContext(null);
|
|
6
|
+
const createModalProvider = (data)=>createStore((set)=>({
|
|
7
|
+
activeId: data,
|
|
8
|
+
setModalActive: (id, postMessage)=>{
|
|
9
|
+
postMessage && window?.parent?.postMessage?.(JSON.stringify({
|
|
10
|
+
type: 'active-element',
|
|
11
|
+
uid: id
|
|
12
|
+
}), '*');
|
|
13
|
+
set({
|
|
14
|
+
activeId: id
|
|
15
|
+
});
|
|
16
|
+
},
|
|
17
|
+
clearModal: ()=>{
|
|
18
|
+
window?.parent?.postMessage?.(JSON.stringify({
|
|
19
|
+
type: 'active-element',
|
|
20
|
+
uid: null
|
|
21
|
+
}), '*');
|
|
22
|
+
set({
|
|
23
|
+
activeId: undefined
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}));
|
|
27
|
+
const ModalProvider = ({ children, activeId, ...passProps })=>{
|
|
28
|
+
const store = createModalProvider(activeId);
|
|
29
|
+
return /*#__PURE__*/ jsx(ModalContext.Provider, {
|
|
30
|
+
...passProps,
|
|
31
|
+
value: store,
|
|
32
|
+
children: children
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
// export const useBuilderStore = useStore;
|
|
36
|
+
const useModalStore = (selector, equalityFn)=>{
|
|
37
|
+
const store = useContext(ModalContext);
|
|
38
|
+
if (!store) {
|
|
39
|
+
throw new Error('useModalStore must be used within a ModalProvider');
|
|
40
|
+
}
|
|
41
|
+
return useStore(store, selector, equalityFn);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export { ModalProvider, useModalStore };
|
|
@@ -1 +1,101 @@
|
|
|
1
|
-
import{jsx
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useMemo, useContext, createContext } from 'react';
|
|
3
|
+
import { useStore, createStore } from 'zustand';
|
|
4
|
+
|
|
5
|
+
const PageContext = /*#__PURE__*/ createContext(null);
|
|
6
|
+
const createPageStoreProvider = (data)=>createStore((set)=>({
|
|
7
|
+
...data,
|
|
8
|
+
setDynamicProduct: (data)=>{
|
|
9
|
+
set({
|
|
10
|
+
dynamicProduct: data
|
|
11
|
+
});
|
|
12
|
+
},
|
|
13
|
+
setDynamicCollection: (data)=>{
|
|
14
|
+
set({
|
|
15
|
+
dynamicCollection: data
|
|
16
|
+
});
|
|
17
|
+
},
|
|
18
|
+
setPostPurchaseProductOffers: (productOffers)=>{
|
|
19
|
+
set({
|
|
20
|
+
productOffers: productOffers
|
|
21
|
+
});
|
|
22
|
+
},
|
|
23
|
+
setSalePageProductId: (id)=>{
|
|
24
|
+
set({
|
|
25
|
+
salePageProductId: id
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
setPublicStoreFrontData: (publicStoreFrontData)=>{
|
|
29
|
+
set({
|
|
30
|
+
publicStoreFrontData: publicStoreFrontData
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
setInteractionIsSelectOnPage: (value)=>{
|
|
34
|
+
set((state)=>({
|
|
35
|
+
interactionData: {
|
|
36
|
+
...state.interactionData,
|
|
37
|
+
isSelectOnPage: value
|
|
38
|
+
}
|
|
39
|
+
}));
|
|
40
|
+
},
|
|
41
|
+
setInteractionItem: (item)=>{
|
|
42
|
+
set((state)=>({
|
|
43
|
+
interactionData: {
|
|
44
|
+
...state.interactionData,
|
|
45
|
+
item,
|
|
46
|
+
isSelectOnPage: state.interactionData?.isSelectOnPage || false
|
|
47
|
+
}
|
|
48
|
+
}));
|
|
49
|
+
},
|
|
50
|
+
setInteractionSelectType: (selectType)=>{
|
|
51
|
+
set((state)=>({
|
|
52
|
+
interactionData: {
|
|
53
|
+
...state.interactionData,
|
|
54
|
+
selectType
|
|
55
|
+
}
|
|
56
|
+
}));
|
|
57
|
+
},
|
|
58
|
+
setInteractionSettingType: (settingType)=>{
|
|
59
|
+
set((state)=>({
|
|
60
|
+
interactionData: {
|
|
61
|
+
...state.interactionData,
|
|
62
|
+
settingType
|
|
63
|
+
}
|
|
64
|
+
}));
|
|
65
|
+
},
|
|
66
|
+
setSidebarMode: (mode)=>{
|
|
67
|
+
set(()=>({
|
|
68
|
+
sidebarMode: mode
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
}));
|
|
72
|
+
const PageProvider = ({ children, dynamicProduct, dynamicCollection, productOffers, publicStoreFrontData, ...passProps })=>{
|
|
73
|
+
const store = useMemo(()=>createPageStoreProvider({
|
|
74
|
+
dynamicProduct,
|
|
75
|
+
dynamicCollection,
|
|
76
|
+
productOffers,
|
|
77
|
+
publicStoreFrontData,
|
|
78
|
+
interactionData: {
|
|
79
|
+
selectType: 'ELEMENT'
|
|
80
|
+
}
|
|
81
|
+
}), [
|
|
82
|
+
dynamicProduct,
|
|
83
|
+
dynamicCollection,
|
|
84
|
+
productOffers,
|
|
85
|
+
publicStoreFrontData
|
|
86
|
+
]);
|
|
87
|
+
return /*#__PURE__*/ jsx(PageContext.Provider, {
|
|
88
|
+
...passProps,
|
|
89
|
+
value: store,
|
|
90
|
+
children: children
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
const usePageStore = (selector, equalityFn)=>{
|
|
94
|
+
const store = useContext(PageContext);
|
|
95
|
+
if (!store) {
|
|
96
|
+
throw new Error('usePageStore must be used within a PageProvider');
|
|
97
|
+
}
|
|
98
|
+
return useStore(store, selector, equalityFn);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export { PageProvider, usePageStore };
|
|
@@ -1 +1,174 @@
|
|
|
1
|
-
import{jsx
|
|
1
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { useId, useMemo, useContext, createContext } from 'react';
|
|
3
|
+
import { useStore, createStore } from 'zustand';
|
|
4
|
+
import 'swr';
|
|
5
|
+
import '@gem-sdk/adapter-shopify';
|
|
6
|
+
import 'swr/mutation';
|
|
7
|
+
import 'swr/infinite';
|
|
8
|
+
import 'vanilla-lazyload';
|
|
9
|
+
import '../hooks/useCartUI.js';
|
|
10
|
+
import { checkInStock } from '../helpers/variant.js';
|
|
11
|
+
import 'react-transition-group';
|
|
12
|
+
import '@gem-sdk/core';
|
|
13
|
+
import 'classnames';
|
|
14
|
+
import 'dayjs';
|
|
15
|
+
import { flattenConnection } from '../helpers/flatten-connection.js';
|
|
16
|
+
import '../helpers/convert.js';
|
|
17
|
+
|
|
18
|
+
// const { Provider, useStore } = createContext<StoreApi<ProductContextProps>>();
|
|
19
|
+
const ProductContext = /*#__PURE__*/ createContext(null);
|
|
20
|
+
const createProductStoreProvider = (data)=>createStore((set, get)=>({
|
|
21
|
+
...data,
|
|
22
|
+
updateProperty: (name, data)=>{
|
|
23
|
+
set((state)=>{
|
|
24
|
+
return {
|
|
25
|
+
properties: state.properties?.map((v)=>{
|
|
26
|
+
if (v.key === name) {
|
|
27
|
+
return {
|
|
28
|
+
...v,
|
|
29
|
+
...data
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return v;
|
|
33
|
+
})
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
setUseProductCompareAtPrice: (value)=>{
|
|
38
|
+
set({
|
|
39
|
+
useProductCompareAtPrice: value
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
addProperty: (data)=>{
|
|
43
|
+
const properties = get().properties;
|
|
44
|
+
if (!properties?.some((v)=>v.key === data.key)) {
|
|
45
|
+
set((state)=>({
|
|
46
|
+
properties: [
|
|
47
|
+
...state.properties ?? [],
|
|
48
|
+
data
|
|
49
|
+
]
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
removeProperty: (name)=>{
|
|
54
|
+
set((state)=>({
|
|
55
|
+
properties: state.properties?.filter((v)=>v.key !== name)
|
|
56
|
+
}));
|
|
57
|
+
},
|
|
58
|
+
setQuantity: (num)=>{
|
|
59
|
+
set({
|
|
60
|
+
quantity: num > 0 ? num : 1
|
|
61
|
+
});
|
|
62
|
+
},
|
|
63
|
+
setProductFeaturedImage: (image)=>{
|
|
64
|
+
set({
|
|
65
|
+
featuredImageGlobal: image
|
|
66
|
+
});
|
|
67
|
+
},
|
|
68
|
+
incrementQuantity: ()=>{
|
|
69
|
+
set((state)=>{
|
|
70
|
+
const quantity = state.quantity ?? 1;
|
|
71
|
+
return {
|
|
72
|
+
quantity: quantity + 1
|
|
73
|
+
};
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
decrementQuantity: ()=>{
|
|
77
|
+
set((state)=>{
|
|
78
|
+
const quantity = state.quantity ?? 1;
|
|
79
|
+
return {
|
|
80
|
+
quantity: quantity > 2 ? quantity - 1 : 1
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
},
|
|
84
|
+
setSelectedOption: (optionId, optionValue)=>{
|
|
85
|
+
set((state)=>{
|
|
86
|
+
if (optionId && optionValue) {
|
|
87
|
+
return {
|
|
88
|
+
selectedOptions: {
|
|
89
|
+
...state?.selectedOptions,
|
|
90
|
+
[optionId]: optionValue
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
return state;
|
|
95
|
+
});
|
|
96
|
+
},
|
|
97
|
+
forceSelectedOption: (value)=>{
|
|
98
|
+
set((state)=>{
|
|
99
|
+
return {
|
|
100
|
+
selectedOptions: {
|
|
101
|
+
...state?.selectedOptions,
|
|
102
|
+
...value
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
});
|
|
106
|
+
},
|
|
107
|
+
updateIsSubmit: (value)=>{
|
|
108
|
+
set({
|
|
109
|
+
isSubmit: value
|
|
110
|
+
});
|
|
111
|
+
},
|
|
112
|
+
setHasUpdatePriceFollowQuantity: (updatePrice)=>{
|
|
113
|
+
set({
|
|
114
|
+
updatePrice
|
|
115
|
+
});
|
|
116
|
+
},
|
|
117
|
+
setHasPreSelected: (value)=>{
|
|
118
|
+
set({
|
|
119
|
+
hasPreSelected: value
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}));
|
|
123
|
+
const ProductProvider = ({ children, product, initialVariantId, quantity = 1, isSyncProduct })=>{
|
|
124
|
+
const uiqueId = useId();
|
|
125
|
+
const store = useMemo(()=>{
|
|
126
|
+
let selectedOptions = {};
|
|
127
|
+
let featuredImageGlobal = undefined;
|
|
128
|
+
if (product) {
|
|
129
|
+
const variants = flattenConnection(product.variants);
|
|
130
|
+
const firstVariant = variants[0];
|
|
131
|
+
const firstVariantInStock = variants.find((item)=>checkInStock(item));
|
|
132
|
+
const initialVariant = variants.find((v)=>v?.id === initialVariantId) ?? firstVariantInStock ?? firstVariant;
|
|
133
|
+
selectedOptions = initialVariant?.selectedOptions.reduce((acc, option)=>{
|
|
134
|
+
if (option.name) {
|
|
135
|
+
return {
|
|
136
|
+
...acc,
|
|
137
|
+
[option.name]: option.value
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
return acc;
|
|
141
|
+
}, {});
|
|
142
|
+
featuredImageGlobal = product.medias?.edges.find((v)=>v.node?.id === initialVariant?.mediaId)?.node ?? product.featuredImage;
|
|
143
|
+
}
|
|
144
|
+
return createProductStoreProvider({
|
|
145
|
+
product,
|
|
146
|
+
quantity,
|
|
147
|
+
selectedOptions,
|
|
148
|
+
uiqueId,
|
|
149
|
+
featuredImageGlobal,
|
|
150
|
+
isSyncProduct
|
|
151
|
+
});
|
|
152
|
+
}, [
|
|
153
|
+
initialVariantId,
|
|
154
|
+
product,
|
|
155
|
+
quantity,
|
|
156
|
+
uiqueId,
|
|
157
|
+
isSyncProduct
|
|
158
|
+
]);
|
|
159
|
+
return /*#__PURE__*/ jsx(ProductContext.Provider, {
|
|
160
|
+
value: store,
|
|
161
|
+
children: /*#__PURE__*/ jsx(Fragment, {
|
|
162
|
+
children: children
|
|
163
|
+
})
|
|
164
|
+
});
|
|
165
|
+
};
|
|
166
|
+
const useProductStore = (selector, equalityFn)=>{
|
|
167
|
+
const store = useContext(ProductContext);
|
|
168
|
+
if (!store) {
|
|
169
|
+
throw new Error('Element of product must be used inside a Product');
|
|
170
|
+
}
|
|
171
|
+
return useStore(store, selector, equalityFn);
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
export { ProductProvider, useProductStore };
|
|
@@ -1 +1,28 @@
|
|
|
1
|
-
import{jsx
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useContext, createContext } from 'react';
|
|
3
|
+
import { useStore, createStore } from 'zustand';
|
|
4
|
+
|
|
5
|
+
const ProductListContext = /*#__PURE__*/ createContext(null);
|
|
6
|
+
const createProductListProvider = (data)=>createStore(()=>({
|
|
7
|
+
...data
|
|
8
|
+
}));
|
|
9
|
+
const ProductListProvider = ({ children, collection, products, settings, styles })=>{
|
|
10
|
+
return /*#__PURE__*/ jsx(ProductListContext.Provider, {
|
|
11
|
+
value: createProductListProvider({
|
|
12
|
+
products,
|
|
13
|
+
collection,
|
|
14
|
+
settings,
|
|
15
|
+
styles
|
|
16
|
+
}),
|
|
17
|
+
children: children
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
const useProductListStore = (selector, equalityFn)=>{
|
|
21
|
+
const store = useContext(ProductListContext);
|
|
22
|
+
if (!store) {
|
|
23
|
+
throw new Error('useProductListStore must be used within a useProductListStore');
|
|
24
|
+
}
|
|
25
|
+
return useStore(store, selector, equalityFn);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { ProductListContext, ProductListProvider, useProductListStore };
|
|
@@ -1 +1,49 @@
|
|
|
1
|
-
import{jsx
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useStore, createStore } from 'zustand';
|
|
3
|
+
import { useContext, createContext } from 'react';
|
|
4
|
+
import { cloneDeep } from '../helpers/clone-deep.js';
|
|
5
|
+
import { normalizeBuilderData } from '../helpers/normalize-builder-data.js';
|
|
6
|
+
|
|
7
|
+
const SectionContext = /*#__PURE__*/ createContext(null);
|
|
8
|
+
const createSectionProvider = (data)=>createStore((set, get)=>({
|
|
9
|
+
data: data ?? {},
|
|
10
|
+
getSection: (id)=>{
|
|
11
|
+
const section = get().data[id];
|
|
12
|
+
return section ?? undefined;
|
|
13
|
+
},
|
|
14
|
+
addSection: (id, data)=>{
|
|
15
|
+
const item = normalizeBuilderData(data);
|
|
16
|
+
set((prev)=>({
|
|
17
|
+
data: {
|
|
18
|
+
...prev.data,
|
|
19
|
+
[id]: cloneDeep(item)
|
|
20
|
+
}
|
|
21
|
+
}));
|
|
22
|
+
},
|
|
23
|
+
removeSection: (id)=>{
|
|
24
|
+
set((prev)=>{
|
|
25
|
+
const { [id]: _, ...rest } = prev.data;
|
|
26
|
+
return {
|
|
27
|
+
data: rest
|
|
28
|
+
};
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}));
|
|
32
|
+
const SectionProvider = ({ children, data, ...passProps })=>{
|
|
33
|
+
return /*#__PURE__*/ jsx(SectionContext.Provider, {
|
|
34
|
+
...passProps,
|
|
35
|
+
value: createSectionProvider(data),
|
|
36
|
+
children: children
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
// export const useSectionStore = useStore;
|
|
40
|
+
const useSectionStore = (selector, equalityFn)=>{
|
|
41
|
+
const store = useContext(SectionContext);
|
|
42
|
+
if (!store) {
|
|
43
|
+
throw new Error('useSectionStore must be used within a SectionProvider');
|
|
44
|
+
}
|
|
45
|
+
return useStore(store, selector, equalityFn);
|
|
46
|
+
};
|
|
47
|
+
const useSection = (id)=>useSectionStore((s)=>s.getSection(id));
|
|
48
|
+
|
|
49
|
+
export { SectionProvider, useSection, useSectionStore };
|
|
@@ -1 +1,104 @@
|
|
|
1
|
-
import{jsx
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { SWRConfig } from 'swr';
|
|
3
|
+
import { useStore, createStore } from 'zustand';
|
|
4
|
+
import { useMemo, useCallback, useEffect, useContext, createContext } from 'react';
|
|
5
|
+
import { AddonProvider } from './AddonContext.js';
|
|
6
|
+
import { ModalProvider } from './ModalContext.js';
|
|
7
|
+
|
|
8
|
+
const ShopContext = /*#__PURE__*/ createContext(null);
|
|
9
|
+
const createShopStoreProvider = (data)=>createStore((set)=>({
|
|
10
|
+
mobileOnly: false,
|
|
11
|
+
isStorefront: true,
|
|
12
|
+
...data,
|
|
13
|
+
changeLocale: (locale)=>{
|
|
14
|
+
set({
|
|
15
|
+
locale
|
|
16
|
+
});
|
|
17
|
+
},
|
|
18
|
+
changeCurrency: (currency)=>{
|
|
19
|
+
set({
|
|
20
|
+
currency
|
|
21
|
+
});
|
|
22
|
+
},
|
|
23
|
+
changeSwatches: (swatches)=>{
|
|
24
|
+
set({
|
|
25
|
+
swatches
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
changeLayoutSettings: (layoutSettings)=>{
|
|
29
|
+
set({
|
|
30
|
+
layoutSettings
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
changeStorefrontInfo: ({ url, token })=>{
|
|
34
|
+
set({
|
|
35
|
+
storefrontUrl: url,
|
|
36
|
+
storefrontToken: token
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
changeCreateThemeSectionCount: (count)=>{
|
|
40
|
+
set({
|
|
41
|
+
createThemeSectionCount: count
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
changeShopPlan: (plan)=>{
|
|
45
|
+
set({
|
|
46
|
+
plan
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
changeLimitCreateThemeSection: (data)=>{
|
|
50
|
+
set({
|
|
51
|
+
limitCreateThemeSection: data
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}));
|
|
55
|
+
const ShopProvider = ({ children, addons, storeOption, queryOption, ...passProps })=>{
|
|
56
|
+
const store = useMemo(()=>createShopStoreProvider(storeOption), [
|
|
57
|
+
storeOption
|
|
58
|
+
]);
|
|
59
|
+
const onUpdateLimitation = useCallback((e)=>{
|
|
60
|
+
const isAllow = !!e.detail?.isAllow;
|
|
61
|
+
const maxGenerateCount = e.detail?.maxGenerateCount;
|
|
62
|
+
const nextQuota = e.detail?.nextQuota;
|
|
63
|
+
store.setState({
|
|
64
|
+
generateContentLimitation: {
|
|
65
|
+
isAllow,
|
|
66
|
+
maxGenerateCount,
|
|
67
|
+
nextQuota
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}, [
|
|
71
|
+
store
|
|
72
|
+
]);
|
|
73
|
+
useEffect(()=>{
|
|
74
|
+
window.addEventListener('editor:ai-generate-content-update-limitation', onUpdateLimitation);
|
|
75
|
+
return ()=>{
|
|
76
|
+
window.removeEventListener('editor:ai-generate-content-update-limitation', onUpdateLimitation);
|
|
77
|
+
};
|
|
78
|
+
}, [
|
|
79
|
+
onUpdateLimitation
|
|
80
|
+
]);
|
|
81
|
+
return /*#__PURE__*/ jsx(AddonProvider, {
|
|
82
|
+
components: addons,
|
|
83
|
+
children: /*#__PURE__*/ jsx(SWRConfig, {
|
|
84
|
+
value: queryOption,
|
|
85
|
+
children: /*#__PURE__*/ jsx(ShopContext.Provider, {
|
|
86
|
+
...passProps,
|
|
87
|
+
value: store,
|
|
88
|
+
children: /*#__PURE__*/ jsx(ModalProvider, {
|
|
89
|
+
children: children
|
|
90
|
+
})
|
|
91
|
+
}, JSON.stringify(storeOption))
|
|
92
|
+
})
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
// export const useShopStore = useStore;
|
|
96
|
+
const useShopStore = (selector, equalityFn)=>{
|
|
97
|
+
const store = useContext(ShopContext);
|
|
98
|
+
if (!store) {
|
|
99
|
+
throw new Error('useShopStore must be used within a ShopProvider');
|
|
100
|
+
}
|
|
101
|
+
return useStore(store, selector, equalityFn);
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export { ShopProvider, useShopStore };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable */ const CollectionDetailSelect = `
|
|
2
2
|
fragment CollectionDetailSelect on Collection {
|
|
3
3
|
id
|
|
4
4
|
createdAt
|
|
@@ -20,4 +20,6 @@ let CollectionDetailSelect=`
|
|
|
20
20
|
isStorefront
|
|
21
21
|
isSample
|
|
22
22
|
}
|
|
23
|
-
`;
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
export { CollectionDetailSelect };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable */ const CollectionProductSelect = `
|
|
2
2
|
fragment CollectionProductSelect on Collection {
|
|
3
3
|
...CollectionDetailSelect
|
|
4
4
|
products(
|
|
@@ -19,4 +19,6 @@ let CollectionProductSelect=`
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
`;
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
export { CollectionProductSelect };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable */ const CollectionSelect = `
|
|
2
2
|
fragment CollectionSelect on Collection {
|
|
3
3
|
...CollectionDetailSelect
|
|
4
4
|
products {
|
|
@@ -17,4 +17,6 @@ let CollectionSelect=`
|
|
|
17
17
|
totalCount
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
`;
|
|
20
|
+
`;
|
|
21
|
+
|
|
22
|
+
export { CollectionSelect };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable */ const CustomFontSelect = `
|
|
2
2
|
fragment CustomFontSelect on CustomFont {
|
|
3
3
|
backupFilePath
|
|
4
4
|
fontFamily
|
|
@@ -7,4 +7,6 @@ let CustomFontSelect=`
|
|
|
7
7
|
mimeType
|
|
8
8
|
filePath
|
|
9
9
|
}
|
|
10
|
-
`;
|
|
10
|
+
`;
|
|
11
|
+
|
|
12
|
+
export { CustomFontSelect };
|