@saasquatch/squatch-js 2.7.0-1 → 2.7.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/dist/squatch.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(p,w){typeof exports=="object"&&typeof module<"u"?w(exports):typeof define=="function"&&define.amd?define(["exports"],w):(p=typeof globalThis<"u"?globalThis:p||self,w(p.squatch={}))})(this,function(p){"use strict";var rt=Object.defineProperty;var st=(p,w,A)=>w in p?rt(p,w,{enumerable:!0,configurable:!0,writable:!0,value:A}):p[w]=A;var f=(p,w,A)=>st(p,typeof w!="symbol"?w+"":w,A);var Ce;function w(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var A={exports:{}},X,se;function be(){if(se)return X;se=1;var i=1e3,n=i*60,t=n*60,e=t*24,o=e*7,r=e*365.25;X=function(s,c){c=c||{};var l=typeof s;if(l==="string"&&s.length>0)return a(s);if(l==="number"&&isFinite(s))return c.long?u(s):d(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))};function a(s){if(s=String(s),!(s.length>100)){var c=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(s);if(c){var l=parseFloat(c[1]),g=(c[2]||"ms").toLowerCase();switch(g){case"years":case"year":case"yrs":case"yr":case"y":return l*r;case"weeks":case"week":case"w":return l*o;case"days":case"day":case"d":return l*e;case"hours":case"hour":case"hrs":case"hr":case"h":return l*t;case"minutes":case"minute":case"mins":case"min":case"m":return l*n;case"seconds":case"second":case"secs":case"sec":case"s":return l*i;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return l;default:return}}}}function d(s){var c=Math.abs(s);return c>=e?Math.round(s/e)+"d":c>=t?Math.round(s/t)+"h":c>=n?Math.round(s/n)+"m":c>=i?Math.round(s/i)+"s":s+"ms"}function u(s){var c=Math.abs(s);return c>=e?h(s,c,e,"day"):c>=t?h(s,c,t,"hour"):c>=n?h(s,c,n,"minute"):c>=i?h(s,c,i,"second"):s+" ms"}function h(s,c,l,g){var m=c>=l*1.5;return Math.round(s/l)+" "+g+(m?"s":"")}return X}var Q,ae;function ve(){if(ae)return Q;ae=1;function i(n){e.debug=e,e.default=e,e.coerce=h,e.disable=d,e.enable=a,e.enabled=u,e.humanize=be(),Object.keys(n).forEach(function(s){e[s]=n[s]}),e.instances=[],e.names=[],e.skips=[],e.formatters={};function t(s){for(var c=0,l=0;l<s.length;l++)c=(c<<5)-c+s.charCodeAt(l),c|=0;return e.colors[Math.abs(c)%e.colors.length]}e.selectColor=t;function e(s){var c;function l(){if(l.enabled){for(var g=arguments.length,m=new Array(g),I=0;I<g;I++)m[I]=arguments[I];var b=l,v=Number(new Date),tt=v-(c||v);b.diff=tt,b.prev=c,b.curr=v,c=v,m[0]=e.coerce(m[0]),typeof m[0]!="string"&&m.unshift("%O");var G=0;m[0]=m[0].replace(/%([a-zA-Z%])/g,function(V,ot){if(V==="%%")return V;G++;var Ee=e.formatters[ot];if(typeof Ee=="function"){var it=m[G];V=Ee.call(b,it),m.splice(G,1),G--}return V}),e.formatArgs.call(b,m);var nt=b.log||e.log;nt.apply(b,m)}}return l.namespace=s,l.enabled=e.enabled(s),l.useColors=e.useColors(),l.color=t(s),l.destroy=o,l.extend=r,typeof e.init=="function"&&e.init(l),e.instances.push(l),l}function o(){var s=e.instances.indexOf(this);return s!==-1?(e.instances.splice(s,1),!0):!1}function r(s,c){return e(this.namespace+(typeof c>"u"?":":c)+s)}function a(s){e.save(s),e.names=[],e.skips=[];var c,l=(typeof s=="string"?s:"").split(/[\s,]+/),g=l.length;for(c=0;c<g;c++)l[c]&&(s=l[c].replace(/\*/g,".*?"),s[0]==="-"?e.skips.push(new RegExp("^"+s.substr(1)+"$")):e.names.push(new RegExp("^"+s+"$")));for(c=0;c<e.instances.length;c++){var m=e.instances[c];m.enabled=e.enabled(m.namespace)}}function d(){e.enable("")}function u(s){if(s[s.length-1]==="*")return!0;var c,l;for(c=0,l=e.skips.length;c<l;c++)if(e.skips[c].test(s))return!1;for(c=0,l=e.names.length;c<l;c++)if(e.names[c].test(s))return!0;return!1}function h(s){return s instanceof Error?s.stack||s.message:s}return e.enable(e.load()),e}return Q=i,Q}var ce;function Ae(){return ce||(ce=1,function(i,n){function t(s){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?t=function(l){return typeof l}:t=function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},t(s)}n.log=r,n.formatArgs=o,n.save=a,n.load=d,n.useColors=e,n.storage=u(),n.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function e(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function o(s){if(s[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+s[0]+(this.useColors?"%c ":" ")+"+"+i.exports.humanize(this.diff),!!this.useColors){var c="color: "+this.color;s.splice(1,0,c,"color: inherit");var l=0,g=0;s[0].replace(/%[a-zA-Z%]/g,function(m){m!=="%%"&&(l++,m==="%c"&&(g=l))}),s.splice(g,0,c)}}function r(){var s;return(typeof console>"u"?"undefined":t(console))==="object"&&console.log&&(s=console).log.apply(s,arguments)}function a(s){try{s?n.storage.setItem("debug",s):n.storage.removeItem("debug")}catch{}}function d(){var s;try{s=n.storage.getItem("debug")}catch{}return!s&&typeof process<"u"&&"env"in process&&(s=process.env.DEBUG),s}function u(){try{return localStorage}catch{}}i.exports=ve()(n);var h=i.exports.formatters;h.j=function(s){try{return JSON.stringify(s)}catch(c){return"[UnexpectedJSONParseError]: "+c.message}}}(A,A.exports)),A.exports}var y=Ae();const Ie=w(y);/*! js-cookie v3.0.5 | MIT */function $(i){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var e in t)i[e]=t[e]}return i}var _e={read:function(i){return i[0]==='"'&&(i=i.slice(1,-1)),i.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(i){return encodeURIComponent(i).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function Y(i,n){function t(o,r,a){if(!(typeof document>"u")){a=$({},n,a),typeof a.expires=="number"&&(a.expires=new Date(Date.now()+a.expires*864e5)),a.expires&&(a.expires=a.expires.toUTCString()),o=encodeURIComponent(o).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var d="";for(var u in a)a[u]&&(d+="; "+u,a[u]!==!0&&(d+="="+a[u].split(";")[0]));return document.cookie=o+"="+i.write(r,o)+d}}function e(o){if(!(typeof document>"u"||arguments.length&&!o)){for(var r=document.cookie?document.cookie.split("; "):[],a={},d=0;d<r.length;d++){var u=r[d].split("="),h=u.slice(1).join("=");try{var s=decodeURIComponent(u[0]);if(a[s]=i.read(h,s),o===s)break}catch{}}return o?a[o]:a}}return Object.create({set:t,get:e,remove:function(o,r){t(o,"",$({},r,{expires:-1}))},withAttributes:function(o){return Y(this.converter,$({},this.attributes,o))},withConverter:function(o){return Y($({},this.converter,o),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(i)}})}var W=Y(_e,{path:"/"});const F="https://app.referralsaasquatch.com",Z="https://fast.ssqt.io/npm",O="squatch",K="impact";function L(i){if(typeof i!="object")throw new Error("config must be an object");const n=window.squatchTenant,t=ee(),e={tenantAlias:(i==null?void 0:i.tenantAlias)||n,domain:(i==null?void 0:i.domain)||(t==null?void 0:t.domain),npmCdn:(i==null?void 0:i.npmCdn)||(t==null?void 0:t.npmCdn),debug:(i==null?void 0:i.debug)||(t==null?void 0:t.debug)};if(typeof e.tenantAlias!="string")throw new Error("tenantAlias not provided");const o=e.tenantAlias,r=typeof e.domain=="string"&&e.domain||F,a=typeof e.debug=="boolean"&&e.debug||!1,d=typeof e.npmCdn=="string"&&e.npmCdn||Z;return{tenantAlias:o,domain:r,debug:a,npmCdn:d}}function k(i){return typeof i=="object"&&!Array.isArray(i)&&i!==null}function Fe(i){if(i&&/^[a-z]{2}_(?:[A-Z]{2}|[0-9]{3})$/.test(i))return i}function de(i){if(!k(i))throw new Error("Widget properties must be an object");if(!(i!=null&&i.user))throw new Error("Required properties missing.");return i}function le(i){if(!k(i))throw new Error("Widget properties must be an object");return i}function R(){return window.impactToken||window.squatchToken}function ee(){return window.impactConfig||window.squatchConfig}y.debug("squatch-js:io");async function ke(i,n,t,e){const o=e||R(),r={Accept:"application/json","Content-Type":"application/json",...o?{Authorization:`Bearer ${o}`}:{},"X-SaaSquatch-Referrer":window?window.location.href:""};try{const a=await fetch(i,{method:"POST",body:JSON.stringify({query:n,variables:t}),headers:r});if(!a.ok)throw new Error(await a.text());return await a.json()}catch(a){throw a}}async function qe(i,n=""){const t={Accept:"application/json","Content-Type":"application/json"},e=n||R();e&&(t["X-SaaSquatch-User-Token"]=e);try{const o=await fetch(i,{method:"GET",credentials:"include",headers:t}),r=await o.text();if(!o.ok)throw new Error(r);return r&&JSON.parse(r)}catch(o){throw o}}async function te(i,n,t){const e={Accept:"application/json","Content-Type":"application/json"},o=t||R();o&&(e["X-SaaSquatch-User-Token"]=o);try{const r=await fetch(i,{method:"POST",body:n,headers:e}),a=await r.text();if(!r.ok)throw new Error(a);return a&&JSON.parse(a)}catch(r){throw r}}async function Re(i,n,t){const e={Accept:"application/json","Content-Type":"application/json","X-SaaSquatch-Referrer":window?window.location.href:""},o=t||R();o&&(e["X-SaaSquatch-User-Token"]=o);try{const r=await fetch(i,{headers:e,method:"PUT",credentials:"include",body:n}),a=await r.text();if(!r.ok)throw new Error(a);return a&&JSON.parse(a)}catch(r){throw r}}const Te=`
1
+ (function(p,w){typeof exports=="object"&&typeof module<"u"?w(exports):(p=typeof globalThis<"u"?globalThis:p||self,w(p.squatch={}))})(this,function(p){"use strict";var rt=Object.defineProperty;var st=(p,w,A)=>w in p?rt(p,w,{enumerable:!0,configurable:!0,writable:!0,value:A}):p[w]=A;var f=(p,w,A)=>st(p,typeof w!="symbol"?w+"":w,A);var Ce;function w(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var A={exports:{}},X,se;function be(){if(se)return X;se=1;var i=1e3,n=i*60,t=n*60,e=t*24,o=e*7,r=e*365.25;X=function(s,c){c=c||{};var l=typeof s;if(l==="string"&&s.length>0)return a(s);if(l==="number"&&isFinite(s))return c.long?u(s):d(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))};function a(s){if(s=String(s),!(s.length>100)){var c=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(s);if(c){var l=parseFloat(c[1]),g=(c[2]||"ms").toLowerCase();switch(g){case"years":case"year":case"yrs":case"yr":case"y":return l*r;case"weeks":case"week":case"w":return l*o;case"days":case"day":case"d":return l*e;case"hours":case"hour":case"hrs":case"hr":case"h":return l*t;case"minutes":case"minute":case"mins":case"min":case"m":return l*n;case"seconds":case"second":case"secs":case"sec":case"s":return l*i;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return l;default:return}}}}function d(s){var c=Math.abs(s);return c>=e?Math.round(s/e)+"d":c>=t?Math.round(s/t)+"h":c>=n?Math.round(s/n)+"m":c>=i?Math.round(s/i)+"s":s+"ms"}function u(s){var c=Math.abs(s);return c>=e?h(s,c,e,"day"):c>=t?h(s,c,t,"hour"):c>=n?h(s,c,n,"minute"):c>=i?h(s,c,i,"second"):s+" ms"}function h(s,c,l,g){var m=c>=l*1.5;return Math.round(s/l)+" "+g+(m?"s":"")}return X}var Q,ae;function ve(){if(ae)return Q;ae=1;function i(n){e.debug=e,e.default=e,e.coerce=h,e.disable=d,e.enable=a,e.enabled=u,e.humanize=be(),Object.keys(n).forEach(function(s){e[s]=n[s]}),e.instances=[],e.names=[],e.skips=[],e.formatters={};function t(s){for(var c=0,l=0;l<s.length;l++)c=(c<<5)-c+s.charCodeAt(l),c|=0;return e.colors[Math.abs(c)%e.colors.length]}e.selectColor=t;function e(s){var c;function l(){if(l.enabled){for(var g=arguments.length,m=new Array(g),I=0;I<g;I++)m[I]=arguments[I];var b=l,v=Number(new Date),tt=v-(c||v);b.diff=tt,b.prev=c,b.curr=v,c=v,m[0]=e.coerce(m[0]),typeof m[0]!="string"&&m.unshift("%O");var G=0;m[0]=m[0].replace(/%([a-zA-Z%])/g,function(V,ot){if(V==="%%")return V;G++;var Ee=e.formatters[ot];if(typeof Ee=="function"){var it=m[G];V=Ee.call(b,it),m.splice(G,1),G--}return V}),e.formatArgs.call(b,m);var nt=b.log||e.log;nt.apply(b,m)}}return l.namespace=s,l.enabled=e.enabled(s),l.useColors=e.useColors(),l.color=t(s),l.destroy=o,l.extend=r,typeof e.init=="function"&&e.init(l),e.instances.push(l),l}function o(){var s=e.instances.indexOf(this);return s!==-1?(e.instances.splice(s,1),!0):!1}function r(s,c){return e(this.namespace+(typeof c>"u"?":":c)+s)}function a(s){e.save(s),e.names=[],e.skips=[];var c,l=(typeof s=="string"?s:"").split(/[\s,]+/),g=l.length;for(c=0;c<g;c++)l[c]&&(s=l[c].replace(/\*/g,".*?"),s[0]==="-"?e.skips.push(new RegExp("^"+s.substr(1)+"$")):e.names.push(new RegExp("^"+s+"$")));for(c=0;c<e.instances.length;c++){var m=e.instances[c];m.enabled=e.enabled(m.namespace)}}function d(){e.enable("")}function u(s){if(s[s.length-1]==="*")return!0;var c,l;for(c=0,l=e.skips.length;c<l;c++)if(e.skips[c].test(s))return!1;for(c=0,l=e.names.length;c<l;c++)if(e.names[c].test(s))return!0;return!1}function h(s){return s instanceof Error?s.stack||s.message:s}return e.enable(e.load()),e}return Q=i,Q}var ce;function Ae(){return ce||(ce=1,function(i,n){function t(s){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?t=function(l){return typeof l}:t=function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},t(s)}n.log=r,n.formatArgs=o,n.save=a,n.load=d,n.useColors=e,n.storage=u(),n.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function e(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function o(s){if(s[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+s[0]+(this.useColors?"%c ":" ")+"+"+i.exports.humanize(this.diff),!!this.useColors){var c="color: "+this.color;s.splice(1,0,c,"color: inherit");var l=0,g=0;s[0].replace(/%[a-zA-Z%]/g,function(m){m!=="%%"&&(l++,m==="%c"&&(g=l))}),s.splice(g,0,c)}}function r(){var s;return(typeof console>"u"?"undefined":t(console))==="object"&&console.log&&(s=console).log.apply(s,arguments)}function a(s){try{s?n.storage.setItem("debug",s):n.storage.removeItem("debug")}catch{}}function d(){var s;try{s=n.storage.getItem("debug")}catch{}return!s&&typeof process<"u"&&"env"in process&&(s=process.env.DEBUG),s}function u(){try{return localStorage}catch{}}i.exports=ve()(n);var h=i.exports.formatters;h.j=function(s){try{return JSON.stringify(s)}catch(c){return"[UnexpectedJSONParseError]: "+c.message}}}(A,A.exports)),A.exports}var y=Ae();const Ie=w(y);/*! js-cookie v3.0.5 | MIT */function $(i){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var e in t)i[e]=t[e]}return i}var _e={read:function(i){return i[0]==='"'&&(i=i.slice(1,-1)),i.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(i){return encodeURIComponent(i).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function Y(i,n){function t(o,r,a){if(!(typeof document>"u")){a=$({},n,a),typeof a.expires=="number"&&(a.expires=new Date(Date.now()+a.expires*864e5)),a.expires&&(a.expires=a.expires.toUTCString()),o=encodeURIComponent(o).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var d="";for(var u in a)a[u]&&(d+="; "+u,a[u]!==!0&&(d+="="+a[u].split(";")[0]));return document.cookie=o+"="+i.write(r,o)+d}}function e(o){if(!(typeof document>"u"||arguments.length&&!o)){for(var r=document.cookie?document.cookie.split("; "):[],a={},d=0;d<r.length;d++){var u=r[d].split("="),h=u.slice(1).join("=");try{var s=decodeURIComponent(u[0]);if(a[s]=i.read(h,s),o===s)break}catch{}}return o?a[o]:a}}return Object.create({set:t,get:e,remove:function(o,r){t(o,"",$({},r,{expires:-1}))},withAttributes:function(o){return Y(this.converter,$({},this.attributes,o))},withConverter:function(o){return Y($({},this.converter,o),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(i)}})}var W=Y(_e,{path:"/"});const F="https://app.referralsaasquatch.com",Z="https://fast.ssqt.io/npm",O="squatch",K="impact";function L(i){if(typeof i!="object")throw new Error("config must be an object");const n=window.squatchTenant,t=ee(),e={tenantAlias:(i==null?void 0:i.tenantAlias)||n,domain:(i==null?void 0:i.domain)||(t==null?void 0:t.domain),npmCdn:(i==null?void 0:i.npmCdn)||(t==null?void 0:t.npmCdn),debug:(i==null?void 0:i.debug)||(t==null?void 0:t.debug)};if(typeof e.tenantAlias!="string")throw new Error("tenantAlias not provided");const o=e.tenantAlias,r=typeof e.domain=="string"&&e.domain||F,a=typeof e.debug=="boolean"&&e.debug||!1,d=typeof e.npmCdn=="string"&&e.npmCdn||Z;return{tenantAlias:o,domain:r,debug:a,npmCdn:d}}function k(i){return typeof i=="object"&&!Array.isArray(i)&&i!==null}function Fe(i){if(i&&/^[a-z]{2}_(?:[A-Z]{2}|[0-9]{3})$/.test(i))return i}function de(i){if(!k(i))throw new Error("Widget properties must be an object");if(!(i!=null&&i.user))throw new Error("Required properties missing.");return i}function le(i){if(!k(i))throw new Error("Widget properties must be an object");return i}function R(){return window.impactToken||window.squatchToken}function ee(){return window.impactConfig||window.squatchConfig}y.debug("squatch-js:io");async function ke(i,n,t,e){const o=e||R(),r={Accept:"application/json","Content-Type":"application/json",...o?{Authorization:`Bearer ${o}`}:{},"X-SaaSquatch-Referrer":window?window.location.href:""};try{const a=await fetch(i,{method:"POST",body:JSON.stringify({query:n,variables:t}),headers:r});if(!a.ok)throw new Error(await a.text());return await a.json()}catch(a){throw a}}async function qe(i,n=""){const t={Accept:"application/json","Content-Type":"application/json"},e=n||R();e&&(t["X-SaaSquatch-User-Token"]=e);try{const o=await fetch(i,{method:"GET",credentials:"include",headers:t}),r=await o.text();if(!o.ok)throw new Error(r);return r&&JSON.parse(r)}catch(o){throw o}}async function te(i,n,t){const e={Accept:"application/json","Content-Type":"application/json"},o=t||R();o&&(e["X-SaaSquatch-User-Token"]=o);try{const r=await fetch(i,{method:"POST",body:n,headers:e}),a=await r.text();if(!r.ok)throw new Error(a);return a&&JSON.parse(a)}catch(r){throw r}}async function Re(i,n,t){const e={Accept:"application/json","Content-Type":"application/json","X-SaaSquatch-Referrer":window?window.location.href:""},o=t||R();o&&(e["X-SaaSquatch-User-Token"]=o);try{const r=await fetch(i,{headers:e,method:"PUT",credentials:"include",body:n}),a=await r.text();if(!r.ok)throw new Error(a);return a&&JSON.parse(a)}catch(r){throw r}}const Te=`
2
2
  query renderWidget ($user: UserIdInput, $engagementMedium: UserEngagementMedium, $widgetType: WidgetType, $locale: RSLocale) {
3
3
  renderWidget(user: $user, engagementMedium: $engagementMedium, widgetType: $widgetType, locale: $locale) {
4
4
  template
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@saasquatch/squatch-js",
3
3
  "type": "module",
4
- "version": "2.7.0-1",
4
+ "version": "2.7.0-2",
5
5
  "description": "The official Referral SaaSquatch Javascript Web/Browser SDK https://docs.referralsaasquatch.com/developer/squatchjs/",
6
6
  "license": "MIT",
7
7
  "author": "ReferralSaaSquatch.com, Inc.",
package/vite.config.ts CHANGED
@@ -17,5 +17,11 @@ export default defineConfig({
17
17
  },
18
18
  outDir: resolve(__dirname, "dist"),
19
19
  minify: true,
20
+ rollupOptions: {
21
+ output: {
22
+ amd: { define: "false" },
23
+ format: "umd",
24
+ },
25
+ },
20
26
  },
21
27
  });