@zeniai/client-epic-state 5.2.7-betaRD2 → 5.2.8-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 +36 -2
- package/lib/entity/invoicing/invoicingCommonPayload.js +89 -11
- package/lib/entity/invoicing/product/productPayload.d.ts +10 -0
- package/lib/entity/invoicing/product/productPayload.js +14 -2
- package/lib/entity/jeSchedules/jeScheduleHelper.d.ts +0 -1
- package/lib/entity/jeSchedules/jeScheduleHelper.js +0 -7
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +1 -66
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +0 -135
- package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +2 -4
- package/lib/entity/jeSchedules/jeSchedulesReducer.js +2 -30
- package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +2 -11
- package/lib/entity/jeSchedules/jeSchedulesSelector.js +3 -38
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +1 -79
- package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +1 -24
- package/lib/entity/jeSchedules/jeSchedulesTypes.js +1 -88
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +0 -3
- package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +0 -2
- package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -2
- package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +0 -2
- package/lib/epic.d.ts +1 -9
- package/lib/epic.js +0 -16
- package/lib/esm/entity/invoicing/invoicingCommonPayload.js +86 -10
- package/lib/esm/entity/invoicing/product/productPayload.js +14 -2
- package/lib/esm/entity/jeSchedules/jeScheduleHelper.js +0 -6
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +1 -135
- package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +2 -30
- package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +2 -36
- package/lib/esm/entity/jeSchedules/jeSchedulesTypes.js +0 -78
- package/lib/esm/entity/snackbar/snackbarTypes.js +0 -3
- package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -2
- package/lib/esm/epic.js +0 -16
- package/lib/esm/index.js +8 -14
- package/lib/esm/view/accountList/accountListReducer.js +0 -1
- package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -6
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +5 -41
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +2 -14
- package/lib/esm/view/expenseAutomationView/payload/jeSchedulesPayload.js +0 -55
- package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +29 -306
- package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +22 -294
- package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +6 -5
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +24 -9
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +2 -1
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +6 -1
- package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +2 -0
- package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingAccountingPickersEpic.js +10 -5
- package/lib/esm/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +47 -3
- package/lib/esm/view/invoicing/settingsView/settingsViewEpics.js +17 -2
- package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +7 -3
- package/lib/esm/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
- package/lib/esm/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +2 -7
- package/lib/esm/view/scheduleView/scheduleListView/scheduleListReducer.js +3 -5
- package/lib/index.d.ts +12 -17
- package/lib/index.js +47 -91
- package/lib/view/accountList/accountListReducer.js +0 -1
- package/lib/view/accountList/accountListState.d.ts +1 -1
- package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -6
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +2 -3
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +3 -39
- package/lib/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +2 -14
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +3 -72
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.js +1 -58
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +12 -91
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +29 -308
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +1 -1
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +2 -2
- package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +7 -36
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +0 -34
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +21 -302
- package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +1 -1
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +8 -82
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -8
- package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +1 -1
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.d.ts +12 -1
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +24 -9
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.d.ts +5 -0
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +1 -0
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +6 -1
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.d.ts +1 -0
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +2 -0
- package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingAccountingPickersEpic.js +10 -5
- package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.d.ts +19 -2
- package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +52 -4
- package/lib/view/invoicing/settingsView/settingsViewEpics.d.ts +1 -1
- package/lib/view/invoicing/settingsView/settingsViewEpics.js +17 -2
- package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +11 -4
- package/lib/view/invoicing/settingsView/settingsViewSelector.js +7 -3
- package/lib/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
- package/lib/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +2 -7
- package/lib/view/scheduleView/scheduleListView/scheduleListReducer.d.ts +2 -4
- package/lib/view/scheduleView/scheduleListView/scheduleListReducer.js +3 -5
- package/package.json +1 -1
- package/lib/commonStateTypes/selectorTypes/pickAndMergeForecastSection.d.ts +0 -0
- package/lib/commonStateTypes/selectorTypes/pickAndMergeForecastSection.js +0 -1
- package/lib/entity/invoicing/coupon/couponConstants.d.ts +0 -11
- package/lib/entity/invoicing/coupon/couponConstants.js +0 -29
- package/lib/esm/commonStateTypes/selectorTypes/pickAndMergeForecastSection.js +0 -1
- package/lib/esm/entity/invoicing/coupon/couponConstants.js +0 -26
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +0 -45
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +0 -99
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +0 -25
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +0 -110
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +0 -79
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +0 -139
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +0 -106
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -22
- package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +0 -140
- package/lib/esm/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +0 -1
- package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +0 -106
- package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.js +0 -25
- package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.js +0 -15
- package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.js +0 -18
- package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.js +0 -18
- package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.js +0 -18
- package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.js +0 -16
- package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.js +0 -1
- package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.js +0 -60
- package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.js +0 -12
- package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.js +0 -1
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.d.ts +0 -20
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +0 -49
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.d.ts +0 -8
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +0 -103
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +0 -8
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +0 -29
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +0 -45
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +0 -114
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +0 -8
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +0 -83
- package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.d.ts +0 -12
- package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +0 -146
- package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.d.ts +0 -64
- package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +0 -110
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +0 -6
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -26
- package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +0 -36
- package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +0 -145
- package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +0 -42
- package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +0 -2
- package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +0 -21
- package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +0 -112
- package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.d.ts +0 -6
- package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.js +0 -29
- package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.d.ts +0 -6
- package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.js +0 -19
- package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.d.ts +0 -8
- package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.js +0 -22
- package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.d.ts +0 -8
- package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.js +0 -22
- package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.d.ts +0 -8
- package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.js +0 -22
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.d.ts +0 -13
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.js +0 -20
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.d.ts +0 -11
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.js +0 -2
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.d.ts +0 -7
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.js +0 -64
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.d.ts +0 -12
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.js +0 -15
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.d.ts +0 -9
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.js +0 -2
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.localDataToSaveInvoicingCatalogItemPayload = void 0;
|
|
4
|
+
const accountPayload_1 = require("../../../entity/account/accountPayload");
|
|
5
|
+
const classPayload_1 = require("../../../entity/class/classPayload");
|
|
4
6
|
const invoicingCatalogItemFormConfig_1 = require("./invoicingCatalogItemFormConfig");
|
|
5
7
|
const CURRENCY_CODE = 'USD';
|
|
6
8
|
const trimOrUndefined = (value) => value.trim() !== '' ? value.trim() : undefined;
|
|
@@ -10,20 +12,26 @@ const toProductCode = (value) => value
|
|
|
10
12
|
.toLowerCase()
|
|
11
13
|
.replace(/[^a-z0-9]+/g, '-')
|
|
12
14
|
.replace(/^-|-$/g, '');
|
|
13
|
-
const buildAccountingDetail = (subFamily) => {
|
|
15
|
+
const buildAccountingDetail = (subFamily, lookup) => {
|
|
14
16
|
const detail = {};
|
|
15
17
|
if (subFamily.sku.trim() !== '') {
|
|
16
18
|
detail.sku = subFamily.sku.trim();
|
|
17
19
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
// The account and class travel as whole objects rather than bare codes, built
|
|
21
|
+
// by the same helpers the transaction and vendor payloads use. An id that no
|
|
22
|
+
// longer resolves is dropped: sending a code the service cannot expand is how
|
|
23
|
+
// a mapping silently lands on the wrong account.
|
|
24
|
+
const account = lookup.accountByQboId(subFamily.accountingCode.trim());
|
|
25
|
+
if (account != null) {
|
|
26
|
+
detail.account = (0, accountPayload_1.toAccountPayload)(account);
|
|
20
27
|
}
|
|
21
|
-
|
|
22
|
-
|
|
28
|
+
const accountingClass = lookup.classByQboId(subFamily.accountingCategory.trim());
|
|
29
|
+
if (accountingClass != null) {
|
|
30
|
+
detail.accounting_class = (0, classPayload_1.toClassBasePayload)(accountingClass);
|
|
23
31
|
}
|
|
24
32
|
return Object.keys(detail).length > 0 ? detail : undefined;
|
|
25
33
|
};
|
|
26
|
-
const buildSubFamilyPayload = (localData, subFamily, clearEmptyValues) => {
|
|
34
|
+
const buildSubFamilyPayload = (localData, subFamily, clearEmptyValues, lookup) => {
|
|
27
35
|
const isAddon = localData.catalogType === 'addon';
|
|
28
36
|
const tiered = (0, invoicingCatalogItemFormConfig_1.isTieredCatalogPricingModel)(subFamily.pricingModel);
|
|
29
37
|
const name = subFamily.name.trim();
|
|
@@ -77,7 +85,7 @@ const buildSubFamilyPayload = (localData, subFamily, clearEmptyValues) => {
|
|
|
77
85
|
starting_unit: Number(tier.startingUnit) || 1,
|
|
78
86
|
}));
|
|
79
87
|
}
|
|
80
|
-
const accountingDetail = buildAccountingDetail(subFamily);
|
|
88
|
+
const accountingDetail = buildAccountingDetail(subFamily, lookup);
|
|
81
89
|
if (accountingDetail != null) {
|
|
82
90
|
payload.accounting_detail = accountingDetail;
|
|
83
91
|
}
|
|
@@ -89,7 +97,7 @@ const DEFAULT_CATALOG_ITEM_UNIT = 'USD';
|
|
|
89
97
|
* Build the parent catalog-item request body from the form draft. Creates omit
|
|
90
98
|
* both parent and sub-family IDs; edits retain returned sub-family IDs.
|
|
91
99
|
*/
|
|
92
|
-
const localDataToSaveInvoicingCatalogItemPayload = (localData, isCreate) => {
|
|
100
|
+
const localDataToSaveInvoicingCatalogItemPayload = (localData, isCreate, lookup) => {
|
|
93
101
|
const description = trimOrUndefined(localData.description);
|
|
94
102
|
const productCode = trimOrUndefined(localData.productCode) ?? toProductCode(localData.name);
|
|
95
103
|
const itemPayload = {
|
|
@@ -117,7 +125,7 @@ const localDataToSaveInvoicingCatalogItemPayload = (localData, isCreate) => {
|
|
|
117
125
|
? localData.subFamilies
|
|
118
126
|
: [(0, invoicingCatalogItemFormConfig_1.blankInvoicingCatalogSubFamily)()];
|
|
119
127
|
itemPayload.sub_family_details = isCreate
|
|
120
|
-
? subFamilies.map((subFamily) => buildSubFamilyPayload(localData, subFamily, false))
|
|
128
|
+
? subFamilies.map((subFamily) => buildSubFamilyPayload(localData, subFamily, false, lookup))
|
|
121
129
|
: subFamilies.map((subFamily) => {
|
|
122
130
|
const priceCode = trimOrUndefined(subFamily.priceCode) ?? toProductCode(subFamily.name);
|
|
123
131
|
const detail = {
|
|
@@ -127,6 +135,13 @@ const localDataToSaveInvoicingCatalogItemPayload = (localData, isCreate) => {
|
|
|
127
135
|
price_code: priceCode,
|
|
128
136
|
show_description_in_invoices: subFamily.showDescriptionInInvoices,
|
|
129
137
|
};
|
|
138
|
+
// Edits send a narrower body than creates, but the accounting mapping
|
|
139
|
+
// is editable on this form, so leaving it out dropped the account and
|
|
140
|
+
// class the user had just picked.
|
|
141
|
+
const accountingDetail = buildAccountingDetail(subFamily, lookup);
|
|
142
|
+
if (accountingDetail != null) {
|
|
143
|
+
detail.accounting_detail = accountingDetail;
|
|
144
|
+
}
|
|
130
145
|
const id = trimOrUndefined(subFamily.id);
|
|
131
146
|
return id != null ? { ...detail, id } : detail;
|
|
132
147
|
});
|
|
@@ -37,6 +37,11 @@ export interface InvoicingCatalogItemFormView extends SelectorView {
|
|
|
37
37
|
* Folded in here so the screen never reaches for the config view itself.
|
|
38
38
|
*/
|
|
39
39
|
fieldHelp: InvoicingFieldHelpByCode;
|
|
40
|
+
/**
|
|
41
|
+
* True while the accounting lists are still loading, so the form can wait
|
|
42
|
+
* instead of mounting pickers whose options are not there yet.
|
|
43
|
+
*/
|
|
44
|
+
isQboPickerDataLoading: boolean;
|
|
40
45
|
localData: InvoicingCatalogItemFormLocalData;
|
|
41
46
|
mode: 'create' | 'edit';
|
|
42
47
|
periodUnitOptions: InvoicingNamedOption[];
|
|
@@ -59,6 +59,7 @@ const getInvoicingCatalogItemFormView = (state, id) => {
|
|
|
59
59
|
const { billingPeriodUnitOptions, catalogItemTypeOptions, catalogTierTypeOptionsByPricingModel, catalogTrialEndActionOptions, catalogTrialUnitOptions, } = (0, invoicingConfigViewSelector_1.getInvoicingConfigView)(state);
|
|
60
60
|
return {
|
|
61
61
|
fieldHelp: (0, invoicingConfigViewSelector_1.invoicingFieldHelpForGroup)(state, 'catalog'),
|
|
62
|
+
isQboPickerDataLoading: (0, invoicingQboViewSelector_1.isInvoicingAccountingPickerDataLoading)(state),
|
|
62
63
|
qboClassHierarchy: isQboConnected
|
|
63
64
|
? (0, invoicingQboViewSelector_1.getInvoicingQboView)(state).nestedClassHierarchy
|
|
64
65
|
: [],
|
package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js
CHANGED
|
@@ -9,6 +9,7 @@ const snackbarApiError_1 = require("../../../entity/snackbar/snackbarApiError");
|
|
|
9
9
|
const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
|
|
10
10
|
const responsePayload_1 = require("../../../responsePayload");
|
|
11
11
|
const invoicingCatalogListViewReducer_1 = require("../invoicingCatalogListView/invoicingCatalogListViewReducer");
|
|
12
|
+
const invoicingQboViewSelector_1 = require("../invoicingQboView/invoicingQboViewSelector");
|
|
12
13
|
const editInvoicingCatalogItemDetailViewPayload_1 = require("./editInvoicingCatalogItemDetailViewPayload");
|
|
13
14
|
const editInvoicingCatalogItemDetailViewReducer_1 = require("./editInvoicingCatalogItemDetailViewReducer");
|
|
14
15
|
const saveInvoicingCatalogItemEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)((action) => editInvoicingCatalogItemDetailViewReducer_1.submitInvoicingCatalogItemForm.match(action) ||
|
|
@@ -23,7 +24,11 @@ const saveInvoicingCatalogItemEpic = (actions$, state$, zeniAPI) => actions$.pip
|
|
|
23
24
|
const viewState = state$.value.editInvoicingCatalogItemDetailViewState;
|
|
24
25
|
const localData = (id != null ? viewState.editDraftById[id] : viewState.newItemDraft) ??
|
|
25
26
|
viewState.newItemDraft;
|
|
26
|
-
|
|
27
|
+
const state = state$.value;
|
|
28
|
+
data = (0, editInvoicingCatalogItemDetailViewPayload_1.localDataToSaveInvoicingCatalogItemPayload)(localData, id == null, {
|
|
29
|
+
accountByQboId: (qboId) => (0, invoicingQboViewSelector_1.invoicingQboAccountByQboId)(state, qboId),
|
|
30
|
+
classByQboId: (qboId) => (0, invoicingQboViewSelector_1.invoicingQboClassByQboId)(state, qboId),
|
|
31
|
+
});
|
|
27
32
|
}
|
|
28
33
|
const baseUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0`;
|
|
29
34
|
const path = id != null
|
|
@@ -32,6 +32,7 @@ export interface InvoicingOnboardingGateView {
|
|
|
32
32
|
acceptTermsState: FetchStateAndError;
|
|
33
33
|
enableState: FetchStateAndError;
|
|
34
34
|
fetchState: FetchState;
|
|
35
|
+
isQboConnected: boolean;
|
|
35
36
|
status?: InvoicingOnboardingStatus;
|
|
36
37
|
}
|
|
37
38
|
export declare const getInvoicingOnboardingGateView: (state: RootState) => InvoicingOnboardingGateView;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.invoicingFieldHelpForGroup = exports.getInvoicingOnboardingGateView = exports.getInvoicingConfigView = void 0;
|
|
4
|
+
const invoicingQboViewSelector_1 = require("../invoicingQboView/invoicingQboViewSelector");
|
|
4
5
|
const invoicingConfigViewPayload_1 = require("./invoicingConfigViewPayload");
|
|
5
6
|
const getInvoicingConfigView = (state) => {
|
|
6
7
|
const { acceptTermsFetchState, enableFetchState, ...configState } = state.invoicingConfigViewState;
|
|
@@ -18,6 +19,7 @@ const getInvoicingOnboardingGateView = (state) => {
|
|
|
18
19
|
acceptTermsState: acceptTermsFetchState,
|
|
19
20
|
enableState: enableFetchState,
|
|
20
21
|
fetchState,
|
|
22
|
+
isQboConnected: (0, invoicingQboViewSelector_1.isInvoicingQboConnected)(state),
|
|
21
23
|
status: (0, invoicingConfigViewPayload_1.deriveInvoicingOnboardingStatus)(state.invoicingConfigViewState.isInvoicingTosAccepted, state.invoicingConfigViewState.isInvoicingEnabled),
|
|
22
24
|
};
|
|
23
25
|
};
|
|
@@ -12,12 +12,17 @@ const invoicingQboViewSelector_1 = require("../invoicingQboViewSelector");
|
|
|
12
12
|
const fetchInvoicingAccountingPickersEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(invoicingQboViewReducer_1.fetchInvoicingAccountingPickers.match), (0, operators_1.withLatestFrom)(state$), (0, operators_1.mergeMap)(([, state]) => {
|
|
13
13
|
const actions = [];
|
|
14
14
|
const accountList = state.accountListState.byReportId[invoicingQboViewSelector_1.INVOICING_ACCOUNT_LIST_KEY];
|
|
15
|
-
|
|
15
|
+
// `hasValidState` only reports that a fetch finished, not that it
|
|
16
|
+
// returned anything usable. The shared bucket can be Completed and empty
|
|
17
|
+
// because a screen that needs fewer accounts filled it first, which would
|
|
18
|
+
// leave the invoicing pickers empty with no request in flight to fix it.
|
|
19
|
+
const isAccountListUsable = accountList.hasValidState() && accountList.accountIds.length > 0;
|
|
20
|
+
if (isAccountListUsable === false &&
|
|
16
21
|
accountList.fetchState !== 'In-Progress') {
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
actions.push((0, accountListReducer_1.fetchAccountList)(invoicingQboViewSelector_1.INVOICING_ACCOUNT_LIST_KEY, true
|
|
22
|
+
// Same arguments the vendor and categorization screens pass, so this
|
|
23
|
+
// shares their cached list rather than replacing it with a narrower one.
|
|
24
|
+
// Invoicing narrows to income accounts when it builds its options.
|
|
25
|
+
actions.push((0, accountListReducer_1.fetchAccountList)(invoicingQboViewSelector_1.INVOICING_ACCOUNT_LIST_KEY, true));
|
|
21
26
|
}
|
|
22
27
|
const classList = state.classListState;
|
|
23
28
|
if (classList.hasValidState() === false &&
|
|
@@ -1,17 +1,34 @@
|
|
|
1
1
|
import { NestedAccountHierarchyForReport } from '../../../commonStateTypes/accountView/nestedAccountID';
|
|
2
2
|
import { NestedClassHierarchyForReport } from '../../../commonStateTypes/classesView/nestedClassID';
|
|
3
3
|
import { FetchStateAndError } from '../../../commonStateTypes/common';
|
|
4
|
-
import { AccountType } from '../../../entity/account/accountState';
|
|
4
|
+
import { AccountBase, AccountType } from '../../../entity/account/accountState';
|
|
5
|
+
import { ClassBase } from '../../../entity/class/classState';
|
|
5
6
|
import { RootState } from '../../../rootStateTypes';
|
|
6
7
|
import { InvoicingQboConnection, InvoicingQboSyncHealth } from './invoicingQboViewPayload';
|
|
7
|
-
export declare const INVOICING_ACCOUNT_LIST_KEY: "
|
|
8
|
+
export declare const INVOICING_ACCOUNT_LIST_KEY: "accountList";
|
|
8
9
|
/** Whether QBO is connected, without building the option lists to find out. */
|
|
9
10
|
export declare const isInvoicingQboConnected: (state: RootState) => boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Whether the accounting pickers are still waiting on their data. Only true when
|
|
13
|
+
* QBO is connected: a tenant without it has no pickers to populate, so the form
|
|
14
|
+
* must not sit behind a skeleton waiting for lists it will never show.
|
|
15
|
+
*/
|
|
16
|
+
export declare const isInvoicingAccountingPickerDataLoading: (state: RootState) => boolean;
|
|
17
|
+
/** The QBO connection fetch on its own, without building the bundled view. */
|
|
18
|
+
export declare const getInvoicingQboConnectionFetchState: (state: RootState) => FetchStateAndError;
|
|
10
19
|
/**
|
|
11
20
|
* Account types that can back invoicing revenue. Named here so screens ask for
|
|
12
21
|
* "income accounts" rather than repeating the accounting service's vocabulary.
|
|
13
22
|
*/
|
|
14
23
|
export declare const INVOICING_INCOME_ACCOUNT_TYPES: readonly AccountType[];
|
|
24
|
+
/**
|
|
25
|
+
* The account behind a picker value. The pickers submit the QuickBooks id, so
|
|
26
|
+
* that is what callers hold; the payload builders need the whole entity to send
|
|
27
|
+
* `toAccountPayload`, which is why the lookup lives here next to the options.
|
|
28
|
+
*/
|
|
29
|
+
export declare const invoicingQboAccountByQboId: (state: RootState, qboId: string | undefined) => AccountBase | undefined;
|
|
30
|
+
/** The class behind a picker value, for the same reason as the account above. */
|
|
31
|
+
export declare const invoicingQboClassByQboId: (state: RootState, qboId: string | undefined) => ClassBase | undefined;
|
|
15
32
|
/** An account or class as the invoicing pickers render and submit it. */
|
|
16
33
|
export interface InvoicingAccountingOption {
|
|
17
34
|
id: string;
|
|
@@ -1,14 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getInvoicingQboView = exports.invoicingAccountHierarchyForTypes = exports.invoicingAccountsForQboAccountTypes = exports.INVOICING_INCOME_ACCOUNT_TYPES = exports.isInvoicingQboConnected = exports.INVOICING_ACCOUNT_LIST_KEY = void 0;
|
|
3
|
+
exports.getInvoicingQboView = exports.invoicingAccountHierarchyForTypes = exports.invoicingAccountsForQboAccountTypes = exports.invoicingQboClassByQboId = exports.invoicingQboAccountByQboId = exports.INVOICING_INCOME_ACCOUNT_TYPES = exports.getInvoicingQboConnectionFetchState = exports.isInvoicingAccountingPickerDataLoading = exports.isInvoicingQboConnected = exports.INVOICING_ACCOUNT_LIST_KEY = void 0;
|
|
4
4
|
const accountListSelector_1 = require("../../accountList/accountListSelector");
|
|
5
5
|
const classListSelector_1 = require("../../classList/classListSelector");
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
|
|
6
|
+
// The shared bucket, fetched with the same arguments as the other consumers so
|
|
7
|
+
// whichever screen loads first satisfies the rest. Invoicing narrows to income
|
|
8
|
+
// accounts when it builds its options, so it does not need its own copy.
|
|
9
|
+
exports.INVOICING_ACCOUNT_LIST_KEY = 'accountList';
|
|
9
10
|
/** Whether QBO is connected, without building the option lists to find out. */
|
|
10
11
|
const isInvoicingQboConnected = (state) => state.invoicingQboViewState.connection?.connected === true;
|
|
11
12
|
exports.isInvoicingQboConnected = isInvoicingQboConnected;
|
|
13
|
+
/**
|
|
14
|
+
* Whether the accounting pickers are still waiting on their data. Only true when
|
|
15
|
+
* QBO is connected: a tenant without it has no pickers to populate, so the form
|
|
16
|
+
* must not sit behind a skeleton waiting for lists it will never show.
|
|
17
|
+
*/
|
|
18
|
+
const isInvoicingAccountingPickerDataLoading = (state) => {
|
|
19
|
+
const isPending = (fetchState) => fetchState === 'Not-Started' || fetchState === 'In-Progress';
|
|
20
|
+
// The connection settles first and decides whether the lists are fetched at
|
|
21
|
+
// all, so it counts as loading too. Reporting "not loading" while it is in
|
|
22
|
+
// flight renders the form, then takes it away again the moment the tenant
|
|
23
|
+
// turns out to be connected.
|
|
24
|
+
if (isPending((0, exports.getInvoicingQboConnectionFetchState)(state).fetchState)) {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
if (!(0, exports.isInvoicingQboConnected)(state)) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
const accountList = state.accountListState.byReportId[exports.INVOICING_ACCOUNT_LIST_KEY];
|
|
31
|
+
return (isPending(accountList.fetchState) ||
|
|
32
|
+
isPending(state.classListState.fetchState));
|
|
33
|
+
};
|
|
34
|
+
exports.isInvoicingAccountingPickerDataLoading = isInvoicingAccountingPickerDataLoading;
|
|
35
|
+
/** The QBO connection fetch on its own, without building the bundled view. */
|
|
36
|
+
const getInvoicingQboConnectionFetchState = (state) => state.invoicingQboViewState.connectionFetchState;
|
|
37
|
+
exports.getInvoicingQboConnectionFetchState = getInvoicingQboConnectionFetchState;
|
|
12
38
|
/**
|
|
13
39
|
* Account types that can back invoicing revenue. Named here so screens ask for
|
|
14
40
|
* "income accounts" rather than repeating the accounting service's vocabulary.
|
|
@@ -17,6 +43,28 @@ exports.INVOICING_INCOME_ACCOUNT_TYPES = [
|
|
|
17
43
|
'income',
|
|
18
44
|
'other_income',
|
|
19
45
|
];
|
|
46
|
+
/**
|
|
47
|
+
* The account behind a picker value. The pickers submit the QuickBooks id, so
|
|
48
|
+
* that is what callers hold; the payload builders need the whole entity to send
|
|
49
|
+
* `toAccountPayload`, which is why the lookup lives here next to the options.
|
|
50
|
+
*/
|
|
51
|
+
const invoicingQboAccountByQboId = (state, qboId) => {
|
|
52
|
+
if (qboId == null || qboId === '') {
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
const { accounts } = (0, accountListSelector_1.getAccountList)(state.accountState, state.accountListState, exports.INVOICING_ACCOUNT_LIST_KEY);
|
|
56
|
+
return accounts.find((account) => String(account.qboId) === qboId);
|
|
57
|
+
};
|
|
58
|
+
exports.invoicingQboAccountByQboId = invoicingQboAccountByQboId;
|
|
59
|
+
/** The class behind a picker value, for the same reason as the account above. */
|
|
60
|
+
const invoicingQboClassByQboId = (state, qboId) => {
|
|
61
|
+
if (qboId == null || qboId === '') {
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
const { classes } = (0, classListSelector_1.getClassList)(state.classState, state.classListState);
|
|
65
|
+
return classes.find((accountingClass) => String(accountingClass.qboId) === qboId);
|
|
66
|
+
};
|
|
67
|
+
exports.invoicingQboClassByQboId = invoicingQboClassByQboId;
|
|
20
68
|
/**
|
|
21
69
|
* Accounts and classes as the invoicing pickers need them. Both come from the
|
|
22
70
|
* shared accounting-service lists, so whatever another screen already loaded
|
|
@@ -9,4 +9,4 @@ export type ActionType = ReturnType<typeof fetchInvoicingSettings> | ReturnType<
|
|
|
9
9
|
export declare const fetchInvoicingSettingsEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
10
10
|
export declare const connectInvoicingStripeEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
11
11
|
export declare const disconnectInvoicingStripeEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
12
|
-
export declare const saveInvoicingSettingsEpic: (actions$: ActionsObservable<ActionType>,
|
|
12
|
+
export declare const saveInvoicingSettingsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -4,9 +4,11 @@ exports.saveInvoicingSettingsEpic = exports.disconnectInvoicingStripeEpic = expo
|
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const addressReducer_1 = require("../../../entity/address/addressReducer");
|
|
7
|
+
const invoicingCommonPayload_1 = require("../../../entity/invoicing/invoicingCommonPayload");
|
|
7
8
|
const snackbarApiError_1 = require("../../../entity/snackbar/snackbarApiError");
|
|
8
9
|
const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
|
|
9
10
|
const responsePayload_1 = require("../../../responsePayload");
|
|
11
|
+
const invoicingQboViewSelector_1 = require("../invoicingQboView/invoicingQboViewSelector");
|
|
10
12
|
const settingsViewReducer_1 = require("./settingsViewReducer");
|
|
11
13
|
const fetchInvoicingSettingsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.fetchInvoicingSettings.match), (0, operators_1.switchMap)(() => {
|
|
12
14
|
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/settings`;
|
|
@@ -63,9 +65,22 @@ const disconnectInvoicingStripeEpic = (actions$, _state$, zeniAPI) => actions$.p
|
|
|
63
65
|
JSON.stringify(error))))));
|
|
64
66
|
}));
|
|
65
67
|
exports.disconnectInvoicingStripeEpic = disconnectInvoicingStripeEpic;
|
|
66
|
-
const saveInvoicingSettingsEpic = (actions$,
|
|
68
|
+
const saveInvoicingSettingsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.saveInvoicingSettings.match), (0, operators_1.mergeMap)((action) => {
|
|
67
69
|
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/settings`;
|
|
68
70
|
const { settings, snackbarSection } = action.payload;
|
|
71
|
+
// The QBO page edits mappings as picker ids; the service stores whole
|
|
72
|
+
// accounts. Expanded here, at the request boundary, so the page does not
|
|
73
|
+
// have to hold entities it only needs in order to save.
|
|
74
|
+
const qboSettings = settings.qbo;
|
|
75
|
+
const body = qboSettings?.account_mappings != null
|
|
76
|
+
? {
|
|
77
|
+
...settings,
|
|
78
|
+
qbo: {
|
|
79
|
+
...qboSettings,
|
|
80
|
+
account_mappings: (0, invoicingCommonPayload_1.withInvoicingQboMappedAccounts)(qboSettings.account_mappings, (qboId) => (0, invoicingQboViewSelector_1.invoicingQboAccountByQboId)(state$.value, qboId)),
|
|
81
|
+
},
|
|
82
|
+
}
|
|
83
|
+
: settings;
|
|
69
84
|
/** `status` surfaces the platform's error text; omit it to keep the generic copy. */
|
|
70
85
|
const snackbar = (messageText, status) => snackbarSection == null
|
|
71
86
|
? []
|
|
@@ -78,7 +93,7 @@ const saveInvoicingSettingsEpic = (actions$, _state$, zeniAPI) => actions$.pipe(
|
|
|
78
93
|
}),
|
|
79
94
|
];
|
|
80
95
|
return zeniAPI
|
|
81
|
-
.putAndGetJSON(apiUrl, { ...
|
|
96
|
+
.putAndGetJSON(apiUrl, { ...body })
|
|
82
97
|
.pipe((0, operators_1.switchMap)((response) => {
|
|
83
98
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
84
99
|
return (0, rxjs_1.from)([
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FetchState, FetchStateAndError } from '../../../commonStateTypes/common';
|
|
2
2
|
import { InvoicingDunningActionOption, InvoicingNamedOption, InvoicingQboAccountMappingKindOption, InvoicingSettingsPayload } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
3
|
-
import { RootState } from '../../../rootStateTypes';
|
|
4
3
|
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
4
|
+
import { RootState } from '../../../rootStateTypes';
|
|
5
5
|
import { InvoicingBrandingFormLocalData } from './invoicingBrandingFormConfig';
|
|
6
6
|
/**
|
|
7
7
|
* Shared primitive: the raw invoicing settings. Consumed internally by other
|
|
@@ -53,6 +53,12 @@ export interface InvoicingSettingsHubView {
|
|
|
53
53
|
configFetchState: FetchState;
|
|
54
54
|
dunningScheduleActionOptions: InvoicingDunningActionOption[];
|
|
55
55
|
isEnablingInvoicing: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Whether the tenant has already enabled invoicing. The enable footer is for
|
|
58
|
+
* tenants that have not, so this — not `canEnableInvoicing` — decides whether
|
|
59
|
+
* it renders at all.
|
|
60
|
+
*/
|
|
61
|
+
isInvoicingEnabled: boolean;
|
|
56
62
|
isQboConfigured: boolean;
|
|
57
63
|
isStripeConnected: boolean;
|
|
58
64
|
qboAccountMappingKindOptions: InvoicingQboAccountMappingKindOption[];
|
|
@@ -67,9 +73,10 @@ export interface InvoicingSettingsHubView {
|
|
|
67
73
|
* two integration prerequisites kept separate so the hub can name the step still
|
|
68
74
|
* outstanding instead of showing a dead button.
|
|
69
75
|
*
|
|
70
|
-
* `
|
|
71
|
-
*
|
|
72
|
-
*
|
|
76
|
+
* `isInvoicingEnabled` decides whether the footer renders; `canEnableInvoicing`
|
|
77
|
+
* whether its button is live, and it still requires the onboarding step so the
|
|
78
|
+
* terms cannot be skipped. A tenant partway through therefore sees the footer,
|
|
79
|
+
* disabled and naming what is left, rather than nothing at all.
|
|
73
80
|
*
|
|
74
81
|
* Deliberately not folded into `getInvoicingConfigView`: that selector gates
|
|
75
82
|
* every invoicing route and stays a pure read of the config slice. The settings
|
|
@@ -70,9 +70,10 @@ function deriveInvoicingEnablePrerequisites(settings, isQboConnected, qboAccount
|
|
|
70
70
|
* two integration prerequisites kept separate so the hub can name the step still
|
|
71
71
|
* outstanding instead of showing a dead button.
|
|
72
72
|
*
|
|
73
|
-
* `
|
|
74
|
-
*
|
|
75
|
-
*
|
|
73
|
+
* `isInvoicingEnabled` decides whether the footer renders; `canEnableInvoicing`
|
|
74
|
+
* whether its button is live, and it still requires the onboarding step so the
|
|
75
|
+
* terms cannot be skipped. A tenant partway through therefore sees the footer,
|
|
76
|
+
* disabled and naming what is left, rather than nothing at all.
|
|
76
77
|
*
|
|
77
78
|
* Deliberately not folded into `getInvoicingConfigView`: that selector gates
|
|
78
79
|
* every invoicing route and stays a pure read of the config slice. The settings
|
|
@@ -82,7 +83,10 @@ const getInvoicingSettingsHubView = (state) => {
|
|
|
82
83
|
const { dunningScheduleActionOptions, enableState, error: configError, fetchState: configFetchState, qboAccountMappingKindOptions, qboCustomerMatchingOptions, qboSyncStatusOptions, status, } = (0, invoicingConfigViewSelector_1.getInvoicingConfigView)(state);
|
|
83
84
|
const { canEnable, isQboConfigured, isStripeConnected } = deriveInvoicingEnablePrerequisites(state.invoicingSettingsViewState.settings, state.invoicingQboViewState.connection?.connected === true, qboAccountMappingKindOptions);
|
|
84
85
|
return {
|
|
86
|
+
// Keeps the onboarding step in the gate: a tenant that has not accepted the
|
|
87
|
+
// terms cannot enable invoicing, whatever the integrations say.
|
|
85
88
|
canEnableInvoicing: status === 'settings' && canEnable,
|
|
89
|
+
isInvoicingEnabled: state.invoicingConfigViewState.isInvoicingEnabled === true,
|
|
86
90
|
configError,
|
|
87
91
|
configFetchState,
|
|
88
92
|
dunningScheduleActionOptions,
|
|
@@ -33,7 +33,7 @@ const fetchAccruedScheduleListEpic = (actions$, state$, zeniAPI) => actions$.pip
|
|
|
33
33
|
je_schedule_type: scheduleType,
|
|
34
34
|
sort_by: 'transaction_date',
|
|
35
35
|
sort_order: 'desc',
|
|
36
|
-
filter:
|
|
36
|
+
filter: 'all',
|
|
37
37
|
};
|
|
38
38
|
return zeniAPI
|
|
39
39
|
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/schedules?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
|
|
@@ -10,14 +10,9 @@ const responsePayload_1 = require("../../../../responsePayload");
|
|
|
10
10
|
const scheduleListReducer_1 = require("../scheduleListReducer");
|
|
11
11
|
const scheduleListTypes_1 = require("../scheduleListTypes");
|
|
12
12
|
const fetchDownloadSchedulesEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(scheduleListReducer_1.fetchDownloadSchedules.match), (0, operators_1.mergeMap)((action) => {
|
|
13
|
-
const { scheduleType, downloadCategories
|
|
13
|
+
const { scheduleType, downloadCategories } = action.payload;
|
|
14
14
|
const scheduleListState = state$.value.scheduleListState;
|
|
15
15
|
// if parameters are provided, use those. else go to localdata
|
|
16
|
-
// Accrued is deliberately not served here. Its rows come back in a different shape, this
|
|
17
|
-
// epic writes them through updateJESchedules (the prepaid / fixed mapper), and
|
|
18
|
-
// doUpdateScheduleList never flips downloadState for accrued -- so a request would store the
|
|
19
|
-
// wrong data and then never report completion. Accrued downloads go through
|
|
20
|
-
// fetchAccruedScheduleList, which owns that shape end to end.
|
|
21
16
|
let scheduleState;
|
|
22
17
|
if (scheduleType !== 'accrued_expenses') {
|
|
23
18
|
scheduleState = (0, scheduleListReducer_1.getState)(scheduleListState, scheduleType);
|
|
@@ -42,7 +37,7 @@ const fetchDownloadSchedulesEpic = (actions$, state$, zeniAPI) => actions$.pipe(
|
|
|
42
37
|
base_txn_account_ids: downloadCategories,
|
|
43
38
|
sort_by: 'transaction_date',
|
|
44
39
|
sort_order: 'desc',
|
|
45
|
-
filter:
|
|
40
|
+
filter: 'all',
|
|
46
41
|
};
|
|
47
42
|
return zeniAPI
|
|
48
43
|
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/schedules/download?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
|
|
@@ -16,7 +16,7 @@ export declare const initialState: ScheduleListViewState;
|
|
|
16
16
|
export declare const fetchDownloadSchedules: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue", timeframeAndCategory: {
|
|
17
17
|
selectedCategoryId: ID;
|
|
18
18
|
selectedTimeframe: TimeframeTick;
|
|
19
|
-
}, downloadCategories: string[],
|
|
19
|
+
}, downloadCategories: string[], cacheOverride?: any], {
|
|
20
20
|
timeframeAndCategory: {
|
|
21
21
|
selectedCategoryId: ID;
|
|
22
22
|
selectedTimeframe: TimeframeTick;
|
|
@@ -24,18 +24,16 @@ export declare const fetchDownloadSchedules: import("@reduxjs/toolkit").ActionCr
|
|
|
24
24
|
scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue";
|
|
25
25
|
cacheOverride: any;
|
|
26
26
|
downloadCategories: string[];
|
|
27
|
-
statusFilter: "completed" | "new" | "ongoing" | "all";
|
|
28
27
|
}, "scheduleListView/fetchDownloadSchedules", never, never>, fetchAccruedScheduleList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue", timeframeAndCategory?: {
|
|
29
28
|
selectedCategoryId: ID;
|
|
30
29
|
selectedTimeframe: TimeframeTick;
|
|
31
|
-
} | undefined, cacheOverride?: any
|
|
30
|
+
} | undefined, cacheOverride?: any], {
|
|
32
31
|
timeframeAndCategory: {
|
|
33
32
|
selectedCategoryId: ID;
|
|
34
33
|
selectedTimeframe: TimeframeTick;
|
|
35
34
|
} | undefined;
|
|
36
35
|
scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue";
|
|
37
36
|
cacheOverride: any;
|
|
38
|
-
statusFilter: "completed" | "new" | "ongoing" | "all";
|
|
39
37
|
}, "scheduleListView/fetchAccruedScheduleList", never, never>, fetchScheduleList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue", timeframeAndCategory?: {
|
|
40
38
|
selectedCategoryId: ID;
|
|
41
39
|
selectedTimeframe: TimeframeTick;
|
|
@@ -90,8 +90,8 @@ const scheduleListView = (0, toolkit_1.createSlice)({
|
|
|
90
90
|
reducers: {
|
|
91
91
|
fetchDownloadSchedules: {
|
|
92
92
|
reducer(draft, action) {
|
|
93
|
-
// Accrued is not downloaded through this action -- see fetchDownloadSchedulesEpic for why.
|
|
94
93
|
if (action.payload.scheduleType !== 'accrued_expenses') {
|
|
94
|
+
//if condition added for type narrowing
|
|
95
95
|
const state = getState(draft, action.payload.scheduleType);
|
|
96
96
|
const selectedTimeframe = action.payload.timeframeAndCategory.selectedTimeframe;
|
|
97
97
|
const selectedCategoryId = action.payload.timeframeAndCategory.selectedCategoryId;
|
|
@@ -115,14 +115,13 @@ const scheduleListView = (0, toolkit_1.createSlice)({
|
|
|
115
115
|
updateState(draft, action.payload.scheduleType, state);
|
|
116
116
|
}
|
|
117
117
|
},
|
|
118
|
-
prepare(scheduleType, timeframeAndCategory, downloadCategories,
|
|
118
|
+
prepare(scheduleType, timeframeAndCategory, downloadCategories, cacheOverride = false) {
|
|
119
119
|
return {
|
|
120
120
|
payload: {
|
|
121
121
|
timeframeAndCategory,
|
|
122
122
|
scheduleType,
|
|
123
123
|
cacheOverride,
|
|
124
124
|
downloadCategories,
|
|
125
|
-
statusFilter,
|
|
126
125
|
},
|
|
127
126
|
};
|
|
128
127
|
},
|
|
@@ -158,13 +157,12 @@ const scheduleListView = (0, toolkit_1.createSlice)({
|
|
|
158
157
|
updateState(draft, action.payload.scheduleType, state);
|
|
159
158
|
}
|
|
160
159
|
},
|
|
161
|
-
prepare(scheduleType, timeframeAndCategory, cacheOverride = false
|
|
160
|
+
prepare(scheduleType, timeframeAndCategory, cacheOverride = false) {
|
|
162
161
|
return {
|
|
163
162
|
payload: {
|
|
164
163
|
timeframeAndCategory,
|
|
165
164
|
scheduleType,
|
|
166
165
|
cacheOverride,
|
|
167
|
-
statusFilter,
|
|
168
166
|
},
|
|
169
167
|
};
|
|
170
168
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.8-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",
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { InvoicingFormOption } from '../invoicingCommonPayload';
|
|
2
|
-
import { InvoicingCouponApplyOn, InvoicingCouponDurationType, InvoicingCouponPeriodUnit, InvoicingDiscountType } from './couponPayload';
|
|
3
|
-
/**
|
|
4
|
-
* Coupon form select options. Single source of truth (CES-owned) for the value
|
|
5
|
-
* sets that back the coupon's string-union domain fields; surfaced to the form
|
|
6
|
-
* via `getInvoicingCouponFormView` so web-components need not hardcode them.
|
|
7
|
-
*/
|
|
8
|
-
export declare const INVOICING_DISCOUNT_TYPE_OPTIONS: readonly InvoicingFormOption<InvoicingDiscountType>[];
|
|
9
|
-
export declare const INVOICING_COUPON_DURATION_TYPE_OPTIONS: readonly InvoicingFormOption<InvoicingCouponDurationType>[];
|
|
10
|
-
export declare const INVOICING_COUPON_PERIOD_UNIT_OPTIONS: readonly InvoicingFormOption<InvoicingCouponPeriodUnit>[];
|
|
11
|
-
export declare const INVOICING_COUPON_APPLY_ON_OPTIONS: readonly InvoicingFormOption<InvoicingCouponApplyOn>[];
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.INVOICING_COUPON_APPLY_ON_OPTIONS = exports.INVOICING_COUPON_PERIOD_UNIT_OPTIONS = exports.INVOICING_COUPON_DURATION_TYPE_OPTIONS = exports.INVOICING_DISCOUNT_TYPE_OPTIONS = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Coupon form select options. Single source of truth (CES-owned) for the value
|
|
6
|
-
* sets that back the coupon's string-union domain fields; surfaced to the form
|
|
7
|
-
* via `getInvoicingCouponFormView` so web-components need not hardcode them.
|
|
8
|
-
*/
|
|
9
|
-
exports.INVOICING_DISCOUNT_TYPE_OPTIONS = [
|
|
10
|
-
{ label: 'Percentage', value: 'percentage' },
|
|
11
|
-
{ label: 'Fixed amount', value: 'fixed_amount' },
|
|
12
|
-
{ label: 'Offer quantity', value: 'offer_quantity' },
|
|
13
|
-
];
|
|
14
|
-
exports.INVOICING_COUPON_DURATION_TYPE_OPTIONS = [
|
|
15
|
-
{ label: 'One time', value: 'one_time' },
|
|
16
|
-
{ label: 'Forever', value: 'forever' },
|
|
17
|
-
{ label: 'Limited period', value: 'limited_period' },
|
|
18
|
-
];
|
|
19
|
-
exports.INVOICING_COUPON_PERIOD_UNIT_OPTIONS = [
|
|
20
|
-
{ label: 'Day', value: 'day' },
|
|
21
|
-
{ label: 'Week', value: 'week' },
|
|
22
|
-
{ label: 'Month', value: 'month' },
|
|
23
|
-
{ label: 'Year', value: 'year' },
|
|
24
|
-
];
|
|
25
|
-
exports.INVOICING_COUPON_APPLY_ON_OPTIONS = [
|
|
26
|
-
{ label: 'Invoice amount', value: 'invoice_amount' },
|
|
27
|
-
{ label: 'Each specified item', value: 'each_specified_item' },
|
|
28
|
-
{ label: 'Specified items total', value: 'specified_items_total' },
|
|
29
|
-
];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Coupon form select options. Single source of truth (CES-owned) for the value
|
|
3
|
-
* sets that back the coupon's string-union domain fields; surfaced to the form
|
|
4
|
-
* via `getInvoicingCouponFormView` so web-components need not hardcode them.
|
|
5
|
-
*/
|
|
6
|
-
export const INVOICING_DISCOUNT_TYPE_OPTIONS = [
|
|
7
|
-
{ label: 'Percentage', value: 'percentage' },
|
|
8
|
-
{ label: 'Fixed amount', value: 'fixed_amount' },
|
|
9
|
-
{ label: 'Offer quantity', value: 'offer_quantity' },
|
|
10
|
-
];
|
|
11
|
-
export const INVOICING_COUPON_DURATION_TYPE_OPTIONS = [
|
|
12
|
-
{ label: 'One time', value: 'one_time' },
|
|
13
|
-
{ label: 'Forever', value: 'forever' },
|
|
14
|
-
{ label: 'Limited period', value: 'limited_period' },
|
|
15
|
-
];
|
|
16
|
-
export const INVOICING_COUPON_PERIOD_UNIT_OPTIONS = [
|
|
17
|
-
{ label: 'Day', value: 'day' },
|
|
18
|
-
{ label: 'Week', value: 'week' },
|
|
19
|
-
{ label: 'Month', value: 'month' },
|
|
20
|
-
{ label: 'Year', value: 'year' },
|
|
21
|
-
];
|
|
22
|
-
export const INVOICING_COUPON_APPLY_ON_OPTIONS = [
|
|
23
|
-
{ label: 'Invoice amount', value: 'invoice_amount' },
|
|
24
|
-
{ label: 'Each specified item', value: 'each_specified_item' },
|
|
25
|
-
{ label: 'Specified items total', value: 'specified_items_total' },
|
|
26
|
-
];
|