@zeniai/client-epic-state 4.10.31 → 4.10.32

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.
@@ -11,9 +11,9 @@ export interface BillTransactionPayload extends VendorTransactionPayload {
11
11
  is_recurring: boolean;
12
12
  recurring_bill_config_id: string | null;
13
13
  recurring_bill_instance: number | null;
14
- home_currency_amount: number;
15
- home_currency_code: string;
16
- home_currency_symbol: string;
14
+ home_currency_amount?: number;
15
+ home_currency_code?: string;
16
+ home_currency_symbol?: string;
17
17
  class_id?: ID | null;
18
18
  class_name?: string | null;
19
19
  qbo_class_id?: ID | null;
@@ -9,7 +9,13 @@ const billTransactionState_1 = require("./billTransactionState");
9
9
  const billPayConfigPayload_1 = require("../../../view/spendManagement/billPay/billPayConfig/billPayConfigPayload");
10
10
  const toBillTransaction = (payload) => {
11
11
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
12
- return (Object.assign(Object.assign({}, (0, vendorTransactionPayload_1.toVendorTransaction)(payload)), { billPayInfo: (0, exports.toBillPayInfo)(payload.bill_pay_info), classId: (_a = payload.class_id) !== null && _a !== void 0 ? _a : '', className: (_b = payload.class_name) !== null && _b !== void 0 ? _b : '', qboClassId: (_c = payload.qbo_class_id) !== null && _c !== void 0 ? _c : '', transactionReferenceId: (_d = payload.transaction_reference_id) !== null && _d !== void 0 ? _d : '', entityApprovalId: payload.entity_approval_id, updateTime: (0, zeniDayJS_1.date)(payload.update_time), createdBy: (_e = payload.created_by_user_id) !== null && _e !== void 0 ? _e : '', candidateVendorName: (_f = payload.candidate_vendor_name) !== null && _f !== void 0 ? _f : '', bookCloseDate: payload.book_close_date != null ? (0, zeniDayJS_1.date)(payload.book_close_date) : undefined, lastUpdatedByUserId: (_g = payload.last_updated_by_user_id) !== null && _g !== void 0 ? _g : '', paymentProcessingTotalFee: (0, amount_1.toAmount)((_h = payload.total_fee) !== null && _h !== void 0 ? _h : 0, payload.currency_code, payload.currency_symbol), isDeleted: payload.is_deleted, deletionInfo: (0, exports.toDeletionInfo)(payload.deletion_info), isRecurring: payload.is_recurring, recurringBillConfigId: (_j = payload.recurring_bill_config_id) !== null && _j !== void 0 ? _j : undefined, recurringBillInstance: (_k = payload.recurring_bill_instance) !== null && _k !== void 0 ? _k : undefined, totalAmountInUSD: (0, amount_1.toAmount)(payload.home_currency_amount, payload.home_currency_code, payload.home_currency_symbol) }));
12
+ return Object.assign(Object.assign({}, (0, vendorTransactionPayload_1.toVendorTransaction)(payload)), { billPayInfo: (0, exports.toBillPayInfo)(payload.bill_pay_info), classId: (_a = payload.class_id) !== null && _a !== void 0 ? _a : '', className: (_b = payload.class_name) !== null && _b !== void 0 ? _b : '', qboClassId: (_c = payload.qbo_class_id) !== null && _c !== void 0 ? _c : '', transactionReferenceId: (_d = payload.transaction_reference_id) !== null && _d !== void 0 ? _d : '', entityApprovalId: payload.entity_approval_id, updateTime: (0, zeniDayJS_1.date)(payload.update_time), createdBy: (_e = payload.created_by_user_id) !== null && _e !== void 0 ? _e : '', candidateVendorName: (_f = payload.candidate_vendor_name) !== null && _f !== void 0 ? _f : '', bookCloseDate: payload.book_close_date != null
13
+ ? (0, zeniDayJS_1.date)(payload.book_close_date)
14
+ : undefined, lastUpdatedByUserId: (_g = payload.last_updated_by_user_id) !== null && _g !== void 0 ? _g : '', paymentProcessingTotalFee: (0, amount_1.toAmount)((_h = payload.total_fee) !== null && _h !== void 0 ? _h : 0, payload.currency_code, payload.currency_symbol), isDeleted: payload.is_deleted, deletionInfo: (0, exports.toDeletionInfo)(payload.deletion_info), isRecurring: payload.is_recurring, recurringBillConfigId: (_j = payload.recurring_bill_config_id) !== null && _j !== void 0 ? _j : undefined, recurringBillInstance: (_k = payload.recurring_bill_instance) !== null && _k !== void 0 ? _k : undefined, totalAmountInUSD: payload.home_currency_amount != null &&
15
+ payload.home_currency_code != null &&
16
+ payload.home_currency_symbol != null
17
+ ? (0, amount_1.toAmount)(payload.home_currency_amount, payload.home_currency_code, payload.home_currency_symbol)
18
+ : undefined });
13
19
  };
14
20
  exports.toBillTransaction = toBillTransaction;
15
21
  const toBillPayInfo = (payload) => {
@@ -19,7 +19,7 @@ export interface BillTransaction extends VendorTransaction {
19
19
  isDeleted: boolean;
20
20
  deletionInfo: DeletionInfo;
21
21
  isRecurring: boolean;
22
- totalAmountInUSD: Amount;
22
+ totalAmountInUSD?: Amount;
23
23
  recurringBillConfigId?: ID;
24
24
  recurringBillInstance?: number;
25
25
  bookCloseDate?: ZeniDate;
package/lib/init.js CHANGED
@@ -32,7 +32,7 @@ function initialize(restEndPoints, userId, sessionId, tenantId) {
32
32
  console.info(`initializing with ${JSON.stringify(restEndPoints)}`);
33
33
  initialize3rdPartyExtensions();
34
34
  exports.zeniAPI = new zeniAPI_1.ZeniAPIClient(restEndPoints, userId, sessionId, tenantId);
35
- exports.store = (0, configureStore_1.default)(exports.zeniAPI, true);
35
+ exports.store = (0, configureStore_1.default)(exports.zeniAPI, false);
36
36
  return exports.store;
37
37
  }
38
38
  exports.default = initialize;
@@ -8,7 +8,7 @@ const notificationViewReducer_1 = require("../notificationViewReducer");
8
8
  const userReducer_1 = require("../../../entity/user/userReducer");
9
9
  const notificationReducer_1 = require("../../../entity/notification/notificationReducer");
10
10
  const fetchNotificationViewEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(notificationViewReducer_1.fetchNotificationView.match), (0, operators_1.switchMap)((action) => {
11
- const { notificationGroup, mode, status } = action.payload;
11
+ const { notificationGroup, mode, status, isNewNotificationFetch } = action.payload;
12
12
  const { stateByTab } = state$.value.notificationViewState;
13
13
  const notificationTab = (0, notificationViewReducer_1.toNotificationTab)(notificationGroup);
14
14
  const notificationTabState = stateByTab[notificationTab];
@@ -18,7 +18,9 @@ const fetchNotificationViewEpic = (actions$, state$, zeniAPI) => actions$.pipe((
18
18
  is_paginated: true,
19
19
  limit: 10,
20
20
  mode,
21
- page_token: notificationTabState.uiState.pageToken,
21
+ page_token: isNewNotificationFetch
22
+ ? null
23
+ : notificationTabState.uiState.pageToken,
22
24
  };
23
25
  return zeniAPI
24
26
  .getJSON(`${zeniAPI.apiEndPoints.notificationMicroServiceBaseUrl}/1.0/user-notification?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
@@ -35,7 +37,7 @@ const fetchNotificationViewEpic = (actions$, state$, zeniAPI) => actions$.pipe((
35
37
  const actions = [
36
38
  (0, userReducer_1.updateAllUsers)({ users: allUniqueUsers, updateType: 'merge' }),
37
39
  (0, notificationReducer_1.updateAllNotifications)(notifications, 'replace'),
38
- (0, notificationViewReducer_1.fetchNotificationViewSuccess)(notifications, total_count, notificationGroup, next_page_token),
40
+ (0, notificationViewReducer_1.fetchNotificationViewSuccess)(notifications, total_count, notificationGroup, isNewNotificationFetch ? null : next_page_token),
39
41
  ];
40
42
  return actions;
41
43
  }
@@ -4,10 +4,11 @@ import { NotificationTabState, NotificationTabType, NotificationViewState, Notif
4
4
  import { NotificationGroup } from '../../entity/notification/types/notificationTypes';
5
5
  import { PageToken } from '../../commonStateTypes/viewAndReport/viewAndReport';
6
6
  export declare const initialState: NotificationViewState;
7
- export declare const fetchNotificationView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[notificationGroup: "task_manager", mode?: "dashboard" | "email" | undefined, status?: ("unread" | "read")[] | undefined], {
7
+ export declare const fetchNotificationView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[notificationGroup: "task_manager", mode?: "dashboard" | "email" | undefined, status?: ("unread" | "read")[] | undefined, isNewNotificationFetch?: boolean | undefined], {
8
8
  notificationGroup: "task_manager";
9
9
  mode: "dashboard" | "email";
10
10
  status: ("unread" | "read")[];
11
+ isNewNotificationFetch: boolean;
11
12
  }, string, never, never>, fetchNotificationViewSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[notifications: NotificationPayload[], totalCount: number, notificationGroup: "task_manager", pageToken: PageToken], {
12
13
  notifications: NotificationPayload[];
13
14
  totalCount: number;
@@ -79,12 +79,13 @@ const notificationView = (0, toolkit_1.createSlice)({
79
79
  draft.stateByTab[notificationTab].fetchState = 'In-Progress';
80
80
  draft.stateByTab[notificationTab].error = undefined;
81
81
  },
82
- prepare(notificationGroup, mode = 'dashboard', status = ['read', 'unread']) {
82
+ prepare(notificationGroup, mode = 'dashboard', status = ['read', 'unread'], isNewNotificationFetch) {
83
83
  return {
84
84
  payload: {
85
85
  notificationGroup,
86
86
  mode,
87
87
  status,
88
+ isNewNotificationFetch: isNewNotificationFetch !== null && isNewNotificationFetch !== void 0 ? isNewNotificationFetch : false,
88
89
  },
89
90
  };
90
91
  },
@@ -107,7 +108,9 @@ const notificationView = (0, toolkit_1.createSlice)({
107
108
  draft.stateByTab[notificationTab].uiState.hasMore = false;
108
109
  }
109
110
  draft.stateByTab[notificationTab].uiState.totalCount = totalCount;
110
- draft.stateByTab[notificationTab].uiState.pageToken = pageToken;
111
+ if (pageToken != null) {
112
+ draft.stateByTab[notificationTab].uiState.pageToken = pageToken;
113
+ }
111
114
  draft.stateByTab[notificationTab].fetchState = 'Completed';
112
115
  draft.stateByTab[notificationTab].error = undefined;
113
116
  },
@@ -400,7 +400,7 @@ const getBillListOnSort = (sortKey, sortOrder, currentTab, transactions) => {
400
400
  }
401
401
  };
402
402
  const sortedTransactionsWithSortKeyValue = (0, orderBy_1.default)(transactionsWithSortKeyValue, (transaction) => {
403
- var _a, _b;
403
+ var _a, _b, _c;
404
404
  switch (sortKey) {
405
405
  case 'name':
406
406
  return (_a = transaction.vendor) === null || _a === void 0 ? void 0 : _a.name.toLowerCase();
@@ -413,7 +413,7 @@ const getBillListOnSort = (sortKey, sortOrder, currentTab, transactions) => {
413
413
  case 'status':
414
414
  return getStatusPerTab(transaction);
415
415
  case 'amount':
416
- return (_b = transaction.totalAmountInUSD.amount) !== null && _b !== void 0 ? _b : 0;
416
+ return (_c = (_b = transaction.totalAmountInUSD) === null || _b === void 0 ? void 0 : _b.amount) !== null && _c !== void 0 ? _c : 0;
417
417
  case 'paymentMethod':
418
418
  return transaction.billPayInfo.billPaymentMethodType.name;
419
419
  }
@@ -189,8 +189,8 @@ const getCategoryValueForTaskList = (key, task) => {
189
189
  return (_a = task.tag) === null || _a === void 0 ? void 0 : _a.code;
190
190
  case 'status':
191
191
  return task.status.code;
192
- case 'createdBy':
193
- return task.createdBy;
192
+ case 'creationDate':
193
+ return task.createTime;
194
194
  case 'assignee':
195
195
  return task.assignees;
196
196
  default:
@@ -18,12 +18,12 @@ export interface TaskFilterCategory {
18
18
  values: (string | ZeniDate)[];
19
19
  valuesCombinationOperator: 'ANY';
20
20
  }
21
- export declare type TaskListFilterCategoryField = 'status' | 'dueDate' | 'assignee' | 'createdBy' | 'priority' | 'tag';
21
+ export declare type TaskListFilterCategoryField = 'status' | 'dueDate' | 'assignee' | 'creationDate' | 'priority' | 'tag';
22
22
  export interface TaskListUIState extends SpendManagementUIState {
23
23
  sortKey: TaskListViewSortKey;
24
24
  }
25
- export declare const ALL_TASK_LIST_SORT_KEYS: readonly ["name", "dueDate", "assignee", "tag", "status", "priority", "createdBy"];
26
- export declare const toTaskListSortKeyType: (v: string) => "priority" | "name" | "status" | "dueDate" | "createdBy" | "assignee" | "tag";
25
+ export declare const ALL_TASK_LIST_SORT_KEYS: readonly ["name", "dueDate", "assignee", "creationDate", "tag", "status", "priority"];
26
+ export declare const toTaskListSortKeyType: (v: string) => "priority" | "name" | "status" | "dueDate" | "creationDate" | "assignee" | "tag";
27
27
  export declare type TaskListViewSortKey = ReturnType<typeof toTaskListSortKeyType>;
28
28
  export declare const TASK_LIST_FILTER_CATEGORIES: TaskListFilterCategoryOption[];
29
29
  export interface TaskListFilterCategoryOption {
@@ -6,10 +6,10 @@ exports.ALL_TASK_LIST_SORT_KEYS = [
6
6
  'name',
7
7
  'dueDate',
8
8
  'assignee',
9
+ 'creationDate',
9
10
  'tag',
10
11
  'status',
11
12
  'priority',
12
- 'createdBy',
13
13
  ];
14
14
  const toTaskListSortKeyType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_TASK_LIST_SORT_KEYS);
15
15
  exports.toTaskListSortKeyType = toTaskListSortKeyType;
@@ -18,10 +18,10 @@ exports.TASK_LIST_FILTER_CATEGORIES = [
18
18
  { value: 'priority', type: 'dropdown', multiple: true },
19
19
  { value: 'tag', type: 'dropdown', multiple: true },
20
20
  { value: 'dueDate', type: 'dateRange', multiple: false },
21
- { value: 'createdBy', type: 'user', multiple: true },
22
21
  {
23
22
  value: 'assignee',
24
23
  type: 'user',
25
24
  multiple: true,
26
25
  },
26
+ { value: 'creationDate', type: 'dateRange', multiple: true },
27
27
  ];
@@ -6,7 +6,6 @@ import { TaskListFilters, TaskListUIState } from './taskList';
6
6
  import { UserListSelectorView } from '../../userListView/userListViewSelector';
7
7
  export interface TaskWithUserDetails extends Task {
8
8
  assigneeUsers: UserAndRole[];
9
- createdByUser?: UserAndRole;
10
9
  }
11
10
  export interface TaskListSelectorView extends SelectorView {
12
11
  taskList: TaskWithUserDetails[];
@@ -21,8 +21,7 @@ const getAllTasks = (state) => {
21
21
  const assigneeUsers = task.assignees
22
22
  .map((userId) => (0, userAndRole_1.getUserAndUserRole)(userState, userRoleState, addressState, userId))
23
23
  .filter((value) => value != null);
24
- const createdByUser = (0, userAndRole_1.getUserAndUserRole)(userState, userRoleState, addressState, task.createdBy);
25
- return Object.assign(Object.assign({}, task), { assigneeUsers, createdByUser });
24
+ return Object.assign(Object.assign({}, task), { assigneeUsers });
26
25
  }
27
26
  return undefined;
28
27
  })
@@ -32,18 +31,18 @@ const getAllTasks = (state) => {
32
31
  const sortOrder = (0, sortOrderPayload_1.getSortOrder)(taskListState.uiState.sortOrder);
33
32
  const filteredTaskList = (0, spendManagementFilterHelpers_1.applyAdvancedFiltersOnList)('task_management', searchedTaskList, taskListState.filters);
34
33
  const cardsInOrder = (0, orderBy_1.default)(filteredTaskList, (task) => {
35
- var _a, _b, _c;
34
+ var _a, _b;
36
35
  switch (sortKey) {
37
36
  case 'dueDate':
38
37
  return task.dueDate;
38
+ case 'creationDate':
39
+ return task.createTime;
39
40
  case 'tag':
40
41
  return (_b = (_a = task.tag) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : '';
41
42
  case 'status':
42
43
  return task.status.name;
43
44
  case 'priority':
44
45
  return taskState_1.ALL_PRORITY_CODE.indexOf(task.priority.code);
45
- case 'createdBy':
46
- return (_c = task.createdByUser) === null || _c === void 0 ? void 0 : _c.user.firstName;
47
46
  case 'name':
48
47
  default:
49
48
  return task.name.toLowerCase();
@@ -71,7 +71,7 @@ const vendorFirstReviewView = (0, toolkit_1.createSlice)({
71
71
  draft.uiState = Object.assign(Object.assign({}, draft.uiState), { pageToken: (_a = query === null || query === void 0 ? void 0 : query.page_token) !== null && _a !== void 0 ? _a : null, totalCount: total_count });
72
72
  },
73
73
  updateVendorFirstReviewViewLocalData(draft, action) {
74
- var _a, _b;
74
+ var _a, _b, _c;
75
75
  const { vendorId, vendorRenamedText, selectedGlobalMerchantId, currentSelection, } = action.payload;
76
76
  if (draft.vendorFirstReviewViewLocalDataById[vendorId]
77
77
  .vendorFirstReviewViewLocalData != null) {
@@ -106,8 +106,7 @@ const vendorFirstReviewView = (0, toolkit_1.createSlice)({
106
106
  }
107
107
  else {
108
108
  updateSelectedGlobalMerchantId =
109
- (_b = vendorLocalData.recommendationIds[0]) !== null && _b !== void 0 ? _b : vendorLocalData.recommendedNonExistingGlobalMerchants[0]
110
- .globalMerchantName;
109
+ (_b = vendorLocalData.recommendationIds[0]) !== null && _b !== void 0 ? _b : (_c = vendorLocalData.recommendedNonExistingGlobalMerchants[0]) === null || _c === void 0 ? void 0 : _c.globalMerchantName;
111
110
  }
112
111
  draft.vendorFirstReviewViewLocalDataById[vendorId].vendorFirstReviewViewLocalData = Object.assign(Object.assign({}, vendorLocalData), { vendorRenamedText: undefined, selectedVendorId: updateSelectedGlobalMerchantId, currentSelection: isRetainSelected
113
112
  ? 'retain'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.10.31",
3
+ "version": "4.10.32",
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",