@gem-sdk/core 1.51.0 → 1.53.0-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/ComponentToolbarPreview.js +115 -104
- package/dist/cjs/components/ComponentWrapperPreview.js +16 -2
- package/dist/cjs/components/InteractionSuffix.js +115 -0
- package/dist/cjs/components/Render.liquid.js +21 -7
- package/dist/cjs/contexts/PageContext.js +29 -1
- 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/compose-advance-style.js +6 -3
- package/dist/cjs/helpers/interaction/index.js +66 -0
- package/dist/cjs/helpers/shadow.js +15 -3
- package/dist/cjs/helpers/third-party/appConfig.js +7 -0
- package/dist/cjs/helpers/third-party/appSetting.js +7 -0
- package/dist/cjs/helpers/third-party/constant.js +2 -1
- package/dist/cjs/helpers/typography.js +4 -3
- package/dist/cjs/hooks/animation/useApplyAnimation.js +2 -0
- package/dist/cjs/hooks/useInteraction.js +19 -0
- package/dist/cjs/index.js +14 -0
- package/dist/cjs/types/animations.js +2 -0
- package/dist/cjs/types/custom.js +51 -0
- package/dist/esm/components/ComponentToolbarPreview.js +115 -104
- package/dist/esm/components/ComponentWrapperPreview.js +16 -2
- package/dist/esm/components/InteractionSuffix.js +113 -0
- package/dist/esm/components/Render.liquid.js +21 -7
- package/dist/esm/contexts/PageContext.js +29 -1
- 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/compose-advance-style.js +7 -4
- package/dist/esm/helpers/interaction/index.js +64 -0
- package/dist/esm/helpers/shadow.js +15 -4
- package/dist/esm/helpers/third-party/appConfig.js +7 -1
- package/dist/esm/helpers/third-party/appSetting.js +7 -0
- package/dist/esm/helpers/third-party/constant.js +3 -2
- package/dist/esm/helpers/typography.js +4 -3
- package/dist/esm/hooks/animation/useApplyAnimation.js +2 -0
- package/dist/esm/hooks/useInteraction.js +17 -0
- package/dist/esm/index.js +4 -1
- package/dist/esm/types/animations.js +2 -0
- package/dist/esm/types/custom.js +51 -0
- package/dist/types/index.d.ts +4863 -890
- package/package.json +3 -3
|
@@ -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;
|
|
@@ -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 };
|
|
@@ -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 };
|
|
@@ -100,5 +100,11 @@ const JunipProductReviewsUgcConfig = {
|
|
|
100
100
|
appId: 'dc14f5a8-ed15-41b1-ad08-cfba23f9789b'
|
|
101
101
|
}
|
|
102
102
|
};
|
|
103
|
+
const PreorderNowWodPresaleConfig = {
|
|
104
|
+
PreorderNowWodPresale: {
|
|
105
|
+
appName: 'preorder-now-wod-presale',
|
|
106
|
+
appId: 'fdf17d17-ef12-4a7b-8383-20cc1fc2a4b6'
|
|
107
|
+
}
|
|
108
|
+
};
|
|
103
109
|
|
|
104
|
-
export { BonLoyaltyRewardsReferralsConfig, EasyBundleBuilderSkailamaConfig, FastBundleBundlesDiscountsConfig, FlyBundlesUpsellsFbtConfig, JunipProductReviewsUgcConfig, KiteFreeGiftDiscountConfig, LoopSubscriptionsConfig, PreorderNowPreOrderPqConfig, PumperBundlesVolumeDiscountConfig, RechargeSubscriptionsConfig, ReviewxpoProductReviewsAppConfig, SelleasyConfig, ShopifyFormsConfig, SimpleBundlesKitsConfig, SkioSubscriptionsYcS20Config, SubifySubscriptionsConfig, UnlimitedBundlesDiscountsConfig };
|
|
110
|
+
export { BonLoyaltyRewardsReferralsConfig, EasyBundleBuilderSkailamaConfig, FastBundleBundlesDiscountsConfig, FlyBundlesUpsellsFbtConfig, JunipProductReviewsUgcConfig, KiteFreeGiftDiscountConfig, LoopSubscriptionsConfig, PreorderNowPreOrderPqConfig, PreorderNowWodPresaleConfig, PumperBundlesVolumeDiscountConfig, RechargeSubscriptionsConfig, ReviewxpoProductReviewsAppConfig, SelleasyConfig, ShopifyFormsConfig, SimpleBundlesKitsConfig, SkioSubscriptionsYcS20Config, SubifySubscriptionsConfig, UnlimitedBundlesDiscountsConfig };
|
|
@@ -189,9 +189,16 @@ const JunipProductReviewsUgc = {
|
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
};
|
|
192
|
+
const PreorderNowWodPresale = {
|
|
193
|
+
PreorderNowWodPresale: {
|
|
194
|
+
'app-block': null,
|
|
195
|
+
'popups-block': null
|
|
196
|
+
}
|
|
197
|
+
};
|
|
192
198
|
const composeSettingsByWidgetType = {
|
|
193
199
|
...JunipProductReviewsUgc,
|
|
194
200
|
...FlyBundlesUpsellsFbt,
|
|
201
|
+
...PreorderNowWodPresale,
|
|
195
202
|
...PreorderNowPreOrderPq,
|
|
196
203
|
...EasyBundleBuilderSkailama,
|
|
197
204
|
...FastBundleBundlesDiscounts,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RechargeSubscriptionsConfig, BonLoyaltyRewardsReferralsConfig, SubifySubscriptionsConfig, SelleasyConfig, LoopSubscriptionsConfig, SkioSubscriptionsYcS20Config, ShopifyFormsConfig, ReviewxpoProductReviewsAppConfig, PumperBundlesVolumeDiscountConfig, UnlimitedBundlesDiscountsConfig, KiteFreeGiftDiscountConfig, FastBundleBundlesDiscountsConfig, SimpleBundlesKitsConfig, EasyBundleBuilderSkailamaConfig, PreorderNowPreOrderPqConfig, FlyBundlesUpsellsFbtConfig, JunipProductReviewsUgcConfig } from './appConfig.js';
|
|
1
|
+
import { RechargeSubscriptionsConfig, BonLoyaltyRewardsReferralsConfig, SubifySubscriptionsConfig, SelleasyConfig, LoopSubscriptionsConfig, SkioSubscriptionsYcS20Config, ShopifyFormsConfig, ReviewxpoProductReviewsAppConfig, PumperBundlesVolumeDiscountConfig, UnlimitedBundlesDiscountsConfig, KiteFreeGiftDiscountConfig, FastBundleBundlesDiscountsConfig, SimpleBundlesKitsConfig, EasyBundleBuilderSkailamaConfig, PreorderNowPreOrderPqConfig, FlyBundlesUpsellsFbtConfig, JunipProductReviewsUgcConfig, PreorderNowWodPresaleConfig } from './appConfig.js';
|
|
2
2
|
|
|
3
3
|
const mapShopifyAppMeta = {
|
|
4
4
|
...RechargeSubscriptionsConfig,
|
|
@@ -17,7 +17,8 @@ const mapShopifyAppMeta = {
|
|
|
17
17
|
...EasyBundleBuilderSkailamaConfig,
|
|
18
18
|
...PreorderNowPreOrderPqConfig,
|
|
19
19
|
...FlyBundlesUpsellsFbtConfig,
|
|
20
|
-
...JunipProductReviewsUgcConfig
|
|
20
|
+
...JunipProductReviewsUgcConfig,
|
|
21
|
+
...PreorderNowWodPresaleConfig
|
|
21
22
|
};
|
|
22
23
|
const THIRD_PARTY_APP_BLOCK_ID_PREFIX = 'gp_app';
|
|
23
24
|
|
|
@@ -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,7 +75,7 @@ const composeTypographyV2 = (value, attrs)=>{
|
|
|
74
75
|
});
|
|
75
76
|
};
|
|
76
77
|
const composeFontFamilyTypographyV2 = (value)=>{
|
|
77
|
-
const { fontFamily, isCustom, fallbackFontFamily } = value || {};
|
|
78
|
+
const { fontFamily, isCustom, fallbackFontFamily, type } = value || {};
|
|
78
79
|
if (!fontFamily) {
|
|
79
80
|
return isCustom ? fallbackFontFamily : undefined;
|
|
80
81
|
}
|
|
@@ -91,7 +92,7 @@ const composeFontFamilyTypographyV2 = (value)=>{
|
|
|
91
92
|
default:
|
|
92
93
|
return getFontUsedByTypographyV2({
|
|
93
94
|
fontFamily: fontFamily.value,
|
|
94
|
-
fallbackFontFamily:
|
|
95
|
+
fallbackFontFamily: composeFallbackTypographyStyle(type ?? 'heading')
|
|
95
96
|
});
|
|
96
97
|
}
|
|
97
98
|
}
|
|
@@ -4,6 +4,7 @@ import { useAnimationTarget } from './useAnimationTarget.js';
|
|
|
4
4
|
import { useAnimationConfig } from './useAnimationConfig.js';
|
|
5
5
|
import { useAnimationActions } from './useAnimationActions.js';
|
|
6
6
|
import { useAnimationPreview } from './useAnimationPreview.js';
|
|
7
|
+
import '../../types/custom.js';
|
|
7
8
|
import { AnimationType } from '../../types/animations.js';
|
|
8
9
|
|
|
9
10
|
const useApplyAnimation = ({ props })=>{
|
|
@@ -36,6 +37,7 @@ const useApplyAnimation = ({ props })=>{
|
|
|
36
37
|
setting,
|
|
37
38
|
target: item.target
|
|
38
39
|
}));
|
|
40
|
+
console.log('listAnimations', listAnimations);
|
|
39
41
|
cancelAnimation();
|
|
40
42
|
setAnimation(listAnimations);
|
|
41
43
|
}, [
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { usePageStore } from '../contexts/PageContext.js';
|
|
2
|
+
|
|
3
|
+
const useInteraction = ()=>{
|
|
4
|
+
const interactionData = usePageStore((state)=>state.interactionData);
|
|
5
|
+
const { item } = interactionData || {};
|
|
6
|
+
const getAnimationByUid = (uid)=>{
|
|
7
|
+
const targets = item?.targets;
|
|
8
|
+
const targetByUid = targets?.find((target)=>target.uid === uid);
|
|
9
|
+
const metaDataContainsAnimation = targetByUid?.events?.find((it)=>it.condition?.metaData?.animation);
|
|
10
|
+
return metaDataContainsAnimation?.condition?.metaData?.animation;
|
|
11
|
+
};
|
|
12
|
+
return {
|
|
13
|
+
getAnimationByUid
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { useInteraction };
|
package/dist/esm/index.js
CHANGED
|
@@ -28,6 +28,7 @@ export { LibraryTemplateDocument } from './graphql-app-api/queries/LibraryTempla
|
|
|
28
28
|
export { ThemePageDocument } from './graphql-app-api/queries/ThemePage.generated.js';
|
|
29
29
|
export { SaleFunnelDiscountsDocument } from './graphql-app-api/queries/SaleFunnelDiscounts.generated.js';
|
|
30
30
|
export { LibrarySaleFunnelDocument } from './graphql-app-api/queries/LibrarySaleFunnelDiscount.generated.js';
|
|
31
|
+
export { ShopLibraryPageDocument } from './graphql-app-api/queries/ShopLibraryPage.generated.js';
|
|
31
32
|
export { composeBorderCss, getBorderRadiusStyle, getBorderStyle, handleConvertBorderColor, handleConvertBorderStyle, handleConvertBorderWidth, handleConvertClassColor, handleConvertClassColorDynamicBtn } from './helpers/borders.js';
|
|
32
33
|
export { getCarouselContainerHeight, makeContainerWidthOrHeight, makeDotGapToCarouselStyle } from './helpers/carousel.js';
|
|
33
34
|
export { cls } from './helpers/cls.js';
|
|
@@ -66,7 +67,7 @@ export { checkAvailableVariantInStock, getSelectedVariant, parseSelectedOption }
|
|
|
66
67
|
export { generateCollectionQueryKey, generateProductQueryKey, generateProductsQueryKey } from './helpers/query.js';
|
|
67
68
|
export { composeCornerCss, composeRadius, composeRadiusResponsive, getCornerCSSFromGlobal, getCustomRadius, getRadiusCSSFromGlobal, getRadiusStyleActiveState } from './helpers/radius.js';
|
|
68
69
|
export { RenderIf, composeMemo, dataStringify, props, removeUndefinedValuesFromObject, styles, template } from './helpers/render.js';
|
|
69
|
-
export { composeShadowCss, getStyleShadow, getStyleShadowState, parseValueWithUnit } from './helpers/shadow.js';
|
|
70
|
+
export { composeShadowCss, getResonsiveStyleShadow, getStyleShadow, getStyleShadowState, parseValueWithUnit } from './helpers/shadow.js';
|
|
70
71
|
export { composeSize, composeSizeCss, genSizeClass, getAspectRatioGlobalSize, getGlobalSizeGap, getHeightByShapeGlobalSize, getPaddingGlobalSize, getValueByDevice, getWidthByShapeGlobalSize, getWidthHeightGlobalSize, makeGlobalSize, makeGlobalSizeIcon, makeStyleWithDefault } from './helpers/size.js';
|
|
71
72
|
export { composeFallbackTypographyStyle, composeFontFamilyTypographyV2, composeTypography, composeTypographyAttr, composeTypographyClassName, composeTypographyCss, composeTypographyStyle, composeTypographyV2, composeTypographyV2Css, genTypoClass } from './helpers/typography.js';
|
|
72
73
|
export { useAddToCart } from './hooks/cart/use-add-to-cart.js';
|
|
@@ -99,6 +100,7 @@ export { useProductList, useProductListProducts, useProductListSettings, useProd
|
|
|
99
100
|
export { default as useSuspenseFetch } from './hooks/useSuspenseFetch.js';
|
|
100
101
|
export { default as useSwatchesOptions } from './hooks/useSwatchesOptions.js';
|
|
101
102
|
export { default as useInitialSwatchesOptions } from './hooks/useInitialSwatchesOptions.js';
|
|
103
|
+
export { InteractionTargetEvent, InteractionTriggerEvent } from './types/custom.js';
|
|
102
104
|
import * as shop from './types/shop.js';
|
|
103
105
|
export { shop as ShopType };
|
|
104
106
|
import * as appAPI from './types/appAPI.js';
|
|
@@ -110,3 +112,4 @@ export { fetchMedias, fetchVariants, getProduct } from './helpers/queries/get-pr
|
|
|
110
112
|
export { getProductBySlug } from './helpers/queries/get-product-by-slug.js';
|
|
111
113
|
export { getAppBlocks } from './helpers/third-party/getAppBlocks.js';
|
|
112
114
|
export { addAppBlockId } from './helpers/third-party/addAppBlockId.js';
|
|
115
|
+
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) {
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
var InteractionTargetEvent;
|
|
2
|
+
(function(InteractionTargetEvent) {
|
|
3
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:change-background-color'] = 0] = 'gp:change-background-color';
|
|
4
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:run-animation'] = 1] = 'gp:run-animation';
|
|
5
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:toggle-element-visibility'] = 2] = 'gp:toggle-element-visibility';
|
|
6
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:change-text'] = 3] = 'gp:change-text';
|
|
7
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:scroll-to'] = 4] = 'gp:scroll-to';
|
|
8
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:change-text-style'] = 5] = 'gp:change-text-style';
|
|
9
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:change-content'] = 6] = 'gp:change-content';
|
|
10
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:change-button-style'] = 7] = 'gp:change-button-style';
|
|
11
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:copy-text'] = 8] = 'gp:copy-text';
|
|
12
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:change-image'] = 9] = 'gp:change-image';
|
|
13
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:toggle-video-play'] = 10] = 'gp:toggle-video-play';
|
|
14
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:change-slider-ratio'] = 11] = 'gp:change-slider-ratio';
|
|
15
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:change-icon-style'] = 12] = 'gp:change-icon-style';
|
|
16
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:change-expanded-item'] = 13] = 'gp:change-expanded-item';
|
|
17
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:change-active-item'] = 14] = 'gp:change-active-item';
|
|
18
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:change-slide'] = 15] = 'gp:change-slide';
|
|
19
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:change-image-step'] = 16] = 'gp:change-image-step';
|
|
20
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:change-text-value'] = 17] = 'gp:change-text-value';
|
|
21
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:toggle-popup-open'] = 18] = 'gp:toggle-popup-open';
|
|
22
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:show-or-hide'] = 19] = 'gp:show-or-hide';
|
|
23
|
+
InteractionTargetEvent[InteractionTargetEvent['gp:change-banner'] = 20] = 'gp:change-banner';
|
|
24
|
+
})(InteractionTargetEvent || (InteractionTargetEvent = {}));
|
|
25
|
+
var InteractionTriggerEvent;
|
|
26
|
+
(function(InteractionTriggerEvent) {
|
|
27
|
+
InteractionTriggerEvent[InteractionTriggerEvent['click'] = 0] = 'click';
|
|
28
|
+
InteractionTriggerEvent[InteractionTriggerEvent["active"] = 1] = "active";
|
|
29
|
+
InteractionTriggerEvent[InteractionTriggerEvent['mouseover'] = 2] = 'mouseover';
|
|
30
|
+
InteractionTriggerEvent[InteractionTriggerEvent['gp:appear'] = 3] = 'gp:appear';
|
|
31
|
+
InteractionTriggerEvent[InteractionTriggerEvent['gp:item-selected'] = 4] = 'gp:item-selected';
|
|
32
|
+
InteractionTriggerEvent[InteractionTriggerEvent['gp:item-unselected'] = 5] = 'gp:item-unselected';
|
|
33
|
+
InteractionTriggerEvent[InteractionTriggerEvent['gp:item-hovered'] = 6] = 'gp:item-hovered';
|
|
34
|
+
InteractionTriggerEvent[InteractionTriggerEvent['gp:item-click'] = 7] = 'gp:item-click';
|
|
35
|
+
InteractionTriggerEvent[InteractionTriggerEvent['gp:after-submit'] = 8] = 'gp:after-submit';
|
|
36
|
+
InteractionTriggerEvent[InteractionTriggerEvent['gp:quantity-change'] = 9] = 'gp:quantity-change';
|
|
37
|
+
InteractionTriggerEvent[InteractionTriggerEvent['gp:after-checked-value'] = 10] = 'gp:after-checked-value';
|
|
38
|
+
InteractionTriggerEvent[InteractionTriggerEvent['gp:after-add-to-cart'] = 11] = 'gp:after-add-to-cart';
|
|
39
|
+
InteractionTriggerEvent[InteractionTriggerEvent['gp:popup-open'] = 12] = 'gp:popup-open';
|
|
40
|
+
InteractionTriggerEvent[InteractionTriggerEvent['gp:popup-close'] = 13] = 'gp:popup-close';
|
|
41
|
+
InteractionTriggerEvent[InteractionTriggerEvent['scroll-up'] = 14] = 'scroll-up';
|
|
42
|
+
InteractionTriggerEvent[InteractionTriggerEvent['scroll-down'] = 15] = 'scroll-down';
|
|
43
|
+
InteractionTriggerEvent[InteractionTriggerEvent['gp:price-change'] = 16] = 'gp:price-change';
|
|
44
|
+
InteractionTriggerEvent[InteractionTriggerEvent['gp:rollback-price-change'] = 17] = 'gp:rollback-price-change';
|
|
45
|
+
InteractionTriggerEvent[InteractionTriggerEvent['gp:compare-price-change'] = 18] = 'gp:compare-price-change';
|
|
46
|
+
InteractionTriggerEvent[InteractionTriggerEvent['gp:rollback:compare-price-change'] = 19] = 'gp:rollback:compare-price-change';
|
|
47
|
+
InteractionTriggerEvent[InteractionTriggerEvent['gp:stock-change'] = 20] = 'gp:stock-change';
|
|
48
|
+
InteractionTriggerEvent[InteractionTriggerEvent['gp:rollback:stock-change'] = 21] = 'gp:rollback:stock-change';
|
|
49
|
+
})(InteractionTriggerEvent || (InteractionTriggerEvent = {}));
|
|
50
|
+
|
|
51
|
+
export { InteractionTargetEvent, InteractionTriggerEvent };
|