Skip to content

Commit

Permalink
[multiple] Adding shared library
Browse files Browse the repository at this point in the history
  • Loading branch information
shilomagen committed Apr 27, 2022
1 parent bab45e2 commit 819af2a
Show file tree
Hide file tree
Showing 47 changed files with 24,925 additions and 2,527 deletions.
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true

[*.{js,json,yml}]
charset = utf-8
indent_style = space
indent_size = 2
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ node_modules
.idea
**/node_modules
**/.serverless
**/dist
.yarn
17,581 changes: 17,581 additions & 0 deletions .pnp.cjs

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
yarnPath: .yarn/releases/yarn-3.2.0.cjs
8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "get-in-line",
"packageManager": "yarn@3.2.0",
"private": true,
"workspaces": [
"packages/*"
]
}
1 change: 1 addition & 0 deletions packages/shared/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# get-in-line - shared library
20 changes: 20 additions & 0 deletions packages/shared/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "@get-in-line/shared",
"version": "1.0.0",
"packageManager": "yarn@3.2.0",
"private": true,
"main": "dist/index.ts",
"types": "dist/index.d.ts",
"scripts": {
"build": "tsc"
},
"devDependencies": {
"@types/node": "^17.0.29",
"tslib": "^2.4.0",
"typescript": "^4.6.3"
},
"dependencies": {
"axios": "^0.27.2",
"date-fns": "^2.28.0"
}
}
46 changes: 46 additions & 0 deletions packages/shared/src/api/appointment-cancel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { CommonResultsResponse } from './common';

export interface AppointmentCancelRequest {
visitId: number;
position: string;
url: string;
}

interface AppointmentCancelResult {
ServiceId: number;
OrganizationId: number;
LocationId: number;
OrganizationName: string;
ServiceName: string;
LocationName: string;
CurrentEntityStatus: number;
CurrentEntityStatusName: string;
CurrentServiceId: number;
QueuePosition: string;
EntityStatusElapsedTime: number;
ReferenceDate: Date;
TicketNumber: string;
Subject: string;
EstimatedWT: number;
SmsAvailable: boolean;
VisitId: number;
QflowProcessId: number;
CancellationAllowed: boolean;
PositionValidated: boolean;
WorkingHoursValidated: boolean;
AllowCustomerToAbandon: boolean;
EarlyArrival: boolean;
EarlinessThreshold: number;
ShowServiceStats: boolean;
ServiceWaitingTime: number;
FreezeDuration: string;
LastSync: number;
IsLateToAppointment: boolean;
CanManageQueue: boolean;
ExtensionTimeAvailable: boolean;
ExtensionTime: number;
ExtensionTimeThreshold: number;
RecallVisitGetInterval: number;
}

export type AppointmentCancelResponse = CommonResultsResponse<AppointmentCancelResult>
48 changes: 48 additions & 0 deletions packages/shared/src/api/appointment-set.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { CommonResultsResponse } from './common';

export interface AppointmentSetRequest {
ServiceId: number;
appointmentDate: string; //2022-08-18T00:00:00
appointmentTime: number; //minutes since midnight
position: string; // {"lat":36,"lng":15,"accuracy":9999}
preparedVisitId: number;
}

export interface AppointmentSetResult {
ServiceId: number;
OrganizationId: number;
LocationId: number;
OrganizationName: string;
ServiceName: string;
LocationName: string;
CurrentEntityStatus: number;
CurrentEntityStatusName: string;
CurrentServiceId: number;
QueuePosition: string;
EntityStatusElapsedTime: number;
ReferenceDate: Date;
TicketNumber: string;
Subject: string;
EstimatedWT: number;
SmsAvailable: boolean;
VisitId: number;
QflowProcessId: number;
CancellationAllowed: boolean;
PositionValidated: boolean;
WorkingHoursValidated: boolean;
AllowCustomerToAbandon: boolean;
EarlyArrival: boolean;
EarlinessThreshold: number;
ShowServiceStats: boolean;
ServiceWaitingTime: number;
FreezeDuration: string;
LastSync: number;
IsLateToAppointment: boolean;
CanManageQueue: boolean;
ExtensionTimeAvailable: boolean;
ExtensionTime: number;
ExtensionTimeThreshold: number;
RecallVisitGetInterval: number;
}

export type AppointmentSetResponse = CommonResultsResponse<AppointmentSetResult>
19 changes: 19 additions & 0 deletions packages/shared/src/api/common.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
interface CommonResponse {
Success: boolean;
Page: number;
ResultsPerPage: number;
TotalResults: number;
ErrorMessage?: any;
ErrorNumber: number;
Messages?: any;
}

export interface CommonResultsResponse<T> extends CommonResponse {
Results: T | null;
}

export interface CommonDataResponse<T> extends CommonResponse{
Data: T
}


15 changes: 15 additions & 0 deletions packages/shared/src/api/create-session.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { CommonResultsResponse } from './common';

export interface CreateSessionRequest {
isPersistent: boolean;
useCookie: boolean;
}

interface CreateSessionResult {
token: string;
username: string;
}

export type CreateSessionResponse = CommonResultsResponse<CreateSessionResult>


9 changes: 9 additions & 0 deletions packages/shared/src/api/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export * from './appointment-set';
export * from './appointment-cancel';
export * from './common';
export * from './create-session';
export * from './location-search';
export * from './location-services';
export * from './prepare-visit';
export * from './search-available-dates';
export * from './search-available-slots';
47 changes: 47 additions & 0 deletions packages/shared/src/api/location-search.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { CommonResultsResponse } from './common';

export interface LocationSearchRequest {
currentPage?: number;
isFavorite?: boolean;
orderBy?: string;
organizationId: number;
resultsInPage?: number;
serviceTypeId?: number;
src?: string;
}

export interface LocationSearchResult {
OrganizationId: number;
OrganizationName: string;
LocationId: number;
LocationName: string;
Address1: string;
Address2: string;
City: string;
State: string;
Country: string;
Description: string;
Directions: string;
ZipCode: string;
Latitude: number;
Longitude: number;
Distance: number;
WaitingTime: number;
ShowStats: boolean;
IsFavorite: boolean;
ServiceCount: number;
LastUseDate: string;
HasCalendarService: boolean;
HasFIFOService: boolean;
ServiceId: number;
ServiceHasFIFO: boolean;
DynamicFormsEnabled: boolean;
PhoneNumber: string;
ExtRef: string;
ServiceTypeId: number;
MaxWaitingTime: number;
}

export type LocationSearchResponse = CommonResultsResponse<LocationSearchResult[]>


28 changes: 28 additions & 0 deletions packages/shared/src/api/location-services.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { CommonResultsResponse } from './common';

export interface LocationServicesRequest {
currentPage?: number;
isFavorite?: boolean;
orderBy?: string;
locationId: number;
resultsInPage?: number;
serviceTypeId?: number;
}

export interface LocationServicesResult {
serviceId: number;
serviceName: string;
serviceDescription: string;
ServiceTypeId: number;
serviceTypeDescription: string;
description: string;
showStats: boolean;
waitingTime: number;
HasCalendarService: boolean;
DynamicFormsEnabled: boolean;
HasFIFOService: boolean;
ExtRef: string;
LocationId: number;
}
export type LocationServicesResponse = CommonResultsResponse<LocationServicesResult[]>

87 changes: 87 additions & 0 deletions packages/shared/src/api/prepare-visit.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import { CommonDataResponse } from './common';

export interface PrepareVisitRequest {
}

export interface AnswerQuestionRequest {
PreparedVisitToken: string;
QuestionnaireItemId: number;
QuestionId: number;
AnswerIds: number[] | null;
AnswerText: string | null;
}

export interface Validation {
Messages: any[];
}

export interface NavigationState {
State?: any;
OrganizationId: number;
ServiceTypeId: number;
LocationId: number;
ServiceId: number;
QflowServiceId: number;
}


export interface Question {
AskOncePerCustomer: boolean;
QuestionId: number;
OrganizationId: number;
IsActive: boolean;
Title: string;
Text: string;
Description: string;
CustomErrorText: string;
Type: number;
MappedTo: number;
MappedToCustomerCustomPropertyId: number;
MappedToProcessCustomPropertyId: number;
MappedToPropertyName: string;
Required: boolean;
ValidateAnswerOnQFlow: boolean;
ValidateAnswerOnClient: boolean;
ValidationExpression: string;
QuestionKey: string;
Answers: any[];
ExtRef: string;
SaveAnswerWithAppointment: boolean;
}

export interface QuestionnaireItem {
QuestionnaireItemId: number;
ServiceTypeId: number;
OrganizationId?: any;
QuestionId: number;
Position: number;
IsActive: boolean;
Question: Question;
}

export interface NavigationState {
State?: any;
OrganizationId: number;
ServiceTypeId: number;
LocationId: number;
ServiceId: number;
QflowServiceId: number;
}


export interface PrepareVisitData {
PreparedVisitId: number;
UserId: number;
ServiceId: number;
ServiceTypeId: number;
OrganizationId?: any;
DateCreated: Date;
PreparedVisitToken: string;
QuestionnaireItem: QuestionnaireItem;
Validation?: Validation;
NavigationState?: NavigationState;
IsUserIdentify?: any;
}

export type PrepareVisitResponse = CommonDataResponse<PrepareVisitData>

15 changes: 15 additions & 0 deletions packages/shared/src/api/search-available-dates.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { CommonResultsResponse } from './common';

export interface SearchAvailableDatesRequest {
maxResults?:number;
serviceId:number;
startDate: string; //YYYY-MM-DD
}

export interface SearchAvailableDatesResult {
calendarDate: string;
calendarId: number;
}
export type SearchAvailableDatesResponse = CommonResultsResponse<SearchAvailableDatesResult[]>


13 changes: 13 additions & 0 deletions packages/shared/src/api/search-available-slots.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { CommonResultsResponse } from './common';

export interface SearchAvailableSlotsRequest {
CalendarId: number;
ServiceId: number;
dayPart: number;
}

interface SearchAvailableSlotsResult {
Time: number; // minutes since midnight
}

export type SearchAvailableSlotsResponse = CommonResultsResponse<SearchAvailableSlotsResult[]>
6 changes: 6 additions & 0 deletions packages/shared/src/consts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export const OrganizationID = 56;
export const MockPosition = JSON.stringify({ lat: 36, lng: 15, accuracy: 9999 });

export enum ServiceIds {
BiometricPassportAppointment = 156
}
Loading

0 comments on commit 819af2a

Please sign in to comment.