clarity-js 0.7.53 → 0.7.57

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.
@@ -83,11 +83,11 @@ function setup() {
83
83
  w[c] = function () {
84
84
  (w[c].q = w[c].q || []).push(arguments);
85
85
  // if the start function was called, don't queue it and instead process the queue
86
- arguments[0] === "start" && w[c].q.unshift(w[c].q.pop()) && process$7();
86
+ arguments[0] === "start" && w[c].q.unshift(w[c].q.pop()) && process$8();
87
87
  };
88
88
  }
89
89
  }
90
- function process$7() {
90
+ function process$8() {
91
91
  if (typeof w !== "undefined") {
92
92
  // Do not execute or reset global "clarity" variable if a version of Clarity is already running on the page
93
93
  if (w[c] && w[c].v) {
@@ -136,6 +136,7 @@ var config$2 = {
136
136
  throttleDom: true,
137
137
  conversions: false,
138
138
  longTask: 30,
139
+ includeSubdomains: true,
139
140
  };
140
141
 
141
142
  function api(method) {
@@ -163,7 +164,7 @@ function stop$F() {
163
164
  startTime = 0;
164
165
  }
165
166
 
166
- var version$1 = "0.7.53";
167
+ var version$1 = "0.7.57";
167
168
 
168
169
  // tslint:disable: no-bitwise
169
170
  function hash (input, precision) {
@@ -540,16 +541,16 @@ function clearTimeout(handle) {
540
541
  var data$h;
541
542
  var last = 0;
542
543
  var interval = 0;
543
- var timeout$6 = null;
544
+ var timeout$7 = null;
544
545
  function start$F() {
545
546
  interval = 60000 /* Setting.PingInterval */;
546
547
  last = 0;
547
548
  }
548
549
  function reset$q() {
549
- if (timeout$6) {
550
- clearTimeout(timeout$6);
550
+ if (timeout$7) {
551
+ clearTimeout(timeout$7);
551
552
  }
552
- timeout$6 = setTimeout(ping, interval);
553
+ timeout$7 = setTimeout(ping, interval);
553
554
  last = time();
554
555
  }
555
556
  function ping() {
@@ -557,14 +558,14 @@ function ping() {
557
558
  data$h = { gap: now - last };
558
559
  encode$1(25 /* Event.Ping */);
559
560
  if (data$h.gap < 300000 /* Setting.PingTimeout */) {
560
- timeout$6 = setTimeout(ping, interval);
561
+ timeout$7 = setTimeout(ping, interval);
561
562
  }
562
563
  else {
563
564
  suspend();
564
565
  }
565
566
  }
566
567
  function stop$C() {
567
- clearTimeout(timeout$6);
568
+ clearTimeout(timeout$7);
568
569
  last = 0;
569
570
  interval = 0;
570
571
  }
@@ -1156,7 +1157,7 @@ function add(node, parent, data, source) {
1156
1157
  };
1157
1158
  privacy(node, values[id], parentValue);
1158
1159
  updateSelector(values[id]);
1159
- size$1(values[id]);
1160
+ updateImageSize(values[id]);
1160
1161
  track$6(id, source);
1161
1162
  }
1162
1163
  function update$1(node, parent, data, source) {
@@ -1233,6 +1234,7 @@ function iframe(node) {
1233
1234
  return doc && iframeMap.has(doc) ? iframeMap.get(doc) : null;
1234
1235
  }
1235
1236
  function privacy(node, value, parent) {
1237
+ var _a;
1236
1238
  var data = value.data;
1237
1239
  var metadata = value.metadata;
1238
1240
  var current = metadata.privacy;
@@ -1277,6 +1279,12 @@ function privacy(node, value, parent) {
1277
1279
  // In a mode where we mask sensitive information by default, look through class names to aggressively mask content
1278
1280
  metadata.privacy = inspect(attributes["class" /* Constant.Class */], maskText, metadata);
1279
1281
  break;
1282
+ case tag === "IMG" /* Constant.ImageTag */:
1283
+ // Mask images with blob src as it is not publicly available anyway.
1284
+ if ((_a = attributes.src) === null || _a === void 0 ? void 0 : _a.startsWith('blob:')) {
1285
+ metadata.privacy = 3 /* Privacy.TextImage */;
1286
+ }
1287
+ break;
1280
1288
  }
1281
1289
  }
1282
1290
  function inspect(input, lookup, metadata) {
@@ -1383,9 +1391,17 @@ function removeNodeFromNodesMap(id) {
1383
1391
  }
1384
1392
  }
1385
1393
  }
1386
- function size$1(value) {
1394
+ function updateImageSize(value) {
1387
1395
  // If this element is a image node, and is masked, then track box model for the current element
1388
1396
  if (value.data.tag === "IMG" /* Constant.ImageTag */ && value.metadata.privacy === 3 /* Privacy.TextImage */) {
1397
+ var img_1 = getNode(value.id);
1398
+ // We will not capture the natural image dimensions until it loads.
1399
+ if (img_1 && (!img_1.complete || img_1.naturalWidth === 0)) {
1400
+ // This will trigger mutation to update the original width and height after image loads.
1401
+ bind(img_1, 'load', function () {
1402
+ img_1.setAttribute('data-clarity-loaded', "".concat(shortid()));
1403
+ });
1404
+ }
1389
1405
  value.metadata.size = [];
1390
1406
  }
1391
1407
  }
@@ -1896,7 +1912,7 @@ function stop$s() {
1896
1912
  reset$h();
1897
1913
  }
1898
1914
 
1899
- var timeout$5 = null;
1915
+ var timeout$6 = null;
1900
1916
  var state$6 = [];
1901
1917
  function start$t() {
1902
1918
  reset$g();
@@ -1922,23 +1938,23 @@ function recompute$6(evt) {
1922
1938
  state$6.pop();
1923
1939
  }
1924
1940
  state$6.push({ time: time(evt), event: 27 /* Event.Input */, data: data });
1925
- clearTimeout(timeout$5);
1926
- timeout$5 = setTimeout(process$6, 1000 /* Setting.InputLookAhead */, 27 /* Event.Input */);
1941
+ clearTimeout(timeout$6);
1942
+ timeout$6 = setTimeout(process$7, 1000 /* Setting.InputLookAhead */, 27 /* Event.Input */);
1927
1943
  }
1928
1944
  }
1929
- function process$6(event) {
1945
+ function process$7(event) {
1930
1946
  schedule$1(encode$3.bind(this, event));
1931
1947
  }
1932
1948
  function reset$g() {
1933
1949
  state$6 = [];
1934
1950
  }
1935
1951
  function stop$r() {
1936
- clearTimeout(timeout$5);
1952
+ clearTimeout(timeout$6);
1937
1953
  reset$g();
1938
1954
  }
1939
1955
 
1940
1956
  var state$5 = [];
1941
- var timeout$4 = null;
1957
+ var timeout$5 = null;
1942
1958
  function start$s() {
1943
1959
  reset$f();
1944
1960
  }
@@ -2003,16 +2019,16 @@ function handler$2(current) {
2003
2019
  state$5.pop();
2004
2020
  }
2005
2021
  state$5.push(current);
2006
- clearTimeout(timeout$4);
2007
- timeout$4 = setTimeout(process$5, 500 /* Setting.LookAhead */, current.event);
2022
+ clearTimeout(timeout$5);
2023
+ timeout$5 = setTimeout(process$6, 500 /* Setting.LookAhead */, current.event);
2008
2024
  break;
2009
2025
  default:
2010
2026
  state$5.push(current);
2011
- process$5(current.event);
2027
+ process$6(current.event);
2012
2028
  break;
2013
2029
  }
2014
2030
  }
2015
- function process$5(event) {
2031
+ function process$6(event) {
2016
2032
  schedule$1(encode$3.bind(this, event));
2017
2033
  }
2018
2034
  function reset$f() {
@@ -2027,14 +2043,15 @@ function similar$1(last, current) {
2027
2043
  return current.event === last.event && match && distance < 20 /* Setting.Distance */ && gap < 25 /* Setting.Interval */;
2028
2044
  }
2029
2045
  function stop$q() {
2030
- clearTimeout(timeout$4);
2046
+ clearTimeout(timeout$5);
2031
2047
  // Send out any pending pointer events in the pipeline
2032
2048
  if (state$5.length > 0) {
2033
- process$5(state$5[state$5.length - 1].event);
2049
+ process$6(state$5[state$5.length - 1].event);
2034
2050
  }
2035
2051
  }
2036
2052
 
2037
2053
  var data$b;
2054
+ var timeout$4 = null;
2038
2055
  function start$r() {
2039
2056
  bind(window, "resize", recompute$5);
2040
2057
  recompute$5();
@@ -2047,10 +2064,15 @@ function recompute$5() {
2047
2064
  width: de && "clientWidth" in de ? Math.min(de.clientWidth, window.innerWidth) : window.innerWidth,
2048
2065
  height: de && "clientHeight" in de ? Math.min(de.clientHeight, window.innerHeight) : window.innerHeight,
2049
2066
  };
2050
- encode$3(11 /* Event.Resize */);
2067
+ clearTimeout(timeout$4);
2068
+ timeout$4 = setTimeout(process$5, 500 /* Setting.LookAhead */, 11 /* Event.Resize */);
2069
+ }
2070
+ function process$5(event) {
2071
+ schedule$1(encode$3.bind(this, event));
2051
2072
  }
2052
2073
  function reset$e() {
2053
2074
  data$b = null;
2075
+ clearTimeout(timeout$4);
2054
2076
  }
2055
2077
  function stop$p() {
2056
2078
  reset$e();
@@ -2349,6 +2371,7 @@ function traverse (root, timer, source, timestamp) {
2349
2371
 
2350
2372
  var observers = [];
2351
2373
  var mutations = [];
2374
+ var throttledMutations = {};
2352
2375
  var insertRule = null;
2353
2376
  var deleteRule = null;
2354
2377
  var attachShadow = null;
@@ -2356,6 +2379,7 @@ var mediaInsertRule = null;
2356
2379
  var mediaDeleteRule = null;
2357
2380
  var queue$2 = [];
2358
2381
  var timeout$1 = null;
2382
+ var throttleDelay = null;
2359
2383
  var activePeriod = null;
2360
2384
  var history$4 = {};
2361
2385
  function start$k() {
@@ -2459,6 +2483,7 @@ function stop$i() {
2459
2483
  observers = [];
2460
2484
  history$4 = {};
2461
2485
  mutations = [];
2486
+ throttledMutations = [];
2462
2487
  queue$2 = [];
2463
2488
  activePeriod = 0;
2464
2489
  timeout$1 = null;
@@ -2476,36 +2501,24 @@ function handle$1(m) {
2476
2501
  measure(compute$6)();
2477
2502
  });
2478
2503
  }
2479
- function process$2() {
2504
+ function processMutation(timer, mutation, instance, timestamp) {
2480
2505
  return __awaiter(this, void 0, void 0, function () {
2481
- var timer, record, instance, _i, _a, mutation, state, target, type, value;
2482
- return __generator(this, function (_b) {
2483
- switch (_b.label) {
2506
+ var state, target, type;
2507
+ return __generator(this, function (_a) {
2508
+ switch (_a.label) {
2484
2509
  case 0:
2485
- timer = { id: id(), cost: 3 /* Metric.LayoutCost */ };
2486
- start$y(timer);
2487
- _b.label = 1;
2488
- case 1:
2489
- if (!(mutations.length > 0)) return [3 /*break*/, 8];
2490
- record = mutations.shift();
2491
- instance = time();
2492
- _i = 0, _a = record.mutations;
2493
- _b.label = 2;
2494
- case 2:
2495
- if (!(_i < _a.length)) return [3 /*break*/, 6];
2496
- mutation = _a[_i];
2497
2510
  state = state$a(timer);
2498
- if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 4];
2511
+ if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 2];
2499
2512
  return [4 /*yield*/, suspend$1(timer)];
2500
- case 3:
2501
- state = _b.sent();
2502
- _b.label = 4;
2503
- case 4:
2513
+ case 1:
2514
+ state = _a.sent();
2515
+ _a.label = 2;
2516
+ case 2:
2504
2517
  if (state === 2 /* Task.Stop */) {
2505
- return [3 /*break*/, 6];
2518
+ return [2 /*return*/];
2506
2519
  }
2507
2520
  target = mutation.target;
2508
- type = config$2.throttleDom ? track$5(mutation, timer, instance, record.time) : mutation.type;
2521
+ type = config$2.throttleDom ? track$5(mutation, timer, instance, timestamp) : mutation.type;
2509
2522
  if (type && target && target.ownerDocument) {
2510
2523
  parse$1(target.ownerDocument);
2511
2524
  }
@@ -2514,31 +2527,60 @@ function process$2() {
2514
2527
  }
2515
2528
  switch (type) {
2516
2529
  case "attributes" /* Constant.Attributes */:
2517
- processNode(target, 3 /* Source.Attributes */, record.time);
2530
+ processNode(target, 3 /* Source.Attributes */, timestamp);
2518
2531
  break;
2519
2532
  case "characterData" /* Constant.CharacterData */:
2520
- processNode(target, 4 /* Source.CharacterData */, record.time);
2533
+ processNode(target, 4 /* Source.CharacterData */, timestamp);
2521
2534
  break;
2522
2535
  case "childList" /* Constant.ChildList */:
2523
- processNodeList(mutation.addedNodes, 1 /* Source.ChildListAdd */, timer, record.time);
2524
- processNodeList(mutation.removedNodes, 2 /* Source.ChildListRemove */, timer, record.time);
2525
- break;
2526
- case "suspend" /* Constant.Suspend */:
2527
- value = get(target);
2528
- if (value) {
2529
- value.metadata.suspend = true;
2530
- }
2536
+ processNodeList(mutation.addedNodes, 1 /* Source.ChildListAdd */, timer, timestamp);
2537
+ processNodeList(mutation.removedNodes, 2 /* Source.ChildListRemove */, timer, timestamp);
2531
2538
  break;
2532
2539
  }
2533
- _b.label = 5;
2534
- case 5:
2535
- _i++;
2536
- return [3 /*break*/, 2];
2537
- case 6: return [4 /*yield*/, encode$4(6 /* Event.Mutation */, timer, record.time)];
2538
- case 7:
2539
- _b.sent();
2540
+ return [2 /*return*/];
2541
+ }
2542
+ });
2543
+ });
2544
+ }
2545
+ function process$2() {
2546
+ return __awaiter(this, void 0, void 0, function () {
2547
+ var timer, record, instance, _i, _a, mutation, processedMutations, _b, _c, key, throttledMutationToProcess;
2548
+ return __generator(this, function (_d) {
2549
+ switch (_d.label) {
2550
+ case 0:
2551
+ timer = { id: id(), cost: 3 /* Metric.LayoutCost */ };
2552
+ start$y(timer);
2553
+ _d.label = 1;
2554
+ case 1:
2555
+ if (!(mutations.length > 0)) return [3 /*break*/, 3];
2556
+ record = mutations.shift();
2557
+ instance = time();
2558
+ for (_i = 0, _a = record.mutations; _i < _a.length; _i++) {
2559
+ mutation = _a[_i];
2560
+ processMutation(timer, mutation, instance, record.time);
2561
+ }
2562
+ return [4 /*yield*/, encode$4(6 /* Event.Mutation */, timer, record.time)];
2563
+ case 2:
2564
+ _d.sent();
2540
2565
  return [3 /*break*/, 1];
2541
- case 8:
2566
+ case 3:
2567
+ processedMutations = false;
2568
+ for (_b = 0, _c = Object.keys(throttledMutations); _b < _c.length; _b++) {
2569
+ key = _c[_b];
2570
+ throttledMutationToProcess = throttledMutations[key];
2571
+ delete throttledMutations[key];
2572
+ processMutation(timer, throttledMutationToProcess.mutation, time(), throttledMutationToProcess.timestamp);
2573
+ processedMutations = true;
2574
+ }
2575
+ if (Object.keys(throttledMutations).length > 0) {
2576
+ processThrottledMutations();
2577
+ }
2578
+ if (!(Object.keys(throttledMutations).length === 0 && processedMutations)) return [3 /*break*/, 5];
2579
+ return [4 /*yield*/, encode$4(6 /* Event.Mutation */, timer, time())];
2580
+ case 4:
2581
+ _d.sent();
2582
+ _d.label = 5;
2583
+ case 5:
2542
2584
  stop$w(timer);
2543
2585
  return [2 /*return*/];
2544
2586
  }
@@ -2569,14 +2611,16 @@ function track$5(m, timer, instance, timestamp) {
2569
2611
  h[0] = inactive ? (h[1] === instance ? h[0] : h[0] + 1) : 1;
2570
2612
  h[1] = instance;
2571
2613
  // Return updated mutation type based on if we have already hit the threshold or not
2572
- if (h[0] === 10 /* Setting.MutationSuspendThreshold */) {
2614
+ if (h[0] >= 10 /* Setting.MutationSuspendThreshold */) {
2573
2615
  // Store a reference to removedNodes so we can process them later
2574
2616
  // when we resume mutations again on user interactions
2575
2617
  h[2] = m.removedNodes;
2576
- return "suspend" /* Constant.Suspend */;
2577
- }
2578
- else if (h[0] > 10 /* Setting.MutationSuspendThreshold */) {
2579
- return "" /* Constant.Empty */;
2618
+ if (instance > timestamp + 3000 /* Setting.MutationActivePeriod */) {
2619
+ return m.type;
2620
+ }
2621
+ // we only store the most recent mutation for a given key if it is being throttled
2622
+ throttledMutations[key] = { mutation: m, timestamp: timestamp };
2623
+ return "throttle" /* Constant.Throttle */;
2580
2624
  }
2581
2625
  }
2582
2626
  return m.type;
@@ -2623,6 +2667,12 @@ function processNodeList(list, source, timer, timestamp) {
2623
2667
  });
2624
2668
  });
2625
2669
  }
2670
+ function processThrottledMutations() {
2671
+ if (throttleDelay) {
2672
+ clearTimeout(throttleDelay);
2673
+ }
2674
+ throttleDelay = setTimeout(function () { schedule$1(process$2, 1 /* Priority.High */); }, 33 /* Setting.LookAhead */);
2675
+ }
2626
2676
  function schedule(node) {
2627
2677
  // Only schedule manual trigger for this node if it's not already in the queue
2628
2678
  if (queue$2.indexOf(node) < 0) {
@@ -2700,9 +2750,6 @@ function ld(json) {
2700
2750
  max(12 /* Metric.RatingCount */, num$1(json["ratingCount" /* JsonLD.RatingCount */]));
2701
2751
  max(17 /* Metric.ReviewCount */, num$1(json["reviewCount" /* JsonLD.ReviewCount */]));
2702
2752
  break;
2703
- case "person" /* JsonLD.Author */:
2704
- log(8 /* Dimension.AuthorName */, json["name" /* JsonLD.Name */]);
2705
- break;
2706
2753
  case "offer" /* JsonLD.Offer */:
2707
2754
  log(7 /* Dimension.ProductAvailability */, json["availability" /* JsonLD.Availability */]);
2708
2755
  log(14 /* Dimension.ProductCondition */, json["itemCondition" /* JsonLD.ItemCondition */]);
@@ -3118,6 +3165,7 @@ var state$2 = [];
3118
3165
  var elementAnimate = null;
3119
3166
  var animationPlay = null;
3120
3167
  var animationPause = null;
3168
+ var animationCommitStyles = null;
3121
3169
  var animationCancel = null;
3122
3170
  var animationFinish = null;
3123
3171
  var animationId = 'clarityAnimationId';
@@ -3125,12 +3173,15 @@ var operationCount = 'clarityOperationCount';
3125
3173
  var maxOperations = 20;
3126
3174
  function start$i() {
3127
3175
  if (window["Animation"] &&
3176
+ window["Animation"].prototype &&
3128
3177
  window["KeyframeEffect"] &&
3178
+ window["KeyframeEffect"].prototype &&
3129
3179
  window["KeyframeEffect"].prototype.getKeyframes &&
3130
3180
  window["KeyframeEffect"].prototype.getTiming) {
3131
3181
  reset$7();
3132
3182
  overrideAnimationHelper(animationPlay, "play");
3133
3183
  overrideAnimationHelper(animationPause, "pause");
3184
+ overrideAnimationHelper(animationCommitStyles, "commitStyles");
3134
3185
  overrideAnimationHelper(animationCancel, "cancel");
3135
3186
  overrideAnimationHelper(animationFinish, "finish");
3136
3187
  if (elementAnimate === null) {
@@ -3214,6 +3265,9 @@ function trackAnimationOperation(animation, name) {
3214
3265
  case "finish":
3215
3266
  operation = 4 /* AnimationOperation.Finish */;
3216
3267
  break;
3268
+ case "commitStyles":
3269
+ operation = 5 /* AnimationOperation.CommitStyles */;
3270
+ break;
3217
3271
  }
3218
3272
  if (operation) {
3219
3273
  track$4(time(), animation[animationId], operation);
@@ -4498,8 +4552,11 @@ function check$2(bytes) {
4498
4552
  }
4499
4553
  function trigger(reason) {
4500
4554
  data$4.check = reason;
4501
- clear();
4502
- stop();
4555
+ // limit the dimensions we collect, but we don't need to stop Clarity entirely if we hit the limit
4556
+ if (reason !== 5 /* Check.Collection */) {
4557
+ clear();
4558
+ stop();
4559
+ }
4503
4560
  }
4504
4561
  function compute$3() {
4505
4562
  if (data$4.check !== 0 /* Check.None */) {
@@ -4512,13 +4569,16 @@ function stop$a() {
4512
4569
 
4513
4570
  var data$3 = null;
4514
4571
  var updates = null;
4572
+ var limited = false;
4515
4573
  function start$a() {
4516
4574
  data$3 = {};
4517
4575
  updates = {};
4576
+ limited = false;
4518
4577
  }
4519
4578
  function stop$9() {
4520
4579
  data$3 = {};
4521
4580
  updates = {};
4581
+ limited = false;
4522
4582
  }
4523
4583
  function log(dimension, value) {
4524
4584
  // Check valid value before moving ahead
@@ -4529,6 +4589,14 @@ function log(dimension, value) {
4529
4589
  data$3[dimension] = [];
4530
4590
  }
4531
4591
  if (data$3[dimension].indexOf(value) < 0) {
4592
+ // Limit check to ensure we have a cap on number of dimensions we can collect
4593
+ if (data$3[dimension].length > 128 /* Setting.CollectionLimit */) {
4594
+ if (!limited) {
4595
+ limited = true;
4596
+ trigger(5 /* Check.Collection */);
4597
+ }
4598
+ return;
4599
+ }
4532
4600
  data$3[dimension].push(value);
4533
4601
  // If this is a new value, track it as part of updates object
4534
4602
  // This allows us to only send back new values in subsequent payloads
@@ -4536,10 +4604,6 @@ function log(dimension, value) {
4536
4604
  updates[dimension] = [];
4537
4605
  }
4538
4606
  updates[dimension].push(value);
4539
- // Limit check to ensure we have a cap on number of dimensions we can collect
4540
- if (data$3[dimension].length > 128 /* Setting.CollectionLimit */) {
4541
- trigger(5 /* Check.Collection */);
4542
- }
4543
4607
  }
4544
4608
  }
4545
4609
  }
@@ -4548,6 +4612,7 @@ function compute$2() {
4548
4612
  }
4549
4613
  function reset$3() {
4550
4614
  updates = {};
4615
+ limited = false;
4551
4616
  }
4552
4617
 
4553
4618
  function config$1(track) {
@@ -4756,7 +4821,7 @@ function shortid() {
4756
4821
  }
4757
4822
  function session() {
4758
4823
  var output = { session: shortid(), ts: Math.round(Date.now()), count: 1, upgrade: null, upload: "" /* Constant.Empty */ };
4759
- var value = getCookie("_clsk" /* Constant.SessionKey */);
4824
+ var value = getCookie("_clsk" /* Constant.SessionKey */, !config$2.includeSubdomains);
4760
4825
  if (value) {
4761
4826
  var parts = value.split("|" /* Constant.Pipe */);
4762
4827
  // Making it backward & forward compatible by using greater than comparison (v0.6.21)
@@ -4776,7 +4841,7 @@ function num(string, base) {
4776
4841
  }
4777
4842
  function user() {
4778
4843
  var output = { id: shortid(), version: 0, expiry: null, consent: 0 /* BooleanFlag.False */, dob: 0 };
4779
- var cookie = getCookie("_clck" /* Constant.CookieKey */);
4844
+ var cookie = getCookie("_clck" /* Constant.CookieKey */, !config$2.includeSubdomains);
4780
4845
  if (cookie && cookie.length > 0) {
4781
4846
  // Splitting and looking up first part for forward compatibility, in case we wish to store additional information in a cookie
4782
4847
  var parts = cookie.split("|" /* Constant.Pipe */);
@@ -4818,8 +4883,9 @@ function user() {
4818
4883
  }
4819
4884
  return output;
4820
4885
  }
4821
- function getCookie(key) {
4886
+ function getCookie(key, limit) {
4822
4887
  var _a;
4888
+ if (limit === void 0) { limit = false; }
4823
4889
  if (supported(document, "cookie" /* Constant.Cookie */)) {
4824
4890
  var cookies = document.cookie.split(";" /* Constant.Semicolon */);
4825
4891
  if (cookies) {
@@ -4836,6 +4902,12 @@ function getCookie(key) {
4836
4902
  while (isEncoded) {
4837
4903
  _a = decodeCookieValue(decodedValue), isEncoded = _a[0], decodedValue = _a[1];
4838
4904
  }
4905
+ // If we are limiting cookies, check if the cookie value is limited
4906
+ if (limit) {
4907
+ return decodedValue.endsWith("".concat("~" /* Constant.Tilde */, "1"))
4908
+ ? decodedValue.substring(0, decodedValue.length - 2)
4909
+ : null;
4910
+ }
4839
4911
  return decodedValue;
4840
4912
  }
4841
4913
  }
@@ -5505,7 +5577,7 @@ function start(config$1) {
5505
5577
  // If it's an internal call to start, without explicit configuration,
5506
5578
  // re-process any newly accumulated items in the queue
5507
5579
  if (config$1 === null) {
5508
- process$7();
5580
+ process$8();
5509
5581
  }
5510
5582
  }
5511
5583
  }