@jetthai/cuora 1.0.302-sl-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 (110) hide show
  1. package/CHANGELOG.md +3 -848
  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 -134
  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 -24
  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 -217
  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_cash.js +0 -63
  96. package/src/machine/navbar.js +0 -57
  97. package/src/machine/promotions.js +0 -171
  98. package/src/machine/reward_cash.js +0 -219
  99. package/src/machine/roulette_v2.js +0 -276
  100. package/src/machine/side_cash.js +0 -110
  101. package/src/machine/user_photo.js +0 -65
  102. package/src/machine/withdraw/index.js +0 -23
  103. package/src/machine/withdraw/withdraw_crypto2.js +0 -540
  104. package/src/machine/withdraw/withdraw_crypto_cash.js +0 -319
  105. package/src/machine/withdraw/withdraw_krway.js +0 -207
  106. package/src/machine/withdraw/withdraw_manual.js +0 -595
  107. package/src/machine/withdraw/withdraw_manual_cash.js +0 -303
  108. package/src/machine/withdraw/withdraw_vn.js +0 -533
  109. package/src/machine/withdraw/withdraw_vn2.js +0 -548
  110. package/src/util/math.js +0 -4
@@ -1,138 +0,0 @@
1
- import { assign, createMachine } from 'xstate'
2
- import payment from '@jetthai/cuora/src/api/payment.js'
3
-
4
- export default function (request, context) {
5
- const { paymentDetail = [] } = context || {}
6
- return createMachine(
7
- {
8
- id: 'usdt',
9
- initial: 'loading',
10
- context: {
11
- paymentDetail,
12
- currentCategory: 'usdt',
13
- currentPayment: null,
14
- networks: [],
15
- selectedNetwork: null,
16
-
17
- resultMap: {},
18
- result: {
19
- action: '',
20
- cdtime: null,
21
- accountNumber: '', // crypto address
22
- currency: '',
23
- network: '',
24
- name: '',
25
- qrcode: '',
26
- },
27
- },
28
- states: {
29
- loading: {
30
- always: [
31
- {
32
- target: 'checking',
33
- actions: 'setPayment',
34
- },
35
- ],
36
- },
37
- checking: {
38
- always: [
39
- {
40
- target: 'calculated',
41
- actions: 'setResultFromLocal',
42
- cond: 'isFound',
43
- },
44
- {
45
- target: 'calculating',
46
- },
47
- ],
48
- },
49
- calculating: {
50
- invoke: {
51
- src: 'submitDeposit',
52
- onDone: {
53
- target: 'calculated',
54
- actions: 'setResult',
55
- },
56
- onError: {
57
- target: 'calculated',
58
- },
59
- },
60
- },
61
- calculated: {
62
- on: {
63
- SET_NETWORK: {
64
- target: 'checking',
65
- actions: 'setNetwork',
66
- },
67
- },
68
- },
69
- },
70
- },
71
- {
72
- actions: {
73
- setPayment: assign((context, event) => {
74
- const currentPayment = context.paymentDetail.find(
75
- (element) => element.transferType === 'deposit' && element.category === context.currentCategory
76
- )
77
- const defaultNetworks = currentPayment.networkName.map((value, i) => {
78
- return {
79
- label: currentPayment.networkOptional?.[i],
80
- value,
81
- icon: value,
82
- }
83
- })
84
- return {
85
- networks: defaultNetworks,
86
- selectedNetwork: defaultNetworks[0],
87
- currentPayment,
88
- }
89
- }),
90
- setNetwork: assign((context, event) => {
91
- return { selectedNetwork: event.data }
92
- }),
93
- setResultFromLocal: assign((context, event) => {
94
- const { resultMap, selectedNetwork } = context
95
- return { result: resultMap[selectedNetwork.value] }
96
- }),
97
- setResult: assign((context, event) => {
98
- const { resultMap, selectedNetwork } = context
99
- const { action, cdtime, accountNumber, currency, network, name, qrcode } = event.data
100
- const result = {
101
- action,
102
- cdtime,
103
- accountNumber,
104
- currency,
105
- network,
106
- name,
107
- qrcode,
108
- }
109
- return {
110
- result,
111
- resultMap: {
112
- ...resultMap,
113
- [selectedNetwork.value]: result,
114
- },
115
- }
116
- }),
117
- },
118
- guards: {
119
- isFound: (context, event) => {
120
- const { resultMap, selectedNetwork } = context
121
- return resultMap[selectedNetwork.value]
122
- },
123
- },
124
- services: {
125
- submitDeposit: async (context, event) => {
126
- const { currentPayment, selectedNetwork } = context
127
- return await request.send(
128
- payment.submitDepositTransactionCrypto({
129
- method: currentPayment.method,
130
- cryptoCurrency: currentPayment.channel,
131
- cryptoNetwork: selectedNetwork.value,
132
- })
133
- )
134
- },
135
- },
136
- }
137
- )
138
- }
@@ -1,359 +0,0 @@
1
- import { assign, createMachine } from 'xstate'
2
- import payment from '../../api/payment.js'
3
- import common from '../../api/common.js'
4
-
5
- export default function (request) {
6
- const { appSecret } = request.config
7
- return createMachine(
8
- {
9
- id: 'vpay',
10
- initial: 'loading',
11
- context: {
12
- method: 'vpay',
13
- userAccount: {},
14
- siteConfig: null,
15
- amount: 0,
16
-
17
- bankList: [],
18
- options: [],
19
- minimum: 0,
20
- maximum: 0,
21
-
22
- calculation: null,
23
-
24
- qrcode: null,
25
- vpayId: null,
26
- calculatedAmount: 0,
27
-
28
- grandTotalEnable: 1,
29
-
30
- promotion: null,
31
- bonusPreviewData: [],
32
- },
33
- states: {
34
- loading: {
35
- initial: 'checkingUserAccount',
36
- states: {
37
- checkingUserAccount: {
38
- invoke: {
39
- src: 'fetchPaymentInfo',
40
- onDone: [
41
- {
42
- target: 'initializing',
43
- actions: 'setUserAccount',
44
- cond: 'hasUserAccount',
45
- },
46
- { target: '#vpay.accountUnbound' },
47
- ],
48
- onError: {
49
- target: '#vpay.unavailable',
50
- },
51
- },
52
- },
53
- initializing: {
54
- invoke: {
55
- src: 'initialize',
56
- onDone: [
57
- {
58
- target: '#vpay.submitted',
59
- actions: ['setInitialization', 'setPreviousOrder'],
60
- cond: 'hasPreviousOrder',
61
- },
62
- { target: '#vpay.checking', actions: 'setInitialization' },
63
- ],
64
- onError: {
65
- target: '#vpay.unavailable',
66
- },
67
- },
68
- },
69
- },
70
- },
71
- checking: {
72
- always: [
73
- {
74
- target: 'fetching',
75
- cond: (context, event) => {
76
- const { siteConfig = {}, promotion = {} } = context
77
- const { walletMode = '', bonusPreviewEnable = '0' } = siteConfig
78
- return walletMode === '4' && bonusPreviewEnable === '1' && promotion.activityNo != 'none'
79
- },
80
- },
81
- { target: 'loaded' },
82
- ],
83
- },
84
- fetching: {
85
- invoke: {
86
- src: 'fetchBonusPreview',
87
- onDone: {
88
- target: 'loaded',
89
- actions: 'setBonusPreview',
90
- },
91
- onError: {
92
- target: 'loaded',
93
- },
94
- },
95
- },
96
- loaded: {
97
- entry: 'reset',
98
- on: {
99
- SELECT_AMOUNT: [
100
- {
101
- target: 'debouncing',
102
- actions: 'addAmount',
103
- cond: 'isGrandTotalEnable',
104
- },
105
- {
106
- target: 'debouncing',
107
- actions: 'setAmount',
108
- },
109
- ],
110
- KEY_IN: {
111
- target: 'calculating',
112
- actions: 'setAmount',
113
- },
114
- CLEAR_CALCULATION: {
115
- target: 'debouncing',
116
- actions: 'clearCalculation',
117
- },
118
- },
119
- },
120
- debouncing: {
121
- on: {
122
- SELECT_AMOUNT: [
123
- {
124
- target: 'debouncing',
125
- actions: 'addAmount',
126
- cond: 'isGrandTotalEnable',
127
- },
128
- {
129
- target: 'debouncing',
130
- actions: 'setAmount',
131
- },
132
- ],
133
- KEY_IN: {
134
- target: 'debouncing',
135
- actions: 'setAmount',
136
- },
137
- },
138
- after: {
139
- 1000: {
140
- target: 'calculating',
141
- },
142
- },
143
- },
144
- calculable: {
145
- entry: 'clearCalculation',
146
- on: {
147
- SELECT_AMOUNT: [
148
- {
149
- target: 'debouncing',
150
- actions: 'addAmount',
151
- cond: 'isGrandTotalEnable',
152
- },
153
- {
154
- target: 'debouncing',
155
- actions: 'setAmount',
156
- },
157
- ],
158
- KEY_IN: {
159
- target: 'debouncing',
160
- actions: 'setAmount',
161
- },
162
- CLEAR_CALCULATION: {
163
- target: 'debouncing',
164
- actions: 'clearCalculation',
165
- },
166
- CLEAR: {
167
- actions: 'setAmount',
168
- },
169
- },
170
- },
171
- calculating: {
172
- invoke: {
173
- src: 'fetchCalculation',
174
- onDone: {
175
- target: 'calculated',
176
- actions: 'setCalculation',
177
- },
178
- onError: {
179
- target: 'calculable',
180
- },
181
- },
182
- },
183
- calculated: {
184
- on: {
185
- SELECT_AMOUNT: [
186
- {
187
- target: 'debouncing',
188
- actions: 'addAmount',
189
- cond: 'isGrandTotalEnable',
190
- },
191
- {
192
- target: 'debouncing',
193
- actions: 'setAmount',
194
- },
195
- ],
196
- KEY_IN: {
197
- target: 'debouncing',
198
- actions: 'setAmount',
199
- },
200
- CONFIRM: {
201
- target: 'submitting',
202
- },
203
- CLEAR_CALCULATION: {
204
- target: 'debouncing',
205
- actions: 'clearCalculation',
206
- },
207
- CLEAR: {
208
- actions: 'setAmount',
209
- },
210
- },
211
- },
212
- submitting: {
213
- invoke: {
214
- src: 'submitDeposit',
215
- onDone: {
216
- target: 'submitted',
217
- actions: 'setOrder',
218
- },
219
- onError: {
220
- target: 'calculated',
221
- },
222
- },
223
- },
224
- submitted: {},
225
- accountUnbound: {},
226
- unavailable: {},
227
- },
228
- on: {
229
- SET_PROMOTION: {
230
- actions: 'setPromotion',
231
- },
232
- },
233
- },
234
- {
235
- actions: {
236
- setUserAccount: assign((context, event) => {
237
- return {
238
- userAccount: event.data?.[0],
239
- }
240
- }),
241
- setBonusPreview: assign((context, event) => {
242
- return {
243
- bonusPreviewData: event.data.bonus,
244
- }
245
- }),
246
- setOrder: assign((context, event) => {
247
- const { amount, qrcode, vpayId } = event.data
248
- return {
249
- qrcode,
250
- vpayId,
251
- calculatedAmount: amount,
252
- }
253
- }),
254
- setPreviousOrder: assign((context, event) => {
255
- const { amount, qrcode, vpayId } = event.data.order
256
- return {
257
- qrcode,
258
- vpayId,
259
- calculatedAmount: amount,
260
- }
261
- }),
262
- setInitialization: assign((context, event) => {
263
- const { siteConfig, housePayment, bankList } = event.data
264
- const { optional, minimum, maximum, grandTotalEnable } = housePayment
265
- return {
266
- siteConfig,
267
- options: optional,
268
- minimum,
269
- maximum,
270
- bankList,
271
- grandTotalEnable,
272
- }
273
- }),
274
- setPromotion: assign((context, event) => {
275
- const promotion = event.data
276
- return {
277
- promotion,
278
- }
279
- }),
280
- addAmount: assign((context, event) => {
281
- const { amount, maximum } = context
282
- return {
283
- amount: Math.min(amount + event.data, maximum),
284
- }
285
- }),
286
- setAmount: assign((context, event) => {
287
- return { amount: event.data }
288
- }),
289
- setCalculation: assign((context, event) => {
290
- return {
291
- calculation: event.data,
292
- }
293
- }),
294
- clearCalculation: assign((context, event) => {
295
- return {
296
- calculation: null,
297
- }
298
- }),
299
- },
300
- guards: {
301
- hasUserAccount: (context, event) => {
302
- return event.data?.[0]
303
- },
304
- hasPreviousOrder: (context, event) => {
305
- return event.data.order?.qrcode
306
- },
307
- isGrandTotalEnable: (context, event) => {
308
- return context.grandTotalEnable === 1
309
- },
310
- },
311
- services: {
312
- fetchPaymentInfo: async (context, event) => {
313
- const { bankInfo } = await request.send(payment.getPaymentInfo())
314
- const filterArray = bankInfo?.filter((item) => item.bindingType !== 'CRYPTO' && item.bindingType !== 'EWALLET')
315
- return filterArray || []
316
- },
317
- initialize: async (context, event) => {
318
- const [{ config }, payments, bankList, order] = await Promise.all([
319
- request.send(common.getConfig({ appSecret })),
320
- request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' })),
321
- request.send(payment.getBankList('amb')),
322
- request.send(payment.checkTransaction(context.method)),
323
- ])
324
- const siteConfig = JSON.parse(window.atob(config))
325
- return { siteConfig, housePayment: payments.find((payment) => payment.method === context.method), bankList, order }
326
- },
327
- fetchBonusPreview: async (context, event) => {
328
- const { method, promotion } = context
329
- return await request.send(
330
- payment.getBonusPreview({
331
- method,
332
- promotionsNo: promotion?.activityNo,
333
- })
334
- )
335
- },
336
- submitDeposit: async (context, event) => {
337
- const { method, amount, promotion } = context
338
- return await request.send(
339
- payment.submitDepositTransaction({
340
- method,
341
- amount,
342
- promotionsNo: promotion?.activityNo,
343
- })
344
- )
345
- },
346
- fetchCalculation: async (context, event) => {
347
- const { method, amount, promotion } = context
348
- return await request.send(
349
- payment.getDepositExpectedResult({
350
- method,
351
- amount,
352
- promotionsNo: promotion?.activityNo,
353
- })
354
- )
355
- },
356
- },
357
- }
358
- )
359
- }
@@ -1,57 +0,0 @@
1
- import { assign, createMachine } from 'xstate'
2
- import game from '../api/game.js'
3
-
4
- export default function (request, context) {
5
- const { appSecret } = request.config
6
- const { gameCode } = context
7
- return createMachine(
8
- {
9
- id: 'game_info',
10
- initial: 'fetching',
11
- context: {
12
- gameInfo: {},
13
- },
14
- states: {
15
- fetching: {
16
- invoke: {
17
- src: 'fetchGameInfo',
18
- onDone: {
19
- target: 'idle',
20
- actions: 'setGameInfo',
21
- },
22
- onError: {
23
- target: 'idle',
24
- },
25
- },
26
- },
27
- idle: {
28
- // on: {
29
- // SET_GAME_CODE: {
30
- // actions: 'setGameCode',
31
- // },
32
- // },
33
- },
34
- },
35
- },
36
- {
37
- actions: {
38
- setGameInfo: assign((context, event) => {
39
- return {
40
- gameInfo: event.data.data,
41
- }
42
- }),
43
- // setGameCode: assign((context, event) => {
44
- // return {
45
- // gameCode: event.data.data,
46
- // }
47
- // }),
48
- },
49
- services: {
50
- // 取得遊戲資訊
51
- fetchGameInfo: async (context, event) => {
52
- return await request.send(game.getGameInfo({ appSecret, gameCode }))
53
- },
54
- },
55
- }
56
- )
57
- }