@zeniai/client-epic-state 5.0.90-betaAR5 → 5.0.90-betaAS10
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/commonPayload.d.ts +25 -4
- package/lib/entity/approvalRule/approvalRulePayload.d.ts +5 -34
- package/lib/entity/approvalRule/approvalRulePayload.js +10 -145
- package/lib/entity/approvalRule/approvalRuleSelector.d.ts +1 -25
- package/lib/entity/approvalRule/approvalRuleSelector.js +0 -40
- package/lib/entity/approvalRule/approvalRuleState.d.ts +7 -59
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +0 -2
- package/lib/epic.d.ts +1 -3
- package/lib/epic.js +1 -3
- package/lib/esm/entity/approvalRule/approvalRulePayload.js +10 -145
- package/lib/esm/entity/approvalRule/approvalRuleSelector.js +0 -35
- package/lib/esm/entity/snackbar/snackbarTypes.js +0 -2
- package/lib/esm/epic.js +1 -3
- package/lib/esm/index.js +12 -9
- package/lib/esm/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +0 -14
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewReducer.js +12 -109
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/deleteBillPayApprovalRuleEpic.js +2 -10
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPaySetupApproverViewEpic.js +4 -8
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/initializeBillPaySetupApproverViewUpdateDataEpic.js +7 -11
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/saveBillPaySetupApproverViewUpdatesEpic.js +4 -13
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.js +16 -140
- package/lib/esm/view/spendManagement/billPay/editBillView/editBillViewSelector.js +4 -60
- package/lib/esm/view/spendManagement/billPay/editBillView/epics/fetchEditBillDetailPageEpic.js +2 -8
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/epics/fetchIntlVerificationFormEpic.js +7 -3
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/epics/initializeIntlVerificationFormEpic.js +33 -34
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/epics/submitIntlVerificationEpic.js +2 -7
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireOnboardingDetailsToLocalData.js +146 -0
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants.js +40 -0
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers.js +86 -0
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationPayload.js +55 -8
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationReducer.js +5 -6
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSelector.js +39 -15
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSubmitPayload.js +154 -0
- package/lib/esm/view/spendManagement/reimbursement/editRemiView/epics/fetchEditRemiDetailPageEpic.js +1 -5
- package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/deleteRemiApprovalRuleEpic.js +2 -10
- package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/fetchRemiSetupApproverViewEpic.js +2 -8
- package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/initializeRemiSetupApproverViewUpdateDataEpic.js +7 -11
- package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/saveRemiSetupApproverViewUpdatesEpic.js +4 -13
- package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewReducer.js +11 -80
- package/lib/index.d.ts +15 -11
- package/lib/index.js +38 -30
- 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/people/peopleTypes.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.d.ts +0 -7
- package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +0 -14
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewReducer.d.ts +3 -14
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewReducer.js +13 -110
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewState.d.ts +0 -16
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/deleteBillPayApprovalRuleEpic.js +2 -10
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPaySetupApproverViewEpic.js +4 -8
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/initializeBillPaySetupApproverViewUpdateDataEpic.js +6 -10
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/saveBillPaySetupApproverViewUpdatesEpic.js +3 -12
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.d.ts +1 -59
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.js +17 -142
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonState.d.ts +5 -31
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +1 -8
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +4 -60
- package/lib/view/spendManagement/billPay/editBillView/epics/fetchEditBillDetailPageEpic.js +2 -8
- package/lib/view/spendManagement/billPay/internationalWireVerification/epics/fetchIntlVerificationFormEpic.d.ts +3 -3
- package/lib/view/spendManagement/billPay/internationalWireVerification/epics/fetchIntlVerificationFormEpic.js +6 -2
- package/lib/view/spendManagement/billPay/internationalWireVerification/epics/initializeIntlVerificationFormEpic.d.ts +2 -1
- package/lib/view/spendManagement/billPay/internationalWireVerification/epics/initializeIntlVerificationFormEpic.js +32 -33
- package/lib/view/spendManagement/billPay/internationalWireVerification/epics/submitIntlVerificationEpic.js +2 -7
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireOnboardingDetailsToLocalData.d.ts +4 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireOnboardingDetailsToLocalData.js +150 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants.d.ts +38 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants.js +43 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers.d.ts +27 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers.js +96 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationPayload.d.ts +24 -1
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationPayload.js +59 -9
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationReducer.js +4 -5
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSelector.js +39 -15
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationState.d.ts +20 -1
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSubmitPayload.d.ts +32 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSubmitPayload.js +159 -0
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
- package/lib/view/spendManagement/reimbursement/editRemiView/epics/fetchEditRemiDetailPageEpic.js +1 -5
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/deleteRemiApprovalRuleEpic.js +2 -10
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/fetchRemiSetupApproverViewEpic.js +2 -8
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/initializeRemiSetupApproverViewUpdateDataEpic.js +6 -10
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/saveRemiSetupApproverViewUpdatesEpic.js +3 -12
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewReducer.d.ts +3 -14
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewReducer.js +12 -81
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewState.d.ts +0 -12
- package/lib/view/taskManager/taskListView/taskList.d.ts +3 -3
- package/lib/view/transactionDetail/journalEntryLinesViewModel.d.ts +1 -1
- package/package.json +1 -1
- package/lib/entity/approvalRule/approvalRuleConflict.d.ts +0 -56
- package/lib/entity/approvalRule/approvalRuleConflict.js +0 -77
- package/lib/esm/entity/approvalRule/approvalRuleConflict.js +0 -74
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/reorderBillPayApprovalRulesEpic.js +0 -54
- package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/reorderRemiApprovalRulesEpic.js +0 -61
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/reorderBillPayApprovalRulesEpic.d.ts +0 -23
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/reorderBillPayApprovalRulesEpic.js +0 -58
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/reorderRemiApprovalRulesEpic.d.ts +0 -14
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/reorderRemiApprovalRulesEpic.js +0 -65
|
@@ -1,17 +1,40 @@
|
|
|
1
1
|
import { AllowedValueWithCode } from '../../../../commonStateTypes/allowedValue';
|
|
2
2
|
import { ZeniAPIResponse } from '../../../../responsePayload';
|
|
3
|
-
import { VerificationFormField } from './internationalWireVerificationState';
|
|
3
|
+
import { VerificationFormField, VerificationFormLocalData } from './internationalWireVerificationState';
|
|
4
|
+
export declare const InternationalWireVerificationFormOrder: readonly ["certificate_of_good_standing", "business_ownership", "company_proof_of_address", "company_officer_proof_of_address", "company_registration_date", "annual_turnover", "expected_transaction_volume", "employee_count", "intended_use_of_account", "transaction_countries", "stake_holder", "controlling_person"];
|
|
5
|
+
export interface FieldOptionPayload {
|
|
6
|
+
label: string;
|
|
7
|
+
}
|
|
8
|
+
export interface SubFieldPayload {
|
|
9
|
+
label: string;
|
|
10
|
+
type: string;
|
|
11
|
+
field_hint_text?: string;
|
|
12
|
+
field_values?: {
|
|
13
|
+
code: string;
|
|
14
|
+
description: string;
|
|
15
|
+
}[];
|
|
16
|
+
is_multiple_options_supported?: boolean;
|
|
17
|
+
options?: Record<string, FieldOptionPayload>;
|
|
18
|
+
}
|
|
4
19
|
export interface FieldPayload {
|
|
5
20
|
label: string;
|
|
6
21
|
type: string;
|
|
22
|
+
default?: boolean;
|
|
7
23
|
field_hint_text?: string;
|
|
8
24
|
field_values?: {
|
|
9
25
|
code: string;
|
|
10
26
|
description: string;
|
|
11
27
|
}[];
|
|
28
|
+
is_multiple_options_supported?: boolean;
|
|
12
29
|
is_multiple_values_allowed?: boolean;
|
|
30
|
+
options?: Record<string, FieldOptionPayload>;
|
|
31
|
+
requirements?: string[];
|
|
32
|
+
subfields?: Record<string, SubFieldPayload>;
|
|
13
33
|
}
|
|
14
34
|
export declare const toDynamicFormField: (key: string, payload: FieldPayload) => VerificationFormField;
|
|
35
|
+
export declare const filterVerificationFormFieldsForReadonlyView: (fields: VerificationFormField[], localData: VerificationFormLocalData, isReadonly: boolean) => VerificationFormField[];
|
|
36
|
+
export declare const sortVerificationFormFields: (fields: VerificationFormField[]) => VerificationFormField[];
|
|
37
|
+
export declare const toVerificationFormFields: (internationalWireFormPayload: Record<string, FieldPayload>) => VerificationFormField[];
|
|
15
38
|
export type IntlVerificationFormResponse = ZeniAPIResponse<IntlVerificationFormPayload>;
|
|
16
39
|
export interface IntlVerificationFormPayload {
|
|
17
40
|
create_time: string;
|
|
@@ -1,19 +1,69 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toDynamicFormField = void 0;
|
|
3
|
+
exports.toVerificationFormFields = exports.sortVerificationFormFields = exports.filterVerificationFormFieldsForReadonlyView = exports.toDynamicFormField = exports.InternationalWireVerificationFormOrder = void 0;
|
|
4
|
+
const internationalWireVerificationFieldConstants_1 = require("./internationalWireVerificationFieldConstants");
|
|
5
|
+
const internationalWireVerificationLocalDataHelpers_1 = require("./internationalWireVerificationLocalDataHelpers");
|
|
6
|
+
exports.InternationalWireVerificationFormOrder = [
|
|
7
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.certificateOfGoodStanding,
|
|
8
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.businessOwnership,
|
|
9
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.companyProofOfAddress,
|
|
10
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.companyOfficerProofOfAddress,
|
|
11
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.companyRegistrationDate,
|
|
12
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.annualTurnover,
|
|
13
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.expectedTransactionVolume,
|
|
14
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.employeeCount,
|
|
15
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.intendedUseOfAccount,
|
|
16
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.transactionCountries,
|
|
17
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.stakeHolder,
|
|
18
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.controllingPerson,
|
|
19
|
+
];
|
|
20
|
+
const toFieldValues = (fieldValues) => fieldValues?.map(({ code, description }) => ({ code, description })) ?? [];
|
|
21
|
+
const toSubField = (subfield) => ({
|
|
22
|
+
label: subfield.label,
|
|
23
|
+
placeholder: subfield.field_hint_text ?? '',
|
|
24
|
+
type: subfield.type,
|
|
25
|
+
fieldValues: toFieldValues(subfield.field_values),
|
|
26
|
+
isMultipleOptionsSupported: subfield.is_multiple_options_supported,
|
|
27
|
+
options: subfield.options,
|
|
28
|
+
});
|
|
4
29
|
const toDynamicFormField = (key, payload) => ({
|
|
5
30
|
name: key,
|
|
6
31
|
label: payload.label,
|
|
7
32
|
placeholder: payload.field_hint_text ?? '',
|
|
8
33
|
isMultipleValuesAllowed: payload.is_multiple_values_allowed ?? false,
|
|
9
34
|
type: payload.type,
|
|
10
|
-
fieldValues: payload.field_values
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
35
|
+
fieldValues: toFieldValues(payload.field_values),
|
|
36
|
+
isMultipleOptionsSupported: payload.is_multiple_options_supported,
|
|
37
|
+
options: payload.options,
|
|
38
|
+
requirements: payload.requirements,
|
|
39
|
+
default: payload.default,
|
|
40
|
+
subfields: payload.subfields != null
|
|
41
|
+
? Object.fromEntries(Object.entries(payload.subfields).map(([subfieldKey, subfield]) => [
|
|
42
|
+
subfieldKey,
|
|
43
|
+
toSubField(subfield),
|
|
44
|
+
]))
|
|
45
|
+
: undefined,
|
|
18
46
|
});
|
|
19
47
|
exports.toDynamicFormField = toDynamicFormField;
|
|
48
|
+
const readonlyHideableVerificationFormFieldNames = new Set(internationalWireVerificationFieldConstants_1.InternationalWireVerificationReadonlyHideableFieldNames);
|
|
49
|
+
const filterVerificationFormFieldsForReadonlyView = (fields, localData, isReadonly) => {
|
|
50
|
+
if (!isReadonly || (0, internationalWireVerificationLocalDataHelpers_1.hasBusinessOwnershipValueInLocalData)(localData)) {
|
|
51
|
+
return fields;
|
|
52
|
+
}
|
|
53
|
+
return fields.filter((field) => !readonlyHideableVerificationFormFieldNames.has(field.name));
|
|
54
|
+
};
|
|
55
|
+
exports.filterVerificationFormFieldsForReadonlyView = filterVerificationFormFieldsForReadonlyView;
|
|
56
|
+
const sortVerificationFormFields = (fields) => {
|
|
57
|
+
const orderIndex = new Map(exports.InternationalWireVerificationFormOrder.map((name, index) => [name, index]));
|
|
58
|
+
return fields.slice().sort((a, b) => {
|
|
59
|
+
const aIndex = orderIndex.get(a.name) ?? exports.InternationalWireVerificationFormOrder.length;
|
|
60
|
+
const bIndex = orderIndex.get(b.name) ?? exports.InternationalWireVerificationFormOrder.length;
|
|
61
|
+
if (aIndex !== bIndex) {
|
|
62
|
+
return aIndex - bIndex;
|
|
63
|
+
}
|
|
64
|
+
return a.name.localeCompare(b.name);
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
exports.sortVerificationFormFields = sortVerificationFormFields;
|
|
68
|
+
const toVerificationFormFields = (internationalWireFormPayload) => (0, exports.sortVerificationFormFields)(Object.keys(internationalWireFormPayload).map((key) => (0, exports.toDynamicFormField)(key, internationalWireFormPayload[key])));
|
|
69
|
+
exports.toVerificationFormFields = toVerificationFormFields;
|
|
@@ -8,6 +8,7 @@ exports.initialState = {
|
|
|
8
8
|
verificationFormFetchState: {
|
|
9
9
|
fetchState: 'Not-Started',
|
|
10
10
|
},
|
|
11
|
+
verificationFormFieldLabels: {},
|
|
11
12
|
verificationFormFields: [],
|
|
12
13
|
verificationFormLocalData: {},
|
|
13
14
|
verificationFormSubmitState: {
|
|
@@ -35,11 +36,8 @@ const internationalWireVerification = (0, toolkit_1.createSlice)({
|
|
|
35
36
|
},
|
|
36
37
|
updateInternationalVerificationForm(draft, action) {
|
|
37
38
|
const { internationalWireFormPayload } = action.payload;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
verificationFormFields.push((0, internationalWireVerificationPayload_1.toDynamicFormField)(key, internationalWireFormPayload[key]));
|
|
41
|
-
});
|
|
42
|
-
draft.verificationFormFields = verificationFormFields;
|
|
39
|
+
draft.verificationFormFieldLabels = internationalWireFormPayload;
|
|
40
|
+
draft.verificationFormFields = (0, internationalWireVerificationPayload_1.toVerificationFormFields)(internationalWireFormPayload);
|
|
43
41
|
draft.verificationFormFetchState.fetchState = 'Completed';
|
|
44
42
|
},
|
|
45
43
|
updateVerificationFormFailure(draft, action) {
|
|
@@ -49,6 +47,7 @@ const internationalWireVerification = (0, toolkit_1.createSlice)({
|
|
|
49
47
|
},
|
|
50
48
|
updateVerificationFormLocalData(draft, action) {
|
|
51
49
|
draft.verificationFormLocalData = {
|
|
50
|
+
...draft.verificationFormLocalData,
|
|
52
51
|
...action.payload,
|
|
53
52
|
};
|
|
54
53
|
},
|
|
@@ -1,29 +1,53 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getIntlWireVerificationView = void 0;
|
|
4
|
+
const companySelector_1 = require("../../../../entity/company/companySelector");
|
|
4
5
|
const fileSelector_1 = require("../../../../entity/file/fileSelector");
|
|
6
|
+
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
5
7
|
const fileViewSelector_1 = require("../../../fileView/fileViewSelector");
|
|
8
|
+
const internationalWireVerificationPayload_1 = require("./internationalWireVerificationPayload");
|
|
9
|
+
const collectFileIdsFromLocalData = (localData) => {
|
|
10
|
+
const fileIds = new Set();
|
|
11
|
+
Object.values(localData).forEach((value) => {
|
|
12
|
+
if (typeof value === 'string' && value.startsWith('file_')) {
|
|
13
|
+
fileIds.add(value);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (Array.isArray(value)) {
|
|
17
|
+
value.forEach((item) => {
|
|
18
|
+
if (typeof item === 'string' && item.startsWith('file_')) {
|
|
19
|
+
fileIds.add(item);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
return Array.from(fileIds);
|
|
25
|
+
};
|
|
6
26
|
const getIntlWireVerificationView = (state) => {
|
|
7
27
|
const deleteFileStatusById = {};
|
|
8
28
|
const updateFileStatusById = {};
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
if (fileField != null) {
|
|
13
|
-
fileId = state.internationalWireVerificationState.verificationFormLocalData[fileField.name];
|
|
14
|
-
}
|
|
15
|
-
if (fileId != null) {
|
|
29
|
+
const { verificationFormFetchState, verificationFormFields, verificationFormLocalData, verificationFormSubmitState, } = state.internationalWireVerificationState;
|
|
30
|
+
const fileIds = collectFileIdsFromLocalData(verificationFormLocalData);
|
|
31
|
+
fileIds.forEach((fileId) => {
|
|
16
32
|
deleteFileStatusById[fileId] = (0, fileViewSelector_1.getFileDeleteStatusById)(state, fileId);
|
|
17
33
|
updateFileStatusById[fileId] = (0, fileViewSelector_1.getFileUpdateNameStatusById)(state, fileId);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
34
|
+
});
|
|
35
|
+
const userFiles = fileIds.length > 0 ? (0, fileSelector_1.getFilesByFileIds)(state.fileState, fileIds) : [];
|
|
36
|
+
const fetchState = verificationFormFetchState.fetchState;
|
|
37
|
+
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
38
|
+
const company = currentTenant?.companyId != null
|
|
39
|
+
? (0, companySelector_1.getCompanyByCompanyId)(state.companyState, currentTenant.companyId)
|
|
40
|
+
?.company
|
|
41
|
+
: undefined;
|
|
42
|
+
const onboardingStatusCode = company?.companyBillPayInfo?.internationalWireOnboardingStatus?.code;
|
|
43
|
+
const isReadonly = onboardingStatusCode != null &&
|
|
44
|
+
onboardingStatusCode !== 'onboarding_status_not_started';
|
|
45
|
+
const visibleVerificationFormFields = (0, internationalWireVerificationPayload_1.filterVerificationFormFieldsForReadonlyView)(verificationFormFields, verificationFormLocalData, isReadonly);
|
|
25
46
|
return {
|
|
26
|
-
|
|
47
|
+
verificationFormFetchState,
|
|
48
|
+
verificationFormFields: visibleVerificationFormFields,
|
|
49
|
+
verificationFormLocalData,
|
|
50
|
+
verificationFormSubmitState,
|
|
27
51
|
deleteFileStatusById,
|
|
28
52
|
updateFileStatusById,
|
|
29
53
|
userFiles,
|
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
import { FetchStateAndError } from '../../../../commonStateTypes/common';
|
|
2
|
+
import { FieldPayload } from './internationalWireVerificationPayload';
|
|
2
3
|
export interface InternationalWireVerificationState {
|
|
3
4
|
verificationFormFetchState: FetchStateAndError;
|
|
5
|
+
verificationFormFieldLabels: Record<string, FieldPayload>;
|
|
4
6
|
verificationFormFields: VerificationFormField[];
|
|
5
7
|
verificationFormLocalData: VerificationFormLocalData;
|
|
6
8
|
verificationFormSubmitState: FetchStateAndError;
|
|
7
9
|
}
|
|
8
|
-
export type
|
|
10
|
+
export type VerificationFormLocalDataValue = string | string[] | number;
|
|
11
|
+
export type VerificationFormLocalData = Record<string, VerificationFormLocalDataValue>;
|
|
9
12
|
export interface FieldValueType {
|
|
10
13
|
code: string;
|
|
11
14
|
description: string;
|
|
12
15
|
}
|
|
16
|
+
export interface VerificationFormFieldOption {
|
|
17
|
+
label: string;
|
|
18
|
+
}
|
|
19
|
+
export interface VerificationFormSubField {
|
|
20
|
+
fieldValues: FieldValueType[];
|
|
21
|
+
label: string;
|
|
22
|
+
placeholder: string;
|
|
23
|
+
type: string;
|
|
24
|
+
isMultipleOptionsSupported?: boolean;
|
|
25
|
+
options?: Record<string, VerificationFormFieldOption>;
|
|
26
|
+
}
|
|
13
27
|
export interface VerificationFormField {
|
|
14
28
|
fieldValues: FieldValueType[];
|
|
15
29
|
isMultipleValuesAllowed: boolean;
|
|
@@ -17,4 +31,9 @@ export interface VerificationFormField {
|
|
|
17
31
|
name: string;
|
|
18
32
|
placeholder: string;
|
|
19
33
|
type: string;
|
|
34
|
+
default?: boolean;
|
|
35
|
+
isMultipleOptionsSupported?: boolean;
|
|
36
|
+
options?: Record<string, VerificationFormFieldOption>;
|
|
37
|
+
requirements?: string[];
|
|
38
|
+
subfields?: Record<string, VerificationFormSubField>;
|
|
20
39
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { VerificationFormLocalData } from './internationalWireVerificationState';
|
|
2
|
+
export interface IntlWireFileOptionPayload {
|
|
3
|
+
file_id: string;
|
|
4
|
+
option: string;
|
|
5
|
+
}
|
|
6
|
+
export interface IntlWirePersonNamePayload {
|
|
7
|
+
first_name: string;
|
|
8
|
+
last_name: string;
|
|
9
|
+
}
|
|
10
|
+
export interface IntlWirePersonPayload {
|
|
11
|
+
company_role?: string;
|
|
12
|
+
date_of_birth?: string;
|
|
13
|
+
email?: string;
|
|
14
|
+
name?: IntlWirePersonNamePayload;
|
|
15
|
+
nationality?: string;
|
|
16
|
+
ownership_percentage?: number;
|
|
17
|
+
proof_of_address?: IntlWireFileOptionPayload[];
|
|
18
|
+
proof_of_identity?: IntlWireFileOptionPayload[];
|
|
19
|
+
ssn?: string;
|
|
20
|
+
}
|
|
21
|
+
export type IntlWireFormDetailsPayload = Record<string, string | string[] | number | IntlWireFileOptionPayload[] | IntlWirePersonPayload | IntlWirePersonPayload[]>;
|
|
22
|
+
export declare const IntlWireVerificationLocalDataSuffix: {
|
|
23
|
+
readonly documentOption: "_option";
|
|
24
|
+
readonly documentBack: "_back";
|
|
25
|
+
readonly nameFirst: "_first_name";
|
|
26
|
+
readonly nameLast: "_last_name";
|
|
27
|
+
};
|
|
28
|
+
export declare const toIntlWireVerificationFormDetails: (localData: VerificationFormLocalData) => IntlWireFormDetailsPayload;
|
|
29
|
+
export declare const toIntlWireVerificationSubmitPayload: (localData: VerificationFormLocalData) => {
|
|
30
|
+
is_applicant_declaration: boolean;
|
|
31
|
+
form_details: IntlWireFormDetailsPayload;
|
|
32
|
+
};
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toIntlWireVerificationSubmitPayload = exports.toIntlWireVerificationFormDetails = exports.IntlWireVerificationLocalDataSuffix = void 0;
|
|
4
|
+
const internationalWireVerificationFieldConstants_1 = require("./internationalWireVerificationFieldConstants");
|
|
5
|
+
exports.IntlWireVerificationLocalDataSuffix = {
|
|
6
|
+
documentOption: '_option',
|
|
7
|
+
documentBack: '_back',
|
|
8
|
+
nameFirst: '_first_name',
|
|
9
|
+
nameLast: '_last_name',
|
|
10
|
+
};
|
|
11
|
+
const MULTI_OPTION_FILE_FIELD_NAMES = new Set([
|
|
12
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.businessOwnership,
|
|
13
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.companyProofOfAddress,
|
|
14
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.companyOfficerProofOfAddress,
|
|
15
|
+
]);
|
|
16
|
+
const BOOLEAN_WITH_SUBFIELDS_FIELD_NAMES = new Set([
|
|
17
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder,
|
|
18
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.controllingPerson,
|
|
19
|
+
]);
|
|
20
|
+
const FILE_SUBFIELD_NAMES = new Set([
|
|
21
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.proofOfIdentity,
|
|
22
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.proofOfAddress,
|
|
23
|
+
]);
|
|
24
|
+
const isInternalLocalDataKey = (key) => key.endsWith(exports.IntlWireVerificationLocalDataSuffix.documentOption) ||
|
|
25
|
+
key.endsWith(exports.IntlWireVerificationLocalDataSuffix.documentBack) ||
|
|
26
|
+
key.endsWith(exports.IntlWireVerificationLocalDataSuffix.nameFirst) ||
|
|
27
|
+
key.endsWith(exports.IntlWireVerificationLocalDataSuffix.nameLast);
|
|
28
|
+
const isPersonSubfieldKey = (key) => key.startsWith(`${internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder}_`) ||
|
|
29
|
+
key.startsWith(`${internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.controllingPerson}_`);
|
|
30
|
+
const toFileOptionPayloads = (localData, baseKey) => {
|
|
31
|
+
const option = localData[`${baseKey}${exports.IntlWireVerificationLocalDataSuffix.documentOption}`];
|
|
32
|
+
if (typeof option !== 'string' || option.length === 0) {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
const payloads = [];
|
|
36
|
+
const frontFileId = localData[baseKey];
|
|
37
|
+
if (typeof frontFileId === 'string' && frontFileId.length > 0) {
|
|
38
|
+
payloads.push({ file_id: frontFileId, option });
|
|
39
|
+
}
|
|
40
|
+
const backFileId = localData[`${baseKey}${exports.IntlWireVerificationLocalDataSuffix.documentBack}`];
|
|
41
|
+
if (typeof backFileId === 'string' && backFileId.length > 0) {
|
|
42
|
+
payloads.push({ file_id: backFileId, option });
|
|
43
|
+
}
|
|
44
|
+
return payloads.length > 0 ? payloads : undefined;
|
|
45
|
+
};
|
|
46
|
+
const buildPersonPayload = (localData, keyPrefix) => {
|
|
47
|
+
const person = {};
|
|
48
|
+
const nameBaseKey = `${keyPrefix}_${internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.name}`;
|
|
49
|
+
const firstName = localData[`${nameBaseKey}${exports.IntlWireVerificationLocalDataSuffix.nameFirst}`];
|
|
50
|
+
const lastName = localData[`${nameBaseKey}${exports.IntlWireVerificationLocalDataSuffix.nameLast}`];
|
|
51
|
+
if (typeof firstName === 'string' || typeof lastName === 'string') {
|
|
52
|
+
person.name = {
|
|
53
|
+
first_name: typeof firstName === 'string' ? firstName : '',
|
|
54
|
+
last_name: typeof lastName === 'string' ? lastName : '',
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const assignStringField = (subfieldName, assign) => {
|
|
58
|
+
const value = localData[`${keyPrefix}_${subfieldName}`];
|
|
59
|
+
if (typeof value === 'string' && value.length > 0) {
|
|
60
|
+
assign(value);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
assignStringField(internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.nationality, (value) => {
|
|
64
|
+
person.nationality = value;
|
|
65
|
+
});
|
|
66
|
+
assignStringField(internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.email, (value) => {
|
|
67
|
+
person.email = value;
|
|
68
|
+
});
|
|
69
|
+
assignStringField(internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.companyRole, (value) => {
|
|
70
|
+
person.company_role = value;
|
|
71
|
+
});
|
|
72
|
+
assignStringField(internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.ssn, (value) => {
|
|
73
|
+
person.ssn = value;
|
|
74
|
+
});
|
|
75
|
+
assignStringField(internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.dateOfBirth, (value) => {
|
|
76
|
+
person.date_of_birth = value;
|
|
77
|
+
});
|
|
78
|
+
const ownershipValue = localData[`${keyPrefix}_${internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.ownershipPercentage}`];
|
|
79
|
+
if (ownershipValue != null && ownershipValue !== '') {
|
|
80
|
+
person.ownership_percentage = Number(ownershipValue);
|
|
81
|
+
}
|
|
82
|
+
FILE_SUBFIELD_NAMES.forEach((subfieldName) => {
|
|
83
|
+
const filePayloads = toFileOptionPayloads(localData, `${keyPrefix}_${subfieldName}`);
|
|
84
|
+
if (filePayloads != null) {
|
|
85
|
+
if (subfieldName ===
|
|
86
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.proofOfIdentity) {
|
|
87
|
+
person.proof_of_identity = filePayloads;
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
person.proof_of_address = filePayloads;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
return person;
|
|
95
|
+
};
|
|
96
|
+
const getStakeHolderOwnerIndices = (localData) => {
|
|
97
|
+
const stakeHolderPrefix = `${internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder}_`;
|
|
98
|
+
const indices = new Set();
|
|
99
|
+
Object.keys(localData).forEach((key) => {
|
|
100
|
+
const match = key.match(/^stake_holder_(\d+)_/);
|
|
101
|
+
if (match != null) {
|
|
102
|
+
indices.add(Number.parseInt(match[1], 10));
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
if (indices.size === 0) {
|
|
106
|
+
const hasUnindexedStakeHolderData = Object.keys(localData).some((key) => key.startsWith(stakeHolderPrefix) &&
|
|
107
|
+
!/^stake_holder_(true|false)$/.test(key));
|
|
108
|
+
if (hasUnindexedStakeHolderData) {
|
|
109
|
+
indices.add(0);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return Array.from(indices).sort((a, b) => a - b);
|
|
113
|
+
};
|
|
114
|
+
const hasPersonPayloadData = (person) => Object.keys(person).length > 0;
|
|
115
|
+
const toIntlWireVerificationFormDetails = (localData) => {
|
|
116
|
+
const formDetails = {};
|
|
117
|
+
Object.entries(localData).forEach(([key, value]) => {
|
|
118
|
+
if (BOOLEAN_WITH_SUBFIELDS_FIELD_NAMES.has(key) ||
|
|
119
|
+
isInternalLocalDataKey(key) ||
|
|
120
|
+
isPersonSubfieldKey(key)) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
if (MULTI_OPTION_FILE_FIELD_NAMES.has(key)) {
|
|
124
|
+
const filePayloads = toFileOptionPayloads(localData, key);
|
|
125
|
+
if (filePayloads != null) {
|
|
126
|
+
formDetails[key] = filePayloads;
|
|
127
|
+
}
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
if (value == null || value === '') {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
formDetails[key] = value;
|
|
134
|
+
});
|
|
135
|
+
const stakeHolderSelection = localData[internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder];
|
|
136
|
+
if (stakeHolderSelection === 'true') {
|
|
137
|
+
formDetails[internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder] = getStakeHolderOwnerIndices(localData)
|
|
138
|
+
.map((ownerIndex) => buildPersonPayload(localData, `${internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder}_${ownerIndex}`))
|
|
139
|
+
.filter(hasPersonPayloadData);
|
|
140
|
+
}
|
|
141
|
+
else if (stakeHolderSelection === 'false') {
|
|
142
|
+
formDetails[internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder] = [];
|
|
143
|
+
}
|
|
144
|
+
const controllingPersonSelection = localData[internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames
|
|
145
|
+
.controllingPerson];
|
|
146
|
+
if (controllingPersonSelection === 'false') {
|
|
147
|
+
const controllingPerson = buildPersonPayload(localData, internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.controllingPerson);
|
|
148
|
+
if (hasPersonPayloadData(controllingPerson)) {
|
|
149
|
+
formDetails[internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.controllingPerson] = controllingPerson;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return formDetails;
|
|
153
|
+
};
|
|
154
|
+
exports.toIntlWireVerificationFormDetails = toIntlWireVerificationFormDetails;
|
|
155
|
+
const toIntlWireVerificationSubmitPayload = (localData) => ({
|
|
156
|
+
is_applicant_declaration: true,
|
|
157
|
+
form_details: (0, exports.toIntlWireVerificationFormDetails)(localData),
|
|
158
|
+
});
|
|
159
|
+
exports.toIntlWireVerificationSubmitPayload = toIntlWireVerificationSubmitPayload;
|
|
@@ -61,7 +61,7 @@ export declare const initialCreditAcc: CreditAccount;
|
|
|
61
61
|
export declare const initialDebitCardSummaries: DebitCardSummaries;
|
|
62
62
|
export declare const initialResendRevokeCardInvite: ResendRevokeCardInvite;
|
|
63
63
|
export declare const initialCreditAccountRepayment: CreditAccountRepayment;
|
|
64
|
-
export declare const toChargeCardSortKeyType: (v: string) => "status" | "
|
|
64
|
+
export declare const toChargeCardSortKeyType: (v: string) => "status" | "accountType" | "owner" | "cardName" | "limit" | "department" | "cardType" | "utilisation";
|
|
65
65
|
export declare type ChargeCardViewSortKey = ReturnType<typeof toChargeCardSortKeyType>;
|
|
66
66
|
export declare const ALL_CASHBACK_SORT_KEYS: readonly ["month", "cashback"];
|
|
67
67
|
export declare const toCashbackSortKeyType: (v: string) => "month" | "cashback";
|
package/lib/view/spendManagement/reimbursement/editRemiView/epics/fetchEditRemiDetailPageEpic.js
CHANGED
|
@@ -66,11 +66,7 @@ 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
|
-
|
|
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));
|
|
69
|
+
remiDetailActions.push((0, remiSetupApproverViewReducer_1.fetchRemiSetupApproverView)(true));
|
|
74
70
|
}
|
|
75
71
|
}
|
|
76
72
|
}
|
|
@@ -9,17 +9,9 @@ const userReducer_1 = require("../../../../../entity/user/userReducer");
|
|
|
9
9
|
const responsePayload_1 = require("../../../../../responsePayload");
|
|
10
10
|
const remiSetupApproverViewReducer_1 = require("../remiSetupApproverViewReducer");
|
|
11
11
|
const deleteRemiApprovalRuleEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(remiSetupApproverViewReducer_1.deleteRemiApprovalRule.match), (0, operators_1.switchMap)((action) => {
|
|
12
|
-
const { approvalRuleId
|
|
13
|
-
// Approval Rules 3.0 — flag-gated endpoint selection.
|
|
14
|
-
// Explicit `=== true` keeps `strict-boolean-expressions` happy
|
|
15
|
-
// when RTK's payload type widens to `any` in some configs.
|
|
16
|
-
const endpoint = useV3 === true
|
|
17
|
-
? `${zeniAPI.apiEndPoints.approvalMicroServiceBaseUrl}/1.0/reimbursements/approval-rules-v2`
|
|
18
|
-
: `${zeniAPI.apiEndPoints.approvalMicroServiceBaseUrl}/1.0/reimbursements/approval-rules`;
|
|
12
|
+
const { approvalRuleId } = action.payload;
|
|
19
13
|
return zeniAPI
|
|
20
|
-
.deleteAndGetJSON(
|
|
21
|
-
approval_rule_id: approvalRuleId,
|
|
22
|
-
})
|
|
14
|
+
.deleteAndGetJSON(`${zeniAPI.apiEndPoints.approvalMicroServiceBaseUrl}/1.0/reimbursements/approval-rules`, { approval_rule_id: approvalRuleId })
|
|
23
15
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
24
16
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
25
17
|
const approvalRuleIds = response.data.approval_rules.map((approvalRule) => approvalRule.approval_rule_id);
|
|
@@ -9,7 +9,7 @@ const userReducer_1 = require("../../../../../entity/user/userReducer");
|
|
|
9
9
|
const responsePayload_1 = require("../../../../../responsePayload");
|
|
10
10
|
const remiSetupApproverViewReducer_1 = require("../remiSetupApproverViewReducer");
|
|
11
11
|
const fetchRemiSetupApproverViewEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(remiSetupApproverViewReducer_1.fetchRemiSetupApproverView.match), (0, operators_1.switchMap)((action) => {
|
|
12
|
-
const { cacheOverride, resolveAttributeToUser, includeImplicitActors
|
|
12
|
+
const { cacheOverride, resolveAttributeToUser, includeImplicitActors } = action.payload;
|
|
13
13
|
const { remiSetupApproverViewState, approvalRuleState } = state$.value;
|
|
14
14
|
const approvalRules = (0, approvalRuleSelector_1.getApprovalRulesByIds)(approvalRuleState, remiSetupApproverViewState.approvalRuleIds);
|
|
15
15
|
if (cacheOverride === true ||
|
|
@@ -17,14 +17,8 @@ const fetchRemiSetupApproverViewEpic = (actions$, state$, zeniAPI) => actions$.p
|
|
|
17
17
|
remiSetupApproverViewState.approvalRuleIds.length ||
|
|
18
18
|
(remiSetupApproverViewState.hasValidState() === false &&
|
|
19
19
|
remiSetupApproverViewState.fetchState !== 'In-Progress')) {
|
|
20
|
-
// Approval Rules 3.0 — flag-gated endpoint selection.
|
|
21
|
-
// Explicit `=== true` keeps `strict-boolean-expressions` happy
|
|
22
|
-
// when RTK's payload type widens to `any` in some configs.
|
|
23
|
-
const basePath = useV3 === true
|
|
24
|
-
? `${zeniAPI.apiEndPoints.approvalMicroServiceBaseUrl}/1.0/reimbursements/approval-rules-v2`
|
|
25
|
-
: `${zeniAPI.apiEndPoints.approvalMicroServiceBaseUrl}/1.0/reimbursements/approval-rules`;
|
|
26
20
|
return zeniAPI
|
|
27
|
-
.getJSON(`${
|
|
21
|
+
.getJSON(`${zeniAPI.apiEndPoints.approvalMicroServiceBaseUrl}/1.0/reimbursements/approval-rules?query={"is_include_implicit_actors": ${includeImplicitActors}, "is_resolve_attribute_to_user":${resolveAttributeToUser}}`)
|
|
28
22
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
29
23
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
30
24
|
const approvalRuleIds = response.data.approval_rules.map((approvalRule) => approvalRule.approval_rule_id);
|
|
@@ -11,20 +11,16 @@ const initializeRemiSetupApproverViewUpdateDataEpic = (actions$, state$) => acti
|
|
|
11
11
|
if (approvalRuleId != null) {
|
|
12
12
|
const approvalRule = (0, approvalRuleSelector_1.getApprovalRuleById)(state$.value.approvalRuleState, approvalRuleId);
|
|
13
13
|
if (approvalRule != null) {
|
|
14
|
+
const criteria = approvalRule.criteria[0];
|
|
15
|
+
const range = criteria?.range;
|
|
14
16
|
const remiSetupApproverViewUpdateData = {
|
|
15
17
|
approvalRuleId,
|
|
16
18
|
steps: approvalRule.steps,
|
|
17
19
|
criteria: {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
rangeType: criteria?.rangeType,
|
|
21
|
+
rangeEntity: criteria?.rangeEntity,
|
|
22
|
+
range,
|
|
21
23
|
},
|
|
22
|
-
// Approval Rules 3.0 — seed rule-level fields so the form can
|
|
23
|
-
// round-trip them on edit. Each may be undefined on legacy rules.
|
|
24
|
-
name: approvalRule.name,
|
|
25
|
-
description: approvalRule.description,
|
|
26
|
-
separationOfDuties: approvalRule.separationOfDuties,
|
|
27
|
-
isFallback: approvalRule.isFallback,
|
|
28
24
|
};
|
|
29
25
|
fetchActions.push((0, remiSetupApproverViewReducer_1.clearRemiSetupApproverViewUpdateData)(), (0, remiSetupApproverViewReducer_1.saveRemiSetupApproverViewUpdateData)(remiSetupApproverViewUpdateData));
|
|
30
26
|
}
|
|
@@ -32,7 +28,7 @@ const initializeRemiSetupApproverViewUpdateDataEpic = (actions$, state$) => acti
|
|
|
32
28
|
else {
|
|
33
29
|
const remiSetupApproverViewCreateData = {
|
|
34
30
|
steps: [],
|
|
35
|
-
criteria:
|
|
31
|
+
criteria: undefined,
|
|
36
32
|
};
|
|
37
33
|
fetchActions.push((0, remiSetupApproverViewReducer_1.clearRemiSetupApproverViewUpdateData)(), (0, remiSetupApproverViewReducer_1.saveRemiSetupApproverViewUpdateData)(remiSetupApproverViewCreateData));
|
|
38
34
|
}
|
|
@@ -9,23 +9,14 @@ const userReducer_1 = require("../../../../../entity/user/userReducer");
|
|
|
9
9
|
const responsePayload_1 = require("../../../../../responsePayload");
|
|
10
10
|
const commonPayload_1 = require("../../../billPay/billPaySetupApproverView/types/commonPayload");
|
|
11
11
|
const remiSetupApproverViewReducer_1 = require("../remiSetupApproverViewReducer");
|
|
12
|
-
const saveRemiSetupApproverViewUpdatesEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(remiSetupApproverViewReducer_1.saveRemiSetupApproverViewUpdates.match), (0, operators_1.switchMap)((
|
|
12
|
+
const saveRemiSetupApproverViewUpdatesEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(remiSetupApproverViewReducer_1.saveRemiSetupApproverViewUpdates.match), (0, operators_1.switchMap)(() => {
|
|
13
13
|
const { remiSetupApproverViewState } = state$.value;
|
|
14
14
|
const remiSetupApproverViewUpdateData = remiSetupApproverViewState.remiSetupApproverViewUpdateData;
|
|
15
15
|
if (remiSetupApproverViewUpdateData != null &&
|
|
16
16
|
remiSetupApproverViewUpdateData.data != null) {
|
|
17
|
-
|
|
18
|
-
// the `approval_rule_v3_config` dynamic config. `useV3` arrives
|
|
19
|
-
// on the action payload from the screen connector.
|
|
20
|
-
const { useV3 } = action.payload;
|
|
21
|
-
const payload = useV3
|
|
22
|
-
? (0, commonPayload_1.toApprovalChangableInfoPayload)(remiSetupApproverViewUpdateData.data)
|
|
23
|
-
: (0, commonPayload_1.toApprovalChangableInfoPayloadV1)(remiSetupApproverViewUpdateData.data);
|
|
24
|
-
const endpoint = useV3
|
|
25
|
-
? `${zeniAPI.apiEndPoints.approvalMicroServiceBaseUrl}/1.0/reimbursements/approval-rules-v2`
|
|
26
|
-
: `${zeniAPI.apiEndPoints.approvalMicroServiceBaseUrl}/1.0/reimbursements/approval-rules`;
|
|
17
|
+
const payload = (0, commonPayload_1.toApprovalChangableInfoPayload)(remiSetupApproverViewUpdateData.data);
|
|
27
18
|
return zeniAPI
|
|
28
|
-
.postAndGetJSON(
|
|
19
|
+
.postAndGetJSON(`${zeniAPI.apiEndPoints.approvalMicroServiceBaseUrl}/1.0/reimbursements/approval-rules`, payload)
|
|
29
20
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
30
21
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
31
22
|
const approvalRuleIds = response.data.approval_rules.map((approvalRule) => approvalRule.approval_rule_id);
|
|
@@ -2,11 +2,10 @@ 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], {
|
|
6
6
|
cacheOverride: any;
|
|
7
7
|
resolveAttributeToUser: any;
|
|
8
8
|
includeImplicitActors: any;
|
|
9
|
-
useV3: boolean;
|
|
10
9
|
}, "remiSetupApproverView/fetchRemiSetupApproverView", never, never>, fetchRemiSetupApproverViewSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[approvalRuleIds: string[]], {
|
|
11
10
|
approvalRuleIds: string[];
|
|
12
11
|
}, "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,25 +24,15 @@ export declare const fetchRemiSetupApproverView: import("@reduxjs/toolkit").Acti
|
|
|
25
24
|
attributeSubTypeToUserIdMapping: Record<"manager" | "vendor_owner" | "manager_of_manager", string> | undefined;
|
|
26
25
|
}, "remiSetupApproverView/fetchRemiApproversListSuccess", never, never>, fetchRemiApproversListFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[status: ZeniAPIStatus<Record<string, unknown>>], {
|
|
27
26
|
status: ZeniAPIStatus<Record<string, unknown>>;
|
|
28
|
-
}, "remiSetupApproverView/fetchRemiApproversListFailure", never, never>, deleteRemiApprovalRule: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[approvalRuleId: string
|
|
27
|
+
}, "remiSetupApproverView/fetchRemiApproversListFailure", never, never>, deleteRemiApprovalRule: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[approvalRuleId: string], {
|
|
29
28
|
approvalRuleId: string;
|
|
30
|
-
useV3: boolean;
|
|
31
29
|
}, "remiSetupApproverView/deleteRemiApprovalRule", never, never>, deleteRemiApprovalRuleSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[deletedApprovalRuleId: string, approvalRuleIds: string[]], {
|
|
32
30
|
deletedApprovalRuleId: string;
|
|
33
31
|
approvalRuleIds: string[];
|
|
34
32
|
}, "remiSetupApproverView/deleteRemiApprovalRuleSuccess", never, never>, deleteRemiApprovalRuleFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[approvalRuleId: string, status: ZeniAPIStatus<Record<string, unknown>>], {
|
|
35
33
|
approvalRuleId: string;
|
|
36
34
|
status: ZeniAPIStatus<Record<string, unknown>>;
|
|
37
|
-
}, "remiSetupApproverView/deleteRemiApprovalRuleFailure", never, never>,
|
|
38
|
-
approvalRuleIds: string[];
|
|
39
|
-
useV3: boolean;
|
|
40
|
-
}, "remiSetupApproverView/reorderRemiApprovalRules", never, never>, reorderRemiApprovalRulesSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[approvalRuleIds: string[]], {
|
|
41
|
-
approvalRuleIds: string[];
|
|
42
|
-
}, "remiSetupApproverView/reorderRemiApprovalRulesSuccess", never, never>, reorderRemiApprovalRulesFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[status: ZeniAPIStatus<Record<string, unknown>>], {
|
|
43
|
-
status: ZeniAPIStatus<Record<string, unknown>>;
|
|
44
|
-
}, "remiSetupApproverView/reorderRemiApprovalRulesFailure", never, never>, saveRemiSetupApproverViewUpdates: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[useV3: boolean], {
|
|
45
|
-
useV3: boolean;
|
|
46
|
-
}, "remiSetupApproverView/saveRemiSetupApproverViewUpdates", never, never>, saveRemiSetupApproverViewUpdatesSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[approvalRuleIds: string[], affectedEntityIds?: string[] | undefined, newApprovalRuleId?: string | undefined], {
|
|
35
|
+
}, "remiSetupApproverView/deleteRemiApprovalRuleFailure", never, never>, saveRemiSetupApproverViewUpdates: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"remiSetupApproverView/saveRemiSetupApproverViewUpdates">, saveRemiSetupApproverViewUpdatesSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[approvalRuleIds: string[], affectedEntityIds?: string[] | undefined, newApprovalRuleId?: string | undefined], {
|
|
47
36
|
approvalRuleIds: string[];
|
|
48
37
|
affectedEntityIds: string[] | undefined;
|
|
49
38
|
newApprovalRuleId: string | undefined;
|