moveo-one-segment-destination-web 1.0.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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/types.ts","../src/store.ts","../src/MoveoOneDestination.ts","../src/index.ts"],"names":["encoder","byteLength"],"mappings":";;;AAwDO,IAAM,QAAA,GAAW;AAAA,EACtB,QAAA,EAAU,iEAAA;AAAA,EACV,KAAA,EAAO,KAAA;AAAA,EACP,IAAA,EAAM,IAAA;AAAA,EACN,SAAA,EAAW,EAAA;AAAA,EACX,eAAA,EAAiB,GAAA;AAAA,EACjB,aAAA,EAAe,GAAA;AAAA,EACf,aAAA,EAAe,CAAA,GAAI,EAAA,GAAK,EAAA,GAAK,EAAA,GAAK,GAAA;AAAA,EAClC,UAAA,EAAY;AACd,CAAA;;;AC/DA,IAAM,OAAA,GAAU,IAAI,WAAA,EAAY;AAGhC,SAAS,WAAW,CAAA,EAAmB;AACrC,EAAA,OAAO,OAAA,CAAQ,MAAA,CAAO,CAAC,CAAA,CAAE,MAAA;AAC3B;AAoCO,IAAM,yBAAN,MAAmD;AAAA,EASxD,YAAY,MAAA,EAAgB;AAH5B,IAAA,IAAA,CAAQ,UAAoB,EAAC;AAC7B,IAAA,IAAA,CAAQ,gBAAA,GAAmB,CAAA;AAGzB,IAAA,IAAA,CAAK,MAAA,GAAS,CAAA,kBAAA,EAAqB,IAAA,CAAK,MAAM,CAAC,CAAA,CAAA;AAC/C,IAAA,IAAA,CAAK,MAAA,GAAS,CAAA,EAAG,IAAA,CAAK,MAAM,CAAA,IAAA,CAAA;AAC5B,IAAA,IAAA,CAAK,UAAA,GAAa,CAAA,EAAG,IAAA,CAAK,MAAM,CAAA,QAAA,CAAA;AAChC,IAAA,IAAA,CAAK,WAAA,GAAc,CAAA,EAAG,IAAA,CAAK,MAAM,CAAA,GAAA,CAAA;AAGjC,IAAA,MAAM,GAAA,GAAM,YAAA,CAAa,OAAA,CA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AAA,CAAE,MAAA;AAC3B;AAGA,SAAS,mBAAmB,EAAA,EAAiC;AAC3D,EAAA,IAAI,EAAA,KAAO,MAAA,IAAa,EAAA,KAAO,IAAA,EAAM,OAAO,MAAA;AAC5C,EAAA,IAAI,EAAA,YAAc,IAAA,EAAM,OAAO,EAAA,CAAG,WAAA,EAAY;AAC9C,EAAA,OAAO,OAAO,EAAE,CAAA;AAClB;AAGA,SAAS,gBAAgB,KAAA,EAAqC;AAC5D,EAAA,IAAI,CAAC,OAAO,OAAO,IAAA;AACnB,EAAA,MAAM,CAAA,GAAI,QAAA,CAAS,KAAA,CAAM,IAAA,IAAQ,EAAE,CAAA;AACnC,EAAA,OAAO,MAAA,CAAO,KAAA,CAAM,CAAC,CAAA,GAAI,IAAA,GAAO,CAAA;AAClC;AAMA,eAAe,KAAK,CAAA,EAAiC;AACnD,EAAA,IAAI,OAAO,iBAAA,KAAsB,WAAA,EAAa,OAAO,IAAA;AACrD,EAAA,IAAI;AACF,IAAA,MAAM,MAAA,GAAS,IAAI,IAAA,CAAK,CAAC,CAAC,CAAC,CAAA,CAAE,MAAA,EAAO,CAAE,WAAA,CAAY,IAAI,iBAAA,CAAkB,MAAM,CAAC,CAAA;AAC/E,IAAA,OAAO,MAAM,IAAI,QAAA,CAAS,MAAM,EAAE,IAAA,EAAK;AAAA,EACzC,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACF;;;ACzcO,SAAS,oBAAoB,OAAA,EAAkC;AACpE,EAAA,OAAO,IAAI,oBAAoB,OAAO,CAAA;AACxC","file":"index.cjs","sourcesContent":["/**\n * Configuration for {@link moveoOneDestination}.\n *\n * Only `apiKey` is required; every other option has a production default.\n * Most apps never set any of the optional knobs.\n */\nexport interface MoveoOneOptions {\n /** Your Moveo One API key. Sent as the `Authorization` header on every request. */\n apiKey: string;\n /** Override the ingestion endpoint. */\n endpoint?: string;\n /** When true, request and response details are logged to the console. */\n debug?: boolean;\n /**\n * When true (default), upload bodies are gzip-compressed (via `CompressionStream`)\n * and sent with `Content-Encoding: gzip`. Falls back to plain JSON automatically\n * when the browser has no `CompressionStream`. Set false to always send plain JSON.\n */\n gzip?: boolean;\n /** Number of events that trigger an immediate flush (default 20). */\n batchSize?: number;\n /** How often the batch is flushed automatically, in ms (default 30000). */\n flushIntervalMs?: number;\n /**\n * Max bytes of queued events held in storage (default 5 MB). When exceeded, the\n * oldest batches are evicted.\n */\n maxQueueBytes?: number;\n /** Max age (ms) of a queued batch before it is evicted (default 7 days). */\n maxQueueAgeMs?: number;\n /** Max upload attempts for a batch before it is dropped (default 10). */\n maxRetries?: number;\n /**\n * Optional property filter. When provided, only events whose properties/traits\n * contain ALL specified keys with a matching value are forwarded. Undefined\n * (default) forwards every event.\n *\n * @example { category: [\"purchase\", \"subscription\"], currency: [\"USD\", \"EUR\"] }\n */\n filter?: Record<string, string[]>;\n}\n\n/** Fully-resolved options with all defaults applied. */\nexport interface ResolvedOptions {\n apiKey: string;\n endpoint: string;\n debug: boolean;\n gzip: boolean;\n batchSize: number;\n flushIntervalMs: number;\n maxQueueBytes: number;\n maxQueueAgeMs: number;\n maxRetries: number;\n filter?: Record<string, string[]>;\n}\n\nexport const DEFAULTS = {\n endpoint: \"https://api.moveo.one/api/analytic/external/segment-destination\",\n debug: false,\n gzip: true,\n batchSize: 20,\n flushIntervalMs: 30_000,\n maxQueueBytes: 5_000_000,\n maxQueueAgeMs: 7 * 24 * 60 * 60 * 1000,\n maxRetries: 10,\n} as const;\n\n/** A sealed group of events that maps to exactly one HTTP request. */\nexport interface BatchFile {\n /** Identifier / storage key. */\n id: string;\n /** Monotonic ordering key. */\n seq: number;\n /** Failed upload attempts so far. */\n attempts: number;\n /** Creation time (epoch ms). */\n createdAtMs: number;\n /** Serialized events (one JSON string per event). */\n events: string[];\n}\n\n/** Result of a single upload attempt. */\nexport type SendResult =\n | { kind: \"success\" }\n | { kind: \"permanent\"; code: number }\n | { kind: \"retryable\"; retryAfterSec: number | null };\n","import type { BatchFile } from \"./types.js\";\n\nconst encoder = new TextEncoder();\n\n/** UTF-8 byte length of a string. */\nfunction byteLength(s: string): number {\n return encoder.encode(s).length;\n}\n\n/**\n * A durable (or in-memory fallback) event queue.\n *\n * A \"batch\" is a sealed group of events that maps to exactly one HTTP request.\n * Pending events are appended to a \"current\" buffer; sealing moves them into an\n * uploadable, ordered batch.\n */\nexport interface EventStore {\n /** Append one serialized event to the pending (not yet sealed) batch. */\n append(eventJson: string): void;\n currentCount(): number;\n currentBytes(): number;\n /** Seal the pending events into an uploadable batch. No-op if empty. */\n sealCurrent(): void;\n /** Sealed batches, oldest first. */\n batches(): BatchFile[];\n delete(batch: BatchFile): void;\n bumpAttempt(batch: BatchFile): void;\n /** Evict oldest batches that exceed the size/age budget. */\n enforceLimits(maxBytes: number, maxAgeMs: number, debug: boolean): void;\n}\n\ninterface StoredBatch {\n seq: number;\n attempts: number;\n createdAtMs: number;\n events: string[];\n}\n\n/**\n * `localStorage`-backed store. Pending events live under `<prefix>:current`; on\n * seal they are written to `<prefix>:b:<seq>` and uploaded oldest-first, deleted\n * only after a confirmed send. Survives page reloads and crashes.\n */\nexport class LocalStorageEventStore implements EventStore {\n private readonly prefix: string;\n private readonly seqKey: string;\n private readonly currentKey: string;\n private readonly batchPrefix: string;\n\n private current: string[] = [];\n private currentByteCount = 0;\n\n constructor(apiKey: string) {\n this.prefix = `moveo-one-segment/${hash(apiKey)}`;\n this.seqKey = `${this.prefix}:seq`;\n this.currentKey = `${this.prefix}:current`;\n this.batchPrefix = `${this.prefix}:b:`;\n\n // Restore any pending (unsealed) events left over from a previous page load.\n const raw = localStorage.getItem(this.currentKey);\n if (raw) {\n try {\n const parsed = JSON.parse(raw) as string[];\n this.current = Array.isArray(parsed) ? parsed : [];\n } catch {\n this.current = [];\n }\n this.currentByteCount = this.current.reduce((n, e) => n + byteLength(e), 0);\n }\n }\n\n append(eventJson: string): void {\n this.current.push(eventJson);\n this.currentByteCount += byteLength(eventJson);\n localStorage.setItem(this.currentKey, JSON.stringify(this.current));\n }\n\n currentCount(): number {\n return this.current.length;\n }\n\n currentBytes(): number {\n return this.currentByteCount;\n }\n\n sealCurrent(): void {\n if (this.current.length === 0) return;\n const seq = this.nextSeq();\n const key = `${this.batchPrefix}${pad(seq)}`;\n const batch: StoredBatch = {\n seq,\n attempts: 0,\n createdAtMs: Date.now(),\n events: this.current,\n };\n localStorage.setItem(key, JSON.stringify(batch));\n localStorage.removeItem(this.currentKey);\n this.current = [];\n this.currentByteCount = 0;\n }\n\n batches(): BatchFile[] {\n return this.sealedKeys()\n .map((key) => this.readBatch(key))\n .filter((b): b is BatchFile => b !== null)\n .sort((a, b) => a.seq - b.seq);\n }\n\n delete(batch: BatchFile): void {\n localStorage.removeItem(batch.id);\n }\n\n bumpAttempt(batch: BatchFile): void {\n const stored = this.readStored(batch.id);\n if (!stored) return;\n stored.attempts += 1;\n localStorage.setItem(batch.id, JSON.stringify(stored));\n }\n\n enforceLimits(maxBytes: number, maxAgeMs: number, debug: boolean): void {\n const now = Date.now();\n\n // Age-based eviction.\n for (const key of this.sealedKeys()) {\n const stored = this.readStored(key);\n if (stored && now - stored.createdAtMs > maxAgeMs) {\n if (debug) console.warn(`[MoveoOne] Evicting aged batch ${key}`);\n localStorage.removeItem(key);\n }\n }\n\n // Size-based eviction — drop oldest until within budget.\n const remaining = this.sealedKeys()\n .map((key) => ({ key, stored: this.readStored(key) }))\n .filter((x): x is { key: string; stored: StoredBatch } => x.stored !== null)\n .sort((a, b) => a.stored.seq - b.stored.seq);\n\n let total = remaining.reduce(\n (n, x) => n + x.stored.events.reduce((m, e) => m + byteLength(e), 0),\n 0,\n );\n let i = 0;\n while (total > maxBytes && i < remaining.length) {\n const x = remaining[i]!;\n total -= x.stored.events.reduce((m, e) => m + byteLength(e), 0);\n if (debug) console.warn(`[MoveoOne] Evicting over-budget batch ${x.key}`);\n localStorage.removeItem(x.key);\n i++;\n }\n }\n\n private nextSeq(): number {\n const seq = Number(localStorage.getItem(this.seqKey) ?? \"0\") || 0;\n localStorage.setItem(this.seqKey, String(seq + 1));\n return seq;\n }\n\n private sealedKeys(): string[] {\n const keys: string[] = [];\n for (let i = 0; i < localStorage.length; i++) {\n const key = localStorage.key(i);\n if (key && key.startsWith(this.batchPrefix)) keys.push(key);\n }\n return keys;\n }\n\n private readStored(key: string): StoredBatch | null {\n const raw = localStorage.getItem(key);\n if (!raw) return null;\n try {\n const parsed = JSON.parse(raw) as StoredBatch;\n if (!Array.isArray(parsed.events)) return null;\n return parsed;\n } catch {\n return null;\n }\n }\n\n private readBatch(key: string): BatchFile | null {\n const stored = this.readStored(key);\n if (!stored) return null;\n return {\n id: key,\n seq: stored.seq,\n attempts: stored.attempts,\n createdAtMs: stored.createdAtMs,\n events: stored.events.filter((e) => e.trim().length > 0),\n };\n }\n}\n\n/**\n * In-memory fallback used when `localStorage` is unavailable (e.g. SSR, private\n * mode, or a hardened CSP). Events are NOT durable across page loads.\n */\nexport class InMemoryEventStore implements EventStore {\n private current: string[] = [];\n private sealed: BatchFile[] = [];\n private seq = 0;\n private currentByteCount = 0;\n\n append(eventJson: string): void {\n this.current.push(eventJson);\n this.currentByteCount += byteLength(eventJson);\n }\n\n currentCount(): number {\n return this.current.length;\n }\n\n currentBytes(): number {\n return this.currentByteCount;\n }\n\n sealCurrent(): void {\n if (this.current.length === 0) return;\n const s = this.seq++;\n this.sealed.push({\n id: `mem-${s}`,\n seq: s,\n attempts: 0,\n createdAtMs: Date.now(),\n events: [...this.current],\n });\n this.current = [];\n this.currentByteCount = 0;\n }\n\n batches(): BatchFile[] {\n return [...this.sealed].sort((a, b) => a.seq - b.seq);\n }\n\n delete(batch: BatchFile): void {\n this.sealed = this.sealed.filter((b) => b.id !== batch.id);\n }\n\n bumpAttempt(batch: BatchFile): void {\n const idx = this.sealed.findIndex((b) => b.id === batch.id);\n if (idx >= 0) this.sealed[idx]!.attempts += 1;\n }\n\n enforceLimits(maxBytes: number, maxAgeMs: number, _debug: boolean): void {\n const now = Date.now();\n this.sealed = this.sealed.filter((b) => now - b.createdAtMs <= maxAgeMs);\n let total = this.sealed.reduce(\n (n, b) => n + b.events.reduce((m, e) => m + byteLength(e), 0),\n 0,\n );\n while (total > maxBytes && this.sealed.length > 0) {\n const removed = this.sealed.shift()!;\n total -= removed.events.reduce((m, e) => m + byteLength(e), 0);\n }\n }\n}\n\n/**\n * Returns a durable `localStorage` store when available, otherwise an in-memory\n * fallback.\n */\nexport function buildStore(apiKey: string, debug: boolean): EventStore {\n try {\n if (typeof localStorage === \"undefined\") throw new Error(\"no localStorage\");\n // Probe that localStorage is actually writable (private mode can throw).\n const probe = \"moveo-one-segment:probe\";\n localStorage.setItem(probe, \"1\");\n localStorage.removeItem(probe);\n return new LocalStorageEventStore(apiKey);\n } catch (e) {\n if (debug)\n console.warn(\n \"[MoveoOne] localStorage unavailable — using in-memory store (events are NOT durable)\",\n e,\n );\n return new InMemoryEventStore();\n }\n}\n\n/** Zero-padded sequence key so lexical and numeric order agree. */\nfunction pad(seq: number): string {\n return String(seq).padStart(12, \"0\");\n}\n\n/** Small, stable string hash (djb2-ish) used to namespace storage per API key. */\nfunction hash(s: string): string {\n let h = 0;\n for (let i = 0; i < s.length; i++) {\n h = (Math.imul(31, h) + s.charCodeAt(i)) | 0;\n }\n return (h >>> 0).toString(16);\n}\n","import type { Analytics, Context, Plugin } from \"@segment/analytics-next\";\nimport {\n DEFAULTS,\n type MoveoOneOptions,\n type ResolvedOptions,\n type SendResult,\n} from \"./types.js\";\nimport { buildStore, type EventStore } from \"./store.js\";\n\n/** The Segment event payload carried by a `Context`. */\ntype EventPayload = Context[\"event\"];\n\nconst encoder = new TextEncoder();\n\n// Segment-style payload limits — keep a single event and a single request\n// comfortably under the Tracking API's 32 KB / 500 KB caps.\nconst MAX_EVENT_BYTES = 32_000;\nconst MAX_REQUEST_BYTES = 475_000;\n\n// Exponential backoff parameters.\nconst BACKOFF_BASE_SEC = 1.0;\nconst BACKOFF_MAX_SEC = 300.0;\nconst BACKOFF_JITTER = 0.2;\n\n/**\n * Moveo One Destination Plugin for Segment Analytics (analytics-next / Web).\n *\n * Intercepts all Segment events and forwards them to the Moveo One API, so you\n * can use a single Segment instrumentation to feed both Segment and Moveo One.\n *\n * Production behaviour:\n * • Durability — events are written to `localStorage` before the network is\n * touched, so they survive page reloads and crashes. They are deleted only\n * after the server confirms receipt (HTTP 2xx). When `localStorage` is\n * unavailable the plugin transparently falls back to an in-memory store.\n * • Batching — events accumulate until `batchSize` is reached, a size limit is\n * hit, the `flushIntervalMs` timer fires, or the page is hidden/unloaded.\n * • Retries — failed uploads retry with exponential backoff + jitter. HTTP 429\n * and a `Retry-After` header are honoured. 5xx/network errors retry; non-429\n * 4xx are treated as permanent and dropped. A batch is dropped after\n * `maxRetries` attempts so one poison batch can't block the queue forever.\n * • Bounded — the queue is capped by `maxQueueBytes`/`maxQueueAgeMs`; when over\n * budget the OLDEST batches are evicted.\n *\n * Delivery is at-least-once: after a crash a batch may be sent twice. The backend\n * de-duplicates on `messageId`, which is included on every event.\n */\nexport class MoveoOneDestination implements Plugin {\n readonly name = \"Moveo One\";\n readonly type = \"enrichment\" as const;\n readonly version = \"1.0.0\";\n\n private readonly options: ResolvedOptions;\n\n // Durable (or in-memory fallback) event queue. Initialised in load().\n private store!: EventStore;\n private loaded = false;\n\n // Retry/backoff state.\n private consecutiveFailures = 0;\n private nextAllowedSendAtMs = 0;\n\n // Guard so overlapping flushes never run concurrently (the browser is\n // single-threaded, but flush I/O is async), serializing all store + network\n // access.\n private flushing = false;\n private flushTimer: ReturnType<typeof setInterval> | null = null;\n\n private onVisibilityChange?: () => void;\n private onPageHide?: () => void;\n\n constructor(options: MoveoOneOptions) {\n if (!options || !options.apiKey) {\n throw new Error(\"[MoveoOne] `apiKey` is required\");\n }\n this.options = {\n apiKey: options.apiKey,\n endpoint: options.endpoint ?? DEFAULTS.endpoint,\n debug: options.debug ?? DEFAULTS.debug,\n gzip: options.gzip ?? DEFAULTS.gzip,\n batchSize: options.batchSize ?? DEFAULTS.batchSize,\n flushIntervalMs: options.flushIntervalMs ?? DEFAULTS.flushIntervalMs,\n maxQueueBytes: options.maxQueueBytes ?? DEFAULTS.maxQueueBytes,\n maxQueueAgeMs: options.maxQueueAgeMs ?? DEFAULTS.maxQueueAgeMs,\n maxRetries: options.maxRetries ?? DEFAULTS.maxRetries,\n filter: options.filter,\n };\n }\n\n isLoaded(): boolean {\n return this.loaded;\n }\n\n // ──────────────────────────────────────────────────────────────────────────\n // Lifecycle — runs when the plugin is registered with analytics-next.\n // ──────────────────────────────────────────────────────────────────────────\n\n async load(_ctx: Context, _instance: Analytics): Promise<void> {\n this.store = buildStore(this.options.apiKey, this.options.debug);\n this.registerLifecycle();\n\n // Seal any leftover partial buffer from a previous load and try to flush.\n void this.flush();\n this.flushTimer = setInterval(() => void this.flush(), this.options.flushIntervalMs);\n\n this.loaded = true;\n }\n\n async unload(): Promise<void> {\n if (this.flushTimer !== null) {\n clearInterval(this.flushTimer);\n this.flushTimer = null;\n }\n if (typeof document !== \"undefined\" && this.onVisibilityChange) {\n document.removeEventListener(\"visibilitychange\", this.onVisibilityChange);\n }\n if (typeof window !== \"undefined\" && this.onPageHide) {\n window.removeEventListener(\"pagehide\", this.onPageHide);\n }\n await this.flush();\n this.loaded = false;\n }\n\n // ──────────────────────────────────────────────────────────────────────────\n // Segment plugin overrides — intercept every event and forward a copy. The\n // context is returned unchanged so the rest of the Segment pipeline is intact.\n // ──────────────────────────────────────────────────────────────────────────\n\n track(ctx: Context): Context {\n this.ship(ctx.event);\n return ctx;\n }\n\n page(ctx: Context): Context {\n this.ship(ctx.event);\n return ctx;\n }\n\n screen(ctx: Context): Context {\n this.ship(ctx.event);\n return ctx;\n }\n\n identify(ctx: Context): Context {\n this.ship(ctx.event);\n return ctx;\n }\n\n group(ctx: Context): Context {\n this.ship(ctx.event);\n return ctx;\n }\n\n alias(ctx: Context): Context {\n this.ship(ctx.event);\n return ctx;\n }\n\n // ──────────────────────────────────────────────────────────────────────────\n // Public API\n // ──────────────────────────────────────────────────────────────────────────\n\n /**\n * Immediately flushes the pending batch and any queued events.\n * Called automatically on the interval timer and when the page is hidden.\n */\n async flush(): Promise<void> {\n await this.doFlush();\n }\n\n // ──────────────────────────────────────────────────────────────────────────\n // Private helpers\n // ──────────────────────────────────────────────────────────────────────────\n\n private ship(event: EventPayload): void {\n if (!this.passesFilter(event)) return;\n const body = JSON.stringify(this.buildPayload(event));\n\n if (byteLength(body) > MAX_EVENT_BYTES) {\n if (this.options.debug)\n console.warn(\n `[MoveoOne] Event ${event.messageId} is too large (${body.length} chars) — skipped`,\n );\n return;\n }\n\n try {\n this.store.append(body);\n if (\n this.store.currentCount() >= this.options.batchSize ||\n this.store.currentBytes() >= MAX_REQUEST_BYTES\n ) {\n void this.flush();\n }\n } catch (e) {\n if (this.options.debug) console.warn(\"[MoveoOne] Failed to enqueue event\", e);\n }\n }\n\n /**\n * Seals the pending events into a batch and uploads everything that is due.\n * Guarded so only one flush runs at a time.\n */\n private async doFlush(): Promise<void> {\n if (this.flushing) return;\n this.flushing = true;\n try {\n try {\n this.store.sealCurrent();\n } catch (e) {\n if (this.options.debug) console.warn(\"[MoveoOne] Seal failed\", e);\n }\n\n const now = Date.now();\n if (now < this.nextAllowedSendAtMs) {\n if (this.options.debug)\n console.debug(\n `[MoveoOne] Backing off — skipping uploads for ${this.nextAllowedSendAtMs - now}ms`,\n );\n return;\n }\n\n this.store.enforceLimits(\n this.options.maxQueueBytes,\n this.options.maxQueueAgeMs,\n this.options.debug,\n );\n\n for (const batch of this.store.batches()) {\n if (batch.events.length === 0) {\n this.store.delete(batch);\n continue;\n }\n const result = await this.postBatch(batch.events);\n if (result.kind === \"success\") {\n this.store.delete(batch);\n this.onSendSuccess();\n if (this.options.debug)\n console.debug(`[MoveoOne] Sent batch ${batch.id} (${batch.events.length} events)`);\n } else if (result.kind === \"permanent\") {\n this.store.delete(batch);\n if (this.options.debug)\n console.warn(\n `[MoveoOne] Dropped batch ${batch.id} — HTTP ${result.code} (non-retryable)`,\n );\n } else {\n const nextAttempt = batch.attempts + 1;\n if (nextAttempt > this.options.maxRetries) {\n this.store.delete(batch);\n if (this.options.debug)\n console.warn(\n `[MoveoOne] Dropped batch ${batch.id} after ${this.options.maxRetries} failed attempts`,\n );\n continue;\n }\n this.store.bumpAttempt(batch);\n this.onSendFailure(result.retryAfterSec);\n if (this.options.debug)\n console.warn(\n `[MoveoOne] Batch ${batch.id} failed (attempt ${nextAttempt}) — backing off`,\n );\n return; // respect the backoff window before trying anything else\n }\n }\n } finally {\n this.flushing = false;\n }\n }\n\n private onSendSuccess(): void {\n this.consecutiveFailures = 0;\n this.nextAllowedSendAtMs = 0;\n }\n\n private onSendFailure(retryAfterSec: number | null): void {\n this.consecutiveFailures++;\n let delaySec: number;\n if (retryAfterSec !== null && retryAfterSec > 0) {\n delaySec = retryAfterSec;\n } else {\n const expo = BACKOFF_BASE_SEC * Math.pow(2, this.consecutiveFailures - 1);\n const capped = Math.min(expo, BACKOFF_MAX_SEC);\n delaySec = capped + capped * BACKOFF_JITTER * Math.random();\n }\n this.nextAllowedSendAtMs = Date.now() + Math.floor(delaySec * 1000);\n }\n\n /**\n * Returns true if the event should be forwarded to Moveo One.\n * When no filter is set all events pass. When a filter is set, all specified\n * key/value conditions must match against the event's properties or traits.\n */\n private passesFilter(event: EventPayload): boolean {\n const filter = this.options.filter;\n if (!filter || Object.keys(filter).length === 0) return true;\n\n let bag: Record<string, unknown> | undefined;\n switch (event.type) {\n case \"track\":\n case \"page\":\n case \"screen\":\n bag = event.properties as Record<string, unknown> | undefined;\n break;\n case \"identify\":\n case \"group\":\n bag = event.traits as Record<string, unknown> | undefined;\n break;\n default:\n return true;\n }\n const properties = bag ?? {};\n\n return Object.entries(filter).every(([key, allowedValues]) => {\n const value = properties[key];\n if (value === null || value === undefined) return false;\n // Only primitive values count (string / number / boolean), matched as strings.\n if (typeof value === \"object\") return false;\n return allowedValues.includes(String(value));\n });\n }\n\n /**\n * Builds the JSON body sent to the Moveo One API.\n * Follows the Segment event spec so the same fields are available on both sides.\n */\n private buildPayload(event: EventPayload): Record<string, unknown> {\n const out: Record<string, unknown> = {\n type: String(event.type).toLowerCase(),\n messageId: event.messageId,\n anonymousId: event.anonymousId,\n timestamp: normalizeTimestamp(event.timestamp),\n originalTimestamp: normalizeTimestamp(event.timestamp),\n };\n\n if (typeof event.userId === \"string\" && event.userId.trim().length > 0) {\n out[\"userId\"] = event.userId;\n }\n\n out[\"context\"] = event.context;\n out[\"integrations\"] = event.integrations;\n\n switch (event.type) {\n case \"track\":\n out[\"event\"] = event.event;\n out[\"properties\"] = event.properties;\n break;\n case \"page\":\n case \"screen\":\n out[\"name\"] = event.name;\n out[\"properties\"] = event.properties;\n break;\n case \"identify\":\n out[\"traits\"] = event.traits;\n break;\n case \"group\":\n out[\"groupId\"] = event.groupId;\n out[\"traits\"] = event.traits;\n break;\n default:\n // alias — common fields above are sufficient\n break;\n }\n\n return out;\n }\n\n private async postBatch(events: string[]): Promise<SendResult> {\n const sentAt = new Date().toISOString();\n const wrapped = events.map((raw) => {\n const obj = JSON.parse(raw) as Record<string, unknown>;\n if (Object.prototype.hasOwnProperty.call(obj, \"sentAt\")) return obj;\n return { ...obj, sentAt };\n });\n const body = JSON.stringify({ events: wrapped });\n return this.sendRequest(body);\n }\n\n private async sendRequest(body: string): Promise<SendResult> {\n const headers: Record<string, string> = {\n \"Content-Type\": \"application/json; charset=utf-8\",\n Authorization: this.options.apiKey,\n };\n\n let payload: BodyInit = body;\n if (this.options.gzip) {\n const gzipped = await gzip(body);\n if (gzipped) {\n payload = gzipped;\n headers[\"Content-Encoding\"] = \"gzip\";\n }\n }\n\n if (this.options.debug) {\n console.debug(\"[MoveoOne] ──────────────────────────────────────\");\n console.debug(\n `[MoveoOne] → POST ${this.options.endpoint}${headers[\"Content-Encoding\"] ? \" (gzip)\" : \"\"}`,\n );\n console.debug(`[MoveoOne] → Authorization: ${this.options.apiKey.slice(0, 8)}…`);\n console.debug(`[MoveoOne] → Body: ${body}`);\n }\n\n let res: Response;\n try {\n res = await fetch(this.options.endpoint, {\n method: \"POST\",\n headers,\n body: payload,\n // keepalive lets in-flight requests complete during page unload.\n keepalive: true,\n });\n } catch (e) {\n if (this.options.debug) console.warn(\"[MoveoOne] Network error while uploading\", e);\n return { kind: \"retryable\", retryAfterSec: null };\n }\n\n const code = res.status;\n const retryAfter = parseRetryAfter(res.headers.get(\"Retry-After\"));\n\n if (this.options.debug) {\n const responseBody = await res.text().catch(() => \"(empty)\");\n console.debug(`[MoveoOne] ← HTTP ${code}`);\n console.debug(`[MoveoOne] ← Response: ${responseBody || \"(empty)\"}`);\n console.debug(\"[MoveoOne] ──────────────────────────────────────\");\n }\n\n if (code >= 200 && code <= 299) return { kind: \"success\" };\n if (code === 429) return { kind: \"retryable\", retryAfterSec: retryAfter };\n if (code >= 500 && code <= 599) return { kind: \"retryable\", retryAfterSec: retryAfter };\n if (code >= 400 && code <= 499) return { kind: \"permanent\", code };\n return { kind: \"retryable\", retryAfterSec: retryAfter };\n }\n\n private registerLifecycle(): void {\n // Flush when the page is hidden or unloaded so queued events aren't lost.\n if (typeof document !== \"undefined\") {\n this.onVisibilityChange = () => {\n if (document.visibilityState === \"hidden\") void this.flush();\n };\n document.addEventListener(\"visibilitychange\", this.onVisibilityChange);\n }\n if (typeof window !== \"undefined\") {\n this.onPageHide = () => void this.flush();\n window.addEventListener(\"pagehide\", this.onPageHide);\n }\n }\n}\n\n/** UTF-8 byte length of a string. */\nfunction byteLength(s: string): number {\n return encoder.encode(s).length;\n}\n\n/** Normalises a Segment timestamp (Date | string | undefined) to an ISO string. */\nfunction normalizeTimestamp(ts: unknown): string | undefined {\n if (ts === undefined || ts === null) return undefined;\n if (ts instanceof Date) return ts.toISOString();\n return String(ts);\n}\n\n/** Parses a `Retry-After` header value (delta-seconds) into a number, or null. */\nfunction parseRetryAfter(value: string | null): number | null {\n if (!value) return null;\n const n = parseInt(value.trim(), 10);\n return Number.isNaN(n) ? null : n;\n}\n\n/**\n * Gzip-compresses a string via `CompressionStream` when available. Returns null\n * when compression is unsupported so the caller can send plain JSON instead.\n */\nasync function gzip(s: string): Promise<Blob | null> {\n if (typeof CompressionStream === \"undefined\") return null;\n try {\n const stream = new Blob([s]).stream().pipeThrough(new CompressionStream(\"gzip\"));\n return await new Response(stream).blob();\n } catch {\n return null;\n }\n}\n","import type { Plugin } from \"@segment/analytics-next\";\nimport { MoveoOneDestination } from \"./MoveoOneDestination.js\";\nimport type { MoveoOneOptions } from \"./types.js\";\n\nexport { MoveoOneDestination };\nexport type { MoveoOneOptions };\n\n/**\n * Creates the Moveo One destination plugin for Segment's `@segment/analytics-next`.\n *\n * Every `track`, `page`, `screen`, `identify`, `group`, and `alias` call made\n * through Segment is forwarded to Moveo One, so a single instrumentation feeds\n * both platforms.\n *\n * @example\n * import { AnalyticsBrowser } from \"@segment/analytics-next\";\n * import { moveoOneDestination } from \"moveo-one-segment-destination-web\";\n *\n * export const analytics = AnalyticsBrowser.load({ writeKey: \"YOUR_SEGMENT_WRITE_KEY\" });\n * analytics.register(moveoOneDestination({ apiKey: \"YOUR_MOVEO_API_KEY\" }));\n */\nexport function moveoOneDestination(options: MoveoOneOptions): Plugin {\n return new MoveoOneDestination(options);\n}\n"]}
@@ -0,0 +1,136 @@
1
+ import { Plugin, Context, Analytics } from '@segment/analytics-next';
2
+
3
+ /**
4
+ * Configuration for {@link moveoOneDestination}.
5
+ *
6
+ * Only `apiKey` is required; every other option has a production default.
7
+ * Most apps never set any of the optional knobs.
8
+ */
9
+ interface MoveoOneOptions {
10
+ /** Your Moveo One API key. Sent as the `Authorization` header on every request. */
11
+ apiKey: string;
12
+ /** Override the ingestion endpoint. */
13
+ endpoint?: string;
14
+ /** When true, request and response details are logged to the console. */
15
+ debug?: boolean;
16
+ /**
17
+ * When true (default), upload bodies are gzip-compressed (via `CompressionStream`)
18
+ * and sent with `Content-Encoding: gzip`. Falls back to plain JSON automatically
19
+ * when the browser has no `CompressionStream`. Set false to always send plain JSON.
20
+ */
21
+ gzip?: boolean;
22
+ /** Number of events that trigger an immediate flush (default 20). */
23
+ batchSize?: number;
24
+ /** How often the batch is flushed automatically, in ms (default 30000). */
25
+ flushIntervalMs?: number;
26
+ /**
27
+ * Max bytes of queued events held in storage (default 5 MB). When exceeded, the
28
+ * oldest batches are evicted.
29
+ */
30
+ maxQueueBytes?: number;
31
+ /** Max age (ms) of a queued batch before it is evicted (default 7 days). */
32
+ maxQueueAgeMs?: number;
33
+ /** Max upload attempts for a batch before it is dropped (default 10). */
34
+ maxRetries?: number;
35
+ /**
36
+ * Optional property filter. When provided, only events whose properties/traits
37
+ * contain ALL specified keys with a matching value are forwarded. Undefined
38
+ * (default) forwards every event.
39
+ *
40
+ * @example { category: ["purchase", "subscription"], currency: ["USD", "EUR"] }
41
+ */
42
+ filter?: Record<string, string[]>;
43
+ }
44
+
45
+ /**
46
+ * Moveo One Destination Plugin for Segment Analytics (analytics-next / Web).
47
+ *
48
+ * Intercepts all Segment events and forwards them to the Moveo One API, so you
49
+ * can use a single Segment instrumentation to feed both Segment and Moveo One.
50
+ *
51
+ * Production behaviour:
52
+ * • Durability — events are written to `localStorage` before the network is
53
+ * touched, so they survive page reloads and crashes. They are deleted only
54
+ * after the server confirms receipt (HTTP 2xx). When `localStorage` is
55
+ * unavailable the plugin transparently falls back to an in-memory store.
56
+ * • Batching — events accumulate until `batchSize` is reached, a size limit is
57
+ * hit, the `flushIntervalMs` timer fires, or the page is hidden/unloaded.
58
+ * • Retries — failed uploads retry with exponential backoff + jitter. HTTP 429
59
+ * and a `Retry-After` header are honoured. 5xx/network errors retry; non-429
60
+ * 4xx are treated as permanent and dropped. A batch is dropped after
61
+ * `maxRetries` attempts so one poison batch can't block the queue forever.
62
+ * • Bounded — the queue is capped by `maxQueueBytes`/`maxQueueAgeMs`; when over
63
+ * budget the OLDEST batches are evicted.
64
+ *
65
+ * Delivery is at-least-once: after a crash a batch may be sent twice. The backend
66
+ * de-duplicates on `messageId`, which is included on every event.
67
+ */
68
+ declare class MoveoOneDestination implements Plugin {
69
+ readonly name = "Moveo One";
70
+ readonly type: "enrichment";
71
+ readonly version = "1.0.0";
72
+ private readonly options;
73
+ private store;
74
+ private loaded;
75
+ private consecutiveFailures;
76
+ private nextAllowedSendAtMs;
77
+ private flushing;
78
+ private flushTimer;
79
+ private onVisibilityChange?;
80
+ private onPageHide?;
81
+ constructor(options: MoveoOneOptions);
82
+ isLoaded(): boolean;
83
+ load(_ctx: Context, _instance: Analytics): Promise<void>;
84
+ unload(): Promise<void>;
85
+ track(ctx: Context): Context;
86
+ page(ctx: Context): Context;
87
+ screen(ctx: Context): Context;
88
+ identify(ctx: Context): Context;
89
+ group(ctx: Context): Context;
90
+ alias(ctx: Context): Context;
91
+ /**
92
+ * Immediately flushes the pending batch and any queued events.
93
+ * Called automatically on the interval timer and when the page is hidden.
94
+ */
95
+ flush(): Promise<void>;
96
+ private ship;
97
+ /**
98
+ * Seals the pending events into a batch and uploads everything that is due.
99
+ * Guarded so only one flush runs at a time.
100
+ */
101
+ private doFlush;
102
+ private onSendSuccess;
103
+ private onSendFailure;
104
+ /**
105
+ * Returns true if the event should be forwarded to Moveo One.
106
+ * When no filter is set all events pass. When a filter is set, all specified
107
+ * key/value conditions must match against the event's properties or traits.
108
+ */
109
+ private passesFilter;
110
+ /**
111
+ * Builds the JSON body sent to the Moveo One API.
112
+ * Follows the Segment event spec so the same fields are available on both sides.
113
+ */
114
+ private buildPayload;
115
+ private postBatch;
116
+ private sendRequest;
117
+ private registerLifecycle;
118
+ }
119
+
120
+ /**
121
+ * Creates the Moveo One destination plugin for Segment's `@segment/analytics-next`.
122
+ *
123
+ * Every `track`, `page`, `screen`, `identify`, `group`, and `alias` call made
124
+ * through Segment is forwarded to Moveo One, so a single instrumentation feeds
125
+ * both platforms.
126
+ *
127
+ * @example
128
+ * import { AnalyticsBrowser } from "@segment/analytics-next";
129
+ * import { moveoOneDestination } from "moveo-one-segment-destination-web";
130
+ *
131
+ * export const analytics = AnalyticsBrowser.load({ writeKey: "YOUR_SEGMENT_WRITE_KEY" });
132
+ * analytics.register(moveoOneDestination({ apiKey: "YOUR_MOVEO_API_KEY" }));
133
+ */
134
+ declare function moveoOneDestination(options: MoveoOneOptions): Plugin;
135
+
136
+ export { MoveoOneDestination, type MoveoOneOptions, moveoOneDestination };
@@ -0,0 +1,136 @@
1
+ import { Plugin, Context, Analytics } from '@segment/analytics-next';
2
+
3
+ /**
4
+ * Configuration for {@link moveoOneDestination}.
5
+ *
6
+ * Only `apiKey` is required; every other option has a production default.
7
+ * Most apps never set any of the optional knobs.
8
+ */
9
+ interface MoveoOneOptions {
10
+ /** Your Moveo One API key. Sent as the `Authorization` header on every request. */
11
+ apiKey: string;
12
+ /** Override the ingestion endpoint. */
13
+ endpoint?: string;
14
+ /** When true, request and response details are logged to the console. */
15
+ debug?: boolean;
16
+ /**
17
+ * When true (default), upload bodies are gzip-compressed (via `CompressionStream`)
18
+ * and sent with `Content-Encoding: gzip`. Falls back to plain JSON automatically
19
+ * when the browser has no `CompressionStream`. Set false to always send plain JSON.
20
+ */
21
+ gzip?: boolean;
22
+ /** Number of events that trigger an immediate flush (default 20). */
23
+ batchSize?: number;
24
+ /** How often the batch is flushed automatically, in ms (default 30000). */
25
+ flushIntervalMs?: number;
26
+ /**
27
+ * Max bytes of queued events held in storage (default 5 MB). When exceeded, the
28
+ * oldest batches are evicted.
29
+ */
30
+ maxQueueBytes?: number;
31
+ /** Max age (ms) of a queued batch before it is evicted (default 7 days). */
32
+ maxQueueAgeMs?: number;
33
+ /** Max upload attempts for a batch before it is dropped (default 10). */
34
+ maxRetries?: number;
35
+ /**
36
+ * Optional property filter. When provided, only events whose properties/traits
37
+ * contain ALL specified keys with a matching value are forwarded. Undefined
38
+ * (default) forwards every event.
39
+ *
40
+ * @example { category: ["purchase", "subscription"], currency: ["USD", "EUR"] }
41
+ */
42
+ filter?: Record<string, string[]>;
43
+ }
44
+
45
+ /**
46
+ * Moveo One Destination Plugin for Segment Analytics (analytics-next / Web).
47
+ *
48
+ * Intercepts all Segment events and forwards them to the Moveo One API, so you
49
+ * can use a single Segment instrumentation to feed both Segment and Moveo One.
50
+ *
51
+ * Production behaviour:
52
+ * • Durability — events are written to `localStorage` before the network is
53
+ * touched, so they survive page reloads and crashes. They are deleted only
54
+ * after the server confirms receipt (HTTP 2xx). When `localStorage` is
55
+ * unavailable the plugin transparently falls back to an in-memory store.
56
+ * • Batching — events accumulate until `batchSize` is reached, a size limit is
57
+ * hit, the `flushIntervalMs` timer fires, or the page is hidden/unloaded.
58
+ * • Retries — failed uploads retry with exponential backoff + jitter. HTTP 429
59
+ * and a `Retry-After` header are honoured. 5xx/network errors retry; non-429
60
+ * 4xx are treated as permanent and dropped. A batch is dropped after
61
+ * `maxRetries` attempts so one poison batch can't block the queue forever.
62
+ * • Bounded — the queue is capped by `maxQueueBytes`/`maxQueueAgeMs`; when over
63
+ * budget the OLDEST batches are evicted.
64
+ *
65
+ * Delivery is at-least-once: after a crash a batch may be sent twice. The backend
66
+ * de-duplicates on `messageId`, which is included on every event.
67
+ */
68
+ declare class MoveoOneDestination implements Plugin {
69
+ readonly name = "Moveo One";
70
+ readonly type: "enrichment";
71
+ readonly version = "1.0.0";
72
+ private readonly options;
73
+ private store;
74
+ private loaded;
75
+ private consecutiveFailures;
76
+ private nextAllowedSendAtMs;
77
+ private flushing;
78
+ private flushTimer;
79
+ private onVisibilityChange?;
80
+ private onPageHide?;
81
+ constructor(options: MoveoOneOptions);
82
+ isLoaded(): boolean;
83
+ load(_ctx: Context, _instance: Analytics): Promise<void>;
84
+ unload(): Promise<void>;
85
+ track(ctx: Context): Context;
86
+ page(ctx: Context): Context;
87
+ screen(ctx: Context): Context;
88
+ identify(ctx: Context): Context;
89
+ group(ctx: Context): Context;
90
+ alias(ctx: Context): Context;
91
+ /**
92
+ * Immediately flushes the pending batch and any queued events.
93
+ * Called automatically on the interval timer and when the page is hidden.
94
+ */
95
+ flush(): Promise<void>;
96
+ private ship;
97
+ /**
98
+ * Seals the pending events into a batch and uploads everything that is due.
99
+ * Guarded so only one flush runs at a time.
100
+ */
101
+ private doFlush;
102
+ private onSendSuccess;
103
+ private onSendFailure;
104
+ /**
105
+ * Returns true if the event should be forwarded to Moveo One.
106
+ * When no filter is set all events pass. When a filter is set, all specified
107
+ * key/value conditions must match against the event's properties or traits.
108
+ */
109
+ private passesFilter;
110
+ /**
111
+ * Builds the JSON body sent to the Moveo One API.
112
+ * Follows the Segment event spec so the same fields are available on both sides.
113
+ */
114
+ private buildPayload;
115
+ private postBatch;
116
+ private sendRequest;
117
+ private registerLifecycle;
118
+ }
119
+
120
+ /**
121
+ * Creates the Moveo One destination plugin for Segment's `@segment/analytics-next`.
122
+ *
123
+ * Every `track`, `page`, `screen`, `identify`, `group`, and `alias` call made
124
+ * through Segment is forwarded to Moveo One, so a single instrumentation feeds
125
+ * both platforms.
126
+ *
127
+ * @example
128
+ * import { AnalyticsBrowser } from "@segment/analytics-next";
129
+ * import { moveoOneDestination } from "moveo-one-segment-destination-web";
130
+ *
131
+ * export const analytics = AnalyticsBrowser.load({ writeKey: "YOUR_SEGMENT_WRITE_KEY" });
132
+ * analytics.register(moveoOneDestination({ apiKey: "YOUR_MOVEO_API_KEY" }));
133
+ */
134
+ declare function moveoOneDestination(options: MoveoOneOptions): Plugin;
135
+
136
+ export { MoveoOneDestination, type MoveoOneOptions, moveoOneDestination };