@jetthai/cuora 1.1.339 → 1.1.340-dev-2

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,7 +2,23 @@
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.339](https://github.com/jetthai/cuora-module/compare/v1.1.338...v1.1.339) (2025-02-18)
5
+ ### [1.1.340-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.340-dev-1...v1.1.340-dev-2) (2025-02-19)
6
+
7
+ ### [1.1.340](https://github.com/jetthai/cuora-module/compare/v1.1.339...v1.1.340) (2025-02-18)
8
+
9
+ ### [1.1.339](https://github.com/jetthai/cuora-module/compare/v1.1.338-dev-10...v1.1.339) (2025-02-18)
10
+
11
+ ### [1.1.340-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.338-dev-10...v1.1.340-dev-1) (2025-02-19)
12
+
13
+ ### [1.1.338-dev-10](https://github.com/jetthai/cuora-module/compare/v1.1.338-dev-9...v1.1.338-dev-10) (2025-02-17)
14
+
15
+ ### [1.1.338-dev-9](https://github.com/jetthai/cuora-module/compare/v1.1.338-dev-8...v1.1.338-dev-9) (2025-02-17)
16
+
17
+ ### [1.1.338-dev-8](https://github.com/jetthai/cuora-module/compare/v1.1.338-dev-7...v1.1.338-dev-8) (2025-02-14)
18
+
19
+ ### [1.1.338-perf-1](https://github.com/jetthai/cuora-module/compare/v1.1.338...v1.1.338-perf-1) (2025-02-12)
20
+
21
+ ### [1.1.338-dev-7](https://github.com/jetthai/cuora-module/compare/v1.1.338...v1.1.338-dev-7) (2025-02-14)
6
22
 
7
23
  ### [1.1.338](https://github.com/jetthai/cuora-module/compare/v1.1.337...v1.1.338) (2025-02-04)
8
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.339",
3
+ "version": "1.1.340-dev-2",
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
  }),
package/src/api/game.js CHANGED
@@ -98,4 +98,6 @@ export default {
98
98
  params: { providerId, seqNo, lang },
99
99
  isPublic: true,
100
100
  }),
101
+ getFreeGameList: () => ({ method: 'get', url: 'activities/getFreeGameRewardList' }),
102
+ getFreeGameReward: ({ activityNo, receiveNo }) => ({ method: 'post', url: 'activities/getFreeGameReward', params: { activityNo, receiveNo } }),
101
103
  }
@@ -222,10 +222,10 @@ export default {
222
222
  params: { transferType: 'WITHDRAW', amount },
223
223
  }),
224
224
  getPromotionsList: () => ({ url: `payment/v2/bankWallet/promotions`, method: 'get' }),
225
- getWithdrawRulePreview: ({ applyType, applyNo, amount }) => ({
225
+ getWithdrawRulePreview: ({ applyType, applyNo, amount, isFreeGame }) => ({
226
226
  url: `payment/v2/bankWallet/promotion/preview`,
227
227
  method: 'post',
228
- params: { applyType, applyNo, amount },
228
+ params: { applyType, applyNo, amount, isFreeGame },
229
229
  }),
230
230
  applyPromotions: ({ promotionsNo, amount }) => ({
231
231
  url: `payment/v2/bankWallet/promotion/apply`,
@@ -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 {
@@ -414,7 +430,7 @@ export default function (request) {
414
430
  }),
415
431
  redirectTo3Party: async (context, event) => {
416
432
  const { provider, channel, subchannel, fc } = event.data
417
- const deviceTokenEnable = context.siteConfig?.dtVerify === '1'
433
+ const deviceTokenEnable = context.siteConfig?.dtVerify
418
434
 
419
435
  const dt = await getDeviceToken({
420
436
  fpToken,
@@ -497,7 +513,7 @@ export default function (request) {
497
513
  return await request.send(user.getUserInfo())
498
514
  },
499
515
  checkDeviceToken: async (context, event) => {
500
- const deviceTokenEnable = context.siteConfig?.dtVerify === '1'
516
+ const deviceTokenEnable = context.siteConfig?.dtVerify
501
517
  if (deviceTokenEnable) {
502
518
  const { exist } = await request.send(user.checkDt())
503
519
  if (!exist) {
@@ -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
  }
@@ -17,7 +17,7 @@ export default function (request) {
17
17
  lineat: null,
18
18
  },
19
19
  loginMethods: {},
20
- forceValidation: '0',
20
+ forceValidation: false,
21
21
  urls: {
22
22
  widget: null,
23
23
  },
@@ -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) => {
@@ -55,8 +55,8 @@ export default function (request) {
55
55
  target: 'fetching',
56
56
  cond: (context, event) => {
57
57
  const { siteConfig = {}, promotion = {}, selectedCrypto } = context
58
- const { walletMode = '', bonusPreviewEnable = '0' } = siteConfig
59
- return !!selectedCrypto && walletMode === '4' && bonusPreviewEnable === '1' && promotion.activityNo != 'none'
58
+ const { walletMode = '', bonusPreviewEnable } = siteConfig
59
+ return !!selectedCrypto && walletMode === '4' && bonusPreviewEnable && promotion.activityNo != 'none'
60
60
  },
61
61
  },
62
62
  { target: 'loaded' },
@@ -72,8 +72,8 @@ export default function (request) {
72
72
  target: 'fetching',
73
73
  cond: (context, event) => {
74
74
  const { siteConfig = {}, promotion = {} } = context
75
- const { walletMode = '', bonusPreviewEnable = '0' } = siteConfig
76
- return walletMode === '4' && bonusPreviewEnable === '1' && promotion.activityNo != 'none'
75
+ const { walletMode = '', bonusPreviewEnable } = siteConfig
76
+ return walletMode === '4' && bonusPreviewEnable && promotion.activityNo != 'none'
77
77
  },
78
78
  },
79
79
  { target: 'loaded' },
@@ -49,8 +49,8 @@ export default function (request) {
49
49
  target: 'fetching',
50
50
  cond: (context, event) => {
51
51
  const { siteConfig = {}, promotion = {}, selectedCard } = context
52
- const { walletMode = '', bonusPreviewEnable = '0' } = siteConfig
53
- return !!selectedCard && walletMode === '4' && bonusPreviewEnable === '1' && promotion.activityNo != 'none'
52
+ const { walletMode = '', bonusPreviewEnable } = siteConfig
53
+ return !!selectedCard && walletMode === '4' && bonusPreviewEnable && promotion.activityNo != 'none'
54
54
  },
55
55
  },
56
56
  { target: 'loaded' },
@@ -78,8 +78,8 @@ export default function (request) {
78
78
  actions: 'setCard',
79
79
  cond: (context, event) => {
80
80
  const { siteConfig = {}, promotion = {} } = context
81
- const { walletMode = '', bonusPreviewEnable = '0' } = siteConfig
82
- return walletMode === '4' && bonusPreviewEnable === '1' && promotion.activityNo != 'none'
81
+ const { walletMode = '', bonusPreviewEnable } = siteConfig
82
+ return walletMode === '4' && bonusPreviewEnable && promotion.activityNo != 'none'
83
83
  },
84
84
  },
85
85
  {
@@ -216,8 +216,8 @@ export default function (request) {
216
216
  actions: 'setCard',
217
217
  cond: (context, event) => {
218
218
  const { siteConfig = {}, promotion = {} } = context
219
- const { walletMode = '', bonusPreviewEnable = '0' } = siteConfig
220
- return walletMode === '4' && bonusPreviewEnable === '1' && promotion.activityNo != 'none'
219
+ const { walletMode = '', bonusPreviewEnable } = siteConfig
220
+ return walletMode === '4' && bonusPreviewEnable && promotion.activityNo != 'none'
221
221
  },
222
222
  },
223
223
  {
@@ -49,8 +49,8 @@ export default function (request) {
49
49
  target: 'fetching',
50
50
  cond: (context, event) => {
51
51
  const { siteConfig = {}, promotion = {}, selectedQrcode } = context
52
- const { walletMode = '', bonusPreviewEnable = '0' } = siteConfig
53
- return !!selectedQrcode && walletMode === '4' && bonusPreviewEnable === '1' && promotion.activityNo != 'none'
52
+ const { walletMode = '', bonusPreviewEnable } = siteConfig
53
+ return !!selectedQrcode && walletMode === '4' && bonusPreviewEnable && promotion.activityNo != 'none'
54
54
  },
55
55
  },
56
56
  {
@@ -86,8 +86,8 @@ export default function (request) {
86
86
  actions: 'setQrcode',
87
87
  cond: (context, event) => {
88
88
  const { siteConfig = {}, promotion = {} } = context
89
- const { walletMode = '', bonusPreviewEnable = '0' } = siteConfig
90
- return walletMode === '4' && bonusPreviewEnable === '1' && promotion.activityNo != 'none'
89
+ const { walletMode = '', bonusPreviewEnable } = siteConfig
90
+ return walletMode === '4' && bonusPreviewEnable && promotion.activityNo != 'none'
91
91
  },
92
92
  },
93
93
  {
@@ -314,8 +314,8 @@ export default function (request) {
314
314
  actions: 'setQrcode',
315
315
  cond: (context, event) => {
316
316
  const { siteConfig = {}, promotion = {} } = context
317
- const { walletMode = '', bonusPreviewEnable = '0' } = siteConfig
318
- return walletMode === '4' && bonusPreviewEnable === '1' && promotion.activityNo != 'none'
317
+ const { walletMode = '', bonusPreviewEnable } = siteConfig
318
+ return walletMode === '4' && bonusPreviewEnable && promotion.activityNo != 'none'
319
319
  },
320
320
  },
321
321
  {
@@ -74,8 +74,8 @@ export default function (request) {
74
74
  target: 'fetching',
75
75
  cond: (context, event) => {
76
76
  const { siteConfig = {}, promotion = {} } = context
77
- const { walletMode = '', bonusPreviewEnable = '0' } = siteConfig
78
- return walletMode === '4' && bonusPreviewEnable === '1' && promotion.activityNo != 'none'
77
+ const { walletMode = '', bonusPreviewEnable } = siteConfig
78
+ return walletMode === '4' && bonusPreviewEnable && promotion.activityNo != 'none'
79
79
  },
80
80
  },
81
81
  { target: 'loaded' },
@@ -26,12 +26,16 @@ export default function () {
26
26
  { target: 'logout', cond: 'isLogout' },
27
27
  { target: 'deposit', cond: 'isNoBalance' },
28
28
  { target: 'unfinishedGame', cond: 'isUnfinishedGame', actions: 'setUnfinishedGame' },
29
+ { target: 'freeGameSettle', cond: 'isFreeGameSettle' },
30
+ { target: 'freeGameGiveUp', cond: 'isFreeGameGiveUp' },
29
31
  // { target: 'hall' },
30
32
  ],
31
33
  },
32
34
  logout: {},
33
35
  deposit: {},
34
36
  unfinishedGame: {},
37
+ freeGameSettle: {},
38
+ freeGameGiveUp: {},
35
39
  // hall: {},
36
40
  },
37
41
  },
@@ -65,6 +69,12 @@ export default function () {
65
69
  isUnfinishedGame: (context, event) => {
66
70
  return context.error.extend?.includes?.('unfinished_')
67
71
  },
72
+ isFreeGameSettle: (context, event) => {
73
+ return context.error.code === 'ERR_G124'
74
+ },
75
+ isFreeGameGiveUp: (context, event) => {
76
+ return context.error.code === 'ERR_G125'
77
+ },
68
78
  },
69
79
  services: {},
70
80
  }
@@ -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) => {
@@ -30,6 +30,7 @@ export default function (request) {
30
30
  withdrawRules: [],
31
31
  withdrawRule: {},
32
32
  withdrawCheck: {},
33
+ freeGameDetail: [],
33
34
  amount: null,
34
35
  calculation: null,
35
36
 
@@ -134,11 +135,11 @@ export default function (request) {
134
135
  invoke: {
135
136
  src: 'convertFreeCredit',
136
137
  onDone: [
137
- {
138
- target: '#withdraw_manual.otp',
139
- actions: 'setOtp',
140
- cond: 'isOtpRequired',
141
- },
138
+ // {
139
+ // target: '#withdraw_manual.otp',
140
+ // actions: 'setOtp',
141
+ // cond: 'isOtpRequired',
142
+ // },
142
143
  { target: 'converted' },
143
144
  ],
144
145
  onError: {
@@ -147,10 +148,10 @@ export default function (request) {
147
148
  },
148
149
  },
149
150
  converted: {
150
- always: [
151
- { target: '#withdraw_manual.cash.unbound', cond: 'isBankNotBound' },
152
- { target: '#withdraw_manual.cash.withdrawable', cond: 'hasAttachmentType' },
153
- ],
151
+ // always: [
152
+ // { target: '#withdraw_manual.cash.unbound', cond: 'isBankNotBound' },
153
+ // { target: '#withdraw_manual.cash.withdrawable', cond: 'hasAttachmentType' },
154
+ // ],
154
155
  },
155
156
  },
156
157
  },
@@ -407,7 +408,8 @@ export default function (request) {
407
408
  }
408
409
  }),
409
410
  updateWithdrawCondition: assign((context, event) => {
410
- const { enableWithdraw, enableWithdrawAmount, currentWithdrawLimit, targetWithdrawLimit, balance } = event.data
411
+ const { enableWithdraw, enableWithdrawAmount, currentWithdrawLimit, targetWithdrawLimit, balance, freeGameDetail, freeGameExpired } =
412
+ event.data
411
413
  const withdrawRules = event.data?.rules || []
412
414
  const rules = withdrawRules.filter((rule) => rule.maxWithdrawAmount > 0)
413
415
  const lastMatchedIndex = findLastIndex(rules, (rule) => balance >= rule.greaterEqualThen)
@@ -431,6 +433,8 @@ export default function (request) {
431
433
  enableWithdrawAmount: +enableWithdrawAmount,
432
434
  enableWithdraw,
433
435
  withdrawRules,
436
+ freeGameDetail,
437
+ freeGameExpired,
434
438
  }
435
439
  }),
436
440
  setWithdrawRulePreview: assign((context, event) => {
@@ -507,8 +511,13 @@ export default function (request) {
507
511
  return !context.boundBanks?.length
508
512
  },
509
513
  isConvertible: (context, event) => {
510
- const { enableWithdraw } = context
511
- return enableWithdraw
514
+ const { enableWithdraw, freeGameDetail } = context
515
+ const isFreeGame = freeGameDetail?.length > 0
516
+ if (isFreeGame) {
517
+ return freeGameDetail[0]?.freeGameCount === freeGameDetail[0]?.freeGameUsedCount
518
+ } else {
519
+ return enableWithdraw
520
+ }
512
521
  },
513
522
  isNotWithdrawable: (context, event) => {
514
523
  const { balance, enableWithdraw, paymentDetail } = context
@@ -107,11 +107,11 @@ export default function (request) {
107
107
  invoke: {
108
108
  src: 'convertFreeCredit',
109
109
  onDone: [
110
- {
111
- target: '#withdraw_vn.otp',
112
- actions: 'setOtp',
113
- cond: 'isOtpRequired',
114
- },
110
+ // {
111
+ // target: '#withdraw_vn.otp',
112
+ // actions: 'setOtp',
113
+ // cond: 'isOtpRequired',
114
+ // },
115
115
  { target: 'converted' },
116
116
  ],
117
117
  onError: {
@@ -120,10 +120,10 @@ export default function (request) {
120
120
  },
121
121
  },
122
122
  converted: {
123
- always: [
124
- { target: '#withdraw_vn.cash.unbound', cond: 'isBankNotBound' },
125
- { target: '#withdraw_vn.cash.withdrawable', cond: 'hasAttachmentType' },
126
- ],
123
+ // always: [
124
+ // { target: '#withdraw_vn.cash.unbound', cond: 'isBankNotBound' },
125
+ // { target: '#withdraw_vn.cash.withdrawable', cond: 'hasAttachmentType' },
126
+ // ],
127
127
  },
128
128
  },
129
129
  },
@@ -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)