@gem-sdk/core 1.50.2 → 1.51.0-staging.56
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/RenderPreview.js +1 -0
- package/dist/cjs/components/constant.js +2 -1
- package/dist/cjs/contexts/SectionContext.js +0 -1
- package/dist/cjs/graphql/fragments/product-little.generated.js +1 -0
- package/dist/cjs/helpers/align.js +19 -0
- package/dist/cjs/helpers/colors.js +1 -1
- package/dist/cjs/helpers/shadow.js +1 -1
- package/dist/cjs/helpers/third-party/appConfig.js +28 -0
- package/dist/cjs/helpers/third-party/appSetting.js +66 -0
- package/dist/cjs/helpers/third-party/constant.js +5 -1
- package/dist/cjs/helpers/typography.js +9 -5
- package/dist/cjs/hooks/useFormatMoney.js +61 -60
- package/dist/cjs/index.js +3 -0
- package/dist/esm/components/RenderPreview.js +1 -0
- package/dist/esm/components/constant.js +2 -1
- package/dist/esm/contexts/SectionContext.js +0 -1
- package/dist/esm/graphql/fragments/product-little.generated.js +1 -0
- package/dist/esm/helpers/align.js +17 -0
- package/dist/esm/helpers/colors.js +1 -1
- package/dist/esm/helpers/shadow.js +1 -1
- package/dist/esm/helpers/third-party/appConfig.js +25 -1
- package/dist/esm/helpers/third-party/appSetting.js +66 -0
- package/dist/esm/helpers/third-party/constant.js +6 -2
- package/dist/esm/helpers/typography.js +9 -5
- package/dist/esm/hooks/useFormatMoney.js +61 -61
- package/dist/esm/index.js +2 -1
- package/dist/types/index.d.ts +218 -4
- package/package.json +3 -3
|
@@ -45,6 +45,7 @@ const RenderPreview = ({ uid, ...passProps })=>{
|
|
|
45
45
|
setting: item.settings,
|
|
46
46
|
...passProps,
|
|
47
47
|
children: item.childrens.map((id)=>/*#__PURE__*/ jsxRuntime.jsx(RenderPreviewMemo, {
|
|
48
|
+
"bundle-item": passProps?.['bundle-item'],
|
|
48
49
|
uid: id
|
|
49
50
|
}, id))
|
|
50
51
|
}) : /*#__PURE__*/ jsxRuntime.jsx(Component, {
|
|
@@ -10,7 +10,6 @@ const SectionContext = /*#__PURE__*/ react.createContext(null);
|
|
|
10
10
|
const createSectionProvider = (data)=>zustand.createStore((set, get)=>({
|
|
11
11
|
data: data ?? {},
|
|
12
12
|
getSection: (id)=>{
|
|
13
|
-
console.log('get().data', get().data);
|
|
14
13
|
const section = get().data[id];
|
|
15
14
|
return section ?? undefined;
|
|
16
15
|
},
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const convertTextAlignToJustify = (align)=>{
|
|
4
|
+
const devices = [
|
|
5
|
+
'desktop',
|
|
6
|
+
'tablet',
|
|
7
|
+
'mobile'
|
|
8
|
+
];
|
|
9
|
+
const result = {};
|
|
10
|
+
devices.forEach((device)=>{
|
|
11
|
+
const deviceType = device === 'desktop' ? '' : `${device}:`;
|
|
12
|
+
result[`${deviceType}gp-justify-start`] = align?.[device] === 'left';
|
|
13
|
+
result[`${deviceType}gp-justify-center`] = align?.[device] === 'center';
|
|
14
|
+
result[`${deviceType}gp-justify-end`] = align?.[device] === 'right';
|
|
15
|
+
});
|
|
16
|
+
return result;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
exports.convertTextAlignToJustify = convertTextAlignToJustify;
|
|
@@ -119,7 +119,7 @@ const getGlobalColorStateStyle = (type, data)=>{
|
|
|
119
119
|
return Object.fromEntries(Object.entries(data).map(([state, value])=>{
|
|
120
120
|
if (state === 'active') return [];
|
|
121
121
|
return [
|
|
122
|
-
`-${constant.stateMapping?.[state]}-${type}`,
|
|
122
|
+
`-${constant.stateMapping?.[state] || ''}-${type}`,
|
|
123
123
|
getSingleColorVariable(value)
|
|
124
124
|
];
|
|
125
125
|
}).filter(isDefined.isDefined));
|
|
@@ -27,7 +27,7 @@ const getStyleShadow = (shadowStyle, isActiveState = false)=>{
|
|
|
27
27
|
if (typeof value.distance == 'undefined') return {};
|
|
28
28
|
const { value: distance, unit: unitDistance } = parseValueWithUnit(`${value?.distance}`);
|
|
29
29
|
return {
|
|
30
|
-
[`-${!isActiveState ? constant.stateMapping?.[state] : ''}-${getShortname.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 + ' ' : ''}${colors.getSingleColorVariable(value?.color)}` : 'none'
|
|
30
|
+
[`-${!isActiveState ? constant.stateMapping?.[state] || '' : ''}-${getShortname.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 + ' ' : ''}${colors.getSingleColorVariable(value?.color)}` : 'none'
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
33
|
const getStyleShadowState = (shadow, styleAppliedFor, isEnableShadow)=>{
|
|
@@ -78,11 +78,39 @@ const SimpleBundlesKitsConfig = {
|
|
|
78
78
|
appId: 'e553276b-36b2-446d-b80a-aa47fe5f96ac'
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
|
+
const EasyBundleBuilderSkailamaConfig = {
|
|
82
|
+
EasyBundleBuilderSkailama: {
|
|
83
|
+
appName: 'easy-bundles',
|
|
84
|
+
appId: '05b1325c-6303-4da5-8e2f-b13ab2a50e1a'
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
const PreorderNowPreOrderPqConfig = {
|
|
88
|
+
PreorderNowPreOrderPq: {
|
|
89
|
+
appName: 'preorder-now-pre-order-pq',
|
|
90
|
+
appId: '551fab2c-3af6-4a8f-ba21-736a71cb4540'
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
const FlyBundlesUpsellsFbtConfig = {
|
|
94
|
+
FlyBundlesUpsellsFbt: {
|
|
95
|
+
appName: 'fly-bundles-upsell',
|
|
96
|
+
appId: '26807bdc-c2ed-4a25-afb2-06e6b1ebf843'
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
const JunipProductReviewsUgcConfig = {
|
|
100
|
+
JunipProductReviewsUgc: {
|
|
101
|
+
appName: 'junip-product-reviews-ugc',
|
|
102
|
+
appId: 'dc14f5a8-ed15-41b1-ad08-cfba23f9789b'
|
|
103
|
+
}
|
|
104
|
+
};
|
|
81
105
|
|
|
82
106
|
exports.BonLoyaltyRewardsReferralsConfig = BonLoyaltyRewardsReferralsConfig;
|
|
107
|
+
exports.EasyBundleBuilderSkailamaConfig = EasyBundleBuilderSkailamaConfig;
|
|
83
108
|
exports.FastBundleBundlesDiscountsConfig = FastBundleBundlesDiscountsConfig;
|
|
109
|
+
exports.FlyBundlesUpsellsFbtConfig = FlyBundlesUpsellsFbtConfig;
|
|
110
|
+
exports.JunipProductReviewsUgcConfig = JunipProductReviewsUgcConfig;
|
|
84
111
|
exports.KiteFreeGiftDiscountConfig = KiteFreeGiftDiscountConfig;
|
|
85
112
|
exports.LoopSubscriptionsConfig = LoopSubscriptionsConfig;
|
|
113
|
+
exports.PreorderNowPreOrderPqConfig = PreorderNowPreOrderPqConfig;
|
|
86
114
|
exports.PumperBundlesVolumeDiscountConfig = PumperBundlesVolumeDiscountConfig;
|
|
87
115
|
exports.RechargeSubscriptionsConfig = RechargeSubscriptionsConfig;
|
|
88
116
|
exports.ReviewxpoProductReviewsAppConfig = ReviewxpoProductReviewsAppConfig;
|
|
@@ -81,6 +81,13 @@ const overrideSettings = (tag, currentSetting, appSetting)=>{
|
|
|
81
81
|
...currentSetting,
|
|
82
82
|
form_id: appSetting['formId']
|
|
83
83
|
};
|
|
84
|
+
case 'FlyBundlesUpsellsFbt':
|
|
85
|
+
{
|
|
86
|
+
return {
|
|
87
|
+
...currentSetting,
|
|
88
|
+
bundle_id: appSetting?.['customBundleId']
|
|
89
|
+
};
|
|
90
|
+
}
|
|
84
91
|
default:
|
|
85
92
|
return currentSetting;
|
|
86
93
|
}
|
|
@@ -129,7 +136,66 @@ const SimpleBundlesKits = {
|
|
|
129
136
|
'infinite-options-selector': null
|
|
130
137
|
}
|
|
131
138
|
};
|
|
139
|
+
const EasyBundleBuilderSkailama = {
|
|
140
|
+
EasyBundleBuilderSkailama: {
|
|
141
|
+
'app-block-bundlePage': null
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
const PreorderNowPreOrderPq = {
|
|
145
|
+
PreorderNowPreOrderPq: {
|
|
146
|
+
'app-block-notifyapp-block-notify': null,
|
|
147
|
+
'app-block-partial': null,
|
|
148
|
+
'app-block-timer': null,
|
|
149
|
+
'app-block': null
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
const FlyBundlesUpsellsFbt = {
|
|
153
|
+
FlyBundlesUpsellsFbt: {
|
|
154
|
+
'app-block-volume': null,
|
|
155
|
+
'app-block-upsell-block': null,
|
|
156
|
+
'app-block-fbt': null,
|
|
157
|
+
'app-block-custom': {
|
|
158
|
+
bundle_id: ''
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
const JunipProductReviewsUgc = {
|
|
163
|
+
JunipProductReviewsUgc: {
|
|
164
|
+
'junip-review-carousel': {
|
|
165
|
+
reviewsType: 'product_reviews',
|
|
166
|
+
showSummary: true,
|
|
167
|
+
title: 'Reviews',
|
|
168
|
+
paddingTop: 48,
|
|
169
|
+
paddingBottom: 48,
|
|
170
|
+
containerClass: ''
|
|
171
|
+
},
|
|
172
|
+
'junip-ugc-gallery': {
|
|
173
|
+
layout: 'scroll',
|
|
174
|
+
title: '',
|
|
175
|
+
paddingTop: 48,
|
|
176
|
+
paddingBottom: 48,
|
|
177
|
+
containerClass: ''
|
|
178
|
+
},
|
|
179
|
+
'junip-product-review': {
|
|
180
|
+
product: '{{product}}'
|
|
181
|
+
},
|
|
182
|
+
'junip-product-summary': {
|
|
183
|
+
product: '{{product}}'
|
|
184
|
+
},
|
|
185
|
+
'junip-reviews': {
|
|
186
|
+
layout: 'list',
|
|
187
|
+
reviewsType: 'all',
|
|
188
|
+
showSummary: true,
|
|
189
|
+
reviewsCount: 10,
|
|
190
|
+
containerClass: ''
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
};
|
|
132
194
|
const composeSettingsByWidgetType = {
|
|
195
|
+
...JunipProductReviewsUgc,
|
|
196
|
+
...FlyBundlesUpsellsFbt,
|
|
197
|
+
...PreorderNowPreOrderPq,
|
|
198
|
+
...EasyBundleBuilderSkailama,
|
|
133
199
|
...FastBundleBundlesDiscounts,
|
|
134
200
|
...KiteFreeGiftDiscount,
|
|
135
201
|
...UnlimitedBundlesDiscounts,
|
|
@@ -15,7 +15,11 @@ const mapShopifyAppMeta = {
|
|
|
15
15
|
...appConfig.UnlimitedBundlesDiscountsConfig,
|
|
16
16
|
...appConfig.KiteFreeGiftDiscountConfig,
|
|
17
17
|
...appConfig.FastBundleBundlesDiscountsConfig,
|
|
18
|
-
...appConfig.SimpleBundlesKitsConfig
|
|
18
|
+
...appConfig.SimpleBundlesKitsConfig,
|
|
19
|
+
...appConfig.EasyBundleBuilderSkailamaConfig,
|
|
20
|
+
...appConfig.PreorderNowPreOrderPqConfig,
|
|
21
|
+
...appConfig.FlyBundlesUpsellsFbtConfig,
|
|
22
|
+
...appConfig.JunipProductReviewsUgcConfig
|
|
19
23
|
};
|
|
20
24
|
const THIRD_PARTY_APP_BLOCK_ID_PREFIX = 'gp_app';
|
|
21
25
|
|
|
@@ -28,7 +28,8 @@ const composeTypographyV2Css = (typography, isImportant)=>{
|
|
|
28
28
|
const composeImportant = isImportant ? '!important' : '';
|
|
29
29
|
return `
|
|
30
30
|
${fontFamily ? `font-family: ${composeFontFamilyTypographyV2({
|
|
31
|
-
fontFamily
|
|
31
|
+
fontFamily,
|
|
32
|
+
type: typography?.type
|
|
32
33
|
})} ${composeImportant}` : ''};
|
|
33
34
|
${fontSize?.desktop ? `font-size: ${fontSize?.desktop} ${composeImportant}` : ''};
|
|
34
35
|
${bold ? `font-weight: bold ${composeImportant}` : fontWeight ? `font-weight: ${fontWeight} ${composeImportant}` : ''};
|
|
@@ -76,7 +77,7 @@ const composeTypographyV2 = (value, attrs)=>{
|
|
|
76
77
|
});
|
|
77
78
|
};
|
|
78
79
|
const composeFontFamilyTypographyV2 = (value)=>{
|
|
79
|
-
const { fontFamily, isCustom, fallbackFontFamily } = value || {};
|
|
80
|
+
const { fontFamily, isCustom, fallbackFontFamily, type } = value || {};
|
|
80
81
|
if (!fontFamily) {
|
|
81
82
|
return isCustom ? fallbackFontFamily : undefined;
|
|
82
83
|
}
|
|
@@ -93,7 +94,7 @@ const composeFontFamilyTypographyV2 = (value)=>{
|
|
|
93
94
|
default:
|
|
94
95
|
return getFontUsedByTypographyV2({
|
|
95
96
|
fontFamily: fontFamily.value,
|
|
96
|
-
fallbackFontFamily:
|
|
97
|
+
fallbackFontFamily: composeFallbackTypographyStyle(type ?? 'heading')
|
|
97
98
|
});
|
|
98
99
|
}
|
|
99
100
|
}
|
|
@@ -118,7 +119,7 @@ const composeTypographyAttr = (attrs)=>{
|
|
|
118
119
|
});
|
|
119
120
|
};
|
|
120
121
|
const composeTypographyClassName = (typo, typography)=>{
|
|
121
|
-
return typo ? typo?.type && !typo.custom ? genTypoClass(typo.type) : '' : typography?.type && genTypoClass(typography?.type);
|
|
122
|
+
return typo ? typo?.type && !isCustomTypo(typo.custom) ? genTypoClass(typo.type) : '' : typography?.type && genTypoClass(typography?.type);
|
|
122
123
|
};
|
|
123
124
|
const composeFallbackTypographyStyle = (tag)=>{
|
|
124
125
|
if (tag.toLocaleLowerCase().includes('heading')) {
|
|
@@ -132,7 +133,7 @@ const composeTypographyStyle = (typo, typography, disableAttr)=>{
|
|
|
132
133
|
const customTypo = {
|
|
133
134
|
...typo.custom,
|
|
134
135
|
fallbackFontFamily: fallbackFontFamily,
|
|
135
|
-
isCustom:
|
|
136
|
+
isCustom: isCustomTypo(typo.custom)
|
|
136
137
|
};
|
|
137
138
|
return {
|
|
138
139
|
...composeTypographyV2(customTypo, typo.attrs),
|
|
@@ -143,6 +144,9 @@ const composeTypographyStyle = (typo, typography, disableAttr)=>{
|
|
|
143
144
|
...!typography?.type ? composeTypography(typography?.custom) : {}
|
|
144
145
|
};
|
|
145
146
|
};
|
|
147
|
+
const isCustomTypo = (customTypo)=>{
|
|
148
|
+
return customTypo && Object.keys(customTypo).length > 1 || customTypo && Object.keys(customTypo).length === 1 && !customTypo.fontSize;
|
|
149
|
+
};
|
|
146
150
|
|
|
147
151
|
exports.composeFallbackTypographyStyle = composeFallbackTypographyStyle;
|
|
148
152
|
exports.composeFontFamilyTypographyV2 = composeFontFamilyTypographyV2;
|
|
@@ -5,70 +5,71 @@ var shop = require('./shop.js');
|
|
|
5
5
|
const shopifyPriceRounding = (amount, precision)=>{
|
|
6
6
|
return parseFloat(`${amount}`).toFixed(Number(precision) + 1).slice(0, -1);
|
|
7
7
|
};
|
|
8
|
+
const formatMoney = function(cents, format) {
|
|
9
|
+
let value = '';
|
|
10
|
+
const placeholderRegex = /\{\{\s*(\w+)\s*\}\}/;
|
|
11
|
+
const formatString = format || '${{amount}}';
|
|
12
|
+
/**
|
|
13
|
+
* check default
|
|
14
|
+
* @param opt opt
|
|
15
|
+
* @param def def
|
|
16
|
+
* @returns any
|
|
17
|
+
*/ function defaultOption(opt, def) {
|
|
18
|
+
return typeof opt == 'undefined' ? def : opt;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* formatWithDelimiters
|
|
22
|
+
* @param number number
|
|
23
|
+
* @param precision precision
|
|
24
|
+
* @param thousands thousands
|
|
25
|
+
* @param decimal decimal
|
|
26
|
+
* @returns any
|
|
27
|
+
*/ // eslint-disable-next-line max-params
|
|
28
|
+
function formatWithDelimiters(number, precision, thousands, decimal) {
|
|
29
|
+
precision = defaultOption(precision, 2);
|
|
30
|
+
thousands = defaultOption(thousands, ',');
|
|
31
|
+
decimal = defaultOption(decimal, '.');
|
|
32
|
+
if (isNaN(number) || number == null) {
|
|
33
|
+
return 0;
|
|
34
|
+
}
|
|
35
|
+
// shopify làm tròn bằng cách cắt đi các số ở đằng sau chứ không sử dụng toFixed để làm tròn như toán học
|
|
36
|
+
number = shopifyPriceRounding(number, Number(precision));
|
|
37
|
+
const parts = number.split('.'), dollars = parts[0]?.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1' + thousands), cents = parts[1] ? decimal + parts[1] : '';
|
|
38
|
+
return dollars + cents;
|
|
39
|
+
}
|
|
40
|
+
switch(formatString.match(placeholderRegex)[1]){
|
|
41
|
+
case 'amount':
|
|
42
|
+
value = formatWithDelimiters(cents, 2);
|
|
43
|
+
break;
|
|
44
|
+
case 'amount_no_decimals':
|
|
45
|
+
value = formatWithDelimiters(cents, 0);
|
|
46
|
+
break;
|
|
47
|
+
case 'amount_with_comma_separator':
|
|
48
|
+
value = formatWithDelimiters(cents, 2, '.', ',');
|
|
49
|
+
break;
|
|
50
|
+
case 'amount_no_decimals_with_comma_separator':
|
|
51
|
+
value = formatWithDelimiters(cents, 0, '.', ',');
|
|
52
|
+
break;
|
|
53
|
+
case 'amount_with_apostrophe_separator':
|
|
54
|
+
value = formatWithDelimiters(cents, 2, "'", '.');
|
|
55
|
+
break;
|
|
56
|
+
case 'amount_no_decimals_with_space_separator':
|
|
57
|
+
value = formatWithDelimiters(cents, 0, ' ');
|
|
58
|
+
break;
|
|
59
|
+
case 'amount_with_space_separator':
|
|
60
|
+
value = formatWithDelimiters(cents, 2, ' ', ',');
|
|
61
|
+
break;
|
|
62
|
+
case 'amount_with_period_and_space_separator':
|
|
63
|
+
value = formatWithDelimiters(cents, 2, ' ', '.');
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
return formatString.replace(placeholderRegex, value);
|
|
67
|
+
};
|
|
8
68
|
const useFormatMoney = (amount, withCurrency)=>{
|
|
9
69
|
const { moneyFormat, moneyWithCurrencyFormat } = shop.useMoneyFormat();
|
|
10
|
-
const formatMoney = function(cents, format) {
|
|
11
|
-
let value = '';
|
|
12
|
-
const placeholderRegex = /\{\{\s*(\w+)\s*\}\}/;
|
|
13
|
-
const formatString = format || '${{amount}}';
|
|
14
|
-
/**
|
|
15
|
-
* check default
|
|
16
|
-
* @param opt opt
|
|
17
|
-
* @param def def
|
|
18
|
-
* @returns any
|
|
19
|
-
*/ function defaultOption(opt, def) {
|
|
20
|
-
return typeof opt == 'undefined' ? def : opt;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* formatWithDelimiters
|
|
24
|
-
* @param number number
|
|
25
|
-
* @param precision precision
|
|
26
|
-
* @param thousands thousands
|
|
27
|
-
* @param decimal decimal
|
|
28
|
-
* @returns any
|
|
29
|
-
*/ // eslint-disable-next-line max-params
|
|
30
|
-
function formatWithDelimiters(number, precision, thousands, decimal) {
|
|
31
|
-
precision = defaultOption(precision, 2);
|
|
32
|
-
thousands = defaultOption(thousands, ',');
|
|
33
|
-
decimal = defaultOption(decimal, '.');
|
|
34
|
-
if (isNaN(number) || number == null) {
|
|
35
|
-
return 0;
|
|
36
|
-
}
|
|
37
|
-
// shopify làm tròn bằng cách cắt đi các số ở đằng sau chứ không sử dụng toFixed để làm tròn như toán học
|
|
38
|
-
number = shopifyPriceRounding(number, Number(precision));
|
|
39
|
-
const parts = number.split('.'), dollars = parts[0]?.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1' + thousands), cents = parts[1] ? decimal + parts[1] : '';
|
|
40
|
-
return dollars + cents;
|
|
41
|
-
}
|
|
42
|
-
switch(formatString.match(placeholderRegex)[1]){
|
|
43
|
-
case 'amount':
|
|
44
|
-
value = formatWithDelimiters(cents, 2);
|
|
45
|
-
break;
|
|
46
|
-
case 'amount_no_decimals':
|
|
47
|
-
value = formatWithDelimiters(cents, 0);
|
|
48
|
-
break;
|
|
49
|
-
case 'amount_with_comma_separator':
|
|
50
|
-
value = formatWithDelimiters(cents, 2, '.', ',');
|
|
51
|
-
break;
|
|
52
|
-
case 'amount_no_decimals_with_comma_separator':
|
|
53
|
-
value = formatWithDelimiters(cents, 0, '.', ',');
|
|
54
|
-
break;
|
|
55
|
-
case 'amount_with_apostrophe_separator':
|
|
56
|
-
value = formatWithDelimiters(cents, 2, "'", '.');
|
|
57
|
-
break;
|
|
58
|
-
case 'amount_no_decimals_with_space_separator':
|
|
59
|
-
value = formatWithDelimiters(cents, 0, ' ');
|
|
60
|
-
break;
|
|
61
|
-
case 'amount_with_space_separator':
|
|
62
|
-
value = formatWithDelimiters(cents, 2, ' ', ',');
|
|
63
|
-
break;
|
|
64
|
-
case 'amount_with_period_and_space_separator':
|
|
65
|
-
value = formatWithDelimiters(cents, 2, ' ', '.');
|
|
66
|
-
break;
|
|
67
|
-
}
|
|
68
|
-
return formatString.replace(placeholderRegex, value);
|
|
69
|
-
};
|
|
70
70
|
return withCurrency ? formatMoney(`${amount}`, moneyWithCurrencyFormat || moneyFormat) : formatMoney(`${amount}`, moneyFormat);
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
+
exports.formatMoney = formatMoney;
|
|
73
74
|
exports.shopifyPriceRounding = shopifyPriceRounding;
|
|
74
75
|
exports.useFormatMoney = useFormatMoney;
|
package/dist/cjs/index.js
CHANGED
|
@@ -60,6 +60,7 @@ var iconList = require('./helpers/icon-list.js');
|
|
|
60
60
|
var isDefined = require('./helpers/is-defined.js');
|
|
61
61
|
var layout = require('./helpers/layout.js');
|
|
62
62
|
var makeStyle = require('./helpers/make-style.js');
|
|
63
|
+
var align = require('./helpers/align.js');
|
|
63
64
|
var product = require('./helpers/product.js');
|
|
64
65
|
var query = require('./helpers/query.js');
|
|
65
66
|
var radius = require('./helpers/radius.js');
|
|
@@ -243,6 +244,7 @@ exports.makeStyleResponsiveState = makeStyle.makeStyleResponsiveState;
|
|
|
243
244
|
exports.makeStyleState = makeStyle.makeStyleState;
|
|
244
245
|
exports.makeWidth = makeStyle.makeWidth;
|
|
245
246
|
exports.removeNullUndefined = makeStyle.removeNullUndefined;
|
|
247
|
+
exports.convertTextAlignToJustify = align.convertTextAlignToJustify;
|
|
246
248
|
exports.checkAvailableVariantInStock = product.checkAvailableVariantInStock;
|
|
247
249
|
exports.getSelectedVariant = product.getSelectedVariant;
|
|
248
250
|
exports.parseSelectedOption = product.parseSelectedOption;
|
|
@@ -317,6 +319,7 @@ exports.useProductQuery = useProductQuery.useProductQuery;
|
|
|
317
319
|
exports.useProductsQuery = useProductsQuery.useProductsQuery;
|
|
318
320
|
exports.useProductsQueryAll = useProductsQuery.useProductsQueryAll;
|
|
319
321
|
exports.useCurrentDevice = useCurrentDevice.useCurrentDevice;
|
|
322
|
+
exports.formatMoney = useFormatMoney.formatMoney;
|
|
320
323
|
exports.shopifyPriceRounding = useFormatMoney.shopifyPriceRounding;
|
|
321
324
|
exports.useFormatMoney = useFormatMoney.useFormatMoney;
|
|
322
325
|
exports.useLazyVideo = useLazyVideo.useLazyVideo;
|
|
@@ -41,6 +41,7 @@ const RenderPreview = ({ uid, ...passProps })=>{
|
|
|
41
41
|
setting: item.settings,
|
|
42
42
|
...passProps,
|
|
43
43
|
children: item.childrens.map((id)=>/*#__PURE__*/ jsx(RenderPreviewMemo, {
|
|
44
|
+
"bundle-item": passProps?.['bundle-item'],
|
|
44
45
|
uid: id
|
|
45
46
|
}, id))
|
|
46
47
|
}) : /*#__PURE__*/ jsx(Component, {
|
|
@@ -8,7 +8,6 @@ const SectionContext = /*#__PURE__*/ createContext(null);
|
|
|
8
8
|
const createSectionProvider = (data)=>createStore((set, get)=>({
|
|
9
9
|
data: data ?? {},
|
|
10
10
|
getSection: (id)=>{
|
|
11
|
-
console.log('get().data', get().data);
|
|
12
11
|
const section = get().data[id];
|
|
13
12
|
return section ?? undefined;
|
|
14
13
|
},
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const convertTextAlignToJustify = (align)=>{
|
|
2
|
+
const devices = [
|
|
3
|
+
'desktop',
|
|
4
|
+
'tablet',
|
|
5
|
+
'mobile'
|
|
6
|
+
];
|
|
7
|
+
const result = {};
|
|
8
|
+
devices.forEach((device)=>{
|
|
9
|
+
const deviceType = device === 'desktop' ? '' : `${device}:`;
|
|
10
|
+
result[`${deviceType}gp-justify-start`] = align?.[device] === 'left';
|
|
11
|
+
result[`${deviceType}gp-justify-center`] = align?.[device] === 'center';
|
|
12
|
+
result[`${deviceType}gp-justify-end`] = align?.[device] === 'right';
|
|
13
|
+
});
|
|
14
|
+
return result;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { convertTextAlignToJustify };
|
|
@@ -117,7 +117,7 @@ const getGlobalColorStateStyle = (type, data)=>{
|
|
|
117
117
|
return Object.fromEntries(Object.entries(data).map(([state, value])=>{
|
|
118
118
|
if (state === 'active') return [];
|
|
119
119
|
return [
|
|
120
|
-
`-${stateMapping?.[state]}-${type}`,
|
|
120
|
+
`-${stateMapping?.[state] || ''}-${type}`,
|
|
121
121
|
getSingleColorVariable(value)
|
|
122
122
|
];
|
|
123
123
|
}).filter(isDefined));
|
|
@@ -25,7 +25,7 @@ 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)}`]: 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
31
|
const getStyleShadowState = (shadow, styleAppliedFor, isEnableShadow)=>{
|
|
@@ -76,5 +76,29 @@ 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 PreorderNowPreOrderPqConfig = {
|
|
86
|
+
PreorderNowPreOrderPq: {
|
|
87
|
+
appName: 'preorder-now-pre-order-pq',
|
|
88
|
+
appId: '551fab2c-3af6-4a8f-ba21-736a71cb4540'
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
const FlyBundlesUpsellsFbtConfig = {
|
|
92
|
+
FlyBundlesUpsellsFbt: {
|
|
93
|
+
appName: 'fly-bundles-upsell',
|
|
94
|
+
appId: '26807bdc-c2ed-4a25-afb2-06e6b1ebf843'
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
const JunipProductReviewsUgcConfig = {
|
|
98
|
+
JunipProductReviewsUgc: {
|
|
99
|
+
appName: 'junip-product-reviews-ugc',
|
|
100
|
+
appId: 'dc14f5a8-ed15-41b1-ad08-cfba23f9789b'
|
|
101
|
+
}
|
|
102
|
+
};
|
|
79
103
|
|
|
80
|
-
export { BonLoyaltyRewardsReferralsConfig, FastBundleBundlesDiscountsConfig, KiteFreeGiftDiscountConfig, LoopSubscriptionsConfig, PumperBundlesVolumeDiscountConfig, RechargeSubscriptionsConfig, ReviewxpoProductReviewsAppConfig, SelleasyConfig, ShopifyFormsConfig, SimpleBundlesKitsConfig, SkioSubscriptionsYcS20Config, SubifySubscriptionsConfig, UnlimitedBundlesDiscountsConfig };
|
|
104
|
+
export { BonLoyaltyRewardsReferralsConfig, EasyBundleBuilderSkailamaConfig, FastBundleBundlesDiscountsConfig, FlyBundlesUpsellsFbtConfig, JunipProductReviewsUgcConfig, KiteFreeGiftDiscountConfig, LoopSubscriptionsConfig, PreorderNowPreOrderPqConfig, 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,66 @@ 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 PreorderNowPreOrderPq = {
|
|
143
|
+
PreorderNowPreOrderPq: {
|
|
144
|
+
'app-block-notifyapp-block-notify': null,
|
|
145
|
+
'app-block-partial': null,
|
|
146
|
+
'app-block-timer': null,
|
|
147
|
+
'app-block': null
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
const FlyBundlesUpsellsFbt = {
|
|
151
|
+
FlyBundlesUpsellsFbt: {
|
|
152
|
+
'app-block-volume': null,
|
|
153
|
+
'app-block-upsell-block': null,
|
|
154
|
+
'app-block-fbt': null,
|
|
155
|
+
'app-block-custom': {
|
|
156
|
+
bundle_id: ''
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
const JunipProductReviewsUgc = {
|
|
161
|
+
JunipProductReviewsUgc: {
|
|
162
|
+
'junip-review-carousel': {
|
|
163
|
+
reviewsType: 'product_reviews',
|
|
164
|
+
showSummary: true,
|
|
165
|
+
title: 'Reviews',
|
|
166
|
+
paddingTop: 48,
|
|
167
|
+
paddingBottom: 48,
|
|
168
|
+
containerClass: ''
|
|
169
|
+
},
|
|
170
|
+
'junip-ugc-gallery': {
|
|
171
|
+
layout: 'scroll',
|
|
172
|
+
title: '',
|
|
173
|
+
paddingTop: 48,
|
|
174
|
+
paddingBottom: 48,
|
|
175
|
+
containerClass: ''
|
|
176
|
+
},
|
|
177
|
+
'junip-product-review': {
|
|
178
|
+
product: '{{product}}'
|
|
179
|
+
},
|
|
180
|
+
'junip-product-summary': {
|
|
181
|
+
product: '{{product}}'
|
|
182
|
+
},
|
|
183
|
+
'junip-reviews': {
|
|
184
|
+
layout: 'list',
|
|
185
|
+
reviewsType: 'all',
|
|
186
|
+
showSummary: true,
|
|
187
|
+
reviewsCount: 10,
|
|
188
|
+
containerClass: ''
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
};
|
|
130
192
|
const composeSettingsByWidgetType = {
|
|
193
|
+
...JunipProductReviewsUgc,
|
|
194
|
+
...FlyBundlesUpsellsFbt,
|
|
195
|
+
...PreorderNowPreOrderPq,
|
|
196
|
+
...EasyBundleBuilderSkailama,
|
|
131
197
|
...FastBundleBundlesDiscounts,
|
|
132
198
|
...KiteFreeGiftDiscount,
|
|
133
199
|
...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, PreorderNowPreOrderPqConfig, FlyBundlesUpsellsFbtConfig, JunipProductReviewsUgcConfig } from './appConfig.js';
|
|
2
2
|
|
|
3
3
|
const mapShopifyAppMeta = {
|
|
4
4
|
...RechargeSubscriptionsConfig,
|
|
@@ -13,7 +13,11 @@ const mapShopifyAppMeta = {
|
|
|
13
13
|
...UnlimitedBundlesDiscountsConfig,
|
|
14
14
|
...KiteFreeGiftDiscountConfig,
|
|
15
15
|
...FastBundleBundlesDiscountsConfig,
|
|
16
|
-
...SimpleBundlesKitsConfig
|
|
16
|
+
...SimpleBundlesKitsConfig,
|
|
17
|
+
...EasyBundleBuilderSkailamaConfig,
|
|
18
|
+
...PreorderNowPreOrderPqConfig,
|
|
19
|
+
...FlyBundlesUpsellsFbtConfig,
|
|
20
|
+
...JunipProductReviewsUgcConfig
|
|
17
21
|
};
|
|
18
22
|
const THIRD_PARTY_APP_BLOCK_ID_PREFIX = 'gp_app';
|
|
19
23
|
|