@zeniai/client-epic-state 5.0.44 → 5.0.46

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 (64) hide show
  1. package/lib/entity/chargeCardRepayment/chargeCardRepayment.d.ts +1 -1
  2. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  3. package/lib/entity/snackbar/snackbarTypes.js +0 -3
  4. package/lib/entity/tenant/clearAllEpic.d.ts +3 -5
  5. package/lib/entity/tenant/clearAllEpic.js +2 -6
  6. package/lib/epic.d.ts +1 -7
  7. package/lib/epic.js +1 -7
  8. package/lib/esm/entity/snackbar/snackbarTypes.js +0 -3
  9. package/lib/esm/entity/tenant/clearAllEpic.js +2 -6
  10. package/lib/esm/epic.js +1 -7
  11. package/lib/esm/index.js +6 -12
  12. package/lib/esm/reducer.js +3 -9
  13. package/lib/index.d.ts +10 -18
  14. package/lib/index.js +46 -75
  15. package/lib/reducer.d.ts +3 -9
  16. package/lib/reducer.js +3 -9
  17. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  18. package/package.json +1 -1
  19. package/lib/entity/creditAgent/creditAgentPayload.d.ts +0 -41
  20. package/lib/entity/creditAgent/creditAgentPayload.js +0 -40
  21. package/lib/entity/creditAgent/creditAgentReducer.d.ts +0 -9
  22. package/lib/entity/creditAgent/creditAgentReducer.js +0 -37
  23. package/lib/entity/creditAgent/creditAgentSelector.d.ts +0 -3
  24. package/lib/entity/creditAgent/creditAgentSelector.js +0 -10
  25. package/lib/entity/creditAgent/creditAgentState.d.ts +0 -39
  26. package/lib/entity/creditAgent/creditAgentState.js +0 -17
  27. package/lib/esm/entity/creditAgent/creditAgentPayload.js +0 -36
  28. package/lib/esm/entity/creditAgent/creditAgentReducer.js +0 -33
  29. package/lib/esm/entity/creditAgent/creditAgentSelector.js +0 -6
  30. package/lib/esm/entity/creditAgent/creditAgentState.js +0 -13
  31. package/lib/esm/view/creditAgentView/buildCreditReportCsv.js +0 -44
  32. package/lib/esm/view/creditAgentView/creditAgentViewPayload.js +0 -2
  33. package/lib/esm/view/creditAgentView/creditAgentViewReducer.js +0 -183
  34. package/lib/esm/view/creditAgentView/creditAgentViewSelector.js +0 -85
  35. package/lib/esm/view/creditAgentView/creditAgentViewState.js +0 -20
  36. package/lib/esm/view/creditAgentView/epics/fetchCardProfilesEpic.js +0 -20
  37. package/lib/esm/view/creditAgentView/epics/fetchCreditAgentAccessEpic.js +0 -13
  38. package/lib/esm/view/creditAgentView/epics/fetchCreditAgentMacroEpic.js +0 -19
  39. package/lib/esm/view/creditAgentView/epics/saveCreditAgentMacroEpic.js +0 -58
  40. package/lib/esm/view/creditAgentView/epics/scheduleTenantCreditScoreCronEpic.js +0 -39
  41. package/lib/esm/view/creditAgentView/epics/updateCardProfileEpic.js +0 -62
  42. package/lib/tsconfig.typecheck.tsbuildinfo +0 -1
  43. package/lib/view/creditAgentView/buildCreditReportCsv.d.ts +0 -17
  44. package/lib/view/creditAgentView/buildCreditReportCsv.js +0 -47
  45. package/lib/view/creditAgentView/creditAgentViewPayload.d.ts +0 -9
  46. package/lib/view/creditAgentView/creditAgentViewPayload.js +0 -7
  47. package/lib/view/creditAgentView/creditAgentViewReducer.d.ts +0 -41
  48. package/lib/view/creditAgentView/creditAgentViewReducer.js +0 -187
  49. package/lib/view/creditAgentView/creditAgentViewSelector.d.ts +0 -20
  50. package/lib/view/creditAgentView/creditAgentViewSelector.js +0 -93
  51. package/lib/view/creditAgentView/creditAgentViewState.d.ts +0 -34
  52. package/lib/view/creditAgentView/creditAgentViewState.js +0 -22
  53. package/lib/view/creditAgentView/epics/fetchCardProfilesEpic.d.ts +0 -15
  54. package/lib/view/creditAgentView/epics/fetchCardProfilesEpic.js +0 -24
  55. package/lib/view/creditAgentView/epics/fetchCreditAgentAccessEpic.d.ts +0 -11
  56. package/lib/view/creditAgentView/epics/fetchCreditAgentAccessEpic.js +0 -17
  57. package/lib/view/creditAgentView/epics/fetchCreditAgentMacroEpic.d.ts +0 -15
  58. package/lib/view/creditAgentView/epics/fetchCreditAgentMacroEpic.js +0 -23
  59. package/lib/view/creditAgentView/epics/saveCreditAgentMacroEpic.d.ts +0 -29
  60. package/lib/view/creditAgentView/epics/saveCreditAgentMacroEpic.js +0 -62
  61. package/lib/view/creditAgentView/epics/scheduleTenantCreditScoreCronEpic.d.ts +0 -30
  62. package/lib/view/creditAgentView/epics/scheduleTenantCreditScoreCronEpic.js +0 -43
  63. package/lib/view/creditAgentView/epics/updateCardProfileEpic.d.ts +0 -37
  64. package/lib/view/creditAgentView/epics/updateCardProfileEpic.js +0 -66
@@ -1,62 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.saveCreditAgentMacroEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const creditAgentReducer_1 = require("../../../entity/creditAgent/creditAgentReducer");
7
- const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
8
- const responsePayload_1 = require("../../../responsePayload");
9
- const creditAgentViewReducer_1 = require("../creditAgentViewReducer");
10
- const saveCreditAgentMacroEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(creditAgentViewReducer_1.saveCreditAgentMacro.match), (0, operators_1.switchMap)((action) => {
11
- const { instructions } = action.payload;
12
- const existingMacro = state$.value.creditAgentEntityState.macro;
13
- // Fail fast if macro has not been loaded yet — avoids overwriting server-side
14
- // name/description fields with empty defaults.
15
- if (existingMacro == null) {
16
- return (0, rxjs_1.from)([
17
- (0, creditAgentViewReducer_1.saveCreditAgentMacroFailure)((0, responsePayload_1.createZeniAPIStatus)('Save failed', 'Cannot save macro: macro data has not been loaded yet.')),
18
- (0, snackbarReducer_1.openSnackbar)({
19
- messageSection: 'credit_agent_save_macro',
20
- messageText: 'failed',
21
- type: 'error',
22
- }),
23
- ]);
24
- }
25
- const url = `${zeniAPI.apiEndPoints.aiCfoMicroServiceBaseUrl}/1.0/macros/credit-agent`;
26
- const body = {
27
- instructions,
28
- name: existingMacro.name,
29
- description: existingMacro.description,
30
- };
31
- return zeniAPI.putAndGetJSON(url, body).pipe((0, operators_1.mergeMap)((response) => {
32
- if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
33
- return (0, rxjs_1.from)([
34
- (0, creditAgentReducer_1.updateCreditAgentMacro)(response.data),
35
- (0, creditAgentViewReducer_1.saveCreditAgentMacroSuccess)(),
36
- (0, snackbarReducer_1.openSnackbar)({
37
- messageSection: 'credit_agent_save_macro',
38
- messageText: 'success',
39
- type: 'success',
40
- }),
41
- ]);
42
- }
43
- else {
44
- return (0, rxjs_1.from)([
45
- (0, creditAgentViewReducer_1.saveCreditAgentMacroFailure)(response.status),
46
- (0, snackbarReducer_1.openSnackbar)({
47
- messageSection: 'credit_agent_save_macro',
48
- messageText: 'failed',
49
- type: 'error',
50
- }),
51
- ]);
52
- }
53
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
54
- (0, creditAgentViewReducer_1.saveCreditAgentMacroFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'REST API call errored out: ' + JSON.stringify(error))),
55
- (0, snackbarReducer_1.openSnackbar)({
56
- messageSection: 'credit_agent_save_macro',
57
- messageText: 'failed',
58
- type: 'error',
59
- }),
60
- ])));
61
- }));
62
- exports.saveCreditAgentMacroEpic = saveCreditAgentMacroEpic;
@@ -1,30 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
3
- import { RootState } from '../../../reducer';
4
- import { ZeniAPI } from '../../../zeniAPI';
5
- import { scheduleTenantCreditScoreCron, scheduleTenantCreditScoreCronFailure, scheduleTenantCreditScoreCronSuccess } from '../creditAgentViewReducer';
6
- export type ActionType = ReturnType<typeof scheduleTenantCreditScoreCron> | ReturnType<typeof scheduleTenantCreditScoreCronSuccess> | ReturnType<typeof scheduleTenantCreditScoreCronFailure> | ReturnType<typeof openSnackbar>;
7
- export declare const scheduleTenantCreditScoreCronEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
8
- payload: {
9
- messageSection: import("../../..").SnackbarMessageSections;
10
- messageText: import("../../..").SnackbarMessageSectionTexts;
11
- type: import("../../..").SnackbarMessageType;
12
- showStatusIcon?: boolean;
13
- variables?: {
14
- variableName: string;
15
- variableValue: string;
16
- }[];
17
- };
18
- type: "snackbar/openSnackbar";
19
- } | {
20
- payload: {
21
- tenantId: string | undefined;
22
- };
23
- type: "creditAgentView/scheduleTenantCreditScoreCronSuccess";
24
- } | {
25
- payload: {
26
- tenantId: string | undefined;
27
- error: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
28
- };
29
- type: "creditAgentView/scheduleTenantCreditScoreCronFailure";
30
- }>;
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.scheduleTenantCreditScoreCronEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
7
- const responsePayload_1 = require("../../../responsePayload");
8
- const creditAgentViewReducer_1 = require("../creditAgentViewReducer");
9
- const scheduleTenantCreditScoreCronEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(creditAgentViewReducer_1.scheduleTenantCreditScoreCron.match), (0, operators_1.mergeMap)((action) => {
10
- const { tenantId } = action.payload;
11
- const url = `${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/crons/cards/tenant-credit-score`;
12
- const body = tenantId != null ? { tenant_id: tenantId } : {};
13
- return zeniAPI.postAndGetJSON(url, body).pipe((0, operators_1.mergeMap)((response) => {
14
- if ((0, responsePayload_1.isSuccessResponse)(response)) {
15
- return (0, rxjs_1.from)([
16
- (0, creditAgentViewReducer_1.scheduleTenantCreditScoreCronSuccess)(tenantId),
17
- (0, snackbarReducer_1.openSnackbar)({
18
- messageSection: 'credit_agent_schedule_cron',
19
- messageText: 'success',
20
- type: 'success',
21
- }),
22
- ]);
23
- }
24
- else {
25
- return (0, rxjs_1.from)([
26
- (0, creditAgentViewReducer_1.scheduleTenantCreditScoreCronFailure)(tenantId, response.status),
27
- (0, snackbarReducer_1.openSnackbar)({
28
- messageSection: 'credit_agent_schedule_cron',
29
- messageText: 'failed',
30
- type: 'error',
31
- }),
32
- ]);
33
- }
34
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
35
- (0, creditAgentViewReducer_1.scheduleTenantCreditScoreCronFailure)(tenantId, (0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'REST API call errored out: ' + JSON.stringify(error))),
36
- (0, snackbarReducer_1.openSnackbar)({
37
- messageSection: 'credit_agent_schedule_cron',
38
- messageText: 'failed',
39
- type: 'error',
40
- }),
41
- ])));
42
- }));
43
- exports.scheduleTenantCreditScoreCronEpic = scheduleTenantCreditScoreCronEpic;
@@ -1,37 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { updateCreditAgentRow } from '../../../entity/creditAgent/creditAgentReducer';
3
- import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
4
- import { RootState } from '../../../reducer';
5
- import { ZeniAPI } from '../../../zeniAPI';
6
- import { updateCardProfile, updateCardProfileFailure, updateCardProfileSuccess } from '../creditAgentViewReducer';
7
- export type ActionType = ReturnType<typeof updateCardProfile> | ReturnType<typeof updateCardProfileSuccess> | ReturnType<typeof updateCardProfileFailure> | ReturnType<typeof updateCreditAgentRow> | ReturnType<typeof openSnackbar>;
8
- export declare const updateCardProfileEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
9
- payload: {
10
- messageSection: import("../../..").SnackbarMessageSections;
11
- messageText: import("../../..").SnackbarMessageSectionTexts;
12
- type: import("../../..").SnackbarMessageType;
13
- showStatusIcon?: boolean;
14
- variables?: {
15
- variableName: string;
16
- variableValue: string;
17
- }[];
18
- };
19
- type: "snackbar/openSnackbar";
20
- } | {
21
- payload: {
22
- tenantId: string;
23
- };
24
- type: "creditAgentView/updateCardProfileSuccess";
25
- } | {
26
- payload: {
27
- tenantId: string;
28
- error: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
29
- };
30
- type: "creditAgentView/updateCardProfileFailure";
31
- } | {
32
- payload: {
33
- payload: import("../creditAgentViewPayload").CardTenantProfileRowPayload;
34
- tenantId: string;
35
- };
36
- type: "creditAgent/updateCreditAgentRow";
37
- }>;
@@ -1,66 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateCardProfileEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const creditAgentReducer_1 = require("../../../entity/creditAgent/creditAgentReducer");
7
- const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
8
- const responsePayload_1 = require("../../../responsePayload");
9
- const creditAgentViewReducer_1 = require("../creditAgentViewReducer");
10
- const updateCardProfileEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(creditAgentViewReducer_1.updateCardProfile.match), (0, operators_1.mergeMap)((action) => {
11
- const { tenantId, tenantEmailDomain, update } = action.payload;
12
- const url = `${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/cockpit/card-tenant-profiles`;
13
- const body = {
14
- tenant_namespace: tenantEmailDomain,
15
- };
16
- if (update.cardStatus != null) {
17
- body.card_status = update.cardStatus;
18
- }
19
- if (update.creditLimit != null) {
20
- body.credit_limit = update.creditLimit;
21
- }
22
- if (update.updatedByName != null) {
23
- body.updated_by_name = update.updatedByName;
24
- }
25
- if (update.reason != null && update.reason.trim() !== '') {
26
- body.reason = update.reason.trim();
27
- }
28
- return zeniAPI
29
- .putAndGetJSON(url, body)
30
- .pipe((0, operators_1.mergeMap)((response) => {
31
- if ((0, responsePayload_1.isSuccessResponse)(response) &&
32
- response.data != null &&
33
- response.data.profile != null) {
34
- return (0, rxjs_1.from)([
35
- (0, creditAgentReducer_1.updateCreditAgentRow)({
36
- payload: response.data.profile,
37
- tenantId,
38
- }),
39
- (0, creditAgentViewReducer_1.updateCardProfileSuccess)(tenantId),
40
- (0, snackbarReducer_1.openSnackbar)({
41
- messageSection: 'credit_agent_update_profile',
42
- messageText: 'success',
43
- type: 'success',
44
- }),
45
- ]);
46
- }
47
- else {
48
- return (0, rxjs_1.from)([
49
- (0, creditAgentViewReducer_1.updateCardProfileFailure)(tenantId, response.status),
50
- (0, snackbarReducer_1.openSnackbar)({
51
- messageSection: 'credit_agent_update_profile',
52
- messageText: 'failed',
53
- type: 'error',
54
- }),
55
- ]);
56
- }
57
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
58
- (0, creditAgentViewReducer_1.updateCardProfileFailure)(tenantId, (0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'REST API call errored out: ' + JSON.stringify(error))),
59
- (0, snackbarReducer_1.openSnackbar)({
60
- messageSection: 'credit_agent_update_profile',
61
- messageText: 'failed',
62
- type: 'error',
63
- }),
64
- ])));
65
- }));
66
- exports.updateCardProfileEpic = updateCardProfileEpic;