@zeniai/client-epic-state 5.0.85-beta0ND → 5.0.85-betaAR1
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/commonStateTypes/animations.d.ts +1 -1
- package/lib/commonStateTypes/animations.js +0 -1
- package/lib/entity/approvalRule/approvalRuleConflict.d.ts +56 -0
- package/lib/entity/approvalRule/approvalRuleConflict.js +77 -0
- package/lib/entity/approvalRule/approvalRulePayload.d.ts +34 -5
- package/lib/entity/approvalRule/approvalRulePayload.js +130 -10
- package/lib/entity/approvalRule/approvalRuleSelector.d.ts +25 -1
- package/lib/entity/approvalRule/approvalRuleSelector.js +40 -0
- package/lib/entity/approvalRule/approvalRuleState.d.ts +59 -7
- package/lib/entity/company/companyPayload.d.ts +0 -2
- package/lib/entity/company/companyPayload.js +0 -2
- package/lib/entity/company/companyStateTypes.d.ts +0 -2
- package/lib/entity/paymentAccount/paymentAccountSelector.d.ts +0 -1
- package/lib/entity/paymentAccount/paymentAccountSelector.js +0 -4
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +2 -0
- package/lib/entity/tenant/epic/deleteConnectionEpic.d.ts +1 -1
- package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.d.ts +1 -1
- package/lib/entity/tenant/epic/saveConnectorCredentialsEpic.d.ts +3 -3
- package/lib/entity/tenant/epic/saveOAuthConnectionEpic.d.ts +1 -1
- package/lib/entity/tenant/tenantPayload.d.ts +0 -1
- package/lib/entity/tenant/tenantReducer.d.ts +25 -38
- package/lib/entity/tenant/tenantReducer.js +5 -65
- package/lib/entity/tenant/tenantState.d.ts +0 -1
- package/lib/epic.d.ts +5 -7
- package/lib/epic.js +5 -8
- package/lib/esm/commonStateTypes/animations.js +0 -1
- package/lib/esm/entity/approvalRule/approvalRuleConflict.js +74 -0
- package/lib/esm/entity/approvalRule/approvalRulePayload.js +130 -10
- package/lib/esm/entity/approvalRule/approvalRuleSelector.js +35 -0
- package/lib/esm/entity/company/companyPayload.js +0 -2
- package/lib/esm/entity/paymentAccount/paymentAccountSelector.js +0 -3
- package/lib/esm/entity/snackbar/snackbarTypes.js +2 -0
- package/lib/esm/entity/tenant/tenantReducer.js +3 -63
- package/lib/esm/epic.js +5 -8
- package/lib/esm/index.js +15 -16
- package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewReducer.js +50 -168
- package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewSelector.js +0 -14
- package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewState.js +0 -13
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewReducer.js +74 -12
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/deleteBillPayApprovalRuleEpic.js +10 -2
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPaySetupApproverViewEpic.js +8 -4
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/initializeBillPaySetupApproverViewUpdateDataEpic.js +11 -7
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/reorderBillPayApprovalRulesEpic.js +54 -0
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/saveBillPaySetupApproverViewUpdatesEpic.js +13 -4
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.js +122 -16
- package/lib/esm/view/spendManagement/billPay/editBillView/editBillViewSelector.js +7 -2
- package/lib/esm/view/spendManagement/commonSetup/setupViewReducer.js +52 -71
- package/lib/esm/view/spendManagement/commonSetup/setupViewSelector.js +0 -2
- package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/deleteRemiApprovalRuleEpic.js +10 -2
- package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/fetchRemiSetupApproverViewEpic.js +8 -2
- package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/initializeRemiSetupApproverViewUpdateDataEpic.js +11 -7
- package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/reorderRemiApprovalRulesEpic.js +49 -0
- package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/saveRemiSetupApproverViewUpdatesEpic.js +13 -4
- package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewReducer.js +63 -11
- package/lib/index.d.ts +17 -19
- package/lib/index.js +45 -55
- package/lib/view/companyTaskManagerView/companyTaskManagerViewReducer.d.ts +2 -2
- package/lib/view/companyView/types/cockpitTypes.d.ts +1 -1
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/onboardingView/customerView/onboardingCustomerViewPayload.d.ts +0 -3
- package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.d.ts +4 -41
- package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.js +51 -170
- package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.d.ts +1 -7
- package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.js +1 -21
- package/lib/view/onboardingView/customerView/onboardingCustomerViewState.d.ts +0 -37
- package/lib/view/onboardingView/customerView/onboardingCustomerViewState.js +1 -14
- package/lib/view/people/peopleTypes.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewReducer.d.ts +14 -3
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewReducer.js +75 -13
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewState.d.ts +8 -0
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/deleteBillPayApprovalRuleEpic.js +10 -2
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPaySetupApproverViewEpic.js +8 -4
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/initializeBillPaySetupApproverViewUpdateDataEpic.js +10 -6
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/reorderBillPayApprovalRulesEpic.d.ts +23 -0
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/reorderBillPayApprovalRulesEpic.js +58 -0
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/saveBillPaySetupApproverViewUpdatesEpic.js +12 -3
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.d.ts +50 -1
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.js +124 -17
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonState.d.ts +31 -5
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +7 -2
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
- package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +2 -24
- package/lib/view/spendManagement/commonSetup/setupViewReducer.js +53 -72
- package/lib/view/spendManagement/commonSetup/setupViewSelector.d.ts +0 -4
- package/lib/view/spendManagement/commonSetup/setupViewSelector.js +0 -2
- package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +0 -12
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/deleteRemiApprovalRuleEpic.js +10 -2
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/fetchRemiSetupApproverViewEpic.js +8 -2
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/initializeRemiSetupApproverViewUpdateDataEpic.js +10 -6
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/reorderRemiApprovalRulesEpic.d.ts +14 -0
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/reorderRemiApprovalRulesEpic.js +53 -0
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/saveRemiSetupApproverViewUpdatesEpic.js +12 -3
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewReducer.d.ts +14 -3
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewReducer.js +64 -12
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewState.d.ts +5 -0
- package/lib/view/taskManager/taskListView/taskList.d.ts +3 -3
- package/package.json +1 -1
- package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.d.ts +0 -21
- package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.js +0 -54
- package/lib/esm/entity/tenant/epic/initEmailConnectOAuthEpic.js +0 -50
- package/lib/esm/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.js +0 -45
- package/lib/esm/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.js +0 -40
- package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +0 -49
- package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +0 -58
- package/lib/esm/view/spendManagement/commonSetup/kycKybAutofillActions.js +0 -12
- package/lib/esm/view/spendManagement/commonSetup/kycKybParseMapper.js +0 -205
- package/lib/esm/view/spendManagement/commonSetup/types/kycKybAutofill.js +0 -28
- package/lib/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.d.ts +0 -7
- package/lib/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.js +0 -49
- package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.d.ts +0 -9
- package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.js +0 -44
- package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.d.ts +0 -8
- package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +0 -53
- package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.d.ts +0 -8
- package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +0 -62
- package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.d.ts +0 -27
- package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.js +0 -15
- package/lib/view/spendManagement/commonSetup/kycKybParseMapper.d.ts +0 -24
- package/lib/view/spendManagement/commonSetup/kycKybParseMapper.js +0 -213
- package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.d.ts +0 -125
- package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.js +0 -32
package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.js
CHANGED
|
@@ -1,20 +1,48 @@
|
|
|
1
1
|
export const toApprovalChangableInfoPayload = (approverViewUpdateData) => {
|
|
2
|
-
|
|
2
|
+
// Form-side criteria is a structured object with optional slots for
|
|
3
|
+
// amount / vendor / department; flatten it into the wire format's
|
|
4
|
+
// `conditions[]` array.
|
|
5
|
+
let criteriaPayload;
|
|
3
6
|
if (approverViewUpdateData.criteria != null) {
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
const { amount, vendor, department } = approverViewUpdateData.criteria;
|
|
8
|
+
const conditions = [];
|
|
9
|
+
if (amount?.min != null) {
|
|
10
|
+
conditions.push({
|
|
11
|
+
field: 'amount',
|
|
12
|
+
type: 'gte',
|
|
13
|
+
value: amount.min.amount,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
if (amount?.max != null) {
|
|
17
|
+
conditions.push({
|
|
18
|
+
field: 'amount',
|
|
19
|
+
type: 'lte',
|
|
20
|
+
value: amount.max.amount,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
if (vendor != null && vendor.vendorIds.length > 0) {
|
|
24
|
+
conditions.push({
|
|
25
|
+
field: 'vendor_id',
|
|
26
|
+
type: vendor.operator === 'is_not' ? 'not_in' : 'in',
|
|
27
|
+
value: vendor.vendorIds,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
if (department != null && department.departmentIds.length > 0) {
|
|
31
|
+
conditions.push({
|
|
32
|
+
field: 'department_id',
|
|
33
|
+
type: department.operator === 'is_not' ? 'not_in' : 'in',
|
|
34
|
+
value: department.departmentIds,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
if (conditions.length > 0) {
|
|
38
|
+
const currency = amount?.min ?? amount?.max ?? null;
|
|
39
|
+
criteriaPayload = {
|
|
40
|
+
conditions,
|
|
41
|
+
criteria_operator: 'and',
|
|
42
|
+
currency_code: currency?.currencyCode ?? 'USD',
|
|
43
|
+
currency_symbol: currency?.currencySymbol ?? '$',
|
|
44
|
+
};
|
|
45
|
+
}
|
|
18
46
|
}
|
|
19
47
|
const steps = approverViewUpdateData.steps.map((step) => {
|
|
20
48
|
return {
|
|
@@ -35,10 +63,88 @@ export const toApprovalChangableInfoPayload = (approverViewUpdateData) => {
|
|
|
35
63
|
});
|
|
36
64
|
const isUpdate = approverViewUpdateData.approvalRuleId != null;
|
|
37
65
|
const payload = {
|
|
38
|
-
criteria: criteriaPayload,
|
|
39
66
|
steps,
|
|
40
67
|
is_applicable_on_pending_approval_entity: approverViewUpdateData.isApplicableOnPendingApprovalEntity ?? true,
|
|
41
68
|
};
|
|
69
|
+
if (criteriaPayload != null) {
|
|
70
|
+
payload.criteria = criteriaPayload;
|
|
71
|
+
}
|
|
72
|
+
// Approval Rules 3.0 — surface rule-level fields when the form set them.
|
|
73
|
+
// Send only what the user actually entered: an undefined value means
|
|
74
|
+
// "no opinion" and stays off the wire.
|
|
75
|
+
if (approverViewUpdateData.name != null) {
|
|
76
|
+
payload.name = approverViewUpdateData.name;
|
|
77
|
+
}
|
|
78
|
+
if (approverViewUpdateData.description != null) {
|
|
79
|
+
payload.description = approverViewUpdateData.description;
|
|
80
|
+
}
|
|
81
|
+
if (approverViewUpdateData.separationOfDuties != null) {
|
|
82
|
+
payload.is_separation_of_duty_enabled =
|
|
83
|
+
approverViewUpdateData.separationOfDuties;
|
|
84
|
+
}
|
|
85
|
+
if (approverViewUpdateData.isFallback != null) {
|
|
86
|
+
payload.is_fallback = approverViewUpdateData.isFallback;
|
|
87
|
+
}
|
|
88
|
+
if (isUpdate) {
|
|
89
|
+
payload.approval_rule_id = approverViewUpdateData.approvalRuleId;
|
|
90
|
+
}
|
|
91
|
+
return payload;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* V1 wire mapper — used when `approval_rule_v3_config` resolves to OFF
|
|
95
|
+
* for the current tenant. Translates the form-side amount criteria into
|
|
96
|
+
* the legacy `{rangeType, rangeEntity, range: {min, max}}` shape. The
|
|
97
|
+
* V1 backend does not understand vendor / department criteria or the
|
|
98
|
+
* rule-level 3.0 fields, so those are dropped on the wire.
|
|
99
|
+
*
|
|
100
|
+
* The form-side amount slot is always read as a `range`-style criteria
|
|
101
|
+
* here: V1 schemas only supported ranges, so an absent `min` or `max`
|
|
102
|
+
* falls back to `0` / `Number.MAX_SAFE_INTEGER`.
|
|
103
|
+
*/
|
|
104
|
+
export const toApprovalChangableInfoPayloadV1 = (approverViewUpdateData) => {
|
|
105
|
+
const amount = approverViewUpdateData.criteria?.amount;
|
|
106
|
+
const minAmount = amount?.min;
|
|
107
|
+
const maxAmount = amount?.max;
|
|
108
|
+
const currencyCode = minAmount?.currencyCode ?? maxAmount?.currencyCode ?? 'USD';
|
|
109
|
+
const currencySymbol = minAmount?.currencySymbol ?? maxAmount?.currencySymbol ?? '$';
|
|
110
|
+
const steps = approverViewUpdateData.steps.map((step) => {
|
|
111
|
+
return {
|
|
112
|
+
action: step.action,
|
|
113
|
+
operator: step.operator,
|
|
114
|
+
actors: step.actors
|
|
115
|
+
.filter((actor) => actor.subType !== 'admin')
|
|
116
|
+
.map((actor) => {
|
|
117
|
+
return {
|
|
118
|
+
type: actor.type,
|
|
119
|
+
id: actor.userId ?? null,
|
|
120
|
+
sub_type: actor.subType ?? null,
|
|
121
|
+
id_type: actor.idType ?? null,
|
|
122
|
+
is_implicit_actor: actor.isImplicitActor ?? false,
|
|
123
|
+
};
|
|
124
|
+
}),
|
|
125
|
+
};
|
|
126
|
+
});
|
|
127
|
+
const isUpdate = approverViewUpdateData.approvalRuleId != null;
|
|
128
|
+
const payload = {
|
|
129
|
+
steps,
|
|
130
|
+
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
|
+
},
|
|
147
|
+
};
|
|
42
148
|
if (isUpdate) {
|
|
43
149
|
payload.approval_rule_id = approverViewUpdateData.approvalRuleId;
|
|
44
150
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import recordGet from 'lodash/get';
|
|
2
2
|
import has from 'lodash/has';
|
|
3
|
+
import { getAmountCriteria } from '../../../../entity/approvalRule/approvalRuleSelector';
|
|
3
4
|
import { reduceFetchState } from '../../../../commonStateTypes/reduceFetchState';
|
|
4
5
|
import { getBankAccountByBankAccountId, getBankAccountsByBankAccountIds, } from '../../../../entity/bankAccount/bankAccountSelector';
|
|
5
6
|
import { getContactById, getContactsByIds, } from '../../../../entity/billPay/contact/contactSelector';
|
|
@@ -681,9 +682,13 @@ export const getDefaultWithdrawFromAccount = (state, depositAccounts, companyId,
|
|
|
681
682
|
export const checkIfCreatorIsApprover = (billAmount, approvalRules, signedInUser) => {
|
|
682
683
|
let isCreatorAlsoApprover = false;
|
|
683
684
|
const approvalRule = approvalRules.find((rule) => {
|
|
684
|
-
const
|
|
685
|
+
const amountCriteria = getAmountCriteria(rule.criteria);
|
|
686
|
+
if (amountCriteria?.min == null) {
|
|
687
|
+
return false;
|
|
688
|
+
}
|
|
689
|
+
const { min, max } = amountCriteria;
|
|
685
690
|
return (billAmount > min.amount &&
|
|
686
|
-
(max?.amount != null ? billAmount <= max
|
|
691
|
+
(max?.amount != null ? billAmount <= max.amount : true));
|
|
687
692
|
});
|
|
688
693
|
if (approvalRule != null) {
|
|
689
694
|
const requireApprovalSteps = approvalRule.steps.filter((step) => step.action === 'require_approval');
|
|
@@ -3,26 +3,60 @@ const initialFetchStatus = {
|
|
|
3
3
|
fetchState: 'Not-Started',
|
|
4
4
|
error: undefined,
|
|
5
5
|
};
|
|
6
|
-
const emptyOfficerSlot = {
|
|
7
|
-
autoFilledFields: [],
|
|
8
|
-
localData: undefined,
|
|
9
|
-
sendOtpStatus: initialFetchStatus,
|
|
10
|
-
otpverificationStatus: initialFetchStatus,
|
|
11
|
-
};
|
|
12
6
|
export const initialState = {
|
|
13
7
|
updateStatus: { fetchState: 'Not-Started', error: undefined },
|
|
14
|
-
companyDetails: {
|
|
8
|
+
companyDetails: {},
|
|
15
9
|
companyOfficerUpdateStatus: {
|
|
16
|
-
Officer_1: {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
10
|
+
Officer_1: {
|
|
11
|
+
localData: undefined,
|
|
12
|
+
sendOtpStatus: initialFetchStatus,
|
|
13
|
+
otpverificationStatus: initialFetchStatus,
|
|
14
|
+
},
|
|
15
|
+
Officer_2: {
|
|
16
|
+
localData: undefined,
|
|
17
|
+
sendOtpStatus: initialFetchStatus,
|
|
18
|
+
otpverificationStatus: initialFetchStatus,
|
|
19
|
+
},
|
|
20
|
+
Officer_3: {
|
|
21
|
+
localData: undefined,
|
|
22
|
+
sendOtpStatus: initialFetchStatus,
|
|
23
|
+
otpverificationStatus: initialFetchStatus,
|
|
24
|
+
},
|
|
25
|
+
Officer_4: {
|
|
26
|
+
localData: undefined,
|
|
27
|
+
sendOtpStatus: initialFetchStatus,
|
|
28
|
+
otpverificationStatus: initialFetchStatus,
|
|
29
|
+
},
|
|
30
|
+
Officer_5: {
|
|
31
|
+
localData: undefined,
|
|
32
|
+
sendOtpStatus: initialFetchStatus,
|
|
33
|
+
otpverificationStatus: initialFetchStatus,
|
|
34
|
+
},
|
|
35
|
+
Officer_6: {
|
|
36
|
+
localData: undefined,
|
|
37
|
+
sendOtpStatus: initialFetchStatus,
|
|
38
|
+
otpverificationStatus: initialFetchStatus,
|
|
39
|
+
},
|
|
40
|
+
Officer_7: {
|
|
41
|
+
localData: undefined,
|
|
42
|
+
sendOtpStatus: initialFetchStatus,
|
|
43
|
+
otpverificationStatus: initialFetchStatus,
|
|
44
|
+
},
|
|
45
|
+
Officer_8: {
|
|
46
|
+
localData: undefined,
|
|
47
|
+
sendOtpStatus: initialFetchStatus,
|
|
48
|
+
otpverificationStatus: initialFetchStatus,
|
|
49
|
+
},
|
|
50
|
+
Officer_9: {
|
|
51
|
+
localData: undefined,
|
|
52
|
+
sendOtpStatus: initialFetchStatus,
|
|
53
|
+
otpverificationStatus: initialFetchStatus,
|
|
54
|
+
},
|
|
55
|
+
Officer_10: {
|
|
56
|
+
localData: undefined,
|
|
57
|
+
sendOtpStatus: initialFetchStatus,
|
|
58
|
+
otpverificationStatus: initialFetchStatus,
|
|
59
|
+
},
|
|
26
60
|
},
|
|
27
61
|
primaryContactDetails: {},
|
|
28
62
|
};
|
|
@@ -263,60 +297,7 @@ const setupView = createSlice({
|
|
|
263
297
|
clearSetupView(draft) {
|
|
264
298
|
Object.assign(draft, initialState);
|
|
265
299
|
},
|
|
266
|
-
/**
|
|
267
|
-
* Merge AI-parsed officer fields into the selected officer's localData and
|
|
268
|
-
* track which field names were autofilled so the form can show the ✦ badge.
|
|
269
|
-
*/
|
|
270
|
-
applyKycDocumentAutofillForSetup: {
|
|
271
|
-
reducer(draft, action) {
|
|
272
|
-
const { officerType, values, autoFilledFieldNames } = action.payload;
|
|
273
|
-
const slot = draft.companyOfficerUpdateStatus[officerType];
|
|
274
|
-
slot.localData = Object.assign({}, slot.localData, values);
|
|
275
|
-
slot.autoFilledFields = Array.from(new Set([...slot.autoFilledFields, ...autoFilledFieldNames]));
|
|
276
|
-
},
|
|
277
|
-
prepare(payload) {
|
|
278
|
-
return { payload };
|
|
279
|
-
},
|
|
280
|
-
},
|
|
281
|
-
/**
|
|
282
|
-
* Merge AI-parsed company fields into companyDetails.localData and track
|
|
283
|
-
* which field names were autofilled.
|
|
284
|
-
*/
|
|
285
|
-
applyKybDocumentAutofillForSetup: {
|
|
286
|
-
reducer(draft, action) {
|
|
287
|
-
const { values, autoFilledFieldNames } = action.payload;
|
|
288
|
-
draft.companyDetails.localData = Object.assign({}, draft.companyDetails.localData, values);
|
|
289
|
-
draft.companyDetails.autoFilledFields = Array.from(new Set([
|
|
290
|
-
...draft.companyDetails.autoFilledFields,
|
|
291
|
-
...autoFilledFieldNames,
|
|
292
|
-
]));
|
|
293
|
-
},
|
|
294
|
-
prepare(payload) {
|
|
295
|
-
return { payload };
|
|
296
|
-
},
|
|
297
|
-
},
|
|
298
|
-
/**
|
|
299
|
-
* Wipe AI-autofill badges. If `officerType` is provided, clears only that
|
|
300
|
-
* officer; otherwise clears company details too.
|
|
301
|
-
*/
|
|
302
|
-
clearKycKybAutofillForSetup: {
|
|
303
|
-
reducer(draft, action) {
|
|
304
|
-
const { officerType } = action.payload;
|
|
305
|
-
if (officerType != null) {
|
|
306
|
-
draft.companyOfficerUpdateStatus[officerType].autoFilledFields = [];
|
|
307
|
-
}
|
|
308
|
-
else {
|
|
309
|
-
draft.companyDetails.autoFilledFields = [];
|
|
310
|
-
Object.keys(draft.companyOfficerUpdateStatus).forEach((key) => {
|
|
311
|
-
draft.companyOfficerUpdateStatus[key].autoFilledFields = [];
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
},
|
|
315
|
-
prepare(payload = {}) {
|
|
316
|
-
return { payload };
|
|
317
|
-
},
|
|
318
|
-
},
|
|
319
300
|
},
|
|
320
301
|
});
|
|
321
|
-
export const { enableSetup, enableSetupSuccess, enableSetupFailure, updateBusinessVerificationDetails, updateBusinessVerificationDetailsSuccess, updateBusinessVerificationDetailsFailure, updateSelectedCompanyOfficer, updateSetupViewLocalStoreData, saveSetupViewDataInLocalStore, saveCompnayOfficerPhoneInLocalStore, saveCompnayOfficerAdditionalDocumentsInLocalStore, saveTreasuryAdditionalDocumentsInLocalStore, sendOtp: sendOtpSpendManagementSetUp, resendOtp: resendOtpSpendManagementSetUp, sendOtpSuccess: sendOtpSuccessSpendManagementSetUp, sendOtpFailure: sendOtpFailureSpendManagementSetUp, verifyOtp: verifyOtpSpendManagementSetUp, verifyOtpSuccess: verifyOtpSuccessSpendManagementSetUp, verifyOtpFailure: verifyOtpFailureSpendManagementSetUp, saveIndustryAndIncDateInLocalStore, clearSetupViewDataInLocalStore, clearSetupView,
|
|
302
|
+
export const { enableSetup, enableSetupSuccess, enableSetupFailure, updateBusinessVerificationDetails, updateBusinessVerificationDetailsSuccess, updateBusinessVerificationDetailsFailure, updateSelectedCompanyOfficer, updateSetupViewLocalStoreData, saveSetupViewDataInLocalStore, saveCompnayOfficerPhoneInLocalStore, saveCompnayOfficerAdditionalDocumentsInLocalStore, saveTreasuryAdditionalDocumentsInLocalStore, sendOtp: sendOtpSpendManagementSetUp, resendOtp: resendOtpSpendManagementSetUp, sendOtpSuccess: sendOtpSuccessSpendManagementSetUp, sendOtpFailure: sendOtpFailureSpendManagementSetUp, verifyOtp: verifyOtpSpendManagementSetUp, verifyOtpSuccess: verifyOtpSuccessSpendManagementSetUp, verifyOtpFailure: verifyOtpFailureSpendManagementSetUp, saveIndustryAndIncDateInLocalStore, clearSetupViewDataInLocalStore, clearSetupView, } = setupView.actions;
|
|
322
303
|
export default setupView.reducer;
|
|
@@ -119,7 +119,6 @@ export const getCompanyAndIdentityDetails = (state, companyId, companyAndIdentit
|
|
|
119
119
|
const companyAddress = addressViewState.newAddressState?.company_address;
|
|
120
120
|
const registeredCompanyAddress = addressViewState.newAddressState?.company_registered_address;
|
|
121
121
|
companyDetailsLocalData = {
|
|
122
|
-
autoFilledFields: companyDetails.autoFilledFields,
|
|
123
122
|
companyId,
|
|
124
123
|
companyDescription,
|
|
125
124
|
companyLegalName,
|
|
@@ -192,7 +191,6 @@ export const getCompanyAndIdentityDetails = (state, companyId, companyAndIdentit
|
|
|
192
191
|
const companyOfficerAddress = addressViewState.newAddressState?.[addressType];
|
|
193
192
|
companyOfficerLocalData[officerType] = {
|
|
194
193
|
...companyOfficer.localData,
|
|
195
|
-
autoFilledFields: companyOfficer.autoFilledFields,
|
|
196
194
|
userFiles: getFilesByFileIds(fileState, fileIds),
|
|
197
195
|
additionalFiles: getFilesByFileIds(fileState, additionalSubmittedDocumentsForVerificationFileIds),
|
|
198
196
|
deleteFileStatusById,
|
|
@@ -6,9 +6,17 @@ import { updateAllUsers } from '../../../../../entity/user/userReducer';
|
|
|
6
6
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../../responsePayload';
|
|
7
7
|
import { deleteRemiApprovalRule, deleteRemiApprovalRuleFailure, deleteRemiApprovalRuleSuccess, } from '../remiSetupApproverViewReducer';
|
|
8
8
|
export const deleteRemiApprovalRuleEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(deleteRemiApprovalRule.match), switchMap((action) => {
|
|
9
|
-
const { approvalRuleId } = action.payload;
|
|
9
|
+
const { approvalRuleId, useV3 } = action.payload;
|
|
10
|
+
// Approval Rules 3.0 — flag-gated endpoint selection.
|
|
11
|
+
// Explicit `=== true` keeps `strict-boolean-expressions` happy
|
|
12
|
+
// when RTK's payload type widens to `any` in some configs.
|
|
13
|
+
const endpoint = useV3 === true
|
|
14
|
+
? `${zeniAPI.apiEndPoints.approvalMicroServiceBaseUrl}/1.0/reimbursements/approval-rules-v2`
|
|
15
|
+
: `${zeniAPI.apiEndPoints.approvalMicroServiceBaseUrl}/1.0/reimbursements/approval-rules`;
|
|
10
16
|
return zeniAPI
|
|
11
|
-
.deleteAndGetJSON(
|
|
17
|
+
.deleteAndGetJSON(endpoint, {
|
|
18
|
+
approval_rule_id: approvalRuleId,
|
|
19
|
+
})
|
|
12
20
|
.pipe(mergeMap((response) => {
|
|
13
21
|
if (isSuccessResponse(response) && response.data != null) {
|
|
14
22
|
const approvalRuleIds = response.data.approval_rules.map((approvalRule) => approvalRule.approval_rule_id);
|
|
@@ -6,7 +6,7 @@ import { updateAllUsers } from '../../../../../entity/user/userReducer';
|
|
|
6
6
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../../responsePayload';
|
|
7
7
|
import { fetchRemiSetupApproverView, fetchRemiSetupApproverViewFailure, fetchRemiSetupApproverViewSuccess, } from '../remiSetupApproverViewReducer';
|
|
8
8
|
export const fetchRemiSetupApproverViewEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchRemiSetupApproverView.match), switchMap((action) => {
|
|
9
|
-
const { cacheOverride, resolveAttributeToUser, includeImplicitActors } = action.payload;
|
|
9
|
+
const { cacheOverride, resolveAttributeToUser, includeImplicitActors, useV3, } = action.payload;
|
|
10
10
|
const { remiSetupApproverViewState, approvalRuleState } = state$.value;
|
|
11
11
|
const approvalRules = getApprovalRulesByIds(approvalRuleState, remiSetupApproverViewState.approvalRuleIds);
|
|
12
12
|
if (cacheOverride === true ||
|
|
@@ -14,8 +14,14 @@ export const fetchRemiSetupApproverViewEpic = (actions$, state$, zeniAPI) => act
|
|
|
14
14
|
remiSetupApproverViewState.approvalRuleIds.length ||
|
|
15
15
|
(remiSetupApproverViewState.hasValidState() === false &&
|
|
16
16
|
remiSetupApproverViewState.fetchState !== 'In-Progress')) {
|
|
17
|
+
// Approval Rules 3.0 — flag-gated endpoint selection.
|
|
18
|
+
// Explicit `=== true` keeps `strict-boolean-expressions` happy
|
|
19
|
+
// when RTK's payload type widens to `any` in some configs.
|
|
20
|
+
const basePath = useV3 === true
|
|
21
|
+
? `${zeniAPI.apiEndPoints.approvalMicroServiceBaseUrl}/1.0/reimbursements/approval-rules-v2`
|
|
22
|
+
: `${zeniAPI.apiEndPoints.approvalMicroServiceBaseUrl}/1.0/reimbursements/approval-rules`;
|
|
17
23
|
return zeniAPI
|
|
18
|
-
.getJSON(`${
|
|
24
|
+
.getJSON(`${basePath}?query={"is_include_implicit_actors": ${includeImplicitActors}, "is_resolve_attribute_to_user":${resolveAttributeToUser}}`)
|
|
19
25
|
.pipe(mergeMap((response) => {
|
|
20
26
|
if (isSuccessResponse(response) && response.data != null) {
|
|
21
27
|
const approvalRuleIds = response.data.approval_rules.map((approvalRule) => approvalRule.approval_rule_id);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { from } from 'rxjs';
|
|
2
2
|
import { filter, mergeMap } from 'rxjs/operators';
|
|
3
|
-
import { getApprovalRuleById } from '../../../../../entity/approvalRule/approvalRuleSelector';
|
|
3
|
+
import { getAmountCriteria, getApprovalRuleById, getDepartmentCriteria, getVendorCriteria, } from '../../../../../entity/approvalRule/approvalRuleSelector';
|
|
4
4
|
import { clearRemiSetupApproverViewUpdateData, initializeRemiSetupApproverViewUpdateData, saveRemiSetupApproverViewUpdateData, } from '../remiSetupApproverViewReducer';
|
|
5
5
|
export const initializeRemiSetupApproverViewUpdateDataEpic = (actions$, state$) => actions$.pipe(filter(initializeRemiSetupApproverViewUpdateData.match), mergeMap((action) => {
|
|
6
6
|
const { approvalRuleId } = action.payload;
|
|
@@ -8,16 +8,20 @@ export const initializeRemiSetupApproverViewUpdateDataEpic = (actions$, state$)
|
|
|
8
8
|
if (approvalRuleId != null) {
|
|
9
9
|
const approvalRule = getApprovalRuleById(state$.value.approvalRuleState, approvalRuleId);
|
|
10
10
|
if (approvalRule != null) {
|
|
11
|
-
const criteria = approvalRule.criteria[0];
|
|
12
|
-
const range = criteria?.range;
|
|
13
11
|
const remiSetupApproverViewUpdateData = {
|
|
14
12
|
approvalRuleId,
|
|
15
13
|
steps: approvalRule.steps,
|
|
16
14
|
criteria: {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
amount: getAmountCriteria(approvalRule.criteria),
|
|
16
|
+
vendor: getVendorCriteria(approvalRule.criteria),
|
|
17
|
+
department: getDepartmentCriteria(approvalRule.criteria),
|
|
20
18
|
},
|
|
19
|
+
// Approval Rules 3.0 — seed rule-level fields so the form can
|
|
20
|
+
// round-trip them on edit. Each may be undefined on legacy rules.
|
|
21
|
+
name: approvalRule.name,
|
|
22
|
+
description: approvalRule.description,
|
|
23
|
+
separationOfDuties: approvalRule.separationOfDuties,
|
|
24
|
+
isFallback: approvalRule.isFallback,
|
|
21
25
|
};
|
|
22
26
|
fetchActions.push(clearRemiSetupApproverViewUpdateData(), saveRemiSetupApproverViewUpdateData(remiSetupApproverViewUpdateData));
|
|
23
27
|
}
|
|
@@ -25,7 +29,7 @@ export const initializeRemiSetupApproverViewUpdateDataEpic = (actions$, state$)
|
|
|
25
29
|
else {
|
|
26
30
|
const remiSetupApproverViewCreateData = {
|
|
27
31
|
steps: [],
|
|
28
|
-
criteria:
|
|
32
|
+
criteria: {},
|
|
29
33
|
};
|
|
30
34
|
fetchActions.push(clearRemiSetupApproverViewUpdateData(), saveRemiSetupApproverViewUpdateData(remiSetupApproverViewCreateData));
|
|
31
35
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { from } from 'rxjs';
|
|
2
|
+
import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
|
|
3
|
+
import { updateApprovalRules } from '../../../../../entity/approvalRule/approvalRuleReducer';
|
|
4
|
+
import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
|
|
5
|
+
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../../responsePayload';
|
|
6
|
+
import { fetchRemiSetupApproverView, reorderRemiApprovalRules, reorderRemiApprovalRulesFailure, reorderRemiApprovalRulesSuccess, } from '../remiSetupApproverViewReducer';
|
|
7
|
+
export const reorderRemiApprovalRulesEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(reorderRemiApprovalRules.match), switchMap((action) => {
|
|
8
|
+
const { approvalRuleIds, useV3 } = action.payload;
|
|
9
|
+
const endpoint = `${zeniAPI.apiEndPoints.approvalMicroServiceBaseUrl}/1.0/reimbursements/approval-rules-v2/reorder`;
|
|
10
|
+
return zeniAPI
|
|
11
|
+
.putAndGetJSON(endpoint, {
|
|
12
|
+
rule_ids: approvalRuleIds,
|
|
13
|
+
})
|
|
14
|
+
.pipe(mergeMap((response) => {
|
|
15
|
+
if (isSuccessResponse(response) && response.data != null) {
|
|
16
|
+
const serverOrderedIds = response.data.approval_rules.map((approvalRule) => approvalRule.approval_rule_id);
|
|
17
|
+
const actions = [
|
|
18
|
+
updateApprovalRules(response.data.approval_rules),
|
|
19
|
+
reorderRemiApprovalRulesSuccess(serverOrderedIds),
|
|
20
|
+
openSnackbar({
|
|
21
|
+
messageSection: `reimbursement_approval_reorder`,
|
|
22
|
+
messageText: 'success',
|
|
23
|
+
type: 'success',
|
|
24
|
+
}),
|
|
25
|
+
];
|
|
26
|
+
return from(actions);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
return from([
|
|
30
|
+
reorderRemiApprovalRulesFailure(response.status),
|
|
31
|
+
openSnackbar({
|
|
32
|
+
messageSection: `reimbursement_approval_reorder`,
|
|
33
|
+
messageText: 'failed',
|
|
34
|
+
type: 'error',
|
|
35
|
+
}),
|
|
36
|
+
fetchRemiSetupApproverView(true, true, useV3),
|
|
37
|
+
]);
|
|
38
|
+
}
|
|
39
|
+
}), catchError((error) => from([
|
|
40
|
+
reorderRemiApprovalRulesFailure(createZeniAPIStatus('Unexpected Error', 'Reorder Reimbursement Approval Rules errored out' +
|
|
41
|
+
JSON.stringify(error))),
|
|
42
|
+
openSnackbar({
|
|
43
|
+
messageSection: `reimbursement_approval_reorder`,
|
|
44
|
+
messageText: 'failed',
|
|
45
|
+
type: 'error',
|
|
46
|
+
}),
|
|
47
|
+
fetchRemiSetupApproverView(true, true, useV3),
|
|
48
|
+
])));
|
|
49
|
+
}));
|
|
@@ -4,16 +4,25 @@ import { updateApprovalRules } from '../../../../../entity/approvalRule/approval
|
|
|
4
4
|
import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
|
|
5
5
|
import { updateAllUsers } from '../../../../../entity/user/userReducer';
|
|
6
6
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../../responsePayload';
|
|
7
|
-
import { toApprovalChangableInfoPayload } from '../../../billPay/billPaySetupApproverView/types/commonPayload';
|
|
7
|
+
import { toApprovalChangableInfoPayload, toApprovalChangableInfoPayloadV1, } from '../../../billPay/billPaySetupApproverView/types/commonPayload';
|
|
8
8
|
import { saveRemiSetupApproverViewUpdates, saveRemiSetupApproverViewUpdatesFailure, saveRemiSetupApproverViewUpdatesSuccess, } from '../remiSetupApproverViewReducer';
|
|
9
|
-
export const saveRemiSetupApproverViewUpdatesEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(saveRemiSetupApproverViewUpdates.match), switchMap(() => {
|
|
9
|
+
export const saveRemiSetupApproverViewUpdatesEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(saveRemiSetupApproverViewUpdates.match), switchMap((action) => {
|
|
10
10
|
const { remiSetupApproverViewState } = state$.value;
|
|
11
11
|
const remiSetupApproverViewUpdateData = remiSetupApproverViewState.remiSetupApproverViewUpdateData;
|
|
12
12
|
if (remiSetupApproverViewUpdateData != null &&
|
|
13
13
|
remiSetupApproverViewUpdateData.data != null) {
|
|
14
|
-
|
|
14
|
+
// Approval Rules 3.0 — gate URL + write-side payload mapper on
|
|
15
|
+
// the `approval_rule_v3_config` dynamic config. `useV3` arrives
|
|
16
|
+
// on the action payload from the screen connector.
|
|
17
|
+
const { useV3 } = action.payload;
|
|
18
|
+
const payload = useV3
|
|
19
|
+
? toApprovalChangableInfoPayload(remiSetupApproverViewUpdateData.data)
|
|
20
|
+
: toApprovalChangableInfoPayloadV1(remiSetupApproverViewUpdateData.data);
|
|
21
|
+
const endpoint = useV3
|
|
22
|
+
? `${zeniAPI.apiEndPoints.approvalMicroServiceBaseUrl}/1.0/reimbursements/approval-rules-v2`
|
|
23
|
+
: `${zeniAPI.apiEndPoints.approvalMicroServiceBaseUrl}/1.0/reimbursements/approval-rules`;
|
|
15
24
|
return zeniAPI
|
|
16
|
-
.postAndGetJSON(
|
|
25
|
+
.postAndGetJSON(endpoint, payload)
|
|
17
26
|
.pipe(mergeMap((response) => {
|
|
18
27
|
if (isSuccessResponse(response) && response.data != null) {
|
|
19
28
|
const approvalRuleIds = response.data.approval_rules.map((approvalRule) => approvalRule.approval_rule_id);
|
|
@@ -13,6 +13,7 @@ export const initialState = {
|
|
|
13
13
|
newApprovalRuleId: undefined,
|
|
14
14
|
approvalRulesDeleteStatusById: {},
|
|
15
15
|
remiSetupApproverViewUpdateData: undefined,
|
|
16
|
+
reorderStatus: { fetchState: 'Not-Started', error: undefined },
|
|
16
17
|
hasValidState() {
|
|
17
18
|
return this.fetchState === 'Completed';
|
|
18
19
|
},
|
|
@@ -26,12 +27,16 @@ const remiSetupApproverView = createSlice({
|
|
|
26
27
|
draft.fetchState = 'In-Progress';
|
|
27
28
|
draft.error = undefined;
|
|
28
29
|
},
|
|
29
|
-
|
|
30
|
+
// Approval Rules 3.0 — `useV3` arrives from the screen connector
|
|
31
|
+
// (`approval_rule_v3_config` dynamic config) and picks v1 vs v2
|
|
32
|
+
// endpoint in the fetch epic.
|
|
33
|
+
prepare(cacheOverride = false, resolveAttributeToUser = false, includeImplicitActors = false, useV3 = false) {
|
|
30
34
|
return {
|
|
31
35
|
payload: {
|
|
32
36
|
cacheOverride,
|
|
33
37
|
resolveAttributeToUser,
|
|
34
38
|
includeImplicitActors,
|
|
39
|
+
useV3,
|
|
35
40
|
},
|
|
36
41
|
};
|
|
37
42
|
},
|
|
@@ -134,8 +139,11 @@ const remiSetupApproverView = createSlice({
|
|
|
134
139
|
error: undefined,
|
|
135
140
|
};
|
|
136
141
|
},
|
|
137
|
-
|
|
138
|
-
|
|
142
|
+
// Approval Rules 3.0 — `useV3` flows from the screen connector
|
|
143
|
+
// (`approval_rule_v3_config` dynamic config) so the delete epic
|
|
144
|
+
// can pick the v1 vs v2 endpoint.
|
|
145
|
+
prepare(approvalRuleId, useV3 = false) {
|
|
146
|
+
return { payload: { approvalRuleId, useV3 } };
|
|
139
147
|
},
|
|
140
148
|
},
|
|
141
149
|
deleteRemiApprovalRuleSuccess: {
|
|
@@ -167,13 +175,57 @@ const remiSetupApproverView = createSlice({
|
|
|
167
175
|
};
|
|
168
176
|
},
|
|
169
177
|
},
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
178
|
+
/**
|
|
179
|
+
* Approval Rules 3.0 — list-page drag-and-drop reorder.
|
|
180
|
+
* See BillPay equivalent for the longer rationale.
|
|
181
|
+
*/
|
|
182
|
+
reorderRemiApprovalRules: {
|
|
183
|
+
reducer(draft, action) {
|
|
184
|
+
const { approvalRuleIds } = action.payload;
|
|
185
|
+
draft.reorderStatus = { fetchState: 'In-Progress', error: undefined };
|
|
186
|
+
draft.approvalRuleIds = approvalRuleIds;
|
|
187
|
+
},
|
|
188
|
+
prepare(approvalRuleIds, useV3 = false) {
|
|
189
|
+
return { payload: { approvalRuleIds, useV3 } };
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
reorderRemiApprovalRulesSuccess: {
|
|
193
|
+
reducer(draft, action) {
|
|
194
|
+
const { approvalRuleIds } = action.payload;
|
|
195
|
+
draft.reorderStatus = { fetchState: 'Completed', error: undefined };
|
|
196
|
+
draft.approvalRuleIds = approvalRuleIds;
|
|
197
|
+
},
|
|
198
|
+
prepare(approvalRuleIds) {
|
|
199
|
+
return { payload: { approvalRuleIds } };
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
reorderRemiApprovalRulesFailure: {
|
|
203
|
+
reducer(draft, action) {
|
|
204
|
+
const { status } = action.payload;
|
|
205
|
+
draft.reorderStatus = { fetchState: 'Error', error: status };
|
|
206
|
+
},
|
|
207
|
+
prepare(status) {
|
|
208
|
+
return { payload: { status } };
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
saveRemiSetupApproverViewUpdates: {
|
|
212
|
+
// Approval Rules 3.0 — `useV3` sourced from
|
|
213
|
+
// `approval_rule_v3_config` dynamic config in the screen
|
|
214
|
+
// connector; epic uses it to pick v1 vs v2 URL + mapper. The
|
|
215
|
+
// reducer doesn't read the action but the parameter must be
|
|
216
|
+
// declared so the action payload type carries downstream.
|
|
217
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
218
|
+
reducer(draft, _action) {
|
|
219
|
+
if (draft.remiSetupApproverViewUpdateData != null) {
|
|
220
|
+
draft.remiSetupApproverViewUpdateData.updateStatus = {
|
|
221
|
+
fetchState: 'In-Progress',
|
|
222
|
+
error: undefined,
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
prepare(useV3) {
|
|
227
|
+
return { payload: { useV3 } };
|
|
228
|
+
},
|
|
177
229
|
},
|
|
178
230
|
saveRemiSetupApproverViewUpdatesSuccess: {
|
|
179
231
|
reducer(draft, action) {
|
|
@@ -262,5 +314,5 @@ const remiSetupApproverView = createSlice({
|
|
|
262
314
|
},
|
|
263
315
|
},
|
|
264
316
|
});
|
|
265
|
-
export const { fetchRemiSetupApproverView, fetchRemiSetupApproverViewSuccess, fetchRemiSetupApproverViewFailure, fetchRemiApproversDetails, fetchRemiApproversList, fetchRemiApproversListSuccess, fetchRemiApproversListFailure, deleteRemiApprovalRule, deleteRemiApprovalRuleSuccess, deleteRemiApprovalRuleFailure, saveRemiSetupApproverViewUpdates, saveRemiSetupApproverViewUpdatesSuccess, saveRemiSetupApproverViewUpdatesFailure, initializeRemiSetupApproverViewUpdateData, saveRemiSetupApproverViewUpdateData, setListeningToPusherEvent, clearRemiSetupApproverViewUpdateData, clearRemiSetupApproverView, } = remiSetupApproverView.actions;
|
|
317
|
+
export const { fetchRemiSetupApproverView, fetchRemiSetupApproverViewSuccess, fetchRemiSetupApproverViewFailure, fetchRemiApproversDetails, fetchRemiApproversList, fetchRemiApproversListSuccess, fetchRemiApproversListFailure, deleteRemiApprovalRule, deleteRemiApprovalRuleSuccess, deleteRemiApprovalRuleFailure, reorderRemiApprovalRules, reorderRemiApprovalRulesSuccess, reorderRemiApprovalRulesFailure, saveRemiSetupApproverViewUpdates, saveRemiSetupApproverViewUpdatesSuccess, saveRemiSetupApproverViewUpdatesFailure, initializeRemiSetupApproverViewUpdateData, saveRemiSetupApproverViewUpdateData, setListeningToPusherEvent, clearRemiSetupApproverViewUpdateData, clearRemiSetupApproverView, } = remiSetupApproverView.actions;
|
|
266
318
|
export default remiSetupApproverView.reducer;
|