@gem-sdk/core 3.0.0-pre-production.15 → 3.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cjs/components/AddOn.js +2 -18
- package/dist/cjs/components/ComponentAnimation.js +2 -17
- package/dist/cjs/components/ComponentToolbarPreview.js +2 -752
- package/dist/cjs/components/ComponentWrapper.js +2 -61
- package/dist/cjs/components/ComponentWrapperPreview.js +2 -213
- package/dist/cjs/components/Empty.js +2 -7
- package/dist/cjs/components/InteractionSuffix.js +2 -42
- package/dist/cjs/components/Render.js +2 -75
- package/dist/cjs/components/Render.liquid.js +16 -307
- package/dist/cjs/components/RenderBlock.js +2 -54
- package/dist/cjs/components/RenderCustomCode.js +4 -59
- package/dist/cjs/components/RenderPreview.js +2 -67
- package/dist/cjs/components/RenderSection.js +2 -23
- package/dist/cjs/components/ai-generator/AIContentGenerator.js +2 -252
- package/dist/cjs/components/ai-generator/AIGenContentLoading.js +2 -85
- package/dist/cjs/components/ai-generator/components/PickProduct.js +2 -220
- package/dist/cjs/components/ai-generator/components/ToneAndVoice.js +2 -77
- package/dist/cjs/components/ai-generator/hooks/useCheckingProductInside.js +1 -47
- package/dist/cjs/components/ai-generator/hooks/useFlipPopup.js +1 -110
- package/dist/cjs/components/ai-generator/hooks/useGettingGenerateRequest.js +1 -37
- package/dist/cjs/components/ai-generator/hooks/useListenEventGenerate.js +1 -70
- package/dist/cjs/components/ai-generator/icons/AIIcon.js +2 -67
- package/dist/cjs/components/ai-generator/icons/CloseIcon.js +2 -19
- package/dist/cjs/components/ai-generator/icons/DropdownIcon.js +2 -37
- package/dist/cjs/components/ai-generator/icons/SearchIcon.js +2 -21
- package/dist/cjs/components/ai-generator/icons/ShowMoreIcon.js +2 -21
- package/dist/cjs/components/ai-generator/icons/UpgradeIcon.js +2 -27
- package/dist/cjs/components/ai-generator/icons/WarningIcon.js +2 -31
- package/dist/cjs/components/constant.js +1 -82
- package/dist/cjs/components/resize/Resize.js +2 -16
- package/dist/cjs/components/resize/Spacing.js +2 -260
- package/dist/cjs/components/src/product/helpers/variant-presets.js +1 -56
- package/dist/cjs/components/theme-section/CreateThemeSection.js +2 -123
- package/dist/cjs/components/theme-section/ThemeSectionStatus.js +2 -45
- package/dist/cjs/components/theme-section/ThemeSectionTooltip.js +2 -126
- package/dist/cjs/components/toolbar/Tooltip.js +2 -28
- package/dist/cjs/constants/device.js +1 -0
- package/dist/cjs/contexts/AddonContext.js +2 -36
- package/dist/cjs/contexts/ArticleContext.js +2 -39
- package/dist/cjs/contexts/ArticleListContext.js +2 -31
- package/dist/cjs/contexts/BuilderComponent.js +2 -34
- package/dist/cjs/contexts/BuilderContext.js +2 -39
- package/dist/cjs/contexts/BuilderPreviewContext.js +2 -482
- package/dist/cjs/contexts/CartLineContext.js +2 -29
- package/dist/cjs/contexts/CollectionContext.js +2 -38
- package/dist/cjs/contexts/I18nContext.js +2 -0
- package/dist/cjs/contexts/ModalContext.js +2 -47
- package/dist/cjs/contexts/PageContext.js +2 -111
- package/dist/cjs/contexts/ProductContext.js +2 -182
- package/dist/cjs/contexts/ProductListContext.js +2 -32
- package/dist/cjs/contexts/SectionContext.js +2 -53
- package/dist/cjs/contexts/ShopContext.js +2 -107
- package/dist/cjs/graphql/fragments/analytic.generated.js +2 -6
- package/dist/cjs/graphql/fragments/collection-detail.generated.js +2 -6
- package/dist/cjs/graphql/fragments/collection-product.generated.js +2 -6
- package/dist/cjs/graphql/fragments/collection.generated.js +2 -6
- package/dist/cjs/graphql/fragments/custom-code.generated.js +2 -6
- package/dist/cjs/graphql/fragments/custom-font.generated.js +7 -7
- package/dist/cjs/graphql/fragments/data-seo.generated.js +2 -6
- package/dist/cjs/graphql/fragments/media.generated.js +2 -6
- package/dist/cjs/graphql/fragments/preview-theme-page.generated.js +6 -6
- package/dist/cjs/graphql/fragments/product-little.generated.js +2 -6
- package/dist/cjs/graphql/fragments/product-option-value.generated.js +2 -6
- package/dist/cjs/graphql/fragments/product-option.generated.js +2 -6
- package/dist/cjs/graphql/fragments/product.generated.js +2 -6
- package/dist/cjs/graphql/fragments/published-custom-section.generated.js +2 -6
- package/dist/cjs/graphql/fragments/published-page-section.generated.js +2 -6
- package/dist/cjs/graphql/fragments/published-theme-page.generated.js +4 -18
- package/dist/cjs/graphql/fragments/published-theme-style.generated.js +2 -6
- package/dist/cjs/graphql/fragments/selected-option.generated.js +2 -6
- package/dist/cjs/graphql/fragments/variant.generated.js +2 -6
- package/dist/cjs/graphql/mutations/page-view-up.generated.js +2 -6
- package/dist/cjs/graphql/queries/articles.generated.js +2 -6
- package/dist/cjs/graphql/queries/blogs.generated.js +2 -6
- package/dist/cjs/graphql/queries/collection-detail-filter.generated.js +2 -16
- package/dist/cjs/graphql/queries/collection.generated.js +2 -14
- package/dist/cjs/graphql/queries/collections.generated.js +2 -9
- package/dist/cjs/graphql/queries/preview-page.generated.js +2 -12
- package/dist/cjs/graphql/queries/product-little-detail.generated.js +2 -11
- package/dist/cjs/graphql/queries/product-medias.generated.js +2 -8
- package/dist/cjs/graphql/queries/product-value-label.generated.js +2 -6
- package/dist/cjs/graphql/queries/product-variants.generated.js +3 -11
- package/dist/cjs/graphql/queries/products.generated.js +3 -17
- package/dist/cjs/graphql/queries/{published-shop-metas.js → published-shop-metas.generated.js} +2 -6
- package/dist/cjs/graphql/queries/published-theme-pages.generated.js +3 -19
- package/dist/cjs/graphql/queries/shop-shopify.generated.js +2 -6
- package/dist/cjs/graphql/queries/store-property.generated.js +2 -6
- package/dist/cjs/graphql-app-api/queries/LibrarySaleFunnelDiscount.generated.js +2 -6
- package/dist/cjs/graphql-app-api/queries/LibraryTemplate.generated.js +2 -6
- package/dist/cjs/graphql-app-api/queries/SaleFunnelDiscounts.generated.js +2 -6
- package/dist/cjs/graphql-app-api/queries/SaleFunnelOffer.generated.js +2 -6
- package/dist/cjs/graphql-app-api/queries/ShopLibraryPage.generated.js +2 -6
- package/dist/cjs/graphql-app-api/queries/ThemePage.generated.js +2 -6
- package/dist/cjs/helpers/GlobalEvent.js +1 -19
- package/dist/cjs/helpers/align.js +1 -37
- package/dist/cjs/helpers/animations.js +1 -222
- package/dist/cjs/helpers/background.js +1 -236
- package/dist/cjs/helpers/backgroundImage.js +1 -0
- package/dist/cjs/helpers/borders.js +4 -198
- package/dist/cjs/helpers/carousel.js +1 -55
- package/dist/cjs/helpers/clone-deep.js +1 -5
- package/dist/cjs/helpers/cls.js +1 -16
- package/dist/cjs/helpers/colors.js +1 -184
- package/dist/cjs/helpers/compose-advance-style.js +1 -323
- package/dist/cjs/helpers/composeClasses.js +1 -0
- package/dist/cjs/helpers/const.js +1 -0
- package/dist/cjs/helpers/constant.js +1 -23
- package/dist/cjs/helpers/convert.js +1 -7
- package/dist/cjs/helpers/covert-entities-html.js +1 -19
- package/dist/cjs/helpers/css-variable.js +1 -7
- package/dist/cjs/helpers/email.js +1 -11
- package/dist/cjs/helpers/filter-styles.js +1 -0
- package/dist/cjs/helpers/filter-toolbar-preview.js +2 -14
- package/dist/cjs/helpers/flatten-connection.js +1 -9
- package/dist/cjs/helpers/get-resonsive-value.js +1 -36
- package/dist/cjs/helpers/get-shortname.js +1 -92
- package/dist/cjs/helpers/icon-list.js +1 -61
- package/dist/cjs/helpers/interaction/index.js +2 -134
- package/dist/cjs/helpers/is-browser.js +1 -9
- package/dist/cjs/helpers/is-defined.js +1 -7
- package/dist/cjs/helpers/is-empty-children.js +2 -15
- package/dist/cjs/helpers/is-safari.js +1 -9
- package/dist/cjs/helpers/layout.js +1 -76
- package/dist/cjs/helpers/load-script.js +1 -31
- package/dist/cjs/helpers/loop-component.js +1 -16
- package/dist/cjs/helpers/make-style.js +1 -163
- package/dist/cjs/helpers/normalize-builder-data.js +1 -23
- package/dist/cjs/helpers/pascal-to-kebab-case.js +1 -7
- package/dist/cjs/helpers/prefetch-queries.js +1 -78
- package/dist/cjs/helpers/product.js +1 -48
- package/dist/cjs/helpers/queries/get-collection.js +1 -226
- package/dist/cjs/helpers/queries/get-collections.js +1 -21
- package/dist/cjs/helpers/queries/get-product-by-slug.js +1 -125
- package/dist/cjs/helpers/queries/get-product.js +1 -154
- package/dist/cjs/helpers/queries/get-products.js +1 -214
- package/dist/cjs/helpers/query.js +1 -29
- package/dist/cjs/helpers/radius.js +6 -140
- package/dist/cjs/helpers/render.js +1 -91
- package/dist/cjs/helpers/shadow.js +1 -69
- package/dist/cjs/helpers/size.js +4 -228
- package/dist/cjs/helpers/spacing.js +1 -43
- package/dist/cjs/helpers/third-party/addAppBlockId.js +1 -20
- package/dist/cjs/helpers/third-party/appConfig.js +1 -416
- package/dist/cjs/helpers/third-party/appSetting.js +1 -1324
- package/dist/cjs/helpers/third-party/composeAppBlockId.js +1 -11
- package/dist/cjs/helpers/third-party/constant.js +1 -69
- package/dist/cjs/helpers/third-party/generateAppBlockConfigs.js +1 -34
- package/dist/cjs/helpers/third-party/getAppBlockConfig.js +1 -55
- package/dist/cjs/helpers/third-party/getAppBlockType.js +1 -12
- package/dist/cjs/helpers/third-party/getAppBlocks.js +1 -30
- package/dist/cjs/helpers/third-party/mergeBlock.js +1 -19
- package/dist/cjs/helpers/third-party/mergeBlockOrder.js +1 -47
- package/dist/cjs/helpers/third-party/removeGPAppItems.js +1 -18
- package/dist/cjs/helpers/tracking/fpixel.js +1 -28
- package/dist/cjs/helpers/tracking/gtag.js +1 -93
- package/dist/cjs/helpers/tracking/tiktokpixel.js +1 -17
- package/dist/cjs/helpers/typography.js +19 -160
- package/dist/cjs/helpers/variant.js +1 -11
- package/dist/cjs/hooks/animation/useAnimationActions.js +2 -39
- package/dist/cjs/hooks/animation/useAnimationConfig.js +2 -30
- package/dist/cjs/hooks/animation/useAnimationPreview.js +2 -31
- package/dist/cjs/hooks/animation/useAnimationTarget.js +2 -122
- package/dist/cjs/hooks/animation/useApplyAnimation.js +2 -89
- package/dist/cjs/hooks/articles/useArticlesQuery.js +2 -33
- package/dist/cjs/hooks/cart/use-add-to-cart.js +2 -20
- package/dist/cjs/hooks/cart/use-cart-data.js +2 -28
- package/dist/cjs/hooks/cart/use-cart-discount-codes-update.js +2 -20
- package/dist/cjs/hooks/cart/use-cart-note-update.js +2 -20
- package/dist/cjs/hooks/cart/use-create-cart.js +2 -22
- package/dist/cjs/hooks/cart/use-remove-cart-item.js +2 -20
- package/dist/cjs/hooks/cart/use-update-cart-item.js +2 -20
- package/dist/cjs/hooks/shop/use-collection-query.js +2 -22
- package/dist/cjs/hooks/shop/use-collections-query.js +2 -17
- package/dist/cjs/hooks/shop/use-product-query.js +2 -22
- package/dist/cjs/hooks/shop/use-products-query.js +2 -63
- package/dist/cjs/hooks/shop/useShopifyLink.js +2 -0
- package/dist/cjs/hooks/shop.js +2 -135
- package/dist/cjs/hooks/use-current-device.js +2 -30
- package/dist/cjs/hooks/use-lazy-video.js +2 -15
- package/dist/cjs/hooks/useAnimations.js +2 -29
- package/dist/cjs/hooks/useCartId.js +2 -44
- package/dist/cjs/hooks/useCartLine.js +2 -11
- package/dist/cjs/hooks/useCartUI.js +2 -48
- package/dist/cjs/hooks/useCollection.js +2 -9
- package/dist/cjs/hooks/useFetchHandle.js +2 -13
- package/dist/cjs/hooks/useFormatMoney.js +2 -75
- package/dist/cjs/hooks/useI18n.js +2 -0
- package/dist/cjs/hooks/useInitialSwatchesOptions.js +2 -127
- package/dist/cjs/hooks/useInteraction.js +2 -19
- package/dist/cjs/hooks/useIsomorphicLayoutEffect.js +2 -10
- package/dist/cjs/hooks/useLoadScript.js +2 -32
- package/dist/cjs/hooks/useMoney.js +2 -84
- package/dist/cjs/hooks/usePrevious.js +2 -19
- package/dist/cjs/hooks/useProduct.js +2 -250
- package/dist/cjs/hooks/useProductList.js +2 -21
- package/dist/cjs/hooks/useStickyStore.js +1 -0
- package/dist/cjs/hooks/useSuspenseFetch.js +2 -27
- package/dist/cjs/hooks/useSwatchesOptions.js +2 -41
- package/dist/cjs/hooks/useToolbarPostPurchase.js +2 -89
- package/dist/cjs/index.js +1 -425
- package/dist/cjs/types/animations.js +1 -49
- package/dist/cjs/types/appAPI.js +1 -2
- package/dist/cjs/types/custom.js +1 -52
- package/dist/cjs/types/global-style.js +1 -15
- package/dist/cjs/types/shop.js +1 -2
- package/dist/esm/components/AddOn.js +2 -14
- package/dist/esm/components/ComponentAnimation.js +2 -13
- package/dist/esm/components/ComponentToolbarPreview.js +2 -748
- package/dist/esm/components/ComponentWrapper.js +2 -57
- package/dist/esm/components/ComponentWrapperPreview.js +2 -209
- package/dist/esm/components/Empty.js +2 -3
- package/dist/esm/components/InteractionSuffix.js +2 -40
- package/dist/esm/components/Render.js +2 -71
- package/dist/esm/components/Render.liquid.js +16 -301
- package/dist/esm/components/RenderBlock.js +2 -50
- package/dist/esm/components/RenderCustomCode.js +4 -55
- package/dist/esm/components/RenderPreview.js +2 -63
- package/dist/esm/components/RenderSection.js +2 -19
- package/dist/esm/components/ai-generator/AIContentGenerator.js +2 -250
- package/dist/esm/components/ai-generator/AIGenContentLoading.js +2 -83
- package/dist/esm/components/ai-generator/components/PickProduct.js +2 -218
- package/dist/esm/components/ai-generator/components/ToneAndVoice.js +2 -75
- package/dist/esm/components/ai-generator/hooks/useCheckingProductInside.js +1 -45
- package/dist/esm/components/ai-generator/hooks/useFlipPopup.js +1 -108
- package/dist/esm/components/ai-generator/hooks/useGettingGenerateRequest.js +1 -35
- package/dist/esm/components/ai-generator/hooks/useListenEventGenerate.js +1 -68
- package/dist/esm/components/ai-generator/icons/AIIcon.js +2 -65
- package/dist/esm/components/ai-generator/icons/CloseIcon.js +2 -17
- package/dist/esm/components/ai-generator/icons/DropdownIcon.js +2 -34
- package/dist/esm/components/ai-generator/icons/SearchIcon.js +2 -19
- package/dist/esm/components/ai-generator/icons/ShowMoreIcon.js +2 -19
- package/dist/esm/components/ai-generator/icons/UpgradeIcon.js +2 -25
- package/dist/esm/components/ai-generator/icons/WarningIcon.js +2 -29
- package/dist/esm/components/constant.js +1 -75
- package/dist/esm/components/resize/Resize.js +2 -12
- package/dist/esm/components/resize/Spacing.js +2 -256
- package/dist/esm/components/src/product/helpers/variant-presets.js +1 -54
- package/dist/esm/components/theme-section/CreateThemeSection.js +2 -121
- package/dist/esm/components/theme-section/ThemeSectionStatus.js +2 -43
- package/dist/esm/components/theme-section/ThemeSectionTooltip.js +2 -124
- package/dist/esm/components/toolbar/Tooltip.js +2 -24
- package/dist/esm/constants/device.js +1 -0
- package/dist/esm/contexts/AddonContext.js +2 -32
- package/dist/esm/contexts/ArticleContext.js +2 -36
- package/dist/esm/contexts/ArticleListContext.js +2 -27
- package/dist/esm/contexts/BuilderComponent.js +2 -31
- package/dist/esm/contexts/BuilderContext.js +2 -36
- package/dist/esm/contexts/BuilderPreviewContext.js +2 -479
- package/dist/esm/contexts/CartLineContext.js +2 -26
- package/dist/esm/contexts/CollectionContext.js +2 -35
- package/dist/esm/contexts/I18nContext.js +2 -0
- package/dist/esm/contexts/ModalContext.js +2 -44
- package/dist/esm/contexts/PageContext.js +2 -108
- package/dist/esm/contexts/ProductContext.js +2 -179
- package/dist/esm/contexts/ProductListContext.js +2 -28
- package/dist/esm/contexts/SectionContext.js +2 -49
- package/dist/esm/contexts/ShopContext.js +2 -104
- package/dist/esm/graphql/fragments/analytic.generated.js +2 -4
- package/dist/esm/graphql/fragments/collection-detail.generated.js +2 -4
- package/dist/esm/graphql/fragments/collection-product.generated.js +2 -4
- package/dist/esm/graphql/fragments/collection.generated.js +2 -4
- package/dist/esm/graphql/fragments/custom-code.generated.js +2 -4
- package/dist/esm/graphql/fragments/custom-font.generated.js +7 -5
- package/dist/esm/graphql/fragments/data-seo.generated.js +2 -4
- package/dist/esm/graphql/fragments/media.generated.js +2 -4
- package/dist/esm/graphql/fragments/preview-theme-page.generated.js +6 -4
- package/dist/esm/graphql/fragments/product-little.generated.js +2 -4
- package/dist/esm/graphql/fragments/product-option-value.generated.js +2 -4
- package/dist/esm/graphql/fragments/product-option.generated.js +2 -4
- package/dist/esm/graphql/fragments/product.generated.js +2 -4
- package/dist/esm/graphql/fragments/published-custom-section.generated.js +2 -4
- package/dist/esm/graphql/fragments/published-page-section.generated.js +2 -4
- package/dist/esm/graphql/fragments/published-theme-page.generated.js +4 -16
- package/dist/esm/graphql/fragments/published-theme-style.generated.js +2 -4
- package/dist/esm/graphql/fragments/selected-option.generated.js +2 -4
- package/dist/esm/graphql/fragments/variant.generated.js +2 -4
- package/dist/esm/graphql/mutations/page-view-up.generated.js +2 -4
- package/dist/esm/graphql/queries/articles.generated.js +2 -4
- package/dist/esm/graphql/queries/blogs.generated.js +2 -4
- package/dist/esm/graphql/queries/collection-detail-filter.generated.js +10 -22
- package/dist/esm/graphql/queries/collection.generated.js +8 -18
- package/dist/esm/graphql/queries/collections.generated.js +3 -8
- package/dist/esm/graphql/queries/preview-page.generated.js +6 -14
- package/dist/esm/graphql/queries/product-little-detail.generated.js +5 -12
- package/dist/esm/graphql/queries/product-medias.generated.js +2 -6
- package/dist/esm/graphql/queries/product-value-label.generated.js +2 -4
- package/dist/esm/graphql/queries/product-variants.generated.js +5 -11
- package/dist/esm/graphql/queries/products.generated.js +9 -20
- package/dist/esm/graphql/queries/{published-shop-metas.js → published-shop-metas.generated.js} +2 -4
- package/dist/esm/graphql/queries/published-theme-pages.generated.js +6 -20
- package/dist/esm/graphql/queries/shop-shopify.generated.js +2 -4
- package/dist/esm/graphql/queries/store-property.generated.js +2 -4
- package/dist/esm/graphql-app-api/queries/LibrarySaleFunnelDiscount.generated.js +2 -4
- package/dist/esm/graphql-app-api/queries/LibraryTemplate.generated.js +2 -4
- package/dist/esm/graphql-app-api/queries/SaleFunnelDiscounts.generated.js +2 -4
- package/dist/esm/graphql-app-api/queries/SaleFunnelOffer.generated.js +2 -4
- package/dist/esm/graphql-app-api/queries/ShopLibraryPage.generated.js +2 -4
- package/dist/esm/graphql-app-api/queries/ThemePage.generated.js +2 -4
- package/dist/esm/helpers/GlobalEvent.js +1 -15
- package/dist/esm/helpers/align.js +1 -34
- package/dist/esm/helpers/animations.js +1 -220
- package/dist/esm/helpers/background.js +1 -227
- package/dist/esm/helpers/backgroundImage.js +1 -0
- package/dist/esm/helpers/borders.js +4 -189
- package/dist/esm/helpers/carousel.js +1 -51
- package/dist/esm/helpers/clone-deep.js +1 -3
- package/dist/esm/helpers/cls.js +1 -14
- package/dist/esm/helpers/colors.js +1 -169
- package/dist/esm/helpers/compose-advance-style.js +1 -315
- package/dist/esm/helpers/composeClasses.js +1 -0
- package/dist/esm/helpers/const.js +1 -0
- package/dist/esm/helpers/constant.js +1 -19
- package/dist/esm/helpers/convert.js +1 -4
- package/dist/esm/helpers/covert-entities-html.js +1 -17
- package/dist/esm/helpers/css-variable.js +1 -5
- package/dist/esm/helpers/email.js +1 -6
- package/dist/esm/helpers/filter-styles.js +1 -0
- package/dist/esm/helpers/filter-toolbar-preview.js +2 -9
- package/dist/esm/helpers/flatten-connection.js +1 -7
- package/dist/esm/helpers/get-resonsive-value.js +1 -31
- package/dist/esm/helpers/get-shortname.js +1 -90
- package/dist/esm/helpers/icon-list.js +1 -58
- package/dist/esm/helpers/interaction/index.js +2 -132
- package/dist/esm/helpers/is-browser.js +1 -5
- package/dist/esm/helpers/is-defined.js +1 -5
- package/dist/esm/helpers/is-empty-children.js +2 -10
- package/dist/esm/helpers/is-safari.js +1 -5
- package/dist/esm/helpers/layout.js +1 -70
- package/dist/esm/helpers/load-script.js +1 -29
- package/dist/esm/helpers/loop-component.js +1 -14
- package/dist/esm/helpers/make-style.js +1 -149
- package/dist/esm/helpers/normalize-builder-data.js +1 -21
- package/dist/esm/helpers/pascal-to-kebab-case.js +1 -5
- package/dist/esm/helpers/prefetch-queries.js +1 -76
- package/dist/esm/helpers/product.js +1 -44
- package/dist/esm/helpers/queries/get-collection.js +1 -223
- package/dist/esm/helpers/queries/get-collections.js +1 -19
- package/dist/esm/helpers/queries/get-product-by-slug.js +1 -123
- package/dist/esm/helpers/queries/get-product.js +1 -150
- package/dist/esm/helpers/queries/get-products.js +1 -210
- package/dist/esm/helpers/query.js +1 -25
- package/dist/esm/helpers/radius.js +6 -132
- package/dist/esm/helpers/render.js +1 -82
- package/dist/esm/helpers/shadow.js +1 -63
- package/dist/esm/helpers/size.js +4 -213
- package/dist/esm/helpers/spacing.js +1 -40
- package/dist/esm/helpers/third-party/addAppBlockId.js +1 -18
- package/dist/esm/helpers/third-party/appConfig.js +1 -356
- package/dist/esm/helpers/third-party/appSetting.js +1 -1321
- package/dist/esm/helpers/third-party/composeAppBlockId.js +1 -9
- package/dist/esm/helpers/third-party/constant.js +1 -66
- package/dist/esm/helpers/third-party/generateAppBlockConfigs.js +1 -32
- package/dist/esm/helpers/third-party/getAppBlockConfig.js +1 -53
- package/dist/esm/helpers/third-party/getAppBlockType.js +1 -10
- package/dist/esm/helpers/third-party/getAppBlocks.js +1 -28
- package/dist/esm/helpers/third-party/mergeBlock.js +1 -17
- package/dist/esm/helpers/third-party/mergeBlockOrder.js +1 -45
- package/dist/esm/helpers/third-party/removeGPAppItems.js +1 -15
- package/dist/esm/helpers/tracking/fpixel.js +1 -24
- package/dist/esm/helpers/tracking/gtag.js +1 -87
- package/dist/esm/helpers/tracking/tiktokpixel.js +1 -15
- package/dist/esm/helpers/typography.js +19 -149
- package/dist/esm/helpers/variant.js +1 -9
- package/dist/esm/hooks/animation/useAnimationActions.js +2 -37
- package/dist/esm/hooks/animation/useAnimationConfig.js +2 -28
- package/dist/esm/hooks/animation/useAnimationPreview.js +2 -29
- package/dist/esm/hooks/animation/useAnimationTarget.js +2 -120
- package/dist/esm/hooks/animation/useApplyAnimation.js +2 -85
- package/dist/esm/hooks/articles/useArticlesQuery.js +2 -30
- package/dist/esm/hooks/cart/use-add-to-cart.js +2 -18
- package/dist/esm/hooks/cart/use-cart-data.js +2 -26
- package/dist/esm/hooks/cart/use-cart-discount-codes-update.js +2 -18
- package/dist/esm/hooks/cart/use-cart-note-update.js +2 -18
- package/dist/esm/hooks/cart/use-create-cart.js +2 -20
- package/dist/esm/hooks/cart/use-remove-cart-item.js +2 -18
- package/dist/esm/hooks/cart/use-update-cart-item.js +2 -18
- package/dist/esm/hooks/shop/use-collection-query.js +2 -20
- package/dist/esm/hooks/shop/use-collections-query.js +2 -15
- package/dist/esm/hooks/shop/use-product-query.js +2 -20
- package/dist/esm/hooks/shop/use-products-query.js +2 -59
- package/dist/esm/hooks/shop/useShopifyLink.js +2 -0
- package/dist/esm/hooks/shop.js +2 -119
- package/dist/esm/hooks/use-current-device.js +2 -28
- package/dist/esm/hooks/use-lazy-video.js +2 -13
- package/dist/esm/hooks/useAnimations.js +2 -27
- package/dist/esm/hooks/useCartId.js +2 -40
- package/dist/esm/hooks/useCartLine.js +2 -7
- package/dist/esm/hooks/useCartUI.js +2 -44
- package/dist/esm/hooks/useCollection.js +2 -7
- package/dist/esm/hooks/useFetchHandle.js +2 -11
- package/dist/esm/hooks/useFormatMoney.js +2 -71
- package/dist/esm/hooks/useI18n.js +2 -0
- package/dist/esm/hooks/useInitialSwatchesOptions.js +2 -123
- package/dist/esm/hooks/useInteraction.js +2 -17
- package/dist/esm/hooks/useIsomorphicLayoutEffect.js +2 -6
- package/dist/esm/hooks/useLoadScript.js +2 -28
- package/dist/esm/hooks/useMoney.js +2 -80
- package/dist/esm/hooks/usePrevious.js +2 -17
- package/dist/esm/hooks/useProduct.js +2 -233
- package/dist/esm/hooks/useProductList.js +2 -16
- package/dist/esm/hooks/useStickyStore.js +1 -0
- package/dist/esm/hooks/useSuspenseFetch.js +2 -23
- package/dist/esm/hooks/useSwatchesOptions.js +2 -37
- package/dist/esm/hooks/useToolbarPostPurchase.js +2 -87
- package/dist/esm/index.js +1 -119
- package/dist/esm/types/animations.js +1 -49
- package/dist/esm/types/custom.js +1 -52
- package/dist/esm/types/global-style.js +1 -12
- package/dist/types/index.d.ts +12025 -8969
- package/package.json +6 -6
- package/dist/cjs/web-components/src/helpers/styles/constant.js +0 -9
- package/dist/esm/web-components/src/helpers/styles/constant.js +0 -7
|
@@ -1,124 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
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
|
+
'use client';
|
|
2
|
+
import{jsx as e,Fragment as t,jsxs as i}from"react/jsx-runtime";import{useRef as o}from"react";import{Transition as n}from"react-transition-group";import{useI18nStore as a,cls as c}from"@gem-sdk/core";let TRANSITION_DURATION=350,defaultStyles={transition:"opacity 350ms ease-out",opacity:0},transitions={entering:{opacity:1},entered:{opacity:1},exiting:{opacity:0},exited:{opacity:0},unmounted:{opacity:0}},ThemeSectionTooltip=({isShow:l,isFreeLimit:s,isRender:r,children:m,limitCreateThemeSection:d,onMouseEnter:h,onMouseLeave:p,onActions:_})=>{let{t:u}=a(),y=o(null),b=s?"Upgrade to create Theme Section":"Create Theme Section",g=()=>{window.open("https://help.gempages.net/articles/theme-section","_blank")};return e(t,{children:i("div",{className:"theme-section-tooltip-wrapper",onMouseEnter:h,onMouseLeave:p,children:[m,r&&e(n,{in:l,timeout:350,nodeRef:y,unmountOnExit:!0,children:o=>e("div",{className:"theme-section-tooltip",ref:y,style:{...defaultStyles,...transitions[o]},children:d?.isLimit&&!s?i("div",{className:"theme-section-tooltip__body theme-section-tooltip__body-limit",children:[e("div",{className:"theme-section-tooltip__body-title theme-section-tooltip__body-limit__title",children:"Upgrade plan"}),i("div",{className:"theme-section-tooltip__body-desc theme-section-tooltip__body-limit__desc",children:["You’ve reached the maximum number of theme sections on your plan (",d.total,"/",d.limit,")"]}),e("button",{onClick:e=>_(e),children:"Upgrade plan to create more"})]}):i(t,{children:[e("div",{className:"theme-section-tooltip__image",children:e("img",{src:"https://ucarecdn.com/6a9f408a-aa8c-434a-890b-81067a14aceb/-/format/auto/-/preview/1920x1920/-/quality/lighter/theme-section-illustration.png",alt:""})}),i("div",{className:"theme-section-tooltip__body",children:[e("div",{className:"theme-section-tooltip__body-title",children:"Create once, use everywhere with Theme Section"}),e("div",{className:"theme-section-tooltip__body-desc",children:"A global section that can be used on all your GemPages & Shopify pages."})]}),i("div",{className:c("theme-section-tooltip__action",{"theme-section-tooltip__action-limit":s}),children:[e("button",{onClick:e=>_(e),children:u(b)}),s&&e("div",{onClick:g,"aria-hidden":!0,className:"theme-section-tooltip__action-learn-more",children:"Learn more about Theme Section"})]})]})})})]})})};export{ThemeSectionTooltip};
|
|
@@ -1,24 +1,2 @@
|
|
|
1
|
-
|
|
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 };
|
|
1
|
+
'use client';
|
|
2
|
+
import{jsxs as t,jsx as o}from"react/jsx-runtime";function Tooltip({children:i,enable:r,text:l="Tooltip Text",position:a="right",width:e,...d}){return t("div",{...d,"data-toolbar-tooltip-trigger":!0,children:[i,r&&o("div",{style:{width:e,zIndex:50},"data-toolbar-tooltip":!0,"data-toolbar-tooltip-position":a,dangerouslySetInnerHTML:{__html:l}})]})}export{Tooltip as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let DEVICES=["desktop","tablet","mobile"];export{DEVICES};
|
|
@@ -1,32 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import Empty from '../components/Empty.js';
|
|
4
|
-
|
|
5
|
-
const AddonContext = /*#__PURE__*/ createContext(null);
|
|
6
|
-
const AddonProvider = ({ children, components, ...passProps })=>{
|
|
7
|
-
return /*#__PURE__*/ jsx(AddonContext.Provider, {
|
|
8
|
-
...passProps,
|
|
9
|
-
value: {
|
|
10
|
-
components
|
|
11
|
-
},
|
|
12
|
-
children: children
|
|
13
|
-
});
|
|
14
|
-
};
|
|
15
|
-
const useAddons = ()=>{
|
|
16
|
-
const context = useContext(AddonContext);
|
|
17
|
-
if (!context) {
|
|
18
|
-
throw new Error('useAddons must be used within an AddonProvider');
|
|
19
|
-
}
|
|
20
|
-
return useMemo(()=>context.components, [
|
|
21
|
-
context.components
|
|
22
|
-
]);
|
|
23
|
-
};
|
|
24
|
-
const useAddon = (id)=>{
|
|
25
|
-
const addons = useAddons();
|
|
26
|
-
return useMemo(()=>id ? addons[id] ?? Empty : Empty, [
|
|
27
|
-
id,
|
|
28
|
-
addons
|
|
29
|
-
]);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export { AddonProvider, useAddon, useAddons };
|
|
1
|
+
'use client';
|
|
2
|
+
import{jsx as o}from"react/jsx-runtime";import{useContext as d,useMemo as e,createContext as n}from"react";import r from"../components/Empty.js";let AddonContext=n(null),AddonProvider=({children:d,components:e,...n})=>o(AddonContext.Provider,{...n,value:{components:e},children:d}),useAddons=()=>{let o=d(AddonContext);if(!o)throw Error("useAddons must be used within an AddonProvider");return e(()=>o.components,[o.components])},useAddon=o=>{let d=useAddons();return e(()=>o?d[o]??r:r,[o,d])};export{AddonProvider,useAddon,useAddons};
|
|
@@ -1,36 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { useId, useMemo, useContext, createContext } from 'react';
|
|
4
|
-
|
|
5
|
-
// const { Provider, useStore } = createContext<StoreApi<ProductContextProps>>();
|
|
6
|
-
const ArticleContext = /*#__PURE__*/ createContext(null);
|
|
7
|
-
const createArticleStoreProvider = (data)=>createStore(()=>({
|
|
8
|
-
...data
|
|
9
|
-
}));
|
|
10
|
-
const ArticleProvider = ({ children, article })=>{
|
|
11
|
-
const uniqueId = useId();
|
|
12
|
-
const store = useMemo(()=>{
|
|
13
|
-
return createArticleStoreProvider({
|
|
14
|
-
article,
|
|
15
|
-
uniqueId
|
|
16
|
-
});
|
|
17
|
-
}, [
|
|
18
|
-
article,
|
|
19
|
-
uniqueId
|
|
20
|
-
]);
|
|
21
|
-
return /*#__PURE__*/ jsx(ArticleContext.Provider, {
|
|
22
|
-
value: store,
|
|
23
|
-
children: /*#__PURE__*/ jsx(Fragment, {
|
|
24
|
-
children: children
|
|
25
|
-
})
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
const useArticleStore = (selector, equalityFn)=>{
|
|
29
|
-
const store = useContext(ArticleContext);
|
|
30
|
-
if (!store) {
|
|
31
|
-
throw new Error('Element of article must be used inside a Article');
|
|
32
|
-
}
|
|
33
|
-
return useStore(store, selector, equalityFn);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export { ArticleProvider, useArticleStore };
|
|
1
|
+
'use client';
|
|
2
|
+
import{jsx as r,Fragment as e}from"react/jsx-runtime";import{useStore as t,createStore as i}from"zustand";import{useId as o,useMemo as l,useContext as c,createContext as n}from"react";let ArticleContext=n(null),createArticleStoreProvider=r=>i(()=>({...r})),ArticleProvider=({children:t,article:i})=>{let c=o(),n=l(()=>createArticleStoreProvider({article:i,uniqueId:c}),[i,c]);return r(ArticleContext.Provider,{value:n,children:r(e,{children:t})})},useArticleStore=(r,e)=>{let i=c(ArticleContext);if(!i)throw Error("Element of article must be used inside a Article");return t(i,r,e)};export{ArticleProvider,useArticleStore};
|
|
@@ -1,27 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { useStore, createStore } from 'zustand';
|
|
4
|
-
|
|
5
|
-
const ArticleListContext = /*#__PURE__*/ createContext(null);
|
|
6
|
-
const createArticleListProvider = (data)=>createStore(()=>({
|
|
7
|
-
...data
|
|
8
|
-
}));
|
|
9
|
-
const ArticleListProvider = ({ articles, children, styles, settings })=>{
|
|
10
|
-
return /*#__PURE__*/ jsx(ArticleListContext.Provider, {
|
|
11
|
-
value: createArticleListProvider({
|
|
12
|
-
articles,
|
|
13
|
-
styles,
|
|
14
|
-
settings
|
|
15
|
-
}),
|
|
16
|
-
children: children
|
|
17
|
-
});
|
|
18
|
-
};
|
|
19
|
-
const useArticleListStore = (selector, equalityFn)=>{
|
|
20
|
-
const store = useContext(ArticleListContext);
|
|
21
|
-
if (!store) {
|
|
22
|
-
throw new Error('useArticleListStore must be used within a useArticleListStore');
|
|
23
|
-
}
|
|
24
|
-
return useStore(store, selector, equalityFn);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export { ArticleListContext, ArticleListProvider, useArticleListStore };
|
|
1
|
+
'use client';
|
|
2
|
+
import{jsx as t}from"react/jsx-runtime";import{useContext as r,createContext as e}from"react";import{useStore as i,createStore as o}from"zustand";let ArticleListContext=e(null),createArticleListProvider=t=>o(()=>({...t})),ArticleListProvider=({articles:r,children:e,styles:i,settings:o})=>t(ArticleListContext.Provider,{value:createArticleListProvider({articles:r,styles:i,settings:o}),children:e}),useArticleListStore=(t,e)=>{let o=r(ArticleListContext);if(!o)throw Error("useArticleListStore must be used within a useArticleListStore");return i(o,t,e)};export{ArticleListContext,ArticleListProvider,useArticleListStore};
|
|
@@ -1,31 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { useContext, createContext } from 'react';
|
|
4
|
-
import Empty from '../components/Empty.js';
|
|
5
|
-
|
|
6
|
-
const BuilderComponentContext = /*#__PURE__*/ createContext(null);
|
|
7
|
-
const createBuilderComponentStore = (components)=>createStore((_, get)=>({
|
|
8
|
-
components,
|
|
9
|
-
getItem: (id)=>{
|
|
10
|
-
return get().components[id];
|
|
11
|
-
}
|
|
12
|
-
}));
|
|
13
|
-
const BuilderComponentProvider = ({ children, components, ...passProps })=>{
|
|
14
|
-
return /*#__PURE__*/ jsx(BuilderComponentContext.Provider, {
|
|
15
|
-
...passProps,
|
|
16
|
-
value: createBuilderComponentStore(components),
|
|
17
|
-
children: children
|
|
18
|
-
});
|
|
19
|
-
};
|
|
20
|
-
// export const useBuilderComponent = (id?: string) => {
|
|
21
|
-
// return useStore((s) => (id ? s.getItem(id) ?? Empty : Empty));
|
|
22
|
-
// };
|
|
23
|
-
const useBuilderComponent = (id)=>{
|
|
24
|
-
const store = useContext(BuilderComponentContext);
|
|
25
|
-
if (!store) {
|
|
26
|
-
throw new Error('useBuilderComponent must be used within a BuilderComponentProvider');
|
|
27
|
-
}
|
|
28
|
-
return useStore(store, (s)=>id ? s.getItem(id) ?? Empty : Empty);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export { BuilderComponentProvider, useBuilderComponent };
|
|
1
|
+
'use client';
|
|
2
|
+
import{jsx as e}from"react/jsx-runtime";import{useStore as o,createStore as t}from"zustand";import{useContext as r,createContext as n}from"react";import m from"../components/Empty.js";let BuilderComponentContext=n(null),createBuilderComponentStore=e=>t((o,t)=>({components:e,getItem:e=>t().components[e]})),BuilderComponentProvider=({children:o,components:t,...r})=>e(BuilderComponentContext.Provider,{...r,value:createBuilderComponentStore(t),children:o}),useBuilderComponent=e=>{let t=r(BuilderComponentContext);if(!t)throw Error("useBuilderComponent must be used within a BuilderComponentProvider");return o(t,o=>e?o.getItem(e)??m:m)};export{BuilderComponentProvider,useBuilderComponent};
|
|
@@ -1,36 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { useStore, createStore } from 'zustand';
|
|
4
|
-
|
|
5
|
-
const BuilderContext = /*#__PURE__*/ createContext(null);
|
|
6
|
-
const createBuilderProvider = (data, isPostPurchase, isPreview)=>createStore((_, get)=>({
|
|
7
|
-
state: data,
|
|
8
|
-
isPostPurchase: isPostPurchase,
|
|
9
|
-
isPreview: isPreview,
|
|
10
|
-
getItem: (id)=>{
|
|
11
|
-
return get().state[id];
|
|
12
|
-
},
|
|
13
|
-
getIsPostPurchase: ()=>get().isPostPurchase,
|
|
14
|
-
getIsPreview: ()=>get().isPreview
|
|
15
|
-
}));
|
|
16
|
-
const BuilderProvider = ({ children, state, isPostPurchase, isPreview, lazy, priority, ...passProps })=>{
|
|
17
|
-
const Component = lazy ? Suspense : Fragment;
|
|
18
|
-
const store = createBuilderProvider(state, isPostPurchase, isPreview);
|
|
19
|
-
return /*#__PURE__*/ jsx(Component, {
|
|
20
|
-
children: /*#__PURE__*/ jsx(BuilderContext.Provider, {
|
|
21
|
-
...passProps,
|
|
22
|
-
value: store,
|
|
23
|
-
children: children
|
|
24
|
-
})
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
// export const useBuilderStore = useStore;
|
|
28
|
-
const useBuilderStore = (selector, equalityFn)=>{
|
|
29
|
-
const store = useContext(BuilderContext);
|
|
30
|
-
if (!store) {
|
|
31
|
-
throw new Error('useBuilderStore must be used within a BuilderProvider');
|
|
32
|
-
}
|
|
33
|
-
return useStore(store, selector, equalityFn);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export { BuilderProvider, useBuilderStore };
|
|
1
|
+
'use client';
|
|
2
|
+
import{jsx as e}from"react/jsx-runtime";import{useContext as r,createContext as t,Suspense as i,Fragment as u}from"react";import{useStore as o,createStore as d}from"zustand";let BuilderContext=t(null),createBuilderProvider=(e,r,t)=>d((i,u)=>({state:e,isPostPurchase:r,isPreview:t,getItem:e=>u().state[e],getIsPostPurchase:()=>u().isPostPurchase,getIsPreview:()=>u().isPreview})),BuilderProvider=({children:r,state:t,isPostPurchase:o,isPreview:d,lazy:s,priority:l,...P})=>{let a=s?i:u,n=createBuilderProvider(t,o,d);return e(a,{children:e(BuilderContext.Provider,{...P,value:n,children:r})})},useBuilderStore=(e,t)=>{let i=r(BuilderContext);if(!i)throw Error("useBuilderStore must be used within a BuilderProvider");return o(i,e,t)};export{BuilderProvider,useBuilderStore};
|