66 type DecoratorMiddleware
77} from 'botframework-webchat-api/decorator' ;
88import 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' ;
1112import BorderFlair from './BorderFlair' ;
1213import BorderLoader from './BorderLoader' ;
1314import InjectDecoratorCSS from './InjectDecoratorCSS' ;
@@ -31,17 +32,17 @@ const middleware: readonly DecoratorMiddleware[] = Object.freeze([
3132
3233const 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
4140type WebChatDecoratorProps = InferInput < typeof webChatDecoratorPropsSchema > ;
4241
4342function 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 } >
0 commit comments