@@ -11,6 +11,7 @@ import {
1111import { Duplicate } from '@sim/emcn/icons'
1212import { LinkedInIcon , xIcon as XIcon } from '@/components/icons'
1313import { buildLinkedInPostUrl , buildXShareUrl } from '@/lib/social-share'
14+ import { useBrandConfig } from '@/ee/whitelabeling'
1415
1516interface ShareLinkButtonProps {
1617 /** The resource name, shown in the composed post. */
@@ -25,21 +26,29 @@ interface ShareLinkButtonProps {
2526 * menu to copy the page link or post it to X / LinkedIn with a pre-drafted
2627 * message ("Check out my {brand} {kind}! / {name} / {link}").
2728 *
28- * The brand mention differs by platform: X gets `@simdotai`, which the tweet
29+ * The mention is brand-aware. On a whitelabeled instance every mention is
30+ * `brand.name`, so an outbound post from a customer's public chat or shared file
31+ * never advertises Sim — the same rule the email footer applies via
32+ * `brand.isWhitelabeled`. This surface renders under {@link Navbar}'s `actions`
33+ * slot, which is deliberately NOT gated by `hideBrand` (that hides only the
34+ * wordmark), so the mention has to carry the whitelabel rule itself.
35+ *
36+ * Unbranded, the mention differs by platform: X gets `@simdotai`, which the tweet
2937 * intent renders as a real tag; LinkedIn cannot create `@`-mentions from a share
3038 * URL (its composer treats `text` as literal — a real mention only exists as an
31- * org URN created live in the composer or via the API), so it uses plain "Sim" to
32- * avoid a dead "@simdotai". LinkedIn also uses the feed composer, not
33- * `share-offsite`, which can't pre-fill text. The X and LinkedIn glyphs are
39+ * org URN created live in the composer or via the API), so it uses the plain
40+ * brand name to avoid a dead "@simdotai". LinkedIn also uses the feed composer,
41+ * not `share-offsite`, which can't pre-fill text. The X and LinkedIn glyphs are
3442 * `currentColor`, so they follow the menu item's text color; these surfaces are
3543 * pinned light by the theme provider (`forcedTheme`), so the portalled menu
3644 * resolves light tokens to match.
3745 */
3846export function ShareLinkButton ( { title, kind } : ShareLinkButtonProps ) {
47+ const brand = useBrandConfig ( )
3948 const { copied, copy } = useCopyToClipboard ( { resetMs : 1500 } )
4049
41- const composePost = ( brand : string ) =>
42- `Check out my ${ brand } ${ kind } !\n\n${ title } : ${ window . location . href } `
50+ const composePost = ( mention : string ) =>
51+ `Check out my ${ mention } ${ kind } !\n\n${ title } : ${ window . location . href } `
4352
4453 const openShare = ( url : string ) => {
4554 window . open ( url , '_blank' , 'noopener,noreferrer' )
@@ -57,11 +66,15 @@ export function ShareLinkButton({ title, kind }: ShareLinkButtonProps) {
5766 < Duplicate />
5867 { copied ? 'Copied!' : 'Copy link' }
5968 </ DropdownMenuItem >
60- < DropdownMenuItem onSelect = { ( ) => openShare ( buildXShareUrl ( composePost ( '@simdotai' ) ) ) } >
69+ < DropdownMenuItem
70+ onSelect = { ( ) =>
71+ openShare ( buildXShareUrl ( composePost ( brand . isWhitelabeled ? brand . name : '@simdotai' ) ) )
72+ }
73+ >
6174 < XIcon />
6275 Post on X
6376 </ DropdownMenuItem >
64- < DropdownMenuItem onSelect = { ( ) => openShare ( buildLinkedInPostUrl ( composePost ( 'Sim' ) ) ) } >
77+ < DropdownMenuItem onSelect = { ( ) => openShare ( buildLinkedInPostUrl ( composePost ( brand . name ) ) ) } >
6578 < LinkedInIcon />
6679 Post on LinkedIn
6780 </ DropdownMenuItem >
0 commit comments