@ovok/core 0.3.24 → 0.4.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.
package/README.md CHANGED
@@ -282,6 +282,35 @@ if ("nextStep" in result && result.nextStep === "mfa") {
282
282
  }
283
283
  ```
284
284
 
285
+ ## Patient registration invitations
286
+
287
+ When a project invites people with a business email address to join as clinicians,
288
+ `register()` can return a clinician-invite step instead of an authenticated session. Check
289
+ `nextStep` before reading tokens or setting the active login:
290
+
291
+ ```typescript
292
+ const result = await client.register(registerBody);
293
+
294
+ if ("nextStep" in result && result.nextStep === "clinician-invite") {
295
+ showCheckYourEmailMessage();
296
+ return;
297
+ }
298
+
299
+ await client.setActiveLogin(result);
300
+ ```
301
+
302
+ The invitation email's “continue as patient” link includes a
303
+ `continueAsPatientToken` query parameter. The host app owns its deep-link and universal-link
304
+ configuration: read that parameter from the incoming URL and pass it to `register()` to finish
305
+ registration as a patient:
306
+
307
+ ```typescript
308
+ await client.register({ ...registerBody, continueAsPatientToken });
309
+ ```
310
+
311
+ The token is optional and is sent only when provided. An invalid or expired token is rejected
312
+ with HTTP 400 and the message “The continue-as-patient link is invalid or has expired.”
313
+
285
314
  ## Large measurements
286
315
 
287
316
  `saveMeasurement` and `saveObservations` use conditional creates for idempotent saves. Medplum
@@ -1,4 +1,4 @@
1
1
  import { OvokClient } from "../../ovok-client";
2
- import { AuthResponse } from "../types/AuthResponse";
3
2
  import { RegisterBody } from "../types/RegisterBody";
4
- export declare function register(this: OvokClient, body: RegisterBody): Promise<AuthResponse>;
3
+ import { RegisterResponse } from "../types/RegisterResponse";
4
+ export declare function register(this: OvokClient, body: RegisterBody): Promise<RegisterResponse>;
@@ -11,5 +11,8 @@ async function register(body) {
11
11
  name: body.name,
12
12
  surname: body.surname,
13
13
  tenantCode: body.tenantCode,
14
+ ...(body.continueAsPatientToken !== undefined
15
+ ? { continueAsPatientToken: body.continueAsPatientToken }
16
+ : {}),
14
17
  }, "application/json");
15
18
  }
@@ -5,4 +5,5 @@ export interface RegisterBody {
5
5
  name: string;
6
6
  surname: string;
7
7
  tenantCode: string;
8
+ continueAsPatientToken?: string;
8
9
  }
@@ -0,0 +1,5 @@
1
+ import { AuthResponse } from "./AuthResponse";
2
+ export type ClinicianInviteStep = {
3
+ nextStep: "clinician-invite";
4
+ };
5
+ export type RegisterResponse = AuthResponse | ClinicianInviteStep;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -68,7 +68,7 @@ export type OvokProjectFeatures = {
68
68
  export type OvokProjectFeaturesUpdate = {
69
69
  features: OvokProjectFeature[];
70
70
  };
71
- export declare const OVOK_PROJECT_SETTING_KEYS: readonly ["CONTENT_ENABLED", "MAILING_ENABLED", "PATIENT_INVITATION_ENABLED", "PATIENT_REGISTRATION_ENABLED", "PATIENT_LOGIN_ENABLED", "PRACTITIONER_INVITATION_ENABLED", "PRACTITIONER_REGISTRATION_ENABLED", "PRACTITIONER_LOGIN_ENABLED", "IOT_ENABLED"];
71
+ export declare const OVOK_PROJECT_SETTING_KEYS: readonly ["CONTENT_ENABLED", "MAILING_ENABLED", "PATIENT_INVITATION_ENABLED", "PATIENT_REGISTRATION_ENABLED", "PATIENT_LOGIN_ENABLED", "PRACTITIONER_INVITATION_ENABLED", "PRACTITIONER_REGISTRATION_ENABLED", "PRACTITIONER_LOGIN_ENABLED", "IOT_ENABLED", "CLINICIAN_INVITE_ON_BUSINESS_EMAIL"];
72
72
  export type OvokProjectSettingKey = (typeof OVOK_PROJECT_SETTING_KEYS)[number];
73
73
  export type OvokProjectSettings = {
74
74
  projectId: string;
@@ -24,4 +24,5 @@ exports.OVOK_PROJECT_SETTING_KEYS = [
24
24
  "PRACTITIONER_REGISTRATION_ENABLED",
25
25
  "PRACTITIONER_LOGIN_ENABLED",
26
26
  "IOT_ENABLED",
27
+ "CLINICIAN_INVITE_ON_BUSINESS_EMAIL",
27
28
  ];
@@ -48,7 +48,7 @@ exports.OVOK_CORE_REQUIREMENTS = {
48
48
  description: "The FHIR surface a server must provide for the @ovok/core client library's own methods to function.",
49
49
  software: {
50
50
  name: "@ovok/core",
51
- version: "0.3.24",
51
+ version: "0.4.0",
52
52
  },
53
53
  fhirVersion: "4.0.1",
54
54
  format: ["json"],
@@ -2,6 +2,7 @@ export * from "../client/auth/types/AuthResponse";
2
2
  export * from "../client/auth/types/LoginResponse";
3
3
  export * from "../client/auth/types/LoginBody";
4
4
  export * from "../client/auth/types/RegisterBody";
5
+ export * from "../client/auth/types/RegisterResponse";
5
6
  export * from "../client/auth/types/ChangePasswordBody";
6
7
  export * from "../client/auth/types/ChangePasswordResponse";
7
8
  export * from "../client/auth/types/RequestDeleteUserBody";
@@ -19,6 +19,7 @@ __exportStar(require("../client/auth/types/AuthResponse"), exports);
19
19
  __exportStar(require("../client/auth/types/LoginResponse"), exports);
20
20
  __exportStar(require("../client/auth/types/LoginBody"), exports);
21
21
  __exportStar(require("../client/auth/types/RegisterBody"), exports);
22
+ __exportStar(require("../client/auth/types/RegisterResponse"), exports);
22
23
  __exportStar(require("../client/auth/types/ChangePasswordBody"), exports);
23
24
  __exportStar(require("../client/auth/types/ChangePasswordResponse"), exports);
24
25
  __exportStar(require("../client/auth/types/RequestDeleteUserBody"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ovok/core",
3
- "version": "0.3.24",
3
+ "version": "0.4.0",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",