@jetthai/cuora 1.0.88 → 1.0.90

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.0.90](https://github.com/jetthai/cuora-module/compare/v1.0.89...v1.0.90) (2022-02-14)
6
+
7
+ ### [1.0.89](https://github.com/jetthai/cuora-module/compare/v1.0.88...v1.0.89) (2022-02-14)
8
+
5
9
  ### [1.0.88](https://github.com/jetthai/cuora-module/compare/v1.0.87...v1.0.88) (2022-02-10)
6
10
 
7
11
  ### [1.0.87](https://github.com/jetthai/cuora-module/compare/v1.0.86...v1.0.87) (2022-02-09)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.0.88",
3
+ "version": "1.0.90",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
@@ -251,7 +251,8 @@ export default function (request) {
251
251
  }),
252
252
  redirectTo3Party: async (context, event) => {
253
253
  const { provider, channel, subchannel } = event.data
254
- const dt = await getDeviceToken({ fpToken, sentry })
254
+ const endpoint = request.config.apiURL.replace('fnapi', 'fp')
255
+ const dt = await getDeviceToken({ fpToken, sentry, endpoint })
255
256
  const redirectParams = omitBy(omitBy({ channel, subchannel }, isUndefined), isNull)
256
257
  const query = new URLSearchParams(redirectParams).toString()
257
258
  const redirectURI = urljoin(`${window.location.protocol}//${window.location.host}`, query ? `?${query}` : '')
@@ -277,7 +278,8 @@ export default function (request) {
277
278
  },
278
279
  services: {
279
280
  authenticate: async (context, event) => {
280
- const dt = await getDeviceToken({ fpToken, sentry })
281
+ const endpoint = request.config.apiURL.replace('fnapi', 'fp')
282
+ const dt = await getDeviceToken({ fpToken, sentry, endpoint })
281
283
  const data = { ...context.loginData, dt }
282
284
  const { token } = await request.send(auth.login(data))
283
285
  return token
@@ -91,7 +91,8 @@ export default function (request) {
91
91
  services: {
92
92
  signUp: async (context, event) => {
93
93
  const { email, password, channel, subchannel } = context
94
- const dt = await getDeviceToken({ fpToken, sentry })
94
+ const endpoint = request.config.apiURL.replace('fnapi', 'fp')
95
+ const dt = await getDeviceToken({ fpToken, sentry, endpoint })
95
96
  return await request.send(auth.register({ provider: 'email', email, password, channel, subchannel, dt }))
96
97
  },
97
98
  },
@@ -1,9 +1,9 @@
1
1
  import FingerprintJS from '@fingerprintjs/fingerprintjs-pro'
2
2
 
3
- const getDeviceToken = async ({ fpToken, sentry }) => {
3
+ const getDeviceToken = async ({ fpToken, sentry, endpoint }) => {
4
4
  let dt
5
5
  try {
6
- const fp = await FingerprintJS.load({ token: fpToken })
6
+ const fp = await FingerprintJS.load({ token: fpToken, endpoint })
7
7
  const result = await fp.get()
8
8
  dt = result.visitorId
9
9
 
@@ -11,10 +11,10 @@ const getDeviceToken = async ({ fpToken, sentry }) => {
11
11
  throw new Error('[Device Token] No token from FingerprintJS.')
12
12
  }
13
13
 
14
- console.log('[Device Token]', dt)
14
+ console.log('[Device Token]', `${dt} from ${endpoint}`)
15
15
  } catch (error) {
16
+ console.error('[Device Token]', `${dt} from ${endpoint}`)
16
17
  sentry?.captureException(error)
17
- console.log(error)
18
18
  } finally {
19
19
  return dt
20
20
  }