@zeniai/client-epic-state 4.8.67 → 4.8.69

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.
@@ -110,6 +110,9 @@ const updateAmountsInScheduleDetails = (jeSchedulesLocalData, actualPeriod, rowI
110
110
  let currentRunningBalance = calculatedRunningBalance;
111
111
  const isNegative = totalAmount < 0 || currentRunningBalance < 0;
112
112
  return jeSchedulesLocalData.map((jeScheduleDetail, index) => {
113
+ const postingStatus = jeScheduleDetail.postingDate.isBefore((0, zeniDayJS_1.dateNow)().startOf('month'))
114
+ ? 'unknown'
115
+ : 'pending';
113
116
  if (index > rowId) {
114
117
  if (currentRunningBalance - averageAmount > 0) {
115
118
  currentRunningBalance =
@@ -123,12 +126,12 @@ const updateAmountsInScheduleDetails = (jeSchedulesLocalData, actualPeriod, rowI
123
126
  index === actualPeriod - 1 ? 0 : currentRunningBalance;
124
127
  return Object.assign(Object.assign({}, jeScheduleDetail), { amount: Object.assign(Object.assign({}, jeScheduleDetail.amount), { amount: isNegative && amount !== 0 ? -amount : amount }), runningBalance: Object.assign(Object.assign({}, jeScheduleDetail.runningBalance), { amount: isNegative && currentRunningBalance !== 0
125
128
  ? -currentRunningBalance
126
- : currentRunningBalance }), postingStatus: amount === 0 ? 'canceled' : 'pending' });
129
+ : currentRunningBalance }), postingStatus: amount === 0 ? 'canceled' : postingStatus });
127
130
  }
128
131
  else if (index === rowId) {
129
132
  return Object.assign(Object.assign({}, jeScheduleDetail), { amount: Object.assign(Object.assign({}, jeScheduleDetail.amount), { amount: isNegative && updatedAmount !== 0 ? -updatedAmount : updatedAmount }), runningBalance: Object.assign(Object.assign({}, jeScheduleDetail.runningBalance), { amount: isNegative && calculatedRunningBalance !== 0
130
133
  ? -calculatedRunningBalance
131
- : calculatedRunningBalance }), postingStatus: updatedAmount === 0 ? 'canceled' : 'pending' });
134
+ : calculatedRunningBalance }), postingStatus: updatedAmount === 0 ? 'canceled' : postingStatus });
132
135
  }
133
136
  else {
134
137
  return jeScheduleDetail;
@@ -19,5 +19,5 @@ export declare const isRecurringConfigChanged: (recurringBillNewConfig: Recurrin
19
19
  export declare const getTotalPayments: (startDate: ZeniDate, endDate: ZeniDate, frequency: RecurringBillFrequency, currentInstance?: RecurringBillInstance | undefined) => number;
20
20
  export declare const getEndDate: (startDate: ZeniDate, frequency: RecurringBillFrequency, totalPayments: number, currentInstance?: RecurringBillInstance | undefined) => ZeniDate;
21
21
  export declare const accountTypeSubConfigCodeToAccType: (code?: "depositAccount" | "paymentAccount" | undefined) => AccType | undefined;
22
- export declare function showReimbursementPromoPage(currentTenant: CurrentTenant): boolean;
22
+ export declare function showReimbursementPromoPage(currentTenant: CurrentTenant, userRoleMap: RoleMap): boolean;
23
23
  export declare function showBillPayPromoPage(currentTenant: CurrentTenant, userRoleMap: RoleMap): boolean;
@@ -228,27 +228,27 @@ const accountTypeSubConfigCodeToAccType = (code) => {
228
228
  }
229
229
  };
230
230
  exports.accountTypeSubConfigCodeToAccType = accountTypeSubConfigCodeToAccType;
231
- function showReimbursementPromoPage(currentTenant) {
231
+ function showReimbursementPromoPage(currentTenant, userRoleMap) {
232
232
  var _a, _b, _c;
233
233
  const isReimbursementTOSAccepted = Boolean((_a = currentTenant.company) === null || _a === void 0 ? void 0 : _a.companyReimbursementInfo.isReimbursementTOSAccepted);
234
- const isEmployeeLevelAccess = Boolean(currentTenant.userRole) === true
235
- ? (0, userRoleType_1.hasEmployeeLevelAccess)(currentTenant)
236
- : false;
234
+ const isUserHasRemiAccess = (0, userRoleType_1.hasReimbursementAccess)(userRoleMap);
235
+ const isUserHasAdminLevelRemiAccess = (0, userRoleType_1.hasReimbursementAdminLevelAccess)(userRoleMap);
236
+ const isNonAdminLevelAccess = isUserHasRemiAccess && !isUserHasAdminLevelRemiAccess;
237
237
  const isEmployeeReimbursementTOSAccepted = Boolean((_b = currentTenant.userReimbursementInfo) === null || _b === void 0 ? void 0 : _b.isReimbursementTOSAccepted);
238
238
  return ((Boolean((_c = currentTenant.company) === null || _c === void 0 ? void 0 : _c.companyReimbursementInfo) &&
239
239
  !isReimbursementTOSAccepted) ||
240
240
  (Boolean(currentTenant.userReimbursementInfo) &&
241
- isEmployeeLevelAccess &&
241
+ isNonAdminLevelAccess &&
242
242
  !isEmployeeReimbursementTOSAccepted));
243
243
  }
244
244
  exports.showReimbursementPromoPage = showReimbursementPromoPage;
245
245
  function showBillPayPromoPage(currentTenant, userRoleMap) {
246
246
  var _a, _b, _c;
247
- const isUserHasOnlyBillPayAccess = (0, userRoleType_1.hasOnlyBillPayAccess)(userRoleMap);
247
+ const isUserHasBillPayAccess = (0, userRoleType_1.hasBillPayAccess)(userRoleMap);
248
+ const isUserHasAdminLevelBillPayAccess = (0, userRoleType_1.hasBillPayAdminLevelAccess)(userRoleMap);
248
249
  const isBillPayTOSAccepted = Boolean((_b = (_a = currentTenant.companyBillPayInfo) === null || _a === void 0 ? void 0 : _a.info) === null || _b === void 0 ? void 0 : _b.isBillPayTOSAccepted);
249
250
  return (Boolean((_c = currentTenant.companyBillPayInfo) === null || _c === void 0 ? void 0 : _c.info) &&
250
251
  (isBillPayTOSAccepted === false ||
251
- (isUserHasOnlyBillPayAccess &&
252
- Boolean(userRoleMap.bill_pay_admin) === false)));
252
+ (isUserHasBillPayAccess && isUserHasAdminLevelBillPayAccess === false)));
253
253
  }
254
254
  exports.showBillPayPromoPage = showBillPayPromoPage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.8.67",
3
+ "version": "4.8.69",
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",