@zeniai/client-epic-state 5.1.76 → 5.1.77-betaAK0
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/editInvoicingCouponDetailView/editInvoicingCouponDetailViewReducer.js +1 -1
- package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewSelector.js +1 -1
- package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewState.js +44 -1
- 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/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/editInvoicingCouponDetailView/editInvoicingCouponDetailViewReducer.js +3 -3
- package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewSelector.js +2 -2
- package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewState.d.ts +4 -0
- package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewState.js +46 -0
- 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/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
|
+
}
|
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-betaAK0",
|
|
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;
|