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