@active-reach/web-sdk 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +78 -0
- package/dist/index.js.map +1 -1
- package/dist/runtime/AegisMessageRuntime.d.ts +88 -0
- package/dist/runtime/AegisMessageRuntime.d.ts.map +1 -0
- package/dist/runtime/index.d.ts +3 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -22,6 +22,8 @@ export { PrefetchBundleClient } from './core/prefetch-bundle-client';
|
|
|
22
22
|
export type { PrefetchBundle, PrefetchBundleCampaign, PrefetchBundleInbox, PrefetchBundleInboxEntry, PrefetchBundleClientOptions, PrefetchBundleContext, PrefetchBundleListener, } from './core/prefetch-bundle-client';
|
|
23
23
|
export { AegisInbox } from './inbox';
|
|
24
24
|
export type { AegisInboxConfig, AegisInboxEntry, InboxListener } from './inbox';
|
|
25
|
+
export { AegisMessageRuntime } from './runtime';
|
|
26
|
+
export type { AegisMessageRuntimeConfig } from './runtime';
|
|
25
27
|
export { AegisWebPush } from './push/AegisWebPush';
|
|
26
28
|
export type { AegisWebPushConfig, AegisAPIClient, ContactIdentity, PushEventTracker, } from './push/AegisWebPush';
|
|
27
29
|
export { bootstrap, readFirstPartyCookie, writeFirstPartyCookie, deriveDeviceFingerprint, BootstrapError, } from './core/bootstrap';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,QAAA,MAAM,KAAK,OAAc,CAAC;AAE1B,eAAe,KAAK,CAAC;AAErB,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,YAAY,EAAE,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M,cAAc,CAAC;AAC7E,YAAY,EAAE,mBAAmB,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAQvF,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,YAAY,EACV,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -5650,6 +5650,83 @@ class AegisInbox {
|
|
|
5650
5650
|
}
|
|
5651
5651
|
}
|
|
5652
5652
|
}
|
|
5653
|
+
class AegisMessageRuntime {
|
|
5654
|
+
constructor(config) {
|
|
5655
|
+
this.initialized = false;
|
|
5656
|
+
this.inApp = new AegisInAppManager({
|
|
5657
|
+
writeKey: config.writeKey,
|
|
5658
|
+
apiHost: config.apiHost,
|
|
5659
|
+
userId: config.userId,
|
|
5660
|
+
contactId: config.contactId,
|
|
5661
|
+
organizationId: config.organizationId,
|
|
5662
|
+
propertyId: config.propertyId,
|
|
5663
|
+
debugMode: config.debugMode,
|
|
5664
|
+
enableSSE: config.enableSSE
|
|
5665
|
+
});
|
|
5666
|
+
this.widgets = new AegisWidgetManager({
|
|
5667
|
+
writeKey: config.writeKey,
|
|
5668
|
+
apiHost: config.apiHost,
|
|
5669
|
+
userId: config.userId,
|
|
5670
|
+
contactId: config.contactId,
|
|
5671
|
+
organizationId: config.organizationId,
|
|
5672
|
+
debugMode: config.debugMode,
|
|
5673
|
+
triggerEngine: config.triggerEngine,
|
|
5674
|
+
enablePrefetch: config.enableWidgetPrefetch !== false,
|
|
5675
|
+
sourcePlatform: config.sourcePlatform
|
|
5676
|
+
});
|
|
5677
|
+
}
|
|
5678
|
+
/**
|
|
5679
|
+
* Boots both managers in parallel. Safe to call multiple times — the
|
|
5680
|
+
* second + subsequent calls are no-ops.
|
|
5681
|
+
*/
|
|
5682
|
+
async initialize() {
|
|
5683
|
+
if (this.initialized) return;
|
|
5684
|
+
this.initialized = true;
|
|
5685
|
+
await Promise.all([
|
|
5686
|
+
this.inApp.initialize(),
|
|
5687
|
+
this.widgets.initialize()
|
|
5688
|
+
]);
|
|
5689
|
+
}
|
|
5690
|
+
/**
|
|
5691
|
+
* Both managers carry contactId. Update both so the server-side
|
|
5692
|
+
* targeting pipeline sees the identity for campaign eligibility AND
|
|
5693
|
+
* the widget prefetch includes per-contact segment configs.
|
|
5694
|
+
*/
|
|
5695
|
+
updateContactId(contactId) {
|
|
5696
|
+
var _a, _b;
|
|
5697
|
+
(_b = (_a = this.inApp).updateContactId) == null ? void 0 : _b.call(_a, contactId);
|
|
5698
|
+
}
|
|
5699
|
+
/**
|
|
5700
|
+
* Forward a client-side event (product_viewed, cart_idle_90s, etc.)
|
|
5701
|
+
* to the in-app manager's client-trigger evaluator. The WidgetManager
|
|
5702
|
+
* has its own TriggerEngine wiring (exit-intent, scroll-velocity) so
|
|
5703
|
+
* we don't forward there — events it cares about arrive through that
|
|
5704
|
+
* channel already.
|
|
5705
|
+
*/
|
|
5706
|
+
onClientEvent(eventName, eventData = {}) {
|
|
5707
|
+
var _a, _b;
|
|
5708
|
+
(_b = (_a = this.inApp).onClientEvent) == null ? void 0 : _b.call(_a, eventName, eventData);
|
|
5709
|
+
}
|
|
5710
|
+
/**
|
|
5711
|
+
* Tear down both managers. Used by React component unmounts + during
|
|
5712
|
+
* identity switches where we want a full reset.
|
|
5713
|
+
*/
|
|
5714
|
+
destroy() {
|
|
5715
|
+
var _a, _b, _c, _d;
|
|
5716
|
+
(_b = (_a = this.inApp).destroy) == null ? void 0 : _b.call(_a);
|
|
5717
|
+
(_d = (_c = this.widgets).destroy) == null ? void 0 : _d.call(_c);
|
|
5718
|
+
this.initialized = false;
|
|
5719
|
+
}
|
|
5720
|
+
/**
|
|
5721
|
+
* Current armed campaigns visible to the InAppManager. Accessible for
|
|
5722
|
+
* the Prefetch Inspector and for debugging. WidgetManager's prefetched
|
|
5723
|
+
* spin_wheel / scratch_card configs are NOT in this list — they live
|
|
5724
|
+
* in `this.widgets` and have their own lifecycle.
|
|
5725
|
+
*/
|
|
5726
|
+
getCampaigns() {
|
|
5727
|
+
return this.inApp.campaigns ?? [];
|
|
5728
|
+
}
|
|
5729
|
+
}
|
|
5653
5730
|
const COOKIE_NAME = "aegis_fpc";
|
|
5654
5731
|
const COOKIE_MAX_AGE_DAYS = 365 * 2;
|
|
5655
5732
|
class BootstrapError extends Error {
|
|
@@ -5728,6 +5805,7 @@ export {
|
|
|
5728
5805
|
Aegis,
|
|
5729
5806
|
AegisInAppManager,
|
|
5730
5807
|
AegisInbox,
|
|
5808
|
+
AegisMessageRuntime,
|
|
5731
5809
|
AegisPlacementManager,
|
|
5732
5810
|
AegisWebPush,
|
|
5733
5811
|
AegisWidgetManager,
|