@zeniai/client-epic-state 5.2.87 → 5.2.89-beta0KB
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/invoicing/invoicingCommonPayload.d.ts +9 -0
- package/lib/entity/invoicing/invoicingCommonPayload.js +8 -1
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/entity/tenant/tenantPayload.d.ts +1 -0
- package/lib/entity/tenant/tenantReducer.js +1 -0
- package/lib/entity/tenant/tenantState.d.ts +1 -0
- package/lib/entity/transaction/stateTypes/paymentType.d.ts +2 -2
- package/lib/entity/transaction/stateTypes/paymentType.js +9 -1
- package/lib/entity/transaction/stateTypes/printStatus.d.ts +4 -0
- package/lib/entity/transaction/stateTypes/printStatus.js +11 -0
- package/lib/epic.d.ts +5 -1
- package/lib/epic.js +8 -0
- package/lib/esm/entity/invoicing/invoicingCommonPayload.js +7 -0
- package/lib/esm/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/esm/entity/tenant/tenantReducer.js +1 -0
- package/lib/esm/entity/transaction/stateTypes/paymentType.js +9 -1
- package/lib/esm/entity/transaction/stateTypes/printStatus.js +7 -0
- package/lib/esm/epic.js +8 -0
- package/lib/esm/index.js +5 -2
- package/lib/esm/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +20 -12
- package/lib/esm/view/invoicing/settingsView/invoicingQboSettingsFormConfig.js +6 -1
- package/lib/esm/view/invoicing/settingsView/settingsViewReducer.js +19 -1
- package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +15 -1
- package/lib/esm/view/settingsView/epic/saveNotificationSettingsEpic.js +7 -0
- package/lib/esm/view/settingsView/settingsViewHelpers.js +1 -0
- package/lib/esm/view/settingsView/settingsViewReducer.js +16 -1
- package/lib/esm/view/settingsView/settingsViewState.js +1 -0
- package/lib/esm/view/transactionDetail/createTransaction/createTransactionLocalDataHelper.js +157 -0
- package/lib/esm/view/transactionDetail/createTransaction/createTransactionPayload.js +164 -0
- package/lib/esm/view/transactionDetail/createTransaction/createTransactionSelector.js +47 -0
- package/lib/esm/view/transactionDetail/createTransaction/createTransactionState.js +11 -0
- package/lib/esm/view/transactionDetail/createTransaction/epics/createTransactionAttachmentUploadFailureEpic.js +19 -0
- package/lib/esm/view/transactionDetail/createTransaction/epics/createTransactionEpic.js +81 -0
- package/lib/esm/view/transactionDetail/createTransaction/epics/fetchVendorRecommendationsForCreateTransactionEpic.js +53 -0
- package/lib/esm/view/transactionDetail/createTransaction/epics/initializeCreateTransactionLocalDataEpic.js +10 -0
- package/lib/esm/view/transactionDetail/transactionDetailReducer.js +196 -1
- package/lib/index.d.ts +6 -2
- package/lib/index.js +58 -37
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.d.ts +6 -1
- package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +20 -12
- package/lib/view/invoicing/settingsView/invoicingQboSettingsFormConfig.js +5 -0
- package/lib/view/invoicing/settingsView/settingsViewReducer.js +19 -1
- package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +3 -1
- package/lib/view/invoicing/settingsView/settingsViewSelector.js +15 -1
- package/lib/view/settingsView/epic/saveNotificationSettingsEpic.js +7 -0
- package/lib/view/settingsView/settingsViewHelpers.js +1 -0
- package/lib/view/settingsView/settingsViewPayload.d.ts +2 -0
- package/lib/view/settingsView/settingsViewReducer.js +16 -1
- package/lib/view/settingsView/settingsViewState.d.ts +2 -2
- package/lib/view/settingsView/settingsViewState.js +1 -0
- package/lib/view/transactionDetail/createTransaction/createTransactionLocalDataHelper.d.ts +56 -0
- package/lib/view/transactionDetail/createTransaction/createTransactionLocalDataHelper.js +172 -0
- package/lib/view/transactionDetail/createTransaction/createTransactionPayload.d.ts +95 -0
- package/lib/view/transactionDetail/createTransaction/createTransactionPayload.js +169 -0
- package/lib/view/transactionDetail/createTransaction/createTransactionSelector.d.ts +44 -0
- package/lib/view/transactionDetail/createTransaction/createTransactionSelector.js +53 -0
- package/lib/view/transactionDetail/createTransaction/createTransactionState.d.ts +82 -0
- package/lib/view/transactionDetail/createTransaction/createTransactionState.js +14 -0
- package/lib/view/transactionDetail/createTransaction/epics/createTransactionAttachmentUploadFailureEpic.d.ts +10 -0
- package/lib/view/transactionDetail/createTransaction/epics/createTransactionAttachmentUploadFailureEpic.js +23 -0
- package/lib/view/transactionDetail/createTransaction/epics/createTransactionEpic.d.ts +9 -0
- package/lib/view/transactionDetail/createTransaction/epics/createTransactionEpic.js +85 -0
- package/lib/view/transactionDetail/createTransaction/epics/fetchVendorRecommendationsForCreateTransactionEpic.d.ts +20 -0
- package/lib/view/transactionDetail/createTransaction/epics/fetchVendorRecommendationsForCreateTransactionEpic.js +57 -0
- package/lib/view/transactionDetail/createTransaction/epics/initializeCreateTransactionLocalDataEpic.d.ts +12 -0
- package/lib/view/transactionDetail/createTransaction/epics/initializeCreateTransactionLocalDataEpic.js +14 -0
- package/lib/view/transactionDetail/transactionDetailReducer.d.ts +39 -1
- package/lib/view/transactionDetail/transactionDetailReducer.js +198 -2
- package/lib/view/transactionDetail/transactionDetailState.d.ts +12 -0
- package/package.json +1 -1
package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ export declare const getLineItemsByTransactionsIdsFromResponse: (transactions: S
|
|
|
39
39
|
export declare const getLineItemsByTransactionIdsFromLocalData: (transactionLocalData: TransactionReviewLocalDataSelectorView[], selectedTab: TransactionsTab) => Record<ID, string[]>;
|
|
40
40
|
export declare const mergeTabSpecificLineItems: (currentTabSpecificLineItems: TabSpecificLineItems, selectedTab: TransactionsTab, newLineItems: TabSpecificLineItems) => TabSpecificLineItems;
|
|
41
41
|
export declare const getSnackbarMessageForTransactionReview: (updatedCount: number, failedCount: number, categorizedCount: number) => {
|
|
42
|
-
messageSection: "common" | "recommendation_feedback" | "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" | "actual_matching_match_and_reverse" | "actual_matching_undo_reversal" | "actual_matching_ignore_suggestion" | "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_approval_reorder" | "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_approval_reorder" | "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" | "card_policy_created" | "card_policy_updated" | "card_policy_deleted" | "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" | "revert_schedule" | "ignore_accrual" | "revert_accrual" | "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" | "create_transfer_entry" | "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" | "accounting_projects_enabled_update" | "accounting_projects_qbo_not_enabled" | "capitalization_threshold_update" | "account_excluded_from_reconciliation" | "account_included_in_reconciliation" | "confirm_statement_mapping" | "statement_parsing_in_progress" | "statement_parsing_complete" | "ai_accountant_trigger_job" | "oauth_consent_approve" | "oauth_consent_invalid_request" | "credit_agent_update_profile" | "credit_agent_save_macro" | "credit_agent_schedule_cron" | "create_sub_task" | "qbo_connection_already_linked" | "qbo_connection_failed" | "accounting_projects_qbo_reconnect_failed" | "product_services_update" | "qbo_realm_id_update" | "kyc_kyb_reset" | "invoicing_dunning_case_resolved" | "invoicing_dunning_retry" | "invoicing_dunning_cancel" | "invoicing_dunning_settings_save" | "invoicing_qbo_backfill" | "invoicing_qbo_sync_health_retry" | "invoicing_qbo_settings_save" | "invoicing_branding_save" | "invoicing_discount_archive" | "invoicing_discount_unarchive" | "invoicing_discount_delete" | "invoicing_invoice_reminder_sent" | "invoicing_invoice_regenerated" | "invoicing_invoice_voided" | "invoicing_catalog_item_saved" | "invoicing_customer_saved" | "invoicing_subscription_saved" | "invoicing_coupon_saved" | "invoicing_invoice_saved" | "invoicing_credit_note_saved" | "invoicing_payment_recorded" | "invoicing_subscription_activated" | "invoicing_subscription_cancellation_removed" | "invoicing_subscription_cancelled" | "invoicing_subscription_non_renewing" | "invoicing_subscription_paused" | "invoicing_subscription_reactivated" | "invoicing_subscription_resumed" | "invoicing_subscription_term_end_changed" | "invoicing_data_import_download";
|
|
42
|
+
messageSection: "common" | "recommendation_feedback" | "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" | "actual_matching_match_and_reverse" | "actual_matching_undo_reversal" | "actual_matching_ignore_suggestion" | "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_approval_reorder" | "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_approval_reorder" | "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" | "card_policy_created" | "card_policy_updated" | "card_policy_deleted" | "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" | "revert_schedule" | "ignore_accrual" | "revert_accrual" | "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" | "create_transfer_entry" | "create_transaction" | "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" | "accounting_projects_enabled_update" | "accounting_projects_qbo_not_enabled" | "capitalization_threshold_update" | "account_excluded_from_reconciliation" | "account_included_in_reconciliation" | "confirm_statement_mapping" | "statement_parsing_in_progress" | "statement_parsing_complete" | "ai_accountant_trigger_job" | "oauth_consent_approve" | "oauth_consent_invalid_request" | "credit_agent_update_profile" | "credit_agent_save_macro" | "credit_agent_schedule_cron" | "create_sub_task" | "qbo_connection_already_linked" | "qbo_connection_failed" | "accounting_projects_qbo_reconnect_failed" | "product_services_update" | "qbo_realm_id_update" | "kyc_kyb_reset" | "invoicing_dunning_case_resolved" | "invoicing_dunning_retry" | "invoicing_dunning_cancel" | "invoicing_dunning_settings_save" | "invoicing_qbo_backfill" | "invoicing_qbo_sync_health_retry" | "invoicing_qbo_settings_save" | "invoicing_branding_save" | "invoicing_discount_archive" | "invoicing_discount_unarchive" | "invoicing_discount_delete" | "invoicing_invoice_reminder_sent" | "invoicing_invoice_regenerated" | "invoicing_invoice_voided" | "invoicing_catalog_item_saved" | "invoicing_customer_saved" | "invoicing_subscription_saved" | "invoicing_coupon_saved" | "invoicing_invoice_saved" | "invoicing_credit_note_saved" | "invoicing_payment_recorded" | "invoicing_subscription_activated" | "invoicing_subscription_cancellation_removed" | "invoicing_subscription_cancelled" | "invoicing_subscription_non_renewing" | "invoicing_subscription_paused" | "invoicing_subscription_reactivated" | "invoicing_subscription_resumed" | "invoicing_subscription_term_end_changed" | "invoicing_data_import_download";
|
|
43
43
|
messageText: "notification" | "failed" | "success";
|
|
44
44
|
type: "error" | "success" | "info";
|
|
45
45
|
variables: {
|
|
@@ -41,6 +41,7 @@ export declare const getInvoicingCatalogAccountingLookup: (state: RootState) =>
|
|
|
41
41
|
export interface InvoicingAccountingOption {
|
|
42
42
|
id: string;
|
|
43
43
|
name: string;
|
|
44
|
+
accountSubType?: string;
|
|
44
45
|
accountType?: string;
|
|
45
46
|
}
|
|
46
47
|
export interface InvoicingQboView {
|
|
@@ -77,8 +78,12 @@ export declare const getInvoicingQboAccountOptions: (state: RootState) => Invoic
|
|
|
77
78
|
* comma-separated list of QuickBooks type names. An unrecognised list yields no
|
|
78
79
|
* accounts rather than every account: offering a bank account where income is
|
|
79
80
|
* required would post a mapping QuickBooks rejects.
|
|
81
|
+
*
|
|
82
|
+
* `excludedAccountSubTypes` drops accounts QuickBooks will not post to for that
|
|
83
|
+
* kind even though their type matches, e.g. a tax agency's system payable for
|
|
84
|
+
* the sales tax liability.
|
|
80
85
|
*/
|
|
81
|
-
export declare const invoicingAccountsForQboAccountTypes: (accounts: InvoicingAccountingOption[], accountTypes: string) => InvoicingAccountingOption[];
|
|
86
|
+
export declare const invoicingAccountsForQboAccountTypes: (accounts: InvoicingAccountingOption[], accountTypes: string, excludedAccountSubTypes?: string) => InvoicingAccountingOption[];
|
|
82
87
|
/**
|
|
83
88
|
* The account-mapping slot a catalog price point's income account shares with
|
|
84
89
|
* the settings page, and the one a discount's account shares with it.
|
|
@@ -115,6 +115,7 @@ exports.getInvoicingQboAccountOptions = (0, toolkit_1.createSelector)([
|
|
|
115
115
|
{
|
|
116
116
|
id: String(account.qboId),
|
|
117
117
|
name: account.accountName,
|
|
118
|
+
accountSubType: account.accountSubType,
|
|
118
119
|
accountType: account.accountType,
|
|
119
120
|
},
|
|
120
121
|
];
|
|
@@ -138,22 +139,29 @@ const normalizeAccountTypeName = (value) => {
|
|
|
138
139
|
// trailing "s" alone would leave "liabilitie", matching nothing.
|
|
139
140
|
return normalized.replace(/ies$/, 'y').replace(/([^s])s$/, '$1');
|
|
140
141
|
};
|
|
142
|
+
const toAccountTypeNameSet = (names) => new Set((names ?? '')
|
|
143
|
+
.split(',')
|
|
144
|
+
.map(normalizeAccountTypeName)
|
|
145
|
+
.filter((name) => name !== ''));
|
|
141
146
|
/**
|
|
142
147
|
* The accounts valid for one QBO mapping kind, whose `accountTypes` is a
|
|
143
148
|
* comma-separated list of QuickBooks type names. An unrecognised list yields no
|
|
144
149
|
* accounts rather than every account: offering a bank account where income is
|
|
145
150
|
* required would post a mapping QuickBooks rejects.
|
|
151
|
+
*
|
|
152
|
+
* `excludedAccountSubTypes` drops accounts QuickBooks will not post to for that
|
|
153
|
+
* kind even though their type matches, e.g. a tax agency's system payable for
|
|
154
|
+
* the sales tax liability.
|
|
146
155
|
*/
|
|
147
|
-
const invoicingAccountsForQboAccountTypes = (accounts, accountTypes) => {
|
|
148
|
-
const wanted =
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
.
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
wanted.has(normalizeAccountTypeName(account.accountType)));
|
|
156
|
+
const invoicingAccountsForQboAccountTypes = (accounts, accountTypes, excludedAccountSubTypes) => {
|
|
157
|
+
const wanted = toAccountTypeNameSet(accountTypes);
|
|
158
|
+
const excluded = toAccountTypeNameSet(excludedAccountSubTypes);
|
|
159
|
+
return accounts.filter((account) => (wanted.size === 0 ||
|
|
160
|
+
(account.accountType != null &&
|
|
161
|
+
wanted.has(normalizeAccountTypeName(account.accountType)))) &&
|
|
162
|
+
(excluded.size === 0 ||
|
|
163
|
+
account.accountSubType == null ||
|
|
164
|
+
!excluded.has(normalizeAccountTypeName(account.accountSubType))));
|
|
157
165
|
};
|
|
158
166
|
exports.invoicingAccountsForQboAccountTypes = invoicingAccountsForQboAccountTypes;
|
|
159
167
|
/**
|
|
@@ -182,8 +190,8 @@ exports.INVOICING_DEFAULT_INCOME_ACCOUNT_TYPES = 'Income';
|
|
|
182
190
|
* not carry falls back to `defaultAccountTypes` rather than to every account.
|
|
183
191
|
*/
|
|
184
192
|
const invoicingQboAccountIdsForMappingSlot = (accounts, accountMappingKindOptions, mappingSlot, defaultAccountTypes) => {
|
|
185
|
-
const
|
|
186
|
-
return (0, exports.invoicingAccountsForQboAccountTypes)(accounts, accountTypes).map((account) => account.id);
|
|
193
|
+
const kindOption = accountMappingKindOptions.find((option) => (0, invoicingCommonPayload_1.toInvoicingQboAccountMappingSlot)(option.code) === mappingSlot);
|
|
194
|
+
return (0, exports.invoicingAccountsForQboAccountTypes)(accounts, kindOption?.accountTypes ?? defaultAccountTypes, kindOption?.excludedAccountSubTypes).map((account) => account.id);
|
|
187
195
|
};
|
|
188
196
|
exports.invoicingQboAccountIdsForMappingSlot = invoicingQboAccountIdsForMappingSlot;
|
|
189
197
|
/**
|
|
@@ -18,6 +18,11 @@ const entityToInvoicingQboSettingsLocalData = (qbo) => {
|
|
|
18
18
|
// Keyed by the slot the payload used, which is the config code the page will
|
|
19
19
|
// ask for — the reader tolerates the older `_id` form on the way in.
|
|
20
20
|
Object.keys(accountMappings).forEach((key) => {
|
|
21
|
+
// Display-only, so it is never edited or written back on save.
|
|
22
|
+
if ((0, invoicingCommonPayload_1.toInvoicingQboAccountMappingSlot)(key) ===
|
|
23
|
+
invoicingCommonPayload_1.INVOICING_QBO_SALES_TAX_POSTING_ACCOUNT_SLOT) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
21
26
|
const accountId = (0, invoicingCommonPayload_1.getInvoicingQboAccountMappingId)(accountMappings, key);
|
|
22
27
|
if (accountId != null) {
|
|
23
28
|
accountIdByMappingCode[(0, invoicingCommonPayload_1.toInvoicingQboAccountMappingSlot)(key)] = accountId;
|
|
@@ -3,6 +3,7 @@ var _a;
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.invoicingStripeConnectionFailure = exports.updateInvoicingStripeConnection = exports.disconnectInvoicingStripe = exports.connectInvoicingStripe = exports.resetInvoicingQboSettingsDraft = exports.submitInvoicingQboSettings = exports.updateInvoicingQboSettingsDraft = exports.resetInvoicingBrandingFormDraft = exports.submitInvoicingBrandingForm = exports.updateInvoicingBrandingFormDraft = exports.resetSaveInvoicingSettings = exports.saveInvoicingSettingsFailure = exports.saveInvoicingSettingsSuccess = exports.saveInvoicingSettings = exports.updateInvoicingSettingsFailure = exports.updateInvoicingSettings = exports.fetchInvoicingSettings = exports.initialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
const invoicingCommonPayload_1 = require("../../../entity/invoicing/invoicingCommonPayload");
|
|
6
7
|
const rootActions_1 = require("../../../rootActions");
|
|
7
8
|
const invoicingQboSettingsFormConfig_1 = require("./invoicingQboSettingsFormConfig");
|
|
8
9
|
exports.initialState = {
|
|
@@ -44,7 +45,24 @@ const settingsView = (0, toolkit_1.createSlice)({
|
|
|
44
45
|
saveInvoicingSettings(draft, action) {
|
|
45
46
|
draft.saveFetchState = { fetchState: 'In-Progress', error: undefined };
|
|
46
47
|
if (draft.settings != null) {
|
|
47
|
-
|
|
48
|
+
// The display-only sales tax posting account is never in a save body,
|
|
49
|
+
// so carry it over rather than blank it until the response lands.
|
|
50
|
+
const postingAccount = draft.settings.qbo?.account_mappings?.[invoicingCommonPayload_1.INVOICING_QBO_SALES_TAX_POSTING_ACCOUNT_SLOT];
|
|
51
|
+
const settings = { ...draft.settings, ...action.payload.settings };
|
|
52
|
+
const accountMappings = settings.qbo?.account_mappings;
|
|
53
|
+
draft.settings =
|
|
54
|
+
postingAccount != null && accountMappings != null
|
|
55
|
+
? {
|
|
56
|
+
...settings,
|
|
57
|
+
qbo: {
|
|
58
|
+
...settings.qbo,
|
|
59
|
+
account_mappings: {
|
|
60
|
+
...accountMappings,
|
|
61
|
+
[invoicingCommonPayload_1.INVOICING_QBO_SALES_TAX_POSTING_ACCOUNT_SLOT]: postingAccount,
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
}
|
|
65
|
+
: settings;
|
|
48
66
|
}
|
|
49
67
|
},
|
|
50
68
|
saveInvoicingSettingsSuccess(draft, action) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NestedAccountHierarchyForReport } from '../../../commonStateTypes/accountView/nestedAccountID';
|
|
2
2
|
import { FetchState, FetchStateAndError } from '../../../commonStateTypes/common';
|
|
3
|
-
import { InvoicingDunningActionOption, InvoicingFieldHelpByCode, InvoicingNamedOption, InvoicingQboAccountMappingKindOption, InvoicingSettingsPayload } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
4
3
|
import { File } from '../../../entity/file/fileState';
|
|
4
|
+
import { InvoicingDunningActionOption, InvoicingFieldHelpByCode, InvoicingNamedOption, InvoicingQboAccountMappingKindOption, InvoicingSettingsPayload } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
5
5
|
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
6
6
|
import { RootState } from '../../../rootStateTypes';
|
|
7
7
|
import { AddressUpdatableInfo } from '../../addressView/addressViewState';
|
|
@@ -120,6 +120,8 @@ export interface InvoicingQboSettingsFormView {
|
|
|
120
120
|
settingsFetchState: FetchState;
|
|
121
121
|
syncStatusOptions: InvoicingNamedOption[];
|
|
122
122
|
connection?: InvoicingQboConnection;
|
|
123
|
+
/** The Zeni-owned account sales tax posts to, shown read-only when present. */
|
|
124
|
+
salesTaxPostingAccountName?: string;
|
|
123
125
|
syncHealth?: InvoicingQboSyncHealth;
|
|
124
126
|
}
|
|
125
127
|
/**
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getInvoicingBrandingFormView = exports.getInvoicingQboSettingsFormView = exports.getInvoicingSettingsHubView = exports.getInvoicingSettingsView = exports.getInvoicingSettingsFetchState = exports.getInvoicingSettings = void 0;
|
|
4
4
|
exports.deriveInvoicingEnablePrerequisites = deriveInvoicingEnablePrerequisites;
|
|
5
|
-
const invoicingCommonPayload_1 = require("../../../entity/invoicing/invoicingCommonPayload");
|
|
6
5
|
const addressSelector_1 = require("../../../entity/address/addressSelector");
|
|
7
6
|
const fileSelector_1 = require("../../../entity/file/fileSelector");
|
|
7
|
+
const invoicingCommonPayload_1 = require("../../../entity/invoicing/invoicingCommonPayload");
|
|
8
8
|
const addressViewSelector_1 = require("../../addressView/addressViewSelector");
|
|
9
9
|
const invoicingConfigViewSelector_1 = require("../invoicingConfigView/invoicingConfigViewSelector");
|
|
10
10
|
const invoicingQboViewSelector_1 = require("../invoicingQboView/invoicingQboViewSelector");
|
|
@@ -110,6 +110,19 @@ const getInvoicingSettingsHubView = (state) => {
|
|
|
110
110
|
};
|
|
111
111
|
};
|
|
112
112
|
exports.getInvoicingSettingsHubView = getInvoicingSettingsHubView;
|
|
113
|
+
/**
|
|
114
|
+
* The name of the account the service posts sales tax to. Read from the whole
|
|
115
|
+
* account the settings carry, or looked up by id in the account list for a
|
|
116
|
+
* payload that sends only the id.
|
|
117
|
+
*/
|
|
118
|
+
const invoicingSalesTaxPostingAccountName = (accountMappings, accounts) => {
|
|
119
|
+
const slot = accountMappings?.[invoicingCommonPayload_1.INVOICING_QBO_SALES_TAX_POSTING_ACCOUNT_SLOT];
|
|
120
|
+
const name = typeof slot === 'string'
|
|
121
|
+
? accounts.find((account) => account.id === slot)?.name
|
|
122
|
+
: slot?.account_name;
|
|
123
|
+
const trimmed = name?.trim() ?? '';
|
|
124
|
+
return trimmed !== '' ? trimmed : undefined;
|
|
125
|
+
};
|
|
113
126
|
/**
|
|
114
127
|
* Bundled view for the QBO configuration page: the draft it edits, the accounts
|
|
115
128
|
* and option lists its dropdowns render, the connection and sync health it
|
|
@@ -143,6 +156,7 @@ const getInvoicingQboSettingsFormView = (state) => {
|
|
|
143
156
|
localData: qboDraft ?? invoicingQboSettingsFormConfig_1.initialInvoicingQboSettingsLocalData,
|
|
144
157
|
nestedAccountHierarchy: qboView.nestedAccountHierarchy,
|
|
145
158
|
retryFetchStateByTaskId: qboView.retryFetchStateByTaskId,
|
|
159
|
+
salesTaxPostingAccountName: invoicingSalesTaxPostingAccountName(settings?.qbo?.account_mappings, qboView.accounts),
|
|
146
160
|
saveState: saveFetchState.fetchState === 'Not-Started' && error != null
|
|
147
161
|
? { fetchState, error }
|
|
148
162
|
: saveFetchState,
|
|
@@ -54,6 +54,8 @@ function toSaveNotificationSettingsPayload(localData, notificationSettingsData)
|
|
|
54
54
|
pending_bill_approval_notification: null,
|
|
55
55
|
pending_reimbursement_approval_notification: null,
|
|
56
56
|
is_pending_reimbursement_approval_notification_active: null,
|
|
57
|
+
is_pending_task_notification_active: null,
|
|
58
|
+
pending_task_notification: null,
|
|
57
59
|
is_month_end_insights_active: monthEndInsightsNotificationSettings.enabled != null
|
|
58
60
|
? monthEndInsights.notify
|
|
59
61
|
: null,
|
|
@@ -81,5 +83,10 @@ function toSaveNotificationSettingsPayload(localData, notificationSettingsData)
|
|
|
81
83
|
0;
|
|
82
84
|
payload.pending_reimbursement_approval_notification = toRemindersPayload(reminders.pendingReimbursementApprovalNotification);
|
|
83
85
|
}
|
|
86
|
+
if (reminderNotificationSettings.pendingTaskNotification != null) {
|
|
87
|
+
payload.is_pending_task_notification_active =
|
|
88
|
+
reminders.pendingTaskNotification.preferredMode.length > 0;
|
|
89
|
+
payload.pending_task_notification = toRemindersPayload(reminders.pendingTaskNotification);
|
|
90
|
+
}
|
|
84
91
|
return payload;
|
|
85
92
|
}
|
|
@@ -153,6 +153,7 @@ const isRemindersSectionVisibleOnSettingsPage = (reminderNotificationSettings) =
|
|
|
153
153
|
reminderNotificationSettings.pendingBillApprovalNotification != null ||
|
|
154
154
|
reminderNotificationSettings.pendingReimbursementApprovalNotification !=
|
|
155
155
|
null ||
|
|
156
|
+
reminderNotificationSettings.pendingTaskNotification != null ||
|
|
156
157
|
reminderNotificationSettings.uncategorizedTransactionNotification != null);
|
|
157
158
|
};
|
|
158
159
|
exports.isRemindersSectionVisibleOnSettingsPage = isRemindersSectionVisibleOnSettingsPage;
|
|
@@ -32,10 +32,12 @@ export interface NotificationSettingsPayload {
|
|
|
32
32
|
is_month_end_insights_active: boolean | null;
|
|
33
33
|
is_pending_bill_approval_notification_active: boolean | null;
|
|
34
34
|
is_pending_reimbursement_approval_notification_active: boolean | null;
|
|
35
|
+
is_pending_task_notification_active: boolean | null;
|
|
35
36
|
is_uncategorized_transaction_notification_active: boolean | null;
|
|
36
37
|
missing_receipt_notification: RemindersPayload | null;
|
|
37
38
|
pending_bill_approval_notification: RemindersPayload | null;
|
|
38
39
|
pending_reimbursement_approval_notification: RemindersPayload | null;
|
|
40
|
+
pending_task_notification: RemindersPayload | null;
|
|
39
41
|
uncategorized_transaction_notification: RemindersPayload | null;
|
|
40
42
|
month_end_email_recipient_email_ids?: string[];
|
|
41
43
|
task_checklist_preferences?: NotificationPreferencesPayload;
|
|
@@ -8,6 +8,7 @@ const settingsViewState_1 = require("./settingsViewState");
|
|
|
8
8
|
const initialNotificationSettingsData = {
|
|
9
9
|
reminderNotificationSettings: {
|
|
10
10
|
missingReceiptNotification: null,
|
|
11
|
+
pendingTaskNotification: null,
|
|
11
12
|
uncategorizedTransactionNotification: null,
|
|
12
13
|
pendingBillApprovalNotification: null,
|
|
13
14
|
pendingReimbursementApprovalNotification: null,
|
|
@@ -48,6 +49,7 @@ const initialNotificationSettingsLocalData = {
|
|
|
48
49
|
missingReceiptNotification: initialRemindersLocalData,
|
|
49
50
|
pendingBillApprovalNotification: initialRemindersLocalData,
|
|
50
51
|
pendingReimbursementApprovalNotification: initialRemindersLocalData,
|
|
52
|
+
pendingTaskNotification: initialRemindersLocalData,
|
|
51
53
|
uncategorizedTransactionNotification: initialRemindersLocalData,
|
|
52
54
|
},
|
|
53
55
|
};
|
|
@@ -377,7 +379,7 @@ function toRemindersLocalData(reminderNotificationSettingDetails) {
|
|
|
377
379
|
}
|
|
378
380
|
const toNotificationSettingsLocalData = (data, loggedInUserEmail) => {
|
|
379
381
|
const { monthEndInsightsNotificationSettings, reminderNotificationSettings } = data;
|
|
380
|
-
const { missingReceiptNotification, pendingBillApprovalNotification, pendingReimbursementApprovalNotification, uncategorizedTransactionNotification, } = reminderNotificationSettings;
|
|
382
|
+
const { missingReceiptNotification, pendingBillApprovalNotification, pendingReimbursementApprovalNotification, pendingTaskNotification, uncategorizedTransactionNotification, } = reminderNotificationSettings;
|
|
381
383
|
return {
|
|
382
384
|
monthEndInsights: {
|
|
383
385
|
notify: monthEndInsightsNotificationSettings.enabled ??
|
|
@@ -388,10 +390,22 @@ const toNotificationSettingsLocalData = (data, loggedInUserEmail) => {
|
|
|
388
390
|
missingReceiptNotification: toRemindersLocalData(missingReceiptNotification),
|
|
389
391
|
pendingBillApprovalNotification: toRemindersLocalData(pendingBillApprovalNotification),
|
|
390
392
|
pendingReimbursementApprovalNotification: toRemindersLocalData(pendingReimbursementApprovalNotification),
|
|
393
|
+
pendingTaskNotification: toRemindersLocalData(pendingTaskNotification),
|
|
391
394
|
uncategorizedTransactionNotification: toRemindersLocalData(uncategorizedTransactionNotification),
|
|
392
395
|
},
|
|
393
396
|
};
|
|
394
397
|
};
|
|
398
|
+
function toPendingTaskNotificationActive(data) {
|
|
399
|
+
if (data.is_pending_task_notification_active != null) {
|
|
400
|
+
return data.is_pending_task_notification_active;
|
|
401
|
+
}
|
|
402
|
+
// Rows saved before this flag existed store null. It shares the
|
|
403
|
+
// transactions-reminder scope with missing receipts and uncategorized
|
|
404
|
+
// transactions, so a set sibling means the user has access.
|
|
405
|
+
const hasTransactionReminderAccess = data.is_missing_receipt_notification_active != null ||
|
|
406
|
+
data.is_uncategorized_transaction_notification_active != null;
|
|
407
|
+
return hasTransactionReminderAccess ? false : null;
|
|
408
|
+
}
|
|
395
409
|
function toReminderNotificationSettingsDetails(isNotificationActive, remindersPayload) {
|
|
396
410
|
if (isNotificationActive != null) {
|
|
397
411
|
return {
|
|
@@ -412,6 +426,7 @@ const toNotificationSettings = (data) => {
|
|
|
412
426
|
missingReceiptNotification: toReminderNotificationSettingsDetails(data.is_missing_receipt_notification_active, data.missing_receipt_notification),
|
|
413
427
|
pendingBillApprovalNotification: toReminderNotificationSettingsDetails(data.is_pending_bill_approval_notification_active, data.pending_bill_approval_notification),
|
|
414
428
|
pendingReimbursementApprovalNotification: toReminderNotificationSettingsDetails(data.is_pending_reimbursement_approval_notification_active, data.pending_reimbursement_approval_notification),
|
|
429
|
+
pendingTaskNotification: toReminderNotificationSettingsDetails(toPendingTaskNotificationActive(data), data.pending_task_notification),
|
|
415
430
|
uncategorizedTransactionNotification: toReminderNotificationSettingsDetails(data.is_uncategorized_transaction_notification_active, data.uncategorized_transaction_notification),
|
|
416
431
|
},
|
|
417
432
|
monthEndInsightsNotificationSettings: {
|
|
@@ -9,8 +9,8 @@ interface BillingAddress extends FetchStateAndError {
|
|
|
9
9
|
export interface IntegrationsSettings {
|
|
10
10
|
refreshQBO: FetchStateAndError;
|
|
11
11
|
}
|
|
12
|
-
export declare const REMINDER_NOTIFICATION_TYPES: readonly ["missingReceiptNotification", "uncategorizedTransactionNotification", "pendingBillApprovalNotification", "pendingReimbursementApprovalNotification"];
|
|
13
|
-
declare const toReminderTypeKey: (v: string) => "missingReceiptNotification" | "uncategorizedTransactionNotification" | "pendingBillApprovalNotification" | "pendingReimbursementApprovalNotification";
|
|
12
|
+
export declare const REMINDER_NOTIFICATION_TYPES: readonly ["missingReceiptNotification", "pendingTaskNotification", "uncategorizedTransactionNotification", "pendingBillApprovalNotification", "pendingReimbursementApprovalNotification"];
|
|
13
|
+
declare const toReminderTypeKey: (v: string) => "missingReceiptNotification" | "pendingTaskNotification" | "uncategorizedTransactionNotification" | "pendingBillApprovalNotification" | "pendingReimbursementApprovalNotification";
|
|
14
14
|
export type ReminderTypeKey = ReturnType<typeof toReminderTypeKey>;
|
|
15
15
|
export declare const toRemindersFrequencyType: (v: string) => "weekly" | "monthly" | "daily" | "bi-weekly";
|
|
16
16
|
export type FrequencyTypeKey = ReturnType<typeof toRemindersFrequencyType>;
|
|
@@ -4,6 +4,7 @@ exports.toNotificationMode = exports.NOTIFICATION_MODES = exports.toRemindersFre
|
|
|
4
4
|
const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
|
|
5
5
|
exports.REMINDER_NOTIFICATION_TYPES = [
|
|
6
6
|
'missingReceiptNotification',
|
|
7
|
+
'pendingTaskNotification',
|
|
7
8
|
'uncategorizedTransactionNotification',
|
|
8
9
|
'pendingBillApprovalNotification',
|
|
9
10
|
'pendingReimbursementApprovalNotification',
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Recommendation, RecommendationWithCOT } from '../../../commonStateTypes/recommendationBase';
|
|
2
|
+
import { TransactionCategory } from '../../../entity/transaction/stateTypes/transactionType';
|
|
3
|
+
import { CreatableTransactionType, CreateTransactionLineLocalData, CreateTransactionLocalData, CreateTransactionLocalDataByType } from './createTransactionState';
|
|
4
|
+
export declare const nextCreateTransactionLineId: () => string;
|
|
5
|
+
/** Test-only: makes line ids predictable from the start of each case. */
|
|
6
|
+
export declare const resetCreateTransactionLineIdCounter: () => void;
|
|
7
|
+
export declare const createEmptyCreateTransactionLine: (postingType?: TransactionCategory) => CreateTransactionLineLocalData;
|
|
8
|
+
/**
|
|
9
|
+
* The lines a freshly-opened form starts with. A journal entry is invalid with fewer than one
|
|
10
|
+
* debit and one credit, so it opens with both rather than making the user add the second row.
|
|
11
|
+
* Transfer has no lines at all.
|
|
12
|
+
*/
|
|
13
|
+
export declare const getDefaultCreateTransactionLines: (transactionType: CreatableTransactionType) => CreateTransactionLineLocalData[];
|
|
14
|
+
/**
|
|
15
|
+
* A blank working copy for one type. Note this does NOT seed the date -- the reducer's initial
|
|
16
|
+
* state has to stay a pure constant so `clearAll` restores something stable. The date is seeded
|
|
17
|
+
* by initializeCreateTransactionLocalDataEpic, which runs when the form opens.
|
|
18
|
+
*/
|
|
19
|
+
export declare const getEmptyCreateTransactionLocalData: (transactionType: CreatableTransactionType) => CreateTransactionLocalData;
|
|
20
|
+
export declare const getInitialCreateTransactionLocalDataByType: () => CreateTransactionLocalDataByType;
|
|
21
|
+
/**
|
|
22
|
+
* What the form opens with: a blank copy plus today's date, the default line set, and the
|
|
23
|
+
* payment_type the backend insists on for the type.
|
|
24
|
+
*/
|
|
25
|
+
export declare const getSeededCreateTransactionLocalData: (transactionType: CreatableTransactionType) => CreateTransactionLocalData;
|
|
26
|
+
/**
|
|
27
|
+
* Merges a partial edit into the working copy. Lines are replaced wholesale when present --
|
|
28
|
+
* a partial line array would silently truncate the form.
|
|
29
|
+
*/
|
|
30
|
+
export declare const mergeCreateTransactionLocalData: (current: CreateTransactionLocalData, update: Partial<CreateTransactionLocalData>) => CreateTransactionLocalData;
|
|
31
|
+
/**
|
|
32
|
+
* A user edit to a prefilled account or class makes it theirs, so its flag is dropped and a
|
|
33
|
+
* later vendor switch no longer clears it.
|
|
34
|
+
*/
|
|
35
|
+
export declare const updateCreateTransactionLine: (lines: CreateTransactionLineLocalData[], lineId: string, update: Partial<CreateTransactionLineLocalData>) => CreateTransactionLineLocalData[];
|
|
36
|
+
/**
|
|
37
|
+
* Recommendation -> RecommendationWithCOT. Chain-of-thought and recommendation feedback both
|
|
38
|
+
* need an existing transaction, so cot/reasoning are empty here by design; the dropdown only
|
|
39
|
+
* needs the entities to build its "Recommended" group.
|
|
40
|
+
*/
|
|
41
|
+
export declare const toRecommendationsWithCOT: (recommendations: Recommendation[]) => RecommendationWithCOT[];
|
|
42
|
+
/**
|
|
43
|
+
* Applies a vendor's recommendations to one line: always refreshes the dropdown's "Recommended"
|
|
44
|
+
* group, but only prefills account/class when the field is still empty. Callers switching
|
|
45
|
+
* vendors clear the previous prefill first, so "empty" includes what the last vendor filled. Anything the user
|
|
46
|
+
* picked wins -- this follows the transaction-categorization helper, which prefills, rather
|
|
47
|
+
* than the detail-page helper, which only suggests.
|
|
48
|
+
*/
|
|
49
|
+
export declare const applyRecommendationsToCreateTransactionLine: (line: CreateTransactionLineLocalData, recommendations: Recommendation[], isAccountingClassesEnabled: boolean) => CreateTransactionLineLocalData;
|
|
50
|
+
/**
|
|
51
|
+
* Undoes a prefill when the vendor is cleared. Only the fields the prefill wrote are removed --
|
|
52
|
+
* the per-field flags are what make the user's own choices distinguishable from ours, which is
|
|
53
|
+
* why they are not a single line-level boolean: a hand-picked account alongside a prefilled
|
|
54
|
+
* class is an ordinary state, and clearing must not take the account with it.
|
|
55
|
+
*/
|
|
56
|
+
export declare const clearRecommendationsFromCreateTransactionLine: (line: CreateTransactionLineLocalData) => CreateTransactionLineLocalData;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.clearRecommendationsFromCreateTransactionLine = exports.applyRecommendationsToCreateTransactionLine = exports.toRecommendationsWithCOT = exports.updateCreateTransactionLine = exports.mergeCreateTransactionLocalData = exports.getSeededCreateTransactionLocalData = exports.getInitialCreateTransactionLocalDataByType = exports.getEmptyCreateTransactionLocalData = exports.getDefaultCreateTransactionLines = exports.createEmptyCreateTransactionLine = exports.resetCreateTransactionLineIdCounter = exports.nextCreateTransactionLineId = void 0;
|
|
4
|
+
const zeniDayJS_1 = require("../../../zeniDayJS");
|
|
5
|
+
const createTransactionState_1 = require("./createTransactionState");
|
|
6
|
+
/**
|
|
7
|
+
* Monotonic counter for line row keys. These never leave the client -- the payload builder
|
|
8
|
+
* drops them -- so a counter is enough, and it keeps reducer tests deterministic in a way
|
|
9
|
+
* randomUUID would not.
|
|
10
|
+
*/
|
|
11
|
+
let lineIdCounter = 0;
|
|
12
|
+
const nextCreateTransactionLineId = () => `create-transaction-line-${lineIdCounter++}`;
|
|
13
|
+
exports.nextCreateTransactionLineId = nextCreateTransactionLineId;
|
|
14
|
+
/** Test-only: makes line ids predictable from the start of each case. */
|
|
15
|
+
const resetCreateTransactionLineIdCounter = () => {
|
|
16
|
+
lineIdCounter = 0;
|
|
17
|
+
};
|
|
18
|
+
exports.resetCreateTransactionLineIdCounter = resetCreateTransactionLineIdCounter;
|
|
19
|
+
const createEmptyCreateTransactionLine = (postingType) => ({
|
|
20
|
+
id: (0, exports.nextCreateTransactionLineId)(),
|
|
21
|
+
postingType,
|
|
22
|
+
});
|
|
23
|
+
exports.createEmptyCreateTransactionLine = createEmptyCreateTransactionLine;
|
|
24
|
+
/**
|
|
25
|
+
* The lines a freshly-opened form starts with. A journal entry is invalid with fewer than one
|
|
26
|
+
* debit and one credit, so it opens with both rather than making the user add the second row.
|
|
27
|
+
* Transfer has no lines at all.
|
|
28
|
+
*/
|
|
29
|
+
const getDefaultCreateTransactionLines = (transactionType) => {
|
|
30
|
+
if (transactionType === 'transfer') {
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
if (transactionType === 'journal_entry') {
|
|
34
|
+
return [
|
|
35
|
+
(0, exports.createEmptyCreateTransactionLine)('debit'),
|
|
36
|
+
(0, exports.createEmptyCreateTransactionLine)('credit'),
|
|
37
|
+
];
|
|
38
|
+
}
|
|
39
|
+
return [(0, exports.createEmptyCreateTransactionLine)()];
|
|
40
|
+
};
|
|
41
|
+
exports.getDefaultCreateTransactionLines = getDefaultCreateTransactionLines;
|
|
42
|
+
/**
|
|
43
|
+
* A blank working copy for one type. Note this does NOT seed the date -- the reducer's initial
|
|
44
|
+
* state has to stay a pure constant so `clearAll` restores something stable. The date is seeded
|
|
45
|
+
* by initializeCreateTransactionLocalDataEpic, which runs when the form opens.
|
|
46
|
+
*/
|
|
47
|
+
const getEmptyCreateTransactionLocalData = (transactionType) => ({
|
|
48
|
+
lines: [],
|
|
49
|
+
transactionType,
|
|
50
|
+
});
|
|
51
|
+
exports.getEmptyCreateTransactionLocalData = getEmptyCreateTransactionLocalData;
|
|
52
|
+
const getInitialCreateTransactionLocalDataByType = () => createTransactionState_1.ALL_CREATABLE_TRANSACTION_TYPES.reduce((acc, transactionType) => {
|
|
53
|
+
acc[transactionType] =
|
|
54
|
+
(0, exports.getEmptyCreateTransactionLocalData)(transactionType);
|
|
55
|
+
return acc;
|
|
56
|
+
}, {});
|
|
57
|
+
exports.getInitialCreateTransactionLocalDataByType = getInitialCreateTransactionLocalDataByType;
|
|
58
|
+
/**
|
|
59
|
+
* The payment_type the backend insists on for some types: a check needs `check`, and a
|
|
60
|
+
* credit_card_credit (sent as expense + is_credit) needs a card type -- qbo_purchase.py raises
|
|
61
|
+
* without them.
|
|
62
|
+
*/
|
|
63
|
+
const SEEDED_PAYMENT_TYPE = {
|
|
64
|
+
check: 'check',
|
|
65
|
+
credit_card_credit: 'credit_card',
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* What the form opens with: a blank copy plus today's date, the default line set, and the
|
|
69
|
+
* payment_type the backend insists on for the type.
|
|
70
|
+
*/
|
|
71
|
+
const getSeededCreateTransactionLocalData = (transactionType) => ({
|
|
72
|
+
...(0, exports.getEmptyCreateTransactionLocalData)(transactionType),
|
|
73
|
+
lines: (0, exports.getDefaultCreateTransactionLines)(transactionType),
|
|
74
|
+
paymentType: SEEDED_PAYMENT_TYPE[transactionType],
|
|
75
|
+
transactionDate: (0, zeniDayJS_1.dateNow)(),
|
|
76
|
+
});
|
|
77
|
+
exports.getSeededCreateTransactionLocalData = getSeededCreateTransactionLocalData;
|
|
78
|
+
/**
|
|
79
|
+
* Merges a partial edit into the working copy. Lines are replaced wholesale when present --
|
|
80
|
+
* a partial line array would silently truncate the form.
|
|
81
|
+
*/
|
|
82
|
+
const mergeCreateTransactionLocalData = (current, update) => ({
|
|
83
|
+
...current,
|
|
84
|
+
...update,
|
|
85
|
+
lines: update.lines ?? current.lines,
|
|
86
|
+
// The type is keyed by the slice, never edited through a merge.
|
|
87
|
+
transactionType: current.transactionType,
|
|
88
|
+
});
|
|
89
|
+
exports.mergeCreateTransactionLocalData = mergeCreateTransactionLocalData;
|
|
90
|
+
/**
|
|
91
|
+
* A user edit to a prefilled account or class makes it theirs, so its flag is dropped and a
|
|
92
|
+
* later vendor switch no longer clears it.
|
|
93
|
+
*/
|
|
94
|
+
const updateCreateTransactionLine = (lines, lineId, update) => lines.map((line) => line.id === lineId
|
|
95
|
+
? {
|
|
96
|
+
...line,
|
|
97
|
+
...update,
|
|
98
|
+
id: line.id,
|
|
99
|
+
isAccountPreFilled: 'accountQboId' in update ? undefined : line.isAccountPreFilled,
|
|
100
|
+
isClassPreFilled: 'classId' in update ? undefined : line.isClassPreFilled,
|
|
101
|
+
}
|
|
102
|
+
: line);
|
|
103
|
+
exports.updateCreateTransactionLine = updateCreateTransactionLine;
|
|
104
|
+
/**
|
|
105
|
+
* Recommendation -> RecommendationWithCOT. Chain-of-thought and recommendation feedback both
|
|
106
|
+
* need an existing transaction, so cot/reasoning are empty here by design; the dropdown only
|
|
107
|
+
* needs the entities to build its "Recommended" group.
|
|
108
|
+
*/
|
|
109
|
+
const toRecommendationsWithCOT = (recommendations) => recommendations.map((recommendation) => ({
|
|
110
|
+
account: recommendation.account != null
|
|
111
|
+
? { ...recommendation.account, cot: [], reasoning: '' }
|
|
112
|
+
: undefined,
|
|
113
|
+
class: recommendation.class != null
|
|
114
|
+
? { ...recommendation.class, cot: [], reasoning: '' }
|
|
115
|
+
: undefined,
|
|
116
|
+
vendor: recommendation.vendor != null
|
|
117
|
+
? { ...recommendation.vendor, cot: [], reasoning: '' }
|
|
118
|
+
: undefined,
|
|
119
|
+
}));
|
|
120
|
+
exports.toRecommendationsWithCOT = toRecommendationsWithCOT;
|
|
121
|
+
/**
|
|
122
|
+
* Applies a vendor's recommendations to one line: always refreshes the dropdown's "Recommended"
|
|
123
|
+
* group, but only prefills account/class when the field is still empty. Callers switching
|
|
124
|
+
* vendors clear the previous prefill first, so "empty" includes what the last vendor filled. Anything the user
|
|
125
|
+
* picked wins -- this follows the transaction-categorization helper, which prefills, rather
|
|
126
|
+
* than the detail-page helper, which only suggests.
|
|
127
|
+
*/
|
|
128
|
+
const applyRecommendationsToCreateTransactionLine = (line, recommendations, isAccountingClassesEnabled) => {
|
|
129
|
+
const top = recommendations[0];
|
|
130
|
+
const updated = {
|
|
131
|
+
...line,
|
|
132
|
+
recommendationsWithCOT: (0, exports.toRecommendationsWithCOT)(recommendations),
|
|
133
|
+
};
|
|
134
|
+
if (line.accountQboId == null && top?.account?.qboId != null) {
|
|
135
|
+
updated.accountQboId = top.account.qboId;
|
|
136
|
+
updated.accountName = top.account.accountName;
|
|
137
|
+
updated.isAccountPreFilled = true;
|
|
138
|
+
}
|
|
139
|
+
if (isAccountingClassesEnabled &&
|
|
140
|
+
line.classId == null &&
|
|
141
|
+
top?.class?.classId != null) {
|
|
142
|
+
updated.classId = top.class.classId;
|
|
143
|
+
updated.className = top.class.className;
|
|
144
|
+
updated.isClassPreFilled = true;
|
|
145
|
+
}
|
|
146
|
+
return updated;
|
|
147
|
+
};
|
|
148
|
+
exports.applyRecommendationsToCreateTransactionLine = applyRecommendationsToCreateTransactionLine;
|
|
149
|
+
/**
|
|
150
|
+
* Undoes a prefill when the vendor is cleared. Only the fields the prefill wrote are removed --
|
|
151
|
+
* the per-field flags are what make the user's own choices distinguishable from ours, which is
|
|
152
|
+
* why they are not a single line-level boolean: a hand-picked account alongside a prefilled
|
|
153
|
+
* class is an ordinary state, and clearing must not take the account with it.
|
|
154
|
+
*/
|
|
155
|
+
const clearRecommendationsFromCreateTransactionLine = (line) => {
|
|
156
|
+
const cleared = {
|
|
157
|
+
...line,
|
|
158
|
+
recommendationsWithCOT: undefined,
|
|
159
|
+
};
|
|
160
|
+
if (line.isAccountPreFilled === true) {
|
|
161
|
+
cleared.accountQboId = undefined;
|
|
162
|
+
cleared.accountName = undefined;
|
|
163
|
+
cleared.isAccountPreFilled = undefined;
|
|
164
|
+
}
|
|
165
|
+
if (line.isClassPreFilled === true) {
|
|
166
|
+
cleared.classId = undefined;
|
|
167
|
+
cleared.className = undefined;
|
|
168
|
+
cleared.isClassPreFilled = undefined;
|
|
169
|
+
}
|
|
170
|
+
return cleared;
|
|
171
|
+
};
|
|
172
|
+
exports.clearRecommendationsFromCreateTransactionLine = clearRecommendationsFromCreateTransactionLine;
|