@aranova/tracking-react 1.18.0 → 1.20.0
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/{bookings-CVvpj_8K.d.mts → bookings-BpLjL5w1.d.mts} +25 -1
- package/dist/{bookings-CCGpXhYE.d.ts → bookings-CSDPoT-I.d.ts} +25 -1
- package/dist/client.d.mts +121 -4
- package/dist/client.d.ts +121 -4
- package/dist/client.js +1685 -31
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +1687 -31
- package/dist/client.mjs.map +1 -1
- package/dist/index.d.mts +15 -39
- package/dist/index.d.ts +15 -39
- package/dist/index.js +178 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +176 -6
- package/dist/index.mjs.map +1 -1
- package/dist/{ingest-typed-CoCjTqJs.d.mts → ingest-typed-BEFQd3WM.d.mts} +200 -2
- package/dist/{ingest-typed-C3XAjHlH.d.ts → ingest-typed-DChvvgwd.d.ts} +200 -2
- package/dist/{sales-Dlc_umAV.d.ts → sales-CM_dxsf8.d.ts} +1 -1
- package/dist/{sales-B1ONR-Yi.d.mts → sales-agx4zLC9.d.mts} +1 -1
- package/dist/sales.d.mts +2 -2
- package/dist/sales.d.ts +2 -2
- package/dist/sales.js +115 -5
- package/dist/sales.js.map +1 -1
- package/dist/sales.mjs +115 -5
- package/dist/sales.mjs.map +1 -1
- package/package.json +1 -1
package/dist/client.mjs
CHANGED
|
@@ -255,7 +255,8 @@ var TRACKING_CAPABILITIES = [
|
|
|
255
255
|
"form_capture",
|
|
256
256
|
"phone_click_capture",
|
|
257
257
|
"phone_fields",
|
|
258
|
-
"typed_form_submit"
|
|
258
|
+
"typed_form_submit",
|
|
259
|
+
"video_tracking"
|
|
259
260
|
];
|
|
260
261
|
var CAPABILITY_DOM_ATTRIBUTE = "data-aranova-capability";
|
|
261
262
|
var registered = /* @__PURE__ */ new Set();
|
|
@@ -1036,8 +1037,48 @@ function parseTrigger(value) {
|
|
|
1036
1037
|
if (typeof t.threshold_seconds === "number") spec.threshold_seconds = t.threshold_seconds;
|
|
1037
1038
|
if (typeof t.page_threshold === "number") spec.page_threshold = t.page_threshold;
|
|
1038
1039
|
if (typeof t.page_name === "string") spec.page_name = t.page_name;
|
|
1040
|
+
if (t.metric === "percent" || t.metric === "seconds") spec.metric = t.metric;
|
|
1041
|
+
if (typeof t.threshold === "number") spec.threshold = t.threshold;
|
|
1042
|
+
if (typeof t.video_id === "string" || t.video_id === null) spec.video_id = t.video_id;
|
|
1039
1043
|
return spec;
|
|
1040
1044
|
}
|
|
1045
|
+
function parseVideoEntry(fallbackKey2, entry) {
|
|
1046
|
+
const key = typeof entry.key === "string" && entry.key ? entry.key : fallbackKey2;
|
|
1047
|
+
if (!key) return null;
|
|
1048
|
+
const host = typeof entry.host === "string" ? entry.host : "";
|
|
1049
|
+
const title = typeof entry.title === "string" && entry.title ? entry.title : key;
|
|
1050
|
+
const sourcesRaw = isRecord(entry.sources) ? entry.sources : null;
|
|
1051
|
+
const desktop = sourcesRaw && typeof sourcesRaw.desktop === "string" ? sourcesRaw.desktop : typeof entry.desktop_uid === "string" ? entry.desktop_uid : "";
|
|
1052
|
+
if (!host || !desktop) return null;
|
|
1053
|
+
const mobile = sourcesRaw && typeof sourcesRaw.mobile === "string" ? sourcesRaw.mobile : typeof entry.mobile_uid === "string" ? entry.mobile_uid : null;
|
|
1054
|
+
const posterTime = typeof entry.poster_time === "number" ? entry.poster_time : typeof entry.poster_time_s === "number" ? entry.poster_time_s : 4;
|
|
1055
|
+
return {
|
|
1056
|
+
key,
|
|
1057
|
+
title,
|
|
1058
|
+
host,
|
|
1059
|
+
sources: { desktop, mobile },
|
|
1060
|
+
poster_time: posterTime,
|
|
1061
|
+
duration_s: typeof entry.duration_s === "number" ? entry.duration_s : null
|
|
1062
|
+
};
|
|
1063
|
+
}
|
|
1064
|
+
function parseVideos(value) {
|
|
1065
|
+
const out = {};
|
|
1066
|
+
if (Array.isArray(value)) {
|
|
1067
|
+
for (const item of value) {
|
|
1068
|
+
if (!isRecord(item)) continue;
|
|
1069
|
+
const parsed = parseVideoEntry("", item);
|
|
1070
|
+
if (parsed) out[parsed.key] = parsed;
|
|
1071
|
+
}
|
|
1072
|
+
return out;
|
|
1073
|
+
}
|
|
1074
|
+
if (!isRecord(value)) return out;
|
|
1075
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
1076
|
+
if (!isRecord(entry)) continue;
|
|
1077
|
+
const parsed = parseVideoEntry(key, entry);
|
|
1078
|
+
if (parsed) out[parsed.key] = parsed;
|
|
1079
|
+
}
|
|
1080
|
+
return out;
|
|
1081
|
+
}
|
|
1041
1082
|
function parseConversionConfig(raw) {
|
|
1042
1083
|
if (!raw || typeof raw !== "object") return null;
|
|
1043
1084
|
const obj = raw;
|
|
@@ -1088,7 +1129,8 @@ function parseConversionConfig(raw) {
|
|
|
1088
1129
|
goals,
|
|
1089
1130
|
linked_hostnames: Array.isArray(obj.linked_hostnames) ? obj.linked_hostnames.filter((h) => typeof h === "string" && h.length > 0) : [],
|
|
1090
1131
|
integrations: parseIntegrations(obj.integrations),
|
|
1091
|
-
lead_forms: parseLeadForms(obj.lead_forms)
|
|
1132
|
+
lead_forms: parseLeadForms(obj.lead_forms),
|
|
1133
|
+
videos: parseVideos(obj.videos)
|
|
1092
1134
|
};
|
|
1093
1135
|
}
|
|
1094
1136
|
function parseLeadForms(value) {
|
|
@@ -1334,6 +1376,21 @@ function automaticThresholdMet(goal, eventType, metadata) {
|
|
|
1334
1376
|
case "form_start":
|
|
1335
1377
|
case "phone_click":
|
|
1336
1378
|
return true;
|
|
1379
|
+
case "video_play":
|
|
1380
|
+
return trigger.video_id == null || hasStringField(metadata, "video_id") && metadata.video_id === trigger.video_id;
|
|
1381
|
+
case "video_progress": {
|
|
1382
|
+
if (trigger.video_id != null && (!hasStringField(metadata, "video_id") || metadata.video_id !== trigger.video_id)) {
|
|
1383
|
+
return false;
|
|
1384
|
+
}
|
|
1385
|
+
if (typeof trigger.threshold !== "number") return false;
|
|
1386
|
+
if (trigger.metric === "seconds") {
|
|
1387
|
+
return hasNumberField(metadata, "watched_s") && metadata.watched_s >= trigger.threshold;
|
|
1388
|
+
}
|
|
1389
|
+
if (trigger.metric === "percent") {
|
|
1390
|
+
return hasNumberField(metadata, "max_percent") && metadata.max_percent >= trigger.threshold || hasNumberField(metadata, "watched_percent") && metadata.watched_percent >= trigger.threshold;
|
|
1391
|
+
}
|
|
1392
|
+
return false;
|
|
1393
|
+
}
|
|
1337
1394
|
default:
|
|
1338
1395
|
return false;
|
|
1339
1396
|
}
|
|
@@ -1370,6 +1427,9 @@ var RETRY_BASE_MS = 5e3;
|
|
|
1370
1427
|
var RETRY_MAX_MS = 5 * 6e4;
|
|
1371
1428
|
var runtimes = /* @__PURE__ */ new Map();
|
|
1372
1429
|
var configuredIds = /* @__PURE__ */ new Set();
|
|
1430
|
+
var EMPTY_GOALS = [];
|
|
1431
|
+
var EMPTY_STRINGS = [];
|
|
1432
|
+
var EMPTY_VIDEOS = {};
|
|
1373
1433
|
var scriptLoad = null;
|
|
1374
1434
|
var jsInitialized = false;
|
|
1375
1435
|
function cacheKey2(url) {
|
|
@@ -1560,11 +1620,11 @@ var TrackingConfigRuntime = class {
|
|
|
1560
1620
|
void this.flush();
|
|
1561
1621
|
}
|
|
1562
1622
|
listGoals() {
|
|
1563
|
-
return this.current?.goals ??
|
|
1623
|
+
return this.current?.goals ?? EMPTY_GOALS;
|
|
1564
1624
|
}
|
|
1565
1625
|
/** Sibling hostnames for the linker — read from the cached object even while unconfirmed. */
|
|
1566
1626
|
linkedHostnames() {
|
|
1567
|
-
return this.current?.linked_hostnames ??
|
|
1627
|
+
return this.current?.linked_hostnames ?? EMPTY_STRINGS;
|
|
1568
1628
|
}
|
|
1569
1629
|
/**
|
|
1570
1630
|
* Integration blocks, from the cached object even while unconfirmed: the booking fallback
|
|
@@ -1577,6 +1637,14 @@ var TrackingConfigRuntime = class {
|
|
|
1577
1637
|
leadForms() {
|
|
1578
1638
|
return this.current?.lead_forms ?? null;
|
|
1579
1639
|
}
|
|
1640
|
+
/** Configured Cloudflare Stream tracked videos for this site. */
|
|
1641
|
+
videos() {
|
|
1642
|
+
return this.current?.videos ?? EMPTY_VIDEOS;
|
|
1643
|
+
}
|
|
1644
|
+
/** Look up one configured Cloudflare Stream tracked video by key. */
|
|
1645
|
+
getVideo(key) {
|
|
1646
|
+
return this.current?.videos?.[key] ?? null;
|
|
1647
|
+
}
|
|
1580
1648
|
async revalidateNow() {
|
|
1581
1649
|
try {
|
|
1582
1650
|
const headers = {};
|
|
@@ -1733,6 +1801,16 @@ var TrackingConfigRuntime = class {
|
|
|
1733
1801
|
this.scheduleRetry();
|
|
1734
1802
|
return;
|
|
1735
1803
|
}
|
|
1804
|
+
if (outcome === "fired" && typeof window !== "undefined" && typeof window.fbq === "function") {
|
|
1805
|
+
try {
|
|
1806
|
+
window.fbq("trackCustom", item.key, {
|
|
1807
|
+
...value != null ? { value } : {},
|
|
1808
|
+
...currency ? { currency } : {},
|
|
1809
|
+
...item.transactionId ? { transaction_id: item.transactionId } : {}
|
|
1810
|
+
});
|
|
1811
|
+
} catch {
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1736
1814
|
this.conversionQueue.shift();
|
|
1737
1815
|
}
|
|
1738
1816
|
}
|
|
@@ -1876,12 +1954,24 @@ function createConversionAutoFire(store) {
|
|
|
1876
1954
|
const firing = goal.firing;
|
|
1877
1955
|
const cents = firing.value_cents ?? null;
|
|
1878
1956
|
const currency = firing.currency ?? null;
|
|
1879
|
-
|
|
1957
|
+
const value = cents != null && currency ? fromMinor(cents, currency) : null;
|
|
1958
|
+
const outcome = fireConversionWithConsent({
|
|
1880
1959
|
sendTo: firing.send_to,
|
|
1881
|
-
value
|
|
1960
|
+
value,
|
|
1882
1961
|
currency,
|
|
1883
1962
|
transactionId
|
|
1884
1963
|
});
|
|
1964
|
+
if (outcome === "fired" && typeof window !== "undefined" && typeof window.fbq === "function") {
|
|
1965
|
+
try {
|
|
1966
|
+
window.fbq("trackCustom", goal.key, {
|
|
1967
|
+
event_type: eventType,
|
|
1968
|
+
...value != null ? { value } : {},
|
|
1969
|
+
...currency ? { currency } : {},
|
|
1970
|
+
transaction_id: transactionId
|
|
1971
|
+
});
|
|
1972
|
+
} catch {
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1885
1975
|
}
|
|
1886
1976
|
}
|
|
1887
1977
|
return {
|
|
@@ -2014,6 +2104,18 @@ var EVENT_SEMANTICS = {
|
|
|
2014
2104
|
category: "page",
|
|
2015
2105
|
outcomeRole: "navigation",
|
|
2016
2106
|
clientVisibility: "simple"
|
|
2107
|
+
},
|
|
2108
|
+
video_play: {
|
|
2109
|
+
label: "Video played",
|
|
2110
|
+
category: "engagement",
|
|
2111
|
+
outcomeRole: "engagement",
|
|
2112
|
+
clientVisibility: "simple"
|
|
2113
|
+
},
|
|
2114
|
+
video_progress: {
|
|
2115
|
+
label: "Video watched",
|
|
2116
|
+
category: "engagement",
|
|
2117
|
+
outcomeRole: "engagement",
|
|
2118
|
+
clientVisibility: "detailed"
|
|
2017
2119
|
}
|
|
2018
2120
|
};
|
|
2019
2121
|
function getEventSemantics(eventName) {
|
|
@@ -2601,14 +2703,31 @@ function createTrackingClient(config) {
|
|
|
2601
2703
|
metadata: input.metadata ?? null,
|
|
2602
2704
|
occurred_at: occurredAt
|
|
2603
2705
|
});
|
|
2604
|
-
|
|
2706
|
+
const triggerReason = input.metadata?.trigger;
|
|
2707
|
+
const isUrgentVideoEvent = input.eventType === "video_play" || input.eventType === "video_progress" && (triggerReason === "ended" || triggerReason === "goal" || triggerReason === "checkpoint");
|
|
2708
|
+
if (queue.length >= maxQueueSize || input.eventType === "form_details" || getEventSemantics(input.eventType)?.outcomeRole === "lead" || isUrgentVideoEvent) {
|
|
2605
2709
|
void flush();
|
|
2606
2710
|
} else {
|
|
2607
2711
|
scheduleFlush();
|
|
2608
2712
|
}
|
|
2609
2713
|
}
|
|
2714
|
+
const beforeUnloadListeners = /* @__PURE__ */ new Set();
|
|
2715
|
+
let runningBeforeUnload = false;
|
|
2610
2716
|
function flushOnUnload() {
|
|
2611
2717
|
if (destroyed) return;
|
|
2718
|
+
if (!runningBeforeUnload && beforeUnloadListeners.size > 0) {
|
|
2719
|
+
runningBeforeUnload = true;
|
|
2720
|
+
try {
|
|
2721
|
+
for (const listener of beforeUnloadListeners) {
|
|
2722
|
+
try {
|
|
2723
|
+
listener();
|
|
2724
|
+
} catch {
|
|
2725
|
+
}
|
|
2726
|
+
}
|
|
2727
|
+
} finally {
|
|
2728
|
+
runningBeforeUnload = false;
|
|
2729
|
+
}
|
|
2730
|
+
}
|
|
2612
2731
|
bufferQueued();
|
|
2613
2732
|
clearScheduledFlush();
|
|
2614
2733
|
if (pending.length === 0) return;
|
|
@@ -2629,6 +2748,12 @@ function createTrackingClient(config) {
|
|
|
2629
2748
|
trackEvent,
|
|
2630
2749
|
flush,
|
|
2631
2750
|
flushBeacon: flushOnUnload,
|
|
2751
|
+
onBeforeUnload: (listener) => {
|
|
2752
|
+
beforeUnloadListeners.add(listener);
|
|
2753
|
+
return () => {
|
|
2754
|
+
beforeUnloadListeners.delete(listener);
|
|
2755
|
+
};
|
|
2756
|
+
},
|
|
2632
2757
|
getSessionId: () => sessionId,
|
|
2633
2758
|
getVisitorId: () => visitorId,
|
|
2634
2759
|
destroy: () => {
|
|
@@ -2639,6 +2764,7 @@ function createTrackingClient(config) {
|
|
|
2639
2764
|
destroyed = true;
|
|
2640
2765
|
clearScheduledFlush();
|
|
2641
2766
|
queue = [];
|
|
2767
|
+
beforeUnloadListeners.clear();
|
|
2642
2768
|
if (typeof window !== "undefined") {
|
|
2643
2769
|
window.removeEventListener("pagehide", flushOnUnload);
|
|
2644
2770
|
window.removeEventListener("visibilitychange", onVisibilityChange);
|
|
@@ -2939,6 +3065,86 @@ var timeOnSiteConfigSchema = z15.strictObject({
|
|
|
2939
3065
|
thresholdSeconds: z15.int().check(z15.positive())
|
|
2940
3066
|
});
|
|
2941
3067
|
|
|
3068
|
+
// ../tracking-core/src/events/video.ts
|
|
3069
|
+
import * as z16 from "zod/mini";
|
|
3070
|
+
|
|
3071
|
+
// ../tracking-core/src/video-ranges.ts
|
|
3072
|
+
var VIDEO_ID_MAX_LENGTH = 64;
|
|
3073
|
+
var VIDEO_ID_PATTERN = /^[A-Za-z0-9_-]+$/;
|
|
3074
|
+
function roundVideoSeconds(value) {
|
|
3075
|
+
if (!Number.isFinite(value) || value < 0) return 0;
|
|
3076
|
+
return Math.round(value * 100) / 100;
|
|
3077
|
+
}
|
|
3078
|
+
function mergeVideoRanges(ranges, epsilonSeconds = 0.25) {
|
|
3079
|
+
const valid2 = ranges.filter((r) => Number.isFinite(r.start_s) && Number.isFinite(r.end_s) && r.end_s > r.start_s).map((r) => ({
|
|
3080
|
+
start_s: roundVideoSeconds(r.start_s),
|
|
3081
|
+
end_s: roundVideoSeconds(r.end_s)
|
|
3082
|
+
})).filter((r) => r.end_s - r.start_s >= 0.05).sort((a, b) => a.start_s - b.start_s || a.end_s - b.end_s);
|
|
3083
|
+
if (valid2.length === 0) return [];
|
|
3084
|
+
const merged = [{ ...valid2[0] }];
|
|
3085
|
+
for (let i = 1; i < valid2.length; i += 1) {
|
|
3086
|
+
const cur = valid2[i];
|
|
3087
|
+
const last = merged[merged.length - 1];
|
|
3088
|
+
if (cur.start_s <= last.end_s + epsilonSeconds) {
|
|
3089
|
+
last.end_s = roundVideoSeconds(Math.max(last.end_s, cur.end_s));
|
|
3090
|
+
} else {
|
|
3091
|
+
merged.push({ ...cur });
|
|
3092
|
+
}
|
|
3093
|
+
}
|
|
3094
|
+
return merged;
|
|
3095
|
+
}
|
|
3096
|
+
function sumVideoRangesSeconds(ranges, durationSeconds = 0) {
|
|
3097
|
+
const merged = mergeVideoRanges(ranges);
|
|
3098
|
+
const raw = merged.reduce((acc, r) => acc + Math.max(0, r.end_s - r.start_s), 0);
|
|
3099
|
+
const clamped = durationSeconds > 0 ? Math.min(raw, durationSeconds) : raw;
|
|
3100
|
+
return roundVideoSeconds(clamped);
|
|
3101
|
+
}
|
|
3102
|
+
|
|
3103
|
+
// ../tracking-core/src/events/video.ts
|
|
3104
|
+
var videoIdSchema = z16.string().check(z16.minLength(1), z16.maxLength(VIDEO_ID_MAX_LENGTH), z16.regex(VIDEO_ID_PATTERN));
|
|
3105
|
+
var videoVariantSchema = z16.enum(["16x9", "9x16"]);
|
|
3106
|
+
var videoProgressTriggerReasonSchema = z16.enum([
|
|
3107
|
+
"checkpoint",
|
|
3108
|
+
"goal",
|
|
3109
|
+
"pause",
|
|
3110
|
+
"seek",
|
|
3111
|
+
"ended",
|
|
3112
|
+
"page_exit"
|
|
3113
|
+
]);
|
|
3114
|
+
var videoRangeSchema = z16.strictObject({
|
|
3115
|
+
start_s: z16.number().check(z16.gte(0)),
|
|
3116
|
+
end_s: z16.number().check(z16.gte(0))
|
|
3117
|
+
});
|
|
3118
|
+
var videoPlayMetadataSchema = z16.strictObject({
|
|
3119
|
+
video_id: videoIdSchema,
|
|
3120
|
+
variant: videoVariantSchema,
|
|
3121
|
+
current_s: z16.number().check(z16.gte(0)),
|
|
3122
|
+
duration_s: z16.number().check(z16.gte(0)),
|
|
3123
|
+
play_sequence: z16.int().check(z16.gte(1)),
|
|
3124
|
+
page: z16.strictObject({
|
|
3125
|
+
path: z16.string()
|
|
3126
|
+
})
|
|
3127
|
+
});
|
|
3128
|
+
var videoPlayConfigSchema = z16.strictObject({});
|
|
3129
|
+
var videoProgressMetadataSchema = z16.strictObject({
|
|
3130
|
+
video_id: videoIdSchema,
|
|
3131
|
+
variant: videoVariantSchema,
|
|
3132
|
+
trigger: videoProgressTriggerReasonSchema,
|
|
3133
|
+
current_s: z16.number().check(z16.gte(0)),
|
|
3134
|
+
furthest_s: z16.number().check(z16.gte(0)),
|
|
3135
|
+
watched_s: z16.number().check(z16.gte(0)),
|
|
3136
|
+
duration_s: z16.number().check(z16.gte(0)),
|
|
3137
|
+
max_percent: z16.int().check(z16.gte(0), z16.lte(100)),
|
|
3138
|
+
watched_percent: z16.int().check(z16.gte(0), z16.lte(100)),
|
|
3139
|
+
play_count: z16.int().check(z16.gte(1)),
|
|
3140
|
+
seek_count: z16.int().check(z16.gte(0)),
|
|
3141
|
+
ranges: z16.array(videoRangeSchema),
|
|
3142
|
+
page: z16.strictObject({
|
|
3143
|
+
path: z16.string()
|
|
3144
|
+
})
|
|
3145
|
+
});
|
|
3146
|
+
var videoProgressConfigSchema = z16.strictObject({});
|
|
3147
|
+
|
|
2942
3148
|
// ../tracking-core/src/events/registry.ts
|
|
2943
3149
|
var EVENT_REGISTRY = {
|
|
2944
3150
|
// --- automatic triggers ---
|
|
@@ -3005,6 +3211,18 @@ var EVENT_REGISTRY = {
|
|
|
3005
3211
|
metadataSchema: siteLinkArrivalMetadataSchema,
|
|
3006
3212
|
configSchema: siteLinkArrivalConfigSchema
|
|
3007
3213
|
},
|
|
3214
|
+
video_play: {
|
|
3215
|
+
kind: "automatic",
|
|
3216
|
+
semantics: EVENT_SEMANTICS.video_play,
|
|
3217
|
+
metadataSchema: videoPlayMetadataSchema,
|
|
3218
|
+
configSchema: videoPlayConfigSchema
|
|
3219
|
+
},
|
|
3220
|
+
video_progress: {
|
|
3221
|
+
kind: "automatic",
|
|
3222
|
+
semantics: EVENT_SEMANTICS.video_progress,
|
|
3223
|
+
metadataSchema: videoProgressMetadataSchema,
|
|
3224
|
+
configSchema: videoProgressConfigSchema
|
|
3225
|
+
},
|
|
3008
3226
|
// --- manual triggers ---
|
|
3009
3227
|
form_submit: {
|
|
3010
3228
|
kind: "manual",
|
|
@@ -3105,6 +3323,17 @@ function currentPath2() {
|
|
|
3105
3323
|
|
|
3106
3324
|
// ../tracking-core/src/ingest-typed.ts
|
|
3107
3325
|
var clientSettings = /* @__PURE__ */ new WeakMap();
|
|
3326
|
+
var latestTrackingConfig;
|
|
3327
|
+
var latestRawClient = null;
|
|
3328
|
+
function setDefaultTrackingConfig(ref) {
|
|
3329
|
+
if (ref) latestTrackingConfig = ref;
|
|
3330
|
+
}
|
|
3331
|
+
function getActiveTrackingEnv() {
|
|
3332
|
+
return {
|
|
3333
|
+
rawClient: latestRawClient,
|
|
3334
|
+
trackingConfig: latestTrackingConfig
|
|
3335
|
+
};
|
|
3336
|
+
}
|
|
3108
3337
|
function typedClientSettings(client) {
|
|
3109
3338
|
return clientSettings.get(client) ?? {};
|
|
3110
3339
|
}
|
|
@@ -3135,7 +3364,9 @@ function createTypedClient(raw, registry, options = {}) {
|
|
|
3135
3364
|
getSessionId: raw.getSessionId.bind(raw),
|
|
3136
3365
|
getVisitorId: raw.getVisitorId.bind(raw)
|
|
3137
3366
|
};
|
|
3138
|
-
|
|
3367
|
+
latestRawClient = raw;
|
|
3368
|
+
if (options.trackingConfig) latestTrackingConfig = options.trackingConfig;
|
|
3369
|
+
clientSettings.set(client, { ...options, rawClient: raw });
|
|
3139
3370
|
return client;
|
|
3140
3371
|
}
|
|
3141
3372
|
|
|
@@ -3653,6 +3884,9 @@ function attachPageExit(client) {
|
|
|
3653
3884
|
emitSegment(currentPath4, true);
|
|
3654
3885
|
}
|
|
3655
3886
|
const unsubscribeNav = onHistoryChange(onNavigate);
|
|
3887
|
+
const unsubscribeBeforeUnload = client.onBeforeUnload?.(() => {
|
|
3888
|
+
emitSegment(currentPath4, false);
|
|
3889
|
+
});
|
|
3656
3890
|
window.addEventListener("scroll", onScroll, { passive: true });
|
|
3657
3891
|
document.addEventListener("visibilitychange", onVisibilityChange);
|
|
3658
3892
|
window.addEventListener("pagehide", onPageHide);
|
|
@@ -3661,6 +3895,7 @@ function attachPageExit(client) {
|
|
|
3661
3895
|
if (rafId !== null) cancelAnimationFrame(rafId);
|
|
3662
3896
|
gate.cancel();
|
|
3663
3897
|
unsubscribeNav();
|
|
3898
|
+
unsubscribeBeforeUnload?.();
|
|
3664
3899
|
window.removeEventListener("scroll", onScroll);
|
|
3665
3900
|
document.removeEventListener("visibilitychange", onVisibilityChange);
|
|
3666
3901
|
window.removeEventListener("pagehide", onPageHide);
|
|
@@ -3830,7 +4065,7 @@ function attachPhoneClickCapture(client, config) {
|
|
|
3830
4065
|
}
|
|
3831
4066
|
|
|
3832
4067
|
// ../tracking-core/src/lead-forms/lead-forms.gen.ts
|
|
3833
|
-
import * as
|
|
4068
|
+
import * as z17 from "zod/mini";
|
|
3834
4069
|
var LEAD_FORM_REGISTRY_VERSION = 2;
|
|
3835
4070
|
var LEAD_FORM_ROLES = [
|
|
3836
4071
|
"given_name",
|
|
@@ -3856,28 +4091,28 @@ var LEAD_FORM_ROLES = [
|
|
|
3856
4091
|
"attribution"
|
|
3857
4092
|
];
|
|
3858
4093
|
var leadFormPrimitiveSchemas = /* @__PURE__ */ (() => ({
|
|
3859
|
-
string:
|
|
3860
|
-
text:
|
|
3861
|
-
enum:
|
|
3862
|
-
multi_enum:
|
|
3863
|
-
bool:
|
|
3864
|
-
date:
|
|
3865
|
-
time_window:
|
|
3866
|
-
start:
|
|
3867
|
-
end:
|
|
3868
|
-
label:
|
|
4094
|
+
string: z17.string().check(z17.maxLength(120)),
|
|
4095
|
+
text: z17.string().check(z17.maxLength(2e3)),
|
|
4096
|
+
enum: z17.string().check(z17.regex(/^[a-z0-9-]{1,48}$/)),
|
|
4097
|
+
multi_enum: z17.array(z17.string().check(z17.regex(/^[a-z0-9-]{1,48}$/))).check(z17.maxLength(10)),
|
|
4098
|
+
bool: z17.boolean(),
|
|
4099
|
+
date: z17.string().check(z17.regex(/^\d{4}-\d{2}-\d{2}$/)),
|
|
4100
|
+
time_window: z17.strictObject({
|
|
4101
|
+
start: z17.string().check(z17.regex(/^([01]\d|2[0-3]):[0-5]\d$/)),
|
|
4102
|
+
end: z17.nullable(z17.string().check(z17.regex(/^([01]\d|2[0-3]):[0-5]\d$/))),
|
|
4103
|
+
label: z17.optional(z17.string().check(z17.maxLength(60)))
|
|
3869
4104
|
}),
|
|
3870
|
-
phone:
|
|
3871
|
-
email:
|
|
3872
|
-
address:
|
|
3873
|
-
line1:
|
|
3874
|
-
line2:
|
|
3875
|
-
city:
|
|
3876
|
-
region:
|
|
3877
|
-
postal_code:
|
|
3878
|
-
country:
|
|
4105
|
+
phone: z17.string().check(z17.regex(/^\+[1-9]\d{6,14}$/)),
|
|
4106
|
+
email: z17.string().check(z17.maxLength(320), z17.regex(/^[^\s@]+@[^\s@]+$/)),
|
|
4107
|
+
address: z17.strictObject({
|
|
4108
|
+
line1: z17.string().check(z17.maxLength(120)),
|
|
4109
|
+
line2: z17.optional(z17.string().check(z17.maxLength(120))),
|
|
4110
|
+
city: z17.optional(z17.string().check(z17.maxLength(120))),
|
|
4111
|
+
region: z17.optional(z17.string().check(z17.maxLength(120))),
|
|
4112
|
+
postal_code: z17.optional(z17.string().check(z17.maxLength(120))),
|
|
4113
|
+
country: z17.optional(z17.string().check(z17.maxLength(120)))
|
|
3879
4114
|
}),
|
|
3880
|
-
number:
|
|
4115
|
+
number: z17.number()
|
|
3881
4116
|
}))();
|
|
3882
4117
|
var LEAD_FORM_ROLE_SPECS = {
|
|
3883
4118
|
given_name: { primitive: "string", smsLabel: "", contactIdentity: true },
|
|
@@ -3959,7 +4194,11 @@ function createLeadFormSubmit(tracking, contracts, options = {}) {
|
|
|
3959
4194
|
contracts,
|
|
3960
4195
|
settings
|
|
3961
4196
|
);
|
|
3962
|
-
const submission = {
|
|
4197
|
+
const submission = {
|
|
4198
|
+
submissionId: input.submissionId ?? uuidV4(),
|
|
4199
|
+
formId: input.formId,
|
|
4200
|
+
kind: input.kind
|
|
4201
|
+
};
|
|
3963
4202
|
const metadata = {
|
|
3964
4203
|
form: {
|
|
3965
4204
|
id: input.formId,
|
|
@@ -4449,7 +4688,7 @@ function GoogleAdsTracking(props) {
|
|
|
4449
4688
|
import { createContext as createContext2, useContext as useContext2, useEffect as useEffect5, useMemo as useMemo4 } from "react";
|
|
4450
4689
|
|
|
4451
4690
|
// package.json
|
|
4452
|
-
var version = "1.
|
|
4691
|
+
var version = "1.20.0";
|
|
4453
4692
|
|
|
4454
4693
|
// ../tracking-core/src/phone-react.tsx
|
|
4455
4694
|
import {
|
|
@@ -4567,6 +4806,7 @@ function createTracking(options) {
|
|
|
4567
4806
|
trackingConfig
|
|
4568
4807
|
} = options;
|
|
4569
4808
|
registerCapability("base_tracking");
|
|
4809
|
+
setDefaultTrackingConfig(trackingConfig);
|
|
4570
4810
|
if (trackingConfig) registerCapability("conversion_goals_auto");
|
|
4571
4811
|
if (!apiKey || !endpoint) {
|
|
4572
4812
|
if (apiKey || endpoint) {
|
|
@@ -4834,14 +5074,1429 @@ function useBookingSubmit(bookings, options = {}) {
|
|
|
4834
5074
|
const status = submitting ? "submitting" : outcome?.status ?? "idle";
|
|
4835
5075
|
return { status, outcome, booked, submit, updateBooking, reset };
|
|
4836
5076
|
}
|
|
5077
|
+
|
|
5078
|
+
// ../tracking-core/src/video-react.tsx
|
|
5079
|
+
import {
|
|
5080
|
+
useCallback as useCallback4,
|
|
5081
|
+
useEffect as useEffect6,
|
|
5082
|
+
useLayoutEffect,
|
|
5083
|
+
useMemo as useMemo6,
|
|
5084
|
+
useRef as useRef2,
|
|
5085
|
+
useState as useState5,
|
|
5086
|
+
useSyncExternalStore as useSyncExternalStore2
|
|
5087
|
+
} from "react";
|
|
5088
|
+
import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
5089
|
+
var DEFAULT_VIDEO_CHECKPOINTS = [25, 50, 75, 90, 100];
|
|
5090
|
+
var streamManifestUrl = (host, uid) => `https://${host}/${uid}/manifest/video.m3u8`;
|
|
5091
|
+
var streamPosterUrl = (host, uid, time = 4) => `https://${host}/${uid}/thumbnails/thumbnail.jpg?time=${time}s`;
|
|
5092
|
+
var TV_SKIN_STYLE_ATTR = "data-aranova-tv-skin";
|
|
5093
|
+
var TV_SKIN_CSS = `
|
|
5094
|
+
.tv-skin {
|
|
5095
|
+
container-type: inline-size;
|
|
5096
|
+
position: relative;
|
|
5097
|
+
overflow: hidden;
|
|
5098
|
+
border-radius: 18px;
|
|
5099
|
+
border: 1px solid rgba(255, 255, 255, 0.12);
|
|
5100
|
+
background: #0a0e1a;
|
|
5101
|
+
box-shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
|
|
5102
|
+
}
|
|
5103
|
+
.tv-skin-desktop {
|
|
5104
|
+
display: none;
|
|
5105
|
+
aspect-ratio: 16 / 9;
|
|
5106
|
+
width: 100%;
|
|
5107
|
+
}
|
|
5108
|
+
.tv-skin-mobile {
|
|
5109
|
+
display: block;
|
|
5110
|
+
margin-left: auto;
|
|
5111
|
+
margin-right: auto;
|
|
5112
|
+
aspect-ratio: 9 / 16;
|
|
5113
|
+
width: 100%;
|
|
5114
|
+
max-width: 420px;
|
|
5115
|
+
}
|
|
5116
|
+
@media (min-width: 768px) {
|
|
5117
|
+
.tv-skin-desktop {
|
|
5118
|
+
display: block;
|
|
5119
|
+
}
|
|
5120
|
+
.tv-skin-mobile {
|
|
5121
|
+
display: none;
|
|
5122
|
+
}
|
|
5123
|
+
}
|
|
5124
|
+
.tv-skin media-controller {
|
|
5125
|
+
display: block;
|
|
5126
|
+
width: 100%;
|
|
5127
|
+
height: 100%;
|
|
5128
|
+
background: #000;
|
|
5129
|
+
--media-primary-color: #ffffff;
|
|
5130
|
+
--media-text-color: rgba(255, 255, 255, 0.82);
|
|
5131
|
+
--media-icon-color: #ffffff;
|
|
5132
|
+
--media-secondary-color: transparent;
|
|
5133
|
+
--media-control-background: transparent;
|
|
5134
|
+
--media-control-hover-background: transparent;
|
|
5135
|
+
--media-control-padding: 0;
|
|
5136
|
+
--media-control-height: 40px;
|
|
5137
|
+
--media-tooltip-display: none;
|
|
5138
|
+
--media-font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
|
|
5139
|
+
--media-font-size: 11.5px;
|
|
5140
|
+
--media-focus-box-shadow: 0 0 0 2px #74a0ff;
|
|
5141
|
+
--media-button-icon-width: 20px;
|
|
5142
|
+
--media-button-icon-height: 20px;
|
|
5143
|
+
--media-range-padding: 0;
|
|
5144
|
+
--media-range-bar-color: #ffffff;
|
|
5145
|
+
--media-range-track-background: rgba(255, 255, 255, 0.25);
|
|
5146
|
+
--media-range-track-border-radius: 3px;
|
|
5147
|
+
--media-time-range-buffered-color: transparent;
|
|
5148
|
+
--media-time-range-hover-display: none;
|
|
5149
|
+
--media-preview-time-background: transparent;
|
|
5150
|
+
--media-range-thumb-background: #ffffff;
|
|
5151
|
+
--media-range-thumb-width: 12px;
|
|
5152
|
+
--media-range-thumb-height: 12px;
|
|
5153
|
+
--media-range-thumb-opacity: 0;
|
|
5154
|
+
}
|
|
5155
|
+
.tv-skin media-controller::part(vertical-layer),
|
|
5156
|
+
.tv-skin media-controller::part(centered-layer) {
|
|
5157
|
+
background: transparent;
|
|
5158
|
+
}
|
|
5159
|
+
.tv-chrome {
|
|
5160
|
+
position: absolute;
|
|
5161
|
+
inset: auto 0 0 0;
|
|
5162
|
+
padding-top: 56px;
|
|
5163
|
+
background: linear-gradient(to top, rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0));
|
|
5164
|
+
transition: opacity 0.25s ease;
|
|
5165
|
+
}
|
|
5166
|
+
.tv-skin media-controller[userinactive]:not([mediapaused]) .tv-chrome {
|
|
5167
|
+
opacity: 0;
|
|
5168
|
+
pointer-events: none;
|
|
5169
|
+
}
|
|
5170
|
+
.tv-row {
|
|
5171
|
+
display: flex;
|
|
5172
|
+
align-items: center;
|
|
5173
|
+
gap: 2px;
|
|
5174
|
+
padding: 0 4px;
|
|
5175
|
+
}
|
|
5176
|
+
.tv-spacer {
|
|
5177
|
+
flex: 1 1 auto;
|
|
5178
|
+
}
|
|
5179
|
+
.tv-ctl,
|
|
5180
|
+
.tv-btn {
|
|
5181
|
+
display: inline-flex;
|
|
5182
|
+
align-items: center;
|
|
5183
|
+
justify-content: center;
|
|
5184
|
+
width: 40px;
|
|
5185
|
+
height: 40px;
|
|
5186
|
+
padding: 0;
|
|
5187
|
+
border: 0;
|
|
5188
|
+
border-radius: 0;
|
|
5189
|
+
background: transparent;
|
|
5190
|
+
box-shadow: none;
|
|
5191
|
+
color: rgba(255, 255, 255, 0.92);
|
|
5192
|
+
cursor: pointer;
|
|
5193
|
+
transition: color 0.15s;
|
|
5194
|
+
}
|
|
5195
|
+
.tv-ctl:hover,
|
|
5196
|
+
.tv-btn:hover {
|
|
5197
|
+
background: transparent;
|
|
5198
|
+
color: #ffffff;
|
|
5199
|
+
}
|
|
5200
|
+
.tv-ctl:focus-visible,
|
|
5201
|
+
.tv-btn:focus-visible,
|
|
5202
|
+
.tv-menu-item:focus-visible {
|
|
5203
|
+
outline: 2px solid #74a0ff;
|
|
5204
|
+
outline-offset: -4px;
|
|
5205
|
+
box-shadow: none;
|
|
5206
|
+
}
|
|
5207
|
+
.tv-time {
|
|
5208
|
+
width: auto;
|
|
5209
|
+
padding: 0 4px 0 6px;
|
|
5210
|
+
background: transparent;
|
|
5211
|
+
letter-spacing: 0.02em;
|
|
5212
|
+
white-space: nowrap;
|
|
5213
|
+
--media-control-background: transparent;
|
|
5214
|
+
}
|
|
5215
|
+
.tv-time-cur {
|
|
5216
|
+
display: none;
|
|
5217
|
+
}
|
|
5218
|
+
.tv-seek {
|
|
5219
|
+
display: block;
|
|
5220
|
+
width: 100%;
|
|
5221
|
+
height: 16px;
|
|
5222
|
+
margin: 0;
|
|
5223
|
+
padding: 0;
|
|
5224
|
+
background: transparent;
|
|
5225
|
+
box-shadow: none;
|
|
5226
|
+
border: 0;
|
|
5227
|
+
--media-range-track-height: 3px;
|
|
5228
|
+
--media-control-background: transparent;
|
|
5229
|
+
--media-control-hover-background: transparent;
|
|
5230
|
+
}
|
|
5231
|
+
.tv-seek:hover,
|
|
5232
|
+
.tv-seek:focus-visible {
|
|
5233
|
+
--media-range-track-height: 6px;
|
|
5234
|
+
--media-range-thumb-opacity: 1;
|
|
5235
|
+
}
|
|
5236
|
+
.tv-vol {
|
|
5237
|
+
display: flex;
|
|
5238
|
+
align-items: center;
|
|
5239
|
+
}
|
|
5240
|
+
.tv-volrange {
|
|
5241
|
+
width: 64px;
|
|
5242
|
+
height: 40px;
|
|
5243
|
+
margin-right: 4px;
|
|
5244
|
+
padding: 0;
|
|
5245
|
+
opacity: 0;
|
|
5246
|
+
pointer-events: none;
|
|
5247
|
+
transform: scaleX(0.75);
|
|
5248
|
+
transform-origin: right center;
|
|
5249
|
+
background: transparent;
|
|
5250
|
+
transition: transform 0.2s ease, opacity 0.2s ease;
|
|
5251
|
+
--media-control-background: transparent;
|
|
5252
|
+
--media-range-track-height: 3px;
|
|
5253
|
+
}
|
|
5254
|
+
.tv-vol:hover .tv-volrange,
|
|
5255
|
+
.tv-vol:focus-within .tv-volrange {
|
|
5256
|
+
opacity: 1;
|
|
5257
|
+
pointer-events: auto;
|
|
5258
|
+
transform: scaleX(1);
|
|
5259
|
+
}
|
|
5260
|
+
@media (hover: none) {
|
|
5261
|
+
.tv-volrange {
|
|
5262
|
+
display: none;
|
|
5263
|
+
}
|
|
5264
|
+
}
|
|
5265
|
+
@container (max-width: 479px) {
|
|
5266
|
+
.tv-vol,
|
|
5267
|
+
.tv-time-full {
|
|
5268
|
+
display: none;
|
|
5269
|
+
}
|
|
5270
|
+
.tv-time-cur {
|
|
5271
|
+
display: inline-flex;
|
|
5272
|
+
}
|
|
5273
|
+
}
|
|
5274
|
+
@container (max-width: 767px) {
|
|
5275
|
+
.tv-theater {
|
|
5276
|
+
display: none;
|
|
5277
|
+
}
|
|
5278
|
+
}
|
|
5279
|
+
.tv-menu-wrap {
|
|
5280
|
+
position: relative;
|
|
5281
|
+
display: flex;
|
|
5282
|
+
align-items: center;
|
|
5283
|
+
}
|
|
5284
|
+
.tv-menu {
|
|
5285
|
+
position: absolute;
|
|
5286
|
+
right: 0;
|
|
5287
|
+
bottom: calc(100% + 8px);
|
|
5288
|
+
z-index: 5;
|
|
5289
|
+
width: 136px;
|
|
5290
|
+
max-height: 232px;
|
|
5291
|
+
margin: 0;
|
|
5292
|
+
padding: 4px 0;
|
|
5293
|
+
overflow-y: auto;
|
|
5294
|
+
list-style: none;
|
|
5295
|
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
|
5296
|
+
border-radius: 10px;
|
|
5297
|
+
background: linear-gradient(rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.12)), rgba(10, 14, 26, 0.55);
|
|
5298
|
+
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 12px 32px rgba(0, 0, 0, 0.35);
|
|
5299
|
+
}
|
|
5300
|
+
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
|
|
5301
|
+
.tv-menu {
|
|
5302
|
+
-webkit-backdrop-filter: blur(16px) saturate(140%);
|
|
5303
|
+
backdrop-filter: blur(16px) saturate(140%);
|
|
5304
|
+
}
|
|
5305
|
+
}
|
|
5306
|
+
.tv-menu-item {
|
|
5307
|
+
position: relative;
|
|
5308
|
+
display: flex;
|
|
5309
|
+
width: 100%;
|
|
5310
|
+
height: 32px;
|
|
5311
|
+
align-items: center;
|
|
5312
|
+
padding: 0 12px 0 24px;
|
|
5313
|
+
border: 0;
|
|
5314
|
+
background: transparent;
|
|
5315
|
+
color: rgba(255, 255, 255, 0.75);
|
|
5316
|
+
font-family: var(--font-sans, system-ui, -apple-system, sans-serif);
|
|
5317
|
+
font-size: 13px;
|
|
5318
|
+
font-weight: 500;
|
|
5319
|
+
text-align: left;
|
|
5320
|
+
cursor: pointer;
|
|
5321
|
+
}
|
|
5322
|
+
.tv-menu-item:hover,
|
|
5323
|
+
.tv-menu-item:focus-visible {
|
|
5324
|
+
background: rgba(255, 255, 255, 0.1);
|
|
5325
|
+
color: #ffffff;
|
|
5326
|
+
outline: none;
|
|
5327
|
+
}
|
|
5328
|
+
.tv-menu-item[aria-checked='true'] {
|
|
5329
|
+
color: #ffffff;
|
|
5330
|
+
font-weight: 600;
|
|
5331
|
+
}
|
|
5332
|
+
.tv-menu-item[aria-checked='true']::before {
|
|
5333
|
+
content: '';
|
|
5334
|
+
position: absolute;
|
|
5335
|
+
left: 12px;
|
|
5336
|
+
width: 5px;
|
|
5337
|
+
height: 5px;
|
|
5338
|
+
border-radius: 50%;
|
|
5339
|
+
background: #ffffff;
|
|
5340
|
+
}
|
|
5341
|
+
.tv-menu-sub {
|
|
5342
|
+
margin-left: 4px;
|
|
5343
|
+
font-size: 11.5px;
|
|
5344
|
+
font-weight: 400;
|
|
5345
|
+
color: rgba(255, 255, 255, 0.55);
|
|
5346
|
+
}
|
|
5347
|
+
.tv-menu-note {
|
|
5348
|
+
height: 20px;
|
|
5349
|
+
padding: 0 12px 0 24px;
|
|
5350
|
+
color: rgba(255, 255, 255, 0.55);
|
|
5351
|
+
font-family: var(--font-sans, system-ui, -apple-system, sans-serif);
|
|
5352
|
+
font-size: 11.5px;
|
|
5353
|
+
line-height: 20px;
|
|
5354
|
+
}
|
|
5355
|
+
.tv-poster-overlay {
|
|
5356
|
+
position: absolute;
|
|
5357
|
+
inset: 0;
|
|
5358
|
+
}
|
|
5359
|
+
.tv-poster-img {
|
|
5360
|
+
width: 100%;
|
|
5361
|
+
height: 100%;
|
|
5362
|
+
object-fit: cover;
|
|
5363
|
+
display: block;
|
|
5364
|
+
}
|
|
5365
|
+
.tv-play-trigger {
|
|
5366
|
+
position: absolute;
|
|
5367
|
+
inset: 0;
|
|
5368
|
+
width: 100%;
|
|
5369
|
+
height: 100%;
|
|
5370
|
+
border: 0;
|
|
5371
|
+
padding: 0;
|
|
5372
|
+
background: transparent;
|
|
5373
|
+
cursor: pointer;
|
|
5374
|
+
display: flex;
|
|
5375
|
+
align-items: center;
|
|
5376
|
+
justify-content: center;
|
|
5377
|
+
transition: filter 0.2s ease;
|
|
5378
|
+
}
|
|
5379
|
+
.tv-play-trigger:hover {
|
|
5380
|
+
filter: brightness(1.1);
|
|
5381
|
+
}
|
|
5382
|
+
.tv-play-trigger:focus-visible {
|
|
5383
|
+
outline: 2px solid #74a0ff;
|
|
5384
|
+
outline-offset: -4px;
|
|
5385
|
+
}
|
|
5386
|
+
.tv-play-pill {
|
|
5387
|
+
display: flex;
|
|
5388
|
+
width: 64px;
|
|
5389
|
+
height: 64px;
|
|
5390
|
+
align-items: center;
|
|
5391
|
+
justify-content: center;
|
|
5392
|
+
border-radius: 9999px;
|
|
5393
|
+
border: 2px solid rgba(255, 255, 255, 0.72);
|
|
5394
|
+
background: rgba(255, 255, 255, 0.15);
|
|
5395
|
+
color: #ffffff;
|
|
5396
|
+
backdrop-filter: blur(2px);
|
|
5397
|
+
-webkit-backdrop-filter: blur(2px);
|
|
5398
|
+
transition: transform 0.3s ease;
|
|
5399
|
+
}
|
|
5400
|
+
.tv-play-trigger:hover .tv-play-pill {
|
|
5401
|
+
transform: scale(1.05);
|
|
5402
|
+
}
|
|
5403
|
+
`;
|
|
5404
|
+
function ensureTvSkinStyles() {
|
|
5405
|
+
if (typeof document === "undefined") return;
|
|
5406
|
+
if (document.querySelector(`style[${TV_SKIN_STYLE_ATTR}]`)) return;
|
|
5407
|
+
const style = document.createElement("style");
|
|
5408
|
+
style.setAttribute(TV_SKIN_STYLE_ATTR, "1");
|
|
5409
|
+
style.textContent = TV_SKIN_CSS;
|
|
5410
|
+
document.head.append(style);
|
|
5411
|
+
}
|
|
5412
|
+
function IconPlay({
|
|
5413
|
+
slot,
|
|
5414
|
+
size = 20,
|
|
5415
|
+
filled = false
|
|
5416
|
+
}) {
|
|
5417
|
+
return /* @__PURE__ */ jsx5(
|
|
5418
|
+
"svg",
|
|
5419
|
+
{
|
|
5420
|
+
slot,
|
|
5421
|
+
width: size,
|
|
5422
|
+
height: size,
|
|
5423
|
+
viewBox: "0 0 24 24",
|
|
5424
|
+
fill: filled ? "currentColor" : "none",
|
|
5425
|
+
stroke: "currentColor",
|
|
5426
|
+
strokeWidth: filled ? 0 : 1.75,
|
|
5427
|
+
strokeLinecap: "round",
|
|
5428
|
+
strokeLinejoin: "round",
|
|
5429
|
+
"aria-hidden": "true",
|
|
5430
|
+
style: filled ? { marginLeft: 3 } : void 0,
|
|
5431
|
+
children: /* @__PURE__ */ jsx5("polygon", { points: "6 3 20 12 6 21 6 3" })
|
|
5432
|
+
}
|
|
5433
|
+
);
|
|
5434
|
+
}
|
|
5435
|
+
function IconPause({ slot }) {
|
|
5436
|
+
return /* @__PURE__ */ jsxs2(
|
|
5437
|
+
"svg",
|
|
5438
|
+
{
|
|
5439
|
+
slot,
|
|
5440
|
+
width: 20,
|
|
5441
|
+
height: 20,
|
|
5442
|
+
viewBox: "0 0 24 24",
|
|
5443
|
+
fill: "none",
|
|
5444
|
+
stroke: "currentColor",
|
|
5445
|
+
strokeWidth: 1.75,
|
|
5446
|
+
strokeLinecap: "round",
|
|
5447
|
+
strokeLinejoin: "round",
|
|
5448
|
+
"aria-hidden": "true",
|
|
5449
|
+
children: [
|
|
5450
|
+
/* @__PURE__ */ jsx5("rect", { x: "14", y: "4", width: "4", height: "16", rx: "1" }),
|
|
5451
|
+
/* @__PURE__ */ jsx5("rect", { x: "6", y: "4", width: "4", height: "16", rx: "1" })
|
|
5452
|
+
]
|
|
5453
|
+
}
|
|
5454
|
+
);
|
|
5455
|
+
}
|
|
5456
|
+
function IconVolumeHigh({ slot }) {
|
|
5457
|
+
return /* @__PURE__ */ jsxs2(
|
|
5458
|
+
"svg",
|
|
5459
|
+
{
|
|
5460
|
+
slot,
|
|
5461
|
+
width: 20,
|
|
5462
|
+
height: 20,
|
|
5463
|
+
viewBox: "0 0 24 24",
|
|
5464
|
+
fill: "none",
|
|
5465
|
+
stroke: "currentColor",
|
|
5466
|
+
strokeWidth: 1.75,
|
|
5467
|
+
strokeLinecap: "round",
|
|
5468
|
+
strokeLinejoin: "round",
|
|
5469
|
+
"aria-hidden": "true",
|
|
5470
|
+
children: [
|
|
5471
|
+
/* @__PURE__ */ jsx5("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
|
|
5472
|
+
/* @__PURE__ */ jsx5("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07" }),
|
|
5473
|
+
/* @__PURE__ */ jsx5("path", { d: "M19.07 4.93a10 10 0 0 1 0 14.14" })
|
|
5474
|
+
]
|
|
5475
|
+
}
|
|
5476
|
+
);
|
|
5477
|
+
}
|
|
5478
|
+
function IconVolumeLow({ slot }) {
|
|
5479
|
+
return /* @__PURE__ */ jsxs2(
|
|
5480
|
+
"svg",
|
|
5481
|
+
{
|
|
5482
|
+
slot,
|
|
5483
|
+
width: 20,
|
|
5484
|
+
height: 20,
|
|
5485
|
+
viewBox: "0 0 24 24",
|
|
5486
|
+
fill: "none",
|
|
5487
|
+
stroke: "currentColor",
|
|
5488
|
+
strokeWidth: 1.75,
|
|
5489
|
+
strokeLinecap: "round",
|
|
5490
|
+
strokeLinejoin: "round",
|
|
5491
|
+
"aria-hidden": "true",
|
|
5492
|
+
children: [
|
|
5493
|
+
/* @__PURE__ */ jsx5("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
|
|
5494
|
+
/* @__PURE__ */ jsx5("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07" })
|
|
5495
|
+
]
|
|
5496
|
+
}
|
|
5497
|
+
);
|
|
5498
|
+
}
|
|
5499
|
+
function IconVolumeOff({ slot }) {
|
|
5500
|
+
return /* @__PURE__ */ jsxs2(
|
|
5501
|
+
"svg",
|
|
5502
|
+
{
|
|
5503
|
+
slot,
|
|
5504
|
+
width: 20,
|
|
5505
|
+
height: 20,
|
|
5506
|
+
viewBox: "0 0 24 24",
|
|
5507
|
+
fill: "none",
|
|
5508
|
+
stroke: "currentColor",
|
|
5509
|
+
strokeWidth: 1.75,
|
|
5510
|
+
strokeLinecap: "round",
|
|
5511
|
+
strokeLinejoin: "round",
|
|
5512
|
+
"aria-hidden": "true",
|
|
5513
|
+
children: [
|
|
5514
|
+
/* @__PURE__ */ jsx5("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
|
|
5515
|
+
/* @__PURE__ */ jsx5("line", { x1: "22", y1: "9", x2: "16", y2: "15" }),
|
|
5516
|
+
/* @__PURE__ */ jsx5("line", { x1: "16", y1: "9", x2: "22", y2: "15" })
|
|
5517
|
+
]
|
|
5518
|
+
}
|
|
5519
|
+
);
|
|
5520
|
+
}
|
|
5521
|
+
function IconSettings() {
|
|
5522
|
+
return /* @__PURE__ */ jsxs2(
|
|
5523
|
+
"svg",
|
|
5524
|
+
{
|
|
5525
|
+
width: 20,
|
|
5526
|
+
height: 20,
|
|
5527
|
+
viewBox: "0 0 24 24",
|
|
5528
|
+
fill: "none",
|
|
5529
|
+
stroke: "currentColor",
|
|
5530
|
+
strokeWidth: 1.75,
|
|
5531
|
+
strokeLinecap: "round",
|
|
5532
|
+
strokeLinejoin: "round",
|
|
5533
|
+
"aria-hidden": "true",
|
|
5534
|
+
children: [
|
|
5535
|
+
/* @__PURE__ */ jsx5("path", { d: "M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" }),
|
|
5536
|
+
/* @__PURE__ */ jsx5("circle", { cx: "12", cy: "12", r: "3" })
|
|
5537
|
+
]
|
|
5538
|
+
}
|
|
5539
|
+
);
|
|
5540
|
+
}
|
|
5541
|
+
function IconTheaterExpand() {
|
|
5542
|
+
return /* @__PURE__ */ jsxs2(
|
|
5543
|
+
"svg",
|
|
5544
|
+
{
|
|
5545
|
+
width: 20,
|
|
5546
|
+
height: 20,
|
|
5547
|
+
viewBox: "0 0 24 24",
|
|
5548
|
+
fill: "none",
|
|
5549
|
+
stroke: "currentColor",
|
|
5550
|
+
strokeWidth: 1.75,
|
|
5551
|
+
strokeLinecap: "round",
|
|
5552
|
+
strokeLinejoin: "round",
|
|
5553
|
+
"aria-hidden": "true",
|
|
5554
|
+
children: [
|
|
5555
|
+
/* @__PURE__ */ jsx5("polyline", { points: "15 3 21 3 21 9" }),
|
|
5556
|
+
/* @__PURE__ */ jsx5("polyline", { points: "9 21 3 21 3 15" }),
|
|
5557
|
+
/* @__PURE__ */ jsx5("line", { x1: "21", y1: "3", x2: "14", y2: "10" }),
|
|
5558
|
+
/* @__PURE__ */ jsx5("line", { x1: "3", y1: "21", x2: "10", y2: "14" })
|
|
5559
|
+
]
|
|
5560
|
+
}
|
|
5561
|
+
);
|
|
5562
|
+
}
|
|
5563
|
+
function IconTheaterShrink() {
|
|
5564
|
+
return /* @__PURE__ */ jsxs2(
|
|
5565
|
+
"svg",
|
|
5566
|
+
{
|
|
5567
|
+
width: 20,
|
|
5568
|
+
height: 20,
|
|
5569
|
+
viewBox: "0 0 24 24",
|
|
5570
|
+
fill: "none",
|
|
5571
|
+
stroke: "currentColor",
|
|
5572
|
+
strokeWidth: 1.75,
|
|
5573
|
+
strokeLinecap: "round",
|
|
5574
|
+
strokeLinejoin: "round",
|
|
5575
|
+
"aria-hidden": "true",
|
|
5576
|
+
children: [
|
|
5577
|
+
/* @__PURE__ */ jsx5("polyline", { points: "4 14 10 14 10 20" }),
|
|
5578
|
+
/* @__PURE__ */ jsx5("polyline", { points: "20 10 14 10 14 4" }),
|
|
5579
|
+
/* @__PURE__ */ jsx5("line", { x1: "14", y1: "10", x2: "21", y2: "3" }),
|
|
5580
|
+
/* @__PURE__ */ jsx5("line", { x1: "3", y1: "21", x2: "10", y2: "14" })
|
|
5581
|
+
]
|
|
5582
|
+
}
|
|
5583
|
+
);
|
|
5584
|
+
}
|
|
5585
|
+
function IconFullscreenEnter({ slot }) {
|
|
5586
|
+
return /* @__PURE__ */ jsxs2(
|
|
5587
|
+
"svg",
|
|
5588
|
+
{
|
|
5589
|
+
slot,
|
|
5590
|
+
width: 20,
|
|
5591
|
+
height: 20,
|
|
5592
|
+
viewBox: "0 0 24 24",
|
|
5593
|
+
fill: "none",
|
|
5594
|
+
stroke: "currentColor",
|
|
5595
|
+
strokeWidth: 1.75,
|
|
5596
|
+
strokeLinecap: "round",
|
|
5597
|
+
strokeLinejoin: "round",
|
|
5598
|
+
"aria-hidden": "true",
|
|
5599
|
+
children: [
|
|
5600
|
+
/* @__PURE__ */ jsx5("path", { d: "M8 3H5a2 2 0 0 0-2 2v3" }),
|
|
5601
|
+
/* @__PURE__ */ jsx5("path", { d: "M21 8V5a2 2 0 0 0-2-2h-3" }),
|
|
5602
|
+
/* @__PURE__ */ jsx5("path", { d: "M3 16v3a2 2 0 0 0 2 2h3" }),
|
|
5603
|
+
/* @__PURE__ */ jsx5("path", { d: "M16 21h3a2 2 0 0 0 2-2v-3" })
|
|
5604
|
+
]
|
|
5605
|
+
}
|
|
5606
|
+
);
|
|
5607
|
+
}
|
|
5608
|
+
function IconFullscreenExit({ slot }) {
|
|
5609
|
+
return /* @__PURE__ */ jsxs2(
|
|
5610
|
+
"svg",
|
|
5611
|
+
{
|
|
5612
|
+
slot,
|
|
5613
|
+
width: 20,
|
|
5614
|
+
height: 20,
|
|
5615
|
+
viewBox: "0 0 24 24",
|
|
5616
|
+
fill: "none",
|
|
5617
|
+
stroke: "currentColor",
|
|
5618
|
+
strokeWidth: 1.75,
|
|
5619
|
+
strokeLinecap: "round",
|
|
5620
|
+
strokeLinejoin: "round",
|
|
5621
|
+
"aria-hidden": "true",
|
|
5622
|
+
children: [
|
|
5623
|
+
/* @__PURE__ */ jsx5("path", { d: "M8 3v3a2 2 0 0 1-2 2H3" }),
|
|
5624
|
+
/* @__PURE__ */ jsx5("path", { d: "M21 8h-3a2 2 0 0 1-2-2V3" }),
|
|
5625
|
+
/* @__PURE__ */ jsx5("path", { d: "M3 16h3a2 2 0 0 1 2 2v3" }),
|
|
5626
|
+
/* @__PURE__ */ jsx5("path", { d: "M16 21v-3a2 2 0 0 1 2-2h3" })
|
|
5627
|
+
]
|
|
5628
|
+
}
|
|
5629
|
+
);
|
|
5630
|
+
}
|
|
5631
|
+
var EMPTY_GOALS2 = [];
|
|
5632
|
+
function serverVideoSnapshot() {
|
|
5633
|
+
return null;
|
|
5634
|
+
}
|
|
5635
|
+
function serverGoalsSnapshot() {
|
|
5636
|
+
return EMPTY_GOALS2;
|
|
5637
|
+
}
|
|
5638
|
+
function useTrackedVideoConfig(videoKey, trackingConfig, fallbackConfig) {
|
|
5639
|
+
registerCapability("video_tracking");
|
|
5640
|
+
const effectiveRef = trackingConfig ?? getActiveTrackingEnv().trackingConfig;
|
|
5641
|
+
const subscribe = useCallback4(
|
|
5642
|
+
(listener) => effectiveRef ? getTrackingConfigRuntime(effectiveRef).subscribe(listener) : () => {
|
|
5643
|
+
},
|
|
5644
|
+
[effectiveRef]
|
|
5645
|
+
);
|
|
5646
|
+
const live = useSyncExternalStore2(
|
|
5647
|
+
subscribe,
|
|
5648
|
+
() => effectiveRef && videoKey ? getTrackingConfigRuntime(effectiveRef).getVideo(videoKey) : null,
|
|
5649
|
+
serverVideoSnapshot
|
|
5650
|
+
);
|
|
5651
|
+
return live ?? fallbackConfig ?? null;
|
|
5652
|
+
}
|
|
5653
|
+
function useActiveVideoGoals(videoId, trackingConfig) {
|
|
5654
|
+
const effectiveRef = trackingConfig ?? getActiveTrackingEnv().trackingConfig;
|
|
5655
|
+
const subscribe = useCallback4(
|
|
5656
|
+
(listener) => effectiveRef ? getTrackingConfigRuntime(effectiveRef).subscribe(listener) : () => {
|
|
5657
|
+
},
|
|
5658
|
+
[effectiveRef]
|
|
5659
|
+
);
|
|
5660
|
+
const goals = useSyncExternalStore2(
|
|
5661
|
+
subscribe,
|
|
5662
|
+
() => effectiveRef ? getTrackingConfigRuntime(effectiveRef).listGoals() : EMPTY_GOALS2,
|
|
5663
|
+
serverGoalsSnapshot
|
|
5664
|
+
);
|
|
5665
|
+
return useMemo6(() => {
|
|
5666
|
+
const out = [];
|
|
5667
|
+
for (const goal of goals) {
|
|
5668
|
+
if (goal.kind !== "event" || !goal.trigger) continue;
|
|
5669
|
+
if (goal.trigger.event_type !== "video_progress") continue;
|
|
5670
|
+
if (goal.trigger.video_id && goal.trigger.video_id !== videoId) continue;
|
|
5671
|
+
const metric = goal.trigger.metric;
|
|
5672
|
+
const threshold = goal.trigger.threshold;
|
|
5673
|
+
if ((metric === "percent" || metric === "seconds") && typeof threshold === "number") {
|
|
5674
|
+
out.push({ key: goal.key, metric, threshold });
|
|
5675
|
+
}
|
|
5676
|
+
}
|
|
5677
|
+
return out;
|
|
5678
|
+
}, [goals, videoId]);
|
|
5679
|
+
}
|
|
5680
|
+
function renditionsOf(h) {
|
|
5681
|
+
const best = /* @__PURE__ */ new Map();
|
|
5682
|
+
h.levels.forEach((l, index) => {
|
|
5683
|
+
const px = Math.min(l.width || Infinity, l.height || Infinity);
|
|
5684
|
+
if (!Number.isFinite(px)) return;
|
|
5685
|
+
const cur = best.get(px);
|
|
5686
|
+
if (!cur || l.bitrate > cur.bitrate) best.set(px, { height: px, index, bitrate: l.bitrate });
|
|
5687
|
+
});
|
|
5688
|
+
return [...best.values()].sort((a, b) => b.height - a.height).map(({ height, index }) => ({ height, index }));
|
|
5689
|
+
}
|
|
5690
|
+
var MEDIA_CHROME_CDN_URL = "https://cdn.jsdelivr.net/npm/media-chrome@4/+esm";
|
|
5691
|
+
var HLS_JS_CDN_URL = "https://cdn.jsdelivr.net/npm/hls.js@1/dist/hls.min.js";
|
|
5692
|
+
var defaultLibsPromise = null;
|
|
5693
|
+
function loadScriptOnce(src, attr, isModule = false) {
|
|
5694
|
+
if (typeof document === "undefined") return Promise.resolve();
|
|
5695
|
+
const existing = document.querySelector(`script[${attr}]`);
|
|
5696
|
+
if (existing) return Promise.resolve();
|
|
5697
|
+
return new Promise((resolve) => {
|
|
5698
|
+
const s = document.createElement("script");
|
|
5699
|
+
if (isModule) s.type = "module";
|
|
5700
|
+
s.async = true;
|
|
5701
|
+
s.src = src;
|
|
5702
|
+
s.setAttribute(attr, "1");
|
|
5703
|
+
s.addEventListener("load", () => resolve(), { once: true });
|
|
5704
|
+
s.addEventListener("error", () => resolve(), { once: true });
|
|
5705
|
+
document.head.append(s);
|
|
5706
|
+
if (typeof navigator !== "undefined" && /jsdom/i.test(navigator.userAgent)) {
|
|
5707
|
+
setTimeout(resolve, 0);
|
|
5708
|
+
}
|
|
5709
|
+
});
|
|
5710
|
+
}
|
|
5711
|
+
function loadDefaultPlayerLibs() {
|
|
5712
|
+
if (typeof window === "undefined") return Promise.resolve({});
|
|
5713
|
+
if (defaultLibsPromise) return defaultLibsPromise;
|
|
5714
|
+
defaultLibsPromise = Promise.all([
|
|
5715
|
+
typeof customElements !== "undefined" && customElements.get("media-controller") ? Promise.resolve() : loadScriptOnce(MEDIA_CHROME_CDN_URL, "data-aranova-media-chrome", true),
|
|
5716
|
+
window.Hls ? Promise.resolve() : loadScriptOnce(HLS_JS_CDN_URL, "data-aranova-hls-js", false)
|
|
5717
|
+
]).then(() => ({
|
|
5718
|
+
hls: window.Hls
|
|
5719
|
+
}));
|
|
5720
|
+
return defaultLibsPromise;
|
|
5721
|
+
}
|
|
5722
|
+
function Cut({
|
|
5723
|
+
id,
|
|
5724
|
+
variant,
|
|
5725
|
+
uid,
|
|
5726
|
+
host,
|
|
5727
|
+
title,
|
|
5728
|
+
posterTime,
|
|
5729
|
+
posterUrl,
|
|
5730
|
+
renderPoster,
|
|
5731
|
+
theater,
|
|
5732
|
+
onTheaterChange,
|
|
5733
|
+
autoExpandOnPlay,
|
|
5734
|
+
checkpoints,
|
|
5735
|
+
videoGoals,
|
|
5736
|
+
client,
|
|
5737
|
+
loadPlayerLibs,
|
|
5738
|
+
className,
|
|
5739
|
+
...cb
|
|
5740
|
+
}) {
|
|
5741
|
+
const root = useRef2(null);
|
|
5742
|
+
const video = useRef2(null);
|
|
5743
|
+
const hls = useRef2(null);
|
|
5744
|
+
const lastTime = useRef2(0);
|
|
5745
|
+
const seekFrom = useRef2(0);
|
|
5746
|
+
const cbRef = useRef2(cb);
|
|
5747
|
+
cbRef.current = cb;
|
|
5748
|
+
const clientRef = useRef2(client);
|
|
5749
|
+
clientRef.current = client;
|
|
5750
|
+
const goalsRef = useRef2(videoGoals);
|
|
5751
|
+
goalsRef.current = videoGoals;
|
|
5752
|
+
const rangesRef = useRef2([]);
|
|
5753
|
+
const activeSegmentStartRef = useRef2(null);
|
|
5754
|
+
const furthestSecondsRef = useRef2(0);
|
|
5755
|
+
const maxPercentRef = useRef2(0);
|
|
5756
|
+
const durationRef = useRef2(0);
|
|
5757
|
+
const playCountRef = useRef2(0);
|
|
5758
|
+
const seekCountRef = useRef2(0);
|
|
5759
|
+
const firedCheckpointsRef = useRef2(/* @__PURE__ */ new Set());
|
|
5760
|
+
const firedGoalsRef = useRef2(/* @__PURE__ */ new Set());
|
|
5761
|
+
const dirtySinceLastEmitRef = useRef2(false);
|
|
5762
|
+
const [started, setStarted] = useState5(false);
|
|
5763
|
+
const [ready, setReady] = useState5(false);
|
|
5764
|
+
const [playing, setPlaying] = useState5(false);
|
|
5765
|
+
const [renditions, setRenditions] = useState5([]);
|
|
5766
|
+
const [selected, setSelected] = useState5("auto");
|
|
5767
|
+
const [live, setLive] = useState5(null);
|
|
5768
|
+
const [menu, setMenu] = useState5(false);
|
|
5769
|
+
const [pending, setPending] = useState5(null);
|
|
5770
|
+
const pendingRef = useRef2(null);
|
|
5771
|
+
const wrap = useRef2(null);
|
|
5772
|
+
const gear = useRef2(null);
|
|
5773
|
+
const selectedRef = useRef2("auto");
|
|
5774
|
+
const pendingTimer = useRef2(null);
|
|
5775
|
+
const liveRef = useRef2(null);
|
|
5776
|
+
const videoId = `${id}-${variant}`;
|
|
5777
|
+
const getCurrentRanges = useCallback4(() => {
|
|
5778
|
+
const v = video.current;
|
|
5779
|
+
const cur = v ? v.currentTime : lastTime.current;
|
|
5780
|
+
const list = [...rangesRef.current];
|
|
5781
|
+
if (activeSegmentStartRef.current !== null && cur > activeSegmentStartRef.current) {
|
|
5782
|
+
list.push({
|
|
5783
|
+
start_s: activeSegmentStartRef.current,
|
|
5784
|
+
end_s: cur
|
|
5785
|
+
});
|
|
5786
|
+
}
|
|
5787
|
+
return mergeVideoRanges(list);
|
|
5788
|
+
}, []);
|
|
5789
|
+
const commitActiveSegment = useCallback4((endTime) => {
|
|
5790
|
+
const end = endTime ?? video.current?.currentTime ?? lastTime.current;
|
|
5791
|
+
if (activeSegmentStartRef.current !== null && end > activeSegmentStartRef.current) {
|
|
5792
|
+
rangesRef.current = mergeVideoRanges([
|
|
5793
|
+
...rangesRef.current,
|
|
5794
|
+
{ start_s: activeSegmentStartRef.current, end_s: end }
|
|
5795
|
+
]);
|
|
5796
|
+
}
|
|
5797
|
+
activeSegmentStartRef.current = null;
|
|
5798
|
+
}, []);
|
|
5799
|
+
const snap = useCallback4(() => {
|
|
5800
|
+
const v = video.current;
|
|
5801
|
+
const currentTime = roundVideoSeconds(v?.currentTime ?? lastTime.current);
|
|
5802
|
+
const rawDuration = v?.duration;
|
|
5803
|
+
const duration = typeof rawDuration === "number" && Number.isFinite(rawDuration) && rawDuration > 0 ? roundVideoSeconds(rawDuration) : durationRef.current;
|
|
5804
|
+
if (duration > 0) durationRef.current = duration;
|
|
5805
|
+
if (currentTime > furthestSecondsRef.current) {
|
|
5806
|
+
furthestSecondsRef.current = currentTime;
|
|
5807
|
+
}
|
|
5808
|
+
const ranges = getCurrentRanges();
|
|
5809
|
+
const watchedSeconds = sumVideoRangesSeconds(ranges, duration);
|
|
5810
|
+
const watchedPercent = duration > 0 ? Math.min(100, Math.round(watchedSeconds / duration * 100)) : 0;
|
|
5811
|
+
const curPercent = duration > 0 ? Math.min(100, Math.round(furthestSecondsRef.current / duration * 100)) : 0;
|
|
5812
|
+
if (curPercent > maxPercentRef.current) {
|
|
5813
|
+
maxPercentRef.current = curPercent;
|
|
5814
|
+
}
|
|
5815
|
+
return {
|
|
5816
|
+
id,
|
|
5817
|
+
videoId,
|
|
5818
|
+
variant,
|
|
5819
|
+
currentTime,
|
|
5820
|
+
duration,
|
|
5821
|
+
watchedSeconds,
|
|
5822
|
+
watchedPercent,
|
|
5823
|
+
maxPercent: maxPercentRef.current,
|
|
5824
|
+
ranges
|
|
5825
|
+
};
|
|
5826
|
+
}, [getCurrentRanges, id, variant, videoId]);
|
|
5827
|
+
const emitProgress = useCallback4(
|
|
5828
|
+
(trigger, snapshotOverride) => {
|
|
5829
|
+
const activeClient = clientRef.current ?? getActiveTrackingEnv().rawClient;
|
|
5830
|
+
if (!activeClient || playCountRef.current <= 0) return;
|
|
5831
|
+
const s = snapshotOverride ?? snap();
|
|
5832
|
+
if (s.ranges.length === 0 && s.currentTime <= 0 && trigger !== "ended") return;
|
|
5833
|
+
dirtySinceLastEmitRef.current = false;
|
|
5834
|
+
const path = typeof window === "undefined" ? "/" : window.location.pathname;
|
|
5835
|
+
activeClient.trackEvent({
|
|
5836
|
+
eventType: "video_progress",
|
|
5837
|
+
metadata: {
|
|
5838
|
+
video_id: id,
|
|
5839
|
+
variant,
|
|
5840
|
+
trigger,
|
|
5841
|
+
current_s: s.currentTime,
|
|
5842
|
+
furthest_s: roundVideoSeconds(furthestSecondsRef.current),
|
|
5843
|
+
watched_s: s.watchedSeconds,
|
|
5844
|
+
duration_s: s.duration,
|
|
5845
|
+
max_percent: s.maxPercent,
|
|
5846
|
+
watched_percent: s.watchedPercent,
|
|
5847
|
+
play_count: playCountRef.current,
|
|
5848
|
+
seek_count: seekCountRef.current,
|
|
5849
|
+
ranges: s.ranges,
|
|
5850
|
+
page: { path }
|
|
5851
|
+
}
|
|
5852
|
+
});
|
|
5853
|
+
},
|
|
5854
|
+
[id, snap, variant]
|
|
5855
|
+
);
|
|
5856
|
+
const clearPending = () => {
|
|
5857
|
+
if (pendingTimer.current) clearTimeout(pendingTimer.current);
|
|
5858
|
+
pendingTimer.current = null;
|
|
5859
|
+
pendingRef.current = null;
|
|
5860
|
+
setPending(null);
|
|
5861
|
+
};
|
|
5862
|
+
useEffect6(() => {
|
|
5863
|
+
ensureTvSkinStyles();
|
|
5864
|
+
registerCapability("video_tracking");
|
|
5865
|
+
return () => {
|
|
5866
|
+
if (pendingTimer.current) clearTimeout(pendingTimer.current);
|
|
5867
|
+
hls.current?.destroy();
|
|
5868
|
+
hls.current = null;
|
|
5869
|
+
};
|
|
5870
|
+
}, []);
|
|
5871
|
+
useEffect6(() => {
|
|
5872
|
+
if (!started || typeof window === "undefined") return;
|
|
5873
|
+
const flushExitProgress = (useBeacon) => {
|
|
5874
|
+
if (playCountRef.current <= 0 || !dirtySinceLastEmitRef.current) return;
|
|
5875
|
+
commitActiveSegment();
|
|
5876
|
+
emitProgress("page_exit");
|
|
5877
|
+
if (useBeacon) {
|
|
5878
|
+
const activeClient2 = clientRef.current ?? getActiveTrackingEnv().rawClient;
|
|
5879
|
+
activeClient2?.flushBeacon();
|
|
5880
|
+
}
|
|
5881
|
+
};
|
|
5882
|
+
const activeClient = clientRef.current ?? getActiveTrackingEnv().rawClient;
|
|
5883
|
+
const unsubscribeBeforeUnload = activeClient?.onBeforeUnload?.(() => {
|
|
5884
|
+
flushExitProgress(false);
|
|
5885
|
+
});
|
|
5886
|
+
const onVisibilityChange = () => {
|
|
5887
|
+
if (document.visibilityState === "hidden") {
|
|
5888
|
+
flushExitProgress(true);
|
|
5889
|
+
}
|
|
5890
|
+
};
|
|
5891
|
+
const onPageHide = () => {
|
|
5892
|
+
flushExitProgress(true);
|
|
5893
|
+
};
|
|
5894
|
+
document.addEventListener("visibilitychange", onVisibilityChange);
|
|
5895
|
+
window.addEventListener("pagehide", onPageHide);
|
|
5896
|
+
return () => {
|
|
5897
|
+
unsubscribeBeforeUnload?.();
|
|
5898
|
+
document.removeEventListener("visibilitychange", onVisibilityChange);
|
|
5899
|
+
window.removeEventListener("pagehide", onPageHide);
|
|
5900
|
+
};
|
|
5901
|
+
}, [started, commitActiveSegment, emitProgress]);
|
|
5902
|
+
useEffect6(() => {
|
|
5903
|
+
if (!started) return;
|
|
5904
|
+
let was = false;
|
|
5905
|
+
const report = (fullscreen) => {
|
|
5906
|
+
if (fullscreen === was) return;
|
|
5907
|
+
was = fullscreen;
|
|
5908
|
+
cbRef.current.onFullscreenChange?.({ ...snap(), fullscreen });
|
|
5909
|
+
};
|
|
5910
|
+
const onDoc = () => {
|
|
5911
|
+
const el = root.current;
|
|
5912
|
+
const fe = document.fullscreenElement ?? document.webkitFullscreenElement;
|
|
5913
|
+
report(Boolean(el && fe && el.contains(fe)));
|
|
5914
|
+
};
|
|
5915
|
+
const v = video.current;
|
|
5916
|
+
const begin = () => report(true);
|
|
5917
|
+
const end = () => report(false);
|
|
5918
|
+
document.addEventListener("fullscreenchange", onDoc);
|
|
5919
|
+
document.addEventListener("webkitfullscreenchange", onDoc);
|
|
5920
|
+
v?.addEventListener("webkitbeginfullscreen", begin);
|
|
5921
|
+
v?.addEventListener("webkitendfullscreen", end);
|
|
5922
|
+
return () => {
|
|
5923
|
+
document.removeEventListener("fullscreenchange", onDoc);
|
|
5924
|
+
document.removeEventListener("webkitfullscreenchange", onDoc);
|
|
5925
|
+
v?.removeEventListener("webkitbeginfullscreen", begin);
|
|
5926
|
+
v?.removeEventListener("webkitendfullscreen", end);
|
|
5927
|
+
};
|
|
5928
|
+
}, [started, snap]);
|
|
5929
|
+
useEffect6(() => {
|
|
5930
|
+
if (!menu) return;
|
|
5931
|
+
const outside = (e) => {
|
|
5932
|
+
if (wrap.current && !wrap.current.contains(e.target)) setMenu(false);
|
|
5933
|
+
};
|
|
5934
|
+
document.addEventListener("pointerdown", outside);
|
|
5935
|
+
return () => document.removeEventListener("pointerdown", outside);
|
|
5936
|
+
}, [menu]);
|
|
5937
|
+
const closeMenu = (refocus) => {
|
|
5938
|
+
setMenu(false);
|
|
5939
|
+
if (refocus) gear.current?.focus();
|
|
5940
|
+
};
|
|
5941
|
+
const onMenuKey = (e) => {
|
|
5942
|
+
if (e.key === "Escape") {
|
|
5943
|
+
e.preventDefault();
|
|
5944
|
+
e.stopPropagation();
|
|
5945
|
+
closeMenu(true);
|
|
5946
|
+
} else if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
5947
|
+
e.preventDefault();
|
|
5948
|
+
const items = [
|
|
5949
|
+
...wrap.current?.querySelectorAll('[role="menuitemradio"]') ?? []
|
|
5950
|
+
];
|
|
5951
|
+
const i = items.indexOf(document.activeElement);
|
|
5952
|
+
items[(i + (e.key === "ArrowDown" ? 1 : items.length - 1)) % items.length]?.focus();
|
|
5953
|
+
}
|
|
5954
|
+
};
|
|
5955
|
+
const emitQuality = (from, to, source) => cbRef.current.onQualityChange?.({ ...snap(), from, to, source });
|
|
5956
|
+
const start = async () => {
|
|
5957
|
+
const v = video.current;
|
|
5958
|
+
if (!v || started) return;
|
|
5959
|
+
setStarted(true);
|
|
5960
|
+
if (variant === "16x9" && autoExpandOnPlay) {
|
|
5961
|
+
onTheaterChange?.(true);
|
|
5962
|
+
}
|
|
5963
|
+
const src = streamManifestUrl(host, uid);
|
|
5964
|
+
try {
|
|
5965
|
+
const loaded = await (loadPlayerLibs ? loadPlayerLibs() : loadDefaultPlayerLibs());
|
|
5966
|
+
setReady(true);
|
|
5967
|
+
const rawHls = (loaded && typeof loaded === "object" && "hls" in loaded ? loaded.hls : null) ?? (typeof window !== "undefined" ? window.Hls : void 0);
|
|
5968
|
+
const HlsLib = rawHls && typeof rawHls === "object" && "default" in rawHls ? rawHls.default : rawHls;
|
|
5969
|
+
if (!HlsLib || !HlsLib.isSupported()) {
|
|
5970
|
+
v.src = src;
|
|
5971
|
+
} else {
|
|
5972
|
+
const h = new HlsLib({ capLevelToPlayerSize: true });
|
|
5973
|
+
hls.current = h;
|
|
5974
|
+
h.on(HlsLib.Events.MANIFEST_PARSED, () => setRenditions(renditionsOf(h)));
|
|
5975
|
+
h.on(HlsLib.Events.LEVEL_SWITCHED, (_e, data) => {
|
|
5976
|
+
const lv = h.levels[data.level];
|
|
5977
|
+
const height = lv ? Math.min(lv.width || Infinity, lv.height || Infinity) : null;
|
|
5978
|
+
const from = liveRef.current;
|
|
5979
|
+
liveRef.current = height;
|
|
5980
|
+
setLive(height);
|
|
5981
|
+
const want = pendingRef.current;
|
|
5982
|
+
if (want !== null && want === height) clearPending();
|
|
5983
|
+
if (selectedRef.current === "auto" && height && from && from !== height) {
|
|
5984
|
+
emitQuality(from, height, "auto");
|
|
5985
|
+
}
|
|
5986
|
+
});
|
|
5987
|
+
h.on(HlsLib.Events.ERROR, () => clearPending());
|
|
5988
|
+
h.loadSource(src);
|
|
5989
|
+
h.attachMedia(v);
|
|
5990
|
+
}
|
|
5991
|
+
} catch {
|
|
5992
|
+
setReady(true);
|
|
5993
|
+
v.src = src;
|
|
5994
|
+
}
|
|
5995
|
+
try {
|
|
5996
|
+
await v.play();
|
|
5997
|
+
} catch {
|
|
5998
|
+
}
|
|
5999
|
+
};
|
|
6000
|
+
const pick = (q) => {
|
|
6001
|
+
const h = hls.current;
|
|
6002
|
+
const from = selectedRef.current;
|
|
6003
|
+
setMenu(false);
|
|
6004
|
+
if (!h || q === from) return;
|
|
6005
|
+
if (q === "auto") h.nextLevel = -1;
|
|
6006
|
+
else {
|
|
6007
|
+
const r = renditions.find((x) => x.height === q);
|
|
6008
|
+
if (r) h.nextLevel = r.index;
|
|
6009
|
+
}
|
|
6010
|
+
selectedRef.current = q;
|
|
6011
|
+
setSelected(q);
|
|
6012
|
+
clearPending();
|
|
6013
|
+
if (typeof q === "number" && q !== liveRef.current) {
|
|
6014
|
+
pendingRef.current = q;
|
|
6015
|
+
setPending(q);
|
|
6016
|
+
pendingTimer.current = setTimeout(clearPending, 4e3);
|
|
6017
|
+
}
|
|
6018
|
+
emitQuality(from, q, "manual");
|
|
6019
|
+
};
|
|
6020
|
+
const qualityLabel = selected === "auto" ? live ? `Auto (${live}p)` : "Auto" : `${selected}p`;
|
|
6021
|
+
const resolvedPosterUrl = posterUrl ?? streamPosterUrl(host, uid, posterTime);
|
|
6022
|
+
const posterWidth = variant === "16x9" ? 1280 : 720;
|
|
6023
|
+
const posterHeight = variant === "16x9" ? 720 : 1280;
|
|
6024
|
+
return /* @__PURE__ */ jsxs2(
|
|
6025
|
+
"div",
|
|
6026
|
+
{
|
|
6027
|
+
ref: root,
|
|
6028
|
+
className: `tv-skin ${variant === "16x9" ? "tv-skin-desktop" : "tv-skin-mobile"} ${className ?? ""}`,
|
|
6029
|
+
"data-video-id": videoId,
|
|
6030
|
+
children: [
|
|
6031
|
+
/* @__PURE__ */ jsxs2("media-controller", { class: "absolute inset-0 block", autohide: menu ? "-1" : "2", children: [
|
|
6032
|
+
/* @__PURE__ */ jsx5(
|
|
6033
|
+
"video",
|
|
6034
|
+
{
|
|
6035
|
+
ref: video,
|
|
6036
|
+
slot: "media",
|
|
6037
|
+
style: { width: "100%", height: "100%", backgroundColor: "#000", objectFit: "contain" },
|
|
6038
|
+
preload: "none",
|
|
6039
|
+
playsInline: true,
|
|
6040
|
+
title,
|
|
6041
|
+
"aria-label": title,
|
|
6042
|
+
"data-video-id": videoId,
|
|
6043
|
+
onPlay: () => {
|
|
6044
|
+
const v = video.current;
|
|
6045
|
+
const cur = roundVideoSeconds(v?.currentTime ?? 0);
|
|
6046
|
+
activeSegmentStartRef.current = cur;
|
|
6047
|
+
playCountRef.current += 1;
|
|
6048
|
+
dirtySinceLastEmitRef.current = true;
|
|
6049
|
+
const s = snap();
|
|
6050
|
+
const activeClient = clientRef.current ?? getActiveTrackingEnv().rawClient;
|
|
6051
|
+
if (activeClient) {
|
|
6052
|
+
const path = typeof window === "undefined" ? "/" : window.location.pathname;
|
|
6053
|
+
activeClient.trackEvent({
|
|
6054
|
+
eventType: "video_play",
|
|
6055
|
+
metadata: {
|
|
6056
|
+
video_id: id,
|
|
6057
|
+
variant,
|
|
6058
|
+
current_s: s.currentTime,
|
|
6059
|
+
duration_s: s.duration,
|
|
6060
|
+
play_sequence: playCountRef.current,
|
|
6061
|
+
page: { path }
|
|
6062
|
+
}
|
|
6063
|
+
});
|
|
6064
|
+
}
|
|
6065
|
+
cbRef.current.onPlay?.(s);
|
|
6066
|
+
},
|
|
6067
|
+
onPlaying: () => setPlaying(true),
|
|
6068
|
+
onPause: () => {
|
|
6069
|
+
const v = video.current;
|
|
6070
|
+
if (v?.ended) return;
|
|
6071
|
+
commitActiveSegment(v?.currentTime);
|
|
6072
|
+
const s = snap();
|
|
6073
|
+
emitProgress("pause", s);
|
|
6074
|
+
cbRef.current.onPause?.(s);
|
|
6075
|
+
},
|
|
6076
|
+
onEnded: () => {
|
|
6077
|
+
const v = video.current;
|
|
6078
|
+
const dur = typeof v?.duration === "number" && Number.isFinite(v.duration) ? v.duration : durationRef.current;
|
|
6079
|
+
commitActiveSegment(dur > 0 ? dur : v?.currentTime);
|
|
6080
|
+
maxPercentRef.current = 100;
|
|
6081
|
+
const s = snap();
|
|
6082
|
+
if (!firedCheckpointsRef.current.has(100) && checkpoints.includes(100)) {
|
|
6083
|
+
firedCheckpointsRef.current.add(100);
|
|
6084
|
+
cbRef.current.onCheckpoint?.({ ...s, checkpoint: 100 });
|
|
6085
|
+
}
|
|
6086
|
+
emitProgress("ended", s);
|
|
6087
|
+
cbRef.current.onEnded?.(s);
|
|
6088
|
+
},
|
|
6089
|
+
onWaiting: () => cbRef.current.onWaiting?.(snap()),
|
|
6090
|
+
onTimeUpdate: () => {
|
|
6091
|
+
const v = video.current;
|
|
6092
|
+
if (v && !v.seeking) {
|
|
6093
|
+
if (activeSegmentStartRef.current === null && !v.paused) {
|
|
6094
|
+
activeSegmentStartRef.current = lastTime.current;
|
|
6095
|
+
}
|
|
6096
|
+
lastTime.current = v.currentTime;
|
|
6097
|
+
dirtySinceLastEmitRef.current = true;
|
|
6098
|
+
}
|
|
6099
|
+
const s = snap();
|
|
6100
|
+
let hitCheckpoint = false;
|
|
6101
|
+
let hitGoal = false;
|
|
6102
|
+
for (const goal of goalsRef.current) {
|
|
6103
|
+
if (firedGoalsRef.current.has(goal.key)) continue;
|
|
6104
|
+
const met = goal.metric === "seconds" ? s.watchedSeconds >= goal.threshold : s.watchedPercent >= goal.threshold;
|
|
6105
|
+
if (met) {
|
|
6106
|
+
firedGoalsRef.current.add(goal.key);
|
|
6107
|
+
hitGoal = true;
|
|
6108
|
+
}
|
|
6109
|
+
}
|
|
6110
|
+
const newlyFiredCheckpoints = [];
|
|
6111
|
+
for (const cp of checkpoints) {
|
|
6112
|
+
if (firedCheckpointsRef.current.has(cp)) continue;
|
|
6113
|
+
if (s.watchedPercent >= cp || s.maxPercent >= cp) {
|
|
6114
|
+
firedCheckpointsRef.current.add(cp);
|
|
6115
|
+
newlyFiredCheckpoints.push(cp);
|
|
6116
|
+
hitCheckpoint = true;
|
|
6117
|
+
}
|
|
6118
|
+
}
|
|
6119
|
+
if (hitCheckpoint || hitGoal) {
|
|
6120
|
+
commitActiveSegment(v?.currentTime);
|
|
6121
|
+
if (v && !v.paused) activeSegmentStartRef.current = v.currentTime;
|
|
6122
|
+
const emittedSnap = snap();
|
|
6123
|
+
emitProgress(hitCheckpoint ? "checkpoint" : "goal", emittedSnap);
|
|
6124
|
+
for (const cp of newlyFiredCheckpoints) {
|
|
6125
|
+
cbRef.current.onCheckpoint?.({ ...emittedSnap, checkpoint: cp });
|
|
6126
|
+
}
|
|
6127
|
+
}
|
|
6128
|
+
cbRef.current.onTimeUpdate?.(s);
|
|
6129
|
+
},
|
|
6130
|
+
onSeeking: () => {
|
|
6131
|
+
seekFrom.current = lastTime.current;
|
|
6132
|
+
commitActiveSegment(seekFrom.current);
|
|
6133
|
+
},
|
|
6134
|
+
onSeeked: () => {
|
|
6135
|
+
const v = video.current;
|
|
6136
|
+
const to = roundVideoSeconds(v?.currentTime ?? 0);
|
|
6137
|
+
const from = roundVideoSeconds(seekFrom.current);
|
|
6138
|
+
lastTime.current = to;
|
|
6139
|
+
if (v && !v.paused) {
|
|
6140
|
+
activeSegmentStartRef.current = to;
|
|
6141
|
+
}
|
|
6142
|
+
if (Math.abs(to - from) >= 1) {
|
|
6143
|
+
seekCountRef.current += 1;
|
|
6144
|
+
const s = snap();
|
|
6145
|
+
emitProgress("seek", s);
|
|
6146
|
+
cbRef.current.onSeek?.({ ...s, from, to });
|
|
6147
|
+
}
|
|
6148
|
+
},
|
|
6149
|
+
children: /* @__PURE__ */ jsx5("track", { kind: "captions" })
|
|
6150
|
+
}
|
|
6151
|
+
),
|
|
6152
|
+
ready && /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
6153
|
+
/* @__PURE__ */ jsx5("media-loading-indicator", { slot: "centered-chrome" }),
|
|
6154
|
+
/* @__PURE__ */ jsxs2("div", { className: "tv-chrome", children: [
|
|
6155
|
+
/* @__PURE__ */ jsxs2("div", { className: "tv-row", children: [
|
|
6156
|
+
/* @__PURE__ */ jsxs2("media-play-button", { class: "tv-ctl", children: [
|
|
6157
|
+
/* @__PURE__ */ jsx5(IconPlay, { slot: "play" }),
|
|
6158
|
+
/* @__PURE__ */ jsx5(IconPause, { slot: "pause" })
|
|
6159
|
+
] }),
|
|
6160
|
+
/* @__PURE__ */ jsx5("media-time-display", { class: "tv-time tv-time-full", showduration: true }),
|
|
6161
|
+
/* @__PURE__ */ jsx5("media-time-display", { class: "tv-time tv-time-cur" }),
|
|
6162
|
+
/* @__PURE__ */ jsx5("span", { className: "tv-spacer" }),
|
|
6163
|
+
/* @__PURE__ */ jsxs2("div", { className: "tv-vol", children: [
|
|
6164
|
+
/* @__PURE__ */ jsxs2("media-mute-button", { class: "tv-ctl", children: [
|
|
6165
|
+
/* @__PURE__ */ jsx5(IconVolumeHigh, { slot: "high" }),
|
|
6166
|
+
/* @__PURE__ */ jsx5(IconVolumeLow, { slot: "medium" }),
|
|
6167
|
+
/* @__PURE__ */ jsx5(IconVolumeLow, { slot: "low" }),
|
|
6168
|
+
/* @__PURE__ */ jsx5(IconVolumeOff, { slot: "off" })
|
|
6169
|
+
] }),
|
|
6170
|
+
/* @__PURE__ */ jsx5("media-volume-range", { class: "tv-volrange" })
|
|
6171
|
+
] }),
|
|
6172
|
+
renditions.length > 1 && /* @__PURE__ */ jsxs2("div", { className: "tv-menu-wrap", ref: wrap, children: [
|
|
6173
|
+
/* @__PURE__ */ jsx5(
|
|
6174
|
+
"button",
|
|
6175
|
+
{
|
|
6176
|
+
ref: gear,
|
|
6177
|
+
type: "button",
|
|
6178
|
+
className: "tv-btn",
|
|
6179
|
+
"aria-haspopup": "menu",
|
|
6180
|
+
"aria-expanded": menu,
|
|
6181
|
+
"aria-label": `Settings, quality ${qualityLabel}`,
|
|
6182
|
+
title: "Settings",
|
|
6183
|
+
onClick: () => setMenu((m) => !m),
|
|
6184
|
+
onKeyDown: onMenuKey,
|
|
6185
|
+
children: /* @__PURE__ */ jsx5(IconSettings, {})
|
|
6186
|
+
}
|
|
6187
|
+
),
|
|
6188
|
+
/* @__PURE__ */ jsx5("span", { role: "status", className: "sr-only", children: pending !== null ? `Switching to ${pending}p` : "" }),
|
|
6189
|
+
menu && /* @__PURE__ */ jsxs2(
|
|
6190
|
+
"ul",
|
|
6191
|
+
{
|
|
6192
|
+
role: "menu",
|
|
6193
|
+
"aria-label": "Quality",
|
|
6194
|
+
className: "tv-menu",
|
|
6195
|
+
onKeyDown: onMenuKey,
|
|
6196
|
+
children: [
|
|
6197
|
+
["auto", ...renditions.map((r) => r.height)].map(
|
|
6198
|
+
(q) => /* @__PURE__ */ jsx5("li", { role: "none", children: /* @__PURE__ */ jsx5(
|
|
6199
|
+
"button",
|
|
6200
|
+
{
|
|
6201
|
+
type: "button",
|
|
6202
|
+
role: "menuitemradio",
|
|
6203
|
+
"aria-checked": selected === q,
|
|
6204
|
+
className: "tv-menu-item",
|
|
6205
|
+
onClick: () => pick(q),
|
|
6206
|
+
children: q === "auto" ? /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
6207
|
+
"Auto",
|
|
6208
|
+
live ? /* @__PURE__ */ jsxs2("span", { className: "tv-menu-sub", children: [
|
|
6209
|
+
" ",
|
|
6210
|
+
live,
|
|
6211
|
+
"p"
|
|
6212
|
+
] }) : null
|
|
6213
|
+
] }) : `${q}p`
|
|
6214
|
+
}
|
|
6215
|
+
) }, String(q))
|
|
6216
|
+
),
|
|
6217
|
+
/* @__PURE__ */ jsx5("li", { "aria-hidden": "true", className: "tv-menu-note", children: pending !== null ? `Switching to ${pending}p\u2026` : "" })
|
|
6218
|
+
]
|
|
6219
|
+
}
|
|
6220
|
+
)
|
|
6221
|
+
] }),
|
|
6222
|
+
variant === "16x9" && onTheaterChange && /* @__PURE__ */ jsx5(
|
|
6223
|
+
"button",
|
|
6224
|
+
{
|
|
6225
|
+
type: "button",
|
|
6226
|
+
className: "tv-btn tv-theater",
|
|
6227
|
+
"aria-pressed": theater,
|
|
6228
|
+
"aria-label": theater ? "Shrink the player" : "Expand the player",
|
|
6229
|
+
title: theater ? "Shrink" : "Expand",
|
|
6230
|
+
onClick: () => onTheaterChange(!theater),
|
|
6231
|
+
children: theater ? /* @__PURE__ */ jsx5(IconTheaterShrink, {}) : /* @__PURE__ */ jsx5(IconTheaterExpand, {})
|
|
6232
|
+
}
|
|
6233
|
+
),
|
|
6234
|
+
/* @__PURE__ */ jsxs2("media-fullscreen-button", { class: "tv-ctl", children: [
|
|
6235
|
+
/* @__PURE__ */ jsx5(IconFullscreenEnter, { slot: "enter" }),
|
|
6236
|
+
/* @__PURE__ */ jsx5(IconFullscreenExit, { slot: "exit" })
|
|
6237
|
+
] })
|
|
6238
|
+
] }),
|
|
6239
|
+
/* @__PURE__ */ jsx5("media-time-range", { class: "tv-seek" })
|
|
6240
|
+
] })
|
|
6241
|
+
] })
|
|
6242
|
+
] }),
|
|
6243
|
+
!playing && /* @__PURE__ */ jsxs2("div", { className: "tv-poster-overlay", children: [
|
|
6244
|
+
renderPoster ? renderPoster({
|
|
6245
|
+
src: resolvedPosterUrl,
|
|
6246
|
+
variant,
|
|
6247
|
+
title,
|
|
6248
|
+
width: posterWidth,
|
|
6249
|
+
height: posterHeight
|
|
6250
|
+
}) : /* @__PURE__ */ jsx5(
|
|
6251
|
+
"img",
|
|
6252
|
+
{
|
|
6253
|
+
src: resolvedPosterUrl,
|
|
6254
|
+
alt: "",
|
|
6255
|
+
width: posterWidth,
|
|
6256
|
+
height: posterHeight,
|
|
6257
|
+
loading: "lazy",
|
|
6258
|
+
decoding: "async",
|
|
6259
|
+
className: "tv-poster-img"
|
|
6260
|
+
}
|
|
6261
|
+
),
|
|
6262
|
+
!started && /* @__PURE__ */ jsx5(
|
|
6263
|
+
"button",
|
|
6264
|
+
{
|
|
6265
|
+
type: "button",
|
|
6266
|
+
onClick: start,
|
|
6267
|
+
"aria-label": `Play video: ${title}`,
|
|
6268
|
+
className: "tv-play-trigger",
|
|
6269
|
+
children: /* @__PURE__ */ jsx5("span", { className: "tv-play-pill", children: /* @__PURE__ */ jsx5(IconPlay, { size: 26, filled: true }) })
|
|
6270
|
+
}
|
|
6271
|
+
)
|
|
6272
|
+
] })
|
|
6273
|
+
]
|
|
6274
|
+
}
|
|
6275
|
+
);
|
|
6276
|
+
}
|
|
6277
|
+
function TrackedVideo(props) {
|
|
6278
|
+
const {
|
|
6279
|
+
id,
|
|
6280
|
+
video,
|
|
6281
|
+
host,
|
|
6282
|
+
sources,
|
|
6283
|
+
title,
|
|
6284
|
+
posterTime,
|
|
6285
|
+
posterUrl,
|
|
6286
|
+
renderPoster,
|
|
6287
|
+
theater: controlledTheater,
|
|
6288
|
+
defaultTheater = false,
|
|
6289
|
+
onTheaterChange,
|
|
6290
|
+
expandMode = "inline",
|
|
6291
|
+
autoExpandOnPlay = true,
|
|
6292
|
+
expandedMaxWidth = 1100,
|
|
6293
|
+
checkpoints = DEFAULT_VIDEO_CHECKPOINTS,
|
|
6294
|
+
trackingConfig,
|
|
6295
|
+
fallbackConfig,
|
|
6296
|
+
client = null,
|
|
6297
|
+
loadPlayerLibs,
|
|
6298
|
+
className = "",
|
|
6299
|
+
style,
|
|
6300
|
+
...callbacks
|
|
6301
|
+
} = props;
|
|
6302
|
+
const videoKey = id ?? video ?? fallbackConfig?.key ?? "";
|
|
6303
|
+
const r2Video = useTrackedVideoConfig(videoKey || void 0, trackingConfig, fallbackConfig);
|
|
6304
|
+
const videoGoals = useActiveVideoGoals(videoKey, trackingConfig);
|
|
6305
|
+
const [internalTheater, setInternalTheater] = useState5(defaultTheater);
|
|
6306
|
+
const isTheaterControlled = controlledTheater !== void 0;
|
|
6307
|
+
const activeTheater = isTheaterControlled ? controlledTheater : internalTheater;
|
|
6308
|
+
const handleTheaterChange = useCallback4(
|
|
6309
|
+
(next) => {
|
|
6310
|
+
if (!isTheaterControlled) {
|
|
6311
|
+
setInternalTheater(next);
|
|
6312
|
+
}
|
|
6313
|
+
onTheaterChange?.(next);
|
|
6314
|
+
},
|
|
6315
|
+
[isTheaterControlled, onTheaterChange]
|
|
6316
|
+
);
|
|
6317
|
+
const resolvedHost = host ?? r2Video?.host ?? "";
|
|
6318
|
+
const desktopUid = sources?.desktop ?? r2Video?.sources.desktop ?? "";
|
|
6319
|
+
const mobileUid = sources?.mobile ?? r2Video?.sources.mobile ?? desktopUid;
|
|
6320
|
+
const resolvedTitle = title ?? r2Video?.title ?? videoKey;
|
|
6321
|
+
const resolvedPosterTime = posterTime ?? r2Video?.poster_time ?? r2Video?.poster_time_s ?? 4;
|
|
6322
|
+
if (!videoKey || !resolvedHost || !desktopUid) {
|
|
6323
|
+
return null;
|
|
6324
|
+
}
|
|
6325
|
+
const showTheaterControl = expandMode !== "none" && (expandMode === "theater" || Boolean(onTheaterChange));
|
|
6326
|
+
const wrapperStyle = !isTheaterControlled && expandMode === "theater" && activeTheater ? {
|
|
6327
|
+
maxWidth: typeof expandedMaxWidth === "number" ? `${expandedMaxWidth}px` : expandedMaxWidth,
|
|
6328
|
+
marginLeft: "auto",
|
|
6329
|
+
marginRight: "auto",
|
|
6330
|
+
width: "100%",
|
|
6331
|
+
transition: "max-width 360ms cubic-bezier(0.2, 0.7, 0.2, 1)",
|
|
6332
|
+
...style
|
|
6333
|
+
} : style;
|
|
6334
|
+
return /* @__PURE__ */ jsxs2("div", { className, style: wrapperStyle, "data-tracked-video": videoKey, children: [
|
|
6335
|
+
/* @__PURE__ */ jsx5(
|
|
6336
|
+
Cut,
|
|
6337
|
+
{
|
|
6338
|
+
...callbacks,
|
|
6339
|
+
id: videoKey,
|
|
6340
|
+
variant: "16x9",
|
|
6341
|
+
uid: desktopUid,
|
|
6342
|
+
host: resolvedHost,
|
|
6343
|
+
title: resolvedTitle,
|
|
6344
|
+
posterTime: resolvedPosterTime,
|
|
6345
|
+
posterUrl,
|
|
6346
|
+
renderPoster,
|
|
6347
|
+
theater: activeTheater,
|
|
6348
|
+
onTheaterChange: showTheaterControl ? handleTheaterChange : void 0,
|
|
6349
|
+
autoExpandOnPlay,
|
|
6350
|
+
checkpoints,
|
|
6351
|
+
videoGoals,
|
|
6352
|
+
client,
|
|
6353
|
+
loadPlayerLibs
|
|
6354
|
+
}
|
|
6355
|
+
),
|
|
6356
|
+
/* @__PURE__ */ jsx5(
|
|
6357
|
+
Cut,
|
|
6358
|
+
{
|
|
6359
|
+
...callbacks,
|
|
6360
|
+
id: videoKey,
|
|
6361
|
+
variant: "9x16",
|
|
6362
|
+
uid: mobileUid || desktopUid,
|
|
6363
|
+
host: resolvedHost,
|
|
6364
|
+
title: resolvedTitle,
|
|
6365
|
+
posterTime: resolvedPosterTime,
|
|
6366
|
+
posterUrl,
|
|
6367
|
+
renderPoster,
|
|
6368
|
+
theater: false,
|
|
6369
|
+
onTheaterChange: void 0,
|
|
6370
|
+
autoExpandOnPlay: false,
|
|
6371
|
+
checkpoints,
|
|
6372
|
+
videoGoals,
|
|
6373
|
+
client,
|
|
6374
|
+
loadPlayerLibs
|
|
6375
|
+
}
|
|
6376
|
+
)
|
|
6377
|
+
] });
|
|
6378
|
+
}
|
|
6379
|
+
var STAGE_DURATION_MS = 360;
|
|
6380
|
+
var STAGE_EASE = "cubic-bezier(0.2, 0.7, 0.2, 1)";
|
|
6381
|
+
function TrackedVideoStage({
|
|
6382
|
+
video,
|
|
6383
|
+
children,
|
|
6384
|
+
expandedMaxWidth = 1100,
|
|
6385
|
+
collapsedTextMaxWidth = 760,
|
|
6386
|
+
className = ""
|
|
6387
|
+
}) {
|
|
6388
|
+
const [theater, setTheater] = useState5(video.defaultTheater ?? false);
|
|
6389
|
+
const videoBox = useRef2(null);
|
|
6390
|
+
const textBox = useRef2(null);
|
|
6391
|
+
const first = useRef2(null);
|
|
6392
|
+
const activeTheater = video.theater !== void 0 ? video.theater : theater;
|
|
6393
|
+
const change = useCallback4(
|
|
6394
|
+
(next) => {
|
|
6395
|
+
if (next === activeTheater) return;
|
|
6396
|
+
if (next && typeof window !== "undefined" && !window.matchMedia("(min-width: 768px)").matches) {
|
|
6397
|
+
return;
|
|
6398
|
+
}
|
|
6399
|
+
if (videoBox.current && textBox.current) {
|
|
6400
|
+
first.current = {
|
|
6401
|
+
v: videoBox.current.getBoundingClientRect(),
|
|
6402
|
+
t: textBox.current.getBoundingClientRect()
|
|
6403
|
+
};
|
|
6404
|
+
}
|
|
6405
|
+
if (video.theater === void 0) {
|
|
6406
|
+
setTheater(next);
|
|
6407
|
+
}
|
|
6408
|
+
video.onTheaterChange?.(next);
|
|
6409
|
+
},
|
|
6410
|
+
[activeTheater, video]
|
|
6411
|
+
);
|
|
6412
|
+
useLayoutEffect(() => {
|
|
6413
|
+
if (typeof window === "undefined") return;
|
|
6414
|
+
const f = first.current;
|
|
6415
|
+
const vb = videoBox.current;
|
|
6416
|
+
const tb = textBox.current;
|
|
6417
|
+
first.current = null;
|
|
6418
|
+
if (!f || !vb || !tb) return;
|
|
6419
|
+
const reduce = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
6420
|
+
const lv = vb.getBoundingClientRect();
|
|
6421
|
+
const lt = tb.getBoundingClientRect();
|
|
6422
|
+
if (!reduce && typeof vb.animate === "function" && lv.width > 0) {
|
|
6423
|
+
const s = f.v.width / lv.width;
|
|
6424
|
+
vb.animate(
|
|
6425
|
+
[
|
|
6426
|
+
{
|
|
6427
|
+
transformOrigin: "top left",
|
|
6428
|
+
transform: `translate(${f.v.left - lv.left}px, ${f.v.top - lv.top}px) scale(${s})`
|
|
6429
|
+
},
|
|
6430
|
+
{ transformOrigin: "top left", transform: "none" }
|
|
6431
|
+
],
|
|
6432
|
+
{ duration: STAGE_DURATION_MS, easing: STAGE_EASE }
|
|
6433
|
+
);
|
|
6434
|
+
tb.animate(
|
|
6435
|
+
[
|
|
6436
|
+
{
|
|
6437
|
+
transform: `translate(${f.t.left - lt.left}px, ${f.t.top - lt.top}px)`,
|
|
6438
|
+
opacity: 0.4
|
|
6439
|
+
},
|
|
6440
|
+
{ transform: "none", opacity: 1 }
|
|
6441
|
+
],
|
|
6442
|
+
{ duration: STAGE_DURATION_MS, easing: STAGE_EASE }
|
|
6443
|
+
);
|
|
6444
|
+
}
|
|
6445
|
+
if (lv.top < 80 || lv.bottom > window.innerHeight - 24) {
|
|
6446
|
+
const top = window.scrollY + lv.top - Math.max(96, (window.innerHeight - lv.height) / 2);
|
|
6447
|
+
window.scrollTo({ top, behavior: reduce ? "auto" : "smooth" });
|
|
6448
|
+
}
|
|
6449
|
+
}, [activeTheater]);
|
|
6450
|
+
const maxVideoWidthCss = typeof expandedMaxWidth === "number" ? `${expandedMaxWidth}px` : expandedMaxWidth;
|
|
6451
|
+
const maxTextWidthCss = typeof collapsedTextMaxWidth === "number" ? `${collapsedTextMaxWidth}px` : collapsedTextMaxWidth;
|
|
6452
|
+
return /* @__PURE__ */ jsxs2(
|
|
6453
|
+
"div",
|
|
6454
|
+
{
|
|
6455
|
+
className: activeTheater ? `grid gap-10 md:gap-12 ${className}` : `grid items-start gap-10 lg:grid-cols-[1fr_1fr] lg:gap-16 ${className}`,
|
|
6456
|
+
children: [
|
|
6457
|
+
/* @__PURE__ */ jsx5(
|
|
6458
|
+
"div",
|
|
6459
|
+
{
|
|
6460
|
+
ref: textBox,
|
|
6461
|
+
className: activeTheater ? "md:order-2" : "",
|
|
6462
|
+
style: activeTheater ? { maxWidth: maxTextWidthCss } : void 0,
|
|
6463
|
+
children
|
|
6464
|
+
}
|
|
6465
|
+
),
|
|
6466
|
+
/* @__PURE__ */ jsx5(
|
|
6467
|
+
"div",
|
|
6468
|
+
{
|
|
6469
|
+
ref: videoBox,
|
|
6470
|
+
className: activeTheater ? "md:order-1 md:mx-auto md:w-full" : "",
|
|
6471
|
+
style: activeTheater ? { maxWidth: maxVideoWidthCss, width: "100%" } : void 0,
|
|
6472
|
+
children: /* @__PURE__ */ jsx5(
|
|
6473
|
+
TrackedVideo,
|
|
6474
|
+
{
|
|
6475
|
+
...video,
|
|
6476
|
+
theater: activeTheater,
|
|
6477
|
+
onTheaterChange: change,
|
|
6478
|
+
className: video.className ?? "w-full"
|
|
6479
|
+
}
|
|
6480
|
+
)
|
|
6481
|
+
}
|
|
6482
|
+
)
|
|
6483
|
+
]
|
|
6484
|
+
}
|
|
6485
|
+
);
|
|
6486
|
+
}
|
|
4837
6487
|
export {
|
|
4838
6488
|
AdPlatformTracking,
|
|
4839
6489
|
BookingHandoffLink,
|
|
4840
6490
|
ConsentBanner,
|
|
6491
|
+
DEFAULT_VIDEO_CHECKPOINTS,
|
|
4841
6492
|
GoogleAdsTracking,
|
|
4842
6493
|
PhoneField,
|
|
6494
|
+
TrackedVideo,
|
|
6495
|
+
TrackedVideoStage,
|
|
4843
6496
|
createLeadFormSubmit,
|
|
4844
6497
|
createTracking,
|
|
6498
|
+
streamManifestUrl,
|
|
6499
|
+
streamPosterUrl,
|
|
4845
6500
|
useBookingHandoffUrl,
|
|
4846
6501
|
useBookingIntegration,
|
|
4847
6502
|
useBookingSlots,
|
|
@@ -4852,6 +6507,7 @@ export {
|
|
|
4852
6507
|
useGclid,
|
|
4853
6508
|
usePhoneConfig,
|
|
4854
6509
|
usePhoneField,
|
|
6510
|
+
useTrackedVideoConfig,
|
|
4855
6511
|
useTrackingParams
|
|
4856
6512
|
};
|
|
4857
6513
|
//# sourceMappingURL=client.mjs.map
|