@gem-sdk/core 2.0.0-dev.896 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/AddOn.js +18 -1
- package/dist/cjs/components/ComponentAnimation.js +17 -0
- package/dist/cjs/components/ComponentToolbarPreview.js +752 -1
- package/dist/cjs/components/ComponentWrapper.js +61 -1
- package/dist/cjs/components/ComponentWrapperPreview.js +213 -1
- package/dist/cjs/components/Empty.js +7 -1
- package/dist/cjs/components/InteractionSuffix.js +42 -0
- package/dist/cjs/components/Render.js +75 -1
- package/dist/cjs/components/Render.liquid.js +313 -17
- package/dist/cjs/components/RenderBlock.js +54 -1
- package/dist/cjs/components/RenderCustomCode.js +59 -3
- package/dist/cjs/components/RenderPreview.js +67 -1
- package/dist/cjs/components/RenderSection.js +23 -1
- package/dist/cjs/components/ai-generator/AIContentGenerator.js +252 -1
- package/dist/cjs/components/ai-generator/AIGenContentLoading.js +85 -1
- package/dist/cjs/components/ai-generator/components/PickProduct.js +220 -1
- package/dist/cjs/components/ai-generator/components/ToneAndVoice.js +77 -1
- package/dist/cjs/components/ai-generator/hooks/useCheckingProductInside.js +47 -0
- package/dist/cjs/components/ai-generator/hooks/useFlipPopup.js +110 -0
- package/dist/cjs/components/ai-generator/hooks/useGettingGenerateRequest.js +37 -1
- package/dist/cjs/components/ai-generator/hooks/useListenEventGenerate.js +70 -1
- package/dist/cjs/components/ai-generator/icons/AIIcon.js +67 -1
- package/dist/cjs/components/ai-generator/icons/CloseIcon.js +19 -1
- package/dist/cjs/components/ai-generator/icons/DropdownIcon.js +37 -1
- package/dist/cjs/components/ai-generator/icons/SearchIcon.js +21 -1
- package/dist/cjs/components/ai-generator/icons/ShowMoreIcon.js +21 -1
- package/dist/cjs/components/ai-generator/icons/UpgradeIcon.js +27 -0
- package/dist/cjs/components/ai-generator/icons/WarningIcon.js +31 -0
- package/dist/cjs/components/constant.js +83 -1
- package/dist/cjs/components/resize/Resize.js +16 -1
- package/dist/cjs/components/resize/Spacing.js +260 -1
- package/dist/cjs/components/src/product/helpers/variant-presets.js +56 -1
- package/dist/cjs/components/theme-section/CreateThemeSection.js +123 -1
- package/dist/cjs/components/theme-section/ThemeSectionStatus.js +45 -1
- package/dist/cjs/components/theme-section/ThemeSectionTooltip.js +126 -1
- package/dist/cjs/components/toolbar/Tooltip.js +28 -1
- package/dist/cjs/contexts/AddonContext.js +36 -1
- package/dist/cjs/contexts/ArticleContext.js +39 -1
- package/dist/cjs/contexts/ArticleListContext.js +31 -1
- package/dist/cjs/contexts/BuilderComponent.js +34 -1
- package/dist/cjs/contexts/BuilderContext.js +39 -1
- package/dist/cjs/contexts/BuilderPreviewContext.js +486 -1
- package/dist/cjs/contexts/CartLineContext.js +29 -1
- package/dist/cjs/contexts/CollectionContext.js +38 -1
- package/dist/cjs/contexts/ModalContext.js +47 -1
- package/dist/cjs/contexts/PageContext.js +104 -1
- package/dist/cjs/contexts/ProductContext.js +177 -1
- package/dist/cjs/contexts/ProductListContext.js +32 -1
- package/dist/cjs/contexts/SectionContext.js +53 -1
- package/dist/cjs/contexts/ShopContext.js +107 -1
- package/dist/cjs/graphql/fragments/analytic.generated.js +6 -2
- package/dist/cjs/graphql/fragments/collection-detail.generated.js +6 -2
- package/dist/cjs/graphql/fragments/collection-product.generated.js +6 -2
- package/dist/cjs/graphql/fragments/collection.generated.js +6 -2
- package/dist/cjs/graphql/fragments/custom-code.generated.js +6 -2
- package/dist/cjs/graphql/fragments/custom-font.generated.js +6 -2
- package/dist/cjs/graphql/fragments/data-seo.generated.js +6 -2
- package/dist/cjs/graphql/fragments/media.generated.js +6 -2
- package/dist/cjs/graphql/fragments/preview-theme-page.generated.js +39 -0
- package/dist/cjs/graphql/fragments/product-little.generated.js +7 -2
- package/dist/cjs/graphql/fragments/product-option-value.generated.js +6 -2
- package/dist/cjs/graphql/fragments/product-option.generated.js +6 -2
- package/dist/cjs/graphql/fragments/product.generated.js +6 -2
- package/dist/cjs/graphql/fragments/published-custom-section.generated.js +6 -2
- package/dist/cjs/graphql/fragments/published-page-section.generated.js +6 -2
- package/dist/cjs/graphql/fragments/published-theme-page.generated.js +10 -28
- package/dist/cjs/graphql/fragments/published-theme-style.generated.js +6 -2
- package/dist/cjs/graphql/fragments/selected-option.generated.js +6 -2
- package/dist/cjs/graphql/fragments/variant.generated.js +6 -2
- package/dist/cjs/graphql/mutations/page-view-up.generated.js +8 -4
- package/dist/cjs/graphql/queries/articles.generated.js +61 -0
- package/dist/cjs/graphql/queries/blogs.generated.js +69 -0
- package/dist/cjs/graphql/queries/collection-detail-filter.generated.js +16 -2
- package/dist/cjs/graphql/queries/collection.generated.js +14 -2
- package/dist/cjs/graphql/queries/collections.generated.js +9 -2
- package/dist/cjs/graphql/queries/preview-page.generated.js +16 -8
- package/dist/cjs/graphql/queries/product-little-detail.generated.js +11 -2
- package/dist/cjs/graphql/queries/product-medias.generated.js +8 -2
- package/dist/cjs/graphql/queries/product-value-label.generated.js +6 -2
- package/dist/cjs/graphql/queries/product-variants.generated.js +10 -2
- package/dist/cjs/graphql/queries/products.generated.js +17 -3
- package/dist/cjs/graphql/queries/published-shop-metas.js +15 -0
- package/dist/cjs/graphql/queries/published-theme-pages.generated.js +15 -2
- package/dist/cjs/graphql/queries/store-property.generated.js +6 -2
- package/dist/cjs/graphql-app-api/queries/LibrarySaleFunnelDiscount.generated.js +6 -2
- package/dist/cjs/graphql-app-api/queries/LibraryTemplate.generated.js +6 -2
- package/dist/cjs/graphql-app-api/queries/SaleFunnelDiscounts.generated.js +6 -2
- package/dist/cjs/graphql-app-api/queries/ShopLibraryPage.generated.js +17 -0
- package/dist/cjs/graphql-app-api/queries/ThemePage.generated.js +6 -2
- package/dist/cjs/helpers/GlobalEvent.js +19 -1
- package/dist/cjs/helpers/align.js +19 -0
- package/dist/cjs/helpers/animations.js +222 -1
- package/dist/cjs/helpers/background.js +235 -1
- package/dist/cjs/helpers/borders.js +198 -4
- package/dist/cjs/helpers/carousel.js +55 -1
- package/dist/cjs/helpers/clone-deep.js +5 -1
- package/dist/cjs/helpers/cls.js +16 -1
- package/dist/cjs/helpers/colors.js +184 -1
- package/dist/cjs/helpers/compose-advance-style.js +327 -1
- package/dist/cjs/helpers/constant.js +23 -1
- package/dist/cjs/helpers/convert.js +7 -1
- package/dist/cjs/helpers/covert-entities-html.js +19 -1
- package/dist/cjs/helpers/css-variable.js +7 -1
- package/dist/cjs/helpers/email.js +11 -1
- package/dist/cjs/helpers/filter-toolbar-preview.js +14 -1
- package/dist/cjs/helpers/flatten-connection.js +9 -1
- package/dist/cjs/helpers/get-resonsive-value.js +36 -1
- package/dist/cjs/helpers/get-shortname.js +92 -1
- package/dist/cjs/helpers/icon-list.js +61 -1
- package/dist/cjs/helpers/interaction/index.js +134 -0
- package/dist/cjs/helpers/is-browser.js +9 -1
- package/dist/cjs/helpers/is-defined.js +7 -1
- package/dist/cjs/helpers/is-empty-children.js +15 -1
- package/dist/cjs/helpers/is-safari.js +9 -1
- package/dist/cjs/helpers/layout.js +59 -1
- package/dist/cjs/helpers/load-script.js +31 -1
- package/dist/cjs/helpers/loop-component.js +16 -0
- package/dist/cjs/helpers/make-style.js +163 -1
- package/dist/cjs/helpers/normalize-builder-data.js +23 -1
- package/dist/cjs/helpers/pascal-to-kebab-case.js +7 -0
- package/dist/cjs/helpers/prefetch-queries.js +78 -1
- package/dist/cjs/helpers/product.js +48 -1
- package/dist/cjs/helpers/queries/get-collection.js +226 -1
- package/dist/cjs/helpers/queries/get-collections.js +21 -1
- package/dist/cjs/helpers/queries/get-product-by-slug.js +125 -1
- package/dist/cjs/helpers/queries/get-product.js +154 -1
- package/dist/cjs/helpers/queries/get-products.js +214 -1
- package/dist/cjs/helpers/query.js +29 -1
- package/dist/cjs/helpers/radius.js +140 -6
- package/dist/cjs/helpers/render.js +78 -1
- package/dist/cjs/helpers/shadow.js +69 -1
- package/dist/cjs/helpers/size.js +206 -4
- package/dist/cjs/helpers/spacing.js +43 -1
- package/dist/cjs/helpers/third-party/addAppBlockId.js +20 -0
- package/dist/cjs/helpers/third-party/appConfig.js +234 -0
- package/dist/cjs/helpers/third-party/appSetting.js +661 -0
- package/dist/cjs/helpers/third-party/composeAppBlockId.js +11 -0
- package/dist/cjs/helpers/third-party/constant.js +43 -0
- package/dist/cjs/helpers/third-party/generateAppBlockConfigs.js +34 -0
- package/dist/cjs/helpers/third-party/getAppBlockConfig.js +47 -0
- package/dist/cjs/helpers/third-party/getAppBlockType.js +12 -0
- package/dist/cjs/helpers/third-party/getAppBlocks.js +30 -0
- package/dist/cjs/helpers/third-party/mergeBlock.js +19 -0
- package/dist/cjs/helpers/third-party/mergeBlockOrder.js +47 -0
- package/dist/cjs/helpers/third-party/removeGPAppItems.js +18 -0
- package/dist/cjs/helpers/tracking/fpixel.js +28 -1
- package/dist/cjs/helpers/tracking/gtag.js +93 -1
- package/dist/cjs/helpers/tracking/tiktokpixel.js +17 -1
- package/dist/cjs/helpers/typography.js +160 -17
- package/dist/cjs/helpers/variant.js +11 -1
- package/dist/cjs/hooks/animation/useAnimationActions.js +39 -1
- package/dist/cjs/hooks/animation/useAnimationConfig.js +30 -1
- package/dist/cjs/hooks/animation/useAnimationPreview.js +31 -1
- package/dist/cjs/hooks/animation/useAnimationTarget.js +122 -1
- package/dist/cjs/hooks/animation/useApplyAnimation.js +89 -1
- package/dist/cjs/hooks/articles/useArticlesQuery.js +33 -1
- package/dist/cjs/hooks/cart/use-add-to-cart.js +20 -1
- package/dist/cjs/hooks/cart/use-cart-data.js +28 -1
- package/dist/cjs/hooks/cart/use-cart-discount-codes-update.js +20 -1
- package/dist/cjs/hooks/cart/use-cart-note-update.js +20 -1
- package/dist/cjs/hooks/cart/use-create-cart.js +22 -1
- package/dist/cjs/hooks/cart/use-remove-cart-item.js +20 -1
- package/dist/cjs/hooks/cart/use-update-cart-item.js +20 -1
- package/dist/cjs/hooks/shop/use-collection-query.js +22 -1
- package/dist/cjs/hooks/shop/use-collections-query.js +17 -1
- package/dist/cjs/hooks/shop/use-product-query.js +22 -1
- package/dist/cjs/hooks/shop/use-products-query.js +63 -1
- package/dist/cjs/hooks/shop.js +126 -1
- package/dist/cjs/hooks/use-current-device.js +30 -1
- package/dist/cjs/hooks/use-lazy-video.js +15 -1
- package/dist/cjs/hooks/useAnimations.js +29 -1
- package/dist/cjs/hooks/useCartId.js +44 -1
- package/dist/cjs/hooks/useCartLine.js +11 -1
- package/dist/cjs/hooks/useCartUI.js +48 -1
- package/dist/cjs/hooks/useCollection.js +9 -1
- package/dist/cjs/hooks/useFetchHandle.js +13 -1
- package/dist/cjs/hooks/useFormatMoney.js +75 -1
- package/dist/cjs/hooks/useInitialSwatchesOptions.js +128 -1
- package/dist/cjs/hooks/useInteraction.js +19 -0
- package/dist/cjs/hooks/useIsomorphicLayoutEffect.js +10 -1
- package/dist/cjs/hooks/useLoadScript.js +32 -1
- package/dist/cjs/hooks/useMoney.js +84 -1
- package/dist/cjs/hooks/usePrevious.js +19 -1
- package/dist/cjs/hooks/useProduct.js +245 -1
- package/dist/cjs/hooks/useProductList.js +21 -1
- package/dist/cjs/hooks/useSuspenseFetch.js +27 -1
- package/dist/cjs/hooks/useSwatchesOptions.js +41 -1
- package/dist/cjs/hooks/useToolbarPostPurchase.js +89 -1
- package/dist/cjs/index.js +416 -1
- package/dist/cjs/types/animations.js +49 -1
- package/dist/cjs/types/appAPI.js +2 -1
- package/dist/cjs/types/custom.js +52 -0
- package/dist/cjs/types/global-style.js +15 -1
- package/dist/cjs/types/shop.js +2 -1
- package/dist/cjs/web-components/src/helpers/styles/constant.js +9 -1
- package/dist/esm/components/AddOn.js +14 -1
- package/dist/esm/components/ComponentAnimation.js +13 -0
- package/dist/esm/components/ComponentToolbarPreview.js +748 -1
- package/dist/esm/components/ComponentWrapper.js +57 -1
- package/dist/esm/components/ComponentWrapperPreview.js +209 -1
- package/dist/esm/components/Empty.js +3 -1
- package/dist/esm/components/InteractionSuffix.js +40 -0
- package/dist/esm/components/Render.js +71 -1
- package/dist/esm/components/Render.liquid.js +307 -17
- package/dist/esm/components/RenderBlock.js +50 -1
- package/dist/esm/components/RenderCustomCode.js +55 -3
- package/dist/esm/components/RenderPreview.js +63 -1
- package/dist/esm/components/RenderSection.js +19 -1
- package/dist/esm/components/ai-generator/AIContentGenerator.js +250 -1
- package/dist/esm/components/ai-generator/AIGenContentLoading.js +83 -1
- package/dist/esm/components/ai-generator/components/PickProduct.js +218 -1
- package/dist/esm/components/ai-generator/components/ToneAndVoice.js +75 -1
- package/dist/esm/components/ai-generator/hooks/useCheckingProductInside.js +45 -0
- package/dist/esm/components/ai-generator/hooks/useFlipPopup.js +108 -0
- package/dist/esm/components/ai-generator/hooks/useGettingGenerateRequest.js +35 -1
- package/dist/esm/components/ai-generator/hooks/useListenEventGenerate.js +68 -1
- package/dist/esm/components/ai-generator/icons/AIIcon.js +65 -1
- package/dist/esm/components/ai-generator/icons/CloseIcon.js +17 -1
- package/dist/esm/components/ai-generator/icons/DropdownIcon.js +34 -1
- package/dist/esm/components/ai-generator/icons/SearchIcon.js +19 -1
- package/dist/esm/components/ai-generator/icons/ShowMoreIcon.js +19 -1
- package/dist/esm/components/ai-generator/icons/UpgradeIcon.js +25 -0
- package/dist/esm/components/ai-generator/icons/WarningIcon.js +29 -0
- package/dist/esm/components/constant.js +76 -1
- package/dist/esm/components/resize/Resize.js +12 -1
- package/dist/esm/components/resize/Spacing.js +256 -1
- package/dist/esm/components/src/product/helpers/variant-presets.js +54 -1
- package/dist/esm/components/theme-section/CreateThemeSection.js +121 -1
- package/dist/esm/components/theme-section/ThemeSectionStatus.js +43 -1
- package/dist/esm/components/theme-section/ThemeSectionTooltip.js +124 -1
- package/dist/esm/components/toolbar/Tooltip.js +24 -1
- package/dist/esm/contexts/AddonContext.js +32 -1
- package/dist/esm/contexts/ArticleContext.js +36 -1
- package/dist/esm/contexts/ArticleListContext.js +27 -1
- package/dist/esm/contexts/BuilderComponent.js +31 -1
- package/dist/esm/contexts/BuilderContext.js +36 -1
- package/dist/esm/contexts/BuilderPreviewContext.js +483 -1
- package/dist/esm/contexts/CartLineContext.js +26 -1
- package/dist/esm/contexts/CollectionContext.js +35 -1
- package/dist/esm/contexts/ModalContext.js +44 -1
- package/dist/esm/contexts/PageContext.js +101 -1
- package/dist/esm/contexts/ProductContext.js +174 -1
- package/dist/esm/contexts/ProductListContext.js +28 -1
- package/dist/esm/contexts/SectionContext.js +49 -1
- package/dist/esm/contexts/ShopContext.js +104 -1
- package/dist/esm/graphql/fragments/analytic.generated.js +4 -2
- package/dist/esm/graphql/fragments/collection-detail.generated.js +4 -2
- package/dist/esm/graphql/fragments/collection-product.generated.js +4 -2
- package/dist/esm/graphql/fragments/collection.generated.js +4 -2
- package/dist/esm/graphql/fragments/custom-code.generated.js +4 -2
- package/dist/esm/graphql/fragments/custom-font.generated.js +4 -2
- package/dist/esm/graphql/fragments/data-seo.generated.js +4 -2
- package/dist/esm/graphql/fragments/media.generated.js +4 -2
- package/dist/esm/graphql/fragments/preview-theme-page.generated.js +37 -0
- package/dist/esm/graphql/fragments/product-little.generated.js +5 -2
- package/dist/esm/graphql/fragments/product-option-value.generated.js +4 -2
- package/dist/esm/graphql/fragments/product-option.generated.js +4 -2
- package/dist/esm/graphql/fragments/product.generated.js +4 -2
- package/dist/esm/graphql/fragments/published-custom-section.generated.js +4 -2
- package/dist/esm/graphql/fragments/published-page-section.generated.js +4 -2
- package/dist/esm/graphql/fragments/published-theme-page.generated.js +8 -28
- package/dist/esm/graphql/fragments/published-theme-style.generated.js +4 -2
- package/dist/esm/graphql/fragments/selected-option.generated.js +4 -2
- package/dist/esm/graphql/fragments/variant.generated.js +4 -2
- package/dist/esm/graphql/mutations/page-view-up.generated.js +6 -4
- package/dist/esm/graphql/queries/articles.generated.js +59 -0
- package/dist/esm/graphql/queries/blogs.generated.js +67 -0
- package/dist/esm/graphql/queries/collection-detail-filter.generated.js +22 -10
- package/dist/esm/graphql/queries/collection.generated.js +18 -8
- package/dist/esm/graphql/queries/collections.generated.js +8 -3
- package/dist/esm/graphql/queries/preview-page.generated.js +16 -10
- package/dist/esm/graphql/queries/product-little-detail.generated.js +12 -5
- package/dist/esm/graphql/queries/product-medias.generated.js +6 -2
- package/dist/esm/graphql/queries/product-value-label.generated.js +4 -2
- package/dist/esm/graphql/queries/product-variants.generated.js +10 -4
- package/dist/esm/graphql/queries/products.generated.js +20 -9
- package/dist/esm/graphql/queries/published-shop-metas.js +13 -0
- package/dist/esm/graphql/queries/published-theme-pages.generated.js +20 -9
- package/dist/esm/graphql/queries/store-property.generated.js +4 -2
- package/dist/esm/graphql-app-api/queries/LibrarySaleFunnelDiscount.generated.js +4 -2
- package/dist/esm/graphql-app-api/queries/LibraryTemplate.generated.js +4 -2
- package/dist/esm/graphql-app-api/queries/SaleFunnelDiscounts.generated.js +4 -2
- package/dist/esm/graphql-app-api/queries/ShopLibraryPage.generated.js +15 -0
- package/dist/esm/graphql-app-api/queries/ThemePage.generated.js +4 -2
- package/dist/esm/helpers/GlobalEvent.js +15 -1
- package/dist/esm/helpers/align.js +17 -0
- package/dist/esm/helpers/animations.js +220 -1
- package/dist/esm/helpers/background.js +226 -1
- package/dist/esm/helpers/borders.js +189 -4
- package/dist/esm/helpers/carousel.js +51 -1
- package/dist/esm/helpers/clone-deep.js +3 -1
- package/dist/esm/helpers/cls.js +14 -1
- package/dist/esm/helpers/colors.js +169 -1
- package/dist/esm/helpers/compose-advance-style.js +319 -1
- package/dist/esm/helpers/constant.js +19 -1
- package/dist/esm/helpers/convert.js +4 -1
- package/dist/esm/helpers/covert-entities-html.js +17 -1
- package/dist/esm/helpers/css-variable.js +5 -1
- package/dist/esm/helpers/email.js +6 -1
- package/dist/esm/helpers/filter-toolbar-preview.js +9 -1
- package/dist/esm/helpers/flatten-connection.js +7 -1
- package/dist/esm/helpers/get-resonsive-value.js +31 -1
- package/dist/esm/helpers/get-shortname.js +90 -1
- package/dist/esm/helpers/icon-list.js +58 -1
- package/dist/esm/helpers/interaction/index.js +132 -0
- package/dist/esm/helpers/is-browser.js +5 -1
- package/dist/esm/helpers/is-defined.js +5 -1
- package/dist/esm/helpers/is-empty-children.js +10 -1
- package/dist/esm/helpers/is-safari.js +5 -1
- package/dist/esm/helpers/layout.js +54 -1
- package/dist/esm/helpers/load-script.js +29 -1
- package/dist/esm/helpers/loop-component.js +14 -0
- package/dist/esm/helpers/make-style.js +149 -1
- package/dist/esm/helpers/normalize-builder-data.js +21 -1
- package/dist/esm/helpers/pascal-to-kebab-case.js +5 -0
- package/dist/esm/helpers/prefetch-queries.js +76 -1
- package/dist/esm/helpers/product.js +44 -1
- package/dist/esm/helpers/queries/get-collection.js +223 -1
- package/dist/esm/helpers/queries/get-collections.js +19 -1
- package/dist/esm/helpers/queries/get-product-by-slug.js +123 -1
- package/dist/esm/helpers/queries/get-product.js +150 -1
- package/dist/esm/helpers/queries/get-products.js +210 -1
- package/dist/esm/helpers/query.js +25 -1
- package/dist/esm/helpers/radius.js +132 -6
- package/dist/esm/helpers/render.js +70 -1
- package/dist/esm/helpers/shadow.js +63 -1
- package/dist/esm/helpers/size.js +192 -4
- package/dist/esm/helpers/spacing.js +40 -1
- package/dist/esm/helpers/third-party/addAppBlockId.js +18 -0
- package/dist/esm/helpers/third-party/appConfig.js +200 -0
- package/dist/esm/helpers/third-party/appSetting.js +658 -0
- package/dist/esm/helpers/third-party/composeAppBlockId.js +9 -0
- package/dist/esm/helpers/third-party/constant.js +40 -0
- package/dist/esm/helpers/third-party/generateAppBlockConfigs.js +32 -0
- package/dist/esm/helpers/third-party/getAppBlockConfig.js +45 -0
- package/dist/esm/helpers/third-party/getAppBlockType.js +10 -0
- package/dist/esm/helpers/third-party/getAppBlocks.js +28 -0
- package/dist/esm/helpers/third-party/mergeBlock.js +17 -0
- package/dist/esm/helpers/third-party/mergeBlockOrder.js +45 -0
- package/dist/esm/helpers/third-party/removeGPAppItems.js +15 -0
- package/dist/esm/helpers/tracking/fpixel.js +24 -1
- package/dist/esm/helpers/tracking/gtag.js +87 -1
- package/dist/esm/helpers/tracking/tiktokpixel.js +15 -1
- package/dist/esm/helpers/typography.js +149 -17
- package/dist/esm/helpers/variant.js +9 -1
- package/dist/esm/hooks/animation/useAnimationActions.js +37 -1
- package/dist/esm/hooks/animation/useAnimationConfig.js +28 -1
- package/dist/esm/hooks/animation/useAnimationPreview.js +29 -1
- package/dist/esm/hooks/animation/useAnimationTarget.js +120 -1
- package/dist/esm/hooks/animation/useApplyAnimation.js +85 -1
- package/dist/esm/hooks/articles/useArticlesQuery.js +30 -1
- package/dist/esm/hooks/cart/use-add-to-cart.js +18 -1
- package/dist/esm/hooks/cart/use-cart-data.js +26 -1
- package/dist/esm/hooks/cart/use-cart-discount-codes-update.js +18 -1
- package/dist/esm/hooks/cart/use-cart-note-update.js +18 -1
- package/dist/esm/hooks/cart/use-create-cart.js +20 -1
- package/dist/esm/hooks/cart/use-remove-cart-item.js +18 -1
- package/dist/esm/hooks/cart/use-update-cart-item.js +18 -1
- package/dist/esm/hooks/shop/use-collection-query.js +20 -1
- package/dist/esm/hooks/shop/use-collections-query.js +15 -1
- package/dist/esm/hooks/shop/use-product-query.js +20 -1
- package/dist/esm/hooks/shop/use-products-query.js +59 -1
- package/dist/esm/hooks/shop.js +111 -1
- package/dist/esm/hooks/use-current-device.js +28 -1
- package/dist/esm/hooks/use-lazy-video.js +13 -1
- package/dist/esm/hooks/useAnimations.js +27 -1
- package/dist/esm/hooks/useCartId.js +40 -1
- package/dist/esm/hooks/useCartLine.js +7 -1
- package/dist/esm/hooks/useCartUI.js +44 -1
- package/dist/esm/hooks/useCollection.js +7 -1
- package/dist/esm/hooks/useFetchHandle.js +11 -1
- package/dist/esm/hooks/useFormatMoney.js +71 -1
- package/dist/esm/hooks/useInitialSwatchesOptions.js +124 -1
- package/dist/esm/hooks/useInteraction.js +17 -0
- package/dist/esm/hooks/useIsomorphicLayoutEffect.js +6 -1
- package/dist/esm/hooks/useLoadScript.js +28 -1
- package/dist/esm/hooks/useMoney.js +80 -1
- package/dist/esm/hooks/usePrevious.js +17 -1
- package/dist/esm/hooks/useProduct.js +228 -1
- package/dist/esm/hooks/useProductList.js +16 -1
- package/dist/esm/hooks/useSuspenseFetch.js +23 -1
- package/dist/esm/hooks/useSwatchesOptions.js +37 -1
- package/dist/esm/hooks/useToolbarPostPurchase.js +87 -1
- package/dist/esm/index.js +117 -1
- package/dist/esm/types/animations.js +49 -1
- package/dist/esm/types/custom.js +52 -0
- package/dist/esm/types/global-style.js +12 -1
- package/dist/esm/web-components/src/helpers/styles/constant.js +7 -1
- package/dist/types/index.d.ts +23183 -17335
- package/package.json +5 -3
- package/dist/cjs/components/animation/AnimationWrapper.js +0 -1
- package/dist/cjs/hooks/animation/animations.js +0 -1
- package/dist/cjs/hooks/animation/useLivePageAnimation.js +0 -1
- package/dist/esm/components/animation/AnimationWrapper.js +0 -1
- package/dist/esm/hooks/animation/animations.js +0 -1
- package/dist/esm/hooks/animation/useLivePageAnimation.js +0 -1
|
@@ -1 +1,256 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { useRef, useState, useCallback, useEffect } from 'react';
|
|
3
|
+
import 'zustand';
|
|
4
|
+
import { useBuilderPreviewStore } from '../../contexts/BuilderPreviewContext.js';
|
|
5
|
+
import 'react-transition-group';
|
|
6
|
+
import '@gem-sdk/core';
|
|
7
|
+
import 'swr';
|
|
8
|
+
import 'swr/infinite';
|
|
9
|
+
import { usePageType } from '../../hooks/shop.js';
|
|
10
|
+
import 'classnames';
|
|
11
|
+
import 'dayjs';
|
|
12
|
+
import '../../helpers/convert.js';
|
|
13
|
+
import '@gem-sdk/adapter-shopify';
|
|
14
|
+
import 'swr/mutation';
|
|
15
|
+
import 'vanilla-lazyload';
|
|
16
|
+
import '../../hooks/useCartUI.js';
|
|
17
|
+
|
|
18
|
+
function Spacing(props) {
|
|
19
|
+
const isThemeSectionEditor = useBuilderPreviewStore((s)=>s.isThemeSectionEditor);
|
|
20
|
+
const pageType = usePageType();
|
|
21
|
+
const $bottomDrag = useRef(null);
|
|
22
|
+
const $bottomBg = useRef(null);
|
|
23
|
+
const delayMouseMove = useRef(null);
|
|
24
|
+
const isDragging = useRef(false);
|
|
25
|
+
const startY = useRef(0);
|
|
26
|
+
const marginBottom = useRef(0);
|
|
27
|
+
const $visualNumberValue = useRef(null);
|
|
28
|
+
const [marginBottomValue, setMarginBottomValue] = useState(0);
|
|
29
|
+
const [isShowVisual, setIsShowVisual] = useState(false);
|
|
30
|
+
const hideVisualNumberValue = useRef(null);
|
|
31
|
+
const getNewValueMargin = (event)=>{
|
|
32
|
+
const top = event.clientY;
|
|
33
|
+
const diffY = Math.ceil(top - startY.current);
|
|
34
|
+
const currentValue = marginBottom.current || 0;
|
|
35
|
+
const newValue = currentValue + diffY >= 0 ? `${currentValue + diffY}px` : `0px`;
|
|
36
|
+
return {
|
|
37
|
+
newValue
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
const onMouseMoveDocument = (event)=>{
|
|
41
|
+
if ($bottomDrag.current && $bottomBg.current) {
|
|
42
|
+
// $bottomDrag.current.
|
|
43
|
+
const { newValue } = getNewValueMargin(event);
|
|
44
|
+
$bottomBg.current.style.height = newValue;
|
|
45
|
+
$bottomDrag.current.style.top = newValue;
|
|
46
|
+
const $component = $bottomDrag.current.closest('[data-toolbar-wrap]');
|
|
47
|
+
if ($component) {
|
|
48
|
+
$component.style.marginBottom = newValue;
|
|
49
|
+
onShowMarginBottomNumber(newValue);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
const onMouseUpDocument = ()=>{
|
|
54
|
+
endDrag();
|
|
55
|
+
};
|
|
56
|
+
const startDrag = ()=>{
|
|
57
|
+
if (delayMouseMove.current) clearTimeout(delayMouseMove.current);
|
|
58
|
+
delayMouseMove.current = setTimeout(()=>{
|
|
59
|
+
isDragging.current = true;
|
|
60
|
+
const event = new CustomEvent('editor:toolbar:resize-spacing', {
|
|
61
|
+
bubbles: true,
|
|
62
|
+
detail: {
|
|
63
|
+
value: true
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
window.dispatchEvent(event);
|
|
67
|
+
document.addEventListener('mousemove', onMouseMoveDocument);
|
|
68
|
+
document.addEventListener('mouseup', onMouseUpDocument);
|
|
69
|
+
}, 100);
|
|
70
|
+
};
|
|
71
|
+
const endDrag = ()=>{
|
|
72
|
+
if (delayMouseMove.current) clearTimeout(delayMouseMove.current);
|
|
73
|
+
isDragging.current = false;
|
|
74
|
+
const event = new CustomEvent('editor:toolbar:resize-spacing', {
|
|
75
|
+
bubbles: true,
|
|
76
|
+
detail: {
|
|
77
|
+
value: false
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
window.dispatchEvent(event);
|
|
81
|
+
if ($bottomDrag.current) {
|
|
82
|
+
const style = getComputedStyle($bottomDrag.current);
|
|
83
|
+
const marginBottom = style.top;
|
|
84
|
+
const event = new CustomEvent('editor:toolbar:change-margin-bottom', {
|
|
85
|
+
bubbles: true,
|
|
86
|
+
detail: {
|
|
87
|
+
componentUid: props.uid,
|
|
88
|
+
marginBottom
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
window.dispatchEvent(event);
|
|
92
|
+
}
|
|
93
|
+
const $component = $bottomDrag.current?.closest('[data-toolbar-wrap]');
|
|
94
|
+
if ($component) {
|
|
95
|
+
$component.style.marginBottom = '';
|
|
96
|
+
}
|
|
97
|
+
document.removeEventListener('mousemove', onMouseMoveDocument);
|
|
98
|
+
document.removeEventListener('mouseup', onMouseUpDocument);
|
|
99
|
+
};
|
|
100
|
+
const onMouseDown = (event)=>{
|
|
101
|
+
if ($bottomDrag.current) {
|
|
102
|
+
const style = getComputedStyle($bottomDrag.current);
|
|
103
|
+
startY.current = event.clientY;
|
|
104
|
+
marginBottom.current = parseFloat(style.top);
|
|
105
|
+
startDrag();
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
const onMouseUp = ()=>{
|
|
109
|
+
endDrag();
|
|
110
|
+
};
|
|
111
|
+
const getChildrenByAttrSelector = ($el, attrSelector)=>{
|
|
112
|
+
const childLen = $el.children.length;
|
|
113
|
+
if (childLen) {
|
|
114
|
+
for(let i = 0; i < childLen; i++){
|
|
115
|
+
const children = $el.children[i];
|
|
116
|
+
if (children) {
|
|
117
|
+
const is = children.getAttribute(attrSelector);
|
|
118
|
+
if (is) {
|
|
119
|
+
return children;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
const isLayoutElement = (el)=>{
|
|
126
|
+
const tag = el.getAttribute('data-component-tag');
|
|
127
|
+
return tag === 'Row' || tag === 'Product';
|
|
128
|
+
};
|
|
129
|
+
const updateSpacing = useCallback((isShowVisualize)=>{
|
|
130
|
+
const $component = $bottomDrag.current?.closest('[data-toolbar-wrap]');
|
|
131
|
+
if (!$component) return;
|
|
132
|
+
const toolbar = getChildrenByAttrSelector($component, 'data-toolbar');
|
|
133
|
+
if (!toolbar) return;
|
|
134
|
+
const isActive = toolbar.getAttribute('data-toolbar-active');
|
|
135
|
+
if (!isActive) return;
|
|
136
|
+
const style = getComputedStyle($component);
|
|
137
|
+
const $spacing = getChildrenByAttrSelector($component, 'data-spacing');
|
|
138
|
+
const $marginBottom = ($spacing?.querySelector('[data-spacing-margin-bottom]')) || null;
|
|
139
|
+
if ($marginBottom) {
|
|
140
|
+
if ($bottomBg.current && $bottomDrag.current) {
|
|
141
|
+
let value = style.marginBottom;
|
|
142
|
+
isShowVisualize && onShowMarginBottomNumber(value);
|
|
143
|
+
if (parseFloat(value) < 0) {
|
|
144
|
+
value = '0';
|
|
145
|
+
}
|
|
146
|
+
$bottomBg.current.style.height = value;
|
|
147
|
+
$bottomDrag.current.style.top = value;
|
|
148
|
+
$marginBottom.setAttribute('data-spacing-margin-bottom-active', 'true');
|
|
149
|
+
if (isLayoutElement($component)) {
|
|
150
|
+
$bottomBg.current.style.left = '0';
|
|
151
|
+
} else {
|
|
152
|
+
const paddingLeft = style.paddingLeft;
|
|
153
|
+
const leftValue = `-${paddingLeft}`;
|
|
154
|
+
const translateCss = `translate(${leftValue}, -100%)`;
|
|
155
|
+
$bottomBg.current.style.left = leftValue;
|
|
156
|
+
$bottomDrag.current.style.transform = translateCss;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}, []);
|
|
161
|
+
const onShowMarginBottomNumber = (value)=>{
|
|
162
|
+
const parsedValue = parseFloat(value);
|
|
163
|
+
setMarginBottomValue(parsedValue);
|
|
164
|
+
setIsShowVisual(true);
|
|
165
|
+
if (hideVisualNumberValue.current) clearTimeout(hideVisualNumberValue.current);
|
|
166
|
+
hideVisualNumberValue.current = setTimeout(()=>{
|
|
167
|
+
setIsShowVisual(false);
|
|
168
|
+
}, 2000);
|
|
169
|
+
// break point 28px
|
|
170
|
+
const topPosition = parsedValue <= 28 && parsedValue >= 0 ? parsedValue / 2 + 16 : parsedValue > 28 ? 0 : 16;
|
|
171
|
+
if ($visualNumberValue.current) {
|
|
172
|
+
$visualNumberValue.current.style.transform = `translateY(${topPosition}px)`;
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
const previousAdvanced = usePrevious(props.advanced?.['spacing-setting']);
|
|
176
|
+
useEffect(()=>{
|
|
177
|
+
// validate margin bottom setting changed
|
|
178
|
+
const isShowVisualize = verifyMarginBottomChanged(previousAdvanced, props.advanced?.['spacing-setting']);
|
|
179
|
+
updateSpacing(isShowVisualize);
|
|
180
|
+
}, [
|
|
181
|
+
previousAdvanced,
|
|
182
|
+
props.advanced,
|
|
183
|
+
updateSpacing
|
|
184
|
+
]);
|
|
185
|
+
const verifyMarginBottomChanged = (prevValue, newValue)=>{
|
|
186
|
+
const listDevices = [
|
|
187
|
+
'desktop',
|
|
188
|
+
'tablet',
|
|
189
|
+
'mobile'
|
|
190
|
+
];
|
|
191
|
+
return listDevices.some((device)=>JSON.stringify(prevValue?.[device]?.margin?.bottom) !== JSON.stringify(newValue?.[device]?.margin?.bottom));
|
|
192
|
+
};
|
|
193
|
+
const onWindowResize = useCallback(()=>{
|
|
194
|
+
updateSpacing();
|
|
195
|
+
}, [
|
|
196
|
+
updateSpacing
|
|
197
|
+
]);
|
|
198
|
+
useEffect(()=>{
|
|
199
|
+
window.addEventListener('editor:toolbar:update-margin-bottom', ()=>updateSpacing);
|
|
200
|
+
window.addEventListener('editor:toolbar:update-padding-left', ()=>updateSpacing);
|
|
201
|
+
window.addEventListener('resize', onWindowResize);
|
|
202
|
+
return ()=>{
|
|
203
|
+
window.removeEventListener('editor:toolbar:update-margin-bottom', ()=>updateSpacing);
|
|
204
|
+
window.removeEventListener('editor:toolbar:update-padding-left', ()=>updateSpacing);
|
|
205
|
+
window.removeEventListener('resize', onWindowResize);
|
|
206
|
+
};
|
|
207
|
+
}, [
|
|
208
|
+
onWindowResize,
|
|
209
|
+
updateSpacing
|
|
210
|
+
]);
|
|
211
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
212
|
+
children: props.tag !== 'Section' && pageType !== 'POST_PURCHASE' && /*#__PURE__*/ jsx("div", {
|
|
213
|
+
"data-spacing": true,
|
|
214
|
+
"data-spacing-theme-section": isThemeSectionEditor,
|
|
215
|
+
className: "gp-absolute gp-w-full gp-bottom-0",
|
|
216
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
217
|
+
"data-spacing-margin-bottom": true,
|
|
218
|
+
children: [
|
|
219
|
+
/*#__PURE__*/ jsxs("div", {
|
|
220
|
+
"data-spacing-margin-bottom-bg": true,
|
|
221
|
+
ref: $bottomBg,
|
|
222
|
+
children: [
|
|
223
|
+
/*#__PURE__*/ jsx("div", {
|
|
224
|
+
"data-spacing-margin-bottom-value": true
|
|
225
|
+
}),
|
|
226
|
+
/*#__PURE__*/ jsx("div", {
|
|
227
|
+
"data-active": isShowVisual,
|
|
228
|
+
"data-value-number": true,
|
|
229
|
+
ref: $visualNumberValue,
|
|
230
|
+
children: marginBottomValue
|
|
231
|
+
})
|
|
232
|
+
]
|
|
233
|
+
}),
|
|
234
|
+
/*#__PURE__*/ jsx("div", {
|
|
235
|
+
ref: $bottomDrag,
|
|
236
|
+
"data-spacing-margin-bottom-drag": true,
|
|
237
|
+
onMouseDown: onMouseDown,
|
|
238
|
+
onMouseUp: onMouseUp,
|
|
239
|
+
role: "presentation"
|
|
240
|
+
})
|
|
241
|
+
]
|
|
242
|
+
})
|
|
243
|
+
})
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
const usePrevious = (value)=>{
|
|
247
|
+
const ref = useRef();
|
|
248
|
+
useEffect(()=>{
|
|
249
|
+
ref.current = value;
|
|
250
|
+
}, [
|
|
251
|
+
value
|
|
252
|
+
]);
|
|
253
|
+
return ref.current;
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
export { Spacing as default };
|
|
@@ -1 +1,54 @@
|
|
|
1
|
-
|
|
1
|
+
const colorPreset = {
|
|
2
|
+
black: '#000000',
|
|
3
|
+
white: '#FFFFFF',
|
|
4
|
+
gray: '#808080',
|
|
5
|
+
red: '#FF0000',
|
|
6
|
+
blue: '#0000FF',
|
|
7
|
+
green: '#008000',
|
|
8
|
+
yellow: '#FFFF00',
|
|
9
|
+
orange: '#FFA500',
|
|
10
|
+
pink: '#FFC0CB',
|
|
11
|
+
purple: '#800080',
|
|
12
|
+
brown: '#A52A2A',
|
|
13
|
+
cyan: '#00FFFF',
|
|
14
|
+
magenta: '#FF00FF',
|
|
15
|
+
teal: '#008080',
|
|
16
|
+
navy: '#000080',
|
|
17
|
+
maroon: '#800000',
|
|
18
|
+
gold: '#FFD700',
|
|
19
|
+
silver: '#C0C0C0',
|
|
20
|
+
beige: '#F5F5DC',
|
|
21
|
+
ivory: '#FFFFF0',
|
|
22
|
+
lavender: '#E6E6FA',
|
|
23
|
+
indigo: '#4B0082',
|
|
24
|
+
coral: '#FF7F50',
|
|
25
|
+
mint: '#98FF98',
|
|
26
|
+
'sky blue': '#87CEEB',
|
|
27
|
+
salmon: '#FA8072',
|
|
28
|
+
olive: '#808000',
|
|
29
|
+
lilac: '#C8A2C8',
|
|
30
|
+
peach: '#FFDAB9',
|
|
31
|
+
turquoise: '#40E0D0',
|
|
32
|
+
ruby: '#E0115F',
|
|
33
|
+
bronze: '#CD7F32',
|
|
34
|
+
slate: '#708090',
|
|
35
|
+
charcoal: '#36454F',
|
|
36
|
+
sand: '#C2B280',
|
|
37
|
+
mauve: '#E0B0FF',
|
|
38
|
+
tangerine: '#FF4500',
|
|
39
|
+
'mint green': '#00FF99',
|
|
40
|
+
'forest green': '#228B22',
|
|
41
|
+
'ruby red': '#9B111E',
|
|
42
|
+
marigold: '#FFB928',
|
|
43
|
+
eggplant: '#990066',
|
|
44
|
+
'coral pink': '#F88379',
|
|
45
|
+
mustard: '#FFDB58',
|
|
46
|
+
'sky gray': '#B0C4DE',
|
|
47
|
+
'dusty rose': '#FF9BAE',
|
|
48
|
+
'olive green': '#556B2F',
|
|
49
|
+
coffee: '#6F4E37',
|
|
50
|
+
'lilac gray': '#C8A2C8',
|
|
51
|
+
'steel blue': '#4682B4'
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export { colorPreset };
|
|
@@ -1 +1,121 @@
|
|
|
1
|
-
import{jsx
|
|
1
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { useRef, useState } from 'react';
|
|
3
|
+
import { ThemeSectionTooltip } from './ThemeSectionTooltip.js';
|
|
4
|
+
import 'zustand';
|
|
5
|
+
import { useShopStore } from '../../contexts/ShopContext.js';
|
|
6
|
+
import 'swr';
|
|
7
|
+
import 'swr/infinite';
|
|
8
|
+
import 'classnames';
|
|
9
|
+
import 'dayjs';
|
|
10
|
+
import '../../helpers/convert.js';
|
|
11
|
+
import '@gem-sdk/adapter-shopify';
|
|
12
|
+
import 'swr/mutation';
|
|
13
|
+
import 'vanilla-lazyload';
|
|
14
|
+
import '../../hooks/useCartUI.js';
|
|
15
|
+
|
|
16
|
+
const SHOW_TOOLTIP_TIMEOUT = 600;
|
|
17
|
+
const NUMBER_OF_THEME_SECTION_CREATED_TO_SHOW_TOOLTIP = 1;
|
|
18
|
+
const LIMIT_PLANS = [
|
|
19
|
+
'starter',
|
|
20
|
+
'trial',
|
|
21
|
+
'trial2022'
|
|
22
|
+
];
|
|
23
|
+
const CreateThemeSection = ({ ...props })=>{
|
|
24
|
+
const shopPlan = useShopStore((s)=>s.plan);
|
|
25
|
+
const createThemeSectionCount = useShopStore((s)=>s.createThemeSectionCount);
|
|
26
|
+
const limitCreateThemeSection = useShopStore((s)=>s.limitCreateThemeSection);
|
|
27
|
+
const isFreeLimit = LIMIT_PLANS.includes(shopPlan ?? '');
|
|
28
|
+
const isLimit = isFreeLimit || limitCreateThemeSection?.isLimit;
|
|
29
|
+
const isRenderTooltip = isLimit || createThemeSectionCount === undefined || createThemeSectionCount < NUMBER_OF_THEME_SECTION_CREATED_TO_SHOW_TOOLTIP;
|
|
30
|
+
const timeoutRef = useRef();
|
|
31
|
+
const [isShowTooltip, setIsShowTooltip] = useState(false);
|
|
32
|
+
const showTooltip = ()=>{
|
|
33
|
+
if (!isRenderTooltip) return;
|
|
34
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
35
|
+
timeoutRef.current = setTimeout(()=>{
|
|
36
|
+
setIsShowTooltip(true);
|
|
37
|
+
}, SHOW_TOOLTIP_TIMEOUT);
|
|
38
|
+
};
|
|
39
|
+
const hideTooltip = ()=>{
|
|
40
|
+
if (!isRenderTooltip) return;
|
|
41
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
42
|
+
setIsShowTooltip(false);
|
|
43
|
+
};
|
|
44
|
+
const onActions = (e, options)=>{
|
|
45
|
+
e.preventDefault();
|
|
46
|
+
e.stopPropagation();
|
|
47
|
+
if (options?.disabled) return;
|
|
48
|
+
isLimit ? onUpgrade() : onCreate();
|
|
49
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
50
|
+
setIsShowTooltip(false);
|
|
51
|
+
};
|
|
52
|
+
const onUpgrade = ()=>{
|
|
53
|
+
const eventUpgrade = new CustomEvent('editor:toolbar:upgrade', {
|
|
54
|
+
bubbles: true
|
|
55
|
+
});
|
|
56
|
+
window.dispatchEvent(eventUpgrade);
|
|
57
|
+
};
|
|
58
|
+
const onCreate = ()=>{
|
|
59
|
+
const eventCreate = new CustomEvent('editor:toolbar:create-theme-section', {
|
|
60
|
+
bubbles: true,
|
|
61
|
+
detail: {
|
|
62
|
+
componentUid: props.uid
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
window.dispatchEvent(eventCreate);
|
|
66
|
+
};
|
|
67
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
68
|
+
children: /*#__PURE__*/ jsxs(ThemeSectionTooltip, {
|
|
69
|
+
isFreeLimit: isFreeLimit,
|
|
70
|
+
limitCreateThemeSection: limitCreateThemeSection,
|
|
71
|
+
isShow: isShowTooltip,
|
|
72
|
+
isRender: isRenderTooltip,
|
|
73
|
+
onActions: onActions,
|
|
74
|
+
onMouseEnter: showTooltip,
|
|
75
|
+
onMouseLeave: hideTooltip,
|
|
76
|
+
children: [
|
|
77
|
+
isRenderTooltip && /*#__PURE__*/ jsx("div", {
|
|
78
|
+
"data-toolbar-create-theme-section": true,
|
|
79
|
+
children: "You can create reusable sections"
|
|
80
|
+
}),
|
|
81
|
+
/*#__PURE__*/ jsx("div", {
|
|
82
|
+
"data-toolbar-active-create-theme-section-wrapper": true,
|
|
83
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
84
|
+
"data-toolbar-active-create-theme-section": true,
|
|
85
|
+
onClick: (e)=>onActions(e, {
|
|
86
|
+
disabled: !!isLimit
|
|
87
|
+
}),
|
|
88
|
+
"aria-hidden": "true",
|
|
89
|
+
children: [
|
|
90
|
+
/*#__PURE__*/ jsxs("svg", {
|
|
91
|
+
width: "16",
|
|
92
|
+
height: "16",
|
|
93
|
+
viewBox: "0 0 16 16",
|
|
94
|
+
fill: "none",
|
|
95
|
+
children: [
|
|
96
|
+
/*#__PURE__*/ jsx("path", {
|
|
97
|
+
d: "M1 2C1 1.44772 1.44772 1 2 1H6C6.55228 1 7 1.44772 7 2V6C7 6.55228 6.55228 7 6 7H2C1.44772 7 1 6.55228 1 6V2Z",
|
|
98
|
+
fill: "#F9F9F9"
|
|
99
|
+
}),
|
|
100
|
+
/*#__PURE__*/ jsx("path", {
|
|
101
|
+
d: "M9 10C9 9.44772 9.44772 9 10 9H14C14.5523 9 15 9.44772 15 10V14C15 14.5523 14.5523 15 14 15H10C9.44772 15 9 14.5523 9 14V10Z",
|
|
102
|
+
fill: "#F9F9F9"
|
|
103
|
+
}),
|
|
104
|
+
/*#__PURE__*/ jsx("path", {
|
|
105
|
+
d: "M2 9C1.44772 9 1 9.44772 1 10V14C1 14.5523 1.44772 15 2 15H6C6.55228 15 7 14.5523 7 14V10C7 9.44772 6.55228 9 6 9H2Z",
|
|
106
|
+
fill: "#F9F9F9"
|
|
107
|
+
})
|
|
108
|
+
]
|
|
109
|
+
}),
|
|
110
|
+
/*#__PURE__*/ jsx("p", {
|
|
111
|
+
children: "Create Theme Section"
|
|
112
|
+
})
|
|
113
|
+
]
|
|
114
|
+
})
|
|
115
|
+
})
|
|
116
|
+
]
|
|
117
|
+
})
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export { CreateThemeSection };
|
|
@@ -1 +1,43 @@
|
|
|
1
|
-
import{jsx
|
|
1
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
const getStatusMessage = (status)=>{
|
|
4
|
+
switch(status){
|
|
5
|
+
case 'DRAFT':
|
|
6
|
+
return 'This Theme Section is Draft. Publish page will also publish Theme Section.';
|
|
7
|
+
case 'NEED_PUBLISHING':
|
|
8
|
+
return 'Need to republish. Go to global edit and publish this section';
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
const ThemeSectionStatusWrapper = ({ tag, status, isThemeSection })=>{
|
|
12
|
+
const isRenderThemeSectionStatus = tag === 'Section' && isThemeSection && (status === 'DRAFT' || status === 'NEED_PUBLISHING');
|
|
13
|
+
const statusMessage = getStatusMessage(status);
|
|
14
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
15
|
+
children: isRenderThemeSectionStatus && /*#__PURE__*/ jsxs("div", {
|
|
16
|
+
"data-theme-section-status": true,
|
|
17
|
+
children: [
|
|
18
|
+
/*#__PURE__*/ jsx("div", {
|
|
19
|
+
"data-theme-section-status-icon": true,
|
|
20
|
+
children: /*#__PURE__*/ jsx("svg", {
|
|
21
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
22
|
+
width: "16",
|
|
23
|
+
height: "16",
|
|
24
|
+
viewBox: "0 0 16 16",
|
|
25
|
+
fill: "none",
|
|
26
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
27
|
+
fillRule: "evenodd",
|
|
28
|
+
clipRule: "evenodd",
|
|
29
|
+
d: "M15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1C11.866 1 15 4.13401 15 8ZM8.4668 4.61597C8.4668 4.89211 8.24294 5.11597 7.9668 5.11597C7.69065 5.11597 7.4668 4.89211 7.4668 4.61597C7.4668 4.33982 7.69065 4.11597 7.9668 4.11597C8.24294 4.11597 8.4668 4.33982 8.4668 4.61597ZM6.91309 5.48633C6.63694 5.48633 6.41309 5.71019 6.41309 5.98633C6.41309 6.26247 6.63694 6.48633 6.91309 6.48633H7.56006V10.3839C7.56006 10.9362 8.00777 11.3839 8.56006 11.3839H9.57144C9.84758 11.3839 10.0714 11.1601 10.0714 10.8839C10.0714 10.6078 9.84758 10.3839 9.57144 10.3839H8.56006V6.48633C8.56006 5.93404 8.11234 5.48633 7.56006 5.48633H6.91309Z",
|
|
30
|
+
fill: "#9144DA"
|
|
31
|
+
})
|
|
32
|
+
})
|
|
33
|
+
}),
|
|
34
|
+
statusMessage && /*#__PURE__*/ jsx("span", {
|
|
35
|
+
"data-theme-section-status-text": true,
|
|
36
|
+
children: statusMessage
|
|
37
|
+
})
|
|
38
|
+
]
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export { ThemeSectionStatusWrapper };
|
|
@@ -1 +1,124 @@
|
|
|
1
|
-
import{jsx
|
|
1
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { useRef } from 'react';
|
|
3
|
+
import { Transition } from 'react-transition-group';
|
|
4
|
+
import { cls } from '@gem-sdk/core';
|
|
5
|
+
|
|
6
|
+
const TRANSITION_DURATION = 350;
|
|
7
|
+
const defaultStyles = {
|
|
8
|
+
transition: `opacity ${TRANSITION_DURATION}ms ease-out`,
|
|
9
|
+
opacity: 0
|
|
10
|
+
};
|
|
11
|
+
const transitions = {
|
|
12
|
+
entering: {
|
|
13
|
+
opacity: 1
|
|
14
|
+
},
|
|
15
|
+
entered: {
|
|
16
|
+
opacity: 1
|
|
17
|
+
},
|
|
18
|
+
exiting: {
|
|
19
|
+
opacity: 0
|
|
20
|
+
},
|
|
21
|
+
exited: {
|
|
22
|
+
opacity: 0
|
|
23
|
+
},
|
|
24
|
+
unmounted: {
|
|
25
|
+
opacity: 0
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const ThemeSectionTooltip = ({ isShow, isFreeLimit, isRender, children, limitCreateThemeSection, onMouseEnter, onMouseLeave, onActions })=>{
|
|
29
|
+
const nodeRef = useRef(null);
|
|
30
|
+
const actionBtnLabel = isFreeLimit ? 'Upgrade to create Theme Section' : 'Create Theme Section';
|
|
31
|
+
const openHelpCenter = ()=>{
|
|
32
|
+
const url = 'https://help.gempages.net/articles/theme-section';
|
|
33
|
+
window.open(url, '_blank');
|
|
34
|
+
};
|
|
35
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
36
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
37
|
+
className: "theme-section-tooltip-wrapper",
|
|
38
|
+
onMouseEnter: onMouseEnter,
|
|
39
|
+
onMouseLeave: onMouseLeave,
|
|
40
|
+
children: [
|
|
41
|
+
children,
|
|
42
|
+
isRender && /*#__PURE__*/ jsx(Transition, {
|
|
43
|
+
in: isShow,
|
|
44
|
+
timeout: TRANSITION_DURATION,
|
|
45
|
+
nodeRef: nodeRef,
|
|
46
|
+
unmountOnExit: true,
|
|
47
|
+
children: (state)=>/*#__PURE__*/ jsx("div", {
|
|
48
|
+
className: "theme-section-tooltip",
|
|
49
|
+
ref: nodeRef,
|
|
50
|
+
style: {
|
|
51
|
+
...defaultStyles,
|
|
52
|
+
...transitions[state]
|
|
53
|
+
},
|
|
54
|
+
children: limitCreateThemeSection?.isLimit && !isFreeLimit ? /*#__PURE__*/ jsxs("div", {
|
|
55
|
+
className: "theme-section-tooltip__body theme-section-tooltip__body-limit",
|
|
56
|
+
children: [
|
|
57
|
+
/*#__PURE__*/ jsx("div", {
|
|
58
|
+
className: "theme-section-tooltip__body-title theme-section-tooltip__body-limit__title",
|
|
59
|
+
children: "Upgrade plan"
|
|
60
|
+
}),
|
|
61
|
+
/*#__PURE__*/ jsxs("div", {
|
|
62
|
+
className: "theme-section-tooltip__body-desc theme-section-tooltip__body-limit__desc",
|
|
63
|
+
children: [
|
|
64
|
+
"You’ve reached the maximum number of theme sections on your plan (",
|
|
65
|
+
limitCreateThemeSection.total,
|
|
66
|
+
"/",
|
|
67
|
+
limitCreateThemeSection.limit,
|
|
68
|
+
")"
|
|
69
|
+
]
|
|
70
|
+
}),
|
|
71
|
+
/*#__PURE__*/ jsx("button", {
|
|
72
|
+
onClick: (e)=>onActions(e),
|
|
73
|
+
children: "Upgrade plan to create more"
|
|
74
|
+
})
|
|
75
|
+
]
|
|
76
|
+
}) : /*#__PURE__*/ jsxs(Fragment, {
|
|
77
|
+
children: [
|
|
78
|
+
/*#__PURE__*/ jsx("div", {
|
|
79
|
+
className: "theme-section-tooltip__image",
|
|
80
|
+
children: /*#__PURE__*/ jsx("img", {
|
|
81
|
+
src: "https://ucarecdn.com/6a9f408a-aa8c-434a-890b-81067a14aceb/-/format/auto/-/preview/1920x1920/-/quality/lighter/theme-section-illustration.png",
|
|
82
|
+
alt: ""
|
|
83
|
+
})
|
|
84
|
+
}),
|
|
85
|
+
/*#__PURE__*/ jsxs("div", {
|
|
86
|
+
className: "theme-section-tooltip__body",
|
|
87
|
+
children: [
|
|
88
|
+
/*#__PURE__*/ jsx("div", {
|
|
89
|
+
className: "theme-section-tooltip__body-title",
|
|
90
|
+
children: "Create once, use everywhere with Theme Section"
|
|
91
|
+
}),
|
|
92
|
+
/*#__PURE__*/ jsx("div", {
|
|
93
|
+
className: "theme-section-tooltip__body-desc",
|
|
94
|
+
children: "A global section that can be used on all your GemPages & Shopify pages."
|
|
95
|
+
})
|
|
96
|
+
]
|
|
97
|
+
}),
|
|
98
|
+
/*#__PURE__*/ jsxs("div", {
|
|
99
|
+
className: cls('theme-section-tooltip__action', {
|
|
100
|
+
'theme-section-tooltip__action-limit': isFreeLimit
|
|
101
|
+
}),
|
|
102
|
+
children: [
|
|
103
|
+
/*#__PURE__*/ jsx("button", {
|
|
104
|
+
onClick: (e)=>onActions(e),
|
|
105
|
+
children: actionBtnLabel
|
|
106
|
+
}),
|
|
107
|
+
isFreeLimit && /*#__PURE__*/ jsx("div", {
|
|
108
|
+
onClick: openHelpCenter,
|
|
109
|
+
"aria-hidden": true,
|
|
110
|
+
className: "theme-section-tooltip__action-learn-more",
|
|
111
|
+
children: "Learn more about Theme Section"
|
|
112
|
+
})
|
|
113
|
+
]
|
|
114
|
+
})
|
|
115
|
+
]
|
|
116
|
+
})
|
|
117
|
+
})
|
|
118
|
+
})
|
|
119
|
+
]
|
|
120
|
+
})
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
export { ThemeSectionTooltip };
|
|
@@ -1 +1,24 @@
|
|
|
1
|
-
import{jsxs
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
function Tooltip({ children, enable, text = 'Tooltip Text', position = 'right', width, ...props }) {
|
|
4
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
5
|
+
...props,
|
|
6
|
+
"data-toolbar-tooltip-trigger": true,
|
|
7
|
+
children: [
|
|
8
|
+
children,
|
|
9
|
+
enable && /*#__PURE__*/ jsx("div", {
|
|
10
|
+
style: {
|
|
11
|
+
width: width,
|
|
12
|
+
zIndex: 50
|
|
13
|
+
},
|
|
14
|
+
"data-toolbar-tooltip": true,
|
|
15
|
+
"data-toolbar-tooltip-position": position,
|
|
16
|
+
dangerouslySetInnerHTML: {
|
|
17
|
+
__html: text
|
|
18
|
+
}
|
|
19
|
+
})
|
|
20
|
+
]
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { Tooltip as default };
|