@zeniai/client-epic-state 5.0.81-betaAD6 → 5.0.81-betaAD8

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.
@@ -1,4 +1,4 @@
1
- export declare const toSnackbarMessageSection: (v: string) => "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" | "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";
1
+ export declare const toSnackbarMessageSection: (v: string) => "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" | "ai_cfo_update_chat_session_pin" | "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" | "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";
2
2
  export type SnackbarMessageSections = ReturnType<typeof toSnackbarMessageSection>;
3
3
  export declare const toSnackbarMessageSectionTexts: (v: string) => "notification" | "failed" | "success";
4
4
  export type SnackbarMessageSectionTexts = ReturnType<typeof toSnackbarMessageSectionTexts>;
@@ -168,6 +168,7 @@ const ALL_SNACKBAR_MESSAGE_SECTIONS = [
168
168
  'set_debit_card_pin',
169
169
  'ai_cfo_create_session_and_submit',
170
170
  'ai_cfo_chat_session_deleted',
171
+ 'ai_cfo_update_chat_session_pin',
171
172
  'charge_card_auto_pay_enable',
172
173
  'charge_card_auto_pay_disable',
173
174
  'treasury_setup',
@@ -165,6 +165,7 @@ const ALL_SNACKBAR_MESSAGE_SECTIONS = [
165
165
  'set_debit_card_pin',
166
166
  'ai_cfo_create_session_and_submit',
167
167
  'ai_cfo_chat_session_deleted',
168
+ 'ai_cfo_update_chat_session_pin',
168
169
  'charge_card_auto_pay_enable',
169
170
  'charge_card_auto_pay_disable',
170
171
  'treasury_setup',
@@ -43,6 +43,7 @@ export const initialAiCfoViewState = {
43
43
  error: undefined,
44
44
  },
45
45
  deleteChatSessionStateByChatSessionId: {},
46
+ updateChatSessionPinStateByChatSessionId: {},
46
47
  fetchChatSessionHistoryByChatSessionId: {},
47
48
  responseStateByChatSessionId: {},
48
49
  stopSubmitStateByChatSessionId: {},
@@ -377,16 +378,36 @@ const aiCfoView = createSlice({
377
378
  const { chatSessionId } = action.payload;
378
379
  delete draft.deleteChatSessionStateByChatSessionId[chatSessionId];
379
380
  },
380
- /** Dispatched to trigger {@link updateChatSessionPinEpic}; no view state mutation. */
381
381
  updateChatSessionPin: {
382
- reducer(draft, _action) {
383
- void draft;
384
- void _action;
382
+ reducer(draft, action) {
383
+ const { chatSessionId } = action.payload;
384
+ draft.updateChatSessionPinStateByChatSessionId[chatSessionId] = {
385
+ fetchState: 'In-Progress',
386
+ error: undefined,
387
+ };
385
388
  },
386
389
  prepare(chatSessionId, isPinned) {
387
390
  return { payload: { chatSessionId, isPinned } };
388
391
  },
389
392
  },
393
+ updateChatSessionPinSuccess(draft, action) {
394
+ const { chatSessionId } = action.payload;
395
+ draft.updateChatSessionPinStateByChatSessionId[chatSessionId] = {
396
+ fetchState: 'Completed',
397
+ error: undefined,
398
+ };
399
+ },
400
+ updateChatSessionPinFailure(draft, action) {
401
+ const { chatSessionId, error } = action.payload;
402
+ draft.updateChatSessionPinStateByChatSessionId[chatSessionId] = {
403
+ fetchState: 'Error',
404
+ error,
405
+ };
406
+ },
407
+ clearUpdateChatSessionPinStatus(draft, action) {
408
+ const { chatSessionId } = action.payload;
409
+ delete draft.updateChatSessionPinStateByChatSessionId[chatSessionId];
410
+ },
390
411
  clearInput(draft) {
391
412
  draft.uiState.currentInput = '';
392
413
  },
@@ -462,5 +483,5 @@ const aiCfoView = createSlice({
462
483
  },
463
484
  },
464
485
  });
465
- export const { submitQuestion, submitQuestionSuccess, submitQuestionFailure, updateResponseState, updateAiCfoViewScrollPosition, updateCurrentInput, clearInput, setSession, createSession, createSessionSuccess, createSessionFailure, createSessionAndSubmit, initializeNewSessionState, createSessionAndSubmitSuccess, createSessionAndSubmitFailure, fetchChatSessionsForUser, fetchChatSessionsForUserSuccess, fetchChatSessionsForUserFailure, fetchChatHistory, fetchChatHistorySuccess, fetchChatHistoryFailure, clearCurrentSessionId, clearLastContextMessage, stopSubmit, stopSubmitSuccess, stopSubmitFailure, stopSubmitQuestion, stopSubmitQuestionSuccess, stopSubmitQuestionFailure, acceptMasterTOS, acceptMasterTOSSuccess, acceptMasterTOSFailure, deleteChatSession, deleteChatSessionSuccess, deleteChatSessionFailure, clearDeleteChatSessionStatus, updateChatSessionPin, clearAiCfoView, updateCotCollapsedState, fetchSuggestedQuestions, fetchSuggestedQuestionsSuccess, fetchSuggestedQuestionsFailure, applyAiCfoSidePanelHostPageTransition, clearAiCfoSidePanelHostPageContext, } = aiCfoView.actions;
486
+ export const { submitQuestion, submitQuestionSuccess, submitQuestionFailure, updateResponseState, updateAiCfoViewScrollPosition, updateCurrentInput, clearInput, setSession, createSession, createSessionSuccess, createSessionFailure, createSessionAndSubmit, initializeNewSessionState, createSessionAndSubmitSuccess, createSessionAndSubmitFailure, fetchChatSessionsForUser, fetchChatSessionsForUserSuccess, fetchChatSessionsForUserFailure, fetchChatHistory, fetchChatHistorySuccess, fetchChatHistoryFailure, clearCurrentSessionId, clearLastContextMessage, stopSubmit, stopSubmitSuccess, stopSubmitFailure, stopSubmitQuestion, stopSubmitQuestionSuccess, stopSubmitQuestionFailure, acceptMasterTOS, acceptMasterTOSSuccess, acceptMasterTOSFailure, deleteChatSession, deleteChatSessionSuccess, deleteChatSessionFailure, clearDeleteChatSessionStatus, updateChatSessionPin, updateChatSessionPinSuccess, updateChatSessionPinFailure, clearUpdateChatSessionPinStatus, clearAiCfoView, updateCotCollapsedState, fetchSuggestedQuestions, fetchSuggestedQuestionsSuccess, fetchSuggestedQuestionsFailure, applyAiCfoSidePanelHostPageTransition, clearAiCfoSidePanelHostPageContext, } = aiCfoView.actions;
466
487
  export default aiCfoView.reducer;
@@ -2,13 +2,14 @@ import { initialAiCfoState } from '../../entity/aiCfo/aiCfoReducer';
2
2
  import { getAiCfoSelectorView, } from '../../entity/aiCfo/aiCfoSelector';
3
3
  import { initialAiCfoViewState } from './aiCfoViewReducer';
4
4
  export const getAiCfoView = (state) => {
5
- const { fetchState, error, uiState, createSessionState, createSessionAndSubmitState, deleteChatSessionStateByChatSessionId, stopSubmitStateByChatSessionId, responseStateByChatSessionId, fetchChatSessionHistoryByChatSessionId, masterTOSAcceptanceState, suggestedQuestionsByPageContext, } = state.aiCfoViewState ?? initialAiCfoViewState;
5
+ const { fetchState, error, uiState, createSessionState, createSessionAndSubmitState, deleteChatSessionStateByChatSessionId, updateChatSessionPinStateByChatSessionId, stopSubmitStateByChatSessionId, responseStateByChatSessionId, fetchChatSessionHistoryByChatSessionId, masterTOSAcceptanceState, suggestedQuestionsByPageContext, } = state.aiCfoViewState ?? initialAiCfoViewState;
6
6
  return {
7
7
  fetchState,
8
8
  error,
9
9
  createSessionState,
10
10
  createSessionAndSubmitState,
11
11
  deleteChatSessionStateByChatSessionId,
12
+ updateChatSessionPinStateByChatSessionId,
12
13
  stopSubmitStateByChatSessionId,
13
14
  responseStateByChatSessionId,
14
15
  uiState,
@@ -1,46 +1,47 @@
1
- import { EMPTY, of } from 'rxjs';
2
- import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
1
+ import { from, of } from 'rxjs';
2
+ import { catchError, filter, mergeMap } from 'rxjs/operators';
3
3
  import { mergeChatSessionFromPutResponse } from '../../../entity/aiCfo/aiCfoReducer';
4
- import { isSuccessResponse } from '../../../responsePayload';
5
- import { updateChatSessionPin } from '../aiCfoViewReducer';
6
- /**
7
- * TEMP (remove after chat platform pin API is deployed everywhere):
8
- * When PUT pin/unpin fails, still merge requested pin state so the drawer/navbar UX works
9
- * against older backends. Revert this file when the platform supports pin or when dropping
10
- * compatibility — search for `TEMP_PIN_OPTIMISTIC`.
11
- */
12
- function buildOptimisticPinPayload_TEMP_PIN_OPTIMISTIC(state, chatSessionId, isPinned) {
13
- const session = state.aiCfoState.aiCfoByChatSessionId[chatSessionId]?.chatSession;
14
- if (session == null) {
15
- return null;
16
- }
17
- return {
18
- chat_session_id: chatSessionId,
19
- user_id: session.userId,
20
- created_at: session.createdAt.toISOString(),
21
- chat_session_summary: session.chatSessionSummary ?? null,
22
- is_pinned: isPinned,
23
- pinned_at: isPinned ? new Date().toISOString() : null,
24
- };
25
- }
26
- export const updateChatSessionPinEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(updateChatSessionPin.match), switchMap((action) => {
4
+ import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
5
+ import { createZeniAPIStatus, isSuccessResponse, } from '../../../responsePayload';
6
+ import { updateChatSessionPin, updateChatSessionPinFailure, updateChatSessionPinSuccess, } from '../aiCfoViewReducer';
7
+ export const updateChatSessionPinEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(updateChatSessionPin.match), mergeMap((action) => {
27
8
  const { chatSessionId, isPinned } = action.payload;
28
9
  return zeniAPI
29
- .putAndGetJSON(`https://dev.api.zeni.ai/version/chat/05-20-e27f90e/1.0/sessions/${chatSessionId}`, { is_pinned: isPinned })
10
+ .putAndGetJSON(`https://dev.api.zeni.ai/version/chat/05-20-d37fcc2/1.0/sessions/${chatSessionId}`, { is_pinned: isPinned })
30
11
  .pipe(mergeMap((response) => {
31
12
  if (isSuccessResponse(response) && response.data != null) {
32
- return of(mergeChatSessionFromPutResponse(response.data));
13
+ return from([
14
+ mergeChatSessionFromPutResponse(response.data),
15
+ updateChatSessionPinSuccess({ chatSessionId }),
16
+ ]);
33
17
  }
34
- // TEMP_PIN_OPTIMISTIC — see comment above
35
- const synthetic = buildOptimisticPinPayload_TEMP_PIN_OPTIMISTIC(state$.value, chatSessionId, isPinned);
36
- return synthetic != null
37
- ? of(mergeChatSessionFromPutResponse(synthetic))
38
- : EMPTY;
39
- }), catchError(() => {
40
- // TEMP_PIN_OPTIMISTIC — see comment above
41
- const synthetic = buildOptimisticPinPayload_TEMP_PIN_OPTIMISTIC(state$.value, chatSessionId, isPinned);
42
- return synthetic != null
43
- ? of(mergeChatSessionFromPutResponse(synthetic))
44
- : EMPTY;
45
- }));
18
+ return of(updateChatSessionPinFailure({
19
+ chatSessionId,
20
+ error: response.status,
21
+ }), openSnackbar({
22
+ messageSection: 'ai_cfo_update_chat_session_pin',
23
+ messageText: 'failed',
24
+ type: 'error',
25
+ variables: [
26
+ {
27
+ variableName: '_api-error_',
28
+ variableValue: response.status?.message ?? String(response.status),
29
+ },
30
+ ],
31
+ }));
32
+ }), catchError((error) => of(updateChatSessionPinFailure({
33
+ chatSessionId,
34
+ error: createZeniAPIStatus('Unexpected Error', 'Update chat session pin REST API call errored out ' +
35
+ JSON.stringify(error)),
36
+ }), openSnackbar({
37
+ messageSection: 'ai_cfo_update_chat_session_pin',
38
+ messageText: 'failed',
39
+ type: 'error',
40
+ variables: [
41
+ {
42
+ variableName: '_api-error_',
43
+ variableValue: JSON.stringify(error),
44
+ },
45
+ ],
46
+ }))));
46
47
  }));
@@ -90,7 +90,14 @@ export declare const submitQuestion: import("@reduxjs/toolkit").ActionCreatorWit
90
90
  }, "aiCfoView/clearDeleteChatSessionStatus">, updateChatSessionPin: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[chatSessionId: string, isPinned: boolean], {
91
91
  chatSessionId: string;
92
92
  isPinned: boolean;
93
- }, "aiCfoView/updateChatSessionPin", never, never>, clearAiCfoView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"aiCfoView/clearAiCfoView">, updateCotCollapsedState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
93
+ }, "aiCfoView/updateChatSessionPin", never, never>, updateChatSessionPinSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
94
+ chatSessionId: ID;
95
+ }, "aiCfoView/updateChatSessionPinSuccess">, updateChatSessionPinFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
96
+ chatSessionId: ID;
97
+ error: ZeniAPIStatus;
98
+ }, "aiCfoView/updateChatSessionPinFailure">, clearUpdateChatSessionPinStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
99
+ chatSessionId: ID;
100
+ }, "aiCfoView/clearUpdateChatSessionPinStatus">, clearAiCfoView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"aiCfoView/clearAiCfoView">, updateCotCollapsedState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
94
101
  isCollapsed: boolean;
95
102
  questionAnswerId: ID;
96
103
  }, "aiCfoView/updateCotCollapsedState">, fetchSuggestedQuestions: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.clearAiCfoSidePanelHostPageContext = exports.applyAiCfoSidePanelHostPageTransition = exports.fetchSuggestedQuestionsFailure = exports.fetchSuggestedQuestionsSuccess = exports.fetchSuggestedQuestions = exports.updateCotCollapsedState = exports.clearAiCfoView = exports.updateChatSessionPin = exports.clearDeleteChatSessionStatus = exports.deleteChatSessionFailure = exports.deleteChatSessionSuccess = exports.deleteChatSession = exports.acceptMasterTOSFailure = exports.acceptMasterTOSSuccess = exports.acceptMasterTOS = exports.stopSubmitQuestionFailure = exports.stopSubmitQuestionSuccess = exports.stopSubmitQuestion = exports.stopSubmitFailure = exports.stopSubmitSuccess = exports.stopSubmit = exports.clearLastContextMessage = exports.clearCurrentSessionId = exports.fetchChatHistoryFailure = exports.fetchChatHistorySuccess = exports.fetchChatHistory = exports.fetchChatSessionsForUserFailure = exports.fetchChatSessionsForUserSuccess = exports.fetchChatSessionsForUser = exports.createSessionAndSubmitFailure = exports.createSessionAndSubmitSuccess = exports.initializeNewSessionState = exports.createSessionAndSubmit = exports.createSessionFailure = exports.createSessionSuccess = exports.createSession = exports.setSession = exports.clearInput = exports.updateCurrentInput = exports.updateAiCfoViewScrollPosition = exports.updateResponseState = exports.submitQuestionFailure = exports.submitQuestionSuccess = exports.submitQuestion = exports.initialAiCfoViewState = void 0;
4
+ exports.clearAiCfoSidePanelHostPageContext = exports.applyAiCfoSidePanelHostPageTransition = exports.fetchSuggestedQuestionsFailure = exports.fetchSuggestedQuestionsSuccess = exports.fetchSuggestedQuestions = exports.updateCotCollapsedState = exports.clearAiCfoView = exports.clearUpdateChatSessionPinStatus = exports.updateChatSessionPinFailure = exports.updateChatSessionPinSuccess = exports.updateChatSessionPin = exports.clearDeleteChatSessionStatus = exports.deleteChatSessionFailure = exports.deleteChatSessionSuccess = exports.deleteChatSession = exports.acceptMasterTOSFailure = exports.acceptMasterTOSSuccess = exports.acceptMasterTOS = exports.stopSubmitQuestionFailure = exports.stopSubmitQuestionSuccess = exports.stopSubmitQuestion = exports.stopSubmitFailure = exports.stopSubmitSuccess = exports.stopSubmit = exports.clearLastContextMessage = exports.clearCurrentSessionId = exports.fetchChatHistoryFailure = exports.fetchChatHistorySuccess = exports.fetchChatHistory = exports.fetchChatSessionsForUserFailure = exports.fetchChatSessionsForUserSuccess = exports.fetchChatSessionsForUser = exports.createSessionAndSubmitFailure = exports.createSessionAndSubmitSuccess = exports.initializeNewSessionState = exports.createSessionAndSubmit = exports.createSessionFailure = exports.createSessionSuccess = exports.createSession = exports.setSession = exports.clearInput = exports.updateCurrentInput = exports.updateAiCfoViewScrollPosition = exports.updateResponseState = exports.submitQuestionFailure = exports.submitQuestionSuccess = exports.submitQuestion = exports.initialAiCfoViewState = void 0;
5
5
  const toolkit_1 = require("@reduxjs/toolkit");
6
6
  function removeSessionIdFromPageKeyMap(draft, sessionId) {
7
7
  const map = draft.uiState.chatSessionIdByPageKey;
@@ -47,6 +47,7 @@ exports.initialAiCfoViewState = {
47
47
  error: undefined,
48
48
  },
49
49
  deleteChatSessionStateByChatSessionId: {},
50
+ updateChatSessionPinStateByChatSessionId: {},
50
51
  fetchChatSessionHistoryByChatSessionId: {},
51
52
  responseStateByChatSessionId: {},
52
53
  stopSubmitStateByChatSessionId: {},
@@ -381,16 +382,36 @@ const aiCfoView = (0, toolkit_1.createSlice)({
381
382
  const { chatSessionId } = action.payload;
382
383
  delete draft.deleteChatSessionStateByChatSessionId[chatSessionId];
383
384
  },
384
- /** Dispatched to trigger {@link updateChatSessionPinEpic}; no view state mutation. */
385
385
  updateChatSessionPin: {
386
- reducer(draft, _action) {
387
- void draft;
388
- void _action;
386
+ reducer(draft, action) {
387
+ const { chatSessionId } = action.payload;
388
+ draft.updateChatSessionPinStateByChatSessionId[chatSessionId] = {
389
+ fetchState: 'In-Progress',
390
+ error: undefined,
391
+ };
389
392
  },
390
393
  prepare(chatSessionId, isPinned) {
391
394
  return { payload: { chatSessionId, isPinned } };
392
395
  },
393
396
  },
397
+ updateChatSessionPinSuccess(draft, action) {
398
+ const { chatSessionId } = action.payload;
399
+ draft.updateChatSessionPinStateByChatSessionId[chatSessionId] = {
400
+ fetchState: 'Completed',
401
+ error: undefined,
402
+ };
403
+ },
404
+ updateChatSessionPinFailure(draft, action) {
405
+ const { chatSessionId, error } = action.payload;
406
+ draft.updateChatSessionPinStateByChatSessionId[chatSessionId] = {
407
+ fetchState: 'Error',
408
+ error,
409
+ };
410
+ },
411
+ clearUpdateChatSessionPinStatus(draft, action) {
412
+ const { chatSessionId } = action.payload;
413
+ delete draft.updateChatSessionPinStateByChatSessionId[chatSessionId];
414
+ },
394
415
  clearInput(draft) {
395
416
  draft.uiState.currentInput = '';
396
417
  },
@@ -466,5 +487,5 @@ const aiCfoView = (0, toolkit_1.createSlice)({
466
487
  },
467
488
  },
468
489
  });
469
- _a = aiCfoView.actions, exports.submitQuestion = _a.submitQuestion, exports.submitQuestionSuccess = _a.submitQuestionSuccess, exports.submitQuestionFailure = _a.submitQuestionFailure, exports.updateResponseState = _a.updateResponseState, exports.updateAiCfoViewScrollPosition = _a.updateAiCfoViewScrollPosition, exports.updateCurrentInput = _a.updateCurrentInput, exports.clearInput = _a.clearInput, exports.setSession = _a.setSession, exports.createSession = _a.createSession, exports.createSessionSuccess = _a.createSessionSuccess, exports.createSessionFailure = _a.createSessionFailure, exports.createSessionAndSubmit = _a.createSessionAndSubmit, exports.initializeNewSessionState = _a.initializeNewSessionState, exports.createSessionAndSubmitSuccess = _a.createSessionAndSubmitSuccess, exports.createSessionAndSubmitFailure = _a.createSessionAndSubmitFailure, exports.fetchChatSessionsForUser = _a.fetchChatSessionsForUser, exports.fetchChatSessionsForUserSuccess = _a.fetchChatSessionsForUserSuccess, exports.fetchChatSessionsForUserFailure = _a.fetchChatSessionsForUserFailure, exports.fetchChatHistory = _a.fetchChatHistory, exports.fetchChatHistorySuccess = _a.fetchChatHistorySuccess, exports.fetchChatHistoryFailure = _a.fetchChatHistoryFailure, exports.clearCurrentSessionId = _a.clearCurrentSessionId, exports.clearLastContextMessage = _a.clearLastContextMessage, exports.stopSubmit = _a.stopSubmit, exports.stopSubmitSuccess = _a.stopSubmitSuccess, exports.stopSubmitFailure = _a.stopSubmitFailure, exports.stopSubmitQuestion = _a.stopSubmitQuestion, exports.stopSubmitQuestionSuccess = _a.stopSubmitQuestionSuccess, exports.stopSubmitQuestionFailure = _a.stopSubmitQuestionFailure, exports.acceptMasterTOS = _a.acceptMasterTOS, exports.acceptMasterTOSSuccess = _a.acceptMasterTOSSuccess, exports.acceptMasterTOSFailure = _a.acceptMasterTOSFailure, exports.deleteChatSession = _a.deleteChatSession, exports.deleteChatSessionSuccess = _a.deleteChatSessionSuccess, exports.deleteChatSessionFailure = _a.deleteChatSessionFailure, exports.clearDeleteChatSessionStatus = _a.clearDeleteChatSessionStatus, exports.updateChatSessionPin = _a.updateChatSessionPin, exports.clearAiCfoView = _a.clearAiCfoView, exports.updateCotCollapsedState = _a.updateCotCollapsedState, exports.fetchSuggestedQuestions = _a.fetchSuggestedQuestions, exports.fetchSuggestedQuestionsSuccess = _a.fetchSuggestedQuestionsSuccess, exports.fetchSuggestedQuestionsFailure = _a.fetchSuggestedQuestionsFailure, exports.applyAiCfoSidePanelHostPageTransition = _a.applyAiCfoSidePanelHostPageTransition, exports.clearAiCfoSidePanelHostPageContext = _a.clearAiCfoSidePanelHostPageContext;
490
+ _a = aiCfoView.actions, exports.submitQuestion = _a.submitQuestion, exports.submitQuestionSuccess = _a.submitQuestionSuccess, exports.submitQuestionFailure = _a.submitQuestionFailure, exports.updateResponseState = _a.updateResponseState, exports.updateAiCfoViewScrollPosition = _a.updateAiCfoViewScrollPosition, exports.updateCurrentInput = _a.updateCurrentInput, exports.clearInput = _a.clearInput, exports.setSession = _a.setSession, exports.createSession = _a.createSession, exports.createSessionSuccess = _a.createSessionSuccess, exports.createSessionFailure = _a.createSessionFailure, exports.createSessionAndSubmit = _a.createSessionAndSubmit, exports.initializeNewSessionState = _a.initializeNewSessionState, exports.createSessionAndSubmitSuccess = _a.createSessionAndSubmitSuccess, exports.createSessionAndSubmitFailure = _a.createSessionAndSubmitFailure, exports.fetchChatSessionsForUser = _a.fetchChatSessionsForUser, exports.fetchChatSessionsForUserSuccess = _a.fetchChatSessionsForUserSuccess, exports.fetchChatSessionsForUserFailure = _a.fetchChatSessionsForUserFailure, exports.fetchChatHistory = _a.fetchChatHistory, exports.fetchChatHistorySuccess = _a.fetchChatHistorySuccess, exports.fetchChatHistoryFailure = _a.fetchChatHistoryFailure, exports.clearCurrentSessionId = _a.clearCurrentSessionId, exports.clearLastContextMessage = _a.clearLastContextMessage, exports.stopSubmit = _a.stopSubmit, exports.stopSubmitSuccess = _a.stopSubmitSuccess, exports.stopSubmitFailure = _a.stopSubmitFailure, exports.stopSubmitQuestion = _a.stopSubmitQuestion, exports.stopSubmitQuestionSuccess = _a.stopSubmitQuestionSuccess, exports.stopSubmitQuestionFailure = _a.stopSubmitQuestionFailure, exports.acceptMasterTOS = _a.acceptMasterTOS, exports.acceptMasterTOSSuccess = _a.acceptMasterTOSSuccess, exports.acceptMasterTOSFailure = _a.acceptMasterTOSFailure, exports.deleteChatSession = _a.deleteChatSession, exports.deleteChatSessionSuccess = _a.deleteChatSessionSuccess, exports.deleteChatSessionFailure = _a.deleteChatSessionFailure, exports.clearDeleteChatSessionStatus = _a.clearDeleteChatSessionStatus, exports.updateChatSessionPin = _a.updateChatSessionPin, exports.updateChatSessionPinSuccess = _a.updateChatSessionPinSuccess, exports.updateChatSessionPinFailure = _a.updateChatSessionPinFailure, exports.clearUpdateChatSessionPinStatus = _a.clearUpdateChatSessionPinStatus, exports.clearAiCfoView = _a.clearAiCfoView, exports.updateCotCollapsedState = _a.updateCotCollapsedState, exports.fetchSuggestedQuestions = _a.fetchSuggestedQuestions, exports.fetchSuggestedQuestionsSuccess = _a.fetchSuggestedQuestionsSuccess, exports.fetchSuggestedQuestionsFailure = _a.fetchSuggestedQuestionsFailure, exports.applyAiCfoSidePanelHostPageTransition = _a.applyAiCfoSidePanelHostPageTransition, exports.clearAiCfoSidePanelHostPageContext = _a.clearAiCfoSidePanelHostPageContext;
470
491
  exports.default = aiCfoView.reducer;
@@ -20,6 +20,7 @@ export interface AiCfoViewSelector extends SelectorView, AiCfoSelectorView {
20
20
  stopSubmitStateByChatSessionId: Record<ID, FetchStateAndError>;
21
21
  suggestedQuestionsByPageContext: Partial<Record<AiCfoSuggestedQuestionsPageContext, SuggestedQuestionsForPageContext>>;
22
22
  uiState: AiCfoViewUIState;
23
+ updateChatSessionPinStateByChatSessionId: Record<ID, FetchStateAndError>;
23
24
  }
24
25
  export declare const getAiCfoView: (state: RootState) => AiCfoViewSelector;
25
26
  export declare function getSuggestedQuestionsForPageContext(state: RootState, pageContext: AiCfoSuggestedQuestionsPageContext): SuggestedQuestionsForPageContext | undefined;
@@ -6,13 +6,14 @@ const aiCfoReducer_1 = require("../../entity/aiCfo/aiCfoReducer");
6
6
  const aiCfoSelector_1 = require("../../entity/aiCfo/aiCfoSelector");
7
7
  const aiCfoViewReducer_1 = require("./aiCfoViewReducer");
8
8
  const getAiCfoView = (state) => {
9
- const { fetchState, error, uiState, createSessionState, createSessionAndSubmitState, deleteChatSessionStateByChatSessionId, stopSubmitStateByChatSessionId, responseStateByChatSessionId, fetchChatSessionHistoryByChatSessionId, masterTOSAcceptanceState, suggestedQuestionsByPageContext, } = state.aiCfoViewState ?? aiCfoViewReducer_1.initialAiCfoViewState;
9
+ const { fetchState, error, uiState, createSessionState, createSessionAndSubmitState, deleteChatSessionStateByChatSessionId, updateChatSessionPinStateByChatSessionId, stopSubmitStateByChatSessionId, responseStateByChatSessionId, fetchChatSessionHistoryByChatSessionId, masterTOSAcceptanceState, suggestedQuestionsByPageContext, } = state.aiCfoViewState ?? aiCfoViewReducer_1.initialAiCfoViewState;
10
10
  return {
11
11
  fetchState,
12
12
  error,
13
13
  createSessionState,
14
14
  createSessionAndSubmitState,
15
15
  deleteChatSessionStateByChatSessionId,
16
+ updateChatSessionPinStateByChatSessionId,
16
17
  stopSubmitStateByChatSessionId,
17
18
  responseStateByChatSessionId,
18
19
  uiState,
@@ -54,4 +54,5 @@ export interface AiCfoViewState extends FetchStateAndError {
54
54
  /** Keyed by `page_context` query value (e.g. balance_sheet). */
55
55
  suggestedQuestionsByPageContext: Partial<Record<AiCfoSuggestedQuestionsPageContext, SuggestedQuestionsForPageContext>>;
56
56
  uiState: AiCfoViewUIState;
57
+ updateChatSessionPinStateByChatSessionId: Record<ID, FetchStateAndError>;
57
58
  }
@@ -1,8 +1,35 @@
1
1
  import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
2
  import { mergeChatSessionFromPutResponse } from '../../../entity/aiCfo/aiCfoReducer';
3
+ import { ChatSessionPayload } from '../../../entity/aiCfo/aiCfoPayload';
4
+ import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
4
5
  import { RootState } from '../../../reducer';
5
6
  import { ZeniAPI } from '../../../zeniAPI';
6
- import { updateChatSessionPin } from '../aiCfoViewReducer';
7
- export type ActionType = ReturnType<typeof updateChatSessionPin> | ReturnType<typeof mergeChatSessionFromPutResponse>;
8
- export declare const updateChatSessionPinEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
7
+ import { updateChatSessionPin, updateChatSessionPinFailure, updateChatSessionPinSuccess } from '../aiCfoViewReducer';
8
+ export type ActionType = ReturnType<typeof updateChatSessionPin> | ReturnType<typeof mergeChatSessionFromPutResponse> | ReturnType<typeof updateChatSessionPinSuccess> | ReturnType<typeof updateChatSessionPinFailure> | ReturnType<typeof openSnackbar>;
9
+ export declare const updateChatSessionPinEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
10
+ payload: {
11
+ messageSection: import("../../..").SnackbarMessageSections;
12
+ messageText: import("../../..").SnackbarMessageSectionTexts;
13
+ type: import("../../..").SnackbarMessageType;
14
+ showStatusIcon?: boolean;
15
+ variables?: {
16
+ variableName: string;
17
+ variableValue: string;
18
+ }[];
19
+ };
20
+ type: "snackbar/openSnackbar";
21
+ } | {
22
+ payload: ChatSessionPayload;
23
+ type: "aiCfo/mergeChatSessionFromPutResponse";
24
+ } | {
25
+ payload: {
26
+ chatSessionId: import("../../..").ID;
27
+ };
28
+ type: "aiCfoView/updateChatSessionPinSuccess";
29
+ } | {
30
+ payload: {
31
+ chatSessionId: import("../../..").ID;
32
+ error: import("../../../responsePayload").ZeniAPIStatus;
33
+ };
34
+ type: "aiCfoView/updateChatSessionPinFailure";
35
+ }>;
@@ -4,47 +4,48 @@ exports.updateChatSessionPinEpic = void 0;
4
4
  const rxjs_1 = require("rxjs");
5
5
  const operators_1 = require("rxjs/operators");
6
6
  const aiCfoReducer_1 = require("../../../entity/aiCfo/aiCfoReducer");
7
+ const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
7
8
  const responsePayload_1 = require("../../../responsePayload");
8
9
  const aiCfoViewReducer_1 = require("../aiCfoViewReducer");
9
- /**
10
- * TEMP (remove after chat platform pin API is deployed everywhere):
11
- * When PUT pin/unpin fails, still merge requested pin state so the drawer/navbar UX works
12
- * against older backends. Revert this file when the platform supports pin or when dropping
13
- * compatibility — search for `TEMP_PIN_OPTIMISTIC`.
14
- */
15
- function buildOptimisticPinPayload_TEMP_PIN_OPTIMISTIC(state, chatSessionId, isPinned) {
16
- const session = state.aiCfoState.aiCfoByChatSessionId[chatSessionId]?.chatSession;
17
- if (session == null) {
18
- return null;
19
- }
20
- return {
21
- chat_session_id: chatSessionId,
22
- user_id: session.userId,
23
- created_at: session.createdAt.toISOString(),
24
- chat_session_summary: session.chatSessionSummary ?? null,
25
- is_pinned: isPinned,
26
- pinned_at: isPinned ? new Date().toISOString() : null,
27
- };
28
- }
29
- const updateChatSessionPinEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(aiCfoViewReducer_1.updateChatSessionPin.match), (0, operators_1.switchMap)((action) => {
10
+ const updateChatSessionPinEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(aiCfoViewReducer_1.updateChatSessionPin.match), (0, operators_1.mergeMap)((action) => {
30
11
  const { chatSessionId, isPinned } = action.payload;
31
12
  return zeniAPI
32
- .putAndGetJSON(`https://dev.api.zeni.ai/version/chat/05-20-e27f90e/1.0/sessions/${chatSessionId}`, { is_pinned: isPinned })
13
+ .putAndGetJSON(`https://dev.api.zeni.ai/version/chat/05-20-d37fcc2/1.0/sessions/${chatSessionId}`, { is_pinned: isPinned })
33
14
  .pipe((0, operators_1.mergeMap)((response) => {
34
15
  if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
35
- return (0, rxjs_1.of)((0, aiCfoReducer_1.mergeChatSessionFromPutResponse)(response.data));
16
+ return (0, rxjs_1.from)([
17
+ (0, aiCfoReducer_1.mergeChatSessionFromPutResponse)(response.data),
18
+ (0, aiCfoViewReducer_1.updateChatSessionPinSuccess)({ chatSessionId }),
19
+ ]);
36
20
  }
37
- // TEMP_PIN_OPTIMISTIC see comment above
38
- const synthetic = buildOptimisticPinPayload_TEMP_PIN_OPTIMISTIC(state$.value, chatSessionId, isPinned);
39
- return synthetic != null
40
- ? (0, rxjs_1.of)((0, aiCfoReducer_1.mergeChatSessionFromPutResponse)(synthetic))
41
- : rxjs_1.EMPTY;
42
- }), (0, operators_1.catchError)(() => {
43
- // TEMP_PIN_OPTIMISTIC — see comment above
44
- const synthetic = buildOptimisticPinPayload_TEMP_PIN_OPTIMISTIC(state$.value, chatSessionId, isPinned);
45
- return synthetic != null
46
- ? (0, rxjs_1.of)((0, aiCfoReducer_1.mergeChatSessionFromPutResponse)(synthetic))
47
- : rxjs_1.EMPTY;
48
- }));
21
+ return (0, rxjs_1.of)((0, aiCfoViewReducer_1.updateChatSessionPinFailure)({
22
+ chatSessionId,
23
+ error: response.status,
24
+ }), (0, snackbarReducer_1.openSnackbar)({
25
+ messageSection: 'ai_cfo_update_chat_session_pin',
26
+ messageText: 'failed',
27
+ type: 'error',
28
+ variables: [
29
+ {
30
+ variableName: '_api-error_',
31
+ variableValue: response.status?.message ?? String(response.status),
32
+ },
33
+ ],
34
+ }));
35
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, aiCfoViewReducer_1.updateChatSessionPinFailure)({
36
+ chatSessionId,
37
+ error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Update chat session pin REST API call errored out ' +
38
+ JSON.stringify(error)),
39
+ }), (0, snackbarReducer_1.openSnackbar)({
40
+ messageSection: 'ai_cfo_update_chat_session_pin',
41
+ messageText: 'failed',
42
+ type: 'error',
43
+ variables: [
44
+ {
45
+ variableName: '_api-error_',
46
+ variableValue: JSON.stringify(error),
47
+ },
48
+ ],
49
+ }))));
49
50
  }));
50
51
  exports.updateChatSessionPinEpic = updateChatSessionPinEpic;
@@ -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" | "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" | "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" | "ai_cfo_update_chat_session_pin" | "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" | "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: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.0.81-betaAD6",
3
+ "version": "5.0.81-betaAD8",
4
4
  "description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/esm/index.js",