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