@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,108 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
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
|
-
setDynamicDiscountOffer: (dynamicDiscountOffer)=>{
|
|
24
|
-
set({
|
|
25
|
-
dynamicDiscountOffer: dynamicDiscountOffer
|
|
26
|
-
});
|
|
27
|
-
},
|
|
28
|
-
setSalePageProductId: (id)=>{
|
|
29
|
-
set({
|
|
30
|
-
salePageProductId: id
|
|
31
|
-
});
|
|
32
|
-
},
|
|
33
|
-
setPublicStoreFrontData: (publicStoreFrontData)=>{
|
|
34
|
-
set({
|
|
35
|
-
publicStoreFrontData: publicStoreFrontData
|
|
36
|
-
});
|
|
37
|
-
},
|
|
38
|
-
setInteractionIsSelectOnPage: (value)=>{
|
|
39
|
-
set((state)=>({
|
|
40
|
-
interactionData: {
|
|
41
|
-
...state.interactionData,
|
|
42
|
-
isSelectOnPage: value
|
|
43
|
-
}
|
|
44
|
-
}));
|
|
45
|
-
},
|
|
46
|
-
setInteractionItem: (item)=>{
|
|
47
|
-
set((state)=>({
|
|
48
|
-
interactionData: {
|
|
49
|
-
...state.interactionData,
|
|
50
|
-
item,
|
|
51
|
-
isSelectOnPage: state.interactionData?.isSelectOnPage || false
|
|
52
|
-
}
|
|
53
|
-
}));
|
|
54
|
-
},
|
|
55
|
-
setInteractionSelectType: (selectType)=>{
|
|
56
|
-
set((state)=>({
|
|
57
|
-
interactionData: {
|
|
58
|
-
...state.interactionData,
|
|
59
|
-
selectType
|
|
60
|
-
}
|
|
61
|
-
}));
|
|
62
|
-
},
|
|
63
|
-
setInteractionSettingType: (settingType)=>{
|
|
64
|
-
set((state)=>({
|
|
65
|
-
interactionData: {
|
|
66
|
-
...state.interactionData,
|
|
67
|
-
settingType
|
|
68
|
-
}
|
|
69
|
-
}));
|
|
70
|
-
},
|
|
71
|
-
setSidebarMode: (mode)=>{
|
|
72
|
-
set(()=>({
|
|
73
|
-
sidebarMode: mode
|
|
74
|
-
}));
|
|
75
|
-
}
|
|
76
|
-
}));
|
|
77
|
-
const PageProvider = ({ children, dynamicProduct, dynamicCollection, productOffers, dynamicDiscountOffer, publicStoreFrontData, ...passProps })=>{
|
|
78
|
-
const store = useMemo(()=>createPageStoreProvider({
|
|
79
|
-
dynamicProduct,
|
|
80
|
-
dynamicCollection,
|
|
81
|
-
productOffers,
|
|
82
|
-
dynamicDiscountOffer,
|
|
83
|
-
publicStoreFrontData,
|
|
84
|
-
interactionData: {
|
|
85
|
-
selectType: 'ELEMENT'
|
|
86
|
-
}
|
|
87
|
-
}), [
|
|
88
|
-
dynamicProduct,
|
|
89
|
-
dynamicCollection,
|
|
90
|
-
productOffers,
|
|
91
|
-
dynamicDiscountOffer,
|
|
92
|
-
publicStoreFrontData
|
|
93
|
-
]);
|
|
94
|
-
return /*#__PURE__*/ jsx(PageContext.Provider, {
|
|
95
|
-
...passProps,
|
|
96
|
-
value: store,
|
|
97
|
-
children: children
|
|
98
|
-
});
|
|
99
|
-
};
|
|
100
|
-
const usePageStore = (selector, equalityFn)=>{
|
|
101
|
-
const store = useContext(PageContext);
|
|
102
|
-
if (!store) {
|
|
103
|
-
throw new Error('usePageStore must be used within a PageProvider');
|
|
104
|
-
}
|
|
105
|
-
return useStore(store, selector, equalityFn);
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
export { PageProvider, usePageStore };
|
|
1
|
+
'use client';
|
|
2
|
+
import{jsx as e}from"react/jsx-runtime";import{useMemo as t,useContext as a,createContext as r}from"react";import{useStore as i,createStore as o}from"zustand";let PageContext=r(null),createPageStoreProvider=e=>o(t=>({...e,setDynamicProduct:e=>{t({dynamicProduct:e})},setDynamicCollection:e=>{t({dynamicCollection:e})},setPostPurchaseProductOffers:e=>{t({productOffers:e})},setDynamicDiscountOffer:e=>{t({dynamicDiscountOffer:e})},setSalePageProductId:e=>{t({salePageProductId:e})},setPublicStoreFrontData:e=>{t({publicStoreFrontData:e})},setInteractionIsSelectOnPage:e=>{t(t=>({interactionData:{...t.interactionData,isSelectOnPage:e}}))},setInteractionItem:e=>{t(t=>({interactionData:{...t.interactionData,item:e,isSelectOnPage:t.interactionData?.isSelectOnPage||!1}}))},setInteractionSelectType:e=>{t(t=>({interactionData:{...t.interactionData,selectType:e}}))},setInteractionSettingType:e=>{t(t=>({interactionData:{...t.interactionData,settingType:e}}))},setSidebarMode:e=>{t(()=>({sidebarMode:e}))}})),PageProvider=({children:a,dynamicProduct:r,dynamicCollection:i,productOffers:o,dynamicDiscountOffer:n,publicStoreFrontData:c,...s})=>{let P=t(()=>createPageStoreProvider({dynamicProduct:r,dynamicCollection:i,productOffers:o,dynamicDiscountOffer:n,publicStoreFrontData:c,interactionData:{selectType:"ELEMENT"}}),[r,i,o,n,c]);return e(PageContext.Provider,{...s,value:P,children:a})},usePageStore=(e,t)=>{let r=a(PageContext);if(!r)throw Error("usePageStore must be used within a PageProvider");return i(r,e,t)};export{PageProvider,usePageStore};
|
|
@@ -1,179 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
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
|
-
setIsChangeSelectedOption: (value)=>{
|
|
123
|
-
set({
|
|
124
|
-
isChangeSelectedOption: value
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
}));
|
|
128
|
-
const ProductProvider = ({ children, product, initialVariantId, quantity = 1, isSyncProduct })=>{
|
|
129
|
-
const uiqueId = useId();
|
|
130
|
-
const store = useMemo(()=>{
|
|
131
|
-
let selectedOptions = {};
|
|
132
|
-
let featuredImageGlobal = undefined;
|
|
133
|
-
if (product) {
|
|
134
|
-
const variants = flattenConnection(product.variants);
|
|
135
|
-
const firstVariant = variants[0];
|
|
136
|
-
const firstVariantInStock = variants.find((item)=>checkInStock(item));
|
|
137
|
-
const initialVariant = variants.find((v)=>v?.id === initialVariantId) ?? firstVariantInStock ?? firstVariant;
|
|
138
|
-
selectedOptions = initialVariant?.selectedOptions.reduce((acc, option)=>{
|
|
139
|
-
if (option.name) {
|
|
140
|
-
return {
|
|
141
|
-
...acc,
|
|
142
|
-
[option.name]: option.value
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
return acc;
|
|
146
|
-
}, {});
|
|
147
|
-
featuredImageGlobal = product.medias?.edges.find((v)=>v.node?.id === initialVariant?.mediaId)?.node ?? product.featuredImage;
|
|
148
|
-
}
|
|
149
|
-
return createProductStoreProvider({
|
|
150
|
-
product,
|
|
151
|
-
quantity,
|
|
152
|
-
selectedOptions,
|
|
153
|
-
uiqueId,
|
|
154
|
-
featuredImageGlobal,
|
|
155
|
-
isSyncProduct
|
|
156
|
-
});
|
|
157
|
-
}, [
|
|
158
|
-
initialVariantId,
|
|
159
|
-
product,
|
|
160
|
-
quantity,
|
|
161
|
-
uiqueId,
|
|
162
|
-
isSyncProduct
|
|
163
|
-
]);
|
|
164
|
-
return /*#__PURE__*/ jsx(ProductContext.Provider, {
|
|
165
|
-
value: store,
|
|
166
|
-
children: /*#__PURE__*/ jsx(Fragment, {
|
|
167
|
-
children: children
|
|
168
|
-
})
|
|
169
|
-
});
|
|
170
|
-
};
|
|
171
|
-
const useProductStore = (selector, equalityFn)=>{
|
|
172
|
-
const store = useContext(ProductContext);
|
|
173
|
-
if (!store) {
|
|
174
|
-
throw new Error('Element of product must be used inside a Product');
|
|
175
|
-
}
|
|
176
|
-
return useStore(store, selector, equalityFn);
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
export { ProductProvider, useProductStore };
|
|
1
|
+
'use client';
|
|
2
|
+
import{jsx as e,Fragment as t}from"react/jsx-runtime";import{useId as r,useMemo as o,useContext as i,createContext as s}from"react";import{useStore as d,createStore as a}from"zustand";import"swr";import"@gem-sdk/adapter-shopify";import"swr/mutation";import"swr/infinite";import"vanilla-lazyload";import"../hooks/useCartUI.js";import"../hooks/useStickyStore.js";import{checkInStock as p}from"../helpers/variant.js";import"react-transition-group";import"@gem-sdk/core";import"classnames";import"dayjs";import{flattenConnection as n}from"../helpers/flatten-connection.js";import"../helpers/convert.js";let ProductContext=s(null),createProductStoreProvider=e=>a((t,r)=>({...e,updateProperty:(e,r)=>{t(t=>({properties:t.properties?.map(t=>t.key===e?{...t,...r}:t)}))},setUseProductCompareAtPrice:e=>{t({useProductCompareAtPrice:e})},setShouldRequireUploadMessage:e=>{t({shouldRequireUploadMessage:e})},setRequireUpload:e=>{t({requireUpload:e})},addProperty:e=>{let o=r().properties;o?.some(t=>t.key===e.key)||t(t=>({properties:[...t.properties??[],e]}))},removeProperty:e=>{t(t=>({properties:t.properties?.filter(t=>t.key!==e)}))},setQuantity:e=>{t({quantity:e>0?e:1})},setProductFeaturedImage:e=>{t({featuredImageGlobal:e})},incrementQuantity:()=>{t(e=>{let t=e.quantity??1;return{quantity:t+1}})},decrementQuantity:()=>{t(e=>{let t=e.quantity??1;return{quantity:t>2?t-1:1}})},setSelectedOption:(e,r)=>{t(t=>e&&r?{selectedOptions:{...t?.selectedOptions,[e]:r}}:t)},forceSelectedOption:e=>{t(t=>({selectedOptions:{...t?.selectedOptions,...e}}))},updateIsSubmit:e=>{t({isSubmit:e})},setHasUpdatePriceFollowQuantity:e=>{t({updatePrice:e})},setHasPreSelected:e=>{t({hasPreSelected:e})},setIsChangeSelectedOption:e=>{t({isChangeSelectedOption:e})}})),ProductProvider=({children:i,product:s,initialVariantId:d,initialVariantBaseId:a,quantity:u=1,isSyncProduct:l,hasPreSelected:c})=>{let m=r(),P=o(()=>{let e,t={};if(s){let r=n(s.variants),o=r[0],i=r.find(e=>p(e)),u=r.find(e=>e?.id===d||e?.baseID===a)??i??o;t=u?.selectedOptions?.reduce((e,t)=>t.name?{...e,[t.name]:t.value}:e,{}),e=s.medias?.edges.find(e=>e.node?.id===u?.mediaId)?.node??s.featuredImage}return createProductStoreProvider({product:s,quantity:u,selectedOptions:t,uiqueId:m,featuredImageGlobal:e,isSyncProduct:l,hasPreSelected:c})},[s,u,m,l,c,d]);return e(ProductContext.Provider,{value:P,children:e(t,{children:i})})},useProductStore=(e,t)=>{let r=i(ProductContext);if(!r)throw Error("Element of product must be used inside a Product");return d(r,e,t)};export{ProductProvider,useProductStore};
|
|
@@ -1,28 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
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
|
+
'use client';
|
|
2
|
+
import{jsx as t}from"react/jsx-runtime";import{useContext as r,createContext as o}from"react";import{useStore as e,createStore as i}from"zustand";let ProductListContext=o(null),createProductListProvider=t=>i(()=>({...t})),ProductListProvider=({children:r,collection:o,products:e,settings:i,styles:u})=>t(ProductListContext.Provider,{value:createProductListProvider({products:e,collection:o,settings:i,styles:u}),children:r}),useProductListStore=(t,o)=>{let i=r(ProductListContext);if(!i)throw Error("useProductListStore must be used within a useProductListStore");return e(i,t,o)};export{ProductListContext,ProductListProvider,useProductListStore};
|
|
@@ -1,49 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
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
|
+
'use client';
|
|
2
|
+
import{jsx as e}from"react/jsx-runtime";import{useStore as t,createStore as o}from"zustand";import{useContext as r,createContext as i}from"react";import{cloneDeep as n}from"../helpers/clone-deep.js";import{normalizeBuilderData as c}from"../helpers/normalize-builder-data.js";let SectionContext=i(null),createSectionProvider=e=>o((t,o)=>({data:e??{},getSection:e=>{let t=o().data[e];return t??void 0},addSection:(e,o)=>{let r=c(o);t(t=>({data:{...t.data,[e]:n(r)}}))},removeSection:e=>{t(t=>{let{[e]:o,...r}=t.data;return{data:r}})}})),SectionProvider=({children:t,data:o,...r})=>e(SectionContext.Provider,{...r,value:createSectionProvider(o),children:t}),useSectionStore=(e,o)=>{let i=r(SectionContext);if(!i)throw Error("useSectionStore must be used within a SectionProvider");return t(i,e,o)},useSection=e=>useSectionStore(t=>t.getSection(e));export{SectionProvider,useSection,useSectionStore};
|
|
@@ -1,104 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
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
|
+
'use client';
|
|
2
|
+
import{jsx as e}from"react/jsx-runtime";import{SWRConfig as t}from"swr";import{useStore as o,createStore as r}from"zustand";import{useMemo as n,useCallback as i,useEffect as a,useContext as h,createContext as c}from"react";import{AddonProvider as d}from"./AddonContext.js";import{ModalProvider as m}from"./ModalContext.js";let ShopContext=c(null),createShopStoreProvider=e=>r(t=>({mobileOnly:!1,isStorefront:!0,...e,changeLocale:e=>{t({locale:e})},changeCurrency:e=>{t({currency:e})},changeSwatches:e=>{t({swatches:e})},changeLayoutSettings:e=>{t({layoutSettings:e})},updatePriceWithCurrency:e=>{t({showPriceCurrency:e})},changeStorefrontInfo:({url:e,token:o})=>{t({storefrontUrl:e,storefrontToken:o})},changeCreateThemeSectionCount:e=>{t({createThemeSectionCount:e})},changeShopPlan:e=>{t({plan:e})},changeLimitCreateThemeSection:e=>{t({limitCreateThemeSection:e})}})),ShopProvider=({children:o,addons:r,storeOption:h,queryOption:c,...S})=>{let l=n(()=>createShopStoreProvider(h),[h]),p=i(e=>{let t=!!e.detail?.isAllow,o=e.detail?.maxGenerateCount,r=e.detail?.nextQuota;l.setState({generateContentLimitation:{isAllow:t,maxGenerateCount:o,nextQuota:r}})},[l]);return a(()=>(window.addEventListener("editor:ai-generate-content-update-limitation",p),()=>{window.removeEventListener("editor:ai-generate-content-update-limitation",p)}),[p]),e(d,{components:r,children:e(t,{value:c,children:e(ShopContext.Provider,{...S,value:l,children:e(m,{children:o})},JSON.stringify(h))})})},useShopStore=(e,t)=>{let r=h(ShopContext);if(!r)throw Error("useShopStore must be used within a ShopProvider");return o(r,e,t)};export{ShopProvider,useShopStore};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
let CollectionDetailSelect=`
|
|
2
2
|
fragment CollectionDetailSelect on Collection {
|
|
3
3
|
id
|
|
4
4
|
createdAt
|
|
@@ -20,6 +20,4 @@
|
|
|
20
20
|
isStorefront
|
|
21
21
|
isSample
|
|
22
22
|
}
|
|
23
|
-
`;
|
|
24
|
-
|
|
25
|
-
export { CollectionDetailSelect };
|
|
23
|
+
`;export{CollectionDetailSelect};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
let CollectionProductSelect=`
|
|
2
2
|
fragment CollectionProductSelect on Collection {
|
|
3
3
|
...CollectionDetailSelect
|
|
4
4
|
products(
|
|
@@ -19,6 +19,4 @@
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
`;
|
|
23
|
-
|
|
24
|
-
export { CollectionProductSelect };
|
|
22
|
+
`;export{CollectionProductSelect};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
let CollectionSelect=`
|
|
2
2
|
fragment CollectionSelect on Collection {
|
|
3
3
|
...CollectionDetailSelect
|
|
4
4
|
products {
|
|
@@ -17,6 +17,4 @@
|
|
|
17
17
|
totalCount
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
`;
|
|
21
|
-
|
|
22
|
-
export { CollectionSelect };
|
|
20
|
+
`;export{CollectionSelect};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
let CustomFontSelect=`
|
|
2
2
|
fragment CustomFontSelect on CustomFont {
|
|
3
3
|
backupFilePath
|
|
4
|
+
fileKey
|
|
5
|
+
filePath
|
|
4
6
|
fontFamily
|
|
5
7
|
fontStyle
|
|
6
8
|
fontWeight
|
|
9
|
+
id
|
|
7
10
|
mimeType
|
|
8
|
-
|
|
11
|
+
shopID
|
|
12
|
+
size
|
|
9
13
|
}
|
|
10
|
-
`;
|
|
11
|
-
|
|
12
|
-
export { CustomFontSelect };
|
|
14
|
+
`;export{CustomFontSelect};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
let PreviewThemePageSelect=`
|
|
2
2
|
fragment PreviewThemePageSelect on PreviewThemePage {
|
|
3
3
|
id
|
|
4
4
|
name
|
|
@@ -31,7 +31,9 @@
|
|
|
31
31
|
id
|
|
32
32
|
value
|
|
33
33
|
}
|
|
34
|
+
metafields {
|
|
35
|
+
key
|
|
36
|
+
value
|
|
37
|
+
}
|
|
34
38
|
}
|
|
35
|
-
`;
|
|
36
|
-
|
|
37
|
-
export { PreviewThemePageSelect };
|
|
39
|
+
`;export{PreviewThemePageSelect};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
let ProductOptionValueSelect=`
|
|
2
2
|
fragment ProductOptionValueSelect on ProductOptionValue {
|
|
3
3
|
id
|
|
4
4
|
label
|
|
5
5
|
isDefault
|
|
6
6
|
baseID
|
|
7
7
|
}
|
|
8
|
-
`;
|
|
9
|
-
|
|
10
|
-
export { ProductOptionValueSelect };
|
|
8
|
+
`;export{ProductOptionValueSelect};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
let ProductOptionSelect=`
|
|
2
2
|
fragment ProductOptionSelect on ProductOption {
|
|
3
3
|
id
|
|
4
4
|
name
|
|
@@ -7,6 +7,4 @@
|
|
|
7
7
|
...ProductOptionValueSelect
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
`;
|
|
11
|
-
|
|
12
|
-
export { ProductOptionSelect };
|
|
10
|
+
`;export{ProductOptionSelect};
|