@jetthai/cuora 1.0.125 → 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,12 @@
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
+
7
+ ### [1.0.127](https://github.com/jetthai/cuora-module/compare/v1.0.125...v1.0.127) (2022-05-26)
8
+
9
+ ### [1.0.126](https://github.com/jetthai/cuora-module/compare/v1.0.123...v1.0.126) (2022-05-26)
10
+
5
11
  ### [1.0.125](https://github.com/jetthai/cuora-module/compare/v1.0.124...v1.0.125) (2022-05-26)
6
12
 
7
13
  ### [1.0.124](https://github.com/jetthai/cuora-module/compare/v1.0.123...v1.0.124) (2022-05-26)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.0.125",
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) => {
@@ -44,6 +44,10 @@ export default function (request) {
44
44
  target: 'calculable',
45
45
  actions: 'addAmount',
46
46
  },
47
+ KEY_IN: {
48
+ target: 'calculable',
49
+ actions: 'setAmount',
50
+ },
47
51
  },
48
52
  },
49
53
  fail: {},
@@ -53,6 +57,9 @@ export default function (request) {
53
57
  SELECT_AMOUNT: {
54
58
  actions: 'addAmount',
55
59
  },
60
+ KEY_IN: {
61
+ actions: 'setAmount',
62
+ },
56
63
  CALCULATE: {
57
64
  target: 'calculating',
58
65
  },
@@ -79,6 +86,10 @@ export default function (request) {
79
86
  target: 'calculable',
80
87
  actions: 'addAmount',
81
88
  },
89
+ KEY_IN: {
90
+ target: 'calculable',
91
+ actions: 'setAmount',
92
+ },
82
93
  CONFIRM: {
83
94
  target: 'submitting',
84
95
  },
@@ -143,6 +154,9 @@ export default function (request) {
143
154
  addAmount: assign((context, event) => {
144
155
  return { selectedAmount: (context.selectedAmount || 0) + event.data }
145
156
  }),
157
+ setAmount: assign((context, event) => {
158
+ return { selectedAmount: event.data }
159
+ }),
146
160
  setCalculation: assign((context, event) => {
147
161
  return {
148
162
  calculation: event.data,
@@ -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) => {