From aeba37dd3251bcb201b8524012f184ff470693be Mon Sep 17 00:00:00 2001 From: Eran Grinberg Date: Tue, 30 Apr 2024 08:50:42 +0200 Subject: [PATCH] feat: Add sandboxAttributes prop to solve issue from this PR https://github.com/botman/web-widget/pull/53/files --- README.md | 5 +++-- package.json | 2 +- src/typings/index.ts | 2 ++ src/widget/chat-frame.tsx | 1 + types/botman-extended-web-widget.d.ts | 1 + 5 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ad03bd5..aa82090 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@

License MIT - version 1.2.7 + version 1.2.8 maintained yes

@@ -158,11 +158,12 @@ Here are the new options: | --- | --- | --- | --- | --- | | useChatAsIframe | boolean | Whether to use the chat as an iframe. | false | | useInAppCss | boolean | Whether to use in-app inline CSS. | false | -| useShadowDom | boolean | Whether to use shadow DOM. | true | css is always injected | +| useShadowDom | boolean | Whether to use [shadow DOM](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_shadow_DOM). | true | css is always injected | | requestHeaders | object | Custom headers for authentication. | {} | | customStylesInjection | string | Custom styles to inject into the widget. | '' | | autoInit | boolean | Whether to automatically initialize the widget. use if load in html | false | | useLoader | boolean | Whether to use a loader as a type indication until the server responds | false | +| sandboxAttributes | string | The [sandbox attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#sandbox) for the iframe | '' | [Sandbox Docs](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#sandbox) | ## reactiv chat open / close state ```javascript diff --git a/package.json b/package.json index f76014a..659a03c 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "type": "git", "url": "https://github.com/EranGrin/botman-extended-web-widget" }, - "version": "1.2.7", + "version": "1.2.8", "description": "A BotMan frontend package for the web widget", "type": "module", "main": "dist/widget.js", diff --git a/src/typings/index.ts b/src/typings/index.ts index 9e495e1..7c08876 100644 --- a/src/typings/index.ts +++ b/src/typings/index.ts @@ -148,4 +148,6 @@ export interface IConfiguration { autoInit?: boolean, useLoader?: boolean, + + sandboxAttributes?: string, } \ No newline at end of file diff --git a/src/widget/chat-frame.tsx b/src/widget/chat-frame.tsx index 6a3a9a4..1f97c7e 100644 --- a/src/widget/chat-frame.tsx +++ b/src/widget/chat-frame.tsx @@ -22,6 +22,7 @@ export default class ChatFrame extends Component { height={isMobile ? '94%' : '100%'} frameBorder='0' allowTransparency + sandbox={config.sandboxAttributes} /> ); } diff --git a/types/botman-extended-web-widget.d.ts b/types/botman-extended-web-widget.d.ts index b858ed4..3c2b711 100644 --- a/types/botman-extended-web-widget.d.ts +++ b/types/botman-extended-web-widget.d.ts @@ -66,6 +66,7 @@ interface Configuration { useShadowDom?: boolean, customStylesInjection?: string, useLoader?: boolean, + sandboxAttributes?: string, } interface BotmanChatWidget {