@gem-sdk/core 2.0.0-dev.896 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/AddOn.js +18 -1
- package/dist/cjs/components/ComponentAnimation.js +17 -0
- package/dist/cjs/components/ComponentToolbarPreview.js +752 -1
- package/dist/cjs/components/ComponentWrapper.js +61 -1
- package/dist/cjs/components/ComponentWrapperPreview.js +213 -1
- package/dist/cjs/components/Empty.js +7 -1
- package/dist/cjs/components/InteractionSuffix.js +42 -0
- package/dist/cjs/components/Render.js +75 -1
- package/dist/cjs/components/Render.liquid.js +313 -17
- package/dist/cjs/components/RenderBlock.js +54 -1
- package/dist/cjs/components/RenderCustomCode.js +59 -3
- package/dist/cjs/components/RenderPreview.js +67 -1
- package/dist/cjs/components/RenderSection.js +23 -1
- package/dist/cjs/components/ai-generator/AIContentGenerator.js +252 -1
- package/dist/cjs/components/ai-generator/AIGenContentLoading.js +85 -1
- package/dist/cjs/components/ai-generator/components/PickProduct.js +220 -1
- package/dist/cjs/components/ai-generator/components/ToneAndVoice.js +77 -1
- package/dist/cjs/components/ai-generator/hooks/useCheckingProductInside.js +47 -0
- package/dist/cjs/components/ai-generator/hooks/useFlipPopup.js +110 -0
- package/dist/cjs/components/ai-generator/hooks/useGettingGenerateRequest.js +37 -1
- package/dist/cjs/components/ai-generator/hooks/useListenEventGenerate.js +70 -1
- package/dist/cjs/components/ai-generator/icons/AIIcon.js +67 -1
- package/dist/cjs/components/ai-generator/icons/CloseIcon.js +19 -1
- package/dist/cjs/components/ai-generator/icons/DropdownIcon.js +37 -1
- package/dist/cjs/components/ai-generator/icons/SearchIcon.js +21 -1
- package/dist/cjs/components/ai-generator/icons/ShowMoreIcon.js +21 -1
- package/dist/cjs/components/ai-generator/icons/UpgradeIcon.js +27 -0
- package/dist/cjs/components/ai-generator/icons/WarningIcon.js +31 -0
- package/dist/cjs/components/constant.js +83 -1
- package/dist/cjs/components/resize/Resize.js +16 -1
- package/dist/cjs/components/resize/Spacing.js +260 -1
- package/dist/cjs/components/src/product/helpers/variant-presets.js +56 -1
- package/dist/cjs/components/theme-section/CreateThemeSection.js +123 -1
- package/dist/cjs/components/theme-section/ThemeSectionStatus.js +45 -1
- package/dist/cjs/components/theme-section/ThemeSectionTooltip.js +126 -1
- package/dist/cjs/components/toolbar/Tooltip.js +28 -1
- package/dist/cjs/contexts/AddonContext.js +36 -1
- package/dist/cjs/contexts/ArticleContext.js +39 -1
- package/dist/cjs/contexts/ArticleListContext.js +31 -1
- package/dist/cjs/contexts/BuilderComponent.js +34 -1
- package/dist/cjs/contexts/BuilderContext.js +39 -1
- package/dist/cjs/contexts/BuilderPreviewContext.js +486 -1
- package/dist/cjs/contexts/CartLineContext.js +29 -1
- package/dist/cjs/contexts/CollectionContext.js +38 -1
- package/dist/cjs/contexts/ModalContext.js +47 -1
- package/dist/cjs/contexts/PageContext.js +104 -1
- package/dist/cjs/contexts/ProductContext.js +177 -1
- package/dist/cjs/contexts/ProductListContext.js +32 -1
- package/dist/cjs/contexts/SectionContext.js +53 -1
- package/dist/cjs/contexts/ShopContext.js +107 -1
- package/dist/cjs/graphql/fragments/analytic.generated.js +6 -2
- package/dist/cjs/graphql/fragments/collection-detail.generated.js +6 -2
- package/dist/cjs/graphql/fragments/collection-product.generated.js +6 -2
- package/dist/cjs/graphql/fragments/collection.generated.js +6 -2
- package/dist/cjs/graphql/fragments/custom-code.generated.js +6 -2
- package/dist/cjs/graphql/fragments/custom-font.generated.js +6 -2
- package/dist/cjs/graphql/fragments/data-seo.generated.js +6 -2
- package/dist/cjs/graphql/fragments/media.generated.js +6 -2
- package/dist/cjs/graphql/fragments/preview-theme-page.generated.js +39 -0
- package/dist/cjs/graphql/fragments/product-little.generated.js +7 -2
- package/dist/cjs/graphql/fragments/product-option-value.generated.js +6 -2
- package/dist/cjs/graphql/fragments/product-option.generated.js +6 -2
- package/dist/cjs/graphql/fragments/product.generated.js +6 -2
- package/dist/cjs/graphql/fragments/published-custom-section.generated.js +6 -2
- package/dist/cjs/graphql/fragments/published-page-section.generated.js +6 -2
- package/dist/cjs/graphql/fragments/published-theme-page.generated.js +10 -28
- package/dist/cjs/graphql/fragments/published-theme-style.generated.js +6 -2
- package/dist/cjs/graphql/fragments/selected-option.generated.js +6 -2
- package/dist/cjs/graphql/fragments/variant.generated.js +6 -2
- package/dist/cjs/graphql/mutations/page-view-up.generated.js +8 -4
- package/dist/cjs/graphql/queries/articles.generated.js +61 -0
- package/dist/cjs/graphql/queries/blogs.generated.js +69 -0
- package/dist/cjs/graphql/queries/collection-detail-filter.generated.js +16 -2
- package/dist/cjs/graphql/queries/collection.generated.js +14 -2
- package/dist/cjs/graphql/queries/collections.generated.js +9 -2
- package/dist/cjs/graphql/queries/preview-page.generated.js +16 -8
- package/dist/cjs/graphql/queries/product-little-detail.generated.js +11 -2
- package/dist/cjs/graphql/queries/product-medias.generated.js +8 -2
- package/dist/cjs/graphql/queries/product-value-label.generated.js +6 -2
- package/dist/cjs/graphql/queries/product-variants.generated.js +10 -2
- package/dist/cjs/graphql/queries/products.generated.js +17 -3
- package/dist/cjs/graphql/queries/published-shop-metas.js +15 -0
- package/dist/cjs/graphql/queries/published-theme-pages.generated.js +15 -2
- package/dist/cjs/graphql/queries/store-property.generated.js +6 -2
- package/dist/cjs/graphql-app-api/queries/LibrarySaleFunnelDiscount.generated.js +6 -2
- package/dist/cjs/graphql-app-api/queries/LibraryTemplate.generated.js +6 -2
- package/dist/cjs/graphql-app-api/queries/SaleFunnelDiscounts.generated.js +6 -2
- package/dist/cjs/graphql-app-api/queries/ShopLibraryPage.generated.js +17 -0
- package/dist/cjs/graphql-app-api/queries/ThemePage.generated.js +6 -2
- package/dist/cjs/helpers/GlobalEvent.js +19 -1
- package/dist/cjs/helpers/align.js +19 -0
- package/dist/cjs/helpers/animations.js +222 -1
- package/dist/cjs/helpers/background.js +235 -1
- package/dist/cjs/helpers/borders.js +198 -4
- package/dist/cjs/helpers/carousel.js +55 -1
- package/dist/cjs/helpers/clone-deep.js +5 -1
- package/dist/cjs/helpers/cls.js +16 -1
- package/dist/cjs/helpers/colors.js +184 -1
- package/dist/cjs/helpers/compose-advance-style.js +327 -1
- package/dist/cjs/helpers/constant.js +23 -1
- package/dist/cjs/helpers/convert.js +7 -1
- package/dist/cjs/helpers/covert-entities-html.js +19 -1
- package/dist/cjs/helpers/css-variable.js +7 -1
- package/dist/cjs/helpers/email.js +11 -1
- package/dist/cjs/helpers/filter-toolbar-preview.js +14 -1
- package/dist/cjs/helpers/flatten-connection.js +9 -1
- package/dist/cjs/helpers/get-resonsive-value.js +36 -1
- package/dist/cjs/helpers/get-shortname.js +92 -1
- package/dist/cjs/helpers/icon-list.js +61 -1
- package/dist/cjs/helpers/interaction/index.js +134 -0
- package/dist/cjs/helpers/is-browser.js +9 -1
- package/dist/cjs/helpers/is-defined.js +7 -1
- package/dist/cjs/helpers/is-empty-children.js +15 -1
- package/dist/cjs/helpers/is-safari.js +9 -1
- package/dist/cjs/helpers/layout.js +59 -1
- package/dist/cjs/helpers/load-script.js +31 -1
- package/dist/cjs/helpers/loop-component.js +16 -0
- package/dist/cjs/helpers/make-style.js +163 -1
- package/dist/cjs/helpers/normalize-builder-data.js +23 -1
- package/dist/cjs/helpers/pascal-to-kebab-case.js +7 -0
- package/dist/cjs/helpers/prefetch-queries.js +78 -1
- package/dist/cjs/helpers/product.js +48 -1
- package/dist/cjs/helpers/queries/get-collection.js +226 -1
- package/dist/cjs/helpers/queries/get-collections.js +21 -1
- package/dist/cjs/helpers/queries/get-product-by-slug.js +125 -1
- package/dist/cjs/helpers/queries/get-product.js +154 -1
- package/dist/cjs/helpers/queries/get-products.js +214 -1
- package/dist/cjs/helpers/query.js +29 -1
- package/dist/cjs/helpers/radius.js +140 -6
- package/dist/cjs/helpers/render.js +78 -1
- package/dist/cjs/helpers/shadow.js +69 -1
- package/dist/cjs/helpers/size.js +206 -4
- package/dist/cjs/helpers/spacing.js +43 -1
- package/dist/cjs/helpers/third-party/addAppBlockId.js +20 -0
- package/dist/cjs/helpers/third-party/appConfig.js +234 -0
- package/dist/cjs/helpers/third-party/appSetting.js +661 -0
- package/dist/cjs/helpers/third-party/composeAppBlockId.js +11 -0
- package/dist/cjs/helpers/third-party/constant.js +43 -0
- package/dist/cjs/helpers/third-party/generateAppBlockConfigs.js +34 -0
- package/dist/cjs/helpers/third-party/getAppBlockConfig.js +47 -0
- package/dist/cjs/helpers/third-party/getAppBlockType.js +12 -0
- package/dist/cjs/helpers/third-party/getAppBlocks.js +30 -0
- package/dist/cjs/helpers/third-party/mergeBlock.js +19 -0
- package/dist/cjs/helpers/third-party/mergeBlockOrder.js +47 -0
- package/dist/cjs/helpers/third-party/removeGPAppItems.js +18 -0
- package/dist/cjs/helpers/tracking/fpixel.js +28 -1
- package/dist/cjs/helpers/tracking/gtag.js +93 -1
- package/dist/cjs/helpers/tracking/tiktokpixel.js +17 -1
- package/dist/cjs/helpers/typography.js +160 -17
- package/dist/cjs/helpers/variant.js +11 -1
- package/dist/cjs/hooks/animation/useAnimationActions.js +39 -1
- package/dist/cjs/hooks/animation/useAnimationConfig.js +30 -1
- package/dist/cjs/hooks/animation/useAnimationPreview.js +31 -1
- package/dist/cjs/hooks/animation/useAnimationTarget.js +122 -1
- package/dist/cjs/hooks/animation/useApplyAnimation.js +89 -1
- package/dist/cjs/hooks/articles/useArticlesQuery.js +33 -1
- package/dist/cjs/hooks/cart/use-add-to-cart.js +20 -1
- package/dist/cjs/hooks/cart/use-cart-data.js +28 -1
- package/dist/cjs/hooks/cart/use-cart-discount-codes-update.js +20 -1
- package/dist/cjs/hooks/cart/use-cart-note-update.js +20 -1
- package/dist/cjs/hooks/cart/use-create-cart.js +22 -1
- package/dist/cjs/hooks/cart/use-remove-cart-item.js +20 -1
- package/dist/cjs/hooks/cart/use-update-cart-item.js +20 -1
- package/dist/cjs/hooks/shop/use-collection-query.js +22 -1
- package/dist/cjs/hooks/shop/use-collections-query.js +17 -1
- package/dist/cjs/hooks/shop/use-product-query.js +22 -1
- package/dist/cjs/hooks/shop/use-products-query.js +63 -1
- package/dist/cjs/hooks/shop.js +126 -1
- package/dist/cjs/hooks/use-current-device.js +30 -1
- package/dist/cjs/hooks/use-lazy-video.js +15 -1
- package/dist/cjs/hooks/useAnimations.js +29 -1
- package/dist/cjs/hooks/useCartId.js +44 -1
- package/dist/cjs/hooks/useCartLine.js +11 -1
- package/dist/cjs/hooks/useCartUI.js +48 -1
- package/dist/cjs/hooks/useCollection.js +9 -1
- package/dist/cjs/hooks/useFetchHandle.js +13 -1
- package/dist/cjs/hooks/useFormatMoney.js +75 -1
- package/dist/cjs/hooks/useInitialSwatchesOptions.js +128 -1
- package/dist/cjs/hooks/useInteraction.js +19 -0
- package/dist/cjs/hooks/useIsomorphicLayoutEffect.js +10 -1
- package/dist/cjs/hooks/useLoadScript.js +32 -1
- package/dist/cjs/hooks/useMoney.js +84 -1
- package/dist/cjs/hooks/usePrevious.js +19 -1
- package/dist/cjs/hooks/useProduct.js +245 -1
- package/dist/cjs/hooks/useProductList.js +21 -1
- package/dist/cjs/hooks/useSuspenseFetch.js +27 -1
- package/dist/cjs/hooks/useSwatchesOptions.js +41 -1
- package/dist/cjs/hooks/useToolbarPostPurchase.js +89 -1
- package/dist/cjs/index.js +416 -1
- package/dist/cjs/types/animations.js +49 -1
- package/dist/cjs/types/appAPI.js +2 -1
- package/dist/cjs/types/custom.js +52 -0
- package/dist/cjs/types/global-style.js +15 -1
- package/dist/cjs/types/shop.js +2 -1
- package/dist/cjs/web-components/src/helpers/styles/constant.js +9 -1
- package/dist/esm/components/AddOn.js +14 -1
- package/dist/esm/components/ComponentAnimation.js +13 -0
- package/dist/esm/components/ComponentToolbarPreview.js +748 -1
- package/dist/esm/components/ComponentWrapper.js +57 -1
- package/dist/esm/components/ComponentWrapperPreview.js +209 -1
- package/dist/esm/components/Empty.js +3 -1
- package/dist/esm/components/InteractionSuffix.js +40 -0
- package/dist/esm/components/Render.js +71 -1
- package/dist/esm/components/Render.liquid.js +307 -17
- package/dist/esm/components/RenderBlock.js +50 -1
- package/dist/esm/components/RenderCustomCode.js +55 -3
- package/dist/esm/components/RenderPreview.js +63 -1
- package/dist/esm/components/RenderSection.js +19 -1
- package/dist/esm/components/ai-generator/AIContentGenerator.js +250 -1
- package/dist/esm/components/ai-generator/AIGenContentLoading.js +83 -1
- package/dist/esm/components/ai-generator/components/PickProduct.js +218 -1
- package/dist/esm/components/ai-generator/components/ToneAndVoice.js +75 -1
- package/dist/esm/components/ai-generator/hooks/useCheckingProductInside.js +45 -0
- package/dist/esm/components/ai-generator/hooks/useFlipPopup.js +108 -0
- package/dist/esm/components/ai-generator/hooks/useGettingGenerateRequest.js +35 -1
- package/dist/esm/components/ai-generator/hooks/useListenEventGenerate.js +68 -1
- package/dist/esm/components/ai-generator/icons/AIIcon.js +65 -1
- package/dist/esm/components/ai-generator/icons/CloseIcon.js +17 -1
- package/dist/esm/components/ai-generator/icons/DropdownIcon.js +34 -1
- package/dist/esm/components/ai-generator/icons/SearchIcon.js +19 -1
- package/dist/esm/components/ai-generator/icons/ShowMoreIcon.js +19 -1
- package/dist/esm/components/ai-generator/icons/UpgradeIcon.js +25 -0
- package/dist/esm/components/ai-generator/icons/WarningIcon.js +29 -0
- package/dist/esm/components/constant.js +76 -1
- package/dist/esm/components/resize/Resize.js +12 -1
- package/dist/esm/components/resize/Spacing.js +256 -1
- package/dist/esm/components/src/product/helpers/variant-presets.js +54 -1
- package/dist/esm/components/theme-section/CreateThemeSection.js +121 -1
- package/dist/esm/components/theme-section/ThemeSectionStatus.js +43 -1
- package/dist/esm/components/theme-section/ThemeSectionTooltip.js +124 -1
- package/dist/esm/components/toolbar/Tooltip.js +24 -1
- package/dist/esm/contexts/AddonContext.js +32 -1
- package/dist/esm/contexts/ArticleContext.js +36 -1
- package/dist/esm/contexts/ArticleListContext.js +27 -1
- package/dist/esm/contexts/BuilderComponent.js +31 -1
- package/dist/esm/contexts/BuilderContext.js +36 -1
- package/dist/esm/contexts/BuilderPreviewContext.js +483 -1
- package/dist/esm/contexts/CartLineContext.js +26 -1
- package/dist/esm/contexts/CollectionContext.js +35 -1
- package/dist/esm/contexts/ModalContext.js +44 -1
- package/dist/esm/contexts/PageContext.js +101 -1
- package/dist/esm/contexts/ProductContext.js +174 -1
- package/dist/esm/contexts/ProductListContext.js +28 -1
- package/dist/esm/contexts/SectionContext.js +49 -1
- package/dist/esm/contexts/ShopContext.js +104 -1
- package/dist/esm/graphql/fragments/analytic.generated.js +4 -2
- package/dist/esm/graphql/fragments/collection-detail.generated.js +4 -2
- package/dist/esm/graphql/fragments/collection-product.generated.js +4 -2
- package/dist/esm/graphql/fragments/collection.generated.js +4 -2
- package/dist/esm/graphql/fragments/custom-code.generated.js +4 -2
- package/dist/esm/graphql/fragments/custom-font.generated.js +4 -2
- package/dist/esm/graphql/fragments/data-seo.generated.js +4 -2
- package/dist/esm/graphql/fragments/media.generated.js +4 -2
- package/dist/esm/graphql/fragments/preview-theme-page.generated.js +37 -0
- package/dist/esm/graphql/fragments/product-little.generated.js +5 -2
- package/dist/esm/graphql/fragments/product-option-value.generated.js +4 -2
- package/dist/esm/graphql/fragments/product-option.generated.js +4 -2
- package/dist/esm/graphql/fragments/product.generated.js +4 -2
- package/dist/esm/graphql/fragments/published-custom-section.generated.js +4 -2
- package/dist/esm/graphql/fragments/published-page-section.generated.js +4 -2
- package/dist/esm/graphql/fragments/published-theme-page.generated.js +8 -28
- package/dist/esm/graphql/fragments/published-theme-style.generated.js +4 -2
- package/dist/esm/graphql/fragments/selected-option.generated.js +4 -2
- package/dist/esm/graphql/fragments/variant.generated.js +4 -2
- package/dist/esm/graphql/mutations/page-view-up.generated.js +6 -4
- package/dist/esm/graphql/queries/articles.generated.js +59 -0
- package/dist/esm/graphql/queries/blogs.generated.js +67 -0
- package/dist/esm/graphql/queries/collection-detail-filter.generated.js +22 -10
- package/dist/esm/graphql/queries/collection.generated.js +18 -8
- package/dist/esm/graphql/queries/collections.generated.js +8 -3
- package/dist/esm/graphql/queries/preview-page.generated.js +16 -10
- package/dist/esm/graphql/queries/product-little-detail.generated.js +12 -5
- package/dist/esm/graphql/queries/product-medias.generated.js +6 -2
- package/dist/esm/graphql/queries/product-value-label.generated.js +4 -2
- package/dist/esm/graphql/queries/product-variants.generated.js +10 -4
- package/dist/esm/graphql/queries/products.generated.js +20 -9
- package/dist/esm/graphql/queries/published-shop-metas.js +13 -0
- package/dist/esm/graphql/queries/published-theme-pages.generated.js +20 -9
- package/dist/esm/graphql/queries/store-property.generated.js +4 -2
- package/dist/esm/graphql-app-api/queries/LibrarySaleFunnelDiscount.generated.js +4 -2
- package/dist/esm/graphql-app-api/queries/LibraryTemplate.generated.js +4 -2
- package/dist/esm/graphql-app-api/queries/SaleFunnelDiscounts.generated.js +4 -2
- package/dist/esm/graphql-app-api/queries/ShopLibraryPage.generated.js +15 -0
- package/dist/esm/graphql-app-api/queries/ThemePage.generated.js +4 -2
- package/dist/esm/helpers/GlobalEvent.js +15 -1
- package/dist/esm/helpers/align.js +17 -0
- package/dist/esm/helpers/animations.js +220 -1
- package/dist/esm/helpers/background.js +226 -1
- package/dist/esm/helpers/borders.js +189 -4
- package/dist/esm/helpers/carousel.js +51 -1
- package/dist/esm/helpers/clone-deep.js +3 -1
- package/dist/esm/helpers/cls.js +14 -1
- package/dist/esm/helpers/colors.js +169 -1
- package/dist/esm/helpers/compose-advance-style.js +319 -1
- package/dist/esm/helpers/constant.js +19 -1
- package/dist/esm/helpers/convert.js +4 -1
- package/dist/esm/helpers/covert-entities-html.js +17 -1
- package/dist/esm/helpers/css-variable.js +5 -1
- package/dist/esm/helpers/email.js +6 -1
- package/dist/esm/helpers/filter-toolbar-preview.js +9 -1
- package/dist/esm/helpers/flatten-connection.js +7 -1
- package/dist/esm/helpers/get-resonsive-value.js +31 -1
- package/dist/esm/helpers/get-shortname.js +90 -1
- package/dist/esm/helpers/icon-list.js +58 -1
- package/dist/esm/helpers/interaction/index.js +132 -0
- package/dist/esm/helpers/is-browser.js +5 -1
- package/dist/esm/helpers/is-defined.js +5 -1
- package/dist/esm/helpers/is-empty-children.js +10 -1
- package/dist/esm/helpers/is-safari.js +5 -1
- package/dist/esm/helpers/layout.js +54 -1
- package/dist/esm/helpers/load-script.js +29 -1
- package/dist/esm/helpers/loop-component.js +14 -0
- package/dist/esm/helpers/make-style.js +149 -1
- package/dist/esm/helpers/normalize-builder-data.js +21 -1
- package/dist/esm/helpers/pascal-to-kebab-case.js +5 -0
- package/dist/esm/helpers/prefetch-queries.js +76 -1
- package/dist/esm/helpers/product.js +44 -1
- package/dist/esm/helpers/queries/get-collection.js +223 -1
- package/dist/esm/helpers/queries/get-collections.js +19 -1
- package/dist/esm/helpers/queries/get-product-by-slug.js +123 -1
- package/dist/esm/helpers/queries/get-product.js +150 -1
- package/dist/esm/helpers/queries/get-products.js +210 -1
- package/dist/esm/helpers/query.js +25 -1
- package/dist/esm/helpers/radius.js +132 -6
- package/dist/esm/helpers/render.js +70 -1
- package/dist/esm/helpers/shadow.js +63 -1
- package/dist/esm/helpers/size.js +192 -4
- package/dist/esm/helpers/spacing.js +40 -1
- package/dist/esm/helpers/third-party/addAppBlockId.js +18 -0
- package/dist/esm/helpers/third-party/appConfig.js +200 -0
- package/dist/esm/helpers/third-party/appSetting.js +658 -0
- package/dist/esm/helpers/third-party/composeAppBlockId.js +9 -0
- package/dist/esm/helpers/third-party/constant.js +40 -0
- package/dist/esm/helpers/third-party/generateAppBlockConfigs.js +32 -0
- package/dist/esm/helpers/third-party/getAppBlockConfig.js +45 -0
- package/dist/esm/helpers/third-party/getAppBlockType.js +10 -0
- package/dist/esm/helpers/third-party/getAppBlocks.js +28 -0
- package/dist/esm/helpers/third-party/mergeBlock.js +17 -0
- package/dist/esm/helpers/third-party/mergeBlockOrder.js +45 -0
- package/dist/esm/helpers/third-party/removeGPAppItems.js +15 -0
- package/dist/esm/helpers/tracking/fpixel.js +24 -1
- package/dist/esm/helpers/tracking/gtag.js +87 -1
- package/dist/esm/helpers/tracking/tiktokpixel.js +15 -1
- package/dist/esm/helpers/typography.js +149 -17
- package/dist/esm/helpers/variant.js +9 -1
- package/dist/esm/hooks/animation/useAnimationActions.js +37 -1
- package/dist/esm/hooks/animation/useAnimationConfig.js +28 -1
- package/dist/esm/hooks/animation/useAnimationPreview.js +29 -1
- package/dist/esm/hooks/animation/useAnimationTarget.js +120 -1
- package/dist/esm/hooks/animation/useApplyAnimation.js +85 -1
- package/dist/esm/hooks/articles/useArticlesQuery.js +30 -1
- package/dist/esm/hooks/cart/use-add-to-cart.js +18 -1
- package/dist/esm/hooks/cart/use-cart-data.js +26 -1
- package/dist/esm/hooks/cart/use-cart-discount-codes-update.js +18 -1
- package/dist/esm/hooks/cart/use-cart-note-update.js +18 -1
- package/dist/esm/hooks/cart/use-create-cart.js +20 -1
- package/dist/esm/hooks/cart/use-remove-cart-item.js +18 -1
- package/dist/esm/hooks/cart/use-update-cart-item.js +18 -1
- package/dist/esm/hooks/shop/use-collection-query.js +20 -1
- package/dist/esm/hooks/shop/use-collections-query.js +15 -1
- package/dist/esm/hooks/shop/use-product-query.js +20 -1
- package/dist/esm/hooks/shop/use-products-query.js +59 -1
- package/dist/esm/hooks/shop.js +111 -1
- package/dist/esm/hooks/use-current-device.js +28 -1
- package/dist/esm/hooks/use-lazy-video.js +13 -1
- package/dist/esm/hooks/useAnimations.js +27 -1
- package/dist/esm/hooks/useCartId.js +40 -1
- package/dist/esm/hooks/useCartLine.js +7 -1
- package/dist/esm/hooks/useCartUI.js +44 -1
- package/dist/esm/hooks/useCollection.js +7 -1
- package/dist/esm/hooks/useFetchHandle.js +11 -1
- package/dist/esm/hooks/useFormatMoney.js +71 -1
- package/dist/esm/hooks/useInitialSwatchesOptions.js +124 -1
- package/dist/esm/hooks/useInteraction.js +17 -0
- package/dist/esm/hooks/useIsomorphicLayoutEffect.js +6 -1
- package/dist/esm/hooks/useLoadScript.js +28 -1
- package/dist/esm/hooks/useMoney.js +80 -1
- package/dist/esm/hooks/usePrevious.js +17 -1
- package/dist/esm/hooks/useProduct.js +228 -1
- package/dist/esm/hooks/useProductList.js +16 -1
- package/dist/esm/hooks/useSuspenseFetch.js +23 -1
- package/dist/esm/hooks/useSwatchesOptions.js +37 -1
- package/dist/esm/hooks/useToolbarPostPurchase.js +87 -1
- package/dist/esm/index.js +117 -1
- package/dist/esm/types/animations.js +49 -1
- package/dist/esm/types/custom.js +52 -0
- package/dist/esm/types/global-style.js +12 -1
- package/dist/esm/web-components/src/helpers/styles/constant.js +7 -1
- package/dist/types/index.d.ts +23183 -17335
- package/package.json +5 -3
- package/dist/cjs/components/animation/AnimationWrapper.js +0 -1
- package/dist/cjs/hooks/animation/animations.js +0 -1
- package/dist/cjs/hooks/animation/useLivePageAnimation.js +0 -1
- package/dist/esm/components/animation/AnimationWrapper.js +0 -1
- package/dist/esm/hooks/animation/animations.js +0 -1
- package/dist/esm/hooks/animation/useLivePageAnimation.js +0 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { loopComponent } from '../loop-component.js';
|
|
2
|
+
import { getAppBlockConfig } from './getAppBlockConfig.js';
|
|
3
|
+
|
|
4
|
+
const generateAppBlockConfigs = (component)=>{
|
|
5
|
+
const strComponent = JSON.stringify(component) || '';
|
|
6
|
+
if (!strComponent.includes('appBlockId')) return null;
|
|
7
|
+
const configs = [];
|
|
8
|
+
loopComponent(component, (component)=>{
|
|
9
|
+
const settings = component.settings || {};
|
|
10
|
+
const appBlockId = settings?.appBlockId || '';
|
|
11
|
+
if (!appBlockId) return;
|
|
12
|
+
const config = getAppBlockConfig(component.tag, appBlockId, settings);
|
|
13
|
+
if (!config) return;
|
|
14
|
+
configs.push(config);
|
|
15
|
+
});
|
|
16
|
+
if (!configs.length) return null;
|
|
17
|
+
return {
|
|
18
|
+
newBlocks: extractBlocks(configs),
|
|
19
|
+
newBlockOrder: extractBlockOrder(configs)
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
function extractBlocks(array) {
|
|
23
|
+
return array.reduce((acc, item)=>{
|
|
24
|
+
acc[item.key] = item.value;
|
|
25
|
+
return acc;
|
|
26
|
+
}, {});
|
|
27
|
+
}
|
|
28
|
+
function extractBlockOrder(array) {
|
|
29
|
+
return array.map((item)=>item.key);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { generateAppBlockConfigs };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { composeSettingsByWidgetType, overrideSettings } from './appSetting.js';
|
|
2
|
+
import { getAppBlockType } from './getAppBlockType.js';
|
|
3
|
+
|
|
4
|
+
const listAppUpdateNewVersion = [
|
|
5
|
+
'Growave',
|
|
6
|
+
'Trustoo',
|
|
7
|
+
'LooxReviews'
|
|
8
|
+
];
|
|
9
|
+
const listThirdPartyRejectAppBlock = {
|
|
10
|
+
YotpoReviews: {
|
|
11
|
+
conditionToReject: 'settings?.version === "v1"'
|
|
12
|
+
},
|
|
13
|
+
Trustoo: {
|
|
14
|
+
conditionToReject: 'settings?.version === "v1"'
|
|
15
|
+
},
|
|
16
|
+
LooxReviews: {
|
|
17
|
+
conditionToReject: 'settings?.version === "v1"'
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const getAppBlockConfig = (tag, appBlockId, settings)=>{
|
|
21
|
+
if (listThirdPartyRejectAppBlock[tag] && eval(listThirdPartyRejectAppBlock[tag]?.conditionToReject ?? '')) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
let widgetType = settings?.widgetType;
|
|
25
|
+
if (listAppUpdateNewVersion.includes(tag)) {
|
|
26
|
+
widgetType = settings?.widgetTypeV2;
|
|
27
|
+
}
|
|
28
|
+
const appBlockType = getAppBlockType({
|
|
29
|
+
tag,
|
|
30
|
+
widgetType
|
|
31
|
+
});
|
|
32
|
+
const settingByWidget = composeSettingsByWidgetType[tag][settings?.widgetType];
|
|
33
|
+
const appSettings = overrideSettings(tag, settingByWidget, settings);
|
|
34
|
+
return {
|
|
35
|
+
key: appBlockId,
|
|
36
|
+
value: {
|
|
37
|
+
type: appBlockType,
|
|
38
|
+
...settingByWidget && {
|
|
39
|
+
settings: appSettings
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export { getAppBlockConfig };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { mapShopifyAppMeta } from './constant.js';
|
|
2
|
+
|
|
3
|
+
const getAppBlockType = ({ tag, widgetType })=>{
|
|
4
|
+
const shopifyAppMeta = mapShopifyAppMeta[tag];
|
|
5
|
+
if (!shopifyAppMeta) return '';
|
|
6
|
+
const { appName, appId } = shopifyAppMeta;
|
|
7
|
+
return `shopify://apps/${appName}/blocks/${widgetType}/${appId}`;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { getAppBlockType };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { addAppBlockId } from './addAppBlockId.js';
|
|
2
|
+
import { generateAppBlockConfigs } from './generateAppBlockConfigs.js';
|
|
3
|
+
import { mergeBlocks } from './mergeBlock.js';
|
|
4
|
+
import { mergeBlockOrder } from './mergeBlockOrder.js';
|
|
5
|
+
import { removeAllGPAppItemsFromBlocks, removeAllGPAppItemsFromBlockOrder } from './removeGPAppItems.js';
|
|
6
|
+
|
|
7
|
+
const getAppBlocks = (section)=>{
|
|
8
|
+
const { blocks: currentBlock, block_order: currentBlockOrder } = JSON.parse(section?.appBlocks || '{}');
|
|
9
|
+
const component = JSON.parse(section?.component || '');
|
|
10
|
+
const componentWithAppBlockId = addAppBlockId(component);
|
|
11
|
+
const appBlockConfigs = generateAppBlockConfigs(componentWithAppBlockId);
|
|
12
|
+
if (!appBlockConfigs) {
|
|
13
|
+
if (!currentBlock || !currentBlockOrder) return {};
|
|
14
|
+
return {
|
|
15
|
+
blocks: removeAllGPAppItemsFromBlocks(currentBlock),
|
|
16
|
+
block_order: removeAllGPAppItemsFromBlockOrder(currentBlockOrder)
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
const { newBlocks, newBlockOrder } = appBlockConfigs;
|
|
20
|
+
const blocks = mergeBlocks(newBlocks, currentBlock);
|
|
21
|
+
const block_order = mergeBlockOrder(newBlockOrder, currentBlockOrder);
|
|
22
|
+
return {
|
|
23
|
+
blocks,
|
|
24
|
+
block_order
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { getAppBlocks };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
function mergeBlocks(newBlocks, blocks) {
|
|
2
|
+
if (!blocks) return newBlocks;
|
|
3
|
+
const result = {};
|
|
4
|
+
// Add all non-gp_app blocks from the original blocks
|
|
5
|
+
for (const [key, value] of Object.entries(blocks)){
|
|
6
|
+
if (!key.startsWith('gp_app')) {
|
|
7
|
+
result[key] = value;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
// Add all blocks from new-blocks
|
|
11
|
+
for (const [key, value] of Object.entries(newBlocks)){
|
|
12
|
+
result[key] = value;
|
|
13
|
+
}
|
|
14
|
+
return result;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { mergeBlocks };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { THIRD_PARTY_APP_BLOCK_ID_PREFIX } from './constant.js';
|
|
2
|
+
|
|
3
|
+
function isGpAppItem(item) {
|
|
4
|
+
if (!item) return false;
|
|
5
|
+
return item.startsWith(THIRD_PARTY_APP_BLOCK_ID_PREFIX);
|
|
6
|
+
}
|
|
7
|
+
function filterCurrentOrder(currentOrder, newOrderSet) {
|
|
8
|
+
return currentOrder.filter((item)=>!isGpAppItem(item) || newOrderSet.has(item));
|
|
9
|
+
}
|
|
10
|
+
function processNonGpAppItem(item, resultOrder) {
|
|
11
|
+
resultOrder.push(item);
|
|
12
|
+
}
|
|
13
|
+
function processGpAppItems(newOrder, newOrderIndex, resultOrder) {
|
|
14
|
+
while(newOrderIndex < newOrder.length && isGpAppItem(newOrder[newOrderIndex])){
|
|
15
|
+
resultOrder.push(newOrder[newOrderIndex]);
|
|
16
|
+
newOrderIndex++;
|
|
17
|
+
}
|
|
18
|
+
return newOrderIndex;
|
|
19
|
+
}
|
|
20
|
+
function addRemainingGpAppItems(newOrder, startIndex, resultOrder) {
|
|
21
|
+
for(let i = startIndex; i < newOrder.length; i++){
|
|
22
|
+
const item = newOrder[i];
|
|
23
|
+
if (item && isGpAppItem(item)) {
|
|
24
|
+
resultOrder.push(item);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function mergeBlockOrder(newOrder, currentOrder) {
|
|
29
|
+
if (!currentOrder) return newOrder;
|
|
30
|
+
const newOrderSet = new Set(newOrder);
|
|
31
|
+
const filteredCurrentOrder = filterCurrentOrder(currentOrder, newOrderSet);
|
|
32
|
+
const resultOrder = [];
|
|
33
|
+
let newOrderIndex = 0;
|
|
34
|
+
filteredCurrentOrder.forEach((item)=>{
|
|
35
|
+
if (!isGpAppItem(item)) {
|
|
36
|
+
processNonGpAppItem(item, resultOrder);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
newOrderIndex = processGpAppItems(newOrder, newOrderIndex, resultOrder);
|
|
40
|
+
});
|
|
41
|
+
addRemainingGpAppItems(newOrder, newOrderIndex, resultOrder);
|
|
42
|
+
return resultOrder;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { mergeBlockOrder };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { THIRD_PARTY_APP_BLOCK_ID_PREFIX } from './constant.js';
|
|
2
|
+
|
|
3
|
+
const removeAllGPAppItemsFromBlocks = (blocks)=>{
|
|
4
|
+
for(const key in blocks){
|
|
5
|
+
if (key.startsWith(THIRD_PARTY_APP_BLOCK_ID_PREFIX)) {
|
|
6
|
+
delete blocks[key];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return blocks;
|
|
10
|
+
};
|
|
11
|
+
const removeAllGPAppItemsFromBlockOrder = (blockOrder)=>{
|
|
12
|
+
return blockOrder.filter((item)=>!item.includes(THIRD_PARTY_APP_BLOCK_ID_PREFIX));
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { removeAllGPAppItemsFromBlockOrder, removeAllGPAppItemsFromBlocks };
|
|
@@ -1 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
const pageview = ()=>{
|
|
2
|
+
if (!window.fbq) return;
|
|
3
|
+
window.fbq('track', 'PageView');
|
|
4
|
+
};
|
|
5
|
+
// https://developers.facebook.com/docs/facebook-pixel/advanced/
|
|
6
|
+
const event = (name, options = {})=>{
|
|
7
|
+
if (!window.fbq) return;
|
|
8
|
+
window.fbq('track', name, options);
|
|
9
|
+
};
|
|
10
|
+
const addToCart = (product)=>{
|
|
11
|
+
if (!window.fbq) return;
|
|
12
|
+
window.fbq('track', 'AddToCart', {
|
|
13
|
+
content_ids: [
|
|
14
|
+
product.id
|
|
15
|
+
],
|
|
16
|
+
content_name: product.name,
|
|
17
|
+
content_category: product.category,
|
|
18
|
+
content_type: 'product',
|
|
19
|
+
value: product.price,
|
|
20
|
+
currency: product.currency
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { addToCart, event, pageview };
|
|
@@ -1 +1,87 @@
|
|
|
1
|
-
|
|
1
|
+
// https://developers.google.com/analytics/devguides/collection/gtagjs/pages
|
|
2
|
+
const pageview = (url, trackingId)=>{
|
|
3
|
+
// GA 4
|
|
4
|
+
if (window.gtag && trackingId) {
|
|
5
|
+
window.gtag('config', trackingId, {
|
|
6
|
+
page_path: url
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
// GA 3
|
|
10
|
+
if (window.ga) {
|
|
11
|
+
window.ga('send', 'pageview', url);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
/** Addition to cart events
|
|
15
|
+
* https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#add-remove-cart
|
|
16
|
+
*/ const addToCart = (product)=>{
|
|
17
|
+
// GA 3
|
|
18
|
+
if (!window.ga || !product) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
window.ga('ec:addProduct', {
|
|
22
|
+
...product,
|
|
23
|
+
id: product.sku,
|
|
24
|
+
name: product.variant === 'Default Title' ? product.name : `${product.name} - ${product.variant}`,
|
|
25
|
+
variant: product.variant === 'Default Title' ? product.name : product.variant
|
|
26
|
+
});
|
|
27
|
+
window.ga('ec:setAction', 'add');
|
|
28
|
+
window.ga('send', 'event', {
|
|
29
|
+
eventCategory: 'EnhancedEcommerce',
|
|
30
|
+
eventAction: 'Added Product',
|
|
31
|
+
nonInteraction: true
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
/** Product clicked event
|
|
35
|
+
* https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#product-click
|
|
36
|
+
*/ const productClick = (product)=>{
|
|
37
|
+
if (!window.ga) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
ga('ec:addProduct', {
|
|
41
|
+
id: product.id,
|
|
42
|
+
name: product.name,
|
|
43
|
+
category: product.category,
|
|
44
|
+
brand: product.brand,
|
|
45
|
+
variant: product.variant
|
|
46
|
+
});
|
|
47
|
+
ga('ec:setAction', 'click');
|
|
48
|
+
ga('send', 'event', {
|
|
49
|
+
eventAction: 'Click',
|
|
50
|
+
eventCategory: 'Product'
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
/** Product viewed event
|
|
54
|
+
* https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#measuring-actvities
|
|
55
|
+
*/ const productDetail = (product)=>{
|
|
56
|
+
if (!product || !window.ga) return;
|
|
57
|
+
ga('ec:addProduct', {
|
|
58
|
+
brand: product.brand,
|
|
59
|
+
category: product.category,
|
|
60
|
+
id: product.id,
|
|
61
|
+
name: product.name,
|
|
62
|
+
variant: product.variant
|
|
63
|
+
});
|
|
64
|
+
ga('ec:setAction', 'detail');
|
|
65
|
+
ga('send', 'event', {
|
|
66
|
+
eventAction: 'Detail',
|
|
67
|
+
eventCategory: 'Ecommerce',
|
|
68
|
+
nonInteraction: 1
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
/** Removal from cart events
|
|
72
|
+
* https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#add-remove-cart
|
|
73
|
+
*/ const removeFromCart = (product, price)=>{
|
|
74
|
+
if (!product || !window.ga) return;
|
|
75
|
+
ga('ec:addProduct', {
|
|
76
|
+
id: product.id,
|
|
77
|
+
name: product.name,
|
|
78
|
+
price
|
|
79
|
+
});
|
|
80
|
+
ga('ec:setAction', 'remove');
|
|
81
|
+
ga('send', 'event', {
|
|
82
|
+
eventAction: 'Click',
|
|
83
|
+
eventCategory: 'Remove from cart'
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export { addToCart, pageview, productClick, productDetail, removeFromCart };
|
|
@@ -1 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
const addToCart = (product)=>{
|
|
3
|
+
if (!window?.ttq?.track) return;
|
|
4
|
+
window.ttq.track('AddToCart', {
|
|
5
|
+
content_id: product.id,
|
|
6
|
+
content_type: 'product',
|
|
7
|
+
content_name: product.name,
|
|
8
|
+
quantity: product.quantity,
|
|
9
|
+
price: product.price,
|
|
10
|
+
value: (product.price ?? 0) * (product.quantity ?? 0),
|
|
11
|
+
currency: product.currency
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { addToCart };
|
|
@@ -1,17 +1,149 @@
|
|
|
1
|
-
import{getSingleColorVariable
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
${
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
${
|
|
15
|
-
${
|
|
16
|
-
${
|
|
17
|
-
|
|
1
|
+
import { getSingleColorVariable } from './colors.js';
|
|
2
|
+
import { removeNullUndefined, makeStyle, makeStyleResponsive } from './make-style.js';
|
|
3
|
+
|
|
4
|
+
const genTypoClass = (name)=>{
|
|
5
|
+
return `gp-g-${name}`;
|
|
6
|
+
};
|
|
7
|
+
const composeTypographyCss = (typography)=>{
|
|
8
|
+
const typographyCustom = typography?.custom;
|
|
9
|
+
const { fontFamily, fontSize, fontStyle, fontWeight, lineHeight, letterSpacing } = typographyCustom?.desktop ?? {};
|
|
10
|
+
return `
|
|
11
|
+
${fontFamily ? `fontFamily: ${composeFontFamilyTypographyV2({
|
|
12
|
+
fontFamily
|
|
13
|
+
})};` : ''}
|
|
14
|
+
${fontSize ? `font-size: ${fontSize};` : ''}
|
|
15
|
+
${fontStyle ? `font-style: ${fontStyle};` : ''}
|
|
16
|
+
${fontWeight ? `font-weight: ${fontWeight};` : ''}
|
|
17
|
+
${letterSpacing ? `letter-spacing: ${letterSpacing};` : ''}
|
|
18
|
+
${lineHeight ? `line-height: ${lineHeight};` : ''}
|
|
19
|
+
`;
|
|
20
|
+
};
|
|
21
|
+
const composeTypographyV2Css = (typography, isImportant)=>{
|
|
22
|
+
const typographyCustom = typography?.custom;
|
|
23
|
+
const { fontFamily, fontSize, fontWeight, lineHeight, letterSpacing } = typographyCustom ?? {};
|
|
24
|
+
const typographyAttrs = typography?.attrs;
|
|
25
|
+
const { bold, italic, underline, transform } = typographyAttrs ?? {};
|
|
26
|
+
const composeImportant = isImportant ? '!important' : '';
|
|
27
|
+
return `
|
|
28
|
+
${fontFamily ? `font-family: ${composeFontFamilyTypographyV2({
|
|
29
|
+
fontFamily,
|
|
30
|
+
type: typography?.type
|
|
31
|
+
})} ${composeImportant}` : ''};
|
|
32
|
+
${fontSize?.desktop ? `font-size: ${fontSize?.desktop} ${composeImportant}` : ''};
|
|
33
|
+
${bold ? `font-weight: bold ${composeImportant}` : fontWeight ? `font-weight: ${fontWeight} ${composeImportant}` : ''};
|
|
34
|
+
${letterSpacing ? `letter-spacing: ${letterSpacing} ${composeImportant}` : ''};
|
|
35
|
+
${lineHeight?.desktop ? `line-height: ${lineHeight?.desktop} ${composeImportant}` : ''};
|
|
36
|
+
${italic ? `font-style: italic ${composeImportant}` : ''};
|
|
37
|
+
${underline ? `text-decoration-line: underline ${composeImportant}` : ''};
|
|
38
|
+
${transform ? `text-transform: ${transform} ${composeImportant}` : ''};
|
|
39
|
+
`;
|
|
40
|
+
};
|
|
41
|
+
function getCustomCSSByDevice(typography, device) {
|
|
42
|
+
if (!typography || !device) return {};
|
|
43
|
+
const suffix = device === 'desktop' || !device ? '' : `-${device}`;
|
|
44
|
+
const { fontFamily } = typography?.[device] ?? {};
|
|
45
|
+
return {
|
|
46
|
+
[`--size${suffix}`]: typography?.[device]?.fontSize,
|
|
47
|
+
[`--lh${suffix}`]: typography?.[device]?.lineHeight,
|
|
48
|
+
[`--fs${suffix}`]: typography?.[device]?.fontStyle,
|
|
49
|
+
[`--ff${suffix}`]: composeFontFamilyTypographyV2({
|
|
50
|
+
fontFamily
|
|
51
|
+
}),
|
|
52
|
+
[`--weight${suffix}`]: typography?.[device]?.fontWeight,
|
|
53
|
+
[`--ls${suffix}`]: typography?.[device]?.letterSpacing
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
const composeTypography = (typography)=>{
|
|
57
|
+
if (!typography) return {};
|
|
58
|
+
return removeNullUndefined({
|
|
59
|
+
...getCustomCSSByDevice(typography, 'desktop'),
|
|
60
|
+
...getCustomCSSByDevice(typography, 'tablet'),
|
|
61
|
+
...getCustomCSSByDevice(typography, 'mobile')
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
const composeTypographyV2 = (value, attrs)=>{
|
|
65
|
+
if (!value) return {};
|
|
66
|
+
return removeNullUndefined({
|
|
67
|
+
...makeStyle({
|
|
68
|
+
fs: !attrs?.italic ? value?.fontStyle : undefined,
|
|
69
|
+
ff: composeFontFamilyTypographyV2(value),
|
|
70
|
+
weight: !attrs?.bold ? value?.fontWeight : undefined,
|
|
71
|
+
ls: value?.letterSpacing
|
|
72
|
+
}),
|
|
73
|
+
...makeStyleResponsive('size', value?.fontSize),
|
|
74
|
+
...makeStyleResponsive('lh', value?.lineHeight)
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
const composeFontFamilyTypographyV2 = (value)=>{
|
|
78
|
+
const { fontFamily, isCustom, fallbackFontFamily, type } = value || {};
|
|
79
|
+
if (!fontFamily) {
|
|
80
|
+
return isCustom ? fallbackFontFamily : undefined;
|
|
81
|
+
}
|
|
82
|
+
if (typeof fontFamily === 'string') {
|
|
83
|
+
return getFontUsedByTypographyV2({
|
|
84
|
+
fontFamily,
|
|
85
|
+
fallbackFontFamily: value?.fallbackFontFamily || composeFallbackTypographyStyle(type ?? 'heading')
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
if (typeof fontFamily === 'object' && typeof fontFamily?.value === 'string') {
|
|
89
|
+
switch(fontFamily.type){
|
|
90
|
+
case 'theme':
|
|
91
|
+
return `var(${fontFamily?.value}), var(--g-font-body)`;
|
|
92
|
+
default:
|
|
93
|
+
return getFontUsedByTypographyV2({
|
|
94
|
+
fontFamily: fontFamily.value,
|
|
95
|
+
fallbackFontFamily: value?.fallbackFontFamily || composeFallbackTypographyStyle(type ?? 'heading')
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return;
|
|
100
|
+
};
|
|
101
|
+
const getFontUsedByTypographyV2 = ({ fontFamily, fallbackFontFamily })=>{
|
|
102
|
+
if (fontFamily) {
|
|
103
|
+
return `var(--g-font-${fontFamily?.replace(/ /g, '-')}, '${fontFamily}'), ${fallbackFontFamily}`;
|
|
104
|
+
}
|
|
105
|
+
return;
|
|
106
|
+
};
|
|
107
|
+
const composeTypographyAttr = (attrs)=>{
|
|
108
|
+
if (!attrs) return {};
|
|
109
|
+
return removeNullUndefined({
|
|
110
|
+
...makeStyle({
|
|
111
|
+
fs: attrs?.italic ? 'italic' : undefined,
|
|
112
|
+
weight: attrs?.bold ? 'bold' : undefined,
|
|
113
|
+
c: getSingleColorVariable(attrs?.color),
|
|
114
|
+
tt: attrs?.transform,
|
|
115
|
+
tdl: attrs?.underline ? 'underline' : undefined
|
|
116
|
+
})
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
const composeTypographyClassName = (typo, typography)=>{
|
|
120
|
+
return typo ? typo?.type && !isCustomTypo(typo.custom) ? genTypoClass(typo.type) : '' : typography?.type && genTypoClass(typography?.type);
|
|
121
|
+
};
|
|
122
|
+
const composeFallbackTypographyStyle = (tag)=>{
|
|
123
|
+
if (tag.toLocaleLowerCase().includes('heading')) {
|
|
124
|
+
return 'var(--g-font-heading, heading)';
|
|
125
|
+
}
|
|
126
|
+
return 'var(--g-font-body, body)';
|
|
127
|
+
};
|
|
128
|
+
const composeTypographyStyle = (typo, typography, disableAttr)=>{
|
|
129
|
+
if (typo) {
|
|
130
|
+
const fallbackFontFamily = composeFallbackTypographyStyle(typo.type ?? 'heading');
|
|
131
|
+
const customTypo = {
|
|
132
|
+
...typo.custom,
|
|
133
|
+
fallbackFontFamily: fallbackFontFamily,
|
|
134
|
+
isCustom: isCustomTypo(typo.custom)
|
|
135
|
+
};
|
|
136
|
+
return {
|
|
137
|
+
...composeTypographyV2(customTypo, typo.attrs),
|
|
138
|
+
...!disableAttr && composeTypographyAttr(typo.attrs)
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
return {
|
|
142
|
+
...!typography?.type ? composeTypography(typography?.custom) : {}
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
const isCustomTypo = (customTypo)=>{
|
|
146
|
+
return customTypo && Object.keys(customTypo).length > 1 || customTypo && Object.keys(customTypo).length === 1 && !customTypo.fontSize;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export { composeFallbackTypographyStyle, composeFontFamilyTypographyV2, composeTypography, composeTypographyAttr, composeTypographyClassName, composeTypographyCss, composeTypographyStyle, composeTypographyV2, composeTypographyV2Css, genTypoClass };
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
function checkInStock(
|
|
1
|
+
function checkInStock(variant, product) {
|
|
2
|
+
if (!variant) return false;
|
|
3
|
+
return variant?.inventoryQuantity && variant.inventoryQuantity > 0 && !isDefaultVariant(variant, product) || !variant?.manageInventory || variant.inventoryPolicy === 'CONTINUE';
|
|
4
|
+
}
|
|
5
|
+
function isDefaultVariant(variant, product) {
|
|
6
|
+
return Boolean(variant?.title === 'Default Title' && product?.options?.some((option)=>option.values.length > 1));
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { checkInStock };
|
|
@@ -1 +1,37 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useRef, useCallback } from 'react';
|
|
2
|
+
|
|
3
|
+
const useAnimationActions = ()=>{
|
|
4
|
+
const listAnimations = useRef();
|
|
5
|
+
const setAnimation = useCallback((newListAnimations)=>{
|
|
6
|
+
listAnimations.current = newListAnimations;
|
|
7
|
+
}, [
|
|
8
|
+
listAnimations
|
|
9
|
+
]);
|
|
10
|
+
const playAnimation = useCallback(()=>{
|
|
11
|
+
if (!listAnimations.current) return;
|
|
12
|
+
for (const animation of listAnimations.current){
|
|
13
|
+
animation.play();
|
|
14
|
+
}
|
|
15
|
+
}, []);
|
|
16
|
+
const cancelAnimation = useCallback(()=>{
|
|
17
|
+
if (!listAnimations.current) return;
|
|
18
|
+
for (const animation of listAnimations.current){
|
|
19
|
+
animation.cancel();
|
|
20
|
+
}
|
|
21
|
+
}, []);
|
|
22
|
+
const setAnimationOnFinish = useCallback((onFinish)=>{
|
|
23
|
+
if (!listAnimations.current) return;
|
|
24
|
+
for (const animation of listAnimations.current){
|
|
25
|
+
animation.onfinish = onFinish;
|
|
26
|
+
}
|
|
27
|
+
}, []);
|
|
28
|
+
return {
|
|
29
|
+
currentAnimation: listAnimations.current,
|
|
30
|
+
setAnimation,
|
|
31
|
+
playAnimation,
|
|
32
|
+
cancelAnimation,
|
|
33
|
+
setAnimationOnFinish
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export { useAnimationActions };
|
|
@@ -1 +1,28 @@
|
|
|
1
|
-
import{useMemo
|
|
1
|
+
import { useMemo, useCallback } from 'react';
|
|
2
|
+
import { useCurrentDevice } from '../use-current-device.js';
|
|
3
|
+
|
|
4
|
+
const useAnimationConfig = (props)=>{
|
|
5
|
+
const currentDevice = useCurrentDevice();
|
|
6
|
+
const configByDevices = useMemo(()=>props?.advanced?.animation?.[currentDevice], [
|
|
7
|
+
currentDevice,
|
|
8
|
+
props?.advanced?.animation
|
|
9
|
+
]);
|
|
10
|
+
const getAnimationConfig = useCallback(()=>{
|
|
11
|
+
const { trigger, triggerConfig } = configByDevices;
|
|
12
|
+
const { animation, setting } = triggerConfig[trigger];
|
|
13
|
+
return {
|
|
14
|
+
type: animation,
|
|
15
|
+
setting: setting[animation],
|
|
16
|
+
reverse: trigger === "hidden"
|
|
17
|
+
};
|
|
18
|
+
}, [
|
|
19
|
+
configByDevices
|
|
20
|
+
]);
|
|
21
|
+
const isEnabledAnimation = configByDevices?.enabled;
|
|
22
|
+
return {
|
|
23
|
+
isEnabledAnimation,
|
|
24
|
+
getAnimationConfig
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { useAnimationConfig };
|
|
@@ -1 +1,29 @@
|
|
|
1
|
-
import{useCallback
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
|
|
3
|
+
const useAnimationPreview = ({ props, playAnimation, cancelAnimation, setAnimationOnFinish, setToolbarActive })=>{
|
|
4
|
+
const previewAnimation = useCallback((e)=>{
|
|
5
|
+
const { uid, isCancel } = e.detail;
|
|
6
|
+
if (props.uid !== uid) return;
|
|
7
|
+
cancelAnimation();
|
|
8
|
+
if (isCancel) {
|
|
9
|
+
setToolbarActive(true);
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
playAnimation();
|
|
13
|
+
setToolbarActive(false);
|
|
14
|
+
setAnimationOnFinish(()=>{
|
|
15
|
+
setToolbarActive(true);
|
|
16
|
+
});
|
|
17
|
+
}, [
|
|
18
|
+
props.uid,
|
|
19
|
+
cancelAnimation,
|
|
20
|
+
playAnimation,
|
|
21
|
+
setToolbarActive,
|
|
22
|
+
setAnimationOnFinish
|
|
23
|
+
]);
|
|
24
|
+
return {
|
|
25
|
+
previewAnimation
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export { useAnimationPreview };
|