5.2.0 • Published 3 years ago

@timetac/js-core v5.2.0

Weekly downloads
335
License
Apache-2.0
Repository
github
Last release
3 years ago

@timetac/js-core

Core library for sharing state (Redux) and business logic in general between our (React) frontend projects.

Available Scripts

In the project directory, you can run:

yarn install

Installs all dependencies.

yarn dev

Run the compiler in watch mode. Watch input files and trigger recompilation on changes. The implementation of watching files and directories can be configured using environment variable. See configuring watch for more details.

yarn test

Launches the test runner in the interactive watch mode.

Import

import { Core } from '@timetac/js-core;

Actions and parameters

LoginSlice

Core.slices.login.actions.requestServerCommunication(
  PayloadAction<{ account: string }>
)
Core.slices.login.actions.requestUsernamePasswordLogin(PayloadAction<{
        username: string;
        password: string;
        clientId: string;
        clientSecret: string;}>)
Core.slices.login.actions.requestUsersMe()
Core.slices.login.actions.resetAccountName()

User slice

Core.slices.user.actions.requestSync()

Timetrackings slice

  Core.slices.timeTrackings.actions.requestRead(PayloadAction<RequestParams<TimeTracking>>)
  Core.slices.timeTrackings.actions.requestReadPayloadAction<TimeTrackingCreate>

TimeTracking types: TimeTracking, TimeTrackingCreate

interface TimeTracking {
  id: number;
  user_id: number;
  task_id: number;
  start_time?: string; // dateTimeString ??
  end_time?: string; // dateTimeString ??
  /**
   * Timezone, eg. Europe/Vienna, that is mandatory if action is CREATE
   */
  start_time_timezone?: string;
  /**
   * Timezone id for start_time
   */
  start_time_timezone_id?: number;
  /**
   * Timezone needs to be set if end_time field value is set
   */
  end_time_timezone?: string;
  /**
   * Timezone id for end_time
   */
  end_time_timezone_id?: number;
  /**
   * The department id to which the timetrackings user (pm_time_tracking.user_id)
   * was assigned at the time start_date of the timeTracking.
   */
  department_id?: number;
  /**
   * The department role id to which the timetrackings user (pm_time_tracking.user_id)
   * was assigned at the time start_date of the timeTracking.
   */
  department_role_id?: number;
  start_time_offset?: number;
  end_time_offset?: number;
  timezone?: string;
  /**
   * Whether the start of the timer was booked live or not
   */
  is_start_live?: boolean;
  /**
   * Whether the end of the timer was booked live or not
   */
  is_end_live?: boolean;
  time?: string;
  duration?: number;
  status?: number;
  start_ip?: string;
  end_ip?: string;
  is_statistic_countable?: boolean;
  max_hours_alert?: boolean;
  input_type?: number;
  t_iv_1?: string;
  /**
   * if 1, admin has approved time tracking entry (no change possible)
   */
  approved_by_admin?: boolean;
  geo_start_lat?: number;
  geo_start_long?: number;
  geo_start_accuracy?: number;
  geo_end_lat?: number;
  geo_end_long?: number;
  geo_end_accuracy?: number;
  geo_lat?: number;
  geo_long?: number;
  geo_accuracy?: number;
  updated?: string;
  /**
   * Id of latest time tracking change request
   */
  last_change_time_tracking_request_id?: number;
  /**
   * Special unique case: If a to-be-inserted value is not null and exists already,
   * the create action should successfully return the existing row instead of creating
   * (and no unique error)
   */
  client_unique_id?: string;
  /**
   * 0 = post-dated, 1 = live, 2 = nfc
   */
  start_type_id?: number;
  /**
   * 0 = post-dated, 1 = live, 2 = nfc
   */
  end_type_id?: number;
  notes?: string;
  is_billable?: boolean;
  is_nonworking?: boolean;
}

interface TimeTrackingCreate extends Omit<TimeTracking, 'id'> {}

State structure

Structure of js-core redux state:

  error: {
    timestamp?: number;
    host?: string;
    Error?: number;
    ErrorMessage?: string;
    ErrorExtended?: Record<string, unknown>;
  }[];
  login: {
    account?: string;
    serverCommunication?: {
      host: string;
      authenticationType: 'AUTHORIZATION_CODE_GRANT' | 'PASSWORD_GRANT';
    };
    user?: User;
    state?: number | string;
    codeVerifier?: string;
    tokens?: {
      accessToken?: string;
      refreshToken?: string;
    };
    rehydrated: boolean;
  };
  initialLoad: {
    completed: boolean;
    startedAt: string | null;
    completedAt: string | null;
    blockingResourcesCompleted: {
      absenceTypes: boolean;
      generalSettings: boolean;
      projects: boolean;
      tasks: boolean;
      users: boolean;
    };
  };
  entities: {
    absenceDays: {
      ids: [],
      entities: {}
    };
    absences: {
      ids: [],
      entities: {}
    };
    absenceTypes: {
      ids: [],
      entities: {}
    };
    favouriteTasks: {
      ids: [],
      entities: {}
    };
    generalSettings: {
      ids: [],
      entities: {}
    };
    projects: {
      ids: [],
      entities: {}
    };
    recentTasks: {
      ids: [],
      entities: {}
    };
    tasks: {
      ids: [],
      entities: {}
    };
    timesheetAccountings: {
      ids: [],
      entities: {}
    };
    todoTasks: {
      ids: [],
      entities: {}
    };
    users: {
      ids: [],
      entities: {}
    };
    userStatusOverviews: {
      ids: [],
      entities: {}
    };
  }
}```
5.2.0

3 years ago

5.1.0

3 years ago

5.0.0

3 years ago

4.1.0

3 years ago

4.0.0

3 years ago

4.3.0

3 years ago

3.1.0

3 years ago

3.0.0

3 years ago

2.9.0

3 years ago

2.8.0

3 years ago

2.7.0

3 years ago

2.6.0

3 years ago

2.5.3

3 years ago

2.5.2

3 years ago

2.5.1

3 years ago

2.5.0

3 years ago

2.4.0

3 years ago

2.3.3

3 years ago

2.3.2

3 years ago

2.3.1

3 years ago

2.3.0

3 years ago

2.2.1

3 years ago

2.2.0

3 years ago

2.1.0

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago