@gem-sdk/core 1.15.3 → 1.15.5
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.
|
@@ -65,13 +65,16 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, ...passPr
|
|
|
65
65
|
customProps
|
|
66
66
|
};
|
|
67
67
|
}),
|
|
68
|
-
children:
|
|
68
|
+
children: WrapRenderChildren({
|
|
69
|
+
uid,
|
|
70
|
+
customProps
|
|
71
|
+
}, item.childrens.map((id)=>RenderChildren({
|
|
69
72
|
uid: id,
|
|
70
73
|
builder,
|
|
71
74
|
components,
|
|
72
75
|
customProps,
|
|
73
76
|
parentTag: item.tag
|
|
74
|
-
}))
|
|
77
|
+
})))
|
|
75
78
|
});
|
|
76
79
|
}, ()=>{
|
|
77
80
|
return Component({
|
|
@@ -108,12 +111,16 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, ...passPr
|
|
|
108
111
|
customProps
|
|
109
112
|
};
|
|
110
113
|
}),
|
|
111
|
-
children:
|
|
114
|
+
children: WrapRenderChildren({
|
|
115
|
+
uid,
|
|
116
|
+
customProps
|
|
117
|
+
}, item.childrens.map((id)=>RenderChildren({
|
|
112
118
|
uid: id,
|
|
113
119
|
builder,
|
|
114
120
|
components,
|
|
115
|
-
customProps
|
|
116
|
-
|
|
121
|
+
customProps,
|
|
122
|
+
parentTag: item.tag
|
|
123
|
+
})))
|
|
117
124
|
});
|
|
118
125
|
}, ()=>{
|
|
119
126
|
return Component({
|
|
@@ -154,6 +161,29 @@ const RenderChildren = (props)=>{
|
|
|
154
161
|
}
|
|
155
162
|
return data.liquid;
|
|
156
163
|
};
|
|
164
|
+
const WrapRenderChildren = ({ uid, customProps }, codes)=>{
|
|
165
|
+
let liquid = '';
|
|
166
|
+
if (codes?.length) {
|
|
167
|
+
for(let i = 0; i < codes.length; i++){
|
|
168
|
+
const code = codes[i];
|
|
169
|
+
if (code) {
|
|
170
|
+
const newLiquid = liquid + code;
|
|
171
|
+
// Fix limit 256kb
|
|
172
|
+
const textEncoder = new TextEncoder();
|
|
173
|
+
const size = newLiquid ? textEncoder.encode(newLiquid).length : 0;
|
|
174
|
+
if (Math.ceil(size / 1024) >= 180) {
|
|
175
|
+
const fileName = `gp-section-snippet-${uid + i}`;
|
|
176
|
+
customProps.extraFiles[fileName] = code;
|
|
177
|
+
liquid += `{% render '${fileName}', product: product, variant: variant, product_form_id: product_form_id %}`;
|
|
178
|
+
} else {
|
|
179
|
+
liquid += code;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return liquid;
|
|
185
|
+
};
|
|
157
186
|
|
|
158
187
|
exports.RenderChildren = RenderChildren;
|
|
188
|
+
exports.WrapRenderChildren = WrapRenderChildren;
|
|
159
189
|
exports.default = Render;
|
package/dist/cjs/index.js
CHANGED
|
@@ -96,6 +96,7 @@ exports.Render = Render.default;
|
|
|
96
96
|
exports.RenderPreview = RenderPreview.default;
|
|
97
97
|
exports.RenderChildren = Render_liquid.RenderChildren;
|
|
98
98
|
exports.RenderLiquid = Render_liquid.default;
|
|
99
|
+
exports.WrapRenderChildren = Render_liquid.WrapRenderChildren;
|
|
99
100
|
exports.AddonProvider = AddonContext.AddonProvider;
|
|
100
101
|
exports.useAddon = AddonContext.useAddon;
|
|
101
102
|
exports.useAddons = AddonContext.useAddons;
|
|
@@ -61,13 +61,16 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, ...passPr
|
|
|
61
61
|
customProps
|
|
62
62
|
};
|
|
63
63
|
}),
|
|
64
|
-
children:
|
|
64
|
+
children: WrapRenderChildren({
|
|
65
|
+
uid,
|
|
66
|
+
customProps
|
|
67
|
+
}, item.childrens.map((id)=>RenderChildren({
|
|
65
68
|
uid: id,
|
|
66
69
|
builder,
|
|
67
70
|
components,
|
|
68
71
|
customProps,
|
|
69
72
|
parentTag: item.tag
|
|
70
|
-
}))
|
|
73
|
+
})))
|
|
71
74
|
});
|
|
72
75
|
}, ()=>{
|
|
73
76
|
return Component({
|
|
@@ -104,12 +107,16 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, ...passPr
|
|
|
104
107
|
customProps
|
|
105
108
|
};
|
|
106
109
|
}),
|
|
107
|
-
children:
|
|
110
|
+
children: WrapRenderChildren({
|
|
111
|
+
uid,
|
|
112
|
+
customProps
|
|
113
|
+
}, item.childrens.map((id)=>RenderChildren({
|
|
108
114
|
uid: id,
|
|
109
115
|
builder,
|
|
110
116
|
components,
|
|
111
|
-
customProps
|
|
112
|
-
|
|
117
|
+
customProps,
|
|
118
|
+
parentTag: item.tag
|
|
119
|
+
})))
|
|
113
120
|
});
|
|
114
121
|
}, ()=>{
|
|
115
122
|
return Component({
|
|
@@ -150,5 +157,27 @@ const RenderChildren = (props)=>{
|
|
|
150
157
|
}
|
|
151
158
|
return data.liquid;
|
|
152
159
|
};
|
|
160
|
+
const WrapRenderChildren = ({ uid, customProps }, codes)=>{
|
|
161
|
+
let liquid = '';
|
|
162
|
+
if (codes?.length) {
|
|
163
|
+
for(let i = 0; i < codes.length; i++){
|
|
164
|
+
const code = codes[i];
|
|
165
|
+
if (code) {
|
|
166
|
+
const newLiquid = liquid + code;
|
|
167
|
+
// Fix limit 256kb
|
|
168
|
+
const textEncoder = new TextEncoder();
|
|
169
|
+
const size = newLiquid ? textEncoder.encode(newLiquid).length : 0;
|
|
170
|
+
if (Math.ceil(size / 1024) >= 180) {
|
|
171
|
+
const fileName = `gp-section-snippet-${uid + i}`;
|
|
172
|
+
customProps.extraFiles[fileName] = code;
|
|
173
|
+
liquid += `{% render '${fileName}', product: product, variant: variant, product_form_id: product_form_id %}`;
|
|
174
|
+
} else {
|
|
175
|
+
liquid += code;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return liquid;
|
|
181
|
+
};
|
|
153
182
|
|
|
154
|
-
export { RenderChildren, Render as default };
|
|
183
|
+
export { RenderChildren, WrapRenderChildren, Render as default };
|
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { default as AddOn } from './components/AddOn.js';
|
|
2
2
|
export { default as Render } from './components/Render.js';
|
|
3
3
|
export { default as RenderPreview } from './components/RenderPreview.js';
|
|
4
|
-
export { RenderChildren, default as RenderLiquid } from './components/Render.liquid.js';
|
|
4
|
+
export { RenderChildren, default as RenderLiquid, WrapRenderChildren } from './components/Render.liquid.js';
|
|
5
5
|
export { AddonProvider, useAddon, useAddons } from './contexts/AddonContext.js';
|
|
6
6
|
export { BuilderComponentProvider, useBuilderComponent } from './contexts/BuilderComponent.js';
|
|
7
7
|
export { BuilderProvider, useBuilderStore } from './contexts/BuilderContext.js';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -39,6 +39,12 @@ declare const Render: ({ uid, builder, components, parentId, extraFiles, ...pass
|
|
|
39
39
|
extraFiles: ExtraFiles;
|
|
40
40
|
};
|
|
41
41
|
declare const RenderChildren: (props: Props) => string;
|
|
42
|
+
declare const WrapRenderChildren: ({ uid, customProps, }: {
|
|
43
|
+
uid: string;
|
|
44
|
+
customProps: {
|
|
45
|
+
extraFiles: ExtraFiles;
|
|
46
|
+
};
|
|
47
|
+
}, codes?: (string | undefined)[]) => string;
|
|
42
48
|
|
|
43
49
|
type AddonContextProps = {
|
|
44
50
|
components: Record<string, React.ComponentType<any>>;
|
|
@@ -9642,4 +9648,4 @@ type PublishedThemePageSelectFragment = Pick<PublishedThemePage, 'id' | 'name' |
|
|
|
9642
9648
|
|
|
9643
9649
|
declare const getProductBySlug: (fetcher: FetchFunc, slug?: string) => Promise<ProductSelectFragment>;
|
|
9644
9650
|
|
|
9645
|
-
export { AddOn, AddonProvider, AddonProviderProps, AlignItemProp, AlignProp, Background, BaseProps, BasePropsWrap, BlockEntity, BoldSubscriptionsWidgetType, Border, BorderStyle, BuilderComponentProvider, BuilderComponentProviderProps, BuilderEntity, BuilderEntityNested, BuilderPreviewProvider, BuilderPreviewProviderProps, BuilderProvider, BuilderProviderProps, BuilderState, Builtin, CartLineProvider, CartLineProviderProps, CollectionDetailFilterDocument, CollectionDetailFilterQueryResponse, CollectionDetailFilterQueryVariables, CollectionDocument, CollectionProvider, CollectionProviderProps, CollectionQueryResponse, CollectionQueryVariables, CollectionSelectFragment, CollectionsDocument, CollectionsQueryResponse, CollectionsQueryVariables, ColorKey, ColorType$1 as ColorType, ColorValueType, Component, ComponentPreset, ComponentSetting, ContainerProp, ControlProp, ControlUI, CornerRadius, CornerRadiusType, CustomComponentConfig, DeepPartial, ExtractState, FetchCollectionArgs, FetchFunc, FetchProductParams, FlexDirectionProp, FontName, GlobalStyleConfig, GlobalStyleResponsiveConfig, GlobalSwatchesData, GraphQLConnection, GroupPropType, HSLAColorType, HSLColorType, HexColorType, InitComponentType, InstantJudgeMeReviewsWidgetType, InstantKlaviyoWidgetType, InstantLooxReviewsWidgetType, JudgeMeReviewsWidgetType, KlaviyoWidgetType, LooxReviewsWidgetType, ModalProvider, ModalProviderProps, NameDevices, NestedKeys, ObjectDeviceGlobalType, ObjectDevices, ObjectLayoutValue, OptionNormalStyle, OptionSpecialStyle, PageType, PageViewUpDocument, PageViewUpMutationResponse, PageViewUpMutationVariables, PickyStoryWidgetType, PreviewPageDocument, PreviewPageQueryResponse, PreviewPageQueryVariables, Primitive, ProductInputAnalytic, ProductListProvider, ProductListProviderProps, ProductProvider, ProductProviderProps, ProductReviewsWidgetType, ProductSelectFragment, ProductsDocument, ProductsQueryResponse, ProductsQueryVariables, PublishedThemePageSelectFragment, PublishedThemePagesDocument, PublishedThemePagesQueryResponse, PublishedThemePagesQueryVariables, RGBAColorType, RGBColorType, Ratio$1 as Ratio, RenderMemo as Render, RenderChildren, RenderIf, Render as RenderLiquid, RenderMode, RenderPreviewMemo as RenderPreview, RequiredCursorEdge, ResponsiveStateProp, RivyoWidgetType, RoundedSize, RyviuWidgetType, SectionData, SectionEntity, SectionProvider, SectionProviderProps, ShadowProps, ShadowStyle, ShadowStyleApplied, ShadowType, ShopProvider, ShopProviderProps, shop as ShopType, SizeProps, SizeSetting, SizeType, SpacingType, StateProp, StateSelector, StateType, StoreConfig, StorePropertyDocument, StorePropertyQueryResponse, StorePropertyQueryVariables, SwatchesOptionType, SwatchesOptionValue, TransformProp, TypographyProps, TypographySetting, TypographySettingV2, TypographyType, TypographyV2Attrs, TypographyV2Props, VariantSelectFragment, WiserWidgetType, baseAssetURL, calculateFirstProduct, checkAvailableVariantInStock, cls, composeAdvanceStyle, composeBackgroundCss, composeBorderCss, composeCornerCss, composeGridLayout, composeMemo, composeRadius, composeShadowCss, composeSize, composeSizeCss, composeSpacing, composeTextColorCss, composeTypography, composeTypographyAttr, composeTypographyClassName, composeTypographyCss, composeTypographyStyle, composeTypographyV2, composeTypographyV2Css, convertOldLayout, dataStringify, fetchMedias, fetchVariants, flattenConnection, fpixel, genSizeClass, genTypoClass, genVariable, generateCollectionQueryKey, generateProductQueryKey, generateProductsQueryKey, getBorderStyle, getCollection, getCornerCSSFromGlobal, getCustomRadius, getGlobalColorCSSProp, getGlobalColorClass, getGlobalColorResponsiveClass, getGlobalColorResponsiveStyle, getGlobalColorStateClass, getGlobalColorStateClassDynamicBtn, getGlobalColorStateResponsiveClass, getGlobalColorStateResponsiveClassDynamicBtn, getGlobalColorStateResponsiveStyle, getGlobalColorStateStyle, getGlobalColorStyle, getProduct, getProductBySlug, getRadiusCSSFromGlobal, getRadiusStyleActiveState, getResponsiveStateValue, getResponsiveValue, getResponsiveValueByScreen, getSelectedVariant, getShortName, getSingleColorVariable, getSpacingVariable, getStyleBackgroundByDevice, getStyleShadow, getStyleShadowState, globalEvent, gridToArrayRegex, gtag, handleConvertBorderColor, handleConvertBorderStyle, handleConvertBorderWidth, handleConvertClassColor, handleConvertClassColorDynamicBtn, isBrowser, isColor, isColumnDirectionExist, isDefined, isEmptyChildren, isLocalEnv, isSafari, loadScript, makeAspectRatio, makeHeight, makeLineClamp, makeStyle, makeStyleResponsive, makeStyleResponsiveState, makeStyleState, makeWidth, normalizeBuilderData, optionLayoutStyle, parseSelectedOption, parseValueWithUnit, prefetchQueries, props, removeNullUndefined, splitStyle, styles, template, tiktokpixel, useAddToCart, useAddon, useAddons, useBuilderComponent, useBuilderPreviewStore, useBuilderStore, useCartData, useCartDiscountCodesUpdate, useCartId, useCartLine, useCartLineStore, useCartNoteUpdate, useCartUI, useCheckAvailableVariantInStock, useCheckoutUrl, useCollection, useCollectionQuery, useCollectionStore, useCollectionsQuery, useConnectedShopify, useCreateCart, useCurrency, useCurrentDevice, useCurrentVariant, useCurrentVariantInStock, useEditorMode, useFeaturedImageGlobal, useFormatMoney, useIsSampleProduct, useIsStorefrontProduct, useIsomorphicLayoutEffect, useLazyVideo, useLoadScript, useLocale, useMatchMutate, useMobileOnly, useModalStore, useMoney, useMoneyFormat, usePageType, usePluginEnable, usePrevious, useProduct, useProductList, useProductListProducts, useProductListSettings, useProductListStore, useProductListStyles, useProductProperties, useProductQuery, useProductStore, useProductsQuery, useQuantity, useRemoveCartItem, useSection, useSectionStore, useSelectedOption, useShopStore, useStoreFront, useSuspenseFetch, useSwatches, useSwatchesOptions, useUniqProductID, useUpdateCartItem, useVariant, useVariantOutStock, useVariants, validateEmail };
|
|
9651
|
+
export { AddOn, AddonProvider, AddonProviderProps, AlignItemProp, AlignProp, Background, BaseProps, BasePropsWrap, BlockEntity, BoldSubscriptionsWidgetType, Border, BorderStyle, BuilderComponentProvider, BuilderComponentProviderProps, BuilderEntity, BuilderEntityNested, BuilderPreviewProvider, BuilderPreviewProviderProps, BuilderProvider, BuilderProviderProps, BuilderState, Builtin, CartLineProvider, CartLineProviderProps, CollectionDetailFilterDocument, CollectionDetailFilterQueryResponse, CollectionDetailFilterQueryVariables, CollectionDocument, CollectionProvider, CollectionProviderProps, CollectionQueryResponse, CollectionQueryVariables, CollectionSelectFragment, CollectionsDocument, CollectionsQueryResponse, CollectionsQueryVariables, ColorKey, ColorType$1 as ColorType, ColorValueType, Component, ComponentPreset, ComponentSetting, ContainerProp, ControlProp, ControlUI, CornerRadius, CornerRadiusType, CustomComponentConfig, DeepPartial, ExtractState, FetchCollectionArgs, FetchFunc, FetchProductParams, FlexDirectionProp, FontName, GlobalStyleConfig, GlobalStyleResponsiveConfig, GlobalSwatchesData, GraphQLConnection, GroupPropType, HSLAColorType, HSLColorType, HexColorType, InitComponentType, InstantJudgeMeReviewsWidgetType, InstantKlaviyoWidgetType, InstantLooxReviewsWidgetType, JudgeMeReviewsWidgetType, KlaviyoWidgetType, LooxReviewsWidgetType, ModalProvider, ModalProviderProps, NameDevices, NestedKeys, ObjectDeviceGlobalType, ObjectDevices, ObjectLayoutValue, OptionNormalStyle, OptionSpecialStyle, PageType, PageViewUpDocument, PageViewUpMutationResponse, PageViewUpMutationVariables, PickyStoryWidgetType, PreviewPageDocument, PreviewPageQueryResponse, PreviewPageQueryVariables, Primitive, ProductInputAnalytic, ProductListProvider, ProductListProviderProps, ProductProvider, ProductProviderProps, ProductReviewsWidgetType, ProductSelectFragment, ProductsDocument, ProductsQueryResponse, ProductsQueryVariables, PublishedThemePageSelectFragment, PublishedThemePagesDocument, PublishedThemePagesQueryResponse, PublishedThemePagesQueryVariables, RGBAColorType, RGBColorType, Ratio$1 as Ratio, RenderMemo as Render, RenderChildren, RenderIf, Render as RenderLiquid, RenderMode, RenderPreviewMemo as RenderPreview, RequiredCursorEdge, ResponsiveStateProp, RivyoWidgetType, RoundedSize, RyviuWidgetType, SectionData, SectionEntity, SectionProvider, SectionProviderProps, ShadowProps, ShadowStyle, ShadowStyleApplied, ShadowType, ShopProvider, ShopProviderProps, shop as ShopType, SizeProps, SizeSetting, SizeType, SpacingType, StateProp, StateSelector, StateType, StoreConfig, StorePropertyDocument, StorePropertyQueryResponse, StorePropertyQueryVariables, SwatchesOptionType, SwatchesOptionValue, TransformProp, TypographyProps, TypographySetting, TypographySettingV2, TypographyType, TypographyV2Attrs, TypographyV2Props, VariantSelectFragment, WiserWidgetType, WrapRenderChildren, baseAssetURL, calculateFirstProduct, checkAvailableVariantInStock, cls, composeAdvanceStyle, composeBackgroundCss, composeBorderCss, composeCornerCss, composeGridLayout, composeMemo, composeRadius, composeShadowCss, composeSize, composeSizeCss, composeSpacing, composeTextColorCss, composeTypography, composeTypographyAttr, composeTypographyClassName, composeTypographyCss, composeTypographyStyle, composeTypographyV2, composeTypographyV2Css, convertOldLayout, dataStringify, fetchMedias, fetchVariants, flattenConnection, fpixel, genSizeClass, genTypoClass, genVariable, generateCollectionQueryKey, generateProductQueryKey, generateProductsQueryKey, getBorderStyle, getCollection, getCornerCSSFromGlobal, getCustomRadius, getGlobalColorCSSProp, getGlobalColorClass, getGlobalColorResponsiveClass, getGlobalColorResponsiveStyle, getGlobalColorStateClass, getGlobalColorStateClassDynamicBtn, getGlobalColorStateResponsiveClass, getGlobalColorStateResponsiveClassDynamicBtn, getGlobalColorStateResponsiveStyle, getGlobalColorStateStyle, getGlobalColorStyle, getProduct, getProductBySlug, getRadiusCSSFromGlobal, getRadiusStyleActiveState, getResponsiveStateValue, getResponsiveValue, getResponsiveValueByScreen, getSelectedVariant, getShortName, getSingleColorVariable, getSpacingVariable, getStyleBackgroundByDevice, getStyleShadow, getStyleShadowState, globalEvent, gridToArrayRegex, gtag, handleConvertBorderColor, handleConvertBorderStyle, handleConvertBorderWidth, handleConvertClassColor, handleConvertClassColorDynamicBtn, isBrowser, isColor, isColumnDirectionExist, isDefined, isEmptyChildren, isLocalEnv, isSafari, loadScript, makeAspectRatio, makeHeight, makeLineClamp, makeStyle, makeStyleResponsive, makeStyleResponsiveState, makeStyleState, makeWidth, normalizeBuilderData, optionLayoutStyle, parseSelectedOption, parseValueWithUnit, prefetchQueries, props, removeNullUndefined, splitStyle, styles, template, tiktokpixel, useAddToCart, useAddon, useAddons, useBuilderComponent, useBuilderPreviewStore, useBuilderStore, useCartData, useCartDiscountCodesUpdate, useCartId, useCartLine, useCartLineStore, useCartNoteUpdate, useCartUI, useCheckAvailableVariantInStock, useCheckoutUrl, useCollection, useCollectionQuery, useCollectionStore, useCollectionsQuery, useConnectedShopify, useCreateCart, useCurrency, useCurrentDevice, useCurrentVariant, useCurrentVariantInStock, useEditorMode, useFeaturedImageGlobal, useFormatMoney, useIsSampleProduct, useIsStorefrontProduct, useIsomorphicLayoutEffect, useLazyVideo, useLoadScript, useLocale, useMatchMutate, useMobileOnly, useModalStore, useMoney, useMoneyFormat, usePageType, usePluginEnable, usePrevious, useProduct, useProductList, useProductListProducts, useProductListSettings, useProductListStore, useProductListStyles, useProductProperties, useProductQuery, useProductStore, useProductsQuery, useQuantity, useRemoveCartItem, useSection, useSectionStore, useSelectedOption, useShopStore, useStoreFront, useSuspenseFetch, useSwatches, useSwatchesOptions, useUniqProductID, useUpdateCartItem, useVariant, useVariantOutStock, useVariants, validateEmail };
|