@gem-sdk/core 1.47.0-staging.2 → 1.47.0-staging.4
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 +43 -7
- package/dist/cjs/components/Render.liquid.js +0 -1
- package/dist/cjs/hooks/useProduct.js +1 -2
- package/dist/esm/components/ComponentToolbarPreview.js +43 -7
- package/dist/esm/components/Render.liquid.js +0 -1
- package/dist/esm/hooks/useProduct.js +1 -2
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -47,6 +47,7 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
47
47
|
const [deleteTooltipPosition, setDeleteTooltipPosition] = react.useState('top');
|
|
48
48
|
const [isDisableDelete, setIsUnableDelete] = react.useState(false);
|
|
49
49
|
const [parentProductUid, setParentProductUid] = react.useState('');
|
|
50
|
+
const [articleUid, setArticleUid] = react.useState('');
|
|
50
51
|
const [tooltipText, setTooltipText] = react.useState({
|
|
51
52
|
width: '',
|
|
52
53
|
text: ''
|
|
@@ -59,8 +60,21 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
59
60
|
const editProductElementList = [
|
|
60
61
|
'Product Title',
|
|
61
62
|
'Product Description',
|
|
62
|
-
'Product Price'
|
|
63
|
-
|
|
63
|
+
'Product Price'
|
|
64
|
+
];
|
|
65
|
+
const editArticleElementList = [
|
|
66
|
+
'Article Title',
|
|
67
|
+
'Article Content',
|
|
68
|
+
'Article Image',
|
|
69
|
+
'Article Author',
|
|
70
|
+
'Article Category',
|
|
71
|
+
'Article Date',
|
|
72
|
+
'Article Excerpt',
|
|
73
|
+
'Article Tags'
|
|
74
|
+
];
|
|
75
|
+
const editAbleElementList = [
|
|
76
|
+
...editProductElementList,
|
|
77
|
+
...editArticleElementList
|
|
64
78
|
];
|
|
65
79
|
const isOverToolbarPosition = (el, parent)=>{
|
|
66
80
|
const parentLength = parents.length;
|
|
@@ -107,15 +121,29 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
107
121
|
}, [
|
|
108
122
|
storefrontUrl
|
|
109
123
|
]);
|
|
110
|
-
const
|
|
111
|
-
return
|
|
124
|
+
const linkShopDefault = react.useMemo(()=>{
|
|
125
|
+
return `https://admin.shopify.com/store/${shopName}`;
|
|
112
126
|
}, [
|
|
113
|
-
productId,
|
|
114
127
|
shopName
|
|
115
128
|
]);
|
|
129
|
+
const linkEditProduct = react.useMemo(()=>{
|
|
130
|
+
return productId ? `${linkShopDefault}/products/${productId}` : '';
|
|
131
|
+
}, [
|
|
132
|
+
linkShopDefault,
|
|
133
|
+
productId
|
|
134
|
+
]);
|
|
135
|
+
const linkEditArticle = react.useMemo(()=>{
|
|
136
|
+
return articleUid ? `${linkShopDefault}/articles/${articleUid}` : '';
|
|
137
|
+
}, [
|
|
138
|
+
articleUid,
|
|
139
|
+
linkShopDefault
|
|
140
|
+
]);
|
|
116
141
|
// Get parents
|
|
117
142
|
const onActiveComponent = react.useCallback((e)=>{
|
|
118
143
|
const detail = e.detail;
|
|
144
|
+
if (detail?.articleId) {
|
|
145
|
+
setArticleUid(detail.articleId);
|
|
146
|
+
}
|
|
119
147
|
if (detail?.componentUid == props.uid) {
|
|
120
148
|
getDeleteTooltipPosition();
|
|
121
149
|
if (isSaleFunnelPage) {
|
|
@@ -207,7 +235,15 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
207
235
|
window.dispatchEvent(event);
|
|
208
236
|
};
|
|
209
237
|
const goToShopifyEditLink = ()=>{
|
|
210
|
-
|
|
238
|
+
if (editArticleElementList.includes(toolbarName() ?? '')) {
|
|
239
|
+
window.open(linkEditArticle, '_blank');
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
if (editProductElementList.includes(toolbarName() ?? '')) {
|
|
243
|
+
window.open(linkEditProduct, '_blank');
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
window.open(linkShopDefault, '_blank');
|
|
211
247
|
};
|
|
212
248
|
const onDelete = (e)=>{
|
|
213
249
|
e.preventDefault();
|
|
@@ -486,7 +522,7 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
486
522
|
})
|
|
487
523
|
})
|
|
488
524
|
}),
|
|
489
|
-
|
|
525
|
+
editAbleElementList.includes(toolbarName() ?? '') && /*#__PURE__*/ jsxRuntime.jsx(Tooltip.default, {
|
|
490
526
|
"data-toolbar-title": true,
|
|
491
527
|
enable: true,
|
|
492
528
|
"data-toolbar-disable": false,
|
|
@@ -20,7 +20,6 @@ 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
|
-
require('cssjson');
|
|
24
23
|
|
|
25
24
|
const componentsRenderWithParentId = [
|
|
26
25
|
'CarouselItem'
|
|
@@ -9,7 +9,6 @@ var PageContext = require('../contexts/PageContext.js');
|
|
|
9
9
|
require('@gem-sdk/adapter-shopify');
|
|
10
10
|
require('swr/mutation');
|
|
11
11
|
require('swr/infinite');
|
|
12
|
-
var useFormatMoney = require('./useFormatMoney.js');
|
|
13
12
|
require('vanilla-lazyload');
|
|
14
13
|
require('./useCartUI.js');
|
|
15
14
|
var variant = require('../helpers/variant.js');
|
|
@@ -206,7 +205,7 @@ const useProductOfferDiscount = ()=>{
|
|
|
206
205
|
const price = currentVariant?.price || 0;
|
|
207
206
|
currentDiscount = currentDiscount * price / 100;
|
|
208
207
|
}
|
|
209
|
-
return currentDiscount
|
|
208
|
+
return currentDiscount || 0;
|
|
210
209
|
};
|
|
211
210
|
|
|
212
211
|
exports.useCheckAvailableVariantInStock = useCheckAvailableVariantInStock;
|
|
@@ -43,6 +43,7 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
43
43
|
const [deleteTooltipPosition, setDeleteTooltipPosition] = useState('top');
|
|
44
44
|
const [isDisableDelete, setIsUnableDelete] = useState(false);
|
|
45
45
|
const [parentProductUid, setParentProductUid] = useState('');
|
|
46
|
+
const [articleUid, setArticleUid] = useState('');
|
|
46
47
|
const [tooltipText, setTooltipText] = useState({
|
|
47
48
|
width: '',
|
|
48
49
|
text: ''
|
|
@@ -55,8 +56,21 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
55
56
|
const editProductElementList = [
|
|
56
57
|
'Product Title',
|
|
57
58
|
'Product Description',
|
|
58
|
-
'Product Price'
|
|
59
|
-
|
|
59
|
+
'Product Price'
|
|
60
|
+
];
|
|
61
|
+
const editArticleElementList = [
|
|
62
|
+
'Article Title',
|
|
63
|
+
'Article Content',
|
|
64
|
+
'Article Image',
|
|
65
|
+
'Article Author',
|
|
66
|
+
'Article Category',
|
|
67
|
+
'Article Date',
|
|
68
|
+
'Article Excerpt',
|
|
69
|
+
'Article Tags'
|
|
70
|
+
];
|
|
71
|
+
const editAbleElementList = [
|
|
72
|
+
...editProductElementList,
|
|
73
|
+
...editArticleElementList
|
|
60
74
|
];
|
|
61
75
|
const isOverToolbarPosition = (el, parent)=>{
|
|
62
76
|
const parentLength = parents.length;
|
|
@@ -103,15 +117,29 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
103
117
|
}, [
|
|
104
118
|
storefrontUrl
|
|
105
119
|
]);
|
|
106
|
-
const
|
|
107
|
-
return
|
|
120
|
+
const linkShopDefault = useMemo(()=>{
|
|
121
|
+
return `https://admin.shopify.com/store/${shopName}`;
|
|
108
122
|
}, [
|
|
109
|
-
productId,
|
|
110
123
|
shopName
|
|
111
124
|
]);
|
|
125
|
+
const linkEditProduct = useMemo(()=>{
|
|
126
|
+
return productId ? `${linkShopDefault}/products/${productId}` : '';
|
|
127
|
+
}, [
|
|
128
|
+
linkShopDefault,
|
|
129
|
+
productId
|
|
130
|
+
]);
|
|
131
|
+
const linkEditArticle = useMemo(()=>{
|
|
132
|
+
return articleUid ? `${linkShopDefault}/articles/${articleUid}` : '';
|
|
133
|
+
}, [
|
|
134
|
+
articleUid,
|
|
135
|
+
linkShopDefault
|
|
136
|
+
]);
|
|
112
137
|
// Get parents
|
|
113
138
|
const onActiveComponent = useCallback((e)=>{
|
|
114
139
|
const detail = e.detail;
|
|
140
|
+
if (detail?.articleId) {
|
|
141
|
+
setArticleUid(detail.articleId);
|
|
142
|
+
}
|
|
115
143
|
if (detail?.componentUid == props.uid) {
|
|
116
144
|
getDeleteTooltipPosition();
|
|
117
145
|
if (isSaleFunnelPage) {
|
|
@@ -203,7 +231,15 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
203
231
|
window.dispatchEvent(event);
|
|
204
232
|
};
|
|
205
233
|
const goToShopifyEditLink = ()=>{
|
|
206
|
-
|
|
234
|
+
if (editArticleElementList.includes(toolbarName() ?? '')) {
|
|
235
|
+
window.open(linkEditArticle, '_blank');
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
if (editProductElementList.includes(toolbarName() ?? '')) {
|
|
239
|
+
window.open(linkEditProduct, '_blank');
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
window.open(linkShopDefault, '_blank');
|
|
207
243
|
};
|
|
208
244
|
const onDelete = (e)=>{
|
|
209
245
|
e.preventDefault();
|
|
@@ -482,7 +518,7 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
482
518
|
})
|
|
483
519
|
})
|
|
484
520
|
}),
|
|
485
|
-
|
|
521
|
+
editAbleElementList.includes(toolbarName() ?? '') && /*#__PURE__*/ jsx(Tooltip, {
|
|
486
522
|
"data-toolbar-title": true,
|
|
487
523
|
enable: true,
|
|
488
524
|
"data-toolbar-disable": false,
|
|
@@ -16,7 +16,6 @@ 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 'cssjson';
|
|
20
19
|
|
|
21
20
|
const componentsRenderWithParentId = [
|
|
22
21
|
'CarouselItem'
|
|
@@ -7,7 +7,6 @@ import { usePageStore } from '../contexts/PageContext.js';
|
|
|
7
7
|
import '@gem-sdk/adapter-shopify';
|
|
8
8
|
import 'swr/mutation';
|
|
9
9
|
import 'swr/infinite';
|
|
10
|
-
import { shopifyPriceRounding } from './useFormatMoney.js';
|
|
11
10
|
import 'vanilla-lazyload';
|
|
12
11
|
import './useCartUI.js';
|
|
13
12
|
import { checkInStock } from '../helpers/variant.js';
|
|
@@ -204,7 +203,7 @@ const useProductOfferDiscount = ()=>{
|
|
|
204
203
|
const price = currentVariant?.price || 0;
|
|
205
204
|
currentDiscount = currentDiscount * price / 100;
|
|
206
205
|
}
|
|
207
|
-
return currentDiscount
|
|
206
|
+
return currentDiscount || 0;
|
|
208
207
|
};
|
|
209
208
|
|
|
210
209
|
export { useCheckAvailableVariantInStock, useCurrentVariant, useCurrentVariantInStock, useFeaturedImageGlobal, useIsSyncProduct, useProduct, useProductOfferDiscount, useProductProperties, useQuantity, useSelectedOption, useUniqProductID, useVariant, useVariantOutStock, useVariants };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -8106,7 +8106,7 @@ type ControlUI = {
|
|
|
8106
8106
|
labelPosition?: 'start' | 'end';
|
|
8107
8107
|
justifyContent?: 'start' | 'end' | 'between' | 'around';
|
|
8108
8108
|
label?: 'medium' | 'large';
|
|
8109
|
-
info?: 'near' | 'far';
|
|
8109
|
+
info?: 'near' | 'far' | 'bottom';
|
|
8110
8110
|
labelSpacing?: 'small' | 'medium' | 'large';
|
|
8111
8111
|
removeSpacing?: boolean;
|
|
8112
8112
|
noGap?: boolean;
|