Skip to content

Commit bfd5f2d

Browse files
committed
Remove nonce requirement
1 parent b890931 commit bfd5f2d

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

packages/component/src/decorator/private/WebChatDecorator.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ import {
66
type DecoratorMiddleware
77
} from 'botframework-webchat-api/decorator';
88
import React, { memo } from 'react';
9-
import { object, optional, pipe, readonly, string, undefinedable, type InferInput } from 'valibot';
9+
import { object, optional, pipe, readonly, type InferInput } from 'valibot';
1010

11+
import useNonce from '../../hooks/internal/useNonce';
1112
import BorderFlair from './BorderFlair';
1213
import BorderLoader from './BorderLoader';
1314
import InjectDecoratorCSS from './InjectDecoratorCSS';
@@ -31,17 +32,17 @@ const middleware: readonly DecoratorMiddleware[] = Object.freeze([
3132

3233
const webChatDecoratorPropsSchema = pipe(
3334
object({
34-
children: optional(reactNode()),
35-
// Intentionally undefinedable() instead of optional() to remind caller they should pass nonce.
36-
nonce: undefinedable(string())
35+
children: optional(reactNode())
3736
}),
3837
readonly()
3938
);
4039

4140
type WebChatDecoratorProps = InferInput<typeof webChatDecoratorPropsSchema>;
4241

4342
function WebChatDecorator(props: WebChatDecoratorProps) {
44-
const { children, nonce } = validateProps(webChatDecoratorPropsSchema, props);
43+
const { children } = validateProps(webChatDecoratorPropsSchema, props);
44+
45+
const [nonce] = useNonce();
4546

4647
return (
4748
<InjectDecoratorCSS nonce={nonce}>

packages/fluent-theme/src/private/FluentThemeProvider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ function FluentThemeProvider(props: FluentThemeProviderProps) {
107107
typingIndicatorMiddleware={typingIndicatorMiddleware}
108108
>
109109
<AssetComposer>
110-
<WebChatDecorator nonce={nonce}>
110+
<WebChatDecorator>
111111
<DecoratorComposer middleware={decoratorMiddleware}>{children}</DecoratorComposer>
112112
</WebChatDecorator>
113113
</AssetComposer>

0 commit comments

Comments
 (0)