@gem-sdk/core 1.38.0 → 2.0.0-dev.834
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 +1 -18
- package/dist/cjs/components/ComponentToolbarPreview.js +1 -465
- package/dist/cjs/components/ComponentWrapper.js +1 -46
- package/dist/cjs/components/ComponentWrapperPreview.js +1 -136
- package/dist/cjs/components/Empty.js +1 -7
- package/dist/cjs/components/Render.js +1 -65
- package/dist/cjs/components/Render.liquid.js +14 -288
- package/dist/cjs/components/RenderBlock.js +1 -54
- package/dist/cjs/components/RenderCustomCode.js +3 -56
- package/dist/cjs/components/RenderPreview.js +1 -66
- package/dist/cjs/components/RenderSection.js +1 -23
- package/dist/cjs/components/ai-generator/AIContentGenerator.js +1 -0
- package/dist/cjs/components/ai-generator/AIGenContentLoading.js +1 -0
- package/dist/cjs/components/ai-generator/components/PickProduct.js +1 -0
- package/dist/cjs/components/ai-generator/components/ToneAndVoice.js +1 -0
- package/dist/cjs/components/ai-generator/hooks/useGettingGenerateRequest.js +1 -0
- package/dist/cjs/components/ai-generator/hooks/useListenEventGenerate.js +1 -0
- package/dist/cjs/components/ai-generator/icons/AIIcon.js +1 -0
- package/dist/cjs/components/ai-generator/icons/CloseIcon.js +1 -0
- package/dist/cjs/components/ai-generator/icons/DropdownIcon.js +1 -0
- package/dist/cjs/components/ai-generator/icons/ShowMoreIcon.js +1 -0
- package/dist/cjs/components/animation/AnimationWrapper.js +1 -0
- package/dist/cjs/components/constant.js +1 -54
- package/dist/cjs/components/resize/Resize.js +1 -16
- package/dist/cjs/components/resize/Spacing.js +1 -248
- package/dist/cjs/components/src/product/helpers/variant-presets.js +1 -56
- package/dist/cjs/components/theme-section/CreateThemeSection.js +1 -117
- package/dist/cjs/components/theme-section/ThemeSectionStatus.js +1 -36
- package/dist/cjs/components/theme-section/ThemeSectionTooltip.js +1 -102
- package/dist/cjs/components/toolbar/Tooltip.js +1 -22
- package/dist/cjs/contexts/AddonContext.js +1 -36
- package/dist/cjs/contexts/BuilderComponent.js +1 -34
- package/dist/cjs/contexts/BuilderContext.js +1 -35
- package/dist/cjs/contexts/BuilderPreviewContext.js +1 -479
- package/dist/cjs/contexts/CartLineContext.js +1 -29
- package/dist/cjs/contexts/CollectionContext.js +1 -38
- package/dist/cjs/contexts/ModalContext.js +1 -47
- package/dist/cjs/contexts/PageContext.js +1 -44
- package/dist/cjs/contexts/ProductContext.js +1 -156
- package/dist/cjs/contexts/ProductListContext.js +1 -32
- package/dist/cjs/contexts/SectionContext.js +1 -53
- package/dist/cjs/contexts/ShopContext.js +1 -80
- 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 +2 -6
- 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/product-little.generated.js +11 -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 +11 -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 +3 -9
- 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 +3 -7
- 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 -14
- 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 +2 -10
- package/dist/cjs/graphql/queries/products.generated.js +12 -17
- package/dist/cjs/graphql/queries/published-theme-pages.generated.js +2 -15
- package/dist/cjs/graphql/queries/store-property.generated.js +2 -6
- package/dist/cjs/graphql-app-api/queries/LibrarySaleFunnelDiscount.generated.js +21 -0
- package/dist/cjs/graphql-app-api/queries/LibraryTemplate.generated.js +13 -0
- package/dist/cjs/graphql-app-api/queries/SaleFunnelDiscounts.generated.js +34 -0
- package/dist/cjs/graphql-app-api/queries/ThemePage.generated.js +22 -0
- package/dist/cjs/helpers/GlobalEvent.js +1 -19
- package/dist/cjs/helpers/animations.js +1 -213
- package/dist/cjs/helpers/background.js +1 -230
- package/dist/cjs/helpers/borders.js +4 -183
- package/dist/cjs/helpers/carousel.js +1 -58
- 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 -268
- 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-toolbar-preview.js +1 -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/is-browser.js +1 -9
- package/dist/cjs/helpers/is-defined.js +1 -7
- package/dist/cjs/helpers/is-empty-children.js +1 -15
- package/dist/cjs/helpers/is-safari.js +1 -9
- package/dist/cjs/helpers/layout.js +1 -59
- package/dist/cjs/helpers/load-script.js +1 -31
- package/dist/cjs/helpers/make-style.js +1 -163
- package/dist/cjs/helpers/normalize-builder-data.js +1 -23
- 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 -163
- package/dist/cjs/helpers/query.js +1 -29
- package/dist/cjs/helpers/radius.js +6 -140
- package/dist/cjs/helpers/render.js +1 -76
- package/dist/cjs/helpers/shadow.js +1 -57
- package/dist/cjs/helpers/size.js +4 -183
- package/dist/cjs/helpers/spacing.js +1 -43
- 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 +17 -126
- package/dist/cjs/helpers/variant.js +1 -11
- package/dist/cjs/hooks/animation/animations.js +1 -0
- package/dist/cjs/hooks/animation/useAnimationActions.js +1 -39
- package/dist/cjs/hooks/animation/useAnimationConfig.js +1 -29
- package/dist/cjs/hooks/animation/useAnimationPreview.js +1 -31
- package/dist/cjs/hooks/animation/useAnimationTarget.js +1 -120
- package/dist/cjs/hooks/animation/useApplyAnimation.js +1 -87
- package/dist/cjs/hooks/animation/useLivePageAnimation.js +1 -0
- package/dist/cjs/hooks/cart/use-add-to-cart.js +1 -20
- package/dist/cjs/hooks/cart/use-cart-data.js +1 -28
- package/dist/cjs/hooks/cart/use-cart-discount-codes-update.js +1 -20
- package/dist/cjs/hooks/cart/use-cart-note-update.js +1 -20
- package/dist/cjs/hooks/cart/use-create-cart.js +1 -22
- package/dist/cjs/hooks/cart/use-remove-cart-item.js +1 -20
- package/dist/cjs/hooks/cart/use-update-cart-item.js +1 -20
- package/dist/cjs/hooks/shop/use-collection-query.js +1 -22
- package/dist/cjs/hooks/shop/use-collections-query.js +1 -17
- package/dist/cjs/hooks/shop/use-product-query.js +1 -22
- package/dist/cjs/hooks/shop/use-products-query.js +1 -23
- package/dist/cjs/hooks/shop.js +1 -126
- package/dist/cjs/hooks/use-current-device.js +1 -21
- package/dist/cjs/hooks/use-lazy-video.js +1 -15
- package/dist/cjs/hooks/useAnimations.js +1 -26
- package/dist/cjs/hooks/useCartId.js +1 -44
- package/dist/cjs/hooks/useCartLine.js +1 -11
- package/dist/cjs/hooks/useCartUI.js +1 -48
- package/dist/cjs/hooks/useCollection.js +1 -9
- package/dist/cjs/hooks/useFetchHandle.js +1 -13
- package/dist/cjs/hooks/useFormatMoney.js +1 -58
- package/dist/cjs/hooks/useInitialSwatchesOptions.js +1 -113
- package/dist/cjs/hooks/useIsomorphicLayoutEffect.js +1 -10
- package/dist/cjs/hooks/useLoadScript.js +1 -32
- package/dist/cjs/hooks/useMoney.js +1 -84
- package/dist/cjs/hooks/usePrevious.js +1 -19
- package/dist/cjs/hooks/useProduct.js +1 -206
- package/dist/cjs/hooks/useProductList.js +1 -21
- package/dist/cjs/hooks/useSuspenseFetch.js +1 -27
- package/dist/cjs/hooks/useSwatchesOptions.js +1 -41
- package/dist/cjs/hooks/useToolbarPostPurchase.js +1 -0
- package/dist/cjs/index.js +1 -361
- package/dist/cjs/types/animations.js +1 -47
- package/dist/cjs/types/appAPI.js +1 -0
- package/dist/cjs/types/global-style.js +1 -15
- package/dist/cjs/types/shop.js +1 -2
- package/dist/cjs/web-components/src/helpers/styles/constant.js +1 -9
- package/dist/esm/components/AddOn.js +1 -14
- package/dist/esm/components/ComponentToolbarPreview.js +1 -463
- package/dist/esm/components/ComponentWrapper.js +1 -42
- package/dist/esm/components/ComponentWrapperPreview.js +1 -132
- package/dist/esm/components/Empty.js +1 -3
- package/dist/esm/components/Render.js +1 -61
- package/dist/esm/components/Render.liquid.js +14 -282
- package/dist/esm/components/RenderBlock.js +1 -50
- package/dist/esm/components/RenderCustomCode.js +3 -52
- package/dist/esm/components/RenderPreview.js +1 -62
- package/dist/esm/components/RenderSection.js +1 -19
- package/dist/esm/components/ai-generator/AIContentGenerator.js +1 -0
- package/dist/esm/components/ai-generator/AIGenContentLoading.js +1 -0
- package/dist/esm/components/ai-generator/components/PickProduct.js +1 -0
- package/dist/esm/components/ai-generator/components/ToneAndVoice.js +1 -0
- package/dist/esm/components/ai-generator/hooks/useGettingGenerateRequest.js +1 -0
- package/dist/esm/components/ai-generator/hooks/useListenEventGenerate.js +1 -0
- package/dist/esm/components/ai-generator/icons/AIIcon.js +1 -0
- package/dist/esm/components/ai-generator/icons/CloseIcon.js +1 -0
- package/dist/esm/components/ai-generator/icons/DropdownIcon.js +1 -0
- package/dist/esm/components/ai-generator/icons/ShowMoreIcon.js +1 -0
- package/dist/esm/components/animation/AnimationWrapper.js +1 -0
- package/dist/esm/components/constant.js +1 -50
- package/dist/esm/components/resize/Resize.js +1 -12
- package/dist/esm/components/resize/Spacing.js +1 -244
- package/dist/esm/components/src/product/helpers/variant-presets.js +1 -54
- package/dist/esm/components/theme-section/CreateThemeSection.js +1 -115
- package/dist/esm/components/theme-section/ThemeSectionStatus.js +1 -34
- package/dist/esm/components/theme-section/ThemeSectionTooltip.js +1 -100
- package/dist/esm/components/toolbar/Tooltip.js +1 -18
- package/dist/esm/contexts/AddonContext.js +1 -32
- package/dist/esm/contexts/BuilderComponent.js +1 -31
- package/dist/esm/contexts/BuilderContext.js +1 -32
- package/dist/esm/contexts/BuilderPreviewContext.js +1 -476
- package/dist/esm/contexts/CartLineContext.js +1 -26
- package/dist/esm/contexts/CollectionContext.js +1 -35
- package/dist/esm/contexts/ModalContext.js +1 -44
- package/dist/esm/contexts/PageContext.js +1 -41
- package/dist/esm/contexts/ProductContext.js +1 -153
- package/dist/esm/contexts/ProductListContext.js +1 -28
- package/dist/esm/contexts/SectionContext.js +1 -49
- package/dist/esm/contexts/ShopContext.js +1 -77
- 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 +2 -4
- 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/product-little.generated.js +11 -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 +11 -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 +3 -6
- 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 +3 -5
- 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 +8 -18
- 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 +4 -10
- package/dist/esm/graphql/queries/products.generated.js +18 -20
- package/dist/esm/graphql/queries/published-theme-pages.generated.js +9 -20
- package/dist/esm/graphql/queries/store-property.generated.js +2 -4
- package/dist/esm/graphql-app-api/queries/LibrarySaleFunnelDiscount.generated.js +21 -0
- package/dist/esm/graphql-app-api/queries/LibraryTemplate.generated.js +13 -0
- package/dist/esm/graphql-app-api/queries/SaleFunnelDiscounts.generated.js +34 -0
- package/dist/esm/graphql-app-api/queries/ThemePage.generated.js +22 -0
- package/dist/esm/helpers/GlobalEvent.js +1 -15
- package/dist/esm/helpers/animations.js +1 -211
- package/dist/esm/helpers/background.js +1 -222
- package/dist/esm/helpers/borders.js +4 -175
- package/dist/esm/helpers/carousel.js +1 -54
- 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 -261
- 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-toolbar-preview.js +1 -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/is-browser.js +1 -5
- package/dist/esm/helpers/is-defined.js +1 -5
- package/dist/esm/helpers/is-empty-children.js +1 -10
- package/dist/esm/helpers/is-safari.js +1 -5
- package/dist/esm/helpers/layout.js +1 -54
- package/dist/esm/helpers/load-script.js +1 -29
- package/dist/esm/helpers/make-style.js +1 -149
- package/dist/esm/helpers/normalize-builder-data.js +1 -21
- 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 -161
- package/dist/esm/helpers/query.js +1 -25
- package/dist/esm/helpers/radius.js +6 -132
- package/dist/esm/helpers/render.js +1 -68
- package/dist/esm/helpers/shadow.js +1 -52
- package/dist/esm/helpers/size.js +4 -171
- package/dist/esm/helpers/spacing.js +1 -40
- 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 +17 -116
- package/dist/esm/helpers/variant.js +1 -9
- package/dist/esm/hooks/animation/animations.js +1 -0
- package/dist/esm/hooks/animation/useAnimationActions.js +1 -37
- package/dist/esm/hooks/animation/useAnimationConfig.js +1 -27
- package/dist/esm/hooks/animation/useAnimationPreview.js +1 -29
- package/dist/esm/hooks/animation/useAnimationTarget.js +1 -118
- package/dist/esm/hooks/animation/useApplyAnimation.js +1 -83
- package/dist/esm/hooks/animation/useLivePageAnimation.js +1 -0
- package/dist/esm/hooks/cart/use-add-to-cart.js +1 -18
- package/dist/esm/hooks/cart/use-cart-data.js +1 -26
- package/dist/esm/hooks/cart/use-cart-discount-codes-update.js +1 -18
- package/dist/esm/hooks/cart/use-cart-note-update.js +1 -18
- package/dist/esm/hooks/cart/use-create-cart.js +1 -20
- package/dist/esm/hooks/cart/use-remove-cart-item.js +1 -18
- package/dist/esm/hooks/cart/use-update-cart-item.js +1 -18
- package/dist/esm/hooks/shop/use-collection-query.js +1 -20
- package/dist/esm/hooks/shop/use-collections-query.js +1 -15
- package/dist/esm/hooks/shop/use-product-query.js +1 -20
- package/dist/esm/hooks/shop/use-products-query.js +1 -21
- package/dist/esm/hooks/shop.js +1 -111
- package/dist/esm/hooks/use-current-device.js +1 -19
- package/dist/esm/hooks/use-lazy-video.js +1 -13
- package/dist/esm/hooks/useAnimations.js +1 -24
- package/dist/esm/hooks/useCartId.js +1 -40
- package/dist/esm/hooks/useCartLine.js +1 -7
- package/dist/esm/hooks/useCartUI.js +1 -44
- package/dist/esm/hooks/useCollection.js +1 -7
- package/dist/esm/hooks/useFetchHandle.js +1 -11
- package/dist/esm/hooks/useFormatMoney.js +1 -56
- package/dist/esm/hooks/useInitialSwatchesOptions.js +1 -109
- package/dist/esm/hooks/useIsomorphicLayoutEffect.js +1 -6
- package/dist/esm/hooks/useLoadScript.js +1 -28
- package/dist/esm/hooks/useMoney.js +1 -80
- package/dist/esm/hooks/usePrevious.js +1 -17
- package/dist/esm/hooks/useProduct.js +1 -192
- package/dist/esm/hooks/useProductList.js +1 -16
- package/dist/esm/hooks/useSuspenseFetch.js +1 -23
- package/dist/esm/hooks/useSwatchesOptions.js +1 -37
- package/dist/esm/hooks/useToolbarPostPurchase.js +1 -0
- package/dist/esm/index.js +1 -100
- package/dist/esm/types/animations.js +1 -47
- package/dist/esm/types/appAPI.js +1 -0
- package/dist/esm/types/global-style.js +1 -12
- package/dist/esm/web-components/src/helpers/styles/constant.js +1 -7
- package/dist/types/index.d.ts +25970 -6309
- package/package.json +8 -3
|
@@ -1,132 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useEffect, isValidElement } from 'react';
|
|
3
|
-
import { composeAdvanceStyle } from '../helpers/compose-advance-style.js';
|
|
4
|
-
import { disableWrap, excludeApplyStyle } from './constant.js';
|
|
5
|
-
import RenderCustomCode from './RenderCustomCode.js';
|
|
6
|
-
import { ComponentToolbarPreview } from './ComponentToolbarPreview.js';
|
|
7
|
-
import useApplyAnimation from '../hooks/animation/useApplyAnimation.js';
|
|
8
|
-
|
|
9
|
-
const ComponentWrapperPreview = ({ children, ...props })=>{
|
|
10
|
-
useEffect(()=>{
|
|
11
|
-
const event = new CustomEvent('editor:component:render', {
|
|
12
|
-
bubbles: true,
|
|
13
|
-
detail: {
|
|
14
|
-
componentUid: props.uid
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
window.dispatchEvent(event);
|
|
18
|
-
}, [
|
|
19
|
-
props.uid
|
|
20
|
-
]);
|
|
21
|
-
useApplyAnimation({
|
|
22
|
-
props
|
|
23
|
-
});
|
|
24
|
-
if (props.type === 'section') {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
const customProps = {};
|
|
28
|
-
if (props.tag === 'Section' && props.isThemeSection) {
|
|
29
|
-
customProps['data-theme-section'] = true;
|
|
30
|
-
}
|
|
31
|
-
// Build editor configs
|
|
32
|
-
if (props.editorConfigs) {
|
|
33
|
-
const editorConfigs = props.editorConfigs;
|
|
34
|
-
if (editorConfigs.placeholder?.notAppendBeforeAfter) {
|
|
35
|
-
customProps['data-placeholder-not-append-before-after'] = true;
|
|
36
|
-
}
|
|
37
|
-
if (editorConfigs.toolbar?.parent) {
|
|
38
|
-
customProps['data-toolbar-parent'] = true;
|
|
39
|
-
}
|
|
40
|
-
if (editorConfigs.component?.noDelete) {
|
|
41
|
-
customProps['data-component-no-delete'] = true;
|
|
42
|
-
}
|
|
43
|
-
if (editorConfigs.component?.noDuplicate) {
|
|
44
|
-
customProps['data-component-no-duplicate'] = true;
|
|
45
|
-
}
|
|
46
|
-
if (editorConfigs.component?.noDragDrop) {
|
|
47
|
-
customProps['data-component-no-drag-drop'] = true;
|
|
48
|
-
}
|
|
49
|
-
if (editorConfigs.component?.noSetting) {
|
|
50
|
-
customProps['data-component-no-setting'] = true;
|
|
51
|
-
}
|
|
52
|
-
if (editorConfigs.component?.isThirdParty) {
|
|
53
|
-
customProps['data-component-is-third-party'] = true;
|
|
54
|
-
}
|
|
55
|
-
if (editorConfigs.toolbar?.hide) {
|
|
56
|
-
customProps['data-toolbar-hide'] = true;
|
|
57
|
-
}
|
|
58
|
-
if (editorConfigs.slots?.children) {
|
|
59
|
-
customProps['data-slots-children'] = true;
|
|
60
|
-
}
|
|
61
|
-
if (!editorConfigs.toolbar?.hide) {
|
|
62
|
-
customProps['data-toolbar-wrap'] = true;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
// Show toolbar wrapper
|
|
66
|
-
if (!props?.editorConfigs?.toolbar?.hide) {
|
|
67
|
-
customProps['data-toolbar-wrap'] = true;
|
|
68
|
-
}
|
|
69
|
-
const style = composeAdvanceStyle(props.advanced, props.tag);
|
|
70
|
-
const advanced = props.advanced;
|
|
71
|
-
const builderAttrs = {
|
|
72
|
-
...customProps,
|
|
73
|
-
'data-uid': props.uid,
|
|
74
|
-
'data-component-type': 'component',
|
|
75
|
-
'data-component-tag': props.tag,
|
|
76
|
-
'data-component-label': props.label
|
|
77
|
-
};
|
|
78
|
-
if (disableWrap.includes(props.tag) && /*#__PURE__*/ isValidElement(children)) {
|
|
79
|
-
return /*#__PURE__*/ jsxs(Fragment, {
|
|
80
|
-
children: [
|
|
81
|
-
/*#__PURE__*/ jsx(RenderCustomCode, {
|
|
82
|
-
uid: props.uid,
|
|
83
|
-
advanced: advanced
|
|
84
|
-
}),
|
|
85
|
-
/*#__PURE__*/ jsxs(children.type, {
|
|
86
|
-
className: advanced?.cssClass,
|
|
87
|
-
...children.props,
|
|
88
|
-
style,
|
|
89
|
-
builderAttrs,
|
|
90
|
-
advanced,
|
|
91
|
-
children: [
|
|
92
|
-
children.props['children'],
|
|
93
|
-
/*#__PURE__*/ jsx(ComponentToolbarPreview, {
|
|
94
|
-
...props
|
|
95
|
-
})
|
|
96
|
-
]
|
|
97
|
-
})
|
|
98
|
-
]
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
// Render
|
|
102
|
-
return /*#__PURE__*/ jsxs(Fragment, {
|
|
103
|
-
children: [
|
|
104
|
-
/*#__PURE__*/ jsx(RenderCustomCode, {
|
|
105
|
-
uid: props.uid,
|
|
106
|
-
advanced: advanced
|
|
107
|
-
}),
|
|
108
|
-
/*#__PURE__*/ jsxs("div", {
|
|
109
|
-
style: !excludeApplyStyle.includes(props.tag) ? style : {
|
|
110
|
-
'--mb': style?.['--mb'],
|
|
111
|
-
'--mb-tablet': style?.['--mb-tablet'],
|
|
112
|
-
'--mb-mobile': style?.['--mb-mobile']
|
|
113
|
-
},
|
|
114
|
-
className: `${props.uid} ${props.advanced?.cssClass ? props.advanced?.cssClass : ''}`,
|
|
115
|
-
...builderAttrs,
|
|
116
|
-
children: [
|
|
117
|
-
!excludeApplyStyle.includes(props.tag) && children,
|
|
118
|
-
/*#__PURE__*/ isValidElement(children) && excludeApplyStyle.includes(props.tag) && /*#__PURE__*/ jsx(children.type, {
|
|
119
|
-
...children.props,
|
|
120
|
-
style,
|
|
121
|
-
advanced
|
|
122
|
-
}),
|
|
123
|
-
/*#__PURE__*/ jsx(ComponentToolbarPreview, {
|
|
124
|
-
...props
|
|
125
|
-
})
|
|
126
|
-
]
|
|
127
|
-
})
|
|
128
|
-
]
|
|
129
|
-
});
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
export { ComponentWrapperPreview as default };
|
|
1
|
+
import{jsxs as e,Fragment as t,jsx as o}from"react/jsx-runtime";import{memo as a,useEffect as n,isValidElement as r}from"react";import{composeAdvanceStyle as d}from"../helpers/compose-advance-style.js";import{disableWrap as p,excludeApplyStyle as i}from"./constant.js";import l from"./RenderCustomCode.js";import s from"./ComponentToolbarPreview.js";import m from"../hooks/animation/useApplyAnimation.js";import"zustand";import"swr";import"@gem-sdk/adapter-shopify";import"swr/mutation";import{usePageType as c}from"../hooks/shop.js";import"vanilla-lazyload";import"../hooks/useCartUI.js";import"../helpers/convert.js";let ComponentWrapperPreview=({children:a,...h})=>{n(()=>{let e=new CustomEvent("editor:component:render",{bubbles:!0,detail:{componentUid:h.uid}});window.dispatchEvent(e)},[h.uid]),m({props:h});let u=c();if("section"===h.type)return null;let b={};if("Section"===h.tag&&h.isThemeSection&&(b["data-theme-section"]=!0),h.editorConfigs){let e=h.editorConfigs;e.placeholder?.notAppendBeforeAfter&&(b["data-placeholder-not-append-before-after"]=!0),e.placeholder?.notAppendLeftRight&&(b["data-placeholder-not-append-left-right"]=!0),e.toolbar?.parent&&(b["data-toolbar-parent"]=!0),e.component?.noDelete&&(b["data-component-no-delete"]=!0),e.component?.noDuplicate&&(b["data-component-no-duplicate"]=!0),e.component?.noDragDrop&&(b["data-component-no-drag-drop"]=!0),e.component?.noSetting&&(b["data-component-no-setting"]=!0),e.component?.isThirdParty&&(b["data-component-is-third-party"]=!0),e.toolbar?.hide&&(b["data-toolbar-hide"]=!0),e.slots?.children&&(b["data-slots-children"]=!0),e.toolbar?.hide||(b["data-toolbar-wrap"]=!0)}h?.editorConfigs?.toolbar?.hide||(b["data-toolbar-wrap"]=!0);let f=e=>"GP_FUNNEL_PAGE"===u&&["ProductList","Header"].includes(e),g=d(h.advanced,h.tag,u),v=h.advanced,C={...b,"data-uid":h.uid,"data-component-type":"component","data-component-tag":h.tag,"data-component-label":h.label,"data-not-droppable":f(h.tag)};return p.includes(h.tag)&&r(a)?e(t,{children:[o(l,{uid:h.uid,advanced:v}),e(a.type,{className:v?.cssClass,...a.props,style:g,builderAttrs:C,advanced:v,children:[a.props.children,o(s,{...h})]})]}):e(t,{children:[o(l,{uid:h.uid,advanced:v}),e("div",{style:i.includes(h.tag)?{"--mb":g?.["--mb"],"--mb-tablet":g?.["--mb-tablet"],"--mb-mobile":g?.["--mb-mobile"]}:g,className:`${h.uid} ${h.advanced?.cssClass?h.advanced?.cssClass:""}`,...C,children:[!i.includes(h.tag)&&a,r(a)&&i.includes(h.tag)&&o(a.type,{...a.props,style:g,advanced:v}),o(s,{...h})]})]})};var ComponentWrapperPreview$1=a(ComponentWrapperPreview);export{ComponentWrapperPreview$1 as default};
|
|
@@ -1,61 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { memo } from 'react';
|
|
3
|
-
import { ErrorBoundary } from 'react-error-boundary';
|
|
4
|
-
import { useBuilderComponent } from '../contexts/BuilderComponent.js';
|
|
5
|
-
import { useBuilderStore } from '../contexts/BuilderContext.js';
|
|
6
|
-
import ComponentWrapper from './ComponentWrapper.js';
|
|
7
|
-
import RenderSectionMemo from './RenderSection.js';
|
|
8
|
-
|
|
9
|
-
const Render = ({ uid, ...passProps })=>{
|
|
10
|
-
const item = useBuilderStore((s)=>s.getItem(uid));
|
|
11
|
-
const Component = useBuilderComponent(item?.tag);
|
|
12
|
-
if (!item) return null;
|
|
13
|
-
if (item?.type === 'section') {
|
|
14
|
-
return /*#__PURE__*/ jsx(RenderSectionMemo, {
|
|
15
|
-
sectionId: item.uid
|
|
16
|
-
});
|
|
17
|
-
} else {
|
|
18
|
-
return /*#__PURE__*/ jsx(ErrorBoundary, {
|
|
19
|
-
fallbackRender: ({ error, resetErrorBoundary })=>/*#__PURE__*/ jsxs(Fragment, {
|
|
20
|
-
children: [
|
|
21
|
-
/*#__PURE__*/ jsx("span", {
|
|
22
|
-
"aria-label": "Error message",
|
|
23
|
-
children: error.message
|
|
24
|
-
}),
|
|
25
|
-
/*#__PURE__*/ jsx("button", {
|
|
26
|
-
type: "button",
|
|
27
|
-
onClick: resetErrorBoundary,
|
|
28
|
-
children: "Try again"
|
|
29
|
-
})
|
|
30
|
-
]
|
|
31
|
-
}),
|
|
32
|
-
children: /*#__PURE__*/ jsx(ComponentWrapper, {
|
|
33
|
-
...item,
|
|
34
|
-
children: item?.childrens?.length ? /*#__PURE__*/ jsx(Component, {
|
|
35
|
-
builderProps: {
|
|
36
|
-
uid,
|
|
37
|
-
builderData: item
|
|
38
|
-
},
|
|
39
|
-
styles: item.styles,
|
|
40
|
-
setting: item.settings,
|
|
41
|
-
...passProps,
|
|
42
|
-
children: item.childrens.map((id)=>/*#__PURE__*/ jsx(RenderMemo, {
|
|
43
|
-
uid: id
|
|
44
|
-
}, id))
|
|
45
|
-
}) : /*#__PURE__*/ jsx(Component, {
|
|
46
|
-
builderProps: {
|
|
47
|
-
uid,
|
|
48
|
-
builderData: item
|
|
49
|
-
},
|
|
50
|
-
styles: item.styles,
|
|
51
|
-
setting: item.settings,
|
|
52
|
-
...passProps
|
|
53
|
-
})
|
|
54
|
-
})
|
|
55
|
-
}, item.uid);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
const RenderMemo = /*#__PURE__*/ memo(Render);
|
|
59
|
-
RenderMemo.displayName = 'RenderMemo';
|
|
60
|
-
|
|
61
|
-
export { RenderMemo as default };
|
|
1
|
+
import{jsx as e,jsxs as r,Fragment as t}from"react/jsx-runtime";import{memo as n,useMemo as o}from"react";import{ErrorBoundary as i}from"react-error-boundary";import{useBuilderComponent as s}from"../contexts/BuilderComponent.js";import{useBuilderStore as d}from"../contexts/BuilderContext.js";import l from"./ComponentWrapper.js";import a from"./RenderSection.js";let Render=({uid:n,...m})=>{let p=d(e=>e.getItem(n)),c=s(p?.tag),u=d(e=>e.getIsPostPurchase()),g=o(()=>u?"POST_PURCHASE":void 0,[u]);return p?p?.type==="section"?e(a,{sectionId:p.uid}):e(i,{fallbackRender:({error:n,resetErrorBoundary:o})=>r(t,{children:[e("span",{"aria-label":"Error message",children:n.message}),e("button",{type:"button",onClick:o,children:"Try again"})]}),children:e(l,{...p,pageType:g,children:p?.childrens?.length?e(c,{builderProps:{uid:n,builderData:p},styles:p.styles,setting:p.settings,...m,children:p.childrens.map(r=>e(RenderMemo,{uid:r},r))}):e(c,{builderProps:{uid:n,builderData:p},styles:p.styles,setting:p.settings,...m})})},p.uid):null},RenderMemo=n(Render);RenderMemo.displayName="RenderMemo";export{RenderMemo as default};
|
|
@@ -1,291 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import 'zustand';
|
|
5
|
-
import 'swr';
|
|
6
|
-
import '@gem-sdk/adapter-shopify';
|
|
7
|
-
import 'swr/mutation';
|
|
8
|
-
import 'vanilla-lazyload';
|
|
9
|
-
import '../hooks/useCartUI.js';
|
|
10
|
-
import 'react-transition-group';
|
|
11
|
-
import '@gem-sdk/core';
|
|
12
|
-
import { composeAdvanceStyle } from '../helpers/compose-advance-style.js';
|
|
13
|
-
import { baseAssetURL, isLocalEnv } from '../helpers/convert.js';
|
|
14
|
-
import { RenderIf, template } from '../helpers/render.js';
|
|
15
|
-
import { disableWrap, customRenderChildren } from './constant.js';
|
|
16
|
-
|
|
17
|
-
const componentsRenderWithParentId = [
|
|
18
|
-
'CarouselItem'
|
|
19
|
-
];
|
|
20
|
-
const componentTexts = [
|
|
21
|
-
'Text',
|
|
22
|
-
'Heading'
|
|
23
|
-
];
|
|
24
|
-
const componentIconList = [
|
|
25
|
-
'IconListV2',
|
|
26
|
-
'IconList'
|
|
27
|
-
];
|
|
28
|
-
const componentUsingAdvanced = [
|
|
29
|
-
'IconList'
|
|
30
|
-
];
|
|
31
|
-
const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageContext, ...passProps })=>{
|
|
32
|
-
const item = builder[uid];
|
|
33
|
-
const Component = components[item?.tag];
|
|
34
|
-
if (!Component) {
|
|
35
|
-
console.log('Miss component: ', item);
|
|
36
|
-
return {
|
|
37
|
-
liquid: '',
|
|
38
|
-
extraFiles
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
if (!item) {
|
|
42
|
-
return {
|
|
43
|
-
liquid: '',
|
|
44
|
-
extraFiles
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
if (item?.type === 'section') {
|
|
48
|
-
return {
|
|
49
|
-
liquid: '',
|
|
50
|
-
extraFiles
|
|
51
|
-
};
|
|
52
|
-
} else {
|
|
53
|
-
const customProps = {
|
|
54
|
-
extraFiles: {}
|
|
55
|
-
};
|
|
56
|
-
const style = composeAdvanceStyle(item.advanced, item.tag);
|
|
57
|
-
let liquid = '';
|
|
58
|
-
if (disableWrap.includes(item.tag)) {
|
|
59
|
-
liquid = RenderIf(item?.childrens?.length, ()=>{
|
|
60
|
-
return Component({
|
|
61
|
-
builderProps: {
|
|
62
|
-
uid,
|
|
63
|
-
builderData: item
|
|
64
|
-
},
|
|
65
|
-
styles: item.styles,
|
|
66
|
-
setting: item.settings,
|
|
67
|
-
style,
|
|
68
|
-
advanced: item.advanced,
|
|
69
|
-
parentId: componentsRenderWithParentId.includes(item.tag) ? parentId : null,
|
|
70
|
-
pageContext,
|
|
71
|
-
...passProps,
|
|
72
|
-
rawChildren: item.childrens.map((id)=>{
|
|
73
|
-
return {
|
|
74
|
-
...builder[id],
|
|
75
|
-
uid: id,
|
|
76
|
-
builder,
|
|
77
|
-
components,
|
|
78
|
-
customProps,
|
|
79
|
-
pageContext
|
|
80
|
-
};
|
|
81
|
-
}),
|
|
82
|
-
children: !customRenderChildren.includes(item.tag) ? WrapRenderChildren({
|
|
83
|
-
uid,
|
|
84
|
-
customProps
|
|
85
|
-
}, item.childrens.map((id)=>RenderChildren({
|
|
86
|
-
uid: id,
|
|
87
|
-
builder,
|
|
88
|
-
components,
|
|
89
|
-
customProps,
|
|
90
|
-
parentTag: item.tag,
|
|
91
|
-
pageContext
|
|
92
|
-
}))) : ''
|
|
93
|
-
});
|
|
94
|
-
}, ()=>{
|
|
95
|
-
return Component({
|
|
96
|
-
builderProps: {
|
|
97
|
-
uid,
|
|
98
|
-
builderData: item
|
|
99
|
-
},
|
|
100
|
-
styles: item.styles,
|
|
101
|
-
setting: item.settings,
|
|
102
|
-
advanced: item.advanced,
|
|
103
|
-
style,
|
|
104
|
-
isText: componentTexts.includes(item.tag) ? true : null,
|
|
105
|
-
parentId: componentsRenderWithParentId.includes(item.tag) ? parentId : null,
|
|
106
|
-
pageContext,
|
|
107
|
-
...passProps
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
} else {
|
|
111
|
-
liquid = template`<div style="${!componentIconList.includes(item.tag) ? style : ''}" class="${item.uid} ${!item?.childrens?.length && item.tag === 'IconListItemHoz' ? 'hidden' : ''}">
|
|
112
|
-
${RenderIf(item?.childrens?.length, ()=>{
|
|
113
|
-
return Component({
|
|
114
|
-
builderProps: {
|
|
115
|
-
uid,
|
|
116
|
-
builderData: item
|
|
117
|
-
},
|
|
118
|
-
styles: item.styles,
|
|
119
|
-
setting: item.settings,
|
|
120
|
-
advanced: {
|
|
121
|
-
...componentUsingAdvanced.includes(item.tag) ? item?.advanced : {},
|
|
122
|
-
cssClass: item?.advanced?.cssClass
|
|
123
|
-
},
|
|
124
|
-
pageContext,
|
|
125
|
-
...passProps,
|
|
126
|
-
rawChildren: item.childrens.map((id)=>{
|
|
127
|
-
return {
|
|
128
|
-
...builder[id],
|
|
129
|
-
uid: id,
|
|
130
|
-
builder,
|
|
131
|
-
components,
|
|
132
|
-
customProps,
|
|
133
|
-
pageContext
|
|
134
|
-
};
|
|
135
|
-
}),
|
|
136
|
-
children: !customRenderChildren.includes(item.tag) ? WrapRenderChildren({
|
|
137
|
-
uid,
|
|
138
|
-
customProps
|
|
139
|
-
}, item.childrens.map((id)=>RenderChildren({
|
|
140
|
-
uid: id,
|
|
141
|
-
builder,
|
|
142
|
-
components,
|
|
143
|
-
customProps,
|
|
144
|
-
parentTag: item.tag,
|
|
145
|
-
pageContext
|
|
146
|
-
}))) : ''
|
|
147
|
-
});
|
|
148
|
-
}, ()=>{
|
|
149
|
-
return Component({
|
|
150
|
-
builderProps: {
|
|
151
|
-
uid,
|
|
152
|
-
builderData: item
|
|
153
|
-
},
|
|
154
|
-
styles: item.styles,
|
|
155
|
-
setting: item.settings,
|
|
156
|
-
advanced: {
|
|
157
|
-
cssClass: item?.advanced?.cssClass
|
|
158
|
-
},
|
|
159
|
-
pageContext,
|
|
160
|
-
isText: componentTexts.includes(item.tag) ? true : null,
|
|
161
|
-
style: componentIconList.includes(item.tag) ? style : null,
|
|
162
|
-
...passProps
|
|
163
|
-
});
|
|
164
|
-
})}
|
|
165
|
-
</div>`;
|
|
166
|
-
}
|
|
167
|
-
const { cssCode, jsCode } = RenderCustomCode(item);
|
|
168
|
-
if (cssCode) liquid += cssCode;
|
|
169
|
-
if (jsCode) liquid += jsCode;
|
|
170
|
-
liquid = appendAnimation(item, liquid);
|
|
171
|
-
return {
|
|
172
|
-
liquid,
|
|
173
|
-
extraFiles: customProps.extraFiles
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
const RenderCustomCode = (item)=>{
|
|
178
|
-
const { css, javascript, rootClassName } = item.advanced?.editorData || {};
|
|
179
|
-
const replacedCSS = css?.replaceAll(rootClassName, item.uid);
|
|
180
|
-
const replacedJS = javascript?.replaceAll(rootClassName, item.uid);
|
|
181
|
-
const cssCode = RenderIf(!!css, template`
|
|
1
|
+
import{makeStyleResponsive as e}from"../helpers/make-style.js";import"react";import"react/jsx-runtime";import"zustand";import"swr";import"@gem-sdk/adapter-shopify";import"swr/mutation";import"vanilla-lazyload";import"../hooks/useCartUI.js";import"react-transition-group";import"@gem-sdk/core";import"classnames";import{disableWrap as t,customRenderChildren as n}from"./constant.js";import{composeAdvanceStyle as r}from"../helpers/compose-advance-style.js";import{baseAssetURL as i,isLocalEnv as s}from"../helpers/convert.js";import{RenderIf as a,template as d}from"../helpers/render.js";let componentsRenderWithParentId=["CarouselItem"],componentTexts=["Text","Heading"],componentIconList=["IconListV2","IconList"],componentUsingAdvanced=["IconList"],Render=({uid:e,builder:i,components:s,parentId:l,extraFiles:o={},pageContext:p,...c})=>{let u=i[e],m=s[u?.tag];if(!m)return console.log("Miss component: ",u),{liquid:"",extraFiles:o};if(!u||u?.type==="section")return{liquid:"",extraFiles:o};{let o={extraFiles:{}},g=r(u.advanced,u.tag),h="";h=t.includes(u.tag)?a(u?.childrens?.length,()=>m({builderProps:{uid:e,builderData:u},styles:u.styles,setting:u.settings,style:g,advanced:u.advanced,parentId:componentsRenderWithParentId.includes(u.tag)?l:null,pageContext:p,...c,rawChildren:u.childrens.map(e=>({...i[e],uid:e,builder:i,components:s,customProps:o,pageContext:p})),children:n.includes(u.tag)?"":WrapRenderChildren({uid:e,customProps:o},u.childrens.map(e=>RenderChildren({uid:e,builder:i,components:s,customProps:o,parentTag:u.tag,pageContext:p})))}),()=>m({builderProps:{uid:e,builderData:u},styles:u.styles,setting:u.settings,advanced:u.advanced,style:g,isText:!!componentTexts.includes(u.tag)||null,parentId:componentsRenderWithParentId.includes(u.tag)?l:null,pageContext:p,...c})):d`<div style="${componentIconList.includes(u.tag)?"":g}" class="${u.uid} ${u?.childrens?.length||"IconListItemHoz"!==u.tag?"":"hidden"}">
|
|
2
|
+
${a(u?.childrens?.length,()=>m({builderProps:{uid:e,builderData:u},styles:u.styles,setting:u.settings,advanced:{...componentUsingAdvanced.includes(u.tag)?u?.advanced:{},cssClass:u?.advanced?.cssClass},pageContext:p,...c,rawChildren:u.childrens.map(e=>({...i[e],uid:e,builder:i,components:s,customProps:o,pageContext:p})),children:n.includes(u.tag)?"":WrapRenderChildren({uid:e,customProps:o},u.childrens.map(e=>RenderChildren({uid:e,builder:i,components:s,customProps:o,parentTag:u.tag,pageContext:p})))}),()=>m({builderProps:{uid:e,builderData:u},styles:u.styles,setting:u.settings,advanced:{cssClass:u?.advanced?.cssClass},pageContext:p,isText:!!componentTexts.includes(u.tag)||null,style:componentIconList.includes(u.tag)?g:null,...c}))}
|
|
3
|
+
</div>`;let{cssCode:f,jsCode:v}=RenderCustomCode(u);return f&&(h+=f),v&&(h+=v),{liquid:h=appendAnimation(u,h),extraFiles:o.extraFiles}}},RenderCustomCode=e=>{let{css:t,javascript:n,rootClassName:r}=e.advanced?.editorData||{},i=t?.replaceAll(r,e.uid),s=n?.replaceAll(r,e.uid),l=a(!!t,d`
|
|
182
4
|
<style
|
|
183
|
-
id="${`custom-css-${
|
|
184
|
-
>${
|
|
185
|
-
`)
|
|
186
|
-
const jsCode = RenderIf(!!javascript, template`
|
|
5
|
+
id="${`custom-css-${e?.uid}`}"
|
|
6
|
+
>${i}</style>
|
|
7
|
+
`),o=a(!!n,d`
|
|
187
8
|
<script
|
|
188
|
-
id="${`custom-js-${
|
|
9
|
+
id="${`custom-js-${e?.uid}`}"
|
|
189
10
|
>
|
|
190
11
|
try {
|
|
191
|
-
${
|
|
12
|
+
${s}
|
|
192
13
|
} catch(err){}
|
|
193
14
|
</script>
|
|
194
|
-
`);
|
|
195
|
-
return {
|
|
196
|
-
cssCode,
|
|
197
|
-
jsCode
|
|
198
|
-
};
|
|
199
|
-
};
|
|
200
|
-
const appendAnimation = (props, liquid)=>{
|
|
201
|
-
const { advanced, tag } = props;
|
|
202
|
-
const { animation, op: opacity } = advanced ?? {};
|
|
203
|
-
const getAnimationType = (settings, type)=>{
|
|
204
|
-
return settings?.triggerConfig?.[type]?.animation ?? 'none';
|
|
205
|
-
};
|
|
206
|
-
const getSettingsByDevice = (device)=>{
|
|
207
|
-
if (device === 'desktop') return animation?.desktop;
|
|
208
|
-
else if (device === 'tablet') return animation?.tablet ?? animation?.desktop;
|
|
209
|
-
else if (device === 'mobile') return animation?.mobile ?? animation?.tablet ?? animation?.desktop;
|
|
210
|
-
return animation?.desktop;
|
|
211
|
-
};
|
|
212
|
-
const appearDesktop = getAnimationType(getSettingsByDevice('desktop'), 'appear');
|
|
213
|
-
const hoverDesktop = getAnimationType(getSettingsByDevice('desktop'), 'hover');
|
|
214
|
-
const appearTablet = getAnimationType(getSettingsByDevice('tablet'), 'appear');
|
|
215
|
-
const appearMobile = getAnimationType(getSettingsByDevice('mobile'), 'appear');
|
|
216
|
-
const enableAnimation = animation?.desktop?.enabled && (appearDesktop !== 'none' || hoverDesktop !== 'none') || animation?.tablet?.enabled && appearTablet !== 'none' || animation?.mobile?.enabled && appearMobile !== 'none';
|
|
217
|
-
if (!enableAnimation) return liquid;
|
|
218
|
-
const getInitOpacity = (device)=>+!(getSettingsByDevice(device)?.enabled && ![
|
|
219
|
-
'shake',
|
|
220
|
-
'none'
|
|
221
|
-
].includes(getAnimationType(getSettingsByDevice(device), 'appear')));
|
|
222
|
-
const opacityObject = {
|
|
223
|
-
desktop: getInitOpacity('desktop'),
|
|
224
|
-
tablet: getInitOpacity('tablet'),
|
|
225
|
-
mobile: getInitOpacity('mobile')
|
|
226
|
-
};
|
|
227
|
-
const inheritParentStyle = {
|
|
228
|
-
all: tag === 'Section' ? '' : 'inherit',
|
|
229
|
-
position: 'static',
|
|
230
|
-
transform: 'unset'
|
|
231
|
-
};
|
|
232
|
-
return template`
|
|
15
|
+
`);return{cssCode:l,jsCode:o}},appendAnimation=(t,n)=>{let{advanced:r,tag:l}=t,{animation:o,op:p}=r??{},c=(e,t)=>e?.triggerConfig?.[t]?.animation??"none",u=e=>{if("desktop"===e);else if("tablet"===e)return o?.tablet??o?.desktop;else if("mobile"===e)return o?.mobile??o?.tablet??o?.desktop;return o?.desktop},m=c(u("desktop"),"appear"),g=c(u("desktop"),"hover"),h=c(u("tablet"),"appear"),f=c(u("mobile"),"appear"),v=o?.desktop?.enabled&&("none"!==m||"none"!==g)||o?.tablet?.enabled&&"none"!==h||o?.mobile?.enabled&&"none"!==f;if(!v)return n;let b=e=>+!(u(e)?.enabled&&!["shake","none"].includes(c(u(e),"appear"))),y={desktop:b("desktop"),tablet:b("tablet"),mobile:b("mobile")},C={all:"Section"===l?"":"inherit",position:"static",transform:"unset"};return d`
|
|
233
16
|
<gp-animation
|
|
234
|
-
gp-data='${JSON.stringify({
|
|
235
|
-
|
|
236
|
-
tag,
|
|
237
|
-
opacity
|
|
238
|
-
})}'
|
|
239
|
-
style="${{
|
|
240
|
-
...inheritParentStyle
|
|
241
|
-
}}"
|
|
17
|
+
gp-data='${JSON.stringify({config:o,tag:l,opacity:p})}'
|
|
18
|
+
style="${{...C}}"
|
|
242
19
|
>
|
|
243
|
-
<div style="${{
|
|
244
|
-
...makeStyleResponsive('op', opacityObject)
|
|
245
|
-
}}">${liquid}</div>
|
|
20
|
+
<div style="${{...e("op",y)}}">${n}</div>
|
|
246
21
|
</gp-animation>
|
|
247
|
-
${
|
|
248
|
-
`;
|
|
249
|
-
};
|
|
250
|
-
const RenderChildren = (props)=>{
|
|
251
|
-
const data = Render(props);
|
|
252
|
-
// Append to prop parent
|
|
253
|
-
for(const key in data.extraFiles){
|
|
254
|
-
if (Object.prototype.hasOwnProperty.call(data.extraFiles, key)) {
|
|
255
|
-
props.customProps.extraFiles[key] = data.extraFiles[key];
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
// Fix limit 256kb
|
|
259
|
-
const textEncoder = new TextEncoder();
|
|
260
|
-
const size = data?.liquid ? textEncoder.encode(data.liquid).length : 0;
|
|
261
|
-
if (Math.ceil(size / 1024) >= 180) {
|
|
262
|
-
const fileName = `gp-section-snippet-${props.uid}`;
|
|
263
|
-
props.customProps.extraFiles[fileName] = data.liquid;
|
|
264
|
-
return `{% render '${fileName}', product: product, variant: variant, product_form_id: product_form_id, productSelectedVariant: productSelectedVariant, form: form %}`;
|
|
265
|
-
}
|
|
266
|
-
return data.liquid;
|
|
267
|
-
};
|
|
268
|
-
const WrapRenderChildren = ({ uid, customProps }, codes)=>{
|
|
269
|
-
let liquid = '';
|
|
270
|
-
if (codes?.length) {
|
|
271
|
-
for(let i = 0; i < codes.length; i++){
|
|
272
|
-
const code = codes[i];
|
|
273
|
-
if (code) {
|
|
274
|
-
const newLiquid = liquid + code;
|
|
275
|
-
// Fix limit 256kb
|
|
276
|
-
const textEncoder = new TextEncoder();
|
|
277
|
-
const size = newLiquid ? textEncoder.encode(newLiquid).length : 0;
|
|
278
|
-
if (Math.ceil(size / 1024) >= 180) {
|
|
279
|
-
const fileName = `gp-section-snippet-${uid + i}`;
|
|
280
|
-
customProps.extraFiles[fileName] = code;
|
|
281
|
-
liquid += `{% render '${fileName}', product: product, variant: variant, product_form_id: product_form_id, productSelectedVariant: productSelectedVariant, form: form %}`;
|
|
282
|
-
} else {
|
|
283
|
-
liquid += code;
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
return liquid;
|
|
289
|
-
};
|
|
290
|
-
|
|
291
|
-
export { RenderChildren, WrapRenderChildren, Render as default };
|
|
22
|
+
${a(s,'<script src="{{ \'gp-animation.js\' | asset_url }}" defer="defer"></script>',`<script src="${i}/assets-v2/gp-animation.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
|
|
23
|
+
`},RenderChildren=e=>{let t=Render(e);for(let n in t.extraFiles)Object.prototype.hasOwnProperty.call(t.extraFiles,n)&&(e.customProps.extraFiles[n]=t.extraFiles[n]);let n=new TextEncoder,r=t?.liquid?n.encode(t.liquid).length:0;if(Math.ceil(r/1024)>=180){let n=`gp-section-snippet-${e.uid}`;return e.customProps.extraFiles[n]=t.liquid,`{% render '${n}', product: product, variant: variant, product_form_id: product_form_id, productSelectedVariant: productSelectedVariant, form: form %}`}return t.liquid},WrapRenderChildren=({uid:e,customProps:t},n)=>{let r="";if(n?.length)for(let i=0;i<n.length;i++){let s=n[i];if(s){let n=r+s,a=new TextEncoder,d=n?a.encode(n).length:0;if(Math.ceil(d/1024)>=180){let n=`gp-section-snippet-${e+i}`;t.extraFiles[n]=s,r+=`{% render '${n}', product: product, variant: variant, product_form_id: product_form_id, productSelectedVariant: productSelectedVariant, form: form %}`}else r+=s}}return r};export{RenderChildren,WrapRenderChildren,Render as default};
|
|
@@ -1,50 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { memo } from 'react';
|
|
3
|
-
import { ErrorBoundary } from 'react-error-boundary';
|
|
4
|
-
import { useBuilderComponent } from '../contexts/BuilderComponent.js';
|
|
5
|
-
import { useBuilderStore } from '../contexts/BuilderContext.js';
|
|
6
|
-
import ComponentWrapper from './ComponentWrapper.js';
|
|
7
|
-
|
|
8
|
-
const RenderBlock = ({ uid })=>{
|
|
9
|
-
const item = useBuilderStore((s)=>s.getItem(uid));
|
|
10
|
-
const Component = useBuilderComponent(item?.tag);
|
|
11
|
-
if (!item || item.type === 'section') return null;
|
|
12
|
-
return /*#__PURE__*/ jsx(ErrorBoundary, {
|
|
13
|
-
fallbackRender: ({ error, resetErrorBoundary })=>/*#__PURE__*/ jsxs(ComponentWrapper, {
|
|
14
|
-
...item,
|
|
15
|
-
children: [
|
|
16
|
-
/*#__PURE__*/ jsx("span", {
|
|
17
|
-
"aria-label": "Error message",
|
|
18
|
-
children: error.message
|
|
19
|
-
}),
|
|
20
|
-
/*#__PURE__*/ jsx("button", {
|
|
21
|
-
type: "button",
|
|
22
|
-
onClick: resetErrorBoundary,
|
|
23
|
-
children: "Try again"
|
|
24
|
-
})
|
|
25
|
-
]
|
|
26
|
-
}),
|
|
27
|
-
children: /*#__PURE__*/ jsx(ComponentWrapper, {
|
|
28
|
-
...item,
|
|
29
|
-
children: item?.childrens?.length ? /*#__PURE__*/ jsx(Component, {
|
|
30
|
-
builderProps: {
|
|
31
|
-
uid
|
|
32
|
-
},
|
|
33
|
-
styles: item.styles ?? {},
|
|
34
|
-
setting: item.settings ?? {},
|
|
35
|
-
children: item?.childrens?.map((id)=>/*#__PURE__*/ jsx(RenderBlockMemo, {
|
|
36
|
-
uid: id
|
|
37
|
-
}, id))
|
|
38
|
-
}) : /*#__PURE__*/ jsx(Component, {
|
|
39
|
-
builderProps: {
|
|
40
|
-
uid
|
|
41
|
-
},
|
|
42
|
-
styles: item.styles ?? {},
|
|
43
|
-
setting: item.settings ?? {}
|
|
44
|
-
})
|
|
45
|
-
})
|
|
46
|
-
}, item.uid);
|
|
47
|
-
};
|
|
48
|
-
const RenderBlockMemo = /*#__PURE__*/ memo(RenderBlock);
|
|
49
|
-
|
|
50
|
-
export { RenderBlockMemo as default };
|
|
1
|
+
import{jsx as e,jsxs as r}from"react/jsx-runtime";import{memo as t}from"react";import{ErrorBoundary as o}from"react-error-boundary";import{useBuilderComponent as n}from"../contexts/BuilderComponent.js";import{useBuilderStore as l}from"../contexts/BuilderContext.js";import s from"./ComponentWrapper.js";let RenderBlock=({uid:t})=>{let i=l(e=>e.getItem(t)),d=n(i?.tag);return i&&"section"!==i.type?e(o,{fallbackRender:({error:t,resetErrorBoundary:o})=>r(s,{...i,children:[e("span",{"aria-label":"Error message",children:t.message}),e("button",{type:"button",onClick:o,children:"Try again"})]}),children:e(s,{...i,children:i?.childrens?.length?e(d,{builderProps:{uid:t},styles:i.styles??{},setting:i.settings??{},children:i?.childrens?.map(r=>e(RenderBlockMemo,{uid:r},r))}):e(d,{builderProps:{uid:t},styles:i.styles??{},setting:i.settings??{}})})},i.uid):null},RenderBlockMemo=t(RenderBlock);export{RenderBlockMemo as default};
|
|
@@ -1,54 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import Head from 'next/head';
|
|
3
|
-
import Script from 'next/script';
|
|
4
|
-
import { useMemo } from 'react';
|
|
5
|
-
import 'zustand';
|
|
6
|
-
import 'swr';
|
|
7
|
-
import '@gem-sdk/adapter-shopify';
|
|
8
|
-
import 'swr/mutation';
|
|
9
|
-
import { useEditorMode } from '../hooks/shop.js';
|
|
10
|
-
import 'vanilla-lazyload';
|
|
11
|
-
import '../hooks/useCartUI.js';
|
|
12
|
-
import 'react-transition-group';
|
|
13
|
-
import '@gem-sdk/core';
|
|
14
|
-
import '../helpers/convert.js';
|
|
15
|
-
|
|
16
|
-
const RenderCustomCode = ({ uid, advanced })=>{
|
|
17
|
-
const mode = useEditorMode();
|
|
18
|
-
const { css, javascript, rootClassName } = advanced?.editorData || {};
|
|
19
|
-
const replacedCSS = css?.replaceAll(rootClassName, uid);
|
|
20
|
-
const replacedJS = javascript?.replaceAll(rootClassName, uid);
|
|
21
|
-
const mapId = {
|
|
22
|
-
css: `custom-css-${uid}`,
|
|
23
|
-
javascript: `custom-js-${uid}`
|
|
24
|
-
};
|
|
25
|
-
const jsCode = useMemo(()=>{
|
|
26
|
-
return `
|
|
1
|
+
import{jsxs as r,Fragment as t,jsx as e}from"react/jsx-runtime";import o from"next/head";import s from"next/script";import{useMemo as m}from"react";import"zustand";import"swr";import"@gem-sdk/adapter-shopify";import"swr/mutation";import{useEditorMode as i}from"../hooks/shop.js";import"vanilla-lazyload";import"../hooks/useCartUI.js";import"react-transition-group";import"@gem-sdk/core";import"classnames";import"../helpers/convert.js";let RenderCustomCode=({uid:a,advanced:p})=>{let l=i(),{css:n,javascript:c,rootClassName:d}=p?.editorData||{},u=n?.replaceAll(d,a),h=c?.replaceAll(d,a),f={css:`custom-css-${a}`,javascript:`custom-js-${a}`},j=m(()=>`
|
|
27
2
|
try {
|
|
28
|
-
${
|
|
3
|
+
${h}
|
|
29
4
|
} catch(err){}
|
|
30
|
-
|
|
31
|
-
}, [
|
|
32
|
-
replacedJS
|
|
33
|
-
]);
|
|
34
|
-
return /*#__PURE__*/ jsxs(Fragment, {
|
|
35
|
-
children: [
|
|
36
|
-
/*#__PURE__*/ jsx(Head, {
|
|
37
|
-
children: !!css && /*#__PURE__*/ jsx("style", {
|
|
38
|
-
id: mapId['css'],
|
|
39
|
-
dangerouslySetInnerHTML: {
|
|
40
|
-
__html: replacedCSS
|
|
41
|
-
}
|
|
42
|
-
})
|
|
43
|
-
}),
|
|
44
|
-
!!javascript && mode !== 'edit' && /*#__PURE__*/ jsx(Script, {
|
|
45
|
-
id: mapId['javascript'],
|
|
46
|
-
dangerouslySetInnerHTML: {
|
|
47
|
-
__html: jsCode
|
|
48
|
-
}
|
|
49
|
-
})
|
|
50
|
-
]
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export { RenderCustomCode as default };
|
|
5
|
+
`,[h]);return r(t,{children:[e(o,{children:!!n&&e("style",{id:f.css,dangerouslySetInnerHTML:{__html:u}})}),!!c&&"edit"!==l&&e(s,{id:f.javascript,dangerouslySetInnerHTML:{__html:j}})]})};export{RenderCustomCode as default};
|