-
Notifications
You must be signed in to change notification settings - Fork 2
feat: add LocationService.createInputField method #833
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
be082f7
feat: add LocationService.createInputField method
2ndalpha 46c07fb
style: format test file with prettier
2ndalpha 7504454
refactor: split input field types into dedicated files
2ndalpha 306509e
refactor: extract LocationRef and LineRef types
2ndalpha 8feee76
chore: remove unnecessary UUID comments
2ndalpha b3e3565
refactor: extract shared V2_HEADERS constant and add FIRST_NAME test
2ndalpha 753f975
fix: address PR review feedback for createInputField
2ndalpha File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
packages/javascript-api/src/lib/model/input-field/date-field-creation-request.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import { InputFieldBase } from './input-field-base.js'; | ||
| import { InputFieldTranslation } from './input-field-translation.js'; | ||
|
|
||
| export interface DateFieldCreationRequest extends InputFieldBase { | ||
| type: 'DATE'; | ||
| title: string; | ||
| visitorFacingTitle?: string; | ||
| translations?: InputFieldTranslation[]; | ||
| } |
6 changes: 6 additions & 0 deletions
6
packages/javascript-api/src/lib/model/input-field/email-field-creation-request.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import { InputFieldBase } from './input-field-base.js'; | ||
|
|
||
| export interface EmailFieldCreationRequest extends InputFieldBase { | ||
| type: 'EMAIL'; | ||
| isRequiredInAppointments: boolean; | ||
| } |
5 changes: 5 additions & 0 deletions
5
packages/javascript-api/src/lib/model/input-field/first-name-field-creation-request.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import { InputFieldBase } from './input-field-base.js'; | ||
|
|
||
| export interface FirstNameFieldCreationRequest extends InputFieldBase { | ||
| type: 'FIRST_NAME'; | ||
| } |
15 changes: 15 additions & 0 deletions
15
packages/javascript-api/src/lib/model/input-field/input-field-base.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import { LineRef } from './line-ref.js'; | ||
| import { LocationRef } from './location-ref.js'; | ||
| import { UUID } from '../uuid.js'; | ||
|
|
||
| export interface InputFieldBase { | ||
| id: UUID; | ||
| location: LocationRef; | ||
| isMandatoryBeforeAdded: boolean; | ||
| isMandatoryBeforeServed: boolean; | ||
| isMandatoryInRemoteSignIn: boolean; | ||
| isVisibleInWaitingDrawer: boolean; | ||
| isVisibleInServingDrawer: boolean; | ||
| visibleForLines: LineRef[]; | ||
| showInRemoteSignIn: boolean; | ||
| } |
24 changes: 24 additions & 0 deletions
24
packages/javascript-api/src/lib/model/input-field/input-field-creation-request.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import { DateFieldCreationRequest } from './date-field-creation-request.js'; | ||
| import { EmailFieldCreationRequest } from './email-field-creation-request.js'; | ||
| import { FirstNameFieldCreationRequest } from './first-name-field-creation-request.js'; | ||
| import { LastNameFieldCreationRequest } from './last-name-field-creation-request.js'; | ||
| import { NumericFieldCreationRequest } from './numeric-field-creation-request.js'; | ||
| import { PhoneNumberFieldCreationRequest } from './phone-number-field-creation-request.js'; | ||
| import { SelectFieldCreationRequest } from './select-field-creation-request.js'; | ||
| import { TextFieldCreationRequest } from './text-field-creation-request.js'; | ||
| import { UrlFieldCreationRequest } from './url-field-creation-request.js'; | ||
|
|
||
| /** | ||
| * A discriminated union of all input field creation request types. | ||
| * The `type` field determines which properties are available. | ||
| */ | ||
| export type InputFieldCreationRequest = | ||
| | TextFieldCreationRequest | ||
| | SelectFieldCreationRequest | ||
| | EmailFieldCreationRequest | ||
| | PhoneNumberFieldCreationRequest | ||
| | FirstNameFieldCreationRequest | ||
| | LastNameFieldCreationRequest | ||
| | UrlFieldCreationRequest | ||
| | DateFieldCreationRequest | ||
| | NumericFieldCreationRequest; |
5 changes: 5 additions & 0 deletions
5
packages/javascript-api/src/lib/model/input-field/input-field-translation.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| export interface InputFieldTranslation { | ||
| languageCode: string; | ||
| title?: string; | ||
| visitorFacingTitle?: string; | ||
| } |
6 changes: 6 additions & 0 deletions
6
packages/javascript-api/src/lib/model/input-field/last-name-field-creation-request.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import { InputFieldBase } from './input-field-base.js'; | ||
|
|
||
| export interface LastNameFieldCreationRequest extends InputFieldBase { | ||
| type: 'LAST_NAME'; | ||
| isRequiredInAppointments?: boolean; | ||
| } |
3 changes: 3 additions & 0 deletions
3
packages/javascript-api/src/lib/model/input-field/line-ref.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| export interface LineRef { | ||
| id: number; | ||
| } |
3 changes: 3 additions & 0 deletions
3
packages/javascript-api/src/lib/model/input-field/location-ref.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| export interface LocationRef { | ||
| id: number; | ||
| } |
5 changes: 5 additions & 0 deletions
5
packages/javascript-api/src/lib/model/input-field/numeric-field-constraints.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| export interface NumericFieldConstraints { | ||
| min?: number; | ||
| max?: number; | ||
| scale: number; | ||
| } |
11 changes: 11 additions & 0 deletions
11
packages/javascript-api/src/lib/model/input-field/numeric-field-creation-request.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import { InputFieldBase } from './input-field-base.js'; | ||
| import { InputFieldTranslation } from './input-field-translation.js'; | ||
| import { NumericFieldConstraints } from './numeric-field-constraints.js'; | ||
|
|
||
| export interface NumericFieldCreationRequest extends InputFieldBase { | ||
| type: 'NUMERIC'; | ||
| title: string; | ||
| visitorFacingTitle?: string; | ||
| translations?: InputFieldTranslation[]; | ||
| constraints?: NumericFieldConstraints; | ||
| } |
5 changes: 5 additions & 0 deletions
5
packages/javascript-api/src/lib/model/input-field/phone-number-field-creation-request.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import { InputFieldBase } from './input-field-base.js'; | ||
|
|
||
| export interface PhoneNumberFieldCreationRequest extends InputFieldBase { | ||
| type: 'PHONE_NUMBER'; | ||
| } |
12 changes: 12 additions & 0 deletions
12
packages/javascript-api/src/lib/model/input-field/select-field-creation-request.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import { InputFieldBase } from './input-field-base.js'; | ||
| import { InputFieldTranslation } from './input-field-translation.js'; | ||
| import { SelectOption } from './select-option.js'; | ||
|
|
||
| export interface SelectFieldCreationRequest extends InputFieldBase { | ||
| type: 'SELECT'; | ||
| title: string; | ||
| visitorFacingTitle?: string; | ||
| multiSelect: boolean; | ||
| options: SelectOption[]; | ||
| translations?: InputFieldTranslation[]; | ||
| } |
4 changes: 4 additions & 0 deletions
4
packages/javascript-api/src/lib/model/input-field/select-option-translation.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| export interface SelectOptionTranslation { | ||
| languageCode: string; | ||
| title?: string; | ||
| } |
9 changes: 9 additions & 0 deletions
9
packages/javascript-api/src/lib/model/input-field/select-option.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import { UUID } from '../uuid.js'; | ||
| import { SelectOptionTranslation } from './select-option-translation.js'; | ||
|
|
||
| export interface SelectOption { | ||
| id: UUID; | ||
| title: string; | ||
| color?: string; | ||
| translations?: SelectOptionTranslation[]; | ||
| } |
9 changes: 9 additions & 0 deletions
9
packages/javascript-api/src/lib/model/input-field/text-field-creation-request.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import { InputFieldBase } from './input-field-base.js'; | ||
| import { InputFieldTranslation } from './input-field-translation.js'; | ||
|
|
||
| export interface TextFieldCreationRequest extends InputFieldBase { | ||
| type: 'TEXT'; | ||
| title: string; | ||
| visitorFacingTitle?: string; | ||
| translations?: InputFieldTranslation[]; | ||
| } |
8 changes: 8 additions & 0 deletions
8
packages/javascript-api/src/lib/model/input-field/url-field-creation-request.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import { InputFieldBase } from './input-field-base.js'; | ||
| import { InputFieldTranslation } from './input-field-translation.js'; | ||
|
|
||
| export interface UrlFieldCreationRequest extends InputFieldBase { | ||
| type: 'URL'; | ||
| title: string; | ||
| translations?: InputFieldTranslation[]; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export const V2_HEADERS = { 'X-Qminder-API-Version': '2020-09-01' } as const; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.