@zeniai/client-epic-state 5.0.65-betaRR5 → 5.0.65-betaRR7
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.
- package/lib/entity/aiCfo/aiCfoPayload.d.ts +67 -64
- package/lib/entity/aiCfo/aiCfoReducer.d.ts +7 -1
- package/lib/entity/aiCfo/aiCfoReducer.js +87 -56
- package/lib/entity/aiCfo/aiCfoState.d.ts +58 -59
- package/lib/entity/cardPolicy/cardPolicyPayload.d.ts +106 -5
- package/lib/entity/cardPolicy/cardPolicyPayload.js +35 -4
- package/lib/entity/cardPolicy/cardPolicyReducer.d.ts +9 -3
- package/lib/entity/cardPolicy/cardPolicyReducer.js +57 -4
- package/lib/entity/cardPolicy/cardPolicySelector.d.ts +4 -0
- package/lib/entity/cardPolicy/cardPolicySelector.js +17 -0
- package/lib/entity/cardPolicy/cardPolicyState.d.ts +33 -0
- package/lib/entity/cardPolicy/policyDocumentExtractionToRecommendationBridgeEpic.d.ts +25 -0
- package/lib/entity/cardPolicy/policyDocumentExtractionToRecommendationBridgeEpic.js +39 -0
- package/lib/entity/cardPolicy/policyRecommendationFromUploadEpic.d.ts +23 -0
- package/lib/entity/cardPolicy/policyRecommendationFromUploadEpic.js +92 -0
- package/lib/epic.d.ts +3 -1
- package/lib/epic.js +3 -1
- package/lib/esm/entity/aiCfo/aiCfoReducer.js +86 -55
- package/lib/esm/entity/cardPolicy/cardPolicyPayload.js +32 -3
- package/lib/esm/entity/cardPolicy/cardPolicyReducer.js +56 -3
- package/lib/esm/entity/cardPolicy/cardPolicySelector.js +13 -0
- package/lib/esm/entity/cardPolicy/policyDocumentExtractionToRecommendationBridgeEpic.js +35 -0
- package/lib/esm/entity/cardPolicy/policyRecommendationFromUploadEpic.js +88 -0
- package/lib/esm/epic.js +4 -2
- package/lib/esm/index.js +10 -9
- package/lib/esm/view/aiCfoView/aiCfoViewReducer.js +6 -3
- package/lib/esm/view/aiCfoView/epics/createSessionAndSubmitEpic.js +5 -2
- package/lib/esm/view/aiCfoView/epics/createSessionEpic.js +2 -1
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.js +22 -13
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.js +26 -1
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.js +27 -8
- package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +25 -0
- package/lib/index.d.ts +10 -10
- package/lib/index.js +29 -15
- package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +4 -2
- package/lib/view/aiCfoView/aiCfoViewReducer.js +6 -3
- package/lib/view/aiCfoView/epics/createSessionAndSubmitEpic.js +5 -2
- package/lib/view/aiCfoView/epics/createSessionEpic.js +2 -1
- package/lib/view/companyHealthMetricView/companyHealthMetricViewSelector.d.ts +1 -1
- package/lib/view/onboardingView/cockpitView/types/onboardingCockpitViewTypes.d.ts +1 -1
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.d.ts +4 -3
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.js +23 -14
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.d.ts +22 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.js +28 -1
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.d.ts +29 -8
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.d.ts +20 -3
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.js +27 -8
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.d.ts +14 -0
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +27 -1
- package/package.json +1 -1
|
@@ -1,24 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.createCardPolicyTemplatesEpic = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const cardPolicyReducer_1 = require("../../../../../entity/cardPolicy/cardPolicyReducer");
|
|
7
7
|
const cardPolicyPayload_1 = require("../../../../../entity/cardPolicy/cardPolicyPayload");
|
|
8
8
|
const responsePayload_1 = require("../../../../../responsePayload");
|
|
9
9
|
const createCardPolicyReducer_1 = require("./createCardPolicyReducer");
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
/**
|
|
11
|
+
* `POST /cards/1.0/policy-templates` (bulk). Builds the bulk wire body
|
|
12
|
+
* from the camelCased action payload, sends one round-trip, and on
|
|
13
|
+
* success fans out:
|
|
14
|
+
* - one `updateCreatedCardPolicyTemplate` on the entity slice per row
|
|
15
|
+
* in `templates_created` (so the entity store is hydrated with every
|
|
16
|
+
* created template), and
|
|
17
|
+
* - one `updateCreateCardPolicyTemplateRequestState` with the ordered
|
|
18
|
+
* id list + per-item errors so the view can render partial-success
|
|
19
|
+
* UX without re-touching the wire types.
|
|
20
|
+
*
|
|
21
|
+
* Partial success (`errors.length > 0` with at least one template
|
|
22
|
+
* created) is still treated as `Completed` — the lifecycle is binary
|
|
23
|
+
* and the per-item errors live on the slice for the UI to inspect.
|
|
24
|
+
* Hard failures (non-success `status` or thrown errors) map to `Error`
|
|
25
|
+
* the same way they did pre-bulk.
|
|
26
|
+
*/
|
|
27
|
+
const createCardPolicyTemplatesEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(createCardPolicyReducer_1.createCardPolicyTemplates.match), (0, operators_1.mergeMap)((action) => {
|
|
28
|
+
const body = (0, cardPolicyPayload_1.toCreateCardPolicyTemplatesRequestBody)(action.payload);
|
|
12
29
|
return zeniAPI
|
|
13
30
|
.postAndGetJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/policy-templates`, body)
|
|
14
31
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
15
32
|
if ((0, responsePayload_1.isSuccessStatus)(response) && response.data != null) {
|
|
16
|
-
const {
|
|
33
|
+
const { templates_created, errors } = response.data;
|
|
34
|
+
const createdTemplates = templates_created.map((row) => row.template);
|
|
17
35
|
const actions = [
|
|
18
|
-
(0, cardPolicyReducer_1.updateCreatedCardPolicyTemplate)(template),
|
|
36
|
+
...createdTemplates.map((template) => (0, cardPolicyReducer_1.updateCreatedCardPolicyTemplate)(template)),
|
|
19
37
|
(0, createCardPolicyReducer_1.updateCreateCardPolicyTemplateRequestState)({
|
|
20
38
|
fetchState: 'Completed',
|
|
21
|
-
|
|
39
|
+
perItemErrors: (errors ?? []).map(cardPolicyPayload_1.toBulkCreateCardPolicyTemplateError),
|
|
40
|
+
templateIds: createdTemplates.map((template) => template.template_id),
|
|
22
41
|
}),
|
|
23
42
|
];
|
|
24
43
|
return (0, rxjs_1.from)(actions);
|
|
@@ -31,8 +50,8 @@ const createCardPolicyTemplateEpic = (actions$, _state$, zeniAPI) => actions$.pi
|
|
|
31
50
|
}
|
|
32
51
|
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, createCardPolicyReducer_1.updateCreateCardPolicyTemplateRequestState)({
|
|
33
52
|
fetchState: 'Error',
|
|
34
|
-
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Create card-policy
|
|
53
|
+
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Create card-policy templates REST API call errored out' +
|
|
35
54
|
JSON.stringify(error)),
|
|
36
55
|
}))));
|
|
37
56
|
}));
|
|
38
|
-
exports.
|
|
57
|
+
exports.createCardPolicyTemplatesEpic = createCardPolicyTemplatesEpic;
|
|
@@ -61,7 +61,7 @@ export declare const initialCreditAcc: CreditAccount;
|
|
|
61
61
|
export declare const initialDebitCardSummaries: DebitCardSummaries;
|
|
62
62
|
export declare const initialResendRevokeCardInvite: ResendRevokeCardInvite;
|
|
63
63
|
export declare const initialCreditAccountRepayment: CreditAccountRepayment;
|
|
64
|
-
export declare const toChargeCardSortKeyType: (v: string) => "status" | "department" | "
|
|
64
|
+
export declare const toChargeCardSortKeyType: (v: string) => "status" | "department" | "accountType" | "owner" | "cardName" | "limit" | "cardType" | "utilisation";
|
|
65
65
|
export declare type ChargeCardViewSortKey = ReturnType<typeof toChargeCardSortKeyType>;
|
|
66
66
|
export declare const ALL_CASHBACK_SORT_KEYS: readonly ["month", "cashback"];
|
|
67
67
|
export declare const toCashbackSortKeyType: (v: string) => "month" | "cashback";
|
|
@@ -54,7 +54,21 @@ export interface MyPendingActivationChargeCardListSelectorView extends SelectorV
|
|
|
54
54
|
export interface ChargeCardListWithShippingAddressSelectorView extends SelectorView {
|
|
55
55
|
cards: ChargeCardWithUserAndShippingAddress[];
|
|
56
56
|
}
|
|
57
|
+
export interface AllChargeCardsWithUserSelectorView extends SelectorView {
|
|
58
|
+
cards: ChargeCardWithUser[];
|
|
59
|
+
}
|
|
57
60
|
export declare const getChargeCardListView: (state: RootState, includeCreditAccountDebitSummaryAndCashbackInfo: boolean, isDebitCardEnabled: boolean, isCreditCardEnabled: boolean) => ChargeCardListSelectorView;
|
|
61
|
+
/**
|
|
62
|
+
* Returns every enriched `ChargeCardWithUser` for the tenant, without
|
|
63
|
+
* applying the cards-list screen's `searchText` filter or its column
|
|
64
|
+
* `sortKey/sortOrder`. Used by surfaces that need the raw card universe
|
|
65
|
+
* decoupled from whatever the user has typed/sorted on the cards list
|
|
66
|
+
* (e.g. the Card Policy "Apply to Cards" picker, which owns its own
|
|
67
|
+
* search + sort UI). The list-screen's filter/sort state is intentionally
|
|
68
|
+
* left untouched so revisits to the cards list still restore the user's
|
|
69
|
+
* search.
|
|
70
|
+
*/
|
|
71
|
+
export declare const getAllChargeCardsWithUser: (state: RootState) => AllChargeCardsWithUserSelectorView;
|
|
58
72
|
export declare const getMyPendingActivationChargeCardListView: (state: RootState) => MyPendingActivationChargeCardListSelectorView;
|
|
59
73
|
export declare const getMyRequestOnHoldChargeCardListWithShippingAddress: (state: RootState) => ChargeCardListWithShippingAddressSelectorView;
|
|
60
74
|
/**
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getChargeCardBulkActionView = exports.getChargeCardRowActionView = exports.getChargeCardRecurringExpensesByCardIds = exports.getDebitCardSummary = exports.getDebitCardList = exports.getDepositAccountListWithDebitCardIssued = exports.getCreditAccountDetails = exports.anyCardOnHold = exports.getMyRequestOnHoldChargeCardListWithShippingAddress = exports.getMyPendingActivationChargeCardListView = exports.getChargeCardListView = void 0;
|
|
6
|
+
exports.getChargeCardBulkActionView = exports.getChargeCardRowActionView = exports.getChargeCardRecurringExpensesByCardIds = exports.getDebitCardSummary = exports.getDebitCardList = exports.getDepositAccountListWithDebitCardIssued = exports.getCreditAccountDetails = exports.anyCardOnHold = exports.getMyRequestOnHoldChargeCardListWithShippingAddress = exports.getMyPendingActivationChargeCardListView = exports.getAllChargeCardsWithUser = exports.getChargeCardListView = void 0;
|
|
7
7
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
8
8
|
const orderBy_1 = __importDefault(require("lodash/orderBy"));
|
|
9
9
|
const sortOrderPayload_1 = require("../../../../commonPayloadTypes/sortOrderPayload");
|
|
@@ -94,6 +94,32 @@ const getChargeCardListView = (state, includeCreditAccountDebitSummaryAndCashbac
|
|
|
94
94
|
};
|
|
95
95
|
};
|
|
96
96
|
exports.getChargeCardListView = getChargeCardListView;
|
|
97
|
+
/**
|
|
98
|
+
* Returns every enriched `ChargeCardWithUser` for the tenant, without
|
|
99
|
+
* applying the cards-list screen's `searchText` filter or its column
|
|
100
|
+
* `sortKey/sortOrder`. Used by surfaces that need the raw card universe
|
|
101
|
+
* decoupled from whatever the user has typed/sorted on the cards list
|
|
102
|
+
* (e.g. the Card Policy "Apply to Cards" picker, which owns its own
|
|
103
|
+
* search + sort UI). The list-screen's filter/sort state is intentionally
|
|
104
|
+
* left untouched so revisits to the cards list still restore the user's
|
|
105
|
+
* search.
|
|
106
|
+
*/
|
|
107
|
+
const getAllChargeCardsWithUser = (state) => {
|
|
108
|
+
const { chargeCardListState, chargeCardState, chargeCardConfigState } = state;
|
|
109
|
+
const cards = (0, chargeCardSelector_1.getChargeCardsByIds)(chargeCardState, chargeCardListState.cardIds);
|
|
110
|
+
const chargeCardsWithUser = getChargeCardsWithUser(cards, state);
|
|
111
|
+
const fetchState = (0, reduceFetchState_1.reduceFetchState)([
|
|
112
|
+
chargeCardListState,
|
|
113
|
+
chargeCardConfigState,
|
|
114
|
+
]).fetchState;
|
|
115
|
+
return {
|
|
116
|
+
fetchState,
|
|
117
|
+
error: chargeCardListState.error,
|
|
118
|
+
cards: chargeCardsWithUser,
|
|
119
|
+
version: '1.0',
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
exports.getAllChargeCardsWithUser = getAllChargeCardsWithUser;
|
|
97
123
|
const getMyPendingActivationChargeCardListView = (state) => {
|
|
98
124
|
const { tenantState, chargeCardListState, chargeCardState } = state;
|
|
99
125
|
const cards = (0, chargeCardSelector_1.getChargeCardsByIds)(chargeCardState, chargeCardListState.cardIds);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.0.65-
|
|
3
|
+
"version": "5.0.65-betaRR7",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/esm/index.js",
|