@medplum/react 2.0.1 → 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/index.cjs +1160 -1095
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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.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 +26 -26
- package/dist/esm/ResourcePropertyDisplay/ResourcePropertyDisplay.mjs.map +1 -1
- package/dist/esm/ResourcePropertyInput/ResourcePropertyInput.mjs +34 -34
- 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.mjs +49 -50
- 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 +2 -2
- 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 +9 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValueSetAutocomplete.mjs","sources":["../../../src/ValueSetAutocomplete/ValueSetAutocomplete.tsx"],"sourcesContent":["import { ElementDefinition, ValueSetExpansionContains } from '@medplum/fhirtypes';\nimport React, { useCallback } from 'react';\nimport {\n AsyncAutocomplete,\n AsyncAutocompleteOption,\n AsyncAutocompleteProps,\n} from '../AsyncAutocomplete/AsyncAutocomplete';\nimport { useMedplum } from '../MedplumProvider/MedplumProvider';\n\nexport interface ValueSetAutocompleteProps\n extends Omit<AsyncAutocompleteProps<ValueSetExpansionContains>, 'loadOptions' | 'toKey' | 'toOption'> {\n elementDefinition: ElementDefinition;\n}\n\nfunction toKey(element: ValueSetExpansionContains): string {\n return element.code as string;\n}\n\nfunction toOption(element: ValueSetExpansionContains): AsyncAutocompleteOption<ValueSetExpansionContains> {\n return {\n value: element.code as string,\n label: getDisplay(element),\n resource: element,\n };\n}\n\nfunction createValue(input: string): ValueSetExpansionContains {\n return {\n code: input,\n display: input,\n };\n}\n\nexport function ValueSetAutocomplete(props: ValueSetAutocompleteProps): JSX.Element {\n const medplum = useMedplum();\n const { elementDefinition, ...rest } = props;\n\n const loadValues = useCallback(\n async (input: string, signal: AbortSignal): Promise<ValueSetExpansionContains[]> => {\n const system = elementDefinition.binding?.valueSet as string;\n const valueSet = await medplum.searchValueSet(system, input, { signal });\n const valueSetElements = valueSet.expansion?.contains as ValueSetExpansionContains[];\n const newData: ValueSetExpansionContains[] = [];\n\n for (const valueSetElement of valueSetElements) {\n if (valueSetElement.code && !newData.some((item) => item.code === valueSetElement.code)) {\n newData.push(valueSetElement);\n }\n }\n\n return newData;\n },\n [medplum, elementDefinition]\n );\n\n return (\n <AsyncAutocomplete\n {...rest}\n creatable\n clearable\n toKey={toKey}\n toOption={toOption}\n loadOptions={loadValues}\n getCreateLabel={(query) => `+ Create ${query}`}\n onCreate={createValue}\n />\n );\n}\n\nfunction getDisplay(item: ValueSetExpansionContains): string {\n return item.display || item.code || '';\n}\n"],"names":[],"mappings":";;;;AAcA,SAAS,KAAK,CAAC,OAAkC,EAAA;IA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AAC,CAC7B,CAAC;AAEF,IAAA,
|
|
1
|
+
{"version":3,"file":"ValueSetAutocomplete.mjs","sources":["../../../src/ValueSetAutocomplete/ValueSetAutocomplete.tsx"],"sourcesContent":["import { ElementDefinition, ValueSetExpansionContains } from '@medplum/fhirtypes';\nimport React, { useCallback } from 'react';\nimport {\n AsyncAutocomplete,\n AsyncAutocompleteOption,\n AsyncAutocompleteProps,\n} from '../AsyncAutocomplete/AsyncAutocomplete';\nimport { useMedplum } from '../MedplumProvider/MedplumProvider';\n\nexport interface ValueSetAutocompleteProps\n extends Omit<AsyncAutocompleteProps<ValueSetExpansionContains>, 'loadOptions' | 'toKey' | 'toOption'> {\n elementDefinition: ElementDefinition;\n}\n\nfunction toKey(element: ValueSetExpansionContains): string {\n return element.code as string;\n}\n\nfunction toOption(element: ValueSetExpansionContains): AsyncAutocompleteOption<ValueSetExpansionContains> {\n return {\n value: element.code as string,\n label: getDisplay(element),\n resource: element,\n };\n}\n\nfunction createValue(input: string): ValueSetExpansionContains {\n return {\n code: input,\n display: input,\n };\n}\n\nexport function ValueSetAutocomplete(props: ValueSetAutocompleteProps): JSX.Element {\n const medplum = useMedplum();\n const { elementDefinition, ...rest } = props;\n\n const loadValues = useCallback(\n async (input: string, signal: AbortSignal): Promise<ValueSetExpansionContains[]> => {\n const system = elementDefinition.binding?.valueSet as string;\n const valueSet = await medplum.searchValueSet(system, input, { signal });\n const valueSetElements = valueSet.expansion?.contains as ValueSetExpansionContains[];\n const newData: ValueSetExpansionContains[] = [];\n\n for (const valueSetElement of valueSetElements) {\n if (valueSetElement.code && !newData.some((item) => item.code === valueSetElement.code)) {\n newData.push(valueSetElement);\n }\n }\n\n return newData;\n },\n [medplum, elementDefinition]\n );\n\n return (\n <AsyncAutocomplete\n {...rest}\n creatable\n clearable\n toKey={toKey}\n toOption={toOption}\n loadOptions={loadValues}\n getCreateLabel={(query) => `+ Create ${query}`}\n onCreate={createValue}\n />\n );\n}\n\nfunction getDisplay(item: ValueSetExp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,aAAA;AACF,SAAA;AAED,QAAA,OAAO,OAAO,CAAC;AACjB,KAAC,EACD,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAC7B,CAAC;AAEF,IAAA,QACEA,UAAC,CAAA,aAAA,CAAA,iBAAiB,EACZ,EAAA,GAAA,IAAI,EACR,SAAS,EAAA,IAAA,EACT,SAAS,EAAA,IAAA,EACT,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,UAAU,EACvB,cAAc,EAAE,CAAC,KAAK,KAAK,CAAY,SAAA,EAAA,KAAK,EAAE,EAC9C,QAAQ,EAAE,WAAW,EAAA,CACrB,EACF;AACJ,CAAC;AAED,SAAS,UAAU,CAAC,IAA+B,EAAA;IACjD,OAAO,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;AACzC;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Center, Group, Divider, TextInput, Anchor, Button, Stack, PasswordInput, Checkbox } from '@mantine/core';
|
|
2
|
-
import
|
|
2
|
+
import e__default, { useState, useCallback } from 'react';
|
|
3
3
|
import { Form } from '../Form/Form.mjs';
|
|
4
4
|
import { getGoogleClientId, GoogleButton } from '../GoogleButton/GoogleButton.mjs';
|
|
5
5
|
import { useMedplum } from '../MedplumProvider/MedplumProvider.mjs';
|
|
@@ -9,10 +9,10 @@ import { getIssuesForExpression, getErrorsForInput } from '../utils/outcomes.mjs
|
|
|
9
9
|
function AuthenticationForm(props) {
|
|
10
10
|
const [email, setEmail] = useState();
|
|
11
11
|
if (!email) {
|
|
12
|
-
return
|
|
12
|
+
return e__default.createElement(EmailForm, { setEmail: setEmail, ...props });
|
|
13
13
|
}
|
|
14
14
|
else {
|
|
15
|
-
return
|
|
15
|
+
return e__default.createElement(PasswordForm, { email: email, ...props });
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
function EmailForm(props) {
|
|
@@ -47,16 +47,16 @@ function EmailForm(props) {
|
|
|
47
47
|
handleAuthResponse(authResponse);
|
|
48
48
|
}
|
|
49
49
|
}, [medplum, baseLoginRequest, isExternalAuth, handleAuthResponse]);
|
|
50
|
-
return (
|
|
51
|
-
|
|
52
|
-
googleClientId && (
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
onRegister && (
|
|
59
|
-
|
|
50
|
+
return (e__default.createElement(Form, { style: { maxWidth: 400 }, onSubmit: handleSubmit },
|
|
51
|
+
e__default.createElement(Center, { sx: { flexDirection: 'column' } }, children),
|
|
52
|
+
googleClientId && (e__default.createElement(e__default.Fragment, null,
|
|
53
|
+
e__default.createElement(Group, { position: "center", p: "xl", style: { height: 70 } },
|
|
54
|
+
e__default.createElement(GoogleButton, { googleClientId: googleClientId, handleGoogleCredential: handleGoogleCredential })),
|
|
55
|
+
e__default.createElement(Divider, { label: "or", labelPosition: "center", my: "lg" }))),
|
|
56
|
+
e__default.createElement(TextInput, { name: "email", type: "email", label: "Email", placeholder: "name@domain.com", required: true, autoFocus: true }),
|
|
57
|
+
e__default.createElement(Group, { position: "apart", mt: "xl", spacing: 0, noWrap: true },
|
|
58
|
+
onRegister && (e__default.createElement(Anchor, { component: "button", type: "button", color: "dimmed", onClick: onRegister, size: "xs" }, "Register")),
|
|
59
|
+
e__default.createElement(Button, { type: "submit" }, "Next"))));
|
|
60
60
|
}
|
|
61
61
|
function PasswordForm(props) {
|
|
62
62
|
const { onForgotPassword, handleAuthResponse, children, ...baseLoginRequest } = props;
|
|
@@ -73,15 +73,15 @@ function PasswordForm(props) {
|
|
|
73
73
|
.then(handleAuthResponse)
|
|
74
74
|
.catch(setOutcome);
|
|
75
75
|
}, [medplum, baseLoginRequest, handleAuthResponse]);
|
|
76
|
-
return (
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
onForgotPassword && (
|
|
83
|
-
|
|
84
|
-
|
|
76
|
+
return (e__default.createElement(Form, { style: { maxWidth: 400 }, onSubmit: handleSubmit },
|
|
77
|
+
e__default.createElement(Center, { sx: { flexDirection: 'column' } }, children),
|
|
78
|
+
e__default.createElement(OperationOutcomeAlert, { issues: issues }),
|
|
79
|
+
e__default.createElement(Stack, { spacing: "xl" },
|
|
80
|
+
e__default.createElement(PasswordInput, { name: "password", type: "password", label: "Password", autoComplete: "off", required: true, error: getErrorsForInput(outcome, 'password') })),
|
|
81
|
+
e__default.createElement(Group, { position: "apart", mt: "xl", spacing: 0, noWrap: true },
|
|
82
|
+
onForgotPassword && (e__default.createElement(Anchor, { component: "button", type: "button", color: "dimmed", onClick: onForgotPassword, size: "xs" }, "Forgot password")),
|
|
83
|
+
e__default.createElement(Checkbox, { id: "remember", name: "remember", label: "Remember me", size: "xs", sx: { lineHeight: 1 } }),
|
|
84
|
+
e__default.createElement(Button, { type: "submit" }, "Sign in"))));
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
export { AuthenticationForm, EmailForm, PasswordForm };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthenticationForm.mjs","sources":["../../../src/auth/AuthenticationForm.tsx"],"sourcesContent":["import { Anchor, Button, Center, Checkbox, Divider, Group, PasswordInput, Stack, TextInput } from '@mantine/core';\nimport {\n BaseLoginRequest,\n GoogleCredentialResponse,\n GoogleLoginRequest,\n LoginAuthenticationResponse,\n} from '@medplum/core';\nimport { OperationOutcome } from '@medplum/fhirtypes';\nimport React, { useCallback, 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';\n\nexport interface AuthenticationFormProps extends BaseLoginRequest {\n readonly onForgotPassword?: () => void;\n readonly onRegister?: () => void;\n readonly handleAuthResponse: (response: LoginAuthenticationResponse) => void;\n readonly children?: React.ReactNode;\n}\n\nexport function AuthenticationForm(props: AuthenticationFormProps): JSX.Element {\n const [email, setEmail] = useState<string>();\n\n if (!email) {\n return <EmailForm setEmail={setEmail} {...props} />;\n } else {\n return <PasswordForm email={email} {...props} />;\n }\n}\n\nexport interface EmailFormProps extends BaseLoginRequest {\n readonly generatePkce?: boolean;\n readonly onRegister?: () => void;\n readonly handleAuthResponse: (response: LoginAuthenticationResponse) => void;\n readonly setEmail: (email: string) => void;\n readonly children?: React.ReactNode;\n}\n\nexport function EmailForm(props: EmailFormProps): JSX.Element {\n const { setEmail, onRegister, handleAuthResponse, children, ...baseLoginRequest } = props;\n const medplum = useMedplum();\n const googleClientId = getGoogleClientId(props.googleClientId);\n\n const isExternalAuth = useCallback(\n async (authMethod: any): Promise<boolean> => {\n if (!authMethod.authorizeUrl) {\n return false;\n }\n\n const state = JSON.stringify({\n ...(await medplum.ensureCodeChallenge(baseLoginRequest)),\n domain: authMethod.domain,\n });\n const url = new URL(authMethod.authorizeUrl);\n url.searchParams.set('state', state);\n window.location.assign(url.toString());\n return true;\n },\n [medplum, baseLoginRequest]\n );\n\n const handleSubmit = useCallback(\n async (formData: Record<string, string>) => {\n const authMethod = await medplum.post('auth/method', { email: formData.email });\n if (!(await isExternalAuth(authMethod))) {\n setEmail(formData.email);\n }\n },\n [medplum, isExternalAuth, setEmail]\n );\n\n const handleGoogleCredential = useCallback(\n async (response: GoogleCredentialResponse) => {\n const authResponse = await medplum.startGoogleLogin({\n ...baseLoginRequest,\n googleCredential: response.credential,\n } as GoogleLoginRequest);\n if (!(await isExternalAuth(authResponse))) {\n handleAuthResponse(authResponse);\n }\n },\n [medplum, baseLoginRequest, isExternalAuth, handleAuthResponse]\n );\n\n return (\n <Form style={{ maxWidth: 400 }} onSubmit={handleSubmit}>\n <Center sx={{ flexDirection: 'column' }}>{children}</Center>\n {googleClientId && (\n <>\n <Group position=\"center\" p=\"xl\" style={{ height: 70 }}>\n <GoogleButton googleClientId={googleClientId} handleGoogleCredential={handleGoogleCredential} />\n </Group>\n <Divider label=\"or\" labelPosition=\"center\" my=\"lg\" />\n </>\n )}\n <TextInput\n name=\"email\"\n type=\"email\"\n label=\"Email\"\n placeholder=\"name@domain.com\"\n required={true}\n autoFocus={true}\n />\n <Group position=\"apart\" mt=\"xl\" spacing={0} noWrap>\n {onRegister && (\n <Anchor component=\"button\" type=\"button\" color=\"dimmed\" onClick={onRegister} size=\"xs\">\n Register\n </Anchor>\n )}\n <Button type=\"submit\">Next</Button>\n </Group>\n </Form>\n );\n}\n\nexport interface PasswordFormProps extends BaseLoginRequest {\n readonly email: string;\n readonly onForgotPassword?: () => void;\n readonly handleAuthResponse: (response: LoginAuthenticationResponse) => void;\n readonly children?: React.ReactNode;\n}\n\nexport function PasswordForm(props: PasswordFormProps): JSX.Element {\n const { onForgotPassword, handleAuthResponse, children, ...baseLoginRequest } = props;\n const medplum = useMedplum();\n const [outcome, setOutcome] = useState<OperationOutcome>();\n const issues = getIssuesForExpression(outcome, undefined);\n\n const handleSubmit = useCallback(\n (formData: Record<string, string>) => {\n medplum\n .startLogin({\n ...baseLoginRequest,\n password: formData.password,\n remember: formData.remember === 'on',\n })\n .then(handleAuthResponse)\n .catch(setOutcome);\n },\n [medplum, baseLoginRequest, handleAuthResponse]\n );\n\n return (\n <Form style={{ maxWidth: 400 }} onSubmit={handleSubmit}>\n <Center sx={{ flexDirection: 'column' }}>{children}</Center>\n <OperationOutcomeAlert issues={issues} />\n <Stack spacing=\"xl\">\n <PasswordInput\n name=\"password\"\n type=\"password\"\n label=\"Password\"\n autoComplete=\"off\"\n required={true}\n error={getErrorsForInput(outcome, 'password')}\n />\n </Stack>\n <Group position=\"apart\" mt=\"xl\" spacing={0} noWrap>\n {onForgotPassword && (\n <Anchor component=\"button\" type=\"button\" color=\"dimmed\" onClick={onForgotPassword} size=\"xs\">\n Forgot password\n </Anchor>\n )}\n <Checkbox id=\"remember\" name=\"remember\" label=\"Remember me\"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CAAC,OAAO,EAAE,UAAU,CAAC,GAC7C,CACI;AACR,QAAA,KAAA,CAAA,aAAA,CAAC,KAAK,EAAA,EAAC,QAAQ,EAAC,OAAO,EAAC,EAAE,EAAC,IAAI,EAAC,OAAO,EAAE,CAAC,EAAE,MAAM,EAAA,IAAA,EAAA;YAC/C,gBAAgB,KACf,KAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EAAC,SAAS,EAAC,QAAQ,EAAC,IAAI,EAAC,QAAQ,EAAC,KAAK,EAAC,QAAQ,EAAC,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAC,IAAI,EAAA,EAAA,iBAAA,CAEnF,CACV;YACD,KAAC,CAAA,aAAA,CAAA,QAAQ,EAAC,EAAA,EAAE,EAAC,UAAU,EAAC,IAAI,EAAC,UAAU,EAAC,KAAK,EAAC,aAAa,EAAC,IAAI,EAAC,IAAI,EAAC,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,EAAI,CAAA;YAC/F,KAAC,CAAA,aAAA,CAAA,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAiB,EAAA,SAAA,CAAA,CAChC,CACH,EACP;AACJ;;;;"}
|
|
1
|
+
{"version":3,"file":"AuthenticationForm.mjs","sources":["../../../src/auth/AuthenticationForm.tsx"],"sourcesContent":["import { Anchor, Button, Center, Checkbox, Divider, Group, PasswordInput, Stack, TextInput } from '@mantine/core';\nimport {\n BaseLoginRequest,\n GoogleCredentialResponse,\n GoogleLoginRequest,\n LoginAuthenticationResponse,\n} from '@medplum/core';\nimport { OperationOutcome } from '@medplum/fhirtypes';\nimport React, { useCallback, 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';\n\nexport interface AuthenticationFormProps extends BaseLoginRequest {\n readonly onForgotPassword?: () => void;\n readonly onRegister?: () => void;\n readonly handleAuthResponse: (response: LoginAuthenticationResponse) => void;\n readonly children?: React.ReactNode;\n}\n\nexport function AuthenticationForm(props: AuthenticationFormProps): JSX.Element {\n const [email, setEmail] = useState<string>();\n\n if (!email) {\n return <EmailForm setEmail={setEmail} {...props} />;\n } else {\n return <PasswordForm email={email} {...props} />;\n }\n}\n\nexport interface EmailFormProps extends BaseLoginRequest {\n readonly generatePkce?: boolean;\n readonly onRegister?: () => void;\n readonly handleAuthResponse: (response: LoginAuthenticationResponse) => void;\n readonly setEmail: (email: string) => void;\n readonly children?: React.ReactNode;\n}\n\nexport function EmailForm(props: EmailFormProps): JSX.Element {\n const { setEmail, onRegister, handleAuthResponse, children, ...baseLoginRequest } = props;\n const medplum = useMedplum();\n const googleClientId = getGoogleClientId(props.googleClientId);\n\n const isExternalAuth = useCallback(\n async (authMethod: any): Promise<boolean> => {\n if (!authMethod.authorizeUrl) {\n return false;\n }\n\n const state = JSON.stringify({\n ...(await medplum.ensureCodeChallenge(baseLoginRequest)),\n domain: authMethod.domain,\n });\n const url = new URL(authMethod.authorizeUrl);\n url.searchParams.set('state', state);\n window.location.assign(url.toString());\n return true;\n },\n [medplum, baseLoginRequest]\n );\n\n const handleSubmit = useCallback(\n async (formData: Record<string, string>) => {\n const authMethod = await medplum.post('auth/method', { email: formData.email });\n if (!(await isExternalAuth(authMethod))) {\n setEmail(formData.email);\n }\n },\n [medplum, isExternalAuth, setEmail]\n );\n\n const handleGoogleCredential = useCallback(\n async (response: GoogleCredentialResponse) => {\n const authResponse = await medplum.startGoogleLogin({\n ...baseLoginRequest,\n googleCredential: response.credential,\n } as GoogleLoginRequest);\n if (!(await isExternalAuth(authResponse))) {\n handleAuthResponse(authResponse);\n }\n },\n [medplum, baseLoginRequest, isExternalAuth, handleAuthResponse]\n );\n\n return (\n <Form style={{ maxWidth: 400 }} onSubmit={handleSubmit}>\n <Center sx={{ flexDirection: 'column' }}>{children}</Center>\n {googleClientId && (\n <>\n <Group position=\"center\" p=\"xl\" style={{ height: 70 }}>\n <GoogleButton googleClientId={googleClientId} handleGoogleCredential={handleGoogleCredential} />\n </Group>\n <Divider label=\"or\" labelPosition=\"center\" my=\"lg\" />\n </>\n )}\n <TextInput\n name=\"email\"\n type=\"email\"\n label=\"Email\"\n placeholder=\"name@domain.com\"\n required={true}\n autoFocus={true}\n />\n <Group position=\"apart\" mt=\"xl\" spacing={0} noWrap>\n {onRegister && (\n <Anchor component=\"button\" type=\"button\" color=\"dimmed\" onClick={onRegister} size=\"xs\">\n Register\n </Anchor>\n )}\n <Button type=\"submit\">Next</Button>\n </Group>\n </Form>\n );\n}\n\nexport interface PasswordFormProps extends BaseLoginRequest {\n readonly email: string;\n readonly onForgotPassword?: () => void;\n readonly handleAuthResponse: (response: LoginAuthenticationResponse) => void;\n readonly children?: React.ReactNode;\n}\n\nexport function PasswordForm(props: PasswordFormProps): JSX.Element {\n const { onForgotPassword, handleAuthResponse, children, ...baseLoginRequest } = props;\n const medplum = useMedplum();\n const [outcome, setOutcome] = useState<OperationOutcome>();\n const issues = getIssuesForExpression(outcome, undefined);\n\n const handleSubmit = useCallback(\n (formData: Record<string, string>) => {\n medplum\n .startLogin({\n ...baseLoginRequest,\n password: formData.password,\n remember: formData.remember === 'on',\n })\n .then(handleAuthResponse)\n .catch(setOutcome);\n },\n [medplum, baseLoginRequest, handleAuthResponse]\n );\n\n return (\n <Form style={{ maxWidth: 400 }} onSubmit={handleSubmit}>\n <Center sx={{ flexDirection: 'column' }}>{children}</Center>\n <OperationOutcomeAlert issues={issues} />\n <Stack spacing=\"xl\">\n <PasswordInput\n name=\"password\"\n type=\"password\"\n label=\"Password\"\n autoComplete=\"off\"\n required={true}\n error={getErrorsForInput(outcome, 'password')}\n />\n </Stack>\n <Group position=\"apart\" mt=\"xl\" spacing={0} noWrap>\n {onForgotPassword && (\n <Anchor component=\"button\" type=\"button\" color=\"dimmed\" onClick={onForgotPassword} size=\"xs\">\n Forgot password\n </Anchor>\n )}\n <Checkbox id=\"remember\" name=\"remember\" label=\"Remember me\" size=\"xs\" sx={{ lineHeight: 1 }} />\n <Button type=\"submit\">Sign in</Button>\n </Group>\n </Form>\n );\n}\n"],"names":["React"],"mappings":";;;;;;;;AAsBM,SAAU,kBAAkB,CAAC,KAA8B,EAAA;IAC/D,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,EAAU,CAAC;IAE7C,IAAI,CAAC,KAAK,EAAE;QACV,OAAOA,UAAA,CAAA,aAAA,CAAC,SAAS,EAAC,EAAA,QAAQ,EAAE,QAAQ,EAAA,GAAM,KAAK,EAAA,CAAI,CAAC;AACrD,KAAA;AAAM,SAAA;QACL,OAAOA,UAAA,CAAA,aAAA,CAAC,YAAY,EAAC,EAAA,KAAK,EAAE,KAAK,EAAA,GAAM,KAAK,EAAA,CAAI,CAAC;AAClD,KAAA;AACH,CAAC;AAUK,SAAU,SAAS,CAAC,KAAqB,EAAA;AAC7C,IAAA,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,kBAAkB,EAAE,QAAQ,EAAE,GAAG,gBAAgB,EAAE,GAAG,KAAK,CAAC;AAC1F,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,cAAc,GAAG,iBAAiB,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IAE/D,MAAM,cAAc,GAAG,WAAW,CAChC,OAAO,UAAe,KAAsB;AAC1C,QAAA,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE;AAC5B,YAAA,OAAO,KAAK,CAAC;AACd,SAAA;AAED,QAAA,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC;YAC3B,IAAI,MAAM,OAAO,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;YACxD,MAAM,EAAE,UAAU,CAAC,MAAM;AAC1B,SAAA,CAAC,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,UAA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ACf,KAAK,EAAC,UAAU,EAChB,YAAY,EAAC,KAAK,EAClB,QAAQ,EAAE,IAAI,EACd,KAAK,EAAE,iBAAiB,CAAC,OAAO,EAAE,UAAU,CAAC,GAC7C,CACI;AACR,QAAAA,UAAA,CAAA,aAAA,CAAC,KAAK,EAAA,EAAC,QAAQ,EAAC,OAAO,EAAC,EAAE,EAAC,IAAI,EAAC,OAAO,EAAE,CAAC,EAAE,MAAM,EAAA,IAAA,EAAA;YAC/C,gBAAgB,KACfA,UAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EAAC,SAAS,EAAC,QAAQ,EAAC,IAAI,EAAC,QAAQ,EAAC,KAAK,EAAC,QAAQ,EAAC,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAC,IAAI,EAAA,EAAA,iBAAA,CAEnF,CACV;YACDA,UAAC,CAAA,aAAA,CAAA,QAAQ,EAAC,EAAA,EAAE,EAAC,UAAU,EAAC,IAAI,EAAC,UAAU,EAAC,KAAK,EAAC,aAAa,EAAC,IAAI,EAAC,IAAI,EAAC,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,EAAI,CAAA;YAC/FA,UAAC,CAAA,aAAA,CAAA,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAiB,EAAA,SAAA,CAAA,CAChC,CACH,EACP;AACJ;;;;"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { Stack, Center, Title, UnstyledButton, Group, Avatar, Text } from '@mantine/core';
|
|
2
|
-
import
|
|
2
|
+
import e__default from 'react';
|
|
3
3
|
import { Logo } from '../Logo/Logo.mjs';
|
|
4
4
|
import { useMedplum } from '../MedplumProvider/MedplumProvider.mjs';
|
|
5
5
|
|
|
6
6
|
function ChooseProfileForm(props) {
|
|
7
7
|
const medplum = useMedplum();
|
|
8
|
-
return (
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
props.memberships.map((membership) => (
|
|
8
|
+
return (e__default.createElement(Stack, null,
|
|
9
|
+
e__default.createElement(Center, { sx: { flexDirection: 'column' } },
|
|
10
|
+
e__default.createElement(Logo, { size: 32 }),
|
|
11
|
+
e__default.createElement(Title, null, "Choose profile")),
|
|
12
|
+
props.memberships.map((membership) => (e__default.createElement(UnstyledButton, { key: membership.id, onClick: () => {
|
|
13
13
|
medplum
|
|
14
14
|
.post('auth/profile', {
|
|
15
15
|
login: props.login,
|
|
@@ -18,11 +18,11 @@ function ChooseProfileForm(props) {
|
|
|
18
18
|
.then(props.handleAuthResponse)
|
|
19
19
|
.catch(console.log);
|
|
20
20
|
} },
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
e__default.createElement(Group, null,
|
|
22
|
+
e__default.createElement(Avatar, { radius: "xl" }),
|
|
23
|
+
e__default.createElement("div", { style: { flex: 1 } },
|
|
24
|
+
e__default.createElement(Text, { size: "sm", weight: 500 }, membership.profile?.display),
|
|
25
|
+
e__default.createElement(Text, { color: "dimmed", size: "xs" }, membership.project?.display))))))));
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export { ChooseProfileForm };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChooseProfileForm.mjs","sources":["../../../src/auth/ChooseProfileForm.tsx"],"sourcesContent":["import { Avatar, Center, Group, Stack, Text, Title, UnstyledButton } from '@mantine/core';\nimport { LoginAuthenticationResponse } from '@medplum/core';\nimport { ProjectMembership } from '@medplum/fhirtypes';\nimport React from 'react';\nimport { Logo } from '../Logo/Logo';\nimport { useMedplum } from '../MedplumProvider/MedplumProvider';\n\nexport interface ChooseProfileFormProps {\n login: string;\n memberships: ProjectMembership[];\n handleAuthResponse: (response: LoginAuthenticationResponse) => void;\n}\n\nexport function ChooseProfileForm(props: ChooseProfileFormProps): JSX.Element {\n const medplum = useMedplum();\n return (\n <Stack>\n <Center sx={{ flexDirection: 'column' }}>\n <Logo size={32} />\n <Title>Choose profile</Title>\n </Center>\n {props.memberships.map((membership: ProjectMembership) => (\n <UnstyledButton\n key={membership.id}\n onClick={() => {\n medplum\n .post('auth/profile', {\n login: props.login,\n profile: membership.id,\n })\n .then(props.handleAuthResponse)\n .catch(console.log);\n }}\n >\n <Group>\n <Avatar radius=\"xl\" />\n <div style={{ flex: 1 }}>\n <Text size=\"sm\" weight={500}>\n {membership.profile?.display}\n </Text>\n <Text color=\"dimmed\" size=\"xs\">\n {membership.project?.display}\n </Text>\n </div>\n </Group>\n </UnstyledButton>\n ))}\n </Stack>\n );\n}\n"],"names":[],"mappings":";;;;;AAaM,SAAU,iBAAiB,CAAC,KAA6B,EAAA;AAC7D,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,
|
|
1
|
+
{"version":3,"file":"ChooseProfileForm.mjs","sources":["../../../src/auth/ChooseProfileForm.tsx"],"sourcesContent":["import { Avatar, Center, Group, Stack, Text, Title, UnstyledButton } from '@mantine/core';\nimport { LoginAuthenticationResponse } from '@medplum/core';\nimport { ProjectMembership } from '@medplum/fhirtypes';\nimport React from 'react';\nimport { Logo } from '../Logo/Logo';\nimport { useMedplum } from '../MedplumProvider/MedplumProvider';\n\nexport interface ChooseProfileFormProps {\n login: string;\n memberships: ProjectMembership[];\n handleAuthResponse: (response: LoginAuthenticationResponse) => void;\n}\n\nexport function ChooseProfileForm(props: ChooseProfileFormProps): JSX.Element {\n const medplum = useMedplum();\n return (\n <Stack>\n <Center sx={{ flexDirection: 'column' }}>\n <Logo size={32} />\n <Title>Choose profile</Title>\n </Center>\n {props.memberships.map((membership: ProjectMembership) => (\n <UnstyledButton\n key={membership.id}\n onClick={() => {\n medplum\n .post('auth/profile', {\n login: props.login,\n profile: membership.id,\n })\n .then(props.handleAuthResponse)\n .catch(console.log);\n }}\n >\n <Group>\n <Avatar radius=\"xl\" />\n <div style={{ flex: 1 }}>\n <Text size=\"sm\" weight={500}>\n {membership.profile?.display}\n </Text>\n <Text color=\"dimmed\" size=\"xs\">\n {membership.project?.display}\n </Text>\n </div>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IAAI,IAAC,KAAK,EAAC,QAAQ,EAAC,IAAI,EAAC,IAAI,EAC3B,EAAA,UAAU,CAAC,OAAO,EAAE,OAAO,CACvB,CACH,CACA,CACO,CAClB,CAAC,CACI,EACR;AACJ;;;;"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Stack, Center, Title, Checkbox, Group, Button } from '@mantine/core';
|
|
2
|
-
import
|
|
2
|
+
import e__default from 'react';
|
|
3
3
|
import { Form } from '../Form/Form.mjs';
|
|
4
4
|
import { Logo } from '../Logo/Logo.mjs';
|
|
5
5
|
import { useMedplum } from '../MedplumProvider/MedplumProvider.mjs';
|
|
6
6
|
|
|
7
7
|
function ChooseScopeForm(props) {
|
|
8
8
|
const medplum = useMedplum();
|
|
9
|
-
return (
|
|
9
|
+
return (e__default.createElement(Form, { style: { maxWidth: 400 }, onSubmit: (formData) => {
|
|
10
10
|
medplum
|
|
11
11
|
.post('auth/scope', {
|
|
12
12
|
login: props.login,
|
|
@@ -15,13 +15,13 @@ function ChooseScopeForm(props) {
|
|
|
15
15
|
.then(props.handleAuthResponse)
|
|
16
16
|
.catch(console.log);
|
|
17
17
|
} },
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
e__default.createElement(Stack, null,
|
|
19
|
+
e__default.createElement(Center, { sx: { flexDirection: 'column' } },
|
|
20
|
+
e__default.createElement(Logo, { size: 32 }),
|
|
21
|
+
e__default.createElement(Title, null, "Choose scope")),
|
|
22
|
+
e__default.createElement(Stack, null, (props.scope || 'openid').split(' ').map((scopeName) => (e__default.createElement(Checkbox, { key: scopeName, id: scopeName, name: scopeName, label: scopeName, defaultChecked: true })))),
|
|
23
|
+
e__default.createElement(Group, { position: "right", mt: "xl" },
|
|
24
|
+
e__default.createElement(Button, { type: "submit" }, "Set scope")))));
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export { ChooseScopeForm };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChooseScopeForm.mjs","sources":["../../../src/auth/ChooseScopeForm.tsx"],"sourcesContent":["import { Button, Center, Checkbox, Group, Stack, Title } from '@mantine/core';\nimport { LoginAuthenticationResponse } from '@medplum/core';\nimport React from 'react';\nimport { Form } from '../Form/Form';\nimport { Logo } from '../Logo/Logo';\nimport { useMedplum } from '../MedplumProvider/MedplumProvider';\n\nexport interface ChooseScopeFormProps {\n login: string;\n scope: string | undefined;\n handleAuthResponse: (response: LoginAuthenticationResponse) => void;\n}\n\nexport function ChooseScopeForm(props: ChooseScopeFormProps): JSX.Element {\n const medplum = useMedplum();\n return (\n <Form\n style={{ maxWidth: 400 }}\n onSubmit={(formData: Record<string, string>) => {\n medplum\n .post('auth/scope', {\n login: props.login,\n scope: Object.keys(formData).join(' '),\n })\n .then(props.handleAuthResponse)\n .catch(console.log);\n }}\n >\n <Stack>\n <Center sx={{ flexDirection: 'column' }}>\n <Logo size={32} />\n <Title>Choose scope</Title>\n </Center>\n <Stack>\n {(props.scope || 'openid').split(' ').map((scopeName: string) => (\n <Checkbox key={scopeName} id={scopeName} name={scopeName} label={scopeName} defaultChecked />\n ))}\n </Stack>\n <Group position=\"right\" mt=\"xl\">\n <Button type=\"submit\">Set scope</Button>\n </Group>\n </Stack>\n </Form>\n );\n}\n"],"names":[],"mappings":";;;;;;AAaM,SAAU,eAAe,CAAC,KAA2B,EAAA;AACzD,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;AAC7B,IAAA,
|
|
1
|
+
{"version":3,"file":"ChooseScopeForm.mjs","sources":["../../../src/auth/ChooseScopeForm.tsx"],"sourcesContent":["import { Button, Center, Checkbox, Group, Stack, Title } from '@mantine/core';\nimport { LoginAuthenticationResponse } from '@medplum/core';\nimport React from 'react';\nimport { Form } from '../Form/Form';\nimport { Logo } from '../Logo/Logo';\nimport { useMedplum } from '../MedplumProvider/MedplumProvider';\n\nexport interface ChooseScopeFormProps {\n login: string;\n scope: string | undefined;\n handleAuthResponse: (response: LoginAuthenticationResponse) => void;\n}\n\nexport function ChooseScopeForm(props: ChooseScopeFormProps): JSX.Element {\n const medplum = useMedplum();\n return (\n <Form\n style={{ maxWidth: 400 }}\n onSubmit={(formData: Record<string, string>) => {\n medplum\n .post('auth/scope', {\n login: props.login,\n scope: Object.keys(formData).join(' '),\n })\n .then(props.handleAuthResponse)\n .catch(console.log);\n }}\n >\n <Stack>\n <Center sx={{ flexDirection: 'column' }}>\n <Logo size={32} />\n <Title>Choose scope</Title>\n </Center>\n <Stack>\n {(props.scope || 'openid').split(' ').map((scopeName: string) => (\n <Checkbox key={scopeName} id={scopeName} name={scopeName} label={scopeName} defaultChecked />\n ))}\n </Stack>\n <Group position=\"right\" mt=\"xl\">\n <Button type=\"submit\">Set scope</Button>\n </Group>\n </Stack>\n </Form>\n );\n}\n"],"names":["React"],"mappings":";;;;;;AAaM,SAAU,eAAe,CAAC,KAA2B,EAAA;AACzD,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;AAC7B,IAAA,QACEA,UAAC,CAAA,aAAA,CAAA,IAAI,EACH,EAAA,KAAK,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,EACxB,QAAQ,EAAE,CAAC,QAAgC,KAAI;YAC7C,OAAO;iBACJ,IAAI,CAAC,YAAY,EAAE;gBAClB,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;aACvC,CAAC;AACD,iBAAA,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC;AAC9B,iBAAA,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;SACvB,EAAA;AAED,QAAAA,UAAA,CAAA,aAAA,CAAC,KAAK,EAAA,IAAA;YACJA,UAAC,CAAA,aAAA,CAAA,MAAM,IAAC,EAAE,EAAE,EAAE,aAAa,EAAE,QAAQ,EAAE,EAAA;AACrC,gBAAAA,UAAA,CAAA,aAAA,CAAC,IAAI,EAAA,EAAC,IAAI,EAAE,EAAE,EAAI,CAAA;gBAClBA,UAAC,CAAA,aAAA,CAAA,KAAK,uBAAqB,CACpB;YACTA,UAAC,CAAA,aAAA,CAAA,KAAK,QACH,CAAC,KAAK,CAAC,KAAK,IAAI,QAAQ,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,SAAiB,MAC1DA,yBAAC,QAAQ,EAAA,EAAC,GAAG,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,cAAc,EAAA,IAAA,EAAA,CAAG,CAC9F,CAAC,CACI;YACRA,UAAC,CAAA,aAAA,CAAA,KAAK,IAAC,QAAQ,EAAC,OAAO,EAAC,EAAE,EAAC,IAAI,EAAA;gBAC7BA,UAAC,CAAA,aAAA,CAAA,MAAM,EAAC,EAAA,IAAI,EAAC,QAAQ,gBAAmB,CAClC,CACF,CACH,EACP;AACJ;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Stack, Center, Title, Alert, TextInput, Group, Button } from '@mantine/core';
|
|
2
2
|
import { normalizeErrorString } from '@medplum/core';
|
|
3
|
-
import { IconAlertCircle } from '
|
|
4
|
-
import
|
|
3
|
+
import { IconAlertCircle as We } from '../node_modules/@tabler/icons/icons-react/dist/index.esm.mjs';
|
|
4
|
+
import e__default, { useState } from 'react';
|
|
5
5
|
import { Form } from '../Form/Form.mjs';
|
|
6
6
|
import { Logo } from '../Logo/Logo.mjs';
|
|
7
7
|
import { useMedplum } from '../MedplumProvider/MedplumProvider.mjs';
|
|
@@ -9,7 +9,7 @@ import { useMedplum } from '../MedplumProvider/MedplumProvider.mjs';
|
|
|
9
9
|
function MfaForm(props) {
|
|
10
10
|
const medplum = useMedplum();
|
|
11
11
|
const [errorMessage, setErrorMessage] = useState(undefined);
|
|
12
|
-
return (
|
|
12
|
+
return (e__default.createElement(Form, { style: { maxWidth: 400 }, onSubmit: (formData) => {
|
|
13
13
|
setErrorMessage(undefined);
|
|
14
14
|
medplum
|
|
15
15
|
.post('auth/mfa/verify', {
|
|
@@ -19,15 +19,15 @@ function MfaForm(props) {
|
|
|
19
19
|
.then(props.handleAuthResponse)
|
|
20
20
|
.catch((err) => setErrorMessage(normalizeErrorString(err)));
|
|
21
21
|
} },
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
errorMessage && (
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
22
|
+
e__default.createElement(Stack, null,
|
|
23
|
+
e__default.createElement(Center, { sx: { flexDirection: 'column' } },
|
|
24
|
+
e__default.createElement(Logo, { size: 32 }),
|
|
25
|
+
e__default.createElement(Title, null, "Enter MFA code")),
|
|
26
|
+
errorMessage && (e__default.createElement(Alert, { icon: e__default.createElement(We, { size: 16 }), title: "Error", color: "red" }, errorMessage)),
|
|
27
|
+
e__default.createElement(Stack, null,
|
|
28
|
+
e__default.createElement(TextInput, { name: "token", label: "MFA code", required: true })),
|
|
29
|
+
e__default.createElement(Group, { position: "right", mt: "xl" },
|
|
30
|
+
e__default.createElement(Button, { type: "submit" }, "Submit code")))));
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
export { MfaForm };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MfaForm.mjs","sources":["../../../src/auth/MfaForm.tsx"],"sourcesContent":["import { Alert, Button, Center, Group, Stack, TextInput, Title } from '@mantine/core';\nimport { LoginAuthenticationResponse, normalizeErrorString } from '@medplum/core';\nimport { IconAlertCircle } from '@tabler/icons';\nimport React, { useState } from 'react';\nimport { Form } from '../Form/Form';\nimport { Logo } from '../Logo/Logo';\nimport { useMedplum } from '../MedplumProvider/MedplumProvider';\n\nexport interface MfaFormProps {\n login: string;\n handleAuthResponse: (response: LoginAuthenticationResponse) => void;\n}\n\nexport function MfaForm(props: MfaFormProps): JSX.Element {\n const medplum = useMedplum();\n const [errorMessage, setErrorMessage] = useState<string | undefined>(undefined);\n return (\n <Form\n style={{ maxWidth: 400 }}\n onSubmit={(formData: Record<string, string>) => {\n setErrorMessage(undefined);\n medplum\n .post('auth/mfa/verify', {\n login: props.login,\n token: formData.token,\n })\n .then(props.handleAuthResponse)\n .catch((err) => setErrorMessage(normalizeErrorString(err)));\n }}\n >\n <Stack>\n <Center sx={{ flexDirection: 'column' }}>\n <Logo size={32} />\n <Title>Enter MFA code</Title>\n </Center>\n {errorMessage && (\n <Alert icon={<IconAlertCircle size={16} />} title=\"Error\" color=\"red\">\n {errorMessage}\n </Alert>\n )}\n <Stack>\n <TextInput name=\"token\" label=\"MFA code\" required />\n </Stack>\n <Group position=\"right\" mt=\"xl\">\n <Button type=\"submit\">Submit code</Button>\n </Group>\n </Stack>\n </Form>\n );\n}\n"],"names":[],"mappings":";;;;;;;;AAaM,SAAU,OAAO,CAAC,KAAmB,EAAA;AACzC,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAqB,SAAS,CAAC,CAAC;AAChF,IAAA,
|
|
1
|
+
{"version":3,"file":"MfaForm.mjs","sources":["../../../src/auth/MfaForm.tsx"],"sourcesContent":["import { Alert, Button, Center, Group, Stack, TextInput, Title } from '@mantine/core';\nimport { LoginAuthenticationResponse, normalizeErrorString } from '@medplum/core';\nimport { IconAlertCircle } from '@tabler/icons';\nimport React, { useState } from 'react';\nimport { Form } from '../Form/Form';\nimport { Logo } from '../Logo/Logo';\nimport { useMedplum } from '../MedplumProvider/MedplumProvider';\n\nexport interface MfaFormProps {\n login: string;\n handleAuthResponse: (response: LoginAuthenticationResponse) => void;\n}\n\nexport function MfaForm(props: MfaFormProps): JSX.Element {\n const medplum = useMedplum();\n const [errorMessage, setErrorMessage] = useState<string | undefined>(undefined);\n return (\n <Form\n style={{ maxWidth: 400 }}\n onSubmit={(formData: Record<string, string>) => {\n setErrorMessage(undefined);\n medplum\n .post('auth/mfa/verify', {\n login: props.login,\n token: formData.token,\n })\n .then(props.handleAuthResponse)\n .catch((err) => setErrorMessage(normalizeErrorString(err)));\n }}\n >\n <Stack>\n <Center sx={{ flexDirection: 'column' }}>\n <Logo size={32} />\n <Title>Enter MFA code</Title>\n </Center>\n {errorMessage && (\n <Alert icon={<IconAlertCircle size={16} />} title=\"Error\" color=\"red\">\n {errorMessage}\n </Alert>\n )}\n <Stack>\n <TextInput name=\"token\" label=\"MFA code\" required />\n </Stack>\n <Group position=\"right\" mt=\"xl\">\n <Button type=\"submit\">Submit code</Button>\n </Group>\n </Stack>\n </Form>\n );\n}\n"],"names":["React","IconAlertCircle"],"mappings":";;;;;;;;AAaM,SAAU,OAAO,CAAC,KAAmB,EAAA;AACzC,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAqB,SAAS,CAAC,CAAC;AAChF,IAAA,QACEA,UAAC,CAAA,aAAA,CAAA,IAAI,EACH,EAAA,KAAK,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,EACxB,QAAQ,EAAE,CAAC,QAAgC,KAAI;YAC7C,eAAe,CAAC,SAAS,CAAC,CAAC;YAC3B,OAAO;iBACJ,IAAI,CAAC,iBAAiB,EAAE;gBACvB,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,KAAK,EAAE,QAAQ,CAAC,KAAK;aACtB,CAAC;AACD,iBAAA,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC;AAC9B,iBAAA,KAAK,CAAC,CAAC,GAAG,KAAK,eAAe,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SAC/D,EAAA;AAED,QAAAA,UAAA,CAAA,aAAA,CAAC,KAAK,EAAA,IAAA;YACJA,UAAC,CAAA,aAAA,CAAA,MAAM,IAAC,EAAE,EAAE,EAAE,aAAa,EAAE,QAAQ,EAAE,EAAA;AACrC,gBAAAA,UAAA,CAAA,aAAA,CAAC,IAAI,EAAA,EAAC,IAAI,EAAE,EAAE,EAAI,CAAA;gBAClBA,UAAC,CAAA,aAAA,CAAA,KAAK,yBAAuB,CACtB;YACR,YAAY,KACXA,UAAA,CAAA,aAAA,CAAC,KAAK,EAAA,EAAC,IAAI,EAAEA,UAAA,CAAA,aAAA,CAACC,EAAe,EAAA,EAAC,IAAI,EAAE,EAAE,EAAI,CAAA,EAAE,KAAK,EAAC,OAAO,EAAC,KAAK,EAAC,KAAK,EAAA,EAClE,YAAY,CACP,CACT;AACD,YAAAD,UAAA,CAAA,aAAA,CAAC,KAAK,EAAA,IAAA;AACJ,gBAAAA,UAAA,CAAA,aAAA,CAAC,SAAS,EAAA,EAAC,IAAI,EAAC,OAAO,EAAC,KAAK,EAAC,UAAU,EAAC,QAAQ,EAAA,IAAA,EAAA,CAAG,CAC9C;YACRA,UAAC,CAAA,aAAA,CAAA,KAAK,IAAC,QAAQ,EAAC,OAAO,EAAC,EAAE,EAAC,IAAI,EAAA;gBAC7BA,UAAC,CAAA,aAAA,CAAA,MAAM,EAAC,EAAA,IAAI,EAAC,QAAQ,kBAAqB,CACpC,CACF,CACH,EACP;AACJ;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Center, Title, Stack, TextInput, Text, Anchor, Group, Button } from '@mantine/core';
|
|
2
|
-
import
|
|
2
|
+
import e__default, { useState } from 'react';
|
|
3
3
|
import { Form } from '../Form/Form.mjs';
|
|
4
4
|
import { Logo } from '../Logo/Logo.mjs';
|
|
5
5
|
import { useMedplum } from '../MedplumProvider/MedplumProvider.mjs';
|
|
@@ -8,7 +8,7 @@ import { getErrorsForInput } from '../utils/outcomes.mjs';
|
|
|
8
8
|
function NewProjectForm(props) {
|
|
9
9
|
const medplum = useMedplum();
|
|
10
10
|
const [outcome, setOutcome] = useState();
|
|
11
|
-
return (
|
|
11
|
+
return (e__default.createElement(Form, { style: { maxWidth: 400 }, onSubmit: async (formData) => {
|
|
12
12
|
try {
|
|
13
13
|
props.handleAuthResponse(await medplum.startNewProject({
|
|
14
14
|
login: props.login,
|
|
@@ -19,20 +19,20 @@ function NewProjectForm(props) {
|
|
|
19
19
|
setOutcome(err);
|
|
20
20
|
}
|
|
21
21
|
} },
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
e__default.createElement(Center, { sx: { flexDirection: 'column' } },
|
|
23
|
+
e__default.createElement(Logo, { size: 32 }),
|
|
24
|
+
e__default.createElement(Title, null, "Create project")),
|
|
25
|
+
e__default.createElement(Stack, { spacing: "xl" },
|
|
26
|
+
e__default.createElement(TextInput, { name: "projectName", label: "Project Name", placeholder: "My Project", required: true, autoFocus: true, error: getErrorsForInput(outcome, 'firstName') }),
|
|
27
|
+
e__default.createElement(Text, { color: "dimmed", size: "xs" },
|
|
28
28
|
"By clicking submit you agree to the Medplum",
|
|
29
29
|
' ',
|
|
30
|
-
|
|
30
|
+
e__default.createElement(Anchor, { href: "https://www.medplum.com/privacy" }, "Privacy\u00A0Policy"),
|
|
31
31
|
' and ',
|
|
32
|
-
|
|
32
|
+
e__default.createElement(Anchor, { href: "https://www.medplum.com/terms" }, "Terms\u00A0of\u00A0Service"),
|
|
33
33
|
".")),
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
e__default.createElement(Group, { position: "right", mt: "xl", noWrap: true },
|
|
35
|
+
e__default.createElement(Button, { type: "submit" }, "Create project"))));
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export { NewProjectForm };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NewProjectForm.mjs","sources":["../../../src/auth/NewProjectForm.tsx"],"sourcesContent":["import { Anchor, Button, Center, Group, Stack, Text, TextInput, Title } from '@mantine/core';\nimport { LoginAuthenticationResponse } from '@medplum/core';\nimport { OperationOutcome } from '@medplum/fhirtypes';\nimport React, { useState } from 'react';\nimport { Form } from '../Form/Form';\nimport { Logo } from '../Logo/Logo';\nimport { useMedplum } from '../MedplumProvider/MedplumProvider';\nimport { getErrorsForInput } from '../utils/outcomes';\n\nexport interface NewProjectFormProps {\n login: string;\n handleAuthResponse: (response: LoginAuthenticationResponse) => void;\n}\n\nexport function NewProjectForm(props: NewProjectFormProps): JSX.Element {\n const medplum = useMedplum();\n const [outcome, setOutcome] = useState<OperationOutcome | undefined>();\n return (\n <Form\n style={{ maxWidth: 400 }}\n onSubmit={async (formData: Record<string, string>) => {\n try {\n props.handleAuthResponse(\n await medplum.startNewProject({\n login: props.login,\n projectName: formData.projectName,\n })\n );\n } catch (err) {\n setOutcome(err as OperationOutcome);\n }\n }}\n >\n <Center sx={{ flexDirection: 'column' }}>\n <Logo size={32} />\n <Title>Create project</Title>\n </Center>\n <Stack spacing=\"xl\">\n <TextInput\n name=\"projectName\"\n label=\"Project Name\"\n placeholder=\"My Project\"\n required={true}\n autoFocus={true}\n error={getErrorsForInput(outcome, 'firstName')}\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 </Stack>\n <Group position=\"right\" mt=\"xl\" noWrap>\n <Button type=\"submit\">Create project</Button>\n </Group>\n </Form>\n );\n}\n"],"names":[],"mappings":";;;;;;;AAcM,SAAU,cAAc,CAAC,KAA0B,EAAA;AACvD,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,EAAgC,CAAC;AACvE,IAAA,
|
|
1
|
+
{"version":3,"file":"NewProjectForm.mjs","sources":["../../../src/auth/NewProjectForm.tsx"],"sourcesContent":["import { Anchor, Button, Center, Group, Stack, Text, TextInput, Title } from '@mantine/core';\nimport { LoginAuthenticationResponse } from '@medplum/core';\nimport { OperationOutcome } from '@medplum/fhirtypes';\nimport React, { useState } from 'react';\nimport { Form } from '../Form/Form';\nimport { Logo } from '../Logo/Logo';\nimport { useMedplum } from '../MedplumProvider/MedplumProvider';\nimport { getErrorsForInput } from '../utils/outcomes';\n\nexport interface NewProjectFormProps {\n login: string;\n handleAuthResponse: (response: LoginAuthenticationResponse) => void;\n}\n\nexport function NewProjectForm(props: NewProjectFormProps): JSX.Element {\n const medplum = useMedplum();\n const [outcome, setOutcome] = useState<OperationOutcome | undefined>();\n return (\n <Form\n style={{ maxWidth: 400 }}\n onSubmit={async (formData: Record<string, string>) => {\n try {\n props.handleAuthResponse(\n await medplum.startNewProject({\n login: props.login,\n projectName: formData.projectName,\n })\n );\n } catch (err) {\n setOutcome(err as OperationOutcome);\n }\n }}\n >\n <Center sx={{ flexDirection: 'column' }}>\n <Logo size={32} />\n <Title>Create project</Title>\n </Center>\n <Stack spacing=\"xl\">\n <TextInput\n name=\"projectName\"\n label=\"Project Name\"\n placeholder=\"My Project\"\n required={true}\n autoFocus={true}\n error={getErrorsForInput(outcome, 'firstName')}\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 </Stack>\n <Group position=\"right\" mt=\"xl\" noWrap>\n <Button type=\"submit\">Create project</Button>\n </Group>\n </Form>\n );\n}\n"],"names":["React"],"mappings":";;;;;;;AAcM,SAAU,cAAc,CAAC,KAA0B,EAAA;AACvD,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,EAAgC,CAAC;AACvE,IAAA,QACEA,UAAC,CAAA,aAAA,CAAA,IAAI,IACH,KAAK,EAAE,EAAE,QAAQ,EAAE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,UAAC,CAAA,aAAA,CAAA,KAAK,EAAC,EAAA,QAAQ,EAAC,OAAO,EAAC,EAAE,EAAC,IAAI,EAAC,MAAM,EAAA,IAAA,EAAA;YACpCA,UAAC,CAAA,aAAA,CAAA,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAwB,EAAA,gBAAA,CAAA,CACvC,CACH,EACP;AACJ;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Center, Group, Divider, Stack, TextInput, PasswordInput, Text, Anchor, Checkbox, Button } from '@mantine/core';
|
|
2
|
-
import
|
|
2
|
+
import e__default, { useState, useEffect } from 'react';
|
|
3
3
|
import { Form } from '../Form/Form.mjs';
|
|
4
4
|
import { getGoogleClientId, GoogleButton } from '../GoogleButton/GoogleButton.mjs';
|
|
5
5
|
import { useMedplum } from '../MedplumProvider/MedplumProvider.mjs';
|
|
@@ -14,7 +14,7 @@ function NewUserForm(props) {
|
|
|
14
14
|
const [outcome, setOutcome] = useState();
|
|
15
15
|
const issues = getIssuesForExpression(outcome, undefined);
|
|
16
16
|
useEffect(() => initRecaptcha(recaptchaSiteKey), [recaptchaSiteKey]);
|
|
17
|
-
return (
|
|
17
|
+
return (e__default.createElement(Form, { style: { maxWidth: 400 }, onSubmit: async (formData) => {
|
|
18
18
|
try {
|
|
19
19
|
const recaptchaToken = await getRecaptcha(recaptchaSiteKey);
|
|
20
20
|
props.handleAuthResponse(await medplum.startNewUser({
|
|
@@ -32,11 +32,11 @@ function NewUserForm(props) {
|
|
|
32
32
|
setOutcome(err);
|
|
33
33
|
}
|
|
34
34
|
} },
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
googleClientId && (
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
e__default.createElement(Center, { sx: { flexDirection: 'column' } }, props.children),
|
|
36
|
+
e__default.createElement(OperationOutcomeAlert, { issues: issues }),
|
|
37
|
+
googleClientId && (e__default.createElement(e__default.Fragment, null,
|
|
38
|
+
e__default.createElement(Group, { position: "center", p: "xl", style: { height: 70 } },
|
|
39
|
+
e__default.createElement(GoogleButton, { googleClientId: googleClientId, handleGoogleCredential: async (response) => {
|
|
40
40
|
try {
|
|
41
41
|
props.handleAuthResponse(await medplum.startGoogleLogin({
|
|
42
42
|
googleClientId: response.clientId,
|
|
@@ -48,29 +48,29 @@ function NewUserForm(props) {
|
|
|
48
48
|
setOutcome(err);
|
|
49
49
|
}
|
|
50
50
|
} })),
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
e__default.createElement(Divider, { label: "or", labelPosition: "center", my: "lg" }))),
|
|
52
|
+
e__default.createElement(Stack, { spacing: "xl" },
|
|
53
|
+
e__default.createElement(TextInput, { name: "firstName", type: "text", label: "First name", placeholder: "First name", required: true, autoFocus: true, error: getErrorsForInput(outcome, 'firstName') }),
|
|
54
|
+
e__default.createElement(TextInput, { name: "lastName", type: "text", label: "Last name", placeholder: "Last name", required: true, error: getErrorsForInput(outcome, 'lastName') }),
|
|
55
|
+
e__default.createElement(TextInput, { name: "email", type: "email", label: "Email", placeholder: "name@domain.com", required: true, error: getErrorsForInput(outcome, 'email') }),
|
|
56
|
+
e__default.createElement(PasswordInput, { name: "password", label: "Password", autoComplete: "off", required: true, error: getErrorsForInput(outcome, 'password') }),
|
|
57
|
+
e__default.createElement(Text, { color: "dimmed", size: "xs" },
|
|
58
58
|
"By clicking submit you agree to the Medplum",
|
|
59
59
|
' ',
|
|
60
|
-
|
|
60
|
+
e__default.createElement(Anchor, { href: "https://www.medplum.com/privacy" }, "Privacy\u00A0Policy"),
|
|
61
61
|
' and ',
|
|
62
|
-
|
|
62
|
+
e__default.createElement(Anchor, { href: "https://www.medplum.com/terms" }, "Terms\u00A0of\u00A0Service"),
|
|
63
63
|
"."),
|
|
64
|
-
|
|
64
|
+
e__default.createElement(Text, { color: "dimmed", size: "xs" },
|
|
65
65
|
"This site is protected by reCAPTCHA and the Google",
|
|
66
66
|
' ',
|
|
67
|
-
|
|
67
|
+
e__default.createElement(Anchor, { href: "https://policies.google.com/privacy" }, "Privacy\u00A0Policy"),
|
|
68
68
|
' and ',
|
|
69
|
-
|
|
69
|
+
e__default.createElement(Anchor, { href: "https://policies.google.com/terms" }, "Terms\u00A0of\u00A0Service"),
|
|
70
70
|
" apply.")),
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
e__default.createElement(Group, { position: "apart", mt: "xl", noWrap: true },
|
|
72
|
+
e__default.createElement(Checkbox, { name: "remember", label: "Remember me", size: "xs" }),
|
|
73
|
+
e__default.createElement(Button, { type: "submit" }, "Create account"))));
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
export { NewUserForm };
|
|
@@ -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,IAA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,UAAA,CAAA,aAAA,CAAC,QAAQ,EAAA,EAAC,IAAI,EAAC,UAAU,EAAC,KAAK,EAAC,aAAa,EAAC,IAAI,EAAC,IAAI,EAAG,CAAA;YAC1DA,UAAC,CAAA,aAAA,CAAA,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAwB,EAAA,gBAAA,CAAA,CACvC,CACH,EACP;AACJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e__default, { useState, useEffect } from 'react';
|
|
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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