@jetthai/cuora 1.1.225 → 1.1.227

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,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.1.227](https://github.com/jetthai/cuora-module/compare/v1.1.226...v1.1.227) (2024-02-26)
6
+
7
+ ### [1.1.226](https://github.com/jetthai/cuora-module/compare/v1.1.225...v1.1.226) (2024-02-26)
8
+
5
9
  ### [1.1.225](https://github.com/jetthai/cuora-module/compare/v1.1.221-layout-1...v1.1.225) (2024-02-07)
6
10
 
7
11
  ### [1.1.224](https://github.com/jetthai/cuora-module/compare/v1.1.222...v1.1.224) (2024-02-02)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.225",
3
+ "version": "1.1.227",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -162,9 +162,24 @@ export default function (request) {
162
162
  setConfig: assign((context, event) => {
163
163
  const { siteConfig, layoutConfig } = event.data
164
164
  const { loginMethods = {}, registerMethods = {} } = siteConfig
165
+ let layoutConfigDecoded = ''
166
+
167
+ if (layoutConfig) {
168
+ const base64Url = layoutConfig.split('.')[0]
169
+ const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/')
170
+ layoutConfigDecoded = decodeURIComponent(
171
+ window
172
+ .atob(base64)
173
+ .split('')
174
+ .map((c) => {
175
+ return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2)
176
+ })
177
+ .join('')
178
+ )
179
+ }
165
180
  return {
166
181
  siteConfig: { ...siteConfig, loginMethods: pickBy(loginMethods), registerMethods: pickBy(registerMethods) },
167
- layoutConfig,
182
+ layoutConfig: layoutConfigDecoded,
168
183
  }
169
184
  }),
170
185
  setUA: assign((context, event) => {
@@ -270,7 +285,7 @@ export default function (request) {
270
285
  services: {
271
286
  fetchConfig: async (context, event) => {
272
287
  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)) }
288
+ return { siteConfig: JSON.parse(window.atob(site.config)), layoutConfig: layout.config }
274
289
  },
275
290
  fetchFeeds: async (context, event) => {
276
291
  return await request.send(api.feeds({ appSecret }))