@gem-sdk/core 1.47.0-staging.2 → 1.47.0-staging.3

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.
@@ -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
- 'Product Vendor'
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 shopifyEditLink = react.useMemo(()=>{
111
- return productId ? `https://admin.shopify.com/store/${shopName}/products/${productId}` : '';
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
- window.open(shopifyEditLink, '_blank');
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
- editProductElementList.includes(toolbarName() ?? '') && /*#__PURE__*/ jsxRuntime.jsx(Tooltip.default, {
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,
@@ -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
- 'Product Vendor'
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 shopifyEditLink = useMemo(()=>{
107
- return productId ? `https://admin.shopify.com/store/${shopName}/products/${productId}` : '';
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
- window.open(shopifyEditLink, '_blank');
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
- editProductElementList.includes(toolbarName() ?? '') && /*#__PURE__*/ jsx(Tooltip, {
521
+ editAbleElementList.includes(toolbarName() ?? '') && /*#__PURE__*/ jsx(Tooltip, {
486
522
  "data-toolbar-title": true,
487
523
  enable: true,
488
524
  "data-toolbar-disable": false,
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/core",
3
- "version": "1.47.0-staging.2",
3
+ "version": "1.47.0-staging.3",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",