@flamingo-stack/openframe-frontend-core 0.0.643 → 0.0.644-2208.6319.1

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 (156) hide show
  1. package/dist/chat-protocol/index.cjs +20 -3
  2. package/dist/chat-protocol/index.cjs.map +1 -1
  3. package/dist/chat-protocol/index.js +20 -3
  4. package/dist/chat-protocol/index.js.map +1 -1
  5. package/dist/chat-protocol/source-metadata.d.ts +7 -1
  6. package/dist/chat-protocol/source-metadata.d.ts.map +1 -1
  7. package/dist/{chunk-B42INNRA.cjs → chunk-2UA3DT5O.cjs} +199 -199
  8. package/dist/{chunk-B42INNRA.cjs.map → chunk-2UA3DT5O.cjs.map} +1 -1
  9. package/dist/{chunk-KX2FT7AS.cjs → chunk-2ZGEXLQW.cjs} +28 -28
  10. package/dist/{chunk-KX2FT7AS.cjs.map → chunk-2ZGEXLQW.cjs.map} +1 -1
  11. package/dist/{chunk-2NRLRRMR.cjs → chunk-3HSRNCDV.cjs} +226 -203
  12. package/dist/chunk-3HSRNCDV.cjs.map +1 -0
  13. package/dist/{chunk-64KDKDYC.js → chunk-5ELZ2NQ5.js} +6 -6
  14. package/dist/{chunk-2DJH6KHA.cjs → chunk-B46Q4DTN.cjs} +382 -386
  15. package/dist/chunk-B46Q4DTN.cjs.map +1 -0
  16. package/dist/{chunk-N7UYD57Q.js → chunk-C7RU466R.js} +3 -3
  17. package/dist/{chunk-2NODQ7FO.js → chunk-DSJZYRS6.js} +17 -21
  18. package/dist/{chunk-2NODQ7FO.js.map → chunk-DSJZYRS6.js.map} +1 -1
  19. package/dist/{chunk-26D6FM6L.cjs → chunk-EKSCVXA3.cjs} +6 -6
  20. package/dist/{chunk-26D6FM6L.cjs.map → chunk-EKSCVXA3.cjs.map} +1 -1
  21. package/dist/{chunk-7HL2PNQ3.js → chunk-GEGE3JXC.js} +5 -5
  22. package/dist/{chunk-7T673MHJ.cjs → chunk-GUB6BR26.cjs} +22 -22
  23. package/dist/{chunk-7T673MHJ.cjs.map → chunk-GUB6BR26.cjs.map} +1 -1
  24. package/dist/{chunk-3IPL6G7S.js → chunk-GXNQPCL4.js} +164 -141
  25. package/dist/chunk-GXNQPCL4.js.map +1 -0
  26. package/dist/{chunk-D6TWJEFW.cjs → chunk-GZXW5QWQ.cjs} +15 -15
  27. package/dist/{chunk-D6TWJEFW.cjs.map → chunk-GZXW5QWQ.cjs.map} +1 -1
  28. package/dist/{chunk-4TE53O6U.js → chunk-HAQRGJFL.js} +4 -4
  29. package/dist/{chunk-TIOHTWDA.js → chunk-INISTVWK.js} +6 -6
  30. package/dist/{chunk-IU3IYXMM.js → chunk-IRV2W7GN.js} +7 -7
  31. package/dist/{chunk-R2IU2Y2O.cjs → chunk-JWCAWGLG.cjs} +33 -33
  32. package/dist/{chunk-R2IU2Y2O.cjs.map → chunk-JWCAWGLG.cjs.map} +1 -1
  33. package/dist/{chunk-77EO26XV.cjs → chunk-LNLNPCII.cjs} +5 -5
  34. package/dist/{chunk-77EO26XV.cjs.map → chunk-LNLNPCII.cjs.map} +1 -1
  35. package/dist/{chunk-42NXGOTG.cjs → chunk-N3M56EE5.cjs} +3 -3
  36. package/dist/{chunk-42NXGOTG.cjs.map → chunk-N3M56EE5.cjs.map} +1 -1
  37. package/dist/{chunk-O7JMF5OT.js → chunk-O47SGDBV.js} +3 -3
  38. package/dist/{chunk-EWQI5MV6.cjs → chunk-OANRA5ML.cjs} +20 -20
  39. package/dist/{chunk-EWQI5MV6.cjs.map → chunk-OANRA5ML.cjs.map} +1 -1
  40. package/dist/{chunk-NCHLLTAR.js → chunk-PR6IR22M.js} +3 -3
  41. package/dist/{chunk-6MQBLFUM.js → chunk-Q7JDIDE2.js} +5 -5
  42. package/dist/{chunk-YG7KLZE7.js → chunk-R5EIFOW2.js} +4 -4
  43. package/dist/{chunk-5E6Y6766.cjs → chunk-S2E4I3WP.cjs} +29 -29
  44. package/dist/{chunk-5E6Y6766.cjs.map → chunk-S2E4I3WP.cjs.map} +1 -1
  45. package/dist/{chunk-SE6YRE3R.cjs → chunk-SAD5IUSO.cjs} +32 -32
  46. package/dist/{chunk-SE6YRE3R.cjs.map → chunk-SAD5IUSO.cjs.map} +1 -1
  47. package/dist/{chunk-3LXJEXPH.js → chunk-TAP4MJPF.js} +2 -2
  48. package/dist/{chunk-M3W5Y5DK.cjs → chunk-TEKH3J65.cjs} +11 -11
  49. package/dist/{chunk-M3W5Y5DK.cjs.map → chunk-TEKH3J65.cjs.map} +1 -1
  50. package/dist/{chunk-HA2U7WHU.js → chunk-TXNWDP3M.js} +3 -3
  51. package/dist/{chunk-IIZX3K2R.js → chunk-URGDDCJL.js} +2 -2
  52. package/dist/{chunk-TQ7KTANJ.js → chunk-V52INSJH.js} +3 -3
  53. package/dist/{chunk-FO7SD2IQ.cjs → chunk-VA6N7IVZ.cjs} +6 -6
  54. package/dist/{chunk-FO7SD2IQ.cjs.map → chunk-VA6N7IVZ.cjs.map} +1 -1
  55. package/dist/{chunk-CWHLVXUW.cjs → chunk-WYS66RIO.cjs} +10 -10
  56. package/dist/{chunk-CWHLVXUW.cjs.map → chunk-WYS66RIO.cjs.map} +1 -1
  57. package/dist/{chunk-XJLWGYL4.cjs → chunk-XVGWYNRY.cjs} +81 -81
  58. package/dist/{chunk-XJLWGYL4.cjs.map → chunk-XVGWYNRY.cjs.map} +1 -1
  59. package/dist/{chunk-ZU2JBBOE.cjs → chunk-XYJ3URIN.cjs} +59 -59
  60. package/dist/{chunk-ZU2JBBOE.cjs.map → chunk-XYJ3URIN.cjs.map} +1 -1
  61. package/dist/{chunk-FVIT23I5.js → chunk-Z5KAIEZ4.js} +3 -3
  62. package/dist/{chunk-YT6RGA3X.js → chunk-ZPLT4XLC.js} +3 -3
  63. package/dist/components/case-studies/index.cjs +16 -16
  64. package/dist/components/case-studies/index.js +4 -4
  65. package/dist/components/chat/entity-cards/dispatch.d.ts.map +1 -1
  66. package/dist/components/chat/entity-cards/program-card.d.ts.map +1 -1
  67. package/dist/components/chat/index.cjs +3 -9
  68. package/dist/components/chat/index.cjs.map +1 -1
  69. package/dist/components/chat/index.js +2 -8
  70. package/dist/components/chat/types/entities/program-types.d.ts +29 -18
  71. package/dist/components/chat/types/entities/program-types.d.ts.map +1 -1
  72. package/dist/components/chat/utils/compact-card-classes.d.ts.map +1 -1
  73. package/dist/components/contact/index.cjs +5 -5
  74. package/dist/components/contact/index.js +4 -4
  75. package/dist/components/docs/index.cjs +8 -8
  76. package/dist/components/docs/index.js +7 -7
  77. package/dist/components/embeds/index.cjs +5 -5
  78. package/dist/components/embeds/index.js +4 -4
  79. package/dist/components/faq/index.cjs +5 -5
  80. package/dist/components/faq/index.js +4 -4
  81. package/dist/components/features/index.cjs +4 -4
  82. package/dist/components/features/index.js +3 -3
  83. package/dist/components/help-center-pages/index.cjs +24 -24
  84. package/dist/components/help-center-pages/index.js +15 -15
  85. package/dist/components/index.cjs +53 -59
  86. package/dist/components/index.cjs.map +1 -1
  87. package/dist/components/index.js +15 -21
  88. package/dist/components/index.js.map +1 -1
  89. package/dist/components/meeting-scheduler/index.cjs +34 -34
  90. package/dist/components/meeting-scheduler/index.js +3 -3
  91. package/dist/components/navigation/index.cjs +7 -7
  92. package/dist/components/navigation/index.js +6 -6
  93. package/dist/components/onboarding-guides/index.cjs +7 -7
  94. package/dist/components/onboarding-guides/index.js +6 -6
  95. package/dist/components/related-content/index.cjs +3 -3
  96. package/dist/components/related-content/index.js +2 -2
  97. package/dist/components/tickets/index.cjs +8 -8
  98. package/dist/components/tickets/index.js +7 -7
  99. package/dist/components/ui/index.cjs +4 -10
  100. package/dist/components/ui/index.cjs.map +1 -1
  101. package/dist/components/ui/index.js +3 -9
  102. package/dist/index.cjs +24 -8
  103. package/dist/index.cjs.map +1 -1
  104. package/dist/index.js +30 -14
  105. package/dist/index.js.map +1 -1
  106. package/dist/utils/format.d.ts +127 -4
  107. package/dist/utils/format.d.ts.map +1 -1
  108. package/dist/utils/index.cjs +113 -5
  109. package/dist/utils/index.cjs.map +1 -1
  110. package/dist/utils/index.d.ts +4 -1
  111. package/dist/utils/index.d.ts.map +1 -1
  112. package/dist/utils/index.js +103 -6
  113. package/dist/utils/index.js.map +1 -1
  114. package/dist/utils/program-instant.d.ts +171 -0
  115. package/dist/utils/program-instant.d.ts.map +1 -0
  116. package/dist/utils/program-meta-renderers.d.ts +3 -0
  117. package/dist/utils/program-meta-renderers.d.ts.map +1 -0
  118. package/dist/utils/url-safety.d.ts +35 -0
  119. package/dist/utils/url-safety.d.ts.map +1 -0
  120. package/package.json +1 -1
  121. package/src/chat-protocol/__tests__/source-metadata.test.ts +76 -0
  122. package/src/chat-protocol/source-metadata.ts +40 -6
  123. package/src/components/chat/entity-cards/.program-card.md +1 -1
  124. package/src/components/chat/entity-cards/dispatch.tsx +9 -27
  125. package/src/components/chat/entity-cards/program-card.tsx +42 -81
  126. package/src/components/chat/types/entities/program-types.ts +29 -89
  127. package/src/components/chat/utils/.compact-card-classes.md +1 -1
  128. package/src/components/chat/utils/compact-card-classes.ts +5 -3
  129. package/src/utils/.format.md +5 -2
  130. package/src/utils/__tests__/format-program-dates.test.ts +180 -0
  131. package/src/utils/__tests__/program-instant.test.ts +170 -0
  132. package/src/utils/__tests__/url-safety.test.ts +44 -0
  133. package/src/utils/format.ts +228 -13
  134. package/src/utils/index.ts +22 -0
  135. package/src/utils/program-instant.ts +211 -0
  136. package/src/utils/program-meta-renderers.ts +18 -0
  137. package/src/utils/url-safety.ts +45 -0
  138. package/dist/chunk-2DJH6KHA.cjs.map +0 -1
  139. package/dist/chunk-2NRLRRMR.cjs.map +0 -1
  140. package/dist/chunk-3IPL6G7S.js.map +0 -1
  141. /package/dist/{chunk-64KDKDYC.js.map → chunk-5ELZ2NQ5.js.map} +0 -0
  142. /package/dist/{chunk-N7UYD57Q.js.map → chunk-C7RU466R.js.map} +0 -0
  143. /package/dist/{chunk-7HL2PNQ3.js.map → chunk-GEGE3JXC.js.map} +0 -0
  144. /package/dist/{chunk-4TE53O6U.js.map → chunk-HAQRGJFL.js.map} +0 -0
  145. /package/dist/{chunk-TIOHTWDA.js.map → chunk-INISTVWK.js.map} +0 -0
  146. /package/dist/{chunk-IU3IYXMM.js.map → chunk-IRV2W7GN.js.map} +0 -0
  147. /package/dist/{chunk-O7JMF5OT.js.map → chunk-O47SGDBV.js.map} +0 -0
  148. /package/dist/{chunk-NCHLLTAR.js.map → chunk-PR6IR22M.js.map} +0 -0
  149. /package/dist/{chunk-6MQBLFUM.js.map → chunk-Q7JDIDE2.js.map} +0 -0
  150. /package/dist/{chunk-YG7KLZE7.js.map → chunk-R5EIFOW2.js.map} +0 -0
  151. /package/dist/{chunk-3LXJEXPH.js.map → chunk-TAP4MJPF.js.map} +0 -0
  152. /package/dist/{chunk-HA2U7WHU.js.map → chunk-TXNWDP3M.js.map} +0 -0
  153. /package/dist/{chunk-IIZX3K2R.js.map → chunk-URGDDCJL.js.map} +0 -0
  154. /package/dist/{chunk-TQ7KTANJ.js.map → chunk-V52INSJH.js.map} +0 -0
  155. /package/dist/{chunk-FVIT23I5.js.map → chunk-Z5KAIEZ4.js.map} +0 -0
  156. /package/dist/{chunk-YT6RGA3X.js.map → chunk-ZPLT4XLC.js.map} +0 -0
@@ -189,14 +189,16 @@ function formatDurationCompact(seconds) {
189
189
  }
190
190
  return `${minutes} min`;
191
191
  }
192
- function formatTimeWithTimezone(date, timezone) {
192
+ function formatTimeWithTimezone(date, timezone, options) {
193
193
  if (!date) return "";
194
194
  const dateObj = typeof date === "string" ? new Date(date) : date;
195
+ if (Number.isNaN(dateObj.getTime())) return "";
195
196
  const opts = {
196
197
  hour: "numeric",
197
198
  minute: "2-digit",
198
199
  hour12: true,
199
- timeZone: timezone || "UTC"
200
+ timeZone: timezone || "UTC",
201
+ ...options?.withZoneLabel ? { timeZoneName: "short" } : {}
200
202
  };
201
203
  try {
202
204
  return dateObj.toLocaleTimeString("en-US", opts);
@@ -204,12 +206,41 @@ function formatTimeWithTimezone(date, timezone) {
204
206
  return dateObj.toLocaleTimeString("en-US", { ...opts, timeZone: "UTC" });
205
207
  }
206
208
  }
209
+ var ZONED_DATE_STYLES = {
210
+ medium: { year: "numeric", month: "short", day: "numeric" },
211
+ weekday: { weekday: "long", day: "numeric", month: "long" },
212
+ // Spelled-out month, no weekday — what an SEO description reads best as.
213
+ long: { year: "numeric", month: "long", day: "numeric" }
214
+ };
215
+ function formatDateWithTimezone(date, timezone, style = "medium") {
216
+ if (!date) return "";
217
+ const dateObj = typeof date === "string" ? new Date(date) : date;
218
+ if (Number.isNaN(dateObj.getTime())) return "";
219
+ const opts = {
220
+ ...ZONED_DATE_STYLES[style],
221
+ timeZone: timezone || "UTC"
222
+ };
223
+ try {
224
+ return dateObj.toLocaleDateString("en-US", opts);
225
+ } catch {
226
+ return dateObj.toLocaleDateString("en-US", { ...opts, timeZone: "UTC" });
227
+ }
228
+ }
229
+ function formatProgramDate(at, style = "medium") {
230
+ return formatDateWithTimezone(at.instant ?? at.utcDate, at.timezone, style);
231
+ }
232
+ function isOrderedRange(from, to) {
233
+ if (!from || !to) return false;
234
+ const a = (typeof from === "string" ? new Date(from) : from).getTime();
235
+ const b = (typeof to === "string" ? new Date(to) : to).getTime();
236
+ return Number.isFinite(a) && Number.isFinite(b) && b > a;
237
+ }
207
238
  function formatDurationFromRange(startAt, endAt) {
208
- if (!startAt || !endAt) return "";
239
+ if (!isOrderedRange(startAt, endAt)) return "";
209
240
  const start = typeof startAt === "string" ? new Date(startAt) : startAt;
210
241
  const end = typeof endAt === "string" ? new Date(endAt) : endAt;
211
- const durationMs = end.getTime() - start.getTime();
212
- const minutes = Math.round(durationMs / 6e4);
242
+ const minutes = Math.round((end.getTime() - start.getTime()) / 6e4);
243
+ if (minutes <= 0) return "";
213
244
  if (minutes >= 60) {
214
245
  const hours = Math.floor(minutes / 60);
215
246
  const mins = minutes % 60;
@@ -269,16 +300,16 @@ function formatWholeDollars(price, currency = "USD") {
269
300
  maximumFractionDigits: 0
270
301
  }).format(price);
271
302
  }
272
- function formatCompactMetric(value, format2 = "number", options) {
303
+ function formatCompactMetric(value, format = "number", options) {
273
304
  if (value === 0 || value === null || value === void 0) {
274
- if (format2 === "currency") return `${options?.prefix || "$"}0`;
275
- if (format2 === "percentage") return "0%";
276
- if (format2 === "months") return `0 ${options?.suffix || "months"}`;
305
+ if (format === "currency") return `${options?.prefix || "$"}0`;
306
+ if (format === "percentage") return "0%";
307
+ if (format === "months") return `0 ${options?.suffix || "months"}`;
277
308
  return "0";
278
309
  }
279
310
  const absValue = Math.abs(value);
280
311
  const sign = value < 0 ? "-" : "";
281
- if (format2 === "currency") {
312
+ if (format === "currency") {
282
313
  const prefix = options?.prefix || "$";
283
314
  const compact = (val, divisor, suffix) => {
284
315
  const divided = val / divisor;
@@ -290,10 +321,10 @@ function formatCompactMetric(value, format2 = "number", options) {
290
321
  if (absValue >= 1e3) return `${sign}${prefix}${(absValue / 1e3).toFixed(0)}K`;
291
322
  return `${sign}${prefix}${absValue.toLocaleString()}`;
292
323
  }
293
- if (format2 === "percentage") {
324
+ if (format === "percentage") {
294
325
  return `${sign}${absValue}%`;
295
326
  }
296
- if (format2 === "months") {
327
+ if (format === "months") {
297
328
  const rounded = Math.round(value * 10) / 10;
298
329
  return `${rounded} ${options?.suffix || "months"}`;
299
330
  }
@@ -398,6 +429,22 @@ function formatBioText(aboutHtml, fallback = "") {
398
429
  }
399
430
  return stripHtml(aboutHtml).trim() || fallback;
400
431
  }
432
+ function formatProgramTimeRange(at, opts = {}) {
433
+ if (at.dateOnly) return "";
434
+ const source = at.instant ?? at.utcDate ?? opts.startAt;
435
+ const label = opts.withZoneLabel === true;
436
+ const bare = formatTimeWithTimezone(source, at.timezone);
437
+ const labelled = label ? formatTimeWithTimezone(source, at.timezone, { withZoneLabel: true }) : bare;
438
+ const ordered = isOrderedRange(source, opts.endAt);
439
+ const end = ordered && opts.endAt ? formatTimeWithTimezone(opts.endAt, at.timezone, { withZoneLabel: label }) : "";
440
+ if (!bare) return "";
441
+ return end ? `${bare} - ${end}` : labelled;
442
+ }
443
+ function formatWebinarTimeMeta(at, opts) {
444
+ const duration = formatDurationFromRange(opts.startAt, opts.endAt);
445
+ const time = formatProgramTimeRange(at, { startAt: opts.startAt, withZoneLabel: opts.withZoneLabel });
446
+ return [time, duration].filter(Boolean).join(" \xB7 ");
447
+ }
401
448
 
402
449
  // src/components/ui/square-avatar.tsx
403
450
  import { memo, forwardRef as forwardRef2 } from "react";
@@ -2036,6 +2083,17 @@ function buildProductReleaseCardProps(item) {
2036
2083
  };
2037
2084
  }
2038
2085
 
2086
+ // src/utils/url-safety.ts
2087
+ var UNSAFE_URL_CHARS = /[\u0000-\u001f\u007f\u200b-\u200d\u2028\u2029\ufeff]/;
2088
+ var SAME_ORIGIN_PROBE = "https://_sameorigin_.invalid";
2089
+ function isSameOriginPath(candidate) {
2090
+ try {
2091
+ return new URL(candidate, SAME_ORIGIN_PROBE).origin === SAME_ORIGIN_PROBE;
2092
+ } catch {
2093
+ return false;
2094
+ }
2095
+ }
2096
+
2039
2097
  // src/components/chat/utils/compact-card-classes.ts
2040
2098
  var COMPACT_CARD_OUTER = "my-1.5 flex items-start gap-3 w-full p-2 rounded-lg border border-ods-border bg-ods-card no-underline transition-colors hover:border-ods-text-secondary/40";
2041
2099
  var COMPACT_CARD_OUTER_STATIC = "my-1.5 flex items-start gap-3 w-full p-2 rounded-lg border border-ods-border bg-ods-card no-underline cursor-default";
@@ -2054,10 +2112,10 @@ var COMPACT_CARD_ROW_FILLER = "\xA0";
2054
2112
  var SAFE_URL_SCHEMES = ["http:", "https:", "mailto:"];
2055
2113
  function safeHref(url) {
2056
2114
  if (!url) return null;
2057
- if (/[\u0000-\u001f\u007f\u200b-\u200d\u2028\u2029\ufeff]/.test(url)) return null;
2115
+ if (UNSAFE_URL_CHARS.test(url)) return null;
2058
2116
  const trimmed = url.trim();
2059
2117
  if (!trimmed) return null;
2060
- if (trimmed.startsWith("/") && !trimmed.startsWith("//")) return trimmed;
2118
+ if (trimmed.startsWith("/")) return isSameOriginPath(trimmed) ? trimmed : null;
2061
2119
  if (trimmed.startsWith("#")) return trimmed;
2062
2120
  if (/^[a-z][a-z0-9+.-]*:$/i.test(trimmed)) return null;
2063
2121
  try {
@@ -3535,6 +3593,56 @@ function partitionMediaByType(media) {
3535
3593
  };
3536
3594
  }
3537
3595
 
3596
+ // src/utils/program-instant.ts
3597
+ var programStr = (value) => typeof value === "string" && value ? value : null;
3598
+ function programDateInstant(item) {
3599
+ const declaredZone = programStr(item.timezone);
3600
+ const dateOnly = item.date_is_display_override === true;
3601
+ const date = programStr(item.date);
3602
+ const startAt = programStr(item.start_at);
3603
+ const timezone = dateOnly ? null : declaredZone;
3604
+ return {
3605
+ instant: timezone ? date ?? startAt : null,
3606
+ timezone,
3607
+ dateOnly,
3608
+ utcDate: date ?? startAt
3609
+ };
3610
+ }
3611
+ function webinarTiming(item) {
3612
+ return { startAt: programStr(item.start_at), endAt: programStr(item.end_at) };
3613
+ }
3614
+ function programMetaLine(item, kind, fmt) {
3615
+ const at = programDateInstant(item);
3616
+ const isScheduled = item.status === "scheduled";
3617
+ let typeMeta = null;
3618
+ if (kind === "podcast" && typeof item.duration_seconds === "number" && item.duration_seconds > 0 && !isScheduled) {
3619
+ typeMeta = fmt.duration(item.duration_seconds);
3620
+ } else if (kind === "event" && typeof item.location_name === "string" && item.location_name.trim().length > 0) {
3621
+ typeMeta = item.location_name;
3622
+ } else if (kind === "webinar" && programStr(item.start_at)) {
3623
+ typeMeta = fmt.webinarMeta(at, webinarTiming(item)) || null;
3624
+ }
3625
+ return { at, typeMeta, line: [fmt.date(at), typeMeta].filter(Boolean).join(" \xB7 ") };
3626
+ }
3627
+ function programMetaFormatters(fmt, opts = {}) {
3628
+ const withZoneLabel = opts.withZoneLabel !== false;
3629
+ return {
3630
+ // The meta line always renders the compact day; the one surface that wants
3631
+ // the weekday form renders it in its own slot, so a `dateStyle` option here
3632
+ // would exist for no caller.
3633
+ date: (at) => fmt.date(at, "medium"),
3634
+ duration: fmt.duration,
3635
+ webinarMeta: (at, o) => fmt.webinarMeta(at, { ...o, withZoneLabel })
3636
+ };
3637
+ }
3638
+
3639
+ // src/utils/program-meta-renderers.ts
3640
+ var PROGRAM_META_RENDERERS = {
3641
+ date: formatProgramDate,
3642
+ duration: formatDurationCompact,
3643
+ webinarMeta: formatWebinarTimeMeta
3644
+ };
3645
+
3538
3646
  // src/components/chat/types/entities/program-types.ts
3539
3647
  function programItemToStripProfile(item) {
3540
3648
  const fromAuthor = toStripProfile(item.author);
@@ -3543,87 +3651,11 @@ function programItemToStripProfile(item) {
3543
3651
  if (!host?.name) return null;
3544
3652
  return toStripProfile({ full_name: host.name, avatar_url: host.avatar_url ?? null });
3545
3653
  }
3546
- function transformEventToProgram(event) {
3547
- return {
3548
- id: event.id,
3549
- title: event.name,
3550
- description: event.description ?? null,
3551
- cover_url: event.cover_url ?? null,
3552
- date: event.start_at,
3553
- external_url: event.event_url ?? null,
3554
- hosts: event.hosts ?? null,
3555
- luma_api_id: event.luma_api_id,
3556
- end_at: event.end_at,
3557
- timezone: event.timezone ?? null,
3558
- location_name: event.location_name ?? null,
3559
- location_full_address: event.location_full_address ?? null,
3560
- geo_latitude: event.geo_latitude ?? null,
3561
- geo_longitude: event.geo_longitude ?? null,
3562
- meeting_url: event.meeting_url ?? null,
3563
- event_url: event.event_url ?? null,
3564
- guest_count: event.guest_count ?? null,
3565
- visibility: event.visibility ?? null,
3566
- is_deleted: event.is_deleted ?? false
3567
- };
3568
- }
3569
- function transformPodcastToProgram(episode) {
3570
- return {
3571
- id: episode.id,
3572
- title: episode.title,
3573
- description: episode.description ?? null,
3574
- // Use cover_image_override if set, otherwise use cover_url
3575
- cover_url: episode.cover_image_override ?? episode.cover_url ?? null,
3576
- date: episode.published_at ?? episode.created_at,
3577
- external_url: episode.external_url ?? null,
3578
- hosts: episode.hosts ?? null,
3579
- podbean_episode_id: episode.podbean_episode_id,
3580
- podbean_podcast_id: episode.podbean_podcast_id,
3581
- audio_url: episode.audio_url ?? null,
3582
- main_video_url: episode.main_video_url ?? null,
3583
- media_type: episode.media_type ?? "audio",
3584
- duration_seconds: episode.duration_seconds ?? null,
3585
- status: episode.status ?? "published",
3586
- published_at: episode.published_at ?? null,
3587
- is_deleted: episode.is_deleted ?? false,
3588
- // Override fields
3589
- cover_image_override: episode.cover_image_override ?? null,
3590
- custom_video_url: episode.custom_video_url ?? null
3591
- };
3592
- }
3593
- function transformWebinarToProgram(webinar) {
3594
- return {
3595
- id: webinar.id,
3596
- title: webinar.title,
3597
- description: webinar.description ?? null,
3598
- // Use cover_image_override if set, otherwise use cover_url
3599
- cover_url: webinar.cover_image_override ?? webinar.cover_url ?? null,
3600
- // Use display_date_override if set, otherwise use start_at
3601
- date: webinar.display_date_override ?? webinar.start_at,
3602
- external_url: webinar.registration_url ?? null,
3603
- hosts: webinar.hosts ?? null,
3604
- livestorm_event_id: webinar.livestorm_event_id,
3605
- start_at: webinar.start_at,
3606
- end_at: webinar.end_at ?? null,
3607
- timezone: webinar.timezone ?? null,
3608
- registration_url: webinar.registration_url ?? null,
3609
- is_deleted: webinar.is_deleted ?? false,
3610
- main_video_url: webinar.main_video_url ?? null,
3611
- // Override fields
3612
- custom_video_url: webinar.custom_video_url ?? null,
3613
- display_date_override: webinar.display_date_override ?? null,
3614
- cover_image_override: webinar.cover_image_override ?? null
3615
- };
3616
- }
3617
3654
 
3618
3655
  // src/components/chat/entity-cards/program-card.tsx
3619
- import { format } from "date-fns";
3620
3656
  import { ExternalLink as ExternalLink2, Clock as Clock2, Play as Play3, Video as Video2 } from "lucide-react";
3621
3657
  import { useState as useState6 } from "react";
3622
3658
  import { Fragment as Fragment9, jsx as jsx31, jsxs as jsxs21 } from "react/jsx-runtime";
3623
- function formatUtc(date, fmt) {
3624
- if (Number.isNaN(date.getTime())) return "";
3625
- return format(new Date(date.getTime() + date.getTimezoneOffset() * 6e4), fmt);
3626
- }
3627
3659
  function ProgramCardSkeleton({ size = "default" }) {
3628
3660
  if (size === "sm") {
3629
3661
  return /* @__PURE__ */ jsxs21("span", { className: COMPACT_CARD_SKELETON_OUTER, children: [
@@ -3688,14 +3720,6 @@ function getHosts(hosts) {
3688
3720
  }
3689
3721
  return [];
3690
3722
  }
3691
- function webinarTiming(item) {
3692
- const str = (value) => typeof value === "string" && value ? value : null;
3693
- return {
3694
- startAt: "start_at" in item ? str(item.start_at) : null,
3695
- endAt: "end_at" in item ? str(item.end_at) : null,
3696
- timezone: "timezone" in item ? str(item.timezone) : null
3697
- };
3698
- }
3699
3723
  function MediaGallery({ images, title }) {
3700
3724
  const [selectedImageIndex, setSelectedImageIndex] = useState6(null);
3701
3725
  const [isModalOpen, setIsModalOpen] = useState6(false);
@@ -3774,25 +3798,17 @@ function ProgramCard({
3774
3798
  const hosts = getHosts(item.hosts);
3775
3799
  const accentColor = "var(--color-accent-primary)";
3776
3800
  const isScheduled = "status" in item && item.status === "scheduled";
3777
- const compactTypeMeta = () => {
3778
- if (config.type === "podcast" && "duration_seconds" in item && !isScheduled) {
3779
- const dur = item.duration_seconds;
3780
- if (typeof dur === "number" && dur > 0) return formatDurationCompact(dur);
3781
- } else if (config.type === "event" && "location_name" in item) {
3782
- const loc = item.location_name;
3783
- if (typeof loc === "string" && loc.trim().length > 0) return loc;
3784
- } else if (config.type === "webinar" && "start_at" in item) {
3785
- const { startAt, endAt, timezone } = webinarTiming(item);
3786
- const time = formatTimeWithTimezone(startAt, timezone);
3787
- const dur = formatDurationFromRange(startAt, endAt);
3788
- return dur ? `${time} \xB7 ${dur}` : time;
3789
- }
3790
- return null;
3791
- };
3792
- const compactDate = formatUtc(new Date(item.date), "MMM d, yyyy");
3801
+ const {
3802
+ at: zonedDate,
3803
+ typeMeta: compactTypeMetaValue,
3804
+ line: compactMetaLine
3805
+ // Compact densities join plain strings, so the zone rides inline here; the
3806
+ // default density below renders it as its own styled span instead.
3807
+ } = programMetaLine(item, config.type, programMetaFormatters(PROGRAM_META_RENDERERS));
3808
+ const compactDate = formatProgramDate(zonedDate, "medium");
3793
3809
  if (size === "portrait") {
3794
3810
  const profile = programItemToStripProfile(item);
3795
- const dateMeta = [compactDate, compactTypeMeta()].filter(Boolean).join(" \xB7 ");
3811
+ const dateMeta = compactMetaLine;
3796
3812
  return /* @__PURE__ */ jsx31(
3797
3813
  EntityPortraitCard,
3798
3814
  {
@@ -3811,10 +3827,10 @@ function ProgramCard({
3811
3827
  );
3812
3828
  }
3813
3829
  if (size === "sm") {
3814
- const itemDate2 = compactDate;
3830
+ const itemDate = compactDate;
3815
3831
  const compactCover = coverImage || placeholderUrl || null;
3816
- const typeMeta = compactTypeMeta();
3817
- const subtitleParts = [itemDate2, typeMeta, config.labels?.singular].filter(
3832
+ const typeMeta = compactTypeMetaValue;
3833
+ const subtitleParts = [itemDate, typeMeta, config.labels?.singular].filter(
3818
3834
  (s) => typeof s === "string" && s.length > 0
3819
3835
  );
3820
3836
  return /* @__PURE__ */ jsxs21("a", { href, target, rel, className: cn(COMPACT_CARD_OUTER, className), children: [
@@ -3830,32 +3846,29 @@ function ProgramCard({
3830
3846
  /* @__PURE__ */ jsx31("span", { className: "flex h-5 shrink-0 items-center self-start text-ods-text-secondary", children: /* @__PURE__ */ jsx31(ExternalLink2, { className: "h-3.5 w-3.5" }) })
3831
3847
  ] });
3832
3848
  }
3833
- const itemDate = new Date(item.date);
3834
- const dateFormat = formatUtc(itemDate, "EEEE d MMMM");
3849
+ const dateFormat = formatProgramDate(zonedDate, "weekday");
3850
+ const { typeMeta: defaultTypeMeta } = programMetaLine(
3851
+ item,
3852
+ config.type,
3853
+ programMetaFormatters(PROGRAM_META_RENDERERS, { withZoneLabel: false })
3854
+ );
3835
3855
  const defaultRenderMeta = () => {
3836
- if (config.type === "podcast" && "duration_seconds" in item && !isScheduled) {
3837
- const dur = item.duration_seconds;
3838
- return /* @__PURE__ */ jsxs21(Fragment9, { children: [
3856
+ if (config.type === "podcast") {
3857
+ return defaultTypeMeta ? /* @__PURE__ */ jsxs21(Fragment9, { children: [
3839
3858
  /* @__PURE__ */ jsx31(Clock2, { className: "h-4 w-4 text-ods-text-secondary" }),
3840
- /* @__PURE__ */ jsx31("span", { className: "font-body text-ods-text-secondary", children: formatDurationCompact(typeof dur === "number" ? dur : null) })
3841
- ] });
3859
+ /* @__PURE__ */ jsx31("span", { className: "font-body text-ods-text-secondary", children: defaultTypeMeta })
3860
+ ] }) : null;
3842
3861
  }
3843
- if (config.type === "event" && "location_name" in item) {
3844
- const loc = item.location_name;
3845
- return /* @__PURE__ */ jsx31("span", { className: "font-body text-ods-text-secondary", children: typeof loc === "string" && loc || "Location TBD" });
3862
+ if (config.type === "event") {
3863
+ return defaultTypeMeta ? /* @__PURE__ */ jsx31("span", { className: "font-body text-ods-text-secondary", children: defaultTypeMeta }) : null;
3846
3864
  }
3847
- if (config.type === "webinar" && "start_at" in item) {
3848
- const { startAt, endAt, timezone } = webinarTiming(item);
3849
- const duration = formatDurationFromRange(startAt, endAt);
3865
+ if (config.type === "webinar" && (defaultTypeMeta || zonedDate.timezone)) {
3850
3866
  return /* @__PURE__ */ jsxs21(Fragment9, { children: [
3851
3867
  /* @__PURE__ */ jsx31(Video2, { className: "h-4 w-4 text-ods-text-secondary" }),
3852
- /* @__PURE__ */ jsxs21("span", { className: "font-body text-ods-text-secondary", children: [
3853
- formatTimeWithTimezone(startAt, timezone),
3854
- duration && ` \xB7 ${duration}`
3855
- ] }),
3856
- timezone && /* @__PURE__ */ jsxs21("span", { className: "text-ods-text-secondary text-h6", children: [
3868
+ defaultTypeMeta && /* @__PURE__ */ jsx31("span", { className: "font-body text-ods-text-secondary", children: defaultTypeMeta }),
3869
+ zonedDate.timezone && /* @__PURE__ */ jsxs21("span", { className: "text-ods-text-secondary text-h6", children: [
3857
3870
  "(",
3858
- timezone,
3871
+ zonedDate.timezone,
3859
3872
  ")"
3860
3873
  ] })
3861
3874
  ] });
@@ -4078,6 +4091,9 @@ export {
4078
4091
  formatDurationMMSS,
4079
4092
  formatDurationCompact,
4080
4093
  formatTimeWithTimezone,
4094
+ formatDateWithTimezone,
4095
+ formatProgramDate,
4096
+ isOrderedRange,
4081
4097
  formatDurationFromRange,
4082
4098
  formatDateUTC,
4083
4099
  formatEntryMonthUTC,
@@ -4097,6 +4113,8 @@ export {
4097
4113
  formatClassification,
4098
4114
  formatPricingModel,
4099
4115
  formatBioText,
4116
+ formatProgramTimeRange,
4117
+ formatWebinarTimeMeta,
4100
4118
  SquareAvatar,
4101
4119
  InteractiveCard,
4102
4120
  Modal,
@@ -4158,6 +4176,8 @@ export {
4158
4176
  resolveReleaseCover,
4159
4177
  defaultBuildProductReleaseCardProps,
4160
4178
  buildProductReleaseCardProps,
4179
+ UNSAFE_URL_CHARS,
4180
+ isSameOriginPath,
4161
4181
  COMPACT_CARD_OUTER,
4162
4182
  COMPACT_CARD_OUTER_STATIC,
4163
4183
  COMPACT_CARD_SKELETON_OUTER,
@@ -4198,10 +4218,13 @@ export {
4198
4218
  isImageMedia,
4199
4219
  isPublishableMediaType,
4200
4220
  partitionMediaByType,
4221
+ programStr,
4222
+ programDateInstant,
4223
+ webinarTiming,
4224
+ programMetaLine,
4225
+ programMetaFormatters,
4226
+ PROGRAM_META_RENDERERS,
4201
4227
  programItemToStripProfile,
4202
- transformEventToProgram,
4203
- transformPodcastToProgram,
4204
- transformWebinarToProgram,
4205
4228
  ProgramCardSkeleton,
4206
4229
  ProgramCard,
4207
4230
  extractItems,
@@ -4209,4 +4232,4 @@ export {
4209
4232
  canonicalContentRefType,
4210
4233
  buildListUrl
4211
4234
  };
4212
- //# sourceMappingURL=chunk-3IPL6G7S.js.map
4235
+ //# sourceMappingURL=chunk-GXNQPCL4.js.map