@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,280 +0,0 @@
1
- import { assign, createMachine } from 'xstate'
2
- import payment from '@jetthai/cuora/src/api/payment.js'
3
- import { max } from '../../util/index.js'
4
-
5
- export default function (request, context) {
6
- const { paymentDetail = [], promotion, selectedAmount, siteConfig } = context || {}
7
- return createMachine(
8
- {
9
- id: 'crypto_cash',
10
- initial: 'loading',
11
- context: {
12
- paymentDetail,
13
- promotion,
14
- selectedAmount,
15
- siteConfig,
16
-
17
- cryptos: [],
18
- addresses: [],
19
- options: [],
20
-
21
- cryptoBank: null,
22
- selectedCrypto: null,
23
- selectedAddress: null,
24
-
25
- currentCategory: 'cryptoBank',
26
-
27
- calculation: null,
28
- result: null,
29
- receipt: null,
30
- },
31
- states: {
32
- loading: {
33
- always: [
34
- {
35
- target: 'debouncing',
36
- actions: 'setInitData',
37
- },
38
- ],
39
- },
40
- loaded: {},
41
- debouncing: {
42
- entry: 'clearCalculation',
43
- after: {
44
- 1000: [
45
- {
46
- target: 'calculating',
47
- cond: 'isCalculable',
48
- },
49
- {
50
- target: 'loaded',
51
- },
52
- ],
53
- },
54
- },
55
- calculating: {
56
- invoke: {
57
- src: 'fetchCalculation',
58
- onDone: {
59
- target: 'calculated',
60
- actions: 'setCalculation',
61
- },
62
- onError: {
63
- target: 'calculated',
64
- },
65
- },
66
- },
67
- calculated: {
68
- on: {
69
- SUBMIT: [
70
- {
71
- target: 'submitting',
72
- cond: 'isSubmittable',
73
- },
74
- ],
75
- },
76
- },
77
- submitting: {
78
- invoke: {
79
- src: 'submitDeposit',
80
- onDone: {
81
- target: 'submitted',
82
- actions: 'setResult',
83
- },
84
- onError: {
85
- target: 'calculated',
86
- },
87
- },
88
- },
89
- submitted: {},
90
- },
91
- on: {
92
- SET_PROMOTION: {
93
- target: '.debouncing',
94
- actions: 'setPromotion',
95
- internal: false,
96
- },
97
- SET_CRYPTO: {
98
- target: '.debouncing',
99
- actions: 'setCrypto',
100
- internal: false,
101
- },
102
- SET_ADDRESS: {
103
- target: '.debouncing',
104
- actions: 'setAddress',
105
- internal: false,
106
- },
107
- SET_AMOUNT: {
108
- target: '.debouncing',
109
- actions: 'setAmount',
110
- internal: false,
111
- },
112
- INPUT_AMOUNT: {
113
- target: '.debouncing',
114
- actions: 'inputAmount',
115
- internal: false,
116
- },
117
- SET_DEPOSIT_TIME: {
118
- actions: 'setDepositTime',
119
- },
120
- SET_RECEIPT: {
121
- actions: 'setReceipt',
122
- },
123
- },
124
- },
125
- {
126
- actions: {
127
- setInitData: assign((context, event) => {
128
- const { paymentDetail } = context
129
- const cryptoBank = paymentDetail.find((element) => element.transferType === 'deposit' && element.category === context.currentCategory)
130
- cryptoBank.banks = (cryptoBank.banks || []).map((crypto) => ({
131
- ...crypto,
132
- label: crypto.cryptoName,
133
- value: cryptoBank.method,
134
- icon: crypto.symbol,
135
- }))
136
- const defaultCrypto = []
137
- cryptoBank.banks?.forEach((bank) => {
138
- var existingCryptoName = defaultCrypto.find((item) => {
139
- return item.cryptoName === bank.cryptoName
140
- })
141
-
142
- if (!existingCryptoName) {
143
- defaultCrypto.push(bank)
144
- }
145
- })
146
- const defaultAddresses = (cryptoBank.banks || [])
147
- .filter((element) => element.cryptoName === defaultCrypto[0].cryptoName)
148
- .map((value, i) => {
149
- return {
150
- label: value.address,
151
- value: value.address,
152
- icon: null,
153
- }
154
- })
155
- return {
156
- cryptos: defaultCrypto,
157
- addresses: defaultAddresses,
158
- cryptoBank,
159
- selectedCrypto: defaultCrypto[0],
160
- selectedAddress: defaultAddresses[0],
161
- options: cryptoBank.optional,
162
- }
163
- }),
164
- setCrypto: assign((context, event) => {
165
- const { cryptoBank } = context
166
- const selectedCrypto = cryptoBank.banks.find((bank) => bank.label === event.data.label)
167
- const addresses = cryptoBank.banks
168
- .filter((element) => element.cryptoName === selectedCrypto.cryptoName)
169
- .map((value, i) => {
170
- return {
171
- label: value.address,
172
- value: value.address,
173
- icon: null,
174
- }
175
- })
176
- return {
177
- addresses,
178
- selectedCrypto: selectedCrypto,
179
- selectedAddress: addresses[0],
180
- selectedAmount: null,
181
- calculation: null,
182
- options: cryptoBank.optional,
183
- }
184
- }),
185
- setAddress: assign((context, event) => {
186
- const { cryptoBank, selectedCrypto } = context
187
- const selectedCryptoByAddress = cryptoBank.banks.find((bank) => bank.label === selectedCrypto.label && bank.address === event.data.value)
188
- return {
189
- selectedCrypto: selectedCryptoByAddress,
190
- selectedAddress: event.data,
191
- }
192
- }),
193
- setAmount: assign((context, event) => {
194
- // 現金網可自由填額度,grandTotalEnable 欄位感覺不再需要?
195
- if (context.cryptoBank?.grandTotalEnable === 1) {
196
- return { selectedAmount: parseFloat(context.selectedAmount || 0) + parseFloat(event.data) }
197
- } else {
198
- return { selectedAmount: event.data }
199
- }
200
- }),
201
- inputAmount: assign((context, event) => {
202
- return { selectedAmount: event.data }
203
- }),
204
- setCalculation: assign((context, event) => {
205
- return {
206
- calculation: event.data,
207
- }
208
- }),
209
- clearCalculation: assign((context, event) => {
210
- return {
211
- calculation: null,
212
- }
213
- }),
214
- setResult: assign((context, event) => {
215
- return {
216
- result: event.data,
217
- }
218
- }),
219
- setPromotion: assign((context, event) => {
220
- const { cryptoBank, selectedAmount } = context
221
- const promotion = event.data
222
- return {
223
- promotion,
224
- selectedAmount: max(promotion.minimumAmount, cryptoBank.minimum, selectedAmount, 0),
225
- calculation: null,
226
- }
227
- }),
228
- setDepositTime: assign((context, event) => {
229
- return {
230
- depositTime: event.data,
231
- }
232
- }),
233
- setReceipt: assign((context, event) => {
234
- return {
235
- receipt: event.data,
236
- }
237
- }),
238
- },
239
- guards: {
240
- isCalculable: (context, event) => {
241
- const { selectedCrypto, selectedAddress, cryptoBank, selectedAmount } = context
242
- return selectedCrypto && selectedAddress && selectedAmount && cryptoBank.minimum <= +selectedAmount && +selectedAmount <= cryptoBank.maximum
243
- },
244
- isSubmittable: (context, event) => {
245
- const { selectedCrypto, selectedAddress, selectedAmount, depositTime, receipt, calculation, siteConfig } = context
246
- const { bankDepositProofIsOptional = '1' } = siteConfig
247
- return selectedCrypto && selectedAddress && selectedAmount && depositTime && calculation && (receipt || bankDepositProofIsOptional === '0')
248
- },
249
- },
250
- services: {
251
- fetchCalculation: async (context, event) => {
252
- const { selectedCrypto, selectedAmount, promotion } = context
253
- return await request.send(
254
- payment.getCryptoDepositExpectedResult({
255
- method: selectedCrypto.value,
256
- amount: selectedAmount,
257
- cryptoCurrency: selectedCrypto.symbol,
258
- promotionsNo: promotion?.promotionsNo,
259
- })
260
- )
261
- },
262
- submitDeposit: async (context, event) => {
263
- const { selectedCrypto, selectedAmount, promotion, depositTime, receipt } = context
264
- return await request.send(
265
- payment.submitDepositTransactionCryptoBank({
266
- method: selectedCrypto.value,
267
- amount: selectedAmount,
268
- cryptoCurrency: selectedCrypto.symbol,
269
- cryptoNetwork: selectedCrypto.network,
270
- sourceAddress: selectedCrypto.address,
271
- promotionsNo: promotion?.promotionsNo,
272
- depositTime,
273
- receipt,
274
- })
275
- )
276
- },
277
- },
278
- }
279
- )
280
- }
@@ -1,147 +0,0 @@
1
- import { assign, createMachine } from 'xstate'
2
- import payment from '@jetthai/cuora/src/api/payment.js'
3
-
4
- export default function (request) {
5
- return createMachine(
6
- {
7
- id: 'crypto_qrcode',
8
- initial: 'loading',
9
- context: {
10
- paymentDetails: [],
11
- currentCategory: 'cryptoQrcode',
12
- currentPayment: null,
13
- cryptos: [],
14
- selectedCrypto: null,
15
-
16
- resultMap: {},
17
- result: {
18
- action: '',
19
- cdtime: null,
20
- accountNumber: '', // crypto address
21
- currency: '',
22
- network: '',
23
- name: '',
24
- qrcode: '',
25
- },
26
- },
27
- states: {
28
- loading: {
29
- invoke: {
30
- src: 'fetchPaymentDetail',
31
- onDone: {
32
- target: 'fetching',
33
- actions: 'setInitData',
34
- },
35
- onError: {
36
- target: 'fail',
37
- },
38
- },
39
- },
40
- finding: {
41
- always: [
42
- {
43
- target: 'idle',
44
- actions: 'setResultFromLocal',
45
- cond: 'isFound',
46
- },
47
- {
48
- target: 'fetching',
49
- },
50
- ],
51
- },
52
- fetching: {
53
- invoke: {
54
- src: 'submitDeposit',
55
- onDone: {
56
- target: 'idle',
57
- actions: 'setResult',
58
- },
59
- onError: {
60
- target: 'idle',
61
- },
62
- },
63
- },
64
- idle: {},
65
- fail: {},
66
- },
67
- on: {
68
- SET_CRYPTO: {
69
- target: '.finding',
70
- actions: 'setCrypto',
71
- },
72
- },
73
- },
74
- {
75
- actions: {
76
- setInitData: assign((context, event) => {
77
- const paymentDetail = event.data || []
78
- const payments = paymentDetail.filter((item) => item.transferType === 'deposit' && item.category === context.currentCategory)
79
- const cryptos = payments?.map((value, i) => {
80
- return {
81
- ...value,
82
- label: value?.cryptoOptional[0],
83
- network: value?.networkName[0],
84
- icon: value?.channel,
85
- }
86
- })
87
- return {
88
- cryptos,
89
- selectedCrypto: cryptos[0],
90
- currentPayment: cryptos[0],
91
- }
92
- }),
93
- setCrypto: assign((context, event) => {
94
- const { cryptos } = context
95
- const selectedCrypto = cryptos.find((crypto) => crypto.label === event.data.label)
96
- return { selectedCrypto }
97
- }),
98
- setResultFromLocal: assign((context, event) => {
99
- const { resultMap, selectedCrypto } = context
100
- return { result: resultMap[selectedCrypto.network] }
101
- }),
102
- setResult: assign((context, event) => {
103
- const { resultMap, selectedCrypto } = context
104
- const { action, cdtime, accountNumber, currency, network, name, qrcode } = event.data
105
- const result = {
106
- action,
107
- cdtime,
108
- accountNumber,
109
- currency,
110
- network,
111
- name,
112
- qrcode,
113
- }
114
-
115
- return {
116
- result,
117
- resultMap: {
118
- ...resultMap,
119
- [selectedCrypto.network]: result,
120
- },
121
- }
122
- }),
123
- },
124
- guards: {
125
- isFound: (context, event) => {
126
- const { resultMap, selectedCrypto } = context
127
- return resultMap[selectedCrypto.network]
128
- },
129
- },
130
- services: {
131
- fetchPaymentDetail: async (context, event) => {
132
- return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
133
- },
134
- submitDeposit: async (context, event) => {
135
- const { currentPayment, selectedCrypto } = context
136
- return await request.send(
137
- payment.submitDepositTransactionCrypto({
138
- method: currentPayment.method,
139
- cryptoCurrency: currentPayment.channel,
140
- cryptoNetwork: selectedCrypto.network,
141
- })
142
- )
143
- },
144
- },
145
- }
146
- )
147
- }
@@ -1,131 +0,0 @@
1
- import { assign, createMachine } from 'xstate'
2
- import payment from '@jetthai/cuora/src/api/payment.js'
3
-
4
- export default function (request) {
5
- return createMachine(
6
- {
7
- id: 'crypto_qrcode_cash',
8
- initial: 'loading',
9
- context: {
10
- currentCategory: 'cryptoQrcode',
11
- cryptos: [],
12
- selectedCrypto: null,
13
- resultMap: {},
14
- result: {},
15
- },
16
- states: {
17
- loading: {
18
- invoke: {
19
- src: 'fetchPaymentDetail',
20
- onDone: {
21
- target: 'submitting',
22
- actions: 'setInitData',
23
- },
24
- onError: {
25
- target: 'fail',
26
- },
27
- },
28
- },
29
- finding: {
30
- always: [
31
- {
32
- target: 'idle',
33
- actions: 'setResultFromLocal',
34
- cond: 'isFound',
35
- },
36
- {
37
- target: 'submitting',
38
- },
39
- ],
40
- },
41
- submitting: {
42
- invoke: {
43
- src: 'submitDeposit',
44
- onDone: {
45
- target: 'idle',
46
- actions: 'setResult',
47
- },
48
- onError: {
49
- target: 'idle',
50
- },
51
- },
52
- },
53
- idle: {},
54
- fail: {},
55
- },
56
- on: {
57
- SET_CRYPTO: {
58
- target: '.finding',
59
- actions: 'setCrypto',
60
- },
61
- SET_NETWORK: {
62
- target: '.finding',
63
- actions: 'setNetwork',
64
- },
65
- },
66
- },
67
- {
68
- actions: {
69
- setInitData: assign((context, event) => {
70
- const paymentDetail = event.data || []
71
- const payments = paymentDetail.filter((item) => item.category === context.currentCategory)
72
- const cryptos = payments.map((payment) => ({
73
- ...payment,
74
- label: payment.cryptoOptional?.[0],
75
- network: payment.networkName?.[0],
76
- value: payment.method,
77
- icon: payment.channel,
78
- }))
79
-
80
- return {
81
- cryptos,
82
- selectedCrypto: cryptos[0],
83
- }
84
- }),
85
- setCrypto: assign((context, event) => {
86
- const { cryptos } = context
87
- const selectedCrypto = cryptos.find((crypto) => crypto.label === event.data.label)
88
- return { selectedCrypto }
89
- }),
90
- setResultFromLocal: assign((context, event) => {
91
- const { resultMap, selectedCrypto } = context
92
- return { result: resultMap[`${selectedCrypto.channel}_${selectedCrypto.network}`] }
93
- }),
94
- setResult: assign((context, event) => {
95
- const { resultMap, selectedCrypto } = context
96
- const { accountNumber, currency, network, qrcode, forexRate } = event.data
97
- const result = { accountNumber, currency, network, qrcode, forexRate }
98
-
99
- return {
100
- result,
101
- resultMap: {
102
- ...resultMap,
103
- [`${selectedCrypto.channel}_${selectedCrypto.network}`]: result,
104
- },
105
- }
106
- }),
107
- },
108
- guards: {
109
- isFound: (context, event) => {
110
- const { resultMap, selectedCrypto } = context
111
- return resultMap[`${selectedCrypto.channel}_${selectedCrypto.network}`]
112
- },
113
- },
114
- services: {
115
- fetchPaymentDetail: async (context, event) => {
116
- return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
117
- },
118
- submitDeposit: async (context, event) => {
119
- const { selectedCrypto } = context
120
- return await request.send(
121
- payment.submitDepositTransactionCrypto({
122
- method: selectedCrypto.method,
123
- cryptoCurrency: selectedCrypto.channel,
124
- cryptoNetwork: selectedCrypto.network,
125
- })
126
- )
127
- },
128
- },
129
- }
130
- )
131
- }