@pendo/agent 2.327.1 → 2.328.1
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 +719 -552
- package/dist/pendo.module.min.js +8 -106
- 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.1_';
|
|
4006
|
+
let PACKAGE_VERSION = '2.328.1';
|
|
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]),
|
|
@@ -24350,15 +24374,13 @@ function guidesPayload(guidesJson) {
|
|
|
24350
24374
|
delete guidesJson.segmentFlags; // This is temporary until the BE stops sending segment flags in the guides payload, at which point this can be removed
|
|
24351
24375
|
}
|
|
24352
24376
|
_.extend(pendo$1, guidesJson);
|
|
24353
|
-
|
|
24354
|
-
|
|
24355
|
-
|
|
24356
|
-
|
|
24357
|
-
|
|
24358
|
-
|
|
24359
|
-
|
|
24360
|
-
}
|
|
24361
|
-
});
|
|
24377
|
+
const guidesReceivedPayload = {
|
|
24378
|
+
guides: pendo$1.guides,
|
|
24379
|
+
visitorId: get_visitor_id(),
|
|
24380
|
+
guideCache
|
|
24381
|
+
};
|
|
24382
|
+
Events.guidesReceived.trigger(guidesReceivedPayload);
|
|
24383
|
+
pendo$1.guides = guidesReceivedPayload.guides;
|
|
24362
24384
|
if (mostRecentGuideRequest.deferred) {
|
|
24363
24385
|
mostRecentGuideRequest.deferred.resolve();
|
|
24364
24386
|
}
|
|
@@ -28987,7 +29009,7 @@ function registerEventHandlers({ events = [] }) {
|
|
|
28987
29009
|
function applyDoNotTrackConfigOverrides(options) {
|
|
28988
29010
|
options.excludeNonGuideAnalytics = true;
|
|
28989
29011
|
options.disableCookies = true;
|
|
28990
|
-
options.visitor = { id: '
|
|
29012
|
+
options.visitor = { id: '__cookieless_visitor__' };
|
|
28991
29013
|
delete options.account;
|
|
28992
29014
|
delete options.parentAccount;
|
|
28993
29015
|
}
|
|
@@ -37455,6 +37477,126 @@ const FrustrationEvent = (function () {
|
|
|
37455
37477
|
}
|
|
37456
37478
|
})();
|
|
37457
37479
|
|
|
37480
|
+
const snapshots = {};
|
|
37481
|
+
function snapshotKey(guideId, stepId) {
|
|
37482
|
+
return `${guideId}:${stepId}`;
|
|
37483
|
+
}
|
|
37484
|
+
function isPlaceholderGuide(guide) {
|
|
37485
|
+
return _.keys(guide).length === 1 && guide.id;
|
|
37486
|
+
}
|
|
37487
|
+
function recordGuideResponseSnapshots(guidesFromResponse, guideCache) {
|
|
37488
|
+
if (!guidesFromResponse || !guideCache) {
|
|
37489
|
+
return;
|
|
37490
|
+
}
|
|
37491
|
+
_.each(guidesFromResponse, function (guide) {
|
|
37492
|
+
if (!guide || !guide.id) {
|
|
37493
|
+
return;
|
|
37494
|
+
}
|
|
37495
|
+
if (isPlaceholderGuide(guide)) {
|
|
37496
|
+
const priorCached = guideCache.get(guide.id);
|
|
37497
|
+
if (!priorCached || !priorCached.steps) {
|
|
37498
|
+
return;
|
|
37499
|
+
}
|
|
37500
|
+
_.each(priorCached.steps, function (step) {
|
|
37501
|
+
if (!step || !step.id) {
|
|
37502
|
+
return;
|
|
37503
|
+
}
|
|
37504
|
+
const entry = { payload_seen_state: null };
|
|
37505
|
+
if (!_.isUndefined(step.seenState) && step.seenState !== null) {
|
|
37506
|
+
entry.cached_seen_state = step.seenState;
|
|
37507
|
+
}
|
|
37508
|
+
snapshots[snapshotKey(guide.id, step.id)] = entry;
|
|
37509
|
+
});
|
|
37510
|
+
return;
|
|
37511
|
+
}
|
|
37512
|
+
const priorCached = guideCache.get(guide.id);
|
|
37513
|
+
_.each(guide.steps || [], function (step) {
|
|
37514
|
+
if (!step || !step.id) {
|
|
37515
|
+
return;
|
|
37516
|
+
}
|
|
37517
|
+
const entry = {
|
|
37518
|
+
payload_seen_state: _.isUndefined(step.seenState) ? null : step.seenState
|
|
37519
|
+
};
|
|
37520
|
+
const cachedStep = priorCached && _.findWhere(priorCached.steps, { id: step.id });
|
|
37521
|
+
if (cachedStep && !_.isUndefined(cachedStep.seenState) && cachedStep.seenState !== null) {
|
|
37522
|
+
entry.cached_seen_state = cachedStep.seenState;
|
|
37523
|
+
}
|
|
37524
|
+
snapshots[snapshotKey(guide.id, step.id)] = entry;
|
|
37525
|
+
});
|
|
37526
|
+
});
|
|
37527
|
+
}
|
|
37528
|
+
function mergeGuidesWithCache(guidesFromResponse, visitorId, guideCache) {
|
|
37529
|
+
if (!guidesFromResponse) {
|
|
37530
|
+
return guidesFromResponse;
|
|
37531
|
+
}
|
|
37532
|
+
if (!guideCache) {
|
|
37533
|
+
return guidesFromResponse;
|
|
37534
|
+
}
|
|
37535
|
+
return _.map(guidesFromResponse, function (guide) {
|
|
37536
|
+
if (isPlaceholderGuide(guide)) {
|
|
37537
|
+
return guideCache.get(guide.id);
|
|
37538
|
+
}
|
|
37539
|
+
guideCache.add(guide, visitorId);
|
|
37540
|
+
return guide;
|
|
37541
|
+
});
|
|
37542
|
+
}
|
|
37543
|
+
function getSnapshot(guideId, stepId) {
|
|
37544
|
+
return snapshots[snapshotKey(guideId, stepId)];
|
|
37545
|
+
}
|
|
37546
|
+
function clearSnapshots() {
|
|
37547
|
+
_.each(_.keys(snapshots), function (key) {
|
|
37548
|
+
delete snapshots[key];
|
|
37549
|
+
});
|
|
37550
|
+
}
|
|
37551
|
+
|
|
37552
|
+
const GuideCachePlugin = {
|
|
37553
|
+
name: 'GuideCache',
|
|
37554
|
+
initialize(pendo, PluginAPI) {
|
|
37555
|
+
this.onGuidesReceived = _.bind(this.guidesReceived, this);
|
|
37556
|
+
this.onEventCaptured = _.bind(this.eventCaptured, this);
|
|
37557
|
+
PluginAPI.Events.on('guidesReceived', this.onGuidesReceived);
|
|
37558
|
+
this.subscriptions = [
|
|
37559
|
+
PluginAPI.attachEvent(PluginAPI.Events, 'eventCaptured', this.onEventCaptured)
|
|
37560
|
+
];
|
|
37561
|
+
},
|
|
37562
|
+
teardown(pendo, PluginAPI) {
|
|
37563
|
+
PluginAPI.Events.off('guidesReceived', this.onGuidesReceived);
|
|
37564
|
+
_.each(this.subscriptions, function (unsubscribe) {
|
|
37565
|
+
unsubscribe();
|
|
37566
|
+
});
|
|
37567
|
+
this.subscriptions = [];
|
|
37568
|
+
},
|
|
37569
|
+
guidesReceived(event) {
|
|
37570
|
+
clearSnapshots();
|
|
37571
|
+
const payload = event.data[0];
|
|
37572
|
+
if (!payload || !payload.guideCache || !payload.guides) {
|
|
37573
|
+
return;
|
|
37574
|
+
}
|
|
37575
|
+
recordGuideResponseSnapshots(payload.guides, payload.guideCache);
|
|
37576
|
+
payload.guides = mergeGuidesWithCache(payload.guides, payload.visitorId, payload.guideCache);
|
|
37577
|
+
},
|
|
37578
|
+
eventCaptured(event) {
|
|
37579
|
+
if (!event || !event.data || !event.data.length) {
|
|
37580
|
+
return;
|
|
37581
|
+
}
|
|
37582
|
+
const capturedEvent = event.data[0];
|
|
37583
|
+
if (!capturedEvent || capturedEvent.type !== 'guideSeen') {
|
|
37584
|
+
return;
|
|
37585
|
+
}
|
|
37586
|
+
if (capturedEvent.props.reason !== 'auto') {
|
|
37587
|
+
return;
|
|
37588
|
+
}
|
|
37589
|
+
const snap = getSnapshot(capturedEvent.props.guide_id, capturedEvent.props.guide_step_id);
|
|
37590
|
+
if (!snap) {
|
|
37591
|
+
return;
|
|
37592
|
+
}
|
|
37593
|
+
capturedEvent.props.payload_seen_state = snap.payload_seen_state;
|
|
37594
|
+
if (!_.isUndefined(snap.cached_seen_state)) {
|
|
37595
|
+
capturedEvent.props.cached_seen_state = snap.cached_seen_state;
|
|
37596
|
+
}
|
|
37597
|
+
}
|
|
37598
|
+
};
|
|
37599
|
+
|
|
37458
37600
|
const IFrameMonitor = (function () {
|
|
37459
37601
|
const FRAME_TIMER_LENGTH = 250;
|
|
37460
37602
|
const FRAME_ID = 'pendo-loader';
|
|
@@ -40082,6 +40224,8 @@ const THUMB_UP = 'thumbUp';
|
|
|
40082
40224
|
const TURN_CONTAINER = 'turnContainer';
|
|
40083
40225
|
const TURN_ATTR = 'turnAttr';
|
|
40084
40226
|
const USER_MESSAGE = 'userMessage';
|
|
40227
|
+
const CUSTOM_AGENT_ID_URL_PATTERN = 'customAgentIdUrlPattern';
|
|
40228
|
+
const CUSTOM_AGENT_NAME = 'customAgentName';
|
|
40085
40229
|
const REQUIRED_SELECTORS = [
|
|
40086
40230
|
ASSISTANT_MESSAGE,
|
|
40087
40231
|
CONVERSATION_ID_URL_PATTERN,
|
|
@@ -40092,6 +40236,8 @@ const REQUIRED_SELECTORS = [
|
|
|
40092
40236
|
USER_MESSAGE
|
|
40093
40237
|
];
|
|
40094
40238
|
const STREAMING_END_SETTLE_MS = 500;
|
|
40239
|
+
const SUBMISSION_START_RETRY_MS = 1000;
|
|
40240
|
+
const SUBMISSION_START_MAX_ATTEMPTS = 4;
|
|
40095
40241
|
class DOMConversation {
|
|
40096
40242
|
// Returns the list of required selector types that are missing or empty
|
|
40097
40243
|
// in the given cssSelectors config. An empty array means the config is
|
|
@@ -40126,8 +40272,10 @@ class DOMConversation {
|
|
|
40126
40272
|
this.observers = [];
|
|
40127
40273
|
this.wasStreaming = false;
|
|
40128
40274
|
this.streamingEndTimer = null;
|
|
40275
|
+
this.submissionStartRetryTimer = null;
|
|
40129
40276
|
this.requestNode = null;
|
|
40130
40277
|
this.conversationIdRegex = null;
|
|
40278
|
+
this.customAgentIdRegex = null;
|
|
40131
40279
|
this.lastReturnedMessageId = null;
|
|
40132
40280
|
this.dom = pendo.dom;
|
|
40133
40281
|
this._ = pendo._;
|
|
@@ -40145,6 +40293,15 @@ class DOMConversation {
|
|
|
40145
40293
|
}
|
|
40146
40294
|
});
|
|
40147
40295
|
this.conversationIdRegex = new RegExp(this.selectors[CONVERSATION_ID_URL_PATTERN]);
|
|
40296
|
+
const customAgentIdUrlPattern = this.selectors[CUSTOM_AGENT_ID_URL_PATTERN];
|
|
40297
|
+
if (customAgentIdUrlPattern) { // this is optional
|
|
40298
|
+
try {
|
|
40299
|
+
this.customAgentIdRegex = new RegExp(customAgentIdUrlPattern);
|
|
40300
|
+
}
|
|
40301
|
+
catch (error) {
|
|
40302
|
+
this.api.log.error(`bad customAgentIdUrlPattern ${customAgentIdUrlPattern}`, { error });
|
|
40303
|
+
}
|
|
40304
|
+
}
|
|
40148
40305
|
this.root = document.body;
|
|
40149
40306
|
this.setupReactionListener();
|
|
40150
40307
|
this.setupStreamingObserver();
|
|
@@ -40221,14 +40378,20 @@ class DOMConversation {
|
|
|
40221
40378
|
}
|
|
40222
40379
|
this.wasStreaming = isStreaming;
|
|
40223
40380
|
}
|
|
40224
|
-
onSubmissionStart() {
|
|
40381
|
+
onSubmissionStart(attempt = 1) {
|
|
40225
40382
|
this.requestNode = this.findLastRequestNode();
|
|
40226
40383
|
if (this.requestNode) {
|
|
40227
40384
|
this.handleUserMessage(this.requestNode);
|
|
40385
|
+
return;
|
|
40386
|
+
}
|
|
40387
|
+
// URL hasn't flipped yet to include the conversation id on a fresh chat
|
|
40388
|
+
// retry, if that still fails, onSubmissionEnd handles it
|
|
40389
|
+
if (attempt < SUBMISSION_START_MAX_ATTEMPTS) {
|
|
40390
|
+
this.startSubmissionStartRetryTimer(attempt + 1);
|
|
40228
40391
|
}
|
|
40229
40392
|
}
|
|
40230
40393
|
onSubmissionEnd() {
|
|
40231
|
-
this.
|
|
40394
|
+
this.stopSubmissionStartRetryTimer();
|
|
40232
40395
|
let requestNode = this.requestNode;
|
|
40233
40396
|
this.requestNode = null;
|
|
40234
40397
|
if (!requestNode) {
|
|
@@ -40308,6 +40471,32 @@ class DOMConversation {
|
|
|
40308
40471
|
return null;
|
|
40309
40472
|
return m[1] !== undefined ? m[1] : m[0];
|
|
40310
40473
|
}
|
|
40474
|
+
getCustomAgentId() {
|
|
40475
|
+
if (!this.customAgentIdRegex)
|
|
40476
|
+
return undefined;
|
|
40477
|
+
const m = location.href.match(this.customAgentIdRegex);
|
|
40478
|
+
if (!m)
|
|
40479
|
+
return undefined;
|
|
40480
|
+
return m[1] !== undefined ? m[1] : m[0];
|
|
40481
|
+
}
|
|
40482
|
+
getCustomAgentName() {
|
|
40483
|
+
if (!this.findSelector(CUSTOM_AGENT_NAME))
|
|
40484
|
+
return '';
|
|
40485
|
+
const node = this.select(CUSTOM_AGENT_NAME);
|
|
40486
|
+
if (!node.length)
|
|
40487
|
+
return '';
|
|
40488
|
+
return node.text().trim();
|
|
40489
|
+
}
|
|
40490
|
+
addCustomAgentInfo(eventPayload) {
|
|
40491
|
+
const customAgentId = this.getCustomAgentId();
|
|
40492
|
+
if (!customAgentId)
|
|
40493
|
+
return;
|
|
40494
|
+
eventPayload.customAgentId = customAgentId;
|
|
40495
|
+
const customAgentName = this.getCustomAgentName();
|
|
40496
|
+
if (customAgentName) {
|
|
40497
|
+
eventPayload.customAgentName = customAgentName;
|
|
40498
|
+
}
|
|
40499
|
+
}
|
|
40311
40500
|
setFilters(candidateFilter) {
|
|
40312
40501
|
if (!candidateFilter) {
|
|
40313
40502
|
this.privacyFilters = null;
|
|
@@ -40333,11 +40522,15 @@ class DOMConversation {
|
|
|
40333
40522
|
}
|
|
40334
40523
|
emit(eventType, eventPayload) {
|
|
40335
40524
|
eventPayload.conversationId = this.getConversationId();
|
|
40525
|
+
this.addCustomAgentInfo(eventPayload);
|
|
40336
40526
|
this._.each(this.listeners, (cb) => cb(eventType, eventPayload));
|
|
40337
40527
|
}
|
|
40338
40528
|
startStreamingEndTimer() {
|
|
40339
40529
|
this.stopStreamingEndTimer();
|
|
40340
|
-
this.streamingEndTimer = setTimeout$1(
|
|
40530
|
+
this.streamingEndTimer = setTimeout$1(() => {
|
|
40531
|
+
this.streamingEndTimer = null;
|
|
40532
|
+
this.onSubmissionEnd();
|
|
40533
|
+
}, STREAMING_END_SETTLE_MS);
|
|
40341
40534
|
}
|
|
40342
40535
|
stopStreamingEndTimer() {
|
|
40343
40536
|
if (!this.streamingEndTimer)
|
|
@@ -40345,6 +40538,19 @@ class DOMConversation {
|
|
|
40345
40538
|
clearTimeout(this.streamingEndTimer);
|
|
40346
40539
|
this.streamingEndTimer = null;
|
|
40347
40540
|
}
|
|
40541
|
+
startSubmissionStartRetryTimer(attempt) {
|
|
40542
|
+
this.stopSubmissionStartRetryTimer();
|
|
40543
|
+
this.submissionStartRetryTimer = setTimeout$1(() => {
|
|
40544
|
+
this.submissionStartRetryTimer = null;
|
|
40545
|
+
this.onSubmissionStart(attempt);
|
|
40546
|
+
}, SUBMISSION_START_RETRY_MS);
|
|
40547
|
+
}
|
|
40548
|
+
stopSubmissionStartRetryTimer() {
|
|
40549
|
+
if (!this.submissionStartRetryTimer)
|
|
40550
|
+
return;
|
|
40551
|
+
clearTimeout(this.submissionStartRetryTimer);
|
|
40552
|
+
this.submissionStartRetryTimer = null;
|
|
40553
|
+
}
|
|
40348
40554
|
suspend() {
|
|
40349
40555
|
this.isActive = false;
|
|
40350
40556
|
}
|
|
@@ -40359,6 +40565,7 @@ class DOMConversation {
|
|
|
40359
40565
|
this.reactionClickHandler = null;
|
|
40360
40566
|
}
|
|
40361
40567
|
this.stopStreamingEndTimer();
|
|
40568
|
+
this.stopSubmissionStartRetryTimer();
|
|
40362
40569
|
this.listeners = [];
|
|
40363
40570
|
}
|
|
40364
40571
|
}
|
|
@@ -41147,6 +41354,7 @@ function registerBuiltInPlugins() {
|
|
|
41147
41354
|
registerPlugin(EventProperties);
|
|
41148
41355
|
registerPlugin(FormValidation);
|
|
41149
41356
|
registerPlugin(FrustrationEvent);
|
|
41357
|
+
registerPlugin(GuideCachePlugin);
|
|
41150
41358
|
registerPlugin(IFrameMonitor);
|
|
41151
41359
|
registerPlugin(OemAccountId);
|
|
41152
41360
|
registerPlugin(P1GuidePlugin);
|
|
@@ -41362,8 +41570,6 @@ function removeMarkdownSyntax(element, textToReplace, replacementText, pendo) {
|
|
|
41362
41570
|
// This prevents us from removing the message for the conditionally rendered elements
|
|
41363
41571
|
element.innerHTML = (_a = element.innerHTML) === null || _a === void 0 ? void 0 : _a.replace(textToReplace, replacementText);
|
|
41364
41572
|
}
|
|
41365
|
-
if (element.localName === 'div')
|
|
41366
|
-
return;
|
|
41367
41573
|
if (element.localName === 'button' ||
|
|
41368
41574
|
element.localName === 'label' ||
|
|
41369
41575
|
element.localName === 'a') {
|
|
@@ -41401,20 +41607,20 @@ function getZoneSafeMethod(_, method, target) {
|
|
|
41401
41607
|
}
|
|
41402
41608
|
|
|
41403
41609
|
// Does not support submit and go to
|
|
41404
|
-
|
|
41405
|
-
|
|
41610
|
+
var goToRegex = new RegExp(guideMarkdownUtil.goToString);
|
|
41611
|
+
var PollBranching = {
|
|
41406
41612
|
name: 'PollBranching',
|
|
41407
|
-
script(step, guide, pendo) {
|
|
41408
|
-
|
|
41409
|
-
|
|
41613
|
+
script: function (step, guide, pendo) {
|
|
41614
|
+
var isAdvanceIntercepted = false;
|
|
41615
|
+
var branchingQuestions = initialBranchingSetup(step, pendo);
|
|
41410
41616
|
if (branchingQuestions) {
|
|
41411
41617
|
// If there are too many branching questions saved, exit and run the guide normally.
|
|
41412
41618
|
if (pendo._.size(branchingQuestions) > 1)
|
|
41413
41619
|
return;
|
|
41414
|
-
this.on('beforeAdvance', (evt)
|
|
41415
|
-
|
|
41416
|
-
|
|
41417
|
-
|
|
41620
|
+
this.on('beforeAdvance', function (evt) {
|
|
41621
|
+
var noResponseSelected = step.guideElement.find('[branching] .pendo-radio:checked').length === 0;
|
|
41622
|
+
var responseLabel = step.guideElement.find('[branching] .pendo-radio:checked + label')[0];
|
|
41623
|
+
var noGotoLabel;
|
|
41418
41624
|
if (responseLabel) {
|
|
41419
41625
|
noGotoLabel = pendo._.isNull(responseLabel.getAttribute('goToStep'));
|
|
41420
41626
|
}
|
|
@@ -41425,58 +41631,58 @@ const PollBranching = {
|
|
|
41425
41631
|
});
|
|
41426
41632
|
}
|
|
41427
41633
|
},
|
|
41428
|
-
test(step, guide, pendo) {
|
|
41634
|
+
test: function (step, guide, pendo) {
|
|
41429
41635
|
var _a;
|
|
41430
|
-
|
|
41636
|
+
var branchingQuestions = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find('._pendo-multi-choice-poll-question:contains("{branching/}")');
|
|
41431
41637
|
return !pendo._.isUndefined(branchingQuestions) && pendo._.size(branchingQuestions);
|
|
41432
41638
|
},
|
|
41433
|
-
designerListener(pendo) {
|
|
41434
|
-
|
|
41435
|
-
|
|
41639
|
+
designerListener: function (pendo) {
|
|
41640
|
+
var target = pendo.dom.getBody();
|
|
41641
|
+
var config = {
|
|
41436
41642
|
attributeFilter: ['data-layout'],
|
|
41437
41643
|
attributes: true,
|
|
41438
41644
|
childList: true,
|
|
41439
41645
|
characterData: true,
|
|
41440
41646
|
subtree: true
|
|
41441
41647
|
};
|
|
41442
|
-
|
|
41443
|
-
|
|
41648
|
+
var MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
|
|
41649
|
+
var observer = new MutationObserver(applyBranchingIndicators);
|
|
41444
41650
|
observer.observe(target, config);
|
|
41445
41651
|
function applyBranchingIndicators(mutations) {
|
|
41446
41652
|
pendo._.each(mutations, function (mutation) {
|
|
41447
41653
|
var _a;
|
|
41448
|
-
|
|
41654
|
+
var nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelector);
|
|
41449
41655
|
if (mutation.addedNodes.length && nodeHasQuerySelector) {
|
|
41450
41656
|
if (mutation.addedNodes[0].querySelector('._pendo-multi-choice-poll-select-border')) {
|
|
41451
41657
|
if (pendo._.size(pendo.dom('._pendo-multi-choice-poll-question:contains("{branching/}")'))) {
|
|
41452
41658
|
pendo
|
|
41453
41659
|
.dom('._pendo-multi-choice-poll-question:contains("{branching/}")')
|
|
41454
|
-
.each((question, index)
|
|
41455
|
-
pendo._.each(pendo.dom(
|
|
41660
|
+
.each(function (question, index) {
|
|
41661
|
+
pendo._.each(pendo.dom("#".concat(question.id, " *")), function (element) {
|
|
41456
41662
|
guideMarkdownUtil.removeMarkdownSyntax(element, '{branching/}', '', pendo);
|
|
41457
41663
|
});
|
|
41458
41664
|
pendo
|
|
41459
|
-
.dom(
|
|
41665
|
+
.dom("#".concat(question.id, " p"))
|
|
41460
41666
|
.css({ display: 'inline-block !important' })
|
|
41461
41667
|
.append(branchingIcon('#999', '20px'))
|
|
41462
41668
|
.attr({ title: 'Custom Branching Added' });
|
|
41463
|
-
|
|
41464
|
-
if (pendo.dom(
|
|
41669
|
+
var dataPendoPollId = question.getAttribute('data-pendo-poll-id');
|
|
41670
|
+
if (pendo.dom("._pendo-multi-choice-poll-question[data-pendo-poll-id=".concat(dataPendoPollId, "]"))[0]) {
|
|
41465
41671
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
41466
41672
|
pendo
|
|
41467
|
-
.dom(
|
|
41673
|
+
.dom("._pendo-multi-choice-poll-question[data-pendo-poll-id=".concat(dataPendoPollId, "]"))[0]
|
|
41468
41674
|
.textContent.trim();
|
|
41469
41675
|
}
|
|
41470
|
-
|
|
41676
|
+
var pollLabels = pendo.dom("label[for*=".concat(dataPendoPollId, "]"));
|
|
41471
41677
|
if (pendo._.size(pollLabels)) {
|
|
41472
|
-
pendo._.forEach(pollLabels, (label)
|
|
41678
|
+
pendo._.forEach(pollLabels, function (label) {
|
|
41473
41679
|
if (goToRegex.test(label.textContent)) {
|
|
41474
|
-
|
|
41680
|
+
var labelTitle = goToRegex.exec(label.textContent)[2];
|
|
41475
41681
|
guideMarkdownUtil.removeMarkdownSyntax(label, goToRegex, '', pendo);
|
|
41476
41682
|
pendo
|
|
41477
41683
|
.dom(label)
|
|
41478
41684
|
.append(branchingIcon('#999', '14px'))
|
|
41479
|
-
.attr({ title:
|
|
41685
|
+
.attr({ title: "Branching to step ".concat(labelTitle) });
|
|
41480
41686
|
}
|
|
41481
41687
|
});
|
|
41482
41688
|
}
|
|
@@ -41484,9 +41690,9 @@ const PollBranching = {
|
|
|
41484
41690
|
pendo
|
|
41485
41691
|
.dom(question)
|
|
41486
41692
|
.append(branchingErrorHTML(question.dataset.pendoPollId));
|
|
41487
|
-
pendo.dom(
|
|
41693
|
+
pendo.dom("#".concat(question.id, " #pendo-ps-branching-svg")).remove();
|
|
41488
41694
|
pendo
|
|
41489
|
-
.dom(
|
|
41695
|
+
.dom("#".concat(question.id, " p"))
|
|
41490
41696
|
.css({ display: 'inline-block !important' })
|
|
41491
41697
|
.append(branchingIcon('red', '20px'))
|
|
41492
41698
|
.attr({ title: 'Unsupported Branching configuration' });
|
|
@@ -41498,49 +41704,31 @@ const PollBranching = {
|
|
|
41498
41704
|
});
|
|
41499
41705
|
}
|
|
41500
41706
|
function branchingErrorHTML(dataPendoPollId) {
|
|
41501
|
-
return
|
|
41502
|
-
font-style: italic; margin-top: 0px;" class="branching-wrapper"
|
|
41503
|
-
name="${dataPendoPollId}">
|
|
41504
|
-
* Branching Error: Multiple branching polls not supported</div>`;
|
|
41707
|
+
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>");
|
|
41505
41708
|
}
|
|
41506
41709
|
function branchingIcon(color, size) {
|
|
41507
|
-
return
|
|
41508
|
-
style="margin-left: 5px;
|
|
41509
|
-
height:${size}; width:${size}; display:inline; vertical-align:middle;" xmlns="http://www.w3.org/2000/svg">
|
|
41510
|
-
<g stroke-width="0"></g>
|
|
41511
|
-
<g stroke-linecap="round" stroke-linejoin="round"></g>
|
|
41512
|
-
<g> <circle cx="4" cy="7" r="2" stroke="${color}"
|
|
41513
|
-
stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></circle>
|
|
41514
|
-
<circle cx="20" cy="7" r="2" stroke="${color}"
|
|
41515
|
-
stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></circle>
|
|
41516
|
-
<circle cx="20" cy="17" r="2" stroke="${color}" stroke-width="2"
|
|
41517
|
-
stroke-linecap="round" stroke-linejoin="round"></circle>
|
|
41518
|
-
<path d="M18 7H6" stroke="${color}" stroke-width="2"
|
|
41519
|
-
stroke-linecap="round" stroke-linejoin="round"></path>
|
|
41520
|
-
<path d="M7 7V7C8.65685 7 10 8.34315 10 10V15C10 16.1046 10.8954 17 12 17H18"
|
|
41521
|
-
stroke="${color}" stroke-width="2" stroke-linecap="round"
|
|
41522
|
-
stroke-linejoin="round"></path> </g></svg>`;
|
|
41710
|
+
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>");
|
|
41523
41711
|
}
|
|
41524
41712
|
}
|
|
41525
41713
|
};
|
|
41526
41714
|
function initialBranchingSetup(step, pendo) {
|
|
41527
|
-
|
|
41528
|
-
pendo._.forEach(questions, (question)
|
|
41529
|
-
|
|
41530
|
-
pendo._.each(step.guideElement.find(
|
|
41715
|
+
var questions = step.guideElement.find('._pendo-multi-choice-poll-question:contains("{branching/}")');
|
|
41716
|
+
pendo._.forEach(questions, function (question) {
|
|
41717
|
+
var dataPendoPollId = question.getAttribute('data-pendo-poll-id');
|
|
41718
|
+
pendo._.each(step.guideElement.find("#".concat(question.id, " *")), function (element) {
|
|
41531
41719
|
guideMarkdownUtil.removeMarkdownSyntax(element, '{branching/}', '', pendo);
|
|
41532
41720
|
});
|
|
41533
|
-
|
|
41534
|
-
pendo._.forEach(pollLabels, (label)
|
|
41721
|
+
var pollLabels = step.guideElement.find("label[for*=".concat(dataPendoPollId, "]"));
|
|
41722
|
+
pendo._.forEach(pollLabels, function (label) {
|
|
41535
41723
|
if (pendo._.isNull(goToRegex.exec(label.textContent))) {
|
|
41536
41724
|
return;
|
|
41537
41725
|
}
|
|
41538
|
-
|
|
41539
|
-
|
|
41726
|
+
var gotoSubstring = goToRegex.exec(label.textContent)[1];
|
|
41727
|
+
var gotoIndex = goToRegex.exec(label.textContent)[2];
|
|
41540
41728
|
label.setAttribute('goToStep', gotoIndex);
|
|
41541
41729
|
guideMarkdownUtil.removeMarkdownSyntax(label, gotoSubstring, '', pendo);
|
|
41542
41730
|
});
|
|
41543
|
-
|
|
41731
|
+
var pollChoiceContainer = step.guideElement.find("[data-pendo-poll-id=".concat(dataPendoPollId, "]._pendo-multi-choice-poll-select-border"));
|
|
41544
41732
|
if (pollChoiceContainer && pollChoiceContainer.length) {
|
|
41545
41733
|
pollChoiceContainer[0].setAttribute('branching', '');
|
|
41546
41734
|
}
|
|
@@ -41549,24 +41737,24 @@ function initialBranchingSetup(step, pendo) {
|
|
|
41549
41737
|
}
|
|
41550
41738
|
function branchingGoToStep(event, step, guide, pendo) {
|
|
41551
41739
|
var _a;
|
|
41552
|
-
|
|
41553
|
-
|
|
41554
|
-
|
|
41555
|
-
|
|
41740
|
+
var checkedPollInputId = (_a = step.guideElement.find('[branching] input.pendo-radio[data-pendo-poll-id]:checked')[0]) === null || _a === void 0 ? void 0 : _a.id;
|
|
41741
|
+
var checkedPollLabel = step.guideElement.find("label[for=\"".concat(checkedPollInputId, "\"]"))[0];
|
|
41742
|
+
var checkedPollLabelStepIndex = checkedPollLabel === null || checkedPollLabel === void 0 ? void 0 : checkedPollLabel.getAttribute('goToStep');
|
|
41743
|
+
var pollStepIndex = checkedPollLabelStepIndex - 1;
|
|
41556
41744
|
if (pollStepIndex < 0)
|
|
41557
41745
|
return;
|
|
41558
|
-
|
|
41746
|
+
var destinationObject = {
|
|
41559
41747
|
destinationStepId: guide.steps[pollStepIndex].id,
|
|
41560
|
-
step
|
|
41748
|
+
step: step
|
|
41561
41749
|
};
|
|
41562
41750
|
pendo.goToStep(destinationObject);
|
|
41563
41751
|
event.cancel = true;
|
|
41564
41752
|
}
|
|
41565
41753
|
|
|
41566
|
-
|
|
41754
|
+
var MetadataSubstitution = {
|
|
41567
41755
|
name: 'MetadataSubstitution',
|
|
41568
|
-
script(step, guide, pendo) {
|
|
41569
|
-
|
|
41756
|
+
script: function (step, guide, pendo) {
|
|
41757
|
+
var placeholderData = findSubstitutableElements(pendo);
|
|
41570
41758
|
if (step.domJson) {
|
|
41571
41759
|
findSubstitutableUrlsInJson(step.domJson, placeholderData, pendo);
|
|
41572
41760
|
}
|
|
@@ -41574,22 +41762,22 @@ const MetadataSubstitution = {
|
|
|
41574
41762
|
pendo._.each(placeholderData, function (placeholder) {
|
|
41575
41763
|
processPlaceholder(placeholder, pendo);
|
|
41576
41764
|
});
|
|
41577
|
-
|
|
41578
|
-
|
|
41579
|
-
updateGuideContainer(containerId,
|
|
41765
|
+
var containerId = "pendo-g-".concat(step.id);
|
|
41766
|
+
var context_1 = step.guideElement;
|
|
41767
|
+
updateGuideContainer(containerId, context_1, pendo);
|
|
41580
41768
|
}
|
|
41581
41769
|
},
|
|
41582
|
-
designerListener(pendo) {
|
|
41583
|
-
|
|
41770
|
+
designerListener: function (pendo) {
|
|
41771
|
+
var target = pendo.dom.getBody();
|
|
41584
41772
|
if (pendo.designerv2) {
|
|
41585
41773
|
pendo.designerv2.runMetadataSubstitutionForDesignerPreview = function runMetadataSubstitutionForDesignerPreview() {
|
|
41586
41774
|
var _a;
|
|
41587
41775
|
if (!document.querySelector(guideMarkdownUtil.containerSelector))
|
|
41588
41776
|
return;
|
|
41589
|
-
|
|
41777
|
+
var step = (_a = pendo.designerv2.currentlyPreviewedGuide) === null || _a === void 0 ? void 0 : _a.steps[0];
|
|
41590
41778
|
if (!step)
|
|
41591
41779
|
return;
|
|
41592
|
-
|
|
41780
|
+
var placeholderData = findSubstitutableElements(pendo);
|
|
41593
41781
|
if (step.buildingBlocks) {
|
|
41594
41782
|
findSubstitutableUrlsInJson(step.buildingBlocks, placeholderData, pendo);
|
|
41595
41783
|
}
|
|
@@ -41599,32 +41787,32 @@ const MetadataSubstitution = {
|
|
|
41599
41787
|
return;
|
|
41600
41788
|
processPlaceholder(placeholder, pendo);
|
|
41601
41789
|
});
|
|
41602
|
-
|
|
41603
|
-
|
|
41604
|
-
updateGuideContainer(containerId,
|
|
41790
|
+
var containerId = "pendo-g-".concat(step.id);
|
|
41791
|
+
var context_2 = step.guideElement;
|
|
41792
|
+
updateGuideContainer(containerId, context_2, pendo);
|
|
41605
41793
|
}
|
|
41606
41794
|
};
|
|
41607
41795
|
}
|
|
41608
|
-
|
|
41796
|
+
var config = {
|
|
41609
41797
|
attributeFilter: ['data-layout'],
|
|
41610
41798
|
attributes: true,
|
|
41611
41799
|
childList: true,
|
|
41612
41800
|
characterData: true,
|
|
41613
41801
|
subtree: true
|
|
41614
41802
|
};
|
|
41615
|
-
|
|
41616
|
-
|
|
41803
|
+
var MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
|
|
41804
|
+
var observer = new MutationObserver(applySubstitutionIndicators);
|
|
41617
41805
|
observer.observe(target, config);
|
|
41618
41806
|
function applySubstitutionIndicators(mutations) {
|
|
41619
41807
|
pendo._.each(mutations, function (mutation) {
|
|
41620
41808
|
var _a;
|
|
41621
41809
|
if (mutation.addedNodes.length) {
|
|
41622
41810
|
if (document.querySelector(guideMarkdownUtil.containerSelector)) {
|
|
41623
|
-
|
|
41624
|
-
|
|
41811
|
+
var placeholderData = findSubstitutableElements(pendo);
|
|
41812
|
+
var step = (_a = pendo.designerv2.currentlyPreviewedGuide) === null || _a === void 0 ? void 0 : _a.steps[0];
|
|
41625
41813
|
if (!step)
|
|
41626
41814
|
return;
|
|
41627
|
-
|
|
41815
|
+
var pendoBlocks = step.buildingBlocks;
|
|
41628
41816
|
if (!pendo._.isUndefined(pendoBlocks)) {
|
|
41629
41817
|
findSubstitutableUrlsInJson(pendoBlocks, placeholderData, pendo);
|
|
41630
41818
|
}
|
|
@@ -41634,9 +41822,9 @@ const MetadataSubstitution = {
|
|
|
41634
41822
|
return;
|
|
41635
41823
|
processPlaceholder(placeholder, pendo);
|
|
41636
41824
|
});
|
|
41637
|
-
|
|
41638
|
-
|
|
41639
|
-
updateGuideContainer(containerId,
|
|
41825
|
+
var containerId = "pendo-g-".concat(step.id);
|
|
41826
|
+
var context_3 = step.guideElement;
|
|
41827
|
+
updateGuideContainer(containerId, context_3, pendo);
|
|
41640
41828
|
}
|
|
41641
41829
|
}
|
|
41642
41830
|
}
|
|
@@ -41645,18 +41833,18 @@ const MetadataSubstitution = {
|
|
|
41645
41833
|
}
|
|
41646
41834
|
};
|
|
41647
41835
|
function processPlaceholder(placeholder, pendo) {
|
|
41648
|
-
|
|
41649
|
-
|
|
41650
|
-
|
|
41836
|
+
var match;
|
|
41837
|
+
var data = placeholder.data, target = placeholder.target;
|
|
41838
|
+
var subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
|
|
41651
41839
|
while ((match = matchPlaceholder(placeholder, subRegex))) {
|
|
41652
|
-
|
|
41653
|
-
|
|
41840
|
+
var usedArrayPath = Array.isArray(match) && match.length >= 2;
|
|
41841
|
+
var currentStr = target === 'textContent'
|
|
41654
41842
|
? data[target]
|
|
41655
41843
|
: decodeURI((data.getAttribute && (target === 'href' || target === 'value') ? (data.getAttribute(target) || '') : data[target]));
|
|
41656
|
-
|
|
41844
|
+
var matched = usedArrayPath ? match : subRegex.exec(currentStr);
|
|
41657
41845
|
if (!matched)
|
|
41658
41846
|
continue;
|
|
41659
|
-
|
|
41847
|
+
var mdValue = getSubstituteValue(matched, pendo);
|
|
41660
41848
|
substituteMetadataByTarget(data, target, mdValue, matched);
|
|
41661
41849
|
}
|
|
41662
41850
|
}
|
|
@@ -41665,48 +41853,48 @@ function matchPlaceholder(placeholder, regex) {
|
|
|
41665
41853
|
return placeholder.data[placeholder.target].match(regex);
|
|
41666
41854
|
}
|
|
41667
41855
|
else {
|
|
41668
|
-
|
|
41856
|
+
var raw = placeholder.data.getAttribute && (placeholder.target === 'href' || placeholder.target === 'value')
|
|
41669
41857
|
? (placeholder.data.getAttribute(placeholder.target) || '')
|
|
41670
41858
|
: placeholder.data[placeholder.target];
|
|
41671
41859
|
return decodeURI(raw).match(regex);
|
|
41672
41860
|
}
|
|
41673
41861
|
}
|
|
41674
41862
|
function getMetadataValueCaseInsensitive(metadata, type, property) {
|
|
41675
|
-
|
|
41863
|
+
var kind = metadata && metadata[type];
|
|
41676
41864
|
if (!kind || typeof kind !== 'object')
|
|
41677
41865
|
return undefined;
|
|
41678
|
-
|
|
41866
|
+
var direct = Object.prototype.hasOwnProperty.call(kind, property) ? kind[property] : undefined;
|
|
41679
41867
|
if (direct !== undefined) {
|
|
41680
41868
|
return direct;
|
|
41681
41869
|
}
|
|
41682
|
-
|
|
41683
|
-
|
|
41684
|
-
|
|
41870
|
+
var propLower = property.toLowerCase();
|
|
41871
|
+
var key = Object.keys(kind).find(function (k) { return k.toLowerCase() === propLower; });
|
|
41872
|
+
var value = key !== undefined ? kind[key] : undefined;
|
|
41685
41873
|
return value;
|
|
41686
41874
|
}
|
|
41687
41875
|
function getSubstituteValue(match, pendo) {
|
|
41688
41876
|
if (pendo._.isUndefined(match[1]) || pendo._.isUndefined(match[2])) {
|
|
41689
41877
|
return;
|
|
41690
41878
|
}
|
|
41691
|
-
|
|
41692
|
-
|
|
41693
|
-
|
|
41879
|
+
var type = match[1];
|
|
41880
|
+
var property = match[2];
|
|
41881
|
+
var defaultValue = match[3];
|
|
41694
41882
|
if (pendo._.isUndefined(type) || pendo._.isUndefined(property)) {
|
|
41695
41883
|
return;
|
|
41696
41884
|
}
|
|
41697
|
-
|
|
41698
|
-
|
|
41885
|
+
var metadata = pendo.getSerializedMetadata();
|
|
41886
|
+
var mdValue = getMetadataValueCaseInsensitive(metadata, type, property);
|
|
41699
41887
|
if (mdValue === undefined || mdValue === null)
|
|
41700
41888
|
mdValue = defaultValue || '';
|
|
41701
41889
|
return mdValue;
|
|
41702
41890
|
}
|
|
41703
41891
|
function substituteMetadataByTarget(data, target, mdValue, matched) {
|
|
41704
|
-
|
|
41705
|
-
|
|
41892
|
+
var isElement = data && typeof data.getAttribute === 'function';
|
|
41893
|
+
var current = (target === 'href' || target === 'value') && isElement
|
|
41706
41894
|
? (data.getAttribute(target) || '')
|
|
41707
41895
|
: data[target];
|
|
41708
41896
|
if (target === 'href' || target === 'value') {
|
|
41709
|
-
|
|
41897
|
+
var safeValue = window.encodeURIComponent(String(mdValue === undefined || mdValue === null ? '' : mdValue));
|
|
41710
41898
|
data[target] = decodeURI(current).replace(matched[0], safeValue);
|
|
41711
41899
|
}
|
|
41712
41900
|
else {
|
|
@@ -41720,8 +41908,9 @@ function updateGuideContainer(containerId, context, pendo) {
|
|
|
41720
41908
|
pendo.flexElement(pendo.dom(guideMarkdownUtil.containerSelector));
|
|
41721
41909
|
pendo.BuildingBlocks.BuildingBlockGuides.recalculateGuideHeight(containerId, context);
|
|
41722
41910
|
}
|
|
41723
|
-
function findSubstitutableUrlsInJson(originalData, placeholderData
|
|
41724
|
-
|
|
41911
|
+
function findSubstitutableUrlsInJson(originalData, placeholderData, pendo) {
|
|
41912
|
+
if (placeholderData === void 0) { placeholderData = []; }
|
|
41913
|
+
var subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
|
|
41725
41914
|
if ((originalData.name === 'url' || originalData.name === 'href') && originalData.value) {
|
|
41726
41915
|
if (subRegex.test(originalData.value)) {
|
|
41727
41916
|
placeholderData.push({
|
|
@@ -41731,37 +41920,37 @@ function findSubstitutableUrlsInJson(originalData, placeholderData = [], pendo)
|
|
|
41731
41920
|
}
|
|
41732
41921
|
}
|
|
41733
41922
|
if (originalData.properties && originalData.id === 'href_link_block') {
|
|
41734
|
-
pendo._.each(originalData.properties, (prop)
|
|
41923
|
+
pendo._.each(originalData.properties, function (prop) {
|
|
41735
41924
|
findSubstitutableUrlsInJson(prop, placeholderData, pendo);
|
|
41736
41925
|
});
|
|
41737
41926
|
}
|
|
41738
41927
|
if (originalData.views) {
|
|
41739
|
-
pendo._.each(originalData.views, (view)
|
|
41928
|
+
pendo._.each(originalData.views, function (view) {
|
|
41740
41929
|
findSubstitutableUrlsInJson(view, placeholderData, pendo);
|
|
41741
41930
|
});
|
|
41742
41931
|
}
|
|
41743
41932
|
if (originalData.parameters) {
|
|
41744
|
-
pendo._.each(originalData.parameters, (param)
|
|
41933
|
+
pendo._.each(originalData.parameters, function (param) {
|
|
41745
41934
|
findSubstitutableUrlsInJson(param, placeholderData, pendo);
|
|
41746
41935
|
});
|
|
41747
41936
|
}
|
|
41748
41937
|
if (originalData.actions) {
|
|
41749
|
-
pendo._.each(originalData.actions, (action)
|
|
41938
|
+
pendo._.each(originalData.actions, function (action) {
|
|
41750
41939
|
findSubstitutableUrlsInJson(action, placeholderData, pendo);
|
|
41751
41940
|
});
|
|
41752
41941
|
}
|
|
41753
41942
|
if (originalData.children) {
|
|
41754
|
-
pendo._.each(originalData.children, (child)
|
|
41943
|
+
pendo._.each(originalData.children, function (child) {
|
|
41755
41944
|
findSubstitutableUrlsInJson(child, placeholderData, pendo);
|
|
41756
41945
|
});
|
|
41757
41946
|
}
|
|
41758
41947
|
return placeholderData;
|
|
41759
41948
|
}
|
|
41760
41949
|
function findSubstitutableElements(pendo) {
|
|
41761
|
-
|
|
41950
|
+
var elements = pendo.dom("".concat(guideMarkdownUtil.containerSelector, " *:not(.pendo-inline-ui)"));
|
|
41762
41951
|
return pendo._.chain(elements)
|
|
41763
41952
|
.filter(function (placeholder) {
|
|
41764
|
-
|
|
41953
|
+
var subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
|
|
41765
41954
|
if (placeholder.localName === 'a') {
|
|
41766
41955
|
return subRegex.test(decodeURI(placeholder.href)) || subRegex.test(placeholder.textContent);
|
|
41767
41956
|
}
|
|
@@ -41817,51 +42006,25 @@ function findSubstitutableElements(pendo) {
|
|
|
41817
42006
|
.value();
|
|
41818
42007
|
}
|
|
41819
42008
|
function substitutionIcon(color, size) {
|
|
41820
|
-
return (
|
|
41821
|
-
|
|
41822
|
-
|
|
41823
|
-
|
|
41824
|
-
|
|
41825
|
-
|
|
41826
|
-
transform="matrix(1, 0, 0, 1, 0, 0)rotate(0)">
|
|
41827
|
-
<g stroke-width="0"></g>
|
|
41828
|
-
<g stroke-linecap="round" stroke-linejoin="round"
|
|
41829
|
-
stroke="${color}" stroke-width="0.528"></g>
|
|
41830
|
-
<g><path fill-rule="evenodd" clip-rule="evenodd"
|
|
41831
|
-
d="M5 5.5C4.17157 5.5 3.5 6.17157 3.5 7V10C3.5 10.8284
|
|
41832
|
-
4.17157 11.5 5 11.5H8C8.82843 11.5 9.5 10.8284 9.5
|
|
41833
|
-
10V9H17V11C17 11.2761 17.2239 11.5 17.5 11.5C17.7761
|
|
41834
|
-
11.5 18 11.2761 18 11V8.5C18 8.22386 17.7761 8 17.5
|
|
41835
|
-
8H9.5V7C9.5 6.17157 8.82843 5.5 8 5.5H5ZM8.5 7C8.5
|
|
41836
|
-
6.72386 8.27614 6.5 8 6.5H5C4.72386 6.5 4.5 6.72386
|
|
41837
|
-
4.5 7V10C4.5 10.2761 4.72386 10.5 5 10.5H8C8.27614
|
|
41838
|
-
10.5 8.5 10.2761 8.5 10V7Z" fill="${color}"></path>
|
|
41839
|
-
<path fill-rule="evenodd" clip-rule="evenodd"
|
|
41840
|
-
d="M7 13C7 12.7239 6.77614 12.5 6.5 12.5C6.22386 12.5
|
|
41841
|
-
6 12.7239 6 13V15.5C6 15.7761 6.22386 16 6.5
|
|
41842
|
-
16H14.5V17C14.5 17.8284 15.1716 18.5 16 18.5H19C19.8284
|
|
41843
|
-
18.5 20.5 17.8284 20.5 17V14C20.5 13.1716 19.8284 12.5
|
|
41844
|
-
19 12.5H16C15.1716 12.5 14.5 13.1716 14.5
|
|
41845
|
-
14V15H7V13ZM15.5 17C15.5 17.2761 15.7239 17.5 16
|
|
41846
|
-
17.5H19C19.2761 17.5 19.5 17.2761 19.5 17V14C19.5
|
|
41847
|
-
13.7239 19.2761 13.5 19 13.5H16C15.7239 13.5 15.5
|
|
41848
|
-
13.7239 15.5 14V17Z" fill="${color}"></path> </g></svg></div>`);
|
|
41849
|
-
}
|
|
41850
|
-
|
|
41851
|
-
const requiredElement = '<span class="_pendo-required-indicator" style="color:red; font-style:italic;" title="Question is required"> *</span>';
|
|
41852
|
-
const requiredSyntax = '{required/}';
|
|
41853
|
-
const RequiredQuestions = {
|
|
42009
|
+
return ("<div title=\"Metadata Substitution added\">\n <svg id=\"pendo-ps-substitution-icon\" viewBox=\"0 0 24 24\"\n preserveAspectRatio=\"xMidYMid meet\"\n height=".concat(size, " width=").concat(size, " title=\"Metadata Substitution\"\n style=\"bottom:5px; right:10px; position: absolute;\"\n fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" stroke=\"").concat(color, "\"\n transform=\"matrix(1, 0, 0, 1, 0, 0)rotate(0)\">\n <g stroke-width=\"0\"></g>\n <g stroke-linecap=\"round\" stroke-linejoin=\"round\"\n stroke=\"").concat(color, "\" stroke-width=\"0.528\"></g>\n <g><path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\n d=\"M5 5.5C4.17157 5.5 3.5 6.17157 3.5 7V10C3.5 10.8284\n 4.17157 11.5 5 11.5H8C8.82843 11.5 9.5 10.8284 9.5\n 10V9H17V11C17 11.2761 17.2239 11.5 17.5 11.5C17.7761\n 11.5 18 11.2761 18 11V8.5C18 8.22386 17.7761 8 17.5\n 8H9.5V7C9.5 6.17157 8.82843 5.5 8 5.5H5ZM8.5 7C8.5\n 6.72386 8.27614 6.5 8 6.5H5C4.72386 6.5 4.5 6.72386\n 4.5 7V10C4.5 10.2761 4.72386 10.5 5 10.5H8C8.27614\n 10.5 8.5 10.2761 8.5 10V7Z\" fill=\"").concat(color, "\"></path>\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\n d=\"M7 13C7 12.7239 6.77614 12.5 6.5 12.5C6.22386 12.5\n 6 12.7239 6 13V15.5C6 15.7761 6.22386 16 6.5\n 16H14.5V17C14.5 17.8284 15.1716 18.5 16 18.5H19C19.8284\n 18.5 20.5 17.8284 20.5 17V14C20.5 13.1716 19.8284 12.5\n 19 12.5H16C15.1716 12.5 14.5 13.1716 14.5\n 14V15H7V13ZM15.5 17C15.5 17.2761 15.7239 17.5 16\n 17.5H19C19.2761 17.5 19.5 17.2761 19.5 17V14C19.5\n 13.7239 19.2761 13.5 19 13.5H16C15.7239 13.5 15.5\n 13.7239 15.5 14V17Z\" fill=\"").concat(color, "\"></path> </g></svg></div>"));
|
|
42010
|
+
}
|
|
42011
|
+
|
|
42012
|
+
var requiredElement = '<span class="_pendo-required-indicator" style="color:red; font-style:italic;" title="Question is required"> *</span>';
|
|
42013
|
+
var requiredSyntax = '{required/}';
|
|
42014
|
+
var RequiredQuestions = {
|
|
41854
42015
|
name: 'RequiredQuestions',
|
|
41855
|
-
script(step, guide, pendo) {
|
|
42016
|
+
script: function (step, guide, pendo) {
|
|
41856
42017
|
var _a;
|
|
41857
|
-
|
|
41858
|
-
|
|
41859
|
-
|
|
42018
|
+
var requiredPollIds = [];
|
|
42019
|
+
var submitButtons = (_a = guideMarkdownUtil.lookupGuideButtons(step.domJson)) === null || _a === void 0 ? void 0 : _a.filter(function (button) {
|
|
42020
|
+
return button.actions.find(function (action) { return action.action === 'submitPoll' || action.action === 'submitPollAndGoToStep'; });
|
|
42021
|
+
});
|
|
42022
|
+
var requiredQuestions = processRequiredQuestions();
|
|
41860
42023
|
if (requiredQuestions) {
|
|
41861
|
-
pendo._.forEach(requiredQuestions, (question)
|
|
42024
|
+
pendo._.forEach(requiredQuestions, function (question) {
|
|
41862
42025
|
if (question.classList.contains('_pendo-open-text-poll-question')) {
|
|
41863
|
-
|
|
41864
|
-
step.attachEvent(step.guideElement.find(
|
|
42026
|
+
var pollId = question.dataset.pendoPollId;
|
|
42027
|
+
step.attachEvent(step.guideElement.find("[data-pendo-poll-id=".concat(pollId, "]._pendo-open-text-poll-input"))[0], 'input', function () {
|
|
41865
42028
|
evaluateRequiredQuestions(requiredQuestions);
|
|
41866
42029
|
});
|
|
41867
42030
|
}
|
|
@@ -41873,36 +42036,49 @@ const RequiredQuestions = {
|
|
|
41873
42036
|
});
|
|
41874
42037
|
}
|
|
41875
42038
|
function getEligibleQuestions() {
|
|
41876
|
-
|
|
41877
|
-
|
|
42039
|
+
var pollQuestions = pendo._.toArray(step.guideElement.find("[class*=-poll-question]:contains(".concat(requiredSyntax, ")")));
|
|
42040
|
+
var surveyMatches = pendo._.toArray(step.guideElement.find("[data-pendo-poll-id]:contains(".concat(requiredSyntax, ")")));
|
|
42041
|
+
var surveyQuestions = pendo._.filter(surveyMatches, function (candidate) {
|
|
42042
|
+
return !pendo._.some(surveyMatches, function (other) { return other !== candidate && candidate.contains(other); });
|
|
42043
|
+
});
|
|
42044
|
+
var allQuestions = pendo._.uniq(pollQuestions.concat(surveyQuestions));
|
|
42045
|
+
return pendo._.reduce(allQuestions, function (eligibleQuestions, question) {
|
|
41878
42046
|
if (question.classList.contains('_pendo-yes-no-poll-question'))
|
|
41879
42047
|
return eligibleQuestions;
|
|
41880
42048
|
eligibleQuestions.push(question);
|
|
41881
42049
|
return eligibleQuestions;
|
|
41882
42050
|
}, []);
|
|
41883
42051
|
}
|
|
42052
|
+
function ownsRequiredText(element) {
|
|
42053
|
+
return pendo._.some(element.childNodes, function (node) {
|
|
42054
|
+
return node.nodeType === 3 && node.nodeValue && node.nodeValue.indexOf(requiredSyntax) !== -1;
|
|
42055
|
+
});
|
|
42056
|
+
}
|
|
41884
42057
|
function processRequiredQuestions() {
|
|
41885
|
-
|
|
42058
|
+
var questions = getEligibleQuestions();
|
|
41886
42059
|
if (questions) {
|
|
41887
|
-
pendo._.forEach(questions, question
|
|
41888
|
-
|
|
42060
|
+
pendo._.forEach(questions, function (question) {
|
|
42061
|
+
var dataPendoPollId = question.getAttribute('data-pendo-poll-id');
|
|
41889
42062
|
requiredPollIds.push(dataPendoPollId);
|
|
41890
|
-
|
|
42063
|
+
var candidates = step.guideElement.find("#".concat(question.id, " *, #").concat(question.id));
|
|
42064
|
+
var textHost = pendo._.find(candidates, ownsRequiredText) || question;
|
|
42065
|
+
pendo._.each(candidates, function (element) {
|
|
41891
42066
|
guideMarkdownUtil.removeMarkdownSyntax(element, requiredSyntax, '', pendo);
|
|
41892
42067
|
});
|
|
41893
|
-
|
|
42068
|
+
var textHostEl = pendo.dom(textHost);
|
|
42069
|
+
if (textHostEl.find('._pendo-required-indicator').length === 0) {
|
|
42070
|
+
var questionParagraph = textHostEl.find('p');
|
|
42071
|
+
if (questionParagraph && questionParagraph.length) {
|
|
42072
|
+
pendo.dom(questionParagraph[0]).append(requiredElement);
|
|
42073
|
+
}
|
|
42074
|
+
else {
|
|
42075
|
+
textHostEl.append(requiredElement);
|
|
42076
|
+
}
|
|
42077
|
+
}
|
|
41894
42078
|
});
|
|
41895
42079
|
}
|
|
41896
42080
|
if (pendo._.size(requiredPollIds)) {
|
|
41897
|
-
|
|
41898
|
-
id=_pendo-guide-required-disabled>
|
|
41899
|
-
._pendo-button:disabled, ._pendo-buttons[disabled] {
|
|
41900
|
-
border: 1px solid #999999 !important;
|
|
41901
|
-
background-color: #cccccc !important;
|
|
41902
|
-
color: #666666 !important;
|
|
41903
|
-
pointer-events: none !important;
|
|
41904
|
-
}
|
|
41905
|
-
</style>`;
|
|
42081
|
+
var disabledButtonStyles = "<style type=text/css\n id=_pendo-guide-required-disabled>\n ._pendo-button:disabled, ._pendo-buttons[disabled] {\n border: 1px solid #999999 !important;\n background-color: #cccccc !important;\n color: #666666 !important;\n pointer-events: none !important;\n }\n </style>";
|
|
41906
42082
|
if (pendo.dom('#_pendo-guide-required-disabled').length === 0) {
|
|
41907
42083
|
pendo.dom('head').append(disabledButtonStyles);
|
|
41908
42084
|
}
|
|
@@ -41913,15 +42089,11 @@ const RequiredQuestions = {
|
|
|
41913
42089
|
function evaluateRequiredQuestions(questions) {
|
|
41914
42090
|
if (questions.length === 0)
|
|
41915
42091
|
return;
|
|
41916
|
-
|
|
41917
|
-
|
|
41918
|
-
responses = responses.concat(pendo._.map(questions, (question)
|
|
41919
|
-
|
|
41920
|
-
|
|
41921
|
-
[data-pendo-poll-id=${pollId}] textarea,
|
|
41922
|
-
[data-pendo-poll-id=${pollId}] input:text,
|
|
41923
|
-
[data-pendo-poll-id=${pollId}] select,
|
|
41924
|
-
[data-pendo-poll-id=${pollId}] input:radio:checked`);
|
|
42092
|
+
var allRequiredComplete = true;
|
|
42093
|
+
var responses = [];
|
|
42094
|
+
responses = responses.concat(pendo._.map(questions, function (question) {
|
|
42095
|
+
var pollId = question.getAttribute('data-pendo-poll-id');
|
|
42096
|
+
var input = step.guideElement.find("\n [data-pendo-poll-id=".concat(pollId, "] textarea,\n [data-pendo-poll-id=").concat(pollId, "] input:text,\n [data-pendo-poll-id=").concat(pollId, "] select,\n [data-pendo-poll-id=").concat(pollId, "] input:radio:checked"));
|
|
41925
42097
|
if (input && input.length && input[0].value) {
|
|
41926
42098
|
return input[0].value;
|
|
41927
42099
|
}
|
|
@@ -41938,48 +42110,50 @@ const RequiredQuestions = {
|
|
|
41938
42110
|
}
|
|
41939
42111
|
function disableEligibleButtons(buttons) {
|
|
41940
42112
|
pendo._.each(buttons, function (button) {
|
|
41941
|
-
if (step.guideElement.find(
|
|
41942
|
-
step.guideElement.find(
|
|
41943
|
-
step.guideElement.find(
|
|
42113
|
+
if (step.guideElement.find("#".concat(button.props.id))[0]) {
|
|
42114
|
+
step.guideElement.find("#".concat(button.props.id))[0].disabled = true;
|
|
42115
|
+
step.guideElement.find("#".concat(button.props.id))[0].parentElement.title = 'Please complete all required questions.';
|
|
41944
42116
|
}
|
|
41945
42117
|
});
|
|
41946
42118
|
}
|
|
41947
42119
|
function enableEligibleButtons(buttons) {
|
|
41948
42120
|
pendo._.each(buttons, function (button) {
|
|
41949
|
-
if (step.guideElement.find(
|
|
41950
|
-
step.guideElement.find(
|
|
41951
|
-
step.guideElement.find(
|
|
42121
|
+
if (step.guideElement.find("#".concat(button.props.id))[0]) {
|
|
42122
|
+
step.guideElement.find("#".concat(button.props.id))[0].disabled = false;
|
|
42123
|
+
step.guideElement.find("#".concat(button.props.id))[0].parentElement.title = '';
|
|
41952
42124
|
}
|
|
41953
42125
|
});
|
|
41954
42126
|
}
|
|
41955
42127
|
},
|
|
41956
|
-
test(step, guide, pendo) {
|
|
41957
|
-
var _a;
|
|
41958
|
-
|
|
41959
|
-
|
|
42128
|
+
test: function (step, guide, pendo) {
|
|
42129
|
+
var _a, _b;
|
|
42130
|
+
var pollQuestions = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find("[class*=-poll-question]:contains(".concat(requiredSyntax, ")"));
|
|
42131
|
+
var surveyQuestions = (_b = step.guideElement) === null || _b === void 0 ? void 0 : _b.find("[data-pendo-poll-id]:contains(".concat(requiredSyntax, ")"));
|
|
42132
|
+
return (!pendo._.isUndefined(pollQuestions) && pendo._.size(pollQuestions)) ||
|
|
42133
|
+
(!pendo._.isUndefined(surveyQuestions) && pendo._.size(surveyQuestions));
|
|
41960
42134
|
},
|
|
41961
|
-
designerListener(pendo) {
|
|
41962
|
-
|
|
41963
|
-
|
|
41964
|
-
|
|
42135
|
+
designerListener: function (pendo) {
|
|
42136
|
+
var requiredQuestions = [];
|
|
42137
|
+
var target = pendo.dom.getBody();
|
|
42138
|
+
var config = {
|
|
41965
42139
|
attributeFilter: ['data-layout'],
|
|
41966
42140
|
attributes: true,
|
|
41967
42141
|
childList: true,
|
|
41968
42142
|
characterData: true,
|
|
41969
42143
|
subtree: true
|
|
41970
42144
|
};
|
|
41971
|
-
|
|
41972
|
-
|
|
42145
|
+
var MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
|
|
42146
|
+
var observer = new MutationObserver(applyRequiredIndicators);
|
|
41973
42147
|
observer.observe(target, config);
|
|
41974
42148
|
function applyRequiredIndicators(mutations) {
|
|
41975
42149
|
pendo._.each(mutations, function (mutation) {
|
|
41976
42150
|
var _a;
|
|
41977
|
-
|
|
42151
|
+
var nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll);
|
|
41978
42152
|
if (mutation.addedNodes.length && nodeHasQuerySelector) {
|
|
41979
|
-
|
|
42153
|
+
var eligiblePolls = mutation.addedNodes[0].querySelectorAll('[class*=-poll-wrapper], [class*=-poll-select-border], [id^=survey-item-wrapper__]');
|
|
41980
42154
|
if (eligiblePolls) {
|
|
41981
42155
|
pendo._.each(eligiblePolls, function (poll) {
|
|
41982
|
-
|
|
42156
|
+
var dataPendoPollId;
|
|
41983
42157
|
if (poll.classList.contains('_pendo-open-text-poll-wrapper') ||
|
|
41984
42158
|
poll.classList.contains('_pendo-number-scale-poll-wrapper')) {
|
|
41985
42159
|
dataPendoPollId = poll.getAttribute('name');
|
|
@@ -41987,30 +42161,31 @@ const RequiredQuestions = {
|
|
|
41987
42161
|
else {
|
|
41988
42162
|
dataPendoPollId = poll.getAttribute('data-pendo-poll-id');
|
|
41989
42163
|
}
|
|
41990
|
-
|
|
41991
|
-
|
|
41992
|
-
|
|
41993
|
-
|
|
42164
|
+
var questionText;
|
|
42165
|
+
var questionElement = pendo.dom("[class*=\"-poll-question\"][data-pendo-poll-id=".concat(dataPendoPollId, "]"))[0] ||
|
|
42166
|
+
pendo.dom(".bb-text[data-pendo-poll-id=".concat(dataPendoPollId, "]"))[0];
|
|
42167
|
+
if (questionElement) {
|
|
42168
|
+
questionText = questionElement.textContent;
|
|
41994
42169
|
}
|
|
41995
|
-
|
|
42170
|
+
var requiredSyntaxIndex = questionText ? questionText.indexOf(requiredSyntax) : -1;
|
|
41996
42171
|
if (requiredSyntaxIndex > -1) {
|
|
41997
|
-
pendo._.each(pendo.dom(
|
|
41998
|
-
pendo._.each(pendo.dom(
|
|
42172
|
+
pendo._.each(pendo.dom("[data-pendo-poll-id=".concat(dataPendoPollId, "]:not(.pendo-radio)")), function (element) {
|
|
42173
|
+
pendo._.each(pendo.dom("#".concat(element.id, " *:not(\".pendo-radio\"), #").concat(element.id, ":not(\".pendo-radio\")")), function (item) {
|
|
41999
42174
|
guideMarkdownUtil.removeMarkdownSyntax(item, requiredSyntax, '', pendo);
|
|
42000
42175
|
});
|
|
42001
42176
|
});
|
|
42002
|
-
|
|
42003
|
-
|
|
42004
|
-
|
|
42005
|
-
|
|
42006
|
-
pendo._.each(pendo.dom(
|
|
42007
|
-
pendo._.each(el.childNodes, (node)
|
|
42177
|
+
var pollTextSelector = ".bb-text[data-pendo-poll-id=".concat(dataPendoPollId, "]");
|
|
42178
|
+
var pollParagraphSelector = "".concat(pollTextSelector, " p");
|
|
42179
|
+
var pollListItemSelector = "".concat(pollTextSelector, " li");
|
|
42180
|
+
var pollIndicatorSelector = "".concat(pollTextSelector, " ._pendo-required-indicator");
|
|
42181
|
+
pendo._.each(pendo.dom("".concat(pollParagraphSelector, ", ").concat(pollListItemSelector)), function (el) {
|
|
42182
|
+
pendo._.each(el.childNodes, function (node) {
|
|
42008
42183
|
if (node.nodeType === 3 && node.nodeValue.indexOf(requiredSyntax) !== -1) {
|
|
42009
42184
|
node.nodeValue = node.nodeValue.split(requiredSyntax).join('');
|
|
42010
42185
|
}
|
|
42011
42186
|
});
|
|
42012
42187
|
});
|
|
42013
|
-
|
|
42188
|
+
var hasIndicator = pendo.dom(pollIndicatorSelector).length !== 0;
|
|
42014
42189
|
if (!hasIndicator) {
|
|
42015
42190
|
if (pendo.dom(pollParagraphSelector).length !== 0 || pendo.dom(pollListItemSelector).length !== 0) {
|
|
42016
42191
|
pendo.dom(pollParagraphSelector).append(requiredElement);
|
|
@@ -42021,7 +42196,7 @@ const RequiredQuestions = {
|
|
|
42021
42196
|
}
|
|
42022
42197
|
}
|
|
42023
42198
|
if (pendo._.contains(requiredQuestions, dataPendoPollId)) {
|
|
42024
|
-
|
|
42199
|
+
var questionIndex = requiredQuestions.indexOf(dataPendoPollId);
|
|
42025
42200
|
if (questionIndex !== -1) {
|
|
42026
42201
|
requiredQuestions.splice(questionIndex, 1);
|
|
42027
42202
|
}
|
|
@@ -42032,7 +42207,7 @@ const RequiredQuestions = {
|
|
|
42032
42207
|
}
|
|
42033
42208
|
else {
|
|
42034
42209
|
if (pendo._.contains(requiredQuestions, dataPendoPollId)) {
|
|
42035
|
-
|
|
42210
|
+
var index = requiredQuestions.indexOf(dataPendoPollId);
|
|
42036
42211
|
if (index !== -1) {
|
|
42037
42212
|
requiredQuestions.splice(index, 1);
|
|
42038
42213
|
}
|
|
@@ -42046,54 +42221,54 @@ const RequiredQuestions = {
|
|
|
42046
42221
|
}
|
|
42047
42222
|
};
|
|
42048
42223
|
|
|
42049
|
-
|
|
42050
|
-
|
|
42051
|
-
script(step, guide, pendo) {
|
|
42052
|
-
|
|
42053
|
-
|
|
42054
|
-
|
|
42055
|
-
|
|
42056
|
-
|
|
42224
|
+
var skipStepRegex = new RegExp(guideMarkdownUtil.skipStepString);
|
|
42225
|
+
var SkipToEligibleStep = {
|
|
42226
|
+
script: function (step, guide, pendo) {
|
|
42227
|
+
var isAdvanceIntercepted = false;
|
|
42228
|
+
var isPreviousIntercepted = false;
|
|
42229
|
+
var guideContainer = step.guideElement.find(guideMarkdownUtil.containerSelector);
|
|
42230
|
+
var guideContainerAriaLabel = guideContainer.attr('aria-label');
|
|
42231
|
+
var stepNumberOrAuto = skipStepRegex.exec(guideContainerAriaLabel)[1];
|
|
42057
42232
|
if (guideContainer) {
|
|
42058
42233
|
guideContainer.attr({ 'aria-label': guideContainer.attr('aria-label').replace(skipStepRegex, '') });
|
|
42059
42234
|
}
|
|
42060
|
-
this.on('beforeAdvance', (evt)
|
|
42235
|
+
this.on('beforeAdvance', function (evt) {
|
|
42061
42236
|
if (guide.getPositionOfStep(step) === guide.steps.length || pendo._.isUndefined(stepNumberOrAuto))
|
|
42062
42237
|
return; // exit on the last step of a guide or when we don't have an argument
|
|
42063
|
-
|
|
42238
|
+
var eligibleStep = findEligibleSkipStep(stepNumberOrAuto, 'next');
|
|
42064
42239
|
if (!isAdvanceIntercepted && stepNumberOrAuto) {
|
|
42065
42240
|
isAdvanceIntercepted = true;
|
|
42066
|
-
pendo.goToStep({ destinationStepId: eligibleStep.id, step });
|
|
42241
|
+
pendo.goToStep({ destinationStepId: eligibleStep.id, step: step });
|
|
42067
42242
|
evt.cancel = true;
|
|
42068
42243
|
}
|
|
42069
42244
|
});
|
|
42070
|
-
this.on('beforePrevious', (evt)
|
|
42245
|
+
this.on('beforePrevious', function (evt) {
|
|
42071
42246
|
if (pendo._.isUndefined(stepNumberOrAuto))
|
|
42072
42247
|
return;
|
|
42073
|
-
|
|
42248
|
+
var eligibleStep = findEligibleSkipStep(stepNumberOrAuto, 'previous');
|
|
42074
42249
|
if (!isPreviousIntercepted && stepNumberOrAuto) {
|
|
42075
42250
|
isPreviousIntercepted = true;
|
|
42076
|
-
pendo.goToStep({ destinationStepId: eligibleStep.id, step });
|
|
42251
|
+
pendo.goToStep({ destinationStepId: eligibleStep.id, step: step });
|
|
42077
42252
|
evt.cancel = true;
|
|
42078
42253
|
}
|
|
42079
42254
|
});
|
|
42080
42255
|
function findEligibleSkipStep(stepNumber, direction) {
|
|
42081
42256
|
// Find the next eligible step by using getPosition of step (1 based)
|
|
42082
42257
|
// getPosition - 2 gives the previous step
|
|
42083
|
-
|
|
42084
|
-
|
|
42258
|
+
var skipForwardStep = findStepOnPage(guide.getPositionOfStep(step), 'next', stepNumber);
|
|
42259
|
+
var skipPreviousStep = findStepOnPage(guide.getPositionOfStep(step) - 2, 'previous', stepNumber);
|
|
42085
42260
|
if (skipForwardStep && direction == 'next') {
|
|
42086
|
-
pendo.goToStep({ destinationStepId: skipForwardStep, step });
|
|
42261
|
+
pendo.goToStep({ destinationStepId: skipForwardStep, step: step });
|
|
42087
42262
|
}
|
|
42088
42263
|
if (skipPreviousStep && direction == 'previous') {
|
|
42089
|
-
pendo.goToStep({ destinationStepId: skipPreviousStep, step });
|
|
42264
|
+
pendo.goToStep({ destinationStepId: skipPreviousStep, step: step });
|
|
42090
42265
|
}
|
|
42091
42266
|
return direction === 'next' ? skipForwardStep : skipPreviousStep;
|
|
42092
42267
|
}
|
|
42093
42268
|
function findStepOnPage(stepIndex, direction, stepNumber) {
|
|
42094
42269
|
if (pendo._.isNaN(stepIndex))
|
|
42095
42270
|
return;
|
|
42096
|
-
|
|
42271
|
+
var $step = guide.steps[stepIndex];
|
|
42097
42272
|
if ($step && !$step.canShow()) {
|
|
42098
42273
|
if (stepNumber !== 'auto') {
|
|
42099
42274
|
return guide.steps[stepNumber - 1];
|
|
@@ -42110,34 +42285,34 @@ const SkipToEligibleStep = {
|
|
|
42110
42285
|
}
|
|
42111
42286
|
}
|
|
42112
42287
|
},
|
|
42113
|
-
test(step, guide, pendo) {
|
|
42288
|
+
test: function (step, guide, pendo) {
|
|
42114
42289
|
var _a;
|
|
42115
|
-
|
|
42290
|
+
var guideContainerAriaLabel = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find(guideMarkdownUtil.containerSelector).attr('aria-label');
|
|
42116
42291
|
return pendo._.isString(guideContainerAriaLabel) && guideContainerAriaLabel.indexOf('{skipStep') !== -1;
|
|
42117
42292
|
},
|
|
42118
|
-
designerListener(pendo) {
|
|
42119
|
-
|
|
42120
|
-
|
|
42293
|
+
designerListener: function (pendo) {
|
|
42294
|
+
var target = pendo.dom.getBody();
|
|
42295
|
+
var config = {
|
|
42121
42296
|
attributeFilter: ['data-layout'],
|
|
42122
42297
|
attributes: true,
|
|
42123
42298
|
childList: true,
|
|
42124
42299
|
characterData: true,
|
|
42125
42300
|
subtree: true
|
|
42126
42301
|
};
|
|
42127
|
-
|
|
42128
|
-
|
|
42302
|
+
var MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
|
|
42303
|
+
var observer = new MutationObserver(applySkipStepIndicator);
|
|
42129
42304
|
observer.observe(target, config);
|
|
42130
42305
|
// create an observer instance
|
|
42131
42306
|
function applySkipStepIndicator(mutations) {
|
|
42132
42307
|
pendo._.each(mutations, function (mutation) {
|
|
42133
42308
|
var _a, _b;
|
|
42134
|
-
|
|
42309
|
+
var nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll);
|
|
42135
42310
|
if (mutation.addedNodes.length && nodeHasQuerySelector) {
|
|
42136
|
-
|
|
42137
|
-
|
|
42311
|
+
var guideContainer = mutation.addedNodes[0].querySelectorAll(guideMarkdownUtil.containerSelector);
|
|
42312
|
+
var guideContainerAriaLabel = (_b = guideContainer[0]) === null || _b === void 0 ? void 0 : _b.getAttribute('aria-label');
|
|
42138
42313
|
if (guideContainerAriaLabel) {
|
|
42139
42314
|
if (guideContainerAriaLabel.match(skipStepRegex)) {
|
|
42140
|
-
|
|
42315
|
+
var fullSkipStepString = guideContainerAriaLabel.match(skipStepRegex)[0];
|
|
42141
42316
|
guideContainerAriaLabel.replace(fullSkipStepString, '');
|
|
42142
42317
|
if (!pendo.dom('#_pendoSkipIcon').length) {
|
|
42143
42318
|
pendo.dom(guideMarkdownUtil.containerSelector).append(skipIcon('#999', '30px').trim());
|
|
@@ -42148,48 +42323,30 @@ const SkipToEligibleStep = {
|
|
|
42148
42323
|
});
|
|
42149
42324
|
}
|
|
42150
42325
|
function skipIcon(color, size) {
|
|
42151
|
-
return (
|
|
42152
|
-
width="${size}" height="${size}" viewBox="0 0 512.000000 512.000000"
|
|
42153
|
-
preserveAspectRatio="xMidYMid meet" style="bottom:5px; right:10px; position: absolute;">
|
|
42154
|
-
<g transform="translate(0.000000,512.000000) scale(0.100000,-0.100000)"
|
|
42155
|
-
fill="${color}" stroke="none">
|
|
42156
|
-
<path d="M2185 4469 c-363 -38 -739 -186 -1034 -407 -95 -71 -273 -243 -357
|
|
42157
|
-
-343 -205 -246 -364 -577 -429 -897 -25 -121 -45 -288 -45 -373 l0 -49 160 0
|
|
42158
|
-
160 0 0 48 c0 26 5 88 10 137 68 593 417 1103 940 1374 1100 570 2418 -137
|
|
42159
|
-
2560 -1374 5 -49 10 -111 10 -137 l0 -47 -155 -3 -155 -3 235 -235 235 -236
|
|
42160
|
-
235 236 235 235 -155 3 -155 3 0 48 c0 27 -5 95 -10 152 -100 989 -878 1767
|
|
42161
|
-
-1869 1868 -117 12 -298 12 -416 0z"/>
|
|
42162
|
-
<path d="M320 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
|
|
42163
|
-
<path d="M960 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
|
|
42164
|
-
<path d="M1600 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
|
|
42165
|
-
<path d="M2240 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
|
|
42166
|
-
<path d="M2880 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
|
|
42167
|
-
<path d="M3840 1440 l0 -160 480 0 480 0 0 160 0 160 -480 0 -480 0 0 -160z"/>
|
|
42168
|
-
</g></svg></div>
|
|
42169
|
-
`);
|
|
42326
|
+
return ("<div title=\"Skip step added\"><svg id=\"_pendoSkipIcon\" version=\"1.0\" xmlns=\"http://www.w3.org/2000/svg\"\n width=\"".concat(size, "\" height=\"").concat(size, "\" viewBox=\"0 0 512.000000 512.000000\"\n preserveAspectRatio=\"xMidYMid meet\" style=\"bottom:5px; right:10px; position: absolute;\">\n <g transform=\"translate(0.000000,512.000000) scale(0.100000,-0.100000)\"\n fill=\"").concat(color, "\" stroke=\"none\">\n <path d=\"M2185 4469 c-363 -38 -739 -186 -1034 -407 -95 -71 -273 -243 -357\n -343 -205 -246 -364 -577 -429 -897 -25 -121 -45 -288 -45 -373 l0 -49 160 0\n 160 0 0 48 c0 26 5 88 10 137 68 593 417 1103 940 1374 1100 570 2418 -137\n 2560 -1374 5 -49 10 -111 10 -137 l0 -47 -155 -3 -155 -3 235 -235 235 -236\n 235 236 235 235 -155 3 -155 3 0 48 c0 27 -5 95 -10 152 -100 989 -878 1767\n -1869 1868 -117 12 -298 12 -416 0z\"/>\n <path d=\"M320 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z\"/>\n <path d=\"M960 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z\"/>\n <path d=\"M1600 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z\"/>\n <path d=\"M2240 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z\"/>\n <path d=\"M2880 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z\"/>\n <path d=\"M3840 1440 l0 -160 480 0 480 0 0 160 0 160 -480 0 -480 0 0 -160z\"/>\n </g></svg></div>\n "));
|
|
42170
42327
|
}
|
|
42171
42328
|
}
|
|
42172
42329
|
};
|
|
42173
42330
|
|
|
42174
42331
|
function GuideMarkdown() {
|
|
42175
|
-
|
|
42176
|
-
|
|
42177
|
-
|
|
42332
|
+
var guideMarkdown;
|
|
42333
|
+
var pluginApi;
|
|
42334
|
+
var globalPendo;
|
|
42178
42335
|
return {
|
|
42179
42336
|
name: 'GuideMarkdown',
|
|
42180
42337
|
initialize: init,
|
|
42181
|
-
teardown
|
|
42338
|
+
teardown: teardown
|
|
42182
42339
|
};
|
|
42183
42340
|
function init(pendo, PluginAPI) {
|
|
42184
42341
|
globalPendo = pendo;
|
|
42185
42342
|
pluginApi = PluginAPI;
|
|
42186
|
-
|
|
42187
|
-
|
|
42343
|
+
var configReader = PluginAPI.ConfigReader;
|
|
42344
|
+
var GUIDEMARKDOWN_CONFIG = 'guideMarkdown';
|
|
42188
42345
|
configReader.addOption(GUIDEMARKDOWN_CONFIG, [
|
|
42189
42346
|
configReader.sources.SNIPPET_SRC,
|
|
42190
42347
|
configReader.sources.PENDO_CONFIG_SRC
|
|
42191
42348
|
], false);
|
|
42192
|
-
|
|
42349
|
+
var markdownScriptsEnabled = configReader.get(GUIDEMARKDOWN_CONFIG);
|
|
42193
42350
|
if (!markdownScriptsEnabled)
|
|
42194
42351
|
return;
|
|
42195
42352
|
guideMarkdown = [PollBranching, MetadataSubstitution, RequiredQuestions, SkipToEligibleStep];
|
|
@@ -43228,8 +43385,8 @@ function Feedback() {
|
|
|
43228
43385
|
var widgetLoaded = false;
|
|
43229
43386
|
var feedbackAllowedProductId = '';
|
|
43230
43387
|
var initialized = false;
|
|
43231
|
-
|
|
43232
|
-
|
|
43388
|
+
var PING_COOKIE = 'feedback_ping_sent';
|
|
43389
|
+
var PING_COOKIE_EXPIRATION = 1000 * 60 * 60;
|
|
43233
43390
|
var overflowMediaQuery = '@media only screen and (max-device-width:1112px){#feedback-widget{overflow-y:scroll}}';
|
|
43234
43391
|
var slideIn = '@-webkit-keyframes pendoFeedbackSlideIn{from{opacity:0;transform:translate(145px,0) rotate(270deg) translateY(-50%)}to{opacity:1;transform:translate(50%,0) rotate(270deg) translateY(-50%)}}@keyframes pendoFeedbackSlideIn{from{opacity:0;transform:translate(145px,0) rotate(270deg) translateY(-50%)}to{opacity:1;transform:translate(50%,0) rotate(270deg) translateY(-50%)}}';
|
|
43235
43392
|
var slideInLeft = '@-webkit-keyframes pendoFeedbackSlideIn-left{from{opacity:0;transform:rotate(270deg) translateX(-55%) translateY(-55%)}to{opacity:1;transform:rotate(270deg) translateX(-55%) translateY(0)}}@keyframes pendoFeedbackSlideIn-left{from{opacity:0;transform:rotate(270deg) translateX(-55%) translateY(-55%)}to{opacity:1;transform:rotate(270deg) translateX(-55%) translateY(0)}}';
|
|
@@ -43249,28 +43406,28 @@ function Feedback() {
|
|
|
43249
43406
|
feedbackStyles: 'pendo-feedback-styles',
|
|
43250
43407
|
feedbackFrameStyles: 'pendo-feedback-visible-buttons-styles'
|
|
43251
43408
|
};
|
|
43252
|
-
|
|
43253
|
-
|
|
43409
|
+
var globalPendo;
|
|
43410
|
+
var pluginApi;
|
|
43254
43411
|
return {
|
|
43255
43412
|
name: 'Feedback',
|
|
43256
|
-
initialize,
|
|
43257
|
-
teardown,
|
|
43258
|
-
validate
|
|
43413
|
+
initialize: initialize,
|
|
43414
|
+
teardown: teardown,
|
|
43415
|
+
validate: validate
|
|
43259
43416
|
};
|
|
43260
43417
|
function initialize(pendo, PluginAPI) {
|
|
43261
43418
|
globalPendo = pendo;
|
|
43262
43419
|
pluginApi = PluginAPI;
|
|
43263
43420
|
var publicFeedback = {
|
|
43264
|
-
ping,
|
|
43265
|
-
init,
|
|
43421
|
+
ping: ping,
|
|
43422
|
+
init: init,
|
|
43266
43423
|
initialized: getInitialized,
|
|
43267
|
-
loginAndRedirect,
|
|
43268
|
-
openFeedback,
|
|
43269
|
-
initializeFeedbackOnce,
|
|
43270
|
-
isFeedbackLoaded,
|
|
43271
|
-
convertPendoToFeedbackOptions,
|
|
43424
|
+
loginAndRedirect: loginAndRedirect,
|
|
43425
|
+
openFeedback: openFeedback,
|
|
43426
|
+
initializeFeedbackOnce: initializeFeedbackOnce,
|
|
43427
|
+
isFeedbackLoaded: isFeedbackLoaded,
|
|
43428
|
+
convertPendoToFeedbackOptions: convertPendoToFeedbackOptions,
|
|
43272
43429
|
isUnsupportedIE: pendo._.partial(isUnsupportedIE, PluginAPI),
|
|
43273
|
-
removeFeedbackWidget
|
|
43430
|
+
removeFeedbackWidget: removeFeedbackWidget
|
|
43274
43431
|
};
|
|
43275
43432
|
pendo.feedback = publicFeedback;
|
|
43276
43433
|
pendo.getFeedbackSettings = getFeedbackSettings;
|
|
@@ -43298,7 +43455,7 @@ function Feedback() {
|
|
|
43298
43455
|
*/
|
|
43299
43456
|
PluginAPI.agentStorage.registry.addLocal(PING_COOKIE, { duration: PING_COOKIE_EXPIRATION });
|
|
43300
43457
|
return {
|
|
43301
|
-
validate
|
|
43458
|
+
validate: validate
|
|
43302
43459
|
};
|
|
43303
43460
|
}
|
|
43304
43461
|
function teardown() {
|
|
@@ -43318,18 +43475,18 @@ function Feedback() {
|
|
|
43318
43475
|
return result;
|
|
43319
43476
|
}
|
|
43320
43477
|
function pingOrInitialize() {
|
|
43321
|
-
|
|
43478
|
+
var options = getPendoOptions();
|
|
43322
43479
|
if (initialized) {
|
|
43323
|
-
|
|
43480
|
+
var feedbackOptions = convertPendoToFeedbackOptions(options);
|
|
43324
43481
|
ping(feedbackOptions);
|
|
43325
43482
|
}
|
|
43326
43483
|
else if (shouldInitializeFeedback() && !globalPendo._.isEmpty(options)) {
|
|
43327
|
-
|
|
43328
|
-
init(options, settings)
|
|
43484
|
+
var settings = pluginApi.ConfigReader.get('feedbackSettings');
|
|
43485
|
+
init(options, settings)["catch"](globalPendo._.noop);
|
|
43329
43486
|
}
|
|
43330
43487
|
}
|
|
43331
43488
|
function handleIdentityChange(event) {
|
|
43332
|
-
|
|
43489
|
+
var visitorId = globalPendo._.get(event, 'data.0.visitor_id') || globalPendo._.get(event, 'data.0.options.visitor.id');
|
|
43333
43490
|
if (globalPendo.isAnonymousVisitor(visitorId)) {
|
|
43334
43491
|
removeFeedbackWidget();
|
|
43335
43492
|
return;
|
|
@@ -43399,9 +43556,9 @@ function Feedback() {
|
|
|
43399
43556
|
if (toSend.data && toSend.data !== '{}' && toSend.data !== 'null') {
|
|
43400
43557
|
return globalPendo.ajax
|
|
43401
43558
|
.postJSON(getFullUrl('/widget/pendo_ping'), toSend)
|
|
43402
|
-
.then((response)
|
|
43559
|
+
.then(function (response) {
|
|
43403
43560
|
onWidgetPingResponse(response);
|
|
43404
|
-
})
|
|
43561
|
+
})["catch"](function () { onPingFailure(); });
|
|
43405
43562
|
}
|
|
43406
43563
|
}
|
|
43407
43564
|
return pluginApi.q.resolve();
|
|
@@ -43535,10 +43692,10 @@ function Feedback() {
|
|
|
43535
43692
|
return globalPendo.ajax.postJSON(getFullUrl('/analytics'), toSend);
|
|
43536
43693
|
}
|
|
43537
43694
|
function addOverlay() {
|
|
43538
|
-
|
|
43695
|
+
var widget = globalPendo.dom("#".concat(elemIds.feedbackWidget));
|
|
43539
43696
|
if (!widget)
|
|
43540
43697
|
return;
|
|
43541
|
-
|
|
43698
|
+
var overlayStyles = {
|
|
43542
43699
|
'position': 'fixed',
|
|
43543
43700
|
'top': '0',
|
|
43544
43701
|
'right': '0',
|
|
@@ -43550,7 +43707,7 @@ function Feedback() {
|
|
|
43550
43707
|
'animation': 'pendoFeedbackFadeIn 0.5s 0s 1 alternate both',
|
|
43551
43708
|
'-webkit-animation': 'pendoFeedbackFadeIn 0.5s 0s 1 alternate both'
|
|
43552
43709
|
};
|
|
43553
|
-
|
|
43710
|
+
var overlayElement = globalPendo.dom(document.createElement('div'));
|
|
43554
43711
|
overlayElement.attr('id', 'feedback-overlay');
|
|
43555
43712
|
overlayElement.css(overlayStyles);
|
|
43556
43713
|
overlayElement.appendTo(widget.getParent());
|
|
@@ -43655,22 +43812,22 @@ function Feedback() {
|
|
|
43655
43812
|
}
|
|
43656
43813
|
}
|
|
43657
43814
|
function buildOuterTriggerDiv(positionInfo) {
|
|
43658
|
-
|
|
43659
|
-
|
|
43660
|
-
|
|
43815
|
+
var horizontalStyles = getHorizontalPositionStyles(positionInfo);
|
|
43816
|
+
var verticalStyles = getVerticalPositionStyles(positionInfo);
|
|
43817
|
+
var styles = globalPendo._.extend({
|
|
43661
43818
|
'position': 'fixed',
|
|
43662
43819
|
'height': '43px',
|
|
43663
43820
|
'opacity': '1 !important',
|
|
43664
43821
|
'z-index': '9001'
|
|
43665
43822
|
}, horizontalStyles, verticalStyles);
|
|
43666
|
-
|
|
43823
|
+
var outerTrigger = globalPendo.dom(document.createElement('div'));
|
|
43667
43824
|
outerTrigger.attr('id', elemIds.feedbackTrigger);
|
|
43668
43825
|
outerTrigger.css(styles);
|
|
43669
43826
|
outerTrigger.attr('data-turbolinks-permanent', '');
|
|
43670
43827
|
return outerTrigger;
|
|
43671
43828
|
}
|
|
43672
43829
|
function buildNotification() {
|
|
43673
|
-
|
|
43830
|
+
var styles = {
|
|
43674
43831
|
'background-color': '#D85039',
|
|
43675
43832
|
'color': '#fff',
|
|
43676
43833
|
'border-radius': '50%',
|
|
@@ -43687,20 +43844,20 @@ function Feedback() {
|
|
|
43687
43844
|
'animation-delay': '1s',
|
|
43688
43845
|
'animation-iteration-count': '1'
|
|
43689
43846
|
};
|
|
43690
|
-
|
|
43847
|
+
var notification = globalPendo.dom(document.createElement('span'));
|
|
43691
43848
|
notification.attr('id', 'feedback-trigger-notification');
|
|
43692
43849
|
notification.css(styles);
|
|
43693
43850
|
return notification;
|
|
43694
43851
|
}
|
|
43695
43852
|
function buildTriggerButton(settings, positionInfo) {
|
|
43696
|
-
|
|
43853
|
+
var borderRadius;
|
|
43697
43854
|
if (positionInfo.horizontalPosition === 'left') {
|
|
43698
43855
|
borderRadius = '0 0 5px 5px';
|
|
43699
43856
|
}
|
|
43700
43857
|
else {
|
|
43701
43858
|
borderRadius = '3px 3px 0 0';
|
|
43702
43859
|
}
|
|
43703
|
-
|
|
43860
|
+
var styles = {
|
|
43704
43861
|
'border': 'none',
|
|
43705
43862
|
'padding': '11px 18px 14px 18px',
|
|
43706
43863
|
'background-color': settings.triggerColor,
|
|
@@ -43711,32 +43868,21 @@ function Feedback() {
|
|
|
43711
43868
|
'cursor': 'pointer',
|
|
43712
43869
|
'text-align': 'left'
|
|
43713
43870
|
};
|
|
43714
|
-
|
|
43871
|
+
var triggerButton = globalPendo.dom(document.createElement('button'));
|
|
43715
43872
|
triggerButton.attr('id', elemIds.feedbackTriggerButton);
|
|
43716
43873
|
triggerButton.css(styles);
|
|
43717
43874
|
triggerButton.text(settings.triggerText);
|
|
43718
43875
|
return triggerButton;
|
|
43719
43876
|
}
|
|
43720
43877
|
function addTriggerPseudoStyles() {
|
|
43721
|
-
|
|
43722
|
-
#feedback-trigger button:hover {
|
|
43723
|
-
box-shadow: 0 -5px 20px rgba(0,0,0,.19) !important;
|
|
43724
|
-
outline: none !important;
|
|
43725
|
-
background: #3e566f !important;
|
|
43726
|
-
}
|
|
43727
|
-
#feedback-trigger button:focus {
|
|
43728
|
-
box-shadow: 0 -5px 20px rgba(0,0,0,.19) !important;
|
|
43729
|
-
outline: none !important;
|
|
43730
|
-
background: #3e566f !important;
|
|
43731
|
-
}
|
|
43732
|
-
`;
|
|
43878
|
+
var pseudoStyles = "\n #feedback-trigger button:hover {\n box-shadow: 0 -5px 20px rgba(0,0,0,.19) !important;\n outline: none !important;\n background: #3e566f !important;\n }\n #feedback-trigger button:focus {\n box-shadow: 0 -5px 20px rgba(0,0,0,.19) !important;\n outline: none !important;\n background: #3e566f !important;\n }\n ";
|
|
43733
43879
|
pluginApi.util.addInlineStyles('pendo-feedback-trigger-styles', pseudoStyles);
|
|
43734
43880
|
}
|
|
43735
43881
|
function createTrigger(settings, positionInfo) {
|
|
43736
43882
|
addTriggerPseudoStyles();
|
|
43737
|
-
|
|
43738
|
-
|
|
43739
|
-
|
|
43883
|
+
var triggerElement = buildOuterTriggerDiv(positionInfo);
|
|
43884
|
+
var notificationElement = buildNotification();
|
|
43885
|
+
var triggerButtonElement = buildTriggerButton(settings, positionInfo);
|
|
43740
43886
|
triggerElement.append(notificationElement);
|
|
43741
43887
|
triggerElement.append(triggerButtonElement);
|
|
43742
43888
|
triggerElement.appendTo(globalPendo.dom.getBody());
|
|
@@ -43760,7 +43906,7 @@ function Feedback() {
|
|
|
43760
43906
|
iframeWrapper.css(getWidgetOriginalStyles());
|
|
43761
43907
|
iframeWrapper.attr('id', elemIds.feedbackWidget);
|
|
43762
43908
|
iframeWrapper.attr('data-turbolinks-permanent', 'true');
|
|
43763
|
-
iframeWrapper.addClass(
|
|
43909
|
+
iframeWrapper.addClass("buttonIs-".concat(horizontalPosition));
|
|
43764
43910
|
return iframeWrapper;
|
|
43765
43911
|
}
|
|
43766
43912
|
function buildIframeContainer() {
|
|
@@ -43777,22 +43923,13 @@ function Feedback() {
|
|
|
43777
43923
|
return iframeContainer;
|
|
43778
43924
|
}
|
|
43779
43925
|
function addWidgetVisibleButtonStyles(buttonStylePosition) {
|
|
43780
|
-
|
|
43781
|
-
|
|
43782
|
-
.buttonIs-${side}.visible {
|
|
43783
|
-
${side}: 0 !important;
|
|
43784
|
-
width: 470px !important;
|
|
43785
|
-
animation-direction: alternate-reverse !important;
|
|
43786
|
-
animation: pendoFeedbackSlideFrom-${side} 0.5s 0s 1 alternate both !important;
|
|
43787
|
-
-webkit-animation: pendoFeedbackSlideFrom-${side} 0.5s 0s 1 alternate both !important;
|
|
43788
|
-
z-index: 9002 !important;
|
|
43789
|
-
}
|
|
43790
|
-
`;
|
|
43926
|
+
var side = buttonStylePosition === 'left' ? 'left' : 'right'; // just in case something was not left or right for some reason
|
|
43927
|
+
var styles = "\n .buttonIs-".concat(side, ".visible {\n ").concat(side, ": 0 !important;\n width: 470px !important;\n animation-direction: alternate-reverse !important;\n animation: pendoFeedbackSlideFrom-").concat(side, " 0.5s 0s 1 alternate both !important;\n -webkit-animation: pendoFeedbackSlideFrom-").concat(side, " 0.5s 0s 1 alternate both !important;\n z-index: 9002 !important;\n }\n ");
|
|
43791
43928
|
pluginApi.util.addInlineStyles(elemIds.feedbackFrameStyles, styles);
|
|
43792
43929
|
}
|
|
43793
43930
|
function initialiseWidgetFrame(horizontalPosition) {
|
|
43794
43931
|
addWidgetVisibleButtonStyles(horizontalPosition);
|
|
43795
|
-
|
|
43932
|
+
var iframeElement = buildIframeWrapper(horizontalPosition);
|
|
43796
43933
|
iframeElement.append(buildIframeContainer());
|
|
43797
43934
|
iframeElement.appendTo(globalPendo.dom.getBody());
|
|
43798
43935
|
subscribeToIframeMessages();
|
|
@@ -43816,7 +43953,7 @@ function Feedback() {
|
|
|
43816
43953
|
return widgetLoaded;
|
|
43817
43954
|
}
|
|
43818
43955
|
function getPendoOptions() {
|
|
43819
|
-
|
|
43956
|
+
var options = pluginApi.ConfigReader.getLocalConfig();
|
|
43820
43957
|
if (!globalPendo._.isObject(options))
|
|
43821
43958
|
options = {};
|
|
43822
43959
|
if (!globalPendo._.isObject(options.visitor))
|
|
@@ -43844,7 +43981,7 @@ function Feedback() {
|
|
|
43844
43981
|
return true;
|
|
43845
43982
|
}
|
|
43846
43983
|
function getQueryParam(url, paramName) {
|
|
43847
|
-
|
|
43984
|
+
var results = new RegExp('[?&]' + paramName + '=([^&#]*)').exec(url);
|
|
43848
43985
|
if (results == null) {
|
|
43849
43986
|
return null;
|
|
43850
43987
|
}
|
|
@@ -43861,13 +43998,13 @@ function Feedback() {
|
|
|
43861
43998
|
return pluginApi.q.reject();
|
|
43862
43999
|
if (!canInitFeedback(pendoOptions))
|
|
43863
44000
|
return pluginApi.q.reject();
|
|
43864
|
-
|
|
44001
|
+
var feedbackOptions = convertPendoToFeedbackOptions(pendoOptions);
|
|
43865
44002
|
try {
|
|
43866
|
-
|
|
43867
|
-
if (
|
|
44003
|
+
var fdbkDst_1 = getQueryParam(globalPendo.url.get(), 'fdbkDst');
|
|
44004
|
+
if (fdbkDst_1 && fdbkDst_1.startsWith('case')) {
|
|
43868
44005
|
initialized = true;
|
|
43869
44006
|
getFeedbackLoginUrl().then(function (loginUrl) {
|
|
43870
|
-
|
|
44007
|
+
var destinationUrl = loginUrl + '&fdbkDst=' + fdbkDst_1;
|
|
43871
44008
|
window.location.href = destinationUrl;
|
|
43872
44009
|
});
|
|
43873
44010
|
return;
|
|
@@ -43916,7 +44053,7 @@ function Feedback() {
|
|
|
43916
44053
|
function convertPendoToFeedbackOptions(options) {
|
|
43917
44054
|
var jwtOptions = pluginApi.agent.getJwtInfoCopy();
|
|
43918
44055
|
if (globalPendo._.isEmpty(jwtOptions)) {
|
|
43919
|
-
|
|
44056
|
+
var feedbackOptions = {};
|
|
43920
44057
|
feedbackOptions.user = globalPendo._.pick(options.visitor, 'id', 'full_name', 'firstName', 'lastName', 'email', 'tags', 'custom_allowed_products');
|
|
43921
44058
|
globalPendo._.extend(feedbackOptions.user, { allowed_products: [{ id: feedbackAllowedProductId }] });
|
|
43922
44059
|
feedbackOptions.account = globalPendo._.pick(options.account, 'id', 'name', 'monthly_value', 'is_paying', 'tags');
|
|
@@ -49506,6 +49643,17 @@ var SessionRecorderBuffer = /** @class */ (function () {
|
|
|
49506
49643
|
return SessionRecorderBuffer;
|
|
49507
49644
|
}());
|
|
49508
49645
|
|
|
49646
|
+
var __assign = function() {
|
|
49647
|
+
__assign = Object.assign || function __assign(t) {
|
|
49648
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
49649
|
+
s = arguments[i];
|
|
49650
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
49651
|
+
}
|
|
49652
|
+
return t;
|
|
49653
|
+
};
|
|
49654
|
+
return __assign.apply(this, arguments);
|
|
49655
|
+
};
|
|
49656
|
+
|
|
49509
49657
|
function __rest(s, e) {
|
|
49510
49658
|
var t = {};
|
|
49511
49659
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -49703,9 +49851,9 @@ var Transport = /** @class */ (function () {
|
|
|
49703
49851
|
return Transport;
|
|
49704
49852
|
}());
|
|
49705
49853
|
|
|
49706
|
-
|
|
49707
|
-
|
|
49708
|
-
|
|
49854
|
+
var ELEMENT_NODE = 1;
|
|
49855
|
+
var INPUT_MASK = '*'.repeat(10);
|
|
49856
|
+
var NUMBER_INPUT_MASK = '0'.repeat(10);
|
|
49709
49857
|
function isElementNode(node) {
|
|
49710
49858
|
if (!node)
|
|
49711
49859
|
return false;
|
|
@@ -49714,10 +49862,12 @@ function isElementNode(node) {
|
|
|
49714
49862
|
return true;
|
|
49715
49863
|
}
|
|
49716
49864
|
function getParent(elem) {
|
|
49717
|
-
|
|
49865
|
+
var isElementShadowRoot = typeof window.ShadowRoot !== 'undefined' && elem instanceof window.ShadowRoot && elem.host;
|
|
49718
49866
|
return isElementShadowRoot ? elem.host : elem.parentNode;
|
|
49719
49867
|
}
|
|
49720
|
-
function distanceToMatch(node, selector, limit
|
|
49868
|
+
function distanceToMatch(node, selector, limit, distance) {
|
|
49869
|
+
if (limit === void 0) { limit = Infinity; }
|
|
49870
|
+
if (distance === void 0) { distance = 0; }
|
|
49721
49871
|
if (distance > limit)
|
|
49722
49872
|
return -1;
|
|
49723
49873
|
if (!node)
|
|
@@ -49731,13 +49881,15 @@ function distanceToMatch(node, selector, limit = Infinity, distance = 0) {
|
|
|
49731
49881
|
return distanceToMatch(getParent(node), selector, limit, distance + 1);
|
|
49732
49882
|
}
|
|
49733
49883
|
function shouldMask(node, options) {
|
|
49734
|
-
|
|
49884
|
+
var maskAllText = options.maskAllText, maskTextSelector = options.maskTextSelector, unmaskTextSelector = options.unmaskTextSelector;
|
|
49735
49885
|
try {
|
|
49736
|
-
|
|
49886
|
+
var el = isElementNode(node) ? node : node.parentElement;
|
|
49737
49887
|
if (el === null)
|
|
49738
49888
|
return false;
|
|
49739
|
-
|
|
49740
|
-
|
|
49889
|
+
if ((el.tagName || '').toUpperCase() === 'STYLE')
|
|
49890
|
+
return false;
|
|
49891
|
+
var maskDistance = -1;
|
|
49892
|
+
var unmaskDistance = -1;
|
|
49741
49893
|
if (maskAllText) {
|
|
49742
49894
|
unmaskDistance = distanceToMatch(el, unmaskTextSelector);
|
|
49743
49895
|
if (unmaskDistance < 0) {
|
|
@@ -49770,8 +49922,8 @@ function isNumberInput(element) {
|
|
|
49770
49922
|
}
|
|
49771
49923
|
function shouldMaskInput(element, maskInputOptions) {
|
|
49772
49924
|
if (maskInputOptions && isElementNode(element)) {
|
|
49773
|
-
|
|
49774
|
-
|
|
49925
|
+
var tagName = (element.tagName || '').toLowerCase();
|
|
49926
|
+
var type = (element.type || '').toLowerCase();
|
|
49775
49927
|
if (maskInputOptions[tagName] || maskInputOptions[type]) {
|
|
49776
49928
|
return true;
|
|
49777
49929
|
}
|
|
@@ -51265,12 +51417,12 @@ var WorkerFactory = /*#__PURE__*/createInlineWorkerFactory(/* rollup-plugin-web-
|
|
|
51265
51417
|
}
|
|
51266
51418
|
}
|
|
51267
51419
|
|
|
51268
|
-
|
|
51420
|
+
var ONE_HUNDRED_MB_IN_BYTES = 100 * 1024 * 1024;
|
|
51269
51421
|
function matchHostedResources(recordingEvent, stringifiedRecordingPayload) {
|
|
51270
|
-
|
|
51271
|
-
|
|
51422
|
+
var fontURLRegex = /https:\/\/[^"\\\s]+?\.(woff2?|ttf|otf|eot)(\?[^"\\\s]*)?\b/g;
|
|
51423
|
+
var matches = stringifiedRecordingPayload.match(fontURLRegex);
|
|
51272
51424
|
// de-duplicate matches
|
|
51273
|
-
|
|
51425
|
+
var hostedResources = matches ? Array.from(new Set(matches)) : [];
|
|
51274
51426
|
return {
|
|
51275
51427
|
type: 'recording',
|
|
51276
51428
|
visitorId: recordingEvent.visitorId,
|
|
@@ -51285,7 +51437,7 @@ var WorkerFactory = /*#__PURE__*/createInlineWorkerFactory(/* rollup-plugin-web-
|
|
|
51285
51437
|
recordingPayloadMetadata: [],
|
|
51286
51438
|
sequence: 0,
|
|
51287
51439
|
recordingPayloadCount: 0,
|
|
51288
|
-
hostedResources
|
|
51440
|
+
hostedResources: hostedResources
|
|
51289
51441
|
};
|
|
51290
51442
|
}
|
|
51291
51443
|
// keep in mind changes here may need addressing in the extension worker proxy as well
|
|
@@ -51293,69 +51445,69 @@ var WorkerFactory = /*#__PURE__*/createInlineWorkerFactory(/* rollup-plugin-web-
|
|
|
51293
51445
|
try {
|
|
51294
51446
|
if (e.data.type === 'init' && e.data.lockID) {
|
|
51295
51447
|
if (navigator.locks) {
|
|
51296
|
-
navigator.locks.request(e.data.lockID, ()
|
|
51448
|
+
navigator.locks.request(e.data.lockID, function () {
|
|
51297
51449
|
postMessage({ ready: true });
|
|
51298
51450
|
// This unresolved promise keeps the lock held with the worker until the worker is
|
|
51299
51451
|
// terminated at which point the lock is released.
|
|
51300
|
-
return new Promise$2(()
|
|
51452
|
+
return new Promise$2(function () { });
|
|
51301
51453
|
});
|
|
51302
51454
|
}
|
|
51303
51455
|
return;
|
|
51304
51456
|
}
|
|
51305
51457
|
if (e.data.url && e.data.payload) {
|
|
51306
|
-
|
|
51458
|
+
var _a = e.data, url = _a.url, payload = _a.payload, shouldCacheResources = _a.shouldCacheResources;
|
|
51307
51459
|
if (Object.keys(payload).length === 0) {
|
|
51308
51460
|
postMessage({
|
|
51309
51461
|
type: 'emptyPayload'
|
|
51310
51462
|
});
|
|
51311
51463
|
}
|
|
51312
|
-
|
|
51313
|
-
|
|
51464
|
+
var sequence_1 = payload.sequence;
|
|
51465
|
+
var stringifiedRecordingPayload = JSON.stringify(payload.recordingPayload);
|
|
51314
51466
|
// calculate and post back the recording payload size before the payload is compressed
|
|
51315
|
-
|
|
51316
|
-
|
|
51467
|
+
var recordingPayloadSize = new TextEncoder().encode(stringifiedRecordingPayload).length;
|
|
51468
|
+
var exceedsPayloadSizeLimit = recordingPayloadSize >= ONE_HUNDRED_MB_IN_BYTES;
|
|
51317
51469
|
postMessage({
|
|
51318
51470
|
type: 'recordingPayloadSize',
|
|
51319
|
-
recordingPayloadSize,
|
|
51320
|
-
exceedsPayloadSizeLimit
|
|
51471
|
+
recordingPayloadSize: recordingPayloadSize,
|
|
51472
|
+
exceedsPayloadSizeLimit: exceedsPayloadSizeLimit
|
|
51321
51473
|
});
|
|
51322
51474
|
// don't attempt to send the payload if it exceeds the allowed limit
|
|
51323
51475
|
if (exceedsPayloadSizeLimit)
|
|
51324
51476
|
return;
|
|
51325
51477
|
if (shouldCacheResources) {
|
|
51326
|
-
|
|
51478
|
+
var hostedResourcesEvent = matchHostedResources(payload, stringifiedRecordingPayload);
|
|
51327
51479
|
if (hostedResourcesEvent.hostedResources.length) {
|
|
51328
51480
|
postMessage({
|
|
51329
51481
|
type: 'hostedResources',
|
|
51330
|
-
hostedResourcesEvent
|
|
51482
|
+
hostedResourcesEvent: hostedResourcesEvent
|
|
51331
51483
|
});
|
|
51332
51484
|
}
|
|
51333
51485
|
}
|
|
51334
51486
|
payload.recordingSize = recordingPayloadSize;
|
|
51335
|
-
|
|
51487
|
+
var body = compress(payload, 'binary');
|
|
51336
51488
|
// we want to calculate ct (current time) as close as we can to the actual POST request
|
|
51337
51489
|
// so that it's as accurate as possible
|
|
51338
|
-
url =
|
|
51490
|
+
url = "".concat(url, "&ct=").concat(new Date().getTime());
|
|
51339
51491
|
fetch(url, {
|
|
51340
51492
|
method: 'POST',
|
|
51341
|
-
body
|
|
51493
|
+
body: body
|
|
51342
51494
|
}).then(function (response) {
|
|
51343
51495
|
if (response.status < 200 || response.status >= 300) {
|
|
51344
51496
|
postMessage({
|
|
51345
|
-
error: new Error(
|
|
51497
|
+
error: new Error("received status code ".concat(response.status, ": ").concat(response.statusText)),
|
|
51346
51498
|
status: response.status,
|
|
51347
|
-
sequence
|
|
51499
|
+
sequence: sequence_1
|
|
51348
51500
|
});
|
|
51349
51501
|
}
|
|
51350
51502
|
else {
|
|
51351
51503
|
postMessage({
|
|
51352
|
-
sequence
|
|
51504
|
+
sequence: sequence_1
|
|
51353
51505
|
});
|
|
51354
51506
|
}
|
|
51355
|
-
})
|
|
51507
|
+
})["catch"](function (e) {
|
|
51356
51508
|
postMessage({
|
|
51357
51509
|
error: e,
|
|
51358
|
-
sequence
|
|
51510
|
+
sequence: sequence_1
|
|
51359
51511
|
});
|
|
51360
51512
|
});
|
|
51361
51513
|
}
|
|
@@ -51666,7 +51818,7 @@ function includes(str, substring) {
|
|
|
51666
51818
|
function getResourceType(blockedURI, directive) {
|
|
51667
51819
|
if (!directive || typeof directive !== 'string')
|
|
51668
51820
|
return 'resource';
|
|
51669
|
-
|
|
51821
|
+
var d = directive.toLowerCase();
|
|
51670
51822
|
if (blockedURI === 'inline') {
|
|
51671
51823
|
if (includes(d, 'script-src-attr')) {
|
|
51672
51824
|
return 'inline event handler';
|
|
@@ -51725,11 +51877,12 @@ function getResourceType(blockedURI, directive) {
|
|
|
51725
51877
|
function getDirective(policy, directiveName) {
|
|
51726
51878
|
if (!policy || !directiveName)
|
|
51727
51879
|
return '';
|
|
51728
|
-
|
|
51729
|
-
for (
|
|
51730
|
-
|
|
51731
|
-
|
|
51732
|
-
|
|
51880
|
+
var needle = directiveName.toLowerCase();
|
|
51881
|
+
for (var _i = 0, _a = policy.split(';'); _i < _a.length; _i++) {
|
|
51882
|
+
var directive = _a[_i];
|
|
51883
|
+
var trimmed = directive.trim();
|
|
51884
|
+
var lower = trimmed.toLowerCase();
|
|
51885
|
+
if (lower === needle || lower.startsWith("".concat(needle, " "))) {
|
|
51733
51886
|
return trimmed;
|
|
51734
51887
|
}
|
|
51735
51888
|
}
|
|
@@ -51751,7 +51904,7 @@ function getDirective(policy, directiveName) {
|
|
|
51751
51904
|
function getArticle(phrase) {
|
|
51752
51905
|
if (!phrase || typeof phrase !== 'string')
|
|
51753
51906
|
return 'A';
|
|
51754
|
-
|
|
51907
|
+
var c = phrase.trim().charAt(0).toLowerCase();
|
|
51755
51908
|
return includes('aeiou', c) ? 'An' : 'A';
|
|
51756
51909
|
}
|
|
51757
51910
|
/**
|
|
@@ -51794,46 +51947,47 @@ function createCspViolationMessage(blockedURI, directive, isReportOnly, original
|
|
|
51794
51947
|
return 'Content Security Policy: Unknown violation occurred.';
|
|
51795
51948
|
}
|
|
51796
51949
|
try {
|
|
51797
|
-
|
|
51950
|
+
var reportOnlyText = isReportOnly ? ' (Report-Only)' : '';
|
|
51798
51951
|
// special case for frame-ancestors since it doesn't fit our template at all
|
|
51799
51952
|
if ((directive === null || directive === void 0 ? void 0 : directive.toLowerCase()) === 'frame-ancestors') {
|
|
51800
|
-
return
|
|
51953
|
+
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, "\".");
|
|
51801
51954
|
}
|
|
51802
|
-
|
|
51803
|
-
|
|
51804
|
-
|
|
51805
|
-
|
|
51806
|
-
|
|
51807
|
-
|
|
51808
|
-
return
|
|
51955
|
+
var resourceType = getResourceType(blockedURI, directive);
|
|
51956
|
+
var article = getArticle(resourceType);
|
|
51957
|
+
var source = formatBlockedUri(blockedURI);
|
|
51958
|
+
var directiveValue = getDirective(originalPolicy, directive);
|
|
51959
|
+
var policyDisplay = directiveValue || directive;
|
|
51960
|
+
var resourceDescription = "".concat(article, " ").concat(resourceType).concat(source ? " from ".concat(source) : '');
|
|
51961
|
+
return "Content Security Policy".concat(reportOnlyText, ": ").concat(resourceDescription, " was blocked by your site's `").concat(policyDisplay, "` policy.\nCurrent CSP: \"").concat(originalPolicy, "\".");
|
|
51809
51962
|
}
|
|
51810
51963
|
catch (error) {
|
|
51811
|
-
return
|
|
51964
|
+
return "Content Security Policy: Error formatting violation message: ".concat(error.message);
|
|
51812
51965
|
}
|
|
51813
51966
|
}
|
|
51814
51967
|
|
|
51815
|
-
|
|
51816
|
-
|
|
51968
|
+
var MAX_LENGTH = 1000;
|
|
51969
|
+
var PII_PATTERN = {
|
|
51817
51970
|
ip: /\b(?:\d{1,3}\.){3}\d{1,3}\b/g,
|
|
51818
51971
|
ssn: /\b\d{3}-\d{2}-\d{4}\b/g,
|
|
51819
51972
|
creditCard: /\b(?:\d[ -]?){12,18}\d\b/g,
|
|
51820
51973
|
httpsUrls: /https:\/\/[^\s]+/g,
|
|
51821
51974
|
email: /[\w._+-]+@[\w.-]+\.\w+/g
|
|
51822
51975
|
};
|
|
51823
|
-
|
|
51824
|
-
|
|
51825
|
-
|
|
51826
|
-
|
|
51827
|
-
|
|
51976
|
+
var PII_REPLACEMENT = '*'.repeat(10);
|
|
51977
|
+
var JSON_PII_KEYS = ['password', 'email', 'key', 'token', 'auth', 'authentication', 'phone', 'address', 'ssn'];
|
|
51978
|
+
var UNABLE_TO_DISPLAY_BODY = '[Unable to display body: detected PII could not be redacted]';
|
|
51979
|
+
var joinedKeys = JSON_PII_KEYS.join('|');
|
|
51980
|
+
var keyPattern = "\"([^\"]*(?:".concat(joinedKeys, ")[^\"]*)\"");
|
|
51828
51981
|
// only scrub strings, numbers, and booleans
|
|
51829
|
-
|
|
51982
|
+
var acceptedValues = '("([^"\\\\]*(?:\\\\.[^"\\\\]*)*")|(\\d+)|(true|false))';
|
|
51830
51983
|
/**
|
|
51831
51984
|
* Truncates a string to the max length
|
|
51832
51985
|
* @access private
|
|
51833
51986
|
* @param {String} string
|
|
51834
51987
|
* @returns {String}
|
|
51835
51988
|
*/
|
|
51836
|
-
function truncate(string, includeEllipsis
|
|
51989
|
+
function truncate(string, includeEllipsis) {
|
|
51990
|
+
if (includeEllipsis === void 0) { includeEllipsis = false; }
|
|
51837
51991
|
if (string.length <= MAX_LENGTH)
|
|
51838
51992
|
return string;
|
|
51839
51993
|
if (includeEllipsis) {
|
|
@@ -51850,7 +52004,7 @@ function truncate(string, includeEllipsis = false) {
|
|
|
51850
52004
|
* @returns {String}
|
|
51851
52005
|
*/
|
|
51852
52006
|
function generateLogKey(methodName, message, stackTrace) {
|
|
51853
|
-
return
|
|
52007
|
+
return "".concat(methodName, "|").concat(message, "|").concat(stackTrace);
|
|
51854
52008
|
}
|
|
51855
52009
|
/**
|
|
51856
52010
|
* Checks if a string has 2 or more digits, a https URL, or an email address
|
|
@@ -51867,12 +52021,13 @@ function mightContainPII(string) {
|
|
|
51867
52021
|
* @param {String} string
|
|
51868
52022
|
* @returns {String}
|
|
51869
52023
|
*/
|
|
51870
|
-
function scrubPII(
|
|
52024
|
+
function scrubPII(_a) {
|
|
52025
|
+
var string = _a.string, _ = _a._;
|
|
51871
52026
|
if (!string || typeof string !== 'string')
|
|
51872
52027
|
return string;
|
|
51873
52028
|
if (!mightContainPII(string))
|
|
51874
52029
|
return string;
|
|
51875
|
-
return _.reduce(_.values(PII_PATTERN), (str, pattern)
|
|
52030
|
+
return _.reduce(_.values(PII_PATTERN), function (str, pattern) { return str.replace(pattern, PII_REPLACEMENT); }, string);
|
|
51876
52031
|
}
|
|
51877
52032
|
/**
|
|
51878
52033
|
* Scrub PII from a stringified JSON object
|
|
@@ -51881,12 +52036,14 @@ function scrubPII({ string, _ }) {
|
|
|
51881
52036
|
* @returns {String}
|
|
51882
52037
|
*/
|
|
51883
52038
|
function scrubJsonPII(string) {
|
|
51884
|
-
|
|
52039
|
+
var fullScrubRegex = new RegExp("".concat(keyPattern, "\\s*:\\s*[\\{\\[]"), 'i');
|
|
51885
52040
|
if (fullScrubRegex.test(string)) {
|
|
51886
52041
|
return UNABLE_TO_DISPLAY_BODY;
|
|
51887
52042
|
}
|
|
51888
|
-
|
|
51889
|
-
return string.replace(keyValueScrubRegex, (match, key)
|
|
52043
|
+
var keyValueScrubRegex = new RegExp("".concat(keyPattern, "\\s*:\\s*").concat(acceptedValues), 'gi');
|
|
52044
|
+
return string.replace(keyValueScrubRegex, function (match, key) {
|
|
52045
|
+
return "\"".concat(key, "\":\"").concat(PII_REPLACEMENT, "\"");
|
|
52046
|
+
});
|
|
51890
52047
|
}
|
|
51891
52048
|
/**
|
|
51892
52049
|
* Checks if a string is a JSON object
|
|
@@ -51898,7 +52055,7 @@ function scrubJsonPII(string) {
|
|
|
51898
52055
|
function mightContainJson(string, contentType) {
|
|
51899
52056
|
if (!string || typeof string !== 'string')
|
|
51900
52057
|
return false;
|
|
51901
|
-
|
|
52058
|
+
var firstChar = string.charAt(0);
|
|
51902
52059
|
if (contentType && contentType.indexOf('application/json') !== -1) {
|
|
51903
52060
|
return true;
|
|
51904
52061
|
}
|
|
@@ -51911,19 +52068,20 @@ function mightContainJson(string, contentType) {
|
|
|
51911
52068
|
* @param {String} contentType
|
|
51912
52069
|
* @returns {String}
|
|
51913
52070
|
*/
|
|
51914
|
-
function maskSensitiveFields(
|
|
52071
|
+
function maskSensitiveFields(_a) {
|
|
52072
|
+
var string = _a.string, contentType = _a.contentType, _ = _a._;
|
|
51915
52073
|
if (!string || typeof string !== 'string')
|
|
51916
52074
|
return string;
|
|
51917
52075
|
if (mightContainJson(string, contentType)) {
|
|
51918
52076
|
string = scrubJsonPII(string);
|
|
51919
52077
|
}
|
|
51920
52078
|
if (mightContainPII(string)) {
|
|
51921
|
-
string = scrubPII({ string, _ });
|
|
52079
|
+
string = scrubPII({ string: string, _: _ });
|
|
51922
52080
|
}
|
|
51923
52081
|
return string;
|
|
51924
52082
|
}
|
|
51925
52083
|
|
|
51926
|
-
|
|
52084
|
+
var DEV_LOG_TYPE = 'devlog';
|
|
51927
52085
|
function createDevLogEnvelope(pluginAPI, globalPendo) {
|
|
51928
52086
|
return {
|
|
51929
52087
|
browser_time: pluginAPI.util.getNow(),
|
|
@@ -51934,12 +52092,12 @@ function createDevLogEnvelope(pluginAPI, globalPendo) {
|
|
|
51934
52092
|
};
|
|
51935
52093
|
}
|
|
51936
52094
|
|
|
51937
|
-
|
|
51938
|
-
|
|
51939
|
-
|
|
51940
|
-
|
|
51941
|
-
|
|
51942
|
-
|
|
52095
|
+
var TOKEN_MAX_SIZE = 100;
|
|
52096
|
+
var TOKEN_REFILL_RATE = 10;
|
|
52097
|
+
var TOKEN_REFRESH_INTERVAL = 1000;
|
|
52098
|
+
var MAX_UNCOMPRESSED_SIZE = 125000; // 125KB
|
|
52099
|
+
var DevlogBuffer = /** @class */ (function () {
|
|
52100
|
+
function DevlogBuffer(pendo, pluginAPI) {
|
|
51943
52101
|
this.pendo = pendo;
|
|
51944
52102
|
this.pluginAPI = pluginAPI;
|
|
51945
52103
|
this.events = [];
|
|
@@ -51950,36 +52108,36 @@ class DevlogBuffer {
|
|
|
51950
52108
|
this.lastRefillTime = this.pluginAPI.util.getNow();
|
|
51951
52109
|
this.nextRefillTime = this.lastRefillTime + TOKEN_REFRESH_INTERVAL;
|
|
51952
52110
|
}
|
|
51953
|
-
isEmpty() {
|
|
52111
|
+
DevlogBuffer.prototype.isEmpty = function () {
|
|
51954
52112
|
return this.events.length === 0 && this.payloads.length === 0;
|
|
51955
|
-
}
|
|
51956
|
-
refillTokens() {
|
|
51957
|
-
|
|
52113
|
+
};
|
|
52114
|
+
DevlogBuffer.prototype.refillTokens = function () {
|
|
52115
|
+
var now = this.pluginAPI.util.getNow();
|
|
51958
52116
|
if (now >= this.nextRefillTime) {
|
|
51959
|
-
|
|
51960
|
-
|
|
51961
|
-
|
|
52117
|
+
var timeSinceLastRefill = now - this.lastRefillTime;
|
|
52118
|
+
var secondsSinceLastRefill = Math.floor(timeSinceLastRefill / TOKEN_REFRESH_INTERVAL);
|
|
52119
|
+
var tokensToRefill = secondsSinceLastRefill * TOKEN_REFILL_RATE;
|
|
51962
52120
|
this.tokens = Math.min(this.tokens + tokensToRefill, TOKEN_MAX_SIZE);
|
|
51963
52121
|
this.lastRefillTime = now;
|
|
51964
52122
|
this.nextRefillTime = now + TOKEN_REFRESH_INTERVAL;
|
|
51965
52123
|
}
|
|
51966
|
-
}
|
|
51967
|
-
clear() {
|
|
52124
|
+
};
|
|
52125
|
+
DevlogBuffer.prototype.clear = function () {
|
|
51968
52126
|
this.events = [];
|
|
51969
52127
|
this.lastEvent = null;
|
|
51970
52128
|
this.uncompressedSize = 0;
|
|
51971
|
-
}
|
|
51972
|
-
hasTokenAvailable() {
|
|
52129
|
+
};
|
|
52130
|
+
DevlogBuffer.prototype.hasTokenAvailable = function () {
|
|
51973
52131
|
this.refillTokens();
|
|
51974
52132
|
return this.tokens > 0;
|
|
51975
|
-
}
|
|
51976
|
-
estimateEventSize(event) {
|
|
52133
|
+
};
|
|
52134
|
+
DevlogBuffer.prototype.estimateEventSize = function (event) {
|
|
51977
52135
|
return JSON.stringify(event).length;
|
|
51978
|
-
}
|
|
51979
|
-
push(event) {
|
|
52136
|
+
};
|
|
52137
|
+
DevlogBuffer.prototype.push = function (event) {
|
|
51980
52138
|
if (!this.hasTokenAvailable())
|
|
51981
52139
|
return false;
|
|
51982
|
-
|
|
52140
|
+
var eventSize = this.estimateEventSize(event);
|
|
51983
52141
|
if (this.uncompressedSize + eventSize > MAX_UNCOMPRESSED_SIZE) {
|
|
51984
52142
|
this.compressCurrentChunk();
|
|
51985
52143
|
}
|
|
@@ -51988,54 +52146,55 @@ class DevlogBuffer {
|
|
|
51988
52146
|
this.events.push(event);
|
|
51989
52147
|
this.tokens = Math.max(this.tokens - 1, 0);
|
|
51990
52148
|
return true;
|
|
51991
|
-
}
|
|
51992
|
-
compressCurrentChunk() {
|
|
52149
|
+
};
|
|
52150
|
+
DevlogBuffer.prototype.compressCurrentChunk = function () {
|
|
51993
52151
|
if (this.events.length === 0)
|
|
51994
52152
|
return;
|
|
51995
|
-
|
|
52153
|
+
var jzb = this.pendo.compress(this.events);
|
|
51996
52154
|
this.payloads.push(jzb);
|
|
51997
52155
|
this.clear();
|
|
51998
|
-
}
|
|
51999
|
-
generateUrl() {
|
|
52000
|
-
|
|
52156
|
+
};
|
|
52157
|
+
DevlogBuffer.prototype.generateUrl = function () {
|
|
52158
|
+
var queryParams = {
|
|
52001
52159
|
v: this.pendo.VERSION,
|
|
52002
52160
|
ct: this.pluginAPI.util.getNow()
|
|
52003
52161
|
};
|
|
52004
52162
|
return this.pluginAPI.transmit.buildBaseDataUrl(DEV_LOG_TYPE, this.pendo.apiKey, queryParams);
|
|
52005
|
-
}
|
|
52006
|
-
pack() {
|
|
52163
|
+
};
|
|
52164
|
+
DevlogBuffer.prototype.pack = function () {
|
|
52007
52165
|
if (this.isEmpty())
|
|
52008
52166
|
return;
|
|
52009
|
-
|
|
52167
|
+
var url = this.generateUrl();
|
|
52010
52168
|
this.compressCurrentChunk();
|
|
52011
|
-
|
|
52012
|
-
jzb,
|
|
52013
|
-
url
|
|
52014
|
-
}));
|
|
52169
|
+
var payloads = this.pendo._.map(this.payloads, function (jzb) { return ({
|
|
52170
|
+
jzb: jzb,
|
|
52171
|
+
url: url
|
|
52172
|
+
}); });
|
|
52015
52173
|
this.payloads = [];
|
|
52016
52174
|
return payloads;
|
|
52017
|
-
}
|
|
52018
|
-
|
|
52175
|
+
};
|
|
52176
|
+
return DevlogBuffer;
|
|
52177
|
+
}());
|
|
52019
52178
|
|
|
52020
|
-
|
|
52021
|
-
|
|
52179
|
+
var DevlogTransport = /** @class */ (function () {
|
|
52180
|
+
function DevlogTransport(globalPendo, pluginAPI) {
|
|
52022
52181
|
this.pendo = globalPendo;
|
|
52023
52182
|
this.pluginAPI = pluginAPI;
|
|
52024
52183
|
}
|
|
52025
|
-
buildGetUrl(baseUrl, jzb) {
|
|
52026
|
-
|
|
52184
|
+
DevlogTransport.prototype.buildGetUrl = function (baseUrl, jzb) {
|
|
52185
|
+
var params = {};
|
|
52027
52186
|
if (this.pluginAPI.agent.treatAsAdoptPartner()) {
|
|
52028
52187
|
this.pluginAPI.agent.addAccountIdParams(params, this.pendo.get_account_id(), this.pluginAPI.ConfigReader.get('oemAccountId'));
|
|
52029
52188
|
}
|
|
52030
|
-
|
|
52189
|
+
var jwtOptions = this.pluginAPI.agent.getJwtInfoCopy();
|
|
52031
52190
|
if (!this.pendo._.isEmpty(jwtOptions)) {
|
|
52032
52191
|
this.pendo._.extend(params, jwtOptions);
|
|
52033
52192
|
}
|
|
52034
52193
|
params.jzb = jzb;
|
|
52035
|
-
|
|
52036
|
-
return
|
|
52037
|
-
}
|
|
52038
|
-
get(url, options) {
|
|
52194
|
+
var queryString = this.pendo._.map(params, function (value, key) { return "".concat(key, "=").concat(value); }).join('&');
|
|
52195
|
+
return "".concat(baseUrl).concat(baseUrl.indexOf('?') !== -1 ? '&' : '?').concat(queryString);
|
|
52196
|
+
};
|
|
52197
|
+
DevlogTransport.prototype.get = function (url, options) {
|
|
52039
52198
|
options.method = 'GET';
|
|
52040
52199
|
if (this.pluginAPI.transmit.fetchKeepalive.supported()) {
|
|
52041
52200
|
return this.pluginAPI.transmit.fetchKeepalive(url, options);
|
|
@@ -52043,86 +52202,90 @@ class DevlogTransport {
|
|
|
52043
52202
|
else {
|
|
52044
52203
|
return this.pendo.ajax.get(url);
|
|
52045
52204
|
}
|
|
52046
|
-
}
|
|
52047
|
-
sendRequestWithGet
|
|
52048
|
-
|
|
52205
|
+
};
|
|
52206
|
+
DevlogTransport.prototype.sendRequestWithGet = function (_a) {
|
|
52207
|
+
var url = _a.url, jzb = _a.jzb;
|
|
52208
|
+
var getUrl = this.buildGetUrl(url, jzb);
|
|
52049
52209
|
return this.get(getUrl, {
|
|
52050
52210
|
headers: {
|
|
52051
52211
|
'Content-Type': 'application/octet-stream'
|
|
52052
52212
|
}
|
|
52053
52213
|
});
|
|
52054
|
-
}
|
|
52055
|
-
post(url, options) {
|
|
52214
|
+
};
|
|
52215
|
+
DevlogTransport.prototype.post = function (url, options) {
|
|
52056
52216
|
options.method = 'POST';
|
|
52057
52217
|
if (options.keepalive && this.pluginAPI.transmit.fetchKeepalive.supported()) {
|
|
52058
52218
|
return this.pluginAPI.transmit.fetchKeepalive(url, options);
|
|
52059
52219
|
}
|
|
52060
52220
|
else if (options.keepalive && this.pluginAPI.transmit.sendBeacon.supported()) {
|
|
52061
|
-
|
|
52221
|
+
var result = this.pluginAPI.transmit.sendBeacon(url, new Blob([options.body]));
|
|
52062
52222
|
return result ? Promise$2.resolve() : Promise$2.reject(new Error('sendBeacon failed to send devlog data'));
|
|
52063
52223
|
}
|
|
52064
52224
|
else {
|
|
52065
52225
|
return this.pendo.ajax.post(url, options.body);
|
|
52066
52226
|
}
|
|
52067
|
-
}
|
|
52068
|
-
sendRequestWithPost
|
|
52069
|
-
|
|
52070
|
-
|
|
52227
|
+
};
|
|
52228
|
+
DevlogTransport.prototype.sendRequestWithPost = function (_a, isUnload) {
|
|
52229
|
+
var url = _a.url, jzb = _a.jzb;
|
|
52230
|
+
var jwtOptions = this.pluginAPI.agent.getJwtInfoCopy();
|
|
52231
|
+
var bodyPayload = {
|
|
52071
52232
|
events: jzb,
|
|
52072
52233
|
browser_time: this.pluginAPI.util.getNow()
|
|
52073
52234
|
};
|
|
52074
52235
|
if (this.pluginAPI.agent.treatAsAdoptPartner()) {
|
|
52075
52236
|
this.pluginAPI.agent.addAccountIdParams(bodyPayload, this.pendo.get_account_id(), this.pluginAPI.ConfigReader.get('oemAccountId'));
|
|
52076
52237
|
}
|
|
52077
|
-
|
|
52238
|
+
var body = JSON.stringify(this.pendo._.extend(bodyPayload, jwtOptions));
|
|
52078
52239
|
return this.post(url, {
|
|
52079
|
-
body,
|
|
52240
|
+
body: body,
|
|
52080
52241
|
headers: {
|
|
52081
52242
|
'Content-Type': 'application/json'
|
|
52082
52243
|
},
|
|
52083
52244
|
keepalive: isUnload
|
|
52084
52245
|
});
|
|
52085
|
-
}
|
|
52086
|
-
sendRequest
|
|
52087
|
-
|
|
52246
|
+
};
|
|
52247
|
+
DevlogTransport.prototype.sendRequest = function (_a, isUnload) {
|
|
52248
|
+
var url = _a.url, jzb = _a.jzb;
|
|
52249
|
+
var compressedLength = jzb.length;
|
|
52088
52250
|
if (compressedLength <= this.pluginAPI.constants.ENCODED_EVENT_MAX_LENGTH && !this.pluginAPI.ConfigReader.get('sendEventsWithPostOnly')) {
|
|
52089
|
-
return this.sendRequestWithGet({ url, jzb });
|
|
52251
|
+
return this.sendRequestWithGet({ url: url, jzb: jzb });
|
|
52090
52252
|
}
|
|
52091
|
-
return this.sendRequestWithPost({ url, jzb }, isUnload);
|
|
52092
|
-
}
|
|
52093
|
-
|
|
52253
|
+
return this.sendRequestWithPost({ url: url, jzb: jzb }, isUnload);
|
|
52254
|
+
};
|
|
52255
|
+
return DevlogTransport;
|
|
52256
|
+
}());
|
|
52094
52257
|
|
|
52095
52258
|
function ConsoleCapture() {
|
|
52096
|
-
|
|
52097
|
-
|
|
52098
|
-
|
|
52099
|
-
|
|
52100
|
-
|
|
52101
|
-
|
|
52102
|
-
|
|
52103
|
-
|
|
52104
|
-
|
|
52105
|
-
|
|
52106
|
-
|
|
52107
|
-
|
|
52259
|
+
var pluginAPI;
|
|
52260
|
+
var _;
|
|
52261
|
+
var globalPendo;
|
|
52262
|
+
var buffer;
|
|
52263
|
+
var sendQueue;
|
|
52264
|
+
var sendInterval;
|
|
52265
|
+
var transport;
|
|
52266
|
+
var isPtmPaused;
|
|
52267
|
+
var isCapturingConsoleLogs = false;
|
|
52268
|
+
var CAPTURE_CONSOLE_CONFIG = 'captureConsoleLogs';
|
|
52269
|
+
var CONSOLE_METHODS = ['log', 'warn', 'error', 'info'];
|
|
52270
|
+
var DEV_LOG_SUB_TYPE = 'console';
|
|
52108
52271
|
// deduplicate logs
|
|
52109
|
-
|
|
52272
|
+
var lastLogKey = '';
|
|
52110
52273
|
return {
|
|
52111
52274
|
name: 'ConsoleCapture',
|
|
52112
|
-
initialize,
|
|
52113
|
-
teardown,
|
|
52114
|
-
addIntercepts,
|
|
52115
|
-
createConsoleEvent,
|
|
52116
|
-
captureStackTrace,
|
|
52117
|
-
send,
|
|
52118
|
-
setCaptureState,
|
|
52119
|
-
recordingStarted,
|
|
52120
|
-
recordingStopped,
|
|
52121
|
-
onAppHidden,
|
|
52122
|
-
onAppUnloaded,
|
|
52123
|
-
onPtmPaused,
|
|
52124
|
-
onPtmUnpaused,
|
|
52125
|
-
securityPolicyViolationFn,
|
|
52275
|
+
initialize: initialize,
|
|
52276
|
+
teardown: teardown,
|
|
52277
|
+
addIntercepts: addIntercepts,
|
|
52278
|
+
createConsoleEvent: createConsoleEvent,
|
|
52279
|
+
captureStackTrace: captureStackTrace,
|
|
52280
|
+
send: send,
|
|
52281
|
+
setCaptureState: setCaptureState,
|
|
52282
|
+
recordingStarted: recordingStarted,
|
|
52283
|
+
recordingStopped: recordingStopped,
|
|
52284
|
+
onAppHidden: onAppHidden,
|
|
52285
|
+
onAppUnloaded: onAppUnloaded,
|
|
52286
|
+
onPtmPaused: onPtmPaused,
|
|
52287
|
+
onPtmUnpaused: onPtmUnpaused,
|
|
52288
|
+
securityPolicyViolationFn: securityPolicyViolationFn,
|
|
52126
52289
|
get isCapturingConsoleLogs() {
|
|
52127
52290
|
return isCapturingConsoleLogs;
|
|
52128
52291
|
},
|
|
@@ -52139,16 +52302,16 @@ function ConsoleCapture() {
|
|
|
52139
52302
|
function initialize(pendo, PluginAPI) {
|
|
52140
52303
|
_ = pendo._;
|
|
52141
52304
|
pluginAPI = PluginAPI;
|
|
52142
|
-
|
|
52305
|
+
var ConfigReader = pluginAPI.ConfigReader;
|
|
52143
52306
|
ConfigReader.addOption(CAPTURE_CONSOLE_CONFIG, [ConfigReader.sources.PENDO_CONFIG_SRC], false);
|
|
52144
|
-
|
|
52307
|
+
var captureConsoleEnabled = ConfigReader.get(CAPTURE_CONSOLE_CONFIG);
|
|
52145
52308
|
if (!captureConsoleEnabled)
|
|
52146
52309
|
return;
|
|
52147
52310
|
globalPendo = pendo;
|
|
52148
52311
|
buffer = new DevlogBuffer(pendo, pluginAPI);
|
|
52149
52312
|
transport = new DevlogTransport(pendo, pluginAPI);
|
|
52150
52313
|
sendQueue = new pluginAPI.SendQueue(transport.sendRequest.bind(transport));
|
|
52151
|
-
sendInterval = setInterval(()
|
|
52314
|
+
sendInterval = setInterval(function () {
|
|
52152
52315
|
if (!sendQueue.failed()) {
|
|
52153
52316
|
send();
|
|
52154
52317
|
}
|
|
@@ -52174,17 +52337,19 @@ function ConsoleCapture() {
|
|
|
52174
52337
|
function onPtmUnpaused() {
|
|
52175
52338
|
isPtmPaused = false;
|
|
52176
52339
|
if (!buffer.isEmpty()) {
|
|
52177
|
-
for (
|
|
52178
|
-
|
|
52340
|
+
for (var _i = 0, _a = buffer.events; _i < _a.length; _i++) {
|
|
52341
|
+
var event_1 = _a[_i];
|
|
52342
|
+
pluginAPI.Events.eventCaptured.trigger(event_1);
|
|
52179
52343
|
}
|
|
52180
52344
|
send();
|
|
52181
52345
|
}
|
|
52182
52346
|
}
|
|
52183
|
-
function setCaptureState(
|
|
52347
|
+
function setCaptureState(_a) {
|
|
52348
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.shouldCapture, shouldCapture = _c === void 0 ? false : _c, _d = _b.reason, reason = _d === void 0 ? '' : _d;
|
|
52184
52349
|
if (shouldCapture === isCapturingConsoleLogs)
|
|
52185
52350
|
return;
|
|
52186
52351
|
isCapturingConsoleLogs = shouldCapture;
|
|
52187
|
-
pluginAPI.log.info(
|
|
52352
|
+
pluginAPI.log.info("[ConsoleCapture] Console log capture ".concat(shouldCapture ? 'started' : 'stopped').concat(reason ? ": ".concat(reason) : ''));
|
|
52188
52353
|
}
|
|
52189
52354
|
function recordingStarted() {
|
|
52190
52355
|
setCaptureState({ shouldCapture: true, reason: 'recording started' });
|
|
@@ -52204,12 +52369,12 @@ function ConsoleCapture() {
|
|
|
52204
52369
|
}
|
|
52205
52370
|
function addIntercepts() {
|
|
52206
52371
|
_.each(CONSOLE_METHODS, function (methodName) {
|
|
52207
|
-
|
|
52372
|
+
var originalMethod = console[methodName];
|
|
52208
52373
|
if (!originalMethod)
|
|
52209
52374
|
return;
|
|
52210
52375
|
console[methodName] = _.wrap(originalMethod, function (originalFn) {
|
|
52211
52376
|
// slice 1 to omit originalFn
|
|
52212
|
-
|
|
52377
|
+
var args = _.toArray(arguments).slice(1);
|
|
52213
52378
|
originalFn.apply(console, args);
|
|
52214
52379
|
createConsoleEvent(args, methodName);
|
|
52215
52380
|
});
|
|
@@ -52221,10 +52386,10 @@ function ConsoleCapture() {
|
|
|
52221
52386
|
function securityPolicyViolationFn(evt) {
|
|
52222
52387
|
if (!evt || typeof evt !== 'object')
|
|
52223
52388
|
return;
|
|
52224
|
-
|
|
52225
|
-
|
|
52226
|
-
|
|
52227
|
-
|
|
52389
|
+
var blockedURI = evt.blockedURI, violatedDirective = evt.violatedDirective, effectiveDirective = evt.effectiveDirective, disposition = evt.disposition, originalPolicy = evt.originalPolicy;
|
|
52390
|
+
var directive = violatedDirective || effectiveDirective;
|
|
52391
|
+
var isReportOnly = disposition === 'report';
|
|
52392
|
+
var message = createCspViolationMessage(blockedURI, directive, isReportOnly, originalPolicy);
|
|
52228
52393
|
if (isReportOnly) {
|
|
52229
52394
|
createConsoleEvent([message], 'warn', { skipStackTrace: true, skipScrubPII: true });
|
|
52230
52395
|
}
|
|
@@ -52232,12 +52397,13 @@ function ConsoleCapture() {
|
|
|
52232
52397
|
createConsoleEvent([message], 'error', { skipStackTrace: true, skipScrubPII: true });
|
|
52233
52398
|
}
|
|
52234
52399
|
}
|
|
52235
|
-
function createConsoleEvent(args, methodName,
|
|
52400
|
+
function createConsoleEvent(args, methodName, _a) {
|
|
52401
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.skipStackTrace, skipStackTrace = _c === void 0 ? false : _c, _d = _b.skipScrubPII, skipScrubPII = _d === void 0 ? false : _d;
|
|
52236
52402
|
if (!isCapturingConsoleLogs || !args || args.length === 0 || !_.contains(CONSOLE_METHODS, methodName))
|
|
52237
52403
|
return;
|
|
52238
52404
|
// stringify args
|
|
52239
|
-
|
|
52240
|
-
|
|
52405
|
+
var message = _.compact(_.map(args, function (arg) {
|
|
52406
|
+
var stringifiedArg;
|
|
52241
52407
|
try {
|
|
52242
52408
|
stringifiedArg = stringify(arg);
|
|
52243
52409
|
}
|
|
@@ -52249,22 +52415,22 @@ function ConsoleCapture() {
|
|
|
52249
52415
|
if (!message)
|
|
52250
52416
|
return;
|
|
52251
52417
|
// capture stack trace
|
|
52252
|
-
|
|
52418
|
+
var stackTrace = '';
|
|
52253
52419
|
if (!skipStackTrace) {
|
|
52254
|
-
|
|
52420
|
+
var maxStackFrames = methodName === 'error' ? 4 : 1;
|
|
52255
52421
|
stackTrace = captureStackTrace(maxStackFrames);
|
|
52256
52422
|
}
|
|
52257
52423
|
// truncate message and stack trace
|
|
52258
52424
|
message = truncate(message);
|
|
52259
52425
|
stackTrace = truncate(stackTrace);
|
|
52260
52426
|
// de-duplicate log
|
|
52261
|
-
|
|
52427
|
+
var logKey = generateLogKey(methodName, message, stackTrace);
|
|
52262
52428
|
if (isExistingDuplicateLog(logKey)) {
|
|
52263
52429
|
buffer.lastEvent.devLogCount++;
|
|
52264
52430
|
return;
|
|
52265
52431
|
}
|
|
52266
|
-
|
|
52267
|
-
|
|
52432
|
+
var devLogEnvelope = createDevLogEnvelope(pluginAPI, globalPendo);
|
|
52433
|
+
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 });
|
|
52268
52434
|
if (!buffer.hasTokenAvailable())
|
|
52269
52435
|
return consoleEvent;
|
|
52270
52436
|
if (!isPtmPaused) {
|
|
@@ -52276,8 +52442,8 @@ function ConsoleCapture() {
|
|
|
52276
52442
|
}
|
|
52277
52443
|
function captureStackTrace(maxStackFrames) {
|
|
52278
52444
|
try {
|
|
52279
|
-
|
|
52280
|
-
return _.map(stackFrames, frame
|
|
52445
|
+
var stackFrames = ErrorStackParser.parse(new Error(), maxStackFrames);
|
|
52446
|
+
return _.map(stackFrames, function (frame) { return frame.toString(); }).join('\n');
|
|
52281
52447
|
}
|
|
52282
52448
|
catch (error) {
|
|
52283
52449
|
return '';
|
|
@@ -52289,21 +52455,22 @@ function ConsoleCapture() {
|
|
|
52289
52455
|
function updateLastLog(logKey) {
|
|
52290
52456
|
lastLogKey = logKey;
|
|
52291
52457
|
}
|
|
52292
|
-
function send(
|
|
52458
|
+
function send(_a) {
|
|
52459
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.unload, unload = _c === void 0 ? false : _c, _d = _b.hidden, hidden = _d === void 0 ? false : _d;
|
|
52293
52460
|
if (!buffer || buffer.isEmpty())
|
|
52294
52461
|
return;
|
|
52295
52462
|
if (!globalPendo.isSendingEvents()) {
|
|
52296
52463
|
buffer.clear();
|
|
52297
52464
|
return;
|
|
52298
52465
|
}
|
|
52299
|
-
|
|
52466
|
+
var payloads = buffer.pack();
|
|
52300
52467
|
if (!payloads || payloads.length === 0)
|
|
52301
52468
|
return;
|
|
52302
52469
|
if (unload || hidden) {
|
|
52303
52470
|
sendQueue.drain(payloads, unload);
|
|
52304
52471
|
}
|
|
52305
52472
|
else {
|
|
52306
|
-
sendQueue.push(
|
|
52473
|
+
sendQueue.push.apply(sendQueue, payloads);
|
|
52307
52474
|
}
|
|
52308
52475
|
}
|
|
52309
52476
|
function teardown() {
|
|
@@ -52327,7 +52494,7 @@ function ConsoleCapture() {
|
|
|
52327
52494
|
_.each(CONSOLE_METHODS, function (methodName) {
|
|
52328
52495
|
if (!console[methodName])
|
|
52329
52496
|
return _.noop;
|
|
52330
|
-
|
|
52497
|
+
var unwrap = console[methodName]._pendoUnwrap;
|
|
52331
52498
|
if (_.isFunction(unwrap)) {
|
|
52332
52499
|
unwrap();
|
|
52333
52500
|
}
|
|
@@ -52769,7 +52936,7 @@ var injectStyles = function (pendoContainerId, log) {
|
|
|
52769
52936
|
log("[predict] injecting styles: ".concat(styleId));
|
|
52770
52937
|
createElement('style', {
|
|
52771
52938
|
id: styleId,
|
|
52772
|
-
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:
|
|
52939
|
+
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 ")
|
|
52773
52940
|
}, document.head);
|
|
52774
52941
|
};
|
|
52775
52942
|
var getRecordIdFromUrl = function (recordRegex, log) {
|