@ianmenethil/zp-observer 6.0.0 → 6.1.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/README.md +19 -276
- package/dist/adapters/browser-lifecycle-adapter.cjs +51 -0
- package/dist/adapters/browser-lifecycle-adapter.js +48 -0
- package/dist/adapters/iframe-detector-adapter.cjs +108 -0
- package/dist/adapters/iframe-detector-adapter.js +106 -0
- package/dist/client/create-telemetry-client.cjs +136 -0
- package/dist/client/create-telemetry-client.js +134 -0
- package/dist/client/state-machine.cjs +20 -0
- package/dist/client/state-machine.js +18 -0
- package/dist/diagnostics/diagnostics-buffer.cjs +34 -0
- package/dist/diagnostics/diagnostics-buffer.js +32 -0
- package/dist/diagnostics/preflight.cjs +36 -0
- package/dist/diagnostics/preflight.js +34 -0
- package/dist/events/envelope.cjs +23 -0
- package/dist/events/envelope.js +21 -0
- package/dist/index.cjs +23 -0
- package/dist/index.d.ts +230 -0
- package/dist/index.js +10 -0
- package/dist/persistence/local-storage-outbox.cjs +56 -0
- package/dist/persistence/local-storage-outbox.js +54 -0
- package/dist/persistence/memory-outbox.cjs +23 -0
- package/dist/persistence/memory-outbox.js +21 -0
- package/dist/runtime/event-pipeline.cjs +64 -0
- package/dist/runtime/event-pipeline.js +62 -0
- package/dist/runtime/heartbeat-scheduler.cjs +46 -0
- package/dist/runtime/heartbeat-scheduler.js +44 -0
- package/dist/runtime/session-manager.cjs +47 -0
- package/dist/runtime/session-manager.js +45 -0
- package/dist/transport/beacon.cjs +14 -0
- package/dist/transport/beacon.js +12 -0
- package/dist/transport/callback-transport.cjs +19 -0
- package/dist/transport/callback-transport.js +17 -0
- package/dist/transport/http-transport.cjs +62 -0
- package/dist/transport/http-transport.js +60 -0
- package/dist/types/internal.cjs +3 -0
- package/dist/types/internal.js +0 -0
- package/dist/types/public.cjs +3 -0
- package/dist/types/public.js +0 -0
- package/dist/utils/ids.cjs +20 -0
- package/dist/utils/ids.js +17 -0
- package/dist/utils/safe-globals.cjs +11 -0
- package/dist/utils/safe-globals.js +9 -0
- package/dist/version.cjs +5 -0
- package/dist/version.js +2 -0
- package/package.json +29 -89
- package/PRIVACY.md +0 -67
- package/dist/auto-patch.cjs +0 -171
- package/dist/auto-patch.cjs.map +0 -7
- package/dist/auto-patch.mjs +0 -148
- package/dist/auto-patch.mjs.map +0 -7
- package/dist/session.cjs +0 -1186
- package/dist/session.cjs.map +0 -7
- package/dist/session.mjs +0 -1163
- package/dist/session.mjs.map +0 -7
- package/dist/types/auto-patch.d.ts +0 -9
- package/dist/types/auto-patch.d.ts.map +0 -1
- package/dist/types/core/beacon.d.ts +0 -6
- package/dist/types/core/beacon.d.ts.map +0 -1
- package/dist/types/core/detection.d.ts +0 -34
- package/dist/types/core/detection.d.ts.map +0 -1
- package/dist/types/core/event-bus.d.ts +0 -21
- package/dist/types/core/event-bus.d.ts.map +0 -1
- package/dist/types/core/experimental.d.ts +0 -35
- package/dist/types/core/experimental.d.ts.map +0 -1
- package/dist/types/core/heartbeat.d.ts +0 -32
- package/dist/types/core/heartbeat.d.ts.map +0 -1
- package/dist/types/core/lifecycle.d.ts +0 -31
- package/dist/types/core/lifecycle.d.ts.map +0 -1
- package/dist/types/core/observer.d.ts +0 -10
- package/dist/types/core/observer.d.ts.map +0 -1
- package/dist/types/core/outbox.d.ts +0 -20
- package/dist/types/core/outbox.d.ts.map +0 -1
- package/dist/types/core/random.d.ts +0 -8
- package/dist/types/core/random.d.ts.map +0 -1
- package/dist/types/core/shortcode.d.ts +0 -17
- package/dist/types/core/shortcode.d.ts.map +0 -1
- package/dist/types/core/types.d.ts +0 -292
- package/dist/types/core/types.d.ts.map +0 -1
- package/dist/types/diagnostics/preflight.d.ts +0 -17
- package/dist/types/diagnostics/preflight.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -41
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/integration/devicefp-bridge.d.ts +0 -31
- package/dist/types/integration/devicefp-bridge.d.ts.map +0 -1
- package/dist/types/integration/hpp-bridge.d.ts +0 -13
- package/dist/types/integration/hpp-bridge.d.ts.map +0 -1
- package/dist/types/integration/zenpay-auto-patch.d.ts +0 -28
- package/dist/types/integration/zenpay-auto-patch.d.ts.map +0 -1
- package/dist/types/outcome.d.ts +0 -20
- package/dist/types/outcome.d.ts.map +0 -1
- package/dist/types/session.d.ts +0 -54
- package/dist/types/session.d.ts.map +0 -1
- package/dist/types/transport/callback-transport.d.ts +0 -17
- package/dist/types/transport/callback-transport.d.ts.map +0 -1
- package/dist/types/transport/http-transport.d.ts +0 -30
- package/dist/types/transport/http-transport.d.ts.map +0 -1
- package/dist/types/umd.d.ts +0 -16
- package/dist/types/umd.d.ts.map +0 -1
- package/dist/zp-observer.cjs +0 -1375
- package/dist/zp-observer.cjs.map +0 -7
- package/dist/zp-observer.js +0 -1377
- package/dist/zp-observer.js.map +0 -7
- package/dist/zp-observer.min.js +0 -2
- package/dist/zp-observer.min.js.map +0 -7
- package/dist/zp-observer.min.obf.js +0 -1
- package/dist/zp-observer.mjs +0 -1352
- package/dist/zp-observer.mjs.map +0 -7
package/dist/session.mjs.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/core/detection.ts", "../src/core/beacon.ts", "../src/core/experimental.ts", "../src/core/heartbeat.ts", "../src/core/lifecycle.ts", "../src/core/shortcode.ts", "../src/core/random.ts", "../src/core/event-bus.ts", "../src/core/outbox.ts", "../src/core/observer.ts", "../src/integration/zenpay-auto-patch.ts", "../src/integration/hpp-bridge.ts", "../src/session.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Iframe detection and removal tracking.\n *\n * The ZenPay hosted checkout injects an iframe into the parent DOM when\n * the user triggers a payment. We need to know:\n * 1. When the iframe appears (\u2192 \"open\" event)\n * 2. When the iframe is removed (\u2192 \"user.modal_closed\")\n *\n * Signals, in order of reliability:\n * - Poll + querySelector (primary; works for every plugin version)\n * - MutationObserver on body (cheap removal detection)\n * - Bootstrap `hidden.bs.modal` (only when plugin uses Bootstrap modals)\n */\n\nexport const DEFAULT_IFRAME_SELECTORS = [\n\t'iframe.zp-payment-frame',\n\t'iframe[src*=\"zenithpayments\"]',\n\t'iframe[src*=\"travelpay\"]',\n\t'.modal-payment iframe',\n\t'div.modal.show iframe',\n] as const;\n\ninterface DetectionHandle {\n\tstop(): void;\n}\n\ninterface DetectionHooks {\n\t/** Called once, when the iframe is first located. */\n\tonFound(iframe: HTMLIFrameElement): void;\n\t/** Called if the iframe is removed from the DOM after detection. */\n\tonRemoved(): void;\n\t/** Called if Bootstrap's `hidden.bs.modal` fires on a containing modal. */\n\tonBootstrapHidden(): void;\n\t/** Called if detection times out without finding an iframe. */\n\tonTimeout(): void;\n}\n\nexport function startDetection(\n\thooks: DetectionHooks,\n\topts: {\n\t\tselectors: readonly string[];\n\t\tintervalMs: number;\n\t\ttimeoutMs: number;\n\t},\n): DetectionHandle {\n\tif (typeof document === 'undefined') {\n\t\treturn { stop() {} };\n\t}\n\n\tlet stopped = false;\n\tlet pollTimer: ReturnType<typeof setInterval> | null = null;\n\tlet mutationObserver: MutationObserver | null = null;\n\tlet bootstrapHandler: ((e: Event) => void) | null = null;\n\tconst startedAt = Date.now();\n\n\tconst findIframe = (): HTMLIFrameElement | null => {\n\t\tfor (const selector of opts.selectors) {\n\t\t\tconst el = document.querySelector(selector);\n\t\t\tif (el instanceof HTMLIFrameElement) return el;\n\t\t}\n\t\treturn null;\n\t};\n\n\tconst stopPolling = () => {\n\t\tif (pollTimer !== null) {\n\t\t\tclearInterval(pollTimer);\n\t\t\tpollTimer = null;\n\t\t}\n\t};\n\n\tconst watchForRemoval = (iframe: HTMLIFrameElement) => {\n\t\tif (typeof MutationObserver === 'undefined' || !document.body) return;\n\n\t\tmutationObserver = new MutationObserver((mutations) => {\n\t\t\tfor (const m of mutations) {\n\t\t\t\tfor (const node of Array.from(m.removedNodes)) {\n\t\t\t\t\tif (node === iframe || (node instanceof Node && node.contains(iframe))) {\n\t\t\t\t\t\thooks.onRemoved();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tmutationObserver.observe(document.body, { childList: true, subtree: true });\n\t};\n\n\tconst watchBootstrapModal = () => {\n\t\t// ZenPay v3 wraps the iframe in a Bootstrap modal and fires\n\t\t// `hidden.bs.modal` on close. jQuery delegates bubble to document.\n\t\tif (typeof document.addEventListener !== 'function') return;\n\n\t\tbootstrapHandler = () => hooks.onBootstrapHidden();\n\n\t\t// Listen on document \u2014 Bootstrap events bubble there via jQuery.\n\t\tdocument.addEventListener('hidden.bs.modal' as 'click', bootstrapHandler, true);\n\t};\n\n\tconst onFound = (iframe: HTMLIFrameElement) => {\n\t\tstopPolling();\n\t\twatchForRemoval(iframe);\n\t\twatchBootstrapModal();\n\t\thooks.onFound(iframe);\n\t};\n\n\t// Immediate check in case the iframe is already present.\n\tconst existing = findIframe();\n\tif (existing) {\n\t\tqueueMicrotask(() => {\n\t\t\tif (!stopped) onFound(existing);\n\t\t});\n\t} else {\n\t\tpollTimer = setInterval(() => {\n\t\t\tif (stopped) return;\n\t\t\tif (Date.now() - startedAt > opts.timeoutMs) {\n\t\t\t\tstopPolling();\n\t\t\t\thooks.onTimeout();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst found = findIframe();\n\t\t\tif (found) onFound(found);\n\t\t}, opts.intervalMs);\n\t}\n\n\treturn {\n\t\tstop() {\n\t\t\tstopped = true;\n\t\t\tstopPolling();\n\t\t\tif (mutationObserver) {\n\t\t\t\tmutationObserver.disconnect();\n\t\t\t\tmutationObserver = null;\n\t\t\t}\n\t\t\tif (bootstrapHandler) {\n\t\t\t\tdocument.removeEventListener(\n\t\t\t\t\t'hidden.bs.modal' as 'click',\n\t\t\t\t\tbootstrapHandler,\n\t\t\t\t\ttrue,\n\t\t\t\t);\n\t\t\t\tbootstrapHandler = null;\n\t\t\t}\n\t\t},\n\t};\n}\n", "/**\n * Shared sendBeacon helper \u2014 fire-and-forget JSON POST.\n * Returns true if the beacon was queued, false otherwise.\n */\n\nconst JSON_TYPE = 'application/json';\n\nexport function postJsonBeacon(url: string, body: unknown): boolean {\n\tif (typeof navigator === 'undefined' || typeof navigator.sendBeacon !== 'function') {\n\t\treturn false;\n\t}\n\ttry {\n\t\tconst blob = new Blob([JSON.stringify(body)], { type: JSON_TYPE });\n\t\treturn navigator.sendBeacon(url, blob);\n\t} catch {\n\t\treturn false;\n\t}\n}\n", "/**\n * Opt-in browser instrumentation for lab / production A-B testing.\n * Each flag installs a narrow listener or one-shot read. Nothing here ends\n * the session \u2014 use onDiagnostic + optional beacon URL to see what fires.\n */\n\nimport type { DiagnosticEvent, ExperimentalOptions } from './types.js';\nimport { postJsonBeacon } from './beacon.js';\n\nexport function hasGlobalExperimentalFeatures(exp?: ExperimentalOptions): boolean {\n\tif (!exp) return false;\n\treturn !!(\n\t\texp.pageLifecycleBeaconUrl ||\n\t\texp.captureWasDiscarded ||\n\t\texp.capturePageShow ||\n\t\texp.captureWindowFocus ||\n\t\texp.captureVisibilityDetail ||\n\t\texp.captureFreezeResume ||\n\t\texp.capturePerformanceEntries\n\t);\n}\n\nexport function hasIframeExperimentalFeatures(exp?: ExperimentalOptions): boolean {\n\tif (!exp) return false;\n\treturn !!(exp.captureIframeResize || exp.captureIframeSrcChanges);\n}\n\nfunction logDiag(debug: boolean, ...args: unknown[]): void {\n\tif (debug && typeof console !== 'undefined') {\n\t\tconsole.log('[ZPObserver/experimental]', ...args);\n\t}\n}\n\nfunction captureUserActivation():\n| { hasBeenActive: boolean; isActive: boolean }\n\t| undefined {\n\ttry {\n\t\tconst ua = typeof navigator !== 'undefined' ? navigator.userActivation : undefined;\n\t\tif (!ua) return undefined;\n\t\treturn {\n\t\t\thasBeenActive: ua.hasBeenActive ?? false,\n\t\t\tisActive: ua.isActive ?? false,\n\t\t};\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nfunction readNavigationDetail(): {\n\twasDiscarded: boolean | null;\n\tredirectCount: number | null;\n\ttransferSize: number | null;\n\ttype: string | null;\n} | null {\n\ttry {\n\t\tconst entries = performance.getEntriesByType('navigation');\n\t\tconst nav = entries[0] as PerformanceNavigationTiming | undefined;\n\t\tif (!nav) return null;\n\t\tconst wasDiscarded =\n\t\t\t'wasDiscarded' in nav ? Boolean((nav as PerformanceNavigationTiming & { wasDiscarded?: boolean }).wasDiscarded) : null;\n\t\treturn {\n\t\t\twasDiscarded,\n\t\t\tredirectCount: nav.redirectCount ?? null,\n\t\t\ttransferSize: nav.transferSize ?? null,\n\t\t\ttype: nav.type ?? null,\n\t\t};\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nexport function readOpenExperimentalFields(\n\texp: ExperimentalOptions | undefined,\n): {\n\tuserActivation?: { hasBeenActive: boolean; isActive: boolean };\n\tnavigationDetail?: {\n\t\twasDiscarded: boolean | null;\n\t\tredirectCount: number | null;\n\t\ttransferSize: number | null;\n\t\ttype: string | null;\n\t};\n} {\n\tif (!exp) return {};\n\tconst out: {\n\t\tuserActivation?: { hasBeenActive: boolean; isActive: boolean };\n\t\tnavigationDetail?: {\n\t\t\twasDiscarded: boolean | null;\n\t\t\tredirectCount: number | null;\n\t\t\ttransferSize: number | null;\n\t\t\ttype: string | null;\n\t\t};\n\t} = {};\n\tif (exp.captureUserActivation) {\n\t\tconst ua = captureUserActivation();\n\t\tif (ua) out.userActivation = ua;\n\t}\n\tif (exp.captureNavigationTimingDetail) {\n\t\tconst nav = readNavigationDetail();\n\t\tif (nav) out.navigationDetail = nav;\n\t}\n\treturn out;\n}\n\ninterface ExperimentalRuntimeContext {\n\tsessionId: string;\n\texperimental: ExperimentalOptions;\n\tonDiagnostic: (e: DiagnosticEvent) => void;\n\tdebug: boolean;\n\tgetNavigationType: () => string | null;\n}\n\nexport function installGlobalExperimental(ctx: ExperimentalRuntimeContext): { stop(): void } {\n\tconst { experimental: exp, onDiagnostic, debug, sessionId, getNavigationType } = ctx;\n\tconst stops: Array<() => void> = [];\n\n\tconst beaconUrl = exp.pageLifecycleBeaconUrl;\n\tconst fireBeacon = (phase: 'navigation' | 'pageshow' | 'pagehide', extra: Record<string, unknown>) => {\n\t\tif (!beaconUrl) return;\n\t\tconst payload = { phase, sessionId, timestamp: Date.now(), ...extra };\n\t\tconst ok = postJsonBeacon(beaconUrl, payload);\n\t\tonDiagnostic({ kind: 'exp.page_lifecycle_beacon', phase, ok, timestamp: Date.now() });\n\t\tlogDiag(debug, 'pageLifecycleBeacon', phase, ok);\n\t};\n\n\tif (beaconUrl) {\n\t\tfireBeacon('navigation', { navType: getNavigationType() });\n\t}\n\n\tif (exp.captureWasDiscarded) {\n\t\tconst nav = readNavigationDetail();\n\t\tconst wasDiscarded = nav?.wasDiscarded ?? null;\n\t\tonDiagnostic({ kind: 'exp.was_discarded', wasDiscarded, timestamp: Date.now() });\n\t\tlogDiag(debug, 'wasDiscarded', wasDiscarded);\n\t}\n\n\tif ((exp.capturePageShow || beaconUrl) && typeof window !== 'undefined') {\n\t\tconst handler = (ev: PageTransitionEvent) => {\n\t\t\tconst persisted = ev.persisted === true;\n\t\t\tif (exp.capturePageShow) {\n\t\t\t\tonDiagnostic({\n\t\t\t\t\tkind: 'exp.pageshow',\n\t\t\t\t\tpersisted,\n\t\t\t\t\tnavigationType: getNavigationType(),\n\t\t\t\t\ttimestamp: Date.now(),\n\t\t\t\t});\n\t\t\t\tlogDiag(debug, 'pageshow', { persisted });\n\t\t\t}\n\t\t\tif (beaconUrl) fireBeacon('pageshow', { persisted });\n\t\t};\n\t\twindow.addEventListener('pageshow', handler, { passive: true });\n\t\tstops.push(() => window.removeEventListener('pageshow', handler));\n\t}\n\n\tif (beaconUrl && typeof window !== 'undefined') {\n\t\tconst ph = (ev: PageTransitionEvent) => {\n\t\t\tfireBeacon('pagehide', { persisted: ev.persisted === true });\n\t\t};\n\t\twindow.addEventListener('pagehide', ph, { passive: true });\n\t\tstops.push(() => window.removeEventListener('pagehide', ph));\n\t}\n\n\tif (exp.captureWindowFocus && typeof window !== 'undefined') {\n\t\tconst onF = () => {\n\t\t\tonDiagnostic({ kind: 'exp.window_focus', timestamp: Date.now() });\n\t\t\tlogDiag(debug, 'window focus');\n\t\t};\n\t\tconst onB = () => {\n\t\t\tonDiagnostic({ kind: 'exp.window_blur', timestamp: Date.now() });\n\t\t\tlogDiag(debug, 'window blur');\n\t\t};\n\t\twindow.addEventListener('focus', onF, { passive: true });\n\t\twindow.addEventListener('blur', onB, { passive: true });\n\t\tstops.push(() => {\n\t\t\twindow.removeEventListener('focus', onF);\n\t\t\twindow.removeEventListener('blur', onB);\n\t\t});\n\t}\n\n\tif (exp.captureVisibilityDetail && typeof document !== 'undefined') {\n\t\tlet lastState = document.visibilityState ?? 'visible';\n\t\tlet lastChangeAt = Date.now();\n\t\tconst handler = () => {\n\t\t\tconst now = Date.now();\n\t\t\tconst curr = document.visibilityState ?? 'visible';\n\t\t\tconst prev = lastState;\n\t\t\tlastState = curr;\n\t\t\tconst deltaMs = now - lastChangeAt;\n\t\t\tlastChangeAt = now;\n\t\t\tconst hasFocus =\n\t\t\t\ttypeof document.hasFocus === 'function' ? document.hasFocus() : null;\n\t\t\tconst onLine =\n\t\t\t\ttypeof navigator !== 'undefined' && typeof navigator.onLine === 'boolean'\n\t\t\t\t\t? navigator.onLine\n\t\t\t\t\t: null;\n\t\t\tonDiagnostic({\n\t\t\t\tkind: 'exp.visibility_detail',\n\t\t\t\tprevState: prev,\n\t\t\t\tcurrState: curr,\n\t\t\t\tprevStateDurationMs: deltaMs,\n\t\t\t\thasFocus,\n\t\t\t\tonLine,\n\t\t\t\ttimestamp: now,\n\t\t\t});\n\t\t\tlogDiag(debug, 'visibility_detail', { prev, curr, hasFocus, onLine });\n\t\t};\n\t\tdocument.addEventListener('visibilitychange', handler, { passive: true });\n\t\tstops.push(() => document.removeEventListener('visibilitychange', handler));\n\t}\n\n\tif (exp.captureFreezeResume && typeof document !== 'undefined') {\n\t\tconst onFreeze = () => {\n\t\t\tonDiagnostic({ kind: 'exp.freeze', timestamp: Date.now() });\n\t\t\tlogDiag(debug, 'freeze');\n\t\t};\n\t\tconst onResume = () => {\n\t\t\tonDiagnostic({ kind: 'exp.resume', timestamp: Date.now() });\n\t\t\tlogDiag(debug, 'resume');\n\t\t};\n\t\ttry {\n\t\t\tdocument.addEventListener('freeze', onFreeze, { passive: true });\n\t\t\tdocument.addEventListener('resume', onResume, { passive: true });\n\t\t\tstops.push(() => {\n\t\t\t\tdocument.removeEventListener('freeze', onFreeze);\n\t\t\t\tdocument.removeEventListener('resume', onResume);\n\t\t\t});\n\t\t} catch {\n\t\t\tlogDiag(debug, 'freeze/resume not supported');\n\t\t}\n\t}\n\n\tif (exp.capturePerformanceEntries && typeof PerformanceObserver !== 'undefined') {\n\t\tconst types = exp.perfEntryTypes ?? ['longtask', 'largest-contentful-paint'];\n\t\tconst emitPerf = (entry: PerformanceEntry) => {\n\t\t\tif (entry.entryType === 'longtask') {\n\t\t\t\tonDiagnostic({\n\t\t\t\t\tkind: 'exp.perf_entry',\n\t\t\t\t\tentryType: entry.entryType,\n\t\t\t\t\tname: entry.name,\n\t\t\t\t\tstartTime: entry.startTime,\n\t\t\t\t\tduration: entry.duration,\n\t\t\t\t\ttimestamp: Date.now(),\n\t\t\t\t});\n\t\t\t} else if (entry.entryType === 'largest-contentful-paint') {\n\t\t\tconst lcp = entry as PerformanceEntry & { size?: number; url?: string };\n\t\t\tonDiagnostic({\n\t\t\t\tkind: 'exp.perf_entry',\n\t\t\t\tentryType: entry.entryType,\n\t\t\t\tname: entry.name,\n\t\t\t\tstartTime: entry.startTime,\n\t\t\t\t...(lcp.size !== undefined && { size: lcp.size }),\n\t\t\t\t...(lcp.url !== undefined && { url: lcp.url }),\n\t\t\t\ttimestamp: Date.now(),\n\t\t\t});\n\t\t\t} else {\n\t\t\t\tonDiagnostic({\n\t\t\t\t\tkind: 'exp.perf_entry',\n\t\t\t\t\tentryType: entry.entryType,\n\t\t\t\t\tname: entry.name,\n\t\t\t\t\tstartTime: entry.startTime,\n\t\t\t\t\ttimestamp: Date.now(),\n\t\t\t\t});\n\t\t\t}\n\t\t\tlogDiag(debug, 'perf', entry.entryType, entry.name);\n\t\t};\n\t\tfor (const t of types) {\n\t\t\ttry {\n\t\t\t\tconst obs = new PerformanceObserver((list) => {\n\t\t\t\t\tfor (const entry of list.getEntries()) emitPerf(entry);\n\t\t\t\t});\n\t\t\t\ttry {\n\t\t\t\t\tobs.observe({ type: t, buffered: true });\n\t\t\t\t} catch {\n\t\t\t\t\tobs.observe({ entryTypes: [t] });\n\t\t\t\t}\n\t\t\t\tstops.push(() => obs.disconnect());\n\t\t\t} catch (err) {\n\t\t\t\tlogDiag(debug, 'PerformanceObserver failed for', t, err);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn {\n\t\tstop() {\n\t\t\tfor (const s of stops) s();\n\t\t},\n\t};\n}\n\nexport function installIframeExperimental(\n\tiframe: HTMLIFrameElement,\n\tctx: ExperimentalRuntimeContext,\n): { stop(): void } {\n\tconst { experimental: exp, onDiagnostic, debug } = ctx;\n\tconst stops: Array<() => void> = [];\n\n\tif (exp.captureIframeResize && typeof ResizeObserver !== 'undefined') {\n\t\tconst ro = new ResizeObserver((entries) => {\n\t\t\tconst e = entries[entries.length - 1];\n\t\t\tif (!e) return;\n\t\t\tconst { width, height } = e.contentRect;\n\t\t\tonDiagnostic({\n\t\t\t\tkind: 'exp.iframe_resize',\n\t\t\t\twidth: Math.round(width),\n\t\t\t\theight: Math.round(height),\n\t\t\t\ttimestamp: Date.now(),\n\t\t\t});\n\t\t\tlogDiag(debug, 'iframe_resize', width, height);\n\t\t});\n\t\tro.observe(iframe);\n\t\tstops.push(() => ro.disconnect());\n\t}\n\n\tif (exp.captureIframeSrcChanges && typeof MutationObserver !== 'undefined') {\n\t\tlet prev = iframe.src || null;\n\t\tconst mo = new MutationObserver(() => {\n\t\t\tconst cur = iframe.src || '';\n\t\t\tif (cur !== prev) {\n\t\t\t\tonDiagnostic({\n\t\t\t\t\tkind: 'exp.iframe_src',\n\t\t\t\t\tpreviousSrc: prev,\n\t\t\t\t\tcurrentSrc: cur,\n\t\t\t\t\ttimestamp: Date.now(),\n\t\t\t\t});\n\t\t\t\tlogDiag(debug, 'iframe_src', prev, cur);\n\t\t\t\tprev = cur || null;\n\t\t\t}\n\t\t});\n\t\tmo.observe(iframe, { attributes: true, attributeFilter: ['src'] });\n\t\tstops.push(() => mo.disconnect());\n\t}\n\n\treturn {\n\t\tstop() {\n\t\t\tfor (const s of stops) s();\n\t\t},\n\t};\n}\n", "/**\n * Application-level heartbeat.\n *\n * Browsers expose no ping/pong control frames to JS, so we run our own.\n * The heartbeat goes through the event bus so `beforeSend` is applied\n * centrally. The transport handles the actual send.\n *\n * Mirrors the 2025-10-27 bugfix in the v1.2 experimental observer: a failed\n * response increments `missedBeats`; threshold breach triggers abandonment.\n */\n\nimport type { HeartbeatEvent, ObserverEvent } from './types.js';\n\ninterface HeartbeatHooks {\n\tonTick(sequence: number, missedBeats: number): void;\n\tonAbandoned(missedBeats: number): void;\n}\n\nexport interface HeartbeatHandle {\n\tstop(): void;\n\theartbeatCount(): number;\n\tmissedBeats(): number;\n}\n\ninterface HeartbeatSender {\n\tsendHeartbeat(event: ObserverEvent): Promise<{ ok: boolean; status?: number }>;\n}\n\nexport function startHeartbeat(\n\tsessionId: string,\n\tcorrelationId: string,\n\tgetMetadata: () => Record<string, unknown>,\n\tsender: HeartbeatSender,\n\thooks: HeartbeatHooks,\n\topts: {\n\t\tintervalMs: number;\n\t\tmissThreshold: number;\n\t},\n): HeartbeatHandle {\n\tlet sequence = 0;\n\tlet missed = 0;\n\tlet abandoned = false;\n\tlet timer: ReturnType<typeof setInterval> | null = null;\n\n\tconst tick = () => {\n\t\tif (abandoned) return;\n\t\tsequence += 1;\n\n\t\tconst ev: HeartbeatEvent = {\n\t\t\tkind: 'heartbeat',\n\t\t\tsessionId,\n\t\t\tcorrelationId,\n\t\t\ttimestamp: Date.now(),\n\t\t\tsequence,\n\t\t\tmissedBeats: missed,\n\t\t\tmetadata: getMetadata(),\n\t\t};\n\n\t\tvoid sender.sendHeartbeat(ev).then((result) => {\n\t\t\tif (result.ok) {\n\t\t\t\tmissed = 0;\n\t\t\t} else {\n\t\t\t\tmissed += 1;\n\t\t\t\tif (missed >= opts.missThreshold && !abandoned) {\n\t\t\t\t\tabandoned = true;\n\t\t\t\t\thooks.onAbandoned(missed);\n\t\t\t\t}\n\t\t\t}\n\t\t\thooks.onTick(sequence, missed);\n\t\t}).catch(() => {\n\t\t\tmissed += 1;\n\t\t\tif (missed >= opts.missThreshold && !abandoned) {\n\t\t\t\tabandoned = true;\n\t\t\t\thooks.onAbandoned(missed);\n\t\t\t}\n\t\t\thooks.onTick(sequence, missed);\n\t\t});\n\t};\n\n\ttimer = setInterval(tick, opts.intervalMs);\n\n\treturn {\n\t\tstop() {\n\t\t\tabandoned = true;\n\t\t\tif (timer !== null) {\n\t\t\t\tclearInterval(timer);\n\t\t\t\ttimer = null;\n\t\t\t}\n\t\t},\n\t\theartbeatCount: () => sequence,\n\t\tmissedBeats: () => missed,\n\t};\n}\n", "/**\n * Page lifecycle signals.\n *\n * Per the browser-lifecycle handbook:\n * - `visibilitychange` is the primary signal for \"user left active view\".\n * - `pagehide` is the fallback for dismissal + bfcache, with `event.persisted`.\n * - `unload` is unreliable and deliberately not used.\n * - `navigator.onLine` is a UX hint only, not used for correctness.\n */\n\ninterface LifecycleHooks {\n\t/** visibilityState transitioned to \"hidden\". */\n\tonHidden(): void;\n\t/** visibilityState transitioned back to \"visible\". */\n\tonVisible(): void;\n\t/** pagehide fired. `persisted` means the page is in bfcache. */\n\tonPageHide(persisted: boolean): void;\n}\n\ninterface LifecycleHandle {\n\tstop(): void;\n}\n\nexport function installPageLifecycle(hooks: LifecycleHooks): LifecycleHandle {\n\tif (typeof document === 'undefined' || typeof window === 'undefined') {\n\t\treturn { stop() {} };\n\t}\n\n\tconst visibilityHandler = () => {\n\t\tif (document.visibilityState === 'hidden') hooks.onHidden();\n\t\telse if (document.visibilityState === 'visible') hooks.onVisible();\n\t};\n\n\tconst pageHideHandler = (event: Event) => {\n\t\tconst persisted = (event as PageTransitionEvent).persisted === true;\n\t\thooks.onPageHide(persisted);\n\t};\n\n\tdocument.addEventListener('visibilitychange', visibilityHandler);\n\twindow.addEventListener('pagehide', pageHideHandler);\n\n\treturn {\n\t\tstop() {\n\t\t\tdocument.removeEventListener('visibilitychange', visibilityHandler);\n\t\t\twindow.removeEventListener('pagehide', pageHideHandler);\n\t\t},\n\t};\n}\n\n/**\n * Attach an IntersectionObserver to the iframe so we know if it is actually\n * on-screen (not just in the DOM). Useful when a merchant page scrolls the\n * modal out of view but leaves it mounted.\n */\nexport function observeIframeVisibility(\n\tiframe: HTMLIFrameElement,\n\tonChange: (visible: boolean) => void,\n): { stop(): void } {\n\tif (typeof IntersectionObserver === 'undefined') {\n\t\treturn { stop() {} };\n\t}\n\n\tconst io = new IntersectionObserver(\n\t\t(entries) => {\n\t\t\tconst entry = entries[entries.length - 1];\n\t\t\tif (entry) onChange(entry.isIntersecting);\n\t\t},\n\t\t{ threshold: 0.01 },\n\t);\n\tio.observe(iframe);\n\n\treturn {\n\t\tstop() {\n\t\t\tio.disconnect();\n\t\t},\n\t};\n}\n", "/**\n * Shortcode pattern \u2014 WAF-safe callback passing to ZenPay.\n *\n * Problem: passing a function object to ZenPay's `onPluginClose` causes the\n * function source to appear in URL query strings, which trips WAFs.\n *\n * Solution: register the callback as a global under a unique name and pass\n * the STRING \"window.zpcb_xxx\" instead. ZenPay invokes `window[name]()` which\n * resolves at runtime but never leaks code into the URL.\n */\n\nconst PREFIX = 'zpcb_';\n\n/** Build a unique, WAF-safe global name. Uses crypto when available. */\nexport function generateShortcodeName(): string {\n\tconst ts = Date.now().toString(36);\n\n\tif (typeof crypto !== 'undefined' && typeof crypto.getRandomValues === 'function') {\n\t\tconst buf = new Uint32Array(2);\n\t\tcrypto.getRandomValues(buf);\n\t\treturn `${PREFIX}${ts}_${buf[0]!.toString(36)}${buf[1]!.toString(36)}`;\n\t}\n\n\tconst rand = Math.floor(Math.random() * 0xffffffff).toString(36);\n\treturn `${PREFIX}${ts}_${rand}`;\n}\n\n/** Register `fn` as `window[name]`. Returns the string to pass to ZenPay. */\nexport function registerShortcode(name: string, fn: () => void): string {\n\tif (typeof window !== 'undefined') {\n\t\t(window as unknown as Record<string, unknown>)[name] = fn;\n\t}\n\treturn `window.${name}`;\n}\n\n/** Remove a previously registered shortcode. Safe to call twice. */\nexport function unregisterShortcode(name: string): void {\n\tif (typeof window !== 'undefined') {\n\t\ttry {\n\t\t\tdelete (window as unknown as Record<string, unknown>)[name];\n\t\t} catch {\n\t\t\t(window as unknown as Record<string, unknown>)[name] = undefined;\n\t\t}\n\t}\n}\n", "/**\n * Shared random helpers \u2014 UUID generation for correlation IDs.\n *\n * Uses `crypto.randomUUID()` when available (all modern browsers, Node 19+),\n * with a `Math.random` fallback for older environments.\n */\n\nfunction fallbackUUID(): string {\n\t// RFC 4122 version 4 UUID via Math.random\n\tconst hex = '0123456789abcdef';\n\tconst template = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';\n\tlet result = '';\n\tfor (const ch of template) {\n\t\tif (ch === '-') {\n\t\t\tresult += '-';\n\t\t} else if (ch === '4') {\n\t\t\tresult += '4';\n\t\t} else if (ch === 'y') {\n\t\t\tresult += hex[(Math.random() * 16) | 0]!;\n\t\t} else {\n\t\t\tresult += hex[(Math.random() * 16) | 0]!;\n\t\t}\n\t}\n\treturn result;\n}\n\nexport function generateUUID(): string {\n\tif (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {\n\t\treturn crypto.randomUUID();\n\t}\n\treturn fallbackUUID();\n}\n", "/**\n * Typed event bus \u2014 the dispatch layer between `observer.emit()` and `Transport.send()`.\n *\n * Responsibilities:\n * 1. Run every event through `beforeSend` (drop / mutate).\n * 2. Optionally persist non-heartbeat events to an outbox before sending.\n * 3. Delegate to `Transport.send()` and handle the result.\n * 4. Count missed beats for heartbeat events (delegated from the heartbeat timer).\n */\n\nimport type { ObserverEvent, Transport, TransportResult } from './types.js';\nimport type { Outbox } from './outbox.js';\n\nexport interface EventBus {\n\t/** Push a domain event onto the bus. Fire-and-forget from the caller's POV. */\n\temit(event: ObserverEvent): void;\n\n\t/** Send a heartbeat and return the transport result (used by the heartbeat timer). */\n\tsendHeartbeat(event: ObserverEvent): Promise<TransportResult>;\n\n\t/** Drain persisted events for a given session. */\n\tdrain(sessionId: string): void;\n}\n\nexport function createEventBus(\n\ttransport: Transport,\n\tbeforeSend: ((event: ObserverEvent) => ObserverEvent | null) | undefined,\n\toutbox: Outbox | null,\n): EventBus {\n\tfunction applyBeforeSend(ev: ObserverEvent): ObserverEvent | null {\n\t\tif (!beforeSend) return ev;\n\t\ttry {\n\t\t\treturn beforeSend(ev);\n\t\t} catch {\n\t\t\treturn ev;\n\t\t}\n\t}\n\n\tfunction sendViaTransport(ev: ObserverEvent): Promise<TransportResult> {\n\t\treturn transport.send(ev).catch(() => ({ ok: false }));\n\t}\n\n\tconst bus: EventBus = {\n\t\temit(ev) {\n\t\t\tconst filtered = applyBeforeSend(ev);\n\t\t\tif (!filtered) return;\n\n\t\t\tif (outbox && ev.kind !== 'heartbeat') {\n\t\t\t\toutbox.push(filtered);\n\t\t\t}\n\n\t\t\t// Fire-and-forget for non-heartbeat events.\n\t\t\tvoid sendViaTransport(filtered).then((result) => {\n\t\t\t\tif (result.ok && outbox && ev.kind !== 'heartbeat') {\n\t\t\t\t\toutbox.remove(filtered);\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\n\t\tasync sendHeartbeat(ev) {\n\t\t\tconst filtered = applyBeforeSend(ev);\n\t\t\tif (!filtered) return { ok: true };\n\n\t\t\tconst result = await sendViaTransport(filtered);\n\t\t\treturn result;\n\t\t},\n\n\t\tdrain(sessionId) {\n\t\t\tif (!outbox) return;\n\t\t\tconst pending = outbox.drain(sessionId);\n\t\t\tfor (const ev of pending) {\n\t\t\t\tvoid sendViaTransport(ev).then((result) => {\n\t\t\t\t\tif (result.ok) outbox.remove(ev);\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t};\n\n\treturn bus;\n}\n", "/**\n * localStorage outbox for at-least-once delivery of non-heartbeat events.\n *\n * When `persistence: 'localStorage'` is set, every non-heartbeat event is\n * written to a ring buffer before sending. On successful send, the entry is\n * removed. On next `start()`, pending entries for the matching sessionId are\n * drained and re-sent.\n *\n * Caps at 64 entries to bound storage. If localStorage is unavailable (private\n * mode, quota exceeded), surfaces `system.persistence_unavailable` via the\n * `onUnavailable` callback so the integrator can downgrade to `'memory'`.\n */\n\nimport type { ObserverEvent } from './types.js';\n\nconst STORAGE_KEY = '__zpobs_outbox_v1';\nconst MAX_ENTRIES = 64;\n\ninterface OutboxEntry {\n\tsessionId: string;\n\tcorrelationId: string;\n\tevent: ObserverEvent;\n}\n\nexport interface Outbox {\n\tpush(event: ObserverEvent): void;\n\tremove(event: ObserverEvent): void;\n\tdrain(sessionId: string): ObserverEvent[];\n}\n\nexport function createOutbox(\n\tonUnavailable: (error: string) => void,\n): Outbox | null {\n\tif (typeof localStorage === 'undefined') {\n\t\treturn null;\n\t}\n\n\tfunction readAll(): OutboxEntry[] {\n\t\ttry {\n\t\t\tconst raw = localStorage.getItem(STORAGE_KEY);\n\t\t\tif (!raw) return [];\n\t\t\tconst parsed: unknown = JSON.parse(raw);\n\t\t\tif (!Array.isArray(parsed)) return [];\n\t\t\treturn parsed as OutboxEntry[];\n\t\t} catch {\n\t\t\tonUnavailable('Failed to read outbox from localStorage');\n\t\t\treturn [];\n\t\t}\n\t}\n\n\tfunction writeAll(entries: OutboxEntry[]): boolean {\n\t\ttry {\n\t\t\tconst trimmed = entries.slice(-MAX_ENTRIES);\n\t\t\tlocalStorage.setItem(STORAGE_KEY, JSON.stringify(trimmed));\n\t\t\treturn true;\n\t\t} catch (err) {\n\t\t\tonUnavailable(\n\t\t\t\terr instanceof Error ? err.message : 'localStorage write failed (quota or private mode)',\n\t\t\t);\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn {\n\t\tpush(event) {\n\t\t\tconst entries = readAll();\n\t\t\tentries.push({ sessionId: event.sessionId, correlationId: event.correlationId, event });\n\t\t\twriteAll(entries);\n\t\t},\n\n\t\tremove(event) {\n\t\t\tconst entries = readAll();\n\t\t\tconst filtered = entries.filter(\n\t\t\t\t(e) =>\n\t\t\t\t\t!(e.event.kind === event.kind &&\n\t\t\t\t\t\te.event.timestamp === event.timestamp &&\n\t\t\t\t\t\te.event.sessionId === event.sessionId),\n\t\t\t);\n\t\t\twriteAll(filtered);\n\t\t},\n\n\t\tdrain(targetSessionId) {\n\t\t\tconst entries = readAll();\n\t\t\tconst match = entries.filter((e) => e.sessionId === targetSessionId);\n\t\t\tconst rest = entries.filter((e) => e.sessionId !== targetSessionId);\n\t\t\twriteAll(rest);\n\t\t\treturn match.map((e) => e.event);\n\t\t},\n\t};\n}\n", "/**\n * createObserver \u2014 the public factory (v6).\n *\n * Wires detection + lifecycle + heartbeat + shortcode + event bus + outbox\n * against a Transport. The only concrete behaviour here is orchestration;\n * every external side effect is delegated.\n */\n\nimport { startDetection, DEFAULT_IFRAME_SELECTORS } from './detection.js';\nimport {\n\thasGlobalExperimentalFeatures,\n\thasIframeExperimentalFeatures,\n\tinstallGlobalExperimental,\n\tinstallIframeExperimental,\n\treadOpenExperimentalFields,\n} from './experimental.js';\nimport { startHeartbeat, type HeartbeatHandle } from './heartbeat.js';\nimport { installPageLifecycle, observeIframeVisibility } from './lifecycle.js';\nimport {\n\tgenerateShortcodeName,\n\tregisterShortcode,\n\tunregisterShortcode,\n} from './shortcode.js';\nimport { generateUUID } from './random.js';\nimport { createEventBus, type EventBus } from './event-bus.js';\nimport { createOutbox } from './outbox.js';\nimport type {\n\tCloseEvent,\n\tCloseReason,\n\tCreateObserverOptions,\n\tDiagnosticDump,\n\tDiagnosticEvent,\n\tExperimentalOptions,\n\tObserver,\n\tObserverDiagnostics,\n\tObserverEvent,\n\tObserverState,\n\tOpenEvent,\n\tTransportState,\n\tUIState,\n} from './types.js';\n\nfunction getNavigationType(): string | null {\n\ttry {\n\t\tconst entries = performance.getEntriesByType('navigation');\n\t\tconst entry = entries[0] as PerformanceNavigationTiming | undefined;\n\t\treturn entry?.type ?? null;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nfunction logDebug(enabled: boolean, ...args: unknown[]): void {\n\tif (enabled && typeof console !== 'undefined') {\n\t\tconsole.log('[ZPObserver]', ...args);\n\t}\n}\n\nexport function createObserver(options: CreateObserverOptions): Observer {\n\tif (!options || typeof options !== 'object') {\n\t\tthrow new Error('[ZPObserver] createObserver(options) requires an options object');\n\t}\n\tif (!options.sessionId || typeof options.sessionId !== 'string') {\n\t\tthrow new Error('[ZPObserver] options.sessionId is required');\n\t}\n\tif (!options.transport) {\n\t\tthrow new Error('[ZPObserver] options.transport is required');\n\t}\n\n\tconst sessionId = options.sessionId;\n\tconst correlationId = options.correlationId ?? generateUUID();\n\tconst transport = options.transport;\n\tconst metadata = options.metadata ?? {};\n\tconst beforeSend = options.beforeSend;\n\tconst heartbeatMs = options.heartbeatMs ?? 5000;\n\tconst missThreshold = options.heartbeatMissThreshold ?? 3;\n\tconst idleTimeoutMs = options.idleTimeoutMs ?? 15 * 60 * 1000;\n\tconst detectionIntervalMs = options.detectionIntervalMs ?? 100;\n\tconst detectionTimeoutMs = options.detectionTimeoutMs ?? 30_000;\n\tconst iframeSelectors = options.iframeSelectors ?? Array.from(DEFAULT_IFRAME_SELECTORS);\n\tconst debug = options.debug === true;\n\tconst experimental: ExperimentalOptions | undefined = options.experimental;\n\tconst diagMax = experimental?.diagnosticsMax ?? 50;\n\tconst diagnosticsBuffer: DiagnosticEvent[] = [];\n\tconst recentEvents: ObserverEvent[] = [];\n\tconst eventsMax = 50;\n\n\t// State\n\tlet uiState: UIState = 'IDLE';\n\tlet transportState: TransportState = 'CONNECTED';\n\tlet isActive = false;\n\tlet startedAtMs = 0;\n\tlet iframeEl: HTMLIFrameElement | null = null;\n\tlet closed = false;\n\n\t// Handles\n\tlet detectionHandle: { stop(): void } | null = null;\n\tlet lifecycleHandle: { stop(): void } | null = null;\n\tlet visibilityHandle: { stop(): void } | null = null;\n\tlet heartbeat: HeartbeatHandle | null = null;\n\tlet idleTimer: ReturnType<typeof setTimeout> | null = null;\n\tlet experimentalGlobalHandle: { stop(): void } | null = null;\n\tlet experimentalIframeHandle: { stop(): void } | null = null;\n\n\t// Shortcode\n\tconst shortcodeName = generateShortcodeName();\n\tconst shortcode = registerShortcode(shortcodeName, () => {\n\t\tlogDebug(debug, `shortcode invoked: ${shortcodeName}`);\n\t\tstop('user.callback_invoked');\n\t});\n\n\tconst emitDiagnostic = (e: DiagnosticEvent) => {\n\t\tdiagnosticsBuffer.push(e);\n\t\twhile (diagnosticsBuffer.length > diagMax) diagnosticsBuffer.shift();\n\t\toptions.onDiagnostic?.(e);\n\t\tlogDebug(debug, 'diagnostic', e);\n\t};\n\n\t// Outbox\n\tconst outbox = options.persistence === 'localStorage'\n\t\t? createOutbox((error: string) => {\n\t\t\temitDiagnostic({ kind: 'system.persistence_unavailable', error, timestamp: Date.now() });\n\t\t})\n\t\t: null;\n\n\t// Event bus (centralizes beforeSend + transport.send + outbox)\n\tconst bus: EventBus = createEventBus(transport, beforeSend, outbox);\n\n\tconst trackEvent = (ev: ObserverEvent) => {\n\t\trecentEvents.push(ev);\n\t\twhile (recentEvents.length > eventsMax) recentEvents.shift();\n\t};\n\n\t// Public emit \u2014 all events route through the bus.\n\tconst emit = (event: ObserverEvent) => {\n\t\ttrackEvent(event);\n\t\tbus.emit(event);\n\t};\n\n\tconst getMetadata = (): Record<string, unknown> => {\n\t\tconst base: Record<string, unknown> = { ...metadata };\n\t\tif (experimental?.attachDiagnosticsToHeartbeat) {\n\t\t\tbase.zpObserverDiagnostics = diagnosticsBuffer.slice();\n\t\t}\n\t\treturn base;\n\t};\n\n\tconst resetIdleTimer = () => {\n\t\tif (idleTimeoutMs <= 0) return;\n\t\tif (idleTimer !== null) clearTimeout(idleTimer);\n\t\tidleTimer = setTimeout(() => {\n\t\t\tlogDebug(debug, 'idle timeout reached');\n\t\t\tstop('system.idle_timeout');\n\t\t}, idleTimeoutMs);\n\t};\n\n\tconst sendOpen = (iframe: HTMLIFrameElement) => {\n\t\tconst openExtras = readOpenExperimentalFields(experimental);\n\t\tconst ev: OpenEvent = {\n\t\t\tkind: 'open',\n\t\t\tsessionId,\n\t\t\tcorrelationId,\n\t\t\ttimestamp: Date.now(),\n\t\t\tiframeSrc: iframe.src || null,\n\t\t\tuserAgent: typeof navigator !== 'undefined' ? navigator.userAgent : '',\n\t\t\tscreenWidth: typeof screen !== 'undefined' ? screen.width : 0,\n\t\t\tscreenHeight: typeof screen !== 'undefined' ? screen.height : 0,\n\t\t\tnavigationType: getNavigationType(),\n\t\t\tmetadata: getMetadata(),\n\t\t\t...openExtras,\n\t\t};\n\n\t\temit(ev);\n\t};\n\n\tconst sendClose = (reason: CloseReason, wasPersisted: boolean | null) => {\n\t\tconst hbCount = heartbeat?.heartbeatCount() ?? 0;\n\t\tconst missed = heartbeat?.missedBeats() ?? 0;\n\n\t\tconst ev: CloseEvent = {\n\t\t\tkind: 'close',\n\t\t\tsessionId,\n\t\t\tcorrelationId,\n\t\t\ttimestamp: Date.now(),\n\t\t\treason,\n\t\t\telapsedMs: startedAtMs ? Date.now() - startedAtMs : 0,\n\t\t\theartbeatCount: hbCount,\n\t\t\tmissedBeats: missed,\n\t\t\twasPersisted,\n\t\t\tmetadata: getMetadata(),\n\t\t};\n\n\t\temit(ev);\n\t};\n\n\t// Public: start\n\tconst start = () => {\n\t\tif (isActive) {\n\t\t\tlogDebug(debug, 'start() called while already active \u2014 ignoring');\n\t\t\treturn;\n\t\t}\n\t\tisActive = true;\n\t\tclosed = false;\n\t\tstartedAtMs = Date.now();\n\t\tuiState = 'DETECTING';\n\n\t\t// Drain persisted outbox for this session before sending live events.\n\t\tbus.drain(sessionId);\n\n\t\t// Emit session_init as the first domain event.\n\t\temit({\n\t\t\tkind: 'payment.session_init',\n\t\t\tsessionId,\n\t\t\tcorrelationId,\n\t\t\ttimestamp: Date.now(),\n\t\t\tmetadata: getMetadata(),\n\t\t});\n\n\t\tif (hasGlobalExperimentalFeatures(experimental) && experimental) {\n\t\t\texperimentalGlobalHandle = installGlobalExperimental({\n\t\t\t\tsessionId,\n\t\t\t\texperimental,\n\t\t\t\tonDiagnostic: emitDiagnostic,\n\t\t\t\tdebug,\n\t\t\t\tgetNavigationType,\n\t\t\t});\n\t\t}\n\n\t\tlifecycleHandle = installPageLifecycle({\n\t\t\tonHidden: () => {\n\t\t\t\tif (uiState === 'ACTIVE_MODAL_VISIBLE') uiState = 'BACKGROUND_HIDDEN';\n\t\t\t},\n\t\t\tonVisible: () => {\n\t\t\t\tif (uiState === 'BACKGROUND_HIDDEN') uiState = 'ACTIVE_MODAL_VISIBLE';\n\t\t\t},\n\t\t\tonPageHide: (persisted) => {\n\t\t\t\tif (!closed) stopInternal('page.pagehide', persisted);\n\t\t\t},\n\t\t});\n\n\t\tdetectionHandle = startDetection(\n\t\t\t{\n\t\t\t\tonFound: (iframe) => {\n\t\t\t\t\tiframeEl = iframe;\n\t\t\t\t\tuiState = 'ACTIVE_MODAL_VISIBLE';\n\t\t\t\t\tlogDebug(debug, 'iframe detected:', iframe.src);\n\n\t\t\t\t\tsendOpen(iframe);\n\n\t\t\t\t\theartbeat = startHeartbeat(\n\t\t\t\t\t\tsessionId,\n\t\t\t\t\t\tcorrelationId,\n\t\t\t\t\t\tgetMetadata,\n\t\t\t\t\t\tbus,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tonTick: (_seq, missed) => {\n\t\t\t\t\t\t\t\ttransportState =\n\t\t\t\t\t\t\t\t\tmissed === 0\n\t\t\t\t\t\t\t\t\t\t? 'CONNECTED'\n\t\t\t\t\t\t\t\t\t\t: missed < missThreshold\n\t\t\t\t\t\t\t\t\t\t\t? 'HEARTBEAT_LATE'\n\t\t\t\t\t\t\t\t\t\t\t: 'DISCONNECTED';\n\t\t\t\t\t\t\t\tif (missed === 0) resetIdleTimer();\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tonAbandoned: () => {\n\t\t\t\t\t\t\t\ttransportState = 'DISCONNECTED';\n\t\t\t\t\t\t\t\tif (!closed) stop('system.network_abandoned');\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{ intervalMs: heartbeatMs, missThreshold },\n\t\t\t\t\t);\n\n\t\t\t\t\tvisibilityHandle = observeIframeVisibility(iframe, (visible) => {\n\t\t\t\t\t\tlogDebug(debug, 'iframe visibility:', visible);\n\t\t\t\t\t});\n\n\t\t\t\t\tif (hasIframeExperimentalFeatures(experimental) && experimental) {\n\t\t\t\t\t\texperimentalIframeHandle = installIframeExperimental(iframe, {\n\t\t\t\t\t\t\tsessionId,\n\t\t\t\t\t\t\texperimental,\n\t\t\t\t\t\t\tonDiagnostic: emitDiagnostic,\n\t\t\t\t\t\t\tdebug,\n\t\t\t\t\t\t\tgetNavigationType,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\tresetIdleTimer();\n\t\t\t\t},\n\t\t\t\tonRemoved: () => {\n\t\t\t\t\tif (!closed) stop('user.modal_closed');\n\t\t\t\t},\n\t\t\t\tonBootstrapHidden: () => {\n\t\t\t\t\tif (!closed) stop('user.modal_closed');\n\t\t\t\t},\n\t\t\t\tonTimeout: () => {\n\t\t\t\t\tlogDebug(debug, 'detection timeout \u2014 no iframe found');\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tselectors: iframeSelectors,\n\t\t\t\tintervalMs: detectionIntervalMs,\n\t\t\t\ttimeoutMs: detectionTimeoutMs,\n\t\t\t},\n\t\t);\n\n\t\tlogDebug(debug, `started session ${sessionId}, correlationId=${correlationId}, shortcode=${shortcode}`);\n\t};\n\n\tconst stopInternal = (reason: CloseReason, wasPersisted: boolean | null) => {\n\t\tif (closed) return;\n\t\tclosed = true;\n\t\tisActive = false;\n\t\tuiState = 'DISMISSED';\n\n\t\tlogDebug(debug, `stopping: ${reason}`);\n\n\t\tif (detectionHandle) {\n\t\t\tdetectionHandle.stop();\n\t\t\tdetectionHandle = null;\n\t\t}\n\t\tif (heartbeat) {\n\t\t\theartbeat.stop();\n\t\t\theartbeat = null;\n\t\t}\n\t\tif (visibilityHandle) {\n\t\t\tvisibilityHandle.stop();\n\t\t\tvisibilityHandle = null;\n\t\t}\n\t\tif (experimentalIframeHandle) {\n\t\t\texperimentalIframeHandle.stop();\n\t\t\texperimentalIframeHandle = null;\n\t\t}\n\t\tif (idleTimer !== null) {\n\t\t\tclearTimeout(idleTimer);\n\t\t\tidleTimer = null;\n\t\t}\n\t\tif (lifecycleHandle) {\n\t\t\tlifecycleHandle.stop();\n\t\t\tlifecycleHandle = null;\n\t\t}\n\t\tif (experimentalGlobalHandle) {\n\t\t\texperimentalGlobalHandle.stop();\n\t\t\texperimentalGlobalHandle = null;\n\t\t}\n\n\t\tsendClose(reason, wasPersisted);\n\t\tunregisterShortcode(shortcodeName);\n\t};\n\n\t// Public: stop\n\tconst stop = (reason: CloseReason = 'user.manual_close') => {\n\t\tstopInternal(reason, null);\n\t};\n\n\tconst getState = (): ObserverState => ({\n\t\tui: uiState,\n\t\ttransport: transportState,\n\t\tsessionId,\n\t\tcorrelationId,\n\t\tshortcode,\n\t\tisActive,\n\t\tiframeDetected: iframeEl !== null,\n\t\theartbeatCount: heartbeat?.heartbeatCount() ?? 0,\n\t\tmissedBeats: heartbeat?.missedBeats() ?? 0,\n\t\telapsedMs: startedAtMs ? Date.now() - startedAtMs : 0,\n\t});\n\n\tconst diagnostics: ObserverDiagnostics = {\n\t\tdump(): DiagnosticDump {\n\t\t\treturn {\n\t\t\t\tsessionId,\n\t\t\t\tcorrelationId,\n\t\t\t\tstate: getState(),\n\t\t\t\trecentEvents: recentEvents.slice(),\n\t\t\t\tdiagnostics: diagnosticsBuffer.slice(),\n\t\t\t\tconfiguredTransport: transport.constructor?.name ?? 'custom',\n\t\t\t\tversion: '6.0.0',\n\t\t\t};\n\t\t},\n\t};\n\n\treturn { sessionId, correlationId, shortcode, start, stop, getState, emit, diagnostics };\n}\n", "/**\n * ZenPay plugin auto-patch (v6).\n *\n * One-line integration: detects the ZenPay plugin and rewrites its\n * `onPluginClose` at invocation time to use our shortcode. Emits\n * `payment.hpp_init` domain events when the plugin is invoked so the\n * observer's event stream captures HPP lifecycle.\n *\n * Supports:\n * - v3: jQuery plugin `$.fn.zpPayment`\n * - v5: global `window.ZenPay` (class or factory)\n *\n * If neither is present at install time, we set a short-lived polling\n * watch (plugins are typically loaded via <script> before first payment).\n */\n\nimport type { Observer } from '../core/types.js';\n\ninterface JQueryLike {\n\tfn: { zpPayment?: unknown };\n}\n\ninterface ZPOptions {\n\tonPluginClose?: unknown;\n\t[key: string]: unknown;\n}\n\ntype PluginFn = (this: unknown, opts?: ZPOptions) => unknown;\n\nexport interface AutoPatchHandle {\n\tuninstall(): void;\n\tisPatched(): boolean;\n}\n\nexport interface AutoPatchOptions {\n\tpollIntervalMs?: number;\n\tpollTimeoutMs?: number;\n\tchainExisting?: boolean;\n\tdebug?: boolean;\n}\n\nfunction logDebug(enabled: boolean, ...args: unknown[]): void {\n\tif (enabled && typeof console !== 'undefined') {\n\t\tconsole.log('[ZPObserver/auto-patch]', ...args);\n\t}\n}\n\nfunction resolveAndCallWindowPath(windowPath: string): void {\n\tconst path = windowPath.replace(/^window\\./, '').split('.');\n\tlet ref: unknown = window;\n\tfor (const part of path) {\n\t\tif (ref && typeof ref === 'object' && part in ref) {\n\t\t\tref = (ref as Record<string, unknown>)[part];\n\t\t} else {\n\t\t\tref = undefined;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (typeof ref === 'function') (ref as () => void)();\n}\n\nfunction wrapOptions(\n\topts: ZPOptions | undefined,\n\tshortcode: string,\n\tchainExisting: boolean,\n): ZPOptions {\n\tconst next: ZPOptions = { ...(opts ?? {}) };\n\tconst existing = next.onPluginClose;\n\n\tif (chainExisting && existing != null) {\n\t\tif (typeof window !== 'undefined') {\n\t\t\tconst wrapperName = `__zpobs_chain_${Date.now().toString(36)}`;\n\t\t\t(window as unknown as Record<string, unknown>)[wrapperName] = () => {\n\t\t\t\ttry {\n\t\t\t\t\tif (typeof existing === 'function') {\n\t\t\t\t\t\t(existing as () => void)();\n\t\t\t\t\t} else if (typeof existing === 'string') {\n\t\t\t\t\t\tresolveAndCallWindowPath(existing);\n\t\t\t\t\t}\n\t\t\t\t} catch {\n\t\t\t\t\t// ignore\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\tresolveAndCallWindowPath(shortcode);\n\t\t\t\t} catch {\n\t\t\t\t\t// ignore\n\t\t\t\t}\n\t\t\t};\n\t\t\tnext.onPluginClose = `window.${wrapperName}`;\n\t\t\treturn next;\n\t\t}\n\t}\n\n\tnext.onPluginClose = shortcode;\n\treturn next;\n}\n\nfunction patchJQueryPlugin(\n\t$: JQueryLike,\n\tshortcode: string,\n\tchainExisting: boolean,\n\tdebug: boolean,\n\tonInvoke: () => void,\n): boolean {\n\tconst original = $.fn.zpPayment as PluginFn | undefined;\n\tif (typeof original !== 'function' || (original as { __zpobsPatched?: boolean }).__zpobsPatched) {\n\t\treturn false;\n\t}\n\n\tconst patched: PluginFn & { __zpobsPatched?: boolean } = function (\n\t\tthis: unknown,\n\t\topts?: ZPOptions,\n\t) {\n\t\tonInvoke();\n\t\treturn original.call(this, wrapOptions(opts, shortcode, chainExisting));\n\t};\n\tpatched.__zpobsPatched = true;\n\t$.fn.zpPayment = patched;\n\n\tlogDebug(debug, 'patched $.fn.zpPayment');\n\treturn true;\n}\n\nfunction patchZenPayGlobal(\n\tshortcode: string,\n\tchainExisting: boolean,\n\tdebug: boolean,\n\tonInvoke: () => void,\n): boolean {\n\tconst w = window as unknown as {\n\t\tZenPay?: (new (opts?: ZPOptions) => unknown) | ((opts?: ZPOptions) => unknown);\n\t};\n\tconst original = w.ZenPay;\n\tif (typeof original !== 'function' || (original as { __zpobsPatched?: boolean }).__zpobsPatched) {\n\t\treturn false;\n\t}\n\n\tconst handler: ProxyHandler<typeof original> = {\n\t\tconstruct(target, args) {\n\t\t\tonInvoke();\n\t\t\tconst [first, ...rest] = args as [ZPOptions | undefined, ...unknown[]];\n\t\t\tconst wrapped = wrapOptions(first, shortcode, chainExisting);\n\t\t\treturn Reflect.construct(target, [wrapped, ...rest]) as object;\n\t\t},\n\t\tapply(target, thisArg, args) {\n\t\t\tonInvoke();\n\t\t\tconst [first, ...rest] = args as [ZPOptions | undefined, ...unknown[]];\n\t\t\tconst wrapped = wrapOptions(first, shortcode, chainExisting);\n\t\t\treturn Reflect.apply(target as (...a: unknown[]) => unknown, thisArg, [\n\t\t\t\twrapped,\n\t\t\t\t...rest,\n\t\t\t]);\n\t\t},\n\t};\n\n\tconst patched = new Proxy(original, handler) as typeof original & {\n\t\t__zpobsPatched?: boolean;\n\t};\n\tpatched.__zpobsPatched = true;\n\tw.ZenPay = patched;\n\n\tlogDebug(debug, 'patched window.ZenPay');\n\treturn true;\n}\n\nexport function installZenPayAutoPatch(\n\tobserver: Pick<Observer, 'sessionId' | 'correlationId' | 'shortcode' | 'emit'>,\n\toptions: AutoPatchOptions = {},\n): AutoPatchHandle {\n\tif (typeof window === 'undefined') {\n\t\treturn { uninstall() {}, isPatched: () => false };\n\t}\n\n\tconst pollIntervalMs = options.pollIntervalMs ?? 200;\n\tconst pollTimeoutMs = options.pollTimeoutMs ?? 30_000;\n\tconst chainExisting = options.chainExisting !== false;\n\tconst debug = options.debug === true;\n\n\tlet patched = false;\n\tconst shortcode = observer.shortcode;\n\tconst w = window as unknown as { jQuery?: JQueryLike; $?: JQueryLike };\n\n\tconst emitHppInit = () => {\n\t\tobserver.emit({\n\t\t\tkind: 'payment.hpp_init',\n\t\t\tsessionId: observer.sessionId,\n\t\t\tcorrelationId: observer.correlationId,\n\t\t\ttimestamp: Date.now(),\n\t\t\tmetadata: {},\n\t\t});\n\t};\n\n\tconst tryPatch = (): boolean => {\n\t\tlet didSomething = false;\n\n\t\tconst jq = w.jQuery ?? w.$;\n\t\tif (jq && typeof jq === 'object' && 'fn' in jq) {\n\t\t\tif (patchJQueryPlugin(jq, shortcode, chainExisting, debug, emitHppInit)) didSomething = true;\n\t\t}\n\n\t\tif ('ZenPay' in window) {\n\t\t\tif (patchZenPayGlobal(shortcode, chainExisting, debug, emitHppInit)) didSomething = true;\n\t\t}\n\n\t\tif (didSomething) patched = true;\n\t\treturn didSomething;\n\t};\n\n\ttryPatch();\n\n\tconst startedAt = Date.now();\n\tlet pollTimer: ReturnType<typeof setInterval> | null = setInterval(() => {\n\t\tif (Date.now() - startedAt > pollTimeoutMs) {\n\t\t\tif (pollTimer !== null) {\n\t\t\t\tclearInterval(pollTimer);\n\t\t\t\tpollTimer = null;\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\ttryPatch();\n\t}, pollIntervalMs);\n\n\treturn {\n\t\tuninstall() {\n\t\t\tif (pollTimer !== null) {\n\t\t\t\tclearInterval(pollTimer);\n\t\t\t\tpollTimer = null;\n\t\t\t}\n\t\t},\n\t\tisPatched: () => patched,\n\t};\n}\n", "/**\n * HPP-TS observation bridge \u2014 wraps `window.onPaymentPluginLoaded`.\n *\n * HPP-TS v5 exposes `window.onPaymentPluginLoaded` (lines 794-823) as a\n * callback that fires when the payment iframe has loaded. This bridge wraps\n * it to emit `payment.hpp_iframe_loaded` through the observer without\n * modifying HPP-TS source.\n */\nimport type { Observer } from '../core/types.js';\n\nexport function installHPPBridge(\n\tobserver: Pick<Observer, 'sessionId' | 'correlationId' | 'emit'>,\n): { uninstall(): void } {\n\tif (typeof window === 'undefined') {\n\t\treturn { uninstall() {} };\n\t}\n\n\tconst w = window as unknown as {\n\t\tonPaymentPluginLoaded?: (() => void) | null;\n\t};\n\n\tconst original = w.onPaymentPluginLoaded;\n\n\tconst wrapper = () => {\n\t\ttry {\n\t\t\tobserver.emit({\n\t\t\t\tkind: 'payment.hpp_iframe_loaded',\n\t\t\t\tsessionId: observer.sessionId,\n\t\t\t\tcorrelationId: observer.correlationId,\n\t\t\t\ttimestamp: Date.now(),\n\t\t\t\tmetadata: {},\n\t\t\t});\n\t\t} catch {\n\t\t\t// Don't let observer emit errors block the original callback.\n\t\t}\n\n\t\tif (typeof original === 'function') {\n\t\t\ttry {\n\t\t\t\toriginal();\n\t\t\t} catch {\n\t\t\t\t// Don't let a broken original callback block the observer.\n\t\t\t}\n\t\t}\n\t};\n\n\tw.onPaymentPluginLoaded = wrapper;\n\n\treturn {\n\t\tuninstall() {\n\t\t\tw.onPaymentPluginLoaded = original ?? null;\n\t\t},\n\t};\n}\n", "/**\n * Unified entry point \u2014 `createZenPaySession`.\n *\n * Composes the observer, auto-patch, HPP bridge, and DEVICEFP hooks into a\n * single call. Returns a correlation-aware session object the integrator\n * destructures and passes to DEVICEFP and HPP-TS.\n *\n * import { createZenPaySession, httpTransport } from '@ianmenethil/zp-observer/session';\n *\n * const session = await createZenPaySession({\n * sessionId: merchantUPID,\n * transport: httpTransport({ openUrl, aliveUrl, closeUrl }),\n * deviceFP: { apiKey: '...', captureTimeoutMs: 7000 },\n * persistence: 'localStorage',\n * });\n *\n * // Pass session.fingerprint.hooks to DEVICEFP's captureThumbmark()\n * // Pass session.hppDefaults.onPluginClose to ZenPay\n * // observer starts automatically \u2014 no manual start() needed\n */\n\nimport { createObserver } from './core/observer.js';\nimport { installZenPayAutoPatch } from './integration/zenpay-auto-patch.js';\nimport { installHPPBridge } from './integration/hpp-bridge.js';\nimport type { Observer, PersistenceMode, Transport } from './core/types.js';\nimport type { AutoPatchOptions } from './integration/zenpay-auto-patch.js';\n\nexport interface CreateSessionOptions {\n\tsessionId: string;\n\ttransport: Transport;\n\tcorrelationId?: string;\n\tmetadata?: Record<string, unknown>;\n\tpersistence?: PersistenceMode;\n\tdeviceFP?: {\n\t\tapiKey?: string;\n\t\tcaptureTimeoutMs?: number;\n\t};\n\tautoPatch?: AutoPatchOptions;\n\theartbeatMs?: number;\n\tdebug?: boolean;\n}\n\nexport interface ZenPaySession {\n\treadonly sessionId: string;\n\treadonly correlationId: string;\n\treadonly observer: Observer;\n\treadonly hppDefaults: {\n\t\tonPluginClose: string;\n\t};\n\treadonly fingerprint: {\n\t\thooks: {\n\t\t\tonFingerprintStarted: (attempt: number) => void;\n\t\t\tonFingerprintCacheHit: (age: number) => void;\n\t\t\tonFingerprintSucceeded: () => void;\n\t\t\tonFingerprintFailed: (error: string, attempt: number) => void;\n\t\t};\n\t};\n}\n\nexport function createZenPaySession(\n\toptions: CreateSessionOptions,\n): ZenPaySession {\n\tconst {\n\t\tsessionId,\n\t\ttransport,\n\t\tcorrelationId,\n\t\tmetadata,\n\t\tpersistence,\n\t\tautoPatch,\n\t\theartbeatMs,\n\t\tdebug,\n\t} = options;\n\n\tconst observer = createObserver({\n\t\tsessionId,\n\t\ttransport,\n\t\t...(correlationId !== undefined ? { correlationId } : {}),\n\t\t...(metadata !== undefined ? { metadata } : {}),\n\t\t...(persistence !== undefined ? { persistence } : {}),\n\t\t...(heartbeatMs !== undefined ? { heartbeatMs } : {}),\n\t\t...(debug !== undefined ? { debug } : {}),\n\t});\n\n\tobserver.start();\n\n\tinstallZenPayAutoPatch(observer, autoPatch);\n\tinstallHPPBridge(observer);\n\n\t// DEVICEFP hooks that the integrator spreads into captureThumbmark() options.\n\tconst fpObserver = observer;\n\tconst hooks = {\n\t\tonFingerprintStarted(attempt: number) {\n\t\t\tfpObserver.emit({\n\t\t\t\tkind: 'payment.fingerprint_started',\n\t\t\t\tsessionId,\n\t\t\t\tcorrelationId: fpObserver.correlationId,\n\t\t\t\ttimestamp: Date.now(),\n\t\t\t\tattempt,\n\t\t\t\tmetadata: metadata ?? {},\n\t\t\t});\n\t\t},\n\t\tonFingerprintCacheHit(age: number) {\n\t\t\tfpObserver.emit({\n\t\t\t\tkind: 'payment.fingerprint_cache_hit',\n\t\t\t\tsessionId,\n\t\t\t\tcorrelationId: fpObserver.correlationId,\n\t\t\t\ttimestamp: Date.now(),\n\t\t\t\tage,\n\t\t\t\tmetadata: metadata ?? {},\n\t\t\t});\n\t\t},\n\t\tonFingerprintSucceeded() {\n\t\t\tfpObserver.emit({\n\t\t\t\tkind: 'payment.fingerprint_succeeded',\n\t\t\t\tsessionId,\n\t\t\t\tcorrelationId: fpObserver.correlationId,\n\t\t\t\ttimestamp: Date.now(),\n\t\t\t\tmetadata: metadata ?? {},\n\t\t\t});\n\t\t},\n\t\tonFingerprintFailed(error: string, attempt: number) {\n\t\t\tfpObserver.emit({\n\t\t\t\tkind: 'payment.fingerprint_failed',\n\t\t\t\tsessionId,\n\t\t\t\tcorrelationId: fpObserver.correlationId,\n\t\t\t\ttimestamp: Date.now(),\n\t\t\t\terror,\n\t\t\t\tattempt,\n\t\t\t\tmetadata: metadata ?? {},\n\t\t\t});\n\t\t},\n\t};\n\n\treturn {\n\t\tsessionId,\n\t\tcorrelationId: observer.correlationId,\n\t\tobserver,\n\t\thppDefaults: {\n\t\t\tonPluginClose: observer.shortcode,\n\t\t},\n\t\tfingerprint: { hooks },\n\t};\n}\n"],
|
|
5
|
-
"mappings": ";AAcO,IAAM,2BAA2B;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAiBO,SAAS,eACf,OACA,MAKkB;AAClB,MAAI,OAAO,aAAa,aAAa;AACpC,WAAO,EAAE,OAAO;AAAA,IAAC,EAAE;AAAA,EACpB;AAEA,MAAI,UAAU;AACd,MAAI,YAAmD;AACvD,MAAI,mBAA4C;AAChD,MAAI,mBAAgD;AACpD,QAAM,YAAY,KAAK,IAAI;AAE3B,QAAM,aAAa,MAAgC;AAClD,eAAW,YAAY,KAAK,WAAW;AACtC,YAAM,KAAK,SAAS,cAAc,QAAQ;AAC1C,UAAI,cAAc,kBAAmB,QAAO;AAAA,IAC7C;AACA,WAAO;AAAA,EACR;AAEA,QAAM,cAAc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AAU,YAAY,CAAC;AAAA,MACxB,CAAC;AAAA,IACF;AAAA,IACA,sBAAsB,KAAa;AAClC,iBAAW,KAAK;AAAA,QACf,MAAM;AAAA,QACN;AAAA,QACA,eAAe,WAAW;AAAA,QAC1B,WAAW,KAAK,IAAI;AAAA,QACpB;AAAA,QACA,UAAU,YAAY,CAAC;AAAA,MACxB,CAAC;AAAA,IACF;AAAA,IACA,yBAAyB;AACxB,iBAAW,KAAK;AAAA,QACf,MAAM;AAAA,QACN;AAAA,QACA,eAAe,WAAW;AAAA,QAC1B,WAAW,KAAK,IAAI;AAAA,QACpB,UAAU,YAAY,CAAC;AAAA,MACxB,CAAC;AAAA,IACF;AAAA,IACA,oBAAoB,OAAe,SAAiB;AACnD,iBAAW,KAAK;AAAA,QACf,MAAM;AAAA,QACN;AAAA,QACA,eAAe,WAAW;AAAA,QAC1B,WAAW,KAAK,IAAI;AAAA,QACpB;AAAA,QACA;AAAA,QACA,UAAU,YAAY,CAAC;AAAA,MACxB,CAAC;AAAA,IACF;AAAA,EACD;AAEA,SAAO;AAAA,IACN;AAAA,IACA,eAAe,SAAS;AAAA,IACxB;AAAA,IACA,aAAa;AAAA,MACZ,eAAe,SAAS;AAAA,IACzB;AAAA,IACA,aAAa,EAAE,MAAM;AAAA,EACtB;AACD;",
|
|
6
|
-
"names": ["getNavigationType", "logDebug"]
|
|
7
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @ianmenethil/zp-observer/auto-patch — subpath entry
|
|
3
|
-
*
|
|
4
|
-
* Single export: installZenPayAutoPatch. Import via:
|
|
5
|
-
* import { installZenPayAutoPatch } from '@ianmenethil/zp-observer/auto-patch';
|
|
6
|
-
*/
|
|
7
|
-
export { installZenPayAutoPatch } from './integration/zenpay-auto-patch.js';
|
|
8
|
-
export type { AutoPatchHandle, AutoPatchOptions } from './integration/zenpay-auto-patch.js';
|
|
9
|
-
//# sourceMappingURL=auto-patch.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auto-patch.d.ts","sourceRoot":"","sources":["../../src/auto-patch.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"beacon.d.ts","sourceRoot":"","sources":["../../../src/core/beacon.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAUlE"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Iframe detection and removal tracking.
|
|
3
|
-
*
|
|
4
|
-
* The ZenPay hosted checkout injects an iframe into the parent DOM when
|
|
5
|
-
* the user triggers a payment. We need to know:
|
|
6
|
-
* 1. When the iframe appears (→ "open" event)
|
|
7
|
-
* 2. When the iframe is removed (→ "user.modal_closed")
|
|
8
|
-
*
|
|
9
|
-
* Signals, in order of reliability:
|
|
10
|
-
* - Poll + querySelector (primary; works for every plugin version)
|
|
11
|
-
* - MutationObserver on body (cheap removal detection)
|
|
12
|
-
* - Bootstrap `hidden.bs.modal` (only when plugin uses Bootstrap modals)
|
|
13
|
-
*/
|
|
14
|
-
export declare const DEFAULT_IFRAME_SELECTORS: readonly ["iframe.zp-payment-frame", "iframe[src*=\"zenithpayments\"]", "iframe[src*=\"travelpay\"]", ".modal-payment iframe", "div.modal.show iframe"];
|
|
15
|
-
interface DetectionHandle {
|
|
16
|
-
stop(): void;
|
|
17
|
-
}
|
|
18
|
-
interface DetectionHooks {
|
|
19
|
-
/** Called once, when the iframe is first located. */
|
|
20
|
-
onFound(iframe: HTMLIFrameElement): void;
|
|
21
|
-
/** Called if the iframe is removed from the DOM after detection. */
|
|
22
|
-
onRemoved(): void;
|
|
23
|
-
/** Called if Bootstrap's `hidden.bs.modal` fires on a containing modal. */
|
|
24
|
-
onBootstrapHidden(): void;
|
|
25
|
-
/** Called if detection times out without finding an iframe. */
|
|
26
|
-
onTimeout(): void;
|
|
27
|
-
}
|
|
28
|
-
export declare function startDetection(hooks: DetectionHooks, opts: {
|
|
29
|
-
selectors: readonly string[];
|
|
30
|
-
intervalMs: number;
|
|
31
|
-
timeoutMs: number;
|
|
32
|
-
}): DetectionHandle;
|
|
33
|
-
export {};
|
|
34
|
-
//# sourceMappingURL=detection.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"detection.d.ts","sourceRoot":"","sources":["../../../src/core/detection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,eAAO,MAAM,wBAAwB,yJAM3B,CAAC;AAEX,UAAU,eAAe;IACxB,IAAI,IAAI,IAAI,CAAC;CACb;AAED,UAAU,cAAc;IACvB,qDAAqD;IACrD,OAAO,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACzC,oEAAoE;IACpE,SAAS,IAAI,IAAI,CAAC;IAClB,2EAA2E;IAC3E,iBAAiB,IAAI,IAAI,CAAC;IAC1B,+DAA+D;IAC/D,SAAS,IAAI,IAAI,CAAC;CAClB;AAED,wBAAgB,cAAc,CAC7B,KAAK,EAAE,cAAc,EACrB,IAAI,EAAE;IACL,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CAClB,GACC,eAAe,CAkGjB"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Typed event bus — the dispatch layer between `observer.emit()` and `Transport.send()`.
|
|
3
|
-
*
|
|
4
|
-
* Responsibilities:
|
|
5
|
-
* 1. Run every event through `beforeSend` (drop / mutate).
|
|
6
|
-
* 2. Optionally persist non-heartbeat events to an outbox before sending.
|
|
7
|
-
* 3. Delegate to `Transport.send()` and handle the result.
|
|
8
|
-
* 4. Count missed beats for heartbeat events (delegated from the heartbeat timer).
|
|
9
|
-
*/
|
|
10
|
-
import type { ObserverEvent, Transport, TransportResult } from './types.js';
|
|
11
|
-
import type { Outbox } from './outbox.js';
|
|
12
|
-
export interface EventBus {
|
|
13
|
-
/** Push a domain event onto the bus. Fire-and-forget from the caller's POV. */
|
|
14
|
-
emit(event: ObserverEvent): void;
|
|
15
|
-
/** Send a heartbeat and return the transport result (used by the heartbeat timer). */
|
|
16
|
-
sendHeartbeat(event: ObserverEvent): Promise<TransportResult>;
|
|
17
|
-
/** Drain persisted events for a given session. */
|
|
18
|
-
drain(sessionId: string): void;
|
|
19
|
-
}
|
|
20
|
-
export declare function createEventBus(transport: Transport, beforeSend: ((event: ObserverEvent) => ObserverEvent | null) | undefined, outbox: Outbox | null): EventBus;
|
|
21
|
-
//# sourceMappingURL=event-bus.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"event-bus.d.ts","sourceRoot":"","sources":["../../../src/core/event-bus.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC5E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,WAAW,QAAQ;IACxB,+EAA+E;IAC/E,IAAI,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;IAEjC,sFAAsF;IACtF,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAE9D,kDAAkD;IAClD,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED,wBAAgB,cAAc,CAC7B,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,CAAC,CAAC,KAAK,EAAE,aAAa,KAAK,aAAa,GAAG,IAAI,CAAC,GAAG,SAAS,EACxE,MAAM,EAAE,MAAM,GAAG,IAAI,GACnB,QAAQ,CAmDV"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Opt-in browser instrumentation for lab / production A-B testing.
|
|
3
|
-
* Each flag installs a narrow listener or one-shot read. Nothing here ends
|
|
4
|
-
* the session — use onDiagnostic + optional beacon URL to see what fires.
|
|
5
|
-
*/
|
|
6
|
-
import type { DiagnosticEvent, ExperimentalOptions } from './types.js';
|
|
7
|
-
export declare function hasGlobalExperimentalFeatures(exp?: ExperimentalOptions): boolean;
|
|
8
|
-
export declare function hasIframeExperimentalFeatures(exp?: ExperimentalOptions): boolean;
|
|
9
|
-
export declare function readOpenExperimentalFields(exp: ExperimentalOptions | undefined): {
|
|
10
|
-
userActivation?: {
|
|
11
|
-
hasBeenActive: boolean;
|
|
12
|
-
isActive: boolean;
|
|
13
|
-
};
|
|
14
|
-
navigationDetail?: {
|
|
15
|
-
wasDiscarded: boolean | null;
|
|
16
|
-
redirectCount: number | null;
|
|
17
|
-
transferSize: number | null;
|
|
18
|
-
type: string | null;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
interface ExperimentalRuntimeContext {
|
|
22
|
-
sessionId: string;
|
|
23
|
-
experimental: ExperimentalOptions;
|
|
24
|
-
onDiagnostic: (e: DiagnosticEvent) => void;
|
|
25
|
-
debug: boolean;
|
|
26
|
-
getNavigationType: () => string | null;
|
|
27
|
-
}
|
|
28
|
-
export declare function installGlobalExperimental(ctx: ExperimentalRuntimeContext): {
|
|
29
|
-
stop(): void;
|
|
30
|
-
};
|
|
31
|
-
export declare function installIframeExperimental(iframe: HTMLIFrameElement, ctx: ExperimentalRuntimeContext): {
|
|
32
|
-
stop(): void;
|
|
33
|
-
};
|
|
34
|
-
export {};
|
|
35
|
-
//# sourceMappingURL=experimental.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"experimental.d.ts","sourceRoot":"","sources":["../../../src/core/experimental.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAGvE,wBAAgB,6BAA6B,CAAC,GAAG,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAWhF;AAED,wBAAgB,6BAA6B,CAAC,GAAG,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAGhF;AA8CD,wBAAgB,0BAA0B,CACzC,GAAG,EAAE,mBAAmB,GAAG,SAAS,GAClC;IACF,cAAc,CAAC,EAAE;QAAE,aAAa,EAAE,OAAO,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAC;IAC/D,gBAAgB,CAAC,EAAE;QAClB,YAAY,EAAE,OAAO,GAAG,IAAI,CAAC;QAC7B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;QAC7B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;QAC5B,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;KACpB,CAAC;CACF,CAoBA;AAED,UAAU,0BAA0B;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,mBAAmB,CAAC;IAClC,YAAY,EAAE,CAAC,CAAC,EAAE,eAAe,KAAK,IAAI,CAAC;IAC3C,KAAK,EAAE,OAAO,CAAC;IACf,iBAAiB,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;CACvC;AAED,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,0BAA0B,GAAG;IAAE,IAAI,IAAI,IAAI,CAAA;CAAE,CA+K3F;AAED,wBAAgB,yBAAyB,CACxC,MAAM,EAAE,iBAAiB,EACzB,GAAG,EAAE,0BAA0B,GAC7B;IAAE,IAAI,IAAI,IAAI,CAAA;CAAE,CA6ClB"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Application-level heartbeat.
|
|
3
|
-
*
|
|
4
|
-
* Browsers expose no ping/pong control frames to JS, so we run our own.
|
|
5
|
-
* The heartbeat goes through the event bus so `beforeSend` is applied
|
|
6
|
-
* centrally. The transport handles the actual send.
|
|
7
|
-
*
|
|
8
|
-
* Mirrors the 2025-10-27 bugfix in the v1.2 experimental observer: a failed
|
|
9
|
-
* response increments `missedBeats`; threshold breach triggers abandonment.
|
|
10
|
-
*/
|
|
11
|
-
import type { ObserverEvent } from './types.js';
|
|
12
|
-
interface HeartbeatHooks {
|
|
13
|
-
onTick(sequence: number, missedBeats: number): void;
|
|
14
|
-
onAbandoned(missedBeats: number): void;
|
|
15
|
-
}
|
|
16
|
-
export interface HeartbeatHandle {
|
|
17
|
-
stop(): void;
|
|
18
|
-
heartbeatCount(): number;
|
|
19
|
-
missedBeats(): number;
|
|
20
|
-
}
|
|
21
|
-
interface HeartbeatSender {
|
|
22
|
-
sendHeartbeat(event: ObserverEvent): Promise<{
|
|
23
|
-
ok: boolean;
|
|
24
|
-
status?: number;
|
|
25
|
-
}>;
|
|
26
|
-
}
|
|
27
|
-
export declare function startHeartbeat(sessionId: string, correlationId: string, getMetadata: () => Record<string, unknown>, sender: HeartbeatSender, hooks: HeartbeatHooks, opts: {
|
|
28
|
-
intervalMs: number;
|
|
29
|
-
missThreshold: number;
|
|
30
|
-
}): HeartbeatHandle;
|
|
31
|
-
export {};
|
|
32
|
-
//# sourceMappingURL=heartbeat.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"heartbeat.d.ts","sourceRoot":"","sources":["../../../src/core/heartbeat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAkB,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhE,UAAU,cAAc;IACvB,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IACpD,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CACvC;AAED,MAAM,WAAW,eAAe;IAC/B,IAAI,IAAI,IAAI,CAAC;IACb,cAAc,IAAI,MAAM,CAAC;IACzB,WAAW,IAAI,MAAM,CAAC;CACtB;AAED,UAAU,eAAe;IACxB,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC;QAAE,EAAE,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC/E;AAED,wBAAgB,cAAc,CAC7B,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC1C,MAAM,EAAE,eAAe,EACvB,KAAK,EAAE,cAAc,EACrB,IAAI,EAAE;IACL,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACtB,GACC,eAAe,CAsDjB"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Page lifecycle signals.
|
|
3
|
-
*
|
|
4
|
-
* Per the browser-lifecycle handbook:
|
|
5
|
-
* - `visibilitychange` is the primary signal for "user left active view".
|
|
6
|
-
* - `pagehide` is the fallback for dismissal + bfcache, with `event.persisted`.
|
|
7
|
-
* - `unload` is unreliable and deliberately not used.
|
|
8
|
-
* - `navigator.onLine` is a UX hint only, not used for correctness.
|
|
9
|
-
*/
|
|
10
|
-
interface LifecycleHooks {
|
|
11
|
-
/** visibilityState transitioned to "hidden". */
|
|
12
|
-
onHidden(): void;
|
|
13
|
-
/** visibilityState transitioned back to "visible". */
|
|
14
|
-
onVisible(): void;
|
|
15
|
-
/** pagehide fired. `persisted` means the page is in bfcache. */
|
|
16
|
-
onPageHide(persisted: boolean): void;
|
|
17
|
-
}
|
|
18
|
-
interface LifecycleHandle {
|
|
19
|
-
stop(): void;
|
|
20
|
-
}
|
|
21
|
-
export declare function installPageLifecycle(hooks: LifecycleHooks): LifecycleHandle;
|
|
22
|
-
/**
|
|
23
|
-
* Attach an IntersectionObserver to the iframe so we know if it is actually
|
|
24
|
-
* on-screen (not just in the DOM). Useful when a merchant page scrolls the
|
|
25
|
-
* modal out of view but leaves it mounted.
|
|
26
|
-
*/
|
|
27
|
-
export declare function observeIframeVisibility(iframe: HTMLIFrameElement, onChange: (visible: boolean) => void): {
|
|
28
|
-
stop(): void;
|
|
29
|
-
};
|
|
30
|
-
export {};
|
|
31
|
-
//# sourceMappingURL=lifecycle.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../../src/core/lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,UAAU,cAAc;IACvB,gDAAgD;IAChD,QAAQ,IAAI,IAAI,CAAC;IACjB,sDAAsD;IACtD,SAAS,IAAI,IAAI,CAAC;IAClB,gEAAgE;IAChE,UAAU,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CAAC;CACrC;AAED,UAAU,eAAe;IACxB,IAAI,IAAI,IAAI,CAAC;CACb;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,cAAc,GAAG,eAAe,CAwB3E;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACtC,MAAM,EAAE,iBAAiB,EACzB,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,GAClC;IAAE,IAAI,IAAI,IAAI,CAAA;CAAE,CAmBlB"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* createObserver — the public factory (v6).
|
|
3
|
-
*
|
|
4
|
-
* Wires detection + lifecycle + heartbeat + shortcode + event bus + outbox
|
|
5
|
-
* against a Transport. The only concrete behaviour here is orchestration;
|
|
6
|
-
* every external side effect is delegated.
|
|
7
|
-
*/
|
|
8
|
-
import type { CreateObserverOptions, Observer } from './types.js';
|
|
9
|
-
export declare function createObserver(options: CreateObserverOptions): Observer;
|
|
10
|
-
//# sourceMappingURL=observer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"observer.d.ts","sourceRoot":"","sources":["../../../src/core/observer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAoBH,OAAO,KAAK,EAGX,qBAAqB,EAIrB,QAAQ,EAOR,MAAM,YAAY,CAAC;AAkBpB,wBAAgB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,QAAQ,CAoUvE"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* localStorage outbox for at-least-once delivery of non-heartbeat events.
|
|
3
|
-
*
|
|
4
|
-
* When `persistence: 'localStorage'` is set, every non-heartbeat event is
|
|
5
|
-
* written to a ring buffer before sending. On successful send, the entry is
|
|
6
|
-
* removed. On next `start()`, pending entries for the matching sessionId are
|
|
7
|
-
* drained and re-sent.
|
|
8
|
-
*
|
|
9
|
-
* Caps at 64 entries to bound storage. If localStorage is unavailable (private
|
|
10
|
-
* mode, quota exceeded), surfaces `system.persistence_unavailable` via the
|
|
11
|
-
* `onUnavailable` callback so the integrator can downgrade to `'memory'`.
|
|
12
|
-
*/
|
|
13
|
-
import type { ObserverEvent } from './types.js';
|
|
14
|
-
export interface Outbox {
|
|
15
|
-
push(event: ObserverEvent): void;
|
|
16
|
-
remove(event: ObserverEvent): void;
|
|
17
|
-
drain(sessionId: string): ObserverEvent[];
|
|
18
|
-
}
|
|
19
|
-
export declare function createOutbox(onUnavailable: (error: string) => void): Outbox | null;
|
|
20
|
-
//# sourceMappingURL=outbox.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"outbox.d.ts","sourceRoot":"","sources":["../../../src/core/outbox.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAWhD,MAAM,WAAW,MAAM;IACtB,IAAI,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;IACjC,MAAM,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;IACnC,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,EAAE,CAAC;CAC1C;AAED,wBAAgB,YAAY,CAC3B,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GACpC,MAAM,GAAG,IAAI,CAyDf"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared random helpers — UUID generation for correlation IDs.
|
|
3
|
-
*
|
|
4
|
-
* Uses `crypto.randomUUID()` when available (all modern browsers, Node 19+),
|
|
5
|
-
* with a `Math.random` fallback for older environments.
|
|
6
|
-
*/
|
|
7
|
-
export declare function generateUUID(): string;
|
|
8
|
-
//# sourceMappingURL=random.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"random.d.ts","sourceRoot":"","sources":["../../../src/core/random.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAqBH,wBAAgB,YAAY,IAAI,MAAM,CAKrC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shortcode pattern — WAF-safe callback passing to ZenPay.
|
|
3
|
-
*
|
|
4
|
-
* Problem: passing a function object to ZenPay's `onPluginClose` causes the
|
|
5
|
-
* function source to appear in URL query strings, which trips WAFs.
|
|
6
|
-
*
|
|
7
|
-
* Solution: register the callback as a global under a unique name and pass
|
|
8
|
-
* the STRING "window.zpcb_xxx" instead. ZenPay invokes `window[name]()` which
|
|
9
|
-
* resolves at runtime but never leaks code into the URL.
|
|
10
|
-
*/
|
|
11
|
-
/** Build a unique, WAF-safe global name. Uses crypto when available. */
|
|
12
|
-
export declare function generateShortcodeName(): string;
|
|
13
|
-
/** Register `fn` as `window[name]`. Returns the string to pass to ZenPay. */
|
|
14
|
-
export declare function registerShortcode(name: string, fn: () => void): string;
|
|
15
|
-
/** Remove a previously registered shortcode. Safe to call twice. */
|
|
16
|
-
export declare function unregisterShortcode(name: string): void;
|
|
17
|
-
//# sourceMappingURL=shortcode.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shortcode.d.ts","sourceRoot":"","sources":["../../../src/core/shortcode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,wEAAwE;AACxE,wBAAgB,qBAAqB,IAAI,MAAM,CAW9C;AAED,6EAA6E;AAC7E,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,IAAI,GAAG,MAAM,CAKtE;AAED,oEAAoE;AACpE,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAQtD"}
|