@jetthai/cuora 1.1.128-dev-2 → 1.1.128

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 -424
  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 +53 -99
  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,140 +0,0 @@
1
- import { assign, createMachine } from 'xstate'
2
- import api from '../../api/activity.js'
3
-
4
- export default function (request) {
5
- const { appSecret } = request.config
6
- return createMachine(
7
- {
8
- id: 'vip_card_activity',
9
- context: {
10
- activityNo: null,
11
- activityDetail: null,
12
- conditions: null,
13
- rebateType: null,
14
- currentReachLevel: null,
15
- nextReachLevel: null,
16
- lastPeriod: null,
17
- nextDepositLimit: null,
18
- nextTurnoverLimit: null,
19
- currentTotalDeposit: null,
20
- currentTotalTurnover: null,
21
- retainAmount: '0',
22
- yesterdayReward: '0',
23
- calculateWalletMode: '1',
24
- duration: 0,
25
- },
26
- initial: 'idle',
27
- states: {
28
- idle: {
29
- on: {
30
- SET_ACTIVITY_NO: {
31
- target: 'loading',
32
- actions: 'setActivityNo',
33
- },
34
- },
35
- },
36
- loading: {
37
- invoke: {
38
- src: 'fetchActivityDetail',
39
- onDone: {
40
- target: 'loaded',
41
- actions: ['setActivityDetail', 'setInitData'],
42
- },
43
- onError: {
44
- target: 'idle',
45
- },
46
- },
47
- },
48
- loaded: {
49
- entry: 'setDuration',
50
- after: {
51
- 1000: {
52
- target: 'loaded',
53
- },
54
- },
55
- },
56
- },
57
- on: {
58
- START: {
59
- target: '.loading',
60
- },
61
- STOP: {
62
- target: '.idle',
63
- },
64
- },
65
- },
66
- {
67
- actions: {
68
- setActivityNo: assign((context, event) => {
69
- return {
70
- activityNo: event.data,
71
- }
72
- }),
73
- setActivityDetail: assign((context, event) => {
74
- return {
75
- activityDetail: event.data,
76
- }
77
- }),
78
- setInitData: assign((context, event) => {
79
- const {
80
- rebateType,
81
- conditions = [],
82
- currentReachLevel = {},
83
- nextReachLevel = {},
84
- lastPeriod = {},
85
- currentTotalDeposit = '0',
86
- currentTotalTurnover = '0',
87
- retainAmount = '0',
88
- yesterdayReward = '0',
89
- calculateWalletMode = '0',
90
- } = context.activityDetail || {}
91
-
92
- let nextDepositLimit = '0'
93
- let nextTurnoverLimit = '0'
94
- let currentTurnover = '0'
95
- let currentDeposit = '0'
96
- // 若已達到最高等級,所有數值皆以最高等級顯示
97
- if (currentReachLevel?.title === conditions?.[conditions?.length - 1]?.title) {
98
- currentDeposit = conditions[conditions.length - 1].depositLimit
99
- currentTurnover = conditions[conditions.length - 1].turnoverLimit
100
- nextDepositLimit = conditions[conditions.length - 1].depositLimit
101
- nextTurnoverLimit = conditions[conditions.length - 1].turnoverLimit
102
- } else {
103
- currentDeposit = currentTotalDeposit
104
- currentTurnover = currentTotalTurnover
105
- nextDepositLimit = nextReachLevel?.depositLimit
106
- nextTurnoverLimit = nextReachLevel?.turnoverLimit
107
- }
108
-
109
- return {
110
- rebateType,
111
- conditions,
112
- currentReachLevel,
113
- nextReachLevel,
114
- lastPeriod,
115
- nextDepositLimit,
116
- nextTurnoverLimit,
117
- currentTotalDeposit: currentDeposit,
118
- currentTotalTurnover: currentTurnover,
119
- retainAmount,
120
- yesterdayReward,
121
- calculateWalletMode,
122
- }
123
- }),
124
- setDuration: assign((context, event) => {
125
- const { currentEndTime } = context?.activityDetail
126
- return {
127
- duration: Math.max(parseInt(currentEndTime) - new Date().getTime() / 1000, 0),
128
- }
129
- }),
130
- },
131
- services: {
132
- fetchActivityDetail: async (context, event) => {
133
- const { activityNo } = context
134
- const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }))
135
- return data
136
- },
137
- },
138
- }
139
- )
140
- }
@@ -1,317 +0,0 @@
1
- import { assign, createMachine } from 'xstate'
2
- import padStart from 'lodash/padStart.js'
3
- import payment from '@jetthai/cuora/src/api/payment.js'
4
-
5
- export default function (request) {
6
- const { appSecret } = request.config
7
- return createMachine(
8
- {
9
- id: 'crypto_bank',
10
- initial: 'loading',
11
- context: {
12
- paymentDetails: [],
13
-
14
- cryptos: [],
15
- addresses: [],
16
- cryptoBank: null,
17
-
18
- amount: null,
19
- selectedCrypto: null,
20
- selectedAddress: null,
21
- selectedBank: null,
22
-
23
- currentCategory: 'cryptoBank',
24
- currentPayment: null,
25
-
26
- calculation: null,
27
- processing: null,
28
- result: null,
29
-
30
- depositTime: null,
31
- receipt: null,
32
- proofOptional: false,
33
-
34
- // use for wallet mode 4
35
- promotion: null,
36
- },
37
- states: {
38
- loading: {
39
- initial: 'init1',
40
- states: {
41
- init1: {
42
- invoke: {
43
- src: 'fetchPayments',
44
- onDone: {
45
- target: 'init2',
46
- actions: 'setPayment',
47
- },
48
- onError: {
49
- target: '#crypto_bank.fail',
50
- },
51
- },
52
- },
53
- init2: {
54
- always: [
55
- {
56
- target: '#crypto_bank.processing',
57
- cond: 'isProcessing',
58
- },
59
- { target: '#crypto_bank.loaded' },
60
- ],
61
- },
62
- },
63
- },
64
- loaded: {
65
- always: [{ target: 'debouncing', cond: 'isCalculable' }],
66
- },
67
- debouncing: {
68
- after: {
69
- 1000: {
70
- target: 'calculating',
71
- },
72
- },
73
- },
74
- calculating: {
75
- invoke: {
76
- src: 'fetchCalculation',
77
- onDone: {
78
- target: 'calculated',
79
- actions: 'setCalculation',
80
- },
81
- onError: {
82
- target: 'loaded',
83
- },
84
- },
85
- },
86
- calculated: {
87
- on: {
88
- SUBMIT: [
89
- {
90
- target: 'pending',
91
- },
92
- {
93
- target: 'submitting',
94
- cond: 'isSubmittable',
95
- },
96
- ],
97
- },
98
- },
99
- pending: {
100
- on: {
101
- SUBMIT: {
102
- target: 'submitting',
103
- cond: 'isSubmittable',
104
- },
105
- },
106
- },
107
- submitting: {
108
- invoke: {
109
- src: 'submitDeposit',
110
- onDone: {
111
- target: 'submitted',
112
- actions: 'setResult',
113
- },
114
- onError: {
115
- target: 'loaded',
116
- },
117
- },
118
- },
119
- processing: {},
120
- submitted: {},
121
- fail: {},
122
- },
123
- on: {
124
- SET_CRYPTO: {
125
- target: '.loaded',
126
- actions: 'setCrypto',
127
- },
128
- SET_ADDRESS: {
129
- target: '.loaded',
130
- actions: 'setAddress',
131
- },
132
- SET_AMOUNT: {
133
- target: '.loaded',
134
- actions: ['setAmount', 'clearCalculation'],
135
- },
136
- SET_PROOF_OPTIONAL: {
137
- actions: 'setProofOptional',
138
- },
139
- CALCULATE: {
140
- target: '.debouncing',
141
- actions: 'clearCalculation',
142
- },
143
- SET_DEPOSIT_TIME: {
144
- actions: 'setDepositTime',
145
- },
146
- SET_RECEIPT: {
147
- actions: 'setReceipt',
148
- },
149
- SET_PROMOTION: {
150
- actions: 'setPromotion',
151
- },
152
- },
153
- },
154
- {
155
- actions: {
156
- setPayment: assign((context, event) => {
157
- const cryptoBank = event.data.find((element) => element.category === context.currentCategory)
158
- cryptoBank.banks = (cryptoBank.banks || []).map((crypto) => ({
159
- ...crypto,
160
- label: crypto.cryptoName,
161
- value: cryptoBank.method,
162
- icon: crypto.symbol,
163
- }))
164
- const defaultCrypto = []
165
- cryptoBank.banks?.forEach((bank) => {
166
- var existingCryptoName = defaultCrypto.find((item) => {
167
- return item.cryptoName === bank.cryptoName
168
- })
169
-
170
- if (!existingCryptoName) {
171
- defaultCrypto.push(bank)
172
- }
173
- })
174
- const currentPayment = {
175
- label: defaultCrypto[0]?.network,
176
- value: defaultCrypto[0]?.network,
177
- icon: defaultCrypto[0]?.network,
178
- }
179
- const defaultAddresses = (cryptoBank.banks || [])
180
- .filter((element) => element.cryptoName === defaultCrypto[0].cryptoName)
181
- .map((value, i) => {
182
- return {
183
- label: value.address,
184
- value: value.address,
185
- icon: null,
186
- }
187
- })
188
-
189
- return {
190
- cryptos: defaultCrypto,
191
- addresses: defaultAddresses,
192
- cryptoBank,
193
- selectedCrypto: defaultCrypto[0],
194
- selectedAddress: defaultAddresses[0],
195
- options: defaultCrypto[0]?.optional,
196
- currentPayment,
197
- processing: currentPayment.processing?.[0],
198
- }
199
- }),
200
- setCrypto: assign((context, event) => {
201
- const { cryptoBank } = context
202
- const selectedCrypto = cryptoBank.banks.find((bank) => bank.label === event.data.label)
203
- const addresses = cryptoBank.banks
204
- .filter((element) => element.cryptoName === selectedCrypto.cryptoName)
205
- .map((value, i) => {
206
- return {
207
- label: value.address,
208
- value: value.address,
209
- icon: null,
210
- }
211
- })
212
- return {
213
- addresses,
214
- selectedCrypto: selectedCrypto,
215
- selectedAddress: addresses[0],
216
- selectedAmount: null,
217
- calculation: null,
218
- options: cryptoBank.optional,
219
- }
220
- }),
221
- setAddress: assign((context, event) => {
222
- const { cryptoBank, selectedCrypto } = context
223
- const selectedCryptoByAddress = cryptoBank.banks.find((bank) => bank.label === selectedCrypto.label && bank.address === event.data.value)
224
- return {
225
- selectedCrypto: selectedCryptoByAddress,
226
- selectedAddress: event.data,
227
- }
228
- }),
229
- setAmount: assign((context, event) => {
230
- return {
231
- amount: event.data,
232
- }
233
- }),
234
- setCalculation: assign((context, event) => {
235
- return {
236
- calculation: event.data,
237
- }
238
- }),
239
- clearCalculation: assign((context, event) => {
240
- return {
241
- calculation: null,
242
- }
243
- }),
244
- setResult: assign((context, event) => {
245
- return {
246
- result: event.data,
247
- }
248
- }),
249
- setProofOptional: assign((context, event) => {
250
- return {
251
- proofOptional: event.data,
252
- }
253
- }),
254
- setDepositTime: assign((context, event) => {
255
- return {
256
- depositTime: event.data,
257
- }
258
- }),
259
- setReceipt: assign((context, event) => {
260
- return {
261
- receipt: event.data,
262
- }
263
- }),
264
- setPromotion: assign((context, event) => {
265
- const promotion = event.data
266
- return {
267
- promotion,
268
- }
269
- }),
270
- },
271
- guards: {
272
- isCalculable: (context, event) => {
273
- const { selectedCrypto, selectedAddress, cryptoBank, amount } = context
274
- return selectedCrypto && selectedAddress && amount && cryptoBank.minimum <= +amount && +amount <= cryptoBank.maximum
275
- },
276
- isSubmittable: (context, event) => {
277
- const { selectedCrypto, selectedAddress, amount, depositTime, receipt, proofOptional } = context
278
- return selectedCrypto && selectedAddress && amount && depositTime && (receipt || proofOptional)
279
- },
280
- isProcessing: (context, event) => {
281
- return context.processing
282
- },
283
- },
284
- services: {
285
- fetchPayments: async (context, event) => {
286
- return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
287
- },
288
- fetchCalculation: async (context, event) => {
289
- const { selectedCrypto, amount, promotion } = context
290
- return await request.send(
291
- payment.getCryptoDepositExpectedResult({
292
- method: selectedCrypto.value,
293
- amount,
294
- cryptoCurrency: selectedCrypto.symbol,
295
- promotionsNo: promotion?.activityNo,
296
- })
297
- )
298
- },
299
- submitDeposit: async (context, event) => {
300
- const { selectedCrypto, depositTime, receipt, amount, promotion } = context
301
- return await request.send(
302
- payment.submitDepositTransactionCryptoBank({
303
- method: selectedCrypto.value,
304
- amount: amount,
305
- cryptoCurrency: selectedCrypto.symbol,
306
- cryptoNetwork: selectedCrypto.network,
307
- sourceAddress: selectedCrypto.address,
308
- promotionsNo: promotion?.activityNo,
309
- depositTime,
310
- receipt,
311
- })
312
- )
313
- },
314
- },
315
- }
316
- )
317
- }