@zeniai/client-epic-state 5.0.41 → 5.0.42
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/entity/chargeCardRepayment/chargeCardRepayment.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +0 -3
- package/lib/entity/task/taskPayload.d.ts +0 -1
- package/lib/entity/task/taskPayload.js +0 -5
- package/lib/entity/task/taskState.d.ts +0 -5
- package/lib/entity/task/taskState.js +1 -6
- package/lib/entity/tenant/clearAllEpic.d.ts +3 -5
- package/lib/entity/tenant/clearAllEpic.js +2 -6
- package/lib/entity/tenant/tenantReducer.js +28 -2
- package/lib/epic.d.ts +1 -7
- package/lib/epic.js +1 -7
- package/lib/esm/entity/snackbar/snackbarTypes.js +0 -3
- package/lib/esm/entity/task/taskPayload.js +1 -6
- package/lib/esm/entity/task/taskState.js +0 -3
- package/lib/esm/entity/tenant/clearAllEpic.js +2 -6
- package/lib/esm/entity/tenant/tenantReducer.js +28 -2
- package/lib/esm/epic.js +1 -7
- package/lib/esm/index.js +9 -15
- package/lib/esm/reducer.js +3 -9
- package/lib/esm/view/common/recurringViewHelper.js +0 -17
- package/lib/esm/view/taskManager/taskDetailView/epics/initializeTaskToLocalStoreEpic.js +0 -2
- package/lib/esm/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +0 -5
- package/lib/esm/view/taskManager/taskDetailView/taskDetail.js +0 -1
- package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +0 -5
- package/lib/index.d.ts +13 -21
- package/lib/index.js +46 -77
- package/lib/reducer.d.ts +3 -9
- package/lib/reducer.js +3 -9
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/common/recurringViewHelper.d.ts +2 -3
- package/lib/view/common/recurringViewHelper.js +1 -18
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/taskManager/taskDetailView/epics/initializeTaskToLocalStoreEpic.js +0 -2
- package/lib/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +0 -5
- package/lib/view/taskManager/taskDetailView/taskDetail.d.ts +1 -3
- package/lib/view/taskManager/taskDetailView/taskDetail.js +0 -1
- package/lib/view/taskManager/taskDetailView/taskDetailSelector.d.ts +0 -1
- package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +0 -5
- package/package.json +1 -1
- package/lib/entity/creditAgent/creditAgentPayload.d.ts +0 -41
- package/lib/entity/creditAgent/creditAgentPayload.js +0 -40
- package/lib/entity/creditAgent/creditAgentReducer.d.ts +0 -9
- package/lib/entity/creditAgent/creditAgentReducer.js +0 -37
- package/lib/entity/creditAgent/creditAgentSelector.d.ts +0 -3
- package/lib/entity/creditAgent/creditAgentSelector.js +0 -10
- package/lib/entity/creditAgent/creditAgentState.d.ts +0 -39
- package/lib/entity/creditAgent/creditAgentState.js +0 -17
- package/lib/esm/entity/creditAgent/creditAgentPayload.js +0 -36
- package/lib/esm/entity/creditAgent/creditAgentReducer.js +0 -33
- package/lib/esm/entity/creditAgent/creditAgentSelector.js +0 -6
- package/lib/esm/entity/creditAgent/creditAgentState.js +0 -13
- package/lib/esm/view/creditAgentView/buildCreditReportCsv.js +0 -44
- package/lib/esm/view/creditAgentView/creditAgentViewPayload.js +0 -2
- package/lib/esm/view/creditAgentView/creditAgentViewReducer.js +0 -183
- package/lib/esm/view/creditAgentView/creditAgentViewSelector.js +0 -85
- package/lib/esm/view/creditAgentView/creditAgentViewState.js +0 -20
- package/lib/esm/view/creditAgentView/epics/fetchCardProfilesEpic.js +0 -20
- package/lib/esm/view/creditAgentView/epics/fetchCreditAgentAccessEpic.js +0 -13
- package/lib/esm/view/creditAgentView/epics/fetchCreditAgentMacroEpic.js +0 -19
- package/lib/esm/view/creditAgentView/epics/saveCreditAgentMacroEpic.js +0 -58
- package/lib/esm/view/creditAgentView/epics/scheduleTenantCreditScoreCronEpic.js +0 -39
- package/lib/esm/view/creditAgentView/epics/updateCardProfileEpic.js +0 -62
- package/lib/view/creditAgentView/buildCreditReportCsv.d.ts +0 -17
- package/lib/view/creditAgentView/buildCreditReportCsv.js +0 -47
- package/lib/view/creditAgentView/creditAgentViewPayload.d.ts +0 -9
- package/lib/view/creditAgentView/creditAgentViewPayload.js +0 -7
- package/lib/view/creditAgentView/creditAgentViewReducer.d.ts +0 -41
- package/lib/view/creditAgentView/creditAgentViewReducer.js +0 -187
- package/lib/view/creditAgentView/creditAgentViewSelector.d.ts +0 -20
- package/lib/view/creditAgentView/creditAgentViewSelector.js +0 -93
- package/lib/view/creditAgentView/creditAgentViewState.d.ts +0 -34
- package/lib/view/creditAgentView/creditAgentViewState.js +0 -22
- package/lib/view/creditAgentView/epics/fetchCardProfilesEpic.d.ts +0 -15
- package/lib/view/creditAgentView/epics/fetchCardProfilesEpic.js +0 -24
- package/lib/view/creditAgentView/epics/fetchCreditAgentAccessEpic.d.ts +0 -11
- package/lib/view/creditAgentView/epics/fetchCreditAgentAccessEpic.js +0 -17
- package/lib/view/creditAgentView/epics/fetchCreditAgentMacroEpic.d.ts +0 -15
- package/lib/view/creditAgentView/epics/fetchCreditAgentMacroEpic.js +0 -23
- package/lib/view/creditAgentView/epics/saveCreditAgentMacroEpic.d.ts +0 -29
- package/lib/view/creditAgentView/epics/saveCreditAgentMacroEpic.js +0 -62
- package/lib/view/creditAgentView/epics/scheduleTenantCreditScoreCronEpic.d.ts +0 -30
- package/lib/view/creditAgentView/epics/scheduleTenantCreditScoreCronEpic.js +0 -43
- package/lib/view/creditAgentView/epics/updateCardProfileEpic.d.ts +0 -37
- package/lib/view/creditAgentView/epics/updateCardProfileEpic.js +0 -66
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { ZeniDate } from '../../zeniDayJS';
|
|
2
|
-
export declare const toRecurringFrequency: (v: string) => "weekly" | "biweekly" | "monthly" | "quarterly" | "daily"
|
|
3
|
-
export declare const toRecurringFrequencyStrict: (v?: string) => "weekly" | "biweekly" | "monthly" | "quarterly" | "daily" |
|
|
2
|
+
export declare const toRecurringFrequency: (v: string) => "weekly" | "biweekly" | "monthly" | "quarterly" | "daily";
|
|
3
|
+
export declare const toRecurringFrequencyStrict: (v?: string) => "weekly" | "biweekly" | "monthly" | "quarterly" | "daily" | undefined;
|
|
4
4
|
export type RecurringFrequencyType = NonNullable<ReturnType<typeof toRecurringFrequency>>;
|
|
5
|
-
export declare const SEMI_WEEKLY_REQUIRED_DAYS_COUNT = 2;
|
|
6
5
|
declare const toRecurringDatePickerOptions: (v: string) => "date" | "recurringCount";
|
|
7
6
|
export type RecurringDatePickerOptions = NonNullable<ReturnType<typeof toRecurringDatePickerOptions>>;
|
|
8
7
|
export declare const getRecurringFrequencyInDays: (frequency: RecurringFrequencyType) => number;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getMinAllowedEndDate = exports.getRecurringEndDateFromCount = exports.getRecurringFrequencyInDays = exports.
|
|
3
|
+
exports.getMinAllowedEndDate = exports.getRecurringEndDateFromCount = exports.getRecurringFrequencyInDays = exports.toRecurringFrequencyStrict = exports.toRecurringFrequency = void 0;
|
|
4
4
|
const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
|
|
5
5
|
const ALL_RECURRING_FREQUENCY = [
|
|
6
6
|
'daily',
|
|
7
7
|
'weekly',
|
|
8
8
|
'biweekly',
|
|
9
|
-
'semi_weekly',
|
|
10
9
|
'monthly',
|
|
11
10
|
'quarterly',
|
|
12
11
|
];
|
|
@@ -14,7 +13,6 @@ const toRecurringFrequency = (v) => (0, stringToUnion_1.stringToUnion)(v, ALL_RE
|
|
|
14
13
|
exports.toRecurringFrequency = toRecurringFrequency;
|
|
15
14
|
const toRecurringFrequencyStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v ?? '', ALL_RECURRING_FREQUENCY);
|
|
16
15
|
exports.toRecurringFrequencyStrict = toRecurringFrequencyStrict;
|
|
17
|
-
exports.SEMI_WEEKLY_REQUIRED_DAYS_COUNT = 2;
|
|
18
16
|
const ALL_RECURRING_DATE_PICKER_OPTIONS = ['date', 'recurringCount'];
|
|
19
17
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
20
18
|
const toRecurringDatePickerOptions = (v) => (0, stringToUnion_1.stringToUnion)(v, ALL_RECURRING_DATE_PICKER_OPTIONS);
|
|
@@ -22,8 +20,6 @@ const getRecurringFrequencyInDays = (frequency) => {
|
|
|
22
20
|
switch (frequency) {
|
|
23
21
|
case 'daily':
|
|
24
22
|
return 1;
|
|
25
|
-
case 'semi_weekly':
|
|
26
|
-
return 3;
|
|
27
23
|
case 'weekly':
|
|
28
24
|
return 7;
|
|
29
25
|
case 'biweekly':
|
|
@@ -45,17 +41,6 @@ const getRecurringEndDateFromCount = (startDate, frequency, recurringCount) => {
|
|
|
45
41
|
case 'biweekly':
|
|
46
42
|
endDate = startDate.add((0, exports.getRecurringFrequencyInDays)(frequency) * (recurringCount - 1), 'day');
|
|
47
43
|
break;
|
|
48
|
-
case 'semi_weekly': {
|
|
49
|
-
// Two semi-weekly occurrences span exactly 7 days regardless of which
|
|
50
|
-
// two weekdays are picked (since gap1 + gap2 = 7). So odd counts are
|
|
51
|
-
// exact; even counts use the conservative half-week step (4 days).
|
|
52
|
-
const stepsRemaining = recurringCount - 1;
|
|
53
|
-
const fullWeekPairs = Math.floor(stepsRemaining / 2);
|
|
54
|
-
const hasOddTailStep = stepsRemaining % 2 === 1;
|
|
55
|
-
const days = fullWeekPairs * 7 + (hasOddTailStep ? 4 : 0);
|
|
56
|
-
endDate = startDate.add(days, 'day');
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
44
|
case 'monthly':
|
|
60
45
|
endDate = startDate.add(recurringCount - 1, 'month');
|
|
61
46
|
break;
|
|
@@ -73,8 +58,6 @@ const getMinAllowedEndDate = (frequency, startDate) => {
|
|
|
73
58
|
switch (frequency) {
|
|
74
59
|
case 'daily':
|
|
75
60
|
return startDate.add(1, 'day');
|
|
76
|
-
case 'semi_weekly':
|
|
77
|
-
return startDate.add(3, 'day');
|
|
78
61
|
case 'weekly':
|
|
79
62
|
return startDate.add(7, 'day');
|
|
80
63
|
case 'biweekly':
|
package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ export declare const getLineItemsByTransactionsIdsFromResponse: (transactions: S
|
|
|
37
37
|
export declare const getLineItemsByTransactionIdsFromLocalData: (transactionLocalData: TransactionReviewLocalDataSelectorView[], selectedTab: TransactionsTab) => Record<ID, string[]>;
|
|
38
38
|
export declare const mergeTabSpecificLineItems: (currentTabSpecificLineItems: TabSpecificLineItems, selectedTab: TransactionsTab, newLineItems: TabSpecificLineItems) => TabSpecificLineItems;
|
|
39
39
|
export declare const getSnackbarMessageForTransactionReview: (updatedCount: number, failedCount: number, categorizedCount: number) => {
|
|
40
|
-
messageSection: "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_month_end_email_sent" | "cockpit_month_end_email_save" | "cockpit_month_end_email_attachment_upload" | "je_bill_link" | "je_posted" | "audit_score_updated" | "people_invite_people" | "people_invite_multiple_people" | "people_delete_person" | "people_update_person" | "reimbursement_updated" | "reimbursement_deleted" | "reimbursement_cancelled_deleted" | "reimbursement_cancelled" | "reimbursement_approved" | "reimbursement_rejected" | "reimbursement_sent_for_approval" | "account_added" | "business_verification_save" | "business_verification_submit" | "business_verification_from_bills_submit" | "plaid_connection" | "unlink_deposit_account" | "reimbursement_setup" | "reimbursement_approval_create" | "reimbursement_duplicate_approval_create" | "reimbursement_approval_update" | "reimbursement_duplicate_approval_update" | "reimbursement_approval_delete" | "reimbursement_create_mileage" | "reimbursement_update_mileage" | "reimbursement_accept_term" | "reimbursement_accept_employee_term" | "reimbursement_bulk_submit" | "reimbursement_bulk_processed" | "bill_pay_setup" | "zeni_accounts_setup" | "bill_pay_approval_create" | "bill_pay_duplicate_approval_create" | "bill_pay_approval_update" | "bill_pay_duplicate_approval_update" | "bill_pay_approval_delete" | "bill_pay_updated" | "bill_pay_deleted" | "bill_pay_cancelled_deleted" | "bill_pay_cancelled" | "bill_pay_approved" | "real_time_approver_added" | "bill_pay_rejected" | "bill_pay_sent_for_approval" | "bill_pay_accept_term" | "bill_pay_bulk_submit" | "bill_pay_bulk_processed" | "bill_pay_refund" | "bill_pay_retry" | "bill_pay_marked_as_paid" | "zeni_account_accept_term" | "update_vendor" | "data_refresh_update" | "delete_bank_account" | "create_bank_account" | "create_bank_account_ach" | "create_bank_account_wire" | "create_bank_account_international" | "transfer_money" | "update_zeni_account_nickname" | "create_checking_account" | "deposit_check" | "create_vendor" | "onboarding_customer_view" | "onboarding_customer_view_complete" | "onboarding_customer_identity_verification_save" | "onboarding_customer_identity_verification_submit" | "onboarding_customer_business_verification_save" | "onboarding_customer_business_verification_submit" | "retry_bank_account_connection" | "dashboard_invite_sent" | "onboarding_info_saved" | "approve_original_merchant" | "approve_global_merchant" | "reject_global_merchant" | "create_global_merchant" | "fetch_global_merchant_no_recommendation" | "save_vendor_renamed" | "save_vendor_sent_for_review" | "save_vendor_marked_as_employee" | "save_vendor_marked_as_local_contractor" | "charge_card_setup" | "charge_card_accept_term" | "charge_card_receipt_upload" | "charge_card_resend_invite" | "charge_card_revoke_invite" | "charge_card_update_limit" | "charge_cards_update_limit" | "close_charge_card" | "lock_charge_card" | "lock_charge_card_card_user" | "lock_charge_cards" | "unlock_charge_card" | "unlock_charge_card_card_user" | "unlock_charge_cards" | "close_charge_cards" | "revoke_invite_charge_cards" | "charge_card_express_interest" | "create_schedule" | "save_schedule" | "delete_schedule" | "ignore_schedule" | "save_task_detail" | "fetch_task_detail" | "delete_task" | "archive_task" | "snooze_task" | "unsnooze_task" | "create_tag" | "delete_tag" | "update_charge_card" | "update_charge_card_name" | "update_charge_card_name_card_user" | "issue_charge_card" | "issue_charge_cards" | "notification_settings_saved" | "referral_invite_sent" | "notification_mark_as_read" | "mark_as_complete_schedule" | "cancel_journal_entry" | "settings_accounting_accounts_updated" | "create_card_setup" | "confirm_card_setup" | "add_card_payment_source" | "fetch_payment_sources" | "task_assigned_toast_notification" | "task_due_tomorrow_toast_notification" | "task_deleted_toast_notification" | "task_archived_toast_notification" | "task_overdue_toast_notification" | "task_overdue_toast_notification_creator" | "task_notification_count" | "task_activities_toast_notification" | "task_created_toast_notification" | "task_group_creation_success" | "task_group_deletion_success" | "task_group_update_success" | "primary_funding_account_updated" | "task_time_spent_validation" | "missing_receipts_attachment" | "flux_analysis_unreviewed" | "flux_analysis_reviewed" | "receipt_match" | "receipts_upload" | "receipts_bulk_match" | "billing_address_view" | "express_pay_submit" | "exclude_transaction" | "reconcile" | "save_reconcile_for_later" | "recon_transaction_categorize" | "recon_transaction_match" | "update_debit_card_pin_attempt" | "set_debit_card_pin" | "ai_cfo_create_session_and_submit" | "ai_cfo_chat_session_deleted" | "charge_card_auto_pay_enable" | "charge_card_auto_pay_disable" | "treasury_setup" | "treasury_accept_term" | "treasury_transfer_money" | "treasury_transfer_money_failed" | "auto_transfer_rule_create" | "auto_transfer_rule_update" | "auto_transfer_rule_delete" | "auto_transfer_rule_pause" | "auto_transfer_rule_resume" | "treasury_update_portfolio_allocation" | "send_email_magic_link_to_user" | "complete_profile_done" | "reports_resync" | "invalid_phone_number" | "transactions_categorized_updated_failed" | "transaction_categorized_updated_failed" | "transactionsCategorized_transactionsUpdated" | "transactionsCategorized_transactionUpdated" | "transactionCategorized_transactionsUpdated" | "transactionCategorized_transactionUpdated" | "transactionsCategorized_transactionsFailed" | "transactionsCategorized_transactionFailed" | "transactionCategorized_transactionsFailed" | "transactionCategorized_transactionFailed" | "transactionsUpdated_transactionsFailed" | "transactionsUpdated_transactionFailed" | "transactionUpdated_transactionsFailed" | "transactionUpdated_transactionFailed" | "transactionsCategorized_transactionsUpdated_transactionsFailed" | "transactionsCategorized_transactionsUpdated_transactionFailed" | "transactionsCategorized_transactionUpdated_transactionsFailed" | "transactionCategorized_transactionsUpdated_transactionsFailed" | "transactionsCategorized_transactionUpdated_transactionFailed" | "transactionCategorized_transactionsUpdated_transactionFailed" | "transactionCategorized_transactionUpdated_transactionsFailed" | "transactionCategorized_transactionUpdated_transactionFailed" | "accounting_classes_enabled_update" | "account_excluded_from_reconciliation" | "account_included_in_reconciliation" | "ai_accountant_trigger_job" | "oauth_consent_approve" | "oauth_consent_invalid_request"
|
|
40
|
+
messageSection: "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_month_end_email_sent" | "cockpit_month_end_email_save" | "cockpit_month_end_email_attachment_upload" | "je_bill_link" | "je_posted" | "audit_score_updated" | "people_invite_people" | "people_invite_multiple_people" | "people_delete_person" | "people_update_person" | "reimbursement_updated" | "reimbursement_deleted" | "reimbursement_cancelled_deleted" | "reimbursement_cancelled" | "reimbursement_approved" | "reimbursement_rejected" | "reimbursement_sent_for_approval" | "account_added" | "business_verification_save" | "business_verification_submit" | "business_verification_from_bills_submit" | "plaid_connection" | "unlink_deposit_account" | "reimbursement_setup" | "reimbursement_approval_create" | "reimbursement_duplicate_approval_create" | "reimbursement_approval_update" | "reimbursement_duplicate_approval_update" | "reimbursement_approval_delete" | "reimbursement_create_mileage" | "reimbursement_update_mileage" | "reimbursement_accept_term" | "reimbursement_accept_employee_term" | "reimbursement_bulk_submit" | "reimbursement_bulk_processed" | "bill_pay_setup" | "zeni_accounts_setup" | "bill_pay_approval_create" | "bill_pay_duplicate_approval_create" | "bill_pay_approval_update" | "bill_pay_duplicate_approval_update" | "bill_pay_approval_delete" | "bill_pay_updated" | "bill_pay_deleted" | "bill_pay_cancelled_deleted" | "bill_pay_cancelled" | "bill_pay_approved" | "real_time_approver_added" | "bill_pay_rejected" | "bill_pay_sent_for_approval" | "bill_pay_accept_term" | "bill_pay_bulk_submit" | "bill_pay_bulk_processed" | "bill_pay_refund" | "bill_pay_retry" | "bill_pay_marked_as_paid" | "zeni_account_accept_term" | "update_vendor" | "data_refresh_update" | "delete_bank_account" | "create_bank_account" | "create_bank_account_ach" | "create_bank_account_wire" | "create_bank_account_international" | "transfer_money" | "update_zeni_account_nickname" | "create_checking_account" | "deposit_check" | "create_vendor" | "onboarding_customer_view" | "onboarding_customer_view_complete" | "onboarding_customer_identity_verification_save" | "onboarding_customer_identity_verification_submit" | "onboarding_customer_business_verification_save" | "onboarding_customer_business_verification_submit" | "retry_bank_account_connection" | "dashboard_invite_sent" | "onboarding_info_saved" | "approve_original_merchant" | "approve_global_merchant" | "reject_global_merchant" | "create_global_merchant" | "fetch_global_merchant_no_recommendation" | "save_vendor_renamed" | "save_vendor_sent_for_review" | "save_vendor_marked_as_employee" | "save_vendor_marked_as_local_contractor" | "charge_card_setup" | "charge_card_accept_term" | "charge_card_receipt_upload" | "charge_card_resend_invite" | "charge_card_revoke_invite" | "charge_card_update_limit" | "charge_cards_update_limit" | "close_charge_card" | "lock_charge_card" | "lock_charge_card_card_user" | "lock_charge_cards" | "unlock_charge_card" | "unlock_charge_card_card_user" | "unlock_charge_cards" | "close_charge_cards" | "revoke_invite_charge_cards" | "charge_card_express_interest" | "create_schedule" | "save_schedule" | "delete_schedule" | "ignore_schedule" | "save_task_detail" | "fetch_task_detail" | "delete_task" | "archive_task" | "snooze_task" | "unsnooze_task" | "create_tag" | "delete_tag" | "update_charge_card" | "update_charge_card_name" | "update_charge_card_name_card_user" | "issue_charge_card" | "issue_charge_cards" | "notification_settings_saved" | "referral_invite_sent" | "notification_mark_as_read" | "mark_as_complete_schedule" | "cancel_journal_entry" | "settings_accounting_accounts_updated" | "create_card_setup" | "confirm_card_setup" | "add_card_payment_source" | "fetch_payment_sources" | "task_assigned_toast_notification" | "task_due_tomorrow_toast_notification" | "task_deleted_toast_notification" | "task_archived_toast_notification" | "task_overdue_toast_notification" | "task_overdue_toast_notification_creator" | "task_notification_count" | "task_activities_toast_notification" | "task_created_toast_notification" | "task_group_creation_success" | "task_group_deletion_success" | "task_group_update_success" | "primary_funding_account_updated" | "task_time_spent_validation" | "missing_receipts_attachment" | "flux_analysis_unreviewed" | "flux_analysis_reviewed" | "receipt_match" | "receipts_upload" | "receipts_bulk_match" | "billing_address_view" | "express_pay_submit" | "exclude_transaction" | "reconcile" | "save_reconcile_for_later" | "recon_transaction_categorize" | "recon_transaction_match" | "update_debit_card_pin_attempt" | "set_debit_card_pin" | "ai_cfo_create_session_and_submit" | "ai_cfo_chat_session_deleted" | "charge_card_auto_pay_enable" | "charge_card_auto_pay_disable" | "treasury_setup" | "treasury_accept_term" | "treasury_transfer_money" | "treasury_transfer_money_failed" | "auto_transfer_rule_create" | "auto_transfer_rule_update" | "auto_transfer_rule_delete" | "auto_transfer_rule_pause" | "auto_transfer_rule_resume" | "treasury_update_portfolio_allocation" | "send_email_magic_link_to_user" | "complete_profile_done" | "reports_resync" | "invalid_phone_number" | "transactions_categorized_updated_failed" | "transaction_categorized_updated_failed" | "transactionsCategorized_transactionsUpdated" | "transactionsCategorized_transactionUpdated" | "transactionCategorized_transactionsUpdated" | "transactionCategorized_transactionUpdated" | "transactionsCategorized_transactionsFailed" | "transactionsCategorized_transactionFailed" | "transactionCategorized_transactionsFailed" | "transactionCategorized_transactionFailed" | "transactionsUpdated_transactionsFailed" | "transactionsUpdated_transactionFailed" | "transactionUpdated_transactionsFailed" | "transactionUpdated_transactionFailed" | "transactionsCategorized_transactionsUpdated_transactionsFailed" | "transactionsCategorized_transactionsUpdated_transactionFailed" | "transactionsCategorized_transactionUpdated_transactionsFailed" | "transactionCategorized_transactionsUpdated_transactionsFailed" | "transactionsCategorized_transactionUpdated_transactionFailed" | "transactionCategorized_transactionsUpdated_transactionFailed" | "transactionCategorized_transactionUpdated_transactionsFailed" | "transactionCategorized_transactionUpdated_transactionFailed" | "accounting_classes_enabled_update" | "account_excluded_from_reconciliation" | "account_included_in_reconciliation" | "ai_accountant_trigger_job" | "oauth_consent_approve" | "oauth_consent_invalid_request";
|
|
41
41
|
messageText: "notification" | "failed" | "success";
|
|
42
42
|
type: "error" | "success" | "info";
|
|
43
43
|
variables: {
|
|
@@ -18,14 +18,12 @@ const initializeTaskToLocalStoreEpic = (actions$, state$) => actions$.pipe((0, o
|
|
|
18
18
|
description: task.description,
|
|
19
19
|
status: task.status.code,
|
|
20
20
|
assignee: task.assignees,
|
|
21
|
-
groupAssignees: task.groupAssignees,
|
|
22
21
|
dueDate: task.dueDate,
|
|
23
22
|
priority: task.priority.code,
|
|
24
23
|
tagIds: task.tagIds,
|
|
25
24
|
fileIds: task.fileIds,
|
|
26
25
|
type: task.type,
|
|
27
26
|
recurringFrequency: task.recurringFrequency,
|
|
28
|
-
recurringDaysOfWeek: task.recurringDaysOfWeek,
|
|
29
27
|
recurringEndDateLocalData: {
|
|
30
28
|
recurringDatePickerOptionsType: 'date', // by default, date would be selected
|
|
31
29
|
recurringEndDate: task.recurringEndDate,
|
|
@@ -95,14 +95,9 @@ const prepareTaskPayload = (state, taskId, taskGroupId) => {
|
|
|
95
95
|
recurring_start_date: localData.type.code === 'recurring'
|
|
96
96
|
? (localData.recurringStartDate?.format(formatZeniDateFY_1.DEFAULT_DATE_FORMAT) ?? null)
|
|
97
97
|
: null,
|
|
98
|
-
recurring_days_of_week: localData.type.code === 'recurring' &&
|
|
99
|
-
localData.recurringFrequency === 'semi_weekly'
|
|
100
|
-
? (localData.recurringDaysOfWeek ?? [])
|
|
101
|
-
: [],
|
|
102
98
|
sync_token: syncToken,
|
|
103
99
|
task_group_ids: taskGroupId != null ? [taskGroupId] : [],
|
|
104
100
|
time_spent: (0, formatMinutesToFromHHMM_1.convertHHMMStrToMinutes)(localData.timeSpent),
|
|
105
|
-
group_assignees: localData.groupAssignees,
|
|
106
101
|
...(taskId == null ? { is_private: localData.isPrivate ?? false } : {}),
|
|
107
102
|
};
|
|
108
103
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FetchStateAndError, ID } from '../../../commonStateTypes/common';
|
|
2
|
-
import {
|
|
2
|
+
import { PriorityCodeType, TaskStatusCodeType, TaskType } from '../../../entity/task/taskState';
|
|
3
3
|
import { ZeniDate } from '../../../zeniDayJS';
|
|
4
4
|
import { RecurringDatePickerOptions, RecurringFrequencyType } from '../../common/recurringViewHelper';
|
|
5
5
|
import { CommonHistoryView } from '../../spendManagement/commonHistoryView/commonHistory';
|
|
@@ -21,7 +21,6 @@ export interface EditTaskLocalData {
|
|
|
21
21
|
assignee: ID[];
|
|
22
22
|
description: string;
|
|
23
23
|
fileIds: ID[];
|
|
24
|
-
groupAssignees: ID[];
|
|
25
24
|
name: string;
|
|
26
25
|
priority: PriorityCodeType;
|
|
27
26
|
recurringEndDateLocalData: {
|
|
@@ -35,7 +34,6 @@ export interface EditTaskLocalData {
|
|
|
35
34
|
type: TaskType;
|
|
36
35
|
dueDate?: ZeniDate;
|
|
37
36
|
isPrivate?: boolean;
|
|
38
|
-
recurringDaysOfWeek?: DayOfWeek[];
|
|
39
37
|
recurringFrequency?: RecurringFrequencyType;
|
|
40
38
|
recurringStartDate?: ZeniDate;
|
|
41
39
|
savedRecurringEndDate?: ZeniDate;
|
|
@@ -23,7 +23,6 @@ export interface TaskDetailSelectorView extends SelectorView {
|
|
|
23
23
|
isDeleted?: boolean;
|
|
24
24
|
recurringSourceTaskId?: ID;
|
|
25
25
|
snoozedUntil?: ZeniDate | null;
|
|
26
|
-
taskGroupId?: ID;
|
|
27
26
|
}
|
|
28
27
|
export declare const getTaskDetail: (state: RootState, taskId?: ID) => TaskDetailSelectorView;
|
|
29
28
|
export declare const allTaskStatus: TaskStatus[];
|
|
@@ -32,7 +32,6 @@ const getTaskDetail = (state, taskId) => {
|
|
|
32
32
|
let isDeleted = undefined;
|
|
33
33
|
let recurringSourceTaskId = undefined;
|
|
34
34
|
let snoozedUntil = undefined;
|
|
35
|
-
let taskGroupId = undefined;
|
|
36
35
|
if (taskId != null && sourceTaskDetail != null) {
|
|
37
36
|
const taskEntity = (0, taskSelector_1.getTaskById)(taskState, taskId);
|
|
38
37
|
const fileIdsInEntity = taskEntity?.fileIds ?? [];
|
|
@@ -42,7 +41,6 @@ const getTaskDetail = (state, taskId) => {
|
|
|
42
41
|
isDeleted = taskEntity.isDeleted;
|
|
43
42
|
recurringSourceTaskId = taskEntity.recurringSourceTaskId;
|
|
44
43
|
snoozedUntil = taskEntity.snoozedUntil;
|
|
45
|
-
taskGroupId = taskEntity.taskGroupIds[0];
|
|
46
44
|
}
|
|
47
45
|
if (fileIdsInEntity.length > 0) {
|
|
48
46
|
fetchStatus = (0, reduceFetchState_1.reduceFetchState)([
|
|
@@ -95,7 +93,6 @@ const getTaskDetail = (state, taskId) => {
|
|
|
95
93
|
recurringSourceTaskId,
|
|
96
94
|
showTaskDetailFormFooter,
|
|
97
95
|
snoozedUntil,
|
|
98
|
-
taskGroupId,
|
|
99
96
|
};
|
|
100
97
|
};
|
|
101
98
|
exports.getTaskDetail = getTaskDetail;
|
|
@@ -150,13 +147,11 @@ const showFormFooter = (taskDetailLocalData, taskDetailInStore) => {
|
|
|
150
147
|
taskDetailLocalData.status !== taskDetailInStore.status.code ||
|
|
151
148
|
!(0, isEqual_1.default)(taskDetailInStore.tagIds, taskDetailLocalData.tagIds) ||
|
|
152
149
|
!(0, isEqual_1.default)(taskDetailLocalData.assignee, taskDetailInStore?.assignees ?? []) ||
|
|
153
|
-
!(0, isEqual_1.default)(taskDetailLocalData.groupAssignees, taskDetailInStore?.groupAssignees ?? []) ||
|
|
154
150
|
!(0, isEqual_1.default)(taskDetailLocalData.fileIds, taskDetailInStore.fileIds ?? []) ||
|
|
155
151
|
!(0, isEqual_1.default)(taskDetailLocalData.dueDate, taskDetailInStore.dueDate) ||
|
|
156
152
|
!(0, isEqual_1.default)(taskDetailLocalData.type, taskDetailInStore.type) ||
|
|
157
153
|
!(0, isEqual_1.default)(taskDetailLocalData.savedRecurringEndDate, taskDetailInStore.recurringEndDate) ||
|
|
158
154
|
!(0, isEqual_1.default)(taskDetailLocalData.recurringFrequency, taskDetailInStore.recurringFrequency) ||
|
|
159
|
-
!(0, isEqual_1.default)(taskDetailLocalData.recurringDaysOfWeek, taskDetailInStore.recurringDaysOfWeek) ||
|
|
160
155
|
!(0, isEqual_1.default)(taskDetailLocalData.recurringStartDate, taskDetailInStore.recurringStartDate) ||
|
|
161
156
|
!(0, isEqual_1.default)(taskDetailLocalData.timeSpent, taskDetailInStore.timeSpent)) {
|
|
162
157
|
return true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.42",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { CardTenantProfileRow, CreditAgentMacro } from './creditAgentState';
|
|
2
|
-
export interface CardTenantProfileRowPayload {
|
|
3
|
-
card_score: string | null;
|
|
4
|
-
card_status: string;
|
|
5
|
-
company_id: string | null;
|
|
6
|
-
credit_limit: number | null;
|
|
7
|
-
customer_name: string | null;
|
|
8
|
-
is_analyzing: boolean;
|
|
9
|
-
is_new: boolean;
|
|
10
|
-
rationale: string | null;
|
|
11
|
-
recommended_amount: number | null;
|
|
12
|
-
report_date: string | null;
|
|
13
|
-
tenant_id: string;
|
|
14
|
-
tenant_namespace: string;
|
|
15
|
-
updated_by_name: string | null;
|
|
16
|
-
updated_by_user_id: string | null;
|
|
17
|
-
updated_on: string | null;
|
|
18
|
-
}
|
|
19
|
-
export interface CardTenantProfilesPayload {
|
|
20
|
-
count: number;
|
|
21
|
-
rows: CardTenantProfileRowPayload[];
|
|
22
|
-
}
|
|
23
|
-
export interface CardTenantProfileUpdatePayload {
|
|
24
|
-
profile: CardTenantProfileRowPayload;
|
|
25
|
-
}
|
|
26
|
-
export interface MacroPayload {
|
|
27
|
-
created_at: string;
|
|
28
|
-
creator_id: string;
|
|
29
|
-
description: string;
|
|
30
|
-
instructions: string;
|
|
31
|
-
is_active: boolean;
|
|
32
|
-
is_latest: boolean;
|
|
33
|
-
macro_id: string;
|
|
34
|
-
name: string;
|
|
35
|
-
parameters_schema: Record<string, unknown> | null;
|
|
36
|
-
tenant_id: string;
|
|
37
|
-
updated_at: string;
|
|
38
|
-
version: number;
|
|
39
|
-
}
|
|
40
|
-
export declare function toCardTenantProfileRow(row: CardTenantProfileRowPayload): CardTenantProfileRow;
|
|
41
|
-
export declare function toMacro(payload: MacroPayload): CreditAgentMacro;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toCardTenantProfileRow = toCardTenantProfileRow;
|
|
4
|
-
exports.toMacro = toMacro;
|
|
5
|
-
const zeniDayJS_1 = require("../../zeniDayJS");
|
|
6
|
-
const creditAgentState_1 = require("./creditAgentState");
|
|
7
|
-
// ── Mapping functions (payload → domain) ──
|
|
8
|
-
function toCardTenantProfileRow(row) {
|
|
9
|
-
return {
|
|
10
|
-
cardStatus: (0, creditAgentState_1.toCardStatus)(row.card_status),
|
|
11
|
-
companyId: row.company_id ?? undefined,
|
|
12
|
-
creditLimit: row.credit_limit ?? undefined,
|
|
13
|
-
creditScore: row.card_score ?? undefined,
|
|
14
|
-
customerName: row.customer_name ?? undefined,
|
|
15
|
-
isAnalyzing: Boolean(row.is_analyzing),
|
|
16
|
-
isNew: Boolean(row.is_new),
|
|
17
|
-
rationale: row.rationale ?? undefined,
|
|
18
|
-
recommendedAmount: row.recommended_amount ?? undefined,
|
|
19
|
-
reportDate: row.report_date != null ? (0, zeniDayJS_1.date)(row.report_date) : undefined,
|
|
20
|
-
tenantId: row.tenant_id,
|
|
21
|
-
tenantEmailDomain: row.tenant_namespace,
|
|
22
|
-
updatedByName: row.updated_by_name ?? undefined,
|
|
23
|
-
updatedByUserId: row.updated_by_user_id ?? undefined,
|
|
24
|
-
updatedOn: row.updated_on != null ? (0, zeniDayJS_1.date)(row.updated_on) : undefined,
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
function toMacro(payload) {
|
|
28
|
-
return {
|
|
29
|
-
macroId: payload.macro_id,
|
|
30
|
-
version: payload.version,
|
|
31
|
-
isLatest: payload.is_latest,
|
|
32
|
-
isActive: payload.is_active,
|
|
33
|
-
name: payload.name,
|
|
34
|
-
description: payload.description,
|
|
35
|
-
instructions: payload.instructions,
|
|
36
|
-
tenantId: payload.tenant_id,
|
|
37
|
-
createdAt: (0, zeniDayJS_1.date)(payload.created_at),
|
|
38
|
-
updatedAt: (0, zeniDayJS_1.date)(payload.updated_at),
|
|
39
|
-
};
|
|
40
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { CardTenantProfileRowPayload, MacroPayload } from './creditAgentPayload';
|
|
2
|
-
import { CreditAgentEntityState } from './creditAgentState';
|
|
3
|
-
export declare const initialCreditAgentEntityState: CreditAgentEntityState;
|
|
4
|
-
export declare const clearAllCreditAgent: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"creditAgent/clearAllCreditAgent">, updateCreditAgentMacro: import("@reduxjs/toolkit").ActionCreatorWithPayload<MacroPayload, "creditAgent/updateCreditAgentMacro">, updateCreditAgentRow: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
5
|
-
payload: CardTenantProfileRowPayload;
|
|
6
|
-
tenantId: string;
|
|
7
|
-
}, "creditAgent/updateCreditAgentRow">, updateCreditAgentRows: import("@reduxjs/toolkit").ActionCreatorWithPayload<CardTenantProfileRowPayload[], "creditAgent/updateCreditAgentRows">;
|
|
8
|
-
declare const _default: import("redux").Reducer<CreditAgentEntityState>;
|
|
9
|
-
export default _default;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.updateCreditAgentRows = exports.updateCreditAgentRow = exports.updateCreditAgentMacro = exports.clearAllCreditAgent = exports.initialCreditAgentEntityState = void 0;
|
|
5
|
-
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
-
const creditAgentPayload_1 = require("./creditAgentPayload");
|
|
7
|
-
exports.initialCreditAgentEntityState = {
|
|
8
|
-
macro: undefined,
|
|
9
|
-
rowByTenantId: {},
|
|
10
|
-
};
|
|
11
|
-
const creditAgent = (0, toolkit_1.createSlice)({
|
|
12
|
-
name: 'creditAgent',
|
|
13
|
-
initialState: exports.initialCreditAgentEntityState,
|
|
14
|
-
reducers: {
|
|
15
|
-
updateCreditAgentRows(draft, action) {
|
|
16
|
-
const newRowByTenantId = {};
|
|
17
|
-
action.payload.forEach((payload) => {
|
|
18
|
-
const row = (0, creditAgentPayload_1.toCardTenantProfileRow)(payload);
|
|
19
|
-
newRowByTenantId[row.tenantId] = row;
|
|
20
|
-
});
|
|
21
|
-
draft.rowByTenantId = newRowByTenantId;
|
|
22
|
-
},
|
|
23
|
-
updateCreditAgentRow(draft, action) {
|
|
24
|
-
const { tenantId, payload } = action.payload;
|
|
25
|
-
const row = (0, creditAgentPayload_1.toCardTenantProfileRow)(payload);
|
|
26
|
-
draft.rowByTenantId[tenantId] = row;
|
|
27
|
-
},
|
|
28
|
-
updateCreditAgentMacro(draft, action) {
|
|
29
|
-
draft.macro = (0, creditAgentPayload_1.toMacro)(action.payload);
|
|
30
|
-
},
|
|
31
|
-
clearAllCreditAgent(draft) {
|
|
32
|
-
Object.assign(draft, exports.initialCreditAgentEntityState);
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
_a = creditAgent.actions, exports.clearAllCreditAgent = _a.clearAllCreditAgent, exports.updateCreditAgentMacro = _a.updateCreditAgentMacro, exports.updateCreditAgentRow = _a.updateCreditAgentRow, exports.updateCreditAgentRows = _a.updateCreditAgentRows;
|
|
37
|
-
exports.default = creditAgent.reducer;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { CardTenantProfileRow, CreditAgentEntityState, CreditAgentMacro } from './creditAgentState';
|
|
2
|
-
export declare function getCreditAgentRows(state: CreditAgentEntityState): CardTenantProfileRow[];
|
|
3
|
-
export declare function getCreditAgentMacroEntity(state: CreditAgentEntityState): CreditAgentMacro | undefined;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCreditAgentRows = getCreditAgentRows;
|
|
4
|
-
exports.getCreditAgentMacroEntity = getCreditAgentMacroEntity;
|
|
5
|
-
function getCreditAgentRows(state) {
|
|
6
|
-
return Object.values(state.rowByTenantId);
|
|
7
|
-
}
|
|
8
|
-
function getCreditAgentMacroEntity(state) {
|
|
9
|
-
return state.macro;
|
|
10
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { ID } from '../../commonStateTypes/common';
|
|
2
|
-
import { ZeniDate } from '../../zeniDayJS';
|
|
3
|
-
declare const ALL_CARD_STATUS_VALUES: readonly ["Not-Initiated", "Interested", "Pre-approved", "Approved", "Enabled", "Active", "Rejected", "Locked"];
|
|
4
|
-
export declare const toCardStatus: (v: string) => "Not-Initiated" | "Interested" | "Pre-approved" | "Approved" | "Enabled" | "Active" | "Rejected" | "Locked";
|
|
5
|
-
export type CardStatus = ReturnType<typeof toCardStatus>;
|
|
6
|
-
export { ALL_CARD_STATUS_VALUES };
|
|
7
|
-
export interface CardTenantProfileRow {
|
|
8
|
-
cardStatus: CardStatus;
|
|
9
|
-
isAnalyzing: boolean;
|
|
10
|
-
isNew: boolean;
|
|
11
|
-
tenantEmailDomain: string;
|
|
12
|
-
tenantId: ID;
|
|
13
|
-
companyId?: ID;
|
|
14
|
-
creditLimit?: number;
|
|
15
|
-
creditScore?: string;
|
|
16
|
-
customerName?: string;
|
|
17
|
-
rationale?: string;
|
|
18
|
-
recommendedAmount?: number;
|
|
19
|
-
reportDate?: ZeniDate;
|
|
20
|
-
updatedByName?: string;
|
|
21
|
-
updatedByUserId?: ID;
|
|
22
|
-
updatedOn?: ZeniDate;
|
|
23
|
-
}
|
|
24
|
-
export interface CreditAgentMacro {
|
|
25
|
-
createdAt: ZeniDate;
|
|
26
|
-
description: string;
|
|
27
|
-
instructions: string;
|
|
28
|
-
isActive: boolean;
|
|
29
|
-
isLatest: boolean;
|
|
30
|
-
macroId: ID;
|
|
31
|
-
name: string;
|
|
32
|
-
tenantId: ID;
|
|
33
|
-
updatedAt: ZeniDate;
|
|
34
|
-
version: number;
|
|
35
|
-
}
|
|
36
|
-
export interface CreditAgentEntityState {
|
|
37
|
-
rowByTenantId: Record<ID, CardTenantProfileRow>;
|
|
38
|
-
macro?: CreditAgentMacro;
|
|
39
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ALL_CARD_STATUS_VALUES = exports.toCardStatus = void 0;
|
|
4
|
-
const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
|
|
5
|
-
const ALL_CARD_STATUS_VALUES = [
|
|
6
|
-
'Not-Initiated',
|
|
7
|
-
'Interested',
|
|
8
|
-
'Pre-approved',
|
|
9
|
-
'Approved',
|
|
10
|
-
'Enabled',
|
|
11
|
-
'Active',
|
|
12
|
-
'Rejected',
|
|
13
|
-
'Locked',
|
|
14
|
-
];
|
|
15
|
-
exports.ALL_CARD_STATUS_VALUES = ALL_CARD_STATUS_VALUES;
|
|
16
|
-
const toCardStatus = (v) => (0, stringToUnion_1.stringToUnion)(v, ALL_CARD_STATUS_VALUES);
|
|
17
|
-
exports.toCardStatus = toCardStatus;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { date } from '../../zeniDayJS';
|
|
2
|
-
import { toCardStatus, } from './creditAgentState';
|
|
3
|
-
// ── Mapping functions (payload → domain) ──
|
|
4
|
-
export function toCardTenantProfileRow(row) {
|
|
5
|
-
return {
|
|
6
|
-
cardStatus: toCardStatus(row.card_status),
|
|
7
|
-
companyId: row.company_id ?? undefined,
|
|
8
|
-
creditLimit: row.credit_limit ?? undefined,
|
|
9
|
-
creditScore: row.card_score ?? undefined,
|
|
10
|
-
customerName: row.customer_name ?? undefined,
|
|
11
|
-
isAnalyzing: Boolean(row.is_analyzing),
|
|
12
|
-
isNew: Boolean(row.is_new),
|
|
13
|
-
rationale: row.rationale ?? undefined,
|
|
14
|
-
recommendedAmount: row.recommended_amount ?? undefined,
|
|
15
|
-
reportDate: row.report_date != null ? date(row.report_date) : undefined,
|
|
16
|
-
tenantId: row.tenant_id,
|
|
17
|
-
tenantEmailDomain: row.tenant_namespace,
|
|
18
|
-
updatedByName: row.updated_by_name ?? undefined,
|
|
19
|
-
updatedByUserId: row.updated_by_user_id ?? undefined,
|
|
20
|
-
updatedOn: row.updated_on != null ? date(row.updated_on) : undefined,
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
export function toMacro(payload) {
|
|
24
|
-
return {
|
|
25
|
-
macroId: payload.macro_id,
|
|
26
|
-
version: payload.version,
|
|
27
|
-
isLatest: payload.is_latest,
|
|
28
|
-
isActive: payload.is_active,
|
|
29
|
-
name: payload.name,
|
|
30
|
-
description: payload.description,
|
|
31
|
-
instructions: payload.instructions,
|
|
32
|
-
tenantId: payload.tenant_id,
|
|
33
|
-
createdAt: date(payload.created_at),
|
|
34
|
-
updatedAt: date(payload.updated_at),
|
|
35
|
-
};
|
|
36
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
-
import { toCardTenantProfileRow, toMacro, } from './creditAgentPayload';
|
|
3
|
-
export const initialCreditAgentEntityState = {
|
|
4
|
-
macro: undefined,
|
|
5
|
-
rowByTenantId: {},
|
|
6
|
-
};
|
|
7
|
-
const creditAgent = createSlice({
|
|
8
|
-
name: 'creditAgent',
|
|
9
|
-
initialState: initialCreditAgentEntityState,
|
|
10
|
-
reducers: {
|
|
11
|
-
updateCreditAgentRows(draft, action) {
|
|
12
|
-
const newRowByTenantId = {};
|
|
13
|
-
action.payload.forEach((payload) => {
|
|
14
|
-
const row = toCardTenantProfileRow(payload);
|
|
15
|
-
newRowByTenantId[row.tenantId] = row;
|
|
16
|
-
});
|
|
17
|
-
draft.rowByTenantId = newRowByTenantId;
|
|
18
|
-
},
|
|
19
|
-
updateCreditAgentRow(draft, action) {
|
|
20
|
-
const { tenantId, payload } = action.payload;
|
|
21
|
-
const row = toCardTenantProfileRow(payload);
|
|
22
|
-
draft.rowByTenantId[tenantId] = row;
|
|
23
|
-
},
|
|
24
|
-
updateCreditAgentMacro(draft, action) {
|
|
25
|
-
draft.macro = toMacro(action.payload);
|
|
26
|
-
},
|
|
27
|
-
clearAllCreditAgent(draft) {
|
|
28
|
-
Object.assign(draft, initialCreditAgentEntityState);
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
export const { clearAllCreditAgent, updateCreditAgentMacro, updateCreditAgentRow, updateCreditAgentRows, } = creditAgent.actions;
|
|
33
|
-
export default creditAgent.reducer;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { stringToUnion } from '../../commonStateTypes/stringToUnion';
|
|
2
|
-
const ALL_CARD_STATUS_VALUES = [
|
|
3
|
-
'Not-Initiated',
|
|
4
|
-
'Interested',
|
|
5
|
-
'Pre-approved',
|
|
6
|
-
'Approved',
|
|
7
|
-
'Enabled',
|
|
8
|
-
'Active',
|
|
9
|
-
'Rejected',
|
|
10
|
-
'Locked',
|
|
11
|
-
];
|
|
12
|
-
export const toCardStatus = (v) => stringToUnion(v, ALL_CARD_STATUS_VALUES);
|
|
13
|
-
export { ALL_CARD_STATUS_VALUES };
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
const CREDIT_REPORT_COLUMNS = [
|
|
2
|
-
'Customer Name',
|
|
3
|
-
'Card Status',
|
|
4
|
-
'Credit Limit ($)',
|
|
5
|
-
'Credit Score',
|
|
6
|
-
'Recommended Amount ($)',
|
|
7
|
-
'Rationale',
|
|
8
|
-
'Report Date',
|
|
9
|
-
'Tenant Email Domain',
|
|
10
|
-
'Tenant ID',
|
|
11
|
-
'Company ID',
|
|
12
|
-
'Updated By',
|
|
13
|
-
'Updated On',
|
|
14
|
-
];
|
|
15
|
-
function rowToFields(row) {
|
|
16
|
-
return [
|
|
17
|
-
row.customerName,
|
|
18
|
-
row.cardStatus,
|
|
19
|
-
row.creditLimit,
|
|
20
|
-
row.creditScore,
|
|
21
|
-
row.recommendedAmount,
|
|
22
|
-
row.rationale,
|
|
23
|
-
row.reportDate?.format('YYYY-MM-DD'),
|
|
24
|
-
row.tenantEmailDomain,
|
|
25
|
-
row.tenantId,
|
|
26
|
-
row.companyId,
|
|
27
|
-
row.updatedByName,
|
|
28
|
-
row.updatedOn?.format('YYYY-MM-DD'),
|
|
29
|
-
];
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Build the payload for the web-app-v2 table download endpoint.
|
|
33
|
-
*
|
|
34
|
-
* The component calls this, then GETs the endpoint with the payload
|
|
35
|
-
* as a query param and handles the blob response as a file download.
|
|
36
|
-
*/
|
|
37
|
-
export function getCreditReportDownloadPayload(rows) {
|
|
38
|
-
return {
|
|
39
|
-
columns: CREDIT_REPORT_COLUMNS,
|
|
40
|
-
rows: rows.map(rowToFields),
|
|
41
|
-
file_name: 'credit-report',
|
|
42
|
-
sheet_name: 'Credit Report',
|
|
43
|
-
};
|
|
44
|
-
}
|