@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,252 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var AIIcon = require('./icons/AIIcon.js');
|
|
6
|
+
var CloseIcon = require('./icons/CloseIcon.js');
|
|
7
|
+
var ShowMoreIcon = require('./icons/ShowMoreIcon.js');
|
|
8
|
+
var WarningIcon = require('./icons/WarningIcon.js');
|
|
9
|
+
var UpgradeIcon = require('./icons/UpgradeIcon.js');
|
|
10
|
+
var PickProduct = require('./components/PickProduct.js');
|
|
11
|
+
var ToneAndVoice = require('./components/ToneAndVoice.js');
|
|
12
|
+
var classNames = require('classnames');
|
|
13
|
+
var useListenEventGenerate = require('./hooks/useListenEventGenerate.js');
|
|
14
|
+
var useGettingGenerateRequest = require('./hooks/useGettingGenerateRequest.js');
|
|
15
|
+
var useFlipPopup = require('./hooks/useFlipPopup.js');
|
|
16
|
+
var useCheckingProductInside = require('./hooks/useCheckingProductInside.js');
|
|
17
|
+
require('zustand');
|
|
18
|
+
require('react-transition-group');
|
|
19
|
+
require('@gem-sdk/core');
|
|
20
|
+
var ShopContext = require('../../contexts/ShopContext.js');
|
|
21
|
+
var dayjs = require('dayjs');
|
|
22
|
+
require('swr');
|
|
23
|
+
require('../../helpers/convert.js');
|
|
24
|
+
require('@gem-sdk/adapter-shopify');
|
|
25
|
+
require('swr/mutation');
|
|
26
|
+
require('swr/infinite');
|
|
27
|
+
require('vanilla-lazyload');
|
|
28
|
+
require('../../hooks/useCartUI.js');
|
|
29
|
+
|
|
30
|
+
const AIContentGenerator = ({ ...props })=>{
|
|
31
|
+
const [isShowPopup, setIsShowPopup] = react.useState(false);
|
|
32
|
+
const [isShowMore, setIsShowMore] = react.useState(false);
|
|
33
|
+
const genTool = react.useRef(null);
|
|
34
|
+
const genPopup = react.useRef(null);
|
|
35
|
+
const genPopupHeader = react.useRef(null);
|
|
36
|
+
const genButtonWrapper = react.useRef(null);
|
|
37
|
+
const nextMonth = dayjs().add(1, 'month').startOf('month').format('DD MMM');
|
|
38
|
+
const { popupPositionX, popupPositionY, isValidating: isValidatingFlipPopup, bodyMaxHeight: popupBodyMaxHeight } = useFlipPopup.useFlipPopup(isShowPopup, {
|
|
39
|
+
genTool,
|
|
40
|
+
genPopup,
|
|
41
|
+
genPopupHeader,
|
|
42
|
+
genButtonWrapper
|
|
43
|
+
});
|
|
44
|
+
const { isGenerating, onGenerate, onOpenProductElementSettings, goToPricing } = useListenEventGenerate.useListenEventGenerate({
|
|
45
|
+
uid: props.uid,
|
|
46
|
+
tag: String(props.tag)
|
|
47
|
+
});
|
|
48
|
+
const { getRequestBody, prompt, changeProductName, changePrompt, changeTone } = useGettingGenerateRequest.useGettingGenerateRequest();
|
|
49
|
+
const { productElement, checkSectionHasProduct } = useCheckingProductInside.useCheckingProductInside(genTool);
|
|
50
|
+
const generateLimitation = ShopContext.useShopStore((s)=>s.generateContentLimitation);
|
|
51
|
+
const togglePopup = ()=>{
|
|
52
|
+
setIsShowPopup(!isShowPopup);
|
|
53
|
+
};
|
|
54
|
+
const hidePopup = ()=>{
|
|
55
|
+
setIsShowPopup(false);
|
|
56
|
+
};
|
|
57
|
+
const onChangePrompt = (e)=>{
|
|
58
|
+
changePrompt(e.target.value);
|
|
59
|
+
};
|
|
60
|
+
const onActiveComponent = react.useCallback((e)=>{
|
|
61
|
+
const detail = e.detail;
|
|
62
|
+
if (detail?.componentUid !== props.uid) {
|
|
63
|
+
hidePopup();
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
checkSectionHasProduct();
|
|
67
|
+
}, [
|
|
68
|
+
props.uid,
|
|
69
|
+
checkSectionHasProduct
|
|
70
|
+
]);
|
|
71
|
+
const toggleShowMore = ()=>{
|
|
72
|
+
setIsShowMore(!isShowMore);
|
|
73
|
+
};
|
|
74
|
+
const handleGenerateContent = ()=>{
|
|
75
|
+
const body = getRequestBody();
|
|
76
|
+
onGenerate(body);
|
|
77
|
+
hidePopup();
|
|
78
|
+
};
|
|
79
|
+
const handleOpenProductSetting = ()=>{
|
|
80
|
+
onOpenProductElementSettings(productElement.uid ?? '');
|
|
81
|
+
};
|
|
82
|
+
react.useEffect(()=>{
|
|
83
|
+
if (!isGenerating) {
|
|
84
|
+
hidePopup();
|
|
85
|
+
}
|
|
86
|
+
}, [
|
|
87
|
+
isGenerating
|
|
88
|
+
]);
|
|
89
|
+
react.useEffect(()=>{
|
|
90
|
+
if (productElement.productId) {
|
|
91
|
+
setIsShowMore(false);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
setIsShowMore(true);
|
|
95
|
+
}, [
|
|
96
|
+
productElement
|
|
97
|
+
]);
|
|
98
|
+
react.useEffect(()=>{
|
|
99
|
+
window.addEventListener('editor:active-component', onActiveComponent);
|
|
100
|
+
return ()=>{
|
|
101
|
+
window.removeEventListener('editor:active-component', onActiveComponent);
|
|
102
|
+
};
|
|
103
|
+
}, [
|
|
104
|
+
onActiveComponent
|
|
105
|
+
]);
|
|
106
|
+
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
107
|
+
className: "gp-gen-content-toolbar-wrapper gp-relative",
|
|
108
|
+
ref: genTool,
|
|
109
|
+
children: [
|
|
110
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
111
|
+
className: "gp-gen-content-btn gp-border-r gp-pr-1 gp-mr-1",
|
|
112
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs("button", {
|
|
113
|
+
className: classNames({
|
|
114
|
+
'gp-toolbar-ai-active': isShowPopup
|
|
115
|
+
}, 'gp-p-1 gp-text-xs gp-flex gp-gap-1 gp-items-center gp-rounded-md hover:gp-bg-[#3B3B3B] gp-font-medium'),
|
|
116
|
+
onClick: togglePopup,
|
|
117
|
+
children: [
|
|
118
|
+
/*#__PURE__*/ jsxRuntime.jsx(AIIcon.AIIcon, {}),
|
|
119
|
+
"AI Content"
|
|
120
|
+
]
|
|
121
|
+
})
|
|
122
|
+
}),
|
|
123
|
+
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
124
|
+
className: classNames({
|
|
125
|
+
'gp-hidden': !isShowPopup,
|
|
126
|
+
'gp-right-0': props.tag === 'Section' || popupPositionX === 'right',
|
|
127
|
+
'gp-left-0': popupPositionX === 'left' && props.tag !== 'Section',
|
|
128
|
+
'gp-top-8': popupPositionY === 'top',
|
|
129
|
+
'gp-bottom-8': popupPositionY === 'bottom',
|
|
130
|
+
'!gp-visible': !isValidatingFlipPopup
|
|
131
|
+
}, 'gp-absolute gp-invisible gp-rounded-lg gp-bg-[#151515] gp-w-[312px] !gp-max-w-[312px] !gp-cursor-default'),
|
|
132
|
+
ref: genPopup,
|
|
133
|
+
children: [
|
|
134
|
+
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
135
|
+
className: "gp-flex gp-items-center gp-justify-between gp-px-4 gp-py-[10px]",
|
|
136
|
+
ref: genPopupHeader,
|
|
137
|
+
children: [
|
|
138
|
+
/*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
139
|
+
className: "gp-font-medium gp-text-sm",
|
|
140
|
+
children: "Write with GemAI"
|
|
141
|
+
}),
|
|
142
|
+
/*#__PURE__*/ jsxRuntime.jsx("button", {
|
|
143
|
+
className: "gp-p-2 gp-cursor-pointer hover:gp-bg-[#3B3B3B] gp-rounded-md",
|
|
144
|
+
onClick: hidePopup,
|
|
145
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(CloseIcon.CloseIcon, {})
|
|
146
|
+
})
|
|
147
|
+
]
|
|
148
|
+
}),
|
|
149
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
150
|
+
className: classNames({
|
|
151
|
+
'gp-overflow-auto': popupBodyMaxHeight !== null
|
|
152
|
+
}, 'gp-pt-2 gp-text-left gp-px-4 scrollbar:gp-w-1 scrollbar-thumb:gp-bg-[#999] scrollbar-thumb:gp-rounded-xl'),
|
|
153
|
+
style: {
|
|
154
|
+
maxHeight: popupBodyMaxHeight !== null ? `${popupBodyMaxHeight}px` : 'auto'
|
|
155
|
+
},
|
|
156
|
+
children: generateLimitation?.isAllow ? /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
157
|
+
children: [
|
|
158
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
159
|
+
className: "gp-mb-4",
|
|
160
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
161
|
+
className: "gp-text-xs",
|
|
162
|
+
children: "What would you like to describe here?"
|
|
163
|
+
})
|
|
164
|
+
}),
|
|
165
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
166
|
+
className: "gp-mb-4 gp-flex",
|
|
167
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("textarea", {
|
|
168
|
+
className: "gp-p-2 gp-bg-[#333333] gp-rounded-lg gp-w-full gp-text-xs gp-text-white placeholder:gp-text-[#AAAAAA] gp-resize-none focus-visible:gp-outline-none",
|
|
169
|
+
placeholder: "e.g: generate feature benefits",
|
|
170
|
+
rows: 4,
|
|
171
|
+
value: prompt,
|
|
172
|
+
onChange: onChangePrompt
|
|
173
|
+
})
|
|
174
|
+
}),
|
|
175
|
+
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
176
|
+
className: classNames({
|
|
177
|
+
'gp-hidden': !isShowMore
|
|
178
|
+
}, 'gp-mb-4 gp-gap-4 gp-flex gp-flex-col'),
|
|
179
|
+
children: [
|
|
180
|
+
/*#__PURE__*/ jsxRuntime.jsx(ToneAndVoice.ToneAndVoice, {
|
|
181
|
+
changeToneAndVoice: changeTone
|
|
182
|
+
}),
|
|
183
|
+
/*#__PURE__*/ jsxRuntime.jsx(PickProduct.PickProduct, {
|
|
184
|
+
changeProductName: changeProductName,
|
|
185
|
+
openProductSetting: handleOpenProductSetting,
|
|
186
|
+
productId: productElement.productId
|
|
187
|
+
})
|
|
188
|
+
]
|
|
189
|
+
}),
|
|
190
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
191
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs("button", {
|
|
192
|
+
className: "gp-flex gp-justify-center gp-items-center gp-w-full gp-bg-[#333333] gp-py-2 gp-rounded-lg gp-gap-2 gp-text-xs gp-font-medium",
|
|
193
|
+
onClick: toggleShowMore,
|
|
194
|
+
children: [
|
|
195
|
+
"Show more",
|
|
196
|
+
/*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
197
|
+
className: classNames({
|
|
198
|
+
'gp-rotate-180': isShowMore
|
|
199
|
+
}),
|
|
200
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(ShowMoreIcon.ShowMoreIcon, {})
|
|
201
|
+
})
|
|
202
|
+
]
|
|
203
|
+
})
|
|
204
|
+
})
|
|
205
|
+
]
|
|
206
|
+
}) : /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
207
|
+
className: "gp-flex gp-gap-2 gp-p-3 gp-rounded-xl gp-bg-[#FDB913] gp-bg-opacity-20",
|
|
208
|
+
children: [
|
|
209
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
210
|
+
className: "gp-flex-none gp-w-7 gp-h-7 gp-rounded-lg gp-bg-[#FFB800] gp-flex gp-justify-center gp-items-center",
|
|
211
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(WarningIcon.WarningIcon, {})
|
|
212
|
+
}),
|
|
213
|
+
/*#__PURE__*/ jsxRuntime.jsxs("p", {
|
|
214
|
+
className: "gp-text-xs gp-whitespace-normal",
|
|
215
|
+
children: [
|
|
216
|
+
"You've reached ",
|
|
217
|
+
generateLimitation?.maxGenerateCount,
|
|
218
|
+
"/",
|
|
219
|
+
generateLimitation?.maxGenerateCount,
|
|
220
|
+
" rewrites of your AI generative this month.",
|
|
221
|
+
/*#__PURE__*/ jsxRuntime.jsx("br", {}),
|
|
222
|
+
"Resets on ",
|
|
223
|
+
nextMonth,
|
|
224
|
+
"."
|
|
225
|
+
]
|
|
226
|
+
})
|
|
227
|
+
]
|
|
228
|
+
})
|
|
229
|
+
}),
|
|
230
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
231
|
+
className: "gp-p-4",
|
|
232
|
+
ref: genButtonWrapper,
|
|
233
|
+
children: generateLimitation?.isAllow ? /*#__PURE__*/ jsxRuntime.jsx("button", {
|
|
234
|
+
className: "gp-rounded-lg gp-w-full gp-text-xs gp-font-medium gp-bg-gradient-to-tl gp-from-[#3C38E1] gp-to-[#874CFD] gp-py-2",
|
|
235
|
+
onClick: handleGenerateContent,
|
|
236
|
+
children: isGenerating ? 'Generating...' : 'Generate'
|
|
237
|
+
}) : /*#__PURE__*/ jsxRuntime.jsxs("button", {
|
|
238
|
+
className: "gp-flex gp-items-center gp-gap-2 gp-justify-center gp-rounded-lg gp-w-full gp-text-xs gp-font-medium gp-bg-gradient-to-tl gp-from-[#3C38E1] gp-to-[#874CFD] gp-py-2",
|
|
239
|
+
onClick: goToPricing,
|
|
240
|
+
children: [
|
|
241
|
+
/*#__PURE__*/ jsxRuntime.jsx(UpgradeIcon.UpgradeIcon, {}),
|
|
242
|
+
generateLimitation?.nextQuota ? `Upgrade to generate ${generateLimitation?.nextQuota} rewrites` : 'You have reached limit this month'
|
|
243
|
+
]
|
|
244
|
+
})
|
|
245
|
+
})
|
|
246
|
+
]
|
|
247
|
+
})
|
|
248
|
+
]
|
|
249
|
+
});
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
exports.AIContentGenerator = AIContentGenerator;
|
|
@@ -1 +1,85 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var AIIcon = require('./icons/AIIcon.js');
|
|
6
|
+
|
|
7
|
+
function getRandomArbitrary(min, max) {
|
|
8
|
+
const randomNum = Math.random();
|
|
9
|
+
return randomNum * (max - min) + min;
|
|
10
|
+
}
|
|
11
|
+
const AIGenContentLoading = ({ ...props })=>{
|
|
12
|
+
const [isGenerating, setIsGenerating] = react.useState(false);
|
|
13
|
+
const [time, setTime] = react.useState(0);
|
|
14
|
+
const interval = react.useRef(null);
|
|
15
|
+
const onGenerateContentStatus = react.useCallback((e)=>{
|
|
16
|
+
const detail = e.detail;
|
|
17
|
+
if (detail?.generatingUid !== props.uid) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if (detail.status === 'loading') {
|
|
21
|
+
setIsGenerating(true);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (detail.status === 'success') {
|
|
25
|
+
setIsGenerating(false);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
}, [
|
|
29
|
+
props.uid
|
|
30
|
+
]);
|
|
31
|
+
react.useEffect(()=>{
|
|
32
|
+
if (isGenerating) {
|
|
33
|
+
handleFakeLoading();
|
|
34
|
+
} else {
|
|
35
|
+
setTime(0);
|
|
36
|
+
}
|
|
37
|
+
return ()=>{
|
|
38
|
+
interval.current && clearInterval(interval.current);
|
|
39
|
+
};
|
|
40
|
+
}, [
|
|
41
|
+
isGenerating
|
|
42
|
+
]);
|
|
43
|
+
const handleFakeLoading = ()=>{
|
|
44
|
+
setTime(0);
|
|
45
|
+
interval.current = setInterval(()=>{
|
|
46
|
+
setTime((time)=>{
|
|
47
|
+
const randomNum = getRandomArbitrary(0, 6);
|
|
48
|
+
return time >= 580 ? time : time + randomNum;
|
|
49
|
+
});
|
|
50
|
+
}, 50);
|
|
51
|
+
};
|
|
52
|
+
react.useEffect(()=>{
|
|
53
|
+
window.addEventListener('editor:ai-generate-content-status', onGenerateContentStatus);
|
|
54
|
+
return ()=>{
|
|
55
|
+
window.removeEventListener('editor:ai-generate-content-status', onGenerateContentStatus);
|
|
56
|
+
};
|
|
57
|
+
}, [
|
|
58
|
+
onGenerateContentStatus
|
|
59
|
+
]);
|
|
60
|
+
return isGenerating ? /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
61
|
+
className: "gp-absolute gp-top-0 gp-left-0 gp-w-full gp-h-full gp-bg-white gp-bg-opacity-70 gp-flex gp-justify-center gp-items-center gp-z-100 gp-gap-2",
|
|
62
|
+
children: [
|
|
63
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
64
|
+
className: "gp-absolute gp-left-0 gp-top-0 gp-z-2 gp-flex gp-h-full gp-w-full",
|
|
65
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
66
|
+
className: `gp-relative gp-h-[2px] gp-w-full gp-overflow-hidden gp-rounded-md`,
|
|
67
|
+
children: [
|
|
68
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
69
|
+
className: "gp-absolute gp-h-full gp-w-full gp-rounded-md gp-bg-[#F4F4F4]"
|
|
70
|
+
}),
|
|
71
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
72
|
+
className: "gps-image-to-layout-progress-bar gp-absolute gp-h-full gp-rounded-md gp-transition-all",
|
|
73
|
+
style: {
|
|
74
|
+
width: `${time / 600 * 100}%`
|
|
75
|
+
}
|
|
76
|
+
})
|
|
77
|
+
]
|
|
78
|
+
})
|
|
79
|
+
}),
|
|
80
|
+
/*#__PURE__*/ jsxRuntime.jsx(AIIcon.AIIcon, {})
|
|
81
|
+
]
|
|
82
|
+
}) : null;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
exports.AIGenContentLoading = AIGenContentLoading;
|
|
@@ -1 +1,220 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var SearchIcon = require('../icons/SearchIcon.js');
|
|
6
|
+
var useProductsQuery = require('../../../hooks/shop/use-products-query.js');
|
|
7
|
+
var classNames = require('classnames');
|
|
8
|
+
require('zustand');
|
|
9
|
+
require('react-transition-group');
|
|
10
|
+
require('@gem-sdk/core');
|
|
11
|
+
require('swr');
|
|
12
|
+
require('dayjs');
|
|
13
|
+
require('../../../helpers/convert.js');
|
|
14
|
+
require('@gem-sdk/adapter-shopify');
|
|
15
|
+
require('swr/mutation');
|
|
16
|
+
var useProductQuery = require('../../../hooks/shop/use-product-query.js');
|
|
17
|
+
require('vanilla-lazyload');
|
|
18
|
+
require('../../../hooks/useCartUI.js');
|
|
19
|
+
|
|
20
|
+
const PickProduct = (props)=>{
|
|
21
|
+
const LIMIT_PRODUCTS = 8;
|
|
22
|
+
const [productVariables, setProductVariables] = react.useState(!props.productId ? {
|
|
23
|
+
first: LIMIT_PRODUCTS
|
|
24
|
+
} : undefined);
|
|
25
|
+
const { data: productList, isLoading: isLoadingGetProducts, isValidating: isValidatingGetProducts, size: productsSize, setSize: setProductsSize } = useProductsQuery.useListProductQuery(productVariables, {
|
|
26
|
+
revalidateFirstPage: false
|
|
27
|
+
});
|
|
28
|
+
const { data: sectionProduct } = useProductQuery.useProductQuery(props.productId);
|
|
29
|
+
const [activeProduct, setActiveProduct] = react.useState();
|
|
30
|
+
const [isShowChooseProduct, setIsShowChooseProduct] = react.useState(false);
|
|
31
|
+
const debounceSearch = react.useRef(null);
|
|
32
|
+
const debounceScroll = react.useRef(null);
|
|
33
|
+
const toggleChooseProduct = ()=>{
|
|
34
|
+
if (props.productId) return;
|
|
35
|
+
setIsShowChooseProduct(!isShowChooseProduct);
|
|
36
|
+
};
|
|
37
|
+
const chooseProduct = (product)=>{
|
|
38
|
+
setActiveProduct(product);
|
|
39
|
+
setIsShowChooseProduct(false);
|
|
40
|
+
};
|
|
41
|
+
const searchProduct = (e)=>{
|
|
42
|
+
debounceSearch.current && clearTimeout(debounceSearch.current);
|
|
43
|
+
debounceSearch.current = setTimeout(()=>{
|
|
44
|
+
const searchValue = e.target.value ?? '';
|
|
45
|
+
if (searchValue) {
|
|
46
|
+
setProductVariables({
|
|
47
|
+
first: LIMIT_PRODUCTS,
|
|
48
|
+
where: {
|
|
49
|
+
titleContainsFold: searchValue
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
setProductVariables({
|
|
55
|
+
first: LIMIT_PRODUCTS
|
|
56
|
+
});
|
|
57
|
+
}, 200);
|
|
58
|
+
};
|
|
59
|
+
const handleOpenProductElementSettings = ()=>{
|
|
60
|
+
props.openProductSetting();
|
|
61
|
+
};
|
|
62
|
+
const handleLoadMore = (e)=>{
|
|
63
|
+
const target = e.target;
|
|
64
|
+
if (target.scrollHeight - target.scrollTop === target.clientHeight) {
|
|
65
|
+
debounceScroll.current && clearTimeout(debounceScroll.current);
|
|
66
|
+
debounceScroll.current = setTimeout(()=>{
|
|
67
|
+
setProductsSize(productsSize + 1);
|
|
68
|
+
}, 50);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const products = react.useMemo(()=>{
|
|
72
|
+
return productList?.reduce((acc, curr)=>{
|
|
73
|
+
return [
|
|
74
|
+
...acc,
|
|
75
|
+
...curr.products?.edges ?? []
|
|
76
|
+
];
|
|
77
|
+
}, []) ?? [];
|
|
78
|
+
}, [
|
|
79
|
+
productList
|
|
80
|
+
]);
|
|
81
|
+
react.useEffect(()=>{
|
|
82
|
+
if (products.length && !activeProduct && !props.productId) {
|
|
83
|
+
const firstProduct = products[0]?.node;
|
|
84
|
+
if (!firstProduct) return;
|
|
85
|
+
setActiveProduct({
|
|
86
|
+
id: firstProduct?.id,
|
|
87
|
+
name: firstProduct?.title,
|
|
88
|
+
image: firstProduct.featuredImage?.src
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}, [
|
|
92
|
+
products,
|
|
93
|
+
activeProduct,
|
|
94
|
+
props.productId
|
|
95
|
+
]);
|
|
96
|
+
react.useEffect(()=>{
|
|
97
|
+
if (activeProduct && activeProduct.name) {
|
|
98
|
+
props.changeProductName(activeProduct.name);
|
|
99
|
+
}
|
|
100
|
+
}, [
|
|
101
|
+
activeProduct,
|
|
102
|
+
props
|
|
103
|
+
]);
|
|
104
|
+
react.useEffect(()=>{
|
|
105
|
+
if (sectionProduct) {
|
|
106
|
+
setActiveProduct({
|
|
107
|
+
id: sectionProduct.id,
|
|
108
|
+
name: sectionProduct.title,
|
|
109
|
+
image: sectionProduct.featuredImage?.src
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}, [
|
|
113
|
+
sectionProduct
|
|
114
|
+
]);
|
|
115
|
+
const NO_IMAGE_SRC = 'https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif';
|
|
116
|
+
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
117
|
+
className: "gp-flex gp-flex-col gp-gap-2",
|
|
118
|
+
children: [
|
|
119
|
+
/*#__PURE__*/ jsxRuntime.jsx("p", {
|
|
120
|
+
className: "gp-py-2 gp-text-xs",
|
|
121
|
+
children: "Product"
|
|
122
|
+
}),
|
|
123
|
+
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
124
|
+
className: "gp-relative",
|
|
125
|
+
children: [
|
|
126
|
+
!isLoadingGetProducts || activeProduct ? /*#__PURE__*/ jsxRuntime.jsxs("button", {
|
|
127
|
+
className: classNames({
|
|
128
|
+
'gp-cursor-default': props.productId
|
|
129
|
+
}, 'gp-flex gp-gap-2 gp-items-center gp-w-full gp-p-2 gp-rounded-lg gp-bg-[#333333] gp-text-xs'),
|
|
130
|
+
onClick: toggleChooseProduct,
|
|
131
|
+
children: [
|
|
132
|
+
/*#__PURE__*/ jsxRuntime.jsx("img", {
|
|
133
|
+
className: "gp-rounded-lg gp-w-10 gp-h-10",
|
|
134
|
+
src: activeProduct?.image || NO_IMAGE_SRC,
|
|
135
|
+
alt: "product_image"
|
|
136
|
+
}),
|
|
137
|
+
/*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
138
|
+
className: "gp-truncate gp-max-w-[210px]",
|
|
139
|
+
children: activeProduct?.name
|
|
140
|
+
})
|
|
141
|
+
]
|
|
142
|
+
}) : /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
143
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
144
|
+
className: "gp-text-xs",
|
|
145
|
+
children: "Getting products..."
|
|
146
|
+
})
|
|
147
|
+
}),
|
|
148
|
+
props.productId && /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
149
|
+
className: "gp-mt-2 gp-text-xs",
|
|
150
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs("p", {
|
|
151
|
+
children: [
|
|
152
|
+
"You can manage it in",
|
|
153
|
+
' ',
|
|
154
|
+
/*#__PURE__*/ jsxRuntime.jsx("button", {
|
|
155
|
+
className: "gp-text-[#8AA4FF] gp-cursor-pointer hover:gp-underline",
|
|
156
|
+
onClick: handleOpenProductElementSettings,
|
|
157
|
+
children: "Product element"
|
|
158
|
+
})
|
|
159
|
+
]
|
|
160
|
+
})
|
|
161
|
+
}),
|
|
162
|
+
isShowChooseProduct && /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
163
|
+
className: "gp-absolute gp-w-full gp-top-16 gp-left-0 gp-rounded-lg gp-bg-[#333333] gp-p-2 gp-flex gp-flex-col gp-gap-2 gp-z-10",
|
|
164
|
+
children: [
|
|
165
|
+
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
166
|
+
className: "gp-flex gp-items-center gp-gap-2 gp-p-2",
|
|
167
|
+
children: [
|
|
168
|
+
/*#__PURE__*/ jsxRuntime.jsx(SearchIcon.SearchIcon, {}),
|
|
169
|
+
/*#__PURE__*/ jsxRuntime.jsx("input", {
|
|
170
|
+
className: "gp-bg-transparent gp-w-full focus-visible:!gp-outline-none gp-text-xs",
|
|
171
|
+
placeholder: "Search product...",
|
|
172
|
+
onChange: searchProduct
|
|
173
|
+
})
|
|
174
|
+
]
|
|
175
|
+
}),
|
|
176
|
+
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
177
|
+
className: "gp-max-h-[168px] gp-overflow-auto scrollbar:gp-w-1 scrollbar-thumb:gp-bg-[#999] scrollbar-thumb:gp-rounded-xl",
|
|
178
|
+
onScroll: handleLoadMore,
|
|
179
|
+
children: [
|
|
180
|
+
products?.map((item)=>{
|
|
181
|
+
return /*#__PURE__*/ jsxRuntime.jsxs("button", {
|
|
182
|
+
className: "gp-flex gp-p-2 hover:gp-bg-[#3B3B3B] gp-rounded-lg gp-cursor-pointer gp-gap-2 gp-items-center",
|
|
183
|
+
onClick: ()=>{
|
|
184
|
+
chooseProduct({
|
|
185
|
+
id: item.node?.id,
|
|
186
|
+
name: item.node?.title,
|
|
187
|
+
image: item.node?.featuredImage?.src
|
|
188
|
+
});
|
|
189
|
+
},
|
|
190
|
+
children: [
|
|
191
|
+
/*#__PURE__*/ jsxRuntime.jsx("img", {
|
|
192
|
+
className: "gp-rounded-lg gp-w-10 gp-h-10",
|
|
193
|
+
src: item.node?.featuredImage?.src || NO_IMAGE_SRC,
|
|
194
|
+
alt: "product_image"
|
|
195
|
+
}),
|
|
196
|
+
/*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
197
|
+
className: "gp-truncate gp-max-w-[210px] gp-text-xs",
|
|
198
|
+
children: item.node?.title
|
|
199
|
+
})
|
|
200
|
+
]
|
|
201
|
+
}, item.node?.id);
|
|
202
|
+
}),
|
|
203
|
+
isLoadingGetProducts || isValidatingGetProducts && /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
204
|
+
className: "gp-p-2",
|
|
205
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
206
|
+
className: "gp-text-xs",
|
|
207
|
+
children: "Getting products..."
|
|
208
|
+
})
|
|
209
|
+
})
|
|
210
|
+
]
|
|
211
|
+
})
|
|
212
|
+
]
|
|
213
|
+
})
|
|
214
|
+
]
|
|
215
|
+
})
|
|
216
|
+
]
|
|
217
|
+
});
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
exports.PickProduct = PickProduct;
|
|
@@ -1 +1,77 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var DropdownIcon = require('../icons/DropdownIcon.js');
|
|
6
|
+
var classNames = require('classnames');
|
|
7
|
+
|
|
8
|
+
const ToneAndVoice = (props)=>{
|
|
9
|
+
const listToneAndVoice = [
|
|
10
|
+
'Persuasive',
|
|
11
|
+
'Friendly',
|
|
12
|
+
'Professional',
|
|
13
|
+
'Casual'
|
|
14
|
+
];
|
|
15
|
+
const [tone, setTone] = react.useState(listToneAndVoice[0]);
|
|
16
|
+
const [isShow, setIsShow] = react.useState(false);
|
|
17
|
+
const toggle = ()=>{
|
|
18
|
+
setIsShow(!isShow);
|
|
19
|
+
};
|
|
20
|
+
const setValue = (value)=>{
|
|
21
|
+
setTone(value);
|
|
22
|
+
setIsShow(false);
|
|
23
|
+
};
|
|
24
|
+
react.useEffect(()=>{
|
|
25
|
+
tone && props.changeToneAndVoice(tone);
|
|
26
|
+
}, [
|
|
27
|
+
tone,
|
|
28
|
+
props
|
|
29
|
+
]);
|
|
30
|
+
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
31
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
32
|
+
className: "gp-flex gp-flex-col gp-gap-2",
|
|
33
|
+
children: [
|
|
34
|
+
/*#__PURE__*/ jsxRuntime.jsx("p", {
|
|
35
|
+
className: "gp-py-2 gp-text-xs",
|
|
36
|
+
children: "Tone and Voice"
|
|
37
|
+
}),
|
|
38
|
+
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
39
|
+
className: "gp-relative",
|
|
40
|
+
children: [
|
|
41
|
+
/*#__PURE__*/ jsxRuntime.jsxs("button", {
|
|
42
|
+
className: "gp-flex gp-justify-between gp-items-center gp-w-full gp-p-2 gp-rounded-lg gp-bg-[#333333] gp-text-xs",
|
|
43
|
+
onClick: toggle,
|
|
44
|
+
children: [
|
|
45
|
+
tone,
|
|
46
|
+
/*#__PURE__*/ jsxRuntime.jsx(DropdownIcon.DropdownIcon, {})
|
|
47
|
+
]
|
|
48
|
+
}),
|
|
49
|
+
isShow ? /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
50
|
+
className: "gp-absolute gp-w-full gp-top-10 gp-left-0 gp-rounded-lg gp-bg-[#333333] gp-p-2 gp-flex gp-flex-col gp-gap-2 gp-z-10",
|
|
51
|
+
children: listToneAndVoice.map((item)=>{
|
|
52
|
+
return /*#__PURE__*/ jsxRuntime.jsxs("button", {
|
|
53
|
+
className: "gp-flex gp-p-2 hover:gp-bg-[#3B3B3B] gp-rounded-lg gp-cursor-pointer gp-gap-3 gp-items-center",
|
|
54
|
+
onClick: ()=>setValue(item),
|
|
55
|
+
children: [
|
|
56
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
57
|
+
className: classNames({
|
|
58
|
+
'gp-invisible': tone !== item
|
|
59
|
+
}),
|
|
60
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(DropdownIcon.TickIcon, {})
|
|
61
|
+
}),
|
|
62
|
+
/*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
63
|
+
className: "gp-text-xs",
|
|
64
|
+
children: item
|
|
65
|
+
})
|
|
66
|
+
]
|
|
67
|
+
}, item);
|
|
68
|
+
})
|
|
69
|
+
}) : null
|
|
70
|
+
]
|
|
71
|
+
})
|
|
72
|
+
]
|
|
73
|
+
})
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
exports.ToneAndVoice = ToneAndVoice;
|