@medplum/react 0.9.30 → 0.9.31

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.
Files changed (48) hide show
  1. package/dist/cjs/auth/AuthenticationForm.d.ts +14 -0
  2. package/dist/cjs/auth/ChooseProfileForm.d.ts +8 -0
  3. package/dist/cjs/auth/NewProjectForm.d.ts +7 -0
  4. package/dist/cjs/auth/NewUserForm.d.ts +10 -0
  5. package/dist/cjs/auth/RegisterForm.d.ts +12 -0
  6. package/dist/cjs/{SignInForm.d.ts → auth/SignInForm.d.ts} +1 -1
  7. package/dist/cjs/index.d.ts +2 -2
  8. package/dist/cjs/index.js +671 -648
  9. package/dist/cjs/index.js.map +1 -1
  10. package/dist/cjs/index.min.js +1 -1
  11. package/dist/cjs/index.min.js.map +1 -1
  12. package/dist/cjs/styles.css +197 -197
  13. package/dist/esm/MedplumLink.js +29 -14
  14. package/dist/esm/MedplumLink.js.map +1 -1
  15. package/dist/esm/ResourceHistoryTable.js +15 -11
  16. package/dist/esm/ResourceHistoryTable.js.map +1 -1
  17. package/dist/esm/ResourceTimeline.js +3 -1
  18. package/dist/esm/ResourceTimeline.js.map +1 -1
  19. package/dist/esm/auth/AuthenticationForm.d.ts +14 -0
  20. package/dist/esm/auth/AuthenticationForm.js +67 -0
  21. package/dist/esm/auth/AuthenticationForm.js.map +1 -0
  22. package/dist/esm/auth/ChooseProfileForm.d.ts +8 -0
  23. package/dist/esm/auth/ChooseProfileForm.js +32 -0
  24. package/dist/esm/auth/ChooseProfileForm.js.map +1 -0
  25. package/dist/esm/auth/NewProjectForm.d.ts +7 -0
  26. package/dist/esm/auth/NewProjectForm.js +42 -0
  27. package/dist/esm/auth/NewProjectForm.js.map +1 -0
  28. package/dist/esm/auth/NewUserForm.d.ts +10 -0
  29. package/dist/esm/auth/NewUserForm.js +87 -0
  30. package/dist/esm/auth/NewUserForm.js.map +1 -0
  31. package/dist/esm/auth/RegisterForm.d.ts +12 -0
  32. package/dist/esm/auth/RegisterForm.js +39 -0
  33. package/dist/esm/auth/RegisterForm.js.map +1 -0
  34. package/dist/esm/{SignInForm.d.ts → auth/SignInForm.d.ts} +1 -1
  35. package/dist/esm/auth/SignInForm.js +52 -0
  36. package/dist/esm/auth/SignInForm.js.map +1 -0
  37. package/dist/esm/index.d.ts +2 -2
  38. package/dist/esm/index.js +2 -2
  39. package/dist/esm/index.min.js +1 -1
  40. package/dist/esm/index.min.js.map +1 -1
  41. package/dist/esm/styles.css +197 -197
  42. package/package.json +16 -18
  43. package/dist/cjs/RegisterForm.d.ts +0 -18
  44. package/dist/esm/RegisterForm.d.ts +0 -18
  45. package/dist/esm/RegisterForm.js +0 -121
  46. package/dist/esm/RegisterForm.js.map +0 -1
  47. package/dist/esm/SignInForm.js +0 -167
  48. package/dist/esm/SignInForm.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ResourceTimeline.js","sources":["../../src/ResourceTimeline.tsx"],"sourcesContent":["import { getReferenceString, ProfileResource } from '@medplum/core';\nimport {\n Attachment,\n AuditEvent,\n Bundle,\n BundleEntry,\n Communication,\n DiagnosticReport,\n Media,\n Reference,\n Resource,\n} from '@medplum/fhirtypes';\nimport React, { useCallback, useEffect, useRef, useState } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { AttachmentDisplay } from './AttachmentDisplay';\nimport { Button } from './Button';\nimport { DiagnosticReportDisplay } from './DiagnosticReportDisplay';\nimport { Form } from './Form';\nimport { Input } from './Input';\nimport { Loading } from './Loading';\nimport { useMedplum } from './MedplumProvider';\nimport { MenuItem } from './MenuItem';\nimport { ResourceDiffTable } from './ResourceDiffTable';\nimport { ResourceTable } from './ResourceTable';\nimport { Scrollable } from './Scrollable';\nimport { Timeline, TimelineItem } from './Timeline';\nimport { UploadButton } from './UploadButton';\nimport { useResource } from './useResource';\nimport { sortByDateAndPriority } from './utils/date';\nimport './ResourceTimeline.css';\n\nexport interface ResourceTimelineProps<T extends Resource> {\n value: T | Reference<T>;\n buildSearchRequests: (resource: T) => Bundle;\n createCommunication?: (resource: T, sender: ProfileResource, text: string) => Communication;\n createMedia?: (resource: T, operator: ProfileResource, attachment: Attachment) => Media;\n}\n\nexport function ResourceTimeline<T extends Resource>(props: ResourceTimelineProps<T>): JSX.Element {\n const navigate = useNavigate();\n const medplum = useMedplum();\n const sender = medplum.getProfile() as ProfileResource;\n const inputRef = useRef<HTMLInputElement>(null);\n const resource = useResource(props.value);\n const [history, setHistory] = useState<Bundle>();\n const [items, setItems] = useState<Resource[]>([]);\n const buildSearchRequests = props.buildSearchRequests;\n\n const itemsRef = useRef<Resource[]>(items);\n itemsRef.current = items;\n\n const loadTimeline = useCallback(() => {\n if (!resource) {\n setItems([]);\n setHistory({} as Bundle);\n return;\n }\n medplum.executeBatch(buildSearchRequests(resource)).then(handleBatchResponse).catch(console.log);\n }, [medplum, resource, buildSearchRequests]);\n\n useEffect(() => {\n loadTimeline();\n }, [loadTimeline]);\n\n /**\n * Handles a batch request response.\n * @param batchResponse The batch response.\n */\n function handleBatchResponse(batchResponse: Bundle): void {\n const newItems = [];\n\n if (batchResponse.entry) {\n for (const batchEntry of batchResponse.entry) {\n const bundle = batchEntry.resource as Bundle;\n if (!bundle) {\n // User may not have access to all resource types\n continue;\n }\n\n if (bundle.type === 'history') {\n setHistory(bundle);\n }\n\n if (bundle.entry) {\n for (const entry of bundle.entry) {\n newItems.push(entry.resource as Resource);\n }\n }\n }\n\n sortByDateAndPriority(newItems);\n newItems.reverse();\n }\n\n setItems(newItems);\n }\n\n /**\n * Adds an array of resources to the timeline.\n * @param resources Array of resources.\n */\n function addResources(resources: Resource[]): void {\n const newItems = [...itemsRef.current, ...resources];\n sortByDateAndPriority(newItems);\n newItems.reverse();\n setItems(newItems);\n }\n\n /**\n * Adds a Communication resource to the timeline.\n * @param contentString The comment content.\n */\n function createComment(contentString: string): void {\n if (!resource || !props.createCommunication) {\n // Encounter not loaded yet\n return;\n }\n medplum\n .createResource(props.createCommunication(resource, sender, contentString))\n .then((result) => {\n addResources([result]);\n })\n .catch(console.log);\n }\n\n /**\n * Adds a Media resource to the timeline.\n * @param attachment The media attachment.\n */\n function createMedia(attachment: Attachment): void {\n if (!resource || !props.createMedia) {\n // Encounter not loaded yet\n return;\n }\n medplum\n .createResource(props.createMedia(resource, sender, attachment))\n .then((result) => {\n addResources([result]);\n })\n .catch(console.log);\n }\n\n function setPriority(communication: Communication, priority: string): Promise<Communication> {\n return medplum.updateResource({ ...communication, priority });\n }\n\n function onPin(communication: Communication): void {\n setPriority(communication, 'stat').then(loadTimeline).catch(console.log);\n }\n\n function onUnpin(communication: Communication): void {\n setPriority(communication, 'routine').then(loadTimeline).catch(console.log);\n }\n\n function onDetails(timelineItem: Resource): void {\n navigate(`/${timelineItem.resourceType}/${timelineItem.id}`);\n }\n\n function onEdit(timelineItem: Resource): void {\n navigate(`/${timelineItem.resourceType}/${timelineItem.id}/edit`);\n }\n\n function onDelete(timelineItem: Resource): void {\n navigate(`/${timelineItem.resourceType}/${timelineItem.id}/delete`);\n }\n\n function onVersionDetails(version: Resource): void {\n navigate(`/${version.resourceType}/${version.id}/_history/${version.meta?.versionId}`);\n }\n\n if (!resource || !history) {\n return <Loading />;\n }\n\n return (\n <Timeline>\n {props.createCommunication && (\n <article className=\"medplum-timeline-item\">\n <div className=\"medplum-timeline-item-header\">\n <Form\n testid=\"timeline-form\"\n onSubmit={(formData: Record<string, string>) => {\n createComment(formData.text);\n\n const input = inputRef.current;\n if (input) {\n input.value = '';\n input.focus();\n }\n }}\n >\n <Input name=\"text\" testid=\"timeline-input\" inputRef={inputRef} />\n <Button type=\"submit\">Comment</Button>\n <UploadButton onUpload={createMedia} />\n </Form>\n </div>\n </article>\n )}\n {items.map((item) => {\n if (item.resourceType === resource.resourceType && item.id === resource.id) {\n return (\n <HistoryTimelineItem\n key={item.meta?.versionId}\n history={history}\n resource={item}\n onDetails={onVersionDetails}\n />\n );\n }\n const key = `${item.resourceType}/${item.id}`;\n switch (item.resourceType) {\n case 'AuditEvent':\n return <AuditEventTimelineItem key={key} resource={item} onDetails={onDetails} />;\n case 'Communication':\n return (\n <CommunicationTimelineItem\n key={key}\n resource={item}\n onPin={item.priority !== 'stat' ? onPin : undefined}\n onUnpin={item.priority === 'stat' ? onUnpin : undefined}\n onDetails={onDetails}\n onEdit={onEdit}\n onDelete={onDelete}\n />\n );\n case 'DiagnosticReport':\n return (\n <DiagnosticReportTimelineItem\n key={key}\n resource={item}\n onDetails={onDetails}\n onEdit={onEdit}\n onDelete={onDelete}\n />\n );\n case 'Media':\n return (\n <MediaTimelineItem key={key} resource={item} onDetails={onDetails} onEdit={onEdit} onDelete={onDelete} />\n );\n default:\n return (\n <TimelineItem key={key} resource={item} padding={true}>\n <ResourceTable value={item} ignoreMissingValues={true} />\n </TimelineItem>\n );\n }\n })}\n </Timeline>\n );\n}\n\ninterface BaseTimelineItemProps<T extends Resource> {\n resource: T;\n onPin?: (resource: T) => void;\n onUnpin?: (resource: T) => void;\n onDetails?: (resource: T) => void;\n onEdit?: (resource: T) => void;\n onDelete?: (resource: T) => void;\n}\n\nfunction TimelineItemPopupMenu<T extends Resource>(props: BaseTimelineItemProps<T>): JSX.Element {\n return (\n <>\n {props.onPin && (\n <MenuItem\n onClick={() => (props.onPin as (resource: T) => void)(props.resource)}\n label={`Pin ${getReferenceString(props.resource)}`}\n >\n Pin\n </MenuItem>\n )}\n {props.onUnpin && (\n <MenuItem\n onClick={() => (props.onUnpin as (resource: T) => void)(props.resource)}\n label={`Unpin ${getReferenceString(props.resource)}`}\n >\n Unpin\n </MenuItem>\n )}\n {props.onDetails && (\n <MenuItem\n onClick={() => (props.onDetails as (resource: T) => void)(props.resource)}\n label={`Details ${getReferenceString(props.resource)}`}\n >\n Details\n </MenuItem>\n )}\n {props.onEdit && (\n <MenuItem\n onClick={() => (props.onEdit as (resource: T) => void)(props.resource)}\n label={`Edit ${getReferenceString(props.resource)}`}\n >\n Edit\n </MenuItem>\n )}\n {props.onDelete && (\n <MenuItem\n onClick={() => (props.onDelete as (resource: T) => void)(props.resource)}\n label={`Delete ${getReferenceString(props.resource)}`}\n >\n Delete\n </MenuItem>\n )}\n </>\n );\n}\n\ninterface HistoryTimelineItemProps extends BaseTimelineItemProps<Resource> {\n history: Bundle;\n}\n\nfunction HistoryTimelineItem(props: HistoryTimelineItemProps): JSX.Element {\n const previous = getPrevious(props.history, props.resource);\n if (previous) {\n return (\n <TimelineItem resource={props.resource} padding={true} popupMenuItems={<TimelineItemPopupMenu {...props} />}>\n <ResourceDiffTable original={previous} revised={props.resource} />\n </TimelineItem>\n );\n } else {\n return (\n <TimelineItem resource={props.resource} padding={true} popupMenuItems={<TimelineItemPopupMenu {...props} />}>\n <h3>Created</h3>\n <ResourceTable value={props.resource} ignoreMissingValues={true} />\n </TimelineItem>\n );\n }\n}\n\nfunction getPrevious(history: Bundle, version: Resource): Resource | undefined {\n const entries = history.entry as BundleEntry[];\n const index = entries.findIndex((entry) => entry.resource?.meta?.versionId === version.meta?.versionId);\n if (index >= entries.length - 1) {\n return undefined;\n }\n return entries[index + 1].resource;\n}\n\nfunction CommunicationTimelineItem(props: BaseTimelineItemProps<Communication>): JSX.Element {\n const routine = !props.resource.priority || props.resource.priority === 'routine';\n const className = routine ? 'medplum-timeline-item' : 'medplum-timeline-item medplum-timeline-item-pinned';\n return (\n <TimelineItem\n resource={props.resource}\n profile={props.resource.sender}\n padding={true}\n className={className}\n popupMenuItems={<TimelineItemPopupMenu {...props} />}\n >\n <p>{props.resource.payload?.[0]?.contentString}</p>\n </TimelineItem>\n );\n}\n\nfunction MediaTimelineItem(props: BaseTimelineItemProps<Media>): JSX.Element {\n const contentType = props.resource.content?.contentType;\n const padding =\n contentType &&\n !contentType.startsWith('image/') &&\n !contentType.startsWith('video/') &&\n contentType !== 'application/pdf';\n return (\n <TimelineItem resource={props.resource} padding={!!padding} popupMenuItems={<TimelineItemPopupMenu {...props} />}>\n <AttachmentDisplay value={props.resource.content} />\n </TimelineItem>\n );\n}\n\nfunction AuditEventTimelineItem(props: BaseTimelineItemProps<AuditEvent>): JSX.Element {\n return (\n <TimelineItem resource={props.resource} padding={true} popupMenuItems={<TimelineItemPopupMenu {...props} />}>\n <Scrollable>\n <pre>{props.resource.outcomeDesc}</pre>\n </Scrollable>\n </TimelineItem>\n );\n}\n\nfunction DiagnosticReportTimelineItem(props: BaseTimelineItemProps<DiagnosticReport>): JSX.Element {\n return (\n <TimelineItem resource={props.resource} padding={true} popupMenuItems={<TimelineItemPopupMenu {...props} />}>\n <DiagnosticReportDisplay value={props.resource} />\n </TimelineItem>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAsCM,SAAU,gBAAgB,CAAqB,KAA+B,EAAA;AAClF,IAAA,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;AAC/B,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;AAC7B,IAAA,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,EAAqB,CAAC;AACvD,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAmB,IAAI,CAAC,CAAC;IAChD,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC1C,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,EAAU,CAAC;IACjD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAa,EAAE,CAAC,CAAC;AACnD,IAAA,MAAM,mBAAmB,GAAG,KAAK,CAAC,mBAAmB,CAAC;AAEtD,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAa,KAAK,CAAC,CAAC;AAC3C,IAAA,QAAQ,CAAC,OAAO,GAAG,KAAK,CAAC;AAEzB,IAAA,MAAM,YAAY,GAAG,WAAW,CAAC,MAAK;QACpC,IAAI,CAAC,QAAQ,EAAE;YACb,QAAQ,CAAC,EAAE,CAAC,CAAC;YACb,UAAU,CAAC,EAAY,CAAC,CAAC;YACzB,OAAO;AACR,SAA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AAA,CAAA,EAAA,EAAK,KAAK,CAAI,CAAA,EAAA;AACzG,QAAA,KAAA,CAAA,aAAA,CAAC,UAAU,EAAA,IAAA;YACT,KAAM,CAAA,aAAA,CAAA,KAAA,EAAA,IAAA,EAAA,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAO,CAC5B,CACA,EACf;AACJ,CAAC;AAED,SAAS,4BAA4B,CAAC,KAA8C,EAAA;IAClF,QACE,oBAAC,YAAY,EAAA,EAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,oBAAC,qBAAqB,EAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAK,KAAK,CAAI,CAAA,EAAA;QACzG,KAAC,CAAA,aAAA,CAAA,uBAAuB,EAAC,EAAA,KAAK,EAAE,KAAK,CAAC,QAAQ,EAAA,CAAI,CACrC,EACf;AACJ;;;;"}
1
+ {"version":3,"file":"ResourceTimeline.js","sources":["../../src/ResourceTimeline.tsx"],"sourcesContent":["import { getReferenceString, ProfileResource } from '@medplum/core';\nimport {\n Attachment,\n AuditEvent,\n Bundle,\n BundleEntry,\n Communication,\n DiagnosticReport,\n Media,\n Reference,\n Resource,\n} from '@medplum/fhirtypes';\nimport React, { useCallback, useEffect, useRef, useState } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { AttachmentDisplay } from './AttachmentDisplay';\nimport { Button } from './Button';\nimport { DiagnosticReportDisplay } from './DiagnosticReportDisplay';\nimport { Form } from './Form';\nimport { Input } from './Input';\nimport { Loading } from './Loading';\nimport { useMedplum } from './MedplumProvider';\nimport { MenuItem } from './MenuItem';\nimport { ResourceDiffTable } from './ResourceDiffTable';\nimport { ResourceTable } from './ResourceTable';\nimport { Scrollable } from './Scrollable';\nimport { Timeline, TimelineItem } from './Timeline';\nimport { UploadButton } from './UploadButton';\nimport { useResource } from './useResource';\nimport { sortByDateAndPriority } from './utils/date';\nimport './ResourceTimeline.css';\n\nexport interface ResourceTimelineProps<T extends Resource> {\n value: T | Reference<T>;\n buildSearchRequests: (resource: T) => Bundle;\n createCommunication?: (resource: T, sender: ProfileResource, text: string) => Communication;\n createMedia?: (resource: T, operator: ProfileResource, attachment: Attachment) => Media;\n}\n\nexport function ResourceTimeline<T extends Resource>(props: ResourceTimelineProps<T>): JSX.Element {\n const navigate = useNavigate();\n const medplum = useMedplum();\n const sender = medplum.getProfile() as ProfileResource;\n const inputRef = useRef<HTMLInputElement>(null);\n const resource = useResource(props.value);\n const [history, setHistory] = useState<Bundle>();\n const [items, setItems] = useState<Resource[]>([]);\n const buildSearchRequests = props.buildSearchRequests;\n\n const itemsRef = useRef<Resource[]>(items);\n itemsRef.current = items;\n\n const loadTimeline = useCallback(() => {\n if (!resource) {\n setItems([]);\n setHistory({} as Bundle);\n return;\n }\n medplum.executeBatch(buildSearchRequests(resource)).then(handleBatchResponse).catch(console.log);\n }, [medplum, resource, buildSearchRequests]);\n\n useEffect(() => {\n loadTimeline();\n }, [loadTimeline]);\n\n /**\n * Handles a batch request response.\n * @param batchResponse The batch response.\n */\n function handleBatchResponse(batchResponse: Bundle): void {\n const newItems = [];\n\n if (batchResponse.entry) {\n for (const batchEntry of batchResponse.entry) {\n const bundle = batchEntry.resource as Bundle;\n if (!bundle) {\n // User may not have access to all resource types\n continue;\n }\n\n if (bundle.type === 'history') {\n setHistory(bundle);\n }\n\n if (bundle.entry) {\n for (const entry of bundle.entry) {\n if (entry.resource) {\n newItems.push(entry.resource);\n }\n }\n }\n }\n\n sortByDateAndPriority(newItems);\n newItems.reverse();\n }\n\n setItems(newItems);\n }\n\n /**\n * Adds an array of resources to the timeline.\n * @param resources Array of resources.\n */\n function addResources(resources: Resource[]): void {\n const newItems = [...itemsRef.current, ...resources];\n sortByDateAndPriority(newItems);\n newItems.reverse();\n setItems(newItems);\n }\n\n /**\n * Adds a Communication resource to the timeline.\n * @param contentString The comment content.\n */\n function createComment(contentString: string): void {\n if (!resource || !props.createCommunication) {\n // Encounter not loaded yet\n return;\n }\n medplum\n .createResource(props.createCommunication(resource, sender, contentString))\n .then((result) => {\n addResources([result]);\n })\n .catch(console.log);\n }\n\n /**\n * Adds a Media resource to the timeline.\n * @param attachment The media attachment.\n */\n function createMedia(attachment: Attachment): void {\n if (!resource || !props.createMedia) {\n // Encounter not loaded yet\n return;\n }\n medplum\n .createResource(props.createMedia(resource, sender, attachment))\n .then((result) => {\n addResources([result]);\n })\n .catch(console.log);\n }\n\n function setPriority(communication: Communication, priority: string): Promise<Communication> {\n return medplum.updateResource({ ...communication, priority });\n }\n\n function onPin(communication: Communication): void {\n setPriority(communication, 'stat').then(loadTimeline).catch(console.log);\n }\n\n function onUnpin(communication: Communication): void {\n setPriority(communication, 'routine').then(loadTimeline).catch(console.log);\n }\n\n function onDetails(timelineItem: Resource): void {\n navigate(`/${timelineItem.resourceType}/${timelineItem.id}`);\n }\n\n function onEdit(timelineItem: Resource): void {\n navigate(`/${timelineItem.resourceType}/${timelineItem.id}/edit`);\n }\n\n function onDelete(timelineItem: Resource): void {\n navigate(`/${timelineItem.resourceType}/${timelineItem.id}/delete`);\n }\n\n function onVersionDetails(version: Resource): void {\n navigate(`/${version.resourceType}/${version.id}/_history/${version.meta?.versionId}`);\n }\n\n if (!resource || !history) {\n return <Loading />;\n }\n\n return (\n <Timeline>\n {props.createCommunication && (\n <article className=\"medplum-timeline-item\">\n <div className=\"medplum-timeline-item-header\">\n <Form\n testid=\"timeline-form\"\n onSubmit={(formData: Record<string, string>) => {\n createComment(formData.text);\n\n const input = inputRef.current;\n if (input) {\n input.value = '';\n input.focus();\n }\n }}\n >\n <Input name=\"text\" testid=\"timeline-input\" inputRef={inputRef} />\n <Button type=\"submit\">Comment</Button>\n <UploadButton onUpload={createMedia} />\n </Form>\n </div>\n </article>\n )}\n {items.map((item) => {\n if (item.resourceType === resource.resourceType && item.id === resource.id) {\n return (\n <HistoryTimelineItem\n key={item.meta?.versionId}\n history={history}\n resource={item}\n onDetails={onVersionDetails}\n />\n );\n }\n const key = `${item.resourceType}/${item.id}`;\n switch (item.resourceType) {\n case 'AuditEvent':\n return <AuditEventTimelineItem key={key} resource={item} onDetails={onDetails} />;\n case 'Communication':\n return (\n <CommunicationTimelineItem\n key={key}\n resource={item}\n onPin={item.priority !== 'stat' ? onPin : undefined}\n onUnpin={item.priority === 'stat' ? onUnpin : undefined}\n onDetails={onDetails}\n onEdit={onEdit}\n onDelete={onDelete}\n />\n );\n case 'DiagnosticReport':\n return (\n <DiagnosticReportTimelineItem\n key={key}\n resource={item}\n onDetails={onDetails}\n onEdit={onEdit}\n onDelete={onDelete}\n />\n );\n case 'Media':\n return (\n <MediaTimelineItem key={key} resource={item} onDetails={onDetails} onEdit={onEdit} onDelete={onDelete} />\n );\n default:\n return (\n <TimelineItem key={key} resource={item} padding={true}>\n <ResourceTable value={item} ignoreMissingValues={true} />\n </TimelineItem>\n );\n }\n })}\n </Timeline>\n );\n}\n\ninterface BaseTimelineItemProps<T extends Resource> {\n resource: T;\n onPin?: (resource: T) => void;\n onUnpin?: (resource: T) => void;\n onDetails?: (resource: T) => void;\n onEdit?: (resource: T) => void;\n onDelete?: (resource: T) => void;\n}\n\nfunction TimelineItemPopupMenu<T extends Resource>(props: BaseTimelineItemProps<T>): JSX.Element {\n return (\n <>\n {props.onPin && (\n <MenuItem\n onClick={() => (props.onPin as (resource: T) => void)(props.resource)}\n label={`Pin ${getReferenceString(props.resource)}`}\n >\n Pin\n </MenuItem>\n )}\n {props.onUnpin && (\n <MenuItem\n onClick={() => (props.onUnpin as (resource: T) => void)(props.resource)}\n label={`Unpin ${getReferenceString(props.resource)}`}\n >\n Unpin\n </MenuItem>\n )}\n {props.onDetails && (\n <MenuItem\n onClick={() => (props.onDetails as (resource: T) => void)(props.resource)}\n label={`Details ${getReferenceString(props.resource)}`}\n >\n Details\n </MenuItem>\n )}\n {props.onEdit && (\n <MenuItem\n onClick={() => (props.onEdit as (resource: T) => void)(props.resource)}\n label={`Edit ${getReferenceString(props.resource)}`}\n >\n Edit\n </MenuItem>\n )}\n {props.onDelete && (\n <MenuItem\n onClick={() => (props.onDelete as (resource: T) => void)(props.resource)}\n label={`Delete ${getReferenceString(props.resource)}`}\n >\n Delete\n </MenuItem>\n )}\n </>\n );\n}\n\ninterface HistoryTimelineItemProps extends BaseTimelineItemProps<Resource> {\n history: Bundle;\n}\n\nfunction HistoryTimelineItem(props: HistoryTimelineItemProps): JSX.Element {\n const previous = getPrevious(props.history, props.resource);\n if (previous) {\n return (\n <TimelineItem resource={props.resource} padding={true} popupMenuItems={<TimelineItemPopupMenu {...props} />}>\n <ResourceDiffTable original={previous} revised={props.resource} />\n </TimelineItem>\n );\n } else {\n return (\n <TimelineItem resource={props.resource} padding={true} popupMenuItems={<TimelineItemPopupMenu {...props} />}>\n <h3>Created</h3>\n <ResourceTable value={props.resource} ignoreMissingValues={true} />\n </TimelineItem>\n );\n }\n}\n\nfunction getPrevious(history: Bundle, version: Resource): Resource | undefined {\n const entries = history.entry as BundleEntry[];\n const index = entries.findIndex((entry) => entry.resource?.meta?.versionId === version.meta?.versionId);\n if (index >= entries.length - 1) {\n return undefined;\n }\n return entries[index + 1].resource;\n}\n\nfunction CommunicationTimelineItem(props: BaseTimelineItemProps<Communication>): JSX.Element {\n const routine = !props.resource.priority || props.resource.priority === 'routine';\n const className = routine ? 'medplum-timeline-item' : 'medplum-timeline-item medplum-timeline-item-pinned';\n return (\n <TimelineItem\n resource={props.resource}\n profile={props.resource.sender}\n padding={true}\n className={className}\n popupMenuItems={<TimelineItemPopupMenu {...props} />}\n >\n <p>{props.resource.payload?.[0]?.contentString}</p>\n </TimelineItem>\n );\n}\n\nfunction MediaTimelineItem(props: BaseTimelineItemProps<Media>): JSX.Element {\n const contentType = props.resource.content?.contentType;\n const padding =\n contentType &&\n !contentType.startsWith('image/') &&\n !contentType.startsWith('video/') &&\n contentType !== 'application/pdf';\n return (\n <TimelineItem resource={props.resource} padding={!!padding} popupMenuItems={<TimelineItemPopupMenu {...props} />}>\n <AttachmentDisplay value={props.resource.content} />\n </TimelineItem>\n );\n}\n\nfunction AuditEventTimelineItem(props: BaseTimelineItemProps<AuditEvent>): JSX.Element {\n return (\n <TimelineItem resource={props.resource} padding={true} popupMenuItems={<TimelineItemPopupMenu {...props} />}>\n <Scrollable>\n <pre>{props.resource.outcomeDesc}</pre>\n </Scrollable>\n </TimelineItem>\n );\n}\n\nfunction DiagnosticReportTimelineItem(props: BaseTimelineItemProps<DiagnosticReport>): JSX.Element {\n return (\n <TimelineItem resource={props.resource} padding={true} popupMenuItems={<TimelineItemPopupMenu {...props} />}>\n <DiagnosticReportDisplay value={props.resource} />\n </TimelineItem>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAsCM,SAAU,gBAAgB,CAAqB,KAA+B,EAAA;AAClF,IAAA,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;AAC/B,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;AAC7B,IAAA,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,EAAqB,CAAC;AACvD,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAmB,IAAI,CAAC,CAAC;IAChD,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC1C,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,EAAU,CAAC;IACjD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAa,EAAE,CAAC,CAAC;AACnD,IAAA,MAAM,mBAAmB,GAAG,KAAK,CAAC,mBAAmB,CAAC;AAEtD,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAa,KAAK,CAAC,CAAC;AAC3C,IAAA,QAAQ,CAAC,OAAO,GAAG,KAAK,CAAC;AAEzB,IAAA,MAAM,YAAY,GAAG,WAAW,CAAC,MAAK;QACpC,IAAI,CAAC,QAAQ,EAAE;YACb,QAAQ,CAAC,EAAE,CAAC,CAAC;YACb,UAAU,CAA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,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,oBAAC,qBAAqB,EAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAK,KAAK,CAAI,CAAA,EAAA;AACzG,QAAA,KAAA,CAAA,aAAA,CAAC,UAAU,EAAA,IAAA;YACT,KAAM,CAAA,aAAA,CAAA,KAAA,EAAA,IAAA,EAAA,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAO,CAC5B,CACA,EACf;AACJ,CAAC;AAED,SAAS,4BAA4B,CAAC,KAA8C,EAAA;IAClF,QACE,oBAAC,YAAY,EAAA,EAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,oBAAC,qBAAqB,EAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAK,KAAK,CAAI,CAAA,EAAA;QACzG,KAAC,CAAA,aAAA,CAAA,uBAAuB,EAAC,EAAA,KAAK,EAAE,KAAK,CAAC,QAAQ,EAAA,CAAI,CACrC,EACf;AACJ;;;;"}
@@ -0,0 +1,14 @@
1
+ import { LoginAuthenticationResponse } from '@medplum/core';
2
+ import React from 'react';
3
+ export interface AuthenticationFormProps {
4
+ readonly projectId?: string;
5
+ readonly clientId?: string;
6
+ readonly scope?: string;
7
+ readonly nonce?: string;
8
+ readonly googleClientId?: string;
9
+ readonly onForgotPassword?: () => void;
10
+ readonly onRegister?: () => void;
11
+ readonly handleAuthResponse: (response: LoginAuthenticationResponse) => void;
12
+ readonly children?: React.ReactNode;
13
+ }
14
+ export declare function AuthenticationForm(props: AuthenticationFormProps): JSX.Element;
@@ -0,0 +1,67 @@
1
+ import React, { useState } from 'react';
2
+ import { Button } from '../Button.js';
3
+ import { Form } from '../Form.js';
4
+ import { FormSection } from '../FormSection.js';
5
+ import { getGoogleClientId, GoogleButton } from '../GoogleButton.js';
6
+ import { Input } from '../Input.js';
7
+ import { MedplumLink } from '../MedplumLink.js';
8
+ import { useMedplum } from '../MedplumProvider.js';
9
+ import { getIssuesForExpression } from '../utils/outcomes.js';
10
+
11
+ function AuthenticationForm(props) {
12
+ const medplum = useMedplum();
13
+ const googleClientId = getGoogleClientId(props.googleClientId);
14
+ const [outcome, setOutcome] = useState();
15
+ const issues = getIssuesForExpression(outcome, undefined);
16
+ return (React.createElement(Form, { style: { maxWidth: 400 }, onSubmit: (formData) => {
17
+ medplum
18
+ .startLogin({
19
+ projectId: props.projectId,
20
+ clientId: props.clientId,
21
+ scope: props.scope,
22
+ nonce: props.nonce,
23
+ email: formData.email,
24
+ password: formData.password,
25
+ remember: formData.remember === 'true',
26
+ })
27
+ .then(props.handleAuthResponse)
28
+ .catch(setOutcome);
29
+ } },
30
+ React.createElement("div", { className: "medplum-center" }, props.children),
31
+ issues && (React.createElement("div", { className: "medplum-input-error" }, issues.map((issue) => {
32
+ var _a, _b;
33
+ return (React.createElement("div", { "data-testid": "text-field-error", key: (_a = issue.details) === null || _a === void 0 ? void 0 : _a.text }, (_b = issue.details) === null || _b === void 0 ? void 0 : _b.text));
34
+ }))),
35
+ googleClientId && (React.createElement(React.Fragment, null,
36
+ React.createElement("div", { className: "medplum-signin-google-container" },
37
+ React.createElement(GoogleButton, { googleClientId: googleClientId, handleGoogleCredential: (response) => {
38
+ medplum
39
+ .startGoogleLogin({
40
+ projectId: props.projectId,
41
+ clientId: props.clientId,
42
+ scope: props.scope,
43
+ nonce: props.nonce,
44
+ googleClientId: response.clientId,
45
+ googleCredential: response.credential,
46
+ })
47
+ .then(props.handleAuthResponse)
48
+ .catch(setOutcome);
49
+ } })),
50
+ React.createElement("div", { className: "medplum-signin-separator" }, "or"))),
51
+ React.createElement(FormSection, { title: "Email", htmlFor: "email", outcome: outcome },
52
+ React.createElement(Input, { name: "email", type: "email", testid: "email", required: true, autoFocus: true, outcome: outcome })),
53
+ React.createElement(FormSection, { title: "Password", htmlFor: "password", outcome: outcome },
54
+ React.createElement(Input, { name: "password", type: "password", testid: "password", autoComplete: "off", required: true, outcome: outcome })),
55
+ React.createElement("div", { className: "medplum-signin-buttons" },
56
+ (props.onForgotPassword || props.onRegister) && (React.createElement("div", null,
57
+ props.onForgotPassword && (React.createElement(MedplumLink, { testid: "forgotpassword", onClick: props.onForgotPassword }, "Forgot password")),
58
+ props.onRegister && (React.createElement(MedplumLink, { testid: "register", onClick: props.onRegister }, "Register")))),
59
+ React.createElement("div", null,
60
+ React.createElement("input", { type: "checkbox", id: "remember", name: "remember", value: "true" }),
61
+ React.createElement("label", { htmlFor: "remember" }, "Remember me")),
62
+ React.createElement("div", null,
63
+ React.createElement(Button, { type: "submit", testid: "submit" }, "Sign in")))));
64
+ }
65
+
66
+ export { AuthenticationForm };
67
+ //# sourceMappingURL=AuthenticationForm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthenticationForm.js","sources":["../../../src/auth/AuthenticationForm.tsx"],"sourcesContent":["import { GoogleCredentialResponse, LoginAuthenticationResponse } from '@medplum/core';\nimport { OperationOutcome } from '@medplum/fhirtypes';\nimport React, { useState } from 'react';\nimport { Button } from '../Button';\nimport { Form } from '../Form';\nimport { FormSection } from '../FormSection';\nimport { getGoogleClientId, GoogleButton } from '../GoogleButton';\nimport { Input } from '../Input';\nimport { MedplumLink } from '../MedplumLink';\nimport { useMedplum } from '../MedplumProvider';\nimport { getIssuesForExpression } from '../utils/outcomes';\n\nexport interface AuthenticationFormProps {\n readonly projectId?: string;\n readonly clientId?: string;\n readonly scope?: string;\n readonly nonce?: string;\n readonly googleClientId?: string;\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 medplum = useMedplum();\n const googleClientId = getGoogleClientId(props.googleClientId);\n const [outcome, setOutcome] = useState<OperationOutcome>();\n const issues = getIssuesForExpression(outcome, undefined);\n\n return (\n <Form\n style={{ maxWidth: 400 }}\n onSubmit={(formData: Record<string, string>) => {\n medplum\n .startLogin({\n projectId: props.projectId,\n clientId: props.clientId,\n scope: props.scope,\n nonce: props.nonce,\n email: formData.email,\n password: formData.password,\n remember: formData.remember === 'true',\n })\n .then(props.handleAuthResponse)\n .catch(setOutcome);\n }}\n >\n <div className=\"medplum-center\">{props.children}</div>\n {issues && (\n <div className=\"medplum-input-error\">\n {issues.map((issue) => (\n <div data-testid=\"text-field-error\" key={issue.details?.text}>\n {issue.details?.text}\n </div>\n ))}\n </div>\n )}\n {googleClientId && (\n <>\n <div className=\"medplum-signin-google-container\">\n <GoogleButton\n googleClientId={googleClientId}\n handleGoogleCredential={(response: GoogleCredentialResponse) => {\n medplum\n .startGoogleLogin({\n projectId: props.projectId,\n clientId: props.clientId,\n scope: props.scope,\n nonce: props.nonce,\n googleClientId: response.clientId,\n googleCredential: response.credential,\n })\n .then(props.handleAuthResponse)\n .catch(setOutcome);\n }}\n />\n </div>\n <div className=\"medplum-signin-separator\">or</div>\n </>\n )}\n <FormSection title=\"Email\" htmlFor=\"email\" outcome={outcome}>\n <Input name=\"email\" type=\"email\" testid=\"email\" required={true} autoFocus={true} outcome={outcome} />\n </FormSection>\n <FormSection title=\"Password\" htmlFor=\"password\" outcome={outcome}>\n <Input name=\"password\" type=\"password\" testid=\"password\" autoComplete=\"off\" required={true} outcome={outcome} />\n </FormSection>\n <div className=\"medplum-signin-buttons\">\n {(props.onForgotPassword || props.onRegister) && (\n <div>\n {props.onForgotPassword && (\n <MedplumLink testid=\"forgotpassword\" onClick={props.onForgotPassword}>\n Forgot password\n </MedplumLink>\n )}\n {props.onRegister && (\n <MedplumLink testid=\"register\" onClick={props.onRegister}>\n Register\n </MedplumLink>\n )}\n </div>\n )}\n <div>\n <input type=\"checkbox\" id=\"remember\" name=\"remember\" value=\"true\" />\n <label htmlFor=\"remember\">Remember me</label>\n </div>\n <div>\n <Button type=\"submit\" testid=\"submit\">\n Sign in\n </Button>\n </div>\n </div>\n </Form>\n );\n}\n"],"names":[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;AACE,gBAAA,KAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EAAC,IAAI,EAAC,QAAQ,EAAC,MAAM,EAAC,QAAQ,EAE5B,EAAA,SAAA,CAAA,CACL,CACF,CACD,EACP;AACJ;;;;"}
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { ProjectMembership } from '@medplum/fhirtypes';
3
+ export interface ChooseProfileFormProps {
4
+ login: string;
5
+ memberships: ProjectMembership[];
6
+ handleAuthResponse: (response: any) => void;
7
+ }
8
+ export declare function ChooseProfileForm(props: ChooseProfileFormProps): JSX.Element;
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ import { Avatar } from '../Avatar.js';
3
+ import { Logo } from '../Logo.js';
4
+ import { useMedplum } from '../MedplumProvider.js';
5
+
6
+ function ChooseProfileForm(props) {
7
+ const medplum = useMedplum();
8
+ return (React.createElement("div", null,
9
+ React.createElement("div", { className: "medplum-center" },
10
+ React.createElement(Logo, { size: 32 }),
11
+ React.createElement("h1", null, "Choose profile")),
12
+ props.memberships.map((membership) => {
13
+ var _a, _b, _c;
14
+ return (React.createElement("div", { className: "medplum-nav-menu-profile", key: membership.id, onClick: () => {
15
+ medplum
16
+ .post('auth/profile', {
17
+ login: props.login,
18
+ profile: membership.id,
19
+ })
20
+ .then(props.handleAuthResponse)
21
+ .catch(console.log);
22
+ } },
23
+ React.createElement("div", { className: "medplum-nav-menu-profile-icon" },
24
+ React.createElement(Avatar, { alt: (_a = membership.profile) === null || _a === void 0 ? void 0 : _a.display })),
25
+ React.createElement("div", { className: "medplum-nav-menu-profile-label" }, (_b = membership.profile) === null || _b === void 0 ? void 0 :
26
+ _b.display,
27
+ React.createElement("div", { className: "medplum-nav-menu-profile-help-text" }, (_c = membership.project) === null || _c === void 0 ? void 0 : _c.display))));
28
+ })));
29
+ }
30
+
31
+ export { ChooseProfileForm };
32
+ //# sourceMappingURL=ChooseProfileForm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChooseProfileForm.js","sources":["../../../src/auth/ChooseProfileForm.tsx"],"sourcesContent":["import { ProjectMembership } from '@medplum/fhirtypes';\nimport React from 'react';\nimport { Avatar } from '../Avatar';\nimport { Logo } from '../Logo';\nimport { useMedplum } from '../MedplumProvider';\n\nexport interface ChooseProfileFormProps {\n login: string;\n memberships: ProjectMembership[];\n handleAuthResponse: (response: any) => void;\n}\n\nexport function ChooseProfileForm(props: ChooseProfileFormProps): JSX.Element {\n const medplum = useMedplum();\n return (\n <div>\n <div className=\"medplum-center\">\n <Logo size={32} />\n <h1>Choose profile</h1>\n </div>\n {props.memberships.map((membership: ProjectMembership) => (\n <div\n className=\"medplum-nav-menu-profile\"\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 <div className=\"medplum-nav-menu-profile-icon\">\n <Avatar alt={membership.profile?.display} />\n </div>\n <div className=\"medplum-nav-menu-profile-label\">\n {membership.profile?.display}\n <div className=\"medplum-nav-menu-profile-help-text\">{membership.project?.display}</div>\n </div>\n </div>\n ))}\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;AAYM,SAAU,iBAAiB,CAAC,KAA6B,EAAA;AAC7D,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;AAC7B,IAAA,QACE,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,IAAA;QACE,KAAK,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,SAAS,EAAC,gBAAgB,EAAA;AAC7B,YAAA,KAAA,CAAA,aAAA,CAAC,IAAI,EAAA,EAAC,IAAI,EAAE,EAAE,EAAI,CAAA;AAClB,YAAA,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,IAAA,EAAA,gBAAA,CAAuB,CACnB;QACL,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,UAA6B,KAAI;;AAAC,YAAA,QACxD,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EACE,SAAS,EAAC,0BAA0B,EACpC,GAAG,EAAE,UAAU,CAAC,EAAE,EAClB,OAAO,EAAE,MAAK;oBACZ,OAAO;yBACJ,IAAI,CAAC,cAAc,EAAE;wBACpB,KAAK,EAAE,KAAK,CAAC,KAAK;wBAClB,OAAO,EAAE,UAAU,CAAC,EAAE;qBACvB,CAAC;AACD,yBAAA,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC;AAC9B,yBAAA,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;iBACvB,EAAA;gBAED,KAAK,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,SAAS,EAAC,+BAA+B,EAAA;oBAC5C,KAAC,CAAA,aAAA,CAAA,MAAM,EAAC,EAAA,GAAG,EAAE,CAAA,EAAA,GAAA,UAAU,CAAC,OAAO,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAE,OAAO,EAAA,CAAI,CACxC;AACN,gBAAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,gCAAgC,IAC5C,CAAA,EAAA,GAAA,UAAU,CAAC,OAAO,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA;uBAAE,OAAO;AAC5B,oBAAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,oCAAoC,EAAA,EAAE,MAAA,UAAU,CAAC,OAAO,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAE,OAAO,CAAO,CACnF,CACF,EACP;SAAA,CAAC,CACE,EACN;AACJ;;;;"}
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { LoginAuthenticationResponse } from '@medplum/core';
3
+ export interface NewProjectFormProps {
4
+ login: string;
5
+ handleAuthResponse: (response: LoginAuthenticationResponse) => void;
6
+ }
7
+ export declare function NewProjectForm(props: NewProjectFormProps): JSX.Element;
@@ -0,0 +1,42 @@
1
+ import { __awaiter } from '../node_modules/tslib/tslib.es6.js';
2
+ import React, { useState } from 'react';
3
+ import { Button } from '../Button.js';
4
+ import { Form } from '../Form.js';
5
+ import { FormSection } from '../FormSection.js';
6
+ import { Input } from '../Input.js';
7
+ import { Logo } from '../Logo.js';
8
+ import { useMedplum } from '../MedplumProvider.js';
9
+
10
+ function NewProjectForm(props) {
11
+ const medplum = useMedplum();
12
+ const [outcome, setOutcome] = useState();
13
+ return (React.createElement(Form, { style: { maxWidth: 400 }, onSubmit: (formData) => __awaiter(this, void 0, void 0, function* () {
14
+ try {
15
+ props.handleAuthResponse(yield medplum.startNewProject({
16
+ login: props.login,
17
+ projectName: formData.projectName,
18
+ }));
19
+ }
20
+ catch (err) {
21
+ setOutcome(err);
22
+ }
23
+ }) },
24
+ React.createElement("div", { className: "medplum-center" },
25
+ React.createElement(Logo, { size: 32 }),
26
+ React.createElement("h1", null, "Create project")),
27
+ React.createElement(FormSection, { title: "Project Name", htmlFor: "projectName", outcome: outcome },
28
+ React.createElement(Input, { name: "projectName", type: "text", testid: "projectName", placeholder: "My Project", required: true, outcome: outcome })),
29
+ React.createElement("p", { style: { fontSize: '12px', color: '#888' } },
30
+ "By clicking submit you agree to the Medplum ",
31
+ React.createElement("a", { href: "https://www.medplum.com/privacy" }, "Privacy\u00A0Policy"),
32
+ ' and ',
33
+ React.createElement("a", { href: "https://www.medplum.com/terms" }, "Terms\u00A0of\u00A0Service"),
34
+ "."),
35
+ React.createElement("div", { className: "medplum-signin-buttons" },
36
+ React.createElement("div", null),
37
+ React.createElement("div", null,
38
+ React.createElement(Button, { type: "submit", testid: "submit" }, "Create project")))));
39
+ }
40
+
41
+ export { NewProjectForm };
42
+ //# sourceMappingURL=NewProjectForm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NewProjectForm.js","sources":["../../../src/auth/NewProjectForm.tsx"],"sourcesContent":["import { LoginAuthenticationResponse } from '@medplum/core';\nimport { OperationOutcome } from '@medplum/fhirtypes';\nimport React, { useState } from 'react';\nimport { Button } from '../Button';\nimport { Form } from '../Form';\nimport { FormSection } from '../FormSection';\nimport { Input } from '../Input';\nimport { Logo } from '../Logo';\nimport { useMedplum } from '../MedplumProvider';\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 <div className=\"medplum-center\">\n <Logo size={32} />\n <h1>Create project</h1>\n </div>\n <FormSection title=\"Project Name\" htmlFor=\"projectName\" outcome={outcome}>\n <Input\n name=\"projectName\"\n type=\"text\"\n testid=\"projectName\"\n placeholder=\"My Project\"\n required={true}\n outcome={outcome}\n />\n </FormSection>\n <p style={{ fontSize: '12px', color: '#888' }}>\n By clicking submit you agree to the Medplum <a href=\"https://www.medplum.com/privacy\">Privacy&nbsp;Policy</a>\n {' and '}\n <a href=\"https://www.medplum.com/terms\">Terms&nbsp;of&nbsp;Service</a>.\n </p>\n <div className=\"medplum-signin-buttons\">\n <div />\n <div>\n <Button type=\"submit\" testid=\"submit\">\n Create project\n </Button>\n </div>\n </div>\n </Form>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;AAeM,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,QACE,KAAC,CAAA,aAAA,CAAA,IAAI,EACH,EAAA,KAAK,EAAE,EAAE,QAA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G,CAAA,aAAA,CAAA,GAAA,EAAA,EAAA,IAAI,EAAC,+BAA+B,EAA+B,EAAA,4BAAA,CAAA;AACpE,YAAA,GAAA,CAAA;QACJ,KAAK,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,SAAS,EAAC,wBAAwB,EAAA;YACrC,KAAO,CAAA,aAAA,CAAA,KAAA,EAAA,IAAA,CAAA;AACP,YAAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,IAAA;AACE,gBAAA,KAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EAAC,IAAI,EAAC,QAAQ,EAAC,MAAM,EAAC,QAAQ,EAE5B,EAAA,gBAAA,CAAA,CACL,CACF,CACD,EACP;AACJ;;;;"}
@@ -0,0 +1,10 @@
1
+ import { LoginAuthenticationResponse } from '@medplum/core';
2
+ import React from 'react';
3
+ export interface NewUserFormProps {
4
+ readonly projectId: string;
5
+ readonly googleClientId?: string;
6
+ readonly recaptchaSiteKey: string;
7
+ readonly children?: React.ReactNode;
8
+ readonly handleAuthResponse: (response: LoginAuthenticationResponse) => void;
9
+ }
10
+ export declare function NewUserForm(props: NewUserFormProps): JSX.Element;
@@ -0,0 +1,87 @@
1
+ import { __awaiter } from '../node_modules/tslib/tslib.es6.js';
2
+ import React, { useState, useEffect } from 'react';
3
+ import { Button } from '../Button.js';
4
+ import { Form } from '../Form.js';
5
+ import { FormSection } from '../FormSection.js';
6
+ import { getGoogleClientId, GoogleButton } from '../GoogleButton.js';
7
+ import { Input } from '../Input.js';
8
+ import { useMedplum } from '../MedplumProvider.js';
9
+ import { getIssuesForExpression } from '../utils/outcomes.js';
10
+ import { initRecaptcha, getRecaptcha } from '../utils/recaptcha.js';
11
+
12
+ function NewUserForm(props) {
13
+ const googleClientId = getGoogleClientId(props.googleClientId);
14
+ const recaptchaSiteKey = props.recaptchaSiteKey;
15
+ const medplum = useMedplum();
16
+ const [outcome, setOutcome] = useState();
17
+ const issues = getIssuesForExpression(outcome, undefined);
18
+ useEffect(() => initRecaptcha(recaptchaSiteKey), [recaptchaSiteKey]);
19
+ return (React.createElement(Form, { style: { maxWidth: 400 }, onSubmit: (formData) => __awaiter(this, void 0, void 0, function* () {
20
+ try {
21
+ const recaptchaToken = yield getRecaptcha(recaptchaSiteKey);
22
+ props.handleAuthResponse(yield medplum.startNewUser({
23
+ projectId: props.projectId,
24
+ firstName: formData.firstName,
25
+ lastName: formData.lastName,
26
+ email: formData.email,
27
+ password: formData.password,
28
+ remember: formData.remember === 'true',
29
+ recaptchaSiteKey,
30
+ recaptchaToken,
31
+ }));
32
+ }
33
+ catch (err) {
34
+ setOutcome(err);
35
+ }
36
+ }) },
37
+ React.createElement("div", { className: "medplum-center" }, props.children),
38
+ issues && (React.createElement("div", { className: "medplum-input-error" }, issues.map((issue) => {
39
+ var _a, _b;
40
+ return (React.createElement("div", { "data-testid": "text-field-error", key: (_a = issue.details) === null || _a === void 0 ? void 0 : _a.text }, (_b = issue.details) === null || _b === void 0 ? void 0 : _b.text));
41
+ }))),
42
+ googleClientId && (React.createElement(React.Fragment, null,
43
+ React.createElement("div", { className: "medplum-signin-google-container" },
44
+ React.createElement(GoogleButton, { googleClientId: googleClientId, handleGoogleCredential: (response) => __awaiter(this, void 0, void 0, function* () {
45
+ try {
46
+ props.handleAuthResponse(yield medplum.startGoogleLogin({
47
+ googleClientId: response.clientId,
48
+ googleCredential: response.credential,
49
+ createUser: true,
50
+ }));
51
+ }
52
+ catch (err) {
53
+ setOutcome(err);
54
+ }
55
+ }) })),
56
+ React.createElement("div", { className: "medplum-signin-separator" }, "or"))),
57
+ React.createElement(FormSection, { title: "First Name", htmlFor: "firstName", outcome: outcome },
58
+ React.createElement(Input, { name: "firstName", type: "text", testid: "firstName", placeholder: "First name", required: true, autoFocus: true, outcome: outcome })),
59
+ React.createElement(FormSection, { title: "Last Name", htmlFor: "lastName", outcome: outcome },
60
+ React.createElement(Input, { name: "lastName", type: "text", testid: "lastName", placeholder: "Last name", required: true, outcome: outcome })),
61
+ React.createElement(FormSection, { title: "Email", htmlFor: "email", outcome: outcome },
62
+ React.createElement(Input, { name: "email", type: "email", testid: "email", placeholder: "name@domain.com", required: true, outcome: outcome })),
63
+ React.createElement(FormSection, { title: "Password", htmlFor: "password", outcome: outcome },
64
+ React.createElement(Input, { name: "password", type: "password", testid: "password", autoComplete: "off", required: true, outcome: outcome })),
65
+ React.createElement("p", { style: { fontSize: '12px', color: '#888' } },
66
+ "By clicking submit you agree to the Medplum ",
67
+ React.createElement("a", { href: "https://www.medplum.com/privacy" }, "Privacy\u00A0Policy"),
68
+ ' and ',
69
+ React.createElement("a", { href: "https://www.medplum.com/terms" }, "Terms\u00A0of\u00A0Service"),
70
+ "."),
71
+ React.createElement("p", { style: { fontSize: '12px', color: '#888' } },
72
+ "This site is protected by reCAPTCHA and the Google",
73
+ ' ',
74
+ React.createElement("a", { href: "https://policies.google.com/privacy" }, "Privacy\u00A0Policy"),
75
+ ' and ',
76
+ React.createElement("a", { href: "https://policies.google.com/terms" }, "Terms\u00A0of\u00A0Service"),
77
+ " apply."),
78
+ React.createElement("div", { className: "medplum-signin-buttons" },
79
+ React.createElement("div", null,
80
+ React.createElement("input", { type: "checkbox", id: "remember", name: "remember", value: "true" }),
81
+ React.createElement("label", { htmlFor: "remember" }, "Remember me")),
82
+ React.createElement("div", null,
83
+ React.createElement(Button, { type: "submit", testid: "submit" }, "Create account")))));
84
+ }
85
+
86
+ export { NewUserForm };
87
+ //# sourceMappingURL=NewUserForm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NewUserForm.js","sources":["../../../src/auth/NewUserForm.tsx"],"sourcesContent":["import { GoogleCredentialResponse, LoginAuthenticationResponse } from '@medplum/core';\nimport { OperationOutcome } from '@medplum/fhirtypes';\nimport React, { useEffect, useState } from 'react';\nimport { Button } from '../Button';\nimport { Form } from '../Form';\nimport { FormSection } from '../FormSection';\nimport { getGoogleClientId, GoogleButton } from '../GoogleButton';\nimport { Input } from '../Input';\nimport { useMedplum } from '../MedplumProvider';\nimport { 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 <div className=\"medplum-center\">{props.children}</div>\n {issues && (\n <div className=\"medplum-input-error\">\n {issues.map((issue) => (\n <div data-testid=\"text-field-error\" key={issue.details?.text}>\n {issue.details?.text}\n </div>\n ))}\n </div>\n )}\n {googleClientId && (\n <>\n <div className=\"medplum-signin-google-container\">\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 </div>\n <div className=\"medplum-signin-separator\">or</div>\n </>\n )}\n <FormSection title=\"First Name\" htmlFor=\"firstName\" outcome={outcome}>\n <Input\n name=\"firstName\"\n type=\"text\"\n testid=\"firstName\"\n placeholder=\"First name\"\n required={true}\n autoFocus={true}\n outcome={outcome}\n />\n </FormSection>\n <FormSection title=\"Last Name\" htmlFor=\"lastName\" outcome={outcome}>\n <Input\n name=\"lastName\"\n type=\"text\"\n testid=\"lastName\"\n placeholder=\"Last name\"\n required={true}\n outcome={outcome}\n />\n </FormSection>\n <FormSection title=\"Email\" htmlFor=\"email\" outcome={outcome}>\n <Input\n name=\"email\"\n type=\"email\"\n testid=\"email\"\n placeholder=\"name@domain.com\"\n required={true}\n outcome={outcome}\n />\n </FormSection>\n <FormSection title=\"Password\" htmlFor=\"password\" outcome={outcome}>\n <Input name=\"password\" type=\"password\" testid=\"password\" autoComplete=\"off\" required={true} outcome={outcome} />\n </FormSection>\n <p style={{ fontSize: '12px', color: '#888' }}>\n By clicking submit you agree to the Medplum <a href=\"https://www.medplum.com/privacy\">Privacy&nbsp;Policy</a>\n {' and '}\n <a href=\"https://www.medplum.com/terms\">Terms&nbsp;of&nbsp;Service</a>.\n </p>\n <p style={{ fontSize: '12px', color: '#888' }}>\n This site is protected by reCAPTCHA and the Google{' '}\n <a href=\"https://policies.google.com/privacy\">Privacy&nbsp;Policy</a>\n {' and '}\n <a href=\"https://policies.google.com/terms\">Terms&nbsp;of&nbsp;Service</a> apply.\n </p>\n <div className=\"medplum-signin-buttons\">\n <div>\n <input type=\"checkbox\" id=\"remember\" name=\"remember\" value=\"true\" />\n <label htmlFor=\"remember\">Remember me</label>\n </div>\n <div>\n <Button type=\"submit\" testid=\"submit\">\n Create account\n </Button>\n </div>\n </div>\n </Form>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAoBM,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,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ACF,CACD,EACP;AACJ;;;;"}
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import './SignInForm.css';
3
+ import '../util.css';
4
+ export interface RegisterFormProps {
5
+ readonly type: 'patient' | 'project';
6
+ readonly projectId?: string;
7
+ readonly googleClientId?: string;
8
+ readonly recaptchaSiteKey: string;
9
+ readonly children?: React.ReactNode;
10
+ readonly onSuccess: () => void;
11
+ }
12
+ export declare function RegisterForm(props: RegisterFormProps): JSX.Element;
@@ -0,0 +1,39 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import { Document } from '../Document.js';
3
+ import { useMedplum } from '../MedplumProvider.js';
4
+ import { NewProjectForm } from './NewProjectForm.js';
5
+ import { NewUserForm } from './NewUserForm.js';
6
+
7
+ function RegisterForm(props) {
8
+ const { type, projectId, googleClientId, recaptchaSiteKey, onSuccess } = props;
9
+ const medplum = useMedplum();
10
+ const [login, setLogin] = useState(undefined);
11
+ const [outcome, setOutcome] = useState();
12
+ useEffect(() => {
13
+ if (type === 'patient' && login) {
14
+ medplum
15
+ .startNewPatient({ login, projectId: projectId })
16
+ .then((response) => medplum.processCode(response.code))
17
+ .then(() => onSuccess())
18
+ .catch((err) => setOutcome(err));
19
+ }
20
+ }, [medplum, type, projectId, login, onSuccess]);
21
+ function handleAuthResponse(response) {
22
+ if (response.code) {
23
+ medplum
24
+ .processCode(response.code)
25
+ .then(() => onSuccess())
26
+ .catch(console.log);
27
+ }
28
+ else if (response.login) {
29
+ setLogin(response.login);
30
+ }
31
+ }
32
+ return (React.createElement(Document, { width: 450 },
33
+ outcome && React.createElement("pre", null, JSON.stringify(outcome, null, 2)),
34
+ !login && (React.createElement(NewUserForm, { projectId: projectId, googleClientId: googleClientId, recaptchaSiteKey: recaptchaSiteKey, handleAuthResponse: handleAuthResponse })),
35
+ login && type === 'project' && React.createElement(NewProjectForm, { login: login, handleAuthResponse: handleAuthResponse })));
36
+ }
37
+
38
+ export { RegisterForm };
39
+ //# sourceMappingURL=RegisterForm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RegisterForm.js","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';\nimport { useMedplum } from '../MedplumProvider';\nimport { NewProjectForm } from './NewProjectForm';\nimport { NewUserForm } from './NewUserForm';\nimport './SignInForm.css';\nimport '../util.css';\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 )}\n {login && type === 'project' && <NewProjectForm login={login} handleAuthResponse={handleAuthResponse} />}\n </Document>\n );\n}\n"],"names":[],"mappings":";;;;;;AAmBM,SAAU,YAAY,CAAC,KAAwB,EAAA;AACnD,IAAA,MAAM,EAAE,IAAI,EAAE,SAA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AAI,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,IAAA,EAAM,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAO;QACxD,CAAC,KAAK,KACL,KAAA,CAAA,aAAA,CAAC,WAAW,EACV,EAAA,SAAS,EAAE,SAAmB,EAC9B,cAAc,EAAE,cAAc,EAC9B,gBAAgB,EAAE,gBAAgB,EAClC,kBAAkB,EAAE,kBAAkB,EAAA,CACtC,CACH;AACA,QAAA,KAAK,IAAI,IAAI,KAAK,SAAS,IAAI,KAAA,CAAA,aAAA,CAAC,cAAc,EAAC,EAAA,KAAK,EAAE,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAI,CAAA,CAC/F,EACX;AACJ;;;;"}
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
+ import '../util.css';
2
3
  import './SignInForm.css';
3
- import './util.css';
4
4
  export interface SignInFormProps {
5
5
  readonly remember?: boolean;
6
6
  readonly projectId?: string;
@@ -0,0 +1,52 @@
1
+ import React, { useState } from 'react';
2
+ import { Document } from '../Document.js';
3
+ import { useMedplum } from '../MedplumProvider.js';
4
+ import { AuthenticationForm } from './AuthenticationForm.js';
5
+ import { ChooseProfileForm } from './ChooseProfileForm.js';
6
+ import { NewProjectForm } from './NewProjectForm.js';
7
+
8
+ function SignInForm(props) {
9
+ const medplum = useMedplum();
10
+ const [login, setLogin] = useState(undefined);
11
+ const [memberships, setMemberships] = useState(undefined);
12
+ function handleAuthResponse(response) {
13
+ if (response.login) {
14
+ setLogin(response.login);
15
+ }
16
+ if (response.memberships) {
17
+ setMemberships(response.memberships);
18
+ }
19
+ if (response.code) {
20
+ if (props.onCode) {
21
+ props.onCode(response.code);
22
+ }
23
+ else {
24
+ medplum
25
+ .processCode(response.code)
26
+ .then(() => {
27
+ if (props.onSuccess) {
28
+ props.onSuccess();
29
+ }
30
+ })
31
+ .catch(console.log);
32
+ }
33
+ }
34
+ }
35
+ return (React.createElement(Document, { width: 450 }, (() => {
36
+ if (!login) {
37
+ return (React.createElement(AuthenticationForm, { projectId: props.projectId, clientId: props.clientId, scope: props.scope, nonce: props.nonce, googleClientId: props.googleClientId, onForgotPassword: props.onForgotPassword, onRegister: props.onRegister, handleAuthResponse: handleAuthResponse }, props.children));
38
+ }
39
+ else if (memberships) {
40
+ return React.createElement(ChooseProfileForm, { login: login, memberships: memberships, handleAuthResponse: handleAuthResponse });
41
+ }
42
+ else if (props.projectId === 'new') {
43
+ return React.createElement(NewProjectForm, { login: login, handleAuthResponse: handleAuthResponse });
44
+ }
45
+ else {
46
+ return React.createElement("div", null, "Success");
47
+ }
48
+ })()));
49
+ }
50
+
51
+ export { SignInForm };
52
+ //# sourceMappingURL=SignInForm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SignInForm.js","sources":["../../../src/auth/SignInForm.tsx"],"sourcesContent":["import { LoginAuthenticationResponse } from '@medplum/core';\nimport { ProjectMembership } from '@medplum/fhirtypes';\nimport React, { useState } from 'react';\nimport { Document } from '../Document';\nimport { useMedplum } from '../MedplumProvider';\nimport { AuthenticationForm } from './AuthenticationForm';\nimport { ChooseProfileForm } from './ChooseProfileForm';\nimport { NewProjectForm } from './NewProjectForm';\nimport '../util.css';\nimport './SignInForm.css';\n\nexport interface SignInFormProps {\n readonly remember?: boolean;\n readonly projectId?: string;\n readonly googleClientId?: string;\n readonly clientId?: string;\n readonly scope?: string;\n readonly nonce?: string;\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\nexport function SignInForm(props: SignInFormProps): JSX.Element {\n const medplum = useMedplum();\n const [login, setLogin] = useState<string | undefined>(undefined);\n const [memberships, setMemberships] = useState<ProjectMembership[] | undefined>(undefined);\n\n function handleAuthResponse(response: LoginAuthenticationResponse): void {\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 (props.onCode) {\n props.onCode(response.code);\n } else {\n medplum\n .processCode(response.code)\n .then(() => {\n if (props.onSuccess) {\n props.onSuccess();\n }\n })\n .catch(console.log);\n }\n }\n }\n\n return (\n <Document width={450}>\n {(() => {\n if (!login) {\n return (\n <AuthenticationForm\n projectId={props.projectId}\n clientId={props.clientId}\n scope={props.scope}\n nonce={props.nonce}\n googleClientId={props.googleClientId}\n onForgotPassword={props.onForgotPassword}\n onRegister={props.onRegister}\n handleAuthResponse={handleAuthResponse}\n >\n {props.children}\n </AuthenticationForm>\n );\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 {\n return <div>Success</div>;\n }\n })()}\n </Document>\n );\n}\n"],"names":[],"mappings":";;;;;;;AAyBM,SAAU,UAAU,CAAC,KAAsB,EAAA;AAC/C,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,cAAc,CAAC,GAAG,QAAQ,CAAkC,SAAS,CAAC,CAAC;IAE3F,SAAS,kBAAkB,CAAC,QAAqC,EAAA;QAC/D,IAAI,QAAQ,CAAC,KAAK,EAAE;AAClB,YAAA,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC1B,SAAA;QAED,IAAI,QAAQ,CAAC,WAAW,EAAE;AACxB,YAAA,cAAc,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AACtC,SAAA;QAED,IAAI,QAAQ,CAAC,IAAI,EAAE;YACjB,IAAI,KAAK,CAAC,MAAM,EAAE;AAChB,gBAAA,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC7B,aAAA;AAAM,iBAAA;gBACL,OAAO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