@pendo/agent 2.273.0 → 2.275.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dom.esm.js +9616 -0
- package/dist/pendo.module.js +653 -93
- package/dist/pendo.module.min.js +1 -1
- package/package.json +1 -1
- package/setup.js +3 -0
package/dist/pendo.module.js
CHANGED
|
@@ -3002,6 +3002,7 @@ var ConfigReader = (function () {
|
|
|
3002
3002
|
*/
|
|
3003
3003
|
addOption('observeShadowRoots', [SNIPPET_SRC, PENDO_CONFIG_SRC], false);
|
|
3004
3004
|
addOption('pendoCore', [PENDO_CONFIG_SRC], true);
|
|
3005
|
+
addOption('pendoGlobalKey', [PENDO_CONFIG_SRC]);
|
|
3005
3006
|
/**
|
|
3006
3007
|
* By default, if there are multiple frames on the page that have the Agent installed, they will communicate
|
|
3007
3008
|
* using `window.postMessage`. If set to `true` the Agent will instead use the browser's Broadcast Channel
|
|
@@ -3514,6 +3515,8 @@ var ConfigReader = (function () {
|
|
|
3514
3515
|
addOption('forceParentDesigner', [SNIPPET_SRC]); // Only works in non-prod environments for automated testing
|
|
3515
3516
|
// Embedded Guides
|
|
3516
3517
|
addOption('enableAllEmbeddedGuideEvents', [PENDO_CONFIG_SRC], false);
|
|
3518
|
+
// Form Validation
|
|
3519
|
+
addOption('formValidation', [PENDO_CONFIG_SRC], false);
|
|
3517
3520
|
}
|
|
3518
3521
|
initializeOptions();
|
|
3519
3522
|
var sourceGetters = {};
|
|
@@ -3888,8 +3891,8 @@ var SERVER = '';
|
|
|
3888
3891
|
var ASSET_HOST = '';
|
|
3889
3892
|
var ASSET_PATH = '';
|
|
3890
3893
|
var DESIGNER_ENV = '';
|
|
3891
|
-
var VERSION = '2.
|
|
3892
|
-
var PACKAGE_VERSION = '2.
|
|
3894
|
+
var VERSION = '2.275.0_';
|
|
3895
|
+
var PACKAGE_VERSION = '2.275.0';
|
|
3893
3896
|
var LOADER = 'xhr';
|
|
3894
3897
|
/* eslint-enable agent-eslint-rules/no-gulp-env-references */
|
|
3895
3898
|
/**
|
|
@@ -9097,20 +9100,7 @@ var ajax = (function () {
|
|
|
9097
9100
|
else {
|
|
9098
9101
|
request.send();
|
|
9099
9102
|
}
|
|
9100
|
-
return
|
|
9101
|
-
}
|
|
9102
|
-
function aliasFailToCatch(promise) {
|
|
9103
|
-
// Custom code written by pro services uses fail, so we need to support that.
|
|
9104
|
-
var wrappedThen = promise.then;
|
|
9105
|
-
var wrappedCatch = promise['catch'];
|
|
9106
|
-
promise.then = function () {
|
|
9107
|
-
return aliasFailToCatch(wrappedThen.apply(this, arguments));
|
|
9108
|
-
};
|
|
9109
|
-
promise['catch'] = function () {
|
|
9110
|
-
return aliasFailToCatch(wrappedCatch.apply(this, arguments));
|
|
9111
|
-
};
|
|
9112
|
-
promise.fail = promise['catch'];
|
|
9113
|
-
return promise;
|
|
9103
|
+
return deferred.promise;
|
|
9114
9104
|
}
|
|
9115
9105
|
function get(url, headers) {
|
|
9116
9106
|
return ajax({
|
|
@@ -13505,6 +13495,9 @@ var isWalkthrough = function (guide) {
|
|
|
13505
13495
|
guide.isMultiStep &&
|
|
13506
13496
|
!(guide.attributes && guide.attributes.type === 'group');
|
|
13507
13497
|
};
|
|
13498
|
+
var isForm = function (guide) {
|
|
13499
|
+
return !!(_.get(guide, 'attributes.form'));
|
|
13500
|
+
};
|
|
13508
13501
|
function isPreviewing() {
|
|
13509
13502
|
/* global selmo */
|
|
13510
13503
|
return (typeof selmo !== 'undefined' && !!selmo.isPreviewing);
|
|
@@ -13713,10 +13706,10 @@ var PublicEvents = (function () {
|
|
|
13713
13706
|
return events;
|
|
13714
13707
|
})();
|
|
13715
13708
|
|
|
13716
|
-
function postLoadGuideJs(url, payload, callback) {
|
|
13717
|
-
return ajax.postJSON(url.replace(/\/guides\.js\//, '/guides.json/'), payload)
|
|
13709
|
+
function postLoadGuideJs(url, payload, pendo, callback) {
|
|
13710
|
+
return pendo.ajax.postJSON(url.replace(/\/guides\.js\//, '/guides.json/'), payload)
|
|
13718
13711
|
.then(function (response) {
|
|
13719
|
-
pendo
|
|
13712
|
+
pendo.guidesPayload(response.data);
|
|
13720
13713
|
callback();
|
|
13721
13714
|
});
|
|
13722
13715
|
}
|
|
@@ -13729,10 +13722,10 @@ var XHRGuideLoader = {
|
|
|
13729
13722
|
* @param {Function} done called with no arguments
|
|
13730
13723
|
* @returns {ayepromise.Promise<undefined>}
|
|
13731
13724
|
*/
|
|
13732
|
-
'load': function (url, done) {
|
|
13733
|
-
return ajax.get(url)
|
|
13725
|
+
'load': function (url, pendo, done) {
|
|
13726
|
+
return pendo.ajax.get(url)
|
|
13734
13727
|
.then(function (response) {
|
|
13735
|
-
pendo
|
|
13728
|
+
pendo.guidesPayload(response.data);
|
|
13736
13729
|
done();
|
|
13737
13730
|
});
|
|
13738
13731
|
},
|
|
@@ -21367,7 +21360,7 @@ function setPreviewState(state) {
|
|
|
21367
21360
|
function createPreviewBar() {
|
|
21368
21361
|
var frame = document.createElement('iframe');
|
|
21369
21362
|
frame.id = pendoPreview$1;
|
|
21370
|
-
var previewModeStartingHeight = '70px';
|
|
21363
|
+
var previewModeStartingHeight = '70px !important';
|
|
21371
21364
|
setStyles(frame, {
|
|
21372
21365
|
'border': 'none',
|
|
21373
21366
|
'display': 'block !important',
|
|
@@ -21378,7 +21371,7 @@ function createPreviewBar() {
|
|
|
21378
21371
|
'right': 0,
|
|
21379
21372
|
'top': 0,
|
|
21380
21373
|
'visibility': 'visible !important',
|
|
21381
|
-
'width': '100%',
|
|
21374
|
+
'width': '100% !important',
|
|
21382
21375
|
'z-index': 400000
|
|
21383
21376
|
});
|
|
21384
21377
|
frame.onload = function () {
|
|
@@ -21869,7 +21862,7 @@ function previewGuideRequest(config, id) {
|
|
|
21869
21862
|
}
|
|
21870
21863
|
return guide;
|
|
21871
21864
|
}).then(function (guide) {
|
|
21872
|
-
if (guide.attributes && guide.attributes.isWatermark) {
|
|
21865
|
+
if (guide && guide.attributes && guide.attributes.isWatermark) {
|
|
21873
21866
|
guidesArray.push(guide);
|
|
21874
21867
|
}
|
|
21875
21868
|
// set pendo.guides at the very end to avoid mutation
|
|
@@ -22212,6 +22205,9 @@ var DesignerV2 = (function () {
|
|
|
22212
22205
|
if (options.selectionOnly) {
|
|
22213
22206
|
scriptTagAttributes['selection-only'] = true;
|
|
22214
22207
|
}
|
|
22208
|
+
if (ConfigReader.get('pendoGlobalKey')) {
|
|
22209
|
+
scriptTagAttributes['data-pendo-global-key'] = ConfigReader.get('pendoGlobalKey');
|
|
22210
|
+
}
|
|
22215
22211
|
var designerAgentPluginsLoader = ConfigReader.get('designerAgentPluginsLoader');
|
|
22216
22212
|
var forceNativeDesignerInDoubleAgentScenarios = window.__pendoExtensions && options.forceNativeDesigner;
|
|
22217
22213
|
var nativeAgentOnly = !window.__pendoExtensions && !_.isFunction(designerAgentPluginsLoader);
|
|
@@ -22306,7 +22302,7 @@ var DesignerV2 = (function () {
|
|
|
22306
22302
|
if (style) {
|
|
22307
22303
|
setStyle(iframe, style);
|
|
22308
22304
|
}
|
|
22309
|
-
iframe.setAttribute('sandbox', 'allow-scripts allow-same-origin allow-top-navigation allow-forms allow-pointer-lock allow-popups');
|
|
22305
|
+
iframe.setAttribute('sandbox', 'allow-scripts allow-same-origin allow-top-navigation allow-forms allow-pointer-lock allow-popups allow-storage-access-by-user-activation');
|
|
22310
22306
|
iframe.src = src;
|
|
22311
22307
|
return iframe;
|
|
22312
22308
|
}
|
|
@@ -23304,16 +23300,19 @@ function createCrossFrameChannel(store) {
|
|
|
23304
23300
|
}
|
|
23305
23301
|
|
|
23306
23302
|
function onTurbolinksPageLoad(document, onPageLoad) {
|
|
23307
|
-
|
|
23308
|
-
|
|
23309
|
-
|
|
23310
|
-
|
|
23311
|
-
|
|
23312
|
-
|
|
23313
|
-
return attachEventInternal(document, turboLinksPageLoad, onPageLoad);
|
|
23314
|
-
}
|
|
23303
|
+
var Turbolinks = window.Turbolinks, Turbo = window.Turbo;
|
|
23304
|
+
var turboLinksPageLoad;
|
|
23305
|
+
// Special case guide reloading for troublesome Rails component:
|
|
23306
|
+
// https://github.com/rails/turbolinks
|
|
23307
|
+
if (Turbolinks) {
|
|
23308
|
+
turboLinksPageLoad = Turbolinks.EVENTS && Turbolinks.EVENTS.LOAD;
|
|
23315
23309
|
}
|
|
23316
|
-
|
|
23310
|
+
// Updated version of Turbo library
|
|
23311
|
+
// https://turbo.hotwired.dev/reference/events
|
|
23312
|
+
if (Turbo && Turbo.visit) {
|
|
23313
|
+
turboLinksPageLoad = 'turbo:load';
|
|
23314
|
+
}
|
|
23315
|
+
return turboLinksPageLoad ? attachEventInternal(document, turboLinksPageLoad, onPageLoad) : function () { };
|
|
23317
23316
|
}
|
|
23318
23317
|
|
|
23319
23318
|
var EMPTY_ARRAY_JZB = 'eJwFwIEIAAAAwDDQd3-N1QABFQC5';
|
|
@@ -24670,10 +24669,10 @@ var loadGuideJs = function (apiKey, params) {
|
|
|
24670
24669
|
delete queryString.jzb;
|
|
24671
24670
|
url = buildBaseDataUrl('guide.json', apiKey, queryString);
|
|
24672
24671
|
var payload = _.extend({ 'events': jzb }, jwtOptions);
|
|
24673
|
-
loadingPromise = guideLoaderImpl.post(url, payload, _.noop);
|
|
24672
|
+
loadingPromise = guideLoaderImpl.post(url, payload, pendo$1, _.noop);
|
|
24674
24673
|
}
|
|
24675
24674
|
else {
|
|
24676
|
-
loadingPromise = guideLoaderImpl.load(url, _.noop);
|
|
24675
|
+
loadingPromise = guideLoaderImpl.load(url, pendo$1, _.noop);
|
|
24677
24676
|
}
|
|
24678
24677
|
return q.all([
|
|
24679
24678
|
// eslint-disable-next-line dot-notation
|
|
@@ -25030,6 +25029,8 @@ function hasLegacyGuides(guides, pendo) {
|
|
|
25030
25029
|
if (pendo && pendo.designer)
|
|
25031
25030
|
return true;
|
|
25032
25031
|
return _.any(guides, function (guide) {
|
|
25032
|
+
if (isForm(guide))
|
|
25033
|
+
return false;
|
|
25033
25034
|
return _.any(guide.steps, function (step) {
|
|
25034
25035
|
return !(step.domUrl || step.domJsonpUrl || step.domJson);
|
|
25035
25036
|
});
|
|
@@ -26726,12 +26727,17 @@ var initialize = makeSafe(function (options) {
|
|
|
26726
26727
|
function announceFrameToDesignerPlugin() {
|
|
26727
26728
|
if (!window.parent || !window.parent.postMessage || typeof window.parent.postMessage != 'function')
|
|
26728
26729
|
return;
|
|
26730
|
+
var targetOrigin = SingletonMessageHandler.targetOrigin();
|
|
26731
|
+
if (!targetOrigin) {
|
|
26732
|
+
log.warn('Unable to announce frame to designer plugin, targetOrigin is not set. Check if broadcastChannel is enabled and cross origin frames are allowed.');
|
|
26733
|
+
return;
|
|
26734
|
+
}
|
|
26729
26735
|
window.parent.postMessage({
|
|
26730
26736
|
'type': 'announce-frame-initialized',
|
|
26731
26737
|
'destination': 'pendo-designer-agent',
|
|
26732
26738
|
'source': 'pendo-designer-agent',
|
|
26733
26739
|
'localStorageRouter': true
|
|
26734
|
-
},
|
|
26740
|
+
}, targetOrigin);
|
|
26735
26741
|
}
|
|
26736
26742
|
function isCallQueueEmpty(callQueue) {
|
|
26737
26743
|
return (!_.isArray(callQueue) || _.isEmpty(callQueue));
|
|
@@ -30567,7 +30573,6 @@ var CloneDetection = /** @class */ (function () {
|
|
|
30567
30573
|
this.name = 'CloneDetection';
|
|
30568
30574
|
}
|
|
30569
30575
|
CloneDetection.prototype.initialize = function () {
|
|
30570
|
-
var _this = this;
|
|
30571
30576
|
if (!_.isFunction(window.BroadcastChannel))
|
|
30572
30577
|
return;
|
|
30573
30578
|
/**
|
|
@@ -30583,32 +30588,39 @@ var CloneDetection = /** @class */ (function () {
|
|
|
30583
30588
|
this.tabId = EventTracer.getTabId();
|
|
30584
30589
|
this.id = randomString(16);
|
|
30585
30590
|
this.channel = new BroadcastChannel("pendo-clone-detection-".concat(pendo$1.apiKey));
|
|
30586
|
-
this.channel.onmessage
|
|
30587
|
-
var type = _.get(msg, 'data.type');
|
|
30588
|
-
var tabId = _.get(msg, 'data.tabId');
|
|
30589
|
-
var id = _.get(msg, 'data.id');
|
|
30590
|
-
if (tabId !== _this.tabId)
|
|
30591
|
-
return;
|
|
30592
|
-
switch (type) {
|
|
30593
|
-
case 'pendo-clone-test':
|
|
30594
|
-
if (id === _this.id)
|
|
30595
|
-
return;
|
|
30596
|
-
if (_this.isClonedSession(id)) {
|
|
30597
|
-
_this.sendMessage('pendo-change-tab-id', {
|
|
30598
|
-
tabId: tabId,
|
|
30599
|
-
id: id
|
|
30600
|
-
});
|
|
30601
|
-
}
|
|
30602
|
-
break;
|
|
30603
|
-
case 'pendo-change-tab-id':
|
|
30604
|
-
if (id !== _this.id)
|
|
30605
|
-
return;
|
|
30606
|
-
_this.clearClonedStorage();
|
|
30607
|
-
break;
|
|
30608
|
-
}
|
|
30609
|
-
};
|
|
30591
|
+
this.channel.addEventListener('message', _.bind(this.onmessage, this));
|
|
30610
30592
|
this.detectClonedSession(this.id);
|
|
30611
|
-
return this.teardown;
|
|
30593
|
+
return _.bind(this.teardown, this);
|
|
30594
|
+
};
|
|
30595
|
+
CloneDetection.prototype.teardown = function () {
|
|
30596
|
+
this.stopCloneDetectionTimer();
|
|
30597
|
+
this.channel.removeEventListener('message', this.onmessage);
|
|
30598
|
+
this.channel.close();
|
|
30599
|
+
this.channel = null;
|
|
30600
|
+
};
|
|
30601
|
+
CloneDetection.prototype.onmessage = function (msg) {
|
|
30602
|
+
var type = _.get(msg, 'data.type');
|
|
30603
|
+
var tabId = _.get(msg, 'data.tabId');
|
|
30604
|
+
var id = _.get(msg, 'data.id');
|
|
30605
|
+
if (tabId !== this.tabId)
|
|
30606
|
+
return;
|
|
30607
|
+
switch (type) {
|
|
30608
|
+
case 'pendo-clone-test':
|
|
30609
|
+
if (id === this.id)
|
|
30610
|
+
return;
|
|
30611
|
+
if (this.isClonedSession(id)) {
|
|
30612
|
+
this.sendMessage('pendo-change-tab-id', {
|
|
30613
|
+
tabId: tabId,
|
|
30614
|
+
id: id
|
|
30615
|
+
});
|
|
30616
|
+
}
|
|
30617
|
+
break;
|
|
30618
|
+
case 'pendo-change-tab-id':
|
|
30619
|
+
if (id !== this.id)
|
|
30620
|
+
return;
|
|
30621
|
+
this.clearClonedStorage();
|
|
30622
|
+
break;
|
|
30623
|
+
}
|
|
30612
30624
|
};
|
|
30613
30625
|
CloneDetection.prototype.detectClonedSession = function (cd) {
|
|
30614
30626
|
var cdToStore = pendoSessionStorage.getItem(SESSION_CLONE_DETECTION) || '';
|
|
@@ -31421,7 +31433,8 @@ var FramesModule = (function () {
|
|
|
31421
31433
|
'isFollower': function (state) {
|
|
31422
31434
|
return !!state.leaderId && state.leaderId !== state.frameId;
|
|
31423
31435
|
},
|
|
31424
|
-
'isTop': function (state) {
|
|
31436
|
+
'isTop': function (state, getters) {
|
|
31437
|
+
var window = getters.window();
|
|
31425
31438
|
return state.topId === state.frameId || window == window.top;
|
|
31426
31439
|
},
|
|
31427
31440
|
'frameVisibility': function (state) {
|
|
@@ -31539,6 +31552,9 @@ var FramesModule = (function () {
|
|
|
31539
31552
|
},
|
|
31540
31553
|
'getMyFrame': function (state) {
|
|
31541
31554
|
return state.frames[state.frameId];
|
|
31555
|
+
},
|
|
31556
|
+
'window': function () {
|
|
31557
|
+
return window;
|
|
31542
31558
|
}
|
|
31543
31559
|
};
|
|
31544
31560
|
return {
|
|
@@ -32937,6 +32953,9 @@ var DesignerConnect = (function () {
|
|
|
32937
32953
|
pluginAPI.Events.appUnloaded.off(unloadListener);
|
|
32938
32954
|
unloadListener = undefined;
|
|
32939
32955
|
}
|
|
32956
|
+
if (tempLaunchToken) {
|
|
32957
|
+
tempLaunchToken = undefined;
|
|
32958
|
+
}
|
|
32940
32959
|
}
|
|
32941
32960
|
function onConnectMessage(data, msg) {
|
|
32942
32961
|
if (globalPendo.isSendingEvents()) {
|
|
@@ -35090,7 +35109,7 @@ var P1GuidePlugin = (function () {
|
|
|
35090
35109
|
// Adds pendo credits to the guide unless disabled
|
|
35091
35110
|
function Credits() {
|
|
35092
35111
|
var step = this;
|
|
35093
|
-
if (!step.hideCredits && !step.domJson && !step.domJsonpUrl) {
|
|
35112
|
+
if (!step.hideCredits && !step.domJson && !step.domJsonpUrl && !isForm(step.guide)) {
|
|
35094
35113
|
step.after('render', function () {
|
|
35095
35114
|
_addCredits(step.guideElement[0]);
|
|
35096
35115
|
});
|
|
@@ -35138,7 +35157,7 @@ var Branding = (function () {
|
|
|
35138
35157
|
link.href = 'https://www.pendo.io/pendo-free/nps?utm_source=pendo_app&utm_medium=branded-nps&utm_campaign=free-branded-nps';
|
|
35139
35158
|
link.target = '_blank';
|
|
35140
35159
|
var img = document.createElement('img');
|
|
35141
|
-
img.setAttribute('src',
|
|
35160
|
+
img.setAttribute('src', pluginApi.getAssetUrl('img/nps-branding.png'));
|
|
35142
35161
|
link.appendChild(img);
|
|
35143
35162
|
link.style.display = 'inline-block';
|
|
35144
35163
|
var div = document.createElement('div');
|
|
@@ -35973,7 +35992,7 @@ var FrustrationEvent = (function () {
|
|
|
35973
35992
|
*/
|
|
35974
35993
|
function addFrustrationType(event, type) {
|
|
35975
35994
|
var _a = event.frustrationTypes, frustrationTypes = _a === void 0 ? [] : _a;
|
|
35976
|
-
if (!
|
|
35995
|
+
if (!_.contains(frustrationTypes, type)) {
|
|
35977
35996
|
frustrationTypes.push(type);
|
|
35978
35997
|
event.frustrationTypes = frustrationTypes;
|
|
35979
35998
|
}
|
|
@@ -36018,7 +36037,7 @@ var FrustrationEvent = (function () {
|
|
|
36018
36037
|
}
|
|
36019
36038
|
function handleClickEvent(eventData, browserEvent) {
|
|
36020
36039
|
var isHyperlinked = browserEvent.target && browserEvent.target.tagName === 'A' && browserEvent.target.hasAttribute('href');
|
|
36021
|
-
var isDeadClickEligibleTag = browserEvent.target && !
|
|
36040
|
+
var isDeadClickEligibleTag = browserEvent.target && !_.contains(deadClickIneligibleTags, browserEvent.target.tagName);
|
|
36022
36041
|
if (canQueueDeadClicks && !hasHighlightedText && isDeadClickEligibleTag && !isHyperlinked) {
|
|
36023
36042
|
queueDeadClick(eventData);
|
|
36024
36043
|
}
|
|
@@ -36170,7 +36189,7 @@ var FrustrationEvent = (function () {
|
|
|
36170
36189
|
if (eventData.type === 'submit' || eventData.type === 'change') {
|
|
36171
36190
|
suspendDeadClickQueue();
|
|
36172
36191
|
}
|
|
36173
|
-
var isDeadClickIneligibleTag = _.has(browserEvent, 'target') &&
|
|
36192
|
+
var isDeadClickIneligibleTag = _.has(browserEvent, 'target') && _.contains(deadClickIneligibleTags, browserEvent.target.tagName);
|
|
36174
36193
|
if (eventData.type === 'focus' && isDeadClickIneligibleTag) {
|
|
36175
36194
|
suspendDeadClickQueue();
|
|
36176
36195
|
}
|
|
@@ -36910,7 +36929,10 @@ var WebAnalytics = /** @class */ (function () {
|
|
|
36910
36929
|
var referrerValue = calculateReferrerValue({ referrer: referrer, currentHost: currentHost });
|
|
36911
36930
|
// Check if this is a self-referral.
|
|
36912
36931
|
if (referrerValue !== 'self') {
|
|
36913
|
-
var
|
|
36932
|
+
var parsedUrl = this.api.util.parseUrl(url);
|
|
36933
|
+
if (!parsedUrl)
|
|
36934
|
+
return {};
|
|
36935
|
+
var query = parsedUrl.query;
|
|
36914
36936
|
// It is not a self referral, therefore we should calculate the channel and track the visit
|
|
36915
36937
|
var source = query.utm_source;
|
|
36916
36938
|
var medium = query.utm_medium;
|
|
@@ -36931,6 +36953,9 @@ var WebAnalytics = /** @class */ (function () {
|
|
|
36931
36953
|
if (referrer && this.api.ConfigReader.get(CAPTURE_REFERRER_CONFIG_KEY)) {
|
|
36932
36954
|
utm.referrer = referrer;
|
|
36933
36955
|
}
|
|
36956
|
+
else if (referrerValue !== 'direct') {
|
|
36957
|
+
utm.referrer = referrerValue;
|
|
36958
|
+
}
|
|
36934
36959
|
return utm;
|
|
36935
36960
|
}
|
|
36936
36961
|
}
|
|
@@ -36992,6 +37017,524 @@ var WebAnalytics = /** @class */ (function () {
|
|
|
36992
37017
|
}());
|
|
36993
37018
|
var WebAnalytics$1 = new WebAnalytics();
|
|
36994
37019
|
|
|
37020
|
+
var buildFormStepBehaviors = function () {
|
|
37021
|
+
if (!this.attributes) {
|
|
37022
|
+
log.info('buildFormStepBehaviors called with invalid context');
|
|
37023
|
+
return {};
|
|
37024
|
+
}
|
|
37025
|
+
var step = this;
|
|
37026
|
+
var originalShow = step.show;
|
|
37027
|
+
var originalHide = step.hide;
|
|
37028
|
+
// Override the show method to respect validation state
|
|
37029
|
+
var show = function (reason) {
|
|
37030
|
+
if (step.attributes.validationHidden) {
|
|
37031
|
+
return false;
|
|
37032
|
+
}
|
|
37033
|
+
return originalShow.call(step, reason);
|
|
37034
|
+
};
|
|
37035
|
+
// Override the hide method to track validation state
|
|
37036
|
+
var hide = function (options) {
|
|
37037
|
+
if (options && options.validationHidden) {
|
|
37038
|
+
step.attributes.validationHidden = true;
|
|
37039
|
+
}
|
|
37040
|
+
return originalHide.call(step, options);
|
|
37041
|
+
};
|
|
37042
|
+
return { show: show, hide: hide };
|
|
37043
|
+
};
|
|
37044
|
+
|
|
37045
|
+
var domJsonBase = {
|
|
37046
|
+
'children': [],
|
|
37047
|
+
'props': {
|
|
37048
|
+
'class': '_pendo-step-container',
|
|
37049
|
+
'data-layout': 'tooltipBlank',
|
|
37050
|
+
'id': 'pendo-base'
|
|
37051
|
+
},
|
|
37052
|
+
'type': 'div'
|
|
37053
|
+
};
|
|
37054
|
+
var domJsonCss = {
|
|
37055
|
+
'css': [],
|
|
37056
|
+
'props': {
|
|
37057
|
+
'scoped': 'scoped',
|
|
37058
|
+
'type': 'text/css'
|
|
37059
|
+
},
|
|
37060
|
+
'type': 'style'
|
|
37061
|
+
};
|
|
37062
|
+
var layoutContainer = {
|
|
37063
|
+
'children': [],
|
|
37064
|
+
'props': {
|
|
37065
|
+
'class': '_pendo-step-container-size',
|
|
37066
|
+
'data-relative-alignment': true,
|
|
37067
|
+
'data-vertical-alignment': 'Relative to Element',
|
|
37068
|
+
'id': 'pendo-g-validation-tooltip-container',
|
|
37069
|
+
'style': {
|
|
37070
|
+
'display': 'block',
|
|
37071
|
+
'width': '300px',
|
|
37072
|
+
'z-index': 300000
|
|
37073
|
+
}
|
|
37074
|
+
},
|
|
37075
|
+
'type': 'div'
|
|
37076
|
+
};
|
|
37077
|
+
var guideStepContainer = {
|
|
37078
|
+
'children': [],
|
|
37079
|
+
'props': {
|
|
37080
|
+
'class': '_pendo-step-container-styles',
|
|
37081
|
+
'id': 'pendo-guide-container',
|
|
37082
|
+
'role': 'dialog',
|
|
37083
|
+
'data-caret-enabled': true,
|
|
37084
|
+
'data-caret-height': '15px',
|
|
37085
|
+
'data-caret-width': '15px',
|
|
37086
|
+
'style': {
|
|
37087
|
+
'background-color': 'rgba(255, 255, 255, 1)',
|
|
37088
|
+
'border': '1px solid #BBBBBB',
|
|
37089
|
+
'border-radius': '5px',
|
|
37090
|
+
'padding': '8px 12px',
|
|
37091
|
+
'box-shadow': '0px 0px 10px 0px rgba(190, 190, 190, 0.5)'
|
|
37092
|
+
},
|
|
37093
|
+
'tabindex': -1
|
|
37094
|
+
},
|
|
37095
|
+
'type': 'div'
|
|
37096
|
+
};
|
|
37097
|
+
var textContainer = {
|
|
37098
|
+
'children': [],
|
|
37099
|
+
'props': {
|
|
37100
|
+
'class': '_pendo-text-paragraph',
|
|
37101
|
+
'style': {}
|
|
37102
|
+
},
|
|
37103
|
+
'type': 'div'
|
|
37104
|
+
};
|
|
37105
|
+
function createRuleBlock(id, text) {
|
|
37106
|
+
var textChild = createTextBlock(id, text);
|
|
37107
|
+
return {
|
|
37108
|
+
'props': {
|
|
37109
|
+
'id': "rule-".concat(id),
|
|
37110
|
+
'class': 'text-row',
|
|
37111
|
+
'style': { 'display': 'flex', 'align-items': 'center' }
|
|
37112
|
+
},
|
|
37113
|
+
'children': [textChild],
|
|
37114
|
+
'type': 'div'
|
|
37115
|
+
};
|
|
37116
|
+
}
|
|
37117
|
+
function createTextBlock(id, content) {
|
|
37118
|
+
return {
|
|
37119
|
+
'content': content,
|
|
37120
|
+
'props': {
|
|
37121
|
+
'id': "text-".concat(id),
|
|
37122
|
+
'class': '_pendo-text-plain',
|
|
37123
|
+
'style': { 'color': 'gray', 'margin': 0 }
|
|
37124
|
+
},
|
|
37125
|
+
'type': 'p'
|
|
37126
|
+
};
|
|
37127
|
+
}
|
|
37128
|
+
function createIcon(svgString) {
|
|
37129
|
+
var parser = new DOMParser();
|
|
37130
|
+
var svgDoc = parser.parseFromString(svgString, 'image/svg+xml');
|
|
37131
|
+
var svgElement = svgDoc.documentElement;
|
|
37132
|
+
// Create a wrapper div with a margin right of 5px
|
|
37133
|
+
var wrapperDiv = document.createElement('div');
|
|
37134
|
+
wrapperDiv.style.marginRight = '5px';
|
|
37135
|
+
wrapperDiv.appendChild(svgElement);
|
|
37136
|
+
return wrapperDiv;
|
|
37137
|
+
}
|
|
37138
|
+
var defaultIcon = "\n<svg xmlns=\"http://www.w3.org/2000/svg\" \n width=\"10\" height=\"10\" fill=\"none\"\n stroke=\"gray\" stroke-linecap=\"round\" stroke-linejoin=\"round\" \n stroke-width=\"2\" viewBox=\"0 0 10 10\">\n <line x1=\"2\" y1=\"5\" x2=\"8\" y2=\"5\"/>\n</svg>\n";
|
|
37139
|
+
var validIcon = "\n<svg xmlns=\"http://www.w3.org/2000/svg\" \n width=\"10\" height=\"10\" viewBox=\"0 0 10 10\" \n fill=\"none\" stroke=\"green\" stroke-width=\"2\" \n stroke-linecap=\"round\" stroke-linejoin=\"round\" \n class=\"feather feather-check\">\n <polyline points=\"2 5 4 7 8 2\"></polyline>\n</svg>\n";
|
|
37140
|
+
var invalidIcon = "\n<svg xmlns=\"http://www.w3.org/2000/svg\" \n width=\"10\" height=\"10\" viewBox=\"0 0 10 10\" \n fill=\"none\" stroke=\"red\" stroke-width=\"2\" \n stroke-linecap=\"round\" stroke-linejoin=\"round\" \n class=\"feather feather-x\">\n <line x1=\"2\" y1=\"2\" x2=\"8\" y2=\"8\"/>\n <line x1=\"8\" y1=\"2\" x2=\"2\" y2=\"8\"/>\n</svg>\n";
|
|
37141
|
+
|
|
37142
|
+
var regexPatterns = {
|
|
37143
|
+
'emailRegex': /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
|
|
37144
|
+
'phoneRegex': /^(\+\d{1,2}\s?)?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}$/,
|
|
37145
|
+
'urlRegex': /^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_+.~#?&/=]*)$/
|
|
37146
|
+
};
|
|
37147
|
+
var dateFormats = {
|
|
37148
|
+
'MM-DD-YYYY': /^(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])-(19|20)\d\d$/,
|
|
37149
|
+
'DD-MM-YYYY': /^(0[1-9]|[12][0-9]|3[01])-(0[1-9]|1[0-2])-(19|20)\d\d$/,
|
|
37150
|
+
'MM/DD/YYYY': /^(0[1-9]|1[0-2])\/(0[1-9]|[12][0-9]|3[01])\/(19|20)\d\d$/,
|
|
37151
|
+
'DD/MM/YYYY': /^(0[1-9]|[12][0-9]|3[01])\/(0[1-9]|1[0-2])\/(19|20)\d\d$/,
|
|
37152
|
+
'YYYY-MM-DD': /^(19|20)\d\d-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/
|
|
37153
|
+
};
|
|
37154
|
+
var validators = {
|
|
37155
|
+
'email': function (value) {
|
|
37156
|
+
return regexPatterns.emailRegex.test(value);
|
|
37157
|
+
},
|
|
37158
|
+
'phone': function (value) {
|
|
37159
|
+
return regexPatterns.phoneRegex.test(value);
|
|
37160
|
+
},
|
|
37161
|
+
'date': function (value, options) {
|
|
37162
|
+
if (options === void 0) { options = {}; }
|
|
37163
|
+
var regex = dateFormats[options.format] || dateFormats['MM/DD/YYYY'];
|
|
37164
|
+
return regex.test(value);
|
|
37165
|
+
},
|
|
37166
|
+
'url': function (value) {
|
|
37167
|
+
return regexPatterns.urlRegex.test(value);
|
|
37168
|
+
},
|
|
37169
|
+
'number': function (value, options) {
|
|
37170
|
+
if (options === void 0) { options = {}; }
|
|
37171
|
+
if (value === '')
|
|
37172
|
+
return false;
|
|
37173
|
+
var min = options.min, max = options.max, allowDecimal = options.allowDecimal;
|
|
37174
|
+
var hasMin = hasValue(min);
|
|
37175
|
+
var hasMax = hasValue(max);
|
|
37176
|
+
if (hasMin)
|
|
37177
|
+
min = Number(min);
|
|
37178
|
+
if (hasMax)
|
|
37179
|
+
max = Number(max);
|
|
37180
|
+
var num = Number(value);
|
|
37181
|
+
if (isNaN(num))
|
|
37182
|
+
return false;
|
|
37183
|
+
if (hasMin && num < min)
|
|
37184
|
+
return false;
|
|
37185
|
+
if (hasMax && num > max)
|
|
37186
|
+
return false;
|
|
37187
|
+
if (!allowDecimal && num % 1 !== 0)
|
|
37188
|
+
return false; // eslint-disable-line
|
|
37189
|
+
return true;
|
|
37190
|
+
},
|
|
37191
|
+
'characterLength': function (value, options) {
|
|
37192
|
+
if (options === void 0) { options = {}; }
|
|
37193
|
+
var min = options.min, max = options.max;
|
|
37194
|
+
var hasMin = hasValue(min);
|
|
37195
|
+
var hasMax = hasValue(max);
|
|
37196
|
+
if (hasMin)
|
|
37197
|
+
min = Number(min);
|
|
37198
|
+
if (hasMax)
|
|
37199
|
+
max = Number(max);
|
|
37200
|
+
if (hasMin && value.length < min)
|
|
37201
|
+
return false;
|
|
37202
|
+
if (hasMax && value.length > max)
|
|
37203
|
+
return false; // eslint-disable-line
|
|
37204
|
+
return true;
|
|
37205
|
+
}
|
|
37206
|
+
};
|
|
37207
|
+
function hasValue(value) {
|
|
37208
|
+
return value !== undefined && value !== null && value !== '';
|
|
37209
|
+
}
|
|
37210
|
+
|
|
37211
|
+
var FormValidation = (function () {
|
|
37212
|
+
var globalPendo;
|
|
37213
|
+
var pluginApi;
|
|
37214
|
+
var validationGuides = [];
|
|
37215
|
+
var debouncedValidate;
|
|
37216
|
+
var activeStep;
|
|
37217
|
+
var activeField;
|
|
37218
|
+
var activeFieldIsValid = null;
|
|
37219
|
+
var designerModeCheckInterval;
|
|
37220
|
+
return {
|
|
37221
|
+
'name': 'FormValidation',
|
|
37222
|
+
validationGuides: validationGuides,
|
|
37223
|
+
debouncedValidate: debouncedValidate,
|
|
37224
|
+
initialize: initialize,
|
|
37225
|
+
teardown: teardown,
|
|
37226
|
+
appendValidationStyles: appendValidationStyles,
|
|
37227
|
+
getActiveStep: getActiveStep,
|
|
37228
|
+
setActiveStep: setActiveStep,
|
|
37229
|
+
setActiveField: setActiveField,
|
|
37230
|
+
getActiveField: getActiveField,
|
|
37231
|
+
getActiveFieldIsValid: getActiveFieldIsValid,
|
|
37232
|
+
setActiveFieldIsValid: setActiveFieldIsValid,
|
|
37233
|
+
getValidationGuides: getValidationGuides,
|
|
37234
|
+
setValidationGuides: setValidationGuides,
|
|
37235
|
+
initializeFormValidation: initializeFormValidation,
|
|
37236
|
+
clearAllValidationGuides: clearAllValidationGuides,
|
|
37237
|
+
extractValidationGuides: extractValidationGuides,
|
|
37238
|
+
applyFormBehaviors: applyFormBehaviors,
|
|
37239
|
+
checkValidationFieldVisibility: checkValidationFieldVisibility,
|
|
37240
|
+
hideValidationTooltip: hideValidationTooltip,
|
|
37241
|
+
focusField: focusField,
|
|
37242
|
+
blurField: blurField,
|
|
37243
|
+
findFieldByElement: findFieldByElement,
|
|
37244
|
+
validateInput: validateInput,
|
|
37245
|
+
validateField: validateField,
|
|
37246
|
+
getRuleText: getRuleText,
|
|
37247
|
+
setValidationStyle: setValidationStyle
|
|
37248
|
+
};
|
|
37249
|
+
function initialize(pendo, PluginAPI) {
|
|
37250
|
+
var hasFormValidation = PluginAPI.ConfigReader.get('formValidation');
|
|
37251
|
+
if (!hasFormValidation) {
|
|
37252
|
+
return;
|
|
37253
|
+
}
|
|
37254
|
+
globalPendo = pendo;
|
|
37255
|
+
pluginApi = PluginAPI;
|
|
37256
|
+
debouncedValidate = _.debounce(validateInput, 100);
|
|
37257
|
+
pluginApi.Events.on('deliverablesLoaded', clearAllValidationGuides);
|
|
37258
|
+
pluginApi.Events.on('guideLoopStopped', hideValidationTooltip);
|
|
37259
|
+
pluginApi.Events.on('guideListChanged', initializeFormValidation);
|
|
37260
|
+
pluginApi.GuideLoop.addUpdatePhase(checkValidationFieldVisibility);
|
|
37261
|
+
pluginApi.guides.addProcessor(extractValidationGuides);
|
|
37262
|
+
var isInDesignerMode = !!(globalPendo === null || globalPendo === void 0 ? void 0 : globalPendo.designer);
|
|
37263
|
+
// Set up an interval to check for designer mode
|
|
37264
|
+
designerModeCheckInterval = setInterval(function () {
|
|
37265
|
+
if (isInDesignerMode) {
|
|
37266
|
+
teardown();
|
|
37267
|
+
clearInterval(designerModeCheckInterval);
|
|
37268
|
+
designerModeCheckInterval = null;
|
|
37269
|
+
return;
|
|
37270
|
+
}
|
|
37271
|
+
}, 1000);
|
|
37272
|
+
pendo.attachEvent(document, 'focusin', focusField);
|
|
37273
|
+
pendo.attachEvent(document, 'focusout', blurField);
|
|
37274
|
+
pendo.attachEvent(document, 'input', debouncedValidate);
|
|
37275
|
+
}
|
|
37276
|
+
function teardown() {
|
|
37277
|
+
if (designerModeCheckInterval) {
|
|
37278
|
+
clearInterval(designerModeCheckInterval);
|
|
37279
|
+
designerModeCheckInterval = null;
|
|
37280
|
+
}
|
|
37281
|
+
pluginApi.Events.off('deliverablesLoaded', clearAllValidationGuides);
|
|
37282
|
+
pluginApi.Events.off('guideLoopStopped', hideValidationTooltip);
|
|
37283
|
+
pluginApi.Events.off('guideListChanged', initializeFormValidation);
|
|
37284
|
+
pluginApi.GuideLoop.removeUpdatePhase(checkValidationFieldVisibility);
|
|
37285
|
+
pluginApi.guides.removeProcessor(extractValidationGuides);
|
|
37286
|
+
globalPendo.detachEvent(document, 'focusin', focusField);
|
|
37287
|
+
globalPendo.detachEvent(document, 'focusout', blurField);
|
|
37288
|
+
globalPendo.detachEvent(document, 'input', debouncedValidate);
|
|
37289
|
+
debouncedValidate.cancel();
|
|
37290
|
+
validationGuides = [];
|
|
37291
|
+
activeStep = null;
|
|
37292
|
+
activeField = null;
|
|
37293
|
+
activeFieldIsValid = null;
|
|
37294
|
+
}
|
|
37295
|
+
function clearAllValidationGuides() {
|
|
37296
|
+
pluginApi.guides.removeDisplayableGuides('validationGuides');
|
|
37297
|
+
validationGuides = [];
|
|
37298
|
+
}
|
|
37299
|
+
function hideValidationTooltip() {
|
|
37300
|
+
globalPendo.detachEvent(document, 'focusin', focusField);
|
|
37301
|
+
if (activeField) {
|
|
37302
|
+
activeField = null;
|
|
37303
|
+
activeFieldIsValid = null;
|
|
37304
|
+
}
|
|
37305
|
+
if (activeStep) {
|
|
37306
|
+
activeStep.hide({ 'validationHidden': true });
|
|
37307
|
+
activeStep = null;
|
|
37308
|
+
}
|
|
37309
|
+
}
|
|
37310
|
+
function initializeFormValidation() {
|
|
37311
|
+
appendValidationStyles();
|
|
37312
|
+
pluginApi.guides.registerDisplayableGuides('validationGuides', validationGuides);
|
|
37313
|
+
applyFormBehaviors();
|
|
37314
|
+
}
|
|
37315
|
+
function applyFormBehaviors() {
|
|
37316
|
+
_.map(validationGuides, function (guide) {
|
|
37317
|
+
_.map(guide.steps, function (step) {
|
|
37318
|
+
var stepBehaviors = buildFormStepBehaviors.call(step);
|
|
37319
|
+
Object.assign(step, stepBehaviors);
|
|
37320
|
+
});
|
|
37321
|
+
});
|
|
37322
|
+
}
|
|
37323
|
+
function checkValidationFieldVisibility() {
|
|
37324
|
+
var _a;
|
|
37325
|
+
// If there is an active field/step, check if the associated element still exists
|
|
37326
|
+
if (activeField) {
|
|
37327
|
+
var element = globalPendo.Sizzle(activeStep.elementPathRule)[0];
|
|
37328
|
+
// If element doesn't exist, dismiss the validation
|
|
37329
|
+
if (!element || !globalPendo.isElementVisible(element)) {
|
|
37330
|
+
activeField = null;
|
|
37331
|
+
activeFieldIsValid = null;
|
|
37332
|
+
activeStep.hide({ 'validationHidden': true });
|
|
37333
|
+
activeStep = null;
|
|
37334
|
+
}
|
|
37335
|
+
}
|
|
37336
|
+
// If focusin event listener was detached when guide loop stopped, attach it again
|
|
37337
|
+
var docData = DomData$1.get(document);
|
|
37338
|
+
var bubbleFocusEvents = ((_a = docData.bubbleEvents) === null || _a === void 0 ? void 0 : _a.focusin) || [];
|
|
37339
|
+
var isFocusFieldAttached = bubbleFocusEvents.some(function (e) { return e.handler === focusField; });
|
|
37340
|
+
if (!isFocusFieldAttached) {
|
|
37341
|
+
globalPendo.attachEvent(document, 'focusin', focusField);
|
|
37342
|
+
}
|
|
37343
|
+
}
|
|
37344
|
+
function extractValidationGuides(guide) {
|
|
37345
|
+
if (guide.launchMethod === 'form') {
|
|
37346
|
+
if (!_.some(validationGuides, function (_a) {
|
|
37347
|
+
var id = _a.id;
|
|
37348
|
+
return id === guide.id;
|
|
37349
|
+
})) {
|
|
37350
|
+
validationGuides.push(guide);
|
|
37351
|
+
}
|
|
37352
|
+
}
|
|
37353
|
+
return true;
|
|
37354
|
+
}
|
|
37355
|
+
function appendValidationStyles() {
|
|
37356
|
+
var style = document.createElement('style');
|
|
37357
|
+
style.innerHTML = "\n input[data-pendo-field-valid=\"false\"] {\n border-color: red !important;\n outline-color: red !important;\n }\n ";
|
|
37358
|
+
document.head.appendChild(style);
|
|
37359
|
+
}
|
|
37360
|
+
function focusField(event) {
|
|
37361
|
+
var _a, _b;
|
|
37362
|
+
var target = event.target;
|
|
37363
|
+
if (target.tagName === 'INPUT') {
|
|
37364
|
+
var matchingField = findFieldByElement(target);
|
|
37365
|
+
if (matchingField && activeStep) {
|
|
37366
|
+
activeStep.attributes.validationHidden = false;
|
|
37367
|
+
// if there is no domJson on the step,
|
|
37368
|
+
// this is the first time the user is focusing on the field
|
|
37369
|
+
// so add the text and icon
|
|
37370
|
+
if (!activeStep.domJson) {
|
|
37371
|
+
appendDomJson();
|
|
37372
|
+
}
|
|
37373
|
+
activeStep.show('api');
|
|
37374
|
+
var ruleElement = document.getElementById("rule-".concat((_a = activeField === null || activeField === void 0 ? void 0 : activeField.rules[0]) === null || _a === void 0 ? void 0 : _a.id));
|
|
37375
|
+
if (ruleElement && ((_b = activeField === null || activeField === void 0 ? void 0 : activeField.rules[0]) === null || _b === void 0 ? void 0 : _b.type)) {
|
|
37376
|
+
// add the icon for the rule
|
|
37377
|
+
var icon = activeField.isValid === null ? createIcon(defaultIcon)
|
|
37378
|
+
: activeFieldIsValid ? createIcon(validIcon)
|
|
37379
|
+
: createIcon(invalidIcon);
|
|
37380
|
+
ruleElement.insertBefore(icon, ruleElement.firstChild);
|
|
37381
|
+
}
|
|
37382
|
+
if (matchingField.value !== '') {
|
|
37383
|
+
validateField(target);
|
|
37384
|
+
}
|
|
37385
|
+
}
|
|
37386
|
+
}
|
|
37387
|
+
}
|
|
37388
|
+
function blurField(event) {
|
|
37389
|
+
var target = event.target;
|
|
37390
|
+
if (activeField && activeStep) {
|
|
37391
|
+
var targetMatchesActiveField = globalPendo.Sizzle.matchesSelector(target, activeStep === null || activeStep === void 0 ? void 0 : activeStep.elementPathRule);
|
|
37392
|
+
if (targetMatchesActiveField) {
|
|
37393
|
+
setValidationStyle(target, activeFieldIsValid);
|
|
37394
|
+
}
|
|
37395
|
+
activeStep.hide({ 'validationHidden': true });
|
|
37396
|
+
if (activeField.isValid === null && activeFieldIsValid === false) {
|
|
37397
|
+
var ruleTextBlock = getRuleText();
|
|
37398
|
+
ruleTextBlock.props.style.color = 'red';
|
|
37399
|
+
}
|
|
37400
|
+
activeField.isValid = activeFieldIsValid;
|
|
37401
|
+
activeField = null;
|
|
37402
|
+
activeStep = null;
|
|
37403
|
+
activeFieldIsValid = null;
|
|
37404
|
+
}
|
|
37405
|
+
}
|
|
37406
|
+
function findFieldByElement(element) {
|
|
37407
|
+
var _a;
|
|
37408
|
+
if (activeStep) {
|
|
37409
|
+
activeStep.hide({ 'validationHidden': true });
|
|
37410
|
+
}
|
|
37411
|
+
activeStep = null;
|
|
37412
|
+
activeField = null;
|
|
37413
|
+
activeFieldIsValid = null;
|
|
37414
|
+
// loop through fields to find a field that matches the event target
|
|
37415
|
+
// to determine if there is a validation for that target
|
|
37416
|
+
for (var _i = 0, validationGuides_1 = validationGuides; _i < validationGuides_1.length; _i++) {
|
|
37417
|
+
var guide = validationGuides_1[_i];
|
|
37418
|
+
var matchingStep = _.find(guide.steps, function (step) {
|
|
37419
|
+
return globalPendo.Sizzle.matchesSelector(element, step.elementPathRule);
|
|
37420
|
+
});
|
|
37421
|
+
if (matchingStep) {
|
|
37422
|
+
activeStep = matchingStep;
|
|
37423
|
+
activeField = (_a = matchingStep.attributes) === null || _a === void 0 ? void 0 : _a.field;
|
|
37424
|
+
activeFieldIsValid = activeField.isValid;
|
|
37425
|
+
return activeField;
|
|
37426
|
+
}
|
|
37427
|
+
}
|
|
37428
|
+
return null;
|
|
37429
|
+
}
|
|
37430
|
+
function appendDomJson() {
|
|
37431
|
+
var rule = activeField.rules[0];
|
|
37432
|
+
// Create text blocks
|
|
37433
|
+
var helperContent = createTextBlock("context-".concat(activeField.id), activeField.context);
|
|
37434
|
+
var ruleContent = (rule === null || rule === void 0 ? void 0 : rule.type) ? createRuleBlock(rule.id, rule.ruleText) : null;
|
|
37435
|
+
// Filter out null values and check if we have any content
|
|
37436
|
+
var textBlocks = [helperContent, ruleContent].filter(Boolean);
|
|
37437
|
+
if (textBlocks.length === 0) {
|
|
37438
|
+
return;
|
|
37439
|
+
}
|
|
37440
|
+
// compile the basic json building blocks
|
|
37441
|
+
var stepBase = deepCopy(domJsonBase);
|
|
37442
|
+
var stepCss = deepCopy(domJsonCss);
|
|
37443
|
+
var stepLayoutContainer = deepCopy(layoutContainer);
|
|
37444
|
+
var stepContainer = deepCopy(guideStepContainer);
|
|
37445
|
+
var stepTextContainer = deepCopy(textContainer);
|
|
37446
|
+
stepBase.children.push(stepCss, stepLayoutContainer);
|
|
37447
|
+
stepLayoutContainer.children.push(stepContainer);
|
|
37448
|
+
stepContainer.children.push(stepTextContainer);
|
|
37449
|
+
stepTextContainer.children = textBlocks;
|
|
37450
|
+
activeStep.domJson = stepBase;
|
|
37451
|
+
}
|
|
37452
|
+
function validateInput(event) {
|
|
37453
|
+
var target = event.target;
|
|
37454
|
+
// check if the user is typing in current active field
|
|
37455
|
+
var targetMatchesActiveField = globalPendo.Sizzle.matchesSelector(target, activeStep === null || activeStep === void 0 ? void 0 : activeStep.elementPathRule);
|
|
37456
|
+
if (targetMatchesActiveField) {
|
|
37457
|
+
validateField(target);
|
|
37458
|
+
}
|
|
37459
|
+
else {
|
|
37460
|
+
// if not, find the field that matches the event target
|
|
37461
|
+
var matchingField = findFieldByElement(target);
|
|
37462
|
+
if (matchingField) {
|
|
37463
|
+
activeFieldIsValid = matchingField.isValid;
|
|
37464
|
+
validateField(target);
|
|
37465
|
+
}
|
|
37466
|
+
}
|
|
37467
|
+
}
|
|
37468
|
+
function validateField(target) {
|
|
37469
|
+
var rule = activeField === null || activeField === void 0 ? void 0 : activeField.rules[0];
|
|
37470
|
+
if (!rule) {
|
|
37471
|
+
return;
|
|
37472
|
+
}
|
|
37473
|
+
var validator = validators[rule.type];
|
|
37474
|
+
if (!validator) {
|
|
37475
|
+
return;
|
|
37476
|
+
}
|
|
37477
|
+
var isValid = validator(target.value, rule.options);
|
|
37478
|
+
activeFieldIsValid = !!isValid;
|
|
37479
|
+
var ruleTextBlock = getRuleText();
|
|
37480
|
+
// don't show invalid if the user hasn't finished typing
|
|
37481
|
+
var newIcon;
|
|
37482
|
+
if (activeField.isValid === null) {
|
|
37483
|
+
ruleTextBlock.props.style.color = isValid ? 'green' : 'gray';
|
|
37484
|
+
newIcon = isValid ? createIcon(validIcon) : createIcon(defaultIcon);
|
|
37485
|
+
}
|
|
37486
|
+
else {
|
|
37487
|
+
ruleTextBlock.props.style.color = isValid ? 'green' : 'red';
|
|
37488
|
+
newIcon = isValid ? createIcon(validIcon) : createIcon(invalidIcon);
|
|
37489
|
+
setValidationStyle(target, isValid);
|
|
37490
|
+
}
|
|
37491
|
+
activeStep.hide({ 'stepHidden': true });
|
|
37492
|
+
activeStep.show('api');
|
|
37493
|
+
var ruleElement = document.getElementById("rule-".concat(activeField.rules[0].id));
|
|
37494
|
+
if (ruleElement) {
|
|
37495
|
+
ruleElement.insertBefore(newIcon, ruleElement.firstChild);
|
|
37496
|
+
}
|
|
37497
|
+
}
|
|
37498
|
+
function getRuleText() {
|
|
37499
|
+
var ruleId = activeField.rules[0].id;
|
|
37500
|
+
var ruleTextId = "text-".concat(ruleId);
|
|
37501
|
+
var ruleTextBlock = findBlockById(ruleTextId, activeStep.domJson);
|
|
37502
|
+
return ruleTextBlock;
|
|
37503
|
+
}
|
|
37504
|
+
function setValidationStyle(target, isValid) {
|
|
37505
|
+
if (isValid === false) {
|
|
37506
|
+
target.setAttribute('data-pendo-field-valid', false);
|
|
37507
|
+
}
|
|
37508
|
+
else {
|
|
37509
|
+
target.removeAttribute('data-pendo-field-valid');
|
|
37510
|
+
}
|
|
37511
|
+
}
|
|
37512
|
+
function getActiveStep() {
|
|
37513
|
+
return activeStep;
|
|
37514
|
+
}
|
|
37515
|
+
function setActiveStep(step) {
|
|
37516
|
+
activeStep = step;
|
|
37517
|
+
}
|
|
37518
|
+
function getActiveField() {
|
|
37519
|
+
return activeField;
|
|
37520
|
+
}
|
|
37521
|
+
function setActiveField(field) {
|
|
37522
|
+
activeField = field;
|
|
37523
|
+
}
|
|
37524
|
+
function getActiveFieldIsValid() {
|
|
37525
|
+
return activeFieldIsValid;
|
|
37526
|
+
}
|
|
37527
|
+
function setActiveFieldIsValid(isValid) {
|
|
37528
|
+
activeFieldIsValid = isValid;
|
|
37529
|
+
}
|
|
37530
|
+
function getValidationGuides() {
|
|
37531
|
+
return validationGuides;
|
|
37532
|
+
}
|
|
37533
|
+
function setValidationGuides(guides) {
|
|
37534
|
+
validationGuides = guides;
|
|
37535
|
+
}
|
|
37536
|
+
})();
|
|
37537
|
+
|
|
36995
37538
|
function registerBuiltInPlugins() {
|
|
36996
37539
|
registerPlugin(IFrameMonitor);
|
|
36997
37540
|
registerPlugin(DOMActivation);
|
|
@@ -37008,6 +37551,7 @@ function registerBuiltInPlugins() {
|
|
|
37008
37551
|
registerPlugin(SessionManager$1);
|
|
37009
37552
|
registerPlugin(SegmentFlags$1);
|
|
37010
37553
|
registerPlugin(WebAnalytics$1);
|
|
37554
|
+
registerPlugin(FormValidation);
|
|
37011
37555
|
}
|
|
37012
37556
|
|
|
37013
37557
|
/*
|
|
@@ -43586,6 +44130,7 @@ var Feedback = (function () {
|
|
|
43586
44130
|
var iframeContainer = globalPendo.dom(document.createElement('iframe'));
|
|
43587
44131
|
iframeContainer.css(iframeContainerStyles);
|
|
43588
44132
|
iframeContainer.attr('id', elemIds.feedbackIframe);
|
|
44133
|
+
iframeContainer.attr('title', 'Feedback');
|
|
43589
44134
|
iframeContainer.attr('src', getWidgetInitialSource());
|
|
43590
44135
|
return iframeContainer;
|
|
43591
44136
|
}
|
|
@@ -43836,14 +44381,20 @@ const testableMethods$1 = {
|
|
|
43836
44381
|
MutationObserver: ["constructor"]
|
|
43837
44382
|
};
|
|
43838
44383
|
const untaintedBasePrototype$1 = {};
|
|
43839
|
-
|
|
43840
|
-
|
|
43841
|
-
|
|
44384
|
+
function angularZoneUnpatchedAlternative$1(key) {
|
|
44385
|
+
var _a2, _b;
|
|
44386
|
+
const angularUnpatchedVersionSymbol = (_b = (_a2 = globalThis == null ? void 0 : globalThis.Zone) == null ? void 0 : _a2.__symbol__) == null ? void 0 : _b.call(_a2, key);
|
|
44387
|
+
if (angularUnpatchedVersionSymbol && globalThis[angularUnpatchedVersionSymbol]) {
|
|
44388
|
+
return globalThis[angularUnpatchedVersionSymbol];
|
|
44389
|
+
} else {
|
|
44390
|
+
return void 0;
|
|
44391
|
+
}
|
|
44392
|
+
}
|
|
43842
44393
|
function getUntaintedPrototype$1(key) {
|
|
43843
44394
|
if (untaintedBasePrototype$1[key])
|
|
43844
44395
|
return untaintedBasePrototype$1[key];
|
|
43845
|
-
const
|
|
43846
|
-
const defaultPrototype =
|
|
44396
|
+
const candidate = angularZoneUnpatchedAlternative$1(key) || globalThis[key];
|
|
44397
|
+
const defaultPrototype = candidate.prototype;
|
|
43847
44398
|
const accessorNames = key in testableAccessors$1 ? testableAccessors$1[key] : void 0;
|
|
43848
44399
|
const isUntaintedAccessors = Boolean(
|
|
43849
44400
|
accessorNames && // @ts-expect-error 2345
|
|
@@ -43866,15 +44417,15 @@ function getUntaintedPrototype$1(key) {
|
|
|
43866
44417
|
}
|
|
43867
44418
|
)
|
|
43868
44419
|
);
|
|
43869
|
-
if (isUntaintedAccessors && isUntaintedMethods
|
|
43870
|
-
untaintedBasePrototype$1[key] =
|
|
43871
|
-
return
|
|
44420
|
+
if (isUntaintedAccessors && isUntaintedMethods) {
|
|
44421
|
+
untaintedBasePrototype$1[key] = candidate.prototype;
|
|
44422
|
+
return candidate.prototype;
|
|
43872
44423
|
}
|
|
43873
44424
|
try {
|
|
43874
44425
|
const iframeEl = document.createElement("iframe");
|
|
43875
44426
|
document.body.appendChild(iframeEl);
|
|
43876
44427
|
const win = iframeEl.contentWindow;
|
|
43877
|
-
if (!win) return
|
|
44428
|
+
if (!win) return candidate.prototype;
|
|
43878
44429
|
const untaintedObject = win[key].prototype;
|
|
43879
44430
|
document.body.removeChild(iframeEl);
|
|
43880
44431
|
if (!untaintedObject) return defaultPrototype;
|
|
@@ -44040,6 +44591,7 @@ function stringifyStylesheet(s2) {
|
|
|
44040
44591
|
}
|
|
44041
44592
|
}
|
|
44042
44593
|
function stringifyRule(rule, sheetHref) {
|
|
44594
|
+
var _a2;
|
|
44043
44595
|
if (isCSSImportRule(rule)) {
|
|
44044
44596
|
let importStringified;
|
|
44045
44597
|
try {
|
|
@@ -44050,7 +44602,7 @@ function stringifyRule(rule, sheetHref) {
|
|
|
44050
44602
|
} catch (error) {
|
|
44051
44603
|
importStringified = rule.cssText;
|
|
44052
44604
|
}
|
|
44053
|
-
if (rule.styleSheet.href) {
|
|
44605
|
+
if ((_a2 = rule == null ? void 0 : rule.styleSheet) == null ? void 0 : _a2.href) {
|
|
44054
44606
|
return absolutifyURLs(importStringified, rule.styleSheet.href);
|
|
44055
44607
|
}
|
|
44056
44608
|
return importStringified;
|
|
@@ -45256,14 +45808,20 @@ const testableMethods = {
|
|
|
45256
45808
|
MutationObserver: ["constructor"]
|
|
45257
45809
|
};
|
|
45258
45810
|
const untaintedBasePrototype = {};
|
|
45259
|
-
|
|
45260
|
-
|
|
45261
|
-
|
|
45811
|
+
function angularZoneUnpatchedAlternative(key) {
|
|
45812
|
+
var _a2, _b;
|
|
45813
|
+
const angularUnpatchedVersionSymbol = (_b = (_a2 = globalThis == null ? void 0 : globalThis.Zone) == null ? void 0 : _a2.__symbol__) == null ? void 0 : _b.call(_a2, key);
|
|
45814
|
+
if (angularUnpatchedVersionSymbol && globalThis[angularUnpatchedVersionSymbol]) {
|
|
45815
|
+
return globalThis[angularUnpatchedVersionSymbol];
|
|
45816
|
+
} else {
|
|
45817
|
+
return void 0;
|
|
45818
|
+
}
|
|
45819
|
+
}
|
|
45262
45820
|
function getUntaintedPrototype(key) {
|
|
45263
45821
|
if (untaintedBasePrototype[key])
|
|
45264
45822
|
return untaintedBasePrototype[key];
|
|
45265
|
-
const
|
|
45266
|
-
const defaultPrototype =
|
|
45823
|
+
const candidate = angularZoneUnpatchedAlternative(key) || globalThis[key];
|
|
45824
|
+
const defaultPrototype = candidate.prototype;
|
|
45267
45825
|
const accessorNames = key in testableAccessors ? testableAccessors[key] : void 0;
|
|
45268
45826
|
const isUntaintedAccessors = Boolean(
|
|
45269
45827
|
accessorNames && // @ts-expect-error 2345
|
|
@@ -45286,15 +45844,15 @@ function getUntaintedPrototype(key) {
|
|
|
45286
45844
|
}
|
|
45287
45845
|
)
|
|
45288
45846
|
);
|
|
45289
|
-
if (isUntaintedAccessors && isUntaintedMethods
|
|
45290
|
-
untaintedBasePrototype[key] =
|
|
45291
|
-
return
|
|
45847
|
+
if (isUntaintedAccessors && isUntaintedMethods) {
|
|
45848
|
+
untaintedBasePrototype[key] = candidate.prototype;
|
|
45849
|
+
return candidate.prototype;
|
|
45292
45850
|
}
|
|
45293
45851
|
try {
|
|
45294
45852
|
const iframeEl = document.createElement("iframe");
|
|
45295
45853
|
document.body.appendChild(iframeEl);
|
|
45296
45854
|
const win = iframeEl.contentWindow;
|
|
45297
|
-
if (!win) return
|
|
45855
|
+
if (!win) return candidate.prototype;
|
|
45298
45856
|
const untaintedObject = win[key].prototype;
|
|
45299
45857
|
document.body.removeChild(iframeEl);
|
|
45300
45858
|
if (!untaintedObject) return defaultPrototype;
|
|
@@ -46164,7 +46722,7 @@ class MutationBuffer {
|
|
|
46164
46722
|
}
|
|
46165
46723
|
const old = this.unattachedDoc.createElement("span");
|
|
46166
46724
|
if (m.oldValue) {
|
|
46167
|
-
old.
|
|
46725
|
+
old.style.cssText = m.oldValue;
|
|
46168
46726
|
}
|
|
46169
46727
|
for (const pname of Array.from(target.style)) {
|
|
46170
46728
|
const newValue = target.style.getPropertyValue(pname);
|
|
@@ -49460,16 +50018,18 @@ SessionRecorder.prototype.initialize = function (pendo, PluginAPI) {
|
|
|
49460
50018
|
// but ONLY for replay being enabled - all other values should be taken from the backend
|
|
49461
50019
|
if (pendo._.isBoolean(snippetOverrideValue)) {
|
|
49462
50020
|
isSessionReplayEnabled = snippetOverrideValue;
|
|
50021
|
+
if (!isSessionReplayEnabled) {
|
|
50022
|
+
this.api.log.info('Session Replay disabled via the snippet config');
|
|
50023
|
+
}
|
|
49463
50024
|
}
|
|
49464
50025
|
else {
|
|
49465
50026
|
isSessionReplayEnabled = this.config.enabled;
|
|
49466
50027
|
}
|
|
49467
50028
|
if (!isSessionReplayEnabled) {
|
|
49468
|
-
this.logStopReason('RECORDING_DISABLED');
|
|
49469
50029
|
return;
|
|
49470
50030
|
}
|
|
49471
50031
|
if (configReader.get('excludeNonGuideAnalytics')) {
|
|
49472
|
-
this.
|
|
50032
|
+
this.api.log.info('Session Replay is disabled because excludeNonGuideAnalytics is enabled');
|
|
49473
50033
|
return;
|
|
49474
50034
|
}
|
|
49475
50035
|
var sessionIdKey = this.sessionIdKey = "".concat(SESSION_RECORDING_ID, ".").concat(pendo.apiKey);
|