@jetthai/cuora 1.1.74-cash → 1.1.74
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/.husky/pre-commit +1 -1
- package/CHANGELOG.md +0 -6
- package/dist/bundle.mjs +827 -79
- package/package.json +1 -1
- package/src/machine/activity/deposit_activity.js +2 -2
- package/src/machine/activity/fafafa_activity.js +0 -12
- package/src/machine/activity/specify_turnover_activity.js +1 -14
- package/src/machine/game.js +285 -0
- package/src/machine/game_favorite.js +123 -0
- package/src/machine/game_favorite_v2.js +2 -6
- package/src/machine/game_v2.js +381 -0
- package/src/machine/game_v2_1.js +9 -36
- package/src/machine/index.js +6 -0
- package/src/request/request.js +5 -9
package/dist/bundle.mjs
CHANGED
|
@@ -3613,7 +3613,7 @@ var common$1 = {
|
|
|
3613
3613
|
getAnnouncements: () => ({ url: 'getAnnouncements', method: 'get', isPublic: true }),
|
|
3614
3614
|
};
|
|
3615
3615
|
|
|
3616
|
-
var game = {
|
|
3616
|
+
var game$1 = {
|
|
3617
3617
|
getGameSHA: () => ({ method: 'get', url: 'game/list/v2/sha' }),
|
|
3618
3618
|
getOptionMap: (code) => ({ method: 'get', url: 'game/list/v2/options', params: { code } }),
|
|
3619
3619
|
getGameStatus: () => ({ method: 'get', url: 'game/list/v2/status' }),
|
|
@@ -3928,7 +3928,7 @@ var form = {
|
|
|
3928
3928
|
upload: (formData) => ({ url: 'upload', method: 'post', params: formData, isFormData: true }),
|
|
3929
3929
|
};
|
|
3930
3930
|
|
|
3931
|
-
var index$2 = { activity: api, auth: auth$1, common: common$1, game, mailbox, payment, user, form };
|
|
3931
|
+
var index$2 = { activity: api, auth: auth$1, common: common$1, game: game$1, mailbox, payment, user, form };
|
|
3932
3932
|
|
|
3933
3933
|
/*! *****************************************************************************
|
|
3934
3934
|
Copyright (c) Microsoft Corporation.
|
|
@@ -17053,13 +17053,672 @@ function error () {
|
|
|
17053
17053
|
)
|
|
17054
17054
|
}
|
|
17055
17055
|
|
|
17056
|
+
// const UAParser = require('ua-parser-js')
|
|
17057
|
+
|
|
17058
|
+
function game (request) {
|
|
17059
|
+
return createMachine(
|
|
17060
|
+
{
|
|
17061
|
+
id: 'game',
|
|
17062
|
+
type: 'parallel',
|
|
17063
|
+
context: {
|
|
17064
|
+
roomId: null,
|
|
17065
|
+
room: null,
|
|
17066
|
+
list: [],
|
|
17067
|
+
gameList: [],
|
|
17068
|
+
// play params
|
|
17069
|
+
game: {
|
|
17070
|
+
provider: null,
|
|
17071
|
+
game_id: null,
|
|
17072
|
+
game_type: null,
|
|
17073
|
+
mapping_id: null,
|
|
17074
|
+
portrait: null,
|
|
17075
|
+
},
|
|
17076
|
+
lang: 'en_US',
|
|
17077
|
+
isMobile: new UAParser().getResult().device.type,
|
|
17078
|
+
gameURL: null,
|
|
17079
|
+
// game database
|
|
17080
|
+
sha: {
|
|
17081
|
+
category: null,
|
|
17082
|
+
status: null,
|
|
17083
|
+
},
|
|
17084
|
+
isCategoryChanged: false,
|
|
17085
|
+
isStatusChanged: false,
|
|
17086
|
+
statusMap: {},
|
|
17087
|
+
optionMap: {},
|
|
17088
|
+
},
|
|
17089
|
+
states: {
|
|
17090
|
+
flow: {
|
|
17091
|
+
initial: 'idle',
|
|
17092
|
+
states: {
|
|
17093
|
+
idle: {
|
|
17094
|
+
enter: 'clearGameInfo',
|
|
17095
|
+
on: {
|
|
17096
|
+
SET_ROOM: {
|
|
17097
|
+
target: 'loading',
|
|
17098
|
+
actions: 'setRoom',
|
|
17099
|
+
cond: (context, event) => {
|
|
17100
|
+
return context.room?.id !== event.data?.id
|
|
17101
|
+
},
|
|
17102
|
+
},
|
|
17103
|
+
ENTER_GAME: {
|
|
17104
|
+
target: 'connecting',
|
|
17105
|
+
actions: ['setGameInfo', 'setLang'],
|
|
17106
|
+
},
|
|
17107
|
+
},
|
|
17108
|
+
},
|
|
17109
|
+
loading: {
|
|
17110
|
+
invoke: {
|
|
17111
|
+
src: 'getRoomItems',
|
|
17112
|
+
onDone: {
|
|
17113
|
+
target: 'idle',
|
|
17114
|
+
actions: 'setList',
|
|
17115
|
+
},
|
|
17116
|
+
onError: {
|
|
17117
|
+
target: 'idle',
|
|
17118
|
+
actions: assign({ list: [] }),
|
|
17119
|
+
},
|
|
17120
|
+
},
|
|
17121
|
+
},
|
|
17122
|
+
connecting: {
|
|
17123
|
+
invoke: {
|
|
17124
|
+
src: 'connectGame',
|
|
17125
|
+
onDone: {
|
|
17126
|
+
target: 'playing',
|
|
17127
|
+
actions: 'setGameURL',
|
|
17128
|
+
},
|
|
17129
|
+
onError: {
|
|
17130
|
+
target: 'idle',
|
|
17131
|
+
},
|
|
17132
|
+
},
|
|
17133
|
+
},
|
|
17134
|
+
playing: {
|
|
17135
|
+
on: {
|
|
17136
|
+
EXIT_GAME: {
|
|
17137
|
+
target: 'disconnect',
|
|
17138
|
+
},
|
|
17139
|
+
},
|
|
17140
|
+
},
|
|
17141
|
+
disconnect: {
|
|
17142
|
+
invoke: {
|
|
17143
|
+
src: 'disconnectGame',
|
|
17144
|
+
onDone: {
|
|
17145
|
+
target: 'idle',
|
|
17146
|
+
},
|
|
17147
|
+
onError: {
|
|
17148
|
+
target: 'idle',
|
|
17149
|
+
},
|
|
17150
|
+
},
|
|
17151
|
+
},
|
|
17152
|
+
},
|
|
17153
|
+
},
|
|
17154
|
+
timer: {
|
|
17155
|
+
initial: 'fetchingGameSHA',
|
|
17156
|
+
states: {
|
|
17157
|
+
fetchingGameSHA: {
|
|
17158
|
+
invoke: {
|
|
17159
|
+
src: 'fetchGameSHA',
|
|
17160
|
+
onDone: {
|
|
17161
|
+
target: 'checking',
|
|
17162
|
+
actions: 'setGameSHA',
|
|
17163
|
+
},
|
|
17164
|
+
onError: {
|
|
17165
|
+
target: 'pending',
|
|
17166
|
+
},
|
|
17167
|
+
},
|
|
17168
|
+
},
|
|
17169
|
+
checking: {
|
|
17170
|
+
always: [
|
|
17171
|
+
{ target: 'updatingStatus', cond: 'isStatusChanged' },
|
|
17172
|
+
{ target: 'updatingCategory', cond: 'isCategoryChanged' },
|
|
17173
|
+
{ target: 'pending' },
|
|
17174
|
+
],
|
|
17175
|
+
},
|
|
17176
|
+
updatingStatus: {
|
|
17177
|
+
invoke: {
|
|
17178
|
+
src: 'fetchStatus',
|
|
17179
|
+
onDone: {
|
|
17180
|
+
target: 'updatingOption',
|
|
17181
|
+
actions: ['setStatus'],
|
|
17182
|
+
},
|
|
17183
|
+
onError: {
|
|
17184
|
+
target: 'pending',
|
|
17185
|
+
},
|
|
17186
|
+
},
|
|
17187
|
+
},
|
|
17188
|
+
updatingOption: {
|
|
17189
|
+
invoke: {
|
|
17190
|
+
src: 'fetchOption',
|
|
17191
|
+
onDone: {
|
|
17192
|
+
target: 'updatingCategory',
|
|
17193
|
+
actions: 'mergeOption',
|
|
17194
|
+
},
|
|
17195
|
+
onError: {
|
|
17196
|
+
target: 'pending',
|
|
17197
|
+
},
|
|
17198
|
+
},
|
|
17199
|
+
},
|
|
17200
|
+
updatingCategory: {
|
|
17201
|
+
invoke: {
|
|
17202
|
+
src: 'getRoomItems',
|
|
17203
|
+
onDone: {
|
|
17204
|
+
target: 'pending',
|
|
17205
|
+
actions: 'setList',
|
|
17206
|
+
},
|
|
17207
|
+
onError: {
|
|
17208
|
+
target: 'pending',
|
|
17209
|
+
},
|
|
17210
|
+
},
|
|
17211
|
+
},
|
|
17212
|
+
pending: {
|
|
17213
|
+
after: {
|
|
17214
|
+
20000: {
|
|
17215
|
+
target: 'fetchingGameSHA',
|
|
17216
|
+
},
|
|
17217
|
+
},
|
|
17218
|
+
},
|
|
17219
|
+
},
|
|
17220
|
+
},
|
|
17221
|
+
},
|
|
17222
|
+
},
|
|
17223
|
+
{
|
|
17224
|
+
actions: {
|
|
17225
|
+
setRoomId: assign((context, event) => {
|
|
17226
|
+
return { roomId: event.roomId }
|
|
17227
|
+
}),
|
|
17228
|
+
setRoom: assign((context, event) => {
|
|
17229
|
+
return {
|
|
17230
|
+
room: event.data,
|
|
17231
|
+
roomId: event.data.id,
|
|
17232
|
+
}
|
|
17233
|
+
}),
|
|
17234
|
+
setList: assign((context, event) => {
|
|
17235
|
+
const { statusMap, optionMap } = context;
|
|
17236
|
+
const { list = [] } = event.data;
|
|
17237
|
+
const gameList = list
|
|
17238
|
+
.map((item) => {
|
|
17239
|
+
if (item.id) {
|
|
17240
|
+
item.room = true;
|
|
17241
|
+
return item
|
|
17242
|
+
}
|
|
17243
|
+
|
|
17244
|
+
const code = item.g;
|
|
17245
|
+
if (!code || !optionMap[code]) {
|
|
17246
|
+
return
|
|
17247
|
+
}
|
|
17248
|
+
|
|
17249
|
+
return {
|
|
17250
|
+
...optionMap[code],
|
|
17251
|
+
code,
|
|
17252
|
+
system_enable: statusMap[code][0],
|
|
17253
|
+
}
|
|
17254
|
+
})
|
|
17255
|
+
.filter((item) => item && !item.header)
|
|
17256
|
+
.sort((a, b) => a.system_enable - b.system_enable);
|
|
17257
|
+
return { list, gameList }
|
|
17258
|
+
}),
|
|
17259
|
+
setGameURL: assign({
|
|
17260
|
+
gameURL: (context, event) => {
|
|
17261
|
+
return event.data.gameURL
|
|
17262
|
+
},
|
|
17263
|
+
}),
|
|
17264
|
+
clearGameInfo: assign((context, event) => {
|
|
17265
|
+
return { game: { provider: null, game_id: null, game_type: null, mapping_id: null } }
|
|
17266
|
+
}),
|
|
17267
|
+
setGameInfo: assign((context, event) => {
|
|
17268
|
+
const { provider, game_id, game_type, mapping_id, portrait } = event.data.game;
|
|
17269
|
+
return { game: { provider, game_id, game_type, mapping_id, portrait } }
|
|
17270
|
+
}),
|
|
17271
|
+
setLang: assign((context, event) => {
|
|
17272
|
+
const lang = event.data.locale.replace('-', '_');
|
|
17273
|
+
return { lang }
|
|
17274
|
+
}),
|
|
17275
|
+
setGameSHA: assign((context, event) => {
|
|
17276
|
+
const { sha } = context;
|
|
17277
|
+
const newSha = event.data;
|
|
17278
|
+
return {
|
|
17279
|
+
sha: newSha,
|
|
17280
|
+
isCategoryChanged: !sha.category || sha.category !== newSha.category,
|
|
17281
|
+
isStatusChanged: !sha.status || sha.status !== newSha.status,
|
|
17282
|
+
}
|
|
17283
|
+
}),
|
|
17284
|
+
setStatus: assign((context, event) => {
|
|
17285
|
+
return {
|
|
17286
|
+
statusMap: event.data,
|
|
17287
|
+
}
|
|
17288
|
+
}),
|
|
17289
|
+
mergeOption: assign((context, event) => {
|
|
17290
|
+
const { optionMap } = context;
|
|
17291
|
+
return {
|
|
17292
|
+
optionMap: { ...optionMap, ...event.data },
|
|
17293
|
+
}
|
|
17294
|
+
}),
|
|
17295
|
+
},
|
|
17296
|
+
guards: {
|
|
17297
|
+
isCategoryChanged: (context, event) => context.isCategoryChanged,
|
|
17298
|
+
isStatusChanged: (context, event) => context.isStatusChanged,
|
|
17299
|
+
},
|
|
17300
|
+
services: {
|
|
17301
|
+
getRoomItems: async (context, event) => {
|
|
17302
|
+
return await request.send(game$1.getGameCategory({ id: context.roomId }))
|
|
17303
|
+
},
|
|
17304
|
+
connectGame: async (context, event) => {
|
|
17305
|
+
const { lang, isMobile } = context;
|
|
17306
|
+
const { provider, game_id, game_type, mapping_id } = context.game;
|
|
17307
|
+
const params = {
|
|
17308
|
+
provider_id: provider,
|
|
17309
|
+
game_id: game_id,
|
|
17310
|
+
gametype_id: game_type,
|
|
17311
|
+
mapping_id: mapping_id,
|
|
17312
|
+
is_demo: false,
|
|
17313
|
+
is_mobile: isMobile,
|
|
17314
|
+
lang,
|
|
17315
|
+
return_url: window.location.href,
|
|
17316
|
+
};
|
|
17317
|
+
const { redirect_url } = await request.send(game$1.playGame(params));
|
|
17318
|
+
return { gameURL: redirect_url }
|
|
17319
|
+
},
|
|
17320
|
+
disconnectGame: async (context, event) => {
|
|
17321
|
+
const uid_site = event.data;
|
|
17322
|
+
return await request.send(game$1.logoutGame({ uid_site, provider_id: context.game.provider }))
|
|
17323
|
+
},
|
|
17324
|
+
fetchOption: async (context, event) => {
|
|
17325
|
+
return await request.send(game$1.getOptionMap())
|
|
17326
|
+
},
|
|
17327
|
+
fetchGameSHA: async (context, event) => {
|
|
17328
|
+
return await request.send(game$1.getGameSHA())
|
|
17329
|
+
},
|
|
17330
|
+
fetchStatus: async (context, event) => {
|
|
17331
|
+
return await request.send(game$1.getGameStatus())
|
|
17332
|
+
},
|
|
17333
|
+
},
|
|
17334
|
+
}
|
|
17335
|
+
)
|
|
17336
|
+
}
|
|
17337
|
+
|
|
17056
17338
|
const MY_FAVORITE = 'MyFavorite';
|
|
17057
17339
|
const GAME_SEARCH = 'GameSearch';
|
|
17058
17340
|
|
|
17059
|
-
var constant = /*#__PURE__*/Object.freeze({
|
|
17060
|
-
__proto__: null,
|
|
17061
|
-
MY_FAVORITE: MY_FAVORITE,
|
|
17062
|
-
GAME_SEARCH: GAME_SEARCH
|
|
17341
|
+
var constant = /*#__PURE__*/Object.freeze({
|
|
17342
|
+
__proto__: null,
|
|
17343
|
+
MY_FAVORITE: MY_FAVORITE,
|
|
17344
|
+
GAME_SEARCH: GAME_SEARCH
|
|
17345
|
+
});
|
|
17346
|
+
|
|
17347
|
+
function game_v2 (request) {
|
|
17348
|
+
return createMachine(
|
|
17349
|
+
{
|
|
17350
|
+
id: 'game',
|
|
17351
|
+
type: 'parallel',
|
|
17352
|
+
context: {
|
|
17353
|
+
room: null,
|
|
17354
|
+
index: 0,
|
|
17355
|
+
content: {
|
|
17356
|
+
data: [],
|
|
17357
|
+
timestamp: null,
|
|
17358
|
+
parentCategoryId: null,
|
|
17359
|
+
totalPage: 1,
|
|
17360
|
+
},
|
|
17361
|
+
addition: {
|
|
17362
|
+
data: [],
|
|
17363
|
+
timestamp: null,
|
|
17364
|
+
totalPage: 1,
|
|
17365
|
+
},
|
|
17366
|
+
// play params
|
|
17367
|
+
game: {
|
|
17368
|
+
providerId: null,
|
|
17369
|
+
gameId: null,
|
|
17370
|
+
gameTypeId: null,
|
|
17371
|
+
mappingId: null,
|
|
17372
|
+
portrait: null,
|
|
17373
|
+
},
|
|
17374
|
+
lang: 'en_US',
|
|
17375
|
+
isMobile: new UAParser().getResult().device.type,
|
|
17376
|
+
gameURL: null,
|
|
17377
|
+
...oldContext$1,
|
|
17378
|
+
},
|
|
17379
|
+
states: {
|
|
17380
|
+
flow: {
|
|
17381
|
+
initial: 'idle',
|
|
17382
|
+
states: {
|
|
17383
|
+
idle: {
|
|
17384
|
+
enter: 'clearGameInfo',
|
|
17385
|
+
on: {
|
|
17386
|
+
ENTER_ROOM: {
|
|
17387
|
+
target: 'loading',
|
|
17388
|
+
cond: 'isDifferentRoom',
|
|
17389
|
+
actions: ['setRoom', 'resetContent'],
|
|
17390
|
+
},
|
|
17391
|
+
NEXT_PAGE: {
|
|
17392
|
+
target: 'loading',
|
|
17393
|
+
cond: 'hasNext',
|
|
17394
|
+
actions: 'increaseIndex',
|
|
17395
|
+
},
|
|
17396
|
+
ENTER_GAME: {
|
|
17397
|
+
target: 'connecting',
|
|
17398
|
+
actions: ['setGameInfo', 'setLang'],
|
|
17399
|
+
},
|
|
17400
|
+
},
|
|
17401
|
+
},
|
|
17402
|
+
loading: {
|
|
17403
|
+
invoke: {
|
|
17404
|
+
src: 'getPageContent',
|
|
17405
|
+
onDone: {
|
|
17406
|
+
target: 'idle',
|
|
17407
|
+
actions: 'appendContent',
|
|
17408
|
+
},
|
|
17409
|
+
onError: {
|
|
17410
|
+
target: 'idle',
|
|
17411
|
+
},
|
|
17412
|
+
},
|
|
17413
|
+
},
|
|
17414
|
+
connecting: {
|
|
17415
|
+
invoke: {
|
|
17416
|
+
src: 'connectGame',
|
|
17417
|
+
onDone: {
|
|
17418
|
+
target: 'playing',
|
|
17419
|
+
actions: 'setGameURL',
|
|
17420
|
+
},
|
|
17421
|
+
onError: {
|
|
17422
|
+
target: 'idle',
|
|
17423
|
+
},
|
|
17424
|
+
},
|
|
17425
|
+
},
|
|
17426
|
+
playing: {
|
|
17427
|
+
on: {
|
|
17428
|
+
EXIT_GAME: {
|
|
17429
|
+
target: 'disconnect',
|
|
17430
|
+
},
|
|
17431
|
+
},
|
|
17432
|
+
},
|
|
17433
|
+
disconnect: {
|
|
17434
|
+
invoke: {
|
|
17435
|
+
src: 'disconnectGame',
|
|
17436
|
+
onDone: {
|
|
17437
|
+
target: 'idle',
|
|
17438
|
+
},
|
|
17439
|
+
onError: {
|
|
17440
|
+
target: 'idle',
|
|
17441
|
+
},
|
|
17442
|
+
},
|
|
17443
|
+
},
|
|
17444
|
+
},
|
|
17445
|
+
},
|
|
17446
|
+
timer: {
|
|
17447
|
+
initial: 'pending',
|
|
17448
|
+
states: {
|
|
17449
|
+
pending: {
|
|
17450
|
+
after: {
|
|
17451
|
+
20000: [
|
|
17452
|
+
{
|
|
17453
|
+
target: 'updating',
|
|
17454
|
+
cond: 'hasRoom',
|
|
17455
|
+
},
|
|
17456
|
+
{
|
|
17457
|
+
target: 'pending',
|
|
17458
|
+
},
|
|
17459
|
+
],
|
|
17460
|
+
},
|
|
17461
|
+
},
|
|
17462
|
+
updating: {
|
|
17463
|
+
invoke: {
|
|
17464
|
+
src: 'updatePageContent',
|
|
17465
|
+
onDone: {
|
|
17466
|
+
target: 'pending',
|
|
17467
|
+
actions: 'swapContent',
|
|
17468
|
+
},
|
|
17469
|
+
onError: {
|
|
17470
|
+
target: 'pending',
|
|
17471
|
+
},
|
|
17472
|
+
},
|
|
17473
|
+
},
|
|
17474
|
+
},
|
|
17475
|
+
},
|
|
17476
|
+
oldTimer: {
|
|
17477
|
+
initial: 'fetchingGameSHA',
|
|
17478
|
+
states: {
|
|
17479
|
+
fetchingGameSHA: {
|
|
17480
|
+
invoke: {
|
|
17481
|
+
src: 'fetchGameSHA',
|
|
17482
|
+
onDone: {
|
|
17483
|
+
target: 'checking',
|
|
17484
|
+
actions: 'setGameSHA',
|
|
17485
|
+
},
|
|
17486
|
+
onError: {
|
|
17487
|
+
target: 'pending',
|
|
17488
|
+
},
|
|
17489
|
+
},
|
|
17490
|
+
},
|
|
17491
|
+
checking: {
|
|
17492
|
+
always: [{ target: 'updatingStatus', cond: 'isStatusChanged' }, { target: 'pending' }],
|
|
17493
|
+
},
|
|
17494
|
+
updatingStatus: {
|
|
17495
|
+
invoke: {
|
|
17496
|
+
src: 'fetchStatus',
|
|
17497
|
+
onDone: {
|
|
17498
|
+
target: 'updatingOption',
|
|
17499
|
+
actions: ['setStatus'],
|
|
17500
|
+
},
|
|
17501
|
+
onError: {
|
|
17502
|
+
target: 'pending',
|
|
17503
|
+
},
|
|
17504
|
+
},
|
|
17505
|
+
},
|
|
17506
|
+
updatingOption: {
|
|
17507
|
+
invoke: {
|
|
17508
|
+
src: 'fetchOption',
|
|
17509
|
+
onDone: {
|
|
17510
|
+
target: 'pending',
|
|
17511
|
+
actions: 'mergeOption',
|
|
17512
|
+
},
|
|
17513
|
+
onError: {
|
|
17514
|
+
target: 'pending',
|
|
17515
|
+
},
|
|
17516
|
+
},
|
|
17517
|
+
},
|
|
17518
|
+
pending: {
|
|
17519
|
+
after: {
|
|
17520
|
+
20000: {
|
|
17521
|
+
target: 'fetchingGameSHA',
|
|
17522
|
+
},
|
|
17523
|
+
},
|
|
17524
|
+
},
|
|
17525
|
+
},
|
|
17526
|
+
},
|
|
17527
|
+
},
|
|
17528
|
+
},
|
|
17529
|
+
{
|
|
17530
|
+
actions: {
|
|
17531
|
+
setFavoriteList: assign((context, event) => {
|
|
17532
|
+
return {
|
|
17533
|
+
favoriteList: event.data.data || [],
|
|
17534
|
+
}
|
|
17535
|
+
}),
|
|
17536
|
+
setRoom: assign((context, event) => {
|
|
17537
|
+
return {
|
|
17538
|
+
room: event.data,
|
|
17539
|
+
}
|
|
17540
|
+
}),
|
|
17541
|
+
resetContent: assign((context, event) => {
|
|
17542
|
+
return {
|
|
17543
|
+
index: 0,
|
|
17544
|
+
content: {
|
|
17545
|
+
data: [],
|
|
17546
|
+
timestamp: null,
|
|
17547
|
+
parentCategoryId: null,
|
|
17548
|
+
totalPage: 1,
|
|
17549
|
+
},
|
|
17550
|
+
addition: {
|
|
17551
|
+
data: [],
|
|
17552
|
+
timestamp: null,
|
|
17553
|
+
totalPage: 1,
|
|
17554
|
+
},
|
|
17555
|
+
}
|
|
17556
|
+
}),
|
|
17557
|
+
appendContent: assign((context, event) => {
|
|
17558
|
+
const { room, favoriteList } = context;
|
|
17559
|
+
if (room.categoryId === GAME_SEARCH) {
|
|
17560
|
+
return
|
|
17561
|
+
} else {
|
|
17562
|
+
const [content, addition] = event.data;
|
|
17563
|
+
return {
|
|
17564
|
+
content: {
|
|
17565
|
+
...context.content,
|
|
17566
|
+
...content,
|
|
17567
|
+
data: context.content.data.concat(content.data),
|
|
17568
|
+
},
|
|
17569
|
+
addition: {
|
|
17570
|
+
...context.addition,
|
|
17571
|
+
...addition,
|
|
17572
|
+
data: context.addition.data.concat(addition.data),
|
|
17573
|
+
},
|
|
17574
|
+
}
|
|
17575
|
+
}
|
|
17576
|
+
}),
|
|
17577
|
+
swapContent: assign((context, event) => {
|
|
17578
|
+
const [content, addition] = event.data;
|
|
17579
|
+
let result = {};
|
|
17580
|
+
if (content?.data?.length) {
|
|
17581
|
+
result.content = content;
|
|
17582
|
+
}
|
|
17583
|
+
if (addition?.data?.length) {
|
|
17584
|
+
result.addition = addition;
|
|
17585
|
+
}
|
|
17586
|
+
return result
|
|
17587
|
+
}),
|
|
17588
|
+
increaseIndex: assign((context, event) => {
|
|
17589
|
+
return {
|
|
17590
|
+
index: context.index + 1,
|
|
17591
|
+
}
|
|
17592
|
+
}),
|
|
17593
|
+
setGameURL: assign({
|
|
17594
|
+
gameURL: (context, event) => {
|
|
17595
|
+
return event.data.gameURL
|
|
17596
|
+
},
|
|
17597
|
+
}),
|
|
17598
|
+
clearGameInfo: assign((context, event) => {
|
|
17599
|
+
return { game: { providerId: null, gameId: null, gameTypeId: null, mappingId: null } }
|
|
17600
|
+
}),
|
|
17601
|
+
setGameInfo: assign((context, event) => {
|
|
17602
|
+
const { providerId, gameId, gameTypeId, mappingId, portrait } = event.data.game;
|
|
17603
|
+
return { game: { providerId, gameId, gameTypeId, mappingId, portrait: portrait ? 1 : 0 } }
|
|
17604
|
+
}),
|
|
17605
|
+
setLang: assign((context, event) => {
|
|
17606
|
+
const lang = event.data.locale.replace('-', '_');
|
|
17607
|
+
return { lang }
|
|
17608
|
+
}),
|
|
17609
|
+
...oldActions$1,
|
|
17610
|
+
},
|
|
17611
|
+
guards: {
|
|
17612
|
+
isDifferentRoom: (context, event) => context.room?.categoryId !== event.data?.categoryId,
|
|
17613
|
+
hasNext: (context, event) => context.index < context?.content?.totalPage - 1,
|
|
17614
|
+
hasRoom: (context, event) => context.room?.categoryId,
|
|
17615
|
+
...oldGuards$1,
|
|
17616
|
+
},
|
|
17617
|
+
services: {
|
|
17618
|
+
getPageContent: async (context, event) => {
|
|
17619
|
+
const { room, index } = context;
|
|
17620
|
+
if (room.categoryId === GAME_SEARCH) {
|
|
17621
|
+
return
|
|
17622
|
+
} else {
|
|
17623
|
+
const param = { categoryId: room.categoryId, index };
|
|
17624
|
+
return await Promise.all([request.send(game$1.getListCategory(param)), request.send(game$1.getListAddition(param))])
|
|
17625
|
+
}
|
|
17626
|
+
},
|
|
17627
|
+
updatePageContent: async (context, event) => {
|
|
17628
|
+
const { room, content, index } = context;
|
|
17629
|
+
if (room.categoryId === GAME_SEARCH) {
|
|
17630
|
+
return
|
|
17631
|
+
} else {
|
|
17632
|
+
return await Promise.all([
|
|
17633
|
+
request.send(
|
|
17634
|
+
game$1.getListCategoryByRange({
|
|
17635
|
+
categoryId: room.categoryId,
|
|
17636
|
+
end: index,
|
|
17637
|
+
timestamp: content.timestamp,
|
|
17638
|
+
})
|
|
17639
|
+
),
|
|
17640
|
+
request.send(
|
|
17641
|
+
game$1.getListAdditionByRange({
|
|
17642
|
+
categoryId: room.categoryId,
|
|
17643
|
+
end: index,
|
|
17644
|
+
timestamp: content.timestamp,
|
|
17645
|
+
})
|
|
17646
|
+
),
|
|
17647
|
+
])
|
|
17648
|
+
}
|
|
17649
|
+
},
|
|
17650
|
+
connectGame: async (context, event) => {
|
|
17651
|
+
const { lang, isMobile } = context;
|
|
17652
|
+
const { providerId, gameId, gameTypeId, mappingId } = context.game;
|
|
17653
|
+
const params = {
|
|
17654
|
+
provider_id: providerId,
|
|
17655
|
+
game_id: gameId,
|
|
17656
|
+
gametype_id: gameTypeId,
|
|
17657
|
+
mapping_id: mappingId,
|
|
17658
|
+
is_demo: false,
|
|
17659
|
+
is_mobile: isMobile,
|
|
17660
|
+
lang,
|
|
17661
|
+
return_url: window.location.href,
|
|
17662
|
+
};
|
|
17663
|
+
const { redirect_url } = await request.send(game$1.playGame(params));
|
|
17664
|
+
return { gameURL: redirect_url }
|
|
17665
|
+
},
|
|
17666
|
+
disconnectGame: async (context, event) => {
|
|
17667
|
+
const uid_site = event.data;
|
|
17668
|
+
const provider_id = context.game.providerId;
|
|
17669
|
+
return await request.send(game$1.logoutGame({ uid_site, provider_id }))
|
|
17670
|
+
},
|
|
17671
|
+
...oldServices$1(request),
|
|
17672
|
+
},
|
|
17673
|
+
}
|
|
17674
|
+
)
|
|
17675
|
+
}
|
|
17676
|
+
|
|
17677
|
+
const oldContext$1 = {
|
|
17678
|
+
sha: {
|
|
17679
|
+
status: null,
|
|
17680
|
+
},
|
|
17681
|
+
isStatusChanged: false,
|
|
17682
|
+
statusMap: {},
|
|
17683
|
+
optionMap: {},
|
|
17684
|
+
};
|
|
17685
|
+
|
|
17686
|
+
const oldActions$1 = {
|
|
17687
|
+
setGameSHA: assign((context, event) => {
|
|
17688
|
+
const { sha } = context;
|
|
17689
|
+
const newSha = event.data;
|
|
17690
|
+
return {
|
|
17691
|
+
sha: newSha,
|
|
17692
|
+
isStatusChanged: !sha.status || sha.status !== newSha.status,
|
|
17693
|
+
}
|
|
17694
|
+
}),
|
|
17695
|
+
setStatus: assign((context, event) => {
|
|
17696
|
+
return {
|
|
17697
|
+
statusMap: event.data,
|
|
17698
|
+
}
|
|
17699
|
+
}),
|
|
17700
|
+
mergeOption: assign((context, event) => {
|
|
17701
|
+
const { optionMap } = context;
|
|
17702
|
+
return {
|
|
17703
|
+
optionMap: { ...optionMap, ...event.data },
|
|
17704
|
+
}
|
|
17705
|
+
}),
|
|
17706
|
+
};
|
|
17707
|
+
|
|
17708
|
+
const oldGuards$1 = {
|
|
17709
|
+
isStatusChanged: (context, event) => context.isStatusChanged,
|
|
17710
|
+
};
|
|
17711
|
+
|
|
17712
|
+
const oldServices$1 = (request) => ({
|
|
17713
|
+
fetchOption: async (context, event) => {
|
|
17714
|
+
return await request.send(game$1.getOptionMap())
|
|
17715
|
+
},
|
|
17716
|
+
fetchGameSHA: async (context, event) => {
|
|
17717
|
+
return await request.send(game$1.getGameSHA())
|
|
17718
|
+
},
|
|
17719
|
+
fetchStatus: async (context, event) => {
|
|
17720
|
+
return await request.send(game$1.getGameStatus())
|
|
17721
|
+
},
|
|
17063
17722
|
});
|
|
17064
17723
|
|
|
17065
17724
|
// 對應 intersectionObserver 版本
|
|
@@ -17085,7 +17744,6 @@ function game_v2_1 (request) {
|
|
|
17085
17744
|
timestamp: null,
|
|
17086
17745
|
totalPage: 0,
|
|
17087
17746
|
},
|
|
17088
|
-
staticData: [],
|
|
17089
17747
|
// play params
|
|
17090
17748
|
game: {
|
|
17091
17749
|
providerId: null,
|
|
@@ -17106,9 +17764,6 @@ function game_v2_1 (request) {
|
|
|
17106
17764
|
idle: {
|
|
17107
17765
|
enter: 'clearGameInfo',
|
|
17108
17766
|
on: {
|
|
17109
|
-
SET_STATIC_DATA: {
|
|
17110
|
-
actions: 'setStaticData',
|
|
17111
|
-
},
|
|
17112
17767
|
SET_ADDITION_ENABLE: {
|
|
17113
17768
|
actions: 'setAdditionEnable',
|
|
17114
17769
|
},
|
|
@@ -17268,11 +17923,6 @@ function game_v2_1 (request) {
|
|
|
17268
17923
|
},
|
|
17269
17924
|
{
|
|
17270
17925
|
actions: {
|
|
17271
|
-
setStaticData: assign((context, event) => {
|
|
17272
|
-
return {
|
|
17273
|
-
staticData: event.data,
|
|
17274
|
-
}
|
|
17275
|
-
}),
|
|
17276
17926
|
setAdditionEnable: assign((context, event) => {
|
|
17277
17927
|
return {
|
|
17278
17928
|
additionEnable: event.data,
|
|
@@ -17290,13 +17940,17 @@ function game_v2_1 (request) {
|
|
|
17290
17940
|
isLastPage: index >= content?.totalPage - 1,
|
|
17291
17941
|
}
|
|
17292
17942
|
}),
|
|
17943
|
+
setFavoriteList: assign((context, event) => {
|
|
17944
|
+
return {
|
|
17945
|
+
favoriteList: event.data.data || [],
|
|
17946
|
+
}
|
|
17947
|
+
}),
|
|
17293
17948
|
setRoom: assign((context, event) => {
|
|
17294
17949
|
return {
|
|
17295
17950
|
room: event.data,
|
|
17296
17951
|
}
|
|
17297
17952
|
}),
|
|
17298
17953
|
resetContent: assign((context, event) => {
|
|
17299
|
-
console.log('resetContent');
|
|
17300
17954
|
return {
|
|
17301
17955
|
loadable: false,
|
|
17302
17956
|
isLastPage: false,
|
|
@@ -17388,44 +18042,32 @@ function game_v2_1 (request) {
|
|
|
17388
18042
|
},
|
|
17389
18043
|
services: {
|
|
17390
18044
|
getPageContent: async (context, event) => {
|
|
17391
|
-
const { room, index, additionEnable
|
|
18045
|
+
const { room, index, additionEnable } = context;
|
|
17392
18046
|
if (room.categoryId === GAME_SEARCH) {
|
|
17393
18047
|
return
|
|
17394
|
-
} else if (!request.getToken()) {
|
|
17395
|
-
const list = staticData.find((data) => data.category == room.categoryId)?.info || [];
|
|
17396
|
-
|
|
17397
|
-
return [
|
|
17398
|
-
{
|
|
17399
|
-
data: list.slice(index * 20, (index + 1) * 20),
|
|
17400
|
-
totalPage: Math.ceil(list.length / 20),
|
|
17401
|
-
timestamp: Math.floor(Date.now() / 1000),
|
|
17402
|
-
},
|
|
17403
|
-
]
|
|
17404
18048
|
} else if (additionEnable) {
|
|
17405
18049
|
const param = { categoryId: room.categoryId, index };
|
|
17406
|
-
return await Promise.all([request.send(game.getListCategory(param)), request.send(game.getListAddition(param))])
|
|
18050
|
+
return await Promise.all([request.send(game$1.getListCategory(param)), request.send(game$1.getListAddition(param))])
|
|
17407
18051
|
} else {
|
|
17408
18052
|
const param = { categoryId: room.categoryId, index };
|
|
17409
|
-
return await Promise.all([request.send(game.getListCategory(param))])
|
|
18053
|
+
return await Promise.all([request.send(game$1.getListCategory(param))])
|
|
17410
18054
|
}
|
|
17411
18055
|
},
|
|
17412
18056
|
updatePageContent: async (context, event) => {
|
|
17413
18057
|
const { room, content, index, additionEnable } = context;
|
|
17414
18058
|
if (room.categoryId === GAME_SEARCH) {
|
|
17415
18059
|
return
|
|
17416
|
-
} else if (!request.getToken()) {
|
|
17417
|
-
return []
|
|
17418
18060
|
} else if (additionEnable) {
|
|
17419
18061
|
return await Promise.all([
|
|
17420
18062
|
request.send(
|
|
17421
|
-
game.getListCategoryByRange({
|
|
18063
|
+
game$1.getListCategoryByRange({
|
|
17422
18064
|
categoryId: room.categoryId,
|
|
17423
18065
|
end: index,
|
|
17424
18066
|
timestamp: content.timestamp,
|
|
17425
18067
|
})
|
|
17426
18068
|
),
|
|
17427
18069
|
request.send(
|
|
17428
|
-
game.getListAdditionByRange({
|
|
18070
|
+
game$1.getListAdditionByRange({
|
|
17429
18071
|
categoryId: room.categoryId,
|
|
17430
18072
|
end: index,
|
|
17431
18073
|
timestamp: content.timestamp,
|
|
@@ -17435,7 +18077,7 @@ function game_v2_1 (request) {
|
|
|
17435
18077
|
} else {
|
|
17436
18078
|
return await Promise.all([
|
|
17437
18079
|
request.send(
|
|
17438
|
-
game.getListCategoryByRange({
|
|
18080
|
+
game$1.getListCategoryByRange({
|
|
17439
18081
|
categoryId: room.categoryId,
|
|
17440
18082
|
end: index,
|
|
17441
18083
|
timestamp: content.timestamp,
|
|
@@ -17457,13 +18099,13 @@ function game_v2_1 (request) {
|
|
|
17457
18099
|
lang,
|
|
17458
18100
|
return_url: window.location.href,
|
|
17459
18101
|
};
|
|
17460
|
-
const { redirect_url } = await request.send(game.playGame(params));
|
|
18102
|
+
const { redirect_url } = await request.send(game$1.playGame(params));
|
|
17461
18103
|
return { gameURL: redirect_url }
|
|
17462
18104
|
},
|
|
17463
18105
|
disconnectGame: async (context, event) => {
|
|
17464
18106
|
const uid_site = event.data;
|
|
17465
18107
|
const provider_id = context.game.providerId;
|
|
17466
|
-
return await request.send(game.logoutGame({ uid_site, provider_id }))
|
|
18108
|
+
return await request.send(game$1.logoutGame({ uid_site, provider_id }))
|
|
17467
18109
|
},
|
|
17468
18110
|
...oldServices(request),
|
|
17469
18111
|
},
|
|
@@ -17508,26 +18150,137 @@ const oldGuards = {
|
|
|
17508
18150
|
|
|
17509
18151
|
const oldServices = (request) => ({
|
|
17510
18152
|
fetchOption: async (context, event) => {
|
|
17511
|
-
|
|
17512
|
-
return await request.send(game.getOptionMap())
|
|
17513
|
-
}
|
|
18153
|
+
return await request.send(game$1.getOptionMap())
|
|
17514
18154
|
},
|
|
17515
18155
|
fetchGameSHA: async (context, event) => {
|
|
17516
|
-
|
|
17517
|
-
return await request.send(game.getGameSHA())
|
|
17518
|
-
} else {
|
|
17519
|
-
return {
|
|
17520
|
-
status: null,
|
|
17521
|
-
}
|
|
17522
|
-
}
|
|
18156
|
+
return await request.send(game$1.getGameSHA())
|
|
17523
18157
|
},
|
|
17524
18158
|
fetchStatus: async (context, event) => {
|
|
17525
|
-
|
|
17526
|
-
return await request.send(game.getGameStatus())
|
|
17527
|
-
}
|
|
18159
|
+
return await request.send(game$1.getGameStatus())
|
|
17528
18160
|
},
|
|
17529
18161
|
});
|
|
17530
18162
|
|
|
18163
|
+
function game_favorite (request) {
|
|
18164
|
+
return createMachine(
|
|
18165
|
+
{
|
|
18166
|
+
id: 'favorite',
|
|
18167
|
+
type: 'parallel',
|
|
18168
|
+
context: {
|
|
18169
|
+
list: [],
|
|
18170
|
+
},
|
|
18171
|
+
states: {
|
|
18172
|
+
fetching: {
|
|
18173
|
+
initial: 'disable',
|
|
18174
|
+
states: {
|
|
18175
|
+
disable: {},
|
|
18176
|
+
enable: {
|
|
18177
|
+
invoke: {
|
|
18178
|
+
src: 'fetchList',
|
|
18179
|
+
onDone: {
|
|
18180
|
+
actions: 'setList',
|
|
18181
|
+
},
|
|
18182
|
+
onError: {
|
|
18183
|
+
actions: assign({ list: [] }),
|
|
18184
|
+
},
|
|
18185
|
+
},
|
|
18186
|
+
},
|
|
18187
|
+
},
|
|
18188
|
+
},
|
|
18189
|
+
adding: {
|
|
18190
|
+
initial: 'disable',
|
|
18191
|
+
states: {
|
|
18192
|
+
disable: {},
|
|
18193
|
+
enable: {
|
|
18194
|
+
invoke: {
|
|
18195
|
+
src: 'add',
|
|
18196
|
+
onDone: {},
|
|
18197
|
+
onError: {
|
|
18198
|
+
actions: 'removeFromList',
|
|
18199
|
+
},
|
|
18200
|
+
},
|
|
18201
|
+
},
|
|
18202
|
+
},
|
|
18203
|
+
},
|
|
18204
|
+
removing: {
|
|
18205
|
+
initial: 'disable',
|
|
18206
|
+
states: {
|
|
18207
|
+
disable: {},
|
|
18208
|
+
enable: {
|
|
18209
|
+
invoke: {
|
|
18210
|
+
src: 'remove',
|
|
18211
|
+
onDone: {},
|
|
18212
|
+
onError: {
|
|
18213
|
+
actions: 'addToList',
|
|
18214
|
+
},
|
|
18215
|
+
},
|
|
18216
|
+
},
|
|
18217
|
+
},
|
|
18218
|
+
},
|
|
18219
|
+
},
|
|
18220
|
+
on: {
|
|
18221
|
+
FETCH_LIST: {
|
|
18222
|
+
target: 'fetching.enable',
|
|
18223
|
+
},
|
|
18224
|
+
ADD: {
|
|
18225
|
+
target: 'adding.enable',
|
|
18226
|
+
actions: 'addToList',
|
|
18227
|
+
cond: 'isNotExist',
|
|
18228
|
+
},
|
|
18229
|
+
REMOVE: {
|
|
18230
|
+
target: 'removing.enable',
|
|
18231
|
+
actions: 'removeFromList',
|
|
18232
|
+
cond: 'isExist',
|
|
18233
|
+
},
|
|
18234
|
+
},
|
|
18235
|
+
},
|
|
18236
|
+
{
|
|
18237
|
+
actions: {
|
|
18238
|
+
setList: assign((context, event) => {
|
|
18239
|
+
return {
|
|
18240
|
+
list: event.data,
|
|
18241
|
+
}
|
|
18242
|
+
}),
|
|
18243
|
+
addToList: assign((context, event) => {
|
|
18244
|
+
return {
|
|
18245
|
+
list: [...context.list, event.data],
|
|
18246
|
+
}
|
|
18247
|
+
}),
|
|
18248
|
+
removeFromList: assign((context, event) => {
|
|
18249
|
+
return {
|
|
18250
|
+
list: context.list.filter((item) => item !== event.data),
|
|
18251
|
+
}
|
|
18252
|
+
}),
|
|
18253
|
+
},
|
|
18254
|
+
guards: {
|
|
18255
|
+
isExist: (context, event) => context.list.includes(event.data),
|
|
18256
|
+
isNotExist: (context, event) => !context.list.includes(event.data),
|
|
18257
|
+
},
|
|
18258
|
+
services: {
|
|
18259
|
+
add: async (context, event) => {
|
|
18260
|
+
try {
|
|
18261
|
+
return await request.send(game$1.addFavoriteGame(event.data))
|
|
18262
|
+
} catch (error) {
|
|
18263
|
+
throw event.data
|
|
18264
|
+
}
|
|
18265
|
+
},
|
|
18266
|
+
remove: async (context, event) => {
|
|
18267
|
+
try {
|
|
18268
|
+
return await request.send(game$1.removeFavoriteGame(event.data))
|
|
18269
|
+
} catch (error) {
|
|
18270
|
+
throw event.data
|
|
18271
|
+
}
|
|
18272
|
+
},
|
|
18273
|
+
fetchList: async (context, event) => {
|
|
18274
|
+
const main = await request.send(game$1.getGameCategory({}));
|
|
18275
|
+
const room = main.list.find((item) => item.category === 'SYSTEM_MY_FAVORITE');
|
|
18276
|
+
const favorite = await request.send(game$1.getGameCategory({ id: room.id }));
|
|
18277
|
+
return favorite.list.map((item) => item.g)
|
|
18278
|
+
},
|
|
18279
|
+
},
|
|
18280
|
+
}
|
|
18281
|
+
)
|
|
18282
|
+
}
|
|
18283
|
+
|
|
17531
18284
|
function game_favorite_v2 (request) {
|
|
17532
18285
|
return createMachine(
|
|
17533
18286
|
{
|
|
@@ -17622,7 +18375,7 @@ function game_favorite_v2 (request) {
|
|
|
17622
18375
|
services: {
|
|
17623
18376
|
add: async (context, event) => {
|
|
17624
18377
|
try {
|
|
17625
|
-
await request.send(game.addListFavorite(event.data.gameCode));
|
|
18378
|
+
await request.send(game$1.addListFavorite(event.data.gameCode));
|
|
17626
18379
|
return event.data
|
|
17627
18380
|
} catch (error) {
|
|
17628
18381
|
throw event.data
|
|
@@ -17630,19 +18383,15 @@ function game_favorite_v2 (request) {
|
|
|
17630
18383
|
},
|
|
17631
18384
|
remove: async (context, event) => {
|
|
17632
18385
|
try {
|
|
17633
|
-
await request.send(game.removeListFavorite(event.data.gameCode));
|
|
18386
|
+
await request.send(game$1.removeListFavorite(event.data.gameCode));
|
|
17634
18387
|
return event.data
|
|
17635
18388
|
} catch (error) {
|
|
17636
18389
|
throw event.data
|
|
17637
18390
|
}
|
|
17638
18391
|
},
|
|
17639
18392
|
fetchList: async (context, event) => {
|
|
17640
|
-
|
|
17641
|
-
|
|
17642
|
-
return data
|
|
17643
|
-
} else {
|
|
17644
|
-
return []
|
|
17645
|
-
}
|
|
18393
|
+
const { data } = await request.send(game$1.getListMyFavorite());
|
|
18394
|
+
return data
|
|
17646
18395
|
},
|
|
17647
18396
|
},
|
|
17648
18397
|
}
|
|
@@ -17874,17 +18623,17 @@ function game_search (request) {
|
|
|
17874
18623
|
services: {
|
|
17875
18624
|
fetchTags: async (context, event) => {
|
|
17876
18625
|
const { keyword } = context;
|
|
17877
|
-
const { result } = await request.send(game.getGameTags({ q: keyword }));
|
|
18626
|
+
const { result } = await request.send(game$1.getGameTags({ q: keyword }));
|
|
17878
18627
|
return result
|
|
17879
18628
|
},
|
|
17880
18629
|
fetchGames: async (context, event) => {
|
|
17881
18630
|
const { tagId, tagIndex, keyword, click, clickDefault } = context;
|
|
17882
|
-
const { traceId, result } = await request.send(game.getGameSearchList({ id: tagId, index: tagIndex, q: keyword, click, clickDefault }));
|
|
18631
|
+
const { traceId, result } = await request.send(game$1.getGameSearchList({ id: tagId, index: tagIndex, q: keyword, click, clickDefault }));
|
|
17883
18632
|
return { traceId, result }
|
|
17884
18633
|
},
|
|
17885
18634
|
sendTrace: async (context, event) => {
|
|
17886
18635
|
const { traceId, tagId, tagIndex, gameCode, gameCodeIndex, keyword: query, click, clickDefault } = context;
|
|
17887
|
-
return await request.send(game.setGameSearchTrace({ traceId, tagId, tagIndex, gameCode, gameCodeIndex, query, click, clickDefault }))
|
|
18636
|
+
return await request.send(game$1.setGameSearchTrace({ traceId, tagId, tagIndex, gameCode, gameCodeIndex, query, click, clickDefault }))
|
|
17888
18637
|
},
|
|
17889
18638
|
},
|
|
17890
18639
|
}
|
|
@@ -18217,16 +18966,16 @@ function game_search_v2 (request) {
|
|
|
18217
18966
|
services: {
|
|
18218
18967
|
fetchTags: async (context, event) => {
|
|
18219
18968
|
const { keyword } = context;
|
|
18220
|
-
const { result } = await request.send(game.getGameTags({ q: keyword }));
|
|
18969
|
+
const { result } = await request.send(game$1.getGameTags({ q: keyword }));
|
|
18221
18970
|
return result
|
|
18222
18971
|
},
|
|
18223
18972
|
fetchInitialData: async (context, event) => {
|
|
18224
|
-
const data = await request.send(game.getGameSearchHome());
|
|
18973
|
+
const data = await request.send(game$1.getGameSearchHome());
|
|
18225
18974
|
return data
|
|
18226
18975
|
},
|
|
18227
18976
|
fetchGames: async (context, event) => {
|
|
18228
18977
|
const { tagId, tagIndex, keyword, click, clickDefault } = context;
|
|
18229
|
-
const { traceId, result } = await request.send(game.getGameSearchList({ id: tagId, index: tagIndex, q: keyword, click, clickDefault }));
|
|
18978
|
+
const { traceId, result } = await request.send(game$1.getGameSearchList({ id: tagId, index: tagIndex, q: keyword, click, clickDefault }));
|
|
18230
18979
|
return { traceId, result }
|
|
18231
18980
|
},
|
|
18232
18981
|
sendTrace: async (context, event) => {
|
|
@@ -18248,7 +18997,7 @@ function game_search_v2 (request) {
|
|
|
18248
18997
|
id = null;
|
|
18249
18998
|
}
|
|
18250
18999
|
return await request.send(
|
|
18251
|
-
game.setGameSearchTrace({
|
|
19000
|
+
game$1.setGameSearchTrace({
|
|
18252
19001
|
traceId,
|
|
18253
19002
|
tagId: id,
|
|
18254
19003
|
tagIndex,
|
|
@@ -18329,12 +19078,12 @@ function game_hot_new (request) {
|
|
|
18329
19078
|
},
|
|
18330
19079
|
services: {
|
|
18331
19080
|
getRoomItems: async (context, event) => {
|
|
18332
|
-
return await request.send(game.getGameCategory({ id: context.roomId }))
|
|
19081
|
+
return await request.send(game$1.getGameCategory({ id: context.roomId }))
|
|
18333
19082
|
},
|
|
18334
19083
|
getGames: async (context, event) => {
|
|
18335
19084
|
const [resHot, resNew] = await Promise.all([
|
|
18336
|
-
request.send(game.getGameCategory({ id: context.hot.id })),
|
|
18337
|
-
request.send(game.getGameCategory({ id: context.new.id })),
|
|
19085
|
+
request.send(game$1.getGameCategory({ id: context.hot.id })),
|
|
19086
|
+
request.send(game$1.getGameCategory({ id: context.new.id })),
|
|
18338
19087
|
]);
|
|
18339
19088
|
const hotGames = resHot?.list?.map?.((item) => item.g);
|
|
18340
19089
|
const newGames = resNew?.list?.map?.((item) => item.g);
|
|
@@ -19174,7 +19923,7 @@ function side (request) {
|
|
|
19174
19923
|
},
|
|
19175
19924
|
services: {
|
|
19176
19925
|
getRoomItems: async (context, event) => {
|
|
19177
|
-
return await request.send(game.getGameCategory({ id: context.room?.id }))
|
|
19926
|
+
return await request.send(game$1.getGameCategory({ id: context.room?.id }))
|
|
19178
19927
|
},
|
|
19179
19928
|
},
|
|
19180
19929
|
}
|
|
@@ -19338,10 +20087,10 @@ function side_v2 (request) {
|
|
|
19338
20087
|
},
|
|
19339
20088
|
services: {
|
|
19340
20089
|
getMenu: async (context, event) => {
|
|
19341
|
-
return await request.send(game.getListRoot())
|
|
20090
|
+
return await request.send(game$1.getListRoot())
|
|
19342
20091
|
},
|
|
19343
20092
|
fetchUpdateMenu: async (context, event) => {
|
|
19344
|
-
return await request.send(game.getListRoot({ timestamp: context.menu.timestamp }))
|
|
20093
|
+
return await request.send(game$1.getListRoot({ timestamp: context.menu.timestamp }))
|
|
19345
20094
|
},
|
|
19346
20095
|
},
|
|
19347
20096
|
}
|
|
@@ -26884,6 +27633,9 @@ var index$1 = {
|
|
|
26884
27633
|
common,
|
|
26885
27634
|
deposit,
|
|
26886
27635
|
error,
|
|
27636
|
+
game,
|
|
27637
|
+
game_v2,
|
|
27638
|
+
game_favorite,
|
|
26887
27639
|
game_favorite_v2,
|
|
26888
27640
|
game_search,
|
|
26889
27641
|
game_search_v2,
|
|
@@ -26937,8 +27689,8 @@ class Request {
|
|
|
26937
27689
|
this.axios.interceptors.request.use((axiosConfig) => {
|
|
26938
27690
|
axiosConfig.headers['X-TH1GAMES-VERSION'] = this.config.version;
|
|
26939
27691
|
axiosConfig.headers['X-TH1GAMES-PLATFORM'] = this.config.platform;
|
|
26940
|
-
if (this.
|
|
26941
|
-
axiosConfig.headers.Authorization = this.
|
|
27692
|
+
if (storage.get(this.key)) {
|
|
27693
|
+
axiosConfig.headers.Authorization = storage.get(this.key);
|
|
26942
27694
|
}
|
|
26943
27695
|
return axiosConfig
|
|
26944
27696
|
});
|
|
@@ -26966,7 +27718,7 @@ class Request {
|
|
|
26966
27718
|
async send(req, customToken) {
|
|
26967
27719
|
try {
|
|
26968
27720
|
const cancelToken = customToken || this.source.token;
|
|
26969
|
-
this._checkToken(req);
|
|
27721
|
+
this._checkToken(req, storage.get(this.key));
|
|
26970
27722
|
const requestConfig = this._createConfig(req, cancelToken);
|
|
26971
27723
|
const { data } = await this.axios.request(requestConfig);
|
|
26972
27724
|
return data
|
|
@@ -27012,16 +27764,12 @@ class Request {
|
|
|
27012
27764
|
}
|
|
27013
27765
|
}
|
|
27014
27766
|
|
|
27015
|
-
_checkToken(req) {
|
|
27016
|
-
if (!req.isPublic && !
|
|
27767
|
+
_checkToken(req, token) {
|
|
27768
|
+
if (!req.isPublic && !token) {
|
|
27017
27769
|
console.error(req);
|
|
27018
27770
|
throw { code: 'ERR_A103', url: req.url }
|
|
27019
27771
|
}
|
|
27020
27772
|
}
|
|
27021
|
-
|
|
27022
|
-
getToken() {
|
|
27023
|
-
return storage.get(this.key)
|
|
27024
|
-
}
|
|
27025
27773
|
}
|
|
27026
27774
|
|
|
27027
27775
|
// const urljoin = require('url-join')
|