@zeniai/client-epic-state 5.1.76 → 5.1.77-betaAK1
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/lib/entity/invoicing/invoicingCommonPayload.d.ts +42 -0
- package/lib/entity/invoicing/invoicingCommonPayload.js +66 -1
- package/lib/entity/notificationRegistry/notificationRegistryPayload.d.ts +1 -0
- package/lib/entity/notificationRegistry/notificationRegistryPayload.js +3 -0
- package/lib/entity/notificationRegistry/notificationRegistryState.d.ts +1 -0
- package/lib/entity/tenant/clearAllEpic.d.ts +2 -1
- package/lib/entity/tenant/clearAllEpic.js +2 -0
- package/lib/epic.d.ts +2 -1
- package/lib/epic.js +7 -1
- package/lib/esm/entity/invoicing/invoicingCommonPayload.js +61 -0
- package/lib/esm/entity/notificationRegistry/notificationRegistryPayload.js +3 -0
- package/lib/esm/entity/tenant/clearAllEpic.js +2 -0
- package/lib/esm/epic.js +7 -1
- package/lib/esm/index.js +5 -1
- package/lib/esm/reducer.js +3 -0
- package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +4 -18
- package/lib/esm/view/invoicing/createCreditNote/createCreditNoteFormConfig.js +8 -1
- package/lib/esm/view/invoicing/createCreditNote/createCreditNotePayload.js +1 -8
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js +5 -5
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +2 -3
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormConfig.js +5 -4
- package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewPayload.js +2 -2
- package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewReducer.js +1 -1
- package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewSelector.js +1 -1
- package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewState.js +45 -1
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewPayload.js +3 -4
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/invoicingSubscriptionFormConfig.js +4 -2
- package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +7 -1
- package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +3 -0
- package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.js +25 -0
- package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.js +15 -0
- package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingQboConnectionEpic.js +15 -0
- package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingQboSyncHealthEpic.js +15 -0
- package/lib/esm/view/invoicing/invoicingQboView/epics/invoicingQboViewActionType.js +1 -0
- package/lib/esm/view/invoicing/invoicingQboView/epics/retryInvoicingQboSyncTaskEpic.js +26 -0
- package/lib/esm/view/invoicing/invoicingQboView/epics/startInvoicingQboBackfillEpic.js +18 -0
- package/lib/esm/view/invoicing/invoicingQboView/invoicingQboViewPayload.js +47 -0
- package/lib/esm/view/invoicing/invoicingQboView/invoicingQboViewReducer.js +128 -0
- package/lib/esm/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +20 -0
- package/lib/esm/view/invoicing/invoicingQboView/invoicingQboViewState.js +1 -0
- package/lib/esm/view/invoicing/issueCreditNote/issueCreditNotePayload.js +4 -11
- package/lib/esm/view/invoicing/recordPayment/recordPaymentFormConfig.js +2 -1
- package/lib/esm/view/invoicing/recordPayment/recordPaymentPayload.js +5 -14
- package/lib/index.d.ts +7 -1
- package/lib/index.js +20 -4
- package/lib/reducer.d.ts +3 -0
- package/lib/reducer.js +3 -0
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +3 -17
- package/lib/view/invoicing/createCreditNote/createCreditNoteFormConfig.js +8 -1
- package/lib/view/invoicing/createCreditNote/createCreditNotePayload.js +1 -8
- package/lib/view/invoicing/createCreditNote/createCreditNoteState.d.ts +2 -1
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.d.ts +2 -1
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js +5 -5
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +2 -3
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewState.d.ts +3 -2
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormConfig.js +5 -4
- package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewPayload.js +2 -2
- package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewReducer.js +3 -3
- package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewSelector.js +2 -2
- package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewState.d.ts +8 -2
- package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewState.js +47 -0
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewPayload.js +3 -4
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewState.d.ts +2 -1
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/invoicingSubscriptionFormConfig.js +4 -2
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewPayload.d.ts +4 -1
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +6 -0
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.d.ts +4 -1
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +3 -0
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewState.d.ts +4 -1
- package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.d.ts +6 -0
- package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.js +29 -0
- package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.d.ts +6 -0
- package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.js +19 -0
- package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboConnectionEpic.d.ts +6 -0
- package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboConnectionEpic.js +19 -0
- package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboSyncHealthEpic.d.ts +6 -0
- package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboSyncHealthEpic.js +19 -0
- package/lib/view/invoicing/invoicingQboView/epics/invoicingQboViewActionType.d.ts +2 -0
- package/lib/view/invoicing/invoicingQboView/epics/invoicingQboViewActionType.js +2 -0
- package/lib/view/invoicing/invoicingQboView/epics/retryInvoicingQboSyncTaskEpic.d.ts +6 -0
- package/lib/view/invoicing/invoicingQboView/epics/retryInvoicingQboSyncTaskEpic.js +30 -0
- package/lib/view/invoicing/invoicingQboView/epics/startInvoicingQboBackfillEpic.d.ts +6 -0
- package/lib/view/invoicing/invoicingQboView/epics/startInvoicingQboBackfillEpic.js +22 -0
- package/lib/view/invoicing/invoicingQboView/invoicingQboViewPayload.d.ts +79 -0
- package/lib/view/invoicing/invoicingQboView/invoicingQboViewPayload.js +52 -0
- package/lib/view/invoicing/invoicingQboView/invoicingQboViewReducer.d.ts +25 -0
- package/lib/view/invoicing/invoicingQboView/invoicingQboViewReducer.js +132 -0
- package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.d.ts +21 -0
- package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +24 -0
- package/lib/view/invoicing/invoicingQboView/invoicingQboViewState.d.ts +14 -0
- package/lib/view/invoicing/invoicingQboView/invoicingQboViewState.js +2 -0
- package/lib/view/invoicing/issueCreditNote/issueCreditNotePayload.js +4 -11
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteState.d.ts +3 -2
- package/lib/view/invoicing/recordPayment/recordPaymentFormConfig.js +2 -1
- package/lib/view/invoicing/recordPayment/recordPaymentPayload.js +5 -14
- package/lib/view/invoicing/recordPayment/recordPaymentState.d.ts +3 -2
- package/package.json +1 -1
- package/lib/esm/view/invoicing/editInvoicingCouponDetailView/invoicingCouponFormConfig.js +0 -44
- package/lib/view/invoicing/editInvoicingCouponDetailView/invoicingCouponFormConfig.d.ts +0 -5
- package/lib/view/invoicing/editInvoicingCouponDetailView/invoicingCouponFormConfig.js +0 -48
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.clearInvoicingQboView = exports.startInvoicingQboBackfillFailure = exports.startInvoicingQboBackfillSuccess = exports.startInvoicingQboBackfill = exports.retryInvoicingQboSyncTaskFailure = exports.retryInvoicingQboSyncTaskSuccess = exports.retryInvoicingQboSyncTask = exports.updateInvoicingQboSyncHealthFailure = exports.updateInvoicingQboSyncHealth = exports.fetchInvoicingQboSyncHealth = exports.updateInvoicingQboClassesFailure = exports.updateInvoicingQboClasses = exports.fetchInvoicingQboClasses = exports.updateInvoicingQboAccountsFailure = exports.updateInvoicingQboAccounts = exports.fetchInvoicingQboAccounts = exports.updateInvoicingQboConnectionFailure = exports.updateInvoicingQboConnection = exports.fetchInvoicingQboConnection = exports.initialState = void 0;
|
|
5
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
exports.initialState = {
|
|
7
|
+
accountsByAccountTypes: {},
|
|
8
|
+
accountsFetchStateByAccountTypes: {},
|
|
9
|
+
backfillFetchState: { fetchState: 'Not-Started', error: undefined },
|
|
10
|
+
classes: [],
|
|
11
|
+
classesFetchState: { fetchState: 'Not-Started', error: undefined },
|
|
12
|
+
connection: undefined,
|
|
13
|
+
connectionFetchState: { fetchState: 'Not-Started', error: undefined },
|
|
14
|
+
retryFetchStateByTaskId: {},
|
|
15
|
+
syncHealth: undefined,
|
|
16
|
+
syncHealthFetchState: { fetchState: 'Not-Started', error: undefined },
|
|
17
|
+
};
|
|
18
|
+
const invoicingQboView = (0, toolkit_1.createSlice)({
|
|
19
|
+
name: 'invoicingQboView',
|
|
20
|
+
initialState: exports.initialState,
|
|
21
|
+
reducers: {
|
|
22
|
+
fetchInvoicingQboConnection(draft) {
|
|
23
|
+
draft.connectionFetchState = {
|
|
24
|
+
fetchState: 'In-Progress',
|
|
25
|
+
error: undefined,
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
updateInvoicingQboConnection(draft, action) {
|
|
29
|
+
draft.connection = action.payload;
|
|
30
|
+
draft.connectionFetchState = { fetchState: 'Completed', error: undefined };
|
|
31
|
+
},
|
|
32
|
+
updateInvoicingQboConnectionFailure(draft, action) {
|
|
33
|
+
draft.connectionFetchState = { fetchState: 'Error', error: action.payload };
|
|
34
|
+
},
|
|
35
|
+
fetchInvoicingQboAccounts: {
|
|
36
|
+
reducer(draft, action) {
|
|
37
|
+
draft.accountsFetchStateByAccountTypes[action.payload.accountTypes] = {
|
|
38
|
+
fetchState: 'In-Progress',
|
|
39
|
+
error: undefined,
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
prepare(accountTypes) {
|
|
43
|
+
return { payload: { accountTypes } };
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
updateInvoicingQboAccounts(draft, action) {
|
|
47
|
+
draft.accountsByAccountTypes[action.payload.accountTypes] =
|
|
48
|
+
action.payload.accounts;
|
|
49
|
+
draft.accountsFetchStateByAccountTypes[action.payload.accountTypes] = {
|
|
50
|
+
fetchState: 'Completed',
|
|
51
|
+
error: undefined,
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
updateInvoicingQboAccountsFailure(draft, action) {
|
|
55
|
+
draft.accountsFetchStateByAccountTypes[action.payload.accountTypes] = {
|
|
56
|
+
fetchState: 'Error',
|
|
57
|
+
error: action.payload.status,
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
fetchInvoicingQboClasses(draft) {
|
|
61
|
+
draft.classesFetchState = { fetchState: 'In-Progress', error: undefined };
|
|
62
|
+
},
|
|
63
|
+
updateInvoicingQboClasses(draft, action) {
|
|
64
|
+
draft.classes = action.payload;
|
|
65
|
+
draft.classesFetchState = { fetchState: 'Completed', error: undefined };
|
|
66
|
+
},
|
|
67
|
+
updateInvoicingQboClassesFailure(draft, action) {
|
|
68
|
+
draft.classesFetchState = { fetchState: 'Error', error: action.payload };
|
|
69
|
+
},
|
|
70
|
+
fetchInvoicingQboSyncHealth(draft) {
|
|
71
|
+
draft.syncHealthFetchState = {
|
|
72
|
+
fetchState: 'In-Progress',
|
|
73
|
+
error: undefined,
|
|
74
|
+
};
|
|
75
|
+
},
|
|
76
|
+
updateInvoicingQboSyncHealth(draft, action) {
|
|
77
|
+
draft.syncHealth = action.payload;
|
|
78
|
+
draft.syncHealthFetchState = { fetchState: 'Completed', error: undefined };
|
|
79
|
+
},
|
|
80
|
+
updateInvoicingQboSyncHealthFailure(draft, action) {
|
|
81
|
+
draft.syncHealthFetchState = {
|
|
82
|
+
fetchState: 'Error',
|
|
83
|
+
error: action.payload,
|
|
84
|
+
};
|
|
85
|
+
},
|
|
86
|
+
retryInvoicingQboSyncTask: {
|
|
87
|
+
reducer(draft, action) {
|
|
88
|
+
draft.retryFetchStateByTaskId[action.payload.taskId] = {
|
|
89
|
+
fetchState: 'In-Progress',
|
|
90
|
+
error: undefined,
|
|
91
|
+
};
|
|
92
|
+
},
|
|
93
|
+
prepare(taskId) {
|
|
94
|
+
return { payload: { taskId } };
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
retryInvoicingQboSyncTaskSuccess(draft, action) {
|
|
98
|
+
draft.retryFetchStateByTaskId[action.payload.taskId] = {
|
|
99
|
+
fetchState: 'Completed',
|
|
100
|
+
error: undefined,
|
|
101
|
+
};
|
|
102
|
+
},
|
|
103
|
+
retryInvoicingQboSyncTaskFailure(draft, action) {
|
|
104
|
+
draft.retryFetchStateByTaskId[action.payload.taskId] = {
|
|
105
|
+
fetchState: 'Error',
|
|
106
|
+
error: action.payload.status,
|
|
107
|
+
};
|
|
108
|
+
},
|
|
109
|
+
startInvoicingQboBackfill: {
|
|
110
|
+
reducer(draft) {
|
|
111
|
+
draft.backfillFetchState = {
|
|
112
|
+
fetchState: 'In-Progress',
|
|
113
|
+
error: undefined,
|
|
114
|
+
};
|
|
115
|
+
},
|
|
116
|
+
prepare(startDate) {
|
|
117
|
+
return { payload: { startDate } };
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
startInvoicingQboBackfillSuccess(draft) {
|
|
121
|
+
draft.backfillFetchState = { fetchState: 'Completed', error: undefined };
|
|
122
|
+
},
|
|
123
|
+
startInvoicingQboBackfillFailure(draft, action) {
|
|
124
|
+
draft.backfillFetchState = { fetchState: 'Error', error: action.payload };
|
|
125
|
+
},
|
|
126
|
+
clearInvoicingQboView(draft) {
|
|
127
|
+
Object.assign(draft, exports.initialState);
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
});
|
|
131
|
+
_a = invoicingQboView.actions, exports.fetchInvoicingQboConnection = _a.fetchInvoicingQboConnection, exports.updateInvoicingQboConnection = _a.updateInvoicingQboConnection, exports.updateInvoicingQboConnectionFailure = _a.updateInvoicingQboConnectionFailure, exports.fetchInvoicingQboAccounts = _a.fetchInvoicingQboAccounts, exports.updateInvoicingQboAccounts = _a.updateInvoicingQboAccounts, exports.updateInvoicingQboAccountsFailure = _a.updateInvoicingQboAccountsFailure, exports.fetchInvoicingQboClasses = _a.fetchInvoicingQboClasses, exports.updateInvoicingQboClasses = _a.updateInvoicingQboClasses, exports.updateInvoicingQboClassesFailure = _a.updateInvoicingQboClassesFailure, exports.fetchInvoicingQboSyncHealth = _a.fetchInvoicingQboSyncHealth, exports.updateInvoicingQboSyncHealth = _a.updateInvoicingQboSyncHealth, exports.updateInvoicingQboSyncHealthFailure = _a.updateInvoicingQboSyncHealthFailure, exports.retryInvoicingQboSyncTask = _a.retryInvoicingQboSyncTask, exports.retryInvoicingQboSyncTaskSuccess = _a.retryInvoicingQboSyncTaskSuccess, exports.retryInvoicingQboSyncTaskFailure = _a.retryInvoicingQboSyncTaskFailure, exports.startInvoicingQboBackfill = _a.startInvoicingQboBackfill, exports.startInvoicingQboBackfillSuccess = _a.startInvoicingQboBackfillSuccess, exports.startInvoicingQboBackfillFailure = _a.startInvoicingQboBackfillFailure, exports.clearInvoicingQboView = _a.clearInvoicingQboView;
|
|
132
|
+
exports.default = invoicingQboView.reducer;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FetchStateAndError } from '../../../commonStateTypes/common';
|
|
2
|
+
import { RootState } from '../../../reducer';
|
|
3
|
+
import { InvoicingQboAccountOption, InvoicingQboConnection, InvoicingQboSyncHealth } from './invoicingQboViewPayload';
|
|
4
|
+
export interface InvoicingQboView {
|
|
5
|
+
accountsByAccountTypes: Record<string, InvoicingQboAccountOption[]>;
|
|
6
|
+
accountsFetchStateByAccountTypes: Record<string, FetchStateAndError>;
|
|
7
|
+
backfillState: FetchStateAndError;
|
|
8
|
+
classes: InvoicingQboAccountOption[];
|
|
9
|
+
classesFetchState: FetchStateAndError;
|
|
10
|
+
connectionFetchState: FetchStateAndError;
|
|
11
|
+
retryFetchStateByTaskId: Record<string, FetchStateAndError>;
|
|
12
|
+
syncHealthFetchState: FetchStateAndError;
|
|
13
|
+
connection?: InvoicingQboConnection;
|
|
14
|
+
syncHealth?: InvoicingQboSyncHealth;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Single bundled view for the QBO integration settings screen — the
|
|
18
|
+
* connection, per-account-types account options, classes, sync health, and the
|
|
19
|
+
* fetch/action states for each of them.
|
|
20
|
+
*/
|
|
21
|
+
export declare const getInvoicingQboView: (state: RootState) => InvoicingQboView;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getInvoicingQboView = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Single bundled view for the QBO integration settings screen — the
|
|
6
|
+
* connection, per-account-types account options, classes, sync health, and the
|
|
7
|
+
* fetch/action states for each of them.
|
|
8
|
+
*/
|
|
9
|
+
const getInvoicingQboView = (state) => {
|
|
10
|
+
const qboState = state.invoicingQboViewState;
|
|
11
|
+
return {
|
|
12
|
+
accountsByAccountTypes: qboState.accountsByAccountTypes,
|
|
13
|
+
accountsFetchStateByAccountTypes: qboState.accountsFetchStateByAccountTypes,
|
|
14
|
+
backfillState: qboState.backfillFetchState,
|
|
15
|
+
classes: qboState.classes,
|
|
16
|
+
classesFetchState: qboState.classesFetchState,
|
|
17
|
+
connection: qboState.connection,
|
|
18
|
+
connectionFetchState: qboState.connectionFetchState,
|
|
19
|
+
retryFetchStateByTaskId: qboState.retryFetchStateByTaskId,
|
|
20
|
+
syncHealth: qboState.syncHealth,
|
|
21
|
+
syncHealthFetchState: qboState.syncHealthFetchState,
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
exports.getInvoicingQboView = getInvoicingQboView;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FetchStateAndError } from '../../../commonStateTypes/common';
|
|
2
|
+
import { InvoicingQboAccountOption, InvoicingQboConnection, InvoicingQboSyncHealth } from './invoicingQboViewPayload';
|
|
3
|
+
export interface InvoicingQboViewState {
|
|
4
|
+
accountsByAccountTypes: Record<string, InvoicingQboAccountOption[]>;
|
|
5
|
+
accountsFetchStateByAccountTypes: Record<string, FetchStateAndError>;
|
|
6
|
+
backfillFetchState: FetchStateAndError;
|
|
7
|
+
classes: InvoicingQboAccountOption[];
|
|
8
|
+
classesFetchState: FetchStateAndError;
|
|
9
|
+
connectionFetchState: FetchStateAndError;
|
|
10
|
+
retryFetchStateByTaskId: Record<string, FetchStateAndError>;
|
|
11
|
+
syncHealthFetchState: FetchStateAndError;
|
|
12
|
+
connection?: InvoicingQboConnection;
|
|
13
|
+
syncHealth?: InvoicingQboSyncHealth;
|
|
14
|
+
}
|
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.initializeIssueCreditNoteDraftFromInvoice = exports.localDataToIssueCreditNotePayload = exports.computeIssueCreditNoteTotal = void 0;
|
|
4
|
-
const dollarsFromAmountString = (value) => {
|
|
5
|
-
const parsed = Number.parseFloat(value);
|
|
6
|
-
if (Number.isNaN(parsed)) {
|
|
7
|
-
return 0;
|
|
8
|
-
}
|
|
9
|
-
return parsed;
|
|
10
|
-
};
|
|
11
4
|
const computeIssueCreditNoteTotal = (lineItems) => lineItems
|
|
12
5
|
.filter((lineItem) => lineItem.selected)
|
|
13
6
|
.reduce((total, lineItem) => {
|
|
14
7
|
const quantity = Number.parseFloat(lineItem.quantity);
|
|
15
|
-
const unitAmount =
|
|
8
|
+
const unitAmount = lineItem.unitAmount.amount;
|
|
16
9
|
if (Number.isNaN(quantity) || quantity <= 0 || unitAmount <= 0) {
|
|
17
10
|
return total;
|
|
18
11
|
}
|
|
@@ -24,7 +17,7 @@ const localDataToIssueCreditNotePayload = (localData) => {
|
|
|
24
17
|
.filter((lineItem) => lineItem.selected)
|
|
25
18
|
.map((lineItem) => {
|
|
26
19
|
const quantity = Math.round(Number.parseFloat(lineItem.quantity));
|
|
27
|
-
const unitAmount =
|
|
20
|
+
const unitAmount = lineItem.unitAmount.amount;
|
|
28
21
|
return {
|
|
29
22
|
description: lineItem.description,
|
|
30
23
|
quantity,
|
|
@@ -48,10 +41,10 @@ const initializeIssueCreditNoteDraftFromInvoice = (invoice) => ({
|
|
|
48
41
|
description: lineItem.description,
|
|
49
42
|
id: lineItem.id,
|
|
50
43
|
maxQuantity: lineItem.quantity,
|
|
51
|
-
maxUnitAmount: lineItem.unitAmount
|
|
44
|
+
maxUnitAmount: lineItem.unitAmount,
|
|
52
45
|
quantity: String(lineItem.quantity),
|
|
53
46
|
selected: true,
|
|
54
|
-
unitAmount: lineItem.unitAmount
|
|
47
|
+
unitAmount: lineItem.unitAmount,
|
|
55
48
|
})),
|
|
56
49
|
});
|
|
57
50
|
exports.initializeIssueCreditNoteDraftFromInvoice = initializeIssueCreditNoteDraftFromInvoice;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import { Amount } from '../../../commonStateTypes/amount';
|
|
1
2
|
import { FetchedState, ID } from '../../../commonStateTypes/common';
|
|
2
3
|
export interface IssueCreditNoteLineItemDraft {
|
|
3
4
|
description: string;
|
|
4
5
|
maxQuantity: number;
|
|
5
|
-
maxUnitAmount:
|
|
6
|
+
maxUnitAmount: Amount;
|
|
6
7
|
quantity: string;
|
|
7
8
|
selected: boolean;
|
|
8
|
-
unitAmount:
|
|
9
|
+
unitAmount: Amount;
|
|
9
10
|
id?: string;
|
|
10
11
|
}
|
|
11
12
|
export interface IssueCreditNoteFormLocalData {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.initialRecordPaymentFormLocalData = exports.INVOICING_PAYMENT_GATEWAY_VALUES = exports.INVOICING_PAYMENT_METHOD_VALUES = void 0;
|
|
4
|
+
const amount_1 = require("../../../commonStateTypes/amount");
|
|
4
5
|
/**
|
|
5
6
|
* Canonical value sets for the Record Payment form. CES owns the values;
|
|
6
7
|
* web-components maps each value to a localized label.
|
|
@@ -28,7 +29,7 @@ exports.INVOICING_PAYMENT_GATEWAY_VALUES = [
|
|
|
28
29
|
'other',
|
|
29
30
|
];
|
|
30
31
|
exports.initialRecordPaymentFormLocalData = {
|
|
31
|
-
amount: '',
|
|
32
|
+
amount: (0, amount_1.toAmount)(0, 'USD', '$'),
|
|
32
33
|
comment: '',
|
|
33
34
|
customerId: '',
|
|
34
35
|
date: '',
|
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.initializeRecordPaymentDraftFromInvoice = exports.localDataToRecordPaymentPayload = exports.localDataToInvoiceRecordPaymentBody = void 0;
|
|
4
|
+
const amount_1 = require("../../../commonStateTypes/amount");
|
|
4
5
|
const zeniDayJS_1 = require("../../../zeniDayJS");
|
|
5
6
|
const recordPaymentFormConfig_1 = require("./recordPaymentFormConfig");
|
|
6
7
|
const trimOrUndefined = (value) => value.trim() !== '' ? value.trim() : undefined;
|
|
7
|
-
const
|
|
8
|
-
const parsed = Number.parseFloat(value);
|
|
9
|
-
if (Number.isNaN(parsed)) {
|
|
10
|
-
return 0;
|
|
11
|
-
}
|
|
12
|
-
return parsed;
|
|
13
|
-
};
|
|
14
|
-
const amountDueDollarsFromInvoice = (invoice) => {
|
|
15
|
-
const amountDue = invoice.amountDue?.amount ?? 0;
|
|
16
|
-
return amountDue.toFixed(2);
|
|
17
|
-
};
|
|
8
|
+
const amountDueFromInvoice = (invoice) => invoice.amountDue ?? (0, amount_1.toAmount)(0, 'USD', '$');
|
|
18
9
|
/**
|
|
19
10
|
* Build the invoice-scoped Record Payment body from the form draft. Amount stays
|
|
20
11
|
* in dollars for the invoice endpoint.
|
|
@@ -24,7 +15,7 @@ const localDataToInvoiceRecordPaymentBody = (localData) => {
|
|
|
24
15
|
const date = localData.date.trim();
|
|
25
16
|
const referenceNumber = trimOrUndefined(localData.referenceNumber);
|
|
26
17
|
return {
|
|
27
|
-
amount:
|
|
18
|
+
amount: localData.amount.amount,
|
|
28
19
|
payment_method: localData.paymentMethod,
|
|
29
20
|
...(gateway != null ? { gateway } : {}),
|
|
30
21
|
...(date !== '' ? { date } : {}),
|
|
@@ -38,7 +29,7 @@ exports.localDataToInvoiceRecordPaymentBody = localDataToInvoiceRecordPaymentBod
|
|
|
38
29
|
* and the linked invoice into `linked_invoices`. Currency is locked to USD.
|
|
39
30
|
*/
|
|
40
31
|
const localDataToRecordPaymentPayload = (localData) => {
|
|
41
|
-
const amount =
|
|
32
|
+
const amount = localData.amount.amount;
|
|
42
33
|
const gateway = trimOrUndefined(localData.gateway);
|
|
43
34
|
const date = localData.date.trim();
|
|
44
35
|
const transactionId = trimOrUndefined(localData.transactionId);
|
|
@@ -65,7 +56,7 @@ const localDataToRecordPaymentPayload = (localData) => {
|
|
|
65
56
|
exports.localDataToRecordPaymentPayload = localDataToRecordPaymentPayload;
|
|
66
57
|
const initializeRecordPaymentDraftFromInvoice = (invoice) => ({
|
|
67
58
|
...recordPaymentFormConfig_1.initialRecordPaymentFormLocalData,
|
|
68
|
-
amount:
|
|
59
|
+
amount: amountDueFromInvoice(invoice),
|
|
69
60
|
customerId: invoice.customerID,
|
|
70
61
|
date: (0, zeniDayJS_1.dateNow)().format('YYYY-MM-DD'),
|
|
71
62
|
invoiceToLink: invoice.id,
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import { Amount } from '../../../commonStateTypes/amount';
|
|
1
2
|
import { FetchedState, ID } from '../../../commonStateTypes/common';
|
|
2
3
|
/**
|
|
3
4
|
* Draft form state for the Record Payment form. Held in CES so the form flows
|
|
4
5
|
* its data from here (mirrors the customer form pattern). Record payment is
|
|
5
6
|
* create-only, so there is a single draft (no per-id edit tree). The date is an
|
|
6
|
-
* ISO `YYYY-MM-DD` string; amount
|
|
7
|
+
* ISO `YYYY-MM-DD` string; the amount as an `Amount` (as on the invoice entity).
|
|
7
8
|
*/
|
|
8
9
|
export interface RecordPaymentFormLocalData {
|
|
9
|
-
amount:
|
|
10
|
+
amount: Amount;
|
|
10
11
|
comment: string;
|
|
11
12
|
customerId: string;
|
|
12
13
|
date: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.77-betaAK1",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
export const initialInvoicingCouponFormLocalData = {
|
|
2
|
-
applyOn: 'invoice_amount',
|
|
3
|
-
couponCode: '',
|
|
4
|
-
couponId: '',
|
|
5
|
-
discountAmount: '',
|
|
6
|
-
discountPercentage: '',
|
|
7
|
-
discountQuantity: '',
|
|
8
|
-
discountType: 'percentage',
|
|
9
|
-
durationType: 'one_time',
|
|
10
|
-
invoiceName: '',
|
|
11
|
-
invoiceNotes: '',
|
|
12
|
-
maxRedemptions: '',
|
|
13
|
-
name: '',
|
|
14
|
-
period: '',
|
|
15
|
-
periodUnit: 'month',
|
|
16
|
-
validFrom: '',
|
|
17
|
-
validTill: '',
|
|
18
|
-
};
|
|
19
|
-
/** Seed the form draft from an existing coupon entity (edit mode). */
|
|
20
|
-
export const entityToInvoicingCouponFormLocalData = (coupon) => {
|
|
21
|
-
if (coupon == null) {
|
|
22
|
-
return { ...initialInvoicingCouponFormLocalData };
|
|
23
|
-
}
|
|
24
|
-
return {
|
|
25
|
-
applyOn: coupon.applyOn ?? 'invoice_amount',
|
|
26
|
-
couponCode: coupon.couponCode ?? '',
|
|
27
|
-
couponId: coupon.id ?? '',
|
|
28
|
-
discountAmount: coupon.discountAmount != null ? String(coupon.discountAmount.amount) : '',
|
|
29
|
-
discountPercentage: coupon.discountPercentage != null
|
|
30
|
-
? String(coupon.discountPercentage)
|
|
31
|
-
: '',
|
|
32
|
-
discountQuantity: coupon.discountQuantity != null ? String(coupon.discountQuantity) : '',
|
|
33
|
-
discountType: coupon.discountType ?? 'percentage',
|
|
34
|
-
durationType: coupon.durationType ?? 'one_time',
|
|
35
|
-
invoiceName: coupon.invoiceName ?? '',
|
|
36
|
-
invoiceNotes: coupon.invoiceNotes ?? '',
|
|
37
|
-
maxRedemptions: coupon.maxRedemptions != null ? String(coupon.maxRedemptions) : '',
|
|
38
|
-
name: coupon.name ?? '',
|
|
39
|
-
period: coupon.period != null ? String(coupon.period) : '',
|
|
40
|
-
periodUnit: coupon.periodUnit ?? 'month',
|
|
41
|
-
validFrom: coupon.validFrom != null ? coupon.validFrom.format('YYYY-MM-DD') : '',
|
|
42
|
-
validTill: coupon.validTill != null ? coupon.validTill.format('YYYY-MM-DD') : '',
|
|
43
|
-
};
|
|
44
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { InvoicingCoupon } from '../../../entity/invoicing/coupon/couponState';
|
|
2
|
-
import { InvoicingCouponFormLocalData } from './editInvoicingCouponDetailViewState';
|
|
3
|
-
export declare const initialInvoicingCouponFormLocalData: InvoicingCouponFormLocalData;
|
|
4
|
-
/** Seed the form draft from an existing coupon entity (edit mode). */
|
|
5
|
-
export declare const entityToInvoicingCouponFormLocalData: (coupon?: InvoicingCoupon) => InvoicingCouponFormLocalData;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.entityToInvoicingCouponFormLocalData = exports.initialInvoicingCouponFormLocalData = void 0;
|
|
4
|
-
exports.initialInvoicingCouponFormLocalData = {
|
|
5
|
-
applyOn: 'invoice_amount',
|
|
6
|
-
couponCode: '',
|
|
7
|
-
couponId: '',
|
|
8
|
-
discountAmount: '',
|
|
9
|
-
discountPercentage: '',
|
|
10
|
-
discountQuantity: '',
|
|
11
|
-
discountType: 'percentage',
|
|
12
|
-
durationType: 'one_time',
|
|
13
|
-
invoiceName: '',
|
|
14
|
-
invoiceNotes: '',
|
|
15
|
-
maxRedemptions: '',
|
|
16
|
-
name: '',
|
|
17
|
-
period: '',
|
|
18
|
-
periodUnit: 'month',
|
|
19
|
-
validFrom: '',
|
|
20
|
-
validTill: '',
|
|
21
|
-
};
|
|
22
|
-
/** Seed the form draft from an existing coupon entity (edit mode). */
|
|
23
|
-
const entityToInvoicingCouponFormLocalData = (coupon) => {
|
|
24
|
-
if (coupon == null) {
|
|
25
|
-
return { ...exports.initialInvoicingCouponFormLocalData };
|
|
26
|
-
}
|
|
27
|
-
return {
|
|
28
|
-
applyOn: coupon.applyOn ?? 'invoice_amount',
|
|
29
|
-
couponCode: coupon.couponCode ?? '',
|
|
30
|
-
couponId: coupon.id ?? '',
|
|
31
|
-
discountAmount: coupon.discountAmount != null ? String(coupon.discountAmount.amount) : '',
|
|
32
|
-
discountPercentage: coupon.discountPercentage != null
|
|
33
|
-
? String(coupon.discountPercentage)
|
|
34
|
-
: '',
|
|
35
|
-
discountQuantity: coupon.discountQuantity != null ? String(coupon.discountQuantity) : '',
|
|
36
|
-
discountType: coupon.discountType ?? 'percentage',
|
|
37
|
-
durationType: coupon.durationType ?? 'one_time',
|
|
38
|
-
invoiceName: coupon.invoiceName ?? '',
|
|
39
|
-
invoiceNotes: coupon.invoiceNotes ?? '',
|
|
40
|
-
maxRedemptions: coupon.maxRedemptions != null ? String(coupon.maxRedemptions) : '',
|
|
41
|
-
name: coupon.name ?? '',
|
|
42
|
-
period: coupon.period != null ? String(coupon.period) : '',
|
|
43
|
-
periodUnit: coupon.periodUnit ?? 'month',
|
|
44
|
-
validFrom: coupon.validFrom != null ? coupon.validFrom.format('YYYY-MM-DD') : '',
|
|
45
|
-
validTill: coupon.validTill != null ? coupon.validTill.format('YYYY-MM-DD') : '',
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
exports.entityToInvoicingCouponFormLocalData = entityToInvoicingCouponFormLocalData;
|