@jetthai/cuora 1.0.134 → 1.0.136
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 +4 -0
- package/package.json +1 -1
- package/src/api/game.js +14 -0
- package/src/machine/common.js +19 -14
- package/src/machine/game_search.js +2 -6
- package/src/request/config.js +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
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.0.136](https://github.com/jetthai/cuora-module/compare/v1.0.135...v1.0.136) (2022-06-20)
|
|
6
|
+
|
|
7
|
+
### [1.0.135](https://github.com/jetthai/cuora-module/compare/v1.0.134...v1.0.135) (2022-06-16)
|
|
8
|
+
|
|
5
9
|
### [1.0.134](https://github.com/jetthai/cuora-module/compare/v1.0.133...v1.0.134) (2022-06-13)
|
|
6
10
|
|
|
7
11
|
### [1.0.133](https://github.com/jetthai/cuora-module/compare/v1.0.132...v1.0.133) (2022-06-13)
|
package/package.json
CHANGED
package/src/api/game.js
CHANGED
|
@@ -29,4 +29,18 @@ export default {
|
|
|
29
29
|
clickDefault,
|
|
30
30
|
},
|
|
31
31
|
}),
|
|
32
|
+
gameHistory: ({ requestTimestamp, lang, provider, type }) => ({
|
|
33
|
+
url: 'game/history',
|
|
34
|
+
method: 'post',
|
|
35
|
+
params: { requestTimestamp, lang, provider, type },
|
|
36
|
+
}),
|
|
37
|
+
gameHistoryDetail: ({ requestTimestamp, provider, gameId, lang, page, row }) => ({
|
|
38
|
+
url: 'game/history/detail',
|
|
39
|
+
method: 'post',
|
|
40
|
+
params: { requestTimestamp, provider, gameId, lang, page, row },
|
|
41
|
+
}),
|
|
42
|
+
gameHistoryOptions: () => ({
|
|
43
|
+
url: 'game/history/options',
|
|
44
|
+
method: 'get',
|
|
45
|
+
}),
|
|
32
46
|
}
|
package/src/machine/common.js
CHANGED
|
@@ -6,7 +6,7 @@ import api from '../api/common'
|
|
|
6
6
|
const cookies = new Cookies()
|
|
7
7
|
|
|
8
8
|
export default function (request) {
|
|
9
|
-
const { appSecret } = request.config
|
|
9
|
+
const { appSecret, defaultChannel, defaultSubchannel } = request.config
|
|
10
10
|
return createMachine(
|
|
11
11
|
{
|
|
12
12
|
id: 'common',
|
|
@@ -37,6 +37,8 @@ export default function (request) {
|
|
|
37
37
|
normalBroadcast: null,
|
|
38
38
|
sentEmergencyBroadcastList: [],
|
|
39
39
|
sentNormalBroadcastList: [],
|
|
40
|
+
channel: null,
|
|
41
|
+
subchannel: null,
|
|
40
42
|
},
|
|
41
43
|
states: {
|
|
42
44
|
config: {
|
|
@@ -144,22 +146,25 @@ export default function (request) {
|
|
|
144
146
|
isMobile: userAgent?.device?.type,
|
|
145
147
|
}
|
|
146
148
|
}),
|
|
147
|
-
setAgent: (context, event) => {
|
|
149
|
+
setAgent: assign((context, event) => {
|
|
148
150
|
let urlParams = new URLSearchParams(window.location.search)
|
|
149
|
-
const channel = urlParams.get('channel')
|
|
150
|
-
const subchannel = urlParams.get('subchannel')
|
|
151
|
+
const channel = urlParams.get('channel') || cookies.get('channel') || defaultChannel || 'official'
|
|
152
|
+
const subchannel = urlParams.get('subchannel') || cookies.get('subchannel') || defaultSubchannel || 'pwa'
|
|
151
153
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
154
|
+
cookies.set('channel', channel, {
|
|
155
|
+
path: '/',
|
|
156
|
+
maxAge: 60 * 60 * 24 * 7,
|
|
157
|
+
})
|
|
158
|
+
cookies.set('subchannel', subchannel, {
|
|
159
|
+
path: '/',
|
|
160
|
+
maxAge: 60 * 60 * 24 * 7,
|
|
161
|
+
})
|
|
162
|
+
|
|
163
|
+
return {
|
|
164
|
+
channel,
|
|
165
|
+
subchannel,
|
|
161
166
|
}
|
|
162
|
-
},
|
|
167
|
+
}),
|
|
163
168
|
setFeeds: assign((context, event) => {
|
|
164
169
|
const { announcementList, broadcastList, mailBoxInfo } = event.data
|
|
165
170
|
const promotions = announcementList?.announcements?.filter?.((item) => item.category === 3) || []
|
|
@@ -231,16 +231,12 @@ export default function (request) {
|
|
|
231
231
|
},
|
|
232
232
|
fetchGames: async (context, event) => {
|
|
233
233
|
const { tagId, tagIndex, keyword, click, clickDefault } = context
|
|
234
|
-
const { traceId, result } = await request.send(
|
|
235
|
-
game.getGameSearchList({ id: tagId, index: tagIndex, q: keyword, click, clickDefault })
|
|
236
|
-
)
|
|
234
|
+
const { traceId, result } = await request.send(game.getGameSearchList({ id: tagId, index: tagIndex, q: keyword, click, clickDefault }))
|
|
237
235
|
return { traceId, result }
|
|
238
236
|
},
|
|
239
237
|
sendTrace: async (context, event) => {
|
|
240
238
|
const { traceId, tagId, tagIndex, gameCode, gameCodeIndex, keyword: query, click, clickDefault } = context
|
|
241
|
-
return await request.send(
|
|
242
|
-
game.setGameSearchTrace({ traceId, tagId, tagIndex, gameCode, gameCodeIndex, query, click, clickDefault })
|
|
243
|
-
)
|
|
239
|
+
return await request.send(game.setGameSearchTrace({ traceId, tagId, tagIndex, gameCode, gameCodeIndex, query, click, clickDefault }))
|
|
244
240
|
},
|
|
245
241
|
},
|
|
246
242
|
}
|
package/src/request/config.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import urljoin from 'url-join'
|
|
2
2
|
|
|
3
3
|
export default class Config {
|
|
4
|
-
constructor({ apiURL, apiVersion, clientId, appSecret, platform, version, fpToken, sentry }) {
|
|
4
|
+
constructor({ apiURL, apiVersion, clientId, appSecret, platform, version, fpToken, sentry, defaultChannel, defaultSubchannel }) {
|
|
5
5
|
this.apiURL = apiURL
|
|
6
6
|
this.apiVersion = apiVersion
|
|
7
7
|
this.clientId = clientId
|
|
@@ -11,6 +11,8 @@ export default class Config {
|
|
|
11
11
|
this.fullURL = urljoin(this.apiURL, this.apiVersion, this.clientId)
|
|
12
12
|
this.fpToken = fpToken // fingerprintjs token
|
|
13
13
|
this.sentry = sentry
|
|
14
|
+
this.defaultChannel = defaultChannel
|
|
15
|
+
this.defaultSubchannel = defaultSubchannel
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
setApiURL(url) {
|