@fonixtree/magic-design 2.0.39 → 2.0.41

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.
@@ -7,8 +7,6 @@ exports["default"] = void 0;
7
7
 
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
 
10
- var _pc = _interopRequireDefault(require("./pc"));
11
-
12
10
  var _mobile = _interopRequireDefault(require("./mobile"));
13
11
 
14
12
  var _defaultJSON = require("./defaultJSON");
@@ -59,30 +57,28 @@ var __decorate = void 0 && (void 0).__decorate || function (decorators, target,
59
57
  return c > 3 && r && Object.defineProperty(target, key, r), r;
60
58
  };
61
59
 
62
- var ImageGallery =
60
+ var Wallet =
63
61
  /** @class */
64
62
  function (_super) {
65
- __extends(ImageGallery, _super);
63
+ __extends(Wallet, _super);
66
64
 
67
- function ImageGallery() {
65
+ function Wallet() {
68
66
  return _super !== null && _super.apply(this, arguments) || this;
69
67
  }
70
68
 
71
- ImageGallery.prototype.render = function () {
69
+ Wallet.prototype.render = function () {
72
70
  var nodeData = this.props.nodeData;
73
- return /*#__PURE__*/_react["default"].createElement("div", null, window.magicDesign.device === 'pc' ? /*#__PURE__*/_react["default"].createElement(_pc["default"], {
74
- data: nodeData
75
- }) : /*#__PURE__*/_react["default"].createElement(_mobile["default"], {
71
+ return /*#__PURE__*/_react["default"].createElement("div", null, window.magicDesign.device === 'pc' ? null : /*#__PURE__*/_react["default"].createElement(_mobile["default"], {
76
72
  data: nodeData
77
73
  }));
78
74
  };
79
75
 
80
- ImageGallery.defaultProps = {};
81
- ImageGallery.type = 'WALLET';
82
- ImageGallery.getDefaultJSON = _defaultJSON.getDefaultJSON;
83
- ImageGallery = __decorate([_compositeDecorator["default"]], ImageGallery);
84
- return ImageGallery;
76
+ Wallet.defaultProps = {};
77
+ Wallet.type = 'WALLET';
78
+ Wallet.getDefaultJSON = _defaultJSON.getDefaultJSON;
79
+ Wallet = __decorate([_compositeDecorator["default"]], Wallet);
80
+ return Wallet;
85
81
  }(_react.Component);
86
82
 
87
- var _default = ImageGallery;
83
+ var _default = Wallet;
88
84
  exports["default"] = _default;
@@ -240,93 +240,112 @@ function (_super) {
240
240
  var _this = _super !== null && _super.apply(this, arguments) || this;
241
241
 
242
242
  _this.state = {
243
- sliderIndex: 0
243
+ sliderIndex: 0,
244
+ userWalletData: {}
244
245
  };
245
246
  _this.sliderRef = null;
246
247
  _this.destroy = null;
247
- _this.userWalletData = {};
248
248
 
249
249
  _this.getMyWalletData = function () {
250
250
  return __awaiter(_this, void 0, void 0, function () {
251
- var _a, userCreditResps, userCashbackValues, userBalance, userPoint, defaultShowWallet, defaultShowIndex, bnplObj, creditObj, B2BObj;
251
+ var data, _a, userCreditResps, userCashbackValues, userBalance, userPoint, defaultShowWallet, defaultShowIndex_1, bnplObj, creditObj, B2BObj;
252
252
 
253
253
  var _b;
254
254
 
255
255
  return __generator(this, function (_c) {
256
- _a = {
257
- userCreditResps: [{
258
- userCreditId: 1023,
259
- creditId: 1,
260
- partyType: null,
261
- state: 'Pass',
262
- isUrlExpired: false,
263
- creditLimit: 150000,
264
- usageAmount: 100000,
265
- availableAmount: 1000,
266
- comments: null,
267
- userNearestBillDto: null
268
- }, {
269
- userCreditId: 1026,
270
- creditId: 2,
271
- partyType: null,
272
- state: 'Locked',
273
- isUrlExpired: false,
274
- creditLimit: 100000,
275
- usageAmount: 100000,
276
- availableAmount: 2000,
277
- comments: null,
278
- userNearestBillDto: null
279
- }, {
280
- userCreditId: 1027,
281
- creditId: 3,
282
- partyType: 'I',
283
- state: 'Pass',
284
- isUrlExpired: false,
285
- creditLimit: 100000000,
286
- usageAmount: 0,
287
- availableAmount: 3000,
288
- comments: 'ty',
289
- userNearestBillDto: null
290
- }],
291
- userCashbackValues: 4000,
292
- userBalance: 5000,
293
- userPoint: 6000,
294
- defaultShowWallet: 'Balance'
295
- }, userCreditResps = _a.userCreditResps, userCashbackValues = _a.userCashbackValues, userBalance = _a.userBalance, userPoint = _a.userPoint, defaultShowWallet = _a.defaultShowWallet;
296
- defaultShowIndex = 0;
297
- this.props.data.groupSource.forEach(function (f, i) {
298
- if (f.sourceType === defaultShowWallet) defaultShowIndex = i;
299
- });
300
- this.sliderRef.slickGoTo(defaultShowIndex);
301
- bnplObj = userCreditResps === null || userCreditResps === void 0 ? void 0 : userCreditResps.find(function (item) {
302
- return item.creditId === 1 && [_constants.CREDIT_STATE.APPROVED.KEY, _constants.CREDIT_STATE.LOCKED.KEY].includes(item.state);
303
- });
304
- creditObj = userCreditResps === null || userCreditResps === void 0 ? void 0 : userCreditResps.find(function (item) {
305
- return item.creditId === 2 && [_constants.CREDIT_STATE.APPROVED.KEY, _constants.CREDIT_STATE.LOCKED.KEY].includes(item.state);
306
- });
307
- B2BObj = userCreditResps === null || userCreditResps === void 0 ? void 0 : userCreditResps.find(function (item) {
308
- return item.creditId === 3 && [_constants.CREDIT_STATE.APPROVED.KEY, _constants.CREDIT_STATE.LOCKED.KEY].includes(item.state);
309
- });
310
- this.userWalletData = (_b = {}, _b[_constants.walletType.BNPL] = {
311
- amount: userCreditResps === null ? '****' : bnplObj ? (0, _currencyUtil.formatCurrencyWithSymbol)(bnplObj.availableAmount) : 'APPLY'
312
- }, _b[_constants.walletType.CREDIT] = {
313
- amount: userCreditResps === null ? '****' : creditObj ? (0, _currencyUtil.formatCurrencyWithSymbol)(creditObj.availableAmount) : 'APPLY'
314
- }, _b[_constants.walletType.B2B] = {
315
- amount: userCreditResps === null ? '****' : B2BObj ? (0, _currencyUtil.formatCurrencyWithSymbol)(B2BObj.availableAmount) : 'APPLY',
316
- text: B2BObj ? 'Add ore products to your shop!' : '',
317
- btnText: 'Procure Product'
318
- }, _b[_constants.walletType.CASHBACK] = {
319
- amount: userCashbackValues === null ? '****' : (0, _currencyUtil.formatCurrencyWithSymbol)(userCashbackValues)
320
- }, _b[_constants.walletType.BALANCE] = {
321
- amount: userBalance === null ? '****' : (0, _currencyUtil.formatCurrencyWithSymbol)(userBalance),
322
- btnText: 'Social Commerce'
323
- }, _b[_constants.walletType.CENDUIT] = {
324
- amount: userBalance === null ? '****' : (0, _currencyUtil.formatCurrencyWithSymbol)(userPoint),
325
- btnText: 'Cenduit Mall'
326
- }, _b);
327
- return [2
328
- /*return*/
329
- ];
256
+ switch (_c.label) {
257
+ case 0:
258
+ data = this.props.data;
259
+ return [4
260
+ /*yield*/
261
+ , (0, _commonUtil.commonFetch)('/designer/v1/h5/mywallet/list', {}, 'GET')];
262
+
263
+ case 1:
264
+ _a = _c.sent(), userCreditResps = _a.userCreditResps, userCashbackValues = _a.userCashbackValues, userBalance = _a.userBalance, userPoint = _a.userPoint, defaultShowWallet = _a.defaultShowWallet; // const { userCreditResps, userCashbackValues, userBalance, userPoint, defaultShowWallet } = {
265
+ // userCreditResps: [
266
+ // {
267
+ // userCreditId: 1023,
268
+ // creditId: 1,
269
+ // partyType: null,
270
+ // state: 'Pass',
271
+ // isUrlExpired: false,
272
+ // creditLimit: 150000,
273
+ // usageAmount: 100000,
274
+ // availableAmount: 1000,
275
+ // comments: null,
276
+ // userNearestBillDto: null,
277
+ // },
278
+ // {
279
+ // userCreditId: 1026,
280
+ // creditId: 2,
281
+ // partyType: null,
282
+ // state: 'Locked',
283
+ // isUrlExpired: false,
284
+ // creditLimit: 100000,
285
+ // usageAmount: 100000,
286
+ // availableAmount: 2000,
287
+ // comments: null,
288
+ // userNearestBillDto: null,
289
+ // },
290
+ // {
291
+ // userCreditId: 1027,
292
+ // creditId: 3,
293
+ // partyType: 'I',
294
+ // state: 'Pass',
295
+ // isUrlExpired: false,
296
+ // creditLimit: 100000000,
297
+ // usageAmount: 0,
298
+ // availableAmount: 3000,
299
+ // comments: 'ty',
300
+ // userNearestBillDto: null,
301
+ // },
302
+ // ],
303
+ // userCashbackValues: 4000,
304
+ // userBalance: 5000,
305
+ // userPoint: 6000,
306
+ // defaultShowWallet: 'Balance',
307
+ // };
308
+
309
+ if (data.customize.layout === 'layout2' && this.sliderRef) {
310
+ defaultShowIndex_1 = 0;
311
+ data.groupSource.forEach(function (f, i) {
312
+ if (f.sourceType === defaultShowWallet) defaultShowIndex_1 = i;
313
+ });
314
+ this.sliderRef.slickGoTo(defaultShowIndex_1);
315
+ }
316
+
317
+ bnplObj = userCreditResps === null || userCreditResps === void 0 ? void 0 : userCreditResps.find(function (item) {
318
+ return item.creditId === 1 && [_constants.CREDIT_STATE.APPROVED.KEY, _constants.CREDIT_STATE.LOCKED.KEY].includes(item.state);
319
+ });
320
+ creditObj = userCreditResps === null || userCreditResps === void 0 ? void 0 : userCreditResps.find(function (item) {
321
+ return item.creditId === 2 && [_constants.CREDIT_STATE.APPROVED.KEY, _constants.CREDIT_STATE.LOCKED.KEY].includes(item.state);
322
+ });
323
+ B2BObj = userCreditResps === null || userCreditResps === void 0 ? void 0 : userCreditResps.find(function (item) {
324
+ return item.creditId === 3 && [_constants.CREDIT_STATE.APPROVED.KEY, _constants.CREDIT_STATE.LOCKED.KEY].includes(item.state);
325
+ });
326
+ this.setState({
327
+ userWalletData: (_b = {}, _b[_constants.walletType.BNPL] = {
328
+ amount: userCreditResps === null ? '****' : bnplObj ? (0, _currencyUtil.formatCurrencyWithSymbol)(bnplObj.availableAmount) : 'APPLY'
329
+ }, _b[_constants.walletType.CREDIT] = {
330
+ amount: userCreditResps === null ? '****' : creditObj ? (0, _currencyUtil.formatCurrencyWithSymbol)(creditObj.availableAmount) : 'APPLY'
331
+ }, _b[_constants.walletType.B2B] = {
332
+ amount: userCreditResps === null ? '****' : B2BObj ? (0, _currencyUtil.formatCurrencyWithSymbol)(B2BObj.availableAmount) : 'APPLY',
333
+ text: B2BObj ? 'Add ore products to your shop!' : '',
334
+ btnText: 'Procure Product'
335
+ }, _b[_constants.walletType.CASHBACK] = {
336
+ amount: userCashbackValues === null ? '****' : (0, _currencyUtil.formatCurrencyWithSymbol)(userCashbackValues)
337
+ }, _b[_constants.walletType.BALANCE] = {
338
+ amount: userBalance === null ? '****' : (0, _currencyUtil.formatCurrencyWithSymbol)(userBalance),
339
+ btnText: 'Social Commerce'
340
+ }, _b[_constants.walletType.CENDUIT] = {
341
+ amount: userBalance === null ? '****' : (0, _currencyUtil.formatCurrencyWithSymbol)(userPoint),
342
+ btnText: 'Cenduit Mall'
343
+ }, _b)
344
+ });
345
+ return [2
346
+ /*return*/
347
+ ];
348
+ }
330
349
  });
331
350
  });
332
351
  };
@@ -377,12 +396,14 @@ function (_super) {
377
396
 
378
397
  this.getMyWalletData();
379
398
  this.destroy = (0, _mobx.autorun)(function () {
380
- _this.sliderGoTo(_this.props.data.groupSource);
381
- /** 设计器模式下 如果选中特定group 自动播放关闭 */
399
+ if (_this.props.data.customize.layout === 'layout2' && _this.sliderRef) {
400
+ _this.sliderGoTo(_this.props.data.groupSource);
401
+ /** 设计器模式下 如果选中特定group 自动播放关闭 */
382
402
 
383
403
 
384
- if ((0, _coreUtil.isDesignMode)() && _mobx.store.clickedGroup) {
385
- _this.sliderRef.slickPause();
404
+ if ((0, _coreUtil.isDesignMode)() && _mobx.store.clickedGroup) {
405
+ _this.sliderRef.slickPause();
406
+ }
386
407
  }
387
408
  });
388
409
  };
@@ -437,6 +458,7 @@ function (_super) {
437
458
  var _a, _b, _c, _d, _e, _f, _g;
438
459
 
439
460
  var data = _this.props.data;
461
+ var userWalletData = _this.state.userWalletData;
440
462
  var GAData = (0, _commonUtil.getGAData)(data);
441
463
  var _bgStyle = {};
442
464
 
@@ -464,7 +486,7 @@ function (_super) {
464
486
  }), item.amount.open && /*#__PURE__*/_react["default"].createElement(_components.MetaText, {
465
487
  className: "amount",
466
488
  data: __assign(__assign({}, item.amount), {
467
- text: (_a = _this.userWalletData[item.sourceType]) === null || _a === void 0 ? void 0 : _a.amount
489
+ text: (_a = userWalletData[item.sourceType]) === null || _a === void 0 ? void 0 : _a.amount
468
490
  }),
469
491
  GAData: __assign(__assign({}, GAData), {
470
492
  groupId: item.id,
@@ -474,7 +496,7 @@ function (_super) {
474
496
  }), item.text.open && /*#__PURE__*/_react["default"].createElement(_components.MetaText, {
475
497
  className: "text",
476
498
  data: __assign(__assign({}, item.text), {
477
- text: ((_b = _this.userWalletData[item.sourceType]) === null || _b === void 0 ? void 0 : _b.text) || 'Make money and shop on Cendol!'
499
+ text: ((_b = userWalletData[item.sourceType]) === null || _b === void 0 ? void 0 : _b.text) || 'Make money and shop on Cendol!'
478
500
  }),
479
501
  GAData: __assign(__assign({}, GAData), {
480
502
  groupId: item.id,
@@ -484,7 +506,7 @@ function (_super) {
484
506
  }), item.button.open && /*#__PURE__*/_react["default"].createElement(_components.MetaButton, {
485
507
  className: "wallet-btn",
486
508
  data: __assign(__assign({}, item.button), {
487
- text: ((_c = _this.userWalletData[item.sourceType]) === null || _c === void 0 ? void 0 : _c.btnText) || 'Lets Go!'
509
+ text: ((_c = userWalletData[item.sourceType]) === null || _c === void 0 ? void 0 : _c.btnText) || 'Lets Go!'
488
510
  }),
489
511
  GAData: __assign(__assign({}, GAData), {
490
512
  groupId: item.id,
@@ -503,7 +525,7 @@ function (_super) {
503
525
  readonly: true
504
526
  }), /*#__PURE__*/_react["default"].createElement(_components.MetaText, {
505
527
  data: __assign(__assign({}, item.peek), {
506
- text: "" + (((_e = _this.userWalletData[preItem === null || preItem === void 0 ? void 0 : preItem.sourceType]) === null || _e === void 0 ? void 0 : _e.amount) || '')
528
+ text: "" + (((_e = userWalletData[preItem === null || preItem === void 0 ? void 0 : preItem.sourceType]) === null || _e === void 0 ? void 0 : _e.amount) || '')
507
529
  }),
508
530
  GAData: __assign(__assign({}, GAData), {
509
531
  groupId: item.id,
@@ -523,7 +545,7 @@ function (_super) {
523
545
  readonly: true
524
546
  }), /*#__PURE__*/_react["default"].createElement(_components.MetaText, {
525
547
  data: __assign(__assign({}, item.peek), {
526
- text: "" + (((_g = _this.userWalletData[nextItem === null || nextItem === void 0 ? void 0 : nextItem.sourceType]) === null || _g === void 0 ? void 0 : _g.amount) || '')
548
+ text: "" + (((_g = userWalletData[nextItem === null || nextItem === void 0 ? void 0 : nextItem.sourceType]) === null || _g === void 0 ? void 0 : _g.amount) || '')
527
549
  }),
528
550
  GAData: __assign(__assign({}, GAData), {
529
551
  groupId: item.id,
@@ -7,8 +7,6 @@ exports["default"] = void 0;
7
7
 
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
 
10
- var _pc = _interopRequireDefault(require("./pc"));
11
-
12
10
  var _mobile = _interopRequireDefault(require("./mobile"));
13
11
 
14
12
  var _defaultJSON = require("./defaultJSON");
@@ -59,30 +57,28 @@ var __decorate = void 0 && (void 0).__decorate || function (decorators, target,
59
57
  return c > 3 && r && Object.defineProperty(target, key, r), r;
60
58
  };
61
59
 
62
- var ImageGallery =
60
+ var Wallet =
63
61
  /** @class */
64
62
  function (_super) {
65
- __extends(ImageGallery, _super);
63
+ __extends(Wallet, _super);
66
64
 
67
- function ImageGallery() {
65
+ function Wallet() {
68
66
  return _super !== null && _super.apply(this, arguments) || this;
69
67
  }
70
68
 
71
- ImageGallery.prototype.render = function () {
69
+ Wallet.prototype.render = function () {
72
70
  var nodeData = this.props.nodeData;
73
- return /*#__PURE__*/_react["default"].createElement("div", null, window.magicDesign.device === 'pc' ? /*#__PURE__*/_react["default"].createElement(_pc["default"], {
74
- data: nodeData
75
- }) : /*#__PURE__*/_react["default"].createElement(_mobile["default"], {
71
+ return /*#__PURE__*/_react["default"].createElement("div", null, window.magicDesign.device === 'pc' ? null : /*#__PURE__*/_react["default"].createElement(_mobile["default"], {
76
72
  data: nodeData
77
73
  }));
78
74
  };
79
75
 
80
- ImageGallery.defaultProps = {};
81
- ImageGallery.type = 'WALLET';
82
- ImageGallery.getDefaultJSON = _defaultJSON.getDefaultJSON;
83
- ImageGallery = __decorate([_compositeDecorator["default"]], ImageGallery);
84
- return ImageGallery;
76
+ Wallet.defaultProps = {};
77
+ Wallet.type = 'WALLET';
78
+ Wallet.getDefaultJSON = _defaultJSON.getDefaultJSON;
79
+ Wallet = __decorate([_compositeDecorator["default"]], Wallet);
80
+ return Wallet;
85
81
  }(_react.Component);
86
82
 
87
- var _default = ImageGallery;
83
+ var _default = Wallet;
88
84
  exports["default"] = _default;
@@ -240,93 +240,112 @@ function (_super) {
240
240
  var _this = _super !== null && _super.apply(this, arguments) || this;
241
241
 
242
242
  _this.state = {
243
- sliderIndex: 0
243
+ sliderIndex: 0,
244
+ userWalletData: {}
244
245
  };
245
246
  _this.sliderRef = null;
246
247
  _this.destroy = null;
247
- _this.userWalletData = {};
248
248
 
249
249
  _this.getMyWalletData = function () {
250
250
  return __awaiter(_this, void 0, void 0, function () {
251
- var _a, userCreditResps, userCashbackValues, userBalance, userPoint, defaultShowWallet, defaultShowIndex, bnplObj, creditObj, B2BObj;
251
+ var data, _a, userCreditResps, userCashbackValues, userBalance, userPoint, defaultShowWallet, defaultShowIndex_1, bnplObj, creditObj, B2BObj;
252
252
 
253
253
  var _b;
254
254
 
255
255
  return __generator(this, function (_c) {
256
- _a = {
257
- userCreditResps: [{
258
- userCreditId: 1023,
259
- creditId: 1,
260
- partyType: null,
261
- state: 'Pass',
262
- isUrlExpired: false,
263
- creditLimit: 150000,
264
- usageAmount: 100000,
265
- availableAmount: 1000,
266
- comments: null,
267
- userNearestBillDto: null
268
- }, {
269
- userCreditId: 1026,
270
- creditId: 2,
271
- partyType: null,
272
- state: 'Locked',
273
- isUrlExpired: false,
274
- creditLimit: 100000,
275
- usageAmount: 100000,
276
- availableAmount: 2000,
277
- comments: null,
278
- userNearestBillDto: null
279
- }, {
280
- userCreditId: 1027,
281
- creditId: 3,
282
- partyType: 'I',
283
- state: 'Pass',
284
- isUrlExpired: false,
285
- creditLimit: 100000000,
286
- usageAmount: 0,
287
- availableAmount: 3000,
288
- comments: 'ty',
289
- userNearestBillDto: null
290
- }],
291
- userCashbackValues: 4000,
292
- userBalance: 5000,
293
- userPoint: 6000,
294
- defaultShowWallet: 'Balance'
295
- }, userCreditResps = _a.userCreditResps, userCashbackValues = _a.userCashbackValues, userBalance = _a.userBalance, userPoint = _a.userPoint, defaultShowWallet = _a.defaultShowWallet;
296
- defaultShowIndex = 0;
297
- this.props.data.groupSource.forEach(function (f, i) {
298
- if (f.sourceType === defaultShowWallet) defaultShowIndex = i;
299
- });
300
- this.sliderRef.slickGoTo(defaultShowIndex);
301
- bnplObj = userCreditResps === null || userCreditResps === void 0 ? void 0 : userCreditResps.find(function (item) {
302
- return item.creditId === 1 && [_constants.CREDIT_STATE.APPROVED.KEY, _constants.CREDIT_STATE.LOCKED.KEY].includes(item.state);
303
- });
304
- creditObj = userCreditResps === null || userCreditResps === void 0 ? void 0 : userCreditResps.find(function (item) {
305
- return item.creditId === 2 && [_constants.CREDIT_STATE.APPROVED.KEY, _constants.CREDIT_STATE.LOCKED.KEY].includes(item.state);
306
- });
307
- B2BObj = userCreditResps === null || userCreditResps === void 0 ? void 0 : userCreditResps.find(function (item) {
308
- return item.creditId === 3 && [_constants.CREDIT_STATE.APPROVED.KEY, _constants.CREDIT_STATE.LOCKED.KEY].includes(item.state);
309
- });
310
- this.userWalletData = (_b = {}, _b[_constants.walletType.BNPL] = {
311
- amount: userCreditResps === null ? '****' : bnplObj ? (0, _currencyUtil.formatCurrencyWithSymbol)(bnplObj.availableAmount) : 'APPLY'
312
- }, _b[_constants.walletType.CREDIT] = {
313
- amount: userCreditResps === null ? '****' : creditObj ? (0, _currencyUtil.formatCurrencyWithSymbol)(creditObj.availableAmount) : 'APPLY'
314
- }, _b[_constants.walletType.B2B] = {
315
- amount: userCreditResps === null ? '****' : B2BObj ? (0, _currencyUtil.formatCurrencyWithSymbol)(B2BObj.availableAmount) : 'APPLY',
316
- text: B2BObj ? 'Add ore products to your shop!' : '',
317
- btnText: 'Procure Product'
318
- }, _b[_constants.walletType.CASHBACK] = {
319
- amount: userCashbackValues === null ? '****' : (0, _currencyUtil.formatCurrencyWithSymbol)(userCashbackValues)
320
- }, _b[_constants.walletType.BALANCE] = {
321
- amount: userBalance === null ? '****' : (0, _currencyUtil.formatCurrencyWithSymbol)(userBalance),
322
- btnText: 'Social Commerce'
323
- }, _b[_constants.walletType.CENDUIT] = {
324
- amount: userBalance === null ? '****' : (0, _currencyUtil.formatCurrencyWithSymbol)(userPoint),
325
- btnText: 'Cenduit Mall'
326
- }, _b);
327
- return [2
328
- /*return*/
329
- ];
256
+ switch (_c.label) {
257
+ case 0:
258
+ data = this.props.data;
259
+ return [4
260
+ /*yield*/
261
+ , (0, _commonUtil.commonFetch)('/designer/v1/h5/mywallet/list', {}, 'GET')];
262
+
263
+ case 1:
264
+ _a = _c.sent(), userCreditResps = _a.userCreditResps, userCashbackValues = _a.userCashbackValues, userBalance = _a.userBalance, userPoint = _a.userPoint, defaultShowWallet = _a.defaultShowWallet; // const { userCreditResps, userCashbackValues, userBalance, userPoint, defaultShowWallet } = {
265
+ // userCreditResps: [
266
+ // {
267
+ // userCreditId: 1023,
268
+ // creditId: 1,
269
+ // partyType: null,
270
+ // state: 'Pass',
271
+ // isUrlExpired: false,
272
+ // creditLimit: 150000,
273
+ // usageAmount: 100000,
274
+ // availableAmount: 1000,
275
+ // comments: null,
276
+ // userNearestBillDto: null,
277
+ // },
278
+ // {
279
+ // userCreditId: 1026,
280
+ // creditId: 2,
281
+ // partyType: null,
282
+ // state: 'Locked',
283
+ // isUrlExpired: false,
284
+ // creditLimit: 100000,
285
+ // usageAmount: 100000,
286
+ // availableAmount: 2000,
287
+ // comments: null,
288
+ // userNearestBillDto: null,
289
+ // },
290
+ // {
291
+ // userCreditId: 1027,
292
+ // creditId: 3,
293
+ // partyType: 'I',
294
+ // state: 'Pass',
295
+ // isUrlExpired: false,
296
+ // creditLimit: 100000000,
297
+ // usageAmount: 0,
298
+ // availableAmount: 3000,
299
+ // comments: 'ty',
300
+ // userNearestBillDto: null,
301
+ // },
302
+ // ],
303
+ // userCashbackValues: 4000,
304
+ // userBalance: 5000,
305
+ // userPoint: 6000,
306
+ // defaultShowWallet: 'Balance',
307
+ // };
308
+
309
+ if (data.customize.layout === 'layout2' && this.sliderRef) {
310
+ defaultShowIndex_1 = 0;
311
+ data.groupSource.forEach(function (f, i) {
312
+ if (f.sourceType === defaultShowWallet) defaultShowIndex_1 = i;
313
+ });
314
+ this.sliderRef.slickGoTo(defaultShowIndex_1);
315
+ }
316
+
317
+ bnplObj = userCreditResps === null || userCreditResps === void 0 ? void 0 : userCreditResps.find(function (item) {
318
+ return item.creditId === 1 && [_constants.CREDIT_STATE.APPROVED.KEY, _constants.CREDIT_STATE.LOCKED.KEY].includes(item.state);
319
+ });
320
+ creditObj = userCreditResps === null || userCreditResps === void 0 ? void 0 : userCreditResps.find(function (item) {
321
+ return item.creditId === 2 && [_constants.CREDIT_STATE.APPROVED.KEY, _constants.CREDIT_STATE.LOCKED.KEY].includes(item.state);
322
+ });
323
+ B2BObj = userCreditResps === null || userCreditResps === void 0 ? void 0 : userCreditResps.find(function (item) {
324
+ return item.creditId === 3 && [_constants.CREDIT_STATE.APPROVED.KEY, _constants.CREDIT_STATE.LOCKED.KEY].includes(item.state);
325
+ });
326
+ this.setState({
327
+ userWalletData: (_b = {}, _b[_constants.walletType.BNPL] = {
328
+ amount: userCreditResps === null ? '****' : bnplObj ? (0, _currencyUtil.formatCurrencyWithSymbol)(bnplObj.availableAmount) : 'APPLY'
329
+ }, _b[_constants.walletType.CREDIT] = {
330
+ amount: userCreditResps === null ? '****' : creditObj ? (0, _currencyUtil.formatCurrencyWithSymbol)(creditObj.availableAmount) : 'APPLY'
331
+ }, _b[_constants.walletType.B2B] = {
332
+ amount: userCreditResps === null ? '****' : B2BObj ? (0, _currencyUtil.formatCurrencyWithSymbol)(B2BObj.availableAmount) : 'APPLY',
333
+ text: B2BObj ? 'Add ore products to your shop!' : '',
334
+ btnText: 'Procure Product'
335
+ }, _b[_constants.walletType.CASHBACK] = {
336
+ amount: userCashbackValues === null ? '****' : (0, _currencyUtil.formatCurrencyWithSymbol)(userCashbackValues)
337
+ }, _b[_constants.walletType.BALANCE] = {
338
+ amount: userBalance === null ? '****' : (0, _currencyUtil.formatCurrencyWithSymbol)(userBalance),
339
+ btnText: 'Social Commerce'
340
+ }, _b[_constants.walletType.CENDUIT] = {
341
+ amount: userBalance === null ? '****' : (0, _currencyUtil.formatCurrencyWithSymbol)(userPoint),
342
+ btnText: 'Cenduit Mall'
343
+ }, _b)
344
+ });
345
+ return [2
346
+ /*return*/
347
+ ];
348
+ }
330
349
  });
331
350
  });
332
351
  };
@@ -377,12 +396,14 @@ function (_super) {
377
396
 
378
397
  this.getMyWalletData();
379
398
  this.destroy = (0, _mobx.autorun)(function () {
380
- _this.sliderGoTo(_this.props.data.groupSource);
381
- /** 设计器模式下 如果选中特定group 自动播放关闭 */
399
+ if (_this.props.data.customize.layout === 'layout2' && _this.sliderRef) {
400
+ _this.sliderGoTo(_this.props.data.groupSource);
401
+ /** 设计器模式下 如果选中特定group 自动播放关闭 */
382
402
 
383
403
 
384
- if ((0, _coreUtil.isDesignMode)() && _mobx.store.clickedGroup) {
385
- _this.sliderRef.slickPause();
404
+ if ((0, _coreUtil.isDesignMode)() && _mobx.store.clickedGroup) {
405
+ _this.sliderRef.slickPause();
406
+ }
386
407
  }
387
408
  });
388
409
  };
@@ -437,6 +458,7 @@ function (_super) {
437
458
  var _a, _b, _c, _d, _e, _f, _g;
438
459
 
439
460
  var data = _this.props.data;
461
+ var userWalletData = _this.state.userWalletData;
440
462
  var GAData = (0, _commonUtil.getGAData)(data);
441
463
  var _bgStyle = {};
442
464
 
@@ -464,7 +486,7 @@ function (_super) {
464
486
  }), item.amount.open && /*#__PURE__*/_react["default"].createElement(_components.MetaText, {
465
487
  className: "amount",
466
488
  data: __assign(__assign({}, item.amount), {
467
- text: (_a = _this.userWalletData[item.sourceType]) === null || _a === void 0 ? void 0 : _a.amount
489
+ text: (_a = userWalletData[item.sourceType]) === null || _a === void 0 ? void 0 : _a.amount
468
490
  }),
469
491
  GAData: __assign(__assign({}, GAData), {
470
492
  groupId: item.id,
@@ -474,7 +496,7 @@ function (_super) {
474
496
  }), item.text.open && /*#__PURE__*/_react["default"].createElement(_components.MetaText, {
475
497
  className: "text",
476
498
  data: __assign(__assign({}, item.text), {
477
- text: ((_b = _this.userWalletData[item.sourceType]) === null || _b === void 0 ? void 0 : _b.text) || 'Make money and shop on Cendol!'
499
+ text: ((_b = userWalletData[item.sourceType]) === null || _b === void 0 ? void 0 : _b.text) || 'Make money and shop on Cendol!'
478
500
  }),
479
501
  GAData: __assign(__assign({}, GAData), {
480
502
  groupId: item.id,
@@ -484,7 +506,7 @@ function (_super) {
484
506
  }), item.button.open && /*#__PURE__*/_react["default"].createElement(_components.MetaButton, {
485
507
  className: "wallet-btn",
486
508
  data: __assign(__assign({}, item.button), {
487
- text: ((_c = _this.userWalletData[item.sourceType]) === null || _c === void 0 ? void 0 : _c.btnText) || 'Lets Go!'
509
+ text: ((_c = userWalletData[item.sourceType]) === null || _c === void 0 ? void 0 : _c.btnText) || 'Lets Go!'
488
510
  }),
489
511
  GAData: __assign(__assign({}, GAData), {
490
512
  groupId: item.id,
@@ -503,7 +525,7 @@ function (_super) {
503
525
  readonly: true
504
526
  }), /*#__PURE__*/_react["default"].createElement(_components.MetaText, {
505
527
  data: __assign(__assign({}, item.peek), {
506
- text: "" + (((_e = _this.userWalletData[preItem === null || preItem === void 0 ? void 0 : preItem.sourceType]) === null || _e === void 0 ? void 0 : _e.amount) || '')
528
+ text: "" + (((_e = userWalletData[preItem === null || preItem === void 0 ? void 0 : preItem.sourceType]) === null || _e === void 0 ? void 0 : _e.amount) || '')
507
529
  }),
508
530
  GAData: __assign(__assign({}, GAData), {
509
531
  groupId: item.id,
@@ -523,7 +545,7 @@ function (_super) {
523
545
  readonly: true
524
546
  }), /*#__PURE__*/_react["default"].createElement(_components.MetaText, {
525
547
  data: __assign(__assign({}, item.peek), {
526
- text: "" + (((_g = _this.userWalletData[nextItem === null || nextItem === void 0 ? void 0 : nextItem.sourceType]) === null || _g === void 0 ? void 0 : _g.amount) || '')
548
+ text: "" + (((_g = userWalletData[nextItem === null || nextItem === void 0 ? void 0 : nextItem.sourceType]) === null || _g === void 0 ? void 0 : _g.amount) || '')
527
549
  }),
528
550
  GAData: __assign(__assign({}, GAData), {
529
551
  groupId: item.id,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fonixtree/magic-design",
3
3
  "author": "Cylon Team",
4
- "version": "2.0.39",
4
+ "version": "2.0.41",
5
5
  "description": "Magic Design",
6
6
  "license": "MIT",
7
7
  "module": "es/index.js",