@medplum/react 0.9.22 → 0.9.23
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/cjs/index.js +188 -75
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.min.js +1 -1
- package/dist/cjs/index.min.js.map +1 -1
- package/dist/cjs/styles.css +70 -55
- package/dist/esm/index.js +187 -77
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +1 -1
- package/dist/esm/index.min.js.map +1 -1
- package/dist/esm/styles.css +70 -55
- package/dist/types/RegisterForm.d.ts +17 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/stories/RegisterForm.stories.d.ts +7 -0
- package/dist/types/utils/recaptcha.d.ts +10 -0
- package/package.json +5 -5
package/dist/cjs/styles.css
CHANGED
|
@@ -1370,6 +1370,76 @@ div.medplum-nav-menu-container {
|
|
|
1370
1370
|
color: var(--medplum-blue-500);
|
|
1371
1371
|
}
|
|
1372
1372
|
|
|
1373
|
+
.medplum-signin-buttons {
|
|
1374
|
+
display: flex;
|
|
1375
|
+
justify-content: space-between;
|
|
1376
|
+
line-height: 32px;
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
.medplum-signin-buttons > div {
|
|
1380
|
+
display: flex;
|
|
1381
|
+
align-items: center;
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
.medplum-signin-buttons a {
|
|
1385
|
+
font-size: 12px;
|
|
1386
|
+
margin-right: 16px;
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
.medplum-signin-buttons label {
|
|
1390
|
+
font-size: 12px;
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
.medplum-signin-google-container {
|
|
1394
|
+
padding: 20px 0 10px 0;
|
|
1395
|
+
margin: 20px 0 10px 0;
|
|
1396
|
+
text-align: center;
|
|
1397
|
+
display: flex;
|
|
1398
|
+
align-items: center;
|
|
1399
|
+
justify-content: center;
|
|
1400
|
+
}
|
|
1401
|
+
|
|
1402
|
+
.medplum-signin-separator {
|
|
1403
|
+
padding: 12px 0;
|
|
1404
|
+
margin: 12px 0;
|
|
1405
|
+
overflow: hidden;
|
|
1406
|
+
text-align: center;
|
|
1407
|
+
font-size: var(--medplum-font-small);
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
.medplum-signin-separator::before,
|
|
1411
|
+
.medplum-signin-separator::after {
|
|
1412
|
+
background-color: var(--medplum-gray-400);
|
|
1413
|
+
content: '';
|
|
1414
|
+
display: inline-block;
|
|
1415
|
+
height: 0.1px;
|
|
1416
|
+
position: relative;
|
|
1417
|
+
vertical-align: middle;
|
|
1418
|
+
width: 50%;
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
.medplum-signin-separator::before {
|
|
1422
|
+
right: 0.5em;
|
|
1423
|
+
margin-left: -50%;
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
.medplum-signin-separator::after {
|
|
1427
|
+
left: 0.5em;
|
|
1428
|
+
margin-right: -50%;
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1431
|
+
.medplum-left {
|
|
1432
|
+
text-align: left;
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
.medplum-center {
|
|
1436
|
+
text-align: center;
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
.medplum-right {
|
|
1440
|
+
text-align: right;
|
|
1441
|
+
}
|
|
1442
|
+
|
|
1373
1443
|
.medplum-status {
|
|
1374
1444
|
padding: 1px 6px;
|
|
1375
1445
|
font-size: 80%;
|
|
@@ -1569,61 +1639,6 @@ div.medplum-nav-menu-container {
|
|
|
1569
1639
|
|
|
1570
1640
|
.grecaptcha-badge { visibility: hidden; }
|
|
1571
1641
|
|
|
1572
|
-
.medplum-signin {
|
|
1573
|
-
max-width: 400px;
|
|
1574
|
-
}
|
|
1575
|
-
|
|
1576
|
-
.medplum-signin-buttons {
|
|
1577
|
-
display: flex;
|
|
1578
|
-
justify-content: space-between;
|
|
1579
|
-
line-height: 32px;
|
|
1580
|
-
}
|
|
1581
|
-
|
|
1582
|
-
.medplum-signin-buttons > div {
|
|
1583
|
-
display: flex;
|
|
1584
|
-
align-items: center;
|
|
1585
|
-
}
|
|
1586
|
-
|
|
1587
|
-
.medplum-signin-buttons a {
|
|
1588
|
-
font-size: 12px;
|
|
1589
|
-
margin-right: 16px;
|
|
1590
|
-
}
|
|
1591
|
-
|
|
1592
|
-
.medplum-signin-buttons label {
|
|
1593
|
-
font-size: 12px;
|
|
1594
|
-
}
|
|
1595
|
-
|
|
1596
|
-
.medplum-signin-google-container {
|
|
1597
|
-
padding: 20px 0 10px 0;
|
|
1598
|
-
margin: 20px 0 10px 0;
|
|
1599
|
-
text-align: center;
|
|
1600
|
-
display: flex;
|
|
1601
|
-
align-items: center;
|
|
1602
|
-
justify-content: center;
|
|
1603
|
-
border-top: 0.1px solid var(--medplum-gray-200);
|
|
1604
|
-
}
|
|
1605
|
-
|
|
1606
|
-
.medplum-signin-google-icon {
|
|
1607
|
-
margin-right: 8px;
|
|
1608
|
-
}
|
|
1609
|
-
|
|
1610
|
-
.medplum-signin-google-icon svg {
|
|
1611
|
-
display: inline-block;
|
|
1612
|
-
vertical-align: top;
|
|
1613
|
-
}
|
|
1614
|
-
|
|
1615
|
-
.medplum-left {
|
|
1616
|
-
text-align: left;
|
|
1617
|
-
}
|
|
1618
|
-
|
|
1619
|
-
.medplum-center {
|
|
1620
|
-
text-align: center;
|
|
1621
|
-
}
|
|
1622
|
-
|
|
1623
|
-
.medplum-right {
|
|
1624
|
-
text-align: right;
|
|
1625
|
-
}
|
|
1626
|
-
|
|
1627
1642
|
a.medplum-tab {
|
|
1628
1643
|
display: inline-block;
|
|
1629
1644
|
line-height: 50px;
|
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { formatAddress, getDisplayString, getImageSrc, capitalize, globalSchema, getPropertyDisplayName, formatHumanName, stringify, buildTypeName, PropertyType, getTypedPropertyValue, createReference, toTypedValue, getReferenceString, evalFhirPath, getSearchParameterDetails, Operator, evalFhirPathTyped, SearchParameterType, formatSearchQuery, parseSearchDefinition, DEFAULT_SEARCH_COUNT, isUUID } from '@medplum/core';
|
|
1
|
+
import { formatAddress, getDisplayString, getImageSrc, capitalize, globalSchema, getPropertyDisplayName, formatHumanName, stringify, buildTypeName, PropertyType, getTypedPropertyValue, createReference, toTypedValue, getReferenceString, evalFhirPath, getSearchParameterDetails, Operator, evalFhirPathTyped, SearchParameterType, formatSearchQuery, parseSearchDefinition, DEFAULT_SEARCH_COUNT, isUUID, parseJWTPayload } from '@medplum/core';
|
|
2
2
|
import React, { useState, useRef, createContext, useEffect, useContext, useCallback, useMemo } from 'react';
|
|
3
3
|
import { useNavigate, useLocation } from 'react-router-dom';
|
|
4
4
|
|
|
@@ -1770,18 +1770,24 @@ function ResourceBadge(props) {
|
|
|
1770
1770
|
}
|
|
1771
1771
|
|
|
1772
1772
|
function DiagnosticReportDisplay(props) {
|
|
1773
|
-
var _a;
|
|
1773
|
+
var _a, _b;
|
|
1774
1774
|
const diagnosticReport = useResource(props.value);
|
|
1775
|
+
const specimen = useResource((_a = diagnosticReport === null || diagnosticReport === void 0 ? void 0 : diagnosticReport.specimen) === null || _a === void 0 ? void 0 : _a[0]);
|
|
1775
1776
|
if (!diagnosticReport) {
|
|
1776
1777
|
return null;
|
|
1777
1778
|
}
|
|
1778
|
-
let textContent =
|
|
1779
|
+
let textContent = '';
|
|
1779
1780
|
if (diagnosticReport.presentedForm && diagnosticReport.presentedForm.length > 0) {
|
|
1780
1781
|
const pf = diagnosticReport.presentedForm[0];
|
|
1781
|
-
if (((
|
|
1782
|
+
if (((_b = pf.contentType) === null || _b === void 0 ? void 0 : _b.startsWith('text/plain')) && pf.data) {
|
|
1782
1783
|
textContent = window.atob(pf.data);
|
|
1783
1784
|
}
|
|
1784
1785
|
}
|
|
1786
|
+
if (specimen === null || specimen === void 0 ? void 0 : specimen.note) {
|
|
1787
|
+
for (const note of specimen.note) {
|
|
1788
|
+
textContent += note.text + '\n\n';
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1785
1791
|
return (React.createElement("div", { className: "medplum-diagnostic-report" },
|
|
1786
1792
|
React.createElement("h1", null, "Diagnostic Report"),
|
|
1787
1793
|
React.createElement("div", { className: "medplum-diagnostic-report-header" },
|
|
@@ -1801,8 +1807,8 @@ function DiagnosticReportDisplay(props) {
|
|
|
1801
1807
|
diagnosticReport.status && (React.createElement("dl", null,
|
|
1802
1808
|
React.createElement("dt", null, "Status"),
|
|
1803
1809
|
React.createElement("dd", null, capitalize(diagnosticReport.status))))),
|
|
1804
|
-
|
|
1805
|
-
|
|
1810
|
+
diagnosticReport.result && React.createElement(ObservationTable, { value: diagnosticReport.result }),
|
|
1811
|
+
textContent && React.createElement("pre", null, textContent.trim())));
|
|
1806
1812
|
}
|
|
1807
1813
|
function ObservationTable(props) {
|
|
1808
1814
|
var _a;
|
|
@@ -4898,6 +4904,163 @@ function ensureQuestionnaireOptionKeys(options) {
|
|
|
4898
4904
|
return options.map((option) => (Object.assign(Object.assign({}, option), { id: option.id || generateId() })));
|
|
4899
4905
|
}
|
|
4900
4906
|
|
|
4907
|
+
/**
|
|
4908
|
+
* Dynamically creates a script tag for the specified JavaScript file.
|
|
4909
|
+
* @param src The JavaScript file URL.
|
|
4910
|
+
*/
|
|
4911
|
+
function createScriptTag(src, onload) {
|
|
4912
|
+
const head = document.getElementsByTagName('head')[0];
|
|
4913
|
+
const script = document.createElement('script');
|
|
4914
|
+
script.async = true;
|
|
4915
|
+
script.src = src;
|
|
4916
|
+
script.onload = onload || null;
|
|
4917
|
+
head.appendChild(script);
|
|
4918
|
+
}
|
|
4919
|
+
|
|
4920
|
+
function GoogleButton(props) {
|
|
4921
|
+
const medplum = useMedplum();
|
|
4922
|
+
const { googleClientId, handleGoogleCredential } = props;
|
|
4923
|
+
const parentRef = useRef(null);
|
|
4924
|
+
const [scriptLoaded, setScriptLoaded] = useState(typeof google !== 'undefined');
|
|
4925
|
+
const [initialized, setInitialized] = useState(false);
|
|
4926
|
+
const [buttonRendered, setButtonRendered] = useState(false);
|
|
4927
|
+
useEffect(() => {
|
|
4928
|
+
if (typeof google === 'undefined') {
|
|
4929
|
+
createScriptTag('https://accounts.google.com/gsi/client', () => setScriptLoaded(true));
|
|
4930
|
+
return;
|
|
4931
|
+
}
|
|
4932
|
+
if (!initialized) {
|
|
4933
|
+
google.accounts.id.initialize({
|
|
4934
|
+
client_id: googleClientId,
|
|
4935
|
+
callback: handleGoogleCredential,
|
|
4936
|
+
});
|
|
4937
|
+
setInitialized(true);
|
|
4938
|
+
}
|
|
4939
|
+
if (parentRef.current && !buttonRendered) {
|
|
4940
|
+
google.accounts.id.renderButton(parentRef.current, {});
|
|
4941
|
+
setButtonRendered(true);
|
|
4942
|
+
}
|
|
4943
|
+
}, [medplum, googleClientId, initialized, scriptLoaded, parentRef, buttonRendered, handleGoogleCredential]);
|
|
4944
|
+
if (!googleClientId) {
|
|
4945
|
+
return null;
|
|
4946
|
+
}
|
|
4947
|
+
return React.createElement("div", { ref: parentRef });
|
|
4948
|
+
}
|
|
4949
|
+
function getGoogleClientId(clientId) {
|
|
4950
|
+
var _a, _b;
|
|
4951
|
+
if (clientId) {
|
|
4952
|
+
return clientId;
|
|
4953
|
+
}
|
|
4954
|
+
const origin = window.location.protocol + '//' + window.location.host;
|
|
4955
|
+
const authorizedOrigins = (_b = (_a = "http://localhost:3000,http://localhost:6006,https://app.medplum.com,https://docs.medplum.com") === null || _a === void 0 ? void 0 : _a.split(',')) !== null && _b !== void 0 ? _b : [];
|
|
4956
|
+
if (authorizedOrigins.includes(origin)) {
|
|
4957
|
+
return "921088377005-3j1sa10vr6hj86jgmdfh2l53v3mp7lfi.apps.googleusercontent.com";
|
|
4958
|
+
}
|
|
4959
|
+
return undefined;
|
|
4960
|
+
}
|
|
4961
|
+
|
|
4962
|
+
/**
|
|
4963
|
+
* Dynamically loads the recaptcha script.
|
|
4964
|
+
* We do not want to load the script on page load unless the user needs it.
|
|
4965
|
+
*/
|
|
4966
|
+
function initRecaptcha() {
|
|
4967
|
+
if (typeof grecaptcha === 'undefined') {
|
|
4968
|
+
createScriptTag('https://www.google.com/recaptcha/api.js?render=' + process.env.RECAPTCHA_SITE_KEY);
|
|
4969
|
+
}
|
|
4970
|
+
}
|
|
4971
|
+
/**
|
|
4972
|
+
* Starts a request to generate a recapcha token.
|
|
4973
|
+
* @returns Promise to a recaptcha token for the current user.
|
|
4974
|
+
*/
|
|
4975
|
+
function getRecaptcha() {
|
|
4976
|
+
return new Promise((resolve) => {
|
|
4977
|
+
grecaptcha.ready(() => {
|
|
4978
|
+
grecaptcha.execute(process.env.RECAPTCHA_SITE_KEY, { action: 'submit' }).then(resolve);
|
|
4979
|
+
});
|
|
4980
|
+
});
|
|
4981
|
+
}
|
|
4982
|
+
|
|
4983
|
+
function RegisterForm(props) {
|
|
4984
|
+
const medplum = useMedplum();
|
|
4985
|
+
const googleClientId = getGoogleClientId(props.googleClientId);
|
|
4986
|
+
const [outcome, setOutcome] = useState();
|
|
4987
|
+
const issues = getIssuesForExpression(outcome, undefined);
|
|
4988
|
+
useEffect(initRecaptcha, []);
|
|
4989
|
+
function handleAuthResponse(registerRequest, partialLogin) {
|
|
4990
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4991
|
+
try {
|
|
4992
|
+
let login;
|
|
4993
|
+
if (props.type === 'patient') {
|
|
4994
|
+
login = yield medplum.startNewPatient(registerRequest, partialLogin);
|
|
4995
|
+
}
|
|
4996
|
+
else {
|
|
4997
|
+
login = yield medplum.startNewProject(registerRequest, partialLogin);
|
|
4998
|
+
}
|
|
4999
|
+
yield medplum.processCode(login.code);
|
|
5000
|
+
props.onSuccess();
|
|
5001
|
+
}
|
|
5002
|
+
catch (err) {
|
|
5003
|
+
setOutcome(err);
|
|
5004
|
+
}
|
|
5005
|
+
});
|
|
5006
|
+
}
|
|
5007
|
+
return (React.createElement(Document, { width: 450 },
|
|
5008
|
+
React.createElement(Form, { style: { maxWidth: 400 }, onSubmit: (formData) => __awaiter(this, void 0, void 0, function* () {
|
|
5009
|
+
try {
|
|
5010
|
+
const recaptchaToken = yield getRecaptcha();
|
|
5011
|
+
const registerRequest = Object.assign(Object.assign({}, formData), { recaptchaToken });
|
|
5012
|
+
const userLogin = yield medplum.startNewUser(registerRequest);
|
|
5013
|
+
handleAuthResponse(registerRequest, userLogin);
|
|
5014
|
+
}
|
|
5015
|
+
catch (err) {
|
|
5016
|
+
setOutcome(err);
|
|
5017
|
+
}
|
|
5018
|
+
}) },
|
|
5019
|
+
React.createElement("div", { className: "medplum-center" }, props.children),
|
|
5020
|
+
issues && (React.createElement("div", { className: "medplum-input-error" }, issues.map((issue) => {
|
|
5021
|
+
var _a, _b;
|
|
5022
|
+
return (React.createElement("div", { "data-testid": "text-field-error", key: (_a = issue.details) === null || _a === void 0 ? void 0 : _a.text }, (_b = issue.details) === null || _b === void 0 ? void 0 : _b.text));
|
|
5023
|
+
}))),
|
|
5024
|
+
googleClientId && (React.createElement(React.Fragment, null,
|
|
5025
|
+
React.createElement("div", { className: "medplum-signin-google-container" },
|
|
5026
|
+
React.createElement(GoogleButton, { googleClientId: googleClientId, handleGoogleCredential: (response) => __awaiter(this, void 0, void 0, function* () {
|
|
5027
|
+
try {
|
|
5028
|
+
const loginRequest = {
|
|
5029
|
+
googleClientId: response.clientId,
|
|
5030
|
+
googleCredential: response.credential,
|
|
5031
|
+
};
|
|
5032
|
+
const userLogin = yield medplum.startGoogleLogin(loginRequest);
|
|
5033
|
+
const googleClaims = parseJWTPayload(loginRequest.googleCredential);
|
|
5034
|
+
const registerRequest = {
|
|
5035
|
+
firstName: googleClaims.given_name,
|
|
5036
|
+
lastName: googleClaims.family_name,
|
|
5037
|
+
email: googleClaims.email,
|
|
5038
|
+
};
|
|
5039
|
+
handleAuthResponse(registerRequest, userLogin);
|
|
5040
|
+
}
|
|
5041
|
+
catch (err) {
|
|
5042
|
+
setOutcome(err);
|
|
5043
|
+
}
|
|
5044
|
+
}) })),
|
|
5045
|
+
React.createElement("div", { className: "medplum-signin-separator" }, "or"))),
|
|
5046
|
+
React.createElement(FormSection, { title: "First Name", htmlFor: "firstName", outcome: outcome },
|
|
5047
|
+
React.createElement(Input, { name: "firstName", type: "text", testid: "firstName", placeholder: "First name", required: true, autoFocus: true, outcome: outcome })),
|
|
5048
|
+
React.createElement(FormSection, { title: "Last Name", htmlFor: "lastName", outcome: outcome },
|
|
5049
|
+
React.createElement(Input, { name: "lastName", type: "text", testid: "lastName", placeholder: "Last name", required: true, outcome: outcome })),
|
|
5050
|
+
props.type === 'project' && (React.createElement(FormSection, { title: "Project Name", htmlFor: "projectName", outcome: outcome },
|
|
5051
|
+
React.createElement(Input, { name: "projectName", type: "text", testid: "projectName", placeholder: "My Project", required: true, outcome: outcome }))),
|
|
5052
|
+
React.createElement(FormSection, { title: "Email", htmlFor: "email", outcome: outcome },
|
|
5053
|
+
React.createElement(Input, { name: "email", type: "email", testid: "email", placeholder: "name@domain.com", required: true, outcome: outcome })),
|
|
5054
|
+
React.createElement(FormSection, { title: "Password", htmlFor: "password", outcome: outcome },
|
|
5055
|
+
React.createElement(Input, { name: "password", type: "password", testid: "password", autoComplete: "off", required: true, outcome: outcome })),
|
|
5056
|
+
React.createElement("div", { className: "medplum-signin-buttons" },
|
|
5057
|
+
React.createElement("div", null,
|
|
5058
|
+
React.createElement("input", { type: "checkbox", id: "remember", name: "remember", value: "true" }),
|
|
5059
|
+
React.createElement("label", { htmlFor: "remember" }, "Remember me")),
|
|
5060
|
+
React.createElement("div", null,
|
|
5061
|
+
React.createElement(Button, { type: "submit", testid: "submit" }, "Create account"))))));
|
|
5062
|
+
}
|
|
5063
|
+
|
|
4901
5064
|
function StatusBadge(props) {
|
|
4902
5065
|
return React.createElement("span", { className: `medplum-status medplum-status-${props.status}` }, props.status);
|
|
4903
5066
|
}
|
|
@@ -5471,62 +5634,6 @@ function ServiceRequestTimeline(props) {
|
|
|
5471
5634
|
}) }));
|
|
5472
5635
|
}
|
|
5473
5636
|
|
|
5474
|
-
/**
|
|
5475
|
-
* Dynamically creates a script tag for the specified JavaScript file.
|
|
5476
|
-
* @param src The JavaScript file URL.
|
|
5477
|
-
*/
|
|
5478
|
-
function createScriptTag(src, onload) {
|
|
5479
|
-
const head = document.getElementsByTagName('head')[0];
|
|
5480
|
-
const script = document.createElement('script');
|
|
5481
|
-
script.async = true;
|
|
5482
|
-
script.src = src;
|
|
5483
|
-
script.onload = onload || null;
|
|
5484
|
-
head.appendChild(script);
|
|
5485
|
-
}
|
|
5486
|
-
|
|
5487
|
-
function GoogleButton(props) {
|
|
5488
|
-
const medplum = useMedplum();
|
|
5489
|
-
const { handleGoogleCredential } = props;
|
|
5490
|
-
const googleClientId = getGoogleClientId(props.googleClientId);
|
|
5491
|
-
const parentRef = useRef(null);
|
|
5492
|
-
const [scriptLoaded, setScriptLoaded] = useState(typeof google !== 'undefined');
|
|
5493
|
-
const [initialized, setInitialized] = useState(false);
|
|
5494
|
-
const [buttonRendered, setButtonRendered] = useState(false);
|
|
5495
|
-
useEffect(() => {
|
|
5496
|
-
if (typeof google === 'undefined') {
|
|
5497
|
-
createScriptTag('https://accounts.google.com/gsi/client', () => setScriptLoaded(true));
|
|
5498
|
-
return;
|
|
5499
|
-
}
|
|
5500
|
-
if (!initialized) {
|
|
5501
|
-
google.accounts.id.initialize({
|
|
5502
|
-
client_id: googleClientId,
|
|
5503
|
-
callback: handleGoogleCredential,
|
|
5504
|
-
});
|
|
5505
|
-
setInitialized(true);
|
|
5506
|
-
}
|
|
5507
|
-
if (parentRef.current && !buttonRendered) {
|
|
5508
|
-
google.accounts.id.renderButton(parentRef.current, {});
|
|
5509
|
-
setButtonRendered(true);
|
|
5510
|
-
}
|
|
5511
|
-
}, [medplum, googleClientId, initialized, scriptLoaded, parentRef, buttonRendered, handleGoogleCredential]);
|
|
5512
|
-
if (!googleClientId) {
|
|
5513
|
-
return null;
|
|
5514
|
-
}
|
|
5515
|
-
return React.createElement("div", { ref: parentRef });
|
|
5516
|
-
}
|
|
5517
|
-
function getGoogleClientId(clientId) {
|
|
5518
|
-
var _a, _b;
|
|
5519
|
-
if (clientId) {
|
|
5520
|
-
return clientId;
|
|
5521
|
-
}
|
|
5522
|
-
const origin = window.location.protocol + '//' + window.location.host;
|
|
5523
|
-
const authorizedOrigins = (_b = (_a = "http://localhost:3000,http://localhost:6006,https://app.medplum.com,https://docs.medplum.com") === null || _a === void 0 ? void 0 : _a.split(',')) !== null && _b !== void 0 ? _b : [];
|
|
5524
|
-
if (authorizedOrigins.includes(origin)) {
|
|
5525
|
-
return "921088377005-3j1sa10vr6hj86jgmdfh2l53v3mp7lfi.apps.googleusercontent.com";
|
|
5526
|
-
}
|
|
5527
|
-
return undefined;
|
|
5528
|
-
}
|
|
5529
|
-
|
|
5530
5637
|
function SignInForm(props) {
|
|
5531
5638
|
const medplum = useMedplum();
|
|
5532
5639
|
const [login, setLogin] = useState(undefined);
|
|
@@ -5568,6 +5675,7 @@ function SignInForm(props) {
|
|
|
5568
5675
|
}
|
|
5569
5676
|
function AuthenticationForm(props) {
|
|
5570
5677
|
const medplum = useMedplum();
|
|
5678
|
+
const googleClientId = getGoogleClientId(props.googleClientId);
|
|
5571
5679
|
const [outcome, setOutcome] = useState();
|
|
5572
5680
|
const issues = getIssuesForExpression(outcome, undefined);
|
|
5573
5681
|
return (React.createElement(Form, { style: { maxWidth: 400 }, onSubmit: (formData) => {
|
|
@@ -5588,6 +5696,21 @@ function AuthenticationForm(props) {
|
|
|
5588
5696
|
var _a, _b;
|
|
5589
5697
|
return (React.createElement("div", { "data-testid": "text-field-error", key: (_a = issue.details) === null || _a === void 0 ? void 0 : _a.text }, (_b = issue.details) === null || _b === void 0 ? void 0 : _b.text));
|
|
5590
5698
|
}))),
|
|
5699
|
+
googleClientId && (React.createElement(React.Fragment, null,
|
|
5700
|
+
React.createElement("div", { className: "medplum-signin-google-container" },
|
|
5701
|
+
React.createElement(GoogleButton, { googleClientId: googleClientId, handleGoogleCredential: (response) => {
|
|
5702
|
+
medplum
|
|
5703
|
+
.startGoogleLogin({
|
|
5704
|
+
clientId: props.clientId,
|
|
5705
|
+
scope: props.scope,
|
|
5706
|
+
nonce: props.nonce,
|
|
5707
|
+
googleClientId: response.clientId,
|
|
5708
|
+
googleCredential: response.credential,
|
|
5709
|
+
})
|
|
5710
|
+
.then(props.handleAuthResponse)
|
|
5711
|
+
.catch(setOutcome);
|
|
5712
|
+
} })),
|
|
5713
|
+
React.createElement("div", { className: "medplum-signin-separator" }, "or"))),
|
|
5591
5714
|
React.createElement(FormSection, { title: "Email", htmlFor: "email", outcome: outcome },
|
|
5592
5715
|
React.createElement(Input, { name: "email", type: "email", testid: "email", required: true, autoFocus: true, outcome: outcome })),
|
|
5593
5716
|
React.createElement(FormSection, { title: "Password", htmlFor: "password", outcome: outcome },
|
|
@@ -5600,20 +5723,7 @@ function AuthenticationForm(props) {
|
|
|
5600
5723
|
React.createElement("input", { type: "checkbox", id: "remember", name: "remember", value: "true" }),
|
|
5601
5724
|
React.createElement("label", { htmlFor: "remember" }, "Remember me")),
|
|
5602
5725
|
React.createElement("div", null,
|
|
5603
|
-
React.createElement(Button, { type: "submit", testid: "submit" }, "Sign in")))
|
|
5604
|
-
React.createElement("div", { className: "medplum-signin-google-container" },
|
|
5605
|
-
React.createElement(GoogleButton, { googleClientId: props.googleClientId, handleGoogleCredential: (response) => {
|
|
5606
|
-
medplum
|
|
5607
|
-
.startGoogleLogin({
|
|
5608
|
-
clientId: props.clientId,
|
|
5609
|
-
scope: props.scope,
|
|
5610
|
-
nonce: props.nonce,
|
|
5611
|
-
googleClientId: response.clientId,
|
|
5612
|
-
googleCredential: response.credential,
|
|
5613
|
-
})
|
|
5614
|
-
.then(props.handleAuthResponse)
|
|
5615
|
-
.catch(setOutcome);
|
|
5616
|
-
} }))));
|
|
5726
|
+
React.createElement(Button, { type: "submit", testid: "submit" }, "Sign in")))));
|
|
5617
5727
|
}
|
|
5618
5728
|
function ProfileForm(props) {
|
|
5619
5729
|
const medplum = useMedplum();
|
|
@@ -5685,5 +5795,5 @@ function TabSwitch(props) {
|
|
|
5685
5795
|
})));
|
|
5686
5796
|
}
|
|
5687
5797
|
|
|
5688
|
-
export { AddressDisplay, AddressInput, AttachmentArrayDisplay, AttachmentArrayInput, AttachmentInput, Autocomplete, Avatar, BackboneElementInput, Button, Checkbox, CheckboxFormSection, CodeInput, CodeableConceptDisplay, CodeableConceptInput, ContactDetailDisplay, ContactDetailInput, ContactPointDisplay, ContactPointInput, DateTimeDisplay, DateTimeInput, DefaultResourceTimeline, DiagnosticReportDisplay, Document, ElementDefinitionInputSelector, ElementDefinitionTypeInput, EncounterTimeline, ErrorBoundary, FhirPathTable, FooterLinks, Form, FormSection, Header, HumanNameDisplay, HumanNameInput, IdentifierInput, Input, Loading, Logo, MedplumLink, MedplumProvider, MemoizedFhirPathTable, MemoizedSearchControl, MenuItem, ObservationTable, PatientTimeline, PlanDefinitionBuilder, Popup, QuestionnaireBuilder, QuestionnaireForm, QuestionnaireFormItem, QuestionnaireItemType, RangeDisplay, RangeInput, ReferenceInput, RequestGroupDisplay, ResourceArrayDisplay, ResourceArrayInput, ResourceBadge, ResourceBlame, ResourceDiff, ResourceForm, ResourceHistoryTable, ResourceInput, ResourceName, ResourcePropertyDisplay, ResourcePropertyInput, ResourceTable, ResourceTimeline, Scheduler, Scrollable, SearchChangeEvent, SearchClickEvent, SearchControl, SearchFieldEditor, SearchFilterEditor, SearchLoadEvent, Select, ServiceRequestTimeline, SignInForm, StatusBadge, Tab, TabList, TabPanel, TabSwitch, TextArea, Timeline, TimelineItem, TitleBar, UploadButton, addDateEqualsFilter, addDateFilter, addDateFilterBetween, addField, addFilter, addLastMonthFilter, addMissingFilter, addNextMonthFilter, addQuestionnaireInitialValues, addThisMonthFilter, addTodayFilter, addTomorrowFilter, addYearToDateFilter, addYesterdayFilter, buildFieldNameString, clearFilters, clearFiltersOnField, convertIsoToLocal, convertLocalToIso, createScriptTag, deleteFilter, formatRangeString, getOpString, getSearchOperators, getSortField, getTimeString, getValueAndType, hasFilterOnField, isChoiceQuestion, isSortDescending, movePage, parseForm, renderValue, setFilters, setOffset, setPropertyValue, setSort, sortByDateAndPriority, toggleSort, useMedplum, useMedplumContext, useMedplumProfile, useResource };
|
|
5798
|
+
export { AddressDisplay, AddressInput, AttachmentArrayDisplay, AttachmentArrayInput, AttachmentInput, Autocomplete, Avatar, BackboneElementInput, Button, Checkbox, CheckboxFormSection, CodeInput, CodeableConceptDisplay, CodeableConceptInput, ContactDetailDisplay, ContactDetailInput, ContactPointDisplay, ContactPointInput, DateTimeDisplay, DateTimeInput, DefaultResourceTimeline, DiagnosticReportDisplay, Document, ElementDefinitionInputSelector, ElementDefinitionTypeInput, EncounterTimeline, ErrorBoundary, FhirPathTable, FooterLinks, Form, FormSection, Header, HumanNameDisplay, HumanNameInput, IdentifierInput, Input, Loading, Logo, MedplumLink, MedplumProvider, MemoizedFhirPathTable, MemoizedSearchControl, MenuItem, ObservationTable, PatientTimeline, PlanDefinitionBuilder, Popup, QuestionnaireBuilder, QuestionnaireForm, QuestionnaireFormItem, QuestionnaireItemType, RangeDisplay, RangeInput, ReferenceInput, RegisterForm, RequestGroupDisplay, ResourceArrayDisplay, ResourceArrayInput, ResourceBadge, ResourceBlame, ResourceDiff, ResourceForm, ResourceHistoryTable, ResourceInput, ResourceName, ResourcePropertyDisplay, ResourcePropertyInput, ResourceTable, ResourceTimeline, Scheduler, Scrollable, SearchChangeEvent, SearchClickEvent, SearchControl, SearchFieldEditor, SearchFilterEditor, SearchLoadEvent, Select, ServiceRequestTimeline, SignInForm, StatusBadge, Tab, TabList, TabPanel, TabSwitch, TextArea, Timeline, TimelineItem, TitleBar, UploadButton, addDateEqualsFilter, addDateFilter, addDateFilterBetween, addField, addFilter, addLastMonthFilter, addMissingFilter, addNextMonthFilter, addQuestionnaireInitialValues, addThisMonthFilter, addTodayFilter, addTomorrowFilter, addYearToDateFilter, addYesterdayFilter, buildFieldNameString, clearFilters, clearFiltersOnField, convertIsoToLocal, convertLocalToIso, createScriptTag, deleteFilter, formatRangeString, getOpString, getRecaptcha, getSearchOperators, getSortField, getTimeString, getValueAndType, hasFilterOnField, initRecaptcha, isChoiceQuestion, isSortDescending, movePage, parseForm, renderValue, setFilters, setOffset, setPropertyValue, setSort, sortByDateAndPriority, toggleSort, useMedplum, useMedplumContext, useMedplumProfile, useResource };
|
|
5689
5799
|
//# sourceMappingURL=index.js.map
|