@zeniai/client-epic-state 5.3.4 → 5.3.6

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 (60) hide show
  1. package/lib/entity/customerIncome/customerIncomeTrend.d.ts +18 -2
  2. package/lib/entity/customerIncome/customerIncomeTrend.js +65 -5
  3. package/lib/entity/insights/insightSummary.d.ts +3 -0
  4. package/lib/entity/insights/insightSummaryPayload.js +2 -0
  5. package/lib/entity/invoicing/invoice/invoicePayload.d.ts +1 -0
  6. package/lib/entity/invoicing/invoice/invoicePayload.js +3 -0
  7. package/lib/entity/invoicing/invoice/invoiceState.d.ts +2 -0
  8. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  9. package/lib/entity/snackbar/snackbarTypes.js +1 -0
  10. package/lib/entity/vendorExpense/vendorSpendTrendFilterTabType.d.ts +2 -2
  11. package/lib/epic.d.ts +4 -1
  12. package/lib/epic.js +6 -0
  13. package/lib/esm/entity/customerIncome/customerIncomeTrend.js +63 -4
  14. package/lib/esm/entity/insights/insightSummaryPayload.js +2 -0
  15. package/lib/esm/entity/invoicing/invoice/invoicePayload.js +3 -0
  16. package/lib/esm/entity/snackbar/snackbarTypes.js +1 -0
  17. package/lib/esm/epic.js +6 -0
  18. package/lib/esm/index.js +3 -0
  19. package/lib/esm/reducer.js +3 -0
  20. package/lib/esm/view/customerSummaryView/customerSummaryViewPayload.js +1 -0
  21. package/lib/esm/view/customerSummaryView/customerSummaryViewReducer.js +197 -0
  22. package/lib/esm/view/customerSummaryView/customerSummaryViewSelector.js +35 -0
  23. package/lib/esm/view/customerSummaryView/customerSummaryViewState.js +10 -0
  24. package/lib/esm/view/customerSummaryView/epic/fetchCustomerSummaryDetailEpic.js +30 -0
  25. package/lib/esm/view/customerSummaryView/epic/fetchCustomerSummaryListEpic.js +27 -0
  26. package/lib/esm/view/customerSummaryView/epic/saveCustomerSummaryDetailEpic.js +44 -0
  27. package/lib/esm/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +2 -1
  28. package/lib/esm/view/transactionDetail/createTransaction/createTransactionPayload.js +0 -1
  29. package/lib/esm/view/trend/fetchIncomeTrendEpic.js +29 -6
  30. package/lib/esm/view/trend/trendReducer.js +4 -2
  31. package/lib/index.d.ts +6 -0
  32. package/lib/index.js +21 -1
  33. package/lib/reducer.d.ts +1 -0
  34. package/lib/reducer.js +3 -0
  35. package/lib/rootStateTypes.d.ts +2 -0
  36. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewReducer.d.ts +2 -2
  37. package/lib/view/customerSummaryView/customerSummaryViewPayload.d.ts +38 -0
  38. package/lib/view/customerSummaryView/customerSummaryViewPayload.js +2 -0
  39. package/lib/view/customerSummaryView/customerSummaryViewReducer.d.ts +32 -0
  40. package/lib/view/customerSummaryView/customerSummaryViewReducer.js +202 -0
  41. package/lib/view/customerSummaryView/customerSummaryViewSelector.d.ts +20 -0
  42. package/lib/view/customerSummaryView/customerSummaryViewSelector.js +43 -0
  43. package/lib/view/customerSummaryView/customerSummaryViewState.d.ts +63 -0
  44. package/lib/view/customerSummaryView/customerSummaryViewState.js +13 -0
  45. package/lib/view/customerSummaryView/epic/fetchCustomerSummaryDetailEpic.d.ts +9 -0
  46. package/lib/view/customerSummaryView/epic/fetchCustomerSummaryDetailEpic.js +34 -0
  47. package/lib/view/customerSummaryView/epic/fetchCustomerSummaryListEpic.d.ts +7 -0
  48. package/lib/view/customerSummaryView/epic/fetchCustomerSummaryListEpic.js +31 -0
  49. package/lib/view/customerSummaryView/epic/saveCustomerSummaryDetailEpic.d.ts +8 -0
  50. package/lib/view/customerSummaryView/epic/saveCustomerSummaryDetailEpic.js +48 -0
  51. package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +2 -1
  52. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  53. package/lib/view/transactionDetail/createTransaction/createTransactionPayload.d.ts +2 -4
  54. package/lib/view/transactionDetail/createTransaction/createTransactionPayload.js +0 -1
  55. package/lib/view/transactionDetail/createTransaction/createTransactionState.d.ts +0 -2
  56. package/lib/view/trend/fetchIncomeTrendEpic.d.ts +1 -1
  57. package/lib/view/trend/fetchIncomeTrendEpic.js +28 -5
  58. package/lib/view/trend/trendReducer.d.ts +8 -1
  59. package/lib/view/trend/trendReducer.js +4 -2
  60. 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" | "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" | "auto_review_income_without_customer_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" | "update_customer" | "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" | "auto_review_income_without_customer_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: {
@@ -12,8 +12,8 @@ import { CreateTransactionLocalData } from './createTransactionState';
12
12
  * 1. `line_detail_type` is snake_case. The PascalCase strings in the backend are Python
13
13
  * constant NAMES; ZENI_LINE_DETAIL_TYPE_TO_QBO_LINE_DETAIL_TYPE_MAP converts them for the
14
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`.
15
+ * 2. Only the QBO Purchases (check, credit_card_credit) send a reference number, as
16
+ * `document_number`. A journal entry sends none.
17
17
  */
18
18
  export interface CreateTransactionAccountPayload {
19
19
  qbo_id: ID;
@@ -51,8 +51,6 @@ export interface CreateTransactionRemitToAddressPayload {
51
51
  export interface CreateTransactionRequest extends Record<string, unknown> {
52
52
  transaction_date: string;
53
53
  transaction_type: string;
54
- /** journal_entry reference number. */
55
- document_id?: string;
56
54
  /** check / credit_card_credit reference number (QBO Purchase). */
57
55
  document_number?: string;
58
56
  from_account_id?: ID;
@@ -132,7 +132,6 @@ const prepareCreateTransactionPayload = (state, localData) => {
132
132
  if (transactionType === 'journal_entry') {
133
133
  return {
134
134
  ...base,
135
- document_id: localData.documentId,
136
135
  lines,
137
136
  };
138
137
  }
@@ -54,8 +54,6 @@ export interface CreateTransactionLocalData {
54
54
  /** Empty for transfer, which has no lines at all. */
55
55
  lines: CreateTransactionLineLocalData[];
56
56
  transactionType: CreatableTransactionType;
57
- /** journal_entry reference number. */
58
- documentId?: string;
59
57
  /** check / credit_card_credit reference number. */
60
58
  documentNumber?: string;
61
59
  /** transfer */
@@ -4,4 +4,4 @@ import { RootState } from '../../rootStateTypes';
4
4
  import { ZeniAPI } from '../../zeniAPI';
5
5
  import { fetchIncomeTrend, updateTrendFailure, updateTrendSuccess } from './trendReducer';
6
6
  export type ActionType = ReturnType<typeof fetchIncomeTrend> | ReturnType<typeof updateTrendSuccess> | ReturnType<typeof updateCustomerIncomeTrend> | ReturnType<typeof updateTrendFailure>;
7
- export declare const fetchIncomeTrendEpic: (actions$: ActionsObservable<ActionType>, _: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<ActionType>;
7
+ export declare const fetchIncomeTrendEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<ActionType>;
@@ -3,17 +3,39 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fetchIncomeTrendEpic = void 0;
4
4
  const rxjs_1 = require("rxjs");
5
5
  const operators_1 = require("rxjs/operators");
6
+ const timeframeTick_1 = require("../../commonStateTypes/timeframeTick");
7
+ const customerIncomeTrendKey_1 = require("../../entity/customerIncome/customerIncomeTrendKey");
6
8
  const customerIncomeTrendReducer_1 = require("../../entity/customerIncome/customerIncomeTrendReducer");
7
9
  const responsePayload_1 = require("../../responsePayload");
8
10
  const zeniDayJS_1 = require("../../zeniDayJS");
9
11
  const trendReducer_1 = require("./trendReducer");
10
- const fetchIncomeTrendEpic = (actions$, _, zeniAPI) => actions$.pipe((0, operators_1.filter)(trendReducer_1.fetchIncomeTrend.match), (0, operators_1.mergeMap)((action) => {
11
- const { customerId, customerName } = action.payload;
12
+ const fetchIncomeTrendEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(trendReducer_1.fetchIncomeTrend.match),
13
+ // switchMap: a late response for the previously selected customer must not land on the current one
14
+ (0, operators_1.switchMap)((action) => {
15
+ const { customerId, customerName, dateRange } = action.payload;
16
+ // Customers tab: the trend for this exact range is already loaded (e.g. back from a transaction) ->
17
+ // just re-select it instead of re-running the live QBO report
18
+ const requestedPeriod = dateRange != null
19
+ ? {
20
+ startDate: (0, zeniDayJS_1.date)(dateRange.startDate),
21
+ endDate: (0, zeniDayJS_1.date)(dateRange.endDate),
22
+ }
23
+ : undefined;
24
+ if (requestedPeriod != null) {
25
+ const key = (0, customerIncomeTrendKey_1.getCustomerIncomeTrendKey)(customerId, (0, timeframeTick_1.toTimePeriod)(requestedPeriod));
26
+ if (state$.value.customerIncomeState.customerIncomeTrendByPeriod[key] !=
27
+ null) {
28
+ return (0, rxjs_1.of)((0, trendReducer_1.updateTrendSuccess)(requestedPeriod));
29
+ }
30
+ }
12
31
  const query = {
13
32
  entity_id: customerId,
14
33
  entity_type: 'customer',
15
34
  customer_id: customerId,
16
35
  customer_name: customerName,
36
+ ...(dateRange != null
37
+ ? { start_date: dateRange.startDate, end_date: dateRange.endDate }
38
+ : {}),
17
39
  };
18
40
  const getIncomeTrend$ = zeniAPI
19
41
  .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/reports/income_trend?query=${encodeURIComponent(JSON.stringify(query))}`)
@@ -23,7 +45,7 @@ const fetchIncomeTrendEpic = (actions$, _, zeniAPI) => actions$.pipe((0, operato
23
45
  id: customerId,
24
46
  name: customerName,
25
47
  };
26
- return (0, rxjs_1.from)(updateTrendActions(customer, response));
48
+ return (0, rxjs_1.from)(updateTrendActions(customer, response, requestedPeriod));
27
49
  }
28
50
  else {
29
51
  return (0, rxjs_1.of)((0, trendReducer_1.updateTrendFailure)(action.payload.customerId, response.status));
@@ -37,13 +59,14 @@ exports.fetchIncomeTrendEpic = fetchIncomeTrendEpic;
37
59
  *
38
60
  * @param customer
39
61
  * @param incomeResponse
62
+ * @param requestedPeriod stored under the requested range (not data_available_*) so the cache lookup hits
40
63
  * @returns actions for updating the trend
41
64
  */
42
- const updateTrendActions = (customer, incomeResponse) => {
65
+ const updateTrendActions = (customer, incomeResponse, requestedPeriod) => {
43
66
  const updateActions = [];
44
67
  /* eslint-disable @typescript-eslint/no-non-null-assertion */
45
68
  /* eslint-disable @typescript-eslint/no-non-null-asserted-optional-chain */
46
- const trendPeriod = {
69
+ const trendPeriod = requestedPeriod ?? {
47
70
  startDate: (0, zeniDayJS_1.date)(incomeResponse.data?.report.data_available_start_date),
48
71
  endDate: (0, zeniDayJS_1.date)(incomeResponse.data?.report.data_available_end_date),
49
72
  };
@@ -6,9 +6,16 @@ export declare const fetchExpenseTrend: import("@reduxjs/toolkit").ActionCreator
6
6
  vendorId: string;
7
7
  vendorName: string;
8
8
  vendorZeniId: string;
9
- }, "trend/fetchExpenseTrend", never, never>, fetchIncomeTrend: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[customerId: string, customerName: string], {
9
+ }, "trend/fetchExpenseTrend", never, never>, fetchIncomeTrend: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[customerId: string, customerName: string, dateRange?: {
10
+ endDate: string;
11
+ startDate: string;
12
+ } | undefined], {
10
13
  customerId: string;
11
14
  customerName: string;
15
+ dateRange: {
16
+ endDate: string;
17
+ startDate: string;
18
+ } | undefined;
12
19
  }, "trend/fetchIncomeTrend", never, never>, updateTrendSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<TimeframeTick, "trend/updateTrendSuccess">, updateTrendFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[id: string, error: ZeniAPIStatus<Record<string, unknown>>], {
13
20
  id: string;
14
21
  error: ZeniAPIStatus<Record<string, unknown>>;
@@ -18,8 +18,10 @@ const trend = (0, toolkit_1.createSlice)({
18
18
  initialState: exports.initialTrendState,
19
19
  reducers: {
20
20
  fetchIncomeTrend: {
21
- prepare(customerId, customerName) {
22
- return { payload: { customerId, customerName } };
21
+ prepare(customerId, customerName,
22
+ // ISO dates; omitted = the API default (last 8 months)
23
+ dateRange) {
24
+ return { payload: { customerId, customerName, dateRange } };
23
25
  },
24
26
  reducer(draft, action) {
25
27
  draft.selectedEntity = Object.assign({}, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.3.4",
3
+ "version": "5.3.6",
4
4
  "description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/esm/index.js",