@jetthai/cuora 1.0.168-2 → 1.0.168

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,10 +2,6 @@
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.168-2](https://github.com/jetthai/cuora-module/compare/v1.0.168-1...v1.0.168-2) (2022-09-26)
6
-
7
- ### [1.0.168-1](https://github.com/jetthai/cuora-module/compare/v1.0.168...v1.0.168-1) (2022-09-23)
8
-
9
5
  ### [1.0.168](https://github.com/jetthai/cuora-module/compare/v1.0.167...v1.0.168) (2022-09-12)
10
6
 
11
7
  ### [1.0.167](https://github.com/jetthai/cuora-module/compare/v1.0.166...v1.0.167) (2022-09-07)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.0.168-2",
3
+ "version": "1.0.168",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -11,7 +11,6 @@ export default function (request) {
11
11
  const { clientId, fpToken, sentry, defaultChannel, defaultSubchannel } = request.config
12
12
  const tokenKey = `cuora_${clientId}`
13
13
  const userKey = `cuora_tempuser`
14
- const phoneCountryCode = 'phone_countrycode'
15
14
  const accountPhoneKey = 'account_phone'
16
15
  const accountEmailKey = 'account_email'
17
16
  const cookies = new Cookies()
@@ -32,7 +31,6 @@ export default function (request) {
32
31
  username: null,
33
32
  password: null,
34
33
  },
35
- countryAbbr: null,
36
34
  userInfo: {},
37
35
  redirectURL: null,
38
36
  reCaptchaToken: null,
@@ -41,6 +39,23 @@ export default function (request) {
41
39
  idle: {
42
40
  entry: 'fetchToken',
43
41
  always: [{ target: 'authenticated', cond: 'hasToken' }],
42
+ on: {
43
+ LOGIN_GUEST: {
44
+ target: 'authenticationGuest',
45
+ },
46
+ LOGIN_PHONE: {
47
+ target: 'authentication',
48
+ actions: ['setReCaptchaToken', 'setLoginPhone'],
49
+ },
50
+ LOGIN_EMAIL: {
51
+ target: 'authentication',
52
+ actions: ['setReCaptchaToken', 'setLoginEmail'],
53
+ },
54
+ LOGIN_LOCAL: {
55
+ target: 'authentication',
56
+ actions: 'setLoginLocal',
57
+ },
58
+ },
44
59
  },
45
60
  authentication: {
46
61
  invoke: {
@@ -162,21 +177,6 @@ export default function (request) {
162
177
  CLEAR: {
163
178
  target: '.logout',
164
179
  },
165
- LOGIN_GUEST: {
166
- target: '.authenticationGuest',
167
- },
168
- LOGIN_PHONE: {
169
- target: '.authentication',
170
- actions: ['setReCaptchaToken', 'setLoginPhone'],
171
- },
172
- LOGIN_EMAIL: {
173
- target: '.authentication',
174
- actions: ['setReCaptchaToken', 'setLoginEmail'],
175
- },
176
- LOGIN_LOCAL: {
177
- target: '.authentication',
178
- actions: 'setLoginLocal',
179
- },
180
180
  LOGIN_3PARTY: {
181
181
  actions: 'redirectTo3Party',
182
182
  },
@@ -211,7 +211,7 @@ export default function (request) {
211
211
  }
212
212
  }),
213
213
  setLoginPhone: assign((context, event) => {
214
- const { countryCode, countryAbbr, phone, password } = event.data
214
+ const { countryCode, phone, password } = event.data
215
215
  return {
216
216
  loginData: {
217
217
  provider: 'phone',
@@ -219,7 +219,6 @@ export default function (request) {
219
219
  phone,
220
220
  password,
221
221
  },
222
- countryAbbr,
223
222
  }
224
223
  }),
225
224
  setLoginEmail: assign((context, event) => {
@@ -264,17 +263,12 @@ export default function (request) {
264
263
  setAccount: assign((context, event) => {
265
264
  if (context.loginData.phone) {
266
265
  cookies.remove(accountEmailKey)
267
- cookies.set(accountPhoneKey, `${context.loginData.phone}`, {
268
- path: '/',
269
- maxAge: 60 * 60 * 24 * 7,
270
- })
271
- cookies.set(phoneCountryCode, `${context.countryAbbr}_${context.loginData.countryCode}`, {
266
+ cookies.set(accountPhoneKey, `0${context.loginData.phone}`, {
272
267
  path: '/',
273
268
  maxAge: 60 * 60 * 24 * 7,
274
269
  })
275
270
  } else if (context.loginData.email) {
276
271
  cookies.remove(accountPhoneKey)
277
- cookies.remove(phoneCountryCode)
278
272
  cookies.set(accountEmailKey, context.loginData.email, {
279
273
  path: '/',
280
274
  maxAge: 60 * 60 * 24 * 7,
@@ -314,14 +308,14 @@ export default function (request) {
314
308
  const redirectURL = urljoin(
315
309
  request.config.fullURL,
316
310
  'login?' +
317
- new URLSearchParams({
318
- provider,
319
- redirectURI: `${window.location.protocol}//${window.location.host}`,
320
- channel: cookies.get('channel') || channel || defaultChannel || 'official',
321
- subchannel: cookies.get('subchannel') || subchannel || defaultSubchannel || 'pwa',
322
- // dt,
323
- platform: 'pwa',
324
- }).toString()
311
+ new URLSearchParams({
312
+ provider,
313
+ redirectURI: `${window.location.protocol}//${window.location.host}`,
314
+ channel: cookies.get('channel') || channel || defaultChannel || 'official',
315
+ subchannel: cookies.get('subchannel') || subchannel || defaultSubchannel || 'pwa',
316
+ // dt,
317
+ platform: 'pwa',
318
+ }).toString()
325
319
  )
326
320
  window.location.href = redirectURL
327
321
  },