oro-sdk-apis 3.5.0 → 3.7.0-dev1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,11 +15,11 @@ export declare class ApisPracticeManager {
15
15
  * @param getAuthTokenCbk the callback function used to get a new JWT token
16
16
  * @param useLocalStorage (default: false) if true store tokens into local storage (only for browsers)
17
17
  */
18
- constructor(serviceCollReq: ServiceCollectionRequest, getAuthTokenCbk: (guard: GuardService, practiceUuid: string) => Promise<AuthTokenResponse>, useLocalStorage?: boolean);
18
+ constructor(serviceCollReq: ServiceCollectionRequest, getAuthTokenCbk: (guard: GuardService, practiceUuid?: string) => Promise<AuthTokenResponse>, useLocalStorage?: boolean);
19
19
  /**
20
20
  * This function is used to get a `ServiceCollection` associated to a practice. If missing, it will initialize a new `ServiceCollection`.
21
21
  * @param practiceUuid the uuid of the practice
22
22
  * @returns a promise holding a `ServiceCollection`
23
23
  */
24
- get(practiceUuid: string): Promise<ServiceCollection>;
24
+ get(practiceUuid?: string): Promise<ServiceCollection>;
25
25
  }
@@ -5,6 +5,12 @@ export declare class PracticeService {
5
5
  private api;
6
6
  private baseURL;
7
7
  constructor(api: APIService, baseURL: string);
8
+ /**
9
+ * This function will only work if the service is initialized with
10
+ * an M2M with the scope `practice.practices.get`
11
+ * @returns an array of practices
12
+ */
13
+ practiceGetAll(): Promise<Practice[]>;
8
14
  /**
9
15
  * This function get the practice from the URL of a practice
10
16
  * It is the entry point of our web apps
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.5.0",
2
+ "version": "3.7.0-dev1.0",
3
3
  "main": "dist/index.js",
4
4
  "typings": "dist/index.d.ts",
5
5
  "files": [
@@ -55,4 +55,4 @@
55
55
  "buffer": "^6.0.3",
56
56
  "hash.js": "^1.1.7"
57
57
  }
58
- }
58
+ }
@@ -33,6 +33,7 @@ export interface TreatmentRequest {
33
33
  name: string
34
34
  description: string
35
35
  refillable?: boolean
36
+ noteToPharmacy?: string
36
37
  urlMultimedia?: string
37
38
  type?: TreatmentType
38
39
  }
@@ -105,7 +106,6 @@ export interface TreatmentPlan {
105
106
  uuidConsult: string
106
107
  uuidDiagnosis: string
107
108
  uuidTreatment?: string
108
- notes?: string
109
109
  status: PlanStatus
110
110
  decidedAt: string
111
111
  createdAt: string
@@ -118,7 +118,6 @@ export interface DrugPrescription {
118
118
 
119
119
  export interface TreatmentAndDrugPrescription {
120
120
  treatmentsHistory?: TreatmentHistory[]
121
- notes?: string
122
121
  status: PlanStatus
123
122
  uuidTreatmentPlan: string
124
123
  /**
@@ -153,7 +152,6 @@ export interface TreatmentAndDrugPrescriptionRequest {
153
152
  trackingId: string
154
153
  treatment: TreatmentRequest
155
154
  prescriptionsAndDrugs?: DrugPrescriptionRequest[]
156
- notes?: string
157
155
  }
158
156
 
159
157
  export interface TreatmentPlansRequest {
@@ -165,7 +163,6 @@ export interface TreatmentPlansRequest {
165
163
  export interface TreatmentAndDrugPrescriptionUpdateRequest {
166
164
  treatment: Treatment
167
165
  prescriptionsAndDrugs?: DrugPrescriptionRequest[]
168
- notes?: string
169
166
  }
170
167
 
171
168
  export interface TreatmentPlanUpdateRequest extends TreatmentPlansRequest {
@@ -75,9 +75,16 @@ export interface TileRadioData extends ChoiceInputData {
75
75
  description?: string
76
76
  }
77
77
 
78
+ export enum InputApplyFunctions { //these are generic metadata categories
79
+ MakeUpperCase = 'MakeUpperCase',
80
+ MakeLowerCase = 'MakeLowerCase',
81
+ RemoveAllSpaces = 'RemoveAllSpaces',
82
+ }
83
+
78
84
  export interface EntryData {
79
85
  id?: number
80
86
  label?: string
87
+ inputApply?: InputApplyFunctions | InputApplyFunctions[]
81
88
  hideLabel?: boolean
82
89
  minorLabel?: string
83
90
  summaryLabel?: string
@@ -200,25 +207,25 @@ export interface GroupedGenericQuestionData<T, A = IndexedData<ChoiceInputData>>
200
207
  export declare type QuestionData =
201
208
  | GenericQuestionData<'title' | 'paragraph' | 'checkbox', void>
202
209
  | GenericQuestionData<
203
- | 'text'
204
- | 'text-area'
205
- | 'date'
206
- | 'number'
207
- | 'images'
208
- | 'body-parts'
209
- | 'pharmacy-picker'
210
- | 'online-pharmacy-picker'
211
- | 'place-address'
212
- >
210
+ | 'text'
211
+ | 'text-area'
212
+ | 'date'
213
+ | 'number'
214
+ | 'images'
215
+ | 'body-parts'
216
+ | 'pharmacy-picker'
217
+ | 'online-pharmacy-picker'
218
+ | 'place-address'
219
+ >
213
220
  | GenericQuestionData<'images-alias', IndexedData<ChoiceInputData>, ImagesAliasQuestionOptions>
214
221
  | GenericQuestionData<
215
- 'checkbox-group' | 'hair-loss-frontal' | 'select' | 'multiple' | 'text-select-group',
216
- IndexedData<ChoiceInputData>
217
- >
222
+ 'checkbox-group' | 'hair-loss-frontal' | 'select' | 'multiple' | 'text-select-group',
223
+ IndexedData<ChoiceInputData>
224
+ >
218
225
  | GroupedGenericQuestionData<
219
- 'radio' | 'hair-selector-women' | 'hair-selector-men' | 'hair-loss-stage' | 'hair-loss-other',
220
- IndexedData<RadioInputData>
221
- >
226
+ 'radio' | 'hair-selector-women' | 'hair-selector-men' | 'hair-loss-stage' | 'hair-loss-other',
227
+ IndexedData<RadioInputData>
228
+ >
222
229
  | GroupedGenericQuestionData<'radio-card' | 'profile-selector', IndexedData<RadioCardInputData>>
223
230
  | GroupedGenericQuestionData<'language-picker', IndexedData<LanguagePickerData>>
224
231
  | GroupedGenericQuestionData<'tile-radio', IndexedData<TileRadioData>>
@@ -331,4 +338,4 @@ export interface PopulatedWorkflowData {
331
338
  workflowCreatedAt: string // The workflow version
332
339
  locale?: string
333
340
  fields: Record<string, PopulatedWorkflowField> // key corresponds to the QuestionData key in the workflow
334
- }
341
+ }
@@ -17,7 +17,7 @@ export class ApisPracticeManager {
17
17
  */
18
18
  constructor(
19
19
  private serviceCollReq: ServiceCollectionRequest,
20
- private getAuthTokenCbk: (guard: GuardService, practiceUuid: string) => Promise<AuthTokenResponse>,
20
+ private getAuthTokenCbk: (guard: GuardService, practiceUuid?: string) => Promise<AuthTokenResponse>,
21
21
  private useLocalStorage = false
22
22
  ) {}
23
23
 
@@ -26,8 +26,9 @@ export class ApisPracticeManager {
26
26
  * @param practiceUuid the uuid of the practice
27
27
  * @returns a promise holding a `ServiceCollection`
28
28
  */
29
- public async get(practiceUuid: string): Promise<ServiceCollection> {
30
- const practiceInstance = this.practiceInstances.get(practiceUuid)
29
+ public async get(practiceUuid?: string): Promise<ServiceCollection> {
30
+ const cacheKey = practiceUuid ?? 'none'
31
+ const practiceInstance = this.practiceInstances.get(cacheKey)
31
32
  if (practiceInstance) return practiceInstance
32
33
 
33
34
  const newPracticeInstance = init(this.serviceCollReq, undefined, this.useLocalStorage)
@@ -48,7 +49,7 @@ export class ApisPracticeManager {
48
49
  // Set the refresh tokens callback
49
50
  newPracticeInstance.apiService.setAuthRefreshFn(authTokenFunc)
50
51
 
51
- this.practiceInstances.set(practiceUuid, newPracticeInstance)
52
+ this.practiceInstances.set(cacheKey, newPracticeInstance)
52
53
 
53
54
  return newPracticeInstance
54
55
  }
@@ -1,5 +1,5 @@
1
1
  import { hashToBase64String } from '../helpers'
2
- import {PaymentStatus, PracticeAccount, Uuid} from '../models'
2
+ import { PaymentStatus, PracticeAccount, Uuid } from '../models'
3
3
  import {
4
4
  Assignment,
5
5
  AssignmentRequest,
@@ -27,6 +27,15 @@ import { APIService } from './api'
27
27
  export class PracticeService {
28
28
  constructor(private api: APIService, private baseURL: string) {}
29
29
 
30
+ /**
31
+ * This function will only work if the service is initialized with
32
+ * an M2M with the scope `practice.practices.get`
33
+ * @returns an array of practices
34
+ */
35
+ public practiceGetAll(): Promise<Practice[]> {
36
+ return this.api.get<Practice[]>(`${this.baseURL}/v1/practices`)
37
+ }
38
+
30
39
  /**
31
40
  * This function get the practice from the URL of a practice
32
41
  * It is the entry point of our web apps
@@ -154,14 +163,14 @@ export class PracticeService {
154
163
  statusPayment?: PaymentStatus,
155
164
  withConsultUUIDNULL?: boolean,
156
165
  perPage?: number,
157
- indexPage?: number,
158
- ): Promise<PracticePayment[]> {
166
+ indexPage?: number
167
+ ): Promise<PracticePayment[]> {
159
168
  return this.api.get<PracticePayment[]>(`${this.baseURL}/v1/practices/${practiceUuid}/payments`, {
160
169
  params: {
161
170
  status: statusPayment,
162
171
  withConsultUUIDNULL,
163
172
  perPage,
164
- indexPage
173
+ indexPage,
165
174
  },
166
175
  })
167
176
  }