@pendo/agent 2.321.1 → 2.321.2
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 +1 -1
- package/dist/pendo.module.js +371 -370
- package/dist/pendo.module.min.js +4 -52
- package/dist/servers.json +7 -7
- package/package.json +1 -1
package/dist/pendo.module.js
CHANGED
|
@@ -3967,8 +3967,8 @@ let SERVER = '';
|
|
|
3967
3967
|
let ASSET_HOST = '';
|
|
3968
3968
|
let ASSET_PATH = '';
|
|
3969
3969
|
let DESIGNER_SERVER = '';
|
|
3970
|
-
let VERSION = '2.321.
|
|
3971
|
-
let PACKAGE_VERSION = '2.321.
|
|
3970
|
+
let VERSION = '2.321.2_';
|
|
3971
|
+
let PACKAGE_VERSION = '2.321.2';
|
|
3972
3972
|
let LOADER = 'xhr';
|
|
3973
3973
|
/* eslint-enable web-sdk-eslint-rules/no-gulp-env-references */
|
|
3974
3974
|
/**
|
|
@@ -40707,17 +40707,19 @@ function TextCapture() {
|
|
|
40707
40707
|
}
|
|
40708
40708
|
}
|
|
40709
40709
|
|
|
40710
|
-
|
|
40711
|
-
|
|
40712
|
-
|
|
40713
|
-
|
|
40714
|
-
|
|
40715
|
-
function lookupGuideButtons(domJson, buttons
|
|
40710
|
+
var substitutionRegex = '\\{(?:\\s?)([^.\\s]?visitor|account|parentAccount)\\.([^|\\s/]*)(?:\\s?\\|\\s?([^}]+|[\\/s]+))?(?:\\s?\\/\\s?){1}\\}';
|
|
40711
|
+
var skipStepString = '{skipStep:* *(auto|\\d+)\\/}';
|
|
40712
|
+
var goToMiddleString = '(?!0)(\\d+)';
|
|
40713
|
+
var goToString = "({goto-".concat(goToMiddleString, "\\/})");
|
|
40714
|
+
var containerSelector = '[id^="pendo-guide-container"]';
|
|
40715
|
+
function lookupGuideButtons(domJson, buttons) {
|
|
40716
|
+
if (buttons === void 0) { buttons = []; }
|
|
40716
40717
|
if (domJson.type === 'button' && domJson.actions) {
|
|
40717
40718
|
buttons.push(domJson);
|
|
40718
40719
|
}
|
|
40719
40720
|
if (domJson.children) {
|
|
40720
|
-
for (
|
|
40721
|
+
for (var _i = 0, _a = domJson.children; _i < _a.length; _i++) {
|
|
40722
|
+
var child = _a[_i];
|
|
40721
40723
|
lookupGuideButtons(child, buttons);
|
|
40722
40724
|
}
|
|
40723
40725
|
}
|
|
@@ -40746,15 +40748,16 @@ function removeMarkdownSyntax(element, textToReplace, replacementText, pendo) {
|
|
|
40746
40748
|
}
|
|
40747
40749
|
}
|
|
40748
40750
|
var guideMarkdownUtil = {
|
|
40749
|
-
substitutionRegex,
|
|
40750
|
-
skipStepString,
|
|
40751
|
-
goToString,
|
|
40752
|
-
containerSelector,
|
|
40753
|
-
lookupGuideButtons,
|
|
40754
|
-
removeMarkdownSyntax
|
|
40751
|
+
substitutionRegex: substitutionRegex,
|
|
40752
|
+
skipStepString: skipStepString,
|
|
40753
|
+
goToString: goToString,
|
|
40754
|
+
containerSelector: containerSelector,
|
|
40755
|
+
lookupGuideButtons: lookupGuideButtons,
|
|
40756
|
+
removeMarkdownSyntax: removeMarkdownSyntax
|
|
40755
40757
|
};
|
|
40756
40758
|
|
|
40757
|
-
function getZoneSafeMethod(_, method, target
|
|
40759
|
+
function getZoneSafeMethod(_, method, target) {
|
|
40760
|
+
if (target === void 0) { target = window; }
|
|
40758
40761
|
var zoneSymbol = '__symbol__';
|
|
40759
40762
|
/* global Zone */
|
|
40760
40763
|
if (typeof Zone !== 'undefined' && _.isFunction(Zone[zoneSymbol])) {
|
|
@@ -46582,10 +46585,7 @@ function initStyleSheetObserver({ styleSheetRuleCb, mirror: mirror2, stylesheetM
|
|
|
46582
46585
|
adds: [{ rule, index: index2 }]
|
|
46583
46586
|
});
|
|
46584
46587
|
}
|
|
46585
|
-
|
|
46586
|
-
return target.apply(thisArg, argumentsList);
|
|
46587
|
-
} catch (e2) {
|
|
46588
|
-
}
|
|
46588
|
+
return target.apply(thisArg, argumentsList);
|
|
46589
46589
|
}
|
|
46590
46590
|
)
|
|
46591
46591
|
});
|
|
@@ -46610,10 +46610,7 @@ function initStyleSheetObserver({ styleSheetRuleCb, mirror: mirror2, stylesheetM
|
|
|
46610
46610
|
removes: [{ index: index2 }]
|
|
46611
46611
|
});
|
|
46612
46612
|
}
|
|
46613
|
-
|
|
46614
|
-
return target.apply(thisArg, argumentsList);
|
|
46615
|
-
} catch (e2) {
|
|
46616
|
-
}
|
|
46613
|
+
return target.apply(thisArg, argumentsList);
|
|
46617
46614
|
}
|
|
46618
46615
|
)
|
|
46619
46616
|
});
|
|
@@ -46717,10 +46714,7 @@ function initStyleSheetObserver({ styleSheetRuleCb, mirror: mirror2, stylesheetM
|
|
|
46717
46714
|
]
|
|
46718
46715
|
});
|
|
46719
46716
|
}
|
|
46720
|
-
|
|
46721
|
-
return target.apply(thisArg, argumentsList);
|
|
46722
|
-
} catch (e2) {
|
|
46723
|
-
}
|
|
46717
|
+
return target.apply(thisArg, argumentsList);
|
|
46724
46718
|
}
|
|
46725
46719
|
)
|
|
46726
46720
|
}
|
|
@@ -46745,10 +46739,7 @@ function initStyleSheetObserver({ styleSheetRuleCb, mirror: mirror2, stylesheetM
|
|
|
46745
46739
|
]
|
|
46746
46740
|
});
|
|
46747
46741
|
}
|
|
46748
|
-
|
|
46749
|
-
return target.apply(thisArg, argumentsList);
|
|
46750
|
-
} catch (e2) {
|
|
46751
|
-
}
|
|
46742
|
+
return target.apply(thisArg, argumentsList);
|
|
46752
46743
|
}
|
|
46753
46744
|
)
|
|
46754
46745
|
}
|
|
@@ -48754,31 +48745,32 @@ var n;
|
|
|
48754
48745
|
}(n || (n = {}));
|
|
48755
48746
|
return record; }
|
|
48756
48747
|
|
|
48757
|
-
|
|
48758
|
-
|
|
48748
|
+
var SessionRecorderBuffer = /** @class */ (function () {
|
|
48749
|
+
function SessionRecorderBuffer(interval, maxCount) {
|
|
48750
|
+
if (maxCount === void 0) { maxCount = Infinity; }
|
|
48759
48751
|
this.data = [];
|
|
48760
48752
|
this.sequenceNumber = 0;
|
|
48761
48753
|
this.interval = interval;
|
|
48762
48754
|
this.maxCount = maxCount;
|
|
48763
48755
|
this.doubledMaxCount = maxCount * 2;
|
|
48764
48756
|
}
|
|
48765
|
-
isEmpty() {
|
|
48757
|
+
SessionRecorderBuffer.prototype.isEmpty = function () {
|
|
48766
48758
|
return this.data.length === 0;
|
|
48767
|
-
}
|
|
48768
|
-
count() {
|
|
48759
|
+
};
|
|
48760
|
+
SessionRecorderBuffer.prototype.count = function () {
|
|
48769
48761
|
return this.data.length;
|
|
48770
|
-
}
|
|
48771
|
-
clear() {
|
|
48762
|
+
};
|
|
48763
|
+
SessionRecorderBuffer.prototype.clear = function () {
|
|
48772
48764
|
this.data.length = 0;
|
|
48773
|
-
}
|
|
48774
|
-
clearSequence() {
|
|
48765
|
+
};
|
|
48766
|
+
SessionRecorderBuffer.prototype.clearSequence = function () {
|
|
48775
48767
|
this.sequenceNumber = 0;
|
|
48776
|
-
}
|
|
48777
|
-
push(event) {
|
|
48768
|
+
};
|
|
48769
|
+
SessionRecorderBuffer.prototype.push = function (event) {
|
|
48778
48770
|
this.data.push(event);
|
|
48779
48771
|
this.checkRateLimit();
|
|
48780
|
-
}
|
|
48781
|
-
pack(envelope, _) {
|
|
48772
|
+
};
|
|
48773
|
+
SessionRecorderBuffer.prototype.pack = function (envelope, _) {
|
|
48782
48774
|
var eventsToSend = this.data.splice(0, this.maxCount);
|
|
48783
48775
|
envelope.recordingPayload = eventsToSend;
|
|
48784
48776
|
envelope.sequence = this.sequenceNumber;
|
|
@@ -48786,8 +48778,8 @@ class SessionRecorderBuffer {
|
|
|
48786
48778
|
if (eventsToSend.length) {
|
|
48787
48779
|
envelope.browserTime = eventsToSend[0].timestamp;
|
|
48788
48780
|
}
|
|
48789
|
-
envelope.recordingPayloadMetadata = _.map(eventsToSend, event
|
|
48790
|
-
|
|
48781
|
+
envelope.recordingPayloadMetadata = _.map(eventsToSend, function (event) {
|
|
48782
|
+
var metadata = _.pick(event, 'type', 'timestamp');
|
|
48791
48783
|
if (event.data) {
|
|
48792
48784
|
metadata.data = _.pick(event.data, 'source', 'type', 'x', 'y', 'id', 'height', 'width', 'href');
|
|
48793
48785
|
}
|
|
@@ -48795,17 +48787,18 @@ class SessionRecorderBuffer {
|
|
|
48795
48787
|
});
|
|
48796
48788
|
this.sequenceNumber += eventsToSend.length;
|
|
48797
48789
|
return envelope;
|
|
48798
|
-
}
|
|
48799
|
-
checkRateLimit() {
|
|
48800
|
-
|
|
48790
|
+
};
|
|
48791
|
+
SessionRecorderBuffer.prototype.checkRateLimit = function () {
|
|
48792
|
+
var length = this.data.length;
|
|
48801
48793
|
if (length >= this.doubledMaxCount && length % this.maxCount === 0) {
|
|
48802
|
-
|
|
48794
|
+
var elapsed = this.data[length - 1].timestamp - this.data[length - this.doubledMaxCount].timestamp;
|
|
48803
48795
|
if (elapsed <= this.interval && this.onRateLimit) {
|
|
48804
48796
|
this.onRateLimit();
|
|
48805
48797
|
}
|
|
48806
48798
|
}
|
|
48807
|
-
}
|
|
48808
|
-
|
|
48799
|
+
};
|
|
48800
|
+
return SessionRecorderBuffer;
|
|
48801
|
+
}());
|
|
48809
48802
|
|
|
48810
48803
|
function __rest(s, e) {
|
|
48811
48804
|
var t = {};
|
|
@@ -48829,24 +48822,52 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
48829
48822
|
});
|
|
48830
48823
|
}
|
|
48831
48824
|
|
|
48825
|
+
function __generator(thisArg, body) {
|
|
48826
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
48827
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
48828
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
48829
|
+
function step(op) {
|
|
48830
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
48831
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
48832
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
48833
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
48834
|
+
switch (op[0]) {
|
|
48835
|
+
case 0: case 1: t = op; break;
|
|
48836
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
48837
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
48838
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
48839
|
+
default:
|
|
48840
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
48841
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
48842
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
48843
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
48844
|
+
if (t[2]) _.ops.pop();
|
|
48845
|
+
_.trys.pop(); continue;
|
|
48846
|
+
}
|
|
48847
|
+
op = body.call(thisArg, _);
|
|
48848
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
48849
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
48850
|
+
}
|
|
48851
|
+
}
|
|
48852
|
+
|
|
48832
48853
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
48833
48854
|
var e = new Error(message);
|
|
48834
48855
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
48835
48856
|
};
|
|
48836
48857
|
|
|
48837
|
-
|
|
48838
|
-
|
|
48839
|
-
|
|
48840
|
-
|
|
48841
|
-
|
|
48858
|
+
var RECORDING_CONFIG_WORKERURL$1 = 'recording.workerUrl';
|
|
48859
|
+
var MAX_SIZE = 2000000;
|
|
48860
|
+
var RESOURCE_CACHING$1 = 'resourceCaching';
|
|
48861
|
+
var Transport = /** @class */ (function () {
|
|
48862
|
+
function Transport(WorkerClass, pendo, api) {
|
|
48842
48863
|
this.WorkerClass = WorkerClass;
|
|
48843
48864
|
this.pendo = pendo;
|
|
48844
48865
|
this.api = api;
|
|
48845
48866
|
this.maxSize = MAX_SIZE;
|
|
48846
|
-
this.lockID =
|
|
48867
|
+
this.lockID = "worker-lock-".concat(this.pendo.randomString(16));
|
|
48847
48868
|
this.isResourceCachingEnabled = this.api.ConfigReader.get(RESOURCE_CACHING$1);
|
|
48848
48869
|
}
|
|
48849
|
-
start(config) {
|
|
48870
|
+
Transport.prototype.start = function (config) {
|
|
48850
48871
|
if (config.disableWorker)
|
|
48851
48872
|
return;
|
|
48852
48873
|
if (!this.worker) {
|
|
@@ -48856,7 +48877,7 @@ class Transport {
|
|
|
48856
48877
|
this.worker = config.workerOverride;
|
|
48857
48878
|
}
|
|
48858
48879
|
else {
|
|
48859
|
-
|
|
48880
|
+
var workerUrl = this.api.ConfigReader.get(RECORDING_CONFIG_WORKERURL$1);
|
|
48860
48881
|
this.usesSelfHostedWorker = workerUrl != null;
|
|
48861
48882
|
this.worker = workerUrl ? new Worker(workerUrl) : new this.WorkerClass();
|
|
48862
48883
|
}
|
|
@@ -48870,34 +48891,35 @@ class Transport {
|
|
|
48870
48891
|
this.worker = null;
|
|
48871
48892
|
}
|
|
48872
48893
|
}
|
|
48873
|
-
}
|
|
48874
|
-
stop() {
|
|
48894
|
+
};
|
|
48895
|
+
Transport.prototype.stop = function () {
|
|
48875
48896
|
if (this.worker) {
|
|
48876
48897
|
this.worker.terminate();
|
|
48877
48898
|
delete this.worker;
|
|
48878
48899
|
}
|
|
48879
|
-
}
|
|
48880
|
-
send(envelope, isUnload, failureCount
|
|
48881
|
-
|
|
48882
|
-
|
|
48900
|
+
};
|
|
48901
|
+
Transport.prototype.send = function (envelope, isUnload, failureCount) {
|
|
48902
|
+
if (failureCount === void 0) { failureCount = 0; }
|
|
48903
|
+
var url = envelope.url;
|
|
48904
|
+
var payload = envelope.payload;
|
|
48883
48905
|
if (failureCount > 0) {
|
|
48884
|
-
url =
|
|
48906
|
+
url = "".concat(url, "&rt=").concat(failureCount);
|
|
48885
48907
|
}
|
|
48886
48908
|
if (this.worker && !isUnload && payload) {
|
|
48887
|
-
|
|
48888
|
-
|
|
48889
|
-
|
|
48890
|
-
|
|
48909
|
+
var deferred_1 = {};
|
|
48910
|
+
deferred_1.promise = new Promise$2(function (resolve, reject) {
|
|
48911
|
+
deferred_1.resolve = resolve;
|
|
48912
|
+
deferred_1.reject = reject;
|
|
48891
48913
|
});
|
|
48892
|
-
this.workerResponse =
|
|
48893
|
-
this.worker.postMessage({ url, payload, shouldCacheResources: this.isResourceCachingEnabled });
|
|
48894
|
-
return
|
|
48914
|
+
this.workerResponse = deferred_1;
|
|
48915
|
+
this.worker.postMessage({ url: url, payload: payload, shouldCacheResources: this.isResourceCachingEnabled });
|
|
48916
|
+
return deferred_1.promise;
|
|
48895
48917
|
}
|
|
48896
48918
|
else {
|
|
48897
48919
|
if (!envelope.body) {
|
|
48898
|
-
|
|
48920
|
+
var strPayload = JSON.stringify(payload);
|
|
48899
48921
|
if (strPayload.length > this.maxSize) {
|
|
48900
|
-
|
|
48922
|
+
var error = new Error('maximum recording payload size exceeded');
|
|
48901
48923
|
error.reason = 'HEAVY_EVENT';
|
|
48902
48924
|
error.context = {
|
|
48903
48925
|
size: strPayload.length,
|
|
@@ -48908,14 +48930,14 @@ class Transport {
|
|
|
48908
48930
|
envelope.body = this.pendo.compress(strPayload, 'binary');
|
|
48909
48931
|
delete envelope.payload;
|
|
48910
48932
|
}
|
|
48911
|
-
url =
|
|
48933
|
+
url = "".concat(url, "&ct=").concat(new Date().getTime());
|
|
48912
48934
|
return this.post(url, {
|
|
48913
48935
|
keepalive: isUnload,
|
|
48914
48936
|
body: envelope.body
|
|
48915
48937
|
});
|
|
48916
48938
|
}
|
|
48917
|
-
}
|
|
48918
|
-
post(url, options) {
|
|
48939
|
+
};
|
|
48940
|
+
Transport.prototype.post = function (url, options) {
|
|
48919
48941
|
options.method = 'POST';
|
|
48920
48942
|
if (options.keepalive && this.api.transmit.fetchKeepalive.supported()) {
|
|
48921
48943
|
return this.api.transmit.fetchKeepalive(url, options);
|
|
@@ -48927,46 +48949,57 @@ class Transport {
|
|
|
48927
48949
|
else {
|
|
48928
48950
|
return this.pendo.ajax.post(url, options.body);
|
|
48929
48951
|
}
|
|
48930
|
-
}
|
|
48931
|
-
_onMessage(messageEvent) {
|
|
48932
|
-
return __awaiter(this, void 0, void 0, function
|
|
48933
|
-
|
|
48934
|
-
|
|
48935
|
-
|
|
48936
|
-
|
|
48937
|
-
|
|
48938
|
-
|
|
48939
|
-
|
|
48940
|
-
|
|
48941
|
-
|
|
48942
|
-
|
|
48943
|
-
|
|
48944
|
-
|
|
48945
|
-
|
|
48946
|
-
|
|
48947
|
-
|
|
48948
|
-
|
|
48949
|
-
|
|
48950
|
-
|
|
48951
|
-
|
|
48952
|
+
};
|
|
48953
|
+
Transport.prototype._onMessage = function (messageEvent) {
|
|
48954
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
48955
|
+
return __generator(this, function (_a) {
|
|
48956
|
+
switch (_a.label) {
|
|
48957
|
+
case 0:
|
|
48958
|
+
if (!(messageEvent.data && messageEvent.data.ready)) return [3 /*break*/, 2];
|
|
48959
|
+
// When the lock is released, we can assume the worker was terminated or closed
|
|
48960
|
+
return [4 /*yield*/, navigator.locks.request(this.lockID, function () { })];
|
|
48961
|
+
case 1:
|
|
48962
|
+
// When the lock is released, we can assume the worker was terminated or closed
|
|
48963
|
+
_a.sent();
|
|
48964
|
+
this.onWorkerMessage({ type: 'workerDied' });
|
|
48965
|
+
_a.label = 2;
|
|
48966
|
+
case 2:
|
|
48967
|
+
// handle non-POST request responses from worker
|
|
48968
|
+
if (messageEvent.data && messageEvent.data.type) {
|
|
48969
|
+
this.onWorkerMessage(messageEvent.data);
|
|
48970
|
+
return [2 /*return*/];
|
|
48971
|
+
}
|
|
48972
|
+
// handle POST request response from worker
|
|
48973
|
+
if (messageEvent.data && messageEvent.data.error) {
|
|
48974
|
+
if ((messageEvent.data.status && messageEvent.data.status < 500) ||
|
|
48975
|
+
messageEvent.data.sequence == null) {
|
|
48976
|
+
this.api.log.critical('Failed to send recording data from web worker', { error: messageEvent.data.error });
|
|
48977
|
+
}
|
|
48978
|
+
if (this.workerResponse) {
|
|
48979
|
+
this.workerResponse.reject();
|
|
48980
|
+
this.workerResponse = null;
|
|
48981
|
+
}
|
|
48982
|
+
}
|
|
48983
|
+
if (this.workerResponse) {
|
|
48984
|
+
this.workerResponse.resolve();
|
|
48985
|
+
this.workerResponse = null;
|
|
48986
|
+
}
|
|
48987
|
+
return [2 /*return*/];
|
|
48952
48988
|
}
|
|
48953
|
-
}
|
|
48954
|
-
if (this.workerResponse) {
|
|
48955
|
-
this.workerResponse.resolve();
|
|
48956
|
-
this.workerResponse = null;
|
|
48957
|
-
}
|
|
48989
|
+
});
|
|
48958
48990
|
});
|
|
48959
|
-
}
|
|
48960
|
-
_onError() {
|
|
48991
|
+
};
|
|
48992
|
+
Transport.prototype._onError = function () {
|
|
48961
48993
|
if (this.onError) {
|
|
48962
48994
|
this.onError();
|
|
48963
48995
|
}
|
|
48964
|
-
}
|
|
48965
|
-
|
|
48996
|
+
};
|
|
48997
|
+
return Transport;
|
|
48998
|
+
}());
|
|
48966
48999
|
|
|
48967
|
-
|
|
48968
|
-
|
|
48969
|
-
|
|
49000
|
+
var ELEMENT_NODE = 1;
|
|
49001
|
+
var INPUT_MASK = '*'.repeat(10);
|
|
49002
|
+
var NUMBER_INPUT_MASK = '0'.repeat(10);
|
|
48970
49003
|
function isElementNode(node) {
|
|
48971
49004
|
if (!node)
|
|
48972
49005
|
return false;
|
|
@@ -48975,10 +49008,12 @@ function isElementNode(node) {
|
|
|
48975
49008
|
return true;
|
|
48976
49009
|
}
|
|
48977
49010
|
function getParent(elem) {
|
|
48978
|
-
|
|
49011
|
+
var isElementShadowRoot = typeof window.ShadowRoot !== 'undefined' && elem instanceof window.ShadowRoot && elem.host;
|
|
48979
49012
|
return isElementShadowRoot ? elem.host : elem.parentNode;
|
|
48980
49013
|
}
|
|
48981
|
-
function distanceToMatch(node, selector, limit
|
|
49014
|
+
function distanceToMatch(node, selector, limit, distance) {
|
|
49015
|
+
if (limit === void 0) { limit = Infinity; }
|
|
49016
|
+
if (distance === void 0) { distance = 0; }
|
|
48982
49017
|
if (distance > limit)
|
|
48983
49018
|
return -1;
|
|
48984
49019
|
if (!node)
|
|
@@ -48992,13 +49027,13 @@ function distanceToMatch(node, selector, limit = Infinity, distance = 0) {
|
|
|
48992
49027
|
return distanceToMatch(getParent(node), selector, limit, distance + 1);
|
|
48993
49028
|
}
|
|
48994
49029
|
function shouldMask(node, options) {
|
|
48995
|
-
|
|
49030
|
+
var maskAllText = options.maskAllText, maskTextSelector = options.maskTextSelector, unmaskTextSelector = options.unmaskTextSelector;
|
|
48996
49031
|
try {
|
|
48997
|
-
|
|
49032
|
+
var el = isElementNode(node) ? node : node.parentElement;
|
|
48998
49033
|
if (el === null)
|
|
48999
49034
|
return false;
|
|
49000
|
-
|
|
49001
|
-
|
|
49035
|
+
var maskDistance = -1;
|
|
49036
|
+
var unmaskDistance = -1;
|
|
49002
49037
|
if (maskAllText) {
|
|
49003
49038
|
unmaskDistance = distanceToMatch(el, unmaskTextSelector);
|
|
49004
49039
|
if (unmaskDistance < 0) {
|
|
@@ -49031,8 +49066,8 @@ function isNumberInput(element) {
|
|
|
49031
49066
|
}
|
|
49032
49067
|
function shouldMaskInput(element, maskInputOptions) {
|
|
49033
49068
|
if (maskInputOptions && isElementNode(element)) {
|
|
49034
|
-
|
|
49035
|
-
|
|
49069
|
+
var tagName = (element.tagName || '').toLowerCase();
|
|
49070
|
+
var type = (element.type || '').toLowerCase();
|
|
49036
49071
|
if (maskInputOptions[tagName] || maskInputOptions[type]) {
|
|
49037
49072
|
return true;
|
|
49038
49073
|
}
|
|
@@ -50519,12 +50554,12 @@ var WorkerFactory = /*#__PURE__*/createInlineWorkerFactory(/* rollup-plugin-web-
|
|
|
50519
50554
|
}
|
|
50520
50555
|
}
|
|
50521
50556
|
|
|
50522
|
-
|
|
50557
|
+
var ONE_HUNDRED_MB_IN_BYTES = 100 * 1024 * 1024;
|
|
50523
50558
|
function matchHostedResources(recordingEvent, stringifiedRecordingPayload) {
|
|
50524
|
-
|
|
50525
|
-
|
|
50559
|
+
var fontURLRegex = /https:\/\/[^"\\\s]+?\.(woff2?|ttf|otf|eot)(\?[^"\\\s]*)?\b/g;
|
|
50560
|
+
var matches = stringifiedRecordingPayload.match(fontURLRegex);
|
|
50526
50561
|
// de-duplicate matches
|
|
50527
|
-
|
|
50562
|
+
var hostedResources = matches ? Array.from(new Set(matches)) : [];
|
|
50528
50563
|
return {
|
|
50529
50564
|
type: 'recording',
|
|
50530
50565
|
visitorId: recordingEvent.visitorId,
|
|
@@ -50539,75 +50574,75 @@ var WorkerFactory = /*#__PURE__*/createInlineWorkerFactory(/* rollup-plugin-web-
|
|
|
50539
50574
|
recordingPayloadMetadata: [],
|
|
50540
50575
|
sequence: 0,
|
|
50541
50576
|
recordingPayloadCount: 0,
|
|
50542
|
-
hostedResources
|
|
50577
|
+
hostedResources: hostedResources
|
|
50543
50578
|
};
|
|
50544
50579
|
}
|
|
50545
50580
|
// keep in mind changes here may need addressing in the extension worker proxy as well
|
|
50546
50581
|
self.onmessage = function (e) {
|
|
50547
50582
|
try {
|
|
50548
50583
|
if (e.data.type === 'init' && e.data.lockID) {
|
|
50549
|
-
navigator.locks.request(e.data.lockID, ()
|
|
50584
|
+
navigator.locks.request(e.data.lockID, function () {
|
|
50550
50585
|
postMessage({ ready: true });
|
|
50551
50586
|
// This unresolved promise keeps the lock held with the worker until the worker is
|
|
50552
50587
|
// terminated at which point the lock is released.
|
|
50553
|
-
return new Promise$2(()
|
|
50588
|
+
return new Promise$2(function () { });
|
|
50554
50589
|
});
|
|
50555
50590
|
return;
|
|
50556
50591
|
}
|
|
50557
50592
|
if (e.data.url && e.data.payload) {
|
|
50558
|
-
|
|
50593
|
+
var _a = e.data, url = _a.url, payload = _a.payload, shouldCacheResources = _a.shouldCacheResources;
|
|
50559
50594
|
if (Object.keys(payload).length === 0) {
|
|
50560
50595
|
postMessage({
|
|
50561
50596
|
type: 'emptyPayload'
|
|
50562
50597
|
});
|
|
50563
50598
|
}
|
|
50564
|
-
|
|
50565
|
-
|
|
50599
|
+
var sequence_1 = payload.sequence;
|
|
50600
|
+
var stringifiedRecordingPayload = JSON.stringify(payload.recordingPayload);
|
|
50566
50601
|
// calculate and post back the recording payload size before the payload is compressed
|
|
50567
|
-
|
|
50568
|
-
|
|
50602
|
+
var recordingPayloadSize = new TextEncoder().encode(stringifiedRecordingPayload).length;
|
|
50603
|
+
var exceedsPayloadSizeLimit = recordingPayloadSize >= ONE_HUNDRED_MB_IN_BYTES;
|
|
50569
50604
|
postMessage({
|
|
50570
50605
|
type: 'recordingPayloadSize',
|
|
50571
|
-
recordingPayloadSize,
|
|
50572
|
-
exceedsPayloadSizeLimit
|
|
50606
|
+
recordingPayloadSize: recordingPayloadSize,
|
|
50607
|
+
exceedsPayloadSizeLimit: exceedsPayloadSizeLimit
|
|
50573
50608
|
});
|
|
50574
50609
|
// don't attempt to send the payload if it exceeds the allowed limit
|
|
50575
50610
|
if (exceedsPayloadSizeLimit)
|
|
50576
50611
|
return;
|
|
50577
50612
|
if (shouldCacheResources) {
|
|
50578
|
-
|
|
50613
|
+
var hostedResourcesEvent = matchHostedResources(payload, stringifiedRecordingPayload);
|
|
50579
50614
|
if (hostedResourcesEvent.hostedResources.length) {
|
|
50580
50615
|
postMessage({
|
|
50581
50616
|
type: 'hostedResources',
|
|
50582
|
-
hostedResourcesEvent
|
|
50617
|
+
hostedResourcesEvent: hostedResourcesEvent
|
|
50583
50618
|
});
|
|
50584
50619
|
}
|
|
50585
50620
|
}
|
|
50586
50621
|
payload.recordingSize = recordingPayloadSize;
|
|
50587
|
-
|
|
50622
|
+
var body = compress(payload, 'binary');
|
|
50588
50623
|
// we want to calculate ct (current time) as close as we can to the actual POST request
|
|
50589
50624
|
// so that it's as accurate as possible
|
|
50590
|
-
url =
|
|
50625
|
+
url = "".concat(url, "&ct=").concat(new Date().getTime());
|
|
50591
50626
|
fetch(url, {
|
|
50592
50627
|
method: 'POST',
|
|
50593
|
-
body
|
|
50628
|
+
body: body
|
|
50594
50629
|
}).then(function (response) {
|
|
50595
50630
|
if (response.status < 200 || response.status >= 300) {
|
|
50596
50631
|
postMessage({
|
|
50597
|
-
error: new Error(
|
|
50632
|
+
error: new Error("received status code ".concat(response.status, ": ").concat(response.statusText)),
|
|
50598
50633
|
status: response.status,
|
|
50599
|
-
sequence
|
|
50634
|
+
sequence: sequence_1
|
|
50600
50635
|
});
|
|
50601
50636
|
}
|
|
50602
50637
|
else {
|
|
50603
50638
|
postMessage({
|
|
50604
|
-
sequence
|
|
50639
|
+
sequence: sequence_1
|
|
50605
50640
|
});
|
|
50606
50641
|
}
|
|
50607
|
-
})
|
|
50642
|
+
})["catch"](function (e) {
|
|
50608
50643
|
postMessage({
|
|
50609
50644
|
error: e,
|
|
50610
|
-
sequence
|
|
50645
|
+
sequence: sequence_1
|
|
50611
50646
|
});
|
|
50612
50647
|
});
|
|
50613
50648
|
}
|
|
@@ -50642,12 +50677,12 @@ function createReplayPlugin() {
|
|
|
50642
50677
|
* limit of number of keys in an object
|
|
50643
50678
|
* if an object contains more keys than this limit, we would call its toString function directly
|
|
50644
50679
|
*/
|
|
50645
|
-
|
|
50680
|
+
var NUM_OF_KEYS_LIMIT = 50;
|
|
50646
50681
|
/**
|
|
50647
50682
|
* limit number of depth in an object
|
|
50648
50683
|
* if an object is too deep, toString process may cause browser OOM
|
|
50649
50684
|
*/
|
|
50650
|
-
|
|
50685
|
+
var DEPTH_OF_LIMIT = 4;
|
|
50651
50686
|
/**
|
|
50652
50687
|
* serialize an HTML element by creating a shallow clone of it with text content
|
|
50653
50688
|
* and return the resulting outerHTML string (without the subtree)
|
|
@@ -50658,8 +50693,8 @@ function serializeHTML(node) {
|
|
|
50658
50693
|
if (!node || node.nodeType !== node.ELEMENT_NODE) {
|
|
50659
50694
|
return '';
|
|
50660
50695
|
}
|
|
50661
|
-
|
|
50662
|
-
|
|
50696
|
+
var nodeClone = node.cloneNode(false);
|
|
50697
|
+
var textContent = node.textContent;
|
|
50663
50698
|
if (textContent) {
|
|
50664
50699
|
nodeClone.textContent = textContent;
|
|
50665
50700
|
}
|
|
@@ -50673,7 +50708,7 @@ function isObject(obj) {
|
|
|
50673
50708
|
return false;
|
|
50674
50709
|
if (typeof obj !== 'object')
|
|
50675
50710
|
return false;
|
|
50676
|
-
|
|
50711
|
+
var proto = Object.getPrototypeOf(obj);
|
|
50677
50712
|
return proto === Object.prototype || proto === null;
|
|
50678
50713
|
}
|
|
50679
50714
|
/**
|
|
@@ -50682,11 +50717,11 @@ function isObject(obj) {
|
|
|
50682
50717
|
function isObjTooDeep(obj, limit) {
|
|
50683
50718
|
if (limit === 0)
|
|
50684
50719
|
return true;
|
|
50685
|
-
|
|
50720
|
+
var keys = Object.keys(obj);
|
|
50686
50721
|
if (keys.length === 0)
|
|
50687
50722
|
return false;
|
|
50688
|
-
return keys.some(key
|
|
50689
|
-
|
|
50723
|
+
return keys.some(function (key) {
|
|
50724
|
+
var value = obj[key];
|
|
50690
50725
|
return isObject(value) && isObjTooDeep(value, limit - 1);
|
|
50691
50726
|
});
|
|
50692
50727
|
}
|
|
@@ -50702,7 +50737,7 @@ function shouldIgnore(_obj) {
|
|
|
50702
50737
|
return false;
|
|
50703
50738
|
}
|
|
50704
50739
|
// out of keys limit
|
|
50705
|
-
|
|
50740
|
+
var keys = Object.keys(_obj);
|
|
50706
50741
|
if (keys.length > NUM_OF_KEYS_LIMIT) {
|
|
50707
50742
|
return true;
|
|
50708
50743
|
}
|
|
@@ -50734,7 +50769,7 @@ function stringify(arg) {
|
|
|
50734
50769
|
return value.toString ? value.toString() : '[object Object]';
|
|
50735
50770
|
}
|
|
50736
50771
|
if (value instanceof ArrayBuffer)
|
|
50737
|
-
return
|
|
50772
|
+
return "ArrayBuffer { byteLength: ".concat(value.byteLength, " }");
|
|
50738
50773
|
if (value instanceof Error)
|
|
50739
50774
|
return value.name + ': ' + value.message;
|
|
50740
50775
|
if (value instanceof Node) {
|
|
@@ -50742,10 +50777,10 @@ function stringify(arg) {
|
|
|
50742
50777
|
}
|
|
50743
50778
|
// Handle events
|
|
50744
50779
|
if (value instanceof Event) {
|
|
50745
|
-
|
|
50780
|
+
var eventResult = {};
|
|
50746
50781
|
// eslint-disable-next-line guard-for-in
|
|
50747
|
-
for (
|
|
50748
|
-
|
|
50782
|
+
for (var eventKey in value) {
|
|
50783
|
+
var eventValue = value[eventKey];
|
|
50749
50784
|
eventResult[eventKey] = Array.isArray(eventValue) && eventValue[0] instanceof HTMLElement
|
|
50750
50785
|
? serializeHTML(eventValue[0])
|
|
50751
50786
|
: eventValue;
|
|
@@ -50756,30 +50791,31 @@ function stringify(arg) {
|
|
|
50756
50791
|
});
|
|
50757
50792
|
}
|
|
50758
50793
|
|
|
50759
|
-
|
|
50760
|
-
|
|
50794
|
+
var StackFrame = /** @class */ (function () {
|
|
50795
|
+
function StackFrame(obj) {
|
|
50761
50796
|
this.fileName = obj.fileName || '';
|
|
50762
50797
|
this.functionName = obj.functionName || '';
|
|
50763
50798
|
this.lineNumber = obj.lineNumber;
|
|
50764
50799
|
this.columnNumber = obj.columnNumber;
|
|
50765
50800
|
}
|
|
50766
|
-
toString() {
|
|
50767
|
-
|
|
50801
|
+
StackFrame.prototype.toString = function () {
|
|
50802
|
+
var _a = this, fileName = _a.fileName, functionName = _a.functionName, _b = _a.lineNumber, lineNumber = _b === void 0 ? '' : _b, _c = _a.columnNumber, columnNumber = _c === void 0 ? '' : _c;
|
|
50768
50803
|
return functionName
|
|
50769
|
-
?
|
|
50770
|
-
:
|
|
50771
|
-
}
|
|
50772
|
-
|
|
50773
|
-
|
|
50774
|
-
|
|
50775
|
-
|
|
50776
|
-
|
|
50777
|
-
|
|
50778
|
-
|
|
50804
|
+
? "".concat(functionName, " (").concat(fileName, ":").concat(lineNumber, ":").concat(columnNumber, ")")
|
|
50805
|
+
: "".concat(fileName, ":").concat(lineNumber, ":").concat(columnNumber);
|
|
50806
|
+
};
|
|
50807
|
+
return StackFrame;
|
|
50808
|
+
}());
|
|
50809
|
+
var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+:\d+/;
|
|
50810
|
+
var CHROME_EDGE_STACK_REGEXP = /^\s*at .*(\S+:\d+|\(native\))/m;
|
|
50811
|
+
var SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code])?$/;
|
|
50812
|
+
var LOCATION_REGEXP = /(.+?)(?::(\d+))?(?::(\d+))?$/;
|
|
50813
|
+
var DEFAULT_NUM_FRAMES_TO_SKIP = 5;
|
|
50814
|
+
var ErrorStackParser = {
|
|
50779
50815
|
/**
|
|
50780
50816
|
* Given an Error object, extract the most information from it.
|
|
50781
50817
|
*/
|
|
50782
|
-
parse(error, maxFramesToSave) {
|
|
50818
|
+
parse: function (error, maxFramesToSave) {
|
|
50783
50819
|
if (!(error === null || error === void 0 ? void 0 : error.stack))
|
|
50784
50820
|
return [];
|
|
50785
50821
|
// Chrome, Edge, Opera ≥15
|
|
@@ -50793,24 +50829,25 @@ const ErrorStackParser = {
|
|
|
50793
50829
|
return [];
|
|
50794
50830
|
},
|
|
50795
50831
|
// Separate line and column numbers from a string of the form: (URI:Line:Column)
|
|
50796
|
-
extractLocation(urlLike) {
|
|
50832
|
+
extractLocation: function (urlLike) {
|
|
50797
50833
|
// Fail-fast but return locations like "(native)"
|
|
50798
50834
|
if (urlLike.indexOf(':') === -1) {
|
|
50799
50835
|
return [urlLike];
|
|
50800
50836
|
}
|
|
50801
|
-
|
|
50837
|
+
var parts = LOCATION_REGEXP.exec(urlLike.replace(/[()]/g, ''));
|
|
50802
50838
|
if (!parts)
|
|
50803
|
-
throw new Error(
|
|
50839
|
+
throw new Error("Cannot parse given url: ".concat(urlLike));
|
|
50804
50840
|
return [parts[1], parts[2] || undefined, parts[3] || undefined];
|
|
50805
50841
|
},
|
|
50806
|
-
parseHelper
|
|
50807
|
-
|
|
50808
|
-
|
|
50809
|
-
|
|
50810
|
-
|
|
50811
|
-
|
|
50812
|
-
|
|
50813
|
-
|
|
50842
|
+
parseHelper: function (_a, error, maxFramesToSave, callback) {
|
|
50843
|
+
var regex = _a.regex, includeMatchedLine = _a.includeMatchedLine;
|
|
50844
|
+
var lines = error.stack.split('\n');
|
|
50845
|
+
var frames = [];
|
|
50846
|
+
var validFramesFound = 0;
|
|
50847
|
+
for (var i = 0; i < lines.length; i++) {
|
|
50848
|
+
var line = lines[i];
|
|
50849
|
+
var lineMatchesRegex = regex.test(line);
|
|
50850
|
+
var shouldSkipLine = (includeMatchedLine && !lineMatchesRegex) || // if line doesn't match regex and we want matched lines, skip it
|
|
50814
50851
|
(!includeMatchedLine && lineMatchesRegex); // if line does match regex but we don't want matched lines, skip it
|
|
50815
50852
|
if (shouldSkipLine)
|
|
50816
50853
|
continue;
|
|
@@ -50825,11 +50862,12 @@ const ErrorStackParser = {
|
|
|
50825
50862
|
}
|
|
50826
50863
|
return frames;
|
|
50827
50864
|
},
|
|
50828
|
-
parseChromiumStack(error, maxFramesToSave) {
|
|
50829
|
-
|
|
50830
|
-
|
|
50865
|
+
parseChromiumStack: function (error, maxFramesToSave) {
|
|
50866
|
+
var _this = this;
|
|
50867
|
+
return this.parseHelper({ regex: CHROME_EDGE_STACK_REGEXP, includeMatchedLine: true }, error, maxFramesToSave, function (line, frames) {
|
|
50868
|
+
var sanitizedLine;
|
|
50831
50869
|
if (line.indexOf('(eval ') > -1) {
|
|
50832
|
-
|
|
50870
|
+
var processedLine = line
|
|
50833
50871
|
.replace(/eval code/g, 'eval')
|
|
50834
50872
|
.replace(/(\(eval at [^()]*)|(\),.*$)/g, '');
|
|
50835
50873
|
sanitizedLine = processedLine.replace(/^\s+/, '').replace(/\(eval code/g, '(');
|
|
@@ -50839,7 +50877,7 @@ const ErrorStackParser = {
|
|
|
50839
50877
|
}
|
|
50840
50878
|
// capture and preserve the parenthesized location "(/foo/my bar.js:12:87)"
|
|
50841
50879
|
// in case it has spaces in it, as the string is split on \s+ later on
|
|
50842
|
-
|
|
50880
|
+
var location;
|
|
50843
50881
|
if (sanitizedLine.indexOf('(') > -1 && sanitizedLine.indexOf('):') > -1) {
|
|
50844
50882
|
location = sanitizedLine.match(/ (\((.+):(\d+):(\d+)\)$)/);
|
|
50845
50883
|
}
|
|
@@ -50847,22 +50885,23 @@ const ErrorStackParser = {
|
|
|
50847
50885
|
sanitizedLine = location
|
|
50848
50886
|
? sanitizedLine.replace(location[0], '')
|
|
50849
50887
|
: sanitizedLine;
|
|
50850
|
-
|
|
50888
|
+
var tokens = sanitizedLine.split(/\s+/).slice(1);
|
|
50851
50889
|
// if a location was matched, pass it to extractLocation() otherwise pop the last token
|
|
50852
|
-
|
|
50853
|
-
|
|
50854
|
-
|
|
50890
|
+
var locationParts = _this.extractLocation(location ? location[1] : tokens.pop() || '');
|
|
50891
|
+
var functionName = tokens.join(' ') || undefined;
|
|
50892
|
+
var fileName = (locationParts[0] === 'eval' || locationParts[0] === '<anonymous>') ? undefined : locationParts[0];
|
|
50855
50893
|
frames.push(new StackFrame({
|
|
50856
|
-
functionName,
|
|
50857
|
-
fileName,
|
|
50894
|
+
functionName: functionName,
|
|
50895
|
+
fileName: fileName,
|
|
50858
50896
|
lineNumber: locationParts[1],
|
|
50859
50897
|
columnNumber: locationParts[2]
|
|
50860
50898
|
}));
|
|
50861
50899
|
});
|
|
50862
50900
|
},
|
|
50863
|
-
parseFirefoxSafariStack(error, maxFramesToSave) {
|
|
50864
|
-
|
|
50865
|
-
|
|
50901
|
+
parseFirefoxSafariStack: function (error, maxFramesToSave) {
|
|
50902
|
+
var _this = this;
|
|
50903
|
+
return this.parseHelper({ regex: SAFARI_NATIVE_CODE_REGEXP, includeMatchedLine: false }, error, maxFramesToSave, function (line, frames) {
|
|
50904
|
+
var processedLine = line;
|
|
50866
50905
|
// Throw away eval information until we implement stacktrace.js/stackframe#8
|
|
50867
50906
|
if (processedLine.indexOf(' > eval') > -1) {
|
|
50868
50907
|
processedLine = processedLine.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ':$1');
|
|
@@ -50874,12 +50913,12 @@ const ErrorStackParser = {
|
|
|
50874
50913
|
}));
|
|
50875
50914
|
return;
|
|
50876
50915
|
}
|
|
50877
|
-
|
|
50878
|
-
|
|
50879
|
-
|
|
50880
|
-
|
|
50916
|
+
var functionNameRegex = /((.*".+"[^@]*)?[^@]*)(?:@)/;
|
|
50917
|
+
var matches = processedLine.match(functionNameRegex);
|
|
50918
|
+
var functionName = matches && matches[1] ? matches[1] : undefined;
|
|
50919
|
+
var locationParts = _this.extractLocation(processedLine.replace(functionNameRegex, ''));
|
|
50881
50920
|
frames.push(new StackFrame({
|
|
50882
|
-
functionName,
|
|
50921
|
+
functionName: functionName,
|
|
50883
50922
|
fileName: locationParts[0],
|
|
50884
50923
|
lineNumber: locationParts[1],
|
|
50885
50924
|
columnNumber: locationParts[2]
|
|
@@ -51975,18 +52014,20 @@ function NetworkCapture() {
|
|
|
51975
52014
|
}
|
|
51976
52015
|
}
|
|
51977
52016
|
|
|
51978
|
-
|
|
51979
|
-
|
|
51980
|
-
|
|
51981
|
-
|
|
51982
|
-
|
|
51983
|
-
|
|
51984
|
-
|
|
51985
|
-
|
|
51986
|
-
|
|
51987
|
-
|
|
51988
|
-
|
|
51989
|
-
|
|
52017
|
+
var PREDICT_STEP_REGEX = /\$\$predict\$\$/;
|
|
52018
|
+
var DRAG_THRESHOLD = 5;
|
|
52019
|
+
var STYLE_ID = 'pendo-predict-plugin-styles';
|
|
52020
|
+
var PREDICT_BASE_URL = 'https://predict.pendo.io';
|
|
52021
|
+
var GUIDE_BUTTON_IDENTIFIER = 'button:contains("token")';
|
|
52022
|
+
var pluginVersion = '1.0.1';
|
|
52023
|
+
var $ = function (id) { return document.getElementById(id); };
|
|
52024
|
+
var createElement = function (tag, attrs, parent) {
|
|
52025
|
+
if (attrs === void 0) { attrs = {}; }
|
|
52026
|
+
if (parent === void 0) { parent = null; }
|
|
52027
|
+
var el = document.createElement(tag);
|
|
52028
|
+
var entries = Object.entries(attrs);
|
|
52029
|
+
for (var i = 0; i < entries.length; i++) {
|
|
52030
|
+
var _a = entries[i], key = _a[0], value = _a[1];
|
|
51990
52031
|
if (key === 'className')
|
|
51991
52032
|
el.className = value;
|
|
51992
52033
|
else if (key === 'innerHTML')
|
|
@@ -51998,69 +52039,28 @@ const createElement = (tag, attrs = {}, parent = null) => {
|
|
|
51998
52039
|
parent.appendChild(el);
|
|
51999
52040
|
return el;
|
|
52000
52041
|
};
|
|
52001
|
-
|
|
52002
|
-
|
|
52042
|
+
var injectStyles = function (pendoContainerId, log) {
|
|
52043
|
+
if (log === void 0) { log = function () { }; }
|
|
52044
|
+
var styleId = "".concat(STYLE_ID, "-").concat(pendoContainerId);
|
|
52003
52045
|
if ($(styleId)) {
|
|
52004
|
-
log(
|
|
52046
|
+
log("[predict] style already exists, skipping: ".concat(styleId));
|
|
52005
52047
|
return;
|
|
52006
52048
|
}
|
|
52007
|
-
log(
|
|
52049
|
+
log("[predict] injecting styles: ".concat(styleId));
|
|
52008
52050
|
createElement('style', {
|
|
52009
52051
|
id: styleId,
|
|
52010
|
-
textContent:
|
|
52011
|
-
#${pendoContainerId} {
|
|
52012
|
-
display: none !important;
|
|
52013
|
-
}
|
|
52014
|
-
.frame-explanation {
|
|
52015
|
-
aspect-ratio: 16/9; overflow: hidden; min-height: 300px;
|
|
52016
|
-
width: 100vw; height: 100vh; background: transparent;
|
|
52017
|
-
position: fixed; bottom: 0; right: 0; z-index: 999999; border: none;
|
|
52018
|
-
visibility: hidden; opacity: 0; pointer-events: none;
|
|
52019
|
-
transition: opacity 0.1s ease-out, visibility 0s linear 0.1s;
|
|
52020
|
-
display: none;
|
|
52021
|
-
}
|
|
52022
|
-
.frame-explanation.is-visible {
|
|
52023
|
-
visibility: visible; opacity: 1; pointer-events: auto;
|
|
52024
|
-
transition: opacity 0.1s ease-out, visibility 0s linear 0s;
|
|
52025
|
-
}
|
|
52026
|
-
.frame-explanation.is-exists {
|
|
52027
|
-
display: block !important;
|
|
52028
|
-
}
|
|
52029
|
-
.floating-modal-container {
|
|
52030
|
-
position: fixed; top: 20px; right: 20px; z-index: 500000;
|
|
52031
|
-
visibility: hidden; opacity: 0; pointer-events: none;
|
|
52032
|
-
transition: opacity 0.1s ease-out, visibility 0s linear 0.1s;
|
|
52033
|
-
border-radius: 8px; box-shadow: 0px 4px 12px 0px rgba(0,0,0,0.15);
|
|
52034
|
-
overflow: hidden; width: 384px; height: 176px;
|
|
52035
|
-
}
|
|
52036
|
-
.floating-modal-container.is-visible {
|
|
52037
|
-
visibility: visible; opacity: 1; pointer-events: auto;
|
|
52038
|
-
transition: opacity 0.1s ease-out, visibility 0s linear 0s;
|
|
52039
|
-
}
|
|
52040
|
-
.floating-modal-container.is-dragging { will-change: left, top; }
|
|
52041
|
-
.floating-modal-drag-handle {
|
|
52042
|
-
position: absolute; left: 50%; transform: translateX(-50%);
|
|
52043
|
-
top: 5px; width: calc(100% - 46px); min-width: 166px; height: 17px;
|
|
52044
|
-
z-index: 9999; transition: left 0.2s ease, right 0.2s ease;
|
|
52045
|
-
display: flex; justify-content: center; align-items: center;
|
|
52046
|
-
}
|
|
52047
|
-
.floating-modal-drag-handle svg g { fill: #A0A0A0; }
|
|
52048
|
-
.floating-modal-drag-handle:hover { cursor: grab; }
|
|
52049
|
-
.floating-modal-drag-handle:hover svg g { fill: #1f2937; }
|
|
52050
|
-
.floating-modal-drag-handle.is-dragging { cursor: grabbing; }
|
|
52051
|
-
.floating-modal-drag-handle.is-collapsed { top: 0px; }
|
|
52052
|
-
.frame-floating-modal { width: 100%; height: 100%; background: white; border: none; display: block; }
|
|
52053
|
-
`
|
|
52052
|
+
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: 999999; 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 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 ")
|
|
52054
52053
|
}, document.head);
|
|
52055
52054
|
};
|
|
52056
|
-
|
|
52055
|
+
var getRecordIdFromUrl = function (recordRegex, log) {
|
|
52057
52056
|
var _a;
|
|
52058
|
-
|
|
52059
|
-
|
|
52060
|
-
|
|
52057
|
+
if (log === void 0) { log = function () { }; }
|
|
52058
|
+
var match = window.location.href.match(recordRegex);
|
|
52059
|
+
var recordId = (_a = match === null || match === void 0 ? void 0 : match[1]) !== null && _a !== void 0 ? _a : null;
|
|
52060
|
+
log("[predict] recordId found: ".concat(recordId));
|
|
52061
52061
|
return recordId;
|
|
52062
52062
|
};
|
|
52063
|
-
|
|
52063
|
+
var safeStringify = function (value, fallback) {
|
|
52064
52064
|
try {
|
|
52065
52065
|
return JSON.stringify(value);
|
|
52066
52066
|
}
|
|
@@ -52068,21 +52068,22 @@ const safeStringify = (value, fallback) => {
|
|
|
52068
52068
|
return fallback !== null && fallback !== void 0 ? fallback : '';
|
|
52069
52069
|
}
|
|
52070
52070
|
};
|
|
52071
|
-
|
|
52071
|
+
var safeParse = function (value, fallback, log) {
|
|
52072
|
+
if (log === void 0) { log = function () { }; }
|
|
52072
52073
|
try {
|
|
52073
52074
|
return JSON.parse(value);
|
|
52074
52075
|
}
|
|
52075
52076
|
catch (error) {
|
|
52076
|
-
log(
|
|
52077
|
+
log("[predict] JSON parse error: ".concat(error));
|
|
52077
52078
|
return fallback;
|
|
52078
52079
|
}
|
|
52079
52080
|
};
|
|
52080
|
-
|
|
52081
|
-
|
|
52082
|
-
|
|
52081
|
+
var buildQueryParams = function (params) {
|
|
52082
|
+
var urlParams = new URLSearchParams();
|
|
52083
|
+
var entries = Object.entries(params);
|
|
52083
52084
|
urlParams.set('pluginVersion', pluginVersion);
|
|
52084
|
-
for (
|
|
52085
|
-
|
|
52085
|
+
for (var i = 0; i < entries.length; i++) {
|
|
52086
|
+
var _a = entries[i], key = _a[0], value = _a[1];
|
|
52086
52087
|
if (value != null) {
|
|
52087
52088
|
urlParams.set(key, typeof value === 'object' ? safeStringify(value) : String(value));
|
|
52088
52089
|
}
|
|
@@ -52090,17 +52091,17 @@ const buildQueryParams = (params) => {
|
|
|
52090
52091
|
return urlParams.toString();
|
|
52091
52092
|
};
|
|
52092
52093
|
// ----- Drag & Drop -----
|
|
52093
|
-
|
|
52094
|
-
|
|
52095
|
-
|
|
52096
|
-
|
|
52097
|
-
|
|
52098
|
-
|
|
52099
|
-
|
|
52100
|
-
|
|
52101
|
-
|
|
52102
|
-
|
|
52103
|
-
|
|
52094
|
+
var setupDragAndDrop = function (handle, container) {
|
|
52095
|
+
var isDragging = false;
|
|
52096
|
+
var hasMoved = false;
|
|
52097
|
+
var isCollapsed = false;
|
|
52098
|
+
var startX = 0;
|
|
52099
|
+
var startY = 0;
|
|
52100
|
+
var initialLeft = 0;
|
|
52101
|
+
var initialTop = 0;
|
|
52102
|
+
var rafId = null;
|
|
52103
|
+
var iframe = container.querySelector('iframe');
|
|
52104
|
+
var onMouseDown = function (e) {
|
|
52104
52105
|
if (e.button !== 0)
|
|
52105
52106
|
return;
|
|
52106
52107
|
e.preventDefault();
|
|
@@ -52110,35 +52111,35 @@ const setupDragAndDrop = (handle, container) => {
|
|
|
52110
52111
|
container.classList.add('is-dragging');
|
|
52111
52112
|
if (iframe)
|
|
52112
52113
|
iframe.style.pointerEvents = 'none';
|
|
52113
|
-
|
|
52114
|
+
var rect = container.getBoundingClientRect();
|
|
52114
52115
|
initialLeft = rect.left;
|
|
52115
52116
|
initialTop = rect.top;
|
|
52116
|
-
container.style.left =
|
|
52117
|
+
container.style.left = "".concat(initialLeft, "px");
|
|
52117
52118
|
container.style.right = 'auto';
|
|
52118
52119
|
startX = e.clientX;
|
|
52119
52120
|
startY = e.clientY;
|
|
52120
52121
|
document.addEventListener('mousemove', onMouseMove);
|
|
52121
52122
|
document.addEventListener('mouseup', onMouseUp);
|
|
52122
52123
|
};
|
|
52123
|
-
|
|
52124
|
+
var onMouseMove = function (e) {
|
|
52124
52125
|
if (!isDragging)
|
|
52125
52126
|
return;
|
|
52126
|
-
|
|
52127
|
-
|
|
52127
|
+
var deltaX = e.clientX - startX;
|
|
52128
|
+
var deltaY = e.clientY - startY;
|
|
52128
52129
|
if (Math.abs(deltaX) > DRAG_THRESHOLD || Math.abs(deltaY) > DRAG_THRESHOLD) {
|
|
52129
52130
|
hasMoved = true;
|
|
52130
52131
|
}
|
|
52131
52132
|
if (rafId)
|
|
52132
52133
|
cancelAnimationFrame(rafId);
|
|
52133
|
-
rafId = requestAnimationFrame(()
|
|
52134
|
-
|
|
52135
|
-
|
|
52136
|
-
|
|
52137
|
-
container.style.left =
|
|
52138
|
-
container.style.top =
|
|
52134
|
+
rafId = requestAnimationFrame(function () {
|
|
52135
|
+
var rect = container.getBoundingClientRect();
|
|
52136
|
+
var newLeft = Math.max(0, Math.min(initialLeft + deltaX, window.innerWidth - rect.width));
|
|
52137
|
+
var newTop = Math.max(0, Math.min(initialTop + deltaY, window.innerHeight - rect.height));
|
|
52138
|
+
container.style.left = "".concat(newLeft, "px");
|
|
52139
|
+
container.style.top = "".concat(newTop, "px");
|
|
52139
52140
|
});
|
|
52140
52141
|
};
|
|
52141
|
-
|
|
52142
|
+
var onMouseUp = function (e) {
|
|
52142
52143
|
var _a;
|
|
52143
52144
|
if (!isDragging)
|
|
52144
52145
|
return;
|
|
@@ -52156,12 +52157,12 @@ const setupDragAndDrop = (handle, container) => {
|
|
|
52156
52157
|
(_a = iframe === null || iframe === void 0 ? void 0 : iframe.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage({ type: 'TRIGGER_EXPAND' }, PREDICT_BASE_URL);
|
|
52157
52158
|
}
|
|
52158
52159
|
};
|
|
52159
|
-
handle.setCollapsedState = (collapsed)
|
|
52160
|
+
handle.setCollapsedState = function (collapsed) {
|
|
52160
52161
|
isCollapsed = collapsed;
|
|
52161
52162
|
handle.classList.toggle('is-collapsed', collapsed);
|
|
52162
52163
|
};
|
|
52163
52164
|
handle.addEventListener('mousedown', onMouseDown);
|
|
52164
|
-
handle.cleanup = ()
|
|
52165
|
+
handle.cleanup = function () {
|
|
52165
52166
|
handle.removeEventListener('mousedown', onMouseDown);
|
|
52166
52167
|
document.removeEventListener('mousemove', onMouseMove);
|
|
52167
52168
|
document.removeEventListener('mouseup', onMouseUp);
|
|
@@ -52171,12 +52172,13 @@ const setupDragAndDrop = (handle, container) => {
|
|
|
52171
52172
|
return handle;
|
|
52172
52173
|
};
|
|
52173
52174
|
// ----- Explanation Iframe Creation -----
|
|
52174
|
-
|
|
52175
|
-
var
|
|
52176
|
-
|
|
52177
|
-
|
|
52178
|
-
|
|
52179
|
-
|
|
52175
|
+
var createExplanationIframe = function (_a) {
|
|
52176
|
+
var _b;
|
|
52177
|
+
var analysisId = _a.analysisId, recordId = _a.recordId, configuration = _a.configuration;
|
|
52178
|
+
var frameId = "frameExplanation-".concat(analysisId);
|
|
52179
|
+
(_b = $(frameId)) === null || _b === void 0 ? void 0 : _b.remove();
|
|
52180
|
+
var base = "".concat(PREDICT_BASE_URL, "/external/analysis/").concat(analysisId, "/prediction/drilldown/").concat(recordId);
|
|
52181
|
+
var params = buildQueryParams(configuration);
|
|
52180
52182
|
createElement('iframe', {
|
|
52181
52183
|
id: frameId,
|
|
52182
52184
|
className: 'frame-explanation',
|
|
@@ -52184,28 +52186,24 @@ const createExplanationIframe = ({ analysisId, recordId, configuration }) => {
|
|
|
52184
52186
|
loading: 'lazy',
|
|
52185
52187
|
referrerPolicy: 'strict-origin-when-cross-origin',
|
|
52186
52188
|
allowFullscreen: true,
|
|
52187
|
-
src:
|
|
52189
|
+
src: "".concat(base, "?").concat(params)
|
|
52188
52190
|
}, document.body);
|
|
52189
52191
|
};
|
|
52190
52192
|
// ----- Floating Modal Creation -----
|
|
52191
|
-
|
|
52192
|
-
var
|
|
52193
|
-
|
|
52194
|
-
|
|
52195
|
-
|
|
52196
|
-
|
|
52197
|
-
|
|
52198
|
-
|
|
52193
|
+
var createFloatingModal = function (_a) {
|
|
52194
|
+
var _b;
|
|
52195
|
+
var recordId = _a.recordId, configuration = _a.configuration;
|
|
52196
|
+
var flatIds = (_b = configuration.analysisIds) === null || _b === void 0 ? void 0 : _b.flat(Infinity);
|
|
52197
|
+
for (var i = 0; i < flatIds.length; i++) {
|
|
52198
|
+
createExplanationIframe({ analysisId: flatIds[i], recordId: recordId, configuration: configuration });
|
|
52199
|
+
}
|
|
52200
|
+
var container = createElement('div', { id: 'floatingModalContainer', className: 'floating-modal-container' }, document.body);
|
|
52201
|
+
var dragHandle = createElement('div', {
|
|
52199
52202
|
className: 'floating-modal-drag-handle',
|
|
52200
|
-
innerHTML:
|
|
52201
|
-
<g fill="#EBEBEB">
|
|
52202
|
-
<circle cx="3.33" cy="6" r="1.5"/><circle cx="8" cy="6" r="1.5"/><circle cx="12.67" cy="6" r="1.5"/>
|
|
52203
|
-
<circle cx="3.33" cy="10" r="1.5"/><circle cx="8" cy="10" r="1.5"/><circle cx="12.67" cy="10" r="1.5"/>
|
|
52204
|
-
</g>
|
|
52205
|
-
</svg>`
|
|
52203
|
+
innerHTML: "<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" xmlns=\"http://www.w3.org/2000/svg\">\n <g fill=\"#EBEBEB\">\n <circle cx=\"3.33\" cy=\"6\" r=\"1.5\"/><circle cx=\"8\" cy=\"6\" r=\"1.5\"/><circle cx=\"12.67\" cy=\"6\" r=\"1.5\"/>\n <circle cx=\"3.33\" cy=\"10\" r=\"1.5\"/><circle cx=\"8\" cy=\"10\" r=\"1.5\"/><circle cx=\"12.67\" cy=\"10\" r=\"1.5\"/>\n </g>\n </svg>"
|
|
52206
52204
|
}, container);
|
|
52207
|
-
|
|
52208
|
-
|
|
52205
|
+
var baseUrl = "".concat(PREDICT_BASE_URL, "/external/analysis/prediction/summary/").concat(recordId);
|
|
52206
|
+
var params = buildQueryParams(configuration);
|
|
52209
52207
|
createElement('iframe', {
|
|
52210
52208
|
id: 'frameFloatingModal',
|
|
52211
52209
|
className: 'frame-floating-modal',
|
|
@@ -52213,133 +52211,136 @@ const createFloatingModal = ({ recordId, configuration }) => {
|
|
|
52213
52211
|
referrerPolicy: 'strict-origin-when-cross-origin',
|
|
52214
52212
|
allowFullscreen: true,
|
|
52215
52213
|
title: 'Floating Modal',
|
|
52216
|
-
src:
|
|
52214
|
+
src: "".concat(baseUrl, "?").concat(params)
|
|
52217
52215
|
}, container);
|
|
52218
52216
|
container.dragHandle = setupDragAndDrop(dragHandle, container);
|
|
52219
|
-
return ()
|
|
52217
|
+
return function () {
|
|
52220
52218
|
var _a, _b;
|
|
52221
52219
|
(_b = (_a = container.dragHandle) === null || _a === void 0 ? void 0 : _a.cleanup) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
52222
52220
|
container.remove();
|
|
52223
|
-
for (
|
|
52224
|
-
|
|
52221
|
+
for (var i = 0; i < flatIds.length; i++) {
|
|
52222
|
+
var frame = $("frameExplanation-".concat(flatIds[i]));
|
|
52225
52223
|
if (frame)
|
|
52226
52224
|
frame.remove();
|
|
52227
52225
|
}
|
|
52228
52226
|
};
|
|
52229
52227
|
};
|
|
52230
|
-
|
|
52231
|
-
|
|
52232
|
-
|
|
52228
|
+
var setupMessageListener = function (_a) {
|
|
52229
|
+
var token = _a.token, forceAccountId = _a.forceAccountId, cleanup = _a.cleanup, pendo = _a.pendo;
|
|
52230
|
+
var messageHandler = function (_a) {
|
|
52231
|
+
var _b;
|
|
52232
|
+
var origin = _a.origin, data = _a.data;
|
|
52233
52233
|
if (origin !== PREDICT_BASE_URL || !data || typeof data !== 'object')
|
|
52234
52234
|
return;
|
|
52235
|
-
|
|
52236
|
-
|
|
52237
|
-
|
|
52238
|
-
|
|
52235
|
+
var _c = data, type = _c.type, analysisId = _c.analysisId, height = _c.height, width = _c.width;
|
|
52236
|
+
var explanationFrame = $("frameExplanation-".concat(analysisId));
|
|
52237
|
+
var floatingModal = $('floatingModalContainer');
|
|
52238
|
+
var setFloatingModalSize = function () {
|
|
52239
52239
|
if (floatingModal) {
|
|
52240
|
-
floatingModal.style.height =
|
|
52241
|
-
floatingModal.style.width =
|
|
52240
|
+
floatingModal.style.height = "".concat(height, "px");
|
|
52241
|
+
floatingModal.style.width = "".concat(width, "px");
|
|
52242
52242
|
}
|
|
52243
52243
|
};
|
|
52244
|
-
|
|
52244
|
+
var setFloatingModalCollapsedState = function (collapsed) {
|
|
52245
52245
|
var _a, _b;
|
|
52246
52246
|
if (floatingModal)
|
|
52247
52247
|
(_b = (_a = floatingModal.dragHandle) === null || _a === void 0 ? void 0 : _a.setCollapsedState) === null || _b === void 0 ? void 0 : _b.call(_a, collapsed);
|
|
52248
52248
|
};
|
|
52249
|
-
|
|
52250
|
-
MODAL_INITIALIZED: ()
|
|
52249
|
+
var actions = {
|
|
52250
|
+
MODAL_INITIALIZED: function () {
|
|
52251
52251
|
var _a, _b, _c;
|
|
52252
|
-
|
|
52252
|
+
var iframe = $('frameFloatingModal');
|
|
52253
52253
|
if (iframe) {
|
|
52254
|
-
|
|
52255
|
-
|
|
52256
|
-
|
|
52254
|
+
var idToken = null;
|
|
52255
|
+
var extensionAPIKeys = null;
|
|
52256
|
+
var retrieveIDPToken = pendo.getConfigValue('retrieveIDPToken');
|
|
52257
52257
|
if (pendo._.isFunction(retrieveIDPToken)) {
|
|
52258
|
-
|
|
52258
|
+
var result = retrieveIDPToken();
|
|
52259
52259
|
if (result) {
|
|
52260
52260
|
idToken = result.idToken;
|
|
52261
52261
|
extensionAPIKeys = result.extensionAPIKeys;
|
|
52262
52262
|
}
|
|
52263
52263
|
}
|
|
52264
|
-
|
|
52265
|
-
|
|
52266
|
-
(_c = iframe.contentWindow) === null || _c === void 0 ? void 0 : _c.postMessage({ type: 'TOKEN_RECEIVED', token, idToken, extensionAPIKeys, visitorId, accountId }, PREDICT_BASE_URL);
|
|
52264
|
+
var visitorId = (_a = pendo === null || pendo === void 0 ? void 0 : pendo.getVisitorId) === null || _a === void 0 ? void 0 : _a.call(pendo);
|
|
52265
|
+
var accountId = forceAccountId !== null && forceAccountId !== void 0 ? forceAccountId : (_b = pendo === null || pendo === void 0 ? void 0 : pendo.getAccountId) === null || _b === void 0 ? void 0 : _b.call(pendo);
|
|
52266
|
+
(_c = iframe.contentWindow) === null || _c === void 0 ? void 0 : _c.postMessage({ type: 'TOKEN_RECEIVED', token: token, idToken: idToken, extensionAPIKeys: extensionAPIKeys, visitorId: visitorId, accountId: accountId }, PREDICT_BASE_URL);
|
|
52267
52267
|
}
|
|
52268
52268
|
},
|
|
52269
|
-
OPEN_EXPLANATION: ()
|
|
52269
|
+
OPEN_EXPLANATION: function () {
|
|
52270
52270
|
var _a;
|
|
52271
52271
|
explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.add('is-visible');
|
|
52272
52272
|
(_a = explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage(data, PREDICT_BASE_URL);
|
|
52273
52273
|
},
|
|
52274
|
-
CLOSE_EXPLANATION: ()
|
|
52275
|
-
AUTH_ERROR_EXPLANATION: ()
|
|
52274
|
+
CLOSE_EXPLANATION: function () { return explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.remove('is-visible'); },
|
|
52275
|
+
AUTH_ERROR_EXPLANATION: function () {
|
|
52276
52276
|
explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.remove('is-visible');
|
|
52277
|
-
|
|
52277
|
+
var iframe = $('frameFloatingModal');
|
|
52278
52278
|
// eslint-disable-next-line no-self-assign
|
|
52279
52279
|
if (iframe)
|
|
52280
52280
|
iframe.src = iframe.src;
|
|
52281
52281
|
},
|
|
52282
|
-
DATA_READY: ()
|
|
52282
|
+
DATA_READY: function () {
|
|
52283
52283
|
floatingModal === null || floatingModal === void 0 ? void 0 : floatingModal.classList.add('is-visible');
|
|
52284
52284
|
setFloatingModalSize();
|
|
52285
52285
|
// Use analysisIds from the message data if available, otherwise use all IDs
|
|
52286
|
-
|
|
52287
|
-
for (
|
|
52288
|
-
|
|
52286
|
+
var idsToShow = data.analysisIds || [];
|
|
52287
|
+
for (var i = 0; i < idsToShow.length; i++) {
|
|
52288
|
+
var frame = $("frameExplanation-".concat(idsToShow[i]));
|
|
52289
52289
|
if (frame)
|
|
52290
52290
|
frame.classList.add('is-exists');
|
|
52291
52291
|
}
|
|
52292
52292
|
},
|
|
52293
|
-
AUTH_ERROR: ()
|
|
52293
|
+
AUTH_ERROR: function () {
|
|
52294
52294
|
floatingModal === null || floatingModal === void 0 ? void 0 : floatingModal.classList.add('is-visible');
|
|
52295
52295
|
setFloatingModalSize();
|
|
52296
52296
|
},
|
|
52297
52297
|
CLOSE_FLOATING_MODAL: cleanup,
|
|
52298
|
-
EXPAND_FLOATING_MODAL: ()
|
|
52298
|
+
EXPAND_FLOATING_MODAL: function () {
|
|
52299
52299
|
setFloatingModalSize();
|
|
52300
52300
|
setFloatingModalCollapsedState(false);
|
|
52301
52301
|
},
|
|
52302
|
-
COLLAPSE_FLOATING_MODAL: ()
|
|
52302
|
+
COLLAPSE_FLOATING_MODAL: function () {
|
|
52303
52303
|
setFloatingModalSize();
|
|
52304
52304
|
setFloatingModalCollapsedState(true);
|
|
52305
52305
|
}
|
|
52306
52306
|
};
|
|
52307
52307
|
if (type && type in actions) {
|
|
52308
|
-
(
|
|
52308
|
+
(_b = actions === null || actions === void 0 ? void 0 : actions[type]) === null || _b === void 0 ? void 0 : _b.call(actions);
|
|
52309
52309
|
}
|
|
52310
52310
|
};
|
|
52311
52311
|
window.addEventListener('message', messageHandler);
|
|
52312
|
-
return ()
|
|
52312
|
+
return function () { return window.removeEventListener('message', messageHandler); };
|
|
52313
52313
|
};
|
|
52314
|
-
|
|
52315
|
-
var
|
|
52314
|
+
var predictGuidesScript = function (_a) {
|
|
52315
|
+
var _b;
|
|
52316
|
+
var step = _a.step, pendo = _a.pendo, cleanupArray = _a.cleanupArray, cleanup = _a.cleanup, log = _a.log;
|
|
52316
52317
|
log('[predict] initializing');
|
|
52317
52318
|
// Before anything else, inject styles so that the guide will be hidden
|
|
52318
|
-
|
|
52319
|
+
var pendoContainerId = step === null || step === void 0 ? void 0 : step.containerId;
|
|
52319
52320
|
injectStyles(pendoContainerId, log);
|
|
52320
52321
|
if (cleanupArray.length > 0) {
|
|
52321
52322
|
log('[predict] cleanupArray is not empty');
|
|
52322
52323
|
return;
|
|
52323
52324
|
}
|
|
52324
52325
|
// ----- Extract Configuration -----
|
|
52325
|
-
|
|
52326
|
+
var guideButton = (_b = step.guideElement.find(GUIDE_BUTTON_IDENTIFIER)) === null || _b === void 0 ? void 0 : _b[0];
|
|
52326
52327
|
if (!guideButton) {
|
|
52327
52328
|
log('[predict] no guide button found, aborting');
|
|
52328
52329
|
return;
|
|
52329
52330
|
}
|
|
52330
|
-
|
|
52331
|
+
var _c = safeParse(guideButton.textContent, {}, log), token = _c.token, configuration = __rest(_c, ["token"]);
|
|
52331
52332
|
if (!configuration || !token) {
|
|
52332
52333
|
log('[predict] no configuration found, aborting');
|
|
52333
52334
|
return;
|
|
52334
52335
|
}
|
|
52335
|
-
|
|
52336
|
-
|
|
52336
|
+
var recordRegex = new RegExp("/".concat(configuration.recordRegexName, "/([a-zA-Z0-9]+)(?:/|$)"));
|
|
52337
|
+
var recordId = getRecordIdFromUrl(recordRegex, log);
|
|
52337
52338
|
if (!recordId) {
|
|
52338
52339
|
log('[predict] no recordId found in URL, aborting');
|
|
52339
52340
|
return;
|
|
52340
52341
|
}
|
|
52341
|
-
cleanupArray.push(setupMessageListener({ token, forceAccountId: configuration === null || configuration === void 0 ? void 0 : configuration.forceAccountId, cleanup, pendo }));
|
|
52342
|
-
cleanupArray.push(createFloatingModal({ recordId, configuration }));
|
|
52342
|
+
cleanupArray.push(setupMessageListener({ token: token, forceAccountId: configuration === null || configuration === void 0 ? void 0 : configuration.forceAccountId, cleanup: cleanup, pendo: pendo }));
|
|
52343
|
+
cleanupArray.push(createFloatingModal({ recordId: recordId, configuration: configuration }));
|
|
52343
52344
|
};
|
|
52344
52345
|
|
|
52345
52346
|
const PredictGuides = () => {
|