@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.
- package/dist/chat-protocol/index.cjs +20 -3
- package/dist/chat-protocol/index.cjs.map +1 -1
- package/dist/chat-protocol/index.js +20 -3
- package/dist/chat-protocol/index.js.map +1 -1
- package/dist/chat-protocol/source-metadata.d.ts +7 -1
- package/dist/chat-protocol/source-metadata.d.ts.map +1 -1
- package/dist/{chunk-B42INNRA.cjs → chunk-2UA3DT5O.cjs} +199 -199
- package/dist/{chunk-B42INNRA.cjs.map → chunk-2UA3DT5O.cjs.map} +1 -1
- package/dist/{chunk-KX2FT7AS.cjs → chunk-2ZGEXLQW.cjs} +28 -28
- package/dist/{chunk-KX2FT7AS.cjs.map → chunk-2ZGEXLQW.cjs.map} +1 -1
- package/dist/{chunk-2NRLRRMR.cjs → chunk-3HSRNCDV.cjs} +226 -203
- package/dist/chunk-3HSRNCDV.cjs.map +1 -0
- package/dist/{chunk-64KDKDYC.js → chunk-5ELZ2NQ5.js} +6 -6
- package/dist/{chunk-2DJH6KHA.cjs → chunk-B46Q4DTN.cjs} +382 -386
- package/dist/chunk-B46Q4DTN.cjs.map +1 -0
- package/dist/{chunk-N7UYD57Q.js → chunk-C7RU466R.js} +3 -3
- package/dist/{chunk-2NODQ7FO.js → chunk-DSJZYRS6.js} +17 -21
- package/dist/{chunk-2NODQ7FO.js.map → chunk-DSJZYRS6.js.map} +1 -1
- package/dist/{chunk-26D6FM6L.cjs → chunk-EKSCVXA3.cjs} +6 -6
- package/dist/{chunk-26D6FM6L.cjs.map → chunk-EKSCVXA3.cjs.map} +1 -1
- package/dist/{chunk-7HL2PNQ3.js → chunk-GEGE3JXC.js} +5 -5
- package/dist/{chunk-7T673MHJ.cjs → chunk-GUB6BR26.cjs} +22 -22
- package/dist/{chunk-7T673MHJ.cjs.map → chunk-GUB6BR26.cjs.map} +1 -1
- package/dist/{chunk-3IPL6G7S.js → chunk-GXNQPCL4.js} +164 -141
- package/dist/chunk-GXNQPCL4.js.map +1 -0
- package/dist/{chunk-D6TWJEFW.cjs → chunk-GZXW5QWQ.cjs} +15 -15
- package/dist/{chunk-D6TWJEFW.cjs.map → chunk-GZXW5QWQ.cjs.map} +1 -1
- package/dist/{chunk-4TE53O6U.js → chunk-HAQRGJFL.js} +4 -4
- package/dist/{chunk-TIOHTWDA.js → chunk-INISTVWK.js} +6 -6
- package/dist/{chunk-IU3IYXMM.js → chunk-IRV2W7GN.js} +7 -7
- package/dist/{chunk-R2IU2Y2O.cjs → chunk-JWCAWGLG.cjs} +33 -33
- package/dist/{chunk-R2IU2Y2O.cjs.map → chunk-JWCAWGLG.cjs.map} +1 -1
- package/dist/{chunk-77EO26XV.cjs → chunk-LNLNPCII.cjs} +5 -5
- package/dist/{chunk-77EO26XV.cjs.map → chunk-LNLNPCII.cjs.map} +1 -1
- package/dist/{chunk-42NXGOTG.cjs → chunk-N3M56EE5.cjs} +3 -3
- package/dist/{chunk-42NXGOTG.cjs.map → chunk-N3M56EE5.cjs.map} +1 -1
- package/dist/{chunk-O7JMF5OT.js → chunk-O47SGDBV.js} +3 -3
- package/dist/{chunk-EWQI5MV6.cjs → chunk-OANRA5ML.cjs} +20 -20
- package/dist/{chunk-EWQI5MV6.cjs.map → chunk-OANRA5ML.cjs.map} +1 -1
- package/dist/{chunk-NCHLLTAR.js → chunk-PR6IR22M.js} +3 -3
- package/dist/{chunk-6MQBLFUM.js → chunk-Q7JDIDE2.js} +5 -5
- package/dist/{chunk-YG7KLZE7.js → chunk-R5EIFOW2.js} +4 -4
- package/dist/{chunk-5E6Y6766.cjs → chunk-S2E4I3WP.cjs} +29 -29
- package/dist/{chunk-5E6Y6766.cjs.map → chunk-S2E4I3WP.cjs.map} +1 -1
- package/dist/{chunk-SE6YRE3R.cjs → chunk-SAD5IUSO.cjs} +32 -32
- package/dist/{chunk-SE6YRE3R.cjs.map → chunk-SAD5IUSO.cjs.map} +1 -1
- package/dist/{chunk-3LXJEXPH.js → chunk-TAP4MJPF.js} +2 -2
- package/dist/{chunk-M3W5Y5DK.cjs → chunk-TEKH3J65.cjs} +11 -11
- package/dist/{chunk-M3W5Y5DK.cjs.map → chunk-TEKH3J65.cjs.map} +1 -1
- package/dist/{chunk-HA2U7WHU.js → chunk-TXNWDP3M.js} +3 -3
- package/dist/{chunk-IIZX3K2R.js → chunk-URGDDCJL.js} +2 -2
- package/dist/{chunk-TQ7KTANJ.js → chunk-V52INSJH.js} +3 -3
- package/dist/{chunk-FO7SD2IQ.cjs → chunk-VA6N7IVZ.cjs} +6 -6
- package/dist/{chunk-FO7SD2IQ.cjs.map → chunk-VA6N7IVZ.cjs.map} +1 -1
- package/dist/{chunk-CWHLVXUW.cjs → chunk-WYS66RIO.cjs} +10 -10
- package/dist/{chunk-CWHLVXUW.cjs.map → chunk-WYS66RIO.cjs.map} +1 -1
- package/dist/{chunk-XJLWGYL4.cjs → chunk-XVGWYNRY.cjs} +81 -81
- package/dist/{chunk-XJLWGYL4.cjs.map → chunk-XVGWYNRY.cjs.map} +1 -1
- package/dist/{chunk-ZU2JBBOE.cjs → chunk-XYJ3URIN.cjs} +59 -59
- package/dist/{chunk-ZU2JBBOE.cjs.map → chunk-XYJ3URIN.cjs.map} +1 -1
- package/dist/{chunk-FVIT23I5.js → chunk-Z5KAIEZ4.js} +3 -3
- package/dist/{chunk-YT6RGA3X.js → chunk-ZPLT4XLC.js} +3 -3
- package/dist/components/case-studies/index.cjs +16 -16
- package/dist/components/case-studies/index.js +4 -4
- 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/program-types.d.ts +29 -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/meeting-scheduler/index.cjs +34 -34
- package/dist/components/meeting-scheduler/index.js +3 -3
- 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/tickets/index.cjs +8 -8
- package/dist/components/tickets/index.js +7 -7
- 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/index.cjs +24 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +30 -14
- package/dist/index.js.map +1 -1
- package/dist/utils/format.d.ts +127 -4
- package/dist/utils/format.d.ts.map +1 -1
- package/dist/utils/index.cjs +113 -5
- 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 +103 -6
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/program-instant.d.ts +171 -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 +35 -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 +76 -0
- package/src/chat-protocol/source-metadata.ts +40 -6
- package/src/components/chat/entity-cards/.program-card.md +1 -1
- 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/program-types.ts +29 -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/utils/.format.md +5 -2
- package/src/utils/__tests__/format-program-dates.test.ts +180 -0
- package/src/utils/__tests__/program-instant.test.ts +170 -0
- package/src/utils/__tests__/url-safety.test.ts +44 -0
- package/src/utils/format.ts +228 -13
- package/src/utils/index.ts +22 -0
- package/src/utils/program-instant.ts +211 -0
- package/src/utils/program-meta-renderers.ts +18 -0
- package/src/utils/url-safety.ts +45 -0
- package/dist/chunk-2DJH6KHA.cjs.map +0 -1
- package/dist/chunk-2NRLRRMR.cjs.map +0 -1
- package/dist/chunk-3IPL6G7S.js.map +0 -1
- /package/dist/{chunk-64KDKDYC.js.map → chunk-5ELZ2NQ5.js.map} +0 -0
- /package/dist/{chunk-N7UYD57Q.js.map → chunk-C7RU466R.js.map} +0 -0
- /package/dist/{chunk-7HL2PNQ3.js.map → chunk-GEGE3JXC.js.map} +0 -0
- /package/dist/{chunk-4TE53O6U.js.map → chunk-HAQRGJFL.js.map} +0 -0
- /package/dist/{chunk-TIOHTWDA.js.map → chunk-INISTVWK.js.map} +0 -0
- /package/dist/{chunk-IU3IYXMM.js.map → chunk-IRV2W7GN.js.map} +0 -0
- /package/dist/{chunk-O7JMF5OT.js.map → chunk-O47SGDBV.js.map} +0 -0
- /package/dist/{chunk-NCHLLTAR.js.map → chunk-PR6IR22M.js.map} +0 -0
- /package/dist/{chunk-6MQBLFUM.js.map → chunk-Q7JDIDE2.js.map} +0 -0
- /package/dist/{chunk-YG7KLZE7.js.map → chunk-R5EIFOW2.js.map} +0 -0
- /package/dist/{chunk-3LXJEXPH.js.map → chunk-TAP4MJPF.js.map} +0 -0
- /package/dist/{chunk-HA2U7WHU.js.map → chunk-TXNWDP3M.js.map} +0 -0
- /package/dist/{chunk-IIZX3K2R.js.map → chunk-URGDDCJL.js.map} +0 -0
- /package/dist/{chunk-TQ7KTANJ.js.map → chunk-V52INSJH.js.map} +0 -0
- /package/dist/{chunk-FVIT23I5.js.map → chunk-Z5KAIEZ4.js.map} +0 -0
- /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
|
|
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
|
|
212
|
-
|
|
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,
|
|
303
|
+
function formatCompactMetric(value, format = "number", options) {
|
|
273
304
|
if (value === 0 || value === null || value === void 0) {
|
|
274
|
-
if (
|
|
275
|
-
if (
|
|
276
|
-
if (
|
|
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 (
|
|
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 (
|
|
324
|
+
if (format === "percentage") {
|
|
294
325
|
return `${sign}${absValue}%`;
|
|
295
326
|
}
|
|
296
|
-
if (
|
|
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 (
|
|
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("/")
|
|
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
|
|
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");
|
|
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 =
|
|
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
|
|
3830
|
+
const itemDate = compactDate;
|
|
3815
3831
|
const compactCover = coverImage || placeholderUrl || null;
|
|
3816
|
-
const typeMeta =
|
|
3817
|
-
const subtitleParts = [
|
|
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
|
|
3834
|
-
const
|
|
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"
|
|
3837
|
-
|
|
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:
|
|
3841
|
-
] });
|
|
3859
|
+
/* @__PURE__ */ jsx31("span", { className: "font-body text-ods-text-secondary", children: defaultTypeMeta })
|
|
3860
|
+
] }) : null;
|
|
3842
3861
|
}
|
|
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" });
|
|
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" &&
|
|
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__ */
|
|
3853
|
-
|
|
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-
|
|
4235
|
+
//# sourceMappingURL=chunk-GXNQPCL4.js.map
|