@linktr.ee/messaging-react 1.27.0 → 1.28.0-rc-1776231821

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.
Files changed (57) hide show
  1. package/dist/Creator-BFpHsh2u.js +318 -0
  2. package/dist/Creator-BFpHsh2u.js.map +1 -0
  3. package/dist/MediaPlayer-DXz4IBLx.js +313 -0
  4. package/dist/MediaPlayer-DXz4IBLx.js.map +1 -0
  5. package/dist/Visitor-C1Fcrgd6.js +199 -0
  6. package/dist/Visitor-C1Fcrgd6.js.map +1 -0
  7. package/dist/assets/index.css +1 -1
  8. package/dist/index.d.ts +13 -16
  9. package/dist/index.js +27 -35
  10. package/dist/index.js.map +1 -1
  11. package/package.json +1 -2
  12. package/src/components/CustomMessage/CustomMessage.stories.tsx +1 -1
  13. package/src/components/CustomMessage/index.tsx +0 -1
  14. package/src/components/LockedAttachment/LockedAttachment.stories.tsx +143 -49
  15. package/src/components/LockedAttachment/components/Creator.tsx +406 -114
  16. package/src/components/LockedAttachment/components/MediaPlayer.tsx +162 -80
  17. package/src/components/LockedAttachment/components/Visitor.tsx +205 -145
  18. package/src/components/LockedAttachment/index.tsx +7 -7
  19. package/src/components/LockedAttachment/types.ts +1 -5
  20. package/src/components/LockedAttachment/utils/icons.ts +2 -1
  21. package/src/components/LockedAttachment/utils/mimeType.test.ts +29 -7
  22. package/src/components/LockedAttachment/utils/mimeType.ts +3 -1
  23. package/src/types.ts +0 -1
  24. package/dist/Creator-B6M8dB0U.js +0 -87
  25. package/dist/Creator-B6M8dB0U.js.map +0 -1
  26. package/dist/MediaPlayer-DsjlYGGH.js +0 -539
  27. package/dist/MediaPlayer-DsjlYGGH.js.map +0 -1
  28. package/dist/Preview-DqAv16NS.js +0 -87
  29. package/dist/Preview-DqAv16NS.js.map +0 -1
  30. package/dist/Visitor-CpmFZRGO.js +0 -175
  31. package/dist/Visitor-CpmFZRGO.js.map +0 -1
  32. package/dist/dash.all.min-Duv4lvGS.js +0 -18858
  33. package/dist/dash.all.min-Duv4lvGS.js.map +0 -1
  34. package/dist/hls-Bogc7CBn.js +0 -21710
  35. package/dist/hls-Bogc7CBn.js.map +0 -1
  36. package/dist/index-Da-xN4Yq.js +0 -16142
  37. package/dist/index-Da-xN4Yq.js.map +0 -1
  38. package/dist/index-Dj9rqWcU.js +0 -69
  39. package/dist/index-Dj9rqWcU.js.map +0 -1
  40. package/dist/mixin-B6jYfIcp.js +0 -808
  41. package/dist/mixin-B6jYfIcp.js.map +0 -1
  42. package/dist/react-BxlQMOfz.js +0 -419
  43. package/dist/react-BxlQMOfz.js.map +0 -1
  44. package/dist/react-COAP-MIW.js +0 -377
  45. package/dist/react-COAP-MIW.js.map +0 -1
  46. package/dist/react-Cn4WlMcl.js +0 -3108
  47. package/dist/react-Cn4WlMcl.js.map +0 -1
  48. package/dist/react-CwTJArKY.js +0 -459
  49. package/dist/react-CwTJArKY.js.map +0 -1
  50. package/dist/react-DkfS_atT.js +0 -373
  51. package/dist/react-DkfS_atT.js.map +0 -1
  52. package/dist/react-Pea5fum1.js +0 -286
  53. package/dist/react-Pea5fum1.js.map +0 -1
  54. package/dist/react-RiBbsUDd.js +0 -534
  55. package/dist/react-RiBbsUDd.js.map +0 -1
  56. package/dist/react-dS1WBxxz.js +0 -238
  57. package/dist/react-dS1WBxxz.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -230,9 +230,10 @@ export declare interface ChannelViewProps {
230
230
  }
231
231
 
232
232
  declare interface CreatorCardProps extends LockedAttachmentBaseProps {
233
- title?: string;
233
+ isPreview?: boolean;
234
234
  placeholderTitle?: string;
235
235
  placeholderAmountText?: string;
236
+ onDismiss?: () => void;
236
237
  }
237
238
 
238
239
  declare type DmAgentSystemType = 'SYSTEM_DM_AGENT_PAUSED' | 'SYSTEM_DM_AGENT_RESUMED';
@@ -274,29 +275,20 @@ export declare const formatRelativeTime: (date: Date) => string;
274
275
 
275
276
  export declare const LockedAttachment: (props: LockedAttachmentProps) => JSX_2.Element;
276
277
 
277
- /** Shared fields for creator and visitor locked-attachment cards (internal). */
278
278
  declare interface LockedAttachmentBaseProps {
279
+ title?: string;
279
280
  mimeType?: string;
280
- /** Blurred preview image shown in the locked/collapsed state. */
281
281
  thumbnail?: string;
282
- /** Clean poster image passed to the media player. Falls back to thumbnail. */
283
- poster?: string;
284
- /** Unlocked media URL. Undefined while locked or pending unlock. */
285
282
  source?: string;
286
283
  detail?: string;
287
284
  amountText?: string;
288
285
  paymentStatus?: PaymentStatus;
289
286
  }
290
287
 
291
- export declare type LockedAttachmentProps = ({
292
- isCreator: true;
293
- } & CreatorCardProps) | ({
294
- isCreator?: false;
295
- } & VisitorCardProps);
288
+ export declare type LockedAttachmentProps = (CreatorCardProps & Never<VisitorCardProps, 'onUnlock' | 'onDownload'>) | (VisitorCardProps & Never<CreatorCardProps, 'isPreview' | 'placeholderTitle' | 'placeholderAmountText' | 'onDismiss'>);
296
289
 
297
290
  export declare interface LockedAttachmentSource {
298
291
  source: string;
299
- poster?: string;
300
292
  }
301
293
 
302
294
  declare type MessageCustomType = 'MESSAGE_TIP' | 'MESSAGE_PAID' | 'MESSAGE_CHATBOT' | 'MESSAGE_ATTACHMENT' | AgeSafetySystemType | DmAgentSystemType;
@@ -428,6 +420,10 @@ export declare interface MessagingShellProps extends ChannelViewPassthroughProps
428
420
  renderMessagePreview?: (message: LocalMessage | undefined, defaultPreview?: string) => React.ReactNode;
429
421
  }
430
422
 
423
+ declare type Never<T, K extends keyof T = keyof T> = {
424
+ [P in K]?: never;
425
+ };
426
+
431
427
  /**
432
428
  * Generic participant interface for different host environments
433
429
  */
@@ -522,14 +518,15 @@ export declare const useParticipants: (participantSource: ParticipantSource, opt
522
518
  };
523
519
 
524
520
  declare interface VisitorCardProps extends LockedAttachmentBaseProps {
525
- title?: string;
526
521
  /**
527
- * Called when the visitor clicks Unlock. Return the resolved source and optional poster.
528
- * The component manages loading state and sets source/poster internally on resolution.
522
+ * Called when the visitor clicks Unlock. Return the resolved source URL.
523
+ * The component manages loading state and sets source internally on resolution.
529
524
  * Omit to hide the Unlock button.
530
525
  */
531
526
  onUnlock?: () => Promise<LockedAttachmentSource>;
532
- /** Called when the visitor clicks Download on an unlocked card. */
527
+ /**
528
+ * Called when the visitor clicks Download on an unlocked card.
529
+ */
533
530
  onDownload?: () => void;
534
531
  }
535
532
 
package/dist/index.js CHANGED
@@ -620,7 +620,7 @@ const bs = ({
620
620
  customProfileContent: N,
621
621
  customChannelActions: S
622
622
  }) => {
623
- var D, $, z, ee, le, ie, ce;
623
+ var D, G, z, ee, le, ie, ce;
624
624
  const { service: m, debug: I } = Me(), [o, v] = T(!1), [k, y] = T(!1), [w, _] = T(!1), R = U(async () => {
625
625
  var A;
626
626
  if (!(!m || !((A = n == null ? void 0 : n.user) != null && A.id)))
@@ -687,7 +687,7 @@ const bs = ({
687
687
  );
688
688
  };
689
689
  if (!n) return null;
690
- const C = (($ = n.user) == null ? void 0 : $.name) || ((z = n.user) == null ? void 0 : z.id) || "Unknown member", p = (ee = n.user) == null ? void 0 : ee.image, O = (le = n.user) == null ? void 0 : le.email, q = (ie = n.user) == null ? void 0 : ie.username, Z = O || (q ? `linktr.ee/${q}` : void 0), Q = ((ce = n.user) == null ? void 0 : ce.id) || "unknown";
690
+ const C = ((G = n.user) == null ? void 0 : G.name) || ((z = n.user) == null ? void 0 : z.id) || "Unknown member", p = (ee = n.user) == null ? void 0 : ee.image, O = (le = n.user) == null ? void 0 : le.email, q = (ie = n.user) == null ? void 0 : ie.username, Z = O || (q ? `linktr.ee/${q}` : void 0), Q = ((ce = n.user) == null ? void 0 : ce.id) || "unknown";
691
691
  return (
692
692
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
693
693
  /* @__PURE__ */ e(
@@ -821,20 +821,13 @@ function ps(t) {
821
821
  }, [s, n == null ? void 0 : n.userID, t.id, r]);
822
822
  return { selected: r, voteUp: l, voteDown: d };
823
823
  }
824
- const ys = F.lazy(() => import("./Creator-B6M8dB0U.js")), vs = F.lazy(() => import("./Visitor-CpmFZRGO.js")), Ze = () => /* @__PURE__ */ e(
824
+ const ys = F.lazy(() => import("./Creator-BFpHsh2u.js")), vs = F.lazy(() => import("./Visitor-C1Fcrgd6.js")), Ze = () => /* @__PURE__ */ e(
825
825
  "div",
826
826
  {
827
827
  className: "w-[280px] min-h-[200px] animate-pulse rounded-3xl bg-black/[0.06] shadow-[0px_0px_0px_1px_rgba(0,0,0,0.04),0px_1px_2px_0px_rgba(0,0,0,0.04)]",
828
828
  "aria-hidden": !0
829
829
  }
830
- ), ws = (t) => {
831
- if (t.isCreator) {
832
- const { isCreator: r, ...l } = t;
833
- return /* @__PURE__ */ e($e, { fallback: /* @__PURE__ */ e(Ze, {}), children: /* @__PURE__ */ e(ys, { ...l }) });
834
- }
835
- const { isCreator: s, ...n } = t;
836
- return /* @__PURE__ */ e($e, { fallback: /* @__PURE__ */ e(Ze, {}), children: /* @__PURE__ */ e(vs, { ...n }) });
837
- }, _s = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ e(
830
+ ), ws = (t) => t.onUnlock != null || t.onDownload != null ? /* @__PURE__ */ e($e, { fallback: /* @__PURE__ */ e(Ze, {}), children: /* @__PURE__ */ e(vs, { ...t }) }) : /* @__PURE__ */ e($e, { fallback: /* @__PURE__ */ e(Ze, {}), children: /* @__PURE__ */ e(ys, { ...t }) }), _s = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ e(
838
831
  "path",
839
832
  {
840
833
  d: "M4.667 7.333l2.666-6A1.333 1.333 0 018.667 2v2.667a.667.667 0 00.666.666h3.764a1.334 1.334 0 011.192 1.93l-2.333 4.666a1.333 1.333 0 01-1.193.738H4.667m0-5.334v5.334m0-5.334H2.667a1.333 1.333 0 00-1.334 1.334v2.666a1.333 1.333 0 001.334 1.334h2",
@@ -909,7 +902,7 @@ const ys = F.lazy(() => import("./Creator-B6M8dB0U.js")), vs = F.lazy(() => impo
909
902
  MessageDeleted: Z = Et,
910
903
  MessageIsThreadReplyInChannelButtonIndicator: Q = St,
911
904
  MessageRepliesCountButton: D = It,
912
- ReminderNotification: $ = Mt,
905
+ ReminderNotification: G = Mt,
913
906
  StreamedMessageText: z = kt,
914
907
  PinIndicator: ee
915
908
  } = pt("CustomMessage"), le = Tt(o), ie = Dt(o), ce = Le(
@@ -928,11 +921,11 @@ const ys = F.lazy(() => import("./Creator-B6M8dB0U.js")), vs = F.lazy(() => impo
928
921
  const P = !k && !!o.reply_count, H = !k && o.show_in_channel && o.parent_id, Y = o.status === "failed" && ((be = o.error) == null ? void 0 : be.status) !== 403, te = Lt(o);
929
922
  let se;
930
923
  Y ? se = () => N(o) : te && (se = () => R(!0));
931
- const G = I(), de = L(
924
+ const $ = I(), de = L(
932
925
  "str-chat__message str-chat__message-simple",
933
926
  `str-chat__message--${o.type}`,
934
927
  `str-chat__message--${o.status}`,
935
- G ? "str-chat__message--me str-chat__message-simple--me" : "str-chat__message--other",
928
+ $ ? "str-chat__message--me str-chat__message-simple--me" : "str-chat__message--other",
936
929
  o.text ? "str-chat__message--has-text" : "has-no-text",
937
930
  {
938
931
  "str-chat__message--has-attachment": le,
@@ -945,7 +938,7 @@ const ys = F.lazy(() => import("./Creator-B6M8dB0U.js")), vs = F.lazy(() => impo
945
938
  "str-chat__virtual-message__wrapper--first": c,
946
939
  "str-chat__virtual-message__wrapper--group": g
947
940
  }
948
- ), fe = o.poll_id && y.polls.fromState(o.poll_id), ne = gs(o), J = Be(o), ge = fs(o), me = !!(A != null && A.length && !o.quoted_message), xe = J && G && me;
941
+ ), fe = o.poll_id && y.polls.fromState(o.poll_id), ne = gs(o), J = Be(o), ge = fs(o), me = !!(A != null && A.length && !o.quoted_message), xe = J && $ && me;
949
942
  return /* @__PURE__ */ i(he, { children: [
950
943
  d && /* @__PURE__ */ e(
951
944
  p,
@@ -963,7 +956,7 @@ const ys = F.lazy(() => import("./Creator-B6M8dB0U.js")), vs = F.lazy(() => impo
963
956
  ),
964
957
  /* @__PURE__ */ i("div", { className: de, children: [
965
958
  ee && /* @__PURE__ */ e(ee, {}),
966
- !!x && /* @__PURE__ */ e($, { reminder: x }),
959
+ !!x && /* @__PURE__ */ e(G, { reminder: x }),
967
960
  o.user && /* @__PURE__ */ e(
968
961
  oe,
969
962
  {
@@ -994,7 +987,6 @@ const ys = F.lazy(() => import("./Creator-B6M8dB0U.js")), vs = F.lazy(() => impo
994
987
  /* @__PURE__ */ e(
995
988
  ws,
996
989
  {
997
- isCreator: G,
998
990
  title: (X = o.metadata) == null ? void 0 : X.attachment_title,
999
991
  mimeType: (Ce = o.metadata) == null ? void 0 : Ce.attachment_mime_type,
1000
992
  thumbnail: (Ne = o.metadata) == null ? void 0 : Ne.attachment_thumbnail,
@@ -1016,7 +1008,7 @@ const ys = F.lazy(() => import("./Creator-B6M8dB0U.js")), vs = F.lazy(() => impo
1016
1008
  {
1017
1009
  message: o,
1018
1010
  hasAttachment: me,
1019
- isMyMessage: G
1011
+ isMyMessage: $
1020
1012
  }
1021
1013
  ),
1022
1014
  fe && /* @__PURE__ */ e(Pt, { poll: fe }),
@@ -1041,7 +1033,7 @@ const ys = F.lazy(() => import("./Creator-B6M8dB0U.js")), vs = F.lazy(() => impo
1041
1033
  {
1042
1034
  message: o,
1043
1035
  hasAttachment: me,
1044
- isMyMessage: G
1036
+ isMyMessage: $
1045
1037
  }
1046
1038
  ),
1047
1039
  n && J && /* @__PURE__ */ e(
@@ -1601,8 +1593,8 @@ const ue = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
1601
1593
  }) => {
1602
1594
  const f = U(
1603
1595
  async (E, C, p) => {
1604
- var $;
1605
- const O = (($ = t.data) == null ? void 0 : $.chatbot_paused) === !0, q = m && !O, Z = {
1596
+ var G;
1597
+ const O = ((G = t.data) == null ? void 0 : G.chatbot_paused) === !0, q = m && !O, Z = {
1606
1598
  ...C,
1607
1599
  ...q && { silent: !0 },
1608
1600
  ...I && {
@@ -2039,7 +2031,7 @@ const on = ({
2039
2031
  error: Z,
2040
2032
  refreshConnection: Q,
2041
2033
  debug: D
2042
- } = as(), [$, z] = T(null), [ee, le] = T(!1), [ie, ce] = T(!1), [A, P] = T(!1), [H, Y] = T(/* @__PURE__ */ new Set()), [te, se] = T(0), [G, de] = T(!1), [fe, ne] = T(null), J = K(null), {
2034
+ } = as(), [G, z] = T(null), [ee, le] = T(!1), [ie, ce] = T(!1), [A, P] = T(!1), [H, Y] = T(/* @__PURE__ */ new Set()), [te, se] = T(0), [$, de] = T(!1), [fe, ne] = T(null), J = K(null), {
2043
2035
  participantSource: ge,
2044
2036
  participantLabel: me = "participants",
2045
2037
  showDeleteConversation: xe = !0
@@ -2163,8 +2155,8 @@ const on = ({
2163
2155
  },
2164
2156
  [l]
2165
2157
  ), Ne = U(() => {
2166
- G || z(null);
2167
- }, [G]), pe = U(
2158
+ $ || z(null);
2159
+ }, [$]), pe = U(
2168
2160
  async (M) => {
2169
2161
  var V;
2170
2162
  if (C)
@@ -2208,7 +2200,7 @@ const on = ({
2208
2200
  D && console.log("[MessagingShell] Blocking participant:", M), z(null), de(!1), ae.current = null, await X();
2209
2201
  },
2210
2202
  [X, D]
2211
- ), ve = !!$;
2203
+ ), ve = !!G;
2212
2204
  return q ? /* @__PURE__ */ e("div", { className: L("h-full", s), children: /* @__PURE__ */ e(Se, {}) }) : Z ? /* @__PURE__ */ e("div", { className: L("h-full", s), children: /* @__PURE__ */ e(Ee, { message: Z, onBack: Q }) }) : !O || !p ? /* @__PURE__ */ e("div", { className: L("h-full", s), children: /* @__PURE__ */ e(
2213
2205
  Ee,
2214
2206
  {
@@ -2230,18 +2222,18 @@ const on = ({
2230
2222
  className: L(
2231
2223
  "messaging-channel-list-sidebar min-h-0 min-w-0 lg:flex lg:flex-col",
2232
2224
  {
2233
- "!hidden": h === !1 || G,
2225
+ "!hidden": h === !1 || $,
2234
2226
  // Hide on mobile when channel selected, show on desktop with consistent wide width
2235
- "hidden lg:flex lg:flex-1 lg:max-w-2xl": h !== !1 && !G && ve,
2227
+ "hidden lg:flex lg:flex-1 lg:max-w-2xl": h !== !1 && !$ && ve,
2236
2228
  // Show on mobile when no channel selected, use same wide width on desktop
2237
- "flex flex-col w-full lg:flex-1 lg:max-w-2xl": h !== !1 && !G && !ve
2229
+ "flex flex-col w-full lg:flex-1 lg:max-w-2xl": h !== !1 && !$ && !ve
2238
2230
  }
2239
2231
  ),
2240
2232
  children: /* @__PURE__ */ e(
2241
2233
  at,
2242
2234
  {
2243
2235
  onChannelSelect: Ce,
2244
- selectedChannel: $ || void 0,
2236
+ selectedChannel: G || void 0,
2245
2237
  filters: be,
2246
2238
  channelRenderFilterFn: N,
2247
2239
  customEmptyStateIndicator: S,
@@ -2257,17 +2249,17 @@ const on = ({
2257
2249
  "messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
2258
2250
  {
2259
2251
  // In direct conversation mode (or waiting for it), always show (full width)
2260
- flex: G || ve || a,
2252
+ flex: $ || ve || a,
2261
2253
  // Normal mode: hide on mobile when no channel selected
2262
- "hidden lg:flex": !G && !ve && !a
2254
+ "hidden lg:flex": !$ && !ve && !a
2263
2255
  }
2264
2256
  ),
2265
- children: $ ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
2257
+ children: G ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
2266
2258
  lt,
2267
2259
  {
2268
- channel: $,
2260
+ channel: G,
2269
2261
  onBack: Ne,
2270
- showBackButton: !G,
2262
+ showBackButton: !$,
2271
2263
  renderMessageInputActions: n,
2272
2264
  renderConversationFooter: r,
2273
2265
  renderChannelBanner: x,
@@ -2287,7 +2279,7 @@ const on = ({
2287
2279
  customChannelActions: f,
2288
2280
  renderMessage: E
2289
2281
  },
2290
- $.id
2282
+ G.id
2291
2283
  ) }) : a ? (
2292
2284
  // Show loading while creating/loading direct conversation channel
2293
2285
  /* @__PURE__ */ e(Se, {})