@active-reach/web-sdk 1.38.0 → 1.40.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 (37) hide show
  1. package/dist/aegis-push.min.js +1 -1
  2. package/dist/aegis-push.min.js.map +1 -1
  3. package/dist/aegis.min.js +1 -1
  4. package/dist/aegis.min.js.map +1 -1
  5. package/dist/{analytics-Cz1ZBOxH.mjs → analytics-C-Go3Pm5.mjs} +27 -2
  6. package/dist/analytics-C-Go3Pm5.mjs.map +1 -0
  7. package/dist/core/analytics.d.ts +12 -0
  8. package/dist/core/analytics.d.ts.map +1 -1
  9. package/dist/core/prefetch-bundle-client.d.ts +3 -0
  10. package/dist/core/prefetch-bundle-client.d.ts.map +1 -1
  11. package/dist/inapp/AegisInAppManager.d.ts +5 -1
  12. package/dist/inapp/AegisInAppManager.d.ts.map +1 -1
  13. package/dist/inapp/renderers/card-template.d.ts.map +1 -1
  14. package/dist/inapp/renderers/games.d.ts.map +1 -1
  15. package/dist/inapp/renderers/types.d.ts +13 -0
  16. package/dist/inapp/renderers/types.d.ts.map +1 -1
  17. package/dist/inbox/AegisInbox.d.ts +3 -0
  18. package/dist/inbox/AegisInbox.d.ts.map +1 -1
  19. package/dist/index.js +124 -16
  20. package/dist/index.js.map +1 -1
  21. package/dist/push/AegisWebPush.d.ts +19 -0
  22. package/dist/push/AegisWebPush.d.ts.map +1 -1
  23. package/dist/push/AegisWebPush.js +31 -2
  24. package/dist/push/AegisWebPush.js.map +1 -1
  25. package/dist/react.js +1 -1
  26. package/dist/runtime/AegisMessageRuntime.d.ts +2 -1
  27. package/dist/runtime/AegisMessageRuntime.d.ts.map +1 -1
  28. package/dist/triggers/ContactScoresFetcher.d.ts +3 -1
  29. package/dist/triggers/ContactScoresFetcher.d.ts.map +1 -1
  30. package/dist/triggers/IntentRuleEvaluator.d.ts +1 -1
  31. package/dist/triggers/IntentRuleEvaluator.d.ts.map +1 -1
  32. package/dist/utils/redact-url.d.ts +1 -1
  33. package/dist/utils/redact-url.d.ts.map +1 -1
  34. package/dist/widgets/AegisWidgetManager.d.ts +22 -1
  35. package/dist/widgets/AegisWidgetManager.d.ts.map +1 -1
  36. package/package.json +1 -1
  37. package/dist/analytics-Cz1ZBOxH.mjs.map +0 -1
@@ -1111,7 +1111,18 @@ class Storage {
1111
1111
  }
1112
1112
  }
1113
1113
  }
1114
- const CREDENTIAL_URL_PARAMS = ["t", "k", "code", "session_code", "aegis_pair", "u"];
1114
+ const CREDENTIAL_URL_PARAMS = [
1115
+ "t",
1116
+ "k",
1117
+ "code",
1118
+ "session_code",
1119
+ "aegis_pair",
1120
+ "u",
1121
+ // The Shopify CarrierService callback token (2026-09-18). Server-to-server
1122
+ // today, so the SDK never sees one — it is here because the two lists are
1123
+ // ONE rule, and a list that is only correct for today's callers is not.
1124
+ "carrier_token"
1125
+ ];
1115
1126
  const REDACTED = "REDACTED";
1116
1127
  const CREDENTIAL_PARAM_PATTERN = new RegExp(
1117
1128
  `([?&])(${CREDENTIAL_URL_PARAMS.join("|")})=([^&#\\s"'<>]+)`,
@@ -3021,6 +3032,9 @@ class Aegis {
3021
3032
  if (!this.assertInitialized()) return;
3022
3033
  const wsForGovernor = this.getEffectiveWorkspaceId() || null;
3023
3034
  const { sanitized: governedTraits } = this.traitGovernor.process(traits, wsForGovernor);
3035
+ if (this.identity.getUserId() !== userId) {
3036
+ this.contactToken = void 0;
3037
+ }
3024
3038
  this.identity.setUserId(userId, governedTraits);
3025
3039
  const event = {
3026
3040
  type: "identify",
@@ -3275,6 +3289,16 @@ class Aegis {
3275
3289
  if (!this.identity) return null;
3276
3290
  return this.identity.getUserId();
3277
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
+ }
3278
3302
  /**
3279
3303
  * The Aegis short-link attribution captured from this visitor's landing URL
3280
3304
  * (`aegis_code` + the link row's `aegis_campaign` / `aegis_journey` /
@@ -3308,6 +3332,7 @@ class Aegis {
3308
3332
  "X-Contact-ID": contactId,
3309
3333
  "X-User-ID": contactId
3310
3334
  };
3335
+ if (this.contactToken) headers["X-Contact-Token"] = this.contactToken;
3311
3336
  const orgId = config.organization_id;
3312
3337
  if (orgId) headers["X-Organization-ID"] = orgId;
3313
3338
  const location = this.getEffectiveLocationId();
@@ -3481,4 +3506,4 @@ export {
3481
3506
  murmurhash3_x86_32 as m,
3482
3507
  redactUrl as r
3483
3508
  };
3484
- //# sourceMappingURL=analytics-Cz1ZBOxH.mjs.map
3509
+ //# sourceMappingURL=analytics-C-Go3Pm5.mjs.map