@jetthai/cuora 1.0.127 → 1.0.129

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.129](https://github.com/jetthai/cuora-module/compare/v1.0.128...v1.0.129) (2022-05-31)
6
+
7
+ ### [1.0.128](https://github.com/jetthai/cuora-module/compare/v1.0.127...v1.0.128) (2022-05-27)
8
+
5
9
  ### [1.0.127](https://github.com/jetthai/cuora-module/compare/v1.0.125...v1.0.127) (2022-05-26)
6
10
 
7
11
  ### [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.129",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
@@ -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,9 @@ 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
137
135
  return {
138
- siteConfig: { ...event.data, loginMethods: methods },
136
+ siteConfig: { ...event.data, loginMethods: pickBy(loginMethods), registerMethods: pickBy(registerMethods) },
139
137
  }
140
138
  }),
141
139
  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,10 @@ export default function (request) {
53
57
  SELECT_AMOUNT: {
54
58
  actions: 'addAmount',
55
59
  },
60
+ KEY_IN: {
61
+ target: 'calculable',
62
+ actions: 'setAmount'
63
+ },
56
64
  CALCULATE: {
57
65
  target: 'calculating',
58
66
  },
@@ -79,6 +87,10 @@ export default function (request) {
79
87
  target: 'calculable',
80
88
  actions: 'addAmount',
81
89
  },
90
+ KEY_IN: {
91
+ target: 'calculable',
92
+ actions: 'setAmount'
93
+ },
82
94
  CONFIRM: {
83
95
  target: 'submitting',
84
96
  },
@@ -143,6 +155,9 @@ export default function (request) {
143
155
  addAmount: assign((context, event) => {
144
156
  return { selectedAmount: (context.selectedAmount || 0) + event.data }
145
157
  }),
158
+ setAmount: assign((context, event) => {
159
+ return { selectedAmount: event.data }
160
+ }),
146
161
  setCalculation: assign((context, event) => {
147
162
  return {
148
163
  calculation: event.data,
@@ -159,9 +174,6 @@ export default function (request) {
159
174
  }
160
175
  }),
161
176
  },
162
- guards: {
163
- isSubmittable: (context, event) => {},
164
- },
165
177
  services: {
166
178
  fetchInitData: async (context, event) => {
167
179
  return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
@@ -173,9 +173,6 @@ export default function (request) {
173
173
  }
174
174
  }),
175
175
  },
176
- guards: {
177
- isSubmittable: (context, event) => { },
178
- },
179
176
  services: {
180
177
  fetchInitData: async (context, event) => {
181
178
  return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))