@zeniai/client-epic-state 4.15.27 → 4.15.29

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.
@@ -2,8 +2,8 @@ import { Amount } from '../../../commonStateTypes/amount';
2
2
  import { ID } from '../../../commonStateTypes/common';
3
3
  import { ZeniDate } from '../../../zeniDayJS';
4
4
  import { BaseTransaction } from './transaction';
5
- export declare const TRANSACTION_DIRECTION: readonly ["debit", "credit"];
6
- export declare const toTransactionDirectionType: (v: string) => "credit" | "debit";
5
+ export declare const TRANSACTION_DIRECTION: readonly ["payment", "deposit"];
6
+ export declare const toTransactionDirectionType: (v: string) => "payment" | "deposit";
7
7
  export type TransactionDirectionType = ReturnType<typeof toTransactionDirectionType>;
8
8
  export declare const MERCHANT_TYPE: readonly ["customer", "vendor", "none"];
9
9
  export declare const toMerchantType: (v: string) => "none" | "vendor" | "customer";
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.toMerchantType = exports.MERCHANT_TYPE = exports.toTransactionDirectionType = exports.TRANSACTION_DIRECTION = void 0;
4
4
  const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
5
- exports.TRANSACTION_DIRECTION = ['debit', 'credit'];
5
+ exports.TRANSACTION_DIRECTION = ['payment', 'deposit'];
6
6
  const toTransactionDirectionType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.TRANSACTION_DIRECTION);
7
7
  exports.toTransactionDirectionType = toTransactionDirectionType;
8
8
  exports.MERCHANT_TYPE = ['customer', 'vendor', 'none'];
package/lib/init.d.ts CHANGED
@@ -11,7 +11,7 @@ export declare let store: ZeniStore;
11
11
  * Note: This version SHOULD BE used only in the client side. Not intended to be used
12
12
  * when using from server side.
13
13
  */
14
- export default function initialize(restEndPoints: RESTAPIEndpoints, userId?: string, sessionId?: string, tenantId?: string): ZeniStore;
14
+ export default function initialize(restEndPoints: RESTAPIEndpoints, userId?: string, sessionId?: string, tenantId?: string, isSandboxEnv?: boolean): ZeniStore;
15
15
  export interface PusherAuthPayload {
16
16
  auth: ID;
17
17
  }
package/lib/init.js CHANGED
@@ -29,7 +29,7 @@ let initialized = false;
29
29
  * Note: This version SHOULD BE used only in the client side. Not intended to be used
30
30
  * when using from server side.
31
31
  */
32
- function initialize(restEndPoints, userId, sessionId, tenantId) {
32
+ function initialize(restEndPoints, userId, sessionId, tenantId, isSandboxEnv) {
33
33
  if (initialized) {
34
34
  console.warn(`Already initialized with url ${JSON.stringify(exports.zeniAPI.apiEndPoints)}`);
35
35
  return exports.store;
@@ -38,7 +38,7 @@ function initialize(restEndPoints, userId, sessionId, tenantId) {
38
38
  console.info(`initializing with ${JSON.stringify(restEndPoints)}`);
39
39
  initialize3rdPartyExtensions();
40
40
  exports.zeniAPI = new zeniAPI_1.ZeniAPIClient(restEndPoints, userId, sessionId, tenantId);
41
- exports.store = (0, configureStore_1.default)(exports.zeniAPI, false);
41
+ exports.store = (0, configureStore_1.default)(exports.zeniAPI, isSandboxEnv);
42
42
  return exports.store;
43
43
  }
44
44
  let isPusherInitialized = false;
@@ -44,8 +44,8 @@ const updateReconcileTabLocalDataEpic = (actions$, state$) => actions$.pipe((0,
44
44
  currencyCode: bankBalance.currencyCode,
45
45
  currencySymbol: bankBalance.currencySymbol,
46
46
  };
47
- const depositsLocalData = calculateSplitAmounts(transactions, 'credit', currency);
48
- const paymentLocalData = calculateSplitAmounts(transactions, 'debit', currency);
47
+ const depositsLocalData = calculateSplitAmounts(transactions, 'deposit', currency);
48
+ const paymentLocalData = calculateSplitAmounts(transactions, 'payment', currency);
49
49
  actions.push((0, reconciliationViewReducer_1.updateBalancesLocalData)({
50
50
  clearedBalance: updatedClearedBalance,
51
51
  variance: variance,
@@ -60,10 +60,10 @@ exports.updateReconcileTabLocalDataEpic = updateReconcileTabLocalDataEpic;
60
60
  function calculateUpdatedClearedBalance(transactions, initialClearedBalance) {
61
61
  // Reduce the transactions to calculate the updated cleared balance
62
62
  const updatedClearedBalance = transactions.reduce((updatedBalance, transaction) => {
63
- if (transaction.transactionDirection === 'debit') {
63
+ if (transaction.transactionDirection === 'payment') {
64
64
  return updatedBalance - transaction.amount.amount; // Deduct for debit
65
65
  }
66
- else if (transaction.transactionDirection === 'credit') {
66
+ else if (transaction.transactionDirection === 'deposit') {
67
67
  return updatedBalance + transaction.amount.amount; // Add for credit
68
68
  }
69
69
  return updatedBalance; // Return unchanged balance for other cases
@@ -26,7 +26,7 @@ const fetchAllExpenseAutomationTabsEpic = (actions$, state$) => actions$.pipe((0
26
26
  const timePeriodEnd = (0, timePeriod_1.toAbsoluteDay)(period.end);
27
27
  const monthYearPeriodId = (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod);
28
28
  const monthEndCheckState = (_a = monthEndCloseChecksByTenantId === null || monthEndCloseChecksByTenantId === void 0 ? void 0 : monthEndCloseChecksByTenantId[currentTenant.tenantId]) === null || _a === void 0 ? void 0 : _a[monthYearPeriodId];
29
- const reconciliationEnabled = (_b = monthEndCheckState === null || monthEndCheckState === void 0 ? void 0 : monthEndCheckState.monthEndCloseCheckList.find((list) => list.id === 'reconciliation')) !== null && _b !== void 0 ? _b : false;
29
+ const reconciliationEnabled = (_b = monthEndCheckState === null || monthEndCheckState === void 0 ? void 0 : monthEndCheckState.monthEndCloseCheckList.some((list) => list.id === 'reconciliation')) !== null && _b !== void 0 ? _b : false;
30
30
  if (timePeriodStart == null ||
31
31
  timePeriodEnd == null ||
32
32
  companyId == null) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.15.27",
3
+ "version": "4.15.29",
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",