@jetthai/cuora 1.1.320-dev-4 → 1.1.320-dev-6
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
CHANGED
|
@@ -2,6 +2,26 @@
|
|
|
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.320-dev-6](https://github.com/jetthai/cuora-module/compare/v1.1.325-dev-2...v1.1.320-dev-6) (2024-12-04)
|
|
6
|
+
|
|
7
|
+
### [1.1.325-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.325-dev-1...v1.1.325-dev-2) (2024-12-04)
|
|
8
|
+
|
|
9
|
+
### [1.1.325-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.325...v1.1.325-dev-1) (2024-12-04)
|
|
10
|
+
|
|
11
|
+
### [1.1.325](https://github.com/jetthai/cuora-module/compare/v1.1.324...v1.1.325) (2024-12-04)
|
|
12
|
+
|
|
13
|
+
### [1.1.320-dev-5](https://github.com/jetthai/cuora-module/compare/v1.1.320-dev-4...v1.1.320-dev-5) (2024-12-02)
|
|
14
|
+
|
|
15
|
+
### [1.1.320-dev-4](https://github.com/jetthai/cuora-module/compare/v1.1.320-dev-3...v1.1.320-dev-4) (2024-12-02)
|
|
16
|
+
|
|
17
|
+
### [1.1.320-dev-3](https://github.com/jetthai/cuora-module/compare/v1.1.320-dev-2...v1.1.320-dev-3) (2024-12-02)
|
|
18
|
+
|
|
19
|
+
### [1.1.320-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.320-dev-1...v1.1.320-dev-2) (2024-11-29)
|
|
20
|
+
|
|
21
|
+
### [1.1.320-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.320...v1.1.320-dev-1) (2024-11-29)
|
|
22
|
+
|
|
23
|
+
### [1.1.320-dev-5](https://github.com/jetthai/cuora-module/compare/v1.1.320-dev-4...v1.1.320-dev-5) (2024-12-02)
|
|
24
|
+
|
|
5
25
|
### [1.1.320-dev-4](https://github.com/jetthai/cuora-module/compare/v1.1.320-dev-3...v1.1.320-dev-4) (2024-12-02)
|
|
6
26
|
|
|
7
27
|
### [1.1.320-dev-3](https://github.com/jetthai/cuora-module/compare/v1.1.320-dev-2...v1.1.320-dev-3) (2024-12-02)
|
|
@@ -10,6 +30,14 @@ All notable changes to this project will be documented in this file. See [standa
|
|
|
10
30
|
|
|
11
31
|
### [1.1.320-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.320...v1.1.320-dev-1) (2024-11-29)
|
|
12
32
|
|
|
33
|
+
### [1.1.324](https://github.com/jetthai/cuora-module/compare/v1.1.323...v1.1.324) (2024-12-04)
|
|
34
|
+
|
|
35
|
+
### [1.1.323](https://github.com/jetthai/cuora-module/compare/v1.1.322...v1.1.323) (2024-12-04)
|
|
36
|
+
|
|
37
|
+
### [1.1.322](https://github.com/jetthai/cuora-module/compare/v1.1.321...v1.1.322) (2024-12-03)
|
|
38
|
+
|
|
39
|
+
### [1.1.321](https://github.com/jetthai/cuora-module/compare/v1.1.320...v1.1.321) (2024-12-02)
|
|
40
|
+
|
|
13
41
|
### [1.1.320](https://github.com/jetthai/cuora-module/compare/v1.1.319...v1.1.320) (2024-11-26)
|
|
14
42
|
|
|
15
43
|
### [1.1.319](https://github.com/jetthai/cuora-module/compare/v1.1.318...v1.1.319) (2024-11-26)
|
package/package.json
CHANGED
package/src/api/common.js
CHANGED
|
@@ -5,4 +5,5 @@ export default {
|
|
|
5
5
|
broadcast: () => ({ url: 'broadcast', method: 'get', isPublic: true }),
|
|
6
6
|
getAnnouncements: ({ appSecret }) => ({ url: 'getAnnouncements', params: { appSecret }, method: 'get', isPublic: true }),
|
|
7
7
|
getNavbar: ({ appSecret } = {}) => ({ url: 'getNavbarSetting', params: { appSecret }, method: 'get', isPublic: true }),
|
|
8
|
+
getDefaultAffiliateCode: ({ appSecret }) => ({ url: 'getAffiliateCode', params: { appSecret }, method: 'get', isPublic: true }),
|
|
8
9
|
}
|
package/src/api/game.js
CHANGED
|
@@ -92,4 +92,5 @@ export default {
|
|
|
92
92
|
addListFavorite: (code) => ({ method: 'post', url: 'game/list/v3/addMyFavorite', params: { games: [code] } }),
|
|
93
93
|
removeListFavorite: (code) => ({ method: 'post', url: 'game/list/v3/removeMyFavorite', params: { games: [code] } }),
|
|
94
94
|
getGameInfo: ({ appSecret, gameCode }) => ({ method: 'get', url: 'game/info', params: { appSecret, gameCode } }),
|
|
95
|
+
getGameReplayInfo: () => ({ method: 'post', url: 'game/history/detail' }),
|
|
95
96
|
}
|
|
@@ -269,8 +269,8 @@ export default function (request) {
|
|
|
269
269
|
fetchFriendsList: async (context, event) => {
|
|
270
270
|
const { currentType, listPage, friendsList } = context
|
|
271
271
|
const copiedObj = JSON.parse(JSON.stringify(friendsList))
|
|
272
|
-
const copiedList = copiedObj.
|
|
273
|
-
const resopnseData = await request.send(user.getFriendsList({ type: currentType, page: listPage, row:
|
|
272
|
+
const copiedList = copiedObj.list
|
|
273
|
+
const resopnseData = await request.send(user.getFriendsList({ type: currentType, page: listPage, row: 15 }))
|
|
274
274
|
if (!!copiedList && !!resopnseData?.data?.list) {
|
|
275
275
|
const combindData = {
|
|
276
276
|
...resopnseData.data,
|
package/src/machine/common.js
CHANGED
|
@@ -4,9 +4,6 @@ import pickBy from 'lodash/pickBy.js'
|
|
|
4
4
|
import api from '../api/common.js'
|
|
5
5
|
import storage from '../util/storage.js'
|
|
6
6
|
|
|
7
|
-
// const pickBy = require('lodash/pickBy')
|
|
8
|
-
// const UAParser = require('ua-parser-js')
|
|
9
|
-
|
|
10
7
|
export default function (request) {
|
|
11
8
|
const { appSecret, defaultChannel, defaultSubchannel } = request.config
|
|
12
9
|
return createMachine(
|
|
@@ -41,6 +38,7 @@ export default function (request) {
|
|
|
41
38
|
channel: null,
|
|
42
39
|
subchannel: null,
|
|
43
40
|
affiliateCode: null,
|
|
41
|
+
defaultAffiliateCode: null,
|
|
44
42
|
friendCode: null,
|
|
45
43
|
},
|
|
46
44
|
states: {
|
|
@@ -58,9 +56,28 @@ export default function (request) {
|
|
|
58
56
|
entry: ['setUA', 'setAgent', 'setPixel', 'setKPixel'],
|
|
59
57
|
invoke: {
|
|
60
58
|
src: 'fetchConfig',
|
|
59
|
+
onDone: [
|
|
60
|
+
{
|
|
61
|
+
target: 'getDefaultAffiliateCode',
|
|
62
|
+
actions: 'setConfig',
|
|
63
|
+
cond: 'isAffiliateCodeInstructionsEnable',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
target: 'idle',
|
|
67
|
+
actions: 'setConfig',
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
onError: {
|
|
71
|
+
target: 'idle',
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
getDefaultAffiliateCode: {
|
|
76
|
+
invoke: {
|
|
77
|
+
src: 'fetchDefaultAffiliateCode',
|
|
61
78
|
onDone: {
|
|
62
79
|
target: 'idle',
|
|
63
|
-
actions: '
|
|
80
|
+
actions: 'setDefaultAffiliateCode',
|
|
64
81
|
},
|
|
65
82
|
onError: {
|
|
66
83
|
target: 'idle',
|
|
@@ -183,6 +200,12 @@ export default function (request) {
|
|
|
183
200
|
layoutConfig: layoutConfigDecoded,
|
|
184
201
|
}
|
|
185
202
|
}),
|
|
203
|
+
setDefaultAffiliateCode: assign((context, event) => {
|
|
204
|
+
const { affiliateCode } = event.data
|
|
205
|
+
return {
|
|
206
|
+
defaultAffiliateCode: affiliateCode,
|
|
207
|
+
}
|
|
208
|
+
}),
|
|
186
209
|
setUA: assign((context, event) => {
|
|
187
210
|
const parser = new UAParser()
|
|
188
211
|
const userAgent = parser.getResult()
|
|
@@ -283,6 +306,13 @@ export default function (request) {
|
|
|
283
306
|
}
|
|
284
307
|
}),
|
|
285
308
|
},
|
|
309
|
+
guards: {
|
|
310
|
+
isAffiliateCodeInstructionsEnable: (context, event) => {
|
|
311
|
+
const { siteConfig } = event.data
|
|
312
|
+
const { registerBindingAffiliateCodeInstructionsEnable } = siteConfig || {}
|
|
313
|
+
return registerBindingAffiliateCodeInstructionsEnable ? JSON.parse(registerBindingAffiliateCodeInstructionsEnable) : false
|
|
314
|
+
},
|
|
315
|
+
},
|
|
286
316
|
services: {
|
|
287
317
|
fetchConfig: async (context, event) => {
|
|
288
318
|
const [site, layout] = await Promise.all([request.send(api.getConfig({ appSecret })), request.send(api.getLayoutConfig({ appSecret }))])
|
|
@@ -299,6 +329,9 @@ export default function (request) {
|
|
|
299
329
|
)
|
|
300
330
|
return { siteConfig: JSON.parse(decodeResult), layoutConfig: layout.config }
|
|
301
331
|
},
|
|
332
|
+
fetchDefaultAffiliateCode: async (context, event) => {
|
|
333
|
+
return await request.send(api.getDefaultAffiliateCode({ appSecret }))
|
|
334
|
+
},
|
|
302
335
|
fetchFeeds: async (context, event) => {
|
|
303
336
|
return await request.send(api.feeds({ appSecret }))
|
|
304
337
|
},
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { assign, createMachine } from 'xstate'
|
|
2
|
+
import game from '../api/game.js'
|
|
3
|
+
|
|
4
|
+
export default function (request, context) {
|
|
5
|
+
// const { appSecret } = request.config
|
|
6
|
+
// const { gameCode } = context
|
|
7
|
+
return createMachine(
|
|
8
|
+
{
|
|
9
|
+
id: 'game_replay',
|
|
10
|
+
initial: 'fetching',
|
|
11
|
+
context: {
|
|
12
|
+
gameReplayInfo: {},
|
|
13
|
+
},
|
|
14
|
+
states: {
|
|
15
|
+
fetching: {
|
|
16
|
+
invoke: {
|
|
17
|
+
src: 'fetchGameReplayInfo',
|
|
18
|
+
onDone: {
|
|
19
|
+
target: 'idle',
|
|
20
|
+
actions: 'setGameReplayInfo',
|
|
21
|
+
},
|
|
22
|
+
onError: {
|
|
23
|
+
target: 'idle',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
idle: {},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
actions: {
|
|
32
|
+
setGameReplayInfo: assign((context, event) => {
|
|
33
|
+
return {
|
|
34
|
+
gameReplayInfo: event.data.data,
|
|
35
|
+
}
|
|
36
|
+
}),
|
|
37
|
+
},
|
|
38
|
+
services: {
|
|
39
|
+
// 取得遊戲重播資訊
|
|
40
|
+
fetchGameReplayInfo: async (context, event) => {
|
|
41
|
+
return await request.send(game.getGameReplayInfo())
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
}
|
|
45
|
+
)
|
|
46
|
+
}
|