@zeniai/client-epic-state 4.19.8 → 4.19.9

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.
@@ -58,10 +58,19 @@ exports.defaultMonthYearPeriod = {
58
58
  };
59
59
  const getDefaultSelectedPeriodsForTenants = (tenantsData) => {
60
60
  const defaultSelectedPeriodsForTenants = tenantsData.tenants.reduce((prev, currentTenant) => {
61
- const currentMonthYearPeriod = currentTenant.book_close_date != null
61
+ // if book close date is of current month then show current month, else show book close date month + 1
62
+ const currentMonthYearPeriod = currentTenant.book_close_date != null &&
63
+ ((0, zeniDayJS_1.dateNow)().month() !== (0, zeniDayJS_1.date)(currentTenant.book_close_date).month() ||
64
+ (0, zeniDayJS_1.dateNow)().year() !== (0, zeniDayJS_1.date)(currentTenant.book_close_date).year())
62
65
  ? {
63
- month: (0, timePeriod_1.toMonth)((0, zeniDayJS_1.date)(currentTenant.book_close_date).month()),
64
- year: (0, zeniDayJS_1.date)(currentTenant.book_close_date).year(),
66
+ month: (0, timePeriod_1.toMonth)((0, zeniDayJS_1.date)(currentTenant.book_close_date)
67
+ .startOf('month')
68
+ .add(1, 'month')
69
+ .month()),
70
+ year: (0, zeniDayJS_1.date)(currentTenant.book_close_date)
71
+ .startOf('month')
72
+ .add(1, 'month')
73
+ .year(),
65
74
  }
66
75
  : undefined;
67
76
  if (currentMonthYearPeriod != null) {
@@ -3,8 +3,7 @@ import { AccountListResponse } from './accountListPayload';
3
3
  import { AccountList, AccountListKeyType, AccountListState } from './accountListState';
4
4
  export declare const initialAccountList: AccountList;
5
5
  export declare const initialState: AccountListState;
6
- export declare const fetchAccountList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[accountListKey: AccountListKeyType, fetchFullResponse?: any, excludeAccountPayableAccounts?: any, excludeAccountReceivableAccounts?: any, isLimitedCategoryEnabled?: any, filterAccountTypes?: ("cash_position" | "fixed_assets" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets")[] | undefined, isIncludeDeleted?: boolean | undefined], {
7
- isIncludeDeleted?: true | undefined;
6
+ export declare const fetchAccountList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[accountListKey: AccountListKeyType, fetchFullResponse?: any, excludeAccountPayableAccounts?: any, excludeAccountReceivableAccounts?: any, isLimitedCategoryEnabled?: any, filterAccountTypes?: ("cash_position" | "fixed_assets" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets")[] | undefined], {
8
7
  accountListKey: AccountListKeyType;
9
8
  fetchFullResponse: any;
10
9
  excludeAccountPayableAccounts: any;
@@ -45,13 +45,16 @@ const accountList = (0, toolkit_1.createSlice)({
45
45
  const existingData = draft.byReportId[action.payload.accountListKey];
46
46
  draft.byReportId[action.payload.accountListKey] = Object.assign(Object.assign({}, existingData), { fetchState: 'In-Progress', error: undefined });
47
47
  },
48
- prepare(accountListKey, fetchFullResponse = false, excludeAccountPayableAccounts = false, excludeAccountReceivableAccounts = false, isLimitedCategoryEnabled = false, filterAccountTypes, isIncludeDeleted) {
48
+ prepare(accountListKey, fetchFullResponse = false, excludeAccountPayableAccounts = false, excludeAccountReceivableAccounts = false, isLimitedCategoryEnabled = false, filterAccountTypes) {
49
49
  return {
50
- payload: Object.assign({ accountListKey,
50
+ payload: {
51
+ accountListKey,
51
52
  fetchFullResponse,
52
53
  excludeAccountPayableAccounts,
53
54
  excludeAccountReceivableAccounts,
54
- isLimitedCategoryEnabled, filterAccountTypes: filterAccountTypes !== null && filterAccountTypes !== void 0 ? filterAccountTypes : [] }, (isIncludeDeleted === true && { isIncludeDeleted })),
55
+ isLimitedCategoryEnabled,
56
+ filterAccountTypes: filterAccountTypes !== null && filterAccountTypes !== void 0 ? filterAccountTypes : [],
57
+ },
55
58
  };
56
59
  },
57
60
  },
@@ -16,9 +16,14 @@ const getAccountTypes = (isLimitedCategoryEnabled, filterAccountTypes) => {
16
16
  return [];
17
17
  };
18
18
  const fetchAccountListEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(accountListReducer_1.fetchAccountList.match), (0, operators_1.mergeMap)((action) => {
19
- const { accountListKey, fetchFullResponse, excludeAccountPayableAccounts, excludeAccountReceivableAccounts, isLimitedCategoryEnabled, filterAccountTypes, isIncludeDeleted, } = action.payload;
19
+ const { accountListKey, fetchFullResponse, excludeAccountPayableAccounts, excludeAccountReceivableAccounts, isLimitedCategoryEnabled, filterAccountTypes, } = action.payload;
20
20
  const accountTypes = getAccountTypes(isLimitedCategoryEnabled, filterAccountTypes);
21
- const queryValue = Object.assign({ is_bookkeeping_admin: fetchFullResponse, is_exclude_account_payable_accounts: excludeAccountPayableAccounts, is_exclude_account_receivable_accounts: excludeAccountReceivableAccounts, account_types: accountTypes }, (isIncludeDeleted === true && { is_include_deleted: true }));
21
+ const queryValue = {
22
+ is_bookkeeping_admin: fetchFullResponse,
23
+ is_exclude_account_payable_accounts: excludeAccountPayableAccounts,
24
+ is_exclude_account_receivable_accounts: excludeAccountReceivableAccounts,
25
+ account_types: accountTypes,
26
+ };
22
27
  return zeniAPI
23
28
  .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accounts?query=${encodeURIComponent(JSON.stringify(queryValue))}`)
24
29
  .pipe((0, operators_1.mergeMap)((response) => {
@@ -18,8 +18,8 @@ const fetchEditRemiDetailPageEpic = (actions$, state$) => actions$.pipe((0, oper
18
18
  const state = state$.value;
19
19
  const userId = (_b = (_a = state.tenantState.loggedInUser) === null || _a === void 0 ? void 0 : _a.userId) !== null && _b !== void 0 ? _b : '';
20
20
  if (cacheOverride) {
21
- remiDetailActions.push((0, accountListReducer_1.fetchAccountList)('reimbursementAccountList', true, true, true, isLimitedCategoryEnabled, [], true));
22
- remiDetailActions.push((0, classListReducer_1.fetchClassList)(true));
21
+ remiDetailActions.push((0, accountListReducer_1.fetchAccountList)('reimbursementAccountList', true, true, true, isLimitedCategoryEnabled));
22
+ remiDetailActions.push((0, classListReducer_1.fetchClassList)());
23
23
  remiDetailActions.push((0, merchantListReducer_1.fetchMerchantList)());
24
24
  remiDetailActions.push((0, reimbursementConfigReducer_1.fetchReimbursementConfig)());
25
25
  remiDetailActions.push((0, userFinancialAccountReducer_1.fetchUserFinancialAccount)(userId, reimbursementId));
@@ -29,12 +29,14 @@ const fetchEditRemiDetailPageEpic = (actions$, state$) => actions$.pipe((0, oper
29
29
  }
30
30
  else {
31
31
  const accountList = state.accountListState.byReportId.reimbursementAccountList;
32
- if (accountList.fetchState !== 'In-Progress') {
33
- remiDetailActions.push((0, accountListReducer_1.fetchAccountList)('reimbursementAccountList', true, true, true, isLimitedCategoryEnabled, [], true));
32
+ if (accountList.hasValidState() === false &&
33
+ accountList.fetchState !== 'In-Progress') {
34
+ remiDetailActions.push((0, accountListReducer_1.fetchAccountList)('reimbursementAccountList', true, true, true, isLimitedCategoryEnabled));
34
35
  }
35
36
  const classList = state.classListState;
36
- if (classList.fetchState !== 'In-Progress') {
37
- remiDetailActions.push((0, classListReducer_1.fetchClassList)(true));
37
+ if (classList.hasValidState() === false &&
38
+ classList.fetchState !== 'In-Progress') {
39
+ remiDetailActions.push((0, classListReducer_1.fetchClassList)());
38
40
  }
39
41
  const merchantList = state.merchantListState;
40
42
  if (merchantList.hasValidState() === false &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.19.8",
3
+ "version": "4.19.9",
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",
@@ -30,7 +30,7 @@
30
30
  "@liveblocks/client": "^2.23.0",
31
31
  "@trivago/prettier-plugin-sort-imports": "^5.2.2",
32
32
  "@types/big.js": "^6.2.2",
33
- "@types/lodash": "^4.17.23",
33
+ "@types/lodash": "^4.17.16",
34
34
  "@types/node": "^20.19.0",
35
35
  "@types/url-parse": "^1.4.11",
36
36
  "@typescript-eslint/eslint-plugin": "^8.26.0",
@@ -62,7 +62,7 @@
62
62
  "dayjs": "^1.10.7",
63
63
  "dayjs-business-time": "^1.0.4",
64
64
  "js-base64": "^3.6.0",
65
- "lodash": "^4.17.23",
65
+ "lodash": "^4.17.21",
66
66
  "pusher-js": "^8.4.0",
67
67
  "redux": "^4.0.5",
68
68
  "redux-observable": "^1.2.0",