File tree Expand file tree Collapse file tree 4 files changed +10
-6
lines changed
Expand file tree Collapse file tree 4 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ type WebChatThemeProps = Readonly<{
77 readonly children ?: ReactNode | undefined ;
88} > ;
99
10- const styles = createStyles ( ) ;
10+ const styles = createStyles ( 'component' ) ;
1111
1212function WebChatTheme ( { children } : WebChatThemeProps ) {
1313 return < ThemeProvider styles = { styles } > { children } </ ThemeProvider > ;
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ type WebChatThemeProps = Readonly<{
77 readonly children ?: ReactNode | undefined ;
88} > ;
99
10- const styles = createStyles ( ) ;
10+ const styles = createStyles ( 'component/decorator' ) ;
1111
1212function WebChatTheme ( { children } : WebChatThemeProps ) {
1313 return < ThemeProvider styles = { styles } > { children } </ ThemeProvider > ;
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ const decoratorMiddleware: readonly DecoratorMiddleware[] = Object.freeze([
6262 : next ( request ) ) satisfies DecoratorMiddlewareTypes [ 'activity border' ] )
6363] ) ;
6464
65- const styles = createStyles ( ) ;
65+ const styles = createStyles ( 'fluent-theme' ) ;
6666
6767const fluentStyleOptions : StyleOptions = Object . freeze ( {
6868 feedbackActionsPlacement : 'activity-actions'
Original file line number Diff line number Diff line change 1- function createStyle ( content : string ) {
1+ function createStyle ( content : string , origin ?: string ) {
22 const style = document . createElement ( 'style' ) ;
33
44 style . append ( document . createTextNode ( content ) ) ;
55
6+ if ( origin ) {
7+ style . dataset [ 'webchatInjected' ] = origin ;
8+ }
9+
610 return style ;
711}
812
913export default function makeCreateStyles ( ...contents : string [ ] ) {
10- return function createStyles ( ) {
14+ return function createStyles ( origin ?: string ) {
1115 if ( ! globalThis . document ) {
1216 throw new Error ( 'Unable to create styles: document is not defined' ) ;
1317 }
1418
15- return contents . map ( content => createStyle ( content ) ) ;
19+ return contents . map ( content => createStyle ( content , origin ) ) ;
1620 } ;
1721}
You can’t perform that action at this time.
0 commit comments