@gem-sdk/core 1.47.0 → 1.48.0-dev.0
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 +114 -100
- package/dist/cjs/components/ComponentWrapperPreview.js +16 -2
- package/dist/cjs/components/InteractionSuffix.js +107 -0
- package/dist/cjs/components/Render.liquid.js +21 -6
- package/dist/cjs/components/RenderPreview.js +1 -0
- package/dist/cjs/components/constant.js +2 -1
- package/dist/cjs/contexts/PageContext.js +29 -1
- package/dist/cjs/contexts/SectionContext.js +0 -1
- package/dist/cjs/helpers/align.js +19 -0
- package/dist/cjs/helpers/colors.js +1 -1
- package/dist/cjs/helpers/shadow.js +1 -1
- package/dist/cjs/helpers/third-party/appConfig.js +14 -0
- package/dist/cjs/helpers/third-party/appSetting.js +22 -0
- package/dist/cjs/helpers/third-party/constant.js +3 -1
- package/dist/cjs/hooks/animation/useApplyAnimation.js +1 -0
- package/dist/cjs/hooks/useFormatMoney.js +61 -60
- package/dist/cjs/hooks/useInteraction.js +19 -0
- package/dist/cjs/index.js +12 -0
- package/dist/cjs/types/custom.js +44 -0
- package/dist/esm/components/ComponentToolbarPreview.js +114 -100
- package/dist/esm/components/ComponentWrapperPreview.js +16 -2
- package/dist/esm/components/InteractionSuffix.js +105 -0
- package/dist/esm/components/Render.liquid.js +21 -6
- package/dist/esm/components/RenderPreview.js +1 -0
- package/dist/esm/components/constant.js +2 -1
- package/dist/esm/contexts/PageContext.js +29 -1
- package/dist/esm/contexts/SectionContext.js +0 -1
- package/dist/esm/helpers/align.js +17 -0
- package/dist/esm/helpers/colors.js +1 -1
- package/dist/esm/helpers/shadow.js +1 -1
- package/dist/esm/helpers/third-party/appConfig.js +13 -1
- package/dist/esm/helpers/third-party/appSetting.js +22 -0
- package/dist/esm/helpers/third-party/constant.js +4 -2
- package/dist/esm/hooks/animation/useApplyAnimation.js +1 -0
- package/dist/esm/hooks/useFormatMoney.js +61 -61
- package/dist/esm/hooks/useInteraction.js +17 -0
- package/dist/esm/index.js +3 -1
- package/dist/esm/types/custom.js +44 -0
- package/dist/types/index.d.ts +168 -3
- package/package.json +3 -3
|
@@ -42,10 +42,24 @@ const ShopifyFormsConfig = {
|
|
|
42
42
|
appId: '8744a304-fcb1-4347-b211-bb6b4759a76a'
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
|
+
const ReviewxpoProductReviewsAppConfig = {
|
|
46
|
+
ReviewxpoProductReviewsApp: {
|
|
47
|
+
appName: 'reviewxpo-product-reviews-app',
|
|
48
|
+
appId: '3e3d94fa-8b53-4134-942c-f7662dc9282f'
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
const PumperBundlesVolumeDiscountConfig = {
|
|
52
|
+
PumperBundlesVolumeDiscount: {
|
|
53
|
+
appName: 'Pumper Bundles Volume Discount',
|
|
54
|
+
appId: '0856870d-2aca-4b1e-a662-cf1797f61270'
|
|
55
|
+
}
|
|
56
|
+
};
|
|
45
57
|
|
|
46
58
|
exports.BonLoyaltyRewardsReferralsConfig = BonLoyaltyRewardsReferralsConfig;
|
|
47
59
|
exports.LoopSubscriptionsConfig = LoopSubscriptionsConfig;
|
|
60
|
+
exports.PumperBundlesVolumeDiscountConfig = PumperBundlesVolumeDiscountConfig;
|
|
48
61
|
exports.RechargeSubscriptionsConfig = RechargeSubscriptionsConfig;
|
|
62
|
+
exports.ReviewxpoProductReviewsAppConfig = ReviewxpoProductReviewsAppConfig;
|
|
49
63
|
exports.SelleasyConfig = SelleasyConfig;
|
|
50
64
|
exports.ShopifyFormsConfig = ShopifyFormsConfig;
|
|
51
65
|
exports.SkioSubscriptionsYcS20Config = SkioSubscriptionsYcS20Config;
|
|
@@ -85,7 +85,29 @@ const overrideSettings = (tag, currentSetting, appSetting)=>{
|
|
|
85
85
|
return currentSetting;
|
|
86
86
|
}
|
|
87
87
|
};
|
|
88
|
+
const ReviewxpoProductReviewsApp = {
|
|
89
|
+
ReviewxpoProductReviewsApp: {
|
|
90
|
+
'five-star-badge-widget': null,
|
|
91
|
+
'allreviews-widget': null,
|
|
92
|
+
'carousel-widget': null,
|
|
93
|
+
'gallery-widget': null,
|
|
94
|
+
'badge-widget': null,
|
|
95
|
+
'testimonial-widget': null,
|
|
96
|
+
'star-widget': null,
|
|
97
|
+
'revews-widget': null
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
const PumperBundlesVolumeDiscount = {
|
|
101
|
+
PumperBundlesVolumeDiscount: {
|
|
102
|
+
'app-block': {
|
|
103
|
+
selected_product: '{{product}}',
|
|
104
|
+
using_page_builder: false
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
};
|
|
88
108
|
const composeSettingsByWidgetType = {
|
|
109
|
+
...PumperBundlesVolumeDiscount,
|
|
110
|
+
...ReviewxpoProductReviewsApp,
|
|
89
111
|
...ShopifyForms,
|
|
90
112
|
...SkioSubscriptionsYcS20,
|
|
91
113
|
...LoopSubscriptions,
|
|
@@ -9,7 +9,9 @@ const mapShopifyAppMeta = {
|
|
|
9
9
|
...appConfig.SelleasyConfig,
|
|
10
10
|
...appConfig.LoopSubscriptionsConfig,
|
|
11
11
|
...appConfig.SkioSubscriptionsYcS20Config,
|
|
12
|
-
...appConfig.ShopifyFormsConfig
|
|
12
|
+
...appConfig.ShopifyFormsConfig,
|
|
13
|
+
...appConfig.ReviewxpoProductReviewsAppConfig,
|
|
14
|
+
...appConfig.PumperBundlesVolumeDiscountConfig
|
|
13
15
|
};
|
|
14
16
|
const THIRD_PARTY_APP_BLOCK_ID_PREFIX = 'gp_app';
|
|
15
17
|
|
|
@@ -8,6 +8,7 @@ var useAnimationTarget = require('./useAnimationTarget.js');
|
|
|
8
8
|
var useAnimationConfig = require('./useAnimationConfig.js');
|
|
9
9
|
var useAnimationActions = require('./useAnimationActions.js');
|
|
10
10
|
var useAnimationPreview = require('./useAnimationPreview.js');
|
|
11
|
+
require('../../types/custom.js');
|
|
11
12
|
var animations = require('../../types/animations.js');
|
|
12
13
|
|
|
13
14
|
const useApplyAnimation = ({ props })=>{
|
|
@@ -5,70 +5,71 @@ var shop = require('./shop.js');
|
|
|
5
5
|
const shopifyPriceRounding = (amount, precision)=>{
|
|
6
6
|
return parseFloat(`${amount}`).toFixed(Number(precision) + 1).slice(0, -1);
|
|
7
7
|
};
|
|
8
|
+
const formatMoney = function(cents, format) {
|
|
9
|
+
let value = '';
|
|
10
|
+
const placeholderRegex = /\{\{\s*(\w+)\s*\}\}/;
|
|
11
|
+
const formatString = format || '${{amount}}';
|
|
12
|
+
/**
|
|
13
|
+
* check default
|
|
14
|
+
* @param opt opt
|
|
15
|
+
* @param def def
|
|
16
|
+
* @returns any
|
|
17
|
+
*/ function defaultOption(opt, def) {
|
|
18
|
+
return typeof opt == 'undefined' ? def : opt;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* formatWithDelimiters
|
|
22
|
+
* @param number number
|
|
23
|
+
* @param precision precision
|
|
24
|
+
* @param thousands thousands
|
|
25
|
+
* @param decimal decimal
|
|
26
|
+
* @returns any
|
|
27
|
+
*/ // eslint-disable-next-line max-params
|
|
28
|
+
function formatWithDelimiters(number, precision, thousands, decimal) {
|
|
29
|
+
precision = defaultOption(precision, 2);
|
|
30
|
+
thousands = defaultOption(thousands, ',');
|
|
31
|
+
decimal = defaultOption(decimal, '.');
|
|
32
|
+
if (isNaN(number) || number == null) {
|
|
33
|
+
return 0;
|
|
34
|
+
}
|
|
35
|
+
// shopify làm tròn bằng cách cắt đi các số ở đằng sau chứ không sử dụng toFixed để làm tròn như toán học
|
|
36
|
+
number = shopifyPriceRounding(number, Number(precision));
|
|
37
|
+
const parts = number.split('.'), dollars = parts[0]?.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1' + thousands), cents = parts[1] ? decimal + parts[1] : '';
|
|
38
|
+
return dollars + cents;
|
|
39
|
+
}
|
|
40
|
+
switch(formatString.match(placeholderRegex)[1]){
|
|
41
|
+
case 'amount':
|
|
42
|
+
value = formatWithDelimiters(cents, 2);
|
|
43
|
+
break;
|
|
44
|
+
case 'amount_no_decimals':
|
|
45
|
+
value = formatWithDelimiters(cents, 0);
|
|
46
|
+
break;
|
|
47
|
+
case 'amount_with_comma_separator':
|
|
48
|
+
value = formatWithDelimiters(cents, 2, '.', ',');
|
|
49
|
+
break;
|
|
50
|
+
case 'amount_no_decimals_with_comma_separator':
|
|
51
|
+
value = formatWithDelimiters(cents, 0, '.', ',');
|
|
52
|
+
break;
|
|
53
|
+
case 'amount_with_apostrophe_separator':
|
|
54
|
+
value = formatWithDelimiters(cents, 2, "'", '.');
|
|
55
|
+
break;
|
|
56
|
+
case 'amount_no_decimals_with_space_separator':
|
|
57
|
+
value = formatWithDelimiters(cents, 0, ' ');
|
|
58
|
+
break;
|
|
59
|
+
case 'amount_with_space_separator':
|
|
60
|
+
value = formatWithDelimiters(cents, 2, ' ', ',');
|
|
61
|
+
break;
|
|
62
|
+
case 'amount_with_period_and_space_separator':
|
|
63
|
+
value = formatWithDelimiters(cents, 2, ' ', '.');
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
return formatString.replace(placeholderRegex, value);
|
|
67
|
+
};
|
|
8
68
|
const useFormatMoney = (amount, withCurrency)=>{
|
|
9
69
|
const { moneyFormat, moneyWithCurrencyFormat } = shop.useMoneyFormat();
|
|
10
|
-
const formatMoney = function(cents, format) {
|
|
11
|
-
let value = '';
|
|
12
|
-
const placeholderRegex = /\{\{\s*(\w+)\s*\}\}/;
|
|
13
|
-
const formatString = format || '${{amount}}';
|
|
14
|
-
/**
|
|
15
|
-
* check default
|
|
16
|
-
* @param opt opt
|
|
17
|
-
* @param def def
|
|
18
|
-
* @returns any
|
|
19
|
-
*/ function defaultOption(opt, def) {
|
|
20
|
-
return typeof opt == 'undefined' ? def : opt;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* formatWithDelimiters
|
|
24
|
-
* @param number number
|
|
25
|
-
* @param precision precision
|
|
26
|
-
* @param thousands thousands
|
|
27
|
-
* @param decimal decimal
|
|
28
|
-
* @returns any
|
|
29
|
-
*/ // eslint-disable-next-line max-params
|
|
30
|
-
function formatWithDelimiters(number, precision, thousands, decimal) {
|
|
31
|
-
precision = defaultOption(precision, 2);
|
|
32
|
-
thousands = defaultOption(thousands, ',');
|
|
33
|
-
decimal = defaultOption(decimal, '.');
|
|
34
|
-
if (isNaN(number) || number == null) {
|
|
35
|
-
return 0;
|
|
36
|
-
}
|
|
37
|
-
// shopify làm tròn bằng cách cắt đi các số ở đằng sau chứ không sử dụng toFixed để làm tròn như toán học
|
|
38
|
-
number = shopifyPriceRounding(number, Number(precision));
|
|
39
|
-
const parts = number.split('.'), dollars = parts[0]?.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1' + thousands), cents = parts[1] ? decimal + parts[1] : '';
|
|
40
|
-
return dollars + cents;
|
|
41
|
-
}
|
|
42
|
-
switch(formatString.match(placeholderRegex)[1]){
|
|
43
|
-
case 'amount':
|
|
44
|
-
value = formatWithDelimiters(cents, 2);
|
|
45
|
-
break;
|
|
46
|
-
case 'amount_no_decimals':
|
|
47
|
-
value = formatWithDelimiters(cents, 0);
|
|
48
|
-
break;
|
|
49
|
-
case 'amount_with_comma_separator':
|
|
50
|
-
value = formatWithDelimiters(cents, 2, '.', ',');
|
|
51
|
-
break;
|
|
52
|
-
case 'amount_no_decimals_with_comma_separator':
|
|
53
|
-
value = formatWithDelimiters(cents, 0, '.', ',');
|
|
54
|
-
break;
|
|
55
|
-
case 'amount_with_apostrophe_separator':
|
|
56
|
-
value = formatWithDelimiters(cents, 2, "'", '.');
|
|
57
|
-
break;
|
|
58
|
-
case 'amount_no_decimals_with_space_separator':
|
|
59
|
-
value = formatWithDelimiters(cents, 0, ' ');
|
|
60
|
-
break;
|
|
61
|
-
case 'amount_with_space_separator':
|
|
62
|
-
value = formatWithDelimiters(cents, 2, ' ', ',');
|
|
63
|
-
break;
|
|
64
|
-
case 'amount_with_period_and_space_separator':
|
|
65
|
-
value = formatWithDelimiters(cents, 2, ' ', '.');
|
|
66
|
-
break;
|
|
67
|
-
}
|
|
68
|
-
return formatString.replace(placeholderRegex, value);
|
|
69
|
-
};
|
|
70
70
|
return withCurrency ? formatMoney(`${amount}`, moneyWithCurrencyFormat || moneyFormat) : formatMoney(`${amount}`, moneyFormat);
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
+
exports.formatMoney = formatMoney;
|
|
73
74
|
exports.shopifyPriceRounding = shopifyPriceRounding;
|
|
74
75
|
exports.useFormatMoney = useFormatMoney;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var PageContext = require('../contexts/PageContext.js');
|
|
4
|
+
|
|
5
|
+
const useInteraction = ()=>{
|
|
6
|
+
const interactionData = PageContext.usePageStore((state)=>state.interactionData);
|
|
7
|
+
const { item } = interactionData || {};
|
|
8
|
+
const getAnimationByUid = (uid)=>{
|
|
9
|
+
const targets = item?.targets;
|
|
10
|
+
const targetByUid = targets?.find((target)=>target.uid === uid);
|
|
11
|
+
const metaDataContainsAnimation = targetByUid?.events?.find((it)=>it.condition?.metaData?.animation);
|
|
12
|
+
return metaDataContainsAnimation?.condition?.metaData?.animation;
|
|
13
|
+
};
|
|
14
|
+
return {
|
|
15
|
+
getAnimationByUid
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
exports.useInteraction = useInteraction;
|
package/dist/cjs/index.js
CHANGED
|
@@ -60,6 +60,7 @@ var iconList = require('./helpers/icon-list.js');
|
|
|
60
60
|
var isDefined = require('./helpers/is-defined.js');
|
|
61
61
|
var layout = require('./helpers/layout.js');
|
|
62
62
|
var makeStyle = require('./helpers/make-style.js');
|
|
63
|
+
var align = require('./helpers/align.js');
|
|
63
64
|
var product = require('./helpers/product.js');
|
|
64
65
|
var query = require('./helpers/query.js');
|
|
65
66
|
var radius = require('./helpers/radius.js');
|
|
@@ -97,6 +98,7 @@ var useProductList = require('./hooks/useProductList.js');
|
|
|
97
98
|
var useSuspenseFetch = require('./hooks/useSuspenseFetch.js');
|
|
98
99
|
var useSwatchesOptions = require('./hooks/useSwatchesOptions.js');
|
|
99
100
|
var useInitialSwatchesOptions = require('./hooks/useInitialSwatchesOptions.js');
|
|
101
|
+
var custom = require('./types/custom.js');
|
|
100
102
|
var shop$1 = require('./types/shop.js');
|
|
101
103
|
var appAPI = require('./types/appAPI.js');
|
|
102
104
|
var globalStyle = require('./types/global-style.js');
|
|
@@ -243,6 +245,7 @@ exports.makeStyleResponsiveState = makeStyle.makeStyleResponsiveState;
|
|
|
243
245
|
exports.makeStyleState = makeStyle.makeStyleState;
|
|
244
246
|
exports.makeWidth = makeStyle.makeWidth;
|
|
245
247
|
exports.removeNullUndefined = makeStyle.removeNullUndefined;
|
|
248
|
+
exports.convertTextAlignToJustify = align.convertTextAlignToJustify;
|
|
246
249
|
exports.checkAvailableVariantInStock = product.checkAvailableVariantInStock;
|
|
247
250
|
exports.getSelectedVariant = product.getSelectedVariant;
|
|
248
251
|
exports.parseSelectedOption = product.parseSelectedOption;
|
|
@@ -317,6 +320,7 @@ exports.useProductQuery = useProductQuery.useProductQuery;
|
|
|
317
320
|
exports.useProductsQuery = useProductsQuery.useProductsQuery;
|
|
318
321
|
exports.useProductsQueryAll = useProductsQuery.useProductsQueryAll;
|
|
319
322
|
exports.useCurrentDevice = useCurrentDevice.useCurrentDevice;
|
|
323
|
+
exports.formatMoney = useFormatMoney.formatMoney;
|
|
320
324
|
exports.shopifyPriceRounding = useFormatMoney.shopifyPriceRounding;
|
|
321
325
|
exports.useFormatMoney = useFormatMoney.useFormatMoney;
|
|
322
326
|
exports.useLazyVideo = useLazyVideo.useLazyVideo;
|
|
@@ -355,6 +359,14 @@ exports.useProductListStyles = useProductList.useProductListStyles;
|
|
|
355
359
|
exports.useSuspenseFetch = useSuspenseFetch.default;
|
|
356
360
|
exports.useSwatchesOptions = useSwatchesOptions.default;
|
|
357
361
|
exports.useInitialSwatchesOptions = useInitialSwatchesOptions.default;
|
|
362
|
+
Object.defineProperty(exports, 'InteractionTargetEvent', {
|
|
363
|
+
enumerable: true,
|
|
364
|
+
get: function () { return custom.InteractionTargetEvent; }
|
|
365
|
+
});
|
|
366
|
+
Object.defineProperty(exports, 'InteractionTriggerEvent', {
|
|
367
|
+
enumerable: true,
|
|
368
|
+
get: function () { return custom.InteractionTriggerEvent; }
|
|
369
|
+
});
|
|
358
370
|
exports.ShopType = shop$1;
|
|
359
371
|
exports.AppAPIType = appAPI;
|
|
360
372
|
exports.OptionNormalStyle = globalStyle.OptionNormalStyle;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
exports.InteractionTargetEvent = void 0;
|
|
4
|
+
(function(InteractionTargetEvent) {
|
|
5
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:change-background-color'] = 0] = 'gp:change-background-color';
|
|
6
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:run-animation'] = 1] = 'gp:run-animation';
|
|
7
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:toggle-element-visibility'] = 2] = 'gp:toggle-element-visibility';
|
|
8
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:change-text'] = 3] = 'gp:change-text';
|
|
9
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:scroll-to'] = 4] = 'gp:scroll-to';
|
|
10
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:change-text-style'] = 5] = 'gp:change-text-style';
|
|
11
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:change-content'] = 6] = 'gp:change-content';
|
|
12
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:change-button-style'] = 7] = 'gp:change-button-style';
|
|
13
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:copy-text'] = 8] = 'gp:copy-text';
|
|
14
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:change-image'] = 9] = 'gp:change-image';
|
|
15
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:toggle-video-play'] = 10] = 'gp:toggle-video-play';
|
|
16
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:change-slider-ratio'] = 11] = 'gp:change-slider-ratio';
|
|
17
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:change-icon-style'] = 12] = 'gp:change-icon-style';
|
|
18
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:change-expanded-item'] = 13] = 'gp:change-expanded-item';
|
|
19
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:change-active-item'] = 14] = 'gp:change-active-item';
|
|
20
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:change-slide'] = 15] = 'gp:change-slide';
|
|
21
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:change-image-step'] = 16] = 'gp:change-image-step';
|
|
22
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:change-text-value'] = 17] = 'gp:change-text-value';
|
|
23
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:toggle-popup-open'] = 18] = 'gp:toggle-popup-open';
|
|
24
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:show-or-hide'] = 19] = 'gp:show-or-hide';
|
|
25
|
+
})(exports.InteractionTargetEvent || (exports.InteractionTargetEvent = {}));
|
|
26
|
+
exports.InteractionTriggerEvent = void 0;
|
|
27
|
+
(function(InteractionTriggerEvent) {
|
|
28
|
+
InteractionTriggerEvent[InteractionTriggerEvent['click'] = 0] = 'click';
|
|
29
|
+
InteractionTriggerEvent[InteractionTriggerEvent["active"] = 1] = "active";
|
|
30
|
+
InteractionTriggerEvent[InteractionTriggerEvent['mouseover'] = 2] = 'mouseover';
|
|
31
|
+
InteractionTriggerEvent[InteractionTriggerEvent['gp:appear'] = 3] = 'gp:appear';
|
|
32
|
+
InteractionTriggerEvent[InteractionTriggerEvent['gp:item-selected'] = 4] = 'gp:item-selected';
|
|
33
|
+
InteractionTriggerEvent[InteractionTriggerEvent['gp:item-unselected'] = 5] = 'gp:item-unselected';
|
|
34
|
+
InteractionTriggerEvent[InteractionTriggerEvent['gp:item-hovered'] = 6] = 'gp:item-hovered';
|
|
35
|
+
InteractionTriggerEvent[InteractionTriggerEvent['gp:item-click'] = 7] = 'gp:item-click';
|
|
36
|
+
InteractionTriggerEvent[InteractionTriggerEvent['gp:after-submit'] = 8] = 'gp:after-submit';
|
|
37
|
+
InteractionTriggerEvent[InteractionTriggerEvent['gp:quantity-change'] = 9] = 'gp:quantity-change';
|
|
38
|
+
InteractionTriggerEvent[InteractionTriggerEvent['gp:after-checked-value'] = 10] = 'gp:after-checked-value';
|
|
39
|
+
InteractionTriggerEvent[InteractionTriggerEvent['gp:after-add-to-cart'] = 11] = 'gp:after-add-to-cart';
|
|
40
|
+
InteractionTriggerEvent[InteractionTriggerEvent['gp:popup-open'] = 12] = 'gp:popup-open';
|
|
41
|
+
InteractionTriggerEvent[InteractionTriggerEvent['gp:popup-close'] = 13] = 'gp:popup-close';
|
|
42
|
+
InteractionTriggerEvent[InteractionTriggerEvent['scroll-up'] = 14] = 'scroll-up';
|
|
43
|
+
InteractionTriggerEvent[InteractionTriggerEvent['scroll-down'] = 15] = 'scroll-down';
|
|
44
|
+
})(exports.InteractionTriggerEvent || (exports.InteractionTriggerEvent = {}));
|
|
@@ -3,6 +3,7 @@ import { memo, useState, useMemo, useCallback, useEffect } from 'react';
|
|
|
3
3
|
import 'zustand';
|
|
4
4
|
import { useBuilderPreviewStore } from '../contexts/BuilderPreviewContext.js';
|
|
5
5
|
import { useShopStore } from '../contexts/ShopContext.js';
|
|
6
|
+
import { usePageStore } from '../contexts/PageContext.js';
|
|
6
7
|
import '@gem-sdk/adapter-shopify';
|
|
7
8
|
import 'swr';
|
|
8
9
|
import 'swr/mutation';
|
|
@@ -17,6 +18,7 @@ import { usePostPurchase } from '../hooks/useToolbarPostPurchase.js';
|
|
|
17
18
|
import { ableGenerateContentElements } from './constant.js';
|
|
18
19
|
import { AIContentGenerator } from './ai-generator/AIContentGenerator.js';
|
|
19
20
|
import { AIGenContentLoading } from './ai-generator/AIGenContentLoading.js';
|
|
21
|
+
import { InteractionSuffix } from './InteractionSuffix.js';
|
|
20
22
|
import '../helpers/convert.js';
|
|
21
23
|
|
|
22
24
|
const SECTION_LIMIT = 25;
|
|
@@ -33,6 +35,7 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
33
35
|
const isShopifySection = props.isShopifySection;
|
|
34
36
|
const storefrontUrl = useShopStore((s)=>s.storefrontUrl);
|
|
35
37
|
const editingPageType = useShopStore((s)=>s.pageType);
|
|
38
|
+
const interactionData = usePageStore((s)=>s.interactionData);
|
|
36
39
|
const getParents = useBuilderPreviewStore((s)=>s.getParents);
|
|
37
40
|
const root = useBuilderPreviewStore((s)=>s.getItem('ROOT'));
|
|
38
41
|
const isThemeSectionEditor = useBuilderPreviewStore((s)=>s.isThemeSectionEditor);
|
|
@@ -52,6 +55,9 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
52
55
|
const isSaleFunnelPage = useMemo(()=>editingPageType === 'POST_PURCHASE', [
|
|
53
56
|
editingPageType
|
|
54
57
|
]);
|
|
58
|
+
const isSelectOnPage = useMemo(()=>interactionData?.isSelectOnPage, [
|
|
59
|
+
interactionData
|
|
60
|
+
]);
|
|
55
61
|
const { checkDisableDelete, getTooltipText, checkDisableDuplicate } = usePostPurchase(props.uid, props.tag || '');
|
|
56
62
|
const editProductElementList = [
|
|
57
63
|
'Product Title',
|
|
@@ -494,109 +500,117 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
494
500
|
]
|
|
495
501
|
}, parent.uid);
|
|
496
502
|
}),
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
503
|
+
!isSelectOnPage && /*#__PURE__*/ jsxs(Fragment, {
|
|
504
|
+
children: [
|
|
505
|
+
props.tag === 'Section' && !props.isThemeSection && isEnableCreateThemeSection() && !props.isShopifySection && getIndexSection() < SECTION_LIMIT && /*#__PURE__*/ jsx(CreateThemeSection, {
|
|
506
|
+
...props
|
|
507
|
+
}),
|
|
508
|
+
isEnableAIContent() && /*#__PURE__*/ jsx(AIContentGenerator, {
|
|
509
|
+
...props
|
|
510
|
+
}),
|
|
511
|
+
props.tag == 'Sticky' && /*#__PURE__*/ jsx("div", {
|
|
512
|
+
"data-toolbar-zoom-out": true,
|
|
513
|
+
onClick: (e)=>onZoomOut(e),
|
|
514
|
+
"aria-hidden": "true",
|
|
515
|
+
children: /*#__PURE__*/ jsx("svg", {
|
|
516
|
+
width: "16",
|
|
517
|
+
height: "16",
|
|
518
|
+
viewBox: "0 0 16 16",
|
|
519
|
+
fill: "none",
|
|
520
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
521
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
522
|
+
fillRule: "evenodd",
|
|
523
|
+
clipRule: "evenodd",
|
|
524
|
+
d: "M14.5 7C14.7761 7 15 6.77614 15 6.5C15 6.22386 14.7761 6 14.5 6L10.7072 6L14.8536 1.85355C15.0489 1.65829 15.0489 1.34171 14.8536 1.14645C14.6584 0.951186 14.3418 0.951185 14.1465 1.14645L10 5.29297L10 1.5C10 1.22386 9.77614 1 9.5 1C9.22386 1 9 1.22386 9 1.5L9 6.5C9 6.77614 9.22386 7 9.5 7L14.5 7ZM6 10.7073L6 14.5C6 14.7761 6.22386 15 6.5 15C6.77614 15 7 14.7761 7 14.5L7 9.5C7 9.22386 6.77614 9 6.5 9H1.5C1.22386 9 1 9.22386 1 9.5C1 9.77614 1.22386 10 1.5 10H5.29306L1.14662 14.1464C0.951353 14.3417 0.951353 14.6583 1.14662 14.8536C1.34188 15.0488 1.65846 15.0488 1.85372 14.8536L6 10.7073Z",
|
|
525
|
+
fill: "currentColor"
|
|
526
|
+
})
|
|
527
|
+
})
|
|
528
|
+
}),
|
|
529
|
+
editAbleElementList.includes(toolbarName() ?? '') && /*#__PURE__*/ jsx(Tooltip, {
|
|
530
|
+
"data-toolbar-title": true,
|
|
531
|
+
enable: true,
|
|
532
|
+
"data-toolbar-disable": false,
|
|
533
|
+
text: "Edit content in Shopify",
|
|
534
|
+
position: "top",
|
|
535
|
+
onClick: goToShopifyEditLink,
|
|
536
|
+
"aria-hidden": "true",
|
|
537
|
+
children: /*#__PURE__*/ jsxs("svg", {
|
|
538
|
+
width: "16",
|
|
539
|
+
height: "16",
|
|
540
|
+
viewBox: "0 0 16 16",
|
|
541
|
+
fill: "none",
|
|
542
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
543
|
+
children: [
|
|
544
|
+
/*#__PURE__*/ jsx("path", {
|
|
545
|
+
fillRule: "evenodd",
|
|
546
|
+
clipRule: "evenodd",
|
|
547
|
+
d: "M8.61129 2.47348C8.61129 2.47348 8.47099 2.51557 8.23248 2.59274C8.19039 2.46647 8.13427 2.30512 8.05009 2.15079C7.78352 1.6387 7.39068 1.37212 6.91366 1.36511C6.87858 1.36511 6.85052 1.36511 6.81545 1.37212C6.80843 1.36511 6.80142 1.35634 6.7944 1.34757C6.78739 1.3388 6.78037 1.33003 6.77336 1.32302C6.56992 1.09854 6.30335 0.993314 5.98768 1.00033C5.37737 1.02137 4.76706 1.46332 4.269 2.249C3.91825 2.80319 3.65869 3.49767 3.58153 4.03082C3.38823 4.09074 3.21092 4.14586 3.05516 4.19429C2.64595 4.32151 2.3851 4.40261 2.37494 4.40261C2.01718 4.51485 2.01016 4.52888 1.96106 4.85859C1.92598 5.11113 1 12.2945 1 12.2945L7.14764 13.3583C7.18955 13.118 7.30454 12.8953 7.47848 12.7214L8.70249 11.4974V2.45945C8.66741 2.45945 8.63234 2.46647 8.61129 2.47348ZM6.82948 3.02767L6.62554 3.09101C6.27515 3.19989 5.90094 3.31617 5.5317 3.42752C5.65797 2.94349 5.89648 2.46647 6.19111 2.15079C6.30335 2.03154 6.45067 1.90527 6.63306 1.8281C6.80142 2.18587 6.83649 2.68393 6.82948 3.02767ZM5.99469 1.4072C6.13499 1.4072 6.26126 1.43526 6.36649 1.50541C6.19813 1.58959 6.0438 1.71586 5.88947 1.87721C5.50364 2.29109 5.202 2.94349 5.08274 3.56783C4.74459 3.66991 4.41804 3.77199 4.10838 3.8688L4.01646 3.89753C4.22691 2.90841 5.05468 1.43526 5.99469 1.4072ZM4.80214 7.0122C4.81874 7.26957 5.09737 7.44833 5.43473 7.66478C5.95252 7.99699 6.60867 8.41798 6.66813 9.3482C6.7453 10.5548 6.02977 11.3826 4.99154 11.4457C3.7569 11.5229 3.06943 10.7933 3.06943 10.7933L3.32899 9.67791C3.32899 9.67791 4.01646 10.197 4.56363 10.1619C4.92139 10.1409 5.04767 9.84627 5.04065 9.64283C5.01607 9.26796 4.73308 9.06671 4.41569 8.84101C4.00848 8.55142 3.54465 8.22157 3.49735 7.4331C3.42018 6.24756 4.19885 5.05501 5.91051 4.94277C6.57694 4.90068 6.91366 5.06904 6.91366 5.06904L6.52082 6.53518C6.52082 6.53518 6.08589 6.33876 5.56678 6.36682C4.80915 6.41592 4.79512 6.89294 4.80214 7.0122ZM7.23635 2.9014C7.22934 2.59274 7.19426 2.15781 7.04695 1.78601C7.50994 1.87721 7.74143 2.39632 7.83964 2.71199C7.70008 2.75665 7.54275 2.80575 7.37118 2.8593L7.23635 2.9014Z",
|
|
548
|
+
fill: "currentColor"
|
|
549
|
+
}),
|
|
550
|
+
/*#__PURE__*/ jsx("path", {
|
|
551
|
+
d: "M10.7719 3.44156C10.7757 3.47543 11.1733 6.16931 11.541 8.65883L8.95503 11.2448V2.57871C9.16548 2.78214 9.71265 3.31528 9.71265 3.31528C9.71265 3.31528 10.6106 3.32931 10.6597 3.33633C10.7088 3.34334 10.7649 3.37842 10.7719 3.44156Z",
|
|
552
|
+
fill: "currentColor"
|
|
553
|
+
}),
|
|
554
|
+
/*#__PURE__*/ jsx("path", {
|
|
555
|
+
d: "M14.8056 8.644L14.0424 7.88088C13.7832 7.62163 13.3629 7.62163 13.1036 7.88088L12.1519 8.83258L13.8539 10.5345L14.8056 9.58282C15.0648 9.32357 15.0648 8.90325 14.8056 8.644Z",
|
|
556
|
+
fill: "currentColor"
|
|
557
|
+
}),
|
|
558
|
+
/*#__PURE__*/ jsx("path", {
|
|
559
|
+
d: "M7.85018 13.0942L11.6419 9.30246L13.3438 11.0044L9.55212 14.7961C9.43782 14.9104 9.28573 14.9791 9.1244 14.9892L7.93427 15.0641C7.73484 15.0767 7.56961 14.9114 7.58216 14.712L7.65706 13.5219C7.66721 13.3606 7.73588 13.2085 7.85018 13.0942Z",
|
|
560
|
+
fill: "currentColor"
|
|
561
|
+
})
|
|
562
|
+
]
|
|
563
|
+
})
|
|
564
|
+
}),
|
|
565
|
+
/*#__PURE__*/ jsx(Tooltip, {
|
|
566
|
+
enable: props.tag == 'Section' && getSectionNumber() >= SECTION_LIMIT,
|
|
567
|
+
text: "Page has reached Shopify’s 25 section-limit",
|
|
568
|
+
position: "bottom",
|
|
569
|
+
"data-toolbar-duplicate": true,
|
|
570
|
+
"data-toolbar-disable": props.tag == 'Section' && getSectionNumber() >= SECTION_LIMIT || isDisableDuplicate,
|
|
571
|
+
onClick: isDisableDuplicate ? undefined : (e)=>onDuplicate(e),
|
|
572
|
+
"aria-hidden": "true",
|
|
573
|
+
className: isDisableDuplicate ? '!gp-cursor-not-allowed' : '',
|
|
574
|
+
children: /*#__PURE__*/ jsx("svg", {
|
|
575
|
+
width: "16",
|
|
576
|
+
height: "16",
|
|
577
|
+
viewBox: "0 0 16 16",
|
|
578
|
+
fill: "none",
|
|
579
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
580
|
+
fillRule: "evenodd",
|
|
581
|
+
clipRule: "evenodd",
|
|
582
|
+
d: "M6.08423 1.21289C5.53194 1.21289 5.08423 1.66061 5.08423 2.21289V3.78711H4.26172C3.43329 3.78711 2.76172 4.45868 2.76172 5.28711V13.2871C2.76172 14.1155 3.43329 14.7871 4.26172 14.7871H10.2617C11.0901 14.7871 11.7617 14.1155 11.7617 13.2871V12.4629H13.0842C13.6365 12.4629 14.0842 12.0152 14.0842 11.4629V2.21289C14.0842 1.66061 13.6365 1.21289 13.0842 1.21289H6.08423ZM10.7617 12.4629H6.08423C5.53194 12.4629 5.08423 12.0152 5.08423 11.4629V4.78711H4.26172C3.98558 4.78711 3.76172 5.01097 3.76172 5.28711V13.2871C3.76172 13.5633 3.98558 13.7871 4.26172 13.7871H10.2617C10.5379 13.7871 10.7617 13.5633 10.7617 13.2871V12.4629Z",
|
|
583
|
+
fill: "currentColor"
|
|
584
|
+
})
|
|
585
|
+
})
|
|
586
|
+
}),
|
|
587
|
+
/*#__PURE__*/ jsx(Tooltip, {
|
|
588
|
+
"data-toolbar-delete": true,
|
|
589
|
+
onClick: (e)=>isDisableDelete ? null : onDelete(e),
|
|
590
|
+
enable: isDisableDelete,
|
|
591
|
+
"data-toolbar-disable": isDisableDelete,
|
|
592
|
+
width: tooltipText.width,
|
|
593
|
+
text: tooltipText.text,
|
|
594
|
+
position: deleteTooltipPosition,
|
|
595
|
+
"aria-hidden": "true",
|
|
596
|
+
children: /*#__PURE__*/ jsx("svg", {
|
|
597
|
+
width: "16",
|
|
598
|
+
height: "16",
|
|
599
|
+
viewBox: "0 0 16 16",
|
|
600
|
+
fill: "none",
|
|
601
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
602
|
+
fillRule: "evenodd",
|
|
603
|
+
clipRule: "evenodd",
|
|
604
|
+
d: "M11 2.88965V2.38965C11 1.56122 10.3284 0.889648 9.5 0.889648H6.5C5.67157 0.889648 5 1.56122 5 2.38965V2.88965H2C1.72386 2.88965 1.5 3.11351 1.5 3.38965C1.5 3.66579 1.72386 3.88965 2 3.88965H3.21997V13.1099C3.21997 14.2144 4.1154 15.1099 5.21997 15.1099H11.22C12.3245 15.1099 13.22 14.2144 13.22 13.1099V3.88965H14C14.2761 3.88965 14.5 3.66579 14.5 3.38965C14.5 3.11351 14.2761 2.88965 14 2.88965H11ZM6 2.88965H10V2.38965C10 2.11351 9.77614 1.88965 9.5 1.88965H6.5C6.22386 1.88965 6 2.11351 6 2.38965V2.88965ZM6.24976 6.13965C6.66397 6.13965 6.99976 6.47543 6.99976 6.88965V11.3896C6.99976 11.8039 6.66397 12.1396 6.24976 12.1396C5.83554 12.1396 5.49976 11.8039 5.49976 11.3896V6.88965C5.49976 6.47543 5.83554 6.13965 6.24976 6.13965ZM10.4998 6.88965C10.4998 6.47543 10.164 6.13965 9.74976 6.13965C9.33554 6.13965 8.99976 6.47543 8.99976 6.88965V11.3896C8.99976 11.8039 9.33554 12.1396 9.74976 12.1396C10.164 12.1396 10.4998 11.8039 10.4998 11.3896V6.88965Z",
|
|
605
|
+
fill: "currentColor"
|
|
606
|
+
})
|
|
553
607
|
})
|
|
554
|
-
]
|
|
555
|
-
})
|
|
556
|
-
}),
|
|
557
|
-
/*#__PURE__*/ jsx(Tooltip, {
|
|
558
|
-
enable: props.tag == 'Section' && getSectionNumber() >= SECTION_LIMIT,
|
|
559
|
-
text: "Page has reached Shopify’s 25 section-limit",
|
|
560
|
-
position: "bottom",
|
|
561
|
-
"data-toolbar-duplicate": true,
|
|
562
|
-
"data-toolbar-disable": props.tag == 'Section' && getSectionNumber() >= SECTION_LIMIT || isDisableDuplicate,
|
|
563
|
-
onClick: isDisableDuplicate ? undefined : (e)=>onDuplicate(e),
|
|
564
|
-
"aria-hidden": "true",
|
|
565
|
-
className: isDisableDuplicate ? '!gp-cursor-not-allowed' : '',
|
|
566
|
-
children: /*#__PURE__*/ jsx("svg", {
|
|
567
|
-
width: "16",
|
|
568
|
-
height: "16",
|
|
569
|
-
viewBox: "0 0 16 16",
|
|
570
|
-
fill: "none",
|
|
571
|
-
children: /*#__PURE__*/ jsx("path", {
|
|
572
|
-
fillRule: "evenodd",
|
|
573
|
-
clipRule: "evenodd",
|
|
574
|
-
d: "M6.08423 1.21289C5.53194 1.21289 5.08423 1.66061 5.08423 2.21289V3.78711H4.26172C3.43329 3.78711 2.76172 4.45868 2.76172 5.28711V13.2871C2.76172 14.1155 3.43329 14.7871 4.26172 14.7871H10.2617C11.0901 14.7871 11.7617 14.1155 11.7617 13.2871V12.4629H13.0842C13.6365 12.4629 14.0842 12.0152 14.0842 11.4629V2.21289C14.0842 1.66061 13.6365 1.21289 13.0842 1.21289H6.08423ZM10.7617 12.4629H6.08423C5.53194 12.4629 5.08423 12.0152 5.08423 11.4629V4.78711H4.26172C3.98558 4.78711 3.76172 5.01097 3.76172 5.28711V13.2871C3.76172 13.5633 3.98558 13.7871 4.26172 13.7871H10.2617C10.5379 13.7871 10.7617 13.5633 10.7617 13.2871V12.4629Z",
|
|
575
|
-
fill: "currentColor"
|
|
576
608
|
})
|
|
577
|
-
|
|
609
|
+
]
|
|
578
610
|
}),
|
|
579
|
-
/*#__PURE__*/ jsx(
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
enable: isDisableDelete,
|
|
583
|
-
"data-toolbar-disable": isDisableDelete,
|
|
584
|
-
width: tooltipText.width,
|
|
585
|
-
text: tooltipText.text,
|
|
586
|
-
position: deleteTooltipPosition,
|
|
587
|
-
"aria-hidden": "true",
|
|
588
|
-
children: /*#__PURE__*/ jsx("svg", {
|
|
589
|
-
width: "16",
|
|
590
|
-
height: "16",
|
|
591
|
-
viewBox: "0 0 16 16",
|
|
592
|
-
fill: "none",
|
|
593
|
-
children: /*#__PURE__*/ jsx("path", {
|
|
594
|
-
fillRule: "evenodd",
|
|
595
|
-
clipRule: "evenodd",
|
|
596
|
-
d: "M11 2.88965V2.38965C11 1.56122 10.3284 0.889648 9.5 0.889648H6.5C5.67157 0.889648 5 1.56122 5 2.38965V2.88965H2C1.72386 2.88965 1.5 3.11351 1.5 3.38965C1.5 3.66579 1.72386 3.88965 2 3.88965H3.21997V13.1099C3.21997 14.2144 4.1154 15.1099 5.21997 15.1099H11.22C12.3245 15.1099 13.22 14.2144 13.22 13.1099V3.88965H14C14.2761 3.88965 14.5 3.66579 14.5 3.38965C14.5 3.11351 14.2761 2.88965 14 2.88965H11ZM6 2.88965H10V2.38965C10 2.11351 9.77614 1.88965 9.5 1.88965H6.5C6.22386 1.88965 6 2.11351 6 2.38965V2.88965ZM6.24976 6.13965C6.66397 6.13965 6.99976 6.47543 6.99976 6.88965V11.3896C6.99976 11.8039 6.66397 12.1396 6.24976 12.1396C5.83554 12.1396 5.49976 11.8039 5.49976 11.3896V6.88965C5.49976 6.47543 5.83554 6.13965 6.24976 6.13965ZM10.4998 6.88965C10.4998 6.47543 10.164 6.13965 9.74976 6.13965C9.33554 6.13965 8.99976 6.47543 8.99976 6.88965V11.3896C8.99976 11.8039 9.33554 12.1396 9.74976 12.1396C10.164 12.1396 10.4998 11.8039 10.4998 11.3896V6.88965Z",
|
|
597
|
-
fill: "currentColor"
|
|
598
|
-
})
|
|
599
|
-
})
|
|
611
|
+
/*#__PURE__*/ jsx(InteractionSuffix, {
|
|
612
|
+
tag: props.tag,
|
|
613
|
+
uid: props.uid
|
|
600
614
|
})
|
|
601
615
|
]
|
|
602
616
|
}, props.uid),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { memo, useEffect, isValidElement } from 'react';
|
|
3
3
|
import { composeAdvanceStyle } from '../helpers/compose-advance-style.js';
|
|
4
|
+
import { useInteraction } from '../hooks/useInteraction.js';
|
|
4
5
|
import { disableWrap, excludeApplyStyle } from './constant.js';
|
|
5
6
|
import RenderCustomCode from './RenderCustomCode.js';
|
|
6
7
|
import ComponentToolbarPreview from './ComponentToolbarPreview.js';
|
|
@@ -28,6 +29,19 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
|
|
|
28
29
|
}, [
|
|
29
30
|
props.uid
|
|
30
31
|
]);
|
|
32
|
+
const currentProps = props;
|
|
33
|
+
const { getAnimationByUid } = useInteraction();
|
|
34
|
+
const animationByInteraction = getAnimationByUid(props.uid);
|
|
35
|
+
if (animationByInteraction) {
|
|
36
|
+
currentProps.advanced = {
|
|
37
|
+
...currentProps.advanced,
|
|
38
|
+
animation: {
|
|
39
|
+
desktop: animationByInteraction,
|
|
40
|
+
tablet: animationByInteraction,
|
|
41
|
+
mobile: animationByInteraction
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
31
45
|
const pageType = usePageType();
|
|
32
46
|
if (props.type === 'section') {
|
|
33
47
|
return null;
|
|
@@ -132,7 +146,7 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
|
|
|
132
146
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
133
147
|
children: [
|
|
134
148
|
/*#__PURE__*/ jsx(ComponentAnimation, {
|
|
135
|
-
...
|
|
149
|
+
...currentProps
|
|
136
150
|
}),
|
|
137
151
|
/*#__PURE__*/ jsx(RenderCustomCode, {
|
|
138
152
|
uid: props.uid,
|
|
@@ -161,7 +175,7 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
|
|
|
161
175
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
162
176
|
children: [
|
|
163
177
|
/*#__PURE__*/ jsx(ComponentAnimation, {
|
|
164
|
-
...
|
|
178
|
+
...currentProps
|
|
165
179
|
}),
|
|
166
180
|
/*#__PURE__*/ jsx(RenderCustomCode, {
|
|
167
181
|
uid: props.uid,
|