@zeniai/client-epic-state 5.0.65-betaRR6 → 5.0.65

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 (106) hide show
  1. package/lib/common/aiCfo/aiCfoSuggestedQuestionsPageContext.d.ts +1 -1
  2. package/lib/entity/aiCfo/aiCfoPayload.d.ts +1 -168
  3. package/lib/entity/aiCfo/aiCfoReducer.js +2 -186
  4. package/lib/entity/aiCfo/aiCfoState.d.ts +4 -164
  5. package/lib/entity/aiCfo/aiCfoState.js +1 -10
  6. package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +1 -1
  7. package/lib/entity/monthEndCloseChecks/monthEndCloseChecksState.d.ts +1 -1
  8. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  9. package/lib/entity/snackbar/snackbarTypes.js +0 -2
  10. package/lib/entity/tenant/clearAllEpic.d.ts +2 -6
  11. package/lib/entity/tenant/clearAllEpic.js +0 -8
  12. package/lib/epic.d.ts +1 -9
  13. package/lib/epic.js +1 -9
  14. package/lib/esm/entity/aiCfo/aiCfoReducer.js +3 -187
  15. package/lib/esm/entity/aiCfo/aiCfoState.js +0 -7
  16. package/lib/esm/entity/snackbar/snackbarTypes.js +0 -2
  17. package/lib/esm/entity/tenant/clearAllEpic.js +0 -8
  18. package/lib/esm/epic.js +1 -9
  19. package/lib/esm/index.js +3 -17
  20. package/lib/esm/reducer.js +0 -12
  21. package/lib/esm/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +2 -12
  22. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +0 -25
  23. package/lib/index.d.ts +3 -16
  24. package/lib/index.js +11 -99
  25. package/lib/reducer.d.ts +0 -12
  26. package/lib/reducer.js +0 -12
  27. package/lib/tsconfig.typecheck.tsbuildinfo +1 -0
  28. package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +0 -7
  29. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.d.ts +1 -8
  30. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +2 -12
  31. package/lib/view/companyHealthMetricView/companyHealthMetricViewSelector.d.ts +1 -1
  32. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  33. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +1 -1
  34. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +2 -2
  35. package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +1 -1
  36. package/lib/view/onboardingView/cockpitView/types/onboardingCockpitViewTypes.d.ts +1 -1
  37. package/lib/view/people/peopleTypes.d.ts +1 -1
  38. package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
  39. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
  40. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.d.ts +0 -14
  41. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +1 -27
  42. package/lib/view/taskManager/taskListView/taskListReducer.d.ts +1 -1
  43. package/package.json +1 -1
  44. package/lib/entity/cardPolicy/cardPolicyPayload.d.ts +0 -176
  45. package/lib/entity/cardPolicy/cardPolicyPayload.js +0 -112
  46. package/lib/entity/cardPolicy/cardPolicyReducer.d.ts +0 -13
  47. package/lib/entity/cardPolicy/cardPolicyReducer.js +0 -203
  48. package/lib/entity/cardPolicy/cardPolicySelector.d.ts +0 -28
  49. package/lib/entity/cardPolicy/cardPolicySelector.js +0 -86
  50. package/lib/entity/cardPolicy/cardPolicyState.d.ts +0 -172
  51. package/lib/entity/cardPolicy/cardPolicyState.js +0 -14
  52. package/lib/entity/cardPolicy/extractPolicyDocumentEpic.d.ts +0 -18
  53. package/lib/entity/cardPolicy/extractPolicyDocumentEpic.js +0 -54
  54. package/lib/entity/cardPolicy/fetchCardPolicyVendorOptionsEpic.d.ts +0 -26
  55. package/lib/entity/cardPolicy/fetchCardPolicyVendorOptionsEpic.js +0 -47
  56. package/lib/esm/entity/cardPolicy/cardPolicyPayload.js +0 -101
  57. package/lib/esm/entity/cardPolicy/cardPolicyReducer.js +0 -199
  58. package/lib/esm/entity/cardPolicy/cardPolicySelector.js +0 -66
  59. package/lib/esm/entity/cardPolicy/cardPolicyState.js +0 -9
  60. package/lib/esm/entity/cardPolicy/extractPolicyDocumentEpic.js +0 -50
  61. package/lib/esm/entity/cardPolicy/fetchCardPolicyVendorOptionsEpic.js +0 -43
  62. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.js +0 -70
  63. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.js +0 -22
  64. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.js +0 -1
  65. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.js +0 -56
  66. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.js +0 -49
  67. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.js +0 -42
  68. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.js +0 -72
  69. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.js +0 -21
  70. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.js +0 -1
  71. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.js +0 -56
  72. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.js +0 -50
  73. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.js +0 -6
  74. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.js +0 -1
  75. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.js +0 -34
  76. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.js +0 -25
  77. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.d.ts +0 -14
  78. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.js +0 -74
  79. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.d.ts +0 -21
  80. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.js +0 -28
  81. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.d.ts +0 -25
  82. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.js +0 -2
  83. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.d.ts +0 -19
  84. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.js +0 -60
  85. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.d.ts +0 -18
  86. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.js +0 -53
  87. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.d.ts +0 -16
  88. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.js +0 -46
  89. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.d.ts +0 -15
  90. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.js +0 -76
  91. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.d.ts +0 -21
  92. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.js +0 -27
  93. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.d.ts +0 -19
  94. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.js +0 -2
  95. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.d.ts +0 -19
  96. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.js +0 -60
  97. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.d.ts +0 -12
  98. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.js +0 -54
  99. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.d.ts +0 -4
  100. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.js +0 -10
  101. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.d.ts +0 -15
  102. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.js +0 -2
  103. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.d.ts +0 -8
  104. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.js +0 -38
  105. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.d.ts +0 -15
  106. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.js +0 -29
@@ -1,203 +0,0 @@
1
- "use strict";
2
- var _a;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.clearCardPolicy = exports.clearPolicyDocumentExtraction = exports.updatePolicyDocumentExtractionFailure = exports.updatePolicyDocumentExtractionSuccess = exports.extractPolicyDocument = exports.updateCardPolicyStats = exports.removeCardPolicyTemplate = exports.updateCardPolicyTemplates = exports.updateCreatedCardPolicyTemplate = exports.updateCardPolicyVendorOptionsFailure = exports.updateCardPolicyVendorOptions = exports.updateCardPolicyMccCategoriesFailure = exports.updateCardPolicyMccCategories = exports.fetchCardPolicyVendorOptions = exports.fetchCardPolicyMccCategories = exports.initialState = void 0;
5
- const toolkit_1 = require("@reduxjs/toolkit");
6
- const cardPolicyPayload_1 = require("./cardPolicyPayload");
7
- /**
8
- * Defensive predicate for vendor / merchant names that flow into
9
- * `buildVendorChipId(name)` (in `@zeniai/web-components`). That helper
10
- * calls `name.trim().toLowerCase()`, so a null / undefined / whitespace-
11
- * only value would throw at render time, and an empty string would
12
- * collapse every nameless row into a single colliding `vendor-` chip-id.
13
- * Used at the redux ingestion boundary for both the vendor-search results
14
- * and the BE-suggested merchant seed arrays.
15
- */
16
- const isUsableMerchantName = (name) => typeof name === 'string' && name.trim() !== '';
17
- const initialPolicyDocumentExtractionState = {
18
- fetchState: 'Not-Started',
19
- error: undefined,
20
- extractedRules: undefined,
21
- uploadedFileName: undefined,
22
- };
23
- const initialVendorSearchState = {
24
- fetchState: 'Not-Started',
25
- searchString: '',
26
- vendors: [],
27
- error: undefined,
28
- };
29
- exports.initialState = {
30
- cardPolicyTemplateById: {},
31
- mccCategories: [],
32
- mccCategoriesError: undefined,
33
- mccCategoriesFetchState: 'Not-Started',
34
- policyDocumentExtraction: initialPolicyDocumentExtractionState,
35
- suggestedAllowCategories: [],
36
- suggestedAllowMerchants: [],
37
- suggestedBlockCategories: [],
38
- suggestedBlockMerchants: [],
39
- vendorSearch: initialVendorSearchState,
40
- cardPolicyStats: undefined,
41
- };
42
- const cardPolicy = (0, toolkit_1.createSlice)({
43
- name: 'cardPolicy',
44
- initialState: exports.initialState,
45
- reducers: {
46
- fetchCardPolicyMccCategories(draft) {
47
- draft.mccCategoriesFetchState = 'In-Progress';
48
- draft.mccCategoriesError = undefined;
49
- },
50
- updateCardPolicyMccCategories(draft, action) {
51
- draft.mccCategories = (action.payload.categories ?? []).map(cardPolicyPayload_1.toMccCategory);
52
- // Persist BE-suggested allow / block seeds alongside the universe.
53
- // Both flows (manual create page + AI CFO interactive form) read
54
- // these to pre-populate the chip cloud body before the user edits.
55
- // Drop empty / nullish merchant names defensively — they feed
56
- // `buildVendorChipId(name)` (in @zeniai/web-components) which calls
57
- // `.trim().toLowerCase()` and would crash the chip-picker render
58
- // path if any entry slipped through as undefined / "".
59
- draft.suggestedAllowMerchants = (action.payload.suggested_allow_merchants ?? []).filter(isUsableMerchantName);
60
- draft.suggestedBlockMerchants = (action.payload.suggested_block_merchants ?? []).filter(isUsableMerchantName);
61
- draft.suggestedAllowCategories = (action.payload.suggested_allow_catagories ?? []).map(cardPolicyPayload_1.toMccCategory);
62
- draft.suggestedBlockCategories = (action.payload.suggested_block_catagories ?? []).map(cardPolicyPayload_1.toMccCategory);
63
- draft.mccCategoriesFetchState = 'Completed';
64
- draft.mccCategoriesError = undefined;
65
- },
66
- updateCardPolicyMccCategoriesFailure(draft, action) {
67
- draft.mccCategoriesFetchState = 'Error';
68
- draft.mccCategoriesError = action.payload;
69
- },
70
- /**
71
- * Store a newly-created (or refreshed) card-policy template keyed by
72
- * `templateId`. Dispatched by the create / list / get epics; consumed
73
- * by both manual and AI-CFO policy flows via `getCardPolicyTemplateById`.
74
- */
75
- updateCreatedCardPolicyTemplate(draft, action) {
76
- const template = (0, cardPolicyPayload_1.toCardPolicyTemplate)(action.payload);
77
- draft.cardPolicyTemplateById[template.templateId] = template;
78
- },
79
- /**
80
- * Replace the entity store's `cardPolicyTemplateById` map with the
81
- * full list returned by the templates-list endpoint. Full replace is
82
- * intentional — templates that no longer exist on the server should be
83
- * dropped from local state too. The view slice keeps the server-order
84
- * ID list separately for stable list rendering.
85
- */
86
- updateCardPolicyTemplates(draft, action) {
87
- const byId = {};
88
- for (const template of action.payload) {
89
- byId[template.templateId] = template;
90
- }
91
- draft.cardPolicyTemplateById = byId;
92
- },
93
- /**
94
- * Drop a single template from the entity map. Dispatched by the
95
- * archive (DELETE) epic on success; also usable by any future flow
96
- * that needs to evict a template (e.g. AI-CFO rejection).
97
- */
98
- removeCardPolicyTemplate(draft, action) {
99
- delete draft.cardPolicyTemplateById[action.payload];
100
- },
101
- /**
102
- * Replace the tenant-wide policy stats. Dispatched alongside
103
- * `updateCardPolicyTemplates` from the list epic, but lives on the
104
- * entity slice so any consumer can read it without re-fetching the
105
- * list.
106
- */
107
- updateCardPolicyStats(draft, action) {
108
- draft.cardPolicyStats = action.payload;
109
- },
110
- /**
111
- * Kick off the `POST /cards/1.0/policy-documents/extract` request.
112
- *
113
- * Synchronously flips the sub-slice to `In-Progress` and captures the
114
- * first uploaded file's name (used by the manual `CardPolicyCreatePage`
115
- * to render the "Policy.pdf ×" pill once the request completes) so
116
- * downstream callers don't have to keep their own file refs.
117
- *
118
- * The accompanying `extractPolicyDocumentEpic` listens for this action,
119
- * POSTs multipart form-data to the cards micro-service, and dispatches
120
- * either `updatePolicyDocumentExtractionSuccess` or
121
- * `updatePolicyDocumentExtractionFailure`.
122
- *
123
- * Designed to be dispatched from both the manual create page and a
124
- * future AI CFO composer/upload surface — selectors return a single
125
- * source of truth.
126
- */
127
- extractPolicyDocument: {
128
- reducer(draft, action) {
129
- draft.policyDocumentExtraction.fetchState = 'In-Progress';
130
- draft.policyDocumentExtraction.error = undefined;
131
- draft.policyDocumentExtraction.extractedRules = undefined;
132
- draft.policyDocumentExtraction.uploadedFileName =
133
- action.meta.uploadedFileName;
134
- },
135
- prepare(files) {
136
- return {
137
- payload: { files },
138
- meta: { uploadedFileName: files[0]?.name },
139
- };
140
- },
141
- },
142
- updatePolicyDocumentExtractionSuccess(draft, action) {
143
- draft.policyDocumentExtraction.fetchState = 'Completed';
144
- draft.policyDocumentExtraction.error = undefined;
145
- draft.policyDocumentExtraction.extractedRules =
146
- (0, cardPolicyPayload_1.toExtractedCardPolicyRules)(action.payload);
147
- },
148
- updatePolicyDocumentExtractionFailure(draft, action) {
149
- draft.policyDocumentExtraction.fetchState = 'Error';
150
- draft.policyDocumentExtraction.error = action.payload;
151
- draft.policyDocumentExtraction.extractedRules = undefined;
152
- },
153
- clearPolicyDocumentExtraction(draft) {
154
- draft.policyDocumentExtraction = {
155
- ...initialPolicyDocumentExtractionState,
156
- };
157
- },
158
- /**
159
- * Kick off `GET /accounting/1.0/vendors` (card-policy mode). When
160
- * `searchString` is empty the BE returns the top vendors sorted by
161
- * year-to-date spend; with a non-empty value it filters server-side.
162
- *
163
- * The accompanying `fetchCardPolicyVendorOptionsEpic` listens for
164
- * this action, builds the `query` JSON (matching `fetchVendorsList`'s
165
- * `view: "vendor_list"` shape) and dispatches success / failure.
166
- *
167
- * Designed to be dispatched from both the manual `CardPolicyCreate /
168
- * EditScreen` (on mount + on every chip-picker keystroke, debounced)
169
- * and the AI CFO interactive form's vendor step.
170
- */
171
- fetchCardPolicyVendorOptions: {
172
- reducer(draft, action) {
173
- draft.vendorSearch.fetchState = 'In-Progress';
174
- draft.vendorSearch.searchString = action.payload.searchString;
175
- draft.vendorSearch.error = undefined;
176
- },
177
- prepare(searchString) {
178
- return { payload: { searchString: searchString ?? '' } };
179
- },
180
- },
181
- updateCardPolicyVendorOptions(draft, action) {
182
- // Drop rows with no usable name. The chip-picker keys vendors by
183
- // `buildVendorChipId(name)` (in @zeniai/web-components), which calls
184
- // `name.trim().toLowerCase()`. A null / undefined / whitespace-only
185
- // name would either throw at render time or collapse every nameless
186
- // row into a single colliding `vendor-` chip-id.
187
- draft.vendorSearch.vendors = (action.payload.vendors ?? [])
188
- .map(cardPolicyPayload_1.toCardPolicyVendorSearchOption)
189
- .filter((vendor) => isUsableMerchantName(vendor.name));
190
- draft.vendorSearch.fetchState = 'Completed';
191
- draft.vendorSearch.error = undefined;
192
- },
193
- updateCardPolicyVendorOptionsFailure(draft, action) {
194
- draft.vendorSearch.fetchState = 'Error';
195
- draft.vendorSearch.error = action.payload;
196
- },
197
- clearCardPolicy(draft) {
198
- Object.assign(draft, exports.initialState);
199
- },
200
- },
201
- });
202
- _a = cardPolicy.actions, exports.fetchCardPolicyMccCategories = _a.fetchCardPolicyMccCategories, exports.fetchCardPolicyVendorOptions = _a.fetchCardPolicyVendorOptions, exports.updateCardPolicyMccCategories = _a.updateCardPolicyMccCategories, exports.updateCardPolicyMccCategoriesFailure = _a.updateCardPolicyMccCategoriesFailure, exports.updateCardPolicyVendorOptions = _a.updateCardPolicyVendorOptions, exports.updateCardPolicyVendorOptionsFailure = _a.updateCardPolicyVendorOptionsFailure, exports.updateCreatedCardPolicyTemplate = _a.updateCreatedCardPolicyTemplate, exports.updateCardPolicyTemplates = _a.updateCardPolicyTemplates, exports.removeCardPolicyTemplate = _a.removeCardPolicyTemplate, exports.updateCardPolicyStats = _a.updateCardPolicyStats, exports.extractPolicyDocument = _a.extractPolicyDocument, exports.updatePolicyDocumentExtractionSuccess = _a.updatePolicyDocumentExtractionSuccess, exports.updatePolicyDocumentExtractionFailure = _a.updatePolicyDocumentExtractionFailure, exports.clearPolicyDocumentExtraction = _a.clearPolicyDocumentExtraction, exports.clearCardPolicy = _a.clearCardPolicy;
203
- exports.default = cardPolicy.reducer;
@@ -1,28 +0,0 @@
1
- import { FetchState, ID } from '../../commonStateTypes/common';
2
- import { ZeniAPIStatus } from '../../responsePayload';
3
- import { CardPolicyState, CardPolicyStats, CardPolicyTemplate, CardPolicyVendorSearchEntry, ExtractedCardPolicyRules, MccCategory } from './cardPolicyState';
4
- export declare function getCardPolicyMccCategories(state: CardPolicyState): MccCategory[];
5
- export declare function getCardPolicyMccCategoriesFetchState(state: CardPolicyState): FetchState;
6
- export declare function getCardPolicyMccCategoriesError(state: CardPolicyState): ZeniAPIStatus | undefined;
7
- export declare function getCardPolicyTemplateById(state: CardPolicyState, templateId: ID): CardPolicyTemplate | undefined;
8
- export declare function getAllCardPolicyTemplates(state: CardPolicyState): CardPolicyTemplate[];
9
- /**
10
- * Resolve an ordered list of `templateId`s against the entity store and
11
- * return the corresponding `CardPolicyTemplate[]` in the same order.
12
- * Missing IDs (e.g. stale local state during a refetch) are silently
13
- * dropped. Pair with `getCardPolicyTemplateIds` from the view slice to
14
- * render the Policy List page in server order.
15
- */
16
- export declare function getCardPolicyTemplatesByIds(state: CardPolicyState, templateIds: ID[]): CardPolicyTemplate[];
17
- export declare function getCardPolicyStats(state: CardPolicyState): CardPolicyStats | undefined;
18
- export declare function getPolicyDocumentExtractionFetchState(state: CardPolicyState): FetchState;
19
- export declare function getPolicyDocumentExtractionError(state: CardPolicyState): ZeniAPIStatus | undefined;
20
- export declare function getExtractedCardPolicyRules(state: CardPolicyState): ExtractedCardPolicyRules | undefined;
21
- export declare function getUploadedPolicyDocumentFileName(state: CardPolicyState): string | undefined;
22
- export declare function getCardPolicySuggestedAllowMerchants(state: CardPolicyState): string[];
23
- export declare function getCardPolicySuggestedBlockMerchants(state: CardPolicyState): string[];
24
- export declare function getCardPolicySuggestedAllowCategories(state: CardPolicyState): MccCategory[];
25
- export declare function getCardPolicySuggestedBlockCategories(state: CardPolicyState): MccCategory[];
26
- export declare function getCardPolicyVendorSearchOptions(state: CardPolicyState): CardPolicyVendorSearchEntry[];
27
- export declare function getCardPolicyVendorSearchFetchState(state: CardPolicyState): FetchState;
28
- export declare function getCardPolicyVendorSearchString(state: CardPolicyState): string;
@@ -1,86 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getCardPolicyMccCategories = getCardPolicyMccCategories;
4
- exports.getCardPolicyMccCategoriesFetchState = getCardPolicyMccCategoriesFetchState;
5
- exports.getCardPolicyMccCategoriesError = getCardPolicyMccCategoriesError;
6
- exports.getCardPolicyTemplateById = getCardPolicyTemplateById;
7
- exports.getAllCardPolicyTemplates = getAllCardPolicyTemplates;
8
- exports.getCardPolicyTemplatesByIds = getCardPolicyTemplatesByIds;
9
- exports.getCardPolicyStats = getCardPolicyStats;
10
- exports.getPolicyDocumentExtractionFetchState = getPolicyDocumentExtractionFetchState;
11
- exports.getPolicyDocumentExtractionError = getPolicyDocumentExtractionError;
12
- exports.getExtractedCardPolicyRules = getExtractedCardPolicyRules;
13
- exports.getUploadedPolicyDocumentFileName = getUploadedPolicyDocumentFileName;
14
- exports.getCardPolicySuggestedAllowMerchants = getCardPolicySuggestedAllowMerchants;
15
- exports.getCardPolicySuggestedBlockMerchants = getCardPolicySuggestedBlockMerchants;
16
- exports.getCardPolicySuggestedAllowCategories = getCardPolicySuggestedAllowCategories;
17
- exports.getCardPolicySuggestedBlockCategories = getCardPolicySuggestedBlockCategories;
18
- exports.getCardPolicyVendorSearchOptions = getCardPolicyVendorSearchOptions;
19
- exports.getCardPolicyVendorSearchFetchState = getCardPolicyVendorSearchFetchState;
20
- exports.getCardPolicyVendorSearchString = getCardPolicyVendorSearchString;
21
- function getCardPolicyMccCategories(state) {
22
- return state.mccCategories;
23
- }
24
- function getCardPolicyMccCategoriesFetchState(state) {
25
- return state.mccCategoriesFetchState;
26
- }
27
- function getCardPolicyMccCategoriesError(state) {
28
- return state.mccCategoriesError;
29
- }
30
- function getCardPolicyTemplateById(state, templateId) {
31
- return state.cardPolicyTemplateById[templateId];
32
- }
33
- function getAllCardPolicyTemplates(state) {
34
- return Object.values(state.cardPolicyTemplateById);
35
- }
36
- /**
37
- * Resolve an ordered list of `templateId`s against the entity store and
38
- * return the corresponding `CardPolicyTemplate[]` in the same order.
39
- * Missing IDs (e.g. stale local state during a refetch) are silently
40
- * dropped. Pair with `getCardPolicyTemplateIds` from the view slice to
41
- * render the Policy List page in server order.
42
- */
43
- function getCardPolicyTemplatesByIds(state, templateIds) {
44
- return templateIds
45
- .map((id) => state.cardPolicyTemplateById[id])
46
- .filter((template) => template != null);
47
- }
48
- function getCardPolicyStats(state) {
49
- return state.cardPolicyStats;
50
- }
51
- // ── Policy document extraction ───────────────────────────────────────
52
- function getPolicyDocumentExtractionFetchState(state) {
53
- return state.policyDocumentExtraction.fetchState;
54
- }
55
- function getPolicyDocumentExtractionError(state) {
56
- return state.policyDocumentExtraction.error;
57
- }
58
- function getExtractedCardPolicyRules(state) {
59
- return state.policyDocumentExtraction.extractedRules;
60
- }
61
- function getUploadedPolicyDocumentFileName(state) {
62
- return state.policyDocumentExtraction.uploadedFileName;
63
- }
64
- // ── Suggested allow / block seeds (shipped alongside MCC categories) ─
65
- function getCardPolicySuggestedAllowMerchants(state) {
66
- return state.suggestedAllowMerchants;
67
- }
68
- function getCardPolicySuggestedBlockMerchants(state) {
69
- return state.suggestedBlockMerchants;
70
- }
71
- function getCardPolicySuggestedAllowCategories(state) {
72
- return state.suggestedAllowCategories;
73
- }
74
- function getCardPolicySuggestedBlockCategories(state) {
75
- return state.suggestedBlockCategories;
76
- }
77
- // ── Vendor search dropdown ───────────────────────────────────────────
78
- function getCardPolicyVendorSearchOptions(state) {
79
- return state.vendorSearch.vendors;
80
- }
81
- function getCardPolicyVendorSearchFetchState(state) {
82
- return state.vendorSearch.fetchState;
83
- }
84
- function getCardPolicyVendorSearchString(state) {
85
- return state.vendorSearch.searchString;
86
- }
@@ -1,172 +0,0 @@
1
- import { FetchState, ID } from '../../commonStateTypes/common';
2
- import { ZeniAPIStatus } from '../../responsePayload';
3
- import { ZeniDate } from '../../zeniDayJS';
4
- /**
5
- * A category grouping merchant category codes (MCCs) used while configuring
6
- * card policies (e.g. "Apparel", "AC Refrigeration Repair"). The same data
7
- * is consumed by both the manual policy-creation flow and the AI-CFO-driven
8
- * flow.
9
- */
10
- export interface MccCategory {
11
- count: number;
12
- mccCodes: string[];
13
- name: string;
14
- }
15
- export declare const ALL_CARD_POLICY_TEMPLATE_MODES: readonly ["strict", "flexible"];
16
- export declare const toCardPolicyTemplateMode: (v: string) => "strict" | "flexible";
17
- export type CardPolicyTemplateMode = ReturnType<typeof toCardPolicyTemplateMode>;
18
- export declare const ALL_CARD_POLICY_TEMPLATE_STATUSES: readonly ["active", "inactive", "archived"];
19
- export declare const toCardPolicyTemplateStatus: (v: string) => "active" | "inactive" | "archived";
20
- export type CardPolicyTemplateStatus = ReturnType<typeof toCardPolicyTemplateStatus>;
21
- /**
22
- * Allow- / block-list pair scoped to a card-policy template. Empty arrays
23
- * mean "no restrictions on this dimension".
24
- */
25
- export interface CardPolicyTemplateEntityList {
26
- categoryCodes: string[];
27
- merchantNames: string[];
28
- }
29
- /**
30
- * Spend-limit caps configured per template. Only `transaction` is modeled
31
- * today; additional cadences (e.g. daily, monthly) will be added if/when
32
- * the backend exposes them.
33
- *
34
- * `transaction` is `number | null`: `null` means the row's toggle is off
35
- * (no limit configured), `0` means the user explicitly entered zero with
36
- * the toggle on, and any positive value is the configured per-transaction
37
- * cap.
38
- */
39
- export interface CardPolicyTemplateSpendLimits {
40
- transaction: number | null;
41
- }
42
- /**
43
- * Mapped (camelCase) representation of a card-policy template returned by
44
- * the cards micro-service. Stored on the entity slice keyed by
45
- * `templateId` so both the manual policy-creation UI and the AI-CFO flow
46
- * can read it.
47
- */
48
- export interface CardPolicyTemplate {
49
- allowedEntity: CardPolicyTemplateEntityList;
50
- appliedCards: ID[];
51
- blockedEntity: CardPolicyTemplateEntityList;
52
- cardsCount: number;
53
- categoryRestrictions: unknown[];
54
- createdAt: ZeniDate;
55
- createdBy: ID;
56
- description: string;
57
- mode: CardPolicyTemplateMode;
58
- name: string;
59
- /**
60
- * Receipt-required threshold in dollars. `null` means the toggle is off
61
- * (no receipt requirement); `0` means the user explicitly entered zero
62
- * with the toggle on; any positive value is the configured threshold.
63
- */
64
- requiredReceiptThreshold: number | null;
65
- spendLimits: CardPolicyTemplateSpendLimits;
66
- status: CardPolicyTemplateStatus;
67
- templateId: ID;
68
- tenantId: ID;
69
- updatedAt: ZeniDate;
70
- }
71
- /**
72
- * Aggregate counters returned by the list endpoint and reused across
73
- * any surface that wants to display tenant-wide policy stats without
74
- * triggering an extra fetch.
75
- */
76
- export interface CardPolicyStats {
77
- activePolicies: number;
78
- totalCards: number;
79
- totalTemplates: number;
80
- }
81
- /**
82
- * FE-side (camelCase) mirror of the wire payload
83
- * `ExtractedCardPolicyRulesPayload`. Field names align slice-wise with
84
- * `CardPolicyTemplate` (`allowedEntity`, `blockedEntity`,
85
- * `requiredReceiptThreshold`) so the pre-fill mapper consumed by both
86
- * `CardPolicyCreatePage` (manual) and `CardPolicyInteractiveForm`
87
- * (AI CFO) can read either shape uniformly.
88
- */
89
- export interface ExtractedCardPolicyRules {
90
- allowedEntity: CardPolicyTemplateEntityList;
91
- blockedEntity: CardPolicyTemplateEntityList;
92
- confidenceScore: number;
93
- policyName: string;
94
- requiredReceiptThreshold: number;
95
- transactionLimit: number;
96
- }
97
- /**
98
- * Lifecycle for the `POST /cards/1.0/policy-documents/extract` request.
99
- * Lives on the entity slice (rather than a view slice) so both the manual
100
- * `CardPolicyCreatePage` and the AI CFO `CardPolicyInteractiveForm` can
101
- * read the extracted rules from a single source of truth.
102
- *
103
- * `uploadedFileName` is captured at request-kickoff time so the UI can
104
- * render the "Policy.pdf ×" pill once the request completes without
105
- * having to keep a separate local copy of the file.
106
- */
107
- export interface PolicyDocumentExtractionState {
108
- fetchState: FetchState;
109
- error?: ZeniAPIStatus;
110
- extractedRules?: ExtractedCardPolicyRules;
111
- uploadedFileName?: string;
112
- }
113
- /**
114
- * Lightweight `{vendorId, name}` row stored on the card-policy slice for
115
- * the chip-picker's vendor search dropdown. Sourced from
116
- * `/accounting/1.0/vendors` via `fetchCardPolicyVendorOptionsEpic`.
117
- *
118
- * Intentionally a subset of the full `Vendor` entity — populating this
119
- * slice does NOT touch the global `vendor`/`account`/`vendorList`
120
- * entities, so a card-policy search session never disturbs the user's
121
- * Vendors-tab list state.
122
- */
123
- export interface CardPolicyVendorSearchEntry {
124
- name: string;
125
- vendorId: ID;
126
- }
127
- /**
128
- * Lifecycle for the `GET /accounting/1.0/vendors` (card-policy mode)
129
- * request. Only one in-flight search at a time; the latest typed search
130
- * wins (via `switchMap` in the epic). `searchString` is the text that
131
- * produced `vendors`, useful for stale-result guards in the UI.
132
- */
133
- export interface CardPolicyVendorSearchState {
134
- fetchState: FetchState;
135
- searchString: string;
136
- vendors: CardPolicyVendorSearchEntry[];
137
- error?: ZeniAPIStatus;
138
- }
139
- /**
140
- * Slice state for card-policy reference data shared across the manual and
141
- * AI-driven policy-creation flows. Each sub-resource tracks its own
142
- * `fetchState`/`error` so additional card-policy APIs can be added
143
- * alongside without coupling.
144
- */
145
- export interface CardPolicyState {
146
- cardPolicyTemplateById: Record<ID, CardPolicyTemplate>;
147
- mccCategories: MccCategory[];
148
- mccCategoriesFetchState: FetchState;
149
- policyDocumentExtraction: PolicyDocumentExtractionState;
150
- /**
151
- * MCC categories suggested by the BE as a default "Allow" seed for the
152
- * category chip cloud. Empty when the user lands without prior spend
153
- * history. See `suggested_allow_catagories` on the wire payload.
154
- */
155
- suggestedAllowCategories: MccCategory[];
156
- /**
157
- * Merchant names suggested by the BE as a default "Allow" seed for the
158
- * vendor chip cloud. Empty when the BE has no recommendation. See
159
- * `suggested_allow_merchants` on the wire payload.
160
- */
161
- suggestedAllowMerchants: string[];
162
- suggestedBlockCategories: MccCategory[];
163
- suggestedBlockMerchants: string[];
164
- /**
165
- * Server-driven vendor search results powering the chip picker's
166
- * search dropdown. Distinct from the global vendor entity store so
167
- * the card-policy flow never disturbs the user's Vendors-tab list.
168
- */
169
- vendorSearch: CardPolicyVendorSearchState;
170
- cardPolicyStats?: CardPolicyStats;
171
- mccCategoriesError?: ZeniAPIStatus;
172
- }
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toCardPolicyTemplateStatus = exports.ALL_CARD_POLICY_TEMPLATE_STATUSES = exports.toCardPolicyTemplateMode = exports.ALL_CARD_POLICY_TEMPLATE_MODES = void 0;
4
- const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
5
- exports.ALL_CARD_POLICY_TEMPLATE_MODES = ['strict', 'flexible'];
6
- const toCardPolicyTemplateMode = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_CARD_POLICY_TEMPLATE_MODES);
7
- exports.toCardPolicyTemplateMode = toCardPolicyTemplateMode;
8
- exports.ALL_CARD_POLICY_TEMPLATE_STATUSES = [
9
- 'active',
10
- 'inactive',
11
- 'archived',
12
- ];
13
- const toCardPolicyTemplateStatus = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_CARD_POLICY_TEMPLATE_STATUSES);
14
- exports.toCardPolicyTemplateStatus = toCardPolicyTemplateStatus;
@@ -1,18 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { RootState } from '../../reducer';
4
- import { ZeniAPI } from '../../zeniAPI';
5
- import { extractPolicyDocument, updatePolicyDocumentExtractionFailure, updatePolicyDocumentExtractionSuccess } from './cardPolicyReducer';
6
- export type ActionType = ReturnType<typeof extractPolicyDocument> | ReturnType<typeof updatePolicyDocumentExtractionSuccess> | ReturnType<typeof updatePolicyDocumentExtractionFailure>;
7
- /**
8
- * Listens for `extractPolicyDocument`, POSTs the file(s) as multipart
9
- * form-data to the cards micro-service's policy-document extract endpoint,
10
- * and dispatches success / failure into the entity slice.
11
- *
12
- * Consumed by:
13
- * - Manual `CardPolicyCreatePage` (read result via
14
- * `getExtractedCardPolicyRules` then pre-fill the RHF form via
15
- * `applyExtractedPolicyRulesToFormValues` from `@zeniai/web-components`).
16
- * - (Future) AI CFO upload surface — same action + selector contract.
17
- */
18
- export declare const extractPolicyDocumentEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -1,54 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.extractPolicyDocumentEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const responsePayload_1 = require("../../responsePayload");
7
- const cardPolicyReducer_1 = require("./cardPolicyReducer");
8
- /**
9
- * Build a multipart `FormData` body for `POST /cards/1.0/policy-documents/extract`.
10
- *
11
- * Uses the same `attachment_file_<i>` / `attachment_json_<i>` field-naming
12
- * convention as the charge-card receipt upload (`uploadReceipts.ts` in
13
- * `web-components`) so backends that already support that wire shape
14
- * accept this endpoint without bespoke parsing.
15
- */
16
- const buildPolicyDocumentFormData = (files) => {
17
- const data = new FormData();
18
- files.forEach((file, index) => {
19
- data.append(`attachment_file_${index}`, file);
20
- const attachmentJson = JSON.stringify({
21
- file_name: file.name,
22
- content_type: file.type,
23
- size: file.size,
24
- });
25
- data.append(`attachment_json_${index}`, attachmentJson);
26
- });
27
- return data;
28
- };
29
- /**
30
- * Listens for `extractPolicyDocument`, POSTs the file(s) as multipart
31
- * form-data to the cards micro-service's policy-document extract endpoint,
32
- * and dispatches success / failure into the entity slice.
33
- *
34
- * Consumed by:
35
- * - Manual `CardPolicyCreatePage` (read result via
36
- * `getExtractedCardPolicyRules` then pre-fill the RHF form via
37
- * `applyExtractedPolicyRulesToFormValues` from `@zeniai/web-components`).
38
- * - (Future) AI CFO upload surface — same action + selector contract.
39
- */
40
- const extractPolicyDocumentEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(cardPolicyReducer_1.extractPolicyDocument.match), (0, operators_1.mergeMap)((action) => {
41
- const formData = buildPolicyDocumentFormData(action.payload.files);
42
- return zeniAPI
43
- .postFormData(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/policy-documents/extract`, formData)
44
- .pipe((0, operators_1.mergeMap)((response) => {
45
- if ((0, responsePayload_1.isSuccessStatus)(response) &&
46
- response.data != null &&
47
- response.data.extracted_rules != null) {
48
- return (0, rxjs_1.of)((0, cardPolicyReducer_1.updatePolicyDocumentExtractionSuccess)(response.data.extracted_rules));
49
- }
50
- return (0, rxjs_1.of)((0, cardPolicyReducer_1.updatePolicyDocumentExtractionFailure)(response.status));
51
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, cardPolicyReducer_1.updatePolicyDocumentExtractionFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Extract card-policy document REST API call errored out' +
52
- JSON.stringify(error))))));
53
- }));
54
- exports.extractPolicyDocumentEpic = extractPolicyDocumentEpic;
@@ -1,26 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { RootState } from '../../reducer';
4
- import { ZeniAPI } from '../../zeniAPI';
5
- import { fetchCardPolicyVendorOptions, updateCardPolicyVendorOptions, updateCardPolicyVendorOptionsFailure } from './cardPolicyReducer';
6
- export type ActionType = ReturnType<typeof fetchCardPolicyVendorOptions> | ReturnType<typeof updateCardPolicyVendorOptions> | ReturnType<typeof updateCardPolicyVendorOptionsFailure>;
7
- /**
8
- * Card-policy vendor search.
9
- *
10
- * Listens for `fetchCardPolicyVendorOptions` and hits the same
11
- * `/accounting/1.0/vendors` endpoint the Vendors-tab uses, but writes
12
- * results onto the dedicated `cardPolicyState.vendorSearch` slice — no
13
- * fan-out to the global `vendor` / `account` / `class` / `vendorList`
14
- * entities. That isolation is important: the user may be configuring a
15
- * card policy in parallel with browsing the Vendors tab, and we don't
16
- * want either flow to clobber the other's list state.
17
- *
18
- * Uses `switchMap` so the latest typed search wins — earlier in-flight
19
- * requests are abandoned, which is the right semantics for a
20
- * search-as-you-type UX.
21
- *
22
- * Consumers:
23
- * - Manual `CardPolicyCreate / EditScreen`
24
- * - AI CFO `CardPolicyInteractiveForm` (vendor step)
25
- */
26
- export declare const fetchCardPolicyVendorOptionsEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -1,47 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchCardPolicyVendorOptionsEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const responsePayload_1 = require("../../responsePayload");
7
- const cardPolicyReducer_1 = require("./cardPolicyReducer");
8
- const buildQuery = (searchString) => ({
9
- view: 'vendor_list',
10
- page_token: null,
11
- sort_by: 'year_to_date_spend',
12
- sort_order: 'desc',
13
- search_text: searchString,
14
- vendor_name: searchString,
15
- });
16
- /**
17
- * Card-policy vendor search.
18
- *
19
- * Listens for `fetchCardPolicyVendorOptions` and hits the same
20
- * `/accounting/1.0/vendors` endpoint the Vendors-tab uses, but writes
21
- * results onto the dedicated `cardPolicyState.vendorSearch` slice — no
22
- * fan-out to the global `vendor` / `account` / `class` / `vendorList`
23
- * entities. That isolation is important: the user may be configuring a
24
- * card policy in parallel with browsing the Vendors tab, and we don't
25
- * want either flow to clobber the other's list state.
26
- *
27
- * Uses `switchMap` so the latest typed search wins — earlier in-flight
28
- * requests are abandoned, which is the right semantics for a
29
- * search-as-you-type UX.
30
- *
31
- * Consumers:
32
- * - Manual `CardPolicyCreate / EditScreen`
33
- * - AI CFO `CardPolicyInteractiveForm` (vendor step)
34
- */
35
- const fetchCardPolicyVendorOptionsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(cardPolicyReducer_1.fetchCardPolicyVendorOptions.match), (0, operators_1.switchMap)((action) => {
36
- const query = buildQuery(action.payload.searchString);
37
- const apiUrl = `${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/vendors` +
38
- `?query=${encodeURIComponent(JSON.stringify(query))}`;
39
- return zeniAPI.getJSON(apiUrl).pipe((0, operators_1.switchMap)((response) => {
40
- if ((0, responsePayload_1.isSuccessStatus)(response) && response.data != null) {
41
- return (0, rxjs_1.of)((0, cardPolicyReducer_1.updateCardPolicyVendorOptions)(response.data));
42
- }
43
- return (0, rxjs_1.of)((0, cardPolicyReducer_1.updateCardPolicyVendorOptionsFailure)(response.status));
44
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, cardPolicyReducer_1.updateCardPolicyVendorOptionsFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch card policy vendor options REST API call errored out' +
45
- JSON.stringify(error))))));
46
- }));
47
- exports.fetchCardPolicyVendorOptionsEpic = fetchCardPolicyVendorOptionsEpic;