@active-reach/web-sdk 1.6.0 → 1.7.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-C00PJUSy.mjs → analytics-B-_3Oy5j.mjs} +2 -1
- package/dist/analytics-B-_3Oy5j.mjs.map +1 -0
- package/dist/cdn.d.ts +2 -4
- package/dist/cdn.d.ts.map +1 -1
- package/dist/core/prefetch-bundle-client.d.ts +21 -0
- package/dist/core/prefetch-bundle-client.d.ts.map +1 -1
- package/dist/ecommerce/index.d.ts.map +1 -1
- package/dist/inapp/AegisInAppManager.d.ts +62 -0
- package/dist/inapp/AegisInAppManager.d.ts.map +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2865 -2554
- package/dist/index.js.map +1 -1
- package/dist/push/AegisWebPush.d.ts +0 -1
- package/dist/push/AegisWebPush.d.ts.map +1 -1
- package/dist/push/AegisWebPush.js +3 -34
- package/dist/push/AegisWebPush.js.map +1 -1
- package/dist/react.js +1 -1
- package/dist/runtime/AegisMessageRuntime.d.ts +42 -24
- package/dist/runtime/AegisMessageRuntime.d.ts.map +1 -1
- package/dist/widgets/AegisWidgetManager.d.ts +38 -0
- package/dist/widgets/AegisWidgetManager.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/analytics-C00PJUSy.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AegisWebPush.d.ts","sourceRoot":"","sources":["../../src/push/AegisWebPush.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC3B,IAAI,CACA,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACjC,OAAO,CAAC,OAAO,CAAC,CAAC;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qB;IACnC,OAAO,CAAC,WAAW,CAAS;gBAGxB,SAAS,EAAE,cAAc,EACzB,MAAM,EAAE,kBAAkB,EAC1B,YAAY,CAAC,EAAE,gBAAgB;IAa7B,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IA6B3B,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC;IAYrC,QAAQ,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAmChD,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;YA4Bf,eAAe;IAiC7B;;;;;OAKG;YACW,oBAAoB;IAuBlC;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IAYxB;;OAEG;YACW,YAAY;IAgB1B;;OAEG;IACH,OAAO,CAAC,eAAe;IAuBvB,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,qBAAqB;CAUhC"}
|
|
@@ -58,7 +58,7 @@ class AegisWebPush {
|
|
|
58
58
|
const fingerprint = await this.getStableFingerprint();
|
|
59
59
|
await this.retryApiCall(
|
|
60
60
|
() => this.apiClient.post(
|
|
61
|
-
"/web_push/subscriptions",
|
|
61
|
+
"/v1/web_push/subscriptions",
|
|
62
62
|
{
|
|
63
63
|
contact_id: params.contactId ?? this.resolveContactId(),
|
|
64
64
|
endpoint: subscriptionJSON.endpoint,
|
|
@@ -79,7 +79,7 @@ class AegisWebPush {
|
|
|
79
79
|
const fingerprint = await this.getStableFingerprint();
|
|
80
80
|
try {
|
|
81
81
|
await this.apiClient.post(
|
|
82
|
-
"/web_push/unsubscribe",
|
|
82
|
+
"/v1/web_push/unsubscribe",
|
|
83
83
|
{
|
|
84
84
|
contact_id: this.resolveContactId(),
|
|
85
85
|
device_fingerprint: fingerprint,
|
|
@@ -108,7 +108,7 @@ class AegisWebPush {
|
|
|
108
108
|
const contactId = this.resolveContactId();
|
|
109
109
|
await this.retryApiCall(
|
|
110
110
|
() => this.apiClient.post(
|
|
111
|
-
"/web_push/subscriptions",
|
|
111
|
+
"/v1/web_push/subscriptions",
|
|
112
112
|
{
|
|
113
113
|
contact_id: contactId,
|
|
114
114
|
endpoint: subscriptionJSON.endpoint,
|
|
@@ -213,37 +213,6 @@ class AegisWebPush {
|
|
|
213
213
|
browser: this.getBrowserInfo()
|
|
214
214
|
});
|
|
215
215
|
}
|
|
216
|
-
getDeviceFingerprint() {
|
|
217
|
-
var _a;
|
|
218
|
-
const parts = [
|
|
219
|
-
`${screen.width}x${screen.height}`,
|
|
220
|
-
navigator.language,
|
|
221
|
-
Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
222
|
-
((_a = navigator.hardwareConcurrency) == null ? void 0 : _a.toString()) ?? ""
|
|
223
|
-
];
|
|
224
|
-
try {
|
|
225
|
-
const canvas = document.createElement("canvas");
|
|
226
|
-
const ctx = canvas.getContext("2d");
|
|
227
|
-
if (ctx) {
|
|
228
|
-
ctx.textBaseline = "top";
|
|
229
|
-
ctx.font = "14px Arial";
|
|
230
|
-
ctx.fillText("aegis-fp", 2, 2);
|
|
231
|
-
parts.push(canvas.toDataURL().slice(-32));
|
|
232
|
-
}
|
|
233
|
-
} catch (_) {
|
|
234
|
-
}
|
|
235
|
-
try {
|
|
236
|
-
const gl = document.createElement("canvas").getContext("webgl");
|
|
237
|
-
if (gl) {
|
|
238
|
-
const dbg = gl.getExtension("WEBGL_debug_renderer_info");
|
|
239
|
-
if (dbg) {
|
|
240
|
-
parts.push(gl.getParameter(dbg.UNMASKED_RENDERER_WEBGL));
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
} catch (_) {
|
|
244
|
-
}
|
|
245
|
-
return btoa(parts.join("|"));
|
|
246
|
-
}
|
|
247
216
|
getBrowserInfo() {
|
|
248
217
|
const ua = navigator.userAgent;
|
|
249
218
|
if (ua.includes("Edg")) return "edge";
|
|
@@ -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 — returned by POST /v1/sdk/bootstrap and\n // required for every push-subscribe call so the backend can scope the\n // row to the correct origin.\n propertyId: string;\n firstPartyCookieId: string;\n autoPrompt?: boolean;\n promptDelay?: number;\n serviceWorkerPath?: string;\n serviceWorkerScope?: string;\n}\n\nexport interface PushEventTracker {\n track(eventName: string, properties: Record<string, unknown>): 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 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 this.eventTracker = eventTracker ?? null;\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 navigator.serviceWorker.addEventListener('message', (event) => {\n this.handleSWMessage(event.data);\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 '/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 '/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 '/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 });\n break;\n case 'push.dismissed':\n this.trackPushEvent('push.dismissed', {\n campaign_id: data.campaign_id,\n });\n break;\n case 'push.delivered':\n this.trackPushEvent('push.delivered', {\n campaign_id: data.campaign_id,\n });\n break;\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 getDeviceFingerprint(): string {\n const parts = [\n `${screen.width}x${screen.height}`,\n navigator.language,\n Intl.DateTimeFormat().resolvedOptions().timeZone,\n navigator.hardwareConcurrency?.toString() ?? '',\n ];\n\n // Canvas fingerprint hash (lightweight)\n try {\n const canvas = document.createElement('canvas');\n const ctx = canvas.getContext('2d');\n if (ctx) {\n ctx.textBaseline = 'top';\n ctx.font = '14px Arial';\n ctx.fillText('aegis-fp', 2, 2);\n parts.push(canvas.toDataURL().slice(-32));\n }\n } catch (_) {\n // Canvas blocked — skip\n }\n\n // WebGL renderer\n try {\n const gl = document.createElement('canvas').getContext('webgl');\n if (gl) {\n const dbg = gl.getExtension('WEBGL_debug_renderer_info');\n if (dbg) {\n parts.push(gl.getParameter(dbg.UNMASKED_RENDERER_WEBGL) as string);\n }\n }\n } catch (_) {\n // WebGL blocked — skip\n }\n\n return btoa(parts.join('|'));\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":"AAqCO,MAAM,aAAa;AAAA,EAOtB,YACI,WACA,QACA,cACF;AARF,SAAQ,iBAAmD;AAE3D,SAAQ,cAAc;AAOlB,SAAK,YAAY;AACjB,SAAK,SAAS;AAAA,MACV,mBAAmB;AAAA,MACnB,oBAAoB;AAAA,MACpB,YAAY;AAAA,MACZ,aAAa;AAAA,MACb,GAAG;AAAA,IAAA;AAEP,SAAK,eAAe,gBAAgB;AAAA,EACxC;AAAA,EAEA,MAAM,aAA4B;AAC9B,QAAI,KAAK,YAAa;AAEtB,QAAI,EAAE,mBAAmB,cAAc,EAAE,iBAAiB,SAAS;AAC/D,cAAQ,KAAK,iEAAiE;AAC9E;AAAA,IACJ;AAEA,QAAI;AACA,WAAK,iBAAiB,MAAM,UAAU,cAAc;AAAA,QAChD,KAAK,OAAO;AAAA,QACZ,EAAE,OAAO,KAAK,OAAO,mBAAA;AAAA,MAAmB;AAE5C,YAAM,UAAU,cAAc;AAC9B,WAAK,cAAc;AAGnB,gBAAU,cAAc,iBAAiB,WAAW,CAAC,UAAU;AAC3D,aAAK,gBAAgB,MAAM,I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,aAAa,2BAA2B;AACvD,YAAI,KAAK;AACL,gBAAM,KAAK,GAAG,aAAa,IAAI,uBAAuB,CAAW;AAAA,QACrE;AAAA,MACJ;AAAA,IACJ,SAAS,GAAG;AAAA,IAEZ;AAEA,WAAO,KAAK,MAAM,KAAK,GAAG,CAAC;AAAA,EAC/B;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}\n\nexport interface PushEventTracker {\n track(eventName: string, properties: Record<string, unknown>): 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 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 this.eventTracker = eventTracker ?? null;\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 navigator.serviceWorker.addEventListener('message', (event) => {\n this.handleSWMessage(event.data);\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 });\n break;\n case 'push.dismissed':\n this.trackPushEvent('push.dismissed', {\n campaign_id: data.campaign_id,\n });\n break;\n case 'push.delivered':\n this.trackPushEvent('push.delivered', {\n campaign_id: data.campaign_id,\n });\n break;\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":"AAyCO,MAAM,aAAa;AAAA,EAOtB,YACI,WACA,QACA,cACF;AARF,SAAQ,iBAAmD;AAE3D,SAAQ,cAAc;AAOlB,SAAK,YAAY;AACjB,SAAK,SAAS;AAAA,MACV,mBAAmB;AAAA,MACnB,oBAAoB;AAAA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AAI,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,32 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AegisMessageRuntime — unified facade for in-app messaging.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* The sole public entry point for all 20 in-app types (announce +
|
|
5
|
+
* collect + assist buckets) plus the legacy gamification surface
|
|
6
|
+
* (chat_bubble / toast / exit_intent_popup configured via
|
|
7
|
+
* /v1/widgets/config). Under the hood it composes an
|
|
8
|
+
* `AegisInAppManager` + `AegisWidgetManager`; callers never touch them
|
|
9
|
+
* directly.
|
|
8
10
|
*
|
|
9
|
-
*
|
|
10
|
-
* underlying managers internally and routes by type, so existing code
|
|
11
|
-
* that talks to them still works during the deprecation window.
|
|
12
|
-
*
|
|
13
|
-
* Public API (shape intentionally kept tiny):
|
|
11
|
+
* Public API:
|
|
14
12
|
* new AegisMessageRuntime({ writeKey, apiHost, ... })
|
|
15
13
|
* await runtime.initialize()
|
|
16
|
-
* runtime.updateContactId(id)
|
|
14
|
+
* await runtime.updateContactId(id)
|
|
17
15
|
* runtime.onClientEvent(eventName, data)
|
|
18
16
|
* runtime.destroy()
|
|
19
17
|
*
|
|
20
|
-
* Internal wiring: spin_wheel + scratch_card campaigns
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* When Phase 7c ports WidgetManager's render paths into InAppManager,
|
|
27
|
-
* this facade becomes a thin delegate over a single manager and the
|
|
28
|
-
* WidgetManager instance can be deleted. For now, one import to rule
|
|
29
|
-
* them all.
|
|
18
|
+
* Internal wiring: spin_wheel + scratch_card campaigns land in the
|
|
19
|
+
* inbox prefetch bundle but need DOM renderers that live in
|
|
20
|
+
* WidgetManager. The facade passes an `onInteractiveCampaign` callback
|
|
21
|
+
* into the InAppManager constructor; the callback forwards to
|
|
22
|
+
* `widgets.renderInteractiveCampaign(campaign)` — no CustomEvent bus,
|
|
23
|
+
* no listeners, no registration-order bugs.
|
|
30
24
|
*/
|
|
31
25
|
import { AegisInAppManager, type AegisInAppConfig, type InAppCampaign } from '../inapp';
|
|
32
26
|
import { AegisWidgetManager, type AegisWidgetConfig } from '../widgets';
|
|
@@ -52,6 +46,7 @@ export declare class AegisMessageRuntime {
|
|
|
52
46
|
readonly inApp: AegisInAppManager;
|
|
53
47
|
readonly widgets: AegisWidgetManager;
|
|
54
48
|
private initialized;
|
|
49
|
+
private ownedTriggerEngine;
|
|
55
50
|
constructor(config: AegisMessageRuntimeConfig);
|
|
56
51
|
/**
|
|
57
52
|
* Boots both managers in parallel. Safe to call multiple times — the
|
|
@@ -59,11 +54,14 @@ export declare class AegisMessageRuntime {
|
|
|
59
54
|
*/
|
|
60
55
|
initialize(): Promise<void>;
|
|
61
56
|
/**
|
|
62
|
-
* Both managers carry contactId.
|
|
57
|
+
* Both managers carry contactId. Updates both so the server-side
|
|
63
58
|
* targeting pipeline sees the identity for campaign eligibility AND
|
|
64
|
-
* the widget prefetch includes per-contact segment configs.
|
|
59
|
+
* the widget prefetch includes per-contact segment configs. The
|
|
60
|
+
* widgets call is async (may re-fetch prefetch configs) but we don't
|
|
61
|
+
* wait — callers that care about the fetched state await on the
|
|
62
|
+
* returned promise.
|
|
65
63
|
*/
|
|
66
|
-
updateContactId(contactId: string): void
|
|
64
|
+
updateContactId(contactId: string): Promise<void>;
|
|
67
65
|
/**
|
|
68
66
|
* Forward a client-side event (product_viewed, cart_idle_90s, etc.)
|
|
69
67
|
* to the in-app manager's client-trigger evaluator. The WidgetManager
|
|
@@ -72,9 +70,29 @@ export declare class AegisMessageRuntime {
|
|
|
72
70
|
* channel already.
|
|
73
71
|
*/
|
|
74
72
|
onClientEvent(eventName: string, eventData?: Record<string, unknown>): void;
|
|
73
|
+
/**
|
|
74
|
+
* Conversion-aware suppression — call when the host app observes a
|
|
75
|
+
* goal event (purchase / order_completed / checkout_completed / custom).
|
|
76
|
+
*
|
|
77
|
+
* Forwards to AegisInAppManager.notifyConversion() which:
|
|
78
|
+
* - Persists the conversion in sessionStorage so subsequent page loads
|
|
79
|
+
* in the same tab keep armed campaigns silenced.
|
|
80
|
+
* - For every armed campaign whose
|
|
81
|
+
* `frequency.suppress_after_conversion_seconds` is set, computes an
|
|
82
|
+
* expiry epoch_ms and silences it until then.
|
|
83
|
+
*
|
|
84
|
+
* Storefronts integrate via the React provider's useCommerceEvents
|
|
85
|
+
* helper which calls this after `ecom.orderCompleted(...)`. Direct SDK
|
|
86
|
+
* users call it themselves.
|
|
87
|
+
*
|
|
88
|
+
* Added by Micro-Intent Engine P0a Task 6 (2026-04-30).
|
|
89
|
+
*/
|
|
90
|
+
notifyConversion(goalName: string): void;
|
|
75
91
|
/**
|
|
76
92
|
* Tear down both managers. Used by React component unmounts + during
|
|
77
|
-
* identity switches where we want a full reset.
|
|
93
|
+
* identity switches where we want a full reset. If the facade created
|
|
94
|
+
* its own TriggerEngine, WidgetManager.destroy() will stop it;
|
|
95
|
+
* caller-supplied engines are left alone.
|
|
78
96
|
*/
|
|
79
97
|
destroy(): void;
|
|
80
98
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AegisMessageRuntime.d.ts","sourceRoot":"","sources":["../../src/runtime/AegisMessageRuntime.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"AegisMessageRuntime.d.ts","sourceRoot":"","sources":["../../src/runtime/AegisMessageRuntime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AACxF,OAAO,EAAE,kBAAkB,EAAE,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAGxE,MAAM,WAAW,yBAA0B,SAAQ,gBAAgB;IACjE;;kEAE8D;IAC9D,aAAa,CAAC,EAAE,iBAAiB,CAAC,eAAe,CAAC,CAAC;IACnD;;sDAEkD;IAClD,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;0EACsE;IACtE,cAAc,CAAC,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;CACtD;AAED;;;;GAIG;AACH,qBAAa,mBAAmB;IAC9B,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC;IAClC,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;IACrC,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,kBAAkB,CAA8B;gBAE5C,MAAM,EAAE,yBAAyB;IAoC7C;;;OAGG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IASjC;;;;;;;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;IAOf;;;;;OAKG;IACH,YAAY,IAAI,aAAa,EAAE;CAMhC"}
|
|
@@ -47,6 +47,10 @@ export interface AegisWidgetConfig {
|
|
|
47
47
|
organizationId?: string;
|
|
48
48
|
debugMode?: boolean;
|
|
49
49
|
triggerEngine?: TriggerEngine;
|
|
50
|
+
/** If true, WidgetManager takes ownership of the TriggerEngine and
|
|
51
|
+
* will call `triggerEngine.stop()` on destroy(). Leave false when
|
|
52
|
+
* the caller shares the engine across managers (e.g. the facade). */
|
|
53
|
+
ownsTriggerEngine?: boolean;
|
|
50
54
|
enablePrefetch?: boolean;
|
|
51
55
|
cssCustomization?: WidgetCSSCustomization;
|
|
52
56
|
onEvent?: (eventType: string, data: any) => void;
|
|
@@ -143,10 +147,44 @@ export declare class AegisWidgetManager {
|
|
|
143
147
|
private widgets;
|
|
144
148
|
private renderedWidgets;
|
|
145
149
|
private isInitialized;
|
|
150
|
+
private isDestroyed;
|
|
151
|
+
private ownsTriggerEngine;
|
|
146
152
|
private prefetchWidgetConfigs;
|
|
147
153
|
private cartData?;
|
|
148
154
|
constructor(config: AegisWidgetConfig);
|
|
149
155
|
updateCSSCustomization(customization: WidgetCSSCustomization): void;
|
|
156
|
+
/**
|
|
157
|
+
* Swap the identity that outgoing widget requests are attributed to.
|
|
158
|
+
* Safe to call at any time; if prefetch is enabled and the manager
|
|
159
|
+
* has already initialised, this will re-fetch the per-contact widget
|
|
160
|
+
* configs so subsequent renders target the new identity. Does NOT
|
|
161
|
+
* re-render already-visible widgets — a full teardown requires destroy().
|
|
162
|
+
*/
|
|
163
|
+
updateContactId(contactId: string | undefined): Promise<void>;
|
|
164
|
+
/**
|
|
165
|
+
* Render an in-app campaign whose sub_type routes it to the
|
|
166
|
+
* gamification-widget code path (spin_wheel / scratch_card).
|
|
167
|
+
* InAppCampaign is adapted to the minimal WidgetConfig shape that
|
|
168
|
+
* the internal renderers already understand — no rewrite needed.
|
|
169
|
+
*
|
|
170
|
+
* AegisMessageRuntime wires this method as AegisInAppManager's
|
|
171
|
+
* `onInteractiveCampaign` callback so impressions from the inbox
|
|
172
|
+
* prefetch bundle actually land on screen.
|
|
173
|
+
*/
|
|
174
|
+
renderInteractiveCampaign(campaign: {
|
|
175
|
+
id: string;
|
|
176
|
+
title: string;
|
|
177
|
+
sub_type?: string;
|
|
178
|
+
priority?: number;
|
|
179
|
+
interactive_config?: Record<string, unknown>;
|
|
180
|
+
}): void;
|
|
181
|
+
/**
|
|
182
|
+
* Tear down everything the manager installed: trigger listeners (if
|
|
183
|
+
* we own the TriggerEngine), injected style sheets, and any rendered
|
|
184
|
+
* widget roots. Further render attempts from in-flight triggers are
|
|
185
|
+
* short-circuited by the `isDestroyed` flag.
|
|
186
|
+
*/
|
|
187
|
+
destroy(): void;
|
|
150
188
|
private emitEvent;
|
|
151
189
|
initialize(): Promise<void>;
|
|
152
190
|
setCartData(cartData: CartData): void;
|
|
@@ -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;
|
|
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,CA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AC,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;YA4Bd,UAAU;IA6BxB,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.7.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",
|