O3 Framework API Reference

O3 Framework API Reference

This page provides a reference for the APIs provided by the O3 framework. Its content is generated from comments in the source code.

 

Table of contents

API Functions

Breadcrumb Functions

Config Functions

Config Validation Functions

Context Functions

Date and Time Functions

Dynamic Loading Functions

Error Handling Functions

Extension Functions

Feature Flags Functions

Framework Functions

Navigation Functions

Offline Functions

Other Functions

Store Functions

Translation Functions

UI Functions

Utility Functions

Workspace Functions

API Type Aliases

CurrentPatient

Ƭ CurrentPatient: fhir.Patient | FetchResponse<fhir.Patient>

Defined in

packages/framework/esm-api/src/shared-api-objects/current-patient.ts:7


LoadedSessionStore

Ƭ LoadedSessionStore: Object

Type declaration

Name

Type

Name

Type

loaded

true

session

Session

Defined in

packages/framework/esm-api/src/shared-api-objects/current-user.ts:11


NullablePatient

Ƭ NullablePatient: fhir.Patient | null

Defined in

packages/framework/esm-react-utils/src/usePatient.ts:6


PatientUuid

Ƭ PatientUuid: string | null

Defined in

packages/framework/esm-api/src/shared-api-objects/current-patient.ts:20


SessionStore

Ƭ SessionStore: LoadedSessionStore | UnloadedSessionStore

Defined in

packages/framework/esm-api/src/shared-api-objects/current-user.ts:9


UnloadedSessionStore

Ƭ UnloadedSessionStore: Object

Type declaration

Name

Type

Name

Type

loaded

false

session

null

Defined in

packages/framework/esm-api/src/shared-api-objects/current-user.ts:16


Context Type Aliases

ContextCallback

Ƭ ContextCallback<T>: (state: Readonly<T> | null | undefined) => void

Type parameters

Name

Type

Name

Type

T

extends Object = {}

Type declaration

▸ (state): void

Parameters

Name

Type

Name

Type

state

Readonly<T> | null | undefined

Returns

void

Defined in

packages/framework/esm-context/src/context.ts:90


Date and Time Type Aliases

DateInput

Ƭ DateInput: string | number | Date

Defined in

packages/framework/esm-utils/src/omrs-dates.ts:26


FormatDateMode

Ƭ FormatDateMode: "standard" | "wide"

Defined in

packages/framework/esm-utils/src/omrs-dates.ts:140


FormatDateOptions

Ƭ FormatDateOptions: Object

Type declaration

Name

Type

Description

Name

Type

Description

calendar?

string

The calendar to use when formatting this date.

day

boolean

Whether to include the day number

locale?

string

The locale to use when formatting this date

mode

FormatDateMode

  • standard: "03 Feb 2022" - wide: "03 — Feb — 2022"

month

boolean

Whether to include the month number

noToday

boolean

Disables the special handling of dates that are today. If false (the default), then dates that are today will be formatted as "Today" in the locale language. If true, then dates that are today will be formatted the same as all other dates.

numberingSystem?

string

The unicode numbering system to use

time

boolean | "for today"

Whether the time should be included in the output always (true), never (false), or only when the input date is today (for today).

year

boolean

Whether to include the year

Defined in

packages/framework/esm-utils/src/omrs-dates.ts:142


Extension Type Aliases

ExtensionProps

Ƭ ExtensionProps: { state?: Record<string, any> ; wrap?: (slot: ReactNode, extension: ExtensionData) => null | ReactElement<any, any> } & Omit<React.HTMLAttributes<HTMLDivElement>, "children"> & { children?: React.ReactNode | (slot: React.ReactNode, extension?: ExtensionData) => React.ReactNode }

Defined in

packages/framework/esm-react-utils/src/Extension.tsx:8


ExtensionSlotProps

Ƭ ExtensionSlotProps: OldExtensionSlotBaseProps | ExtensionSlotBaseProps & Omit<React.HTMLAttributes<HTMLDivElement>, "children"> & { children?: React.ReactNode | (extension: ConnectedExtension) => React.ReactNode }

Defined in

packages/framework/esm-react-utils/src/ExtensionSlot.tsx:24


Navigation Type Aliases

TemplateParams

Ƭ TemplateParams: Object

Index signature

▪ [key: string]: string

Defined in

packages/framework/esm-navigation/src/navigation/navigate.ts:10


Offline Type Aliases

KnownOmrsServiceWorkerMessages

Ƭ KnownOmrsServiceWorkerMessages: OnImportMapChangedMessage | ClearDynamicRoutesMessage | RegisterDynamicRouteMessage

Defined in

packages/framework/esm-offline/src/service-worker-messaging.ts:41


OfflineMode

Ƭ OfflineMode: "on" | "off" | "unavailable"

Defined in

packages/framework/esm-offline/src/mode.ts:34


OmrsOfflineCachingStrategy

Ƭ OmrsOfflineCachingStrategy: "network-only-or-cache-only" | "network-first"

Defined in

packages/framework/esm-offline/src/service-worker-http-headers.ts:15


OmrsOfflineHttpHeaderNames

Ƭ OmrsOfflineHttpHeaderNames: keyof OmrsOfflineHttpHeaders

Defined in

packages/framework/esm-offline/src/service-worker-http-headers.ts:40


OmrsOfflineHttpHeaders

Ƭ OmrsOfflineHttpHeaders: Object

Defines the keys of the custom headers which can be appended to an HTTP request. HTTP requests with these headers are handled in a special way by the SPA's service worker.

Type declaration

Name

Type

Description

Name

Type

Description

x-omrs-offline-caching-strategy?

OmrsOfflineCachingStrategy

Instructs the service worker to use a specific caching strategy for this request.

x-omrs-offline-response-body?

string

If the client is offline and the request cannot be read from the cache (i.e. if there is no way to receive any kind of data for this request), the service worker will return a response with the body in this header.

x-omrs-offline-response-status?

`${number}`

If the client is offline and the request cannot be read from the cache (i.e. if there is no way to receive any kind of data for this request), the service worker will return a response with the status code defined in this header.

Defined in

packages/framework/esm-offline/src/service-worker-http-headers.ts:21


Other Type Aliases

ConfigValue

Ƭ ConfigValue: string | number | boolean | void | any[] | object

Defined in

packages/framework/esm-config/src/types.ts:40


DateInputValue

Ƭ DateInputValue: CalendarDate | CalendarDateTime | ZonedDateTime | Date | Dayjs | string | number | null | undefined

A type for any of the acceptable date formats

Defined in

packages/framework/esm-styleguide/src/datepicker/index.tsx:58


ExtensionDefinition

Ƭ ExtensionDefinition: { featureFlag?: string ; meta?: { [k: string]: unknown; } ; name: string ; offline?: boolean ; online?: boolean ; order?: number ; privileges?: string | string[] ; slot?: string ; slots?: string[] } & { component: string } | { component?: never }

A definition of an extension as extracted from an app's routes.json

Defined in

packages/framework/esm-globals/src/types.ts:177


IconProps

Ƭ IconProps: Object

Type declaration

Name

Type

Name

Type

className?

Argument

fill?

string

size?

number

Defined in

packages/framework/esm-styleguide/src/icons/icons.tsx:6


ModalDefinition

Ƭ ModalDefinition: { name: string } & { component: string } | { component?: never }

A definition of a modal as extracted from an app's routes.json

Defined in

packages/framework/esm-globals/src/types.ts:242


NameUse

Ƭ NameUse: "usual" | "official" | "temp" | "nickname" | "anonymous" | "old" | "maiden"

Defined in

packages/framework/esm-globals/src/types.ts:403


OpenmrsRoutes

Ƭ OpenmrsRoutes: Record<string, OpenmrsAppRoutes>

This interfaces describes the format of the overall rotues.json loaded by the app shell. Basically, this is the same as the app routes, with each routes definition keyed by the app's name

Defined in

packages/framework/esm-globals/src/types.ts:394


PageDefinition

Ƭ PageDefinition: { component: string ; offline?: boolean ; online?: boolean ; order?: number } & { route: string | boolean ; routeRegex?: never } | { route?: never ; routeRegex: string }

A definition of a page extracted from an app's routes.json

Defined in

packages/framework/esm-globals/src/types.ts:121


PictogramProps

Ƭ PictogramProps: Object

Type declaration

Name

Type

Name

Type

className?

Argument

size?

number

Defined in

packages/framework/esm-styleguide/src/pictograms/pictograms.tsx:5


ProvidedConfig

Ƭ ProvidedConfig: Object

Type declaration

Name

Type

Name

Type

config

Config

source

string

Defined in

packages/framework/esm-config/src/types.ts:62


RegisteredPageDefinition

Ƭ RegisteredPageDefinition: Omit<PageDefinition, "order"> & AppComponent & { order: number }

A definition of a page after the app has been registered.

Defined in

packages/framework/esm-globals/src/types.ts:172


SpaEnvironment

Ƭ SpaEnvironment: "production" | "development" | "test"

Defined in

packages/framework/esm-globals/src/types.ts:76


SvgIconProps

Ƭ SvgIconProps: Object

Type declaration

Name

Type

Name

Type

icon

string

iconProps

IconProps

Defined in

packages/framework/esm-styleguide/src/icons/icons.tsx:592


SvgPictogramProps

Ƭ SvgPictogramProps: Object

Type declaration

Name

Type

Description

Name

Type

Description

pictogram

string

the id of the pictogram

pictogramProps

PictogramProps

properties when using the pictogram

Defined in

packages/framework/esm-styleguide/src/pictograms/pictograms.tsx:10


UpdateVisitPayload

Ƭ UpdateVisitPayload: NewVisitPayload & {}

Defined in

packages/framework/esm-api/src/types/visit-resource.ts:16


Validator

Ƭ Validator: (value: any) => void | string

Type declaration

▸ (value): void | string

Parameters

Name

Type

Name

Type

value

any

Returns

void | string

Defined in

packages/framework/esm-config/src/types.ts:69


ValidatorFunction

Ƭ ValidatorFunction: (value: any) => boolean

Type declaration

▸ (value): boolean

Parameters

Name

Type

Name

Type

value

any

Returns

boolean

Defined in

packages/framework/esm-config/src/types.ts:67


WorkspaceDefinition

Ƭ WorkspaceDefinition: { canHide?: boolean ; canMaximize?: boolean ; hasOwnSidebar?: boolean ; name: string ; preferredWindowSize?: WorkspaceWindowState ; sidebarFamily?: string ; title: string ; type: string ; width?: "narrow" | "wider" | "extra-wide" } & { component: string } | { component?: never }

A definition of a workspace as extracted from an app's routes.json

Defined in

packages/framework/esm-globals/src/types.ts:276


WorkspaceWindowState

Ƭ WorkspaceWindowState: "maximized" | "hidden" | "normal"

Defined in

packages/framework/esm-globals/src/types.ts:271


Store Type Aliases

ActionFunction

Ƭ ActionFunction<T>: (state: T, ...args: any[]) => Partial<T>

Type parameters

Name

Name

T

Type declaration

▸ (state, ...args): Partial<T>

Parameters

Name

Type

Name

Type

state

T

...args

any[]

Returns

Partial<T>

Defined in

packages/framework/esm-react-utils/src/useStore.ts:6


Actions

Ƭ Actions<T>: (store: StoreApi<T>) => Record<string, ActionFunction<T>> | Record<string, ActionFunction<T>>

Type parameters

Name

Name

T

Defined in

packages/framework/esm-react-utils/src/useStore.ts:7


BoundActions

Ƭ BoundActions: Object

Index signature

▪ [key: string]: (...args: any[]) => void

Defined in

packages/framework/esm-react-utils/src/useStore.ts:10


Translation Type Aliases

CoreTranslationKey

Ƭ CoreTranslationKey: keyof typeof coreTranslations

Defined in

packages/framework/esm-translations/src/index.ts:47


UI Type Aliases

ActionableNotificationType

Ƭ ActionableNotificationType: "error" | "info" | "info-square" | "success" | "warning" | "warning-alt"

Defined in

packages/framework/esm-styleguide/src/notifications/actionable-notification.component.tsx:24


InlineNotificationType

Ƭ InlineNotificationType: "error" | "info" | "info-square" | "success" | "warning" | "warning-alt"

Defined in

packages/framework/esm-styleguide/src/notifications/notification.component.tsx:22


LayoutType

Ƭ LayoutType: "phone" | "tablet" | "small-desktop" | "large-desktop"

Defined in

packages/framework/esm-react-utils/src/useLayoutType.ts:4


SnackbarType

Ƭ SnackbarType: "error" | "info" | "info-square" | "success" | "warning" | "warning-alt"

Defined in