@zeniai/client-epic-state 5.2.50 → 5.2.51
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/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +45 -21
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewReducer.js +4 -1
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +16 -3
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/seedInvoicingCatalogItemFormDraftEpic.js +6 -2
- package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewReducer.js +4 -1
- package/lib/esm/view/invoicing/editInvoicingCouponDetailView/seedInvoicingCouponFormDraftEpic.js +6 -2
- package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer.js +10 -2
- package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewSelector.js +33 -0
- package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/initializeInvoicingCustomerAddressEpic.js +43 -17
- package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/seedInvoicingCustomerFormDraftEpic.js +6 -2
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewReducer.js +10 -2
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewSelector.js +34 -0
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/initializeInvoicingSubscriptionAddressEpic.js +44 -18
- package/lib/esm/view/invoicing/invoicingFormDraft.js +13 -0
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.d.ts +22 -6
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +47 -22
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewReducer.js +3 -0
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +14 -1
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/seedInvoicingCatalogItemFormDraftEpic.js +6 -2
- package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewReducer.js +3 -0
- package/lib/view/invoicing/editInvoicingCouponDetailView/seedInvoicingCouponFormDraftEpic.js +6 -2
- package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer.d.ts +3 -1
- package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer.js +10 -2
- package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewSelector.d.ts +7 -7
- package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewSelector.js +33 -0
- package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewState.d.ts +6 -0
- package/lib/view/invoicing/editInvoicingCustomerDetailView/initializeInvoicingCustomerAddressEpic.d.ts +15 -10
- package/lib/view/invoicing/editInvoicingCustomerDetailView/initializeInvoicingCustomerAddressEpic.js +42 -16
- package/lib/view/invoicing/editInvoicingCustomerDetailView/seedInvoicingCustomerFormDraftEpic.js +6 -2
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewReducer.d.ts +3 -1
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewReducer.js +10 -2
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewSelector.d.ts +7 -0
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewSelector.js +34 -0
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewState.d.ts +6 -0
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/initializeInvoicingSubscriptionAddressEpic.d.ts +15 -11
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/initializeInvoicingSubscriptionAddressEpic.js +42 -16
- package/lib/view/invoicing/invoicingFormDraft.d.ts +10 -1
- package/lib/view/invoicing/invoicingFormDraft.js +14 -0
- package/package.json +1 -1
|
@@ -130,26 +130,50 @@ export const localDataToSaveInvoicingCatalogItemPayload = (localData, isCreate,
|
|
|
130
130
|
const subFamilies = localData.subFamilies.length > 0
|
|
131
131
|
? localData.subFamilies
|
|
132
132
|
: [blankInvoicingCatalogSubFamily()];
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
133
|
+
if (isCreate) {
|
|
134
|
+
itemPayload.sub_families = subFamilies.map((subFamily) => buildSubFamilyPayload(localData, subFamily, false, lookup));
|
|
135
|
+
return itemPayload;
|
|
136
|
+
}
|
|
137
|
+
// Only price points the service has already stored travel in an update: it
|
|
138
|
+
// addresses them by id, and a blank one has nothing to address. A price point
|
|
139
|
+
// added on the form is created by its own request once the item is saved,
|
|
140
|
+
// rather than riding along as a row the update cannot place.
|
|
141
|
+
itemPayload.sub_families = subFamilies
|
|
142
|
+
.filter((subFamily) => subFamily.id !== '')
|
|
143
|
+
.map((subFamily) => {
|
|
144
|
+
// Edits send the same body a create does. The narrower hand-built one
|
|
145
|
+
// this replaces had to be kept in step by hand and was not: it dropped
|
|
146
|
+
// `accounting_detail` once, and `billing_cycles`, `price`,
|
|
147
|
+
// `pricing_model`, `period`, the trial fields, `proration_type`,
|
|
148
|
+
// `free_quantity`, `is_taxable` and `tiers` were never added at all, so
|
|
149
|
+
// editing any of them looked saved and changed nothing.
|
|
150
|
+
const detail = buildSubFamilyPayload(localData, subFamily, true, lookup);
|
|
151
|
+
// `null` rather than omitted when empty: an absent key on an update
|
|
152
|
+
// reads as "leave it alone", which would make a cleared mapping
|
|
153
|
+
// impossible to save — the same reason `description` and
|
|
154
|
+
// `invoice_notes` are cleared rather than dropped above.
|
|
155
|
+
detail.accounting_detail = detail.accounting_detail ?? null;
|
|
156
|
+
// Never blank: the filter above leaves only price points the service has
|
|
157
|
+
// already stored, which is the only kind an update can address.
|
|
158
|
+
return { ...detail, id: subFamily.id };
|
|
159
|
+
});
|
|
154
160
|
return itemPayload;
|
|
155
161
|
};
|
|
162
|
+
/**
|
|
163
|
+
* The bodies that create the price points added on an edit form, one per
|
|
164
|
+
* request to `/catalog/products`.
|
|
165
|
+
*
|
|
166
|
+
* An update cannot carry them: it addresses price points by id, and these have
|
|
167
|
+
* none until the service assigns one. They are bound to their item by
|
|
168
|
+
* `item_id`, so this needs the saved item's id and runs after the item itself
|
|
169
|
+
* is saved.
|
|
170
|
+
*
|
|
171
|
+
* Empty values are left off rather than sent as `null`: there is nothing on a
|
|
172
|
+
* price point that does not exist yet to clear.
|
|
173
|
+
*/
|
|
174
|
+
export const localDataToCreateInvoicingCatalogProductPayloads = (localData, itemId, lookup) => localData.subFamilies
|
|
175
|
+
.filter((subFamily) => subFamily.id === '')
|
|
176
|
+
.map((subFamily) => ({
|
|
177
|
+
...buildSubFamilyPayload(localData, subFamily, false, lookup),
|
|
178
|
+
item_id: itemId,
|
|
179
|
+
}));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createSlice } from '@reduxjs/toolkit';
|
|
2
2
|
import { clearAll } from '../../../rootActions';
|
|
3
|
-
import { applyInvoicingFormDraftEdit, applyInvoicingFormDraftFailure, applyInvoicingFormDraftSeed, } from '../invoicingFormDraft';
|
|
3
|
+
import { applyInvoicingFormDraftEdit, applyInvoicingFormDraftFailure, applyInvoicingFormDraftSaved, applyInvoicingFormDraftSeed, } from '../invoicingFormDraft';
|
|
4
4
|
import { initialInvoicingCatalogItemFormLocalData } from './invoicingCatalogItemFormHelper';
|
|
5
5
|
export const initialState = {
|
|
6
6
|
fetchState: 'Not-Started',
|
|
@@ -43,6 +43,9 @@ const editInvoicingCatalogItemDetailView = createSlice({
|
|
|
43
43
|
draft.error = undefined;
|
|
44
44
|
draft.savedItemId = action.payload.itemId;
|
|
45
45
|
draft.savedKind = action.payload.kind;
|
|
46
|
+
// An edit is refetched on success; keep the saved values on screen until
|
|
47
|
+
// that lands, and let it replace them.
|
|
48
|
+
applyInvoicingFormDraftSaved(draft.editDraftById, action.payload.itemId);
|
|
46
49
|
},
|
|
47
50
|
submitInvoicingCatalogItemFormFailure(draft, action) {
|
|
48
51
|
draft.fetchState = 'Error';
|
package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { from } from 'rxjs';
|
|
1
|
+
import { forkJoin, from } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { mergeInvoicingPlanSubFamily, updateInvoicingPlans, } from '../../../entity/invoicing/plan/planReducer';
|
|
4
4
|
import { updateInvoicingProducts } from '../../../entity/invoicing/product/productReducer';
|
|
@@ -7,7 +7,7 @@ import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
|
7
7
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
8
8
|
import { addInvoicingCatalogItem } from '../invoicingCatalogListView/invoicingCatalogListViewReducer';
|
|
9
9
|
import { getInvoicingCatalogAccountingLookup } from '../invoicingQboView/invoicingQboViewSelector';
|
|
10
|
-
import { localDataToSaveInvoicingCatalogItemPayload, } from './editInvoicingCatalogItemDetailViewPayload';
|
|
10
|
+
import { localDataToCreateInvoicingCatalogProductPayloads, localDataToSaveInvoicingCatalogItemPayload, } from './editInvoicingCatalogItemDetailViewPayload';
|
|
11
11
|
import { submitInvoicingCatalogItemForm, submitInvoicingCatalogItemFormFailure, submitInvoicingCatalogItemFormSuccess, } from './editInvoicingCatalogItemDetailViewReducer';
|
|
12
12
|
export const saveInvoicingCatalogItemEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter((action) => submitInvoicingCatalogItemForm.match(action)), mergeMap((action) => {
|
|
13
13
|
const { id } = action.payload;
|
|
@@ -81,7 +81,20 @@ export const saveInvoicingCatalogItemEpic = (actions$, state$, zeniAPI) => actio
|
|
|
81
81
|
}));
|
|
82
82
|
return resultActions;
|
|
83
83
|
};
|
|
84
|
-
|
|
84
|
+
// Price points added on an edit form cannot ride in the update:
|
|
85
|
+
// it addresses them by id and they have none yet. They are created
|
|
86
|
+
// against the item that was just saved, and their responses join
|
|
87
|
+
// the same success — one of them failing is the whole save
|
|
88
|
+
// failing, since the item on screen would otherwise claim price
|
|
89
|
+
// points the service never stored. A create needs none of this:
|
|
90
|
+
// its price points are nested in the item body.
|
|
91
|
+
const newProductPayloads = id != null
|
|
92
|
+
? localDataToCreateInvoicingCatalogProductPayloads(localData, savedItem.id, accountingLookup)
|
|
93
|
+
: [];
|
|
94
|
+
if (newProductPayloads.length === 0) {
|
|
95
|
+
return completeSave([]);
|
|
96
|
+
}
|
|
97
|
+
return forkJoin(newProductPayloads.map((productPayload) => zeniAPI.postAndGetJSON(`${baseUrl}/catalog/products`, productPayload))).pipe(mergeMap((productResponses) => completeSave(productResponses)));
|
|
85
98
|
}
|
|
86
99
|
return from([
|
|
87
100
|
submitInvoicingCatalogItemFormFailure(response.status),
|
|
@@ -23,9 +23,13 @@ export const seedInvoicingCatalogItemFormDraftEpic = (actions$, state$) => actio
|
|
|
23
23
|
// endpoints merge their own list-shaped rows into the same store. Only a
|
|
24
24
|
// completed detail load does, which is also exactly when the page's
|
|
25
25
|
// cache-guarded fetch issues no request and this is the sole seed.
|
|
26
|
+
// A forced refetch is the caller asking for fresh data: the response will
|
|
27
|
+
// seed, and seeding first from the entity as it stands would mark the
|
|
28
|
+
// draft loaded and lock that response out.
|
|
26
29
|
if (fetchInvoicingCatalogItemDetailPage.match(action) &&
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
(action.payload.cacheOverride === true ||
|
|
31
|
+
state.editInvoicingCatalogItemDetailViewState.recordStateById[id]
|
|
32
|
+
?.fetchState !== 'Completed')) {
|
|
29
33
|
return EMPTY;
|
|
30
34
|
}
|
|
31
35
|
// Nothing to seed from on a cold open; the detail response triggers this
|
package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewReducer.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createSlice } from '@reduxjs/toolkit';
|
|
2
2
|
import { clearAll } from '../../../rootActions';
|
|
3
|
-
import { applyInvoicingFormDraftEdit, applyInvoicingFormDraftFailure, applyInvoicingFormDraftSeed, } from '../invoicingFormDraft';
|
|
3
|
+
import { applyInvoicingFormDraftEdit, applyInvoicingFormDraftFailure, applyInvoicingFormDraftSaved, applyInvoicingFormDraftSeed, } from '../invoicingFormDraft';
|
|
4
4
|
import { initialInvoicingCouponFormLocalData, } from './editInvoicingCouponDetailViewState';
|
|
5
5
|
export const initialState = {
|
|
6
6
|
fetchState: 'Not-Started',
|
|
@@ -51,6 +51,9 @@ const editInvoicingCouponDetailView = createSlice({
|
|
|
51
51
|
draft.fetchState = 'Completed';
|
|
52
52
|
draft.error = undefined;
|
|
53
53
|
draft.savedCouponId = action.payload.couponId;
|
|
54
|
+
// An edit is refetched on success; keep the saved values on screen until
|
|
55
|
+
// that lands, and let it replace them.
|
|
56
|
+
applyInvoicingFormDraftSaved(draft.editDraftById, action.payload.couponId);
|
|
54
57
|
},
|
|
55
58
|
submitInvoicingCouponFormFailure(draft, action) {
|
|
56
59
|
draft.fetchState = 'Error';
|
package/lib/esm/view/invoicing/editInvoicingCouponDetailView/seedInvoicingCouponFormDraftEpic.js
CHANGED
|
@@ -23,9 +23,13 @@ export const seedInvoicingCouponFormDraftEpic = (actions$, state$) => actions$.p
|
|
|
23
23
|
// endpoints merge their own list-shaped rows into the same store. Only a
|
|
24
24
|
// completed detail load does, which is also exactly when the page's
|
|
25
25
|
// cache-guarded fetch issues no request and this is the sole seed.
|
|
26
|
+
// A forced refetch is the caller asking for fresh data: the response will
|
|
27
|
+
// seed, and seeding first from the entity as it stands would mark the
|
|
28
|
+
// draft loaded and lock that response out.
|
|
26
29
|
if (fetchInvoicingCouponDetailPage.match(action) &&
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
(action.payload.cacheOverride === true ||
|
|
31
|
+
state.editInvoicingCouponDetailViewState.recordStateById[id]
|
|
32
|
+
?.fetchState !== 'Completed')) {
|
|
29
33
|
return EMPTY;
|
|
30
34
|
}
|
|
31
35
|
// Nothing to seed from on a cold open; the detail response triggers this
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createSlice } from '@reduxjs/toolkit';
|
|
2
2
|
import { clearAll } from '../../../rootActions';
|
|
3
|
-
import { applyInvoicingFormDraftEdit, applyInvoicingFormDraftFailure, applyInvoicingFormDraftSeed, } from '../invoicingFormDraft';
|
|
3
|
+
import { applyInvoicingFormDraftEdit, applyInvoicingFormDraftFailure, applyInvoicingFormDraftSaved, applyInvoicingFormDraftSeed, } from '../invoicingFormDraft';
|
|
4
4
|
import { initialInvoicingCustomerFormLocalData } from './invoicingCustomerFormConfig';
|
|
5
5
|
export const initialState = {
|
|
6
6
|
emailPreviewFetchState: { fetchState: 'Not-Started', error: undefined },
|
|
@@ -8,6 +8,7 @@ export const initialState = {
|
|
|
8
8
|
emailPreviewCustomerId: undefined,
|
|
9
9
|
promotionalCreditSubmitState: { fetchState: 'Not-Started', error: undefined },
|
|
10
10
|
recordStateById: {},
|
|
11
|
+
billingAddressOwnerId: undefined,
|
|
11
12
|
fetchState: 'Not-Started',
|
|
12
13
|
error: undefined,
|
|
13
14
|
editDraftById: {},
|
|
@@ -154,6 +155,9 @@ const editInvoicingCustomerDetailView = createSlice({
|
|
|
154
155
|
draft.fetchState = 'Completed';
|
|
155
156
|
draft.error = undefined;
|
|
156
157
|
draft.savedCustomerId = action.payload.customerId;
|
|
158
|
+
// An edit is refetched on success; keep the saved values on screen until
|
|
159
|
+
// that lands, and let it replace them.
|
|
160
|
+
applyInvoicingFormDraftSaved(draft.editDraftById, action.payload.customerId);
|
|
157
161
|
},
|
|
158
162
|
submitInvoicingCustomerFormFailure(draft, action) {
|
|
159
163
|
draft.fetchState = 'Error';
|
|
@@ -183,6 +187,10 @@ const editInvoicingCustomerDetailView = createSlice({
|
|
|
183
187
|
return { payload };
|
|
184
188
|
},
|
|
185
189
|
},
|
|
190
|
+
/** Record which customer the shared billing-address slot now belongs to. */
|
|
191
|
+
claimInvoicingCustomerBillingAddress(draft, action) {
|
|
192
|
+
draft.billingAddressOwnerId = action.payload.id;
|
|
193
|
+
},
|
|
186
194
|
},
|
|
187
195
|
extraReducers: (builder) => {
|
|
188
196
|
builder.addCase(clearAll, (draft) => {
|
|
@@ -190,5 +198,5 @@ const editInvoicingCustomerDetailView = createSlice({
|
|
|
190
198
|
});
|
|
191
199
|
},
|
|
192
200
|
});
|
|
193
|
-
export const { fetchInvoicingPaymentLinkEmailPreview, fetchInvoicingPaymentLinkEmailPreviewPage, updateInvoicingPaymentLinkEmailPreview, updateInvoicingPaymentLinkEmailPreviewFailure, addPromotionalCreditsFailure, addPromotionalCreditsSuccess, fetchInvoicingCustomerDetail, fetchInvoicingCustomerDetailPage, seedInvoicingCustomerFormDraft, updateInvoicingCustomerDetail, resetPromotionalCreditAction, submitAddPromotionalCredits, updateInvoicingCustomerDetailFailure, updateInvoicingCustomerFormDraft, submitInvoicingCustomerForm, submitInvoicingCustomerFormSuccess, submitInvoicingCustomerFormFailure, resetEditInvoicingCustomerDetailView, initializeInvoicingCustomerAddress, } = editInvoicingCustomerDetailView.actions;
|
|
201
|
+
export const { fetchInvoicingPaymentLinkEmailPreview, fetchInvoicingPaymentLinkEmailPreviewPage, updateInvoicingPaymentLinkEmailPreview, updateInvoicingPaymentLinkEmailPreviewFailure, addPromotionalCreditsFailure, addPromotionalCreditsSuccess, fetchInvoicingCustomerDetail, fetchInvoicingCustomerDetailPage, seedInvoicingCustomerFormDraft, updateInvoicingCustomerDetail, resetPromotionalCreditAction, submitAddPromotionalCredits, updateInvoicingCustomerDetailFailure, updateInvoicingCustomerFormDraft, submitInvoicingCustomerForm, submitInvoicingCustomerFormSuccess, submitInvoicingCustomerFormFailure, resetEditInvoicingCustomerDetailView, initializeInvoicingCustomerAddress, claimInvoicingCustomerBillingAddress, } = editInvoicingCustomerDetailView.actions;
|
|
194
202
|
export default editInvoicingCustomerDetailView.reducer;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { reduceAllFetchState } from '../../../commonStateTypes/reduceFetchState';
|
|
2
|
+
import { getAddressByAddressId } from '../../../entity/address/addressSelector';
|
|
2
3
|
import { getInvoicesByIds } from '../../../entity/invoicing/invoice/invoiceSelector';
|
|
3
4
|
import { getInvoicingCustomerById } from '../../../entity/invoicing/invoicingCustomer/invoicingCustomerSelector';
|
|
4
5
|
import { invoicingCustomerPaymentMethods } from '../../../entity/invoicing/invoicingCustomer/invoicingCustomerSelector';
|
|
@@ -50,6 +51,37 @@ export const getInvoicingCustomerRecord = (state, invoicingCustomerID) => {
|
|
|
50
51
|
* fetch state/error, and the id of the customer last saved — so the form screen
|
|
51
52
|
* depends on this single selector.
|
|
52
53
|
*/
|
|
54
|
+
/**
|
|
55
|
+
* Whether the billing address entered on the Address screen is a change the
|
|
56
|
+
* customer has not saved. Presence alone cannot say so: the detail page seeds
|
|
57
|
+
* the address store with the saved address on load so the Address screen opens
|
|
58
|
+
* prefilled. Only a pending address that differs from the saved one — or one
|
|
59
|
+
* where nothing is saved yet — is an unsaved change. Compared on what the user
|
|
60
|
+
* enters; a saved address's coordinates and timestamps are left out.
|
|
61
|
+
*/
|
|
62
|
+
const isBillingAddressUnsaved = (state, id, savedBillingAddressId) => {
|
|
63
|
+
// The slot is keyed by address type alone; only a draft this customer owns counts.
|
|
64
|
+
if (id == null ||
|
|
65
|
+
state.editInvoicingCustomerDetailViewState.billingAddressOwnerId !== id) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
const pending = state.addressViewState.newAddressState?.[INVOICING_CUSTOMER_BILLING_ADDRESS_TYPE]?.addressToCreate;
|
|
69
|
+
if (pending == null) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
const saved = savedBillingAddressId != null
|
|
73
|
+
? getAddressByAddressId(state.addressState, savedBillingAddressId)
|
|
74
|
+
: undefined;
|
|
75
|
+
if (saved == null) {
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
return !(pending.street.join('\u0000') === saved.street.join('\u0000') &&
|
|
79
|
+
pending.city === saved.city &&
|
|
80
|
+
pending.state === saved.state &&
|
|
81
|
+
pending.postalCode === saved.postalCode &&
|
|
82
|
+
pending.country === saved.country &&
|
|
83
|
+
(pending.countryCode ?? '') === (saved.countryCode ?? ''));
|
|
84
|
+
};
|
|
53
85
|
export const getInvoicingCustomerFormView = (state, invoicingCustomerID) => {
|
|
54
86
|
const { editDraftById, error, fetchState, newCustomerDraft, savedCustomerId } = state.editInvoicingCustomerDetailViewState;
|
|
55
87
|
const mode = invoicingCustomerID != null ? 'edit' : 'create';
|
|
@@ -101,6 +133,7 @@ export const getInvoicingCustomerFormView = (state, invoicingCustomerID) => {
|
|
|
101
133
|
taxabilityOptions,
|
|
102
134
|
billingAddressId,
|
|
103
135
|
billingAddressLabel,
|
|
136
|
+
hasUnsavedBillingAddress: isBillingAddressUnsaved(state, invoicingCustomerID, customer?.billingAddressId),
|
|
104
137
|
savedCustomerId,
|
|
105
138
|
fetchState,
|
|
106
139
|
error,
|
|
@@ -1,35 +1,61 @@
|
|
|
1
|
-
import { EMPTY,
|
|
1
|
+
import { EMPTY, from } from 'rxjs';
|
|
2
2
|
import { filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { getAddressByAddressId } from '../../../entity/address/addressSelector';
|
|
4
4
|
import { getInvoicingCustomerById } from '../../../entity/invoicing/invoicingCustomer/invoicingCustomerSelector';
|
|
5
|
-
import { newAddressInLocalStore } from '../../addressView/addressViewReducer';
|
|
6
|
-
import { updateInvoicingCustomerDetail } from '
|
|
7
|
-
import { initializeInvoicingCustomerAddress } from './editInvoicingCustomerDetailViewReducer';
|
|
5
|
+
import { newAddressInLocalStore, removeNewAddressDataInLocalStore, } from '../../addressView/addressViewReducer';
|
|
6
|
+
import { claimInvoicingCustomerBillingAddress, fetchInvoicingCustomerDetail, fetchInvoicingCustomerDetailPage, initializeInvoicingCustomerAddress, updateInvoicingCustomerDetail, } from './editInvoicingCustomerDetailViewReducer';
|
|
8
7
|
import { INVOICING_CUSTOMER_BILLING_ADDRESS_TYPE } from './invoicingCustomerFormConfig';
|
|
9
8
|
/**
|
|
10
|
-
* Seed the shared Address screen with
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
9
|
+
* Seed the shared Address screen with the customer's saved billing address, and
|
|
10
|
+
* record that the slot is this customer's. Runs when a detail request is issued
|
|
11
|
+
* (every path that loads a record issues one — the detail page when not cached,
|
|
12
|
+
* the create/edit form always), when the page opens, when the detail load
|
|
13
|
+
* lands, and on an explicit initialize trigger.
|
|
14
|
+
*
|
|
15
|
+
* The address store slot is keyed by address type alone, so it can still hold
|
|
16
|
+
* another customer's draft. Only a draft this customer owns is left alone —
|
|
17
|
+
* that is what lets an address the user just entered survive a trip to the
|
|
18
|
+
* Address screen. Anything else is replaced by this customer's saved address,
|
|
19
|
+
* or cleared when it has none. Opening the page counts as a trigger because a
|
|
20
|
+
* record already loaded this session issues no detail request at all.
|
|
16
21
|
*/
|
|
17
22
|
export const initializeInvoicingCustomerAddressEpic = (actions$, state$) => actions$.pipe(filter((action) => initializeInvoicingCustomerAddress.match(action) ||
|
|
18
|
-
updateInvoicingCustomerDetail.match(action)
|
|
23
|
+
updateInvoicingCustomerDetail.match(action) ||
|
|
24
|
+
fetchInvoicingCustomerDetailPage.match(action) ||
|
|
25
|
+
fetchInvoicingCustomerDetail.match(action)), mergeMap((action) => {
|
|
19
26
|
const { id } = action.payload;
|
|
27
|
+
if (id == null) {
|
|
28
|
+
return EMPTY;
|
|
29
|
+
}
|
|
20
30
|
const rootState = state$.value;
|
|
21
|
-
const
|
|
22
|
-
|
|
31
|
+
const pending = rootState.addressViewState.newAddressState?.[INVOICING_CUSTOMER_BILLING_ADDRESS_TYPE]?.addressToCreate;
|
|
32
|
+
const ownerId = rootState.editInvoicingCustomerDetailViewState.billingAddressOwnerId;
|
|
33
|
+
// A detail response speaks for the record it loaded, which may no longer
|
|
34
|
+
// be the one on screen: its request keeps running when the user moves on
|
|
35
|
+
// to a cached record, which issues no request of its own to cancel it.
|
|
36
|
+
// Only the page-open and explicit triggers define the current record.
|
|
37
|
+
if (updateInvoicingCustomerDetail.match(action) &&
|
|
38
|
+
ownerId != null &&
|
|
39
|
+
ownerId !== id) {
|
|
40
|
+
return EMPTY;
|
|
41
|
+
}
|
|
42
|
+
if (pending != null && ownerId === id) {
|
|
23
43
|
return EMPTY;
|
|
24
44
|
}
|
|
25
45
|
const customer = getInvoicingCustomerById(rootState.invoicingCustomerState, id);
|
|
26
46
|
const address = customer?.billingAddressId != null
|
|
27
47
|
? getAddressByAddressId(rootState.addressState, customer.billingAddressId)
|
|
28
48
|
: undefined;
|
|
29
|
-
|
|
30
|
-
|
|
49
|
+
const actions = [];
|
|
50
|
+
if (address != null) {
|
|
51
|
+
actions.push(newAddressInLocalStore({
|
|
31
52
|
addressType: INVOICING_CUSTOMER_BILLING_ADDRESS_TYPE,
|
|
32
53
|
addressToCreate: address,
|
|
33
|
-
}))
|
|
34
|
-
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
else if (pending != null) {
|
|
57
|
+
actions.push(removeNewAddressDataInLocalStore(INVOICING_CUSTOMER_BILLING_ADDRESS_TYPE));
|
|
58
|
+
}
|
|
59
|
+
actions.push(claimInvoicingCustomerBillingAddress({ id }));
|
|
60
|
+
return from(actions);
|
|
35
61
|
}));
|
package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/seedInvoicingCustomerFormDraftEpic.js
CHANGED
|
@@ -23,9 +23,13 @@ export const seedInvoicingCustomerFormDraftEpic = (actions$, state$) => actions$
|
|
|
23
23
|
// endpoints merge their own list-shaped rows into the same store. Only a
|
|
24
24
|
// completed detail load does, which is also exactly when the page's
|
|
25
25
|
// cache-guarded fetch issues no request and this is the sole seed.
|
|
26
|
+
// A forced refetch is the caller asking for fresh data: the response will
|
|
27
|
+
// seed, and seeding first from the entity as it stands would mark the
|
|
28
|
+
// draft loaded and lock that response out.
|
|
26
29
|
if (fetchInvoicingCustomerDetailPage.match(action) &&
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
(action.payload.cacheOverride === true ||
|
|
31
|
+
state.editInvoicingCustomerDetailViewState.recordStateById[id]
|
|
32
|
+
?.fetchState !== 'Completed')) {
|
|
29
33
|
return EMPTY;
|
|
30
34
|
}
|
|
31
35
|
// Nothing to seed from on a cold open; the detail response triggers this
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createSlice } from '@reduxjs/toolkit';
|
|
2
2
|
import { clearAll } from '../../../rootActions';
|
|
3
|
-
import { applyInvoicingFormDraftEdit, applyInvoicingFormDraftFailure, applyInvoicingFormDraftSeed, } from '../invoicingFormDraft';
|
|
3
|
+
import { applyInvoicingFormDraftEdit, applyInvoicingFormDraftFailure, applyInvoicingFormDraftSaved, applyInvoicingFormDraftSeed, } from '../invoicingFormDraft';
|
|
4
4
|
import { initialInvoicingSubscriptionFormLocalData } from './invoicingSubscriptionFormConfig';
|
|
5
5
|
export const initialState = {
|
|
6
6
|
fetchState: 'Not-Started',
|
|
@@ -8,6 +8,7 @@ export const initialState = {
|
|
|
8
8
|
editDraftById: {},
|
|
9
9
|
actionStateById: {},
|
|
10
10
|
recordStateById: {},
|
|
11
|
+
shippingAddressOwnerId: undefined,
|
|
11
12
|
newSubscriptionDraft: { ...initialInvoicingSubscriptionFormLocalData },
|
|
12
13
|
savedSubscriptionId: undefined,
|
|
13
14
|
hasValidState() {
|
|
@@ -105,6 +106,9 @@ const editInvoicingSubscriptionDetailView = createSlice({
|
|
|
105
106
|
draft.fetchState = 'Completed';
|
|
106
107
|
draft.error = undefined;
|
|
107
108
|
draft.savedSubscriptionId = action.payload.subscriptionId;
|
|
109
|
+
// An edit is refetched on success; keep the saved values on screen until
|
|
110
|
+
// that lands, and let it replace them.
|
|
111
|
+
applyInvoicingFormDraftSaved(draft.editDraftById, action.payload.subscriptionId);
|
|
108
112
|
},
|
|
109
113
|
submitInvoicingSubscriptionFormFailure(draft, action) {
|
|
110
114
|
draft.fetchState = 'Error';
|
|
@@ -136,6 +140,10 @@ const editInvoicingSubscriptionDetailView = createSlice({
|
|
|
136
140
|
return { payload };
|
|
137
141
|
},
|
|
138
142
|
},
|
|
143
|
+
/** Record which subscription the shared shipping-address slot now belongs to. */
|
|
144
|
+
claimInvoicingSubscriptionShippingAddress(draft, action) {
|
|
145
|
+
draft.shippingAddressOwnerId = action.payload.id;
|
|
146
|
+
},
|
|
139
147
|
// Trigger only — handled by syncInvoicingSubscriptionCouponsEpic.
|
|
140
148
|
syncInvoicingSubscriptionCoupons: {
|
|
141
149
|
reducer() { },
|
|
@@ -150,5 +158,5 @@ const editInvoicingSubscriptionDetailView = createSlice({
|
|
|
150
158
|
});
|
|
151
159
|
},
|
|
152
160
|
});
|
|
153
|
-
export const { runInvoicingSubscriptionAction, runInvoicingSubscriptionActionFailure, runInvoicingSubscriptionActionSuccess, fetchInvoicingSubscriptionDetail, fetchInvoicingSubscriptionDetailPage, fetchInvoicingSubscriptionFormPage, seedInvoicingSubscriptionFormDraft, updateInvoicingSubscriptionDetail, updateInvoicingSubscriptionDetailFailure, updateInvoicingSubscriptionFormDraft, submitInvoicingSubscriptionForm, submitInvoicingSubscriptionFormSuccess, submitInvoicingSubscriptionFormFailure, resetEditInvoicingSubscriptionDetailView, initializeInvoicingSubscriptionAddress, syncInvoicingSubscriptionCoupons, } = editInvoicingSubscriptionDetailView.actions;
|
|
161
|
+
export const { runInvoicingSubscriptionAction, runInvoicingSubscriptionActionFailure, runInvoicingSubscriptionActionSuccess, fetchInvoicingSubscriptionDetail, fetchInvoicingSubscriptionDetailPage, fetchInvoicingSubscriptionFormPage, seedInvoicingSubscriptionFormDraft, updateInvoicingSubscriptionDetail, updateInvoicingSubscriptionDetailFailure, updateInvoicingSubscriptionFormDraft, submitInvoicingSubscriptionForm, submitInvoicingSubscriptionFormSuccess, submitInvoicingSubscriptionFormFailure, resetEditInvoicingSubscriptionDetailView, initializeInvoicingSubscriptionAddress, claimInvoicingSubscriptionShippingAddress, syncInvoicingSubscriptionCoupons, } = editInvoicingSubscriptionDetailView.actions;
|
|
154
162
|
export default editInvoicingSubscriptionDetailView.reducer;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { reduceAllFetchState } from '../../../commonStateTypes/reduceFetchState';
|
|
2
|
+
import { getAddressByAddressId } from '../../../entity/address/addressSelector';
|
|
2
3
|
import { getInvoicingSubscriptionById } from '../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionSelector';
|
|
3
4
|
import { getFormattedAddress } from '../../addressView/addressViewSelector';
|
|
4
5
|
import { getInvoicingCouponListItems } from '../couponView/couponViewSelector';
|
|
@@ -24,6 +25,37 @@ export const getEditInvoicingSubscriptionDetailViewState = (state, invoicingSubs
|
|
|
24
25
|
version: 1.0,
|
|
25
26
|
};
|
|
26
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* Whether the shipping address entered on the Address screen is a change the
|
|
30
|
+
* subscription has not saved. Presence alone cannot say so: the detail page seeds
|
|
31
|
+
* the address store with the saved address on load so the Address screen opens
|
|
32
|
+
* prefilled. Only a pending address that differs from the saved one — or one
|
|
33
|
+
* where nothing is saved yet — is an unsaved change. Compared on what the user
|
|
34
|
+
* enters; a saved address's coordinates and timestamps are left out.
|
|
35
|
+
*/
|
|
36
|
+
const isShippingAddressUnsaved = (state, id, savedShippingAddressId) => {
|
|
37
|
+
// The slot is keyed by address type alone; only a draft this subscription owns counts.
|
|
38
|
+
if (id == null ||
|
|
39
|
+
state.editInvoicingSubscriptionDetailViewState.shippingAddressOwnerId !== id) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
const pending = state.addressViewState.newAddressState?.[INVOICING_SUBSCRIPTION_SHIPPING_ADDRESS_TYPE]?.addressToCreate;
|
|
43
|
+
if (pending == null) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
const saved = savedShippingAddressId != null
|
|
47
|
+
? getAddressByAddressId(state.addressState, savedShippingAddressId)
|
|
48
|
+
: undefined;
|
|
49
|
+
if (saved == null) {
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
return !(pending.street.join('\u0000') === saved.street.join('\u0000') &&
|
|
53
|
+
pending.city === saved.city &&
|
|
54
|
+
pending.state === saved.state &&
|
|
55
|
+
pending.postalCode === saved.postalCode &&
|
|
56
|
+
pending.country === saved.country &&
|
|
57
|
+
(pending.countryCode ?? '') === (saved.countryCode ?? ''));
|
|
58
|
+
};
|
|
27
59
|
export const getInvoicingSubscriptionFormView = (state, invoicingSubscriptionID) => {
|
|
28
60
|
const { editDraftById, error, fetchState, newSubscriptionDraft, savedSubscriptionId, } = state.editInvoicingSubscriptionDetailViewState;
|
|
29
61
|
const mode = invoicingSubscriptionID != null ? 'edit' : 'create';
|
|
@@ -43,6 +75,7 @@ export const getInvoicingSubscriptionFormView = (state, invoicingSubscriptionID)
|
|
|
43
75
|
const shippingAddressLabel = newAddress?.addressToCreate != null
|
|
44
76
|
? getFormattedAddress(newAddress.addressToCreate)
|
|
45
77
|
: undefined;
|
|
78
|
+
const hasUnsavedShippingAddress = isShippingAddressUnsaved(state, invoicingSubscriptionID, subscription?.shippingAddressId);
|
|
46
79
|
const catalogListView = getInvoicingCatalogListView(state);
|
|
47
80
|
const planPrices = getInvoicingCatalogPrices(catalogListView.plans);
|
|
48
81
|
const addonAndChargePrices = getInvoicingCatalogPrices(catalogListView.products);
|
|
@@ -75,6 +108,7 @@ export const getInvoicingSubscriptionFormView = (state, invoicingSubscriptionID)
|
|
|
75
108
|
products: addonAndChargePrices,
|
|
76
109
|
savedSubscriptionId,
|
|
77
110
|
shippingAddressLabel,
|
|
111
|
+
hasUnsavedShippingAddress,
|
|
78
112
|
subscription,
|
|
79
113
|
fetchState,
|
|
80
114
|
error,
|
|
@@ -1,36 +1,62 @@
|
|
|
1
|
-
import { EMPTY,
|
|
1
|
+
import { EMPTY, from } from 'rxjs';
|
|
2
2
|
import { filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { getAddressByAddressId } from '../../../entity/address/addressSelector';
|
|
4
4
|
import { getInvoicingSubscriptionById } from '../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionSelector';
|
|
5
|
-
import { newAddressInLocalStore } from '../../addressView/addressViewReducer';
|
|
6
|
-
import { updateInvoicingSubscriptionDetail } from './editInvoicingSubscriptionDetailViewReducer';
|
|
7
|
-
import { initializeInvoicingSubscriptionAddress } from './editInvoicingSubscriptionDetailViewReducer';
|
|
5
|
+
import { newAddressInLocalStore, removeNewAddressDataInLocalStore, } from '../../addressView/addressViewReducer';
|
|
6
|
+
import { claimInvoicingSubscriptionShippingAddress, fetchInvoicingSubscriptionDetail, fetchInvoicingSubscriptionDetailPage, initializeInvoicingSubscriptionAddress, updateInvoicingSubscriptionDetail, } from './editInvoicingSubscriptionDetailViewReducer';
|
|
8
7
|
import { INVOICING_SUBSCRIPTION_SHIPPING_ADDRESS_TYPE } from './invoicingSubscriptionFormConfig';
|
|
9
8
|
/**
|
|
10
|
-
* Seed the shared Address screen with
|
|
11
|
-
*
|
|
12
|
-
* the
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
9
|
+
* Seed the shared Address screen with the subscription's saved shipping address, and
|
|
10
|
+
* record that the slot is this subscription's. Runs when a detail request is issued
|
|
11
|
+
* (every path that loads a record issues one — the detail page when not cached,
|
|
12
|
+
* the create/edit form always), when the page opens, when the detail load
|
|
13
|
+
* lands, and on an explicit initialize trigger.
|
|
14
|
+
*
|
|
15
|
+
* The address store slot is keyed by address type alone, so it can still hold
|
|
16
|
+
* another subscription's draft. Only a draft this subscription owns is left alone —
|
|
17
|
+
* that is what lets an address the user just entered survive a trip to the
|
|
18
|
+
* Address screen. Anything else is replaced by this subscription's saved address,
|
|
19
|
+
* or cleared when it has none. Opening the page counts as a trigger because a
|
|
20
|
+
* record already loaded this session issues no detail request at all.
|
|
17
21
|
*/
|
|
18
22
|
export const initializeInvoicingSubscriptionAddressEpic = (actions$, state$) => actions$.pipe(filter((action) => initializeInvoicingSubscriptionAddress.match(action) ||
|
|
19
|
-
updateInvoicingSubscriptionDetail.match(action)
|
|
23
|
+
updateInvoicingSubscriptionDetail.match(action) ||
|
|
24
|
+
fetchInvoicingSubscriptionDetailPage.match(action) ||
|
|
25
|
+
fetchInvoicingSubscriptionDetail.match(action)), mergeMap((action) => {
|
|
20
26
|
const { id } = action.payload;
|
|
27
|
+
if (id == null) {
|
|
28
|
+
return EMPTY;
|
|
29
|
+
}
|
|
21
30
|
const rootState = state$.value;
|
|
22
|
-
const
|
|
23
|
-
|
|
31
|
+
const pending = rootState.addressViewState.newAddressState?.[INVOICING_SUBSCRIPTION_SHIPPING_ADDRESS_TYPE]?.addressToCreate;
|
|
32
|
+
const ownerId = rootState.editInvoicingSubscriptionDetailViewState
|
|
33
|
+
.shippingAddressOwnerId;
|
|
34
|
+
// A detail response speaks for the record it loaded, which may no longer
|
|
35
|
+
// be the one on screen: its request keeps running when the user moves on
|
|
36
|
+
// to a cached record, which issues no request of its own to cancel it.
|
|
37
|
+
// Only the page-open and explicit triggers define the current record.
|
|
38
|
+
if (updateInvoicingSubscriptionDetail.match(action) &&
|
|
39
|
+
ownerId != null &&
|
|
40
|
+
ownerId !== id) {
|
|
41
|
+
return EMPTY;
|
|
42
|
+
}
|
|
43
|
+
if (pending != null && ownerId === id) {
|
|
24
44
|
return EMPTY;
|
|
25
45
|
}
|
|
26
46
|
const subscription = getInvoicingSubscriptionById(rootState.invoicingSubscriptionState, id);
|
|
27
47
|
const address = subscription?.shippingAddressId != null
|
|
28
48
|
? getAddressByAddressId(rootState.addressState, subscription.shippingAddressId)
|
|
29
49
|
: undefined;
|
|
30
|
-
|
|
31
|
-
|
|
50
|
+
const actions = [];
|
|
51
|
+
if (address != null) {
|
|
52
|
+
actions.push(newAddressInLocalStore({
|
|
32
53
|
addressType: INVOICING_SUBSCRIPTION_SHIPPING_ADDRESS_TYPE,
|
|
33
54
|
addressToCreate: address,
|
|
34
|
-
}))
|
|
35
|
-
|
|
55
|
+
}));
|
|
56
|
+
}
|
|
57
|
+
else if (pending != null) {
|
|
58
|
+
actions.push(removeNewAddressDataInLocalStore(INVOICING_SUBSCRIPTION_SHIPPING_ADDRESS_TYPE));
|
|
59
|
+
}
|
|
60
|
+
actions.push(claimInvoicingSubscriptionShippingAddress({ id }));
|
|
61
|
+
return from(actions);
|
|
36
62
|
}));
|
|
@@ -41,6 +41,19 @@ export function applyInvoicingFormDraftFailure(draftById, id, blankLocalData) {
|
|
|
41
41
|
}
|
|
42
42
|
existing.fetchState = 'Error';
|
|
43
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* The record behind this draft was just saved and is about to be refetched.
|
|
46
|
+
* Keep the values on screen — dropping them would blank the form for the round
|
|
47
|
+
* trip, and the form remounts on the response anyway — but stop counting them
|
|
48
|
+
* as the loaded record's, so that response is allowed to replace them.
|
|
49
|
+
*/
|
|
50
|
+
export function applyInvoicingFormDraftSaved(draftById, id) {
|
|
51
|
+
const existing = draftById[id];
|
|
52
|
+
if (existing == null) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
existing.fetchState = 'Not-Started';
|
|
56
|
+
}
|
|
44
57
|
/** The draft's values, or the blank form when nothing is drafted yet. */
|
|
45
58
|
export function getInvoicingFormDraftLocalData(draftById, id, blankLocalData) {
|
|
46
59
|
if (id == null) {
|