@zeniai/client-epic-state 5.1.8-betaAS1 → 5.1.8-betaSS1

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.
Files changed (65) hide show
  1. package/lib/commonPayloadTypes/commonPayload.d.ts +4 -25
  2. package/lib/esm/index.js +3 -8
  3. package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -3
  4. package/lib/esm/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +4 -3
  5. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +12 -13
  6. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/backgroundRefetchReviewTabEpic.js +19 -3
  7. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +19 -9
  8. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationViewEpic.js +2 -2
  9. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/markTransactionAsNotMiscategorizedEpic.js +13 -2
  10. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/saveTransactionCategorizationEpic.js +6 -2
  11. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/triggerReviewTabRefetchEpic.js +2 -2
  12. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/updateTransactionCategorizationEpic.js +6 -2
  13. package/lib/esm/view/expenseAutomationView/expenseAutomationViewReducer.js +20 -3
  14. package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +48 -8
  15. package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +5 -4
  16. package/lib/esm/view/spendManagement/billPay/internationalWireVerification/epics/fetchIntlVerificationFormEpic.js +3 -7
  17. package/lib/esm/view/spendManagement/billPay/internationalWireVerification/epics/initializeIntlVerificationFormEpic.js +34 -33
  18. package/lib/esm/view/spendManagement/billPay/internationalWireVerification/epics/submitIntlVerificationEpic.js +7 -2
  19. package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationPayload.js +8 -55
  20. package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationReducer.js +6 -5
  21. package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSelector.js +15 -39
  22. package/lib/index.d.ts +4 -10
  23. package/lib/index.js +30 -47
  24. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -3
  25. package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +4 -3
  26. package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.d.ts +0 -6
  27. package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +13 -14
  28. package/lib/view/expenseAutomationView/epics/transactionCategorization/backgroundRefetchReviewTabEpic.js +19 -3
  29. package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +19 -9
  30. package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationViewEpic.js +2 -2
  31. package/lib/view/expenseAutomationView/epics/transactionCategorization/markTransactionAsNotMiscategorizedEpic.js +13 -2
  32. package/lib/view/expenseAutomationView/epics/transactionCategorization/saveTransactionCategorizationEpic.js +6 -2
  33. package/lib/view/expenseAutomationView/epics/transactionCategorization/triggerReviewTabRefetchEpic.js +2 -2
  34. package/lib/view/expenseAutomationView/epics/transactionCategorization/updateTransactionCategorizationEpic.js +6 -2
  35. package/lib/view/expenseAutomationView/expenseAutomationViewReducer.d.ts +6 -2
  36. package/lib/view/expenseAutomationView/expenseAutomationViewReducer.js +20 -3
  37. package/lib/view/expenseAutomationView/payload/transactionCategorizationPayload.d.ts +9 -20
  38. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +17 -8
  39. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +48 -8
  40. package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +5 -4
  41. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +5 -4
  42. package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +2 -1
  43. package/lib/view/spendManagement/billPay/internationalWireVerification/epics/fetchIntlVerificationFormEpic.d.ts +3 -3
  44. package/lib/view/spendManagement/billPay/internationalWireVerification/epics/fetchIntlVerificationFormEpic.js +2 -6
  45. package/lib/view/spendManagement/billPay/internationalWireVerification/epics/initializeIntlVerificationFormEpic.d.ts +1 -2
  46. package/lib/view/spendManagement/billPay/internationalWireVerification/epics/initializeIntlVerificationFormEpic.js +33 -32
  47. package/lib/view/spendManagement/billPay/internationalWireVerification/epics/submitIntlVerificationEpic.js +7 -2
  48. package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationPayload.d.ts +1 -24
  49. package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationPayload.js +9 -59
  50. package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationReducer.js +5 -4
  51. package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSelector.js +15 -39
  52. package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationState.d.ts +1 -20
  53. package/package.json +1 -1
  54. package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireOnboardingDetailsToLocalData.js +0 -146
  55. package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants.js +0 -40
  56. package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers.js +0 -86
  57. package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSubmitPayload.js +0 -154
  58. package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireOnboardingDetailsToLocalData.d.ts +0 -4
  59. package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireOnboardingDetailsToLocalData.js +0 -150
  60. package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants.d.ts +0 -38
  61. package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants.js +0 -43
  62. package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers.d.ts +0 -27
  63. package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers.js +0 -96
  64. package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSubmitPayload.d.ts +0 -32
  65. package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSubmitPayload.js +0 -159
@@ -1,159 +0,0 @@
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;