@jetthai/cuora 1.1.65 → 1.1.66-sabai

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.65",
3
+ "version": "1.1.66-sabai",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -20,10 +20,10 @@
20
20
  "@rollup/plugin-commonjs": "^22.0.2",
21
21
  "@rollup/plugin-node-resolve": "^13.3.0",
22
22
  "@rollup/plugin-replace": "^4.0.0",
23
+ "husky": "^8.0.0",
23
24
  "prettier": "^2.3.0",
24
- "rollup": "^2.78.1",
25
- "standard-version": "^9.3.1",
26
- "husky": "^8.0.0"
25
+ "rollup": "^2.79.1",
26
+ "standard-version": "^9.3.1"
27
27
  },
28
28
  "dependencies": {
29
29
  "lodash": "^4.17.21",
@@ -20,6 +20,7 @@ export default function (request) {
20
20
  parentCategoryId: null,
21
21
  totalPage: 0,
22
22
  },
23
+ additionEnable: false,
23
24
  addition: {
24
25
  data: [],
25
26
  timestamp: null,
@@ -45,6 +46,9 @@ export default function (request) {
45
46
  idle: {
46
47
  enter: 'clearGameInfo',
47
48
  on: {
49
+ SET_ADDITION_ENABLE: {
50
+ actions: 'setAdditionEnable',
51
+ },
48
52
  LOAD: {
49
53
  target: 'routing',
50
54
  actions: 'setLoadable',
@@ -201,6 +205,11 @@ export default function (request) {
201
205
  },
202
206
  {
203
207
  actions: {
208
+ setAdditionEnable: assign((context, event) => {
209
+ return {
210
+ additionEnable: event.data,
211
+ }
212
+ }),
204
213
  setLoadable: assign((context, event) => {
205
214
  return {
206
215
  loadable: event.data,
@@ -241,10 +250,10 @@ export default function (request) {
241
250
  }
242
251
  }),
243
252
  appendContent: assign((context, event) => {
244
- const { room, favoriteList } = context
253
+ const { room, additionEnable } = context
245
254
  if (room.categoryId === GAME_SEARCH) {
246
255
  return
247
- } else {
256
+ } else if (additionEnable) {
248
257
  const [content, addition] = event.data
249
258
  return {
250
259
  content: {
@@ -258,6 +267,15 @@ export default function (request) {
258
267
  data: context.addition.data.concat(addition.data),
259
268
  },
260
269
  }
270
+ } else {
271
+ const [content] = event.data
272
+ return {
273
+ content: {
274
+ ...context.content,
275
+ ...content,
276
+ data: context.content.data.concat(content.data),
277
+ },
278
+ }
261
279
  }
262
280
  }),
263
281
  swapContent: assign((context, event) => {
@@ -305,19 +323,22 @@ export default function (request) {
305
323
  },
306
324
  services: {
307
325
  getPageContent: async (context, event) => {
308
- const { room, index } = context
326
+ const { room, index, additionEnable } = context
309
327
  if (room.categoryId === GAME_SEARCH) {
310
328
  return
311
- } else {
329
+ } else if (additionEnable) {
312
330
  const param = { categoryId: room.categoryId, index }
313
331
  return await Promise.all([request.send(api.getListCategory(param)), request.send(api.getListAddition(param))])
332
+ } else {
333
+ const param = { categoryId: room.categoryId, index }
334
+ return await Promise.all([request.send(api.getListCategory(param))])
314
335
  }
315
336
  },
316
337
  updatePageContent: async (context, event) => {
317
- const { room, content, index } = context
338
+ const { room, content, index, additionEnable } = context
318
339
  if (room.categoryId === GAME_SEARCH) {
319
340
  return
320
- } else {
341
+ } else if (additionEnable) {
321
342
  return await Promise.all([
322
343
  request.send(
323
344
  api.getListCategoryByRange({
@@ -334,6 +355,16 @@ export default function (request) {
334
355
  })
335
356
  ),
336
357
  ])
358
+ } else {
359
+ return await Promise.all([
360
+ request.send(
361
+ api.getListCategoryByRange({
362
+ categoryId: room.categoryId,
363
+ end: index,
364
+ timestamp: content.timestamp,
365
+ })
366
+ ),
367
+ ])
337
368
  }
338
369
  },
339
370
  connectGame: async (context, event) => {
@@ -144,7 +144,9 @@ export default function (request) {
144
144
  guards: {
145
145
  isInMenu: (context, event) => {
146
146
  const { menuItemStack, menu } = context
147
+ if (!menuItemStack || menuItemStack.length === 0) return false
147
148
  const menuItem = menuItemStack.slice(-1)[0]
149
+ if (!menuItem) return false
148
150
  return isItemInMenu(menuItem, menu.data)
149
151
  },
150
152
  },