@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,79 @@
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
+ }
@@ -24,7 +24,13 @@ export default function (request, context) {
24
24
  },
25
25
  },
26
26
  },
27
- idle: {},
27
+ idle: {
28
+ // on: {
29
+ // SET_GAME_CODE: {
30
+ // actions: 'setGameCode',
31
+ // },
32
+ // },
33
+ },
28
34
  },
29
35
  },
30
36
  {
@@ -34,14 +40,15 @@ export default function (request, context) {
34
40
  gameInfo: event.data.data,
35
41
  }
36
42
  }),
43
+ // setGameCode: assign((context, event) => {
44
+ // return {
45
+ // gameCode: event.data.data,
46
+ // }
47
+ // }),
37
48
  },
38
49
  services: {
39
50
  // 取得遊戲資訊
40
51
  fetchGameInfo: async (context, event) => {
41
- // [防呆] 確保有 gameCode
42
- if (!gameCode) {
43
- return { data: {} }
44
- }
45
52
  return await request.send(game.getGameInfo({ appSecret, gameCode }))
46
53
  },
47
54
  },
@@ -0,0 +1,46 @@
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 { providerId, seqNo, lang } = context
7
+ return createMachine(
8
+ {
9
+ id: 'game_replay',
10
+ initial: 'fetching',
11
+ context: {
12
+ gameReplayInfo: {},
13
+ },
14
+ states: {
15
+ fetching: {
16
+ invoke: {
17
+ src: 'fetchGameReplayInfo',
18
+ onDone: {
19
+ target: 'idle',
20
+ actions: 'setGameReplayInfo',
21
+ },
22
+ onError: {
23
+ target: 'idle',
24
+ },
25
+ },
26
+ },
27
+ idle: {},
28
+ },
29
+ },
30
+ {
31
+ actions: {
32
+ setGameReplayInfo: assign((context, event) => {
33
+ return {
34
+ gameReplayInfo: event.data.data,
35
+ }
36
+ }),
37
+ },
38
+ services: {
39
+ // 取得遊戲重播資訊
40
+ fetchGameReplayInfo: async (context, event) => {
41
+ return await request.send(game.getGameReplayInfo({ providerId, seqNo, lang, appSecret }))
42
+ },
43
+ },
44
+ }
45
+ )
46
+ }
@@ -0,0 +1,401 @@
1
+ import { createMachine, assign, send } from 'xstate'
2
+ import game from '../api/game.js'
3
+
4
+ export default function (request) {
5
+ return createMachine(
6
+ {
7
+ id: 'game_search_v2',
8
+ initial: 'init',
9
+ context: {
10
+ keyword: '',
11
+ tagId: null,
12
+ mainTagList: [],
13
+ tagList: [],
14
+ gameList: [],
15
+ recentlySearch: [],
16
+ recentlyGame: [],
17
+ youMayLike: [],
18
+ // 以下變數為數據分析用
19
+ selectedType: null,
20
+ tagIndex: null,
21
+ click: null,
22
+ clickDefault: null,
23
+ traceId: null,
24
+ isYouMayLike: false,
25
+ isRecentlyGame: false,
26
+ isRecentlySearch: false,
27
+ gameCode: null,
28
+ lang: 'en-US',
29
+ },
30
+ states: {
31
+ init: {
32
+ on: {
33
+ INIT: {
34
+ target: 'preset',
35
+ actions: ['setLang'],
36
+ },
37
+ },
38
+ },
39
+ preset: {
40
+ invoke: {
41
+ src: 'fetchTags',
42
+ onDone: {
43
+ target: 'loading',
44
+ actions: 'setMainTagList',
45
+ },
46
+ onError: {
47
+ target: 'fail',
48
+ },
49
+ },
50
+ },
51
+ loading: {
52
+ invoke: {
53
+ src: 'fetchInitialData',
54
+ onDone: {
55
+ target: 'idle',
56
+ actions: 'setInitialData',
57
+ },
58
+ onError: {
59
+ target: '#game_search_v2.fail',
60
+ },
61
+ },
62
+ },
63
+ idle: {
64
+ on: {
65
+ SET_MAIN_TAG_ID: {
66
+ target: 'setGameList',
67
+ actions: ['setMainTagId', 'setTraceData'],
68
+ },
69
+ PLAY_GAME: {
70
+ target: 'sendingTrace',
71
+ actions: 'setGameCode',
72
+ },
73
+ START_SEARCH: {
74
+ target: 'searching',
75
+ actions: 'clearKeywords',
76
+ },
77
+ CLEAR_MAIN_TAG: {
78
+ actions: 'clearMainTag',
79
+ },
80
+ },
81
+ },
82
+ setGameList: {
83
+ always: [
84
+ {
85
+ target: 'idle',
86
+ actions: 'setGames',
87
+ cond: 'isRecentlyYouMayLike',
88
+ },
89
+ {
90
+ target: 'fetchGameList',
91
+ },
92
+ ],
93
+ },
94
+ fetchGameList: {
95
+ invoke: {
96
+ src: 'fetchGames',
97
+ onDone: {
98
+ target: 'idle',
99
+ actions: 'setGames',
100
+ },
101
+ onError: {
102
+ target: '#game_search_v2.fail',
103
+ },
104
+ },
105
+ },
106
+ searching: {
107
+ initial: 'searchIdle',
108
+ states: {
109
+ searchIdle: {
110
+ on: {
111
+ SET_TAG_ID: {
112
+ target: '#game_search_v2.fetchGameList',
113
+ actions: ['setTagId', 'setTraceData'],
114
+ },
115
+ PRESS_ENTER: [
116
+ {
117
+ actions: send((context, event) => ({
118
+ type: 'SET_TAG_ID',
119
+ data: {
120
+ tagId: context.tagList[0]?.id,
121
+ traceData: {
122
+ isYouMayLike: false,
123
+ isRecentlyGame: false,
124
+ isRecentlySearch: false,
125
+ },
126
+ },
127
+ })),
128
+ cond: 'hasTagList',
129
+ },
130
+ {
131
+ target: '#game_search_v2.sendingTrace',
132
+ actions: 'clearExceptKeyword',
133
+ },
134
+ ],
135
+ SET_KEYWORD: {
136
+ target: 'debouncing',
137
+ actions: ['setKeyword', 'setLang'],
138
+ },
139
+ STOP_SEARCH: {
140
+ target: '#game_search_v2.idle',
141
+ actions: 'clearKeywords',
142
+ },
143
+ },
144
+ },
145
+ debouncing: {
146
+ on: {
147
+ SET_KEYWORD: {
148
+ target: 'debouncing',
149
+ actions: ['setKeyword', 'setLang'],
150
+ },
151
+ },
152
+ after: {
153
+ 500: {
154
+ target: 'fetching',
155
+ },
156
+ },
157
+ },
158
+ fetching: {
159
+ invoke: {
160
+ src: 'fetchTags',
161
+ onDone: {
162
+ target: 'searchIdle',
163
+ actions: 'setTagList',
164
+ },
165
+ onError: {
166
+ target: '#game_search_v2.fail',
167
+ },
168
+ },
169
+ },
170
+ },
171
+ },
172
+ sendingTrace: {
173
+ invoke: {
174
+ src: 'sendTrace',
175
+ onDone: {
176
+ target: 'idle',
177
+ },
178
+ onError: {
179
+ target: 'fail',
180
+ },
181
+ },
182
+ },
183
+ fail: {},
184
+ },
185
+ },
186
+ {
187
+ actions: {
188
+ setMainTagList: assign((context, event) => {
189
+ return {
190
+ mainTagList: event.data,
191
+ }
192
+ }),
193
+ setInitialData: assign((context, event) => {
194
+ const { recentlySearch = [], recentlyGame = [], youMayLike = [] } = event.data
195
+ let tagId = null
196
+ let gameList = []
197
+ if (recentlyGame?.length > 0) {
198
+ gameList = recentlyGame
199
+ } else if (youMayLike?.length > 0) {
200
+ gameList = youMayLike
201
+ }
202
+ return {
203
+ recentlySearch: recentlySearch.filter((item) => item.id && item.i18n),
204
+ recentlyGame,
205
+ youMayLike,
206
+ gameList,
207
+ tagId,
208
+ }
209
+ }),
210
+ setMainTagId: assign((context, event) => {
211
+ const { tagId } = event.data
212
+ const { mainTagList } = context
213
+ const tagIndex = mainTagList.findIndex((tag) => tag.id === tagId)
214
+ return {
215
+ keyword: '',
216
+ tagId,
217
+ tagIndex,
218
+ click: 1,
219
+ clickDefault: null,
220
+ }
221
+ }),
222
+ clearMainTag: assign((context, event) => {
223
+ return {
224
+ tagId: null,
225
+ }
226
+ }),
227
+ setTagId: assign((context, event) => {
228
+ const { tagId, clickTagType } = event.data
229
+ const { mainTagList, tagList, recentlySearch } = context
230
+ if (clickTagType === 'RECENTLY SEARCH') {
231
+ const tagIndex = recentlySearch.findIndex((tag) => tag.id === tagId)
232
+ return {
233
+ tagId,
234
+ tagIndex,
235
+ click: 1,
236
+ clickDefault: null,
237
+ }
238
+ } else if (clickTagType === 'POPULAR KEYWORDS' || tagList.length <= 0) {
239
+ const tagIndex = mainTagList.findIndex((tag) => tag.id === tagId)
240
+ return {
241
+ tagId,
242
+ tagIndex,
243
+ click: null,
244
+ clickDefault: 1,
245
+ }
246
+ } else {
247
+ const tagIndex = tagList.findIndex((tag) => tag.id === tagId)
248
+ return {
249
+ tagId,
250
+ tagIndex,
251
+ click: 1,
252
+ clickDefault: null,
253
+ }
254
+ }
255
+ }),
256
+ setGames: assign((context, event) => {
257
+ if (event?.data) {
258
+ const { traceId, result } = event.data
259
+ return {
260
+ traceId,
261
+ gameList: result,
262
+ }
263
+ } else {
264
+ const { tagId, recentlyGame, youMayLike } = context
265
+ let gameList = []
266
+ if (tagId === 'Recently') {
267
+ gameList = recentlyGame
268
+ } else if (tagId === 'You may like') {
269
+ gameList = youMayLike
270
+ }
271
+ return {
272
+ traceId: null,
273
+ gameList,
274
+ }
275
+ }
276
+ }),
277
+ setTraceData: assign((context, event) => {
278
+ const { isYouMayLike, isRecentlyGame, isRecentlySearch } = event.data?.traceData
279
+ return {
280
+ isYouMayLike,
281
+ isRecentlyGame,
282
+ isRecentlySearch,
283
+ }
284
+ }),
285
+ setKeyword: assign((context, event) => {
286
+ return {
287
+ keyword: event.data.keyword,
288
+ }
289
+ }),
290
+ setLang: assign((context, event) => {
291
+ return {
292
+ lang: event.data.lang,
293
+ }
294
+ }),
295
+ clearKeywords: assign((context, event) => {
296
+ return {
297
+ keyword: '',
298
+ }
299
+ }),
300
+ setTagList: assign((context, event) => {
301
+ return {
302
+ tagList: event.data,
303
+ }
304
+ }),
305
+ setGameCode: assign((context, event) => {
306
+ const { gameList } = context
307
+ const gameCode = event.data
308
+ const gameCodeIndex = gameList.findIndex((game) => game?.gameCode === gameCode)
309
+ return {
310
+ gameCode,
311
+ gameCodeIndex,
312
+ }
313
+ }),
314
+ clearExceptKeyword: assign((context, event) => {
315
+ return {
316
+ gameList: [],
317
+ traceId: null,
318
+ tagId: null,
319
+ tagIndex: null,
320
+ gameCode: null,
321
+ gameCodeIndex: null,
322
+ isYouMayLike: false,
323
+ isRecentlyGame: false,
324
+ isRecentlySearch: false,
325
+ query: context.keyword,
326
+ click: null,
327
+ clickDefault: null,
328
+ }
329
+ }),
330
+ },
331
+ guards: {
332
+ isRecentlyYouMayLike: (context, event) => {
333
+ const { tagId } = context
334
+ return tagId === 'Recently' || tagId === 'You may like'
335
+ },
336
+ hasTagList: (context, event) => {
337
+ const { tagList } = context
338
+ return tagList?.length > 0
339
+ },
340
+ },
341
+ services: {
342
+ fetchTags: async (context, event) => {
343
+ const { keyword, lang } = context
344
+ const { result } = await request.send(game.getGameTags({ q: keyword, lang }))
345
+ return result
346
+ },
347
+ fetchInitialData: async (context, event) => {
348
+ const data = await request.send(game.getGameSearchHome())
349
+ return data
350
+ },
351
+ fetchGames: async (context, event) => {
352
+ const { tagId, tagIndex, keyword, click, clickDefault } = context
353
+ const { traceId, result } = await request.send(
354
+ game.getGameSearchList({
355
+ id: tagId,
356
+ index: tagIndex,
357
+ q: keyword,
358
+ click,
359
+ clickDefault,
360
+ })
361
+ )
362
+ return { traceId, result }
363
+ },
364
+ sendTrace: async (context, event) => {
365
+ const {
366
+ traceId,
367
+ tagId,
368
+ tagIndex,
369
+ gameCode,
370
+ gameCodeIndex,
371
+ keyword: query,
372
+ click,
373
+ clickDefault,
374
+ isYouMayLike,
375
+ isRecentlyGame,
376
+ isRecentlySearch,
377
+ } = context
378
+ let id = tagId
379
+ if (tagId === 'Recently' || tagId === 'You may like') {
380
+ id = null
381
+ }
382
+ return await request.send(
383
+ game.setGameSearchTrace({
384
+ traceId,
385
+ tagId: id,
386
+ tagIndex,
387
+ gameCode,
388
+ gameCodeIndex,
389
+ query,
390
+ click,
391
+ clickDefault,
392
+ isYouMayLike,
393
+ isRecentlyGame,
394
+ isRecentlySearch,
395
+ })
396
+ )
397
+ },
398
+ },
399
+ }
400
+ )
401
+ }