@gem-sdk/core 1.46.0-staging.4 → 1.46.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 +8 -2
- package/dist/cjs/components/Render.liquid.js +17 -7
- package/dist/cjs/components/ai-generator/AIContentGenerator.js +1 -1
- package/dist/cjs/graphql/queries/articles.generated.js +3 -1
- package/dist/cjs/graphql/queries/blogs.generated.js +3 -1
- package/dist/cjs/helpers/loop-component.js +16 -0
- package/dist/cjs/helpers/pascal-to-kebab-case.js +7 -0
- package/dist/cjs/helpers/third-party/addAppBlockId.js +20 -0
- package/dist/cjs/helpers/third-party/appConfig.js +52 -0
- package/dist/cjs/helpers/third-party/appSetting.js +99 -0
- package/dist/cjs/helpers/third-party/composeAppBlockId.js +11 -0
- package/dist/cjs/helpers/third-party/constant.js +17 -0
- package/dist/cjs/helpers/third-party/generateAppBlockConfigs.js +34 -0
- package/dist/cjs/helpers/third-party/getAppBlockConfig.js +24 -0
- package/dist/cjs/helpers/third-party/getAppBlockType.js +12 -0
- package/dist/cjs/helpers/third-party/getAppBlocks.js +30 -0
- package/dist/cjs/helpers/third-party/mergeBlock.js +19 -0
- package/dist/cjs/helpers/third-party/mergeBlockOrder.js +47 -0
- package/dist/cjs/helpers/third-party/removeGPAppItems.js +18 -0
- package/dist/cjs/index.js +4 -0
- package/dist/esm/components/ComponentToolbarPreview.js +8 -2
- package/dist/esm/components/Render.liquid.js +17 -7
- package/dist/esm/components/ai-generator/AIContentGenerator.js +1 -1
- package/dist/esm/graphql/queries/articles.generated.js +3 -1
- package/dist/esm/graphql/queries/blogs.generated.js +3 -1
- package/dist/esm/helpers/loop-component.js +14 -0
- package/dist/esm/helpers/pascal-to-kebab-case.js +5 -0
- package/dist/esm/helpers/third-party/addAppBlockId.js +18 -0
- package/dist/esm/helpers/third-party/appConfig.js +44 -0
- package/dist/esm/helpers/third-party/appSetting.js +96 -0
- package/dist/esm/helpers/third-party/composeAppBlockId.js +9 -0
- package/dist/esm/helpers/third-party/constant.js +14 -0
- package/dist/esm/helpers/third-party/generateAppBlockConfigs.js +32 -0
- package/dist/esm/helpers/third-party/getAppBlockConfig.js +22 -0
- package/dist/esm/helpers/third-party/getAppBlockType.js +10 -0
- package/dist/esm/helpers/third-party/getAppBlocks.js +28 -0
- package/dist/esm/helpers/third-party/mergeBlock.js +17 -0
- package/dist/esm/helpers/third-party/mergeBlockOrder.js +45 -0
- package/dist/esm/helpers/third-party/removeGPAppItems.js +15 -0
- package/dist/esm/index.js +2 -0
- package/dist/types/index.d.ts +40 -6
- package/package.json +4 -3
|
@@ -59,7 +59,8 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
59
59
|
const editProductElementList = [
|
|
60
60
|
'Product Title',
|
|
61
61
|
'Product Description',
|
|
62
|
-
'Product Price'
|
|
62
|
+
'Product Price',
|
|
63
|
+
'Product Vendor'
|
|
63
64
|
];
|
|
64
65
|
const isOverToolbarPosition = (el, parent)=>{
|
|
65
66
|
const parentLength = parents.length;
|
|
@@ -294,6 +295,11 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
294
295
|
const isEnableCreateThemeSection = ()=>{
|
|
295
296
|
return editingPageType !== 'STATIC' && editingPageType !== 'POST_PURCHASE';
|
|
296
297
|
};
|
|
298
|
+
const isEnableAIContent = ()=>{
|
|
299
|
+
const { isShopifySection, tag } = props;
|
|
300
|
+
if (isShopifySection || isThemeSection && !isThemeSectionEditor) return false;
|
|
301
|
+
return constant.ableGenerateContentElements.includes(tag);
|
|
302
|
+
};
|
|
297
303
|
// if (!isActive) return null;
|
|
298
304
|
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
299
305
|
children: [
|
|
@@ -459,7 +465,7 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
459
465
|
props.tag === 'Section' && !props.isThemeSection && isEnableCreateThemeSection() && !props.isShopifySection && getIndexSection() < SECTION_LIMIT && /*#__PURE__*/ jsxRuntime.jsx(CreateThemeSection.CreateThemeSection, {
|
|
460
466
|
...props
|
|
461
467
|
}),
|
|
462
|
-
|
|
468
|
+
isEnableAIContent() && /*#__PURE__*/ jsxRuntime.jsx(AIContentGenerator.AIContentGenerator, {
|
|
463
469
|
...props
|
|
464
470
|
}),
|
|
465
471
|
props.tag == 'Sticky' && /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
@@ -20,6 +20,7 @@ require('dayjs');
|
|
|
20
20
|
var composeAdvanceStyle = require('../helpers/compose-advance-style.js');
|
|
21
21
|
var convert = require('../helpers/convert.js');
|
|
22
22
|
var render = require('../helpers/render.js');
|
|
23
|
+
var cssjson = require('cssjson');
|
|
23
24
|
|
|
24
25
|
const componentsRenderWithParentId = [
|
|
25
26
|
'CarouselItem'
|
|
@@ -181,19 +182,28 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
181
182
|
};
|
|
182
183
|
}
|
|
183
184
|
};
|
|
185
|
+
const isEmptyCSS = (cssString)=>{
|
|
186
|
+
if (!cssString) return true;
|
|
187
|
+
const cssJSON = cssjson.toJSON(cssString);
|
|
188
|
+
const isObjectEmpty = (obj)=>{
|
|
189
|
+
if (typeof obj !== 'object' || obj === null) return true;
|
|
190
|
+
return !Object.keys(obj).some((key)=>{
|
|
191
|
+
return key === 'attributes' && Object.keys(obj[key]).length > 0 || typeof obj[key] === 'object' && !isObjectEmpty(obj[key]);
|
|
192
|
+
});
|
|
193
|
+
};
|
|
194
|
+
return isObjectEmpty(cssJSON.children);
|
|
195
|
+
};
|
|
184
196
|
const RenderCustomCode = (item)=>{
|
|
185
197
|
const { css, javascript, rootClassName } = item.advanced?.editorData || {};
|
|
186
198
|
const replacedCSS = css?.replaceAll(rootClassName, item.uid);
|
|
187
199
|
const replacedJS = javascript?.replaceAll(rootClassName, item.uid);
|
|
188
|
-
const cssCode = render.RenderIf(!!css, render.template`
|
|
189
|
-
<style
|
|
190
|
-
|
|
191
|
-
|
|
200
|
+
const cssCode = render.RenderIf(!!css && !isEmptyCSS(replacedCSS), render.template`
|
|
201
|
+
<style id="${`custom-css-${item?.uid}`}">
|
|
202
|
+
${replacedCSS}
|
|
203
|
+
</style>
|
|
192
204
|
`);
|
|
193
205
|
const jsCode = render.RenderIf(!!javascript, render.template`
|
|
194
|
-
<script
|
|
195
|
-
id="${`custom-js-${item?.uid}`}"
|
|
196
|
-
>
|
|
206
|
+
<script id="${`custom-js-${item?.uid}`}">
|
|
197
207
|
try {
|
|
198
208
|
${replacedJS}
|
|
199
209
|
} catch(err){}
|
|
@@ -108,7 +108,7 @@ const AIContentGenerator = ({ ...props })=>{
|
|
|
108
108
|
ref: genTool,
|
|
109
109
|
children: [
|
|
110
110
|
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
111
|
-
className: "gp-gen-content-toolbar gp-border-r
|
|
111
|
+
className: "gp-gen-content-toolbar gp-border-r gp-pr-1 gp-mr-1",
|
|
112
112
|
children: /*#__PURE__*/ jsxRuntime.jsxs("button", {
|
|
113
113
|
className: classNames({
|
|
114
114
|
'gp-toolbar-ai-active': isShowPopup
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function loopComponent(component, callback) {
|
|
4
|
+
if (component) {
|
|
5
|
+
callback(component);
|
|
6
|
+
}
|
|
7
|
+
if (component?.childrens?.length) {
|
|
8
|
+
// eslint-disable-next-line
|
|
9
|
+
for(let i = 0; i < component.childrens.length; i++){
|
|
10
|
+
const children = component.childrens[i];
|
|
11
|
+
loopComponent(children, callback);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
exports.loopComponent = loopComponent;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var loopComponent = require('../loop-component.js');
|
|
4
|
+
var composeAppBlockId = require('./composeAppBlockId.js');
|
|
5
|
+
|
|
6
|
+
const addAppBlockId = (component)=>{
|
|
7
|
+
const strComponent = JSON.stringify(component) || '';
|
|
8
|
+
if (!strComponent.includes('appBlockId')) {
|
|
9
|
+
return component;
|
|
10
|
+
}
|
|
11
|
+
loopComponent.loopComponent(component, (component)=>handleSetBlockId(component));
|
|
12
|
+
return component;
|
|
13
|
+
};
|
|
14
|
+
const handleSetBlockId = (component)=>{
|
|
15
|
+
const { tag, uid } = component;
|
|
16
|
+
if (component.settings.appBlockId === undefined) return component;
|
|
17
|
+
component.settings.appBlockId = composeAppBlockId.composeAppBlockId(tag, uid);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
exports.addAppBlockId = addAppBlockId;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const RechargeSubscriptionsConfig = {
|
|
4
|
+
RechargeSubscriptions: {
|
|
5
|
+
appName: 'recharge-subscriptions',
|
|
6
|
+
appId: '371eed76-0b44-4869-9813-730372ea378e'
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
const BonLoyaltyRewardsReferralsConfig = {
|
|
10
|
+
BonLoyaltyRewardsReferrals: {
|
|
11
|
+
appName: 'bon-loyalty',
|
|
12
|
+
appId: '63496a04-c097-48d1-8c11-475aec24b12e'
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const SubifySubscriptionsConfig = {
|
|
16
|
+
SubifySubscriptionsApp: {
|
|
17
|
+
appName: 'subify-subscriptions-app',
|
|
18
|
+
appId: 'bc0dba25-cd46-4841-bea4-6bdfe9ac815f'
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const SelleasyConfig = {
|
|
22
|
+
Selleasy: {
|
|
23
|
+
appName: 'selleasy',
|
|
24
|
+
appId: '790c1a03-a71f-4bc1-9869-00dad526d3c2'
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
const LoopSubscriptionsConfig = {
|
|
28
|
+
LoopSubscriptions: {
|
|
29
|
+
appName: 'loop-subscriptions',
|
|
30
|
+
appId: '267a7c64-5cb3-4552-b817-5485165f0a0b'
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const SkioSubscriptionsYcS20Config = {
|
|
34
|
+
SkioSubscriptionsYcS20: {
|
|
35
|
+
appName: 'skio-subscriptions-yc-s20',
|
|
36
|
+
appId: 'de50f7a4-0bb0-4d4c-84e2-c03dce83436d'
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const ShopifyFormsConfig = {
|
|
40
|
+
ShopifyForms: {
|
|
41
|
+
appName: 'forms',
|
|
42
|
+
appId: '8744a304-fcb1-4347-b211-bb6b4759a76a'
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
exports.BonLoyaltyRewardsReferralsConfig = BonLoyaltyRewardsReferralsConfig;
|
|
47
|
+
exports.LoopSubscriptionsConfig = LoopSubscriptionsConfig;
|
|
48
|
+
exports.RechargeSubscriptionsConfig = RechargeSubscriptionsConfig;
|
|
49
|
+
exports.SelleasyConfig = SelleasyConfig;
|
|
50
|
+
exports.ShopifyFormsConfig = ShopifyFormsConfig;
|
|
51
|
+
exports.SkioSubscriptionsYcS20Config = SkioSubscriptionsYcS20Config;
|
|
52
|
+
exports.SubifySubscriptionsConfig = SubifySubscriptionsConfig;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const RechargeSubscriptions = {
|
|
4
|
+
RechargeSubscriptions: {
|
|
5
|
+
'subscription-widget': {
|
|
6
|
+
product: '{{ product }}'
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
const LoyaltyRewardsReferrals = {
|
|
11
|
+
BonLoyaltyRewardsReferrals: {
|
|
12
|
+
'loyalty-page-block': null,
|
|
13
|
+
'loyalty-page-earning-block': null,
|
|
14
|
+
'loyalty-page-header-block': null,
|
|
15
|
+
'loyalty-page-profile-block': null,
|
|
16
|
+
'loyalty-page-redeem-block': null,
|
|
17
|
+
'loyalty-page-referral-block': null,
|
|
18
|
+
'loyalty-page-tier-block': null,
|
|
19
|
+
'product-point-preview': null
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const SubifySubscriptions = {
|
|
23
|
+
SubifySubscriptionsApp: {
|
|
24
|
+
'app-block': {
|
|
25
|
+
product: '{{product}}',
|
|
26
|
+
use_app_block_wording: false,
|
|
27
|
+
widget_label: 'Purchase options',
|
|
28
|
+
one_time_purchase_text: 'One-Time Purchase',
|
|
29
|
+
subscription_text: 'Subscribe and save',
|
|
30
|
+
delivery_frequency_text: 'Delivery frequency',
|
|
31
|
+
prepaid_subscription_text: 'Subscription with prepaid',
|
|
32
|
+
skin1_priceSuffix: 'each',
|
|
33
|
+
skin1_save: 'Save(skin1)',
|
|
34
|
+
skin1_prepaid_payment_title: 'prepaid',
|
|
35
|
+
skin1_normal_payment_title: 'pay as you go',
|
|
36
|
+
skin2_discountSuffix: 'Save',
|
|
37
|
+
skin3_fullPrice: 'Full price',
|
|
38
|
+
skin3_priceSuffix: 'each',
|
|
39
|
+
skin3_discountSuffix: 'Off',
|
|
40
|
+
skin4_justOnce: 'Just once',
|
|
41
|
+
skin4_discountSuffix: 'Off',
|
|
42
|
+
skin4_priceSuffix: 'each',
|
|
43
|
+
skin4_fullPrice: '(Full price)',
|
|
44
|
+
skin4_sellingPlansTitle: 'Renews every:',
|
|
45
|
+
from: 'from',
|
|
46
|
+
max_discount_badge_title: 'UP To',
|
|
47
|
+
pay: 'Pay',
|
|
48
|
+
price_save_up_to: 'save up to'
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const SelleasyWidget = {
|
|
53
|
+
Selleasy: {
|
|
54
|
+
'lb-upsell-fbt-block': null,
|
|
55
|
+
'lb-upsell-addon-block': null
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const LoopSubscriptions = {
|
|
59
|
+
LoopSubscriptions: {
|
|
60
|
+
star_rating: {
|
|
61
|
+
product: '{{product}}'
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
const SkioSubscriptionsYcS20 = {
|
|
66
|
+
SkioSubscriptionsYcS20: {
|
|
67
|
+
'app-block': null
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
const ShopifyForms = {
|
|
71
|
+
ShopifyForms: {
|
|
72
|
+
inline: {
|
|
73
|
+
form_id: null
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const overrideSettings = (tag, currentSetting, appSetting)=>{
|
|
78
|
+
switch(tag){
|
|
79
|
+
case 'ShopifyForms':
|
|
80
|
+
return {
|
|
81
|
+
...currentSetting,
|
|
82
|
+
form_id: appSetting['formId']
|
|
83
|
+
};
|
|
84
|
+
default:
|
|
85
|
+
return currentSetting;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
const composeSettingsByWidgetType = {
|
|
89
|
+
...ShopifyForms,
|
|
90
|
+
...SkioSubscriptionsYcS20,
|
|
91
|
+
...LoopSubscriptions,
|
|
92
|
+
...RechargeSubscriptions,
|
|
93
|
+
...LoyaltyRewardsReferrals,
|
|
94
|
+
...SubifySubscriptions,
|
|
95
|
+
...SelleasyWidget
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
exports.composeSettingsByWidgetType = composeSettingsByWidgetType;
|
|
99
|
+
exports.overrideSettings = overrideSettings;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var pascalToKebabCase = require('../pascal-to-kebab-case.js');
|
|
4
|
+
var constant = require('./constant.js');
|
|
5
|
+
|
|
6
|
+
const composeAppBlockId = (tag, uid)=>{
|
|
7
|
+
const key = pascalToKebabCase.pascalToKebab(tag);
|
|
8
|
+
return `${constant.THIRD_PARTY_APP_BLOCK_ID_PREFIX}_${key}_${uid}`;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
exports.composeAppBlockId = composeAppBlockId;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var appConfig = require('./appConfig.js');
|
|
4
|
+
|
|
5
|
+
const mapShopifyAppMeta = {
|
|
6
|
+
...appConfig.RechargeSubscriptionsConfig,
|
|
7
|
+
...appConfig.BonLoyaltyRewardsReferralsConfig,
|
|
8
|
+
...appConfig.SubifySubscriptionsConfig,
|
|
9
|
+
...appConfig.SelleasyConfig,
|
|
10
|
+
...appConfig.LoopSubscriptionsConfig,
|
|
11
|
+
...appConfig.SkioSubscriptionsYcS20Config,
|
|
12
|
+
...appConfig.ShopifyFormsConfig
|
|
13
|
+
};
|
|
14
|
+
const THIRD_PARTY_APP_BLOCK_ID_PREFIX = 'gp_app';
|
|
15
|
+
|
|
16
|
+
exports.THIRD_PARTY_APP_BLOCK_ID_PREFIX = THIRD_PARTY_APP_BLOCK_ID_PREFIX;
|
|
17
|
+
exports.mapShopifyAppMeta = mapShopifyAppMeta;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var loopComponent = require('../loop-component.js');
|
|
4
|
+
var getAppBlockConfig = require('./getAppBlockConfig.js');
|
|
5
|
+
|
|
6
|
+
const generateAppBlockConfigs = (component)=>{
|
|
7
|
+
const strComponent = JSON.stringify(component) || '';
|
|
8
|
+
if (!strComponent.includes('appBlockId')) return null;
|
|
9
|
+
const configs = [];
|
|
10
|
+
loopComponent.loopComponent(component, (component)=>{
|
|
11
|
+
const settings = component.settings || {};
|
|
12
|
+
const appBlockId = settings?.appBlockId || '';
|
|
13
|
+
if (!appBlockId) return;
|
|
14
|
+
const config = getAppBlockConfig.getAppBlockConfig(component.tag, appBlockId, settings);
|
|
15
|
+
if (!config) return;
|
|
16
|
+
configs.push(config);
|
|
17
|
+
});
|
|
18
|
+
if (!configs.length) return null;
|
|
19
|
+
return {
|
|
20
|
+
newBlocks: extractBlocks(configs),
|
|
21
|
+
newBlockOrder: extractBlockOrder(configs)
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
function extractBlocks(array) {
|
|
25
|
+
return array.reduce((acc, item)=>{
|
|
26
|
+
acc[item.key] = item.value;
|
|
27
|
+
return acc;
|
|
28
|
+
}, {});
|
|
29
|
+
}
|
|
30
|
+
function extractBlockOrder(array) {
|
|
31
|
+
return array.map((item)=>item.key);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
exports.generateAppBlockConfigs = generateAppBlockConfigs;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var appSetting = require('./appSetting.js');
|
|
4
|
+
var getAppBlockType = require('./getAppBlockType.js');
|
|
5
|
+
|
|
6
|
+
const getAppBlockConfig = (tag, appBlockId, settings)=>{
|
|
7
|
+
const appBlockType = getAppBlockType.getAppBlockType({
|
|
8
|
+
tag,
|
|
9
|
+
widgetType: settings?.widgetType
|
|
10
|
+
});
|
|
11
|
+
const settingByWidget = appSetting.composeSettingsByWidgetType[tag][settings?.widgetType];
|
|
12
|
+
const appSettings = appSetting.overrideSettings(tag, settingByWidget, settings);
|
|
13
|
+
return {
|
|
14
|
+
key: appBlockId,
|
|
15
|
+
value: {
|
|
16
|
+
type: appBlockType,
|
|
17
|
+
...settingByWidget && {
|
|
18
|
+
settings: appSettings
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
exports.getAppBlockConfig = getAppBlockConfig;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var constant = require('./constant.js');
|
|
4
|
+
|
|
5
|
+
const getAppBlockType = ({ tag, widgetType })=>{
|
|
6
|
+
const shopifyAppMeta = constant.mapShopifyAppMeta[tag];
|
|
7
|
+
if (!shopifyAppMeta) return '';
|
|
8
|
+
const { appName, appId } = shopifyAppMeta;
|
|
9
|
+
return `shopify://apps/${appName}/blocks/${widgetType}/${appId}`;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
exports.getAppBlockType = getAppBlockType;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var addAppBlockId = require('./addAppBlockId.js');
|
|
4
|
+
var generateAppBlockConfigs = require('./generateAppBlockConfigs.js');
|
|
5
|
+
var mergeBlock = require('./mergeBlock.js');
|
|
6
|
+
var mergeBlockOrder = require('./mergeBlockOrder.js');
|
|
7
|
+
var removeGPAppItems = require('./removeGPAppItems.js');
|
|
8
|
+
|
|
9
|
+
const getAppBlocks = (section)=>{
|
|
10
|
+
const { blocks: currentBlock, block_order: currentBlockOrder } = JSON.parse(section?.appBlocks || '{}');
|
|
11
|
+
const component = JSON.parse(section?.component || '');
|
|
12
|
+
const componentWithAppBlockId = addAppBlockId.addAppBlockId(component);
|
|
13
|
+
const appBlockConfigs = generateAppBlockConfigs.generateAppBlockConfigs(componentWithAppBlockId);
|
|
14
|
+
if (!appBlockConfigs) {
|
|
15
|
+
if (!currentBlock || !currentBlockOrder) return {};
|
|
16
|
+
return {
|
|
17
|
+
blocks: removeGPAppItems.removeAllGPAppItemsFromBlocks(currentBlock),
|
|
18
|
+
block_order: removeGPAppItems.removeAllGPAppItemsFromBlockOrder(currentBlockOrder)
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const { newBlocks, newBlockOrder } = appBlockConfigs;
|
|
22
|
+
const blocks = mergeBlock.mergeBlocks(newBlocks, currentBlock);
|
|
23
|
+
const block_order = mergeBlockOrder.mergeBlockOrder(newBlockOrder, currentBlockOrder);
|
|
24
|
+
return {
|
|
25
|
+
blocks,
|
|
26
|
+
block_order
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
exports.getAppBlocks = getAppBlocks;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function mergeBlocks(newBlocks, blocks) {
|
|
4
|
+
if (!blocks) return newBlocks;
|
|
5
|
+
const result = {};
|
|
6
|
+
// Add all non-gp_app blocks from the original blocks
|
|
7
|
+
for (const [key, value] of Object.entries(blocks)){
|
|
8
|
+
if (!key.startsWith('gp_app')) {
|
|
9
|
+
result[key] = value;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
// Add all blocks from new-blocks
|
|
13
|
+
for (const [key, value] of Object.entries(newBlocks)){
|
|
14
|
+
result[key] = value;
|
|
15
|
+
}
|
|
16
|
+
return result;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
exports.mergeBlocks = mergeBlocks;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var constant = require('./constant.js');
|
|
4
|
+
|
|
5
|
+
function isGpAppItem(item) {
|
|
6
|
+
if (!item) return false;
|
|
7
|
+
return item.startsWith(constant.THIRD_PARTY_APP_BLOCK_ID_PREFIX);
|
|
8
|
+
}
|
|
9
|
+
function filterCurrentOrder(currentOrder, newOrderSet) {
|
|
10
|
+
return currentOrder.filter((item)=>!isGpAppItem(item) || newOrderSet.has(item));
|
|
11
|
+
}
|
|
12
|
+
function processNonGpAppItem(item, resultOrder) {
|
|
13
|
+
resultOrder.push(item);
|
|
14
|
+
}
|
|
15
|
+
function processGpAppItems(newOrder, newOrderIndex, resultOrder) {
|
|
16
|
+
while(newOrderIndex < newOrder.length && isGpAppItem(newOrder[newOrderIndex])){
|
|
17
|
+
resultOrder.push(newOrder[newOrderIndex]);
|
|
18
|
+
newOrderIndex++;
|
|
19
|
+
}
|
|
20
|
+
return newOrderIndex;
|
|
21
|
+
}
|
|
22
|
+
function addRemainingGpAppItems(newOrder, startIndex, resultOrder) {
|
|
23
|
+
for(let i = startIndex; i < newOrder.length; i++){
|
|
24
|
+
const item = newOrder[i];
|
|
25
|
+
if (item && isGpAppItem(item)) {
|
|
26
|
+
resultOrder.push(item);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function mergeBlockOrder(newOrder, currentOrder) {
|
|
31
|
+
if (!currentOrder) return newOrder;
|
|
32
|
+
const newOrderSet = new Set(newOrder);
|
|
33
|
+
const filteredCurrentOrder = filterCurrentOrder(currentOrder, newOrderSet);
|
|
34
|
+
const resultOrder = [];
|
|
35
|
+
let newOrderIndex = 0;
|
|
36
|
+
filteredCurrentOrder.forEach((item)=>{
|
|
37
|
+
if (!isGpAppItem(item)) {
|
|
38
|
+
processNonGpAppItem(item, resultOrder);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
newOrderIndex = processGpAppItems(newOrder, newOrderIndex, resultOrder);
|
|
42
|
+
});
|
|
43
|
+
addRemainingGpAppItems(newOrder, newOrderIndex, resultOrder);
|
|
44
|
+
return resultOrder;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
exports.mergeBlockOrder = mergeBlockOrder;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var constant = require('./constant.js');
|
|
4
|
+
|
|
5
|
+
const removeAllGPAppItemsFromBlocks = (blocks)=>{
|
|
6
|
+
for(const key in blocks){
|
|
7
|
+
if (key.startsWith(constant.THIRD_PARTY_APP_BLOCK_ID_PREFIX)) {
|
|
8
|
+
delete blocks[key];
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return blocks;
|
|
12
|
+
};
|
|
13
|
+
const removeAllGPAppItemsFromBlockOrder = (blockOrder)=>{
|
|
14
|
+
return blockOrder.filter((item)=>!item.includes(constant.THIRD_PARTY_APP_BLOCK_ID_PREFIX));
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
exports.removeAllGPAppItemsFromBlockOrder = removeAllGPAppItemsFromBlockOrder;
|
|
18
|
+
exports.removeAllGPAppItemsFromBlocks = removeAllGPAppItemsFromBlocks;
|
package/dist/cjs/index.js
CHANGED
|
@@ -104,6 +104,8 @@ var animations$1 = require('./types/animations.js');
|
|
|
104
104
|
var getCollection = require('./helpers/queries/get-collection.js');
|
|
105
105
|
var getProduct = require('./helpers/queries/get-product.js');
|
|
106
106
|
var getProductBySlug = require('./helpers/queries/get-product-by-slug.js');
|
|
107
|
+
var getAppBlocks = require('./helpers/third-party/getAppBlocks.js');
|
|
108
|
+
var addAppBlockId = require('./helpers/third-party/addAppBlockId.js');
|
|
107
109
|
|
|
108
110
|
|
|
109
111
|
|
|
@@ -387,3 +389,5 @@ exports.fetchMedias = getProduct.fetchMedias;
|
|
|
387
389
|
exports.fetchVariants = getProduct.fetchVariants;
|
|
388
390
|
exports.getProduct = getProduct.getProduct;
|
|
389
391
|
exports.getProductBySlug = getProductBySlug.getProductBySlug;
|
|
392
|
+
exports.getAppBlocks = getAppBlocks.getAppBlocks;
|
|
393
|
+
exports.addAppBlockId = addAppBlockId.addAppBlockId;
|
|
@@ -55,7 +55,8 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
55
55
|
const editProductElementList = [
|
|
56
56
|
'Product Title',
|
|
57
57
|
'Product Description',
|
|
58
|
-
'Product Price'
|
|
58
|
+
'Product Price',
|
|
59
|
+
'Product Vendor'
|
|
59
60
|
];
|
|
60
61
|
const isOverToolbarPosition = (el, parent)=>{
|
|
61
62
|
const parentLength = parents.length;
|
|
@@ -290,6 +291,11 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
290
291
|
const isEnableCreateThemeSection = ()=>{
|
|
291
292
|
return editingPageType !== 'STATIC' && editingPageType !== 'POST_PURCHASE';
|
|
292
293
|
};
|
|
294
|
+
const isEnableAIContent = ()=>{
|
|
295
|
+
const { isShopifySection, tag } = props;
|
|
296
|
+
if (isShopifySection || isThemeSection && !isThemeSectionEditor) return false;
|
|
297
|
+
return ableGenerateContentElements.includes(tag);
|
|
298
|
+
};
|
|
293
299
|
// if (!isActive) return null;
|
|
294
300
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
295
301
|
children: [
|
|
@@ -455,7 +461,7 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
455
461
|
props.tag === 'Section' && !props.isThemeSection && isEnableCreateThemeSection() && !props.isShopifySection && getIndexSection() < SECTION_LIMIT && /*#__PURE__*/ jsx(CreateThemeSection, {
|
|
456
462
|
...props
|
|
457
463
|
}),
|
|
458
|
-
|
|
464
|
+
isEnableAIContent() && /*#__PURE__*/ jsx(AIContentGenerator, {
|
|
459
465
|
...props
|
|
460
466
|
}),
|
|
461
467
|
props.tag == 'Sticky' && /*#__PURE__*/ jsx("div", {
|
|
@@ -16,6 +16,7 @@ import 'dayjs';
|
|
|
16
16
|
import { composeAdvanceStyle } from '../helpers/compose-advance-style.js';
|
|
17
17
|
import { baseAssetURL, isLocalEnv } from '../helpers/convert.js';
|
|
18
18
|
import { RenderIf, template } from '../helpers/render.js';
|
|
19
|
+
import { toJSON } from 'cssjson';
|
|
19
20
|
|
|
20
21
|
const componentsRenderWithParentId = [
|
|
21
22
|
'CarouselItem'
|
|
@@ -177,19 +178,28 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
177
178
|
};
|
|
178
179
|
}
|
|
179
180
|
};
|
|
181
|
+
const isEmptyCSS = (cssString)=>{
|
|
182
|
+
if (!cssString) return true;
|
|
183
|
+
const cssJSON = toJSON(cssString);
|
|
184
|
+
const isObjectEmpty = (obj)=>{
|
|
185
|
+
if (typeof obj !== 'object' || obj === null) return true;
|
|
186
|
+
return !Object.keys(obj).some((key)=>{
|
|
187
|
+
return key === 'attributes' && Object.keys(obj[key]).length > 0 || typeof obj[key] === 'object' && !isObjectEmpty(obj[key]);
|
|
188
|
+
});
|
|
189
|
+
};
|
|
190
|
+
return isObjectEmpty(cssJSON.children);
|
|
191
|
+
};
|
|
180
192
|
const RenderCustomCode = (item)=>{
|
|
181
193
|
const { css, javascript, rootClassName } = item.advanced?.editorData || {};
|
|
182
194
|
const replacedCSS = css?.replaceAll(rootClassName, item.uid);
|
|
183
195
|
const replacedJS = javascript?.replaceAll(rootClassName, item.uid);
|
|
184
|
-
const cssCode = RenderIf(!!css, template`
|
|
185
|
-
<style
|
|
186
|
-
|
|
187
|
-
|
|
196
|
+
const cssCode = RenderIf(!!css && !isEmptyCSS(replacedCSS), template`
|
|
197
|
+
<style id="${`custom-css-${item?.uid}`}">
|
|
198
|
+
${replacedCSS}
|
|
199
|
+
</style>
|
|
188
200
|
`);
|
|
189
201
|
const jsCode = RenderIf(!!javascript, template`
|
|
190
|
-
<script
|
|
191
|
-
id="${`custom-js-${item?.uid}`}"
|
|
192
|
-
>
|
|
202
|
+
<script id="${`custom-js-${item?.uid}`}">
|
|
193
203
|
try {
|
|
194
204
|
${replacedJS}
|
|
195
205
|
} catch(err){}
|
|
@@ -106,7 +106,7 @@ const AIContentGenerator = ({ ...props })=>{
|
|
|
106
106
|
ref: genTool,
|
|
107
107
|
children: [
|
|
108
108
|
/*#__PURE__*/ jsx("div", {
|
|
109
|
-
className: "gp-gen-content-toolbar gp-border-r
|
|
109
|
+
className: "gp-gen-content-toolbar gp-border-r gp-pr-1 gp-mr-1",
|
|
110
110
|
children: /*#__PURE__*/ jsxs("button", {
|
|
111
111
|
className: classNames({
|
|
112
112
|
'gp-toolbar-ai-active': isShowPopup
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
function loopComponent(component, callback) {
|
|
2
|
+
if (component) {
|
|
3
|
+
callback(component);
|
|
4
|
+
}
|
|
5
|
+
if (component?.childrens?.length) {
|
|
6
|
+
// eslint-disable-next-line
|
|
7
|
+
for(let i = 0; i < component.childrens.length; i++){
|
|
8
|
+
const children = component.childrens[i];
|
|
9
|
+
loopComponent(children, callback);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { loopComponent };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { loopComponent } from '../loop-component.js';
|
|
2
|
+
import { composeAppBlockId } from './composeAppBlockId.js';
|
|
3
|
+
|
|
4
|
+
const addAppBlockId = (component)=>{
|
|
5
|
+
const strComponent = JSON.stringify(component) || '';
|
|
6
|
+
if (!strComponent.includes('appBlockId')) {
|
|
7
|
+
return component;
|
|
8
|
+
}
|
|
9
|
+
loopComponent(component, (component)=>handleSetBlockId(component));
|
|
10
|
+
return component;
|
|
11
|
+
};
|
|
12
|
+
const handleSetBlockId = (component)=>{
|
|
13
|
+
const { tag, uid } = component;
|
|
14
|
+
if (component.settings.appBlockId === undefined) return component;
|
|
15
|
+
component.settings.appBlockId = composeAppBlockId(tag, uid);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { addAppBlockId };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const RechargeSubscriptionsConfig = {
|
|
2
|
+
RechargeSubscriptions: {
|
|
3
|
+
appName: 'recharge-subscriptions',
|
|
4
|
+
appId: '371eed76-0b44-4869-9813-730372ea378e'
|
|
5
|
+
}
|
|
6
|
+
};
|
|
7
|
+
const BonLoyaltyRewardsReferralsConfig = {
|
|
8
|
+
BonLoyaltyRewardsReferrals: {
|
|
9
|
+
appName: 'bon-loyalty',
|
|
10
|
+
appId: '63496a04-c097-48d1-8c11-475aec24b12e'
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
const SubifySubscriptionsConfig = {
|
|
14
|
+
SubifySubscriptionsApp: {
|
|
15
|
+
appName: 'subify-subscriptions-app',
|
|
16
|
+
appId: 'bc0dba25-cd46-4841-bea4-6bdfe9ac815f'
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const SelleasyConfig = {
|
|
20
|
+
Selleasy: {
|
|
21
|
+
appName: 'selleasy',
|
|
22
|
+
appId: '790c1a03-a71f-4bc1-9869-00dad526d3c2'
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const LoopSubscriptionsConfig = {
|
|
26
|
+
LoopSubscriptions: {
|
|
27
|
+
appName: 'loop-subscriptions',
|
|
28
|
+
appId: '267a7c64-5cb3-4552-b817-5485165f0a0b'
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const SkioSubscriptionsYcS20Config = {
|
|
32
|
+
SkioSubscriptionsYcS20: {
|
|
33
|
+
appName: 'skio-subscriptions-yc-s20',
|
|
34
|
+
appId: 'de50f7a4-0bb0-4d4c-84e2-c03dce83436d'
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const ShopifyFormsConfig = {
|
|
38
|
+
ShopifyForms: {
|
|
39
|
+
appName: 'forms',
|
|
40
|
+
appId: '8744a304-fcb1-4347-b211-bb6b4759a76a'
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export { BonLoyaltyRewardsReferralsConfig, LoopSubscriptionsConfig, RechargeSubscriptionsConfig, SelleasyConfig, ShopifyFormsConfig, SkioSubscriptionsYcS20Config, SubifySubscriptionsConfig };
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
const RechargeSubscriptions = {
|
|
2
|
+
RechargeSubscriptions: {
|
|
3
|
+
'subscription-widget': {
|
|
4
|
+
product: '{{ product }}'
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
};
|
|
8
|
+
const LoyaltyRewardsReferrals = {
|
|
9
|
+
BonLoyaltyRewardsReferrals: {
|
|
10
|
+
'loyalty-page-block': null,
|
|
11
|
+
'loyalty-page-earning-block': null,
|
|
12
|
+
'loyalty-page-header-block': null,
|
|
13
|
+
'loyalty-page-profile-block': null,
|
|
14
|
+
'loyalty-page-redeem-block': null,
|
|
15
|
+
'loyalty-page-referral-block': null,
|
|
16
|
+
'loyalty-page-tier-block': null,
|
|
17
|
+
'product-point-preview': null
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const SubifySubscriptions = {
|
|
21
|
+
SubifySubscriptionsApp: {
|
|
22
|
+
'app-block': {
|
|
23
|
+
product: '{{product}}',
|
|
24
|
+
use_app_block_wording: false,
|
|
25
|
+
widget_label: 'Purchase options',
|
|
26
|
+
one_time_purchase_text: 'One-Time Purchase',
|
|
27
|
+
subscription_text: 'Subscribe and save',
|
|
28
|
+
delivery_frequency_text: 'Delivery frequency',
|
|
29
|
+
prepaid_subscription_text: 'Subscription with prepaid',
|
|
30
|
+
skin1_priceSuffix: 'each',
|
|
31
|
+
skin1_save: 'Save(skin1)',
|
|
32
|
+
skin1_prepaid_payment_title: 'prepaid',
|
|
33
|
+
skin1_normal_payment_title: 'pay as you go',
|
|
34
|
+
skin2_discountSuffix: 'Save',
|
|
35
|
+
skin3_fullPrice: 'Full price',
|
|
36
|
+
skin3_priceSuffix: 'each',
|
|
37
|
+
skin3_discountSuffix: 'Off',
|
|
38
|
+
skin4_justOnce: 'Just once',
|
|
39
|
+
skin4_discountSuffix: 'Off',
|
|
40
|
+
skin4_priceSuffix: 'each',
|
|
41
|
+
skin4_fullPrice: '(Full price)',
|
|
42
|
+
skin4_sellingPlansTitle: 'Renews every:',
|
|
43
|
+
from: 'from',
|
|
44
|
+
max_discount_badge_title: 'UP To',
|
|
45
|
+
pay: 'Pay',
|
|
46
|
+
price_save_up_to: 'save up to'
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const SelleasyWidget = {
|
|
51
|
+
Selleasy: {
|
|
52
|
+
'lb-upsell-fbt-block': null,
|
|
53
|
+
'lb-upsell-addon-block': null
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const LoopSubscriptions = {
|
|
57
|
+
LoopSubscriptions: {
|
|
58
|
+
star_rating: {
|
|
59
|
+
product: '{{product}}'
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
const SkioSubscriptionsYcS20 = {
|
|
64
|
+
SkioSubscriptionsYcS20: {
|
|
65
|
+
'app-block': null
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
const ShopifyForms = {
|
|
69
|
+
ShopifyForms: {
|
|
70
|
+
inline: {
|
|
71
|
+
form_id: null
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
const overrideSettings = (tag, currentSetting, appSetting)=>{
|
|
76
|
+
switch(tag){
|
|
77
|
+
case 'ShopifyForms':
|
|
78
|
+
return {
|
|
79
|
+
...currentSetting,
|
|
80
|
+
form_id: appSetting['formId']
|
|
81
|
+
};
|
|
82
|
+
default:
|
|
83
|
+
return currentSetting;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
const composeSettingsByWidgetType = {
|
|
87
|
+
...ShopifyForms,
|
|
88
|
+
...SkioSubscriptionsYcS20,
|
|
89
|
+
...LoopSubscriptions,
|
|
90
|
+
...RechargeSubscriptions,
|
|
91
|
+
...LoyaltyRewardsReferrals,
|
|
92
|
+
...SubifySubscriptions,
|
|
93
|
+
...SelleasyWidget
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export { composeSettingsByWidgetType, overrideSettings };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { pascalToKebab } from '../pascal-to-kebab-case.js';
|
|
2
|
+
import { THIRD_PARTY_APP_BLOCK_ID_PREFIX } from './constant.js';
|
|
3
|
+
|
|
4
|
+
const composeAppBlockId = (tag, uid)=>{
|
|
5
|
+
const key = pascalToKebab(tag);
|
|
6
|
+
return `${THIRD_PARTY_APP_BLOCK_ID_PREFIX}_${key}_${uid}`;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export { composeAppBlockId };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RechargeSubscriptionsConfig, BonLoyaltyRewardsReferralsConfig, SubifySubscriptionsConfig, SelleasyConfig, LoopSubscriptionsConfig, SkioSubscriptionsYcS20Config, ShopifyFormsConfig } from './appConfig.js';
|
|
2
|
+
|
|
3
|
+
const mapShopifyAppMeta = {
|
|
4
|
+
...RechargeSubscriptionsConfig,
|
|
5
|
+
...BonLoyaltyRewardsReferralsConfig,
|
|
6
|
+
...SubifySubscriptionsConfig,
|
|
7
|
+
...SelleasyConfig,
|
|
8
|
+
...LoopSubscriptionsConfig,
|
|
9
|
+
...SkioSubscriptionsYcS20Config,
|
|
10
|
+
...ShopifyFormsConfig
|
|
11
|
+
};
|
|
12
|
+
const THIRD_PARTY_APP_BLOCK_ID_PREFIX = 'gp_app';
|
|
13
|
+
|
|
14
|
+
export { THIRD_PARTY_APP_BLOCK_ID_PREFIX, mapShopifyAppMeta };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { loopComponent } from '../loop-component.js';
|
|
2
|
+
import { getAppBlockConfig } from './getAppBlockConfig.js';
|
|
3
|
+
|
|
4
|
+
const generateAppBlockConfigs = (component)=>{
|
|
5
|
+
const strComponent = JSON.stringify(component) || '';
|
|
6
|
+
if (!strComponent.includes('appBlockId')) return null;
|
|
7
|
+
const configs = [];
|
|
8
|
+
loopComponent(component, (component)=>{
|
|
9
|
+
const settings = component.settings || {};
|
|
10
|
+
const appBlockId = settings?.appBlockId || '';
|
|
11
|
+
if (!appBlockId) return;
|
|
12
|
+
const config = getAppBlockConfig(component.tag, appBlockId, settings);
|
|
13
|
+
if (!config) return;
|
|
14
|
+
configs.push(config);
|
|
15
|
+
});
|
|
16
|
+
if (!configs.length) return null;
|
|
17
|
+
return {
|
|
18
|
+
newBlocks: extractBlocks(configs),
|
|
19
|
+
newBlockOrder: extractBlockOrder(configs)
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
function extractBlocks(array) {
|
|
23
|
+
return array.reduce((acc, item)=>{
|
|
24
|
+
acc[item.key] = item.value;
|
|
25
|
+
return acc;
|
|
26
|
+
}, {});
|
|
27
|
+
}
|
|
28
|
+
function extractBlockOrder(array) {
|
|
29
|
+
return array.map((item)=>item.key);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { generateAppBlockConfigs };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { composeSettingsByWidgetType, overrideSettings } from './appSetting.js';
|
|
2
|
+
import { getAppBlockType } from './getAppBlockType.js';
|
|
3
|
+
|
|
4
|
+
const getAppBlockConfig = (tag, appBlockId, settings)=>{
|
|
5
|
+
const appBlockType = getAppBlockType({
|
|
6
|
+
tag,
|
|
7
|
+
widgetType: settings?.widgetType
|
|
8
|
+
});
|
|
9
|
+
const settingByWidget = composeSettingsByWidgetType[tag][settings?.widgetType];
|
|
10
|
+
const appSettings = overrideSettings(tag, settingByWidget, settings);
|
|
11
|
+
return {
|
|
12
|
+
key: appBlockId,
|
|
13
|
+
value: {
|
|
14
|
+
type: appBlockType,
|
|
15
|
+
...settingByWidget && {
|
|
16
|
+
settings: appSettings
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { getAppBlockConfig };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { mapShopifyAppMeta } from './constant.js';
|
|
2
|
+
|
|
3
|
+
const getAppBlockType = ({ tag, widgetType })=>{
|
|
4
|
+
const shopifyAppMeta = mapShopifyAppMeta[tag];
|
|
5
|
+
if (!shopifyAppMeta) return '';
|
|
6
|
+
const { appName, appId } = shopifyAppMeta;
|
|
7
|
+
return `shopify://apps/${appName}/blocks/${widgetType}/${appId}`;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { getAppBlockType };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { addAppBlockId } from './addAppBlockId.js';
|
|
2
|
+
import { generateAppBlockConfigs } from './generateAppBlockConfigs.js';
|
|
3
|
+
import { mergeBlocks } from './mergeBlock.js';
|
|
4
|
+
import { mergeBlockOrder } from './mergeBlockOrder.js';
|
|
5
|
+
import { removeAllGPAppItemsFromBlocks, removeAllGPAppItemsFromBlockOrder } from './removeGPAppItems.js';
|
|
6
|
+
|
|
7
|
+
const getAppBlocks = (section)=>{
|
|
8
|
+
const { blocks: currentBlock, block_order: currentBlockOrder } = JSON.parse(section?.appBlocks || '{}');
|
|
9
|
+
const component = JSON.parse(section?.component || '');
|
|
10
|
+
const componentWithAppBlockId = addAppBlockId(component);
|
|
11
|
+
const appBlockConfigs = generateAppBlockConfigs(componentWithAppBlockId);
|
|
12
|
+
if (!appBlockConfigs) {
|
|
13
|
+
if (!currentBlock || !currentBlockOrder) return {};
|
|
14
|
+
return {
|
|
15
|
+
blocks: removeAllGPAppItemsFromBlocks(currentBlock),
|
|
16
|
+
block_order: removeAllGPAppItemsFromBlockOrder(currentBlockOrder)
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
const { newBlocks, newBlockOrder } = appBlockConfigs;
|
|
20
|
+
const blocks = mergeBlocks(newBlocks, currentBlock);
|
|
21
|
+
const block_order = mergeBlockOrder(newBlockOrder, currentBlockOrder);
|
|
22
|
+
return {
|
|
23
|
+
blocks,
|
|
24
|
+
block_order
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { getAppBlocks };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
function mergeBlocks(newBlocks, blocks) {
|
|
2
|
+
if (!blocks) return newBlocks;
|
|
3
|
+
const result = {};
|
|
4
|
+
// Add all non-gp_app blocks from the original blocks
|
|
5
|
+
for (const [key, value] of Object.entries(blocks)){
|
|
6
|
+
if (!key.startsWith('gp_app')) {
|
|
7
|
+
result[key] = value;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
// Add all blocks from new-blocks
|
|
11
|
+
for (const [key, value] of Object.entries(newBlocks)){
|
|
12
|
+
result[key] = value;
|
|
13
|
+
}
|
|
14
|
+
return result;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { mergeBlocks };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { THIRD_PARTY_APP_BLOCK_ID_PREFIX } from './constant.js';
|
|
2
|
+
|
|
3
|
+
function isGpAppItem(item) {
|
|
4
|
+
if (!item) return false;
|
|
5
|
+
return item.startsWith(THIRD_PARTY_APP_BLOCK_ID_PREFIX);
|
|
6
|
+
}
|
|
7
|
+
function filterCurrentOrder(currentOrder, newOrderSet) {
|
|
8
|
+
return currentOrder.filter((item)=>!isGpAppItem(item) || newOrderSet.has(item));
|
|
9
|
+
}
|
|
10
|
+
function processNonGpAppItem(item, resultOrder) {
|
|
11
|
+
resultOrder.push(item);
|
|
12
|
+
}
|
|
13
|
+
function processGpAppItems(newOrder, newOrderIndex, resultOrder) {
|
|
14
|
+
while(newOrderIndex < newOrder.length && isGpAppItem(newOrder[newOrderIndex])){
|
|
15
|
+
resultOrder.push(newOrder[newOrderIndex]);
|
|
16
|
+
newOrderIndex++;
|
|
17
|
+
}
|
|
18
|
+
return newOrderIndex;
|
|
19
|
+
}
|
|
20
|
+
function addRemainingGpAppItems(newOrder, startIndex, resultOrder) {
|
|
21
|
+
for(let i = startIndex; i < newOrder.length; i++){
|
|
22
|
+
const item = newOrder[i];
|
|
23
|
+
if (item && isGpAppItem(item)) {
|
|
24
|
+
resultOrder.push(item);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function mergeBlockOrder(newOrder, currentOrder) {
|
|
29
|
+
if (!currentOrder) return newOrder;
|
|
30
|
+
const newOrderSet = new Set(newOrder);
|
|
31
|
+
const filteredCurrentOrder = filterCurrentOrder(currentOrder, newOrderSet);
|
|
32
|
+
const resultOrder = [];
|
|
33
|
+
let newOrderIndex = 0;
|
|
34
|
+
filteredCurrentOrder.forEach((item)=>{
|
|
35
|
+
if (!isGpAppItem(item)) {
|
|
36
|
+
processNonGpAppItem(item, resultOrder);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
newOrderIndex = processGpAppItems(newOrder, newOrderIndex, resultOrder);
|
|
40
|
+
});
|
|
41
|
+
addRemainingGpAppItems(newOrder, newOrderIndex, resultOrder);
|
|
42
|
+
return resultOrder;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { mergeBlockOrder };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { THIRD_PARTY_APP_BLOCK_ID_PREFIX } from './constant.js';
|
|
2
|
+
|
|
3
|
+
const removeAllGPAppItemsFromBlocks = (blocks)=>{
|
|
4
|
+
for(const key in blocks){
|
|
5
|
+
if (key.startsWith(THIRD_PARTY_APP_BLOCK_ID_PREFIX)) {
|
|
6
|
+
delete blocks[key];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return blocks;
|
|
10
|
+
};
|
|
11
|
+
const removeAllGPAppItemsFromBlockOrder = (blockOrder)=>{
|
|
12
|
+
return blockOrder.filter((item)=>!item.includes(THIRD_PARTY_APP_BLOCK_ID_PREFIX));
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { removeAllGPAppItemsFromBlockOrder, removeAllGPAppItemsFromBlocks };
|
package/dist/esm/index.js
CHANGED
|
@@ -107,3 +107,5 @@ export { AnimationDirectionType, AnimationEasingType, AnimationSetting, Animatio
|
|
|
107
107
|
export { calculateFirstProduct, getCollection } from './helpers/queries/get-collection.js';
|
|
108
108
|
export { fetchMedias, fetchVariants, getProduct } from './helpers/queries/get-product.js';
|
|
109
109
|
export { getProductBySlug } from './helpers/queries/get-product-by-slug.js';
|
|
110
|
+
export { getAppBlocks } from './helpers/third-party/getAppBlocks.js';
|
|
111
|
+
export { addAppBlockId } from './helpers/third-party/addAppBlockId.js';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -75,7 +75,7 @@ type Article$2 = {
|
|
|
75
75
|
platform?: Maybe$1<ArticlePlatform$1>;
|
|
76
76
|
platformCreatedAt?: Maybe$1<Scalars$2['Time']>;
|
|
77
77
|
platformUpdatedAt?: Maybe$1<Scalars$2['Time']>;
|
|
78
|
-
tags
|
|
78
|
+
tags?: Maybe$1<Array<Maybe$1<Tag$1>>>;
|
|
79
79
|
templateSuffix?: Maybe$1<Scalars$2['String']>;
|
|
80
80
|
title?: Maybe$1<Scalars$2['String']>;
|
|
81
81
|
titleMeta?: Maybe$1<Scalars$2['String']>;
|
|
@@ -2333,6 +2333,7 @@ type Entity = {
|
|
|
2333
2333
|
findPublishedThemePageOnlineStoreDataByID: PublishedThemePageOnlineStoreData$1;
|
|
2334
2334
|
findPublishedThemeSectionByID: PublishedThemeSection$1;
|
|
2335
2335
|
findPublishedThemeStyleByID: PublishedThemeStyle$1;
|
|
2336
|
+
findTagByID: Tag$1;
|
|
2336
2337
|
};
|
|
2337
2338
|
type EntityFindMetafieldByIdArgs = {
|
|
2338
2339
|
id: Scalars$2['ID'];
|
|
@@ -2373,6 +2374,9 @@ type EntityFindPublishedThemeSectionByIdArgs = {
|
|
|
2373
2374
|
type EntityFindPublishedThemeStyleByIdArgs = {
|
|
2374
2375
|
id: Scalars$2['ID'];
|
|
2375
2376
|
};
|
|
2377
|
+
type EntityFindTagByIdArgs = {
|
|
2378
|
+
id: Scalars$2['ID'];
|
|
2379
|
+
};
|
|
2376
2380
|
type Media$1 = {
|
|
2377
2381
|
alt?: Maybe$1<Scalars$2['String']>;
|
|
2378
2382
|
contentType?: Maybe$1<Scalars$2['String']>;
|
|
@@ -6334,6 +6338,12 @@ type StoreProperty$1 = {
|
|
|
6334
6338
|
primaryDomain?: Maybe$1<Scalars$2['String']>;
|
|
6335
6339
|
swatchesConfig: Scalars$2['String'];
|
|
6336
6340
|
};
|
|
6341
|
+
type Tag$1 = {
|
|
6342
|
+
createdAt?: Maybe$1<Scalars$2['Time']>;
|
|
6343
|
+
id: Scalars$2['ID'];
|
|
6344
|
+
name?: Maybe$1<Scalars$2['String']>;
|
|
6345
|
+
updatedAt?: Maybe$1<Scalars$2['Time']>;
|
|
6346
|
+
};
|
|
6337
6347
|
type TagType$1 = 'ARTICLE' | 'BLOG' | 'COLLECTION' | 'PRODUCT';
|
|
6338
6348
|
/**
|
|
6339
6349
|
* TagWhereInput is used for filtering Tag objects.
|
|
@@ -6452,7 +6462,7 @@ type VariantProductOptionWhereInput$1 = {
|
|
|
6452
6462
|
variantIDNEQ?: InputMaybe$1<Scalars$2['ID']>;
|
|
6453
6463
|
variantIDNotIn?: InputMaybe$1<Array<Scalars$2['ID']>>;
|
|
6454
6464
|
};
|
|
6455
|
-
type _Entity = Metafield$1 | Product$1 | PublishedCustomSection$1 | PublishedPageInteraction$1 | PublishedPageSection$1 | PublishedPageSectionMeta$1 | PublishedShopMeta$1 | PublishedThemePage$1 | PublishedThemePageCustomSection$1 | PublishedThemePageMeta$1 | PublishedThemePageOnlineStoreData$1 | PublishedThemeSection$1 | PublishedThemeStyle$1;
|
|
6465
|
+
type _Entity = Metafield$1 | Product$1 | PublishedCustomSection$1 | PublishedPageInteraction$1 | PublishedPageSection$1 | PublishedPageSectionMeta$1 | PublishedShopMeta$1 | PublishedThemePage$1 | PublishedThemePageCustomSection$1 | PublishedThemePageMeta$1 | PublishedThemePageOnlineStoreData$1 | PublishedThemeSection$1 | PublishedThemeStyle$1 | Tag$1;
|
|
6456
6466
|
type _Service = {
|
|
6457
6467
|
sdl?: Maybe$1<Scalars$2['String']>;
|
|
6458
6468
|
};
|
|
@@ -6471,6 +6481,7 @@ type shop_EntityFindPublishedThemePageMetaByIdArgs = EntityFindPublishedThemePag
|
|
|
6471
6481
|
type shop_EntityFindPublishedThemePageOnlineStoreDataByIdArgs = EntityFindPublishedThemePageOnlineStoreDataByIdArgs;
|
|
6472
6482
|
type shop_EntityFindPublishedThemeSectionByIdArgs = EntityFindPublishedThemeSectionByIdArgs;
|
|
6473
6483
|
type shop_EntityFindPublishedThemeStyleByIdArgs = EntityFindPublishedThemeStyleByIdArgs;
|
|
6484
|
+
type shop_EntityFindTagByIdArgs = EntityFindTagByIdArgs;
|
|
6474
6485
|
type shop_Query_EntitiesArgs = Query_EntitiesArgs;
|
|
6475
6486
|
type shop__Entity = _Entity;
|
|
6476
6487
|
type shop__Service = _Service;
|
|
@@ -6553,6 +6564,7 @@ declare namespace shop {
|
|
|
6553
6564
|
shop_EntityFindPublishedThemePageOnlineStoreDataByIdArgs as EntityFindPublishedThemePageOnlineStoreDataByIdArgs,
|
|
6554
6565
|
shop_EntityFindPublishedThemeSectionByIdArgs as EntityFindPublishedThemeSectionByIdArgs,
|
|
6555
6566
|
shop_EntityFindPublishedThemeStyleByIdArgs as EntityFindPublishedThemeStyleByIdArgs,
|
|
6567
|
+
shop_EntityFindTagByIdArgs as EntityFindTagByIdArgs,
|
|
6556
6568
|
Exact$1 as Exact,
|
|
6557
6569
|
InputMaybe$1 as InputMaybe,
|
|
6558
6570
|
MakeMaybe$1 as MakeMaybe,
|
|
@@ -6693,6 +6705,7 @@ declare namespace shop {
|
|
|
6693
6705
|
ShopShopify$1 as ShopShopify,
|
|
6694
6706
|
ShopTokenWhereInput$1 as ShopTokenWhereInput,
|
|
6695
6707
|
StoreProperty$1 as StoreProperty,
|
|
6708
|
+
Tag$1 as Tag,
|
|
6696
6709
|
TagType$1 as TagType,
|
|
6697
6710
|
TagWhereInput$1 as TagWhereInput,
|
|
6698
6711
|
VariantProductOptionWhereInput$1 as VariantProductOptionWhereInput,
|
|
@@ -37217,7 +37230,8 @@ type ArticlesQueryVariables = Exact$1<{
|
|
|
37217
37230
|
type ArticlesQueryResponse = {
|
|
37218
37231
|
articles?: Maybe$1<(Pick<ArticleConnection$1, 'totalCount'> & {
|
|
37219
37232
|
edges: Array<(Pick<ArticleEdge$1, 'cursor'> & {
|
|
37220
|
-
node?: Maybe$1<(Pick<Article$2, 'id' | 'title' | 'handle' | 'description' | 'templateSuffix' | 'titleMeta' | 'descriptionMeta' | 'baseID' | 'platform' | '
|
|
37233
|
+
node?: Maybe$1<(Pick<Article$2, 'id' | 'title' | 'handle' | 'description' | 'templateSuffix' | 'titleMeta' | 'descriptionMeta' | 'baseID' | 'platform' | 'isSample' | 'platformCreatedAt' | 'author'> & {
|
|
37234
|
+
tags: Array<never>;
|
|
37221
37235
|
content?: Maybe$1<Pick<ArticleContent$1, 'excerptHtml'>>;
|
|
37222
37236
|
blogs?: Maybe$1<{
|
|
37223
37237
|
edges: Array<{
|
|
@@ -37246,9 +37260,15 @@ type BlogsQueryResponse = {
|
|
|
37246
37260
|
node?: Maybe$1<(Pick<Blog$1, 'baseID' | 'description' | 'descriptionMeta' | 'handle' | 'id' | 'platform' | 'tags' | 'templateSuffix' | 'title' | 'titleMeta'> & {
|
|
37247
37261
|
articles?: Maybe$1<(Pick<ArticleConnection$1, 'totalCount'> & {
|
|
37248
37262
|
edges: Array<(Pick<ArticleEdge$1, 'cursor'> & {
|
|
37249
|
-
node?: Maybe$1<(Pick<Article$2, 'id' | 'title' | 'handle' | 'description' | 'templateSuffix' | 'titleMeta' | 'descriptionMeta' | 'baseID' | '
|
|
37263
|
+
node?: Maybe$1<(Pick<Article$2, 'id' | 'title' | 'handle' | 'description' | 'templateSuffix' | 'titleMeta' | 'descriptionMeta' | 'baseID' | 'platform' | 'isSample' | 'platformCreatedAt' | 'author'> & {
|
|
37264
|
+
tags: Array<never>;
|
|
37250
37265
|
content?: Maybe$1<Pick<ArticleContent$1, 'excerptHtml'>>;
|
|
37251
|
-
|
|
37266
|
+
blogs?: Maybe$1<{
|
|
37267
|
+
edges: Array<{
|
|
37268
|
+
node?: Maybe$1<Pick<Blog$1, 'title' | 'handle'>>;
|
|
37269
|
+
}>;
|
|
37270
|
+
}>;
|
|
37271
|
+
media?: Maybe$1<Pick<Media$1, 'alt' | 'width' | 'src' | 'height'>>;
|
|
37252
37272
|
})>;
|
|
37253
37273
|
})>;
|
|
37254
37274
|
})>;
|
|
@@ -37343,4 +37363,18 @@ type PublishedThemePageSelectFragment = Pick<PublishedThemePage$1, 'id' | 'name'
|
|
|
37343
37363
|
|
|
37344
37364
|
declare const getProductBySlug: (fetcher: FetchFunc, slug?: string) => Promise<ProductSelectFragment>;
|
|
37345
37365
|
|
|
37346
|
-
|
|
37366
|
+
declare const getAppBlocks: (section: PublishedPageSection$1 & {
|
|
37367
|
+
appBlocks: string;
|
|
37368
|
+
}) => {
|
|
37369
|
+
blocks?: undefined;
|
|
37370
|
+
block_order?: undefined;
|
|
37371
|
+
} | {
|
|
37372
|
+
blocks: {
|
|
37373
|
+
[key: string]: any;
|
|
37374
|
+
};
|
|
37375
|
+
block_order: string[];
|
|
37376
|
+
};
|
|
37377
|
+
|
|
37378
|
+
declare const addAppBlockId: (component: Component) => Component;
|
|
37379
|
+
|
|
37380
|
+
export { AddOn, AddonProvider, AddonProviderProps, AdvancedType, AliReviewsWidgetType, AlignItemProp, AlignProp, AnimationBaseSetting, AnimationConfig, AnimationDirectionType, AnimationEasingType, AnimationFadeSettingType, AnimationSetting, AnimationSettingType, AnimationShakeSettingType, AnimationSlideSettingType, AnimationTrigger, AnimationTriggerType, AnimationType, AnimationZoomDirectionType, AnimationZoomSettingType, appAPI as AppAPIType, ArticleListProvider, ArticleListProviderProps, ArticleProvider, ArticleProviderProps, Background, BaseProps, BasePropsWrap, BlockEntity, BogosWidgetType, BoldSubscriptionsWidgetType, Border, BorderStyle, BuilderComponentProvider, BuilderComponentProviderProps, BuilderEntity, BuilderEntityNested, BuilderPreviewProvider, BuilderPreviewProviderProps, BuilderProvider, BuilderProviderProps, BuilderState, Builtin, CartLineProvider, CartLineProviderProps, CollectionDetailFilterDocument, CollectionDetailFilterQueryResponse, CollectionDetailFilterQueryVariables, CollectionDocument, CollectionProvider, CollectionProviderProps, CollectionQueryResponse, CollectionQueryVariables, CollectionSelectFragment, CollectionsDocument, CollectionsQueryResponse, CollectionsQueryVariables, ColorKey, ColorType$1 as ColorType, ColorValueType, Component, ComponentPreset, ComponentSetting, ContainerProp, ControlProp, ControlTriggerAction, ControlUI, CornerRadius, CornerRadiusType, CustomComponentConfig, DeepPartial, DynamicCollection, DynamicProduct, ExtractState, FeraReviewsV3WidgetType, FeraReviewsWidgetType, FetchCollectionArgs, FetchFunc, FetchProductParams, FlexDirectionProp, FontName, GRADIENT_BGR_KEY, GlobalStyleConfig, GlobalStyleResponsiveConfig, GlobalSwatchesData, GraphQLConnection, GroupPropType, GrowaveWidgetType, HSLAColorType, HSLColorType, HexColorType, ImageShape$1 as ImageShape, InitComponentType, InstantJudgeMeReviewsWidgetType, InstantKlaviyoWidgetType, InstantLooxReviewsWidgetType, JudgeMeReviewsWidgetType, KlaviyoWidgetType, LaiProductReviewsAdvancedWidgetType, LaiProductReviewsWidgetType, LibrarySaleFunnelDocument, LibrarySaleFunnelQueryResponse, LibrarySaleFunnelQueryVariables, LibraryTemplateDocument, LibraryTemplateQueryResponse, LibraryTemplateQueryVariables, LooxReviewsWidgetType, ModalProvider, ModalProviderProps, NameDevices$1 as NameDevices, NestedKeys, ObjectDeviceGlobalType, ObjectDevices, ObjectLayoutValue, OmnisendWidgetType, OnlyOne, OpinewDesignWidgetType, OpinewWidgetType, OptionNormalStyle, OptionSpecialStyle, Options, PageContext, PageProvider, PageProviderProps, PageType, PageViewUpDocument, PageViewUpMutationResponse, PageViewUpMutationVariables, PickyStoryWidgetType, PostPurchaseTypo, PreviewPageDocument, PreviewPageQueryResponse, PreviewPageQueryVariables, Primitive, ProductInputAnalytic, ProductListProvider, ProductListProviderProps, ProductOffer, ProductProvider, ProductProviderProps, ProductReviewsWidgetType, ProductSelectFragment, ProductsDocument, ProductsQueryResponse, ProductsQueryVariables, PublicStoreFrontData, PublishedThemePageSelectFragment, PublishedThemePagesDocument, PublishedThemePagesQueryResponse, PublishedThemePagesQueryVariables, RGBAColorType, RGBColorType, Ratio$1 as Ratio, RawChild, RenderMemo as Render, RenderChildren, RenderIf, Render as RenderLiquid, RenderMode, RenderPreviewMemo as RenderPreview, RequiredCursorEdge, ResponsiveKey, ResponsiveStateProp, RivyoWidgetType, RoundedSize, RyviuWidgetType, SaleFunnelDiscount$1 as SaleFunnelDiscount, SaleFunnelDiscountEdge$1 as SaleFunnelDiscountEdge, SaleFunnelDiscountObjectType$1 as SaleFunnelDiscountObjectType, SaleFunnelDiscountType$1 as SaleFunnelDiscountType, SaleFunnelDiscountValueType$1 as SaleFunnelDiscountValueType, SaleFunnelDiscountsDocument, SaleFunnelDiscountsQueryResponse, SaleFunnelDiscountsQueryVariables, Scalars$1 as Scalars, ScaleByDirection, SectionData, SectionEntity, SectionProvider, SectionProviderProps, SettingByAnimationType, SettingByAnimationValues, ShadowProps, ShadowStyle, ShadowStyleApplied, ShadowType, ShopProvider, ShopProviderProps, shop as ShopType, SizeProps, SizeSetting, SizeSettingGlobal, SizeType, SpacingType, StampedWidgetType, StateProp, StateSelector, StateType, StoreConfig, StorePropertyDocument, StorePropertyQueryResponse, StorePropertyQueryVariables, SwatchesOptionType, SwatchesOptionValue, ThemePageDocument, ThemePageQueryResponse, ThemePageQueryVariables, ThemeSectionStatus$1 as ThemeSectionStatus, TransformProp, TriggerConfig, TrustooWidgetType, TypographyProps, TypographySetting, TypographySettingV2, TypographyType, TypographyV2Attrs, TypographyV2Props, UltimateSalesBoostWidgetType, VariantSelectFragment, VitalsWidgetType, WiserV2WidgetType, WiserWidgetType, WrapRenderChildren, YotpoReviewsWidgetType, addAppBlockId, animations, baseAssetURL, calculateFirstProduct, checkAvailableVariantInStock, cls, composeAdvanceStyle, composeAdvanceStyleForPostPurchase, composeBackgroundCss, composeBorderCss, composeCornerCss, composeFallbackTypographyStyle, composeFontFamilyTypographyV2, composeGridLayout, composeMemo, composePositionLineHeight, composePostionIconList, composeRadius, composeRadiusResponsive, composeShadowCss, composeSize, composeSizeCss, composeSpacing, composeTextColorCss, composeTypography, composeTypographyAttr, composeTypographyClassName, composeTypographyCss, composeTypographyStyle, composeTypographyV2, composeTypographyV2Css, convertHTML, convertOldLayout, dataStringify, fetchMedias, fetchVariants, filterAttrInStyle, filterCornerInStyle, filterToolbarPreview, flattenConnection, fpixel, genSizeClass, genTypoClass, genVariable, generateCollectionQueryKey, generateProductQueryKey, generateProductsQueryKey, getAppBlocks, getAspectRatioGlobalSize, getBgImageByDevice, getBorderRadiusStyle, getBorderStyle, getCarouselContainerHeight, getCollection, getCornerCSSFromGlobal, getCustomRadius, getGlobalColorCSSProp, getGlobalColorClass, getGlobalColorResponsiveClass, getGlobalColorResponsiveStyle, getGlobalColorStateClass, getGlobalColorStateClassDynamicBtn, getGlobalColorStateResponsiveClass, getGlobalColorStateResponsiveClassDynamicBtn, getGlobalColorStateResponsiveStyle, getGlobalColorStateStyle, getGlobalColorStyle, getGlobalSizeGap, getGradientBgrStyleByDevice, getGradientBgrStyleForButton, getHeightByShapeGlobalSize, getPaddingGlobalSize, getProduct, getProductBySlug, getRadiusCSSFromGlobal, getRadiusStyleActiveState, getResponsiveStateValue, getResponsiveValue, getResponsiveValueByScreen, getSelectedVariant, getShortName, getSingleColorVariable, getSpacingVariable, getStyleBackgroundByDevice, getStyleBgColor, getStyleShadow, getStyleShadowState, getValueByDevice, getWidthByShapeGlobalSize, getWidthHeightGlobalSize, globalEvent, gridToArrayRegex, gtag, handleConvertBorderColor, handleConvertBorderStyle, handleConvertBorderWidth, handleConvertClassColor, handleConvertClassColorDynamicBtn, isBrowser, isColor, isColumnDirectionExist, isDefined, isEmptyChildren, isLocalEnv, isSafari, loadScript, makeAspectRatio, makeContainerWidthOrHeight, makeDotGapToCarouselStyle, makeFixedBgAttachment, makeGlobalSize, makeGlobalSizeHeightResponsive, makeGlobalSizeIcon, makeGlobalSizeWidthResponsive, makeHeight, makeLineClamp, makeStyle, makeStyleKey, makeStyleResponsive, makeStyleResponsiveByScreen, makeStyleResponsiveState, makeStyleState, makeStyleWithDefault, makeWidth, normalizeBuilderData, optionLayoutStyle, parseSelectedOption, parseValueWithUnit, prefetchQueries, props, removeAttrInStyle, removeNullUndefined, removePaddingYInStyle, removeUndefinedValuesFromObject, shopifyPriceRounding, splitStyle, styles, template, tiktokpixel, useAddToCart, useAddon, useAddons, useArticleListStore, useArticleStore, useArticlesQuery, useBlogsQuery, useBuilderComponent, useBuilderPreviewStore, useBuilderStore, useCartData, useCartDiscountCodesUpdate, useCartId, useCartLine, useCartLineStore, useCartNoteUpdate, useCartUI, useCheckAvailableVariantInStock, useCheckoutUrl, useCollection, useCollectionQuery, useCollectionStore, useCollectionsQuery, useConnectedShopify, useCreateCart, useCurrency, useCurrentDevice, useCurrentVariant, useCurrentVariantInStock, useEditorMode, useFeaturedImageGlobal, useFormatMoney, useInitialSwatchesOptions, useIsSampleProduct, useIsStorefrontProduct, useIsSyncProduct, useIsomorphicLayoutEffect, useLazyVideo, useLoadScript, useLocale, useMatchMutate, useMobileOnly, useModalStore, useMoney, useMoneyFormat, usePageStore, usePageType, usePluginEnable, usePrevious, useProduct, useProductList, useProductListProducts, useProductListSettings, useProductListStore, useProductListStyles, useProductOfferDiscount, useProductProperties, useProductQuery, useProductStore, useProductsQuery, useProductsQueryAll, useQuantity, useRemoveCartItem, useSection, useSectionStore, useSelectedOption, useShopStore, useStoreFront, useSuspenseFetch, useSwatches, useSwatchesOptions, useUniqProductID, useUpdateCartItem, useVariant, useVariantOutStock, useVariants, validateEmail };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/core",
|
|
3
|
-
"version": "1.46.0
|
|
3
|
+
"version": "1.46.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -27,12 +27,13 @@
|
|
|
27
27
|
"type-check": "yarn tsc --noEmit"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@gem-sdk/adapter-shopify": "1.
|
|
31
|
-
"@gem-sdk/styles": "1.46.0
|
|
30
|
+
"@gem-sdk/adapter-shopify": "1.46.0",
|
|
31
|
+
"@gem-sdk/styles": "1.46.0",
|
|
32
32
|
"@types/classnames": "^2.3.1"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"classnames": "^2.5.1",
|
|
36
|
+
"cssjson": "2.1.3",
|
|
36
37
|
"dayjs": "^1.11.11",
|
|
37
38
|
"react-error-boundary": "4.0.10",
|
|
38
39
|
"swr": "2.1.2",
|