@jetthai/cuora 1.1.455-dev.8 → 1.1.455-dev.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.455-dev.8",
3
+ "version": "1.1.455-dev.9",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -10,7 +10,6 @@ export default function (request) {
10
10
  currentCategory: 'cryptoQrcode',
11
11
  cryptos: [],
12
12
  selectedCrypto: null,
13
- resultMap: {},
14
13
  result: {},
15
14
  },
16
15
  states: {
@@ -26,19 +25,8 @@ export default function (request) {
26
25
  },
27
26
  },
28
27
  },
29
- finding: {
30
- always: [
31
- {
32
- target: 'idle',
33
- actions: 'setResultFromLocal',
34
- cond: 'isFound',
35
- },
36
- {
37
- target: 'submitting',
38
- },
39
- ],
40
- },
41
28
  submitting: {
29
+ entry: 'clearResult',
42
30
  invoke: {
43
31
  src: 'submitDeposit',
44
32
  onDone: {
@@ -55,11 +43,11 @@ export default function (request) {
55
43
  },
56
44
  on: {
57
45
  SET_CRYPTO: {
58
- target: '.finding',
46
+ target: '.submitting',
59
47
  actions: 'setCrypto',
60
48
  },
61
49
  SET_NETWORK: {
62
- target: '.finding',
50
+ target: '.submitting',
63
51
  actions: 'setNetwork',
64
52
  },
65
53
  },
@@ -87,6 +75,9 @@ export default function (request) {
87
75
  selectedCrypto: cryptos[0],
88
76
  }
89
77
  }),
78
+ clearResult: assign({
79
+ result: {},
80
+ }),
90
81
  setCrypto: assign((context, event) => {
91
82
  const { cryptos } = context
92
83
  const data = event.data
@@ -95,30 +86,16 @@ export default function (request) {
95
86
  : cryptos.find((c) => c.label === data.label)
96
87
  return { selectedCrypto }
97
88
  }),
98
- setResultFromLocal: assign((context, event) => {
99
- const { resultMap, selectedCrypto } = context
100
- return { result: resultMap[`${selectedCrypto.channel}_${selectedCrypto.network}`] }
89
+ setNetwork: assign((context, event) => {
90
+ return { selectedCrypto: event.data }
101
91
  }),
102
92
  setResult: assign((context, event) => {
103
- const { resultMap, selectedCrypto } = context
104
93
  const { accountNumber, action, currency, network, qrcode, forexRate, redirect } = event.data
105
- const result = { accountNumber, action, currency, network, qrcode, forexRate, redirect }
106
-
107
94
  return {
108
- result,
109
- resultMap: {
110
- ...resultMap,
111
- [`${selectedCrypto.channel}_${selectedCrypto.network}`]: result,
112
- },
95
+ result: { accountNumber, action, currency, network, qrcode, forexRate, redirect },
113
96
  }
114
97
  }),
115
98
  },
116
- guards: {
117
- isFound: (context, event) => {
118
- const { resultMap, selectedCrypto } = context
119
- return resultMap[`${selectedCrypto.channel}_${selectedCrypto.network}`]
120
- },
121
- },
122
99
  services: {
123
100
  fetchPaymentDetail: async (context, event) => {
124
101
  return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))