@gem-sdk/core 1.44.0-dev.55 → 1.44.0-dev.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.
@@ -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: ''
@@ -61,6 +62,18 @@ const ComponentToolbarPreview = (props)=>{
61
62
  'Product Description',
62
63
  'Product Price'
63
64
  ];
65
+ const editArticleElementList = [
66
+ 'Article Title',
67
+ 'Article Content',
68
+ 'Article Image',
69
+ 'Article Author',
70
+ 'Article Category',
71
+ 'Article Date'
72
+ ];
73
+ const editAbleElementList = [
74
+ ...editProductElementList,
75
+ ...editArticleElementList
76
+ ];
64
77
  const isOverToolbarPosition = (el, parent)=>{
65
78
  const parentLength = parents.length;
66
79
  const rect = el.getBoundingClientRect();
@@ -106,15 +119,29 @@ const ComponentToolbarPreview = (props)=>{
106
119
  }, [
107
120
  storefrontUrl
108
121
  ]);
109
- const shopifyEditLink = react.useMemo(()=>{
110
- return productId ? `https://admin.shopify.com/store/${shopName}/products/${productId}` : '';
122
+ const linkShopDefault = react.useMemo(()=>{
123
+ return `https://admin.shopify.com/store/${shopName}`;
111
124
  }, [
112
- productId,
113
125
  shopName
114
126
  ]);
127
+ const linkEditProduct = react.useMemo(()=>{
128
+ return productId ? `${linkShopDefault}/products/${productId}` : '';
129
+ }, [
130
+ linkShopDefault,
131
+ productId
132
+ ]);
133
+ const linkEditArticle = react.useMemo(()=>{
134
+ return articleUid ? `${linkShopDefault}/articles/${articleUid}` : '';
135
+ }, [
136
+ articleUid,
137
+ linkShopDefault
138
+ ]);
115
139
  // Get parents
116
140
  const onActiveComponent = react.useCallback((e)=>{
117
141
  const detail = e.detail;
142
+ if (detail?.articleId) {
143
+ setArticleUid(detail.articleId);
144
+ }
118
145
  if (detail?.componentUid == props.uid) {
119
146
  getDeleteTooltipPosition();
120
147
  if (isSaleFunnelPage) {
@@ -206,7 +233,15 @@ const ComponentToolbarPreview = (props)=>{
206
233
  window.dispatchEvent(event);
207
234
  };
208
235
  const goToShopifyEditLink = ()=>{
209
- window.open(shopifyEditLink, '_blank');
236
+ if (editArticleElementList.includes(toolbarName() ?? '')) {
237
+ window.open(linkEditArticle, '_blank');
238
+ return;
239
+ }
240
+ if (editProductElementList.includes(toolbarName() ?? '')) {
241
+ window.open(linkEditProduct, '_blank');
242
+ return;
243
+ }
244
+ window.open(linkShopDefault, '_blank');
210
245
  };
211
246
  const onDelete = (e)=>{
212
247
  e.preventDefault();
@@ -480,7 +515,7 @@ const ComponentToolbarPreview = (props)=>{
480
515
  })
481
516
  })
482
517
  }),
483
- editProductElementList.includes(toolbarName() ?? '') && /*#__PURE__*/ jsxRuntime.jsx(Tooltip.default, {
518
+ editAbleElementList.includes(toolbarName() ?? '') && /*#__PURE__*/ jsxRuntime.jsx(Tooltip.default, {
484
519
  "data-toolbar-title": true,
485
520
  enable: true,
486
521
  "data-toolbar-disable": false,
@@ -37,10 +37,10 @@ const disableWrap = [
37
37
  'PostPurchaseProductImages',
38
38
  'Sticky',
39
39
  'Heading',
40
+ 'EstimateDate',
40
41
  'ProductBadge',
41
42
  'Marquee',
42
- 'MarqueeItem',
43
- 'EstimateDate'
43
+ 'MarqueeItem'
44
44
  ];
45
45
  const customRenderChildren = [
46
46
  'Accordion',
@@ -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: ''
@@ -57,6 +58,18 @@ const ComponentToolbarPreview = (props)=>{
57
58
  'Product Description',
58
59
  'Product Price'
59
60
  ];
61
+ const editArticleElementList = [
62
+ 'Article Title',
63
+ 'Article Content',
64
+ 'Article Image',
65
+ 'Article Author',
66
+ 'Article Category',
67
+ 'Article Date'
68
+ ];
69
+ const editAbleElementList = [
70
+ ...editProductElementList,
71
+ ...editArticleElementList
72
+ ];
60
73
  const isOverToolbarPosition = (el, parent)=>{
61
74
  const parentLength = parents.length;
62
75
  const rect = el.getBoundingClientRect();
@@ -102,15 +115,29 @@ const ComponentToolbarPreview = (props)=>{
102
115
  }, [
103
116
  storefrontUrl
104
117
  ]);
105
- const shopifyEditLink = useMemo(()=>{
106
- return productId ? `https://admin.shopify.com/store/${shopName}/products/${productId}` : '';
118
+ const linkShopDefault = useMemo(()=>{
119
+ return `https://admin.shopify.com/store/${shopName}`;
107
120
  }, [
108
- productId,
109
121
  shopName
110
122
  ]);
123
+ const linkEditProduct = useMemo(()=>{
124
+ return productId ? `${linkShopDefault}/products/${productId}` : '';
125
+ }, [
126
+ linkShopDefault,
127
+ productId
128
+ ]);
129
+ const linkEditArticle = useMemo(()=>{
130
+ return articleUid ? `${linkShopDefault}/articles/${articleUid}` : '';
131
+ }, [
132
+ articleUid,
133
+ linkShopDefault
134
+ ]);
111
135
  // Get parents
112
136
  const onActiveComponent = useCallback((e)=>{
113
137
  const detail = e.detail;
138
+ if (detail?.articleId) {
139
+ setArticleUid(detail.articleId);
140
+ }
114
141
  if (detail?.componentUid == props.uid) {
115
142
  getDeleteTooltipPosition();
116
143
  if (isSaleFunnelPage) {
@@ -202,7 +229,15 @@ const ComponentToolbarPreview = (props)=>{
202
229
  window.dispatchEvent(event);
203
230
  };
204
231
  const goToShopifyEditLink = ()=>{
205
- window.open(shopifyEditLink, '_blank');
232
+ if (editArticleElementList.includes(toolbarName() ?? '')) {
233
+ window.open(linkEditArticle, '_blank');
234
+ return;
235
+ }
236
+ if (editProductElementList.includes(toolbarName() ?? '')) {
237
+ window.open(linkEditProduct, '_blank');
238
+ return;
239
+ }
240
+ window.open(linkShopDefault, '_blank');
206
241
  };
207
242
  const onDelete = (e)=>{
208
243
  e.preventDefault();
@@ -476,7 +511,7 @@ const ComponentToolbarPreview = (props)=>{
476
511
  })
477
512
  })
478
513
  }),
479
- editProductElementList.includes(toolbarName() ?? '') && /*#__PURE__*/ jsx(Tooltip, {
514
+ editAbleElementList.includes(toolbarName() ?? '') && /*#__PURE__*/ jsx(Tooltip, {
480
515
  "data-toolbar-title": true,
481
516
  enable: true,
482
517
  "data-toolbar-disable": false,
@@ -35,10 +35,10 @@ const disableWrap = [
35
35
  'PostPurchaseProductImages',
36
36
  'Sticky',
37
37
  'Heading',
38
+ 'EstimateDate',
38
39
  'ProductBadge',
39
40
  'Marquee',
40
- 'MarqueeItem',
41
- 'EstimateDate'
41
+ 'MarqueeItem'
42
42
  ];
43
43
  const customRenderChildren = [
44
44
  'Accordion',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/core",
3
- "version": "1.44.0-dev.55",
3
+ "version": "1.44.0-dev.56",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -27,8 +27,8 @@
27
27
  "type-check": "yarn tsc --noEmit"
28
28
  },
29
29
  "devDependencies": {
30
- "@gem-sdk/adapter-shopify": "1.44.0-dev.55",
31
- "@gem-sdk/styles": "1.44.0-dev.55",
30
+ "@gem-sdk/adapter-shopify": "1.44.0-dev.56",
31
+ "@gem-sdk/styles": "1.44.0-dev.56",
32
32
  "@types/classnames": "^2.3.1"
33
33
  },
34
34
  "dependencies": {