@zeniai/client-epic-state 5.1.3-betaAS1 → 5.1.3-betaVR1
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 +4 -25
- package/lib/esm/index.js +4 -8
- package/lib/esm/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +200 -0
- package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +96 -2
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/epics/fetchIntlVerificationFormEpic.js +3 -7
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/epics/initializeIntlVerificationFormEpic.js +34 -33
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/epics/submitIntlVerificationEpic.js +7 -2
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationPayload.js +8 -55
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationReducer.js +6 -5
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSelector.js +15 -39
- package/lib/index.d.ts +6 -11
- package/lib/index.js +41 -54
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +36 -1
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +205 -1
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +28 -2
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +96 -2
- package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +39 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/epics/fetchIntlVerificationFormEpic.d.ts +3 -3
- package/lib/view/spendManagement/billPay/internationalWireVerification/epics/fetchIntlVerificationFormEpic.js +2 -6
- package/lib/view/spendManagement/billPay/internationalWireVerification/epics/initializeIntlVerificationFormEpic.d.ts +1 -2
- package/lib/view/spendManagement/billPay/internationalWireVerification/epics/initializeIntlVerificationFormEpic.js +33 -32
- package/lib/view/spendManagement/billPay/internationalWireVerification/epics/submitIntlVerificationEpic.js +7 -2
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationPayload.d.ts +1 -24
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationPayload.js +9 -59
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationReducer.js +5 -4
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSelector.js +15 -39
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationState.d.ts +1 -20
- package/package.json +2 -2
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireOnboardingDetailsToLocalData.js +0 -146
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants.js +0 -40
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers.js +0 -86
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSubmitPayload.js +0 -154
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireOnboardingDetailsToLocalData.d.ts +0 -4
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireOnboardingDetailsToLocalData.js +0 -150
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants.d.ts +0 -38
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants.js +0 -43
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers.d.ts +0 -27
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers.js +0 -96
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSubmitPayload.d.ts +0 -32
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSubmitPayload.js +0 -159
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasTransactionLocalDataChanges = exports.isAnyItemWithUncategorizedExpenseAccount = exports.getSnackbarMessageForTransactionReview = exports.mergeTabSpecificLineItems = exports.getLineItemsByTransactionIdsFromLocalData = exports.getLineItemsByTransactionsIdsFromResponse = exports.checkIfAllLineItemsAreCategoryClassFilled = exports.setEntityRecommendationForLineIdInLocalData = exports.toSetAllLineItemsToCategoryClass = exports.toTransactionDetailLocalData = exports.shouldAutoSelectAndAdd = exports.MAX_SELECTION_LIMIT = exports.filterAutoTabLineItems = exports.removeTransactionFromTabView = exports.getPendingReviewLineIdsFromTransaction = void 0;
|
|
3
|
+
exports.toClearApplyToEmpty = exports.toApplyFieldToEmptyLines = exports.toSetLastEditedFieldForApplyToEmpty = exports.isLineFieldEmpty = exports.hasTransactionLocalDataChanges = exports.isAnyItemWithUncategorizedExpenseAccount = exports.getSnackbarMessageForTransactionReview = exports.mergeTabSpecificLineItems = exports.getLineItemsByTransactionIdsFromLocalData = exports.getLineItemsByTransactionsIdsFromResponse = exports.checkIfAllLineItemsAreCategoryClassFilled = exports.setEntityRecommendationForLineIdInLocalData = exports.toSetAllLineItemsToCategoryClass = exports.toTransactionDetailLocalData = exports.shouldAutoSelectAndAdd = exports.MAX_SELECTION_LIMIT = exports.filterAutoTabLineItems = exports.removeTransactionFromTabView = exports.getPendingReviewLineIdsFromTransaction = void 0;
|
|
4
4
|
const vendorTransaction_1 = require("../../../entity/transaction/stateTypes/vendorTransaction");
|
|
5
5
|
const transactionDetailLocalDataHelper_1 = require("../../transactionDetail/transactionDetailLocalDataHelper");
|
|
6
6
|
const transactionDetailLocalDataHelper_2 = require("../../transactionDetail/transactionDetailLocalDataHelper");
|
|
@@ -781,3 +781,207 @@ const hasTransactionLocalDataChanges = (transaction, transactionReviewLocalData)
|
|
|
781
781
|
return false;
|
|
782
782
|
};
|
|
783
783
|
exports.hasTransactionLocalDataChanges = hasTransactionLocalDataChanges;
|
|
784
|
+
// =========================================================================
|
|
785
|
+
// Apply-to-Empty-Lines helpers
|
|
786
|
+
//
|
|
787
|
+
// Drives the contextual "Apply <value> to <count> empty <field>" banner on
|
|
788
|
+
// the Transaction Categorization List page (Pending Review tab). The banner
|
|
789
|
+
// triggers when the user fills in Category / Class / per-line Vendor on one
|
|
790
|
+
// line of a multi-line transaction; the helpers below compute which sibling
|
|
791
|
+
// lines are eligible (per-field, INDEPENDENT) and mutate only that field
|
|
792
|
+
// when the user clicks Apply.
|
|
793
|
+
//
|
|
794
|
+
// Empty-field detection mirrors the existing categorization auto-fill rules:
|
|
795
|
+
// - Category empty when `account.qboId == null` OR the account is one of
|
|
796
|
+
// the company's uncategorized accounts.
|
|
797
|
+
// - Class empty when `class.qboId == null` AND `class.classId == null`.
|
|
798
|
+
// - Vendor empty when the line carries no `lineEntity` / `vendor` /
|
|
799
|
+
// `customer`. Only `journal_entry` / `deposit` transactions surface
|
|
800
|
+
// a per-line vendor — for other transaction types vendor is
|
|
801
|
+
// transaction-level and the banner is not offered.
|
|
802
|
+
// =========================================================================
|
|
803
|
+
const PER_LINE_VENDOR_TRANSACTION_TYPES = [
|
|
804
|
+
'journal_entry',
|
|
805
|
+
'deposit',
|
|
806
|
+
];
|
|
807
|
+
/**
|
|
808
|
+
* Returns true iff the *specific field* is empty on this line. The three
|
|
809
|
+
* fields are evaluated INDEPENDENTLY — eligibility for a Category Apply
|
|
810
|
+
* depends solely on the line's category emptiness, irrespective of class
|
|
811
|
+
* / vendor on the same line.
|
|
812
|
+
*/
|
|
813
|
+
const isLineFieldEmpty = (line, field, transactionType, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled = false) => {
|
|
814
|
+
switch (field) {
|
|
815
|
+
case 'category': {
|
|
816
|
+
const categoryId = line.account?.qboId ?? line.account?.accountId;
|
|
817
|
+
if (categoryId == null) {
|
|
818
|
+
return true;
|
|
819
|
+
}
|
|
820
|
+
if (uncategorizedAccounts == null) {
|
|
821
|
+
return false;
|
|
822
|
+
}
|
|
823
|
+
return (0, transactionDetailLocalDataHelper_2.isAccountUncategorized)(uncategorizedAccounts, categoryId, isUncategorizedExpenseCategoryEnabled === true ? ['income'] : undefined);
|
|
824
|
+
}
|
|
825
|
+
case 'class': {
|
|
826
|
+
// Class has no separate "uncategorized" concept — empty iff both
|
|
827
|
+
// candidate ids are missing. Mirrors the existing auto-fill check
|
|
828
|
+
// at L564 above (`record.class?.qboId == null`) plus the legacy
|
|
829
|
+
// detail-page emptiness convention (qboId OR classId).
|
|
830
|
+
return line.class?.qboId == null && line.class?.classId == null;
|
|
831
|
+
}
|
|
832
|
+
case 'vendor': {
|
|
833
|
+
if (transactionType == null ||
|
|
834
|
+
PER_LINE_VENDOR_TRANSACTION_TYPES.includes(transactionType) === false) {
|
|
835
|
+
// Vendor is transaction-scoped (header) for non-JE / non-deposit
|
|
836
|
+
// transactions, so per-line vendor emptiness is meaningless and
|
|
837
|
+
// we never offer the Apply banner there.
|
|
838
|
+
return false;
|
|
839
|
+
}
|
|
840
|
+
return (line.lineEntity == null && line.vendor == null && line.customer == null);
|
|
841
|
+
}
|
|
842
|
+
default:
|
|
843
|
+
return false;
|
|
844
|
+
}
|
|
845
|
+
};
|
|
846
|
+
exports.isLineFieldEmpty = isLineFieldEmpty;
|
|
847
|
+
/**
|
|
848
|
+
* Computes the eligible empty-line ids for a given field+transaction.
|
|
849
|
+
* Excludes the source line (the one the user edited) since the user
|
|
850
|
+
* already filled THAT line — the banner is about propagating to siblings.
|
|
851
|
+
*/
|
|
852
|
+
const computeEligibleEmptyLineIds = (localData, field, sourceLineId, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled = false) => {
|
|
853
|
+
const eligibleIds = [];
|
|
854
|
+
for (const lineId of localData.sortedLineItems) {
|
|
855
|
+
if (lineId === sourceLineId) {
|
|
856
|
+
continue;
|
|
857
|
+
}
|
|
858
|
+
const line = localData.lineItemById[lineId];
|
|
859
|
+
if (line == null) {
|
|
860
|
+
continue;
|
|
861
|
+
}
|
|
862
|
+
if ((0, exports.isLineFieldEmpty)(line, field, localData.transactionType, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled)) {
|
|
863
|
+
eligibleIds.push(lineId);
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
return eligibleIds;
|
|
867
|
+
};
|
|
868
|
+
/**
|
|
869
|
+
* Replaces (not merges) the apply-to-empty banner state on the local
|
|
870
|
+
* data. Called by the categorization watch handler whenever the user
|
|
871
|
+
* changes Category / Class / per-line Vendor on a line. Returns a fresh
|
|
872
|
+
* copy of the local data; if no sibling lines have the corresponding
|
|
873
|
+
* field empty, the banner is hidden by leaving `applyToEmptyState` null.
|
|
874
|
+
*/
|
|
875
|
+
const toSetLastEditedFieldForApplyToEmpty = (transactionLocalData, field, sourceLineId, value, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled = false) => {
|
|
876
|
+
const eligibleEmptyLineIds = computeEligibleEmptyLineIds(transactionLocalData, field, sourceLineId, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled);
|
|
877
|
+
if (eligibleEmptyLineIds.length === 0) {
|
|
878
|
+
// No siblings to fill — drop any prior banner so we don't leave a
|
|
879
|
+
// stale proposal up.
|
|
880
|
+
return {
|
|
881
|
+
...transactionLocalData,
|
|
882
|
+
applyToEmptyState: null,
|
|
883
|
+
};
|
|
884
|
+
}
|
|
885
|
+
const next = {
|
|
886
|
+
field,
|
|
887
|
+
sourceLineId,
|
|
888
|
+
valueLabel: value.valueLabel,
|
|
889
|
+
eligibleEmptyLineIds,
|
|
890
|
+
account: value.account,
|
|
891
|
+
classBase: value.classBase,
|
|
892
|
+
entity: value.entity,
|
|
893
|
+
};
|
|
894
|
+
return {
|
|
895
|
+
...transactionLocalData,
|
|
896
|
+
applyToEmptyState: next,
|
|
897
|
+
};
|
|
898
|
+
};
|
|
899
|
+
exports.toSetLastEditedFieldForApplyToEmpty = toSetLastEditedFieldForApplyToEmpty;
|
|
900
|
+
/**
|
|
901
|
+
* Mutates ONLY the banner's field on each line whose field is currently
|
|
902
|
+
* empty (re-checked against live state). Other lines and other fields are
|
|
903
|
+
* untouched. Mirrors the per-field, INDEPENDENT rule from the PRD.
|
|
904
|
+
*
|
|
905
|
+
* After applying, the banner state is cleared. Returns a fresh copy of
|
|
906
|
+
* the local data.
|
|
907
|
+
*/
|
|
908
|
+
const toApplyFieldToEmptyLines = (transactionLocalData, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled = false) => {
|
|
909
|
+
const state = transactionLocalData.applyToEmptyState;
|
|
910
|
+
if (state == null) {
|
|
911
|
+
return transactionLocalData;
|
|
912
|
+
}
|
|
913
|
+
const newLineItems = {};
|
|
914
|
+
for (const lineId of transactionLocalData.sortedLineItems) {
|
|
915
|
+
const line = transactionLocalData.lineItemById[lineId];
|
|
916
|
+
if (line == null) {
|
|
917
|
+
continue;
|
|
918
|
+
}
|
|
919
|
+
// Re-check emptiness against the current line state — the user could
|
|
920
|
+
// have manually filled some of these in between the set and apply.
|
|
921
|
+
if (lineId !== state.sourceLineId &&
|
|
922
|
+
state.eligibleEmptyLineIds.includes(lineId) &&
|
|
923
|
+
(0, exports.isLineFieldEmpty)(line, state.field, transactionLocalData.transactionType, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled)) {
|
|
924
|
+
const updated = { ...line };
|
|
925
|
+
switch (state.field) {
|
|
926
|
+
case 'category':
|
|
927
|
+
if (state.account != null) {
|
|
928
|
+
updated.account = state.account;
|
|
929
|
+
}
|
|
930
|
+
break;
|
|
931
|
+
case 'class':
|
|
932
|
+
if (state.classBase != null) {
|
|
933
|
+
updated.class = state.classBase;
|
|
934
|
+
}
|
|
935
|
+
break;
|
|
936
|
+
case 'vendor':
|
|
937
|
+
if (state.entity != null) {
|
|
938
|
+
updated.lineEntity = state.entity;
|
|
939
|
+
// Mirror the legacy split-by-type behavior (see
|
|
940
|
+
// `setEntityRecommendationForLineIdInLocalData` -> entity
|
|
941
|
+
// shape). Keep `vendor` / `customer` legs in sync so
|
|
942
|
+
// downstream save flows that read either side stay correct.
|
|
943
|
+
if (state.entity.type === 'vendor') {
|
|
944
|
+
// VendorBase has {id, name, logo?} — no qboId field.
|
|
945
|
+
updated.vendor = {
|
|
946
|
+
id: state.entity.id,
|
|
947
|
+
name: state.entity.name,
|
|
948
|
+
logo: state.entity.logo,
|
|
949
|
+
};
|
|
950
|
+
updated.customer = undefined;
|
|
951
|
+
}
|
|
952
|
+
else if (state.entity.type === 'customer') {
|
|
953
|
+
updated.customer = {
|
|
954
|
+
id: state.entity.id,
|
|
955
|
+
name: state.entity.name,
|
|
956
|
+
logo: state.entity.logo,
|
|
957
|
+
qboId: state.entity.qboId,
|
|
958
|
+
};
|
|
959
|
+
updated.vendor = undefined;
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
break;
|
|
963
|
+
default:
|
|
964
|
+
break;
|
|
965
|
+
}
|
|
966
|
+
newLineItems[lineId] = updated;
|
|
967
|
+
}
|
|
968
|
+
else {
|
|
969
|
+
newLineItems[lineId] = line;
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
return {
|
|
973
|
+
...transactionLocalData,
|
|
974
|
+
lineItemById: newLineItems,
|
|
975
|
+
applyToEmptyState: null,
|
|
976
|
+
};
|
|
977
|
+
};
|
|
978
|
+
exports.toApplyFieldToEmptyLines = toApplyFieldToEmptyLines;
|
|
979
|
+
/**
|
|
980
|
+
* Clears the apply-to-empty banner state. Used by Dismiss as well as on
|
|
981
|
+
* save / discard / transaction-context-change.
|
|
982
|
+
*/
|
|
983
|
+
const toClearApplyToEmpty = (transactionLocalData) => ({
|
|
984
|
+
...transactionLocalData,
|
|
985
|
+
applyToEmptyState: null,
|
|
986
|
+
});
|
|
987
|
+
exports.toClearApplyToEmpty = toClearApplyToEmpty;
|
|
@@ -14,7 +14,7 @@ import { ZeniAPIStatus } from '../../../responsePayload';
|
|
|
14
14
|
import { UncategorizedAccounts } from '../../accountList/accountListSelector';
|
|
15
15
|
import { UpdateTransactionCategorizationResponsePayload } from '../payload/transactionCategorizationPayload';
|
|
16
16
|
import { TransactionFilters } from '../transactionFilterHelpers';
|
|
17
|
-
import { SupportedTransactionCategorization, TransactionSaveUpdates, TransactionsTab, TransactionsTabViewState, TransactionsViewState, TransactionsViewUIState } from '../types/transactionsViewState';
|
|
17
|
+
import { ApplyToEmptyFieldType, SupportedTransactionCategorization, TransactionSaveUpdates, TransactionsTab, TransactionsTabViewState, TransactionsViewState, TransactionsViewUIState } from '../types/transactionsViewState';
|
|
18
18
|
export declare const initialTransactionTabViewState: TransactionsTabViewState;
|
|
19
19
|
export declare const initialState: TransactionsViewState;
|
|
20
20
|
export declare const fetchTransactionCategorization: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedTab: "review" | "autoCategorized", period: TimePeriod, cacheOverride?: any, keepExistingListItems?: any, searchString?: string | undefined, pageToken?: PageToken | undefined, refreshViewInBackground?: any, resetListItems?: boolean | undefined, isUncategorizedExpenseCategoryEnabled?: boolean | undefined], {
|
|
@@ -197,6 +197,32 @@ export declare const fetchTransactionCategorization: import("@reduxjs/toolkit").
|
|
|
197
197
|
selectedTab: "review" | "autoCategorized";
|
|
198
198
|
transactionPayload: SupportedTransactionPayload;
|
|
199
199
|
updateType: UpdateType;
|
|
200
|
-
}, "expenseAutomationTransactionsView/uploadTransactionCategorizationReceiptSuccess", never, never
|
|
200
|
+
}, "expenseAutomationTransactionsView/uploadTransactionCategorizationReceiptSuccess", never, never>, setLastEditedFieldForApplyToEmptyForCategorization: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedTab: "review" | "autoCategorized", transactionId: string, field: ApplyToEmptyFieldType, sourceLineId: string, value: {
|
|
201
|
+
valueLabel: string;
|
|
202
|
+
account?: AccountBase;
|
|
203
|
+
classBase?: ClassBase;
|
|
204
|
+
entity?: Entity;
|
|
205
|
+
}, uncategorizedAccounts?: UncategorizedAccounts | undefined, isUncategorizedExpenseCategoryEnabled?: boolean | undefined], {
|
|
206
|
+
selectedTab: "review" | "autoCategorized";
|
|
207
|
+
transactionId: string;
|
|
208
|
+
field: ApplyToEmptyFieldType;
|
|
209
|
+
sourceLineId: string;
|
|
210
|
+
value: {
|
|
211
|
+
valueLabel: string;
|
|
212
|
+
account?: AccountBase;
|
|
213
|
+
classBase?: ClassBase;
|
|
214
|
+
entity?: Entity;
|
|
215
|
+
};
|
|
216
|
+
uncategorizedAccounts: UncategorizedAccounts | undefined;
|
|
217
|
+
isUncategorizedExpenseCategoryEnabled: boolean | undefined;
|
|
218
|
+
}, "expenseAutomationTransactionsView/setLastEditedFieldForApplyToEmptyForCategorization", never, never>, applyFieldToEmptyLinesForCategorization: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedTab: "review" | "autoCategorized", transactionId: string, uncategorizedAccounts?: UncategorizedAccounts | undefined, isUncategorizedExpenseCategoryEnabled?: boolean | undefined], {
|
|
219
|
+
selectedTab: "review" | "autoCategorized";
|
|
220
|
+
transactionId: string;
|
|
221
|
+
uncategorizedAccounts: UncategorizedAccounts | undefined;
|
|
222
|
+
isUncategorizedExpenseCategoryEnabled: boolean | undefined;
|
|
223
|
+
}, "expenseAutomationTransactionsView/applyFieldToEmptyLinesForCategorization", never, never>, clearLastEditedFieldForApplyToEmptyForCategorization: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedTab: "review" | "autoCategorized", transactionId: string], {
|
|
224
|
+
selectedTab: "review" | "autoCategorized";
|
|
225
|
+
transactionId: string;
|
|
226
|
+
}, "expenseAutomationTransactionsView/clearLastEditedFieldForApplyToEmptyForCategorization", never, never>;
|
|
201
227
|
declare const _default: import("redux").Reducer<TransactionsViewState>;
|
|
202
228
|
export default _default;
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
var _a;
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.uploadTransactionCategorizationReceiptSuccess = exports.updateTransactionCategorizationUploadReceiptState = exports.removeTransactionFromAllTabs = exports.backgroundRefetchReviewTab = exports.syncTransactionCategorizationFromDetailSave = exports.updateSelectedTransactionId = exports.markCategoryClassRecommendationsFailureForCategorization = exports.markCategoryClassRecommendationsCompletedForCategorization = exports.markCategoryClassRecommendationsInProgressForCategorization = exports.setEntityRecommendationForLineIdsForCategorization = exports.clearExpenseAutomationTransactionsView = exports.clearExpenseAutomationTransactionsViewPerTabView = exports.updateSelectedCheckboxTransactionIds = exports.fetchTransactionCategorizationView = exports.resetOtherTabsFetchState = exports.fetchTransactionCategorizationSuccess = exports.updateParentTotalCountForTab = exports.updateTotalCountForTransactionCategorization = exports.setAllItemsToCategoryClassInLocalDataForCategorization = exports.updateSelectedCustomerForTransaction = exports.updateSelectedVendorForTransaction = exports.updateStatusForTransactionNotMiscategorizedUpdateForCategorization = exports.markTransactionAsNotMiscategorized = exports.updateTransactionCategorizationSaveStatus = exports.updateTransactionCategorizationCompletedSubTab = exports.updateCurrentSelectedTransactionCategorizationTab = exports.updateTransactionCategorization = exports.saveTransactionCategorization = exports.fetchTransactionCategorizationFailure = exports.saveTransactionCategorizationLocalData = exports.initializeTransactionCategorizationViewLocalData = exports.updateTransactionFilters = exports.updateTransactionCategorizationUIState = exports.fetchTransactionCategorization = exports.initialState = exports.initialTransactionTabViewState = void 0;
|
|
7
|
+
exports.clearLastEditedFieldForApplyToEmptyForCategorization = exports.applyFieldToEmptyLinesForCategorization = exports.setLastEditedFieldForApplyToEmptyForCategorization = exports.uploadTransactionCategorizationReceiptSuccess = exports.updateTransactionCategorizationUploadReceiptState = exports.removeTransactionFromAllTabs = exports.backgroundRefetchReviewTab = exports.syncTransactionCategorizationFromDetailSave = exports.updateSelectedTransactionId = exports.markCategoryClassRecommendationsFailureForCategorization = exports.markCategoryClassRecommendationsCompletedForCategorization = exports.markCategoryClassRecommendationsInProgressForCategorization = exports.setEntityRecommendationForLineIdsForCategorization = exports.clearExpenseAutomationTransactionsView = exports.clearExpenseAutomationTransactionsViewPerTabView = exports.updateSelectedCheckboxTransactionIds = exports.fetchTransactionCategorizationView = exports.resetOtherTabsFetchState = exports.fetchTransactionCategorizationSuccess = exports.updateParentTotalCountForTab = exports.updateTotalCountForTransactionCategorization = exports.setAllItemsToCategoryClassInLocalDataForCategorization = exports.updateSelectedCustomerForTransaction = exports.updateSelectedVendorForTransaction = exports.updateStatusForTransactionNotMiscategorizedUpdateForCategorization = exports.markTransactionAsNotMiscategorized = exports.updateTransactionCategorizationSaveStatus = exports.updateTransactionCategorizationCompletedSubTab = exports.updateCurrentSelectedTransactionCategorizationTab = exports.updateTransactionCategorization = exports.saveTransactionCategorization = exports.fetchTransactionCategorizationFailure = exports.saveTransactionCategorizationLocalData = exports.initializeTransactionCategorizationViewLocalData = exports.updateTransactionFilters = exports.updateTransactionCategorizationUIState = exports.fetchTransactionCategorization = exports.initialState = exports.initialTransactionTabViewState = void 0;
|
|
8
8
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
9
9
|
const get_1 = __importDefault(require("lodash/get"));
|
|
10
10
|
const uniq_1 = __importDefault(require("lodash/uniq"));
|
|
@@ -1059,7 +1059,101 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
1059
1059
|
}
|
|
1060
1060
|
},
|
|
1061
1061
|
},
|
|
1062
|
+
/**
|
|
1063
|
+
* Records the user's most-recent Category / Class / per-line Vendor
|
|
1064
|
+
* edit on a multi-line transaction, computes the sibling lines whose
|
|
1065
|
+
* SAME field is currently empty, and stores the result on
|
|
1066
|
+
* `applyToEmptyState`. The categorization list row reads that state
|
|
1067
|
+
* to render the "Apply <value> to <count> empty <field>" banner.
|
|
1068
|
+
*/
|
|
1069
|
+
setLastEditedFieldForApplyToEmptyForCategorization: {
|
|
1070
|
+
prepare(selectedTab, transactionId, field, sourceLineId, value, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled) {
|
|
1071
|
+
return {
|
|
1072
|
+
payload: {
|
|
1073
|
+
selectedTab,
|
|
1074
|
+
transactionId,
|
|
1075
|
+
field,
|
|
1076
|
+
sourceLineId,
|
|
1077
|
+
value,
|
|
1078
|
+
uncategorizedAccounts,
|
|
1079
|
+
isUncategorizedExpenseCategoryEnabled,
|
|
1080
|
+
},
|
|
1081
|
+
};
|
|
1082
|
+
},
|
|
1083
|
+
reducer(draft, action) {
|
|
1084
|
+
const { selectedTab, transactionId, field, sourceLineId, value, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled, } = action.payload;
|
|
1085
|
+
const transactionLocalData = (0, get_1.default)(draft.transactionCategorizationView[selectedTab]
|
|
1086
|
+
.transactionReviewLocalDataById, transactionId, undefined);
|
|
1087
|
+
if (transactionLocalData == null) {
|
|
1088
|
+
return;
|
|
1089
|
+
}
|
|
1090
|
+
const next = (0, transactionCategorizationLocalDataHelper_1.toSetLastEditedFieldForApplyToEmpty)(transactionLocalData.transactionReviewLocalData, field, sourceLineId, value, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled);
|
|
1091
|
+
draft.transactionCategorizationView[selectedTab].transactionReviewLocalDataById[transactionId] = {
|
|
1092
|
+
transactionId,
|
|
1093
|
+
transactionReviewLocalData: next,
|
|
1094
|
+
};
|
|
1095
|
+
},
|
|
1096
|
+
},
|
|
1097
|
+
/**
|
|
1098
|
+
* Applies the value tracked in `applyToEmptyState` to the eligible
|
|
1099
|
+
* empty lines (re-checked at apply time) and clears the banner. Only
|
|
1100
|
+
* the banner's field is mutated — every other field on those lines
|
|
1101
|
+
* is preserved.
|
|
1102
|
+
*/
|
|
1103
|
+
applyFieldToEmptyLinesForCategorization: {
|
|
1104
|
+
prepare(selectedTab, transactionId, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled) {
|
|
1105
|
+
return {
|
|
1106
|
+
payload: {
|
|
1107
|
+
selectedTab,
|
|
1108
|
+
transactionId,
|
|
1109
|
+
uncategorizedAccounts,
|
|
1110
|
+
isUncategorizedExpenseCategoryEnabled,
|
|
1111
|
+
},
|
|
1112
|
+
};
|
|
1113
|
+
},
|
|
1114
|
+
reducer(draft, action) {
|
|
1115
|
+
const { selectedTab, transactionId, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled, } = action.payload;
|
|
1116
|
+
const transactionLocalData = (0, get_1.default)(draft.transactionCategorizationView[selectedTab]
|
|
1117
|
+
.transactionReviewLocalDataById, transactionId, undefined);
|
|
1118
|
+
if (transactionLocalData == null) {
|
|
1119
|
+
return;
|
|
1120
|
+
}
|
|
1121
|
+
const next = (0, transactionCategorizationLocalDataHelper_1.toApplyFieldToEmptyLines)(transactionLocalData.transactionReviewLocalData, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled);
|
|
1122
|
+
draft.transactionCategorizationView[selectedTab].transactionReviewLocalDataById[transactionId] = {
|
|
1123
|
+
transactionId,
|
|
1124
|
+
transactionReviewLocalData: next,
|
|
1125
|
+
};
|
|
1126
|
+
// Mark the transaction dirty so the existing Save flow picks up
|
|
1127
|
+
// the propagated edits.
|
|
1128
|
+
const dirtyIds = draft.transactionCategorizationView[selectedTab]
|
|
1129
|
+
.transactionIdsWithUnsavedData;
|
|
1130
|
+
if (dirtyIds.includes(transactionId) === false) {
|
|
1131
|
+
dirtyIds.push(transactionId);
|
|
1132
|
+
}
|
|
1133
|
+
},
|
|
1134
|
+
},
|
|
1135
|
+
/**
|
|
1136
|
+
* Clears the apply-to-empty banner state. Used by Dismiss and any
|
|
1137
|
+
* transaction-context change (save / discard / unmount).
|
|
1138
|
+
*/
|
|
1139
|
+
clearLastEditedFieldForApplyToEmptyForCategorization: {
|
|
1140
|
+
prepare(selectedTab, transactionId) {
|
|
1141
|
+
return { payload: { selectedTab, transactionId } };
|
|
1142
|
+
},
|
|
1143
|
+
reducer(draft, action) {
|
|
1144
|
+
const { selectedTab, transactionId } = action.payload;
|
|
1145
|
+
const transactionLocalData = (0, get_1.default)(draft.transactionCategorizationView[selectedTab]
|
|
1146
|
+
.transactionReviewLocalDataById, transactionId, undefined);
|
|
1147
|
+
if (transactionLocalData == null) {
|
|
1148
|
+
return;
|
|
1149
|
+
}
|
|
1150
|
+
draft.transactionCategorizationView[selectedTab].transactionReviewLocalDataById[transactionId] = {
|
|
1151
|
+
transactionId,
|
|
1152
|
+
transactionReviewLocalData: (0, transactionCategorizationLocalDataHelper_1.toClearApplyToEmpty)(transactionLocalData.transactionReviewLocalData),
|
|
1153
|
+
};
|
|
1154
|
+
},
|
|
1155
|
+
},
|
|
1062
1156
|
},
|
|
1063
1157
|
});
|
|
1064
|
-
_a = expenseAutomationTransactionsView.actions, exports.fetchTransactionCategorization = _a.fetchTransactionCategorization, exports.updateTransactionCategorizationUIState = _a.updateTransactionCategorizationUIState, exports.updateTransactionFilters = _a.updateTransactionFilters, exports.initializeTransactionCategorizationViewLocalData = _a.initializeTransactionCategorizationViewLocalData, exports.saveTransactionCategorizationLocalData = _a.saveTransactionCategorizationLocalData, exports.fetchTransactionCategorizationFailure = _a.fetchTransactionCategorizationFailure, exports.saveTransactionCategorization = _a.saveTransactionCategorization, exports.updateTransactionCategorization = _a.updateTransactionCategorization, exports.updateCurrentSelectedTransactionCategorizationTab = _a.updateCurrentSelectedTransactionCategorizationTab, exports.updateTransactionCategorizationCompletedSubTab = _a.updateTransactionCategorizationCompletedSubTab, exports.updateTransactionCategorizationSaveStatus = _a.updateTransactionCategorizationSaveStatus, exports.markTransactionAsNotMiscategorized = _a.markTransactionAsNotMiscategorized, exports.updateStatusForTransactionNotMiscategorizedUpdateForCategorization = _a.updateStatusForTransactionNotMiscategorizedUpdateForCategorization, exports.updateSelectedVendorForTransaction = _a.updateSelectedVendorForTransaction, exports.updateSelectedCustomerForTransaction = _a.updateSelectedCustomerForTransaction, exports.setAllItemsToCategoryClassInLocalDataForCategorization = _a.setAllItemsToCategoryClassInLocalDataForCategorization, exports.updateTotalCountForTransactionCategorization = _a.updateTotalCountForTransactionCategorization, exports.updateParentTotalCountForTab = _a.updateParentTotalCountForTab, exports.fetchTransactionCategorizationSuccess = _a.fetchTransactionCategorizationSuccess, exports.resetOtherTabsFetchState = _a.resetOtherTabsFetchState, exports.fetchTransactionCategorizationView = _a.fetchTransactionCategorizationView, exports.updateSelectedCheckboxTransactionIds = _a.updateSelectedCheckboxTransactionIds, exports.clearExpenseAutomationTransactionsViewPerTabView = _a.clearExpenseAutomationTransactionsViewPerTabView, exports.clearExpenseAutomationTransactionsView = _a.clearExpenseAutomationTransactionsView, exports.setEntityRecommendationForLineIdsForCategorization = _a.setEntityRecommendationForLineIdsForCategorization, exports.markCategoryClassRecommendationsInProgressForCategorization = _a.markCategoryClassRecommendationsInProgressForCategorization, exports.markCategoryClassRecommendationsCompletedForCategorization = _a.markCategoryClassRecommendationsCompletedForCategorization, exports.markCategoryClassRecommendationsFailureForCategorization = _a.markCategoryClassRecommendationsFailureForCategorization, exports.updateSelectedTransactionId = _a.updateSelectedTransactionId, exports.syncTransactionCategorizationFromDetailSave = _a.syncTransactionCategorizationFromDetailSave, exports.backgroundRefetchReviewTab = _a.backgroundRefetchReviewTab, exports.removeTransactionFromAllTabs = _a.removeTransactionFromAllTabs, exports.updateTransactionCategorizationUploadReceiptState = _a.updateTransactionCategorizationUploadReceiptState, exports.uploadTransactionCategorizationReceiptSuccess = _a.uploadTransactionCategorizationReceiptSuccess;
|
|
1158
|
+
_a = expenseAutomationTransactionsView.actions, exports.fetchTransactionCategorization = _a.fetchTransactionCategorization, exports.updateTransactionCategorizationUIState = _a.updateTransactionCategorizationUIState, exports.updateTransactionFilters = _a.updateTransactionFilters, exports.initializeTransactionCategorizationViewLocalData = _a.initializeTransactionCategorizationViewLocalData, exports.saveTransactionCategorizationLocalData = _a.saveTransactionCategorizationLocalData, exports.fetchTransactionCategorizationFailure = _a.fetchTransactionCategorizationFailure, exports.saveTransactionCategorization = _a.saveTransactionCategorization, exports.updateTransactionCategorization = _a.updateTransactionCategorization, exports.updateCurrentSelectedTransactionCategorizationTab = _a.updateCurrentSelectedTransactionCategorizationTab, exports.updateTransactionCategorizationCompletedSubTab = _a.updateTransactionCategorizationCompletedSubTab, exports.updateTransactionCategorizationSaveStatus = _a.updateTransactionCategorizationSaveStatus, exports.markTransactionAsNotMiscategorized = _a.markTransactionAsNotMiscategorized, exports.updateStatusForTransactionNotMiscategorizedUpdateForCategorization = _a.updateStatusForTransactionNotMiscategorizedUpdateForCategorization, exports.updateSelectedVendorForTransaction = _a.updateSelectedVendorForTransaction, exports.updateSelectedCustomerForTransaction = _a.updateSelectedCustomerForTransaction, exports.setAllItemsToCategoryClassInLocalDataForCategorization = _a.setAllItemsToCategoryClassInLocalDataForCategorization, exports.updateTotalCountForTransactionCategorization = _a.updateTotalCountForTransactionCategorization, exports.updateParentTotalCountForTab = _a.updateParentTotalCountForTab, exports.fetchTransactionCategorizationSuccess = _a.fetchTransactionCategorizationSuccess, exports.resetOtherTabsFetchState = _a.resetOtherTabsFetchState, exports.fetchTransactionCategorizationView = _a.fetchTransactionCategorizationView, exports.updateSelectedCheckboxTransactionIds = _a.updateSelectedCheckboxTransactionIds, exports.clearExpenseAutomationTransactionsViewPerTabView = _a.clearExpenseAutomationTransactionsViewPerTabView, exports.clearExpenseAutomationTransactionsView = _a.clearExpenseAutomationTransactionsView, exports.setEntityRecommendationForLineIdsForCategorization = _a.setEntityRecommendationForLineIdsForCategorization, exports.markCategoryClassRecommendationsInProgressForCategorization = _a.markCategoryClassRecommendationsInProgressForCategorization, exports.markCategoryClassRecommendationsCompletedForCategorization = _a.markCategoryClassRecommendationsCompletedForCategorization, exports.markCategoryClassRecommendationsFailureForCategorization = _a.markCategoryClassRecommendationsFailureForCategorization, exports.updateSelectedTransactionId = _a.updateSelectedTransactionId, exports.syncTransactionCategorizationFromDetailSave = _a.syncTransactionCategorizationFromDetailSave, exports.backgroundRefetchReviewTab = _a.backgroundRefetchReviewTab, exports.removeTransactionFromAllTabs = _a.removeTransactionFromAllTabs, exports.updateTransactionCategorizationUploadReceiptState = _a.updateTransactionCategorizationUploadReceiptState, exports.uploadTransactionCategorizationReceiptSuccess = _a.uploadTransactionCategorizationReceiptSuccess, exports.setLastEditedFieldForApplyToEmptyForCategorization = _a.setLastEditedFieldForApplyToEmptyForCategorization, exports.applyFieldToEmptyLinesForCategorization = _a.applyFieldToEmptyLinesForCategorization, exports.clearLastEditedFieldForApplyToEmptyForCategorization = _a.clearLastEditedFieldForApplyToEmptyForCategorization;
|
|
1065
1159
|
exports.default = expenseAutomationTransactionsView.reducer;
|
|
@@ -64,10 +64,49 @@ export interface TransactionCategorizationLineItemData extends TransactionLineBa
|
|
|
64
64
|
selectedEntityLine?: Entity;
|
|
65
65
|
vendor?: VendorBase;
|
|
66
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Field types eligible for the "Apply to Empty Lines" banner on the
|
|
69
|
+
* Transaction Categorization List page. Mirrors PRD scope: Category,
|
|
70
|
+
* Class, Vendor — Project is intentionally excluded (matches the
|
|
71
|
+
* existing categorization auto-fill which also skips Project).
|
|
72
|
+
*/
|
|
73
|
+
export type ApplyToEmptyFieldType = 'category' | 'class' | 'vendor';
|
|
74
|
+
/**
|
|
75
|
+
* State driving the contextual "Apply <value> to <count> empty <field>
|
|
76
|
+
* fields" banner under a multi-line transaction in the categorization
|
|
77
|
+
* list. Populated by the watch handler whenever the user changes
|
|
78
|
+
* Category / Class / per-line Vendor; cleared on Apply / Dismiss / save.
|
|
79
|
+
*
|
|
80
|
+
* `eligibleEmptyLineIds` is recomputed on every set so the count in the
|
|
81
|
+
* banner copy stays in sync with the line item state. `field` identifies
|
|
82
|
+
* which of the three fields was edited; emptiness is evaluated
|
|
83
|
+
* INDEPENDENTLY per field (a line is eligible for a Category Apply iff
|
|
84
|
+
* its Category is empty, irrespective of Class / Vendor).
|
|
85
|
+
*/
|
|
86
|
+
export interface ApplyToEmptyState {
|
|
87
|
+
eligibleEmptyLineIds: ID[];
|
|
88
|
+
field: ApplyToEmptyFieldType;
|
|
89
|
+
/** Display label for the value (e.g. "Fixed Assets - Computer"). */
|
|
90
|
+
valueLabel: string;
|
|
91
|
+
/** id of the line that triggered the banner (the user-edited line). */
|
|
92
|
+
sourceLineId?: ID;
|
|
93
|
+
/** Account selected by the user (category Apply). */
|
|
94
|
+
account?: AccountBase;
|
|
95
|
+
/** Class selected by the user (class Apply). */
|
|
96
|
+
classBase?: ClassBase;
|
|
97
|
+
/** Entity selected by the user (per-line vendor Apply, JE/deposit). */
|
|
98
|
+
entity?: Entity;
|
|
99
|
+
}
|
|
67
100
|
export interface TransactionReviewLocalData {
|
|
68
101
|
lineItemById: Record<ID, TransactionCategorizationLineItemData>;
|
|
69
102
|
sortedLineItems: ID[];
|
|
70
103
|
tabSpecificLineItems: TabSpecificLineItems;
|
|
104
|
+
/**
|
|
105
|
+
* Transient banner state for the "Apply to Empty Lines" CTA. `null` /
|
|
106
|
+
* undefined means "no banner". Replaced (not merged) on every new edit
|
|
107
|
+
* so only the latest value-change is offered for propagation.
|
|
108
|
+
*/
|
|
109
|
+
applyToEmptyState?: ApplyToEmptyState | null;
|
|
71
110
|
customer?: CustomerBase;
|
|
72
111
|
customerDetails?: {
|
|
73
112
|
id: ID;
|
|
@@ -2,6 +2,6 @@ import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { RootState } from '../../../../../reducer';
|
|
4
4
|
import { ZeniAPI } from '../../../../../zeniAPI';
|
|
5
|
-
import { fetchInternationalVerificationForm, updateInternationalVerificationForm, updateVerificationFormFailure
|
|
6
|
-
export type ActionType = ReturnType<typeof fetchInternationalVerificationForm> | ReturnType<typeof updateInternationalVerificationForm> | ReturnType<typeof updateVerificationFormFailure> | ReturnType<typeof
|
|
7
|
-
export declare const fetchIntlVerificationFormEpic: (actions$: ActionsObservable<ActionType>,
|
|
5
|
+
import { fetchInternationalVerificationForm, initializeIntlVerificationForm, updateInternationalVerificationForm, updateVerificationFormFailure } from '../internationalWireVerificationReducer';
|
|
6
|
+
export type ActionType = ReturnType<typeof fetchInternationalVerificationForm> | ReturnType<typeof updateInternationalVerificationForm> | ReturnType<typeof updateVerificationFormFailure> | ReturnType<typeof initializeIntlVerificationForm>;
|
|
7
|
+
export declare const fetchIntlVerificationFormEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -4,9 +4,8 @@ exports.fetchIntlVerificationFormEpic = void 0;
|
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const responsePayload_1 = require("../../../../../responsePayload");
|
|
7
|
-
const internationalWireOnboardingDetailsToLocalData_1 = require("../internationalWireOnboardingDetailsToLocalData");
|
|
8
7
|
const internationalWireVerificationReducer_1 = require("../internationalWireVerificationReducer");
|
|
9
|
-
const fetchIntlVerificationFormEpic = (actions$,
|
|
8
|
+
const fetchIntlVerificationFormEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(internationalWireVerificationReducer_1.fetchInternationalVerificationForm.match), (0, operators_1.switchMap)((action) => {
|
|
10
9
|
const query = {
|
|
11
10
|
region: 'US',
|
|
12
11
|
legal_type: 'BUSINESS',
|
|
@@ -15,14 +14,11 @@ const fetchIntlVerificationFormEpic = (actions$, state$, zeniAPI) => actions$.pi
|
|
|
15
14
|
.getJSON(`${zeniAPI.apiEndPoints.payMicroServiceBaseUrl}/1.0/international-wire/onboarding-fields?query=${encodeURIComponent(JSON.stringify(query))}`)
|
|
16
15
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
17
16
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
18
|
-
const onboardingDataFromCompanyInfo = state$.value.companyState.companiesById[action.payload.companyId]
|
|
19
|
-
?.companyBillPayInfo?.internationalWireOnboardingDetails;
|
|
20
|
-
const localData = (0, internationalWireOnboardingDetailsToLocalData_1.toVerificationFormLocalDataFromOnboardingDetails)(onboardingDataFromCompanyInfo, response.data.labels);
|
|
21
17
|
return (0, rxjs_1.from)([
|
|
22
18
|
(0, internationalWireVerificationReducer_1.updateInternationalVerificationForm)({
|
|
23
19
|
internationalWireFormPayload: response.data.labels,
|
|
24
20
|
}),
|
|
25
|
-
(0, internationalWireVerificationReducer_1.
|
|
21
|
+
(0, internationalWireVerificationReducer_1.initializeIntlVerificationForm)(action.payload.companyId, response.data.labels),
|
|
26
22
|
]);
|
|
27
23
|
}
|
|
28
24
|
else {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { RootState } from '../../../../../reducer';
|
|
4
|
-
import { fetchBillPaySetupViewSuccess } from '../../billPaySetupView/billPaySetupViewReducer';
|
|
5
4
|
import { initializeIntlVerificationForm, updateVerificationFormLocalData } from '../internationalWireVerificationReducer';
|
|
6
5
|
export type ActionType = ReturnType<typeof updateVerificationFormLocalData> | ReturnType<typeof initializeIntlVerificationForm>;
|
|
7
|
-
export declare const initializeIntlVerificationFormEpic: (actions$: ActionsObservable<ActionType
|
|
6
|
+
export declare const initializeIntlVerificationFormEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
|
@@ -3,40 +3,41 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.initializeIntlVerificationFormEpic = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const tenantSelector_1 = require("../../../../../entity/tenant/tenantSelector");
|
|
7
|
-
const billPaySetupViewReducer_1 = require("../../billPaySetupView/billPaySetupViewReducer");
|
|
8
|
-
const internationalWireOnboardingDetailsToLocalData_1 = require("../internationalWireOnboardingDetailsToLocalData");
|
|
9
6
|
const internationalWireVerificationReducer_1 = require("../internationalWireVerificationReducer");
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
billPaySetupViewReducer_1.fetchBillPaySetupViewSuccess.match(action)), (0, operators_1.mergeMap)((action) => {
|
|
7
|
+
const initializeIntlVerificationFormEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(internationalWireVerificationReducer_1.initializeIntlVerificationForm.match), (0, operators_1.mergeMap)((action) => {
|
|
8
|
+
const { companyId, internationalWireFormPayload } = action.payload;
|
|
9
|
+
const actions = [];
|
|
14
10
|
const state = state$.value;
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
11
|
+
const onboardingDataFromCompanyInfo = state.companyState.companiesById[companyId].companyBillPayInfo
|
|
12
|
+
.internationalWireOnboardingDetails;
|
|
13
|
+
const localData = {};
|
|
14
|
+
Object.keys(internationalWireFormPayload).forEach((formFieldKey) => {
|
|
15
|
+
const values = onboardingDataFromCompanyInfo != null
|
|
16
|
+
? onboardingDataFromCompanyInfo[formFieldKey]?.values
|
|
17
|
+
: undefined;
|
|
18
|
+
if (values != null) {
|
|
19
|
+
localData[formFieldKey] =
|
|
20
|
+
internationalWireFormPayload[formFieldKey].type === 'enum'
|
|
21
|
+
? internationalWireFormPayload[formFieldKey]
|
|
22
|
+
.is_multiple_values_allowed === false
|
|
23
|
+
? typeof values[0] === 'object' && 'code' in values[0]
|
|
24
|
+
? values[0].code
|
|
25
|
+
: ''
|
|
26
|
+
: values.map((value) => typeof value === 'object' && 'code' in value
|
|
27
|
+
? value.code
|
|
28
|
+
: '')
|
|
29
|
+
: values[0];
|
|
33
30
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
31
|
+
else {
|
|
32
|
+
localData[formFieldKey] =
|
|
33
|
+
internationalWireFormPayload[formFieldKey].type === 'enum' &&
|
|
34
|
+
internationalWireFormPayload[formFieldKey]
|
|
35
|
+
.is_multiple_values_allowed === true
|
|
36
|
+
? []
|
|
37
|
+
: '';
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
actions.push((0, internationalWireVerificationReducer_1.updateVerificationFormLocalData)(localData));
|
|
41
|
+
return (0, rxjs_1.from)(actions);
|
|
41
42
|
}));
|
|
42
43
|
exports.initializeIntlVerificationFormEpic = initializeIntlVerificationFormEpic;
|
|
@@ -6,7 +6,6 @@ const operators_1 = require("rxjs/operators");
|
|
|
6
6
|
const companyReducer_1 = require("../../../../../entity/company/companyReducer");
|
|
7
7
|
const snackbarReducer_1 = require("../../../../../entity/snackbar/snackbarReducer");
|
|
8
8
|
const responsePayload_1 = require("../../../../../responsePayload");
|
|
9
|
-
const internationalWireVerificationSubmitPayload_1 = require("../internationalWireVerificationSubmitPayload");
|
|
10
9
|
const internationalWireVerificationReducer_1 = require("../internationalWireVerificationReducer");
|
|
11
10
|
const submitIntlVerificationEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(internationalWireVerificationReducer_1.submitInternationalVerificationForm.match), (0, operators_1.switchMap)((action) => {
|
|
12
11
|
const { internationalWireVerificationState } = state$.value;
|
|
@@ -14,7 +13,7 @@ const submitIntlVerificationEpic = (actions$, state$, zeniAPI) => actions$.pipe(
|
|
|
14
13
|
const localData = internationalWireVerificationState.verificationFormLocalData;
|
|
15
14
|
if (localData != null) {
|
|
16
15
|
return zeniAPI
|
|
17
|
-
.postAndGetJSON(`${zeniAPI.apiEndPoints.payMicroServiceBaseUrl}/1.0/international-wire/onboarding`, (
|
|
16
|
+
.postAndGetJSON(`${zeniAPI.apiEndPoints.payMicroServiceBaseUrl}/1.0/international-wire/onboarding`, toIntlWireVerificationPayload(localData))
|
|
18
17
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
19
18
|
const actions = [];
|
|
20
19
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
@@ -59,3 +58,9 @@ const submitIntlVerificationEpic = (actions$, state$, zeniAPI) => actions$.pipe(
|
|
|
59
58
|
}
|
|
60
59
|
}));
|
|
61
60
|
exports.submitIntlVerificationEpic = submitIntlVerificationEpic;
|
|
61
|
+
const toIntlWireVerificationPayload = (localData) => {
|
|
62
|
+
return {
|
|
63
|
+
is_applicant_declaration: true,
|
|
64
|
+
form_details: localData,
|
|
65
|
+
};
|
|
66
|
+
};
|
|
@@ -1,40 +1,17 @@
|
|
|
1
1
|
import { AllowedValueWithCode } from '../../../../commonStateTypes/allowedValue';
|
|
2
2
|
import { ZeniAPIResponse } from '../../../../responsePayload';
|
|
3
|
-
import { VerificationFormField
|
|
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
|
-
}
|
|
3
|
+
import { VerificationFormField } from './internationalWireVerificationState';
|
|
19
4
|
export interface FieldPayload {
|
|
20
5
|
label: string;
|
|
21
6
|
type: string;
|
|
22
|
-
default?: boolean;
|
|
23
7
|
field_hint_text?: string;
|
|
24
8
|
field_values?: {
|
|
25
9
|
code: string;
|
|
26
10
|
description: string;
|
|
27
11
|
}[];
|
|
28
|
-
is_multiple_options_supported?: boolean;
|
|
29
12
|
is_multiple_values_allowed?: boolean;
|
|
30
|
-
options?: Record<string, FieldOptionPayload>;
|
|
31
|
-
requirements?: string[];
|
|
32
|
-
subfields?: Record<string, SubFieldPayload>;
|
|
33
13
|
}
|
|
34
14
|
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[];
|
|
38
15
|
export type IntlVerificationFormResponse = ZeniAPIResponse<IntlVerificationFormPayload>;
|
|
39
16
|
export interface IntlVerificationFormPayload {
|
|
40
17
|
create_time: string;
|