@gem-sdk/core 1.37.5 → 2.0.0-dev.832
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/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/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 +24802 -6237
- package/package.json +8 -3
|
@@ -1,62 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { memo } from 'react';
|
|
3
|
-
import { ErrorBoundary } from 'react-error-boundary';
|
|
4
|
-
import { useBuilderComponent } from '../contexts/BuilderComponent.js';
|
|
5
|
-
import { useBuilderPreviewStore } from '../contexts/BuilderPreviewContext.js';
|
|
6
|
-
import ComponentWrapperPreview from './ComponentWrapperPreview.js';
|
|
7
|
-
import RenderSectionMemo from './RenderSection.js';
|
|
8
|
-
|
|
9
|
-
const RenderPreview = ({ uid, ...passProps })=>{
|
|
10
|
-
const item = useBuilderPreviewStore((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(ComponentWrapperPreview, {
|
|
20
|
-
...item,
|
|
21
|
-
children: [
|
|
22
|
-
/*#__PURE__*/ jsx("span", {
|
|
23
|
-
"aria-label": "Error message",
|
|
24
|
-
children: error.message
|
|
25
|
-
}),
|
|
26
|
-
/*#__PURE__*/ jsx("button", {
|
|
27
|
-
type: "button",
|
|
28
|
-
onClick: resetErrorBoundary,
|
|
29
|
-
children: "Try again"
|
|
30
|
-
})
|
|
31
|
-
]
|
|
32
|
-
}),
|
|
33
|
-
children: /*#__PURE__*/ jsx(ComponentWrapperPreview, {
|
|
34
|
-
...item,
|
|
35
|
-
children: item?.childrens?.length ? /*#__PURE__*/ jsx(Component, {
|
|
36
|
-
builderProps: {
|
|
37
|
-
uid,
|
|
38
|
-
builderData: item
|
|
39
|
-
},
|
|
40
|
-
styles: item.styles,
|
|
41
|
-
setting: item.settings,
|
|
42
|
-
...passProps,
|
|
43
|
-
children: item.childrens.map((id)=>/*#__PURE__*/ jsx(RenderPreviewMemo, {
|
|
44
|
-
uid: id
|
|
45
|
-
}, id))
|
|
46
|
-
}) : /*#__PURE__*/ jsx(Component, {
|
|
47
|
-
builderProps: {
|
|
48
|
-
uid,
|
|
49
|
-
builderData: item
|
|
50
|
-
},
|
|
51
|
-
styles: item.styles,
|
|
52
|
-
setting: item.settings,
|
|
53
|
-
...passProps
|
|
54
|
-
})
|
|
55
|
-
})
|
|
56
|
-
}, item.uid);
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
const RenderPreviewMemo = /*#__PURE__*/ memo(RenderPreview);
|
|
60
|
-
RenderPreviewMemo.displayName = 'RenderPreviewMemo';
|
|
61
|
-
|
|
62
|
-
export { RenderPreviewMemo as default };
|
|
1
|
+
import{jsx as e,jsxs as r}from"react/jsx-runtime";import{memo as t}from"react";import{ErrorBoundary as i}from"react-error-boundary";import{useBuilderComponent as n}from"../contexts/BuilderComponent.js";import{useBuilderPreviewStore as o}from"../contexts/BuilderPreviewContext.js";import s from"./ComponentWrapperPreview.js";import d from"./RenderSection.js";let RenderPreview=({uid:t,...l})=>{let m=o(e=>e.getItem(t)),a=n(m?.tag);return m?m?.type==="section"?e(d,{sectionId:m.uid}):e(i,{fallbackRender:({error:t,resetErrorBoundary:i})=>r(s,{...m,children:[e("span",{"aria-label":"Error message",children:t.message}),e("button",{type:"button",onClick:i,children:"Try again"})]}),children:e(s,{...m,children:m?.childrens?.length?e(a,{builderProps:{uid:t,builderData:m},styles:m.styles,setting:m.settings,...l,children:m.childrens.map(r=>e(RenderPreviewMemo,{uid:r},r))}):e(a,{builderProps:{uid:t,builderData:m},styles:m.styles,setting:m.settings,...l})})},m.uid):null},RenderPreviewMemo=t(RenderPreview);RenderPreviewMemo.displayName="RenderPreviewMemo";export{RenderPreviewMemo as default};
|
|
@@ -1,19 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { memo } from 'react';
|
|
3
|
-
import { BuilderProvider } from '../contexts/BuilderContext.js';
|
|
4
|
-
import { useSection } from '../contexts/SectionContext.js';
|
|
5
|
-
import RenderBlockMemo from './RenderBlock.js';
|
|
6
|
-
|
|
7
|
-
const RenderSection = ({ sectionId })=>{
|
|
8
|
-
const state = useSection(sectionId);
|
|
9
|
-
if (!state) return null;
|
|
10
|
-
return /*#__PURE__*/ jsx(BuilderProvider, {
|
|
11
|
-
state: state,
|
|
12
|
-
children: /*#__PURE__*/ jsx(RenderBlockMemo, {
|
|
13
|
-
uid: sectionId
|
|
14
|
-
})
|
|
15
|
-
}, sectionId);
|
|
16
|
-
};
|
|
17
|
-
const RenderSectionMemo = /*#__PURE__*/ memo(RenderSection);
|
|
18
|
-
|
|
19
|
-
export { RenderSectionMemo as default };
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{memo as t}from"react";import{BuilderProvider as o}from"../contexts/BuilderContext.js";import{useSection as r}from"../contexts/SectionContext.js";import n from"./RenderBlock.js";let RenderSection=({sectionId:t})=>{let i=r(t);return i?e(o,{state:i,children:e(n,{uid:t})},t):null},RenderSectionMemo=t(RenderSection);export{RenderSectionMemo as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsxs as e,jsx as p}from"react/jsx-runtime";import{useState as t,useCallback as o,useEffect as n}from"react";import{AIIcon as r}from"./icons/AIIcon.js";import{CloseIcon as g}from"./icons/CloseIcon.js";import{ShowMoreIcon as i}from"./icons/ShowMoreIcon.js";import{PickProduct as a}from"./components/PickProduct.js";import{ToneAndVoice as s}from"./components/ToneAndVoice.js";import l from"classnames";import{useListenEventGenerate as c}from"./hooks/useListenEventGenerate.js";import{useGettingGenerateRequest as d}from"./hooks/useGettingGenerateRequest.js";let AIContentGenerator=({...m})=>{let[x,u]=t(!1),[h,f]=t(!1),[b,v]=t(!1),{isGenerating:N,onGenerate:w}=c(m.uid),{getRequestBody:A,prompt:C,changeProductName:j,changePrompt:G}=d(),k=()=>{u(!x)},I=()=>{u(!1)},B=e=>{G(e.target.value)},y=o(e=>{let p=e.detail;p?.componentUid!==m.uid?(f(!1),I()):f(!0)},[m.uid]),E=()=>{v(!b)},L=()=>{let e=A();w(e)};return n(()=>{N||I()},[N]),n(()=>(window.addEventListener("editor:active-component",y),()=>{window.removeEventListener("editor:active-component",y)}),[y]),e("div",{className:`gp-relative ${!h&&"gp-hidden"}`,children:[p("div",{className:"gp-border-r-[#6a6a6a] gp-border-r-[1px] gp-pr-[4px] gp-mr-[4px]",children:e("button",{className:"gp-p-[4px] gp-text-[12px] gp-flex gp-gap-[4px] gp-items-center gp-rounded-[6px] hover:gp-bg-[#3B3B3B] gp-font-medium",onClick:k,children:[p(r,{}),"AI Content"]})}),e("div",{className:l({"gp-hidden":!x},"gp-absolute gp-top-[32px] gp-right-0 gp-rounded-[8px] gp-bg-[#151515] gp-p-[16px] gp-w-[312px] !gp-max-w-[312px] !gp-cursor-default"),children:[e("div",{className:"gp-flex gp-items-center gp-justify-between gp-mb-[14px]",children:[p("span",{className:"gp-font-medium gp-text-[14px]",children:"Write with GemAI"}),p("button",{className:"gp-p-[8px] gp-cursor-pointer hover:gp-bg-[#3B3B3B] gp-rounded-[6px]",onClick:I,children:p(g,{})})]}),e("div",{className:"gp-mt-[8px]",children:[p("div",{className:"gp-mb-[16px]",children:p("span",{className:"gp-text-[12px]",children:"What would you like to describe here?"})}),p("div",{className:"gp-mb-[16px] gp-flex",children:p("textarea",{className:"gp-p-[8px] gp-bg-[#333333] gp-rounded-[8px] gp-w-full gp-text-[12px] gp-text-white placeholder:gp-text-[#AAAAAA] gp-resize-none focus-visible:gp-outline-none",placeholder:"e.g: Generate feature benefits",rows:4,value:C,onChange:B})}),p("div",{className:"gp-mb-[16px]",children:e("button",{className:"gp-flex gp-justify-center gp-items-center gp-w-full gp-bg-[#333333] gp-py-[8px] gp-rounded-[8px] gp-gap-[8px] gp-text-[12px] gp-font-medium",onClick:E,children:["Show more",p("span",{className:l({"gp-rotate-180":b}),children:p(i,{})})]})}),e("div",{className:l({"gp-hidden":!b},"gp-mb-[16px] gp-gap-[16px] gp-flex gp-flex-col"),children:[p(s,{}),p(a,{changeProductName:j})]}),p("button",{className:"gp-rounded-[8px] gp-w-full gp-text-[12px] gp-font-medium gp-bg-gradient-to-tl gp-from-[#3C38E1] gp-to-[#874CFD] gp-py-[8px]",onClick:L,children:N?"Generating...":"Generate"})]})]})]})};export{AIContentGenerator};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useState as n,useRef as r,useCallback as i,useEffect as a}from"react";let AIGenContentLoading=({...s})=>{let[o,l]=n(!1),[u,f]=n(1),g=r(null),c=i(e=>{let t=e.detail;if(t?.sectionUid===s.uid){if("loading"===t.status){l(!0);return}if("success"===t.status){l(!1);return}}},[s.uid]);return a(()=>{if(o){g.current=setInterval(()=>{f(e=>3===e?1:e+1)},500);return}g.current&&clearInterval(g.current)},[o]),a(()=>(window.addEventListener("editor:ai-generate-content-status",c),()=>{window.removeEventListener("editor:ai-generate-content-status",c)}),[c]),o?e("div",{className:"gp-absolute gp-top-0 gp-left-0 gp-w-full gp-h-full gp-bg-[#ffffff] gp-bg-opacity-70 gp-flex gp-justify-center gp-items-center",children:t("span",{className:"gp-font-medium",children:["Generating Content",Array.from(Array(u).keys()).map(()=>".")]})}):null};export{AIGenContentLoading};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsxs as e,jsx as p}from"react/jsx-runtime";import{useState as t,useEffect as r}from"react";import"zustand";import"swr";import"@gem-sdk/adapter-shopify";import"swr/mutation";import{useProductsQuery as a}from"../../../hooks/shop/use-products-query.js";import"vanilla-lazyload";import"../../../hooks/useCartUI.js";import"react-transition-group";import"@gem-sdk/core";import"classnames";import"../../../helpers/convert.js";let PickProduct=g=>{let{data:o,isLoading:s}=a([]),[d,i]=t(),[c,l]=t(!1),m=()=>{l(!c)},n=e=>{i(e),l(!1)};return r(()=>{if(o?.products?.edges.length&&!d){let e=o.products.edges[0]?.node;e&&i({id:e?.id,name:e?.title,image:e.featuredImage?.src})}},[o,d]),r(()=>{d&&d.name&&g.changeProductName(d.name)},[d,g]),e("div",{className:"gp-flex gp-flex-col gp-gap-[8px]",children:[p("p",{className:"gp-py-[8px] gp-text-[12px]",children:"Product"}),e("div",{className:"gp-relative",children:[s?p("div",{children:p("span",{className:"gp-text-[12px]",children:"Getting products..."})}):e("button",{className:"gp-flex gp-gap-[8px] gp-items-center gp-w-full gp-p-[8px] gp-rounded-[8px] gp-bg-[#333333] gp-text-[12px]",onClick:m,children:[p("img",{className:"gp-rounded-[8px] gp-w-[40px] gp-h-[40px]",src:d?.image,alt:"product_image"}),p("span",{className:"gp-truncate gp-max-w-[210px]",children:d?.name})]}),c&&p("div",{className:"gp-absolute gp-w-full gp-top-[64px] gp-left-0 gp-rounded-[8px] gp-bg-[#333333] gp-p-[8px] gp-flex gp-flex-col gp-gap-[8px] gp-z-10",children:o?.products?.edges.map(t=>e("button",{className:"gp-flex gp-p-[8px] hover:gp-bg-[#3B3B3B] gp-rounded-[8px] gp-cursor-pointer gp-gap-[8px] gp-items-center",onClick:()=>{n({id:t.node?.id,name:t.node?.title,image:t.node?.featuredImage?.src})},children:[p("img",{className:"gp-rounded-[8px] gp-w-[40px] gp-h-[40px]",src:t.node?.featuredImage?.src,alt:"product_image"}),p("span",{className:"gp-truncate gp-max-w-[210px] gp-text-[12px]",children:t.node?.title})]},t.node?.id))})]})]})};export{PickProduct};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as p,jsxs as e}from"react/jsx-runtime";import{useState as l}from"react";import{DropdownIcon as g,TickIcon as n}from"../icons/DropdownIcon.js";import r from"classnames";let ToneAndVoice=()=>{let i=["Persuasive","Friendly","Professional","Casual"],[o,s]=l(i[0]),[a,c]=l(!1),t=()=>{c(!a)},d=p=>{s(p),c(!1)};return p("div",{children:e("div",{className:"gp-flex gp-flex-col gp-gap-[8px]",children:[p("p",{className:"gp-py-[8px] gp-text-[12px]",children:"Tone and Voice"}),e("div",{className:"gp-relative",children:[e("button",{className:"gp-flex gp-justify-between gp-items-center gp-w-full gp-p-[8px] gp-rounded-[8px] gp-bg-[#333333] gp-text-[12px]",onClick:t,children:[o,p(g,{})]}),a?p("div",{className:"gp-absolute gp-w-full gp-top-[40px] gp-left-0 gp-rounded-[8px] gp-bg-[#333333] gp-p-[8px] gp-flex gp-flex-col gp-gap-[8px] gp-z-10",children:i.map(l=>e("button",{className:"gp-flex gp-p-[8px] hover:gp-bg-[#3B3B3B] gp-rounded-[8px] gp-cursor-pointer gp-gap-[12px] gp-items-center",onClick:()=>d(l),children:[p("div",{className:r({"gp-invisible":o!==l}),children:p(n,{})}),p("span",{className:"gp-text-[12px]",children:l})]},l))}):null]})]})})};export{ToneAndVoice};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useState as e}from"react";let useGettingGenerateRequest=()=>{let[t,r]=e(""),[n,s]=e(""),[u,i]=e(""),G=e=>{r(e.slice(0,200))},a=e=>{s(e)},l=e=>{i(e)},o=()=>({prompt:t,productName:n,tone:u});return{prompt:t,changePrompt:G,productName:n,changeProductName:a,tone:u,changeTone:l,getRequestBody:o}};export{useGettingGenerateRequest};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useState as e,useCallback as t,useEffect as n}from"react";let useListenEventGenerate=i=>{let[s,o]=e(!1),a=e=>{let t=new CustomEvent("editor:toolbar:ai-generate-content",{bubbles:!0,detail:{componentUid:i,genRequest:e}});window.dispatchEvent(t),o(!0),r("loading")},r=e=>{let t=new CustomEvent("editor:ai-generate-content-status",{bubbles:!0,detail:{status:e,sectionUid:i}});window.dispatchEvent(t)},d=t(e=>{let t=e.detail;t?.sectionUid===i&&"success"===t.status&&o(!1)},[i]);return n(()=>(window.addEventListener("editor:ai-generate-content-status",d),()=>{window.removeEventListener("editor:ai-generate-content-status",d)}),[d]),{isGenerating:s,onGenerate:a}};export{useListenEventGenerate};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsxs as t,jsx as r}from"react/jsx-runtime";let AIIcon=()=>{let e=()=>Math.random().toString(36).substring(7),o=e();return t("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[r("path",{d:"M11.6363 2.67137C11.5886 2.52361 11.3795 2.52361 11.3318 2.67137L11.1133 3.34797C11.0352 3.58971 10.8469 3.78 10.606 3.86067L9.93715 4.08465C9.79156 4.1334 9.79156 4.33933 9.93715 4.38809L10.606 4.61207C10.8469 4.69273 11.0352 4.88302 11.1133 5.12477L11.3318 5.80137C11.3795 5.94913 11.5886 5.94913 11.6363 5.80137L11.8549 5.12477C11.933 4.88302 12.1212 4.69273 12.3621 4.61207L13.031 4.38809C13.1766 4.33933 13.1766 4.1334 13.031 4.08465L12.3621 3.86067C12.1212 3.78 11.933 3.58971 11.8549 3.34797L11.6363 2.67137Z",fill:`url(#${o}_0)`}),r("path",{d:"M7.61245 3.30705C7.54086 3.08541 7.22728 3.08541 7.15569 3.30705L6.39541 5.6608C6.16115 6.38604 5.59636 6.9569 4.87367 7.19891L2.56369 7.97242C2.3453 8.04555 2.34531 8.35445 2.5637 8.42758L4.87367 9.2011C5.59636 9.4431 6.16115 10.014 6.39541 10.7392L7.15569 13.093C7.22728 13.3146 7.54086 13.3146 7.61245 13.093L8.37273 10.7392C8.60699 10.014 9.17178 9.4431 9.89447 9.2011L12.2044 8.42758C12.4228 8.35445 12.4228 8.04555 12.2044 7.97242L9.89447 7.1989C9.17178 6.9569 8.60699 6.38604 8.37273 5.6608L7.61245 3.30705Z",fill:`url(#${o}_1)`}),t("defs",{children:[t("linearGradient",{id:`${o}_0`,x1:"15.3433",y1:"2.56054",x2:"4.24885",y2:"1.00838",gradientUnits:"userSpaceOnUse",children:[r("stop",{stopColor:"#D8E1FF"}),r("stop",{offset:"1",stopColor:"#C8ACFF"})]}),t("linearGradient",{id:`${o}_1`,x1:"15.3433",y1:"2.56054",x2:"4.24885",y2:"1.00838",gradientUnits:"userSpaceOnUse",children:[r("stop",{stopColor:"#D8E1FF"}),r("stop",{offset:"1",stopColor:"#C8ACFF"})]})]})]})};export{AIIcon};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";let CloseIcon=()=>e("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M11.1755 12.0243C11.4099 12.2586 11.7898 12.2586 12.0241 12.0243C12.2584 11.79 12.2584 11.4101 12.0241 11.1757L8.84833 8L12.0241 4.82427C12.2584 4.58995 12.2584 4.21005 12.0241 3.97574C11.7898 3.74142 11.4099 3.74142 11.1755 3.97574L7.9998 7.15148L4.82407 3.97574C4.58975 3.74142 4.20986 3.74142 3.97554 3.97574C3.74123 4.21005 3.74123 4.58995 3.97554 4.82427L7.15128 8L3.97554 11.1757C3.74123 11.4101 3.74123 11.79 3.97554 12.0243C4.20986 12.2586 4.58975 12.2586 4.82407 12.0243L7.9998 8.84853L11.1755 12.0243Z",fill:"#F9F9F9"})});export{CloseIcon};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";let DropdownIcon=()=>e("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.13313 7.62204C5.31064 7.45932 5.59845 7.45932 5.77596 7.62204L10 11.4941L14.224 7.62204C14.4016 7.45932 14.6894 7.45932 14.8669 7.62204C15.0444 7.78476 15.0444 8.04858 14.8669 8.21129L10.3214 12.378C10.1439 12.5407 9.8561 12.5407 9.67859 12.378L5.13313 8.21129C4.95562 8.04858 4.95562 7.78476 5.13313 7.62204Z",fill:"#F9F9F9"})}),TickIcon=()=>e("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.8415 5.1766C16.0528 5.41207 16.0528 5.79383 15.8415 6.0293L7.95016 14.8234C7.84869 14.9365 7.71107 15 7.56757 15C7.42408 15 7.28645 14.9365 7.18499 14.8234L4.15846 11.4505C3.94717 11.215 3.94718 10.8333 4.15848 10.5978C4.36978 10.3623 4.71236 10.3623 4.92365 10.5978L7.56759 13.5443L15.0764 5.1766C15.2877 4.94113 15.6302 4.94113 15.8415 5.1766Z",fill:"#00C853"})});export{DropdownIcon,TickIcon};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";let ShowMoreIcon=()=>e("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.60651 6.09763C4.74852 5.96746 4.97876 5.96746 5.12077 6.09763L8.5 9.19526L11.8792 6.09763C12.0212 5.96746 12.2515 5.96746 12.3935 6.09763C12.5355 6.22781 12.5355 6.43886 12.3935 6.56904L8.75713 9.90237C8.61512 10.0325 8.38488 10.0325 8.24287 9.90237L4.60651 6.56904C4.4645 6.43886 4.4645 6.22781 4.60651 6.09763Z",fill:"#F9F9F9"})});export{ShowMoreIcon};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{makeStyleResponsive as t}from"../../helpers/make-style.js";import{useRef as r}from"react";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"../../helpers/convert.js";import{useLivePageAnimation as o}from"../../hooks/animation/useLivePageAnimation.js";let AnimationWrapper=({children:i,settings:a,tag:s})=>{let m=r(null),p=(e,t)=>e?.triggerConfig?.[t]?.animation??"none",n=e=>{if("desktop"===e);else if("tablet"===e)return a?.tablet??a?.desktop;else if("mobile"===e)return a?.mobile??a?.tablet??a?.desktop;return a?.desktop},l=e=>+!(n(e)?.enabled&&!["shake","none"].includes(p(n(e),"appear"))),d={desktop:l("desktop"),tablet:l("tablet"),mobile:l("mobile")};return o(m,a,s),e("div",{ref:m,style:{...t("op",d)},children:i})};export{AnimationWrapper as default};
|
|
@@ -1,50 +1 @@
|
|
|
1
|
-
|
|
2
|
-
'Col',
|
|
3
|
-
'CollectionBanner',
|
|
4
|
-
'Row',
|
|
5
|
-
'Section',
|
|
6
|
-
'Image',
|
|
7
|
-
'Text',
|
|
8
|
-
'Button',
|
|
9
|
-
'ProductButton',
|
|
10
|
-
'Cart',
|
|
11
|
-
'Tabs',
|
|
12
|
-
'TabItem',
|
|
13
|
-
'Carousel',
|
|
14
|
-
'CarouselItem',
|
|
15
|
-
'ShopPayButton',
|
|
16
|
-
'AccordionItem',
|
|
17
|
-
'Video',
|
|
18
|
-
'Header',
|
|
19
|
-
'HeroBanner',
|
|
20
|
-
'Icon',
|
|
21
|
-
'HTMLCode',
|
|
22
|
-
'IconListHoz',
|
|
23
|
-
'IconListItem',
|
|
24
|
-
'CSSCode',
|
|
25
|
-
'FormEmail',
|
|
26
|
-
'FormDropdown',
|
|
27
|
-
'SubmitButton',
|
|
28
|
-
'Dialog',
|
|
29
|
-
'TextField',
|
|
30
|
-
'FormTextarea',
|
|
31
|
-
'ProductPrice',
|
|
32
|
-
'Product',
|
|
33
|
-
'ProductImages',
|
|
34
|
-
'ProductImagesV2',
|
|
35
|
-
'Sticky',
|
|
36
|
-
'Heading'
|
|
37
|
-
];
|
|
38
|
-
const customRenderChildren = [
|
|
39
|
-
'Accordion',
|
|
40
|
-
'AccordionItem',
|
|
41
|
-
'Row',
|
|
42
|
-
'IconList',
|
|
43
|
-
'Tabs'
|
|
44
|
-
];
|
|
45
|
-
const excludeApplyStyle = [
|
|
46
|
-
'IconListV2',
|
|
47
|
-
'IconList'
|
|
48
|
-
];
|
|
49
|
-
|
|
50
|
-
export { customRenderChildren, disableWrap, excludeApplyStyle };
|
|
1
|
+
let disableWrap=["Col","CollectionBanner","Row","Section","Image","Text","Button","ProductButton","Cart","Tabs","TabItem","Carousel","CarouselItem","ShopPayButton","AccordionItem","Video","Header","HeroBanner","Icon","HTMLCode","IconListHoz","IconListItem","CSSCode","FormEmail","FormDropdown","SubmitButton","Dialog","TextField","FormTextarea","ProductPrice","Product","ProductImages","ProductImagesV2","PostPurchaseProductImages","Sticky","Heading"],customRenderChildren=["Accordion","AccordionItem","Row","IconList","Tabs"],excludeApplyStyle=["IconListV2","IconList"],postPurchaseRequiredElements=["PostPurchaseProductOffer","PostPurchaseProductTitle","PostPurchaseProductPrice","PostPurchaseAcceptButton","PostPurchaseButton","PostPurchaseCalloutBox","PostPurchaseProductPriceBreakdown","PostPurchaseProductImages","PostPurchaseCalloutText"],postPurchaseWrapElements=["Row","Section","PostPurchaseCalloutBox","PostPurchaseProductOffer"];export{customRenderChildren,disableWrap,excludeApplyStyle,postPurchaseRequiredElements,postPurchaseWrapElements};
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import Spacing from './Spacing.js';
|
|
3
|
-
|
|
4
|
-
function Resize(props) {
|
|
5
|
-
return /*#__PURE__*/ jsx(Fragment, {
|
|
6
|
-
children: /*#__PURE__*/ jsx(Spacing, {
|
|
7
|
-
...props
|
|
8
|
-
})
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export { Resize as default };
|
|
1
|
+
import{jsx as e,Fragment as r}from"react/jsx-runtime";import i from"./Spacing.js";function Resize(t){return e(r,{children:e(i,{...t})})}export{Resize as default};
|
|
@@ -1,244 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useRef, useState, useCallback, useEffect } from 'react';
|
|
3
|
-
import 'zustand';
|
|
4
|
-
import { useBuilderPreviewStore } from '../../contexts/BuilderPreviewContext.js';
|
|
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 '../../helpers/convert.js';
|
|
13
|
-
|
|
14
|
-
function Spacing(props) {
|
|
15
|
-
const isThemeSectionEditor = useBuilderPreviewStore((s)=>s.isThemeSectionEditor);
|
|
16
|
-
const $bottomDrag = useRef(null);
|
|
17
|
-
const $bottomBg = useRef(null);
|
|
18
|
-
const delayMouseMove = useRef(null);
|
|
19
|
-
const isDragging = useRef(false);
|
|
20
|
-
const startY = useRef(0);
|
|
21
|
-
const marginBottom = useRef(0);
|
|
22
|
-
const $visualNumberValue = useRef(null);
|
|
23
|
-
const [marginBottomValue, setMarginBottomValue] = useState(0);
|
|
24
|
-
const [isShowVisual, setIsShowVisual] = useState(false);
|
|
25
|
-
const hideVisualNumberValue = useRef(null);
|
|
26
|
-
const getNewValueMargin = (event)=>{
|
|
27
|
-
const top = event.clientY;
|
|
28
|
-
const diffY = Math.ceil(top - startY.current);
|
|
29
|
-
const currentValue = marginBottom.current || 0;
|
|
30
|
-
const newValue = currentValue + diffY >= 0 ? `${currentValue + diffY}px` : `0px`;
|
|
31
|
-
return {
|
|
32
|
-
newValue
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
const onMouseMoveDocument = (event)=>{
|
|
36
|
-
if ($bottomDrag.current && $bottomBg.current) {
|
|
37
|
-
// $bottomDrag.current.
|
|
38
|
-
const { newValue } = getNewValueMargin(event);
|
|
39
|
-
$bottomBg.current.style.height = newValue;
|
|
40
|
-
$bottomDrag.current.style.top = newValue;
|
|
41
|
-
const $component = $bottomDrag.current.closest('[data-toolbar-wrap]');
|
|
42
|
-
if ($component) {
|
|
43
|
-
$component.style.marginBottom = newValue;
|
|
44
|
-
onShowMarginBottomNumber(newValue);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
const onMouseUpDocument = ()=>{
|
|
49
|
-
endDrag();
|
|
50
|
-
};
|
|
51
|
-
const startDrag = ()=>{
|
|
52
|
-
if (delayMouseMove.current) clearTimeout(delayMouseMove.current);
|
|
53
|
-
delayMouseMove.current = setTimeout(()=>{
|
|
54
|
-
isDragging.current = true;
|
|
55
|
-
const event = new CustomEvent('editor:toolbar:resize-spacing', {
|
|
56
|
-
bubbles: true,
|
|
57
|
-
detail: {
|
|
58
|
-
value: true
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
window.dispatchEvent(event);
|
|
62
|
-
document.addEventListener('mousemove', onMouseMoveDocument);
|
|
63
|
-
document.addEventListener('mouseup', onMouseUpDocument);
|
|
64
|
-
}, 100);
|
|
65
|
-
};
|
|
66
|
-
const endDrag = ()=>{
|
|
67
|
-
if (delayMouseMove.current) clearTimeout(delayMouseMove.current);
|
|
68
|
-
isDragging.current = false;
|
|
69
|
-
const event = new CustomEvent('editor:toolbar:resize-spacing', {
|
|
70
|
-
bubbles: true,
|
|
71
|
-
detail: {
|
|
72
|
-
value: false
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
window.dispatchEvent(event);
|
|
76
|
-
if ($bottomDrag.current) {
|
|
77
|
-
const style = getComputedStyle($bottomDrag.current);
|
|
78
|
-
const marginBottom = style.top;
|
|
79
|
-
const event = new CustomEvent('editor:toolbar:change-margin-bottom', {
|
|
80
|
-
bubbles: true,
|
|
81
|
-
detail: {
|
|
82
|
-
componentUid: props.uid,
|
|
83
|
-
marginBottom
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
window.dispatchEvent(event);
|
|
87
|
-
}
|
|
88
|
-
const $component = $bottomDrag.current?.closest('[data-toolbar-wrap]');
|
|
89
|
-
if ($component) {
|
|
90
|
-
$component.style.marginBottom = '';
|
|
91
|
-
}
|
|
92
|
-
document.removeEventListener('mousemove', onMouseMoveDocument);
|
|
93
|
-
document.removeEventListener('mouseup', onMouseUpDocument);
|
|
94
|
-
};
|
|
95
|
-
const onMouseDown = (event)=>{
|
|
96
|
-
if ($bottomDrag.current) {
|
|
97
|
-
const style = getComputedStyle($bottomDrag.current);
|
|
98
|
-
startY.current = event.clientY;
|
|
99
|
-
marginBottom.current = parseFloat(style.top);
|
|
100
|
-
startDrag();
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
const onMouseUp = ()=>{
|
|
104
|
-
endDrag();
|
|
105
|
-
};
|
|
106
|
-
const getChildrenByAttrSelector = ($el, attrSelector)=>{
|
|
107
|
-
const childLen = $el.children.length;
|
|
108
|
-
if (childLen) {
|
|
109
|
-
for(let i = 0; i < childLen; i++){
|
|
110
|
-
const children = $el.children[i];
|
|
111
|
-
if (children) {
|
|
112
|
-
const is = children.getAttribute(attrSelector);
|
|
113
|
-
if (is) {
|
|
114
|
-
return children;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
const isLayoutElement = (el)=>{
|
|
121
|
-
const tag = el.getAttribute('data-component-tag');
|
|
122
|
-
return tag === 'Row' || tag === 'Product';
|
|
123
|
-
};
|
|
124
|
-
const updateSpacing = useCallback(()=>{
|
|
125
|
-
const $component = $bottomDrag.current?.closest('[data-toolbar-wrap]');
|
|
126
|
-
if (!$component) return;
|
|
127
|
-
const toolbar = getChildrenByAttrSelector($component, 'data-toolbar');
|
|
128
|
-
if (!toolbar) return;
|
|
129
|
-
const isActive = toolbar.getAttribute('data-toolbar-active');
|
|
130
|
-
if (!isActive) return;
|
|
131
|
-
const style = getComputedStyle($component);
|
|
132
|
-
const $spacing = getChildrenByAttrSelector($component, 'data-spacing');
|
|
133
|
-
const $marginBottom = ($spacing?.querySelector('[data-spacing-margin-bottom]')) || null;
|
|
134
|
-
if ($marginBottom) {
|
|
135
|
-
if ($bottomBg.current && $bottomDrag.current) {
|
|
136
|
-
let value = style.marginBottom;
|
|
137
|
-
onShowMarginBottomNumber(value);
|
|
138
|
-
if (parseFloat(value) < 0) {
|
|
139
|
-
value = '0';
|
|
140
|
-
}
|
|
141
|
-
$bottomBg.current.style.height = value;
|
|
142
|
-
$bottomDrag.current.style.top = value;
|
|
143
|
-
$marginBottom.setAttribute('data-spacing-margin-bottom-active', 'true');
|
|
144
|
-
if (isLayoutElement($component)) {
|
|
145
|
-
$bottomBg.current.style.left = '0';
|
|
146
|
-
} else {
|
|
147
|
-
const paddingLeft = style.paddingLeft;
|
|
148
|
-
const leftValue = `-${paddingLeft}`;
|
|
149
|
-
const translateCss = `translate(${leftValue}, -100%)`;
|
|
150
|
-
$bottomBg.current.style.left = leftValue;
|
|
151
|
-
$bottomDrag.current.style.transform = translateCss;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}, []);
|
|
156
|
-
const onShowMarginBottomNumber = (value)=>{
|
|
157
|
-
const parsedValue = parseFloat(value);
|
|
158
|
-
setMarginBottomValue(parsedValue);
|
|
159
|
-
setIsShowVisual(true);
|
|
160
|
-
if (hideVisualNumberValue.current) clearTimeout(hideVisualNumberValue.current);
|
|
161
|
-
hideVisualNumberValue.current = setTimeout(()=>{
|
|
162
|
-
setIsShowVisual(false);
|
|
163
|
-
}, 2000);
|
|
164
|
-
// break point 28px
|
|
165
|
-
const topPosition = parsedValue < 28 && parsedValue >= 0 ? parsedValue / 2 + 16 : parsedValue > 28 ? 0 : 16;
|
|
166
|
-
if ($visualNumberValue.current) {
|
|
167
|
-
$visualNumberValue.current.style.transform = `translateY(${topPosition}px)`;
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
|
-
const previousAdvanced = usePrevious(props.advanced?.['spacing-setting']);
|
|
171
|
-
useEffect(()=>{
|
|
172
|
-
// validate spacing setting changed
|
|
173
|
-
if (JSON.stringify(previousAdvanced) !== JSON.stringify(props.advanced?.['spacing-setting'])) {
|
|
174
|
-
updateSpacing();
|
|
175
|
-
}
|
|
176
|
-
}, [
|
|
177
|
-
previousAdvanced,
|
|
178
|
-
props.advanced,
|
|
179
|
-
updateSpacing
|
|
180
|
-
]);
|
|
181
|
-
const onWindowResize = useCallback(()=>{
|
|
182
|
-
updateSpacing();
|
|
183
|
-
}, [
|
|
184
|
-
updateSpacing
|
|
185
|
-
]);
|
|
186
|
-
useEffect(()=>{
|
|
187
|
-
window.addEventListener('editor:toolbar:update-margin-bottom', updateSpacing);
|
|
188
|
-
window.addEventListener('editor:toolbar:update-padding-left', updateSpacing);
|
|
189
|
-
window.addEventListener('resize', onWindowResize);
|
|
190
|
-
return ()=>{
|
|
191
|
-
window.removeEventListener('editor:toolbar:update-margin-bottom', updateSpacing);
|
|
192
|
-
window.removeEventListener('editor:toolbar:update-padding-left', updateSpacing);
|
|
193
|
-
window.removeEventListener('resize', onWindowResize);
|
|
194
|
-
};
|
|
195
|
-
}, [
|
|
196
|
-
onWindowResize,
|
|
197
|
-
updateSpacing
|
|
198
|
-
]);
|
|
199
|
-
return /*#__PURE__*/ jsx(Fragment, {
|
|
200
|
-
children: props.tag !== 'Section' && /*#__PURE__*/ jsx("div", {
|
|
201
|
-
"data-spacing": true,
|
|
202
|
-
"data-spacing-theme-section": isThemeSectionEditor,
|
|
203
|
-
className: "gp-absolute gp-w-full gp-bottom-0",
|
|
204
|
-
children: /*#__PURE__*/ jsxs("div", {
|
|
205
|
-
"data-spacing-margin-bottom": true,
|
|
206
|
-
children: [
|
|
207
|
-
/*#__PURE__*/ jsxs("div", {
|
|
208
|
-
"data-spacing-margin-bottom-bg": true,
|
|
209
|
-
ref: $bottomBg,
|
|
210
|
-
children: [
|
|
211
|
-
/*#__PURE__*/ jsx("div", {
|
|
212
|
-
"data-spacing-margin-bottom-value": true
|
|
213
|
-
}),
|
|
214
|
-
/*#__PURE__*/ jsx("div", {
|
|
215
|
-
"data-active": isShowVisual,
|
|
216
|
-
"data-value-number": true,
|
|
217
|
-
ref: $visualNumberValue,
|
|
218
|
-
children: marginBottomValue
|
|
219
|
-
})
|
|
220
|
-
]
|
|
221
|
-
}),
|
|
222
|
-
/*#__PURE__*/ jsx("div", {
|
|
223
|
-
ref: $bottomDrag,
|
|
224
|
-
"data-spacing-margin-bottom-drag": true,
|
|
225
|
-
onMouseDown: onMouseDown,
|
|
226
|
-
onMouseUp: onMouseUp,
|
|
227
|
-
role: "presentation"
|
|
228
|
-
})
|
|
229
|
-
]
|
|
230
|
-
})
|
|
231
|
-
})
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
const usePrevious = (value)=>{
|
|
235
|
-
const ref = useRef();
|
|
236
|
-
useEffect(()=>{
|
|
237
|
-
ref.current = value;
|
|
238
|
-
}, [
|
|
239
|
-
value
|
|
240
|
-
]);
|
|
241
|
-
return ref.current;
|
|
242
|
-
};
|
|
243
|
-
|
|
244
|
-
export { Spacing as default };
|
|
1
|
+
import{jsx as t,Fragment as e,jsxs as r}from"react/jsx-runtime";import{useRef as n,useState as o,useCallback as a,useEffect as i}from"react";import"zustand";import{useBuilderPreviewStore as l}from"../../contexts/BuilderPreviewContext.js";import"swr";import"@gem-sdk/adapter-shopify";import"swr/mutation";import{usePageType as u}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";function Spacing(s){let c=l(t=>t.isThemeSectionEditor),d=u(),m=n(null),p=n(null),g=n(null),v=n(!1),b=n(0),f=n(0),w=n(null),[h,y]=o(0),[E,S]=o(!1),L=n(null),C=t=>{let e=t.clientY,r=Math.ceil(e-b.current),n=f.current||0,o=n+r>=0?`${n+r}px`:"0px";return{newValue:o}},x=t=>{if(m.current&&p.current){let{newValue:e}=C(t);p.current.style.height=e,m.current.style.top=e;let r=m.current.closest("[data-toolbar-wrap]");r&&(r.style.marginBottom=e,B(e))}},T=()=>{P()},z=()=>{g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{v.current=!0;let t=new CustomEvent("editor:toolbar:resize-spacing",{bubbles:!0,detail:{value:!0}});window.dispatchEvent(t),document.addEventListener("mousemove",x),document.addEventListener("mouseup",T)},100)},P=()=>{g.current&&clearTimeout(g.current),v.current=!1;let t=new CustomEvent("editor:toolbar:resize-spacing",{bubbles:!0,detail:{value:!1}});if(window.dispatchEvent(t),m.current){let t=getComputedStyle(m.current),e=t.top,r=new CustomEvent("editor:toolbar:change-margin-bottom",{bubbles:!0,detail:{componentUid:s.uid,marginBottom:e}});window.dispatchEvent(r)}let e=m.current?.closest("[data-toolbar-wrap]");e&&(e.style.marginBottom=""),document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",T)},j=(t,e)=>{let r=t.children.length;if(r)for(let n=0;n<r;n++){let r=t.children[n];if(r){let t=r.getAttribute(e);if(t)return r}}},A=t=>{let e=t.getAttribute("data-component-tag");return"Row"===e||"Product"===e},k=a(()=>{let t=m.current?.closest("[data-toolbar-wrap]");if(!t)return;let e=j(t,"data-toolbar");if(!e)return;let r=e.getAttribute("data-toolbar-active");if(!r)return;let n=getComputedStyle(t),o=j(t,"data-spacing"),a=o?.querySelector("[data-spacing-margin-bottom]")||null;if(a&&p.current&&m.current){let e=n.marginBottom;if(B(e),0>parseFloat(e)&&(e="0"),p.current.style.height=e,m.current.style.top=e,a.setAttribute("data-spacing-margin-bottom-active","true"),A(t))p.current.style.left="0";else{let t=n.paddingLeft,e=`-${t}`,r=`translate(${e}, -100%)`;p.current.style.left=e,m.current.style.transform=r}}},[]),B=t=>{let e=parseFloat(t);y(e),S(!0),L.current&&clearTimeout(L.current),L.current=setTimeout(()=>{S(!1)},2e3);let r=e<28&&e>=0?e/2+16:e>28?0:16;w.current&&(w.current.style.transform=`translateY(${r}px)`)},U=usePrevious(s.advanced?.["spacing-setting"]);i(()=>{JSON.stringify(U)!==JSON.stringify(s.advanced?.["spacing-setting"])&&k()},[U,s.advanced,k]);let $=a(()=>{k()},[k]);return i(()=>(window.addEventListener("editor:toolbar:update-margin-bottom",k),window.addEventListener("editor:toolbar:update-padding-left",k),window.addEventListener("resize",$),()=>{window.removeEventListener("editor:toolbar:update-margin-bottom",k),window.removeEventListener("editor:toolbar:update-padding-left",k),window.removeEventListener("resize",$)}),[$,k]),t(e,{children:"Section"!==s.tag&&"POST_PURCHASE"!==d&&t("div",{"data-spacing":!0,"data-spacing-theme-section":c,className:"gp-absolute gp-w-full gp-bottom-0",children:r("div",{"data-spacing-margin-bottom":!0,children:[r("div",{"data-spacing-margin-bottom-bg":!0,ref:p,children:[t("div",{"data-spacing-margin-bottom-value":!0}),t("div",{"data-active":E,"data-value-number":!0,ref:w,children:h})]}),t("div",{ref:m,"data-spacing-margin-bottom-drag":!0,onMouseDown:t=>{if(m.current){let e=getComputedStyle(m.current);b.current=t.clientY,f.current=parseFloat(e.top),z()}},onMouseUp:()=>{P()},role:"presentation"})]})})})}let usePrevious=t=>{let e=n();return i(()=>{e.current=t},[t]),e.current};export{Spacing as default};
|
|
@@ -1,54 +1 @@
|
|
|
1
|
-
|
|
2
|
-
black: '#000000',
|
|
3
|
-
white: '#FFFFFF',
|
|
4
|
-
gray: '#808080',
|
|
5
|
-
red: '#FF0000',
|
|
6
|
-
blue: '#0000FF',
|
|
7
|
-
green: '#008000',
|
|
8
|
-
yellow: '#FFFF00',
|
|
9
|
-
orange: '#FFA500',
|
|
10
|
-
pink: '#FFC0CB',
|
|
11
|
-
purple: '#800080',
|
|
12
|
-
brown: '#A52A2A',
|
|
13
|
-
cyan: '#00FFFF',
|
|
14
|
-
magenta: '#FF00FF',
|
|
15
|
-
teal: '#008080',
|
|
16
|
-
navy: '#000080',
|
|
17
|
-
maroon: '#800000',
|
|
18
|
-
gold: '#FFD700',
|
|
19
|
-
silver: '#C0C0C0',
|
|
20
|
-
beige: '#F5F5DC',
|
|
21
|
-
ivory: '#FFFFF0',
|
|
22
|
-
lavender: '#E6E6FA',
|
|
23
|
-
indigo: '#4B0082',
|
|
24
|
-
coral: '#FF7F50',
|
|
25
|
-
mint: '#98FF98',
|
|
26
|
-
'sky blue': '#87CEEB',
|
|
27
|
-
salmon: '#FA8072',
|
|
28
|
-
olive: '#808000',
|
|
29
|
-
lilac: '#C8A2C8',
|
|
30
|
-
peach: '#FFDAB9',
|
|
31
|
-
turquoise: '#40E0D0',
|
|
32
|
-
ruby: '#E0115F',
|
|
33
|
-
bronze: '#CD7F32',
|
|
34
|
-
slate: '#708090',
|
|
35
|
-
charcoal: '#36454F',
|
|
36
|
-
sand: '#C2B280',
|
|
37
|
-
mauve: '#E0B0FF',
|
|
38
|
-
tangerine: '#FF4500',
|
|
39
|
-
'mint green': '#00FF99',
|
|
40
|
-
'forest green': '#228B22',
|
|
41
|
-
'ruby red': '#9B111E',
|
|
42
|
-
marigold: '#FFB928',
|
|
43
|
-
eggplant: '#990066',
|
|
44
|
-
'coral pink': '#F88379',
|
|
45
|
-
mustard: '#FFDB58',
|
|
46
|
-
'sky gray': '#B0C4DE',
|
|
47
|
-
'dusty rose': '#FF9BAE',
|
|
48
|
-
'olive green': '#556B2F',
|
|
49
|
-
coffee: '#6F4E37',
|
|
50
|
-
'lilac gray': '#C8A2C8',
|
|
51
|
-
'steel blue': '#4682B4'
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export { colorPreset };
|
|
1
|
+
let colorPreset={black:"#000000",white:"#FFFFFF",gray:"#808080",red:"#FF0000",blue:"#0000FF",green:"#008000",yellow:"#FFFF00",orange:"#FFA500",pink:"#FFC0CB",purple:"#800080",brown:"#A52A2A",cyan:"#00FFFF",magenta:"#FF00FF",teal:"#008080",navy:"#000080",maroon:"#800000",gold:"#FFD700",silver:"#C0C0C0",beige:"#F5F5DC",ivory:"#FFFFF0",lavender:"#E6E6FA",indigo:"#4B0082",coral:"#FF7F50",mint:"#98FF98","sky blue":"#87CEEB",salmon:"#FA8072",olive:"#808000",lilac:"#C8A2C8",peach:"#FFDAB9",turquoise:"#40E0D0",ruby:"#E0115F",bronze:"#CD7F32",slate:"#708090",charcoal:"#36454F",sand:"#C2B280",mauve:"#E0B0FF",tangerine:"#FF4500","mint green":"#00FF99","forest green":"#228B22","ruby red":"#9B111E",marigold:"#FFB928",eggplant:"#990066","coral pink":"#F88379",mustard:"#FFDB58","sky gray":"#B0C4DE","dusty rose":"#FF9BAE","olive green":"#556B2F",coffee:"#6F4E37","lilac gray":"#C8A2C8","steel blue":"#4682B4"};export{colorPreset};
|
|
@@ -1,115 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useRef, useState } from 'react';
|
|
3
|
-
import { ThemeSectionTooltip } from './ThemeSectionTooltip.js';
|
|
4
|
-
import 'zustand';
|
|
5
|
-
import { useShopStore } from '../../contexts/ShopContext.js';
|
|
6
|
-
import '@gem-sdk/adapter-shopify';
|
|
7
|
-
import 'swr';
|
|
8
|
-
import 'swr/mutation';
|
|
9
|
-
import 'vanilla-lazyload';
|
|
10
|
-
import '../../hooks/useCartUI.js';
|
|
11
|
-
import '../../helpers/convert.js';
|
|
12
|
-
|
|
13
|
-
const SHOW_TOOLTIP_TIMEOUT = 600;
|
|
14
|
-
const NUMBER_OF_THEME_SECTION_CREATED_TO_SHOW_TOOLTIP = 1;
|
|
15
|
-
const LIMIT_PLANS = [
|
|
16
|
-
'starter',
|
|
17
|
-
'trial',
|
|
18
|
-
'trial2022'
|
|
19
|
-
];
|
|
20
|
-
const CreateThemeSection = ({ ...props })=>{
|
|
21
|
-
const shopPlan = useShopStore((s)=>s.plan);
|
|
22
|
-
const createThemeSectionCount = useShopStore((s)=>s.createThemeSectionCount);
|
|
23
|
-
const isLimit = LIMIT_PLANS.includes(shopPlan ?? '');
|
|
24
|
-
const isRenderTooltip = isLimit || createThemeSectionCount === undefined || createThemeSectionCount < NUMBER_OF_THEME_SECTION_CREATED_TO_SHOW_TOOLTIP;
|
|
25
|
-
const timeoutRef = useRef();
|
|
26
|
-
const [isShowTooltip, setIsShowTooltip] = useState(false);
|
|
27
|
-
const showTooltip = ()=>{
|
|
28
|
-
if (!isRenderTooltip) return;
|
|
29
|
-
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
30
|
-
timeoutRef.current = setTimeout(()=>{
|
|
31
|
-
setIsShowTooltip(true);
|
|
32
|
-
}, SHOW_TOOLTIP_TIMEOUT);
|
|
33
|
-
};
|
|
34
|
-
const hideTooltip = ()=>{
|
|
35
|
-
if (!isRenderTooltip) return;
|
|
36
|
-
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
37
|
-
setIsShowTooltip(false);
|
|
38
|
-
};
|
|
39
|
-
const onActions = (e, options)=>{
|
|
40
|
-
e.preventDefault();
|
|
41
|
-
e.stopPropagation();
|
|
42
|
-
if (options?.disabled) return;
|
|
43
|
-
isLimit ? onUpgrade() : onCreate();
|
|
44
|
-
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
45
|
-
setIsShowTooltip(false);
|
|
46
|
-
};
|
|
47
|
-
const onUpgrade = ()=>{
|
|
48
|
-
const eventUpgrade = new CustomEvent('editor:toolbar:upgrade', {
|
|
49
|
-
bubbles: true
|
|
50
|
-
});
|
|
51
|
-
window.dispatchEvent(eventUpgrade);
|
|
52
|
-
};
|
|
53
|
-
const onCreate = ()=>{
|
|
54
|
-
const eventCreate = new CustomEvent('editor:toolbar:create-theme-section', {
|
|
55
|
-
bubbles: true,
|
|
56
|
-
detail: {
|
|
57
|
-
componentUid: props.uid
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
window.dispatchEvent(eventCreate);
|
|
61
|
-
};
|
|
62
|
-
return /*#__PURE__*/ jsx(Fragment, {
|
|
63
|
-
children: /*#__PURE__*/ jsxs(ThemeSectionTooltip, {
|
|
64
|
-
isLimit: isLimit,
|
|
65
|
-
isShow: isShowTooltip,
|
|
66
|
-
isRender: isRenderTooltip,
|
|
67
|
-
onActions: onActions,
|
|
68
|
-
onMouseEnter: showTooltip,
|
|
69
|
-
onMouseLeave: hideTooltip,
|
|
70
|
-
children: [
|
|
71
|
-
isRenderTooltip && /*#__PURE__*/ jsx("div", {
|
|
72
|
-
"data-toolbar-create-theme-section": true,
|
|
73
|
-
children: "You can create reusable sections"
|
|
74
|
-
}),
|
|
75
|
-
/*#__PURE__*/ jsx("div", {
|
|
76
|
-
"data-toolbar-active-create-theme-section-wrapper": true,
|
|
77
|
-
children: /*#__PURE__*/ jsxs("div", {
|
|
78
|
-
"data-toolbar-active-create-theme-section": true,
|
|
79
|
-
onClick: (e)=>onActions(e, {
|
|
80
|
-
disabled: isLimit
|
|
81
|
-
}),
|
|
82
|
-
"aria-hidden": "true",
|
|
83
|
-
children: [
|
|
84
|
-
/*#__PURE__*/ jsxs("svg", {
|
|
85
|
-
width: "16",
|
|
86
|
-
height: "16",
|
|
87
|
-
viewBox: "0 0 16 16",
|
|
88
|
-
fill: "none",
|
|
89
|
-
children: [
|
|
90
|
-
/*#__PURE__*/ jsx("path", {
|
|
91
|
-
d: "M1 2C1 1.44772 1.44772 1 2 1H6C6.55228 1 7 1.44772 7 2V6C7 6.55228 6.55228 7 6 7H2C1.44772 7 1 6.55228 1 6V2Z",
|
|
92
|
-
fill: "#F9F9F9"
|
|
93
|
-
}),
|
|
94
|
-
/*#__PURE__*/ jsx("path", {
|
|
95
|
-
d: "M9 10C9 9.44772 9.44772 9 10 9H14C14.5523 9 15 9.44772 15 10V14C15 14.5523 14.5523 15 14 15H10C9.44772 15 9 14.5523 9 14V10Z",
|
|
96
|
-
fill: "#F9F9F9"
|
|
97
|
-
}),
|
|
98
|
-
/*#__PURE__*/ jsx("path", {
|
|
99
|
-
d: "M2 9C1.44772 9 1 9.44772 1 10V14C1 14.5523 1.44772 15 2 15H6C6.55228 15 7 14.5523 7 14V10C7 9.44772 6.55228 9 6 9H2Z",
|
|
100
|
-
fill: "#F9F9F9"
|
|
101
|
-
})
|
|
102
|
-
]
|
|
103
|
-
}),
|
|
104
|
-
/*#__PURE__*/ jsx("p", {
|
|
105
|
-
children: "Create Theme Section"
|
|
106
|
-
})
|
|
107
|
-
]
|
|
108
|
-
})
|
|
109
|
-
})
|
|
110
|
-
]
|
|
111
|
-
})
|
|
112
|
-
});
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
export { CreateThemeSection };
|
|
1
|
+
import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import{useRef as o,useState as i}from"react";import{ThemeSectionTooltip as a}from"./ThemeSectionTooltip.js";import"zustand";import{useShopStore as n}from"../../contexts/ShopContext.js";import"@gem-sdk/adapter-shopify";import"swr";import"swr/mutation";import"vanilla-lazyload";import"../../hooks/useCartUI.js";import"classnames";import"../../helpers/convert.js";let SHOW_TOOLTIP_TIMEOUT=600,NUMBER_OF_THEME_SECTION_CREATED_TO_SHOW_TOOLTIP=1,LIMIT_PLANS=["starter","trial","trial2022"],CreateThemeSection=({...c})=>{let l=n(e=>e.plan),s=n(e=>e.createThemeSectionCount),d=LIMIT_PLANS.includes(l??""),m=d||void 0===s||s<1,p=o(),[h,u]=i(!1),C=()=>{m&&(p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{u(!0)},600))},T=()=>{m&&(p.current&&clearTimeout(p.current),u(!1))},v=(e,t)=>{e.preventDefault(),e.stopPropagation(),t?.disabled||(d?b():w(),p.current&&clearTimeout(p.current),u(!1))},b=()=>{let e=new CustomEvent("editor:toolbar:upgrade",{bubbles:!0});window.dispatchEvent(e)},w=()=>{let e=new CustomEvent("editor:toolbar:create-theme-section",{bubbles:!0,detail:{componentUid:c.uid}});window.dispatchEvent(e)};return e(t,{children:r(a,{isLimit:d,isShow:h,isRender:m,onActions:v,onMouseEnter:C,onMouseLeave:T,children:[m&&e("div",{"data-toolbar-create-theme-section":!0,children:"You can create reusable sections"}),e("div",{"data-toolbar-active-create-theme-section-wrapper":!0,children:r("div",{"data-toolbar-active-create-theme-section":!0,onClick:e=>v(e,{disabled:d}),"aria-hidden":"true",children:[r("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[e("path",{d:"M1 2C1 1.44772 1.44772 1 2 1H6C6.55228 1 7 1.44772 7 2V6C7 6.55228 6.55228 7 6 7H2C1.44772 7 1 6.55228 1 6V2Z",fill:"#F9F9F9"}),e("path",{d:"M9 10C9 9.44772 9.44772 9 10 9H14C14.5523 9 15 9.44772 15 10V14C15 14.5523 14.5523 15 14 15H10C9.44772 15 9 14.5523 9 14V10Z",fill:"#F9F9F9"}),e("path",{d:"M2 9C1.44772 9 1 9.44772 1 10V14C1 14.5523 1.44772 15 2 15H6C6.55228 15 7 14.5523 7 14V10C7 9.44772 6.55228 9 6 9H2Z",fill:"#F9F9F9"})]}),e("p",{children:"Create Theme Section"})]})})]})})};export{CreateThemeSection};
|