@zeniai/client-epic-state 4.12.7 → 4.12.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.
@@ -56,10 +56,6 @@ exports.ALL_REPORT_IDS = [
56
56
  ];
57
57
  const toReportID = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_REPORT_IDS);
58
58
  exports.toReportID = toReportID;
59
- const ALL_REPORT_FORMAT = [
60
- 'summary',
61
- 'detailed',
62
- 'more_detailed',
63
- ];
59
+ const ALL_REPORT_FORMAT = ['summary', 'detailed', 'more_detailed'];
64
60
  const toReportFormatStrict = (v) => { var _a; return (0, stringToUnion_1.stringToUnionStrict)((_a = v === null || v === void 0 ? void 0 : v.toLocaleLowerCase()) !== null && _a !== void 0 ? _a : '', ALL_REPORT_FORMAT); };
65
61
  exports.toReportFormatStrict = toReportFormatStrict;
@@ -1,3 +1,3 @@
1
- import { ID } from "../../commonStateTypes/common";
2
- import { Customer, CustomerState } from "./customerState";
1
+ import { ID } from '../../commonStateTypes/common';
2
+ import { Customer, CustomerState } from './customerState';
3
3
  export declare function getCustomer(customerState: CustomerState, cutomerId: ID): Customer | undefined;
@@ -23,9 +23,7 @@ const ALL_BALANCE_SHEET_REPORT_VIEW_LIABILITY_SECTION_IDS = [
23
23
  'longTermLiabilities',
24
24
  ];
25
25
  const toBalanceSheetReportViewLiabilitySectionID = (v) => (0, stringToUnion_1.stringToUnion)(v, ALL_BALANCE_SHEET_REPORT_VIEW_LIABILITY_SECTION_IDS);
26
- const ALL_BALANCE_SHEET_REPORT_VIEW_EQUITY_SECTION_IDS = [
27
- 'equity',
28
- ];
26
+ const ALL_BALANCE_SHEET_REPORT_VIEW_EQUITY_SECTION_IDS = ['equity'];
29
27
  const toBalanceSheetReportViewEquitySectionID = (v) => (0, stringToUnion_1.stringToUnion)(v, ALL_BALANCE_SHEET_REPORT_VIEW_EQUITY_SECTION_IDS);
30
28
  exports.ALL_BALANCE_SHEET_REPORT_VIEW_SECTION_IDS = [
31
29
  ...ALL_BALANCE_SHEET_REPORT_VIEW_ASSET_SECTION_IDS,
@@ -1,10 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
4
- const ALL_ADD_SOURCE_CARD_PAYMENT_TYPE = [
5
- 'card',
6
- 'direct_debit',
7
- ];
4
+ const ALL_ADD_SOURCE_CARD_PAYMENT_TYPE = ['card', 'direct_debit'];
8
5
  const ADD_SOURCE_CARD_PAYMENT_TYPE = [
9
6
  ...ALL_ADD_SOURCE_CARD_PAYMENT_TYPE,
10
7
  ];
@@ -87,6 +87,9 @@ const updateCustomerCreationPayload = (onboardingCustomer, onboardingCustomerPay
87
87
  if (Boolean(qboRealmId) && qboRealmId !== (tenant === null || tenant === void 0 ? void 0 : tenant.qboRealmId)) {
88
88
  onboardingCustomerPayload.qbo_realm_id = qboRealmId;
89
89
  }
90
+ else if (Boolean(qboRealmId) === false && (tenant === null || tenant === void 0 ? void 0 : tenant.qboRealmId) != null) {
91
+ onboardingCustomerPayload.qbo_realm_id = '';
92
+ }
90
93
  if (isSubsidiary != null &&
91
94
  (company == null ||
92
95
  (company != null &&
@@ -77,7 +77,10 @@ exports.initialState = {
77
77
  totalOpexByVendor: {
78
78
  totals: {},
79
79
  },
80
- dataAvailable: undefined,
80
+ dataAvailable: {
81
+ month: undefined,
82
+ quarter: undefined,
83
+ },
81
84
  firstMonthOfFY: 1,
82
85
  reportId: 'operating_expenses_by_vendor',
83
86
  reportTitle: 'OpEx By Vendor',
@@ -249,7 +252,7 @@ const doUpdateOpexByVendorReport = (draft, timeframe, reportPayload, queryProps)
249
252
  var _a, _b, _c;
250
253
  if (reportPayload.status.is_report_generated == null) {
251
254
  const report = (0, viewAndReportPayload_1.mapReportPayloadToReport)(reportPayload);
252
- draft.dataAvailable = report.dataAvailable;
255
+ draft.dataAvailable[timeframe] = report.dataAvailable;
253
256
  draft.firstMonthOfFY = report.firstMonthOfFY;
254
257
  draft.bookCloseDate = report.bookCloseDate;
255
258
  const currencyPayload = reportPayload.currency;
@@ -16,6 +16,15 @@ function getOpexVendorTimeframeKey(timeframeTick) {
16
16
  return `${timeframeTick.startDate.toString()}-${timeframeTick.endDate.toString()}`;
17
17
  }
18
18
  exports.getOpexVendorTimeframeKey = getOpexVendorTimeframeKey;
19
+ const getDateRange = (timeframe, firstMonthOfFY, dataAvailable) => {
20
+ if (dataAvailable != null) {
21
+ if (timeframe === 'month') {
22
+ return dataAvailable;
23
+ }
24
+ return getDataAvailableForQuarter(dataAvailable, firstMonthOfFY);
25
+ }
26
+ return undefined;
27
+ };
19
28
  exports.getOpExByVendorReport = (0, toolkit_1.createSelector)((state) => state.opExByVendorState, (state) => state.vendorState, (state) => state.accountState, (state) => state.classState, (opExByVendorState, vendorState, accountState, classState) => {
20
29
  const fetchState = (0, reduceFetchState_1.reduceFetchState)([
21
30
  opExByVendorState.reportFetchState.month,
@@ -31,13 +40,12 @@ exports.getOpExByVendorReport = (0, toolkit_1.createSelector)((state) => state.o
31
40
  let opexBalances = [];
32
41
  const summaryBalances = [];
33
42
  let totalBalances = undefined;
34
- if (dataAvailable != null &&
43
+ const dateRange = getDateRange(timeframe, firstMonthOfFY, dataAvailable[timeframe]);
44
+ if (dateRange != null &&
35
45
  (fetchState.fetchState === 'Completed' ||
36
46
  opExByVendorState.uiState.sortOrSearchInProgress === true ||
37
47
  opExByVendorState.uiState.pageFetchInProgress === true)) {
38
- filter = (0, coaBalancesFilter_1.newBalancesFilterForDateRange)(firstMonthOfFY, opExByVendorState.uiState.timeframe, timeframe === 'month'
39
- ? dataAvailable
40
- : getDataAvailableForQuarter(dataAvailable, firstMonthOfFY), 'ascending_date', opExByVendorState.uiState.selectedAdditionalBalances);
48
+ filter = (0, coaBalancesFilter_1.newBalancesFilterForDateRange)(firstMonthOfFY, timeframe, dateRange, 'ascending_date', opExByVendorState.uiState.selectedAdditionalBalances);
41
49
  const opexByVendorBalances = (0, coaBalance_1.getCOABalancesWithTotals)(opExByVendorState.totalOpexByVendor, filter);
42
50
  const opexKeys = opExByVendorState.uiState.searchString[timeframe].length > 0
43
51
  ? opExByVendorState.opExByVendorKeysForSearchByTimeframe[timeframe]
@@ -64,7 +72,7 @@ exports.getOpExByVendorReport = (0, toolkit_1.createSelector)((state) => state.o
64
72
  summaryBalances,
65
73
  allTimeframeTicks,
66
74
  totalBalances,
67
- dataAvailable: opExByVendorState.dataAvailable,
75
+ dataAvailable: opExByVendorState.dataAvailable[timeframe],
68
76
  bookCloseDate: opExByVendorState.bookCloseDate,
69
77
  reportId: opExByVendorState.reportId,
70
78
  reportTitle: opExByVendorState.reportTitle,
@@ -4,6 +4,7 @@ import { SortOrder } from '../../commonStateTypes/selectorTypes/sortOrderTypes';
4
4
  import { ReportUIState } from '../../commonStateTypes/viewAndReport/reportUIState';
5
5
  import { PageToken, Report } from '../../commonStateTypes/viewAndReport/viewAndReport';
6
6
  import { ZeniDate } from '../../zeniDayJS';
7
+ import { DataAvailable } from '../../commonStateTypes/dataAvailable';
7
8
  export interface OpExByVendorQuery {
8
9
  sortKey: OpexByVendorSortKey;
9
10
  sortOrder: SortOrder;
@@ -49,7 +50,7 @@ export interface OpexByVendorUIState extends ReportUIState {
49
50
  scrollTop: number;
50
51
  };
51
52
  }
52
- export interface OpExByVendorState extends Report {
53
+ export interface OpExByVendorState extends Omit<Report, 'dataAvailable'> {
53
54
  opExByVendorReportGenerated: boolean;
54
55
  opExByVendorKeysByTimeframe: {
55
56
  month: OpexVendorKey[];
@@ -69,4 +70,8 @@ export interface OpExByVendorState extends Report {
69
70
  };
70
71
  summaryFetchState: FetchStateAndError;
71
72
  lastRefreshSuccessTime?: ZeniDate;
73
+ dataAvailable: {
74
+ month?: DataAvailable;
75
+ quarter?: DataAvailable;
76
+ };
72
77
  }
@@ -11,12 +11,7 @@ const toScheduleListTabsFileTypeStrict = (v) => {
11
11
  exports.toScheduleListTabsFileTypeStrict = toScheduleListTabsFileTypeStrict;
12
12
  const getScheduleListKey = (selectedCategory, selectedTimeframe) => `${selectedCategory}-${selectedTimeframe.startDate.format(formatZeniDateFY_1.DAY_MONTH_YEAR_FORMAT)}--${selectedTimeframe.endDate.format(formatZeniDateFY_1.DAY_MONTH_YEAR_FORMAT)}`;
13
13
  exports.getScheduleListKey = getScheduleListKey;
14
- const ALL_SCHEDULES_SUB_TABS = [
15
- 'all',
16
- 'new',
17
- 'ongoing',
18
- 'completed',
19
- ];
14
+ const ALL_SCHEDULES_SUB_TABS = ['all', 'new', 'ongoing', 'completed'];
20
15
  const toScheduleSubTabType = (v) => (0, stringToUnion_1.stringToUnion)(v, ALL_SCHEDULES_SUB_TABS);
21
16
  exports.toScheduleSubTabType = toScheduleSubTabType;
22
17
  const ALL_SCHEDULES_PAY_SORT_KEYS = [
@@ -49,10 +49,7 @@ exports.INTERNATIONAL_CODES = [
49
49
  'usd-to-usd',
50
50
  ];
51
51
  const toInternationalWireMethodCodeType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.INTERNATIONAL_CODES);
52
- const INTERNATIONAL_CODES_KEYS = [
53
- 'usdToLocalCurrency',
54
- 'usdToUsd',
55
- ];
52
+ const INTERNATIONAL_CODES_KEYS = ['usdToLocalCurrency', 'usdToUsd'];
56
53
  const toInternationalWireMethodCodeKeyType = (v) => (0, stringToUnion_1.stringToUnion)(v, INTERNATIONAL_CODES_KEYS);
57
54
  exports.INTERNATIONAL_SUB_CODES = ['swift_our', 'swift_sha'];
58
55
  const toInternationalSubMethodCodeType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.INTERNATIONAL_SUB_CODES);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.12.7",
3
+ "version": "4.12.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",