@formsort/web-embed-api
Advanced tools
+9
-0
@@ -11,2 +11,11 @@ import { type IFormsortEmbedConfig, type IEventMap } from '@formsort/embed-messaging-manager'; | ||
| useHistoryAPI?: boolean; | ||
| /** | ||
| * iframe title attribute for accessibility | ||
| */ | ||
| iframeTitle?: string; | ||
| /** | ||
| * iframe allow attribute for permissions | ||
| * e.g. "camera;" | ||
| */ | ||
| iframeAllow?: string; | ||
| } | ||
@@ -13,0 +22,0 @@ declare const FormsortWebEmbed: (rootEl: HTMLElement, config?: IFormsortWebEmbedConfig) => IFormsortWebEmbed; |
+7
-2
@@ -11,7 +11,9 @@ "use strict"; | ||
| }; | ||
| const DEFAULT_ALLOW = 'camera;'; | ||
| const FormsortWebEmbed = (rootEl, config = DEFAULT_CONFIG) => { | ||
| const iframeEl = document.createElement('iframe'); | ||
| const { style } = config; | ||
| const { style, iframeAllow = DEFAULT_ALLOW, iframeTitle } = config; | ||
| let loadedOrigin; | ||
| iframeEl.style.border = 'none'; | ||
| iframeEl.allow = iframeAllow || DEFAULT_ALLOW; | ||
| if (style) { | ||
@@ -22,2 +24,5 @@ const { width = '', height = '' } = style; | ||
| } | ||
| if (iframeTitle) { | ||
| iframeEl.title = iframeTitle; | ||
| } | ||
| rootEl.appendChild(iframeEl); | ||
@@ -58,3 +63,3 @@ const setSize = (width, height) => { | ||
| messagingManager.addEventListener(embed_messaging_manager_1.SupportedAnalyticsEvent.FlowLoaded, (payload) => { | ||
| if (payload.documentTitle) { | ||
| if (payload.documentTitle && !iframeEl.title) { | ||
| iframeEl.title = payload.documentTitle; | ||
@@ -61,0 +66,0 @@ } |
+1
-1
| { | ||
| "name": "@formsort/web-embed-api", | ||
| "version": "2.9.0", | ||
| "version": "2.10.0", | ||
| "description": "Embed Formsort flows within other webpages", | ||
@@ -5,0 +5,0 @@ "publishConfig": { |
+15
-0
@@ -36,2 +36,11 @@ # @formsort/web-embed-api | ||
| useHistoryAPI?: boolean; // Default: false | ||
| /** | ||
| * iframe title attribute for accessibility | ||
| */ | ||
| iframeTitle?: string; | ||
| /** | ||
| * iframe allow attribute for permissions | ||
| * e.g. "camera;" | ||
| */ | ||
| iframeAllow?: string; | ||
| autoHeight?: boolean; // Default: false | ||
@@ -59,4 +68,10 @@ style?: { | ||
| - `iframeTitle`: Optional string to set the iframe's title attribute for accessibility. If not provided, the embed will attempt to set a title from the flow's document title when available. | ||
| - `iframeAllow`: Optional string to set the iframe's allow attribute for permissions (for example: `"camera;"`). | ||
| - `authentication.idToken`: When the Flow requires an ID token, this can be used to provide it. | ||
| - `origin`: When present, loads the flow from your custom domain instead of the default formsort domain. | ||
| ### `loadFlow(clientLabel: string, flowLabel: string, variantLabel?: string, queryParams?: Array<[string, string]>) => void` | ||
@@ -63,0 +78,0 @@ |
20787
5.09%269
5.49%176
9.32%