@active-reach/web-sdk 1.7.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.
@@ -37,6 +37,9 @@ export interface InAppCampaign {
37
37
  max_impressions?: number;
38
38
  max_impressions_per_day?: number;
39
39
  cooldown_seconds?: number;
40
+ suppress_after_conversion_seconds?: number;
41
+ suppress_after_dismiss_seconds?: number;
42
+ scope?: 'session' | 'user' | 'user_sku';
40
43
  };
41
44
  interactive_config?: Record<string, unknown>;
42
45
  client_trigger?: {
@@ -75,14 +78,64 @@ export declare class AegisInAppManager {
75
78
  private onInteractiveCampaign?;
76
79
  private campaigns;
77
80
  private displayedCampaigns;
81
+ private suppressedUntil;
78
82
  private eventSource?;
79
83
  private isInitialized;
80
84
  private reconnectAttempts;
81
85
  private maxReconnectAttempts;
86
+ private static readonly CONVERSION_STORAGE_PREFIX;
82
87
  constructor(config: AegisInAppConfig);
83
88
  initialize(): Promise<void>;
84
89
  updateUserId(userId: string): void;
85
90
  updateContactId(contactId: string): void;
91
+ /**
92
+ * Conversion-aware suppression. Call this when the host app observes a
93
+ * goal event (purchase, order_placed, checkout_completed, or any custom
94
+ * goal the workspace has configured per-campaign).
95
+ *
96
+ * For every armed campaign whose `frequency.suppress_after_conversion_seconds`
97
+ * is set, this:
98
+ * 1. Persists the conversion in sessionStorage (so subsequent page
99
+ * loads in the same tab retain silence).
100
+ * 2. Computes an expiry epoch_ms and stores it in `suppressedUntil`.
101
+ * 3. The two campaign-evaluation paths (`tryDisplayNextCampaign`
102
+ * and `onClientEvent`) skip campaigns whose `suppressedUntil`
103
+ * has not yet passed.
104
+ *
105
+ * Scope: only `session` is implemented in P0a. `user` and `user_sku`
106
+ * scopes degrade to session-only with a debug log; the schema accepts
107
+ * them so future expansion is non-breaking.
108
+ *
109
+ * Safe to call repeatedly for the same goal — each call refreshes the
110
+ * sessionStorage timestamp and re-applies suppression to any campaigns
111
+ * loaded since the last call.
112
+ */
113
+ notifyConversion(goalName: string): void;
114
+ /**
115
+ * Compute and store `suppressedUntil` entries for every armed campaign
116
+ * whose `frequency.suppress_after_conversion_seconds` is set. Called by
117
+ * `notifyConversion()` and `refreshCampaigns()` (the latter rehydrates
118
+ * suppression for newly-loaded campaigns when a prior conversion event
119
+ * exists in sessionStorage).
120
+ *
121
+ * `convertedAt` is the epoch_ms of the conversion; pass `Date.now()`
122
+ * when called from `notifyConversion`, or the `ts` recovered from
123
+ * sessionStorage when rehydrating.
124
+ */
125
+ private applySuppressionFromCampaigns;
126
+ /**
127
+ * Recover any prior conversion timestamps from sessionStorage and apply
128
+ * suppression to currently-loaded campaigns. Called from
129
+ * `refreshCampaigns()` after `this.campaigns` is populated. This is the
130
+ * mechanism that prevents a converted buyer from seeing a discount popup
131
+ * on the next page load within the same session.
132
+ */
133
+ private rehydrateSuppressionFromStorage;
134
+ /**
135
+ * Returns true if the campaign is currently suppressed (Date.now() is
136
+ * before the stored expiry). Used by both display paths.
137
+ */
138
+ private isSuppressed;
86
139
  private connectSSE;
87
140
  private disconnectSSE;
88
141
  private attemptReconnect;
@@ -1 +1 @@
1
- {"version":3,"file":"AegisInAppManager.d.ts","sourceRoot":"","sources":["../../src/inapp/AegisInAppManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAyBH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EACA,OAAO,GACP,QAAQ,GACR,SAAS,GACT,aAAa,GACb,mBAAmB,GACnB,OAAO,GACP,KAAK,GAEL,gBAAgB,GAChB,YAAY,GACZ,cAAc,GACd,gBAAgB,GAChB,wBAAwB,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAA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;IAyDvB,OAAO,CAAC,oBAAoB;IAkF5B,OAAO,CAAC,gBAAgB;IA6CxB,OAAO,CAAC,eAAe;IA+CvB,OAAO,CAAC,UAAU;IAiFlB,OAAO,CAAC,aAAa;IAWrB,OAAO,CAAC,eAAe;IAkBvB,OAAO,CAAC,cAAc;IAWtB,OAAO,CAAC,YAAY;IAiHpB,OAAO,CAAC,WAAW;IAkHnB,OAAO,CAAC,gBAAgB;IA6GxB,OAAO,CAAC,sBAAsB;IAyH9B,OAAO,CAAC,WAAW;IAwGnB,OAAO,CAAC,SAAS;IAiHjB,OAAO,CAAC,YAAY;IASpB,OAAO,CAAC,WAAW;IASnB,OAAO,CAAC,aAAa;IA8IrB,OAAO,CAAC,kBAAkB;IA6C1B,OAAO,CAAC,WAAW;IAgBnB,OAAO,CAAC,aAAa;IAqBrB;;;;;;;;;;;OAWG;YACW,UAAU;IA+CxB,OAAO,CAAC,GAAG;IAMX,OAAO,CAAC,OAAO,CAAC,EAAE;QAAE,YAAY,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI;CA6BpD"}
package/dist/index.js CHANGED
@@ -743,10 +743,11 @@ function readAnonIdFromStorage$1() {
743
743
  return void 0;
744
744
  }
745
745
  }
746
- class AegisInAppManager {
746
+ const _AegisInAppManager = class _AegisInAppManager {
747
747
  constructor(config) {
748
748
  this.campaigns = [];
749
749
  this.displayedCampaigns = /* @__PURE__ */ new Set();
750
+ this.suppressedUntil = /* @__PURE__ */ new Map();
750
751
  this.isInitialized = false;
751
752
  this.reconnectAttempts = 0;
752
753
  this.maxReconnectAttempts = 5;
@@ -787,6 +788,117 @@ class AegisInAppManager {
787
788
  }
788
789
  this.refreshCampaigns();
789
790
  }
791
+ /**
792
+ * Conversion-aware suppression. Call this when the host app observes a
793
+ * goal event (purchase, order_placed, checkout_completed, or any custom
794
+ * goal the workspace has configured per-campaign).
795
+ *
796
+ * For every armed campaign whose `frequency.suppress_after_conversion_seconds`
797
+ * is set, this:
798
+ * 1. Persists the conversion in sessionStorage (so subsequent page
799
+ * loads in the same tab retain silence).
800
+ * 2. Computes an expiry epoch_ms and stores it in `suppressedUntil`.
801
+ * 3. The two campaign-evaluation paths (`tryDisplayNextCampaign`
802
+ * and `onClientEvent`) skip campaigns whose `suppressedUntil`
803
+ * has not yet passed.
804
+ *
805
+ * Scope: only `session` is implemented in P0a. `user` and `user_sku`
806
+ * scopes degrade to session-only with a debug log; the schema accepts
807
+ * them so future expansion is non-breaking.
808
+ *
809
+ * Safe to call repeatedly for the same goal — each call refreshes the
810
+ * sessionStorage timestamp and re-applies suppression to any campaigns
811
+ * loaded since the last call.
812
+ */
813
+ notifyConversion(goalName) {
814
+ if (!goalName) {
815
+ this.log("notifyConversion called with empty goalName; ignored", "warn");
816
+ return;
817
+ }
818
+ const ts = Date.now();
819
+ if (typeof sessionStorage !== "undefined") {
820
+ try {
821
+ sessionStorage.setItem(
822
+ `${_AegisInAppManager.CONVERSION_STORAGE_PREFIX}${goalName}`,
823
+ JSON.stringify({ ts })
824
+ );
825
+ } catch {
826
+ }
827
+ }
828
+ this.applySuppressionFromCampaigns(ts);
829
+ this.log(`notifyConversion: ${goalName} — suppressing ${this.suppressedUntil.size} armed campaigns`);
830
+ }
831
+ /**
832
+ * Compute and store `suppressedUntil` entries for every armed campaign
833
+ * whose `frequency.suppress_after_conversion_seconds` is set. Called by
834
+ * `notifyConversion()` and `refreshCampaigns()` (the latter rehydrates
835
+ * suppression for newly-loaded campaigns when a prior conversion event
836
+ * exists in sessionStorage).
837
+ *
838
+ * `convertedAt` is the epoch_ms of the conversion; pass `Date.now()`
839
+ * when called from `notifyConversion`, or the `ts` recovered from
840
+ * sessionStorage when rehydrating.
841
+ */
842
+ applySuppressionFromCampaigns(convertedAt) {
843
+ var _a, _b;
844
+ for (const c of this.campaigns) {
845
+ const seconds = (_a = c.frequency) == null ? void 0 : _a.suppress_after_conversion_seconds;
846
+ if (typeof seconds !== "number" || seconds <= 0) continue;
847
+ const scope = ((_b = c.frequency) == null ? void 0 : _b.scope) ?? "session";
848
+ if (scope !== "session") {
849
+ this.log(
850
+ `applySuppressionFromCampaigns: scope=${scope} not implemented; degrading to session for campaign ${c.id}`,
851
+ "warn"
852
+ );
853
+ }
854
+ const expiresAt = convertedAt + seconds * 1e3;
855
+ const existing = this.suppressedUntil.get(c.id);
856
+ if (existing === void 0 || existing < expiresAt) {
857
+ this.suppressedUntil.set(c.id, expiresAt);
858
+ }
859
+ }
860
+ }
861
+ /**
862
+ * Recover any prior conversion timestamps from sessionStorage and apply
863
+ * suppression to currently-loaded campaigns. Called from
864
+ * `refreshCampaigns()` after `this.campaigns` is populated. This is the
865
+ * mechanism that prevents a converted buyer from seeing a discount popup
866
+ * on the next page load within the same session.
867
+ */
868
+ rehydrateSuppressionFromStorage() {
869
+ if (typeof sessionStorage === "undefined") return;
870
+ let earliestTs = null;
871
+ try {
872
+ for (let i = 0; i < sessionStorage.length; i++) {
873
+ const key = sessionStorage.key(i);
874
+ if (!key || !key.startsWith(_AegisInAppManager.CONVERSION_STORAGE_PREFIX)) continue;
875
+ const raw = sessionStorage.getItem(key);
876
+ if (!raw) continue;
877
+ const parsed = JSON.parse(raw);
878
+ if (typeof parsed.ts === "number") {
879
+ earliestTs = earliestTs === null ? parsed.ts : Math.min(earliestTs, parsed.ts);
880
+ }
881
+ }
882
+ } catch {
883
+ return;
884
+ }
885
+ if (earliestTs !== null) {
886
+ this.applySuppressionFromCampaigns(earliestTs);
887
+ }
888
+ }
889
+ /**
890
+ * Returns true if the campaign is currently suppressed (Date.now() is
891
+ * before the stored expiry). Used by both display paths.
892
+ */
893
+ isSuppressed(campaignId) {
894
+ const expiresAt = this.suppressedUntil.get(campaignId);
895
+ if (expiresAt === void 0) return false;
896
+ if (Date.now() >= expiresAt) {
897
+ this.suppressedUntil.delete(campaignId);
898
+ return false;
899
+ }
900
+ return true;
901
+ }
790
902
  connectSSE() {
791
903
  if (this.eventSource) {
792
904
  this.disconnectSSE();
@@ -892,6 +1004,7 @@ class AegisInAppManager {
892
1004
  const payload = await response.json();
893
1005
  this.campaigns = Array.isArray(payload) ? payload : [];
894
1006
  this.processABAssignments(this.campaigns);
1007
+ this.rehydrateSuppressionFromStorage();
895
1008
  this.log(`Fetched ${this.campaigns.length} campaigns`);
896
1009
  this.tryDisplayNextCampaign();
897
1010
  } catch (error) {
@@ -935,7 +1048,7 @@ class AegisInAppManager {
935
1048
  }
936
1049
  tryDisplayNextCampaign() {
937
1050
  const campaign = this.campaigns.find(
938
- (c) => !this.displayedCampaigns.has(c.id) && !c.client_trigger
1051
+ (c) => !this.displayedCampaigns.has(c.id) && !c.client_trigger && !this.isSuppressed(c.id)
939
1052
  );
940
1053
  if (campaign) {
941
1054
  this.displayCampaign(campaign);
@@ -961,6 +1074,7 @@ class AegisInAppManager {
961
1074
  for (const c of this.campaigns) {
962
1075
  if (this.displayedCampaigns.has(c.id)) continue;
963
1076
  if (!c.client_trigger) continue;
1077
+ if (this.isSuppressed(c.id)) continue;
964
1078
  if (this.matchesClientTrigger(c.client_trigger, eventName, eventData)) {
965
1079
  this.displayCampaign(c);
966
1080
  }
@@ -2268,7 +2382,9 @@ class AegisInAppManager {
2268
2382
  this.isInitialized = false;
2269
2383
  this.log("AegisInApp destroyed");
2270
2384
  }
2271
- }
2385
+ };
2386
+ _AegisInAppManager.CONVERSION_STORAGE_PREFIX = "aegis_conv_";
2387
+ let AegisInAppManager = _AegisInAppManager;
2272
2388
  function renderPreview(config) {
2273
2389
  document.querySelectorAll(
2274
2390
  '[class^="aegis-in-app-"]'