@jetthai/cuora 1.1.340 → 1.1.341-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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [1.1.341-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.341...v1.1.341-dev-1) (2025-02-27)
6
+
7
+ ### [1.1.341](https://github.com/jetthai/cuora-module/compare/v1.1.340...v1.1.341) (2025-02-25)
8
+
9
+ ### [1.1.338-perf-1](https://github.com/jetthai/cuora-module/compare/v1.1.338...v1.1.338-perf-1) (2025-02-12)
10
+
5
11
  ### [1.1.340](https://github.com/jetthai/cuora-module/compare/v1.1.339...v1.1.340) (2025-02-18)
6
12
 
7
13
  ### [1.1.339](https://github.com/jetthai/cuora-module/compare/v1.1.338...v1.1.339) (2025-02-18)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.340",
3
+ "version": "1.1.341-dev-1",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
package/src/api/auth.js CHANGED
@@ -5,10 +5,10 @@ export default {
5
5
  method: 'post',
6
6
  isPublic: true,
7
7
  }),
8
- login: ({ username, password, provider, countryCode, phone, email, dt, reCaptchaToken }) => ({
8
+ login: ({ username, password, provider, countryCode, phone, email, dt, reCaptchaToken, additionalUserInfo, loginType, isSignature }) => ({
9
9
  url: 'login',
10
10
  method: 'post',
11
- params: { username, password, provider, countryCode, phone, email, dt },
11
+ params: { username, password, provider, countryCode, phone, email, dt, additionalUserInfo, loginType, isSignature },
12
12
  isPublic: true,
13
13
  headers: { 'x-access-captcha': reCaptchaToken },
14
14
  }),
@@ -19,6 +19,7 @@ export default function (request) {
19
19
  refs: {},
20
20
  uidSite: '',
21
21
  siteConfig: {},
22
+ isPlaying: false,
22
23
  },
23
24
  states: {
24
25
  init: {
@@ -67,9 +68,10 @@ export default function (request) {
67
68
  },
68
69
  pending: {
69
70
  after: {
70
- TIMEOUT: {
71
- target: '#activity.fetchingList',
72
- },
71
+ TIMEOUT: [
72
+ { target: '#activity.fetchingList', cond: 'isNotInGame' },
73
+ { target: '#activity.idle', cond: 'isInGame' },
74
+ ],
73
75
  },
74
76
  on: {
75
77
  SET_UNREAD: {
@@ -77,6 +79,10 @@ export default function (request) {
77
79
  },
78
80
  REFRESH: {
79
81
  target: '#activity.fetchingList',
82
+ actions: 'leaveGame',
83
+ },
84
+ RESET_ACTIVITIES: {
85
+ actions: 'resetActivities',
80
86
  },
81
87
  },
82
88
  },
@@ -143,6 +149,20 @@ export default function (request) {
143
149
  uidSite,
144
150
  }
145
151
  }),
152
+ resetActivities: assign((context, event) => {
153
+ const { activityList = [], specifyActivities = [] } = context
154
+ const keepActivities = activityList.filter((activity) => specifyActivities.includes(activity.activityType))
155
+ return {
156
+ isPlaying: true,
157
+ activityList: keepActivities,
158
+ promotionList: [],
159
+ }
160
+ }),
161
+ leaveGame: assign((context, event) => {
162
+ return {
163
+ isPlaying: false,
164
+ }
165
+ }),
146
166
  },
147
167
  guards: {
148
168
  hasSpecifyActivities: (context, event) => {
@@ -150,6 +170,12 @@ export default function (request) {
150
170
  const filterActivityList = activityList.filter((activity) => specifyActivities.includes(activity.activityType))
151
171
  return filterActivityList.length > 0
152
172
  },
173
+ isInGame: (context, event) => {
174
+ return context.isPlaying
175
+ },
176
+ isNotInGame: (context, event) => {
177
+ return !context.isPlaying
178
+ },
153
179
  },
154
180
  delays: {
155
181
  TIMEOUT: (context, event) => {
@@ -164,7 +190,7 @@ export default function (request) {
164
190
  const apiCallable = hasToken && isDoubleWallet
165
191
  const [{ data }, promotionList] = await Promise.all([
166
192
  hasToken ? request.send(activity.getActivityList({ appSecret })) : request.send(activity.getAllActivityList({ appSecret })),
167
- apiCallable ? request.send(payment.getPromotionsList()) : [],
193
+ apiCallable && !context.isPlaying ? request.send(payment.getPromotionsList()) : [],
168
194
  ])
169
195
 
170
196
  return { activityList: data, promotionList }
@@ -14,8 +14,9 @@ export default function (request) {
14
14
  tournamentList: [],
15
15
  promotionList: [],
16
16
  uidSite: '',
17
- detailNeededActivityTypes: [29, 34],
17
+ detailNeededActivityTypes: [4, 29, 34],
18
18
  activityDetailList: [],
19
+ isPlaying: false,
19
20
  },
20
21
  states: {
21
22
  fetchingList: {
@@ -47,9 +48,10 @@ export default function (request) {
47
48
  },
48
49
  pending: {
49
50
  after: {
50
- TIMEOUT: {
51
- target: 'fetchingList',
52
- },
51
+ TIMEOUT: [
52
+ { target: 'fetchingList', cond: 'isNotInGame' },
53
+ { target: 'checking', cond: 'isInGame' },
54
+ ],
53
55
  },
54
56
  on: {
55
57
  SET_UNREAD: {
@@ -57,6 +59,10 @@ export default function (request) {
57
59
  },
58
60
  REFRESH: {
59
61
  target: '#activity.fetchingList',
62
+ actions: 'leaveGame',
63
+ },
64
+ RESET_ACTIVITIES: {
65
+ actions: 'resetActivities',
60
66
  },
61
67
  },
62
68
  },
@@ -116,12 +122,32 @@ export default function (request) {
116
122
  activityDetailList: event.data.map((item) => item.data),
117
123
  }
118
124
  }),
125
+ resetActivities: assign((context, event) => {
126
+ const { activityList = [], detailNeededActivityTypes = [] } = context
127
+ const keepActivities = activityList.filter((activity) => detailNeededActivityTypes.includes(activity.activityType))
128
+ return {
129
+ isPlaying: true,
130
+ activityList: keepActivities,
131
+ promotionList: [],
132
+ }
133
+ }),
134
+ leaveGame: assign((context, event) => {
135
+ return {
136
+ isPlaying: false,
137
+ }
138
+ }),
119
139
  },
120
140
  guards: {
121
141
  needFetchingDetail: (context, event) => {
122
142
  const { activityList = [], detailNeededActivityTypes } = context
123
143
  return activityList.filter((activity) => detailNeededActivityTypes.includes(activity.activityType)).length > 0
124
144
  },
145
+ isInGame: (context, event) => {
146
+ return context.isPlaying
147
+ },
148
+ isNotInGame: (context, event) => {
149
+ return !context.isPlaying
150
+ },
125
151
  },
126
152
  delays: {
127
153
  TIMEOUT: (context, event) => {
@@ -33,6 +33,7 @@ export default function (request) {
33
33
  email: null,
34
34
  username: null,
35
35
  password: null,
36
+ additionalUserInfo: null,
36
37
  },
37
38
  countryAbbr: null,
38
39
  userInfo: {},
@@ -271,6 +272,10 @@ export default function (request) {
271
272
  LOGIN_APP: {
272
273
  target: '.authenticationApp',
273
274
  },
275
+ LOGIN_TELEGRAM: {
276
+ target: '.authentication',
277
+ actions: 'setLoginTelegram',
278
+ },
274
279
  SET_PLAY: {
275
280
  actions: 'setPlay',
276
281
  },
@@ -353,6 +358,17 @@ export default function (request) {
353
358
  },
354
359
  }
355
360
  }),
361
+ setLoginTelegram: assign((context, event) => {
362
+ const { loginType, additionalUserInfo, isSignature } = event.data
363
+ return {
364
+ loginData: {
365
+ provider: 'telegram',
366
+ loginType,
367
+ additionalUserInfo,
368
+ isSignature,
369
+ },
370
+ }
371
+ }),
356
372
  fetchToken: assign((context, event) => {
357
373
  const token = storage.get(tokenKey)
358
374
  return {
@@ -508,7 +524,12 @@ export default function (request) {
508
524
  },
509
525
  fetchSiteConfig: async (context, event) => {
510
526
  const { config } = await request.send(common.getConfig({ appSecret }))
511
- return JSON.parse(window.atob(config))
527
+ const parseConfig = JSON.parse(window.atob(config))
528
+ return {
529
+ loginMethods: parseConfig.loginMethods,
530
+ registerMethods: parseConfig.registerMethods,
531
+ dtVerify: parseConfig.dtVerify,
532
+ }
512
533
  },
513
534
  },
514
535
  }
@@ -40,6 +40,7 @@ export default function (request) {
40
40
  affiliateCode: null,
41
41
  defaultAffiliateCode: null,
42
42
  friendCode: null,
43
+ isPlaying: false,
43
44
  },
44
45
  states: {
45
46
  config: {
@@ -103,12 +104,18 @@ export default function (request) {
103
104
  },
104
105
  waiting: {
105
106
  after: {
106
- TIMEOUT: {
107
- target: 'updating',
108
- },
107
+ TIMEOUT: [{ target: 'updating', cond: 'isNotInGame' }, { target: 'waiting' }],
109
108
  },
110
109
  },
111
110
  },
111
+ on: {
112
+ ENTER_GAME_PAUSE: {
113
+ actions: 'resetByEnterGame',
114
+ },
115
+ LEAVE_GAME_REFRESH: {
116
+ actions: 'leaveGame',
117
+ },
118
+ },
112
119
  },
113
120
  getAnnouncements: {
114
121
  initial: 'updating',
@@ -309,6 +316,19 @@ export default function (request) {
309
316
  sentNormalBroadcastList: [],
310
317
  }
311
318
  }),
319
+ resetByEnterGame: assign((context, event) => {
320
+ return {
321
+ isPlaying: true,
322
+ broadcastList: null,
323
+ mailBoxInfo: null,
324
+ promotions: null,
325
+ }
326
+ }),
327
+ leaveGame: assign((context, event) => {
328
+ return {
329
+ isPlaying: false,
330
+ }
331
+ }),
312
332
  },
313
333
  guards: {
314
334
  isAffiliateCodeInstructionsEnable: (context, event) => {
@@ -316,6 +336,9 @@ export default function (request) {
316
336
  const { registerBindingAffiliateCodeInstructionsEnable } = siteConfig || {}
317
337
  return registerBindingAffiliateCodeInstructionsEnable ? JSON.parse(registerBindingAffiliateCodeInstructionsEnable) : false
318
338
  },
339
+ isNotInGame: (context, event) => {
340
+ return !context?.isPlaying
341
+ },
319
342
  },
320
343
  services: {
321
344
  fetchConfig: async (context, event) => {
@@ -40,12 +40,15 @@ export default function (request) {
40
40
  gameCode: null,
41
41
  name: null,
42
42
  },
43
+ walletMode: null,
43
44
  lang: 'en_US',
44
45
  isMobile: new UAParser().getResult().device.type,
45
46
  gameURL: null,
46
47
  gameToken: null,
47
48
  gameHtml: null,
49
+ gameWalletType: null,
48
50
  switchGame: null,
51
+ isPlaying: false,
49
52
  ...oldContext,
50
53
  },
51
54
  states: {
@@ -79,7 +82,7 @@ export default function (request) {
79
82
  },
80
83
  ENTER_GAME: {
81
84
  target: 'connecting',
82
- actions: ['setGameInfo', 'setLang'],
85
+ actions: ['setGameInfo', 'setLang', 'setWalletMode'],
83
86
  },
84
87
  MENU_ENTER_GAME: {
85
88
  target: 'connecting',
@@ -200,6 +203,13 @@ export default function (request) {
200
203
  target: 'connectSwitching',
201
204
  actions: ['setSwitch', 'setLang'],
202
205
  },
206
+ ENTER_GAME_PAUSE: {
207
+ actions: ['setIsPlaying', 'resetContent', 'resetSHA'],
208
+ },
209
+ LEAVE_GAME_REFRESH: {
210
+ target: '#game.oldTimer',
211
+ actions: 'setIsPlaying',
212
+ },
203
213
  },
204
214
  },
205
215
  refreshing: {
@@ -234,6 +244,11 @@ export default function (request) {
234
244
  actions: 'setGameURL',
235
245
  },
236
246
  },
247
+ on: {
248
+ LEAVE_GAME_REFRESH: {
249
+ actions: 'setIsPlaying',
250
+ },
251
+ },
237
252
  },
238
253
  },
239
254
  },
@@ -245,7 +260,7 @@ export default function (request) {
245
260
  20000: [
246
261
  {
247
262
  target: 'updating',
248
- cond: 'hasRoom',
263
+ cond: 'hasRoomAndIsNotInGame',
249
264
  },
250
265
  {
251
266
  target: 'pending',
@@ -311,9 +326,15 @@ export default function (request) {
311
326
  },
312
327
  pending: {
313
328
  after: {
314
- 20000: {
315
- target: 'fetchingGameSHA',
316
- },
329
+ 20000: [
330
+ {
331
+ target: 'fetchingGameSHA',
332
+ cond: 'isNotInGame',
333
+ },
334
+ {
335
+ target: 'pending',
336
+ },
337
+ ],
317
338
  },
318
339
  },
319
340
  },
@@ -430,6 +451,9 @@ export default function (request) {
430
451
  gameURL: (context, event) => {
431
452
  return event.data.gameURL
432
453
  },
454
+ gameWalletType: (context, event) => {
455
+ return event.data.gameWalletType
456
+ },
433
457
  }),
434
458
  clearGameInfo: assign((context, event) => {
435
459
  return { game: { providerId: null, gameId: null, gameTypeId: null, mappingId: null } }
@@ -445,6 +469,9 @@ export default function (request) {
445
469
  const { providerId, gameId, gameTypeId, mappingId, portrait, gameCode, name } = context.switchGame
446
470
  return { game: { providerId, gameId, gameTypeId, mappingId, portrait: portrait ? 1 : 0, gameCode, name } }
447
471
  }),
472
+ setWalletMode: assign((context, event) => {
473
+ return { walletMode: event.data.walletMode }
474
+ }),
448
475
  setLang: assign((context, event) => {
449
476
  const lang = event.data.locale.replace('-', '_')
450
477
  return { lang }
@@ -459,6 +486,11 @@ export default function (request) {
459
486
  pageLoading: false,
460
487
  }
461
488
  }),
489
+ setIsPlaying: assign((context, event) => {
490
+ return {
491
+ isPlaying: event.data,
492
+ }
493
+ }),
462
494
  ...oldActions,
463
495
  },
464
496
  guards: {
@@ -468,7 +500,12 @@ export default function (request) {
468
500
  // 是否有下一頁
469
501
  return loadable && !isLastPage
470
502
  },
471
- hasRoom: (context, event) => context.room?.categoryId,
503
+ isNotInGame: (context, event) => {
504
+ return !context.isPlaying
505
+ },
506
+ hasRoomAndIsNotInGame: (context, event) => {
507
+ return context.room?.categoryId && !context.isPlaying
508
+ },
472
509
  ...oldGuards,
473
510
  },
474
511
  services: {
@@ -483,7 +520,7 @@ export default function (request) {
483
520
  i18n: targetCategory.i18n,
484
521
  downLine: staticData
485
522
  .find((item) => item.category === targetCategory.id)
486
- .info.filter((item) => item.isGame === true)
523
+ .info.filter((item) => item.isGame)
487
524
  .slice(0, 20),
488
525
  }
489
526
  })
@@ -498,7 +535,7 @@ export default function (request) {
498
535
  index: 0,
499
536
  })
500
537
  )
501
- .then((res) => Object.assign({ downLine: res.data.filter((item) => item.isGame === true).slice(0, 20) }, category))
538
+ .then((res) => Object.assign({ downLine: res.data.filter((item) => item.isGame).slice(0, 20) }, category))
502
539
  })
503
540
  const result = await Promise.all([...requestChain, request.send(api.getListAddition(param))])
504
541
  return result.filter((item) => item.downLine.length > 0).slice(0, 6)
@@ -511,7 +548,7 @@ export default function (request) {
511
548
  index: 0,
512
549
  })
513
550
  )
514
- .then((res) => Object.assign({ downLine: res.data.filter((item) => item.isGame === true).slice(0, 20) }, category))
551
+ .then((res) => Object.assign({ downLine: res.data.filter((item) => item.isGame).slice(0, 20) }, category))
515
552
  })
516
553
  const result = await Promise.all([...requestChain])
517
554
  return result.filter((item) => item.downLine.length > 0).slice(0, 6)
@@ -576,7 +613,7 @@ export default function (request) {
576
613
  },
577
614
  connectGame: async (context, event) => {
578
615
  const returnProviders = ['RSG', 'KP', 'EPICWIN', 'AMBSLOT', 'SEXY_VENUS', 'SEXY_SEXYBCRT', 'PG', 'NPG']
579
- const { lang, isMobile } = context
616
+ const { lang, isMobile, walletMode } = context
580
617
  const { providerId, gameId, gameTypeId, mappingId } = context.game
581
618
  const params = {
582
619
  provider_id: providerId,
@@ -586,10 +623,11 @@ export default function (request) {
586
623
  is_demo: false,
587
624
  is_mobile: isMobile === 'mobile' ? 'y' : null,
588
625
  lang,
626
+ selected_wallet_type: walletMode,
589
627
  return_url: returnProviders.includes(providerId) ? `${window.location.origin}${context.base}return` : window.location.href, // For providers to return.
590
628
  }
591
- const { type, redirect_url, gameToken, gameHtml } = await request.send(api.playGame(params))
592
- return { type, gameToken, gameHtml, gameURL: redirect_url }
629
+ const { type, redirect_url, gameToken, gameHtml, wallet_type } = await request.send(api.playGame(params))
630
+ return { type, gameToken, gameHtml, gameURL: redirect_url, gameWalletType: wallet_type }
593
631
  },
594
632
  disconnectGame: async (context, event) => {
595
633
  const uid_site = event.data
@@ -631,6 +669,16 @@ const oldActions = {
631
669
  optionMap: { ...optionMap, ...event.data },
632
670
  }
633
671
  }),
672
+ resetSHA: assign((context, event) => {
673
+ return {
674
+ sha: {
675
+ status: null,
676
+ },
677
+ isStatusChanged: false,
678
+ statusMap: {},
679
+ optionMap: {},
680
+ }
681
+ }),
634
682
  }
635
683
 
636
684
  const oldGuards = {
@@ -9,6 +9,7 @@ export default function (request) {
9
9
  type: 'parallel',
10
10
  context: {
11
11
  tick: 6000,
12
+ isPlaying: false,
12
13
  },
13
14
  states: {
14
15
  feed: {
@@ -30,6 +31,7 @@ export default function (request) {
30
31
  after: {
31
32
  TIMEOUT: {
32
33
  target: 'updating',
34
+ cond: 'isNotInGame',
33
35
  },
34
36
  },
35
37
  },
@@ -42,6 +44,7 @@ export default function (request) {
42
44
  on: {
43
45
  START_BROADCAST: {
44
46
  target: 'picking',
47
+ actions: 'leaveGame',
45
48
  },
46
49
  },
47
50
  },
@@ -102,10 +105,21 @@ export default function (request) {
102
105
  }),
103
106
  resetBroadcast: assign((context, event) => {
104
107
  return {
108
+ isPlaying: true,
105
109
  normalBroadcast: null,
106
110
  sentNormalBroadcastList: [],
107
111
  }
108
112
  }),
113
+ leaveGame: assign((context, event) => {
114
+ return {
115
+ isPlaying: false,
116
+ }
117
+ }),
118
+ },
119
+ guards: {
120
+ isNotInGame: (context, event) => {
121
+ return !context.isPlaying
122
+ },
109
123
  },
110
124
  services: {
111
125
  fetchHonorBoardList: async (context, event) => {
@@ -16,6 +16,7 @@ export default function (request) {
16
16
  receiveNo: null,
17
17
  withdrawRule: {},
18
18
  rewardType: null,
19
+ isPlaying: false,
19
20
  callback: () => {},
20
21
  },
21
22
  states: {
@@ -36,7 +37,7 @@ export default function (request) {
36
37
  },
37
38
  pending: {
38
39
  after: {
39
- 20000: { target: 'loading' },
40
+ 20000: { target: 'loading', cond: 'isNotInGame' },
40
41
  },
41
42
  },
42
43
  },
@@ -63,6 +64,9 @@ export default function (request) {
63
64
  target: 'allPointsReceiving',
64
65
  actions: 'setCallback',
65
66
  },
67
+ SET_IS_PLAYING: {
68
+ actions: 'setIsPlaying',
69
+ },
66
70
  },
67
71
  },
68
72
  fetching: {
@@ -157,12 +161,20 @@ export default function (request) {
157
161
  withdrawRule: event.data,
158
162
  }
159
163
  }),
164
+ setIsPlaying: assign((context, event) => {
165
+ return {
166
+ isPlaying: event.data,
167
+ }
168
+ }),
160
169
  },
161
170
  guards: {
162
171
  isPrize: (context, event) => {
163
172
  const { rewardType } = context
164
173
  return rewardType === 'PRIZE'
165
174
  },
175
+ isNotInGame: (context, event) => {
176
+ return !context.isPlaying
177
+ },
166
178
  },
167
179
  services: {
168
180
  fetchRewardList: async (context, event) => {
@@ -16,6 +16,7 @@ export default function (request) {
16
16
  activityNo: null,
17
17
  receiveNo: null,
18
18
  withdrawRule: {},
19
+ isPlaying: false,
19
20
  callback: () => {},
20
21
  },
21
22
  states: {
@@ -46,7 +47,7 @@ export default function (request) {
46
47
  },
47
48
  pending: {
48
49
  after: {
49
- 20000: { target: 'loading' },
50
+ 20000: [{ target: 'loading', cond: 'isNotInGame' }, { target: 'pending' }],
50
51
  },
51
52
  },
52
53
  },
@@ -73,6 +74,9 @@ export default function (request) {
73
74
  target: 'allPointsReceiving',
74
75
  actions: 'setCallback',
75
76
  },
77
+ SET_IS_PLAYING: {
78
+ actions: 'setIsPlaying',
79
+ },
76
80
  },
77
81
  },
78
82
  fetching: {
@@ -143,6 +147,11 @@ export default function (request) {
143
147
  },
144
148
  },
145
149
  {
150
+ guards: {
151
+ isNotInGame: (context, event) => {
152
+ return !context.isPlaying
153
+ },
154
+ },
146
155
  actions: {
147
156
  setAuth: assign((context, event) => {
148
157
  return { auth: !!event.data }
@@ -174,6 +183,11 @@ export default function (request) {
174
183
  withdrawRule: event.data,
175
184
  }
176
185
  }),
186
+ setIsPlaying: assign((context, event) => {
187
+ return {
188
+ isPlaying: event.data,
189
+ }
190
+ }),
177
191
  },
178
192
  services: {
179
193
  fetchRewardList: async (context, event) => {
@@ -110,7 +110,6 @@ export default class Request {
110
110
 
111
111
  _checkToken(req) {
112
112
  if (!req.isPublic && !this.getToken()) {
113
- console.error(req)
114
113
  throw { code: 'ERR_A103', url: req.url }
115
114
  }
116
115
  }
@@ -23,7 +23,6 @@ const getDeviceToken = async ({ fpToken, sentry, hosts, enable = true }) => {
23
23
  throw new Error('[Device Token] No token from FingerprintJS.')
24
24
  }
25
25
 
26
- console.log('[Device Token]', `${dt} from ${endpoints}`)
27
26
  sentry?.setTag('dt', dt)
28
27
  } catch (error) {
29
28
  console.error('[Device Token]', `${dt} from ${endpoints}`, error)