@jetthai/cuora 1.1.488 → 1.2.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 (128) hide show
  1. package/.husky/pre-commit +3 -1
  2. package/CHANGELOG.md +0 -349
  3. package/README.md +15 -299
  4. package/package.json +3 -6
  5. package/resetGitBranch.sh +101 -0
  6. package/src/api/activity.js +39 -24
  7. package/src/api/auth.js +35 -4
  8. package/src/api/common.js +1 -8
  9. package/src/api/game.js +10 -0
  10. package/src/api/index.js +1 -3
  11. package/src/api/payment.js +55 -17
  12. package/src/api/user.js +16 -11
  13. package/src/index.js +2 -2
  14. package/src/lib/fingerprint_v3_11_12.js +11433 -0
  15. package/src/machine/activity/activity.js +209 -0
  16. package/src/machine/activity/activity_cash.js +18 -71
  17. package/src/machine/activity/diamond_shop_activity_cash.js +1 -0
  18. package/src/machine/activity/diamond_shop_activity_fc.js +196 -0
  19. package/src/machine/activity/diamond_shop_activity_vn.js +178 -0
  20. package/src/machine/activity/fafafa_activity.js +10 -0
  21. package/src/machine/activity/index.js +12 -0
  22. package/src/machine/activity/invite_friends_activity.js +114 -0
  23. package/src/machine/activity/mini_game_activity.js +68 -0
  24. package/src/machine/activity/return_bonus_activity.js +153 -0
  25. package/src/machine/activity/roulette_activity_v2.js +0 -5
  26. package/src/machine/auth.js +109 -158
  27. package/src/machine/auth_otp_v2.js +177 -0
  28. package/src/machine/auth_otp_v3.js +32 -111
  29. package/src/machine/bank_binding.js +2 -2
  30. package/src/machine/bank_binding_amb.js +145 -0
  31. package/src/machine/bonus.js +75 -0
  32. package/src/machine/common.js +91 -27
  33. package/src/machine/deposit/amb.js +92 -0
  34. package/src/machine/deposit/crypto_bank.js +325 -0
  35. package/src/machine/deposit/crypto_bank_cash.js +8 -19
  36. package/src/machine/deposit/crypto_qrcode.js +148 -0
  37. package/src/machine/deposit/crypto_qrcode_cash.js +41 -26
  38. package/src/machine/deposit/crypto_way.js +247 -0
  39. package/src/machine/deposit/crypto_way_cash.js +32 -52
  40. package/src/machine/deposit/deposit_fc.js +271 -0
  41. package/src/machine/deposit/direct.js +310 -0
  42. package/src/machine/deposit/direct_cash.js +9 -8
  43. package/src/machine/deposit/float.js +374 -0
  44. package/src/machine/deposit/index.js +28 -0
  45. package/src/machine/deposit/krway.js +151 -0
  46. package/src/machine/deposit/loadcard_cash.js +31 -14
  47. package/src/machine/deposit/loadcard_vn.js +351 -0
  48. package/src/machine/deposit/manual_cash.js +10 -8
  49. package/src/machine/deposit/manual_vn.js +458 -0
  50. package/src/machine/deposit/qrcode_cash.js +30 -14
  51. package/src/machine/deposit/qrcode_v2.js +338 -0
  52. package/src/machine/deposit/usdt.js +144 -0
  53. package/src/machine/deposit/virtual_bank_cash.js +2 -5
  54. package/src/machine/deposit/virtual_bank_vn.js +269 -0
  55. package/src/machine/deposit/vpay.js +367 -0
  56. package/src/machine/error.js +0 -7
  57. package/src/machine/game_hot_new.js +79 -0
  58. package/src/machine/game_info.js +12 -5
  59. package/src/machine/game_replay.js +46 -0
  60. package/src/machine/game_search_v2.js +401 -0
  61. package/src/machine/game_v2_1.js +88 -43
  62. package/src/machine/honor_board.js +132 -0
  63. package/src/machine/honor_board_cash.js +18 -15
  64. package/src/machine/inbox.js +12 -0
  65. package/src/machine/index.js +32 -0
  66. package/src/machine/leaderboard.js +11 -8
  67. package/src/machine/merge.js +57 -0
  68. package/src/machine/payment_data.js +86 -0
  69. package/src/machine/promotions.js +170 -0
  70. package/src/machine/ranking.js +25 -43
  71. package/src/machine/reward.js +255 -0
  72. package/src/machine/reward_cash.js +41 -2
  73. package/src/machine/reward_fc.js +98 -0
  74. package/src/machine/roulette_v2.js +25 -20
  75. package/src/machine/side.js +154 -0
  76. package/src/machine/side_cash.js +2 -3
  77. package/src/machine/side_v2.js +209 -0
  78. package/src/machine/user_reset_password.js +15 -4
  79. package/src/machine/user_sign_up.js +60 -46
  80. package/src/machine/vip_table.js +57 -0
  81. package/src/machine/websocket.js +325 -378
  82. package/src/machine/welcome.js +110 -0
  83. package/src/machine/withdraw/index.js +6 -0
  84. package/src/machine/withdraw/withdraw_crypto_cash.js +327 -0
  85. package/src/machine/withdraw/withdraw_krway.js +222 -0
  86. package/src/machine/withdraw/withdraw_manual.js +533 -0
  87. package/src/machine/withdraw/withdraw_manual_cash.js +38 -59
  88. package/src/request/config.js +0 -2
  89. package/src/request/request.js +62 -130
  90. package/src/util/constant.js +2 -6
  91. package/src/util/deviceToken.js +59 -0
  92. package/src/util/index.js +4 -2
  93. package/src/util/math.js +4 -0
  94. package/.claude/commands/sync-ai-prompts.md +0 -93
  95. package/.claude/settings.local.json +0 -23
  96. package/.github/copilot-instructions.md +0 -448
  97. package/.husky/post-checkout +0 -32
  98. package/.husky/pre-push +0 -36
  99. package/AGENTS.md +0 -448
  100. package/AI_PROMPT_SOURCE.md +0 -446
  101. package/CLAUDE.md +0 -448
  102. package/GEMINI.md +0 -448
  103. package/docs/kibana/crypto-way-deposit-amount-bug-analysis.md +0 -1003
  104. package/docs/kibana/play-providerId-error.md +0 -202
  105. package/docs/kibana/play-selectedWalletType.md +0 -1
  106. package/docs/kibana/play-selectedWalletType_2.md +0 -1
  107. package/docs/kibana/play-selectedWalletType_analysis.md +0 -565
  108. package/docs/my-claude/feat-sharon-JT-1790247240-socket/branch-transfer.md +0 -14
  109. package/docs/my-claude/feat-sharon-JT-1790247240-socket/cash-module-preparation.json +0 -40
  110. package/docs/my-claude/feat-sharon-JT-1790247240-socket/cash-module-verification.md +0 -41
  111. package/docs/my-claude/feat-sharon-JT-1790247240-socket/implementation-ledger.md +0 -87
  112. package/docs/my-claude/feat-sharon-JT-1790247240-socket/module-report.md +0 -73
  113. package/docs/my-claude/feat-sharon-JT-1790247240-socket/plan.md +0 -309
  114. package/docs/my-claude/feat-sharon-JT-1790247240-socket/test-cases.md +0 -245
  115. package/docs/my-claude/feat-sharon-JT-1791180540-onesignal/transfer.md +0 -9
  116. package/scripts/auto-version.js +0 -68
  117. package/scripts/auto-version.sh +0 -33
  118. package/scripts/branch-auto-npm-publish.js +0 -29
  119. package/scripts/check-version.sh +0 -36
  120. package/scripts/clean-tags.sh +0 -84
  121. package/src/api/account.js +0 -7
  122. package/src/api/otp.js +0 -5
  123. package/src/util/amount.js +0 -8
  124. package/src/util/err998SentryExtra.js +0 -26
  125. package/src/util/paramStore.js +0 -139
  126. package/src/util/socketPolicy.js +0 -57
  127. package/test/auth_otp_v3.test.js +0 -323
  128. package/tests/websocket.test.mjs +0 -779
@@ -0,0 +1,351 @@
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: 'loadcard',
10
+ initial: 'loading',
11
+ context: {
12
+ siteConfig: null,
13
+ cards: [],
14
+ options: [],
15
+
16
+ selectedCard: null,
17
+ selectedAmount: null,
18
+ cardNumber: null,
19
+ serialNumber: null,
20
+
21
+ calculation: null,
22
+
23
+ paymentDetail: [],
24
+ currentCategory: 'loadcard',
25
+ currentMethod: null,
26
+ currentPayment: null,
27
+ result: null,
28
+
29
+ // use for wallet mode 4
30
+ promotion: null,
31
+ bonusPreviewData: [],
32
+ },
33
+ states: {
34
+ loading: {
35
+ invoke: {
36
+ src: 'fetchInitData',
37
+ onDone: {
38
+ target: 'checking',
39
+ actions: 'setInitData',
40
+ },
41
+ onError: {
42
+ target: 'fail',
43
+ },
44
+ },
45
+ },
46
+ checking: {
47
+ always: [
48
+ {
49
+ target: 'fetching',
50
+ cond: (context, event) => {
51
+ const { siteConfig = {}, promotion = {}, selectedCard } = context
52
+ const { bonusPreviewEnable } = siteConfig
53
+ return !!selectedCard && bonusPreviewEnable && 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: {},
72
+ loaded: {
73
+ entry: 'reset',
74
+ on: {
75
+ SELECT_CARD: [
76
+ {
77
+ target: 'fetching',
78
+ actions: 'setCard',
79
+ cond: (context, event) => {
80
+ const { siteConfig = {}, promotion = {} } = context
81
+ const { bonusPreviewEnable } = siteConfig
82
+ return bonusPreviewEnable && promotion.activityNo != 'none'
83
+ },
84
+ },
85
+ {
86
+ actions: 'setCard',
87
+ },
88
+ ],
89
+ SELECT_AMOUNT: [
90
+ {
91
+ target: 'debouncing',
92
+ actions: 'setAmount',
93
+ },
94
+ ],
95
+ },
96
+ },
97
+ debouncing: {
98
+ on: {
99
+ SELECT_AMOUNT: {
100
+ target: 'debouncing',
101
+ actions: 'setAmount',
102
+ },
103
+ BACK: {
104
+ target: 'loaded',
105
+ },
106
+ },
107
+ after: {
108
+ 1000: {
109
+ target: 'calculating',
110
+ },
111
+ },
112
+ },
113
+ calculating: {
114
+ invoke: {
115
+ src: 'fetchCalculation',
116
+ onDone: [
117
+ {
118
+ target: 'calculated',
119
+ actions: 'setCalculation',
120
+ },
121
+ ],
122
+ onError: {
123
+ target: 'calculable',
124
+ },
125
+ },
126
+ },
127
+ calculable: {
128
+ entry: 'clearCalculation',
129
+ on: {
130
+ SELECT_AMOUNT: {
131
+ target: 'debouncing',
132
+ actions: 'setAmount',
133
+ },
134
+ BACK: {
135
+ target: 'loaded',
136
+ },
137
+ },
138
+ },
139
+ calculated: {
140
+ on: {
141
+ SELECT_AMOUNT: {
142
+ target: 'debouncing',
143
+ actions: 'setAmount',
144
+ },
145
+ CONFIRM: [
146
+ {
147
+ target: 'submitting',
148
+ cond: 'jumpLinkEnable',
149
+ },
150
+ {
151
+ target: 'cardInfo',
152
+ },
153
+ ],
154
+ BACK: {
155
+ target: 'loaded',
156
+ },
157
+ CLEAR_CALCULATION: {
158
+ target: 'debouncing',
159
+ actions: 'clearCalculation',
160
+ },
161
+ },
162
+ },
163
+ cardInfo: {
164
+ on: {
165
+ INPUT_CARD_NUMBER: {
166
+ actions: 'setCardNumber',
167
+ },
168
+ INPUT_SERIAL_NUMBER: {
169
+ actions: 'setSerialNumber',
170
+ },
171
+ SUBMIT: {
172
+ target: 'submitting',
173
+ cond: 'isSubmittable',
174
+ },
175
+ SELECT_CARD: [
176
+ {
177
+ target: 'fetching',
178
+ actions: 'setCard',
179
+ cond: (context, event) => {
180
+ const { siteConfig = {}, promotion = {} } = context
181
+ const { bonusPreviewEnable } = siteConfig
182
+ return bonusPreviewEnable && promotion.activityNo != 'none'
183
+ },
184
+ },
185
+ {
186
+ target: 'loaded',
187
+ actions: 'setCard',
188
+ },
189
+ ],
190
+ },
191
+ },
192
+ submitting: {
193
+ invoke: {
194
+ src: 'submitDeposit',
195
+ onDone: {
196
+ target: 'submitted',
197
+ actions: 'setResult',
198
+ },
199
+ onError: {
200
+ target: 'loaded',
201
+ },
202
+ },
203
+ },
204
+ submitted: {
205
+ on: {
206
+ BACK: {
207
+ target: 'loaded',
208
+ },
209
+ },
210
+ },
211
+ },
212
+ on: {
213
+ SET_PROMOTION: {
214
+ actions: 'setPromotion',
215
+ },
216
+ },
217
+ },
218
+ {
219
+ actions: {
220
+ reset: assign((context, event) => {
221
+ return {
222
+ selectedAmount: null,
223
+ cardNumber: null,
224
+ serialNumber: null,
225
+ calculation: null,
226
+ result: null,
227
+ }
228
+ }),
229
+ setInitData: assign((context, event) => {
230
+ const { siteConfig, paymentDetail } = event.data
231
+ const cards = paymentDetail.filter((element) => element.category === context.currentCategory)
232
+ const selectedCard = cards[0]
233
+ return {
234
+ siteConfig,
235
+ paymentDetail,
236
+ cards,
237
+ selectedCard,
238
+ currentMethod: selectedCard?.method,
239
+ options: selectedCard?.optional,
240
+ }
241
+ }),
242
+ setBonusPreview: assign((context, event) => {
243
+ return {
244
+ bonusPreviewData: event.data,
245
+ }
246
+ }),
247
+ setCard: assign((context, event) => {
248
+ return {
249
+ selectedCard: event.data,
250
+ currentMethod: event.data.method,
251
+ options: event.data.optional,
252
+ }
253
+ }),
254
+ setCardNumber: assign((context, event) => {
255
+ return {
256
+ cardNumber: event.data,
257
+ }
258
+ }),
259
+ setSerialNumber: assign((context, event) => {
260
+ return {
261
+ serialNumber: event.data,
262
+ }
263
+ }),
264
+ setAmount: assign((context, event) => {
265
+ return { selectedAmount: event.data }
266
+ }),
267
+ setCalculation: assign((context, event) => {
268
+ // V2接口轉換中回傳的資料結構不同
269
+ const { data } = event.data
270
+ if (data) {
271
+ return {
272
+ calculation: data,
273
+ }
274
+ } else {
275
+ return {
276
+ calculation: event.data,
277
+ }
278
+ }
279
+ }),
280
+ clearCalculation: assign((context, event) => {
281
+ return {
282
+ calculation: null,
283
+ }
284
+ }),
285
+ setResult: assign((context, event) => {
286
+ return {
287
+ result: event.data,
288
+ }
289
+ }),
290
+ setPromotion: assign((context, event) => {
291
+ const promotion = event.data
292
+ return {
293
+ promotion,
294
+ }
295
+ }),
296
+ },
297
+ guards: {
298
+ isSubmittable: (context, event) => {
299
+ const { cardNumber, serialNumber } = context
300
+ return cardNumber && serialNumber
301
+ },
302
+ jumpLinkEnable: (context, event) => {
303
+ const { selectedCard } = context
304
+ return selectedCard.jumpLinkEnable === 1
305
+ },
306
+ },
307
+ services: {
308
+ fetchInitData: async (context, event) => {
309
+ const [{ config }, paymentDetail = []] = await Promise.all([
310
+ request.send(common.getConfig({ appSecret })),
311
+ request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' })),
312
+ ])
313
+ const siteConfig = JSON.parse(window.atob(config))
314
+ return { siteConfig, paymentDetail }
315
+ },
316
+ fetchBonusPreview: async (context, event) => {
317
+ const { currentMethod, promotion } = context
318
+ return await request.send(
319
+ payment.getBonusPreview({
320
+ method: currentMethod,
321
+ promotionsNo: promotion?.activityNo,
322
+ })
323
+ )
324
+ },
325
+ fetchCalculation: async (context, event) => {
326
+ const { currentMethod, selectedAmount, promotion } = context
327
+ return await request.send(
328
+ payment.getDepositExpectedResult({
329
+ method: currentMethod,
330
+ amount: Number(selectedAmount),
331
+ promotionsNo: promotion?.activityNo,
332
+ })
333
+ )
334
+ },
335
+ submitDeposit: async (context, event) => {
336
+ const { currentMethod, selectedCard, selectedAmount, cardNumber, serialNumber, promotion } = context
337
+ return await request.send(
338
+ payment.submitDepositTransactionLoadcard({
339
+ method: currentMethod,
340
+ amount: selectedAmount,
341
+ card_type: selectedCard.channel_id,
342
+ card_code: cardNumber,
343
+ card_seri: serialNumber,
344
+ promotionsNo: promotion?.activityNo,
345
+ })
346
+ )
347
+ },
348
+ },
349
+ }
350
+ )
351
+ }
@@ -1,5 +1,6 @@
1
1
  import { assign, createMachine } from 'xstate'
2
2
  import payment from '../../api/payment.js'
3
+ import { max } from '../../util/index.js'
3
4
 
4
5
  export default function (request, context) {
5
6
  const { appSecret } = request.config
@@ -88,6 +89,9 @@ export default function (request, context) {
88
89
  INPUT_USER_ACCOUNT_BRANCH_NAME: {
89
90
  actions: 'setUserAccountBranchName',
90
91
  },
92
+ INPUT_USER_ACCOUNT_BRANCH_CODE: {
93
+ actions: 'setUserAccountBranchCode',
94
+ },
91
95
  INPUT_USER_ACCOUNT_NUMBER: {
92
96
  actions: 'setUserAccountNumber',
93
97
  },
@@ -130,7 +134,6 @@ export default function (request, context) {
130
134
  target: 'debouncing',
131
135
  actions: 'setPromotion',
132
136
  internal: false,
133
- cond: 'isPromotionChanged',
134
137
  },
135
138
  INPUT_AMOUNT: {
136
139
  target: 'debouncing',
@@ -138,9 +141,7 @@ export default function (request, context) {
138
141
  internal: false,
139
142
  },
140
143
  SELECT_HOUSE_BANK: {
141
- target: 'debouncing',
142
144
  actions: 'setHouseBank',
143
- internal: false,
144
145
  },
145
146
  },
146
147
  },
@@ -179,6 +180,7 @@ export default function (request, context) {
179
180
  method: currentPayment.method,
180
181
  processing,
181
182
  houseBanks,
183
+ selectedAmount: max(promotion?.minimumAmount, currentPayment?.minimum, selectedAmount, 0),
182
184
  selectedHouseBank: houseBanks[0],
183
185
  userBanks,
184
186
  selectedUserBank: userBanks[0],
@@ -192,7 +194,6 @@ export default function (request, context) {
192
194
  setHouseBank: assign((context, event) => {
193
195
  return {
194
196
  selectedHouseBank: event.data,
195
- calculation: null,
196
197
  }
197
198
  }),
198
199
  inputAmount: assign((context, event) => {
@@ -237,6 +238,11 @@ export default function (request, context) {
237
238
  userAccountBranchName: event.data,
238
239
  }
239
240
  }),
241
+ setUserAccountBranchCode: assign((context, event) => {
242
+ return {
243
+ userAccountBranchCode: event.data,
244
+ }
245
+ }),
240
246
  setUserAccountNumber: assign((context, event) => {
241
247
  return {
242
248
  userAccountNumber: event.data,
@@ -270,14 +276,10 @@ export default function (request, context) {
270
276
  setPromotion: assign((context, event) => {
271
277
  return {
272
278
  promotion: event.data,
273
- calculation: null,
274
279
  }
275
280
  }),
276
281
  },
277
282
  guards: {
278
- isPromotionChanged: (context, event) => {
279
- return event.data?.promotionsNo !== context.promotion?.promotionsNo
280
- },
281
283
  isCalculable: (context, event) => {
282
284
  const {
283
285
  selectedAmount,