@zeniai/client-epic-state 4.10.29 → 4.10.31

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,13 +9,7 @@ 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
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 });
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) }));
19
13
  };
20
14
  exports.toBillTransaction = toBillTransaction;
21
15
  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, false);
35
+ exports.store = (0, configureStore_1.default)(exports.zeniAPI, true);
36
36
  return exports.store;
37
37
  }
38
38
  exports.default = initialize;
@@ -44,7 +44,7 @@ const getNestedAgingBalancesByCustomer = (customerState, agingBalancesByCustomer
44
44
  });
45
45
  const filteredAgingBalancesByCustomer = agingBalancesByCustomer.filter((balance) => balance.customer.name.toLowerCase().includes(searchString.toLowerCase()));
46
46
  const sortedAgingBalancesByCustomer = (0, orderBy_1.default)(filteredAgingBalancesByCustomer, (balance) => {
47
- var _a;
47
+ var _a, _b, _c;
48
48
  switch (sortKey) {
49
49
  case 'customer':
50
50
  return balance.customer.name.toLowerCase();
@@ -53,8 +53,13 @@ const getNestedAgingBalancesByCustomer = (customerState, agingBalancesByCustomer
53
53
  ? balance.totalWithChildren.amount
54
54
  : balance.total.amount;
55
55
  default: {
56
- const obj = balance.arAgingBalances.find((balance) => balance.period === sortKey);
57
- return (_a = obj === null || obj === void 0 ? void 0 : obj.balance.amount) !== null && _a !== void 0 ? _a : 0;
56
+ const customerRecord = balance.arAgingBalances.find((balance) => balance.period === sortKey);
57
+ if (balance.children.length > 0) {
58
+ return (_b = (_a = customerRecord === null || customerRecord === void 0 ? void 0 : customerRecord.totalBalance) === null || _a === void 0 ? void 0 : _a.amount) !== null && _b !== void 0 ? _b : 0;
59
+ }
60
+ else {
61
+ return (_c = customerRecord === null || customerRecord === void 0 ? void 0 : customerRecord.balance.amount) !== null && _c !== void 0 ? _c : 0;
62
+ }
58
63
  }
59
64
  }
60
65
  }, sortOrder === 'ascending' ? 'asc' : 'desc');
@@ -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, _c;
403
+ var _a, _b;
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 (_c = (_b = transaction.totalAmountInUSD) === null || _b === void 0 ? void 0 : _b.amount) !== null && _c !== void 0 ? _c : 0;
416
+ return (_b = transaction.totalAmountInUSD.amount) !== null && _b !== void 0 ? _b : 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 'creationDate':
193
- return task.createTime;
192
+ case 'createdBy':
193
+ return task.createdBy;
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' | 'creationDate' | 'priority' | 'tag';
21
+ export declare type TaskListFilterCategoryField = 'status' | 'dueDate' | 'assignee' | 'createdBy' | '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", "creationDate", "tag", "status", "priority"];
26
- export declare const toTaskListSortKeyType: (v: string) => "priority" | "name" | "status" | "dueDate" | "creationDate" | "assignee" | "tag";
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";
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',
10
9
  'tag',
11
10
  'status',
12
11
  '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 },
21
22
  {
22
23
  value: 'assignee',
23
24
  type: 'user',
24
25
  multiple: true,
25
26
  },
26
- { value: 'creationDate', type: 'dateRange', multiple: true },
27
27
  ];
@@ -6,6 +6,7 @@ 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;
9
10
  }
10
11
  export interface TaskListSelectorView extends SelectorView {
11
12
  taskList: TaskWithUserDetails[];
@@ -21,7 +21,8 @@ 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
- return Object.assign(Object.assign({}, task), { assigneeUsers });
24
+ const createdByUser = (0, userAndRole_1.getUserAndUserRole)(userState, userRoleState, addressState, task.createdBy);
25
+ return Object.assign(Object.assign({}, task), { assigneeUsers, createdByUser });
25
26
  }
26
27
  return undefined;
27
28
  })
@@ -31,18 +32,18 @@ const getAllTasks = (state) => {
31
32
  const sortOrder = (0, sortOrderPayload_1.getSortOrder)(taskListState.uiState.sortOrder);
32
33
  const filteredTaskList = (0, spendManagementFilterHelpers_1.applyAdvancedFiltersOnList)('task_management', searchedTaskList, taskListState.filters);
33
34
  const cardsInOrder = (0, orderBy_1.default)(filteredTaskList, (task) => {
34
- var _a, _b;
35
+ var _a, _b, _c;
35
36
  switch (sortKey) {
36
37
  case 'dueDate':
37
38
  return task.dueDate;
38
- case 'creationDate':
39
- return task.createTime;
40
39
  case 'tag':
41
40
  return (_b = (_a = task.tag) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : '';
42
41
  case 'status':
43
42
  return task.status.name;
44
43
  case 'priority':
45
44
  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;
46
47
  case 'name':
47
48
  default:
48
49
  return task.name.toLowerCase();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.10.29",
3
+ "version": "4.10.31",
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",