This package has been deprecated

Author message:

Package is no longer supported.

@timetac/js-core
TypeScript icon, indicating that this package has built-in type declarations

5.2.0 • Public • Published

@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: {}
    };
  }
}```

Readme

Keywords

Package Sidebar

Install

npm i @timetac/js-core

Weekly Downloads

0

Version

5.2.0

License

Apache-2.0

Unpacked Size

355 kB

Total Files

258

Last publish

Collaborators

  • sergej.chak
  • tomi.timetac