@zeniai/client-epic-state 5.2.90 → 5.2.92

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  2. package/lib/entity/snackbar/snackbarTypes.js +1 -0
  3. package/lib/entity/transaction/stateTypes/paymentType.d.ts +2 -2
  4. package/lib/entity/transaction/stateTypes/paymentType.js +9 -1
  5. package/lib/entity/transaction/stateTypes/printStatus.d.ts +4 -0
  6. package/lib/entity/transaction/stateTypes/printStatus.js +11 -0
  7. package/lib/epic.d.ts +5 -1
  8. package/lib/epic.js +8 -0
  9. package/lib/esm/entity/snackbar/snackbarTypes.js +1 -0
  10. package/lib/esm/entity/transaction/stateTypes/paymentType.js +9 -1
  11. package/lib/esm/entity/transaction/stateTypes/printStatus.js +7 -0
  12. package/lib/esm/epic.js +8 -0
  13. package/lib/esm/index.js +4 -2
  14. package/lib/esm/view/{reportUIOptions → financeStatement}/financeStatementCompareBalances.js +7 -0
  15. package/lib/esm/view/financeStatement/financeStatementSelector.js +23 -12
  16. package/lib/esm/view/invoicing/invoicingOverview/invoicingOverviewPayload.js +1 -0
  17. package/lib/esm/view/reportUIOptions/updateReportUIOptionCompareModeEpic.js +1 -1
  18. package/lib/esm/view/reportUIOptions/updateReportUIOptionIsCompareModeOnEpic.js +1 -1
  19. package/lib/esm/view/transactionDetail/createTransaction/createTransactionLocalDataHelper.js +157 -0
  20. package/lib/esm/view/transactionDetail/createTransaction/createTransactionPayload.js +164 -0
  21. package/lib/esm/view/transactionDetail/createTransaction/createTransactionSelector.js +47 -0
  22. package/lib/esm/view/transactionDetail/createTransaction/createTransactionState.js +11 -0
  23. package/lib/esm/view/transactionDetail/createTransaction/epics/createTransactionAttachmentUploadFailureEpic.js +19 -0
  24. package/lib/esm/view/transactionDetail/createTransaction/epics/createTransactionEpic.js +81 -0
  25. package/lib/esm/view/transactionDetail/createTransaction/epics/fetchVendorRecommendationsForCreateTransactionEpic.js +53 -0
  26. package/lib/esm/view/transactionDetail/createTransaction/epics/initializeCreateTransactionLocalDataEpic.js +10 -0
  27. package/lib/esm/view/transactionDetail/transactionDetailReducer.js +196 -1
  28. package/lib/index.d.ts +6 -2
  29. package/lib/index.js +56 -37
  30. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  31. package/lib/view/{reportUIOptions → financeStatement}/financeStatementCompareBalances.d.ts +1 -0
  32. package/lib/view/{reportUIOptions → financeStatement}/financeStatementCompareBalances.js +8 -0
  33. package/lib/view/financeStatement/financeStatementSelector.js +22 -11
  34. package/lib/view/invoicing/invoicingOverview/invoicingOverviewPayload.d.ts +5 -0
  35. package/lib/view/invoicing/invoicingOverview/invoicingOverviewPayload.js +1 -0
  36. package/lib/view/invoicing/invoicingOverview/invoicingOverviewState.d.ts +2 -0
  37. package/lib/view/reportUIOptions/updateReportUIOptionCompareModeEpic.js +1 -1
  38. package/lib/view/reportUIOptions/updateReportUIOptionIsCompareModeOnEpic.js +1 -1
  39. package/lib/view/transactionDetail/createTransaction/createTransactionLocalDataHelper.d.ts +56 -0
  40. package/lib/view/transactionDetail/createTransaction/createTransactionLocalDataHelper.js +172 -0
  41. package/lib/view/transactionDetail/createTransaction/createTransactionPayload.d.ts +95 -0
  42. package/lib/view/transactionDetail/createTransaction/createTransactionPayload.js +169 -0
  43. package/lib/view/transactionDetail/createTransaction/createTransactionSelector.d.ts +44 -0
  44. package/lib/view/transactionDetail/createTransaction/createTransactionSelector.js +53 -0
  45. package/lib/view/transactionDetail/createTransaction/createTransactionState.d.ts +82 -0
  46. package/lib/view/transactionDetail/createTransaction/createTransactionState.js +14 -0
  47. package/lib/view/transactionDetail/createTransaction/epics/createTransactionAttachmentUploadFailureEpic.d.ts +10 -0
  48. package/lib/view/transactionDetail/createTransaction/epics/createTransactionAttachmentUploadFailureEpic.js +23 -0
  49. package/lib/view/transactionDetail/createTransaction/epics/createTransactionEpic.d.ts +9 -0
  50. package/lib/view/transactionDetail/createTransaction/epics/createTransactionEpic.js +85 -0
  51. package/lib/view/transactionDetail/createTransaction/epics/fetchVendorRecommendationsForCreateTransactionEpic.d.ts +20 -0
  52. package/lib/view/transactionDetail/createTransaction/epics/fetchVendorRecommendationsForCreateTransactionEpic.js +57 -0
  53. package/lib/view/transactionDetail/createTransaction/epics/initializeCreateTransactionLocalDataEpic.d.ts +12 -0
  54. package/lib/view/transactionDetail/createTransaction/epics/initializeCreateTransactionLocalDataEpic.js +14 -0
  55. package/lib/view/transactionDetail/transactionDetailReducer.d.ts +39 -1
  56. package/lib/view/transactionDetail/transactionDetailReducer.js +198 -2
  57. package/lib/view/transactionDetail/transactionDetailState.d.ts +12 -0
  58. package/package.json +1 -1
@@ -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: {
@@ -1,2 +1,3 @@
1
1
  import { COABalanceType } from '../../commonStateTypes/coaBalance/coaBalanceType';
2
2
  export declare function getFinanceStatementAdditionalBalances(requestedBalances: COABalanceType[], isCompareModeOn: boolean, compareBalanceFromMode: COABalanceType): COABalanceType[];
3
+ export declare function getDisplayedAdditionalBalances(selectedBalances: COABalanceType[]): COABalanceType[];
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getFinanceStatementAdditionalBalances = getFinanceStatementAdditionalBalances;
4
+ exports.getDisplayedAdditionalBalances = getDisplayedAdditionalBalances;
4
5
  const coaBalanceType_1 = require("../../commonStateTypes/coaBalance/coaBalanceType");
5
6
  // Reports can show the $ and % change columns together, so every requested compare type is kept;
6
7
  // compareMode picks one only when none was requested.
@@ -17,3 +18,10 @@ function getFinanceStatementAdditionalBalances(requestedBalances, isCompareModeO
17
18
  : [compareBalanceFromMode]),
18
19
  ];
19
20
  }
21
+ // The table has one change column with a $/% picker, so only the first selected compare type is
22
+ // shown; the rest of the selection still reaches the download.
23
+ function getDisplayedAdditionalBalances(selectedBalances) {
24
+ const otherBalances = (0, coaBalanceType_1.stripCompareAdditionalBalanceTypes)(selectedBalances);
25
+ const displayedCompareBalance = selectedBalances.find((balance) => !otherBalances.includes(balance));
26
+ return selectedBalances.filter((balance) => otherBalances.includes(balance) || balance === displayedCompareBalance);
27
+ }
@@ -20,6 +20,17 @@ const profitAndLossSelector_1 = require("../profitAndLoss/profitAndLossSelector"
20
20
  const profitAndLossClassesByClassHorizontalSelector_1 = require("../profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector");
21
21
  const profitAndLossClassesViewSelector_1 = require("../profitAndLossClassesView/profitAndLossClassesViewSelector");
22
22
  const profitAndLossProjectViewSelector_1 = require("../profitAndLossProjectView/profitAndLossProjectViewSelector");
23
+ const financeStatementCompareBalances_1 = require("./financeStatementCompareBalances");
24
+ /**
25
+ * Reports are built from the displayed columns, but their filter carries the full selection: the
26
+ * download and the Add Columns picker read it from there.
27
+ */
28
+ function withSelectedAdditionalBalances(report, selectedAdditionalBalances) {
29
+ return {
30
+ ...report,
31
+ filter: { ...report.filter, additionalBalances: selectedAdditionalBalances },
32
+ };
33
+ }
23
34
  function getDateRangeForFinanceReports(profitAndLossState, balanceSheetState, cashFlowState) {
24
35
  const datesSorted = [
25
36
  profitAndLossState.dataAvailable?.startDate,
@@ -74,7 +85,7 @@ exports.getFinanceStatement = (0, toolkit_1.createSelector)((state) => state.acc
74
85
  const additionalBalancesForFilter = useHorizontalClassesLayout
75
86
  ? (0, coaBalanceType_1.stripCompareAdditionalBalanceTypes)(rawAdditionalBalances)
76
87
  : rawAdditionalBalances;
77
- const filter = (0, coaBalancesFilter_1.newBalancesFilter)(firstMonthOfFY, financeStatementState.timeframe, Math.min((0, dataAvailable_1.getNumberOfPeriods)(firstMonthOfFY, financeStatementState.timeframe, dataAvailable) ?? financeStatementState.selectedCOABalancesRange.numberOfPeriods, financeStatementState.selectedCOABalancesRange.numberOfPeriods), thisPeriod, 'ascending_date', additionalBalancesForFilter);
88
+ const filter = (0, coaBalancesFilter_1.newBalancesFilter)(firstMonthOfFY, financeStatementState.timeframe, Math.min((0, dataAvailable_1.getNumberOfPeriods)(firstMonthOfFY, financeStatementState.timeframe, dataAvailable) ?? financeStatementState.selectedCOABalancesRange.numberOfPeriods, financeStatementState.selectedCOABalancesRange.numberOfPeriods), thisPeriod, 'ascending_date', (0, financeStatementCompareBalances_1.getDisplayedAdditionalBalances)(additionalBalancesForFilter));
78
89
  const profitAndLossReport = (0, profitAndLossSelector_1.getProfitAndLossReport)(filter, undefined, accountState, accountGroupState, sectionAccountsViewState, profitAndLossState, forecastState);
79
90
  const classFilter = (0, coaBalancesFilterClassesView_1.newBalancesFilterClassesView)(filter.firstMonthOfFY, filter.timeframe, filter.balancesRange.numberOfPeriods, filter.balancesRange.thisPeriod, filter.balancesRange.orderBy, filter.additionalBalances, profitAndLossClassesViewState.uiState.classesToFilterOut);
80
91
  const profitAndLossByClassReport = (0, profitAndLossClassesViewSelector_1.getProfitAndLossClassesView)(classFilter, accountState, classState, sectionsState, profitAndLossClassesViewState);
@@ -166,17 +177,17 @@ exports.getFinanceStatement = (0, toolkit_1.createSelector)((state) => state.acc
166
177
  reportFormat: financeStatementState.reportFormat,
167
178
  firstMonthOfFY,
168
179
  dataAvailable,
169
- profitAndLossReport,
170
- profitAndLossByClassReport,
171
- profitAndLossByProjectReport,
180
+ profitAndLossReport: withSelectedAdditionalBalances(profitAndLossReport, additionalBalancesForFilter),
181
+ profitAndLossByClassReport: withSelectedAdditionalBalances(profitAndLossByClassReport, additionalBalancesForFilter),
182
+ profitAndLossByProjectReport: withSelectedAdditionalBalances(profitAndLossByProjectReport, additionalBalancesForFilter),
172
183
  profitAndLossByClassHorizontalReport,
173
- balanceSheetReport,
174
- balanceSheetByClassReport,
175
- cashFlowByClassReport,
176
- cashFlowByProjectReport,
177
- balanceSheetByProjectReport,
178
- cashFlowReport,
179
- filter,
184
+ balanceSheetReport: withSelectedAdditionalBalances(balanceSheetReport, additionalBalancesForFilter),
185
+ balanceSheetByClassReport: withSelectedAdditionalBalances(balanceSheetByClassReport, additionalBalancesForFilter),
186
+ cashFlowByClassReport: withSelectedAdditionalBalances(cashFlowByClassReport, additionalBalancesForFilter),
187
+ cashFlowByProjectReport: withSelectedAdditionalBalances(cashFlowByProjectReport, additionalBalancesForFilter),
188
+ balanceSheetByProjectReport: withSelectedAdditionalBalances(balanceSheetByProjectReport, additionalBalancesForFilter),
189
+ cashFlowReport: withSelectedAdditionalBalances(cashFlowReport, additionalBalancesForFilter),
190
+ filter: { ...filter, additionalBalances: additionalBalancesForFilter },
180
191
  selectedReportId: financeStatementState.selectedReportId,
181
192
  downloadState: financeStatementState.downloadState,
182
193
  isCompareModeOn: useHorizontalClassesLayout
@@ -46,6 +46,11 @@ export interface InvoicingDashboardSummaryPayload {
46
46
  resumed: number;
47
47
  total_active: number;
48
48
  total_active_value: number;
49
+ /**
50
+ * Churned opening-cohort customers ÷ customers at month start, as a 0-100
51
+ * percent. Customer-scoped, unlike the subscription-scoped KPI churn rate.
52
+ */
53
+ customer_churn_rate?: number | null;
49
54
  };
50
55
  failed_payments: {
51
56
  amount: number;
@@ -49,6 +49,7 @@ exports.mapInvoicingPlanRevenuePointPayloadToState = mapInvoicingPlanRevenuePoin
49
49
  const mapInvoicingDashboardSummaryPayloadToState = (payload) => ({
50
50
  customerMovement: {
51
51
  churned: payload.customer_movement.churned,
52
+ customerChurnRate: payload.customer_movement.customer_churn_rate ?? undefined,
52
53
  netChange: payload.customer_movement.net_change,
53
54
  new: payload.customer_movement.new,
54
55
  paused: payload.customer_movement.paused,
@@ -50,6 +50,8 @@ export interface InvoicingDashboardSummary {
50
50
  resumed: number;
51
51
  totalActive: number;
52
52
  totalActiveValue: Amount;
53
+ /** 0-100 percent; absent from a backend that predates it. */
54
+ customerChurnRate?: number;
53
55
  };
54
56
  failedPayments: {
55
57
  amount: Amount;
@@ -5,12 +5,12 @@ const rxjs_1 = require("rxjs");
5
5
  const operators_1 = require("rxjs/operators");
6
6
  const cashInCashOutReducer_1 = require("../cashInCashOut/cashInCashOutReducer");
7
7
  const cashPositionReducer_1 = require("../cashPosition/cashPositionReducer");
8
+ const financeStatementCompareBalances_1 = require("../financeStatement/financeStatementCompareBalances");
8
9
  const financeStatementReducer_1 = require("../financeStatement/financeStatementReducer");
9
10
  const financeStatementSelector_1 = require("../financeStatement/financeStatementSelector");
10
11
  const netBurnOrIncomeReducer_1 = require("../netBurnOrIncome/netBurnOrIncomeReducer");
11
12
  const opExReducer_1 = require("../opEx/opExReducer");
12
13
  const revenueReducer_1 = require("../revenue/revenueReducer");
13
- const financeStatementCompareBalances_1 = require("./financeStatementCompareBalances");
14
14
  const reportUIOptionsReducer_1 = require("./reportUIOptionsReducer");
15
15
  const updateReportUIOptionIsCompareModeEpic = (actions$, state) => actions$.pipe((0, operators_1.filter)(reportUIOptionsReducer_1.updateReportUIOptionCompareMode.match), (0, operators_1.switchMap)((action) => {
16
16
  const { additionalBalances } = action.payload;
@@ -5,12 +5,12 @@ const rxjs_1 = require("rxjs");
5
5
  const operators_1 = require("rxjs/operators");
6
6
  const cashInCashOutReducer_1 = require("../cashInCashOut/cashInCashOutReducer");
7
7
  const cashPositionReducer_1 = require("../cashPosition/cashPositionReducer");
8
+ const financeStatementCompareBalances_1 = require("../financeStatement/financeStatementCompareBalances");
8
9
  const financeStatementReducer_1 = require("../financeStatement/financeStatementReducer");
9
10
  const financeStatementSelector_1 = require("../financeStatement/financeStatementSelector");
10
11
  const netBurnOrIncomeReducer_1 = require("../netBurnOrIncome/netBurnOrIncomeReducer");
11
12
  const opExReducer_1 = require("../opEx/opExReducer");
12
13
  const revenueReducer_1 = require("../revenue/revenueReducer");
13
- const financeStatementCompareBalances_1 = require("./financeStatementCompareBalances");
14
14
  const reportUIOptionsReducer_1 = require("./reportUIOptionsReducer");
15
15
  const updateReportUIOptionIsCompareModeOnEpic = (actions$, state) => actions$.pipe((0, operators_1.filter)(reportUIOptionsReducer_1.updateReportUIOptionIsCompareModeOn.match), (0, operators_1.switchMap)((action) => {
16
16
  const { additionalBalances } = action.payload;
@@ -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;
@@ -0,0 +1,95 @@
1
+ import { ID } from '../../../commonStateTypes/common';
2
+ import { ProjectBasePayload } from '../../../entity/project/projectPayload';
3
+ import { TransactionPayload } from '../../../entity/transaction/payloadTypes/transactionPayload';
4
+ import { ZeniAPIResponse } from '../../../responsePayload';
5
+ import { RootState } from '../../../rootStateTypes';
6
+ import { CreateTransactionLocalData } from './createTransactionState';
7
+ /**
8
+ * Wire types for POST /1.0/transactions/manage.
9
+ *
10
+ * Two things here are easy to get wrong and are deliberately explicit:
11
+ *
12
+ * 1. `line_detail_type` is snake_case. The PascalCase strings in the backend are Python
13
+ * constant NAMES; ZENI_LINE_DETAIL_TYPE_TO_QBO_LINE_DETAIL_TYPE_MAP converts them for the
14
+ * body the backend sends on to QuickBooks, never for ours.
15
+ * 2. The reference number uses two different keys depending on the QBO entity. check and
16
+ * expense are Purchases and take `document_number`; everything else takes `document_id`.
17
+ */
18
+ export interface CreateTransactionAccountPayload {
19
+ qbo_id: ID;
20
+ account_name?: string;
21
+ }
22
+ export interface CreateTransactionLineDetailPayload {
23
+ account?: CreateTransactionAccountPayload;
24
+ class?: Record<string, never> | {
25
+ qbo_id: ID;
26
+ };
27
+ /**
28
+ * journal_entry only, and it MUST sit inside line_detail. The write validator's docstring
29
+ * warns that a misplaced posting_type is silently dropped and then rejected by QBO.
30
+ */
31
+ posting_type?: 'credit' | 'debit';
32
+ /** Same shape the transaction update sends on a vendor line. */
33
+ project?: ProjectBasePayload;
34
+ vendor?: {
35
+ qbo_id: ID;
36
+ };
37
+ }
38
+ export interface CreateTransactionLinePayload {
39
+ amount: number;
40
+ line_detail: CreateTransactionLineDetailPayload;
41
+ line_detail_type: 'account_based_expense_line_detail' | 'item_based_expense_line_detail' | 'journal_entry_line_detail';
42
+ line_description?: string;
43
+ }
44
+ export interface CreateTransactionRemitToAddressPayload {
45
+ city?: string;
46
+ country?: string;
47
+ line1?: string;
48
+ postal_code?: string;
49
+ state?: string;
50
+ }
51
+ export interface CreateTransactionRequest extends Record<string, unknown> {
52
+ transaction_date: string;
53
+ transaction_type: string;
54
+ /** journal_entry reference number. */
55
+ document_id?: string;
56
+ /** check / credit_card_credit reference number (QBO Purchase). */
57
+ document_number?: string;
58
+ from_account_id?: ID;
59
+ /** credit_card_credit is modelled as a Purchase with Credit: true. */
60
+ is_credit?: boolean;
61
+ lines?: CreateTransactionLinePayload[];
62
+ payment_type?: string;
63
+ print_status?: string;
64
+ qbo_account_id?: ID;
65
+ remit_to_address?: CreateTransactionRemitToAddressPayload;
66
+ to_account_id?: ID;
67
+ total_amount?: number;
68
+ transaction_memo?: string;
69
+ vendor_id?: ID;
70
+ }
71
+ /**
72
+ * The create endpoint writes to QBO and returns the created entity; Zeni's own mirror is
73
+ * populated by the delta sync that runs afterwards, so this response is the only view of the
74
+ * new transaction the client gets immediately.
75
+ */
76
+ export interface CreateTransactionPayload {
77
+ transactions: TransactionPayload[];
78
+ }
79
+ export type CreateTransactionResponse = ZeniAPIResponse<CreateTransactionPayload>;
80
+ /**
81
+ * Thrown when a picked id has no QBO id to send. Sending the Zeni id instead would reach QBO as
82
+ * an unknown reference and come back as an opaque error, so the create is stopped here and the
83
+ * epic shows this message instead.
84
+ */
85
+ export declare class UnresolvedCreateTransactionIdError extends Error {
86
+ }
87
+ /**
88
+ * Builds the request body for one transaction type. One branch per type rather than a shared
89
+ * body with optional keys, because the types genuinely diverge -- transfer carries no lines at
90
+ * all, and journal_entry carries no header account.
91
+ *
92
+ * Throws UnresolvedCreateTransactionIdError when a picked vendor (header or journal entry line),
93
+ * class or transfer account has no QBO id.
94
+ */
95
+ export declare const prepareCreateTransactionPayload: (state: RootState, localData: CreateTransactionLocalData) => CreateTransactionRequest;