@gem-sdk/core 1.48.0-dev.9 → 1.48.0-dev.91
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/InteractionSuffix.js +9 -1
- package/dist/cjs/components/Render.liquid.js +10 -4
- 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/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/appConfig.js +49 -0
- package/dist/cjs/helpers/third-party/appSetting.js +87 -0
- package/dist/cjs/helpers/third-party/constant.js +8 -1
- package/dist/cjs/helpers/typography.js +19 -15
- package/dist/cjs/index.js +4 -0
- package/dist/cjs/types/animations.js +2 -0
- package/dist/cjs/types/custom.js +1 -0
- package/dist/esm/components/InteractionSuffix.js +10 -2
- package/dist/esm/components/Render.liquid.js +10 -4
- 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/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/appConfig.js +43 -1
- package/dist/esm/helpers/third-party/appSetting.js +87 -0
- package/dist/esm/helpers/third-party/constant.js +9 -2
- package/dist/esm/helpers/typography.js +19 -16
- package/dist/esm/index.js +3 -2
- package/dist/esm/types/animations.js +2 -0
- package/dist/esm/types/custom.js +1 -0
- package/dist/types/index.d.ts +1981 -196
- package/package.json +3 -3
|
@@ -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
|
}),
|
|
@@ -55,7 +55,11 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
55
55
|
const customProps = {
|
|
56
56
|
extraFiles: {}
|
|
57
57
|
};
|
|
58
|
-
const
|
|
58
|
+
const d = item.advanced?.displayInitInteraction ?? item.advanced?.d;
|
|
59
|
+
const style = composeAdvanceStyle({
|
|
60
|
+
...item.advanced,
|
|
61
|
+
d
|
|
62
|
+
}, item.tag);
|
|
59
63
|
let liquid = '';
|
|
60
64
|
if (disableWrap.includes(item.tag)) {
|
|
61
65
|
liquid = RenderIf(item?.childrens?.length, ()=>{
|
|
@@ -215,7 +219,7 @@ const RenderCustomCode = (item)=>{
|
|
|
215
219
|
};
|
|
216
220
|
const appendAnimation = (props, liquid)=>{
|
|
217
221
|
const { advanced, tag } = props;
|
|
218
|
-
const { animation, op: opacity } = advanced ?? {};
|
|
222
|
+
const { animation, op: opacity, hasAnimationInteraction } = advanced ?? {};
|
|
219
223
|
const getAnimationType = (settings, type)=>{
|
|
220
224
|
return settings?.triggerConfig?.[type]?.animation ?? 'none';
|
|
221
225
|
};
|
|
@@ -229,7 +233,9 @@ const appendAnimation = (props, liquid)=>{
|
|
|
229
233
|
const hoverDesktop = getAnimationType(getSettingsByDevice('desktop'), 'hover');
|
|
230
234
|
const appearTablet = getAnimationType(getSettingsByDevice('tablet'), 'appear');
|
|
231
235
|
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';
|
|
236
|
+
const enableAnimation = animation?.desktop?.enabled && (appearDesktop !== 'none' || hoverDesktop !== 'none') || animation?.tablet?.enabled && appearTablet !== 'none' || animation?.mobile?.enabled && appearMobile !== 'none' || !!hasAnimationInteraction;
|
|
237
|
+
const enableAnimationWhenInit = animation?.desktop?.enabled && (appearDesktop !== 'none' || hoverDesktop !== 'none') || animation?.tablet?.enabled && appearTablet !== 'none' || animation?.mobile?.enabled && appearMobile !== 'none';
|
|
238
|
+
if (!enableAnimation) return liquid;
|
|
233
239
|
const getInitVisibility = (device)=>getSettingsByDevice(device)?.enabled && ![
|
|
234
240
|
'shake',
|
|
235
241
|
'none'
|
|
@@ -245,7 +251,7 @@ const appendAnimation = (props, liquid)=>{
|
|
|
245
251
|
config: animation,
|
|
246
252
|
tag,
|
|
247
253
|
opacity,
|
|
248
|
-
|
|
254
|
+
notEnableAnimationWhenInit: !enableAnimationWhenInit
|
|
249
255
|
})}'
|
|
250
256
|
style="${{
|
|
251
257
|
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
|
|
|
@@ -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 };
|
|
@@ -76,5 +76,47 @@ const SimpleBundlesKitsConfig = {
|
|
|
76
76
|
appId: 'e553276b-36b2-446d-b80a-aa47fe5f96ac'
|
|
77
77
|
}
|
|
78
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
|
+
};
|
|
79
121
|
|
|
80
|
-
export { BonLoyaltyRewardsReferralsConfig, FastBundleBundlesDiscountsConfig, KiteFreeGiftDiscountConfig, LoopSubscriptionsConfig, PumperBundlesVolumeDiscountConfig, RechargeSubscriptionsConfig, ReviewxpoProductReviewsAppConfig, SelleasyConfig, ShopifyFormsConfig, SimpleBundlesKitsConfig, SkioSubscriptionsYcS20Config, SubifySubscriptionsConfig, UnlimitedBundlesDiscountsConfig };
|
|
122
|
+
export { AssortionUpsellBundlesConfig, BonLoyaltyRewardsReferralsConfig, EasyBundleBuilderSkailamaConfig, FastBundleBundlesDiscountsConfig, FlyBundlesUpsellsFbtConfig, JunipProductReviewsUgcConfig, KPreorderNowPartialPaymentConfig, KiteFreeGiftDiscountConfig, LoopSubscriptionsConfig, PreorderNowPreOrderPqConfig, PreorderNowWodPresaleConfig, PumperBundlesVolumeDiscountConfig, RechargeSubscriptionsConfig, ReviewxpoProductReviewsAppConfig, SelleasyConfig, ShopifyFormsConfig, SimpleBundlesKitsConfig, SkioSubscriptionsYcS20Config, SubifySubscriptionsConfig, UnlimitedBundlesDiscountsConfig };
|
|
@@ -79,6 +79,13 @@ const overrideSettings = (tag, currentSetting, appSetting)=>{
|
|
|
79
79
|
...currentSetting,
|
|
80
80
|
form_id: appSetting['formId']
|
|
81
81
|
};
|
|
82
|
+
case 'FlyBundlesUpsellsFbt':
|
|
83
|
+
{
|
|
84
|
+
return {
|
|
85
|
+
...currentSetting,
|
|
86
|
+
bundle_id: appSetting?.['customBundleId']
|
|
87
|
+
};
|
|
88
|
+
}
|
|
82
89
|
default:
|
|
83
90
|
return currentSetting;
|
|
84
91
|
}
|
|
@@ -127,7 +134,87 @@ const SimpleBundlesKits = {
|
|
|
127
134
|
'infinite-options-selector': null
|
|
128
135
|
}
|
|
129
136
|
};
|
|
137
|
+
const EasyBundleBuilderSkailama = {
|
|
138
|
+
EasyBundleBuilderSkailama: {
|
|
139
|
+
'app-block-bundlePage': null
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
const AssortionUpsellBundles = {
|
|
143
|
+
AssortionUpsellBundles: {
|
|
144
|
+
volume: null,
|
|
145
|
+
bundle: null,
|
|
146
|
+
addon: null
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
const PreorderNowPreOrderPq = {
|
|
150
|
+
PreorderNowPreOrderPq: {
|
|
151
|
+
'app-block-notifyapp-block-notify': null,
|
|
152
|
+
'app-block-partial': null,
|
|
153
|
+
'app-block-timer': null,
|
|
154
|
+
'app-block': null
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
const KPreorderNowPartialPayment = {
|
|
158
|
+
KPreorderNowPartialPayment: {
|
|
159
|
+
'kaktus-bundle': null
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
const FlyBundlesUpsellsFbt = {
|
|
163
|
+
FlyBundlesUpsellsFbt: {
|
|
164
|
+
'app-block-volume': null,
|
|
165
|
+
'app-block-upsell-block': null,
|
|
166
|
+
'app-block-fbt': null,
|
|
167
|
+
'app-block-custom': {
|
|
168
|
+
bundle_id: ''
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
const PreorderNowWodPresale = {
|
|
173
|
+
PreorderNowWodPresale: {
|
|
174
|
+
'app-block': null,
|
|
175
|
+
'popups-block': null
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
const JunipProductReviewsUgc = {
|
|
179
|
+
JunipProductReviewsUgc: {
|
|
180
|
+
'junip-review-carousel': {
|
|
181
|
+
reviewsType: 'product_reviews',
|
|
182
|
+
showSummary: true,
|
|
183
|
+
title: 'Reviews',
|
|
184
|
+
paddingTop: 48,
|
|
185
|
+
paddingBottom: 48,
|
|
186
|
+
containerClass: ''
|
|
187
|
+
},
|
|
188
|
+
'junip-ugc-gallery': {
|
|
189
|
+
layout: 'scroll',
|
|
190
|
+
title: '',
|
|
191
|
+
paddingTop: 48,
|
|
192
|
+
paddingBottom: 48,
|
|
193
|
+
containerClass: ''
|
|
194
|
+
},
|
|
195
|
+
'junip-product-review': {
|
|
196
|
+
product: '{{product}}'
|
|
197
|
+
},
|
|
198
|
+
'junip-product-summary': {
|
|
199
|
+
product: '{{product}}'
|
|
200
|
+
},
|
|
201
|
+
'junip-reviews': {
|
|
202
|
+
layout: 'list',
|
|
203
|
+
reviewsType: 'all',
|
|
204
|
+
showSummary: true,
|
|
205
|
+
reviewsCount: 10,
|
|
206
|
+
containerClass: ''
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
};
|
|
130
210
|
const composeSettingsByWidgetType = {
|
|
211
|
+
...JunipProductReviewsUgc,
|
|
212
|
+
...FlyBundlesUpsellsFbt,
|
|
213
|
+
...PreorderNowWodPresale,
|
|
214
|
+
...KPreorderNowPartialPayment,
|
|
215
|
+
...PreorderNowPreOrderPq,
|
|
216
|
+
...AssortionUpsellBundles,
|
|
217
|
+
...EasyBundleBuilderSkailama,
|
|
131
218
|
...FastBundleBundlesDiscounts,
|
|
132
219
|
...KiteFreeGiftDiscount,
|
|
133
220
|
...UnlimitedBundlesDiscounts,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RechargeSubscriptionsConfig, BonLoyaltyRewardsReferralsConfig, SubifySubscriptionsConfig, SelleasyConfig, LoopSubscriptionsConfig, SkioSubscriptionsYcS20Config, ShopifyFormsConfig, ReviewxpoProductReviewsAppConfig, PumperBundlesVolumeDiscountConfig, UnlimitedBundlesDiscountsConfig, KiteFreeGiftDiscountConfig, FastBundleBundlesDiscountsConfig, SimpleBundlesKitsConfig } from './appConfig.js';
|
|
1
|
+
import { RechargeSubscriptionsConfig, BonLoyaltyRewardsReferralsConfig, SubifySubscriptionsConfig, SelleasyConfig, LoopSubscriptionsConfig, SkioSubscriptionsYcS20Config, ShopifyFormsConfig, ReviewxpoProductReviewsAppConfig, PumperBundlesVolumeDiscountConfig, UnlimitedBundlesDiscountsConfig, KiteFreeGiftDiscountConfig, FastBundleBundlesDiscountsConfig, SimpleBundlesKitsConfig, EasyBundleBuilderSkailamaConfig, AssortionUpsellBundlesConfig, PreorderNowPreOrderPqConfig, KPreorderNowPartialPaymentConfig, FlyBundlesUpsellsFbtConfig, PreorderNowWodPresaleConfig, JunipProductReviewsUgcConfig } from './appConfig.js';
|
|
2
2
|
|
|
3
3
|
const mapShopifyAppMeta = {
|
|
4
4
|
...RechargeSubscriptionsConfig,
|
|
@@ -13,7 +13,14 @@ const mapShopifyAppMeta = {
|
|
|
13
13
|
...UnlimitedBundlesDiscountsConfig,
|
|
14
14
|
...KiteFreeGiftDiscountConfig,
|
|
15
15
|
...FastBundleBundlesDiscountsConfig,
|
|
16
|
-
...SimpleBundlesKitsConfig
|
|
16
|
+
...SimpleBundlesKitsConfig,
|
|
17
|
+
...EasyBundleBuilderSkailamaConfig,
|
|
18
|
+
...AssortionUpsellBundlesConfig,
|
|
19
|
+
...PreorderNowPreOrderPqConfig,
|
|
20
|
+
...KPreorderNowPartialPaymentConfig,
|
|
21
|
+
...FlyBundlesUpsellsFbtConfig,
|
|
22
|
+
...PreorderNowWodPresaleConfig,
|
|
23
|
+
...JunipProductReviewsUgcConfig
|
|
17
24
|
};
|
|
18
25
|
const THIRD_PARTY_APP_BLOCK_ID_PREFIX = 'gp_app';
|
|
19
26
|
|
|
@@ -26,7 +26,8 @@ const composeTypographyV2Css = (typography, isImportant)=>{
|
|
|
26
26
|
const composeImportant = isImportant ? '!important' : '';
|
|
27
27
|
return `
|
|
28
28
|
${fontFamily ? `font-family: ${composeFontFamilyTypographyV2({
|
|
29
|
-
fontFamily
|
|
29
|
+
fontFamily,
|
|
30
|
+
type: typography?.type
|
|
30
31
|
})} ${composeImportant}` : ''};
|
|
31
32
|
${fontSize?.desktop ? `font-size: ${fontSize?.desktop} ${composeImportant}` : ''};
|
|
32
33
|
${bold ? `font-weight: bold ${composeImportant}` : fontWeight ? `font-weight: ${fontWeight} ${composeImportant}` : ''};
|
|
@@ -74,8 +75,10 @@ const composeTypographyV2 = (value, attrs)=>{
|
|
|
74
75
|
});
|
|
75
76
|
};
|
|
76
77
|
const composeFontFamilyTypographyV2 = (value)=>{
|
|
77
|
-
const fontFamily = value
|
|
78
|
-
if (!fontFamily)
|
|
78
|
+
const { fontFamily, isCustom, fallbackFontFamily, type } = value || {};
|
|
79
|
+
if (!fontFamily) {
|
|
80
|
+
return isCustom ? fallbackFontFamily : undefined;
|
|
81
|
+
}
|
|
79
82
|
if (typeof fontFamily === 'string') {
|
|
80
83
|
return getFontUsedByTypographyV2({
|
|
81
84
|
fontFamily,
|
|
@@ -89,7 +92,7 @@ const composeFontFamilyTypographyV2 = (value)=>{
|
|
|
89
92
|
default:
|
|
90
93
|
return getFontUsedByTypographyV2({
|
|
91
94
|
fontFamily: fontFamily.value,
|
|
92
|
-
fallbackFontFamily:
|
|
95
|
+
fallbackFontFamily: composeFallbackTypographyStyle(type ?? 'heading')
|
|
93
96
|
});
|
|
94
97
|
}
|
|
95
98
|
}
|
|
@@ -114,18 +117,10 @@ const composeTypographyAttr = (attrs)=>{
|
|
|
114
117
|
});
|
|
115
118
|
};
|
|
116
119
|
const composeTypographyClassName = (typo, typography)=>{
|
|
117
|
-
return typo ? typo?.type && !typo.custom ? genTypoClass(typo.type) : '' : typography?.type && genTypoClass(typography?.type);
|
|
120
|
+
return typo ? typo?.type && !isCustomTypo(typo.custom) ? genTypoClass(typo.type) : '' : typography?.type && genTypoClass(typography?.type);
|
|
118
121
|
};
|
|
119
122
|
const composeFallbackTypographyStyle = (tag)=>{
|
|
120
|
-
if (
|
|
121
|
-
'heading',
|
|
122
|
-
'heading-1',
|
|
123
|
-
'heading-2',
|
|
124
|
-
'heading-3',
|
|
125
|
-
'heading-4',
|
|
126
|
-
'heading-5',
|
|
127
|
-
'heading-6'
|
|
128
|
-
].includes(tag)) {
|
|
123
|
+
if (tag.toLocaleLowerCase().includes('heading')) {
|
|
129
124
|
return 'var(--g-font-heading, heading)';
|
|
130
125
|
}
|
|
131
126
|
return 'var(--g-font-body, body)';
|
|
@@ -135,7 +130,8 @@ const composeTypographyStyle = (typo, typography, disableAttr)=>{
|
|
|
135
130
|
const fallbackFontFamily = composeFallbackTypographyStyle(typo.type ?? 'heading');
|
|
136
131
|
const customTypo = {
|
|
137
132
|
...typo.custom,
|
|
138
|
-
fallbackFontFamily: fallbackFontFamily
|
|
133
|
+
fallbackFontFamily: fallbackFontFamily,
|
|
134
|
+
isCustom: isCustomTypo(typo.custom)
|
|
139
135
|
};
|
|
140
136
|
return {
|
|
141
137
|
...composeTypographyV2(customTypo, typo.attrs),
|
|
@@ -146,5 +142,12 @@ const composeTypographyStyle = (typo, typography, disableAttr)=>{
|
|
|
146
142
|
...!typography?.type ? composeTypography(typography?.custom) : {}
|
|
147
143
|
};
|
|
148
144
|
};
|
|
145
|
+
const isCustomTypo = (customTypo)=>{
|
|
146
|
+
return customTypo && Object.keys(customTypo).length > 1 || customTypo && Object.keys(customTypo).length === 1 && !customTypo.fontSize;
|
|
147
|
+
};
|
|
148
|
+
const getSeoTagFromTypo = (typo)=>{
|
|
149
|
+
if (!typo?.attrs?.seoTagValue) return 'div';
|
|
150
|
+
return typo?.attrs?.seoTagValue;
|
|
151
|
+
};
|
|
149
152
|
|
|
150
|
-
export { composeFallbackTypographyStyle, composeFontFamilyTypographyV2, composeTypography, composeTypographyAttr, composeTypographyClassName, composeTypographyCss, composeTypographyStyle, composeTypographyV2, composeTypographyV2Css, genTypoClass };
|
|
153
|
+
export { composeFallbackTypographyStyle, composeFontFamilyTypographyV2, composeTypography, composeTypographyAttr, composeTypographyClassName, composeTypographyCss, composeTypographyStyle, composeTypographyV2, composeTypographyV2Css, genTypoClass, getSeoTagFromTypo };
|
package/dist/esm/index.js
CHANGED
|
@@ -66,9 +66,9 @@ export { checkAvailableVariantInStock, getSelectedVariant, parseSelectedOption }
|
|
|
66
66
|
export { generateCollectionQueryKey, generateProductQueryKey, generateProductsQueryKey } from './helpers/query.js';
|
|
67
67
|
export { composeCornerCss, composeRadius, composeRadiusResponsive, getCornerCSSFromGlobal, getCustomRadius, getRadiusCSSFromGlobal, getRadiusStyleActiveState } from './helpers/radius.js';
|
|
68
68
|
export { RenderIf, composeMemo, dataStringify, props, removeUndefinedValuesFromObject, styles, template } from './helpers/render.js';
|
|
69
|
-
export { composeShadowCss, getStyleShadow, getStyleShadowState, parseValueWithUnit } from './helpers/shadow.js';
|
|
69
|
+
export { composeShadowCss, getResonsiveStyleShadow, getStyleShadow, getStyleShadowState, parseValueWithUnit } from './helpers/shadow.js';
|
|
70
70
|
export { composeSize, composeSizeCss, genSizeClass, getAspectRatioGlobalSize, getGlobalSizeGap, getHeightByShapeGlobalSize, getPaddingGlobalSize, getValueByDevice, getWidthByShapeGlobalSize, getWidthHeightGlobalSize, makeGlobalSize, makeGlobalSizeIcon, makeStyleWithDefault } from './helpers/size.js';
|
|
71
|
-
export { composeFallbackTypographyStyle, composeFontFamilyTypographyV2, composeTypography, composeTypographyAttr, composeTypographyClassName, composeTypographyCss, composeTypographyStyle, composeTypographyV2, composeTypographyV2Css, genTypoClass } from './helpers/typography.js';
|
|
71
|
+
export { composeFallbackTypographyStyle, composeFontFamilyTypographyV2, composeTypography, composeTypographyAttr, composeTypographyClassName, composeTypographyCss, composeTypographyStyle, composeTypographyV2, composeTypographyV2Css, genTypoClass, getSeoTagFromTypo } from './helpers/typography.js';
|
|
72
72
|
export { useAddToCart } from './hooks/cart/use-add-to-cart.js';
|
|
73
73
|
export { useCartData } from './hooks/cart/use-cart-data.js';
|
|
74
74
|
export { useCartDiscountCodesUpdate } from './hooks/cart/use-cart-discount-codes-update.js';
|
|
@@ -111,3 +111,4 @@ export { fetchMedias, fetchVariants, getProduct } from './helpers/queries/get-pr
|
|
|
111
111
|
export { getProductBySlug } from './helpers/queries/get-product-by-slug.js';
|
|
112
112
|
export { getAppBlocks } from './helpers/third-party/getAppBlocks.js';
|
|
113
113
|
export { addAppBlockId } from './helpers/third-party/addAppBlockId.js';
|
|
114
|
+
export { useInteraction } from './helpers/interaction/index.js';
|
|
@@ -30,6 +30,8 @@ var AnimationTriggerType;
|
|
|
30
30
|
(function(AnimationTriggerType) {
|
|
31
31
|
AnimationTriggerType["Appear"] = 'appear';
|
|
32
32
|
AnimationTriggerType["Hover"] = 'hover';
|
|
33
|
+
AnimationTriggerType["Hidden"] = 'hidden';
|
|
34
|
+
AnimationTriggerType["AppearByTrigger"] = 'appearByTrigger';
|
|
33
35
|
})(AnimationTriggerType || (AnimationTriggerType = {}));
|
|
34
36
|
var AnimationZoomDirectionType;
|
|
35
37
|
(function(AnimationZoomDirectionType) {
|
package/dist/esm/types/custom.js
CHANGED
|
@@ -20,6 +20,7 @@ var InteractionTargetEvent;
|
|
|
20
20
|
InteractionTargetEvent[InteractionTargetEvent['gp:change-text-value'] = 17] = 'gp:change-text-value';
|
|
21
21
|
InteractionTargetEvent[InteractionTargetEvent['gp:toggle-popup-open'] = 18] = 'gp:toggle-popup-open';
|
|
22
22
|
InteractionTargetEvent[InteractionTargetEvent['gp:show-or-hide'] = 19] = 'gp:show-or-hide';
|
|
23
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:change-banner'] = 20] = 'gp:change-banner';
|
|
23
24
|
})(InteractionTargetEvent || (InteractionTargetEvent = {}));
|
|
24
25
|
var InteractionTriggerEvent;
|
|
25
26
|
(function(InteractionTriggerEvent) {
|