@jetthai/cuora 1.1.18 → 1.1.20

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.20](https://github.com/jetthai/cuora-module/compare/v1.1.19...v1.1.20) (2022-12-30)
6
+
7
+ ### [1.1.19](https://github.com/jetthai/cuora-module/compare/v1.1.18...v1.1.19) (2022-12-29)
8
+
5
9
  ### [1.1.18](https://github.com/jetthai/cuora-module/compare/v1.1.17...v1.1.18) (2022-12-28)
6
10
 
7
11
  ### [1.1.17](https://github.com/jetthai/cuora-module/compare/v1.1.16...v1.1.17) (2022-12-28)
package/dist/bundle.mjs CHANGED
@@ -14806,7 +14806,7 @@ function withdraw_vn (request) {
14806
14806
  src: 'fetchInitData',
14807
14807
  onDone: {
14808
14808
  target: 'mode',
14809
- actions: ['setInitData', 'preset'],
14809
+ actions: ['setInitData', 'preset', 'updateWithdrawCondition'],
14810
14810
  },
14811
14811
  onError: {
14812
14812
  target: 'fail',
@@ -14817,20 +14817,20 @@ function withdraw_vn (request) {
14817
14817
  always: [{ target: 'free', cond: 'isFree' }, { target: 'cash' }],
14818
14818
  },
14819
14819
  free: {
14820
- initial: 'loading',
14820
+ initial: 'checking',
14821
14821
  states: {
14822
- loading: {
14823
- invoke: {
14824
- src: 'fetchWithdrawRules',
14825
- onDone: {
14826
- target: 'checking',
14827
- actions: 'updateWithdrawCondition',
14828
- },
14829
- onError: {
14830
- target: 'notConvertible',
14831
- },
14832
- },
14833
- },
14822
+ // loading: {
14823
+ // invoke: {
14824
+ // src: 'fetchWithdrawRules',
14825
+ // onDone: {
14826
+ // target: 'checking',
14827
+ // actions: 'updateWithdrawCondition',
14828
+ // },
14829
+ // onError: {
14830
+ // target: 'notConvertible',
14831
+ // },
14832
+ // },
14833
+ // },
14834
14834
  checking: {
14835
14835
  always: [{ target: 'convertible', cond: 'isConvertible' }, { target: 'notConvertible' }],
14836
14836
  },
@@ -14857,41 +14857,10 @@ function withdraw_vn (request) {
14857
14857
  on: {
14858
14858
  SUBMIT: {
14859
14859
  target: 'converting',
14860
- },
14861
- ATTACH: {
14862
- target: 'attachment',
14863
14860
  actions: 'setAttachmentType',
14864
14861
  },
14865
14862
  },
14866
14863
  },
14867
- attachment: {
14868
- on: {
14869
- SET_ATTACHMENT_TYPE: {
14870
- actions: 'setAttachmentType',
14871
- },
14872
- SET_CURRENT_BANK: {
14873
- actions: assign((context, event) => {
14874
- return {
14875
- bank: event.data,
14876
- }
14877
- }),
14878
- },
14879
- SET_AMOUNT: {
14880
- actions: assign((context, event) => {
14881
- return {
14882
- amount: event.data,
14883
- }
14884
- }),
14885
- },
14886
- SUBMIT: {
14887
- target: 'converting',
14888
- cond: (context, event) => {
14889
- const { enableWithdrawAmount, amount } = context;
14890
- return +enableWithdrawAmount >= +amount
14891
- },
14892
- },
14893
- },
14894
- },
14895
14864
  converting: {
14896
14865
  invoke: {
14897
14866
  src: 'convertFreeCredit',
@@ -14909,21 +14878,8 @@ function withdraw_vn (request) {
14909
14878
  },
14910
14879
  },
14911
14880
  converted: {
14912
- always: [
14913
- { target: '#withdraw_vn.cash.submitting', cond: 'shouldGoToWithdraw' },
14914
- { target: 'pooling', cond: 'shouldGoToPool' },
14915
- ],
14881
+ always: [{ target: '#withdraw_vn.cash.withdrawable', cond: 'hasAttachmentType' }],
14916
14882
  },
14917
- pooling: {
14918
- invoke: {
14919
- src: 'pool',
14920
- onDone: { target: 'pooled' },
14921
- onError: {
14922
- target: 'pooled',
14923
- },
14924
- },
14925
- },
14926
- pooled: {},
14927
14883
  },
14928
14884
  },
14929
14885
  cash: {
@@ -14958,10 +14914,23 @@ function withdraw_vn (request) {
14958
14914
  }
14959
14915
  }),
14960
14916
  },
14961
- SUBMIT: {
14962
- target: 'submitting',
14963
- cond: 'isSubmittable',
14917
+ SET_ATTACHMENT_TYPE: {
14918
+ actions: 'setAttachmentType',
14919
+ cond: 'isNewWalletMode',
14964
14920
  },
14921
+ SUBMIT: [
14922
+ {
14923
+ target: 'pooling',
14924
+ cond: (context, event) => {
14925
+ const { amount, attachmentType } = context;
14926
+ return attachmentType === 'pool' && amount > 0
14927
+ },
14928
+ },
14929
+ {
14930
+ target: 'submitting',
14931
+ cond: 'isSubmittable',
14932
+ },
14933
+ ],
14965
14934
  },
14966
14935
  },
14967
14936
  submitting: {
@@ -14998,6 +14967,16 @@ function withdraw_vn (request) {
14998
14967
  },
14999
14968
  },
15000
14969
  },
14970
+ pooling: {
14971
+ invoke: {
14972
+ src: 'pool',
14973
+ onDone: { target: 'pooled' },
14974
+ onError: {
14975
+ target: 'withdrawable',
14976
+ },
14977
+ },
14978
+ },
14979
+ pooled: {},
15001
14980
  },
15002
14981
  },
15003
14982
  otp: {
@@ -15103,17 +15082,18 @@ function withdraw_vn (request) {
15103
15082
  balance,
15104
15083
  siteConfig,
15105
15084
  userInfo,
15085
+ attachmentType: siteConfig.walletMode > 0 ? 'withdraw' : null,
15106
15086
  }
15107
15087
  }),
15108
15088
  updateWithdrawCondition: assign((context, event) => {
15109
15089
  const { differAmountLimit, enableWithdraw, enableWithdrawAmount, maxWithdrawStatus, maximumWithdrawAmount, minimumWithdrawAmount } =
15110
- event.data;
15090
+ event.data?.withdrawRule;
15111
15091
 
15112
15092
  return {
15113
15093
  // maxWithdrawAmount: maximumWithdrawAmount,
15114
15094
  // availableWithdrawAmount: enableWithdrawAmount,
15115
- maximumWithdrawAmount,
15116
- enableWithdrawAmount,
15095
+ maximumWithdrawAmount: +maximumWithdrawAmount,
15096
+ enableWithdrawAmount: +enableWithdrawAmount,
15117
15097
  amount: +enableWithdrawAmount,
15118
15098
  }
15119
15099
  }),
@@ -15150,11 +15130,8 @@ function withdraw_vn (request) {
15150
15130
  isFree: (context, event) => {
15151
15131
  return context.userInfo?.withdraw_rule !== 'DEFAULT'
15152
15132
  },
15153
- shouldGoToWithdraw: (context, event) => {
15154
- return context.attachmentType === 'withdraw'
15155
- },
15156
- shouldGoToPool: (context, event) => {
15157
- return context.attachmentType === 'pool'
15133
+ hasAttachmentType: (context, event) => {
15134
+ return ['withdraw', 'pool'].includes(context.attachmentType)
15158
15135
  },
15159
15136
  haveProcessing: (context, event) => {
15160
15137
  return (context.paymentDetail?.[0]?.processing || []).length > 0
@@ -15169,7 +15146,7 @@ function withdraw_vn (request) {
15169
15146
  },
15170
15147
  isSubmittable: (context, event) => {
15171
15148
  const { bank, amount } = context;
15172
- return bank && amount
15149
+ return bank && amount > 0
15173
15150
  },
15174
15151
  isConvertible: (context, event) => {
15175
15152
  const { balance, withdrawLimit } = context;
@@ -15183,14 +15160,16 @@ function withdraw_vn (request) {
15183
15160
  isOtpRequired: (context, event) => {
15184
15161
  return event.data?.status === 'otp-verifying'
15185
15162
  },
15163
+ isNewWalletMode: (context, event) => context.siteConfig.walletMode > 0,
15186
15164
  },
15187
15165
  services: {
15188
15166
  fetchInitData: async (context, event) => {
15189
- const [{ config }, userInfo, paymentDetail = [], { bonus, bankInfo }] = await Promise.all([
15167
+ const [{ config }, userInfo, paymentDetail = [], { bonus, bankInfo }, withdrawRule] = await Promise.all([
15190
15168
  request.send(common$1.getConfig({ appSecret })),
15191
15169
  request.send(user.getUserInfo()),
15192
15170
  request.send(payment.getPaymentDetail({ transferType: 'WITHDRAW' })),
15193
15171
  request.send(payment.getPaymentInfo()),
15172
+ request.send(payment.getCurrentWithdrawRule()),
15194
15173
  ]);
15195
15174
  const siteConfig = JSON.parse(window.atob(config));
15196
15175
  const method = paymentDetail.find((payment) => payment.category === 'manual').method;
@@ -15198,7 +15177,7 @@ function withdraw_vn (request) {
15198
15177
  const newBankInfo = bankInfo.map((item) => {
15199
15178
  return { ...item, ...bankList.find((bank) => bank.bankCode === item.bankCode) }
15200
15179
  });
15201
- return { siteConfig, userInfo, paymentDetail, bonus, bankInfo: newBankInfo, bankList }
15180
+ return { siteConfig, userInfo, paymentDetail, bonus, bankInfo: newBankInfo, bankList, withdrawRule }
15202
15181
  },
15203
15182
  fetchPaymentData: async (context, event) => {
15204
15183
  const paymentDetail = await request.send(payment.getPaymentDetail({ transferType: 'WITHDRAW' }));
@@ -20270,7 +20249,14 @@ function promotions (request) {
20270
20249
  minimumAmount: 0,
20271
20250
  turnoverLimitMultiple: 1,
20272
20251
  promotionDetail: [],
20273
- withdrawLimitDetail: [],
20252
+ withdrawLimitDetail: [
20253
+ {
20254
+ greaterEqualThen: 0,
20255
+ lessEqualThen: -1,
20256
+ maxWithdrawAmount: -1,
20257
+ turnoverLimitMultiple: 1,
20258
+ },
20259
+ ],
20274
20260
  limitGameDetail: [],
20275
20261
  },
20276
20262
  turnoverLimitStatus: '',
@@ -20350,10 +20336,9 @@ function promotions (request) {
20350
20336
  {
20351
20337
  actions: {
20352
20338
  setInitData: assign((context, event) => {
20353
- const { promotionsList } = event.data;
20354
20339
  const { noBonus } = context;
20355
20340
  return {
20356
- promotionsList,
20341
+ promotionsList: event.data,
20357
20342
  selectedPromo: noBonus,
20358
20343
  }
20359
20344
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.18",
3
+ "version": "1.1.20",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -20,7 +20,14 @@ export default function (request) {
20
20
  minimumAmount: 0,
21
21
  turnoverLimitMultiple: 1,
22
22
  promotionDetail: [],
23
- withdrawLimitDetail: [],
23
+ withdrawLimitDetail: [
24
+ {
25
+ greaterEqualThen: 0,
26
+ lessEqualThen: -1,
27
+ maxWithdrawAmount: -1,
28
+ turnoverLimitMultiple: 1,
29
+ },
30
+ ],
24
31
  limitGameDetail: [],
25
32
  },
26
33
  turnoverLimitStatus: '',
@@ -100,10 +107,9 @@ export default function (request) {
100
107
  {
101
108
  actions: {
102
109
  setInitData: assign((context, event) => {
103
- const { promotionsList } = event.data
104
110
  const { noBonus } = context
105
111
  return {
106
- promotionsList,
112
+ promotionsList: event.data,
107
113
  selectedPromo: noBonus,
108
114
  }
109
115
  }),
@@ -48,7 +48,7 @@ export default function (request) {
48
48
  src: 'fetchInitData',
49
49
  onDone: {
50
50
  target: 'mode',
51
- actions: ['setInitData', 'preset'],
51
+ actions: ['setInitData', 'preset', 'updateWithdrawCondition'],
52
52
  },
53
53
  onError: {
54
54
  target: 'fail',
@@ -59,20 +59,20 @@ export default function (request) {
59
59
  always: [{ target: 'free', cond: 'isFree' }, { target: 'cash' }],
60
60
  },
61
61
  free: {
62
- initial: 'loading',
62
+ initial: 'checking',
63
63
  states: {
64
- loading: {
65
- invoke: {
66
- src: 'fetchWithdrawRules',
67
- onDone: {
68
- target: 'checking',
69
- actions: 'updateWithdrawCondition',
70
- },
71
- onError: {
72
- target: 'notConvertible',
73
- },
74
- },
75
- },
64
+ // loading: {
65
+ // invoke: {
66
+ // src: 'fetchWithdrawRules',
67
+ // onDone: {
68
+ // target: 'checking',
69
+ // actions: 'updateWithdrawCondition',
70
+ // },
71
+ // onError: {
72
+ // target: 'notConvertible',
73
+ // },
74
+ // },
75
+ // },
76
76
  checking: {
77
77
  always: [{ target: 'convertible', cond: 'isConvertible' }, { target: 'notConvertible' }],
78
78
  },
@@ -99,39 +99,8 @@ export default function (request) {
99
99
  on: {
100
100
  SUBMIT: {
101
101
  target: 'converting',
102
- },
103
- ATTACH: {
104
- target: 'attachment',
105
- actions: 'setAttachmentType',
106
- },
107
- },
108
- },
109
- attachment: {
110
- on: {
111
- SET_ATTACHMENT_TYPE: {
112
102
  actions: 'setAttachmentType',
113
103
  },
114
- SET_CURRENT_BANK: {
115
- actions: assign((context, event) => {
116
- return {
117
- bank: event.data,
118
- }
119
- }),
120
- },
121
- SET_AMOUNT: {
122
- actions: assign((context, event) => {
123
- return {
124
- amount: event.data,
125
- }
126
- }),
127
- },
128
- SUBMIT: {
129
- target: 'converting',
130
- cond: (context, event) => {
131
- const { enableWithdrawAmount, amount } = context
132
- return +enableWithdrawAmount >= +amount
133
- },
134
- },
135
104
  },
136
105
  },
137
106
  converting: {
@@ -151,21 +120,8 @@ export default function (request) {
151
120
  },
152
121
  },
153
122
  converted: {
154
- always: [
155
- { target: '#withdraw_vn.cash.submitting', cond: 'shouldGoToWithdraw' },
156
- { target: 'pooling', cond: 'shouldGoToPool' },
157
- ],
158
- },
159
- pooling: {
160
- invoke: {
161
- src: 'pool',
162
- onDone: { target: 'pooled' },
163
- onError: {
164
- target: 'pooled',
165
- },
166
- },
123
+ always: [{ target: '#withdraw_vn.cash.withdrawable', cond: 'hasAttachmentType' }],
167
124
  },
168
- pooled: {},
169
125
  },
170
126
  },
171
127
  cash: {
@@ -200,10 +156,23 @@ export default function (request) {
200
156
  }
201
157
  }),
202
158
  },
203
- SUBMIT: {
204
- target: 'submitting',
205
- cond: 'isSubmittable',
159
+ SET_ATTACHMENT_TYPE: {
160
+ actions: 'setAttachmentType',
161
+ cond: 'isNewWalletMode',
206
162
  },
163
+ SUBMIT: [
164
+ {
165
+ target: 'pooling',
166
+ cond: (context, event) => {
167
+ const { amount, attachmentType } = context
168
+ return attachmentType === 'pool' && amount > 0
169
+ },
170
+ },
171
+ {
172
+ target: 'submitting',
173
+ cond: 'isSubmittable',
174
+ },
175
+ ],
207
176
  },
208
177
  },
209
178
  submitting: {
@@ -240,6 +209,16 @@ export default function (request) {
240
209
  },
241
210
  },
242
211
  },
212
+ pooling: {
213
+ invoke: {
214
+ src: 'pool',
215
+ onDone: { target: 'pooled' },
216
+ onError: {
217
+ target: 'withdrawable',
218
+ },
219
+ },
220
+ },
221
+ pooled: {},
243
222
  },
244
223
  },
245
224
  otp: {
@@ -345,17 +324,18 @@ export default function (request) {
345
324
  balance,
346
325
  siteConfig,
347
326
  userInfo,
327
+ attachmentType: siteConfig.walletMode > 0 ? 'withdraw' : null,
348
328
  }
349
329
  }),
350
330
  updateWithdrawCondition: assign((context, event) => {
351
331
  const { differAmountLimit, enableWithdraw, enableWithdrawAmount, maxWithdrawStatus, maximumWithdrawAmount, minimumWithdrawAmount } =
352
- event.data
332
+ event.data?.withdrawRule
353
333
 
354
334
  return {
355
335
  // maxWithdrawAmount: maximumWithdrawAmount,
356
336
  // availableWithdrawAmount: enableWithdrawAmount,
357
- maximumWithdrawAmount,
358
- enableWithdrawAmount,
337
+ maximumWithdrawAmount: +maximumWithdrawAmount,
338
+ enableWithdrawAmount: +enableWithdrawAmount,
359
339
  amount: +enableWithdrawAmount,
360
340
  }
361
341
  }),
@@ -392,11 +372,8 @@ export default function (request) {
392
372
  isFree: (context, event) => {
393
373
  return context.userInfo?.withdraw_rule !== 'DEFAULT'
394
374
  },
395
- shouldGoToWithdraw: (context, event) => {
396
- return context.attachmentType === 'withdraw'
397
- },
398
- shouldGoToPool: (context, event) => {
399
- return context.attachmentType === 'pool'
375
+ hasAttachmentType: (context, event) => {
376
+ return ['withdraw', 'pool'].includes(context.attachmentType)
400
377
  },
401
378
  haveProcessing: (context, event) => {
402
379
  return (context.paymentDetail?.[0]?.processing || []).length > 0
@@ -411,7 +388,7 @@ export default function (request) {
411
388
  },
412
389
  isSubmittable: (context, event) => {
413
390
  const { bank, amount } = context
414
- return bank && amount
391
+ return bank && amount > 0
415
392
  },
416
393
  isConvertible: (context, event) => {
417
394
  const { balance, withdrawLimit } = context
@@ -425,14 +402,16 @@ export default function (request) {
425
402
  isOtpRequired: (context, event) => {
426
403
  return event.data?.status === 'otp-verifying'
427
404
  },
405
+ isNewWalletMode: (context, event) => context.siteConfig.walletMode > 0,
428
406
  },
429
407
  services: {
430
408
  fetchInitData: async (context, event) => {
431
- const [{ config }, userInfo, paymentDetail = [], { bonus, bankInfo }] = await Promise.all([
409
+ const [{ config }, userInfo, paymentDetail = [], { bonus, bankInfo }, withdrawRule] = await Promise.all([
432
410
  request.send(common.getConfig({ appSecret })),
433
411
  request.send(user.getUserInfo()),
434
412
  request.send(payment.getPaymentDetail({ transferType: 'WITHDRAW' })),
435
413
  request.send(payment.getPaymentInfo()),
414
+ request.send(payment.getCurrentWithdrawRule()),
436
415
  ])
437
416
  const siteConfig = JSON.parse(window.atob(config))
438
417
  const method = paymentDetail.find((payment) => payment.category === 'manual').method
@@ -440,7 +419,7 @@ export default function (request) {
440
419
  const newBankInfo = bankInfo.map((item) => {
441
420
  return { ...item, ...bankList.find((bank) => bank.bankCode === item.bankCode) }
442
421
  })
443
- return { siteConfig, userInfo, paymentDetail, bonus, bankInfo: newBankInfo, bankList }
422
+ return { siteConfig, userInfo, paymentDetail, bonus, bankInfo: newBankInfo, bankList, withdrawRule }
444
423
  },
445
424
  fetchPaymentData: async (context, event) => {
446
425
  const paymentDetail = await request.send(payment.getPaymentDetail({ transferType: 'WITHDRAW' }))