@jetthai/cuora 1.1.182-krw-2 → 1.1.182-krw-4

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.1.182-krw-4](https://github.com/jetthai/cuora-module/compare/v1.1.182-krw-3...v1.1.182-krw-4) (2023-09-27)
6
+
7
+ ### [1.1.182-krw-3](https://github.com/jetthai/cuora-module/compare/v1.1.182-krw-2...v1.1.182-krw-3) (2023-09-27)
8
+
5
9
  ### [1.1.182-krw-2](https://github.com/jetthai/cuora-module/compare/v1.1.182-krw-1...v1.1.182-krw-2) (2023-09-27)
6
10
 
7
11
  ### [1.1.182-krw-1](https://github.com/jetthai/cuora-module/compare/v1.1.182-krw...v1.1.182-krw-1) (2023-09-27)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.182-krw-2",
3
+ "version": "1.1.182-krw-4",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -10,7 +10,11 @@ export default {
10
10
  method: 'post',
11
11
  params: { groupId, isRead },
12
12
  }),
13
- sendMessage: () => ({ url: 'mailbox/sendMessage', method: 'post' }),
13
+ sendMessage: ({ type, category, from, to, title, content }) => ({
14
+ url: 'mailbox/sendMessage',
15
+ method: 'post',
16
+ params: { type, category, from, to, title, content },
17
+ }),
14
18
  getMessage: ({ groupId, limit = 10, pageIdx }) => ({
15
19
  url: 'mailbox/getMessage',
16
20
  method: 'post',
package/src/api/user.js CHANGED
@@ -4,6 +4,7 @@ export const PASSWORD_RESET_ALLOW = 'allow-change-password'
4
4
  export default {
5
5
  checkDt: () => ({ url: 'checkDt', method: 'get' }),
6
6
  updateDt: (data) => ({ url: 'updateDt', method: 'post', params: data }),
7
+ checkAccount: ({ account, strategy }) => ({ url: 'checkAccount', method: 'post', params: { account, strategy } }),
7
8
  getUserInfo: () => ({ url: 'self', method: 'get' }),
8
9
  updateUserInfo: (data) => ({ url: 'self', method: 'post', params: data }),
9
10
  changePassword: (data) => ({ url: 'settings/password', method: 'post', params: data }),
@@ -1,5 +1,6 @@
1
1
  import { assign, createMachine } from 'xstate'
2
- import payment from '@jetthai/cuora/src/api/payment.js'
2
+ import payment from '../../api/payment.js'
3
+ import mailbox from '../../api/mailbox.js'
3
4
 
4
5
  export default function (request) {
5
6
  return createMachine(
@@ -10,7 +11,7 @@ export default function (request) {
10
11
  currentCategory: 'krway',
11
12
  paymentDetail: [],
12
13
  currentPayment: null,
13
- options: null,
14
+ options: [],
14
15
  amount: null,
15
16
  },
16
17
  states: {
@@ -27,18 +28,18 @@ export default function (request) {
27
28
  },
28
29
  },
29
30
  idle: {},
30
- searching: {
31
+ inquiring: {
31
32
  invoke: {
32
- src: 'searchAccount',
33
+ src: 'accountInquiry',
33
34
  onDone: {
34
- target: 'searched',
35
+ target: 'inquired',
35
36
  },
36
37
  onError: {
37
38
  target: 'fail',
38
39
  },
39
40
  },
40
41
  },
41
- searched: {
42
+ inquired: {
42
43
  after: {
43
44
  0: {
44
45
  target: 'idle',
@@ -60,8 +61,8 @@ export default function (request) {
60
61
  fail: {},
61
62
  },
62
63
  on: {
63
- SEARCHING_ACCOUNT: {
64
- target: 'searching',
64
+ INQUIRY_ACCOUNT: {
65
+ target: 'inquiring',
65
66
  },
66
67
  ADD_AMOUNT: {
67
68
  actions: 'addAmount',
@@ -106,8 +107,9 @@ export default function (request) {
106
107
  fetchPaymentDetail: async (context, event) => {
107
108
  return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
108
109
  },
109
- searchAccount: async (context, event) => {
110
- return await request.send(payment.searchAccount())
110
+ accountInquiry: async (context, event) => {
111
+ const { from, title, content } = event.data
112
+ return await request.send(mailbox.sendMessage({ type: 'SYSTEM', category: 'DEPOSIT', from, to: 'SYSTEM', title, content }))
111
113
  },
112
114
  submitDeposit: async (context, event) => {
113
115
  const { currentPayment, amount } = context