@gem-sdk/core 1.53.0-dev.14 → 1.53.0-dev.145
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/ComponentToolbarPreview.js +58 -3
- package/dist/cjs/components/ComponentWrapper.js +1 -1
- package/dist/cjs/components/InteractionSuffix.js +10 -91
- package/dist/cjs/components/Render.liquid.js +34 -7
- package/dist/cjs/contexts/PageContext.js +9 -1
- package/dist/cjs/graphql/queries/published-shop-metas.js +15 -0
- package/dist/cjs/helpers/animations.js +11 -2
- package/dist/cjs/helpers/background.js +6 -1
- package/dist/cjs/helpers/convert.js +1 -1
- package/dist/cjs/helpers/interaction/index.js +24 -5
- package/dist/cjs/helpers/radius.js +11 -1
- package/dist/cjs/helpers/third-party/appConfig.js +42 -0
- package/dist/cjs/helpers/third-party/appSetting.js +144 -1
- package/dist/cjs/helpers/third-party/constant.js +7 -1
- package/dist/cjs/helpers/typography.js +5 -2
- package/dist/cjs/hooks/animation/useAnimationConfig.js +2 -1
- package/dist/cjs/hooks/animation/useApplyAnimation.js +5 -5
- package/dist/cjs/index.js +4 -0
- package/dist/esm/components/ComponentToolbarPreview.js +58 -3
- package/dist/esm/components/ComponentWrapper.js +1 -1
- package/dist/esm/components/InteractionSuffix.js +11 -92
- package/dist/esm/components/Render.liquid.js +34 -7
- package/dist/esm/contexts/PageContext.js +9 -1
- package/dist/esm/graphql/queries/published-shop-metas.js +13 -0
- package/dist/esm/helpers/animations.js +11 -2
- package/dist/esm/helpers/background.js +6 -1
- package/dist/esm/helpers/convert.js +1 -1
- package/dist/esm/helpers/interaction/index.js +24 -5
- package/dist/esm/helpers/radius.js +11 -1
- package/dist/esm/helpers/third-party/appConfig.js +37 -1
- package/dist/esm/helpers/third-party/appSetting.js +144 -1
- package/dist/esm/helpers/third-party/constant.js +8 -2
- package/dist/esm/helpers/typography.js +5 -2
- package/dist/esm/hooks/animation/useAnimationConfig.js +2 -1
- package/dist/esm/hooks/animation/useApplyAnimation.js +5 -5
- package/dist/esm/index.js +2 -0
- package/dist/types/index.d.ts +179 -22
- package/package.json +3 -3
|
@@ -95,6 +95,13 @@ const overrideSettings = (tag, currentSetting, appSetting)=>{
|
|
|
95
95
|
selected_product: appSetting?.['productHandle'] || '{{ product }}'
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
|
+
case 'WhatmoreShoppableVideosreel':
|
|
99
|
+
{
|
|
100
|
+
return {
|
|
101
|
+
...currentSetting,
|
|
102
|
+
['show-views']: appSetting?.showViews
|
|
103
|
+
};
|
|
104
|
+
}
|
|
98
105
|
default:
|
|
99
106
|
return currentSetting;
|
|
100
107
|
}
|
|
@@ -214,7 +221,142 @@ const YotpoReviews = {
|
|
|
214
221
|
}
|
|
215
222
|
}
|
|
216
223
|
};
|
|
224
|
+
const WhatmoreShoppableVideosreel = {
|
|
225
|
+
WhatmoreShoppableVideosreel: {
|
|
226
|
+
'app-block': {
|
|
227
|
+
heading: 'Watch and Buy',
|
|
228
|
+
'template-type': 'template-f',
|
|
229
|
+
'show-views': 'show',
|
|
230
|
+
'ui-theme': 'round',
|
|
231
|
+
'color-primary': '#343434',
|
|
232
|
+
'color-secondary': '#343434',
|
|
233
|
+
'title-font': 'poppins_n4',
|
|
234
|
+
'primary-font': 'poppins_n4',
|
|
235
|
+
'title-font-size': 40,
|
|
236
|
+
'title-font-size-portrait': 24,
|
|
237
|
+
'landscape-padding': 40,
|
|
238
|
+
'top-bottom-padding': 20,
|
|
239
|
+
'scroll-video-tile-size': 80,
|
|
240
|
+
'scroll-video-tile-size-portrait': 80,
|
|
241
|
+
'min-height': 380
|
|
242
|
+
},
|
|
243
|
+
'app-block-banner': {
|
|
244
|
+
'template-type': 'template-banner-a',
|
|
245
|
+
'ui-theme': 'round',
|
|
246
|
+
'banner-video-tile-size': 80
|
|
247
|
+
},
|
|
248
|
+
'app-block-collections': {
|
|
249
|
+
collectionHeading: 'W',
|
|
250
|
+
'template-type': 'template-collections-b',
|
|
251
|
+
'ui-theme': 'round',
|
|
252
|
+
'color-secondary': '#343434',
|
|
253
|
+
'primary-font': 'poppins_n4',
|
|
254
|
+
'tile-size': 60,
|
|
255
|
+
'tile-size-portrait': 60,
|
|
256
|
+
'min-height': 250
|
|
257
|
+
},
|
|
258
|
+
'app-block-stories': {
|
|
259
|
+
'template-type': 'template-stories-a',
|
|
260
|
+
'ui-theme': 'round',
|
|
261
|
+
'color-primary': '#343434',
|
|
262
|
+
'color-secondary': '#343434',
|
|
263
|
+
'primary-font': 'poppins_n4',
|
|
264
|
+
'stories-top-bottom-padding': 0,
|
|
265
|
+
'story-tile-size': 40,
|
|
266
|
+
'story-tile-size-desktop': 40
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
const ProductOptionsCustomizer = {
|
|
271
|
+
ProductOptionsCustomizer: {
|
|
272
|
+
'product-page-customizer': {
|
|
273
|
+
pc_container_size: 100,
|
|
274
|
+
pc_show_options_total: 'initial',
|
|
275
|
+
pc_customizations_total_text: 'Customizations Total:',
|
|
276
|
+
pc_show_preloader: 'hide',
|
|
277
|
+
pc_preloader_color: '',
|
|
278
|
+
pc_ignore_redirect_command: true,
|
|
279
|
+
pc_basic_label_text_color: '#000000',
|
|
280
|
+
pc_basic_label_font_size: 14,
|
|
281
|
+
pc_basic_label_bolden: 'unset',
|
|
282
|
+
pc_basic_label_space_above: 0,
|
|
283
|
+
pc_basic_option_background_color: '#FFFFFF',
|
|
284
|
+
pc_basic_option_text_color: '#000000',
|
|
285
|
+
pc_basic_option_border_color: '#000000',
|
|
286
|
+
pc_basic_option_border_style: 'solid',
|
|
287
|
+
pc_basic_option_border_width: 1,
|
|
288
|
+
pc_basic_option_curve_the_corners: 'none',
|
|
289
|
+
pc_basic_option_font_size: 14,
|
|
290
|
+
pc_basic_option_bolden: 'none',
|
|
291
|
+
pc_basic_option_width: 100,
|
|
292
|
+
pc_basic_option_space_above: 0,
|
|
293
|
+
pc_basic_option_space_below: 0,
|
|
294
|
+
pc_basic_option_space_inside: 10,
|
|
295
|
+
pc_advanced_custom_css: '',
|
|
296
|
+
pc_advanced_custom_js: '',
|
|
297
|
+
pc_show_image_swatch_preview: false
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
const AppointmentBookingCowlendar = {
|
|
302
|
+
AppointmentBookingCowlendar: {
|
|
303
|
+
'app-section': {
|
|
304
|
+
section_title: 'Services list',
|
|
305
|
+
section_type: 'services-list'
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
const SproutPlantTreesGrowSales = {
|
|
310
|
+
SproutPlantTreesGrowSales: {
|
|
311
|
+
badge: null,
|
|
312
|
+
'impact-banner': null
|
|
313
|
+
}
|
|
314
|
+
};
|
|
315
|
+
const InstasellShoppableInstagram = {
|
|
316
|
+
InstasellShoppableInstagram: {
|
|
317
|
+
'app-block': {
|
|
318
|
+
heading: 'InstaSell: Instagram Gallery+',
|
|
319
|
+
description: 'Showcase your Instagram Feed on your Shopify Storefront'
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
const BoldSubscriptions = {
|
|
324
|
+
BoldSubscriptions: {
|
|
325
|
+
'bsub-widget-block': {
|
|
326
|
+
default_subscribe: true,
|
|
327
|
+
primary_color: '#3b63ff',
|
|
328
|
+
secondary_color: '#7dba63',
|
|
329
|
+
background_color: '#f8f9f9',
|
|
330
|
+
border_radius: 4,
|
|
331
|
+
header_text: 'Purchase Options',
|
|
332
|
+
one_time_text: 'One-time Purchase',
|
|
333
|
+
recurring_text: 'Subscribe and Save',
|
|
334
|
+
prepaid_recurring_text: 'Prepaid Subscribe and Save',
|
|
335
|
+
discount_summary_text: '(Save {discount})',
|
|
336
|
+
discount_summary_plural_text: '(Save up to {discount})',
|
|
337
|
+
frequency_header: 'Delivery Frequency',
|
|
338
|
+
frequency_text: 'delivery',
|
|
339
|
+
prepaid_checkbox_label_text: 'Prepay for subscription',
|
|
340
|
+
billing_frequency_header: 'Billing Frequency',
|
|
341
|
+
billing_frequency_text: '{count} Orders',
|
|
342
|
+
delivery_frequency_discount_text: '({discount} off)',
|
|
343
|
+
billing_frequency_discount_text: '({discount} off)',
|
|
344
|
+
prepaid_total_text: 'Billed {price} today',
|
|
345
|
+
prepaid_continue_as_prepaid_text: 'Prepaid order will auto-renew after {count} orders',
|
|
346
|
+
prepaid_continue_as_standard_text: 'Becomes a regular subscription after {count} orders',
|
|
347
|
+
convertible_header: 'Converts to',
|
|
348
|
+
eligible_for_subscription_header: 'Eligible for Subscription',
|
|
349
|
+
initial_dynamic_discount_text: 'Save {initial_percent_discount}% ({initial_fixed_discount})',
|
|
350
|
+
subsequent_dynamic_discounts_text: '{subsequent_percent_discount}% ({subsequent_fixed_discount}) after {order_count} order(s)'
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
};
|
|
217
354
|
const composeSettingsByWidgetType = {
|
|
355
|
+
...InstasellShoppableInstagram,
|
|
356
|
+
...SproutPlantTreesGrowSales,
|
|
357
|
+
...AppointmentBookingCowlendar,
|
|
358
|
+
...ProductOptionsCustomizer,
|
|
359
|
+
...WhatmoreShoppableVideosreel,
|
|
218
360
|
...JunipProductReviewsUgc,
|
|
219
361
|
...FlyBundlesUpsellsFbt,
|
|
220
362
|
...PreorderNowWodPresale,
|
|
@@ -233,7 +375,8 @@ const composeSettingsByWidgetType = {
|
|
|
233
375
|
...LoyaltyRewardsReferrals,
|
|
234
376
|
...SubifySubscriptions,
|
|
235
377
|
...SelleasyWidget,
|
|
236
|
-
...YotpoReviews
|
|
378
|
+
...YotpoReviews,
|
|
379
|
+
...BoldSubscriptions
|
|
237
380
|
};
|
|
238
381
|
|
|
239
382
|
exports.composeSettingsByWidgetType = composeSettingsByWidgetType;
|
|
@@ -21,7 +21,13 @@ const mapShopifyAppMeta = {
|
|
|
21
21
|
...appConfig.FlyBundlesUpsellsFbtConfig,
|
|
22
22
|
...appConfig.JunipProductReviewsUgcConfig,
|
|
23
23
|
...appConfig.PreorderNowWodPresaleConfig,
|
|
24
|
-
...appConfig.YotpoReviewsV3UgcConfig
|
|
24
|
+
...appConfig.YotpoReviewsV3UgcConfig,
|
|
25
|
+
...appConfig.WhatmoreShoppableVideosreelConfig,
|
|
26
|
+
...appConfig.ProductOptionsCustomizerConfig,
|
|
27
|
+
...appConfig.AppointmentBookingCowlendarConfig,
|
|
28
|
+
...appConfig.SproutPlantTreesGrowSalesConfig,
|
|
29
|
+
...appConfig.InstasellShoppableInstagramConfig,
|
|
30
|
+
...appConfig.BoldSubscriptionsConfig
|
|
25
31
|
};
|
|
26
32
|
const THIRD_PARTY_APP_BLOCK_ID_PREFIX = 'gp_app';
|
|
27
33
|
|
|
@@ -84,7 +84,7 @@ const composeFontFamilyTypographyV2 = (value)=>{
|
|
|
84
84
|
if (typeof fontFamily === 'string') {
|
|
85
85
|
return getFontUsedByTypographyV2({
|
|
86
86
|
fontFamily,
|
|
87
|
-
fallbackFontFamily: value?.fallbackFontFamily
|
|
87
|
+
fallbackFontFamily: getFallbackFontFamily(value?.fallbackFontFamily, type)
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
90
|
if (typeof fontFamily === 'object' && typeof fontFamily?.value === 'string') {
|
|
@@ -94,12 +94,15 @@ const composeFontFamilyTypographyV2 = (value)=>{
|
|
|
94
94
|
default:
|
|
95
95
|
return getFontUsedByTypographyV2({
|
|
96
96
|
fontFamily: fontFamily.value,
|
|
97
|
-
fallbackFontFamily:
|
|
97
|
+
fallbackFontFamily: getFallbackFontFamily(value?.fallbackFontFamily, type)
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
return;
|
|
102
102
|
};
|
|
103
|
+
const getFallbackFontFamily = (fallbackFontFamilyDefault, type)=>{
|
|
104
|
+
return fallbackFontFamilyDefault || composeFallbackTypographyStyle(type ?? 'heading');
|
|
105
|
+
};
|
|
103
106
|
const getFontUsedByTypographyV2 = ({ fontFamily, fallbackFontFamily })=>{
|
|
104
107
|
if (fontFamily) {
|
|
105
108
|
return `var(--g-font-${fontFamily?.replace(/ /g, '-')}, '${fontFamily}'), ${fallbackFontFamily}`;
|
|
@@ -25,13 +25,13 @@ const useApplyAnimation = ({ props })=>{
|
|
|
25
25
|
setAnimationOnFinish,
|
|
26
26
|
setToolbarActive
|
|
27
27
|
});
|
|
28
|
-
const generateAnimation = react.useCallback(({ target, setting, type })=>{
|
|
29
|
-
return animation[type](target, setting);
|
|
28
|
+
const generateAnimation = react.useCallback(({ target, setting, type, reverse })=>{
|
|
29
|
+
return animation[type](target, setting, reverse);
|
|
30
30
|
}, [
|
|
31
31
|
animation
|
|
32
32
|
]);
|
|
33
33
|
const initListAnimations = react.useCallback(()=>{
|
|
34
|
-
const { type, setting } = getAnimationConfig();
|
|
34
|
+
const { type, setting, reverse } = getAnimationConfig();
|
|
35
35
|
if (!type || type === animations.AnimationType.None || !targetObjects.current.length) {
|
|
36
36
|
cancelAnimation();
|
|
37
37
|
return;
|
|
@@ -39,9 +39,9 @@ const useApplyAnimation = ({ props })=>{
|
|
|
39
39
|
const listAnimations = targetObjects.current.map((item)=>generateAnimation({
|
|
40
40
|
type,
|
|
41
41
|
setting,
|
|
42
|
-
target: item.target
|
|
42
|
+
target: item.target,
|
|
43
|
+
reverse
|
|
43
44
|
}));
|
|
44
|
-
console.log('listAnimations', listAnimations);
|
|
45
45
|
cancelAnimation();
|
|
46
46
|
setAnimation(listAnimations);
|
|
47
47
|
}, [
|
package/dist/cjs/index.js
CHANGED
|
@@ -19,6 +19,7 @@ var ModalContext = require('./contexts/ModalContext.js');
|
|
|
19
19
|
var ArticleListContext = require('./contexts/ArticleListContext.js');
|
|
20
20
|
var ArticleContext = require('./contexts/ArticleContext.js');
|
|
21
21
|
var pageViewUp_generated = require('./graphql/mutations/page-view-up.generated.js');
|
|
22
|
+
var publishedShopMetas = require('./graphql/queries/published-shop-metas.js');
|
|
22
23
|
var collectionDetailFilter_generated = require('./graphql/queries/collection-detail-filter.generated.js');
|
|
23
24
|
var collection_generated = require('./graphql/queries/collection.generated.js');
|
|
24
25
|
var collections_generated = require('./graphql/queries/collections.generated.js');
|
|
@@ -62,6 +63,7 @@ var isDefined = require('./helpers/is-defined.js');
|
|
|
62
63
|
var layout = require('./helpers/layout.js');
|
|
63
64
|
var makeStyle = require('./helpers/make-style.js');
|
|
64
65
|
var align = require('./helpers/align.js');
|
|
66
|
+
var variant = require('./helpers/variant.js');
|
|
65
67
|
var product = require('./helpers/product.js');
|
|
66
68
|
var query = require('./helpers/query.js');
|
|
67
69
|
var radius = require('./helpers/radius.js');
|
|
@@ -150,6 +152,7 @@ exports.useArticleListStore = ArticleListContext.useArticleListStore;
|
|
|
150
152
|
exports.ArticleProvider = ArticleContext.ArticleProvider;
|
|
151
153
|
exports.useArticleStore = ArticleContext.useArticleStore;
|
|
152
154
|
exports.PageViewUpDocument = pageViewUp_generated.PageViewUpDocument;
|
|
155
|
+
exports.PublishedShopMetasDocument = publishedShopMetas.PublishedShopMetasDocument;
|
|
153
156
|
exports.CollectionDetailFilterDocument = collectionDetailFilter_generated.CollectionDetailFilterDocument;
|
|
154
157
|
exports.CollectionDocument = collection_generated.CollectionDocument;
|
|
155
158
|
exports.CollectionsDocument = collections_generated.CollectionsDocument;
|
|
@@ -249,6 +252,7 @@ exports.makeStyleState = makeStyle.makeStyleState;
|
|
|
249
252
|
exports.makeWidth = makeStyle.makeWidth;
|
|
250
253
|
exports.removeNullUndefined = makeStyle.removeNullUndefined;
|
|
251
254
|
exports.convertTextAlignToJustify = align.convertTextAlignToJustify;
|
|
255
|
+
exports.checkInStock = variant.checkInStock;
|
|
252
256
|
exports.checkAvailableVariantInStock = product.checkAvailableVariantInStock;
|
|
253
257
|
exports.getSelectedVariant = product.getSelectedVariant;
|
|
254
258
|
exports.parseSelectedOption = product.parseSelectedOption;
|
|
@@ -56,7 +56,31 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
56
56
|
editingPageType
|
|
57
57
|
]);
|
|
58
58
|
const isSelectOnPage = useMemo(()=>interactionData?.isSelectOnPage, [
|
|
59
|
-
interactionData
|
|
59
|
+
interactionData?.isSelectOnPage
|
|
60
|
+
]);
|
|
61
|
+
const settingType = useMemo(()=>interactionData?.settingType, [
|
|
62
|
+
interactionData?.settingType
|
|
63
|
+
]);
|
|
64
|
+
const isShowIconInteractionTarget = useMemo(()=>{
|
|
65
|
+
return interactionData?.item?.targets?.find((t)=>t.uid === props.uid && t?.type !== 'PAGE') && settingType === 'TARGET';
|
|
66
|
+
}, [
|
|
67
|
+
interactionData?.item?.targets,
|
|
68
|
+
props.uid,
|
|
69
|
+
settingType
|
|
70
|
+
]);
|
|
71
|
+
const isShowIconInteractionTrigger = useMemo(()=>{
|
|
72
|
+
return interactionData?.item?.self?.uid === props.uid && interactionData?.item?.self.type !== 'PAGE' && settingType === 'TRIGGER';
|
|
73
|
+
}, [
|
|
74
|
+
interactionData?.item?.self?.type,
|
|
75
|
+
interactionData?.item?.self?.uid,
|
|
76
|
+
props.uid,
|
|
77
|
+
settingType
|
|
78
|
+
]);
|
|
79
|
+
const isDisplayIconDrag = useMemo(()=>{
|
|
80
|
+
return !isShowIconInteractionTarget && !isShowIconInteractionTrigger;
|
|
81
|
+
}, [
|
|
82
|
+
isShowIconInteractionTarget,
|
|
83
|
+
isShowIconInteractionTrigger
|
|
60
84
|
]);
|
|
61
85
|
const { checkDisableDelete, getTooltipText, checkDisableDuplicate } = usePostPurchase(props.uid, props.tag || '');
|
|
62
86
|
const editProductElementList = [
|
|
@@ -334,7 +358,6 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
334
358
|
if (isShopifySection || isThemeSection && !isThemeSectionEditor) return false;
|
|
335
359
|
return ableGenerateContentElements.includes(tag);
|
|
336
360
|
};
|
|
337
|
-
// if (!isActive) return null;
|
|
338
361
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
339
362
|
children: [
|
|
340
363
|
!(props.tag == 'Section' && isThemeSectionEditor) && /*#__PURE__*/ jsxs("div", {
|
|
@@ -349,7 +372,39 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
349
372
|
onClick: (e)=>onShowParent(e),
|
|
350
373
|
"aria-hidden": "true",
|
|
351
374
|
children: [
|
|
352
|
-
/*#__PURE__*/ jsx("div", {
|
|
375
|
+
isShowIconInteractionTrigger && /*#__PURE__*/ jsx("div", {
|
|
376
|
+
className: "gp-hidden gp-w-[12px] interaction-use-custom-element",
|
|
377
|
+
children: /*#__PURE__*/ jsx("svg", {
|
|
378
|
+
width: "12",
|
|
379
|
+
height: "13",
|
|
380
|
+
viewBox: "0 0 12 13",
|
|
381
|
+
fill: "none",
|
|
382
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
383
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
384
|
+
"fill-rule": "evenodd",
|
|
385
|
+
"clip-rule": "evenodd",
|
|
386
|
+
d: "M4.36799 0.430523C4.51596 0.205675 4.76709 0.0703125 5.03626 0.0703125H9.88576C10.2042 0.0703125 10.395 0.424378 10.2198 0.69034L8.36968 3.4992C8.28209 3.63218 8.37747 3.80922 8.53671 3.80922H10.749C11.1111 3.80922 11.2869 4.25204 11.0233 4.50036L3.03971 12.0217C2.7572 12.2878 2.29932 12.0361 2.37262 11.655L3.27994 6.93698C3.30366 6.81364 3.20915 6.69921 3.08354 6.69921H0.984651C0.66625 6.69921 0.475479 6.34529 0.650515 6.07932L4.36799 0.430523Z",
|
|
387
|
+
fill: "#F9F9F9"
|
|
388
|
+
})
|
|
389
|
+
})
|
|
390
|
+
}),
|
|
391
|
+
isShowIconInteractionTarget && /*#__PURE__*/ jsx("div", {
|
|
392
|
+
className: "gp-hidden gp-w-[14px] interaction-use-custom-element",
|
|
393
|
+
children: /*#__PURE__*/ jsx("svg", {
|
|
394
|
+
width: "16",
|
|
395
|
+
height: "16",
|
|
396
|
+
viewBox: "0 0 16 16",
|
|
397
|
+
fill: "none",
|
|
398
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
399
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
400
|
+
"fill-rule": "evenodd",
|
|
401
|
+
"clip-rule": "evenodd",
|
|
402
|
+
d: "M7.32785 3.66159C7.87459 3.58351 8.25451 3.077 8.17643 2.53026C8.09836 1.98353 7.59184 1.6036 7.0451 1.68168C3.92866 2.12673 1.5332 4.80488 1.5332 8.04424C1.5332 11.594 4.41085 14.4716 7.9606 14.4716C11.1706 14.4716 13.8294 12.1194 14.3105 9.04446C14.3959 8.49881 14.0227 7.98727 13.4771 7.9019C12.9314 7.81654 12.4199 8.18967 12.3345 8.73531C12.0034 10.852 10.1702 12.4716 7.9606 12.4716C5.51541 12.4716 3.5332 10.4894 3.5332 8.04424C3.5332 5.81431 5.18273 3.96793 7.32785 3.66159ZM10.3432 1.97548C10.6232 1.69551 11.102 1.83654 11.1855 2.22355L11.6106 4.19339C11.6313 4.28936 11.7063 4.36432 11.8023 4.38503L13.7721 4.81013C14.1591 4.89365 14.3001 5.37247 14.0202 5.65243L12.3432 7.32945C12.1244 7.54819 11.8168 7.65338 11.5099 7.61436L10.1528 7.44178C9.84592 7.40276 9.53827 7.50795 9.31953 7.72669L8.66719 8.37903C8.35477 8.69145 7.86633 8.70954 7.57623 8.41943C7.28613 8.12933 7.30421 7.64089 7.61663 7.32847L8.26898 6.67613C8.48771 6.45739 8.5929 6.14974 8.55388 5.84287L8.38131 4.48575C8.34228 4.17888 8.44748 3.87123 8.66621 3.6525L10.3432 1.97548ZM8.19853 5.1916C8.35319 5.72179 8.04877 6.27697 7.51858 6.43163C6.83078 6.63226 6.32988 7.2683 6.32988 8.01873C6.32988 8.9316 7.06991 9.67164 7.98279 9.67164C8.73014 9.67164 9.36406 9.17486 9.56743 8.49131C9.72492 7.96195 10.2817 7.6605 10.8111 7.81799C11.3404 7.97548 11.6419 8.53227 11.4844 9.06163C11.0356 10.57 9.63916 11.6716 7.98279 11.6716C5.96535 11.6716 4.32988 10.0362 4.32988 8.01873C4.32988 6.35558 5.44054 4.95445 6.95851 4.51165C7.4887 4.35699 8.04387 4.66141 8.19853 5.1916Z",
|
|
403
|
+
fill: "#F9F9F9"
|
|
404
|
+
})
|
|
405
|
+
})
|
|
406
|
+
}),
|
|
407
|
+
isDisplayIconDrag && /*#__PURE__*/ jsx("div", {
|
|
353
408
|
"data-toolbar-icon-drag": true,
|
|
354
409
|
children: /*#__PURE__*/ jsxs("svg", {
|
|
355
410
|
width: "16",
|
|
@@ -10,7 +10,7 @@ const ComponentWrapper = ({ children, pageType, ...props })=>{
|
|
|
10
10
|
const advanced = props.advanced;
|
|
11
11
|
const interactionAttributes = ()=>{
|
|
12
12
|
let result = {};
|
|
13
|
-
if (props.advanced?.displayInitInteraction
|
|
13
|
+
if (props.advanced?.displayInitInteraction !== undefined) {
|
|
14
14
|
result = {
|
|
15
15
|
'display-init': props.advanced?.displayInitInteraction === false ? 'hide' : 'show',
|
|
16
16
|
'gp-interaction-wrapper': ''
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx, Fragment
|
|
2
|
-
import { useMemo } from 'react';
|
|
1
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
3
2
|
import 'zustand';
|
|
3
|
+
import 'react';
|
|
4
4
|
import 'swr';
|
|
5
5
|
import { usePageStore } from '../contexts/PageContext.js';
|
|
6
6
|
import '@gem-sdk/adapter-shopify';
|
|
@@ -15,98 +15,17 @@ import 'dayjs';
|
|
|
15
15
|
import { useInteraction } from '../helpers/interaction/index.js';
|
|
16
16
|
import '../helpers/convert.js';
|
|
17
17
|
|
|
18
|
-
const InteractionSuffix = (
|
|
18
|
+
const InteractionSuffix = ()=>{
|
|
19
19
|
const { closeSelectOnPage } = useInteraction();
|
|
20
|
-
const
|
|
20
|
+
const settingType = usePageStore((s)=>s.interactionData?.settingType);
|
|
21
21
|
const isSelectOnPage = usePageStore((s)=>s.interactionData?.isSelectOnPage);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return currentInteraction?.self?.uid === uid && !currentInteraction?.self?.isEntirePage;
|
|
30
|
-
}, [
|
|
31
|
-
currentInteraction,
|
|
32
|
-
uid
|
|
33
|
-
]);
|
|
34
|
-
const isDisplay = useMemo(()=>{
|
|
35
|
-
return isCurrentInteractionTarget || isCurrentInteractionTrigger;
|
|
36
|
-
}, [
|
|
37
|
-
isCurrentInteractionTarget,
|
|
38
|
-
isCurrentInteractionTrigger
|
|
39
|
-
]);
|
|
40
|
-
const positionOffset = useMemo(()=>{
|
|
41
|
-
if (isCurrentInteractionTrigger && isCurrentInteractionTarget) {
|
|
42
|
-
return 80;
|
|
43
|
-
}
|
|
44
|
-
return 40;
|
|
45
|
-
}, [
|
|
46
|
-
isCurrentInteractionTrigger,
|
|
47
|
-
isCurrentInteractionTarget
|
|
48
|
-
]);
|
|
49
|
-
if (!isDisplay) {
|
|
50
|
-
return /*#__PURE__*/ jsx(Fragment, {});
|
|
51
|
-
}
|
|
52
|
-
return /*#__PURE__*/ jsxs(Fragment, {
|
|
53
|
-
children: [
|
|
54
|
-
isSelectOnPage && /*#__PURE__*/ jsx("button", {
|
|
55
|
-
className: "gp-bg-[#F4F4F4] gp-px-2 gp-py-0.5 gp-rounded-lg gp-text-[#212121] gp-text-sm gp-font-medium gp-hidden interaction-use-element-btn",
|
|
56
|
-
onClick: closeSelectOnPage,
|
|
57
|
-
children: "Use element"
|
|
58
|
-
}),
|
|
59
|
-
/*#__PURE__*/ jsx("div", {
|
|
60
|
-
className: "hidden gp-left-[-40px] gp-left-[-80px] gp-right-[-40px] gp-right-[-80px]"
|
|
61
|
-
}),
|
|
62
|
-
/*#__PURE__*/ jsxs("div", {
|
|
63
|
-
className: `gp-hidden gp-absolute interaction-suffix gp-gap-[8px] ${tag == 'Section' ? `gp-left-[-${positionOffset}px]` : `gp-right-[-${positionOffset}px]`}`,
|
|
64
|
-
children: [
|
|
65
|
-
isCurrentInteractionTrigger && /*#__PURE__*/ jsx("div", {
|
|
66
|
-
className: `gp-h-8 gp-rounded-[8px] gp-w-8 gp-bg-[#212121] gp-flex gp-justify-center gp-items-center `,
|
|
67
|
-
children: /*#__PURE__*/ jsx("svg", {
|
|
68
|
-
width: "16",
|
|
69
|
-
height: "16",
|
|
70
|
-
viewBox: "0 0 16 16",
|
|
71
|
-
fill: "none",
|
|
72
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
73
|
-
children: /*#__PURE__*/ jsx("path", {
|
|
74
|
-
fillRule: "evenodd",
|
|
75
|
-
clipRule: "evenodd",
|
|
76
|
-
d: "M12.9196 5.80449C13.0989 5.80449 13.1876 6.02216 13.0595 6.14749L4.83569 14.1892C4.69517 14.3267 4.46149 14.2002 4.49967 14.0074L5.50422 8.93537C5.53483 8.7808 5.41656 8.6368 5.25898 8.6368H3.08019C2.92551 8.6368 2.82938 8.46874 2.90779 8.33541L6.72099 1.85154C6.75692 1.79045 6.8225 1.75293 6.89338 1.75293H12.5729C12.7386 1.75293 12.8324 1.94273 12.7319 2.07435L10.1891 5.40272C10.0634 5.56724 10.1807 5.80449 10.3877 5.80449H12.9196Z",
|
|
77
|
-
fill: "#F9F9F9"
|
|
78
|
-
})
|
|
79
|
-
})
|
|
80
|
-
}),
|
|
81
|
-
isCurrentInteractionTarget && /*#__PURE__*/ jsx("div", {
|
|
82
|
-
className: `gp-h-8 min-w-8 gp-rounded-[8px] gp-w-8 gp-bg-[#212121] gp-flex gp-justify-center gp-items-center`,
|
|
83
|
-
children: /*#__PURE__*/ jsxs("svg", {
|
|
84
|
-
width: "16",
|
|
85
|
-
height: "16",
|
|
86
|
-
viewBox: "0 0 16 16",
|
|
87
|
-
fill: "none",
|
|
88
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
89
|
-
children: [
|
|
90
|
-
/*#__PURE__*/ jsx("path", {
|
|
91
|
-
d: "M8.58987 2.11238C8.62815 2.66333 8.21254 3.141 7.66158 3.17928C6.73192 3.24386 5.84034 3.57396 5.09276 4.13034C4.34519 4.68673 3.77304 5.44602 3.44429 6.31801C3.11554 7.19 3.04401 8.13803 3.23821 9.04947C3.4324 9.96092 3.88415 10.7975 4.53978 11.4597C5.19541 12.122 6.02737 12.5821 6.93682 12.7854C7.84626 12.9888 8.79496 12.9268 9.67021 12.6068C10.5455 12.2869 11.3105 11.7224 11.8743 10.9804C12.4382 10.2385 12.7772 9.35025 12.8512 8.42129C12.895 7.87074 13.3768 7.45996 13.9273 7.50377C14.4779 7.54758 14.8887 8.0294 14.8449 8.57994C14.7406 9.8906 14.2622 11.1438 13.4667 12.1906C12.6711 13.2374 11.5918 14.0338 10.3569 14.4852C9.12204 14.9367 7.78353 15.0241 6.50041 14.7373C5.2173 14.4504 4.0435 13.8012 3.11848 12.8668C2.19345 11.9324 1.55609 10.7522 1.28211 9.46624C1.00813 8.1803 1.10905 6.84274 1.57287 5.61247C2.03669 4.3822 2.84393 3.31093 3.89867 2.52593C4.95342 1.74093 6.21133 1.27521 7.52297 1.18409C8.07393 1.14581 8.5516 1.56142 8.58987 2.11238Z",
|
|
92
|
-
fill: "#F9F9F9"
|
|
93
|
-
}),
|
|
94
|
-
/*#__PURE__*/ jsx("path", {
|
|
95
|
-
fillRule: "evenodd",
|
|
96
|
-
clipRule: "evenodd",
|
|
97
|
-
d: "M11.9757 1.25658C12.184 1.31428 12.3452 1.47958 12.3976 1.68929L12.7872 3.24774L14.3457 3.63736C14.5554 3.68978 14.7207 3.85096 14.7784 4.05928C14.8361 4.2676 14.7773 4.49085 14.6244 4.64371L12.7167 6.55141C12.5677 6.70044 12.3514 6.76035 12.1469 6.70924L10.5688 6.3147L8.42436 8.45912C8.19005 8.69344 7.81015 8.69344 7.57583 8.45912C7.34152 8.22481 7.34152 7.84491 7.57583 7.61059L9.72025 5.46617L9.32572 3.88804C9.2746 3.68357 9.33451 3.46728 9.48354 3.31825L11.3912 1.41054C11.5441 1.25769 11.7674 1.19888 11.9757 1.25658ZM10.8795 5.15545L12.1084 5.46267L13.0266 4.54451L12.1469 4.3246C11.9319 4.27086 11.7641 4.10301 11.7104 3.88804L11.4904 3.0084L10.5723 3.92656L10.8795 5.15545Z",
|
|
98
|
-
fill: "#F9F9F9"
|
|
99
|
-
}),
|
|
100
|
-
/*#__PURE__*/ jsx("path", {
|
|
101
|
-
d: "M7.35783 6.45343C7.87208 6.25201 8.12568 5.67185 7.92426 5.15761C7.72284 4.64336 7.14268 4.38976 6.62844 4.59118C6.05705 4.81498 5.55049 5.17772 5.15453 5.64655C4.75858 6.11538 4.4857 6.67552 4.36055 7.27631C4.23539 7.87709 4.26189 8.49961 4.43764 9.08758C4.6134 9.67555 4.93289 10.2105 5.36727 10.6439C5.80165 11.0774 6.33722 11.3958 6.92556 11.5702C7.51391 11.7445 8.13643 11.7695 8.73683 11.6427C9.33723 11.5158 9.89652 11.2413 10.3641 10.8439C10.8318 10.4465 11.1929 9.93885 11.4151 9.36679C11.615 8.85196 11.3597 8.27254 10.8449 8.07262C10.3301 7.87269 9.75066 8.12797 9.55073 8.6428C9.44887 8.9051 9.28329 9.1378 9.06901 9.3199C8.85474 9.50199 8.59851 9.62774 8.32352 9.68582C8.04853 9.7439 7.76341 9.73249 7.49394 9.65262C7.22445 9.57274 6.97907 9.42691 6.78001 9.22825C6.58093 9.0296 6.43446 8.78439 6.35386 8.51478C6.27327 8.24517 6.26112 7.9597 6.31851 7.6842C6.37591 7.4087 6.50102 7.1519 6.68251 6.93702C6.86399 6.72214 7.0961 6.55595 7.35783 6.45343Z",
|
|
102
|
-
fill: "#F9F9F9"
|
|
103
|
-
})
|
|
104
|
-
]
|
|
105
|
-
})
|
|
106
|
-
})
|
|
107
|
-
]
|
|
108
|
-
})
|
|
109
|
-
]
|
|
22
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
23
|
+
children: isSelectOnPage && /*#__PURE__*/ jsx("button", {
|
|
24
|
+
className: "gp-bg-[#F4F4F4] gp-px-2 gp-py-0.5 gp-rounded-lg gp-text-[#212121] gp-text-xs gp-font-medium gp-hidden interaction-use-custom-element ",
|
|
25
|
+
onClick: closeSelectOnPage,
|
|
26
|
+
"data-setup-interaction": true,
|
|
27
|
+
children: settingType === 'TRIGGER' ? 'Set as trigger' : 'Set as target'
|
|
28
|
+
})
|
|
110
29
|
});
|
|
111
30
|
};
|
|
112
31
|
|
|
@@ -31,7 +31,7 @@ const componentIconList = [
|
|
|
31
31
|
const componentUsingAdvanced = [
|
|
32
32
|
'IconList'
|
|
33
33
|
];
|
|
34
|
-
const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageContext, ...passProps })=>{
|
|
34
|
+
const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageContext, largeComponent = [], sizeLargeComponent = 50, ...passProps })=>{
|
|
35
35
|
const item = builder[uid];
|
|
36
36
|
const Component = components[item?.tag];
|
|
37
37
|
if (!Component) {
|
|
@@ -70,6 +70,8 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
70
70
|
advanced: item.advanced,
|
|
71
71
|
parentId: componentsRenderWithParentId.includes(item.tag) ? parentId : null,
|
|
72
72
|
pageContext,
|
|
73
|
+
largeComponent,
|
|
74
|
+
sizeLargeComponent,
|
|
73
75
|
...passProps,
|
|
74
76
|
builderAttrs: {
|
|
75
77
|
...passProps.builderAttrs
|
|
@@ -81,7 +83,9 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
81
83
|
builder,
|
|
82
84
|
components,
|
|
83
85
|
customProps,
|
|
84
|
-
pageContext
|
|
86
|
+
pageContext,
|
|
87
|
+
largeComponent,
|
|
88
|
+
sizeLargeComponent
|
|
85
89
|
};
|
|
86
90
|
}),
|
|
87
91
|
children: !customRenderChildren.includes(item.tag) ? WrapRenderChildren({
|
|
@@ -93,11 +97,13 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
93
97
|
components,
|
|
94
98
|
customProps,
|
|
95
99
|
parentTag: item.tag,
|
|
96
|
-
pageContext
|
|
100
|
+
pageContext,
|
|
101
|
+
largeComponent,
|
|
102
|
+
sizeLargeComponent
|
|
97
103
|
}))) : ''
|
|
98
104
|
});
|
|
99
105
|
}, ()=>{
|
|
100
|
-
|
|
106
|
+
const liquid = Component({
|
|
101
107
|
builderProps: {
|
|
102
108
|
uid,
|
|
103
109
|
builderData: item
|
|
@@ -109,11 +115,17 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
109
115
|
isText: componentTexts.includes(item.tag) ? true : null,
|
|
110
116
|
parentId: componentsRenderWithParentId.includes(item.tag) ? parentId : null,
|
|
111
117
|
pageContext,
|
|
118
|
+
largeComponent,
|
|
119
|
+
sizeLargeComponent,
|
|
112
120
|
...passProps,
|
|
113
121
|
builderAttrs: {
|
|
114
122
|
...passProps.builderAttrs
|
|
115
123
|
}
|
|
116
124
|
});
|
|
125
|
+
if (isLimitSize(liquid, sizeLargeComponent)) {
|
|
126
|
+
largeComponent.push(item.uid);
|
|
127
|
+
}
|
|
128
|
+
return liquid;
|
|
117
129
|
});
|
|
118
130
|
} else {
|
|
119
131
|
liquid = template`<div gp-el-wrapper style="${!componentIconList.includes(item.tag) ? style : ''}" class="${item.uid} ${!item?.childrens?.length && item.tag === 'IconListItemHoz' ? 'hidden' : ''}">
|
|
@@ -130,6 +142,8 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
130
142
|
cssClass: item?.advanced?.cssClass
|
|
131
143
|
},
|
|
132
144
|
pageContext,
|
|
145
|
+
largeComponent,
|
|
146
|
+
sizeLargeComponent,
|
|
133
147
|
...passProps,
|
|
134
148
|
builderAttrs: {
|
|
135
149
|
...passProps.builderAttrs
|
|
@@ -141,7 +155,9 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
141
155
|
builder,
|
|
142
156
|
components,
|
|
143
157
|
customProps,
|
|
144
|
-
pageContext
|
|
158
|
+
pageContext,
|
|
159
|
+
largeComponent,
|
|
160
|
+
sizeLargeComponent
|
|
145
161
|
};
|
|
146
162
|
}),
|
|
147
163
|
children: !customRenderChildren.includes(item.tag) ? WrapRenderChildren({
|
|
@@ -153,11 +169,13 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
153
169
|
components,
|
|
154
170
|
customProps,
|
|
155
171
|
parentTag: item.tag,
|
|
156
|
-
pageContext
|
|
172
|
+
pageContext,
|
|
173
|
+
largeComponent,
|
|
174
|
+
sizeLargeComponent
|
|
157
175
|
}))) : ''
|
|
158
176
|
});
|
|
159
177
|
}, ()=>{
|
|
160
|
-
|
|
178
|
+
const liquid = Component({
|
|
161
179
|
builderProps: {
|
|
162
180
|
uid,
|
|
163
181
|
builderData: item
|
|
@@ -175,6 +193,10 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
175
193
|
...passProps.builderAttrs
|
|
176
194
|
}
|
|
177
195
|
});
|
|
196
|
+
if (isLimitSize(liquid, sizeLargeComponent)) {
|
|
197
|
+
largeComponent.push(item.uid);
|
|
198
|
+
}
|
|
199
|
+
return liquid;
|
|
178
200
|
})}
|
|
179
201
|
</div>`;
|
|
180
202
|
}
|
|
@@ -299,5 +321,10 @@ const WrapRenderChildren = ({ uid, customProps }, codes)=>{
|
|
|
299
321
|
}
|
|
300
322
|
return liquid;
|
|
301
323
|
};
|
|
324
|
+
const isLimitSize = (liquid, size = 50)=>{
|
|
325
|
+
const textEncoder = new TextEncoder();
|
|
326
|
+
const byteSize = textEncoder.encode(liquid).length;
|
|
327
|
+
return byteSize >= size * 1024;
|
|
328
|
+
};
|
|
302
329
|
|
|
303
330
|
export { RenderChildren, WrapRenderChildren, Render as default };
|
|
@@ -54,6 +54,14 @@ const createPageStoreProvider = (data)=>createStore((set)=>({
|
|
|
54
54
|
selectType
|
|
55
55
|
}
|
|
56
56
|
}));
|
|
57
|
+
},
|
|
58
|
+
setInteractionSettingType: (settingType)=>{
|
|
59
|
+
set((state)=>({
|
|
60
|
+
interactionData: {
|
|
61
|
+
...state.interactionData,
|
|
62
|
+
settingType
|
|
63
|
+
}
|
|
64
|
+
}));
|
|
57
65
|
}
|
|
58
66
|
}));
|
|
59
67
|
const PageProvider = ({ children, dynamicProduct, dynamicCollection, productOffers, publicStoreFrontData, ...passProps })=>{
|
|
@@ -63,7 +71,7 @@ const PageProvider = ({ children, dynamicProduct, dynamicCollection, productOffe
|
|
|
63
71
|
productOffers,
|
|
64
72
|
publicStoreFrontData,
|
|
65
73
|
interactionData: {
|
|
66
|
-
selectType: '
|
|
74
|
+
selectType: 'ELEMENT'
|
|
67
75
|
}
|
|
68
76
|
}), [
|
|
69
77
|
dynamicProduct,
|