oro-sdk 2.13.0 → 2.15.1-dev1

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.
@@ -1,63 +1,4 @@
1
- export declare type FacetFilter = 'type:PHARMACY' | 'type:CLINIC' | 'type:PHARMACY_VIRTUAL';
2
- export interface CliniaResponse<T> {
3
- facets: any;
4
- meta: {
5
- query: string;
6
- page: number;
7
- numPages: number;
8
- perPage: number;
9
- total: number;
10
- };
11
- records: T[];
12
- }
13
- export interface PlaceData {
14
- id: string;
15
- documentType: string;
16
- type: string;
17
- name: string;
18
- address: AddressData;
19
- geoPoint: GeoPointData;
20
- distance: number;
21
- onlineBookingUrl: string;
22
- openingHours: Map<string, Array<IntervalData>>;
23
- phones: Array<PhoneData>;
24
- socials: Array<SocialData>;
25
- note: string;
26
- services: Array<string>;
27
- owner: string;
28
- }
29
- export interface AddressData {
30
- streetAddress: string;
31
- suiteNumber: string;
32
- postalCode: string;
33
- neighborhood: string;
34
- locality: string;
35
- place: string;
36
- region: string;
37
- regionCode: string;
38
- country: string;
39
- countryCode: string;
40
- }
41
- export interface PhoneData {
42
- number: string;
43
- extension: string;
44
- countryCode: string;
45
- type: 'MAIN' | 'ALTERNATE' | 'RECEPTION' | 'FAX' | 'TEXT_TELEPHONE_TTY' | 'INFO' | 'OTHER';
46
- isTollFree: boolean;
47
- province?: string;
48
- }
49
- export interface IntervalData {
50
- start: string;
51
- end: string;
52
- }
53
- export interface GeoPointData {
54
- lat: number;
55
- lng: number;
56
- }
57
- export interface SocialData {
58
- url: string;
59
- type: string;
60
- }
1
+ import { CliniaResponse, FacetFilter, PlaceData } from "oro-sdk-apis";
61
2
  export declare class CliniaService {
62
3
  private url;
63
4
  private locale?;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.13.0",
2
+ "version": "2.15.1-dev1",
3
3
  "main": "dist/index.js",
4
4
  "typings": "dist/index.d.ts",
5
5
  "files": [
@@ -20,12 +20,8 @@
20
20
  "prepare": "tsdx build",
21
21
  "size": "size-limit",
22
22
  "analyze": "size-limit --why",
23
- "package": "tsdx build && npm publish"
24
- },
25
- "husky": {
26
- "hooks": {
27
- "pre-commit": "tsdx lint"
28
- }
23
+ "package": "tsdx build && npm publish",
24
+ "pretty": "prettier --config ../../.prettierrc.yaml --write './src/**/*.{ts,js,json,md}' && prettier --write './*.md'"
29
25
  },
30
26
  "name": "oro-sdk",
31
27
  "author": "Antoine Jaouën <antoine@orohealth.me>",
@@ -45,7 +41,6 @@
45
41
  "@size-limit/preset-small-lib": "^4.10.2",
46
42
  "@types/jest": "^27.4.1",
47
43
  "@types/uuid": "^8.3.0",
48
- "husky": "^6.0.0",
49
44
  "prettier": "^2.5.1",
50
45
  "prettier-plugin-svelte": "^2.3.0",
51
46
  "size-limit": "^4.10.2",
@@ -59,7 +54,7 @@
59
54
  "form-data": "^4.0.0",
60
55
  "formdata-node": "^4.3.1",
61
56
  "idb-keyval": "^5.0.6",
62
- "oro-sdk-apis": "1.9.0",
57
+ "oro-sdk-apis": "1.11.1-dev1",
63
58
  "oro-toolbox": "0.0.6",
64
59
  "uuid": "^8.3.2"
65
60
  }
package/src/client.ts CHANGED
@@ -109,7 +109,8 @@ export class OroClient {
109
109
  practice: Practice,
110
110
  tosAndCpAcceptance: TosAndCpAcceptanceRequest,
111
111
  tokenData?: TokenData,
112
- subscription?: boolean
112
+ subscription?: boolean,
113
+ skipEmailValidation?: boolean
113
114
  ): Promise<IdentityResponse> {
114
115
  this.rsa = new CryptoRSA()
115
116
  const privateKey = this.rsa.private()
@@ -119,9 +120,12 @@ export class OroClient {
119
120
 
120
121
  const hashedPassword = this.toolbox.hashStringToBase64(this.toolbox.hashStringToBase64(password))
121
122
 
123
+ const emailConfirmed = !!skipEmailValidation
124
+
122
125
  const signupRequest: IdentityCreateRequest = {
123
126
  practiceUuid: practice.uuid,
124
127
  email: email.toLowerCase(),
128
+ emailConfirmed,
125
129
  password: hashedPassword,
126
130
  publicKey: this.toolbox.encodeToBase64(this.rsa.public()),
127
131
  recoveryPassword,
@@ -1415,7 +1419,7 @@ export class OroClient {
1415
1419
  recoverySecurityAnswers: string[],
1416
1420
  threshold: number
1417
1421
  ) {
1418
- let shards: SecretShard[] = (await this.guardClient.identityGet(id)).recoverySecurityQuestions
1422
+ let shards: SecretShard[] = (await this.guardClient.identityGet(id)).recoverySecurityQuestions!
1419
1423
  let answeredShards = shards
1420
1424
  .filter((shard: any) => {
1421
1425
  // filters all answered security questions
@@ -1470,7 +1474,7 @@ export class OroClient {
1470
1474
  * @param masterKey
1471
1475
  */
1472
1476
  public async recoverPrivateKeyFromMasterKey(id: Uuid, masterKey: string) {
1473
- let recoveryPayload = (await this.guardClient.identityGet(id)).recoveryMasterKey
1477
+ let recoveryPayload = (await this.guardClient.identityGet(id)).recoveryMasterKey!
1474
1478
  let symmetricDecryptor = this.toolbox.CryptoChaCha.fromPassphrase(masterKey)
1475
1479
  let privateKey = symmetricDecryptor.base64PayloadDecryptToBytes(recoveryPayload)
1476
1480
  this.rsa = this.toolbox.CryptoRSA.fromKey(privateKey)
@@ -14,7 +14,7 @@ import {
14
14
 
15
15
  export async function filterTriggeredAnsweredWithKind(
16
16
  workflowData: WorkflowData,
17
- kind: 'text' | 'date' | 'number' | 'images' | 'images-alias' | 'body-parts' | 'pharmacy-picker'
17
+ kind: 'text' | 'textArea' | 'hybrid' | 'date' | 'number' | 'images' | 'images-alias' | 'body-parts' | 'pharmacy-picker'
18
18
  ): Promise<SelectedAnswerData[]> {
19
19
  if (!workflowData.selectedAnswers) throw WorkflowAnswersMissingError
20
20
 
@@ -120,6 +120,15 @@ async function populateWorkflowField(
120
120
  let displayedAnswer: string | string[] | undefined = undefined
121
121
 
122
122
  switch (question.kind) {
123
+ case 'hybrid':
124
+ if (question.answers) {
125
+ const displayedAnswer1 = question.answers[answerValue as string].text.split(" ")[0]
126
+ const displayedAnswer2 = question.answers[answerValue as string].text.split(" ")[1]
127
+ displayedAnswer = `${displayedAnswer1} ${displayedAnswer2}`
128
+ }
129
+
130
+ answer = answerValue
131
+ break
123
132
  case 'radio':
124
133
  case 'radio-card':
125
134
  case 'select':
@@ -1,5 +1,4 @@
1
- import { PlaceData } from '../services/external/clinia'
2
- import { Uuid } from 'oro-sdk-apis'
1
+ import { PlaceData, Uuid } from 'oro-sdk-apis'
3
2
 
4
3
  export interface PersonalInformations {
5
4
  birthday?: string
@@ -1,79 +1,4 @@
1
- import { AxiosService } from "oro-sdk-apis"
2
-
3
- export type FacetFilter = 'type:PHARMACY' | 'type:CLINIC' | 'type:PHARMACY_VIRTUAL'
4
-
5
- export interface CliniaResponse<T> {
6
- facets: any
7
- meta: {
8
- query: string
9
- page: number
10
- numPages: number
11
- perPage: number
12
- total: number
13
- }
14
- records: T[]
15
- }
16
-
17
- export interface PlaceData {
18
- id: string // The Clinia Id of the resource.
19
- documentType: string // Type of document. This will always be set to health_facility.
20
- type: string // The type of the resource. Possible Place types are detailed here.
21
- name: string // The name of the resource.
22
- address: AddressData // The address of the resource.
23
- geoPoint: GeoPointData // The coordinates of the resource. Useful to locate resource on a map.
24
- distance: number // The distance (in meters) the is from the location used to filter the query.
25
- onlineBookingUrl: string // The url for the online booking system of the resource.
26
- openingHours: Map<string, Array<IntervalData>> // The opening hours of the resource. This object has integers from 1 to 7 as keys, representing days of the week from Monday to Sunday as per ISO 8601.
27
- phones: Array<PhoneData> // Phones associated with this resource.
28
- socials: Array<SocialData> // The social links of the resource. Can be a website or a social media link.
29
- note: string // Special notes on the resource.
30
- services: Array<string> // The services offered by the resource.
31
- owner: string // The owner of the resource in the Clinia ecosystem.
32
- }
33
-
34
- export interface AddressData {
35
- streetAddress: string // Street number plus route name.
36
- suiteNumber: string // Suite, door, appartment number.
37
- postalCode: string // Postal code.
38
- neighborhood: string // Neighborhood.
39
- locality: string // Locality.
40
- place: string // City.
41
- region: string // Name of the region.
42
- regionCode: string // ISO 3166-2 region code.
43
- country: string // Name of the country.
44
- countryCode: string // ISO 3166 country code
45
- }
46
-
47
- export interface PhoneData {
48
- number: string //The phone number.
49
- extension: string //The extension of the phone number.
50
- countryCode: string //The country code associated with this phone number.
51
- type:
52
- | 'MAIN'
53
- | 'ALTERNATE'
54
- | 'RECEPTION'
55
- | 'FAX'
56
- | 'TEXT_TELEPHONE_TTY'
57
- | 'INFO'
58
- | 'OTHER' //The type of phone.
59
- isTollFree: boolean //If the number is toll free or not.
60
- province?: string //If the number is specific to a province
61
- }
62
-
63
- export interface IntervalData {
64
- start: string // Start time of the time interval. Format is HH:mm.
65
- end: string // End time of the time interval. Format is HH:mm.
66
- }
67
-
68
- export interface GeoPointData {
69
- lat: number // Latitude
70
- lng: number // Longitude
71
- }
72
-
73
- export interface SocialData {
74
- url: string // Url representing the link.
75
- type: string // Type of link.
76
- }
1
+ import { AxiosService, CliniaResponse, FacetFilter, PlaceData } from "oro-sdk-apis"
77
2
 
78
3
  export class CliniaService {
79
4
  private api: AxiosService
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2021 ORO Health Inc.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.