@active-reach/web-sdk 1.4.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.
Files changed (38) hide show
  1. package/dist/aegis.min.js +1 -1
  2. package/dist/aegis.min.js.map +1 -1
  3. package/dist/{analytics-D9BAnJAu.mjs → analytics-C00PJUSy.mjs} +7 -2
  4. package/dist/{analytics-D9BAnJAu.mjs.map → analytics-C00PJUSy.mjs.map} +1 -1
  5. package/dist/core/prefetch-bundle-client.d.ts +150 -0
  6. package/dist/core/prefetch-bundle-client.d.ts.map +1 -0
  7. package/dist/governance/name-governor.d.ts +10 -0
  8. package/dist/governance/name-governor.d.ts.map +1 -1
  9. package/dist/inapp/AegisInAppManager.d.ts +26 -1
  10. package/dist/inapp/AegisInAppManager.d.ts.map +1 -1
  11. package/dist/inapp/renderers/carousel-cards.d.ts +15 -0
  12. package/dist/inapp/renderers/carousel-cards.d.ts.map +1 -0
  13. package/dist/inapp/renderers/coachmark-tour.d.ts +24 -0
  14. package/dist/inapp/renderers/coachmark-tour.d.ts.map +1 -0
  15. package/dist/inapp/renderers/index.d.ts +12 -0
  16. package/dist/inapp/renderers/index.d.ts.map +1 -0
  17. package/dist/inapp/renderers/product-recommendation.d.ts +23 -0
  18. package/dist/inapp/renderers/product-recommendation.d.ts.map +1 -0
  19. package/dist/inapp/renderers/progress-bar.d.ts +24 -0
  20. package/dist/inapp/renderers/progress-bar.d.ts.map +1 -0
  21. package/dist/inapp/renderers/sticky-bar.d.ts +14 -0
  22. package/dist/inapp/renderers/sticky-bar.d.ts.map +1 -0
  23. package/dist/inapp/renderers/types.d.ts +27 -0
  24. package/dist/inapp/renderers/types.d.ts.map +1 -0
  25. package/dist/inbox/AegisInbox.d.ts +103 -0
  26. package/dist/inbox/AegisInbox.d.ts.map +1 -0
  27. package/dist/inbox/index.d.ts +3 -0
  28. package/dist/inbox/index.d.ts.map +1 -0
  29. package/dist/index.d.ts +6 -0
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +1382 -3
  32. package/dist/index.js.map +1 -1
  33. package/dist/react.js +1 -1
  34. package/dist/runtime/AegisMessageRuntime.d.ts +88 -0
  35. package/dist/runtime/AegisMessageRuntime.d.ts.map +1 -0
  36. package/dist/runtime/index.d.ts +3 -0
  37. package/dist/runtime/index.d.ts.map +1 -0
  38. package/package.json +1 -1
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-D9BAnJAu.mjs";
2
+ import { A as Aegis } from "./analytics-C00PJUSy.mjs";
3
3
  const AegisContext = createContext({
4
4
  aegis: null,
5
5
  isReady: false
@@ -0,0 +1,88 @@
1
+ /**
2
+ * AegisMessageRuntime — unified facade for in-app messaging.
3
+ *
4
+ * Before Phase 7b, tenants using spin_wheel or scratch_card went through
5
+ * `AegisWidgetManager`, while every other in-app type went through
6
+ * `AegisInAppManager`. Two managers, two prefetch endpoints, two render
7
+ * pipelines — all for what is conceptually one product surface.
8
+ *
9
+ * This facade is the single entry point going forward. It holds BOTH
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):
14
+ * new AegisMessageRuntime({ writeKey, apiHost, ... })
15
+ * await runtime.initialize()
16
+ * runtime.updateContactId(id)
17
+ * runtime.onClientEvent(eventName, data)
18
+ * runtime.destroy()
19
+ *
20
+ * Internal wiring: spin_wheel + scratch_card campaigns that flow through
21
+ * the InAppManager trigger a `CustomEvent('aegis:render-widget')` that
22
+ * the runtime's internal WidgetManager picks up (this bridge already
23
+ * exists in AegisInAppManager). No code movement needed — just a single
24
+ * facade over the existing two-manager split.
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.
30
+ */
31
+ import { AegisInAppManager, type AegisInAppConfig, type InAppCampaign } from '../inapp';
32
+ import { AegisWidgetManager, type AegisWidgetConfig } from '../widgets';
33
+ export interface AegisMessageRuntimeConfig extends AegisInAppConfig {
34
+ /** If set, a `TriggerEngine` from the SDK is wired to the WidgetManager
35
+ * for its exit-intent / scroll-velocity / inactivity handlers. Leave
36
+ * undefined to have the runtime construct one internally. */
37
+ triggerEngine?: AegisWidgetConfig['triggerEngine'];
38
+ /** WidgetManager prefetch toggle. Defaults to true — matches the
39
+ * existing behaviour where spin_wheel / scratch_card prefetch their
40
+ * configs from `/v1/widgets/config/prefetch`. */
41
+ enableWidgetPrefetch?: boolean;
42
+ /** Source platform for gamification attribution (shopify / woocommerce
43
+ * / magento / mobile_sdk / web). Passed through to WidgetManager. */
44
+ sourcePlatform?: AegisWidgetConfig['sourcePlatform'];
45
+ }
46
+ /**
47
+ * One runtime, all in-app types. Consumers should prefer this over
48
+ * importing AegisInAppManager / AegisWidgetManager directly. Those two
49
+ * classes remain exported for a deprecation window — see `./deprecated.ts`.
50
+ */
51
+ export declare class AegisMessageRuntime {
52
+ readonly inApp: AegisInAppManager;
53
+ readonly widgets: AegisWidgetManager;
54
+ private initialized;
55
+ constructor(config: AegisMessageRuntimeConfig);
56
+ /**
57
+ * Boots both managers in parallel. Safe to call multiple times — the
58
+ * second + subsequent calls are no-ops.
59
+ */
60
+ initialize(): Promise<void>;
61
+ /**
62
+ * Both managers carry contactId. Update both so the server-side
63
+ * targeting pipeline sees the identity for campaign eligibility AND
64
+ * the widget prefetch includes per-contact segment configs.
65
+ */
66
+ updateContactId(contactId: string): void;
67
+ /**
68
+ * Forward a client-side event (product_viewed, cart_idle_90s, etc.)
69
+ * to the in-app manager's client-trigger evaluator. The WidgetManager
70
+ * has its own TriggerEngine wiring (exit-intent, scroll-velocity) so
71
+ * we don't forward there — events it cares about arrive through that
72
+ * channel already.
73
+ */
74
+ onClientEvent(eventName: string, eventData?: Record<string, unknown>): void;
75
+ /**
76
+ * Tear down both managers. Used by React component unmounts + during
77
+ * identity switches where we want a full reset.
78
+ */
79
+ destroy(): void;
80
+ /**
81
+ * Current armed campaigns visible to the InAppManager. Accessible for
82
+ * the Prefetch Inspector and for debugging. WidgetManager's prefetched
83
+ * spin_wheel / scratch_card configs are NOT in this list — they live
84
+ * in `this.widgets` and have their own lifecycle.
85
+ */
86
+ getCampaigns(): InAppCampaign[];
87
+ }
88
+ //# sourceMappingURL=AegisMessageRuntime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AegisMessageRuntime.d.ts","sourceRoot":"","sources":["../../src/runtime/AegisMessageRuntime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;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;AAExE,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;gBAEhB,MAAM,EAAE,yBAAyB;IAyB7C;;;OAGG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IASjC;;;;OAIG;IACH,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAYxC;;;;;;OAMG;IACH,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,IAAI;IAI/E;;;OAGG;IACH,OAAO,IAAI,IAAI;IAUf;;;;;OAKG;IACH,YAAY,IAAI,aAAa,EAAE;CAMhC"}
@@ -0,0 +1,3 @@
1
+ export { AegisMessageRuntime } from './AegisMessageRuntime';
2
+ export type { AegisMessageRuntimeConfig } from './AegisMessageRuntime';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,YAAY,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@active-reach/web-sdk",
3
- "version": "1.4.0",
3
+ "version": "1.6.0",
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",