@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
package/dist/esm/hooks/shop.js
CHANGED
|
@@ -1,119 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { useShopStore } from '../contexts/ShopContext.js';
|
|
4
|
-
|
|
5
|
-
const useLocale = ()=>{
|
|
6
|
-
const locale = useShopStore((state)=>state.locale);
|
|
7
|
-
const changeLocale = useShopStore((state)=>state.changeLocale);
|
|
8
|
-
return useMemo(()=>({
|
|
9
|
-
locale,
|
|
10
|
-
changeLocale
|
|
11
|
-
}), [
|
|
12
|
-
locale,
|
|
13
|
-
changeLocale
|
|
14
|
-
]);
|
|
15
|
-
};
|
|
16
|
-
const useCurrency = ()=>{
|
|
17
|
-
const currency = useShopStore((state)=>state.currency);
|
|
18
|
-
const changeCurrency = useShopStore((state)=>state.changeCurrency);
|
|
19
|
-
return useMemo(()=>({
|
|
20
|
-
currency,
|
|
21
|
-
changeCurrency
|
|
22
|
-
}), [
|
|
23
|
-
currency,
|
|
24
|
-
changeCurrency
|
|
25
|
-
]);
|
|
26
|
-
};
|
|
27
|
-
const useTimezone = ()=>{
|
|
28
|
-
const timezone = useShopStore((state)=>state.timezone);
|
|
29
|
-
return useMemo(()=>({
|
|
30
|
-
timezone
|
|
31
|
-
}), [
|
|
32
|
-
timezone
|
|
33
|
-
]);
|
|
34
|
-
};
|
|
35
|
-
const useMoneyFormat = ()=>{
|
|
36
|
-
const moneyFormat = useShopStore((state)=>state.moneyFormat);
|
|
37
|
-
const moneyWithCurrencyFormat = useShopStore((state)=>state.moneyWithCurrencyFormat);
|
|
38
|
-
return useMemo(()=>({
|
|
39
|
-
moneyFormat,
|
|
40
|
-
moneyWithCurrencyFormat
|
|
41
|
-
}), [
|
|
42
|
-
moneyFormat,
|
|
43
|
-
moneyWithCurrencyFormat
|
|
44
|
-
]);
|
|
45
|
-
};
|
|
46
|
-
const useSwatches = ()=>{
|
|
47
|
-
const swatches = useShopStore((state)=>state.swatches);
|
|
48
|
-
const changeSwatches = useShopStore((state)=>state.changeSwatches);
|
|
49
|
-
return useMemo(()=>({
|
|
50
|
-
swatches,
|
|
51
|
-
changeSwatches
|
|
52
|
-
}), [
|
|
53
|
-
swatches,
|
|
54
|
-
changeSwatches
|
|
55
|
-
]);
|
|
56
|
-
};
|
|
57
|
-
const usePageType = ()=>{
|
|
58
|
-
const pageType = useShopStore((state)=>state.pageType);
|
|
59
|
-
return useMemo(()=>pageType || 'STATIC', [
|
|
60
|
-
pageType
|
|
61
|
-
]);
|
|
62
|
-
};
|
|
63
|
-
const useStoreFront = ()=>{
|
|
64
|
-
const provider = useShopStore((state)=>state.provider);
|
|
65
|
-
const storefrontToken = useShopStore((state)=>state.storefrontToken);
|
|
66
|
-
const storefrontUrl = useShopStore((state)=>state.storefrontUrl);
|
|
67
|
-
return {
|
|
68
|
-
provider,
|
|
69
|
-
storefrontToken,
|
|
70
|
-
storefrontUrl
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
const usePluginEnable = ()=>{
|
|
74
|
-
return useShopStore((state)=>state.plugins);
|
|
75
|
-
};
|
|
76
|
-
const useEditorMode = ()=>{
|
|
77
|
-
return useShopStore((state)=>state.mode);
|
|
78
|
-
};
|
|
79
|
-
const useMobileOnly = ()=>{
|
|
80
|
-
return useShopStore((state)=>state.mobileOnly);
|
|
81
|
-
};
|
|
82
|
-
const useMatchMutate = ()=>{
|
|
83
|
-
const { cache, mutate } = useSWRConfig();
|
|
84
|
-
return (matcher, opts)=>{
|
|
85
|
-
if (!(cache instanceof Map)) {
|
|
86
|
-
throw new Error('matchMutate requires the cache provider to be a Map instance');
|
|
87
|
-
}
|
|
88
|
-
const keys = [];
|
|
89
|
-
cache.forEach((_, key)=>{
|
|
90
|
-
if (matcher.test(key)) {
|
|
91
|
-
keys.push(key);
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
const mutations = keys.map((key)=>{
|
|
95
|
-
const cacheData = cache.get(key);
|
|
96
|
-
return mutate(key, cacheData?.data, opts);
|
|
97
|
-
});
|
|
98
|
-
return Promise.all(mutations);
|
|
99
|
-
};
|
|
100
|
-
};
|
|
101
|
-
function useConnectedShopify() {
|
|
102
|
-
const { storefrontToken } = useStoreFront();
|
|
103
|
-
return !!storefrontToken;
|
|
104
|
-
}
|
|
105
|
-
function useIsSampleProduct() {
|
|
106
|
-
const { storefrontToken } = useStoreFront();
|
|
107
|
-
const isStorefront = useShopStore((state)=>state.isStorefront);
|
|
108
|
-
return isStorefront && !storefrontToken;
|
|
109
|
-
}
|
|
110
|
-
function useIsStorefrontProduct() {
|
|
111
|
-
return useShopStore((state)=>state.isStorefront);
|
|
112
|
-
}
|
|
113
|
-
function useCheckoutUrl(url) {
|
|
114
|
-
const { storefrontToken } = useStoreFront();
|
|
115
|
-
if (!url) return undefined;
|
|
116
|
-
return storefrontToken ? `${url}?access_token=${storefrontToken}` : url;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export { useCheckoutUrl, useConnectedShopify, useCurrency, useEditorMode, useIsSampleProduct, useIsStorefrontProduct, useLocale, useMatchMutate, useMobileOnly, useMoneyFormat, usePageType, usePluginEnable, useStoreFront, useSwatches, useTimezone };
|
|
1
|
+
'use client';
|
|
2
|
+
import{useMemo as e}from"react";import{useSWRConfig as t}from"swr";import{useShopStore as r}from"../contexts/ShopContext.js";let useLocale=()=>{let t=r(e=>e.locale),o=r(e=>e.changeLocale);return e(()=>({locale:t,changeLocale:o}),[t,o])},useCurrency=()=>{let t=r(e=>e.currency),o=r(e=>e.changeCurrency);return e(()=>({currency:t,changeCurrency:o}),[t,o])},useTimezone=()=>{let t=r(e=>e.timezone);return e(()=>({timezone:t}),[t])},useMoneyFormat=()=>{let t=r(e=>e.moneyFormat),o=r(e=>e.moneyWithCurrencyFormat);return e(()=>({moneyFormat:t,moneyWithCurrencyFormat:o}),[t,o])},useSwatches=()=>{let t=r(e=>e.swatches),o=r(e=>e.changeSwatches);return e(()=>({swatches:t,changeSwatches:o}),[t,o])},usePageType=()=>{let t=r(e=>e.pageType);return e(()=>t||"STATIC",[t])},useStoreFront=()=>{let e=r(e=>e.provider),t=r(e=>e.storefrontToken),o=r(e=>e.storefrontUrl);return{provider:e,storefrontToken:t,storefrontUrl:o}},usePluginEnable=()=>r(e=>e.plugins),useEditorMode=()=>r(e=>e.mode),useMobileOnly=()=>r(e=>e.mobileOnly),useMatchMutate=()=>{let{cache:e,mutate:r}=t();return(t,o)=>{if(!(e instanceof Map))throw Error("matchMutate requires the cache provider to be a Map instance");let u=[];e.forEach((e,r)=>{t.test(r)&&u.push(r)});let n=u.map(t=>{let u=e.get(t);return r(t,u?.data,o)});return Promise.all(n)}};function useConnectedShopify(){let{storefrontToken:e}=useStoreFront();return!!e}function useIsSampleProduct(){let{storefrontToken:e}=useStoreFront(),t=r(e=>e.isStorefront);return t&&!e}function useIsStorefrontProduct(){return r(e=>e.isStorefront)}function useCheckoutUrl(e){let{storefrontToken:t}=useStoreFront();if(e)return t?`${e}?access_token=${t}`:e}export{useCheckoutUrl,useConnectedShopify,useCurrency,useEditorMode,useIsSampleProduct,useIsStorefrontProduct,useLocale,useMatchMutate,useMobileOnly,useMoneyFormat,usePageType,usePluginEnable,useStoreFront,useSwatches,useTimezone};
|
|
@@ -1,28 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
// Hàm debounce với TypeScript
|
|
4
|
-
function debounce(func, wait) {
|
|
5
|
-
let timeout;
|
|
6
|
-
return function(...args) {
|
|
7
|
-
clearTimeout(timeout);
|
|
8
|
-
timeout = setTimeout(()=>func.apply(this, args), wait);
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
function subscribe(callback) {
|
|
12
|
-
const debouncedCallback = debounce(callback, 200); // Debounce với thời gian chờ 200ms
|
|
13
|
-
window.addEventListener('resize', debouncedCallback);
|
|
14
|
-
return ()=>window.removeEventListener('resize', debouncedCallback);
|
|
15
|
-
}
|
|
16
|
-
const useCurrentDevice = ()=>{
|
|
17
|
-
return useSyncExternalStore(subscribe, ()=>{
|
|
18
|
-
if (window.innerWidth < 768) {
|
|
19
|
-
return 'mobile';
|
|
20
|
-
} else if (window.innerWidth >= 768 && window.innerWidth < 1025) {
|
|
21
|
-
return 'tablet';
|
|
22
|
-
} else {
|
|
23
|
-
return 'desktop';
|
|
24
|
-
}
|
|
25
|
-
}, ()=>'desktop');
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export { useCurrentDevice };
|
|
1
|
+
'use client';
|
|
2
|
+
import{useSyncExternalStore as e}from"react";function debounce(e,t){let i;return function(...n){clearTimeout(i),i=setTimeout(()=>e.apply(this,n),t)}}function subscribe(e){let t=debounce(e,200);return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)}let useCurrentDevice=()=>e(subscribe,()=>window.innerWidth<768?"mobile":window.innerWidth>=768&&window.innerWidth<1025?"tablet":"desktop",()=>"desktop");export{useCurrentDevice};
|
|
@@ -1,13 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
const useLazyVideo = ()=>{
|
|
5
|
-
useEffect(()=>{
|
|
6
|
-
const lazyLoadInstance = new LazyLoad({
|
|
7
|
-
use_native: true
|
|
8
|
-
});
|
|
9
|
-
lazyLoadInstance.update();
|
|
10
|
-
}, []);
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export { useLazyVideo };
|
|
1
|
+
'use client';
|
|
2
|
+
import{useEffect as e}from"react";import a from"vanilla-lazyload";let useLazyVideo=()=>{e(()=>{let e=new a({use_native:!0});e.update()},[])};export{useLazyVideo};
|
|
@@ -1,27 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import 'react/jsx-runtime';
|
|
4
|
-
import 'zustand';
|
|
5
|
-
import 'swr';
|
|
6
|
-
import '@gem-sdk/adapter-shopify';
|
|
7
|
-
import 'swr/mutation';
|
|
8
|
-
import 'swr/infinite';
|
|
9
|
-
import 'vanilla-lazyload';
|
|
10
|
-
import './useCartUI.js';
|
|
11
|
-
import 'react-transition-group';
|
|
12
|
-
import '@gem-sdk/core';
|
|
13
|
-
import 'classnames';
|
|
14
|
-
import 'dayjs';
|
|
15
|
-
import '../helpers/convert.js';
|
|
16
|
-
|
|
17
|
-
const useAnimations = ()=>{
|
|
18
|
-
const { zoom, shake, fade, slide } = animations();
|
|
19
|
-
return {
|
|
20
|
-
zoom,
|
|
21
|
-
shake,
|
|
22
|
-
fade,
|
|
23
|
-
slide
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export { useAnimations };
|
|
1
|
+
'use client';
|
|
2
|
+
import{animations as t}from"../helpers/animations.js";import"react";import"react/jsx-runtime";import"zustand";import"swr";import"@gem-sdk/adapter-shopify";import"swr/mutation";import"swr/infinite";import"vanilla-lazyload";import"./useCartUI.js";import"./useStickyStore.js";import"react-transition-group";import"@gem-sdk/core";import"classnames";import"dayjs";import"../helpers/convert.js";let useAnimations=()=>{let{zoom:r,shake:i,fade:o,slide:s}=t();return{zoom:r,shake:i,fade:o,slide:s}};export{useAnimations};
|
|
@@ -1,40 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const cartKey = 'cart-id';
|
|
4
|
-
const getCartId = ()=>{
|
|
5
|
-
return window.localStorage.getItem(cartKey);
|
|
6
|
-
};
|
|
7
|
-
const writeCartId = (value)=>{
|
|
8
|
-
if (value) {
|
|
9
|
-
window.localStorage.setItem(cartKey, value);
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
const removeCartId = ()=>{
|
|
13
|
-
window.localStorage.removeItem(cartKey);
|
|
14
|
-
};
|
|
15
|
-
const subscribeStorage = (callback)=>{
|
|
16
|
-
window.addEventListener('storage', callback);
|
|
17
|
-
return ()=>{
|
|
18
|
-
window.removeEventListener('storage', callback);
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
const useCartId = ()=>{
|
|
22
|
-
const cartId = useSyncExternalStore(subscribeStorage, getCartId, ()=>undefined);
|
|
23
|
-
const updateCartId = useCallback((val)=>{
|
|
24
|
-
writeCartId(val);
|
|
25
|
-
}, []);
|
|
26
|
-
const clearCartId = useCallback(()=>{
|
|
27
|
-
removeCartId();
|
|
28
|
-
}, []);
|
|
29
|
-
return useMemo(()=>({
|
|
30
|
-
cartId,
|
|
31
|
-
updateCartId,
|
|
32
|
-
clearCartId
|
|
33
|
-
}), [
|
|
34
|
-
cartId,
|
|
35
|
-
clearCartId,
|
|
36
|
-
updateCartId
|
|
37
|
-
]);
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export { useCartId as default };
|
|
1
|
+
'use client';
|
|
2
|
+
import{useSyncExternalStore as e,useCallback as t,useMemo as r}from"react";let cartKey="cart-id",getCartId=()=>window.localStorage.getItem(cartKey),writeCartId=e=>{e&&window.localStorage.setItem(cartKey,e)},removeCartId=()=>{window.localStorage.removeItem(cartKey)},subscribeStorage=e=>(window.addEventListener("storage",e),()=>{window.removeEventListener("storage",e)}),useCartId=()=>{let a=e(subscribeStorage,getCartId,()=>void 0),o=t(e=>{writeCartId(e)},[]),d=t(()=>{removeCartId()},[]);return r(()=>({cartId:a,updateCartId:o,clearCartId:d}),[a,d,o])};export{useCartId as default};
|
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const useCartLine = ()=>{
|
|
4
|
-
return useCartLineStore((s)=>s.line);
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export { useCartLine as default };
|
|
1
|
+
'use client';
|
|
2
|
+
import{useCartLineStore as e}from"../contexts/CartLineContext.js";let useCartLine=()=>e(e=>e.line);export{useCartLine as default};
|
|
@@ -1,44 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { usePluginEnable } from './shop.js';
|
|
4
|
-
|
|
5
|
-
const useStore = create((set)=>({
|
|
6
|
-
isCartOpen: false,
|
|
7
|
-
setOpen: (isCartOpen)=>{
|
|
8
|
-
const scrollBarGap = window.innerWidth - document.documentElement.clientWidth;
|
|
9
|
-
const computedBodyPaddingRight = parseInt(window.getComputedStyle(document.body).getPropertyValue('padding-right'), 10);
|
|
10
|
-
if (isCartOpen) {
|
|
11
|
-
document.body.style.overflow = `hidden`;
|
|
12
|
-
document.body.style.paddingRight = `${computedBodyPaddingRight + scrollBarGap}px`;
|
|
13
|
-
} else {
|
|
14
|
-
document.body.style.overflow = '';
|
|
15
|
-
document.body.style.paddingRight = '';
|
|
16
|
-
}
|
|
17
|
-
set({
|
|
18
|
-
isCartOpen
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
}));
|
|
22
|
-
function useCartUI() {
|
|
23
|
-
const plugins = usePluginEnable();
|
|
24
|
-
const isCartOpen = useStore((s)=>s.isCartOpen);
|
|
25
|
-
const setOpen = useStore((s)=>s.setOpen);
|
|
26
|
-
const openCart = useCallback(()=>{
|
|
27
|
-
if (plugins?.includes('cart-drawer')) {
|
|
28
|
-
setOpen(true);
|
|
29
|
-
}
|
|
30
|
-
}, [
|
|
31
|
-
plugins,
|
|
32
|
-
setOpen
|
|
33
|
-
]);
|
|
34
|
-
const closeCart = useCallback(()=>setOpen(false), [
|
|
35
|
-
setOpen
|
|
36
|
-
]);
|
|
37
|
-
return {
|
|
38
|
-
isCartOpen,
|
|
39
|
-
openCart,
|
|
40
|
-
closeCart
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export { useCartUI as default };
|
|
1
|
+
'use client';
|
|
2
|
+
import{useCallback as e}from"react";import{create as t}from"zustand";import{usePluginEnable as o}from"./shop.js";let useStore=t(e=>({isCartOpen:!1,setOpen:t=>{let o=window.innerWidth-document.documentElement.clientWidth,d=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right"),10);t?(document.body.style.overflow="hidden",document.body.style.paddingRight=`${d+o}px`):(document.body.style.overflow="",document.body.style.paddingRight=""),e({isCartOpen:t})}}));function useCartUI(){let t=o(),d=useStore(e=>e.isCartOpen),n=useStore(e=>e.setOpen),r=e(()=>{t?.includes("cart-drawer")&&n(!0)},[t,n]),i=e(()=>n(!1),[n]);return{isCartOpen:d,openCart:r,closeCart:i}}export{useCartUI as default};
|
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const useCollection = ()=>{
|
|
4
|
-
return useCollectionStore((s)=>s.collection);
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export { useCollection };
|
|
1
|
+
'use client';
|
|
2
|
+
import{useCollectionStore as o}from"../contexts/CollectionContext.js";let useCollection=()=>o(o=>o.collection);export{useCollection};
|
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const useFetchHandle = ()=>{
|
|
4
|
-
const { fetcher } = useSWRConfig();
|
|
5
|
-
if (!fetcher) {
|
|
6
|
-
throw new Error('Application must be init within a fetcher');
|
|
7
|
-
}
|
|
8
|
-
return fetcher;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export { useFetchHandle };
|
|
1
|
+
'use client';
|
|
2
|
+
import{useSWRConfig as e}from"swr";let useFetchHandle=()=>{let{fetcher:t}=e();if(!t)throw Error("Application must be init within a fetcher");return t};export{useFetchHandle};
|
|
@@ -1,71 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const shopifyPriceRounding = (amount, precision)=>{
|
|
4
|
-
return parseFloat(`${amount}`).toFixed(Number(precision));
|
|
5
|
-
};
|
|
6
|
-
const formatMoney = function(cents, format) {
|
|
7
|
-
let value = '';
|
|
8
|
-
const placeholderRegex = /\{\{\s*(\w+)\s*\}\}/;
|
|
9
|
-
const formatString = format || '${{amount}}';
|
|
10
|
-
/**
|
|
11
|
-
* check default
|
|
12
|
-
* @param opt opt
|
|
13
|
-
* @param def def
|
|
14
|
-
* @returns any
|
|
15
|
-
*/ function defaultOption(opt, def) {
|
|
16
|
-
return typeof opt == 'undefined' ? def : opt;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* formatWithDelimiters
|
|
20
|
-
* @param number number
|
|
21
|
-
* @param precision precision
|
|
22
|
-
* @param thousands thousands
|
|
23
|
-
* @param decimal decimal
|
|
24
|
-
* @returns any
|
|
25
|
-
*/ // eslint-disable-next-line max-params
|
|
26
|
-
function formatWithDelimiters(number, precision, thousands, decimal) {
|
|
27
|
-
precision = defaultOption(precision, 2);
|
|
28
|
-
thousands = defaultOption(thousands, ',');
|
|
29
|
-
decimal = defaultOption(decimal, '.');
|
|
30
|
-
if (isNaN(number) || number == null) {
|
|
31
|
-
return 0;
|
|
32
|
-
}
|
|
33
|
-
// shopify làm tròn bằng cách cắt đi các số ở đằng sau chứ không sử dụng toFixed để làm tròn như toán học
|
|
34
|
-
number = shopifyPriceRounding(number, Number(precision));
|
|
35
|
-
const parts = number.split('.'), dollars = parts[0]?.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1' + thousands), cents = parts[1] ? decimal + parts[1] : '';
|
|
36
|
-
return dollars + cents;
|
|
37
|
-
}
|
|
38
|
-
switch(formatString.match(placeholderRegex)[1]){
|
|
39
|
-
case 'amount':
|
|
40
|
-
value = formatWithDelimiters(cents, 2);
|
|
41
|
-
break;
|
|
42
|
-
case 'amount_no_decimals':
|
|
43
|
-
value = formatWithDelimiters(cents, 0);
|
|
44
|
-
break;
|
|
45
|
-
case 'amount_with_comma_separator':
|
|
46
|
-
value = formatWithDelimiters(cents, 2, '.', ',');
|
|
47
|
-
break;
|
|
48
|
-
case 'amount_no_decimals_with_comma_separator':
|
|
49
|
-
value = formatWithDelimiters(cents, 0, '.', ',');
|
|
50
|
-
break;
|
|
51
|
-
case 'amount_with_apostrophe_separator':
|
|
52
|
-
value = formatWithDelimiters(cents, 2, "'", '.');
|
|
53
|
-
break;
|
|
54
|
-
case 'amount_no_decimals_with_space_separator':
|
|
55
|
-
value = formatWithDelimiters(cents, 0, ' ');
|
|
56
|
-
break;
|
|
57
|
-
case 'amount_with_space_separator':
|
|
58
|
-
value = formatWithDelimiters(cents, 2, ' ', ',');
|
|
59
|
-
break;
|
|
60
|
-
case 'amount_with_period_and_space_separator':
|
|
61
|
-
value = formatWithDelimiters(cents, 2, ' ', '.');
|
|
62
|
-
break;
|
|
63
|
-
}
|
|
64
|
-
return formatString.replace(placeholderRegex, value);
|
|
65
|
-
};
|
|
66
|
-
const useFormatMoney = (amount, withCurrency)=>{
|
|
67
|
-
const { moneyFormat, moneyWithCurrencyFormat } = useMoneyFormat();
|
|
68
|
-
return withCurrency ? formatMoney(`${amount}`, moneyWithCurrencyFormat || moneyFormat) : formatMoney(`${amount}`, moneyFormat);
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
export { formatMoney, shopifyPriceRounding, useFormatMoney };
|
|
1
|
+
'use client';
|
|
2
|
+
import{useMoneyFormat as a}from"./shop.js";let shopifyPriceRounding=(a,e)=>parseFloat(`${a}`).toFixed(Number(e)),formatMoney=function(a,e){let o="",r=/\{\{\s*(\w+)\s*\}\}/,t=e||"${{amount}}";function n(a,e){return void 0===a?e:a}function s(a,e,o,r){if(e=n(e,2),o=n(o,","),r=n(r,"."),isNaN(a)||null==a)return 0;a=shopifyPriceRounding(a,Number(e));let t=a.split("."),s=t[0]?.replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+o),i=t[1]?r+t[1]:"";return s+i}switch(t.match(r)[1]){case"amount":o=s(a,2);break;case"amount_no_decimals":o=s(a,0);break;case"amount_with_comma_separator":o=s(a,2,".",",");break;case"amount_no_decimals_with_comma_separator":o=s(a,0,".",",");break;case"amount_with_apostrophe_separator":o=s(a,2,"'",".");break;case"amount_no_decimals_with_space_separator":o=s(a,0," ");break;case"amount_with_space_separator":o=s(a,2," ",",");break;case"amount_with_period_and_space_separator":o=s(a,2," ",".")}return t.replace(r,o)},useFormatMoney=(e,o)=>{let{moneyFormat:r,moneyWithCurrencyFormat:t}=a();return o?formatMoney(`${e}`,t||r):formatMoney(`${e}`,r)};export{formatMoney,shopifyPriceRounding,useFormatMoney};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import{useState as e,useCallback as t,useEffect as n}from"react";let useI18n=()=>{let[r,a]=e(null),i=e=>{let t=e.detail;t&&a(t)},l=t(e=>r?r?.t(e):e,[r]);return n(()=>(window.addEventListener("editor:change-language",i),()=>{window.removeEventListener("editor:change-language",i)}),[]),{t:l}};export{useI18n};
|
|
@@ -1,123 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { colorPreset } from '../components/src/product/helpers/variant-presets.js';
|
|
4
|
-
import { useSwatches } from './shop.js';
|
|
5
|
-
import { useFetchHandle } from './useFetchHandle.js';
|
|
6
|
-
import { useShopStore } from '../contexts/ShopContext.js';
|
|
7
|
-
import 'react';
|
|
8
|
-
import 'react/jsx-runtime';
|
|
9
|
-
import 'zustand';
|
|
10
|
-
import '@gem-sdk/adapter-shopify';
|
|
11
|
-
import 'swr/mutation';
|
|
12
|
-
import 'swr/infinite';
|
|
13
|
-
import 'vanilla-lazyload';
|
|
14
|
-
import './useCartUI.js';
|
|
15
|
-
import 'react-transition-group';
|
|
16
|
-
import '@gem-sdk/core';
|
|
17
|
-
import 'classnames';
|
|
18
|
-
import 'dayjs';
|
|
19
|
-
import isBrowser from '../helpers/is-browser.js';
|
|
20
|
-
import '../helpers/convert.js';
|
|
21
|
-
|
|
22
|
-
let swatchChange = false;
|
|
23
|
-
let colorChange = false;
|
|
24
|
-
const useInitialSwatchesOptions = (options)=>{
|
|
25
|
-
const fetcher = useFetchHandle();
|
|
26
|
-
const changeSwatches = useShopStore((s)=>s.changeSwatches);
|
|
27
|
-
const { swatches } = useSwatches();
|
|
28
|
-
const { data: productOptionName } = useSWR([
|
|
29
|
-
'/query/productOptionName',
|
|
30
|
-
{}
|
|
31
|
-
], async ()=>fetchProductValueLabel(fetcher), {
|
|
32
|
-
revalidateOnMount: true
|
|
33
|
-
});
|
|
34
|
-
const swatchesTitleList = [];
|
|
35
|
-
swatches?.forEach((el)=>{
|
|
36
|
-
swatchesTitleList.push(el.optionTitle);
|
|
37
|
-
});
|
|
38
|
-
productOptionName?.productOptionName?.forEach((el)=>{
|
|
39
|
-
if (!swatchesTitleList.includes(el)) {
|
|
40
|
-
swatchChange = true;
|
|
41
|
-
swatches?.push({
|
|
42
|
-
optionTitle: el,
|
|
43
|
-
optionType: 'rectangle_list',
|
|
44
|
-
optionValues: []
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
if (!options) return [];
|
|
49
|
-
setDefaultSwatches(swatches, options);
|
|
50
|
-
if (isBrowser() && swatches?.length && (swatchChange || colorChange)) {
|
|
51
|
-
window?.parent?.postMessage?.(JSON.stringify({
|
|
52
|
-
type: 'update-swatches',
|
|
53
|
-
swatches
|
|
54
|
-
}), '*');
|
|
55
|
-
changeSwatches(swatches);
|
|
56
|
-
}
|
|
57
|
-
swatchChange = false;
|
|
58
|
-
};
|
|
59
|
-
const getColorDefault = (label, color)=>{
|
|
60
|
-
const colorByLabel = label ? colorPreset[label.toLocaleLowerCase()] : undefined;
|
|
61
|
-
const colorArray = colorByLabel ? [
|
|
62
|
-
colorByLabel
|
|
63
|
-
] : [];
|
|
64
|
-
const firstColor = color?.[0];
|
|
65
|
-
if (!firstColor && colorArray.length) colorChange = true;
|
|
66
|
-
return firstColor ? [
|
|
67
|
-
firstColor
|
|
68
|
-
] : colorArray;
|
|
69
|
-
};
|
|
70
|
-
const getProductOptionsLabelByName = (options, name)=>{
|
|
71
|
-
const labels = [];
|
|
72
|
-
const optionByName = options.find((op)=>op.name === name);
|
|
73
|
-
optionByName?.values.forEach((val)=>{
|
|
74
|
-
if (val.label && !labels.includes(val.label)) labels.push(val.label);
|
|
75
|
-
});
|
|
76
|
-
return labels;
|
|
77
|
-
};
|
|
78
|
-
const getSwatchesOptionsLabel = (options)=>{
|
|
79
|
-
const labels = [];
|
|
80
|
-
options.forEach((op)=>{
|
|
81
|
-
if (op.label && !labels.includes(op.label)) labels.push(op.label);
|
|
82
|
-
});
|
|
83
|
-
return labels;
|
|
84
|
-
};
|
|
85
|
-
const setDefaultSwatches = (swatches, options)=>{
|
|
86
|
-
if (swatches) {
|
|
87
|
-
swatches?.map((sw)=>{
|
|
88
|
-
const productLabels = getProductOptionsLabelByName(options, sw.optionTitle);
|
|
89
|
-
const swLabels = getSwatchesOptionsLabel(sw.optionValues);
|
|
90
|
-
productLabels.forEach((label)=>{
|
|
91
|
-
if (!swLabels.includes(label)) {
|
|
92
|
-
sw.optionValues.push({
|
|
93
|
-
label,
|
|
94
|
-
colors: getColorDefault(label),
|
|
95
|
-
imageUrl: ''
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
sw.optionValues = sw.optionValues.map((op)=>{
|
|
100
|
-
if (op.imageUrl === undefined) swatchChange = true;
|
|
101
|
-
return {
|
|
102
|
-
label: op.label ?? '',
|
|
103
|
-
colors: getColorDefault(op.label, op.colors),
|
|
104
|
-
imageUrl: op.imageUrl ?? ''
|
|
105
|
-
};
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
return swatches;
|
|
110
|
-
};
|
|
111
|
-
const fetchProductValueLabel = async (fetcher)=>{
|
|
112
|
-
const initVariables = {};
|
|
113
|
-
const query = async (variables)=>{
|
|
114
|
-
const response = await fetcher([
|
|
115
|
-
ProductOptionNameDocument,
|
|
116
|
-
variables
|
|
117
|
-
]);
|
|
118
|
-
return response;
|
|
119
|
-
};
|
|
120
|
-
return query(initVariables);
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
export { useInitialSwatchesOptions as default };
|
|
1
|
+
'use client';
|
|
2
|
+
import e from"swr";import{ProductOptionNameDocument as t}from"../graphql/queries/product-value-label.generated.js";import{colorPreset as o}from"../components/src/product/helpers/variant-presets.js";import{useSwatches as a}from"./shop.js";import{useFetchHandle as r}from"./useFetchHandle.js";import{useShopStore as s}from"../contexts/ShopContext.js";import"react";import"react/jsx-runtime";import"zustand";import"@gem-sdk/adapter-shopify";import"swr/mutation";import"swr/infinite";import"vanilla-lazyload";import"./useCartUI.js";import"./useStickyStore.js";import"react-transition-group";import"@gem-sdk/core";import"classnames";import"dayjs";import l from"../helpers/is-browser.js";import"../helpers/convert.js";let swatchChange=!1,colorChange=!1,useInitialSwatchesOptions=t=>{let o=r(),i=s(e=>e.changeSwatches),{swatches:n}=a(),{data:p}=e(["/query/productOptionName",{}],async()=>fetchProductValueLabel(o),{revalidateOnMount:!0}),c=[];if(n?.forEach(e=>{c.push(e.optionTitle)}),p?.productOptionName?.forEach(e=>{c.includes(e)||(swatchChange=!0,n?.push({optionTitle:e,optionType:"rectangle_list",optionValues:[]}))}),!t)return[];setDefaultSwatches(n,t),l()&&n?.length&&(swatchChange||colorChange)&&(window?.parent?.postMessage?.(JSON.stringify({type:"update-swatches",swatches:n}),"*"),i(n)),swatchChange=!1},getColorDefault=(e,t)=>{let a=e?o[e.toLocaleLowerCase()]:void 0,r=a?[a]:[],s=t?.[0];return!s&&r.length&&(colorChange=!0),s?[s]:r},getProductOptionsLabelByName=(e,t)=>{let o=[],a=e.find(e=>e.name===t);return a?.values.forEach(e=>{e.label&&!o.includes(e.label)&&o.push(e.label)}),o},getSwatchesOptionsLabel=e=>{let t=[];return e.forEach(e=>{e.label&&!t.includes(e.label)&&t.push(e.label)}),t},setDefaultSwatches=(e,t)=>(e&&e?.map(e=>{let o=getProductOptionsLabelByName(t,e.optionTitle),a=getSwatchesOptionsLabel(e.optionValues);o.forEach(t=>{a.includes(t)||e.optionValues.push({label:t,colors:getColorDefault(t),imageUrl:""})}),e.optionValues=e.optionValues.map(e=>(void 0===e.imageUrl&&(swatchChange=!0),{label:e.label??"",colors:getColorDefault(e.label,e.colors),imageUrl:e.imageUrl??""}))}),e),fetchProductValueLabel=async e=>{let o={},a=async o=>{let a=await e([t,o]);return a};return a(o)};export{useInitialSwatchesOptions as default};
|
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const useInteraction = ()=>{
|
|
4
|
-
const interactionData = usePageStore((state)=>state.interactionData);
|
|
5
|
-
const { item } = interactionData || {};
|
|
6
|
-
const getAnimationByUid = (uid)=>{
|
|
7
|
-
const targets = item?.targets;
|
|
8
|
-
const targetByUid = targets?.find((target)=>target.uid === uid);
|
|
9
|
-
const metaDataContainsAnimation = targetByUid?.events?.find((it)=>it.condition?.metaData?.animation);
|
|
10
|
-
return metaDataContainsAnimation?.condition?.metaData?.animation;
|
|
11
|
-
};
|
|
12
|
-
return {
|
|
13
|
-
getAnimationByUid
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export { useInteraction };
|
|
1
|
+
'use client';
|
|
2
|
+
import{usePageStore as t}from"../contexts/PageContext.js";let useInteraction=()=>{let n=t(t=>t.interactionData),{item:e}=n||{},a=t=>{let n=e?.targets,a=n?.find(n=>n.uid===t),i=a?.events?.find(t=>t.condition?.metaData?.animation);return i?.condition?.metaData?.animation};return{getAnimationByUid:a}};export{useInteraction};
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
// const isBrowser = typeof window !== 'undefined';
|
|
4
|
-
const useIsomorphicLayoutEffect = useLayoutEffect;
|
|
5
|
-
|
|
6
|
-
export { useIsomorphicLayoutEffect as default };
|
|
1
|
+
'use client';
|
|
2
|
+
import{useLayoutEffect as o}from"react";let useIsomorphicLayoutEffect=o;export{useIsomorphicLayoutEffect as default};
|
|
@@ -1,28 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* The `useLoadScript` hook loads an external script tag on the client-side.
|
|
6
|
-
*/ function useLoadScript(url, options) {
|
|
7
|
-
const [status, setStatus] = useState('loading');
|
|
8
|
-
const stringifiedOptions = JSON.stringify(options);
|
|
9
|
-
useEffect(()=>{
|
|
10
|
-
async function loadScriptWrapper() {
|
|
11
|
-
try {
|
|
12
|
-
setStatus('loading');
|
|
13
|
-
await loadScript(url, options);
|
|
14
|
-
setStatus('done');
|
|
15
|
-
} catch (error) {
|
|
16
|
-
setStatus('error');
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
loadScriptWrapper();
|
|
20
|
-
}, [
|
|
21
|
-
url,
|
|
22
|
-
stringifiedOptions,
|
|
23
|
-
options
|
|
24
|
-
]);
|
|
25
|
-
return status;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export { useLoadScript as default };
|
|
1
|
+
'use client';
|
|
2
|
+
import{useState as r,useEffect as t}from"react";import{loadScript as o}from"../helpers/load-script.js";function useLoadScript(a,i){let[e,n]=r("loading"),c=JSON.stringify(i);return t(()=>{(async function(){try{n("loading"),await o(a,i),n("done")}catch(r){n("error")}})()},[a,c,i]),e}export{useLoadScript as default};
|