@zeniai/client-epic-state 5.0.46 → 5.0.47-beta0ND

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 (144) hide show
  1. package/lib/commonStateTypes/recommendationBase.d.ts +2 -1
  2. package/lib/commonStateTypes/viewAndReport/viewAndReport.d.ts +2 -2
  3. package/lib/commonStateTypes/viewAndReport/viewAndReport.js +1 -0
  4. package/lib/entity/account/accountState.d.ts +1 -1
  5. package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
  6. package/lib/entity/chargeCardRepayment/chargeCardRepayment.d.ts +1 -1
  7. package/lib/entity/class/classReducer.d.ts +4 -4
  8. package/lib/entity/class/classState.d.ts +1 -1
  9. package/lib/entity/creditAgent/creditAgentPayload.d.ts +41 -0
  10. package/lib/entity/creditAgent/creditAgentPayload.js +40 -0
  11. package/lib/entity/creditAgent/creditAgentReducer.d.ts +9 -0
  12. package/lib/entity/creditAgent/creditAgentReducer.js +37 -0
  13. package/lib/entity/creditAgent/creditAgentSelector.d.ts +3 -0
  14. package/lib/entity/creditAgent/creditAgentSelector.js +10 -0
  15. package/lib/entity/creditAgent/creditAgentState.d.ts +39 -0
  16. package/lib/entity/creditAgent/creditAgentState.js +17 -0
  17. package/lib/entity/forecast/forecastState.d.ts +1 -1
  18. package/lib/entity/project/projectPayload.d.ts +7 -0
  19. package/lib/entity/project/projectPayload.js +15 -1
  20. package/lib/entity/sectionAccountsView/sectionAccountsView.d.ts +1 -1
  21. package/lib/entity/sectionClassesViewV2/sectionClassesView.d.ts +1 -1
  22. package/lib/entity/sectionClassesViewV2/sectionClassesViewReducer.d.ts +2 -2
  23. package/lib/entity/sectionProjectView/sectionProjectView.d.ts +1 -1
  24. package/lib/entity/sectionProjectView/sectionProjectViewReducer.d.ts +2 -2
  25. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  26. package/lib/entity/snackbar/snackbarTypes.js +3 -0
  27. package/lib/entity/tenant/SessionManager.d.ts +4 -0
  28. package/lib/entity/tenant/SessionManager.js +6 -0
  29. package/lib/entity/tenant/clearAllEpic.d.ts +6 -3
  30. package/lib/entity/tenant/clearAllEpic.js +8 -2
  31. package/lib/entity/transaction/payloadTypes/transactionLinePayload.d.ts +2 -0
  32. package/lib/entity/transaction/payloadTypes/transactionLinePayload.js +9 -0
  33. package/lib/entity/transaction/stateTypes/transactionLine.d.ts +2 -0
  34. package/lib/epic.d.ts +10 -1
  35. package/lib/epic.js +10 -1
  36. package/lib/esm/commonStateTypes/viewAndReport/viewAndReport.js +1 -0
  37. package/lib/esm/entity/creditAgent/creditAgentPayload.js +36 -0
  38. package/lib/esm/entity/creditAgent/creditAgentReducer.js +33 -0
  39. package/lib/esm/entity/creditAgent/creditAgentSelector.js +6 -0
  40. package/lib/esm/entity/creditAgent/creditAgentState.js +13 -0
  41. package/lib/esm/entity/project/projectPayload.js +12 -0
  42. package/lib/esm/entity/snackbar/snackbarTypes.js +3 -0
  43. package/lib/esm/entity/tenant/SessionManager.js +6 -0
  44. package/lib/esm/entity/tenant/clearAllEpic.js +8 -2
  45. package/lib/esm/entity/transaction/payloadTypes/transactionLinePayload.js +9 -0
  46. package/lib/esm/epic.js +10 -1
  47. package/lib/esm/index.js +19 -10
  48. package/lib/esm/reducer.js +12 -3
  49. package/lib/esm/view/creditAgentView/buildCreditReportCsv.js +44 -0
  50. package/lib/esm/view/creditAgentView/creditAgentViewPayload.js +2 -0
  51. package/lib/esm/view/creditAgentView/creditAgentViewReducer.js +183 -0
  52. package/lib/esm/view/creditAgentView/creditAgentViewSelector.js +85 -0
  53. package/lib/esm/view/creditAgentView/creditAgentViewState.js +20 -0
  54. package/lib/esm/view/creditAgentView/epics/fetchCardProfilesEpic.js +20 -0
  55. package/lib/esm/view/creditAgentView/epics/fetchCreditAgentAccessEpic.js +13 -0
  56. package/lib/esm/view/creditAgentView/epics/fetchCreditAgentMacroEpic.js +19 -0
  57. package/lib/esm/view/creditAgentView/epics/saveCreditAgentMacroEpic.js +58 -0
  58. package/lib/esm/view/creditAgentView/epics/scheduleTenantCreditScoreCronEpic.js +39 -0
  59. package/lib/esm/view/creditAgentView/epics/updateCardProfileEpic.js +62 -0
  60. package/lib/esm/view/projectList/fetchProjectListEpic.js +38 -0
  61. package/lib/esm/view/projectList/projectListPayload.js +1 -0
  62. package/lib/esm/view/projectList/projectListReducer.js +39 -0
  63. package/lib/esm/view/projectList/projectListSelector.js +9 -0
  64. package/lib/esm/view/projectList/projectListState.js +1 -0
  65. package/lib/esm/view/transactionDetail/epics/saveTransactionHelper.js +1 -0
  66. package/lib/esm/view/transactionDetail/epics/transactionDetailEpic.js +6 -0
  67. package/lib/esm/view/transactionDetail/epics/updateTransactionDetailEpic.js +3 -0
  68. package/lib/esm/view/transactionDetail/transactionDetailSelector.js +14 -2
  69. package/lib/esm/view/transactionList/fetchTransactionListByProjectEpic.js +45 -0
  70. package/lib/esm/view/transactionList/parallelFetchProjectTransactionListEpic.js +32 -0
  71. package/lib/esm/view/transactionList/transactionListByProjectSelector.js +58 -0
  72. package/lib/esm/view/transactionList/transactionListReducer.js +83 -2
  73. package/lib/esm/view/transactionList/transactionListState.js +10 -0
  74. package/lib/index.d.ts +25 -14
  75. package/lib/index.js +86 -46
  76. package/lib/reducer.d.ts +12 -3
  77. package/lib/reducer.js +12 -3
  78. package/lib/tsconfig.typecheck.tsbuildinfo +1 -0
  79. package/lib/view/auditReportView/auditReportViewState.d.ts +1 -1
  80. package/lib/view/billPayCard/billPayCardSelector.d.ts +1 -1
  81. package/lib/view/cardBalance/cardBalanceSelector.d.ts +1 -1
  82. package/lib/view/cashBalance/cashBalanceSelector.d.ts +1 -1
  83. package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +1 -1
  84. package/lib/view/cashPosition/cashPositionSelector.d.ts +1 -1
  85. package/lib/view/creditAgentView/buildCreditReportCsv.d.ts +17 -0
  86. package/lib/view/creditAgentView/buildCreditReportCsv.js +47 -0
  87. package/lib/view/creditAgentView/creditAgentViewPayload.d.ts +9 -0
  88. package/lib/view/creditAgentView/creditAgentViewPayload.js +7 -0
  89. package/lib/view/creditAgentView/creditAgentViewReducer.d.ts +41 -0
  90. package/lib/view/creditAgentView/creditAgentViewReducer.js +187 -0
  91. package/lib/view/creditAgentView/creditAgentViewSelector.d.ts +20 -0
  92. package/lib/view/creditAgentView/creditAgentViewSelector.js +93 -0
  93. package/lib/view/creditAgentView/creditAgentViewState.d.ts +34 -0
  94. package/lib/view/creditAgentView/creditAgentViewState.js +22 -0
  95. package/lib/view/creditAgentView/epics/fetchCardProfilesEpic.d.ts +15 -0
  96. package/lib/view/creditAgentView/epics/fetchCardProfilesEpic.js +24 -0
  97. package/lib/view/creditAgentView/epics/fetchCreditAgentAccessEpic.d.ts +11 -0
  98. package/lib/view/creditAgentView/epics/fetchCreditAgentAccessEpic.js +17 -0
  99. package/lib/view/creditAgentView/epics/fetchCreditAgentMacroEpic.d.ts +15 -0
  100. package/lib/view/creditAgentView/epics/fetchCreditAgentMacroEpic.js +23 -0
  101. package/lib/view/creditAgentView/epics/saveCreditAgentMacroEpic.d.ts +29 -0
  102. package/lib/view/creditAgentView/epics/saveCreditAgentMacroEpic.js +62 -0
  103. package/lib/view/creditAgentView/epics/scheduleTenantCreditScoreCronEpic.d.ts +30 -0
  104. package/lib/view/creditAgentView/epics/scheduleTenantCreditScoreCronEpic.js +43 -0
  105. package/lib/view/creditAgentView/epics/updateCardProfileEpic.d.ts +37 -0
  106. package/lib/view/creditAgentView/epics/updateCardProfileEpic.js +66 -0
  107. package/lib/view/dashboard/dashboardReducer.d.ts +2 -2
  108. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  109. package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
  110. package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +2 -2
  111. package/lib/view/projectList/fetchProjectListEpic.d.ts +8 -0
  112. package/lib/view/projectList/fetchProjectListEpic.js +42 -0
  113. package/lib/view/projectList/projectListPayload.d.ts +7 -0
  114. package/lib/view/projectList/projectListPayload.js +2 -0
  115. package/lib/view/projectList/projectListReducer.d.ts +9 -0
  116. package/lib/view/projectList/projectListReducer.js +43 -0
  117. package/lib/view/projectList/projectListSelector.d.ts +8 -0
  118. package/lib/view/projectList/projectListSelector.js +13 -0
  119. package/lib/view/projectList/projectListState.d.ts +4 -0
  120. package/lib/view/projectList/projectListState.js +2 -0
  121. package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
  122. package/lib/view/reportsResync/reportsResyncReducer.d.ts +2 -2
  123. package/lib/view/tasksCard/tasksCardSelector.d.ts +1 -1
  124. package/lib/view/topEx/topExSelector.d.ts +1 -1
  125. package/lib/view/transactionDetail/epics/saveTransactionHelper.js +1 -0
  126. package/lib/view/transactionDetail/epics/transactionDetailEpic.d.ts +2 -1
  127. package/lib/view/transactionDetail/epics/transactionDetailEpic.js +6 -0
  128. package/lib/view/transactionDetail/epics/updateTransactionDetailEpic.js +3 -0
  129. package/lib/view/transactionDetail/transactionDetailSelector.d.ts +3 -0
  130. package/lib/view/transactionDetail/transactionDetailSelector.js +13 -1
  131. package/lib/view/transactionDetail/transactionDetailState.d.ts +2 -0
  132. package/lib/view/transactionDetail/transactionDetailTypes.d.ts +2 -0
  133. package/lib/view/transactionList/fetchTransactionListByProjectEpic.d.ts +8 -0
  134. package/lib/view/transactionList/fetchTransactionListByProjectEpic.js +52 -0
  135. package/lib/view/transactionList/parallelFetchProjectTransactionListEpic.d.ts +6 -0
  136. package/lib/view/transactionList/parallelFetchProjectTransactionListEpic.js +36 -0
  137. package/lib/view/transactionList/transactionListByProjectSelector.d.ts +22 -0
  138. package/lib/view/transactionList/transactionListByProjectSelector.js +66 -0
  139. package/lib/view/transactionList/transactionListPayload.d.ts +15 -0
  140. package/lib/view/transactionList/transactionListReducer.d.ts +25 -2
  141. package/lib/view/transactionList/transactionListReducer.js +83 -2
  142. package/lib/view/transactionList/transactionListState.d.ts +15 -0
  143. package/lib/view/transactionList/transactionListState.js +13 -1
  144. package/package.json +1 -1
@@ -5,7 +5,7 @@ import { ZeniDate } from '../../zeniDayJS';
5
5
  import { AuditSummary } from '../reviewCompanyView/reviewCompanyViewState';
6
6
  export declare const toAuditRuleEntityType: (v: string) => "dashboard" | "transactions" | "reports";
7
7
  export type AuditRuleEntityType = ReturnType<typeof toAuditRuleEntityType>;
8
- declare const toAuditRuleEntityIdType: (v: string) => "cash_balance" | "card_balance" | "expense_automation_card" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "profit_and_loss_by_projects" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "zeni_treasury" | "charge_cards" | "other_connection" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | "notification" | "rewards_card" | "billing" | "flux_analysis_operating_expense" | "account_reconciliation" | "zeni_credit_promo_card" | "treasury_promo_card" | "excluded_account_reconciliation" | "uncategorized-expense" | "uncategorized-income";
8
+ declare const toAuditRuleEntityIdType: (v: string) => "cash_balance" | "card_balance" | "expense_automation_card" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "profit_and_loss_by_projects" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_list_of_account_by_project" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "zeni_treasury" | "charge_cards" | "other_connection" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | "notification" | "rewards_card" | "billing" | "flux_analysis_operating_expense" | "account_reconciliation" | "zeni_credit_promo_card" | "treasury_promo_card" | "excluded_account_reconciliation" | "uncategorized-expense" | "uncategorized-income";
9
9
  export type AuditRuleEntityIdType = ReturnType<typeof toAuditRuleEntityIdType>;
10
10
  export declare const toAuditRuleTypeIdType: (v: string) => "accounting" | "business";
11
11
  type AuditRuleTypeIdType = ReturnType<typeof toAuditRuleTypeIdType>;
@@ -1,6 +1,6 @@
1
1
  import { RootState } from '../../reducer';
2
2
  export declare const getBillPayCardReport: (state: RootState) => {
3
- reportId: "cash_balance" | "card_balance" | "expense_automation_card" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "profit_and_loss_by_projects" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "zeni_treasury" | "charge_cards" | "other_connection" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | "notification" | "rewards_card" | "billing" | "flux_analysis_operating_expense" | "account_reconciliation" | "zeni_credit_promo_card" | "treasury_promo_card" | "excluded_account_reconciliation";
3
+ reportId: "cash_balance" | "card_balance" | "expense_automation_card" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "profit_and_loss_by_projects" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_list_of_account_by_project" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "zeni_treasury" | "charge_cards" | "other_connection" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | "notification" | "rewards_card" | "billing" | "flux_analysis_operating_expense" | "account_reconciliation" | "zeni_credit_promo_card" | "treasury_promo_card" | "excluded_account_reconciliation";
4
4
  reportTitle: string;
5
5
  version: string | number | undefined;
6
6
  fetchState: import("../..").FetchState;
@@ -1,6 +1,6 @@
1
1
  import { RootState } from '../../reducer';
2
2
  export declare const getCardBalance: (state: RootState) => {
3
- reportId: "cash_balance" | "card_balance" | "expense_automation_card" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "profit_and_loss_by_projects" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "zeni_treasury" | "charge_cards" | "other_connection" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | "notification" | "rewards_card" | "billing" | "flux_analysis_operating_expense" | "account_reconciliation" | "zeni_credit_promo_card" | "treasury_promo_card" | "excluded_account_reconciliation";
3
+ reportId: "cash_balance" | "card_balance" | "expense_automation_card" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "profit_and_loss_by_projects" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_list_of_account_by_project" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "zeni_treasury" | "charge_cards" | "other_connection" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | "notification" | "rewards_card" | "billing" | "flux_analysis_operating_expense" | "account_reconciliation" | "zeni_credit_promo_card" | "treasury_promo_card" | "excluded_account_reconciliation";
4
4
  reportTitle: string;
5
5
  version: string | number | undefined;
6
6
  status: import("../..").Status | undefined;
@@ -1,6 +1,6 @@
1
1
  import { RootState } from '../../reducer';
2
2
  export declare const getCashBalance: (state: RootState) => {
3
- reportId: "cash_balance" | "card_balance" | "expense_automation_card" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "profit_and_loss_by_projects" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "zeni_treasury" | "charge_cards" | "other_connection" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | "notification" | "rewards_card" | "billing" | "flux_analysis_operating_expense" | "account_reconciliation" | "zeni_credit_promo_card" | "treasury_promo_card" | "excluded_account_reconciliation";
3
+ reportId: "cash_balance" | "card_balance" | "expense_automation_card" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "profit_and_loss_by_projects" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_list_of_account_by_project" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "zeni_treasury" | "charge_cards" | "other_connection" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | "notification" | "rewards_card" | "billing" | "flux_analysis_operating_expense" | "account_reconciliation" | "zeni_credit_promo_card" | "treasury_promo_card" | "excluded_account_reconciliation";
4
4
  reportTitle: string;
5
5
  version: string | number | undefined;
6
6
  status: import("../..").Status | undefined;
@@ -15,7 +15,7 @@ export declare const getCashInCashOut: (accountState: AccountState, accountGroup
15
15
  firstMonthOfFY: 1 | 3 | 12 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11;
16
16
  dataAvailable: import("../../commonStateTypes/timeframeTick").TimeframeTick | undefined;
17
17
  availableNumberOfPeriods: number | undefined;
18
- reportId: "cash_balance" | "card_balance" | "expense_automation_card" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "profit_and_loss_by_projects" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "zeni_treasury" | "charge_cards" | "other_connection" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | "notification" | "rewards_card" | "billing" | "flux_analysis_operating_expense" | "account_reconciliation" | "zeni_credit_promo_card" | "treasury_promo_card" | "excluded_account_reconciliation";
18
+ reportId: "cash_balance" | "card_balance" | "expense_automation_card" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "profit_and_loss_by_projects" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_list_of_account_by_project" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "zeni_treasury" | "charge_cards" | "other_connection" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | "notification" | "rewards_card" | "billing" | "flux_analysis_operating_expense" | "account_reconciliation" | "zeni_credit_promo_card" | "treasury_promo_card" | "excluded_account_reconciliation";
19
19
  reportTitle: string;
20
20
  version: string | number | undefined;
21
21
  status: import("../..").Status | undefined;
@@ -12,7 +12,7 @@ export declare const getCashPosition: (accountState: AccountState, cashPositionS
12
12
  firstMonthOfFY: 1 | 3 | 12 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11;
13
13
  dataAvailable: import("../../commonStateTypes/timeframeTick").TimeframeTick | undefined;
14
14
  availableNumberOfPeriods: number | undefined;
15
- reportId: "cash_balance" | "card_balance" | "expense_automation_card" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "profit_and_loss_by_projects" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "zeni_treasury" | "charge_cards" | "other_connection" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | "notification" | "rewards_card" | "billing" | "flux_analysis_operating_expense" | "account_reconciliation" | "zeni_credit_promo_card" | "treasury_promo_card" | "excluded_account_reconciliation";
15
+ reportId: "cash_balance" | "card_balance" | "expense_automation_card" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "profit_and_loss_by_projects" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_list_of_account_by_project" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "zeni_treasury" | "charge_cards" | "other_connection" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | "notification" | "rewards_card" | "billing" | "flux_analysis_operating_expense" | "account_reconciliation" | "zeni_credit_promo_card" | "treasury_promo_card" | "excluded_account_reconciliation";
16
16
  reportTitle: string;
17
17
  version: string | number | undefined;
18
18
  status: import("../..").Status | undefined;
@@ -0,0 +1,17 @@
1
+ import { CardTenantProfileRow } from '../../entity/creditAgent/creditAgentState';
2
+ /**
3
+ * Payload shape expected by the web-app-v2 GET /tableDownload endpoint.
4
+ */
5
+ export interface CreditReportDownloadPayload {
6
+ columns: string[];
7
+ file_name: string;
8
+ rows: (string | number | null | undefined)[][];
9
+ sheet_name: string;
10
+ }
11
+ /**
12
+ * Build the payload for the web-app-v2 table download endpoint.
13
+ *
14
+ * The component calls this, then GETs the endpoint with the payload
15
+ * as a query param and handles the blob response as a file download.
16
+ */
17
+ export declare function getCreditReportDownloadPayload(rows: CardTenantProfileRow[]): CreditReportDownloadPayload;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCreditReportDownloadPayload = getCreditReportDownloadPayload;
4
+ const CREDIT_REPORT_COLUMNS = [
5
+ 'Customer Name',
6
+ 'Card Status',
7
+ 'Credit Limit ($)',
8
+ 'Credit Score',
9
+ 'Recommended Amount ($)',
10
+ 'Rationale',
11
+ 'Report Date',
12
+ 'Tenant Email Domain',
13
+ 'Tenant ID',
14
+ 'Company ID',
15
+ 'Updated By',
16
+ 'Updated On',
17
+ ];
18
+ function rowToFields(row) {
19
+ return [
20
+ row.customerName,
21
+ row.cardStatus,
22
+ row.creditLimit,
23
+ row.creditScore,
24
+ row.recommendedAmount,
25
+ row.rationale,
26
+ row.reportDate?.format('YYYY-MM-DD'),
27
+ row.tenantEmailDomain,
28
+ row.tenantId,
29
+ row.companyId,
30
+ row.updatedByName,
31
+ row.updatedOn?.format('YYYY-MM-DD'),
32
+ ];
33
+ }
34
+ /**
35
+ * Build the payload for the web-app-v2 table download endpoint.
36
+ *
37
+ * The component calls this, then GETs the endpoint with the payload
38
+ * as a query param and handles the blob response as a file download.
39
+ */
40
+ function getCreditReportDownloadPayload(rows) {
41
+ return {
42
+ columns: CREDIT_REPORT_COLUMNS,
43
+ rows: rows.map(rowToFields),
44
+ file_name: 'credit-report',
45
+ sheet_name: 'Credit Report',
46
+ };
47
+ }
@@ -0,0 +1,9 @@
1
+ import type { CardTenantProfileUpdatePayload, CardTenantProfilesPayload, MacroPayload } from '../../entity/creditAgent/creditAgentPayload';
2
+ import { ZeniAPIResponse } from '../../responsePayload';
3
+ export { CardTenantProfileRowPayload, CardTenantProfilesPayload, CardTenantProfileUpdatePayload, MacroPayload, toCardTenantProfileRow, toMacro, } from '../../entity/creditAgent/creditAgentPayload';
4
+ export type CardTenantProfilesResponse = ZeniAPIResponse<CardTenantProfilesPayload>;
5
+ export type CreditAgentAccessResponse = ZeniAPIResponse<{
6
+ is_allowed: boolean;
7
+ }>;
8
+ export type CardTenantProfileUpdateResponse = ZeniAPIResponse<CardTenantProfileUpdatePayload>;
9
+ export type MacroResponse = ZeniAPIResponse<MacroPayload>;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toMacro = exports.toCardTenantProfileRow = void 0;
4
+ // Re-export entity payload types and mapping functions.
5
+ var creditAgentPayload_1 = require("../../entity/creditAgent/creditAgentPayload");
6
+ Object.defineProperty(exports, "toCardTenantProfileRow", { enumerable: true, get: function () { return creditAgentPayload_1.toCardTenantProfileRow; } });
7
+ Object.defineProperty(exports, "toMacro", { enumerable: true, get: function () { return creditAgentPayload_1.toMacro; } });
@@ -0,0 +1,41 @@
1
+ import { CardTenantProfileRowPayload } from '../../entity/creditAgent/creditAgentPayload';
2
+ import { CardStatus } from '../../entity/creditAgent/creditAgentState';
3
+ import { ZeniAPIStatus } from '../../responsePayload';
4
+ import { CreditAgentUIState, CreditAgentViewState } from './creditAgentViewState';
5
+ export declare const initialCreditAgentViewState: CreditAgentViewState;
6
+ export declare const fetchCreditAgentAccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"creditAgentView/fetchCreditAgentAccess">, fetchCreditAgentAccessSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "creditAgentView/fetchCreditAgentAccessSuccess">, fetchCreditAgentAccessFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "creditAgentView/fetchCreditAgentAccessFailure">, scheduleTenantCreditScoreCron: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId?: string | undefined], {
7
+ tenantId: string | undefined;
8
+ }, "creditAgentView/scheduleTenantCreditScoreCron", never, never>, scheduleTenantCreditScoreCronSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId?: string | undefined], {
9
+ tenantId: string | undefined;
10
+ }, "creditAgentView/scheduleTenantCreditScoreCronSuccess", never, never>, scheduleTenantCreditScoreCronFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string | undefined, error: ZeniAPIStatus<Record<string, unknown>>], {
11
+ tenantId: string | undefined;
12
+ error: ZeniAPIStatus<Record<string, unknown>>;
13
+ }, "creditAgentView/scheduleTenantCreditScoreCronFailure", never, never>, fetchCreditAgentMacro: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"creditAgentView/fetchCreditAgentMacro">, fetchCreditAgentMacroSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"creditAgentView/fetchCreditAgentMacroSuccess">, fetchCreditAgentMacroFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "creditAgentView/fetchCreditAgentMacroFailure">, saveCreditAgentMacro: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[instructions: string], {
14
+ instructions: string;
15
+ }, "creditAgentView/saveCreditAgentMacro", never, never>, saveCreditAgentMacroSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"creditAgentView/saveCreditAgentMacroSuccess">, saveCreditAgentMacroFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "creditAgentView/saveCreditAgentMacroFailure">, resetSaveMacroState: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"creditAgentView/resetSaveMacroState">, fetchCardProfiles: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"creditAgentView/fetchCardProfiles">, fetchCardProfilesSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<CardTenantProfileRowPayload[], "creditAgentView/fetchCardProfilesSuccess">, fetchCardProfilesFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "creditAgentView/fetchCardProfilesFailure">, updateCardProfile: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload: {
16
+ tenantEmailDomain: string;
17
+ tenantId: string;
18
+ update: {
19
+ cardStatus?: CardStatus;
20
+ creditLimit?: number;
21
+ reason?: string;
22
+ updatedByName?: string;
23
+ };
24
+ }], {
25
+ tenantEmailDomain: string;
26
+ tenantId: string;
27
+ update: {
28
+ cardStatus?: CardStatus;
29
+ creditLimit?: number;
30
+ reason?: string;
31
+ updatedByName?: string;
32
+ };
33
+ }, "creditAgentView/updateCardProfile", never, never>, updateCardProfileSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string], {
34
+ tenantId: string;
35
+ }, "creditAgentView/updateCardProfileSuccess", never, never>, updateCardProfileFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, error: ZeniAPIStatus<Record<string, unknown>>], {
36
+ tenantId: string;
37
+ error: ZeniAPIStatus<Record<string, unknown>>;
38
+ }, "creditAgentView/updateCardProfileFailure", never, never>, updateCreditAgentUIState: import("@reduxjs/toolkit").ActionCreatorWithPayload<Partial<CreditAgentUIState>, "creditAgentView/updateCreditAgentUIState">, clearCreditAgentView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"creditAgentView/clearCreditAgentView">;
39
+ export { initialCreditAgentViewState as initialState };
40
+ declare const _default: import("redux").Reducer<CreditAgentViewState>;
41
+ export default _default;
@@ -0,0 +1,187 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.initialState = exports.clearCreditAgentView = exports.updateCreditAgentUIState = exports.updateCardProfileFailure = exports.updateCardProfileSuccess = exports.updateCardProfile = exports.fetchCardProfilesFailure = exports.fetchCardProfilesSuccess = exports.fetchCardProfiles = exports.resetSaveMacroState = exports.saveCreditAgentMacroFailure = exports.saveCreditAgentMacroSuccess = exports.saveCreditAgentMacro = exports.fetchCreditAgentMacroFailure = exports.fetchCreditAgentMacroSuccess = exports.fetchCreditAgentMacro = exports.scheduleTenantCreditScoreCronFailure = exports.scheduleTenantCreditScoreCronSuccess = exports.scheduleTenantCreditScoreCron = exports.fetchCreditAgentAccessFailure = exports.fetchCreditAgentAccessSuccess = exports.fetchCreditAgentAccess = exports.initialCreditAgentViewState = void 0;
5
+ const toolkit_1 = require("@reduxjs/toolkit");
6
+ const initialTenantView = {
7
+ analyzeStatus: { fetchState: 'Not-Started' },
8
+ updateStatus: { fetchState: 'Not-Started' },
9
+ };
10
+ function getOrCreateTenantView(draft, tenantId) {
11
+ if (draft.tenantViewByTenantId[tenantId] == null) {
12
+ draft.tenantViewByTenantId[tenantId] = {
13
+ ...initialTenantView,
14
+ tenantId,
15
+ };
16
+ }
17
+ return draft.tenantViewByTenantId[tenantId];
18
+ }
19
+ exports.initialCreditAgentViewState = {
20
+ access: {
21
+ fetchStatus: { fetchState: 'Not-Started' },
22
+ isAllowed: false,
23
+ },
24
+ macro: {
25
+ fetchStatus: { fetchState: 'Not-Started' },
26
+ updateStatus: { fetchState: 'Not-Started' },
27
+ },
28
+ profilesFetchStatus: { fetchState: 'Not-Started' },
29
+ tenantViewByTenantId: {},
30
+ uiState: {
31
+ filterText: '',
32
+ focus: 'All',
33
+ minScore: 0,
34
+ sortDir: 'asc',
35
+ sortKey: undefined,
36
+ },
37
+ };
38
+ exports.initialState = exports.initialCreditAgentViewState;
39
+ const creditAgentView = (0, toolkit_1.createSlice)({
40
+ name: 'creditAgentView',
41
+ initialState: exports.initialCreditAgentViewState,
42
+ reducers: {
43
+ // ── Access ──
44
+ fetchCreditAgentAccess(draft) {
45
+ draft.access.fetchStatus = { fetchState: 'In-Progress' };
46
+ },
47
+ fetchCreditAgentAccessSuccess(draft, action) {
48
+ draft.access.fetchStatus = { fetchState: 'Completed' };
49
+ draft.access.isAllowed = action.payload;
50
+ },
51
+ fetchCreditAgentAccessFailure(draft, action) {
52
+ draft.access.fetchStatus = { fetchState: 'Error', error: action.payload };
53
+ },
54
+ // ── Card Profiles (list-level fetch) ──
55
+ fetchCardProfiles(draft) {
56
+ draft.profilesFetchStatus = { fetchState: 'In-Progress' };
57
+ },
58
+ fetchCardProfilesSuccess(draft, action) {
59
+ draft.profilesFetchStatus = { fetchState: 'Completed' };
60
+ // Replace entire tenantViewByTenantId, preserving existing statuses
61
+ // for tenants still present, removing stale ones.
62
+ draft.tenantViewByTenantId = toTenantViewByTenantId(action.payload, draft.tenantViewByTenantId);
63
+ },
64
+ fetchCardProfilesFailure(draft, action) {
65
+ draft.profilesFetchStatus = { fetchState: 'Error', error: action.payload };
66
+ },
67
+ // ── Update Card Profile (per-tenant) ──
68
+ updateCardProfile: {
69
+ reducer(draft, action) {
70
+ const tv = getOrCreateTenantView(draft, action.payload.tenantId);
71
+ tv.updateStatus = { fetchState: 'In-Progress' };
72
+ },
73
+ prepare(payload) {
74
+ return { payload };
75
+ },
76
+ },
77
+ updateCardProfileSuccess: {
78
+ reducer(draft, action) {
79
+ const tv = getOrCreateTenantView(draft, action.payload.tenantId);
80
+ tv.updateStatus = { fetchState: 'Completed' };
81
+ },
82
+ prepare(tenantId) {
83
+ return { payload: { tenantId } };
84
+ },
85
+ },
86
+ updateCardProfileFailure: {
87
+ reducer(draft, action) {
88
+ const tv = getOrCreateTenantView(draft, action.payload.tenantId);
89
+ tv.updateStatus = {
90
+ fetchState: 'Error',
91
+ error: action.payload.error,
92
+ };
93
+ },
94
+ prepare(tenantId, error) {
95
+ return { payload: { tenantId, error } };
96
+ },
97
+ },
98
+ // ── Analyze / Schedule Cron (per-tenant) ──
99
+ scheduleTenantCreditScoreCron: {
100
+ reducer(draft, action) {
101
+ if (action.payload.tenantId != null) {
102
+ const tv = getOrCreateTenantView(draft, action.payload.tenantId);
103
+ tv.analyzeStatus = { fetchState: 'In-Progress' };
104
+ }
105
+ },
106
+ prepare(tenantId) {
107
+ return { payload: { tenantId } };
108
+ },
109
+ },
110
+ scheduleTenantCreditScoreCronSuccess: {
111
+ reducer(draft, action) {
112
+ if (action.payload.tenantId != null) {
113
+ const tv = getOrCreateTenantView(draft, action.payload.tenantId);
114
+ tv.analyzeStatus = { fetchState: 'Completed' };
115
+ }
116
+ },
117
+ prepare(tenantId) {
118
+ return { payload: { tenantId } };
119
+ },
120
+ },
121
+ scheduleTenantCreditScoreCronFailure: {
122
+ reducer(draft, action) {
123
+ if (action.payload.tenantId != null) {
124
+ const tv = getOrCreateTenantView(draft, action.payload.tenantId);
125
+ tv.analyzeStatus = {
126
+ fetchState: 'Error',
127
+ error: action.payload.error,
128
+ };
129
+ }
130
+ },
131
+ prepare(tenantId, error) {
132
+ return { payload: { tenantId, error } };
133
+ },
134
+ },
135
+ // ── Macro ──
136
+ fetchCreditAgentMacro(draft) {
137
+ draft.macro.fetchStatus = { fetchState: 'In-Progress' };
138
+ },
139
+ fetchCreditAgentMacroSuccess(draft) {
140
+ draft.macro.fetchStatus = { fetchState: 'Completed' };
141
+ },
142
+ fetchCreditAgentMacroFailure(draft, action) {
143
+ draft.macro.fetchStatus = { fetchState: 'Error', error: action.payload };
144
+ },
145
+ saveCreditAgentMacro: {
146
+ reducer(draft) {
147
+ draft.macro.updateStatus = { fetchState: 'In-Progress' };
148
+ },
149
+ prepare(instructions) {
150
+ return { payload: { instructions } };
151
+ },
152
+ },
153
+ saveCreditAgentMacroSuccess(draft) {
154
+ draft.macro.updateStatus = { fetchState: 'Completed' };
155
+ },
156
+ saveCreditAgentMacroFailure(draft, action) {
157
+ draft.macro.updateStatus = { fetchState: 'Error', error: action.payload };
158
+ },
159
+ resetSaveMacroState(draft) {
160
+ draft.macro.updateStatus = { fetchState: 'Not-Started' };
161
+ },
162
+ // ── UI State ──
163
+ updateCreditAgentUIState(draft, action) {
164
+ Object.assign(draft.uiState, action.payload);
165
+ },
166
+ // ── Clear ──
167
+ clearCreditAgentView() {
168
+ return exports.initialCreditAgentViewState;
169
+ },
170
+ },
171
+ });
172
+ _a = creditAgentView.actions, exports.fetchCreditAgentAccess = _a.fetchCreditAgentAccess, exports.fetchCreditAgentAccessSuccess = _a.fetchCreditAgentAccessSuccess, exports.fetchCreditAgentAccessFailure = _a.fetchCreditAgentAccessFailure, exports.scheduleTenantCreditScoreCron = _a.scheduleTenantCreditScoreCron, exports.scheduleTenantCreditScoreCronSuccess = _a.scheduleTenantCreditScoreCronSuccess, exports.scheduleTenantCreditScoreCronFailure = _a.scheduleTenantCreditScoreCronFailure, exports.fetchCreditAgentMacro = _a.fetchCreditAgentMacro, exports.fetchCreditAgentMacroSuccess = _a.fetchCreditAgentMacroSuccess, exports.fetchCreditAgentMacroFailure = _a.fetchCreditAgentMacroFailure, exports.saveCreditAgentMacro = _a.saveCreditAgentMacro, exports.saveCreditAgentMacroSuccess = _a.saveCreditAgentMacroSuccess, exports.saveCreditAgentMacroFailure = _a.saveCreditAgentMacroFailure, exports.resetSaveMacroState = _a.resetSaveMacroState, exports.fetchCardProfiles = _a.fetchCardProfiles, exports.fetchCardProfilesSuccess = _a.fetchCardProfilesSuccess, exports.fetchCardProfilesFailure = _a.fetchCardProfilesFailure, exports.updateCardProfile = _a.updateCardProfile, exports.updateCardProfileSuccess = _a.updateCardProfileSuccess, exports.updateCardProfileFailure = _a.updateCardProfileFailure, exports.updateCreditAgentUIState = _a.updateCreditAgentUIState, exports.clearCreditAgentView = _a.clearCreditAgentView;
173
+ exports.default = creditAgentView.reducer;
174
+ // ── Helpers ──
175
+ const toTenantViewByTenantId = (rows, existing) => {
176
+ const result = {};
177
+ for (const row of rows) {
178
+ const tenantId = row.tenant_id;
179
+ const existingState = existing[tenantId];
180
+ result[tenantId] = existingState ?? {
181
+ analyzeStatus: { fetchState: 'Not-Started' },
182
+ tenantId,
183
+ updateStatus: { fetchState: 'Not-Started' },
184
+ };
185
+ }
186
+ return result;
187
+ };
@@ -0,0 +1,20 @@
1
+ import { FetchStateAndError } from '../../commonStateTypes/common';
2
+ import { CardTenantProfileRow, CreditAgentEntityState, CreditAgentMacro } from '../../entity/creditAgent/creditAgentState';
3
+ import { RootState } from '../../reducer';
4
+ import { CreditAgentUIState, CreditAgentViewState } from './creditAgentViewState';
5
+ export declare const getCreditAgentView: (state: RootState) => CreditAgentViewState;
6
+ export declare const getCreditAgentEntity: (state: RootState) => CreditAgentEntityState;
7
+ export declare const getCreditAgentMacro: (state: RootState) => {
8
+ fetchStatus: FetchStateAndError;
9
+ updateStatus: FetchStateAndError;
10
+ data?: CreditAgentMacro;
11
+ };
12
+ export interface CardProfileRowWithStatus extends CardTenantProfileRow {
13
+ analyzeStatus: FetchStateAndError;
14
+ updateStatus: FetchStateAndError;
15
+ }
16
+ export declare const getCardProfilesData: (state: RootState) => {
17
+ fetchStatus: FetchStateAndError;
18
+ rows: CardProfileRowWithStatus[];
19
+ uiState: CreditAgentUIState;
20
+ };
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getCardProfilesData = exports.getCreditAgentMacro = exports.getCreditAgentEntity = exports.getCreditAgentView = void 0;
7
+ const toolkit_1 = require("@reduxjs/toolkit");
8
+ const orderBy_1 = __importDefault(require("lodash/orderBy"));
9
+ const getCreditAgentView = (state) => state.creditAgentViewState;
10
+ exports.getCreditAgentView = getCreditAgentView;
11
+ const getCreditAgentEntity = (state) => state.creditAgentEntityState;
12
+ exports.getCreditAgentEntity = getCreditAgentEntity;
13
+ exports.getCreditAgentMacro = (0, toolkit_1.createSelector)(exports.getCreditAgentView, exports.getCreditAgentEntity, (view, entity) => ({
14
+ ...view.macro,
15
+ data: entity.macro,
16
+ }));
17
+ exports.getCardProfilesData = (0, toolkit_1.createSelector)(exports.getCreditAgentView, exports.getCreditAgentEntity, (view, entity) => {
18
+ const { uiState } = view;
19
+ const allRows = Object.values(entity.rowByTenantId).map((row) => {
20
+ const tenantView = view.tenantViewByTenantId[row.tenantId];
21
+ return {
22
+ ...row,
23
+ analyzeStatus: tenantView?.analyzeStatus ?? {
24
+ fetchState: 'Not-Started',
25
+ },
26
+ updateStatus: tenantView?.updateStatus ?? { fetchState: 'Not-Started' },
27
+ };
28
+ });
29
+ let filteredRows = allRows;
30
+ // Text filter
31
+ const trimmedFilterText = uiState.filterText.trim();
32
+ if (trimmedFilterText.length > 0) {
33
+ const query = trimmedFilterText.toLowerCase();
34
+ filteredRows = filteredRows.filter((row) => (row.customerName ?? '').toLowerCase().includes(query) ||
35
+ row.tenantId.toLowerCase().includes(query));
36
+ }
37
+ // Focus filter
38
+ filteredRows = applyFocusFilter(filteredRows, uiState.focus);
39
+ // Min score filter
40
+ if (uiState.minScore > 0) {
41
+ filteredRows = filteredRows.filter((row) => {
42
+ const score = parseFloat(row.creditScore ?? '0');
43
+ return score >= uiState.minScore;
44
+ });
45
+ }
46
+ // Sorting
47
+ const sortedRows = getSortedRows(filteredRows, uiState.sortKey, uiState.sortDir);
48
+ return {
49
+ fetchStatus: view.profilesFetchStatus,
50
+ rows: sortedRows,
51
+ uiState,
52
+ };
53
+ });
54
+ // ── Helpers ──
55
+ const applyFocusFilter = (rows, focus) => {
56
+ switch (focus) {
57
+ case 'New only':
58
+ return rows.filter((row) => row.isNew);
59
+ case 'Interested':
60
+ return rows.filter((row) => row.cardStatus === 'Interested');
61
+ case 'Active only':
62
+ return rows.filter((row) => row.cardStatus === 'Active' || row.cardStatus === 'Enabled');
63
+ case 'All':
64
+ default:
65
+ return rows;
66
+ }
67
+ };
68
+ const getSortedRows = (rows, sortKey, sortDir) => {
69
+ if (sortKey == null) {
70
+ return rows;
71
+ }
72
+ const direction = sortDir === 'asc' ? 'asc' : 'desc';
73
+ return (0, orderBy_1.default)(rows, (row) => {
74
+ switch (sortKey) {
75
+ case 'name':
76
+ return (row.customerName ?? '').toLowerCase();
77
+ case 'status':
78
+ return row.cardStatus.toLowerCase();
79
+ case 'creditLimit':
80
+ return row.creditLimit ?? 0;
81
+ case 'creditScore':
82
+ return parseFloat(row.creditScore ?? '0');
83
+ case 'recAmount':
84
+ return row.recommendedAmount ?? 0;
85
+ case 'reportDate':
86
+ return row.reportDate?.valueOf() ?? 0;
87
+ case 'updatedBy':
88
+ return (row.updatedByName ?? '').toLowerCase();
89
+ default:
90
+ return (row.customerName ?? '').toLowerCase();
91
+ }
92
+ }, direction);
93
+ };
@@ -0,0 +1,34 @@
1
+ import { FetchStateAndError, ID } from '../../commonStateTypes/common';
2
+ export type { CardStatus, CardTenantProfileRow, CreditAgentMacro, } from '../../entity/creditAgent/creditAgentState';
3
+ declare const toCreditAgentSortKeyType: (v: string) => "status" | "name" | "creditLimit" | "creditScore" | "reportDate" | "recAmount" | "updatedBy";
4
+ export type CreditAgentSortKey = ReturnType<typeof toCreditAgentSortKeyType>;
5
+ export type CreditAgentSortDir = 'asc' | 'desc';
6
+ declare const toCreditAgentFocusFilterType: (v: string) => "Interested" | "All" | "New only" | "Active only";
7
+ export type CreditAgentFocusFilter = ReturnType<typeof toCreditAgentFocusFilterType>;
8
+ export interface CreditAgentUIState {
9
+ filterText: string;
10
+ focus: CreditAgentFocusFilter;
11
+ minScore: number;
12
+ sortDir: CreditAgentSortDir;
13
+ sortKey?: CreditAgentSortKey;
14
+ }
15
+ export interface CreditAgentAccessState {
16
+ fetchStatus: FetchStateAndError;
17
+ isAllowed: boolean;
18
+ }
19
+ export interface CreditAgentTenantView {
20
+ analyzeStatus: FetchStateAndError;
21
+ tenantId: ID;
22
+ updateStatus: FetchStateAndError;
23
+ }
24
+ export interface CreditAgentMacroState {
25
+ fetchStatus: FetchStateAndError;
26
+ updateStatus: FetchStateAndError;
27
+ }
28
+ export interface CreditAgentViewState {
29
+ access: CreditAgentAccessState;
30
+ macro: CreditAgentMacroState;
31
+ profilesFetchStatus: FetchStateAndError;
32
+ tenantViewByTenantId: Record<ID, CreditAgentTenantView>;
33
+ uiState: CreditAgentUIState;
34
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
4
+ const ALL_CREDIT_AGENT_SORT_KEYS = [
5
+ 'name',
6
+ 'status',
7
+ 'creditLimit',
8
+ 'creditScore',
9
+ 'recAmount',
10
+ 'reportDate',
11
+ 'updatedBy',
12
+ ];
13
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
14
+ const toCreditAgentSortKeyType = (v) => (0, stringToUnion_1.stringToUnion)(v, ALL_CREDIT_AGENT_SORT_KEYS);
15
+ const ALL_CREDIT_AGENT_FOCUS_FILTERS = [
16
+ 'All',
17
+ 'New only',
18
+ 'Interested',
19
+ 'Active only',
20
+ ];
21
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
22
+ const toCreditAgentFocusFilterType = (v) => (0, stringToUnion_1.stringToUnion)(v, ALL_CREDIT_AGENT_FOCUS_FILTERS);
@@ -0,0 +1,15 @@
1
+ import { ActionsObservable } from 'redux-observable';
2
+ import { updateCreditAgentRows } from '../../../entity/creditAgent/creditAgentReducer';
3
+ import { ZeniAPI } from '../../../zeniAPI';
4
+ import { fetchCardProfiles, fetchCardProfilesFailure, fetchCardProfilesSuccess } from '../creditAgentViewReducer';
5
+ export type ActionType = ReturnType<typeof fetchCardProfiles> | ReturnType<typeof fetchCardProfilesSuccess> | ReturnType<typeof fetchCardProfilesFailure> | ReturnType<typeof updateCreditAgentRows>;
6
+ export declare const fetchCardProfilesEpic: (actions$: ActionsObservable<ActionType>, _state$: unknown, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
7
+ payload: import("../creditAgentViewPayload").CardTenantProfileRowPayload[];
8
+ type: "creditAgentView/fetchCardProfilesSuccess";
9
+ } | {
10
+ payload: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
11
+ type: "creditAgentView/fetchCardProfilesFailure";
12
+ } | {
13
+ payload: import("../creditAgentViewPayload").CardTenantProfileRowPayload[];
14
+ type: "creditAgent/updateCreditAgentRows";
15
+ }>;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchCardProfilesEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const creditAgentReducer_1 = require("../../../entity/creditAgent/creditAgentReducer");
7
+ const responsePayload_1 = require("../../../responsePayload");
8
+ const creditAgentViewReducer_1 = require("../creditAgentViewReducer");
9
+ const fetchCardProfilesEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(creditAgentViewReducer_1.fetchCardProfiles.match), (0, operators_1.switchMap)(() => {
10
+ const url = `${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/cockpit/card-tenant-profiles`;
11
+ return zeniAPI.getJSON(url).pipe((0, operators_1.mergeMap)((response) => {
12
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
13
+ const rawRows = response.data.rows;
14
+ return (0, rxjs_1.from)([
15
+ (0, creditAgentReducer_1.updateCreditAgentRows)(rawRows),
16
+ (0, creditAgentViewReducer_1.fetchCardProfilesSuccess)(rawRows),
17
+ ]);
18
+ }
19
+ else {
20
+ return (0, rxjs_1.of)((0, creditAgentViewReducer_1.fetchCardProfilesFailure)(response.status));
21
+ }
22
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, creditAgentViewReducer_1.fetchCardProfilesFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'REST API call errored out: ' + JSON.stringify(error))))));
23
+ }));
24
+ exports.fetchCardProfilesEpic = fetchCardProfilesEpic;