@jetthai/cuora 1.0.127 → 1.0.128

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.128](https://github.com/jetthai/cuora-module/compare/v1.0.127...v1.0.128) (2022-05-27)
6
+
5
7
  ### [1.0.127](https://github.com/jetthai/cuora-module/compare/v1.0.125...v1.0.127) (2022-05-26)
6
8
 
7
9
  ### [1.0.126](https://github.com/jetthai/cuora-module/compare/v1.0.123...v1.0.126) (2022-05-26)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.0.127",
3
+ "version": "1.0.128",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
@@ -283,14 +283,14 @@ export default function (request) {
283
283
  const redirectURL = urljoin(
284
284
  request.config.fullURL,
285
285
  'login?' +
286
- qs.stringify({
287
- provider,
288
- redirectURI: `${window.location.protocol}//${window.location.host}`,
289
- channel: cookies.get('channel') || channel || 'official',
290
- subchannel: cookies.get('subchannel') || subchannel || 'pwa',
291
- // dt,
292
- platform: 'pwa',
293
- })
286
+ qs.stringify({
287
+ provider,
288
+ redirectURI: `${window.location.protocol}//${window.location.host}`,
289
+ channel: cookies.get('channel') || channel || 'official',
290
+ subchannel: cookies.get('subchannel') || subchannel || 'pwa',
291
+ // dt,
292
+ platform: 'pwa',
293
+ })
294
294
  )
295
295
  window.location.href = redirectURL
296
296
  },
@@ -1,6 +1,7 @@
1
1
  import UAParser from 'ua-parser-js'
2
2
  import Cookies from 'universal-cookie'
3
3
  import { assign, createMachine } from 'xstate'
4
+ import pickBy from 'lodash/pickBy'
4
5
  import api from '../api/common'
5
6
  const cookies = new Cookies()
6
7
 
@@ -130,12 +131,10 @@ export default function (request) {
130
131
  },
131
132
  actions: {
132
133
  setSiteConfig: assign((context, event) => {
133
- let methods = event.data?.loginMethods || {}
134
- Object.keys(methods).forEach((key) => {
135
- if (!methods[key]) delete methods[key]
136
- })
134
+ const { loginMethods = {}, registerMethods = {} } = event.data
135
+ console.log(event.data)
137
136
  return {
138
- siteConfig: { ...event.data, loginMethods: methods },
137
+ siteConfig: { ...event.data, loginMethods: pickBy(loginMethods), registerMethods: pickBy(registerMethods) },
139
138
  }
140
139
  }),
141
140
  setUA: assign((context, event) => {
@@ -46,8 +46,8 @@ export default function (request) {
46
46
  },
47
47
  KEY_IN: {
48
48
  target: 'calculable',
49
- actions: 'setAmount'
50
- }
49
+ actions: 'setAmount',
50
+ },
51
51
  },
52
52
  },
53
53
  fail: {},
@@ -58,7 +58,7 @@ export default function (request) {
58
58
  actions: 'addAmount',
59
59
  },
60
60
  KEY_IN: {
61
- actions: 'setAmount'
61
+ actions: 'setAmount',
62
62
  },
63
63
  CALCULATE: {
64
64
  target: 'calculating',
@@ -88,7 +88,7 @@ export default function (request) {
88
88
  },
89
89
  KEY_IN: {
90
90
  target: 'calculable',
91
- actions: 'setAmount'
91
+ actions: 'setAmount',
92
92
  },
93
93
  CONFIRM: {
94
94
  target: 'submitting',
@@ -174,7 +174,7 @@ export default function (request) {
174
174
  }),
175
175
  },
176
176
  guards: {
177
- isSubmittable: (context, event) => { },
177
+ isSubmittable: (context, event) => {},
178
178
  },
179
179
  services: {
180
180
  fetchInitData: async (context, event) => {
@@ -9,7 +9,7 @@ export default function (request) {
9
9
  type: 'parallel',
10
10
  context: {
11
11
  rewardList: [],
12
- callback: () => { },
12
+ callback: () => {},
13
13
  },
14
14
  states: {
15
15
  timer: {
@@ -75,7 +75,7 @@ export default function (request) {
75
75
  }),
76
76
  setCallback: assign((context, event) => {
77
77
  return {
78
- callback: event.data?.callback || (() => { }),
78
+ callback: event.data?.callback || (() => {}),
79
79
  }
80
80
  }),
81
81
  doCallback: (context, event) => {