@jetthai/cuora 1.1.341-dev-3 → 1.1.341-dev-5
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,11 @@
|
|
|
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-
|
|
5
|
+
### [1.1.341-dev-5](https://github.com/jetthai/cuora-module/compare/v1.1.341-dev-4...v1.1.341-dev-5) (2025-03-06)
|
|
6
|
+
|
|
7
|
+
### [1.1.341-dev-4](https://github.com/jetthai/cuora-module/compare/v1.1.341-dev-3...v1.1.341-dev-4) (2025-03-03)
|
|
8
|
+
|
|
9
|
+
### [1.1.341-dev-3](https://github.com/jetthai/cuora-module/compare/v1.1.341-dev-2...v1.1.341-dev-3) (2025-03-03)
|
|
6
10
|
|
|
7
11
|
### [1.1.341-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.341-dev-1...v1.1.341-dev-2) (2025-02-27)
|
|
8
12
|
|
package/package.json
CHANGED
package/src/api/game.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
getGameSHA: () => ({ method: 'get', url: 'game/list/v2/sha' }),
|
|
3
|
-
getOptionMap: (code) => ({ method: 'get', url: 'game/list/v2/options', params: { code } }),
|
|
4
|
-
getGameStatus: () => ({ method: 'get', url: 'game/list/v2/status' }),
|
|
5
2
|
getGameCategory: ({ id, first } = {}) => ({ method: 'get', url: 'game/list/v2/category', params: { id, first } }),
|
|
6
3
|
addFavoriteGame: (code) => ({ method: 'post', url: 'game/myfavorite/add', params: { games: [code] } }),
|
|
7
4
|
removeFavoriteGame: (code) => ({ method: 'post', url: 'game/myfavorite/remove', params: { games: [code] } }),
|
|
@@ -150,12 +150,8 @@ export default function (request) {
|
|
|
150
150
|
}
|
|
151
151
|
}),
|
|
152
152
|
resetActivities: assign((context, event) => {
|
|
153
|
-
const { activityList = [], specifyActivities = [] } = context
|
|
154
|
-
const keepActivities = activityList.filter((activity) => specifyActivities.includes(activity.activityType))
|
|
155
153
|
return {
|
|
156
154
|
isPlaying: true,
|
|
157
|
-
activityList: keepActivities,
|
|
158
|
-
promotionList: [],
|
|
159
155
|
}
|
|
160
156
|
}),
|
|
161
157
|
leaveGame: assign((context, event) => {
|
|
@@ -123,12 +123,8 @@ export default function (request) {
|
|
|
123
123
|
}
|
|
124
124
|
}),
|
|
125
125
|
resetActivities: assign((context, event) => {
|
|
126
|
-
const { activityList = [], detailNeededActivityTypes = [] } = context
|
|
127
|
-
const keepActivities = activityList.filter((activity) => detailNeededActivityTypes.includes(activity.activityType))
|
|
128
126
|
return {
|
|
129
127
|
isPlaying: true,
|
|
130
|
-
activityList: keepActivities,
|
|
131
|
-
promotionList: [],
|
|
132
128
|
}
|
|
133
129
|
}),
|
|
134
130
|
leaveGame: assign((context, event) => {
|
package/src/machine/game_v2_1.js
CHANGED
|
@@ -49,7 +49,6 @@ export default function (request) {
|
|
|
49
49
|
gameWalletType: null,
|
|
50
50
|
switchGame: null,
|
|
51
51
|
isPlaying: false,
|
|
52
|
-
...oldContext,
|
|
53
52
|
},
|
|
54
53
|
states: {
|
|
55
54
|
flow: {
|
|
@@ -207,7 +206,6 @@ export default function (request) {
|
|
|
207
206
|
actions: ['setIsPlaying', 'resetContent', 'resetSHA'],
|
|
208
207
|
},
|
|
209
208
|
LEAVE_GAME_REFRESH: {
|
|
210
|
-
target: '#game.oldTimer',
|
|
211
209
|
actions: 'setIsPlaying',
|
|
212
210
|
},
|
|
213
211
|
},
|
|
@@ -282,63 +280,6 @@ export default function (request) {
|
|
|
282
280
|
},
|
|
283
281
|
},
|
|
284
282
|
},
|
|
285
|
-
oldTimer: {
|
|
286
|
-
initial: 'fetchingGameSHA',
|
|
287
|
-
states: {
|
|
288
|
-
fetchingGameSHA: {
|
|
289
|
-
invoke: {
|
|
290
|
-
src: 'fetchGameSHA',
|
|
291
|
-
onDone: {
|
|
292
|
-
target: 'checking',
|
|
293
|
-
actions: 'setGameSHA',
|
|
294
|
-
},
|
|
295
|
-
onError: {
|
|
296
|
-
target: 'pending',
|
|
297
|
-
},
|
|
298
|
-
},
|
|
299
|
-
},
|
|
300
|
-
checking: {
|
|
301
|
-
always: [{ target: 'updatingStatus', cond: 'isStatusChanged' }, { target: 'pending' }],
|
|
302
|
-
},
|
|
303
|
-
updatingStatus: {
|
|
304
|
-
invoke: {
|
|
305
|
-
src: 'fetchStatus',
|
|
306
|
-
onDone: {
|
|
307
|
-
target: 'updatingOption',
|
|
308
|
-
actions: ['setStatus'],
|
|
309
|
-
},
|
|
310
|
-
onError: {
|
|
311
|
-
target: 'pending',
|
|
312
|
-
},
|
|
313
|
-
},
|
|
314
|
-
},
|
|
315
|
-
updatingOption: {
|
|
316
|
-
invoke: {
|
|
317
|
-
src: 'fetchOption',
|
|
318
|
-
onDone: {
|
|
319
|
-
target: 'pending',
|
|
320
|
-
actions: 'mergeOption',
|
|
321
|
-
},
|
|
322
|
-
onError: {
|
|
323
|
-
target: 'pending',
|
|
324
|
-
},
|
|
325
|
-
},
|
|
326
|
-
},
|
|
327
|
-
pending: {
|
|
328
|
-
after: {
|
|
329
|
-
20000: [
|
|
330
|
-
{
|
|
331
|
-
target: 'fetchingGameSHA',
|
|
332
|
-
cond: 'isNotInGame',
|
|
333
|
-
},
|
|
334
|
-
{
|
|
335
|
-
target: 'pending',
|
|
336
|
-
},
|
|
337
|
-
],
|
|
338
|
-
},
|
|
339
|
-
},
|
|
340
|
-
},
|
|
341
|
-
},
|
|
342
283
|
},
|
|
343
284
|
},
|
|
344
285
|
{
|
|
@@ -455,9 +396,6 @@ export default function (request) {
|
|
|
455
396
|
return event.data.gameWalletType
|
|
456
397
|
},
|
|
457
398
|
}),
|
|
458
|
-
clearGameInfo: assign((context, event) => {
|
|
459
|
-
return { game: { providerId: null, gameId: null, gameTypeId: null, mappingId: null } }
|
|
460
|
-
}),
|
|
461
399
|
setGameInfo: assign((context, event) => {
|
|
462
400
|
const { providerId, gameId, gameTypeId, mappingId, portrait, gameCode, name } = event.data.game
|
|
463
401
|
return { game: { providerId, gameId, gameTypeId, mappingId, portrait: portrait ? 1 : 0, gameCode, name } }
|
|
@@ -500,13 +438,9 @@ export default function (request) {
|
|
|
500
438
|
// 是否有下一頁
|
|
501
439
|
return loadable && !isLastPage
|
|
502
440
|
},
|
|
503
|
-
isNotInGame: (context, event) => {
|
|
504
|
-
return !context.isPlaying
|
|
505
|
-
},
|
|
506
441
|
hasRoomAndIsNotInGame: (context, event) => {
|
|
507
442
|
return context.room?.categoryId && !context.isPlaying
|
|
508
443
|
},
|
|
509
|
-
...oldGuards,
|
|
510
444
|
},
|
|
511
445
|
services: {
|
|
512
446
|
batchFetch: async (context, event) => {
|
|
@@ -634,75 +568,7 @@ export default function (request) {
|
|
|
634
568
|
const provider_id = context.game.providerId
|
|
635
569
|
return await request.send(api.logoutGame({ uid_site, provider_id }))
|
|
636
570
|
},
|
|
637
|
-
...oldServices(request),
|
|
638
571
|
},
|
|
639
572
|
}
|
|
640
573
|
)
|
|
641
574
|
}
|
|
642
|
-
|
|
643
|
-
const oldContext = {
|
|
644
|
-
sha: {
|
|
645
|
-
status: null,
|
|
646
|
-
},
|
|
647
|
-
isStatusChanged: false,
|
|
648
|
-
statusMap: {},
|
|
649
|
-
optionMap: {},
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
const oldActions = {
|
|
653
|
-
setGameSHA: assign((context, event) => {
|
|
654
|
-
const { sha } = context
|
|
655
|
-
const newSha = event.data
|
|
656
|
-
return {
|
|
657
|
-
sha: newSha,
|
|
658
|
-
isStatusChanged: !sha.status || sha.status !== newSha.status,
|
|
659
|
-
}
|
|
660
|
-
}),
|
|
661
|
-
setStatus: assign((context, event) => {
|
|
662
|
-
return {
|
|
663
|
-
statusMap: event.data,
|
|
664
|
-
}
|
|
665
|
-
}),
|
|
666
|
-
mergeOption: assign((context, event) => {
|
|
667
|
-
const { optionMap } = context
|
|
668
|
-
return {
|
|
669
|
-
optionMap: { ...optionMap, ...event.data },
|
|
670
|
-
}
|
|
671
|
-
}),
|
|
672
|
-
resetSHA: assign((context, event) => {
|
|
673
|
-
return {
|
|
674
|
-
sha: {
|
|
675
|
-
status: null,
|
|
676
|
-
},
|
|
677
|
-
isStatusChanged: false,
|
|
678
|
-
statusMap: {},
|
|
679
|
-
optionMap: {},
|
|
680
|
-
}
|
|
681
|
-
}),
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
const oldGuards = {
|
|
685
|
-
isStatusChanged: (context, event) => context.isStatusChanged,
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
const oldServices = (request) => ({
|
|
689
|
-
fetchOption: async (context, event) => {
|
|
690
|
-
if (request.getToken()) {
|
|
691
|
-
return await request.send(api.getOptionMap())
|
|
692
|
-
}
|
|
693
|
-
},
|
|
694
|
-
fetchGameSHA: async (context, event) => {
|
|
695
|
-
if (request.getToken()) {
|
|
696
|
-
return await request.send(api.getGameSHA())
|
|
697
|
-
} else {
|
|
698
|
-
return {
|
|
699
|
-
status: null,
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
},
|
|
703
|
-
fetchStatus: async (context, event) => {
|
|
704
|
-
if (request.getToken()) {
|
|
705
|
-
return await request.send(api.getGameStatus())
|
|
706
|
-
}
|
|
707
|
-
},
|
|
708
|
-
})
|
package/src/machine/websocket.js
CHANGED
|
@@ -273,6 +273,18 @@ export default function (request) {
|
|
|
273
273
|
callback({ type: 'ACTIVITY_INFO', data })
|
|
274
274
|
})
|
|
275
275
|
|
|
276
|
+
// 監聽 activity-reward-info 事件
|
|
277
|
+
clientSocket.on('activity-reward-info', (data) => {
|
|
278
|
+
console.log('[socket][activity-reward-info]:', data)
|
|
279
|
+
callback({ type: 'ACTIVITY_INFO', data })
|
|
280
|
+
})
|
|
281
|
+
|
|
282
|
+
// 監聽 message-notice-info 事件
|
|
283
|
+
clientSocket.on('message-notice-info', (data) => {
|
|
284
|
+
console.log('[socket][message-notice-info]:', data)
|
|
285
|
+
callback({ type: 'ACTIVITY_INFO', data })
|
|
286
|
+
})
|
|
287
|
+
|
|
276
288
|
// 監聽 payment-info 事件
|
|
277
289
|
clientSocket.on('payment-info', (data) => {
|
|
278
290
|
console.log('[socket][payment-info]:', data, data.windowType)
|