@gem-sdk/core 1.56.2 → 1.57.0-dev.45
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 +181 -107
- package/dist/cjs/components/ComponentWrapper.js +16 -1
- package/dist/cjs/components/ComponentWrapperPreview.js +16 -2
- package/dist/cjs/components/InteractionSuffix.js +42 -0
- package/dist/cjs/components/Render.liquid.js +22 -7
- package/dist/cjs/contexts/PageContext.js +42 -1
- package/dist/cjs/contexts/ProductContext.js +10 -0
- package/dist/cjs/graphql/fragments/published-theme-page.generated.js +4 -0
- package/dist/cjs/helpers/animations.js +17 -8
- package/dist/cjs/helpers/background.js +10 -5
- package/dist/cjs/helpers/compose-advance-style.js +30 -4
- package/dist/cjs/helpers/interaction/index.js +110 -0
- package/dist/cjs/helpers/radius.js +11 -1
- package/dist/cjs/helpers/shadow.js +5 -4
- package/dist/cjs/helpers/third-party/appConfig.js +49 -0
- package/dist/cjs/helpers/third-party/appSetting.js +116 -1
- package/dist/cjs/helpers/third-party/constant.js +8 -1
- package/dist/cjs/helpers/third-party/getAppBlockConfig.js +8 -1
- package/dist/cjs/hooks/animation/useAnimationConfig.js +2 -1
- package/dist/cjs/hooks/animation/useAnimationTarget.js +5 -2
- package/dist/cjs/hooks/animation/useApplyAnimation.js +6 -4
- package/dist/cjs/hooks/useInteraction.js +19 -0
- package/dist/cjs/hooks/useToolbarPostPurchase.js +2 -2
- package/dist/cjs/index.js +14 -1
- package/dist/cjs/types/animations.js +2 -0
- package/dist/cjs/types/custom.js +52 -0
- package/dist/esm/components/ComponentToolbarPreview.js +181 -107
- package/dist/esm/components/ComponentWrapper.js +16 -1
- package/dist/esm/components/ComponentWrapperPreview.js +16 -2
- package/dist/esm/components/InteractionSuffix.js +40 -0
- package/dist/esm/components/Render.liquid.js +22 -7
- package/dist/esm/contexts/PageContext.js +42 -1
- package/dist/esm/contexts/ProductContext.js +10 -0
- package/dist/esm/graphql/fragments/published-theme-page.generated.js +4 -0
- package/dist/esm/helpers/animations.js +17 -8
- package/dist/esm/helpers/background.js +10 -5
- package/dist/esm/helpers/compose-advance-style.js +31 -5
- package/dist/esm/helpers/interaction/index.js +108 -0
- package/dist/esm/helpers/radius.js +11 -1
- package/dist/esm/helpers/shadow.js +5 -4
- package/dist/esm/helpers/third-party/appConfig.js +43 -1
- package/dist/esm/helpers/third-party/appSetting.js +116 -1
- package/dist/esm/helpers/third-party/constant.js +9 -2
- package/dist/esm/helpers/third-party/getAppBlockConfig.js +8 -1
- package/dist/esm/hooks/animation/useAnimationConfig.js +2 -1
- package/dist/esm/hooks/animation/useAnimationTarget.js +5 -2
- package/dist/esm/hooks/animation/useApplyAnimation.js +6 -4
- package/dist/esm/hooks/useInteraction.js +17 -0
- package/dist/esm/hooks/useToolbarPostPurchase.js +2 -2
- package/dist/esm/index.js +4 -1
- package/dist/esm/types/animations.js +2 -0
- package/dist/esm/types/custom.js +52 -0
- package/dist/types/index.d.ts +547 -184
- package/package.json +3 -3
|
@@ -29,6 +29,44 @@ const createPageStoreProvider = (data)=>createStore((set)=>({
|
|
|
29
29
|
set({
|
|
30
30
|
publicStoreFrontData: publicStoreFrontData
|
|
31
31
|
});
|
|
32
|
+
},
|
|
33
|
+
setInteractionIsSelectOnPage: (value)=>{
|
|
34
|
+
set((state)=>({
|
|
35
|
+
interactionData: {
|
|
36
|
+
...state.interactionData,
|
|
37
|
+
isSelectOnPage: value
|
|
38
|
+
}
|
|
39
|
+
}));
|
|
40
|
+
},
|
|
41
|
+
setInteractionItem: (item)=>{
|
|
42
|
+
set((state)=>({
|
|
43
|
+
interactionData: {
|
|
44
|
+
...state.interactionData,
|
|
45
|
+
item,
|
|
46
|
+
isSelectOnPage: state.interactionData?.isSelectOnPage || false
|
|
47
|
+
}
|
|
48
|
+
}));
|
|
49
|
+
},
|
|
50
|
+
setInteractionSelectType: (selectType)=>{
|
|
51
|
+
set((state)=>({
|
|
52
|
+
interactionData: {
|
|
53
|
+
...state.interactionData,
|
|
54
|
+
selectType
|
|
55
|
+
}
|
|
56
|
+
}));
|
|
57
|
+
},
|
|
58
|
+
setInteractionSettingType: (settingType)=>{
|
|
59
|
+
set((state)=>({
|
|
60
|
+
interactionData: {
|
|
61
|
+
...state.interactionData,
|
|
62
|
+
settingType
|
|
63
|
+
}
|
|
64
|
+
}));
|
|
65
|
+
},
|
|
66
|
+
setSidebarMode: (mode)=>{
|
|
67
|
+
set(()=>({
|
|
68
|
+
sidebarMode: mode
|
|
69
|
+
}));
|
|
32
70
|
}
|
|
33
71
|
}));
|
|
34
72
|
const PageProvider = ({ children, dynamicProduct, dynamicCollection, productOffers, publicStoreFrontData, ...passProps })=>{
|
|
@@ -36,7 +74,10 @@ const PageProvider = ({ children, dynamicProduct, dynamicCollection, productOffe
|
|
|
36
74
|
dynamicProduct,
|
|
37
75
|
dynamicCollection,
|
|
38
76
|
productOffers,
|
|
39
|
-
publicStoreFrontData
|
|
77
|
+
publicStoreFrontData,
|
|
78
|
+
interactionData: {
|
|
79
|
+
selectType: 'ELEMENT'
|
|
80
|
+
}
|
|
40
81
|
}), [
|
|
41
82
|
dynamicProduct,
|
|
42
83
|
dynamicCollection,
|
|
@@ -23,6 +23,16 @@ const createProductStoreProvider = (data)=>createStore((set, get)=>({
|
|
|
23
23
|
};
|
|
24
24
|
});
|
|
25
25
|
},
|
|
26
|
+
setShouldRequireUploadMessage: (value)=>{
|
|
27
|
+
set({
|
|
28
|
+
shouldRequireUploadMessage: value
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
setRequireUpload: (value)=>{
|
|
32
|
+
set({
|
|
33
|
+
requireUpload: value
|
|
34
|
+
});
|
|
35
|
+
},
|
|
26
36
|
addProperty: (data)=>{
|
|
27
37
|
const properties = get().properties;
|
|
28
38
|
if (!properties?.some((v)=>v.key === data.key)) {
|
|
@@ -44,17 +44,23 @@ 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 = [
|
|
51
51
|
'left',
|
|
52
52
|
'right'
|
|
53
53
|
].includes(direction ?? '') ? 'X' : 'Y';
|
|
54
|
-
|
|
54
|
+
let isNeg = [
|
|
55
55
|
'left',
|
|
56
56
|
'down'
|
|
57
57
|
].includes(direction ?? '') ? '-' : '';
|
|
58
|
+
if (reverse) {
|
|
59
|
+
isNeg = [
|
|
60
|
+
'left',
|
|
61
|
+
'down'
|
|
62
|
+
].includes(direction ?? '') ? '' : '-';
|
|
63
|
+
}
|
|
58
64
|
const preset = [
|
|
59
65
|
{
|
|
60
66
|
opacity: 0,
|
|
@@ -65,11 +71,11 @@ const animations = ()=>{
|
|
|
65
71
|
transform: `translate${coordinate}(0)`
|
|
66
72
|
}
|
|
67
73
|
];
|
|
68
|
-
return generateAnimationInstance(target, preset, {
|
|
74
|
+
return generateAnimationInstance(target, reverse ? preset.reverse() : preset, {
|
|
69
75
|
...generateOptions(normalizedOptions, 500)
|
|
70
76
|
});
|
|
71
77
|
};
|
|
72
|
-
const fade = (target, options)=>{
|
|
78
|
+
const fade = (target, options, reverse)=>{
|
|
73
79
|
const normalizedOptions = normalizeOptions(options);
|
|
74
80
|
const preset = [
|
|
75
81
|
{
|
|
@@ -79,7 +85,7 @@ const animations = ()=>{
|
|
|
79
85
|
opacity: 1
|
|
80
86
|
}
|
|
81
87
|
];
|
|
82
|
-
return generateAnimationInstance(target, preset, {
|
|
88
|
+
return generateAnimationInstance(target, reverse ? preset.reverse() : preset, {
|
|
83
89
|
...generateOptions(normalizedOptions, 500)
|
|
84
90
|
});
|
|
85
91
|
};
|
|
@@ -99,7 +105,7 @@ const animations = ()=>{
|
|
|
99
105
|
easing: EASING[easing ?? 'linear']
|
|
100
106
|
};
|
|
101
107
|
};
|
|
102
|
-
const zoom = (target, options)=>{
|
|
108
|
+
const zoom = (target, options, reverse)=>{
|
|
103
109
|
const normalizedOptions = normalizeOptions(options);
|
|
104
110
|
const { scale, zoomDirection, isFade } = normalizedOptions;
|
|
105
111
|
const [i1, i2] = scale.in;
|
|
@@ -124,8 +130,11 @@ const animations = ()=>{
|
|
|
124
130
|
opacity: 1
|
|
125
131
|
}
|
|
126
132
|
];
|
|
127
|
-
|
|
128
|
-
|
|
133
|
+
let zoomPreset = zoomDirection === 'in' ? zoomInPreset : zoomOutPreset;
|
|
134
|
+
if (reverse) {
|
|
135
|
+
zoomPreset = zoomDirection === 'in' ? zoomOutPreset : zoomInPreset;
|
|
136
|
+
}
|
|
137
|
+
return generateAnimationInstance(target, reverse ? zoomPreset.reverse() : zoomPreset, {
|
|
129
138
|
...generateOptions(normalizedOptions, 700)
|
|
130
139
|
});
|
|
131
140
|
};
|
|
@@ -11,7 +11,9 @@ const getStyleBackgroundByDevice = (background, options)=>{
|
|
|
11
11
|
...getStyleBgColor(background)
|
|
12
12
|
} : {},
|
|
13
13
|
...!options?.ignoreBackgroundImage ? {
|
|
14
|
-
...getStyleBgImage(background, options)
|
|
14
|
+
...getStyleBgImage(background, options)
|
|
15
|
+
} : {},
|
|
16
|
+
...!options?.ignoreBackgroundImageProperties ? {
|
|
15
17
|
...getStyleBgPosition(background),
|
|
16
18
|
...getStyleBgSize(background),
|
|
17
19
|
...getStyleBgRepeat(background)
|
|
@@ -72,6 +74,9 @@ const getBgImageByDevice = (background, device, options)=>{
|
|
|
72
74
|
if (typeof imageByDevice === 'string') {
|
|
73
75
|
return `url(${imageByDevice})`;
|
|
74
76
|
}
|
|
77
|
+
if (imageByDevice !== undefined) {
|
|
78
|
+
return 'none';
|
|
79
|
+
}
|
|
75
80
|
};
|
|
76
81
|
const getStyleBgPosition = (background)=>{
|
|
77
82
|
const bgPosition = {
|
|
@@ -119,7 +124,7 @@ const getBgAttachmentByDevice = (background, device)=>{
|
|
|
119
124
|
return background?.[device]?.attachment;
|
|
120
125
|
};
|
|
121
126
|
const composeBackgroundCss = (backgroundColor)=>{
|
|
122
|
-
return `${backgroundColor ? `background-color: ${getSingleColorVariable(backgroundColor)}
|
|
127
|
+
return `${backgroundColor ? `background-color: ${getSingleColorVariable(backgroundColor)};` : undefined}`;
|
|
123
128
|
};
|
|
124
129
|
const makeFixedBgAttachment = (background)=>{
|
|
125
130
|
if (!background) return;
|
|
@@ -203,7 +208,7 @@ const getGradientBgrStyleForButton = (backgroundStyle)=>{
|
|
|
203
208
|
});
|
|
204
209
|
return bgrStyle;
|
|
205
210
|
};
|
|
206
|
-
const getGradientBgrStyleByDevice = (backgroundStyle, ignoreBackgroundImage
|
|
211
|
+
const getGradientBgrStyleByDevice = (backgroundStyle, ignoreBackgroundImage)=>{
|
|
207
212
|
if (!backgroundStyle) return;
|
|
208
213
|
const bgrStyle = {};
|
|
209
214
|
[
|
|
@@ -213,8 +218,8 @@ const getGradientBgrStyleByDevice = (backgroundStyle, ignoreBackgroundImage = fa
|
|
|
213
218
|
].forEach((device)=>{
|
|
214
219
|
if (backgroundStyle[device]?.color?.includes(GRADIENT_BGR_KEY)) {
|
|
215
220
|
Object.assign(bgrStyle, {
|
|
216
|
-
[`--bgc${device !== 'desktop' ? '-' + device : ''}`]:
|
|
217
|
-
[`--bgi${device !== 'desktop' ? '-' + device : ''}`]: ignoreBackgroundImage ? `${backgroundStyle[device]?.color}` : `${getBgImageByDevice(backgroundStyle, device) || 'url()'}, ${backgroundStyle[device]?.color}`
|
|
221
|
+
[`--bgc${device !== 'desktop' ? '-' + device : ''}`]: backgroundStyle[device]?.color,
|
|
222
|
+
[`--bgi${device !== 'desktop' ? '-' + device : ''}`]: !ignoreBackgroundImage?.[device] ? `${backgroundStyle[device]?.color}` : `${getBgImageByDevice(backgroundStyle, device) || 'url()'}, ${backgroundStyle[device]?.color}`
|
|
218
223
|
});
|
|
219
224
|
}
|
|
220
225
|
});
|
|
@@ -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 {
|
|
6
|
+
import { getResponsiveStyleShadow, getStyleShadowState, getStyleShadow } from './shadow.js';
|
|
7
7
|
|
|
8
8
|
const composeSpacing = ({ source, spacing, type, suffix = '' })=>{
|
|
9
9
|
const { top, left, bottom, right } = spacing;
|
|
@@ -38,6 +38,16 @@ const getAttrValue = (attr, value, tag)=>{
|
|
|
38
38
|
if (!value) return 'none';
|
|
39
39
|
if (value && tag && layoutComponent.includes(tag)) return 'grid';
|
|
40
40
|
return 'block';
|
|
41
|
+
case 'animation':
|
|
42
|
+
return undefined;
|
|
43
|
+
case 'hasBoxShadow':
|
|
44
|
+
return undefined;
|
|
45
|
+
case 'rounded':
|
|
46
|
+
return undefined;
|
|
47
|
+
case 'boxShadow':
|
|
48
|
+
return undefined;
|
|
49
|
+
case 'border':
|
|
50
|
+
return undefined;
|
|
41
51
|
default:
|
|
42
52
|
return value;
|
|
43
53
|
}
|
|
@@ -100,8 +110,23 @@ function composeAdvanceStyle(data, tag, pageType) {
|
|
|
100
110
|
Object.assign(styles, composeRadius(value));
|
|
101
111
|
}
|
|
102
112
|
if (attr === 'boxShadow') {
|
|
103
|
-
|
|
113
|
+
const listElementShadowV2 = [
|
|
114
|
+
'Row',
|
|
115
|
+
'Section',
|
|
116
|
+
'Text',
|
|
117
|
+
'Heading'
|
|
118
|
+
];
|
|
119
|
+
let hasBoxShadowV2 = hasBoxShadow;
|
|
120
|
+
if (listElementShadowV2.includes(tag || '')) {
|
|
121
|
+
hasBoxShadowV2 = {
|
|
122
|
+
desktop: value.desktop ?? {},
|
|
123
|
+
tablet: value.tablet ?? value.desktop ?? {},
|
|
124
|
+
mobile: value.mobile ?? value.tablet ?? value.desktop ?? {}
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
Object.assign(styles, getResponsiveStyleShadow(value, 'box-shadow', hasBoxShadowV2 ?? hasBoxShadow));
|
|
104
128
|
}
|
|
129
|
+
const styleValue = getAttrValue(attr, deviceValue, tag);
|
|
105
130
|
if (composeAttr === 'desktop') {
|
|
106
131
|
switch(attr){
|
|
107
132
|
case 'padding':
|
|
@@ -129,7 +154,7 @@ function composeAdvanceStyle(data, tag, pageType) {
|
|
|
129
154
|
case 'p':
|
|
130
155
|
break;
|
|
131
156
|
default:
|
|
132
|
-
styles[`--${attr}`] =
|
|
157
|
+
styleValue && (styles[`--${attr}`] = styleValue);
|
|
133
158
|
break;
|
|
134
159
|
}
|
|
135
160
|
} else {
|
|
@@ -162,7 +187,7 @@ function composeAdvanceStyle(data, tag, pageType) {
|
|
|
162
187
|
case 'p':
|
|
163
188
|
break;
|
|
164
189
|
default:
|
|
165
|
-
styles[`--${attr}-${composeAttr}`] =
|
|
190
|
+
styleValue && (styles[`--${attr}-${composeAttr}`] = styleValue);
|
|
166
191
|
break;
|
|
167
192
|
}
|
|
168
193
|
}
|
|
@@ -207,7 +232,8 @@ function composeAdvanceStyle(data, tag, pageType) {
|
|
|
207
232
|
}
|
|
208
233
|
});
|
|
209
234
|
} else {
|
|
210
|
-
|
|
235
|
+
const styleValue = getAttrValue(attr, value, tag);
|
|
236
|
+
styleValue && (styles[`--${attr}`] = styleValue);
|
|
211
237
|
if (attr === 'hasBoxShadow' && data.boxShadow) {
|
|
212
238
|
Object.assign(styles, getStyleShadow({
|
|
213
239
|
value: data.boxShadow,
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { useRef } from 'react';
|
|
2
|
+
import 'react/jsx-runtime';
|
|
3
|
+
import 'zustand';
|
|
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 ref = useRef();
|
|
19
|
+
const setInteractionIsSelectOnPage = usePageStore((s)=>s.setInteractionIsSelectOnPage);
|
|
20
|
+
function findElementIncludingSelf(element, selector) {
|
|
21
|
+
if (!(element instanceof Document) && element?.matches(selector)) {
|
|
22
|
+
return element;
|
|
23
|
+
} else {
|
|
24
|
+
return element?.querySelector(selector);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const handleOnListener = (element, event, callback)=>{
|
|
28
|
+
const eventListener = (e)=>{
|
|
29
|
+
const customEvent = e;
|
|
30
|
+
const params = customEvent.detail;
|
|
31
|
+
if (callback) callback(params);
|
|
32
|
+
};
|
|
33
|
+
element.addEventListener(event, eventListener);
|
|
34
|
+
return ()=>element.removeEventListener(event, eventListener);
|
|
35
|
+
};
|
|
36
|
+
const onListener = ({ event, selector, elementRef }, callback)=>{
|
|
37
|
+
const element = findElementIncludingSelf(elementRef?.current || ref.current || document, selector);
|
|
38
|
+
if (!element) return;
|
|
39
|
+
return handleOnListener(element, event, callback);
|
|
40
|
+
};
|
|
41
|
+
const trigger = ({ event, data, selector, element: elementParam })=>{
|
|
42
|
+
const element = elementParam || document.body?.querySelector(selector);
|
|
43
|
+
if (!element) return;
|
|
44
|
+
const eventDispatch = new CustomEvent(event, {
|
|
45
|
+
bubbles: false,
|
|
46
|
+
cancelable: true,
|
|
47
|
+
detail: {
|
|
48
|
+
data
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
element.dispatchEvent(eventDispatch);
|
|
52
|
+
};
|
|
53
|
+
const saveToElementInteractionData = (element, key, value)=>{
|
|
54
|
+
const interactionData = element.getAttribute('gp-data-interaction');
|
|
55
|
+
const interactionDataJson = JSON.parse(interactionData || '{}');
|
|
56
|
+
element.setAttribute('gp-data-interaction', JSON.stringify({
|
|
57
|
+
...interactionDataJson,
|
|
58
|
+
[key]: value
|
|
59
|
+
}));
|
|
60
|
+
};
|
|
61
|
+
const getInteractionPreviousData = (element, key)=>{
|
|
62
|
+
const interactionData = element.getAttribute('gp-data-interaction');
|
|
63
|
+
const interactionDataJson = JSON.parse(interactionData || '{}');
|
|
64
|
+
return {
|
|
65
|
+
previousData: interactionDataJson[key],
|
|
66
|
+
interactionDataJson
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
const closeSelectOnPage = ()=>{
|
|
70
|
+
setInteractionIsSelectOnPage(false);
|
|
71
|
+
const event = new CustomEvent('editor:interaction:change-select-on-page', {
|
|
72
|
+
bubbles: true,
|
|
73
|
+
detail: false
|
|
74
|
+
});
|
|
75
|
+
window.dispatchEvent(event);
|
|
76
|
+
};
|
|
77
|
+
const changeSelectMode = (mode)=>{
|
|
78
|
+
const event = new CustomEvent('editor:interaction:change-select-mode', {
|
|
79
|
+
bubbles: true,
|
|
80
|
+
detail: mode
|
|
81
|
+
});
|
|
82
|
+
window.dispatchEvent(event);
|
|
83
|
+
};
|
|
84
|
+
const selectInteractionElement = ({ componentUid, settingType, $target })=>{
|
|
85
|
+
const event = new CustomEvent('editor:interaction:select-element', {
|
|
86
|
+
bubbles: true,
|
|
87
|
+
detail: {
|
|
88
|
+
componentUid,
|
|
89
|
+
settingType,
|
|
90
|
+
$target
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
window.dispatchEvent(event);
|
|
94
|
+
};
|
|
95
|
+
return {
|
|
96
|
+
onListener,
|
|
97
|
+
trigger,
|
|
98
|
+
saveToElementInteractionData,
|
|
99
|
+
closeSelectOnPage,
|
|
100
|
+
ref,
|
|
101
|
+
findElementIncludingSelf,
|
|
102
|
+
getInteractionPreviousData,
|
|
103
|
+
changeSelectMode,
|
|
104
|
+
selectInteractionElement
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export { useInteraction };
|
|
@@ -25,7 +25,14 @@ const getRadiusCSSFromGlobal = (state, key, device)=>{
|
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
27
|
const getCustomRadius = (state, radius, device)=>{
|
|
28
|
-
|
|
28
|
+
const list = [
|
|
29
|
+
'custom',
|
|
30
|
+
'pill',
|
|
31
|
+
'rounded',
|
|
32
|
+
'single',
|
|
33
|
+
'none'
|
|
34
|
+
];
|
|
35
|
+
if (!radius || !state || !list.includes(radius?.radiusType ?? '')) return {};
|
|
29
36
|
const suffix = device && device !== 'desktop' ? devicesMapping?.[device] : '';
|
|
30
37
|
const mState = stateMapping?.[state];
|
|
31
38
|
return {
|
|
@@ -60,6 +67,7 @@ const composeRadiusState = (radiusValue, device)=>{
|
|
|
60
67
|
case 'circle':
|
|
61
68
|
case 'none':
|
|
62
69
|
case 'custom':
|
|
70
|
+
case 'rounded':
|
|
63
71
|
Object.assign(style, getCustomRadius('normal', radiusValue.normal, device));
|
|
64
72
|
break;
|
|
65
73
|
}
|
|
@@ -72,6 +80,7 @@ const composeRadiusState = (radiusValue, device)=>{
|
|
|
72
80
|
case 'circle':
|
|
73
81
|
case 'none':
|
|
74
82
|
case 'custom':
|
|
83
|
+
case 'rounded':
|
|
75
84
|
Object.assign(style, getCustomRadius('hover', radiusValue.hover, device));
|
|
76
85
|
break;
|
|
77
86
|
}
|
|
@@ -84,6 +93,7 @@ const composeRadiusState = (radiusValue, device)=>{
|
|
|
84
93
|
case 'circle':
|
|
85
94
|
case 'none':
|
|
86
95
|
case 'custom':
|
|
96
|
+
case 'rounded':
|
|
87
97
|
Object.assign(style, getCustomRadius('focus', radiusValue.focus, device));
|
|
88
98
|
break;
|
|
89
99
|
}
|
|
@@ -22,10 +22,11 @@ const getStyleShadow = (shadowStyle, isActiveState = false)=>{
|
|
|
22
22
|
let { state } = shadowStyle || {};
|
|
23
23
|
if (!state) state = 'normal';
|
|
24
24
|
if (!styleAppliedFor || !value) return {};
|
|
25
|
-
|
|
25
|
+
const isNoneValue = value.type === 'none';
|
|
26
|
+
if (typeof value.distance == 'undefined' && !isNoneValue) return {};
|
|
26
27
|
const { value: distance, unit: unitDistance } = parseValueWithUnit(`${value?.distance}`);
|
|
27
28
|
return {
|
|
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
|
+
[`-${!isActiveState ? stateMapping?.[state] || '' : ''}-${getShortName(styleAppliedFor)}${shadowStyle.screen ? `-${shadowStyle.screen}` : ''}`]: isEnableShadow && !isNoneValue ? `${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
30
|
};
|
|
30
31
|
};
|
|
31
32
|
const getStyleShadowState = (shadow, styleAppliedFor, isEnableShadow, screen)=>{
|
|
@@ -42,7 +43,7 @@ const getStyleShadowState = (shadow, styleAppliedFor, isEnableShadow, screen)=>{
|
|
|
42
43
|
}
|
|
43
44
|
return style;
|
|
44
45
|
};
|
|
45
|
-
const
|
|
46
|
+
const getResponsiveStyleShadow = (value, styleAppliedFor, isEnableShadow)=>{
|
|
46
47
|
if (!value) return undefined;
|
|
47
48
|
if ('desktop' in value || 'tablet' in value || 'mobile' in value) {
|
|
48
49
|
return {
|
|
@@ -60,4 +61,4 @@ const composeShadowCss = ({ hasBoxShadow, boxShadowValue, important })=>{
|
|
|
60
61
|
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};`;
|
|
61
62
|
};
|
|
62
63
|
|
|
63
|
-
export { composeShadowCss,
|
|
64
|
+
export { composeShadowCss, getResponsiveStyleShadow, getStyleShadow, getStyleShadowState, parseValueWithUnit };
|
|
@@ -136,5 +136,47 @@ const BoldSubscriptionsConfig = {
|
|
|
136
136
|
appId: '9ceb49f0-5fe5-4b5e-943d-f8af8985167d'
|
|
137
137
|
}
|
|
138
138
|
};
|
|
139
|
+
const SproutPlantTreesGrowSalesConfig = {
|
|
140
|
+
SproutPlantTreesGrowSales: {
|
|
141
|
+
appName: 'sprout-plant-trees',
|
|
142
|
+
appId: '7db5ee24-2195-4099-b98e-1547c600e4aa'
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
const InstasellShoppableInstagramConfig = {
|
|
146
|
+
InstasellShoppableInstagram: {
|
|
147
|
+
appName: 'instasell-instagram-gallery',
|
|
148
|
+
appId: '38d643ac-410a-4b2c-a727-6125ff08e444'
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
const GrowaveConfig = {
|
|
152
|
+
Growave: {
|
|
153
|
+
appName: 'growave-loyalty-wishlist',
|
|
154
|
+
appId: 'b3d2efbe-110a-4e27-84a8-1f2ed63996a4'
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
const KachingBundlesConfig = {
|
|
158
|
+
KachingBundles: {
|
|
159
|
+
appName: 'kaching-bundles',
|
|
160
|
+
appId: '6c637362-a106-4a32-94ac-94dcfd68cdb8'
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
const LoloyalLoyaltyReferralsConfig = {
|
|
164
|
+
LoloyalLoyaltyReferrals: {
|
|
165
|
+
appName: 'loloyal-com',
|
|
166
|
+
appId: '930ac91f-2bf2-4655-9ba0-574771f782d6'
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
const PowerfulContactFormBuilderConfig = {
|
|
170
|
+
PowerfulContactFormBuilder: {
|
|
171
|
+
appName: 'powerful-form-builder',
|
|
172
|
+
appId: 'e4bcb1eb-35b2-42e6-bc37-bfe0e1542c9d'
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
const WishlistKingConfig = {
|
|
176
|
+
WishlistKing: {
|
|
177
|
+
appName: 'wishlist-king',
|
|
178
|
+
appId: '194f5011-a43c-4b22-b12e-eaf20dc4506a'
|
|
179
|
+
}
|
|
180
|
+
};
|
|
139
181
|
|
|
140
|
-
export { AppointmentBookingCowlendarConfig, BoldSubscriptionsConfig, BonLoyaltyRewardsReferralsConfig, EasyBundleBuilderSkailamaConfig, FastBundleBundlesDiscountsConfig, FlyBundlesUpsellsFbtConfig, JunipProductReviewsUgcConfig, KiteFreeGiftDiscountConfig, LoopSubscriptionsConfig, PreorderNowPreOrderPqConfig, PreorderNowWodPresaleConfig, ProductOptionsCustomizerConfig, PumperBundlesVolumeDiscountConfig, RechargeSubscriptionsConfig, ReviewxpoProductReviewsAppConfig, SelleasyConfig, ShopifyFormsConfig, SimpleBundlesKitsConfig, SkioSubscriptionsYcS20Config, SubifySubscriptionsConfig, UnlimitedBundlesDiscountsConfig, WhatmoreShoppableVideosreelConfig, YotpoReviewsV3UgcConfig };
|
|
182
|
+
export { AppointmentBookingCowlendarConfig, BoldSubscriptionsConfig, BonLoyaltyRewardsReferralsConfig, EasyBundleBuilderSkailamaConfig, FastBundleBundlesDiscountsConfig, FlyBundlesUpsellsFbtConfig, GrowaveConfig, InstasellShoppableInstagramConfig, JunipProductReviewsUgcConfig, KachingBundlesConfig, KiteFreeGiftDiscountConfig, LoloyalLoyaltyReferralsConfig, LoopSubscriptionsConfig, PowerfulContactFormBuilderConfig, PreorderNowPreOrderPqConfig, PreorderNowWodPresaleConfig, ProductOptionsCustomizerConfig, PumperBundlesVolumeDiscountConfig, RechargeSubscriptionsConfig, ReviewxpoProductReviewsAppConfig, SelleasyConfig, ShopifyFormsConfig, SimpleBundlesKitsConfig, SkioSubscriptionsYcS20Config, SproutPlantTreesGrowSalesConfig, SubifySubscriptionsConfig, UnlimitedBundlesDiscountsConfig, WhatmoreShoppableVideosreelConfig, WishlistKingConfig, YotpoReviewsV3UgcConfig };
|
|
@@ -72,6 +72,13 @@ const ShopifyForms = {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
|
+
const KachingBundles = {
|
|
76
|
+
KachingBundles: {
|
|
77
|
+
'app-block': {
|
|
78
|
+
product: '{{product}}'
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
};
|
|
75
82
|
const overrideSettings = (tag, currentSetting, appSetting)=>{
|
|
76
83
|
switch(tag){
|
|
77
84
|
case 'ShopifyForms':
|
|
@@ -93,6 +100,20 @@ const overrideSettings = (tag, currentSetting, appSetting)=>{
|
|
|
93
100
|
selected_product: appSetting?.['productHandle'] || '{{ product }}'
|
|
94
101
|
};
|
|
95
102
|
}
|
|
103
|
+
case 'WhatmoreShoppableVideosreel':
|
|
104
|
+
{
|
|
105
|
+
return {
|
|
106
|
+
...currentSetting,
|
|
107
|
+
['show-views']: appSetting?.showViews
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
case 'PowerfulContactFormBuilder':
|
|
111
|
+
{
|
|
112
|
+
return {
|
|
113
|
+
...currentSetting,
|
|
114
|
+
shortcode: appSetting?.shortcode
|
|
115
|
+
};
|
|
116
|
+
}
|
|
96
117
|
default:
|
|
97
118
|
return currentSetting;
|
|
98
119
|
}
|
|
@@ -328,7 +349,99 @@ const BoldSubscriptions = {
|
|
|
328
349
|
}
|
|
329
350
|
}
|
|
330
351
|
};
|
|
352
|
+
const SproutPlantTreesGrowSales = {
|
|
353
|
+
SproutPlantTreesGrowSales: {
|
|
354
|
+
badge: null,
|
|
355
|
+
'impact-banner': null
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
const InstasellShoppableInstagram = {
|
|
359
|
+
InstasellShoppableInstagram: {
|
|
360
|
+
'app-block': {
|
|
361
|
+
heading: 'InstaSell: Instagram Gallery+',
|
|
362
|
+
description: 'Showcase your Instagram Feed on your Shopify Storefront'
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
const Growave = {
|
|
367
|
+
Growave: {
|
|
368
|
+
'block.product.faveButton': {
|
|
369
|
+
option_button_class: ''
|
|
370
|
+
},
|
|
371
|
+
'block.product.reviewWidget': null,
|
|
372
|
+
'block.product.reviewAvgProfile': null,
|
|
373
|
+
'v2.product.reviewsMiniSlider': null
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
const LoloyalSettingCommon = {
|
|
377
|
+
title_font_size: 30,
|
|
378
|
+
subtitle_font_size: 13,
|
|
379
|
+
name_font_size: 20,
|
|
380
|
+
details_font_size: 14,
|
|
381
|
+
corner_radius: 8,
|
|
382
|
+
btn_radius: 8,
|
|
383
|
+
top_padding: 32,
|
|
384
|
+
bottom_padding: 32,
|
|
385
|
+
icon_color: '',
|
|
386
|
+
title_color: '#000000',
|
|
387
|
+
subtitle_color: '#000000',
|
|
388
|
+
name_color: '#000000',
|
|
389
|
+
details_color: '#000000',
|
|
390
|
+
card_bg_color: '#FFFFFF',
|
|
391
|
+
background_color: '#ffffff',
|
|
392
|
+
border_color: '#ececec',
|
|
393
|
+
primary_button_color: '#000000',
|
|
394
|
+
primary_button_text_color: '#FFFFFF',
|
|
395
|
+
secondary_button_color: '#FFFFFF',
|
|
396
|
+
secondary_button_text_color: '#000000',
|
|
397
|
+
hover_btn: '#000000',
|
|
398
|
+
hover_text_color: '#FFFFFF',
|
|
399
|
+
custom_css: '/* Add your custom styles here */'
|
|
400
|
+
};
|
|
401
|
+
const LoloyalLoyaltyReferrals = {
|
|
402
|
+
LoloyalLoyaltyReferrals: {
|
|
403
|
+
'app-banner': {
|
|
404
|
+
img_opacity: 0,
|
|
405
|
+
bg_color: '#F6F6F6',
|
|
406
|
+
banner_height: '400',
|
|
407
|
+
content_position: 'll-middle-left',
|
|
408
|
+
content_alignment: 'left',
|
|
409
|
+
title_font_size: 40,
|
|
410
|
+
subtitle_font_size: 13,
|
|
411
|
+
title_color: '#000000',
|
|
412
|
+
subtitle_color: '#000000',
|
|
413
|
+
btn_radius: 30,
|
|
414
|
+
primary_button_color: '#000000',
|
|
415
|
+
primary_button_text_color: '#FFFFFF',
|
|
416
|
+
secondary_button_color: '#FFFFFF',
|
|
417
|
+
secondary_button_text_color: '#000000',
|
|
418
|
+
hover_btn: '#000000',
|
|
419
|
+
hover_text_color: '#FFFFFF',
|
|
420
|
+
custom_css: '/* Add your custom styles here */'
|
|
421
|
+
},
|
|
422
|
+
'app-ways-to-earn': LoloyalSettingCommon,
|
|
423
|
+
'app-ways-to-redeem': LoloyalSettingCommon,
|
|
424
|
+
'app-referrals': LoloyalSettingCommon
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
const PowerfulContactFormBuilder = {
|
|
428
|
+
PowerfulContactFormBuilder: {
|
|
429
|
+
'app-block': {
|
|
430
|
+
shortcode: ''
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
};
|
|
434
|
+
const WishlistKing = {
|
|
435
|
+
WishlistKing: {
|
|
436
|
+
'wishlist-button-block': null
|
|
437
|
+
}
|
|
438
|
+
};
|
|
331
439
|
const composeSettingsByWidgetType = {
|
|
440
|
+
...WishlistKing,
|
|
441
|
+
...LoloyalLoyaltyReferrals,
|
|
442
|
+
...PowerfulContactFormBuilder,
|
|
443
|
+
...InstasellShoppableInstagram,
|
|
444
|
+
...SproutPlantTreesGrowSales,
|
|
332
445
|
...AppointmentBookingCowlendar,
|
|
333
446
|
...ProductOptionsCustomizer,
|
|
334
447
|
...WhatmoreShoppableVideosreel,
|
|
@@ -351,7 +464,9 @@ const composeSettingsByWidgetType = {
|
|
|
351
464
|
...SubifySubscriptions,
|
|
352
465
|
...SelleasyWidget,
|
|
353
466
|
...YotpoReviews,
|
|
354
|
-
...BoldSubscriptions
|
|
467
|
+
...BoldSubscriptions,
|
|
468
|
+
...Growave,
|
|
469
|
+
...KachingBundles
|
|
355
470
|
};
|
|
356
471
|
|
|
357
472
|
export { composeSettingsByWidgetType, overrideSettings };
|