@jetthai/cuora 1.1.24 → 1.1.26

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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [1.1.26](https://github.com/jetthai/cuora-module/compare/v1.1.25...v1.1.26) (2023-01-04)
6
+
7
+ ### [1.1.25](https://github.com/jetthai/cuora-module/compare/v1.1.24...v1.1.25) (2023-01-04)
8
+
5
9
  ### [1.1.24](https://github.com/jetthai/cuora-module/compare/v1.1.23...v1.1.24) (2023-01-04)
6
10
 
7
11
  ### [1.1.23](https://github.com/jetthai/cuora-module/compare/v1.1.22...v1.1.23) (2023-01-03)
package/dist/bundle.mjs CHANGED
@@ -13186,7 +13186,7 @@ function reward (request) {
13186
13186
  },
13187
13187
  fetchWithdrawRulePreview: async (context, event) => {
13188
13188
  const { receiveNo } = context;
13189
- const { data } = await request.send(payment.getWithdrawRulePreview({ applyType: 'activity', applyNo: receiveNo, amount: null }));
13189
+ const data = await request.send(payment.getWithdrawRulePreview({ applyType: 'activity', applyNo: receiveNo, amount: null }));
13190
13190
  return data
13191
13191
  },
13192
13192
  receiveReward: async (context, event) => {
@@ -14806,6 +14806,7 @@ function withdraw_vn (request) {
14806
14806
  attachmentType: null, // null | 'withdraw' | 'pool'
14807
14807
  maximumWithdrawAmount: 0,
14808
14808
  enableWithdrawAmount: 0,
14809
+ enableWithdraw: false,
14809
14810
 
14810
14811
  amount: null,
14811
14812
  bank: null,
@@ -15117,6 +15118,7 @@ function withdraw_vn (request) {
15117
15118
  maximumWithdrawAmount: +maximumWithdrawAmount,
15118
15119
  enableWithdrawAmount: +enableWithdrawAmount,
15119
15120
  amount: +enableWithdrawAmount,
15121
+ enableWithdraw,
15120
15122
  }
15121
15123
  }),
15122
15124
  setOtp: assign((context, event) => {
@@ -15171,13 +15173,12 @@ function withdraw_vn (request) {
15171
15173
  return bank && amount > 0
15172
15174
  },
15173
15175
  isConvertible: (context, event) => {
15174
- const { balance, withdrawLimit } = context;
15175
- return balance > 0 && withdrawLimit === 0
15176
+ const { enableWithdraw } = context;
15177
+ return enableWithdraw
15176
15178
  },
15177
15179
  isNotWithdrawable: (context, event) => {
15178
- const { balance, withdrawLimit, paymentDetail } = context;
15179
- const minWithdrawAmount = paymentDetail[0]?.minimum || 0;
15180
- return withdrawLimit !== 0 || balance < minWithdrawAmount
15180
+ const { enableWithdraw } = context;
15181
+ return !enableWithdraw
15181
15182
  },
15182
15183
  isOtpRequired: (context, event) => {
15183
15184
  return event.data?.status === 'otp-verifying'
@@ -15278,6 +15279,7 @@ function withdraw_crypto (request) {
15278
15279
 
15279
15280
  maxWithdrawAmount: null,
15280
15281
  availableWithdrawAmount: null,
15282
+ enableWithdraw: false,
15281
15283
 
15282
15284
  attachmentType: null, // null | 'withdraw' | 'pool'
15283
15285
 
@@ -15606,6 +15608,7 @@ function withdraw_crypto (request) {
15606
15608
  maximumWithdrawAmount: +maximumWithdrawAmount,
15607
15609
  enableWithdrawAmount: +enableWithdrawAmount,
15608
15610
  amount: +enableWithdrawAmount,
15611
+ enableWithdraw,
15609
15612
  }
15610
15613
 
15611
15614
  // const rules = event.data.rules.filter((rule) => rule.maxWithdrawAmount > 0)
@@ -15714,13 +15717,12 @@ function withdraw_crypto (request) {
15714
15717
  return selectedNetwork && address && amount && charge
15715
15718
  },
15716
15719
  isConvertible: (context, event) => {
15717
- const { balance, withdrawLimit } = context;
15718
- return balance > 0 && withdrawLimit === 0
15720
+ const { enableWithdraw } = context;
15721
+ return enableWithdraw
15719
15722
  },
15720
15723
  isNotWithdrawable: (context, event) => {
15721
- const { balance, withdrawLimit, paymentDetail } = context;
15722
- const minWithdrawAmount = paymentDetail[0]?.minimum || 0;
15723
- return withdrawLimit !== 0 || balance < minWithdrawAmount
15724
+ const { enableWithdraw } = context;
15725
+ return !enableWithdraw
15724
15726
  },
15725
15727
  isCalculable: (context, event) => {
15726
15728
  const { selectedNetwork, amount } = context;
@@ -20342,6 +20344,7 @@ function promotions (request) {
20342
20344
  context: {
20343
20345
  noBonus: {},
20344
20346
  userInfo: {},
20347
+ siteConfig: {},
20345
20348
  withdrawRule: {},
20346
20349
  promotionsList: [],
20347
20350
  selectedPromo: {},
@@ -20349,10 +20352,10 @@ function promotions (request) {
20349
20352
  states: {
20350
20353
  loading: {
20351
20354
  invoke: {
20352
- src: 'fetchInitData',
20355
+ src: 'fetchPromotionsList',
20353
20356
  onDone: {
20354
20357
  target: 'loaded',
20355
- actions: 'setInitData',
20358
+ actions: 'setPromotionsList',
20356
20359
  },
20357
20360
  onError: {
20358
20361
  target: 'fail',
@@ -20412,10 +20415,21 @@ function promotions (request) {
20412
20415
  },
20413
20416
  {
20414
20417
  actions: {
20415
- setInitData: assign((context, event) => {
20416
- const { noBonus, userInfo } = context;
20418
+ setPromotionsList: assign((context, event) => {
20417
20419
  const promotionsList = JSON.parse(JSON.stringify(event.data));
20418
- if (userInfo.withdraw_rule.includes('FREE_LIMIT')) {
20420
+ const { noBonus, userInfo, siteConfig } = context;
20421
+ const { withdraw_rule, balance } = userInfo;
20422
+ const { currencyConversionLimit } = siteConfig;
20423
+ const balanceAvailable = parseFloat(`${balance}`) < parseFloat(`${currencyConversionLimit}`);
20424
+ const isFreeLimitRule = withdraw_rule.includes('FREE_LIMIT');
20425
+ const includesDefaultRule = withdraw_rule === 'DEFAULT' || withdraw_rule.includes('FREE_DEFAULT');
20426
+
20427
+ if (!balanceAvailable && includesDefaultRule) {
20428
+ promotionsList.map((item) => {
20429
+ item.attendEnable = !item.withdrawRule.includes('FREE_LIMIT');
20430
+ return item
20431
+ });
20432
+ } else if (!balanceAvailable && isFreeLimitRule) {
20419
20433
  promotionsList.map((item) => {
20420
20434
  item.attendEnable = false;
20421
20435
  return item
@@ -20459,7 +20473,7 @@ function promotions (request) {
20459
20473
  },
20460
20474
  },
20461
20475
  services: {
20462
- fetchInitData: async (context, event) => {
20476
+ fetchPromotionsList: async (context, event) => {
20463
20477
  return await request.send(payment.getPromotionsList())
20464
20478
  },
20465
20479
  fetchWithdrawRulePreview: async (context, event) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.24",
3
+ "version": "1.1.26",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -9,6 +9,7 @@ export default function (request) {
9
9
  context: {
10
10
  noBonus: {},
11
11
  userInfo: {},
12
+ siteConfig: {},
12
13
  withdrawRule: {},
13
14
  promotionsList: [],
14
15
  selectedPromo: {},
@@ -16,10 +17,10 @@ export default function (request) {
16
17
  states: {
17
18
  loading: {
18
19
  invoke: {
19
- src: 'fetchInitData',
20
+ src: 'fetchPromotionsList',
20
21
  onDone: {
21
22
  target: 'loaded',
22
- actions: 'setInitData',
23
+ actions: 'setPromotionsList',
23
24
  },
24
25
  onError: {
25
26
  target: 'fail',
@@ -79,10 +80,21 @@ export default function (request) {
79
80
  },
80
81
  {
81
82
  actions: {
82
- setInitData: assign((context, event) => {
83
- const { noBonus, userInfo } = context
83
+ setPromotionsList: assign((context, event) => {
84
84
  const promotionsList = JSON.parse(JSON.stringify(event.data))
85
- if (userInfo.withdraw_rule.includes('FREE_LIMIT')) {
85
+ const { noBonus, userInfo, siteConfig } = context
86
+ const { withdraw_rule, balance } = userInfo
87
+ const { currencyConversionLimit } = siteConfig
88
+ const balanceAvailable = parseFloat(`${balance}`) < parseFloat(`${currencyConversionLimit}`)
89
+ const isFreeLimitRule = withdraw_rule.includes('FREE_LIMIT')
90
+ const includesDefaultRule = withdraw_rule === 'DEFAULT' || withdraw_rule.includes('FREE_DEFAULT')
91
+
92
+ if (!balanceAvailable && includesDefaultRule) {
93
+ promotionsList.map((item) => {
94
+ item.attendEnable = !item.withdrawRule.includes('FREE_LIMIT')
95
+ return item
96
+ })
97
+ } else if (!balanceAvailable && isFreeLimitRule) {
86
98
  promotionsList.map((item) => {
87
99
  item.attendEnable = false
88
100
  return item
@@ -126,7 +138,7 @@ export default function (request) {
126
138
  },
127
139
  },
128
140
  services: {
129
- fetchInitData: async (context, event) => {
141
+ fetchPromotionsList: async (context, event) => {
130
142
  return await request.send(payment.getPromotionsList())
131
143
  },
132
144
  fetchWithdrawRulePreview: async (context, event) => {
@@ -159,7 +159,7 @@ export default function (request) {
159
159
  },
160
160
  fetchWithdrawRulePreview: async (context, event) => {
161
161
  const { receiveNo } = context
162
- const { data } = await request.send(payment.getWithdrawRulePreview({ applyType: 'activity', applyNo: receiveNo, amount: null }))
162
+ const data = await request.send(payment.getWithdrawRulePreview({ applyType: 'activity', applyNo: receiveNo, amount: null }))
163
163
  return data
164
164
  },
165
165
  receiveReward: async (context, event) => {
@@ -24,6 +24,7 @@ export default function (request) {
24
24
 
25
25
  maxWithdrawAmount: null,
26
26
  availableWithdrawAmount: null,
27
+ enableWithdraw: false,
27
28
 
28
29
  attachmentType: null, // null | 'withdraw' | 'pool'
29
30
 
@@ -352,6 +353,7 @@ export default function (request) {
352
353
  maximumWithdrawAmount: +maximumWithdrawAmount,
353
354
  enableWithdrawAmount: +enableWithdrawAmount,
354
355
  amount: +enableWithdrawAmount,
356
+ enableWithdraw,
355
357
  }
356
358
 
357
359
  // const rules = event.data.rules.filter((rule) => rule.maxWithdrawAmount > 0)
@@ -460,13 +462,12 @@ export default function (request) {
460
462
  return selectedNetwork && address && amount && charge
461
463
  },
462
464
  isConvertible: (context, event) => {
463
- const { balance, withdrawLimit } = context
464
- return balance > 0 && withdrawLimit === 0
465
+ const { enableWithdraw } = context
466
+ return enableWithdraw
465
467
  },
466
468
  isNotWithdrawable: (context, event) => {
467
- const { balance, withdrawLimit, paymentDetail } = context
468
- const minWithdrawAmount = paymentDetail[0]?.minimum || 0
469
- return withdrawLimit !== 0 || balance < minWithdrawAmount
469
+ const { enableWithdraw } = context
470
+ return !enableWithdraw
470
471
  },
471
472
  isCalculable: (context, event) => {
472
473
  const { selectedNetwork, amount } = context
@@ -26,6 +26,7 @@ export default function (request) {
26
26
  attachmentType: null, // null | 'withdraw' | 'pool'
27
27
  maximumWithdrawAmount: 0,
28
28
  enableWithdrawAmount: 0,
29
+ enableWithdraw: false,
29
30
 
30
31
  amount: null,
31
32
  bank: null,
@@ -337,6 +338,7 @@ export default function (request) {
337
338
  maximumWithdrawAmount: +maximumWithdrawAmount,
338
339
  enableWithdrawAmount: +enableWithdrawAmount,
339
340
  amount: +enableWithdrawAmount,
341
+ enableWithdraw,
340
342
  }
341
343
  }),
342
344
  setOtp: assign((context, event) => {
@@ -391,13 +393,12 @@ export default function (request) {
391
393
  return bank && amount > 0
392
394
  },
393
395
  isConvertible: (context, event) => {
394
- const { balance, withdrawLimit } = context
395
- return balance > 0 && withdrawLimit === 0
396
+ const { enableWithdraw } = context
397
+ return enableWithdraw
396
398
  },
397
399
  isNotWithdrawable: (context, event) => {
398
- const { balance, withdrawLimit, paymentDetail } = context
399
- const minWithdrawAmount = paymentDetail[0]?.minimum || 0
400
- return withdrawLimit !== 0 || balance < minWithdrawAmount
400
+ const { enableWithdraw } = context
401
+ return !enableWithdraw
401
402
  },
402
403
  isOtpRequired: (context, event) => {
403
404
  return event.data?.status === 'otp-verifying'