@jetthai/cuora 1.0.168-1 → 1.0.168-2

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,8 @@
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
+
5
7
  ### [1.0.168-1](https://github.com/jetthai/cuora-module/compare/v1.0.168...v1.0.168-1) (2022-09-23)
6
8
 
7
9
  ### [1.0.168](https://github.com/jetthai/cuora-module/compare/v1.0.167...v1.0.168) (2022-09-12)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.0.168-1",
3
+ "version": "1.0.168-2",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -11,6 +11,7 @@ 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'
14
15
  const accountPhoneKey = 'account_phone'
15
16
  const accountEmailKey = 'account_email'
16
17
  const cookies = new Cookies()
@@ -31,6 +32,7 @@ export default function (request) {
31
32
  username: null,
32
33
  password: null,
33
34
  },
35
+ countryAbbr: null,
34
36
  userInfo: {},
35
37
  redirectURL: null,
36
38
  reCaptchaToken: null,
@@ -209,7 +211,7 @@ export default function (request) {
209
211
  }
210
212
  }),
211
213
  setLoginPhone: assign((context, event) => {
212
- const { countryCode, phone, password } = event.data
214
+ const { countryCode, countryAbbr, phone, password } = event.data
213
215
  return {
214
216
  loginData: {
215
217
  provider: 'phone',
@@ -217,6 +219,7 @@ export default function (request) {
217
219
  phone,
218
220
  password,
219
221
  },
222
+ countryAbbr,
220
223
  }
221
224
  }),
222
225
  setLoginEmail: assign((context, event) => {
@@ -261,12 +264,17 @@ export default function (request) {
261
264
  setAccount: assign((context, event) => {
262
265
  if (context.loginData.phone) {
263
266
  cookies.remove(accountEmailKey)
264
- cookies.set(accountPhoneKey, `0${context.loginData.phone}`, {
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}`, {
265
272
  path: '/',
266
273
  maxAge: 60 * 60 * 24 * 7,
267
274
  })
268
275
  } else if (context.loginData.email) {
269
276
  cookies.remove(accountPhoneKey)
277
+ cookies.remove(phoneCountryCode)
270
278
  cookies.set(accountEmailKey, context.loginData.email, {
271
279
  path: '/',
272
280
  maxAge: 60 * 60 * 24 * 7,
@@ -306,14 +314,14 @@ export default function (request) {
306
314
  const redirectURL = urljoin(
307
315
  request.config.fullURL,
308
316
  'login?' +
309
- new URLSearchParams({
310
- provider,
311
- redirectURI: `${window.location.protocol}//${window.location.host}`,
312
- channel: cookies.get('channel') || channel || defaultChannel || 'official',
313
- subchannel: cookies.get('subchannel') || subchannel || defaultSubchannel || 'pwa',
314
- // dt,
315
- platform: 'pwa',
316
- }).toString()
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()
317
325
  )
318
326
  window.location.href = redirectURL
319
327
  },