@healthcloudai/hc-login-connector 0.1.0 → 0.2.1
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 +142 -4
- package/dist/index.cjs +451 -278
- package/dist/index.d.cts +130 -48
- package/dist/index.d.ts +130 -48
- package/dist/index.js +458 -276
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -114,7 +114,7 @@ The usage example above reads the value from local state.
|
|
|
114
114
|
`getBaseUrl()` returns the currently configured base URL from local state.
|
|
115
115
|
|
|
116
116
|
```txt
|
|
117
|
-
https://dev-api-healthcheck.healthcloud-services.com
|
|
117
|
+
https://dev-api-healthcheck.healthcloud-services.com
|
|
118
118
|
```
|
|
119
119
|
|
|
120
120
|
---
|
|
@@ -247,6 +247,10 @@ list expected by the integration.
|
|
|
247
247
|
- If `verifyEmailCode` is `true`, the client sends `VERIFY_EMAIL_CODE: "true"`.
|
|
248
248
|
- If `verifyEmailCode` is `false` or omitted, `VERIFY_EMAIL_CODE` is not sent.
|
|
249
249
|
|
|
250
|
+
#### OTP-based registration
|
|
251
|
+
|
|
252
|
+
Use this when email verification should be handled through an OTP code. In this case, `verifyEmailCode` should be `true`.
|
|
253
|
+
|
|
250
254
|
```ts
|
|
251
255
|
await loginClient.register(
|
|
252
256
|
"john.smith@example.com",
|
|
@@ -268,7 +272,7 @@ await loginClient.register(
|
|
|
268
272
|
```
|
|
269
273
|
|
|
270
274
|
#### Full API request
|
|
271
|
-
Request sent for the
|
|
275
|
+
Request sent for the OTP example above:
|
|
272
276
|
|
|
273
277
|
```json
|
|
274
278
|
{
|
|
@@ -295,6 +299,39 @@ Request sent for the usage example above:
|
|
|
295
299
|
}
|
|
296
300
|
```
|
|
297
301
|
|
|
302
|
+
#### Link-based registration
|
|
303
|
+
|
|
304
|
+
Use this when email verification should be handled through an email link. In this case, `verifyEmailCode` should be omitted or `false`.
|
|
305
|
+
|
|
306
|
+
```ts
|
|
307
|
+
await loginClient.register(
|
|
308
|
+
"john.smith@example.com",
|
|
309
|
+
"ExamplePassword123!",
|
|
310
|
+
"John",
|
|
311
|
+
"Smith"
|
|
312
|
+
);
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
Effective request body:
|
|
316
|
+
|
|
317
|
+
```json
|
|
318
|
+
{
|
|
319
|
+
"Data": {
|
|
320
|
+
"TenantID": "test-tenant",
|
|
321
|
+
"Credentials": {
|
|
322
|
+
"Email": "john.smith@example.com",
|
|
323
|
+
"Password": "ExamplePassword123!"
|
|
324
|
+
},
|
|
325
|
+
"User": {
|
|
326
|
+
"FirstName": "John",
|
|
327
|
+
"LastName": "Smith",
|
|
328
|
+
"Email": "john.smith@example.com",
|
|
329
|
+
"Attributes": {}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
```
|
|
334
|
+
|
|
298
335
|
#### API response
|
|
299
336
|
|
|
300
337
|
Status:
|
|
@@ -332,6 +369,10 @@ Registers a patient for the configured tenant using the richer registration payl
|
|
|
332
369
|
`verifyEmailCode` behaves the same way as in `register(...)`:
|
|
333
370
|
when enabled, the client injects `VERIFY_EMAIL_CODE: "true"` into `User.Attributes`.
|
|
334
371
|
|
|
372
|
+
#### OTP-based registration
|
|
373
|
+
|
|
374
|
+
Use this when email verification should be handled through an OTP code. In this case, `verifyEmailCode` should be `true`.
|
|
375
|
+
|
|
335
376
|
```ts
|
|
336
377
|
await loginClient.registerFull({
|
|
337
378
|
email: "john.smith@example.com",
|
|
@@ -406,6 +447,40 @@ Request sent for the usage example above:
|
|
|
406
447
|
}
|
|
407
448
|
```
|
|
408
449
|
|
|
450
|
+
#### Link-based registration
|
|
451
|
+
|
|
452
|
+
Use this when email verification should be handled through an email link. In this case, `verifyEmailCode` should be omitted or `false`.
|
|
453
|
+
|
|
454
|
+
```ts
|
|
455
|
+
await loginClient.registerFull({
|
|
456
|
+
email: "john.smith@example.com",
|
|
457
|
+
password: "ExamplePassword123!",
|
|
458
|
+
firstName: "John",
|
|
459
|
+
lastName: "Smith"
|
|
460
|
+
});
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
Effective request body:
|
|
464
|
+
|
|
465
|
+
```json
|
|
466
|
+
{
|
|
467
|
+
"Data": {
|
|
468
|
+
"TenantID": "test-tenant",
|
|
469
|
+
"Credentials": {
|
|
470
|
+
"Email": "john.smith@example.com",
|
|
471
|
+
"Password": "ExamplePassword123!",
|
|
472
|
+
"TenantID": "test-tenant"
|
|
473
|
+
},
|
|
474
|
+
"User": {
|
|
475
|
+
"FirstName": "John",
|
|
476
|
+
"LastName": "Smith",
|
|
477
|
+
"Email": "john.smith@example.com",
|
|
478
|
+
"Attributes": {}
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
```
|
|
483
|
+
|
|
409
484
|
#### API response
|
|
410
485
|
|
|
411
486
|
Status:
|
|
@@ -440,6 +515,10 @@ when email verification should be handled through an OTP code, the client sends
|
|
|
440
515
|
- If `options.verifyEmailCode` is `false` or omitted, `VERIFY_EMAIL_CODE` is not sent.
|
|
441
516
|
- Calling `verifyEmail(...)` without `options` keeps OTP email verification disabled by default.
|
|
442
517
|
|
|
518
|
+
#### OTP-based email verification
|
|
519
|
+
|
|
520
|
+
Use this when email verification should be handled through an OTP code. In this case, `options.verifyEmailCode` should be `true`.
|
|
521
|
+
|
|
443
522
|
```ts
|
|
444
523
|
await loginClient.verifyEmail(
|
|
445
524
|
"john.smith@example.com",
|
|
@@ -452,7 +531,7 @@ await loginClient.verifyEmail(
|
|
|
452
531
|
```
|
|
453
532
|
|
|
454
533
|
#### Full API request
|
|
455
|
-
Request sent for the
|
|
534
|
+
Request sent for the OTP example above:
|
|
456
535
|
|
|
457
536
|
```json
|
|
458
537
|
{
|
|
@@ -471,6 +550,34 @@ Request sent for the usage example above:
|
|
|
471
550
|
}
|
|
472
551
|
```
|
|
473
552
|
|
|
553
|
+
#### Link-based email verification
|
|
554
|
+
|
|
555
|
+
Use this when email verification should be handled through an email link. In this case, `options.verifyEmailCode` should be omitted or `false`.
|
|
556
|
+
|
|
557
|
+
```ts
|
|
558
|
+
await loginClient.verifyEmail(
|
|
559
|
+
"john.smith@example.com",
|
|
560
|
+
"123456",
|
|
561
|
+
"en"
|
|
562
|
+
);
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
Effective request body:
|
|
566
|
+
|
|
567
|
+
```json
|
|
568
|
+
{
|
|
569
|
+
"Data": {
|
|
570
|
+
"Data": "123456",
|
|
571
|
+
"Step": "EMAIL_VERIFY",
|
|
572
|
+
"User": {
|
|
573
|
+
"Email": "john.smith@example.com",
|
|
574
|
+
"TenantID": "test-tenant"
|
|
575
|
+
},
|
|
576
|
+
"Language": "en"
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
```
|
|
580
|
+
|
|
474
581
|
#### API response
|
|
475
582
|
|
|
476
583
|
Status:
|
|
@@ -505,6 +612,10 @@ when email verification should be handled through an OTP code, the client sends
|
|
|
505
612
|
- If `options.verifyEmailCode` is `false` or omitted, `VERIFY_EMAIL_CODE` is not sent.
|
|
506
613
|
- Calling `resendEmailVerify(...)` without `options` keeps OTP email verification disabled by default.
|
|
507
614
|
|
|
615
|
+
#### OTP-based resend
|
|
616
|
+
|
|
617
|
+
Use this when email verification should be handled through an OTP code. In this case, `options.verifyEmailCode` should be `true`.
|
|
618
|
+
|
|
508
619
|
```ts
|
|
509
620
|
await loginClient.resendEmailVerify(
|
|
510
621
|
"john.smith@example.com",
|
|
@@ -516,7 +627,7 @@ await loginClient.resendEmailVerify(
|
|
|
516
627
|
```
|
|
517
628
|
|
|
518
629
|
#### Full API request
|
|
519
|
-
Request sent for the
|
|
630
|
+
Request sent for the OTP example above:
|
|
520
631
|
|
|
521
632
|
```json
|
|
522
633
|
{
|
|
@@ -535,6 +646,33 @@ Request sent for the usage example above:
|
|
|
535
646
|
}
|
|
536
647
|
```
|
|
537
648
|
|
|
649
|
+
#### Link-based resend
|
|
650
|
+
|
|
651
|
+
Use this when email verification should be handled through an email link. In this case, `options.verifyEmailCode` should be omitted or `false`.
|
|
652
|
+
|
|
653
|
+
```ts
|
|
654
|
+
await loginClient.resendEmailVerify(
|
|
655
|
+
"john.smith@example.com",
|
|
656
|
+
"en"
|
|
657
|
+
);
|
|
658
|
+
```
|
|
659
|
+
|
|
660
|
+
Effective request body:
|
|
661
|
+
|
|
662
|
+
```json
|
|
663
|
+
{
|
|
664
|
+
"Data": {
|
|
665
|
+
"Data": "",
|
|
666
|
+
"Step": "RESEND_EMAIL_VERIFY",
|
|
667
|
+
"User": {
|
|
668
|
+
"Email": "john.smith@example.com",
|
|
669
|
+
"TenantID": "test-tenant"
|
|
670
|
+
},
|
|
671
|
+
"Language": "en"
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
```
|
|
675
|
+
|
|
538
676
|
#### API response
|
|
539
677
|
|
|
540
678
|
Status:
|