@gem-sdk/core 1.48.0-dev.0 → 1.48.0-dev.102
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 +1 -0
- package/dist/cjs/components/InteractionSuffix.js +9 -1
- package/dist/cjs/components/Render.liquid.js +10 -11
- package/dist/cjs/graphql/fragments/product-little.generated.js +1 -0
- package/dist/cjs/graphql/fragments/published-theme-page.generated.js +8 -0
- package/dist/cjs/graphql-app-api/queries/ShopLibraryPage.generated.js +17 -0
- package/dist/cjs/helpers/animations.js +6 -6
- package/dist/cjs/helpers/background.js +1 -1
- package/dist/cjs/helpers/colors.js +2 -2
- package/dist/cjs/helpers/compose-advance-style.js +6 -3
- package/dist/cjs/helpers/interaction/index.js +66 -0
- package/dist/cjs/helpers/queries/get-product.js +1 -1
- package/dist/cjs/helpers/render.js +2 -0
- package/dist/cjs/helpers/shadow.js +15 -3
- package/dist/cjs/helpers/third-party/addAppBlockId.js +1 -1
- package/dist/cjs/helpers/third-party/appConfig.js +77 -0
- package/dist/cjs/helpers/third-party/appSetting.js +115 -0
- package/dist/cjs/helpers/third-party/constant.js +12 -1
- package/dist/cjs/helpers/typography.js +19 -15
- package/dist/cjs/index.js +6 -0
- package/dist/cjs/types/animations.js +2 -0
- package/dist/cjs/types/custom.js +1 -0
- package/dist/esm/components/ComponentToolbarPreview.js +1 -0
- package/dist/esm/components/InteractionSuffix.js +10 -2
- package/dist/esm/components/Render.liquid.js +10 -11
- package/dist/esm/graphql/fragments/product-little.generated.js +1 -0
- package/dist/esm/graphql/fragments/published-theme-page.generated.js +8 -0
- package/dist/esm/graphql-app-api/queries/ShopLibraryPage.generated.js +15 -0
- package/dist/esm/helpers/animations.js +6 -6
- package/dist/esm/helpers/background.js +1 -1
- package/dist/esm/helpers/colors.js +2 -2
- package/dist/esm/helpers/compose-advance-style.js +7 -4
- package/dist/esm/helpers/interaction/index.js +64 -0
- package/dist/esm/helpers/queries/get-product.js +1 -1
- package/dist/esm/helpers/render.js +2 -0
- package/dist/esm/helpers/shadow.js +15 -4
- package/dist/esm/helpers/third-party/addAppBlockId.js +1 -1
- package/dist/esm/helpers/third-party/appConfig.js +67 -1
- package/dist/esm/helpers/third-party/appSetting.js +115 -0
- package/dist/esm/helpers/third-party/constant.js +13 -2
- package/dist/esm/helpers/typography.js +19 -16
- package/dist/esm/index.js +4 -2
- package/dist/esm/types/animations.js +2 -0
- package/dist/esm/types/custom.js +1 -0
- package/dist/types/index.d.ts +4922 -893
- package/package.json +3 -3
|
@@ -28,7 +28,8 @@ const composeTypographyV2Css = (typography, isImportant)=>{
|
|
|
28
28
|
const composeImportant = isImportant ? '!important' : '';
|
|
29
29
|
return `
|
|
30
30
|
${fontFamily ? `font-family: ${composeFontFamilyTypographyV2({
|
|
31
|
-
fontFamily
|
|
31
|
+
fontFamily,
|
|
32
|
+
type: typography?.type
|
|
32
33
|
})} ${composeImportant}` : ''};
|
|
33
34
|
${fontSize?.desktop ? `font-size: ${fontSize?.desktop} ${composeImportant}` : ''};
|
|
34
35
|
${bold ? `font-weight: bold ${composeImportant}` : fontWeight ? `font-weight: ${fontWeight} ${composeImportant}` : ''};
|
|
@@ -76,8 +77,10 @@ const composeTypographyV2 = (value, attrs)=>{
|
|
|
76
77
|
});
|
|
77
78
|
};
|
|
78
79
|
const composeFontFamilyTypographyV2 = (value)=>{
|
|
79
|
-
const fontFamily = value
|
|
80
|
-
if (!fontFamily)
|
|
80
|
+
const { fontFamily, isCustom, fallbackFontFamily, type } = value || {};
|
|
81
|
+
if (!fontFamily) {
|
|
82
|
+
return isCustom ? fallbackFontFamily : undefined;
|
|
83
|
+
}
|
|
81
84
|
if (typeof fontFamily === 'string') {
|
|
82
85
|
return getFontUsedByTypographyV2({
|
|
83
86
|
fontFamily,
|
|
@@ -91,7 +94,7 @@ const composeFontFamilyTypographyV2 = (value)=>{
|
|
|
91
94
|
default:
|
|
92
95
|
return getFontUsedByTypographyV2({
|
|
93
96
|
fontFamily: fontFamily.value,
|
|
94
|
-
fallbackFontFamily:
|
|
97
|
+
fallbackFontFamily: composeFallbackTypographyStyle(type ?? 'heading')
|
|
95
98
|
});
|
|
96
99
|
}
|
|
97
100
|
}
|
|
@@ -116,18 +119,10 @@ const composeTypographyAttr = (attrs)=>{
|
|
|
116
119
|
});
|
|
117
120
|
};
|
|
118
121
|
const composeTypographyClassName = (typo, typography)=>{
|
|
119
|
-
return typo ? typo?.type && !typo.custom ? genTypoClass(typo.type) : '' : typography?.type && genTypoClass(typography?.type);
|
|
122
|
+
return typo ? typo?.type && !isCustomTypo(typo.custom) ? genTypoClass(typo.type) : '' : typography?.type && genTypoClass(typography?.type);
|
|
120
123
|
};
|
|
121
124
|
const composeFallbackTypographyStyle = (tag)=>{
|
|
122
|
-
if (
|
|
123
|
-
'heading',
|
|
124
|
-
'heading-1',
|
|
125
|
-
'heading-2',
|
|
126
|
-
'heading-3',
|
|
127
|
-
'heading-4',
|
|
128
|
-
'heading-5',
|
|
129
|
-
'heading-6'
|
|
130
|
-
].includes(tag)) {
|
|
125
|
+
if (tag.toLocaleLowerCase().includes('heading')) {
|
|
131
126
|
return 'var(--g-font-heading, heading)';
|
|
132
127
|
}
|
|
133
128
|
return 'var(--g-font-body, body)';
|
|
@@ -137,7 +132,8 @@ const composeTypographyStyle = (typo, typography, disableAttr)=>{
|
|
|
137
132
|
const fallbackFontFamily = composeFallbackTypographyStyle(typo.type ?? 'heading');
|
|
138
133
|
const customTypo = {
|
|
139
134
|
...typo.custom,
|
|
140
|
-
fallbackFontFamily: fallbackFontFamily
|
|
135
|
+
fallbackFontFamily: fallbackFontFamily,
|
|
136
|
+
isCustom: isCustomTypo(typo.custom)
|
|
141
137
|
};
|
|
142
138
|
return {
|
|
143
139
|
...composeTypographyV2(customTypo, typo.attrs),
|
|
@@ -148,6 +144,13 @@ const composeTypographyStyle = (typo, typography, disableAttr)=>{
|
|
|
148
144
|
...!typography?.type ? composeTypography(typography?.custom) : {}
|
|
149
145
|
};
|
|
150
146
|
};
|
|
147
|
+
const isCustomTypo = (customTypo)=>{
|
|
148
|
+
return customTypo && Object.keys(customTypo).length > 1 || customTypo && Object.keys(customTypo).length === 1 && !customTypo.fontSize;
|
|
149
|
+
};
|
|
150
|
+
const getSeoTagFromTypo = (typo)=>{
|
|
151
|
+
if (!typo?.attrs?.seoTagValue) return 'div';
|
|
152
|
+
return typo?.attrs?.seoTagValue;
|
|
153
|
+
};
|
|
151
154
|
|
|
152
155
|
exports.composeFallbackTypographyStyle = composeFallbackTypographyStyle;
|
|
153
156
|
exports.composeFontFamilyTypographyV2 = composeFontFamilyTypographyV2;
|
|
@@ -159,3 +162,4 @@ exports.composeTypographyStyle = composeTypographyStyle;
|
|
|
159
162
|
exports.composeTypographyV2 = composeTypographyV2;
|
|
160
163
|
exports.composeTypographyV2Css = composeTypographyV2Css;
|
|
161
164
|
exports.genTypoClass = genTypoClass;
|
|
165
|
+
exports.getSeoTagFromTypo = getSeoTagFromTypo;
|
package/dist/cjs/index.js
CHANGED
|
@@ -30,6 +30,7 @@ var LibraryTemplate_generated = require('./graphql-app-api/queries/LibraryTempla
|
|
|
30
30
|
var ThemePage_generated = require('./graphql-app-api/queries/ThemePage.generated.js');
|
|
31
31
|
var SaleFunnelDiscounts_generated = require('./graphql-app-api/queries/SaleFunnelDiscounts.generated.js');
|
|
32
32
|
var LibrarySaleFunnelDiscount_generated = require('./graphql-app-api/queries/LibrarySaleFunnelDiscount.generated.js');
|
|
33
|
+
var ShopLibraryPage_generated = require('./graphql-app-api/queries/ShopLibraryPage.generated.js');
|
|
33
34
|
var borders = require('./helpers/borders.js');
|
|
34
35
|
var carousel = require('./helpers/carousel.js');
|
|
35
36
|
var cls = require('./helpers/cls.js');
|
|
@@ -108,6 +109,7 @@ var getProduct = require('./helpers/queries/get-product.js');
|
|
|
108
109
|
var getProductBySlug = require('./helpers/queries/get-product-by-slug.js');
|
|
109
110
|
var getAppBlocks = require('./helpers/third-party/getAppBlocks.js');
|
|
110
111
|
var addAppBlockId = require('./helpers/third-party/addAppBlockId.js');
|
|
112
|
+
var index = require('./helpers/interaction/index.js');
|
|
111
113
|
|
|
112
114
|
|
|
113
115
|
|
|
@@ -159,6 +161,7 @@ exports.LibraryTemplateDocument = LibraryTemplate_generated.LibraryTemplateDocum
|
|
|
159
161
|
exports.ThemePageDocument = ThemePage_generated.ThemePageDocument;
|
|
160
162
|
exports.SaleFunnelDiscountsDocument = SaleFunnelDiscounts_generated.SaleFunnelDiscountsDocument;
|
|
161
163
|
exports.LibrarySaleFunnelDocument = LibrarySaleFunnelDiscount_generated.LibrarySaleFunnelDocument;
|
|
164
|
+
exports.ShopLibraryPageDocument = ShopLibraryPage_generated.ShopLibraryPageDocument;
|
|
162
165
|
exports.composeBorderCss = borders.composeBorderCss;
|
|
163
166
|
exports.getBorderRadiusStyle = borders.getBorderRadiusStyle;
|
|
164
167
|
exports.getBorderStyle = borders.getBorderStyle;
|
|
@@ -267,6 +270,7 @@ exports.removeUndefinedValuesFromObject = render.removeUndefinedValuesFromObject
|
|
|
267
270
|
exports.styles = render.styles;
|
|
268
271
|
exports.template = render.template;
|
|
269
272
|
exports.composeShadowCss = shadow.composeShadowCss;
|
|
273
|
+
exports.getResonsiveStyleShadow = shadow.getResonsiveStyleShadow;
|
|
270
274
|
exports.getStyleShadow = shadow.getStyleShadow;
|
|
271
275
|
exports.getStyleShadowState = shadow.getStyleShadowState;
|
|
272
276
|
exports.parseValueWithUnit = shadow.parseValueWithUnit;
|
|
@@ -293,6 +297,7 @@ exports.composeTypographyStyle = typography.composeTypographyStyle;
|
|
|
293
297
|
exports.composeTypographyV2 = typography.composeTypographyV2;
|
|
294
298
|
exports.composeTypographyV2Css = typography.composeTypographyV2Css;
|
|
295
299
|
exports.genTypoClass = typography.genTypoClass;
|
|
300
|
+
exports.getSeoTagFromTypo = typography.getSeoTagFromTypo;
|
|
296
301
|
exports.useAddToCart = useAddToCart.useAddToCart;
|
|
297
302
|
exports.useCartData = useCartData.useCartData;
|
|
298
303
|
exports.useCartDiscountCodesUpdate = useCartDiscountCodesUpdate.useCartDiscountCodesUpdate;
|
|
@@ -403,3 +408,4 @@ exports.getProduct = getProduct.getProduct;
|
|
|
403
408
|
exports.getProductBySlug = getProductBySlug.getProductBySlug;
|
|
404
409
|
exports.getAppBlocks = getAppBlocks.getAppBlocks;
|
|
405
410
|
exports.addAppBlockId = addAppBlockId.addAppBlockId;
|
|
411
|
+
exports.useInteraction = index.useInteraction;
|
|
@@ -32,6 +32,8 @@ exports.AnimationTriggerType = void 0;
|
|
|
32
32
|
(function(AnimationTriggerType) {
|
|
33
33
|
AnimationTriggerType["Appear"] = 'appear';
|
|
34
34
|
AnimationTriggerType["Hover"] = 'hover';
|
|
35
|
+
AnimationTriggerType["Hidden"] = 'hidden';
|
|
36
|
+
AnimationTriggerType["AppearByTrigger"] = 'appearByTrigger';
|
|
35
37
|
})(exports.AnimationTriggerType || (exports.AnimationTriggerType = {}));
|
|
36
38
|
exports.AnimationZoomDirectionType = void 0;
|
|
37
39
|
(function(AnimationZoomDirectionType) {
|
package/dist/cjs/types/custom.js
CHANGED
|
@@ -22,6 +22,7 @@ exports.InteractionTargetEvent = void 0;
|
|
|
22
22
|
InteractionTargetEvent[InteractionTargetEvent['gp:change-text-value'] = 17] = 'gp:change-text-value';
|
|
23
23
|
InteractionTargetEvent[InteractionTargetEvent['gp:toggle-popup-open'] = 18] = 'gp:toggle-popup-open';
|
|
24
24
|
InteractionTargetEvent[InteractionTargetEvent['gp:show-or-hide'] = 19] = 'gp:show-or-hide';
|
|
25
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:change-banner'] = 20] = 'gp:change-banner';
|
|
25
26
|
})(exports.InteractionTargetEvent || (exports.InteractionTargetEvent = {}));
|
|
26
27
|
exports.InteractionTriggerEvent = void 0;
|
|
27
28
|
(function(InteractionTriggerEvent) {
|
|
@@ -450,6 +450,7 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
450
450
|
}
|
|
451
451
|
return /*#__PURE__*/ jsxs("div", {
|
|
452
452
|
"data-toolbar-parent": true,
|
|
453
|
+
"data-component-tag": parent.tag,
|
|
453
454
|
"data-parent-uid": parent.uid,
|
|
454
455
|
"data-toolbar-theme-section": isThemeSectionEditor,
|
|
455
456
|
"data-toolbar-parent-revert": isShowParentRevert,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
import 'zustand';
|
|
4
4
|
import 'swr';
|
|
@@ -12,10 +12,13 @@ import 'react-transition-group';
|
|
|
12
12
|
import '@gem-sdk/core';
|
|
13
13
|
import 'classnames';
|
|
14
14
|
import 'dayjs';
|
|
15
|
+
import { useInteraction } from '../helpers/interaction/index.js';
|
|
15
16
|
import '../helpers/convert.js';
|
|
16
17
|
|
|
17
18
|
const InteractionSuffix = ({ tag, uid })=>{
|
|
19
|
+
const { closeSelectOnPage } = useInteraction();
|
|
18
20
|
const currentInteraction = usePageStore((s)=>s.interactionData?.item);
|
|
21
|
+
const isSelectOnPage = usePageStore((s)=>s.interactionData?.isSelectOnPage);
|
|
19
22
|
const isCurrentInteractionTarget = useMemo(()=>{
|
|
20
23
|
return currentInteraction?.targets?.find((t)=>t.uid === uid);
|
|
21
24
|
}, [
|
|
@@ -44,10 +47,15 @@ const InteractionSuffix = ({ tag, uid })=>{
|
|
|
44
47
|
isCurrentInteractionTarget
|
|
45
48
|
]);
|
|
46
49
|
if (!isDisplay) {
|
|
47
|
-
return
|
|
50
|
+
return /*#__PURE__*/ jsx(Fragment, {});
|
|
48
51
|
}
|
|
49
52
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
50
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
|
+
}),
|
|
51
59
|
/*#__PURE__*/ jsx("div", {
|
|
52
60
|
className: "hidden gp-left-[-40px] gp-left-[-80px] gp-right-[-40px] gp-right-[-80px]"
|
|
53
61
|
}),
|
|
@@ -72,8 +72,7 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
72
72
|
pageContext,
|
|
73
73
|
...passProps,
|
|
74
74
|
builderAttrs: {
|
|
75
|
-
...passProps.builderAttrs
|
|
76
|
-
'data-id': uid
|
|
75
|
+
...passProps.builderAttrs
|
|
77
76
|
},
|
|
78
77
|
rawChildren: item.childrens.map((id)=>{
|
|
79
78
|
return {
|
|
@@ -112,8 +111,7 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
112
111
|
pageContext,
|
|
113
112
|
...passProps,
|
|
114
113
|
builderAttrs: {
|
|
115
|
-
...passProps.builderAttrs
|
|
116
|
-
'data-id': uid
|
|
114
|
+
...passProps.builderAttrs
|
|
117
115
|
}
|
|
118
116
|
});
|
|
119
117
|
});
|
|
@@ -134,8 +132,7 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
134
132
|
pageContext,
|
|
135
133
|
...passProps,
|
|
136
134
|
builderAttrs: {
|
|
137
|
-
...passProps.builderAttrs
|
|
138
|
-
'data-id': uid
|
|
135
|
+
...passProps.builderAttrs
|
|
139
136
|
},
|
|
140
137
|
rawChildren: item.childrens.map((id)=>{
|
|
141
138
|
return {
|
|
@@ -175,8 +172,7 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
175
172
|
style: componentIconList.includes(item.tag) ? style : null,
|
|
176
173
|
...passProps,
|
|
177
174
|
builderAttrs: {
|
|
178
|
-
...passProps.builderAttrs
|
|
179
|
-
'data-id': uid
|
|
175
|
+
...passProps.builderAttrs
|
|
180
176
|
}
|
|
181
177
|
});
|
|
182
178
|
})}
|
|
@@ -215,7 +211,7 @@ const RenderCustomCode = (item)=>{
|
|
|
215
211
|
};
|
|
216
212
|
const appendAnimation = (props, liquid)=>{
|
|
217
213
|
const { advanced, tag } = props;
|
|
218
|
-
const { animation, op: opacity } = advanced ?? {};
|
|
214
|
+
const { animation, op: opacity, hasAnimationInteraction, displayInitInteraction = true } = advanced ?? {};
|
|
219
215
|
const getAnimationType = (settings, type)=>{
|
|
220
216
|
return settings?.triggerConfig?.[type]?.animation ?? 'none';
|
|
221
217
|
};
|
|
@@ -229,7 +225,9 @@ const appendAnimation = (props, liquid)=>{
|
|
|
229
225
|
const hoverDesktop = getAnimationType(getSettingsByDevice('desktop'), 'hover');
|
|
230
226
|
const appearTablet = getAnimationType(getSettingsByDevice('tablet'), 'appear');
|
|
231
227
|
const appearMobile = getAnimationType(getSettingsByDevice('mobile'), 'appear');
|
|
232
|
-
const enableAnimation = animation?.desktop?.enabled && (appearDesktop !== 'none' || hoverDesktop !== 'none') || animation?.tablet?.enabled && appearTablet !== 'none' || animation?.mobile?.enabled && appearMobile !== 'none';
|
|
228
|
+
const enableAnimation = animation?.desktop?.enabled && (appearDesktop !== 'none' || hoverDesktop !== 'none') || animation?.tablet?.enabled && appearTablet !== 'none' || animation?.mobile?.enabled && appearMobile !== 'none' || !!hasAnimationInteraction;
|
|
229
|
+
const enableAnimationWhenInit = animation?.desktop?.enabled && (appearDesktop !== 'none' || hoverDesktop !== 'none') || animation?.tablet?.enabled && appearTablet !== 'none' || animation?.mobile?.enabled && appearMobile !== 'none';
|
|
230
|
+
if (!enableAnimation) return liquid;
|
|
233
231
|
const getInitVisibility = (device)=>getSettingsByDevice(device)?.enabled && ![
|
|
234
232
|
'shake',
|
|
235
233
|
'none'
|
|
@@ -241,11 +239,12 @@ const appendAnimation = (props, liquid)=>{
|
|
|
241
239
|
};
|
|
242
240
|
return template`
|
|
243
241
|
<gp-animation
|
|
242
|
+
display-init="${!displayInitInteraction ? 'hide' : 'show'}"
|
|
244
243
|
gp-data='${JSON.stringify({
|
|
245
244
|
config: animation,
|
|
246
245
|
tag,
|
|
247
246
|
opacity,
|
|
248
|
-
|
|
247
|
+
notEnableAnimationWhenInit: !enableAnimationWhenInit
|
|
249
248
|
})}'
|
|
250
249
|
style="${{
|
|
251
250
|
display: 'contents'
|
|
@@ -26,6 +26,10 @@
|
|
|
26
26
|
themePageCustomFonts {
|
|
27
27
|
...CustomFontSelect
|
|
28
28
|
}
|
|
29
|
+
interaction {
|
|
30
|
+
id
|
|
31
|
+
value
|
|
32
|
+
}
|
|
29
33
|
}
|
|
30
34
|
`;
|
|
31
35
|
const PreviewThemePageSelect = `
|
|
@@ -53,6 +57,10 @@ const PreviewThemePageSelect = `
|
|
|
53
57
|
themePageCustomCode {
|
|
54
58
|
...CustomCodeSelect
|
|
55
59
|
}
|
|
60
|
+
interaction {
|
|
61
|
+
id
|
|
62
|
+
value
|
|
63
|
+
}
|
|
56
64
|
}
|
|
57
65
|
`;
|
|
58
66
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/* eslint-disable */ const ShopLibraryPageDocument = `
|
|
2
|
+
query ShopLibraryPage($shopLibraryPageId: ID!) {
|
|
3
|
+
shopLibraryPage(id: $shopLibraryPageId) {
|
|
4
|
+
id
|
|
5
|
+
name
|
|
6
|
+
sectionPosition
|
|
7
|
+
shopLibrarySections {
|
|
8
|
+
id
|
|
9
|
+
component
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
export { ShopLibraryPageDocument };
|
|
@@ -44,7 +44,7 @@ const animations = ()=>{
|
|
|
44
44
|
});
|
|
45
45
|
return cloneOptions;
|
|
46
46
|
};
|
|
47
|
-
const slide = (target, options)=>{
|
|
47
|
+
const slide = (target, options, reverse)=>{
|
|
48
48
|
const normalizedOptions = normalizeOptions(options);
|
|
49
49
|
const { direction, distance } = normalizedOptions;
|
|
50
50
|
const coordinate = [
|
|
@@ -65,11 +65,11 @@ const animations = ()=>{
|
|
|
65
65
|
transform: `translate${coordinate}(0)`
|
|
66
66
|
}
|
|
67
67
|
];
|
|
68
|
-
return generateAnimationInstance(target, preset, {
|
|
68
|
+
return generateAnimationInstance(target, reverse ? preset.reverse() : preset, {
|
|
69
69
|
...generateOptions(normalizedOptions, 500)
|
|
70
70
|
});
|
|
71
71
|
};
|
|
72
|
-
const fade = (target, options)=>{
|
|
72
|
+
const fade = (target, options, reverse)=>{
|
|
73
73
|
const normalizedOptions = normalizeOptions(options);
|
|
74
74
|
const preset = [
|
|
75
75
|
{
|
|
@@ -79,7 +79,7 @@ const animations = ()=>{
|
|
|
79
79
|
opacity: 1
|
|
80
80
|
}
|
|
81
81
|
];
|
|
82
|
-
return generateAnimationInstance(target, preset, {
|
|
82
|
+
return generateAnimationInstance(target, reverse ? preset.reverse() : preset, {
|
|
83
83
|
...generateOptions(normalizedOptions, 500)
|
|
84
84
|
});
|
|
85
85
|
};
|
|
@@ -99,7 +99,7 @@ const animations = ()=>{
|
|
|
99
99
|
easing: EASING[easing ?? 'linear']
|
|
100
100
|
};
|
|
101
101
|
};
|
|
102
|
-
const zoom = (target, options)=>{
|
|
102
|
+
const zoom = (target, options, reverse)=>{
|
|
103
103
|
const normalizedOptions = normalizeOptions(options);
|
|
104
104
|
const { scale, zoomDirection, isFade } = normalizedOptions;
|
|
105
105
|
const [i1, i2] = scale.in;
|
|
@@ -125,7 +125,7 @@ const animations = ()=>{
|
|
|
125
125
|
}
|
|
126
126
|
];
|
|
127
127
|
const zoomPreset = zoomDirection === 'in' ? zoomInPreset : zoomOutPreset;
|
|
128
|
-
return generateAnimationInstance(target, zoomPreset, {
|
|
128
|
+
return generateAnimationInstance(target, reverse ? zoomPreset.reverse() : zoomPreset, {
|
|
129
129
|
...generateOptions(normalizedOptions, 700)
|
|
130
130
|
});
|
|
131
131
|
};
|
|
@@ -119,7 +119,7 @@ const getBgAttachmentByDevice = (background, device)=>{
|
|
|
119
119
|
return background?.[device]?.attachment;
|
|
120
120
|
};
|
|
121
121
|
const composeBackgroundCss = (backgroundColor)=>{
|
|
122
|
-
return `${backgroundColor ? `background-color: ${getSingleColorVariable(backgroundColor)}
|
|
122
|
+
return `${backgroundColor ? `background-color: ${getSingleColorVariable(backgroundColor)};` : undefined}`;
|
|
123
123
|
};
|
|
124
124
|
const makeFixedBgAttachment = (background)=>{
|
|
125
125
|
if (!background) return;
|
|
@@ -112,9 +112,9 @@ const getGlobalColorResponsiveStyle = (type, data)=>{
|
|
|
112
112
|
}
|
|
113
113
|
}));
|
|
114
114
|
};
|
|
115
|
-
const getGlobalColorStateStyle = (type, data)=>{
|
|
115
|
+
const getGlobalColorStateStyle = (type, data, states)=>{
|
|
116
116
|
if (!data) return {};
|
|
117
|
-
return Object.fromEntries(Object.entries(data).map(([state, value])=>{
|
|
117
|
+
return Object.fromEntries(Object.entries(data).filter(([state])=>states?.length ? states?.includes(state) : true).map(([state, value])=>{
|
|
118
118
|
if (state === 'active') return [];
|
|
119
119
|
return [
|
|
120
120
|
`-${stateMapping?.[state] || ''}-${type}`,
|
|
@@ -3,7 +3,7 @@ import { isColor } from './colors.js';
|
|
|
3
3
|
import { layoutComponent } from './constant.js';
|
|
4
4
|
import { makeStyleKey } from './make-style.js';
|
|
5
5
|
import { composeRadius, getCornerCSSFromGlobal } from './radius.js';
|
|
6
|
-
import { getStyleShadowState, getStyleShadow } from './shadow.js';
|
|
6
|
+
import { getResonsiveStyleShadow, getStyleShadowState, getStyleShadow } from './shadow.js';
|
|
7
7
|
|
|
8
8
|
const composeSpacing = ({ source, spacing, type, suffix = '' })=>{
|
|
9
9
|
const { top, left, bottom, right } = spacing;
|
|
@@ -99,6 +99,9 @@ function composeAdvanceStyle(data, tag, pageType) {
|
|
|
99
99
|
if (attr === 'rounded') {
|
|
100
100
|
Object.assign(styles, composeRadius(value));
|
|
101
101
|
}
|
|
102
|
+
if (attr === 'boxShadow') {
|
|
103
|
+
Object.assign(styles, getResonsiveStyleShadow(value, 'box-shadow', hasBoxShadow));
|
|
104
|
+
}
|
|
102
105
|
if (composeAttr === 'desktop') {
|
|
103
106
|
switch(attr){
|
|
104
107
|
case 'padding':
|
|
@@ -213,20 +216,20 @@ function composeAdvanceStyle(data, tag, pageType) {
|
|
|
213
216
|
}));
|
|
214
217
|
}
|
|
215
218
|
}
|
|
216
|
-
if (attr === 'blockPadding' && pageType ===
|
|
219
|
+
if (attr === 'blockPadding' && pageType === 'POST_PURCHASE') {
|
|
217
220
|
const valueMapped = postPurchasePaddingMapping[value];
|
|
218
221
|
styles[`--pb`] = getAttrValue(attr, valueMapped, tag);
|
|
219
222
|
styles[`--pt`] = getAttrValue(attr, valueMapped, tag);
|
|
220
223
|
styles[`--mb`] = '0px';
|
|
221
224
|
styles[`--mt`] = '0px';
|
|
222
225
|
}
|
|
223
|
-
if (attr === 'inlinePadding' && pageType ===
|
|
226
|
+
if (attr === 'inlinePadding' && pageType === 'POST_PURCHASE') {
|
|
224
227
|
const valueMapped = postPurchasePaddingMapping[value];
|
|
225
228
|
styles[`--pl`] = getAttrValue(attr, valueMapped, tag);
|
|
226
229
|
styles[`--pr`] = getAttrValue(attr, valueMapped, tag);
|
|
227
230
|
}
|
|
228
231
|
});
|
|
229
|
-
const advancedPostPurchaseStyles = pageType ===
|
|
232
|
+
const advancedPostPurchaseStyles = pageType === 'POST_PURCHASE' ? composeAdvanceStyleForPostPurchase(data, tag) : {};
|
|
230
233
|
return {
|
|
231
234
|
...styles,
|
|
232
235
|
...advancedPostPurchaseStyles
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import 'react/jsx-runtime';
|
|
2
|
+
import 'zustand';
|
|
3
|
+
import 'react';
|
|
4
|
+
import 'swr';
|
|
5
|
+
import { usePageStore } from '../../contexts/PageContext.js';
|
|
6
|
+
import '@gem-sdk/adapter-shopify';
|
|
7
|
+
import 'swr/mutation';
|
|
8
|
+
import 'swr/infinite';
|
|
9
|
+
import 'vanilla-lazyload';
|
|
10
|
+
import '../../hooks/useCartUI.js';
|
|
11
|
+
import 'react-transition-group';
|
|
12
|
+
import '@gem-sdk/core';
|
|
13
|
+
import 'classnames';
|
|
14
|
+
import 'dayjs';
|
|
15
|
+
import '../convert.js';
|
|
16
|
+
|
|
17
|
+
const useInteraction = ()=>{
|
|
18
|
+
const setInteractionIsSelectOnPage = usePageStore((s)=>s.setInteractionIsSelectOnPage);
|
|
19
|
+
const onListener = ({ event, selector }, callback)=>{
|
|
20
|
+
const element = document.querySelector(selector);
|
|
21
|
+
if (!element) return;
|
|
22
|
+
element.addEventListener(event, (e)=>{
|
|
23
|
+
const event = e;
|
|
24
|
+
const params = event.detail;
|
|
25
|
+
if (callback) callback(params);
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
const trigger = ({ event, data, selector })=>{
|
|
29
|
+
const element = document.querySelector(selector);
|
|
30
|
+
if (!element) return;
|
|
31
|
+
const eventDispatch = new CustomEvent(event, {
|
|
32
|
+
bubbles: false,
|
|
33
|
+
cancelable: true,
|
|
34
|
+
detail: {
|
|
35
|
+
data
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
element.dispatchEvent(eventDispatch);
|
|
39
|
+
};
|
|
40
|
+
const saveToElementInteractionData = (element, key, value)=>{
|
|
41
|
+
const interactionData = element.getAttribute('gp-data-interaction');
|
|
42
|
+
const interactionDataJson = JSON.parse(interactionData || '{}');
|
|
43
|
+
element.setAttribute('gp-data-interaction', JSON.stringify({
|
|
44
|
+
...interactionDataJson,
|
|
45
|
+
[key]: value
|
|
46
|
+
}));
|
|
47
|
+
};
|
|
48
|
+
const closeSelectOnPage = ()=>{
|
|
49
|
+
setInteractionIsSelectOnPage(false);
|
|
50
|
+
const event = new CustomEvent('editor:interaction:change-select-on-page', {
|
|
51
|
+
bubbles: true,
|
|
52
|
+
detail: false
|
|
53
|
+
});
|
|
54
|
+
window.dispatchEvent(event);
|
|
55
|
+
};
|
|
56
|
+
return {
|
|
57
|
+
onListener,
|
|
58
|
+
trigger,
|
|
59
|
+
saveToElementInteractionData,
|
|
60
|
+
closeSelectOnPage
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export { useInteraction };
|
|
@@ -34,7 +34,7 @@ const getProduct = async (fetcher, { id, isSample, isStorefront })=>{
|
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
36
|
const orderBy = {
|
|
37
|
-
field: '
|
|
37
|
+
field: 'PLATFORM_CREATED_AT',
|
|
38
38
|
direction: 'DESC'
|
|
39
39
|
};
|
|
40
40
|
const fetchProduct = async (fetcher, { id, isSample, isStorefront })=>{
|
|
@@ -25,10 +25,10 @@ const getStyleShadow = (shadowStyle, isActiveState = false)=>{
|
|
|
25
25
|
if (typeof value.distance == 'undefined') return {};
|
|
26
26
|
const { value: distance, unit: unitDistance } = parseValueWithUnit(`${value?.distance}`);
|
|
27
27
|
return {
|
|
28
|
-
[`-${!isActiveState ? stateMapping?.[state] || '' : ''}-${getShortName(styleAppliedFor)}`]: isEnableShadow ? `${Math.cos(parseFloat(`${value?.angle}`) * Math.PI / 180) * parseFloat(`${distance}`)}${unitDistance} ${Math.sin(parseFloat(`${value?.angle}`) * Math.PI / 180) * parseFloat(`${distance}`)}${unitDistance} ${value?.blur} ${styleAppliedFor === 'box-shadow' ? value?.spread + ' ' : ''}${getSingleColorVariable(value?.color)}` : 'none'
|
|
28
|
+
[`-${!isActiveState ? stateMapping?.[state] || '' : ''}-${getShortName(styleAppliedFor)}${shadowStyle.screen ? `-${shadowStyle.screen}` : ''}`]: isEnableShadow ? `${Math.cos(parseFloat(`${value?.angle}`) * Math.PI / 180) * parseFloat(`${distance}`)}${unitDistance} ${Math.sin(parseFloat(`${value?.angle}`) * Math.PI / 180) * parseFloat(`${distance}`)}${unitDistance} ${value?.blur} ${styleAppliedFor === 'box-shadow' ? value?.spread + ' ' : ''}${getSingleColorVariable(value?.color)}` : 'none'
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
|
-
const getStyleShadowState = (shadow, styleAppliedFor, isEnableShadow)=>{
|
|
31
|
+
const getStyleShadowState = (shadow, styleAppliedFor, isEnableShadow, screen)=>{
|
|
32
32
|
if (!shadow || !styleAppliedFor) return {};
|
|
33
33
|
const style = {};
|
|
34
34
|
for (const [key, value] of Object.entries(shadow)){
|
|
@@ -36,11 +36,22 @@ const getStyleShadowState = (shadow, styleAppliedFor, isEnableShadow)=>{
|
|
|
36
36
|
value: value,
|
|
37
37
|
state: key,
|
|
38
38
|
styleAppliedFor,
|
|
39
|
-
isEnableShadow: isEnableShadow?.[key]
|
|
39
|
+
isEnableShadow: isEnableShadow?.[key],
|
|
40
|
+
screen: screen ?? ''
|
|
40
41
|
}));
|
|
41
42
|
}
|
|
42
43
|
return style;
|
|
43
44
|
};
|
|
45
|
+
const getResonsiveStyleShadow = (value, styleAppliedFor, isEnableShadow)=>{
|
|
46
|
+
if (!value) return undefined;
|
|
47
|
+
if ('desktop' in value || 'tablet' in value || 'mobile' in value) {
|
|
48
|
+
return {
|
|
49
|
+
...getStyleShadowState(value.desktop, styleAppliedFor, isEnableShadow.desktop),
|
|
50
|
+
...value.tablet && (isEnableShadow.tablet ?? isEnableShadow.desktop) ? getStyleShadowState(value.tablet, styleAppliedFor, isEnableShadow.tablet ?? isEnableShadow.desktop, 'tablet') : undefined,
|
|
51
|
+
...value.mobile && (isEnableShadow.mobile ?? isEnableShadow.tablet ?? isEnableShadow.desktop) ? getStyleShadowState(value.mobile, styleAppliedFor, isEnableShadow.mobile ?? isEnableShadow.tablet ?? isEnableShadow.desktop, 'mobile') : undefined
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
};
|
|
44
55
|
const composeShadowCss = ({ hasBoxShadow, boxShadowValue, important })=>{
|
|
45
56
|
if (!hasBoxShadow) return undefined;
|
|
46
57
|
if (!boxShadowValue) return undefined;
|
|
@@ -49,4 +60,4 @@ const composeShadowCss = ({ hasBoxShadow, boxShadowValue, important })=>{
|
|
|
49
60
|
return `box-shadow: ${Math.cos(parseFloat(`${boxShadowValue?.angle}`) * Math.PI / 180) * parseFloat(`${distance}`)}${unitDistance} ${Math.sin(parseFloat(`${boxShadowValue?.angle}`) * Math.PI / 180) * parseFloat(`${distance}`)}${unitDistance} ${boxShadowValue?.blur} ${boxShadowValue?.spread + ' '}${getSingleColorVariable(boxShadowValue?.color)}${sub};`;
|
|
50
61
|
};
|
|
51
62
|
|
|
52
|
-
export { composeShadowCss, getStyleShadow, getStyleShadowState, parseValueWithUnit };
|
|
63
|
+
export { composeShadowCss, getResonsiveStyleShadow, getStyleShadow, getStyleShadowState, parseValueWithUnit };
|
|
@@ -11,7 +11,7 @@ const addAppBlockId = (component)=>{
|
|
|
11
11
|
};
|
|
12
12
|
const handleSetBlockId = (component)=>{
|
|
13
13
|
const { tag, uid } = component;
|
|
14
|
-
if (component.settings
|
|
14
|
+
if (component.settings?.appBlockId === undefined) return component;
|
|
15
15
|
component.settings.appBlockId = composeAppBlockId(tag, uid);
|
|
16
16
|
};
|
|
17
17
|
|
|
@@ -52,5 +52,71 @@ const PumperBundlesVolumeDiscountConfig = {
|
|
|
52
52
|
appId: '0856870d-2aca-4b1e-a662-cf1797f61270'
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
|
+
const UnlimitedBundlesDiscountsConfig = {
|
|
56
|
+
UnlimitedBundlesDiscounts: {
|
|
57
|
+
appName: 'unlimited-bundles',
|
|
58
|
+
appId: 'd33d0f48-dee0-42a0-b156-2a5dce91814a'
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
const KiteFreeGiftDiscountConfig = {
|
|
62
|
+
KiteFreeGiftDiscount: {
|
|
63
|
+
appName: 'kite-free-gift-discounts',
|
|
64
|
+
appId: '2c7302c4-455d-4078-a829-48563ba26089'
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const FastBundleBundlesDiscountsConfig = {
|
|
68
|
+
FastBundleBundlesDiscounts: {
|
|
69
|
+
appName: 'fast-bundle',
|
|
70
|
+
appId: '9e87fbe2-9041-4c23-acf5-322413994cef'
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
const SimpleBundlesKitsConfig = {
|
|
74
|
+
SimpleBundlesKits: {
|
|
75
|
+
appName: 'simple-bundles-kits',
|
|
76
|
+
appId: 'e553276b-36b2-446d-b80a-aa47fe5f96ac'
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const EasyBundleBuilderSkailamaConfig = {
|
|
80
|
+
EasyBundleBuilderSkailama: {
|
|
81
|
+
appName: 'easy-bundles',
|
|
82
|
+
appId: '05b1325c-6303-4da5-8e2f-b13ab2a50e1a'
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
const AssortionUpsellBundlesConfig = {
|
|
86
|
+
AssortionUpsellBundles: {
|
|
87
|
+
appName: 'assortion',
|
|
88
|
+
appId: '5588d7f9-a5bc-4f4a-9c54-39b7e081dd23'
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
const PreorderNowPreOrderPqConfig = {
|
|
92
|
+
PreorderNowPreOrderPq: {
|
|
93
|
+
appName: 'preorder-now-pre-order-pq',
|
|
94
|
+
appId: '551fab2c-3af6-4a8f-ba21-736a71cb4540'
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
const KPreorderNowPartialPaymentConfig = {
|
|
98
|
+
KPreorderNowPartialPayment: {
|
|
99
|
+
appName: 'k-preorder-now-partial-payment',
|
|
100
|
+
appId: '65705a60-a3b0-43ae-9dc8-15db78d76b3b'
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
const FlyBundlesUpsellsFbtConfig = {
|
|
104
|
+
FlyBundlesUpsellsFbt: {
|
|
105
|
+
appName: 'fly-bundles-upsell',
|
|
106
|
+
appId: '26807bdc-c2ed-4a25-afb2-06e6b1ebf843'
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
const PreorderNowWodPresaleConfig = {
|
|
110
|
+
PreorderNowWodPresale: {
|
|
111
|
+
appName: 'preorder-now-wod-presale',
|
|
112
|
+
appId: 'fdf17d17-ef12-4a7b-8383-20cc1fc2a4b6'
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
const JunipProductReviewsUgcConfig = {
|
|
116
|
+
JunipProductReviewsUgc: {
|
|
117
|
+
appName: 'junip-product-reviews-ugc',
|
|
118
|
+
appId: 'dc14f5a8-ed15-41b1-ad08-cfba23f9789b'
|
|
119
|
+
}
|
|
120
|
+
};
|
|
55
121
|
|
|
56
|
-
export { BonLoyaltyRewardsReferralsConfig, LoopSubscriptionsConfig, PumperBundlesVolumeDiscountConfig, RechargeSubscriptionsConfig, ReviewxpoProductReviewsAppConfig, SelleasyConfig, ShopifyFormsConfig, SkioSubscriptionsYcS20Config, SubifySubscriptionsConfig };
|
|
122
|
+
export { AssortionUpsellBundlesConfig, BonLoyaltyRewardsReferralsConfig, EasyBundleBuilderSkailamaConfig, FastBundleBundlesDiscountsConfig, FlyBundlesUpsellsFbtConfig, JunipProductReviewsUgcConfig, KPreorderNowPartialPaymentConfig, KiteFreeGiftDiscountConfig, LoopSubscriptionsConfig, PreorderNowPreOrderPqConfig, PreorderNowWodPresaleConfig, PumperBundlesVolumeDiscountConfig, RechargeSubscriptionsConfig, ReviewxpoProductReviewsAppConfig, SelleasyConfig, ShopifyFormsConfig, SimpleBundlesKitsConfig, SkioSubscriptionsYcS20Config, SubifySubscriptionsConfig, UnlimitedBundlesDiscountsConfig };
|