@jetthai/cuora 1.1.221 → 1.1.222

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,8 @@
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.222](https://github.com/jetthai/cuora-module/compare/v1.1.221...v1.1.222) (2024-02-01)
6
+
5
7
  ### [1.1.221](https://github.com/jetthai/cuora-module/compare/v1.1.220...v1.1.221) (2024-01-23)
6
8
 
7
9
  ### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.221",
3
+ "version": "1.1.222",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
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
+ getQuickLayout: ({ 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 }),
@@ -29,6 +29,7 @@ export default function (request) {
29
29
  },
30
30
  paymentMethods: {},
31
31
  },
32
+ quickConfig: [],
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: 'fetchSiteConfig',
60
+ src: 'fetchConfig',
60
61
  onDone: {
61
62
  target: 'idle',
62
- actions: 'setSiteConfig',
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
- setSiteConfig: assign((context, event) => {
162
- const { loginMethods = {}, registerMethods = {} } = event.data
162
+ setConfig: assign((context, event) => {
163
+ const { siteConfig, quickConfig } = event.data
164
+ const { loginMethods = {}, registerMethods = {} } = siteConfig
163
165
  return {
164
- siteConfig: { ...event.data, loginMethods: pickBy(loginMethods), registerMethods: pickBy(registerMethods) },
166
+ siteConfig: { ...siteConfig, loginMethods: pickBy(loginMethods), registerMethods: pickBy(registerMethods) },
167
+ quickConfig,
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
- fetchSiteConfig: async (context, event) => {
269
- const { config } = await request.send(api.getConfig({ appSecret }))
270
- return JSON.parse(window.atob(config))
271
+ fetchConfig: async (context, event) => {
272
+ const [config, quick] = await Promise.all([request.send(api.getConfig({ appSecret })), request.send(api.getQuickLayout({ appSecret }))])
273
+ return { siteConfig: JSON.parse(window.atob(config)), quickConfig: JSON.parse(window.atob(quick)) }
271
274
  },
272
275
  fetchFeeds: async (context, event) => {
273
276
  return await request.send(api.feeds({ appSecret }))