@jetthai/cuora 1.1.66-sabai-6 → 1.1.66

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.
@@ -10,26 +10,11 @@ export default function (request) {
10
10
  list: [],
11
11
  },
12
12
  states: {
13
- idle: {
14
- on: {
15
- ADD: {
16
- target: 'operation.adding.enable',
17
- actions: 'addToList',
18
- cond: 'isNotExist',
19
- },
20
- REMOVE: {
21
- target: 'operation.removing.enable',
22
- actions: 'removeFromList',
23
- cond: 'isExist',
24
- },
25
- },
26
- },
27
13
  fetching: {
28
14
  invoke: {
29
15
  src: 'fetchList',
30
16
  onDone: {
31
17
  actions: 'setList',
32
- target: '#favorite.idle',
33
18
  },
34
19
  onError: {
35
20
  actions: assign({ list: [] }),
@@ -46,12 +31,9 @@ export default function (request) {
46
31
  enable: {
47
32
  invoke: {
48
33
  src: 'add',
49
- onDone: {
50
- target: '#favorite.idle',
51
- },
34
+ onDone: {},
52
35
  onError: {
53
36
  actions: 'removeFromList',
54
- target: '#favorite.idle',
55
37
  },
56
38
  },
57
39
  },
@@ -64,12 +46,9 @@ export default function (request) {
64
46
  enable: {
65
47
  invoke: {
66
48
  src: 'remove',
67
- onDone: {
68
- target: '#favorite.idle',
69
- },
49
+ onDone: {},
70
50
  onError: {
71
51
  actions: 'addToList',
72
- target: '#favorite.idle',
73
52
  },
74
53
  },
75
54
  },
@@ -78,6 +57,18 @@ export default function (request) {
78
57
  },
79
58
  },
80
59
  },
60
+ on: {
61
+ ADD: {
62
+ target: 'operation.adding.enable',
63
+ actions: 'addToList',
64
+ cond: 'isNotExist',
65
+ },
66
+ REMOVE: {
67
+ target: 'operation.removing.enable',
68
+ actions: 'removeFromList',
69
+ cond: 'isExist',
70
+ },
71
+ },
81
72
  },
82
73
  {
83
74
  actions: {
@@ -37,7 +37,6 @@ export default function (request) {
37
37
  lang: 'en_US',
38
38
  isMobile: new UAParser().getResult().device.type,
39
39
  gameURL: null,
40
- inGaming: false,
41
40
  ...oldContext,
42
41
  },
43
42
  states: {
@@ -126,12 +125,15 @@ export default function (request) {
126
125
  states: {
127
126
  pending: {
128
127
  after: {
129
- 20000: [{ target: 'inGaming', cond: 'isInGaming' }, { target: 'updating', cond: 'hasRoom' }, { target: 'pending' }],
130
- },
131
- },
132
- inGaming: {
133
- after: {
134
- 3000: [{ target: 'inGaming', cond: 'isInGaming' }, { target: 'updating', cond: 'hasRoom' }, { target: 'pending' }],
128
+ 20000: [
129
+ {
130
+ target: 'updating',
131
+ cond: 'hasRoom',
132
+ },
133
+ {
134
+ target: 'pending',
135
+ },
136
+ ],
135
137
  },
136
138
  },
137
139
  updating: {
@@ -171,7 +173,7 @@ export default function (request) {
171
173
  src: 'fetchStatus',
172
174
  onDone: {
173
175
  target: 'updatingOption',
174
- actions: 'setStatus',
176
+ actions: ['setStatus'],
175
177
  },
176
178
  onError: {
177
179
  target: 'pending',
@@ -192,25 +194,14 @@ export default function (request) {
192
194
  },
193
195
  pending: {
194
196
  after: {
195
- 20000: [{ target: 'inGaming', cond: 'isInGaming' }, { target: 'fetchingGameSHA' }],
196
- },
197
- },
198
- inGaming: {
199
- after: {
200
- 3000: [{ target: 'inGaming', cond: 'isInGaming' }, { target: 'fetchingGameSHA' }],
197
+ 20000: {
198
+ target: 'fetchingGameSHA',
199
+ },
201
200
  },
202
201
  },
203
202
  },
204
203
  },
205
204
  },
206
- on: {
207
- SET_IN_GAME: {
208
- actions: 'setInGaming',
209
- },
210
- SET_LEAVE_GAME: {
211
- actions: 'setLeaveGame',
212
- },
213
- },
214
205
  },
215
206
  {
216
207
  actions: {
@@ -227,9 +218,15 @@ export default function (request) {
227
218
  setLastPage: assign((context, event) => {
228
219
  const { index, content } = context
229
220
  return {
221
+ loadable: false,
230
222
  isLastPage: index >= content?.totalPage - 1,
231
223
  }
232
224
  }),
225
+ setFavoriteList: assign((context, event) => {
226
+ return {
227
+ favoriteList: event.data.data || [],
228
+ }
229
+ }),
233
230
  setRoom: assign((context, event) => {
234
231
  return {
235
232
  room: event.data,
@@ -314,12 +311,6 @@ export default function (request) {
314
311
  const lang = event.data.locale.replace('-', '_')
315
312
  return { lang }
316
313
  }),
317
- setInGaming: assign((context, event) => {
318
- return { inGaming: true }
319
- }),
320
- setLeaveGame: assign((context, event) => {
321
- return { inGaming: false }
322
- }),
323
314
  ...oldActions,
324
315
  },
325
316
  guards: {
@@ -328,12 +319,7 @@ export default function (request) {
328
319
  const { loadable, isLastPage } = context
329
320
  return loadable && !isLastPage
330
321
  },
331
- hasRoom: (context, event) => {
332
- return context.room?.categoryId
333
- },
334
- isInGaming: (context, event) => {
335
- return context.inGaming
336
- },
322
+ hasRoom: (context, event) => context.room?.categoryId,
337
323
  ...oldGuards,
338
324
  },
339
325
  services: {
@@ -12,7 +12,6 @@ export default function (request) {
12
12
  previousMenuItemStack: [],
13
13
  historyStack: [],
14
14
  defaultMenuItemStack: [],
15
- inGaming: false,
16
15
  },
17
16
  states: {
18
17
  loading: {
@@ -29,12 +28,15 @@ export default function (request) {
29
28
  states: {
30
29
  pending: {
31
30
  after: {
32
- 20000: [{ target: 'inGaming', cond: 'isInGaming' }, { target: 'updating', cond: 'isInMenu' }, { target: 'pending' }],
33
- },
34
- },
35
- inGaming: {
36
- after: {
37
- 3000: [{ target: 'inGaming', cond: 'isInGaming' }, { target: 'updating', cond: 'isInMenu' }, { target: 'pending' }],
31
+ 20000: [
32
+ {
33
+ target: 'updating',
34
+ cond: 'isInMenu',
35
+ },
36
+ {
37
+ target: 'pending',
38
+ },
39
+ ],
38
40
  },
39
41
  },
40
42
  updating: {
@@ -63,12 +65,6 @@ export default function (request) {
63
65
  RESET: {
64
66
  actions: 'resetMenuItemStack',
65
67
  },
66
- SET_IN_GAME: {
67
- actions: 'setInGame',
68
- },
69
- SET_LEAVE_GAME: {
70
- actions: 'setLeaveGame',
71
- },
72
68
  },
73
69
  },
74
70
  },
@@ -90,8 +86,8 @@ export default function (request) {
90
86
  setMenuItemStack: assign((context, event) => {
91
87
  const { menuItemStack } = context
92
88
  const inputItem = event.data
93
- const isTopItem = inputItem.level ? inputItem.level === 0 : true
94
- const hasSubMenu = inputItem.sub?.length || 0
89
+ const isTopItem = inputItem.level === 0
90
+ const hasSubMenu = inputItem.sub.length
95
91
 
96
92
  if (isTopItem) {
97
93
  if (hasSubMenu) {
@@ -144,24 +140,13 @@ export default function (request) {
144
140
  const { defaultMenuItemStack } = context
145
141
  return { menuItemStack: defaultMenuItemStack }
146
142
  }),
147
- setInGame: assign((context, event) => {
148
- return { inGaming: true }
149
- }),
150
- setLeaveGame: assign((context, event) => {
151
- return { inGaming: false }
152
- }),
153
143
  },
154
144
  guards: {
155
145
  isInMenu: (context, event) => {
156
146
  const { menuItemStack, menu } = context
157
- if (!menuItemStack || menuItemStack.length === 0) return false
158
147
  const menuItem = menuItemStack.slice(-1)[0]
159
- if (!menuItem || !menuItem.categoryId) return false
160
148
  return isItemInMenu(menuItem, menu.data)
161
149
  },
162
- isInGaming: (context, event) => {
163
- return context.inGaming
164
- },
165
150
  },
166
151
  services: {
167
152
  getMenu: async (context, event) => {
@@ -1,21 +1,19 @@
1
+ // import FingerprintJS from '@fingerprintjs/fingerprintjs-pro'
1
2
  import uniqBy from 'lodash/uniqBy'
2
- import { load, defaultEndpoint } from '../lib/fingerprint_v3_11_5.js'
3
+ import { load } from '../lib/fingerprint.js'
3
4
 
4
5
  const reg = /fnapi\d*/
6
+ // const reg = /(?<=https:\/\/)\w+(?=(\.\w+\.\w+))/
5
7
 
6
- const getDeviceToken = async ({ fpToken, sentry, hosts, enable = true }) => {
7
- if (!enable) {
8
- return
9
- }
10
-
8
+ const getDeviceToken = async ({ fpToken, sentry, hosts }) => {
11
9
  let dt, endpoints
12
10
  try {
13
11
  endpoints = uniqBy(
14
12
  hosts.map((host) => host.replace(reg, 'fp')),
15
13
  (url) => url
16
14
  )
17
-
18
- const fp = await load({ endpoint: [...endpoints, defaultEndpoint] })
15
+ // const fp = await FingerprintJS.load({ apiKey: fpToken, endpoint: endpoints })
16
+ const fp = await load({ endpoint: endpoints })
19
17
  const result = await fp.get({ timeout: 30000 })
20
18
  dt = result.visitorId
21
19
 
@@ -24,7 +22,6 @@ const getDeviceToken = async ({ fpToken, sentry, hosts, enable = true }) => {
24
22
  }
25
23
 
26
24
  console.log('[Device Token]', `${dt} from ${endpoints}`)
27
- sentry?.setTag('dt', dt)
28
25
  } catch (error) {
29
26
  console.error('[Device Token]', `${dt} from ${endpoints}`, error)
30
27
  sentry?.captureException(error)