oro-sdk-apis 3.5.0 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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
  }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.5.0",
2
+ "version": "3.6.0",
3
3
  "main": "dist/index.js",
4
4
  "typings": "dist/index.d.ts",
5
5
  "files": [
@@ -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
  }