@jetthai/cuora 1.0.166 → 1.0.168-1

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.168-1](https://github.com/jetthai/cuora-module/compare/v1.0.168...v1.0.168-1) (2022-09-23)
6
+
7
+ ### [1.0.168](https://github.com/jetthai/cuora-module/compare/v1.0.167...v1.0.168) (2022-09-12)
8
+
9
+ ### [1.0.167](https://github.com/jetthai/cuora-module/compare/v1.0.166...v1.0.167) (2022-09-07)
10
+
5
11
  ### [1.0.166](https://github.com/jetthai/cuora-module/compare/v1.0.165...v1.0.166) (2022-09-07)
6
12
 
7
13
  ### [1.0.165](https://github.com/jetthai/cuora-module/compare/v1.0.164...v1.0.165) (2022-09-02)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.0.166",
3
+ "version": "1.0.168-1",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -39,23 +39,6 @@ export default function (request) {
39
39
  idle: {
40
40
  entry: 'fetchToken',
41
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
- },
59
42
  },
60
43
  authentication: {
61
44
  invoke: {
@@ -177,6 +160,21 @@ export default function (request) {
177
160
  CLEAR: {
178
161
  target: '.logout',
179
162
  },
163
+ LOGIN_GUEST: {
164
+ target: '.authenticationGuest',
165
+ },
166
+ LOGIN_PHONE: {
167
+ target: '.authentication',
168
+ actions: ['setReCaptchaToken', 'setLoginPhone'],
169
+ },
170
+ LOGIN_EMAIL: {
171
+ target: '.authentication',
172
+ actions: ['setReCaptchaToken', 'setLoginEmail'],
173
+ },
174
+ LOGIN_LOCAL: {
175
+ target: '.authentication',
176
+ actions: 'setLoginLocal',
177
+ },
180
178
  LOGIN_3PARTY: {
181
179
  actions: 'redirectTo3Party',
182
180
  },
@@ -262,11 +260,13 @@ export default function (request) {
262
260
  }),
263
261
  setAccount: assign((context, event) => {
264
262
  if (context.loginData.phone) {
263
+ cookies.remove(accountEmailKey)
265
264
  cookies.set(accountPhoneKey, `0${context.loginData.phone}`, {
266
265
  path: '/',
267
266
  maxAge: 60 * 60 * 24 * 7,
268
267
  })
269
268
  } else if (context.loginData.email) {
269
+ cookies.remove(accountPhoneKey)
270
270
  cookies.set(accountEmailKey, context.loginData.email, {
271
271
  path: '/',
272
272
  maxAge: 60 * 60 * 24 * 7,
@@ -20,13 +20,13 @@ export default function (request) {
20
20
  },
21
21
  states: {
22
22
  loading: {
23
- initial: 'step1',
23
+ initial: 'init',
24
24
  states: {
25
- step1: {
25
+ init: {
26
26
  invoke: {
27
27
  src: 'fetchInitData',
28
28
  onDone: {
29
- target: 'step2',
29
+ target: 'fetching',
30
30
  actions: 'setInitData',
31
31
  },
32
32
  onError: {
@@ -34,7 +34,7 @@ export default function (request) {
34
34
  },
35
35
  },
36
36
  },
37
- step2: {
37
+ fetching: {
38
38
  invoke: {
39
39
  src: 'fetchBanksList',
40
40
  onDone: {
@@ -52,6 +52,7 @@ export default function (request) {
52
52
  on: {
53
53
  SELECT_DIRECT: {
54
54
  actions: ['setDirect', 'reset'],
55
+ target: 'loading.fetching',
55
56
  },
56
57
  SELECT_BANK: {
57
58
  actions: 'setSelectedBank',
@@ -180,8 +181,8 @@ export default function (request) {
180
181
  return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
181
182
  },
182
183
  fetchBanksList: async (context, event) => {
183
- const { paymentDetails } = context
184
- const method = paymentDetails.find((item) => item.category === 'direct')?.method
184
+ const { currentDirect } = context
185
+ const method = currentDirect.method
185
186
  return await request.send(payment.getBankList(method))
186
187
  },
187
188
  fetchCalculation: async (context, event) => {