@jetthai/cuora 1.0.302-sl-2 → 1.1.0

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.
Files changed (110) hide show
  1. package/CHANGELOG.md +3 -848
  2. package/README.md +0 -6
  3. package/dist/bundle.mjs +18461 -0
  4. package/package.json +9 -6
  5. package/rollup.config.js +16 -0
  6. package/src/api/activity.js +2 -43
  7. package/src/api/auth.js +7 -22
  8. package/src/api/common.js +1 -3
  9. package/src/api/game.js +7 -20
  10. package/src/api/mailbox.js +5 -9
  11. package/src/api/payment.js +19 -167
  12. package/src/api/user.js +0 -7
  13. package/src/machine/activity/activity.js +26 -111
  14. package/src/machine/activity/{friend_invite_friends_activity.js → affiliate_invite_friends_activity.js} +41 -70
  15. package/src/machine/activity/continue_deposit_activity.js +2 -11
  16. package/src/machine/activity/deposit_activity.js +4 -13
  17. package/src/machine/activity/diamond_shop_activity_vn.js +89 -54
  18. package/src/machine/activity/fafafa_activity.js +19 -34
  19. package/src/machine/activity/index.js +4 -22
  20. package/src/machine/activity/invite_friends_activity.js +14 -14
  21. package/src/machine/activity/ranking_activity.js +2 -11
  22. package/src/machine/activity/sign_in_activity.js +14 -21
  23. package/src/machine/activity/specify_bets_activity.js +3 -25
  24. package/src/machine/activity/specify_turnover_activity.js +3 -25
  25. package/src/machine/activity/time_bomb_activity.js +2 -11
  26. package/src/machine/auth.js +21 -134
  27. package/src/machine/auth_otp.js +201 -0
  28. package/src/machine/auth_otp_v2.js +4 -10
  29. package/src/machine/auth_otp_v3.js +3 -11
  30. package/src/machine/bank_binding.js +12 -112
  31. package/src/machine/common.js +25 -113
  32. package/src/machine/deposit/crypto.js +29 -50
  33. package/src/machine/deposit/crypto_button.js +39 -174
  34. package/src/machine/deposit/deposit_fc.js +5 -8
  35. package/src/machine/deposit/direct.js +16 -111
  36. package/src/machine/deposit/index.js +2 -43
  37. package/src/machine/deposit/loadcard_vn.js +43 -191
  38. package/src/machine/deposit/manual_vn.js +60 -182
  39. package/src/machine/deposit/qrcode_v2.js +52 -285
  40. package/src/machine/deposit/qrcode_vn.js +206 -0
  41. package/src/machine/game.js +285 -0
  42. package/src/machine/game_favorite.js +123 -0
  43. package/src/machine/game_favorite_v2.js +28 -74
  44. package/src/machine/game_search.js +244 -0
  45. package/src/machine/game_search_v2.js +24 -64
  46. package/src/machine/game_v2.js +356 -0
  47. package/src/machine/inbox.js +34 -259
  48. package/src/machine/index.js +17 -24
  49. package/src/machine/leaderboard.js +8 -31
  50. package/src/machine/reward.js +7 -74
  51. package/src/machine/setting.js +2 -5
  52. package/src/machine/side_v2.js +28 -33
  53. package/src/machine/user_sign_up.js +17 -117
  54. package/src/machine/{withdraw/withdraw_crypto.js → withdraw_crypto.js} +69 -220
  55. package/src/machine/{withdraw/withdraw_fc.js → withdraw_fc.js} +2 -2
  56. package/src/machine/{withdraw/withdraw_amb.js → withdraw_vn.js} +78 -146
  57. package/src/request/request.js +5 -10
  58. package/src/util/constant.js +1 -19
  59. package/src/util/deviceToken.js +8 -18
  60. package/src/util/index.js +1 -2
  61. package/src/util/storage.js +22 -22
  62. package/.husky/pre-commit +0 -4
  63. package/.prettierignore +0 -1
  64. package/src/lib/fingerprint.js +0 -9779
  65. package/src/machine/activity/activity_cash.js +0 -159
  66. package/src/machine/activity/cash_rain_activity.js +0 -153
  67. package/src/machine/activity/diamond_shop_activity_cash.js +0 -179
  68. package/src/machine/activity/instant_rebate_activity.js +0 -217
  69. package/src/machine/activity/jackpot.js +0 -74
  70. package/src/machine/activity/otp_verified_activity.js +0 -74
  71. package/src/machine/activity/roulette_activity_v2.js +0 -90
  72. package/src/machine/activity/sign_in_monthly_activity.js +0 -65
  73. package/src/machine/activity/vip_card_activity.js +0 -140
  74. package/src/machine/bank_binding_amb.js +0 -145
  75. package/src/machine/deposit/amb.js +0 -92
  76. package/src/machine/deposit/crypto_bank.js +0 -317
  77. package/src/machine/deposit/crypto_bank_cash.js +0 -287
  78. package/src/machine/deposit/crypto_cash.js +0 -255
  79. package/src/machine/deposit/crypto_qrcode.js +0 -148
  80. package/src/machine/deposit/crypto_qrcode_cash.js +0 -131
  81. package/src/machine/deposit/crypto_way.js +0 -239
  82. package/src/machine/deposit/crypto_way_cash.js +0 -256
  83. package/src/machine/deposit/direct_cash.js +0 -217
  84. package/src/machine/deposit/float.js +0 -366
  85. package/src/machine/deposit/krway.js +0 -151
  86. package/src/machine/deposit/loadcard_cash.js +0 -207
  87. package/src/machine/deposit/manual_cash.js +0 -356
  88. package/src/machine/deposit/qrcode_cash.js +0 -217
  89. package/src/machine/deposit/usdt.js +0 -144
  90. package/src/machine/deposit/usdt_cash.js +0 -138
  91. package/src/machine/deposit/vpay.js +0 -359
  92. package/src/machine/game_info.js +0 -57
  93. package/src/machine/game_search_cash.js +0 -390
  94. package/src/machine/game_v2_1.js +0 -662
  95. package/src/machine/honor_board_cash.js +0 -63
  96. package/src/machine/navbar.js +0 -57
  97. package/src/machine/promotions.js +0 -171
  98. package/src/machine/reward_cash.js +0 -219
  99. package/src/machine/roulette_v2.js +0 -276
  100. package/src/machine/side_cash.js +0 -110
  101. package/src/machine/user_photo.js +0 -65
  102. package/src/machine/withdraw/index.js +0 -23
  103. package/src/machine/withdraw/withdraw_crypto2.js +0 -540
  104. package/src/machine/withdraw/withdraw_crypto_cash.js +0 -319
  105. package/src/machine/withdraw/withdraw_krway.js +0 -207
  106. package/src/machine/withdraw/withdraw_manual.js +0 -595
  107. package/src/machine/withdraw/withdraw_manual_cash.js +0 -303
  108. package/src/machine/withdraw/withdraw_vn.js +0 -533
  109. package/src/machine/withdraw/withdraw_vn2.js +0 -548
  110. package/src/util/math.js +0 -4
@@ -1,319 +0,0 @@
1
- import { assign, createMachine } from 'xstate'
2
- import payment from '../../api/payment.js'
3
- import user from '../../api/user.js'
4
- import api from '../../api/payment.js'
5
-
6
- export default function (request, context) {
7
- const { paymentDetail = [] } = context || {}
8
- return createMachine(
9
- {
10
- id: 'withdraw_crypto_cash',
11
- initial: 'loading',
12
- context: {
13
- paymentDetail,
14
- withdrawRule: null,
15
- selectedCrypto: null,
16
- networks: [],
17
- selectedNetwork: null,
18
- address: '',
19
- selectedAmount: null,
20
- calculation: null,
21
- processing: null,
22
-
23
- // otp
24
- requestId: null,
25
- status: null,
26
- target: null,
27
- ttl: null,
28
- },
29
- states: {
30
- loading: {
31
- invoke: {
32
- src: 'fetchInitData',
33
- onDone: {
34
- target: 'checking',
35
- actions: 'setInitData',
36
- },
37
- onError: {
38
- target: 'loaded',
39
- },
40
- },
41
- },
42
- checking: {
43
- always: [{ target: 'submitted', cond: 'isProcessing' }, { target: 'loaded' }],
44
- },
45
- loaded: {},
46
- debouncing: {
47
- after: {
48
- 1000: [
49
- {
50
- target: 'calculating',
51
- cond: 'isCalculable',
52
- },
53
- { target: 'loaded' },
54
- ],
55
- },
56
- },
57
- calculating: {
58
- entry: 'resetCharge',
59
- invoke: {
60
- src: 'fetchCalculation',
61
- onDone: {
62
- target: 'calculated',
63
- actions: 'setCalculation',
64
- },
65
- onError: {
66
- target: 'calculated',
67
- },
68
- },
69
- },
70
- calculated: {
71
- on: {
72
- SUBMIT: [
73
- {
74
- target: 'submitting',
75
- },
76
- ],
77
- },
78
- },
79
- submitting: {
80
- invoke: {
81
- src: 'submitWithdraw',
82
- onDone: [
83
- {
84
- target: 'otp',
85
- actions: 'setOtp',
86
- cond: 'isOtpRequired',
87
- },
88
- {
89
- target: 'submitted',
90
- actions: 'setProcessing',
91
- },
92
- ],
93
- onError: {
94
- target: 'loaded',
95
- },
96
- },
97
- },
98
- submitted: {},
99
- otp: {
100
- type: 'parallel',
101
- states: {
102
- countdown: {
103
- after: {
104
- 1000: {
105
- target: 'countdown',
106
- actions: 'decreaseTtl',
107
- cond: (context) => context.ttl > 0,
108
- },
109
- },
110
- },
111
- verification: {
112
- initial: 'idle',
113
- states: {
114
- idle: {
115
- on: {
116
- ACKNOWLEDGE: {
117
- target: 'acknowledging',
118
- },
119
- RESET_OTP: {
120
- target: 'reset',
121
- },
122
- },
123
- },
124
- acknowledging: {
125
- invoke: {
126
- src: 'acknowledge',
127
- onDone: [
128
- {
129
- target: '#withdraw_crypto_cash.submitted',
130
- },
131
- ],
132
- onError: {
133
- target: 'idle',
134
- },
135
- },
136
- },
137
- reset: {
138
- invoke: {
139
- src: 'resetOtp',
140
- onDone: {
141
- target: 'idle',
142
- actions: 'setVerificationData',
143
- },
144
- onError: { target: 'idle' },
145
- },
146
- },
147
- },
148
- },
149
- },
150
- },
151
- },
152
- on: {
153
- SET_NETWORK: {
154
- target: 'debouncing',
155
- actions: 'setNetwork',
156
- internal: false,
157
- },
158
- SET_ADDRESS: {
159
- actions: 'setAddress',
160
- internal: false,
161
- },
162
- SET_AMOUNT: {
163
- target: 'debouncing',
164
- actions: 'setAmount',
165
- internal: false,
166
- },
167
- },
168
- },
169
- {
170
- actions: {
171
- setInitData: assign((context, event) => {
172
- const { withdrawRule, processing } = event.data
173
- const { paymentDetail } = context
174
- const selectedCrypto = paymentDetail.find((item) => item.transferType === 'withdraw' && item.category === 'crypto')
175
- const networks = (selectedCrypto?.networkName || []).map((value, i) => {
176
- return {
177
- label: selectedCrypto.networkOptional?.[i],
178
- value,
179
- icon: value,
180
- }
181
- })
182
-
183
- return {
184
- withdrawRule,
185
- selectedCrypto,
186
- networks,
187
- selectedNetwork: networks[0],
188
- processing,
189
- }
190
- }),
191
- setNetwork: assign((context, event) => {
192
- return {
193
- selectedNetwork: event.data,
194
- }
195
- }),
196
- setAddress: assign((context, event) => {
197
- return {
198
- address: event.data,
199
- }
200
- }),
201
- setAmount: assign((context, event) => {
202
- return {
203
- selectedAmount: event.data,
204
- }
205
- }),
206
- setCalculation: assign((context, event) => {
207
- return {
208
- calculation: event.data,
209
- }
210
- }),
211
- resetCharge: assign((context, event) => {
212
- return {
213
- charge: null,
214
- }
215
- }),
216
- setTransaction: assign((context, event) => {
217
- const { realAmount } = event.data
218
- return {
219
- realAmount,
220
- }
221
- }),
222
- setOtp: assign((context, event) => {
223
- const { requestId, status, target, ttl } = event.data
224
- return {
225
- requestId,
226
- status,
227
- target,
228
- ttl,
229
- }
230
- }),
231
- decreaseTtl: assign((context, evnet) => {
232
- const second = context.ttl
233
- return {
234
- ttl: Math.max(second - 1, 0),
235
- }
236
- }),
237
- setVerificationData: assign((context, event) => {
238
- const { requestId, ttl, target } = event.data
239
- return {
240
- requestId,
241
- ttl,
242
- target,
243
- }
244
- }),
245
- setAttachmentType: assign((context, event) => {
246
- return {
247
- attachmentType: event.data,
248
- }
249
- }),
250
- setProcessing: assign((context, event) => {
251
- return {
252
- processing: event.data,
253
- }
254
- }),
255
- },
256
- guards: {
257
- isProcessing: (context, event) => {
258
- return context.processing
259
- },
260
- isCalculable: (context, event) => {
261
- const { withdrawRule, selectedCrypto, selectedNetwork, selectedAmount } = context
262
- const maximum = Math.min(withdrawRule.balance, selectedCrypto.maximum)
263
- return selectedNetwork && selectedAmount && selectedCrypto.minimum <= selectedAmount && selectedAmount <= maximum
264
- },
265
- isOtpRequired: (context, event) => {
266
- return event.data?.status === 'otp-verifying'
267
- },
268
- },
269
- services: {
270
- fetchInitData: async (context, event) => {
271
- const [withdrawRule, orders] = await Promise.all([
272
- request.send(payment.getDoubleWalletWithdrawRule({ walletType: 'CASH' })),
273
- request.send(payment.getPendingOrder({ transferType: 'WITHDRAW' })),
274
- ])
275
-
276
- return {
277
- withdrawRule,
278
- processing: orders[0],
279
- }
280
- },
281
- fetchWithdrawRule: async (context, event) => {
282
- return await request.send(payment.getDoubleWalletWithdrawRule({ walletType: 'CASH' }))
283
- },
284
- submitWithdraw: async (context, event) => {
285
- const { selectedCrypto, selectedNetwork, address, selectedAmount } = context
286
- return await request.send(
287
- api.submitWithdrawTransactionCrypto({
288
- method: selectedCrypto.method,
289
- amount: selectedAmount,
290
- cryptoCurrency: selectedCrypto.channel,
291
- cryptoNetwork: selectedNetwork.value,
292
- targetAddress: address,
293
- })
294
- )
295
- },
296
- fetchCalculation: async (context, event) => {
297
- const { selectedCrypto, selectedNetwork, selectedAmount } = context
298
- const method = selectedCrypto.method
299
- return await request.send(
300
- api.getWithdrawExpectedResult({
301
- method,
302
- amount: selectedAmount,
303
- cryptoNetwork: selectedNetwork.value,
304
- })
305
- )
306
- },
307
- resetOtp: async (context, event) => {
308
- const { requestId, target } = context
309
- return await request.send(user.otpReset({ requestId, target }))
310
- },
311
- acknowledge: async (context, event) => {
312
- const { requestId, target } = context
313
- const code = event.data
314
- return await request.send(user.otpAcknowledge({ requestId, target, code }))
315
- },
316
- },
317
- }
318
- )
319
- }
@@ -1,207 +0,0 @@
1
- import { assign, createMachine } from 'xstate'
2
- import findLastIndex from 'lodash/findLastIndex.js'
3
- import payment from '../../api/payment.js'
4
- import user from '../../api/user.js'
5
-
6
- export default function (request) {
7
- const { appSecret } = request.config
8
- return createMachine(
9
- {
10
- id: 'withdraw_krway',
11
- initial: 'loading',
12
- context: {
13
- userInfo: {},
14
- paymentDetail: {},
15
- minimum: 0,
16
- maximum: 0,
17
- options: [],
18
- amount: 0,
19
- bankInfo: [],
20
- bank: null,
21
- enableWithdraw: false,
22
- applyId: '',
23
- balance: 0,
24
- realAmount: 0,
25
- charge: 0,
26
- withdrawCheck: null,
27
- },
28
- states: {
29
- loading: {
30
- invoke: {
31
- src: 'fetchPaymentDetail',
32
- onDone: {
33
- target: 'fetching',
34
- actions: 'setPaymentData',
35
- },
36
- onError: {
37
- target: 'fail',
38
- },
39
- },
40
- },
41
- fetching: {
42
- invoke: {
43
- src: 'fetchWithdrawRules',
44
- onDone: {
45
- target: 'checking',
46
- actions: 'updateWithdrawCondition',
47
- },
48
- onError: {
49
- target: 'fail',
50
- },
51
- },
52
- },
53
- checking: {
54
- always: [{ target: 'inProcessing', cond: 'haveProcessing' }, { target: 'withdrawCheck' }],
55
- },
56
- withdrawCheck: {
57
- invoke: {
58
- src: 'withdrawCheck',
59
- onDone: [
60
- {
61
- target: 'notWithdrawMinDepositAmount',
62
- cond: 'isNotWithdrawMinDepositAmount',
63
- actions: assign((context, event) => {
64
- return {
65
- withdrawCheck: event.data,
66
- }
67
- }),
68
- },
69
- {
70
- target: 'notWithdrawable',
71
- cond: 'isNotWithdrawable',
72
- },
73
- {
74
- target: 'withdrawable',
75
- },
76
- ],
77
- onError: {
78
- target: '#withdraw_krway.fail',
79
- },
80
- },
81
- },
82
- notWithdrawMinDepositAmount: {},
83
- inProcessing: {},
84
- notWithdrawable: {},
85
- withdrawable: {
86
- on: {
87
- ADD_AMOUNT: {
88
- actions: 'addAmount',
89
- },
90
- SET_AMOUNT: {
91
- actions: 'setAmount',
92
- },
93
- CLEAR_AMOUNT: {
94
- actions: 'clearAmount',
95
- },
96
- SUBMIT: {
97
- target: 'submitting',
98
- cond: 'isSubmittable',
99
- },
100
- },
101
- },
102
- submitting: {
103
- invoke: {
104
- src: 'submitWithdraw',
105
- onDone: {
106
- target: 'submitted',
107
- actions: 'setResult',
108
- },
109
- onError: {
110
- target: 'withdrawable',
111
- },
112
- },
113
- },
114
- submitted: {
115
- invoke: {
116
- src: 'fetchPaymentDetail',
117
- onDone: {
118
- target: 'inProcessing',
119
- actions: 'setPaymentData',
120
- },
121
- onError: {
122
- target: 'fail',
123
- },
124
- },
125
- },
126
- fail: {},
127
- },
128
- },
129
- {
130
- actions: {
131
- setPaymentData: assign((context, event) => {
132
- const { paymentDetail, bankInfo } = event.data
133
- const { minimum, maximum, optional } = paymentDetail?.[0] || {}
134
- return { paymentDetail, bank: bankInfo[0], minimum, maximum, options: optional }
135
- }),
136
- updateWithdrawCondition: assign((context, event) => {
137
- const { enableWithdraw, balance } = event.data
138
- return {
139
- balance,
140
- enableWithdraw,
141
- }
142
- }),
143
- addAmount: assign((context, event) => {
144
- return {
145
- amount: parseFloat(`${context.amount || 0}`) + parseFloat(`${event.data}`),
146
- }
147
- }),
148
- setAmount: assign((context, event) => {
149
- return { amount: parseFloat(`${event.data}`) }
150
- }),
151
- clearAmount: assign((context, event) => {
152
- return { amount: null }
153
- }),
154
- setResult: assign((context, event) => {
155
- const { applyId, balance, realAmount, charge } = event.data
156
- return { applyId, balance, realAmount, charge }
157
- }),
158
- },
159
- guards: {
160
- haveProcessing: (context, event) => {
161
- return (context.paymentDetail?.[0]?.processing || []).length > 0
162
- },
163
- isSubmittable: (context, event) => {
164
- const { amount } = context
165
- return parseFloat(`${amount}`) > 0
166
- },
167
- isNotWithdrawable: (context, event) => {
168
- const { balance, enableWithdraw, paymentDetail } = context
169
- const minWithdrawAmount = paymentDetail[0]?.minimum || 0
170
- return !enableWithdraw || balance < minWithdrawAmount
171
- },
172
- isNotWithdrawMinDepositAmount: (context, event) => {
173
- return !event.data?.enableWithdraw
174
- },
175
- },
176
- services: {
177
- fetchPaymentDetail: async (context, event) => {
178
- const [paymentDetail = [], { bankInfo }] = await Promise.all([
179
- request.send(payment.getPaymentDetail({ transferType: 'WITHDRAW' })),
180
- request.send(payment.getPaymentInfo()),
181
- ])
182
- return { paymentDetail, bankInfo }
183
- },
184
- fetchWithdrawRules: async (context, event) => {
185
- return await request.send(payment.getDoubleWalletWithdrawRule({ walletType: 'CASH' }))
186
- },
187
- submitWithdraw: async (context, event) => {
188
- const { paymentDetail, amount, bank } = context
189
- const { method } = paymentDetail[0]
190
- return await request.send(
191
- payment.submitWithdrawTransactionVN({
192
- method,
193
- amount,
194
- applyerBankCode: bank.bankCode,
195
- applyerAccountNumber: bank.accountNumber,
196
- branch: bank.branch,
197
- holderName: bank.holderName,
198
- })
199
- )
200
- },
201
- withdrawCheck: async (context, event) => {
202
- return await request.send(payment.withdrawCheck())
203
- },
204
- },
205
- }
206
- )
207
- }