oro-sdk-apis 1.9.0 → 1.11.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.
- package/dist/models/external/clinia.d.ts +60 -0
- package/dist/models/external/index.d.ts +1 -0
- package/dist/models/guard.d.ts +1 -0
- package/dist/models/index.d.ts +1 -0
- package/dist/models/practice.d.ts +11 -12
- package/dist/models/workflow.d.ts +3 -1
- package/dist/oro-sdk-apis.cjs.development.js +80 -3
- package/dist/oro-sdk-apis.cjs.development.js.map +1 -1
- package/dist/oro-sdk-apis.cjs.production.min.js +1 -1
- package/dist/oro-sdk-apis.cjs.production.min.js.map +1 -1
- package/dist/oro-sdk-apis.esm.js +80 -3
- package/dist/oro-sdk-apis.esm.js.map +1 -1
- package/dist/services/guard.d.ts +14 -0
- package/dist/services/practice.d.ts +13 -2
- package/package.json +4 -9
- package/src/models/external/clinia.ts +75 -0
- package/src/models/external/index.ts +1 -0
- package/src/models/guard.ts +1 -0
- package/src/models/index.ts +1 -0
- package/src/models/practice.ts +14 -6
- package/src/models/workflow.ts +3 -1
- package/src/services/guard.ts +29 -1
- package/src/services/practice.ts +17 -7
- package/LICENSE +0 -21
package/dist/services/guard.d.ts
CHANGED
|
@@ -97,4 +97,18 @@ export declare class GuardService {
|
|
|
97
97
|
* @return void
|
|
98
98
|
*/
|
|
99
99
|
identitySendConfirmEmail(req: IdentityResendConfirmEmailRequest): Promise<void>;
|
|
100
|
+
/**
|
|
101
|
+
* Get an identity using a customer email (format: customer+[b64Hash]@orohealth.me)
|
|
102
|
+
*
|
|
103
|
+
* @param email the customer email
|
|
104
|
+
* @returns IdentityResponse
|
|
105
|
+
*/
|
|
106
|
+
identityGetByCustomerEmail(email: string): Promise<IdentityResponse>;
|
|
107
|
+
/**
|
|
108
|
+
* Get an identity using a base64 hash
|
|
109
|
+
*
|
|
110
|
+
* @param b64Hash base64 hash of the identity
|
|
111
|
+
* @returns IdentityResponse
|
|
112
|
+
*/
|
|
113
|
+
identityGetByHash(b64Hash: string): Promise<IdentityResponse>;
|
|
100
114
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PracticeAccount, Uuid } from '../models';
|
|
1
|
+
import { ConsultRequestMetadata, PracticeAccount, Uuid } from '../models';
|
|
2
2
|
import { Assignment, PlanType, Practice, PracticeConfigKind, PracticeConfigs, PracticeInvoice, PracticePayment, PracticePaymentIntent, PracticePlan, PracticePlanPrices, PracticeWorkflow, PracticeWorkflowWithTagSpecialty, Practitioner, PractitionerLicense, PractitionerPreference, PractitionerQuota, PractitionerRole, WorkflowType } from '../models/practice';
|
|
3
3
|
import { APIService } from './api';
|
|
4
4
|
export declare class PracticeService {
|
|
@@ -62,7 +62,18 @@ export declare class PracticeService {
|
|
|
62
62
|
* @returns a hashed email
|
|
63
63
|
*/
|
|
64
64
|
getPaymentIntentHashedEmail(email: string): string;
|
|
65
|
-
|
|
65
|
+
/**
|
|
66
|
+
* Creates a PracticePaymentIntent
|
|
67
|
+
* @param practiceUuid the uuid of the practice
|
|
68
|
+
* @param planId the plan id to use
|
|
69
|
+
* @param userEmail the email address of the user
|
|
70
|
+
* @param isoLocality (optional) the desired locality
|
|
71
|
+
* @param url_subdomain (optional) the url of the sub domain (@bruno-morel need you to document that)
|
|
72
|
+
* @param promotionCode (optional) promotion code to apply
|
|
73
|
+
* @param consultRequest (optional) consult request to use. If defined, when payment service call our hooks in practice, it will try to create a consult with these infos.
|
|
74
|
+
* @returns
|
|
75
|
+
*/
|
|
76
|
+
practiceCreatePaymentsIntent(practiceUuid: Uuid, planId: number, userEmail: string, isoLocality?: string, url_subdomain?: string, promotionCode?: string, consultRequest?: ConsultRequestMetadata): Promise<PracticePaymentIntent>;
|
|
66
77
|
practiceGetPaymentsIntent(practiceUuid: Uuid, paymentIntentId: number): Promise<PracticePaymentIntent>;
|
|
67
78
|
practiceUpdatePaymentsIntent(practiceUuid: string, idPraticePaymentIntent: number, practicePaymentIntent: PracticePaymentIntent, userEmail: string, promotionCode?: string): Promise<PracticePaymentIntent>;
|
|
68
79
|
/**
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.11.1-dev1",
|
|
3
3
|
"main": "dist/index.js",
|
|
4
4
|
"typings": "dist/index.d.ts",
|
|
5
5
|
"files": [
|
|
@@ -19,12 +19,8 @@
|
|
|
19
19
|
"prepare": "tsdx build",
|
|
20
20
|
"size": "size-limit",
|
|
21
21
|
"analyze": "size-limit --why",
|
|
22
|
-
"package": "tsdx build && npm publish"
|
|
23
|
-
|
|
24
|
-
"husky": {
|
|
25
|
-
"hooks": {
|
|
26
|
-
"pre-commit": "tsdx lint"
|
|
27
|
-
}
|
|
22
|
+
"package": "tsdx build && npm publish",
|
|
23
|
+
"pretty": "prettier --config ../../.prettierrc.yaml --write './src/**/*.{ts,js,json,md}' && prettier --write './*.md'"
|
|
28
24
|
},
|
|
29
25
|
"name": "oro-sdk-apis",
|
|
30
26
|
"author": "Antoine Jaouën <antoine@orohealth.me>",
|
|
@@ -45,8 +41,7 @@
|
|
|
45
41
|
"@types/jest": "^27.4.1",
|
|
46
42
|
"@types/sha.js": "^2.4.0",
|
|
47
43
|
"@types/uuid": "^8.3.0",
|
|
48
|
-
"
|
|
49
|
-
"prettier": "^2.5.1",
|
|
44
|
+
"prettier": "^2.6.1",
|
|
50
45
|
"prettier-plugin-svelte": "^2.3.0",
|
|
51
46
|
"size-limit": "^4.10.2",
|
|
52
47
|
"tsdx": "^0.14.1",
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
|
|
2
|
+
export type FacetFilter = 'type:PHARMACY' | 'type:CLINIC' | 'type:PHARMACY_VIRTUAL'
|
|
3
|
+
|
|
4
|
+
export interface CliniaResponse<T> {
|
|
5
|
+
facets: any
|
|
6
|
+
meta: {
|
|
7
|
+
query: string
|
|
8
|
+
page: number
|
|
9
|
+
numPages: number
|
|
10
|
+
perPage: number
|
|
11
|
+
total: number
|
|
12
|
+
}
|
|
13
|
+
records: T[]
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface PlaceData {
|
|
17
|
+
id: string // The Clinia Id of the resource.
|
|
18
|
+
documentType: string // Type of document. This will always be set to health_facility.
|
|
19
|
+
type: string // The type of the resource. Possible Place types are detailed here.
|
|
20
|
+
name: string // The name of the resource.
|
|
21
|
+
address: AddressData // The address of the resource.
|
|
22
|
+
geoPoint: GeoPointData // The coordinates of the resource. Useful to locate resource on a map.
|
|
23
|
+
distance: number // The distance (in meters) the is from the location used to filter the query.
|
|
24
|
+
onlineBookingUrl: string // The url for the online booking system of the resource.
|
|
25
|
+
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.
|
|
26
|
+
phones: Array<PhoneData> // Phones associated with this resource.
|
|
27
|
+
socials: Array<SocialData> // The social links of the resource. Can be a website or a social media link.
|
|
28
|
+
note: string // Special notes on the resource.
|
|
29
|
+
services: Array<string> // The services offered by the resource.
|
|
30
|
+
owner: string // The owner of the resource in the Clinia ecosystem.
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface AddressData {
|
|
34
|
+
streetAddress: string // Street number plus route name.
|
|
35
|
+
suiteNumber: string // Suite, door, appartment number.
|
|
36
|
+
postalCode: string // Postal code.
|
|
37
|
+
neighborhood: string // Neighborhood.
|
|
38
|
+
locality: string // Locality.
|
|
39
|
+
place: string // City.
|
|
40
|
+
region: string // Name of the region.
|
|
41
|
+
regionCode: string // ISO 3166-2 region code.
|
|
42
|
+
country: string // Name of the country.
|
|
43
|
+
countryCode: string // ISO 3166 country code
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface PhoneData {
|
|
47
|
+
number: string //The phone number.
|
|
48
|
+
extension: string //The extension of the phone number.
|
|
49
|
+
countryCode: string //The country code associated with this phone number.
|
|
50
|
+
type:
|
|
51
|
+
| 'MAIN'
|
|
52
|
+
| 'ALTERNATE'
|
|
53
|
+
| 'RECEPTION'
|
|
54
|
+
| 'FAX'
|
|
55
|
+
| 'TEXT_TELEPHONE_TTY'
|
|
56
|
+
| 'INFO'
|
|
57
|
+
| 'OTHER' //The type of phone.
|
|
58
|
+
isTollFree: boolean //If the number is toll free or not.
|
|
59
|
+
province?: string //If the number is specific to a province
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface IntervalData {
|
|
63
|
+
start: string // Start time of the time interval. Format is HH:mm.
|
|
64
|
+
end: string // End time of the time interval. Format is HH:mm.
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface GeoPointData {
|
|
68
|
+
lat: number // Latitude
|
|
69
|
+
lng: number // Longitude
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface SocialData {
|
|
73
|
+
url: string // Url representing the link.
|
|
74
|
+
type: string // Type of link.
|
|
75
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './clinia'
|
package/src/models/guard.ts
CHANGED
|
@@ -44,6 +44,7 @@ export interface WhoAmIResponse {
|
|
|
44
44
|
export interface IdentityCreateRequest {
|
|
45
45
|
practiceUuid: Uuid
|
|
46
46
|
email: string
|
|
47
|
+
emailConfirmed?: boolean //In any env that aren't production, you can skip the email verification. Useful to write tests for instance.
|
|
47
48
|
password: Base64String
|
|
48
49
|
publicKey: Base64String
|
|
49
50
|
recoveryPassword: Base64String
|
package/src/models/index.ts
CHANGED
package/src/models/practice.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { PlaceData } from "."
|
|
2
|
+
|
|
1
3
|
export enum WorkflowType {
|
|
2
4
|
Onboard = 'Onboard',
|
|
3
5
|
Followup = 'Followup',
|
|
@@ -156,11 +158,7 @@ export type PracticeConfigPractitionerChatbox = PracticeConfig<
|
|
|
156
158
|
export type PracticeConfigPracticeOnlinePharmacy = PracticeConfig<
|
|
157
159
|
PracticeConfigKind.PracticePharmacyPicker,
|
|
158
160
|
{
|
|
159
|
-
onlinePharmacy?:
|
|
160
|
-
name: string,
|
|
161
|
-
id: string,
|
|
162
|
-
phones: { countryCode: string, number: string, extension: string | null, type: string, isTollFree: boolean, province?: string }[]
|
|
163
|
-
}
|
|
161
|
+
onlinePharmacy?: PlaceData
|
|
164
162
|
}
|
|
165
163
|
>
|
|
166
164
|
|
|
@@ -291,6 +289,16 @@ export interface PracticePaymentIntent {
|
|
|
291
289
|
dateUpdateAt?: Date
|
|
292
290
|
}
|
|
293
291
|
|
|
292
|
+
/**
|
|
293
|
+
* This interface is used as metadata when creating Stripe Invoice.
|
|
294
|
+
* It will be used to create the consult when stripe use our hook.
|
|
295
|
+
*/
|
|
296
|
+
export interface ConsultRequestMetadata {
|
|
297
|
+
tagSpecialtyRequired: string
|
|
298
|
+
isoLocalityRequired?: string
|
|
299
|
+
isoLanguageRequired: string
|
|
300
|
+
}
|
|
301
|
+
|
|
294
302
|
export interface Assignment {
|
|
295
303
|
id?: number ///optional for insertion
|
|
296
304
|
uuidPractice: string
|
|
@@ -428,4 +436,4 @@ export interface PracticeInvoice {
|
|
|
428
436
|
subtotal: number
|
|
429
437
|
currency: string
|
|
430
438
|
discount: number
|
|
431
|
-
}
|
|
439
|
+
}
|
package/src/models/workflow.ts
CHANGED
|
@@ -32,6 +32,8 @@ export interface LanguagePickerData extends ChoiceInputData {
|
|
|
32
32
|
export interface EntryData {
|
|
33
33
|
id?: number
|
|
34
34
|
label?: string
|
|
35
|
+
hideLabel?: boolean
|
|
36
|
+
minorLabel?: string
|
|
35
37
|
summaryLabel?: string
|
|
36
38
|
summaryHidden?: boolean
|
|
37
39
|
className?: string
|
|
@@ -81,7 +83,7 @@ export interface GroupedGenericQuestionData<T, A = IndexedData<ChoiceInputData>>
|
|
|
81
83
|
export type QuestionData =
|
|
82
84
|
| GenericQuestionData<'title' | 'paragraph' | 'checkbox', void>
|
|
83
85
|
| GenericQuestionData<
|
|
84
|
-
'text' | 'date' | 'number' | 'images' | 'images-alias' | 'body-parts' | 'pharmacy-picker' | 'place-address'
|
|
86
|
+
'text' | 'textArea' | 'hybrid' | 'date' | 'number' | 'images' | 'images-alias' | 'body-parts' | 'pharmacy-picker' | 'place-address'
|
|
85
87
|
>
|
|
86
88
|
| GenericQuestionData<'checkbox-group' | 'select' | 'multiple', IndexedData<ChoiceInputData>>
|
|
87
89
|
| GroupedGenericQuestionData<'radio', IndexedData<RadioInputData>>
|
package/src/services/guard.ts
CHANGED
|
@@ -157,7 +157,7 @@ export class GuardService {
|
|
|
157
157
|
}
|
|
158
158
|
return resp
|
|
159
159
|
}
|
|
160
|
-
|
|
160
|
+
|
|
161
161
|
/**
|
|
162
162
|
* Retrieve an identity. Will return public fields only when requested
|
|
163
163
|
* without authentication
|
|
@@ -229,4 +229,32 @@ export class GuardService {
|
|
|
229
229
|
public async identitySendConfirmEmail(req: IdentityResendConfirmEmailRequest): Promise<void> {
|
|
230
230
|
return this.api.post<void>(`${this.baseURL}/v1/identity/confirm`, req)
|
|
231
231
|
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Get an identity using a customer email (format: customer+[b64Hash]@orohealth.me)
|
|
235
|
+
*
|
|
236
|
+
* @param email the customer email
|
|
237
|
+
* @returns IdentityResponse
|
|
238
|
+
*/
|
|
239
|
+
public async identityGetByCustomerEmail(email: string): Promise<IdentityResponse> {
|
|
240
|
+
return this.identityGetByHash(email.substring(email.indexOf('+')+1, email.indexOf('@')))
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Get an identity using a base64 hash
|
|
245
|
+
*
|
|
246
|
+
* @param b64Hash base64 hash of the identity
|
|
247
|
+
* @returns IdentityResponse
|
|
248
|
+
*/
|
|
249
|
+
public async identityGetByHash(b64Hash: string): Promise<IdentityResponse> {
|
|
250
|
+
//TODO: Right now this maps directly to the IdentityGet call.
|
|
251
|
+
//Eventually, with the mapping table method, this would lead to another
|
|
252
|
+
//call (ie: /v1/mapping/[b64Hash]) which would return a blob to decrypt
|
|
253
|
+
//which would contain the real identityID to call IdentityGet with.
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
//The hash comes in base64 format but it isn't URL safe soe we have to convert
|
|
257
|
+
//to base64URL (see https://en.wikipedia.org/wiki/Base64#The_URL_applications)
|
|
258
|
+
return this.identityGet(b64Hash.replace('+','-').replace('/','_'))
|
|
259
|
+
}
|
|
232
260
|
}
|
package/src/services/practice.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Buffer } from 'buffer/'
|
|
2
2
|
import { sha256 } from 'hash.js'
|
|
3
|
-
import { PracticeAccount, Uuid } from '../models'
|
|
3
|
+
import { ConsultRequestMetadata, PracticeAccount, Uuid } from '../models'
|
|
4
4
|
import {
|
|
5
5
|
Assignment,
|
|
6
6
|
PlanType,
|
|
@@ -178,13 +178,25 @@ export class PracticeService {
|
|
|
178
178
|
return Buffer.from(sha256().update(email.toLowerCase()).digest('hex'), 'hex').toString('base64')
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
+
/**
|
|
182
|
+
* Creates a PracticePaymentIntent
|
|
183
|
+
* @param practiceUuid the uuid of the practice
|
|
184
|
+
* @param planId the plan id to use
|
|
185
|
+
* @param userEmail the email address of the user
|
|
186
|
+
* @param isoLocality (optional) the desired locality
|
|
187
|
+
* @param url_subdomain (optional) the url of the sub domain (@bruno-morel need you to document that)
|
|
188
|
+
* @param promotionCode (optional) promotion code to apply
|
|
189
|
+
* @param consultRequest (optional) consult request to use. If defined, when payment service call our hooks in practice, it will try to create a consult with these infos.
|
|
190
|
+
* @returns
|
|
191
|
+
*/
|
|
181
192
|
public practiceCreatePaymentsIntent(
|
|
182
193
|
practiceUuid: Uuid,
|
|
183
194
|
planId: number,
|
|
184
195
|
userEmail: string,
|
|
185
196
|
isoLocality?: string,
|
|
186
197
|
url_subdomain?: string,
|
|
187
|
-
promotionCode?: string
|
|
198
|
+
promotionCode?: string,
|
|
199
|
+
consultRequest?: ConsultRequestMetadata
|
|
188
200
|
): Promise<PracticePaymentIntent> {
|
|
189
201
|
return this.api.post<PracticePaymentIntent>(
|
|
190
202
|
`${this.baseURL}/v1/practices/${practiceUuid}/payments/intents/`,
|
|
@@ -192,6 +204,7 @@ export class PracticeService {
|
|
|
192
204
|
idPlan: planId,
|
|
193
205
|
hashUserEmail: userEmail ? this.getPaymentIntentHashedEmail(userEmail) : undefined,
|
|
194
206
|
isoLocality,
|
|
207
|
+
consultRequest,
|
|
195
208
|
},
|
|
196
209
|
{ params: { url_subdomain, promotionCode } }
|
|
197
210
|
)
|
|
@@ -225,12 +238,9 @@ export class PracticeService {
|
|
|
225
238
|
* @param practiceUuid UUID of the practice to get the invoice from
|
|
226
239
|
* @param invoiceId ID of the invoice in stripe
|
|
227
240
|
*/
|
|
228
|
-
public getInvoice(
|
|
229
|
-
practiceUuid: Uuid,
|
|
230
|
-
invoiceId: string
|
|
231
|
-
): Promise<PracticeInvoice> {
|
|
241
|
+
public getInvoice(practiceUuid: Uuid, invoiceId: string): Promise<PracticeInvoice> {
|
|
232
242
|
return this.api.get<PracticeInvoice>(
|
|
233
|
-
`${this.baseURL}/v1/practices/${practiceUuid}/payments/invoices/${invoiceId}
|
|
243
|
+
`${this.baseURL}/v1/practices/${practiceUuid}/payments/invoices/${invoiceId}`
|
|
234
244
|
)
|
|
235
245
|
}
|
|
236
246
|
|
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.
|