@linktr.ee/messaging-react 3.31.0 → 3.31.1-rc-1785925240
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.d.ts
CHANGED
|
@@ -1786,32 +1786,13 @@ declare module 'stream-chat' {
|
|
|
1786
1786
|
*/
|
|
1787
1787
|
accent_color?: string;
|
|
1788
1788
|
}
|
|
1789
|
-
interface CustomChannelData {
|
|
1789
|
+
interface CustomChannelData extends LinktreeChannelData {
|
|
1790
1790
|
/**
|
|
1791
|
-
* Whether
|
|
1792
|
-
*
|
|
1793
|
-
|
|
1794
|
-
has_visitor_message?: boolean;
|
|
1795
|
-
/**
|
|
1796
|
-
* Priority score assigned by backend classification for spotlighting.
|
|
1797
|
-
*/
|
|
1798
|
-
priority_score?: number;
|
|
1799
|
-
/**
|
|
1800
|
-
* Indicates a paid message is pending creator reply.
|
|
1801
|
-
*/
|
|
1802
|
-
pending_earn_message_reply?: boolean;
|
|
1803
|
-
/**
|
|
1804
|
-
* Indicates DM agent has deferred and creator follow-up is needed.
|
|
1805
|
-
*/
|
|
1806
|
-
agent_deferred?: boolean;
|
|
1807
|
-
/**
|
|
1808
|
-
* Whether DM agent auto-replies are paused for this channel.
|
|
1791
|
+
* Whether DM agent auto-replies are paused for this channel. Writer-only
|
|
1792
|
+
* field not read by other clients, so it stays local rather than in the
|
|
1793
|
+
* shared {@link LinktreeChannelData} contract.
|
|
1809
1794
|
*/
|
|
1810
1795
|
chatbot_paused?: boolean;
|
|
1811
|
-
/**
|
|
1812
|
-
* Customer classification tag for this conversation (e.g. CUSTOMER_PAID).
|
|
1813
|
-
*/
|
|
1814
|
-
customer_tag?: string;
|
|
1815
1796
|
}
|
|
1816
1797
|
interface CustomMemberData {
|
|
1817
1798
|
/**
|
|
@@ -1819,7 +1800,7 @@ declare module 'stream-chat' {
|
|
|
1819
1800
|
*/
|
|
1820
1801
|
is_follower?: boolean;
|
|
1821
1802
|
}
|
|
1822
|
-
interface CustomMessageData {
|
|
1803
|
+
interface CustomMessageData extends LinktreeMessageData {
|
|
1823
1804
|
/**
|
|
1824
1805
|
* Message metadata from backend.
|
|
1825
1806
|
* Contains type and payment information.
|
package/dist/testing.d.ts
CHANGED
|
@@ -124,32 +124,13 @@ declare module 'stream-chat' {
|
|
|
124
124
|
*/
|
|
125
125
|
accent_color?: string;
|
|
126
126
|
}
|
|
127
|
-
interface CustomChannelData {
|
|
127
|
+
interface CustomChannelData extends LinktreeChannelData {
|
|
128
128
|
/**
|
|
129
|
-
* Whether
|
|
130
|
-
*
|
|
131
|
-
|
|
132
|
-
has_visitor_message?: boolean;
|
|
133
|
-
/**
|
|
134
|
-
* Priority score assigned by backend classification for spotlighting.
|
|
135
|
-
*/
|
|
136
|
-
priority_score?: number;
|
|
137
|
-
/**
|
|
138
|
-
* Indicates a paid message is pending creator reply.
|
|
139
|
-
*/
|
|
140
|
-
pending_earn_message_reply?: boolean;
|
|
141
|
-
/**
|
|
142
|
-
* Indicates DM agent has deferred and creator follow-up is needed.
|
|
143
|
-
*/
|
|
144
|
-
agent_deferred?: boolean;
|
|
145
|
-
/**
|
|
146
|
-
* Whether DM agent auto-replies are paused for this channel.
|
|
129
|
+
* Whether DM agent auto-replies are paused for this channel. Writer-only
|
|
130
|
+
* field not read by other clients, so it stays local rather than in the
|
|
131
|
+
* shared {@link LinktreeChannelData} contract.
|
|
147
132
|
*/
|
|
148
133
|
chatbot_paused?: boolean;
|
|
149
|
-
/**
|
|
150
|
-
* Customer classification tag for this conversation (e.g. CUSTOMER_PAID).
|
|
151
|
-
*/
|
|
152
|
-
customer_tag?: string;
|
|
153
134
|
}
|
|
154
135
|
interface CustomMemberData {
|
|
155
136
|
/**
|
|
@@ -157,7 +138,7 @@ declare module 'stream-chat' {
|
|
|
157
138
|
*/
|
|
158
139
|
is_follower?: boolean;
|
|
159
140
|
}
|
|
160
|
-
interface CustomMessageData {
|
|
141
|
+
interface CustomMessageData extends LinktreeMessageData {
|
|
161
142
|
/**
|
|
162
143
|
* Message metadata from backend.
|
|
163
144
|
* Contains type and payment information.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linktr.ee/messaging-react",
|
|
3
|
-
"version": "3.31.
|
|
3
|
+
"version": "3.31.1-rc-1785925240",
|
|
4
4
|
"description": "React messaging components built on messaging-core for web applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@linktr.ee/component-library": "11.8.6",
|
|
53
|
-
"@linktr.ee/messaging-core": "
|
|
54
|
-
"@linktr.ee/messaging-taxonomy": "^0.5.
|
|
53
|
+
"@linktr.ee/messaging-core": "2.4.0-rc-1785925240",
|
|
54
|
+
"@linktr.ee/messaging-taxonomy": "^0.5.1",
|
|
55
55
|
"@phosphor-icons/react": "^2.1.10",
|
|
56
56
|
"culori": "^4.0.2"
|
|
57
57
|
},
|
|
@@ -7,6 +7,10 @@ import {
|
|
|
7
7
|
import type { Meta, StoryFn } from '@storybook/react'
|
|
8
8
|
import React from 'react'
|
|
9
9
|
|
|
10
|
+
import { accentSurface } from './components/_shared/accentSurface'
|
|
11
|
+
import type { LinkAttachmentVariant } from './components/_shared/CardShell'
|
|
12
|
+
import { BUBBLE_BG_BY_VARIANT, inkFor } from './components/_shared/chinContrast'
|
|
13
|
+
|
|
10
14
|
import LinkAttachment from '.'
|
|
11
15
|
|
|
12
16
|
const IMAGE_THUMBNAIL = '/image-thumbnail.jpg'
|
|
@@ -451,3 +455,102 @@ export const AccentWithoutVisibleHero: StoryFn = () => (
|
|
|
451
455
|
)
|
|
452
456
|
|
|
453
457
|
AccentWithoutVisibleHero.parameters = { chromatic: { disableSnapshot: false } }
|
|
458
|
+
|
|
459
|
+
/* ──────────────────────────────────────────────────────────────────
|
|
460
|
+
Accent derivation swatches
|
|
461
|
+
────────────────────────────────────────────────────────────────── */
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* Max-chroma sRGB colour for a hue — three phase-shifted cosines, so stepping
|
|
465
|
+
* the hue walks the wheel at the most saturated triple each hue has. Mirrors
|
|
466
|
+
* the generator `accentSurface.test.ts` sweeps.
|
|
467
|
+
*/
|
|
468
|
+
const vividHex = (hue: number): string =>
|
|
469
|
+
`#${[0, 120, 240]
|
|
470
|
+
.map((offset) =>
|
|
471
|
+
Math.round(127 + 127 * Math.cos(((hue + offset) * Math.PI) / 180))
|
|
472
|
+
.toString(16)
|
|
473
|
+
.padStart(2, '0')
|
|
474
|
+
)
|
|
475
|
+
.join('')}`
|
|
476
|
+
|
|
477
|
+
const HUE_SWEEP = Array.from({ length: 24 }, (_, i) => ({
|
|
478
|
+
label: `${i * 15}°`,
|
|
479
|
+
accentColor: vividHex(i * 15),
|
|
480
|
+
}))
|
|
481
|
+
|
|
482
|
+
// Neutrals and near-limits where the AA gate and the ink flip actually decide
|
|
483
|
+
// something, plus the two inputs that must never derive a surface.
|
|
484
|
+
const EDGE_SAMPLES: Array<{ label: string; accentColor?: string }> = [
|
|
485
|
+
{ label: 'mock #738883', accentColor: '#738883' },
|
|
486
|
+
{ label: 'pale #FFF099', accentColor: '#FFF099' },
|
|
487
|
+
{ label: 'near-white #FCF5E3', accentColor: '#FCF5E3' },
|
|
488
|
+
{ label: 'near-black #1e2330', accentColor: '#1e2330' },
|
|
489
|
+
{ label: 'neutral #767676', accentColor: '#767676' },
|
|
490
|
+
{ label: 'vivid #7008E7', accentColor: '#7008E7' },
|
|
491
|
+
{ label: 'none', accentColor: undefined },
|
|
492
|
+
{ label: 'malformed', accentColor: 'rebeccapurple' },
|
|
493
|
+
]
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* One derivation cell: the surface the card would paint for this accent and
|
|
497
|
+
* variant, drawn in the ink `inkFor` picks against it. `accentSurface` and
|
|
498
|
+
* `inkFor` are the only outputs `culori` feeds into the card, so this paints
|
|
499
|
+
* exactly what a colour-library swap could move — with the resolved hex printed
|
|
500
|
+
* so a shift also reads as a text diff. A refused accent shows the variant's
|
|
501
|
+
* fallback fill, tagged.
|
|
502
|
+
*/
|
|
503
|
+
const DerivedSwatch = ({
|
|
504
|
+
accentColor,
|
|
505
|
+
variant,
|
|
506
|
+
}: {
|
|
507
|
+
accentColor?: string
|
|
508
|
+
variant: LinkAttachmentVariant
|
|
509
|
+
}) => {
|
|
510
|
+
const surface = accentSurface(accentColor, variant)
|
|
511
|
+
const painted = surface ?? BUBBLE_BG_BY_VARIANT[variant]
|
|
512
|
+
return (
|
|
513
|
+
<div
|
|
514
|
+
className="flex h-12 flex-col justify-between rounded-md px-2 py-1.5 text-[11px] font-medium"
|
|
515
|
+
style={{ backgroundColor: painted, color: inkFor(painted) }}
|
|
516
|
+
>
|
|
517
|
+
<span>Yoga on Ice</span>
|
|
518
|
+
<span className="font-mono opacity-80">
|
|
519
|
+
{surface ?? `fallback ${painted}`}
|
|
520
|
+
</span>
|
|
521
|
+
</div>
|
|
522
|
+
)
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
const GridHead = ({ children }: { children: React.ReactNode }) => (
|
|
526
|
+
<div className="text-xs font-medium text-black/40">{children}</div>
|
|
527
|
+
)
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* Isolates the colour maths behind the accent chin: for every hue at maximum
|
|
531
|
+
* chroma and every neutral/edge input, the `dark` (Sent) and `light` (Received)
|
|
532
|
+
* surfaces `accentSurface` derives, each in the ink `inkFor` returns for it.
|
|
533
|
+
* One snapshot, no hero pixels — a dense visual companion to the
|
|
534
|
+
* `accentSurface` hue-sweep unit test, so any drift in the derivation shows up
|
|
535
|
+
* as both a colour change and a hex text diff across adjacent rows.
|
|
536
|
+
*/
|
|
537
|
+
export const AccentDerivation: StoryFn = () => (
|
|
538
|
+
<div className="min-h-screen w-full bg-[#F9F7F4] p-8">
|
|
539
|
+
<div className="grid grid-cols-[6rem_1fr_1fr] items-center gap-x-4 gap-y-1.5">
|
|
540
|
+
<div />
|
|
541
|
+
<GridHead>Sent (dark stop)</GridHead>
|
|
542
|
+
<GridHead>Received (light stop)</GridHead>
|
|
543
|
+
{[...HUE_SWEEP, ...EDGE_SAMPLES].map(({ label, accentColor }) => (
|
|
544
|
+
<React.Fragment key={label}>
|
|
545
|
+
<div className="text-right text-xs font-medium text-black/40">
|
|
546
|
+
{label}
|
|
547
|
+
</div>
|
|
548
|
+
<DerivedSwatch accentColor={accentColor} variant="dark" />
|
|
549
|
+
<DerivedSwatch accentColor={accentColor} variant="light" />
|
|
550
|
+
</React.Fragment>
|
|
551
|
+
))}
|
|
552
|
+
</div>
|
|
553
|
+
</div>
|
|
554
|
+
)
|
|
555
|
+
|
|
556
|
+
AccentDerivation.parameters = { chromatic: { disableSnapshot: false } }
|
|
@@ -18,6 +18,8 @@ import {
|
|
|
18
18
|
type DmAgentSystemType,
|
|
19
19
|
type AgeSafetySystemType,
|
|
20
20
|
type EscalationSystemType,
|
|
21
|
+
type LinktreeChannelData,
|
|
22
|
+
type LinktreeMessageData,
|
|
21
23
|
} from '@linktr.ee/messaging-taxonomy'
|
|
22
24
|
import type { Attachment, LocalMessage } from 'stream-chat'
|
|
23
25
|
import 'stream-chat'
|
|
@@ -93,32 +95,13 @@ declare module 'stream-chat' {
|
|
|
93
95
|
accent_color?: string
|
|
94
96
|
}
|
|
95
97
|
|
|
96
|
-
interface CustomChannelData {
|
|
98
|
+
interface CustomChannelData extends LinktreeChannelData {
|
|
97
99
|
/**
|
|
98
|
-
* Whether
|
|
99
|
-
*
|
|
100
|
-
|
|
101
|
-
has_visitor_message?: boolean
|
|
102
|
-
/**
|
|
103
|
-
* Priority score assigned by backend classification for spotlighting.
|
|
104
|
-
*/
|
|
105
|
-
priority_score?: number
|
|
106
|
-
/**
|
|
107
|
-
* Indicates a paid message is pending creator reply.
|
|
108
|
-
*/
|
|
109
|
-
pending_earn_message_reply?: boolean
|
|
110
|
-
/**
|
|
111
|
-
* Indicates DM agent has deferred and creator follow-up is needed.
|
|
112
|
-
*/
|
|
113
|
-
agent_deferred?: boolean
|
|
114
|
-
/**
|
|
115
|
-
* Whether DM agent auto-replies are paused for this channel.
|
|
100
|
+
* Whether DM agent auto-replies are paused for this channel. Writer-only
|
|
101
|
+
* field not read by other clients, so it stays local rather than in the
|
|
102
|
+
* shared {@link LinktreeChannelData} contract.
|
|
116
103
|
*/
|
|
117
104
|
chatbot_paused?: boolean
|
|
118
|
-
/**
|
|
119
|
-
* Customer classification tag for this conversation (e.g. CUSTOMER_PAID).
|
|
120
|
-
*/
|
|
121
|
-
customer_tag?: string
|
|
122
105
|
}
|
|
123
106
|
|
|
124
107
|
interface CustomMemberData {
|
|
@@ -128,7 +111,7 @@ declare module 'stream-chat' {
|
|
|
128
111
|
is_follower?: boolean
|
|
129
112
|
}
|
|
130
113
|
|
|
131
|
-
interface CustomMessageData {
|
|
114
|
+
interface CustomMessageData extends LinktreeMessageData {
|
|
132
115
|
/**
|
|
133
116
|
* Message metadata from backend.
|
|
134
117
|
* Contains type and payment information.
|