@saasquatch/squatch-js 2.6.0-1 → 2.6.0-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/coverage/clover.xml +2 -2
- package/coverage/lcov-report/api/AnalyticsApi.ts.html +1 -1
- package/coverage/lcov-report/api/WidgetApi.ts.html +6 -6
- package/coverage/lcov-report/api/graphql.ts.html +1 -1
- package/coverage/lcov-report/utils/domready.ts.html +1 -1
- package/coverage/lcov-report/utils/io.ts.html +1 -1
- package/coverage/lcov-report/utils/validate.ts.html +9 -9
- package/coverage/lcov-report/widgets/EmbedWidget.ts.html +1 -1
- package/coverage/lcov-report/widgets/PopupWidget.ts.html +1 -1
- package/coverage/lcov-report/widgets/Widget.ts.html +1 -1
- package/coverage/lcov-report/widgets/Widgets.ts.html +65 -65
- package/dist/squatch.d.ts +0 -15
- package/dist/squatch.esm.js +13 -25
- package/dist/squatch.esm.js.map +1 -1
- package/dist/squatch.js +12 -25
- package/dist/squatch.js.map +1 -1
- package/dist/squatch.min.js +1 -1
- package/jest.config.ts +1 -3
- package/package.json +1 -1
package/dist/squatch.js
CHANGED
|
@@ -683,6 +683,7 @@ class Widget {
|
|
|
683
683
|
function delay(duration) {
|
|
684
684
|
return new Promise(function (resolve, reject) {
|
|
685
685
|
setTimeout(function () {
|
|
686
|
+
/* istanbul ignore next */
|
|
686
687
|
resolve(() => {});
|
|
687
688
|
}, duration);
|
|
688
689
|
});
|
|
@@ -1226,15 +1227,17 @@ class Widgets {
|
|
|
1226
1227
|
|
|
1227
1228
|
|
|
1228
1229
|
_renderWidget(response, config, context) {
|
|
1230
|
+
var _opts$widget;
|
|
1231
|
+
|
|
1229
1232
|
_log$4("Rendering Widget...");
|
|
1230
1233
|
|
|
1231
1234
|
if (!response) throw new Error("Unable to get a response");
|
|
1232
1235
|
var widget;
|
|
1233
1236
|
var displayOnLoad = !!config.displayOnLoad;
|
|
1234
|
-
var opts = response.jsOptions ||
|
|
1237
|
+
var opts = response.jsOptions || {};
|
|
1235
1238
|
var params = {
|
|
1236
1239
|
content: response.template,
|
|
1237
|
-
type: config.widgetType || opts.widget.defaultWidgetType,
|
|
1240
|
+
type: config.widgetType || ((_opts$widget = opts.widget) == null ? void 0 : _opts$widget.defaultWidgetType),
|
|
1238
1241
|
api: this.api,
|
|
1239
1242
|
domain: this.domain,
|
|
1240
1243
|
npmCdn: this.npmCdn,
|
|
@@ -1244,7 +1247,9 @@ class Widgets {
|
|
|
1244
1247
|
if (opts.widgetUrlMappings) {
|
|
1245
1248
|
opts.widgetUrlMappings.forEach(rule => {
|
|
1246
1249
|
if (Widgets._matchesUrl(rule.url)) {
|
|
1247
|
-
|
|
1250
|
+
var _response$user, _response$user2, _response$user2$refer;
|
|
1251
|
+
|
|
1252
|
+
if (rule.widgetType !== "CONVERSION_WIDGET" || (_response$user = response.user) != null && _response$user.referredBy && (_response$user2 = response.user) != null && (_response$user2$refer = _response$user2.referredBy) != null && _response$user2$refer.code) {
|
|
1248
1253
|
displayOnLoad = rule.displayOnLoad;
|
|
1249
1254
|
|
|
1250
1255
|
_log$4("Display " + rule.widgetType + " on " + rule.url);
|
|
@@ -1265,9 +1270,11 @@ class Widgets {
|
|
|
1265
1270
|
} = _ref;
|
|
1266
1271
|
|
|
1267
1272
|
if (Widgets._matchesUrl(url)) {
|
|
1273
|
+
var _response$user3, _response$user4, _response$user4$refer;
|
|
1274
|
+
|
|
1268
1275
|
_log$4("Fuel Tank URL matches");
|
|
1269
1276
|
|
|
1270
|
-
if (response.user.referredBy && response.user.referredBy.code) {
|
|
1277
|
+
if ((_response$user3 = response.user) != null && _response$user3.referredBy && (_response$user4 = response.user) != null && (_response$user4$refer = _response$user4.referredBy) != null && _response$user4$refer.code) {
|
|
1271
1278
|
var formAutofill = document.querySelector(formSelector);
|
|
1272
1279
|
|
|
1273
1280
|
if (formAutofill) {
|
|
@@ -1281,7 +1288,7 @@ class Widgets {
|
|
|
1281
1288
|
}
|
|
1282
1289
|
|
|
1283
1290
|
if (config.engagementMedium === "EMBED") {
|
|
1284
|
-
this._renderEmbedWidget(params, params.context.container);
|
|
1291
|
+
widget = this._renderEmbedWidget(params, params.context.container);
|
|
1285
1292
|
} else if (config.engagementMedium === "POPUP") {
|
|
1286
1293
|
widget = this._renderPopupWidget(params);
|
|
1287
1294
|
if (displayOnLoad) widget.open();
|
|
@@ -2014,25 +2021,6 @@ function autofill(selector) {
|
|
|
2014
2021
|
// @ts-ignore -- will throw occasionally throw a null pointer exception at runtime
|
|
2015
2022
|
widgets().autofill(selector);
|
|
2016
2023
|
}
|
|
2017
|
-
/**
|
|
2018
|
-
* Overrides the default function that submits the user email. If you have
|
|
2019
|
-
* Security enabled, the email needs to be signed before it's submitted.
|
|
2020
|
-
*
|
|
2021
|
-
* @param {function} fn Callback function for the 'submit_email' event.
|
|
2022
|
-
* @returns {void}
|
|
2023
|
-
*
|
|
2024
|
-
* @example
|
|
2025
|
-
* squatch.submitEmail(function(target, widget, email) {
|
|
2026
|
-
* // Sign email and generate jwt token
|
|
2027
|
-
* var jwt = 'token';
|
|
2028
|
-
* widget.reload(email, jwt);
|
|
2029
|
-
* });
|
|
2030
|
-
*/
|
|
2031
|
-
|
|
2032
|
-
function submitEmail(fn) {
|
|
2033
|
-
// @ts-ignore -- will throw occasionally throw a null pointer exception at runtime
|
|
2034
|
-
widgets().submitEmail(fn);
|
|
2035
|
-
}
|
|
2036
2024
|
/**
|
|
2037
2025
|
* Manually set the _saasquatch cookie as a 1st party cookie if available as a URL parameter on the current page.
|
|
2038
2026
|
* This runs automatically immediately when squatch-js is loaded, except when window.SaaSquatchDoNotAutoDrop is true.
|
|
@@ -2071,7 +2059,6 @@ exports.help = help;
|
|
|
2071
2059
|
exports.init = init;
|
|
2072
2060
|
exports.pushCookie = pushCookie;
|
|
2073
2061
|
exports.ready = ready;
|
|
2074
|
-
exports.submitEmail = submitEmail;
|
|
2075
2062
|
exports.widget = widget;
|
|
2076
2063
|
exports.widgets = widgets;
|
|
2077
2064
|
//# sourceMappingURL=squatch.js.map
|