@jetthai/cuora 1.0.307-dev-2 → 1.1.1

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 (111) hide show
  1. package/CHANGELOG.md +4 -853
  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 +25 -141
  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 +30 -110
  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 -26
  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 +21 -112
  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 -195
  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.js +0 -118
  96. package/src/machine/honor_board_cash.js +0 -89
  97. package/src/machine/navbar.js +0 -57
  98. package/src/machine/promotions.js +0 -171
  99. package/src/machine/reward_cash.js +0 -219
  100. package/src/machine/roulette_v2.js +0 -276
  101. package/src/machine/side_cash.js +0 -110
  102. package/src/machine/user_photo.js +0 -65
  103. package/src/machine/withdraw/index.js +0 -23
  104. package/src/machine/withdraw/withdraw_crypto2.js +0 -540
  105. package/src/machine/withdraw/withdraw_crypto_cash.js +0 -319
  106. package/src/machine/withdraw/withdraw_krway.js +0 -220
  107. package/src/machine/withdraw/withdraw_manual.js +0 -610
  108. package/src/machine/withdraw/withdraw_manual_cash.js +0 -303
  109. package/src/machine/withdraw/withdraw_vn.js +0 -546
  110. package/src/machine/withdraw/withdraw_vn2.js +0 -561
  111. 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,220 +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: 'passWithdrawCooldownTime',
71
- cond: 'isPassWithdrawCooldownTime',
72
- actions: assign((context, event) => {
73
- return {
74
- withdrawCheck: event.data,
75
- }
76
- }),
77
- },
78
- {
79
- target: 'notWithdrawable',
80
- cond: 'isNotWithdrawable',
81
- },
82
- {
83
- target: 'withdrawable',
84
- },
85
- ],
86
- onError: {
87
- target: '#withdraw_krway.fail',
88
- },
89
- },
90
- },
91
- notWithdrawMinDepositAmount: {},
92
- passWithdrawCooldownTime: {},
93
- inProcessing: {},
94
- notWithdrawable: {},
95
- withdrawable: {
96
- on: {
97
- ADD_AMOUNT: {
98
- actions: 'addAmount',
99
- },
100
- SET_AMOUNT: {
101
- actions: 'setAmount',
102
- },
103
- CLEAR_AMOUNT: {
104
- actions: 'clearAmount',
105
- },
106
- SUBMIT: {
107
- target: 'submitting',
108
- cond: 'isSubmittable',
109
- },
110
- },
111
- },
112
- submitting: {
113
- invoke: {
114
- src: 'submitWithdraw',
115
- onDone: {
116
- target: 'submitted',
117
- actions: 'setResult',
118
- },
119
- onError: {
120
- target: 'withdrawable',
121
- },
122
- },
123
- },
124
- submitted: {
125
- invoke: {
126
- src: 'fetchPaymentDetail',
127
- onDone: {
128
- target: 'inProcessing',
129
- actions: 'setPaymentData',
130
- },
131
- onError: {
132
- target: 'fail',
133
- },
134
- },
135
- },
136
- fail: {},
137
- },
138
- },
139
- {
140
- actions: {
141
- setPaymentData: assign((context, event) => {
142
- const { paymentDetail, bankInfo } = event.data
143
- const { minimum, maximum, optional } = paymentDetail?.[0] || {}
144
- return { paymentDetail, bank: bankInfo[0], minimum, maximum, options: optional }
145
- }),
146
- updateWithdrawCondition: assign((context, event) => {
147
- const { enableWithdraw, balance } = event.data
148
- return {
149
- balance,
150
- enableWithdraw,
151
- }
152
- }),
153
- addAmount: assign((context, event) => {
154
- return {
155
- amount: parseFloat(`${context.amount || 0}`) + parseFloat(`${event.data}`),
156
- }
157
- }),
158
- setAmount: assign((context, event) => {
159
- return { amount: parseFloat(`${event.data}`) }
160
- }),
161
- clearAmount: assign((context, event) => {
162
- return { amount: null }
163
- }),
164
- setResult: assign((context, event) => {
165
- const { applyId, balance, realAmount, charge } = event.data
166
- return { applyId, balance, realAmount, charge }
167
- }),
168
- },
169
- guards: {
170
- haveProcessing: (context, event) => {
171
- return (context.paymentDetail?.[0]?.processing || []).length > 0
172
- },
173
- isSubmittable: (context, event) => {
174
- const { amount } = context
175
- return parseFloat(`${amount}`) > 0
176
- },
177
- isNotWithdrawable: (context, event) => {
178
- const { balance, enableWithdraw, paymentDetail } = context
179
- const minWithdrawAmount = paymentDetail[0]?.minimum || 0
180
- return !enableWithdraw || balance < minWithdrawAmount
181
- },
182
- isNotWithdrawMinDepositAmount: (context, event) => {
183
- return !event.data?.passDepositeLimit
184
- },
185
- isPassWithdrawCooldownTime: (context, event) => {
186
- return !event.data?.passWithdrawCooldownTime
187
- },
188
- },
189
- services: {
190
- fetchPaymentDetail: async (context, event) => {
191
- const [paymentDetail = [], { bankInfo }] = await Promise.all([
192
- request.send(payment.getPaymentDetail({ transferType: 'WITHDRAW' })),
193
- request.send(payment.getPaymentInfo()),
194
- ])
195
- return { paymentDetail, bankInfo }
196
- },
197
- fetchWithdrawRules: async (context, event) => {
198
- return await request.send(payment.getDoubleWalletWithdrawRule({ walletType: 'CASH' }))
199
- },
200
- submitWithdraw: async (context, event) => {
201
- const { paymentDetail, amount, bank } = context
202
- const { method } = paymentDetail[0]
203
- return await request.send(
204
- payment.submitWithdrawTransactionVN({
205
- method,
206
- amount,
207
- applyerBankCode: bank.bankCode,
208
- applyerAccountNumber: bank.accountNumber,
209
- branch: bank.branch,
210
- holderName: bank.holderName,
211
- })
212
- )
213
- },
214
- withdrawCheck: async (context, event) => {
215
- return await request.send(payment.withdrawCheck())
216
- },
217
- },
218
- }
219
- )
220
- }