@gem-sdk/core 1.46.0-staging.28 → 1.46.0-staging.29

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,19 @@ 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
+ ];
73
+ const editAbleElementList = [
74
+ ...editProductElementList,
75
+ ...editArticleElementList
64
76
  ];
65
77
  const isOverToolbarPosition = (el, parent)=>{
66
78
  const parentLength = parents.length;
@@ -107,15 +119,29 @@ const ComponentToolbarPreview = (props)=>{
107
119
  }, [
108
120
  storefrontUrl
109
121
  ]);
110
- const shopifyEditLink = react.useMemo(()=>{
111
- return productId ? `https://admin.shopify.com/store/${shopName}/products/${productId}` : '';
122
+ const linkShopDefault = react.useMemo(()=>{
123
+ return `https://admin.shopify.com/store/${shopName}`;
112
124
  }, [
113
- productId,
114
125
  shopName
115
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
+ ]);
116
139
  // Get parents
117
140
  const onActiveComponent = react.useCallback((e)=>{
118
141
  const detail = e.detail;
142
+ if (detail?.articleId) {
143
+ setArticleUid(detail.articleId);
144
+ }
119
145
  if (detail?.componentUid == props.uid) {
120
146
  getDeleteTooltipPosition();
121
147
  if (isSaleFunnelPage) {
@@ -207,7 +233,15 @@ const ComponentToolbarPreview = (props)=>{
207
233
  window.dispatchEvent(event);
208
234
  };
209
235
  const goToShopifyEditLink = ()=>{
210
- 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');
211
245
  };
212
246
  const onDelete = (e)=>{
213
247
  e.preventDefault();
@@ -486,7 +520,7 @@ const ComponentToolbarPreview = (props)=>{
486
520
  })
487
521
  })
488
522
  }),
489
- editProductElementList.includes(toolbarName() ?? '') && /*#__PURE__*/ jsxRuntime.jsx(Tooltip.default, {
523
+ editAbleElementList.includes(toolbarName() ?? '') && /*#__PURE__*/ jsxRuntime.jsx(Tooltip.default, {
490
524
  "data-toolbar-title": true,
491
525
  enable: true,
492
526
  "data-toolbar-disable": false,
@@ -45,7 +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
- bundleItems: passProps?.bundleItems,
48
+ bundleItem: passProps?.bundleItem,
49
49
  uid: id
50
50
  }, id))
51
51
  }) : /*#__PURE__*/ jsxRuntime.jsx(Component, {
@@ -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,19 @@ 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
+ ];
69
+ const editAbleElementList = [
70
+ ...editProductElementList,
71
+ ...editArticleElementList
60
72
  ];
61
73
  const isOverToolbarPosition = (el, parent)=>{
62
74
  const parentLength = parents.length;
@@ -103,15 +115,29 @@ const ComponentToolbarPreview = (props)=>{
103
115
  }, [
104
116
  storefrontUrl
105
117
  ]);
106
- const shopifyEditLink = useMemo(()=>{
107
- return productId ? `https://admin.shopify.com/store/${shopName}/products/${productId}` : '';
118
+ const linkShopDefault = useMemo(()=>{
119
+ return `https://admin.shopify.com/store/${shopName}`;
108
120
  }, [
109
- productId,
110
121
  shopName
111
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
+ ]);
112
135
  // Get parents
113
136
  const onActiveComponent = useCallback((e)=>{
114
137
  const detail = e.detail;
138
+ if (detail?.articleId) {
139
+ setArticleUid(detail.articleId);
140
+ }
115
141
  if (detail?.componentUid == props.uid) {
116
142
  getDeleteTooltipPosition();
117
143
  if (isSaleFunnelPage) {
@@ -203,7 +229,15 @@ const ComponentToolbarPreview = (props)=>{
203
229
  window.dispatchEvent(event);
204
230
  };
205
231
  const goToShopifyEditLink = ()=>{
206
- 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');
207
241
  };
208
242
  const onDelete = (e)=>{
209
243
  e.preventDefault();
@@ -482,7 +516,7 @@ const ComponentToolbarPreview = (props)=>{
482
516
  })
483
517
  })
484
518
  }),
485
- editProductElementList.includes(toolbarName() ?? '') && /*#__PURE__*/ jsx(Tooltip, {
519
+ editAbleElementList.includes(toolbarName() ?? '') && /*#__PURE__*/ jsx(Tooltip, {
486
520
  "data-toolbar-title": true,
487
521
  enable: true,
488
522
  "data-toolbar-disable": false,
@@ -41,7 +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
- bundleItems: passProps?.bundleItems,
44
+ bundleItem: passProps?.bundleItem,
45
45
  uid: id
46
46
  }, id))
47
47
  }) : /*#__PURE__*/ jsx(Component, {
@@ -8025,10 +8025,6 @@ type ShapeSelectorControlType<T> = SharedControlType<T> & {
8025
8025
  type: 'shape-selector';
8026
8026
  };
8027
8027
 
8028
- type DisplayTriggerControlType<T> = SharedControlType<T> & {
8029
- type: 'display-trigger-badge';
8030
- };
8031
-
8032
8028
  type CustomPositionControlType<T> = SharedControlType<T> & {
8033
8029
  type: 'custom-position';
8034
8030
  ignoreValue?: string[];
@@ -8038,7 +8034,22 @@ type CustomPositionControlType<T> = SharedControlType<T> & {
8038
8034
  bottomGap?: string;
8039
8035
  };
8040
8036
 
8041
- type ControlProp<T> = AngleControlType<T> | CheckboxControlType<T> | ColorPickerControlType<T> | GroupControlType<T> | IconControlType<T> | InputFixContentControlType<T> | InputNumberControlType<T> | InputUnitControlType<T> | InputUnitSpacingControlType<T> | InputUnitWidthControlType<T> | InputControlType<T> | MarginControlType<T> | PaddingControlType<T> | PositionControlType<T> | RadioGroupControlType | RangeControlType<T> | SegmentControlType<T> | OpenLinkControlType<T> | SelectControlType<T> | TextareaControlType<T> | ToggleControlType<T> | ImageControlType<T> | ChildrensControlType | GridControlType<T> | FlexControlType<T> | TextEditorControlType<T> | ProductControlType<T> | TypographyControlType<T> | TypographyV2ControlType<T> | MenuControlType<T> | BehaviorStateControlType<T> | PickLinkControlType<T> | BoxShadowControlType<T> | TextShadowControlType<T> | BorderControlType<T> | BorderRadiusControlType<T> | RadiusPresetControlType<T> | SizeControlType<T> | ChildItemType<T> | PickMultiProductControlType<T> | CollectionControlType<T> | BackgroundControlType<T> | VisibilityControlType<T> | SelectVariantControlType | CountdownEvergreenType | Timezone<T> | CustomContentControlType<T> | DateTimePickerControlType | CountdownDailyType | KlaviyoCodes | YotpoLoyaltyCodes | InputWidthControlType<T> | LayoutSegmentControlType<T> | InputSpacing<T> | UniqueIdControlType<T> | PositionSquareControlType<T> | CustomCodeEditor | LayoutControlType<T> | LayoutBannerControlType<T> | SwatchesLinkControlType<T> | VariantSwatchesPresetControlType<T> | VariantSwatchesOnlyDefaultVariantControlType<T> | ProductListControlType<T> | ArticleListControlType<T> | CollectionBannerControlType<T> | Ratio<T> | StickyDisplayControlType<T> | SyncProductPropertiesControlType<T> | StepsGuide<T> | ImageShape<T> | GridArrange<T> | SizeSetting$1<T> | ChildIconType<T> | DropdownInput<T> | Dropdown<T> | AliPickSectionControlType<T> | ParallaxScrollingType<T> | BackgroundColorPickerType<T> | PlayPauseControlType<T> | LayoutCustomSegmentControlType<T> | SneakPeakRange<T> | SneakPeakTypeControlType<T> | SneakPeakControlType<T> | ProductInputCurrencyUnitControlType<T> | TypographyPostPurchaseControlType<T> | ProductOffersControlType<T> | DiscountAndShippingFee<T> | PostPurchaseTextareaControlType<T> | NotesControlType<T> | ButtonLayoutType<T> | ShapeSelectorControlType<T> | ShapeSelectorControlType<T> | DisplayTriggerControlType<T> | CustomPositionControlType<T>;
8037
+ type DealControlType<T> = SharedControlType<T> & {
8038
+ type: 'bundleItem';
8039
+ readonly?: boolean;
8040
+ };
8041
+
8042
+ type ProductBundleChildControlType<T> = SharedControlType<T> & {
8043
+ type: 'product-bundle-child-item';
8044
+ [key: string]: any;
8045
+ };
8046
+ type SelectProductBundleControlType<T> = SharedControlType<T> & {
8047
+ type: 'select-product-bundle';
8048
+ label?: string;
8049
+ hide?: boolean;
8050
+ };
8051
+
8052
+ type ControlProp<T> = ProductBundleChildControlType<T> | SelectProductBundleControlType<T> | AngleControlType<T> | CheckboxControlType<T> | ColorPickerControlType<T> | GroupControlType<T> | IconControlType<T> | InputFixContentControlType<T> | InputNumberControlType<T> | InputUnitControlType<T> | InputUnitSpacingControlType<T> | InputUnitWidthControlType<T> | InputControlType<T> | MarginControlType<T> | PaddingControlType<T> | PositionControlType<T> | RadioGroupControlType | RangeControlType<T> | SegmentControlType<T> | OpenLinkControlType<T> | SelectControlType<T> | TextareaControlType<T> | ToggleControlType<T> | ImageControlType<T> | ChildrensControlType | GridControlType<T> | FlexControlType<T> | TextEditorControlType<T> | ProductControlType<T> | TypographyControlType<T> | TypographyV2ControlType<T> | MenuControlType<T> | BehaviorStateControlType<T> | PickLinkControlType<T> | BoxShadowControlType<T> | TextShadowControlType<T> | BorderControlType<T> | BorderRadiusControlType<T> | RadiusPresetControlType<T> | SizeControlType<T> | ChildItemType<T> | PickMultiProductControlType<T> | CollectionControlType<T> | BackgroundControlType<T> | VisibilityControlType<T> | SelectVariantControlType | CountdownEvergreenType | Timezone<T> | CustomContentControlType<T> | DateTimePickerControlType | CountdownDailyType | KlaviyoCodes | YotpoLoyaltyCodes | InputWidthControlType<T> | LayoutSegmentControlType<T> | InputSpacing<T> | UniqueIdControlType<T> | PositionSquareControlType<T> | CustomCodeEditor | LayoutControlType<T> | LayoutBannerControlType<T> | SwatchesLinkControlType<T> | VariantSwatchesPresetControlType<T> | VariantSwatchesOnlyDefaultVariantControlType<T> | ProductListControlType<T> | ArticleListControlType<T> | CollectionBannerControlType<T> | Ratio<T> | StickyDisplayControlType<T> | SyncProductPropertiesControlType<T> | StepsGuide<T> | ImageShape<T> | GridArrange<T> | SizeSetting$1<T> | ChildIconType<T> | DropdownInput<T> | Dropdown<T> | AliPickSectionControlType<T> | ParallaxScrollingType<T> | BackgroundColorPickerType<T> | PlayPauseControlType<T> | LayoutCustomSegmentControlType<T> | SneakPeakRange<T> | SneakPeakTypeControlType<T> | SneakPeakControlType<T> | ProductInputCurrencyUnitControlType<T> | TypographyPostPurchaseControlType<T> | ProductOffersControlType<T> | DiscountAndShippingFee<T> | PostPurchaseTextareaControlType<T> | NotesControlType<T> | ButtonLayoutType<T> | ShapeSelectorControlType<T> | CustomPositionControlType<T> | SneakPeakControlType<T> | PostPurchaseTextareaControlType<T> | DealControlType<T>;
8042
8053
  type ControlTriggerAction = {
8043
8054
  controlId: string;
8044
8055
  newValue?: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/core",
3
- "version": "1.46.0-staging.28",
3
+ "version": "1.46.0-staging.29",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",