@medplum/react 2.0.0 → 2.0.2
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/DiagnosticReportDisplay/DiagnosticReportDisplay.d.ts +2 -0
- package/dist/cjs/DiagnosticReportDisplay/DiagnosticReportDisplay.stories.d.ts +1 -0
- package/dist/cjs/MedplumProvider/MedplumProvider.d.ts +8 -0
- package/dist/cjs/NoteDisplay/NoteDisplay.d.ts +6 -0
- package/dist/cjs/{ResourceDiffTable/ResourceDiffTable.stories.d.ts → NoteDisplay/NoteDisplay.stories.d.ts} +3 -1
- package/dist/cjs/QuantityInput/QuantityInput.d.ts +1 -0
- package/dist/cjs/QuantityInput/QuantityInput.stories.d.ts +7 -0
- package/dist/cjs/ReferenceRangeEditor/ReferenceRangeEditor.d.ts +1 -2
- package/dist/cjs/ResourceTimeline/ResourceTimeline.d.ts +2 -2
- package/dist/cjs/index.cjs +1206 -1204
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.min.cjs +1 -1
- package/dist/esm/AddressDisplay/AddressDisplay.mjs +2 -2
- package/dist/esm/AddressDisplay/AddressDisplay.mjs.map +1 -1
- package/dist/esm/AddressInput/AddressInput.mjs +9 -9
- package/dist/esm/AddressInput/AddressInput.mjs.map +1 -1
- package/dist/esm/AnnotationInput/AnnotationInput.mjs +2 -2
- package/dist/esm/AnnotationInput/AnnotationInput.mjs.map +1 -1
- package/dist/esm/AsyncAutocomplete/AsyncAutocomplete.mjs +2 -2
- package/dist/esm/AsyncAutocomplete/AsyncAutocomplete.mjs.map +1 -1
- package/dist/esm/AttachmentArrayDisplay/AttachmentArrayDisplay.mjs +4 -4
- package/dist/esm/AttachmentArrayDisplay/AttachmentArrayDisplay.mjs.map +1 -1
- package/dist/esm/AttachmentArrayInput/AttachmentArrayInput.mjs +19 -19
- package/dist/esm/AttachmentArrayInput/AttachmentArrayInput.mjs.map +1 -1
- package/dist/esm/AttachmentButton/AttachmentButton.mjs +3 -3
- package/dist/esm/AttachmentButton/AttachmentButton.mjs.map +1 -1
- package/dist/esm/AttachmentDisplay/AttachmentDisplay.mjs +9 -9
- package/dist/esm/AttachmentDisplay/AttachmentDisplay.mjs.map +1 -1
- package/dist/esm/AttachmentInput/AttachmentInput.mjs +5 -5
- package/dist/esm/AttachmentInput/AttachmentInput.mjs.map +1 -1
- package/dist/esm/BackboneElementDisplay/BackboneElementDisplay.mjs +6 -6
- package/dist/esm/BackboneElementDisplay/BackboneElementDisplay.mjs.map +1 -1
- package/dist/esm/BackboneElementInput/BackboneElementInput.mjs +7 -7
- package/dist/esm/BackboneElementInput/BackboneElementInput.mjs.map +1 -1
- package/dist/esm/CalendarInput/CalendarInput.mjs +18 -18
- package/dist/esm/CalendarInput/CalendarInput.mjs.map +1 -1
- package/dist/esm/CheckboxFormSection/CheckboxFormSection.mjs +5 -5
- package/dist/esm/CheckboxFormSection/CheckboxFormSection.mjs.map +1 -1
- package/dist/esm/CodeInput/CodeInput.mjs +2 -2
- package/dist/esm/CodeInput/CodeInput.mjs.map +1 -1
- package/dist/esm/CodeableConceptDisplay/CodeableConceptDisplay.mjs +2 -2
- package/dist/esm/CodeableConceptDisplay/CodeableConceptDisplay.mjs.map +1 -1
- package/dist/esm/CodeableConceptInput/CodeableConceptInput.mjs +2 -2
- package/dist/esm/CodeableConceptInput/CodeableConceptInput.mjs.map +1 -1
- package/dist/esm/CodingDisplay/CodingDisplay.mjs +2 -2
- package/dist/esm/CodingDisplay/CodingDisplay.mjs.map +1 -1
- package/dist/esm/CodingInput/CodingInput.mjs +2 -2
- package/dist/esm/CodingInput/CodingInput.mjs.map +1 -1
- package/dist/esm/ContactDetailDisplay/ContactDetailDisplay.mjs +3 -3
- package/dist/esm/ContactDetailDisplay/ContactDetailDisplay.mjs.map +1 -1
- package/dist/esm/ContactDetailInput/ContactDetailInput.mjs +4 -4
- package/dist/esm/ContactDetailInput/ContactDetailInput.mjs.map +1 -1
- package/dist/esm/ContactPointDisplay/ContactPointDisplay.mjs +2 -2
- package/dist/esm/ContactPointDisplay/ContactPointDisplay.mjs.map +1 -1
- package/dist/esm/ContactPointInput/ContactPointInput.mjs +5 -5
- package/dist/esm/ContactPointInput/ContactPointInput.mjs.map +1 -1
- package/dist/esm/Container/Container.mjs +2 -2
- package/dist/esm/Container/Container.mjs.map +1 -1
- package/dist/esm/DateTimeInput/DateTimeInput.mjs +2 -2
- package/dist/esm/DateTimeInput/DateTimeInput.mjs.map +1 -1
- package/dist/esm/DefaultResourceTimeline/DefaultResourceTimeline.mjs +7 -19
- package/dist/esm/DefaultResourceTimeline/DefaultResourceTimeline.mjs.map +1 -1
- package/dist/esm/DescriptionList/DescriptionList.mjs +5 -5
- package/dist/esm/DescriptionList/DescriptionList.mjs.map +1 -1
- package/dist/esm/DiagnosticReportDisplay/DiagnosticReportDisplay.d.ts +2 -0
- package/dist/esm/DiagnosticReportDisplay/DiagnosticReportDisplay.mjs +56 -52
- package/dist/esm/DiagnosticReportDisplay/DiagnosticReportDisplay.mjs.map +1 -1
- package/dist/esm/DiagnosticReportDisplay/DiagnosticReportDisplay.stories.d.ts +1 -0
- package/dist/esm/Document/Document.mjs +3 -3
- package/dist/esm/Document/Document.mjs.map +1 -1
- package/dist/esm/EncounterTimeline/EncounterTimeline.mjs +8 -25
- package/dist/esm/EncounterTimeline/EncounterTimeline.mjs.map +1 -1
- package/dist/esm/ErrorBoundary/ErrorBoundary.mjs +4 -4
- package/dist/esm/ErrorBoundary/ErrorBoundary.mjs.map +1 -1
- package/dist/esm/ExtensionInput/ExtensionInput.mjs +2 -2
- package/dist/esm/ExtensionInput/ExtensionInput.mjs.map +1 -1
- package/dist/esm/FhirPathDisplay/FhirPathDisplay.mjs +2 -2
- package/dist/esm/FhirPathDisplay/FhirPathDisplay.mjs.map +1 -1
- package/dist/esm/FhirPathTable/FhirPathTable.mjs +19 -19
- package/dist/esm/FhirPathTable/FhirPathTable.mjs.map +1 -1
- package/dist/esm/Form/Form.mjs +2 -2
- package/dist/esm/Form/Form.mjs.map +1 -1
- package/dist/esm/FormSection/FormSection.mjs +2 -2
- package/dist/esm/FormSection/FormSection.mjs.map +1 -1
- package/dist/esm/GoogleButton/GoogleButton.mjs +8 -6
- package/dist/esm/GoogleButton/GoogleButton.mjs.map +1 -1
- package/dist/esm/HumanNameDisplay/HumanNameDisplay.mjs +2 -2
- package/dist/esm/HumanNameDisplay/HumanNameDisplay.mjs.map +1 -1
- package/dist/esm/HumanNameInput/HumanNameInput.mjs +7 -7
- package/dist/esm/HumanNameInput/HumanNameInput.mjs.map +1 -1
- package/dist/esm/IdentifierDisplay/IdentifierDisplay.mjs +2 -2
- package/dist/esm/IdentifierDisplay/IdentifierDisplay.mjs.map +1 -1
- package/dist/esm/IdentifierInput/IdentifierInput.mjs +4 -4
- package/dist/esm/IdentifierInput/IdentifierInput.mjs.map +1 -1
- package/dist/esm/Logo/Logo.mjs +8 -8
- package/dist/esm/Logo/Logo.mjs.map +1 -1
- package/dist/esm/MedplumLink/MedplumLink.mjs +4 -4
- package/dist/esm/MedplumLink/MedplumLink.mjs.map +1 -1
- package/dist/esm/MedplumProvider/MedplumProvider.d.ts +8 -0
- package/dist/esm/MedplumProvider/MedplumProvider.mjs +19 -3
- package/dist/esm/MedplumProvider/MedplumProvider.mjs.map +1 -1
- package/dist/esm/MoneyDisplay/MoneyDisplay.mjs +2 -2
- package/dist/esm/MoneyDisplay/MoneyDisplay.mjs.map +1 -1
- package/dist/esm/MoneyInput/MoneyInput.mjs +4 -4
- package/dist/esm/MoneyInput/MoneyInput.mjs.map +1 -1
- package/dist/esm/NoteDisplay/NoteDisplay.d.ts +6 -0
- package/dist/esm/NoteDisplay/NoteDisplay.mjs +18 -0
- package/dist/esm/NoteDisplay/NoteDisplay.mjs.map +1 -0
- package/dist/esm/{ResourceDiffTable/ResourceDiffTable.stories.d.ts → NoteDisplay/NoteDisplay.stories.d.ts} +3 -1
- package/dist/esm/OperationOutcomeAlert/OperationOutcomeAlert.mjs +3 -3
- package/dist/esm/OperationOutcomeAlert/OperationOutcomeAlert.mjs.map +1 -1
- package/dist/esm/Panel/Panel.mjs +2 -2
- package/dist/esm/Panel/Panel.mjs.map +1 -1
- package/dist/esm/PatientTimeline/PatientTimeline.mjs +13 -20
- package/dist/esm/PatientTimeline/PatientTimeline.mjs.map +1 -1
- package/dist/esm/PeriodInput/PeriodInput.mjs +4 -4
- package/dist/esm/PeriodInput/PeriodInput.mjs.map +1 -1
- package/dist/esm/PlanDefinitionBuilder/PlanDefinitionBuilder.mjs +34 -34
- package/dist/esm/PlanDefinitionBuilder/PlanDefinitionBuilder.mjs.map +1 -1
- package/dist/esm/QuantityDisplay/QuantityDisplay.mjs +2 -2
- package/dist/esm/QuantityDisplay/QuantityDisplay.mjs.map +1 -1
- package/dist/esm/QuantityInput/QuantityInput.d.ts +1 -0
- package/dist/esm/QuantityInput/QuantityInput.mjs +14 -8
- package/dist/esm/QuantityInput/QuantityInput.mjs.map +1 -1
- package/dist/esm/QuantityInput/QuantityInput.stories.d.ts +7 -0
- package/dist/esm/QuestionnaireBuilder/QuestionnaireBuilder.mjs +31 -31
- package/dist/esm/QuestionnaireBuilder/QuestionnaireBuilder.mjs.map +1 -1
- package/dist/esm/QuestionnaireForm/QuestionnaireForm.mjs +33 -33
- package/dist/esm/QuestionnaireForm/QuestionnaireForm.mjs.map +1 -1
- package/dist/esm/RangeDisplay/RangeDisplay.mjs +2 -2
- package/dist/esm/RangeDisplay/RangeDisplay.mjs.map +1 -1
- package/dist/esm/RangeInput/RangeInput.mjs +4 -4
- package/dist/esm/RangeInput/RangeInput.mjs.map +1 -1
- package/dist/esm/RatioDisplay/RatioDisplay.mjs +4 -4
- package/dist/esm/RatioDisplay/RatioDisplay.mjs.map +1 -1
- package/dist/esm/RatioInput/RatioInput.mjs +4 -4
- package/dist/esm/RatioInput/RatioInput.mjs.map +1 -1
- package/dist/esm/ReferenceDisplay/ReferenceDisplay.mjs +3 -3
- package/dist/esm/ReferenceDisplay/ReferenceDisplay.mjs.map +1 -1
- package/dist/esm/ReferenceInput/ReferenceInput.mjs +4 -4
- package/dist/esm/ReferenceInput/ReferenceInput.mjs.map +1 -1
- package/dist/esm/ReferenceRangeEditor/ReferenceRangeEditor.d.ts +1 -2
- package/dist/esm/ReferenceRangeEditor/ReferenceRangeEditor.mjs +31 -31
- package/dist/esm/ReferenceRangeEditor/ReferenceRangeEditor.mjs.map +1 -1
- package/dist/esm/RequestGroupDisplay/RequestGroupDisplay.mjs +15 -15
- package/dist/esm/RequestGroupDisplay/RequestGroupDisplay.mjs.map +1 -1
- package/dist/esm/ResourceArrayDisplay/ResourceArrayDisplay.mjs +3 -3
- package/dist/esm/ResourceArrayDisplay/ResourceArrayDisplay.mjs.map +1 -1
- package/dist/esm/ResourceArrayInput/ResourceArrayInput.mjs +18 -18
- package/dist/esm/ResourceArrayInput/ResourceArrayInput.mjs.map +1 -1
- package/dist/esm/ResourceAvatar/ResourceAvatar.mjs +4 -4
- package/dist/esm/ResourceAvatar/ResourceAvatar.mjs.map +1 -1
- package/dist/esm/ResourceBadge/ResourceBadge.mjs +4 -4
- package/dist/esm/ResourceBadge/ResourceBadge.mjs.map +1 -1
- package/dist/esm/ResourceBlame/ResourceBlame.mjs +13 -13
- package/dist/esm/ResourceBlame/ResourceBlame.mjs.map +1 -1
- package/dist/esm/ResourceDiff/ResourceDiff.mjs +7 -7
- package/dist/esm/ResourceDiff/ResourceDiff.mjs.map +1 -1
- package/dist/esm/ResourceDiffTable/ResourceDiffTable.mjs +18 -18
- package/dist/esm/ResourceDiffTable/ResourceDiffTable.mjs.map +1 -1
- package/dist/esm/ResourceForm/ResourceForm.mjs +12 -12
- package/dist/esm/ResourceForm/ResourceForm.mjs.map +1 -1
- package/dist/esm/ResourceHistoryTable/ResourceHistoryTable.mjs +17 -17
- package/dist/esm/ResourceHistoryTable/ResourceHistoryTable.mjs.map +1 -1
- package/dist/esm/ResourceInput/ResourceInput.mjs +8 -8
- package/dist/esm/ResourceInput/ResourceInput.mjs.map +1 -1
- package/dist/esm/ResourceName/ResourceName.mjs +2 -2
- package/dist/esm/ResourceName/ResourceName.mjs.map +1 -1
- package/dist/esm/ResourcePropertyDisplay/ResourcePropertyDisplay.mjs +27 -27
- package/dist/esm/ResourcePropertyDisplay/ResourcePropertyDisplay.mjs.map +1 -1
- package/dist/esm/ResourcePropertyInput/ResourcePropertyInput.mjs +35 -35
- package/dist/esm/ResourcePropertyInput/ResourcePropertyInput.mjs.map +1 -1
- package/dist/esm/ResourceTable/ResourceTable.mjs +2 -2
- package/dist/esm/ResourceTable/ResourceTable.mjs.map +1 -1
- package/dist/esm/ResourceTimeline/ResourceTimeline.d.ts +2 -2
- package/dist/esm/ResourceTimeline/ResourceTimeline.mjs +67 -73
- package/dist/esm/ResourceTimeline/ResourceTimeline.mjs.map +1 -1
- package/dist/esm/Scheduler/Scheduler.mjs +22 -22
- package/dist/esm/Scheduler/Scheduler.mjs.map +1 -1
- package/dist/esm/SearchControl/SearchControl.mjs +49 -49
- package/dist/esm/SearchControl/SearchControl.mjs.map +1 -1
- package/dist/esm/SearchControl/SearchUtils.mjs +4 -4
- package/dist/esm/SearchControl/SearchUtils.mjs.map +1 -1
- package/dist/esm/SearchFieldEditor/SearchFieldEditor.mjs +25 -25
- package/dist/esm/SearchFieldEditor/SearchFieldEditor.mjs.map +1 -1
- package/dist/esm/SearchFilterEditor/SearchFilterEditor.mjs +37 -37
- package/dist/esm/SearchFilterEditor/SearchFilterEditor.mjs.map +1 -1
- package/dist/esm/SearchFilterValueDialog/SearchFilterValueDialog.mjs +6 -6
- package/dist/esm/SearchFilterValueDialog/SearchFilterValueDialog.mjs.map +1 -1
- package/dist/esm/SearchFilterValueDisplay/SearchFilterValueDisplay.mjs +4 -4
- package/dist/esm/SearchFilterValueDisplay/SearchFilterValueDisplay.mjs.map +1 -1
- package/dist/esm/SearchFilterValueInput/SearchFilterValueInput.mjs +8 -8
- package/dist/esm/SearchFilterValueInput/SearchFilterValueInput.mjs.map +1 -1
- package/dist/esm/SearchPopupMenu/SearchPopupMenu.mjs +62 -62
- package/dist/esm/SearchPopupMenu/SearchPopupMenu.mjs.map +1 -1
- package/dist/esm/ServiceRequestTimeline/ServiceRequestTimeline.mjs +9 -31
- package/dist/esm/ServiceRequestTimeline/ServiceRequestTimeline.mjs.map +1 -1
- package/dist/esm/StatusBadge/StatusBadge.mjs +2 -2
- package/dist/esm/StatusBadge/StatusBadge.mjs.map +1 -1
- package/dist/esm/Timeline/Timeline.mjs +20 -20
- package/dist/esm/Timeline/Timeline.mjs.map +1 -1
- package/dist/esm/TimingInput/TimingInput.mjs +19 -19
- package/dist/esm/TimingInput/TimingInput.mjs.map +1 -1
- package/dist/esm/ValueSetAutocomplete/ValueSetAutocomplete.mjs +2 -2
- package/dist/esm/ValueSetAutocomplete/ValueSetAutocomplete.mjs.map +1 -1
- package/dist/esm/auth/AuthenticationForm.mjs +22 -22
- package/dist/esm/auth/AuthenticationForm.mjs.map +1 -1
- package/dist/esm/auth/ChooseProfileForm.mjs +11 -11
- package/dist/esm/auth/ChooseProfileForm.mjs.map +1 -1
- package/dist/esm/auth/ChooseScopeForm.mjs +9 -9
- package/dist/esm/auth/ChooseScopeForm.mjs.map +1 -1
- package/dist/esm/auth/MfaForm.mjs +12 -12
- package/dist/esm/auth/MfaForm.mjs.map +1 -1
- package/dist/esm/auth/NewProjectForm.mjs +12 -12
- package/dist/esm/auth/NewProjectForm.mjs.map +1 -1
- package/dist/esm/auth/NewUserForm.mjs +22 -22
- package/dist/esm/auth/NewUserForm.mjs.map +1 -1
- package/dist/esm/auth/RegisterForm.mjs +5 -5
- package/dist/esm/auth/RegisterForm.mjs.map +1 -1
- package/dist/esm/auth/SignInForm.mjs +8 -8
- package/dist/esm/auth/SignInForm.mjs.map +1 -1
- package/dist/esm/index.min.mjs +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/node_modules/@tabler/icons/icons-react/dist/index.esm.mjs +6 -0
- package/dist/esm/node_modules/@tabler/icons/icons-react/dist/index.esm.mjs.map +1 -0
- package/dist/esm/useResource/useResource.mjs +3 -0
- package/dist/esm/useResource/useResource.mjs.map +1 -1
- package/package.json +20 -25
- package/rollup.config.mjs +0 -110
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NewUserForm.mjs","sources":["../../../src/auth/NewUserForm.tsx"],"sourcesContent":["import { Anchor, Button, Center, Checkbox, Divider, Group, PasswordInput, Stack, Text, TextInput } from '@mantine/core';\nimport { GoogleCredentialResponse, LoginAuthenticationResponse } from '@medplum/core';\nimport { OperationOutcome } from '@medplum/fhirtypes';\nimport React, { useEffect, useState } from 'react';\nimport { Form } from '../Form/Form';\nimport { getGoogleClientId, GoogleButton } from '../GoogleButton/GoogleButton';\nimport { useMedplum } from '../MedplumProvider/MedplumProvider';\nimport { OperationOutcomeAlert } from '../OperationOutcomeAlert/OperationOutcomeAlert';\nimport { getErrorsForInput, getIssuesForExpression } from '../utils/outcomes';\nimport { getRecaptcha, initRecaptcha } from '../utils/recaptcha';\n\nexport interface NewUserFormProps {\n readonly projectId: string;\n readonly googleClientId?: string;\n readonly recaptchaSiteKey: string;\n readonly children?: React.ReactNode;\n readonly handleAuthResponse: (response: LoginAuthenticationResponse) => void;\n}\n\nexport function NewUserForm(props: NewUserFormProps): JSX.Element {\n const googleClientId = getGoogleClientId(props.googleClientId);\n const recaptchaSiteKey = props.recaptchaSiteKey;\n const medplum = useMedplum();\n const [outcome, setOutcome] = useState<OperationOutcome>();\n const issues = getIssuesForExpression(outcome, undefined);\n\n useEffect(() => initRecaptcha(recaptchaSiteKey), [recaptchaSiteKey]);\n\n return (\n <Form\n style={{ maxWidth: 400 }}\n onSubmit={async (formData: Record<string, string>) => {\n try {\n const recaptchaToken = await getRecaptcha(recaptchaSiteKey);\n props.handleAuthResponse(\n await medplum.startNewUser({\n projectId: props.projectId,\n firstName: formData.firstName,\n lastName: formData.lastName,\n email: formData.email,\n password: formData.password,\n remember: formData.remember === 'true',\n recaptchaSiteKey,\n recaptchaToken,\n })\n );\n } catch (err) {\n setOutcome(err as OperationOutcome);\n }\n }}\n >\n <Center sx={{ flexDirection: 'column' }}>{props.children}</Center>\n <OperationOutcomeAlert issues={issues} />\n {googleClientId && (\n <>\n <Group position=\"center\" p=\"xl\" style={{ height: 70 }}>\n <GoogleButton\n googleClientId={googleClientId}\n handleGoogleCredential={async (response: GoogleCredentialResponse) => {\n try {\n props.handleAuthResponse(\n await medplum.startGoogleLogin({\n googleClientId: response.clientId,\n googleCredential: response.credential,\n createUser: true,\n })\n );\n } catch (err) {\n setOutcome(err as OperationOutcome);\n }\n }}\n />\n </Group>\n <Divider label=\"or\" labelPosition=\"center\" my=\"lg\" />\n </>\n )}\n <Stack spacing=\"xl\">\n <TextInput\n name=\"firstName\"\n type=\"text\"\n label=\"First name\"\n placeholder=\"First name\"\n required={true}\n autoFocus={true}\n error={getErrorsForInput(outcome, 'firstName')}\n />\n <TextInput\n name=\"lastName\"\n type=\"text\"\n label=\"Last name\"\n placeholder=\"Last name\"\n required={true}\n error={getErrorsForInput(outcome, 'lastName')}\n />\n <TextInput\n name=\"email\"\n type=\"email\"\n label=\"Email\"\n placeholder=\"name@domain.com\"\n required={true}\n error={getErrorsForInput(outcome, 'email')}\n />\n <PasswordInput\n name=\"password\"\n label=\"Password\"\n autoComplete=\"off\"\n required={true}\n error={getErrorsForInput(outcome, 'password')}\n />\n <Text color=\"dimmed\" size=\"xs\">\n By clicking submit you agree to the Medplum{' '}\n <Anchor href=\"https://www.medplum.com/privacy\">Privacy Policy</Anchor>\n {' and '}\n <Anchor href=\"https://www.medplum.com/terms\">Terms of Service</Anchor>.\n </Text>\n <Text color=\"dimmed\" size=\"xs\">\n This site is protected by reCAPTCHA and the Google{' '}\n <Anchor href=\"https://policies.google.com/privacy\">Privacy Policy</Anchor>\n {' and '}\n <Anchor href=\"https://policies.google.com/terms\">Terms of Service</Anchor> apply.\n </Text>\n </Stack>\n <Group position=\"apart\" mt=\"xl\" noWrap>\n <Checkbox name=\"remember\" label=\"Remember me\" size=\"xs\" />\n <Button type=\"submit\">Create account</Button>\n </Group>\n </Form>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;AAmBM,SAAU,WAAW,CAAC,KAAuB,EAAA;IACjD,MAAM,cAAc,GAAG,iBAAiB,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;AAC/D,IAAA,MAAM,gBAAgB,GAAG,KAAK,CAAC,gBAAgB,CAAC;AAChD,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,EAAoB,CAAC;IAC3D,MAAM,MAAM,GAAG,sBAAsB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AAE1D,IAAA,SAAS,CAAC,MAAM,aAAa,CAAC,gBAAgB,CAAC,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC;AAErE,IAAA,
|
|
1
|
+
{"version":3,"file":"NewUserForm.mjs","sources":["../../../src/auth/NewUserForm.tsx"],"sourcesContent":["import { Anchor, Button, Center, Checkbox, Divider, Group, PasswordInput, Stack, Text, TextInput } from '@mantine/core';\nimport { GoogleCredentialResponse, LoginAuthenticationResponse } from '@medplum/core';\nimport { OperationOutcome } from '@medplum/fhirtypes';\nimport React, { useEffect, useState } from 'react';\nimport { Form } from '../Form/Form';\nimport { getGoogleClientId, GoogleButton } from '../GoogleButton/GoogleButton';\nimport { useMedplum } from '../MedplumProvider/MedplumProvider';\nimport { OperationOutcomeAlert } from '../OperationOutcomeAlert/OperationOutcomeAlert';\nimport { getErrorsForInput, getIssuesForExpression } from '../utils/outcomes';\nimport { getRecaptcha, initRecaptcha } from '../utils/recaptcha';\n\nexport interface NewUserFormProps {\n readonly projectId: string;\n readonly googleClientId?: string;\n readonly recaptchaSiteKey: string;\n readonly children?: React.ReactNode;\n readonly handleAuthResponse: (response: LoginAuthenticationResponse) => void;\n}\n\nexport function NewUserForm(props: NewUserFormProps): JSX.Element {\n const googleClientId = getGoogleClientId(props.googleClientId);\n const recaptchaSiteKey = props.recaptchaSiteKey;\n const medplum = useMedplum();\n const [outcome, setOutcome] = useState<OperationOutcome>();\n const issues = getIssuesForExpression(outcome, undefined);\n\n useEffect(() => initRecaptcha(recaptchaSiteKey), [recaptchaSiteKey]);\n\n return (\n <Form\n style={{ maxWidth: 400 }}\n onSubmit={async (formData: Record<string, string>) => {\n try {\n const recaptchaToken = await getRecaptcha(recaptchaSiteKey);\n props.handleAuthResponse(\n await medplum.startNewUser({\n projectId: props.projectId,\n firstName: formData.firstName,\n lastName: formData.lastName,\n email: formData.email,\n password: formData.password,\n remember: formData.remember === 'true',\n recaptchaSiteKey,\n recaptchaToken,\n })\n );\n } catch (err) {\n setOutcome(err as OperationOutcome);\n }\n }}\n >\n <Center sx={{ flexDirection: 'column' }}>{props.children}</Center>\n <OperationOutcomeAlert issues={issues} />\n {googleClientId && (\n <>\n <Group position=\"center\" p=\"xl\" style={{ height: 70 }}>\n <GoogleButton\n googleClientId={googleClientId}\n handleGoogleCredential={async (response: GoogleCredentialResponse) => {\n try {\n props.handleAuthResponse(\n await medplum.startGoogleLogin({\n googleClientId: response.clientId,\n googleCredential: response.credential,\n createUser: true,\n })\n );\n } catch (err) {\n setOutcome(err as OperationOutcome);\n }\n }}\n />\n </Group>\n <Divider label=\"or\" labelPosition=\"center\" my=\"lg\" />\n </>\n )}\n <Stack spacing=\"xl\">\n <TextInput\n name=\"firstName\"\n type=\"text\"\n label=\"First name\"\n placeholder=\"First name\"\n required={true}\n autoFocus={true}\n error={getErrorsForInput(outcome, 'firstName')}\n />\n <TextInput\n name=\"lastName\"\n type=\"text\"\n label=\"Last name\"\n placeholder=\"Last name\"\n required={true}\n error={getErrorsForInput(outcome, 'lastName')}\n />\n <TextInput\n name=\"email\"\n type=\"email\"\n label=\"Email\"\n placeholder=\"name@domain.com\"\n required={true}\n error={getErrorsForInput(outcome, 'email')}\n />\n <PasswordInput\n name=\"password\"\n label=\"Password\"\n autoComplete=\"off\"\n required={true}\n error={getErrorsForInput(outcome, 'password')}\n />\n <Text color=\"dimmed\" size=\"xs\">\n By clicking submit you agree to the Medplum{' '}\n <Anchor href=\"https://www.medplum.com/privacy\">Privacy Policy</Anchor>\n {' and '}\n <Anchor href=\"https://www.medplum.com/terms\">Terms of Service</Anchor>.\n </Text>\n <Text color=\"dimmed\" size=\"xs\">\n This site is protected by reCAPTCHA and the Google{' '}\n <Anchor href=\"https://policies.google.com/privacy\">Privacy Policy</Anchor>\n {' and '}\n <Anchor href=\"https://policies.google.com/terms\">Terms of Service</Anchor> apply.\n </Text>\n </Stack>\n <Group position=\"apart\" mt=\"xl\" noWrap>\n <Checkbox name=\"remember\" label=\"Remember me\" size=\"xs\" />\n <Button type=\"submit\">Create account</Button>\n </Group>\n </Form>\n );\n}\n"],"names":["React"],"mappings":";;;;;;;;;AAmBM,SAAU,WAAW,CAAC,KAAuB,EAAA;IACjD,MAAM,cAAc,GAAG,iBAAiB,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;AAC/D,IAAA,MAAM,gBAAgB,GAAG,KAAK,CAAC,gBAAgB,CAAC;AAChD,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,EAAoB,CAAC;IAC3D,MAAM,MAAM,GAAG,sBAAsB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AAE1D,IAAA,SAAS,CAAC,MAAM,aAAa,CAAC,gBAAgB,CAAC,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC;AAErE,IAAA,QACEA,UAAC,CAAA,aAAA,CAAA,IAAI,IACH,KAAK,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,EACxB,QAAQ,EAAE,OAAO,QAAgC,KAAI;YACnD,IAAI;AACF,gBAAA,MAAM,cAAc,GAAG,MAAM,YAAY,CAAC,gBAAgB,CAAC,CAAC;AAC5D,gBAAA,KAAK,C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
2
2
|
import { Document } from '../Document/Document.mjs';
|
|
3
3
|
import { useMedplum } from '../MedplumProvider/MedplumProvider.mjs';
|
|
4
4
|
import { NewProjectForm } from './NewProjectForm.mjs';
|
|
@@ -29,10 +29,10 @@ function RegisterForm(props) {
|
|
|
29
29
|
setLogin(response.login);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
return (
|
|
33
|
-
outcome &&
|
|
34
|
-
!login && (
|
|
35
|
-
login && type === 'project' &&
|
|
32
|
+
return (e__default.createElement(Document, { width: 450 },
|
|
33
|
+
outcome && e__default.createElement("pre", null, JSON.stringify(outcome, null, 2)),
|
|
34
|
+
!login && (e__default.createElement(NewUserForm, { projectId: projectId, googleClientId: googleClientId, recaptchaSiteKey: recaptchaSiteKey, handleAuthResponse: handleAuthResponse }, props.children)),
|
|
35
|
+
login && type === 'project' && e__default.createElement(NewProjectForm, { login: login, handleAuthResponse: handleAuthResponse })));
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export { RegisterForm };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RegisterForm.mjs","sources":["../../../src/auth/RegisterForm.tsx"],"sourcesContent":["import { LoginAuthenticationResponse } from '@medplum/core';\nimport { OperationOutcome } from '@medplum/fhirtypes';\nimport React, { useEffect, useState } from 'react';\nimport { Document } from '../Document/Document';\nimport { useMedplum } from '../MedplumProvider/MedplumProvider';\nimport { NewProjectForm } from './NewProjectForm';\nimport { NewUserForm } from './NewUserForm';\n\nexport interface RegisterFormProps {\n readonly type: 'patient' | 'project';\n readonly projectId?: string;\n readonly googleClientId?: string;\n readonly recaptchaSiteKey: string;\n readonly children?: React.ReactNode;\n readonly onSuccess: () => void;\n}\n\nexport function RegisterForm(props: RegisterFormProps): JSX.Element {\n const { type, projectId, googleClientId, recaptchaSiteKey, onSuccess } = props;\n const medplum = useMedplum();\n const [login, setLogin] = useState<string | undefined>(undefined);\n const [outcome, setOutcome] = useState<OperationOutcome>();\n\n useEffect(() => {\n if (type === 'patient' && login) {\n medplum\n .startNewPatient({ login, projectId: projectId as string })\n .then((response) => medplum.processCode(response.code as string))\n .then(() => onSuccess())\n .catch((err) => setOutcome(err as OperationOutcome));\n }\n }, [medplum, type, projectId, login, onSuccess]);\n\n function handleAuthResponse(response: LoginAuthenticationResponse): void {\n if (response.code) {\n medplum\n .processCode(response.code)\n .then(() => onSuccess())\n .catch(console.log);\n } else if (response.login) {\n setLogin(response.login);\n }\n }\n\n return (\n <Document width={450}>\n {outcome && <pre>{JSON.stringify(outcome, null, 2)}</pre>}\n {!login && (\n <NewUserForm\n projectId={projectId as string}\n googleClientId={googleClientId}\n recaptchaSiteKey={recaptchaSiteKey}\n handleAuthResponse={handleAuthResponse}\n >\n {props.children}\n </NewUserForm>\n )}\n {login && type === 'project' && <NewProjectForm login={login} handleAuthResponse={handleAuthResponse} />}\n </Document>\n );\n}\n"],"names":[],"mappings":";;;;;;AAiBM,SAAU,YAAY,CAAC,KAAwB,EAAA;AACnD,IAAA,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE,gBAAgB,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;AAC/E,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAqB,SAAS,CAAC,CAAC;IAClE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,EAAoB,CAAC;IAE3D,SAAS,CAAC,MAAK;AACb,QAAA,IAAI,IAAI,KAAK,SAAS,IAAI,KAAK,EAAE;YAC/B,OAAO;iBACJ,eAAe,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,SAAmB,EAAE,CAAC;AAC1D,iBAAA,IAAI,CAAC,CAAC,QAAQ,KAAK,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAc,CAAC,CAAC;AAChE,iBAAA,IAAI,CAAC,MAAM,SAAS,EAAE,CAAC;iBACvB,KAAK,CAAC,CAAC,GAAG,KAAK,UAAU,CAAC,GAAuB,CAAC,CAAC,CAAC;AACxD,SAAA;AACH,KAAC,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC;IAEjD,SAAS,kBAAkB,CAAC,QAAqC,EAAA;QAC/D,IAAI,QAAQ,CAAC,IAAI,EAAE;YACjB,OAAO;AACJ,iBAAA,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC;AAC1B,iBAAA,IAAI,CAAC,MAAM,SAAS,EAAE,CAAC;AACvB,iBAAA,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AACvB,SAAA;aAAM,IAAI,QAAQ,CAAC,KAAK,EAAE;AACzB,YAAA,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC1B,SAAA;KACF;AAED,IAAA,
|
|
1
|
+
{"version":3,"file":"RegisterForm.mjs","sources":["../../../src/auth/RegisterForm.tsx"],"sourcesContent":["import { LoginAuthenticationResponse } from '@medplum/core';\nimport { OperationOutcome } from '@medplum/fhirtypes';\nimport React, { useEffect, useState } from 'react';\nimport { Document } from '../Document/Document';\nimport { useMedplum } from '../MedplumProvider/MedplumProvider';\nimport { NewProjectForm } from './NewProjectForm';\nimport { NewUserForm } from './NewUserForm';\n\nexport interface RegisterFormProps {\n readonly type: 'patient' | 'project';\n readonly projectId?: string;\n readonly googleClientId?: string;\n readonly recaptchaSiteKey: string;\n readonly children?: React.ReactNode;\n readonly onSuccess: () => void;\n}\n\nexport function RegisterForm(props: RegisterFormProps): JSX.Element {\n const { type, projectId, googleClientId, recaptchaSiteKey, onSuccess } = props;\n const medplum = useMedplum();\n const [login, setLogin] = useState<string | undefined>(undefined);\n const [outcome, setOutcome] = useState<OperationOutcome>();\n\n useEffect(() => {\n if (type === 'patient' && login) {\n medplum\n .startNewPatient({ login, projectId: projectId as string })\n .then((response) => medplum.processCode(response.code as string))\n .then(() => onSuccess())\n .catch((err) => setOutcome(err as OperationOutcome));\n }\n }, [medplum, type, projectId, login, onSuccess]);\n\n function handleAuthResponse(response: LoginAuthenticationResponse): void {\n if (response.code) {\n medplum\n .processCode(response.code)\n .then(() => onSuccess())\n .catch(console.log);\n } else if (response.login) {\n setLogin(response.login);\n }\n }\n\n return (\n <Document width={450}>\n {outcome && <pre>{JSON.stringify(outcome, null, 2)}</pre>}\n {!login && (\n <NewUserForm\n projectId={projectId as string}\n googleClientId={googleClientId}\n recaptchaSiteKey={recaptchaSiteKey}\n handleAuthResponse={handleAuthResponse}\n >\n {props.children}\n </NewUserForm>\n )}\n {login && type === 'project' && <NewProjectForm login={login} handleAuthResponse={handleAuthResponse} />}\n </Document>\n );\n}\n"],"names":["React"],"mappings":";;;;;;AAiBM,SAAU,YAAY,CAAC,KAAwB,EAAA;AACnD,IAAA,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE,gBAAgB,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;AAC/E,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAqB,SAAS,CAAC,CAAC;IAClE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,EAAoB,CAAC;IAE3D,SAAS,CAAC,MAAK;AACb,QAAA,IAAI,IAAI,KAAK,SAAS,IAAI,KAAK,EAAE;YAC/B,OAAO;iBACJ,eAAe,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,SAAmB,EAAE,CAAC;AAC1D,iBAAA,IAAI,CAAC,CAAC,QAAQ,KAAK,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAc,CAAC,CAAC;AAChE,iBAAA,IAAI,CAAC,MAAM,SAAS,EAAE,CAAC;iBACvB,KAAK,CAAC,CAAC,GAAG,KAAK,UAAU,CAAC,GAAuB,CAAC,CAAC,CAAC;AACxD,SAAA;AACH,KAAC,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC;IAEjD,SAAS,kBAAkB,CAAC,QAAqC,EAAA;QAC/D,IAAI,QAAQ,CAAC,IAAI,EAAE;YACjB,OAAO;AACJ,iBAAA,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC;AAC1B,iBAAA,IAAI,CAAC,MAAM,SAAS,EAAE,CAAC;AACvB,iBAAA,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AACvB,SAAA;aAAM,IAAI,QAAQ,CAAC,KAAK,EAAE;AACzB,YAAA,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC1B,SAAA;KACF;AAED,IAAA,QACEA,UAAC,CAAA,aAAA,CAAA,QAAQ,EAAC,EAAA,KAAK,EAAE,GAAG,EAAA;AACjB,QAAA,OAAO,IAAIA,UAAA,CAAA,aAAA,CAAA,KAAA,EAAA,IAAA,EAAM,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAO;QACxD,CAAC,KAAK,KACLA,UAAC,CAAA,aAAA,CAAA,WAAW,EACV,EAAA,SAAS,EAAE,SAAmB,EAC9B,cAAc,EAAE,cAAc,EAC9B,gBAAgB,EAAE,gBAAgB,EAClC,kBAAkB,EAAE,kBAAkB,EAAA,EAErC,KAAK,CAAC,QAAQ,CACH,CACf;AACA,QAAA,KAAK,IAAI,IAAI,KAAK,SAAS,IAAIA,UAAA,CAAA,aAAA,CAAC,cAAc,EAAC,EAAA,KAAK,EAAE,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAI,CAAA,CAC/F,EACX;AACJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e__default, { useState, useCallback, useEffect } from 'react';
|
|
2
2
|
import { Document } from '../Document/Document.mjs';
|
|
3
3
|
import { useMedplum } from '../MedplumProvider/MedplumProvider.mjs';
|
|
4
4
|
import { AuthenticationForm } from './AuthenticationForm.mjs';
|
|
@@ -66,24 +66,24 @@ function SignInForm(props) {
|
|
|
66
66
|
.catch(console.error);
|
|
67
67
|
}
|
|
68
68
|
}, [medplum, props, handleAuthResponse]);
|
|
69
|
-
return (
|
|
69
|
+
return (e__default.createElement(Document, { width: 450 }, (() => {
|
|
70
70
|
if (!login) {
|
|
71
|
-
return (
|
|
71
|
+
return (e__default.createElement(AuthenticationForm, { onForgotPassword: onForgotPassword, onRegister: onRegister, handleAuthResponse: handleAuthResponse, ...baseLoginRequest }, props.children));
|
|
72
72
|
}
|
|
73
73
|
else if (mfaRequired) {
|
|
74
|
-
return
|
|
74
|
+
return e__default.createElement(MfaForm, { login: login, handleAuthResponse: handleAuthResponse });
|
|
75
75
|
}
|
|
76
76
|
else if (memberships) {
|
|
77
|
-
return
|
|
77
|
+
return e__default.createElement(ChooseProfileForm, { login: login, memberships: memberships, handleAuthResponse: handleAuthResponse });
|
|
78
78
|
}
|
|
79
79
|
else if (props.projectId === 'new') {
|
|
80
|
-
return
|
|
80
|
+
return e__default.createElement(NewProjectForm, { login: login, handleAuthResponse: handleAuthResponse });
|
|
81
81
|
}
|
|
82
82
|
else if (props.chooseScopes) {
|
|
83
|
-
return
|
|
83
|
+
return e__default.createElement(ChooseScopeForm, { login: login, scope: props.scope, handleAuthResponse: handleScopeResponse });
|
|
84
84
|
}
|
|
85
85
|
else {
|
|
86
|
-
return
|
|
86
|
+
return e__default.createElement("div", null, "Success");
|
|
87
87
|
}
|
|
88
88
|
})()));
|
|
89
89
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignInForm.mjs","sources":["../../../src/auth/SignInForm.tsx"],"sourcesContent":["import { BaseLoginRequest, LoginAuthenticationResponse } from '@medplum/core';\nimport { ProjectMembership } from '@medplum/fhirtypes';\nimport React, { useCallback, useEffect, useState } from 'react';\nimport { Document } from '../Document/Document';\nimport { useMedplum } from '../MedplumProvider/MedplumProvider';\nimport { AuthenticationForm } from './AuthenticationForm';\nimport { ChooseProfileForm } from './ChooseProfileForm';\nimport { ChooseScopeForm } from './ChooseScopeForm';\nimport { MfaForm } from './MfaForm';\nimport { NewProjectForm } from './NewProjectForm';\n\nexport interface SignInFormProps extends BaseLoginRequest {\n readonly login?: string;\n readonly chooseScopes?: boolean;\n readonly onSuccess?: () => void;\n readonly onForgotPassword?: () => void;\n readonly onRegister?: () => void;\n readonly onCode?: (code: string) => void;\n readonly children?: React.ReactNode;\n}\n\n/**\n * The SignInForm component allows users to sign in to Medplum.\n *\n * \"Signing in\" is a multi-step process:\n * 1) Authentication - identify the user\n * 2) MFA - If MFA is enabled, prompt for MFA code\n * 3) Choose profile - If the user has multiple profiles, prompt to choose one\n * 4) Choose scope - If the user has multiple scopes, prompt to choose one\n * 5) Success - Return to the caller with either a code or a redirect\n */\nexport function SignInForm(props: SignInFormProps): JSX.Element {\n const { chooseScopes, onSuccess, onForgotPassword, onRegister, onCode, ...baseLoginRequest } = props;\n const medplum = useMedplum();\n const [login, setLogin] = useState<string | undefined>(undefined);\n const [mfaRequired, setAuthenticatorRequired] = useState<boolean>(false);\n const [memberships, setMemberships] = useState<ProjectMembership[] | undefined>(undefined);\n\n const handleCode = useCallback(\n (code: string): void => {\n if (onCode) {\n onCode(code);\n } else {\n medplum\n .processCode(code)\n .then(() => {\n if (onSuccess) {\n onSuccess();\n }\n })\n .catch(console.log);\n }\n },\n [medplum, onCode, onSuccess]\n );\n\n const handleAuthResponse = useCallback(\n (response: LoginAuthenticationResponse): void => {\n setAuthenticatorRequired(!!response.mfaRequired);\n\n if (response.login) {\n setLogin(response.login);\n }\n\n if (response.memberships) {\n setMemberships(response.memberships);\n }\n\n if (response.code) {\n if (chooseScopes) {\n setMemberships(undefined);\n } else {\n handleCode(response.code as string);\n }\n }\n },\n [chooseScopes, handleCode]\n );\n\n const handleScopeResponse = useCallback(\n (response: LoginAuthenticationResponse): void => {\n handleCode(response.code as string);\n },\n [handleCode]\n );\n\n useEffect(() => {\n if (props.login) {\n medplum\n .get('auth/login/' + props.login)\n .then(handleAuthResponse)\n .catch(console.error);\n }\n }, [medplum, props, handleAuthResponse]);\n\n return (\n <Document width={450}>\n {(() => {\n if (!login) {\n return (\n <AuthenticationForm\n onForgotPassword={onForgotPassword}\n onRegister={onRegister}\n handleAuthResponse={handleAuthResponse}\n {...baseLoginRequest}\n >\n {props.children}\n </AuthenticationForm>\n );\n } else if (mfaRequired) {\n return <MfaForm login={login} handleAuthResponse={handleAuthResponse} />;\n } else if (memberships) {\n return <ChooseProfileForm login={login} memberships={memberships} handleAuthResponse={handleAuthResponse} />;\n } else if (props.projectId === 'new') {\n return <NewProjectForm login={login} handleAuthResponse={handleAuthResponse} />;\n } else if (props.chooseScopes) {\n return <ChooseScopeForm login={login} scope={props.scope} handleAuthResponse={handleScopeResponse} />;\n } else {\n return <div>Success</div>;\n }\n })()}\n </Document>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;AAqBA;;;;;;;;;AASG;AACG,SAAU,UAAU,CAAC,KAAsB,EAAA;AAC/C,IAAA,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,gBAAgB,EAAE,GAAG,KAAK,CAAC;AACrG,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAqB,SAAS,CAAC,CAAC;IAClE,MAAM,CAAC,WAAW,EAAE,wBAAwB,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IACzE,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAkC,SAAS,CAAC,CAAC;AAE3F,IAAA,MAAM,UAAU,GAAG,WAAW,CAC5B,CAAC,IAAY,KAAU;AACrB,QAAA,IAAI,MAAM,EAAE;YACV,MAAM,CAAC,IAAI,CAAC,CAAC;AACd,SAAA;AAAM,aAAA;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AACxB,iBAAA,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AACzB,SAAA;KACF,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAEzC,
|
|
1
|
+
{"version":3,"file":"SignInForm.mjs","sources":["../../../src/auth/SignInForm.tsx"],"sourcesContent":["import { BaseLoginRequest, LoginAuthenticationResponse } from '@medplum/core';\nimport { ProjectMembership } from '@medplum/fhirtypes';\nimport React, { useCallback, useEffect, useState } from 'react';\nimport { Document } from '../Document/Document';\nimport { useMedplum } from '../MedplumProvider/MedplumProvider';\nimport { AuthenticationForm } from './AuthenticationForm';\nimport { ChooseProfileForm } from './ChooseProfileForm';\nimport { ChooseScopeForm } from './ChooseScopeForm';\nimport { MfaForm } from './MfaForm';\nimport { NewProjectForm } from './NewProjectForm';\n\nexport interface SignInFormProps extends BaseLoginRequest {\n readonly login?: string;\n readonly chooseScopes?: boolean;\n readonly onSuccess?: () => void;\n readonly onForgotPassword?: () => void;\n readonly onRegister?: () => void;\n readonly onCode?: (code: string) => void;\n readonly children?: React.ReactNode;\n}\n\n/**\n * The SignInForm component allows users to sign in to Medplum.\n *\n * \"Signing in\" is a multi-step process:\n * 1) Authentication - identify the user\n * 2) MFA - If MFA is enabled, prompt for MFA code\n * 3) Choose profile - If the user has multiple profiles, prompt to choose one\n * 4) Choose scope - If the user has multiple scopes, prompt to choose one\n * 5) Success - Return to the caller with either a code or a redirect\n */\nexport function SignInForm(props: SignInFormProps): JSX.Element {\n const { chooseScopes, onSuccess, onForgotPassword, onRegister, onCode, ...baseLoginRequest } = props;\n const medplum = useMedplum();\n const [login, setLogin] = useState<string | undefined>(undefined);\n const [mfaRequired, setAuthenticatorRequired] = useState<boolean>(false);\n const [memberships, setMemberships] = useState<ProjectMembership[] | undefined>(undefined);\n\n const handleCode = useCallback(\n (code: string): void => {\n if (onCode) {\n onCode(code);\n } else {\n medplum\n .processCode(code)\n .then(() => {\n if (onSuccess) {\n onSuccess();\n }\n })\n .catch(console.log);\n }\n },\n [medplum, onCode, onSuccess]\n );\n\n const handleAuthResponse = useCallback(\n (response: LoginAuthenticationResponse): void => {\n setAuthenticatorRequired(!!response.mfaRequired);\n\n if (response.login) {\n setLogin(response.login);\n }\n\n if (response.memberships) {\n setMemberships(response.memberships);\n }\n\n if (response.code) {\n if (chooseScopes) {\n setMemberships(undefined);\n } else {\n handleCode(response.code as string);\n }\n }\n },\n [chooseScopes, handleCode]\n );\n\n const handleScopeResponse = useCallback(\n (response: LoginAuthenticationResponse): void => {\n handleCode(response.code as string);\n },\n [handleCode]\n );\n\n useEffect(() => {\n if (props.login) {\n medplum\n .get('auth/login/' + props.login)\n .then(handleAuthResponse)\n .catch(console.error);\n }\n }, [medplum, props, handleAuthResponse]);\n\n return (\n <Document width={450}>\n {(() => {\n if (!login) {\n return (\n <AuthenticationForm\n onForgotPassword={onForgotPassword}\n onRegister={onRegister}\n handleAuthResponse={handleAuthResponse}\n {...baseLoginRequest}\n >\n {props.children}\n </AuthenticationForm>\n );\n } else if (mfaRequired) {\n return <MfaForm login={login} handleAuthResponse={handleAuthResponse} />;\n } else if (memberships) {\n return <ChooseProfileForm login={login} memberships={memberships} handleAuthResponse={handleAuthResponse} />;\n } else if (props.projectId === 'new') {\n return <NewProjectForm login={login} handleAuthResponse={handleAuthResponse} />;\n } else if (props.chooseScopes) {\n return <ChooseScopeForm login={login} scope={props.scope} handleAuthResponse={handleScopeResponse} />;\n } else {\n return <div>Success</div>;\n }\n })()}\n </Document>\n );\n}\n"],"names":["React"],"mappings":";;;;;;;;;AAqBA;;;;;;;;;AASG;AACG,SAAU,UAAU,CAAC,KAAsB,EAAA;AAC/C,IAAA,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,gBAAgB,EAAE,GAAG,KAAK,CAAC;AACrG,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,CAAC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