ionblink-js 0.1.6 → 0.1.8

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/CHANGELOG.md CHANGED
@@ -1,6 +1,34 @@
1
1
  # Changelog: ionblink-js
2
2
 
3
- ## 0.1.6 - Unreleased
3
+ ## 0.1.8 - 2026-12-02
4
+
5
+ - Masking stays at `inputs` after `identify()` or `set()`: input values are hidden and page text stays readable, signed
6
+ in or out, as PostHog does by default. Before, signing in raised it to `controls`, starring every word except
7
+ buttons, links and labels. `controls` and `text` now apply only when the page passes `mask` or the site's masking
8
+ setting (remote config) asks for them. Sign-ins no longer restart the recorder for the level change.
9
+ - The same level decides autocapture's text, so after sign-in the text and labels of clicked elements that aren't
10
+ buttons, links or labels (`$click`, `$rage_click`, `$dead_click`, `$field` labels) are sent readable, scrubbed of
11
+ emails, numbers and tokens as before, instead of being dropped. Pages that show other people's data there can mark
12
+ it `data-ib-mask` or pass `mask: 'controls'`.
13
+
14
+ ## 0.1.7 - 2026-12-02
15
+
16
+ - A sign-in as another person mid-page (`identify()` or `set()` with a different id) starts a new session, and now
17
+ starts the recorder again so that session opens with its own full snapshot, as `reset()` and an idle rotation
18
+ already did. Before, rrweb's snapshot stayed with the ended session and the new one held changes only, so none of it
19
+ could play (seen in production on IonCipher, 2026-12-02: 2,215 changes with no page to apply them to). Found by the
20
+ 2026-12-02 comparison of IonBlink's replays with PostHog's.
21
+ - `replay.publicImages`: path patterns (`'/media/places/**'`, the page's own origin) of public images whose names are
22
+ ids. A long id or token in an image path was always `:redacted`, so Highlights' place photos
23
+ (`/media/places/places/<place id>/photos/<photo ref>`) were empty cards in every replay while PostHog showed them
24
+ (2026-12-02 comparison: 59 of 321 image URLs across 23 recordings). In an `<img>` src or a srcset there, a segment of
25
+ letters, digits, `_` and `-` keeps its id unless it holds an API key or 9 digits; any other segment, query values,
26
+ the `text` level and masked regions are as before. Page code only. Replay chunk 23,560 -> 23,795 bytes brotli
27
+ (budget 23.1 -> 23.25 KB).
28
+ - The scrubber stars OpenAI (`sk-proj-`), Anthropic (`sk-ant-`) and GitHub user (`ghu_`) keys too, in every event and
29
+ replay. Extras chunk 8,187 -> 8,207 bytes brotli (budget 8 -> 8.02 KB).
30
+
31
+ ## 0.1.6 - 2026-12-02
4
32
 
5
33
  The first version published by CI (npm trusted publishing), with npm provenance; npm and the CDN serve the same bytes
6
34
  again. No change to what the SDK sends.
package/README.md CHANGED
@@ -45,13 +45,13 @@ release has a URL that never changes, cached for a year; it updates only when yo
45
45
  lazy chunks from the same folder, each with its own integrity hash built in:
46
46
 
47
47
  ```html
48
- <script src="https://cdn.ionblink.com/sdk/0.1.6/ionblink.min.js"
48
+ <script src="https://cdn.ionblink.com/sdk/0.1.8/ionblink.min.js"
49
49
  integrity="sha384-…" crossorigin="anonymous" data-key="ib_pk_…" async></script>
50
50
  ```
51
51
 
52
52
  The `integrity` value for each release is in `dist/integrity.json` of the package (and in the release notes). Every
53
53
  npm release is also on jsDelivr and unpkg with no extra step, for example
54
- `https://cdn.jsdelivr.net/npm/ionblink-js@0.1.6/dist/v1.js` (same bytes, same integrity). Batches still go to
54
+ `https://cdn.jsdelivr.net/npm/ionblink-js@0.1.8/dist/v1.js` (same bytes, same integrity). Batches still go to
55
55
  `https://api.ionblink.com` (or your `data-api-host`).
56
56
 
57
57
  ### Inline snippet (call the API before the SDK loads)
@@ -87,7 +87,7 @@ Route changes are page views on their own. Add the `/ib` route with `ionblinkRou
87
87
  |---|---|
88
88
  | `init(key, options?)` | Starts the SDK. Once per page. |
89
89
  | `event(name, props?)` | An app event: a name of 1-64 characters (not starting with `$`) and JSON props. |
90
- | `set(person)` / `identify(id, traits?)` | Who the person is. Use your user id, never an email, as `id`. Raises masking to `controls`. |
90
+ | `set(person)` / `identify(id, traits?)` | Who the person is. Use your user id, never an email, as `id`. |
91
91
  | `page(path?, props?)` | A page view by hand: only for virtual pages or with `pages: false`. |
92
92
  | `reset()` | On sign-out: new anonymous id and session, the person forgotten. |
93
93
  | `consent(choice)` | From your banner: `'off' \| 'basic' \| 'full' \| 'replay'` or `{ analytics, replay }`. |
@@ -99,7 +99,7 @@ Route changes are page views on their own. Add the `/ib` route with `ionblinkRou
99
99
  Options: `apiHost`, `mode` (the most this site captures, default `replay`), `requireConsent`, `mask`, `storage`
100
100
  (`local` default, `cookie` with `cookieDomain` for subdomains, `memory`), `pages`, `autocapture` (or per family:
101
101
  `clicks`, `forms`, `errors`, `vitals`, `signals`), `replay: { sample, maskSelectors, blockSelectors, blockPaths,
102
- console, network }`, `keepQuery`, `app: { version, build }`, `debug`, `beforeSend`. See `src/types.ts`.
102
+ publicImages, console, network }`, `keepQuery`, `app: { version, build }`, `debug`, `beforeSend`. See `src/types.ts`.
103
103
 
104
104
  **Console and network in replays.** When a site's owner turns them on in IonBlink (Settings, Sites), recorded sessions
105
105
  also carry the page's console lines (`log`, `info`, `warn`, `error`, uncaught errors and unhandled rejections) and its
@@ -157,9 +157,10 @@ can carry out the withdrawal. The choice is kept for 6 months.
157
157
  - What people type in a `contenteditable` editor (or a `designMode` document) is masked at every level, like an input.
158
158
  - Emails, card numbers, phone numbers, IBANs, SSNs, JWTs, API keys and long tokens are scrubbed from all text,
159
159
  attributes and URLs before they leave the browser.
160
- - Levels: `inputs` (default when signed out: input values hidden), `controls` (default after `identify()`: all text
161
- hidden except buttons, links and labels), `text` (all text and images hidden). Remote config can only make it
162
- stricter.
160
+ - Levels: `inputs` (the default, signed in or out: input values hidden, page text readable, as PostHog does),
161
+ `controls` (all text hidden except buttons, links and labels), `text` (all text and images hidden). The stricter
162
+ levels apply only when the page's `mask` option or the site's masking setting asks for them; the site's setting
163
+ (remote config) can only make it stricter.
163
164
  - Markup: `data-ib-mask` (or class `ib-mask`) masks an element's text and attributes, its open shadow root
164
165
  included; `data-ib-unmask` keeps a control's label at `controls`; `data-ib-block` (or `ib-block`) replaces an
165
166
  element with a placeholder in replay and stops autocapture inside it; `data-ib-no-capture` stops autocapture only;
@@ -172,6 +173,14 @@ can carry out the withdrawal. The choice is kept for 6 months.
172
173
  `color-scheme`, a cross-origin iframe's URL is masked like a link, and inline handlers, `nonce` and `srcdoc` are
173
174
  dropped.
174
175
  - `blob:` and `data:` images and file inputs are always blocked in replay.
176
+ - Image URLs: a path segment holding an email, a long token or id, a phone or card number is replaced by `:redacted`
177
+ (a built asset's hashed name stays), so such an image doesn't show in the player. For images anyone may open whose
178
+ names are ids (a map place's photos, a CMS's uploads), list their paths on your origin:
179
+ `replay: { publicImages: ['/media/places/**'] }` (`*` is one segment, `**` any depth). In an `<img>` src or a srcset
180
+ there, segments of letters, digits, `_` and `-` keep their ids; an API key or 9 digits in one is still redacted, any
181
+ other segment is treated as usual, and query values are scrubbed. Not at the `text` level or inside masked regions;
182
+ only your page's code can set it (remote config can't). Don't list private files: an id in the path is how they're
183
+ reached.
175
184
 
176
185
  ## First-party proxy
177
186
 
@@ -108,7 +108,7 @@ var init_scrub = __esm({
108
108
  "use strict";
109
109
  EMAIL = /[^\s@<>()[\]"',;:]{1,64}@[^\s@<>()[\]"',;:]{1,253}\.[a-z]{2,}/gi;
110
110
  JWT = /\beyJ[\w-]{6,500}\.[\w-]{6,}\.[\w-]{6,}/g;
111
- KEYS = /\b(?:sk_live_|sk_test_|rk_live_|pk_live_|ib_sk_|ghp_|gho_|ghs_|github_pat_|xox[abpr]-|AKIA|AIza|ya29\.)[\w.-]{8,}/g;
111
+ KEYS = /\b(?:sk_(?:live|test)_|[rp]k_live_|ib_sk_|sk-(?:proj|ant)-|gh[opsu]_|github_pat_|xox[abpr]-|AKIA|AIza|ya29\.)[\w.-]{8,}/g;
112
112
  SSN = /\b\d{3}-\d{2}-\d{4}\b/g;
113
113
  IBAN = /\b[A-Z]{2}\d{2}(?: ?[A-Z0-9]{4}){2,7}(?: ?[A-Z0-9]{1,4})?\b/g;
114
114
  DIGITS = /\+?\(?\d[\d\s().-]{7,}\d/g;
@@ -228,7 +228,7 @@ var VERSION, now, perf, reporter, hasReporter, pnow;
228
228
  var init_util = __esm({
229
229
  "src/util.ts"() {
230
230
  "use strict";
231
- VERSION = true ? "0.1.6" : "0.0.0-dev";
231
+ VERSION = true ? "0.1.8" : "0.0.0-dev";
232
232
  now = () => Date.now();
233
233
  perf = { total: 0, max: 0, over4: 0, over50: 0, errors: 0 };
234
234
  reporter = null;
@@ -322,7 +322,19 @@ function assetSeg(x) {
322
322
  const m = HASHED.exec(x);
323
323
  return m && /[g-z]/i.test(m[1]) && scrub(m[1]) === m[1] ? x : seg(x);
324
324
  }
325
- function scrubUrl(href) {
325
+ function publicSeg(x) {
326
+ return /^[\w-]+$/.test(x) ? /\d{9}/.test(x.replace(/[-_]/g, "")) || new RegExp(KEYS.source.slice(2)).test(x) ? ":redacted" : x : assetSeg(x);
327
+ }
328
+ function publicPaths(list, origin2) {
329
+ if (!Array.isArray(list)) return void 0;
330
+ const res = [];
331
+ for (const g of list.slice(0, 20)) {
332
+ if (typeof g == "string" && g[0] == "/" && g.length <= 200)
333
+ res.push(new RegExp("^" + (origin2 + g).replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*\*?/g, (m) => m[1] ? ".*" : "[^/]*") + "$"));
334
+ }
335
+ return res.length ? (u) => res.some((r) => r.test(u.origin + u.pathname)) : void 0;
336
+ }
337
+ function scrubUrl(href, pub) {
326
338
  if (scrub(href) === href) return href;
327
339
  try {
328
340
  const u = new URL(href, location.href);
@@ -330,14 +342,15 @@ function scrubUrl(href) {
330
342
  u.searchParams.forEach((v, k) => {
331
343
  q += (q ? "&" : "?") + encodeURIComponent(k) + "=" + encodeURIComponent(scrub(v));
332
344
  });
333
- return u.origin + u.pathname.split("/").map(assetSeg).join("/") + q;
345
+ return u.origin + u.pathname.split("/").map(pub && pub(u) ? publicSeg : assetSeg).join("/") + q;
334
346
  } catch (e) {
335
347
  return scrub(href);
336
348
  }
337
349
  }
338
- function maskAttrsFn(level, extraMask) {
350
+ function maskAttrsFn(level, extraMask, pub) {
339
351
  const text2 = maskTextFn(level, extraMask);
340
352
  const masked = MASKED + extraMask;
353
+ const pubOf = (el, n) => pub && level !== "text" && el && (n === "srcset" || n === "src" && el.tagName === "IMG") && !deep(el, masked) ? pub : void 0;
341
354
  return (a, el, mut) => {
342
355
  for (const k in a) {
343
356
  const v = a[k];
@@ -354,8 +367,10 @@ function maskAttrsFn(level, extraMask) {
354
367
  const scheme = /^\s*([a-z][\w+.-]*):/i.exec(v);
355
368
  const sc = scheme ? scheme[1].toLowerCase() : "";
356
369
  a[k] = sc === "javascript" ? "#" : sc && sc !== "http" && sc !== "https" ? sc + ":*" : maskUrl(v).url || "#";
357
- } else if (SRC_ATTR.test(n)) a[k] = /^\s*(blob|data):/i.test(v) ? "" : n === "srcset" ? v.replace(/[^\s,]+/g, scrubUrl) : scrubUrl(v);
358
- else if (n.indexOf("data-") === 0) a[k] = level === "text" || deep(el, masked) ? stars2(v) : UI_WORD.test(v) ? v : text2(v, el);
370
+ } else if (SRC_ATTR.test(n)) {
371
+ const p = pubOf(el, n);
372
+ a[k] = /^\s*(blob|data):/i.test(v) ? "" : n === "srcset" ? v.replace(/[^\s,]+/g, (u) => scrubUrl(u, p)) : scrubUrl(v, p);
373
+ } else if (n.indexOf("data-") === 0) a[k] = level === "text" || deep(el, masked) ? stars2(v) : UI_WORD.test(v) ? v : text2(v, el);
359
374
  else if (TEXT_ATTR.test(n)) a[k] = text2(v, el);
360
375
  }
361
376
  };
@@ -1387,7 +1402,7 @@ function start2(api, loadInspect) {
1387
1402
  if (CRAWLER.test(navigator.userAgent)) return "crawler";
1388
1403
  if (document.getElementsByTagName("*").length > MAX_ELEMENTS) return "dom_too_large";
1389
1404
  const extraMask = validSelectors(api.mask);
1390
- const fix = maskAttrsFn(api.level, extraMask);
1405
+ const fix = maskAttrsFn(api.level, extraMask, publicPaths(api.opts && api.opts.publicImages, location.origin));
1391
1406
  const el = (id) => {
1392
1407
  const n = import_record.record.mirror.getNode(id);
1393
1408
  return n && n.nodeType === 1 ? n : null;
@@ -2598,8 +2613,7 @@ function createIonBlink(deps) {
2598
2613
  const rstate = () => replay.on ? { on: true } : { on: false, off_reason: replay.off };
2599
2614
  const collect = () => full() || mode === "basic" && !choice;
2600
2615
  const level = () => {
2601
- const base = explicitMask || (session && session.peek().p ? "controls" : "inputs");
2602
- return stricter(base, cfg ? cfg.replay.mask : void 0);
2616
+ return stricter(explicitMask || "inputs", cfg ? cfg.replay.mask : void 0);
2603
2617
  };
2604
2618
  const autoOn = (k) => {
2605
2619
  if (killed === "all" || killed === "auto" && k !== "signals") return false;
@@ -3215,19 +3229,20 @@ function createIonBlink(deps) {
3215
3229
  if (later("set", [person])) return;
3216
3230
  if (!person || typeof person !== "object") return;
3217
3231
  const traits = cleanProps(person, false) || {};
3218
- const before = level();
3232
+ let renewed = false;
3219
3233
  if (session && typeof traits.id === "string" && traits.id) {
3220
3234
  const cur2 = session.peek().p;
3221
3235
  if (cur2 && cur2 !== traits.id) {
3222
3236
  cutEvents();
3223
3237
  session.reset();
3224
3238
  ctxDirty = true;
3239
+ renewed = true;
3225
3240
  } else cutEvents();
3226
3241
  session.setPerson(traits.id.slice(0, 200));
3227
3242
  ctxDirty = true;
3228
3243
  }
3229
3244
  capture("$set", traits);
3230
- if (level() !== before) restartReplay();
3245
+ if (renewed && replay.on) restartReplay();
3231
3246
  }),
3232
3247
  identify: (id, traits) => ib.set({ ...traits || {}, id }),
3233
3248
  page: guard("page", (path, props) => {
@@ -3243,12 +3258,11 @@ function createIonBlink(deps) {
3243
3258
  reset: guard("reset", () => {
3244
3259
  if (later("reset", [])) return;
3245
3260
  if (!session) return;
3246
- const before = level();
3247
3261
  cutEvents();
3248
3262
  cutReplay();
3249
3263
  session.reset();
3250
3264
  ctxDirty = true;
3251
- if (level() !== before || replay.on) restartReplay();
3265
+ if (replay.on) restartReplay();
3252
3266
  }),
3253
3267
  consent: guard("consent", (c) => {
3254
3268
  const m = choiceToMode(c);
@@ -6,7 +6,7 @@ import {
6
6
  now,
7
7
  report,
8
8
  setReporter
9
- } from "./c-EMLSQ5BC.js";
9
+ } from "./c-F2YMUNOS.js";
10
10
  import {
11
11
  NO_CAPTURE,
12
12
  isSensitive,
@@ -14,14 +14,14 @@ import {
14
14
  selector,
15
15
  shortText,
16
16
  textFor
17
- } from "./c-UMIKYUMF.js";
17
+ } from "./c-ATMCVW2I.js";
18
18
  import {
19
19
  actionable,
20
20
  boxOf,
21
21
  closest,
22
22
  maskUrl,
23
23
  scrub
24
- } from "./c-FF5JPOWW.js";
24
+ } from "./c-M56MSQLW.js";
25
25
 
26
26
  // src/rage.ts
27
27
  function createRage(o = {}) {
@@ -1,9 +1,10 @@
1
1
  import {
2
+ KEYS,
2
3
  closest,
3
4
  maskUrl,
4
5
  scrub,
5
6
  seg
6
- } from "./c-FF5JPOWW.js";
7
+ } from "./c-M56MSQLW.js";
7
8
 
8
9
  // src/mask.ts
9
10
  var NAME_TOKENS = ["pass", "pwd", "card", "ccnum", "cc-num", "cvc", "cvv", "iban", "ssn", "otp", "secret", "token", "email", "phone"];
@@ -102,7 +103,19 @@ function assetSeg(x) {
102
103
  const m = HASHED.exec(x);
103
104
  return m && /[g-z]/i.test(m[1]) && scrub(m[1]) === m[1] ? x : seg(x);
104
105
  }
105
- function scrubUrl(href) {
106
+ function publicSeg(x) {
107
+ return /^[\w-]+$/.test(x) ? /\d{9}/.test(x.replace(/[-_]/g, "")) || new RegExp(KEYS.source.slice(2)).test(x) ? ":redacted" : x : assetSeg(x);
108
+ }
109
+ function publicPaths(list, origin) {
110
+ if (!Array.isArray(list)) return void 0;
111
+ const res = [];
112
+ for (const g of list.slice(0, 20)) {
113
+ if (typeof g == "string" && g[0] == "/" && g.length <= 200)
114
+ res.push(new RegExp("^" + (origin + g).replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*\*?/g, (m) => m[1] ? ".*" : "[^/]*") + "$"));
115
+ }
116
+ return res.length ? (u) => res.some((r) => r.test(u.origin + u.pathname)) : void 0;
117
+ }
118
+ function scrubUrl(href, pub) {
106
119
  if (scrub(href) === href) return href;
107
120
  try {
108
121
  const u = new URL(href, location.href);
@@ -110,7 +123,7 @@ function scrubUrl(href) {
110
123
  u.searchParams.forEach((v, k) => {
111
124
  q += (q ? "&" : "?") + encodeURIComponent(k) + "=" + encodeURIComponent(scrub(v));
112
125
  });
113
- return u.origin + u.pathname.split("/").map(assetSeg).join("/") + q;
126
+ return u.origin + u.pathname.split("/").map(pub && pub(u) ? publicSeg : assetSeg).join("/") + q;
114
127
  } catch (e) {
115
128
  return scrub(href);
116
129
  }
@@ -122,9 +135,10 @@ var DROP_ATTR = /^(on|nonce$|srcdoc$)/;
122
135
  var BIG_DATA = /data:[\w/+.-]+;base64,[\w+/=]{32768,}/g;
123
136
  var UI_WORD = /^[a-z][a-z-]{0,15}$/;
124
137
  var field = (el) => !el || /^(INPUT|TEXTAREA|SELECT)$/.test(el.tagName) && !/^(submit|button|reset|image|checkbox|radio)$/i.test(el.getAttribute("type") || "");
125
- function maskAttrsFn(level, extraMask) {
138
+ function maskAttrsFn(level, extraMask, pub) {
126
139
  const text = maskTextFn(level, extraMask);
127
140
  const masked = MASKED + extraMask;
141
+ const pubOf = (el, n) => pub && level !== "text" && el && (n === "srcset" || n === "src" && el.tagName === "IMG") && !deep(el, masked) ? pub : void 0;
128
142
  return (a, el, mut) => {
129
143
  for (const k in a) {
130
144
  const v = a[k];
@@ -141,8 +155,10 @@ function maskAttrsFn(level, extraMask) {
141
155
  const scheme = /^\s*([a-z][\w+.-]*):/i.exec(v);
142
156
  const sc = scheme ? scheme[1].toLowerCase() : "";
143
157
  a[k] = sc === "javascript" ? "#" : sc && sc !== "http" && sc !== "https" ? sc + ":*" : maskUrl(v).url || "#";
144
- } else if (SRC_ATTR.test(n)) a[k] = /^\s*(blob|data):/i.test(v) ? "" : n === "srcset" ? v.replace(/[^\s,]+/g, scrubUrl) : scrubUrl(v);
145
- else if (n.indexOf("data-") === 0) a[k] = level === "text" || deep(el, masked) ? stars(v) : UI_WORD.test(v) ? v : text(v, el);
158
+ } else if (SRC_ATTR.test(n)) {
159
+ const p = pubOf(el, n);
160
+ a[k] = /^\s*(blob|data):/i.test(v) ? "" : n === "srcset" ? v.replace(/[^\s,]+/g, (u) => scrubUrl(u, p)) : scrubUrl(v, p);
161
+ } else if (n.indexOf("data-") === 0) a[k] = level === "text" || deep(el, masked) ? stars(v) : UI_WORD.test(v) ? v : text(v, el);
146
162
  else if (TEXT_ATTR.test(n)) a[k] = text(v, el);
147
163
  }
148
164
  };
@@ -215,6 +231,7 @@ export {
215
231
  shortText,
216
232
  textFor,
217
233
  labelFor,
234
+ publicPaths,
218
235
  maskAttrsFn,
219
236
  validSelectors,
220
237
  replayOptions,
@@ -1,5 +1,5 @@
1
1
  // src/util.ts
2
- var VERSION = true ? "0.1.6" : "0.0.0-dev";
2
+ var VERSION = true ? "0.1.8" : "0.0.0-dev";
3
3
  var now = () => Date.now();
4
4
  function rnd(n) {
5
5
  const a = new Uint8Array(n);
@@ -1,13 +1,14 @@
1
1
  import {
2
2
  maskAttrsFn,
3
+ publicPaths,
3
4
  replayOptions,
4
5
  validSelectors
5
- } from "./c-UMIKYUMF.js";
6
+ } from "./c-ATMCVW2I.js";
6
7
  import {
7
8
  maskUrl,
8
9
  scrub,
9
10
  seg
10
- } from "./c-FF5JPOWW.js";
11
+ } from "./c-M56MSQLW.js";
11
12
 
12
13
  // src/replay.ts
13
14
  import { record } from "@rrweb/record";
@@ -20,7 +21,7 @@ function start(api, loadInspect) {
20
21
  if (CRAWLER.test(navigator.userAgent)) return "crawler";
21
22
  if (document.getElementsByTagName("*").length > MAX_ELEMENTS) return "dom_too_large";
22
23
  const extraMask = validSelectors(api.mask);
23
- const fix = maskAttrsFn(api.level, extraMask);
24
+ const fix = maskAttrsFn(api.level, extraMask, publicPaths(api.opts && api.opts.publicImages, location.origin));
24
25
  const el = (id) => {
25
26
  const n = record.mirror.getNode(id);
26
27
  return n && n.nodeType === 1 ? n : null;
@@ -1,7 +1,7 @@
1
1
  // src/scrub.ts
2
2
  var EMAIL = /[^\s@<>()[\]"',;:]{1,64}@[^\s@<>()[\]"',;:]{1,253}\.[a-z]{2,}/gi;
3
3
  var JWT = /\beyJ[\w-]{6,500}\.[\w-]{6,}\.[\w-]{6,}/g;
4
- var KEYS = /\b(?:sk_live_|sk_test_|rk_live_|pk_live_|ib_sk_|ghp_|gho_|ghs_|github_pat_|xox[abpr]-|AKIA|AIza|ya29\.)[\w.-]{8,}/g;
4
+ var KEYS = /\b(?:sk_(?:live|test)_|[rp]k_live_|ib_sk_|sk-(?:proj|ant)-|gh[opsu]_|github_pat_|xox[abpr]-|AKIA|AIza|ya29\.)[\w.-]{8,}/g;
5
5
  var SSN = /\b\d{3}-\d{2}-\d{4}\b/g;
6
6
  var IBAN = /\b[A-Z]{2}\d{2}(?: ?[A-Z0-9]{4}){2,7}(?: ?[A-Z0-9]{1,4})?\b/g;
7
7
  var DIGITS = /\+?\(?\d[\d\s().-]{7,}\d/g;
@@ -109,6 +109,7 @@ function boxOf(el) {
109
109
  }
110
110
 
111
111
  export {
112
+ KEYS,
112
113
  scrub,
113
114
  seg,
114
115
  maskUrl,
package/dist/esm/index.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  setReporter,
13
13
  uuid4,
14
14
  uuid7
15
- } from "./c-EMLSQ5BC.js";
15
+ } from "./c-F2YMUNOS.js";
16
16
  import {
17
17
  actionable,
18
18
  basicPath,
@@ -20,7 +20,7 @@ import {
20
20
  maskUrl,
21
21
  scrub,
22
22
  utmOf
23
- } from "./c-FF5JPOWW.js";
23
+ } from "./c-M56MSQLW.js";
24
24
 
25
25
  // src/consent.ts
26
26
  var clamp = (v, lo, hi) => v < lo ? lo : v > hi ? hi : v;
@@ -592,8 +592,7 @@ function createIonBlink(deps) {
592
592
  const rstate = () => replay.on ? { on: true } : { on: false, off_reason: replay.off };
593
593
  const collect = () => full() || mode === "basic" && !choice;
594
594
  const level = () => {
595
- const base = explicitMask || (session && session.peek().p ? "controls" : "inputs");
596
- return stricter(base, cfg ? cfg.replay.mask : void 0);
595
+ return stricter(explicitMask || "inputs", cfg ? cfg.replay.mask : void 0);
597
596
  };
598
597
  const autoOn = (k) => {
599
598
  if (killed === "all" || killed === "auto" && k !== "signals") return false;
@@ -1209,19 +1208,20 @@ function createIonBlink(deps) {
1209
1208
  if (later("set", [person])) return;
1210
1209
  if (!person || typeof person !== "object") return;
1211
1210
  const traits = cleanProps(person, false) || {};
1212
- const before = level();
1211
+ let renewed = false;
1213
1212
  if (session && typeof traits.id === "string" && traits.id) {
1214
1213
  const cur = session.peek().p;
1215
1214
  if (cur && cur !== traits.id) {
1216
1215
  cutEvents();
1217
1216
  session.reset();
1218
1217
  ctxDirty = true;
1218
+ renewed = true;
1219
1219
  } else cutEvents();
1220
1220
  session.setPerson(traits.id.slice(0, 200));
1221
1221
  ctxDirty = true;
1222
1222
  }
1223
1223
  capture("$set", traits);
1224
- if (level() !== before) restartReplay();
1224
+ if (renewed && replay.on) restartReplay();
1225
1225
  }),
1226
1226
  identify: (id, traits) => ib.set({ ...traits || {}, id }),
1227
1227
  page: guard("page", (path, props) => {
@@ -1237,12 +1237,11 @@ function createIonBlink(deps) {
1237
1237
  reset: guard("reset", () => {
1238
1238
  if (later("reset", [])) return;
1239
1239
  if (!session) return;
1240
- const before = level();
1241
1240
  cutEvents();
1242
1241
  cutReplay();
1243
1242
  session.reset();
1244
1243
  ctxDirty = true;
1245
- if (level() !== before || replay.on) restartReplay();
1244
+ if (replay.on) restartReplay();
1246
1245
  }),
1247
1246
  consent: guard("consent", (c) => {
1248
1247
  const m = choiceToMode(c);
@@ -1305,8 +1304,8 @@ function createIonBlink(deps) {
1305
1304
  // src/index.ts
1306
1305
  var ionblink = createIonBlink({
1307
1306
  dist: "npm",
1308
- loadX: () => import("./c-7SPQIMCH.js").then((m) => m.start),
1309
- loadReplay: () => import("./c-LULHYRWR.js").then((m) => m.start)
1307
+ loadX: () => import("./c-7SGWDJXK.js").then((m) => m.start),
1308
+ loadReplay: () => import("./c-ILNKGNGM.js").then((m) => m.start)
1310
1309
  });
1311
1310
  var index_default = ionblink;
1312
1311
  export {
@@ -1,10 +1,10 @@
1
1
  {
2
- "version": "0.1.6",
2
+ "version": "0.1.8",
3
3
  "files": {
4
- "v1.js": "sha384-TDVvPDTialFh7rrGgEDMzg9mB1lsZ0mf4pltIPwWXUIi94dSNu6pMeln+Cc85VKE",
5
- "ionblink.min.js": "sha384-TDVvPDTialFh7rrGgEDMzg9mB1lsZ0mf4pltIPwWXUIi94dSNu6pMeln+Cc85VKE",
6
- "x-8b414fa290.js": "sha384-itzLKcJ80QMF9PIe1eAIiT5sbTIjCWgkft3DzpuukfZC7pfFWj7Ot7qV7nbAW8TT",
7
- "r-a4f89dccd1.js": "sha384-SytGk1xBzpvNtsRK0JSWg4kDLqBoS/bSTh4dPKwiQqyi4ZNRtjocsCSbiyCW7ykH",
4
+ "v1.js": "sha384-7ZYMK9UV0ML1hTQeONxspIxyShjnyDp/QhubQOORpkFW3dRx7oX/W1Z6ZIlz4DeV",
5
+ "ionblink.min.js": "sha384-7ZYMK9UV0ML1hTQeONxspIxyShjnyDp/QhubQOORpkFW3dRx7oX/W1Z6ZIlz4DeV",
6
+ "x-52d413936f.js": "sha384-M4V+//RRtE846AzdbMBIYUfhb6EKmS6MSVa3B3qFwmkvepCrxYG2hWk5Ocvy9ntA",
7
+ "r-4b7dd9e8ad.js": "sha384-rYdF5PUHTQIEmahGp0KoEjWgcJWMKh2yX5mPv4wq834Z3EqyuZa5+igwgvQATNWg",
8
8
  "i-729781ba45.js": "sha384-73Y7j46JXga2EHgU54+2Gp/OI888ldpFEuOCWYr1eDcn65kpxSBeY/RLWoTijQKw",
9
9
  "snippet.min.js": "sha384-4AftRho4Kc/OMwLQQAHLFqKJ7j6N7O6yATMVxr5aLAkOwNrjSVfzvhJA624i0AkL"
10
10
  }