@zeniai/client-epic-state 5.0.90-betaAR3 → 5.0.90-betaAR5
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/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewReducer.js +14 -7
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.js +42 -24
- package/lib/esm/view/spendManagement/billPay/editBillView/epics/fetchEditBillDetailPageEpic.js +8 -2
- package/lib/esm/view/spendManagement/reimbursement/editRemiView/epics/fetchEditRemiDetailPageEpic.js +5 -1
- package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/reorderRemiApprovalRulesEpic.js +14 -2
- package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewReducer.js +11 -7
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewReducer.d.ts +6 -6
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewReducer.js +14 -7
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.d.ts +36 -27
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.js +42 -24
- package/lib/view/spendManagement/billPay/editBillView/epics/fetchEditBillDetailPageEpic.js +8 -2
- package/lib/view/spendManagement/reimbursement/editRemiView/epics/fetchEditRemiDetailPageEpic.js +5 -1
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/reorderRemiApprovalRulesEpic.js +14 -2
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewReducer.d.ts +6 -6
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewReducer.js +11 -7
- package/package.json +1 -1
|
@@ -28,9 +28,11 @@ const billPaySetupApproverView = createSlice({
|
|
|
28
28
|
draft.error = undefined;
|
|
29
29
|
},
|
|
30
30
|
// Approval Rules 3.0 — `useV3` arrives from the screen connector
|
|
31
|
-
// (
|
|
32
|
-
// v2 endpoint in the fetch epic.
|
|
33
|
-
|
|
31
|
+
// ('approval_rule_v3_config' dynamic config) and picks the v1
|
|
32
|
+
// vs v2 endpoint in the fetch epic. Required (no default) so a
|
|
33
|
+
// missing screen-connector wire surfaces at compile time rather
|
|
34
|
+
// than silently falling back to v1 on a v3 tenant.
|
|
35
|
+
prepare(cacheOverride = false, includeUserRoles = true, useV3) {
|
|
34
36
|
return { payload: { cacheOverride, includeUserRoles, useV3 } };
|
|
35
37
|
},
|
|
36
38
|
},
|
|
@@ -117,9 +119,10 @@ const billPaySetupApproverView = createSlice({
|
|
|
117
119
|
};
|
|
118
120
|
},
|
|
119
121
|
// Approval Rules 3.0 — `useV3` flows from the screen connector
|
|
120
|
-
// (
|
|
121
|
-
// can pick the v1 vs v2 endpoint.
|
|
122
|
-
|
|
122
|
+
// ('approval_rule_v3_config' dynamic config) so the delete epic
|
|
123
|
+
// can pick the v1 vs v2 endpoint. Required (no default) so a
|
|
124
|
+
// missing connector wire surfaces at compile time.
|
|
125
|
+
prepare(approvalRuleId, useV3) {
|
|
123
126
|
return { payload: { approvalRuleId, useV3 } };
|
|
124
127
|
},
|
|
125
128
|
},
|
|
@@ -187,7 +190,11 @@ const billPaySetupApproverView = createSlice({
|
|
|
187
190
|
// reconciles any drift.
|
|
188
191
|
draft.approvalRuleIds = approvalRuleIds;
|
|
189
192
|
},
|
|
190
|
-
|
|
193
|
+
// Approval Rules 3.0 — `useV3` required so a missing wire
|
|
194
|
+
// surfaces at compile time. The reorder epic always hits the
|
|
195
|
+
// v2 endpoint (v1 has no reorder route), but the payload still
|
|
196
|
+
// carries the flag for the failure-path refetch which needs it.
|
|
197
|
+
prepare(approvalRuleIds, useV3) {
|
|
191
198
|
return { payload: { approvalRuleIds, useV3 } };
|
|
192
199
|
},
|
|
193
200
|
},
|
package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.js
CHANGED
|
@@ -91,15 +91,20 @@ export const toApprovalChangableInfoPayload = (approverViewUpdateData) => {
|
|
|
91
91
|
return payload;
|
|
92
92
|
};
|
|
93
93
|
/**
|
|
94
|
-
* V1 wire mapper — used when
|
|
95
|
-
* for the current tenant.
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
94
|
+
* V1 wire mapper — used when 'approval_rule_v3_config' resolves to OFF
|
|
95
|
+
* for the current tenant. Emits the legacy snake_case array shape that
|
|
96
|
+
* '/approval-rules' historically consumed (see the V1 fixture in
|
|
97
|
+
* 'entity/entityApprovalStatus/__mocks__/json/entityApprovalStatusPayload.json'):
|
|
98
|
+
* criteria: [{type: 'range', range_entity: 'currency', min, max,
|
|
99
|
+
* currency_code, currency_symbol}]
|
|
99
100
|
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
101
|
+
* Open-ended semantics are preserved on the wire: an absent 'min' or
|
|
102
|
+
* 'max' is sent as 'null' rather than synthesised to '0' or
|
|
103
|
+
* 'MAX_SAFE_INTEGER', so a 'greater_than' / 'less_than' rule stays
|
|
104
|
+
* one-sided after rollback rather than collapsing into a closed range.
|
|
105
|
+
*
|
|
106
|
+
* The V1 backend does not understand vendor / department criteria or
|
|
107
|
+
* the rule-level 3.0 fields, so those are dropped on the wire.
|
|
103
108
|
*/
|
|
104
109
|
export const toApprovalChangableInfoPayloadV1 = (approverViewUpdateData) => {
|
|
105
110
|
const amount = approverViewUpdateData.criteria?.amount;
|
|
@@ -125,25 +130,38 @@ export const toApprovalChangableInfoPayloadV1 = (approverViewUpdateData) => {
|
|
|
125
130
|
};
|
|
126
131
|
});
|
|
127
132
|
const isUpdate = approverViewUpdateData.approvalRuleId != null;
|
|
133
|
+
const minValue = minAmount?.amount ?? null;
|
|
134
|
+
const maxValue = maxAmount?.amount ?? null;
|
|
135
|
+
// Approval Rules 3.0 — guard against the both-null case. The form
|
|
136
|
+
// is expected to always set at least one bound, but if drift ever
|
|
137
|
+
// hands us a rule with no min and no max we'd otherwise emit
|
|
138
|
+
// '[{type: range, min: null, max: null, ...}]' — a payload that
|
|
139
|
+
// (a) the read-side 'legacyAmountRangeToCriteria' decodes back to
|
|
140
|
+
// '[]' (asymmetric round-trip), and (b) the V1 backend will
|
|
141
|
+
// reject anyway. Emit 'criteria: []' instead so the save fails
|
|
142
|
+
// cleanly on the server side and we leave a breadcrumb in the
|
|
143
|
+
// console for diagnosis rather than persisting mis-shaped data.
|
|
144
|
+
const criteria = [];
|
|
145
|
+
if (minValue == null && maxValue == null) {
|
|
146
|
+
console.warn('[approvalRules][V1] toApprovalChangableInfoPayloadV1: rule has ' +
|
|
147
|
+
'no amount bounds; emitting empty criteria array. The V1 backend ' +
|
|
148
|
+
'will reject this save — caller should ensure at least one bound ' +
|
|
149
|
+
'is set on the form.');
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
criteria.push({
|
|
153
|
+
type: 'range',
|
|
154
|
+
range_entity: 'currency',
|
|
155
|
+
min: minValue,
|
|
156
|
+
max: maxValue,
|
|
157
|
+
currency_code: currencyCode,
|
|
158
|
+
currency_symbol: currencySymbol,
|
|
159
|
+
});
|
|
160
|
+
}
|
|
128
161
|
const payload = {
|
|
129
162
|
steps,
|
|
130
163
|
is_applicable_on_pending_approval_entity: approverViewUpdateData.isApplicableOnPendingApprovalEntity ?? true,
|
|
131
|
-
criteria
|
|
132
|
-
rangeType: 'range',
|
|
133
|
-
rangeEntity: 'currency',
|
|
134
|
-
range: {
|
|
135
|
-
min: {
|
|
136
|
-
amount: minAmount?.amount ?? 0,
|
|
137
|
-
currencyCode,
|
|
138
|
-
currencySymbol,
|
|
139
|
-
},
|
|
140
|
-
max: {
|
|
141
|
-
amount: maxAmount?.amount ?? Number.MAX_SAFE_INTEGER,
|
|
142
|
-
currencyCode,
|
|
143
|
-
currencySymbol,
|
|
144
|
-
},
|
|
145
|
-
},
|
|
146
|
-
},
|
|
164
|
+
criteria,
|
|
147
165
|
};
|
|
148
166
|
if (isUpdate) {
|
|
149
167
|
payload.approval_rule_id = approverViewUpdateData.approvalRuleId;
|
package/lib/esm/view/spendManagement/billPay/editBillView/epics/fetchEditBillDetailPageEpic.js
CHANGED
|
@@ -38,7 +38,10 @@ export const fetchEditBillDetailPageEpic = (actions$, state$) => actions$.pipe(f
|
|
|
38
38
|
else {
|
|
39
39
|
billDetailActions.push(updateShowAutofill(true));
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
// Side-fetch from the edit-bill page bootstrap. The triggering
|
|
42
|
+
// action doesn't carry the V3 flag, so we explicitly target v1
|
|
43
|
+
// here; tenants on v3 re-fetch through their own screen connector.
|
|
44
|
+
billDetailActions.push(fetchBillPaySetupApproverView(true, true, false));
|
|
42
45
|
}
|
|
43
46
|
else {
|
|
44
47
|
if (state.ownerListState.fetchState !== 'In-Progress' &&
|
|
@@ -81,7 +84,10 @@ export const fetchEditBillDetailPageEpic = (actions$, state$) => actions$.pipe(f
|
|
|
81
84
|
// While opening New Bill Refresh Approval Rules and Payment Accounts
|
|
82
85
|
if (approvalViewFetchState !== 'In-Progress' &&
|
|
83
86
|
approvalViewFetchState !== 'Completed') {
|
|
84
|
-
|
|
87
|
+
// Side-fetch from the edit-bill page bootstrap. The triggering
|
|
88
|
+
// action doesn't carry the V3 flag, so we explicitly target v1
|
|
89
|
+
// here; tenants on v3 re-fetch through their own screen connector.
|
|
90
|
+
billDetailActions.push(fetchBillPaySetupApproverView(true, true, false));
|
|
85
91
|
}
|
|
86
92
|
}
|
|
87
93
|
return concat(from(billDetailActions));
|
package/lib/esm/view/spendManagement/reimbursement/editRemiView/epics/fetchEditRemiDetailPageEpic.js
CHANGED
|
@@ -63,7 +63,11 @@ export const fetchEditRemiDetailPageEpic = (actions$, state$) => actions$.pipe(f
|
|
|
63
63
|
const approvalRules = state.remiSetupApproverViewState;
|
|
64
64
|
if (approvalRules.fetchState !== 'Completed' &&
|
|
65
65
|
approvalRules.fetchState !== 'In-Progress') {
|
|
66
|
-
|
|
66
|
+
// Side-fetch from the edit-reim page bootstrap. The
|
|
67
|
+
// triggering action doesn't carry the V3 flag, so we
|
|
68
|
+
// explicitly target v1; v3 tenants re-fetch via their
|
|
69
|
+
// own screen connector.
|
|
70
|
+
remiDetailActions.push(fetchRemiSetupApproverView(true, false, false, false));
|
|
67
71
|
}
|
|
68
72
|
}
|
|
69
73
|
}
|
|
@@ -33,7 +33,13 @@ export const reorderRemiApprovalRulesEpic = (actions$, _state$, zeniAPI) => acti
|
|
|
33
33
|
messageText: 'failed',
|
|
34
34
|
type: 'error',
|
|
35
35
|
}),
|
|
36
|
-
|
|
36
|
+
// Failure-recovery refetch — match the screen connector
|
|
37
|
+
// convention '(cacheOverride, resolveAttributeToUser,
|
|
38
|
+
// includeImplicitActors, useV3)' rather than copying BillPay's
|
|
39
|
+
// 3-arg shape. With the previous useV3-as-default-false the
|
|
40
|
+
// V3 flag was being smuggled in as 'includeImplicitActors',
|
|
41
|
+
// which silently broke V3 recovery refetches.
|
|
42
|
+
fetchRemiSetupApproverView(true, false, false, useV3),
|
|
37
43
|
]);
|
|
38
44
|
}
|
|
39
45
|
}), catchError((error) => from([
|
|
@@ -44,6 +50,12 @@ export const reorderRemiApprovalRulesEpic = (actions$, _state$, zeniAPI) => acti
|
|
|
44
50
|
messageText: 'failed',
|
|
45
51
|
type: 'error',
|
|
46
52
|
}),
|
|
47
|
-
|
|
53
|
+
// Failure-recovery refetch — match the screen connector
|
|
54
|
+
// convention '(cacheOverride, resolveAttributeToUser,
|
|
55
|
+
// includeImplicitActors, useV3)' rather than copying BillPay's
|
|
56
|
+
// 3-arg shape. With the previous useV3-as-default-false the
|
|
57
|
+
// V3 flag was being smuggled in as 'includeImplicitActors',
|
|
58
|
+
// which silently broke V3 recovery refetches.
|
|
59
|
+
fetchRemiSetupApproverView(true, false, false, useV3),
|
|
48
60
|
])));
|
|
49
61
|
}));
|
|
@@ -28,9 +28,10 @@ const remiSetupApproverView = createSlice({
|
|
|
28
28
|
draft.error = undefined;
|
|
29
29
|
},
|
|
30
30
|
// Approval Rules 3.0 — `useV3` arrives from the screen connector
|
|
31
|
-
// (
|
|
32
|
-
// endpoint in the fetch epic.
|
|
33
|
-
|
|
31
|
+
// ('approval_rule_v3_config' dynamic config) and picks v1 vs v2
|
|
32
|
+
// endpoint in the fetch epic. Required (no default) so a missing
|
|
33
|
+
// connector wire surfaces at compile time.
|
|
34
|
+
prepare(cacheOverride = false, resolveAttributeToUser = false, includeImplicitActors = false, useV3) {
|
|
34
35
|
return {
|
|
35
36
|
payload: {
|
|
36
37
|
cacheOverride,
|
|
@@ -140,9 +141,10 @@ const remiSetupApproverView = createSlice({
|
|
|
140
141
|
};
|
|
141
142
|
},
|
|
142
143
|
// Approval Rules 3.0 — `useV3` flows from the screen connector
|
|
143
|
-
// (
|
|
144
|
-
// can pick the v1 vs v2 endpoint.
|
|
145
|
-
|
|
144
|
+
// ('approval_rule_v3_config' dynamic config) so the delete epic
|
|
145
|
+
// can pick the v1 vs v2 endpoint. Required (no default) so a
|
|
146
|
+
// missing connector wire surfaces at compile time.
|
|
147
|
+
prepare(approvalRuleId, useV3) {
|
|
146
148
|
return { payload: { approvalRuleId, useV3 } };
|
|
147
149
|
},
|
|
148
150
|
},
|
|
@@ -193,7 +195,9 @@ const remiSetupApproverView = createSlice({
|
|
|
193
195
|
}
|
|
194
196
|
draft.approvalRuleIds = approvalRuleIds;
|
|
195
197
|
},
|
|
196
|
-
|
|
198
|
+
// Approval Rules 3.0 — `useV3` required so a missing wire
|
|
199
|
+
// surfaces at compile time. Mirror of BillPay's reorder.prepare.
|
|
200
|
+
prepare(approvalRuleIds, useV3) {
|
|
197
201
|
return { payload: { approvalRuleIds, useV3 } };
|
|
198
202
|
},
|
|
199
203
|
},
|
|
@@ -2,10 +2,10 @@ import { ZeniAPIStatus } from '../../../../responsePayload';
|
|
|
2
2
|
import { BillPaySetupApproverViewState } from './billPaySetupApproverViewState';
|
|
3
3
|
import { ApprovalRuleCreateData, ApprovalRuleUpdateData } from './types/commonState';
|
|
4
4
|
export declare const initialState: BillPaySetupApproverViewState;
|
|
5
|
-
export declare const fetchBillPaySetupApproverView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride
|
|
5
|
+
export declare const fetchBillPaySetupApproverView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride: any, includeUserRoles: any, useV3: boolean], {
|
|
6
6
|
cacheOverride: any;
|
|
7
7
|
includeUserRoles: any;
|
|
8
|
-
useV3:
|
|
8
|
+
useV3: boolean;
|
|
9
9
|
}, "billPaySetupApproverView/fetchBillPaySetupApproverView", never, never>, fetchBillPaySetupApproverViewSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[approvalRuleIds: string[]], {
|
|
10
10
|
approvalRuleIds: string[];
|
|
11
11
|
}, "billPaySetupApproverView/fetchBillPaySetupApproverViewSuccess", never, never>, fetchBillPaySetupApproverViewFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[status: ZeniAPIStatus<Record<string, unknown>>], ZeniAPIStatus<Record<string, unknown>>, "billPaySetupApproverView/fetchBillPaySetupApproverViewFailure", never, never>, fetchBillPayApproversDetails: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride?: any, includeUserRoles?: any], {
|
|
@@ -19,18 +19,18 @@ export declare const fetchBillPaySetupApproverView: import("@reduxjs/toolkit").A
|
|
|
19
19
|
attributes: ("manager" | "vendor_owner" | "manager_of_manager")[];
|
|
20
20
|
}, "billPaySetupApproverView/fetchBillPayApproversListSuccess", never, never>, fetchBillPayApproversListFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[status: ZeniAPIStatus<Record<string, unknown>>], {
|
|
21
21
|
status: ZeniAPIStatus<Record<string, unknown>>;
|
|
22
|
-
}, "billPaySetupApproverView/fetchBillPayApproversListFailure", never, never>, deleteBillPayApprovalRule: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[approvalRuleId: string, useV3
|
|
22
|
+
}, "billPaySetupApproverView/fetchBillPayApproversListFailure", never, never>, deleteBillPayApprovalRule: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[approvalRuleId: string, useV3: boolean], {
|
|
23
23
|
approvalRuleId: string;
|
|
24
|
-
useV3:
|
|
24
|
+
useV3: boolean;
|
|
25
25
|
}, "billPaySetupApproverView/deleteBillPayApprovalRule", never, never>, deleteBillPayApprovalRuleSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[deletedApprovalRuleId: string, approvalRuleIds: string[]], {
|
|
26
26
|
deletedApprovalRuleId: string;
|
|
27
27
|
approvalRuleIds: string[];
|
|
28
28
|
}, "billPaySetupApproverView/deleteBillPayApprovalRuleSuccess", never, never>, deleteBillPayApprovalRuleFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[approvalRuleId: string, status: ZeniAPIStatus<Record<string, unknown>>], {
|
|
29
29
|
approvalRuleId: string;
|
|
30
30
|
status: ZeniAPIStatus<Record<string, unknown>>;
|
|
31
|
-
}, "billPaySetupApproverView/deleteBillPayApprovalRuleFailure", never, never>, reorderBillPayApprovalRules: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[approvalRuleIds: string[], useV3
|
|
31
|
+
}, "billPaySetupApproverView/deleteBillPayApprovalRuleFailure", never, never>, reorderBillPayApprovalRules: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[approvalRuleIds: string[], useV3: boolean], {
|
|
32
32
|
approvalRuleIds: string[];
|
|
33
|
-
useV3:
|
|
33
|
+
useV3: boolean;
|
|
34
34
|
}, "billPaySetupApproverView/reorderBillPayApprovalRules", never, never>, reorderBillPayApprovalRulesSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[approvalRuleIds: string[]], {
|
|
35
35
|
approvalRuleIds: string[];
|
|
36
36
|
}, "billPaySetupApproverView/reorderBillPayApprovalRulesSuccess", never, never>, reorderBillPayApprovalRulesFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[status: ZeniAPIStatus<Record<string, unknown>>], {
|
package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewReducer.js
CHANGED
|
@@ -32,9 +32,11 @@ const billPaySetupApproverView = (0, toolkit_1.createSlice)({
|
|
|
32
32
|
draft.error = undefined;
|
|
33
33
|
},
|
|
34
34
|
// Approval Rules 3.0 — `useV3` arrives from the screen connector
|
|
35
|
-
// (
|
|
36
|
-
// v2 endpoint in the fetch epic.
|
|
37
|
-
|
|
35
|
+
// ('approval_rule_v3_config' dynamic config) and picks the v1
|
|
36
|
+
// vs v2 endpoint in the fetch epic. Required (no default) so a
|
|
37
|
+
// missing screen-connector wire surfaces at compile time rather
|
|
38
|
+
// than silently falling back to v1 on a v3 tenant.
|
|
39
|
+
prepare(cacheOverride = false, includeUserRoles = true, useV3) {
|
|
38
40
|
return { payload: { cacheOverride, includeUserRoles, useV3 } };
|
|
39
41
|
},
|
|
40
42
|
},
|
|
@@ -121,9 +123,10 @@ const billPaySetupApproverView = (0, toolkit_1.createSlice)({
|
|
|
121
123
|
};
|
|
122
124
|
},
|
|
123
125
|
// Approval Rules 3.0 — `useV3` flows from the screen connector
|
|
124
|
-
// (
|
|
125
|
-
// can pick the v1 vs v2 endpoint.
|
|
126
|
-
|
|
126
|
+
// ('approval_rule_v3_config' dynamic config) so the delete epic
|
|
127
|
+
// can pick the v1 vs v2 endpoint. Required (no default) so a
|
|
128
|
+
// missing connector wire surfaces at compile time.
|
|
129
|
+
prepare(approvalRuleId, useV3) {
|
|
127
130
|
return { payload: { approvalRuleId, useV3 } };
|
|
128
131
|
},
|
|
129
132
|
},
|
|
@@ -191,7 +194,11 @@ const billPaySetupApproverView = (0, toolkit_1.createSlice)({
|
|
|
191
194
|
// reconciles any drift.
|
|
192
195
|
draft.approvalRuleIds = approvalRuleIds;
|
|
193
196
|
},
|
|
194
|
-
|
|
197
|
+
// Approval Rules 3.0 — `useV3` required so a missing wire
|
|
198
|
+
// surfaces at compile time. The reorder epic always hits the
|
|
199
|
+
// v2 endpoint (v1 has no reorder route), but the payload still
|
|
200
|
+
// carries the flag for the failure-path refetch which needs it.
|
|
201
|
+
prepare(approvalRuleIds, useV3) {
|
|
195
202
|
return { payload: { approvalRuleIds, useV3 } };
|
|
196
203
|
},
|
|
197
204
|
},
|
|
@@ -30,42 +30,51 @@ interface ApprovalUpdatableInfoPayload {
|
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* V1 / pre-3.0 wire shape. Kept so the rollback flag (gated by
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
33
|
+
* 'approval_rule_v3_config' dynamic config) can target the original
|
|
34
|
+
* '/approval-rules' endpoint with the legacy snake_case array of
|
|
35
|
+
* range entries. None of the 3.0 rule-level fields are sent.
|
|
36
|
+
*
|
|
37
|
+
* Reference: 'entityApprovalStatusPayload.json' fixture, which carries
|
|
38
|
+
* a real V1 approval rule from the legacy backend:
|
|
39
|
+
* criteria: [{type: 'range', range_entity: 'currency',
|
|
40
|
+
* min, max, currency_code, currency_symbol}]
|
|
41
|
+
* with 'min' / 'max' as scalar numbers and 'null' representing an
|
|
42
|
+
* absent bound for one-sided rules. The read-side mapper in
|
|
43
|
+
* 'approvalRulePayload.ts' (see 'LegacyAmountRangeCriterionPayload')
|
|
44
|
+
* decodes the same shape — write-side has to match.
|
|
36
45
|
*/
|
|
46
|
+
interface ApprovalUpdatableInfoPayloadV1CriterionEntry {
|
|
47
|
+
currency_code: string;
|
|
48
|
+
currency_symbol: string;
|
|
49
|
+
/** Upper bound. 'null' for a 'greater_than' (open-upper) rule. */
|
|
50
|
+
max: number | null;
|
|
51
|
+
/** Lower bound. 'null' for a 'less_than' (open-lower) rule. */
|
|
52
|
+
min: number | null;
|
|
53
|
+
range_entity: 'currency';
|
|
54
|
+
type: 'range';
|
|
55
|
+
}
|
|
37
56
|
interface ApprovalUpdatableInfoPayloadV1 {
|
|
38
|
-
criteria:
|
|
39
|
-
range: {
|
|
40
|
-
max: {
|
|
41
|
-
amount: number;
|
|
42
|
-
currencyCode: string;
|
|
43
|
-
currencySymbol: string;
|
|
44
|
-
};
|
|
45
|
-
min: {
|
|
46
|
-
amount: number;
|
|
47
|
-
currencyCode: string;
|
|
48
|
-
currencySymbol: string;
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
rangeEntity: 'currency';
|
|
52
|
-
rangeType: 'range';
|
|
53
|
-
};
|
|
57
|
+
criteria: ApprovalUpdatableInfoPayloadV1CriterionEntry[];
|
|
54
58
|
is_applicable_on_pending_approval_entity: boolean;
|
|
55
59
|
steps: ApproverViewStepPayload[];
|
|
56
60
|
approval_rule_id?: ID;
|
|
57
61
|
}
|
|
58
62
|
export declare const toApprovalChangableInfoPayload: (approverViewUpdateData: ApprovalRuleUpdateData | ApprovalRuleCreateData) => Partial<ApprovalUpdatableInfoPayload>;
|
|
59
63
|
/**
|
|
60
|
-
* V1 wire mapper — used when
|
|
61
|
-
* for the current tenant.
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
64
|
+
* V1 wire mapper — used when 'approval_rule_v3_config' resolves to OFF
|
|
65
|
+
* for the current tenant. Emits the legacy snake_case array shape that
|
|
66
|
+
* '/approval-rules' historically consumed (see the V1 fixture in
|
|
67
|
+
* 'entity/entityApprovalStatus/__mocks__/json/entityApprovalStatusPayload.json'):
|
|
68
|
+
* criteria: [{type: 'range', range_entity: 'currency', min, max,
|
|
69
|
+
* currency_code, currency_symbol}]
|
|
70
|
+
*
|
|
71
|
+
* Open-ended semantics are preserved on the wire: an absent 'min' or
|
|
72
|
+
* 'max' is sent as 'null' rather than synthesised to '0' or
|
|
73
|
+
* 'MAX_SAFE_INTEGER', so a 'greater_than' / 'less_than' rule stays
|
|
74
|
+
* one-sided after rollback rather than collapsing into a closed range.
|
|
65
75
|
*
|
|
66
|
-
* The
|
|
67
|
-
*
|
|
68
|
-
* falls back to `0` / `Number.MAX_SAFE_INTEGER`.
|
|
76
|
+
* The V1 backend does not understand vendor / department criteria or
|
|
77
|
+
* the rule-level 3.0 fields, so those are dropped on the wire.
|
|
69
78
|
*/
|
|
70
79
|
export declare const toApprovalChangableInfoPayloadV1: (approverViewUpdateData: ApprovalRuleUpdateData | ApprovalRuleCreateData) => Partial<ApprovalUpdatableInfoPayloadV1>;
|
|
71
80
|
export {};
|
|
@@ -95,15 +95,20 @@ const toApprovalChangableInfoPayload = (approverViewUpdateData) => {
|
|
|
95
95
|
};
|
|
96
96
|
exports.toApprovalChangableInfoPayload = toApprovalChangableInfoPayload;
|
|
97
97
|
/**
|
|
98
|
-
* V1 wire mapper — used when
|
|
99
|
-
* for the current tenant.
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
98
|
+
* V1 wire mapper — used when 'approval_rule_v3_config' resolves to OFF
|
|
99
|
+
* for the current tenant. Emits the legacy snake_case array shape that
|
|
100
|
+
* '/approval-rules' historically consumed (see the V1 fixture in
|
|
101
|
+
* 'entity/entityApprovalStatus/__mocks__/json/entityApprovalStatusPayload.json'):
|
|
102
|
+
* criteria: [{type: 'range', range_entity: 'currency', min, max,
|
|
103
|
+
* currency_code, currency_symbol}]
|
|
103
104
|
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
105
|
+
* Open-ended semantics are preserved on the wire: an absent 'min' or
|
|
106
|
+
* 'max' is sent as 'null' rather than synthesised to '0' or
|
|
107
|
+
* 'MAX_SAFE_INTEGER', so a 'greater_than' / 'less_than' rule stays
|
|
108
|
+
* one-sided after rollback rather than collapsing into a closed range.
|
|
109
|
+
*
|
|
110
|
+
* The V1 backend does not understand vendor / department criteria or
|
|
111
|
+
* the rule-level 3.0 fields, so those are dropped on the wire.
|
|
107
112
|
*/
|
|
108
113
|
const toApprovalChangableInfoPayloadV1 = (approverViewUpdateData) => {
|
|
109
114
|
const amount = approverViewUpdateData.criteria?.amount;
|
|
@@ -129,25 +134,38 @@ const toApprovalChangableInfoPayloadV1 = (approverViewUpdateData) => {
|
|
|
129
134
|
};
|
|
130
135
|
});
|
|
131
136
|
const isUpdate = approverViewUpdateData.approvalRuleId != null;
|
|
137
|
+
const minValue = minAmount?.amount ?? null;
|
|
138
|
+
const maxValue = maxAmount?.amount ?? null;
|
|
139
|
+
// Approval Rules 3.0 — guard against the both-null case. The form
|
|
140
|
+
// is expected to always set at least one bound, but if drift ever
|
|
141
|
+
// hands us a rule with no min and no max we'd otherwise emit
|
|
142
|
+
// '[{type: range, min: null, max: null, ...}]' — a payload that
|
|
143
|
+
// (a) the read-side 'legacyAmountRangeToCriteria' decodes back to
|
|
144
|
+
// '[]' (asymmetric round-trip), and (b) the V1 backend will
|
|
145
|
+
// reject anyway. Emit 'criteria: []' instead so the save fails
|
|
146
|
+
// cleanly on the server side and we leave a breadcrumb in the
|
|
147
|
+
// console for diagnosis rather than persisting mis-shaped data.
|
|
148
|
+
const criteria = [];
|
|
149
|
+
if (minValue == null && maxValue == null) {
|
|
150
|
+
console.warn('[approvalRules][V1] toApprovalChangableInfoPayloadV1: rule has ' +
|
|
151
|
+
'no amount bounds; emitting empty criteria array. The V1 backend ' +
|
|
152
|
+
'will reject this save — caller should ensure at least one bound ' +
|
|
153
|
+
'is set on the form.');
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
criteria.push({
|
|
157
|
+
type: 'range',
|
|
158
|
+
range_entity: 'currency',
|
|
159
|
+
min: minValue,
|
|
160
|
+
max: maxValue,
|
|
161
|
+
currency_code: currencyCode,
|
|
162
|
+
currency_symbol: currencySymbol,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
132
165
|
const payload = {
|
|
133
166
|
steps,
|
|
134
167
|
is_applicable_on_pending_approval_entity: approverViewUpdateData.isApplicableOnPendingApprovalEntity ?? true,
|
|
135
|
-
criteria
|
|
136
|
-
rangeType: 'range',
|
|
137
|
-
rangeEntity: 'currency',
|
|
138
|
-
range: {
|
|
139
|
-
min: {
|
|
140
|
-
amount: minAmount?.amount ?? 0,
|
|
141
|
-
currencyCode,
|
|
142
|
-
currencySymbol,
|
|
143
|
-
},
|
|
144
|
-
max: {
|
|
145
|
-
amount: maxAmount?.amount ?? Number.MAX_SAFE_INTEGER,
|
|
146
|
-
currencyCode,
|
|
147
|
-
currencySymbol,
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
},
|
|
168
|
+
criteria,
|
|
151
169
|
};
|
|
152
170
|
if (isUpdate) {
|
|
153
171
|
payload.approval_rule_id = approverViewUpdateData.approvalRuleId;
|
|
@@ -41,7 +41,10 @@ const fetchEditBillDetailPageEpic = (actions$, state$) => actions$.pipe((0, oper
|
|
|
41
41
|
else {
|
|
42
42
|
billDetailActions.push((0, editBillViewReducer_1.updateShowAutofill)(true));
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
// Side-fetch from the edit-bill page bootstrap. The triggering
|
|
45
|
+
// action doesn't carry the V3 flag, so we explicitly target v1
|
|
46
|
+
// here; tenants on v3 re-fetch through their own screen connector.
|
|
47
|
+
billDetailActions.push((0, billPaySetupApproverViewReducer_1.fetchBillPaySetupApproverView)(true, true, false));
|
|
45
48
|
}
|
|
46
49
|
else {
|
|
47
50
|
if (state.ownerListState.fetchState !== 'In-Progress' &&
|
|
@@ -84,7 +87,10 @@ const fetchEditBillDetailPageEpic = (actions$, state$) => actions$.pipe((0, oper
|
|
|
84
87
|
// While opening New Bill Refresh Approval Rules and Payment Accounts
|
|
85
88
|
if (approvalViewFetchState !== 'In-Progress' &&
|
|
86
89
|
approvalViewFetchState !== 'Completed') {
|
|
87
|
-
|
|
90
|
+
// Side-fetch from the edit-bill page bootstrap. The triggering
|
|
91
|
+
// action doesn't carry the V3 flag, so we explicitly target v1
|
|
92
|
+
// here; tenants on v3 re-fetch through their own screen connector.
|
|
93
|
+
billDetailActions.push((0, billPaySetupApproverViewReducer_1.fetchBillPaySetupApproverView)(true, true, false));
|
|
88
94
|
}
|
|
89
95
|
}
|
|
90
96
|
return (0, rxjs_1.concat)((0, rxjs_1.from)(billDetailActions));
|
package/lib/view/spendManagement/reimbursement/editRemiView/epics/fetchEditRemiDetailPageEpic.js
CHANGED
|
@@ -66,7 +66,11 @@ const fetchEditRemiDetailPageEpic = (actions$, state$) => actions$.pipe((0, oper
|
|
|
66
66
|
const approvalRules = state.remiSetupApproverViewState;
|
|
67
67
|
if (approvalRules.fetchState !== 'Completed' &&
|
|
68
68
|
approvalRules.fetchState !== 'In-Progress') {
|
|
69
|
-
|
|
69
|
+
// Side-fetch from the edit-reim page bootstrap. The
|
|
70
|
+
// triggering action doesn't carry the V3 flag, so we
|
|
71
|
+
// explicitly target v1; v3 tenants re-fetch via their
|
|
72
|
+
// own screen connector.
|
|
73
|
+
remiDetailActions.push((0, remiSetupApproverViewReducer_1.fetchRemiSetupApproverView)(true, false, false, false));
|
|
70
74
|
}
|
|
71
75
|
}
|
|
72
76
|
}
|
|
@@ -36,7 +36,13 @@ const reorderRemiApprovalRulesEpic = (actions$, _state$, zeniAPI) => actions$.pi
|
|
|
36
36
|
messageText: 'failed',
|
|
37
37
|
type: 'error',
|
|
38
38
|
}),
|
|
39
|
-
|
|
39
|
+
// Failure-recovery refetch — match the screen connector
|
|
40
|
+
// convention '(cacheOverride, resolveAttributeToUser,
|
|
41
|
+
// includeImplicitActors, useV3)' rather than copying BillPay's
|
|
42
|
+
// 3-arg shape. With the previous useV3-as-default-false the
|
|
43
|
+
// V3 flag was being smuggled in as 'includeImplicitActors',
|
|
44
|
+
// which silently broke V3 recovery refetches.
|
|
45
|
+
(0, remiSetupApproverViewReducer_1.fetchRemiSetupApproverView)(true, false, false, useV3),
|
|
40
46
|
]);
|
|
41
47
|
}
|
|
42
48
|
}), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
|
|
@@ -47,7 +53,13 @@ const reorderRemiApprovalRulesEpic = (actions$, _state$, zeniAPI) => actions$.pi
|
|
|
47
53
|
messageText: 'failed',
|
|
48
54
|
type: 'error',
|
|
49
55
|
}),
|
|
50
|
-
|
|
56
|
+
// Failure-recovery refetch — match the screen connector
|
|
57
|
+
// convention '(cacheOverride, resolveAttributeToUser,
|
|
58
|
+
// includeImplicitActors, useV3)' rather than copying BillPay's
|
|
59
|
+
// 3-arg shape. With the previous useV3-as-default-false the
|
|
60
|
+
// V3 flag was being smuggled in as 'includeImplicitActors',
|
|
61
|
+
// which silently broke V3 recovery refetches.
|
|
62
|
+
(0, remiSetupApproverViewReducer_1.fetchRemiSetupApproverView)(true, false, false, useV3),
|
|
51
63
|
])));
|
|
52
64
|
}));
|
|
53
65
|
exports.reorderRemiApprovalRulesEpic = reorderRemiApprovalRulesEpic;
|
|
@@ -2,11 +2,11 @@ import { ZeniAPIStatus } from '../../../../responsePayload';
|
|
|
2
2
|
import { ApprovalRuleCreateData, ApprovalRuleUpdateData } from '../../billPay/billPaySetupApproverView/types/commonState';
|
|
3
3
|
import { RemiSetupApproverViewState } from './remiSetupApproverViewState';
|
|
4
4
|
export declare const initialState: RemiSetupApproverViewState;
|
|
5
|
-
export declare const fetchRemiSetupApproverView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride
|
|
5
|
+
export declare const fetchRemiSetupApproverView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride: any, resolveAttributeToUser: any, includeImplicitActors: any, useV3: boolean], {
|
|
6
6
|
cacheOverride: any;
|
|
7
7
|
resolveAttributeToUser: any;
|
|
8
8
|
includeImplicitActors: any;
|
|
9
|
-
useV3:
|
|
9
|
+
useV3: boolean;
|
|
10
10
|
}, "remiSetupApproverView/fetchRemiSetupApproverView", never, never>, fetchRemiSetupApproverViewSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[approvalRuleIds: string[]], {
|
|
11
11
|
approvalRuleIds: string[];
|
|
12
12
|
}, "remiSetupApproverView/fetchRemiSetupApproverViewSuccess", never, never>, fetchRemiSetupApproverViewFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[status: ZeniAPIStatus<Record<string, unknown>>], ZeniAPIStatus<Record<string, unknown>>, "remiSetupApproverView/fetchRemiSetupApproverViewFailure", never, never>, fetchRemiApproversDetails: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride?: any, includeUserRoles?: any, includeAttributesUserIds?: any, lastUpdatedByUserId?: any], {
|
|
@@ -25,18 +25,18 @@ export declare const fetchRemiSetupApproverView: import("@reduxjs/toolkit").Acti
|
|
|
25
25
|
attributeSubTypeToUserIdMapping: Record<"manager" | "vendor_owner" | "manager_of_manager", string> | undefined;
|
|
26
26
|
}, "remiSetupApproverView/fetchRemiApproversListSuccess", never, never>, fetchRemiApproversListFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[status: ZeniAPIStatus<Record<string, unknown>>], {
|
|
27
27
|
status: ZeniAPIStatus<Record<string, unknown>>;
|
|
28
|
-
}, "remiSetupApproverView/fetchRemiApproversListFailure", never, never>, deleteRemiApprovalRule: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[approvalRuleId: string, useV3
|
|
28
|
+
}, "remiSetupApproverView/fetchRemiApproversListFailure", never, never>, deleteRemiApprovalRule: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[approvalRuleId: string, useV3: boolean], {
|
|
29
29
|
approvalRuleId: string;
|
|
30
|
-
useV3:
|
|
30
|
+
useV3: boolean;
|
|
31
31
|
}, "remiSetupApproverView/deleteRemiApprovalRule", never, never>, deleteRemiApprovalRuleSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[deletedApprovalRuleId: string, approvalRuleIds: string[]], {
|
|
32
32
|
deletedApprovalRuleId: string;
|
|
33
33
|
approvalRuleIds: string[];
|
|
34
34
|
}, "remiSetupApproverView/deleteRemiApprovalRuleSuccess", never, never>, deleteRemiApprovalRuleFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[approvalRuleId: string, status: ZeniAPIStatus<Record<string, unknown>>], {
|
|
35
35
|
approvalRuleId: string;
|
|
36
36
|
status: ZeniAPIStatus<Record<string, unknown>>;
|
|
37
|
-
}, "remiSetupApproverView/deleteRemiApprovalRuleFailure", never, never>, reorderRemiApprovalRules: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[approvalRuleIds: string[], useV3
|
|
37
|
+
}, "remiSetupApproverView/deleteRemiApprovalRuleFailure", never, never>, reorderRemiApprovalRules: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[approvalRuleIds: string[], useV3: boolean], {
|
|
38
38
|
approvalRuleIds: string[];
|
|
39
|
-
useV3:
|
|
39
|
+
useV3: boolean;
|
|
40
40
|
}, "remiSetupApproverView/reorderRemiApprovalRules", never, never>, reorderRemiApprovalRulesSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[approvalRuleIds: string[]], {
|
|
41
41
|
approvalRuleIds: string[];
|
|
42
42
|
}, "remiSetupApproverView/reorderRemiApprovalRulesSuccess", never, never>, reorderRemiApprovalRulesFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[status: ZeniAPIStatus<Record<string, unknown>>], {
|
package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewReducer.js
CHANGED
|
@@ -32,9 +32,10 @@ const remiSetupApproverView = (0, toolkit_1.createSlice)({
|
|
|
32
32
|
draft.error = undefined;
|
|
33
33
|
},
|
|
34
34
|
// Approval Rules 3.0 — `useV3` arrives from the screen connector
|
|
35
|
-
// (
|
|
36
|
-
// endpoint in the fetch epic.
|
|
37
|
-
|
|
35
|
+
// ('approval_rule_v3_config' dynamic config) and picks v1 vs v2
|
|
36
|
+
// endpoint in the fetch epic. Required (no default) so a missing
|
|
37
|
+
// connector wire surfaces at compile time.
|
|
38
|
+
prepare(cacheOverride = false, resolveAttributeToUser = false, includeImplicitActors = false, useV3) {
|
|
38
39
|
return {
|
|
39
40
|
payload: {
|
|
40
41
|
cacheOverride,
|
|
@@ -144,9 +145,10 @@ const remiSetupApproverView = (0, toolkit_1.createSlice)({
|
|
|
144
145
|
};
|
|
145
146
|
},
|
|
146
147
|
// Approval Rules 3.0 — `useV3` flows from the screen connector
|
|
147
|
-
// (
|
|
148
|
-
// can pick the v1 vs v2 endpoint.
|
|
149
|
-
|
|
148
|
+
// ('approval_rule_v3_config' dynamic config) so the delete epic
|
|
149
|
+
// can pick the v1 vs v2 endpoint. Required (no default) so a
|
|
150
|
+
// missing connector wire surfaces at compile time.
|
|
151
|
+
prepare(approvalRuleId, useV3) {
|
|
150
152
|
return { payload: { approvalRuleId, useV3 } };
|
|
151
153
|
},
|
|
152
154
|
},
|
|
@@ -197,7 +199,9 @@ const remiSetupApproverView = (0, toolkit_1.createSlice)({
|
|
|
197
199
|
}
|
|
198
200
|
draft.approvalRuleIds = approvalRuleIds;
|
|
199
201
|
},
|
|
200
|
-
|
|
202
|
+
// Approval Rules 3.0 — `useV3` required so a missing wire
|
|
203
|
+
// surfaces at compile time. Mirror of BillPay's reorder.prepare.
|
|
204
|
+
prepare(approvalRuleIds, useV3) {
|
|
201
205
|
return { payload: { approvalRuleIds, useV3 } };
|
|
202
206
|
},
|
|
203
207
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.0.90-
|
|
3
|
+
"version": "5.0.90-betaAR5",
|
|
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",
|