@jetthai/cuora 1.0.307-dev-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 (111) hide show
  1. package/CHANGELOG.md +3 -854
  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 -146
  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 -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 +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 -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,303 +0,0 @@
1
- import { assign, createMachine } from 'xstate'
2
- import payment from '../../api/payment.js'
3
- import user from '../../api/user.js'
4
-
5
- export default function (request, context) {
6
- const { paymentDetail = [] } = context || {}
7
- return createMachine(
8
- {
9
- id: 'withdraw_manual_cash',
10
- initial: 'loading',
11
- context: {
12
- paymentDetail,
13
- currentPayment: null,
14
- banks: [],
15
- paymentInfo: null,
16
- withdrawRule: null,
17
- userBanks: [],
18
- selectedUserBank: null,
19
- selectedAmount: null,
20
- processing: null,
21
-
22
- // otp
23
- requestId: null,
24
- status: null,
25
- target: null,
26
- ttl: null,
27
- },
28
- states: {
29
- loading: {
30
- invoke: {
31
- src: 'fetchInitData',
32
- onDone: {
33
- target: 'checking',
34
- actions: 'setInitData',
35
- },
36
- onError: {
37
- target: 'loaded',
38
- },
39
- },
40
- },
41
- checking: {
42
- always: [{ target: 'submitted', cond: 'isProcessing' }, { target: 'loaded' }],
43
- },
44
- loaded: {},
45
- debouncing: {
46
- always: [{ target: 'calculated', cond: 'isSubmittable' }, { target: 'loaded' }],
47
- },
48
- calculated: {
49
- on: {
50
- SUBMIT: {
51
- target: 'submitting',
52
- },
53
- SUBMIT_CRYPTO: {
54
- target: 'submitting_crypto',
55
- },
56
- },
57
- },
58
- submitting: {
59
- invoke: {
60
- src: 'submitWithdraw',
61
- onDone: [
62
- {
63
- target: 'otp',
64
- actions: 'setOtp',
65
- cond: 'isOtpRequired',
66
- },
67
- {
68
- target: 'submitted',
69
- actions: 'setProcessing',
70
- },
71
- ],
72
- onError: {
73
- target: 'calculated',
74
- },
75
- },
76
- },
77
- submitting_crypto: {
78
- invoke: {
79
- src: 'submitWithdrawCrypto',
80
- onDone: [
81
- {
82
- target: 'otp',
83
- actions: 'setOtp',
84
- cond: 'isOtpRequired',
85
- },
86
- {
87
- target: 'submitted',
88
- actions: 'setProcessing',
89
- },
90
- ],
91
- onError: {
92
- target: 'calculated',
93
- },
94
- },
95
- },
96
- submitted: {},
97
- otp: {
98
- type: 'parallel',
99
- states: {
100
- countdown: {
101
- after: {
102
- 1000: {
103
- target: 'countdown',
104
- actions: 'decreaseTtl',
105
- cond: (context) => context.ttl > 0,
106
- },
107
- },
108
- },
109
- verification: {
110
- initial: 'idle',
111
- states: {
112
- idle: {
113
- on: {
114
- ACKNOWLEDGE: {
115
- target: 'acknowledging',
116
- },
117
- RESET_OTP: {
118
- target: 'reset',
119
- },
120
- BACK: [
121
- // {
122
- // target: '#withdraw_vn2.activity.convertible',
123
- // cond: 'isActivity',
124
- // },
125
- // {
126
- // target: '#withdraw_vn2.cash.withdrawable',
127
- // },
128
- ],
129
- },
130
- },
131
- acknowledging: {
132
- invoke: {
133
- src: 'acknowledge',
134
- onDone: [
135
- // {
136
- // target: '#withdraw_vn2.activity.converted',
137
- // cond: 'isActivity',
138
- // },
139
- // {
140
- // target: '#withdraw_vn2.cash.submitted',
141
- // },
142
- ],
143
- onError: {
144
- target: 'idle',
145
- },
146
- },
147
- },
148
- reset: {
149
- invoke: {
150
- src: 'resetOtp',
151
- onDone: {
152
- target: 'idle',
153
- actions: 'setVerificationData',
154
- },
155
- onError: { target: 'idle' },
156
- },
157
- },
158
- },
159
- },
160
- },
161
- },
162
- },
163
- on: {
164
- REFRESH: { target: 'loading', internal: false, cond: 'hasNoBank' },
165
- SET_AMOUNT: {
166
- target: 'debouncing',
167
- actions: 'setAmount',
168
- internal: false,
169
- },
170
- SELECT_USER_BANK: {
171
- actions: 'setUserBank',
172
- },
173
- },
174
- },
175
- {
176
- actions: {
177
- setInitData: assign((context, event) => {
178
- const { currentPayment, paymentInfo, withdrawRule, processing } = event.data
179
- const userBanks = [...paymentInfo.bankList, ...paymentInfo.cryptoList, ...paymentInfo.ewalletList]
180
-
181
- return {
182
- currentPayment,
183
- processing,
184
- paymentInfo,
185
- withdrawRule,
186
- userBanks,
187
- selectedUserBank: userBanks[0],
188
- }
189
- }),
190
- setAmount: assign((context, event) => {
191
- return {
192
- selectedAmount: event.data,
193
- }
194
- }),
195
- setUserBank: assign((context, event) => {
196
- return {
197
- selectedUserBank: event.data,
198
- }
199
- }),
200
- setProcessing: assign((context, event) => {
201
- return {
202
- processing: event.data,
203
- }
204
- }),
205
- setOtp: assign((context, event) => {
206
- const { requestId, status, target, ttl } = event.data
207
- return {
208
- requestId,
209
- status,
210
- target,
211
- ttl,
212
- }
213
- }),
214
- decreaseTtl: assign((context, evnet) => {
215
- const second = context.ttl
216
- return {
217
- ttl: Math.max(second - 1, 0),
218
- }
219
- }),
220
- setVerificationData: assign((context, event) => {
221
- const { requestId, ttl, target } = event.data
222
- return {
223
- requestId,
224
- ttl,
225
- target,
226
- }
227
- }),
228
- },
229
- guards: {
230
- hasNoBank: (context, event) => {
231
- return !context.userBanks.length
232
- },
233
- isProcessing: (context, event) => {
234
- return context.processing
235
- },
236
- isSubmittable: (context, event) => {
237
- const { currentPayment, selectedUserBank, selectedAmount } = context
238
- return selectedUserBank && selectedAmount > 0 && currentPayment.minimum <= selectedAmount && selectedAmount <= currentPayment.maximum
239
- },
240
- isOtpRequired: (context, event) => {
241
- return event.data?.status === 'otp-verifying'
242
- },
243
- },
244
- services: {
245
- fetchInitData: async (context, event) => {
246
- const { paymentDetail = [] } = context
247
- const currentPayment = paymentDetail.find((element) => element.category === 'manual' && element.transferType === 'withdraw')
248
-
249
- const [paymentInfo, withdrawRule, orders] = await Promise.all([
250
- request.send(payment.getBindingPaymentInfo()),
251
- request.send(payment.getDoubleWalletWithdrawRule({ walletType: 'CASH' })),
252
- request.send(payment.getPendingOrder({ transferType: 'WITHDRAW' })),
253
- ])
254
-
255
- return {
256
- currentPayment,
257
- paymentInfo,
258
- withdrawRule,
259
- processing: orders[0],
260
- }
261
- },
262
- submitWithdraw: async (context, event) => {
263
- const { currentPayment, selectedUserBank, selectedAmount } = context
264
- const branchTemp = ['GCASH', 'PAYM', 'PIX'].includes(selectedUserBank.bankCode) ? '' : selectedUserBank.branch
265
- return await request.send(
266
- payment.submitWithdrawTransactionVN({
267
- method: currentPayment.method,
268
- amount: selectedAmount,
269
- applyerBankCode: selectedUserBank.bankCode,
270
- applyerAccountNumber: selectedUserBank.accountNumber,
271
- applyerIfscCode: selectedUserBank.ifscCode,
272
- branch: branchTemp,
273
- applyerHolderName: selectedUserBank.holderName,
274
- })
275
- )
276
- },
277
- submitWithdrawCrypto: async (context, event) => {
278
- const { currentPayment, selectedUserBank, selectedAmount } = context
279
- const branchTemp = ['GCASH', 'PAYM', 'PIX'].includes(selectedUserBank.bankCode) ? '' : selectedUserBank.branch
280
- return await request.send(
281
- payment.submitWithdrawTransactionCrypto({
282
- method: currentPayment.method,
283
- amount: selectedAmount,
284
- cryptoCurrency: selectedUserBank.cryptoCurrency,
285
- cryptoNetwork: selectedUserBank.cryptoNetwork,
286
- targetAddress: selectedUserBank.cryptoAddress,
287
- applyerHolderName: selectedUserBank.holderName,
288
- })
289
- )
290
- },
291
- resetOtp: async (context, event) => {
292
- const { requestId, target } = context
293
- return await request.send(user.otpReset({ requestId, target }))
294
- },
295
- acknowledge: async (context, event) => {
296
- const { requestId, target } = context
297
- const code = event.data
298
- return await request.send(user.otpAcknowledge({ requestId, target, code }))
299
- },
300
- },
301
- }
302
- )
303
- }