@jetthai/cuora 1.1.408-dev-6 → 1.1.409

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,25 +2,7 @@
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.408-dev-6](https://github.com/jetthai/cuora-module/compare/v1.1.409...v1.1.408-dev-6) (2026-01-29)
6
-
7
- ### [1.1.408-dev-5](https://github.com/jetthai/cuora-module/compare/v1.1.408-dev-4...v1.1.408-dev-5) (2026-01-26)
8
-
9
- ### [1.1.408-dev-4](https://github.com/jetthai/cuora-module/compare/v1.1.408-dev-3...v1.1.408-dev-4) (2026-01-23)
10
-
11
- ### [1.1.408-dev-3](https://github.com/jetthai/cuora-module/compare/v1.1.408-dev-2...v1.1.408-dev-3) (2026-01-20)
12
-
13
- ### [1.1.408-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.408...v1.1.408-dev-2) (2026-01-16)
14
-
15
- ### [1.1.408-dev-5](https://github.com/jetthai/cuora-module/compare/v1.1.408-dev-4...v1.1.408-dev-5) (2026-01-26)
16
-
17
- ### [1.1.408-dev-4](https://github.com/jetthai/cuora-module/compare/v1.1.408-dev-3...v1.1.408-dev-4) (2026-01-23)
18
-
19
- ### [1.1.408-dev-3](https://github.com/jetthai/cuora-module/compare/v1.1.408-dev-2...v1.1.408-dev-3) (2026-01-20)
20
-
21
- ### [1.1.408-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.408-dev-1...v1.1.408-dev-2) (2026-01-16)
22
-
23
- ### [1.1.408-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.408...v1.1.408-dev-1) (2026-01-16)
5
+ ### [1.1.409](https://github.com/jetthai/cuora-module/compare/v1.1.408...v1.1.409) (2026-01-27)
24
6
 
25
7
  ### [1.1.408](https://github.com/jetthai/cuora-module/compare/v1.1.407...v1.1.408) (2026-01-12)
26
8
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.408-dev-6",
3
+ "version": "1.1.409",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -26,6 +26,6 @@
26
26
  "universal-cookie": "^4.0.4",
27
27
  "url-join": "^4.0.1",
28
28
  "xstate": "^4.25.0",
29
- "socket.io-client": "^4.8.3"
29
+ "socket.io-client": "^4.8.0"
30
30
  }
31
31
  }
@@ -176,12 +176,12 @@ export default {
176
176
  params: { transferType: 'DEPOSIT', amount, promotionsNo },
177
177
  }),
178
178
  submitWithdrawTransactionCrypto: ({ method, amount, cryptoCurrency, cryptoNetwork, targetAddress, applyerHolderName }) => ({
179
- url: `/payment/v2/${method}/withdraw-otp/verify`,
179
+ url: `payment/v2/${method}/transaction`,
180
180
  method: 'post',
181
181
  params: { transferType: 'WITHDRAW', amount, cryptoCurrency, cryptoNetwork, targetAddress, applyerHolderName },
182
182
  }),
183
183
  submitWithdrawTransactionVN: ({ method, amount, applyerBankCode, applyerAccountNumber, applyerIfscCode, branch, applyerHolderName }) => ({
184
- url: `/payment/v2/${method}/withdraw-otp/verify`,
184
+ url: `payment/v2/${method}/transaction`,
185
185
  method: 'post',
186
186
  params: {
187
187
  transferType: 'WITHDRAW',
@@ -205,7 +205,7 @@ export default {
205
205
  cryptoNetwork,
206
206
  targetAddress,
207
207
  }) => ({
208
- url: `payment/v2/${method}/withdraw-otp/verify`,
208
+ url: `payment/v2/${method}/transaction`,
209
209
  method: 'post',
210
210
  params: {
211
211
  transferType: 'WITHDRAW',
@@ -247,16 +247,4 @@ export default {
247
247
  withdrawCheck: () => ({ url: `payment/v2/withdrawCheck`, method: 'post' }),
248
248
  updateUtr: ({ applyId, utr }) => ({ url: 'payment/v2/updateUtr', method: 'post', params: { applyId, utr } }),
249
249
  uploadCommonSlip: ({ applyId, slip }) => ({ url: 'payment/v2/uploadCommonSlip', method: 'post', params: { applyId, slip } }),
250
- otpAcknowledge: ({ method, requestId, code }) => ({
251
- url: `/payment/v2/${method}/withdraw-otp/acknowledge`,
252
- method: 'post',
253
- params: { requestId, code },
254
- isPublic: true,
255
- }),
256
- otpReset: ({ method, requestId }) => ({
257
- url: `/payment/v2/${method}/withdraw-otp/reset-otp`,
258
- method: 'post',
259
- params: { requestId },
260
- isPublic: true,
261
- }),
262
250
  }
@@ -101,7 +101,7 @@ export default function (request) {
101
101
  invoke: {
102
102
  src: 'fetchUserInfo',
103
103
  onDone: {
104
- target: 'otpChecking',
104
+ target: 'loginSuccess',
105
105
  actions: ['setUserInfo', 'extendToken'],
106
106
  },
107
107
  onError: {
@@ -109,19 +109,6 @@ export default function (request) {
109
109
  },
110
110
  },
111
111
  },
112
- otpChecking: {
113
- on: {
114
- OTP_VERIFIED: {
115
- target: 'loginSuccess',
116
- },
117
- OTP_SKIP: {
118
- target: 'loginSuccess',
119
- },
120
- LOGOUT: {
121
- target: 'leaving',
122
- },
123
- },
124
- },
125
112
  loginSuccess: {
126
113
  after: {
127
114
  0: {
@@ -1,6 +1,7 @@
1
1
  import { assign, createMachine } from 'xstate'
2
2
  import findLastIndex from 'lodash/findLastIndex.js'
3
3
  import payment from '../../api/payment.js'
4
+ import user from '../../api/user.js'
4
5
 
5
6
  export default function (request) {
6
7
  const { appSecret } = request.config
@@ -35,8 +36,8 @@ export default function (request) {
35
36
 
36
37
  // otp
37
38
  requestId: null,
38
- number: null,
39
- email: null,
39
+ status: null,
40
+ target: null,
40
41
  ttl: null,
41
42
  },
42
43
  states: {
@@ -355,27 +356,26 @@ export default function (request) {
355
356
  return { paymentDetail }
356
357
  }),
357
358
  setOtp: assign((context, event) => {
358
- const { request_id, number, email, ttl } = event.data
359
+ const { requestId, status, target, ttl } = event.data
359
360
  return {
360
- requestId: request_id,
361
- number,
362
- email,
361
+ requestId,
362
+ status,
363
+ target,
363
364
  ttl,
364
365
  }
365
366
  }),
366
367
  decreaseTtl: assign((context, evnet) => {
367
368
  const second = context.ttl
368
369
  return {
369
- ttl: Math.max(second - 1000, 0),
370
+ ttl: Math.max(second - 1, 0),
370
371
  }
371
372
  }),
372
373
  setVerificationData: assign((context, event) => {
373
- const { request_id, number, email, ttl } = event.data
374
+ const { requestId, ttl, target } = event.data
374
375
  return {
375
- requestId: request_id,
376
- number,
377
- email,
376
+ requestId,
378
377
  ttl,
378
+ target,
379
379
  }
380
380
  }),
381
381
  setAttachmentType: assign((context, event) => {
@@ -439,8 +439,7 @@ export default function (request) {
439
439
  return !enableWithdraw || balance < minWithdrawAmount
440
440
  },
441
441
  isOtpRequired: (context, event) => {
442
- const { request_id, number, email } = event.data || {}
443
- return request_id !== undefined && (number || email)
442
+ return event.data?.status === 'otp-verifying'
444
443
  },
445
444
  isNotWithdrawMinDepositAmount: (context, event) => {
446
445
  const { withdrawCheck } = context
@@ -510,15 +509,13 @@ export default function (request) {
510
509
  return await request.send(payment.convertFreeCredit({ exchangeType: 1 }))
511
510
  },
512
511
  resetOtp: async (context, event) => {
513
- const { requestId } = context
514
- const { method } = context.paymentDetail[0]
515
- return await request.send(payment.otpReset({ method: method, requestId }))
512
+ const { requestId, target } = context
513
+ return await request.send(user.otpReset({ requestId, target }))
516
514
  },
517
515
  acknowledge: async (context, event) => {
518
- const { requestId } = context
519
- const { method } = context.paymentDetail[0]
516
+ const { requestId, target } = context
520
517
  const code = event.data
521
- return await request.send(payment.otpAcknowledge({ method: method, requestId, code }))
518
+ return await request.send(user.otpAcknowledge({ requestId, target, code }))
522
519
  },
523
520
  pool: async (context, event) => {
524
521
  const { amount } = context
@@ -23,8 +23,6 @@ export default function (request, context) {
23
23
  requestId: null,
24
24
  status: null,
25
25
  target: null,
26
- email: null,
27
- number: null,
28
26
  ttl: null,
29
27
  },
30
28
  states: {
@@ -119,18 +117,29 @@ export default function (request, context) {
119
117
  RESET_OTP: {
120
118
  target: 'reset',
121
119
  },
122
- BACK: {
123
- target: '#withdraw_manual_cash.calculated',
124
- },
120
+ BACK: [
121
+ // {
122
+ // target: '#withdraw_vn2.activity.convertible',
123
+ // cond: 'isActivity',
124
+ // },
125
+ // {
126
+ // target: '#withdraw_vn2.cash.withdrawable',
127
+ // },
128
+ ],
125
129
  },
126
130
  },
127
131
  acknowledging: {
128
132
  invoke: {
129
133
  src: 'acknowledge',
130
- onDone: {
131
- target: '#withdraw_manual_cash.submitted',
132
- actions: 'setProcessing',
133
- },
134
+ onDone: [
135
+ // {
136
+ // target: '#withdraw_vn2.activity.converted',
137
+ // cond: 'isActivity',
138
+ // },
139
+ // {
140
+ // target: '#withdraw_vn2.cash.submitted',
141
+ // },
142
+ ],
134
143
  onError: {
135
144
  target: 'idle',
136
145
  },
@@ -194,27 +203,26 @@ export default function (request, context) {
194
203
  }
195
204
  }),
196
205
  setOtp: assign((context, event) => {
197
- const { request_id, email, number, ttl } = event.data
206
+ const { requestId, status, target, ttl } = event.data
198
207
  return {
199
- requestId: request_id,
200
- email,
201
- number,
208
+ requestId,
209
+ status,
210
+ target,
202
211
  ttl,
203
212
  }
204
213
  }),
205
214
  decreaseTtl: assign((context, evnet) => {
206
215
  const second = context.ttl
207
216
  return {
208
- ttl: Math.max(second - 1000, 0),
217
+ ttl: Math.max(second - 1, 0),
209
218
  }
210
219
  }),
211
220
  setVerificationData: assign((context, event) => {
212
- const { request_id, ttl, number, email } = event.data
221
+ const { requestId, ttl, target } = event.data
213
222
  return {
214
- requestId: request_id,
223
+ requestId,
215
224
  ttl,
216
- number,
217
- email,
225
+ target,
218
226
  }
219
227
  }),
220
228
  },
@@ -230,7 +238,7 @@ export default function (request, context) {
230
238
  return selectedUserBank && selectedAmount > 0 && currentPayment.minimum <= selectedAmount && selectedAmount <= currentPayment.maximum
231
239
  },
232
240
  isOtpRequired: (context, event) => {
233
- return event.data?.request_id !== undefined
241
+ return event.data?.status === 'otp-verifying'
234
242
  },
235
243
  },
236
244
  services: {
@@ -281,13 +289,13 @@ export default function (request, context) {
281
289
  )
282
290
  },
283
291
  resetOtp: async (context, event) => {
284
- const { currentPayment, requestId } = context
285
- return await request.send(payment.otpReset({ method: currentPayment.method, requestId }))
292
+ const { requestId, target } = context
293
+ return await request.send(user.otpReset({ requestId, target }))
286
294
  },
287
295
  acknowledge: async (context, event) => {
288
- const { currentPayment, requestId } = context
296
+ const { requestId, target } = context
289
297
  const code = event.data
290
- return await request.send(payment.otpAcknowledge({ method: currentPayment.method, requestId, code }))
298
+ return await request.send(user.otpAcknowledge({ requestId, target, code }))
291
299
  },
292
300
  },
293
301
  }