@zeniai/client-epic-state 5.0.82 → 5.0.83-betaRR1

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 (142) hide show
  1. package/lib/common/aiCfo/aiCfoSuggestedQuestionsPageContext.d.ts +1 -1
  2. package/lib/entity/aiCfo/aiCfoPayload.d.ts +140 -1
  3. package/lib/entity/aiCfo/aiCfoReducer.d.ts +23 -2
  4. package/lib/entity/aiCfo/aiCfoReducer.js +328 -5
  5. package/lib/entity/aiCfo/aiCfoSelector.d.ts +13 -1
  6. package/lib/entity/aiCfo/aiCfoSelector.js +28 -1
  7. package/lib/entity/aiCfo/aiCfoState.d.ts +225 -4
  8. package/lib/entity/aiCfo/aiCfoState.js +30 -1
  9. package/lib/entity/cardPolicy/cardPolicyPayload.d.ts +277 -0
  10. package/lib/entity/cardPolicy/cardPolicyPayload.js +143 -0
  11. package/lib/entity/cardPolicy/cardPolicyReducer.d.ts +19 -0
  12. package/lib/entity/cardPolicy/cardPolicyReducer.js +175 -0
  13. package/lib/entity/cardPolicy/cardPolicySelector.d.ts +32 -0
  14. package/lib/entity/cardPolicy/cardPolicySelector.js +99 -0
  15. package/lib/entity/cardPolicy/cardPolicyState.d.ts +205 -0
  16. package/lib/entity/cardPolicy/cardPolicyState.js +14 -0
  17. package/lib/entity/cardPolicy/extractPolicyDocumentEpic.d.ts +18 -0
  18. package/lib/entity/cardPolicy/extractPolicyDocumentEpic.js +68 -0
  19. package/lib/entity/cardPolicy/fetchCardPolicyVendorOptionsEpic.d.ts +26 -0
  20. package/lib/entity/cardPolicy/fetchCardPolicyVendorOptionsEpic.js +47 -0
  21. package/lib/entity/cardPolicy/policyDocumentExtractionToRecommendationBridgeEpic.d.ts +25 -0
  22. package/lib/entity/cardPolicy/policyDocumentExtractionToRecommendationBridgeEpic.js +39 -0
  23. package/lib/entity/cardPolicy/policyRecommendationFromUploadEpic.d.ts +23 -0
  24. package/lib/entity/cardPolicy/policyRecommendationFromUploadEpic.js +104 -0
  25. package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +1 -1
  26. package/lib/entity/monthEndCloseChecks/monthEndCloseChecksState.d.ts +1 -1
  27. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  28. package/lib/entity/snackbar/snackbarTypes.js +3 -0
  29. package/lib/entity/tenant/clearAllEpic.d.ts +6 -2
  30. package/lib/entity/tenant/clearAllEpic.js +8 -0
  31. package/lib/epic.d.ts +11 -1
  32. package/lib/epic.js +11 -1
  33. package/lib/esm/entity/aiCfo/aiCfoReducer.js +328 -5
  34. package/lib/esm/entity/aiCfo/aiCfoSelector.js +26 -1
  35. package/lib/esm/entity/aiCfo/aiCfoState.js +27 -0
  36. package/lib/esm/entity/cardPolicy/cardPolicyPayload.js +130 -0
  37. package/lib/esm/entity/cardPolicy/cardPolicyReducer.js +171 -0
  38. package/lib/esm/entity/cardPolicy/cardPolicySelector.js +75 -0
  39. package/lib/esm/entity/cardPolicy/cardPolicyState.js +9 -0
  40. package/lib/esm/entity/cardPolicy/extractPolicyDocumentEpic.js +64 -0
  41. package/lib/esm/entity/cardPolicy/fetchCardPolicyVendorOptionsEpic.js +43 -0
  42. package/lib/esm/entity/cardPolicy/policyDocumentExtractionToRecommendationBridgeEpic.js +35 -0
  43. package/lib/esm/entity/cardPolicy/policyRecommendationFromUploadEpic.js +100 -0
  44. package/lib/esm/entity/snackbar/snackbarTypes.js +3 -0
  45. package/lib/esm/entity/tenant/clearAllEpic.js +8 -0
  46. package/lib/esm/epic.js +11 -1
  47. package/lib/esm/index.js +27 -8
  48. package/lib/esm/reducer.js +12 -0
  49. package/lib/esm/view/aiCfoView/aiCfoViewReducer.js +6 -3
  50. package/lib/esm/view/aiCfoView/epics/createSessionAndSubmitEpic.js +5 -2
  51. package/lib/esm/view/aiCfoView/epics/createSessionEpic.js +2 -1
  52. package/lib/esm/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +12 -2
  53. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.js +70 -0
  54. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.js +22 -0
  55. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.js +1 -0
  56. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.js +56 -0
  57. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.js +49 -0
  58. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.js +42 -0
  59. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.js +72 -0
  60. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.js +21 -0
  61. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.js +1 -0
  62. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.js +56 -0
  63. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.js +45 -0
  64. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.js +39 -0
  65. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.js +1 -0
  66. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.js +53 -0
  67. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.js +25 -0
  68. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +25 -0
  69. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/aiCardCreationFormDraftTypes.js +1 -0
  70. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/applyAiCardCreationFormDraftUpdate.js +20 -0
  71. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/buildAiCardCreationFormDraftSeed.js +62 -0
  72. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/deriveAiCardRowsFromTeams.js +47 -0
  73. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.js +2 -2
  74. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.js +48 -4
  75. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.js +61 -0
  76. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/toIssueChargeCardLocalDataFromDraft.js +69 -0
  77. package/lib/index.d.ts +26 -8
  78. package/lib/index.js +141 -13
  79. package/lib/reducer.d.ts +12 -0
  80. package/lib/reducer.js +12 -0
  81. package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +11 -2
  82. package/lib/view/aiCfoView/aiCfoViewReducer.js +6 -3
  83. package/lib/view/aiCfoView/epics/createSessionAndSubmitEpic.js +5 -2
  84. package/lib/view/aiCfoView/epics/createSessionEpic.js +2 -1
  85. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.d.ts +8 -1
  86. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +12 -2
  87. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  88. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +1 -1
  89. package/lib/view/people/peopleTypes.d.ts +1 -1
  90. package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
  91. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.d.ts +14 -0
  92. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.js +74 -0
  93. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.d.ts +21 -0
  94. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.js +28 -0
  95. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.d.ts +25 -0
  96. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.js +2 -0
  97. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.d.ts +19 -0
  98. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.js +60 -0
  99. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.d.ts +18 -0
  100. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.js +53 -0
  101. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.d.ts +16 -0
  102. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.js +46 -0
  103. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.d.ts +15 -0
  104. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.js +76 -0
  105. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.d.ts +21 -0
  106. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.js +27 -0
  107. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.d.ts +19 -0
  108. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.js +2 -0
  109. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.d.ts +19 -0
  110. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.js +60 -0
  111. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.d.ts +13 -0
  112. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.js +49 -0
  113. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.d.ts +32 -0
  114. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.js +46 -0
  115. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.d.ts +45 -0
  116. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.js +2 -0
  117. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.d.ts +25 -0
  118. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.js +57 -0
  119. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.d.ts +15 -0
  120. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.js +29 -0
  121. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
  122. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.d.ts +14 -0
  123. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +27 -1
  124. package/lib/view/spendManagement/chargeCards/issueChargeCard/aiCardCreationFormDraftTypes.d.ts +79 -0
  125. package/lib/view/spendManagement/chargeCards/issueChargeCard/aiCardCreationFormDraftTypes.js +2 -0
  126. package/lib/view/spendManagement/chargeCards/issueChargeCard/applyAiCardCreationFormDraftUpdate.d.ts +6 -0
  127. package/lib/view/spendManagement/chargeCards/issueChargeCard/applyAiCardCreationFormDraftUpdate.js +24 -0
  128. package/lib/view/spendManagement/chargeCards/issueChargeCard/buildAiCardCreationFormDraftSeed.d.ts +25 -0
  129. package/lib/view/spendManagement/chargeCards/issueChargeCard/buildAiCardCreationFormDraftSeed.js +66 -0
  130. package/lib/view/spendManagement/chargeCards/issueChargeCard/deriveAiCardRowsFromTeams.d.ts +26 -0
  131. package/lib/view/spendManagement/chargeCards/issueChargeCard/deriveAiCardRowsFromTeams.js +51 -0
  132. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.d.ts +2 -2
  133. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.js +1 -1
  134. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.d.ts +12 -2
  135. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.js +49 -5
  136. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.d.ts +42 -0
  137. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.js +68 -1
  138. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardState.d.ts +18 -0
  139. package/lib/view/spendManagement/chargeCards/issueChargeCard/toIssueChargeCardLocalDataFromDraft.d.ts +11 -0
  140. package/lib/view/spendManagement/chargeCards/issueChargeCard/toIssueChargeCardLocalDataFromDraft.js +73 -0
  141. package/lib/view/taskManager/taskListView/taskListReducer.d.ts +1 -1
  142. package/package.json +1 -1
@@ -8,11 +8,12 @@ const responsePayload_1 = require("../../../responsePayload");
8
8
  const zeniDayJS_1 = require("../../../zeniDayJS");
9
9
  const aiCfoViewReducer_1 = require("../aiCfoViewReducer");
10
10
  const createSessionEpic = (actions$, _, zeniAPI) => actions$.pipe((0, operators_1.filter)(aiCfoViewReducer_1.createSession.match), (0, operators_1.switchMap)((action) => {
11
- const { agentId, contextRefId, contextType, userId } = action.payload;
11
+ const { agentId, contextRefId, contextType, pageContext, userId } = action.payload;
12
12
  const payload = {
13
13
  agent_id: agentId,
14
14
  ...(contextRefId != null && { context_ref_id: contextRefId }),
15
15
  ...(contextType != null && { context_type: contextType }),
16
+ ...(pageContext != null && { page_context: pageContext }),
16
17
  };
17
18
  return zeniAPI
18
19
  .postAndGetJSON(`${zeniAPI.apiEndPoints.aiCfoMicroServiceBaseUrl}/1.0/sessions`, payload)
@@ -4,5 +4,12 @@ import { RootState } from '../../../reducer';
4
4
  import { ZeniAPI } from '../../../zeniAPI';
5
5
  import { fetchSuggestedQuestions, fetchSuggestedQuestionsFailure, fetchSuggestedQuestionsSuccess } from '../aiCfoViewReducer';
6
6
  export type ActionType = ReturnType<typeof fetchSuggestedQuestions> | ReturnType<typeof fetchSuggestedQuestionsSuccess> | ReturnType<typeof fetchSuggestedQuestionsFailure>;
7
- /** GET {aiCfoMicroServiceBaseUrl}/1.0/suggested-questions?page_context=... */
7
+ /**
8
+ * GET {aiCfoMicroServiceBaseUrl}/1.0/suggested-questions?page_context=...
9
+ *
10
+ * Appends `&no_card_created=true` when the action payload sets
11
+ * `noCardCreated: true` (AI Card Creation flow on the cards list — the tenant
12
+ * has not yet created any card). Any other value omits the flag entirely so
13
+ * the existing call sites continue to issue the unchanged request.
14
+ */
8
15
  export declare const fetchSuggestedQuestionsEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -5,13 +5,23 @@ const rxjs_1 = require("rxjs");
5
5
  const operators_1 = require("rxjs/operators");
6
6
  const responsePayload_1 = require("../../../responsePayload");
7
7
  const aiCfoViewReducer_1 = require("../aiCfoViewReducer");
8
- /** GET {aiCfoMicroServiceBaseUrl}/1.0/suggested-questions?page_context=... */
8
+ /**
9
+ * GET {aiCfoMicroServiceBaseUrl}/1.0/suggested-questions?page_context=...
10
+ *
11
+ * Appends `&no_card_created=true` when the action payload sets
12
+ * `noCardCreated: true` (AI Card Creation flow on the cards list — the tenant
13
+ * has not yet created any card). Any other value omits the flag entirely so
14
+ * the existing call sites continue to issue the unchanged request.
15
+ */
9
16
  const fetchSuggestedQuestionsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(aiCfoViewReducer_1.fetchSuggestedQuestions.match),
10
17
  // mergeMap (not switchMap): each page_context is keyed separately in Redux; switchMap
11
18
  // would cancel in-flight HTTP for context A when B is requested, leaving A stuck In-Progress.
12
19
  (0, operators_1.mergeMap)((action) => {
13
- const { pageContext } = action.payload;
20
+ const { pageContext, noCardCreated } = action.payload;
14
21
  const query = new URLSearchParams({ page_context: pageContext });
22
+ if (noCardCreated === true) {
23
+ query.set('no_card_created', 'true');
24
+ }
15
25
  const url = `${zeniAPI.apiEndPoints.aiCfoMicroServiceBaseUrl}/1.0/suggested-questions?${query.toString()}`;
16
26
  return zeniAPI.getJSON(url).pipe((0, operators_1.mergeMap)((response) => {
17
27
  if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
@@ -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" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_month_end_email_sent" | "cockpit_month_end_email_save" | "cockpit_month_end_email_attachment_upload" | "je_bill_link" | "je_posted" | "audit_score_updated" | "people_invite_people" | "people_invite_multiple_people" | "people_delete_person" | "people_update_person" | "reimbursement_updated" | "reimbursement_deleted" | "reimbursement_cancelled_deleted" | "reimbursement_cancelled" | "reimbursement_approved" | "reimbursement_rejected" | "reimbursement_sent_for_approval" | "account_added" | "business_verification_save" | "business_verification_submit" | "business_verification_from_bills_submit" | "plaid_connection" | "unlink_deposit_account" | "reimbursement_setup" | "reimbursement_approval_create" | "reimbursement_duplicate_approval_create" | "reimbursement_approval_update" | "reimbursement_duplicate_approval_update" | "reimbursement_approval_delete" | "reimbursement_create_mileage" | "reimbursement_update_mileage" | "reimbursement_accept_term" | "reimbursement_accept_employee_term" | "reimbursement_bulk_submit" | "reimbursement_bulk_processed" | "bill_pay_setup" | "zeni_accounts_setup" | "bill_pay_approval_create" | "bill_pay_duplicate_approval_create" | "bill_pay_approval_update" | "bill_pay_duplicate_approval_update" | "bill_pay_approval_delete" | "bill_pay_updated" | "bill_pay_deleted" | "bill_pay_cancelled_deleted" | "bill_pay_cancelled" | "bill_pay_approved" | "real_time_approver_added" | "bill_pay_rejected" | "bill_pay_sent_for_approval" | "bill_pay_accept_term" | "bill_pay_bulk_submit" | "bill_pay_bulk_processed" | "bill_pay_refund" | "bill_pay_retry" | "bill_pay_marked_as_paid" | "zeni_account_accept_term" | "update_vendor" | "data_refresh_update" | "delete_bank_account" | "create_bank_account" | "create_bank_account_ach" | "create_bank_account_wire" | "create_bank_account_international" | "transfer_money" | "update_zeni_account_nickname" | "create_checking_account" | "deposit_check" | "create_vendor" | "onboarding_customer_view" | "onboarding_customer_view_complete" | "onboarding_customer_identity_verification_save" | "onboarding_customer_identity_verification_submit" | "onboarding_customer_business_verification_save" | "onboarding_customer_business_verification_submit" | "retry_bank_account_connection" | "dashboard_invite_sent" | "onboarding_info_saved" | "approve_original_merchant" | "approve_global_merchant" | "reject_global_merchant" | "create_global_merchant" | "fetch_global_merchant_no_recommendation" | "save_vendor_renamed" | "save_vendor_sent_for_review" | "save_vendor_marked_as_employee" | "save_vendor_marked_as_local_contractor" | "charge_card_setup" | "charge_card_accept_term" | "charge_card_receipt_upload" | "charge_card_resend_invite" | "charge_card_revoke_invite" | "charge_card_update_limit" | "charge_cards_update_limit" | "close_charge_card" | "lock_charge_card" | "lock_charge_card_card_user" | "lock_charge_cards" | "unlock_charge_card" | "unlock_charge_card_card_user" | "unlock_charge_cards" | "close_charge_cards" | "revoke_invite_charge_cards" | "charge_card_express_interest" | "create_schedule" | "save_schedule" | "delete_schedule" | "ignore_schedule" | "save_task_detail" | "fetch_task_detail" | "delete_task" | "archive_task" | "snooze_task" | "unsnooze_task" | "create_tag" | "delete_tag" | "update_charge_card" | "update_charge_card_name" | "update_charge_card_name_card_user" | "issue_charge_card" | "issue_charge_cards" | "notification_settings_saved" | "referral_invite_sent" | "notification_mark_as_read" | "mark_as_complete_schedule" | "cancel_journal_entry" | "settings_accounting_accounts_updated" | "create_card_setup" | "confirm_card_setup" | "add_card_payment_source" | "fetch_payment_sources" | "task_assigned_toast_notification" | "task_due_tomorrow_toast_notification" | "task_deleted_toast_notification" | "task_archived_toast_notification" | "task_overdue_toast_notification" | "task_overdue_toast_notification_creator" | "task_notification_count" | "task_activities_toast_notification" | "task_created_toast_notification" | "task_group_creation_success" | "task_group_deletion_success" | "task_group_update_success" | "primary_funding_account_updated" | "task_time_spent_validation" | "missing_receipts_attachment" | "flux_analysis_unreviewed" | "flux_analysis_reviewed" | "receipt_match" | "receipts_upload" | "receipts_bulk_match" | "billing_address_view" | "express_pay_submit" | "exclude_transaction" | "reconcile" | "save_reconcile_for_later" | "recon_transaction_categorize" | "recon_transaction_match" | "update_debit_card_pin_attempt" | "set_debit_card_pin" | "ai_cfo_create_session_and_submit" | "ai_cfo_chat_session_deleted" | "charge_card_auto_pay_enable" | "charge_card_auto_pay_disable" | "treasury_setup" | "treasury_accept_term" | "treasury_transfer_money" | "treasury_transfer_money_failed" | "auto_transfer_rule_create" | "auto_transfer_rule_update" | "auto_transfer_rule_delete" | "auto_transfer_rule_pause" | "auto_transfer_rule_resume" | "treasury_update_portfolio_allocation" | "send_email_magic_link_to_user" | "complete_profile_done" | "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" | "account_excluded_from_reconciliation" | "account_included_in_reconciliation" | "ai_accountant_trigger_job" | "oauth_consent_approve" | "oauth_consent_invalid_request" | "credit_agent_update_profile" | "credit_agent_save_macro" | "credit_agent_schedule_cron";
42
+ messageSection: "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_month_end_email_sent" | "cockpit_month_end_email_save" | "cockpit_month_end_email_attachment_upload" | "je_bill_link" | "je_posted" | "audit_score_updated" | "people_invite_people" | "people_invite_multiple_people" | "people_delete_person" | "people_update_person" | "reimbursement_updated" | "reimbursement_deleted" | "reimbursement_cancelled_deleted" | "reimbursement_cancelled" | "reimbursement_approved" | "reimbursement_rejected" | "reimbursement_sent_for_approval" | "account_added" | "business_verification_save" | "business_verification_submit" | "business_verification_from_bills_submit" | "plaid_connection" | "unlink_deposit_account" | "reimbursement_setup" | "reimbursement_approval_create" | "reimbursement_duplicate_approval_create" | "reimbursement_approval_update" | "reimbursement_duplicate_approval_update" | "reimbursement_approval_delete" | "reimbursement_create_mileage" | "reimbursement_update_mileage" | "reimbursement_accept_term" | "reimbursement_accept_employee_term" | "reimbursement_bulk_submit" | "reimbursement_bulk_processed" | "bill_pay_setup" | "zeni_accounts_setup" | "bill_pay_approval_create" | "bill_pay_duplicate_approval_create" | "bill_pay_approval_update" | "bill_pay_duplicate_approval_update" | "bill_pay_approval_delete" | "bill_pay_updated" | "bill_pay_deleted" | "bill_pay_cancelled_deleted" | "bill_pay_cancelled" | "bill_pay_approved" | "real_time_approver_added" | "bill_pay_rejected" | "bill_pay_sent_for_approval" | "bill_pay_accept_term" | "bill_pay_bulk_submit" | "bill_pay_bulk_processed" | "bill_pay_refund" | "bill_pay_retry" | "bill_pay_marked_as_paid" | "zeni_account_accept_term" | "update_vendor" | "data_refresh_update" | "delete_bank_account" | "create_bank_account" | "create_bank_account_ach" | "create_bank_account_wire" | "create_bank_account_international" | "transfer_money" | "update_zeni_account_nickname" | "create_checking_account" | "deposit_check" | "create_vendor" | "onboarding_customer_view" | "onboarding_customer_view_complete" | "onboarding_customer_identity_verification_save" | "onboarding_customer_identity_verification_submit" | "onboarding_customer_business_verification_save" | "onboarding_customer_business_verification_submit" | "retry_bank_account_connection" | "dashboard_invite_sent" | "onboarding_info_saved" | "approve_original_merchant" | "approve_global_merchant" | "reject_global_merchant" | "create_global_merchant" | "fetch_global_merchant_no_recommendation" | "save_vendor_renamed" | "save_vendor_sent_for_review" | "save_vendor_marked_as_employee" | "save_vendor_marked_as_local_contractor" | "charge_card_setup" | "charge_card_accept_term" | "charge_card_receipt_upload" | "charge_card_resend_invite" | "charge_card_revoke_invite" | "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" | "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" | "account_excluded_from_reconciliation" | "account_included_in_reconciliation" | "ai_accountant_trigger_job" | "oauth_consent_approve" | "oauth_consent_invalid_request" | "credit_agent_update_profile" | "credit_agent_save_macro" | "credit_agent_schedule_cron";
43
43
  messageText: "notification" | "failed" | "success";
44
44
  type: "error" | "success" | "info";
45
45
  variables: {
@@ -20,7 +20,7 @@ export interface SaveReconciliationDetailFailurePayload {
20
20
  error: ZeniAPIStatus;
21
21
  fetchStateByAction: SaveReconcileDetailActionPayload;
22
22
  }
23
- export declare const toReconciliationTabsType: (v: string) => "reconcile" | "review";
23
+ export declare const toReconciliationTabsType: (v: string) => "review" | "reconcile";
24
24
  export declare type ReconciliationViewTabType = ReturnType<typeof toReconciliationTabsType>;
25
25
  declare const toReconReconcileSortKeysType: (v: string) => "date" | "amount" | "type" | "account" | "memo" | "clearedDate" | "payee" | "transactionDirection" | "recommended";
26
26
  export declare type ReconReconcileSortKey = ReturnType<typeof toReconReconcileSortKeysType>;
@@ -1,3 +1,3 @@
1
- declare const toPeopleSortKeyType: (v: string) => "role" | "manager" | "name" | "department" | "lastSeen";
1
+ declare const toPeopleSortKeyType: (v: string) => "department" | "name" | "role" | "manager" | "lastSeen";
2
2
  export type PeopleViewSortKey = ReturnType<typeof toPeopleSortKeyType>;
3
3
  export {};
@@ -7,7 +7,7 @@ export declare const getScheduleListKey: (selectedCategory: ID, selectedTimefram
7
7
  export type ScheduleListKey = ReturnType<typeof getScheduleListKey>;
8
8
  export declare const toScheduleSubTabType: (v: string) => "completed" | "new" | "ongoing" | "all";
9
9
  export type ScheduleSubTabType = ReturnType<typeof toScheduleSubTabType>;
10
- declare const toScheduleSortKeyType: (v: string) => "months" | "amount" | "vendor" | "status" | "user" | "createTime" | "class" | "memo" | "balanceAsOfToday" | "transactionDate" | "transactionType" | "assetId" | "scheduleCategory" | "startMonth" | "accruedExpenseCategory" | "expenseCategory" | "accumulatedDepreciationCategory" | "endMonth";
10
+ declare const toScheduleSortKeyType: (v: string) => "months" | "amount" | "vendor" | "status" | "class" | "user" | "createTime" | "memo" | "balanceAsOfToday" | "transactionDate" | "transactionType" | "assetId" | "scheduleCategory" | "startMonth" | "accruedExpenseCategory" | "expenseCategory" | "accumulatedDepreciationCategory" | "endMonth";
11
11
  export declare type ScheduleListSortKey = ReturnType<typeof toScheduleSortKeyType>;
12
12
  export interface DownloadJEScheduleTabOptions {
13
13
  categoryId: ID;
@@ -0,0 +1,14 @@
1
+ import { FetchState } from '../../../../../commonStateTypes/common';
2
+ import { CreateCardPolicyTemplateRequest } from '../../../../../entity/cardPolicy/cardPolicyPayload';
3
+ import { ZeniAPIStatus } from '../../../../../responsePayload';
4
+ import { CardPolicyDetailState } from './cardPolicyDetailState';
5
+ export declare const initialState: CardPolicyDetailState;
6
+ export declare const fetchCardPolicyDetail: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[templateId: string], string, "cardPolicyDetail/fetchCardPolicyDetail", never, never>, updateCardPolicyDetailFetchStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
7
+ fetchState: FetchState;
8
+ error?: ZeniAPIStatus;
9
+ }, "cardPolicyDetail/updateCardPolicyDetailFetchStatus">, updateCardPolicyFormDraft: import("@reduxjs/toolkit").ActionCreatorWithPayload<CreateCardPolicyTemplateRequest, "cardPolicyDetail/updateCardPolicyFormDraft">, updateCardPolicy: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[templateId: string], string, "cardPolicyDetail/updateCardPolicy", never, never>, updateCardPolicyFetchStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
10
+ fetchState: FetchState;
11
+ error?: ZeniAPIStatus;
12
+ }, "cardPolicyDetail/updateCardPolicyFetchStatus">, clearCardPolicyDetail: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"cardPolicyDetail/clearCardPolicyDetail">;
13
+ declare const _default: import("redux").Reducer<CardPolicyDetailState>;
14
+ export default _default;
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.clearCardPolicyDetail = exports.updateCardPolicyFetchStatus = exports.updateCardPolicy = exports.updateCardPolicyFormDraft = exports.updateCardPolicyDetailFetchStatus = exports.fetchCardPolicyDetail = exports.initialState = void 0;
5
+ const toolkit_1 = require("@reduxjs/toolkit");
6
+ exports.initialState = {
7
+ detailTemplateId: undefined,
8
+ detailFetchState: { fetchState: 'Not-Started', error: undefined },
9
+ updateFetchState: { fetchState: 'Not-Started', error: undefined },
10
+ formDraft: undefined,
11
+ };
12
+ const cardPolicyDetail = (0, toolkit_1.createSlice)({
13
+ name: 'cardPolicyDetail',
14
+ initialState: exports.initialState,
15
+ reducers: {
16
+ /**
17
+ * Kick off the `GET /cards/1.0/policy-templates/{id}` request. The
18
+ * accompanying epic dispatches `updateCreatedCardPolicyTemplate` on
19
+ * the entity slice + `updateCardPolicyFormDraft` (seeded from the
20
+ * template) + `updateCardPolicyDetailFetchStatus` here.
21
+ */
22
+ fetchCardPolicyDetail: {
23
+ reducer(draft, action) {
24
+ draft.detailTemplateId = action.payload;
25
+ draft.detailFetchState.fetchState = 'In-Progress';
26
+ draft.detailFetchState.error = undefined;
27
+ // Reset the draft so a stale form from a previous template
28
+ // doesn't leak into the new edit session.
29
+ draft.formDraft = undefined;
30
+ },
31
+ prepare(templateId) {
32
+ return { payload: templateId };
33
+ },
34
+ },
35
+ updateCardPolicyDetailFetchStatus(draft, action) {
36
+ draft.detailFetchState.fetchState = action.payload.fetchState;
37
+ draft.detailFetchState.error = action.payload.error;
38
+ },
39
+ /**
40
+ * Replace (or seed) the local edit-form draft. Dispatched by the
41
+ * detail-fetch epic with the camelCased values pulled from the
42
+ * fetched template, and by the edit page itself as the user types.
43
+ */
44
+ updateCardPolicyFormDraft(draft, action) {
45
+ draft.formDraft = action.payload;
46
+ },
47
+ /**
48
+ * Kick off the `PUT /cards/1.0/policy-templates/{id}` save. The
49
+ * epic reads the current `formDraft` from state, posts the wire
50
+ * body, then dispatches `updateCreatedCardPolicyTemplate` (entity)
51
+ * + `updateCardPolicyFetchStatus({fetchState: 'Completed'})` here.
52
+ */
53
+ updateCardPolicy: {
54
+ reducer(draft,
55
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
56
+ _action) {
57
+ draft.updateFetchState.fetchState = 'In-Progress';
58
+ draft.updateFetchState.error = undefined;
59
+ },
60
+ prepare(templateId) {
61
+ return { payload: templateId };
62
+ },
63
+ },
64
+ updateCardPolicyFetchStatus(draft, action) {
65
+ draft.updateFetchState.fetchState = action.payload.fetchState;
66
+ draft.updateFetchState.error = action.payload.error;
67
+ },
68
+ clearCardPolicyDetail(draft) {
69
+ Object.assign(draft, exports.initialState);
70
+ },
71
+ },
72
+ });
73
+ _a = cardPolicyDetail.actions, exports.fetchCardPolicyDetail = _a.fetchCardPolicyDetail, exports.updateCardPolicyDetailFetchStatus = _a.updateCardPolicyDetailFetchStatus, exports.updateCardPolicyFormDraft = _a.updateCardPolicyFormDraft, exports.updateCardPolicy = _a.updateCardPolicy, exports.updateCardPolicyFetchStatus = _a.updateCardPolicyFetchStatus, exports.clearCardPolicyDetail = _a.clearCardPolicyDetail;
74
+ exports.default = cardPolicyDetail.reducer;
@@ -0,0 +1,21 @@
1
+ import { FetchStateAndError, ID } from '../../../../../commonStateTypes/common';
2
+ import { CreateCardPolicyTemplateRequest } from '../../../../../entity/cardPolicy/cardPolicyPayload';
3
+ import { CardPolicyTemplate } from '../../../../../entity/cardPolicy/cardPolicyState';
4
+ import { RootState } from '../../../../../reducer';
5
+ /**
6
+ * Composite view returned by `getCardPolicyDetailView` — the only
7
+ * public shape the Card Policy edit page should consume. Mirrors how
8
+ * `chargeCardDetailSelector` joins the view-side lifecycle slots with
9
+ * the entity-store template.
10
+ */
11
+ export interface CardPolicyDetailSelectorView {
12
+ detailFetchState: FetchStateAndError;
13
+ updateFetchState: FetchStateAndError;
14
+ formDraft?: CreateCardPolicyTemplateRequest;
15
+ template?: CardPolicyTemplate;
16
+ templateId?: ID;
17
+ }
18
+ export declare function getCardPolicyDetailView(state: RootState): CardPolicyDetailSelectorView;
19
+ export declare function getCardPolicyFormDraft(state: RootState): CreateCardPolicyTemplateRequest | undefined;
20
+ export declare function getCardPolicyDetailFetchState(state: RootState): FetchStateAndError;
21
+ export declare function getUpdateCardPolicyFetchState(state: RootState): FetchStateAndError;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCardPolicyDetailView = getCardPolicyDetailView;
4
+ exports.getCardPolicyFormDraft = getCardPolicyFormDraft;
5
+ exports.getCardPolicyDetailFetchState = getCardPolicyDetailFetchState;
6
+ exports.getUpdateCardPolicyFetchState = getUpdateCardPolicyFetchState;
7
+ const cardPolicySelector_1 = require("../../../../../entity/cardPolicy/cardPolicySelector");
8
+ function getCardPolicyDetailView(state) {
9
+ const { cardPolicyDetailState, cardPolicyState } = state;
10
+ return {
11
+ templateId: cardPolicyDetailState.detailTemplateId,
12
+ template: cardPolicyDetailState.detailTemplateId != null
13
+ ? (0, cardPolicySelector_1.getCardPolicyTemplateById)(cardPolicyState, cardPolicyDetailState.detailTemplateId)
14
+ : undefined,
15
+ formDraft: cardPolicyDetailState.formDraft,
16
+ detailFetchState: cardPolicyDetailState.detailFetchState,
17
+ updateFetchState: cardPolicyDetailState.updateFetchState,
18
+ };
19
+ }
20
+ function getCardPolicyFormDraft(state) {
21
+ return state.cardPolicyDetailState.formDraft;
22
+ }
23
+ function getCardPolicyDetailFetchState(state) {
24
+ return state.cardPolicyDetailState.detailFetchState;
25
+ }
26
+ function getUpdateCardPolicyFetchState(state) {
27
+ return state.cardPolicyDetailState.updateFetchState;
28
+ }
@@ -0,0 +1,25 @@
1
+ import { FetchStateAndError, ID } from '../../../../../commonStateTypes/common';
2
+ import { CreateCardPolicyTemplateRequest } from '../../../../../entity/cardPolicy/cardPolicyPayload';
3
+ /**
4
+ * View-side state for the Card Policy edit page.
5
+ *
6
+ * Mirrors `issueChargeCard` (a single page that owns a local form
7
+ * draft + commits on save). There is no separate read-only "detail"
8
+ * surface today — the same page loads the existing template and offers
9
+ * inline edits. The saved template itself lives on the entity slice;
10
+ * the page joins via `getCardPolicyDetailView`.
11
+ */
12
+ export interface CardPolicyDetailState {
13
+ /** Lifecycle for the initial `GET /policy-templates/{id}` request. */
14
+ detailFetchState: FetchStateAndError;
15
+ /** Lifecycle for the `PUT /policy-templates/{id}` save. */
16
+ updateFetchState: FetchStateAndError;
17
+ /** Template currently being edited; cleared when the page unmounts. */
18
+ detailTemplateId?: ID;
19
+ /**
20
+ * Local form draft seeded from the entity template on fetch success
21
+ * and mutated as the user edits. `undefined` until the detail fetch
22
+ * lands so the page can render a skeleton until then.
23
+ */
24
+ formDraft?: CreateCardPolicyTemplateRequest;
25
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,19 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { updateCreatedCardPolicyTemplate } from '../../../../../entity/cardPolicy/cardPolicyReducer';
4
+ import { RootState } from '../../../../../reducer';
5
+ import { ZeniAPI } from '../../../../../zeniAPI';
6
+ import { fetchCardPolicyDetail, updateCardPolicyDetailFetchStatus, updateCardPolicyFormDraft } from './cardPolicyDetailReducer';
7
+ export type ActionType = ReturnType<typeof fetchCardPolicyDetail> | ReturnType<typeof updateCreatedCardPolicyTemplate> | ReturnType<typeof updateCardPolicyFormDraft> | ReturnType<typeof updateCardPolicyDetailFetchStatus>;
8
+ /**
9
+ * `GET /cards/1.0/policy-templates/{id}`. Response is the same
10
+ * `{cards_applied, template}` envelope the create endpoint returns.
11
+ * We:
12
+ *
13
+ * 1. Cache the template on the entity slice (so the list page picks
14
+ * up any drift from the server).
15
+ * 2. Seed the local edit-form draft from the camelCased template so
16
+ * the page can render with the existing values pre-populated.
17
+ * 3. Flip the view lifecycle to `Completed` / `Error`.
18
+ */
19
+ export declare const fetchCardPolicyDetailEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchCardPolicyDetailEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const cardPolicyPayload_1 = require("../../../../../entity/cardPolicy/cardPolicyPayload");
7
+ const cardPolicyReducer_1 = require("../../../../../entity/cardPolicy/cardPolicyReducer");
8
+ const responsePayload_1 = require("../../../../../responsePayload");
9
+ const cardPolicyDetailReducer_1 = require("./cardPolicyDetailReducer");
10
+ /**
11
+ * `GET /cards/1.0/policy-templates/{id}`. Response is the same
12
+ * `{cards_applied, template}` envelope the create endpoint returns.
13
+ * We:
14
+ *
15
+ * 1. Cache the template on the entity slice (so the list page picks
16
+ * up any drift from the server).
17
+ * 2. Seed the local edit-form draft from the camelCased template so
18
+ * the page can render with the existing values pre-populated.
19
+ * 3. Flip the view lifecycle to `Completed` / `Error`.
20
+ */
21
+ const fetchCardPolicyDetailEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(cardPolicyDetailReducer_1.fetchCardPolicyDetail.match),
22
+ // `exhaustMap` (rather than `mergeMap`) so a duplicate
23
+ // `fetchCardPolicyDetail` dispatched while the previous one is
24
+ // still in flight is dropped instead of producing a second HTTP
25
+ // request. The edit screen dispatches this on mount, and React 18
26
+ // StrictMode invokes its mount effect twice with a stale
27
+ // `detailFetchState` closure — without `exhaustMap` that yields
28
+ // two `/policy-templates/{id}` calls. (The screen also dedupes
29
+ // list→edit navigations via the entity-cached template, so the
30
+ // detail GET is only emitted on direct landings — there's no
31
+ // realistic cross-templateId scenario that needs cancel-and-retry
32
+ // semantics here.)
33
+ (0, operators_1.exhaustMap)((action) => {
34
+ const templateId = action.payload;
35
+ return zeniAPI
36
+ .getJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/policy-templates/${templateId}`)
37
+ .pipe((0, operators_1.mergeMap)((response) => {
38
+ if ((0, responsePayload_1.isSuccessStatus)(response) && response.data != null) {
39
+ const { template } = response.data;
40
+ const formDraft = (0, cardPolicyPayload_1.toCardPolicyEditFormDraft)((0, cardPolicyPayload_1.toCardPolicyTemplate)(template));
41
+ const actions = [
42
+ (0, cardPolicyReducer_1.updateCreatedCardPolicyTemplate)(template),
43
+ (0, cardPolicyDetailReducer_1.updateCardPolicyFormDraft)(formDraft),
44
+ (0, cardPolicyDetailReducer_1.updateCardPolicyDetailFetchStatus)({ fetchState: 'Completed' }),
45
+ ];
46
+ return (0, rxjs_1.from)(actions);
47
+ }
48
+ else {
49
+ return (0, rxjs_1.of)((0, cardPolicyDetailReducer_1.updateCardPolicyDetailFetchStatus)({
50
+ fetchState: 'Error',
51
+ error: response.status,
52
+ }));
53
+ }
54
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, cardPolicyDetailReducer_1.updateCardPolicyDetailFetchStatus)({
55
+ fetchState: 'Error',
56
+ error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch card-policy detail REST API call errored out' +
57
+ JSON.stringify(error)),
58
+ }))));
59
+ }));
60
+ exports.fetchCardPolicyDetailEpic = fetchCardPolicyDetailEpic;
@@ -0,0 +1,18 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { updateCreatedCardPolicyTemplate } from '../../../../../entity/cardPolicy/cardPolicyReducer';
4
+ import { RootState } from '../../../../../reducer';
5
+ import { ZeniAPI } from '../../../../../zeniAPI';
6
+ import { updateCardPolicy, updateCardPolicyFetchStatus } from './cardPolicyDetailReducer';
7
+ export type ActionType = ReturnType<typeof updateCardPolicy> | ReturnType<typeof updateCreatedCardPolicyTemplate> | ReturnType<typeof updateCardPolicyFetchStatus>;
8
+ /**
9
+ * `PUT /cards/1.0/policy-templates/{id}`. Reads the current `formDraft`
10
+ * off the `cardPolicyDetail` slice, converts it to the snake_case wire
11
+ * body (same shape as create), and submits. On success the entity
12
+ * slice picks up the refreshed template and the view lifecycle flips
13
+ * to `Completed`.
14
+ *
15
+ * If the action fires before a draft is seeded (e.g. user clicks save
16
+ * before the detail fetch lands), we short-circuit with an Error.
17
+ */
18
+ export declare const updateCardPolicyEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateCardPolicyEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const cardPolicyPayload_1 = require("../../../../../entity/cardPolicy/cardPolicyPayload");
7
+ const cardPolicyReducer_1 = require("../../../../../entity/cardPolicy/cardPolicyReducer");
8
+ const responsePayload_1 = require("../../../../../responsePayload");
9
+ const cardPolicyDetailReducer_1 = require("./cardPolicyDetailReducer");
10
+ /**
11
+ * `PUT /cards/1.0/policy-templates/{id}`. Reads the current `formDraft`
12
+ * off the `cardPolicyDetail` slice, converts it to the snake_case wire
13
+ * body (same shape as create), and submits. On success the entity
14
+ * slice picks up the refreshed template and the view lifecycle flips
15
+ * to `Completed`.
16
+ *
17
+ * If the action fires before a draft is seeded (e.g. user clicks save
18
+ * before the detail fetch lands), we short-circuit with an Error.
19
+ */
20
+ const updateCardPolicyEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(cardPolicyDetailReducer_1.updateCardPolicy.match), (0, operators_1.mergeMap)((action) => {
21
+ const templateId = action.payload;
22
+ const formDraft = state$.value.cardPolicyDetailState.formDraft;
23
+ if (formDraft == null) {
24
+ return (0, rxjs_1.of)((0, cardPolicyDetailReducer_1.updateCardPolicyFetchStatus)({
25
+ fetchState: 'Error',
26
+ error: (0, responsePayload_1.createZeniAPIStatus)('Missing form draft', `Cannot update card-policy ${templateId} — no formDraft is loaded.`),
27
+ }));
28
+ }
29
+ const body = (0, cardPolicyPayload_1.toUpdateCardPolicyTemplateRequestBody)(formDraft);
30
+ return zeniAPI
31
+ .putAndGetJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/policy-templates/${templateId}`, body)
32
+ .pipe((0, operators_1.mergeMap)((response) => {
33
+ if ((0, responsePayload_1.isSuccessStatus)(response) && response.data != null) {
34
+ const { template } = response.data;
35
+ const actions = [
36
+ (0, cardPolicyReducer_1.updateCreatedCardPolicyTemplate)(template),
37
+ (0, cardPolicyDetailReducer_1.updateCardPolicyFetchStatus)({ fetchState: 'Completed' }),
38
+ ];
39
+ return (0, rxjs_1.from)(actions);
40
+ }
41
+ else {
42
+ return (0, rxjs_1.of)((0, cardPolicyDetailReducer_1.updateCardPolicyFetchStatus)({
43
+ fetchState: 'Error',
44
+ error: response.status,
45
+ }));
46
+ }
47
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, cardPolicyDetailReducer_1.updateCardPolicyFetchStatus)({
48
+ fetchState: 'Error',
49
+ error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Update card-policy REST API call errored out' +
50
+ JSON.stringify(error)),
51
+ }))));
52
+ }));
53
+ exports.updateCardPolicyEpic = updateCardPolicyEpic;
@@ -0,0 +1,16 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { removeCardPolicyTemplate } from '../../../../../entity/cardPolicy/cardPolicyReducer';
4
+ import { RootState } from '../../../../../reducer';
5
+ import { ZeniAPI } from '../../../../../zeniAPI';
6
+ import { archiveCardPolicy, updateArchiveCardPolicyFetchStatus } from './cardPolicyListReducer';
7
+ export type ActionType = ReturnType<typeof archiveCardPolicy> | ReturnType<typeof removeCardPolicyTemplate> | ReturnType<typeof updateArchiveCardPolicyFetchStatus>;
8
+ /**
9
+ * `DELETE /cards/1.0/policy-templates/{id}`. Modeled like
10
+ * `deleteBillEpic`: typed as bare `ZeniAPIResponse` (no `data` body
11
+ * expected) with `isSuccessStatus` driving the success branch. On
12
+ * success the entity slice drops the template via
13
+ * `removeCardPolicyTemplate(templateId)` and the view slice records
14
+ * `Completed` (also pruning the ID from `templateIds`).
15
+ */
16
+ export declare const archiveCardPolicyEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.archiveCardPolicyEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const cardPolicyReducer_1 = require("../../../../../entity/cardPolicy/cardPolicyReducer");
7
+ const responsePayload_1 = require("../../../../../responsePayload");
8
+ const cardPolicyListReducer_1 = require("./cardPolicyListReducer");
9
+ /**
10
+ * `DELETE /cards/1.0/policy-templates/{id}`. Modeled like
11
+ * `deleteBillEpic`: typed as bare `ZeniAPIResponse` (no `data` body
12
+ * expected) with `isSuccessStatus` driving the success branch. On
13
+ * success the entity slice drops the template via
14
+ * `removeCardPolicyTemplate(templateId)` and the view slice records
15
+ * `Completed` (also pruning the ID from `templateIds`).
16
+ */
17
+ const archiveCardPolicyEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(cardPolicyListReducer_1.archiveCardPolicy.match), (0, operators_1.mergeMap)((action) => {
18
+ const templateId = action.payload;
19
+ return zeniAPI
20
+ .deleteAndGetJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/policy-templates/${templateId}`)
21
+ .pipe((0, operators_1.mergeMap)((response) => {
22
+ if ((0, responsePayload_1.isSuccessStatus)(response)) {
23
+ const actions = [
24
+ (0, cardPolicyReducer_1.removeCardPolicyTemplate)(templateId),
25
+ (0, cardPolicyListReducer_1.updateArchiveCardPolicyFetchStatus)({
26
+ fetchState: 'Completed',
27
+ templateId,
28
+ }),
29
+ ];
30
+ return (0, rxjs_1.from)(actions);
31
+ }
32
+ else {
33
+ return (0, rxjs_1.of)((0, cardPolicyListReducer_1.updateArchiveCardPolicyFetchStatus)({
34
+ fetchState: 'Error',
35
+ error: response.status,
36
+ templateId,
37
+ }));
38
+ }
39
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, cardPolicyListReducer_1.updateArchiveCardPolicyFetchStatus)({
40
+ fetchState: 'Error',
41
+ error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Archive card-policy REST API call errored out' +
42
+ JSON.stringify(error)),
43
+ templateId,
44
+ }))));
45
+ }));
46
+ exports.archiveCardPolicyEpic = archiveCardPolicyEpic;
@@ -0,0 +1,15 @@
1
+ import { FetchState, ID } from '../../../../../commonStateTypes/common';
2
+ import { ZeniAPIStatus } from '../../../../../responsePayload';
3
+ import { CardPolicyListState } from './cardPolicyListState';
4
+ export declare const initialState: CardPolicyListState;
5
+ export declare const fetchCardPolicyList: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"cardPolicyList/fetchCardPolicyList">, updateCardPolicyListFetchStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
6
+ fetchState: FetchState;
7
+ error?: ZeniAPIStatus;
8
+ templateIds?: ID[];
9
+ }, "cardPolicyList/updateCardPolicyListFetchStatus">, archiveCardPolicy: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[templateId: string], string, "cardPolicyList/archiveCardPolicy", never, never>, updateArchiveCardPolicyFetchStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
10
+ fetchState: FetchState;
11
+ error?: ZeniAPIStatus;
12
+ templateId?: ID;
13
+ }, "cardPolicyList/updateArchiveCardPolicyFetchStatus">, clearCardPolicyList: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"cardPolicyList/clearCardPolicyList">;
14
+ declare const _default: import("redux").Reducer<CardPolicyListState>;
15
+ export default _default;
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.clearCardPolicyList = exports.updateArchiveCardPolicyFetchStatus = exports.archiveCardPolicy = exports.updateCardPolicyListFetchStatus = exports.fetchCardPolicyList = exports.initialState = void 0;
5
+ const toolkit_1 = require("@reduxjs/toolkit");
6
+ exports.initialState = {
7
+ templateIds: [],
8
+ fetchState: {
9
+ fetchState: 'Not-Started',
10
+ error: undefined,
11
+ },
12
+ archiveFetchState: {
13
+ fetchState: 'Not-Started',
14
+ error: undefined,
15
+ },
16
+ archiveTargetTemplateId: undefined,
17
+ };
18
+ const cardPolicyList = (0, toolkit_1.createSlice)({
19
+ name: 'cardPolicyList',
20
+ initialState: exports.initialState,
21
+ reducers: {
22
+ /**
23
+ * Kick off the `GET /cards/1.0/policy-templates` request. The
24
+ * accompanying epic dispatches `updateCardPolicyTemplates(templates)`
25
+ * + `updateCardPolicyStats(stats)` on the entity slice and
26
+ * `updateCardPolicyListFetchStatus` here (also supplying the ordered
27
+ * `templateIds` on success).
28
+ */
29
+ fetchCardPolicyList(draft) {
30
+ draft.fetchState.fetchState = 'In-Progress';
31
+ draft.fetchState.error = undefined;
32
+ },
33
+ updateCardPolicyListFetchStatus(draft, action) {
34
+ draft.fetchState.fetchState = action.payload.fetchState;
35
+ draft.fetchState.error = action.payload.error;
36
+ if (action.payload.templateIds != null) {
37
+ draft.templateIds = action.payload.templateIds;
38
+ }
39
+ },
40
+ /**
41
+ * Kick off the `DELETE /cards/1.0/policy-templates/{id}` request.
42
+ * The accompanying epic dispatches `removeCardPolicyTemplate(id)` on
43
+ * the entity slice on success + `updateArchiveCardPolicyFetchStatus`
44
+ * here. The view layer also drops the ID from `templateIds` so the
45
+ * list stays in sync without re-fetching.
46
+ */
47
+ archiveCardPolicy: {
48
+ reducer(draft, action) {
49
+ draft.archiveFetchState.fetchState = 'In-Progress';
50
+ draft.archiveFetchState.error = undefined;
51
+ draft.archiveTargetTemplateId = action.payload;
52
+ },
53
+ prepare(templateId) {
54
+ return { payload: templateId };
55
+ },
56
+ },
57
+ updateArchiveCardPolicyFetchStatus(draft, action) {
58
+ draft.archiveFetchState.fetchState = action.payload.fetchState;
59
+ draft.archiveFetchState.error = action.payload.error;
60
+ if (action.payload.fetchState === 'Completed') {
61
+ if (action.payload.templateId != null) {
62
+ draft.templateIds = draft.templateIds.filter((id) => id !== action.payload.templateId);
63
+ }
64
+ draft.archiveTargetTemplateId = undefined;
65
+ }
66
+ else if (action.payload.fetchState === 'Error') {
67
+ draft.archiveTargetTemplateId = undefined;
68
+ }
69
+ },
70
+ clearCardPolicyList(draft) {
71
+ Object.assign(draft, exports.initialState);
72
+ },
73
+ },
74
+ });
75
+ _a = cardPolicyList.actions, exports.fetchCardPolicyList = _a.fetchCardPolicyList, exports.updateCardPolicyListFetchStatus = _a.updateCardPolicyListFetchStatus, exports.archiveCardPolicy = _a.archiveCardPolicy, exports.updateArchiveCardPolicyFetchStatus = _a.updateArchiveCardPolicyFetchStatus, exports.clearCardPolicyList = _a.clearCardPolicyList;
76
+ exports.default = cardPolicyList.reducer;