@active-reach/web-sdk 1.13.0 → 1.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aegis.min.js +1 -1
- package/dist/aegis.min.js.map +1 -1
- package/dist/{analytics-Mh4H4ekQ.mjs → analytics-CjLItVo2.mjs} +287 -23
- package/dist/analytics-CjLItVo2.mjs.map +1 -0
- package/dist/core/analytics.d.ts +137 -0
- package/dist/core/analytics.d.ts.map +1 -1
- package/dist/core/bootstrap.d.ts +25 -0
- package/dist/core/bootstrap.d.ts.map +1 -1
- package/dist/core/session.d.ts.map +1 -1
- package/dist/ecommerce/index.d.ts +8 -3
- package/dist/ecommerce/index.d.ts.map +1 -1
- package/dist/ecommerce/types.d.ts +4 -0
- package/dist/ecommerce/types.d.ts.map +1 -1
- package/dist/inapp/AegisInAppManager.d.ts +11 -0
- package/dist/inapp/AegisInAppManager.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -7
- package/dist/index.js.map +1 -1
- package/dist/placements/AegisPlacementManager.d.ts +9 -0
- package/dist/placements/AegisPlacementManager.d.ts.map +1 -1
- package/dist/push/AegisWebPush.js +7 -7
- package/dist/push/AegisWebPush.js.map +1 -1
- package/dist/react.js +2 -2
- package/dist/react.js.map +1 -1
- package/dist/runtime/AegisMessageRuntime.d.ts.map +1 -1
- package/dist/snippet.min.js +1 -1
- package/dist/types/events.d.ts +20 -0
- package/dist/types/events.d.ts.map +1 -1
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/widgets/AegisWidgetManager.d.ts +9 -0
- package/dist/widgets/AegisWidgetManager.d.ts.map +1 -1
- package/package.json +5 -4
- package/dist/analytics-Mh4H4ekQ.mjs.map +0 -1
|
@@ -44,6 +44,14 @@ export interface AegisPlacementConfig {
|
|
|
44
44
|
organizationId?: string;
|
|
45
45
|
debugMode?: boolean;
|
|
46
46
|
enableSSE?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Workspace cascade reader. Host SDK sets this to
|
|
49
|
+
* `() => aegis.getEffectiveWorkspaceId()` so placement
|
|
50
|
+
* impression/click/conversion events arrive at the gateway with the
|
|
51
|
+
* same workspace context the main analytics SDK uses. See
|
|
52
|
+
* PLUGIN_HANDSHAKE_AUTOMATION_TRACKER.md §P1.b.
|
|
53
|
+
*/
|
|
54
|
+
getWorkspaceId?: () => string | undefined;
|
|
47
55
|
}
|
|
48
56
|
export declare class AegisPlacementManager {
|
|
49
57
|
private writeKey;
|
|
@@ -53,6 +61,7 @@ export declare class AegisPlacementManager {
|
|
|
53
61
|
private organizationId?;
|
|
54
62
|
private debugMode;
|
|
55
63
|
private enableSSE;
|
|
64
|
+
private getWorkspaceId?;
|
|
56
65
|
private placements;
|
|
57
66
|
private slots;
|
|
58
67
|
private renderedSlots;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AegisPlacementManager.d.ts","sourceRoot":"","sources":["../../src/placements/AegisPlacementManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,QAAQ,GAAG,MAAM,GAAG,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,mBAAmB,CAAC;IACtF,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;CACnD;AAED,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC/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,cAAc;YAUR,UAAU;IAmDxB,OAAO,CAAC,UAAU;IAwDlB,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,gBAAgB;IAkBxB,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,WAAW;IAgBnB,OAAO,CAAC,aAAa;IAarB,OAAO,CAAC,YAAY;IAkCpB,OAAO,CAAC,GAAG;IAMX,OAAO,IAAI,IAAI;CAQhB"}
|
|
@@ -58,7 +58,7 @@ class AegisWebPush {
|
|
|
58
58
|
apiClient.post("/v1/push/engagement", body, headers)
|
|
59
59
|
).catch((err) => {
|
|
60
60
|
if (typeof console !== "undefined" && console.warn) {
|
|
61
|
-
console.warn("[
|
|
61
|
+
console.warn("[Active Reach WebPush] engagement report failed:", err);
|
|
62
62
|
}
|
|
63
63
|
});
|
|
64
64
|
}
|
|
@@ -119,7 +119,7 @@ class AegisWebPush {
|
|
|
119
119
|
const handlers = this.hooks.get("error");
|
|
120
120
|
if (!handlers || handlers.size === 0) {
|
|
121
121
|
console.warn(
|
|
122
|
-
"[
|
|
122
|
+
"[Active Reach WebPush] error:",
|
|
123
123
|
err instanceof Error ? err.message : String(err),
|
|
124
124
|
context ?? {}
|
|
125
125
|
);
|
|
@@ -139,7 +139,7 @@ class AegisWebPush {
|
|
|
139
139
|
async initialize() {
|
|
140
140
|
if (this.initialized) return;
|
|
141
141
|
if (!("serviceWorker" in navigator) || !("PushManager" in window)) {
|
|
142
|
-
console.warn("[
|
|
142
|
+
console.warn("[Active Reach WebPush] Push notifications not supported in this browser");
|
|
143
143
|
return;
|
|
144
144
|
}
|
|
145
145
|
try {
|
|
@@ -154,14 +154,14 @@ class AegisWebPush {
|
|
|
154
154
|
});
|
|
155
155
|
if (typeof window !== "undefined" && Notification.permission === "granted") {
|
|
156
156
|
this.subscribeToPush().catch((err) => {
|
|
157
|
-
console.warn("[
|
|
157
|
+
console.warn("[Active Reach WebPush] auto-resync subscribeToPush failed:", err);
|
|
158
158
|
});
|
|
159
159
|
}
|
|
160
160
|
if (this.config.autoPrompt) {
|
|
161
161
|
setTimeout(() => this.requestPermission(), this.config.promptDelay);
|
|
162
162
|
}
|
|
163
163
|
} catch (err) {
|
|
164
|
-
console.error("[
|
|
164
|
+
console.error("[Active Reach WebPush] Service worker registration failed:", err);
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
async requestPermission() {
|
|
@@ -302,7 +302,7 @@ class AegisWebPush {
|
|
|
302
302
|
return;
|
|
303
303
|
} catch (err) {
|
|
304
304
|
if (attempt === maxRetries) {
|
|
305
|
-
console.error("[
|
|
305
|
+
console.error("[Active Reach WebPush] API call failed after retries:", err);
|
|
306
306
|
return;
|
|
307
307
|
}
|
|
308
308
|
const delay = 1e3 * Math.pow(2, attempt);
|
|
@@ -404,7 +404,7 @@ class AegisWebPush {
|
|
|
404
404
|
);
|
|
405
405
|
this.trackPushEvent("push.resubscribed", {});
|
|
406
406
|
} catch (err) {
|
|
407
|
-
console.warn("[
|
|
407
|
+
console.warn("[Active Reach WebPush] persistResubscription failed:", err);
|
|
408
408
|
}
|
|
409
409
|
}
|
|
410
410
|
trackPushEvent(eventName, properties) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AegisWebPush.js","sources":["../../src/push/AegisWebPush.ts"],"sourcesContent":["export interface AegisAPIClient {\n post(\n endpoint: string,\n payload: Record<string, unknown>,\n headers?: Record<string, string>\n ): Promise<unknown>;\n}\n\nexport interface ContactIdentity {\n contactId?: string;\n shopifyCustomerId?: string;\n email?: string;\n}\n\nexport interface AegisWebPushConfig {\n vapidPublicKey: string;\n // SubscriptionProperty binding — supplied by the embedding host (e.g.\n // the storefront SSR via the `sdk.property_id` field on /store/{slug}).\n // Required: every subscribe call sends it back as `X-Property-Id` so\n // the backend pins the row to the right origin.\n propertyId: string;\n // Stable per-browser cookie id (e.g. aegis_fpc). Used as the\n // device-fingerprint salt so a fresh subscribe after VAPID rotation\n // upserts onto the same `web_push_subscriptions` row.\n firstPartyCookieId: string;\n autoPrompt?: boolean;\n promptDelay?: number;\n serviceWorkerPath?: string;\n serviceWorkerScope?: string;\n // Engagement-event reporting credentials. When BOTH `writeKey` and\n // `organizationId` are provided AND the caller does NOT pass an\n // explicit `eventTracker` to the constructor, AegisWebPush auto-wires\n // a built-in tracker that POSTs push lifecycle events\n // (push.delivered / push.dismissed / push.clicked) to\n // `/v1/push/engagement` — closing the long-standing gap where shown\n // + dismissed signals (only the device-side SDK can report them)\n // never reached `aegis.delivery_events`. See backend dual-route at\n // `apps/event-ingress/src/services/event-switchboard.ts`\n // (SDK_ENGAGEMENT_EVENT_TO_DELIVERY_MAPPING).\n //\n // Callers using `AegisMessageRuntime` should keep passing the\n // runtime's analytics adapter as `eventTracker` — these fields are\n // only the standalone-init fallback.\n writeKey?: string;\n organizationId?: string;\n}\n\nexport interface PushEventTracker {\n track(eventName: string, properties: Record<string, unknown>): void;\n}\n\n/**\n * Payload for the `push-tap` lifecycle event. CANCELLABLE — return `false`\n * (or call `evt.preventDefault()`) from a handler to suppress the SDK's\n * default `window.location.href` fallback navigation. Use this to dispatch\n * an in-place state change in a SPA host instead of a hard reload.\n *\n * `action_type` + `action_payload` are author-controlled fields baked into\n * the push template's `data` block:\n *\n * ```json\n * {\n * \"title\": \"Your cart is waiting\",\n * \"body\": \"...\",\n * \"action_url\": \"https://shop.actii.me/?step=cart\",\n * \"data\": {\n * \"action_type\": \"open_cart\",\n * \"action_payload\": { \"step\": \"cart\" }\n * }\n * }\n * ```\n */\nexport interface PushTapEvent {\n /** Author-controlled action discriminator (e.g. `open_cart`,\n * `open_payment_link`, `open_order`). When unset, the SDK runs its\n * default fallback navigation to `action_url`. */\n action_type?: string;\n /** Optional structured args the host SPA forwards to its handler. */\n action_payload?: Record<string, unknown>;\n /** Sanitized destination URL — used as the SDK's default fallback nav\n * target when no host handler cancels. */\n action_url: string;\n /** Action-button id when the user clicked a specific button on a\n * multi-button notification; `'default'` for body taps. */\n action: string;\n /** Source campaign id from the push payload — useful for SPA routing\n * (e.g. open_cart from a cart-recovery campaign vs from a generic\n * catch-all template). */\n campaign_id?: string;\n /** Mutate via `evt.preventDefault()` to signal the SDK to skip its\n * default hard-navigation. Identical semantics to DOM CustomEvent. */\n preventDefault: () => void;\n defaultPrevented: boolean;\n}\n\n/** Payload for `push-shown` — fires after `showNotification` resolves on\n * the SW side. The `degraded` flag is true when the SW had to fall back\n * to its minimal `{title, body}` retry path (broken icon URL etc.). */\nexport interface PushShownEvent {\n campaign_id?: string;\n degraded?: boolean;\n}\n\n/** Payload for `push-dismissed` — fires when the user closes the\n * notification without clicking. */\nexport interface PushDismissEvent {\n campaign_id?: string;\n}\n\n/** Payload for `error` — non-fatal SDK errors (subscribe failures,\n * resubscribe persist failures, host-handler throws). Wire into Sentry\n * / Datadog RUM. */\nexport interface PushErrorEvent {\n message: string;\n error: unknown;\n context: Record<string, unknown>;\n}\n\n/** Map of lifecycle event name → handler signature. Mirrors 1.8.0\n * in-app lifecycle for consistency. */\nexport interface WebPushLifecycleEventMap {\n 'push-tap': (evt: PushTapEvent) => void | false;\n 'push-shown': (evt: PushShownEvent) => void;\n 'push-dismissed': (evt: PushDismissEvent) => void;\n 'error': (evt: PushErrorEvent) => void;\n}\n\n/**\n * AegisWebPush — Web Push notification manager.\n *\n * Handles service worker registration, push subscription via VAPID,\n * token registration with the backend, and push event tracking.\n */\nexport class AegisWebPush {\n private apiClient: AegisAPIClient;\n private eventTracker: PushEventTracker | null;\n private swRegistration: ServiceWorkerRegistration | null = null;\n private config: AegisWebPushConfig;\n private initialized = false;\n\n // ── Lifecycle event bus (1.8.5) ────────────────────────────────────────\n // Typed handler registry, parity with AegisInAppManager (1.8.0).\n // Hosts register via the public `on*` methods below; calling the\n // returned unsubscribe fn removes the handler. Multiple subscribers per\n // event are supported. Cancellable events (`push-tap`) suppress the\n // SDK's default behaviour when a handler returns `false` or calls\n // `evt.preventDefault()`.\n //\n // Industry parity: matches CleverTap `notificationCallback`, OneSignal\n // `addEventListener('notificationOpened')`, MoEngage\n // `onSelfHandledClick`, WebEngage `notificationCallback`. The SW posts\n // a `push.clicked` message; this class translates that into a typed\n // PushTapEvent with cancellable default-nav behaviour.\n private hooks = new Map<string, Set<(...args: unknown[]) => void | false | undefined>>();\n\n constructor(\n apiClient: AegisAPIClient,\n config: AegisWebPushConfig,\n eventTracker?: PushEventTracker\n ) {\n this.apiClient = apiClient;\n this.config = {\n serviceWorkerPath: '/aegis-sw.js',\n serviceWorkerScope: '/',\n autoPrompt: false,\n promptDelay: 5000,\n ...config,\n };\n // Explicit eventTracker wins (typical AegisMessageRuntime flow).\n // Otherwise, if both `writeKey` and `organizationId` are configured,\n // wire the built-in tracker that POSTs to `/v1/push/engagement` so\n // standalone push installs don't silently drop lifecycle events.\n if (eventTracker) {\n this.eventTracker = eventTracker;\n } else if (this.config.writeKey && this.config.organizationId) {\n this.eventTracker = this.createBuiltinEventTracker(\n this.config.writeKey,\n this.config.organizationId,\n );\n } else {\n this.eventTracker = null;\n }\n }\n\n /** Built-in fallback that POSTs push lifecycle events to\n * `/v1/push/engagement`. The gateway forwards to event-ingress with\n * the canonical `push.<event>` event_type, which the\n * event-switchboard's SDK_ENGAGEMENT_EVENT_TO_DELIVERY_MAPPING\n * dual-routes onto `aegis.delivery_events` as\n * `channel='push', status='shown'|'dismissed'|...`. Best-effort —\n * failures are warned but never thrown (push SW callbacks shouldn't\n * reject because the analytics POST failed). */\n private createBuiltinEventTracker(\n writeKey: string,\n organizationId: string,\n ): PushEventTracker {\n const apiClient = this.apiClient;\n const propertyId = this.config.propertyId;\n const resolveContactId = () => this.resolveContactId();\n return {\n track(eventName: string, properties: Record<string, unknown>): void {\n const contactId =\n (properties.contact_id as string | undefined) ?? resolveContactId();\n const body = {\n campaign_id: (properties.campaign_id as string | undefined) || '',\n message_id: (properties.message_id as string | undefined) || '',\n event_type: eventName, // e.g. 'push.delivered' — gateway tolerates either form\n user_id: (properties.user_id as string | undefined) || contactId,\n contact_id: contactId,\n anonymous_id: (properties.anonymous_id as string | undefined) || '',\n platform: (properties.platform as string | undefined) || 'web',\n property_id: propertyId,\n metadata: (properties.metadata as Record<string, unknown> | undefined) ?? {},\n };\n const headers = {\n 'X-Aegis-Write-Key': writeKey,\n 'X-Organization-ID': organizationId,\n 'X-Property-Id': propertyId,\n };\n void Promise.resolve(\n apiClient.post('/v1/push/engagement', body, headers),\n ).catch((err) => {\n if (typeof console !== 'undefined' && console.warn) {\n console.warn('[AegisWebPush] engagement report failed:', err);\n }\n });\n },\n };\n }\n\n // ── Public lifecycle hook API ──────────────────────────────────────────\n\n /** Generic typed subscribe — useful when the host wants to dispatch\n * multiple events through one wrapper. For single-event subscriptions\n * prefer the `on*` sugar methods below. */\n on<E extends keyof WebPushLifecycleEventMap>(\n event: E,\n handler: WebPushLifecycleEventMap[E],\n ): () => void {\n return this.register(event, handler as never);\n }\n\n /** Subscribe to push notification taps. CANCELLABLE — return `false`\n * (or call `evt.preventDefault()`) to suppress the SDK's default\n * `window.location.href = action_url` fallback. Use this to wire a\n * SPA router into the typed `action_type` payload (e.g. open the\n * cart drawer in-place instead of a full reload). */\n onPushTap(\n handler: (evt: PushTapEvent) => void | false,\n ): () => void {\n return this.register('push-tap', handler);\n }\n\n /** Subscribe to push impressions — fires after the OS notification\n * has actually rendered. `degraded=true` when the SW fell back to\n * the minimal `{title, body}` path (broken icon, etc.). */\n onPushShown(\n handler: (evt: PushShownEvent) => void,\n ): () => void {\n return this.register('push-shown', handler);\n }\n\n /** Subscribe to push dismissals (notification closed without a tap). */\n onPushDismiss(\n handler: (evt: PushDismissEvent) => void,\n ): () => void {\n return this.register('push-dismissed', handler);\n }\n\n /** Subscribe to non-fatal SDK errors. Wire into Sentry / Datadog. */\n onError(\n handler: (evt: PushErrorEvent) => void,\n ): () => void {\n return this.register('error', handler);\n }\n\n private register<T>(\n eventName: string,\n handler: (payload: T) => void | false | undefined,\n ): () => void {\n if (!this.hooks.has(eventName)) this.hooks.set(eventName, new Set());\n this.hooks.get(eventName)!.add(handler as (...args: unknown[]) => void | false | undefined);\n return () => {\n this.hooks.get(eventName)?.delete(handler as (...args: unknown[]) => void | false | undefined);\n };\n }\n\n private emit<T>(eventName: string, payload: T): boolean {\n const handlers = this.hooks.get(eventName);\n if (!handlers || handlers.size === 0) return true;\n let proceed = true;\n for (const handler of handlers) {\n try {\n const result = (handler as (p: T) => void | false | undefined)(payload);\n if (result === false) proceed = false;\n } catch (err) {\n this.emitError(err, { event: eventName });\n }\n }\n return proceed;\n }\n\n private emitError(err: unknown, context?: Record<string, unknown>): void {\n const handlers = this.hooks.get('error');\n if (!handlers || handlers.size === 0) {\n console.warn(\n '[AegisWebPush] error:',\n err instanceof Error ? err.message : String(err),\n context ?? {}\n );\n return;\n }\n for (const handler of handlers) {\n try {\n (handler as (e: PushErrorEvent) => void)({\n message: err instanceof Error ? err.message : String(err),\n error: err,\n context: context ?? {},\n });\n } catch {\n // already in error path — don't loop\n }\n }\n }\n\n async initialize(): Promise<void> {\n if (this.initialized) return;\n\n if (!('serviceWorker' in navigator) || !('PushManager' in window)) {\n console.warn('[AegisWebPush] Push notifications not supported in this browser');\n return;\n }\n\n try {\n this.swRegistration = await navigator.serviceWorker.register(\n this.config.serviceWorkerPath!,\n { scope: this.config.serviceWorkerScope }\n );\n await navigator.serviceWorker.ready;\n this.initialized = true;\n\n // Listen for messages from the service worker (click/dismiss tracking,\n // and pushsubscriptionchange relay — see handleSWMessage).\n navigator.serviceWorker.addEventListener('message', (event) => {\n this.handleSWMessage(event.data);\n });\n\n // Heal endpoint drift on every page load.\n //\n // Background: when the SW updates with skipWaiting+clients.claim\n // (added in 1.7.3), some browsers — Samsung Internet most\n // aggressively, occasionally Chrome too — silently regenerate the\n // push subscription mid-flight. The SW catches the\n // pushsubscriptionchange event and resubscribes locally, but\n // historically the new endpoint never made it back to the\n // backend. Cell-plane kept FCM-pushing to the dead endpoint;\n // FCM 201s on receipt regardless of whether the token is alive,\n // so the silent failure was invisible until users complained.\n //\n // Fix: whenever permission is already granted at init time,\n // re-run subscribeToPush. The pushManager.subscribe() call is\n // idempotent — it returns the existing subscription if the\n // endpoint is still valid, otherwise mints a new one — and we\n // POST the result to /v1/web_push/subscriptions which UPSERTs\n // on (property_id, device_fingerprint). One extra round-trip\n // per page load; cheap, deterministic, never need to debug\n // stale-endpoint mysteries again.\n if (typeof window !== 'undefined' && Notification.permission === 'granted') {\n this.subscribeToPush().catch((err) => {\n console.warn('[AegisWebPush] auto-resync subscribeToPush failed:', err);\n });\n }\n\n if (this.config.autoPrompt) {\n setTimeout(() => this.requestPermission(), this.config.promptDelay);\n }\n } catch (err) {\n console.error('[AegisWebPush] Service worker registration failed:', err);\n }\n }\n\n async requestPermission(): Promise<boolean> {\n const permission = await Notification.requestPermission();\n\n if (permission === 'granted') {\n await this.subscribeToPush();\n return true;\n }\n\n this.trackPushEvent('push.permission_denied', {});\n return false;\n }\n\n async identify(params: ContactIdentity): Promise<void> {\n // Persist the resolved contact_id so getStableFingerprint /\n // resolveContactId see it on the next subscribe call. Then re-run\n // the subscribe flow — the backend UPSERT on\n // (property_id, device_fingerprint) updates the existing row with\n // the new contact_id in place.\n try {\n if (params.contactId) {\n window.localStorage.setItem('aegis_contact_id', params.contactId);\n }\n } catch {\n // storage blocked — proceed anyway; subscribe() still works\n }\n\n const subscription = await this.swRegistration?.pushManager.getSubscription();\n if (!subscription) return;\n\n const subscriptionJSON = subscription.toJSON();\n const fingerprint = await this.getStableFingerprint();\n await this.retryApiCall(() =>\n this.apiClient.post(\n '/v1/web_push/subscriptions',\n {\n contact_id: params.contactId ?? this.resolveContactId(),\n endpoint: subscriptionJSON.endpoint!,\n p256dh: subscriptionJSON.keys!.p256dh!,\n auth: subscriptionJSON.keys!.auth!,\n device_fingerprint: fingerprint,\n user_agent: navigator.userAgent,\n },\n { 'X-Property-Id': this.config.propertyId }\n )\n );\n }\n\n async logout(): Promise<void> {\n const subscription = await this.swRegistration?.pushManager.getSubscription();\n if (!subscription) return;\n const subscriptionJSON = subscription.toJSON();\n const fingerprint = await this.getStableFingerprint();\n try {\n await this.apiClient.post(\n '/v1/web_push/unsubscribe',\n {\n contact_id: this.resolveContactId(),\n device_fingerprint: fingerprint,\n endpoint: subscriptionJSON.endpoint!,\n },\n { 'X-Property-Id': this.config.propertyId }\n );\n } finally {\n try {\n window.localStorage.removeItem('aegis_contact_id');\n } catch {\n // ignore\n }\n }\n }\n\n // ---------------------------------------------------------------\n // Private\n // ---------------------------------------------------------------\n\n private async subscribeToPush(): Promise<void> {\n if (!this.swRegistration) return;\n\n const subscription = await this.swRegistration.pushManager.subscribe({\n userVisibleOnly: true,\n applicationServerKey: this.urlBase64ToUint8Array(this.config.vapidPublicKey),\n });\n\n const subscriptionJSON = subscription.toJSON();\n const fingerprint = await this.getStableFingerprint();\n const contactId = this.resolveContactId();\n\n await this.retryApiCall(() =>\n this.apiClient.post(\n '/v1/web_push/subscriptions',\n {\n contact_id: contactId,\n endpoint: subscriptionJSON.endpoint!,\n p256dh: subscriptionJSON.keys!.p256dh!,\n auth: subscriptionJSON.keys!.auth!,\n device_fingerprint: fingerprint,\n user_agent: navigator.userAgent,\n },\n { 'X-Property-Id': this.config.propertyId }\n )\n );\n\n this.trackPushEvent('push.subscribed', {\n browser: this.getBrowserInfo(),\n property_id: this.config.propertyId,\n });\n }\n\n /**\n * Stable SHA-256 device fingerprint over (first_party_cookie_id + UA stable\n * parts). Used as the UPSERT key on `(property_id, device_fingerprint)` —\n * re-subscribes after VAPID rotation or permission reset update the same\n * row instead of leaving dangling duplicates.\n */\n private async getStableFingerprint(): Promise<string> {\n const cookieId = this.config.firstPartyCookieId;\n const ua = navigator.userAgent || '';\n const platform = navigator.platform || '';\n const language = navigator.language || '';\n const input = `${cookieId}|${ua}|${platform}|${language}`;\n if (typeof crypto !== 'undefined' && crypto.subtle) {\n const bytes = new TextEncoder().encode(input);\n const hash = await crypto.subtle.digest('SHA-256', bytes);\n return Array.from(new Uint8Array(hash))\n .map((b) => b.toString(16).padStart(2, '0'))\n .join('');\n }\n // Fallback only reachable in environments without Web Crypto —\n // push-capable browsers all have it, so this is defensive.\n let h = 0x811c9dc5;\n for (let i = 0; i < input.length; i++) {\n h ^= input.charCodeAt(i);\n h = (h + ((h << 1) + (h << 4) + (h << 7) + (h << 8) + (h << 24))) >>> 0;\n }\n return `fnv-${h.toString(16)}`;\n }\n\n /**\n * Resolve the current contact_id. AegisWebPush doesn't own identity, so\n * we look in a few well-known localStorage keys that the identity layer\n * of the SDK writes. If no known contact is set, we use the first-party\n * cookie id — the backend upgrades the row when identify() is called.\n */\n private resolveContactId(): string {\n try {\n const fromStorage =\n window.localStorage.getItem('aegis_contact_id') ||\n window.localStorage.getItem('aegis_user_id');\n if (fromStorage) return fromStorage;\n } catch {\n // storage blocked — fall through\n }\n return this.config.firstPartyCookieId;\n }\n\n /**\n * Retry an API call with exponential backoff (max 3 retries: 1s, 2s, 4s).\n */\n private async retryApiCall(fn: () => Promise<unknown>, maxRetries = 3): Promise<void> {\n for (let attempt = 0; attempt <= maxRetries; attempt++) {\n try {\n await fn();\n return;\n } catch (err) {\n if (attempt === maxRetries) {\n console.error('[AegisWebPush] API call failed after retries:', err);\n return;\n }\n const delay = 1000 * Math.pow(2, attempt);\n await new Promise((r) => setTimeout(r, delay));\n }\n }\n }\n\n /**\n * Handle messages forwarded from the service worker (push click, dismiss).\n */\n private handleSWMessage(data: Record<string, unknown>): void {\n if (!data || typeof data.type !== 'string') return;\n\n switch (data.type) {\n case 'push.clicked': {\n this.trackPushEvent('push.clicked', {\n campaign_id: data.campaign_id,\n action_url: data.action_url,\n action_type: data.action_type,\n });\n this.dispatchPushTap(data);\n break;\n }\n case 'push.dismissed':\n this.trackPushEvent('push.dismissed', {\n campaign_id: data.campaign_id,\n });\n this.emit('push-dismissed', {\n campaign_id: data.campaign_id as string | undefined,\n });\n break;\n case 'push.delivered':\n this.trackPushEvent('push.delivered', {\n campaign_id: data.campaign_id,\n });\n this.emit('push-shown', {\n campaign_id: data.campaign_id as string | undefined,\n degraded: data.degraded === true ? true : undefined,\n });\n break;\n case 'push.resubscribed':\n // SW caught a pushsubscriptionchange event and minted a new\n // push subscription. The browser side now has a fresh\n // endpoint; cell-plane still has the old one. Push the\n // updated payload up so the UPSERT keeps the row alive.\n // Without this, FCM pushes go to a dead endpoint with no\n // visible failure (FCM 201s regardless of token validity).\n void this.persistResubscription(\n data.subscription as PushSubscriptionJSON | undefined\n );\n break;\n }\n }\n\n /**\n * Translate a SW `push.clicked` postMessage into a typed PushTapEvent,\n * dispatch through the lifecycle hook bus, and fall back to a hard\n * navigation if no host handler claimed it.\n *\n * The fallback path matters: if a tenant ships a push template with\n * an unknown `action_type` (no SPA handler registered) OR pushes the\n * SDK before the host wires up its `onPushTap` subscriber, we still\n * want the user to land somewhere — `action_url` is always set by the\n * SW's notificationclick handler (it falls back to '/').\n */\n private dispatchPushTap(data: Record<string, unknown>): void {\n if (typeof window === 'undefined') return;\n const actionUrl = (data.action_url as string) || '/';\n let defaultPrevented = false;\n const evt: PushTapEvent = {\n action_type: data.action_type as string | undefined,\n action_payload: data.action_payload as Record<string, unknown> | undefined,\n action_url: actionUrl,\n action: (data.action as string) || 'default',\n campaign_id: data.campaign_id as string | undefined,\n preventDefault: () => {\n defaultPrevented = true;\n evt.defaultPrevented = true;\n },\n defaultPrevented: false,\n };\n const proceed = this.emit('push-tap', evt);\n if (proceed && !defaultPrevented) {\n // No subscriber claimed this tap (or the subscriber returned\n // void / didn't preventDefault). Default to a hard nav so the\n // user always lands somewhere actionable. SPAs that want\n // in-place handling MUST return false from their handler.\n try {\n window.location.href = actionUrl;\n } catch {\n // navigation blocked (sandboxed iframe, etc.) — host can\n // still handle via the hook\n }\n }\n }\n\n private async persistResubscription(\n subscription: PushSubscriptionJSON | undefined\n ): Promise<void> {\n if (!subscription || !subscription.endpoint || !subscription.keys) return;\n try {\n const fingerprint = await this.getStableFingerprint();\n await this.retryApiCall(() =>\n this.apiClient.post(\n '/v1/web_push/subscriptions',\n {\n contact_id: this.resolveContactId(),\n endpoint: subscription.endpoint!,\n p256dh: subscription.keys!.p256dh!,\n auth: subscription.keys!.auth!,\n device_fingerprint: fingerprint,\n user_agent: navigator.userAgent,\n },\n { 'X-Property-Id': this.config.propertyId }\n )\n );\n this.trackPushEvent('push.resubscribed', {});\n } catch (err) {\n console.warn('[AegisWebPush] persistResubscription failed:', err);\n }\n }\n\n private trackPushEvent(eventName: string, properties: Record<string, unknown>): void {\n this.eventTracker?.track(eventName, {\n ...properties,\n platform: 'web',\n browser: this.getBrowserInfo(),\n });\n }\n\n private getBrowserInfo(): string {\n const ua = navigator.userAgent;\n if (ua.includes('Edg')) return 'edge';\n if (ua.includes('Chrome')) return 'chrome';\n if (ua.includes('Firefox')) return 'firefox';\n if (ua.includes('Safari')) return 'safari';\n return 'unknown';\n }\n\n private urlBase64ToUint8Array(base64String: string): Uint8Array {\n const padding = '='.repeat((4 - (base64String.length % 4)) % 4);\n const base64 = (base64String + padding).replace(/-/g, '+').replace(/_/g, '/');\n const rawData = atob(base64);\n const arr = new Uint8Array(rawData.length);\n for (let i = 0; i < rawData.length; ++i) {\n arr[i] = rawData.charCodeAt(i);\n }\n return arr;\n }\n}\n"],"names":[],"mappings":"AAqIO,MAAM,aAAa;AAAA,EAsBtB,YACI,WACA,QACA,cACF;AAvBF,SAAQ,iBAAmD;AAE3D,SAAQ,cAAc;AAetB,SAAQ,4BAAY,IAAA;AAOhB,SAAK,YAAY;AACjB,SAAK,SAAS;AAAA,MACV,mBAAmB;AAAA,MACnB,oBAAoB;AAAA,MACpB,YAAY;AAAA,MACZ,aAAa;AAAA,MACb,GAAG;AAAA,IAAA;AAMP,QAAI,cAAc;AACd,WAAK,eAAe;AAAA,IACxB,WAAW,KAAK,OAAO,YAAY,KAAK,OAAO,gBAAgB;AAC3D,WAAK,eAAe,KAAK;AAAA,QACrB,KAAK,OAAO;AAAA,QACZ,KAAK,OAAO;AAAA,MAAA;AAAA,IAEpB,OAAO;AACH,WAAK,eAAe;AAAA,IACxB;A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AEQ,eAAe,WAAmB,YAA2C;AAzhBlF;AA0hBC,eAAK,iBAAL,mBAAmB,MAAM,WAAW;AAAA,MAChC,GAAG;AAAA,MACH,UAAU;AAAA,MACV,SAAS,KAAK,eAAA;AAAA,IAAe;AAAA,EAErC;AAAA,EAEQ,iBAAyB;AAC7B,UAAM,KAAK,UAAU;AACrB,QAAI,GAAG,SAAS,KAAK,EAAG,QAAO;AAC/B,QAAI,GAAG,SAAS,QAAQ,EAAG,QAAO;AAClC,QAAI,GAAG,SAAS,SAAS,EAAG,QAAO;AACnC,QAAI,GAAG,SAAS,QAAQ,EAAG,QAAO;AAClC,WAAO;AAAA,EACX;AAAA,EAEQ,sBAAsB,cAAkC;AAC5D,UAAM,UAAU,IAAI,QAAQ,IAAK,aAAa,SAAS,KAAM,CAAC;AAC9D,UAAM,UAAU,eAAe,SAAS,QAAQ,MAAM,GAAG,EAAE,QAAQ,MAAM,GAAG;AAC5E,UAAM,UAAU,KAAK,MAAM;AAC3B,UAAM,MAAM,IAAI,WAAW,QAAQ,MAAM;AACzC,aAAS,IAAI,GAAG,IAAI,QAAQ,QAAQ,EAAE,GAAG;AACrC,UAAI,CAAC,IAAI,QAAQ,WAAW,CAAC;AAAA,IACjC;AACA,WAAO;AAAA,EACX;AACJ;"}
|
|
1
|
+
{"version":3,"file":"AegisWebPush.js","sources":["../../src/push/AegisWebPush.ts"],"sourcesContent":["export interface AegisAPIClient {\n post(\n endpoint: string,\n payload: Record<string, unknown>,\n headers?: Record<string, string>\n ): Promise<unknown>;\n}\n\nexport interface ContactIdentity {\n contactId?: string;\n shopifyCustomerId?: string;\n email?: string;\n}\n\nexport interface AegisWebPushConfig {\n vapidPublicKey: string;\n // SubscriptionProperty binding — supplied by the embedding host (e.g.\n // the storefront SSR via the `sdk.property_id` field on /store/{slug}).\n // Required: every subscribe call sends it back as `X-Property-Id` so\n // the backend pins the row to the right origin.\n propertyId: string;\n // Stable per-browser cookie id (e.g. aegis_fpc). Used as the\n // device-fingerprint salt so a fresh subscribe after VAPID rotation\n // upserts onto the same `web_push_subscriptions` row.\n firstPartyCookieId: string;\n autoPrompt?: boolean;\n promptDelay?: number;\n serviceWorkerPath?: string;\n serviceWorkerScope?: string;\n // Engagement-event reporting credentials. When BOTH `writeKey` and\n // `organizationId` are provided AND the caller does NOT pass an\n // explicit `eventTracker` to the constructor, AegisWebPush auto-wires\n // a built-in tracker that POSTs push lifecycle events\n // (push.delivered / push.dismissed / push.clicked) to\n // `/v1/push/engagement` — closing the long-standing gap where shown\n // + dismissed signals (only the device-side SDK can report them)\n // never reached `aegis.delivery_events`. See backend dual-route at\n // `apps/event-ingress/src/services/event-switchboard.ts`\n // (SDK_ENGAGEMENT_EVENT_TO_DELIVERY_MAPPING).\n //\n // Callers using `AegisMessageRuntime` should keep passing the\n // runtime's analytics adapter as `eventTracker` — these fields are\n // only the standalone-init fallback.\n writeKey?: string;\n organizationId?: string;\n}\n\nexport interface PushEventTracker {\n track(eventName: string, properties: Record<string, unknown>): void;\n}\n\n/**\n * Payload for the `push-tap` lifecycle event. CANCELLABLE — return `false`\n * (or call `evt.preventDefault()`) from a handler to suppress the SDK's\n * default `window.location.href` fallback navigation. Use this to dispatch\n * an in-place state change in a SPA host instead of a hard reload.\n *\n * `action_type` + `action_payload` are author-controlled fields baked into\n * the push template's `data` block:\n *\n * ```json\n * {\n * \"title\": \"Your cart is waiting\",\n * \"body\": \"...\",\n * \"action_url\": \"https://shop.actii.me/?step=cart\",\n * \"data\": {\n * \"action_type\": \"open_cart\",\n * \"action_payload\": { \"step\": \"cart\" }\n * }\n * }\n * ```\n */\nexport interface PushTapEvent {\n /** Author-controlled action discriminator (e.g. `open_cart`,\n * `open_payment_link`, `open_order`). When unset, the SDK runs its\n * default fallback navigation to `action_url`. */\n action_type?: string;\n /** Optional structured args the host SPA forwards to its handler. */\n action_payload?: Record<string, unknown>;\n /** Sanitized destination URL — used as the SDK's default fallback nav\n * target when no host handler cancels. */\n action_url: string;\n /** Action-button id when the user clicked a specific button on a\n * multi-button notification; `'default'` for body taps. */\n action: string;\n /** Source campaign id from the push payload — useful for SPA routing\n * (e.g. open_cart from a cart-recovery campaign vs from a generic\n * catch-all template). */\n campaign_id?: string;\n /** Mutate via `evt.preventDefault()` to signal the SDK to skip its\n * default hard-navigation. Identical semantics to DOM CustomEvent. */\n preventDefault: () => void;\n defaultPrevented: boolean;\n}\n\n/** Payload for `push-shown` — fires after `showNotification` resolves on\n * the SW side. The `degraded` flag is true when the SW had to fall back\n * to its minimal `{title, body}` retry path (broken icon URL etc.). */\nexport interface PushShownEvent {\n campaign_id?: string;\n degraded?: boolean;\n}\n\n/** Payload for `push-dismissed` — fires when the user closes the\n * notification without clicking. */\nexport interface PushDismissEvent {\n campaign_id?: string;\n}\n\n/** Payload for `error` — non-fatal SDK errors (subscribe failures,\n * resubscribe persist failures, host-handler throws). Wire into Sentry\n * / Datadog RUM. */\nexport interface PushErrorEvent {\n message: string;\n error: unknown;\n context: Record<string, unknown>;\n}\n\n/** Map of lifecycle event name → handler signature. Mirrors 1.8.0\n * in-app lifecycle for consistency. */\nexport interface WebPushLifecycleEventMap {\n 'push-tap': (evt: PushTapEvent) => void | false;\n 'push-shown': (evt: PushShownEvent) => void;\n 'push-dismissed': (evt: PushDismissEvent) => void;\n 'error': (evt: PushErrorEvent) => void;\n}\n\n/**\n * AegisWebPush — Web Push notification manager.\n *\n * Handles service worker registration, push subscription via VAPID,\n * token registration with the backend, and push event tracking.\n */\nexport class AegisWebPush {\n private apiClient: AegisAPIClient;\n private eventTracker: PushEventTracker | null;\n private swRegistration: ServiceWorkerRegistration | null = null;\n private config: AegisWebPushConfig;\n private initialized = false;\n\n // ── Lifecycle event bus (1.8.5) ────────────────────────────────────────\n // Typed handler registry, parity with AegisInAppManager (1.8.0).\n // Hosts register via the public `on*` methods below; calling the\n // returned unsubscribe fn removes the handler. Multiple subscribers per\n // event are supported. Cancellable events (`push-tap`) suppress the\n // SDK's default behaviour when a handler returns `false` or calls\n // `evt.preventDefault()`.\n //\n // Industry parity: matches CleverTap `notificationCallback`, OneSignal\n // `addEventListener('notificationOpened')`, MoEngage\n // `onSelfHandledClick`, WebEngage `notificationCallback`. The SW posts\n // a `push.clicked` message; this class translates that into a typed\n // PushTapEvent with cancellable default-nav behaviour.\n private hooks = new Map<string, Set<(...args: unknown[]) => void | false | undefined>>();\n\n constructor(\n apiClient: AegisAPIClient,\n config: AegisWebPushConfig,\n eventTracker?: PushEventTracker\n ) {\n this.apiClient = apiClient;\n this.config = {\n serviceWorkerPath: '/aegis-sw.js',\n serviceWorkerScope: '/',\n autoPrompt: false,\n promptDelay: 5000,\n ...config,\n };\n // Explicit eventTracker wins (typical AegisMessageRuntime flow).\n // Otherwise, if both `writeKey` and `organizationId` are configured,\n // wire the built-in tracker that POSTs to `/v1/push/engagement` so\n // standalone push installs don't silently drop lifecycle events.\n if (eventTracker) {\n this.eventTracker = eventTracker;\n } else if (this.config.writeKey && this.config.organizationId) {\n this.eventTracker = this.createBuiltinEventTracker(\n this.config.writeKey,\n this.config.organizationId,\n );\n } else {\n this.eventTracker = null;\n }\n }\n\n /** Built-in fallback that POSTs push lifecycle events to\n * `/v1/push/engagement`. The gateway forwards to event-ingress with\n * the canonical `push.<event>` event_type, which the\n * event-switchboard's SDK_ENGAGEMENT_EVENT_TO_DELIVERY_MAPPING\n * dual-routes onto `aegis.delivery_events` as\n * `channel='push', status='shown'|'dismissed'|...`. Best-effort —\n * failures are warned but never thrown (push SW callbacks shouldn't\n * reject because the analytics POST failed). */\n private createBuiltinEventTracker(\n writeKey: string,\n organizationId: string,\n ): PushEventTracker {\n const apiClient = this.apiClient;\n const propertyId = this.config.propertyId;\n const resolveContactId = () => this.resolveContactId();\n return {\n track(eventName: string, properties: Record<string, unknown>): void {\n const contactId =\n (properties.contact_id as string | undefined) ?? resolveContactId();\n const body = {\n campaign_id: (properties.campaign_id as string | undefined) || '',\n message_id: (properties.message_id as string | undefined) || '',\n event_type: eventName, // e.g. 'push.delivered' — gateway tolerates either form\n user_id: (properties.user_id as string | undefined) || contactId,\n contact_id: contactId,\n anonymous_id: (properties.anonymous_id as string | undefined) || '',\n platform: (properties.platform as string | undefined) || 'web',\n property_id: propertyId,\n metadata: (properties.metadata as Record<string, unknown> | undefined) ?? {},\n };\n const headers = {\n 'X-Aegis-Write-Key': writeKey,\n 'X-Organization-ID': organizationId,\n 'X-Property-Id': propertyId,\n };\n void Promise.resolve(\n apiClient.post('/v1/push/engagement', body, headers),\n ).catch((err) => {\n if (typeof console !== 'undefined' && console.warn) {\n console.warn('[Active Reach WebPush] engagement report failed:', err);\n }\n });\n },\n };\n }\n\n // ── Public lifecycle hook API ──────────────────────────────────────────\n\n /** Generic typed subscribe — useful when the host wants to dispatch\n * multiple events through one wrapper. For single-event subscriptions\n * prefer the `on*` sugar methods below. */\n on<E extends keyof WebPushLifecycleEventMap>(\n event: E,\n handler: WebPushLifecycleEventMap[E],\n ): () => void {\n return this.register(event, handler as never);\n }\n\n /** Subscribe to push notification taps. CANCELLABLE — return `false`\n * (or call `evt.preventDefault()`) to suppress the SDK's default\n * `window.location.href = action_url` fallback. Use this to wire a\n * SPA router into the typed `action_type` payload (e.g. open the\n * cart drawer in-place instead of a full reload). */\n onPushTap(\n handler: (evt: PushTapEvent) => void | false,\n ): () => void {\n return this.register('push-tap', handler);\n }\n\n /** Subscribe to push impressions — fires after the OS notification\n * has actually rendered. `degraded=true` when the SW fell back to\n * the minimal `{title, body}` path (broken icon, etc.). */\n onPushShown(\n handler: (evt: PushShownEvent) => void,\n ): () => void {\n return this.register('push-shown', handler);\n }\n\n /** Subscribe to push dismissals (notification closed without a tap). */\n onPushDismiss(\n handler: (evt: PushDismissEvent) => void,\n ): () => void {\n return this.register('push-dismissed', handler);\n }\n\n /** Subscribe to non-fatal SDK errors. Wire into Sentry / Datadog. */\n onError(\n handler: (evt: PushErrorEvent) => void,\n ): () => void {\n return this.register('error', handler);\n }\n\n private register<T>(\n eventName: string,\n handler: (payload: T) => void | false | undefined,\n ): () => void {\n if (!this.hooks.has(eventName)) this.hooks.set(eventName, new Set());\n this.hooks.get(eventName)!.add(handler as (...args: unknown[]) => void | false | undefined);\n return () => {\n this.hooks.get(eventName)?.delete(handler as (...args: unknown[]) => void | false | undefined);\n };\n }\n\n private emit<T>(eventName: string, payload: T): boolean {\n const handlers = this.hooks.get(eventName);\n if (!handlers || handlers.size === 0) return true;\n let proceed = true;\n for (const handler of handlers) {\n try {\n const result = (handler as (p: T) => void | false | undefined)(payload);\n if (result === false) proceed = false;\n } catch (err) {\n this.emitError(err, { event: eventName });\n }\n }\n return proceed;\n }\n\n private emitError(err: unknown, context?: Record<string, unknown>): void {\n const handlers = this.hooks.get('error');\n if (!handlers || handlers.size === 0) {\n console.warn(\n '[Active Reach WebPush] error:',\n err instanceof Error ? err.message : String(err),\n context ?? {}\n );\n return;\n }\n for (const handler of handlers) {\n try {\n (handler as (e: PushErrorEvent) => void)({\n message: err instanceof Error ? err.message : String(err),\n error: err,\n context: context ?? {},\n });\n } catch {\n // already in error path — don't loop\n }\n }\n }\n\n async initialize(): Promise<void> {\n if (this.initialized) return;\n\n if (!('serviceWorker' in navigator) || !('PushManager' in window)) {\n console.warn('[Active Reach WebPush] Push notifications not supported in this browser');\n return;\n }\n\n try {\n this.swRegistration = await navigator.serviceWorker.register(\n this.config.serviceWorkerPath!,\n { scope: this.config.serviceWorkerScope }\n );\n await navigator.serviceWorker.ready;\n this.initialized = true;\n\n // Listen for messages from the service worker (click/dismiss tracking,\n // and pushsubscriptionchange relay — see handleSWMessage).\n navigator.serviceWorker.addEventListener('message', (event) => {\n this.handleSWMessage(event.data);\n });\n\n // Heal endpoint drift on every page load.\n //\n // Background: when the SW updates with skipWaiting+clients.claim\n // (added in 1.7.3), some browsers — Samsung Internet most\n // aggressively, occasionally Chrome too — silently regenerate the\n // push subscription mid-flight. The SW catches the\n // pushsubscriptionchange event and resubscribes locally, but\n // historically the new endpoint never made it back to the\n // backend. Cell-plane kept FCM-pushing to the dead endpoint;\n // FCM 201s on receipt regardless of whether the token is alive,\n // so the silent failure was invisible until users complained.\n //\n // Fix: whenever permission is already granted at init time,\n // re-run subscribeToPush. The pushManager.subscribe() call is\n // idempotent — it returns the existing subscription if the\n // endpoint is still valid, otherwise mints a new one — and we\n // POST the result to /v1/web_push/subscriptions which UPSERTs\n // on (property_id, device_fingerprint). One extra round-trip\n // per page load; cheap, deterministic, never need to debug\n // stale-endpoint mysteries again.\n if (typeof window !== 'undefined' && Notification.permission === 'granted') {\n this.subscribeToPush().catch((err) => {\n console.warn('[Active Reach WebPush] auto-resync subscribeToPush failed:', err);\n });\n }\n\n if (this.config.autoPrompt) {\n setTimeout(() => this.requestPermission(), this.config.promptDelay);\n }\n } catch (err) {\n console.error('[Active Reach WebPush] Service worker registration failed:', err);\n }\n }\n\n async requestPermission(): Promise<boolean> {\n const permission = await Notification.requestPermission();\n\n if (permission === 'granted') {\n await this.subscribeToPush();\n return true;\n }\n\n this.trackPushEvent('push.permission_denied', {});\n return false;\n }\n\n async identify(params: ContactIdentity): Promise<void> {\n // Persist the resolved contact_id so getStableFingerprint /\n // resolveContactId see it on the next subscribe call. Then re-run\n // the subscribe flow — the backend UPSERT on\n // (property_id, device_fingerprint) updates the existing row with\n // the new contact_id in place.\n try {\n if (params.contactId) {\n window.localStorage.setItem('aegis_contact_id', params.contactId);\n }\n } catch {\n // storage blocked — proceed anyway; subscribe() still works\n }\n\n const subscription = await this.swRegistration?.pushManager.getSubscription();\n if (!subscription) return;\n\n const subscriptionJSON = subscription.toJSON();\n const fingerprint = await this.getStableFingerprint();\n await this.retryApiCall(() =>\n this.apiClient.post(\n '/v1/web_push/subscriptions',\n {\n contact_id: params.contactId ?? this.resolveContactId(),\n endpoint: subscriptionJSON.endpoint!,\n p256dh: subscriptionJSON.keys!.p256dh!,\n auth: subscriptionJSON.keys!.auth!,\n device_fingerprint: fingerprint,\n user_agent: navigator.userAgent,\n },\n { 'X-Property-Id': this.config.propertyId }\n )\n );\n }\n\n async logout(): Promise<void> {\n const subscription = await this.swRegistration?.pushManager.getSubscription();\n if (!subscription) return;\n const subscriptionJSON = subscription.toJSON();\n const fingerprint = await this.getStableFingerprint();\n try {\n await this.apiClient.post(\n '/v1/web_push/unsubscribe',\n {\n contact_id: this.resolveContactId(),\n device_fingerprint: fingerprint,\n endpoint: subscriptionJSON.endpoint!,\n },\n { 'X-Property-Id': this.config.propertyId }\n );\n } finally {\n try {\n window.localStorage.removeItem('aegis_contact_id');\n } catch {\n // ignore\n }\n }\n }\n\n // ---------------------------------------------------------------\n // Private\n // ---------------------------------------------------------------\n\n private async subscribeToPush(): Promise<void> {\n if (!this.swRegistration) return;\n\n const subscription = await this.swRegistration.pushManager.subscribe({\n userVisibleOnly: true,\n applicationServerKey: this.urlBase64ToUint8Array(this.config.vapidPublicKey),\n });\n\n const subscriptionJSON = subscription.toJSON();\n const fingerprint = await this.getStableFingerprint();\n const contactId = this.resolveContactId();\n\n await this.retryApiCall(() =>\n this.apiClient.post(\n '/v1/web_push/subscriptions',\n {\n contact_id: contactId,\n endpoint: subscriptionJSON.endpoint!,\n p256dh: subscriptionJSON.keys!.p256dh!,\n auth: subscriptionJSON.keys!.auth!,\n device_fingerprint: fingerprint,\n user_agent: navigator.userAgent,\n },\n { 'X-Property-Id': this.config.propertyId }\n )\n );\n\n this.trackPushEvent('push.subscribed', {\n browser: this.getBrowserInfo(),\n property_id: this.config.propertyId,\n });\n }\n\n /**\n * Stable SHA-256 device fingerprint over (first_party_cookie_id + UA stable\n * parts). Used as the UPSERT key on `(property_id, device_fingerprint)` —\n * re-subscribes after VAPID rotation or permission reset update the same\n * row instead of leaving dangling duplicates.\n */\n private async getStableFingerprint(): Promise<string> {\n const cookieId = this.config.firstPartyCookieId;\n const ua = navigator.userAgent || '';\n const platform = navigator.platform || '';\n const language = navigator.language || '';\n const input = `${cookieId}|${ua}|${platform}|${language}`;\n if (typeof crypto !== 'undefined' && crypto.subtle) {\n const bytes = new TextEncoder().encode(input);\n const hash = await crypto.subtle.digest('SHA-256', bytes);\n return Array.from(new Uint8Array(hash))\n .map((b) => b.toString(16).padStart(2, '0'))\n .join('');\n }\n // Fallback only reachable in environments without Web Crypto —\n // push-capable browsers all have it, so this is defensive.\n let h = 0x811c9dc5;\n for (let i = 0; i < input.length; i++) {\n h ^= input.charCodeAt(i);\n h = (h + ((h << 1) + (h << 4) + (h << 7) + (h << 8) + (h << 24))) >>> 0;\n }\n return `fnv-${h.toString(16)}`;\n }\n\n /**\n * Resolve the current contact_id. AegisWebPush doesn't own identity, so\n * we look in a few well-known localStorage keys that the identity layer\n * of the SDK writes. If no known contact is set, we use the first-party\n * cookie id — the backend upgrades the row when identify() is called.\n */\n private resolveContactId(): string {\n try {\n const fromStorage =\n window.localStorage.getItem('aegis_contact_id') ||\n window.localStorage.getItem('aegis_user_id');\n if (fromStorage) return fromStorage;\n } catch {\n // storage blocked — fall through\n }\n return this.config.firstPartyCookieId;\n }\n\n /**\n * Retry an API call with exponential backoff (max 3 retries: 1s, 2s, 4s).\n */\n private async retryApiCall(fn: () => Promise<unknown>, maxRetries = 3): Promise<void> {\n for (let attempt = 0; attempt <= maxRetries; attempt++) {\n try {\n await fn();\n return;\n } catch (err) {\n if (attempt === maxRetries) {\n console.error('[Active Reach WebPush] API call failed after retries:', err);\n return;\n }\n const delay = 1000 * Math.pow(2, attempt);\n await new Promise((r) => setTimeout(r, delay));\n }\n }\n }\n\n /**\n * Handle messages forwarded from the service worker (push click, dismiss).\n */\n private handleSWMessage(data: Record<string, unknown>): void {\n if (!data || typeof data.type !== 'string') return;\n\n switch (data.type) {\n case 'push.clicked': {\n this.trackPushEvent('push.clicked', {\n campaign_id: data.campaign_id,\n action_url: data.action_url,\n action_type: data.action_type,\n });\n this.dispatchPushTap(data);\n break;\n }\n case 'push.dismissed':\n this.trackPushEvent('push.dismissed', {\n campaign_id: data.campaign_id,\n });\n this.emit('push-dismissed', {\n campaign_id: data.campaign_id as string | undefined,\n });\n break;\n case 'push.delivered':\n this.trackPushEvent('push.delivered', {\n campaign_id: data.campaign_id,\n });\n this.emit('push-shown', {\n campaign_id: data.campaign_id as string | undefined,\n degraded: data.degraded === true ? true : undefined,\n });\n break;\n case 'push.resubscribed':\n // SW caught a pushsubscriptionchange event and minted a new\n // push subscription. The browser side now has a fresh\n // endpoint; cell-plane still has the old one. Push the\n // updated payload up so the UPSERT keeps the row alive.\n // Without this, FCM pushes go to a dead endpoint with no\n // visible failure (FCM 201s regardless of token validity).\n void this.persistResubscription(\n data.subscription as PushSubscriptionJSON | undefined\n );\n break;\n }\n }\n\n /**\n * Translate a SW `push.clicked` postMessage into a typed PushTapEvent,\n * dispatch through the lifecycle hook bus, and fall back to a hard\n * navigation if no host handler claimed it.\n *\n * The fallback path matters: if a tenant ships a push template with\n * an unknown `action_type` (no SPA handler registered) OR pushes the\n * SDK before the host wires up its `onPushTap` subscriber, we still\n * want the user to land somewhere — `action_url` is always set by the\n * SW's notificationclick handler (it falls back to '/').\n */\n private dispatchPushTap(data: Record<string, unknown>): void {\n if (typeof window === 'undefined') return;\n const actionUrl = (data.action_url as string) || '/';\n let defaultPrevented = false;\n const evt: PushTapEvent = {\n action_type: data.action_type as string | undefined,\n action_payload: data.action_payload as Record<string, unknown> | undefined,\n action_url: actionUrl,\n action: (data.action as string) || 'default',\n campaign_id: data.campaign_id as string | undefined,\n preventDefault: () => {\n defaultPrevented = true;\n evt.defaultPrevented = true;\n },\n defaultPrevented: false,\n };\n const proceed = this.emit('push-tap', evt);\n if (proceed && !defaultPrevented) {\n // No subscriber claimed this tap (or the subscriber returned\n // void / didn't preventDefault). Default to a hard nav so the\n // user always lands somewhere actionable. SPAs that want\n // in-place handling MUST return false from their handler.\n try {\n window.location.href = actionUrl;\n } catch {\n // navigation blocked (sandboxed iframe, etc.) — host can\n // still handle via the hook\n }\n }\n }\n\n private async persistResubscription(\n subscription: PushSubscriptionJSON | undefined\n ): Promise<void> {\n if (!subscription || !subscription.endpoint || !subscription.keys) return;\n try {\n const fingerprint = await this.getStableFingerprint();\n await this.retryApiCall(() =>\n this.apiClient.post(\n '/v1/web_push/subscriptions',\n {\n contact_id: this.resolveContactId(),\n endpoint: subscription.endpoint!,\n p256dh: subscription.keys!.p256dh!,\n auth: subscription.keys!.auth!,\n device_fingerprint: fingerprint,\n user_agent: navigator.userAgent,\n },\n { 'X-Property-Id': this.config.propertyId }\n )\n );\n this.trackPushEvent('push.resubscribed', {});\n } catch (err) {\n console.warn('[Active Reach WebPush] persistResubscription failed:', err);\n }\n }\n\n private trackPushEvent(eventName: string, properties: Record<string, unknown>): void {\n this.eventTracker?.track(eventName, {\n ...properties,\n platform: 'web',\n browser: this.getBrowserInfo(),\n });\n }\n\n private getBrowserInfo(): string {\n const ua = navigator.userAgent;\n if (ua.includes('Edg')) return 'edge';\n if (ua.includes('Chrome')) return 'chrome';\n if (ua.includes('Firefox')) return 'firefox';\n if (ua.includes('Safari')) return 'safari';\n return 'unknown';\n }\n\n private urlBase64ToUint8Array(base64String: string): Uint8Array {\n const padding = '='.repeat((4 - (base64String.length % 4)) % 4);\n const base64 = (base64String + padding).replace(/-/g, '+').replace(/_/g, '/');\n const rawData = atob(base64);\n const arr = new Uint8Array(rawData.length);\n for (let i = 0; i < rawData.length; ++i) {\n arr[i] = rawData.charCodeAt(i);\n }\n return arr;\n }\n}\n"],"names":[],"mappings":"AAqIO,MAAM,aAAa;AAAA,EAsBtB,YACI,WACA,QACA,cACF;AAvBF,SAAQ,iBAAmD;AAE3D,SAAQ,cAAc;AAetB,SAAQ,4BAAY,IAAA;AAOhB,SAAK,YAAY;AACjB,SAAK,SAAS;AAAA,MACV,mBAAmB;AAAA,MACnB,oBAAoB;AAAA,MACpB,YAAY;AAAA,MACZ,aAAa;AAAA,MACb,GAAG;AAAA,IAAA;AAMP,QAAI,cAAc;AACd,WAAK,eAAe;AAAA,IACxB,WAAW,KAAK,OAAO,YAAY,KAAK,OAAO,gBAAgB;AAC3D,WAAK,eAAe,KAAK;AAAA,QACrB,KAAK,OAAO;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IAC/C,SAAS,KAAK;AACV,cAAQ,KAAK,wDAAwD,GAAG;AAAA,IAC5E;AAAA,EACJ;AAAA,EAEQ,eAAe,WAAmB,YAA2C;AAzhBlF;AA0hBC,eAAK,iBAAL,mBAAmB,MAAM,WAAW;AAAA,MAChC,GAAG;AAAA,MACH,UAAU;AAAA,MACV,SAAS,KAAK,eAAA;AAAA,IAAe;AAAA,EAErC;AAAA,EAEQ,iBAAyB;AAC7B,UAAM,KAAK,UAAU;AACrB,QAAI,GAAG,SAAS,KAAK,EAAG,QAAO;AAC/B,QAAI,GAAG,SAAS,QAAQ,EAAG,QAAO;AAClC,QAAI,GAAG,SAAS,SAAS,EAAG,QAAO;AACnC,QAAI,GAAG,SAAS,QAAQ,EAAG,QAAO;AAClC,WAAO;AAAA,EACX;AAAA,EAEQ,sBAAsB,cAAkC;AAC5D,UAAM,UAAU,IAAI,QAAQ,IAAK,aAAa,SAAS,KAAM,CAAC;AAC9D,UAAM,UAAU,eAAe,SAAS,QAAQ,MAAM,GAAG,EAAE,QAAQ,MAAM,GAAG;AAC5E,UAAM,UAAU,KAAK,MAAM;AAC3B,UAAM,MAAM,IAAI,WAAW,QAAQ,MAAM;AACzC,aAAS,IAAI,GAAG,IAAI,QAAQ,QAAQ,EAAE,GAAG;AACrC,UAAI,CAAC,IAAI,QAAQ,WAAW,CAAC;AAAA,IACjC;AACA,WAAO;AAAA,EACX;AACJ;"}
|
package/dist/react.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { createContext, useState, useEffect, useContext } from "react";
|
|
2
|
-
import { A as Aegis } from "./analytics-
|
|
2
|
+
import { A as Aegis } from "./analytics-CjLItVo2.mjs";
|
|
3
3
|
const AegisContext = createContext({
|
|
4
4
|
aegis: null,
|
|
5
5
|
isReady: false
|
|
@@ -15,7 +15,7 @@ const AegisProvider = ({
|
|
|
15
15
|
aegis.init(writeKey, config).then(() => {
|
|
16
16
|
setIsReady(true);
|
|
17
17
|
}).catch((error) => {
|
|
18
|
-
console.error("[
|
|
18
|
+
console.error("[Active Reach] Initialization failed:", error);
|
|
19
19
|
});
|
|
20
20
|
return () => {
|
|
21
21
|
aegis.destroy();
|
package/dist/react.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.js","sources":["../src/integrations/react.tsx"],"sourcesContent":["import React, { createContext, useContext, useEffect, useState } from 'react';\nimport { Aegis } from '../core/analytics';\nimport { AegisConfig } from '../types/config';\n\ninterface AegisContextValue {\n aegis: Aegis | null;\n isReady: boolean;\n}\n\nconst AegisContext = createContext<AegisContextValue>({\n aegis: null,\n isReady: false,\n});\n\nexport interface AegisProviderProps {\n writeKey: string;\n config?: Partial<AegisConfig>;\n children: React.ReactNode;\n}\n\nexport const AegisProvider: React.FC<AegisProviderProps> = ({\n writeKey,\n config,\n children,\n}) => {\n const [aegis] = useState(() => new Aegis());\n const [isReady, setIsReady] = useState(false);\n\n useEffect(() => {\n aegis\n .init(writeKey, config)\n .then(() => {\n setIsReady(true);\n })\n .catch((error) => {\n console.error('[
|
|
1
|
+
{"version":3,"file":"react.js","sources":["../src/integrations/react.tsx"],"sourcesContent":["import React, { createContext, useContext, useEffect, useState } from 'react';\nimport { Aegis } from '../core/analytics';\nimport { AegisConfig } from '../types/config';\n\ninterface AegisContextValue {\n aegis: Aegis | null;\n isReady: boolean;\n}\n\nconst AegisContext = createContext<AegisContextValue>({\n aegis: null,\n isReady: false,\n});\n\nexport interface AegisProviderProps {\n writeKey: string;\n config?: Partial<AegisConfig>;\n children: React.ReactNode;\n}\n\nexport const AegisProvider: React.FC<AegisProviderProps> = ({\n writeKey,\n config,\n children,\n}) => {\n const [aegis] = useState(() => new Aegis());\n const [isReady, setIsReady] = useState(false);\n\n useEffect(() => {\n aegis\n .init(writeKey, config)\n .then(() => {\n setIsReady(true);\n })\n .catch((error) => {\n console.error('[Active Reach] Initialization failed:', error);\n });\n\n return () => {\n aegis.destroy();\n };\n }, [aegis, writeKey, config]);\n\n return (\n <AegisContext.Provider value={{ aegis, isReady }}>\n {children}\n </AegisContext.Provider>\n );\n};\n\nexport const useAegis = (): AegisContextValue => {\n const context = useContext(AegisContext);\n\n if (!context) {\n throw new Error('useAegis must be used within AegisProvider');\n }\n\n return context;\n};\n\nexport const useTrackEvent = () => {\n const { aegis, isReady } = useAegis();\n\n return React.useCallback(\n (eventName: string, properties?: Record<string, any>) => {\n if (isReady && aegis) {\n aegis.track(eventName, properties);\n }\n },\n [aegis, isReady]\n );\n};\n\nexport const usePageView = (\n pageName?: string,\n properties?: Record<string, any>,\n dependencies: any[] = []\n) => {\n const { aegis, isReady } = useAegis();\n\n useEffect(() => {\n if (isReady && aegis) {\n aegis.page(pageName, properties);\n }\n }, [aegis, isReady, pageName, ...dependencies]);\n};\n\nexport const useIdentifyUser = () => {\n const { aegis, isReady } = useAegis();\n\n return React.useCallback(\n (userId: string, traits?: Record<string, any>) => {\n if (isReady && aegis) {\n aegis.identify(userId, traits);\n }\n },\n [aegis, isReady]\n );\n};\n"],"names":[],"mappings":";;AASA,MAAM,eAAe,cAAiC;AAAA,EACpD,OAAO;AAAA,EACP,SAAS;AACX,CAAC;AAQM,MAAM,gBAA8C,CAAC;AAAA,EAC1D;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,CAAC,KAAK,IAAI,SAAS,MAAM,IAAI,OAAO;AAC1C,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,KAAK;AAE5C,YAAU,MAAM;AACd,UACG,KAAK,UAAU,MAAM,EACrB,KAAK,MAAM;AACV,iBAAW,IAAI;AAAA,IACjB,CAAC,EACA,MAAM,CAAC,UAAU;AAChB,cAAQ,MAAM,yCAAyC,KAAK;AAAA,IAC9D,CAAC;AAEH,WAAO,MAAM;AACX,YAAM,QAAA;AAAA,IACR;AAAA,EACF,GAAG,CAAC,OAAO,UAAU,MAAM,CAAC;AAE5B,SACE,sBAAA,cAAC,aAAa,UAAb,EAAsB,OAAO,EAAE,OAAO,UAAQ,G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;;OAOG;IACG,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKvD;;;;;;OAMG;IACH,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,IAAI;IAI/E;;;;;;;;;;;;;;;;OAgBG;IACH,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAIxC;;;;;OAKG;IACH,OAAO,IAAI,IAAI;IAMf;;;;;OAKG;IACH,YAAY,IAAI,aAAa,EAAE;CAMhC"}
|
package/dist/snippet.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){var e=window.aegis=window.aegis||[];if(!e.invoked){e.invoked=!0,e.methods=["init","track","identify","page","screen","group","alias","reset","flush","use","debug","setCell","getCellInfo","getAnonymousId","getUserId","getSessionId","setConsent","grantConsent","denyConsent","hasConsent","getConsentPreferences","onConsentChange","user.login","user.logout","user.setAttribute","user.setAttributes","user.setEmail","user.setPhone","user.setHashedEmail","user.setHashedPhone","user.setBirthDate","user.setOptIn","user.setSecureToken"],e.factory=function(t){return function(){var
|
|
1
|
+
!function(){var e=window.aegis=window.aegis||[];if(!e.invoked){e.invoked=!0,e.methods=["init","track","identify","page","screen","group","alias","reset","flush","use","debug","setCell","getCellInfo","getAnonymousId","getUserId","getSessionId","setConsent","grantConsent","denyConsent","hasConsent","getConsentPreferences","onConsentChange","user.login","user.logout","user.setAttribute","user.setAttributes","user.setEmail","user.setPhone","user.setHashedEmail","user.setHashedPhone","user.setBirthDate","user.setOptIn","user.setSecureToken"],e.factory=function(t){return function(){var n=Array.prototype.slice.call(arguments);return n.unshift(t),e.push(n),e}};for(var t=0;t<e.methods.length;t++){var n=e.methods[t];if(-1===n.indexOf("."))e[n]=e.factory(n);else{for(var s=n.split("."),r=e,o=0;o<s.length-1;o++)r[s[o]]=r[s[o]]||{},r=r[s[o]];r[s[s.length-1]]=e.factory(n)}}e.load=function(t,n){var s=document.createElement("script");s.type="text/javascript",s.async=!0,s.src=n&&n.cdnUrl?n.cdnUrl:"https://cdn.activereach.ai/sdk/aegis.min.js",s.onerror=function(){window.console&&console.error("Active Reach SDK failed to load")};var r=document.getElementsByTagName("script")[0];r.parentNode.insertBefore(s,r),e._loadOptions={key:t,options:n}},e.SNIPPET_VERSION="1.1.0"}}();
|
package/dist/types/events.d.ts
CHANGED
|
@@ -62,7 +62,27 @@ export interface BaseEvent {
|
|
|
62
62
|
anonymousId: string;
|
|
63
63
|
userId?: string;
|
|
64
64
|
sessionId: string;
|
|
65
|
+
/**
|
|
66
|
+
* Brand-tenant identifier. Under the post-2026-05-26 hierarchy
|
|
67
|
+
* (workspace = brand-tenant, location = outlet), this is the BRAND
|
|
68
|
+
* dimension. Use `location_id` for the outlet (within-brand)
|
|
69
|
+
* dimension. The two are independent — both can be set on the
|
|
70
|
+
* same event.
|
|
71
|
+
*/
|
|
65
72
|
workspace_id?: string | null;
|
|
73
|
+
/**
|
|
74
|
+
* P15.1 — outlet identifier (location within a brand). Stamped by
|
|
75
|
+
* the SDK when the storefront has resolved an active outlet via
|
|
76
|
+
* `aegis.setLocation(location_id)` OR when the SDK detects the
|
|
77
|
+
* outlet code from the URL path segment (`{brand}.actii.me/{outlet}/...`)
|
|
78
|
+
* and the bootstrap response surfaces a `locationCodes` allowlist.
|
|
79
|
+
*
|
|
80
|
+
* Independent of workspace_id — both can be set simultaneously on
|
|
81
|
+
* the same event. Required for per-outlet attribution on events
|
|
82
|
+
* consumed by analytics, journey triggers, and the activation
|
|
83
|
+
* matrix UI.
|
|
84
|
+
*/
|
|
85
|
+
location_id?: string | null;
|
|
66
86
|
context: EventContext;
|
|
67
87
|
integrations?: Record<string, boolean>;
|
|
68
88
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/types/events.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,OAAO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AAM,CAAC;KACf,CAAC,CAAC;CACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAE3D,cAAM,MAAM;IACV,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAE3D,cAAM,MAAM;IACV,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,MAAM,CAAgC;IAE9C,MAAM,IAAI,IAAI;IAId,OAAO,IAAI,IAAI;IAIf,SAAS,IAAI,OAAO;IAIpB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAK5C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAK3C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAI3C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;CAG7C;AAED,eAAO,MAAM,MAAM,QAAe,CAAC"}
|
|
@@ -58,6 +58,14 @@ export interface AegisWidgetConfig {
|
|
|
58
58
|
* can filter campaigns whose display_rules.sources restricts them
|
|
59
59
|
* to specific integrations (e.g. 'shopify', 'woocommerce'). */
|
|
60
60
|
sourcePlatform?: 'web' | 'shopify' | 'woocommerce' | 'mobile_sdk';
|
|
61
|
+
/**
|
|
62
|
+
* Workspace cascade reader. Host SDK sets this to
|
|
63
|
+
* `() => aegis.getEffectiveWorkspaceId()` so widget interaction events
|
|
64
|
+
* (impressions, clicks, spin/scratch plays, feedback submissions)
|
|
65
|
+
* arrive at the gateway with the same workspace context the main
|
|
66
|
+
* analytics SDK uses. See PLUGIN_HANDSHAKE_AUTOMATION_TRACKER.md §P1.b.
|
|
67
|
+
*/
|
|
68
|
+
getWorkspaceId?: () => string | undefined;
|
|
61
69
|
}
|
|
62
70
|
export interface WidgetCSSCustomization {
|
|
63
71
|
exitIntent?: {
|
|
@@ -144,6 +152,7 @@ export declare class AegisWidgetManager {
|
|
|
144
152
|
private cssCustomization;
|
|
145
153
|
private onEvent?;
|
|
146
154
|
private sourcePlatform?;
|
|
155
|
+
private getWorkspaceId?;
|
|
147
156
|
private widgets;
|
|
148
157
|
private renderedWidgets;
|
|
149
158
|
private isInitialized;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AegisWidgetManager.d.ts","sourceRoot":"","sources":["../../src/widgets/AegisWidgetManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAiB1D,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,aAAa,GAAG,YAAY,GAAG,cAAc,GAAG,OAAO,GAAG,eAAe,GAAG,mBAAmB,CAAC;IAC7G,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE;QACd,IAAI,EAAE,aAAa,GAAG,cAAc,GAAG,cAAc,GAAG,WAAW,CAAC;QACpE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAC9B,CAAC;CACH;AAED,MAAM,WAAW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kCpB,OAAO,CAAC,gBAAgB;IA8DxB,OAAO,CAAC,eAAe;IAsKvB,OAAO,CAAC,qBAAqB;IA4P7B,OAAO,CAAC,aAAa;IAKrB,OAAO,CAAC,aAAa;YAKP,eAAe;IAuD7B,OAAO,CAAC,kBAAkB;IAyE1B,OAAO,CAAC,eAAe;IAcvB,OAAO,CAAC,YAAY;IASpB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,iBAAiB;IAsHzB,OAAO,CAAC,WAAW;IA0DnB,OAAO,CAAC,kBAAkB;IA4I1B,OAAO,CAAC,qBAAqB;YAuHf,aAAa;IA0B3B,OAAO,CAAC,eAAe;YAoET,cAAc;YAkCd,UAAU;IAgCxB,OAAO,CAAC,WAAW;IAgBnB,OAAO,CAAC,aAAa;IAgBrB,OAAO,CAAC,aAAa;IAWrB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,kBAAkB;IA8C1B,OAAO,CAAC,uBAAuB;IA+I/B,OAAO,CAAC,kBAAkB;IA6I1B,OAAO,CAAC,wBAAwB;IAShC,OAAO,CAAC,GAAG;CAMZ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@active-reach/web-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.1",
|
|
4
4
|
"description": "Web SDK for Active Reach Intelligence — event tracking, identity resolution, in-app messaging, web push, and placements",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -56,11 +56,12 @@
|
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/node": "^20.10.0",
|
|
58
58
|
"@types/react": "^18.3.1",
|
|
59
|
+
"eslint": "^9.16.0",
|
|
60
|
+
"jsdom": "^25.0.1",
|
|
61
|
+
"terser": "^5.27.0",
|
|
59
62
|
"typescript": "^5.6.2",
|
|
60
63
|
"vite": "^6.4.2",
|
|
61
|
-
"vitest": "^3.2.1"
|
|
62
|
-
"eslint": "^9.16.0",
|
|
63
|
-
"terser": "^5.27.0"
|
|
64
|
+
"vitest": "^3.2.1"
|
|
64
65
|
},
|
|
65
66
|
"peerDependencies": {
|
|
66
67
|
"react": ">=18.0.0"
|