@flamingo-stack/openframe-frontend-core 0.0.642 → 0.0.643-snapshot.20260916153353
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/chat-protocol/index.cjs +6 -3
- package/dist/chat-protocol/index.cjs.map +1 -1
- package/dist/chat-protocol/index.js +6 -3
- package/dist/chat-protocol/index.js.map +1 -1
- package/dist/chat-protocol/source-metadata.d.ts +16 -1
- package/dist/chat-protocol/source-metadata.d.ts.map +1 -1
- package/dist/{chunk-YM6L3WM5.js → chunk-27RD5XTP.js} +3 -3
- package/dist/{chunk-POPL3W2S.js → chunk-3DGRXC74.js} +3 -3
- package/dist/{chunk-2Z5FPHOL.cjs → chunk-3UBT2OIX.cjs} +20 -20
- package/dist/{chunk-2Z5FPHOL.cjs.map → chunk-3UBT2OIX.cjs.map} +1 -1
- package/dist/{chunk-6GY6DFIH.js → chunk-4WVWRFGP.js} +6 -6
- package/dist/{chunk-OYI3K5R6.cjs → chunk-65EVGKFV.cjs} +8 -14
- package/dist/chunk-65EVGKFV.cjs.map +1 -0
- package/dist/{chunk-6NHLZORM.js → chunk-7Q5XXPCB.js} +6 -6
- package/dist/{chunk-2NRLRRMR.cjs → chunk-7R2DIGG4.cjs} +319 -293
- package/dist/chunk-7R2DIGG4.cjs.map +1 -0
- package/dist/{chunk-3LXJEXPH.js → chunk-B3Z3RJRW.js} +2 -2
- package/dist/{chunk-N5C5P2LM.cjs → chunk-B5IFXCRF.cjs} +22 -22
- package/dist/{chunk-N5C5P2LM.cjs.map → chunk-B5IFXCRF.cjs.map} +1 -1
- package/dist/{chunk-YRSRP4U3.cjs → chunk-C5Y5T6GC.cjs} +15 -15
- package/dist/{chunk-YRSRP4U3.cjs.map → chunk-C5Y5T6GC.cjs.map} +1 -1
- package/dist/{chunk-VHB3I6F3.cjs → chunk-CBXZSTAG.cjs} +419 -445
- package/dist/chunk-CBXZSTAG.cjs.map +1 -0
- package/dist/{chunk-VKPTN5MT.cjs → chunk-DCCY54LU.cjs} +6 -6
- package/dist/{chunk-VKPTN5MT.cjs.map → chunk-DCCY54LU.cjs.map} +1 -1
- package/dist/{chunk-WL3PNUNY.cjs → chunk-FAD5WURS.cjs} +81 -81
- package/dist/{chunk-WL3PNUNY.cjs.map → chunk-FAD5WURS.cjs.map} +1 -1
- package/dist/{chunk-3IPL6G7S.js → chunk-FOSIR4QF.js} +260 -234
- package/dist/chunk-FOSIR4QF.js.map +1 -0
- package/dist/{chunk-MJ424FEC.js → chunk-HOGOQA2X.js} +2 -2
- package/dist/{chunk-SDGMLXIP.js → chunk-HPWLIYRL.js} +12 -25
- package/dist/chunk-HPWLIYRL.js.map +1 -0
- package/dist/{chunk-3I6XHQUD.js → chunk-I57XLISO.js} +54 -80
- package/dist/chunk-I57XLISO.js.map +1 -0
- package/dist/{chunk-FRCUUK5X.cjs → chunk-IIXB5REN.cjs} +3 -3
- package/dist/{chunk-FRCUUK5X.cjs.map → chunk-IIXB5REN.cjs.map} +1 -1
- package/dist/{chunk-HW7BLVQH.js → chunk-IXD6SHQ6.js} +4 -4
- package/dist/{chunk-XFLJC2WR.cjs → chunk-LZYPSDFE.cjs} +59 -59
- package/dist/{chunk-XFLJC2WR.cjs.map → chunk-LZYPSDFE.cjs.map} +1 -1
- package/dist/{chunk-QY25ZP2V.cjs → chunk-MCQAOIUK.cjs} +28 -28
- package/dist/{chunk-QY25ZP2V.cjs.map → chunk-MCQAOIUK.cjs.map} +1 -1
- package/dist/{chunk-S254VEDE.js → chunk-MRIOYSXH.js} +3 -3
- package/dist/{chunk-OOOOC5O5.cjs → chunk-OMSUWB6A.cjs} +29 -29
- package/dist/{chunk-OOOOC5O5.cjs.map → chunk-OMSUWB6A.cjs.map} +1 -1
- package/dist/{chunk-GEIHTN6J.cjs → chunk-OVXYX47B.cjs} +10 -10
- package/dist/{chunk-GEIHTN6J.cjs.map → chunk-OVXYX47B.cjs.map} +1 -1
- package/dist/{chunk-XWGHLSAL.js → chunk-PFV4DAX5.js} +4 -4
- package/dist/{chunk-O4LL7RQV.cjs → chunk-RB6L5EGM.cjs} +208 -221
- package/dist/chunk-RB6L5EGM.cjs.map +1 -0
- package/dist/{chunk-M4PJVFBF.cjs → chunk-RFFF2EYD.cjs} +11 -11
- package/dist/{chunk-M4PJVFBF.cjs.map → chunk-RFFF2EYD.cjs.map} +1 -1
- package/dist/{chunk-UFBWNVZZ.js → chunk-RNMGKAS6.js} +7 -7
- package/dist/{chunk-SE6YRE3R.cjs → chunk-RWURXICE.cjs} +32 -32
- package/dist/{chunk-SE6YRE3R.cjs.map → chunk-RWURXICE.cjs.map} +1 -1
- package/dist/{chunk-ZAIYD3MZ.js → chunk-S2KMNFFN.js} +3 -3
- package/dist/{chunk-ZGPJ3NVF.js → chunk-SKABQX44.js} +3 -3
- package/dist/{chunk-YE3TFNW6.cjs → chunk-TGUA3C4U.cjs} +5 -5
- package/dist/{chunk-YE3TFNW6.cjs.map → chunk-TGUA3C4U.cjs.map} +1 -1
- package/dist/{chunk-ORFJVMAL.js → chunk-TTVOBWAH.js} +5 -11
- package/dist/chunk-TTVOBWAH.js.map +1 -0
- package/dist/{chunk-M7QROULE.js → chunk-UEXIMEVU.js} +5 -5
- package/dist/{chunk-EW3MSJOE.cjs → chunk-UKV52KAP.cjs} +33 -33
- package/dist/{chunk-EW3MSJOE.cjs.map → chunk-UKV52KAP.cjs.map} +1 -1
- package/dist/{chunk-J4RZVLLQ.js → chunk-VE52MSYC.js} +5 -5
- package/dist/components/case-studies/index.cjs +16 -16
- package/dist/components/case-studies/index.js +4 -4
- package/dist/components/chat/chat-sidebar.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/blog-card.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/dispatch.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/program-card.d.ts.map +1 -1
- package/dist/components/chat/index.cjs +3 -9
- package/dist/components/chat/index.cjs.map +1 -1
- package/dist/components/chat/index.js +2 -8
- package/dist/components/chat/types/entities/investor-update.d.ts.map +1 -1
- package/dist/components/chat/types/entities/program-types.d.ts +8 -18
- package/dist/components/chat/types/entities/program-types.d.ts.map +1 -1
- package/dist/components/chat/utils/compact-card-classes.d.ts.map +1 -1
- package/dist/components/contact/index.cjs +5 -5
- package/dist/components/contact/index.js +4 -4
- package/dist/components/docs/index.cjs +8 -8
- package/dist/components/docs/index.js +7 -7
- package/dist/components/embeds/index.cjs +5 -5
- package/dist/components/embeds/index.js +4 -4
- package/dist/components/faq/index.cjs +5 -5
- package/dist/components/faq/index.js +4 -4
- package/dist/components/features/index.cjs +4 -4
- package/dist/components/features/index.js +3 -3
- package/dist/components/help-center-pages/index.cjs +24 -24
- package/dist/components/help-center-pages/index.js +15 -15
- package/dist/components/index.cjs +53 -59
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.js +15 -21
- package/dist/components/index.js.map +1 -1
- package/dist/components/logs-list.d.ts.map +1 -1
- package/dist/components/meeting-scheduler/confirmation.d.ts.map +1 -1
- package/dist/components/meeting-scheduler/directory.d.ts.map +1 -1
- package/dist/components/meeting-scheduler/index.cjs +47 -72
- package/dist/components/meeting-scheduler/index.cjs.map +1 -1
- package/dist/components/meeting-scheduler/index.d.ts.map +1 -1
- package/dist/components/meeting-scheduler/index.js +16 -41
- package/dist/components/meeting-scheduler/index.js.map +1 -1
- package/dist/components/meeting-scheduler/slot-picker.d.ts.map +1 -1
- package/dist/components/navigation/index.cjs +7 -7
- package/dist/components/navigation/index.js +6 -6
- package/dist/components/onboarding-guides/index.cjs +7 -7
- package/dist/components/onboarding-guides/index.js +6 -6
- package/dist/components/related-content/index.cjs +3 -3
- package/dist/components/related-content/index.js +2 -2
- package/dist/components/shared/article-author-byline.d.ts.map +1 -1
- package/dist/components/tickets/index.cjs +8 -8
- package/dist/components/tickets/index.js +7 -7
- package/dist/components/ui/date-picker.d.ts.map +1 -1
- package/dist/components/ui/device-card.d.ts.map +1 -1
- package/dist/components/ui/drawer.d.ts +19 -5
- package/dist/components/ui/drawer.d.ts.map +1 -1
- package/dist/components/ui/index.cjs +4 -10
- package/dist/components/ui/index.cjs.map +1 -1
- package/dist/components/ui/index.js +3 -9
- package/dist/components/ui/table/table-timestamp-cell.d.ts.map +1 -1
- package/dist/index.cjs +29 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +35 -23
- package/dist/index.js.map +1 -1
- package/dist/utils/date-formatters.d.ts +7 -2
- package/dist/utils/date-formatters.d.ts.map +1 -1
- package/dist/utils/date-utils.d.ts +4 -1
- package/dist/utils/date-utils.d.ts.map +1 -1
- package/dist/utils/format-date.d.ts.map +1 -1
- package/dist/utils/format.d.ts +155 -11
- package/dist/utils/format.d.ts.map +1 -1
- package/dist/utils/index.cjs +223 -109
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.ts +4 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +211 -110
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/program-instant.d.ts +145 -0
- package/dist/utils/program-instant.d.ts.map +1 -0
- package/dist/utils/program-meta-renderers.d.ts +3 -0
- package/dist/utils/program-meta-renderers.d.ts.map +1 -0
- package/dist/utils/url-safety.d.ts +33 -0
- package/dist/utils/url-safety.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/chat-protocol/__tests__/source-metadata.test.ts +70 -3
- package/src/chat-protocol/source-metadata.ts +22 -6
- package/src/components/chat/chat-sidebar.tsx +4 -11
- package/src/components/chat/entity-cards/.program-card.md +1 -1
- package/src/components/chat/entity-cards/blog-card.tsx +4 -24
- package/src/components/chat/entity-cards/dispatch.tsx +9 -27
- package/src/components/chat/entity-cards/program-card.tsx +42 -81
- package/src/components/chat/types/entities/investor-update.ts +4 -6
- package/src/components/chat/types/entities/program-types.ts +8 -89
- package/src/components/chat/utils/.compact-card-classes.md +1 -1
- package/src/components/chat/utils/compact-card-classes.ts +5 -3
- package/src/components/logs-list.tsx +4 -13
- package/src/components/meeting-scheduler/confirmation.tsx +6 -10
- package/src/components/meeting-scheduler/directory.tsx +2 -12
- package/src/components/meeting-scheduler/index.tsx +3 -11
- package/src/components/meeting-scheduler/slot-picker.tsx +4 -7
- package/src/components/shared/article-author-byline.tsx +4 -13
- package/src/components/ui/.drawer.md +1 -0
- package/src/components/ui/__tests__/drawer-size.test.tsx +38 -0
- package/src/components/ui/date-picker.tsx +6 -13
- package/src/components/ui/device-card.tsx +4 -10
- package/src/components/ui/drawer.tsx +44 -9
- package/src/components/ui/table/table-timestamp-cell.tsx +8 -2
- package/src/utils/.format.md +5 -2
- package/src/utils/__tests__/date-rendering.test.ts +118 -0
- package/src/utils/__tests__/format-program-dates.test.ts +148 -0
- package/src/utils/__tests__/program-instant.test.ts +125 -0
- package/src/utils/__tests__/url-safety.test.ts +44 -0
- package/src/utils/date-formatters.ts +18 -29
- package/src/utils/date-utils.ts +27 -40
- package/src/utils/format-date.ts +14 -16
- package/src/utils/format.ts +367 -66
- package/src/utils/index.ts +24 -0
- package/src/utils/program-instant.ts +180 -0
- package/src/utils/program-meta-renderers.ts +18 -0
- package/src/utils/url-safety.ts +43 -0
- package/dist/chunk-2NRLRRMR.cjs.map +0 -1
- package/dist/chunk-3I6XHQUD.js.map +0 -1
- package/dist/chunk-3IPL6G7S.js.map +0 -1
- package/dist/chunk-O4LL7RQV.cjs.map +0 -1
- package/dist/chunk-ORFJVMAL.js.map +0 -1
- package/dist/chunk-OYI3K5R6.cjs.map +0 -1
- package/dist/chunk-SDGMLXIP.js.map +0 -1
- package/dist/chunk-VHB3I6F3.cjs.map +0 -1
- /package/dist/{chunk-YM6L3WM5.js.map → chunk-27RD5XTP.js.map} +0 -0
- /package/dist/{chunk-POPL3W2S.js.map → chunk-3DGRXC74.js.map} +0 -0
- /package/dist/{chunk-6GY6DFIH.js.map → chunk-4WVWRFGP.js.map} +0 -0
- /package/dist/{chunk-6NHLZORM.js.map → chunk-7Q5XXPCB.js.map} +0 -0
- /package/dist/{chunk-3LXJEXPH.js.map → chunk-B3Z3RJRW.js.map} +0 -0
- /package/dist/{chunk-MJ424FEC.js.map → chunk-HOGOQA2X.js.map} +0 -0
- /package/dist/{chunk-HW7BLVQH.js.map → chunk-IXD6SHQ6.js.map} +0 -0
- /package/dist/{chunk-S254VEDE.js.map → chunk-MRIOYSXH.js.map} +0 -0
- /package/dist/{chunk-XWGHLSAL.js.map → chunk-PFV4DAX5.js.map} +0 -0
- /package/dist/{chunk-UFBWNVZZ.js.map → chunk-RNMGKAS6.js.map} +0 -0
- /package/dist/{chunk-ZAIYD3MZ.js.map → chunk-S2KMNFFN.js.map} +0 -0
- /package/dist/{chunk-ZGPJ3NVF.js.map → chunk-SKABQX44.js.map} +0 -0
- /package/dist/{chunk-M7QROULE.js.map → chunk-UEXIMEVU.js.map} +0 -0
- /package/dist/{chunk-J4RZVLLQ.js.map → chunk-VE52MSYC.js.map} +0 -0
|
@@ -88,7 +88,7 @@ function formatDate(date, options = {
|
|
|
88
88
|
console.warn("Invalid date provided to formatDate:", date);
|
|
89
89
|
return "Invalid Date";
|
|
90
90
|
}
|
|
91
|
-
return dateObj
|
|
91
|
+
return formatDateWithTimezone(dateObj, options.timeZone ?? null, options);
|
|
92
92
|
}
|
|
93
93
|
function formatNumber(num) {
|
|
94
94
|
return num.toLocaleString();
|
|
@@ -189,27 +189,130 @@ function formatDurationCompact(seconds) {
|
|
|
189
189
|
}
|
|
190
190
|
return `${minutes} min`;
|
|
191
191
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
192
|
+
var VIEWER_TIMEZONE = "viewer";
|
|
193
|
+
var ZONED_DATE_STYLES = {
|
|
194
|
+
/** Mar 19, 2026 */
|
|
195
|
+
medium: { year: "numeric", month: "short", day: "numeric" },
|
|
196
|
+
/** Thursday, March 19 */
|
|
197
|
+
weekday: { weekday: "long", day: "numeric", month: "long" },
|
|
198
|
+
/** March 19, 2026 */
|
|
199
|
+
long: { year: "numeric", month: "long", day: "numeric" },
|
|
200
|
+
/** 03/19/2026 */
|
|
201
|
+
numeric: { year: "numeric", month: "2-digit", day: "2-digit" },
|
|
202
|
+
/** March 2026 */
|
|
203
|
+
monthYear: { year: "numeric", month: "long" },
|
|
204
|
+
/** Mar 2026 */
|
|
205
|
+
monthYearShort: { year: "numeric", month: "short" },
|
|
206
|
+
/** 03/19/2026, 9:18 PM */
|
|
207
|
+
numericDateTime: {
|
|
208
|
+
year: "numeric",
|
|
209
|
+
month: "2-digit",
|
|
210
|
+
day: "2-digit",
|
|
196
211
|
hour: "numeric",
|
|
197
212
|
minute: "2-digit",
|
|
198
|
-
hour12: true
|
|
199
|
-
|
|
200
|
-
|
|
213
|
+
hour12: true
|
|
214
|
+
},
|
|
215
|
+
/** Mar 19, 2026, 9:18 PM */
|
|
216
|
+
mediumDateTime: { year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "2-digit" },
|
|
217
|
+
/** Thursday, March 19 at 9:18 PM EDT */
|
|
218
|
+
weekdayDateTimeZoned: {
|
|
219
|
+
weekday: "long",
|
|
220
|
+
month: "long",
|
|
221
|
+
day: "numeric",
|
|
222
|
+
hour: "numeric",
|
|
223
|
+
minute: "2-digit",
|
|
224
|
+
timeZoneName: "short"
|
|
225
|
+
},
|
|
226
|
+
/** Thu, Mar 19, 9:18 PM */
|
|
227
|
+
shortWeekdayDateTime: { weekday: "short", month: "short", day: "numeric", hour: "numeric", minute: "2-digit" },
|
|
228
|
+
/** 03/19/2026, 21:18 */
|
|
229
|
+
numericDateTime24h: {
|
|
230
|
+
year: "numeric",
|
|
231
|
+
month: "2-digit",
|
|
232
|
+
day: "2-digit",
|
|
233
|
+
hour: "2-digit",
|
|
234
|
+
minute: "2-digit",
|
|
235
|
+
hour12: false
|
|
236
|
+
},
|
|
237
|
+
/** 3/19/2026, 9:18:00 PM — the runtime's own default date-time shape */
|
|
238
|
+
localeDateTime: {
|
|
239
|
+
year: "numeric",
|
|
240
|
+
month: "numeric",
|
|
241
|
+
day: "numeric",
|
|
242
|
+
hour: "numeric",
|
|
243
|
+
minute: "2-digit",
|
|
244
|
+
second: "2-digit"
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
var FORMATTERS = /* @__PURE__ */ new Map();
|
|
248
|
+
function zonedFormatter(locale, fields, timeZone) {
|
|
249
|
+
const key = JSON.stringify([locale ?? null, timeZone ?? null, fields]);
|
|
250
|
+
let fmt = FORMATTERS.get(key);
|
|
251
|
+
if (!fmt) {
|
|
252
|
+
fmt = new Intl.DateTimeFormat(locale, { ...fields, timeZone });
|
|
253
|
+
FORMATTERS.set(key, fmt);
|
|
254
|
+
}
|
|
255
|
+
return fmt;
|
|
256
|
+
}
|
|
257
|
+
function formatterFor(timezone, fields, locale) {
|
|
258
|
+
const zone = timezone === VIEWER_TIMEZONE ? void 0 : timezone || "UTC";
|
|
201
259
|
try {
|
|
202
|
-
return
|
|
260
|
+
return zonedFormatter(locale, fields, zone);
|
|
203
261
|
} catch {
|
|
204
|
-
return
|
|
262
|
+
return zonedFormatter(locale, fields, "UTC");
|
|
205
263
|
}
|
|
206
264
|
}
|
|
265
|
+
function toValidDate(date) {
|
|
266
|
+
if (date === null || date === void 0 || date === "") return null;
|
|
267
|
+
const d = date instanceof Date ? date : new Date(date);
|
|
268
|
+
return Number.isNaN(d.getTime()) ? null : d;
|
|
269
|
+
}
|
|
270
|
+
function formatDateWithTimezone(date, timezone, style = "medium", options) {
|
|
271
|
+
const dateObj = toValidDate(date);
|
|
272
|
+
if (!dateObj) return "";
|
|
273
|
+
const { timeZone: _ignored, ...fields } = typeof style === "string" ? ZONED_DATE_STYLES[style] : style;
|
|
274
|
+
return formatterFor(timezone, fields, options?.viewerLocale ? void 0 : "en-US").format(dateObj);
|
|
275
|
+
}
|
|
276
|
+
function formatDateTimeYmd(date, timezone, options) {
|
|
277
|
+
const dateObj = toValidDate(date);
|
|
278
|
+
if (!dateObj) return "";
|
|
279
|
+
const parts = formatterFor(
|
|
280
|
+
timezone,
|
|
281
|
+
{ year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", hourCycle: "h23" },
|
|
282
|
+
"en-US"
|
|
283
|
+
).formatToParts(dateObj);
|
|
284
|
+
const part = (type) => parts.find((p) => p.type === type)?.value ?? "";
|
|
285
|
+
return `${part("year")}/${part("month")}/${part("day")}${options?.separator ?? ", "}${part("hour")}:${part("minute")}`;
|
|
286
|
+
}
|
|
287
|
+
function formatTimeWithTimezone(date, timezone, options) {
|
|
288
|
+
return formatDateWithTimezone(
|
|
289
|
+
date,
|
|
290
|
+
timezone,
|
|
291
|
+
{
|
|
292
|
+
hour: "numeric",
|
|
293
|
+
minute: "2-digit",
|
|
294
|
+
// A viewer-locale clock uses the locale's own 12/24h convention.
|
|
295
|
+
...options?.viewerLocale ? {} : { hour12: true },
|
|
296
|
+
...options?.withZoneLabel ? { timeZoneName: "short" } : {}
|
|
297
|
+
},
|
|
298
|
+
{ viewerLocale: options?.viewerLocale }
|
|
299
|
+
);
|
|
300
|
+
}
|
|
301
|
+
function formatProgramDate(at, style = "medium") {
|
|
302
|
+
return formatDateWithTimezone(at.instant ?? at.utcDate, at.timezone, style);
|
|
303
|
+
}
|
|
304
|
+
function isOrderedRange(from, to) {
|
|
305
|
+
if (!from || !to) return false;
|
|
306
|
+
const a = (typeof from === "string" ? new Date(from) : from).getTime();
|
|
307
|
+
const b = (typeof to === "string" ? new Date(to) : to).getTime();
|
|
308
|
+
return Number.isFinite(a) && Number.isFinite(b) && b > a;
|
|
309
|
+
}
|
|
207
310
|
function formatDurationFromRange(startAt, endAt) {
|
|
208
|
-
if (!startAt
|
|
311
|
+
if (!isOrderedRange(startAt, endAt)) return "";
|
|
209
312
|
const start = typeof startAt === "string" ? new Date(startAt) : startAt;
|
|
210
313
|
const end = typeof endAt === "string" ? new Date(endAt) : endAt;
|
|
211
|
-
const
|
|
212
|
-
|
|
314
|
+
const minutes = Math.round((end.getTime() - start.getTime()) / 6e4);
|
|
315
|
+
if (minutes <= 0) return "";
|
|
213
316
|
if (minutes >= 60) {
|
|
214
317
|
const hours = Math.floor(minutes / 60);
|
|
215
318
|
const mins = minutes % 60;
|
|
@@ -232,23 +335,14 @@ function formatDateUTC(value, options = {}) {
|
|
|
232
335
|
}
|
|
233
336
|
}
|
|
234
337
|
if (!Number.isFinite(ms)) return fallback;
|
|
235
|
-
return
|
|
236
|
-
year: "numeric",
|
|
237
|
-
month: "short",
|
|
238
|
-
day: "numeric",
|
|
239
|
-
timeZone: timezone === "local" ? void 0 : "UTC"
|
|
240
|
-
});
|
|
338
|
+
return formatDateWithTimezone(ms, timezone === "local" ? VIEWER_TIMEZONE : null, "medium");
|
|
241
339
|
}
|
|
242
340
|
function formatEntryMonthUTC(entryMonth, style = "short") {
|
|
243
341
|
if (!entryMonth) return null;
|
|
244
|
-
return
|
|
342
|
+
return formatDateWithTimezone(entryMonth, null, style === "long" ? "monthYear" : "monthYearShort");
|
|
245
343
|
}
|
|
246
344
|
function formatLegalDate(dateInput) {
|
|
247
|
-
return
|
|
248
|
-
year: "numeric",
|
|
249
|
-
month: "2-digit",
|
|
250
|
-
day: "2-digit"
|
|
251
|
-
}).format(new Date(dateInput));
|
|
345
|
+
return formatDateWithTimezone(dateInput, null, "numeric");
|
|
252
346
|
}
|
|
253
347
|
function formatCurrency(value) {
|
|
254
348
|
if (value == null) return "N/A";
|
|
@@ -269,16 +363,16 @@ function formatWholeDollars(price, currency = "USD") {
|
|
|
269
363
|
maximumFractionDigits: 0
|
|
270
364
|
}).format(price);
|
|
271
365
|
}
|
|
272
|
-
function formatCompactMetric(value,
|
|
366
|
+
function formatCompactMetric(value, format = "number", options) {
|
|
273
367
|
if (value === 0 || value === null || value === void 0) {
|
|
274
|
-
if (
|
|
275
|
-
if (
|
|
276
|
-
if (
|
|
368
|
+
if (format === "currency") return `${options?.prefix || "$"}0`;
|
|
369
|
+
if (format === "percentage") return "0%";
|
|
370
|
+
if (format === "months") return `0 ${options?.suffix || "months"}`;
|
|
277
371
|
return "0";
|
|
278
372
|
}
|
|
279
373
|
const absValue = Math.abs(value);
|
|
280
374
|
const sign = value < 0 ? "-" : "";
|
|
281
|
-
if (
|
|
375
|
+
if (format === "currency") {
|
|
282
376
|
const prefix = options?.prefix || "$";
|
|
283
377
|
const compact = (val, divisor, suffix) => {
|
|
284
378
|
const divided = val / divisor;
|
|
@@ -290,10 +384,10 @@ function formatCompactMetric(value, format2 = "number", options) {
|
|
|
290
384
|
if (absValue >= 1e3) return `${sign}${prefix}${(absValue / 1e3).toFixed(0)}K`;
|
|
291
385
|
return `${sign}${prefix}${absValue.toLocaleString()}`;
|
|
292
386
|
}
|
|
293
|
-
if (
|
|
387
|
+
if (format === "percentage") {
|
|
294
388
|
return `${sign}${absValue}%`;
|
|
295
389
|
}
|
|
296
|
-
if (
|
|
390
|
+
if (format === "months") {
|
|
297
391
|
const rounded = Math.round(value * 10) / 10;
|
|
298
392
|
return `${rounded} ${options?.suffix || "months"}`;
|
|
299
393
|
}
|
|
@@ -322,31 +416,13 @@ function getTrendColors(direction, polarity = "positive") {
|
|
|
322
416
|
}
|
|
323
417
|
function formatDateRange(start, end) {
|
|
324
418
|
if (!start || !end) return "";
|
|
325
|
-
const fmt = (s) => {
|
|
326
|
-
const bareMatch = /^(\d{4})-(\d{2})-(\d{2})$/.exec(s);
|
|
327
|
-
const d = bareMatch ? new Date(Number(bareMatch[1]), Number(bareMatch[2]) - 1, Number(bareMatch[3])) : new Date(s);
|
|
328
|
-
if (Number.isNaN(d.getTime())) return s;
|
|
329
|
-
return d.toLocaleDateString(void 0, {
|
|
330
|
-
month: "short",
|
|
331
|
-
day: "numeric",
|
|
332
|
-
year: "numeric"
|
|
333
|
-
});
|
|
334
|
-
};
|
|
419
|
+
const fmt = (s) => formatDateWithTimezone(s, /^\d{4}-\d{2}-\d{2}$/.test(s) ? null : VIEWER_TIMEZONE, "medium") || s;
|
|
335
420
|
return `${fmt(start)} \u2014 ${fmt(end)}`;
|
|
336
421
|
}
|
|
337
422
|
function formatDateTimeAt(dateString) {
|
|
338
|
-
const
|
|
339
|
-
const
|
|
340
|
-
|
|
341
|
-
day: "numeric",
|
|
342
|
-
year: "numeric"
|
|
343
|
-
});
|
|
344
|
-
const timeStr = date.toLocaleTimeString("en-US", {
|
|
345
|
-
hour: "numeric",
|
|
346
|
-
minute: "2-digit",
|
|
347
|
-
hour12: true
|
|
348
|
-
});
|
|
349
|
-
return `${dateStr} at ${timeStr}`;
|
|
423
|
+
const dateStr = formatDateWithTimezone(dateString, VIEWER_TIMEZONE, "medium");
|
|
424
|
+
const timeStr = formatTimeWithTimezone(dateString, VIEWER_TIMEZONE);
|
|
425
|
+
return dateStr && timeStr ? `${dateStr} at ${timeStr}` : "";
|
|
350
426
|
}
|
|
351
427
|
function formatDurationFromMs(ms) {
|
|
352
428
|
if (!ms || isNaN(ms) || ms < 0) return "0ms";
|
|
@@ -398,6 +474,21 @@ function formatBioText(aboutHtml, fallback = "") {
|
|
|
398
474
|
}
|
|
399
475
|
return stripHtml(aboutHtml).trim() || fallback;
|
|
400
476
|
}
|
|
477
|
+
function formatProgramTimeRange(at, opts = {}) {
|
|
478
|
+
const source = at.instant ?? at.utcDate ?? opts.startAt;
|
|
479
|
+
const label = opts.withZoneLabel === true;
|
|
480
|
+
const bare = formatTimeWithTimezone(source, at.timezone);
|
|
481
|
+
const labelled = label ? formatTimeWithTimezone(source, at.timezone, { withZoneLabel: true }) : bare;
|
|
482
|
+
const ordered = isOrderedRange(source, opts.endAt);
|
|
483
|
+
const end = ordered && opts.endAt ? formatTimeWithTimezone(opts.endAt, at.timezone, { withZoneLabel: label }) : "";
|
|
484
|
+
if (!bare) return "";
|
|
485
|
+
return end ? `${bare} - ${end}` : labelled;
|
|
486
|
+
}
|
|
487
|
+
function formatWebinarTimeMeta(at, opts) {
|
|
488
|
+
const duration = formatDurationFromRange(opts.startAt, opts.endAt);
|
|
489
|
+
const time = formatProgramTimeRange(at, { startAt: opts.startAt, withZoneLabel: opts.withZoneLabel });
|
|
490
|
+
return [time, duration].filter(Boolean).join(" \xB7 ");
|
|
491
|
+
}
|
|
401
492
|
|
|
402
493
|
// src/components/ui/square-avatar.tsx
|
|
403
494
|
import { memo, forwardRef as forwardRef2 } from "react";
|
|
@@ -1922,21 +2013,11 @@ function ProductReleaseCardSkeleton({ className, size = "lg" }) {
|
|
|
1922
2013
|
}
|
|
1923
2014
|
|
|
1924
2015
|
// src/utils/date-formatters.ts
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
"
|
|
1929
|
-
|
|
1930
|
-
"May",
|
|
1931
|
-
"June",
|
|
1932
|
-
"July",
|
|
1933
|
-
"August",
|
|
1934
|
-
"September",
|
|
1935
|
-
"October",
|
|
1936
|
-
"November",
|
|
1937
|
-
"December"
|
|
1938
|
-
];
|
|
1939
|
-
var MONTHS_SHORT = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
2016
|
+
function formatDayHead(dateString, style) {
|
|
2017
|
+
const ymd = splitYmd(dateString);
|
|
2018
|
+
if (!ymd) return dateString;
|
|
2019
|
+
return formatDateWithTimezone(ymd.join("-"), null, style) || dateString;
|
|
2020
|
+
}
|
|
1940
2021
|
function splitYmd(dateString) {
|
|
1941
2022
|
const head = dateString.split("T")[0];
|
|
1942
2023
|
const parts = head.split("-");
|
|
@@ -1944,22 +2025,13 @@ function splitYmd(dateString) {
|
|
|
1944
2025
|
return [parts[0], parts[1], parts[2]];
|
|
1945
2026
|
}
|
|
1946
2027
|
function formatReleaseDate(dateString) {
|
|
1947
|
-
|
|
1948
|
-
if (!ymd) return dateString;
|
|
1949
|
-
const [year, month, day] = ymd;
|
|
1950
|
-
return `${MONTHS_LONG[parseInt(month) - 1]} ${parseInt(day)}, ${year}`;
|
|
2028
|
+
return formatDayHead(dateString, "long");
|
|
1951
2029
|
}
|
|
1952
2030
|
function formatDateShort(dateString) {
|
|
1953
|
-
|
|
1954
|
-
if (!ymd) return dateString;
|
|
1955
|
-
const [year, month, day] = ymd;
|
|
1956
|
-
return `${MONTHS_SHORT[parseInt(month) - 1]} ${parseInt(day)}, ${year}`;
|
|
2031
|
+
return formatDayHead(dateString, "medium");
|
|
1957
2032
|
}
|
|
1958
2033
|
function formatDateSlashUTC(dateString) {
|
|
1959
|
-
|
|
1960
|
-
if (!ymd) return dateString;
|
|
1961
|
-
const [year, month, day] = ymd;
|
|
1962
|
-
return `${month}/${day}/${year}`;
|
|
2034
|
+
return formatDayHead(dateString, "numeric");
|
|
1963
2035
|
}
|
|
1964
2036
|
|
|
1965
2037
|
// src/utils/release-badge.ts
|
|
@@ -2036,6 +2108,17 @@ function buildProductReleaseCardProps(item) {
|
|
|
2036
2108
|
};
|
|
2037
2109
|
}
|
|
2038
2110
|
|
|
2111
|
+
// src/utils/url-safety.ts
|
|
2112
|
+
var UNSAFE_URL_CHARS = /[\u0000-\u001f\u007f\u200b-\u200d\u2028\u2029\ufeff]/;
|
|
2113
|
+
var SAME_ORIGIN_PROBE = "https://_sameorigin_.invalid";
|
|
2114
|
+
function isSameOriginPath(candidate) {
|
|
2115
|
+
try {
|
|
2116
|
+
return new URL(candidate, SAME_ORIGIN_PROBE).origin === SAME_ORIGIN_PROBE;
|
|
2117
|
+
} catch {
|
|
2118
|
+
return false;
|
|
2119
|
+
}
|
|
2120
|
+
}
|
|
2121
|
+
|
|
2039
2122
|
// src/components/chat/utils/compact-card-classes.ts
|
|
2040
2123
|
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
2124
|
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 +2137,10 @@ var COMPACT_CARD_ROW_FILLER = "\xA0";
|
|
|
2054
2137
|
var SAFE_URL_SCHEMES = ["http:", "https:", "mailto:"];
|
|
2055
2138
|
function safeHref(url) {
|
|
2056
2139
|
if (!url) return null;
|
|
2057
|
-
if (
|
|
2140
|
+
if (UNSAFE_URL_CHARS.test(url)) return null;
|
|
2058
2141
|
const trimmed = url.trim();
|
|
2059
2142
|
if (!trimmed) return null;
|
|
2060
|
-
if (trimmed.startsWith("/")
|
|
2143
|
+
if (trimmed.startsWith("/")) return isSameOriginPath(trimmed) ? trimmed : null;
|
|
2061
2144
|
if (trimmed.startsWith("#")) return trimmed;
|
|
2062
2145
|
if (/^[a-z][a-z0-9+.-]*:$/i.test(trimmed)) return null;
|
|
2063
2146
|
try {
|
|
@@ -2151,12 +2234,7 @@ function BlogCard({
|
|
|
2151
2234
|
});
|
|
2152
2235
|
const { src: displayImage, onError: onImageError } = useCoverImageFallback(post.featured_image, placeholderUrl);
|
|
2153
2236
|
if (size === "sm") {
|
|
2154
|
-
const dateStr2 = post.published_at ?
|
|
2155
|
-
year: "numeric",
|
|
2156
|
-
month: "short",
|
|
2157
|
-
day: "numeric",
|
|
2158
|
-
timeZone: "UTC"
|
|
2159
|
-
}) : "";
|
|
2237
|
+
const dateStr2 = post.published_at ? formatDateWithTimezone(post.published_at, null, "medium") : "";
|
|
2160
2238
|
const firstCategory = post.categories?.find((c) => c && c.name)?.name;
|
|
2161
2239
|
return /* @__PURE__ */ jsxs14(
|
|
2162
2240
|
"a",
|
|
@@ -2196,12 +2274,7 @@ function BlogCard({
|
|
|
2196
2274
|
);
|
|
2197
2275
|
}
|
|
2198
2276
|
if (size === "portrait") {
|
|
2199
|
-
const dateStr2 = post.published_at ?
|
|
2200
|
-
year: "numeric",
|
|
2201
|
-
month: "short",
|
|
2202
|
-
day: "numeric",
|
|
2203
|
-
timeZone: "UTC"
|
|
2204
|
-
}) : "";
|
|
2277
|
+
const dateStr2 = post.published_at ? formatDateWithTimezone(post.published_at, null, "medium") : "";
|
|
2205
2278
|
return /* @__PURE__ */ jsx22(
|
|
2206
2279
|
EntityPortraitCard,
|
|
2207
2280
|
{
|
|
@@ -2222,12 +2295,7 @@ function BlogCard({
|
|
|
2222
2295
|
}
|
|
2223
2296
|
);
|
|
2224
2297
|
}
|
|
2225
|
-
const dateStr = post.published_at ?
|
|
2226
|
-
year: "numeric",
|
|
2227
|
-
month: "short",
|
|
2228
|
-
day: "numeric",
|
|
2229
|
-
timeZone: "UTC"
|
|
2230
|
-
}) : "";
|
|
2298
|
+
const dateStr = post.published_at ? formatDateWithTimezone(post.published_at, null, "medium") : "";
|
|
2231
2299
|
return /* @__PURE__ */ jsx22(
|
|
2232
2300
|
"article",
|
|
2233
2301
|
{
|
|
@@ -2628,12 +2696,7 @@ function CustomerInterviewCard({
|
|
|
2628
2696
|
// src/components/chat/types/entities/investor-update.ts
|
|
2629
2697
|
function formatInvestorUpdatePeriod(start, end, options) {
|
|
2630
2698
|
if (!start && !end) return "";
|
|
2631
|
-
const fmt = (d) =>
|
|
2632
|
-
month: options?.monthFormat || "short",
|
|
2633
|
-
year: "numeric",
|
|
2634
|
-
// Pin to UTC so SSR (Vercel = UTC) and the client agree (React #418).
|
|
2635
|
-
timeZone: "UTC"
|
|
2636
|
-
});
|
|
2699
|
+
const fmt = (d) => formatDateWithTimezone(d, null, options?.monthFormat === "long" ? "monthYear" : "monthYearShort") || "?";
|
|
2637
2700
|
const s = start ? fmt(start) : "?";
|
|
2638
2701
|
const e = end ? fmt(end) : "?";
|
|
2639
2702
|
return `${s} - ${e}`;
|
|
@@ -3535,6 +3598,53 @@ function partitionMediaByType(media) {
|
|
|
3535
3598
|
};
|
|
3536
3599
|
}
|
|
3537
3600
|
|
|
3601
|
+
// src/utils/program-instant.ts
|
|
3602
|
+
var programStr = (value) => typeof value === "string" && value ? value : null;
|
|
3603
|
+
function programDateInstant(item) {
|
|
3604
|
+
const timezone = programStr(item.timezone);
|
|
3605
|
+
const date = programStr(item.date);
|
|
3606
|
+
const startAt = programStr(item.start_at);
|
|
3607
|
+
return {
|
|
3608
|
+
instant: timezone ? date ?? startAt : null,
|
|
3609
|
+
timezone,
|
|
3610
|
+
utcDate: date ?? startAt
|
|
3611
|
+
};
|
|
3612
|
+
}
|
|
3613
|
+
function webinarTiming(item) {
|
|
3614
|
+
return { startAt: programStr(item.start_at), endAt: programStr(item.end_at) };
|
|
3615
|
+
}
|
|
3616
|
+
function programMetaLine(item, kind, fmt) {
|
|
3617
|
+
const at = programDateInstant(item);
|
|
3618
|
+
const isScheduled = item.status === "scheduled";
|
|
3619
|
+
let typeMeta = null;
|
|
3620
|
+
if (kind === "podcast" && typeof item.duration_seconds === "number" && item.duration_seconds > 0 && !isScheduled) {
|
|
3621
|
+
typeMeta = fmt.duration(item.duration_seconds);
|
|
3622
|
+
} else if (kind === "event" && typeof item.location_name === "string" && item.location_name.trim().length > 0) {
|
|
3623
|
+
typeMeta = item.location_name;
|
|
3624
|
+
} else if (kind === "webinar" && programStr(item.start_at)) {
|
|
3625
|
+
typeMeta = fmt.webinarMeta(at, webinarTiming(item)) || null;
|
|
3626
|
+
}
|
|
3627
|
+
return { at, typeMeta, line: [fmt.date(at), typeMeta].filter(Boolean).join(" \xB7 ") };
|
|
3628
|
+
}
|
|
3629
|
+
function programMetaFormatters(fmt, opts = {}) {
|
|
3630
|
+
const withZoneLabel = opts.withZoneLabel !== false;
|
|
3631
|
+
return {
|
|
3632
|
+
// The meta line always renders the compact day; the one surface that wants
|
|
3633
|
+
// the weekday form renders it in its own slot, so a `dateStyle` option here
|
|
3634
|
+
// would exist for no caller.
|
|
3635
|
+
date: (at) => fmt.date(at, "medium"),
|
|
3636
|
+
duration: fmt.duration,
|
|
3637
|
+
webinarMeta: (at, o) => fmt.webinarMeta(at, { ...o, withZoneLabel })
|
|
3638
|
+
};
|
|
3639
|
+
}
|
|
3640
|
+
|
|
3641
|
+
// src/utils/program-meta-renderers.ts
|
|
3642
|
+
var PROGRAM_META_RENDERERS = {
|
|
3643
|
+
date: formatProgramDate,
|
|
3644
|
+
duration: formatDurationCompact,
|
|
3645
|
+
webinarMeta: formatWebinarTimeMeta
|
|
3646
|
+
};
|
|
3647
|
+
|
|
3538
3648
|
// src/components/chat/types/entities/program-types.ts
|
|
3539
3649
|
function programItemToStripProfile(item) {
|
|
3540
3650
|
const fromAuthor = toStripProfile(item.author);
|
|
@@ -3543,87 +3653,11 @@ function programItemToStripProfile(item) {
|
|
|
3543
3653
|
if (!host?.name) return null;
|
|
3544
3654
|
return toStripProfile({ full_name: host.name, avatar_url: host.avatar_url ?? null });
|
|
3545
3655
|
}
|
|
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
3656
|
|
|
3618
3657
|
// src/components/chat/entity-cards/program-card.tsx
|
|
3619
|
-
import { format } from "date-fns";
|
|
3620
3658
|
import { ExternalLink as ExternalLink2, Clock as Clock2, Play as Play3, Video as Video2 } from "lucide-react";
|
|
3621
3659
|
import { useState as useState6 } from "react";
|
|
3622
3660
|
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
3661
|
function ProgramCardSkeleton({ size = "default" }) {
|
|
3628
3662
|
if (size === "sm") {
|
|
3629
3663
|
return /* @__PURE__ */ jsxs21("span", { className: COMPACT_CARD_SKELETON_OUTER, children: [
|
|
@@ -3688,14 +3722,6 @@ function getHosts(hosts) {
|
|
|
3688
3722
|
}
|
|
3689
3723
|
return [];
|
|
3690
3724
|
}
|
|
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
3725
|
function MediaGallery({ images, title }) {
|
|
3700
3726
|
const [selectedImageIndex, setSelectedImageIndex] = useState6(null);
|
|
3701
3727
|
const [isModalOpen, setIsModalOpen] = useState6(false);
|
|
@@ -3774,25 +3800,17 @@ function ProgramCard({
|
|
|
3774
3800
|
const hosts = getHosts(item.hosts);
|
|
3775
3801
|
const accentColor = "var(--color-accent-primary)";
|
|
3776
3802
|
const isScheduled = "status" in item && item.status === "scheduled";
|
|
3777
|
-
const
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
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");
|
|
3803
|
+
const {
|
|
3804
|
+
at: zonedDate,
|
|
3805
|
+
typeMeta: compactTypeMetaValue,
|
|
3806
|
+
line: compactMetaLine
|
|
3807
|
+
// Compact densities join plain strings, so the zone rides inline here; the
|
|
3808
|
+
// default density below renders it as its own styled span instead.
|
|
3809
|
+
} = programMetaLine(item, config.type, programMetaFormatters(PROGRAM_META_RENDERERS));
|
|
3810
|
+
const compactDate = formatProgramDate(zonedDate, "medium");
|
|
3793
3811
|
if (size === "portrait") {
|
|
3794
3812
|
const profile = programItemToStripProfile(item);
|
|
3795
|
-
const dateMeta =
|
|
3813
|
+
const dateMeta = compactMetaLine;
|
|
3796
3814
|
return /* @__PURE__ */ jsx31(
|
|
3797
3815
|
EntityPortraitCard,
|
|
3798
3816
|
{
|
|
@@ -3811,10 +3829,10 @@ function ProgramCard({
|
|
|
3811
3829
|
);
|
|
3812
3830
|
}
|
|
3813
3831
|
if (size === "sm") {
|
|
3814
|
-
const
|
|
3832
|
+
const itemDate = compactDate;
|
|
3815
3833
|
const compactCover = coverImage || placeholderUrl || null;
|
|
3816
|
-
const typeMeta =
|
|
3817
|
-
const subtitleParts = [
|
|
3834
|
+
const typeMeta = compactTypeMetaValue;
|
|
3835
|
+
const subtitleParts = [itemDate, typeMeta, config.labels?.singular].filter(
|
|
3818
3836
|
(s) => typeof s === "string" && s.length > 0
|
|
3819
3837
|
);
|
|
3820
3838
|
return /* @__PURE__ */ jsxs21("a", { href, target, rel, className: cn(COMPACT_CARD_OUTER, className), children: [
|
|
@@ -3830,32 +3848,29 @@ function ProgramCard({
|
|
|
3830
3848
|
/* @__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
3849
|
] });
|
|
3832
3850
|
}
|
|
3833
|
-
const
|
|
3834
|
-
const
|
|
3851
|
+
const dateFormat = formatProgramDate(zonedDate, "weekday");
|
|
3852
|
+
const { typeMeta: defaultTypeMeta } = programMetaLine(
|
|
3853
|
+
item,
|
|
3854
|
+
config.type,
|
|
3855
|
+
programMetaFormatters(PROGRAM_META_RENDERERS, { withZoneLabel: false })
|
|
3856
|
+
);
|
|
3835
3857
|
const defaultRenderMeta = () => {
|
|
3836
|
-
if (config.type === "podcast"
|
|
3837
|
-
|
|
3838
|
-
return /* @__PURE__ */ jsxs21(Fragment9, { children: [
|
|
3858
|
+
if (config.type === "podcast") {
|
|
3859
|
+
return defaultTypeMeta ? /* @__PURE__ */ jsxs21(Fragment9, { children: [
|
|
3839
3860
|
/* @__PURE__ */ jsx31(Clock2, { className: "h-4 w-4 text-ods-text-secondary" }),
|
|
3840
|
-
/* @__PURE__ */ jsx31("span", { className: "font-body text-ods-text-secondary", children:
|
|
3841
|
-
] });
|
|
3861
|
+
/* @__PURE__ */ jsx31("span", { className: "font-body text-ods-text-secondary", children: defaultTypeMeta })
|
|
3862
|
+
] }) : null;
|
|
3842
3863
|
}
|
|
3843
|
-
if (config.type === "event"
|
|
3844
|
-
|
|
3845
|
-
return /* @__PURE__ */ jsx31("span", { className: "font-body text-ods-text-secondary", children: typeof loc === "string" && loc || "Location TBD" });
|
|
3864
|
+
if (config.type === "event") {
|
|
3865
|
+
return defaultTypeMeta ? /* @__PURE__ */ jsx31("span", { className: "font-body text-ods-text-secondary", children: defaultTypeMeta }) : null;
|
|
3846
3866
|
}
|
|
3847
|
-
if (config.type === "webinar" &&
|
|
3848
|
-
const { startAt, endAt, timezone } = webinarTiming(item);
|
|
3849
|
-
const duration = formatDurationFromRange(startAt, endAt);
|
|
3867
|
+
if (config.type === "webinar" && (defaultTypeMeta || zonedDate.timezone)) {
|
|
3850
3868
|
return /* @__PURE__ */ jsxs21(Fragment9, { children: [
|
|
3851
3869
|
/* @__PURE__ */ jsx31(Video2, { className: "h-4 w-4 text-ods-text-secondary" }),
|
|
3852
|
-
/* @__PURE__ */
|
|
3853
|
-
|
|
3854
|
-
duration && ` \xB7 ${duration}`
|
|
3855
|
-
] }),
|
|
3856
|
-
timezone && /* @__PURE__ */ jsxs21("span", { className: "text-ods-text-secondary text-h6", children: [
|
|
3870
|
+
defaultTypeMeta && /* @__PURE__ */ jsx31("span", { className: "font-body text-ods-text-secondary", children: defaultTypeMeta }),
|
|
3871
|
+
zonedDate.timezone && /* @__PURE__ */ jsxs21("span", { className: "text-ods-text-secondary text-h6", children: [
|
|
3857
3872
|
"(",
|
|
3858
|
-
timezone,
|
|
3873
|
+
zonedDate.timezone,
|
|
3859
3874
|
")"
|
|
3860
3875
|
] })
|
|
3861
3876
|
] });
|
|
@@ -4077,7 +4092,12 @@ export {
|
|
|
4077
4092
|
singleInitial,
|
|
4078
4093
|
formatDurationMMSS,
|
|
4079
4094
|
formatDurationCompact,
|
|
4095
|
+
VIEWER_TIMEZONE,
|
|
4096
|
+
formatDateWithTimezone,
|
|
4097
|
+
formatDateTimeYmd,
|
|
4080
4098
|
formatTimeWithTimezone,
|
|
4099
|
+
formatProgramDate,
|
|
4100
|
+
isOrderedRange,
|
|
4081
4101
|
formatDurationFromRange,
|
|
4082
4102
|
formatDateUTC,
|
|
4083
4103
|
formatEntryMonthUTC,
|
|
@@ -4097,6 +4117,8 @@ export {
|
|
|
4097
4117
|
formatClassification,
|
|
4098
4118
|
formatPricingModel,
|
|
4099
4119
|
formatBioText,
|
|
4120
|
+
formatProgramTimeRange,
|
|
4121
|
+
formatWebinarTimeMeta,
|
|
4100
4122
|
SquareAvatar,
|
|
4101
4123
|
InteractiveCard,
|
|
4102
4124
|
Modal,
|
|
@@ -4158,6 +4180,7 @@ export {
|
|
|
4158
4180
|
resolveReleaseCover,
|
|
4159
4181
|
defaultBuildProductReleaseCardProps,
|
|
4160
4182
|
buildProductReleaseCardProps,
|
|
4183
|
+
UNSAFE_URL_CHARS,
|
|
4161
4184
|
COMPACT_CARD_OUTER,
|
|
4162
4185
|
COMPACT_CARD_OUTER_STATIC,
|
|
4163
4186
|
COMPACT_CARD_SKELETON_OUTER,
|
|
@@ -4198,10 +4221,13 @@ export {
|
|
|
4198
4221
|
isImageMedia,
|
|
4199
4222
|
isPublishableMediaType,
|
|
4200
4223
|
partitionMediaByType,
|
|
4224
|
+
programStr,
|
|
4225
|
+
programDateInstant,
|
|
4226
|
+
webinarTiming,
|
|
4227
|
+
programMetaLine,
|
|
4228
|
+
programMetaFormatters,
|
|
4229
|
+
PROGRAM_META_RENDERERS,
|
|
4201
4230
|
programItemToStripProfile,
|
|
4202
|
-
transformEventToProgram,
|
|
4203
|
-
transformPodcastToProgram,
|
|
4204
|
-
transformWebinarToProgram,
|
|
4205
4231
|
ProgramCardSkeleton,
|
|
4206
4232
|
ProgramCard,
|
|
4207
4233
|
extractItems,
|
|
@@ -4209,4 +4235,4 @@ export {
|
|
|
4209
4235
|
canonicalContentRefType,
|
|
4210
4236
|
buildListUrl
|
|
4211
4237
|
};
|
|
4212
|
-
//# sourceMappingURL=chunk-
|
|
4238
|
+
//# sourceMappingURL=chunk-FOSIR4QF.js.map
|