@jetthai/cuora 1.1.128-dev-2 → 1.1.129

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 (70) hide show
  1. package/CHANGELOG.md +0 -422
  2. package/package.json +1 -1
  3. package/src/api/activity.js +0 -28
  4. package/src/api/auth.js +0 -6
  5. package/src/api/common.js +1 -2
  6. package/src/api/game.js +4 -5
  7. package/src/api/mailbox.js +5 -9
  8. package/src/api/payment.js +8 -103
  9. package/src/api/user.js +0 -2
  10. package/src/machine/activity/activity.js +16 -56
  11. package/src/machine/activity/activity_cash.js +14 -78
  12. package/src/machine/activity/diamond_shop_activity_cash.js +92 -57
  13. package/src/machine/activity/diamond_shop_activity_vn.js +89 -54
  14. package/src/machine/activity/fafafa_activity.js +1 -8
  15. package/src/machine/activity/friend_invite_friends_activity.js +1 -3
  16. package/src/machine/activity/index.js +0 -6
  17. package/src/machine/activity/roulette_activity_v2.js +2 -11
  18. package/src/machine/activity/sign_in_activity.js +13 -20
  19. package/src/machine/auth.js +5 -54
  20. package/src/machine/bank_binding.js +12 -112
  21. package/src/machine/bank_binding_amb.js +1 -6
  22. package/src/machine/common.js +24 -92
  23. package/src/machine/deposit/amb.js +3 -5
  24. package/src/machine/deposit/crypto.js +10 -14
  25. package/src/machine/deposit/crypto_button.js +5 -9
  26. package/src/machine/deposit/crypto_cash.js +5 -2
  27. package/src/machine/deposit/direct.js +15 -2
  28. package/src/machine/deposit/direct_cash.js +26 -6
  29. package/src/machine/deposit/float.js +3 -5
  30. package/src/machine/deposit/index.js +0 -14
  31. package/src/machine/deposit/loadcard_cash.js +27 -6
  32. package/src/machine/deposit/loadcard_vn.js +13 -2
  33. package/src/machine/deposit/manual_cash.js +38 -89
  34. package/src/machine/deposit/manual_vn.js +47 -97
  35. package/src/machine/deposit/qrcode_cash.js +23 -12
  36. package/src/machine/deposit/qrcode_v2.js +14 -3
  37. package/src/machine/deposit/usdt_cash.js +2 -0
  38. package/src/machine/deposit/vpay.js +3 -5
  39. package/src/machine/game_search_cash.js +12 -137
  40. package/src/machine/game_search_v2.js +4 -4
  41. package/src/machine/game_v2_1.js +7 -131
  42. package/src/machine/inbox.js +34 -259
  43. package/src/machine/index.js +0 -6
  44. package/src/machine/leaderboard.js +8 -31
  45. package/src/machine/reward_cash.js +1 -1
  46. package/src/machine/side_v2.js +1 -1
  47. package/src/machine/user_sign_up.js +7 -71
  48. package/src/machine/withdraw/index.js +0 -6
  49. package/src/machine/withdraw/withdraw_crypto.js +66 -1
  50. package/src/machine/withdraw/withdraw_manual_cash.js +14 -44
  51. package/src/machine/withdraw/withdraw_vn.js +7 -42
  52. package/src/machine/withdraw/withdraw_vn2.js +37 -64
  53. package/src/util/constant.js +0 -18
  54. package/src/util/deviceToken.js +2 -2
  55. package/src/machine/activity/cash_rain_activity.js +0 -153
  56. package/src/machine/activity/instant_rebate_activity.js +0 -214
  57. package/src/machine/activity/vip_card_activity.js +0 -140
  58. package/src/machine/deposit/crypto_bank.js +0 -317
  59. package/src/machine/deposit/crypto_bank_cash.js +0 -280
  60. package/src/machine/deposit/crypto_qrcode.js +0 -147
  61. package/src/machine/deposit/crypto_qrcode_cash.js +0 -131
  62. package/src/machine/deposit/crypto_way.js +0 -220
  63. package/src/machine/deposit/crypto_way_cash.js +0 -242
  64. package/src/machine/deposit/krway.js +0 -151
  65. package/src/machine/game_info.js +0 -57
  66. package/src/machine/honor_board_cash.js +0 -63
  67. package/src/machine/user_photo.js +0 -65
  68. package/src/machine/withdraw/withdraw_crypto2.js +0 -540
  69. package/src/machine/withdraw/withdraw_krway.js +0 -207
  70. package/src/machine/withdraw/withdraw_manual.js +0 -595
@@ -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
- }