@active-reach/web-sdk 1.39.0 → 1.41.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.
@@ -3032,6 +3032,9 @@ class Aegis {
3032
3032
  if (!this.assertInitialized()) return;
3033
3033
  const wsForGovernor = this.getEffectiveWorkspaceId() || null;
3034
3034
  const { sanitized: governedTraits } = this.traitGovernor.process(traits, wsForGovernor);
3035
+ if (this.identity.getUserId() !== userId) {
3036
+ this.contactToken = void 0;
3037
+ }
3035
3038
  this.identity.setUserId(userId, governedTraits);
3036
3039
  const event = {
3037
3040
  type: "identify",
@@ -3286,6 +3289,16 @@ class Aegis {
3286
3289
  if (!this.identity) return null;
3287
3290
  return this.identity.getUserId();
3288
3291
  }
3292
+ /**
3293
+ * C1b: register the server-minted proof for the CURRENT contact (as
3294
+ * returned by `getUserId()`). A host wiring `AegisMessageRuntime` calls
3295
+ * this alongside `runtime.updateContactId(id, token)` so `getRewards()`
3296
+ * can also present `X-Contact-Token`. Pass `undefined` to clear it (e.g.
3297
+ * on logout, or when the id changes without a fresh token).
3298
+ */
3299
+ setContactToken(token) {
3300
+ this.contactToken = token;
3301
+ }
3289
3302
  /**
3290
3303
  * The Aegis short-link attribution captured from this visitor's landing URL
3291
3304
  * (`aegis_code` + the link row's `aegis_campaign` / `aegis_journey` /
@@ -3319,6 +3332,7 @@ class Aegis {
3319
3332
  "X-Contact-ID": contactId,
3320
3333
  "X-User-ID": contactId
3321
3334
  };
3335
+ if (this.contactToken) headers["X-Contact-Token"] = this.contactToken;
3322
3336
  const orgId = config.organization_id;
3323
3337
  if (orgId) headers["X-Organization-ID"] = orgId;
3324
3338
  const location = this.getEffectiveLocationId();
@@ -3492,4 +3506,4 @@ export {
3492
3506
  murmurhash3_x86_32 as m,
3493
3507
  redactUrl as r
3494
3508
  };
3495
- //# sourceMappingURL=analytics-DoHdxjjh.mjs.map
3509
+ //# sourceMappingURL=analytics-C-Go3Pm5.mjs.map