@jetthai/cuora 1.0.302-sl-2 → 1.1.0

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.
Files changed (110) hide show
  1. package/CHANGELOG.md +3 -848
  2. package/README.md +0 -6
  3. package/dist/bundle.mjs +18461 -0
  4. package/package.json +9 -6
  5. package/rollup.config.js +16 -0
  6. package/src/api/activity.js +2 -43
  7. package/src/api/auth.js +7 -22
  8. package/src/api/common.js +1 -3
  9. package/src/api/game.js +7 -20
  10. package/src/api/mailbox.js +5 -9
  11. package/src/api/payment.js +19 -167
  12. package/src/api/user.js +0 -7
  13. package/src/machine/activity/activity.js +26 -111
  14. package/src/machine/activity/{friend_invite_friends_activity.js → affiliate_invite_friends_activity.js} +41 -70
  15. package/src/machine/activity/continue_deposit_activity.js +2 -11
  16. package/src/machine/activity/deposit_activity.js +4 -13
  17. package/src/machine/activity/diamond_shop_activity_vn.js +89 -54
  18. package/src/machine/activity/fafafa_activity.js +19 -34
  19. package/src/machine/activity/index.js +4 -22
  20. package/src/machine/activity/invite_friends_activity.js +14 -14
  21. package/src/machine/activity/ranking_activity.js +2 -11
  22. package/src/machine/activity/sign_in_activity.js +14 -21
  23. package/src/machine/activity/specify_bets_activity.js +3 -25
  24. package/src/machine/activity/specify_turnover_activity.js +3 -25
  25. package/src/machine/activity/time_bomb_activity.js +2 -11
  26. package/src/machine/auth.js +21 -134
  27. package/src/machine/auth_otp.js +201 -0
  28. package/src/machine/auth_otp_v2.js +4 -10
  29. package/src/machine/auth_otp_v3.js +3 -11
  30. package/src/machine/bank_binding.js +12 -112
  31. package/src/machine/common.js +25 -113
  32. package/src/machine/deposit/crypto.js +29 -50
  33. package/src/machine/deposit/crypto_button.js +39 -174
  34. package/src/machine/deposit/deposit_fc.js +5 -8
  35. package/src/machine/deposit/direct.js +16 -111
  36. package/src/machine/deposit/index.js +2 -43
  37. package/src/machine/deposit/loadcard_vn.js +43 -191
  38. package/src/machine/deposit/manual_vn.js +60 -182
  39. package/src/machine/deposit/qrcode_v2.js +52 -285
  40. package/src/machine/deposit/qrcode_vn.js +206 -0
  41. package/src/machine/game.js +285 -0
  42. package/src/machine/game_favorite.js +123 -0
  43. package/src/machine/game_favorite_v2.js +28 -74
  44. package/src/machine/game_search.js +244 -0
  45. package/src/machine/game_search_v2.js +24 -64
  46. package/src/machine/game_v2.js +356 -0
  47. package/src/machine/inbox.js +34 -259
  48. package/src/machine/index.js +17 -24
  49. package/src/machine/leaderboard.js +8 -31
  50. package/src/machine/reward.js +7 -74
  51. package/src/machine/setting.js +2 -5
  52. package/src/machine/side_v2.js +28 -33
  53. package/src/machine/user_sign_up.js +17 -117
  54. package/src/machine/{withdraw/withdraw_crypto.js → withdraw_crypto.js} +69 -220
  55. package/src/machine/{withdraw/withdraw_fc.js → withdraw_fc.js} +2 -2
  56. package/src/machine/{withdraw/withdraw_amb.js → withdraw_vn.js} +78 -146
  57. package/src/request/request.js +5 -10
  58. package/src/util/constant.js +1 -19
  59. package/src/util/deviceToken.js +8 -18
  60. package/src/util/index.js +1 -2
  61. package/src/util/storage.js +22 -22
  62. package/.husky/pre-commit +0 -4
  63. package/.prettierignore +0 -1
  64. package/src/lib/fingerprint.js +0 -9779
  65. package/src/machine/activity/activity_cash.js +0 -159
  66. package/src/machine/activity/cash_rain_activity.js +0 -153
  67. package/src/machine/activity/diamond_shop_activity_cash.js +0 -179
  68. package/src/machine/activity/instant_rebate_activity.js +0 -217
  69. package/src/machine/activity/jackpot.js +0 -74
  70. package/src/machine/activity/otp_verified_activity.js +0 -74
  71. package/src/machine/activity/roulette_activity_v2.js +0 -90
  72. package/src/machine/activity/sign_in_monthly_activity.js +0 -65
  73. package/src/machine/activity/vip_card_activity.js +0 -140
  74. package/src/machine/bank_binding_amb.js +0 -145
  75. package/src/machine/deposit/amb.js +0 -92
  76. package/src/machine/deposit/crypto_bank.js +0 -317
  77. package/src/machine/deposit/crypto_bank_cash.js +0 -287
  78. package/src/machine/deposit/crypto_cash.js +0 -255
  79. package/src/machine/deposit/crypto_qrcode.js +0 -148
  80. package/src/machine/deposit/crypto_qrcode_cash.js +0 -131
  81. package/src/machine/deposit/crypto_way.js +0 -239
  82. package/src/machine/deposit/crypto_way_cash.js +0 -256
  83. package/src/machine/deposit/direct_cash.js +0 -217
  84. package/src/machine/deposit/float.js +0 -366
  85. package/src/machine/deposit/krway.js +0 -151
  86. package/src/machine/deposit/loadcard_cash.js +0 -207
  87. package/src/machine/deposit/manual_cash.js +0 -356
  88. package/src/machine/deposit/qrcode_cash.js +0 -217
  89. package/src/machine/deposit/usdt.js +0 -144
  90. package/src/machine/deposit/usdt_cash.js +0 -138
  91. package/src/machine/deposit/vpay.js +0 -359
  92. package/src/machine/game_info.js +0 -57
  93. package/src/machine/game_search_cash.js +0 -390
  94. package/src/machine/game_v2_1.js +0 -662
  95. package/src/machine/honor_board_cash.js +0 -63
  96. package/src/machine/navbar.js +0 -57
  97. package/src/machine/promotions.js +0 -171
  98. package/src/machine/reward_cash.js +0 -219
  99. package/src/machine/roulette_v2.js +0 -276
  100. package/src/machine/side_cash.js +0 -110
  101. package/src/machine/user_photo.js +0 -65
  102. package/src/machine/withdraw/index.js +0 -23
  103. package/src/machine/withdraw/withdraw_crypto2.js +0 -540
  104. package/src/machine/withdraw/withdraw_crypto_cash.js +0 -319
  105. package/src/machine/withdraw/withdraw_krway.js +0 -207
  106. package/src/machine/withdraw/withdraw_manual.js +0 -595
  107. package/src/machine/withdraw/withdraw_manual_cash.js +0 -303
  108. package/src/machine/withdraw/withdraw_vn.js +0 -533
  109. package/src/machine/withdraw/withdraw_vn2.js +0 -548
  110. package/src/util/math.js +0 -4
@@ -3,27 +3,13 @@ import mailbox from '../api/mailbox.js'
3
3
  import activity from '../api/activity.js'
4
4
 
5
5
  const messageState = {
6
+ // always: [{ actions: 'showUnread', cond: 'isShowUnread' }],
6
7
  initial: 'idle',
7
8
  states: {
8
9
  idle: {
9
10
  initial: 'hidden',
10
11
  states: {
11
12
  hidden: {},
12
- deleting: {
13
- invoke: {
14
- src: 'deleteMessages',
15
- onDone: {
16
- target: 'deleted',
17
- actions: 'removeMessage',
18
- },
19
- onError: {
20
- target: 'hidden',
21
- },
22
- },
23
- },
24
- deleted: {
25
- entry: ['cancelSelectMessages', 'hideMessage'],
26
- },
27
13
  shown: {
28
14
  on: {
29
15
  HIDE_MESSAGE: {
@@ -35,15 +21,6 @@ const messageState = {
35
21
  },
36
22
  on: {
37
23
  SHOW_MESSAGE: [
38
- {
39
- target: 'fetchingCustomerMessage',
40
- actions: 'showMessage',
41
- cond: (context, event) => {
42
- const { currentTab } = context
43
- const { isRead } = event.data
44
- return currentTab === 'CUSTOMER' && isRead
45
- },
46
- },
47
24
  {
48
25
  target: '.shown',
49
26
  actions: 'showMessage',
@@ -54,43 +31,19 @@ const messageState = {
54
31
  actions: ['showMessage', 'setMessageIsRead'],
55
32
  },
56
33
  ],
57
- SELECT_MESSAGES: {
58
- actions: ['selectMessages', 'setDelectMessages'],
59
- },
60
- DELETE_MESSAGES: {
61
- target: '.deleting',
62
- },
63
34
  },
64
35
  },
65
- fetchingCustomerMessage: {
36
+ updating: {
66
37
  invoke: {
67
- src: 'getMessage',
38
+ src: 'updateMessageIsRead',
68
39
  onDone: {
69
40
  target: 'idle.shown',
70
- actions: 'setCustomerMessage',
71
41
  },
72
42
  onError: {
73
43
  target: 'idle.shown',
74
44
  },
75
45
  },
76
46
  },
77
- updating: {
78
- invoke: {
79
- src: 'updateMessageIsRead',
80
- onDone: [
81
- {
82
- target: 'fetchingCustomerMessage',
83
- cond: 'isCustomer',
84
- },
85
- {
86
- target: 'idle.shown',
87
- },
88
- ],
89
- onError: {
90
- target: 'idle.shown',
91
- },
92
- },
93
- },
94
47
  },
95
48
  }
96
49
 
@@ -105,12 +58,8 @@ export default function (request) {
105
58
  tabs: [],
106
59
  currentTab: null,
107
60
  inbox: {},
108
- currentMessage: null,
109
61
  messageDetail: null,
110
- hasCustomer: false,
111
- selectedDeleteMessages: null,
112
- messageTitle: '',
113
- messageContent: '',
62
+ // isShowUnread: false,
114
63
  },
115
64
  states: {
116
65
  loading: {
@@ -156,62 +105,15 @@ export default function (request) {
156
105
  },
157
106
  },
158
107
  },
159
- inquiring: {
160
- invoke: {
161
- src: 'accountInquiry',
162
- onDone: {
163
- target: 'inquired',
164
- },
165
- onError: {
166
- target: 'failed',
167
- },
168
- },
169
- },
170
- inquired: {
171
- after: {
172
- 0: {
173
- target: 'reloadMessages',
174
- actions: 'cancelSelectMessages',
175
- },
176
- },
177
- },
178
- reloadMessages: {
179
- invoke: {
180
- src: 'reFetchMessages',
181
- onDone: {
182
- target: 'more',
183
- actions: 'setInbox',
184
- },
185
- onError: {
186
- target: 'end',
187
- },
188
- },
189
- },
190
108
  end: {
191
109
  ...messageState,
192
110
  },
193
- sending: {
194
- invoke: {
195
- src: 'sendMessage',
196
- onDone: {
197
- target: 'sended',
198
- },
199
- onError: {
200
- target: 'end',
201
- },
202
- },
203
- },
204
- sended: {
205
- after: {
206
- 0: {
207
- target: 'reloadMessages',
208
- actions: ['cancelSelectMessages', 'hideMessage'],
209
- },
210
- },
211
- },
212
111
  failed: {},
213
112
  },
214
113
  on: {
114
+ // SHOW_SYSTEM_MESSAGE: {
115
+ // actions: 'showSystemMessage',
116
+ // },
215
117
  SET_TAB: {
216
118
  target: '.checking',
217
119
  actions: ['setCurrentTab', 'hideMessage'],
@@ -224,26 +126,6 @@ export default function (request) {
224
126
  target: '.loading',
225
127
  actions: 'reset',
226
128
  },
227
- INQUIRY_ACCOUNT: {
228
- target: '.inquiring',
229
- actions: 'resetPage',
230
- },
231
- SET_TITLE: {
232
- actions: 'setMessageTitle',
233
- },
234
- SET_CONTENT: {
235
- actions: 'setMessageContent',
236
- },
237
- SEND_MESSAGE: {
238
- target: '.sending',
239
- cond: 'isSendable',
240
- },
241
- CANCEL_SELECT: {
242
- actions: 'cancelSelectMessages',
243
- },
244
- CLEAR: {
245
- actions: 'hideMessage',
246
- },
247
129
  },
248
130
  },
249
131
  {
@@ -263,42 +145,23 @@ export default function (request) {
263
145
  isRead: (context, event) => {
264
146
  return event.data.isRead
265
147
  },
266
- isCustomer: (context, event) => {
267
- const { currentTab } = context
268
- return currentTab === 'CUSTOMER'
269
- },
270
- isSendable: (context, event) => {
271
- const { messageTitle, messageContent } = context
272
- return !!messageTitle && !!messageContent
273
- },
148
+ // isShowUnread: (context, event) => {
149
+ // return context.isShowUnread
150
+ // },
274
151
  },
275
152
  actions: {
276
153
  reset: assign((context, event) => {
277
154
  return {
155
+ tabs: [],
278
156
  currentTab: null,
279
157
  inbox: {},
280
158
  messageDetail: null,
281
- currentMessage: null,
282
- }
283
- }),
284
- resetPage: assign((context, event) => {
285
- const { inbox, currentTab } = JSON.parse(JSON.stringify(context))
286
- inbox[currentTab].page = -1
287
- return {
288
- inbox,
289
- messageDetail: null,
290
- currentMessage: null,
291
159
  }
292
160
  }),
293
161
  setTabs: assign((context, event) => {
294
- let { currentTab, hasCustomer } = context
162
+ let { currentTab } = context
295
163
  if (!currentTab) {
296
- const customerTab = event.data?.find((tab) => tab === 'CUSTOMER')
297
- if (!!customerTab && hasCustomer) {
298
- currentTab = 'CUSTOMER'
299
- } else {
300
- currentTab = event.data?.[0]
301
- }
164
+ currentTab = event.data?.[0]
302
165
  }
303
166
  return {
304
167
  tabs: event.data,
@@ -310,78 +173,29 @@ export default function (request) {
310
173
  currentTab: event.data,
311
174
  }
312
175
  }),
313
- selectMessages: assign((context, event) => {
314
- const { inbox, currentTab } = JSON.parse(JSON.stringify(context))
315
- const data = inbox[currentTab].data.map((item) => {
316
- if (item.groupId === event.data.groupId) {
317
- item.isSelected = !item.isSelected
318
- }
319
- return item
320
- })
321
- inbox[currentTab].data = data
322
- return { inbox }
323
- }),
324
- cancelSelectMessages: assign((context, event) => {
325
- const { inbox, currentTab } = JSON.parse(JSON.stringify(context))
326
- const data = inbox[currentTab].data.map((item) => {
327
- item.isSelected = false
328
- return item
329
- })
330
- inbox[currentTab].data = data
331
- return { inbox, selectedDeleteMessages: null }
332
- }),
333
- setDelectMessages: assign((context, event) => {
334
- const { inbox, currentTab } = JSON.parse(JSON.stringify(context))
335
- const selectedMessages = inbox[currentTab].data?.filter((item) => item.isSelected)
336
- const groupIdsArray = selectedMessages?.map((item) => item.groupId)
337
- const groupIds = groupIdsArray?.join(',')
338
- return {
339
- selectedDeleteMessages: groupIds,
340
- }
341
- }),
342
- setCustomerMessage: assign((context, event) => {
343
- const { data = [] } = event.data
344
- const isCustomerReply = data[0]?.from === 'SYSTEM'
345
- let combindedContent = ''
346
- if (isCustomerReply) {
347
- combindedContent = '-\n-------------------------\n' + data[0]?.content || '' + '\n-------------------------\n' + data[1]?.content || ''
348
- } else {
349
- combindedContent = `-\n-------------------------\n${data[0]?.content || ''}`
350
- }
351
- return {
352
- messageDetail: data,
353
- messageTitle: data[data.length - 1]?.title,
354
- messageContent: combindedContent,
355
- }
356
- }),
357
176
  showMessage: assign((context, event) => {
358
177
  return {
359
- currentMessage: event.data,
360
178
  messageDetail: event.data,
361
- messageTitle: null,
362
- messageContent: null,
363
179
  }
364
180
  }),
365
181
  hideMessage: assign((context, event) => {
366
182
  return {
367
- messageTitle: null,
368
- messageContent: null,
369
183
  messageDetail: null,
370
- currentMessage: null,
371
184
  }
372
185
  }),
373
- removeMessage: assign((context, event) => {
374
- const groupIds = event.data
375
- const { inbox, currentTab } = JSON.parse(JSON.stringify(context))
376
- const data = inbox[currentTab].data.filter((item) => !groupIds.find((groupId) => groupId === item.groupId))
377
- inbox[currentTab].data = data
378
- return { inbox }
379
- }),
380
186
  setInbox: assign((context, event) => {
381
187
  return {
382
188
  inbox: event.data,
383
189
  }
384
190
  }),
191
+ // showUnread: assign((context, event) => {
192
+ // const { currentTab, inbox } = context
193
+ // const messageDetail = inbox[currentTab]?.data.find((item) => !item.isRead)
194
+ // return {
195
+ // messageDetail,
196
+ // isShowUnread: false,
197
+ // }
198
+ // }),
385
199
  setMessageIsRead: assign((context, event) => {
386
200
  const { inbox, currentTab } = JSON.parse(JSON.stringify(context))
387
201
  const data = inbox[currentTab].data.map((item) => {
@@ -393,16 +207,12 @@ export default function (request) {
393
207
  inbox[currentTab].data = data
394
208
  return { inbox }
395
209
  }),
396
- setMessageTitle: assign((context, event) => {
397
- return {
398
- messageTitle: event.data,
399
- }
400
- }),
401
- setMessageContent: assign((context, event) => {
402
- return {
403
- messageContent: event.data,
404
- }
405
- }),
210
+ // showSystemMessage: assign((context, event) => {
211
+ // return {
212
+ // currentTab: 'SYSTEM',
213
+ // isShowUnread: true,
214
+ // }
215
+ // }),
406
216
  },
407
217
  services: {
408
218
  fetchTabs: async (context, event) => {
@@ -417,53 +227,18 @@ export default function (request) {
417
227
  inbox[currentTab] = { data, page: 0, totalPage: 1 }
418
228
  } else {
419
229
  const { page = -1 } = inbox[currentTab] || {}
420
- const { data, ...rest } = await request.send(mailbox.getMessageList({ type: currentTab, page: page + 1 }))
421
- const formattedData = data?.map((item) => ({ ...item, isSelected: false }))
230
+ const nextPage = page + 1
231
+ const { data, ...rest } = await request.send(mailbox.getMessageList({ type: currentTab, page: nextPage }))
422
232
  const currentData = inbox[currentTab]?.data || []
423
- inbox[currentTab] = { data: currentData.concat(formattedData), ...rest }
233
+ inbox[currentTab] = { data: currentData.concat(data), ...rest }
424
234
  }
425
235
  return inbox
426
236
  },
427
- reFetchMessages: async (context, event) => {
428
- const { currentTab, inbox } = JSON.parse(JSON.stringify(context))
429
- const { data, ...rest } = await request.send(mailbox.getMessageList({ type: currentTab, page: 0 }))
430
- let formattedData = []
431
- formattedData = data?.map((item) => ({ ...item, isSelected: false }))
432
- inbox[currentTab] = { data: formattedData, ...rest }
433
- return inbox
434
- },
435
237
  updateMessageIsRead: async (context, event) => {
436
- const { currentMessage } = context
437
- request.send(mailbox.updateMessage({ groupId: currentMessage.groupId, isRead: true }))
438
- return true
439
- },
440
- deleteMessages: async (context, event) => {
441
- const { selectedDeleteMessages } = context
442
- const { groupId = '' } = await request.send(mailbox.updateMessage({ groupId: selectedDeleteMessages, isDelete: true }))
443
- return groupId.split(',')
444
- },
445
- accountInquiry: async (context, event) => {
446
- const { from, title, content } = event.data
447
- return await request.send(mailbox.sendMessage({ type: 'CUSTOMER', category: 'DEPOSIT', from, to: 'SYSTEM', title, content }))
448
- },
449
- getMessage: async (context, event) => {
450
- const { currentMessage } = context
451
- return await request.send(mailbox.getMessage({ groupId: currentMessage.groupId }))
452
- },
453
- sendMessage: async (context, event) => {
454
- const { currentMessage, messageTitle, messageContent } = context
455
- const { from } = event.data
456
- return await request.send(
457
- mailbox.sendMessage({
458
- // groupId: currentMessage?.groupId,
459
- type: 'CUSTOMER',
460
- category: 'MAIL',
461
- from,
462
- to: 'SYSTEM',
463
- title: messageTitle,
464
- content: messageContent,
465
- })
466
- )
238
+ const { data } = event
239
+ request.send(mailbox.updateMessage({ groupId: data.groupId, isRead: true }))
240
+ data.isRead = true
241
+ return data
467
242
  },
468
243
  },
469
244
  }
@@ -1,79 +1,72 @@
1
1
  import activity from './activity/index.js'
2
2
  import auth from './auth.js'
3
+ import auth_otp from './auth_otp.js'
3
4
  import welcome from './welcome.js'
4
5
  import common from './common.js'
5
6
  import error from './error.js'
6
- import game_v2_1 from './game_v2_1.js'
7
+ import game from './game.js'
8
+ import game_v2 from './game_v2.js'
9
+ import game_favorite from './game_favorite.js'
7
10
  import game_favorite_v2 from './game_favorite_v2.js'
8
- import game_search_cash from './game_search_cash.js'
11
+ import game_search from './game_search.js'
9
12
  import game_search_v2 from './game_search_v2.js'
10
13
  import game_hot_new from './game_hot_new.js'
11
- import game_info from './game_info.js'
12
14
  import inbox from './inbox.js'
13
15
  import merge from './merge.js'
14
16
  import payment_data from './payment_data.js'
15
17
  import reward_fc from './reward_fc.js'
16
18
  import reward from './reward.js'
17
- import reward_cash from './reward_cash.js'
18
19
  import setting from './setting.js'
19
20
  import side from './side.js'
20
21
  import side_v2 from './side_v2.js'
21
- import side_cash from './side_cash.js'
22
22
  import user_info from './user_info.js'
23
23
  import user_sign_up from './user_sign_up.js'
24
24
  import user_reset_password from './user_reset_password.js'
25
25
  import bank_binding from './bank_binding.js'
26
- import bank_binding_amb from './bank_binding_amb.js'
27
- import withdraw from './withdraw/index.js'
26
+ import withdraw_fc from './withdraw_fc.js'
27
+ import withdraw_vn from './withdraw_vn.js'
28
+ import withdraw_crypto from './withdraw_crypto.js'
28
29
  import deposit from './deposit/index.js'
29
30
  import bonus from './bonus.js'
30
31
  import leaderboard from './leaderboard.js'
31
32
  import auth_otp_v2 from './auth_otp_v2.js'
32
33
  import auth_otp_v3 from './auth_otp_v3.js'
33
34
  import vip_table from './vip_table.js'
34
- import promotions from './promotions.js'
35
- import roulette_v2 from './roulette_v2.js'
36
- import honor_board_cash from './honor_board_cash.js'
37
- import user_photo from './user_photo.js'
38
- import navbar from './navbar.js'
39
35
 
40
36
  export default {
41
37
  ...activity,
42
38
  auth,
39
+ auth_otp,
43
40
  welcome,
44
41
  common,
42
+ deposit,
45
43
  error,
44
+ game,
45
+ game_v2,
46
+ game_favorite,
46
47
  game_favorite_v2,
47
- game_search_cash,
48
+ game_search,
48
49
  game_search_v2,
49
50
  game_hot_new,
50
- game_info,
51
51
  inbox,
52
52
  merge,
53
53
  payment_data,
54
54
  reward,
55
- reward_cash,
56
55
  reward_fc,
57
56
  setting,
58
57
  side,
59
58
  side_v2,
60
- side_cash,
61
- game_v2_1,
62
59
  user_info,
63
60
  user_sign_up,
64
61
  user_reset_password,
65
62
  bank_binding,
66
- bank_binding_amb,
63
+ withdraw_fc,
64
+ withdraw_vn,
65
+ withdraw_crypto,
67
66
  ...deposit,
68
67
  bonus,
69
68
  leaderboard,
70
69
  auth_otp_v2,
71
70
  auth_otp_v3,
72
71
  vip_table,
73
- promotions,
74
- roulette_v2,
75
- honor_board_cash,
76
- user_photo,
77
- navbar,
78
- ...withdraw,
79
72
  }
@@ -18,7 +18,7 @@ export default function (request) {
18
18
  invoke: {
19
19
  src: 'fetchActivityList',
20
20
  onDone: {
21
- target: 'idle',
21
+ target: 'checking',
22
22
  actions: 'setRankActivities',
23
23
  },
24
24
  onError: {
@@ -42,7 +42,7 @@ export default function (request) {
42
42
  },
43
43
  loading: {
44
44
  invoke: {
45
- src: 'fetchPublicActivityDetail',
45
+ src: 'fetchActivityDetail',
46
46
  onDone: {
47
47
  target: 'idle',
48
48
  actions: ['setActivityMap', 'setActivityDetail'],
@@ -62,6 +62,7 @@ export default function (request) {
62
62
  // 200: cl_activity
63
63
  return {
64
64
  rankActivities,
65
+ activityNo: rankActivities?.[0]?.activityNo,
65
66
  }
66
67
  }),
67
68
  setActivityNo: assign((context, event) => {
@@ -71,21 +72,8 @@ export default function (request) {
71
72
  }),
72
73
  setActivityMap: assign((context, event) => {
73
74
  const { activityMap, activityNo } = context
74
- if (event.data.rankingList) {
75
- return {
76
- activityMap: {
77
- ...activityMap,
78
- [activityNo]: {
79
- topRanking: event.data.rankingList,
80
- awards: event.data.awards,
81
- },
82
- },
83
- }
84
- } else {
85
- return {
86
- activityMap: { ...activityMap, [activityNo]: event.data },
87
- awards: event.data?.awards,
88
- }
75
+ return {
76
+ activityMap: { ...activityMap, [activityNo]: event.data },
89
77
  }
90
78
  }),
91
79
  setActivityDetail: assign((context, event) => {
@@ -106,24 +94,13 @@ export default function (request) {
106
94
  },
107
95
  services: {
108
96
  fetchActivityList: async (context, event) => {
109
- // delay 1s for backend request throttle
110
- await new Promise((resolve) => {
111
- setTimeout(resolve, 1000)
112
- })
113
-
114
97
  const { data } = await request.send(api.getActivityList({ appSecret }))
115
98
  return data
116
99
  },
117
- fetchPublicActivityDetail: async (context, event) => {
118
- const hasToken = request.getToken()
100
+ fetchActivityDetail: async (context, event) => {
119
101
  const { activityNo } = context
120
- let result = {}
121
- if (hasToken) {
122
- result = await request.send(api.getActivityDetail({ activityNo, appSecret }))
123
- } else {
124
- result = await request.send(api.getTournamentDetail({ activityNo, appSecret }))
125
- }
126
- return result.data
102
+ const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }))
103
+ return data
127
104
  },
128
105
  },
129
106
  }