@saasquatch/squatch-js 2.8.0 → 2.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -1
- package/README.md +3 -11
- package/coverage/clover.xml +944 -0
- package/coverage/coverage-final.json +22 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +196 -0
- package/coverage/lcov.info +1714 -0
- package/dist/squatch.cjs.js +19 -15
- package/dist/squatch.cjs.js.map +1 -1
- package/dist/squatch.d.ts +1 -1
- package/dist/squatch.esm.js +19 -15
- package/dist/squatch.esm.js.map +1 -1
- package/dist/squatch.js +19 -15
- package/dist/squatch.js.map +1 -1
- package/dist/squatch.min.js +1 -1
- package/dist/utils/utmUtils.d.ts +1 -10
- package/package.json +1 -1
package/dist/squatch.d.ts
CHANGED
|
@@ -60,7 +60,7 @@ export declare function widget(widgetConfig: WidgetConfig): Promise<WidgetResult
|
|
|
60
60
|
* Called by default on startup via the loader script.
|
|
61
61
|
* @private
|
|
62
62
|
*/
|
|
63
|
-
export declare function _auto(
|
|
63
|
+
export declare function _auto(): Promise<WidgetResult | undefined> | undefined;
|
|
64
64
|
/**
|
|
65
65
|
* Initializes the static `squatch` global. This sets up:
|
|
66
66
|
*
|
package/dist/squatch.esm.js
CHANGED
|
@@ -1787,7 +1787,8 @@ function _pushCookie() {
|
|
|
1787
1787
|
}
|
|
1788
1788
|
}
|
|
1789
1789
|
const _log$3 = browserExports.debug("squatch-js");
|
|
1790
|
-
function _getAutoConfig(
|
|
1790
|
+
function _getAutoConfig() {
|
|
1791
|
+
var _a2;
|
|
1791
1792
|
const queryString = window.location.search;
|
|
1792
1793
|
const urlParams = new URLSearchParams(queryString);
|
|
1793
1794
|
const refParam = urlParams.get("_saasquatchExtra") || "";
|
|
@@ -1795,6 +1796,13 @@ function _getAutoConfig(configIn) {
|
|
|
1795
1796
|
_log$3("No _saasquatchExtra param");
|
|
1796
1797
|
return;
|
|
1797
1798
|
}
|
|
1799
|
+
const config = validateConfig({
|
|
1800
|
+
tenantAlias: "UNKNOWN"
|
|
1801
|
+
});
|
|
1802
|
+
if (!config.domain) {
|
|
1803
|
+
_log$3("domain must be provided in config to use _saasquatchExtra");
|
|
1804
|
+
return;
|
|
1805
|
+
}
|
|
1798
1806
|
let raw;
|
|
1799
1807
|
try {
|
|
1800
1808
|
raw = JSON.parse(b64decode(refParam));
|
|
@@ -1802,8 +1810,13 @@ function _getAutoConfig(configIn) {
|
|
|
1802
1810
|
_log$3("Unable to decode _saasquatchExtra config");
|
|
1803
1811
|
return;
|
|
1804
1812
|
}
|
|
1805
|
-
|
|
1806
|
-
|
|
1813
|
+
function normalizeDomain(domain) {
|
|
1814
|
+
return domain.replace(/^https?:\/\//, "");
|
|
1815
|
+
}
|
|
1816
|
+
const normalizedDomain = normalizeDomain(config.domain);
|
|
1817
|
+
const tenantAlias = Object.keys((raw == null ? void 0 : raw[normalizedDomain]) || {})[0];
|
|
1818
|
+
const widgetConfig = (_a2 = raw == null ? void 0 : raw[normalizedDomain]) == null ? void 0 : _a2[tenantAlias];
|
|
1819
|
+
if (!widgetConfig) {
|
|
1807
1820
|
_log$3("_saasquatchExtra did not have an expected structure");
|
|
1808
1821
|
return void 0;
|
|
1809
1822
|
}
|
|
@@ -1815,20 +1828,11 @@ function _getAutoConfig(configIn) {
|
|
|
1815
1828
|
...rest
|
|
1816
1829
|
},
|
|
1817
1830
|
squatchConfig: {
|
|
1818
|
-
...
|
|
1819
|
-
domain,
|
|
1831
|
+
...config,
|
|
1820
1832
|
tenantAlias
|
|
1821
1833
|
}
|
|
1822
1834
|
};
|
|
1823
1835
|
}
|
|
1824
|
-
function convertExtraToConfig(obj) {
|
|
1825
|
-
var _a2;
|
|
1826
|
-
const _domain = Object.keys(obj || {})[0];
|
|
1827
|
-
const tenantAlias = Object.keys((obj == null ? void 0 : obj[_domain]) || {})[0];
|
|
1828
|
-
const widgetConfig = (_a2 = obj == null ? void 0 : obj[_domain]) == null ? void 0 : _a2[tenantAlias];
|
|
1829
|
-
const domain = _domain ? `https://${_domain}` : void 0;
|
|
1830
|
-
return { domain, tenantAlias, widgetConfig };
|
|
1831
|
-
}
|
|
1832
1836
|
const _log$2 = browserExports.debug("squatch-js:decodeUserJwt");
|
|
1833
1837
|
function decodeUserJwt(tokenStr) {
|
|
1834
1838
|
var _a2;
|
|
@@ -2141,9 +2145,9 @@ function widget(widgetConfig) {
|
|
|
2141
2145
|
var _a2;
|
|
2142
2146
|
return (_a2 = widgets()) == null ? void 0 : _a2.render(widgetConfig);
|
|
2143
2147
|
}
|
|
2144
|
-
function _auto(
|
|
2148
|
+
function _auto() {
|
|
2145
2149
|
var _a2;
|
|
2146
|
-
const configs = _getAutoConfig(
|
|
2150
|
+
const configs = _getAutoConfig();
|
|
2147
2151
|
if (configs) {
|
|
2148
2152
|
const { squatchConfig, widgetConfig } = configs;
|
|
2149
2153
|
init(squatchConfig);
|