@aranova/tracking-react 1.18.0 → 1.19.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/index.d.mts CHANGED
@@ -1,9 +1,9 @@
1
- export { AdPlatformTracking, AdPlatformTrackingProps, BookedAttempt, BookingHandoffLink, BookingHandoffLinkProps, BookingHandoffOptions, BookingSubmitState, BookingSubmitStatus, ConsentBanner, ConsentBannerProps, CreateTrackingOptions, CreateTrackingResult, GoogleAdsTracking, GoogleAdsTrackingProps, PhoneField, PhoneFieldApi, PhoneFieldProps, PhoneInputProps, TrackingProviderProps, UseConsentResult, UseCookiePreferencesOptions, UseCookiePreferencesResult, UsePhoneFieldOptions, createLeadFormSubmit, createTracking, useBookingHandoffUrl, useBookingIntegration, useBookingSlots, useBookingSubmit, useConsent, useConsentState, useCookiePreferences, useGclid, usePhoneConfig, usePhoneField, useTrackingParams } from '@aranova/tracking-react/client';
1
+ export { AdPlatformTracking, AdPlatformTrackingProps, BookedAttempt, BookingHandoffLink, BookingHandoffLinkProps, BookingHandoffOptions, BookingSubmitState, BookingSubmitStatus, ConsentBanner, ConsentBannerProps, CreateTrackingOptions, CreateTrackingResult, DEFAULT_VIDEO_CHECKPOINTS, GoogleAdsTracking, GoogleAdsTrackingProps, PhoneField, PhoneFieldApi, PhoneFieldProps, PhoneInputProps, TrackedVideo, TrackedVideoCallbacks, TrackedVideoEvent, TrackedVideoProps, TrackedVideoSources, TrackedVideoStage, TrackedVideoStageProps, TrackingProviderProps, UseConsentResult, UseCookiePreferencesOptions, UseCookiePreferencesResult, UsePhoneFieldOptions, VideoQuality, createLeadFormSubmit, createTracking, streamManifestUrl, streamPosterUrl, useBookingHandoffUrl, useBookingIntegration, useBookingSlots, useBookingSubmit, useConsent, useConsentState, useCookiePreferences, useGclid, usePhoneConfig, usePhoneField, useTrackedVideoConfig, useTrackingParams } from '@aranova/tracking-react/client';
2
2
  import { T as TrackingParams, a as TrackingInstallSurface, b as TrackingEnvironment, c as TrackingClientContext, d as TrackingEventCreatePayload, e as TrackingSessionUpsertPayload } from './phone-utils-BlWj8oxq.mjs';
3
3
  export { C as ConsentChoice, f as ConsentChoiceState, g as ConsentSource, h as ConsentState, D as DEFAULT_DECLINE_TTL_DAYS, i as DEFAULT_PHONE_COUNTRY, F as FormContractViolation, j as FormSubmitConfig, k as FormSubmitMetadata, G as GtagEnvironmentMap, J as JsonValue, L as LEAD_FORM_KINDS, l as LEAD_FORM_PRIMITIVES, m as LEAD_FORM_REGISTRY_VERSION, n as LEAD_FORM_ROLES, o as LEAD_FORM_ROLE_SPECS, p as LeadFormKind, q as LeadFormPrimitive, r as LeadFormRole, s as LeadFormRoleOption, t as LeadFormRoleSpec, M as MetaPixelEnvironmentMap, P as ParsedPhone, u as PhoneConfig, v as PhoneDisplayFormat, S as SetConsentOptions, w as TrackedField, x as TrackingInitConfig, y as formatPhone, z as formatPhoneAsTyped, A as getConsentChoice, B as getConsentState, E as leadFormPrimitiveSchemas, H as onConsentChange, I as optIn, K as optOut, N as parsePhone, O as phoneField, Q as resetConsent, R as setConsentState, U as toE164 } from './phone-utils-BlWj8oxq.mjs';
4
- export { A as AranovaApiError, B as BusinessConfig, a as BusinessConfigFeatures, b as BusinessConfigService, C as CompareTo, c as ConversionUserData, d as CurrencyRevenue, e as CustomerCurrencyDelta, f as CustomerCurrencyTotal, g as CustomerGetOptions, h as CustomerGetResult, i as CustomerKpis, j as CustomerKpisDeltas, k as CustomerKpisPrevious, l as CustomerListPage, m as CustomerListQuery, n as CustomerProfile, o as CustomerSegment, p as CustomerSegmentCount, q as CustomerSortField, r as CustomerSummary, s as CustomerSummaryQuery, D as DistinctCustomersByCurrency, E as EffectiveSaleProperty, G as Granularity, N as NAMED_RANGES, t as NamedRange, P as PublicServiceItem, S as SALE_SOURCES, u as SUPPORTED_CURRENCIES, v as Sale, w as SaleBuiltinRequirableField, x as SaleCursorPage, y as SaleFilters, z as SaleInput, F as SaleItem, H as SaleItemInput, I as SaleKeysetSortField, J as SaleListPage, K as SaleListQuery, L as SaleListQueryV2, M as SalePropertyOption, O as SalePropertyType, Q as SaleService, R as SaleServiceInput, T as SaleSortField, U as SaleSortOrder, V as SaleSource, W as SaleSourceFacts, X as SaleSummary, Y as SaleSummaryPrevious, Z as SaleSummaryQuery, _ as SaleSummaryQueryV2, $ as SaleSummaryV2, a0 as SaleUpdateInput, a1 as SalesBusinessClient, a2 as SalesCategoryBreakdown, a3 as SalesClient, a4 as SalesClientConfig, a5 as SalesCustomersClient, a6 as SalesServiceBreakdown, a7 as SalesTransportConfig, a8 as SalesTrendPoint, a9 as SummaryCurrencyDelta, aa as SummaryDeltas, ab as SummaryWindow, ac as SupportedCurrency, ad as TRACKING_RANGES, ae as TrackingOverviewRange, af as clearStashedUserData, ag as createSalesClient, ah as currencySchema, ai as fetchServices, aj as formatDateInTz, ak as formatMoney, al as fromMinor, am as saleCreateSchema, an as saleItemSchema, ao as saleServiceSchema, ap as saleUpdateSchema, aq as salesRequest, ar as stashUserData, as as toMinor } from './sales-B1ONR-Yi.mjs';
5
- export { B as BookableDay, a as BookingDetailsFailure, b as BookingDetailsInput, c as BookingDetailsOptions, d as BookingDetailsOutcome, e as BookingDetailsStatus, f as BookingDropOff, g as BookingFormSubmit, h as BookingHandoffPrefill, i as BookingInput, j as BookingInputFor, k as BookingIntegration, l as BookingMode, m as BookingOption, n as BookingOptionGroup, o as BookingOptionKey, p as BookingOutcome, q as BookingProvider, r as BookingRules, s as BookingServiceKey, t as BookingSimulation, u as BookingSubmitOptions, v as BookingVehicle, C as ConversionConfig, w as ConversionConfigStore, F as FormSubmitField, L as LeadFormAddress, x as LeadFormContracts, y as LeadFormDetailsFields, z as LeadFormDetailsInput, A as LeadFormDetailsResult, D as LeadFormExtraField, E as LeadFormFields, G as LeadFormKindDecl, H as LeadFormRequirementDecl, I as LeadFormSubmission, J as LeadFormSubmitInput, K as LeadFormSubmitOptions, M as LeadFormSubmitter, N as LeadFormTimeWindow, O as LeadFormTracking, P as LeadFormValue, S as SalesBookingsClient, T as TrackingConfigReference, Q as bookableSlots, R as buildBookingHandoffUrl, U as getBookingIntegration, V as getTrackingConfigRuntime, W as groupBookingOptions, X as newBookingAttemptKey, Y as resolveConversionConfig, Z as resolveTrackingConfigUrl, _ as shopToday, $ as slotFields, a0 as timeWindow } from './bookings-CVvpj_8K.mjs';
6
- export { A as AutomaticEventName, C as CtaClickConfig, a as CtaClickMetadata, E as EVENT_SEMANTICS, b as EventCategory, c as EventClientVisibility, d as EventConfig, e as EventKind, f as EventMetadata, g as EventName, h as EventOutcomeRole, i as EventSemantics, F as FormDetailsConfig, j as FormDetailsMetadata, k as FormStartConfig, l as FormStartMetadata, m as FormStepConfig, n as FormStepMetadata, M as ManualEventName, o as MultiPageSessionConfig, p as MultiPageSessionMetadata, P as PageExitConfig, q as PageExitMetadata, r as PageIdentity, s as PageViewConfig, t as PageViewMetadata, u as PhoneClickConfig, v as PhoneClickMetadata, R as RegisteredAutomaticEvents, w as RegisteredManualEvents, S as ScrollDepthConfig, x as ScrollDepthMetadata, y as SdkHeartbeatConfig, z as SdkHeartbeatMetadata, B as SiteLinkArrivalConfig, D as SiteLinkArrivalMetadata, G as SiteLinkClickConfig, H as SiteLinkClickMetadata, I as SpecificPageName, J as SpecificPageVisitConfig, K as SpecificPageVisitMetadata, T as TimeOnSiteConfig, L as TimeOnSiteMetadata, N as TrackableEvent, O as TriggerRegistryConfig, Q as TypedTrackEventOptions, U as TypedTrackingClient, V as getEventSemantics } from './ingest-typed-CoCjTqJs.mjs';
4
+ export { A as AranovaApiError, B as BusinessConfig, a as BusinessConfigFeatures, b as BusinessConfigService, C as CompareTo, c as ConversionUserData, d as CurrencyRevenue, e as CustomerCurrencyDelta, f as CustomerCurrencyTotal, g as CustomerGetOptions, h as CustomerGetResult, i as CustomerKpis, j as CustomerKpisDeltas, k as CustomerKpisPrevious, l as CustomerListPage, m as CustomerListQuery, n as CustomerProfile, o as CustomerSegment, p as CustomerSegmentCount, q as CustomerSortField, r as CustomerSummary, s as CustomerSummaryQuery, D as DistinctCustomersByCurrency, E as EffectiveSaleProperty, G as Granularity, N as NAMED_RANGES, t as NamedRange, P as PublicServiceItem, S as SALE_SOURCES, u as SUPPORTED_CURRENCIES, v as Sale, w as SaleBuiltinRequirableField, x as SaleCursorPage, y as SaleFilters, z as SaleInput, F as SaleItem, H as SaleItemInput, I as SaleKeysetSortField, J as SaleListPage, K as SaleListQuery, L as SaleListQueryV2, M as SalePropertyOption, O as SalePropertyType, Q as SaleService, R as SaleServiceInput, T as SaleSortField, U as SaleSortOrder, V as SaleSource, W as SaleSourceFacts, X as SaleSummary, Y as SaleSummaryPrevious, Z as SaleSummaryQuery, _ as SaleSummaryQueryV2, $ as SaleSummaryV2, a0 as SaleUpdateInput, a1 as SalesBusinessClient, a2 as SalesCategoryBreakdown, a3 as SalesClient, a4 as SalesClientConfig, a5 as SalesCustomersClient, a6 as SalesServiceBreakdown, a7 as SalesTransportConfig, a8 as SalesTrendPoint, a9 as SummaryCurrencyDelta, aa as SummaryDeltas, ab as SummaryWindow, ac as SupportedCurrency, ad as TRACKING_RANGES, ae as TrackingOverviewRange, af as clearStashedUserData, ag as createSalesClient, ah as currencySchema, ai as fetchServices, aj as formatDateInTz, ak as formatMoney, al as fromMinor, am as saleCreateSchema, an as saleItemSchema, ao as saleServiceSchema, ap as saleUpdateSchema, aq as salesRequest, ar as stashUserData, as as toMinor } from './sales-DriCnCbM.mjs';
5
+ export { B as BookableDay, a as BookingDetailsFailure, b as BookingDetailsInput, c as BookingDetailsOptions, d as BookingDetailsOutcome, e as BookingDetailsStatus, f as BookingDropOff, g as BookingFormSubmit, h as BookingHandoffPrefill, i as BookingInput, j as BookingInputFor, k as BookingIntegration, l as BookingMode, m as BookingOption, n as BookingOptionGroup, o as BookingOptionKey, p as BookingOutcome, q as BookingProvider, r as BookingRules, s as BookingServiceKey, t as BookingSimulation, u as BookingSubmitOptions, v as BookingVehicle, C as ConversionConfig, w as ConversionConfigStore, F as FormSubmitField, L as LeadFormAddress, x as LeadFormContracts, y as LeadFormDetailsFields, z as LeadFormDetailsInput, A as LeadFormDetailsResult, D as LeadFormExtraField, E as LeadFormFields, G as LeadFormKindDecl, H as LeadFormRequirementDecl, I as LeadFormSubmission, J as LeadFormSubmitInput, K as LeadFormSubmitOptions, M as LeadFormSubmitter, N as LeadFormTimeWindow, O as LeadFormTracking, P as LeadFormValue, S as SalesBookingsClient, T as TrackedVideoConfig, Q as TrackedVideoSourcesConfig, R as TrackingConfigReference, U as bookableSlots, V as buildBookingHandoffUrl, W as getBookingIntegration, X as getTrackingConfigRuntime, Y as groupBookingOptions, Z as newBookingAttemptKey, _ as resolveConversionConfig, $ as resolveTrackingConfigUrl, a0 as shopToday, a1 as slotFields, a2 as timeWindow } from './bookings-v3HA8gsC.mjs';
6
+ export { A as AutomaticEventName, C as CtaClickConfig, a as CtaClickMetadata, E as EVENT_SEMANTICS, b as EventCategory, c as EventClientVisibility, d as EventConfig, e as EventKind, f as EventMetadata, g as EventName, h as EventOutcomeRole, i as EventSemantics, F as FormDetailsConfig, j as FormDetailsMetadata, k as FormStartConfig, l as FormStartMetadata, m as FormStepConfig, n as FormStepMetadata, M as ManualEventName, o as MultiPageSessionConfig, p as MultiPageSessionMetadata, P as PageExitConfig, q as PageExitMetadata, r as PageIdentity, s as PageViewConfig, t as PageViewMetadata, u as PhoneClickConfig, v as PhoneClickMetadata, R as RegisteredAutomaticEvents, w as RegisteredManualEvents, S as ScrollDepthConfig, x as ScrollDepthMetadata, y as SdkHeartbeatConfig, z as SdkHeartbeatMetadata, B as SiteLinkArrivalConfig, D as SiteLinkArrivalMetadata, G as SiteLinkClickConfig, H as SiteLinkClickMetadata, I as SpecificPageName, J as SpecificPageVisitConfig, K as SpecificPageVisitMetadata, T as TimeOnSiteConfig, L as TimeOnSiteMetadata, N as TrackableEvent, O as TrackingClient, Q as TriggerRegistryConfig, U as TypedTrackEventOptions, V as TypedTrackingClient, W as VideoPlayConfig, X as VideoPlayMetadata, Y as VideoProgressConfig, Z as VideoProgressMetadata, _ as VideoProgressTriggerReason, $ as VideoVariant, a0 as VideoWatchRange, a1 as getEventSemantics } from './ingest-typed-BEFQd3WM.mjs';
7
7
  export { CountryCode } from 'libphonenumber-js';
8
8
  import 'zod/mini';
9
9
  import 'zod/v4/core';
@@ -61,42 +61,18 @@ declare function createTrackingSessionUpsertPayload(trackingParams: TrackingPara
61
61
  */
62
62
  declare function createTrackingEventCreatePayload(trackingParams: TrackingParams, input: TrackingEventInput, context: TrackingClientContext): TrackingEventCreatePayload;
63
63
 
64
- /**
65
- * Input accepted by the low-level stringly-typed client.
66
- *
67
- * Prefer the typed `trackEvent(eventName, metadata)` facade exposed by
68
- * `useTracking()` in React/Next integrations.
69
- */
70
- interface TrackEventInput {
71
- /** Event name to enqueue. */
72
- eventType: string;
73
- /** URL associated with the event. Defaults to the current page URL. */
74
- pageUrl?: string | null;
75
- /** Event-specific metadata. */
76
- metadata?: Record<string, unknown> | null;
77
- /** Timestamp override. Defaults to queue time. */
78
- occurredAt?: Date | string | null;
64
+ interface VideoWatchRangeItem {
65
+ start_s: number;
66
+ end_s: number;
79
67
  }
68
+ /** Round to 2 decimal places so wire payloads stay compact and deterministic. */
69
+ declare function roundVideoSeconds(value: number): number;
80
70
  /**
81
- * Low-level tracking client responsible for queueing and flushing events.
71
+ * Merge overlapping or adjacent `[start_s, end_s]` playback intervals.
72
+ * Intervals shorter than 0.05s or inverted are discarded.
82
73
  */
83
- interface TrackingClient {
84
- /** Enqueue an event for batched delivery. */
85
- trackEvent: (input: TrackEventInput) => void;
86
- /** Flush queued events immediately (fetch, non-keepalive). */
87
- flush: () => Promise<void>;
88
- /**
89
- * Flush queued events through the keepalive transport so the request
90
- * survives document unload. Use from `pagehide`/`visibilitychange:hidden`
91
- * handlers — a plain `flush()` there is aborted by the browser on unload.
92
- */
93
- flushBeacon: () => void;
94
- /** Return the current rolling session id. */
95
- getSessionId: () => string;
96
- /** Return the persistent visitor id. */
97
- getVisitorId: () => string;
98
- /** Remove timers/listeners and prevent future flushes. */
99
- destroy: () => void;
100
- }
74
+ declare function mergeVideoRanges(ranges: ReadonlyArray<VideoWatchRangeItem>, epsilonSeconds?: number): VideoWatchRangeItem[];
75
+ /** Total unique watched seconds across merged ranges, clamped to `durationSeconds` when > 0. */
76
+ declare function sumVideoRangesSeconds(ranges: ReadonlyArray<VideoWatchRangeItem>, durationSeconds?: number): number;
101
77
 
102
- export { TRACKING_PARAM_KEYS, type TrackingClient, TrackingClientContext, TrackingEventCreatePayload, TrackingInstallSurface, TrackingParams, TrackingSessionUpsertPayload, captureTrackingParamsFromLocation, createTrackingClientContext, createTrackingEventCreatePayload, createTrackingSessionUpsertPayload };
78
+ export { TRACKING_PARAM_KEYS, TrackingClientContext, TrackingEventCreatePayload, TrackingInstallSurface, TrackingParams, TrackingSessionUpsertPayload, captureTrackingParamsFromLocation, createTrackingClientContext, createTrackingEventCreatePayload, createTrackingSessionUpsertPayload, mergeVideoRanges, roundVideoSeconds, sumVideoRangesSeconds };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- export { AdPlatformTracking, AdPlatformTrackingProps, BookedAttempt, BookingHandoffLink, BookingHandoffLinkProps, BookingHandoffOptions, BookingSubmitState, BookingSubmitStatus, ConsentBanner, ConsentBannerProps, CreateTrackingOptions, CreateTrackingResult, GoogleAdsTracking, GoogleAdsTrackingProps, PhoneField, PhoneFieldApi, PhoneFieldProps, PhoneInputProps, TrackingProviderProps, UseConsentResult, UseCookiePreferencesOptions, UseCookiePreferencesResult, UsePhoneFieldOptions, createLeadFormSubmit, createTracking, useBookingHandoffUrl, useBookingIntegration, useBookingSlots, useBookingSubmit, useConsent, useConsentState, useCookiePreferences, useGclid, usePhoneConfig, usePhoneField, useTrackingParams } from '@aranova/tracking-react/client';
1
+ export { AdPlatformTracking, AdPlatformTrackingProps, BookedAttempt, BookingHandoffLink, BookingHandoffLinkProps, BookingHandoffOptions, BookingSubmitState, BookingSubmitStatus, ConsentBanner, ConsentBannerProps, CreateTrackingOptions, CreateTrackingResult, DEFAULT_VIDEO_CHECKPOINTS, GoogleAdsTracking, GoogleAdsTrackingProps, PhoneField, PhoneFieldApi, PhoneFieldProps, PhoneInputProps, TrackedVideo, TrackedVideoCallbacks, TrackedVideoEvent, TrackedVideoProps, TrackedVideoSources, TrackedVideoStage, TrackedVideoStageProps, TrackingProviderProps, UseConsentResult, UseCookiePreferencesOptions, UseCookiePreferencesResult, UsePhoneFieldOptions, VideoQuality, createLeadFormSubmit, createTracking, streamManifestUrl, streamPosterUrl, useBookingHandoffUrl, useBookingIntegration, useBookingSlots, useBookingSubmit, useConsent, useConsentState, useCookiePreferences, useGclid, usePhoneConfig, usePhoneField, useTrackedVideoConfig, useTrackingParams } from '@aranova/tracking-react/client';
2
2
  import { T as TrackingParams, a as TrackingInstallSurface, b as TrackingEnvironment, c as TrackingClientContext, d as TrackingEventCreatePayload, e as TrackingSessionUpsertPayload } from './phone-utils-BlWj8oxq.js';
3
3
  export { C as ConsentChoice, f as ConsentChoiceState, g as ConsentSource, h as ConsentState, D as DEFAULT_DECLINE_TTL_DAYS, i as DEFAULT_PHONE_COUNTRY, F as FormContractViolation, j as FormSubmitConfig, k as FormSubmitMetadata, G as GtagEnvironmentMap, J as JsonValue, L as LEAD_FORM_KINDS, l as LEAD_FORM_PRIMITIVES, m as LEAD_FORM_REGISTRY_VERSION, n as LEAD_FORM_ROLES, o as LEAD_FORM_ROLE_SPECS, p as LeadFormKind, q as LeadFormPrimitive, r as LeadFormRole, s as LeadFormRoleOption, t as LeadFormRoleSpec, M as MetaPixelEnvironmentMap, P as ParsedPhone, u as PhoneConfig, v as PhoneDisplayFormat, S as SetConsentOptions, w as TrackedField, x as TrackingInitConfig, y as formatPhone, z as formatPhoneAsTyped, A as getConsentChoice, B as getConsentState, E as leadFormPrimitiveSchemas, H as onConsentChange, I as optIn, K as optOut, N as parsePhone, O as phoneField, Q as resetConsent, R as setConsentState, U as toE164 } from './phone-utils-BlWj8oxq.js';
4
- export { A as AranovaApiError, B as BusinessConfig, a as BusinessConfigFeatures, b as BusinessConfigService, C as CompareTo, c as ConversionUserData, d as CurrencyRevenue, e as CustomerCurrencyDelta, f as CustomerCurrencyTotal, g as CustomerGetOptions, h as CustomerGetResult, i as CustomerKpis, j as CustomerKpisDeltas, k as CustomerKpisPrevious, l as CustomerListPage, m as CustomerListQuery, n as CustomerProfile, o as CustomerSegment, p as CustomerSegmentCount, q as CustomerSortField, r as CustomerSummary, s as CustomerSummaryQuery, D as DistinctCustomersByCurrency, E as EffectiveSaleProperty, G as Granularity, N as NAMED_RANGES, t as NamedRange, P as PublicServiceItem, S as SALE_SOURCES, u as SUPPORTED_CURRENCIES, v as Sale, w as SaleBuiltinRequirableField, x as SaleCursorPage, y as SaleFilters, z as SaleInput, F as SaleItem, H as SaleItemInput, I as SaleKeysetSortField, J as SaleListPage, K as SaleListQuery, L as SaleListQueryV2, M as SalePropertyOption, O as SalePropertyType, Q as SaleService, R as SaleServiceInput, T as SaleSortField, U as SaleSortOrder, V as SaleSource, W as SaleSourceFacts, X as SaleSummary, Y as SaleSummaryPrevious, Z as SaleSummaryQuery, _ as SaleSummaryQueryV2, $ as SaleSummaryV2, a0 as SaleUpdateInput, a1 as SalesBusinessClient, a2 as SalesCategoryBreakdown, a3 as SalesClient, a4 as SalesClientConfig, a5 as SalesCustomersClient, a6 as SalesServiceBreakdown, a7 as SalesTransportConfig, a8 as SalesTrendPoint, a9 as SummaryCurrencyDelta, aa as SummaryDeltas, ab as SummaryWindow, ac as SupportedCurrency, ad as TRACKING_RANGES, ae as TrackingOverviewRange, af as clearStashedUserData, ag as createSalesClient, ah as currencySchema, ai as fetchServices, aj as formatDateInTz, ak as formatMoney, al as fromMinor, am as saleCreateSchema, an as saleItemSchema, ao as saleServiceSchema, ap as saleUpdateSchema, aq as salesRequest, ar as stashUserData, as as toMinor } from './sales-Dlc_umAV.js';
5
- export { B as BookableDay, a as BookingDetailsFailure, b as BookingDetailsInput, c as BookingDetailsOptions, d as BookingDetailsOutcome, e as BookingDetailsStatus, f as BookingDropOff, g as BookingFormSubmit, h as BookingHandoffPrefill, i as BookingInput, j as BookingInputFor, k as BookingIntegration, l as BookingMode, m as BookingOption, n as BookingOptionGroup, o as BookingOptionKey, p as BookingOutcome, q as BookingProvider, r as BookingRules, s as BookingServiceKey, t as BookingSimulation, u as BookingSubmitOptions, v as BookingVehicle, C as ConversionConfig, w as ConversionConfigStore, F as FormSubmitField, L as LeadFormAddress, x as LeadFormContracts, y as LeadFormDetailsFields, z as LeadFormDetailsInput, A as LeadFormDetailsResult, D as LeadFormExtraField, E as LeadFormFields, G as LeadFormKindDecl, H as LeadFormRequirementDecl, I as LeadFormSubmission, J as LeadFormSubmitInput, K as LeadFormSubmitOptions, M as LeadFormSubmitter, N as LeadFormTimeWindow, O as LeadFormTracking, P as LeadFormValue, S as SalesBookingsClient, T as TrackingConfigReference, Q as bookableSlots, R as buildBookingHandoffUrl, U as getBookingIntegration, V as getTrackingConfigRuntime, W as groupBookingOptions, X as newBookingAttemptKey, Y as resolveConversionConfig, Z as resolveTrackingConfigUrl, _ as shopToday, $ as slotFields, a0 as timeWindow } from './bookings-CCGpXhYE.js';
6
- export { A as AutomaticEventName, C as CtaClickConfig, a as CtaClickMetadata, E as EVENT_SEMANTICS, b as EventCategory, c as EventClientVisibility, d as EventConfig, e as EventKind, f as EventMetadata, g as EventName, h as EventOutcomeRole, i as EventSemantics, F as FormDetailsConfig, j as FormDetailsMetadata, k as FormStartConfig, l as FormStartMetadata, m as FormStepConfig, n as FormStepMetadata, M as ManualEventName, o as MultiPageSessionConfig, p as MultiPageSessionMetadata, P as PageExitConfig, q as PageExitMetadata, r as PageIdentity, s as PageViewConfig, t as PageViewMetadata, u as PhoneClickConfig, v as PhoneClickMetadata, R as RegisteredAutomaticEvents, w as RegisteredManualEvents, S as ScrollDepthConfig, x as ScrollDepthMetadata, y as SdkHeartbeatConfig, z as SdkHeartbeatMetadata, B as SiteLinkArrivalConfig, D as SiteLinkArrivalMetadata, G as SiteLinkClickConfig, H as SiteLinkClickMetadata, I as SpecificPageName, J as SpecificPageVisitConfig, K as SpecificPageVisitMetadata, T as TimeOnSiteConfig, L as TimeOnSiteMetadata, N as TrackableEvent, O as TriggerRegistryConfig, Q as TypedTrackEventOptions, U as TypedTrackingClient, V as getEventSemantics } from './ingest-typed-C3XAjHlH.js';
4
+ export { A as AranovaApiError, B as BusinessConfig, a as BusinessConfigFeatures, b as BusinessConfigService, C as CompareTo, c as ConversionUserData, d as CurrencyRevenue, e as CustomerCurrencyDelta, f as CustomerCurrencyTotal, g as CustomerGetOptions, h as CustomerGetResult, i as CustomerKpis, j as CustomerKpisDeltas, k as CustomerKpisPrevious, l as CustomerListPage, m as CustomerListQuery, n as CustomerProfile, o as CustomerSegment, p as CustomerSegmentCount, q as CustomerSortField, r as CustomerSummary, s as CustomerSummaryQuery, D as DistinctCustomersByCurrency, E as EffectiveSaleProperty, G as Granularity, N as NAMED_RANGES, t as NamedRange, P as PublicServiceItem, S as SALE_SOURCES, u as SUPPORTED_CURRENCIES, v as Sale, w as SaleBuiltinRequirableField, x as SaleCursorPage, y as SaleFilters, z as SaleInput, F as SaleItem, H as SaleItemInput, I as SaleKeysetSortField, J as SaleListPage, K as SaleListQuery, L as SaleListQueryV2, M as SalePropertyOption, O as SalePropertyType, Q as SaleService, R as SaleServiceInput, T as SaleSortField, U as SaleSortOrder, V as SaleSource, W as SaleSourceFacts, X as SaleSummary, Y as SaleSummaryPrevious, Z as SaleSummaryQuery, _ as SaleSummaryQueryV2, $ as SaleSummaryV2, a0 as SaleUpdateInput, a1 as SalesBusinessClient, a2 as SalesCategoryBreakdown, a3 as SalesClient, a4 as SalesClientConfig, a5 as SalesCustomersClient, a6 as SalesServiceBreakdown, a7 as SalesTransportConfig, a8 as SalesTrendPoint, a9 as SummaryCurrencyDelta, aa as SummaryDeltas, ab as SummaryWindow, ac as SupportedCurrency, ad as TRACKING_RANGES, ae as TrackingOverviewRange, af as clearStashedUserData, ag as createSalesClient, ah as currencySchema, ai as fetchServices, aj as formatDateInTz, ak as formatMoney, al as fromMinor, am as saleCreateSchema, an as saleItemSchema, ao as saleServiceSchema, ap as saleUpdateSchema, aq as salesRequest, ar as stashUserData, as as toMinor } from './sales-Cu8M8I8k.js';
5
+ export { B as BookableDay, a as BookingDetailsFailure, b as BookingDetailsInput, c as BookingDetailsOptions, d as BookingDetailsOutcome, e as BookingDetailsStatus, f as BookingDropOff, g as BookingFormSubmit, h as BookingHandoffPrefill, i as BookingInput, j as BookingInputFor, k as BookingIntegration, l as BookingMode, m as BookingOption, n as BookingOptionGroup, o as BookingOptionKey, p as BookingOutcome, q as BookingProvider, r as BookingRules, s as BookingServiceKey, t as BookingSimulation, u as BookingSubmitOptions, v as BookingVehicle, C as ConversionConfig, w as ConversionConfigStore, F as FormSubmitField, L as LeadFormAddress, x as LeadFormContracts, y as LeadFormDetailsFields, z as LeadFormDetailsInput, A as LeadFormDetailsResult, D as LeadFormExtraField, E as LeadFormFields, G as LeadFormKindDecl, H as LeadFormRequirementDecl, I as LeadFormSubmission, J as LeadFormSubmitInput, K as LeadFormSubmitOptions, M as LeadFormSubmitter, N as LeadFormTimeWindow, O as LeadFormTracking, P as LeadFormValue, S as SalesBookingsClient, T as TrackedVideoConfig, Q as TrackedVideoSourcesConfig, R as TrackingConfigReference, U as bookableSlots, V as buildBookingHandoffUrl, W as getBookingIntegration, X as getTrackingConfigRuntime, Y as groupBookingOptions, Z as newBookingAttemptKey, _ as resolveConversionConfig, $ as resolveTrackingConfigUrl, a0 as shopToday, a1 as slotFields, a2 as timeWindow } from './bookings-BDLyF70h.js';
6
+ export { A as AutomaticEventName, C as CtaClickConfig, a as CtaClickMetadata, E as EVENT_SEMANTICS, b as EventCategory, c as EventClientVisibility, d as EventConfig, e as EventKind, f as EventMetadata, g as EventName, h as EventOutcomeRole, i as EventSemantics, F as FormDetailsConfig, j as FormDetailsMetadata, k as FormStartConfig, l as FormStartMetadata, m as FormStepConfig, n as FormStepMetadata, M as ManualEventName, o as MultiPageSessionConfig, p as MultiPageSessionMetadata, P as PageExitConfig, q as PageExitMetadata, r as PageIdentity, s as PageViewConfig, t as PageViewMetadata, u as PhoneClickConfig, v as PhoneClickMetadata, R as RegisteredAutomaticEvents, w as RegisteredManualEvents, S as ScrollDepthConfig, x as ScrollDepthMetadata, y as SdkHeartbeatConfig, z as SdkHeartbeatMetadata, B as SiteLinkArrivalConfig, D as SiteLinkArrivalMetadata, G as SiteLinkClickConfig, H as SiteLinkClickMetadata, I as SpecificPageName, J as SpecificPageVisitConfig, K as SpecificPageVisitMetadata, T as TimeOnSiteConfig, L as TimeOnSiteMetadata, N as TrackableEvent, O as TrackingClient, Q as TriggerRegistryConfig, U as TypedTrackEventOptions, V as TypedTrackingClient, W as VideoPlayConfig, X as VideoPlayMetadata, Y as VideoProgressConfig, Z as VideoProgressMetadata, _ as VideoProgressTriggerReason, $ as VideoVariant, a0 as VideoWatchRange, a1 as getEventSemantics } from './ingest-typed-DChvvgwd.js';
7
7
  export { CountryCode } from 'libphonenumber-js';
8
8
  import 'zod/mini';
9
9
  import 'zod/v4/core';
@@ -61,42 +61,18 @@ declare function createTrackingSessionUpsertPayload(trackingParams: TrackingPara
61
61
  */
62
62
  declare function createTrackingEventCreatePayload(trackingParams: TrackingParams, input: TrackingEventInput, context: TrackingClientContext): TrackingEventCreatePayload;
63
63
 
64
- /**
65
- * Input accepted by the low-level stringly-typed client.
66
- *
67
- * Prefer the typed `trackEvent(eventName, metadata)` facade exposed by
68
- * `useTracking()` in React/Next integrations.
69
- */
70
- interface TrackEventInput {
71
- /** Event name to enqueue. */
72
- eventType: string;
73
- /** URL associated with the event. Defaults to the current page URL. */
74
- pageUrl?: string | null;
75
- /** Event-specific metadata. */
76
- metadata?: Record<string, unknown> | null;
77
- /** Timestamp override. Defaults to queue time. */
78
- occurredAt?: Date | string | null;
64
+ interface VideoWatchRangeItem {
65
+ start_s: number;
66
+ end_s: number;
79
67
  }
68
+ /** Round to 2 decimal places so wire payloads stay compact and deterministic. */
69
+ declare function roundVideoSeconds(value: number): number;
80
70
  /**
81
- * Low-level tracking client responsible for queueing and flushing events.
71
+ * Merge overlapping or adjacent `[start_s, end_s]` playback intervals.
72
+ * Intervals shorter than 0.05s or inverted are discarded.
82
73
  */
83
- interface TrackingClient {
84
- /** Enqueue an event for batched delivery. */
85
- trackEvent: (input: TrackEventInput) => void;
86
- /** Flush queued events immediately (fetch, non-keepalive). */
87
- flush: () => Promise<void>;
88
- /**
89
- * Flush queued events through the keepalive transport so the request
90
- * survives document unload. Use from `pagehide`/`visibilitychange:hidden`
91
- * handlers — a plain `flush()` there is aborted by the browser on unload.
92
- */
93
- flushBeacon: () => void;
94
- /** Return the current rolling session id. */
95
- getSessionId: () => string;
96
- /** Return the persistent visitor id. */
97
- getVisitorId: () => string;
98
- /** Remove timers/listeners and prevent future flushes. */
99
- destroy: () => void;
100
- }
74
+ declare function mergeVideoRanges(ranges: ReadonlyArray<VideoWatchRangeItem>, epsilonSeconds?: number): VideoWatchRangeItem[];
75
+ /** Total unique watched seconds across merged ranges, clamped to `durationSeconds` when > 0. */
76
+ declare function sumVideoRangesSeconds(ranges: ReadonlyArray<VideoWatchRangeItem>, durationSeconds?: number): number;
101
77
 
102
- export { TRACKING_PARAM_KEYS, type TrackingClient, TrackingClientContext, TrackingEventCreatePayload, TrackingInstallSurface, TrackingParams, TrackingSessionUpsertPayload, captureTrackingParamsFromLocation, createTrackingClientContext, createTrackingEventCreatePayload, createTrackingSessionUpsertPayload };
78
+ export { TRACKING_PARAM_KEYS, TrackingClientContext, TrackingEventCreatePayload, TrackingInstallSurface, TrackingParams, TrackingSessionUpsertPayload, captureTrackingParamsFromLocation, createTrackingClientContext, createTrackingEventCreatePayload, createTrackingSessionUpsertPayload, mergeVideoRanges, roundVideoSeconds, sumVideoRangesSeconds };
package/dist/index.js CHANGED
@@ -36,6 +36,7 @@ __export(src_exports, {
36
36
  ConsentBanner: () => import_client.ConsentBanner,
37
37
  DEFAULT_DECLINE_TTL_DAYS: () => DEFAULT_DECLINE_TTL_DAYS,
38
38
  DEFAULT_PHONE_COUNTRY: () => DEFAULT_PHONE_COUNTRY,
39
+ DEFAULT_VIDEO_CHECKPOINTS: () => import_client5.DEFAULT_VIDEO_CHECKPOINTS,
39
40
  EVENT_SEMANTICS: () => EVENT_SEMANTICS,
40
41
  GoogleAdsTracking: () => import_client.GoogleAdsTracking,
41
42
  LEAD_FORM_KINDS: () => LEAD_FORM_KINDS,
@@ -49,6 +50,8 @@ __export(src_exports, {
49
50
  SUPPORTED_CURRENCIES: () => SUPPORTED_CURRENCIES,
50
51
  TRACKING_PARAM_KEYS: () => TRACKING_PARAM_KEYS,
51
52
  TRACKING_RANGES: () => TRACKING_RANGES,
53
+ TrackedVideo: () => import_client5.TrackedVideo,
54
+ TrackedVideoStage: () => import_client5.TrackedVideoStage,
52
55
  bookableSlots: () => bookableSlots,
53
56
  buildBookingHandoffUrl: () => buildBookingHandoffUrl,
54
57
  captureTrackingParamsFromLocation: () => captureTrackingParamsFromLocation,
@@ -73,6 +76,7 @@ __export(src_exports, {
73
76
  getTrackingConfigRuntime: () => getTrackingConfigRuntime,
74
77
  groupBookingOptions: () => groupBookingOptions,
75
78
  leadFormPrimitiveSchemas: () => leadFormPrimitiveSchemas,
79
+ mergeVideoRanges: () => mergeVideoRanges,
76
80
  newBookingAttemptKey: () => newBookingAttemptKey,
77
81
  onConsentChange: () => onConsentChange,
78
82
  optIn: () => optIn,
@@ -82,6 +86,7 @@ __export(src_exports, {
82
86
  resetConsent: () => resetConsent,
83
87
  resolveConversionConfig: () => resolveConversionConfig,
84
88
  resolveTrackingConfigUrl: () => resolveTrackingConfigUrl,
89
+ roundVideoSeconds: () => roundVideoSeconds,
85
90
  saleCreateSchema: () => saleCreateSchema,
86
91
  saleItemSchema: () => saleItemSchema,
87
92
  saleServiceSchema: () => saleServiceSchema,
@@ -91,6 +96,9 @@ __export(src_exports, {
91
96
  shopToday: () => shopToday,
92
97
  slotFields: () => slotFields,
93
98
  stashUserData: () => stashUserData,
99
+ streamManifestUrl: () => import_client5.streamManifestUrl,
100
+ streamPosterUrl: () => import_client5.streamPosterUrl,
101
+ sumVideoRangesSeconds: () => sumVideoRangesSeconds,
94
102
  timeWindow: () => timeWindow,
95
103
  toE164: () => toE164,
96
104
  toMinor: () => toMinor,
@@ -104,6 +112,7 @@ __export(src_exports, {
104
112
  useGclid: () => import_client.useGclid,
105
113
  usePhoneConfig: () => import_client2.usePhoneConfig,
106
114
  usePhoneField: () => import_client2.usePhoneField,
115
+ useTrackedVideoConfig: () => import_client5.useTrackedVideoConfig,
107
116
  useTrackingParams: () => import_client.useTrackingParams
108
117
  });
109
118
  module.exports = __toCommonJS(src_exports);
@@ -331,7 +340,8 @@ var TRACKING_CAPABILITIES = [
331
340
  "form_capture",
332
341
  "phone_click_capture",
333
342
  "phone_fields",
334
- "typed_form_submit"
343
+ "typed_form_submit",
344
+ "video_tracking"
335
345
  ];
336
346
  var CAPABILITY_DOM_ATTRIBUTE = "data-aranova-capability";
337
347
  var registered = /* @__PURE__ */ new Set();
@@ -872,8 +882,48 @@ function parseTrigger(value) {
872
882
  if (typeof t.threshold_seconds === "number") spec.threshold_seconds = t.threshold_seconds;
873
883
  if (typeof t.page_threshold === "number") spec.page_threshold = t.page_threshold;
874
884
  if (typeof t.page_name === "string") spec.page_name = t.page_name;
885
+ if (t.metric === "percent" || t.metric === "seconds") spec.metric = t.metric;
886
+ if (typeof t.threshold === "number") spec.threshold = t.threshold;
887
+ if (typeof t.video_id === "string" || t.video_id === null) spec.video_id = t.video_id;
875
888
  return spec;
876
889
  }
890
+ function parseVideoEntry(fallbackKey2, entry) {
891
+ const key = typeof entry.key === "string" && entry.key ? entry.key : fallbackKey2;
892
+ if (!key) return null;
893
+ const host = typeof entry.host === "string" ? entry.host : "";
894
+ const title = typeof entry.title === "string" && entry.title ? entry.title : key;
895
+ const sourcesRaw = isRecord(entry.sources) ? entry.sources : null;
896
+ const desktop = sourcesRaw && typeof sourcesRaw.desktop === "string" ? sourcesRaw.desktop : typeof entry.desktop_uid === "string" ? entry.desktop_uid : "";
897
+ if (!host || !desktop) return null;
898
+ const mobile = sourcesRaw && typeof sourcesRaw.mobile === "string" ? sourcesRaw.mobile : typeof entry.mobile_uid === "string" ? entry.mobile_uid : null;
899
+ const posterTime = typeof entry.poster_time === "number" ? entry.poster_time : typeof entry.poster_time_s === "number" ? entry.poster_time_s : 4;
900
+ return {
901
+ key,
902
+ title,
903
+ host,
904
+ sources: { desktop, mobile },
905
+ poster_time: posterTime,
906
+ duration_s: typeof entry.duration_s === "number" ? entry.duration_s : null
907
+ };
908
+ }
909
+ function parseVideos(value) {
910
+ const out = {};
911
+ if (Array.isArray(value)) {
912
+ for (const item of value) {
913
+ if (!isRecord(item)) continue;
914
+ const parsed = parseVideoEntry("", item);
915
+ if (parsed) out[parsed.key] = parsed;
916
+ }
917
+ return out;
918
+ }
919
+ if (!isRecord(value)) return out;
920
+ for (const [key, entry] of Object.entries(value)) {
921
+ if (!isRecord(entry)) continue;
922
+ const parsed = parseVideoEntry(key, entry);
923
+ if (parsed) out[parsed.key] = parsed;
924
+ }
925
+ return out;
926
+ }
877
927
  function parseConversionConfig(raw) {
878
928
  if (!raw || typeof raw !== "object") return null;
879
929
  const obj = raw;
@@ -924,7 +974,8 @@ function parseConversionConfig(raw) {
924
974
  goals,
925
975
  linked_hostnames: Array.isArray(obj.linked_hostnames) ? obj.linked_hostnames.filter((h) => typeof h === "string" && h.length > 0) : [],
926
976
  integrations: parseIntegrations(obj.integrations),
927
- lead_forms: parseLeadForms(obj.lead_forms)
977
+ lead_forms: parseLeadForms(obj.lead_forms),
978
+ videos: parseVideos(obj.videos)
928
979
  };
929
980
  }
930
981
  function parseLeadForms(value) {
@@ -1170,6 +1221,21 @@ function automaticThresholdMet(goal, eventType, metadata) {
1170
1221
  case "form_start":
1171
1222
  case "phone_click":
1172
1223
  return true;
1224
+ case "video_play":
1225
+ return trigger.video_id == null || hasStringField(metadata, "video_id") && metadata.video_id === trigger.video_id;
1226
+ case "video_progress": {
1227
+ if (trigger.video_id != null && (!hasStringField(metadata, "video_id") || metadata.video_id !== trigger.video_id)) {
1228
+ return false;
1229
+ }
1230
+ if (typeof trigger.threshold !== "number") return false;
1231
+ if (trigger.metric === "seconds") {
1232
+ return hasNumberField(metadata, "watched_s") && metadata.watched_s >= trigger.threshold;
1233
+ }
1234
+ if (trigger.metric === "percent") {
1235
+ return hasNumberField(metadata, "max_percent") && metadata.max_percent >= trigger.threshold || hasNumberField(metadata, "watched_percent") && metadata.watched_percent >= trigger.threshold;
1236
+ }
1237
+ return false;
1238
+ }
1173
1239
  default:
1174
1240
  return false;
1175
1241
  }
@@ -1229,6 +1295,9 @@ var RETRY_BASE_MS = 5e3;
1229
1295
  var RETRY_MAX_MS = 5 * 6e4;
1230
1296
  var runtimes = /* @__PURE__ */ new Map();
1231
1297
  var configuredIds = /* @__PURE__ */ new Set();
1298
+ var EMPTY_GOALS = [];
1299
+ var EMPTY_STRINGS = [];
1300
+ var EMPTY_VIDEOS = {};
1232
1301
  var scriptLoad = null;
1233
1302
  var jsInitialized = false;
1234
1303
  function cacheKey2(url) {
@@ -1419,11 +1488,11 @@ var TrackingConfigRuntime = class {
1419
1488
  void this.flush();
1420
1489
  }
1421
1490
  listGoals() {
1422
- return this.current?.goals ?? [];
1491
+ return this.current?.goals ?? EMPTY_GOALS;
1423
1492
  }
1424
1493
  /** Sibling hostnames for the linker — read from the cached object even while unconfirmed. */
1425
1494
  linkedHostnames() {
1426
- return this.current?.linked_hostnames ?? [];
1495
+ return this.current?.linked_hostnames ?? EMPTY_STRINGS;
1427
1496
  }
1428
1497
  /**
1429
1498
  * Integration blocks, from the cached object even while unconfirmed: the booking fallback
@@ -1436,6 +1505,14 @@ var TrackingConfigRuntime = class {
1436
1505
  leadForms() {
1437
1506
  return this.current?.lead_forms ?? null;
1438
1507
  }
1508
+ /** Configured Cloudflare Stream tracked videos for this site. */
1509
+ videos() {
1510
+ return this.current?.videos ?? EMPTY_VIDEOS;
1511
+ }
1512
+ /** Look up one configured Cloudflare Stream tracked video by key. */
1513
+ getVideo(key) {
1514
+ return this.current?.videos?.[key] ?? null;
1515
+ }
1439
1516
  async revalidateNow() {
1440
1517
  try {
1441
1518
  const headers = {};
@@ -1592,6 +1669,16 @@ var TrackingConfigRuntime = class {
1592
1669
  this.scheduleRetry();
1593
1670
  return;
1594
1671
  }
1672
+ if (outcome === "fired" && typeof window !== "undefined" && typeof window.fbq === "function") {
1673
+ try {
1674
+ window.fbq("trackCustom", item.key, {
1675
+ ...value != null ? { value } : {},
1676
+ ...currency ? { currency } : {},
1677
+ ...item.transactionId ? { transaction_id: item.transactionId } : {}
1678
+ });
1679
+ } catch {
1680
+ }
1681
+ }
1595
1682
  this.conversionQueue.shift();
1596
1683
  }
1597
1684
  }
@@ -1814,6 +1901,18 @@ var EVENT_SEMANTICS = {
1814
1901
  category: "page",
1815
1902
  outcomeRole: "navigation",
1816
1903
  clientVisibility: "simple"
1904
+ },
1905
+ video_play: {
1906
+ label: "Video played",
1907
+ category: "engagement",
1908
+ outcomeRole: "engagement",
1909
+ clientVisibility: "simple"
1910
+ },
1911
+ video_progress: {
1912
+ label: "Video watched",
1913
+ category: "engagement",
1914
+ outcomeRole: "engagement",
1915
+ clientVisibility: "detailed"
1817
1916
  }
1818
1917
  };
1819
1918
  function getEventSemantics(eventName) {
@@ -1896,6 +1995,36 @@ var formSubmitMetadataSchema = z2.strictObject({
1896
1995
  });
1897
1996
  var formSubmitConfigSchema = z2.strictObject({});
1898
1997
 
1998
+ // ../tracking-core/src/video-ranges.ts
1999
+ function roundVideoSeconds(value) {
2000
+ if (!Number.isFinite(value) || value < 0) return 0;
2001
+ return Math.round(value * 100) / 100;
2002
+ }
2003
+ function mergeVideoRanges(ranges, epsilonSeconds = 0.25) {
2004
+ const valid = ranges.filter((r) => Number.isFinite(r.start_s) && Number.isFinite(r.end_s) && r.end_s > r.start_s).map((r) => ({
2005
+ start_s: roundVideoSeconds(r.start_s),
2006
+ end_s: roundVideoSeconds(r.end_s)
2007
+ })).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);
2008
+ if (valid.length === 0) return [];
2009
+ const merged = [{ ...valid[0] }];
2010
+ for (let i = 1; i < valid.length; i += 1) {
2011
+ const cur = valid[i];
2012
+ const last = merged[merged.length - 1];
2013
+ if (cur.start_s <= last.end_s + epsilonSeconds) {
2014
+ last.end_s = roundVideoSeconds(Math.max(last.end_s, cur.end_s));
2015
+ } else {
2016
+ merged.push({ ...cur });
2017
+ }
2018
+ }
2019
+ return merged;
2020
+ }
2021
+ function sumVideoRangesSeconds(ranges, durationSeconds = 0) {
2022
+ const merged = mergeVideoRanges(ranges);
2023
+ const raw = merged.reduce((acc, r) => acc + Math.max(0, r.end_s - r.start_s), 0);
2024
+ const clamped = durationSeconds > 0 ? Math.min(raw, durationSeconds) : raw;
2025
+ return roundVideoSeconds(clamped);
2026
+ }
2027
+
1899
2028
  // ../tracking-core/src/ingest-typed.ts
1900
2029
  var clientSettings = /* @__PURE__ */ new WeakMap();
1901
2030
  function typedClientSettings(client) {
@@ -2678,7 +2807,7 @@ var zSaleItemEntitySchema = z4.object({
2678
2807
  external_item_id: z4.nullable(z4.string()),
2679
2808
  id: z4.uuid(),
2680
2809
  name: z4.nullable(z4.string()),
2681
- quantity: z4.string().check(z4.regex(/^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$/)),
2810
+ quantity: z4.string(),
2682
2811
  unit_cost_cents: z4.nullable(z4.int()),
2683
2812
  unit_price_cents: z4.int()
2684
2813
  });
@@ -2800,6 +2929,17 @@ var zApiErrorSchema = z4.object({
2800
2929
  errors: z4._default(z4.nullish(z4.array(zValidationErrorItem)), null),
2801
2930
  request_id: z4._default(z4.nullish(z4.string()), null)
2802
2931
  });
2932
+ var zWritebackCorrectionAction = z4.enum(["retry", "restate_now"]);
2933
+ var zWritebackCorrectionState = z4.enum([
2934
+ "queued",
2935
+ "sent",
2936
+ "restated",
2937
+ "failed",
2938
+ "limit_reached",
2939
+ "voided",
2940
+ "date_changed",
2941
+ "dry_run_ok"
2942
+ ]);
2803
2943
  var zWritebackEmailSource = z4.enum(["NONE", "SALE", "CUSTOMER", "HARVESTED"]);
2804
2944
  var zWritebackEnrichmentStatus = z4.enum(["NONE", "MATCHED", "AMBIGUOUS"]);
2805
2945
  var zWritebackSaleUploadCounts = z4.object({
@@ -2810,9 +2950,28 @@ var zWritebackSaleUploadCounts = z4.object({
2810
2950
  total: z4._default(z4.int(), 0),
2811
2951
  uploaded: z4._default(z4.int(), 0)
2812
2952
  });
2953
+ var zWritebackValueDrift = z4.enum(["none", "open", "failed"]);
2954
+ var zWritebackCorrectionSchema = z4.object({
2955
+ action: z4.nullable(zWritebackCorrectionAction),
2956
+ can_restate: z4._default(z4.boolean(), false),
2957
+ drift: zWritebackValueDrift,
2958
+ error_message: z4.nullable(z4.string()),
2959
+ google_currency: z4.string(),
2960
+ google_value_cents: z4.int(),
2961
+ restated_at: z4.nullable(z4.iso.datetime({ offset: true })),
2962
+ restated_from_cents: z4.nullable(z4.int()),
2963
+ restatement_limit: z4.int(),
2964
+ restatements_used: z4.int(),
2965
+ sale_currency: z4.string(),
2966
+ sale_value_cents: z4.int(),
2967
+ sends_at: z4.nullable(z4.iso.datetime({ offset: true })),
2968
+ state: zWritebackCorrectionState,
2969
+ upload_id: z4.uuid()
2970
+ });
2813
2971
  var zSaleWritebackStatusSchema = z4.object({
2814
2972
  blocked_reason: z4.nullable(z4.string()),
2815
2973
  can_dispatch: z4._default(z4.boolean(), false),
2974
+ correction: z4.nullable(zWritebackCorrectionSchema),
2816
2975
  email_source: z4.nullable(zWritebackEmailSource),
2817
2976
  enrichment_status: z4.nullable(zWritebackEnrichmentStatus),
2818
2977
  gclid_attached: z4._default(z4.boolean(), false),
@@ -2830,7 +2989,6 @@ var zSaleWritebackStatusSchema = z4.object({
2830
2989
  "out_of_window",
2831
2990
  "blocked"
2832
2991
  ]),
2833
- stale: z4._default(z4.boolean(), false),
2834
2992
  uncovered_service_ids: z4.array(z4.uuid()),
2835
2993
  uploads: zWritebackSaleUploadCounts
2836
2994
  });
@@ -2957,6 +3115,7 @@ function phoneField(name, raw, country, label = null) {
2957
3115
  var import_client2 = require("@aranova/tracking-react/client");
2958
3116
  var import_client3 = require("@aranova/tracking-react/client");
2959
3117
  var import_client4 = require("@aranova/tracking-react/client");
3118
+ var import_client5 = require("@aranova/tracking-react/client");
2960
3119
  // Annotate the CommonJS export names for ESM import in node:
2961
3120
  0 && (module.exports = {
2962
3121
  AdPlatformTracking,
@@ -2965,6 +3124,7 @@ var import_client4 = require("@aranova/tracking-react/client");
2965
3124
  ConsentBanner,
2966
3125
  DEFAULT_DECLINE_TTL_DAYS,
2967
3126
  DEFAULT_PHONE_COUNTRY,
3127
+ DEFAULT_VIDEO_CHECKPOINTS,
2968
3128
  EVENT_SEMANTICS,
2969
3129
  GoogleAdsTracking,
2970
3130
  LEAD_FORM_KINDS,
@@ -2978,6 +3138,8 @@ var import_client4 = require("@aranova/tracking-react/client");
2978
3138
  SUPPORTED_CURRENCIES,
2979
3139
  TRACKING_PARAM_KEYS,
2980
3140
  TRACKING_RANGES,
3141
+ TrackedVideo,
3142
+ TrackedVideoStage,
2981
3143
  bookableSlots,
2982
3144
  buildBookingHandoffUrl,
2983
3145
  captureTrackingParamsFromLocation,
@@ -3002,6 +3164,7 @@ var import_client4 = require("@aranova/tracking-react/client");
3002
3164
  getTrackingConfigRuntime,
3003
3165
  groupBookingOptions,
3004
3166
  leadFormPrimitiveSchemas,
3167
+ mergeVideoRanges,
3005
3168
  newBookingAttemptKey,
3006
3169
  onConsentChange,
3007
3170
  optIn,
@@ -3011,6 +3174,7 @@ var import_client4 = require("@aranova/tracking-react/client");
3011
3174
  resetConsent,
3012
3175
  resolveConversionConfig,
3013
3176
  resolveTrackingConfigUrl,
3177
+ roundVideoSeconds,
3014
3178
  saleCreateSchema,
3015
3179
  saleItemSchema,
3016
3180
  saleServiceSchema,
@@ -3020,6 +3184,9 @@ var import_client4 = require("@aranova/tracking-react/client");
3020
3184
  shopToday,
3021
3185
  slotFields,
3022
3186
  stashUserData,
3187
+ streamManifestUrl,
3188
+ streamPosterUrl,
3189
+ sumVideoRangesSeconds,
3023
3190
  timeWindow,
3024
3191
  toE164,
3025
3192
  toMinor,
@@ -3033,6 +3200,7 @@ var import_client4 = require("@aranova/tracking-react/client");
3033
3200
  useGclid,
3034
3201
  usePhoneConfig,
3035
3202
  usePhoneField,
3203
+ useTrackedVideoConfig,
3036
3204
  useTrackingParams
3037
3205
  });
3038
3206
  //# sourceMappingURL=index.js.map