@fonixtree/magic-design 0.0.121 → 0.0.123

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.
@@ -233,27 +233,27 @@ function (_super) {
233
233
 
234
234
  _this.getMyWalletData = function () {
235
235
  return __awaiter(_this, void 0, void 0, function () {
236
- var _a, userCreditResps, userCashbackValues;
236
+ var _a, userCreditResps, userCashbackValues, creditObj, bnplObj;
237
237
 
238
- var _b, _c;
239
-
240
- return __generator(this, function (_d) {
241
- switch (_d.label) {
238
+ return __generator(this, function (_b) {
239
+ switch (_b.label) {
242
240
  case 0:
243
241
  return [4
244
242
  /*yield*/
245
243
  , (0, _commonUtil.commonFetch)(window.magicDesign.MBaseUrl + "/h5/mywallet/list", {}, 'GET')];
246
244
 
247
245
  case 1:
248
- _a = _d.sent(), userCreditResps = _a.userCreditResps, userCashbackValues = _a.userCashbackValues;
246
+ _a = _b.sent(), userCreditResps = _a.userCreditResps, userCashbackValues = _a.userCashbackValues;
247
+ creditObj = userCreditResps.find(function (item) {
248
+ return item.creditId === 2 && [_constants.CREDIT_STATE.APPROVED.KEY, _constants.CREDIT_STATE.LOCKED.KEY].includes(item.state);
249
+ });
250
+ bnplObj = userCreditResps.find(function (item) {
251
+ return item.creditId === 1 && [_constants.CREDIT_STATE.APPROVED.KEY, _constants.CREDIT_STATE.LOCKED.KEY].includes(item.state);
252
+ });
249
253
  this.setState({
250
- cashback: userCashbackValues || 0,
251
- credit: ((_b = userCreditResps.find(function (item) {
252
- return item.creditId === 2 && [_constants.CREDIT_STATE.APPROVED.KEY, _constants.CREDIT_STATE.LOCKED.KEY].includes(item.state);
253
- })) === null || _b === void 0 ? void 0 : _b.availableAmount) || 0,
254
- bnpl: ((_c = userCreditResps.find(function (item) {
255
- return item.creditId === 1 && [_constants.CREDIT_STATE.APPROVED.KEY, _constants.CREDIT_STATE.LOCKED.KEY].includes(item.state);
256
- })) === null || _c === void 0 ? void 0 : _c.availableAmount) || 0
254
+ cashback: userCashbackValues === null ? '****' : (0, _currencyUtil.formatCurrencyWithSymbol)(userCashbackValues),
255
+ credit: userCreditResps === null ? '****' : creditObj ? (0, _currencyUtil.formatCurrencyWithSymbol)(creditObj.availableAmount) : 'APPLY',
256
+ bnpl: userCreditResps === null ? '****' : bnplObj ? (0, _currencyUtil.formatCurrencyWithSymbol)(bnplObj.availableAmount) : 'APPLY'
257
257
  });
258
258
  return [2
259
259
  /*return*/
@@ -327,7 +327,7 @@ function (_super) {
327
327
  }), item.amount.open && /*#__PURE__*/_react["default"].createElement(_components.MetaText, {
328
328
  className: "amount",
329
329
  data: __assign(__assign({}, item.hover.open && item.hover.amount.open && _this.state["hover_" + item.id] ? item.hover.amount : item.amount), {
330
- text: (0, _currencyUtil.formatCurrencyWithSymbol)(_amount)
330
+ text: _amount
331
331
  }),
332
332
  readonly: true
333
333
  })));
@@ -233,27 +233,27 @@ function (_super) {
233
233
 
234
234
  _this.getMyWalletData = function () {
235
235
  return __awaiter(_this, void 0, void 0, function () {
236
- var _a, userCreditResps, userCashbackValues;
236
+ var _a, userCreditResps, userCashbackValues, creditObj, bnplObj;
237
237
 
238
- var _b, _c;
239
-
240
- return __generator(this, function (_d) {
241
- switch (_d.label) {
238
+ return __generator(this, function (_b) {
239
+ switch (_b.label) {
242
240
  case 0:
243
241
  return [4
244
242
  /*yield*/
245
243
  , (0, _commonUtil.commonFetch)(window.magicDesign.MBaseUrl + "/h5/mywallet/list", {}, 'GET')];
246
244
 
247
245
  case 1:
248
- _a = _d.sent(), userCreditResps = _a.userCreditResps, userCashbackValues = _a.userCashbackValues;
246
+ _a = _b.sent(), userCreditResps = _a.userCreditResps, userCashbackValues = _a.userCashbackValues;
247
+ creditObj = userCreditResps.find(function (item) {
248
+ return item.creditId === 2 && [_constants.CREDIT_STATE.APPROVED.KEY, _constants.CREDIT_STATE.LOCKED.KEY].includes(item.state);
249
+ });
250
+ bnplObj = userCreditResps.find(function (item) {
251
+ return item.creditId === 1 && [_constants.CREDIT_STATE.APPROVED.KEY, _constants.CREDIT_STATE.LOCKED.KEY].includes(item.state);
252
+ });
249
253
  this.setState({
250
- cashback: userCashbackValues || 0,
251
- credit: ((_b = userCreditResps.find(function (item) {
252
- return item.creditId === 2 && [_constants.CREDIT_STATE.APPROVED.KEY, _constants.CREDIT_STATE.LOCKED.KEY].includes(item.state);
253
- })) === null || _b === void 0 ? void 0 : _b.availableAmount) || 0,
254
- bnpl: ((_c = userCreditResps.find(function (item) {
255
- return item.creditId === 1 && [_constants.CREDIT_STATE.APPROVED.KEY, _constants.CREDIT_STATE.LOCKED.KEY].includes(item.state);
256
- })) === null || _c === void 0 ? void 0 : _c.availableAmount) || 0
254
+ cashback: userCashbackValues === null ? '****' : (0, _currencyUtil.formatCurrencyWithSymbol)(userCashbackValues),
255
+ credit: userCreditResps === null ? '****' : creditObj ? (0, _currencyUtil.formatCurrencyWithSymbol)(creditObj.availableAmount) : 'APPLY',
256
+ bnpl: userCreditResps === null ? '****' : bnplObj ? (0, _currencyUtil.formatCurrencyWithSymbol)(bnplObj.availableAmount) : 'APPLY'
257
257
  });
258
258
  return [2
259
259
  /*return*/
@@ -327,7 +327,7 @@ function (_super) {
327
327
  }), item.amount.open && /*#__PURE__*/_react["default"].createElement(_components.MetaText, {
328
328
  className: "amount",
329
329
  data: __assign(__assign({}, item.hover.open && item.hover.amount.open && _this.state["hover_" + item.id] ? item.hover.amount : item.amount), {
330
- text: (0, _currencyUtil.formatCurrencyWithSymbol)(_amount)
330
+ text: _amount
331
331
  }),
332
332
  readonly: true
333
333
  })));
@@ -233,27 +233,27 @@ function (_super) {
233
233
 
234
234
  _this.getMyWalletData = function () {
235
235
  return __awaiter(_this, void 0, void 0, function () {
236
- var _a, userCreditResps, userCashbackValues;
236
+ var _a, userCreditResps, userCashbackValues, creditObj, bnplObj;
237
237
 
238
- var _b, _c;
239
-
240
- return __generator(this, function (_d) {
241
- switch (_d.label) {
238
+ return __generator(this, function (_b) {
239
+ switch (_b.label) {
242
240
  case 0:
243
241
  return [4
244
242
  /*yield*/
245
243
  , (0, _commonUtil.commonFetch)(window.magicDesign.MBaseUrl + "/h5/mywallet/list", {}, 'GET')];
246
244
 
247
245
  case 1:
248
- _a = _d.sent(), userCreditResps = _a.userCreditResps, userCashbackValues = _a.userCashbackValues;
246
+ _a = _b.sent(), userCreditResps = _a.userCreditResps, userCashbackValues = _a.userCashbackValues;
247
+ creditObj = userCreditResps.find(function (item) {
248
+ return item.creditId === 2 && [_constants.CREDIT_STATE.APPROVED.KEY, _constants.CREDIT_STATE.LOCKED.KEY].includes(item.state);
249
+ });
250
+ bnplObj = userCreditResps.find(function (item) {
251
+ return item.creditId === 1 && [_constants.CREDIT_STATE.APPROVED.KEY, _constants.CREDIT_STATE.LOCKED.KEY].includes(item.state);
252
+ });
249
253
  this.setState({
250
- cashback: userCashbackValues || 0,
251
- credit: ((_b = userCreditResps.find(function (item) {
252
- return item.creditId === 2 && [_constants.CREDIT_STATE.APPROVED.KEY, _constants.CREDIT_STATE.LOCKED.KEY].includes(item.state);
253
- })) === null || _b === void 0 ? void 0 : _b.availableAmount) || 0,
254
- bnpl: ((_c = userCreditResps.find(function (item) {
255
- return item.creditId === 1 && [_constants.CREDIT_STATE.APPROVED.KEY, _constants.CREDIT_STATE.LOCKED.KEY].includes(item.state);
256
- })) === null || _c === void 0 ? void 0 : _c.availableAmount) || 0
254
+ cashback: userCashbackValues === null ? '****' : (0, _currencyUtil.formatCurrencyWithSymbol)(userCashbackValues),
255
+ credit: userCreditResps === null ? '****' : creditObj ? (0, _currencyUtil.formatCurrencyWithSymbol)(creditObj.availableAmount) : 'APPLY',
256
+ bnpl: userCreditResps === null ? '****' : bnplObj ? (0, _currencyUtil.formatCurrencyWithSymbol)(bnplObj.availableAmount) : 'APPLY'
257
257
  });
258
258
  return [2
259
259
  /*return*/
@@ -327,7 +327,7 @@ function (_super) {
327
327
  }), item.amount.open && /*#__PURE__*/_react["default"].createElement(_components.MetaText, {
328
328
  className: "amount",
329
329
  data: __assign(__assign({}, item.hover.open && item.hover.amount.open && _this.state["hover_" + item.id] ? item.hover.amount : item.amount), {
330
- text: (0, _currencyUtil.formatCurrencyWithSymbol)(_amount)
330
+ text: _amount
331
331
  }),
332
332
  readonly: true
333
333
  })));
@@ -233,27 +233,27 @@ function (_super) {
233
233
 
234
234
  _this.getMyWalletData = function () {
235
235
  return __awaiter(_this, void 0, void 0, function () {
236
- var _a, userCreditResps, userCashbackValues;
236
+ var _a, userCreditResps, userCashbackValues, creditObj, bnplObj;
237
237
 
238
- var _b, _c;
239
-
240
- return __generator(this, function (_d) {
241
- switch (_d.label) {
238
+ return __generator(this, function (_b) {
239
+ switch (_b.label) {
242
240
  case 0:
243
241
  return [4
244
242
  /*yield*/
245
243
  , (0, _commonUtil.commonFetch)(window.magicDesign.MBaseUrl + "/h5/mywallet/list", {}, 'GET')];
246
244
 
247
245
  case 1:
248
- _a = _d.sent(), userCreditResps = _a.userCreditResps, userCashbackValues = _a.userCashbackValues;
246
+ _a = _b.sent(), userCreditResps = _a.userCreditResps, userCashbackValues = _a.userCashbackValues;
247
+ creditObj = userCreditResps.find(function (item) {
248
+ return item.creditId === 2 && [_constants.CREDIT_STATE.APPROVED.KEY, _constants.CREDIT_STATE.LOCKED.KEY].includes(item.state);
249
+ });
250
+ bnplObj = userCreditResps.find(function (item) {
251
+ return item.creditId === 1 && [_constants.CREDIT_STATE.APPROVED.KEY, _constants.CREDIT_STATE.LOCKED.KEY].includes(item.state);
252
+ });
249
253
  this.setState({
250
- cashback: userCashbackValues || 0,
251
- credit: ((_b = userCreditResps.find(function (item) {
252
- return item.creditId === 2 && [_constants.CREDIT_STATE.APPROVED.KEY, _constants.CREDIT_STATE.LOCKED.KEY].includes(item.state);
253
- })) === null || _b === void 0 ? void 0 : _b.availableAmount) || 0,
254
- bnpl: ((_c = userCreditResps.find(function (item) {
255
- return item.creditId === 1 && [_constants.CREDIT_STATE.APPROVED.KEY, _constants.CREDIT_STATE.LOCKED.KEY].includes(item.state);
256
- })) === null || _c === void 0 ? void 0 : _c.availableAmount) || 0
254
+ cashback: userCashbackValues === null ? '****' : (0, _currencyUtil.formatCurrencyWithSymbol)(userCashbackValues),
255
+ credit: userCreditResps === null ? '****' : creditObj ? (0, _currencyUtil.formatCurrencyWithSymbol)(creditObj.availableAmount) : 'APPLY',
256
+ bnpl: userCreditResps === null ? '****' : bnplObj ? (0, _currencyUtil.formatCurrencyWithSymbol)(bnplObj.availableAmount) : 'APPLY'
257
257
  });
258
258
  return [2
259
259
  /*return*/
@@ -327,7 +327,7 @@ function (_super) {
327
327
  }), item.amount.open && /*#__PURE__*/_react["default"].createElement(_components.MetaText, {
328
328
  className: "amount",
329
329
  data: __assign(__assign({}, item.hover.open && item.hover.amount.open && _this.state["hover_" + item.id] ? item.hover.amount : item.amount), {
330
- text: (0, _currencyUtil.formatCurrencyWithSymbol)(_amount)
330
+ text: _amount
331
331
  }),
332
332
  readonly: true
333
333
  })));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fonixtree/magic-design",
3
3
  "author": "Cylon Team",
4
- "version": "0.0.121",
4
+ "version": "0.0.123",
5
5
  "description": "Magic Design",
6
6
  "license": "MIT",
7
7
  "module": "es/index.js",