@zeniai/client-epic-state 4.12.72 → 4.12.73
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.
|
@@ -2,3 +2,4 @@ import { ID } from '../../commonStateTypes/common';
|
|
|
2
2
|
import { ChargeCardState, ChargeCard } from './chargeCard';
|
|
3
3
|
export declare function getChargeCardsByIds(chargeCardState: ChargeCardState, chargeCardIds: ID[]): ChargeCard[];
|
|
4
4
|
export declare function getChargeCardById(chargeCardState: ChargeCardState, chargeCardId: ID): ChargeCard | undefined;
|
|
5
|
+
export declare function getChargeCardsByHolderUserId(chargeCardState: ChargeCardState, userId: ID): ChargeCard[];
|
|
@@ -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.getChargeCardById = exports.getChargeCardsByIds = void 0;
|
|
6
|
+
exports.getChargeCardsByHolderUserId = exports.getChargeCardById = exports.getChargeCardsByIds = void 0;
|
|
7
7
|
const get_1 = __importDefault(require("lodash/get"));
|
|
8
8
|
function getChargeCardsByIds(chargeCardState, chargeCardIds) {
|
|
9
9
|
const chargeCards = chargeCardIds
|
|
@@ -16,3 +16,7 @@ function getChargeCardById(chargeCardState, chargeCardId) {
|
|
|
16
16
|
return (0, get_1.default)(chargeCardState.chargeCardByID, chargeCardId, undefined);
|
|
17
17
|
}
|
|
18
18
|
exports.getChargeCardById = getChargeCardById;
|
|
19
|
+
function getChargeCardsByHolderUserId(chargeCardState, userId) {
|
|
20
|
+
return Object.values(chargeCardState.chargeCardByID).filter((chargeCard) => chargeCard.cardHolderUserId === userId);
|
|
21
|
+
}
|
|
22
|
+
exports.getChargeCardsByHolderUserId = getChargeCardsByHolderUserId;
|
|
@@ -8,6 +8,7 @@ const addressViewReducer_1 = require("../../../../addressView/addressViewReducer
|
|
|
8
8
|
const cardUserOnboardingReducer_1 = require("../cardUserOnboardingReducer");
|
|
9
9
|
const userRoleSelector_1 = require("../../../../../entity/userRole/userRoleSelector");
|
|
10
10
|
const userSelector_1 = require("../../../../../entity/user/userSelector");
|
|
11
|
+
const chargeCardSelector_1 = require("../../../../../entity/chargeCard/chargeCardSelector");
|
|
11
12
|
const initializeCardUserOnboardingLocalDataEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(cardUserOnboardingReducer_1.initializeCardUserOnboardingLocalData.match), (0, operators_1.mergeMap)((action) => {
|
|
12
13
|
const { userId } = action.payload;
|
|
13
14
|
const actions = [
|
|
@@ -17,9 +18,12 @@ const initializeCardUserOnboardingLocalDataEpic = (actions$, state$) => actions$
|
|
|
17
18
|
const userRoleState = state$.value.userRoleState;
|
|
18
19
|
const user = (0, userSelector_1.getUserByUserId)(userState, userId);
|
|
19
20
|
const userRole = (0, userRoleSelector_1.getUserRoleByUserId)(userRoleState, userId);
|
|
21
|
+
const userCards = (0, chargeCardSelector_1.getChargeCardsByHolderUserId)(state$.value.chargeCardState, userId);
|
|
20
22
|
const userAddress = (userRole === null || userRole === void 0 ? void 0 : userRole.addressId) != null
|
|
21
23
|
? (0, addressSelector_1.getAddressByAddressId)(state$.value.addressState, userRole.addressId)
|
|
22
|
-
:
|
|
24
|
+
: userCards.length > 0
|
|
25
|
+
? (0, addressSelector_1.getAddressByAddressId)(state$.value.addressState, userCards[0].billingAddressId)
|
|
26
|
+
: undefined;
|
|
23
27
|
if (userAddress != null) {
|
|
24
28
|
actions.push((0, addressViewReducer_1.newAddressInLocalStore)({
|
|
25
29
|
addressType: 'user_address',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.12.
|
|
3
|
+
"version": "4.12.73",
|
|
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
|
"types": "lib/index.d.ts",
|