@zeniai/client-epic-state 4.13.20 → 4.13.21

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.
@@ -4,6 +4,7 @@ exports.fetchIssueCardPageEpic = void 0;
4
4
  const rxjs_1 = require("rxjs");
5
5
  const operators_1 = require("rxjs/operators");
6
6
  const userListViewReducer_1 = require("../../../userListView/userListViewReducer");
7
+ const classListReducer_1 = require("../../../classList/classListReducer");
7
8
  const chargeCardConfigReducer_1 = require("../chargeCardConfig/chargeCardConfigReducer");
8
9
  const issueChargeCardReducer_1 = require("./issueChargeCardReducer");
9
10
  const chargeCardListReducer_1 = require("../chargeCardList/chargeCardListReducer");
@@ -16,6 +17,8 @@ const fetchIssueCardPageEpic = (actions$, state$) => actions$.pipe((0, operators
16
17
  issueCardPageAction.push((0, chargeCardListReducer_1.fetchCreditAccount)());
17
18
  issueCardPageAction.push((0, userListViewReducer_1.fetchUserListByType)('cardHolderCandidate', true));
18
19
  issueCardPageAction.push((0, userListViewReducer_1.fetchUserListByType)('cardAdmin', true));
20
+ issueCardPageAction.push((0, classListReducer_1.fetchClassList)());
21
+ issueCardPageAction.push((0, chargeCardListReducer_1.fetchChargeCardList)());
19
22
  }
20
23
  else {
21
24
  const chargeCardConfig = state.chargeCardConfigState;
@@ -28,6 +31,10 @@ const fetchIssueCardPageEpic = (actions$, state$) => actions$.pipe((0, operators
28
31
  chargeCardList.creditAccount.fetchState !== 'In-Progress') {
29
32
  issueCardPageAction.push((0, chargeCardListReducer_1.fetchCreditAccount)());
30
33
  }
34
+ if (chargeCardList.fetchState !== 'Completed' &&
35
+ chargeCardList.fetchState !== 'In-Progress') {
36
+ issueCardPageAction.push((0, chargeCardListReducer_1.fetchChargeCardList)());
37
+ }
31
38
  const userList = state.userListViewState.userListByType.cardHolderCandidate;
32
39
  if (userList.fetchState !== 'In-Progress' &&
33
40
  userList.hasValidState() === false) {
@@ -38,6 +45,11 @@ const fetchIssueCardPageEpic = (actions$, state$) => actions$.pipe((0, operators
38
45
  userAdminList.hasValidState() === false) {
39
46
  issueCardPageAction.push((0, userListViewReducer_1.fetchUserListByType)('cardAdmin', false));
40
47
  }
48
+ const classList = state.classListState;
49
+ if (classList.fetchState !== 'In-Progress' &&
50
+ classList.hasValidState() === false) {
51
+ issueCardPageAction.push((0, classListReducer_1.fetchClassList)());
52
+ }
41
53
  }
42
54
  return (0, rxjs_1.concat)((0, rxjs_1.from)(issueCardPageAction));
43
55
  }));
@@ -18,8 +18,8 @@ const issueChargeCardEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, ope
18
18
  var _a, _b, _c, _d, _e, _f, _g, _h;
19
19
  if (data.cardType === 'business_physical_credit_card') {
20
20
  return {
21
- card_holder_user_ids: data.physicalCard.userIds != null
22
- ? [data.physicalCard.userIds]
21
+ card_holder_user_ids: data.physicalCard.userId != null
22
+ ? [data.physicalCard.userId]
23
23
  : [],
24
24
  card_name: data.physicalCard.cardName,
25
25
  credit_limit: (_b = (_a = data.physicalCard.amount) === null || _a === void 0 ? void 0 : _a.amount) !== null && _b !== void 0 ? _b : 0,
@@ -4,12 +4,12 @@ exports.getIssueChargeCardView = void 0;
4
4
  const reduceFetchState_1 = require("../../../../commonStateTypes/reduceFetchState");
5
5
  const addressSelector_1 = require("../../../../entity/address/addressSelector");
6
6
  const addressViewSelector_1 = require("../../../addressView/addressViewSelector");
7
- const getCompanyView_1 = require("../../../companyView/selectorHelpers/getCompanyView");
7
+ const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
8
8
  const classSelector_1 = require("../../../../entity/class/classSelector");
9
9
  const userListViewSelector_1 = require("../../../userListView/userListViewSelector");
10
10
  const getIssueChargeCardView = (state) => {
11
- var _a, _b;
12
- const { issueChargeCardState, userState, userRoleState, userListViewState, chargeCardConfigState, chargeCardListState, tenantState, addressState, classState, classListState, } = state;
11
+ var _a;
12
+ const { issueChargeCardState, userState, userRoleState, userListViewState, chargeCardConfigState, chargeCardListState, addressState, classState, classListState, } = state;
13
13
  const userListSelectorView = (0, userListViewSelector_1.getUserList)(userState, userRoleState, userListViewState, 'cardHolderCandidate');
14
14
  const userList = userListSelectorView.users;
15
15
  let selectedUserAddress = {};
@@ -20,12 +20,9 @@ const getIssueChargeCardView = (state) => {
20
20
  selectedUserAddress = Object.assign(Object.assign({}, selectedUserAddress), { [user.userId]: userAddress });
21
21
  }
22
22
  });
23
- const { currentTenantId } = tenantState;
24
- const companyId = currentTenantId != null
25
- ? (_b = (_a = tenantState.tenantsById) === null || _a === void 0 ? void 0 : _a[currentTenantId]) === null || _b === void 0 ? void 0 : _b.companyId
26
- : '';
27
- const companyView = (0, getCompanyView_1.getCompanyView)(state, companyId, []);
28
- const companyAddress = companyView === null || companyView === void 0 ? void 0 : companyView.companyAddress;
23
+ const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
24
+ const companyAddressId = (_a = currentTenant === null || currentTenant === void 0 ? void 0 : currentTenant.company) === null || _a === void 0 ? void 0 : _a.managegmentInfo.companyAddressId;
25
+ const companyAddress = (0, addressSelector_1.getAddressByAddressId)(addressState, companyAddressId !== null && companyAddressId !== void 0 ? companyAddressId : '');
29
26
  let customAddressStatus = {};
30
27
  let customAddress = {};
31
28
  const defaultFetchState = {
@@ -48,17 +45,19 @@ const getIssueChargeCardView = (state) => {
48
45
  }
49
46
  }
50
47
  });
51
- const issueCardPageFetchState = (0, reduceFetchState_1.reduceFetchState)([
52
- chargeCardConfigState,
53
- userListSelectorView,
54
- chargeCardListState.creditAccount,
55
- tenantState,
56
- ]);
57
48
  const { classIds } = classListState;
58
49
  const allAccountingClasses = (0, classSelector_1.getClassesByIds)(classState, {
59
50
  classIds: classIds,
60
51
  reportId: 'class_list',
61
52
  });
53
+ const issueCardPageFetchState = (0, reduceFetchState_1.reduceFetchState)([
54
+ chargeCardConfigState,
55
+ userListViewState.userListByType.cardHolderCandidate,
56
+ userListSelectorView,
57
+ chargeCardListState.creditAccount,
58
+ classListState,
59
+ chargeCardListState,
60
+ ]);
62
61
  return {
63
62
  fetchState: issueCardPageFetchState.fetchState,
64
63
  error: issueCardPageFetchState.error,
@@ -11,7 +11,7 @@ export interface PhysicalCardData {
11
11
  frequency: CreditLimitFrequencyCodeType;
12
12
  addressId?: ID;
13
13
  amount?: Amount;
14
- userIds?: ID;
14
+ userId?: ID;
15
15
  }
16
16
  export interface VirtualCardData {
17
17
  userIds: ID[];
@@ -11,7 +11,7 @@ exports.initialIssueChargeCardLocalData = [
11
11
  frequency: 'monthly',
12
12
  addressId: undefined,
13
13
  amount: undefined,
14
- userIds: undefined,
14
+ userId: undefined,
15
15
  },
16
16
  virtualCard: {
17
17
  userIds: [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.13.20",
3
+ "version": "4.13.21",
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",