/*! * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved. * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.") * * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and limitations under the License. */ import { type SetStateAction } from "react"; import { type FullscreenModeMessageBus } from "../message-bus/index.js"; import { bufferLatest } from "../tools/bufferLatest.js"; import { PublishMessage } from "../tools/createMessageBus.js"; import { renderReactInWebComponent } from "../web-component/renderReactInWebComponent.js"; import { UiShellProps, UiShellTranslationSettings } from "./UiShell.js"; import { UiShellNavComponentProps } from "./uiShellContentTypes.js"; export declare const optionalComponentSlotNames: Record["optionalComponents"], string>; export type SlottedElements = Record["optionalComponents"], HTMLDivElement>; export type RenderedUiShell = { closeRightSideMenu: PublishMessage; closeSideNavMenu: PublishMessage; /** * Put the whole app area in fullscreen. UI Shell hides its top nav, side nav, and banners so the app fills the page. * * Use this when your app isn't built with Odyssey's `FullscreenButton`, for example a non-React app. * * The app area is one more entry in the page's fullscreen stack, so a `FullscreenRegion` can enter on top of it, and Escape goes back one step at a time. Removing `uiShellElement` from the page clears the stack. */ enterAppFullscreen: () => void; /** * Take the app area out of fullscreen. A `FullscreenRegion` that entered on top of it stays in fullscreen. */ exitAppFullscreen: () => void; /** * The page's current fullscreen state. */ getFullscreenState: FullscreenModeMessageBus["getFullscreenState"]; setComponentProps: ReturnType>>; /** * Update the shell's translation settings (`languageCode`, `translationOverrides`) at runtime. * * Call this after the consumer's locale changes to re-localize shell-rendered chrome (skip-to-content link, top nav icons, side nav toggle) without re-rendering UI Shell. * * Accepts a React `SetStateAction`: passing a plain object **replaces** the entire settings value (so omitting `translationOverrides` clears it). Pass an updater function — `(previous) => ({ ...previous, languageCode: "es" })` — to merge with * the previous value. */ setTranslationSettings: ReturnType>>; slottedElements: SlottedElements; /** * Listen for fullscreen changes anywhere on the page, including ones from other apps. Returns a function that stops listening. */ subscribeToFullscreenState: FullscreenModeMessageBus["subscribeToFullscreenState"]; uiShellElement: ReturnType; } & Partial>; /** * This function renders UI Shell in a web component. * This function is agnostic to the UI framework for your app is using. Your application can be another web component, a React app, or even vanilla HTML. * * **All styles are self-contained.** Even though your application visually renders as children of the web component, its within the global `document` scope, not the web component's `ShadowRoot`. That means any global styles will not affect UI Shell but will affect your application. * * It places your app's root element in a web component and ensures it remains rendered in the event of a UI Shell error. * It also provides you with other elements fitted to slots in the web component. **In React, you can portal to these components.** */ export declare const renderUiShell: ({ appBackgroundColor, appBackgroundContrastMode, appElement: providedAppElement, appElementScrollingMode, breakpointConfig, hasStandardAppContentPadding, initialVisibleSections, languageCode, onError, onRender, parentElement, sideNavBackgroundColor, sideNavBackgroundContrastColor, topNavBackgroundColor, translationOverrides, nonce, }: { /** * Optional nonce for CSP compliance. */ nonce?: string; /** * Notifies when a React rendering error occurs. This could be useful for logging, reporting priority 0 issues, and recovering UI Shell when errors occur. */ onError?: () => void; /** * Notify once when React has rendered UI Shell the first time. */ onRender?: (renderedUiShell: RenderedUiShell) => void; /** * HTML element used as the container for UI Shell and the App. They're siblings inside this element. */ parentElement: HTMLElement; } & Pick & Partial & Partial>) => { appElement: HTMLDivElement; closeRightSideMenu: PublishMessage; closeSideNavMenu: PublishMessage; enterAppFullscreen: () => void; exitAppFullscreen: () => void; getFullscreenState: () => import("../message-bus/index.js").FullscreenState; setComponentProps: (value: SetStateAction) => void; setTranslationSettings: (value: SetStateAction) => void; slottedElements: SlottedElements; subscribeToFullscreenState: import("../tools/createMessageBus.js").MessageSubscription; uiShellElement: import("../web-component/renderReactInWebComponent.js").WebComponentClass; }; //# sourceMappingURL=renderUiShell.d.ts.map