@fonixtree/magic-design 1.0.9 → 1.0.11

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.
Binary file
@@ -208,6 +208,12 @@ function (_super) {
208
208
  style: _this.getBackgroundStyle(item)
209
209
  }, /*#__PURE__*/_react["default"].createElement("div", {
210
210
  className: "carouselItem",
211
+ onClick: function onClick() {
212
+ /** PTO 定制GA */
213
+ if (window.magicDesign.pushGA) {
214
+ window.magicDesign.pushGA({}, 'select_promotion');
215
+ }
216
+ },
211
217
  onMouseEnter: _this.mouseEnterWrap,
212
218
  onMouseLeave: _this.mouseLeaveWrap,
213
219
  style: _this.getItemStyle(item)
@@ -226,7 +226,9 @@ function (_super) {
226
226
  style: {
227
227
  width: salePercent + "%"
228
228
  }
229
- })))));
229
+ }))), !showProgress && data.salesCnt > 0 && /*#__PURE__*/_react["default"].createElement("div", {
230
+ className: "sold-count"
231
+ }, (0, _commonUtil.convertCount)(data.salesCnt), " sold")));
230
232
  };
231
233
 
232
234
  ProductItem.defaultProps = {
@@ -5,6 +5,15 @@
5
5
  border: 1px solid #D2D9E5;
6
6
  width: 142px;
7
7
  cursor: pointer;
8
+ position: relative;
9
+
10
+ .sold-count {
11
+ color: #7b7b7b;
12
+ font-size: 12px;
13
+ position: absolute;
14
+ right: 8px;
15
+ bottom: 8px;
16
+ }
8
17
 
9
18
  .img-wrap {
10
19
  position: relative;
@@ -635,7 +635,14 @@ function (_super) {
635
635
  layout: layout === 'layout2' ? 'horizontal' : 'vertical' // onItemClick={() => clickUrl(`/product/detail/${item.offerId}?productId=${item.sppProductId || item.productId || ''}`)}
636
636
  ,
637
637
  onItemClick: function onItemClick() {
638
- return (0, _coreUtil.clickUrl)("proDetail-" + item.offerId + "-" + (item.sppProductId || item.productId || ''));
638
+ /** PTO 定制GA */
639
+ if (window.magicDesign.pushGA) {
640
+ window.magicDesign.pushGA(item, 'select_item', {
641
+ event_action: 'Select Item'
642
+ });
643
+ }
644
+
645
+ (0, _coreUtil.clickUrl)("proDetail-" + item.offerId + "-" + (item.sppProductId || item.productId || ''));
639
646
  },
640
647
  panelProps: panelProps.content,
641
648
  showProgress: false
@@ -661,7 +668,12 @@ function (_super) {
661
668
  imgWidth: imgWidth // onItemClick={() => clickUrl(`/product/detail/${item.offerId}?productId=${item.sppProductId || item.productId || ''}`)}
662
669
  ,
663
670
  onItemClick: function onItemClick() {
664
- return (0, _coreUtil.clickUrl)("proDetail-" + item.offerId + "-" + (item.sppProductId || item.productId || ''));
671
+ /** PTO 定制GA */
672
+ if (window.magicDesign.pushGA) {
673
+ window.magicDesign.pushGA({}, 'select_item', item);
674
+ }
675
+
676
+ (0, _coreUtil.clickUrl)("proDetail-" + item.offerId + "-" + (item.sppProductId || item.productId || ''));
665
677
  },
666
678
  panelProps: panelProps.content,
667
679
  showProgress: false
@@ -210,10 +210,9 @@ function (_super) {
210
210
 
211
211
  _this.getStoreInfo = function () {
212
212
  return __awaiter(_this, void 0, void 0, function () {
213
- var storeId, _a, res, isFollow;
214
-
215
- return __generator(this, function (_b) {
216
- switch (_b.label) {
213
+ var storeId, storeDetailInfo;
214
+ return __generator(this, function (_a) {
215
+ switch (_a.label) {
217
216
  case 0:
218
217
  storeId = window.magicDesign.storeId;
219
218
  if (!storeId) return [3
@@ -221,17 +220,15 @@ function (_super) {
221
220
  , 2];
222
221
  return [4
223
222
  /*yield*/
224
- , Promise.all([(0, _commonUtil.commonFetch)("/designer/v1/h5/store/detail/" + storeId, {}, 'GET'), (0, _commonUtil.commonFetch)('/designer/v1/h5/collection/store/check', {
225
- storeId: storeId
226
- })])];
223
+ , (0, _commonUtil.commonFetch)("/designer/v1/h5/store/detail/" + storeId, {}, 'GET')];
227
224
 
228
225
  case 1:
229
- _a = _b.sent(), res = _a[0], isFollow = _a[1];
226
+ storeDetailInfo = _a.sent();
230
227
  this.setState({
231
- storeInfo: res,
232
- isFollow: isFollow == 'Y'
228
+ storeInfo: storeDetailInfo,
229
+ isFollow: storeDetailInfo.userHasFollowed == 'Y'
233
230
  });
234
- _b.label = 2;
231
+ _a.label = 2;
235
232
 
236
233
  case 2:
237
234
  return [2
@@ -320,8 +317,8 @@ function (_super) {
320
317
  action: 'operation',
321
318
  params: {
322
319
  type: 'CHAT',
323
- storeId: storeInfo.storeId,
324
- sysAccount: storeInfo.sysAccount
320
+ storeId: storeInfo === null || storeInfo === void 0 ? void 0 : storeInfo.storeId,
321
+ sysAccount: storeInfo === null || storeInfo === void 0 ? void 0 : storeInfo.sysAccount
325
322
  }
326
323
  };
327
324
  window.magicDesign.handleAction(params);
@@ -212,10 +212,9 @@ function (_super) {
212
212
 
213
213
  _this.getStoreInfo = function () {
214
214
  return __awaiter(_this, void 0, void 0, function () {
215
- var storeId, _a, res, isFollow;
216
-
217
- return __generator(this, function (_b) {
218
- switch (_b.label) {
215
+ var storeId, storeDetailInfo;
216
+ return __generator(this, function (_a) {
217
+ switch (_a.label) {
219
218
  case 0:
220
219
  storeId = window.magicDesign.storeId;
221
220
  if (!storeId) return [3
@@ -223,17 +222,15 @@ function (_super) {
223
222
  , 2];
224
223
  return [4
225
224
  /*yield*/
226
- , Promise.all([(0, _commonUtil.commonFetch)("/designer/v1/h5/store/detail/" + storeId, {}, 'GET'), (0, _commonUtil.commonFetch)('/designer/v1/h5/collection/store/check', {
227
- storeId: storeId
228
- })])];
225
+ , (0, _commonUtil.commonFetch)("/designer/v1/h5/store/detail/" + storeId, {}, 'GET')];
229
226
 
230
227
  case 1:
231
- _a = _b.sent(), res = _a[0], isFollow = _a[1];
228
+ storeDetailInfo = _a.sent();
232
229
  this.setState({
233
- storeInfo: res,
234
- isFollow: isFollow == 'Y'
230
+ storeInfo: storeDetailInfo,
231
+ isFollow: storeDetailInfo.userHasFollowed == 'Y'
235
232
  });
236
- _b.label = 2;
233
+ _a.label = 2;
237
234
 
238
235
  case 2:
239
236
  return [2
@@ -81,6 +81,18 @@ function (_super) {
81
81
 
82
82
  _this.state = {};
83
83
 
84
+ _this.hasSource = function (type) {
85
+ if (!window.systemParams || !window.systemParams.recommendSource) {
86
+ return true;
87
+ }
88
+
89
+ if (window.systemParams.recommendSource && window.systemParams.recommendSource.includes(type)) {
90
+ return true;
91
+ }
92
+
93
+ return false;
94
+ };
95
+
84
96
  _this.getContentPanel = function () {
85
97
  var panelProps = _this.props.panelProps;
86
98
 
@@ -95,9 +107,9 @@ function (_super) {
95
107
  _this.selfRender();
96
108
  },
97
109
  value: panelProps.sourceType
98
- }, /*#__PURE__*/_react["default"].createElement(_antd.Select.Option, {
110
+ }, _this.hasSource('P') && /*#__PURE__*/_react["default"].createElement(_antd.Select.Option, {
99
111
  value: "select"
100
- }, (0, _locale.i18n)('SELECT_PRODUCT')), /*#__PURE__*/_react["default"].createElement(_antd.Select.Option, {
112
+ }, (0, _locale.i18n)('SELECT_PRODUCT')), _this.hasSource('A') && /*#__PURE__*/_react["default"].createElement(_antd.Select.Option, {
101
113
  value: "recommend"
102
114
  }, (0, _locale.i18n)('AI_RECOMMENDATION')))), /*#__PURE__*/_react["default"].createElement("div", {
103
115
  className: "greyBg"
@@ -7,7 +7,7 @@ exports.addZero = exports.addUrlQuery = void 0;
7
7
  exports.asyncDataURLtoImage = asyncDataURLtoImage;
8
8
  exports.checkFileName = exports.calcLastTime = exports.asyncNextTick = void 0;
9
9
  exports.commonFetch = commonFetch;
10
- exports.compatibleNewPageData = void 0;
10
+ exports.convertCount = exports.compatibleNewPageData = void 0;
11
11
  exports.convertImageUrl = convertImageUrl;
12
12
  exports.convertToRem = void 0;
13
13
  exports.copy2ClipBoard = copy2ClipBoard;
@@ -884,4 +884,18 @@ var downloadBase64Image = function downloadBase64Image(base64String, filename) {
884
884
  link.click();
885
885
  };
886
886
 
887
- exports.downloadBase64Image = downloadBase64Image;
887
+ exports.downloadBase64Image = downloadBase64Image;
888
+
889
+ var convertCount = function convertCount(value) {
890
+ var newValue = value;
891
+
892
+ if (value >= 1000000) {
893
+ newValue = Number(value / 1000000).toFixed(1) + "M";
894
+ } else if (value >= 1000) {
895
+ newValue = Number(value / 1000).toFixed(1) + "K";
896
+ }
897
+
898
+ return newValue;
899
+ };
900
+
901
+ exports.convertCount = convertCount;
Binary file
@@ -208,6 +208,12 @@ function (_super) {
208
208
  style: _this.getBackgroundStyle(item)
209
209
  }, /*#__PURE__*/_react["default"].createElement("div", {
210
210
  className: "carouselItem",
211
+ onClick: function onClick() {
212
+ /** PTO 定制GA */
213
+ if (window.magicDesign.pushGA) {
214
+ window.magicDesign.pushGA({}, 'select_promotion');
215
+ }
216
+ },
211
217
  onMouseEnter: _this.mouseEnterWrap,
212
218
  onMouseLeave: _this.mouseLeaveWrap,
213
219
  style: _this.getItemStyle(item)
@@ -226,7 +226,9 @@ function (_super) {
226
226
  style: {
227
227
  width: salePercent + "%"
228
228
  }
229
- })))));
229
+ }))), !showProgress && data.salesCnt > 0 && /*#__PURE__*/_react["default"].createElement("div", {
230
+ className: "sold-count"
231
+ }, (0, _commonUtil.convertCount)(data.salesCnt), " sold")));
230
232
  };
231
233
 
232
234
  ProductItem.defaultProps = {
@@ -5,6 +5,15 @@
5
5
  border: 1px solid #D2D9E5;
6
6
  width: 142px;
7
7
  cursor: pointer;
8
+ position: relative;
9
+
10
+ .sold-count {
11
+ color: #7b7b7b;
12
+ font-size: 12px;
13
+ position: absolute;
14
+ right: 8px;
15
+ bottom: 8px;
16
+ }
8
17
 
9
18
  .img-wrap {
10
19
  position: relative;
@@ -635,7 +635,14 @@ function (_super) {
635
635
  layout: layout === 'layout2' ? 'horizontal' : 'vertical' // onItemClick={() => clickUrl(`/product/detail/${item.offerId}?productId=${item.sppProductId || item.productId || ''}`)}
636
636
  ,
637
637
  onItemClick: function onItemClick() {
638
- return (0, _coreUtil.clickUrl)("proDetail-" + item.offerId + "-" + (item.sppProductId || item.productId || ''));
638
+ /** PTO 定制GA */
639
+ if (window.magicDesign.pushGA) {
640
+ window.magicDesign.pushGA(item, 'select_item', {
641
+ event_action: 'Select Item'
642
+ });
643
+ }
644
+
645
+ (0, _coreUtil.clickUrl)("proDetail-" + item.offerId + "-" + (item.sppProductId || item.productId || ''));
639
646
  },
640
647
  panelProps: panelProps.content,
641
648
  showProgress: false
@@ -661,7 +668,12 @@ function (_super) {
661
668
  imgWidth: imgWidth // onItemClick={() => clickUrl(`/product/detail/${item.offerId}?productId=${item.sppProductId || item.productId || ''}`)}
662
669
  ,
663
670
  onItemClick: function onItemClick() {
664
- return (0, _coreUtil.clickUrl)("proDetail-" + item.offerId + "-" + (item.sppProductId || item.productId || ''));
671
+ /** PTO 定制GA */
672
+ if (window.magicDesign.pushGA) {
673
+ window.magicDesign.pushGA({}, 'select_item', item);
674
+ }
675
+
676
+ (0, _coreUtil.clickUrl)("proDetail-" + item.offerId + "-" + (item.sppProductId || item.productId || ''));
665
677
  },
666
678
  panelProps: panelProps.content,
667
679
  showProgress: false
@@ -210,10 +210,9 @@ function (_super) {
210
210
 
211
211
  _this.getStoreInfo = function () {
212
212
  return __awaiter(_this, void 0, void 0, function () {
213
- var storeId, _a, res, isFollow;
214
-
215
- return __generator(this, function (_b) {
216
- switch (_b.label) {
213
+ var storeId, storeDetailInfo;
214
+ return __generator(this, function (_a) {
215
+ switch (_a.label) {
217
216
  case 0:
218
217
  storeId = window.magicDesign.storeId;
219
218
  if (!storeId) return [3
@@ -221,17 +220,15 @@ function (_super) {
221
220
  , 2];
222
221
  return [4
223
222
  /*yield*/
224
- , Promise.all([(0, _commonUtil.commonFetch)("/designer/v1/h5/store/detail/" + storeId, {}, 'GET'), (0, _commonUtil.commonFetch)('/designer/v1/h5/collection/store/check', {
225
- storeId: storeId
226
- })])];
223
+ , (0, _commonUtil.commonFetch)("/designer/v1/h5/store/detail/" + storeId, {}, 'GET')];
227
224
 
228
225
  case 1:
229
- _a = _b.sent(), res = _a[0], isFollow = _a[1];
226
+ storeDetailInfo = _a.sent();
230
227
  this.setState({
231
- storeInfo: res,
232
- isFollow: isFollow == 'Y'
228
+ storeInfo: storeDetailInfo,
229
+ isFollow: storeDetailInfo.userHasFollowed == 'Y'
233
230
  });
234
- _b.label = 2;
231
+ _a.label = 2;
235
232
 
236
233
  case 2:
237
234
  return [2
@@ -320,8 +317,8 @@ function (_super) {
320
317
  action: 'operation',
321
318
  params: {
322
319
  type: 'CHAT',
323
- storeId: storeInfo.storeId,
324
- sysAccount: storeInfo.sysAccount
320
+ storeId: storeInfo === null || storeInfo === void 0 ? void 0 : storeInfo.storeId,
321
+ sysAccount: storeInfo === null || storeInfo === void 0 ? void 0 : storeInfo.sysAccount
325
322
  }
326
323
  };
327
324
  window.magicDesign.handleAction(params);
@@ -212,10 +212,9 @@ function (_super) {
212
212
 
213
213
  _this.getStoreInfo = function () {
214
214
  return __awaiter(_this, void 0, void 0, function () {
215
- var storeId, _a, res, isFollow;
216
-
217
- return __generator(this, function (_b) {
218
- switch (_b.label) {
215
+ var storeId, storeDetailInfo;
216
+ return __generator(this, function (_a) {
217
+ switch (_a.label) {
219
218
  case 0:
220
219
  storeId = window.magicDesign.storeId;
221
220
  if (!storeId) return [3
@@ -223,17 +222,15 @@ function (_super) {
223
222
  , 2];
224
223
  return [4
225
224
  /*yield*/
226
- , Promise.all([(0, _commonUtil.commonFetch)("/designer/v1/h5/store/detail/" + storeId, {}, 'GET'), (0, _commonUtil.commonFetch)('/designer/v1/h5/collection/store/check', {
227
- storeId: storeId
228
- })])];
225
+ , (0, _commonUtil.commonFetch)("/designer/v1/h5/store/detail/" + storeId, {}, 'GET')];
229
226
 
230
227
  case 1:
231
- _a = _b.sent(), res = _a[0], isFollow = _a[1];
228
+ storeDetailInfo = _a.sent();
232
229
  this.setState({
233
- storeInfo: res,
234
- isFollow: isFollow == 'Y'
230
+ storeInfo: storeDetailInfo,
231
+ isFollow: storeDetailInfo.userHasFollowed == 'Y'
235
232
  });
236
- _b.label = 2;
233
+ _a.label = 2;
237
234
 
238
235
  case 2:
239
236
  return [2
@@ -81,6 +81,18 @@ function (_super) {
81
81
 
82
82
  _this.state = {};
83
83
 
84
+ _this.hasSource = function (type) {
85
+ if (!window.systemParams || !window.systemParams.recommendSource) {
86
+ return true;
87
+ }
88
+
89
+ if (window.systemParams.recommendSource && window.systemParams.recommendSource.includes(type)) {
90
+ return true;
91
+ }
92
+
93
+ return false;
94
+ };
95
+
84
96
  _this.getContentPanel = function () {
85
97
  var panelProps = _this.props.panelProps;
86
98
 
@@ -95,9 +107,9 @@ function (_super) {
95
107
  _this.selfRender();
96
108
  },
97
109
  value: panelProps.sourceType
98
- }, /*#__PURE__*/_react["default"].createElement(_antd.Select.Option, {
110
+ }, _this.hasSource('P') && /*#__PURE__*/_react["default"].createElement(_antd.Select.Option, {
99
111
  value: "select"
100
- }, (0, _locale.i18n)('SELECT_PRODUCT')), /*#__PURE__*/_react["default"].createElement(_antd.Select.Option, {
112
+ }, (0, _locale.i18n)('SELECT_PRODUCT')), _this.hasSource('A') && /*#__PURE__*/_react["default"].createElement(_antd.Select.Option, {
101
113
  value: "recommend"
102
114
  }, (0, _locale.i18n)('AI_RECOMMENDATION')))), /*#__PURE__*/_react["default"].createElement("div", {
103
115
  className: "greyBg"
@@ -7,7 +7,7 @@ exports.addZero = exports.addUrlQuery = void 0;
7
7
  exports.asyncDataURLtoImage = asyncDataURLtoImage;
8
8
  exports.checkFileName = exports.calcLastTime = exports.asyncNextTick = void 0;
9
9
  exports.commonFetch = commonFetch;
10
- exports.compatibleNewPageData = void 0;
10
+ exports.convertCount = exports.compatibleNewPageData = void 0;
11
11
  exports.convertImageUrl = convertImageUrl;
12
12
  exports.convertToRem = void 0;
13
13
  exports.copy2ClipBoard = copy2ClipBoard;
@@ -884,4 +884,18 @@ var downloadBase64Image = function downloadBase64Image(base64String, filename) {
884
884
  link.click();
885
885
  };
886
886
 
887
- exports.downloadBase64Image = downloadBase64Image;
887
+ exports.downloadBase64Image = downloadBase64Image;
888
+
889
+ var convertCount = function convertCount(value) {
890
+ var newValue = value;
891
+
892
+ if (value >= 1000000) {
893
+ newValue = Number(value / 1000000).toFixed(1) + "M";
894
+ } else if (value >= 1000) {
895
+ newValue = Number(value / 1000).toFixed(1) + "K";
896
+ }
897
+
898
+ return newValue;
899
+ };
900
+
901
+ exports.convertCount = convertCount;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fonixtree/magic-design",
3
3
  "author": "Cylon Team",
4
- "version": "1.0.9",
4
+ "version": "1.0.11",
5
5
  "description": "Magic Design",
6
6
  "license": "MIT",
7
7
  "module": "es/index.js",