@linktr.ee/messaging-react 3.31.2 → 3.32.0-rc-1786000762

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-Ct_Jgy8P.cjs");exports.ActionButton=e.ActionButton;exports.Avatar=e.Avatar;exports.ChannelEmptyState=e.ChannelEmptyState;exports.ChannelList=e.ChannelList;exports.ChannelView=e.ChannelView;exports.CustomMessageProvider=e.CustomMessageProvider;exports.FaqList=e.FaqList;exports.FaqListItem=e.FaqListItem;exports.LinkAttachment=e.LinkAttachment;exports.LockedAttachment=e.LockedAttachment;exports.MediaMessage=e.MediaMessage;exports.MessageAttachment=e.MessageAttachment;exports.MessageBubble=e.MessageBubble;exports.MessageVoteButtons=e.MessageVoteButtons;exports.MessagingProvider=e.MessagingProvider;exports.MessagingShell=e.MessagingShell;exports.buildCompactMetaLabel=e.buildCompactMetaLabel;exports.formatFileSize=e.formatFileSize;exports.formatRelativeTime=e.formatRelativeTime;exports.getFileExtensionLabel=e.getFileExtensionLabel;exports.getMessageDisplayText=e.getMessageDisplayText;exports.isLinkAttachment=e.isLinkAttachment;exports.isUuidLike=e.isUuidLike;exports.messageAttachmentGroupPositionFromStream=e.bubbleGroupPositionFromStream;exports.normalizeLanguageCode=e.normalizeLanguageCode;exports.optimizeMessagingAttachmentUrl=e.optimizeMessagingAttachmentUrl;exports.resolveConversationParticipant=e.resolveConversationParticipant;exports.resolveLinkAttachment=e.resolveLinkAttachment;exports.resolveMediaFromMessage=e.resolveMediaFromMessage;exports.resolveParticipantDisplayName=e.resolveParticipantDisplayName;exports.useComposerLocked=e.useComposerLocked;exports.useCustomMessage=e.useCustomMessage;exports.useMessageVote=e.useMessageVote;exports.useMessaging=e.useMessaging;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-C0SNOT_0.cjs");exports.ActionButton=e.ActionButton;exports.Avatar=e.Avatar;exports.ChannelEmptyState=e.ChannelEmptyState;exports.ChannelList=e.ChannelList;exports.ChannelView=e.ChannelView;exports.CustomMessageProvider=e.CustomMessageProvider;exports.FaqList=e.FaqList;exports.FaqListItem=e.FaqListItem;exports.LinkAttachment=e.LinkAttachment;exports.LockedAttachment=e.LockedAttachment;exports.MediaMessage=e.MediaMessage;exports.MessageAttachment=e.MessageAttachment;exports.MessageBubble=e.MessageBubble;exports.MessageVoteButtons=e.MessageVoteButtons;exports.MessagingProvider=e.MessagingProvider;exports.MessagingShell=e.MessagingShell;exports.buildCompactMetaLabel=e.buildCompactMetaLabel;exports.formatFileSize=e.formatFileSize;exports.formatRelativeTime=e.formatRelativeTime;exports.getFileExtensionLabel=e.getFileExtensionLabel;exports.getMessageDisplayText=e.getMessageDisplayText;exports.isLinkAttachment=e.isLinkAttachment;exports.isUuidLike=e.isUuidLike;exports.messageAttachmentGroupPositionFromStream=e.bubbleGroupPositionFromStream;exports.normalizeLanguageCode=e.normalizeLanguageCode;exports.optimizeMessagingAttachmentUrl=e.optimizeMessagingAttachmentUrl;exports.resolveConversationParticipant=e.resolveConversationParticipant;exports.resolveLinkAttachment=e.resolveLinkAttachment;exports.resolveMediaFromMessage=e.resolveMediaFromMessage;exports.resolveParticipantDisplayName=e.resolveParticipantDisplayName;exports.useComposerLocked=e.useComposerLocked;exports.useCustomMessage=e.useCustomMessage;exports.useMessageVote=e.useMessageVote;exports.useMessaging=e.useMessaging;
2
2
  //# sourceMappingURL=index.cjs.map
package/dist/index.d.ts CHANGED
@@ -748,6 +748,17 @@ export declare interface LinkAttachmentCta {
748
748
  href?: string;
749
749
  /** When set, called on click (in addition to `href` navigation if provided). */
750
750
  onClick?: () => void;
751
+ /**
752
+ * Visual emphasis of the CTA button. Defaults to `'primary'` (the filled
753
+ * dark button), so existing callers are unaffected. `'secondary'` renders
754
+ * the subtle/grey button. Orthogonal to the card's sent/received `variant`
755
+ * (which controls bubble side, not button emphasis).
756
+ *
757
+ * NOTE: this is the presentational half only. The wire-format value should
758
+ * ride the shared action contract (see docs/plans/interactive-surfaces-contract.md
759
+ * — `InteractiveAction`), not be re-invented per surface.
760
+ */
761
+ variant?: 'primary' | 'secondary';
751
762
  }
752
763
 
753
764
  /**
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as e, b as t, C as i, c as o, d as n, e as m, F as r, f as g, L as l, h as M, M as c, i as u, j as L, k as h, l as p, m as d, n as v, p as C, q as A, s as k, t as F, u as b, v as P, w as f, x, o as y, y as z, z as B, B as S, D as q, E as D, G as E, H as V, I as w } from "./index-ilHx7pIO.js";
1
+ import { a as e, b as t, C as i, c as o, d as n, e as m, F as r, f as g, L as l, h as M, M as c, i as u, j as L, k as h, l as p, m as d, n as v, p as C, q as A, s as k, t as F, u as b, v as P, w as f, x, o as y, y as z, z as B, B as S, D as q, E as D, G as E, H as V, I as w } from "./index-KC2xnb1K.js";
2
2
  export {
3
3
  e as ActionButton,
4
4
  t as Avatar,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linktr.ee/messaging-react",
3
- "version": "3.31.2",
3
+ "version": "3.32.0-rc-1786000762",
4
4
  "description": "React messaging components built on messaging-core for web applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -50,7 +50,7 @@
50
50
  },
51
51
  "dependencies": {
52
52
  "@linktr.ee/component-library": "11.8.6",
53
- "@linktr.ee/messaging-core": "^2.2.0",
53
+ "@linktr.ee/messaging-core": "2.4.0-rc-1786000762",
54
54
  "@linktr.ee/messaging-taxonomy": "^0.5.1",
55
55
  "@phosphor-icons/react": "^2.1.10"
56
56
  },
@@ -57,6 +57,32 @@ describe('LinkAttachment.Received (link previews)', () => {
57
57
  expect(onClick).toHaveBeenCalledTimes(1)
58
58
  expect(ctaOnClick).toHaveBeenCalledTimes(1)
59
59
  })
60
+
61
+ it('renders the filled (primary) CTA when cta.variant is omitted', async () => {
62
+ renderWithProviders(
63
+ <LinkAttachment.Received
64
+ title="Welcome"
65
+ description="Add a personal welcome message"
66
+ cta={{ label: 'Add now', onClick: vi.fn() }}
67
+ />
68
+ )
69
+ const button = await screen.findByText('Add now')
70
+ expect(button.className).toContain('bg-[#121110]')
71
+ expect(button.className).toContain('text-white')
72
+ })
73
+
74
+ it('renders the subtle (secondary) CTA when cta.variant is "secondary"', async () => {
75
+ renderWithProviders(
76
+ <LinkAttachment.Received
77
+ title="Welcome"
78
+ description="Add a personal welcome message"
79
+ cta={{ label: 'Add now', onClick: vi.fn(), variant: 'secondary' }}
80
+ />
81
+ )
82
+ const button = await screen.findByText('Add now')
83
+ expect(button.className).toContain('bg-black/[0.06]')
84
+ expect(button.className).toContain('text-[#121110]')
85
+ })
60
86
  })
61
87
 
62
88
  describe('LinkAttachment.Sent', () => {
@@ -11,9 +11,24 @@ export interface CardCtaProps {
11
11
  cta: LinkAttachmentCta
12
12
  }
13
13
 
14
- const BUTTON_CLASS_BY_VARIANT: Record<LinkAttachmentVariant, string> = {
15
- dark: 'bg-white text-[#121110] hover:bg-white/90',
16
- light: 'bg-[#121110] text-white hover:bg-[#2a2928]',
14
+ type CtaEmphasis = NonNullable<LinkAttachmentCta['variant']>
15
+
16
+ // Two axes: the bubble side (`dark` = sent chrome, `light` = received chrome)
17
+ // crossed with CTA emphasis (`primary` = filled, `secondary` = subtle/grey).
18
+ // `primary` preserves the existing filled button exactly, so callers that omit
19
+ // `cta.variant` are unaffected. Values are explicit rather than DS tokens: the
20
+ // component-library preset has no neutral button token (`primary` is brand
21
+ // purple), and the host preset can't retheme arbitrary hex. Align the grey with
22
+ // the Arbor secondary token when the shared design tokens land.
23
+ const BUTTON_CLASS_BY_VARIANT: Record<LinkAttachmentVariant, Record<CtaEmphasis, string>> = {
24
+ dark: {
25
+ primary: 'bg-white text-[#121110] hover:bg-white/90',
26
+ secondary: 'bg-white/15 text-white hover:bg-white/25',
27
+ },
28
+ light: {
29
+ primary: 'bg-[#121110] text-white hover:bg-[#2a2928]',
30
+ secondary: 'bg-black/[0.06] text-[#121110] hover:bg-black/10',
31
+ },
17
32
  }
18
33
 
19
34
  /**
@@ -23,9 +38,10 @@ const BUTTON_CLASS_BY_VARIANT: Record<LinkAttachmentVariant, string> = {
23
38
  * plain `<button>`.
24
39
  */
25
40
  const CardCta: React.FC<CardCtaProps> = ({ variant, cta }) => {
41
+ const emphasis: CtaEmphasis = cta.variant ?? 'primary'
26
42
  const className = classNames(
27
43
  'mt-2 inline-flex h-10 w-full items-center justify-center rounded-full px-4 text-sm font-medium leading-none transition-colors',
28
- BUTTON_CLASS_BY_VARIANT[variant]
44
+ BUTTON_CLASS_BY_VARIANT[variant][emphasis]
29
45
  )
30
46
 
31
47
  // Mirror the URL normalization used by the shell anchor so bare
@@ -111,4 +111,15 @@ export interface LinkAttachmentCta {
111
111
  href?: string
112
112
  /** When set, called on click (in addition to `href` navigation if provided). */
113
113
  onClick?: () => void
114
+ /**
115
+ * Visual emphasis of the CTA button. Defaults to `'primary'` (the filled
116
+ * dark button), so existing callers are unaffected. `'secondary'` renders
117
+ * the subtle/grey button. Orthogonal to the card's sent/received `variant`
118
+ * (which controls bubble side, not button emphasis).
119
+ *
120
+ * NOTE: this is the presentational half only. The wire-format value should
121
+ * ride the shared action contract (see docs/plans/interactive-surfaces-contract.md
122
+ * — `InteractiveAction`), not be re-invented per surface.
123
+ */
124
+ variant?: 'primary' | 'secondary'
114
125
  }