@jetthai/cuora 1.0.205 → 1.0.302-dev-1

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/.husky/pre-commit +4 -0
  2. package/.prettierignore +1 -0
  3. package/CHANGELOG.md +846 -0
  4. package/README.md +6 -0
  5. package/package.json +6 -9
  6. package/src/api/activity.js +43 -2
  7. package/src/api/auth.js +22 -7
  8. package/src/api/common.js +3 -1
  9. package/src/api/game.js +20 -7
  10. package/src/api/mailbox.js +9 -5
  11. package/src/api/payment.js +167 -19
  12. package/src/api/user.js +7 -0
  13. package/src/lib/fingerprint.js +9779 -0
  14. package/src/machine/activity/activity.js +111 -26
  15. package/src/machine/activity/activity_cash.js +159 -0
  16. package/src/machine/activity/cash_rain_activity.js +153 -0
  17. package/src/machine/activity/continue_deposit_activity.js +11 -2
  18. package/src/machine/activity/deposit_activity.js +13 -4
  19. package/src/machine/activity/diamond_shop_activity_cash.js +179 -0
  20. package/src/machine/activity/diamond_shop_activity_vn.js +54 -89
  21. package/src/machine/activity/fafafa_activity.js +34 -19
  22. package/src/machine/activity/{affiliate_invite_friends_activity.js → friend_invite_friends_activity.js} +70 -41
  23. package/src/machine/activity/index.js +22 -4
  24. package/src/machine/activity/instant_rebate_activity.js +217 -0
  25. package/src/machine/activity/invite_friends_activity.js +14 -14
  26. package/src/machine/activity/jackpot.js +74 -0
  27. package/src/machine/activity/otp_verified_activity.js +74 -0
  28. package/src/machine/activity/ranking_activity.js +11 -2
  29. package/src/machine/activity/roulette_activity_v2.js +90 -0
  30. package/src/machine/activity/sign_in_activity.js +21 -14
  31. package/src/machine/activity/sign_in_monthly_activity.js +65 -0
  32. package/src/machine/activity/specify_bets_activity.js +25 -3
  33. package/src/machine/activity/specify_turnover_activity.js +25 -3
  34. package/src/machine/activity/time_bomb_activity.js +11 -2
  35. package/src/machine/activity/vip_card_activity.js +140 -0
  36. package/src/machine/auth.js +141 -27
  37. package/src/machine/auth_otp_v2.js +10 -4
  38. package/src/machine/auth_otp_v3.js +11 -3
  39. package/src/machine/bank_binding.js +112 -12
  40. package/src/machine/bank_binding_amb.js +145 -0
  41. package/src/machine/common.js +113 -25
  42. package/src/machine/deposit/amb.js +92 -0
  43. package/src/machine/deposit/crypto.js +50 -29
  44. package/src/machine/deposit/crypto_bank.js +317 -0
  45. package/src/machine/deposit/crypto_bank_cash.js +287 -0
  46. package/src/machine/deposit/crypto_button.js +174 -39
  47. package/src/machine/deposit/crypto_cash.js +255 -0
  48. package/src/machine/deposit/crypto_qrcode.js +148 -0
  49. package/src/machine/deposit/crypto_qrcode_cash.js +131 -0
  50. package/src/machine/deposit/crypto_way.js +239 -0
  51. package/src/machine/deposit/crypto_way_cash.js +256 -0
  52. package/src/machine/deposit/deposit_fc.js +8 -5
  53. package/src/machine/deposit/direct.js +111 -16
  54. package/src/machine/deposit/direct_cash.js +217 -0
  55. package/src/machine/deposit/float.js +366 -0
  56. package/src/machine/deposit/index.js +43 -2
  57. package/src/machine/deposit/krway.js +151 -0
  58. package/src/machine/deposit/loadcard_cash.js +207 -0
  59. package/src/machine/deposit/loadcard_vn.js +191 -43
  60. package/src/machine/deposit/manual_cash.js +356 -0
  61. package/src/machine/deposit/manual_vn.js +182 -60
  62. package/src/machine/deposit/qrcode_cash.js +217 -0
  63. package/src/machine/deposit/qrcode_v2.js +285 -52
  64. package/src/machine/deposit/usdt.js +144 -0
  65. package/src/machine/deposit/usdt_cash.js +138 -0
  66. package/src/machine/deposit/vpay.js +359 -0
  67. package/src/machine/game_favorite_v2.js +70 -28
  68. package/src/machine/game_info.js +57 -0
  69. package/src/machine/game_search_cash.js +390 -0
  70. package/src/machine/game_search_v2.js +64 -24
  71. package/src/machine/game_v2_1.js +662 -0
  72. package/src/machine/honor_board_cash.js +63 -0
  73. package/src/machine/inbox.js +259 -34
  74. package/src/machine/index.js +24 -17
  75. package/src/machine/leaderboard.js +31 -8
  76. package/src/machine/navbar.js +57 -0
  77. package/src/machine/promotions.js +171 -0
  78. package/src/machine/reward.js +74 -7
  79. package/src/machine/reward_cash.js +219 -0
  80. package/src/machine/roulette_v2.js +276 -0
  81. package/src/machine/setting.js +5 -2
  82. package/src/machine/side_cash.js +110 -0
  83. package/src/machine/side_v2.js +33 -28
  84. package/src/machine/user_photo.js +65 -0
  85. package/src/machine/user_sign_up.js +117 -17
  86. package/src/machine/withdraw/index.js +23 -0
  87. package/src/machine/{withdraw_vn.js → withdraw/withdraw_amb.js} +146 -78
  88. package/src/machine/{withdraw_crypto.js → withdraw/withdraw_crypto.js} +220 -69
  89. package/src/machine/withdraw/withdraw_crypto2.js +540 -0
  90. package/src/machine/withdraw/withdraw_crypto_cash.js +319 -0
  91. package/src/machine/{withdraw_fc.js → withdraw/withdraw_fc.js} +2 -2
  92. package/src/machine/withdraw/withdraw_krway.js +207 -0
  93. package/src/machine/withdraw/withdraw_manual.js +595 -0
  94. package/src/machine/withdraw/withdraw_manual_cash.js +303 -0
  95. package/src/machine/withdraw/withdraw_vn.js +533 -0
  96. package/src/machine/withdraw/withdraw_vn2.js +548 -0
  97. package/src/request/request.js +10 -5
  98. package/src/util/constant.js +19 -1
  99. package/src/util/deviceToken.js +18 -8
  100. package/src/util/index.js +2 -1
  101. package/src/util/math.js +4 -0
  102. package/src/util/storage.js +22 -22
  103. package/dist/bundle.mjs +0 -18462
  104. package/rollup.config.js +0 -16
  105. package/src/machine/auth_otp.js +0 -201
  106. package/src/machine/deposit/qrcode_vn.js +0 -206
  107. package/src/machine/game.js +0 -285
  108. package/src/machine/game_favorite.js +0 -123
  109. package/src/machine/game_search.js +0 -244
  110. package/src/machine/game_v2.js +0 -356
@@ -1,12 +1,15 @@
1
1
  import { assign, createMachine } from 'xstate'
2
2
  import payment from '../../api/payment.js'
3
+ import common from '../../api/common.js'
3
4
 
4
5
  export default function (request) {
6
+ const { appSecret } = request.config
5
7
  return createMachine(
6
8
  {
7
9
  id: 'loadcard',
8
10
  initial: 'loading',
9
11
  context: {
12
+ siteConfig: null,
10
13
  cards: [],
11
14
  options: [],
12
15
 
@@ -17,17 +20,22 @@ export default function (request) {
17
20
 
18
21
  calculation: null,
19
22
 
20
- paymentDetails: [],
23
+ paymentDetail: [],
21
24
  currentCategory: 'loadcard',
22
25
  currentMethod: null,
23
26
  currentPayment: null,
27
+ result: null,
28
+
29
+ // use for wallet mode 4
30
+ promotion: null,
31
+ bonusPreviewData: [],
24
32
  },
25
33
  states: {
26
34
  loading: {
27
35
  invoke: {
28
36
  src: 'fetchInitData',
29
37
  onDone: {
30
- target: 'loaded',
38
+ target: 'checking',
31
39
  actions: 'setInitData',
32
40
  },
33
41
  onError: {
@@ -35,71 +43,152 @@ export default function (request) {
35
43
  },
36
44
  },
37
45
  },
46
+ checking: {
47
+ always: [
48
+ {
49
+ target: 'fetching',
50
+ cond: (context, event) => {
51
+ const { siteConfig = {}, promotion = {}, selectedCard } = context
52
+ const { walletMode = '', bonusPreviewEnable = '0' } = siteConfig
53
+ return !!selectedCard && walletMode === '4' && bonusPreviewEnable === '1' && promotion.activityNo != 'none'
54
+ },
55
+ },
56
+ { target: 'loaded' },
57
+ ],
58
+ },
59
+ fetching: {
60
+ invoke: {
61
+ src: 'fetchBonusPreview',
62
+ onDone: {
63
+ target: 'loaded',
64
+ actions: 'setBonusPreview',
65
+ },
66
+ onError: {
67
+ target: 'loaded',
68
+ },
69
+ },
70
+ },
71
+ fail: {},
38
72
  loaded: {
39
73
  entry: 'reset',
40
74
  on: {
41
- SELECT_CARD: {
42
- actions: 'setCard',
43
- },
44
- SELECT_AMOUNT: {
45
- target: 'debouncing',
46
- actions: 'setAmount',
47
- },
75
+ SELECT_CARD: [
76
+ {
77
+ target: 'fetching',
78
+ actions: 'setCard',
79
+ cond: (context, event) => {
80
+ const { siteConfig = {}, promotion = {} } = context
81
+ const { walletMode = '', bonusPreviewEnable = '0' } = siteConfig
82
+ return walletMode === '4' && bonusPreviewEnable === '1' && promotion.activityNo != 'none'
83
+ },
84
+ },
85
+ {
86
+ actions: 'setCard',
87
+ },
88
+ ],
89
+ SELECT_AMOUNT: [
90
+ {
91
+ target: 'pending',
92
+ actions: 'setAmount',
93
+ cond: 'isFreeWalletMode',
94
+ },
95
+ {
96
+ target: 'debouncing',
97
+ actions: 'setAmount',
98
+ },
99
+ ],
48
100
  },
49
101
  },
50
- debouncing: {
102
+ pending: {
51
103
  on: {
52
104
  SELECT_AMOUNT: {
53
- target: 'debouncing',
54
105
  actions: 'setAmount',
55
106
  },
107
+ CONFIRM: {
108
+ target: 'debouncing',
109
+ },
56
110
  BACK: {
57
111
  target: 'loaded',
58
112
  },
59
113
  },
60
- after: {
61
- 1000: {
62
- target: 'calculating',
63
- },
64
- },
65
114
  },
66
- fail: {},
67
- calculable: {
68
- entry: 'clearCalculation',
115
+ debouncing: {
69
116
  on: {
70
117
  SELECT_AMOUNT: {
71
118
  target: 'debouncing',
72
119
  actions: 'setAmount',
73
120
  },
74
- CALCULATE: {
75
- target: 'debouncing',
76
- },
77
121
  BACK: {
78
122
  target: 'loaded',
79
123
  },
80
124
  },
125
+ after: {
126
+ 1000: {
127
+ target: 'calculating',
128
+ },
129
+ },
81
130
  },
82
131
  calculating: {
83
132
  invoke: {
84
133
  src: 'fetchCalculation',
85
- onDone: {
86
- target: 'calculated',
87
- actions: 'setCalculation',
88
- },
134
+ onDone: [
135
+ {
136
+ target: 'submitting',
137
+ actions: 'setCalculation',
138
+ cond: (context, event) => {
139
+ const { siteConfig = {}, selectedCard = {} } = context
140
+ return siteConfig.walletMode === '2' && selectedCard.jumpLinkEnable === 1
141
+ },
142
+ },
143
+ {
144
+ target: 'cardInfo',
145
+ actions: 'setCalculation',
146
+ cond: 'isFreeWalletMode',
147
+ },
148
+ {
149
+ target: 'calculated',
150
+ actions: 'setCalculation',
151
+ },
152
+ ],
89
153
  onError: {
90
154
  target: 'calculable',
91
155
  },
92
156
  },
93
157
  },
158
+ calculable: {
159
+ entry: 'clearCalculation',
160
+ on: {
161
+ SELECT_AMOUNT: [
162
+ {
163
+ target: 'pending',
164
+ actions: 'setAmount',
165
+ cond: 'isFreeWalletMode',
166
+ },
167
+ {
168
+ target: 'debouncing',
169
+ actions: 'setAmount',
170
+ },
171
+ ],
172
+ BACK: {
173
+ target: 'loaded',
174
+ },
175
+ },
176
+ },
94
177
  calculated: {
95
178
  on: {
96
179
  SELECT_AMOUNT: {
97
180
  target: 'debouncing',
98
181
  actions: 'setAmount',
99
182
  },
100
- CONFIRM: {
101
- target: 'cardInfo',
102
- },
183
+ CONFIRM: [
184
+ {
185
+ target: 'submitting',
186
+ cond: 'jumpLinkEnable',
187
+ },
188
+ {
189
+ target: 'cardInfo',
190
+ },
191
+ ],
103
192
  BACK: {
104
193
  target: 'loaded',
105
194
  },
@@ -121,10 +210,21 @@ export default function (request) {
121
210
  target: 'submitting',
122
211
  cond: 'isSubmittable',
123
212
  },
124
- SELECT_CARD: {
125
- target: 'loaded',
126
- actions: 'setCard',
127
- },
213
+ SELECT_CARD: [
214
+ {
215
+ target: 'fetching',
216
+ actions: 'setCard',
217
+ cond: (context, event) => {
218
+ const { siteConfig = {}, promotion = {} } = context
219
+ const { walletMode = '', bonusPreviewEnable = '0' } = siteConfig
220
+ return walletMode === '4' && bonusPreviewEnable === '1' && promotion.activityNo != 'none'
221
+ },
222
+ },
223
+ {
224
+ target: 'loaded',
225
+ actions: 'setCard',
226
+ },
227
+ ],
128
228
  },
129
229
  },
130
230
  submitting: {
@@ -132,9 +232,10 @@ export default function (request) {
132
232
  src: 'submitDeposit',
133
233
  onDone: {
134
234
  target: 'submitted',
235
+ actions: 'setResult',
135
236
  },
136
237
  onError: {
137
- target: 'cardInfo',
238
+ target: 'loaded',
138
239
  },
139
240
  },
140
241
  },
@@ -146,6 +247,11 @@ export default function (request) {
146
247
  },
147
248
  },
148
249
  },
250
+ on: {
251
+ SET_PROMOTION: {
252
+ actions: 'setPromotion',
253
+ },
254
+ },
149
255
  },
150
256
  {
151
257
  actions: {
@@ -155,17 +261,25 @@ export default function (request) {
155
261
  cardNumber: null,
156
262
  serialNumber: null,
157
263
  calculation: null,
264
+ result: null,
158
265
  }
159
266
  }),
160
267
  setInitData: assign((context, event) => {
161
- const paymentDetails = event.data
162
- const cards = paymentDetails.filter((element) => element.category === context.currentCategory)
268
+ const { siteConfig, paymentDetail } = event.data
269
+ const cards = paymentDetail.filter((element) => element.category === context.currentCategory)
270
+ const selectedCard = cards[0]
163
271
  return {
164
- paymentDetails,
272
+ siteConfig,
273
+ paymentDetail,
165
274
  cards,
166
- selectedCard: cards[0],
167
- currentMethod: cards[0].method,
168
- options: cards[0].optional
275
+ selectedCard,
276
+ currentMethod: selectedCard?.method,
277
+ options: selectedCard?.optional,
278
+ }
279
+ }),
280
+ setBonusPreview: assign((context, event) => {
281
+ return {
282
+ bonusPreviewData: event.data.bonus,
169
283
  }
170
284
  }),
171
285
  setCard: assign((context, event) => {
@@ -198,28 +312,61 @@ export default function (request) {
198
312
  calculation: null,
199
313
  }
200
314
  }),
315
+ setResult: assign((context, event) => {
316
+ return {
317
+ result: event.data,
318
+ }
319
+ }),
320
+ setPromotion: assign((context, event) => {
321
+ const promotion = event.data
322
+ return {
323
+ promotion,
324
+ }
325
+ }),
201
326
  },
202
327
  guards: {
328
+ isFreeWalletMode: (context, event) => {
329
+ return context.siteConfig?.walletMode === '2'
330
+ },
203
331
  isSubmittable: (context, event) => {
204
332
  const { cardNumber, serialNumber } = context
205
333
  return cardNumber && serialNumber
206
334
  },
335
+ jumpLinkEnable: (context, event) => {
336
+ const { selectedCard } = context
337
+ return selectedCard.jumpLinkEnable === 1
338
+ },
207
339
  },
208
340
  services: {
209
341
  fetchInitData: async (context, event) => {
210
- return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
342
+ const [{ config }, paymentDetail = []] = await Promise.all([
343
+ request.send(common.getConfig({ appSecret })),
344
+ request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' })),
345
+ ])
346
+ const siteConfig = JSON.parse(window.atob(config))
347
+ return { siteConfig, paymentDetail }
348
+ },
349
+ fetchBonusPreview: async (context, event) => {
350
+ const { currentMethod, promotion } = context
351
+ return await request.send(
352
+ payment.getBonusPreview({
353
+ method: currentMethod,
354
+ promotionsNo: promotion?.activityNo,
355
+ })
356
+ )
211
357
  },
212
358
  fetchCalculation: async (context, event) => {
213
- const { currentMethod, selectedAmount } = context
359
+ const { currentMethod, selectedAmount, promotion } = context
214
360
  return await request.send(
215
361
  payment.getDepositExpectedResult({
216
362
  method: currentMethod,
217
363
  amount: selectedAmount,
364
+ promotionsNo: promotion?.activityNo,
218
365
  })
219
366
  )
220
367
  },
221
368
  submitDeposit: async (context, event) => {
222
- const { currentMethod, selectedCard, selectedAmount, cardNumber, serialNumber } = context
369
+ const { currentMethod, selectedCard, selectedAmount, cardNumber, serialNumber, promotion } = context
223
370
  return await request.send(
224
371
  payment.submitDepositTransactionLoadcard({
225
372
  method: currentMethod,
@@ -227,6 +374,7 @@ export default function (request) {
227
374
  card_type: selectedCard.channel_id,
228
375
  card_code: cardNumber,
229
376
  card_seri: serialNumber,
377
+ promotionsNo: promotion?.activityNo,
230
378
  })
231
379
  )
232
380
  },