@gemx-dev/clarity-js 0.8.83 → 0.8.85

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/build/clarity.js CHANGED
@@ -20,8 +20,18 @@ var dom = /*#__PURE__*/Object.freeze({
20
20
  get update () { return update; },
21
21
  get updates () { return updates$2; }
22
22
  });
23
+ var timeline = /*#__PURE__*/Object.freeze({
24
+ __proto__: null,
25
+ get compute () { return compute$5; },
26
+ get reset () { return reset$5; },
27
+ get start () { return start$j; },
28
+ get stop () { return stop$h; },
29
+ get track () { return track$2; },
30
+ get updates () { return updates$1; }
31
+ });
23
32
  var upload$1 = /*#__PURE__*/Object.freeze({
24
33
  __proto__: null,
34
+ get flush () { return flush; },
25
35
  get queue () { return queue; },
26
36
  get start () { return start$h; },
27
37
  get stop () { return stop$f; },
@@ -207,11 +217,11 @@ function time(event) {
207
217
  var origin = event && event.view ? event.view.performance.timeOrigin : performance.timeOrigin;
208
218
  return Math.max(Math.round(ts + origin - baseline), 0);
209
219
  }
210
- function stop$L() {
220
+ function stop$M() {
211
221
  startTime = 0;
212
222
  }
213
223
 
214
- var version$1 = "0.8.83";
224
+ var version$1 = "0.8.85";
215
225
 
216
226
  // tslint:disable: no-bitwise
217
227
  function hash (input, precision) {
@@ -558,7 +568,7 @@ function track$8(event, x, y, time) {
558
568
  function activity(t) {
559
569
  buffer.activityTime = t;
560
570
  }
561
- function visibility(t, visible) {
571
+ function visibility$1(t, visible) {
562
572
  buffer.visible = visible;
563
573
  if (!buffer.visible) {
564
574
  activity(t);
@@ -574,7 +584,7 @@ function compute$g() {
574
584
  encode$1(4 /* Event.Baseline */);
575
585
  }
576
586
  }
577
- function stop$K() {
587
+ function stop$L() {
578
588
  reset$u();
579
589
  }
580
590
 
@@ -586,9 +596,9 @@ var baseline = /*#__PURE__*/Object.freeze({
586
596
  reset: reset$u,
587
597
  start: start$O,
588
598
  get state () { return state$b; },
589
- stop: stop$K,
599
+ stop: stop$L,
590
600
  track: track$8,
591
- visibility: visibility
601
+ visibility: visibility$1
592
602
  });
593
603
 
594
604
  var data$l = null;
@@ -616,7 +626,7 @@ function start$N() {
616
626
  updates$3 = {};
617
627
  count$1(5 /* Metric.InvokeCount */);
618
628
  }
619
- function stop$J() {
629
+ function stop$K() {
620
630
  data$k = {};
621
631
  updates$3 = {};
622
632
  }
@@ -694,7 +704,7 @@ function ping() {
694
704
  suspend();
695
705
  }
696
706
  }
697
- function stop$I() {
707
+ function stop$J() {
698
708
  clearTimeout$1(timeout$7);
699
709
  last = 0;
700
710
  interval = 0;
@@ -705,14 +715,14 @@ var ping$1 = /*#__PURE__*/Object.freeze({
705
715
  get data () { return data$j; },
706
716
  reset: reset$s,
707
717
  start: start$M,
708
- stop: stop$I
718
+ stop: stop$J
709
719
  });
710
720
 
711
721
  var data$i = null;
712
722
  function start$L() {
713
723
  data$i = {};
714
724
  }
715
- function stop$H() {
725
+ function stop$I() {
716
726
  data$i = {};
717
727
  }
718
728
  function track$7(event, time) {
@@ -745,7 +755,7 @@ var summary = /*#__PURE__*/Object.freeze({
745
755
  get data () { return data$i; },
746
756
  reset: reset$r,
747
757
  start: start$L,
748
- stop: stop$H,
758
+ stop: stop$I,
749
759
  track: track$7
750
760
  });
751
761
 
@@ -946,7 +956,7 @@ function compute$d() {
946
956
  function reset$q() {
947
957
  data$h = {};
948
958
  }
949
- function stop$G() {
959
+ function stop$H() {
950
960
  reset$q();
951
961
  }
952
962
  function redact(input) {
@@ -987,7 +997,7 @@ var variable = /*#__PURE__*/Object.freeze({
987
997
  reset: reset$q,
988
998
  set: set$1,
989
999
  start: start$K,
990
- stop: stop$G
1000
+ stop: stop$H
991
1001
  });
992
1002
 
993
1003
  var data$g = {};
@@ -1112,7 +1122,7 @@ function update$1(key, subkey, value) {
1112
1122
  }
1113
1123
  return;
1114
1124
  }
1115
- function stop$F() {
1125
+ function stop$G() {
1116
1126
  reset$p();
1117
1127
  }
1118
1128
  function parse$1(variable) {
@@ -1186,7 +1196,7 @@ var extract = /*#__PURE__*/Object.freeze({
1186
1196
  keys: keys,
1187
1197
  reset: reset$p,
1188
1198
  start: start$J,
1189
- stop: stop$F,
1199
+ stop: stop$G,
1190
1200
  trigger: trigger$2,
1191
1201
  update: update$1
1192
1202
  });
@@ -1217,7 +1227,7 @@ var COOKIE_SEP = "^" /* Constant.Caret */;
1217
1227
  function start$I() {
1218
1228
  rootDomain = null;
1219
1229
  }
1220
- function stop$E() {
1230
+ function stop$F() {
1221
1231
  rootDomain = null;
1222
1232
  }
1223
1233
  function getCookie(key, limit) {
@@ -1300,7 +1310,7 @@ var cookie = /*#__PURE__*/Object.freeze({
1300
1310
  getCookie: getCookie,
1301
1311
  setCookie: setCookie,
1302
1312
  start: start$I,
1303
- stop: stop$E
1313
+ stop: stop$F
1304
1314
  });
1305
1315
 
1306
1316
  var defaultConfig = {
@@ -1313,7 +1323,7 @@ function start$H() {
1313
1323
  excludeClassNames: ((_b = (_a = window === null || window === void 0 ? void 0 : window.GemXHeatmap) === null || _a === void 0 ? void 0 : _a.excludeClassNames) !== null && _b !== void 0 ? _b : []),
1314
1324
  };
1315
1325
  }
1316
- function stop$D() {
1326
+ function stop$E() {
1317
1327
  _config = __assign({}, defaultConfig);
1318
1328
  }
1319
1329
  function set(config) {
@@ -1328,7 +1338,7 @@ var gemx = /*#__PURE__*/Object.freeze({
1328
1338
  get: get$2,
1329
1339
  set: set,
1330
1340
  start: start$H,
1331
- stop: stop$D
1341
+ stop: stop$E
1332
1342
  });
1333
1343
 
1334
1344
  var signalCallback = null;
@@ -1359,19 +1369,19 @@ function signalsEvent(signalsPayload) {
1359
1369
  }
1360
1370
  }
1361
1371
 
1362
- var modules$2 = [gemx, baseline, dimension, variable, limit, summary, cookie, consent$2, metadata$1, envelope$1, upload$1, ping$1, upgrade$1, extract];
1372
+ var modules$3 = [gemx, baseline, dimension, variable, limit, summary, cookie, consent$2, metadata$1, envelope$1, upload$1, ping$1, upgrade$1, extract];
1363
1373
  function start$G() {
1364
1374
  // Metric needs to be initialized before we can start measuring. so metric is not wrapped in measure
1365
1375
  start$N();
1366
- modules$2.forEach(function (x) { return measure(x.start)(); });
1376
+ modules$3.forEach(function (x) { return measure(x.start)(); });
1367
1377
  }
1368
- function stop$C() {
1378
+ function stop$D() {
1369
1379
  // Stop modules in the reverse order of their initialization
1370
1380
  // The ordering below should respect inter-module dependency.
1371
1381
  // E.g. if upgrade depends on upload, then upgrade needs to end before upload.
1372
1382
  // Similarly, if upload depends on metadata, upload needs to end before metadata.
1373
- modules$2.slice().reverse().forEach(function (x) { return measure(x.stop)(); });
1374
- stop$J();
1383
+ modules$3.slice().reverse().forEach(function (x) { return measure(x.stop)(); });
1384
+ stop$K();
1375
1385
  }
1376
1386
  function compute$b() {
1377
1387
  compute$d();
@@ -1440,10 +1450,19 @@ function recompute$8(evt) {
1440
1450
  function reset$o() {
1441
1451
  state$a = [];
1442
1452
  }
1443
- function stop$B() {
1453
+ function stop$C() {
1444
1454
  reset$o();
1445
1455
  }
1446
1456
 
1457
+ var change = /*#__PURE__*/Object.freeze({
1458
+ __proto__: null,
1459
+ observe: observe$c,
1460
+ reset: reset$o,
1461
+ start: start$E,
1462
+ get state () { return state$a; },
1463
+ stop: stop$C
1464
+ });
1465
+
1447
1466
  function offset(element) {
1448
1467
  var output = { x: 0, y: 0 };
1449
1468
  // Walk up the chain to ensure we compute offset distance correctly
@@ -1694,10 +1713,19 @@ function source() {
1694
1713
  function reset$n() {
1695
1714
  state$9 = [];
1696
1715
  }
1697
- function stop$A() {
1716
+ function stop$B() {
1698
1717
  reset$n();
1699
1718
  }
1700
1719
 
1720
+ var click = /*#__PURE__*/Object.freeze({
1721
+ __proto__: null,
1722
+ observe: observe$b,
1723
+ reset: reset$n,
1724
+ start: start$D,
1725
+ get state () { return state$9; },
1726
+ stop: stop$B
1727
+ });
1728
+
1701
1729
  var state$8 = [];
1702
1730
  function start$C() {
1703
1731
  reset$m();
@@ -1714,10 +1742,19 @@ function recompute$7(action, evt) {
1714
1742
  function reset$m() {
1715
1743
  state$8 = [];
1716
1744
  }
1717
- function stop$z() {
1745
+ function stop$A() {
1718
1746
  reset$m();
1719
1747
  }
1720
1748
 
1749
+ var clipboard = /*#__PURE__*/Object.freeze({
1750
+ __proto__: null,
1751
+ observe: observe$a,
1752
+ reset: reset$m,
1753
+ start: start$C,
1754
+ get state () { return state$8; },
1755
+ stop: stop$A
1756
+ });
1757
+
1721
1758
  var timeout$6 = null;
1722
1759
  var state$7 = [];
1723
1760
  function start$B() {
@@ -1754,11 +1791,20 @@ function process$7(event) {
1754
1791
  function reset$l() {
1755
1792
  state$7 = [];
1756
1793
  }
1757
- function stop$y() {
1794
+ function stop$z() {
1758
1795
  clearTimeout$1(timeout$6);
1759
1796
  reset$l();
1760
1797
  }
1761
1798
 
1799
+ var input = /*#__PURE__*/Object.freeze({
1800
+ __proto__: null,
1801
+ observe: observe$9,
1802
+ reset: reset$l,
1803
+ start: start$B,
1804
+ get state () { return state$7; },
1805
+ stop: stop$z
1806
+ });
1807
+
1762
1808
  var state$6 = [];
1763
1809
  var timeout$5 = null;
1764
1810
  var hasPrimaryTouch = false;
@@ -1872,7 +1918,7 @@ function similar$1(last, current) {
1872
1918
  var sameId = current.data.id !== undefined ? current.data.id === last.data.id : true;
1873
1919
  return current.event === last.event && match && distance < 20 /* Setting.Distance */ && gap < 25 /* Setting.PointerInterval */ && sameId;
1874
1920
  }
1875
- function stop$x() {
1921
+ function stop$y() {
1876
1922
  clearTimeout$1(timeout$5);
1877
1923
  // Send out any pending pointer events in the pipeline
1878
1924
  if (state$6.length > 0) {
@@ -1880,6 +1926,15 @@ function stop$x() {
1880
1926
  }
1881
1927
  }
1882
1928
 
1929
+ var pointer = /*#__PURE__*/Object.freeze({
1930
+ __proto__: null,
1931
+ observe: observe$8,
1932
+ reset: reset$k,
1933
+ start: start$A,
1934
+ get state () { return state$6; },
1935
+ stop: stop$y
1936
+ });
1937
+
1883
1938
  /**
1884
1939
  * Creates a throttled version of the provided function that only executes at most once
1885
1940
  * every specified duration in milliseconds, ensuring the last event is not lost.
@@ -1962,10 +2017,18 @@ function reset$j() {
1962
2017
  clearTimeout$1(timeout$4);
1963
2018
  throttledRecompute$1.cleanup();
1964
2019
  }
1965
- function stop$w() {
2020
+ function stop$x() {
1966
2021
  reset$j();
1967
2022
  }
1968
2023
 
2024
+ var resize = /*#__PURE__*/Object.freeze({
2025
+ __proto__: null,
2026
+ get data () { return data$e; },
2027
+ reset: reset$j,
2028
+ start: start$z,
2029
+ stop: stop$x
2030
+ });
2031
+
1969
2032
  var state$5 = [];
1970
2033
  var initialTop = null;
1971
2034
  var initialBottom = null;
@@ -2067,7 +2130,7 @@ function compute$a() {
2067
2130
  log(32 /* Dimension.InitialScrollBottom */, (_b = bottom === null || bottom === void 0 ? void 0 : bottom.hash) === null || _b === void 0 ? void 0 : _b.join("." /* Constant.Dot */));
2068
2131
  }
2069
2132
  }
2070
- function stop$v() {
2133
+ function stop$w() {
2071
2134
  clearTimeout$1(timeout$3);
2072
2135
  throttledRecompute.cleanup();
2073
2136
  state$5 = [];
@@ -2075,6 +2138,16 @@ function stop$v() {
2075
2138
  initialBottom = null;
2076
2139
  }
2077
2140
 
2141
+ var scroll = /*#__PURE__*/Object.freeze({
2142
+ __proto__: null,
2143
+ compute: compute$a,
2144
+ observe: observe$7,
2145
+ reset: reset$i,
2146
+ start: start$y,
2147
+ get state () { return state$5; },
2148
+ stop: stop$w
2149
+ });
2150
+
2078
2151
  var data$d = null;
2079
2152
  var previous = null;
2080
2153
  var timeout$2 = null;
@@ -2122,11 +2195,20 @@ function reset$h() {
2122
2195
  previous = null;
2123
2196
  data$d = { start: 0, startOffset: 0, end: 0, endOffset: 0 };
2124
2197
  }
2125
- function stop$u() {
2198
+ function stop$v() {
2126
2199
  reset$h();
2127
2200
  clearTimeout$1(timeout$2);
2128
2201
  }
2129
2202
 
2203
+ var selection = /*#__PURE__*/Object.freeze({
2204
+ __proto__: null,
2205
+ get data () { return data$d; },
2206
+ observe: observe$6,
2207
+ reset: reset$h,
2208
+ start: start$x,
2209
+ stop: stop$v
2210
+ });
2211
+
2130
2212
  var state$4 = [];
2131
2213
  function start$w() {
2132
2214
  reset$g();
@@ -2141,13 +2223,26 @@ function recompute$2(evt) {
2141
2223
  function reset$g() {
2142
2224
  state$4 = [];
2143
2225
  }
2144
- function stop$t() {
2226
+ function stop$u() {
2145
2227
  reset$g();
2146
2228
  }
2147
2229
 
2230
+ var submit = /*#__PURE__*/Object.freeze({
2231
+ __proto__: null,
2232
+ observe: observe$5,
2233
+ reset: reset$g,
2234
+ start: start$w,
2235
+ get state () { return state$4; },
2236
+ stop: stop$u
2237
+ });
2238
+
2148
2239
  var data$c;
2149
2240
  function start$v() {
2150
2241
  bind(window, "pagehide", recompute$1);
2242
+ bind(window, "beforeunload", beforeUnload);
2243
+ }
2244
+ function beforeUnload() {
2245
+ flush();
2151
2246
  }
2152
2247
  function recompute$1(evt) {
2153
2248
  data$c = { name: evt.type, persisted: evt.persisted ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */ };
@@ -2157,10 +2252,18 @@ function recompute$1(evt) {
2157
2252
  function reset$f() {
2158
2253
  data$c = null;
2159
2254
  }
2160
- function stop$s() {
2255
+ function stop$t() {
2161
2256
  reset$f();
2162
2257
  }
2163
2258
 
2259
+ var unload = /*#__PURE__*/Object.freeze({
2260
+ __proto__: null,
2261
+ get data () { return data$c; },
2262
+ reset: reset$f,
2263
+ start: start$v,
2264
+ stop: stop$t
2265
+ });
2266
+
2164
2267
  var data$b;
2165
2268
  function start$u() {
2166
2269
  bind(document, "visibilitychange", recompute);
@@ -2177,16 +2280,24 @@ function recompute(evt) {
2177
2280
  function reset$e() {
2178
2281
  data$b = null;
2179
2282
  }
2180
- function stop$r() {
2283
+ function stop$s() {
2181
2284
  reset$e();
2182
2285
  }
2183
2286
 
2287
+ var visibility = /*#__PURE__*/Object.freeze({
2288
+ __proto__: null,
2289
+ get data () { return data$b; },
2290
+ reset: reset$e,
2291
+ start: start$u,
2292
+ stop: stop$s
2293
+ });
2294
+
2184
2295
  var data$a;
2185
2296
  function start$t() {
2186
2297
  bind(window, "focus", function () { return compute$9(1 /* BooleanFlag.True */); });
2187
2298
  bind(window, "blur", function () { return compute$9(0 /* BooleanFlag.False */); });
2188
2299
  }
2189
- function stop$q() {
2300
+ function stop$r() {
2190
2301
  reset$d();
2191
2302
  }
2192
2303
  function reset$d() {
@@ -2197,6 +2308,14 @@ function compute$9(focus) {
2197
2308
  encode$4(50 /* Event.Focus */);
2198
2309
  }
2199
2310
 
2311
+ var focus = /*#__PURE__*/Object.freeze({
2312
+ __proto__: null,
2313
+ get data () { return data$a; },
2314
+ reset: reset$d,
2315
+ start: start$t,
2316
+ stop: stop$r
2317
+ });
2318
+
2200
2319
  var bound = false;
2201
2320
  function start$s() {
2202
2321
  // Only bind once - this listener must persist even when Clarity stops
@@ -2219,50 +2338,59 @@ function handler$2(evt) {
2219
2338
  log$1(11 /* Code.BFCache */, 0 /* Severity.Info */);
2220
2339
  }
2221
2340
  }
2341
+ function stop$q() {
2342
+ // Intentionally don't remove the listener or reset 'bound' flag
2343
+ // We need the listener to persist to detect bfcache restoration
2344
+ }
2345
+
2346
+ var pageshow = /*#__PURE__*/Object.freeze({
2347
+ __proto__: null,
2348
+ start: start$s,
2349
+ stop: stop$q
2350
+ });
2222
2351
 
2352
+ var GEMX$1 = [
2353
+ timeline,
2354
+ click,
2355
+ resize,
2356
+ visibility,
2357
+ scroll,
2358
+ pageshow,
2359
+ unload,
2360
+ ];
2361
+ var ALL$1 = [
2362
+ timeline,
2363
+ click,
2364
+ clipboard,
2365
+ pointer,
2366
+ input,
2367
+ resize,
2368
+ visibility,
2369
+ focus,
2370
+ pageshow,
2371
+ scroll,
2372
+ selection,
2373
+ change,
2374
+ submit,
2375
+ unload
2376
+ ];
2377
+ var GEMX_OBSERVE = { allRoots: [scroll], documentOnly: [click] };
2378
+ var ALL_OBSERVE = { allRoots: [scroll], documentOnly: [click, clipboard, pointer, input, selection, change, submit] };
2379
+ var modules$2 = ALL$1;
2380
+ var observeModules = ALL_OBSERVE;
2223
2381
  function start$r() {
2224
- start$j();
2225
- start$D();
2226
- start$C();
2227
- start$A();
2228
- start$B();
2229
- start$z();
2230
- start$u();
2231
- start$t();
2232
- start$s();
2233
- start$y();
2234
- start$x();
2235
- start$E();
2236
- start$w();
2237
- start$v();
2382
+ var mode = config$2.mode;
2383
+ modules$2 = mode === "gemx" ? GEMX$1 : ALL$1;
2384
+ observeModules = mode === "gemx" ? GEMX_OBSERVE : ALL_OBSERVE;
2385
+ modules$2.forEach(function (m) { return m.start(); });
2238
2386
  }
2239
2387
  function stop$p() {
2240
- stop$h();
2241
- stop$A();
2242
- stop$z();
2243
- stop$x();
2244
- stop$y();
2245
- stop$w();
2246
- stop$r();
2247
- stop$q();
2248
- stop$v();
2249
- stop$u();
2250
- stop$B();
2251
- stop$t();
2252
- stop$s();
2388
+ modules$2.forEach(function (m) { return m.stop(); });
2253
2389
  }
2254
2390
  function observe$4(root) {
2255
- observe$7(root);
2256
- // Only monitor following interactions if the root node is a document
2257
- // In case of shadow DOM, following events automatically bubble up to the parent document.
2391
+ observeModules.allRoots.forEach(function (m) { return m.observe(root); });
2258
2392
  if (root.nodeType === Node.DOCUMENT_NODE) {
2259
- observe$b(root);
2260
- observe$a(root);
2261
- observe$8(root);
2262
- observe$9(root);
2263
- observe$6(root);
2264
- observe$c(root);
2265
- observe$5(root);
2393
+ observeModules.documentOnly.forEach(function (m) { return m.observe(root); });
2266
2394
  }
2267
2395
  }
2268
2396
 
@@ -4561,7 +4689,7 @@ function encode$4 (type, ts) {
4561
4689
  v = data$b;
4562
4690
  tokens.push(v.visible);
4563
4691
  queue(tokens);
4564
- visibility(t, v.visible);
4692
+ visibility$1(t, v.visible);
4565
4693
  reset$e();
4566
4694
  break;
4567
4695
  case 50 /* Event.Focus */: {
@@ -4914,6 +5042,14 @@ function queue(tokens, transmit) {
4914
5042
  check$2(playbackBytes);
4915
5043
  }
4916
5044
  }
5045
+ function flush() {
5046
+ if (!active$1) {
5047
+ return;
5048
+ }
5049
+ clearTimeout$1(timeout);
5050
+ timeout = null;
5051
+ upload(true);
5052
+ }
4917
5053
  function stop$f() {
4918
5054
  clearTimeout$1(timeout);
4919
5055
  upload(true);
@@ -6352,7 +6488,7 @@ function stop$5() {
6352
6488
  reset$2();
6353
6489
  reset$1();
6354
6490
  reset$4();
6355
- stop$L();
6491
+ stop$M();
6356
6492
  status = false;
6357
6493
  }
6358
6494
  function active() {
@@ -6745,9 +6881,12 @@ var performance$1 = /*#__PURE__*/Object.freeze({
6745
6881
  stop: stop$1
6746
6882
  });
6747
6883
 
6748
- var modules = [diagnostic, layout, interaction, performance$1, dynamic];
6884
+ var GEMX = [diagnostic, layout, interaction];
6885
+ var ALL = [diagnostic, layout, interaction, performance$1, dynamic];
6886
+ var modules = ALL;
6749
6887
  function start(config$1) {
6750
6888
  if (config$1 === void 0) { config$1 = null; }
6889
+ modules = config$1.mode === "gemx" ? GEMX : ALL;
6751
6890
  // Check that browser supports required APIs and we do not attempt to start Clarity multiple times
6752
6891
  if (check()) {
6753
6892
  config(config$1);
@@ -6783,7 +6922,7 @@ function stop() {
6783
6922
  if (active()) {
6784
6923
  // Stop modules in the reverse order of their initialization and start queuing up items again
6785
6924
  modules.slice().reverse().forEach(function (x) { return measure(x.stop)(); });
6786
- stop$C();
6925
+ stop$D();
6787
6926
  stop$5();
6788
6927
  setup();
6789
6928
  }