@saasquatch/squatch-js 2.6.3 → 2.7.0-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/dist/squatch.cjs.js +48 -0
- package/dist/squatch.es.js +1622 -0
- package/dist/squatch.js +46 -2335
- package/dist copy/squatch.cjs.js +48 -0
- package/dist copy/squatch.es.js +1622 -0
- package/dist copy/squatch.js +2337 -0
- package/package.json +9 -8
- package/vite-env.d.ts +1 -0
- package/vite.config.ts +21 -0
- package/dist/squatch.min.js +0 -2
- package/dist/squatch.min.js.LICENSE.txt +0 -6
- package/dist/utils/decode.d.ts +0 -2
- package/dist/utils/decodeBase64.d.ts +0 -1
- /package/{dist → dist copy}/api/AnalyticsApi.d.ts +0 -0
- /package/{dist → dist copy}/api/EventsApi.d.ts +0 -0
- /package/{dist → dist copy}/api/WidgetApi.d.ts +0 -0
- /package/{dist → dist copy}/api/graphql.d.ts +0 -0
- /package/{dist → dist copy}/async.d.ts +0 -0
- /package/{dist → dist copy}/docs.d.ts +0 -0
- /package/{dist → dist copy}/globals.d.ts +0 -0
- /package/{dist → dist copy}/squatch.d.ts +0 -0
- /package/{dist → dist copy}/squatch.esm.js +0 -0
- /package/{dist → dist copy}/squatch.esm.js.map +0 -0
- /package/{dist → dist copy}/squatch.js.map +0 -0
- /package/{dist → dist copy}/types.d.ts +0 -0
- /package/{dist → dist copy}/utils/cookieUtils.d.ts +0 -0
- /package/{dist → dist copy}/utils/decodeUserJwt.d.ts +0 -0
- /package/{dist → dist copy}/utils/domready.d.ts +0 -0
- /package/{dist → dist copy}/utils/io.d.ts +0 -0
- /package/{dist → dist copy}/utils/utmUtils.d.ts +0 -0
- /package/{dist → dist copy}/utils/validate.d.ts +0 -0
- /package/{dist → dist copy}/widgets/EmbedWidget.d.ts +0 -0
- /package/{dist → dist copy}/widgets/PopupWidget.d.ts +0 -0
- /package/{dist → dist copy}/widgets/Widget.d.ts +0 -0
- /package/{dist → dist copy}/widgets/Widgets.d.ts +0 -0
- /package/{dist → dist copy}/widgets/declarative/DeclarativeWidget.d.ts +0 -0
- /package/{dist → dist copy}/widgets/declarative/DeclarativeWidgets.d.ts +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saasquatch/squatch-js",
|
|
3
|
-
"
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "2.7.0-1",
|
|
4
5
|
"description": "The official Referral SaaSquatch Javascript Web/Browser SDK https://docs.referralsaasquatch.com/developer/squatchjs/",
|
|
5
6
|
"license": "MIT",
|
|
6
7
|
"author": "ReferralSaaSquatch.com, Inc.",
|
|
@@ -26,10 +27,9 @@
|
|
|
26
27
|
},
|
|
27
28
|
"sideEffects": false,
|
|
28
29
|
"scripts": {
|
|
29
|
-
"build:es": "
|
|
30
|
-
"build
|
|
31
|
-
"
|
|
32
|
-
"watch": "webpack --watch",
|
|
30
|
+
"build:es": "vite build",
|
|
31
|
+
"build": "run-s build:es build:docs",
|
|
32
|
+
"watch": "vite serve",
|
|
33
33
|
"declaration": "tsc --emitDeclarationOnly",
|
|
34
34
|
"test:browser": "cucumber-js",
|
|
35
35
|
"test:webkit": "cross-env BROWSER=webkit cucumber-js",
|
|
@@ -101,15 +101,16 @@
|
|
|
101
101
|
"tsd": "^0.13.1",
|
|
102
102
|
"typedoc": "^0.24.8",
|
|
103
103
|
"typescript": "^5.1.6",
|
|
104
|
-
"webpack": "^5.88.0",
|
|
105
104
|
"webpack-bundle-analyzer": "^4.9.0",
|
|
106
|
-
"webpack-cli": "^
|
|
105
|
+
"webpack-cli": "^6.0.1",
|
|
107
106
|
"webpack-visualizer-plugin": "^0.1.11"
|
|
108
107
|
},
|
|
109
108
|
"prettier": {},
|
|
110
109
|
"dependencies": {
|
|
111
110
|
"debug": "^3.2.6",
|
|
112
|
-
"js-cookie": "^3.0.5"
|
|
111
|
+
"js-cookie": "^3.0.5",
|
|
112
|
+
"vite": "^6.0.11",
|
|
113
|
+
"vite-tsconfig-paths": "^5.1.4"
|
|
113
114
|
},
|
|
114
115
|
"browserslist": "> 0.25%, not dead",
|
|
115
116
|
"msw": {
|
package/vite-env.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
package/vite.config.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { resolve } from "path";
|
|
2
|
+
import { defineConfig } from "vite";
|
|
3
|
+
import tsconfigPaths from "vite-tsconfig-paths";
|
|
4
|
+
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
plugins: [tsconfigPaths()],
|
|
7
|
+
server: {
|
|
8
|
+
port: 3000,
|
|
9
|
+
},
|
|
10
|
+
build: {
|
|
11
|
+
lib: {
|
|
12
|
+
formats: ["es", "cjs", "umd"],
|
|
13
|
+
entry: resolve(__dirname, "src/squatch.ts"),
|
|
14
|
+
fileName: (format) =>
|
|
15
|
+
format === "umd" ? "squatch.js" : `squatch.${format}.js`,
|
|
16
|
+
name: "squatch",
|
|
17
|
+
},
|
|
18
|
+
outDir: resolve(__dirname, "dist"),
|
|
19
|
+
minify: true,
|
|
20
|
+
},
|
|
21
|
+
});
|
package/dist/squatch.min.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see squatch.min.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.squatch=t():e.squatch=t()}(self,(function(){return function(){var e={264:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(822),o=n(615),i=n(787);class a{constructor(e){var t,n=function(e){if(!(0,i.Kn)(e))throw new Error("'options' should be an object");return e}(e);this.domain=(null==n?void 0:n.domain)||(null===(t=(0,i.iE)())||void 0===t?void 0:t.domain)||r.cE}pushAnalyticsLoadEvent(e){if(e.externalUserId&&e.externalAccountId){var t=encodeURIComponent(e.tenantAlias),n=encodeURIComponent(e.externalAccountId),r=encodeURIComponent(e.externalUserId),i=encodeURIComponent(e.engagementMedium),a=e.programId?"&programId=".concat(encodeURIComponent(e.programId)):"",s="/a/".concat(t,"/widgets/analytics/loaded?externalAccountId=").concat(n,"&externalUserId=").concat(r,"&engagementMedium=").concat(i).concat(a),c=this.domain+s;return(0,o.Mx)(c,JSON.stringify({}))}}pushAnalyticsShareClickedEvent(e){var t=encodeURIComponent(e.tenantAlias),n=encodeURIComponent(e.externalAccountId),r=encodeURIComponent(e.externalUserId),i=encodeURIComponent(e.engagementMedium),a=encodeURIComponent(e.shareMedium),s="/a/".concat(t,"/widgets/analytics/shared?externalAccountId=").concat(n,"&externalUserId=").concat(r,"&engagementMedium=").concat(i,"&shareMedium=").concat(a),c=this.domain+s;return(0,o.Mx)(c,JSON.stringify({}))}}},745:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(615),o=n(787);class i{constructor(e){var t=e,n=(0,o.ww)(t);this.tenantAlias=n.tenantAlias,this.domain=n.domain}track(e,t){var n=t,i=function(e){if(!(0,o.Kn)(e))throw new Error("tracking parameter must be an object");if(null==e||!e.accountId)throw new Error("accountId field is required");if(null==e||!e.events)throw new Error("events field is required");if(null==e||!e.userId)throw new Error("userId field is required");var t=e;if(!Array.isArray(t.events))throw new Error("'events' should be an array");return t}(e),{jwt:a}=function(e){if(!(0,o.Kn)(e))throw new Error("'options' should be an object");return e}(n),s=encodeURIComponent(this.tenantAlias),c=encodeURIComponent(i.userId),d=encodeURIComponent(i.accountId),u="/api/v1/".concat(s,"/open/account/").concat(d,"/user/").concat(c,"/events"),l=this.domain+u;return(0,r.Mx)(l,JSON.stringify(i),a)}}},139:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(861),o=n(572),i=n(955),a=n(615),s=n(787);function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach((function(t){(0,o.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}class u{constructor(e){(0,o.Z)(this,"referralCookie",this.squatchReferralCookie);var t=e,n=(0,s.ww)(t);this.tenantAlias=n.tenantAlias,this.domain=n.domain,this.npmCdn=n.npmCdn}upsertUser(e){var t=e,n=(0,s.xW)(t),{widgetType:r,engagementMedium:o="POPUP",jwt:c,locale:d,user:u}=n,l=encodeURIComponent(this.tenantAlias),p=u.accountId?encodeURIComponent(u.accountId):null,h=u.id?encodeURIComponent(u.id):null,f=function(e){var{widgetType:t,engagementMedium:n,locale:r}=e,o=new URLSearchParams;return o.append("engagementMedium",n),t&&o.append("widgetType",t),r&&o.append("locale",r),"?".concat(o.toString())}({widgetType:r,engagementMedium:o,locale:d}),g="/api/v1/".concat(l,"/widget/account/").concat(p,"/user/").concat(h,"/upsert").concat(f),m=this.domain+g,w=(i.Z||window.Cookies).get("_saasquatch");return w&&(u.cookies=w),(0,a.iR)(m,JSON.stringify(u),c)}render(e){var t,n=e,o=(0,s.ZL)(n),{widgetType:i,engagementMedium:c="POPUP",jwt:d,user:u}=o,l=encodeURIComponent(this.tenantAlias),p=null!=u&&u.accountId?encodeURIComponent(u.accountId):null,h=null!=u&&u.id?encodeURIComponent(u.id):null,f=null!==(t=o.locale)&&void 0!==t?t:(0,s.Qb)(navigator.language.replace(/\-/g,"_")),g="/api/v1/".concat(l,"/graphql"),m=this.domain+g;return new Promise(function(){var e=(0,r.Z)((function*(e,t){try{var n,r=yield(0,a.Rf)(m,"\n query renderWidget ($user: UserIdInput, $engagementMedium: UserEngagementMedium, $widgetType: WidgetType, $locale: RSLocale) {\n renderWidget(user: $user, engagementMedium: $engagementMedium, widgetType: $widgetType, locale: $locale) {\n template\n user {\n id\n accountId\n }\n jsOptions\n widgetConfig {\n values\n }\n }\n }\n",{user:h&&p?{id:h,accountId:p}:null,engagementMedium:c,widgetType:i,locale:f},d);e(null==r||null===(n=r.data)||void 0===n?void 0:n.renderWidget)}catch(e){t(e)}}));return function(t,n){return e.apply(this,arguments)}}())}squatchReferralCookie(){var e=this;return(0,r.Z)((function*(){var t=encodeURIComponent(e.tenantAlias),n=(i.Z||window.Cookies).get("_saasquatch")||"",r=n?"?cookies=".concat(encodeURIComponent(n)):"",o="".concat(e.domain,"/a/").concat(t,"/widgets/squatchcookiejson").concat(r),s=yield(0,a.gc)(o);return Promise.resolve(d(d({},s),{},{encodedCookie:n}))}))()}}},762:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(822);function o(){var e,t=window[r.q9]?r.q9:r.zG,n=[...(null===(e=window["_"+t])||void 0===e?void 0:e.ready)||[],window.impactOnReady||window.squatchOnReady].filter((e=>!!e));setTimeout((()=>{window[r.zG]&&(window[r.q9]=window[r.zG],n.forEach((e=>e())),window[r.zG]._auto(),window["_"+t]=void 0,delete window["_"+t])}),0)}},510:function(e,t,n){"use strict";function r(){console.log("Having trouble using Squatch.js? Go to https://docs.referralsaasquatch.com/developer/ for tutorials, references and error codes.")}n.d(t,{R:function(){return r}})},822:function(e,t,n){"use strict";n.d(t,{cE:function(){return r},eu:function(){return o},q9:function(){return a},zG:function(){return i}});var r="https://app.referralsaasquatch.com",o="https://fast.ssqt.io/npm",i="squatch",a="impact"},518:function(){},998:function(e,t,n){"use strict";n.d(t,{FO:function(){return l},bT:function(){return h}});var r=n(572),o=n(227),i=n(955);function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){(0,r.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var c=(0,o.debug)("squatch-js"),d=e=>"object"==typeof e&&!Array.isArray(e),u=(e,t)=>{var n=n=>d(t[n])&&e.hasOwnProperty(n)&&d(e[n]),r=Object.getOwnPropertyNames(t).map((r=>({[r]:n(r)?u(e[r],t[r]):t[r]}))).reduce(((e,t)=>s(s({},e),t)),{});return s(s({},e),r)};function l(e){for(var t=atob(e.replace(/_/g,"/").replace(/-/g,"+")),n=new Uint8Array(t.length),r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return new TextDecoder("utf8").decode(n)}function p(e){var t=(new TextEncoder).encode(e),n=Array.from(t,(e=>String.fromCodePoint(e))).join("");return btoa(n).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function h(){var e=window.location.search,t=new URLSearchParams(e).get("_saasquatch")||"";if(t){var n="",r="",o="";try{n=JSON.parse(l(t))}catch(e){return void c("Unable to decode params",e)}try{r=JSON.parse(l(i.Z.get("_saasquatch"))),c("existing cookie",r)}catch(e){c("Unable to retrieve cookie",e)}try{var a=function(){var e,t,n="weird_get_top_level_domain=cookie",r=document.location.hostname.split(".");for(e=r.length-1;e>=0;e--)if(t=r.slice(e).join("."),document.cookie=n+";domain=."+t+";",document.cookie.indexOf(n)>-1)return document.cookie=n.split("=")[0]+"=;domain=."+t+";expires=Thu, 01 Jan 1970 00:00:01 GMT;",t}();if(c("domain retrieved:",a),r){var s=u(r,n);o=p(JSON.stringify(s)),c("cookie to store:",s)}else o=p(JSON.stringify(n)),c("cookie to store:",n);i.Z.set("_saasquatch",o,{expires:365,secure:!1,sameSite:"Lax",domain:a,path:"/"})}catch(e){c("Unable to set cookie",e)}}}},936:function(e,t,n){"use strict";function r(e,t){var n,r=[],o=e,i=o.documentElement.doScroll,a="DOMContentLoaded",s=(i?/^loaded|^c/:/^loaded|^i|^c/).test(o.readyState);return s||o.addEventListener(a,n=()=>{for(o.removeEventListener(a,n),s=!0;n=r.shift();)n()}),s?setTimeout(t,0):r.push(t)}n.d(t,{V:function(){return r}})},615:function(e,t,n){"use strict";n.d(t,{Mx:function(){return h},Rf:function(){return d},gc:function(){return l},iR:function(){return g}});var r=n(572),o=n(861),i=n(227),a=n(787);function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){(0,r.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function d(e,t,n,r){return u.apply(this,arguments)}function u(){return(u=(0,o.Z)((function*(e,t,n,r){var o=r||(0,a.LP)(),i=c(c({Accept:"application/json","Content-Type":"application/json"},o?{Authorization:"Bearer ".concat(o)}:{}),{},{"X-SaaSquatch-Referrer":window?window.location.href:""});try{var s=yield fetch(e,{method:"POST",body:JSON.stringify({query:t,variables:n}),headers:i});if(!s.ok)throw new Error(yield s.text());return yield s.json()}catch(e){throw e}}))).apply(this,arguments)}function l(e){return p.apply(this,arguments)}function p(){return p=(0,o.Z)((function*(e){var t={Accept:"application/json","Content-Type":"application/json"},n=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"")||(0,a.LP)();n&&(t["X-SaaSquatch-User-Token"]=n);try{var r=yield fetch(e,{method:"GET",credentials:"include",headers:t}),o=yield r.text();if(!r.ok)throw new Error(o);return o?JSON.parse(o):o}catch(e){throw e}})),p.apply(this,arguments)}function h(e,t,n){return f.apply(this,arguments)}function f(){return(f=(0,o.Z)((function*(e,t,n){var r={Accept:"application/json","Content-Type":"application/json"},o=n||(0,a.LP)();o&&(r["X-SaaSquatch-User-Token"]=o);try{var i=yield fetch(e,{method:"POST",body:t,headers:r}),s=yield i.text();if(!i.ok)throw new Error(s);return s?JSON.parse(s):s}catch(e){throw e}}))).apply(this,arguments)}function g(e,t,n){return m.apply(this,arguments)}function m(){return(m=(0,o.Z)((function*(e,t,n){var r={Accept:"application/json","Content-Type":"application/json","X-SaaSquatch-Referrer":window?window.location.href:""},o=n||(0,a.LP)();o&&(r["X-SaaSquatch-User-Token"]=o);try{var i=yield fetch(e,{headers:r,method:"PUT",credentials:"include",body:t}),s=yield i.text();if(!i.ok)throw new Error(s);return s?JSON.parse(s):s}catch(e){throw e}}))).apply(this,arguments)}(0,i.debug)("squatch-js:io")},8:function(e,t,n){"use strict";n.d(t,{G:function(){return u}});var r=n(572);function o(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var i=n(227),a=n(998);function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){(0,r.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var d=(0,i.debug)("squatch-js");function u(e){var t=window.location.search,n=new URLSearchParams(t).get("_saasquatchExtra")||"";if(n){var r;try{r=JSON.parse((0,a.FO)(n))}catch(e){return void d("Unable to decode _saasquatchExtra config")}var{domain:i,tenantAlias:s,widgetConfig:u}=function(e){var t,n=Object.keys(e||{})[0],r=Object.keys((null==e?void 0:e[n])||{})[0],o=null==e||null===(t=e[n])||void 0===t?void 0:t[r];return{domain:n?"https://".concat(n):void 0,tenantAlias:r,widgetConfig:o}}(r);if(i&&s&&u){var{autoPopupWidgetType:l}=u;return{widgetConfig:c({widgetType:l,displayOnLoad:!0},o(u,["autoPopupWidgetType"])),squatchConfig:c(c({},e?{configIn:e}:{}),{},{domain:i,tenantAlias:s})}}d("_saasquatchExtra did not have an expected structure")}else d("No _saasquatchExtra param")}},787:function(e,t,n){"use strict";n.d(t,{Kn:function(){return i},LP:function(){return d},Qb:function(){return a},ZL:function(){return c},iE:function(){return u},ww:function(){return o},xW:function(){return s}});var r=n(822);function o(e){if("object"!=typeof e)throw new Error("config must be an object");var t=window.squatchTenant,n=u(),o={tenantAlias:(null==e?void 0:e.tenantAlias)||t,domain:(null==e?void 0:e.domain)||(null==n?void 0:n.domain),npmCdn:(null==e?void 0:e.npmCdn)||(null==n?void 0:n.npmCdn),debug:(null==e?void 0:e.debug)||(null==n?void 0:n.debug)};if("string"!=typeof o.tenantAlias)throw new Error("tenantAlias not provided");return{tenantAlias:o.tenantAlias,domain:"string"==typeof o.domain&&o.domain||r.cE,debug:"boolean"==typeof o.debug&&o.debug||!1,npmCdn:"string"==typeof o.npmCdn&&o.npmCdn||r.eu}}function i(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}function a(e){if(e&&/^[a-z]{2}_(?:[A-Z]{2}|[0-9]{3})$/.test(e))return e}function s(e){if(!i(e))throw new Error("Widget properties must be an object");if(null==e||!e.user)throw new Error("Required properties missing.");return e}function c(e){if(!i(e))throw new Error("Widget properties must be an object");return e}function d(){return window.impactToken||window.squatchToken}function u(){return window.impactConfig||window.squatchConfig}},75:function(e,t,n){"use strict";n.d(t,{Z:function(){return d}});var r=n(861),o=n(572),i=n(227),a=n(657),s=n(936),c=(0,i.debug)("squatch-js:EMBEDwidget");class d extends a.Z{constructor(e,t){super(e),(0,o.Z)(this,"show",this.open),(0,o.Z)(this,"hide",this.close),t&&(this.container=t)}load(){var e=this;return(0,r.Z)((function*(){var t,n,o=e._createFrame(),i=e._findElement();null!==(t=e.context)&&void 0!==t&&t.container&&(i.style.visibility="hidden",i.style.height="0",i.style["overflow-y"]="hidden"),e.container?i.shadowRoot?"IFRAME"===(null===(n=i.shadowRoot.lastChild)||void 0===n?void 0:n.nodeName)?i.shadowRoot.replaceChild(o,i.shadowRoot.lastChild):i.shadowRoot.appendChild(o):i.firstChild?i.replaceChild(o,i.firstChild):i.appendChild(o):i.firstChild&&"#text"!==i.firstChild.nodeName||i.appendChild(o);var{contentWindow:a}=o;if(!a)throw new Error("Frame needs a content window");var d=a.document;d.open(),d.write(e.content),d.write('<script src="'.concat(e.npmCdn,'/resize-observer-polyfill@1.5.x"><\/script>')),d.close(),(0,s.V)(d,(0,r.Z)((function*(){var t=a.squatch||a.widgetIdent;o.height=d.body.scrollHeight;var n=new a.ResizeObserver((e=>{for(var t of e){var{height:n}=t.contentRect;o.height=n}})),r=yield e._findInnerContainer(o);n.observe(r),e._shouldFireLoadEvent()?(e._loadEvent(t),c("loaded")):d&&e._attachLoadEventListener(d,t)})))}))()}open(){var e=this._findFrame();if(!e)return c("no target element to open");if(!e.contentWindow)return c("Frame needs a content window");var t=this._findElement();t.style.visibility="unset",t.style.height="auto",t.style["overflow-y"]="auto",e.contentWindow.document.dispatchEvent(new CustomEvent("sq:refresh"));var n=e.contentWindow.squatch||e.contentWindow.widgetIdent;if(this.context.user)this._loadEvent(n),c("loaded");else{if(!e.contentDocument)return;this._attachLoadEventListener(e.contentDocument,n)}}close(){var e=this._findFrame();if(!e)return c("no target element to close");e.contentDocument&&this._detachLoadEventListener(e.contentDocument);var t=this._findElement();t.style.visibility="hidden",t.style.height="0",t.style["overflow-y"]="hidden",c("Embed widget closed")}_error(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"embed",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return super._error(e,t,n)}_shouldFireLoadEvent(){var e=!this.container,t=this.container instanceof HTMLElement&&(this.container.tagName.startsWith("SQUATCH-")||this.container.tagName.startsWith("IMPACT-"));return!!this.context.user&&(e||t)}}},658:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(861),o=n(572),i=n(227),a=n(936),s=n(657),c=(0,i.debug)("squatch-js:POPUPwidget"),d=0;class u extends s.Z{constructor(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:".squatchpop";super(e),(0,o.Z)(this,"show",this.open),(0,o.Z)(this,"hide",this.close),this.trigger=t,this.container?this.id="squatchModal":(this.id=0===d?"squatchModal":"squatchModal__".concat(d),d+=1),document.head.insertAdjacentHTML("beforeend","<style>#".concat(this.id,"::-webkit-scrollbar { display: none; }</style>"))}_initialiseCTA(){if(this.trigger){var e;try{e=document.querySelector(this.trigger)||document.querySelector(".impactpop"),this.trigger&&!e&&c("No element found with trigger selector",this.trigger)}catch(e){c("Not a valid selector",this.trigger)}e&&(e.onclick=()=>{this.open()})}}_createPopupDialog(){var e=document.createElement("dialog");return e.id=this.id,e.setAttribute("style","width: 100%; max-width: 500px; border: none; padding: 0;"),e.addEventListener("click",(t=>{t.stopPropagation(),t.target===e&&e.close()})),e}load(){var e=this;return(0,r.Z)((function*(){var t,n=e._createFrame();e._initialiseCTA();var r=e.container?e._findElement():document.body,o=r.shadowRoot||r,i=e._createPopupDialog();i.appendChild(n),"DIALOG"===(null===(t=o.lastChild)||void 0===t?void 0:t.nodeName)?o.replaceChild(i,o.lastChild):o.appendChild(i);var{contentWindow:a}=n;if(!a)throw new Error("Frame needs a content window");var s=a.document;s.open(),s.write(e.content),s.write('<script src="'.concat(e.npmCdn,'/resize-observer-polyfill@1.5.x"><\/script>')),s.close(),c("Popup template loaded into iframe"),yield e._setupResizeHandler(n)}))()}_setupResizeHandler(e){var t=this;return(0,r.Z)((function*(){var{contentWindow:n}=e;if(!n)throw new Error("Frame needs a content window");var o=n.document;(0,a.V)(o,(0,r.Z)((function*(){o.body.style.overflowY="hidden",e.height="".concat(o.body.offsetHeight,"px"),new n.ResizeObserver((t=>{for(var n of t){var{top:r,bottom:o}=n.contentRect,i=o+r;e.height=i+"",n.target.style=""}})).observe(yield t._findInnerContainer(e))})))}))()}open(){var e=this.container?this._findElement():document.body,t=(e.shadowRoot||e).querySelector("#".concat(this.id));if(!t)throw new Error("Could not determine container div");t.showModal();var n=this._findFrame();if(!n)throw new Error("Could not find iframe");var{contentWindow:r}=n;if(!r)throw new Error("Squatch.js has an empty iframe");var o=r.document;(0,a.V)(o,(()=>{var e,t=r.squatch||r.widgetIdent;null===(e=n.contentDocument)||void 0===e||e.dispatchEvent(new CustomEvent("sq:refresh")),this.context.user?(this._loadEvent(t),c("Popup opened")):this._attachLoadEventListener(o,t)}))}close(){var e=this._findFrame();null!=e&&e.contentDocument&&this._detachLoadEventListener(e.contentDocument);var t=this.container?this._findElement():document.body,n=(t.shadowRoot||t).querySelector("#".concat(this.id));if(!n)throw new Error("Could not determine container div");n.close(),c("Popup closed")}_clickedOutside(e){var{target:t}=e}_error(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"modal",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return super._error(e,t,n||"body { margin: 0; } .modal { box-shadow: none; border: 0; }")}}},657:function(e,t,n){"use strict";n.d(t,{Z:function(){return l}});var r=n(861),o=n(572),i=n(227),a=n(264),s=n(787);function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach((function(t){(0,o.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var u=(0,i.debug)("squatch-js:widget");class l{constructor(e){var t;(0,o.Z)(this,"loadEventListener",null),u("widget initializing ..."),this.content="error"===e.content?this._error(e.rsCode):e.content,this.type=e.type,this.widgetApi=e.api,this.npmCdn=e.npmCdn,this.analyticsApi=new a.Z({domain:e.domain}),this.context=e.context,this.container=(null===(t=e.context)||void 0===t?void 0:t.container)||e.container}_findElement(){var e;if("string"==typeof this.container?(e=document.querySelector(this.container),u("loading widget with selector",e)):this.container instanceof HTMLElement?(e=this.container,u("loading widget with container",e)):this.container?(e=null,u("container must be an HTMLElement or string",this.container)):(e=document.querySelector("#squatchembed")||document.querySelector(".squatchembed")||document.querySelector("#impactembed")||document.querySelector(".impactembed"),u("loading widget with default selector",e)),!(e instanceof HTMLElement))throw new Error("element with selector '".concat(this.container||"#squatchembed, .squatchembed, #impactembed, or .impactembed","' not found.'"));return e}_createFrame(){var e=document.createElement("iframe");return e.squatchJsApi=this,e.id="squatchFrame",e.width="100%",e.src="about:blank",e.scrolling="no",e.setAttribute("style","border: 0; background-color: none; width: 1px; min-width: 100%;"),e}_findFrame(){var e=this.container?this._findElement():document.body;return(e.shadowRoot||e).querySelector("iframe#squatchFrame")}_detachLoadEventListener(e){this.loadEventListener&&(e.removeEventListener("sq:user-registration",this.loadEventListener),this.loadEventListener=null)}_attachLoadEventListener(e,t){null===this.loadEventListener&&(this.loadEventListener=e=>{this._loadEvent(d(d({},t),{},{userId:e.detail.userId,accountId:e.detail.accountId}))},e.addEventListener("sq:user-registration",this.loadEventListener))}_loadEvent(e){var t;if(e){if(!(0,s.Kn)(e))throw new Error("Widget Load event identity property is not an object");var n;if("programId"in e){if(!(e.tenantAlias&&e.accountId&&e.userId&&e.engagementMedium))throw new Error("Widget Load event missing required properties");n={tenantAlias:e.tenantAlias,externalAccountId:e.accountId,externalUserId:e.userId,engagementMedium:e.engagementMedium,programId:e.programId}}else{var{analytics:r,mode:o}=e;n={tenantAlias:r.attributes.tenant,externalAccountId:r.attributes.accountId,externalUserId:r.attributes.userId,engagementMedium:o.widgetMode}}null===(t=this.analyticsApi.pushAnalyticsLoadEvent(n))||void 0===t||t.then((e=>{u("".concat(n.engagementMedium," loaded event recorded."))})).catch((e=>{u("ERROR: pushAnalyticsLoadEvent() ".concat(e))}))}}_shareEvent(e,t){e&&this.analyticsApi.pushAnalyticsShareClickedEvent({tenantAlias:e.analytics.attributes.tenant,externalAccountId:e.analytics.attributes.accountId,externalUserId:e.analytics.attributes.userId,engagementMedium:e.mode.widgetMode,shareMedium:t}).then((n=>{u("".concat(e.mode.widgetMode," share ").concat(t," event recorded. ").concat(n))})).catch((e=>{u("ERROR: pushAnalyticsShareClickedEvent() ".concat(e))}))}_error(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"modal";return'<!DOCTYPE html>\n \x3c!--[if IE 7]><html class="ie7 oldie" lang="en"><![endif]--\x3e\n \x3c!--[if IE 8]><html class="ie8 oldie" lang="en"><![endif]--\x3e\n \x3c!--[if gt IE 8]>\x3c!--\x3e<html lang="en">\x3c!--<![endif]--\x3e\n <head>\n <link rel="stylesheet" media="all" href="https://fast.ssqt.io/assets/css/widget/errorpage.css">\n <style>\n '.concat(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",'\n </style>\n </head>\n <body>\n\n <div class="squatch-container ').concat(t,'" style="width:100%">\n <div class="errorheader">\n <button type="button" class="close" onclick="window.frameElement.squatchJsApi.close();">×</button>\n <p class="errortitle">Error</p>\n </div>\n <div class="errorbody">\n <div class="sadface"><img src="https://fast.ssqt.io/assets/images/face.png"></div>\n <h4>Our referral program is temporarily unavailable.</h4><br>\n <p>Please reload the page or check back later.</p>\n <p>If the persists please contact our support team.</p>\n <br>\n <br>\n <div class="right-align errtxt">\n Error Code: ').concat(e,"\n </div>\n </div>\n </div>\n </body>\n </html>")}_findInnerContainer(e){return(0,r.Z)((function*(){var{contentWindow:t}=e;if(!t)throw new Error("Squatch.js frame inner frame is empty");for(var n,r,o=t.document,i=null,a=0;a<5&&(void 0,void 0,n=o.getElementsByTagName("sqh-global-container"),r=o.getElementsByClassName("squatch-container"),!(i=n.length>0?n[0]:r.length>0?r[0]:null));a++)yield p(100);return i||o.body}))()}reload(e,t){var{email:n,firstName:r,lastName:o}=e,i=this._findFrame();if(!i)throw new Error("Could not find widget iframe");var a,s=i.contentWindow,c=this.context.engagementMedium||"POPUP";if(!s)throw new Error("Frame needs a content window");if("upsert"===this.context.type){if(!this.context.user)throw new Error("Can't reload without user ids");var d={email:n||null,firstName:r||null,lastName:o||null,id:this.context.user.id,accountId:this.context.user.accountId};a=this.widgetApi.upsertUser({user:d,engagementMedium:c,widgetType:this.type,jwt:t})}else{if("passwordless"!==this.context.type)throw new Error("can't reload an error widget");a=this.widgetApi.render({user:void 0,engagementMedium:c,widgetType:this.type,jwt:void 0})}a.then((e=>{var{template:t}=e;t&&(this.content=t,this.__deprecated__register(i,{email:n,engagementMedium:c},(()=>{this.load(),"POPUP"===c&&this.open()})))})).catch((e=>{var{message:t}=e;u("".concat(t))}))}__deprecated__register(e,t,n){var r=e.contentWindow.document,o=r.createElement("button"),i=r.getElementsByClassName("squatch-register")[0];if(i){o.className="btn btn-primary",o.id="show-stats-btn",o.textContent="REFERRER_WIDGET"===this.type?"Show Stats":"Show Reward";var a="POPUP"===t.engagementMedium?"margin-top: 10px; max-width: 130px; width: 100%;":"margin-top: 10px;";o.setAttribute("style",a),o.onclick=n,i.style.paddingTop="30px",i.innerHTML="<p><strong>".concat(t.email,"</strong><br>Has been successfully registered</p>"),i.appendChild(o)}}}function p(e){return new Promise((t=>{setTimeout(t,e)}))}},452:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(861),o=n(227),i=n(139),a=n(787),s=n(75),c=n(658),d=(0,o.debug)("squatch-js:widgets");class u{constructor(e){var t=(0,a.ww)(e);this.tenantAlias=t.tenantAlias,this.domain=t.domain,this.npmCdn=t.npmCdn,this.api=new i.Z(t)}upsertUser(e){var t=this;return(0,r.Z)((function*(){var n=e,r=(0,a.xW)(n);try{var o=yield t.api.upsertUser(r);return{widget:t._renderWidget(o,r,{type:"upsert",user:r.user,engagementMedium:e.engagementMedium,container:e.container,trigger:e.trigger}),user:o.user}}catch(n){throw d(n),n.apiErrorCode&&t._renderErrorWidget(n,e.engagementMedium),new Error(n)}}))()}render(e){var t=this;return(0,r.Z)((function*(){var n=e,r=(0,a.ZL)(n);try{var o=yield t.api.render(r);return{widget:t._renderWidget(o,r,{type:"passwordless",engagementMedium:r.engagementMedium,container:r.container,trigger:r.trigger}),user:o.user}}catch(e){throw e.apiErrorCode&&t._renderErrorWidget(e,r.engagementMedium),new Error(e)}}))()}autofill(e){var t=this;return(0,r.Z)((function*(){var n=e;if("function"!=typeof n){if("string"!=typeof n)throw new Error("Autofill accepts a string or function");var r,o=document.querySelectorAll(n);if(!(o.length>0))throw d("Element id/class or function missing"),new Error("Element id/class or function missing");r=o[0];try{var i=yield t.api.squatchReferralCookie();r.value=i.codes[0]}catch(e){throw new Error(e)}}else try{n(yield t.api.squatchReferralCookie())}catch(e){throw d("Autofill error",e),new Error(e)}}))()}_renderWidget(e,t,n){var r,o;if(d("Rendering Widget..."),!e)throw new Error("Unable to get a response");var i=!!t.displayOnLoad,a=e.jsOptions||{},s={content:e.template,type:t.widgetType||(null===(r=a.widget)||void 0===r?void 0:r.defaultWidgetType),api:this.api,domain:this.domain,npmCdn:this.npmCdn,context:n};return a.widgetUrlMappings&&a.widgetUrlMappings.forEach((t=>{var n,r;u._matchesUrl(t.url)&&("CONVERSION_WIDGET"!==t.widgetType||null!==(n=e.user)&&void 0!==n&&null!==(r=n.referredBy)&&void 0!==r&&r.code?(i=t.displayOnLoad,d("Display ".concat(t.widgetType," on ").concat(t.url))):d("Don't display ".concat(t.widgetType," when no referral on widget rule match ").concat(t.url)))})),a.fuelTankAutofillUrls&&(d("We found a fuel tank autofill!"),a.fuelTankAutofillUrls.forEach((t=>{var n,r,{url:o,formSelector:i}=t;if(u._matchesUrl(o)&&(d("Fuel Tank URL matches"),null!==(n=e.user)&&void 0!==n&&null!==(r=n.referredBy)&&void 0!==r&&r.code)){var a,s=document.querySelector(i);s?s.value=(null===(a=e.user.referredBy.referredReward)||void 0===a?void 0:a.fuelTankCode)||"":d(new Error("Element with id/class ".concat(i," was not found.")))}}))),"EMBED"===t.engagementMedium?o=this._renderEmbedWidget(s):(o=this._renderPopupWidget(s),i&&o.open()),o}_renderPopupWidget(e){var t=new c.Z(e,e.context.trigger);return t.load(),t}_renderEmbedWidget(e){var t=new s.Z(e,e.context.container);return t.load(),t}_renderErrorWidget(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"POPUP",{apiErrorCode:n,rsCode:r,message:o}=e;d(new Error("".concat(n," (").concat(r,") ").concat(o)));var i={content:"error",rsCode:r,api:this.api,domain:this.domain,npmCdn:this.npmCdn,type:"ERROR_WIDGET",context:{type:"error"}};"EMBED"===t?new s.Z(i).load():"POPUP"===t&&new c.Z(i).load()}static _matchesUrl(e){return!!window.location.href.match(new RegExp(e))}}},22:function(e,t,n){"use strict";n.d(t,{U:function(){return w},n:function(){return v}});var r=n(861),o=n(572),i=n(227),a=n.n(i),s=n(264),c=n(139),d=n(998),u=(0,i.debug)("squatch-js:decodeUserJwt"),l=n(787),p=n(75),h=n(658),f=n(822),g=a()("squatch-js:DeclarativeWidget");class m extends HTMLElement{constructor(){super(),(0,o.Z)(this,"_setWidget",((e,t)=>{var n,r={api:this.widgetApi,content:e,context:{type:t.type,user:t.user,container:this.container||void 0,engagementMedium:this.type},type:this.widgetType,domain:(null===(n=this.config)||void 0===n?void 0:n.domain)||f.cE,npmCdn:f.eu,container:this};if("EMBED"===this.type)return new p.Z(r);var o=this.firstChild?null:void 0;return new h.Z(r,o)})),(0,o.Z)(this,"setErrorWidget",(e=>{var t,n={api:this.widgetApi,content:"error",context:{type:"error",container:this.container||void 0},type:"ERROR_WIDGET",domain:(null===(t=this.config)||void 0===t?void 0:t.domain)||f.cE,npmCdn:f.eu,container:this};if("EMBED"===this.type)return new p.Z(n);var r=this.firstChild?null:void 0;return new h.Z(n,r)})),(0,o.Z)(this,"reload",this.renderWidget),(0,o.Z)(this,"show",this.open),(0,o.Z)(this,"hide",this.close),this.attachShadow({mode:"open"}).innerHTML="<style>:host { display: block; }</style><slot></slot>",this.config=(0,l.iE)(),this.token=(0,l.LP)(),this.tenant=window.squatchTenant,this.container=this}_setupApis(e){var t,n;if(!this.tenant)throw new Error("tenantAlias not provided");this.widgetApi=new c.Z({tenantAlias:(null==e?void 0:e.tenantAlias)||this.tenant,domain:(null==e?void 0:e.domain)||(null===(t=this.config)||void 0===t?void 0:t.domain)||f.cE}),this.analyticsApi=new s.Z({domain:(null==e?void 0:e.domain)||(null===(n=this.config)||void 0===n?void 0:n.domain)||f.cE})}renderPasswordlessVariant(){var e=this;return(0,r.Z)((function*(){return e._setupApis(),g("Rendering as an Instant Access widget"),yield e.widgetApi.render({engagementMedium:e.type,widgetType:e.widgetType,locale:e.locale}).then((t=>e._setWidget(t.template,{type:"passwordless"}))).catch(e.setErrorWidget)}))()}renderUserUpsertVariant(){var e=this;return(0,r.Z)((function*(){e._setupApis();var t=function(e){try{var t,n=e.split(".")[1];if(void 0===n)return null;var r=(0,d.FO)(n);return null===(t=JSON.parse(r))||void 0===t?void 0:t.user}catch(e){return u(e),null}}(e.token);return t?(g("Rendering as a Verified widget"),yield e.widgetApi.upsertUser({user:t,locale:e.locale,engagementMedium:e.type,widgetType:e.widgetType,jwt:e.token}).then((n=>e._setWidget(n.template,{type:"upsert",user:t}))).catch(e.setErrorWidget)):e.setErrorWidget(Error("No user object in token."))}))()}getWidgetInstance(){var e=this;return(0,r.Z)((function*(){var t;if(e.widgetType=e.getAttribute("widget")||void 0,e.locale=e.getAttribute("locale")||e.locale,!e.widgetType)throw new Error("No widget has been specified");return t=e.token?yield e.renderUserUpsertVariant():yield e.renderPasswordlessVariant(),e.widgetInstance=t,e.widgetInstance&&e.dispatchEvent(new CustomEvent("sq:widget-loaded")),t}))()}renderWidget(){var e=this;return(0,r.Z)((function*(){yield e.getWidgetInstance(),yield e.widgetInstance.load()}))()}open(){if(!this.widgetInstance)throw new Error("Widget has not loaded yet");this.widgetInstance.open()}close(){if(!this.widgetInstance)throw new Error("Widget has not loaded yet");this.widgetInstance.close()}}class w extends m{constructor(){super(),this.type="EMBED",this.loaded=!1}static get observedAttributes(){return["widget","locale"]}attributeChangedCallback(e,t,n){if(t!==n&&this.loaded)switch(e){case"locale":case"widget":this.connectedCallback()}}connectedCallback(){var e=this;return(0,r.Z)((function*(){var t,n;e.loaded=!0,e.container=e.getAttribute("container"),yield e.renderWidget();var r=null===(t=e.shadowRoot&&Array.from(e.shadowRoot.children))||void 0===t?void 0:t.find((e=>"SLOT"===e.tagName));r&&(null===(n=e.shadowRoot)||void 0===n||n.removeChild(r)),null!==e.getAttribute("open")&&e.open()}))()}}class v extends m{constructor(){super(),this.type="POPUP",this.loaded=!1,this.addEventListener("click",(e=>{e.stopPropagation(),this.open()}))}static get observedAttributes(){return["widget","locale"]}attributeChangedCallback(e,t,n){if(t!==n&&this.loaded)switch(e){case"locale":case"widget":this.connectedCallback()}}connectedCallback(){var e=this;return(0,r.Z)((function*(){e.loaded=!0,e.container=e.getAttribute("container"),yield e.renderWidget(),null!==e.getAttribute("open")&&e.open()}))()}}window.customElements.get("squatch-embed")||window.customElements.define("squatch-embed",class extends w{}),window.customElements.get("impact-embed")||window.customElements.define("impact-embed",class extends w{}),window.customElements.get("squatch-popup")||window.customElements.define("squatch-popup",class extends v{}),window.customElements.get("impact-popup")||window.customElements.define("impact-popup",class extends v{})},227:function(e,t,n){"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}t.log=function(){var e;return"object"===("undefined"==typeof console?"undefined":r(console))&&console.log&&(e=console).log.apply(e,arguments)},t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),this.useColors){var n="color: "+this.color;t.splice(1,0,n,"color: inherit");var r=0,o=0;t[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(r++,"%c"===e&&(o=r))})),t.splice(o,0,n)}},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){var e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.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"],e.exports=n(447)(t),e.exports.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},447:function(e,t,n){"use strict";e.exports=function(e){function t(e){for(var t=0,n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return r.colors[Math.abs(t)%r.colors.length]}function r(e){var n;function a(){if(a.enabled){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];var i=a,s=Number(new Date),c=s-(n||s);i.diff=c,i.prev=n,i.curr=s,n=s,t[0]=r.coerce(t[0]),"string"!=typeof t[0]&&t.unshift("%O");var d=0;t[0]=t[0].replace(/%([a-zA-Z%])/g,(function(e,n){if("%%"===e)return e;d++;var o=r.formatters[n];if("function"==typeof o){var a=t[d];e=o.call(i,a),t.splice(d,1),d--}return e})),r.formatArgs.call(i,t),(i.log||r.log).apply(i,t)}}return a.namespace=e,a.enabled=r.enabled(e),a.useColors=r.useColors(),a.color=t(e),a.destroy=o,a.extend=i,"function"==typeof r.init&&r.init(a),r.instances.push(a),a}function o(){var e=r.instances.indexOf(this);return-1!==e&&(r.instances.splice(e,1),!0)}function i(e,t){return r(this.namespace+(void 0===t?":":t)+e)}return r.debug=r,r.default=r,r.coerce=function(e){return e instanceof Error?e.stack||e.message:e},r.disable=function(){r.enable("")},r.enable=function(e){var t;r.save(e),r.names=[],r.skips=[];var n=("string"==typeof e?e:"").split(/[\s,]+/),o=n.length;for(t=0;t<o;t++)n[t]&&("-"===(e=n[t].replace(/\*/g,".*?"))[0]?r.skips.push(new RegExp("^"+e.substr(1)+"$")):r.names.push(new RegExp("^"+e+"$")));for(t=0;t<r.instances.length;t++){var i=r.instances[t];i.enabled=r.enabled(i.namespace)}},r.enabled=function(e){if("*"===e[e.length-1])return!0;var t,n;for(t=0,n=r.skips.length;t<n;t++)if(r.skips[t].test(e))return!1;for(t=0,n=r.names.length;t<n;t++)if(r.names[t].test(e))return!0;return!1},r.humanize=n(824),Object.keys(e).forEach((function(t){r[t]=e[t]})),r.instances=[],r.names=[],r.skips=[],r.formatters={},r.selectColor=t,r.enable(r.load()),r}},824:function(e){var t=1e3,n=60*t,r=60*n,o=24*r;function i(e,t,n,r){var o=t>=1.5*n;return Math.round(e/n)+" "+r+(o?"s":"")}e.exports=function(e,a){a=a||{};var s,c,d=typeof e;if("string"===d&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var i=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(i){var a=parseFloat(i[1]);switch((i[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*a;case"weeks":case"week":case"w":return 6048e5*a;case"days":case"day":case"d":return a*o;case"hours":case"hour":case"hrs":case"hr":case"h":return a*r;case"minutes":case"minute":case"mins":case"min":case"m":return a*n;case"seconds":case"second":case"secs":case"sec":case"s":return a*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}(e);if("number"===d&&isFinite(e))return a.long?(s=e,(c=Math.abs(s))>=o?i(s,c,o,"day"):c>=r?i(s,c,r,"hour"):c>=n?i(s,c,n,"minute"):c>=t?i(s,c,t,"second"):s+" ms"):function(e){var i=Math.abs(e);return i>=o?Math.round(e/o)+"d":i>=r?Math.round(e/r)+"h":i>=n?Math.round(e/n)+"m":i>=t?Math.round(e/t)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},861:function(e,t,n){"use strict";function r(e,t,n,r,o,i,a){try{var s=e[i](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function o(e){return function(){var t=this,n=arguments;return new Promise((function(o,i){var a=e.apply(t,n);function s(e){r(a,o,i,s,c,"next",e)}function c(e){r(a,o,i,s,c,"throw",e)}s(void 0)}))}}n.d(t,{Z:function(){return o}})},572:function(e,t,n){"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function o(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==r(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,"string");if("object"!==r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===r(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}n.d(t,{Z:function(){return o}})},955:function(e,t,n){"use strict";function r(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}n.d(t,{Z:function(){return o}});var o=function e(t,n){function o(e,o,i){if("undefined"!=typeof document){"number"==typeof(i=r({},n,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var a="";for(var s in i)i[s]&&(a+="; "+s,!0!==i[s]&&(a+="="+i[s].split(";")[0]));return document.cookie=e+"="+t.write(o,e)+a}}return Object.create({set:o,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],r={},o=0;o<n.length;o++){var i=n[o].split("="),a=i.slice(1).join("=");try{var s=decodeURIComponent(i[0]);if(r[s]=t.read(a,s),e===s)break}catch(e){}}return e?r[e]:r}},remove:function(e,t){o(e,"",r({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,r({},this.attributes,t))},withConverter:function(t){return e(r({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"})}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return function(){"use strict";n.r(r),n.d(r,{DeclarativeEmbedWidget:function(){return p.U},DeclarativePopupWidget:function(){return p.n},EmbedWidget:function(){return o.Z},PopupWidget:function(){return i.Z},WidgetApi:function(){return a.Z},Widgets:function(){return t.Z},_auto:function(){return A},api:function(){return E},autofill:function(){return _},events:function(){return j},help:function(){return w.R},init:function(){return P},pushCookie:function(){return q},ready:function(){return I},widget:function(){return x},widgets:function(){return O}});var e=n(227),t=n(452),o=n(75),i=n(658),a=n(139),s=n(745),c=n(762),d=n(787),u=n(998),l=n(8),p=n(22),h=n(518),f={};for(var g in h)["default","Widgets","EmbedWidget","PopupWidget","DeclarativeEmbedWidget","DeclarativePopupWidget","WidgetApi","api","widgets","events","widget","_auto","init","ready","autofill","pushCookie"].indexOf(g)<0&&(f[g]=function(e){return h[e]}.bind(0,g));n.d(r,f);var m,w=n(510),v=(0,e.debug)("squatch-js"),y=null,b=null,C=null;function E(){return y||P({}),y}function O(){return b||P({}),b}function j(){return C||P({}),C}function x(e){var t;return null===(t=O())||void 0===t?void 0:t.render(e)}function A(e){var t=(0,l.G)(e);if(t){var n,{squatchConfig:r,widgetConfig:o}=t;return P(r),null===(n=O())||void 0===n?void 0:n.render(o)}}function P(n){var r=n,o=(0,d.ww)(r);o.tenantAlias.match("^test")||o.debug?e.debug.enable("squatch-js*"):e.debug.disable(),v("initializing ..."),y=new a.Z(o),b=new t.Z(o),C=new s.Z(o),v("Widget API instance",y),v("Widgets instance",b),v("Events API instance",C)}function I(e){e()}function _(e){O().autofill(e)}function q(){(0,u.bT)()}"undefined"==typeof document||window.SaaSquatchDoNotAutoDrop||q(),null!==(m=window.squatch)&&void 0!==m&&m.init&&v("Squatchjs is being loaded more than once. This may lead to multiple load events being sent, duplicated widgets, and inaccurate analytics."),"undefined"!=typeof document&&(0,c.Z)()}(),r}()}));
|
package/dist/utils/decode.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const decodeb64: (input: any) => string;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|