-
Notifications
You must be signed in to change notification settings - Fork 304
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: render cta for unsupported content (#2663)
detect and display custom message for unsupported content add a targetUrl for the unsupported content set the message signals for unsupported content set the unsupported content component in Chat --------- Signed-off-by: Musale Martin <[email protected]> Signed-off-by: Martin Musale <[email protected]> Co-authored-by: Gavin Barron <[email protected]>
- Loading branch information
1 parent
74a7608
commit 3c00710
Showing
92 changed files
with
767 additions
and
613 deletions.
There are no files selected for viewing
Binary file renamed
BIN
+147 KB
...dion-npm-9.3.18-9565df4ac4-1a7e56f784.zip → ...dion-npm-9.3.19-a7c9d162c6-e47dae1e1a.zip
Binary file not shown.
Binary file removed
BIN
-45.7 KB
.yarn/cache/@fluentui-react-alert-npm-9.0.0-beta.82-3cc87620d0-5c45e7556b.zip
Binary file not shown.
Binary file added
BIN
+46.4 KB
.yarn/cache/@fluentui-react-alert-npm-9.0.0-beta.83-6b69864e5c-9f40e84613.zip
Binary file not shown.
Binary file renamed
BIN
+36.4 KB
...aria-npm-9.3.39-cf60a3a3dd-163c7a6e3c.zip → ...aria-npm-9.3.40-9796bfae5d-c4c3359ae5.zip
Binary file not shown.
Binary file renamed
BIN
+218 KB
...atar-npm-9.5.36-38fc06a100-d6fbc26661.zip → ...atar-npm-9.5.37-96673be60a-b04fae2c38.zip
Binary file not shown.
Binary file renamed
BIN
+110 KB
...badge-npm-9.2.5-942cd71226-05e0dd59d9.zip → ...badge-npm-9.2.6-cb75e6ddec-35af09dd77.zip
Binary file not shown.
Binary file renamed
BIN
+213 KB
...tton-npm-9.3.45-8300f8ba34-e6c42b4456.zip → ...tton-npm-9.3.46-a06c47c50e-ad507b1880.zip
Binary file not shown.
Binary file renamed
BIN
+145 KB
...card-npm-9.0.44-ba214fe91c-e3974e2276.zip → ...card-npm-9.0.45-48b36360c5-5b27d171dc.zip
Binary file not shown.
Binary file renamed
BIN
+69.8 KB
...kbox-npm-9.1.46-8d7be1bf64-e23123e991.zip → ...kbox-npm-9.1.47-41acd9a885-ab8e70e042.zip
Binary file not shown.
Binary file renamed
BIN
+262 KB
...obox-npm-9.5.20-4df0ca2e09-5d2573b197.zip → ...obox-npm-9.5.21-5eb22900d2-d9cb6d3325.zip
Binary file not shown.
Binary file renamed
BIN
+637 KB
...ents-npm-9.34.0-f8086c6153-da6a82fed0.zip → ...ents-npm-9.34.1-d97f6a3e0d-feb89faeae.zip
Binary file not shown.
Binary file renamed
BIN
+37.2 KB
...ctor-npm-9.1.37-4dd3d16ebc-d870845d6d.zip → ...ctor-npm-9.1.38-9d2a5f4967-9e6c24b96f.zip
Binary file not shown.
Binary file renamed
BIN
+187 KB
...ialog-npm-9.7.5-dc4da535ee-039a39ce84.zip → ...ialog-npm-9.7.6-84f4cab624-5b501075bb.zip
Binary file not shown.
Binary file renamed
BIN
+57.8 KB
...ider-npm-9.2.41-8318002318-3891a3dc0e.zip → ...ider-npm-9.2.42-30334b09cf-0de87b939d.zip
Binary file not shown.
Binary file renamed
BIN
+176 KB
...m-9.0.0-beta.31-3dba309310-59e964f43a.zip → ...m-9.0.0-beta.32-36f18c8a73-22307bbbeb.zip
Binary file not shown.
Binary file renamed
BIN
+62.1 KB
...ield-npm-9.1.33-e362086636-d1054823d3.zip → ...ield-npm-9.1.34-e6933203c8-d7761a3f90.zip
Binary file not shown.
Binary file removed
BIN
-54.4 KB
.yarn/cache/@fluentui-react-image-npm-9.1.38-bad7a4df62-d2e2f99396.zip
Binary file not shown.
Binary file added
BIN
+54.5 KB
.yarn/cache/@fluentui-react-image-npm-9.1.39-2791a0cc96-d0f35884f3.zip
Binary file not shown.
Binary file renamed
BIN
+71.5 KB
...m-9.0.0-beta.66-6e71de8f1d-c33610f0ea.zip → ...m-9.0.0-beta.67-b340125102-1847a6f6b3.zip
Binary file not shown.
Binary file renamed
BIN
+63.2 KB
...nput-npm-9.4.43-6e9c0bb70f-a6674868f7.zip → ...nput-npm-9.4.44-0abb80e700-3ddd99d1bb.zip
Binary file not shown.
Binary file renamed
BIN
+43.8 KB
...time-npm-9.0.13-7fd7191b8c-1f294fd2fc.zip → ...time-npm-9.0.14-382cea5c86-1e0d6aba0f.zip
Binary file not shown.
Binary file removed
BIN
-46.1 KB
.yarn/cache/@fluentui-react-label-npm-9.1.41-0c0d6fbeb6-378f0f846e.zip
Binary file not shown.
Binary file added
BIN
+46.2 KB
.yarn/cache/@fluentui-react-label-npm-9.1.42-7362b37024-5fba56808a.zip
Binary file not shown.
Binary file removed
BIN
-66.2 KB
.yarn/cache/@fluentui-react-link-npm-9.1.24-89dbde48d9-60d0683547.zip
Binary file not shown.
Binary file added
BIN
+66.6 KB
.yarn/cache/@fluentui-react-link-npm-9.1.25-ded6bec215-106bf34e43.zip
Binary file not shown.
Binary file renamed
BIN
+354 KB
...enu-npm-9.12.22-8f2ade1ddf-c8fb947afb.zip → ...enu-npm-9.12.23-8d7006b402-20294e5b2f.zip
Binary file not shown.
Binary file renamed
BIN
+35.1 KB
...view-npm-0.2.10-7bd48220e1-33d7b8e494.zip → ...eview-npm-0.3.0-f12af4b182-b82bea26a7.zip
Binary file not shown.
Binary file renamed
BIN
+66.1 KB
...flow-npm-9.0.36-d79cafe8c6-436cc7d5fd.zip → ...flow-npm-9.0.37-a92dc48111-8a9ec3fc59.zip
Binary file not shown.
Binary file renamed
BIN
+48.4 KB
...sona-npm-9.2.46-d29f6fd3f7-103371ef03.zip → ...sona-npm-9.2.47-d1b5fa4a21-6d08bc93f2.zip
Binary file not shown.
Binary file renamed
BIN
+118 KB
...over-npm-9.8.11-db4426e954-ad81c9fc63.zip → ...over-npm-9.8.12-3305f89f60-1a4bb2a3b7.zip
Binary file not shown.
Binary file renamed
BIN
+65.4 KB
...rtal-npm-9.3.20-9ea4ff80af-15fdaa346d.zip → ...rtal-npm-9.3.21-10b6bf4e59-3a9c3424cf.zip
Binary file not shown.
Binary file renamed
BIN
+162 KB
...ning-npm-9.9.17-d26bc7b58a-232d5847e0.zip → ...ning-npm-9.9.18-0ed7bc7874-d5059cd386.zip
Binary file not shown.
Binary file renamed
BIN
+51.1 KB
...ress-npm-9.1.43-0bef0e4ae6-d1d9254e1d.zip → ...ress-npm-9.1.44-c8a054827b-8efad982fc.zip
Binary file not shown.
Binary file removed
BIN
-83.4 KB
.yarn/cache/@fluentui-react-provider-npm-9.10.3-dc27776712-9bffb65db8.zip
Binary file not shown.
Binary file added
BIN
+84.1 KB
.yarn/cache/@fluentui-react-provider-npm-9.10.4-eea3a9917b-a9c26711ec.zip
Binary file not shown.
Binary file renamed
BIN
+79.8 KB
...adio-npm-9.1.46-94b0613a16-b5df68d9a2.zip → ...adio-npm-9.1.47-a911ca4e72-acb6dac0c6.zip
Binary file not shown.
Binary file renamed
BIN
+56.3 KB
...lect-npm-9.1.43-d6725558c3-f01eb16498.zip → ...lect-npm-9.1.44-0b171de646-8f265924be.zip
Binary file not shown.
Binary file renamed
BIN
+62.3 KB
...eton-npm-9.0.31-defb06bb19-bf59dab2f4.zip → ...eton-npm-9.0.32-74446e586a-3bf28440c0.zip
Binary file not shown.
Binary file renamed
BIN
+84.8 KB
...ider-npm-9.1.46-ff4d1673c4-13c04038f5.zip → ...ider-npm-9.1.47-6b5ad7ecee-fdb2fb1b7d.zip
Binary file not shown.
Binary file renamed
BIN
+85.3 KB
...tton-npm-9.2.43-c97f2f5d9b-93d304cdcf.zip → ...tton-npm-9.2.44-a9e7ae0188-42ead8aec2.zip
Binary file not shown.
Binary file renamed
BIN
+57.4 KB
...nner-npm-9.3.21-a68c04056b-add3759e83.zip → ...nner-npm-9.3.22-2eea95bb26-9ab7e814a3.zip
Binary file not shown.
Binary file renamed
BIN
+60.8 KB
...itch-npm-9.1.46-5c4f4c033c-0e5416a797.zip → ...itch-npm-9.1.47-28952c2d8f-94dd142eab.zip
Binary file not shown.
Binary file renamed
BIN
+475 KB
...able-npm-9.10.1-63ca5975de-1723733bb9.zip → ...able-npm-9.10.2-3794d391f8-f47fcd6b30.zip
Binary file not shown.
Binary file renamed
BIN
+104 KB
...tabs-npm-9.3.47-3d1ff0d64c-2b1d105d08.zip → ...tabs-npm-9.3.48-b0fdfb4d02-9048b3be7c.zip
Binary file not shown.
Binary file renamed
BIN
+106 KB
...ster-npm-9.13.3-b0317dbbd7-b416bdef45.zip → ...ster-npm-9.13.4-5b1baf0557-1f3b0e089d.zip
Binary file not shown.
Binary file renamed
BIN
+164 KB
...-tags-npm-9.0.0-631d4a511b-8847b82bc8.zip → ...-tags-npm-9.0.1-34e4efca9a-7497579aa0.zip
Binary file not shown.
Binary file renamed
BIN
+194 KB
...text-npm-9.3.38-dbc733c397-69b4bf3cc7.zip → ...text-npm-9.3.39-9662d3b80a-523c3b6128.zip
Binary file not shown.
Binary file renamed
BIN
+59.4 KB
...area-npm-9.3.43-588c057977-84353a3591.zip → ...area-npm-9.3.44-6b4dd752a3-85e32142d0.zip
Binary file not shown.
Binary file renamed
BIN
+247 KB
...toast-npm-9.3.7-30937f665c-51adcd8aec.zip → ...toast-npm-9.3.8-8e51f03c1c-63c9ba228c.zip
Binary file not shown.
Binary file renamed
BIN
+136 KB
...lbar-npm-9.1.46-a09b3d00bc-9f2e9f7cb9.zip → ...lbar-npm-9.1.47-4acf61f4a2-7482e8df49.zip
Binary file not shown.
Binary file renamed
BIN
+80.3 KB
...ltip-npm-9.3.12-f0acd1f7e9-ae3118596e.zip → ...ltip-npm-9.3.13-5a05332f25-1e6299700b.zip
Binary file not shown.
Binary file renamed
BIN
+290 KB
...-tree-npm-9.4.1-b77ef6509c-aa8f2dcb13.zip → ...-tree-npm-9.4.2-b0b3d952a5-334a9a93de.zip
Binary file not shown.
Binary file renamed
BIN
+230 KB
...ties-npm-9.14.0-20751ec76f-e2edafb2b3.zip → ...ties-npm-9.14.1-fd9fa5c09c-590eb76f92.zip
Binary file not shown.
Binary file renamed
BIN
+158 KB
...-9.0.0-alpha.47-0252e5d1be-49c05a3243.zip → ...-9.0.0-alpha.48-b2c6204a91-fb794535d0.zip
Binary file not shown.
Binary file renamed
BIN
+2.67 KB
...vkit-npm-16.9.1-6a29eef0f4-0521b6eebb.zip → ...kit-npm-16.10.0-fcd08ec770-92c40138f7.zip
Binary file not shown.
Binary file renamed
BIN
+7.92 KB
...-tao-npm-16.9.1-b138046471-51299a3581.zip → ...tao-npm-16.10.0-c76633addf-a973a9fbed.zip
Binary file not shown.
Binary file renamed
BIN
+64.6 KB
...vkit-npm-16.9.1-36d48cc542-c77ec32e9e.zip → ...kit-npm-16.10.0-8a86522e83-f79f22be16.zip
Binary file not shown.
Binary file renamed
BIN
+3.01 MB
...linux-x64-gnu-npm-16.9.1-e88054ccb6-8.zip → ...inux-x64-gnu-npm-16.10.0-0f7f7e3e4b-8.zip
Binary file not shown.
Binary file renamed
BIN
+14.8 MB
...linux-x64-gnu-npm-1.3.91-d5703afe39-8.zip → ...linux-x64-gnu-npm-1.3.92-c410538fc3-8.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-34.7 KB
.yarn/cache/electron-to-chromium-npm-1.4.541-e99b5ae543-bae6640881.zip
Binary file not shown.
Binary file added
BIN
+34.8 KB
.yarn/cache/electron-to-chromium-npm-1.4.543-f3df5cf527-2691478369.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+10.2 KB
...als-npm-13.22.0-a05c550c84-64af5a0956.zip → ...als-npm-13.23.0-7f02426fd5-194c97cf8d.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+839 KB
...e/nx-npm-16.9.1-1782848b9d-7caf0ed7fc.zip → .../nx-npm-16.10.0-f47ffca030-961b290f65.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+248 KB
...cbot-npm-4.21.1-127aecdb48-c1cdccae01.zip → ...cbot-npm-4.21.2-9a78a02813-5f20c6b63e.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
packages/mgt-chat/src/components/UnsupportedContent/UnsupportedContent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/** | ||
* ------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. | ||
* See License in the project root for license information. | ||
* ------------------------------------------------------------------------------------------- | ||
*/ | ||
import { makeStyles, shorthands } from '@fluentui/react-components'; | ||
import React from 'react'; | ||
import { ArrowSquareUpRight24Regular } from '@fluentui/react-icons'; | ||
|
||
const useStyles = makeStyles({ | ||
container: { | ||
backgroundColor: '#ebebeb', | ||
display: 'flex', | ||
boxShadow: '0px 4px 8px 0px rgba(0, 0, 0, 0.14), 0px 0px 2px 0px rgba(0, 0, 0, 0.12)', | ||
textDecorationLine: 'none', | ||
color: '#424242', | ||
...shorthands.margin('18px', '0px', '8px', '0px'), | ||
...shorthands.borderRadius('6px'), | ||
...shorthands.padding('16px'), | ||
...shorthands.gap('6px'), | ||
':hover': { | ||
backgroundColor: '#fafafa' | ||
}, | ||
':visited': { | ||
color: '#424242' | ||
} | ||
}, | ||
cta: { | ||
fontFamily: 'Segoe UI', | ||
fontSize: '12px', | ||
fontStyle: 'normal', | ||
fontWeight: '400', | ||
lineHeight: '16px', | ||
textDecorationLine: 'none' | ||
} | ||
}); | ||
|
||
interface UnsupportedContentProps { | ||
targetUrl: string; | ||
} | ||
|
||
const UnsupportedContent = (props: UnsupportedContentProps) => { | ||
const styles = useStyles(); | ||
return ( | ||
<a className={styles.container} target="blank" href={props.targetUrl}> | ||
<ArrowSquareUpRight24Regular /> | ||
<p className={styles.cta}>View this message in Microsoft Teams.</p> | ||
</a> | ||
); | ||
}; | ||
|
||
export default UnsupportedContent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
packages/mgt-chat/src/statefulClient/Caching/isConversationCacheEnabled.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
import { CacheService } from '@microsoft/mgt-react'; | ||
|
||
export const isConversationCacheEnabled = (): boolean => | ||
CacheService.config.conversation.isEnabled && CacheService.config.isEnabled; | ||
export const isConversationCacheEnabled = (): boolean => { | ||
const conversation = CacheService.config.conversation; | ||
return conversation.isEnabled && CacheService.config.isEnabled; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { MessageProps, MessageRenderer } from '@azure/communication-react'; | ||
import produce from 'immer'; | ||
import React from 'react'; | ||
import { renderToString } from 'react-dom/server'; | ||
import UnsupportedContent from '../components/UnsupportedContent/UnsupportedContent'; | ||
import { isChatMessage, isGraphChatMessage } from '../utils/types'; | ||
|
||
/** | ||
* Renders the preferred content depending on whether it is supported. | ||
* | ||
* @param messageProps final message values from the state. | ||
* @param defaultOnRender default component to render content. | ||
* @returns | ||
*/ | ||
const onRenderMessage = (messageProps: MessageProps, defaultOnRender?: MessageRenderer) => { | ||
const message = messageProps?.message; | ||
if (isGraphChatMessage(message) && message?.hasUnsupportedContent) { | ||
const unsupportedContentComponent = <UnsupportedContent targetUrl={message.rawChatUrl} />; | ||
messageProps = produce(messageProps, (draft: MessageProps) => { | ||
if (isChatMessage(draft.message)) { | ||
draft.message.content = renderToString(unsupportedContentComponent); | ||
} | ||
}); | ||
} | ||
|
||
return defaultOnRender ? defaultOnRender(messageProps) : <></>; | ||
}; | ||
export { onRenderMessage }; |
Oops, something went wrong.