1(function () { 2 'use strict'; 3 4 function _arrayLikeToArray(r, a) { 5 (null == a || a > r.length) && (a = r.length); 6 for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; 7 return n; 8 } 9 function _arrayWithHoles(r) { 10 if (Array.isArray(r)) return r; 11 } 12 function asyncGeneratorStep(n, t, e, r, o, a, c) { 13 try { 14 var i = n[a](c), 15 u = i.value; 16 } catch (n) { 17 return void e(n); 18 } 19 i.done ? t(u) : Promise.resolve(u).then(r, o); 20 } 21 function _asyncToGenerator(n) { 22 return function () { 23 var t = this, 24 e = arguments; 25 return new Promise(function (r, o) { 26 var a = n.apply(t, e); 27 function _next(n) { 28 asyncGeneratorStep(a, r, o, _next, _throw, "next", n); 29 } 30 function _throw(n) { 31 asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); 32 } 33 _next(void 0); 34 }); 35 }; 36 } 37 function _defineProperty(e, r, t) { 38 return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { 39 value: t, 40 enumerable: !0, 41 configurable: !0, 42 writable: !0 43 }) : e[r] = t, e; 44 } 45 function _extends() { 46 return _extends = Object.assign ? Object.assign.bind() : function (n) { 47 for (var e = 1; e < arguments.length; e++) { 48 var t = arguments[e]; 49 for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); 50 } 51 return n; 52 }, _extends.apply(null, arguments); 53 } 54 function _iterableToArrayLimit(r, l) { 55 var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; 56 if (null != t) { 57 var e, 58 n, 59 i, 60 u, 61 a = [], 62 f = !0, 63 o = !1; 64 try { 65 if (i = (t = t.call(r)).next, 0 === l) { 66 if (Object(t) !== t) return; 67 f = !1; 68 } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); 69 } catch (r) { 70 o = !0, n = r; 71 } finally { 72 try { 73 if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; 74 } finally { 75 if (o) throw n; 76 } 77 } 78 return a; 79 } 80 } 81 function _nonIterableRest() { 82 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 83 } 84 function _regeneratorRuntime() { 85 _regeneratorRuntime = function () { 86 return e; 87 }; 88 var t, 89 e = {}, 90 r = Object.prototype, 91 n = r.hasOwnProperty, 92 o = Object.defineProperty || function (t, e, r) { 93 t[e] = r.value; 94 }, 95 i = "function" == typeof Symbol ? Symbol : {}, 96 a = i.iterator || "@@iterator", 97 c = i.asyncIterator || "@@asyncIterator", 98 u = i.toStringTag || "@@toStringTag"; 99 function define(t, e, r) { 100 return Object.defineProperty(t, e, { 101 value: r, 102 enumerable: !0, 103 configurable: !0, 104 writable: !0 105 }), t[e]; 106 } 107 try { 108 define({}, ""); 109 } catch (t) { 110 define = function (t, e, r) { 111 return t[e] = r; 112 }; 113 } 114 function wrap(t, e, r, n) { 115 var i = e && e.prototype instanceof Generator ? e : Generator, 116 a = Object.create(i.prototype), 117 c = new Context(n || []); 118 return o(a, "_invoke", { 119 value: makeInvokeMethod(t, r, c) 120 }), a; 121 } 122 function tryCatch(t, e, r) { 123 try { 124 return { 125 type: "normal", 126 arg: t.call(e, r) 127 }; 128 } catch (t) { 129 return { 130 type: "throw", 131 arg: t 132 }; 133 } 134 } 135 e.wrap = wrap; 136 var h = "suspendedStart", 137 l = "suspendedYield", 138 f = "executing", 139 s = "completed", 140 y = {}; 141 function Generator() {} 142 function GeneratorFunction() {} 143 function GeneratorFunctionPrototype() {} 144 var p = {}; 145 define(p, a, function () { 146 return this; 147 }); 148 var d = Object.getPrototypeOf, 149 v = d && d(d(values([]))); 150 v && v !== r && n.call(v, a) && (p = v); 151 var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); 152 function defineIteratorMethods(t) { 153 ["next", "throw", "return"].forEach(function (e) { 154 define(t, e, function (t) { 155 return this._invoke(e, t); 156 }); 157 }); 158 } 159 function AsyncIterator(t, e) { 160 function invoke(r, o, i, a) { 161 var c = tryCatch(t[r], t, o); 162 if ("throw" !== c.type) { 163 var u = c.arg, 164 h = u.value; 165 return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { 166 invoke("next", t, i, a); 167 }, function (t) { 168 invoke("throw", t, i, a); 169 }) : e.resolve(h).then(function (t) { 170 u.value = t, i(u); 171 }, function (t) { 172 return invoke("throw", t, i, a); 173 }); 174 } 175 a(c.arg); 176 } 177 var r; 178 o(this, "_invoke", { 179 value: function (t, n) { 180 function callInvokeWithMethodAndArg() { 181 return new e(function (e, r) { 182 invoke(t, n, e, r); 183 }); 184 } 185 return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); 186 } 187 }); 188 } 189 function makeInvokeMethod(e, r, n) { 190 var o = h; 191 return function (i, a) { 192 if (o === f) throw Error("Generator is already running"); 193 if (o === s) { 194 if ("throw" === i) throw a; 195 return { 196 value: t, 197 done: !0 198 }; 199 } 200 for (n.method = i, n.arg = a;;) { 201 var c = n.delegate; 202 if (c) { 203 var u = maybeInvokeDelegate(c, n); 204 if (u) { 205 if (u === y) continue; 206 return u; 207 } 208 } 209 if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
vendor: 4,391 bytes, lines 210-307
210 if (o === h) throw o = s, n.arg; 211 n.dispatchException(n.arg); 212 } else "return" === n.method && n.abrupt("return", n.arg); 213 o = f; 214 var p = tryCatch(e, r, n); 215 if ("normal" === p.type) { 216 if (o = n.done ? s : l, p.arg === y) continue; 217 return { 218 value: p.arg, 219 done: n.done 220 }; 221 } 222 "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); 223 } 224 }; 225 } 226 function maybeInvokeDelegate(e, r) { 227 var n = r.method, 228 o = e.iterator[n]; 229 if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; 230 var i = tryCatch(o, e.iterator, r.arg); 231 if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; 232 var a = i.arg; 233 return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); 234 } 235 function pushTryEntry(t) { 236 var e = { 237 tryLoc: t[0] 238 }; 239 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); 240 } 241 function resetTryEntry(t) { 242 var e = t.completion || {}; 243 e.type = "normal", delete e.arg, t.completion = e; 244 } 245 function Context(t) { 246 this.tryEntries = [{ 247 tryLoc: "root" 248 }], t.forEach(pushTryEntry, this), this.reset(!0); 249 } 250 function values(e) { 251 if (e || "" === e) { 252 var r = e[a]; 253 if (r) return r.call(e); 254 if ("function" == typeof e.next) return e; 255 if (!isNaN(e.length)) { 256 var o = -1, 257 i = function next() { 258 for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; 259 return next.value = t, next.done = !0, next; 260 }; 261 return i.next = i; 262 } 263 } 264 throw new TypeError(typeof e + " is not iterable"); 265 } 266 return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { 267 value: GeneratorFunctionPrototype, 268 configurable: !0 269 }), o(GeneratorFunctionPrototype, "constructor", { 270 value: GeneratorFunction, 271 configurable: !0 272 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { 273 var e = "function" == typeof t && t.constructor; 274 return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); 275 }, e.mark = function (t) { 276 return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; 277 }, e.awrap = function (t) { 278 return { 279 __await: t 280 }; 281 }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { 282 return this; 283 }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { 284 void 0 === i && (i = Promise); 285 var a = new AsyncIterator(wrap(t, r, n, o), i); 286 return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { 287 return t.done ? t.value : a.next(); 288 }); 289 }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { 290 return this; 291 }), define(g, "toString", function () { 292 return "[object Generator]"; 293 }), e.keys = function (t) { 294 var e = Object(t), 295 r = []; 296 for (var n in e) r.push(n); 297 return r.reverse(), function next() { 298 for (; r.length;) { 299 var t = r.pop(); 300 if (t in e) return next.value = t, next.done = !1, next; 301 } 302 return next.done = !0, next; 303 }; 304 }, e.values = values, Context.prototype = { 305 constructor: Context, 306 reset: function (e) { 307 if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEac
307h(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); 308 }, 309 stop: function () { 310 this.done = !0; 311 var t = this.tryEntries[0].completion; 312 if ("throw" === t.type) throw t.arg; 313 return this.rval; 314 }, 315 dispatchException: function (e) { 316 if (this.done) throw e; 317 var r = this; 318 function handle(n, o) { 319 return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; 320 } 321 for (var o = this.tryEntries.length - 1; o >= 0; --o) { 322 var i = this.tryEntries[o], 323 a = i.completion; 324 if ("root" === i.tryLoc) return handle("end"); 325 if (i.tryLoc <= this.prev) { 326 var c = n.call(i, "catchLoc"), 327 u = n.call(i, "finallyLoc"); 328 if (c && u) { 329 if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); 330 if (this.prev < i.finallyLoc) return handle(i.finallyLoc); 331 } else if (c) { 332 if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); 333 } else { 334 if (!u) throw Error("try statement without catch or finally"); 335 if (this.prev < i.finallyLoc) return handle(i.finallyLoc); 336 } 337 } 338 } 339 }, 340 abrupt: function (t, e) { 341 for (var r = this.tryEntries.length - 1; r >= 0; --r) { 342 var o = this.tryEntries[r]; 343 if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { 344 var i = o; 345 break; 346 } 347 } 348 i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); 349 var a = i ? i.completion : {}; 350 return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); 351 }, 352 complete: function (t, e) { 353 if ("throw" === t.type) throw t.arg; 354 return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; 355 }, 356 finish: function (t) { 357 for (var e = this.tryEntries.length - 1; e >= 0; --e) { 358 var r = this.tryEntries[e]; 359 if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; 360 } 361 }, 362 catch: function (t) { 363 for (var e = this.tryEntries.length - 1; e >= 0; --e) { 364 var r = this.tryEntries[e]; 365 if (r.tryLoc === t) { 366 var n = r.completion; 367 if ("throw" === n.type) { 368 var o = n.arg; 369 resetTryEntry(r); 370 } 371 return o; 372 } 373 } 374 throw Error("illegal catch attempt"); 375 }, 376 delegateYield: function (e, r, n) { 377 return this.delegate = { 378 iterator: values(e), 379 resultName: r, 380 nextLoc: n 381 }, "next" === this.method && (this.arg = t), y; 382 } 383 }, e; 384 } 385 function _slicedToArray(r, e) { 386 return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); 387 } 388 function _toPrimitive(t, r) { 389 if ("object" != typeof t || !t) return t; 390 var e = t[Symbol.toPrimitive]; 391 if (void 0 !== e) { 392 var i = e.call(t, r || "default"); 393 if ("object" != typeof i) return i; 394 throw new TypeError("@@toPrimitive must return a primitive value."); 395 } 396 return ("string" === r ? String : Number)(t); 397 } 398 function _toPropertyKey(t) { 399 var i = _toPrimitive(t, "string"); 400 return "symbol" == typeof i ? i : i + ""; 401 } 402 function _unsupportedIterableToArray(r, a) { 403 if (r) { 404 if ("string" == typeof r) return _arrayLikeToArray(r, a); 405 var t = {}.toString.call(r).slice(8, -1); 406 return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; 407 } 408 } 409 410 var getFrameDepth = function getFrameDepth(win) { 411 win = win || window; 412 if (win === win.top) { 413 return 0; 414 } 415 return 1 + getFrameDepth(win.parent); 416 }; 417 var getTopAncestorOrigin = function getTopAncestorOrigin(win) { 418 win = win || window; 419 var ancestorOrigins = win.location && win.location.ancestorOrigins; 420 if (win && ancestorOrigins && ancestorOrigins.length > 1) { 421 if (Array.isArray(ancestorOrigins)) { 422 return ancestorOrigins.pop(); 423 } 424 return ancestorOrigins.item(ancestorOrigins.length - 1); 425 } 426 return null; 427 }; 428 var getCanonicalUrl = function getCanonicalUrl(win) { 429 win = win || window; 430 var canonicalUrlLink = win.document.querySelector('link[rel=canonical]'); 431 return canonicalUrlLink ? canonicalUrlLink.href : null; 432 }; 433 var findBestUrl = function findBestUrl(frameDepth, win) { 434 win = win || window; 435 var doc = win.document; 436 if (typeof frameDepth !== 'number' || frameDepth < 0) { 437 frameDepth = getFrameDepth(win); 438 } 439 if (frameDepth === 0) { 440 return getCanonicalUrl(win) || doc.location.href; 441 } else if (frameDepth === 1) {
442 try { 443 var parentHref = win.parent.document.location.href; 444 if (parentHref) { 445 return parentHref; 446 } 447 } catch (ex) { 448 var referrer = doc.referrer; 449 if (referrer) { 450 return referrer; 451 } 452 } 453 } else if (frameDepth === 2) { 454 try { 455 var parentReferrer = win.parent.document.referrer; 456 if (parentReferrer) { 457 return parentReferrer; 458 } 459 } catch (ex) {} 460 } 461 return getTopAncestorOrigin(win) || ''; 462 }; 463 464 function discover() { 465 var win = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window; 466 var frameDepth = arguments.length > 1 ? arguments[1] : undefined; 467 var doc = win.document; 468 var isPresent = win.dtm_config; 469 var config1; 470 if (isPresent) { 471 config1 = _extends({}, win.dtm_config); 472 Object.keys(config1).forEach(function (k) { 473 return (config1["".concat(k)] === null || config1["".concat(k)] === '') && delete config1["".concat(k)]; 474 }); 475 } else { 476 config1 = {}; 477 } 478 config1.data_object_type_code = isPresent ? 1 : 0; 479 config1.location_search = doc.location.search || ''; 480 config1.canonical_url = findBestUrl(frameDepth, win); 481 config1.dtmc_ref = doc.referrer || ''; 482 config1.dtmc_loc = doc.location.href || ''; 483 return config1; 484 } 485 486 var getValueFromQueryString = function getValueFromQueryString(key, search) { 487 if (!search) { 488 return ''; 489 } 490 var querystring = search.substring(1); 491 var items = querystring.split('&'); 492 var filtered = items.map(function (item) { 493 var itemList = item.split('='); 494 return { 495 key: itemList[0], 496 value: itemList[1] 497 }; 498 }).filter(function (kvp) { 499 return kvp.key.toLowerCase() === key.toLowerCase(); 500 }); 501 if (filtered.length) { 502 return filtered[0].value; 503 } 504 return ''; 505 }; 506 var serializeDataToQuery = function serializeDataToQuery(dataObject) { 507 var keyFilter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; 508 var parts = [], 509 key, 510 value; 511 for (key in dataObject) { 512 if (keyFilter.includes(key)) { 513 continue; 514 } else if (dataObject.hasOwnProperty(key)) { 515 value = dataObject["".concat(key)] + '' || ''; 516 parts.push(encodeURIComponent(key) + '=' + encodeURIComponent(value)); 517 } 518 } 519 return parts.join('&'); 520 }; 521 var buildUrlForPlugin = function buildUrlForPlugin(pluginName, hostName, path, dtmConfig, integration) { 522 var plugin = integration.plugins["".concat(pluginName)]; 523 if (!plugin) { 524 console.error('Missing plugin name'); 525 return null; 526 } 527 var queryStringObj = {}; 528 var fieldMasks = integration.fieldMasks.concat(plugin.fieldMasks); 529 _extends(queryStringObj, dtmConfig); 530 fieldMasks.forEach(function (fieldMask) { 531 delete queryStringObj["".concat(fieldMask)]; 532 }); 533 var env = integration.env; 534 var pluginUrl = "".concat(env.tagProto, "://").concat(hostName).concat(path); 535 queryStringObj.dtm_cookies_enabled = navigator.cookieEnabled; 536 if (env.epsilonRP) { 537 queryStringObj.dtm_ept = 'final'; 538 } 539 var keyFilter = []; 540 var queryStrings = serializeDataToQuery(queryStringObj, keyFilter); 541 return "".concat(pluginUrl).concat(queryStrings.length ? '?' : '').concat(queryStrings); 542 }; 543 544 var applyStaticParameters = function applyStaticParameters(dtmConfig, overrideParams) { 545 _extends(dtmConfig, overrideParams); 546 }; 547 var resolve = function resolve(path, obj, separator) { 548 obj = obj || self; 549 separator = separator || '.'; 550 var properties = Array.isArray(path) ? path : path.split(separator); 551 var value = properties.reduce(function (prev, curr) { 552 return prev && prev[curr]; 553 }, obj); 554 if (value === null || value === undefined) { 555 return ''; 556 } 557 return value; 558 }; 559 var resolveForType = function resolveForType(mapping, dtmConfig) { 560 if (mapping.type.toUpperCase() === 'QUERYSTRING') { 561 var keys = mapping.source.split('.'); 562 if (keys.length === 2) { 563 var sourceName = keys[0]; 564 return resolve(sourceName, dtmConfig); 565 } 566 return ''; 567 } else if (mapping.type.toUpperCase() === 'URLENCODE') { 568 return resolve(mapping.source, dtmConfig); 569 } else if (mapping.type.toUpperCase() === 'JSONURLENCODE') { 570 return resolve(mapping.source, dtmConfig); 571 } 572 return resolve(mapping.source, dtmConfig); 573 }; 574 var isObjectOrArray = function isObjectOrArray(value) { 575 return typeof value === 'object' && value !== null; 576 }; 577 var isPrimitive = function isPrimitive(value) { 578 return value === null || typeof value !== 'object' && typeof value !== 'function'; 579 }; 580 var getJsonUrlEncodedValue = function getJsonUrlEncodedValue(str) { 581 if (isPrimitive(str)) { 582 return str; 583 } else if (isObjectOrArray(str)) { 584 return JSON.stringify(str); 585 } 586 }; 587 var transform = function transform(dtmConfig, mapping) { 588 var value = resolveForType(mapping, dtmConfig); 589 if (mapping.type.toUpperCase() === 'QUERYSTRING') { 590 var keys = mapping.source.split('.'); 591 if (keys.length === 2) { 592 var queryStringName = keys[1]; 593 var qsValue = getValueFromQueryString(queryStringName, value); 594 if (qsValue !== '') { 595 dtmConfig[mapping.destination] = qsValue; 596 } 597 } 598 } else if (mapping.type.toUpperCase() === 'URLENCODE') { 599 var encodedValue = encodeURIComponent(value); 600 if (encodedValue !== '') { 601 dtmConfig[mapping.destination] = encodedValue; 602 } 603 } else if (mapping.type.toUpperCase() === 'JSONURLENCODE') { 604 if (value !== '') { 605 var result = getJsonUrlEncodedValue(value); 606 dtmConfig[mapping.destination] = result; 607 } 608 } else { 609 if (value !== '') { 610 dtmConfig[mapping.destination] = value; 611 } 612 } 613 }; 614 var applyMappings = function applyMappings(dtmConfig, mappings) {
615 mappings.forEach(function (m) { 616 return transform(dtmConfig, m); 617 }); 618 }; 619 620 function assign (target) { 621 for (var i = 1; i < arguments.length; i++) { 622 var source = arguments[i]; 623 for (var key in source) { 624 target[key] = source[key]; 625 } 626 } 627 return target 628 } 629 var defaultConverter = { 630 read: function (value) { 631 if (value[0] === '"') { 632 value = value.slice(1, -1); 633 } 634 return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent) 635 }, 636 write: function (value) { 637 return encodeURIComponent(value).replace( 638 /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, 639 decodeURIComponent 640 ) 641 } 642 }; 643 function init (converter, defaultAttributes) { 644 function set (name, value, attributes) { 645 if (typeof document === 'undefined') { 646 return 647 } 648 attributes = assign({}, defaultAttributes, attributes); 649 if (typeof attributes.expires === 'number') { 650 attributes.expires = new Date(Date.now() + attributes.expires * 864e5); 651 } 652 if (attributes.expires) { 653 attributes.expires = attributes.expires.toUTCString(); 654 } 655 name = encodeURIComponent(name) 656 .replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent) 657 .replace(/[()]/g, escape); 658 var stringifiedAttributes = ''; 659 for (var attributeName in attributes) { 660 if (!attributes[attributeName]) { 661 continue 662 } 663 stringifiedAttributes += '; ' + attributeName; 664 if (attributes[attributeName] === true) { 665 continue 666 } 667 stringifiedAttributes += '=' + attributes[attributeName].split(';')[0]; 668 } 669 return (document.cookie = 670 name + '=' + converter.write(value, name) + stringifiedAttributes) 671 } 672 function get (name) { 673 if (typeof document === 'undefined' || (arguments.length && !name)) { 674 return 675 } 676 var cookies = document.cookie ? document.cookie.split('; ') : []; 677 var jar = {}; 678 for (var i = 0; i < cookies.length; i++) { 679 var parts = cookies[i].split('='); 680 var value = parts.slice(1).join('='); 681 try { 682 var found = decodeURIComponent(parts[0]); 683 jar[found] = converter.read(value, found); 684 if (name === found) { 685 break 686 } 687 } catch (e) {} 688 } 689 return name ? jar[name] : jar 690 } 691 return Object.create( 692 { 693 set, 694 get, 695 remove: function (name, attributes) { 696 set( 697 name, 698 '', 699 assign({}, attributes, { 700 expires: -1 701 }) 702 ); 703 }, 704 withAttributes: function (attributes) { 705 return init(this.converter, assign({}, this.attributes, attributes)) 706 }, 707 withConverter: function (converter) { 708 return init(assign({}, this.converter, converter), this.attributes) 709 } 710 }, 711 { 712 attributes: { value: Object.freeze(defaultAttributes) }, 713 converter: { value: Object.freeze(converter) } 714 } 715 ) 716 } 717 var api = init(defaultConverter, { path: '/' }); 718 719 var daysIn13Months = 395; 720 var secondsPerDay = 24 * 60 * 60; 721 var millisecondsPerSecond = 1000; 722 var gppTimeoutMs = 1000; 723 var PATH_PREFIX = '/profile/visit/'; 724 var EXP_SUFFIX = '_exp'; 725 var EventType = { 726 DISCO: 'disco', 727 FINAL: 'final' 728 }; 729 var Parameters = { 730 CLEAR_TAG_FLAG: 'clear_tag_flag' 731 }; 732 var DTM_TOKEN = 'dtm_token'; 733 var DTM_TOKEN_ASSIGNMENT_TYPE = 'dtm_token_assignment_type'; 734 var INIT_WL_CODE = 'init_wl_code'; 735 var CLIENT_STORAGE = 'clientStorage'; 736 var SERVER_OR_DOCUMENT_ONLY = 'serverOrDocument'; 737 var PIXEL_TIMEOUT_MS = 'px_timeout'; 738 var PIXEL_LATENCIES = 'px_latencies'; 739 var PIXEL_ID = 'px_id'; 740 var PIXEL_LATENCY = 'px_latency'; 741 var CLASS_NAME_PREFIX = 'uid-'; 742 var CMPS_QUERIED = 'cmps_queried'; 743 var GPP_STRING = 'gpp_string'; 744 var GPP_CMP_ID = 'gpp_cmp_id'; 745 var DTM_GPP_STRING = 'dtm_gpp_string'; 746 var DTM_GPP_CMP_ID = 'dtm_gpp_cmp_id'; 747 var DTM_COOKIE_ID = 'dtm_cookie_id'; 748 var NAMESPACED_DTM_COOKIE_ID = 'ust:dtm_cookie_id'; 749 750 var getCookie = function getCookie(name) { 751 try { 752 return api.get(name) || null; 753 } catch (e) { 754 return null; 755 } 756 }; 757 var setCookie = function setCookie(name, value, age, domain, sameSite) { 758 age = age || 5 * daysIn13Months * secondsPerDay; 759 sameSite = sameSite || 'lax'; 760 var cookieValue; 761 var cookieConfig = { 762 'expires': new Date(Date.now() + age * millisecondsPerSecond), 763 'sameSite': sameSite, 764 secure: true, 765 'path': '/' 766 }; 767 if (domain) { 768 cookieConfig.domain = domain; 769 } else { 770 return; 771 } 772 cookieValue = api.set(name, value, cookieConfig); 773 return cookieValue; 774 }; 775 776 function removeStorageItem(key, type) { 777 type = type || 'localStorage'; 778 try { 779 var storage = window[type]; 780 storage.removeItem(key + EXP_SUFFIX); 781 storage.removeItem(key); 782 return true; 783 } catch (e) { 784 console.debug(e); 785 return false;
786 } 787 } 788 function getStorageItem(key, type) { 789 type = type || 'localStorage'; 790 var val = null; 791 try { 792 var storage = window[type]; 793 var expVal = storage.getItem(key + EXP_SUFFIX); 794 if (!expVal) { 795 val = storage.getItem(key); 796 } else { 797 var expDate = new Date(expVal); 798 var isValid = expDate.getTime() - Date.now() > 0; 799 if (isValid) { 800 val = storage.getItem(key); 801 } else { 802 removeStorageItem(key); 803 } 804 } 805 } catch (e) { 806 console.debug(e); 807 } 808 return val; 809 } 810 function setStorageItem(key, val, expires, type) { 811 type = type || 'localStorage'; 812 try { 813 var storage = window[type]; 814 if (expires !== undefined) { 815 var expStr = new Date(Date.now() + expires * millisecondsPerSecond).toUTCString(); 816 storage.setItem(key + EXP_SUFFIX, expStr); 817 } 818 storage.setItem(key, val); 819 } catch (e) { 820 console.debug(e); 821 return false; 822 } 823 return true; 824 } 825 826 var isValidValue = function isValidValue(val) { 827 return val !== 'undefined' && val !== undefined && val !== null && val !== ''; 828 }; 829 function getValue(key, target) { 830 var serverSetCookie = getCookie("".concat(key, "_sc")) || ''; 831 var localStorage = getStorageItem(key, 'localStorage') || ''; 832 var sessionStorage = getStorageItem(key, 'sessionStorage') || ''; 833 var documentCookie = getCookie(key) || ''; 834 if (target) { 835 if (isValidValue(localStorage)) { 836 target[key + '_ls'] = localStorage; 837 } 838 if (isValidValue(sessionStorage)) { 839 target[key + '_ss'] = sessionStorage; 840 } 841 if (isValidValue(documentCookie)) { 842 target[key + '_dc'] = documentCookie; 843 } 844 } 845 var getBestValue = function getBestValue() { 846 if (isValidValue(serverSetCookie)) { 847 return serverSetCookie; 848 } 849 if (isValidValue(localStorage)) { 850 return localStorage; 851 } 852 if (isValidValue(documentCookie)) { 853 return documentCookie; 854 } 855 if (isValidValue(sessionStorage)) { 856 return sessionStorage; 857 } 858 return ''; 859 }; 860 return getBestValue(); 861 } 862 function lookupAndLoadDtmTokenValue(key, dtmTokenAssignmentType, initWLCode, target) { 863 var serverSetCookie = getCookie("".concat(key, "_sc")) || ''; 864 var localStorage = getStorageItem(key, 'localStorage') || ''; 865 var sessionStorage = getStorageItem(key, 'sessionStorage') || ''; 866 var documentCookie = getCookie(key) || ''; 867 var assignmentType = dtmTokenAssignmentType; 868 if (isValidValue(serverSetCookie)) { 869 target["".concat(key, "_sc")] = serverSetCookie; 870 } 871 if (isValidValue(documentCookie)) { 872 target["".concat(key, "_dc")] = documentCookie; 873 target["".concat(key)] = documentCookie; 874 assignmentType = '1'; 875 } 876 if (isValidValue(localStorage)) { 877 target["".concat(key, "_ls")] = localStorage; 878 assignmentType = '1'; 879 } 880 if (isValidValue(sessionStorage)) { 881 target["".concat(key, "_ss")] = sessionStorage; 882 assignmentType = '1'; 883 } 884 target[DTM_TOKEN_ASSIGNMENT_TYPE] = assignmentType; 885 } 886 function getValues(target, integration) { 887 if (integration.persistence) { 888 integration.persistence.forEach(function (entry) { 889 if (entry.key === DTM_TOKEN) { 890 lookupAndLoadDtmTokenValue(entry.key, target["".concat(DTM_TOKEN_ASSIGNMENT_TYPE)], integration.parameters["".concat(INIT_WL_CODE)], target); 891 } else { 892 var oldValue = entry.context === CLIENT_STORAGE ? getWebStorageValues(entry.key) : getValue(entry.key, target); 893 var newValue = target[entry.key]; 894 if (!isValidValue(newValue)) { 895 if (isValidValue(oldValue)) { 896 target[entry.key] = oldValue; 897 } else if (isValidValue(entry.value)) { 898 target[entry.key] = entry.value; 899 } 900 } 901 } 902 }); 903 } 904 } 905 function setDtmTokenValue(key, value, ageInSeconds, environment, context, integration) { 906 var localStorageVal = getStorageItem(key, 'localStorage') || ''; 907 var sessionStorageVal = getStorageItem(key, 'sessionStorage') || ''; 908 var documentCookieVal = getCookie(key) || ''; 909 if (environment.pollutedFirstPartyDtmUserTknLs) { 910 setStorageItem(key, '', ageInSeconds, 'localStorage'); 911 } 912 if (environment.pollutedFirstPartyDtmUserTknSs) { 913 setStorageItem(key, '', ageInSeconds, 'sessionStorage'); 914 } 915 if (environment.pollutedFirstPartyDtmUserTkn) {
916 setCookie(key, '', ageInSeconds, environment.cookieDomain); 917 } 918 if (environment.lsWriteExisting) { 919 if (environment.pollutedFirstPartyDtmUserTknLs) { 920 setStorageItem(key, integration.parameters['dtm_token'], ageInSeconds, 'localStorage'); 921 } else if (isValidValue(localStorageVal)) { 922 setStorageItem(key, localStorageVal, ageInSeconds, 'localStorage'); 923 } 924 if (environment.pollutedFirstPartyDtmUserTknSs) { 925 setStorageItem(key, integration.parameters['dtm_token'], ageInSeconds, 'sessionStorage'); 926 } else if (isValidValue(sessionStorageVal)) { 927 setStorageItem(key, sessionStorageVal, ageInSeconds, 'sessionStorage'); 928 } 929 } 930 if (environment.lsWriteNew) { 931 if (environment.pollutedFirstPartyDtmUserTknLs || !isValidValue(localStorageVal)) { 932 setStorageItem(key, integration.parameters['dtm_token'], ageInSeconds, 'localStorage'); 933 } 934 if (environment.pollutedFirstPartyDtmUserTknSs || !isValidValue(sessionStorageVal)) { 935 setStorageItem(key, integration.parameters['dtm_token'], ageInSeconds, 'sessionStorage'); 936 } 937 } 938 if (context !== CLIENT_STORAGE) { 939 if ((environment.dcWriteExisting || environment.dcWriteNew) && environment.pollutedFirstPartyDtmUserTkn) { 940 setCookie(key, integration.parameters['dtm_token'], ageInSeconds, environment.cookieDomain); 941 } else { 942 if (environment.dcWriteExisting && isValidValue(documentCookieVal)) { 943 setCookie(key, documentCookieVal, ageInSeconds, environment.cookieDomain); 944 } 945 if (environment.dcWriteNew && !isValidValue(documentCookieVal)) { 946 setCookie(key, value, ageInSeconds, environment.cookieDomain); 947 } 948 } 949 } 950 } 951 function setPersistenceValue(key, value, ageInSeconds, environment, context) { 952 if (context === SERVER_OR_DOCUMENT_ONLY && !environment.fpcTagWrite) { 953 var _documentCookieVal = getCookie(key) || ''; 954 if (environment.dcWriteNew && !isValidValue(_documentCookieVal)) { 955 setCookie(key, value, ageInSeconds, environment.cookieDomain); 956 } 957 if (environment.dcWriteExisting && isValidValue(_documentCookieVal)) { 958 setCookie(key, value, ageInSeconds, environment.cookieDomain); 959 } 960 return; 961 } 962 var localStorageVal = getStorageItem(key, 'localStorage') || ''; 963 var sessionStorageVal = getStorageItem(key, 'sessionStorage') || ''; 964 var documentCookieVal = getCookie(key) || ''; 965 if (environment.lsWriteNew && !isValidValue(localStorageVal)) { 966 setStorageItem(key, value, ageInSeconds, 'localStorage'); 967 } 968 if (environment.lsWriteExisting && isValidValue(localStorageVal)) { 969 setStorageItem(key, value, ageInSeconds, 'localStorage'); 970 } 971 if (environment.lsWriteNew && !isValidValue(sessionStorageVal)) { 972 setStorageItem(key, value, ageInSeconds, 'sessionStorage'); 973 } 974 if (environment.lsWriteExisting && isValidValue(sessionStorageVal)) { 975 setStorageItem(key, value, ageInSeconds, 'sessionStorage'); 976 } 977 if (context !== CLIENT_STORAGE && environment.dcWriteNew && !isValidValue(documentCookieVal)) { 978 setCookie(key, value, ageInSeconds, environment.cookieDomain); 979 } 980 if (context !== CLIENT_STORAGE && environment.dcWriteExisting && isValidValue(documentCookieVal)) { 981 setCookie(key, value, ageInSeconds, environment.cookieDomain); 982 } 983 } 984 function getWebStorageValues(key) { 985 var localStorage = getStorageItem(key, 'localStorage') || ''; 986 var sessionStorage = getStorageItem(key, 'sessionStorage') || ''; 987 if (isValidValue(localStorage)) { 988 return localStorage; 989 } 990 if (isValidValue(sessionStorage)) { 991 return sessionStorage; 992 } 993 return ''; 994 } 995 function loadFallbackDtmCookieIdFromWebStorage(target) { 996 if (!target[DTM_COOKIE_ID]) { 997 var namespacedDtmCookieId = getWebStorageValues(NAMESPACED_DTM_COOKIE_ID); 998 if (namespacedDtmCookieId) { 999 target[DTM_COOKIE_ID] = namespacedDtmCookieId; 1000 } 1001 } 1002 } 1003 function setValues(target, integration) { 1004 var setPersistenceValueLocal = function setPersistenceValueLocal(persistenceItem) { 1005 if (target[persistenceItem.key]) { 1006 if (persistenceItem.key === DTM_TOKEN) { 1007 setDtmTokenValue(persistenceItem.key, target[persistenceItem.key], persistenceItem.expires * secondsPerDay, integration.env, persistenceItem.context, integration); 1008 } else { 1009 setPersistenceValue(persistenceItem.key, target[persistenceItem.key], persistenceItem.expires * secondsPerDay, integration.env, persistenceItem.context); 1010 } 1011 } 1012 }; 1013 if (integration.persistence) { 1014 integration.persistence.forEach(setPersistenceValueLocal); 1015 } 1016 } 1017 1018 var createScript = function createScript(url, nonceValue, onLoadHandler, onErrorHandler) { 1019 var script = document.createElement('script'); 1020 script.src = url; 1021 script.nonce = nonceValue; 1022 script.onload = onLoadHandler; 1023 script.onerror = onErrorHandler; 1024 return script; 1025 }; 1026 var firePixel = function firePixel(url, onLoadHandler, onErrorHandler, referrerPolicy) { 1027 var img = new Image(1, 1); 1028 img.className = 'cnvr-pixel'; 1029 img.style.cssText = 'display:none'; 1030 if (typeof onLoadHandler === 'function') { 1031 img.onload = onLoadHandler; 1032 } 1033 if (typeof onErrorHandler === 'function') { 1034 img.onerror = onErrorHandler; 1035 } 1036 if (referrerPolicy) { 1037 img.setAttribute('referrerPolicy', referrerPolicy); 1038 img.referrerPolicy = referrerPolicy; 1039 } 1040 img.src = url; 1041 img.alt = ''; 1042 return img; 1043 }; 1044 var firePixels = function firePixels(urls, referrerPolicy) { 1045 var pixelArr = [];
1046 urls.forEach(function (url) { 1047 pixelArr.push(firePixel(url, null, null, referrerPolicy)); 1048 }); 1049 return pixelArr; 1050 }; 1051 var addScriptElements = function addScriptElements(embeddedScripts, className, clearTagFlag) { 1052 var addedScriptReferences = []; 1053 embeddedScripts.forEach(function (embeddedScript) { 1054 var scriptElement = document.createElement('script'); 1055 scriptElement.setAttribute('class', "".concat(CLASS_NAME_PREFIX).concat(className)); 1056 if (embeddedScript.attributeMap) { 1057 var attributeMap = embeddedScript.attributeMap; 1058 for (var _i = 0, _Object$entries = Object.entries(attributeMap); _i < _Object$entries.length; _i++) { 1059 var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2), 1060 key = _Object$entries$_i[0], 1061 value = _Object$entries$_i[1]; 1062 scriptElement.setAttribute(key, value); 1063 } 1064 } 1065 if (embeddedScript.attributeMap && embeddedScript.attributeMap.src) { 1066 if (clearTagFlag) { 1067 scriptElement.onload = scriptElement.onerror = function () { 1068 this.parentNode.removeChild(this); 1069 }; 1070 } 1071 document.head.appendChild(scriptElement); 1072 } else if (embeddedScript.codeSnippet) { 1073 scriptElement.textContent = embeddedScript.codeSnippet; 1074 document.head.appendChild(scriptElement); 1075 if (clearTagFlag) { 1076 document.head.removeChild(scriptElement); 1077 } 1078 } 1079 addedScriptReferences.push(scriptElement); 1080 }); 1081 return addedScriptReferences; 1082 }; 1083 1084 var firePixelWithTimeout = /*#__PURE__*/function () { 1085 var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(pixelId, pixelUrl, pixelTimeoutMs, referrerPolicy) { 1086 return _regeneratorRuntime().wrap(function _callee$(_context) { 1087 while (1) switch (_context.prev = _context.next) { 1088 case 0: 1089 return _context.abrupt("return", new Promise(function (resolve, reject) { 1090 var timeout = setTimeout(function () { 1091 reject(pixelId); 1092 }, pixelTimeoutMs); 1093 var startTime = Date.now(); 1094 var measureLatency = function measureLatency() { 1095 clearTimeout(timeout); 1096 var endTime = Date.now(); 1097 var latency = endTime - startTime; 1098 resolve([pixelId, latency]); 1099 }; 1100 firePixel(pixelUrl, measureLatency, null, referrerPolicy); 1101 })); 1102 case 1: 1103 case "end": 1104 return _context.stop(); 1105 } 1106 }, _callee); 1107 })); 1108 return function firePixelWithTimeout(_x, _x2, _x3, _x4) { 1109 return _ref.apply(this, arguments); 1110 }; 1111 }(); 1112 var sendPixelLatency = /*#__PURE__*/function () { 1113 var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(pixelPromises, pixelTimeoutMs, successLoggerUrl) { 1114 var promiseResults, pixelLatencies, parameters, newUrl; 1115 return _regeneratorRuntime().wrap(function _callee2$(_context2) { 1116 while (1) switch (_context2.prev = _context2.next) { 1117 case 0: 1118 Promise.allSettled = Promise.allSettled || function (promises) { 1119 return Promise.all(promises.map(function (p) { 1120 return p.then(function (value) { 1121 return { 1122 status: "fulfilled", 1123 value: value 1124 }; 1125 }).catch(function (reason) { 1126 return { 1127 status: "rejected", 1128 reason: reason 1129 }; 1130 }); 1131 })); 1132 }; 1133 _context2.next = 3; 1134 return Promise.allSettled(pixelPromises); 1135 case 3: 1136 promiseResults = _context2.sent; 1137 pixelLatencies = promiseResults.map(function (result) { 1138 if (result.status === 'rejected') { 1139 return _defineProperty(_defineProperty({}, PIXEL_ID, result.reason), PIXEL_LATENCY, pixelTimeoutMs + 1); 1140 } else if (result.status === 'fulfilled') { 1141 return _defineProperty(_defineProperty({}, PIXEL_ID, result.value[0]), PIXEL_LATENCY, result.value[1]); 1142 } 1143 }); 1144 if (successLoggerUrl) { 1145 parameters = _defineProperty(_defineProperty({}, PIXEL_TIMEOUT_MS, pixelTimeoutMs), PIXEL_LATENCIES, JSON.stringify(pixelLatencies)); 1146 newUrl = "".concat(successLoggerUrl, "&").concat(serializeDataToQuery(parameters)); 1147 firePixel(newUrl); 1148 } 1149 return _context2.abrupt("return", pixelLatencies); 1150 case 7: 1151 case "end": 1152 return _context2.stop(); 1153 } 1154 }, _callee2); 1155 })); 1156 return function sendPixelLatency(_x5, _x6, _x7) { 1157 return _ref2.apply(this, arguments); 1158 }; 1159 }(); 1160 var fireAndMeasurePixels = function fireAndMeasurePixels(pixels, successLoggerUrl, pixelTimeoutMs, referrerPolicy) { 1161 var pixelPromises = []; 1162 for (var _i = 0, _Object$entries = Object.entries(pixels); _i < _Object$entries.length; _i++) { 1163 var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2), 1164 pixelId = _Object$entries$_i[0], 1165 pixelUrl = _Object$entries$_i[1]; 1166 pixelPromises.push(firePixelWithTimeout(pixelId, pixelUrl, pixelTimeoutMs, referrerPolicy)); 1167 } 1168 return sendPixelLatency(pixelPromises, pixelTimeoutMs, successLoggerUrl); 1169 }; 1170 1171 var createPluginScript = function createPluginScript(dtmConfig, integration) { 1172 var env = integration.env; 1173 var url = buildUrlForPlugin('cnvr', env.tagHost, env.tagPath, dtmConfig, integration); 1174 return createScript(url, dtmConfig.nonce); 1175 }; 1176 var generateAndFireFpcPixel = function generateAndFireFpcPixel(dtmConfig, integration) { 1177 var env = integration.env; 1178 if (!env || !env.fpcTagWrite && (!env.fpcAgilityIdWrite || !dtmConfig.dtm_user_id
1178) || !navigator.cookieEnabled) { 1179 return ''; 1180 } 1181 var wlDomainsKey = ''; 1182 if (dtmConfig.wl_domains_key) { 1183 wlDomainsKey = encodeURIComponent(dtmConfig.wl_domains_key); 1184 } 1185 var wlOverrideDomain = ''; 1186 if (dtmConfig.wl_override || dtmConfig.dtm_wl_override) { 1187 if (dtmConfig.wl_override) { 1188 wlOverrideDomain = dtmConfig.wl_override; 1189 } else { 1190 wlOverrideDomain = dtmConfig.dtm_wl_override; 1191 } 1192 } 1193 var baseUrl = "".concat(env.cookieProto, "://").concat(env.cookieHost).concat(env.cookiePath, "?dtm_cid=").concat(dtmConfig.dtm_cid, "&dtm_cmagic=").concat(dtmConfig.dtm_cmagic, "&ver=2&dtm_form_uid=").concat(dtmConfig.dtm_form_uid, "&wl_domains_key=").concat(wlDomainsKey, "&wl_override=").concat(wlOverrideDomain); 1194 var serverPersistValues = Array.isArray(integration.persistence) ? integration.persistence.filter(function (entry) { 1195 return entry.context === 'server' || entry.context === SERVER_OR_DOCUMENT_ONLY; 1196 }) : []; 1197 var queryParamList = []; 1198 if (env.epsilonRP) { 1199 queryParamList.push('dtm_ept=fpcset'); 1200 } 1201 serverPersistValues.forEach(function (entry) { 1202 var key = entry.key; 1203 var value = dtmConfig[key]; 1204 if (typeof value !== 'undefined') { 1205 if (key === DTM_TOKEN) { 1206 if (typeof dtmConfig["".concat(key)] !== 'undefined') { 1207 queryParamList.push(DTM_TOKEN + '=' + encodeURIComponent(dtmConfig["".concat(key)])); 1208 } 1209 if (typeof dtmConfig["".concat(key, "_dc")] !== 'undefined') { 1210 queryParamList.push(encodeURIComponent("".concat(key, "_dc")) + '=' + encodeURIComponent(dtmConfig["".concat(key, "_dc")])); 1211 } 1212 if (typeof dtmConfig["".concat(key, "_ls")] !== 'undefined') { 1213 queryParamList.push(encodeURIComponent("".concat(key, "_ls")) + '=' + encodeURIComponent(dtmConfig["".concat(key, "_ls")])); 1214 } 1215 if (typeof dtmConfig["".concat(key, "_ss")] !== 'undefined') { 1216 queryParamList.push(encodeURIComponent("".concat(key, "_ss")) + '=' + encodeURIComponent(dtmConfig["".concat(key, "_ss")])); 1217 } 1218 } else { 1219 queryParamList.push(encodeURIComponent(key) + '=' + encodeURIComponent(value)); 1220 } 1221 } 1222 }); 1223 if (dtmConfig.dtm_fpc_enable) { 1224 queryParamList.push('dtm_fpc_enable=' + encodeURIComponent(dtmConfig.dtm_fpc_enable)); 1225 } 1226 if (dtmConfig.dtm_host) { 1227 queryParamList.push('dtm_host=' + encodeURIComponent(dtmConfig.dtm_host)); 1228 } 1229 var pixelUrl = queryParamList.length > 0 ? "".concat(baseUrl, "&").concat(queryParamList.join('&')) : ''; 1230 firePixel(pixelUrl); 1231 return pixelUrl; 1232 }; 1233 var disco = function disco(dtmConfig, integration) { 1234 var pluginScript = createPluginScript(dtmConfig, integration); 1235 document.head.appendChild(pluginScript); 1236 var embeddedScripts = integration.embeddedScripts; 1237 if (Array.isArray(embeddedScripts) && embeddedScripts.length > 0) { 1238 addScriptElements(embeddedScripts, integration.parameters.dtm_form_uid, integration.parameters.clear_tag_flag); 1239 } 1240 }; 1241 var final = function final(dtmConfig, integration) { 1242 var referrerLimitedPixels = integration.referrerLimitedPixels; 1243 var nonReferrerLimitedPixels = integration.pixels; 1244 var embeddedScripts = integration.embeddedScripts; 1245 var successLoggerUrl = integration.successUrl; 1246 var isSuccessEndpointHit = false; 1247 if (integration.eventType === EventType.FINAL) { 1248 generateAndFireFpcPixel(dtmConfig, integration); 1249 } 1250 if (referrerLimitedPixels && Object.keys(referrerLimitedPixels).length > 0) { 1251 var pixelTimeoutMs = integration.pixelTimeoutMs || 1500; 1252 fireAndMeasurePixels(referrerLimitedPixels, successLoggerUrl, pixelTimeoutMs, 'same-origin'); 1253 isSuccessEndpointHit = true; 1254 } 1255 if (Array.isArray(nonReferrerLimitedPixels) && nonReferrerLimitedPixels.length > 0) { 1256 firePixels(integration.pixels); 1257 } 1258 if (Array.isArray(embeddedScripts) && embeddedScripts.length > 0) { 1259 addScriptElements(embeddedScripts, integration.parameters.dtm_form_uid, integration.parameters.clear_tag_flag); 1260 } 1261 if (successLoggerUrl && !isSuccessEndpointHit) { 1262 firePixel(successLoggerUrl); 1263 } 1264 }; 1265 var cnvrPlugin = { 1266 disco: disco, 1267 final: final 1268 }; 1269 1270 var plugins = { 1271 cnvr: cnvrPlugin 1272 }; 1273 function execute(dtmConfig, integration) { 1274 for (var _i = 0, _Object$entries = Object.entries(integration.plugins); _i < _Object$entries.length; _i++) { 1275 var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2), 1276 key = _Object$entries$_i[0], 1277 plugin = _Object$entries$_i[1]; 1278 var pluginState = {}; 1279 _extends(pluginState, dtmConfig); 1280 applyMappings(pluginState, plugin.mappings); 1281 if (integration.eventType === EventType.DISCO) { 1282 plugins[key].disco(pluginState, integration); 1283 } 1284 if (integration.eventType === EventType.FINAL) { 1285 plugins[key].final(pluginState, integration); 1286 } 1287 } 1288 } 1289 function executePlugins(dtmConfig, integration) { 1290 integration.eventType = integration.eventType || EventType.DISCO; 1291 execute(dtmConfig, integration); 1292 } 1293 1294 function deleteTag() { 1295 var scriptElement = document.currentScript; 1296 if (scriptElement && scriptElement.src.toLowerCase().includes(PATH_PREFIX)) { 1297 scriptElement.parentNode.removeChild(scriptElement); 1298 } 1299 } 1300 function cleanupScript(integration) { 1301 var parameters = integration.parameters; 1302 if (parameters) { 1303 if (parameters.hasOwnProperty(Parameters.CLEAR_TAG_FLAG)) { 1304 var clearTagFlag = parameters[Parameters.CLEAR_TAG_FLAG]; 1305 if (clearTagFlag) { 1306 deleteTag(); 1307 } 1308 } 1309 } 1310 } 1311 1312 function executePluginsAndCleanup(dtmConfig, integration) { 1313 executePlugins(dtmConfig, integration); 1314 if (integration.env) { 1315 setValues(dtmConfig, integration); 1316 } 1317 cleanupScript(integration); 1318 } 1319 1320 function decodeQueryParam(str) { 1321 return decodeURIComponent(str.replace(/\+/g, " ")); 1322 } 1323 1324 var GPPHandler = function GPPHandler() { 1325 this.gppQueried = false;
1326 }; 1327 var setConfig = function setConfig(dtmConfig, pingObject, win) { 1328 win = win || window; 1329 if (pingObject && pingObject.gppString) { 1330 win.localStorage.setItem("".concat(DTM_GPP_STRING), pingObject.gppString); 1331 win.localStorage.setItem("".concat(DTM_GPP_CMP_ID), pingObject.cmpId); 1332 dtmConfig["".concat(GPP_STRING)] = pingObject.gppString; 1333 dtmConfig["".concat(GPP_CMP_ID)] = pingObject.cmpId; 1334 } else if (win.localStorage.getItem("".concat(DTM_GPP_STRING))) { 1335 dtmConfig["".concat(GPP_STRING)] = win.localStorage.getItem("".concat(DTM_GPP_STRING)); 1336 dtmConfig["".concat(GPP_CMP_ID)] = win.localStorage.getItem("".concat(DTM_GPP_CMP_ID)); 1337 } else { 1338 dtmConfig["".concat(GPP_STRING)] = ''; 1339 dtmConfig["".concat(GPP_CMP_ID)] = ''; 1340 } 1341 }; 1342 var addGppEventListener = function addGppEventListener(dtmConfig, integration, primaryCallback, win) { 1343 var _this = this; 1344 win = win || window; 1345 win.__gpp('addEventListener', function (event, success) { 1346 if (!success) { 1347 return; 1348 } 1349 if (!_this.gppQueried) { 1350 _this.gppQueried = true; 1351 setConfig(dtmConfig, event.pingData, win); 1352 primaryCallback(dtmConfig, integration); 1353 } else { 1354 setConfig(dtmConfig, event.pingData, win); 1355 } 1356 }, {}, win); 1357 }; 1358 var setGppTimeoutHandler = function setGppTimeoutHandler(dtmConfig, integration, primaryCallback, win) { 1359 var _this2 = this; 1360 win = win || window; 1361 setTimeout(function () { 1362 if (!_this2.gppQueried) { 1363 _this2.gppQueried = true; 1364 var pingObject = win.__gpp('ping', function () {}, {}, win); 1365 setConfig(dtmConfig, pingObject, win); 1366 primaryCallback(dtmConfig, integration); 1367 } 1368 }, gppTimeoutMs); 1369 }; 1370 var isGppAvailable = function isGppAvailable(win) { 1371 win = win || window; 1372 return win['__gpp'] && typeof win['__gpp'] === 'function'; 1373 }; 1374 GPPHandler.prototype.findGppString = function (dtmConfig, integration, primaryCallback, win) { 1375 win = win || window; 1376 if (isGppAvailable(win)) { 1377 addGppEventListener.call(this, dtmConfig, integration, primaryCallback, win); 1378 setGppTimeoutHandler.call(this, dtmConfig, integration, primaryCallback, win); 1379 } else { 1380 primaryCallback(dtmConfig, integration); 1381 } 1382 }; 1383 1384 var integration = {"eventType":"disco","env":{"tagProto":"https","tagHost":"login-ds.dotomi.com","tagPath":"/profile/visit/final/js","dcWriteNew":false,"dcWriteExisting":false,"lsWriteNew":false,"lsWriteExisting":false,"fpcRead":true,"fpcTagWrite":false,"fpcAgilityIdWrite":false,"cookieHost":"","cookieProto":"https","cookiePath":"","cookieDomain":"","cookieTagType":null,"epsilonRP":false,"pollutedFirstPartyDtmUserTkn":false,"pollutedFirstPartyDtmUserTknLs":false,"pollutedFirstPartyDtmUserTknSs":false},"parameters":{"dtm_form_uid":"400908813340038836","cmps_queried":false,"cachebuster":"624206294","tcflag":"true","dtmc_loc":"https%3A%2F%2Ftgifridays.com%2F","dtm_token_assignment_type":"0","dtm_cid":"83063","dtm_fid":"5916","dtm_zip_code":"54494","dtm_user_dc":"iad","dtm_id_assgn_type":"0","dtm_state":"WI","dccu":"true","dtm_user_agent":"Mozilla%2F5.0+AppleWebKit%2F537.36+%28KHTML%2C+like+Gecko%3B+compatible%3B+PageSourceSearchBot%2F1.0%3B+%2Bhttps%3A%2F%2Fpagesourcesearch.com%2Fbot%29+Chrome%2F128.0.0.0+Safari%2F537.36","dtm_email_hash":"undefined","dtm_country_code":"US","init_wl_code":"3","dtm_user_id":"undefined","ops_test_camp":"false","dtmc_product_id":"null","dtm_token":"AQAEkVFx-Cjq-AF5slE8AQBFdgABAQCh08BMiQEBAKHTwEyJ","dtm_dma_code":"705","dtm_cmagic":"71ee8c","init_ts":"1790242278792","dtm_client_optout":"false","dtm_tag_complete":"false","wl_domains_key":"%5E%28.*%5C.%29%3Ftgifridays%5C.com%24-tgifridays.com-%2Ftag_path-","dtm_promo_id":"1","dtm_cookies_enabled":"false"},"mappings":[{"conditionTree":null,"id":0,"scope":"Client","source":"dtm_promo_id","destination":"cli_promo_id","type":"NAME","paused":false,"cnvrEnabled":false,"cjEnabled":false,"index":-1,"invokeOn":null,"modifier":null,"redactOriginal":false},{"conditionTree":null,"id":0,"scope":"Client","source":"items","de
1384stination":"dtm_items","type":"NAME","paused":false,"cnvrEnabled":false,"cjEnabled":false,"index":-1,"invokeOn":null,"modifier":null,"redactOriginal":false},{"conditionTree":null,"id":0,"scope":"Client","source":"dtmc_items","destination":"dtm_items","type":"NAME","paused":false,"cnvrEnabled":false,"cjEnabled":false,"index":-1,"invokeOn":null,"modifier":null,"redactOriginal":false},{"conditionTree":null,"id":0,"scope":"Client","source":"dtm_items","destination":"dtm_items","type":"JSONURLENCODE","paused":false,"cnvrEnabled":false,"cjEnabled":false,"index":-1,"invokeOn":null,"modifier":null,"redactOriginal":false},{"conditionTree":null,"id":0,"scope":"Client","source":"coupons","destination":"dtmc_coupons","type":"JSONURLENCODE","paused":false,"cnvrEnabled":false,"cjEnabled":false,"index":-1,"invokeOn":null,"modifier":null,"redactOriginal":false},{"conditionTree":null,"id":0,"scope":"Client","source":"bypass_channel","destination":"dtmc_bypass_channel","type":"JSONURLENCODE","paused":false,"cnvrEnabled":false,"cjEnabled":false,"index":-1,"invokeOn":null,"modifier":null,"redactOriginal":false},{"conditionTree":null,"id":0,"scope":"Client","source":"dtmc_tf_loc","destination":"dtmc_loc","type":"NAME","paused":false,"cnvrEnabled":false,"cjEnabled":false,"index":-1,"invokeOn":null,"modifier":null,"redactOriginal":false}],"persistence":[{"key":"dtm_status","expires":395.0,"context":null,"destination":null,"value":null,"noSuffix":false},{"key":"dtm_token","expires":395.0,"context":"server","destination":null,"value":null,"noSuffix":false},{"key":"dtm_persisted_em","expires":395.0,"context":"client","destination":null,"value":null,"noSuffix":false},{"key":"dtm_sync","expires":9.0,"context":"clientStorage","destination":null,"value":null,"noSuffix":false},{"key":"dtm_consent","expires":395.0,"context":"client","destination":null,"value":null,"noSuffix":false}],"fieldMasks":["location_search","coupons","items","bypassChannel"],"plugins":{"cnvr":{"name":"cnvr","parameters":{},"mappings":[{"conditionTree":null,"id":0,"scope":"Client","source":"location_search.dtm_em","destination":"dtm_email_hash","type":"QUERYSTRING","paused":false,"cnvrEnabled":false,"cjEnabled":false,"index":-1,"invokeOn":null,"modifier":null,"redactOriginal":false},{"conditionTree":null,"id":0,"scope":"Client","source":"email_hash","destination":"dtm_email_hash","type":"NAME","paused":false,"cnvrEnabled":false,"cjEnabled":false,"index":-1,"invokeOn":null,"modifier":null,"redactOriginal":false},{"conditionTree":null,"id":0,"scope":"Client","source":"confirmation_number","destination":"dtmc_transaction_id","type":"NAME","paused":false,"cnvrEnabled":false,"cjEnabled":false,"index":-1,"invokeOn":null,"modifier":null,"redactOriginal":false},{"conditionTree":null,"id":0,"scope":"Client","source":"dtm_promo_id","destination":"cli_promo_id","type":"NAME","paused":false,"cnvrEnabled":false,"cjEnabled":false,"index":-1,"invokeOn":null,"modifier":null,"redactOriginal":false}],"fieldMasks":["confirmation_number","email_hash"],"data":null}},"embeddedScripts":[]}; 1385 var discoveredDtmConfig = discover(); 1386 var dtmConfig = {}; 1387 if (integration.parameters) { 1388 var decodedParameters = {}; 1389 Object.entries(integration.parameters).forEach(function (_ref) { 1390 var _ref2 = _slicedToArray(_ref, 2), 1391 key = _ref2[0], 1392 value = _ref2[1]; 1393 try { 1394 decodedParameters[decodeQueryParam(key)] = decodeQueryParam(value); 1395 } catch (err) {} 1396 }); 1397 applyStaticParameters(dtmConfig, decodedParameters); 1398 } 1399 applyStaticParameters(dtmConfig, discoveredDtmConfig); 1400 if (integration.env.fpcRead) { 1401 getValues(dtmConfig, integration); 1402 loadFallbackDtmCookieIdFromWebStorage(dtmConfig); 1403 } 1404 applyMappings(dtmConfig, integration.mappings); 1405 if (integration.eventType === EventType.DISCO && integration.parameters && !integration.parameters.cmps_queried) { 1406 var gppHandler = new GPPHandler(); 1407 dtmConfig["".concat(CMPS_QUERIED)] = true; 1408 gppHandler.findGppString(dtmConfig, integration, executePluginsAndCleanup); 1409 } else { 1410 executePluginsAndCleanup(dtmConfig, integration); 1411 } 1412 1413})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.