@jetthai/cuora 1.1.470-dev.2 → 1.1.470

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 (83) hide show
  1. package/.claude/commands/sync-ai-prompts.md +1 -88
  2. package/.claude/settings.local.json +1 -3
  3. package/.github/copilot-instructions.md +57 -64
  4. package/.husky/post-checkout +3 -3
  5. package/.husky/pre-push +1 -1
  6. package/.prettierignore +1 -2
  7. package/AGENTS.md +57 -64
  8. package/AI_PROMPT_SOURCE.md +57 -64
  9. package/CHANGELOG.md +6 -187
  10. package/CLAUDE.md +57 -64
  11. package/GEMINI.md +57 -64
  12. package/README.md +12 -11
  13. package/package.json +1 -1
  14. package/scripts/auto-version.js +0 -1
  15. package/scripts/branch-auto-npm-publish.js +2 -9
  16. package/src/api/account.js +1 -0
  17. package/src/api/activity.js +37 -0
  18. package/src/api/auth.js +31 -0
  19. package/src/api/game.js +10 -0
  20. package/src/api/payment.js +52 -1
  21. package/src/api/user.js +22 -4
  22. package/src/index.js +2 -2
  23. package/src/machine/activity/activity.js +209 -0
  24. package/src/machine/activity/activity_cash.js +15 -23
  25. package/src/machine/activity/diamond_shop_activity_cash.js +1 -0
  26. package/src/machine/activity/diamond_shop_activity_fc.js +196 -0
  27. package/src/machine/activity/diamond_shop_activity_vn.js +178 -0
  28. package/src/machine/activity/fafafa_activity.js +10 -0
  29. package/src/machine/activity/index.js +12 -0
  30. package/src/machine/activity/invite_friends_activity.js +114 -0
  31. package/src/machine/activity/mini_game_activity.js +68 -0
  32. package/src/machine/activity/return_bonus_activity.js +153 -0
  33. package/src/machine/auth.js +68 -16
  34. package/src/machine/auth_otp_v2.js +177 -0
  35. package/src/machine/auth_otp_v3.js +3 -0
  36. package/src/machine/bank_binding_amb.js +146 -0
  37. package/src/machine/bonus.js +76 -0
  38. package/src/machine/common.js +55 -0
  39. package/src/machine/deposit/amb.js +93 -0
  40. package/src/machine/deposit/crypto_bank.js +330 -0
  41. package/src/machine/deposit/crypto_qrcode.js +148 -0
  42. package/src/machine/deposit/crypto_way.js +252 -0
  43. package/src/machine/deposit/deposit_fc.js +272 -0
  44. package/src/machine/deposit/direct.js +310 -0
  45. package/src/machine/deposit/float.js +375 -0
  46. package/src/machine/deposit/index.js +28 -0
  47. package/src/machine/deposit/krway.js +151 -0
  48. package/src/machine/deposit/loadcard_vn.js +351 -0
  49. package/src/machine/deposit/manual_cash.js +8 -0
  50. package/src/machine/deposit/manual_vn.js +458 -0
  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_vn.js +269 -0
  54. package/src/machine/deposit/vpay.js +368 -0
  55. package/src/machine/game_hot_new.js +79 -0
  56. package/src/machine/game_info.js +12 -1
  57. package/src/machine/game_replay.js +46 -0
  58. package/src/machine/game_search_v2.js +401 -0
  59. package/src/machine/game_v2_1.js +89 -1
  60. package/src/machine/honor_board.js +132 -0
  61. package/src/machine/inbox.js +12 -0
  62. package/src/machine/index.js +32 -0
  63. package/src/machine/merge.js +57 -0
  64. package/src/machine/payment_data.js +86 -0
  65. package/src/machine/promotions.js +170 -0
  66. package/src/machine/reward.js +255 -0
  67. package/src/machine/reward_cash.js +39 -0
  68. package/src/machine/reward_fc.js +98 -0
  69. package/src/machine/side.js +154 -0
  70. package/src/machine/side_v2.js +211 -0
  71. package/src/machine/user_reset_password.js +13 -0
  72. package/src/machine/user_sign_up.js +0 -3
  73. package/src/machine/vip_table.js +57 -0
  74. package/src/machine/websocket.js +4 -0
  75. package/src/machine/welcome.js +110 -0
  76. package/src/machine/withdraw/index.js +6 -0
  77. package/src/machine/withdraw/withdraw_crypto_cash.js +327 -0
  78. package/src/machine/withdraw/withdraw_krway.js +223 -0
  79. package/src/machine/withdraw/withdraw_manual.js +536 -0
  80. package/src/request/request.js +28 -0
  81. package/src/util/constant.js +1 -0
  82. package/src/util/index.js +4 -1
  83. package/src/util/math.js +4 -0
@@ -1,21 +1,49 @@
1
+ import manual_vn from './manual_vn.js'
2
+ import loadcard_vn from './loadcard_vn.js'
3
+ import qrcode_v2 from './qrcode_v2.js'
4
+ import deposit_fc from './deposit_fc.js'
5
+ import direct from './direct.js'
6
+ import amb from './amb.js'
7
+ import float from './float.js'
8
+ import vpay from './vpay.js'
9
+ import krway from './krway.js'
10
+ import usdt from './usdt.js'
1
11
  import manual_cash from './manual_cash.js'
2
12
  import qrcode_cash from './qrcode_cash.js'
3
13
  import usdt_cash from './usdt_cash.js'
4
14
  import direct_cash from './direct_cash.js'
5
15
  import loadcard_cash from './loadcard_cash.js'
16
+ import crypto_bank from './crypto_bank.js'
17
+ import crypto_qrcode from './crypto_qrcode.js'
18
+ import crypto_way from './crypto_way.js'
6
19
  import crypto_bank_cash from './crypto_bank_cash.js'
7
20
  import crypto_qrcode_cash from './crypto_qrcode_cash.js'
8
21
  import crypto_way_cash from './crypto_way_cash.js'
22
+ import virtual_bank_vn from './virtual_bank_vn.js'
9
23
  import virtual_bank_cash from './virtual_bank_cash.js'
10
24
 
11
25
  export default {
26
+ manual_vn,
27
+ loadcard_vn,
28
+ qrcode_v2,
29
+ deposit_fc,
30
+ direct,
31
+ amb,
32
+ float,
33
+ vpay,
34
+ usdt,
35
+ krway,
12
36
  manual_cash,
13
37
  qrcode_cash,
14
38
  usdt_cash,
15
39
  direct_cash,
16
40
  loadcard_cash,
41
+ crypto_bank,
42
+ crypto_qrcode,
43
+ crypto_way,
17
44
  crypto_bank_cash,
18
45
  crypto_qrcode_cash,
19
46
  crypto_way_cash,
47
+ virtual_bank_vn,
20
48
  virtual_bank_cash,
21
49
  }
@@ -0,0 +1,151 @@
1
+ import { assign, createMachine } from 'xstate'
2
+ import payment from '../../api/payment.js'
3
+ import mailbox from '../../api/mailbox.js'
4
+
5
+ export default function (request) {
6
+ return createMachine(
7
+ {
8
+ id: 'krway',
9
+ initial: 'loading',
10
+ context: {
11
+ currentCategory: 'krway',
12
+ paymentDetail: [],
13
+ currentPayment: null,
14
+ options: [],
15
+ amount: null,
16
+ processing: null,
17
+ },
18
+ states: {
19
+ loading: {
20
+ invoke: {
21
+ src: 'fetchPaymentDetail',
22
+ onDone: {
23
+ target: 'checking',
24
+ actions: 'setPaymentDetail',
25
+ },
26
+ onError: {
27
+ target: 'fail',
28
+ },
29
+ },
30
+ },
31
+ checking: {
32
+ always: [
33
+ {
34
+ target: 'processing',
35
+ cond: 'isProcessing',
36
+ },
37
+ {
38
+ target: 'idle',
39
+ },
40
+ ],
41
+ },
42
+ processing: {},
43
+ idle: {},
44
+ inquiring: {
45
+ invoke: {
46
+ src: 'accountInquiry',
47
+ onDone: {
48
+ target: 'inquired',
49
+ },
50
+ onError: {
51
+ target: 'idle',
52
+ },
53
+ },
54
+ },
55
+ inquired: {
56
+ after: {
57
+ 0: {
58
+ target: 'idle',
59
+ },
60
+ },
61
+ },
62
+ submitting: {
63
+ invoke: {
64
+ src: 'submitDeposit',
65
+ onDone: {
66
+ target: 'submitted',
67
+ actions: 'setProcessing',
68
+ },
69
+ onError: {
70
+ target: 'fail',
71
+ },
72
+ },
73
+ },
74
+ submitted: {},
75
+ fail: {},
76
+ },
77
+ on: {
78
+ INQUIRY_ACCOUNT: {
79
+ target: 'inquiring',
80
+ },
81
+ ADD_AMOUNT: {
82
+ actions: 'addAmount',
83
+ },
84
+ SET_AMOUNT: {
85
+ actions: 'setAmount',
86
+ },
87
+ CLEAR_AMOUNT: {
88
+ actions: 'clearAmount',
89
+ },
90
+ SUBMIT: {
91
+ target: 'submitting',
92
+ },
93
+ },
94
+ },
95
+ {
96
+ actions: {
97
+ setPaymentDetail: assign((context, event) => {
98
+ const paymentDetail = event.data
99
+ const payments = paymentDetail.filter((item) => item.category === context.currentCategory)
100
+ const currentPayment = payments[0]
101
+ const options = currentPayment.optional || []
102
+
103
+ return {
104
+ currentPayment,
105
+ options,
106
+ processing: currentPayment.processing?.[0],
107
+ }
108
+ }),
109
+ addAmount: assign((context, event) => {
110
+ return {
111
+ amount: parseFloat(`${context.amount || 0}`) + parseFloat(`${event.data}`),
112
+ }
113
+ }),
114
+ setAmount: assign((context, event) => {
115
+ return { amount: parseFloat(`${event.data}`) }
116
+ }),
117
+ clearAmount: assign((context, event) => {
118
+ return { amount: null }
119
+ }),
120
+ setProcessing: assign((context, event) => {
121
+ return {
122
+ processing: event.data,
123
+ }
124
+ }),
125
+ },
126
+ guards: {
127
+ isProcessing: (context, event) => {
128
+ return context.processing
129
+ },
130
+ },
131
+ services: {
132
+ fetchPaymentDetail: async (context, event) => {
133
+ return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
134
+ },
135
+ accountInquiry: async (context, event) => {
136
+ const { from, title, content } = event.data
137
+ return await request.send(mailbox.sendMessage({ type: 'CUSTOMER', category: 'DEPOSIT', from, to: 'SYSTEM', title, content }))
138
+ },
139
+ submitDeposit: async (context, event) => {
140
+ const { currentPayment, amount } = context
141
+ return await request.send(
142
+ payment.submitDepositTransaction({
143
+ method: currentPayment.method,
144
+ amount,
145
+ })
146
+ )
147
+ },
148
+ },
149
+ }
150
+ )
151
+ }
@@ -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
+ }
@@ -88,6 +88,9 @@ export default function (request, context) {
88
88
  INPUT_USER_ACCOUNT_BRANCH_NAME: {
89
89
  actions: 'setUserAccountBranchName',
90
90
  },
91
+ INPUT_USER_ACCOUNT_BRANCH_CODE: {
92
+ actions: 'setUserAccountBranchCode',
93
+ },
91
94
  INPUT_USER_ACCOUNT_NUMBER: {
92
95
  actions: 'setUserAccountNumber',
93
96
  },
@@ -237,6 +240,11 @@ export default function (request, context) {
237
240
  userAccountBranchName: event.data,
238
241
  }
239
242
  }),
243
+ setUserAccountBranchCode: assign((context, event) => {
244
+ return {
245
+ userAccountBranchCode: event.data,
246
+ }
247
+ }),
240
248
  setUserAccountNumber: assign((context, event) => {
241
249
  return {
242
250
  userAccountNumber: event.data,