@jetthai/cuora 1.1.300-dev-1 → 1.1.300
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/CHANGELOG.md +0 -2
- package/package.json +1 -1
- package/src/api/common.js +0 -1
- package/src/machine/game_v2_1.js +2 -35
- package/src/machine/index.js +0 -2
- package/src/machine/navbar.js +0 -57
package/CHANGELOG.md
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
-
### [1.1.300-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.300...v1.1.300-dev-1) (2024-08-28)
|
|
6
|
-
|
|
7
5
|
### [1.1.300](https://github.com/jetthai/cuora-module/compare/v1.1.299...v1.1.300) (2024-08-27)
|
|
8
6
|
|
|
9
7
|
### [1.1.299](https://github.com/jetthai/cuora-module/compare/v1.1.297...v1.1.299) (2024-08-27)
|
package/package.json
CHANGED
package/src/api/common.js
CHANGED
|
@@ -4,5 +4,4 @@ export default {
|
|
|
4
4
|
feeds: ({ appSecret }) => ({ url: 'feeds', method: 'get', params: { appSecret }, isPublic: true }),
|
|
5
5
|
broadcast: () => ({ url: 'broadcast', method: 'get', isPublic: true }),
|
|
6
6
|
getAnnouncements: ({ appSecret }) => ({ url: 'getAnnouncements', params: { appSecret }, method: 'get', isPublic: true }),
|
|
7
|
-
getNavbar: ({ appSecret } = {}) => ({ url: 'getNavbarSetting', params: { appSecret }, method: 'get', isPublic: true }),
|
|
8
7
|
}
|
package/src/machine/game_v2_1.js
CHANGED
|
@@ -14,7 +14,6 @@ export default function (request) {
|
|
|
14
14
|
batch: null,
|
|
15
15
|
loadable: false,
|
|
16
16
|
isLastPage: false,
|
|
17
|
-
pageLoading: true,
|
|
18
17
|
room: null,
|
|
19
18
|
index: -1,
|
|
20
19
|
content: {
|
|
@@ -65,11 +64,6 @@ export default function (request) {
|
|
|
65
64
|
target: 'routing',
|
|
66
65
|
actions: 'setLoadable',
|
|
67
66
|
},
|
|
68
|
-
// 載入下一頁
|
|
69
|
-
NEXT_PAGE: {
|
|
70
|
-
target: 'routing',
|
|
71
|
-
actions: 'setLoadable',
|
|
72
|
-
},
|
|
73
67
|
SET_ROOM: {
|
|
74
68
|
cond: 'isDifferentRoom',
|
|
75
69
|
actions: ['setRoom', 'resetContent'],
|
|
@@ -107,10 +101,7 @@ export default function (request) {
|
|
|
107
101
|
invoke: {
|
|
108
102
|
src: 'getPageContent',
|
|
109
103
|
onDone: {
|
|
110
|
-
|
|
111
|
-
// target: 'routing',
|
|
112
|
-
// 現在: 載完一個頁面就切成loaded狀態
|
|
113
|
-
target: 'loaded',
|
|
104
|
+
target: 'routing',
|
|
114
105
|
actions: ['appendContent', 'setLastPage'],
|
|
115
106
|
},
|
|
116
107
|
onError: {
|
|
@@ -121,23 +112,13 @@ export default function (request) {
|
|
|
121
112
|
LOAD: { actions: 'setLoadable' },
|
|
122
113
|
},
|
|
123
114
|
},
|
|
124
|
-
// 已將當前頁載入完成
|
|
125
|
-
loaded: {
|
|
126
|
-
after: {
|
|
127
|
-
0: {
|
|
128
|
-
target: 'idle',
|
|
129
|
-
actions: 'setPageLoadingDone',
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
115
|
routing: {
|
|
134
116
|
always: [
|
|
135
117
|
{
|
|
136
118
|
target: 'loading',
|
|
137
119
|
cond: 'hasNext',
|
|
138
|
-
actions: 'setPageLoading',
|
|
139
120
|
},
|
|
140
|
-
{ target: 'idle'
|
|
121
|
+
{ target: 'idle' },
|
|
141
122
|
],
|
|
142
123
|
},
|
|
143
124
|
updating: {
|
|
@@ -339,7 +320,6 @@ export default function (request) {
|
|
|
339
320
|
}),
|
|
340
321
|
setLastPage: assign((context, event) => {
|
|
341
322
|
const { index, content } = context
|
|
342
|
-
// 最後一頁
|
|
343
323
|
return {
|
|
344
324
|
isLastPage: index >= content?.totalPage - 1,
|
|
345
325
|
}
|
|
@@ -449,25 +429,12 @@ export default function (request) {
|
|
|
449
429
|
const lang = event.data.locale.replace('-', '_')
|
|
450
430
|
return { lang }
|
|
451
431
|
}),
|
|
452
|
-
setPageLoadingDone: assign((context, event) => {
|
|
453
|
-
// const { index } = context
|
|
454
|
-
// console.log('*載入完成:當前頁碼', index)
|
|
455
|
-
return {
|
|
456
|
-
pageLoading: true,
|
|
457
|
-
}
|
|
458
|
-
}),
|
|
459
|
-
setPageLoading: assign((context, event) => {
|
|
460
|
-
return {
|
|
461
|
-
pageLoading: false,
|
|
462
|
-
}
|
|
463
|
-
}),
|
|
464
432
|
...oldActions,
|
|
465
433
|
},
|
|
466
434
|
guards: {
|
|
467
435
|
isDifferentRoom: (context, event) => context.room?.categoryId !== event.data?.categoryId,
|
|
468
436
|
hasNext: (context, event) => {
|
|
469
437
|
const { loadable, isLastPage } = context
|
|
470
|
-
// 是否有下一頁
|
|
471
438
|
return loadable && !isLastPage
|
|
472
439
|
},
|
|
473
440
|
hasRoom: (context, event) => context.room?.categoryId,
|
package/src/machine/index.js
CHANGED
|
@@ -35,7 +35,6 @@ import promotions from './promotions.js'
|
|
|
35
35
|
import roulette_v2 from './roulette_v2.js'
|
|
36
36
|
import honor_board_cash from './honor_board_cash.js'
|
|
37
37
|
import user_photo from './user_photo.js'
|
|
38
|
-
import navbar from './navbar.js'
|
|
39
38
|
|
|
40
39
|
export default {
|
|
41
40
|
...activity,
|
|
@@ -74,6 +73,5 @@ export default {
|
|
|
74
73
|
roulette_v2,
|
|
75
74
|
honor_board_cash,
|
|
76
75
|
user_photo,
|
|
77
|
-
navbar,
|
|
78
76
|
...withdraw,
|
|
79
77
|
}
|
package/src/machine/navbar.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { assign, createMachine } from 'xstate'
|
|
2
|
-
import common from '../api/common.js'
|
|
3
|
-
|
|
4
|
-
export default function (request) {
|
|
5
|
-
const { appSecret } = request.config
|
|
6
|
-
return createMachine(
|
|
7
|
-
{
|
|
8
|
-
id: 'navbar',
|
|
9
|
-
initial: 'fetching',
|
|
10
|
-
context: {
|
|
11
|
-
navbar: null,
|
|
12
|
-
},
|
|
13
|
-
states: {
|
|
14
|
-
fetching: {
|
|
15
|
-
invoke: {
|
|
16
|
-
src: 'fetchNavbar',
|
|
17
|
-
onDone: {
|
|
18
|
-
target: 'idle',
|
|
19
|
-
actions: 'setNavbar',
|
|
20
|
-
},
|
|
21
|
-
onError: {
|
|
22
|
-
target: 'idle',
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
idle: {},
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
actions: {
|
|
31
|
-
setNavbar: assign((context, event) => {
|
|
32
|
-
const { navbarConfig } = event.data
|
|
33
|
-
return {
|
|
34
|
-
navbar: navbarConfig.settings,
|
|
35
|
-
}
|
|
36
|
-
}),
|
|
37
|
-
},
|
|
38
|
-
services: {
|
|
39
|
-
fetchNavbar: async (context, event) => {
|
|
40
|
-
const navbar = await request.send(common.getNavbar({ appSecret }))
|
|
41
|
-
const base64Url = navbar.config.split('.')[0]
|
|
42
|
-
const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/')
|
|
43
|
-
const decodeResult = decodeURIComponent(
|
|
44
|
-
window
|
|
45
|
-
.atob(base64)
|
|
46
|
-
.split('')
|
|
47
|
-
.map((c) => {
|
|
48
|
-
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2)
|
|
49
|
-
})
|
|
50
|
-
.join('')
|
|
51
|
-
)
|
|
52
|
-
return { navbarConfig: JSON.parse(decodeResult) }
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
}
|
|
56
|
-
)
|
|
57
|
-
}
|