@pendo/agent 2.324.0 → 2.325.0
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/dist/dom.esm.js +21 -2
- package/dist/pendo.module.js +124 -69
- package/dist/pendo.module.min.js +6 -8
- package/dist/servers.json +7 -7
- package/package.json +1 -1
package/dist/dom.esm.js
CHANGED
|
@@ -6776,6 +6776,18 @@ var ConfigReader = (function () {
|
|
|
6776
6776
|
* @type {boolean}
|
|
6777
6777
|
*/
|
|
6778
6778
|
addOption('disablePrefetch', [SNIPPET_SRC, PENDO_CONFIG_SRC]);
|
|
6779
|
+
/**
|
|
6780
|
+
* Visitors will be tracked under a single anonymized visitor id. Disables
|
|
6781
|
+
* cookies, localStorage, click tracking, and metadata. Only displays guides
|
|
6782
|
+
* that have been configured explicitly to show to this visitor.
|
|
6783
|
+
*
|
|
6784
|
+
* @access public
|
|
6785
|
+
* @category Config/Guides
|
|
6786
|
+
* @name doNotTrackGuides
|
|
6787
|
+
* @default false
|
|
6788
|
+
* @type {boolean}
|
|
6789
|
+
*/
|
|
6790
|
+
addOption('doNotTrackGuides', [SNIPPET_SRC, PENDO_CONFIG_SRC]);
|
|
6779
6791
|
/**
|
|
6780
6792
|
* If `true`, the web SDK will listen for `alt+shift+8` on the keyboard and try to launch the designer (). The
|
|
6781
6793
|
* keyboard shortcut requires the guide launch modal of Engage to be open in another tab showing the shortcut.
|
|
@@ -7484,7 +7496,7 @@ function applyMatrix2dRect(matrix2d, rect) {
|
|
|
7484
7496
|
return transformedRect;
|
|
7485
7497
|
}
|
|
7486
7498
|
|
|
7487
|
-
var VERSION = '2.
|
|
7499
|
+
var VERSION = '2.325.0_';
|
|
7488
7500
|
|
|
7489
7501
|
var decodeURIComponent = _.isFunction(window.decodeURIComponent) ? window.decodeURIComponent : _.identity;
|
|
7490
7502
|
|
|
@@ -7857,7 +7869,6 @@ var agentStorage = (function () {
|
|
|
7857
7869
|
var key = !isPlain ? getPendoCookieKey(name, cookieSuffix) : name;
|
|
7858
7870
|
if (storageIsDisabled()) {
|
|
7859
7871
|
delete inMemoryStorage[key];
|
|
7860
|
-
return;
|
|
7861
7872
|
}
|
|
7862
7873
|
if (shouldUseLocalStorage(keyLocalStorageOnly)) {
|
|
7863
7874
|
if (storageAvailable('localStorage')) {
|
|
@@ -7877,6 +7888,13 @@ var agentStorage = (function () {
|
|
|
7877
7888
|
}
|
|
7878
7889
|
delete inMemoryStorage[key];
|
|
7879
7890
|
}
|
|
7891
|
+
function clearAll() {
|
|
7892
|
+
_.each(registry.keys, function (config, name) {
|
|
7893
|
+
if (config.type === 'local') {
|
|
7894
|
+
clear(name);
|
|
7895
|
+
}
|
|
7896
|
+
});
|
|
7897
|
+
}
|
|
7880
7898
|
var wrappedPendoSessionStorage = _.extend({}, pendoSessionStorage$1);
|
|
7881
7899
|
wrappedPendoSessionStorage.setItem = wrapStorageWriteMethod(wrappedPendoSessionStorage.setItem, 'hasSession');
|
|
7882
7900
|
var wrappedPendoLocalStorage = _.extend({}, pendoLocalStorage);
|
|
@@ -7886,6 +7904,7 @@ var agentStorage = (function () {
|
|
|
7886
7904
|
read: read,
|
|
7887
7905
|
write: wrapStorageWriteMethod(write, 'hasLocal'),
|
|
7888
7906
|
clear: clear,
|
|
7907
|
+
clearAll: clearAll,
|
|
7889
7908
|
registry: registry,
|
|
7890
7909
|
getLocal: function () { return wrappedPendoLocalStorage; },
|
|
7891
7910
|
getSession: function () { return wrappedPendoSessionStorage; }
|
package/dist/pendo.module.js
CHANGED
|
@@ -3367,6 +3367,18 @@ var ConfigReader = (function () {
|
|
|
3367
3367
|
* @type {boolean}
|
|
3368
3368
|
*/
|
|
3369
3369
|
addOption('disablePrefetch', [SNIPPET_SRC, PENDO_CONFIG_SRC]);
|
|
3370
|
+
/**
|
|
3371
|
+
* Visitors will be tracked under a single anonymized visitor id. Disables
|
|
3372
|
+
* cookies, localStorage, click tracking, and metadata. Only displays guides
|
|
3373
|
+
* that have been configured explicitly to show to this visitor.
|
|
3374
|
+
*
|
|
3375
|
+
* @access public
|
|
3376
|
+
* @category Config/Guides
|
|
3377
|
+
* @name doNotTrackGuides
|
|
3378
|
+
* @default false
|
|
3379
|
+
* @type {boolean}
|
|
3380
|
+
*/
|
|
3381
|
+
addOption('doNotTrackGuides', [SNIPPET_SRC, PENDO_CONFIG_SRC]);
|
|
3370
3382
|
/**
|
|
3371
3383
|
* If `true`, the web SDK will listen for `alt+shift+8` on the keyboard and try to launch the designer (). The
|
|
3372
3384
|
* keyboard shortcut requires the guide launch modal of Engage to be open in another tab showing the shortcut.
|
|
@@ -3967,8 +3979,8 @@ let SERVER = '';
|
|
|
3967
3979
|
let ASSET_HOST = '';
|
|
3968
3980
|
let ASSET_PATH = '';
|
|
3969
3981
|
let DESIGNER_SERVER = '';
|
|
3970
|
-
let VERSION = '2.
|
|
3971
|
-
let PACKAGE_VERSION = '2.
|
|
3982
|
+
let VERSION = '2.325.0_';
|
|
3983
|
+
let PACKAGE_VERSION = '2.325.0';
|
|
3972
3984
|
let LOADER = 'xhr';
|
|
3973
3985
|
/* eslint-enable web-sdk-eslint-rules/no-gulp-env-references */
|
|
3974
3986
|
/**
|
|
@@ -4806,7 +4818,6 @@ var agentStorage = (function () {
|
|
|
4806
4818
|
var key = !isPlain ? getPendoCookieKey(name, cookieSuffix) : name;
|
|
4807
4819
|
if (storageIsDisabled()) {
|
|
4808
4820
|
delete inMemoryStorage[key];
|
|
4809
|
-
return;
|
|
4810
4821
|
}
|
|
4811
4822
|
if (shouldUseLocalStorage(keyLocalStorageOnly)) {
|
|
4812
4823
|
if (storageAvailable('localStorage')) {
|
|
@@ -4826,6 +4837,13 @@ var agentStorage = (function () {
|
|
|
4826
4837
|
}
|
|
4827
4838
|
delete inMemoryStorage[key];
|
|
4828
4839
|
}
|
|
4840
|
+
function clearAll() {
|
|
4841
|
+
_.each(registry.keys, (config, name) => {
|
|
4842
|
+
if (config.type === 'local') {
|
|
4843
|
+
clear(name);
|
|
4844
|
+
}
|
|
4845
|
+
});
|
|
4846
|
+
}
|
|
4829
4847
|
const wrappedPendoSessionStorage = _.extend({}, pendoSessionStorage$2);
|
|
4830
4848
|
wrappedPendoSessionStorage.setItem = wrapStorageWriteMethod(wrappedPendoSessionStorage.setItem, 'hasSession');
|
|
4831
4849
|
const wrappedPendoLocalStorage = _.extend({}, pendoLocalStorage$4);
|
|
@@ -4835,6 +4853,7 @@ var agentStorage = (function () {
|
|
|
4835
4853
|
read,
|
|
4836
4854
|
write: wrapStorageWriteMethod(write, 'hasLocal'),
|
|
4837
4855
|
clear,
|
|
4856
|
+
clearAll,
|
|
4838
4857
|
registry,
|
|
4839
4858
|
getLocal: () => wrappedPendoLocalStorage,
|
|
4840
4859
|
getSession: () => wrappedPendoSessionStorage
|
|
@@ -28424,6 +28443,7 @@ const PluginAPI = {
|
|
|
28424
28443
|
frames: {
|
|
28425
28444
|
getChannel: () => channel
|
|
28426
28445
|
},
|
|
28446
|
+
getAssetHost,
|
|
28427
28447
|
getAssetUrl,
|
|
28428
28448
|
getEventable: () => Eventable.call({}),
|
|
28429
28449
|
getScreenPosition,
|
|
@@ -28959,6 +28979,13 @@ function registerEventHandlers({ events = [] }) {
|
|
|
28959
28979
|
}
|
|
28960
28980
|
});
|
|
28961
28981
|
}
|
|
28982
|
+
function applyDoNotTrackConfigOverrides(options) {
|
|
28983
|
+
options.excludeNonGuideAnalytics = true;
|
|
28984
|
+
options.disableCookies = true;
|
|
28985
|
+
options.visitor = { id: 'cookieless_visitor' };
|
|
28986
|
+
delete options.account;
|
|
28987
|
+
delete options.parentAccount;
|
|
28988
|
+
}
|
|
28962
28989
|
// ----------------------------------------------------------------------------------
|
|
28963
28990
|
let initializeCounter = 0;
|
|
28964
28991
|
const initializeImmediately = 'initializeImmediately';
|
|
@@ -29036,6 +29063,11 @@ function initialize(options) {
|
|
|
29036
29063
|
});
|
|
29037
29064
|
}
|
|
29038
29065
|
store.dispatch('location/init', options.location || {});
|
|
29066
|
+
const doNotTrackGuides = 'doNotTrackGuides';
|
|
29067
|
+
const isDoNotTrackGuides = _.get(options, doNotTrackGuides) || ConfigReader.get(doNotTrackGuides);
|
|
29068
|
+
if (isDoNotTrackGuides) {
|
|
29069
|
+
applyDoNotTrackConfigOverrides(options);
|
|
29070
|
+
}
|
|
29039
29071
|
// Save the options somewhere
|
|
29040
29072
|
ConfigReader.setLocalConfig(options);
|
|
29041
29073
|
initDataHost();
|
|
@@ -29154,6 +29186,9 @@ function initialize(options) {
|
|
|
29154
29186
|
initializeCounter++;
|
|
29155
29187
|
announceFrameToDesignerPlugin();
|
|
29156
29188
|
flushCallQueue();
|
|
29189
|
+
if (isDoNotTrackGuides) {
|
|
29190
|
+
agentStorage.clearAll();
|
|
29191
|
+
}
|
|
29157
29192
|
}
|
|
29158
29193
|
catch (e) {
|
|
29159
29194
|
log.critical('An exception occurred during pendo.initialize.', e);
|
|
@@ -41507,12 +41542,26 @@ const RequiredQuestions = {
|
|
|
41507
41542
|
guideMarkdownUtil.removeMarkdownSyntax(item, requiredSyntax, '', pendo);
|
|
41508
41543
|
});
|
|
41509
41544
|
});
|
|
41510
|
-
|
|
41511
|
-
|
|
41512
|
-
|
|
41513
|
-
}
|
|
41514
|
-
|
|
41515
|
-
pendo.
|
|
41545
|
+
const pollTextSelector = `.bb-text[data-pendo-poll-id=${dataPendoPollId}]`;
|
|
41546
|
+
const pollParagraphSelector = `${pollTextSelector} p`;
|
|
41547
|
+
const pollListItemSelector = `${pollTextSelector} li`;
|
|
41548
|
+
const pollIndicatorSelector = `${pollTextSelector} ._pendo-required-indicator`;
|
|
41549
|
+
pendo._.each(pendo.dom(`${pollParagraphSelector}, ${pollListItemSelector}`), (el) => {
|
|
41550
|
+
pendo._.each(el.childNodes, (node) => {
|
|
41551
|
+
if (node.nodeType === 3 && node.nodeValue.indexOf(requiredSyntax) !== -1) {
|
|
41552
|
+
node.nodeValue = node.nodeValue.split(requiredSyntax).join('');
|
|
41553
|
+
}
|
|
41554
|
+
});
|
|
41555
|
+
});
|
|
41556
|
+
const hasIndicator = pendo.dom(pollIndicatorSelector).length !== 0;
|
|
41557
|
+
if (!hasIndicator) {
|
|
41558
|
+
if (pendo.dom(pollParagraphSelector).length !== 0 || pendo.dom(pollListItemSelector).length !== 0) {
|
|
41559
|
+
pendo.dom(pollParagraphSelector).append(requiredElement);
|
|
41560
|
+
pendo.dom(pollListItemSelector).append(requiredElement);
|
|
41561
|
+
}
|
|
41562
|
+
else {
|
|
41563
|
+
pendo.dom(pollTextSelector).append(requiredElement);
|
|
41564
|
+
}
|
|
41516
41565
|
}
|
|
41517
41566
|
if (pendo._.contains(requiredQuestions, dataPendoPollId)) {
|
|
41518
41567
|
let questionIndex = requiredQuestions.indexOf(dataPendoPollId);
|
|
@@ -50760,12 +50809,12 @@ var WorkerFactory = /*#__PURE__*/createInlineWorkerFactory(/* rollup-plugin-web-
|
|
|
50760
50809
|
}
|
|
50761
50810
|
}
|
|
50762
50811
|
|
|
50763
|
-
|
|
50812
|
+
var ONE_HUNDRED_MB_IN_BYTES = 100 * 1024 * 1024;
|
|
50764
50813
|
function matchHostedResources(recordingEvent, stringifiedRecordingPayload) {
|
|
50765
|
-
|
|
50766
|
-
|
|
50814
|
+
var fontURLRegex = /https:\/\/[^"\\\s]+?\.(woff2?|ttf|otf|eot)(\?[^"\\\s]*)?\b/g;
|
|
50815
|
+
var matches = stringifiedRecordingPayload.match(fontURLRegex);
|
|
50767
50816
|
// de-duplicate matches
|
|
50768
|
-
|
|
50817
|
+
var hostedResources = matches ? Array.from(new Set(matches)) : [];
|
|
50769
50818
|
return {
|
|
50770
50819
|
type: 'recording',
|
|
50771
50820
|
visitorId: recordingEvent.visitorId,
|
|
@@ -50780,7 +50829,7 @@ var WorkerFactory = /*#__PURE__*/createInlineWorkerFactory(/* rollup-plugin-web-
|
|
|
50780
50829
|
recordingPayloadMetadata: [],
|
|
50781
50830
|
sequence: 0,
|
|
50782
50831
|
recordingPayloadCount: 0,
|
|
50783
|
-
hostedResources
|
|
50832
|
+
hostedResources: hostedResources
|
|
50784
50833
|
};
|
|
50785
50834
|
}
|
|
50786
50835
|
// keep in mind changes here may need addressing in the extension worker proxy as well
|
|
@@ -50788,69 +50837,69 @@ var WorkerFactory = /*#__PURE__*/createInlineWorkerFactory(/* rollup-plugin-web-
|
|
|
50788
50837
|
try {
|
|
50789
50838
|
if (e.data.type === 'init' && e.data.lockID) {
|
|
50790
50839
|
if (navigator.locks) {
|
|
50791
|
-
navigator.locks.request(e.data.lockID, ()
|
|
50840
|
+
navigator.locks.request(e.data.lockID, function () {
|
|
50792
50841
|
postMessage({ ready: true });
|
|
50793
50842
|
// This unresolved promise keeps the lock held with the worker until the worker is
|
|
50794
50843
|
// terminated at which point the lock is released.
|
|
50795
|
-
return new Promise$2(()
|
|
50844
|
+
return new Promise$2(function () { });
|
|
50796
50845
|
});
|
|
50797
50846
|
}
|
|
50798
50847
|
return;
|
|
50799
50848
|
}
|
|
50800
50849
|
if (e.data.url && e.data.payload) {
|
|
50801
|
-
|
|
50850
|
+
var _a = e.data, url = _a.url, payload = _a.payload, shouldCacheResources = _a.shouldCacheResources;
|
|
50802
50851
|
if (Object.keys(payload).length === 0) {
|
|
50803
50852
|
postMessage({
|
|
50804
50853
|
type: 'emptyPayload'
|
|
50805
50854
|
});
|
|
50806
50855
|
}
|
|
50807
|
-
|
|
50808
|
-
|
|
50856
|
+
var sequence_1 = payload.sequence;
|
|
50857
|
+
var stringifiedRecordingPayload = JSON.stringify(payload.recordingPayload);
|
|
50809
50858
|
// calculate and post back the recording payload size before the payload is compressed
|
|
50810
|
-
|
|
50811
|
-
|
|
50859
|
+
var recordingPayloadSize = new TextEncoder().encode(stringifiedRecordingPayload).length;
|
|
50860
|
+
var exceedsPayloadSizeLimit = recordingPayloadSize >= ONE_HUNDRED_MB_IN_BYTES;
|
|
50812
50861
|
postMessage({
|
|
50813
50862
|
type: 'recordingPayloadSize',
|
|
50814
|
-
recordingPayloadSize,
|
|
50815
|
-
exceedsPayloadSizeLimit
|
|
50863
|
+
recordingPayloadSize: recordingPayloadSize,
|
|
50864
|
+
exceedsPayloadSizeLimit: exceedsPayloadSizeLimit
|
|
50816
50865
|
});
|
|
50817
50866
|
// don't attempt to send the payload if it exceeds the allowed limit
|
|
50818
50867
|
if (exceedsPayloadSizeLimit)
|
|
50819
50868
|
return;
|
|
50820
50869
|
if (shouldCacheResources) {
|
|
50821
|
-
|
|
50870
|
+
var hostedResourcesEvent = matchHostedResources(payload, stringifiedRecordingPayload);
|
|
50822
50871
|
if (hostedResourcesEvent.hostedResources.length) {
|
|
50823
50872
|
postMessage({
|
|
50824
50873
|
type: 'hostedResources',
|
|
50825
|
-
hostedResourcesEvent
|
|
50874
|
+
hostedResourcesEvent: hostedResourcesEvent
|
|
50826
50875
|
});
|
|
50827
50876
|
}
|
|
50828
50877
|
}
|
|
50829
50878
|
payload.recordingSize = recordingPayloadSize;
|
|
50830
|
-
|
|
50879
|
+
var body = compress(payload, 'binary');
|
|
50831
50880
|
// we want to calculate ct (current time) as close as we can to the actual POST request
|
|
50832
50881
|
// so that it's as accurate as possible
|
|
50833
|
-
url =
|
|
50882
|
+
url = "".concat(url, "&ct=").concat(new Date().getTime());
|
|
50834
50883
|
fetch(url, {
|
|
50835
50884
|
method: 'POST',
|
|
50836
|
-
body
|
|
50885
|
+
body: body
|
|
50837
50886
|
}).then(function (response) {
|
|
50838
50887
|
if (response.status < 200 || response.status >= 300) {
|
|
50839
50888
|
postMessage({
|
|
50840
|
-
error: new Error(
|
|
50889
|
+
error: new Error("received status code ".concat(response.status, ": ").concat(response.statusText)),
|
|
50841
50890
|
status: response.status,
|
|
50842
|
-
sequence
|
|
50891
|
+
sequence: sequence_1
|
|
50843
50892
|
});
|
|
50844
50893
|
}
|
|
50845
50894
|
else {
|
|
50846
50895
|
postMessage({
|
|
50847
|
-
sequence
|
|
50896
|
+
sequence: sequence_1
|
|
50848
50897
|
});
|
|
50849
50898
|
}
|
|
50850
|
-
})
|
|
50899
|
+
})["catch"](function (e) {
|
|
50851
50900
|
postMessage({
|
|
50852
50901
|
error: e,
|
|
50853
|
-
sequence
|
|
50902
|
+
sequence: sequence_1
|
|
50854
50903
|
});
|
|
50855
50904
|
});
|
|
50856
50905
|
}
|
|
@@ -51161,7 +51210,7 @@ function includes(str, substring) {
|
|
|
51161
51210
|
function getResourceType(blockedURI, directive) {
|
|
51162
51211
|
if (!directive || typeof directive !== 'string')
|
|
51163
51212
|
return 'resource';
|
|
51164
|
-
|
|
51213
|
+
var d = directive.toLowerCase();
|
|
51165
51214
|
if (blockedURI === 'inline') {
|
|
51166
51215
|
if (includes(d, 'script-src-attr')) {
|
|
51167
51216
|
return 'inline event handler';
|
|
@@ -51220,11 +51269,12 @@ function getResourceType(blockedURI, directive) {
|
|
|
51220
51269
|
function getDirective(policy, directiveName) {
|
|
51221
51270
|
if (!policy || !directiveName)
|
|
51222
51271
|
return '';
|
|
51223
|
-
|
|
51224
|
-
for (
|
|
51225
|
-
|
|
51226
|
-
|
|
51227
|
-
|
|
51272
|
+
var needle = directiveName.toLowerCase();
|
|
51273
|
+
for (var _i = 0, _a = policy.split(';'); _i < _a.length; _i++) {
|
|
51274
|
+
var directive = _a[_i];
|
|
51275
|
+
var trimmed = directive.trim();
|
|
51276
|
+
var lower = trimmed.toLowerCase();
|
|
51277
|
+
if (lower === needle || lower.startsWith("".concat(needle, " "))) {
|
|
51228
51278
|
return trimmed;
|
|
51229
51279
|
}
|
|
51230
51280
|
}
|
|
@@ -51246,7 +51296,7 @@ function getDirective(policy, directiveName) {
|
|
|
51246
51296
|
function getArticle(phrase) {
|
|
51247
51297
|
if (!phrase || typeof phrase !== 'string')
|
|
51248
51298
|
return 'A';
|
|
51249
|
-
|
|
51299
|
+
var c = phrase.trim().charAt(0).toLowerCase();
|
|
51250
51300
|
return includes('aeiou', c) ? 'An' : 'A';
|
|
51251
51301
|
}
|
|
51252
51302
|
/**
|
|
@@ -51289,46 +51339,47 @@ function createCspViolationMessage(blockedURI, directive, isReportOnly, original
|
|
|
51289
51339
|
return 'Content Security Policy: Unknown violation occurred.';
|
|
51290
51340
|
}
|
|
51291
51341
|
try {
|
|
51292
|
-
|
|
51342
|
+
var reportOnlyText = isReportOnly ? ' (Report-Only)' : '';
|
|
51293
51343
|
// special case for frame-ancestors since it doesn't fit our template at all
|
|
51294
51344
|
if ((directive === null || directive === void 0 ? void 0 : directive.toLowerCase()) === 'frame-ancestors') {
|
|
51295
|
-
return
|
|
51345
|
+
return "Content Security Policy".concat(reportOnlyText, ": The display of ").concat(blockedURI, " in a frame was blocked because an ancestor violates your site's frame-ancestors policy.\nCurrent CSP: \"").concat(originalPolicy, "\".");
|
|
51296
51346
|
}
|
|
51297
|
-
|
|
51298
|
-
|
|
51299
|
-
|
|
51300
|
-
|
|
51301
|
-
|
|
51302
|
-
|
|
51303
|
-
return
|
|
51347
|
+
var resourceType = getResourceType(blockedURI, directive);
|
|
51348
|
+
var article = getArticle(resourceType);
|
|
51349
|
+
var source = formatBlockedUri(blockedURI);
|
|
51350
|
+
var directiveValue = getDirective(originalPolicy, directive);
|
|
51351
|
+
var policyDisplay = directiveValue || directive;
|
|
51352
|
+
var resourceDescription = "".concat(article, " ").concat(resourceType).concat(source ? " from ".concat(source) : '');
|
|
51353
|
+
return "Content Security Policy".concat(reportOnlyText, ": ").concat(resourceDescription, " was blocked by your site's `").concat(policyDisplay, "` policy.\nCurrent CSP: \"").concat(originalPolicy, "\".");
|
|
51304
51354
|
}
|
|
51305
51355
|
catch (error) {
|
|
51306
|
-
return
|
|
51356
|
+
return "Content Security Policy: Error formatting violation message: ".concat(error.message);
|
|
51307
51357
|
}
|
|
51308
51358
|
}
|
|
51309
51359
|
|
|
51310
|
-
|
|
51311
|
-
|
|
51360
|
+
var MAX_LENGTH = 1000;
|
|
51361
|
+
var PII_PATTERN = {
|
|
51312
51362
|
ip: /\b(?:\d{1,3}\.){3}\d{1,3}\b/g,
|
|
51313
51363
|
ssn: /\b\d{3}-\d{2}-\d{4}\b/g,
|
|
51314
51364
|
creditCard: /\b(?:\d[ -]?){12,18}\d\b/g,
|
|
51315
51365
|
httpsUrls: /https:\/\/[^\s]+/g,
|
|
51316
51366
|
email: /[\w._+-]+@[\w.-]+\.\w+/g
|
|
51317
51367
|
};
|
|
51318
|
-
|
|
51319
|
-
|
|
51320
|
-
|
|
51321
|
-
|
|
51322
|
-
|
|
51368
|
+
var PII_REPLACEMENT = '*'.repeat(10);
|
|
51369
|
+
var JSON_PII_KEYS = ['password', 'email', 'key', 'token', 'auth', 'authentication', 'phone', 'address', 'ssn'];
|
|
51370
|
+
var UNABLE_TO_DISPLAY_BODY = '[Unable to display body: detected PII could not be redacted]';
|
|
51371
|
+
var joinedKeys = JSON_PII_KEYS.join('|');
|
|
51372
|
+
var keyPattern = "\"([^\"]*(?:".concat(joinedKeys, ")[^\"]*)\"");
|
|
51323
51373
|
// only scrub strings, numbers, and booleans
|
|
51324
|
-
|
|
51374
|
+
var acceptedValues = '("([^"\\\\]*(?:\\\\.[^"\\\\]*)*")|(\\d+)|(true|false))';
|
|
51325
51375
|
/**
|
|
51326
51376
|
* Truncates a string to the max length
|
|
51327
51377
|
* @access private
|
|
51328
51378
|
* @param {String} string
|
|
51329
51379
|
* @returns {String}
|
|
51330
51380
|
*/
|
|
51331
|
-
function truncate(string, includeEllipsis
|
|
51381
|
+
function truncate(string, includeEllipsis) {
|
|
51382
|
+
if (includeEllipsis === void 0) { includeEllipsis = false; }
|
|
51332
51383
|
if (string.length <= MAX_LENGTH)
|
|
51333
51384
|
return string;
|
|
51334
51385
|
if (includeEllipsis) {
|
|
@@ -51345,7 +51396,7 @@ function truncate(string, includeEllipsis = false) {
|
|
|
51345
51396
|
* @returns {String}
|
|
51346
51397
|
*/
|
|
51347
51398
|
function generateLogKey(methodName, message, stackTrace) {
|
|
51348
|
-
return
|
|
51399
|
+
return "".concat(methodName, "|").concat(message, "|").concat(stackTrace);
|
|
51349
51400
|
}
|
|
51350
51401
|
/**
|
|
51351
51402
|
* Checks if a string has 2 or more digits, a https URL, or an email address
|
|
@@ -51362,12 +51413,13 @@ function mightContainPII(string) {
|
|
|
51362
51413
|
* @param {String} string
|
|
51363
51414
|
* @returns {String}
|
|
51364
51415
|
*/
|
|
51365
|
-
function scrubPII(
|
|
51416
|
+
function scrubPII(_a) {
|
|
51417
|
+
var string = _a.string, _ = _a._;
|
|
51366
51418
|
if (!string || typeof string !== 'string')
|
|
51367
51419
|
return string;
|
|
51368
51420
|
if (!mightContainPII(string))
|
|
51369
51421
|
return string;
|
|
51370
|
-
return _.reduce(_.values(PII_PATTERN), (str, pattern)
|
|
51422
|
+
return _.reduce(_.values(PII_PATTERN), function (str, pattern) { return str.replace(pattern, PII_REPLACEMENT); }, string);
|
|
51371
51423
|
}
|
|
51372
51424
|
/**
|
|
51373
51425
|
* Scrub PII from a stringified JSON object
|
|
@@ -51376,12 +51428,14 @@ function scrubPII({ string, _ }) {
|
|
|
51376
51428
|
* @returns {String}
|
|
51377
51429
|
*/
|
|
51378
51430
|
function scrubJsonPII(string) {
|
|
51379
|
-
|
|
51431
|
+
var fullScrubRegex = new RegExp("".concat(keyPattern, "\\s*:\\s*[\\{\\[]"), 'i');
|
|
51380
51432
|
if (fullScrubRegex.test(string)) {
|
|
51381
51433
|
return UNABLE_TO_DISPLAY_BODY;
|
|
51382
51434
|
}
|
|
51383
|
-
|
|
51384
|
-
return string.replace(keyValueScrubRegex, (match, key)
|
|
51435
|
+
var keyValueScrubRegex = new RegExp("".concat(keyPattern, "\\s*:\\s*").concat(acceptedValues), 'gi');
|
|
51436
|
+
return string.replace(keyValueScrubRegex, function (match, key) {
|
|
51437
|
+
return "\"".concat(key, "\":\"").concat(PII_REPLACEMENT, "\"");
|
|
51438
|
+
});
|
|
51385
51439
|
}
|
|
51386
51440
|
/**
|
|
51387
51441
|
* Checks if a string is a JSON object
|
|
@@ -51393,7 +51447,7 @@ function scrubJsonPII(string) {
|
|
|
51393
51447
|
function mightContainJson(string, contentType) {
|
|
51394
51448
|
if (!string || typeof string !== 'string')
|
|
51395
51449
|
return false;
|
|
51396
|
-
|
|
51450
|
+
var firstChar = string.charAt(0);
|
|
51397
51451
|
if (contentType && contentType.indexOf('application/json') !== -1) {
|
|
51398
51452
|
return true;
|
|
51399
51453
|
}
|
|
@@ -51406,19 +51460,20 @@ function mightContainJson(string, contentType) {
|
|
|
51406
51460
|
* @param {String} contentType
|
|
51407
51461
|
* @returns {String}
|
|
51408
51462
|
*/
|
|
51409
|
-
function maskSensitiveFields(
|
|
51463
|
+
function maskSensitiveFields(_a) {
|
|
51464
|
+
var string = _a.string, contentType = _a.contentType, _ = _a._;
|
|
51410
51465
|
if (!string || typeof string !== 'string')
|
|
51411
51466
|
return string;
|
|
51412
51467
|
if (mightContainJson(string, contentType)) {
|
|
51413
51468
|
string = scrubJsonPII(string);
|
|
51414
51469
|
}
|
|
51415
51470
|
if (mightContainPII(string)) {
|
|
51416
|
-
string = scrubPII({ string, _ });
|
|
51471
|
+
string = scrubPII({ string: string, _: _ });
|
|
51417
51472
|
}
|
|
51418
51473
|
return string;
|
|
51419
51474
|
}
|
|
51420
51475
|
|
|
51421
|
-
|
|
51476
|
+
var DEV_LOG_TYPE = 'devlog';
|
|
51422
51477
|
function createDevLogEnvelope(pluginAPI, globalPendo) {
|
|
51423
51478
|
return {
|
|
51424
51479
|
browser_time: pluginAPI.util.getNow(),
|