@saasquatch/squatch-js 2.6.0-7 → 2.6.0-8
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/README.md +14 -5
- package/coverage/clover.xml +65 -64
- package/coverage/coverage-final.json +5 -5
- package/coverage/lcov.info +125 -119
- package/dist/async.d.ts +2 -2
- package/dist/squatch.esm.js +18 -22
- package/dist/squatch.esm.js.map +1 -1
- package/dist/squatch.js +18 -22
- package/dist/squatch.js.map +1 -1
- package/dist/squatch.min.js +1 -1
- package/dist/widgets/Widgets.d.ts +8 -8
- package/dist/widgets/declarative/DeclarativeWidget.d.ts +5 -5
- package/package.json +1 -1
package/dist/squatch.js
CHANGED
|
@@ -81,10 +81,10 @@ function validatePasswordlessConfig(raw) {
|
|
|
81
81
|
return raw;
|
|
82
82
|
}
|
|
83
83
|
function getToken() {
|
|
84
|
-
return window.
|
|
84
|
+
return window.impactToken || window.squatchToken;
|
|
85
85
|
}
|
|
86
86
|
function getConfig() {
|
|
87
|
-
return window.
|
|
87
|
+
return window.impactConfig || window.squatchConfig;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
debug.debug("squatch-js:io");
|
|
@@ -545,8 +545,7 @@ class Widget {
|
|
|
545
545
|
_log$8("ERROR: pushAnalyticsShareClickedEvent() " + ex);
|
|
546
546
|
});
|
|
547
547
|
}
|
|
548
|
-
}
|
|
549
|
-
|
|
548
|
+
}
|
|
550
549
|
|
|
551
550
|
_error(rs, mode, style) {
|
|
552
551
|
if (mode === void 0) {
|
|
@@ -863,7 +862,7 @@ class EmbedWidget extends Widget {
|
|
|
863
862
|
|
|
864
863
|
_shouldFireLoadEvent() {
|
|
865
864
|
var noContainer = !this.container;
|
|
866
|
-
var isComponent = this.container instanceof HTMLElement && this.container.tagName.startsWith("SQUATCH-");
|
|
865
|
+
var isComponent = this.container instanceof HTMLElement && (this.container.tagName.startsWith("SQUATCH-") || this.container.tagName.startsWith("IMPACT-"));
|
|
867
866
|
var isVerified = !!this.context.user;
|
|
868
867
|
return isVerified && (noContainer || isComponent);
|
|
869
868
|
}
|
|
@@ -1091,11 +1090,11 @@ class Widgets {
|
|
|
1091
1090
|
*/
|
|
1092
1091
|
|
|
1093
1092
|
/**
|
|
1094
|
-
* Tenant alias of SaaSquatch tenant
|
|
1093
|
+
* Tenant alias of SaaSquatch tenant
|
|
1095
1094
|
*/
|
|
1096
1095
|
|
|
1097
1096
|
/**
|
|
1098
|
-
* SaaSquatch domain for API requests
|
|
1097
|
+
* SaaSquatch domain for API requests
|
|
1099
1098
|
* @default "https://app.referralsaasquatch.com"
|
|
1100
1099
|
*/
|
|
1101
1100
|
|
|
@@ -1139,13 +1138,13 @@ class Widgets {
|
|
|
1139
1138
|
* @param {Object} config.user The user details
|
|
1140
1139
|
* @param {string} config.user.id The user id
|
|
1141
1140
|
* @param {string} config.user.accountId The user account id
|
|
1142
|
-
* @param {WidgetType} config.widgetType The content of the widget
|
|
1143
|
-
* @param {EngagementMedium} config.engagementMedium How to display the widget
|
|
1141
|
+
* @param {WidgetType} config.widgetType The content of the widget
|
|
1142
|
+
* @param {EngagementMedium} config.engagementMedium How to display the widget
|
|
1144
1143
|
* @param {string} config.jwt the JSON Web Token (JWT) that is used to validate the data (can be disabled)
|
|
1145
1144
|
* @param {HTMLElement | string | undefined} config.container Element to load the widget into
|
|
1146
1145
|
* @param {string | undefined} config.trigger Trigger element for opening the popup widget
|
|
1147
1146
|
*
|
|
1148
|
-
* @return {Promise<WidgetResult>} json object if true, with a Widget and user details
|
|
1147
|
+
* @return {Promise<WidgetResult>} json object if true, with a Widget and user details
|
|
1149
1148
|
*/
|
|
1150
1149
|
|
|
1151
1150
|
|
|
@@ -1183,12 +1182,12 @@ class Widgets {
|
|
|
1183
1182
|
* @param {Object} config.user The user details
|
|
1184
1183
|
* @param {string} config.user.id The user id
|
|
1185
1184
|
* @param {string} config.user.accountId The user account id
|
|
1186
|
-
* @param {WidgetType} config.widgetType The content of the widget
|
|
1187
|
-
* @param {EngagementMedium} config.engagementMedium How to display the widget
|
|
1185
|
+
* @param {WidgetType} config.widgetType The content of the widget
|
|
1186
|
+
* @param {EngagementMedium} config.engagementMedium How to display the widget
|
|
1188
1187
|
* @param {string} config.jwt the JSON Web Token (JWT) that is used
|
|
1189
1188
|
* to validate the data (can be disabled)
|
|
1190
1189
|
*
|
|
1191
|
-
* @return {Promise<WidgetResult>} json object if true, with a Widget and user details
|
|
1190
|
+
* @return {Promise<WidgetResult>} json object if true, with a Widget and user details
|
|
1192
1191
|
*/
|
|
1193
1192
|
|
|
1194
1193
|
|
|
@@ -1492,9 +1491,6 @@ function _validateTrackOptions(raw) {
|
|
|
1492
1491
|
function asyncLoad() {
|
|
1493
1492
|
var impactNamespace = "impactTBD";
|
|
1494
1493
|
var namespace = window[impactNamespace] ? impactNamespace : "squatch";
|
|
1495
|
-
console.log({
|
|
1496
|
-
namespace
|
|
1497
|
-
});
|
|
1498
1494
|
var loaded = window[namespace] || null;
|
|
1499
1495
|
var cached = window["_" + namespace] || null;
|
|
1500
1496
|
|
|
@@ -1690,7 +1686,7 @@ function convertExtraToConfig(obj) {
|
|
|
1690
1686
|
};
|
|
1691
1687
|
}
|
|
1692
1688
|
|
|
1693
|
-
var _log$2 = debug.debug("squatch-js:
|
|
1689
|
+
var _log$2 = debug.debug("squatch-js:decodeUserJwt");
|
|
1694
1690
|
|
|
1695
1691
|
function decodeUserJwt(tokenStr) {
|
|
1696
1692
|
try {
|
|
@@ -1709,7 +1705,7 @@ function decodeUserJwt(tokenStr) {
|
|
|
1709
1705
|
|
|
1710
1706
|
var _log$1 = debug__default['default']("squatch-js:DeclarativeWidget");
|
|
1711
1707
|
/**
|
|
1712
|
-
* Abstract class for building web-components that render SaaSquatch widgets to the DOM
|
|
1708
|
+
* Abstract class for building web-components that render SaaSquatch widgets to the DOM
|
|
1713
1709
|
* @abstract
|
|
1714
1710
|
* @example
|
|
1715
1711
|
* class TestWidgetElement extends DeclarativeWidget {}
|
|
@@ -1757,7 +1753,7 @@ class DeclarativeWidget extends HTMLElement {
|
|
|
1757
1753
|
*/
|
|
1758
1754
|
|
|
1759
1755
|
/**
|
|
1760
|
-
* Determines whether to render the widget as an embedding widget or popup widget
|
|
1756
|
+
* Determines whether to render the widget as an embedding widget or popup widget
|
|
1761
1757
|
*/
|
|
1762
1758
|
|
|
1763
1759
|
/**
|
|
@@ -1888,7 +1884,7 @@ class DeclarativeWidget extends HTMLElement {
|
|
|
1888
1884
|
}
|
|
1889
1885
|
|
|
1890
1886
|
/**
|
|
1891
|
-
* Fetches widget content from SaaSquatch and builds a Widget instance to support rendering the widget in the DOM
|
|
1887
|
+
* Fetches widget content from SaaSquatch and builds a Widget instance to support rendering the widget in the DOM
|
|
1892
1888
|
* @returns Instance of either {@link EmbedWidget} or {@link PopupWidget} depending on `this.type`
|
|
1893
1889
|
* @throws Throws an Error if `widgetType` is undefined
|
|
1894
1890
|
*/
|
|
@@ -1908,7 +1904,7 @@ class DeclarativeWidget extends HTMLElement {
|
|
|
1908
1904
|
return widgetInstance;
|
|
1909
1905
|
}
|
|
1910
1906
|
/**
|
|
1911
|
-
* Calls {@link getWidgetInstance} to build the Widget instance and loads the widget iframe into the DOM
|
|
1907
|
+
* Calls {@link getWidgetInstance} to build the Widget instance and loads the widget iframe into the DOM
|
|
1912
1908
|
*/
|
|
1913
1909
|
|
|
1914
1910
|
|
|
@@ -1917,7 +1913,7 @@ class DeclarativeWidget extends HTMLElement {
|
|
|
1917
1913
|
await this.widgetInstance.load();
|
|
1918
1914
|
}
|
|
1919
1915
|
/**
|
|
1920
|
-
* Builds a Widget instance for the default error widget
|
|
1916
|
+
* Builds a Widget instance for the default error widget
|
|
1921
1917
|
* @returns Instance of either {@link EmbedWidget} or {@link PopupWidget} depending on `this.type`
|
|
1922
1918
|
*/
|
|
1923
1919
|
|