@jetthai/cuora 1.1.474 → 1.1.476-dev.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 (86) hide show
  1. package/.claude/commands/sync-ai-prompts.md +88 -1
  2. package/.claude/settings.local.json +3 -1
  3. package/.github/copilot-instructions.md +66 -61
  4. package/.husky/post-checkout +3 -3
  5. package/.husky/pre-push +1 -1
  6. package/.prettierignore +2 -1
  7. package/AGENTS.md +67 -62
  8. package/AI_PROMPT_SOURCE.md +67 -62
  9. package/CHANGELOG.md +261 -6
  10. package/CLAUDE.md +67 -62
  11. package/GEMINI.md +67 -62
  12. package/README.md +11 -12
  13. package/package.json +1 -1
  14. package/prepare-for-pr/JT-1776243420.md +85 -0
  15. package/scripts/auto-version.js +1 -0
  16. package/scripts/branch-auto-npm-publish.js +9 -2
  17. package/src/api/account.js +0 -1
  18. package/src/api/activity.js +0 -37
  19. package/src/api/auth.js +0 -31
  20. package/src/api/game.js +0 -10
  21. package/src/api/payment.js +1 -52
  22. package/src/api/user.js +0 -16
  23. package/src/index.js +2 -2
  24. package/src/machine/activity/activity_cash.js +14 -1
  25. package/src/machine/activity/diamond_shop_activity_cash.js +0 -1
  26. package/src/machine/activity/fafafa_activity.js +0 -10
  27. package/src/machine/activity/index.js +0 -12
  28. package/src/machine/auth.js +37 -59
  29. package/src/machine/auth_otp_v3.js +30 -19
  30. package/src/machine/common.js +0 -55
  31. package/src/machine/deposit/index.js +0 -28
  32. package/src/machine/deposit/manual_cash.js +0 -8
  33. package/src/machine/game_info.js +1 -12
  34. package/src/machine/game_v2_1.js +1 -89
  35. package/src/machine/honor_board_cash.js +15 -18
  36. package/src/machine/inbox.js +0 -12
  37. package/src/machine/index.js +0 -32
  38. package/src/machine/reward_cash.js +0 -39
  39. package/src/machine/user_reset_password.js +0 -13
  40. package/src/machine/user_sign_up.js +3 -0
  41. package/src/machine/websocket.js +0 -4
  42. package/src/machine/withdraw/index.js +0 -6
  43. package/src/request/request.js +0 -28
  44. package/src/util/constant.js +0 -1
  45. package/src/util/index.js +1 -4
  46. package/test/auth_otp_v3.test.js +192 -0
  47. package/src/machine/activity/activity.js +0 -209
  48. package/src/machine/activity/diamond_shop_activity_fc.js +0 -196
  49. package/src/machine/activity/diamond_shop_activity_vn.js +0 -178
  50. package/src/machine/activity/invite_friends_activity.js +0 -114
  51. package/src/machine/activity/mini_game_activity.js +0 -68
  52. package/src/machine/activity/return_bonus_activity.js +0 -153
  53. package/src/machine/auth_otp_v2.js +0 -177
  54. package/src/machine/bank_binding_amb.js +0 -146
  55. package/src/machine/bonus.js +0 -76
  56. package/src/machine/deposit/amb.js +0 -93
  57. package/src/machine/deposit/crypto_bank.js +0 -330
  58. package/src/machine/deposit/crypto_qrcode.js +0 -148
  59. package/src/machine/deposit/crypto_way.js +0 -252
  60. package/src/machine/deposit/deposit_fc.js +0 -272
  61. package/src/machine/deposit/direct.js +0 -310
  62. package/src/machine/deposit/float.js +0 -375
  63. package/src/machine/deposit/krway.js +0 -151
  64. package/src/machine/deposit/loadcard_vn.js +0 -351
  65. package/src/machine/deposit/manual_vn.js +0 -458
  66. package/src/machine/deposit/qrcode_v2.js +0 -338
  67. package/src/machine/deposit/usdt.js +0 -144
  68. package/src/machine/deposit/virtual_bank_vn.js +0 -269
  69. package/src/machine/deposit/vpay.js +0 -368
  70. package/src/machine/game_hot_new.js +0 -79
  71. package/src/machine/game_replay.js +0 -46
  72. package/src/machine/game_search_v2.js +0 -401
  73. package/src/machine/honor_board.js +0 -132
  74. package/src/machine/merge.js +0 -57
  75. package/src/machine/payment_data.js +0 -86
  76. package/src/machine/promotions.js +0 -170
  77. package/src/machine/reward.js +0 -255
  78. package/src/machine/reward_fc.js +0 -98
  79. package/src/machine/side.js +0 -154
  80. package/src/machine/side_v2.js +0 -211
  81. package/src/machine/vip_table.js +0 -57
  82. package/src/machine/welcome.js +0 -110
  83. package/src/machine/withdraw/withdraw_crypto_cash.js +0 -327
  84. package/src/machine/withdraw/withdraw_krway.js +0 -223
  85. package/src/machine/withdraw/withdraw_manual.js +0 -536
  86. package/src/util/math.js +0 -4
@@ -1,269 +0,0 @@
1
- import { assign, createMachine } from 'xstate'
2
- import payment from '../../api/payment.js'
3
-
4
- export default function (request) {
5
- const { appSecret } = request.config
6
-
7
- return createMachine(
8
- {
9
- id: 'virtual_bank',
10
- initial: 'loading',
11
- context: {
12
- siteConfig: null,
13
- paymentDetail: [],
14
- virtualBanks: {},
15
-
16
- amount: null,
17
- depositTime: null,
18
-
19
- currentCategory: 'virtualBank',
20
- method: null,
21
- currentPayment: null,
22
-
23
- calculation: null,
24
- processing: null,
25
-
26
- // use for wallet mode 3
27
- promotion: null,
28
- },
29
- states: {
30
- loading: {
31
- initial: 'init',
32
- states: {
33
- init: {
34
- invoke: {
35
- src: 'fetchPaymentDetail',
36
- onDone: {
37
- target: '#virtual_bank.step1',
38
- actions: 'setInitData',
39
- },
40
- onError: {
41
- target: '#virtual_bank.fail',
42
- },
43
- },
44
- },
45
- },
46
- },
47
- step1: {
48
- initial: 'idle',
49
- states: {
50
- idle: {},
51
- calculating: {
52
- invoke: {
53
- src: 'fetchCalculation',
54
- onDone: {
55
- target: 'idle',
56
- actions: 'setCalculation',
57
- },
58
- onError: {
59
- target: 'idle',
60
- },
61
- },
62
- },
63
- debouncing: {
64
- after: {
65
- 1000: [{ target: 'calculating', cond: 'isCalculable' }, { target: 'idle' }],
66
- },
67
- },
68
- },
69
- on: {
70
- SET_AMOUNT: {
71
- actions: ['setAmount', 'clearCalculation'],
72
- },
73
- CALCULATE: {
74
- target: '.debouncing',
75
- },
76
- CLEAR_CALCULATION: {
77
- target: '.debouncing',
78
- actions: 'clearCalculation',
79
- },
80
- TRANSACT: {
81
- target: 'checking',
82
- cond: 'isCalculated',
83
- },
84
- },
85
- },
86
- checking: {
87
- always: [
88
- {
89
- target: 'pending',
90
- cond: (context, event) => {
91
- const { calculation, promotion } = context
92
- const { promotionsNo, activityNo } = promotion
93
- const isNoBonus = promotionsNo === 'none' || activityNo === 'none'
94
- return !!calculation && !isNoBonus
95
- },
96
- },
97
- {
98
- target: '#virtual_bank.step2',
99
- },
100
- ],
101
- },
102
- pending: {
103
- on: {
104
- CONFIRM: {
105
- target: '#virtual_bank.step2',
106
- },
107
- },
108
- },
109
- step2: {
110
- initial: 'idle',
111
- states: {
112
- idle: {},
113
- calculating: {
114
- invoke: {
115
- src: 'fetchCalculation',
116
- onDone: {
117
- target: 'idle',
118
- actions: 'setCalculation',
119
- },
120
- onError: {
121
- target: 'idle',
122
- },
123
- },
124
- },
125
- debouncing: {
126
- after: {
127
- 1000: [{ target: 'calculating', cond: 'isCalculable' }, { target: 'idle' }],
128
- },
129
- },
130
- submitting: {
131
- invoke: {
132
- src: 'submitDeposit',
133
- onDone: {
134
- target: '#virtual_bank.submitted',
135
- actions: 'setProcessing',
136
- },
137
- onError: {
138
- target: 'idle',
139
- },
140
- },
141
- },
142
- },
143
- on: {
144
- SET_AMOUNT: {
145
- actions: ['setAmount', 'clearCalculation'],
146
- },
147
- CALCULATE: {
148
- target: '.debouncing',
149
- },
150
- SET_DEPOSIT_TIME: {
151
- actions: 'setDepositTime',
152
- },
153
- CLEAR_CALCULATION: {
154
- target: '.debouncing',
155
- actions: 'clearCalculation',
156
- },
157
- SUBMIT: {
158
- target: '.submitting',
159
- },
160
- },
161
- },
162
- processing: {},
163
- submitted: {},
164
- fail: {},
165
- },
166
- on: {
167
- SET_PROMOTION: {
168
- actions: 'setPromotion',
169
- },
170
- },
171
- },
172
- {
173
- actions: {
174
- setInitData: assign((context, event) => {
175
- const paymentDetail = event.data || []
176
- const currentPayment = paymentDetail.find((element) => element.category === context.currentCategory)
177
- const { method, processing, virtualBanks } = currentPayment || {}
178
-
179
- return {
180
- paymentDetail,
181
- currentPayment,
182
- method,
183
- processing: processing?.[0],
184
- virtualBanks: virtualBanks?.[0],
185
- }
186
- }),
187
- setAmount: assign((context, event) => {
188
- return {
189
- amount: event.data,
190
- }
191
- }),
192
- setCalculation: assign((context, event) => {
193
- // V2接口轉換中回傳的資料結構不同
194
- const { data } = event.data
195
- if (data) {
196
- return {
197
- calculation: data,
198
- }
199
- } else {
200
- return {
201
- calculation: event.data,
202
- }
203
- }
204
- }),
205
- setProcessing: assign((context, event) => {
206
- return {
207
- processing: event.data,
208
- }
209
- }),
210
- clearCalculation: assign((context, event) => {
211
- return {
212
- calculation: null,
213
- }
214
- }),
215
- setDepositTime: assign((context, event) => {
216
- return {
217
- depositTime: event.data,
218
- }
219
- }),
220
- setPromotion: assign((context, event) => {
221
- return {
222
- promotion: event.data,
223
- }
224
- }),
225
- },
226
- guards: {
227
- isCalculable: (context, event) => {
228
- const {
229
- amount,
230
- currentPayment: { maximum, minimum },
231
- } = context
232
- return amount && minimum <= +amount && +amount <= maximum
233
- },
234
- isCalculated: (context, event) => {
235
- return context.calculation
236
- },
237
- isProcessing: (context, event) => {
238
- return context.processing
239
- },
240
- },
241
- services: {
242
- fetchPaymentDetail: async (context, event) => {
243
- return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
244
- },
245
- fetchCalculation: async (context, event) => {
246
- const { method, amount, promotion } = context
247
- return await request.send(
248
- payment.getDepositExpectedResult({
249
- method,
250
- amount: Number(amount),
251
- promotionsNo: promotion?.activityNo,
252
- })
253
- )
254
- },
255
- submitDeposit: async (context, event) => {
256
- const { method, amount, depositTime, promotion } = context
257
- return await request.send(
258
- payment.submitDepositTransactionBank({
259
- method,
260
- amount,
261
- depositTime,
262
- promotionsNo: promotion?.activityNo,
263
- })
264
- )
265
- },
266
- },
267
- }
268
- )
269
- }
@@ -1,368 +0,0 @@
1
- // 棄用
2
- import { assign, createMachine } from 'xstate'
3
- import payment from '../../api/payment.js'
4
- import common from '../../api/common.js'
5
-
6
- export default function (request) {
7
- const { appSecret } = request.config
8
- return createMachine(
9
- {
10
- id: 'vpay',
11
- initial: 'loading',
12
- context: {
13
- method: 'vpay',
14
- userAccount: {},
15
- siteConfig: null,
16
- amount: 0,
17
-
18
- bankList: [],
19
- options: [],
20
- minimum: 0,
21
- maximum: 0,
22
-
23
- calculation: null,
24
-
25
- qrcode: null,
26
- vpayId: null,
27
- calculatedAmount: 0,
28
-
29
- grandTotalEnable: 1,
30
-
31
- promotion: null,
32
- bonusPreviewData: [],
33
- },
34
- states: {
35
- loading: {
36
- initial: 'checkingUserAccount',
37
- states: {
38
- checkingUserAccount: {
39
- invoke: {
40
- src: 'fetchPaymentInfo',
41
- onDone: [
42
- {
43
- target: 'initializing',
44
- actions: 'setUserAccount',
45
- cond: 'hasUserAccount',
46
- },
47
- { target: '#vpay.accountUnbound' },
48
- ],
49
- onError: {
50
- target: '#vpay.unavailable',
51
- },
52
- },
53
- },
54
- initializing: {
55
- invoke: {
56
- src: 'initialize',
57
- onDone: [
58
- {
59
- target: '#vpay.submitted',
60
- actions: ['setInitialization', 'setPreviousOrder'],
61
- cond: 'hasPreviousOrder',
62
- },
63
- { target: '#vpay.checking', actions: 'setInitialization' },
64
- ],
65
- onError: {
66
- target: '#vpay.unavailable',
67
- },
68
- },
69
- },
70
- },
71
- },
72
- checking: {
73
- always: [
74
- {
75
- target: 'fetching',
76
- cond: (context, event) => {
77
- const { siteConfig = {}, promotion = {} } = context
78
- const { bonusPreviewEnable } = siteConfig
79
- return bonusPreviewEnable && promotion.activityNo != 'none'
80
- },
81
- },
82
- { target: 'loaded' },
83
- ],
84
- },
85
- fetching: {
86
- invoke: {
87
- src: 'fetchBonusPreview',
88
- onDone: {
89
- target: 'loaded',
90
- actions: 'setBonusPreview',
91
- },
92
- onError: {
93
- target: 'loaded',
94
- },
95
- },
96
- },
97
- loaded: {
98
- entry: 'reset',
99
- on: {
100
- SELECT_AMOUNT: [
101
- {
102
- target: 'debouncing',
103
- actions: 'addAmount',
104
- cond: 'isGrandTotalEnable',
105
- },
106
- {
107
- target: 'debouncing',
108
- actions: 'setAmount',
109
- },
110
- ],
111
- KEY_IN: {
112
- target: 'calculating',
113
- actions: 'setAmount',
114
- },
115
- CLEAR_CALCULATION: {
116
- target: 'debouncing',
117
- actions: 'clearCalculation',
118
- },
119
- },
120
- },
121
- debouncing: {
122
- on: {
123
- SELECT_AMOUNT: [
124
- {
125
- target: 'debouncing',
126
- actions: 'addAmount',
127
- cond: 'isGrandTotalEnable',
128
- },
129
- {
130
- target: 'debouncing',
131
- actions: 'setAmount',
132
- },
133
- ],
134
- KEY_IN: {
135
- target: 'debouncing',
136
- actions: 'setAmount',
137
- },
138
- },
139
- after: {
140
- 1000: {
141
- target: 'calculating',
142
- },
143
- },
144
- },
145
- calculable: {
146
- entry: 'clearCalculation',
147
- on: {
148
- SELECT_AMOUNT: [
149
- {
150
- target: 'debouncing',
151
- actions: 'addAmount',
152
- cond: 'isGrandTotalEnable',
153
- },
154
- {
155
- target: 'debouncing',
156
- actions: 'setAmount',
157
- },
158
- ],
159
- KEY_IN: {
160
- target: 'debouncing',
161
- actions: 'setAmount',
162
- },
163
- CLEAR_CALCULATION: {
164
- target: 'debouncing',
165
- actions: 'clearCalculation',
166
- },
167
- CLEAR: {
168
- actions: 'setAmount',
169
- },
170
- },
171
- },
172
- calculating: {
173
- invoke: {
174
- src: 'fetchCalculation',
175
- onDone: {
176
- target: 'calculated',
177
- actions: 'setCalculation',
178
- },
179
- onError: {
180
- target: 'calculable',
181
- },
182
- },
183
- },
184
- calculated: {
185
- on: {
186
- SELECT_AMOUNT: [
187
- {
188
- target: 'debouncing',
189
- actions: 'addAmount',
190
- cond: 'isGrandTotalEnable',
191
- },
192
- {
193
- target: 'debouncing',
194
- actions: 'setAmount',
195
- },
196
- ],
197
- KEY_IN: {
198
- target: 'debouncing',
199
- actions: 'setAmount',
200
- },
201
- CONFIRM: {
202
- target: 'submitting',
203
- },
204
- CLEAR_CALCULATION: {
205
- target: 'debouncing',
206
- actions: 'clearCalculation',
207
- },
208
- CLEAR: {
209
- actions: 'setAmount',
210
- },
211
- },
212
- },
213
- submitting: {
214
- invoke: {
215
- src: 'submitDeposit',
216
- onDone: {
217
- target: 'submitted',
218
- actions: 'setOrder',
219
- },
220
- onError: {
221
- target: 'calculated',
222
- },
223
- },
224
- },
225
- submitted: {},
226
- accountUnbound: {},
227
- unavailable: {},
228
- },
229
- on: {
230
- SET_PROMOTION: {
231
- actions: 'setPromotion',
232
- },
233
- },
234
- },
235
- {
236
- actions: {
237
- setUserAccount: assign((context, event) => {
238
- return {
239
- userAccount: event.data?.[0],
240
- }
241
- }),
242
- setBonusPreview: assign((context, event) => {
243
- return {
244
- bonusPreviewData: event.data,
245
- }
246
- }),
247
- setOrder: assign((context, event) => {
248
- const { amount, qrcode, vpayId } = event.data
249
- return {
250
- qrcode,
251
- vpayId,
252
- calculatedAmount: amount,
253
- }
254
- }),
255
- setPreviousOrder: assign((context, event) => {
256
- const { amount, qrcode, vpayId } = event.data.order
257
- return {
258
- qrcode,
259
- vpayId,
260
- calculatedAmount: amount,
261
- }
262
- }),
263
- setInitialization: assign((context, event) => {
264
- const { siteConfig, housePayment, bankList } = event.data
265
- const { optional, minimum, maximum, grandTotalEnable } = housePayment
266
- return {
267
- siteConfig,
268
- options: optional,
269
- minimum,
270
- maximum,
271
- bankList: bankList?.data ? bankList.data : bankList,
272
- grandTotalEnable,
273
- }
274
- }),
275
- setPromotion: assign((context, event) => {
276
- const promotion = event.data
277
- return {
278
- promotion,
279
- }
280
- }),
281
- addAmount: assign((context, event) => {
282
- const { amount, maximum } = context
283
- return {
284
- amount: Math.min(amount + event.data, maximum),
285
- }
286
- }),
287
- setAmount: assign((context, event) => {
288
- return { amount: event.data }
289
- }),
290
- setCalculation: assign((context, event) => {
291
- // V2接口轉換中回傳的資料結構不同
292
- const { data } = event.data
293
- if (data) {
294
- return {
295
- calculation: data,
296
- }
297
- } else {
298
- return {
299
- calculation: event.data,
300
- }
301
- }
302
- }),
303
- clearCalculation: assign((context, event) => {
304
- return {
305
- calculation: null,
306
- }
307
- }),
308
- },
309
- guards: {
310
- hasUserAccount: (context, event) => {
311
- return event.data?.[0]
312
- },
313
- hasPreviousOrder: (context, event) => {
314
- return event.data.order?.qrcode
315
- },
316
- isGrandTotalEnable: (context, event) => {
317
- return context.grandTotalEnable === 1
318
- },
319
- },
320
- services: {
321
- fetchPaymentInfo: async (context, event) => {
322
- const { bankInfo } = await request.send(payment.getPaymentInfo())
323
- const filterArray = bankInfo?.filter((item) => item.bindingType !== 'CRYPTO' && item.bindingType !== 'EWALLET')
324
- return filterArray || []
325
- },
326
- initialize: async (context, event) => {
327
- const [{ config }, payments, bankList, order] = await Promise.all([
328
- request.send(common.getConfig({ appSecret })),
329
- request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' })),
330
- request.send(payment.getBankList('amb')),
331
- request.send(payment.checkTransaction(context.method)),
332
- ])
333
- const siteConfig = JSON.parse(window.atob(config))
334
- return { siteConfig, housePayment: payments.find((payment) => payment.method === context.method), bankList, order }
335
- },
336
- fetchBonusPreview: async (context, event) => {
337
- const { method, promotion } = context
338
- return await request.send(
339
- payment.getBonusPreview({
340
- method,
341
- promotionsNo: promotion?.activityNo,
342
- })
343
- )
344
- },
345
- submitDeposit: async (context, event) => {
346
- const { method, amount, promotion } = context
347
- return await request.send(
348
- payment.submitDepositTransaction({
349
- method,
350
- amount,
351
- promotionsNo: promotion?.activityNo,
352
- })
353
- )
354
- },
355
- fetchCalculation: async (context, event) => {
356
- const { method, amount, promotion } = context
357
- return await request.send(
358
- payment.getDepositExpectedResult({
359
- method,
360
- amount: Number(amount),
361
- promotionsNo: promotion?.activityNo,
362
- })
363
- )
364
- },
365
- },
366
- }
367
- )
368
- }
@@ -1,79 +0,0 @@
1
- import { assign, createMachine } from 'xstate'
2
- import api from '../api/game.js'
3
-
4
- export default function (request) {
5
- return createMachine(
6
- {
7
- id: 'game_hot_new',
8
- initial: 'preparing',
9
- context: {
10
- hot: {
11
- id: null,
12
- name: 'SYSTEM_TOP_GAME',
13
- list: [],
14
- },
15
- new: {
16
- id: null,
17
- name: 'SYSTEM_NEW_GAME',
18
- list: [],
19
- },
20
- },
21
- states: {
22
- preparing: {
23
- invoke: {
24
- src: 'getRoomItems',
25
- onDone: {
26
- target: 'fetchingGames',
27
- actions: 'setId',
28
- },
29
- onError: {
30
- target: 'fetchingGames',
31
- },
32
- },
33
- },
34
- fetchingGames: {
35
- invoke: {
36
- src: 'getGames',
37
- onDone: {
38
- actions: 'setGames',
39
- },
40
- },
41
- },
42
- },
43
- },
44
- {
45
- actions: {
46
- setId: assign((context, event) => {
47
- const { list = [] } = event.data
48
- const hotId = list.find((item) => item.category === context.hot.name)?.id
49
- const newId = list.find((item) => item.category === context.new.name)?.id
50
- return {
51
- hot: { ...context.hot, id: hotId },
52
- new: { ...context.new, id: newId },
53
- }
54
- }),
55
- setGames: assign((context, event) => {
56
- const { games } = event.data
57
- return {
58
- hot: { ...context.hot, list: games.hot },
59
- new: { ...context.new, list: games.new },
60
- }
61
- }),
62
- },
63
- services: {
64
- getRoomItems: async (context, event) => {
65
- return await request.send(api.getGameCategory({ id: context.roomId }))
66
- },
67
- getGames: async (context, event) => {
68
- const [resHot, resNew] = await Promise.all([
69
- request.send(api.getGameCategory({ id: context.hot.id })),
70
- request.send(api.getGameCategory({ id: context.new.id })),
71
- ])
72
- const hotGames = resHot?.list?.map?.((item) => item.g)
73
- const newGames = resNew?.list?.map?.((item) => item.g)
74
- return { games: { hot: hotGames, new: newGames } }
75
- },
76
- },
77
- }
78
- )
79
- }