@jetthai/cuora 1.0.82 → 1.0.84
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/index.js +2 -1
- package/src/machine/auth.js +10 -4
- package/src/util/index.js +3 -0
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.84](https://github.com/jetthai/cuora-module/compare/v1.0.83...v1.0.84) (2022-01-20)
|
|
6
|
+
|
|
7
|
+
### [1.0.83](https://github.com/jetthai/cuora-module/compare/v1.0.82...v1.0.83) (2022-01-18)
|
|
8
|
+
|
|
5
9
|
### [1.0.82](https://github.com/jetthai/cuora-module/compare/v1.0.81...v1.0.82) (2022-01-18)
|
|
6
10
|
|
|
7
11
|
### [1.0.81](https://github.com/jetthai/cuora-module/compare/v1.0.80...v1.0.81) (2022-01-18)
|
package/package.json
CHANGED
package/src/index.js
CHANGED
package/src/machine/auth.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import urljoin from 'url-join'
|
|
2
2
|
import Cookies from 'universal-cookie'
|
|
3
3
|
import qs from 'qs'
|
|
4
|
+
import omitBy from 'lodash/omitBy'
|
|
5
|
+
import isNull from 'lodash/isNull'
|
|
6
|
+
import isUndefined from 'lodash/isUndefined'
|
|
4
7
|
import { assign, createMachine, send } from 'xstate'
|
|
5
8
|
import auth from '../api/auth'
|
|
6
9
|
import user from '../api/user'
|
|
@@ -246,16 +249,19 @@ export default function (request) {
|
|
|
246
249
|
return { token }
|
|
247
250
|
}),
|
|
248
251
|
redirectTo3Party: async (context, event) => {
|
|
249
|
-
const { provider, channel
|
|
252
|
+
const { provider, channel, subchannel } = event.data
|
|
250
253
|
const dt = await getDeviceToken(fpToken)
|
|
254
|
+
const redirectParams = omitBy(omitBy({ channel, subchannel }, isUndefined), isNull)
|
|
255
|
+
const query = new URLSearchParams(redirectParams).toString()
|
|
256
|
+
const redirectURI = urljoin(`${window.location.protocol}//${window.location.host}`, query ? `?${query}` : '')
|
|
251
257
|
const redirectURL = urljoin(
|
|
252
258
|
request.config.fullURL,
|
|
253
259
|
'login?' +
|
|
254
260
|
qs.stringify({
|
|
255
261
|
provider,
|
|
256
|
-
redirectURI
|
|
257
|
-
channel,
|
|
258
|
-
subchannel,
|
|
262
|
+
redirectURI,
|
|
263
|
+
channel: channel || 'official',
|
|
264
|
+
subchannel: subchannel || 'pwa',
|
|
259
265
|
dt,
|
|
260
266
|
platform: 'pwa',
|
|
261
267
|
})
|