import { any, array, boolean, custom, function_, literal, maxValue, minLength, minValue, number, object, optional, pipe, record, string, union } from 'valibot' // Shared GCMv2 consent category value. const consentCategoryValue = union([literal('granted'), literal('denied')]) // Shared GCMv2 consent state (+ GA-only control fields). Lenient at schema-parse // time (extra keys pass through); the runtime `consent.*` API rebuilds a strict // variant from these entries so typos surface as a `consola` warning without // breaking the dev schema check. export const gcmConsentState = object({ ad_storage: optional(consentCategoryValue), ad_user_data: optional(consentCategoryValue), ad_personalization: optional(consentCategoryValue), analytics_storage: optional(consentCategoryValue), functionality_storage: optional(consentCategoryValue), personalization_storage: optional(consentCategoryValue), security_storage: optional(consentCategoryValue), wait_for_update: optional(number()), region: optional(array(string())), }) export const AhrefsAnalyticsOptions = object({ /** * Your Ahrefs Web Analytics project key. Set as the `data-key` attribute * on the loaded `analytics.js` script tag. * @see https://ahrefs.com/web-analytics */ key: pipe(string(), minLength(1)), }) export const BlueskyEmbedOptions = object({ /** * The Bluesky post URL to embed. * @example 'https://bsky.app/profile/bsky.app/post/3mgnwwvj3u22a' */ postUrl: string(), /** * Custom API endpoint for fetching post data. * @default '/_scripts/embed/bluesky' */ apiEndpoint: optional(string()), /** * Custom image proxy endpoint. * @default '/_scripts/embed/bluesky-image' */ imageProxyEndpoint: optional(string()), }) export const ClarityOptions = object({ /** * The Clarity token. * @see https://learn.microsoft.com/en-us/clarity/setup-clarity */ id: pipe(string(), minLength(10)), /** * Default consent state applied before Clarity starts. * - `boolean` - enable / disable cookies. * - `Record` - advanced consent vector (see Clarity docs). * @see https://learn.microsoft.com/en-us/clarity/setup-and-installation/cookie-consent */ defaultConsent: optional(union([boolean(), record(string(), string())])), }) export const CloudflareWebAnalyticsOptions = object({ /** * The Cloudflare Web Analytics token. * @see https://developers.cloudflare.com/analytics/web-analytics/get-started/ */ token: pipe(string(), minLength(32)), /** * Cloudflare Web Analytics enables measuring SPAs automatically by overriding the History API's pushState function * and listening to the onpopstate. Hash-based router is not supported. * * @default true * @see https://developers.cloudflare.com/analytics/web-analytics/get-started/#spa-tracking */ spa: optional(boolean()), }) export const CrispOptions = object({ /** * The Crisp ID. */ id: string(), /** * Extra configuration options. Used to configure the locale. * Same as CRISP_RUNTIME_CONFIG. * @see https://docs.crisp.chat/guides/chatbox-sdks/web-sdk/language-customization/ */ runtimeConfig: optional(object({ locale: optional(string()), })), /** * Associated a session, equivalent to using CRISP_TOKEN_ID variable. * Same as CRISP_TOKEN_ID. * @see https://docs.crisp.chat/guides/chatbox-sdks/web-sdk/session-continuity/ */ tokenId: optional(string()), /** * Restrict the domain that the Crisp cookie is set on. * Same as CRISP_COOKIE_DOMAIN. * @see https://docs.crisp.chat/guides/chatbox-sdks/web-sdk/cookie-policies/ */ cookieDomain: optional(string()), /** * The cookie expiry in seconds. * Same as CRISP_COOKIE_EXPIRATION. * @see https://docs.crisp.chat/guides/chatbox-sdks/web-sdk/cookie-policies/#change-cookie-expiration-date */ cookieExpiry: optional(number()), }) /** * @see https://www.databuddy.cc/docs/sdk */ export const DatabuddyAnalyticsOptions = object({ /** * Your Databuddy client ID. */ clientId: string(), /** * Custom script URL for the Databuddy SDK. * @default 'https://cdn.databuddy.cc/databuddy.js' */ scriptUrl: optional(string()), /** * Custom API URL for sending analytics data. * @default 'https://basket.databuddy.cc' */ apiUrl: optional(string()), /** * Disable all tracking when set to `true`. */ disabled: optional(boolean()), /** * Track screen/page views automatically. * @default true * @see https://www.databuddy.cc/docs/sdk#track-screen-views */ trackScreenViews: optional(boolean()), /** * Track page performance metrics. * @default true * @see https://www.databuddy.cc/docs/sdk#track-performance */ trackPerformance: optional(boolean()), /** * Track user sessions. * @default true * @see https://www.databuddy.cc/docs/sdk#track-sessions */ trackSessions: optional(boolean()), /** * Track Web Vitals (LCP, FID, CLS, etc.). */ trackWebVitals: optional(boolean()), /** * Track JavaScript errors. */ trackErrors: optional(boolean()), /** * Track outgoing link clicks. */ trackOutgoingLinks: optional(boolean()), /** * Track scroll depth. */ trackScrollDepth: optional(boolean()), /** * Track user engagement time. */ trackEngagement: optional(boolean()), /** * Track user interactions (clicks, form submissions, etc.). */ trackInteractions: optional(boolean()), /** * Track element attributes for detailed interaction context. */ trackAttributes: optional(boolean()), /** * Track hash changes in the URL. */ trackHashChanges: optional(boolean()), /** * Track exit intent behavior. */ trackExitIntent: optional(boolean()), /** * Track bounce rate metrics. */ trackBounceRate: optional(boolean()), /** * Enable event batching for better performance. */ enableBatching: optional(boolean()), /** * Maximum number of events per batch. */ batchSize: optional(number()), /** * Timeout (in ms) before flushing a batch. */ batchTimeout: optional(number()), /** * Enable automatic retries for failed requests. */ enableRetries: optional(boolean()), /** * Maximum number of retry attempts. */ maxRetries: optional(number()), /** * Initial delay (in ms) before the first retry. */ initialRetryDelay: optional(number()), /** * Sampling rate (0 to 1). Set to `0.5` to track ~50% of sessions. */ samplingRate: optional(number()), /** * Custom SDK identifier. */ sdk: optional(string()), /** * Custom SDK version string. */ sdkVersion: optional(string()), /** * Enable observability/monitoring features. */ enableObservability: optional(boolean()), /** * The service name for observability reporting. */ observabilityService: optional(string()), /** * The environment name for observability (e.g., `'production'`, `'staging'`). */ observabilityEnvironment: optional(string()), /** * The version string for observability reporting. */ observabilityVersion: optional(string()), /** * Enable console logging for debugging. */ enableLogging: optional(boolean()), /** * Enable request tracing. */ enableTracing: optional(boolean()), /** * Enable error tracking via observability. */ enableErrorTracking: optional(boolean()), }) export const FathomAnalyticsOptions = object({ /** * The Fathom Analytics site ID. * @see https://usefathom.com/docs/script/script-settings */ site: string(), /** * The Fathom Analytics tracking mode. * @default 'auto' */ spa: optional(union([literal('auto'), literal('history'), literal('hash')])), /** * Automatically track page views. * @default true */ auto: optional(boolean()), /** * Enable canonical URL tracking. * @default true */ canonical: optional(boolean()), /** * Honor Do Not Track requests. * @default false */ honorDnt: optional(boolean()), }) export const GoogleAdsenseOptions = object({ /** * The Google Adsense ID. * @example 'ca-pub-XXXXXXXXXXXXXXXX' */ client: optional(string()), /** * Enable or disable Auto Ads. * @default false * @see https://support.google.com/adsense/answer/9261805 */ autoAds: optional(boolean()), }) export const GoogleAnalyticsOptions = object({ /** * The GA4 measurement ID. * @example 'G-XXXXXXXX' * @see https://developers.google.com/analytics/devguides/collection/gtagjs */ id: optional(string()), /** * Global name for the dataLayer variable. * @default 'dataLayer' * @see https://developers.google.com/analytics/devguides/collection/gtagjs/setting-up-gtag#rename_the_data_layer */ l: optional(string()), /** * Default GCMv2 consent state(s) fired as `gtag('consent', 'default', state)` before * `gtag('js', ...)`. Pass an array to fire multiple defaults — for example, different * defaults per `region` (more specific regions override broader ones at runtime). * @see https://developers.google.com/tag-platform/security/guides/consent?consentmode=advanced#region-specific-behavior */ defaultConsent: optional(union([gcmConsentState, array(gcmConsentState)])), }) export const GoogleMapsOptions = object({ /** * Your Google Maps API key. */ apiKey: string(), /** * The Google Maps libraries to load. * @default ['places'] * @see https://developers.google.com/maps/documentation/javascript/libraries */ libraries: optional(array(string())), /** * The language code for the map UI and geocoding results. * @see https://developers.google.com/maps/faq#languagesupport */ language: optional(string()), /** * The region code to bias geocoding results. * @see https://developers.google.com/maps/documentation/javascript/localization#Region */ region: optional(string()), /** * The Google Maps JS API version to load. * @default 'weekly' * @see https://developers.google.com/maps/documentation/javascript/versions */ v: optional(union([literal('weekly'), literal('quarterly'), literal('beta'), literal('alpha'), string()])), }) export const GoogleRecaptchaOptions = object({ /** * Your reCAPTCHA site key. * @see https://developers.google.com/recaptcha/docs/display#render_param */ siteKey: string(), /** * Use the Enterprise version of reCAPTCHA (enterprise.js instead of api.js). * @see https://cloud.google.com/recaptcha-enterprise/docs/introduction */ enterprise: optional(boolean()), /** * Use recaptcha.net instead of google.com domain. Useful for regions where google.com is blocked. */ recaptchaNet: optional(boolean()), /** * Language code for the reCAPTCHA widget. * @see https://developers.google.com/recaptcha/docs/language */ hl: optional(string()), }) export const GoogleSignInOptions = object({ /** * Your Google API client ID. * @example 'XXXXXXXXXXXX-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.apps.googleusercontent.com' * @see https://developers.google.com/identity/gsi/web/guides/get-google-api-clientid */ clientId: string(), /** * Auto-select credentials when only one Google account is available. * @see https://developers.google.com/identity/gsi/web/reference/js-reference#auto_select */ autoSelect: optional(boolean()), /** * The context text for the One Tap prompt. * @see https://developers.google.com/identity/gsi/web/reference/js-reference#context */ context: optional(union([literal('signin'), literal('signup'), literal('use')])), /** * Enable FedCM (Federated Credential Management) API support. Mandatory from August 2025. * @see https://developers.google.com/identity/gsi/web/guides/fedcm-migration */ useFedcmForPrompt: optional(boolean()), /** * Cancel the One Tap prompt if the user clicks outside. * @default true * @see https://developers.google.com/identity/gsi/web/reference/js-reference#cancel_on_tap_outside */ cancelOnTapOutside: optional(boolean()), /** * The UX mode for the sign-in flow. * @see https://developers.google.com/identity/gsi/web/reference/js-reference#ux_mode */ uxMode: optional(union([literal('popup'), literal('redirect')])), /** * The URI to redirect to after sign-in when using redirect UX mode. * @see https://developers.google.com/identity/gsi/web/reference/js-reference#login_uri */ loginUri: optional(string()), /** * Enable Intelligent Tracking Prevention (ITP) support for Safari. * @see https://developers.google.com/identity/gsi/web/reference/js-reference#itp_support */ itpSupport: optional(boolean()), /** * Allowed parent origin(s) for iframe embedding. * @see https://developers.google.com/identity/gsi/web/reference/js-reference#allowed_parent_origin */ allowedParentOrigin: optional(union([string(), array(string())])), /** * Restrict sign-in to a specific Google Workspace hosted domain. * @example 'example.com' * @see https://developers.google.com/identity/gsi/web/reference/js-reference#hd */ hd: optional(string()), }) /** * GTM configuration options with improved documentation */ export const GoogleTagManagerOptions = object({ /** * GTM container ID (format: GTM-XXXXXX) * @see https://developers.google.com/tag-platform/tag-manager/web#install-the-container */ id: string(), /** * Optional dataLayer variable name * @default 'dataLayer' * @see https://developers.google.com/tag-platform/tag-manager/web/datalayer#rename_the_data_layer */ l: optional(string()), /** * Authentication token for environment-specific container versions * @see https://support.google.com/tagmanager/answer/6328337 */ auth: optional(string()), /** * Preview environment name * @see https://support.google.com/tagmanager/answer/6328337 */ preview: optional(string()), /** Forces GTM cookies to take precedence when true */ cookiesWin: optional(union([boolean(), literal('x')])), /** * Enables debug mode when true * @see https://support.google.com/tagmanager/answer/6107056 */ debug: optional(union([boolean(), literal('x')])), /** * No Personal Advertising - disables advertising features when true * @see https://developers.google.com/tag-platform/tag-manager/templates/consent-apis */ npa: optional(union([boolean(), literal('1')])), /** Custom dataLayer name (alternative to "l" property) */ dataLayer: optional(string()), /** * Environment name for environment-specific container * @see https://support.google.com/tagmanager/answer/6328337 */ envName: optional(string()), /** Referrer policy for analytics requests */ authReferrerPolicy: optional(string()), /** * Default GCMv2 consent state(s) fired as `['consent','default', state]` onto the dataLayer * before the `gtm.js` event. Pass an array to fire multiple defaults — for example, * different defaults per `region` (more specific regions override broader ones at runtime). * @see https://developers.google.com/tag-platform/tag-manager/templates/consent-apis * @see https://developers.google.com/tag-platform/security/guides/consent?consentmode=advanced#region-specific-behavior */ defaultConsent: optional(union([gcmConsentState, array(gcmConsentState)])), }) export const HotjarOptions = object({ /** * Your Hotjar Site ID. * @see https://help.hotjar.com/hc/en-us/articles/115012039247-Hotjar-Tracking-Code */ id: number(), /** * The Hotjar snippet version. * @default 6 */ sv: optional(number()), }) export const InstagramEmbedOptions = object({ /** * The Instagram post URL to embed. * @example 'https://www.instagram.com/p/C_XXXXXXXXX/' * @see https://developers.facebook.com/docs/instagram/oembed/ */ postUrl: string(), /** * Whether to include captions in the embed. * @default true */ captions: optional(boolean()), /** * Custom API endpoint for fetching embed HTML. * @default '/_scripts/embed/instagram' */ apiEndpoint: optional(string()), }) export const IntercomOptions = object({ /** * Your Intercom app ID. * @see https://developers.intercom.com/installing-intercom/docs/javascript-api-attributes-objects */ app_id: string(), /** * The regional API base URL. Choose based on your Intercom data hosting region. */ api_base: optional(union([literal('https://api-iam.intercom.io'), literal('https://api-iam.eu.intercom.io'), literal('https://api-iam.au.intercom.io')])), /** * The name of the logged-in user. */ name: optional(string()), /** * The email address of the logged-in user. */ email: optional(string()), /** * A unique identifier for the logged-in user. */ user_id: optional(string()), /** * The horizontal alignment of the Intercom messenger launcher. * @default 'right' */ alignment: optional(union([literal('left'), literal('right')])), /** * The horizontal padding (in px) of the messenger launcher from the edge of the page. * @default 20 */ horizontal_padding: optional(number()), /** * The vertical padding (in px) of the messenger launcher from the bottom of the page. * @default 20 */ vertical_padding: optional(number()), }) export const MatomoAnalyticsOptions = object({ /** * The URL of your self-hosted Matomo instance. * Either `matomoUrl` or `cloudId` is required. * @example 'https://matomo.example.com' * @see https://developer.matomo.org/guides/tracking-javascript-guide */ matomoUrl: optional(string()), /** * Your Matomo site ID. * @default '1' */ siteId: optional(union([string(), number()])), /** * Your Matomo Cloud ID (the subdomain portion of your `*.matomo.cloud` URL). * Either `matomoUrl` or `cloudId` is required. * @example 'mysite.matomo.cloud' */ cloudId: optional(string()), /** * A custom tracker URL. Overrides the default tracker endpoint derived from `matomoUrl` or `cloudId`. */ trackerUrl: optional(string()), /** * Whether to track the initial page view on load. * @deprecated Use `watch: true` (default) for automatic page view tracking. */ trackPageView: optional(boolean()), /** * Enable download and outlink tracking. */ enableLinkTracking: optional(boolean()), /** * Disable all tracking cookies for cookieless analytics. */ disableCookies: optional(boolean()), /** * Automatically track page views on route change. * @default true */ watch: optional(boolean()), /** * Default tracking-consent state applied BEFORE the tracker is initialised. * - `'required'` — call `requireConsent` without granting (user must opt in later). * - `'given'` — call `requireConsent` then `setConsentGiven`. * - `'not-required'` — no consent gating (default Matomo behaviour). * @see https://developer.matomo.org/guides/tracking-consent */ defaultConsent: optional(union([literal('required'), literal('given'), literal('not-required')])), }) export const MetaPixelOptions = object({ /** * Your Meta (Facebook) Pixel ID. * @see https://developers.facebook.com/docs/meta-pixel/get-started */ id: union([string(), number()]), /** * Default consent state. `'granted'` fires `fbq('consent', 'grant')`, * `'denied'` fires `fbq('consent', 'revoke')`, both called before `fbq('init', id)`. * @see https://www.facebook.com/business/help/1151321516677370 */ defaultConsent: optional(union([literal('granted'), literal('denied')])), /** * Whether to track a page view on initialization. Disable this to send your own * `fbq('track', 'PageView', …, { eventID })`, for example for Conversions API deduplication. * @default true */ trackPageView: optional(boolean()), }) export const NpmOptions = object({ /** * The npm package name to load. * @example 'lodash' */ packageName: string(), /** * The specific file path within the package to load. * @example '/dist/lodash.min.js' */ file: optional(string()), /** * The package version to load. * @default 'latest' */ version: optional(string()), /** * The CDN provider to use for loading the package. * @default 'unpkg' * @see https://unpkg.com * @see https://www.jsdelivr.com * @see https://cdnjs.com */ provider: optional(union([literal('jsdelivr'), literal('cdnjs'), literal('unpkg')])), }) export const PayPalOptions = union([ object({ /** * Your PayPal client ID. * @see https://developer.paypal.com/sdk/js/reference/ */ clientId: string(), clientToken: optional(string()), /** * Use the PayPal sandbox environment. Defaults to `true` in development. */ sandbox: optional(boolean()), }), object({ clientId: optional(string()), /** * A server-generated client token for authentication. * @see https://docs.paypal.ai/payments/methods/paypal/sdk/js/v6/paypal-checkout */ clientToken: string(), /** * Use the PayPal sandbox environment. Defaults to `true` in development. */ sandbox: optional(boolean()), }), ]) export const PostHogOptions = object({ /** * Your PostHog project API key. * @see https://posthog.com/docs/libraries/js#usage */ apiKey: string(), /** * Your PostHog data region. * @default 'us' * @see https://posthog.com/docs/libraries/js#config */ region: optional(union([literal('us'), literal('eu')])), /** * Custom API host URL. Overrides the default derived from `region`. * Useful for self-hosted instances or reverse proxies. */ apiHost: optional(string()), /** * Enable autocapture of clicks, form submissions, and page views. * @default true */ autocapture: optional(boolean()), /** * Capture page views automatically. Set to `'history_change'` to only capture on history changes. * @default true */ capturePageview: optional(union([boolean(), literal('history_change')])), /** * Capture page leave events automatically. * @default true */ capturePageleave: optional(boolean()), /** * Disable session recording. */ disableSessionRecording: optional(boolean()), /** * Additional PostHog configuration options passed directly to `posthog.init()`. * @see https://posthog.com/docs/libraries/js#config */ config: optional(record(string(), any())), /** * Default capture-consent state for PostHog. * - `'opt-out'`: passed as `opt_out_capturing_by_default: true` to `posthog.init`, so capturing is suppressed from the first event. * - `'opt-in'`: applied after `posthog.init` via `posthog.opt_in_capturing()` on the returned instance. * @see https://posthog.com/docs/privacy/opting-out */ defaultConsent: optional(union([literal('opt-in'), literal('opt-out')])), }) export const RedditPixelOptions = object({ /** * Your Reddit Pixel advertiser ID. * @see https://reddithelp.com/en/categories/advertising/managing-ads/installing-reddit-pixel */ id: string(), }) export const RybbitAnalyticsOptions = object({ /** * Your Rybbit site ID. * @see https://rybbit.io/docs */ siteId: union([string(), number()]), /** * Automatically track page views. * @default true */ autoTrackPageview: optional(boolean()), /** * Enable SPA (single-page app) route tracking. * @default true */ trackSpa: optional(boolean()), /** * Include query parameters in tracked URLs. */ trackQuery: optional(boolean()), /** * Track outbound link clicks. */ trackOutbound: optional(boolean()), /** * Track JavaScript errors. */ trackErrors: optional(boolean()), /** * Enable session replay recording. */ sessionReplay: optional(boolean()), /** * Enable Web Vitals tracking (LCP, FID, CLS, etc.). */ webVitals: optional(boolean()), /** * URL patterns to skip from tracking (glob syntax). */ skipPatterns: optional(array(string())), /** * URL patterns to mask in tracked data (glob syntax). */ maskPatterns: optional(array(string())), /** * Debounce interval (in ms) for page view tracking. */ debounce: optional(number()), /** * API key for authenticated tracking. */ apiKey: optional(string()), /** * Override the analytics host URL. When first-party mode is enabled, this is * auto-injected to route through the proxy. The SDK derives its API endpoint * from the script src, so this changes the script src to `${analyticsHost}/script.js`. */ analyticsHost: optional(string()), }) export const MixpanelAnalyticsOptions = object({ /** * Your Mixpanel project token. * @see https://docs.mixpanel.com/docs/tracking-methods/sdks/javascript#1-initialize-the-library */ token: string(), /** * Default tracking-consent state for Mixpanel. * - `'opt-out'`: passed as `opt_out_tracking_by_default: true` to `mixpanel.init`, so tracking is suppressed from the first call. * - `'opt-in'`: queued via `mixpanel.push(['opt_in_tracking'])` so the real SDK runs it immediately after load. * @see https://docs.mixpanel.com/docs/privacy/opt-out-of-tracking */ defaultConsent: optional(union([literal('opt-in'), literal('opt-out')])), }) export const BingUetOptions = object({ /** * Your Bing UET tag ID. * @see https://help.ads.microsoft.com/#apex/ads/en/56682/2-500 */ id: string(), /** * Enable automatic SPA page tracking. * @default true */ enableAutoSpaTracking: optional(boolean()), /** * Default consent state fired as `uetq.push('consent', 'default', ...)` before UET init. * @see https://help.ads.microsoft.com/#apex/ads/en/60119/1-500 */ defaultConsent: optional(object({ ad_storage: optional(consentCategoryValue), })), }) export const LinkedInInsightOptions = object({ /** * Your LinkedIn Insight Tag Partner ID, or an array of Partner IDs to push * onto window._linkedin_data_partner_ids. The first ID is used as the * primary _linkedin_partner_id global. * @example '111143' * @example ['111143', '111154'] * @see https://www.linkedin.com/help/lms/answer/a417869/access-your-linkedin-partner-id */ id: union([pipe(string(), minLength(1)), pipe(array(pipe(string(), minLength(1))), minLength(1))]), /** * Optional page-load event ID for Conversions API deduplication. Assigned * to window._linkedin_event_id BEFORE the Insight Tag base code runs. Must * match the eventId sent with the corresponding server-side Conversions * API event. * * Per-event conversion deduplication uses the per-call event_id passed to * lintrk('track', { conversion_id, event_id }) instead. * @see https://learn.microsoft.com/en-us/linkedin/marketing/conversions/deduplication */ eventId: optional(string()), /** * Auto-fire lintrk('track') on Vue Router route changes (SPA virtual page * views). When true, suppresses the script's built-in auto-page-view via * window._wait_for_lintrk and tracks every navigation including the * initial page through Nuxt's page:finish hook. When false, the script * fires its own page-view exactly once on load and SPA navigations are * not tracked unless lintrk('track') is called manually. * @default false */ enableAutoSpaTracking: optional(boolean()), }) export const UsercentricsOptions = object({ /** * Your Usercentrics CMP v3 ruleset ID. Find it in the admin under * Implementation; the snippet's `data-ruleset-id` value. */ rulesetId: pipe(string(), minLength(1)), /** * Inject the Usercentrics autoblocker (`autoblocker.js`) ahead of the loader. * Enable when your ruleset relies on Auto Blocking (vs. Manual Blocking) to * gate third-party scripts before consent is granted. * @default false */ autoblocker: optional(boolean()), /** * Override the language displayed by the CMP UI (BCP-47 code, e.g. `'en'`, `'de'`). */ language: optional(string()), }) export const CalendlyOptions = object({ /** * The Calendly event URL to embed. * Required for inline, popup, and badge widgets when called via the composable. * @example 'https://calendly.com/your-name/30min' * @see https://help.calendly.com/hc/en-us/articles/223147027 */ url: optional(string()), /** * Pre-fill invitee fields on the booking form. * @see https://help.calendly.com/hc/en-us/articles/360020052833 */ prefill: optional(object({ name: optional(string()), email: optional(string()), firstName: optional(string()), lastName: optional(string()), /** Custom answers keyed by `a1`, `a2`, ... matching custom question order. */ customAnswers: optional(record(string(), string())), })), /** * UTM parameters appended to the booking URL for marketing attribution. * @see https://help.calendly.com/hc/en-us/articles/360020052833 */ utm: optional(object({ utmCampaign: optional(string()), utmSource: optional(string()), utmMedium: optional(string()), utmContent: optional(string()), utmTerm: optional(string()), })), /** * Theme and layout overrides applied to the booking page. * @see https://help.calendly.com/hc/en-us/articles/360020052833 */ pageSettings: optional(object({ backgroundColor: optional(string()), hideEventTypeDetails: optional(boolean()), hideLandingPageDetails: optional(boolean()), primaryColor: optional(string()), textColor: optional(string()), })), /** * CSS selector for the element that hosts the inline widget. * Required when the widget is initialised inline; the element should have a * minimum height of around 700px so the booking iframe is fully visible. */ parentElement: optional(string()), }) export const SegmentOptions = object({ /** * Your Segment write key. * @see https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/quickstart/ */ writeKey: string(), /** * The global variable name for the analytics instance. * @default 'analytics' */ analyticsKey: optional(string()), }) export const InitObjectPropertiesSchema = object({ /** * The user's email address (for matching). */ user_email: optional(string()), /** * The user's IP address. */ ip_address: optional(string()), /** * The user's phone number (for matching). */ user_phone_number: optional(string()), /** * SHA-256 hashed email address. */ user_hashed_email: optional(string()), /** * SHA-256 hashed phone number. */ user_hashed_phone_number: optional(string()), /** * The user's first name. */ firstname: optional(string()), /** * The user's last name. */ lastname: optional(string()), /** * The user's city. */ geo_city: optional(string()), /** * The user's region/state. */ geo_region: optional(string()), /** * The user's postal/zip code. */ geo_postal_code: optional(string()), /** * The user's country code. */ geo_country: optional(string()), /** * The user's age. */ age: optional(string()), }) export const SpeedCurveOptions = object({ // -- Composable-only options (consumed by useScriptSpeedCurve, not forwarded to LUX) -- /** * Your SpeedCurve customer ID. * @see https://support.speedcurve.com/docs/add-rum-to-your-site */ id: pipe(string(), minLength(1)), /** * Enable SPA (single-page application) mode. * When true, lux.js tracks soft navigations instead of full page loads. * @see https://support.speedcurve.com/docs/single-page-applications */ spaMode: optional(boolean()), /** * Automatically wire Vue Router hooks for SPA tracking when spaMode is true. * Set to false to instrument navigations manually. * @default true (when spaMode is true) */ autoTrackSpaNavigations: optional(boolean()), // -- LUX UserConfig passthrough (forwarded onto window.LUX before lux.js loads) -- // Property names match upstream LUX UserConfig casing exactly. Keep this list in // sync with the LUX_USER_CONFIG_KEYS filter in speedcurve.ts. /** * Page label shown in the SpeedCurve dashboard. * Accepts a static string, a function `(to) => string | false` for per-navigation labels, * or `false` to disable labeling entirely. A callback returning `false` skips updating * the label for that navigation. * @default String(to.name ?? to.path) */ label: optional(union([string(), function_(), literal(false)])), /** * Sampling rate (0–100). Percentage of sessions that send beacons. * Upstream spelling is lowercase — matches LUX UserConfig. */ samplerate: optional(pipe(number(), minValue(0), maxValue(100))), /** * Send the beacon when the page is hidden (pagehide event). * @default true */ sendBeaconOnPageHidden: optional(boolean()), /** * Track JavaScript errors. * @default true */ trackErrors: optional(boolean()), /** * Maximum number of errors to track per page view. * @default 5 */ maxErrors: optional(number()), /** * Minimum time (ms) before a beacon can be sent. */ minMeasureTime: optional(number()), /** * Maximum time (ms) after which the beacon is sent regardless of load state. * @default 60000 */ maxMeasureTime: optional(number()), /** * Start a new beacon when the page becomes visible after being hidden. */ newBeaconOnPageShow: optional(boolean()), /** * Track pages loaded in background tabs. * @default false */ trackHiddenPages: optional(boolean()), /** * Cookie domain for cross-subdomain session tracking. */ cookieDomain: optional(string()), }) export const SnapTrPixelOptions = object({ /** * Your Snapchat Pixel ID. * @see https://businesshelp.snapchat.com/s/article/pixel-website-install */ id: string(), /** * Whether to automatically track a `PAGE_VIEW` event on initialization. */ trackPageView: optional(boolean()), ...(InitObjectPropertiesSchema?.entries || {}), }) export const StripeOptions = object({ /** * Whether to load Stripe's advanced fraud detection signals. * Set to `false` to opt out. * @default true * @see https://docs.stripe.com/disputes/prevention/advanced-fraud-detection */ advancedFraudSignals: optional(boolean()), /** * The Stripe.js SDK version to load. * Named releases get autocomplete; any future codename is also accepted. * @default 'basil' * @see https://docs.stripe.com/sdks/stripejs-versioning */ version: optional(union([literal('v3'), literal('acacia'), literal('basil'), literal('clover'), literal('dahlia'), string()])), }) export const TikTokPixelOptions = object({ /** * Your TikTok Pixel ID. * @see https://ads.tiktok.com/help/article/get-started-pixel */ id: string(), /** * Whether to automatically track a page view on initialization. * @default true */ trackPageView: optional(boolean()), /** * Default consent state, applied before `ttq('init', id)`. * - `'granted'` fires `ttq.grantConsent()` * - `'denied'` fires `ttq.revokeConsent()` * - `'hold'` fires `ttq.holdConsent()` to defer until an explicit update * @see https://business-api.tiktok.com/portal/docs?id=1739585600931842 */ defaultConsent: optional(union([literal('granted'), literal('denied'), literal('hold')])), /** * Data residency region for the Pixel SDK. * - `'global'` (default) -> `analytics.tiktok.com` * - `'us'` -> `analytics.us.tiktok.com` (US enterprise data residency) */ region: optional(union([literal('global'), literal('us')])), }) export const UmamiAnalyticsOptions = object({ /** * Your Umami website ID. * @see https://umami.is/docs/tracker-config */ websiteId: string(), // required /** * By default, Umami will send data to wherever the script is located. * You can override this to send data to another location. * @see https://umami.is/docs/tracker-config#data-host-url */ hostUrl: optional(string()), /** * By default, Umami tracks all pageviews and events for you automatically. * You can disable this behavior and track events yourself using the tracker functions. * @default true * @see https://umami.is/docs/tracker-functions */ autoTrack: optional(boolean()), /** * If you want the tracker to only run on specific domains, you can add them to your tracker script. * This is a comma delimited list of domain names. * Helps if you are working in a staging/development environment. * @see https://umami.is/docs/tracker-config#data-domains */ domains: optional(array(string())), /** * If you want the tracker to collect events under a specific tag. * Events can be filtered in the dashboard by a specific tag. * @see https://umami.is/docs/tracker-config#data-tag */ tag: optional(string()), /** * Function that will be called before data is sent to Umami. * The function takes two parameters: type and payload. * Return the payload to continue sending, or return a falsy value to cancel. * @see https://umami.is/docs/tracker-config#data-before-send */ beforeSend: optional(union([ custom<(type: string, payload: Record) => Record | null | false>(input => typeof input === 'function'), string(), ])), }) export const XEmbedOptions = object({ /** * The tweet ID to embed. * @example '1754336034228171055' * @see https://developer.x.com/en/docs/twitter-for-websites/embedded-tweets/overview */ tweetId: string(), /** * Optional: Custom API endpoint for fetching tweet data. * @default '/_scripts/embed/x' */ apiEndpoint: optional(string()), /** * Optional: Custom image proxy endpoint. * @default '/_scripts/embed/x-image' */ imageProxyEndpoint: optional(string()), }) export const VercelAnalyticsOptions = object({ /** * The DSN of the project to send events to. * Only required when self-hosting or deploying outside of Vercel. */ dsn: optional(string()), /** * Whether to disable automatic page view tracking on route changes. * Set to true if you want to manually call pageview(). */ disableAutoTrack: optional(boolean()), /** * The mode to use for the analytics script. * - `auto` - Automatically detect the environment (default) * - `production` - Always use production script * - `development` - Always use development script (logs to console) */ mode: optional(union([literal('auto'), literal('development'), literal('production')])), /** * Whether to enable debug logging. * Automatically enabled in development/test environments. */ debug: optional(boolean()), /** * Custom endpoint for data collection. * Useful for self-hosted or proxied setups. */ endpoint: optional(string()), }) export const XPixelOptions = object({ /** * Your X (Twitter) Pixel ID. * @see https://business.twitter.com/en/help/campaign-measurement-and-analytics/conversion-tracking-for-websites.html */ id: string(), /** * The X Pixel script version. * @default '1.1' */ version: optional(string()), }) export const GravatarOptions = object({ /** * Cache duration for proxied avatar images in seconds. * @default 3600 */ cacheMaxAge: optional(number()), /** * Default image to show when no Gravatar exists. * @see https://docs.gravatar.com/general/images/#default-image * @default 'mp' */ default: optional(string()), /** * Avatar size in pixels (1-2048). * @default 80 */ size: optional(number()), /** * Content rating filter. * @default 'g' */ rating: optional(string()), })