@jetthai/cuora 1.1.68-cash → 1.1.69

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