@jetthai/cuora 1.0.181 → 1.0.183

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.183](https://github.com/jetthai/cuora-module/compare/v1.0.182...v1.0.183) (2022-10-03)
6
+
7
+ ### [1.0.182](https://github.com/jetthai/cuora-module/compare/v1.0.181...v1.0.182) (2022-10-03)
8
+
5
9
  ### [1.0.181](https://github.com/jetthai/cuora-module/compare/v1.0.180...v1.0.181) (2022-09-29)
6
10
 
7
11
  ### [1.0.180](https://github.com/jetthai/cuora-module/compare/v1.0.179...v1.0.180) (2022-09-28)
package/dist/bundle.mjs CHANGED
@@ -67,6 +67,21 @@ var auth$1 = {
67
67
  isPublic: true,
68
68
  headers: { 'x-access-captcha': reCaptchaToken },
69
69
  }),
70
+ loginApp: ({ id, provider, displayName, pictureUrl, accessToken }) => ({
71
+ url: 'appLogin',
72
+ method: 'post',
73
+ params: {
74
+ provider,
75
+ data: {
76
+ id,
77
+ provider,
78
+ displayName,
79
+ pictureUrl,
80
+ accessToken,
81
+ },
82
+ },
83
+ isPublic: true,
84
+ }),
70
85
  register: ({ channel = 'official', subchannel = 'pwa', reCaptchaToken, dt, ...rest }) => ({
71
86
  url: `register?channel=${channel}&subchannel=${subchannel}`,
72
87
  method: 'post',
@@ -10161,6 +10176,19 @@ function auth (request) {
10161
10176
  },
10162
10177
  },
10163
10178
  },
10179
+ authenticationApp: {
10180
+ invoke: {
10181
+ src: 'authenticateApp',
10182
+ onDone: {
10183
+ target: 'authenticated',
10184
+ actions: ['setToken'],
10185
+ },
10186
+ onError: {
10187
+ target: 'idle',
10188
+ actions: 'removeToken',
10189
+ },
10190
+ },
10191
+ },
10164
10192
  authenticated: {
10165
10193
  invoke: {
10166
10194
  src: 'fetchUserInfo',
@@ -10273,6 +10301,9 @@ function auth (request) {
10273
10301
  LOGIN_3PARTY: {
10274
10302
  actions: 'redirectTo3Party',
10275
10303
  },
10304
+ LOGIN_APP: {
10305
+ actions: '.authenticationApp'
10306
+ },
10276
10307
  SET_PLAY: {
10277
10308
  actions: 'setPlay',
10278
10309
  },
@@ -10431,6 +10462,10 @@ function auth (request) {
10431
10462
  }),
10432
10463
  },
10433
10464
  services: {
10465
+ authenticateApp: async (context, event) => {
10466
+ const { token } = await request.send(auth$1.loginApp(event.data));
10467
+ return token
10468
+ },
10434
10469
  authenticate: async (context, event) => {
10435
10470
  const data = { ...context.loginData, reCaptchaToken: context.reCaptchaToken };
10436
10471
  const { token } = await request.send(auth$1.login(data));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.0.181",
3
+ "version": "1.0.183",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
package/src/api/auth.js CHANGED
@@ -11,6 +11,21 @@ export default {
11
11
  isPublic: true,
12
12
  headers: { 'x-access-captcha': reCaptchaToken },
13
13
  }),
14
+ loginApp: ({ id, provider, displayName, pictureUrl, accessToken }) => ({
15
+ url: 'appLogin',
16
+ method: 'post',
17
+ params: {
18
+ provider,
19
+ data: {
20
+ id,
21
+ provider,
22
+ displayName,
23
+ pictureUrl,
24
+ accessToken,
25
+ },
26
+ },
27
+ isPublic: true,
28
+ }),
14
29
  register: ({ channel = 'official', subchannel = 'pwa', reCaptchaToken, dt, ...rest }) => ({
15
30
  url: `register?channel=${channel}&subchannel=${subchannel}`,
16
31
  method: 'post',
@@ -67,6 +67,19 @@ export default function (request) {
67
67
  },
68
68
  },
69
69
  },
70
+ authenticationApp: {
71
+ invoke: {
72
+ src: 'authenticateApp',
73
+ onDone: {
74
+ target: 'authenticated',
75
+ actions: ['setToken'],
76
+ },
77
+ onError: {
78
+ target: 'idle',
79
+ actions: 'removeToken',
80
+ },
81
+ },
82
+ },
70
83
  authenticated: {
71
84
  invoke: {
72
85
  src: 'fetchUserInfo',
@@ -179,6 +192,9 @@ export default function (request) {
179
192
  LOGIN_3PARTY: {
180
193
  actions: 'redirectTo3Party',
181
194
  },
195
+ LOGIN_APP: {
196
+ actions: '.authenticationApp'
197
+ },
182
198
  SET_PLAY: {
183
199
  actions: 'setPlay',
184
200
  },
@@ -337,6 +353,10 @@ export default function (request) {
337
353
  }),
338
354
  },
339
355
  services: {
356
+ authenticateApp: async (context, event) => {
357
+ const { token } = await request.send(auth.loginApp(event.data))
358
+ return token
359
+ },
340
360
  authenticate: async (context, event) => {
341
361
  const data = { ...context.loginData, reCaptchaToken: context.reCaptchaToken }
342
362
  const { token } = await request.send(auth.login(data))