@jetthai/cuora 1.1.224 → 1.1.225
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 +6 -0
- package/package.json +1 -1
- package/src/api/common.js +1 -0
- package/src/machine/common.js +11 -8
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
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.225](https://github.com/jetthai/cuora-module/compare/v1.1.221-layout-1...v1.1.225) (2024-02-07)
|
|
6
|
+
|
|
7
|
+
### [1.1.224](https://github.com/jetthai/cuora-module/compare/v1.1.222...v1.1.224) (2024-02-02)
|
|
8
|
+
|
|
9
|
+
### [1.1.222](https://github.com/jetthai/cuora-module/compare/v1.1.221-layout...v1.1.222) (2024-02-02)
|
|
10
|
+
|
|
5
11
|
### [1.1.224](https://github.com/jetthai/cuora-module/compare/v1.1.222...v1.1.224) (2024-02-02)
|
|
6
12
|
|
|
7
13
|
### [1.1.222](https://github.com/jetthai/cuora-module/compare/v1.1.221...v1.1.222) (2024-02-02)
|
package/package.json
CHANGED
package/src/api/common.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
getConfig: ({ appSecret }) => ({ url: 'getConfig', method: 'get', params: { appSecret }, isPublic: true }),
|
|
3
|
+
getLayoutConfig: ({ appSecret }) => ({ url: 'getQuickLayout', method: 'get', params: { appSecret }, isPublic: true }),
|
|
3
4
|
feeds: ({ appSecret }) => ({ url: 'feeds', method: 'get', params: { appSecret }, isPublic: true }),
|
|
4
5
|
broadcast: () => ({ url: 'broadcast', method: 'get', isPublic: true }),
|
|
5
6
|
getAnnouncements: ({ appSecret }) => ({ url: 'getAnnouncements', params: { appSecret }, method: 'get', isPublic: true }),
|
package/src/machine/common.js
CHANGED
|
@@ -29,6 +29,7 @@ export default function (request) {
|
|
|
29
29
|
},
|
|
30
30
|
paymentMethods: {},
|
|
31
31
|
},
|
|
32
|
+
layoutConfig: null,
|
|
32
33
|
userAgent: '',
|
|
33
34
|
isMobile: false,
|
|
34
35
|
announcementList: null,
|
|
@@ -56,10 +57,10 @@ export default function (request) {
|
|
|
56
57
|
fetching: {
|
|
57
58
|
entry: ['setUA', 'setAgent', 'setPixel', 'setKPixel'],
|
|
58
59
|
invoke: {
|
|
59
|
-
src: '
|
|
60
|
+
src: 'fetchConfig',
|
|
60
61
|
onDone: {
|
|
61
62
|
target: 'idle',
|
|
62
|
-
actions: '
|
|
63
|
+
actions: 'setConfig',
|
|
63
64
|
},
|
|
64
65
|
onError: {
|
|
65
66
|
target: 'idle',
|
|
@@ -158,10 +159,12 @@ export default function (request) {
|
|
|
158
159
|
},
|
|
159
160
|
},
|
|
160
161
|
actions: {
|
|
161
|
-
|
|
162
|
-
const {
|
|
162
|
+
setConfig: assign((context, event) => {
|
|
163
|
+
const { siteConfig, layoutConfig } = event.data
|
|
164
|
+
const { loginMethods = {}, registerMethods = {} } = siteConfig
|
|
163
165
|
return {
|
|
164
|
-
siteConfig: { ...
|
|
166
|
+
siteConfig: { ...siteConfig, loginMethods: pickBy(loginMethods), registerMethods: pickBy(registerMethods) },
|
|
167
|
+
layoutConfig,
|
|
165
168
|
}
|
|
166
169
|
}),
|
|
167
170
|
setUA: assign((context, event) => {
|
|
@@ -265,9 +268,9 @@ export default function (request) {
|
|
|
265
268
|
}),
|
|
266
269
|
},
|
|
267
270
|
services: {
|
|
268
|
-
|
|
269
|
-
const
|
|
270
|
-
return JSON.parse(window.atob(config))
|
|
271
|
+
fetchConfig: async (context, event) => {
|
|
272
|
+
const [site, layout] = await Promise.all([request.send(api.getConfig({ appSecret })), request.send(api.getLayoutConfig({ appSecret }))])
|
|
273
|
+
return { siteConfig: JSON.parse(window.atob(site.config)), layoutConfig: JSON.parse(window.atob(layout.config)) }
|
|
271
274
|
},
|
|
272
275
|
fetchFeeds: async (context, event) => {
|
|
273
276
|
return await request.send(api.feeds({ appSecret }))
|