@zeniai/client-epic-state 4.12.58 → 4.12.60

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.
@@ -8,5 +8,5 @@ export declare type ScheduleTypes = ReturnType<typeof toScheduleTypesType>;
8
8
  export declare const toScheduleTypesTypeStrict: (v?: string | undefined) => "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue" | undefined;
9
9
  export declare const toScheduleJournalEntryStatusCodeType: (v: string) => "canceled" | "pending" | "unknown" | "posted" | "recorded";
10
10
  export declare type ScheduleJournalEntryStatusCodeType = ReturnType<typeof toScheduleJournalEntryStatusCodeType>;
11
- export declare const toScheduleStatusCodeType: (v: string) => "new" | "completed" | "ongoing" | "marked_as_completed";
11
+ export declare const toScheduleStatusCodeType: (v: string) => "new" | "completed" | "draft" | "ongoing" | "marked_as_completed";
12
12
  export declare type ScheduleStatusCodeType = ReturnType<typeof toScheduleStatusCodeType>;
@@ -26,6 +26,7 @@ const SCHEDULE_STATUS_CODE = [
26
26
  'ongoing',
27
27
  'completed',
28
28
  'marked_as_completed',
29
+ 'draft',
29
30
  ];
30
31
  const toScheduleStatusCodeType = (v) => (0, stringToUnion_1.stringToUnion)(v, SCHEDULE_STATUS_CODE);
31
32
  exports.toScheduleStatusCodeType = toScheduleStatusCodeType;
@@ -3,6 +3,6 @@ import { Observable } from 'rxjs';
3
3
  import { updateJESchedulesDetails, updateJESchedules } from '../../../../entity/jeSchedules/jeSchedulesReducer';
4
4
  import { RootState } from '../../../../reducer';
5
5
  import { ZeniAPI } from '../../../../zeniAPI';
6
- import { updateScheduleDetailsSuccess, updateScheduleDetailsFailure, fetchScheduleDetails, initializeScheduleDetailLocalData, saveScheduleDetailsSuccessOrFailure, updateSelectedJEScheduleKey } from '../scheduleDetailReducer';
7
- export declare type ActionType = ReturnType<typeof fetchScheduleDetails> | ReturnType<typeof updateJESchedulesDetails> | ReturnType<typeof updateJESchedules> | ReturnType<typeof updateSelectedJEScheduleKey> | ReturnType<typeof updateScheduleDetailsSuccess> | ReturnType<typeof initializeScheduleDetailLocalData> | ReturnType<typeof saveScheduleDetailsSuccessOrFailure> | ReturnType<typeof updateScheduleDetailsFailure>;
6
+ import { updateScheduleDetailsSuccess, updateScheduleDetailsFailure, fetchScheduleDetails, initializeScheduleDetailLocalData, saveScheduleDetailsSuccessOrFailure, updateSelectedJEScheduleKey, createNewSchedules } from '../scheduleDetailReducer';
7
+ export declare type ActionType = ReturnType<typeof fetchScheduleDetails> | ReturnType<typeof updateJESchedulesDetails> | ReturnType<typeof updateJESchedules> | ReturnType<typeof updateSelectedJEScheduleKey> | ReturnType<typeof updateScheduleDetailsSuccess> | ReturnType<typeof initializeScheduleDetailLocalData> | ReturnType<typeof saveScheduleDetailsSuccessOrFailure> | ReturnType<typeof createNewSchedules> | ReturnType<typeof updateScheduleDetailsFailure>;
8
8
  export declare const fetchScheduleDetailsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -33,6 +33,9 @@ const fetchScheduleDetailsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0
33
33
  type: (0, transactionType_1.toTransactionType)(transactionData.transaction_type),
34
34
  });
35
35
  updateActions.push((0, jeSchedulesReducer_1.updateJESchedules)(response.data.je_schedules), (0, scheduleDetailReducer_1.updateSelectedJEScheduleKey)({ selectedJEScheduleKey }), (0, jeSchedulesReducer_1.updateJESchedulesDetails)(response.data.je_schedules, response.data.scheduled_journal_entries), (0, scheduleDetailReducer_1.saveScheduleDetailsSuccessOrFailure)('Not-Started'), (0, scheduleDetailReducer_1.initializeScheduleDetailLocalData)(scheduleType, selectedJEScheduleKey, selectedJeScheduleDetailId), (0, scheduleDetailReducer_1.updateScheduleDetailsSuccess)());
36
+ if (response.data.je_schedules[0].status.code === 'draft') {
37
+ updateActions.push((0, scheduleDetailReducer_1.createNewSchedules)({ scheduleType }));
38
+ }
36
39
  return (0, rxjs_1.from)(updateActions);
37
40
  }
38
41
  else {
@@ -3,9 +3,10 @@ import { BillDetailViewState, BillApprovalType, BillAssistActionType } from './b
3
3
  import { FetchState, ID } from '../../../../commonStateTypes/common';
4
4
  import { BillDetailViewPayload } from './billDetailViewPayload';
5
5
  export declare const initialState: BillDetailViewState;
6
- export declare const fetchBillDetail: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[billId: string, isShowDeletedBillsEnabled: boolean, cacheOverride?: any], {
6
+ export declare const fetchBillDetail: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[billId: string, isShowDeletedBillsEnabled: boolean, hasZeniAssistAccess: boolean, cacheOverride?: any], {
7
7
  billId: string;
8
8
  isShowDeletedBillsEnabled: boolean;
9
+ hasZeniAssistAccess: boolean;
9
10
  cacheOverride: any;
10
11
  }, string, never, never>, updateBillDetail: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
11
12
  billId: ID;
@@ -25,11 +25,12 @@ const billDetailView = (0, toolkit_1.createSlice)({
25
25
  draft.billDetailById[key] = Object.assign({}, billDetailViewState_1.initialBillDetailView);
26
26
  }
27
27
  },
28
- prepare(billId, isShowDeletedBillsEnabled, cacheOverride = false) {
28
+ prepare(billId, isShowDeletedBillsEnabled, hasZeniAssistAccess, cacheOverride = false) {
29
29
  return {
30
30
  payload: {
31
31
  billId,
32
32
  isShowDeletedBillsEnabled,
33
+ hasZeniAssistAccess,
33
34
  cacheOverride,
34
35
  },
35
36
  };
@@ -116,7 +116,8 @@ const fetchBillDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, ope
116
116
  'returned',
117
117
  ].includes((_q = transactionInResponse.bill_pay_info.bill_payment_status
118
118
  .code) !== null && _q !== void 0 ? _q : '');
119
- if (billHasPaymentError) {
119
+ if (billHasPaymentError &&
120
+ action.payload.hasZeniAssistAccess) {
120
121
  fetchActions.push((0, billDetailViewReducer_1.fetchEligibleActionsForBill)(billId, true));
121
122
  }
122
123
  }
@@ -5,14 +5,16 @@ import { InvoiceProcessingPayload } from './editBillViewPayload';
5
5
  import { AmountPayload } from '../../../../entity/reimbursement/reimbursementPayload';
6
6
  import { Amount } from '../../../../commonStateTypes/amount';
7
7
  export declare const initialState: EditBillDetailViewState;
8
- export declare const fetchEditBillDetailPage: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride: boolean, isShowDeletedBillsEnabled: boolean, billId?: string | undefined], {
8
+ export declare const fetchEditBillDetailPage: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride: boolean, isShowDeletedBillsEnabled: boolean, hasZeniAssistAccess: boolean, billId?: string | undefined], {
9
9
  cacheOverride: boolean;
10
10
  isShowDeletedBillsEnabled: boolean;
11
+ hasZeniAssistAccess: boolean;
11
12
  billId: string | undefined;
12
- }, string, never, never>, fetchBillAndInitializeLocalStore: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[billId: string, cacheOverride: boolean, isShowDeletedBillsEnabled: boolean], {
13
+ }, string, never, never>, fetchBillAndInitializeLocalStore: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[billId: string, cacheOverride: boolean, isShowDeletedBillsEnabled: boolean, hasZeniAssistAccess: boolean], {
13
14
  billId: string;
14
15
  cacheOverride: boolean;
15
16
  isShowDeletedBillsEnabled: boolean;
17
+ hasZeniAssistAccess: boolean;
16
18
  }, string, never, never>, fetchVendorByNameAndParseInvoice: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[invoiceProcessingPayload: InvoiceProcessingPayload, isVendorRecommendationFeatureEnabled: boolean], {
17
19
  invoiceProcessingPayload: InvoiceProcessingPayload;
18
20
  isVendorRecommendationFeatureEnabled: boolean;
@@ -23,8 +23,15 @@ const editBillView = (0, toolkit_1.createSlice)({
23
23
  reducer() {
24
24
  //do nothing
25
25
  },
26
- prepare(cacheOverride, isShowDeletedBillsEnabled, billId) {
27
- return { payload: { cacheOverride, isShowDeletedBillsEnabled, billId } };
26
+ prepare(cacheOverride, isShowDeletedBillsEnabled, hasZeniAssistAccess, billId) {
27
+ return {
28
+ payload: {
29
+ cacheOverride,
30
+ isShowDeletedBillsEnabled,
31
+ hasZeniAssistAccess,
32
+ billId,
33
+ },
34
+ };
28
35
  },
29
36
  },
30
37
  fetchBillAndInitializeLocalStore: {
@@ -41,8 +48,15 @@ const editBillView = (0, toolkit_1.createSlice)({
41
48
  error: undefined,
42
49
  }, showSkipAutofill: false });
43
50
  },
44
- prepare(billId, cacheOverride, isShowDeletedBillsEnabled) {
45
- return { payload: { billId, cacheOverride, isShowDeletedBillsEnabled } };
51
+ prepare(billId, cacheOverride, isShowDeletedBillsEnabled, hasZeniAssistAccess) {
52
+ return {
53
+ payload: {
54
+ billId,
55
+ cacheOverride,
56
+ isShowDeletedBillsEnabled,
57
+ hasZeniAssistAccess,
58
+ },
59
+ };
46
60
  },
47
61
  },
48
62
  fetchVendorByNameAndParseInvoice: {
@@ -13,11 +13,11 @@ const editBillViewReducer_1 = require("../editBillViewReducer");
13
13
  const fetchBillAndInitializeLocalStoreEpic = (actions$,
14
14
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
15
15
  state$) => actions$.pipe((0, operators_1.filter)(editBillViewReducer_1.fetchBillAndInitializeLocalStore.match), (0, operators_1.mergeMap)((action) => {
16
- const { billId, cacheOverride, isShowDeletedBillsEnabled } = action.payload;
16
+ const { billId, cacheOverride, isShowDeletedBillsEnabled, hasZeniAssistAccess, } = action.payload;
17
17
  const state = state$.value;
18
18
  const billDetailActions = [];
19
19
  if (cacheOverride) {
20
- billDetailActions.push((0, billDetailViewReducer_1.fetchBillDetail)(billId, isShowDeletedBillsEnabled, true));
20
+ billDetailActions.push((0, billDetailViewReducer_1.fetchBillDetail)(billId, isShowDeletedBillsEnabled, hasZeniAssistAccess, true));
21
21
  billDetailActions.push(
22
22
  //https://stackoverflow.com/questions/42276419/invoking-epics-from-within-other-epics
23
23
  (0, editBillViewReducer_1.waitForBillDetailThenInitializeLocalStore)(billId));
@@ -15,7 +15,7 @@ const companySelector_1 = require("../../../../../entity/company/companySelector
15
15
  const paymentAccountListReducer_1 = require("../../../zeniAccounts/paymentAccountList/paymentAccountListReducer");
16
16
  const fetchEditBillDetailPageEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(editBillViewReducer_1.fetchEditBillDetailPage.match), (0, operators_1.mergeMap)((action) => {
17
17
  var _a, _b, _c;
18
- const { cacheOverride, billId, isShowDeletedBillsEnabled } = action.payload;
18
+ const { cacheOverride, billId, isShowDeletedBillsEnabled, hasZeniAssistAccess, } = action.payload;
19
19
  const billDetailActions = [];
20
20
  const state = state$.value;
21
21
  const { tenantState, companyState } = state;
@@ -36,7 +36,7 @@ const fetchEditBillDetailPageEpic = (actions$, state$) => actions$.pipe((0, oper
36
36
  }
37
37
  billDetailActions.push((0, paymentAccountListReducer_1.fetchPaymentAccountList)());
38
38
  if (billId != null) {
39
- billDetailActions.push((0, editBillViewReducer_1.fetchBillAndInitializeLocalStore)(billId, true, isShowDeletedBillsEnabled));
39
+ billDetailActions.push((0, editBillViewReducer_1.fetchBillAndInitializeLocalStore)(billId, true, isShowDeletedBillsEnabled, hasZeniAssistAccess));
40
40
  }
41
41
  else {
42
42
  billDetailActions.push((0, editBillViewReducer_1.updateShowAutofill)(true));
@@ -79,7 +79,7 @@ const fetchEditBillDetailPageEpic = (actions$, state$) => actions$.pipe((0, oper
79
79
  billDetailActions.push((0, paymentAccountListReducer_1.fetchPaymentAccountList)());
80
80
  }
81
81
  if (billId != null) {
82
- billDetailActions.push((0, editBillViewReducer_1.fetchBillAndInitializeLocalStore)(billId, false, isShowDeletedBillsEnabled));
82
+ billDetailActions.push((0, editBillViewReducer_1.fetchBillAndInitializeLocalStore)(billId, false, isShowDeletedBillsEnabled, hasZeniAssistAccess));
83
83
  }
84
84
  else {
85
85
  const approvalViewFetchState = state.billPaySetupApproverViewState.fetchState;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.12.58",
3
+ "version": "4.12.60",
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",