@jetthai/cuora 1.1.264 → 1.1.265

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.1.265](https://github.com/jetthai/cuora-module/compare/v1.1.264...v1.1.265) (2024-05-14)
6
+
5
7
  ### [1.1.264](https://github.com/jetthai/cuora-module/compare/v1.1.263...v1.1.264) (2024-05-11)
6
8
 
7
9
  ### [1.1.263](https://github.com/jetthai/cuora-module/compare/v1.1.262...v1.1.263) (2024-05-10)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.264",
3
+ "version": "1.1.265",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -29,6 +29,7 @@ export default function (request) {
29
29
 
30
30
  depositTime: null,
31
31
  receipt: null,
32
+ proofOptional: false,
32
33
 
33
34
  // use for wallet mode 4
34
35
  promotion: null,
@@ -132,6 +133,9 @@ export default function (request) {
132
133
  target: '.loaded',
133
134
  actions: ['setAmount', 'clearCalculation'],
134
135
  },
136
+ SET_PROOF_OPTIONAL: {
137
+ actions: 'setProofOptional',
138
+ },
135
139
  CALCULATE: {
136
140
  target: '.debouncing',
137
141
  actions: 'clearCalculation',
@@ -242,6 +246,11 @@ export default function (request) {
242
246
  result: event.data,
243
247
  }
244
248
  }),
249
+ setProofOptional: assign((context, event) => {
250
+ return {
251
+ proofOptional: event.data,
252
+ }
253
+ }),
245
254
  setDepositTime: assign((context, event) => {
246
255
  return {
247
256
  depositTime: event.data,
@@ -265,8 +274,8 @@ export default function (request) {
265
274
  return selectedCrypto && selectedAddress && amount && cryptoBank.minimum <= +amount && +amount <= cryptoBank.maximum
266
275
  },
267
276
  isSubmittable: (context, event) => {
268
- const { selectedCrypto, selectedAddress, amount, depositTime, receipt } = context
269
- return selectedCrypto && selectedAddress && amount && depositTime && receipt
277
+ const { selectedCrypto, selectedAddress, amount, depositTime, receipt, proofOptional } = context
278
+ return selectedCrypto && selectedAddress && amount && depositTime && (receipt || proofOptional)
270
279
  },
271
280
  isProcessing: (context, event) => {
272
281
  return context.processing
@@ -75,19 +75,19 @@ export default function (request) {
75
75
  actions: {
76
76
  setInitData: assign((context, event) => {
77
77
  const paymentDetail = event.data || []
78
- const currentPayment = paymentDetail.find((item) => item.transferType === 'deposit' && item.category === context.currentCategory)
79
- const cryptos = currentPayment?.cryptoOptional?.map((value, i) => {
78
+ const payments = paymentDetail.filter((item) => item.transferType === 'deposit' && item.category === context.currentCategory)
79
+ const cryptos = payments?.map((value, i) => {
80
80
  return {
81
- ...currentPayment,
82
- label: value,
83
- network: currentPayment?.networkName[i],
84
- icon: currentPayment.channel,
81
+ ...value,
82
+ label: value?.cryptoOptional[0],
83
+ network: value?.networkName[0],
84
+ icon: value?.channel,
85
85
  }
86
86
  })
87
87
  return {
88
88
  cryptos,
89
89
  selectedCrypto: cryptos[0],
90
- currentPayment,
90
+ currentPayment: cryptos[0],
91
91
  }
92
92
  }),
93
93
  setCrypto: assign((context, event) => {
@@ -122,19 +122,19 @@ export default function (request) {
122
122
  {
123
123
  actions: {
124
124
  setPayment: assign((context, event) => {
125
- const currentPayment = event.data.find((item) => item.category === context.currentCategory)
126
- const cryptos = currentPayment?.cryptoOptional?.map((value, i) => {
125
+ const payments = event.data.filter((item) => item.category === context.currentCategory)
126
+ const cryptos = payments?.map((value, i) => {
127
127
  return {
128
- ...currentPayment,
129
- label: value,
130
- network: currentPayment?.networkName[i],
131
- icon: currentPayment.channel,
128
+ ...value,
129
+ label: value?.cryptoOptional[0],
130
+ network: value?.networkName[0],
131
+ icon: value?.channel,
132
132
  }
133
133
  })
134
134
  return {
135
135
  cryptos,
136
136
  selectedCrypto: cryptos[0],
137
- currentPayment,
137
+ currentPayment: cryptos[0],
138
138
  }
139
139
  }),
140
140
  setCrypto: assign((context, event) => {
@@ -180,12 +180,8 @@ export default function (request) {
180
180
  },
181
181
  guards: {
182
182
  isCalculable: (context, event) => {
183
- const {
184
- selectedCrypto,
185
- amount,
186
- currentPayment: { maximum, minimum },
187
- } = context
188
- return selectedCrypto && amount && minimum <= +amount && +amount <= maximum
183
+ const { selectedCrypto, amount } = context
184
+ return selectedCrypto && amount && selectedCrypto?.minimum <= +amount && +amount <= selectedCrypto?.maximum
189
185
  },
190
186
  isSubmittable: (context, event) => {
191
187
  const { selectedCrypto, amount } = context