@pendo/agent 2.327.0 → 2.328.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 +2 -1
- package/dist/pendo.module.js +485 -247
- package/dist/pendo.module.min.js +11 -31
- package/dist/servers.json +7 -7
- package/package.json +1 -1
package/dist/pendo.module.js
CHANGED
|
@@ -431,6 +431,7 @@ function getPolicy(pendo) {
|
|
|
431
431
|
}
|
|
432
432
|
|
|
433
433
|
var STAGING_SERVER_HASHES = 'stagingServerHashes';
|
|
434
|
+
var STAGING_DOMAINS = 'stagingDomains';
|
|
434
435
|
var pendo$1;
|
|
435
436
|
var _pendoConfig = {};
|
|
436
437
|
function loadAsModule(config) {
|
|
@@ -523,6 +524,27 @@ function urlMatchesPatterns(url, patterns = [], hashes = []) {
|
|
|
523
524
|
}
|
|
524
525
|
return false;
|
|
525
526
|
}
|
|
527
|
+
function domainSuffixes(host) {
|
|
528
|
+
var hostname = (host || '').split(':')[0].toLowerCase();
|
|
529
|
+
if (!hostname || /^[\d.]+$/.test(hostname) || hostname.indexOf(':') >= 0)
|
|
530
|
+
return [];
|
|
531
|
+
var labels = hostname.split('.');
|
|
532
|
+
var suffixes = [];
|
|
533
|
+
for (var i = 0; i <= labels.length - 2; i++) {
|
|
534
|
+
suffixes.push(labels.slice(i).join('.'));
|
|
535
|
+
}
|
|
536
|
+
return suffixes;
|
|
537
|
+
}
|
|
538
|
+
function hostMatchesStagingDomains(host, domains = []) {
|
|
539
|
+
if (!domains.length)
|
|
540
|
+
return false;
|
|
541
|
+
var suffixes = domainSuffixes(host);
|
|
542
|
+
for (var i = 0; i < suffixes.length; i++) {
|
|
543
|
+
if (domains.indexOf(getHash(suffixes[i])) >= 0)
|
|
544
|
+
return true;
|
|
545
|
+
}
|
|
546
|
+
return false;
|
|
547
|
+
}
|
|
526
548
|
function isStagingServer(config, location) {
|
|
527
549
|
if (!config) {
|
|
528
550
|
config = getPendoConfig();
|
|
@@ -536,7 +558,8 @@ function isStagingServer(config, location) {
|
|
|
536
558
|
if (!location) {
|
|
537
559
|
location = window.location;
|
|
538
560
|
}
|
|
539
|
-
return urlMatchesPatterns(location.host, config.stagingServers, config[STAGING_SERVER_HASHES])
|
|
561
|
+
return urlMatchesPatterns(location.host, config.stagingServers, config[STAGING_SERVER_HASHES]) ||
|
|
562
|
+
hostMatchesStagingDomains(location.host, config[STAGING_DOMAINS]);
|
|
540
563
|
}
|
|
541
564
|
function getHash(str) {
|
|
542
565
|
return b64.uint8ToBase64(sha1
|
|
@@ -3979,8 +4002,8 @@ let SERVER = '';
|
|
|
3979
4002
|
let ASSET_HOST = '';
|
|
3980
4003
|
let ASSET_PATH = '';
|
|
3981
4004
|
let DESIGNER_SERVER = '';
|
|
3982
|
-
let VERSION = '2.
|
|
3983
|
-
let PACKAGE_VERSION = '2.
|
|
4005
|
+
let VERSION = '2.328.0_';
|
|
4006
|
+
let PACKAGE_VERSION = '2.328.0';
|
|
3984
4007
|
let LOADER = 'xhr';
|
|
3985
4008
|
/* eslint-enable web-sdk-eslint-rules/no-gulp-env-references */
|
|
3986
4009
|
/**
|
|
@@ -5658,6 +5681,7 @@ var Events = (function () {
|
|
|
5658
5681
|
new EventType('segmentFlagsReady', [DEBUG, LIFECYCLE]),
|
|
5659
5682
|
new EventType('segmentFlagsError', [DEBUG, LIFECYCLE]),
|
|
5660
5683
|
new EventType('guideListChanged', [DEBUG, LIFECYCLE]),
|
|
5684
|
+
new EventType('guidesReceived', [DEBUG, LIFECYCLE]),
|
|
5661
5685
|
new EventType('guideSeen', [DEBUG, LIFECYCLE]),
|
|
5662
5686
|
new EventType('guideNotSeen', [DEBUG, LIFECYCLE]),
|
|
5663
5687
|
new EventType('guideAdvanced', [DEBUG, LIFECYCLE]),
|
|
@@ -24330,15 +24354,13 @@ function guidesPayload(guidesJson) {
|
|
|
24330
24354
|
delete guidesJson.segmentFlags; // This is temporary until the BE stops sending segment flags in the guides payload, at which point this can be removed
|
|
24331
24355
|
}
|
|
24332
24356
|
_.extend(pendo$1, guidesJson);
|
|
24333
|
-
|
|
24334
|
-
|
|
24335
|
-
|
|
24336
|
-
|
|
24337
|
-
|
|
24338
|
-
|
|
24339
|
-
|
|
24340
|
-
}
|
|
24341
|
-
});
|
|
24357
|
+
const guidesReceivedPayload = {
|
|
24358
|
+
guides: pendo$1.guides,
|
|
24359
|
+
visitorId: get_visitor_id(),
|
|
24360
|
+
guideCache
|
|
24361
|
+
};
|
|
24362
|
+
Events.guidesReceived.trigger(guidesReceivedPayload);
|
|
24363
|
+
pendo$1.guides = guidesReceivedPayload.guides;
|
|
24342
24364
|
if (mostRecentGuideRequest.deferred) {
|
|
24343
24365
|
mostRecentGuideRequest.deferred.resolve();
|
|
24344
24366
|
}
|
|
@@ -28967,7 +28989,7 @@ function registerEventHandlers({ events = [] }) {
|
|
|
28967
28989
|
function applyDoNotTrackConfigOverrides(options) {
|
|
28968
28990
|
options.excludeNonGuideAnalytics = true;
|
|
28969
28991
|
options.disableCookies = true;
|
|
28970
|
-
options.visitor = { id: '
|
|
28992
|
+
options.visitor = { id: '__cookieless_visitor__' };
|
|
28971
28993
|
delete options.account;
|
|
28972
28994
|
delete options.parentAccount;
|
|
28973
28995
|
}
|
|
@@ -37435,6 +37457,126 @@ const FrustrationEvent = (function () {
|
|
|
37435
37457
|
}
|
|
37436
37458
|
})();
|
|
37437
37459
|
|
|
37460
|
+
const snapshots = {};
|
|
37461
|
+
function snapshotKey(guideId, stepId) {
|
|
37462
|
+
return `${guideId}:${stepId}`;
|
|
37463
|
+
}
|
|
37464
|
+
function isPlaceholderGuide(guide) {
|
|
37465
|
+
return _.keys(guide).length === 1 && guide.id;
|
|
37466
|
+
}
|
|
37467
|
+
function recordGuideResponseSnapshots(guidesFromResponse, guideCache) {
|
|
37468
|
+
if (!guidesFromResponse || !guideCache) {
|
|
37469
|
+
return;
|
|
37470
|
+
}
|
|
37471
|
+
_.each(guidesFromResponse, function (guide) {
|
|
37472
|
+
if (!guide || !guide.id) {
|
|
37473
|
+
return;
|
|
37474
|
+
}
|
|
37475
|
+
if (isPlaceholderGuide(guide)) {
|
|
37476
|
+
const priorCached = guideCache.get(guide.id);
|
|
37477
|
+
if (!priorCached || !priorCached.steps) {
|
|
37478
|
+
return;
|
|
37479
|
+
}
|
|
37480
|
+
_.each(priorCached.steps, function (step) {
|
|
37481
|
+
if (!step || !step.id) {
|
|
37482
|
+
return;
|
|
37483
|
+
}
|
|
37484
|
+
const entry = { payload_seen_state: null };
|
|
37485
|
+
if (!_.isUndefined(step.seenState) && step.seenState !== null) {
|
|
37486
|
+
entry.cached_seen_state = step.seenState;
|
|
37487
|
+
}
|
|
37488
|
+
snapshots[snapshotKey(guide.id, step.id)] = entry;
|
|
37489
|
+
});
|
|
37490
|
+
return;
|
|
37491
|
+
}
|
|
37492
|
+
const priorCached = guideCache.get(guide.id);
|
|
37493
|
+
_.each(guide.steps || [], function (step) {
|
|
37494
|
+
if (!step || !step.id) {
|
|
37495
|
+
return;
|
|
37496
|
+
}
|
|
37497
|
+
const entry = {
|
|
37498
|
+
payload_seen_state: _.isUndefined(step.seenState) ? null : step.seenState
|
|
37499
|
+
};
|
|
37500
|
+
const cachedStep = priorCached && _.findWhere(priorCached.steps, { id: step.id });
|
|
37501
|
+
if (cachedStep && !_.isUndefined(cachedStep.seenState) && cachedStep.seenState !== null) {
|
|
37502
|
+
entry.cached_seen_state = cachedStep.seenState;
|
|
37503
|
+
}
|
|
37504
|
+
snapshots[snapshotKey(guide.id, step.id)] = entry;
|
|
37505
|
+
});
|
|
37506
|
+
});
|
|
37507
|
+
}
|
|
37508
|
+
function mergeGuidesWithCache(guidesFromResponse, visitorId, guideCache) {
|
|
37509
|
+
if (!guidesFromResponse) {
|
|
37510
|
+
return guidesFromResponse;
|
|
37511
|
+
}
|
|
37512
|
+
if (!guideCache) {
|
|
37513
|
+
return guidesFromResponse;
|
|
37514
|
+
}
|
|
37515
|
+
return _.map(guidesFromResponse, function (guide) {
|
|
37516
|
+
if (isPlaceholderGuide(guide)) {
|
|
37517
|
+
return guideCache.get(guide.id);
|
|
37518
|
+
}
|
|
37519
|
+
guideCache.add(guide, visitorId);
|
|
37520
|
+
return guide;
|
|
37521
|
+
});
|
|
37522
|
+
}
|
|
37523
|
+
function getSnapshot(guideId, stepId) {
|
|
37524
|
+
return snapshots[snapshotKey(guideId, stepId)];
|
|
37525
|
+
}
|
|
37526
|
+
function clearSnapshots() {
|
|
37527
|
+
_.each(_.keys(snapshots), function (key) {
|
|
37528
|
+
delete snapshots[key];
|
|
37529
|
+
});
|
|
37530
|
+
}
|
|
37531
|
+
|
|
37532
|
+
const GuideCachePlugin = {
|
|
37533
|
+
name: 'GuideCache',
|
|
37534
|
+
initialize(pendo, PluginAPI) {
|
|
37535
|
+
this.onGuidesReceived = _.bind(this.guidesReceived, this);
|
|
37536
|
+
this.onEventCaptured = _.bind(this.eventCaptured, this);
|
|
37537
|
+
PluginAPI.Events.on('guidesReceived', this.onGuidesReceived);
|
|
37538
|
+
this.subscriptions = [
|
|
37539
|
+
PluginAPI.attachEvent(PluginAPI.Events, 'eventCaptured', this.onEventCaptured)
|
|
37540
|
+
];
|
|
37541
|
+
},
|
|
37542
|
+
teardown(pendo, PluginAPI) {
|
|
37543
|
+
PluginAPI.Events.off('guidesReceived', this.onGuidesReceived);
|
|
37544
|
+
_.each(this.subscriptions, function (unsubscribe) {
|
|
37545
|
+
unsubscribe();
|
|
37546
|
+
});
|
|
37547
|
+
this.subscriptions = [];
|
|
37548
|
+
},
|
|
37549
|
+
guidesReceived(event) {
|
|
37550
|
+
clearSnapshots();
|
|
37551
|
+
const payload = event.data[0];
|
|
37552
|
+
if (!payload || !payload.guideCache || !payload.guides) {
|
|
37553
|
+
return;
|
|
37554
|
+
}
|
|
37555
|
+
recordGuideResponseSnapshots(payload.guides, payload.guideCache);
|
|
37556
|
+
payload.guides = mergeGuidesWithCache(payload.guides, payload.visitorId, payload.guideCache);
|
|
37557
|
+
},
|
|
37558
|
+
eventCaptured(event) {
|
|
37559
|
+
if (!event || !event.data || !event.data.length) {
|
|
37560
|
+
return;
|
|
37561
|
+
}
|
|
37562
|
+
const capturedEvent = event.data[0];
|
|
37563
|
+
if (!capturedEvent || capturedEvent.type !== 'guideSeen') {
|
|
37564
|
+
return;
|
|
37565
|
+
}
|
|
37566
|
+
if (capturedEvent.props.reason !== 'auto') {
|
|
37567
|
+
return;
|
|
37568
|
+
}
|
|
37569
|
+
const snap = getSnapshot(capturedEvent.props.guide_id, capturedEvent.props.guide_step_id);
|
|
37570
|
+
if (!snap) {
|
|
37571
|
+
return;
|
|
37572
|
+
}
|
|
37573
|
+
capturedEvent.props.payload_seen_state = snap.payload_seen_state;
|
|
37574
|
+
if (!_.isUndefined(snap.cached_seen_state)) {
|
|
37575
|
+
capturedEvent.props.cached_seen_state = snap.cached_seen_state;
|
|
37576
|
+
}
|
|
37577
|
+
}
|
|
37578
|
+
};
|
|
37579
|
+
|
|
37438
37580
|
const IFrameMonitor = (function () {
|
|
37439
37581
|
const FRAME_TIMER_LENGTH = 250;
|
|
37440
37582
|
const FRAME_ID = 'pendo-loader';
|
|
@@ -40062,6 +40204,8 @@ const THUMB_UP = 'thumbUp';
|
|
|
40062
40204
|
const TURN_CONTAINER = 'turnContainer';
|
|
40063
40205
|
const TURN_ATTR = 'turnAttr';
|
|
40064
40206
|
const USER_MESSAGE = 'userMessage';
|
|
40207
|
+
const CUSTOM_AGENT_ID_URL_PATTERN = 'customAgentIdUrlPattern';
|
|
40208
|
+
const CUSTOM_AGENT_NAME = 'customAgentName';
|
|
40065
40209
|
const REQUIRED_SELECTORS = [
|
|
40066
40210
|
ASSISTANT_MESSAGE,
|
|
40067
40211
|
CONVERSATION_ID_URL_PATTERN,
|
|
@@ -40072,6 +40216,8 @@ const REQUIRED_SELECTORS = [
|
|
|
40072
40216
|
USER_MESSAGE
|
|
40073
40217
|
];
|
|
40074
40218
|
const STREAMING_END_SETTLE_MS = 500;
|
|
40219
|
+
const SUBMISSION_START_RETRY_MS = 1000;
|
|
40220
|
+
const SUBMISSION_START_MAX_ATTEMPTS = 4;
|
|
40075
40221
|
class DOMConversation {
|
|
40076
40222
|
// Returns the list of required selector types that are missing or empty
|
|
40077
40223
|
// in the given cssSelectors config. An empty array means the config is
|
|
@@ -40106,8 +40252,10 @@ class DOMConversation {
|
|
|
40106
40252
|
this.observers = [];
|
|
40107
40253
|
this.wasStreaming = false;
|
|
40108
40254
|
this.streamingEndTimer = null;
|
|
40255
|
+
this.submissionStartRetryTimer = null;
|
|
40109
40256
|
this.requestNode = null;
|
|
40110
40257
|
this.conversationIdRegex = null;
|
|
40258
|
+
this.customAgentIdRegex = null;
|
|
40111
40259
|
this.lastReturnedMessageId = null;
|
|
40112
40260
|
this.dom = pendo.dom;
|
|
40113
40261
|
this._ = pendo._;
|
|
@@ -40125,6 +40273,15 @@ class DOMConversation {
|
|
|
40125
40273
|
}
|
|
40126
40274
|
});
|
|
40127
40275
|
this.conversationIdRegex = new RegExp(this.selectors[CONVERSATION_ID_URL_PATTERN]);
|
|
40276
|
+
const customAgentIdUrlPattern = this.selectors[CUSTOM_AGENT_ID_URL_PATTERN];
|
|
40277
|
+
if (customAgentIdUrlPattern) { // this is optional
|
|
40278
|
+
try {
|
|
40279
|
+
this.customAgentIdRegex = new RegExp(customAgentIdUrlPattern);
|
|
40280
|
+
}
|
|
40281
|
+
catch (error) {
|
|
40282
|
+
this.api.log.error(`bad customAgentIdUrlPattern ${customAgentIdUrlPattern}`, { error });
|
|
40283
|
+
}
|
|
40284
|
+
}
|
|
40128
40285
|
this.root = document.body;
|
|
40129
40286
|
this.setupReactionListener();
|
|
40130
40287
|
this.setupStreamingObserver();
|
|
@@ -40201,14 +40358,20 @@ class DOMConversation {
|
|
|
40201
40358
|
}
|
|
40202
40359
|
this.wasStreaming = isStreaming;
|
|
40203
40360
|
}
|
|
40204
|
-
onSubmissionStart() {
|
|
40361
|
+
onSubmissionStart(attempt = 1) {
|
|
40205
40362
|
this.requestNode = this.findLastRequestNode();
|
|
40206
40363
|
if (this.requestNode) {
|
|
40207
40364
|
this.handleUserMessage(this.requestNode);
|
|
40365
|
+
return;
|
|
40366
|
+
}
|
|
40367
|
+
// URL hasn't flipped yet to include the conversation id on a fresh chat
|
|
40368
|
+
// retry, if that still fails, onSubmissionEnd handles it
|
|
40369
|
+
if (attempt < SUBMISSION_START_MAX_ATTEMPTS) {
|
|
40370
|
+
this.startSubmissionStartRetryTimer(attempt + 1);
|
|
40208
40371
|
}
|
|
40209
40372
|
}
|
|
40210
40373
|
onSubmissionEnd() {
|
|
40211
|
-
this.
|
|
40374
|
+
this.stopSubmissionStartRetryTimer();
|
|
40212
40375
|
let requestNode = this.requestNode;
|
|
40213
40376
|
this.requestNode = null;
|
|
40214
40377
|
if (!requestNode) {
|
|
@@ -40288,6 +40451,32 @@ class DOMConversation {
|
|
|
40288
40451
|
return null;
|
|
40289
40452
|
return m[1] !== undefined ? m[1] : m[0];
|
|
40290
40453
|
}
|
|
40454
|
+
getCustomAgentId() {
|
|
40455
|
+
if (!this.customAgentIdRegex)
|
|
40456
|
+
return undefined;
|
|
40457
|
+
const m = location.href.match(this.customAgentIdRegex);
|
|
40458
|
+
if (!m)
|
|
40459
|
+
return undefined;
|
|
40460
|
+
return m[1] !== undefined ? m[1] : m[0];
|
|
40461
|
+
}
|
|
40462
|
+
getCustomAgentName() {
|
|
40463
|
+
if (!this.findSelector(CUSTOM_AGENT_NAME))
|
|
40464
|
+
return '';
|
|
40465
|
+
const node = this.select(CUSTOM_AGENT_NAME);
|
|
40466
|
+
if (!node.length)
|
|
40467
|
+
return '';
|
|
40468
|
+
return node.text().trim();
|
|
40469
|
+
}
|
|
40470
|
+
addCustomAgentInfo(eventPayload) {
|
|
40471
|
+
const customAgentId = this.getCustomAgentId();
|
|
40472
|
+
if (!customAgentId)
|
|
40473
|
+
return;
|
|
40474
|
+
eventPayload.customAgentId = customAgentId;
|
|
40475
|
+
const customAgentName = this.getCustomAgentName();
|
|
40476
|
+
if (customAgentName) {
|
|
40477
|
+
eventPayload.customAgentName = customAgentName;
|
|
40478
|
+
}
|
|
40479
|
+
}
|
|
40291
40480
|
setFilters(candidateFilter) {
|
|
40292
40481
|
if (!candidateFilter) {
|
|
40293
40482
|
this.privacyFilters = null;
|
|
@@ -40313,11 +40502,15 @@ class DOMConversation {
|
|
|
40313
40502
|
}
|
|
40314
40503
|
emit(eventType, eventPayload) {
|
|
40315
40504
|
eventPayload.conversationId = this.getConversationId();
|
|
40505
|
+
this.addCustomAgentInfo(eventPayload);
|
|
40316
40506
|
this._.each(this.listeners, (cb) => cb(eventType, eventPayload));
|
|
40317
40507
|
}
|
|
40318
40508
|
startStreamingEndTimer() {
|
|
40319
40509
|
this.stopStreamingEndTimer();
|
|
40320
|
-
this.streamingEndTimer = setTimeout$1(
|
|
40510
|
+
this.streamingEndTimer = setTimeout$1(() => {
|
|
40511
|
+
this.streamingEndTimer = null;
|
|
40512
|
+
this.onSubmissionEnd();
|
|
40513
|
+
}, STREAMING_END_SETTLE_MS);
|
|
40321
40514
|
}
|
|
40322
40515
|
stopStreamingEndTimer() {
|
|
40323
40516
|
if (!this.streamingEndTimer)
|
|
@@ -40325,6 +40518,19 @@ class DOMConversation {
|
|
|
40325
40518
|
clearTimeout(this.streamingEndTimer);
|
|
40326
40519
|
this.streamingEndTimer = null;
|
|
40327
40520
|
}
|
|
40521
|
+
startSubmissionStartRetryTimer(attempt) {
|
|
40522
|
+
this.stopSubmissionStartRetryTimer();
|
|
40523
|
+
this.submissionStartRetryTimer = setTimeout$1(() => {
|
|
40524
|
+
this.submissionStartRetryTimer = null;
|
|
40525
|
+
this.onSubmissionStart(attempt);
|
|
40526
|
+
}, SUBMISSION_START_RETRY_MS);
|
|
40527
|
+
}
|
|
40528
|
+
stopSubmissionStartRetryTimer() {
|
|
40529
|
+
if (!this.submissionStartRetryTimer)
|
|
40530
|
+
return;
|
|
40531
|
+
clearTimeout(this.submissionStartRetryTimer);
|
|
40532
|
+
this.submissionStartRetryTimer = null;
|
|
40533
|
+
}
|
|
40328
40534
|
suspend() {
|
|
40329
40535
|
this.isActive = false;
|
|
40330
40536
|
}
|
|
@@ -40339,6 +40545,7 @@ class DOMConversation {
|
|
|
40339
40545
|
this.reactionClickHandler = null;
|
|
40340
40546
|
}
|
|
40341
40547
|
this.stopStreamingEndTimer();
|
|
40548
|
+
this.stopSubmissionStartRetryTimer();
|
|
40342
40549
|
this.listeners = [];
|
|
40343
40550
|
}
|
|
40344
40551
|
}
|
|
@@ -41127,6 +41334,7 @@ function registerBuiltInPlugins() {
|
|
|
41127
41334
|
registerPlugin(EventProperties);
|
|
41128
41335
|
registerPlugin(FormValidation);
|
|
41129
41336
|
registerPlugin(FrustrationEvent);
|
|
41337
|
+
registerPlugin(GuideCachePlugin);
|
|
41130
41338
|
registerPlugin(IFrameMonitor);
|
|
41131
41339
|
registerPlugin(OemAccountId);
|
|
41132
41340
|
registerPlugin(P1GuidePlugin);
|
|
@@ -41381,20 +41589,20 @@ function getZoneSafeMethod(_, method, target) {
|
|
|
41381
41589
|
}
|
|
41382
41590
|
|
|
41383
41591
|
// Does not support submit and go to
|
|
41384
|
-
|
|
41385
|
-
|
|
41592
|
+
var goToRegex = new RegExp(guideMarkdownUtil.goToString);
|
|
41593
|
+
var PollBranching = {
|
|
41386
41594
|
name: 'PollBranching',
|
|
41387
|
-
script(step, guide, pendo) {
|
|
41388
|
-
|
|
41389
|
-
|
|
41595
|
+
script: function (step, guide, pendo) {
|
|
41596
|
+
var isAdvanceIntercepted = false;
|
|
41597
|
+
var branchingQuestions = initialBranchingSetup(step, pendo);
|
|
41390
41598
|
if (branchingQuestions) {
|
|
41391
41599
|
// If there are too many branching questions saved, exit and run the guide normally.
|
|
41392
41600
|
if (pendo._.size(branchingQuestions) > 1)
|
|
41393
41601
|
return;
|
|
41394
|
-
this.on('beforeAdvance', (evt)
|
|
41395
|
-
|
|
41396
|
-
|
|
41397
|
-
|
|
41602
|
+
this.on('beforeAdvance', function (evt) {
|
|
41603
|
+
var noResponseSelected = step.guideElement.find('[branching] .pendo-radio:checked').length === 0;
|
|
41604
|
+
var responseLabel = step.guideElement.find('[branching] .pendo-radio:checked + label')[0];
|
|
41605
|
+
var noGotoLabel;
|
|
41398
41606
|
if (responseLabel) {
|
|
41399
41607
|
noGotoLabel = pendo._.isNull(responseLabel.getAttribute('goToStep'));
|
|
41400
41608
|
}
|
|
@@ -41405,58 +41613,58 @@ const PollBranching = {
|
|
|
41405
41613
|
});
|
|
41406
41614
|
}
|
|
41407
41615
|
},
|
|
41408
|
-
test(step, guide, pendo) {
|
|
41616
|
+
test: function (step, guide, pendo) {
|
|
41409
41617
|
var _a;
|
|
41410
|
-
|
|
41618
|
+
var branchingQuestions = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find('._pendo-multi-choice-poll-question:contains("{branching/}")');
|
|
41411
41619
|
return !pendo._.isUndefined(branchingQuestions) && pendo._.size(branchingQuestions);
|
|
41412
41620
|
},
|
|
41413
|
-
designerListener(pendo) {
|
|
41414
|
-
|
|
41415
|
-
|
|
41621
|
+
designerListener: function (pendo) {
|
|
41622
|
+
var target = pendo.dom.getBody();
|
|
41623
|
+
var config = {
|
|
41416
41624
|
attributeFilter: ['data-layout'],
|
|
41417
41625
|
attributes: true,
|
|
41418
41626
|
childList: true,
|
|
41419
41627
|
characterData: true,
|
|
41420
41628
|
subtree: true
|
|
41421
41629
|
};
|
|
41422
|
-
|
|
41423
|
-
|
|
41630
|
+
var MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
|
|
41631
|
+
var observer = new MutationObserver(applyBranchingIndicators);
|
|
41424
41632
|
observer.observe(target, config);
|
|
41425
41633
|
function applyBranchingIndicators(mutations) {
|
|
41426
41634
|
pendo._.each(mutations, function (mutation) {
|
|
41427
41635
|
var _a;
|
|
41428
|
-
|
|
41636
|
+
var nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelector);
|
|
41429
41637
|
if (mutation.addedNodes.length && nodeHasQuerySelector) {
|
|
41430
41638
|
if (mutation.addedNodes[0].querySelector('._pendo-multi-choice-poll-select-border')) {
|
|
41431
41639
|
if (pendo._.size(pendo.dom('._pendo-multi-choice-poll-question:contains("{branching/}")'))) {
|
|
41432
41640
|
pendo
|
|
41433
41641
|
.dom('._pendo-multi-choice-poll-question:contains("{branching/}")')
|
|
41434
|
-
.each((question, index)
|
|
41435
|
-
pendo._.each(pendo.dom(
|
|
41642
|
+
.each(function (question, index) {
|
|
41643
|
+
pendo._.each(pendo.dom("#".concat(question.id, " *")), function (element) {
|
|
41436
41644
|
guideMarkdownUtil.removeMarkdownSyntax(element, '{branching/}', '', pendo);
|
|
41437
41645
|
});
|
|
41438
41646
|
pendo
|
|
41439
|
-
.dom(
|
|
41647
|
+
.dom("#".concat(question.id, " p"))
|
|
41440
41648
|
.css({ display: 'inline-block !important' })
|
|
41441
41649
|
.append(branchingIcon('#999', '20px'))
|
|
41442
41650
|
.attr({ title: 'Custom Branching Added' });
|
|
41443
|
-
|
|
41444
|
-
if (pendo.dom(
|
|
41651
|
+
var dataPendoPollId = question.getAttribute('data-pendo-poll-id');
|
|
41652
|
+
if (pendo.dom("._pendo-multi-choice-poll-question[data-pendo-poll-id=".concat(dataPendoPollId, "]"))[0]) {
|
|
41445
41653
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
41446
41654
|
pendo
|
|
41447
|
-
.dom(
|
|
41655
|
+
.dom("._pendo-multi-choice-poll-question[data-pendo-poll-id=".concat(dataPendoPollId, "]"))[0]
|
|
41448
41656
|
.textContent.trim();
|
|
41449
41657
|
}
|
|
41450
|
-
|
|
41658
|
+
var pollLabels = pendo.dom("label[for*=".concat(dataPendoPollId, "]"));
|
|
41451
41659
|
if (pendo._.size(pollLabels)) {
|
|
41452
|
-
pendo._.forEach(pollLabels, (label)
|
|
41660
|
+
pendo._.forEach(pollLabels, function (label) {
|
|
41453
41661
|
if (goToRegex.test(label.textContent)) {
|
|
41454
|
-
|
|
41662
|
+
var labelTitle = goToRegex.exec(label.textContent)[2];
|
|
41455
41663
|
guideMarkdownUtil.removeMarkdownSyntax(label, goToRegex, '', pendo);
|
|
41456
41664
|
pendo
|
|
41457
41665
|
.dom(label)
|
|
41458
41666
|
.append(branchingIcon('#999', '14px'))
|
|
41459
|
-
.attr({ title:
|
|
41667
|
+
.attr({ title: "Branching to step ".concat(labelTitle) });
|
|
41460
41668
|
}
|
|
41461
41669
|
});
|
|
41462
41670
|
}
|
|
@@ -41464,9 +41672,9 @@ const PollBranching = {
|
|
|
41464
41672
|
pendo
|
|
41465
41673
|
.dom(question)
|
|
41466
41674
|
.append(branchingErrorHTML(question.dataset.pendoPollId));
|
|
41467
|
-
pendo.dom(
|
|
41675
|
+
pendo.dom("#".concat(question.id, " #pendo-ps-branching-svg")).remove();
|
|
41468
41676
|
pendo
|
|
41469
|
-
.dom(
|
|
41677
|
+
.dom("#".concat(question.id, " p"))
|
|
41470
41678
|
.css({ display: 'inline-block !important' })
|
|
41471
41679
|
.append(branchingIcon('red', '20px'))
|
|
41472
41680
|
.attr({ title: 'Unsupported Branching configuration' });
|
|
@@ -41478,49 +41686,31 @@ const PollBranching = {
|
|
|
41478
41686
|
});
|
|
41479
41687
|
}
|
|
41480
41688
|
function branchingErrorHTML(dataPendoPollId) {
|
|
41481
|
-
return
|
|
41482
|
-
font-style: italic; margin-top: 0px;" class="branching-wrapper"
|
|
41483
|
-
name="${dataPendoPollId}">
|
|
41484
|
-
* Branching Error: Multiple branching polls not supported</div>`;
|
|
41689
|
+
return "<div style=\"text-align:lrft; font-size: 14px; color: red;\n font-style: italic; margin-top: 0px;\" class=\"branching-wrapper\"\n name=\"".concat(dataPendoPollId, "\">\n * Branching Error: Multiple branching polls not supported</div>");
|
|
41485
41690
|
}
|
|
41486
41691
|
function branchingIcon(color, size) {
|
|
41487
|
-
return
|
|
41488
|
-
style="margin-left: 5px;
|
|
41489
|
-
height:${size}; width:${size}; display:inline; vertical-align:middle;" xmlns="http://www.w3.org/2000/svg">
|
|
41490
|
-
<g stroke-width="0"></g>
|
|
41491
|
-
<g stroke-linecap="round" stroke-linejoin="round"></g>
|
|
41492
|
-
<g> <circle cx="4" cy="7" r="2" stroke="${color}"
|
|
41493
|
-
stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></circle>
|
|
41494
|
-
<circle cx="20" cy="7" r="2" stroke="${color}"
|
|
41495
|
-
stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></circle>
|
|
41496
|
-
<circle cx="20" cy="17" r="2" stroke="${color}" stroke-width="2"
|
|
41497
|
-
stroke-linecap="round" stroke-linejoin="round"></circle>
|
|
41498
|
-
<path d="M18 7H6" stroke="${color}" stroke-width="2"
|
|
41499
|
-
stroke-linecap="round" stroke-linejoin="round"></path>
|
|
41500
|
-
<path d="M7 7V7C8.65685 7 10 8.34315 10 10V15C10 16.1046 10.8954 17 12 17H18"
|
|
41501
|
-
stroke="${color}" stroke-width="2" stroke-linecap="round"
|
|
41502
|
-
stroke-linejoin="round"></path> </g></svg>`;
|
|
41692
|
+
return "<svg id=\"pendo-ps-branching-svg\" viewBox=\"0 0 24 24\" fill=\"none\"\n style=\"margin-left: 5px;\n height:".concat(size, "; width:").concat(size, "; display:inline; vertical-align:middle;\" xmlns=\"http://www.w3.org/2000/svg\">\n <g stroke-width=\"0\"></g>\n <g stroke-linecap=\"round\" stroke-linejoin=\"round\"></g>\n <g> <circle cx=\"4\" cy=\"7\" r=\"2\" stroke=\"").concat(color, "\"\n stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></circle>\n <circle cx=\"20\" cy=\"7\" r=\"2\" stroke=\"").concat(color, "\"\n stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></circle>\n <circle cx=\"20\" cy=\"17\" r=\"2\" stroke=\"").concat(color, "\" stroke-width=\"2\"\n stroke-linecap=\"round\" stroke-linejoin=\"round\"></circle>\n <path d=\"M18 7H6\" stroke=\"").concat(color, "\" stroke-width=\"2\"\n stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>\n <path d=\"M7 7V7C8.65685 7 10 8.34315 10 10V15C10 16.1046 10.8954 17 12 17H18\"\n stroke=\"").concat(color, "\" stroke-width=\"2\" stroke-linecap=\"round\"\n stroke-linejoin=\"round\"></path> </g></svg>");
|
|
41503
41693
|
}
|
|
41504
41694
|
}
|
|
41505
41695
|
};
|
|
41506
41696
|
function initialBranchingSetup(step, pendo) {
|
|
41507
|
-
|
|
41508
|
-
pendo._.forEach(questions, (question)
|
|
41509
|
-
|
|
41510
|
-
pendo._.each(step.guideElement.find(
|
|
41697
|
+
var questions = step.guideElement.find('._pendo-multi-choice-poll-question:contains("{branching/}")');
|
|
41698
|
+
pendo._.forEach(questions, function (question) {
|
|
41699
|
+
var dataPendoPollId = question.getAttribute('data-pendo-poll-id');
|
|
41700
|
+
pendo._.each(step.guideElement.find("#".concat(question.id, " *")), function (element) {
|
|
41511
41701
|
guideMarkdownUtil.removeMarkdownSyntax(element, '{branching/}', '', pendo);
|
|
41512
41702
|
});
|
|
41513
|
-
|
|
41514
|
-
pendo._.forEach(pollLabels, (label)
|
|
41703
|
+
var pollLabels = step.guideElement.find("label[for*=".concat(dataPendoPollId, "]"));
|
|
41704
|
+
pendo._.forEach(pollLabels, function (label) {
|
|
41515
41705
|
if (pendo._.isNull(goToRegex.exec(label.textContent))) {
|
|
41516
41706
|
return;
|
|
41517
41707
|
}
|
|
41518
|
-
|
|
41519
|
-
|
|
41708
|
+
var gotoSubstring = goToRegex.exec(label.textContent)[1];
|
|
41709
|
+
var gotoIndex = goToRegex.exec(label.textContent)[2];
|
|
41520
41710
|
label.setAttribute('goToStep', gotoIndex);
|
|
41521
41711
|
guideMarkdownUtil.removeMarkdownSyntax(label, gotoSubstring, '', pendo);
|
|
41522
41712
|
});
|
|
41523
|
-
|
|
41713
|
+
var pollChoiceContainer = step.guideElement.find("[data-pendo-poll-id=".concat(dataPendoPollId, "]._pendo-multi-choice-poll-select-border"));
|
|
41524
41714
|
if (pollChoiceContainer && pollChoiceContainer.length) {
|
|
41525
41715
|
pollChoiceContainer[0].setAttribute('branching', '');
|
|
41526
41716
|
}
|
|
@@ -41529,15 +41719,15 @@ function initialBranchingSetup(step, pendo) {
|
|
|
41529
41719
|
}
|
|
41530
41720
|
function branchingGoToStep(event, step, guide, pendo) {
|
|
41531
41721
|
var _a;
|
|
41532
|
-
|
|
41533
|
-
|
|
41534
|
-
|
|
41535
|
-
|
|
41722
|
+
var checkedPollInputId = (_a = step.guideElement.find('[branching] input.pendo-radio[data-pendo-poll-id]:checked')[0]) === null || _a === void 0 ? void 0 : _a.id;
|
|
41723
|
+
var checkedPollLabel = step.guideElement.find("label[for=\"".concat(checkedPollInputId, "\"]"))[0];
|
|
41724
|
+
var checkedPollLabelStepIndex = checkedPollLabel === null || checkedPollLabel === void 0 ? void 0 : checkedPollLabel.getAttribute('goToStep');
|
|
41725
|
+
var pollStepIndex = checkedPollLabelStepIndex - 1;
|
|
41536
41726
|
if (pollStepIndex < 0)
|
|
41537
41727
|
return;
|
|
41538
|
-
|
|
41728
|
+
var destinationObject = {
|
|
41539
41729
|
destinationStepId: guide.steps[pollStepIndex].id,
|
|
41540
|
-
step
|
|
41730
|
+
step: step
|
|
41541
41731
|
};
|
|
41542
41732
|
pendo.goToStep(destinationObject);
|
|
41543
41733
|
event.cancel = true;
|
|
@@ -41853,7 +42043,10 @@ const RequiredQuestions = {
|
|
|
41853
42043
|
});
|
|
41854
42044
|
}
|
|
41855
42045
|
function getEligibleQuestions() {
|
|
41856
|
-
const
|
|
42046
|
+
const pollQuestions = pendo._.toArray(step.guideElement.find(`[class*=-poll-question]:contains(${requiredSyntax})`));
|
|
42047
|
+
const surveyMatches = pendo._.toArray(step.guideElement.find(`[data-pendo-poll-id]:contains(${requiredSyntax})`));
|
|
42048
|
+
const surveyQuestions = pendo._.filter(surveyMatches, (candidate) => !pendo._.some(surveyMatches, (other) => other !== candidate && candidate.contains(other)));
|
|
42049
|
+
const allQuestions = pendo._.uniq(pollQuestions.concat(surveyQuestions));
|
|
41857
42050
|
return pendo._.reduce(allQuestions, (eligibleQuestions, question) => {
|
|
41858
42051
|
if (question.classList.contains('_pendo-yes-no-poll-question'))
|
|
41859
42052
|
return eligibleQuestions;
|
|
@@ -41861,16 +42054,30 @@ const RequiredQuestions = {
|
|
|
41861
42054
|
return eligibleQuestions;
|
|
41862
42055
|
}, []);
|
|
41863
42056
|
}
|
|
42057
|
+
function ownsRequiredText(element) {
|
|
42058
|
+
return pendo._.some(element.childNodes, (node) => node.nodeType === 3 && node.nodeValue && node.nodeValue.indexOf(requiredSyntax) !== -1);
|
|
42059
|
+
}
|
|
41864
42060
|
function processRequiredQuestions() {
|
|
41865
42061
|
let questions = getEligibleQuestions();
|
|
41866
42062
|
if (questions) {
|
|
41867
42063
|
pendo._.forEach(questions, question => {
|
|
41868
42064
|
let dataPendoPollId = question.getAttribute('data-pendo-poll-id');
|
|
41869
42065
|
requiredPollIds.push(dataPendoPollId);
|
|
41870
|
-
|
|
42066
|
+
const candidates = step.guideElement.find(`#${question.id} *, #${question.id}`);
|
|
42067
|
+
const textHost = pendo._.find(candidates, ownsRequiredText) || question;
|
|
42068
|
+
pendo._.each(candidates, (element) => {
|
|
41871
42069
|
guideMarkdownUtil.removeMarkdownSyntax(element, requiredSyntax, '', pendo);
|
|
41872
42070
|
});
|
|
41873
|
-
|
|
42071
|
+
const textHostEl = pendo.dom(textHost);
|
|
42072
|
+
if (textHostEl.find('._pendo-required-indicator').length === 0) {
|
|
42073
|
+
const questionParagraph = textHostEl.find('p');
|
|
42074
|
+
if (questionParagraph && questionParagraph.length) {
|
|
42075
|
+
pendo.dom(questionParagraph[0]).append(requiredElement);
|
|
42076
|
+
}
|
|
42077
|
+
else {
|
|
42078
|
+
textHostEl.append(requiredElement);
|
|
42079
|
+
}
|
|
42080
|
+
}
|
|
41874
42081
|
});
|
|
41875
42082
|
}
|
|
41876
42083
|
if (pendo._.size(requiredPollIds)) {
|
|
@@ -41934,9 +42141,11 @@ const RequiredQuestions = {
|
|
|
41934
42141
|
}
|
|
41935
42142
|
},
|
|
41936
42143
|
test(step, guide, pendo) {
|
|
41937
|
-
var _a;
|
|
41938
|
-
|
|
41939
|
-
|
|
42144
|
+
var _a, _b;
|
|
42145
|
+
const pollQuestions = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find(`[class*=-poll-question]:contains(${requiredSyntax})`);
|
|
42146
|
+
const surveyQuestions = (_b = step.guideElement) === null || _b === void 0 ? void 0 : _b.find(`[data-pendo-poll-id]:contains(${requiredSyntax})`);
|
|
42147
|
+
return (!pendo._.isUndefined(pollQuestions) && pendo._.size(pollQuestions)) ||
|
|
42148
|
+
(!pendo._.isUndefined(surveyQuestions) && pendo._.size(surveyQuestions));
|
|
41940
42149
|
},
|
|
41941
42150
|
designerListener(pendo) {
|
|
41942
42151
|
const requiredQuestions = [];
|
|
@@ -41956,7 +42165,7 @@ const RequiredQuestions = {
|
|
|
41956
42165
|
var _a;
|
|
41957
42166
|
const nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll);
|
|
41958
42167
|
if (mutation.addedNodes.length && nodeHasQuerySelector) {
|
|
41959
|
-
let eligiblePolls = mutation.addedNodes[0].querySelectorAll('[class*=-poll-wrapper], [class*=-poll-select-border]');
|
|
42168
|
+
let eligiblePolls = mutation.addedNodes[0].querySelectorAll('[class*=-poll-wrapper], [class*=-poll-select-border], [id^=survey-item-wrapper__]');
|
|
41960
42169
|
if (eligiblePolls) {
|
|
41961
42170
|
pendo._.each(eligiblePolls, function (poll) {
|
|
41962
42171
|
let dataPendoPollId;
|
|
@@ -41968,11 +42177,12 @@ const RequiredQuestions = {
|
|
|
41968
42177
|
dataPendoPollId = poll.getAttribute('data-pendo-poll-id');
|
|
41969
42178
|
}
|
|
41970
42179
|
let questionText;
|
|
41971
|
-
const
|
|
41972
|
-
|
|
41973
|
-
|
|
42180
|
+
const questionElement = pendo.dom(`[class*="-poll-question"][data-pendo-poll-id=${dataPendoPollId}]`)[0] ||
|
|
42181
|
+
pendo.dom(`.bb-text[data-pendo-poll-id=${dataPendoPollId}]`)[0];
|
|
42182
|
+
if (questionElement) {
|
|
42183
|
+
questionText = questionElement.textContent;
|
|
41974
42184
|
}
|
|
41975
|
-
const requiredSyntaxIndex = questionText.indexOf(requiredSyntax);
|
|
42185
|
+
const requiredSyntaxIndex = questionText ? questionText.indexOf(requiredSyntax) : -1;
|
|
41976
42186
|
if (requiredSyntaxIndex > -1) {
|
|
41977
42187
|
pendo._.each(pendo.dom(`[data-pendo-poll-id=${dataPendoPollId}]:not(.pendo-radio)`), (element) => {
|
|
41978
42188
|
pendo._.each(pendo.dom(`#${element.id} *:not(".pendo-radio"), #${element.id}:not(".pendo-radio")`), (item) => {
|
|
@@ -49486,6 +49696,17 @@ var SessionRecorderBuffer = /** @class */ (function () {
|
|
|
49486
49696
|
return SessionRecorderBuffer;
|
|
49487
49697
|
}());
|
|
49488
49698
|
|
|
49699
|
+
var __assign = function() {
|
|
49700
|
+
__assign = Object.assign || function __assign(t) {
|
|
49701
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
49702
|
+
s = arguments[i];
|
|
49703
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
49704
|
+
}
|
|
49705
|
+
return t;
|
|
49706
|
+
};
|
|
49707
|
+
return __assign.apply(this, arguments);
|
|
49708
|
+
};
|
|
49709
|
+
|
|
49489
49710
|
function __rest(s, e) {
|
|
49490
49711
|
var t = {};
|
|
49491
49712
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -49718,6 +49939,8 @@ function shouldMask(node, options) {
|
|
|
49718
49939
|
var el = isElementNode(node) ? node : node.parentElement;
|
|
49719
49940
|
if (el === null)
|
|
49720
49941
|
return false;
|
|
49942
|
+
if ((el.tagName || '').toUpperCase() === 'STYLE')
|
|
49943
|
+
return false;
|
|
49721
49944
|
var maskDistance = -1;
|
|
49722
49945
|
var unmaskDistance = -1;
|
|
49723
49946
|
if (maskAllText) {
|
|
@@ -51648,7 +51871,7 @@ function includes(str, substring) {
|
|
|
51648
51871
|
function getResourceType(blockedURI, directive) {
|
|
51649
51872
|
if (!directive || typeof directive !== 'string')
|
|
51650
51873
|
return 'resource';
|
|
51651
|
-
|
|
51874
|
+
var d = directive.toLowerCase();
|
|
51652
51875
|
if (blockedURI === 'inline') {
|
|
51653
51876
|
if (includes(d, 'script-src-attr')) {
|
|
51654
51877
|
return 'inline event handler';
|
|
@@ -51707,11 +51930,12 @@ function getResourceType(blockedURI, directive) {
|
|
|
51707
51930
|
function getDirective(policy, directiveName) {
|
|
51708
51931
|
if (!policy || !directiveName)
|
|
51709
51932
|
return '';
|
|
51710
|
-
|
|
51711
|
-
for (
|
|
51712
|
-
|
|
51713
|
-
|
|
51714
|
-
|
|
51933
|
+
var needle = directiveName.toLowerCase();
|
|
51934
|
+
for (var _i = 0, _a = policy.split(';'); _i < _a.length; _i++) {
|
|
51935
|
+
var directive = _a[_i];
|
|
51936
|
+
var trimmed = directive.trim();
|
|
51937
|
+
var lower = trimmed.toLowerCase();
|
|
51938
|
+
if (lower === needle || lower.startsWith("".concat(needle, " "))) {
|
|
51715
51939
|
return trimmed;
|
|
51716
51940
|
}
|
|
51717
51941
|
}
|
|
@@ -51733,7 +51957,7 @@ function getDirective(policy, directiveName) {
|
|
|
51733
51957
|
function getArticle(phrase) {
|
|
51734
51958
|
if (!phrase || typeof phrase !== 'string')
|
|
51735
51959
|
return 'A';
|
|
51736
|
-
|
|
51960
|
+
var c = phrase.trim().charAt(0).toLowerCase();
|
|
51737
51961
|
return includes('aeiou', c) ? 'An' : 'A';
|
|
51738
51962
|
}
|
|
51739
51963
|
/**
|
|
@@ -51776,46 +52000,47 @@ function createCspViolationMessage(blockedURI, directive, isReportOnly, original
|
|
|
51776
52000
|
return 'Content Security Policy: Unknown violation occurred.';
|
|
51777
52001
|
}
|
|
51778
52002
|
try {
|
|
51779
|
-
|
|
52003
|
+
var reportOnlyText = isReportOnly ? ' (Report-Only)' : '';
|
|
51780
52004
|
// special case for frame-ancestors since it doesn't fit our template at all
|
|
51781
52005
|
if ((directive === null || directive === void 0 ? void 0 : directive.toLowerCase()) === 'frame-ancestors') {
|
|
51782
|
-
return
|
|
52006
|
+
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, "\".");
|
|
51783
52007
|
}
|
|
51784
|
-
|
|
51785
|
-
|
|
51786
|
-
|
|
51787
|
-
|
|
51788
|
-
|
|
51789
|
-
|
|
51790
|
-
return
|
|
52008
|
+
var resourceType = getResourceType(blockedURI, directive);
|
|
52009
|
+
var article = getArticle(resourceType);
|
|
52010
|
+
var source = formatBlockedUri(blockedURI);
|
|
52011
|
+
var directiveValue = getDirective(originalPolicy, directive);
|
|
52012
|
+
var policyDisplay = directiveValue || directive;
|
|
52013
|
+
var resourceDescription = "".concat(article, " ").concat(resourceType).concat(source ? " from ".concat(source) : '');
|
|
52014
|
+
return "Content Security Policy".concat(reportOnlyText, ": ").concat(resourceDescription, " was blocked by your site's `").concat(policyDisplay, "` policy.\nCurrent CSP: \"").concat(originalPolicy, "\".");
|
|
51791
52015
|
}
|
|
51792
52016
|
catch (error) {
|
|
51793
|
-
return
|
|
52017
|
+
return "Content Security Policy: Error formatting violation message: ".concat(error.message);
|
|
51794
52018
|
}
|
|
51795
52019
|
}
|
|
51796
52020
|
|
|
51797
|
-
|
|
51798
|
-
|
|
52021
|
+
var MAX_LENGTH = 1000;
|
|
52022
|
+
var PII_PATTERN = {
|
|
51799
52023
|
ip: /\b(?:\d{1,3}\.){3}\d{1,3}\b/g,
|
|
51800
52024
|
ssn: /\b\d{3}-\d{2}-\d{4}\b/g,
|
|
51801
52025
|
creditCard: /\b(?:\d[ -]?){12,18}\d\b/g,
|
|
51802
52026
|
httpsUrls: /https:\/\/[^\s]+/g,
|
|
51803
52027
|
email: /[\w._+-]+@[\w.-]+\.\w+/g
|
|
51804
52028
|
};
|
|
51805
|
-
|
|
51806
|
-
|
|
51807
|
-
|
|
51808
|
-
|
|
51809
|
-
|
|
52029
|
+
var PII_REPLACEMENT = '*'.repeat(10);
|
|
52030
|
+
var JSON_PII_KEYS = ['password', 'email', 'key', 'token', 'auth', 'authentication', 'phone', 'address', 'ssn'];
|
|
52031
|
+
var UNABLE_TO_DISPLAY_BODY = '[Unable to display body: detected PII could not be redacted]';
|
|
52032
|
+
var joinedKeys = JSON_PII_KEYS.join('|');
|
|
52033
|
+
var keyPattern = "\"([^\"]*(?:".concat(joinedKeys, ")[^\"]*)\"");
|
|
51810
52034
|
// only scrub strings, numbers, and booleans
|
|
51811
|
-
|
|
52035
|
+
var acceptedValues = '("([^"\\\\]*(?:\\\\.[^"\\\\]*)*")|(\\d+)|(true|false))';
|
|
51812
52036
|
/**
|
|
51813
52037
|
* Truncates a string to the max length
|
|
51814
52038
|
* @access private
|
|
51815
52039
|
* @param {String} string
|
|
51816
52040
|
* @returns {String}
|
|
51817
52041
|
*/
|
|
51818
|
-
function truncate(string, includeEllipsis
|
|
52042
|
+
function truncate(string, includeEllipsis) {
|
|
52043
|
+
if (includeEllipsis === void 0) { includeEllipsis = false; }
|
|
51819
52044
|
if (string.length <= MAX_LENGTH)
|
|
51820
52045
|
return string;
|
|
51821
52046
|
if (includeEllipsis) {
|
|
@@ -51832,7 +52057,7 @@ function truncate(string, includeEllipsis = false) {
|
|
|
51832
52057
|
* @returns {String}
|
|
51833
52058
|
*/
|
|
51834
52059
|
function generateLogKey(methodName, message, stackTrace) {
|
|
51835
|
-
return
|
|
52060
|
+
return "".concat(methodName, "|").concat(message, "|").concat(stackTrace);
|
|
51836
52061
|
}
|
|
51837
52062
|
/**
|
|
51838
52063
|
* Checks if a string has 2 or more digits, a https URL, or an email address
|
|
@@ -51849,12 +52074,13 @@ function mightContainPII(string) {
|
|
|
51849
52074
|
* @param {String} string
|
|
51850
52075
|
* @returns {String}
|
|
51851
52076
|
*/
|
|
51852
|
-
function scrubPII(
|
|
52077
|
+
function scrubPII(_a) {
|
|
52078
|
+
var string = _a.string, _ = _a._;
|
|
51853
52079
|
if (!string || typeof string !== 'string')
|
|
51854
52080
|
return string;
|
|
51855
52081
|
if (!mightContainPII(string))
|
|
51856
52082
|
return string;
|
|
51857
|
-
return _.reduce(_.values(PII_PATTERN), (str, pattern)
|
|
52083
|
+
return _.reduce(_.values(PII_PATTERN), function (str, pattern) { return str.replace(pattern, PII_REPLACEMENT); }, string);
|
|
51858
52084
|
}
|
|
51859
52085
|
/**
|
|
51860
52086
|
* Scrub PII from a stringified JSON object
|
|
@@ -51863,12 +52089,14 @@ function scrubPII({ string, _ }) {
|
|
|
51863
52089
|
* @returns {String}
|
|
51864
52090
|
*/
|
|
51865
52091
|
function scrubJsonPII(string) {
|
|
51866
|
-
|
|
52092
|
+
var fullScrubRegex = new RegExp("".concat(keyPattern, "\\s*:\\s*[\\{\\[]"), 'i');
|
|
51867
52093
|
if (fullScrubRegex.test(string)) {
|
|
51868
52094
|
return UNABLE_TO_DISPLAY_BODY;
|
|
51869
52095
|
}
|
|
51870
|
-
|
|
51871
|
-
return string.replace(keyValueScrubRegex, (match, key)
|
|
52096
|
+
var keyValueScrubRegex = new RegExp("".concat(keyPattern, "\\s*:\\s*").concat(acceptedValues), 'gi');
|
|
52097
|
+
return string.replace(keyValueScrubRegex, function (match, key) {
|
|
52098
|
+
return "\"".concat(key, "\":\"").concat(PII_REPLACEMENT, "\"");
|
|
52099
|
+
});
|
|
51872
52100
|
}
|
|
51873
52101
|
/**
|
|
51874
52102
|
* Checks if a string is a JSON object
|
|
@@ -51880,7 +52108,7 @@ function scrubJsonPII(string) {
|
|
|
51880
52108
|
function mightContainJson(string, contentType) {
|
|
51881
52109
|
if (!string || typeof string !== 'string')
|
|
51882
52110
|
return false;
|
|
51883
|
-
|
|
52111
|
+
var firstChar = string.charAt(0);
|
|
51884
52112
|
if (contentType && contentType.indexOf('application/json') !== -1) {
|
|
51885
52113
|
return true;
|
|
51886
52114
|
}
|
|
@@ -51893,19 +52121,20 @@ function mightContainJson(string, contentType) {
|
|
|
51893
52121
|
* @param {String} contentType
|
|
51894
52122
|
* @returns {String}
|
|
51895
52123
|
*/
|
|
51896
|
-
function maskSensitiveFields(
|
|
52124
|
+
function maskSensitiveFields(_a) {
|
|
52125
|
+
var string = _a.string, contentType = _a.contentType, _ = _a._;
|
|
51897
52126
|
if (!string || typeof string !== 'string')
|
|
51898
52127
|
return string;
|
|
51899
52128
|
if (mightContainJson(string, contentType)) {
|
|
51900
52129
|
string = scrubJsonPII(string);
|
|
51901
52130
|
}
|
|
51902
52131
|
if (mightContainPII(string)) {
|
|
51903
|
-
string = scrubPII({ string, _ });
|
|
52132
|
+
string = scrubPII({ string: string, _: _ });
|
|
51904
52133
|
}
|
|
51905
52134
|
return string;
|
|
51906
52135
|
}
|
|
51907
52136
|
|
|
51908
|
-
|
|
52137
|
+
var DEV_LOG_TYPE = 'devlog';
|
|
51909
52138
|
function createDevLogEnvelope(pluginAPI, globalPendo) {
|
|
51910
52139
|
return {
|
|
51911
52140
|
browser_time: pluginAPI.util.getNow(),
|
|
@@ -51916,12 +52145,12 @@ function createDevLogEnvelope(pluginAPI, globalPendo) {
|
|
|
51916
52145
|
};
|
|
51917
52146
|
}
|
|
51918
52147
|
|
|
51919
|
-
|
|
51920
|
-
|
|
51921
|
-
|
|
51922
|
-
|
|
51923
|
-
|
|
51924
|
-
|
|
52148
|
+
var TOKEN_MAX_SIZE = 100;
|
|
52149
|
+
var TOKEN_REFILL_RATE = 10;
|
|
52150
|
+
var TOKEN_REFRESH_INTERVAL = 1000;
|
|
52151
|
+
var MAX_UNCOMPRESSED_SIZE = 125000; // 125KB
|
|
52152
|
+
var DevlogBuffer = /** @class */ (function () {
|
|
52153
|
+
function DevlogBuffer(pendo, pluginAPI) {
|
|
51925
52154
|
this.pendo = pendo;
|
|
51926
52155
|
this.pluginAPI = pluginAPI;
|
|
51927
52156
|
this.events = [];
|
|
@@ -51932,36 +52161,36 @@ class DevlogBuffer {
|
|
|
51932
52161
|
this.lastRefillTime = this.pluginAPI.util.getNow();
|
|
51933
52162
|
this.nextRefillTime = this.lastRefillTime + TOKEN_REFRESH_INTERVAL;
|
|
51934
52163
|
}
|
|
51935
|
-
isEmpty() {
|
|
52164
|
+
DevlogBuffer.prototype.isEmpty = function () {
|
|
51936
52165
|
return this.events.length === 0 && this.payloads.length === 0;
|
|
51937
|
-
}
|
|
51938
|
-
refillTokens() {
|
|
51939
|
-
|
|
52166
|
+
};
|
|
52167
|
+
DevlogBuffer.prototype.refillTokens = function () {
|
|
52168
|
+
var now = this.pluginAPI.util.getNow();
|
|
51940
52169
|
if (now >= this.nextRefillTime) {
|
|
51941
|
-
|
|
51942
|
-
|
|
51943
|
-
|
|
52170
|
+
var timeSinceLastRefill = now - this.lastRefillTime;
|
|
52171
|
+
var secondsSinceLastRefill = Math.floor(timeSinceLastRefill / TOKEN_REFRESH_INTERVAL);
|
|
52172
|
+
var tokensToRefill = secondsSinceLastRefill * TOKEN_REFILL_RATE;
|
|
51944
52173
|
this.tokens = Math.min(this.tokens + tokensToRefill, TOKEN_MAX_SIZE);
|
|
51945
52174
|
this.lastRefillTime = now;
|
|
51946
52175
|
this.nextRefillTime = now + TOKEN_REFRESH_INTERVAL;
|
|
51947
52176
|
}
|
|
51948
|
-
}
|
|
51949
|
-
clear() {
|
|
52177
|
+
};
|
|
52178
|
+
DevlogBuffer.prototype.clear = function () {
|
|
51950
52179
|
this.events = [];
|
|
51951
52180
|
this.lastEvent = null;
|
|
51952
52181
|
this.uncompressedSize = 0;
|
|
51953
|
-
}
|
|
51954
|
-
hasTokenAvailable() {
|
|
52182
|
+
};
|
|
52183
|
+
DevlogBuffer.prototype.hasTokenAvailable = function () {
|
|
51955
52184
|
this.refillTokens();
|
|
51956
52185
|
return this.tokens > 0;
|
|
51957
|
-
}
|
|
51958
|
-
estimateEventSize(event) {
|
|
52186
|
+
};
|
|
52187
|
+
DevlogBuffer.prototype.estimateEventSize = function (event) {
|
|
51959
52188
|
return JSON.stringify(event).length;
|
|
51960
|
-
}
|
|
51961
|
-
push(event) {
|
|
52189
|
+
};
|
|
52190
|
+
DevlogBuffer.prototype.push = function (event) {
|
|
51962
52191
|
if (!this.hasTokenAvailable())
|
|
51963
52192
|
return false;
|
|
51964
|
-
|
|
52193
|
+
var eventSize = this.estimateEventSize(event);
|
|
51965
52194
|
if (this.uncompressedSize + eventSize > MAX_UNCOMPRESSED_SIZE) {
|
|
51966
52195
|
this.compressCurrentChunk();
|
|
51967
52196
|
}
|
|
@@ -51970,54 +52199,55 @@ class DevlogBuffer {
|
|
|
51970
52199
|
this.events.push(event);
|
|
51971
52200
|
this.tokens = Math.max(this.tokens - 1, 0);
|
|
51972
52201
|
return true;
|
|
51973
|
-
}
|
|
51974
|
-
compressCurrentChunk() {
|
|
52202
|
+
};
|
|
52203
|
+
DevlogBuffer.prototype.compressCurrentChunk = function () {
|
|
51975
52204
|
if (this.events.length === 0)
|
|
51976
52205
|
return;
|
|
51977
|
-
|
|
52206
|
+
var jzb = this.pendo.compress(this.events);
|
|
51978
52207
|
this.payloads.push(jzb);
|
|
51979
52208
|
this.clear();
|
|
51980
|
-
}
|
|
51981
|
-
generateUrl() {
|
|
51982
|
-
|
|
52209
|
+
};
|
|
52210
|
+
DevlogBuffer.prototype.generateUrl = function () {
|
|
52211
|
+
var queryParams = {
|
|
51983
52212
|
v: this.pendo.VERSION,
|
|
51984
52213
|
ct: this.pluginAPI.util.getNow()
|
|
51985
52214
|
};
|
|
51986
52215
|
return this.pluginAPI.transmit.buildBaseDataUrl(DEV_LOG_TYPE, this.pendo.apiKey, queryParams);
|
|
51987
|
-
}
|
|
51988
|
-
pack() {
|
|
52216
|
+
};
|
|
52217
|
+
DevlogBuffer.prototype.pack = function () {
|
|
51989
52218
|
if (this.isEmpty())
|
|
51990
52219
|
return;
|
|
51991
|
-
|
|
52220
|
+
var url = this.generateUrl();
|
|
51992
52221
|
this.compressCurrentChunk();
|
|
51993
|
-
|
|
51994
|
-
jzb,
|
|
51995
|
-
url
|
|
51996
|
-
}));
|
|
52222
|
+
var payloads = this.pendo._.map(this.payloads, function (jzb) { return ({
|
|
52223
|
+
jzb: jzb,
|
|
52224
|
+
url: url
|
|
52225
|
+
}); });
|
|
51997
52226
|
this.payloads = [];
|
|
51998
52227
|
return payloads;
|
|
51999
|
-
}
|
|
52000
|
-
|
|
52228
|
+
};
|
|
52229
|
+
return DevlogBuffer;
|
|
52230
|
+
}());
|
|
52001
52231
|
|
|
52002
|
-
|
|
52003
|
-
|
|
52232
|
+
var DevlogTransport = /** @class */ (function () {
|
|
52233
|
+
function DevlogTransport(globalPendo, pluginAPI) {
|
|
52004
52234
|
this.pendo = globalPendo;
|
|
52005
52235
|
this.pluginAPI = pluginAPI;
|
|
52006
52236
|
}
|
|
52007
|
-
buildGetUrl(baseUrl, jzb) {
|
|
52008
|
-
|
|
52237
|
+
DevlogTransport.prototype.buildGetUrl = function (baseUrl, jzb) {
|
|
52238
|
+
var params = {};
|
|
52009
52239
|
if (this.pluginAPI.agent.treatAsAdoptPartner()) {
|
|
52010
52240
|
this.pluginAPI.agent.addAccountIdParams(params, this.pendo.get_account_id(), this.pluginAPI.ConfigReader.get('oemAccountId'));
|
|
52011
52241
|
}
|
|
52012
|
-
|
|
52242
|
+
var jwtOptions = this.pluginAPI.agent.getJwtInfoCopy();
|
|
52013
52243
|
if (!this.pendo._.isEmpty(jwtOptions)) {
|
|
52014
52244
|
this.pendo._.extend(params, jwtOptions);
|
|
52015
52245
|
}
|
|
52016
52246
|
params.jzb = jzb;
|
|
52017
|
-
|
|
52018
|
-
return
|
|
52019
|
-
}
|
|
52020
|
-
get(url, options) {
|
|
52247
|
+
var queryString = this.pendo._.map(params, function (value, key) { return "".concat(key, "=").concat(value); }).join('&');
|
|
52248
|
+
return "".concat(baseUrl).concat(baseUrl.indexOf('?') !== -1 ? '&' : '?').concat(queryString);
|
|
52249
|
+
};
|
|
52250
|
+
DevlogTransport.prototype.get = function (url, options) {
|
|
52021
52251
|
options.method = 'GET';
|
|
52022
52252
|
if (this.pluginAPI.transmit.fetchKeepalive.supported()) {
|
|
52023
52253
|
return this.pluginAPI.transmit.fetchKeepalive(url, options);
|
|
@@ -52025,86 +52255,90 @@ class DevlogTransport {
|
|
|
52025
52255
|
else {
|
|
52026
52256
|
return this.pendo.ajax.get(url);
|
|
52027
52257
|
}
|
|
52028
|
-
}
|
|
52029
|
-
sendRequestWithGet
|
|
52030
|
-
|
|
52258
|
+
};
|
|
52259
|
+
DevlogTransport.prototype.sendRequestWithGet = function (_a) {
|
|
52260
|
+
var url = _a.url, jzb = _a.jzb;
|
|
52261
|
+
var getUrl = this.buildGetUrl(url, jzb);
|
|
52031
52262
|
return this.get(getUrl, {
|
|
52032
52263
|
headers: {
|
|
52033
52264
|
'Content-Type': 'application/octet-stream'
|
|
52034
52265
|
}
|
|
52035
52266
|
});
|
|
52036
|
-
}
|
|
52037
|
-
post(url, options) {
|
|
52267
|
+
};
|
|
52268
|
+
DevlogTransport.prototype.post = function (url, options) {
|
|
52038
52269
|
options.method = 'POST';
|
|
52039
52270
|
if (options.keepalive && this.pluginAPI.transmit.fetchKeepalive.supported()) {
|
|
52040
52271
|
return this.pluginAPI.transmit.fetchKeepalive(url, options);
|
|
52041
52272
|
}
|
|
52042
52273
|
else if (options.keepalive && this.pluginAPI.transmit.sendBeacon.supported()) {
|
|
52043
|
-
|
|
52274
|
+
var result = this.pluginAPI.transmit.sendBeacon(url, new Blob([options.body]));
|
|
52044
52275
|
return result ? Promise$2.resolve() : Promise$2.reject(new Error('sendBeacon failed to send devlog data'));
|
|
52045
52276
|
}
|
|
52046
52277
|
else {
|
|
52047
52278
|
return this.pendo.ajax.post(url, options.body);
|
|
52048
52279
|
}
|
|
52049
|
-
}
|
|
52050
|
-
sendRequestWithPost
|
|
52051
|
-
|
|
52052
|
-
|
|
52280
|
+
};
|
|
52281
|
+
DevlogTransport.prototype.sendRequestWithPost = function (_a, isUnload) {
|
|
52282
|
+
var url = _a.url, jzb = _a.jzb;
|
|
52283
|
+
var jwtOptions = this.pluginAPI.agent.getJwtInfoCopy();
|
|
52284
|
+
var bodyPayload = {
|
|
52053
52285
|
events: jzb,
|
|
52054
52286
|
browser_time: this.pluginAPI.util.getNow()
|
|
52055
52287
|
};
|
|
52056
52288
|
if (this.pluginAPI.agent.treatAsAdoptPartner()) {
|
|
52057
52289
|
this.pluginAPI.agent.addAccountIdParams(bodyPayload, this.pendo.get_account_id(), this.pluginAPI.ConfigReader.get('oemAccountId'));
|
|
52058
52290
|
}
|
|
52059
|
-
|
|
52291
|
+
var body = JSON.stringify(this.pendo._.extend(bodyPayload, jwtOptions));
|
|
52060
52292
|
return this.post(url, {
|
|
52061
|
-
body,
|
|
52293
|
+
body: body,
|
|
52062
52294
|
headers: {
|
|
52063
52295
|
'Content-Type': 'application/json'
|
|
52064
52296
|
},
|
|
52065
52297
|
keepalive: isUnload
|
|
52066
52298
|
});
|
|
52067
|
-
}
|
|
52068
|
-
sendRequest
|
|
52069
|
-
|
|
52299
|
+
};
|
|
52300
|
+
DevlogTransport.prototype.sendRequest = function (_a, isUnload) {
|
|
52301
|
+
var url = _a.url, jzb = _a.jzb;
|
|
52302
|
+
var compressedLength = jzb.length;
|
|
52070
52303
|
if (compressedLength <= this.pluginAPI.constants.ENCODED_EVENT_MAX_LENGTH && !this.pluginAPI.ConfigReader.get('sendEventsWithPostOnly')) {
|
|
52071
|
-
return this.sendRequestWithGet({ url, jzb });
|
|
52304
|
+
return this.sendRequestWithGet({ url: url, jzb: jzb });
|
|
52072
52305
|
}
|
|
52073
|
-
return this.sendRequestWithPost({ url, jzb }, isUnload);
|
|
52074
|
-
}
|
|
52075
|
-
|
|
52306
|
+
return this.sendRequestWithPost({ url: url, jzb: jzb }, isUnload);
|
|
52307
|
+
};
|
|
52308
|
+
return DevlogTransport;
|
|
52309
|
+
}());
|
|
52076
52310
|
|
|
52077
52311
|
function ConsoleCapture() {
|
|
52078
|
-
|
|
52079
|
-
|
|
52080
|
-
|
|
52081
|
-
|
|
52082
|
-
|
|
52083
|
-
|
|
52084
|
-
|
|
52085
|
-
|
|
52086
|
-
|
|
52087
|
-
|
|
52088
|
-
|
|
52089
|
-
|
|
52312
|
+
var pluginAPI;
|
|
52313
|
+
var _;
|
|
52314
|
+
var globalPendo;
|
|
52315
|
+
var buffer;
|
|
52316
|
+
var sendQueue;
|
|
52317
|
+
var sendInterval;
|
|
52318
|
+
var transport;
|
|
52319
|
+
var isPtmPaused;
|
|
52320
|
+
var isCapturingConsoleLogs = false;
|
|
52321
|
+
var CAPTURE_CONSOLE_CONFIG = 'captureConsoleLogs';
|
|
52322
|
+
var CONSOLE_METHODS = ['log', 'warn', 'error', 'info'];
|
|
52323
|
+
var DEV_LOG_SUB_TYPE = 'console';
|
|
52090
52324
|
// deduplicate logs
|
|
52091
|
-
|
|
52325
|
+
var lastLogKey = '';
|
|
52092
52326
|
return {
|
|
52093
52327
|
name: 'ConsoleCapture',
|
|
52094
|
-
initialize,
|
|
52095
|
-
teardown,
|
|
52096
|
-
addIntercepts,
|
|
52097
|
-
createConsoleEvent,
|
|
52098
|
-
captureStackTrace,
|
|
52099
|
-
send,
|
|
52100
|
-
setCaptureState,
|
|
52101
|
-
recordingStarted,
|
|
52102
|
-
recordingStopped,
|
|
52103
|
-
onAppHidden,
|
|
52104
|
-
onAppUnloaded,
|
|
52105
|
-
onPtmPaused,
|
|
52106
|
-
onPtmUnpaused,
|
|
52107
|
-
securityPolicyViolationFn,
|
|
52328
|
+
initialize: initialize,
|
|
52329
|
+
teardown: teardown,
|
|
52330
|
+
addIntercepts: addIntercepts,
|
|
52331
|
+
createConsoleEvent: createConsoleEvent,
|
|
52332
|
+
captureStackTrace: captureStackTrace,
|
|
52333
|
+
send: send,
|
|
52334
|
+
setCaptureState: setCaptureState,
|
|
52335
|
+
recordingStarted: recordingStarted,
|
|
52336
|
+
recordingStopped: recordingStopped,
|
|
52337
|
+
onAppHidden: onAppHidden,
|
|
52338
|
+
onAppUnloaded: onAppUnloaded,
|
|
52339
|
+
onPtmPaused: onPtmPaused,
|
|
52340
|
+
onPtmUnpaused: onPtmUnpaused,
|
|
52341
|
+
securityPolicyViolationFn: securityPolicyViolationFn,
|
|
52108
52342
|
get isCapturingConsoleLogs() {
|
|
52109
52343
|
return isCapturingConsoleLogs;
|
|
52110
52344
|
},
|
|
@@ -52121,16 +52355,16 @@ function ConsoleCapture() {
|
|
|
52121
52355
|
function initialize(pendo, PluginAPI) {
|
|
52122
52356
|
_ = pendo._;
|
|
52123
52357
|
pluginAPI = PluginAPI;
|
|
52124
|
-
|
|
52358
|
+
var ConfigReader = pluginAPI.ConfigReader;
|
|
52125
52359
|
ConfigReader.addOption(CAPTURE_CONSOLE_CONFIG, [ConfigReader.sources.PENDO_CONFIG_SRC], false);
|
|
52126
|
-
|
|
52360
|
+
var captureConsoleEnabled = ConfigReader.get(CAPTURE_CONSOLE_CONFIG);
|
|
52127
52361
|
if (!captureConsoleEnabled)
|
|
52128
52362
|
return;
|
|
52129
52363
|
globalPendo = pendo;
|
|
52130
52364
|
buffer = new DevlogBuffer(pendo, pluginAPI);
|
|
52131
52365
|
transport = new DevlogTransport(pendo, pluginAPI);
|
|
52132
52366
|
sendQueue = new pluginAPI.SendQueue(transport.sendRequest.bind(transport));
|
|
52133
|
-
sendInterval = setInterval(()
|
|
52367
|
+
sendInterval = setInterval(function () {
|
|
52134
52368
|
if (!sendQueue.failed()) {
|
|
52135
52369
|
send();
|
|
52136
52370
|
}
|
|
@@ -52156,17 +52390,19 @@ function ConsoleCapture() {
|
|
|
52156
52390
|
function onPtmUnpaused() {
|
|
52157
52391
|
isPtmPaused = false;
|
|
52158
52392
|
if (!buffer.isEmpty()) {
|
|
52159
|
-
for (
|
|
52160
|
-
|
|
52393
|
+
for (var _i = 0, _a = buffer.events; _i < _a.length; _i++) {
|
|
52394
|
+
var event_1 = _a[_i];
|
|
52395
|
+
pluginAPI.Events.eventCaptured.trigger(event_1);
|
|
52161
52396
|
}
|
|
52162
52397
|
send();
|
|
52163
52398
|
}
|
|
52164
52399
|
}
|
|
52165
|
-
function setCaptureState(
|
|
52400
|
+
function setCaptureState(_a) {
|
|
52401
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.shouldCapture, shouldCapture = _c === void 0 ? false : _c, _d = _b.reason, reason = _d === void 0 ? '' : _d;
|
|
52166
52402
|
if (shouldCapture === isCapturingConsoleLogs)
|
|
52167
52403
|
return;
|
|
52168
52404
|
isCapturingConsoleLogs = shouldCapture;
|
|
52169
|
-
pluginAPI.log.info(
|
|
52405
|
+
pluginAPI.log.info("[ConsoleCapture] Console log capture ".concat(shouldCapture ? 'started' : 'stopped').concat(reason ? ": ".concat(reason) : ''));
|
|
52170
52406
|
}
|
|
52171
52407
|
function recordingStarted() {
|
|
52172
52408
|
setCaptureState({ shouldCapture: true, reason: 'recording started' });
|
|
@@ -52186,12 +52422,12 @@ function ConsoleCapture() {
|
|
|
52186
52422
|
}
|
|
52187
52423
|
function addIntercepts() {
|
|
52188
52424
|
_.each(CONSOLE_METHODS, function (methodName) {
|
|
52189
|
-
|
|
52425
|
+
var originalMethod = console[methodName];
|
|
52190
52426
|
if (!originalMethod)
|
|
52191
52427
|
return;
|
|
52192
52428
|
console[methodName] = _.wrap(originalMethod, function (originalFn) {
|
|
52193
52429
|
// slice 1 to omit originalFn
|
|
52194
|
-
|
|
52430
|
+
var args = _.toArray(arguments).slice(1);
|
|
52195
52431
|
originalFn.apply(console, args);
|
|
52196
52432
|
createConsoleEvent(args, methodName);
|
|
52197
52433
|
});
|
|
@@ -52203,10 +52439,10 @@ function ConsoleCapture() {
|
|
|
52203
52439
|
function securityPolicyViolationFn(evt) {
|
|
52204
52440
|
if (!evt || typeof evt !== 'object')
|
|
52205
52441
|
return;
|
|
52206
|
-
|
|
52207
|
-
|
|
52208
|
-
|
|
52209
|
-
|
|
52442
|
+
var blockedURI = evt.blockedURI, violatedDirective = evt.violatedDirective, effectiveDirective = evt.effectiveDirective, disposition = evt.disposition, originalPolicy = evt.originalPolicy;
|
|
52443
|
+
var directive = violatedDirective || effectiveDirective;
|
|
52444
|
+
var isReportOnly = disposition === 'report';
|
|
52445
|
+
var message = createCspViolationMessage(blockedURI, directive, isReportOnly, originalPolicy);
|
|
52210
52446
|
if (isReportOnly) {
|
|
52211
52447
|
createConsoleEvent([message], 'warn', { skipStackTrace: true, skipScrubPII: true });
|
|
52212
52448
|
}
|
|
@@ -52214,12 +52450,13 @@ function ConsoleCapture() {
|
|
|
52214
52450
|
createConsoleEvent([message], 'error', { skipStackTrace: true, skipScrubPII: true });
|
|
52215
52451
|
}
|
|
52216
52452
|
}
|
|
52217
|
-
function createConsoleEvent(args, methodName,
|
|
52453
|
+
function createConsoleEvent(args, methodName, _a) {
|
|
52454
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.skipStackTrace, skipStackTrace = _c === void 0 ? false : _c, _d = _b.skipScrubPII, skipScrubPII = _d === void 0 ? false : _d;
|
|
52218
52455
|
if (!isCapturingConsoleLogs || !args || args.length === 0 || !_.contains(CONSOLE_METHODS, methodName))
|
|
52219
52456
|
return;
|
|
52220
52457
|
// stringify args
|
|
52221
|
-
|
|
52222
|
-
|
|
52458
|
+
var message = _.compact(_.map(args, function (arg) {
|
|
52459
|
+
var stringifiedArg;
|
|
52223
52460
|
try {
|
|
52224
52461
|
stringifiedArg = stringify(arg);
|
|
52225
52462
|
}
|
|
@@ -52231,22 +52468,22 @@ function ConsoleCapture() {
|
|
|
52231
52468
|
if (!message)
|
|
52232
52469
|
return;
|
|
52233
52470
|
// capture stack trace
|
|
52234
|
-
|
|
52471
|
+
var stackTrace = '';
|
|
52235
52472
|
if (!skipStackTrace) {
|
|
52236
|
-
|
|
52473
|
+
var maxStackFrames = methodName === 'error' ? 4 : 1;
|
|
52237
52474
|
stackTrace = captureStackTrace(maxStackFrames);
|
|
52238
52475
|
}
|
|
52239
52476
|
// truncate message and stack trace
|
|
52240
52477
|
message = truncate(message);
|
|
52241
52478
|
stackTrace = truncate(stackTrace);
|
|
52242
52479
|
// de-duplicate log
|
|
52243
|
-
|
|
52480
|
+
var logKey = generateLogKey(methodName, message, stackTrace);
|
|
52244
52481
|
if (isExistingDuplicateLog(logKey)) {
|
|
52245
52482
|
buffer.lastEvent.devLogCount++;
|
|
52246
52483
|
return;
|
|
52247
52484
|
}
|
|
52248
|
-
|
|
52249
|
-
|
|
52485
|
+
var devLogEnvelope = createDevLogEnvelope(pluginAPI, globalPendo);
|
|
52486
|
+
var consoleEvent = __assign(__assign({}, devLogEnvelope), { subType: DEV_LOG_SUB_TYPE, devLogLevel: methodName === 'log' ? 'info' : methodName, devLogMessage: skipScrubPII ? message : scrubPII({ string: message, _: _ }), devLogTrace: stackTrace, devLogCount: 1 });
|
|
52250
52487
|
if (!buffer.hasTokenAvailable())
|
|
52251
52488
|
return consoleEvent;
|
|
52252
52489
|
if (!isPtmPaused) {
|
|
@@ -52258,8 +52495,8 @@ function ConsoleCapture() {
|
|
|
52258
52495
|
}
|
|
52259
52496
|
function captureStackTrace(maxStackFrames) {
|
|
52260
52497
|
try {
|
|
52261
|
-
|
|
52262
|
-
return _.map(stackFrames, frame
|
|
52498
|
+
var stackFrames = ErrorStackParser.parse(new Error(), maxStackFrames);
|
|
52499
|
+
return _.map(stackFrames, function (frame) { return frame.toString(); }).join('\n');
|
|
52263
52500
|
}
|
|
52264
52501
|
catch (error) {
|
|
52265
52502
|
return '';
|
|
@@ -52271,21 +52508,22 @@ function ConsoleCapture() {
|
|
|
52271
52508
|
function updateLastLog(logKey) {
|
|
52272
52509
|
lastLogKey = logKey;
|
|
52273
52510
|
}
|
|
52274
|
-
function send(
|
|
52511
|
+
function send(_a) {
|
|
52512
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.unload, unload = _c === void 0 ? false : _c, _d = _b.hidden, hidden = _d === void 0 ? false : _d;
|
|
52275
52513
|
if (!buffer || buffer.isEmpty())
|
|
52276
52514
|
return;
|
|
52277
52515
|
if (!globalPendo.isSendingEvents()) {
|
|
52278
52516
|
buffer.clear();
|
|
52279
52517
|
return;
|
|
52280
52518
|
}
|
|
52281
|
-
|
|
52519
|
+
var payloads = buffer.pack();
|
|
52282
52520
|
if (!payloads || payloads.length === 0)
|
|
52283
52521
|
return;
|
|
52284
52522
|
if (unload || hidden) {
|
|
52285
52523
|
sendQueue.drain(payloads, unload);
|
|
52286
52524
|
}
|
|
52287
52525
|
else {
|
|
52288
|
-
sendQueue.push(
|
|
52526
|
+
sendQueue.push.apply(sendQueue, payloads);
|
|
52289
52527
|
}
|
|
52290
52528
|
}
|
|
52291
52529
|
function teardown() {
|
|
@@ -52309,7 +52547,7 @@ function ConsoleCapture() {
|
|
|
52309
52547
|
_.each(CONSOLE_METHODS, function (methodName) {
|
|
52310
52548
|
if (!console[methodName])
|
|
52311
52549
|
return _.noop;
|
|
52312
|
-
|
|
52550
|
+
var unwrap = console[methodName]._pendoUnwrap;
|
|
52313
52551
|
if (_.isFunction(unwrap)) {
|
|
52314
52552
|
unwrap();
|
|
52315
52553
|
}
|
|
@@ -52751,7 +52989,7 @@ var injectStyles = function (pendoContainerId, log) {
|
|
|
52751
52989
|
log("[predict] injecting styles: ".concat(styleId));
|
|
52752
52990
|
createElement('style', {
|
|
52753
52991
|
id: styleId,
|
|
52754
|
-
textContent: "\n #".concat(pendoContainerId, " {\n display: none !important;\n }\n .frame-explanation {\n aspect-ratio: 16/9; overflow: hidden; min-height: 300px;\n width: 100vw; height: 100vh; background: transparent;\n position: fixed; bottom: 0; right: 0; z-index:
|
|
52992
|
+
textContent: "\n #".concat(pendoContainerId, " {\n display: none !important;\n }\n .frame-explanation {\n aspect-ratio: 16/9; overflow: hidden; min-height: 300px;\n width: 100vw; height: 100vh; background: transparent;\n position: fixed; bottom: 0; right: 0; z-index: 1; border: none;\n visibility: hidden; opacity: 0; pointer-events: none;\n transition: opacity 0.1s ease-out, visibility 0s linear 0.1s;\n display: none;\n }\n .frame-explanation.is-visible {\n z-index: 999999;\n visibility: visible; opacity: 1; pointer-events: auto;\n transition: opacity 0.1s ease-out, visibility 0s linear 0s;\n }\n .frame-explanation.is-exists {\n display: block !important;\n }\n .floating-modal-container {\n position: fixed; top: 20px; right: 20px; z-index: 500000;\n visibility: hidden; opacity: 0; pointer-events: none;\n transition: opacity 0.1s ease-out, visibility 0s linear 0.1s;\n border-radius: 8px; box-shadow: 0px 4px 12px 0px rgba(0,0,0,0.15);\n overflow: hidden; width: 384px; height: 176px;\n }\n .floating-modal-container.is-visible {\n visibility: visible; opacity: 1; pointer-events: auto;\n transition: opacity 0.1s ease-out, visibility 0s linear 0s;\n }\n .floating-modal-container.is-dragging { will-change: left, top; }\n .floating-modal-drag-handle {\n position: absolute; left: 50%; transform: translateX(-50%);\n top: 5px; width: calc(100% - 46px); min-width: 166px; height: 17px;\n z-index: 9999; transition: left 0.2s ease, right 0.2s ease;\n display: flex; justify-content: center; align-items: center;\n }\n .floating-modal-drag-handle svg g { fill: #A0A0A0; }\n .floating-modal-drag-handle:hover { cursor: grab; }\n .floating-modal-drag-handle:hover svg g { fill: #1f2937; }\n .floating-modal-drag-handle.is-dragging { cursor: grabbing; }\n .floating-modal-drag-handle.is-collapsed { top: 0px; }\n .frame-floating-modal { width: 100%; height: 100%; background: white; border: none; display: block; }\n ")
|
|
52755
52993
|
}, document.head);
|
|
52756
52994
|
};
|
|
52757
52995
|
var getRecordIdFromUrl = function (recordRegex, log) {
|