@zeniai/client-epic-state 5.0.15-betaRD1 → 5.0.16-betaJK1

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.
@@ -4,7 +4,7 @@ export declare const toAiAccountantOperationType: (v: string) => "onboard" | "of
4
4
  export type AiAccountantOperationType = ReturnType<typeof toAiAccountantOperationType>;
5
5
  export declare const toAiAccountantEnrollmentStatus: (v: string) => "onboarding" | "error" | "active" | "pending" | "offboarding" | "offboarded" | "failed";
6
6
  export type AiAccountantEnrollmentStatus = ReturnType<typeof toAiAccountantEnrollmentStatus>;
7
- export declare const getAllowedOperationsForStatus: (status: string) => AiAccountantOperationType[];
7
+ export declare const getAllowedOperationsForStatus: (status: string | null | undefined) => AiAccountantOperationType[];
8
8
  export declare const toAiAccountantJobStatus: (v: string) => "failed" | "queued" | "running" | "completed" | "cancelled" | "retried";
9
9
  export type AiAccountantJobStatus = ReturnType<typeof toAiAccountantJobStatus>;
10
10
  export interface AiAccountantEnrollment {
@@ -32,7 +32,12 @@ const STATUS_ALLOWED_OPERATIONS = {
32
32
  onboarding: ['cancel_onboarding'],
33
33
  offboarding: [],
34
34
  };
35
- const getAllowedOperationsForStatus = (status) => STATUS_ALLOWED_OPERATIONS[status] ?? STATUS_ALLOWED_OPERATIONS.default;
35
+ const getAllowedOperationsForStatus = (status) => {
36
+ if (status == null) {
37
+ return STATUS_ALLOWED_OPERATIONS.default;
38
+ }
39
+ return STATUS_ALLOWED_OPERATIONS[status] ?? STATUS_ALLOWED_OPERATIONS.default;
40
+ };
36
41
  exports.getAllowedOperationsForStatus = getAllowedOperationsForStatus;
37
42
  // ── Job Status ──
38
43
  const ALL_JOB_STATUSES = [
@@ -27,7 +27,12 @@ const STATUS_ALLOWED_OPERATIONS = {
27
27
  onboarding: ['cancel_onboarding'],
28
28
  offboarding: [],
29
29
  };
30
- export const getAllowedOperationsForStatus = (status) => STATUS_ALLOWED_OPERATIONS[status] ?? STATUS_ALLOWED_OPERATIONS.default;
30
+ export const getAllowedOperationsForStatus = (status) => {
31
+ if (status == null) {
32
+ return STATUS_ALLOWED_OPERATIONS.default;
33
+ }
34
+ return STATUS_ALLOWED_OPERATIONS[status] ?? STATUS_ALLOWED_OPERATIONS.default;
35
+ };
31
36
  // ── Job Status ──
32
37
  const ALL_JOB_STATUSES = [
33
38
  'queued',
@@ -1,28 +1,23 @@
1
1
  import { createSelector } from '@reduxjs/toolkit';
2
- import isEqual from 'lodash/isEqual';
3
2
  import { DEFAULT_DATE_FORMAT } from '../../commonStateTypes/fiscalYearHelpers/formatZeniDateFY';
4
- import { toMonth, toMonthYearPeriodId, } from '../../commonStateTypes/timePeriod';
3
+ import { toMonthYearPeriodId, } from '../../commonStateTypes/timePeriod';
5
4
  import { getMonthEndCloseChecksByTenantId } from '../../entity/monthEndCloseChecks/monthEndCloseChecksSelector';
6
5
  import { defaultMonthYearPeriod } from '../../entity/tenant/epic/fetchAllTenantsEpic';
7
6
  import { getCurrentTenant, } from '../../entity/tenant/tenantSelector';
8
- import { date, dateNow } from '../../zeniDayJS';
7
+ import { date } from '../../zeniDayJS';
9
8
  export const isMonthEndInsightDisabled = (currentTenant, selectedPeriod, userAllowedToAccessMonthEndInsights, auditSummary) => {
9
+ console.log('jklogs ~ isMonthEndInsightDisabled ~ selectedPeriod:', selectedPeriod);
10
10
  if (auditSummary != null) {
11
11
  if (auditSummary.auditScorePercentage < 75 &&
12
12
  userAllowedToAccessMonthEndInsights === false) {
13
13
  return true;
14
14
  }
15
- const previousMonthPeriod = {
16
- month: toMonth(dateNow().subtract(1, 'month').month() + 1),
17
- year: dateNow().subtract(1, 'month').year(),
18
- };
19
- if (!isEqual(previousMonthPeriod, selectedPeriod)) {
20
- return true;
21
- }
22
15
  // if the selected period is November 2024, then book close date should not be null and book close date should be 30th November 2024
23
16
  const { bookCloseDate } = currentTenant;
17
+ console.log('jklogs ~ isMonthEndInsightDisabled ~ bookCloseDate:', bookCloseDate);
24
18
  const selectedPeriodFirstDay = date(`${selectedPeriod.year}-${selectedPeriod.month}-01`);
25
19
  const selectedPeriodLastDay = selectedPeriodFirstDay.endOf('month');
20
+ console.log('jklogs ~ isMonthEndInsightDisabled ~ selectedPeriodLastDay:', selectedPeriodLastDay);
26
21
  if (bookCloseDate == null ||
27
22
  bookCloseDate.format(DEFAULT_DATE_FORMAT) !==
28
23
  selectedPeriodLastDay.format(DEFAULT_DATE_FORMAT)) {