@zeniai/client-epic-state 5.2.36 → 5.2.37
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/commonPayloadTypes/classesView/reportByClassPayloadV2.d.ts +13 -1
- package/lib/entity/sectionClassesViewV2/sectionClassesViewEpic.js +10 -7
- package/lib/entity/sectionClassesViewV2/sectionClassesViewReducer.d.ts +3 -3
- package/lib/entity/sectionProjectView/sectionProjectViewEpic.js +6 -2
- package/lib/entity/sectionProjectView/sectionProjectViewReducer.d.ts +3 -3
- package/lib/entity/sectionProjectView/sectionProjectViewReducer.js +4 -3
- package/lib/epic.js +12 -0
- package/lib/esm/entity/class/classReducer.js +1 -1
- package/lib/esm/entity/sectionClassesViewV2/sectionClassesViewEpic.js +10 -7
- package/lib/esm/entity/sectionProjectView/sectionProjectViewEpic.js +6 -2
- package/lib/esm/entity/sectionProjectView/sectionProjectViewReducer.js +5 -4
- package/lib/esm/epic.js +12 -0
- package/lib/esm/index.js +2 -2
- package/lib/esm/view/aiCfoView/aiCfoViewReducer.js +266 -1
- package/lib/esm/view/aiCfoView/aiCfoViewSelector.js +50 -0
- package/lib/esm/view/aiCfoView/epics/deleteRoutineEpic.js +35 -0
- package/lib/esm/view/aiCfoView/epics/fetchRoutineRunsEpic.js +35 -0
- package/lib/esm/view/aiCfoView/epics/fetchRoutinesEpic.js +37 -0
- package/lib/esm/view/aiCfoView/epics/runRoutineEpic.js +34 -0
- package/lib/esm/view/aiCfoView/epics/saveRoutineEpic.js +65 -0
- package/lib/esm/view/aiCfoView/epics/setRoutineEnabledEpic.js +28 -0
- package/lib/esm/view/aiCfoView/epics/toRoutine.js +64 -0
- package/lib/esm/view/aiCfoView/epics/toRoutineRun.js +42 -0
- package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewPayload.js +4 -0
- package/lib/index.d.ts +4 -4
- package/lib/index.js +55 -40
- package/lib/view/aiCfoView/aiCfoViewPayload.d.ts +90 -0
- package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +164 -123
- package/lib/view/aiCfoView/aiCfoViewReducer.js +268 -3
- package/lib/view/aiCfoView/aiCfoViewSelector.d.ts +13 -1
- package/lib/view/aiCfoView/aiCfoViewSelector.js +55 -0
- package/lib/view/aiCfoView/aiCfoViewState.d.ts +157 -0
- package/lib/view/aiCfoView/epics/deleteRoutineEpic.d.ts +18 -0
- package/lib/view/aiCfoView/epics/deleteRoutineEpic.js +39 -0
- package/lib/view/aiCfoView/epics/fetchRoutineRunsEpic.d.ts +13 -0
- package/lib/view/aiCfoView/epics/fetchRoutineRunsEpic.js +39 -0
- package/lib/view/aiCfoView/epics/fetchRoutinesEpic.d.ts +7 -0
- package/lib/view/aiCfoView/epics/fetchRoutinesEpic.js +41 -0
- package/lib/view/aiCfoView/epics/runRoutineEpic.d.ts +14 -0
- package/lib/view/aiCfoView/epics/runRoutineEpic.js +38 -0
- package/lib/view/aiCfoView/epics/saveRoutineEpic.d.ts +13 -0
- package/lib/view/aiCfoView/epics/saveRoutineEpic.js +69 -0
- package/lib/view/aiCfoView/epics/setRoutineEnabledEpic.d.ts +15 -0
- package/lib/view/aiCfoView/epics/setRoutineEnabledEpic.js +32 -0
- package/lib/view/aiCfoView/epics/toRoutine.d.ts +17 -0
- package/lib/view/aiCfoView/epics/toRoutine.js +69 -0
- package/lib/view/aiCfoView/epics/toRoutineRun.d.ts +12 -0
- package/lib/view/aiCfoView/epics/toRoutineRun.js +47 -0
- package/lib/view/cashFlowClassesView/cashFlowClassesViewPayload.d.ts +4 -4
- package/lib/view/cashFlowProjectView/cashFlowProjectViewPayload.d.ts +4 -4
- package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewPayload.d.ts +1 -11
- package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewPayload.js +4 -0
- package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer.d.ts +1 -2
- package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewSelector.d.ts +1 -2
- package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewState.d.ts +15 -1
- package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewState.d.ts +1 -1
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewPayload.d.ts +12 -0
- package/package.json +1 -1
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deleteRoutineEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const responsePayload_1 = require("../../../responsePayload");
|
|
7
|
+
const aiCfoViewReducer_1 = require("../aiCfoViewReducer");
|
|
8
|
+
/**
|
|
9
|
+
* DELETE /1.0/routines/{scheduleId}.
|
|
10
|
+
*
|
|
11
|
+
* The row has already left the list by the time this runs — the reducer removes
|
|
12
|
+
* it optimistically so the click does not feel ignored.
|
|
13
|
+
*
|
|
14
|
+
* A failure therefore has to put it BACK, not merely report. The routine still
|
|
15
|
+
* exists and is still emailing the user their financials on a schedule; leaving
|
|
16
|
+
* it hidden would tell them they had stopped something they had not. So a
|
|
17
|
+
* failure drops the tombstone and refetches, and the error explains why the row
|
|
18
|
+
* returned.
|
|
19
|
+
*/
|
|
20
|
+
const deleteRoutineEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(aiCfoViewReducer_1.deleteRoutine.match),
|
|
21
|
+
// mergeMap: deleting one routine must not cancel the delete of another.
|
|
22
|
+
(0, operators_1.mergeMap)((action) => {
|
|
23
|
+
const { scheduleId } = action.payload;
|
|
24
|
+
return zeniAPI
|
|
25
|
+
.deleteAndGetJSON(`${zeniAPI.apiEndPoints.aiCfoMicroServiceBaseUrl}/1.0/routines/${encodeURIComponent(scheduleId)}`)
|
|
26
|
+
.pipe((0, operators_1.mergeMap)((response) =>
|
|
27
|
+
// isSuccessStatus, NOT isSuccessResponse: the latter also requires a
|
|
28
|
+
// non-null `data`, and a successful DELETE here is a 204 with no body.
|
|
29
|
+
// deleteSkillEpic carries the same note for the same reason — using
|
|
30
|
+
// the wrong one reported every completed delete as a failure, which
|
|
31
|
+
// here would also drop the tombstone and refetch the row back.
|
|
32
|
+
(0, responsePayload_1.isSuccessStatus)(response)
|
|
33
|
+
? (0, rxjs_1.of)((0, aiCfoViewReducer_1.deleteRoutineSuccess)({ scheduleId }))
|
|
34
|
+
: (0, rxjs_1.of)((0, aiCfoViewReducer_1.deleteRoutineFailure)({ scheduleId, status: response.status }), (0, aiCfoViewReducer_1.fetchRoutines)())), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, aiCfoViewReducer_1.deleteRoutineFailure)({
|
|
35
|
+
scheduleId,
|
|
36
|
+
status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Delete routine REST API call failed', error instanceof Error ? { message: error.message } : undefined),
|
|
37
|
+
}), (0, aiCfoViewReducer_1.fetchRoutines)())));
|
|
38
|
+
}));
|
|
39
|
+
exports.deleteRoutineEpic = deleteRoutineEpic;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ActionsObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { ZeniAPI } from '../../../zeniAPI';
|
|
4
|
+
import { fetchRoutineRuns, fetchRoutineRunsFailure, fetchRoutineRunsSuccess } from '../aiCfoViewReducer';
|
|
5
|
+
export type ActionType = ReturnType<typeof fetchRoutineRuns> | ReturnType<typeof fetchRoutineRunsSuccess> | ReturnType<typeof fetchRoutineRunsFailure>;
|
|
6
|
+
/**
|
|
7
|
+
* GET /1.0/routines/{scheduleId}/runs — one routine's run history.
|
|
8
|
+
*
|
|
9
|
+
* switchMap: only the history the user has open matters, so expanding a second
|
|
10
|
+
* routine while the first is still loading should abandon the first rather than
|
|
11
|
+
* race it into the single slot the state keeps.
|
|
12
|
+
*/
|
|
13
|
+
export declare const fetchRoutineRunsEpic: (actions$: ActionsObservable<ActionType>, _state$: unknown, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchRoutineRunsEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const responsePayload_1 = require("../../../responsePayload");
|
|
7
|
+
const aiCfoViewReducer_1 = require("../aiCfoViewReducer");
|
|
8
|
+
const toRoutineRun_1 = require("./toRoutineRun");
|
|
9
|
+
/**
|
|
10
|
+
* GET /1.0/routines/{scheduleId}/runs — one routine's run history.
|
|
11
|
+
*
|
|
12
|
+
* switchMap: only the history the user has open matters, so expanding a second
|
|
13
|
+
* routine while the first is still loading should abandon the first rather than
|
|
14
|
+
* race it into the single slot the state keeps.
|
|
15
|
+
*/
|
|
16
|
+
const fetchRoutineRunsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(aiCfoViewReducer_1.fetchRoutineRuns.match), (0, operators_1.switchMap)((action) => {
|
|
17
|
+
const { scheduleId } = action.payload;
|
|
18
|
+
return zeniAPI
|
|
19
|
+
.getJSON(`${zeniAPI.apiEndPoints.aiCfoMicroServiceBaseUrl}/1.0/routines/${encodeURIComponent(scheduleId)}/runs`)
|
|
20
|
+
.pipe((0, operators_1.map)((response) => {
|
|
21
|
+
// The explicit `data == null` is what narrows the type — the helper
|
|
22
|
+
// returns a plain boolean, not a type guard — and it means a
|
|
23
|
+
// malformed 2xx becomes a failure rather than an empty history,
|
|
24
|
+
// which would read as "this has never run" when it has.
|
|
25
|
+
if (!(0, responsePayload_1.isSuccessResponse)(response) || response.data == null) {
|
|
26
|
+
return (0, aiCfoViewReducer_1.fetchRoutineRunsFailure)(response.status);
|
|
27
|
+
}
|
|
28
|
+
const { data } = response;
|
|
29
|
+
return (0, aiCfoViewReducer_1.fetchRoutineRunsSuccess)({
|
|
30
|
+
// Filtered, not trusted: one malformed row must not take the
|
|
31
|
+
// whole history down, and a run without an id is not addressable
|
|
32
|
+
// by anything the UI does with it.
|
|
33
|
+
runs: (data.runs ?? []).filter(toRoutineRun_1.isRoutineRunPayload).map(toRoutineRun_1.toRoutineRun),
|
|
34
|
+
scheduleId,
|
|
35
|
+
sessionId: data.session_id ?? null,
|
|
36
|
+
});
|
|
37
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, aiCfoViewReducer_1.fetchRoutineRunsFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch routine runs REST API call failed', error instanceof Error ? { message: error.message } : undefined)))));
|
|
38
|
+
}));
|
|
39
|
+
exports.fetchRoutineRunsEpic = fetchRoutineRunsEpic;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ActionsObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { ZeniAPI } from '../../../zeniAPI';
|
|
4
|
+
import { fetchRoutines, fetchRoutinesFailure, fetchRoutinesSuccess } from '../aiCfoViewReducer';
|
|
5
|
+
export type ActionType = ReturnType<typeof fetchRoutines> | ReturnType<typeof fetchRoutinesSuccess> | ReturnType<typeof fetchRoutinesFailure>;
|
|
6
|
+
/** GET /1.0/routines — the caller's own scheduled runs. */
|
|
7
|
+
export declare const fetchRoutinesEpic: (actions$: ActionsObservable<ActionType>, _state$: unknown, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchRoutinesEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const responsePayload_1 = require("../../../responsePayload");
|
|
7
|
+
const aiCfoViewReducer_1 = require("../aiCfoViewReducer");
|
|
8
|
+
const toRoutine_1 = require("./toRoutine");
|
|
9
|
+
/** GET /1.0/routines — the caller's own scheduled runs. */
|
|
10
|
+
const fetchRoutinesEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(aiCfoViewReducer_1.fetchRoutines.match),
|
|
11
|
+
// switchMap: a read. A newer list request makes an older one's answer
|
|
12
|
+
// irrelevant, and letting both land means the older can arrive second and
|
|
13
|
+
// overwrite the newer — which matters here because every write refetches,
|
|
14
|
+
// so two GETs in flight is the normal case rather than the exotic one. It
|
|
15
|
+
// also widens the delete tombstone's race window.
|
|
16
|
+
(0, operators_1.switchMap)(() => zeniAPI
|
|
17
|
+
.getJSON(`${zeniAPI.apiEndPoints.aiCfoMicroServiceBaseUrl}/1.0/routines`)
|
|
18
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
19
|
+
// The explicit `data == null` is what narrows the type — the
|
|
20
|
+
// helper returns a plain boolean, not a type guard — and it means a
|
|
21
|
+
// malformed 2xx becomes a failure rather than a silent empty list,
|
|
22
|
+
// which would read as "you have no routines" when you do.
|
|
23
|
+
if (!(0, responsePayload_1.isSuccessResponse)(response) || response.data == null) {
|
|
24
|
+
return (0, rxjs_1.of)((0, aiCfoViewReducer_1.fetchRoutinesFailure)(response.status));
|
|
25
|
+
}
|
|
26
|
+
const { data } = response;
|
|
27
|
+
return (0, rxjs_1.of)((0, aiCfoViewReducer_1.fetchRoutinesSuccess)({
|
|
28
|
+
// Malformed rows are dropped, not defaulted into existence: a
|
|
29
|
+
// routine with no id cannot be opened, paused or deleted, so
|
|
30
|
+
// rendering one offers controls that cannot work.
|
|
31
|
+
routines: (data.routines ?? [])
|
|
32
|
+
.filter(toRoutine_1.isRoutinePayload)
|
|
33
|
+
.map(toRoutine_1.toRoutine),
|
|
34
|
+
maxRoutines: data.max_routines ?? 0,
|
|
35
|
+
// Absent reads as OFF, matching the server's fail-closed gate:
|
|
36
|
+
// an older backend that does not send it should hide the entry,
|
|
37
|
+
// not show one whose endpoints 404.
|
|
38
|
+
routinesEnabled: data.routines_enabled === true,
|
|
39
|
+
}));
|
|
40
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, aiCfoViewReducer_1.fetchRoutinesFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch routines REST API call failed', error instanceof Error ? { message: error.message } : undefined)))))));
|
|
41
|
+
exports.fetchRoutinesEpic = fetchRoutinesEpic;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ActionsObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { ZeniAPI } from '../../../zeniAPI';
|
|
4
|
+
import { fetchRoutineRuns, fetchRoutines, runRoutine, runRoutineFailure, runRoutineSuccess } from '../aiCfoViewReducer';
|
|
5
|
+
export type ActionType = ReturnType<typeof runRoutine> | ReturnType<typeof runRoutineSuccess> | ReturnType<typeof runRoutineFailure> | ReturnType<typeof fetchRoutineRuns> | ReturnType<typeof fetchRoutines>;
|
|
6
|
+
/**
|
|
7
|
+
* POST /1.0/routines/{scheduleId}/run — run a routine now.
|
|
8
|
+
*
|
|
9
|
+
* The response says the run was QUEUED, not that it finished: the answer is
|
|
10
|
+
* emailed a minute or two later. So nothing is spliced in — both refetches are
|
|
11
|
+
* what show the new run, and the outcome arrives on a later fetch rather than
|
|
12
|
+
* being polled for.
|
|
13
|
+
*/
|
|
14
|
+
export declare const runRoutineEpic: (actions$: ActionsObservable<ActionType>, _state$: unknown, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runRoutineEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const responsePayload_1 = require("../../../responsePayload");
|
|
7
|
+
const aiCfoViewReducer_1 = require("../aiCfoViewReducer");
|
|
8
|
+
/**
|
|
9
|
+
* POST /1.0/routines/{scheduleId}/run — run a routine now.
|
|
10
|
+
*
|
|
11
|
+
* The response says the run was QUEUED, not that it finished: the answer is
|
|
12
|
+
* emailed a minute or two later. So nothing is spliced in — both refetches are
|
|
13
|
+
* what show the new run, and the outcome arrives on a later fetch rather than
|
|
14
|
+
* being polled for.
|
|
15
|
+
*/
|
|
16
|
+
const runRoutineEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(aiCfoViewReducer_1.runRoutine.match),
|
|
17
|
+
// mergeMap, not exhaustMap: these target different rows, so running one
|
|
18
|
+
// routine must not swallow a request to run another. A double-click on the
|
|
19
|
+
// SAME row is already harmless — the server keys a manual run by the
|
|
20
|
+
// minute, so the second press finds the first run and reports it.
|
|
21
|
+
(0, operators_1.mergeMap)((action) => {
|
|
22
|
+
const { scheduleId } = action.payload;
|
|
23
|
+
return zeniAPI
|
|
24
|
+
.postAndGetJSON(`${zeniAPI.apiEndPoints.aiCfoMicroServiceBaseUrl}/1.0/routines/${encodeURIComponent(scheduleId)}/run`, {})
|
|
25
|
+
.pipe((0, operators_1.mergeMap)((response) =>
|
|
26
|
+
// isSuccessStatus, not isSuccessResponse: "already_running" is a
|
|
27
|
+
// legitimate 200 whose body carries no routine, and treating a
|
|
28
|
+
// second press as a failure would be a lie about what happened.
|
|
29
|
+
(0, responsePayload_1.isSuccessStatus)(response)
|
|
30
|
+
? (0, rxjs_1.of)((0, aiCfoViewReducer_1.runRoutineSuccess)(), (0, aiCfoViewReducer_1.fetchRoutines)(),
|
|
31
|
+
// The run history too, or the panel the user is looking at
|
|
32
|
+
// keeps showing the runs from before they pressed Run. The
|
|
33
|
+
// new row comes back as claimed/running — the run has been
|
|
34
|
+
// queued, not finished — which is the honest thing to show.
|
|
35
|
+
(0, aiCfoViewReducer_1.fetchRoutineRuns)({ scheduleId }))
|
|
36
|
+
: (0, rxjs_1.of)((0, aiCfoViewReducer_1.runRoutineFailure)(response.status))), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, aiCfoViewReducer_1.runRoutineFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Run routine REST API call failed', error instanceof Error ? { message: error.message } : undefined)))));
|
|
37
|
+
}));
|
|
38
|
+
exports.runRoutineEpic = runRoutineEpic;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ActionsObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { ZeniAPI } from '../../../zeniAPI';
|
|
4
|
+
import { fetchRoutines, saveRoutine, saveRoutineFailure, saveRoutineSuccess } from '../aiCfoViewReducer';
|
|
5
|
+
export type ActionType = ReturnType<typeof saveRoutine> | ReturnType<typeof saveRoutineSuccess> | ReturnType<typeof saveRoutineFailure> | ReturnType<typeof fetchRoutines>;
|
|
6
|
+
/**
|
|
7
|
+
* POST /1.0/routines (create) or PUT /1.0/routines/{scheduleId} (update).
|
|
8
|
+
*
|
|
9
|
+
* One epic for both: to a user they are the same act, and the server answers
|
|
10
|
+
* both with the routine. Splitting them would duplicate the body mapping and
|
|
11
|
+
* the error handling for a difference the form does not have.
|
|
12
|
+
*/
|
|
13
|
+
export declare const saveRoutineEpic: (actions$: ActionsObservable<ActionType>, _state$: unknown, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.saveRoutineEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const responsePayload_1 = require("../../../responsePayload");
|
|
7
|
+
const aiCfoViewReducer_1 = require("../aiCfoViewReducer");
|
|
8
|
+
/**
|
|
9
|
+
* POST /1.0/routines (create) or PUT /1.0/routines/{scheduleId} (update).
|
|
10
|
+
*
|
|
11
|
+
* One epic for both: to a user they are the same act, and the server answers
|
|
12
|
+
* both with the routine. Splitting them would duplicate the body mapping and
|
|
13
|
+
* the error handling for a difference the form does not have.
|
|
14
|
+
*/
|
|
15
|
+
const saveRoutineEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(aiCfoViewReducer_1.saveRoutine.match),
|
|
16
|
+
// exhaustMap, and neither of the obvious two.
|
|
17
|
+
//
|
|
18
|
+
// switchMap is wrong: it cancels the client's subscription, not the request
|
|
19
|
+
// that already left the browser. The routine is still created; the client
|
|
20
|
+
// just stops listening and never tells the user.
|
|
21
|
+
//
|
|
22
|
+
// mergeMap is wrong for the same reason in reverse: a double-clicked Save
|
|
23
|
+
// sends two POSTs, and the user gets two routines that both email them the
|
|
24
|
+
// company's financials on the same schedule.
|
|
25
|
+
//
|
|
26
|
+
// exhaustMap ignores further saves while one is in flight, which is exactly
|
|
27
|
+
// what a submit button should do.
|
|
28
|
+
(0, operators_1.exhaustMap)((action) => {
|
|
29
|
+
const { draft, scheduleId } = action.payload;
|
|
30
|
+
const base = `${zeniAPI.apiEndPoints.aiCfoMicroServiceBaseUrl}/1.0/routines`;
|
|
31
|
+
const isUpdate = scheduleId != null && scheduleId !== '';
|
|
32
|
+
const body = {
|
|
33
|
+
name: draft.name,
|
|
34
|
+
recurrence: draft.recurrence,
|
|
35
|
+
hour: draft.hour,
|
|
36
|
+
minute: draft.minute ?? 0,
|
|
37
|
+
tz_name: draft.tzName,
|
|
38
|
+
// Spread rather than sent as null. `weekday` and `day_of_month` are
|
|
39
|
+
// meaningful only for their own recurrence, and the server validates
|
|
40
|
+
// that pairing — sending a stale weekday alongside a monthly cadence is
|
|
41
|
+
// a 400 rather than a field politely ignored.
|
|
42
|
+
...(draft.recurrence === 'weekly' &&
|
|
43
|
+
draft.weekday != null && { weekday: draft.weekday }),
|
|
44
|
+
...(draft.recurrence === 'monthly' &&
|
|
45
|
+
draft.dayOfMonth != null && { day_of_month: draft.dayOfMonth }),
|
|
46
|
+
...(draft.enabled != null && { enabled: draft.enabled }),
|
|
47
|
+
// `macro_id` is create-only: re-sending it on an update would let an
|
|
48
|
+
// edit silently repoint a schedule at a different skill.
|
|
49
|
+
...(!isUpdate && draft.macroId != null && { macro_id: draft.macroId }),
|
|
50
|
+
// `prompt` is allowed on both. On update the server accepts it only for
|
|
51
|
+
// a one-off, where it saves a new version of the routine's own
|
|
52
|
+
// instructions — that is editing what this routine says, not repointing
|
|
53
|
+
// it at someone else's skill.
|
|
54
|
+
...(draft.prompt != null && { prompt: draft.prompt }),
|
|
55
|
+
};
|
|
56
|
+
const request$ = isUpdate
|
|
57
|
+
? zeniAPI.putAndGetJSON(`${base}/${encodeURIComponent(scheduleId)}`, body)
|
|
58
|
+
: zeniAPI.postAndGetJSON(base, body);
|
|
59
|
+
return request$.pipe((0, operators_1.mergeMap)((response) => {
|
|
60
|
+
if (!(0, responsePayload_1.isSuccessResponse)(response)) {
|
|
61
|
+
return (0, rxjs_1.of)((0, aiCfoViewReducer_1.saveRoutineFailure)(response.status));
|
|
62
|
+
}
|
|
63
|
+
// Refetch rather than splice the response in: a create changes the
|
|
64
|
+
// list's ordering, and the server recomputes `next_run_at` on every
|
|
65
|
+
// write, so a local insert would show a time the next load moves.
|
|
66
|
+
return (0, rxjs_1.of)((0, aiCfoViewReducer_1.saveRoutineSuccess)(), (0, aiCfoViewReducer_1.fetchRoutines)());
|
|
67
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, aiCfoViewReducer_1.saveRoutineFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Save routine REST API call failed', error instanceof Error ? { message: error.message } : undefined)))));
|
|
68
|
+
}));
|
|
69
|
+
exports.saveRoutineEpic = saveRoutineEpic;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ActionsObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { ZeniAPI } from '../../../zeniAPI';
|
|
4
|
+
import { fetchRoutines, saveRoutineFailure, saveRoutineSuccess, setRoutineEnabled } from '../aiCfoViewReducer';
|
|
5
|
+
export type ActionType = ReturnType<typeof setRoutineEnabled> | ReturnType<typeof saveRoutineSuccess> | ReturnType<typeof saveRoutineFailure> | ReturnType<typeof fetchRoutines>;
|
|
6
|
+
/**
|
|
7
|
+
* PUT /1.0/routines/{scheduleId} with nothing but `enabled`.
|
|
8
|
+
*
|
|
9
|
+
* Separate from `saveRoutineEpic` because pausing is not editing. A routine
|
|
10
|
+
* whose cadence this client version does not recognise has `recurrence: null`
|
|
11
|
+
* and cannot produce a `RoutineDraft` — and that is precisely the routine
|
|
12
|
+
* someone most needs to be able to stop. Sending only `enabled` also means a
|
|
13
|
+
* pause can never rewrite a schedule as a side effect.
|
|
14
|
+
*/
|
|
15
|
+
export declare const setRoutineEnabledEpic: (actions$: ActionsObservable<ActionType>, _state$: unknown, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setRoutineEnabledEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const responsePayload_1 = require("../../../responsePayload");
|
|
7
|
+
const aiCfoViewReducer_1 = require("../aiCfoViewReducer");
|
|
8
|
+
/**
|
|
9
|
+
* PUT /1.0/routines/{scheduleId} with nothing but `enabled`.
|
|
10
|
+
*
|
|
11
|
+
* Separate from `saveRoutineEpic` because pausing is not editing. A routine
|
|
12
|
+
* whose cadence this client version does not recognise has `recurrence: null`
|
|
13
|
+
* and cannot produce a `RoutineDraft` — and that is precisely the routine
|
|
14
|
+
* someone most needs to be able to stop. Sending only `enabled` also means a
|
|
15
|
+
* pause can never rewrite a schedule as a side effect.
|
|
16
|
+
*/
|
|
17
|
+
const setRoutineEnabledEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(aiCfoViewReducer_1.setRoutineEnabled.match),
|
|
18
|
+
// mergeMap: pausing one routine must not cancel pausing another, and these
|
|
19
|
+
// target different rows so they cannot collide the way two saves of one
|
|
20
|
+
// form would.
|
|
21
|
+
(0, operators_1.mergeMap)((action) => {
|
|
22
|
+
const { enabled, scheduleId } = action.payload;
|
|
23
|
+
return zeniAPI
|
|
24
|
+
.putAndGetJSON(`${zeniAPI.apiEndPoints.aiCfoMicroServiceBaseUrl}/1.0/routines/${encodeURIComponent(scheduleId)}`, { enabled })
|
|
25
|
+
.pipe((0, operators_1.mergeMap)((response) => (0, responsePayload_1.isSuccessResponse)(response)
|
|
26
|
+
? (0, rxjs_1.of)((0, aiCfoViewReducer_1.saveRoutineSuccess)(), (0, aiCfoViewReducer_1.fetchRoutines)())
|
|
27
|
+
: // Refetch on failure too: the switch was flipped optimistically,
|
|
28
|
+
// and leaving it showing "paused" for a routine that is still
|
|
29
|
+
// running would be the one lie this list must not tell.
|
|
30
|
+
(0, rxjs_1.of)((0, aiCfoViewReducer_1.saveRoutineFailure)(response.status), (0, aiCfoViewReducer_1.fetchRoutines)())), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, aiCfoViewReducer_1.saveRoutineFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Set routine enabled REST API call failed', error instanceof Error ? { message: error.message } : undefined)), (0, aiCfoViewReducer_1.fetchRoutines)())));
|
|
31
|
+
}));
|
|
32
|
+
exports.setRoutineEnabledEpic = setRoutineEnabledEpic;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { RoutinePayload } from '../aiCfoViewPayload';
|
|
2
|
+
import { Routine } from '../aiCfoViewState';
|
|
3
|
+
/**
|
|
4
|
+
* A routine is usable if it has an identity. That is the whole bar.
|
|
5
|
+
*
|
|
6
|
+
* `schedule_id` and `name` are what every consumer dereferences, so those are
|
|
7
|
+
* what this establishes.
|
|
8
|
+
*
|
|
9
|
+
* Deliberately NOT also requiring `macro_id`. A routine whose skill was deleted
|
|
10
|
+
* can come back without one — and it is still an active schedule emailing the
|
|
11
|
+
* user's financials. Dropping it here would make it invisible in the UI while
|
|
12
|
+
* it kept running, with no way for anyone to turn it off. Showing a broken row
|
|
13
|
+
* that can be paused or deleted is strictly better than hiding a live one.
|
|
14
|
+
*/
|
|
15
|
+
export declare const isRoutinePayload: (value: unknown) => value is RoutinePayload;
|
|
16
|
+
/** Map one routine off the wire. Every default here is a deliberate reading. */
|
|
17
|
+
export declare const toRoutine: (payload: RoutinePayload) => Routine;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toRoutine = exports.isRoutinePayload = void 0;
|
|
4
|
+
const RECURRENCES = ['daily', 'weekly', 'monthly'];
|
|
5
|
+
const STATUSES = ['succeeded', 'failed', 'timeout'];
|
|
6
|
+
/**
|
|
7
|
+
* A routine is usable if it has an identity. That is the whole bar.
|
|
8
|
+
*
|
|
9
|
+
* `schedule_id` and `name` are what every consumer dereferences, so those are
|
|
10
|
+
* what this establishes.
|
|
11
|
+
*
|
|
12
|
+
* Deliberately NOT also requiring `macro_id`. A routine whose skill was deleted
|
|
13
|
+
* can come back without one — and it is still an active schedule emailing the
|
|
14
|
+
* user's financials. Dropping it here would make it invisible in the UI while
|
|
15
|
+
* it kept running, with no way for anyone to turn it off. Showing a broken row
|
|
16
|
+
* that can be paused or deleted is strictly better than hiding a live one.
|
|
17
|
+
*/
|
|
18
|
+
const isRoutinePayload = (value) => {
|
|
19
|
+
const candidate = value;
|
|
20
|
+
return (typeof candidate?.schedule_id === 'string' &&
|
|
21
|
+
candidate.schedule_id !== '' &&
|
|
22
|
+
typeof candidate.name === 'string');
|
|
23
|
+
};
|
|
24
|
+
exports.isRoutinePayload = isRoutinePayload;
|
|
25
|
+
/**
|
|
26
|
+
* Narrow a server string to a known recurrence, or null.
|
|
27
|
+
*
|
|
28
|
+
* Null, NOT a fallback to 'daily'. A read-side default becomes a write-side
|
|
29
|
+
* value the moment the user opens that routine and saves it — so guessing here
|
|
30
|
+
* would quietly convert a cadence this client does not understand into a daily
|
|
31
|
+
* one, and the owner would find out from the volume of email. Null says "this
|
|
32
|
+
* client does not know", and the UI shows the row so it can still be paused or
|
|
33
|
+
* deleted while refusing to edit its schedule.
|
|
34
|
+
*/
|
|
35
|
+
const toRecurrence = (value) => RECURRENCES.includes(value)
|
|
36
|
+
? value
|
|
37
|
+
: null;
|
|
38
|
+
const toStatus = (value) => STATUSES.includes(value) ? value : null;
|
|
39
|
+
/** Map one routine off the wire. Every default here is a deliberate reading. */
|
|
40
|
+
const toRoutine = (payload) => ({
|
|
41
|
+
unreadRuns: payload.unread_runs ?? 0,
|
|
42
|
+
consecutiveFailures: payload.consecutive_failures ?? 0,
|
|
43
|
+
dayOfMonth: payload.day_of_month ?? null,
|
|
44
|
+
// Absent reads as enabled: a routine the server returned without the flag is
|
|
45
|
+
// one it intends to run, and defaulting to false would show every row paused.
|
|
46
|
+
enabled: payload.enabled !== false,
|
|
47
|
+
hour: payload.hour ?? 0,
|
|
48
|
+
isAdHoc: payload.is_ad_hoc === true,
|
|
49
|
+
lastRunAt: payload.last_run_at ?? null,
|
|
50
|
+
lastStatus: toStatus(payload.last_status),
|
|
51
|
+
// '' is the sanctioned "unset ID" (CLAUDE.md), not a papered-over absence:
|
|
52
|
+
// the row still renders, and the UI reads this to show it as broken rather
|
|
53
|
+
// than offering to open a skill that is not there.
|
|
54
|
+
macroId: payload.macro_id ?? '',
|
|
55
|
+
minute: payload.minute ?? 0,
|
|
56
|
+
name: payload.name,
|
|
57
|
+
nextRunAt: payload.next_run_at ?? null,
|
|
58
|
+
pinnedVersion: payload.pinned_version ?? null,
|
|
59
|
+
recurrence: toRecurrence(payload.recurrence),
|
|
60
|
+
scheduleId: payload.schedule_id,
|
|
61
|
+
sessionId: payload.session_id ?? null,
|
|
62
|
+
// Null, not a guessed 'UTC'. Same trap as `recurrence`: a read-side default
|
|
63
|
+
// is written straight back on the next save, silently moving the routine's
|
|
64
|
+
// delivery by however many hours the real zone differed by. The server always
|
|
65
|
+
// sends this, so null means something is wrong and the UI should say so.
|
|
66
|
+
tzName: payload.tz_name ?? null,
|
|
67
|
+
weekday: payload.weekday ?? null,
|
|
68
|
+
});
|
|
69
|
+
exports.toRoutine = toRoutine;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RoutineRunPayload } from '../aiCfoViewPayload';
|
|
2
|
+
import { RoutineRun } from '../aiCfoViewState';
|
|
3
|
+
/**
|
|
4
|
+
* A run is usable if it has an identity — the same bar `isRoutinePayload` sets.
|
|
5
|
+
*
|
|
6
|
+
* Nothing else is required. A run that is still in flight has no `finished_at`,
|
|
7
|
+
* a claimed one has no `started_at`, and a failed one may have neither an error
|
|
8
|
+
* nor an answer to link to. Requiring any of those would drop exactly the rows
|
|
9
|
+
* the history exists to show.
|
|
10
|
+
*/
|
|
11
|
+
export declare const isRoutineRunPayload: (value: unknown) => value is RoutineRunPayload;
|
|
12
|
+
export declare const toRoutineRun: (payload: RoutineRunPayload) => RoutineRun;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toRoutineRun = exports.isRoutineRunPayload = void 0;
|
|
4
|
+
const STATUSES = [
|
|
5
|
+
'claimed',
|
|
6
|
+
'running',
|
|
7
|
+
'succeeded',
|
|
8
|
+
'failed',
|
|
9
|
+
'timeout',
|
|
10
|
+
];
|
|
11
|
+
/**
|
|
12
|
+
* A run is usable if it has an identity — the same bar `isRoutinePayload` sets.
|
|
13
|
+
*
|
|
14
|
+
* Nothing else is required. A run that is still in flight has no `finished_at`,
|
|
15
|
+
* a claimed one has no `started_at`, and a failed one may have neither an error
|
|
16
|
+
* nor an answer to link to. Requiring any of those would drop exactly the rows
|
|
17
|
+
* the history exists to show.
|
|
18
|
+
*/
|
|
19
|
+
const isRoutineRunPayload = (value) => {
|
|
20
|
+
const candidate = value;
|
|
21
|
+
return typeof candidate?.run_id === 'string' && candidate.run_id !== '';
|
|
22
|
+
};
|
|
23
|
+
exports.isRoutineRunPayload = isRoutineRunPayload;
|
|
24
|
+
/**
|
|
25
|
+
* Narrow a server status to one this client knows, or null.
|
|
26
|
+
*
|
|
27
|
+
* Null rather than a fallback, for the same reason `toRecurrence` returns null:
|
|
28
|
+
* a guess here would badge an unknown state as something specific, and on a run
|
|
29
|
+
* history the difference between "failed" and "we don't know" is the whole
|
|
30
|
+
* message. The UI shows an unknown status as neither succeeded nor failed.
|
|
31
|
+
*/
|
|
32
|
+
const toStatus = (value) => STATUSES.find((status) => status === value) ?? null;
|
|
33
|
+
/** Empty strings become null: the server sends '' for an absent deep link. */
|
|
34
|
+
const toId = (value) => value != null && value !== '' ? value : null;
|
|
35
|
+
const toRoutineRun = (payload) => ({
|
|
36
|
+
runId: payload.run_id,
|
|
37
|
+
attempt: payload.attempt ?? 1,
|
|
38
|
+
isManual: payload.is_manual === true,
|
|
39
|
+
error: toId(payload.error),
|
|
40
|
+
finishedAt: toId(payload.finished_at),
|
|
41
|
+
questionAnswerId: toId(payload.question_answer_id),
|
|
42
|
+
sessionId: toId(payload.session_id),
|
|
43
|
+
scheduledFor: toId(payload.scheduled_for),
|
|
44
|
+
startedAt: toId(payload.started_at),
|
|
45
|
+
status: toStatus(payload.status),
|
|
46
|
+
});
|
|
47
|
+
exports.toRoutineRun = toRoutineRun;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { ReportByClassMetadataPayloadV2, SectionByClassCOABalanceGroupedPayloadV2 } from '../../commonPayloadTypes/classesView/reportByClassPayloadV2';
|
|
1
|
+
import { CalculatedSectionByClassCOABalanceGroupedPayloadV2, ReportByClassMetadataPayloadV2, SectionByClassCOABalanceGroupedPayloadV2 } from '../../commonPayloadTypes/classesView/reportByClassPayloadV2';
|
|
2
2
|
import { ZeniReportResponse } from '../../responsePayload';
|
|
3
3
|
interface OperatingActivitiesClassesView {
|
|
4
4
|
adjustments: SectionByClassCOABalanceGroupedPayloadV2;
|
|
5
|
-
net_income:
|
|
5
|
+
net_income: CalculatedSectionByClassCOABalanceGroupedPayloadV2;
|
|
6
6
|
}
|
|
7
7
|
export interface CashFlowClassesViewPayload extends ReportByClassMetadataPayloadV2 {
|
|
8
|
-
change_in_cash_and_equivalents:
|
|
8
|
+
change_in_cash_and_equivalents: CalculatedSectionByClassCOABalanceGroupedPayloadV2;
|
|
9
9
|
financing_activities: SectionByClassCOABalanceGroupedPayloadV2;
|
|
10
10
|
investing_activities: SectionByClassCOABalanceGroupedPayloadV2;
|
|
11
|
-
operating_activities:
|
|
11
|
+
operating_activities: CalculatedSectionByClassCOABalanceGroupedPayloadV2 & OperatingActivitiesClassesView;
|
|
12
12
|
}
|
|
13
13
|
export type CashFlowReportClassesViewResponse = ZeniReportResponse<CashFlowClassesViewPayload>;
|
|
14
14
|
export {};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { ZeniReportResponse } from '../../responsePayload';
|
|
2
|
-
import { ReportByProjectMetadataPayloadV2, SectionByProjectCOABalanceGroupedPayloadV2 } from '../profitAndLossProjectView/profitAndLossProjectViewPayload';
|
|
2
|
+
import { CalculatedSectionByProjectCOABalanceGroupedPayloadV2, ReportByProjectMetadataPayloadV2, SectionByProjectCOABalanceGroupedPayloadV2 } from '../profitAndLossProjectView/profitAndLossProjectViewPayload';
|
|
3
3
|
interface OperatingActivitiesProjectView {
|
|
4
4
|
adjustments: SectionByProjectCOABalanceGroupedPayloadV2;
|
|
5
|
-
net_income:
|
|
5
|
+
net_income: CalculatedSectionByProjectCOABalanceGroupedPayloadV2;
|
|
6
6
|
}
|
|
7
7
|
export interface CashFlowProjectViewPayload extends ReportByProjectMetadataPayloadV2 {
|
|
8
|
-
change_in_cash_and_equivalents:
|
|
8
|
+
change_in_cash_and_equivalents: CalculatedSectionByProjectCOABalanceGroupedPayloadV2;
|
|
9
9
|
financing_activities: SectionByProjectCOABalanceGroupedPayloadV2;
|
|
10
10
|
investing_activities: SectionByProjectCOABalanceGroupedPayloadV2;
|
|
11
|
-
operating_activities:
|
|
11
|
+
operating_activities: CalculatedSectionByProjectCOABalanceGroupedPayloadV2 & OperatingActivitiesProjectView;
|
|
12
12
|
}
|
|
13
13
|
export type CashFlowReportProjectViewResponse = ZeniReportResponse<CashFlowProjectViewPayload>;
|
|
14
14
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { InvoicingCustomerPayload } from '../../../entity/invoicing/invoicingCustomer/invoicingCustomerPayload';
|
|
2
2
|
import { ZeniAPIResponse } from '../../../responsePayload';
|
|
3
3
|
import { AddressUpdatableInfo } from '../../addressView/addressViewState';
|
|
4
|
-
import { InvoicingCustomerFormLocalData } from './editInvoicingCustomerDetailViewState';
|
|
4
|
+
import { InvoicingCustomerFormLocalData, InvoicingPaymentLinkEmailPreviewData } from './editInvoicingCustomerDetailViewState';
|
|
5
5
|
export type SaveInvoicingCustomerResponse = ZeniAPIResponse<InvoicingCustomerPayload>;
|
|
6
6
|
/**
|
|
7
7
|
* Build the create/update customer request body from the form draft. The
|
|
@@ -25,15 +25,5 @@ export type InvoicingPaymentLinkEmailPreviewResponse = ZeniAPIResponse<Invoicing
|
|
|
25
25
|
* The email rendered once with sentinel tokens standing in for the subject and
|
|
26
26
|
* body, so the composer can splice a draft into it without another request.
|
|
27
27
|
*/
|
|
28
|
-
export interface InvoicingPaymentLinkEmailPreviewData {
|
|
29
|
-
/** Default body prefill, plain text. */
|
|
30
|
-
body: string;
|
|
31
|
-
bodyToken: string;
|
|
32
|
-
renderedHtmlTemplate: string;
|
|
33
|
-
/** Default subject prefill. */
|
|
34
|
-
subject: string;
|
|
35
|
-
subjectToken: string;
|
|
36
|
-
to: string;
|
|
37
|
-
}
|
|
38
28
|
export declare const toInvoicingPaymentLinkEmailPreview: (payload: InvoicingPaymentLinkEmailPreviewPayload) => InvoicingPaymentLinkEmailPreviewData;
|
|
39
29
|
export type AddPromotionalCreditsResponse = ZeniAPIResponse<InvoicingCustomerPayload>;
|
package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewPayload.js
CHANGED
|
@@ -34,6 +34,10 @@ const localDataToSaveInvoicingCustomerPayload = (localData, billingAddress) => {
|
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
36
|
exports.localDataToSaveInvoicingCustomerPayload = localDataToSaveInvoicingCustomerPayload;
|
|
37
|
+
/**
|
|
38
|
+
* The email rendered once with sentinel tokens standing in for the subject and
|
|
39
|
+
* body, so the composer can splice a draft into it without another request.
|
|
40
|
+
*/
|
|
37
41
|
const toInvoicingPaymentLinkEmailPreview = (payload) => ({
|
|
38
42
|
body: payload.body,
|
|
39
43
|
bodyToken: payload.body_token,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ID } from '../../../commonStateTypes/common';
|
|
2
2
|
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
3
|
-
import { InvoicingPaymentLinkEmailPreviewData } from './
|
|
4
|
-
import { EditInvoicingCustomerDetailViewState, InvoicingCustomerFormLocalData } from './editInvoicingCustomerDetailViewState';
|
|
3
|
+
import { EditInvoicingCustomerDetailViewState, InvoicingCustomerFormLocalData, InvoicingPaymentLinkEmailPreviewData } from './editInvoicingCustomerDetailViewState';
|
|
5
4
|
/** Add promotional credits to a customer. */
|
|
6
5
|
export interface SubmitAddPromotionalCreditsPayload {
|
|
7
6
|
amount: number;
|
|
@@ -5,8 +5,7 @@ import { InvoicingFieldHelpByCode, InvoicingNamedOption } from '../../../entity/
|
|
|
5
5
|
import { InvoicingCustomer, InvoicingCustomerPaymentMethod } from '../../../entity/invoicing/invoicingCustomer/invoicingCustomerState';
|
|
6
6
|
import { RootState } from '../../../rootStateTypes';
|
|
7
7
|
import { InvoicingSetupIntent } from '../customerPaymentMethod/customerPaymentMethodState';
|
|
8
|
-
import { InvoicingPaymentLinkEmailPreviewData } from './
|
|
9
|
-
import { InvoicingCustomerFormLocalData } from './editInvoicingCustomerDetailViewState';
|
|
8
|
+
import { InvoicingCustomerFormLocalData, InvoicingPaymentLinkEmailPreviewData } from './editInvoicingCustomerDetailViewState';
|
|
10
9
|
/**
|
|
11
10
|
* Read-only view for the customer detail page: the customer entity + its fetch
|
|
12
11
|
* state, plus everything the page renders in view mode — recent invoices, the
|
package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewState.d.ts
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
import { FetchStateAndError, FetchedState, ID } from '../../../commonStateTypes/common';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* The payment-link email the composer opens with: the backend's prefill plus
|
|
4
|
+
* the tokens the frontend splices the user's edits into. State, not wire shape
|
|
5
|
+
* — `toInvoicingPaymentLinkEmailPreview` in the payload file maps onto it.
|
|
6
|
+
*/
|
|
7
|
+
export interface InvoicingPaymentLinkEmailPreviewData {
|
|
8
|
+
/** Default body prefill, plain text. */
|
|
9
|
+
body: string;
|
|
10
|
+
bodyToken: string;
|
|
11
|
+
renderedHtmlTemplate: string;
|
|
12
|
+
/** Default subject prefill. */
|
|
13
|
+
subject: string;
|
|
14
|
+
subjectToken: string;
|
|
15
|
+
to: string;
|
|
16
|
+
}
|
|
3
17
|
/**
|
|
4
18
|
* Draft form state for the create/edit customer form. Held in CES so the form
|
|
5
19
|
* flows its data from here (mirrors the bill-pay / reimbursement pattern). The
|
|
@@ -26,7 +26,7 @@ export declare const fetchInvoicingCustomerList: import("@reduxjs/toolkit").Acti
|
|
|
26
26
|
ids: ID[];
|
|
27
27
|
keepExistingListItems: boolean;
|
|
28
28
|
nextCursor: string | null;
|
|
29
|
-
}, "invoicingCustomerListView/updateInvoicingCustomerList">, updateInvoicingCustomerListFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingCustomerListView/updateInvoicingCustomerListFailure">, fetchInvoicingCustomerCounts: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingCustomerListView/fetchInvoicingCustomerCounts">, updateInvoicingCustomerCounts: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingListCounts, "invoicingCustomerListView/updateInvoicingCustomerCounts">, updateInvoicingCustomerCountsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingCustomerListView/updateInvoicingCustomerCountsFailure">, updateInvoicingCustomerFilters: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingCustomerFilters, "invoicingCustomerListView/updateInvoicingCustomerFilters">, setInvoicingCustomerActiveTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"active" | "all" | "
|
|
29
|
+
}, "invoicingCustomerListView/updateInvoicingCustomerList">, updateInvoicingCustomerListFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingCustomerListView/updateInvoicingCustomerListFailure">, fetchInvoicingCustomerCounts: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingCustomerListView/fetchInvoicingCustomerCounts">, updateInvoicingCustomerCounts: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingListCounts, "invoicingCustomerListView/updateInvoicingCustomerCounts">, updateInvoicingCustomerCountsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingCustomerListView/updateInvoicingCustomerCountsFailure">, updateInvoicingCustomerFilters: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingCustomerFilters, "invoicingCustomerListView/updateInvoicingCustomerFilters">, setInvoicingCustomerActiveTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"active" | "all" | "trial" | "at_risk", "invoicingCustomerListView/setInvoicingCustomerActiveTab">, addInvoicingCustomerToList: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
30
30
|
id: ID;
|
|
31
31
|
status?: string;
|
|
32
32
|
}, "invoicingCustomerListView/addInvoicingCustomerToList">;
|