@zeniai/client-epic-state 4.20.3-betaSS13 → 4.20.3-betaSS14

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 (34) hide show
  1. package/lib/common/aiCfo/aiCfoSuggestedQuestionsPageContext.d.ts +1 -1
  2. package/lib/entity/tenant/clearAllEpic.d.ts +2 -1
  3. package/lib/entity/tenant/clearAllEpic.js +2 -0
  4. package/lib/esm/entity/tenant/clearAllEpic.js +2 -0
  5. package/lib/esm/index.js +1 -1
  6. package/lib/esm/view/creditAgentView/creditAgentViewReducer.js +73 -37
  7. package/lib/esm/view/creditAgentView/creditAgentViewState.js +1 -22
  8. package/lib/esm/view/creditAgentView/epics/downloadCreditReportEpic.js +20 -17
  9. package/lib/esm/view/creditAgentView/epics/fetchCardProfilesEpic.js +5 -5
  10. package/lib/esm/view/creditAgentView/epics/fetchCreditAgentAccessEpic.js +8 -8
  11. package/lib/esm/view/creditAgentView/epics/fetchCreditAgentMacroEpic.js +7 -7
  12. package/lib/esm/view/creditAgentView/epics/saveCreditAgentMacroEpic.js +8 -3
  13. package/lib/esm/view/creditAgentView/epics/updateCardProfileEpic.js +5 -11
  14. package/lib/esm/view/spendManagement/zeniAccounts/zeniAccountList/zeniAccountListSelector.js +10 -3
  15. package/lib/index.d.ts +3 -3
  16. package/lib/index.js +12 -12
  17. package/lib/view/creditAgentView/creditAgentViewReducer.d.ts +19 -8
  18. package/lib/view/creditAgentView/creditAgentViewReducer.js +76 -40
  19. package/lib/view/creditAgentView/creditAgentViewState.d.ts +5 -15
  20. package/lib/view/creditAgentView/creditAgentViewState.js +0 -23
  21. package/lib/view/creditAgentView/epics/downloadCreditReportEpic.d.ts +20 -5
  22. package/lib/view/creditAgentView/epics/downloadCreditReportEpic.js +21 -16
  23. package/lib/view/creditAgentView/epics/fetchCardProfilesEpic.d.ts +4 -4
  24. package/lib/view/creditAgentView/epics/fetchCardProfilesEpic.js +4 -4
  25. package/lib/view/creditAgentView/epics/fetchCreditAgentAccessEpic.d.ts +6 -6
  26. package/lib/view/creditAgentView/epics/fetchCreditAgentAccessEpic.js +5 -5
  27. package/lib/view/creditAgentView/epics/fetchCreditAgentMacroEpic.d.ts +5 -5
  28. package/lib/view/creditAgentView/epics/fetchCreditAgentMacroEpic.js +5 -5
  29. package/lib/view/creditAgentView/epics/saveCreditAgentMacroEpic.js +8 -3
  30. package/lib/view/creditAgentView/epics/updateCardProfileEpic.d.ts +5 -5
  31. package/lib/view/creditAgentView/epics/updateCardProfileEpic.js +4 -10
  32. package/lib/view/spendManagement/zeniAccounts/zeniAccountList/zeniAccountListSelector.d.ts +9 -1
  33. package/lib/view/spendManagement/zeniAccounts/zeniAccountList/zeniAccountListSelector.js +10 -3
  34. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -69,8 +69,8 @@ exports.toPriorityCodeType = exports.getDueDateValueFromDueDateGroupId = exports
69
69
  exports.toReferralListViewSortKeyType = exports.getInviteFormView = exports.getReferralListView = exports.getNotifications = exports.getLastNotificationTime = exports.pushToastNotification = exports.getNotificationsForSelectedSubTab = exports.getExternalNotificationsForSelectedSubTab = exports.getNotificationView = exports.updateNotificationViewUIState = exports.updateNotificationViewSubTab = exports.updateNotificationViewCurrentTabAndSubTab = exports.updateNotificationViewTabState = exports.updateNotificationViewNotificationStatus = exports.updateNotificationViewAllNotificationsStatus = exports.fetchNotificationUnreadCountSuccess = exports.fetchNotificationUnreadCount = exports.fetchNotificationView = exports.toNotificationTabTypeStrict = exports.toNotificationSubTabTypeStrict = exports.updateCommentsNotificationsStatuses = exports.updateCommentsNotifications = exports.toNotificationModeStrict = exports.fetchZeniAccountsPromoCard = exports.getZeniAccountsPromoCard = exports.getAuthenticationView = exports.fetchCollaborationAuthToken = exports.clearAuditReportGroupViewByCompanyId = exports.saveReasonForAuditRule = exports.fetchAuditReportGroupView = exports.fetchAuditRuleGroupView = exports.getUserFromAllUsers = exports.getAuditRuleGroupViewSelectorView = exports.getAuditReportGroupViewSelectorView = exports.clearCardPaymentView = exports.resetCardPaymentErrorStatuses = exports.fetchPaymentSources = exports.addCardPaymentSource = exports.confirmCardSetupIntent = exports.createCardSetupIntent = exports.getAllCardsAndBankPaymentMethods = exports.deleteTag = exports.createTag = exports.fetchTagList = exports.getAllTags = exports.initialTaskDetailLocalData = exports.convertHHMMStrToMinutes = exports.updateTaskFromListView = exports.toDueDateGroupKeyType = exports.toTaskStatusCodeType = void 0;
70
70
  exports.cancelAiAccountantOnboarding = exports.getAiAccountantJobsByTenantId = exports.getAiAccountantCustomers = exports.updateAiAccountantJobs = exports.updateAiAccountantCustomer = exports.updateAiAccountantCustomers = exports.clearAllAiAccountantCustomers = exports.toAiAccountantJob = exports.toAiAccountantEnrollment = exports.toAiAccountantCustomer = exports.toAiAccountantOperationType = exports.toAiAccountantJobStatus = exports.toAiAccountantEnrollmentStatus = exports.getTreasuryFundsMaximumYield = exports.getTreasurySetupViewDetails = exports.updateTreasuryVideoViewed = exports.updateFundAllocationLocalData = exports.fetchPortfolioAllocation = exports.updatePortfolioAllocation = exports.fetchTreasuryFunds = exports.clearTreasurySetupView = exports.fetchTreasurySetupView = exports.acceptTreasuryTerms = exports.getExpressPayView = exports.resetExpressPayLocalData = exports.submitExpressPay = exports.updateExpressPayFormLocalData = exports.fetchExpressPayInitialDetails = exports.getIntlWireVerificationView = exports.updateVerificationFormLocalData = exports.submitInternationalVerificationForm = exports.fetchInternationalVerificationForm = exports.createTaskFromTaskGroupTemplate = exports.getCompanyTaskManagerView = exports.fetchTaskManagerMetrics = exports.fetchCompanyTaskManagerView = exports.getMinAllowedEndDate = exports.toRecurringFrequency = exports.getRecurringEndDateFromCount = exports.updateReferViewed = exports.getRewardsPlanCard = exports.fetchRewardsPlan = exports.resendReferralInvite = exports.updateReferralListSortUiState = exports.saveReferralFormDataInLocalStore = exports.clearReferrals = exports.sendReferralInvite = exports.fetchReferrals = exports.AmountStatusTypes = exports.StatusTypes = void 0;
71
71
  exports.toAiCfoVisualizationType = exports.ALL_AI_CFO_ANSWER_RESPONSE_TYPES = exports.ALL_AI_CFO_ANSWER_STATE_TYPES = exports.ALL_AI_CFO_VISUALIZATION_TYPES = exports.ALL_AI_CFO_CHARTS_TYPES = exports.getAiCfoSelectorView = exports.getAllQuestionsForChatSession = exports.getQuestionAnswerByIdForChatSession = exports.getAllQuestionAnswersForChatSession = exports.toAiCfoVisualization = exports.clearAiCfo = exports.clearSession = exports.addQuestionPayload = exports.upsertOrAddQuestionAnswerPayload = exports.upsertAnswerPayload = exports.setSessions = exports.setNewSession = exports.getSuggestedQuestionsForPageContext = exports.getAiCfoView = exports.clearAiCfoSidePanelHostPageContext = exports.applyAiCfoSidePanelHostPageTransition = exports.fetchSuggestedQuestionsFailure = exports.fetchSuggestedQuestionsSuccess = exports.fetchSuggestedQuestions = exports.updateResponseState = exports.deleteChatSession = exports.acceptMasterTOS = exports.fetchChatHistory = exports.stopSubmitQuestion = exports.stopSubmit = exports.createSessionAndSubmit = exports.clearLastContextMessage = exports.clearDeleteChatSessionStatus = exports.clearCurrentSessionId = exports.clearAiCfoView = exports.setSession = exports.clearInput = exports.updateCotCollapsedState = exports.updateCurrentInput = exports.updateAiCfoViewScrollPosition = exports.submitQuestion = exports.createSession = exports.fetchChatSessionsForUser = exports.getAiAccountantCockpitView = exports.updateAiAccountantUIState = exports.triggerAiAccountantJob = exports.setSelectedTenantIdsForJobTrigger = exports.fetchAiAccountantJobs = exports.fetchAiAccountantCustomers = exports.clearAiAccountantView = void 0;
72
- exports.fetchCreditAgentAccessFailed = exports.fetchCreditAgentAccessCompleted = exports.fetchCreditAgentAccess = exports.resetSaveMacroState = exports.saveCreditAgentMacroFailure = exports.saveCreditAgentMacroSuccess = exports.saveCreditAgentMacro = exports.updateCreditAgentMacroFailure = exports.updateCreditAgentMacro = exports.fetchCreditAgentMacro = exports.resetScheduleCronState = exports.scheduleTenantCreditScoreCronFailure = exports.scheduleTenantCreditScoreCronSuccess = exports.scheduleTenantCreditScoreCron = exports.getTransactionActivityLogView = exports.fetchTransactionActivityLog = exports.BULK_UPLOAD_BAR_COMPLETE_HOLD_MS = exports.BULK_UPLOAD_AUTOMATCHING_TIMEOUT_MS = exports.getAutoTransferRuleHistory = exports.getAutoTransferRuleById = exports.getAutoTransferRules = exports.clearRuleUpdateLocalData = exports.updateRuleLocalData = exports.fetchAutoTransferReviewDetail = exports.fetchAutoTransferRuleHistory = exports.deleteAutoTransferRule = exports.updateAutoTransferRule = exports.createAutoTransferRule = exports.fetchAutoTransferRules = exports.getTreasuryTaxLetters = exports.fetchTreasuryTaxLetterList = exports.getTreasuryStatements = exports.fetchTreasuryStatementList = exports.getTreasuryTransferMoney = exports.clearTreasuryTransferMoney = exports.updateTreasuryTransferMoneyLocalData = exports.executeTreasuryTransferMoney = exports.getTreasuryDetail = exports.updateTreasuryTransactionListUIState = exports.fetchTreasuryTransactionList = exports.fetchTreasuryOverviewDetail = exports.toMessageType = exports.toMessageSender = exports.toAiCfoAnswerResponseTypeStrict = exports.toAiCfoAnswerResponseType = exports.toAiCfoAnswerStateTypeStrict = exports.toAiCfoAnswerStateType = exports.toAiCfoChartTypeStrict = exports.toAiCfoChartType = exports.toAiCfoVisualizationTypeStrict = void 0;
73
- exports.getCardProfilesData = exports.getScheduleCronState = exports.getCreditAgentMacro = exports.downloadCreditReportFailed = exports.downloadCreditReportCompleted = exports.downloadCreditReport = exports.updateCardProfileFailed = exports.updateCardProfileCompleted = exports.updateCardProfile = exports.fetchCardProfilesFailed = exports.fetchCardProfilesCompleted = exports.fetchCardProfiles = void 0;
72
+ exports.fetchCreditAgentAccessFailure = exports.fetchCreditAgentAccessSuccess = exports.fetchCreditAgentAccess = exports.resetSaveMacroState = exports.saveCreditAgentMacroFailure = exports.saveCreditAgentMacroSuccess = exports.saveCreditAgentMacro = exports.fetchCreditAgentMacroFailure = exports.fetchCreditAgentMacroSuccess = exports.fetchCreditAgentMacro = exports.resetScheduleCronState = exports.scheduleTenantCreditScoreCronFailure = exports.scheduleTenantCreditScoreCronSuccess = exports.scheduleTenantCreditScoreCron = exports.getTransactionActivityLogView = exports.fetchTransactionActivityLog = exports.BULK_UPLOAD_BAR_COMPLETE_HOLD_MS = exports.BULK_UPLOAD_AUTOMATCHING_TIMEOUT_MS = exports.getAutoTransferRuleHistory = exports.getAutoTransferRuleById = exports.getAutoTransferRules = exports.clearRuleUpdateLocalData = exports.updateRuleLocalData = exports.fetchAutoTransferReviewDetail = exports.fetchAutoTransferRuleHistory = exports.deleteAutoTransferRule = exports.updateAutoTransferRule = exports.createAutoTransferRule = exports.fetchAutoTransferRules = exports.getTreasuryTaxLetters = exports.fetchTreasuryTaxLetterList = exports.getTreasuryStatements = exports.fetchTreasuryStatementList = exports.getTreasuryTransferMoney = exports.clearTreasuryTransferMoney = exports.updateTreasuryTransferMoneyLocalData = exports.executeTreasuryTransferMoney = exports.getTreasuryDetail = exports.updateTreasuryTransactionListUIState = exports.fetchTreasuryTransactionList = exports.fetchTreasuryOverviewDetail = exports.toMessageType = exports.toMessageSender = exports.toAiCfoAnswerResponseTypeStrict = exports.toAiCfoAnswerResponseType = exports.toAiCfoAnswerStateTypeStrict = exports.toAiCfoAnswerStateType = exports.toAiCfoChartTypeStrict = exports.toAiCfoChartType = exports.toAiCfoVisualizationTypeStrict = void 0;
73
+ exports.getCardProfilesData = exports.getScheduleCronState = exports.getCreditAgentMacro = exports.downloadCreditReportFailure = exports.downloadCreditReportSuccess = exports.downloadCreditReport = exports.updateCardProfileFailure = exports.updateCardProfileSuccess = exports.updateCardProfile = exports.fetchCardProfilesFailure = exports.fetchCardProfilesSuccess = exports.fetchCardProfiles = void 0;
74
74
  const allowedValue_1 = require("./commonStateTypes/allowedValue");
75
75
  Object.defineProperty(exports, "isAllowedValueWithCode", { enumerable: true, get: function () { return allowedValue_1.isAllowedValueWithCode; } });
76
76
  Object.defineProperty(exports, "isAllowedValueWithID", { enumerable: true, get: function () { return allowedValue_1.isAllowedValueWithID; } });
@@ -2211,24 +2211,24 @@ Object.defineProperty(exports, "scheduleTenantCreditScoreCronSuccess", { enumera
2211
2211
  Object.defineProperty(exports, "scheduleTenantCreditScoreCronFailure", { enumerable: true, get: function () { return creditAgentViewReducer_1.scheduleTenantCreditScoreCronFailure; } });
2212
2212
  Object.defineProperty(exports, "resetScheduleCronState", { enumerable: true, get: function () { return creditAgentViewReducer_1.resetScheduleCronState; } });
2213
2213
  Object.defineProperty(exports, "fetchCreditAgentMacro", { enumerable: true, get: function () { return creditAgentViewReducer_1.fetchCreditAgentMacro; } });
2214
- Object.defineProperty(exports, "updateCreditAgentMacro", { enumerable: true, get: function () { return creditAgentViewReducer_1.updateCreditAgentMacro; } });
2215
- Object.defineProperty(exports, "updateCreditAgentMacroFailure", { enumerable: true, get: function () { return creditAgentViewReducer_1.updateCreditAgentMacroFailure; } });
2214
+ Object.defineProperty(exports, "fetchCreditAgentMacroSuccess", { enumerable: true, get: function () { return creditAgentViewReducer_1.fetchCreditAgentMacroSuccess; } });
2215
+ Object.defineProperty(exports, "fetchCreditAgentMacroFailure", { enumerable: true, get: function () { return creditAgentViewReducer_1.fetchCreditAgentMacroFailure; } });
2216
2216
  Object.defineProperty(exports, "saveCreditAgentMacro", { enumerable: true, get: function () { return creditAgentViewReducer_1.saveCreditAgentMacro; } });
2217
2217
  Object.defineProperty(exports, "saveCreditAgentMacroSuccess", { enumerable: true, get: function () { return creditAgentViewReducer_1.saveCreditAgentMacroSuccess; } });
2218
2218
  Object.defineProperty(exports, "saveCreditAgentMacroFailure", { enumerable: true, get: function () { return creditAgentViewReducer_1.saveCreditAgentMacroFailure; } });
2219
2219
  Object.defineProperty(exports, "resetSaveMacroState", { enumerable: true, get: function () { return creditAgentViewReducer_1.resetSaveMacroState; } });
2220
2220
  Object.defineProperty(exports, "fetchCreditAgentAccess", { enumerable: true, get: function () { return creditAgentViewReducer_1.fetchCreditAgentAccess; } });
2221
- Object.defineProperty(exports, "fetchCreditAgentAccessCompleted", { enumerable: true, get: function () { return creditAgentViewReducer_1.fetchCreditAgentAccessCompleted; } });
2222
- Object.defineProperty(exports, "fetchCreditAgentAccessFailed", { enumerable: true, get: function () { return creditAgentViewReducer_1.fetchCreditAgentAccessFailed; } });
2221
+ Object.defineProperty(exports, "fetchCreditAgentAccessSuccess", { enumerable: true, get: function () { return creditAgentViewReducer_1.fetchCreditAgentAccessSuccess; } });
2222
+ Object.defineProperty(exports, "fetchCreditAgentAccessFailure", { enumerable: true, get: function () { return creditAgentViewReducer_1.fetchCreditAgentAccessFailure; } });
2223
2223
  Object.defineProperty(exports, "fetchCardProfiles", { enumerable: true, get: function () { return creditAgentViewReducer_1.fetchCardProfiles; } });
2224
- Object.defineProperty(exports, "fetchCardProfilesCompleted", { enumerable: true, get: function () { return creditAgentViewReducer_1.fetchCardProfilesCompleted; } });
2225
- Object.defineProperty(exports, "fetchCardProfilesFailed", { enumerable: true, get: function () { return creditAgentViewReducer_1.fetchCardProfilesFailed; } });
2224
+ Object.defineProperty(exports, "fetchCardProfilesSuccess", { enumerable: true, get: function () { return creditAgentViewReducer_1.fetchCardProfilesSuccess; } });
2225
+ Object.defineProperty(exports, "fetchCardProfilesFailure", { enumerable: true, get: function () { return creditAgentViewReducer_1.fetchCardProfilesFailure; } });
2226
2226
  Object.defineProperty(exports, "updateCardProfile", { enumerable: true, get: function () { return creditAgentViewReducer_1.updateCardProfile; } });
2227
- Object.defineProperty(exports, "updateCardProfileCompleted", { enumerable: true, get: function () { return creditAgentViewReducer_1.updateCardProfileCompleted; } });
2228
- Object.defineProperty(exports, "updateCardProfileFailed", { enumerable: true, get: function () { return creditAgentViewReducer_1.updateCardProfileFailed; } });
2227
+ Object.defineProperty(exports, "updateCardProfileSuccess", { enumerable: true, get: function () { return creditAgentViewReducer_1.updateCardProfileSuccess; } });
2228
+ Object.defineProperty(exports, "updateCardProfileFailure", { enumerable: true, get: function () { return creditAgentViewReducer_1.updateCardProfileFailure; } });
2229
2229
  Object.defineProperty(exports, "downloadCreditReport", { enumerable: true, get: function () { return creditAgentViewReducer_1.downloadCreditReport; } });
2230
- Object.defineProperty(exports, "downloadCreditReportCompleted", { enumerable: true, get: function () { return creditAgentViewReducer_1.downloadCreditReportCompleted; } });
2231
- Object.defineProperty(exports, "downloadCreditReportFailed", { enumerable: true, get: function () { return creditAgentViewReducer_1.downloadCreditReportFailed; } });
2230
+ Object.defineProperty(exports, "downloadCreditReportSuccess", { enumerable: true, get: function () { return creditAgentViewReducer_1.downloadCreditReportSuccess; } });
2231
+ Object.defineProperty(exports, "downloadCreditReportFailure", { enumerable: true, get: function () { return creditAgentViewReducer_1.downloadCreditReportFailure; } });
2232
2232
  var creditAgentViewSelector_1 = require("./view/creditAgentView/creditAgentViewSelector");
2233
2233
  Object.defineProperty(exports, "getCreditAgentMacro", { enumerable: true, get: function () { return creditAgentViewSelector_1.getCreditAgentMacro; } });
2234
2234
  Object.defineProperty(exports, "getScheduleCronState", { enumerable: true, get: function () { return creditAgentViewSelector_1.getScheduleCronState; } });
@@ -1,12 +1,13 @@
1
1
  import { ZeniAPIStatus } from '../../responsePayload';
2
2
  import { CardTenantProfileRowPayload, MacroPayload } from './creditAgentViewPayload';
3
- import { CardStatus, CardTenantProfileRow, CreditAgentViewState, initialCreditAgentViewState } from './creditAgentViewState';
3
+ import { CardStatus, CardTenantProfileRow, CreditAgentViewState } from './creditAgentViewState';
4
+ export declare const initialCreditAgentViewState: CreditAgentViewState;
4
5
  export declare function mapCardTenantProfileRowPayload(row: CardTenantProfileRowPayload): CardTenantProfileRow;
5
- export declare const fetchCreditAgentAccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"creditAgentView/fetchCreditAgentAccess">, fetchCreditAgentAccessCompleted: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "creditAgentView/fetchCreditAgentAccessCompleted">, fetchCreditAgentAccessFailed: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"creditAgentView/fetchCreditAgentAccessFailed">, scheduleTenantCreditScoreCron: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
6
- tenantId?: string;
7
- }, "creditAgentView/scheduleTenantCreditScoreCron">, scheduleTenantCreditScoreCronSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"creditAgentView/scheduleTenantCreditScoreCronSuccess">, scheduleTenantCreditScoreCronFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "creditAgentView/scheduleTenantCreditScoreCronFailure">, resetScheduleCronState: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"creditAgentView/resetScheduleCronState">, fetchCreditAgentMacro: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"creditAgentView/fetchCreditAgentMacro">, updateCreditAgentMacro: import("@reduxjs/toolkit").ActionCreatorWithPayload<MacroPayload, "creditAgentView/updateCreditAgentMacro">, updateCreditAgentMacroFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "creditAgentView/updateCreditAgentMacroFailure">, saveCreditAgentMacro: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
6
+ export declare const fetchCreditAgentAccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"creditAgentView/fetchCreditAgentAccess">, fetchCreditAgentAccessSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "creditAgentView/fetchCreditAgentAccessSuccess">, fetchCreditAgentAccessFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "creditAgentView/fetchCreditAgentAccessFailure">, scheduleTenantCreditScoreCron: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId?: string | undefined], {
7
+ tenantId: string | undefined;
8
+ }, "creditAgentView/scheduleTenantCreditScoreCron", never, never>, scheduleTenantCreditScoreCronSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"creditAgentView/scheduleTenantCreditScoreCronSuccess">, scheduleTenantCreditScoreCronFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "creditAgentView/scheduleTenantCreditScoreCronFailure">, resetScheduleCronState: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"creditAgentView/resetScheduleCronState">, fetchCreditAgentMacro: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"creditAgentView/fetchCreditAgentMacro">, fetchCreditAgentMacroSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<MacroPayload, "creditAgentView/fetchCreditAgentMacroSuccess">, fetchCreditAgentMacroFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "creditAgentView/fetchCreditAgentMacroFailure">, saveCreditAgentMacro: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[instructions: string], {
8
9
  instructions: string;
9
- }, "creditAgentView/saveCreditAgentMacro">, saveCreditAgentMacroSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<MacroPayload, "creditAgentView/saveCreditAgentMacroSuccess">, saveCreditAgentMacroFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "creditAgentView/saveCreditAgentMacroFailure">, resetSaveMacroState: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"creditAgentView/resetSaveMacroState">, fetchCardProfiles: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"creditAgentView/fetchCardProfiles">, fetchCardProfilesCompleted: import("@reduxjs/toolkit").ActionCreatorWithPayload<CardTenantProfileRow[], "creditAgentView/fetchCardProfilesCompleted">, fetchCardProfilesFailed: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "creditAgentView/fetchCardProfilesFailed">, updateCardProfile: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
10
+ }, "creditAgentView/saveCreditAgentMacro", never, never>, saveCreditAgentMacroSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<MacroPayload, "creditAgentView/saveCreditAgentMacroSuccess">, saveCreditAgentMacroFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "creditAgentView/saveCreditAgentMacroFailure">, resetSaveMacroState: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"creditAgentView/resetSaveMacroState">, fetchCardProfiles: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"creditAgentView/fetchCardProfiles">, fetchCardProfilesSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<CardTenantProfileRow[], "creditAgentView/fetchCardProfilesSuccess">, fetchCardProfilesFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "creditAgentView/fetchCardProfilesFailure">, updateCardProfile: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload: {
10
11
  tenantNamespace: string;
11
12
  update: {
12
13
  cardStatus?: CardStatus;
@@ -14,10 +15,20 @@ export declare const fetchCreditAgentAccess: import("@reduxjs/toolkit").ActionCr
14
15
  reason?: string;
15
16
  updatedByName?: string;
16
17
  };
17
- }, "creditAgentView/updateCardProfile">, updateCardProfileCompleted: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
18
- profile: Partial<CardTenantProfileRow>;
18
+ }], {
19
19
  tenantNamespace: string;
20
- }, "creditAgentView/updateCardProfileCompleted">, updateCardProfileFailed: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "creditAgentView/updateCardProfileFailed">, downloadCreditReport: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"creditAgentView/downloadCreditReport">, downloadCreditReportCompleted: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"creditAgentView/downloadCreditReportCompleted">, downloadCreditReportFailed: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"creditAgentView/downloadCreditReportFailed">;
20
+ update: {
21
+ cardStatus?: CardStatus;
22
+ creditLimit?: number;
23
+ reason?: string;
24
+ updatedByName?: string;
25
+ };
26
+ }, "creditAgentView/updateCardProfile", never, never>, updateCardProfileSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
27
+ profile: CardTenantProfileRow;
28
+ tenantNamespace: string;
29
+ }, "creditAgentView/updateCardProfileSuccess">, updateCardProfileFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload: ZeniAPIStatus<Record<string, unknown>>], ZeniAPIStatus<Record<string, unknown>>, "creditAgentView/updateCardProfileFailure", never, never>, downloadCreditReport: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"creditAgentView/downloadCreditReport">, downloadCreditReportSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[csv: string], {
30
+ csv: string;
31
+ }, "creditAgentView/downloadCreditReportSuccess", never, never>, downloadCreditReportFailure: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"creditAgentView/downloadCreditReportFailure">;
21
32
  export { initialCreditAgentViewState as initialState, CreditAgentViewState };
22
33
  declare const _default: import("redux").Reducer<CreditAgentViewState>;
23
34
  export default _default;
@@ -1,32 +1,56 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.initialState = exports.downloadCreditReportFailed = exports.downloadCreditReportCompleted = exports.downloadCreditReport = exports.updateCardProfileFailed = exports.updateCardProfileCompleted = exports.updateCardProfile = exports.fetchCardProfilesFailed = exports.fetchCardProfilesCompleted = exports.fetchCardProfiles = exports.resetSaveMacroState = exports.saveCreditAgentMacroFailure = exports.saveCreditAgentMacroSuccess = exports.saveCreditAgentMacro = exports.updateCreditAgentMacroFailure = exports.updateCreditAgentMacro = exports.fetchCreditAgentMacro = exports.resetScheduleCronState = exports.scheduleTenantCreditScoreCronFailure = exports.scheduleTenantCreditScoreCronSuccess = exports.scheduleTenantCreditScoreCron = exports.fetchCreditAgentAccessFailed = exports.fetchCreditAgentAccessCompleted = exports.fetchCreditAgentAccess = void 0;
4
+ exports.initialState = exports.downloadCreditReportFailure = exports.downloadCreditReportSuccess = exports.downloadCreditReport = exports.updateCardProfileFailure = exports.updateCardProfileSuccess = exports.updateCardProfile = exports.fetchCardProfilesFailure = exports.fetchCardProfilesSuccess = exports.fetchCardProfiles = exports.resetSaveMacroState = exports.saveCreditAgentMacroFailure = exports.saveCreditAgentMacroSuccess = exports.saveCreditAgentMacro = exports.fetchCreditAgentMacroFailure = exports.fetchCreditAgentMacroSuccess = exports.fetchCreditAgentMacro = exports.resetScheduleCronState = exports.scheduleTenantCreditScoreCronFailure = exports.scheduleTenantCreditScoreCronSuccess = exports.scheduleTenantCreditScoreCron = exports.fetchCreditAgentAccessFailure = exports.fetchCreditAgentAccessSuccess = exports.fetchCreditAgentAccess = exports.initialCreditAgentViewState = void 0;
5
5
  exports.mapCardTenantProfileRowPayload = mapCardTenantProfileRowPayload;
6
6
  const toolkit_1 = require("@reduxjs/toolkit");
7
- const creditAgentViewState_1 = require("./creditAgentViewState");
8
- Object.defineProperty(exports, "initialState", { enumerable: true, get: function () { return creditAgentViewState_1.initialCreditAgentViewState; } });
7
+ exports.initialCreditAgentViewState = {
8
+ access: {
9
+ fetchState: 'Not-Started',
10
+ isAllowed: null,
11
+ },
12
+ cardProfiles: {
13
+ downloadState: 'Not-Started',
14
+ error: undefined,
15
+ fetchState: 'Not-Started',
16
+ rows: [],
17
+ },
18
+ macro: {
19
+ data: null,
20
+ error: undefined,
21
+ fetchState: 'Not-Started',
22
+ updateState: 'Not-Started',
23
+ },
24
+ scheduleCron: {
25
+ error: undefined,
26
+ fetchState: 'Not-Started',
27
+ },
28
+ };
29
+ exports.initialState = exports.initialCreditAgentViewState;
9
30
  const creditAgentView = (0, toolkit_1.createSlice)({
10
31
  name: 'creditAgentView',
11
- initialState: creditAgentViewState_1.initialCreditAgentViewState,
32
+ initialState: exports.initialCreditAgentViewState,
12
33
  reducers: {
13
34
  fetchCreditAgentAccess(draft) {
14
35
  draft.access.fetchState = 'In-Progress';
15
36
  draft.access.isAllowed = null;
16
37
  },
17
- fetchCreditAgentAccessCompleted(draft, action) {
38
+ fetchCreditAgentAccessSuccess(draft, action) {
18
39
  draft.access.fetchState = 'Completed';
19
40
  draft.access.isAllowed = action.payload;
20
41
  },
21
- fetchCreditAgentAccessFailed(draft) {
42
+ fetchCreditAgentAccessFailure(draft, action) {
22
43
  draft.access.fetchState = 'Error';
23
- draft.access.isAllowed = false;
44
+ draft.access.error = action.payload;
24
45
  },
25
- scheduleTenantCreditScoreCron(draft,
26
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
27
- _action) {
28
- draft.scheduleCron.fetchState = 'In-Progress';
29
- draft.scheduleCron.error = undefined;
46
+ scheduleTenantCreditScoreCron: {
47
+ reducer(draft) {
48
+ draft.scheduleCron.fetchState = 'In-Progress';
49
+ draft.scheduleCron.error = undefined;
50
+ },
51
+ prepare(tenantId) {
52
+ return { payload: { tenantId } };
53
+ },
30
54
  },
31
55
  scheduleTenantCreditScoreCronSuccess(draft) {
32
56
  draft.scheduleCron.fetchState = 'Completed';
@@ -44,20 +68,23 @@ const creditAgentView = (0, toolkit_1.createSlice)({
44
68
  draft.macro.fetchState = 'In-Progress';
45
69
  draft.macro.error = undefined;
46
70
  },
47
- updateCreditAgentMacro(draft, action) {
71
+ fetchCreditAgentMacroSuccess(draft, action) {
48
72
  draft.macro.fetchState = 'Completed';
49
73
  draft.macro.error = undefined;
50
74
  draft.macro.data = mapMacroPayload(action.payload);
51
75
  },
52
- updateCreditAgentMacroFailure(draft, action) {
76
+ fetchCreditAgentMacroFailure(draft, action) {
53
77
  draft.macro.fetchState = 'Error';
54
78
  draft.macro.error = action.payload;
55
79
  },
56
- saveCreditAgentMacro(draft,
57
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
58
- _action) {
59
- draft.macro.updateState = 'In-Progress';
60
- draft.macro.error = undefined;
80
+ saveCreditAgentMacro: {
81
+ reducer(draft) {
82
+ draft.macro.updateState = 'In-Progress';
83
+ draft.macro.error = undefined;
84
+ },
85
+ prepare(instructions) {
86
+ return { payload: { instructions } };
87
+ },
61
88
  },
62
89
  saveCreditAgentMacroSuccess(draft, action) {
63
90
  draft.macro.updateState = 'Completed';
@@ -76,40 +103,49 @@ const creditAgentView = (0, toolkit_1.createSlice)({
76
103
  draft.cardProfiles.fetchState = 'In-Progress';
77
104
  draft.cardProfiles.error = undefined;
78
105
  },
79
- fetchCardProfilesCompleted(draft, action) {
106
+ fetchCardProfilesSuccess(draft, action) {
80
107
  draft.cardProfiles.fetchState = 'Completed';
81
108
  draft.cardProfiles.error = undefined;
82
109
  draft.cardProfiles.rows = action.payload;
83
110
  },
84
- fetchCardProfilesFailed(draft, action) {
111
+ fetchCardProfilesFailure(draft, action) {
85
112
  draft.cardProfiles.fetchState = 'Error';
86
113
  draft.cardProfiles.error = action.payload;
87
114
  },
88
- updateCardProfile(
89
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
90
- _draft,
91
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
92
- _action) {
93
- // action dispatched to trigger the epic; no optimistic state update needed
115
+ updateCardProfile: {
116
+ reducer() {
117
+ // action dispatched to trigger the epic; no optimistic state update needed
118
+ },
119
+ prepare(payload) {
120
+ return { payload };
121
+ },
94
122
  },
95
- updateCardProfileCompleted(draft, action) {
123
+ updateCardProfileSuccess(draft, action) {
96
124
  const { tenantNamespace, profile } = action.payload;
97
125
  draft.cardProfiles.rows = draft.cardProfiles.rows.map((row) => row.tenantNamespace === tenantNamespace ? { ...row, ...profile } : row);
98
126
  },
99
- updateCardProfileFailed(
100
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
101
- _draft,
102
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
103
- _action) {
104
- // noop the epic will surface the error via alert
127
+ updateCardProfileFailure: {
128
+ reducer() {
129
+ // noop — the epic will surface the error via alert
130
+ },
131
+ prepare(payload) {
132
+ return { payload };
133
+ },
105
134
  },
106
135
  downloadCreditReport(draft) {
107
136
  draft.cardProfiles.downloadState = 'In-Progress';
108
137
  },
109
- downloadCreditReportCompleted(draft) {
110
- draft.cardProfiles.downloadState = 'Completed';
111
- },
112
- downloadCreditReportFailed(draft) {
138
+ // Payload carries the CSV string so the consuming app can trigger the actual
139
+ // file download using its platform-appropriate mechanism (browser Blob / RN file API).
140
+ downloadCreditReportSuccess: {
141
+ reducer(draft) {
142
+ draft.cardProfiles.downloadState = 'Completed';
143
+ },
144
+ prepare(csv) {
145
+ return { payload: { csv } };
146
+ },
147
+ },
148
+ downloadCreditReportFailure(draft) {
113
149
  draft.cardProfiles.downloadState = 'Error';
114
150
  },
115
151
  },
@@ -126,7 +162,7 @@ function mapCardTenantProfileRowPayload(row) {
126
162
  recommendedAmount: row.recommended_amount ?? null,
127
163
  reportDate: row.report_date ?? null,
128
164
  tenantId: row.tenant_id ?? null,
129
- tenantNamespace: String(row.tenant_namespace ?? ''),
165
+ tenantNamespace: row.tenant_namespace,
130
166
  updatedByName: row.updated_by_name ?? null,
131
167
  updatedByUserId: row.updated_by_user_id ?? null,
132
168
  updatedOn: row.updated_on ?? null,
@@ -146,5 +182,5 @@ function mapMacroPayload(payload) {
146
182
  updatedAt: payload.updated_at,
147
183
  };
148
184
  }
149
- _a = creditAgentView.actions, exports.fetchCreditAgentAccess = _a.fetchCreditAgentAccess, exports.fetchCreditAgentAccessCompleted = _a.fetchCreditAgentAccessCompleted, exports.fetchCreditAgentAccessFailed = _a.fetchCreditAgentAccessFailed, exports.scheduleTenantCreditScoreCron = _a.scheduleTenantCreditScoreCron, exports.scheduleTenantCreditScoreCronSuccess = _a.scheduleTenantCreditScoreCronSuccess, exports.scheduleTenantCreditScoreCronFailure = _a.scheduleTenantCreditScoreCronFailure, exports.resetScheduleCronState = _a.resetScheduleCronState, exports.fetchCreditAgentMacro = _a.fetchCreditAgentMacro, exports.updateCreditAgentMacro = _a.updateCreditAgentMacro, exports.updateCreditAgentMacroFailure = _a.updateCreditAgentMacroFailure, exports.saveCreditAgentMacro = _a.saveCreditAgentMacro, exports.saveCreditAgentMacroSuccess = _a.saveCreditAgentMacroSuccess, exports.saveCreditAgentMacroFailure = _a.saveCreditAgentMacroFailure, exports.resetSaveMacroState = _a.resetSaveMacroState, exports.fetchCardProfiles = _a.fetchCardProfiles, exports.fetchCardProfilesCompleted = _a.fetchCardProfilesCompleted, exports.fetchCardProfilesFailed = _a.fetchCardProfilesFailed, exports.updateCardProfile = _a.updateCardProfile, exports.updateCardProfileCompleted = _a.updateCardProfileCompleted, exports.updateCardProfileFailed = _a.updateCardProfileFailed, exports.downloadCreditReport = _a.downloadCreditReport, exports.downloadCreditReportCompleted = _a.downloadCreditReportCompleted, exports.downloadCreditReportFailed = _a.downloadCreditReportFailed;
185
+ _a = creditAgentView.actions, exports.fetchCreditAgentAccess = _a.fetchCreditAgentAccess, exports.fetchCreditAgentAccessSuccess = _a.fetchCreditAgentAccessSuccess, exports.fetchCreditAgentAccessFailure = _a.fetchCreditAgentAccessFailure, exports.scheduleTenantCreditScoreCron = _a.scheduleTenantCreditScoreCron, exports.scheduleTenantCreditScoreCronSuccess = _a.scheduleTenantCreditScoreCronSuccess, exports.scheduleTenantCreditScoreCronFailure = _a.scheduleTenantCreditScoreCronFailure, exports.resetScheduleCronState = _a.resetScheduleCronState, exports.fetchCreditAgentMacro = _a.fetchCreditAgentMacro, exports.fetchCreditAgentMacroSuccess = _a.fetchCreditAgentMacroSuccess, exports.fetchCreditAgentMacroFailure = _a.fetchCreditAgentMacroFailure, exports.saveCreditAgentMacro = _a.saveCreditAgentMacro, exports.saveCreditAgentMacroSuccess = _a.saveCreditAgentMacroSuccess, exports.saveCreditAgentMacroFailure = _a.saveCreditAgentMacroFailure, exports.resetSaveMacroState = _a.resetSaveMacroState, exports.fetchCardProfiles = _a.fetchCardProfiles, exports.fetchCardProfilesSuccess = _a.fetchCardProfilesSuccess, exports.fetchCardProfilesFailure = _a.fetchCardProfilesFailure, exports.updateCardProfile = _a.updateCardProfile, exports.updateCardProfileSuccess = _a.updateCardProfileSuccess, exports.updateCardProfileFailure = _a.updateCardProfileFailure, exports.downloadCreditReport = _a.downloadCreditReport, exports.downloadCreditReportSuccess = _a.downloadCreditReportSuccess, exports.downloadCreditReportFailure = _a.downloadCreditReportFailure;
150
186
  exports.default = creditAgentView.reducer;
@@ -1,5 +1,4 @@
1
- import { FetchState } from '../../commonStateTypes/common';
2
- import { ZeniAPIStatus } from '../../responsePayload';
1
+ import { FetchState, FetchStateAndError } from '../../commonStateTypes/common';
3
2
  export type CardStatus = 'Not-Initiated' | 'Interested' | 'Pre-approved' | 'Approved' | 'Enabled' | 'Active' | 'Rejected' | 'Locked';
4
3
  export interface CardTenantProfileRow {
5
4
  cardStatus: CardStatus;
@@ -30,25 +29,16 @@ export interface CreditAgentMacro {
30
29
  version: number;
31
30
  }
32
31
  export interface CreditAgentViewState {
33
- access: {
34
- fetchState: FetchState;
32
+ access: FetchStateAndError & {
35
33
  isAllowed: boolean | null;
36
34
  };
37
- cardProfiles: {
35
+ cardProfiles: FetchStateAndError & {
38
36
  downloadState: FetchState;
39
- fetchState: FetchState;
40
37
  rows: CardTenantProfileRow[];
41
- error?: ZeniAPIStatus;
42
38
  };
43
- macro: {
39
+ macro: FetchStateAndError & {
44
40
  data: CreditAgentMacro | null;
45
- fetchState: FetchState;
46
41
  updateState: FetchState;
47
- error?: ZeniAPIStatus;
48
- };
49
- scheduleCron: {
50
- fetchState: FetchState;
51
- error?: ZeniAPIStatus;
52
42
  };
43
+ scheduleCron: FetchStateAndError;
53
44
  }
54
- export declare const initialCreditAgentViewState: CreditAgentViewState;
@@ -1,25 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.initialCreditAgentViewState = void 0;
4
- exports.initialCreditAgentViewState = {
5
- access: {
6
- fetchState: 'Not-Started',
7
- isAllowed: null,
8
- },
9
- cardProfiles: {
10
- downloadState: 'Not-Started',
11
- error: undefined,
12
- fetchState: 'Not-Started',
13
- rows: [],
14
- },
15
- macro: {
16
- data: null,
17
- error: undefined,
18
- fetchState: 'Not-Started',
19
- updateState: 'Not-Started',
20
- },
21
- scheduleCron: {
22
- error: undefined,
23
- fetchState: 'Not-Started',
24
- },
25
- };
@@ -1,12 +1,27 @@
1
1
  import { ActionsObservable, StateObservable } from 'redux-observable';
2
2
  import { RootState } from '../../../reducer';
3
3
  import { ZeniAPI } from '../../../zeniAPI';
4
- import { downloadCreditReport, downloadCreditReportCompleted, downloadCreditReportFailed } from '../creditAgentViewReducer';
5
- export type ActionType = ReturnType<typeof downloadCreditReport> | ReturnType<typeof downloadCreditReportCompleted> | ReturnType<typeof downloadCreditReportFailed>;
4
+ import { CardTenantProfileRow } from '../creditAgentViewState';
5
+ import { downloadCreditReport, downloadCreditReportFailure, downloadCreditReportSuccess } from '../creditAgentViewReducer';
6
+ export type ActionType = ReturnType<typeof downloadCreditReport> | ReturnType<typeof downloadCreditReportSuccess> | ReturnType<typeof downloadCreditReportFailure>;
7
+ export declare const CSV_HEADERS: string[];
8
+ export declare function rowToCsvLine(row: CardTenantProfileRow): string;
9
+ export declare function buildCsvString(rows: CardTenantProfileRow[]): string;
10
+ /**
11
+ * Epic: gather rows from state and emit downloadCreditReportSuccess with CSV data.
12
+ *
13
+ * This epic intentionally does NOT touch the DOM (no Blob, no document, no
14
+ * URL.createObjectURL). Those browser-only APIs would break SSR and React Native
15
+ * consumers of this shared package. The consuming web app should listen for
16
+ * downloadCreditReportSuccess and perform the actual file-save using its own
17
+ * platform-appropriate mechanism.
18
+ */
6
19
  export declare const downloadCreditReportEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, _zeniAPI: ZeniAPI) => import("rxjs").Observable<{
7
- payload: undefined;
8
- type: "creditAgentView/downloadCreditReportCompleted";
20
+ payload: {
21
+ csv: string;
22
+ };
23
+ type: "creditAgentView/downloadCreditReportSuccess";
9
24
  } | {
10
25
  payload: undefined;
11
- type: "creditAgentView/downloadCreditReportFailed";
26
+ type: "creditAgentView/downloadCreditReportFailure";
12
27
  }>;
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.downloadCreditReportEpic = void 0;
3
+ exports.downloadCreditReportEpic = exports.CSV_HEADERS = void 0;
4
+ exports.rowToCsvLine = rowToCsvLine;
5
+ exports.buildCsvString = buildCsvString;
4
6
  const rxjs_1 = require("rxjs");
5
7
  const operators_1 = require("rxjs/operators");
6
8
  const creditAgentViewReducer_1 = require("../creditAgentViewReducer");
7
- const CSV_HEADERS = [
9
+ exports.CSV_HEADERS = [
8
10
  'Customer Name',
9
11
  'Card Status',
10
12
  'Credit Limit ($)',
@@ -40,24 +42,27 @@ function rowToCsvLine(row) {
40
42
  })
41
43
  .join(',');
42
44
  }
45
+ function buildCsvString(rows) {
46
+ const csvLines = [exports.CSV_HEADERS.join(','), ...rows.map(rowToCsvLine)];
47
+ return csvLines.join('\n');
48
+ }
49
+ /**
50
+ * Epic: gather rows from state and emit downloadCreditReportSuccess with CSV data.
51
+ *
52
+ * This epic intentionally does NOT touch the DOM (no Blob, no document, no
53
+ * URL.createObjectURL). Those browser-only APIs would break SSR and React Native
54
+ * consumers of this shared package. The consuming web app should listen for
55
+ * downloadCreditReportSuccess and perform the actual file-save using its own
56
+ * platform-appropriate mechanism.
57
+ */
43
58
  const downloadCreditReportEpic = (actions$, state$, _zeniAPI) => actions$.pipe((0, operators_1.filter)(creditAgentViewReducer_1.downloadCreditReport.match), (0, operators_1.switchMap)(() => {
44
59
  try {
45
60
  const rows = state$.value.creditAgentViewState.cardProfiles.rows;
46
- const csvLines = [CSV_HEADERS.join(','), ...rows.map(rowToCsvLine)];
47
- const csv = csvLines.join('\n');
48
- const blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' });
49
- const objectUrl = URL.createObjectURL(blob);
50
- const link = document.createElement('a');
51
- link.href = objectUrl;
52
- link.setAttribute('download', 'card-tenant-profiles.csv');
53
- document.body.appendChild(link);
54
- link.click();
55
- document.body.removeChild(link);
56
- URL.revokeObjectURL(objectUrl);
57
- return (0, rxjs_1.of)((0, creditAgentViewReducer_1.downloadCreditReportCompleted)());
61
+ const csv = buildCsvString(rows);
62
+ return (0, rxjs_1.of)((0, creditAgentViewReducer_1.downloadCreditReportSuccess)(csv));
58
63
  }
59
64
  catch {
60
- return (0, rxjs_1.of)((0, creditAgentViewReducer_1.downloadCreditReportFailed)());
65
+ return (0, rxjs_1.of)((0, creditAgentViewReducer_1.downloadCreditReportFailure)());
61
66
  }
62
- }), (0, operators_1.catchError)(() => (0, rxjs_1.of)((0, creditAgentViewReducer_1.downloadCreditReportFailed)())));
67
+ }), (0, operators_1.catchError)(() => (0, rxjs_1.of)((0, creditAgentViewReducer_1.downloadCreditReportFailure)())));
63
68
  exports.downloadCreditReportEpic = downloadCreditReportEpic;
@@ -1,12 +1,12 @@
1
1
  import { ActionsObservable, StateObservable } from 'redux-observable';
2
2
  import { RootState } from '../../../reducer';
3
3
  import { ZeniAPI } from '../../../zeniAPI';
4
- import { fetchCardProfiles, fetchCardProfilesCompleted, fetchCardProfilesFailed } from '../creditAgentViewReducer';
5
- export type ActionType = ReturnType<typeof fetchCardProfiles> | ReturnType<typeof fetchCardProfilesCompleted> | ReturnType<typeof fetchCardProfilesFailed>;
4
+ import { fetchCardProfiles, fetchCardProfilesFailure, fetchCardProfilesSuccess } from '../creditAgentViewReducer';
5
+ export type ActionType = ReturnType<typeof fetchCardProfiles> | ReturnType<typeof fetchCardProfilesSuccess> | ReturnType<typeof fetchCardProfilesFailure>;
6
6
  export declare const fetchCardProfilesEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
7
7
  payload: import("../creditAgentViewState").CardTenantProfileRow[];
8
- type: "creditAgentView/fetchCardProfilesCompleted";
8
+ type: "creditAgentView/fetchCardProfilesSuccess";
9
9
  } | {
10
10
  payload: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
11
- type: "creditAgentView/fetchCardProfilesFailed";
11
+ type: "creditAgentView/fetchCardProfilesFailure";
12
12
  }>;
@@ -8,13 +8,13 @@ const creditAgentViewReducer_1 = require("../creditAgentViewReducer");
8
8
  const fetchCardProfilesEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(creditAgentViewReducer_1.fetchCardProfiles.match), (0, operators_1.switchMap)(() => {
9
9
  const url = `${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/cockpit/card-tenant-profiles`;
10
10
  return zeniAPI.getJSON(url).pipe((0, operators_1.mergeMap)((response) => {
11
- if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
11
+ if ((0, responsePayload_1.isSuccessResponse)(response)) {
12
12
  const rows = (response.data.rows ?? []).map(creditAgentViewReducer_1.mapCardTenantProfileRowPayload);
13
- return (0, rxjs_1.of)((0, creditAgentViewReducer_1.fetchCardProfilesCompleted)(rows));
13
+ return (0, rxjs_1.of)((0, creditAgentViewReducer_1.fetchCardProfilesSuccess)(rows));
14
14
  }
15
15
  else {
16
- return (0, rxjs_1.of)((0, creditAgentViewReducer_1.fetchCardProfilesFailed)(response.status));
16
+ return (0, rxjs_1.of)((0, creditAgentViewReducer_1.fetchCardProfilesFailure)(response.status));
17
17
  }
18
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, creditAgentViewReducer_1.fetchCardProfilesFailed)((0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'REST API call errored out: ' + JSON.stringify(error))))));
18
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, creditAgentViewReducer_1.fetchCardProfilesFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'REST API call errored out: ' + JSON.stringify(error))))));
19
19
  }));
20
20
  exports.fetchCardProfilesEpic = fetchCardProfilesEpic;
@@ -1,12 +1,12 @@
1
1
  import { ActionsObservable, StateObservable } from 'redux-observable';
2
2
  import { RootState } from '../../../reducer';
3
3
  import { ZeniAPI } from '../../../zeniAPI';
4
- import { fetchCreditAgentAccess, fetchCreditAgentAccessCompleted, fetchCreditAgentAccessFailed } from '../creditAgentViewReducer';
5
- export type ActionType = ReturnType<typeof fetchCreditAgentAccess> | ReturnType<typeof fetchCreditAgentAccessCompleted> | ReturnType<typeof fetchCreditAgentAccessFailed>;
6
- export declare const fetchCreditAgentAccessEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
4
+ import { fetchCreditAgentAccess, fetchCreditAgentAccessFailure, fetchCreditAgentAccessSuccess } from '../creditAgentViewReducer';
5
+ export type ActionType = ReturnType<typeof fetchCreditAgentAccess> | ReturnType<typeof fetchCreditAgentAccessSuccess> | ReturnType<typeof fetchCreditAgentAccessFailure>;
6
+ export declare const fetchCreditAgentAccessEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
7
7
  payload: boolean;
8
- type: "creditAgentView/fetchCreditAgentAccessCompleted";
8
+ type: "creditAgentView/fetchCreditAgentAccessSuccess";
9
9
  } | {
10
- payload: undefined;
11
- type: "creditAgentView/fetchCreditAgentAccessFailed";
10
+ payload: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
11
+ type: "creditAgentView/fetchCreditAgentAccessFailure";
12
12
  }>;
@@ -5,13 +5,13 @@ const rxjs_1 = require("rxjs");
5
5
  const operators_1 = require("rxjs/operators");
6
6
  const responsePayload_1 = require("../../../responsePayload");
7
7
  const creditAgentViewReducer_1 = require("../creditAgentViewReducer");
8
- const fetchCreditAgentAccessEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(creditAgentViewReducer_1.fetchCreditAgentAccess.match), (0, operators_1.switchMap)(() => {
8
+ const fetchCreditAgentAccessEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(creditAgentViewReducer_1.fetchCreditAgentAccess.match), (0, operators_1.withLatestFrom)(state$), (0, operators_1.filter)(([, state]) => state.creditAgentViewState.access.fetchState !== 'In-Progress'), (0, operators_1.switchMap)(() => {
9
9
  const url = `${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/cockpit/cards-cockpit-access`;
10
10
  return zeniAPI.getJSON(url).pipe((0, operators_1.switchMap)((response) => {
11
- if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
12
- return (0, rxjs_1.of)((0, creditAgentViewReducer_1.fetchCreditAgentAccessCompleted)(response.data.is_allowed === true));
11
+ if ((0, responsePayload_1.isSuccessResponse)(response)) {
12
+ return (0, rxjs_1.of)((0, creditAgentViewReducer_1.fetchCreditAgentAccessSuccess)(response.data.is_allowed === true));
13
13
  }
14
- return (0, rxjs_1.of)((0, creditAgentViewReducer_1.fetchCreditAgentAccessCompleted)(false));
15
- }), (0, operators_1.catchError)(() => (0, rxjs_1.of)((0, creditAgentViewReducer_1.fetchCreditAgentAccessFailed)())));
14
+ return (0, rxjs_1.of)((0, creditAgentViewReducer_1.fetchCreditAgentAccessFailure)(response.status));
15
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, creditAgentViewReducer_1.fetchCreditAgentAccessFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'REST API call errored out: ' + JSON.stringify(error))))));
16
16
  }));
17
17
  exports.fetchCreditAgentAccessEpic = fetchCreditAgentAccessEpic;
@@ -1,12 +1,12 @@
1
1
  import { ActionsObservable, StateObservable } from 'redux-observable';
2
2
  import { RootState } from '../../../reducer';
3
3
  import { ZeniAPI } from '../../../zeniAPI';
4
- import { fetchCreditAgentMacro, updateCreditAgentMacro, updateCreditAgentMacroFailure } from '../creditAgentViewReducer';
5
- export type ActionType = ReturnType<typeof fetchCreditAgentMacro> | ReturnType<typeof updateCreditAgentMacro> | ReturnType<typeof updateCreditAgentMacroFailure>;
6
- export declare const fetchCreditAgentMacroEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
4
+ import { fetchCreditAgentMacro, fetchCreditAgentMacroFailure, fetchCreditAgentMacroSuccess } from '../creditAgentViewReducer';
5
+ export type ActionType = ReturnType<typeof fetchCreditAgentMacro> | ReturnType<typeof fetchCreditAgentMacroSuccess> | ReturnType<typeof fetchCreditAgentMacroFailure>;
6
+ export declare const fetchCreditAgentMacroEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
7
7
  payload: import("../creditAgentViewPayload").MacroPayload;
8
- type: "creditAgentView/updateCreditAgentMacro";
8
+ type: "creditAgentView/fetchCreditAgentMacroSuccess";
9
9
  } | {
10
10
  payload: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
11
- type: "creditAgentView/updateCreditAgentMacroFailure";
11
+ type: "creditAgentView/fetchCreditAgentMacroFailure";
12
12
  }>;
@@ -5,15 +5,15 @@ const rxjs_1 = require("rxjs");
5
5
  const operators_1 = require("rxjs/operators");
6
6
  const responsePayload_1 = require("../../../responsePayload");
7
7
  const creditAgentViewReducer_1 = require("../creditAgentViewReducer");
8
- const fetchCreditAgentMacroEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(creditAgentViewReducer_1.fetchCreditAgentMacro.match), (0, operators_1.switchMap)(() => {
8
+ const fetchCreditAgentMacroEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(creditAgentViewReducer_1.fetchCreditAgentMacro.match), (0, operators_1.withLatestFrom)(state$), (0, operators_1.filter)(([, state]) => state.creditAgentViewState.macro.fetchState !== 'In-Progress'), (0, operators_1.switchMap)(() => {
9
9
  const url = `${zeniAPI.apiEndPoints.aiCfoMicroServiceBaseUrl}/1.0/macros/credit-agent`;
10
10
  return zeniAPI.getJSON(url).pipe((0, operators_1.mergeMap)((response) => {
11
- if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
12
- return (0, rxjs_1.of)((0, creditAgentViewReducer_1.updateCreditAgentMacro)(response.data));
11
+ if ((0, responsePayload_1.isSuccessResponse)(response)) {
12
+ return (0, rxjs_1.of)((0, creditAgentViewReducer_1.fetchCreditAgentMacroSuccess)(response.data));
13
13
  }
14
14
  else {
15
- return (0, rxjs_1.of)((0, creditAgentViewReducer_1.updateCreditAgentMacroFailure)(response.status));
15
+ return (0, rxjs_1.of)((0, creditAgentViewReducer_1.fetchCreditAgentMacroFailure)(response.status));
16
16
  }
17
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, creditAgentViewReducer_1.updateCreditAgentMacroFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'REST API call errored out: ' + JSON.stringify(error))))));
17
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, creditAgentViewReducer_1.fetchCreditAgentMacroFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'REST API call errored out: ' + JSON.stringify(error))))));
18
18
  }));
19
19
  exports.fetchCreditAgentMacroEpic = fetchCreditAgentMacroEpic;