@saasquatch/squatch-js 2.6.0-8 → 2.6.0
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/.github/workflows/size-limit.yml +14 -14
- package/.github/workflows/static.yml +89 -89
- package/CHANGELOG.md +388 -326
- package/LICENSE +20 -20
- package/README.md +259 -208
- package/babel.config.js +7 -7
- package/cucumber.js +45 -45
- package/demo/sandbox.ts +124 -124
- package/demo/toolbar.tsx +526 -526
- package/dist/api/WidgetApi.d.ts +1 -0
- package/dist/async.d.ts +2 -0
- package/dist/globals.d.ts +4 -0
- package/dist/squatch.esm.js +80 -49
- package/dist/squatch.esm.js.map +1 -1
- package/dist/squatch.js +80 -49
- package/dist/squatch.js.map +1 -1
- package/dist/squatch.min.js +1 -1
- package/dist/squatch.min.js.br +0 -0
- package/dist/squatch.min.js.map +1 -1
- package/dist/squatch.modern.js +1 -1
- package/dist/squatch.modern.js.map +1 -1
- package/dist/stats.html +1 -1
- package/dist/utils/decodeJwt.d.ts +1 -0
- package/dist/utils/validate.d.ts +0 -2
- package/dist/widgets/PopupWidget.d.ts +2 -2
- package/dist/widgets/declarative/DeclarativeWidget.d.ts +5 -0
- package/jest.config.ts +200 -200
- package/package.json +123 -123
- package/tsconfig.json +23 -23
- package/coverage/clover.xml +0 -865
- package/coverage/coverage-final.json +0 -20
- package/coverage/lcov-report/DeclarativeWidget.ts.html +0 -790
- package/coverage/lcov-report/WidgetApi.ts.html +0 -631
- package/coverage/lcov-report/Widgets.ts.html +0 -1105
- package/coverage/lcov-report/api/AnalyticsApi.ts.html +0 -304
- package/coverage/lcov-report/api/EventsApi.ts.html +0 -352
- package/coverage/lcov-report/api/WidgetApi.ts.html +0 -658
- package/coverage/lcov-report/api/graphql.ts.html +0 -130
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/coverage/lcov-report/squatch.ts.html +0 -721
- package/coverage/lcov-report/utils/cookieUtils.ts.html +0 -415
- package/coverage/lcov-report/utils/decodeUserJwt.ts.html +0 -133
- package/coverage/lcov-report/utils/domready.ts.html +0 -160
- package/coverage/lcov-report/utils/io.ts.html +0 -400
- package/coverage/lcov-report/utils/utmUtils.ts.html +0 -277
- package/coverage/lcov-report/utils/validate.ts.html +0 -268
- package/coverage/lcov-report/validate.ts.html +0 -268
- package/coverage/lcov-report/widgets/EmbedWidget.ts.html +0 -481
- package/coverage/lcov-report/widgets/PopupWidget.ts.html +0 -685
- package/coverage/lcov-report/widgets/Widget.ts.html +0 -1159
- package/coverage/lcov-report/widgets/Widgets.ts.html +0 -1102
- package/coverage/lcov-report/widgets/declarative/DeclarativeWidget.ts.html +0 -790
- package/coverage/lcov-report/widgets/declarative/DeclarativeWidgets.ts.html +0 -388
- package/coverage/lcov.info +0 -1593
- package/stats.json +0 -1
package/dist/squatch.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
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 i}});var r=n(615),o=n(787);class i{constructor(e){var t,n=function(e){if(!(0,o.Kn)(e))throw new Error("'options' should be an object");return e}(e);this.domain=(null==n?void 0:n.domain)||(null===(t=(0,o.iE)())||void 0===t?void 0:t.domain)||o.cE}pushAnalyticsLoadEvent(e){if(e.externalUserId&&e.externalAccountId){var t=encodeURIComponent(e.tenantAlias),n=encodeURIComponent(e.externalAccountId),o=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(o,"&engagementMedium=").concat(i).concat(a),c=this.domain+s;return(0,r.Mx)(c,JSON.stringify({}))}}pushAnalyticsShareClickedEvent(e){var t=encodeURIComponent(e.tenantAlias),n=encodeURIComponent(e.externalAccountId),o=encodeURIComponent(e.externalUserId),i=encodeURIComponent(e.engagementMedium),a=encodeURIComponent(e.shareMedium),s="/a/".concat(t,"/widgets/analytics/shared?externalAccountId=").concat(n,"&externalUserId=").concat(o,"&engagementMedium=").concat(i,"&shareMedium=").concat(a),c=this.domain+s;return(0,r.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(572),o=n(861),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,r.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){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=["engagementMedium=".concat(encodeURIComponent(n)),t&&"widgetType=".concat(encodeURIComponent(t)),r&&"locale=".concat(encodeURIComponent(r))].filter((e=>!!e));return"?".concat(o.join("&"))}({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,r=(0,s.ZL)(n),{widgetType:i,engagementMedium:c="POPUP",jwt:d,user:u}=r,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=r.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,o.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,o.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";function r(){var e="impactTBD",t=window[e]?e:"squatch",n=window[t]||null,r=window["_"+t]||null;if(n&&r){var o=r.ready||[];setTimeout((()=>window.impactTBD=window.squatch),0),o.forEach((e=>setTimeout((()=>e()),0))),setTimeout((()=>{window.squatch._auto()}),0),window["_"+t]=void 0;try{delete window["_"+t]}catch(e){throw e}}}n.d(t,{Z:function(){return r}})},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}})},518:function(){},998:function(e,t,n){"use strict";n.d(t,{F:function(){return l},b: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){return atob(e.replace(/_/g,"/").replace(/-/g,"+"))}function p(e){return btoa(e).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.F)(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 a},LP:function(){return u},Qb:function(){return s},ZL:function(){return d},cE:function(){return r},eu:function(){return o},iE:function(){return l},ww:function(){return i},xW:function(){return c}});var r="https://app.referralsaasquatch.com",o="https://fast.ssqt.io/npm";function i(e){if("object"!=typeof e)throw new Error("config must be an object");var t=window.squatchTenant,n=l(),i={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 i.tenantAlias)throw new Error("tenantAlias not provided");return{tenantAlias:i.tenantAlias,domain:"string"==typeof i.domain&&i.domain||r,debug:"boolean"==typeof i.debug&&i.debug||!1,npmCdn:"string"==typeof i.npmCdn&&i.npmCdn||o}}function a(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}function s(e){if(e&&/^[a-z]{2}_(?:[A-Z]{2}|[0-9]{3})$/.test(e))return e}function c(e){if(!a(e))throw new Error("Widget properties must be an object");if(null==e||!e.user)throw new Error("Required properties missing.");return e}function d(e){if(!a(e))throw new Error("Widget properties must be an object");return e}function u(){return window.impactToken||window.squatchToken}function l(){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=e._createFrame(),o=e._findElement();e.container?o.shadowRoot?"IFRAME"===(null===(t=o.shadowRoot.lastChild)||void 0===t?void 0:t.nodeName)?o.shadowRoot.replaceChild(n,o.shadowRoot.lastChild):o.shadowRoot.appendChild(n):o.firstChild?o.replaceChild(n,o.firstChild):o.appendChild(n):o.firstChild&&"#text"!==o.firstChild.nodeName||o.appendChild(n);var{contentWindow:i}=n;if(!i)throw new Error("Frame needs a content window");var a=i.document;a.open(),a.write(e.content),a.write('<script src="'.concat(e.npmCdn,'/resize-observer-polyfill@1.5.x"><\/script>')),a.close(),(0,s.V)(a,(0,r.Z)((function*(){var t=i.squatch||i.widgetIdent;n.height=a.body.scrollHeight;var r=new i.ResizeObserver((e=>{for(var t of e){var{height:r}=t.contentRect;n.height=r}})),o=yield e._findInnerContainer(n);r.observe(o),e._shouldFireLoadEvent()&&(e._loadEvent(t),c("loaded"))})))}))()}open(){var e,t,n,r=this._findFrame();if(!r)return c("no target element to open");var o=this._findElement();o.style.visibility="unset",o.style.height="auto",o.style["overflow-y"]="auto",null==r||null===(e=r.contentDocument)||void 0===e||e.dispatchEvent(new CustomEvent("sq:refresh"));var i=(null==r||null===(t=r.contentWindow)||void 0===t?void 0:t.squatch)||(null==r||null===(n=r.contentWindow)||void 0===n?void 0:n.widgetIdent);this.context.user&&(this._loadEvent(i),c("loaded"))}close(){if(!this._findFrame())return c("no target element to close");var e=this._findElement();e.style.visibility="hidden",e.style.height="0",e.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),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,t=this._createFrame();this._initialiseCTA();var n=this.container?this._findElement():document.body,r=n.shadowRoot||n,o=this._createPopupDialog();o.appendChild(t),"DIALOG"===(null===(e=r.lastChild)||void 0===e?void 0:e.nodeName)?r.replaceChild(o,r.lastChild):r.appendChild(o);var{contentWindow:i}=t;if(!i)throw new Error("Frame needs a content window");var a=i.document;a.open(),a.write(this.content),a.write('<script src="'.concat(this.npmCdn,'/resize-observer-polyfill@1.5.x"><\/script>')),a.close(),c("Popup template loaded into iframe"),this._setupResizeHandler(t)}_setupResizeHandler(e){var t=this,{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"))}))}close(){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.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 c}});var r=n(861),o=n(227),i=n(264),a=n(787),s=(0,o.debug)("squatch-js:widget");class c{constructor(e){s("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 i.Z({domain:e.domain}),this.context=e.context,this.container=e.context.container}_findElement(){var e;if("string"==typeof this.container?(e=document.querySelector(this.container),s("loading widget with selector",e)):this.container instanceof HTMLElement?(e=this.container,s("loading widget with container",e)):this.container?(e=null,s("container must be an HTMLElement or string",this.container)):(e=document.querySelector("#squatchembed")||document.querySelector(".squatchembed"),s("loading widget with default selector",e)),!(e instanceof HTMLElement))throw new Error("element with selector '".concat(this.container||"#squatchembed or .squatchembed","' 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")}_loadEvent(e){var t;if(e){if(!(0,a.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=>{s("".concat(n.engagementMedium," loaded event recorded."))})).catch((e=>{s("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=>{s("".concat(e.mode.widgetMode," share ").concat(t," event recorded. ").concat(n))})).catch((e=>{s("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 d(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,c=i.contentWindow,d=this.context.engagementMedium||"POPUP";if(!c)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 u={email:n||null,firstName:r||null,lastName:o||null,id:this.context.user.id,accountId:this.context.user.accountId};a=this.widgetApi.upsertUser({user:u,engagementMedium:d,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:d,widgetType:this.type,jwt:void 0})}a.then((e=>{var{template:t}=e;t&&(this.content=t,this.__deprecated__register(i,{email:n,engagementMedium:d},(()=>{this.load(),"POPUP"===d&&this.open()})))})).catch((e=>{var{message:t}=e;s("".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 d(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 m},n:function(){return w}});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=a()("squatch-js:DeclarativeWidget");class g 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||this,engagementMedium:this.type},type:this.widgetType,domain:(null===(n=this.config)||void 0===n?void 0:n.domain)||l.cE,npmCdn:l.eu};return"EMBED"===this.type?new p.Z(r,r.context.container):new h.Z(r,this.firstChild?null:void 0)})),(0,o.Z)(this,"setErrorWidget",(e=>{var t,n={api:this.widgetApi,content:"error",context:{type:"error",container:this.container||this},type:"ERROR_WIDGET",domain:(null===(t=this.config)||void 0===t?void 0:t.domain)||l.cE,npmCdn:l.eu};return"EMBED"===this.type?new p.Z(n,n.context.container):new h.Z(n,this.firstChild?null:void 0)})),(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: contents; }</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)||l.cE}),this.analyticsApi=new s.Z({domain:(null==e?void 0:e.domain)||(null===(n=this.config)||void 0===n?void 0:n.domain)||l.cE})}renderPasswordlessVariant(){var e=this;return(0,r.Z)((function*(){return e._setupApis(),f("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.F)(n);return null===(t=JSON.parse(r))||void 0===t?void 0:t.user}catch(e){return u(e),null}}(e.token);return t?(f("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,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 m extends g{constructor(){super(),this.type="EMBED"}static get observedAttributes(){return["widget","locale"]}attributeChangedCallback(e,t,n){if(t!==n&&t)switch(e){case"locale":case"widget":this.connectedCallback()}}connectedCallback(){var e=this;return(0,r.Z)((function*(){var t,n;e.container=e.getAttribute("container")||e,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))}))()}}class w extends g{constructor(){super(),this.type="POPUP",this.addEventListener("click",(e=>{e.stopPropagation(),this.open()}))}static get observedAttributes(){return["widget","locale"]}attributeChangedCallback(e,t,n){if(t!==n&&t)switch(e){case"locale":case"widget":this.connectedCallback()}}connectedCallback(){var e=this;return(0,r.Z)((function*(){e.container=e.getAttribute("container")||e,yield e.renderWidget(),null!==e.getAttribute("open")&&e.open()}))()}}window.customElements.define("squatch-embed",class extends m{}),window.customElements.define("impact-embed",class extends m{}),window.customElements.define("squatch-popup",class extends w{}),window.customElements.define("impact-popup",class extends w{})},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 C},autofill:function(){return P},events:function(){return O},help:function(){return m.R},init:function(){return j},pushCookie:function(){return _},ready:function(){return I},widget:function(){return x},widgets:function(){return E}});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=n(510),w=(0,e.debug)("squatch-js"),v=null,y=null,b=null;function C(){return v||j({}),v}function E(){return y||j({}),y}function O(){return b||j({}),b}function x(e){var t;return null===(t=E())||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 j(r),null===(n=E())||void 0===n?void 0:n.render(o)}}function j(n){var r=n,o=(0,d.ww)(r);o.tenantAlias.match("^test")||o.debug?e.debug.enable("squatch-js*"):e.debug.disable(),w("initializing ..."),v=new a.Z(o),y=new t.Z(o),b=new s.Z(o),w("Widget API instance",v),w("Widgets instance",y),w("Events API instance",b)}function I(e){e()}function P(e){E().autofill(e)}function _(){(0,u.b)()}"undefined"==typeof document||window.SaaSquatchDoNotAutoDrop||_(),"undefined"!=typeof document&&(0,c.Z)()}(),r}()}));
|
|
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,{F:function(){return l},b: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){return atob(e.replace(/_/g,"/").replace(/-/g,"+"))}function p(e){return btoa(e).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.F)(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,console.log("RESIZE")}})),r=yield e._findInnerContainer(o);n.observe(r),e._shouldFireLoadEvent()&&(e._loadEvent(t),c("loaded"))})))}))()}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;this.context.user&&(this._loadEvent(n),c("loaded"))}close(){if(!this._findFrame())return c("no target element to close");var e=this._findElement();e.style.visibility="hidden",e.style.height="0",e.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"))}))}close(){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.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 c}});var r=n(861),o=n(227),i=n(264),a=n(787),s=(0,o.debug)("squatch-js:widget");class c{constructor(e){var t;s("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 i.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),s("loading widget with selector",e)):this.container instanceof HTMLElement?(e=this.container,s("loading widget with container",e)):this.container?(e=null,s("container must be an HTMLElement or string",this.container)):(e=document.querySelector("#squatchembed")||document.querySelector(".squatchembed")||document.querySelector("#impactembed")||document.querySelector(".impactembed"),s("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")}_loadEvent(e){var t;if(e){if(!(0,a.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=>{s("".concat(n.engagementMedium," loaded event recorded."))})).catch((e=>{s("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=>{s("".concat(e.mode.widgetMode," share ").concat(t," event recorded. ").concat(n))})).catch((e=>{s("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 d(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,c=i.contentWindow,d=this.context.engagementMedium||"POPUP";if(!c)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 u={email:n||null,firstName:r||null,lastName:o||null,id:this.context.user.id,accountId:this.context.user.accountId};a=this.widgetApi.upsertUser({user:u,engagementMedium:d,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:d,widgetType:this.type,jwt:void 0})}a.then((e=>{var{template:t}=e;t&&(this.content=t,this.__deprecated__register(i,{email:n,engagementMedium:d},(()=>{this.load(),"POPUP"===d&&this.open()})))})).catch((e=>{var{message:t}=e;s("".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 d(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.F)(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.define("squatch-embed",class extends w{}),window.customElements.define("impact-embed",class extends w{}),window.customElements.define("squatch-popup",class extends v{}),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 C},autofill:function(){return P},events:function(){return O},help:function(){return m.R},init:function(){return j},pushCookie:function(){return _},ready:function(){return I},widget:function(){return x},widgets:function(){return E}});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=n(510),w=(0,e.debug)("squatch-js"),v=null,y=null,b=null;function C(){return v||j({}),v}function E(){return y||j({}),y}function O(){return b||j({}),b}function x(e){var t;return null===(t=E())||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 j(r),null===(n=E())||void 0===n?void 0:n.render(o)}}function j(n){var r=n,o=(0,d.ww)(r);o.tenantAlias.match("^test")||o.debug?e.debug.enable("squatch-js*"):e.debug.disable(),w("initializing ..."),v=new a.Z(o),y=new t.Z(o),b=new s.Z(o),w("Widget API instance",v),w("Widgets instance",y),w("Events API instance",b)}function I(e){e()}function P(e){E().autofill(e)}function _(){(0,u.b)()}"undefined"==typeof document||window.SaaSquatchDoNotAutoDrop||_(),"undefined"!=typeof document&&(0,c.Z)()}(),r}()}));
|
|
Binary file
|
package/dist/squatch.min.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"squatch.min.js","sources":["../node_modules/@ungap/url-search-params/esm/index.js"],"sourcesContent":["/*! (c) Andrea Giammarchi - ISC */\nvar self = this || /* istanbul ignore next */ {};\ntry {\n (function (URLSearchParams, plus) {\n if (\n new URLSearchParams('q=%2B').get('q') !== plus ||\n new URLSearchParams({q: plus}).get('q') !== plus ||\n new URLSearchParams([['q', plus]]).get('q') !== plus ||\n new URLSearchParams('q=\\n').toString() !== 'q=%0A' ||\n new URLSearchParams({q: ' &'}).toString() !== 'q=+%26' ||\n new URLSearchParams({q: '%zx'}).toString() !== 'q=%25zx'\n )\n throw URLSearchParams;\n self.URLSearchParams = URLSearchParams;\n }(URLSearchParams, '+'));\n} catch(URLSearchParams) {\n (function (Object, String, isArray) {'use strict';\n var create = Object.create;\n var defineProperty = Object.defineProperty;\n var find = /[!'\\(\\)~]|%20|%00/g;\n var findPercentSign = /%(?![0-9a-fA-F]{2})/g;\n var plus = /\\+/g;\n var replace = {\n '!': '%21',\n \"'\": '%27',\n '(': '%28',\n ')': '%29',\n '~': '%7E',\n '%20': '+',\n '%00': '\\x00'\n };\n var proto = {\n append: function (key, value) {\n appendTo(this._ungap, key, value);\n },\n delete: function (key) {\n delete this._ungap[key];\n },\n get: function (key) {\n return this.has(key) ? this._ungap[key][0] : null;\n },\n getAll: function (key) {\n return this.has(key) ? this._ungap[key].slice(0) : [];\n },\n has: function (key) {\n return key in this._ungap;\n },\n set: function (key, value) {\n this._ungap[key] = [String(value)];\n },\n forEach: function (callback, thisArg) {\n var self = this;\n for (var key in self._ungap)\n self._ungap[key].forEach(invoke, key);\n function invoke(value) {\n callback.call(thisArg, value, String(key), self);\n }\n },\n toJSON: function () {\n return {};\n },\n toString: function () {\n var query = [];\n for (var key in this._ungap) {\n var encoded = encode(key);\n for (var\n i = 0,\n value = this._ungap[key];\n i < value.length; i++\n ) {\n query.push(encoded + '=' + encode(value[i]));\n }\n }\n return query.join('&');\n }\n };\n for (var key in proto)\n defineProperty(URLSearchParams.prototype, key, {\n configurable: true,\n writable: true,\n value: proto[key]\n });\n self.URLSearchParams = URLSearchParams;\n function URLSearchParams(query) {\n var dict = create(null);\n defineProperty(this, '_ungap', {value: dict});\n switch (true) {\n case !query:\n break;\n case typeof query === 'string':\n if (query.charAt(0) === '?') {\n query = query.slice(1);\n }\n for (var\n pairs = query.split('&'),\n i = 0,\n length = pairs.length; i < length; i++\n ) {\n var value = pairs[i];\n var index = value.indexOf('=');\n if (-1 < index) {\n appendTo(\n dict,\n decode(value.slice(0, index)),\n decode(value.slice(index + 1))\n );\n } else if (value.length){\n appendTo(\n dict,\n decode(value),\n ''\n );\n }\n }\n break;\n case isArray(query):\n for (var\n i = 0,\n length = query.length; i < length; i++\n ) {\n var value = query[i];\n appendTo(dict, value[0], value[1]);\n }\n break;\n case 'forEach' in query:\n query.forEach(addEach, dict);\n break;\n default:\n for (var key in query)\n appendTo(dict, key, query[key]);\n }\n }\n\n function addEach(value, key) {\n appendTo(this, key, value);\n }\n\n function appendTo(dict, key, value) {\n var res = isArray(value) ? value.join(',') : value;\n if (key in dict)\n dict[key].push(res);\n else\n dict[key] = [res];\n }\n\n function decode(str) {\n return decodeURIComponent(str.replace(findPercentSign, '%25').replace(plus, ' '));\n }\n\n function encode(str) {\n return encodeURIComponent(str).replace(find, replacer);\n }\n\n function replacer(match) {\n return replace[match];\n }\n\n }(Object, String, Array.isArray));\n}\n\n(function (URLSearchParamsProto) {\n\n var iterable = false;\n try { iterable = !!Symbol.iterator; } catch (o_O) {}\n\n /* istanbul ignore else */\n if (!('forEach' in URLSearchParamsProto)) {\n URLSearchParamsProto.forEach = function forEach(callback, thisArg) {\n var self = this;\n var names = Object.create(null);\n this.toString()\n .replace(/=[\\s\\S]*?(?:&|$)/g, '=')\n .split('=')\n .forEach(function (name) {\n if (!name.length || name in names)\n return;\n (names[name] = self.getAll(name)).forEach(function(value) {\n callback.call(thisArg, value, name, self);\n });\n });\n };\n }\n\n /* istanbul ignore else */\n if (!('keys' in URLSearchParamsProto)) {\n URLSearchParamsProto.keys = function keys() {\n return iterator(this, function(value, key) { this.push(key); });\n };\n }\n\n /* istanbul ignore else */\n if (!('values' in URLSearchParamsProto)) {\n URLSearchParamsProto.values = function values() {\n return iterator(this, function(value, key) { this.push(value); });\n };\n }\n\n /* istanbul ignore else */\n if (!('entries' in URLSearchParamsProto)) {\n URLSearchParamsProto.entries = function entries() {\n return iterator(this, function(value, key) { this.push([key, value]); });\n };\n }\n\n /* istanbul ignore else */\n if (iterable && !(Symbol.iterator in URLSearchParamsProto)) {\n URLSearchParamsProto[Symbol.iterator] = URLSearchParamsProto.entries;\n }\n\n /* istanbul ignore else */\n if (!('sort' in URLSearchParamsProto)) {\n URLSearchParamsProto.sort = function sort() {\n var\n entries = this.entries(),\n entry = entries.next(),\n done = entry.done,\n keys = [],\n values = Object.create(null),\n i, key, value\n ;\n while (!done) {\n value = entry.value;\n key = value[0];\n keys.push(key);\n if (!(key in values)) {\n values[key] = [];\n }\n values[key].push(value[1]);\n entry = entries.next();\n done = entry.done;\n }\n // not the champion in efficiency\n // but these two bits just do the job\n keys.sort();\n for (i = 0; i < keys.length; i++) {\n this.delete(keys[i]);\n }\n for (i = 0; i < keys.length; i++) {\n key = keys[i];\n this.append(key, values[key].shift());\n }\n };\n }\n\n function iterator(self, callback) {\n var items = [];\n self.forEach(callback, items);\n /* istanbul ignore next */\n return iterable ?\n items[Symbol.iterator]() :\n {\n next: function() {\n var value = items.shift();\n return {done: value === void 0, value: value};\n }\n };\n }\n\n /* istanbul ignore next */\n (function (Object) {\n var\n dP = Object.defineProperty,\n gOPD = Object.getOwnPropertyDescriptor,\n createSearchParamsPollute = function (search) {\n function append(name, value) {\n URLSearchParamsProto.append.call(this, name, value);\n name = this.toString();\n search.set.call(this._usp, name ? ('?' + name) : '');\n }\n function del(name) {\n URLSearchParamsProto.delete.call(this, name);\n name = this.toString();\n search.set.call(this._usp, name ? ('?' + name) : '');\n }\n function set(name, value) {\n URLSearchParamsProto.set.call(this, name, value);\n name = this.toString();\n search.set.call(this._usp, name ? ('?' + name) : '');\n }\n return function (sp, value) {\n sp.append = append;\n sp.delete = del;\n sp.set = set;\n return dP(sp, '_usp', {\n configurable: true,\n writable: true,\n value: value\n });\n };\n },\n createSearchParamsCreate = function (polluteSearchParams) {\n return function (obj, sp) {\n dP(\n obj, '_searchParams', {\n configurable: true,\n writable: true,\n value: polluteSearchParams(sp, obj)\n }\n );\n return sp;\n };\n },\n updateSearchParams = function (sp) {\n var append = sp.append;\n sp.append = URLSearchParamsProto.append;\n URLSearchParams.call(sp, sp._usp.search.slice(1));\n sp.append = append;\n },\n verifySearchParams = function (obj, Class) {\n if (!(obj instanceof Class)) throw new TypeError(\n \"'searchParams' accessed on an object that \" +\n \"does not implement interface \" + Class.name\n );\n },\n upgradeClass = function (Class) {\n var\n ClassProto = Class.prototype,\n searchParams = gOPD(ClassProto, 'searchParams'),\n href = gOPD(ClassProto, 'href'),\n search = gOPD(ClassProto, 'search'),\n createSearchParams\n ;\n if (!searchParams && search && search.set) {\n createSearchParams = createSearchParamsCreate(\n createSearchParamsPollute(search)\n );\n Object.defineProperties(\n ClassProto,\n {\n href: {\n get: function () {\n return href.get.call(this);\n },\n set: function (value) {\n var sp = this._searchParams;\n href.set.call(this, value);\n if (sp) updateSearchParams(sp);\n }\n },\n search: {\n get: function () {\n return search.get.call(this);\n },\n set: function (value) {\n var sp = this._searchParams;\n search.set.call(this, value);\n if (sp) updateSearchParams(sp);\n }\n },\n searchParams: {\n get: function () {\n verifySearchParams(this, Class);\n return this._searchParams || createSearchParams(\n this,\n new URLSearchParams(this.search.slice(1))\n );\n },\n set: function (sp) {\n verifySearchParams(this, Class);\n createSearchParams(this, sp);\n }\n }\n }\n );\n }\n }\n ;\n try {\n upgradeClass(HTMLAnchorElement);\n if (/^function|object$/.test(typeof URL) && URL.prototype)\n upgradeClass(URL);\n } catch (meh) {}\n }(Object));\n\n}(self.URLSearchParams.prototype, Object));\nexport default self.URLSearchParams;\n"],"names":["self","URLSearchParams","plus","get","q","toString","Object","String","isArray","create","defineProperty","find","findPercentSign","replace","!","'","(",")","~","%20","%00","proto","append","key","value","appendTo","this","_ungap","delete","has","getAll","slice","set","forEach","callback","thisArg","invoke","call","toJSON","query","encoded","encode","i","length","push","join","prototype","configurable","writable","dict","charAt","pairs","split","index","indexOf","decode","addEach","res","str","decodeURIComponent","encodeURIComponent","replacer","match","Array","URLSearchParamsProto","iterable","Symbol","iterator","o_O","items","next","shift","done","names","name","keys","values","entries","sort","entry","dP","gOPD","getOwnPropertyDescriptor","updateSearchParams","sp","_usp","search","verifySearchParams","obj","Class","TypeError","upgradeClass","createSearchParams","polluteSearchParams","ClassProto","searchParams","href","del","createSearchParamsPollute","defineProperties","_searchParams","HTMLAnchorElement","test","URL","meh"],"mappings":"+2xBACIA,EAA0C,GAC9C,KACG,SAAUC,EAAiBC,GAC1B,GACE,IAAID,EAAgB,SAASE,IAAI,OAASD,GAC1C,IAAID,EAAgB,CAACG,EAAGF,IAAOC,IAAI,OAASD,GAC5C,IAAID,EAAgB,CAAC,CAAC,IAAKC,KAAQC,IAAI,OAASD,GACL,UAA3C,IAAID,EAAgB,QAAQI,YACkB,WAA9C,IAAIJ,EAAgB,CAACG,EAAG,OAAOC,YACgB,YAA/C,IAAIJ,EAAgB,CAACG,EAAG,QAAQC,WAEhC,MAAMJ,EACRD,EAAKC,gBAAkBA,EAVzB,CAWEA,gBAAiB,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AhHX,CAiHElG,QApNJ,CAsNEN,EAAKC,gBAAgB6C,iBACR9C,EAAKC"}
|
|
1
|
+
{"version":3,"file":"squatch.min.js","sources":["../node_modules/@ungap/url-search-params/esm/index.js"],"sourcesContent":["/*! (c) Andrea Giammarchi - ISC */\nvar self = this || /* istanbul ignore next */ {};\ntry {\n (function (URLSearchParams, plus) {\n if (\n new URLSearchParams('q=%2B').get('q') !== plus ||\n new URLSearchParams({q: plus}).get('q') !== plus ||\n new URLSearchParams([['q', plus]]).get('q') !== plus ||\n new URLSearchParams('q=\\n').toString() !== 'q=%0A' ||\n new URLSearchParams({q: ' &'}).toString() !== 'q=+%26' ||\n new URLSearchParams({q: '%zx'}).toString() !== 'q=%25zx'\n )\n throw URLSearchParams;\n self.URLSearchParams = URLSearchParams;\n }(URLSearchParams, '+'));\n} catch(URLSearchParams) {\n (function (Object, String, isArray) {'use strict';\n var create = Object.create;\n var defineProperty = Object.defineProperty;\n var find = /[!'\\(\\)~]|%20|%00/g;\n var findPercentSign = /%(?![0-9a-fA-F]{2})/g;\n var plus = /\\+/g;\n var replace = {\n '!': '%21',\n \"'\": '%27',\n '(': '%28',\n ')': '%29',\n '~': '%7E',\n '%20': '+',\n '%00': '\\x00'\n };\n var proto = {\n append: function (key, value) {\n appendTo(this._ungap, key, value);\n },\n delete: function (key) {\n delete this._ungap[key];\n },\n get: function (key) {\n return this.has(key) ? this._ungap[key][0] : null;\n },\n getAll: function (key) {\n return this.has(key) ? this._ungap[key].slice(0) : [];\n },\n has: function (key) {\n return key in this._ungap;\n },\n set: function (key, value) {\n this._ungap[key] = [String(value)];\n },\n forEach: function (callback, thisArg) {\n var self = this;\n for (var key in self._ungap)\n self._ungap[key].forEach(invoke, key);\n function invoke(value) {\n callback.call(thisArg, value, String(key), self);\n }\n },\n toJSON: function () {\n return {};\n },\n toString: function () {\n var query = [];\n for (var key in this._ungap) {\n var encoded = encode(key);\n for (var\n i = 0,\n value = this._ungap[key];\n i < value.length; i++\n ) {\n query.push(encoded + '=' + encode(value[i]));\n }\n }\n return query.join('&');\n }\n };\n for (var key in proto)\n defineProperty(URLSearchParams.prototype, key, {\n configurable: true,\n writable: true,\n value: proto[key]\n });\n self.URLSearchParams = URLSearchParams;\n function URLSearchParams(query) {\n var dict = create(null);\n defineProperty(this, '_ungap', {value: dict});\n switch (true) {\n case !query:\n break;\n case typeof query === 'string':\n if (query.charAt(0) === '?') {\n query = query.slice(1);\n }\n for (var\n pairs = query.split('&'),\n i = 0,\n length = pairs.length; i < length; i++\n ) {\n var value = pairs[i];\n var index = value.indexOf('=');\n if (-1 < index) {\n appendTo(\n dict,\n decode(value.slice(0, index)),\n decode(value.slice(index + 1))\n );\n } else if (value.length){\n appendTo(\n dict,\n decode(value),\n ''\n );\n }\n }\n break;\n case isArray(query):\n for (var\n i = 0,\n length = query.length; i < length; i++\n ) {\n var value = query[i];\n appendTo(dict, value[0], value[1]);\n }\n break;\n case 'forEach' in query:\n query.forEach(addEach, dict);\n break;\n default:\n for (var key in query)\n appendTo(dict, key, query[key]);\n }\n }\n\n function addEach(value, key) {\n appendTo(this, key, value);\n }\n\n function appendTo(dict, key, value) {\n var res = isArray(value) ? value.join(',') : value;\n if (key in dict)\n dict[key].push(res);\n else\n dict[key] = [res];\n }\n\n function decode(str) {\n return decodeURIComponent(str.replace(findPercentSign, '%25').replace(plus, ' '));\n }\n\n function encode(str) {\n return encodeURIComponent(str).replace(find, replacer);\n }\n\n function replacer(match) {\n return replace[match];\n }\n\n }(Object, String, Array.isArray));\n}\n\n(function (URLSearchParamsProto) {\n\n var iterable = false;\n try { iterable = !!Symbol.iterator; } catch (o_O) {}\n\n /* istanbul ignore else */\n if (!('forEach' in URLSearchParamsProto)) {\n URLSearchParamsProto.forEach = function forEach(callback, thisArg) {\n var self = this;\n var names = Object.create(null);\n this.toString()\n .replace(/=[\\s\\S]*?(?:&|$)/g, '=')\n .split('=')\n .forEach(function (name) {\n if (!name.length || name in names)\n return;\n (names[name] = self.getAll(name)).forEach(function(value) {\n callback.call(thisArg, value, name, self);\n });\n });\n };\n }\n\n /* istanbul ignore else */\n if (!('keys' in URLSearchParamsProto)) {\n URLSearchParamsProto.keys = function keys() {\n return iterator(this, function(value, key) { this.push(key); });\n };\n }\n\n /* istanbul ignore else */\n if (!('values' in URLSearchParamsProto)) {\n URLSearchParamsProto.values = function values() {\n return iterator(this, function(value, key) { this.push(value); });\n };\n }\n\n /* istanbul ignore else */\n if (!('entries' in URLSearchParamsProto)) {\n URLSearchParamsProto.entries = function entries() {\n return iterator(this, function(value, key) { this.push([key, value]); });\n };\n }\n\n /* istanbul ignore else */\n if (iterable && !(Symbol.iterator in URLSearchParamsProto)) {\n URLSearchParamsProto[Symbol.iterator] = URLSearchParamsProto.entries;\n }\n\n /* istanbul ignore else */\n if (!('sort' in URLSearchParamsProto)) {\n URLSearchParamsProto.sort = function sort() {\n var\n entries = this.entries(),\n entry = entries.next(),\n done = entry.done,\n keys = [],\n values = Object.create(null),\n i, key, value\n ;\n while (!done) {\n value = entry.value;\n key = value[0];\n keys.push(key);\n if (!(key in values)) {\n values[key] = [];\n }\n values[key].push(value[1]);\n entry = entries.next();\n done = entry.done;\n }\n // not the champion in efficiency\n // but these two bits just do the job\n keys.sort();\n for (i = 0; i < keys.length; i++) {\n this.delete(keys[i]);\n }\n for (i = 0; i < keys.length; i++) {\n key = keys[i];\n this.append(key, values[key].shift());\n }\n };\n }\n\n function iterator(self, callback) {\n var items = [];\n self.forEach(callback, items);\n /* istanbul ignore next */\n return iterable ?\n items[Symbol.iterator]() :\n {\n next: function() {\n var value = items.shift();\n return {done: value === void 0, value: value};\n }\n };\n }\n\n /* istanbul ignore next */\n (function (Object) {\n var\n dP = Object.defineProperty,\n gOPD = Object.getOwnPropertyDescriptor,\n createSearchParamsPollute = function (search) {\n function append(name, value) {\n URLSearchParamsProto.append.call(this, name, value);\n name = this.toString();\n search.set.call(this._usp, name ? ('?' + name) : '');\n }\n function del(name) {\n URLSearchParamsProto.delete.call(this, name);\n name = this.toString();\n search.set.call(this._usp, name ? ('?' + name) : '');\n }\n function set(name, value) {\n URLSearchParamsProto.set.call(this, name, value);\n name = this.toString();\n search.set.call(this._usp, name ? ('?' + name) : '');\n }\n return function (sp, value) {\n sp.append = append;\n sp.delete = del;\n sp.set = set;\n return dP(sp, '_usp', {\n configurable: true,\n writable: true,\n value: value\n });\n };\n },\n createSearchParamsCreate = function (polluteSearchParams) {\n return function (obj, sp) {\n dP(\n obj, '_searchParams', {\n configurable: true,\n writable: true,\n value: polluteSearchParams(sp, obj)\n }\n );\n return sp;\n };\n },\n updateSearchParams = function (sp) {\n var append = sp.append;\n sp.append = URLSearchParamsProto.append;\n URLSearchParams.call(sp, sp._usp.search.slice(1));\n sp.append = append;\n },\n verifySearchParams = function (obj, Class) {\n if (!(obj instanceof Class)) throw new TypeError(\n \"'searchParams' accessed on an object that \" +\n \"does not implement interface \" + Class.name\n );\n },\n upgradeClass = function (Class) {\n var\n ClassProto = Class.prototype,\n searchParams = gOPD(ClassProto, 'searchParams'),\n href = gOPD(ClassProto, 'href'),\n search = gOPD(ClassProto, 'search'),\n createSearchParams\n ;\n if (!searchParams && search && search.set) {\n createSearchParams = createSearchParamsCreate(\n createSearchParamsPollute(search)\n );\n Object.defineProperties(\n ClassProto,\n {\n href: {\n get: function () {\n return href.get.call(this);\n },\n set: function (value) {\n var sp = this._searchParams;\n href.set.call(this, value);\n if (sp) updateSearchParams(sp);\n }\n },\n search: {\n get: function () {\n return search.get.call(this);\n },\n set: function (value) {\n var sp = this._searchParams;\n search.set.call(this, value);\n if (sp) updateSearchParams(sp);\n }\n },\n searchParams: {\n get: function () {\n verifySearchParams(this, Class);\n return this._searchParams || createSearchParams(\n this,\n new URLSearchParams(this.search.slice(1))\n );\n },\n set: function (sp) {\n verifySearchParams(this, Class);\n createSearchParams(this, sp);\n }\n }\n }\n );\n }\n }\n ;\n try {\n upgradeClass(HTMLAnchorElement);\n if (/^function|object$/.test(typeof URL) && URL.prototype)\n upgradeClass(URL);\n } catch (meh) {}\n }(Object));\n\n}(self.URLSearchParams.prototype, Object));\nexport default self.URLSearchParams;\n"],"names":["self","URLSearchParams","plus","get","q","toString","Object","String","isArray","create","defineProperty","find","findPercentSign","replace","!","'","(",")","~","%20","%00","proto","append","key","value","appendTo","this","_ungap","delete","has","getAll","slice","set","forEach","callback","thisArg","invoke","call","toJSON","query","encoded","encode","i","length","push","join","prototype","configurable","writable","dict","charAt","pairs","split","index","indexOf","decode","addEach","res","str","decodeURIComponent","encodeURIComponent","replacer","match","Array","URLSearchParamsProto","iterable","Symbol","iterator","o_O","items","next","shift","done","names","name","keys","values","entries","sort","entry","dP","gOPD","getOwnPropertyDescriptor","updateSearchParams","sp","_usp","search","verifySearchParams","obj","Class","TypeError","upgradeClass","createSearchParams","polluteSearchParams","ClassProto","searchParams","href","del","createSearchParamsPollute","defineProperties","_searchParams","HTMLAnchorElement","test","URL","meh"],"mappings":"+gyBACIA,EAA0C,GAC9C,KACG,SAAUC,EAAiBC,GAC1B,GACE,IAAID,EAAgB,SAASE,IAAI,OAASD,GAC1C,IAAID,EAAgB,CAACG,EAAGF,IAAOC,IAAI,OAASD,GAC5C,IAAID,EAAgB,CAAC,CAAC,IAAKC,KAAQC,IAAI,OAASD,GACL,UAA3C,IAAID,EAAgB,QAAQI,YACkB,WAA9C,IAAIJ,EAAgB,CAACG,EAAG,OAAOC,YACgB,YAA/C,IAAIJ,EAAgB,CAACG,EAAG,QAAQC,WAEhC,MAAMJ,EACRD,EAAKC,gBAAkBA,EAVzB,CAWEA,gBAAiB,KACnB,MAAMA,IACL,SAAUK,EAAQC,EAAQC,GACzB,IAAIC,EAASH,EAAOG,OAChBC,EAAiBJ,EAAOI,eACxBC,EAAO,qBACPC,EAAkB,uBAClBV,EAAO,MACPW,EAAU,CACZC,IAAK,MACLC,IAAK,MACLC,IAAK,MACLC,IAAK,MACLC,IAAK,MACLC,MAAO,IACPC,MAAO,MAELC,EAAQ,CACVC,OAAQ,SAAUC,EAAKC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9D,OAASA,EACZ8D,EAAGxD,OAASqE,EACZb,EAAGpD,IAAMA,EACFgD,EAAGI,EAAI,OAAQ,CACpBrC,cAAc,EACdC,UAAU,EACVxB,MAAOA,KAsCP0E,CAA0BZ,GAD5BM,EAhCK,SAAUJ,EAAKJ,GAQpB,OAPAJ,EACEQ,EAAK,gBAAiB,CACpBzC,cAAc,EACdC,UAAU,EACVxB,MAAOqE,EAAoBT,EAAII,KAG5BJ,GA2BP9E,EAAO6F,iBACLL,EACA,CACEE,KAAM,CACJ7F,IAAK,WACH,OAAO6F,EAAK7F,IAAIkC,KAAKX,OAEvBM,IAAK,SAAUR,GACb,IAAI4D,EAAK1D,KAAK0E,cACdJ,EAAKhE,IAAIK,KAAKX,KAAMF,GAChB4D,GAAID,EAAmBC,KAG/BE,OAAQ,CACNnF,IAAK,WACH,OAAOmF,EAAOnF,IAAIkC,KAAKX,OAEzBM,IAAK,SAAUR,GACb,IAAI4D,EAAK1D,KAAK0E,cACdd,EAAOtD,IAAIK,KAAKX,KAAMF,GAClB4D,GAAID,EAAmBC,KAG/BW,aAAc,CACZ5F,IAAK,WAEH,OADAoF,EAAmB7D,KAAM+D,GAClB/D,KAAK0E,eAAiBR,EAC3BlE,KACA,IAAIzB,gBAAgByB,KAAK4D,OAAOvD,MAAM,MAG1CC,IAAK,SAAUoD,GACbG,EAAmB7D,KAAM+D,GACzBG,EAAmBlE,KAAM0D,SAQvC,IACEO,EAAaU,mBACT,oBAAoBC,YAAYC,MAAQA,IAAIzD,WAC9C6C,EAAaY,KACf,MAAOC,KAhHX,CAiHElG,QApNJ,CAsNEN,EAAKC,gBAAgB6C,iBACR9C,EAAKC"}
|
package/dist/squatch.modern.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as e from"debug";import t from"debug";import*as n from"eventbusjs";import*as i from"superagent";import r from"js-cookie";function o(e,t=""){const n={Accept:"application/json","Content-Type":"application/json"};return t&&(n["X-SaaSquatch-User-Token"]=t),c(i.get(e).withCredentials().set(n)).then(e=>{return!e.headers["content-type"]||(t=e.headers["content-type"].toLowerCase(),"number"!=typeof n&&(n=0),n+"application/json".length>t.length||-1===t.indexOf("application/json",n))?e.text:JSON.parse(e.text);var t,n},({response:e})=>{throw JSON.parse(e.text)})}function s(e,t,n){const r={Accept:"application/json","Content-Type":"application/json"};return n&&(r["X-SaaSquatch-User-Token"]=n),c(i.post(e).send(t).set(r)).then(({text:e})=>e?JSON.parse(e):e,e=>{let t;try{t=JSON.parse(e.response.text)}catch(t){throw e||t}throw t})}function a(e,t,n){const r={Accept:"application/json","Content-Type":"application/json","X-SaaSquatch-Referrer":window?window.location.href:""};return n&&(r["X-SaaSquatch-User-Token"]=n),c(i.put(e).withCredentials().send(t).set(r)).then(({text:e})=>e?JSON.parse(e):e,e=>{let t;try{t=JSON.parse(e.response.text)}catch(t){throw e||t}throw t})}function c(e){return new Promise((t,n)=>{e.on("error",n),e.end((e,i)=>{e?n(e):t(i)})})}function d(e,t){if(!l(e))return!1;const n=Object.keys(e);return Array.isArray(t)?t.reduce((e,t)=>e&&n.indexOf(t)>=0,!0):e.hasOwnProperty(t)}function l(e){return"object"==typeof e}function u(e,...t){return t.forEach(n=>{if(!d(e,t))throw new Error(n+" is required")}),!0}function h(e){if(!l(e))throw new Error("config must be an object");if(!d(e,"tenantAlias")||"string"!=typeof e.tenantAlias)throw new Error("tenantAlias not provided");return{tenantAlias:e.tenantAlias,domain:d(e,"domain")&&"string"==typeof e.domain&&e.domain||"https://app.referralsaasquatch.com",debug:d(e,"debug")&&"boolean"==typeof e.debug&&e.debug||!1,npmCdn:d(e,"npmCdn")&&"string"==typeof e.npmCdn&&e.npmCdn||"https://fast.ssqt.io/npm"}}function p(e){if(!l(e))throw new Error("Widget properties must be an object");return u(e,"user"),e}class m{constructor(e){const t=h(e);this.tenantAlias=t.tenantAlias,this.domain=t.domain,this.npmCdn=t.npmCdn}cookieUser(e){const{widgetType:t,engagementMedium:n="POPUP",jwt:i,user:r}=e,o=encodeURIComponent(this.tenantAlias),s=g({widgetType:t,engagementMedium:n});return a(this.domain+`/api/v1/${o}/widget/user/cookie_user${s}`,JSON.stringify(r||{}),i)}upsertUser(e){const t=p(e),{widgetType:n,engagementMedium:i="POPUP",jwt:o,user:s}=t,c=encodeURIComponent(this.tenantAlias),d=encodeURIComponent(s.accountId),l=encodeURIComponent(s.id),u=g({widgetType:n,engagementMedium:i}),h=this.domain+`/api/v1/${c}/widget/account/${d}/user/${l}/upsert${u}`,m=r.get("_saasquatch");return m&&(s.cookies=m),a(h,JSON.stringify(s),o)}render(e){const t=p(e),{widgetType:n,engagementMedium:i="POPUP",jwt:r,user:s}=t,a=encodeURIComponent(this.tenantAlias),c=encodeURIComponent(s.accountId),d=encodeURIComponent(s.id),l=g({widgetType:n,engagementMedium:i});return o(this.domain+`/api/v1/${a}/widget/account/${c}/user/${d}/render${l}`,r)}invite({emailList:e=[],userId:t,accountId:n,tenantAlias:i}){const r=encodeURIComponent(i);return s(this.domain+`/api/v1/${r}/mail/referralinvite`,JSON.stringify({sendingAccountId:n,sendingUserId:t,recipients:e}))}squatchReferralCookie(){const e=encodeURIComponent(this.tenantAlias),t=r.get("_saasquatch"),n=t?`?cookies=${encodeURIComponent(t)}`:"";return o(`${this.domain}/a/${e}/widgets/squatchcookiejson${n}`)}}function g({widgetType:e,engagementMedium:t}){return(e?`?widgetType=${encodeURIComponent(e)}`:"")+`${e?"&":"?"}engagementMedium=${encodeURIComponent(t)}`}class f{constructor(e){const t=e;this.domain=d(t,"domain")&&"string"==typeof t.domain?t.domain:"https://app.referralsaasquatch.com"}pushAnalyticsLoadEvent(e){const t=encodeURIComponent(e.tenantAlias),n=encodeURIComponent(e.externalAccountId),i=encodeURIComponent(e.externalUserId),r=encodeURIComponent(e.engagementMedium),o=e.programId?`&programId=${encodeURIComponent(e.programId)}`:"";return s(this.domain+`/a/${t}/widgets/analytics/loaded?externalAccountId=${n}&externalUserId=${i}&engagementMedium=${r}${o}`,JSON.stringify({}))}pushAnalyticsShareClickedEvent(e){const t=encodeURIComponent(e.tenantAlias),n=encodeURIComponent(e.externalAccountId),i=encodeURIComponent(e.externalUserId),r=encodeURIComponent(e.engagementMedium),o=encodeURIComponent(e.shareMedium);return s(this.domain+`/a/${t}/widgets/analytics/shared?externalAccountId=${n}&externalUserId=${i}&engagementMedium=${r}&shareMedium=${o}`,JSON.stringify({}))}}const w=t("squatch-js:widget");class y{constructor(e){w("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 f({domain:e.domain}),this.frame=document.createElement("iframe"),this.frame.squatchJsApi=this,this.frame.width="100%",this.frame.scrolling="no",this.frame.setAttribute("style","border: 0; background-color: none; width: 1px; min-width: 100%;"),this.context=e.context}_loadEvent(e){if(!e)return;if(!l(e))throw new Error("Widget Load event identity property is not an object");let t;if(d(e,"programId")){if(!d(e,["tenantAlias","accountId","userId","engagementMedium"]))throw new Error("Widget Load event missing required properties");t={tenantAlias:e.tenantAlias,externalAccountId:e.accountId,externalUserId:e.userId,engagementMedium:e.engagementMedium,programId:e.programId}}else{const{analytics:n,mode:i}=e;t={tenantAlias:n.attributes.tenant,externalAccountId:n.attributes.accountId,externalUserId:n.attributes.userId,engagementMedium:i.widgetMode}}this.analyticsApi.pushAnalyticsLoadEvent(t).then(e=>{w(`${t.engagementMedium} loaded event recorded.`)}).catch(e=>{w(new Error(`pushAnalyticsLoadEvent() ${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=>{w(`${e.mode.widgetMode} share ${t} event recorded. ${n}`)}).catch(e=>{w(new Error(`pushAnalyticsLoadEvent() ${e}`))})}_inviteContacts(e,t){e&&this.widgetApi.invite({tenantAlias:e.analytics.attributes.tenant,accountId:e.analytics.attributes.accountId,userId:e.analytics.attributes.userId,emailList:t}).then(e=>{w(`Sent email invites to share ${t}. ${e}`)}).catch(e=>{w(new Error(`invite() ${e}`))})}_error(e,t="modal",n=""){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 ${n}\n </style>\n </head>\n <body>\n\n <div class="squatch-container ${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: ${e}\n </div>\n </div>\n </div>\n </body>\n </html>`}async _findInnerContainer(){const{contentWindow:e}=this.frame;if(!e)throw new Error("Squatch.js frame inner frame is empty");const t=e.document;function n(){const e=t.getElementsByTagName("sqh-global-container"),n=t.getElementsByClassName("squatch-container");return e.length>0?e[0]:n.length>0?n[0]:null}let i=null;for(let e=0;e<5&&(i=n(),!i);e++)await v(100);return i||t.body}reload({email:e,firstName:t,lastName:n},i){const r=this.frame.contentWindow,o=this.context.engagementMedium||"POPUP";if(!r)throw new Error("Frame needs a content window");const s=r.document;let a;if("upsert"===this.context.type)a=this.widgetApi.upsertUser({user:{email:e||null,firstName:t||null,lastName:n||null,id:this.context.user.id,accountId:this.context.user.accountId},engagementMedium:o,widgetType:this.type,jwt:i});else{if("cookie"!==this.context.type)throw new Error("can't reload an error widget");a=this.widgetApi.cookieUser({user:{email:e||null,firstName:t||null,lastName:n||null},engagementMedium:o,widgetType:this.type,jwt:i})}a.then(({template:t})=>{if(t){this.content=t;const n=s.createElement("button"),i=s.getElementsByClassName("squatch-register")[0];i&&(n.className="btn btn-primary",n.id="show-stats-btn",n.textContent="REFERRER_WIDGET"===this.type?"Show Stats":"Show Reward",n.setAttribute("style","POPUP"===o?"margin-top: 10px; max-width: 130px; width: 100%;":"margin-top: 10px;"),n.onclick=()=>{this.load(),"POPUP"===o&&this.open()},i.style.paddingTop="30px",i.innerHTML=`<p><strong>${e}</strong><br>Has been successfully registered</p>`,i.appendChild(n))}}).catch(({message:e})=>{w(`${e}`)})}}function v(e){return new Promise(function(t,n){setTimeout(function(){t()},e)})}function b(e,t){let n,i=[],r=e,o="DOMContentLoaded",s=(r.documentElement.doScroll?/^loaded|^c/:/^loaded|^i|^c/).test(r.readyState);return s||r.addEventListener(o,n=()=>{for(r.removeEventListener(o,n),s=!0;n=i.shift();)n()}),s?setTimeout(t,0):i.push(t)}const E=t("squatch-js:EMBEDwidget");class C extends y{constructor(e,t){let n;if(super(e),"string"==typeof t?(n=document.querySelector(t),E("loading widget with selector",n)):t instanceof HTMLElement?(n=t,E("loading widget with container",n)):t?(n=null,E("container must be an HTMLElement or string",t)):(n=document.querySelector("#squatchembed")||document.querySelector(".squatchembed"),E("loading widget with default selector",n)),!(n instanceof HTMLElement))throw new Error(`element with selector '${t}' not found.'`);this.element=n}async load(){var e=this;this.context.container?(this.element.style.visibility="hidden",this.element.style.height="0",this.element.style["overflow-y"]="hidden",this.element.firstChild?this.element.replaceChild(this.frame,this.element.firstChild):this.element.appendChild(this.frame)):this.element.firstChild&&"#text"!==this.element.firstChild.nodeName||this.element.appendChild(this.frame);const{contentWindow:t}=this.frame;if(!t)throw new Error("Frame needs a content window");const n=t.document;n.open(),n.write(this.content),n.write(`<script src="${this.npmCdn}/resize-observer-polyfill@1.5.x"><\/script>`),n.close(),b(n,async function(){const i=t.squatch||t.widgetIdent,r=n.getElementById("cta");if(r){if(!r.parentNode)throw new Error("ctaElement needs a parentNode");r.parentNode.removeChild(r)}e.frame.height=n.body.scrollHeight,new t.ResizeObserver(t=>{for(const n of t){const{height:t}=n.contentRect;e.frame.height=t}}).observe(await e._findInnerContainer()),e.context.container||(e._loadEvent(i),E("loaded"))})}open(){var e,t,n,i,r,o;if(!this.frame)return E("no target element to open");this.element.style.visibility="unset",this.element.style.height="auto",this.element.style["overflow-y"]="auto",null==(e=this.frame)||null==(t=e.contentDocument)||t.dispatchEvent(new CustomEvent("sq:refresh"));const s=(null==(n=this.frame)||null==(i=n.contentWindow)?void 0:i.squatch)||(null==(r=this.frame)||null==(o=r.contentWindow)?void 0:o.widgetIdent);this._loadEvent(s),E("loaded")}close(){if(!this.frame)return E("no target element to close");this.element.style.visibility="hidden",this.element.style.height="0",this.element.style["overflow-y"]="hidden",E("Embed widget closed")}_error(e,t="embed",n=""){return super._error(e,t,n)}}const A=t("squatch-js:POPUPwidget");class I extends y{constructor(e,t=".squatchpop"){super(e);try{this.triggerElement=document.querySelector(t),t&&!this.triggerElement&&A("No element found with trigger selector",t)}catch(e){A("Not a valid selector",t)}this.triggerElement&&(this.triggerElement.onclick=()=>{this.open()}),this.triggerWhenCTA=document.querySelector(".squatchpop"),"#cta"===t&&this.triggerWhenCTA&&(this.triggerWhenCTA.onclick=()=>{this.open()}),this.popupdiv=document.createElement("div"),this.popupdiv.id="squatchModal",this.popupdiv.setAttribute("style","display: none; position: fixed; z-index: 1; padding-top: 5%; left: 0; top: -2000px; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.4);"),this.popupcontent=document.createElement("div"),this.popupcontent.setAttribute("style","margin: auto; width: 80%; max-width: 500px; position: relative;"),this.popupdiv.onclick=e=>{this._clickedOutside(e)}}load(){this.popupdiv.appendChild(this.popupcontent),document.body.appendChild(this.popupdiv),this.popupcontent.appendChild(this.frame);const e=this.frame.contentWindow.document;e.open(),e.write(this.content),e.write(`<script src="${this.npmCdn}/resize-observer-polyfill@1.5.x"><\/script>`),e.close(),A("Popup template loaded into iframe"),this._setupResizeHandler()}_setupResizeHandler(){var e=this;const t=this.popupdiv,n=this.frame,{contentWindow:i}=n;if(!i)throw new Error("Frame needs a content window");const r=i.document;b(r,async function(){r.body.style.overflowY="hidden",t.style.visibility="hidden",t.style.display="block",n.height=`${r.body.offsetHeight}px`,new i.ResizeObserver(e=>{for(const i of e){const{top:e,bottom:r}=i.contentRect;n.height=r+e+"",i.target.style="",t.style.paddingTop=window.innerHeight>Number(n.height)?(window.innerHeight-Number(n.height))/2+"px":"5px"}}).observe(await e._findInnerContainer())})}open(){const e=this.popupdiv,t=this.frame,{contentWindow:n}=t;if(!n)throw new Error("Squatch.js has an empty iframe");const i=n.document;b(i,()=>{var r;const o=n.squatch||n.widgetIdent,s=i.getElementById("cta");s&&s.parentNode.removeChild(s),e.style.visibility="visible",e.style.top="0px",null==(r=t.contentDocument)||r.dispatchEvent(new CustomEvent("sq:refresh")),this._loadEvent(o),A("Popup opened")})}close(){this.popupdiv.style.visibility="hidden",this.popupdiv.style.top="-2000px",A("Popup closed")}_clickedOutside({target:e}){e===this.popupdiv&&this.close()}_error(e,t="modal",n=""){return super._error(e,t,n||"body { margin: 0; } .modal { box-shadow: none; border: 0; }")}}const x=e("squatch-js:CTAwidget");class U extends I{constructor(e,t){x("CTA constructor");const n=document.createElement("div");n.id="cta",document.body.appendChild(n),super(e,"#cta"),t.side||t.position||(t.position="bottom",t.side="right"),"middle"===t.position?(this.position="top: 45%;",this.side="center"===t.side?"right: 45%;":`${t.side}: -10px;`):(this.position=`${t.position}: -10px;`,this.side="center"===t.side?"right: 45%;":`${t.side}: 20px;`),this.positionClass=t.position,this.ctaFrame=document.createElement("iframe"),this.ctaFrame.squatchJsApi=this,this.ctaFrame.scrolling="no",this.ctaFrame.setAttribute("style",`border:0; background-color:transparent; position:fixed; display:none;${this.side}${this.position}`),document.body.appendChild(this.ctaFrame),x("ctaframe appended to body")}load(){if(super.load(),!this.frame.contentWindow)throw new Error("frame requires a contentWindow");const e=this.frame.contentWindow.document,t=this.ctaFrame,n=this.positionClass;b(e,()=>{const i=e.getElementById("cta");if(i){if(!i.parentNode)throw new Error("ctaElement requires a parentNode");i.parentNode.removeChild(i);const e=t.contentWindow;if(!e)throw new Error("ctaFrame requires a contentWindow");const r=e.document;r.open(),r.write(i.innerHTML),r.write(`<script src="${this.npmCdn}/resize-observer-polyfill@1.5.x"><\/script>`),r.close(),b(r,()=>{const i=r.getElementsByClassName("cta-container")[0];i.style.position="fixed",t.height=i.offsetHeight,t.width=i.scrollWidth,t.style.display="block",i.classList.contains(n)||(i.className+=` ${n}`),new e.ResizeObserver(e=>{for(const n of e){const{height:e,width:i}=n.contentRect;t.height=e,t.width=i}}).observe(i),x("CTA template loaded into iframe")})}else x(new Error("CTA element not found in theme"))})}open(){super.open()}close(){super.close()}}const q=t("squatch-js:widgets");class _{constructor(e){const t=h(e);this.tenantAlias=t.tenantAlias,this.domain=t.domain,this.npmCdn=t.npmCdn,this.eventBus=n,this.api=new m(t),n.addEventListener("submit_email",_._cb)}async createCookieUser(e){try{const t=await this.api.cookieUser(e);return{widget:this._renderWidget(t,e,{type:"cookie",engagementMedium:e.engagementMedium}),user:t.user}}catch(t){throw q(t),t.apiErrorCode&&this._renderErrorWidget(t,e.engagementMedium),t}}async upsertUser(e){const t=p(e);try{const n=await this.api.upsertUser(t);return{widget:this._renderWidget(n,t,{type:"upsert",user:t.user,engagementMedium:e.engagementMedium,container:e.container,trigger:e.trigger}),user:n.user}}catch(t){throw q(t),t.apiErrorCode&&this._renderErrorWidget(t,e.engagementMedium),t}}async render(e){const t=p(e);try{const e=await this.api.cookieUser(t);return{widget:this._renderWidget({template:e},t,{type:"cookie",engagementMedium:t.engagementMedium}),user:e.user}}catch(e){throw e.apiErrorCode&&this._renderErrorWidget(e,t.engagementMedium),e}}autofill(e){const t=e;if("function"==typeof t)return void this.api.squatchReferralCookie().then((...e)=>t(...e)).catch(e=>{throw q("Autofill error",e),e});if("string"!=typeof t)throw new Error("Autofill accepts a string or function");let n,i=document.querySelectorAll(t);if(!(i.length>0))throw q("Element id/class or function missing"),new Error("Element id/class or function missing");n=i[0],this.api.squatchReferralCookie().then(({code:e})=>{n.value=e}).catch(e=>{throw e})}submitEmail(e){n.removeEventListener("submit_email",_._cb),n.addEventListener("submit_email",e)}_renderWidget(e,t,n){if(q("Rendering Widget..."),!e)throw new Error("Unable to get a response");let i,r=!1,o=!1;const s=e.jsOptions||"",a={content:e.template,type:t.widgetType||s.widget.defaultWidgetType,api:this.api,domain:this.domain,npmCdn:this.npmCdn,context:n};return s.widgetUrlMappings&&s.widgetUrlMappings.forEach(t=>{_._matchesUrl(t.url)&&("CONVERSION_WIDGET"!==t.widgetType||e.user.referredBy&&e.user.referredBy.code?(r=t.displayOnLoad,o=t.showAsCTA,q(`Display ${t.widgetType} on ${t.url}`)):q(`Don't display ${t.widgetType} when no referral on widget rule match ${t.url}`))}),s.conversionUrls&&s.conversionUrls.forEach(t=>{e.user.referredBy&&_._matchesUrl(t)&&q("This is a conversion URL",t)}),s.fuelTankAutofillUrls&&(q("We found a fuel tank autofill!"),s.fuelTankAutofillUrls.forEach(({url:t,formSelector:n})=>{if(_._matchesUrl(t)&&(q("Fuel Tank URL matches"),e.user.referredBy&&e.user.referredBy.code)){const t=document.querySelector(n);t?t.value=e.user.referredBy.referredReward.fuelTankCode||"":q(new Error(`Element with id/class ${n} was not found.`))}})),o||"EMBED"!==t.engagementMedium?o||"POPUP"!==t.engagementMedium?o?(q("display CTA"),i=new U(a,{side:s.cta.content.buttonSide,position:s.cta.content.buttonPosition}),i.load(),r&&i.open()):(q("display popup on load"),i=new I(a),i.load(),r&&i.open()):(i=new I(a,a.context.trigger),i.load(),r&&i.open()):(i=new C(a,a.context.container),i.load()),i}_renderErrorWidget(e,t="POPUP"){const{apiErrorCode:n,rsCode:i,message:r}=e;q(new Error(`${n} (${i}) ${r}`));const o={content:"error",rsCode:i,api:this.api,domain:this.domain,npmCdn:this.npmCdn,type:"ERROR_WIDGET",context:{type:"error"}};let s;"EMBED"===t?(s=new C(o),s.load()):"POPUP"===t&&(s=new I(o),s.load())}static _matchesUrl(e){return!!window.location.href.match(new RegExp(e))}static _cb(e,t,n){let i;i="string"==typeof n||n instanceof String?{email:n}:n,t.reload(i)}}class S{constructor(e){const t=h(e);this.tenantAlias=t.tenantAlias,this.domain=t.domain}track(e,t){const n=t,i=function(e){if(u(e,"accountId","events","userId"),!Array.isArray(e.events))throw new Error("'events' should be an array");return e}(e),{jwt:r}=function(e){if(!l(e))throw new Error("'options' should be an object");return e}(n),o=encodeURIComponent(this.tenantAlias),a=encodeURIComponent(i.userId),c=encodeURIComponent(i.accountId);return s(this.domain+`/api/v1/${o}/open/account/${c}/user/${a}/events`,JSON.stringify(i),r)}}function $(){return($=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}).apply(this,arguments)}var R={};try{!function(e,t){if(new e("q=%2B").get("q")!==t||new e({q:t}).get("q")!==t||new e([["q",t]]).get("q")!==t||"q=%0A"!==new e("q=\n").toString()||"q=+%26"!==new e({q:" &"}).toString()||"q=%25zx"!==new e({q:"%zx"}).toString())throw e;R.URLSearchParams=e}(URLSearchParams,"+")}catch(e){!function(e,t,n){var i=e.create,r=e.defineProperty,o=/[!'\(\)~]|%20|%00/g,s=/%(?![0-9a-fA-F]{2})/g,a=/\+/g,c={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"},d={append:function(e,t){p(this._ungap,e,t)},delete:function(e){delete this._ungap[e]},get:function(e){return this.has(e)?this._ungap[e][0]:null},getAll:function(e){return this.has(e)?this._ungap[e].slice(0):[]},has:function(e){return e in this._ungap},set:function(e,n){this._ungap[e]=[t(n)]},forEach:function(e,n){var i=this;for(var r in i._ungap)i._ungap[r].forEach(o,r);function o(o){e.call(n,o,t(r),i)}},toJSON:function(){return{}},toString:function(){var e=[];for(var t in this._ungap)for(var n=g(t),i=0,r=this._ungap[t];i<r.length;i++)e.push(n+"="+g(r[i]));return e.join("&")}};for(var l in d)r(u.prototype,l,{configurable:!0,writable:!0,value:d[l]});function u(e){var t=i(null);switch(r(this,"_ungap",{value:t}),!0){case!e:break;case"string"==typeof e:"?"===e.charAt(0)&&(e=e.slice(1));for(var o=e.split("&"),s=0,a=o.length;s<a;s++){var c=(d=o[s]).indexOf("=");-1<c?p(t,m(d.slice(0,c)),m(d.slice(c+1))):d.length&&p(t,m(d),"")}break;case n(e):for(s=0,a=e.length;s<a;s++){var d;p(t,(d=e[s])[0],d[1])}break;case"forEach"in e:e.forEach(h,t);break;default:for(var l in e)p(t,l,e[l])}}function h(e,t){p(this,t,e)}function p(e,t,i){var r=n(i)?i.join(","):i;t in e?e[t].push(r):e[t]=[r]}function m(e){return decodeURIComponent(e.replace(s,"%25").replace(a," "))}function g(e){return encodeURIComponent(e).replace(o,f)}function f(e){return c[e]}R.URLSearchParams=u}(Object,String,Array.isArray)}!function(e){var t=!1;try{t=!!Symbol.iterator}catch(e){}function n(e,n){var i=[];return e.forEach(n,i),t?i[Symbol.iterator]():{next:function(){var e=i.shift();return{done:void 0===e,value:e}}}}"forEach"in e||(e.forEach=function(e,t){var n=this,i=Object.create(null);this.toString().replace(/=[\s\S]*?(?:&|$)/g,"=").split("=").forEach(function(r){r.length&&!(r in i)&&(i[r]=n.getAll(r)).forEach(function(i){e.call(t,i,r,n)})})}),"keys"in e||(e.keys=function(){return n(this,function(e,t){this.push(t)})}),"values"in e||(e.values=function(){return n(this,function(e,t){this.push(e)})}),"entries"in e||(e.entries=function(){return n(this,function(e,t){this.push([t,e])})}),t&&!(Symbol.iterator in e)&&(e[Symbol.iterator]=e.entries),"sort"in e||(e.sort=function(){for(var e,t,n,i=this.entries(),r=i.next(),o=r.done,s=[],a=Object.create(null);!o;)s.push(t=(n=r.value)[0]),t in a||(a[t]=[]),a[t].push(n[1]),o=(r=i.next()).done;for(s.sort(),e=0;e<s.length;e++)this.delete(s[e]);for(e=0;e<s.length;e++)this.append(t=s[e],a[t].shift())}),function(t){var n=t.defineProperty,i=t.getOwnPropertyDescriptor,r=function(t){var n=t.append;t.append=e.append,URLSearchParams.call(t,t._usp.search.slice(1)),t.append=n},o=function(e,t){if(!(e instanceof t))throw new TypeError("'searchParams' accessed on an object that does not implement interface "+t.name)},s=function(s){var a,c,d=s.prototype,l=i(d,"searchParams"),u=i(d,"href"),h=i(d,"search");!l&&h&&h.set&&(c=function(t){function i(n,i){e.append.call(this,n,i),n=this.toString(),t.set.call(this._usp,n?"?"+n:"")}function r(n){e.delete.call(this,n),n=this.toString(),t.set.call(this._usp,n?"?"+n:"")}function o(n,i){e.set.call(this,n,i),n=this.toString(),t.set.call(this._usp,n?"?"+n:"")}return function(e,t){return e.append=i,e.delete=r,e.set=o,n(e,"_usp",{configurable:!0,writable:!0,value:t})}}(h),a=function(e,t){return n(e,"_searchParams",{configurable:!0,writable:!0,value:c(t,e)}),t},t.defineProperties(d,{href:{get:function(){return u.get.call(this)},set:function(e){var t=this._searchParams;u.set.call(this,e),t&&r(t)}},search:{get:function(){return h.get.call(this)},set:function(e){var t=this._searchParams;h.set.call(this,e),t&&r(t)}},searchParams:{get:function(){return o(this,s),this._searchParams||a(this,new URLSearchParams(this.search.slice(1)))},set:function(e){o(this,s),a(this,e)}}}))};try{s(HTMLAnchorElement),/^function|object$/.test(typeof URL)&&URL.prototype&&s(URL)}catch(e){}}(Object)}(R.URLSearchParams.prototype);var P=R.URLSearchParams;const k=t("squatch-js"),O=e=>"object"==typeof e&&!Array.isArray(e),T=(e,t)=>{const n=n=>O(t[n])&&e.hasOwnProperty(n)&&O(e[n]),i=Object.getOwnPropertyNames(t).map(i=>({[i]:n(i)?T(e[i],t[i]):t[i]})).reduce((e,t)=>$({},e,t),{});return $({},e,i)};function M(e){return atob(e.replace(/_/g,"/").replace(/-/g,"+"))}function j(e){return btoa(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function N(){console.log("Having trouble using Squatch.js? Go to https://docs.referralsaasquatch.com/developer/ for tutorials, references and error codes.")}const L=t("squatch-js");let W=null,J=null,B=null;function D(){return W}function H(){return J}function z(){return null}function F(){return B}function G(e){const n=h(e);(n.tenantAlias.match("^test")||n.debug)&&t.enable("squatch-js*"),L("initializing ..."),W=new m(n),J=new _(n),B=new S(n),L("Widget API instance",W),L("Widgets instance",J),L("Events API instance",B)}function X(e){e()}function Y(e){H().autofill(e)}function V(e){H().submitEmail(e)}function K(){!function(){const e=window.location.search,t=new P(e).get("_saasquatch")||"";if(t){let e="",n="",i="";try{e=JSON.parse(M(t))}catch(e){return void k("Unable to decode params",e)}try{n=JSON.parse(M(r.get("_saasquatch"))),k("existing cookie",n)}catch(e){k("Unable to retrieve cookie",e)}try{const t=function(){var e,t,n="weird_get_top_level_domain=cookie",i=document.location.hostname.split(".");for(e=i.length-1;e>=0;e--)if(t=i.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(k("domain retrieved:",t),n){const t=T(n,e);i=j(JSON.stringify(t)),k("cookie to store:",t)}else i=j(JSON.stringify(e)),k("cookie to store:",e);r.set("_saasquatch",i,{expires:365,secure:!1,sameSite:"Lax",domain:t,path:"/"})}catch(e){k("Unable to set cookie",e)}}}()}"undefined"==typeof document||window.SaaSquatchDoNotAutoDrop||K(),"undefined"!=typeof document&&function(){const e=window.squatch||null,t=window._squatch||null;if(e&&t){(t.ready||[]).forEach(e=>setTimeout(()=>e(),0)),window._squatch=void 0;try{delete window._squatch}catch(e){throw e}}}();export{U as CtaWidget,C as EmbedWidget,I as PopupWidget,m as WidgetApi,_ as Widgets,D as api,Y as autofill,F as events,N as help,G as init,K as pushCookie,X as ready,V as submitEmail,z as widget,H as widgets};
|
|
1
|
+
import*as e from"debug";import t from"debug";import*as n from"eventbusjs";import*as i from"superagent";import o from"js-cookie";function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}).apply(this,arguments)}function s(e,t=""){const n={Accept:"application/json","Content-Type":"application/json"};return t&&(n["X-SaaSquatch-User-Token"]=t),d(i.get(e).withCredentials().set(n)).then(e=>{return!e.headers["content-type"]||(t=e.headers["content-type"].toLowerCase(),"number"!=typeof n&&(n=0),n+"application/json".length>t.length||-1===t.indexOf("application/json",n))?e.text:JSON.parse(e.text);var t,n},({response:e})=>{throw JSON.parse(e.text)})}function a(e,t,n){const o={Accept:"application/json","Content-Type":"application/json"};return n&&(o["X-SaaSquatch-User-Token"]=n),d(i.post(e).send(t).set(o)).then(({text:e})=>e?JSON.parse(e):e,e=>{let t;try{t=JSON.parse(e.response.text)}catch(t){throw e||t}throw t})}function c(e,t,n){const o={Accept:"application/json","Content-Type":"application/json","X-SaaSquatch-Referrer":window?window.location.href:""};return n&&(o["X-SaaSquatch-User-Token"]=n),d(i.put(e).withCredentials().send(t).set(o)).then(({text:e})=>e?JSON.parse(e):e,e=>{let t;try{t=JSON.parse(e.response.text)}catch(t){throw e||t}throw t})}function d(e){return new Promise((t,n)=>{e.on("error",n),e.end((e,i)=>{e?n(e):t(i)})})}function l(e,t){if(!u(e))return!1;const n=Object.keys(e);return Array.isArray(t)?t.reduce((e,t)=>e&&n.indexOf(t)>=0,!0):e.hasOwnProperty(t)}function u(e){return"object"==typeof e}function h(e,...t){return t.forEach(n=>{if(!l(e,t))throw new Error(n+" is required")}),!0}function p(e){if(!u(e))throw new Error("config must be an object");if(!l(e,"tenantAlias")||"string"!=typeof e.tenantAlias)throw new Error("tenantAlias not provided");return{tenantAlias:e.tenantAlias,domain:l(e,"domain")&&"string"==typeof e.domain&&e.domain||"https://app.referralsaasquatch.com",debug:l(e,"debug")&&"boolean"==typeof e.debug&&e.debug||!1,npmCdn:l(e,"npmCdn")&&"string"==typeof e.npmCdn&&e.npmCdn||"https://fast.ssqt.io/npm"}}function m(e){if(!u(e))throw new Error("Widget properties must be an object");return h(e,"user"),e}class g{constructor(e){const t=p(e);this.tenantAlias=t.tenantAlias,this.domain=t.domain,this.npmCdn=t.npmCdn}cookieUser(e){const{widgetType:t,engagementMedium:n="POPUP",jwt:i,user:o}=e,r=encodeURIComponent(this.tenantAlias),s=f({widgetType:t,engagementMedium:n});return c(this.domain+`/api/v1/${r}/widget/user/cookie_user${s}`,JSON.stringify(o||{}),i)}upsertUser(e){const t=m(e),{widgetType:n,engagementMedium:i="POPUP",jwt:r,user:s}=t,a=encodeURIComponent(this.tenantAlias),d=encodeURIComponent(s.accountId),l=encodeURIComponent(s.id),u=f({widgetType:n,engagementMedium:i}),h=this.domain+`/api/v1/${a}/widget/account/${d}/user/${l}/upsert${u}`,p=o.get("_saasquatch");return p&&(s.cookies=p),c(h,JSON.stringify(s),r)}render(e){const t=m(e),{widgetType:n,engagementMedium:i="POPUP",jwt:o,user:r}=t,a=encodeURIComponent(this.tenantAlias),c=encodeURIComponent(r.accountId),d=encodeURIComponent(r.id),l=f({widgetType:n,engagementMedium:i});return s(this.domain+`/api/v1/${a}/widget/account/${c}/user/${d}/render${l}`,o)}invite({emailList:e=[],userId:t,accountId:n,tenantAlias:i}){const o=encodeURIComponent(i);return a(this.domain+`/api/v1/${o}/mail/referralinvite`,JSON.stringify({sendingAccountId:n,sendingUserId:t,recipients:e}))}async squatchReferralCookie(){const e=encodeURIComponent(this.tenantAlias),t=o.get("_saasquatch")||"",n=t?`?cookies=${encodeURIComponent(t)}`:"",i=`${this.domain}/a/${e}/widgets/squatchcookiejson${n}`,a=await s(i);return Promise.resolve(r({},a,{encodedCookie:t}))}}function f({widgetType:e,engagementMedium:t}){return(e?`?widgetType=${encodeURIComponent(e)}`:"")+`${e?"&":"?"}engagementMedium=${encodeURIComponent(t)}`}class w{constructor(e){const t=e;this.domain=l(t,"domain")&&"string"==typeof t.domain?t.domain:"https://app.referralsaasquatch.com"}pushAnalyticsLoadEvent(e){const t=encodeURIComponent(e.tenantAlias),n=encodeURIComponent(e.externalAccountId),i=encodeURIComponent(e.externalUserId),o=encodeURIComponent(e.engagementMedium),r=e.programId?`&programId=${encodeURIComponent(e.programId)}`:"";return a(this.domain+`/a/${t}/widgets/analytics/loaded?externalAccountId=${n}&externalUserId=${i}&engagementMedium=${o}${r}`,JSON.stringify({}))}pushAnalyticsShareClickedEvent(e){const t=encodeURIComponent(e.tenantAlias),n=encodeURIComponent(e.externalAccountId),i=encodeURIComponent(e.externalUserId),o=encodeURIComponent(e.engagementMedium),r=encodeURIComponent(e.shareMedium);return a(this.domain+`/a/${t}/widgets/analytics/shared?externalAccountId=${n}&externalUserId=${i}&engagementMedium=${o}&shareMedium=${r}`,JSON.stringify({}))}}const y=t("squatch-js:widget");class v{constructor(e){y("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 w({domain:e.domain}),this.frame=document.createElement("iframe"),this.frame.squatchJsApi=this,this.frame.width="100%",this.frame.scrolling="no",this.frame.setAttribute("style","border: 0; background-color: none; width: 1px; min-width: 100%;"),this.context=e.context}_loadEvent(e){if(!e)return;if(!u(e))throw new Error("Widget Load event identity property is not an object");let t;if(l(e,"programId")){if(!l(e,["tenantAlias","accountId","userId","engagementMedium"]))throw new Error("Widget Load event missing required properties");t={tenantAlias:e.tenantAlias,externalAccountId:e.accountId,externalUserId:e.userId,engagementMedium:e.engagementMedium,programId:e.programId}}else{const{analytics:n,mode:i}=e;t={tenantAlias:n.attributes.tenant,externalAccountId:n.attributes.accountId,externalUserId:n.attributes.userId,engagementMedium:i.widgetMode}}this.analyticsApi.pushAnalyticsLoadEvent(t).then(e=>{y(`${t.engagementMedium} loaded event recorded.`)}).catch(e=>{y(new Error(`pushAnalyticsLoadEvent() ${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=>{y(`${e.mode.widgetMode} share ${t} event recorded. ${n}`)}).catch(e=>{y(new Error(`pushAnalyticsLoadEvent() ${e}`))})}_inviteContacts(e,t){e&&this.widgetApi.invite({tenantAlias:e.analytics.attributes.tenant,accountId:e.analytics.attributes.accountId,userId:e.analytics.attributes.userId,emailList:t}).then(e=>{y(`Sent email invites to share ${t}. ${e}`)}).catch(e=>{y(new Error(`invite() ${e}`))})}_error(e,t="modal",n=""){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 ${n}\n </style>\n </head>\n <body>\n\n <div class="squatch-container ${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: ${e}\n </div>\n </div>\n </div>\n </body>\n </html>`}async _findInnerContainer(){const{contentWindow:e}=this.frame;if(!e)throw new Error("Squatch.js frame inner frame is empty");const t=e.document;function n(){const e=t.getElementsByTagName("sqh-global-container"),n=t.getElementsByClassName("squatch-container");return e.length>0?e[0]:n.length>0?n[0]:null}let i=null;for(let e=0;e<5&&(i=n(),!i);e++)await b(100);return i||t.body}reload({email:e,firstName:t,lastName:n},i){const o=this.frame.contentWindow,r=this.context.engagementMedium||"POPUP";if(!o)throw new Error("Frame needs a content window");const s=o.document;let a;if("upsert"===this.context.type)a=this.widgetApi.upsertUser({user:{email:e||null,firstName:t||null,lastName:n||null,id:this.context.user.id,accountId:this.context.user.accountId},engagementMedium:r,widgetType:this.type,jwt:i});else{if("cookie"!==this.context.type)throw new Error("can't reload an error widget");a=this.widgetApi.cookieUser({user:{email:e||null,firstName:t||null,lastName:n||null},engagementMedium:r,widgetType:this.type,jwt:i})}a.then(({template:t})=>{if(t){this.content=t;const n=s.createElement("button"),i=s.getElementsByClassName("squatch-register")[0];i&&(n.className="btn btn-primary",n.id="show-stats-btn",n.textContent="REFERRER_WIDGET"===this.type?"Show Stats":"Show Reward",n.setAttribute("style","POPUP"===r?"margin-top: 10px; max-width: 130px; width: 100%;":"margin-top: 10px;"),n.onclick=()=>{this.load(),"POPUP"===r&&this.open()},i.style.paddingTop="30px",i.innerHTML=`<p><strong>${e}</strong><br>Has been successfully registered</p>`,i.appendChild(n))}}).catch(({message:e})=>{y(`${e}`)})}}function b(e){return new Promise(function(t,n){setTimeout(function(){t()},e)})}function E(e,t){let n,i=[],o=e,r="DOMContentLoaded",s=(o.documentElement.doScroll?/^loaded|^c/:/^loaded|^i|^c/).test(o.readyState);return s||o.addEventListener(r,n=()=>{for(o.removeEventListener(r,n),s=!0;n=i.shift();)n()}),s?setTimeout(t,0):i.push(t)}const C=t("squatch-js:EMBEDwidget");class I extends v{constructor(e,t){let n;if(super(e),"string"==typeof t?(n=document.querySelector(t),C("loading widget with selector",n)):t instanceof HTMLElement?(n=t,C("loading widget with container",n)):t?(n=null,C("container must be an HTMLElement or string",t)):(n=document.querySelector("#squatchembed")||document.querySelector(".squatchembed"),C("loading widget with default selector",n)),!(n instanceof HTMLElement))throw new Error(`element with selector '${t}' not found.'`);this.element=n}async load(){var e=this;this.context.container?(this.element.style.visibility="hidden",this.element.style.height="0",this.element.style["overflow-y"]="hidden",this.element.firstChild?this.element.replaceChild(this.frame,this.element.firstChild):this.element.appendChild(this.frame)):this.element.firstChild&&"#text"!==this.element.firstChild.nodeName||this.element.appendChild(this.frame);const{contentWindow:t}=this.frame;if(!t)throw new Error("Frame needs a content window");const n=t.document;n.open(),n.write(this.content),n.write(`<script src="${this.npmCdn}/resize-observer-polyfill@1.5.x"><\/script>`),n.close(),E(n,async function(){const i=t.squatch||t.widgetIdent,o=n.getElementById("cta");if(o){if(!o.parentNode)throw new Error("ctaElement needs a parentNode");o.parentNode.removeChild(o)}e.frame.height=n.body.scrollHeight,new t.ResizeObserver(t=>{for(const n of t){const{height:t}=n.contentRect;e.frame.height=t}}).observe(await e._findInnerContainer()),e.context.container||(e._loadEvent(i),C("loaded"))})}open(){var e,t,n,i,o,r;if(!this.frame)return C("no target element to open");this.element.style.visibility="unset",this.element.style.height="auto",this.element.style["overflow-y"]="auto",null==(e=this.frame)||null==(t=e.contentDocument)||t.dispatchEvent(new CustomEvent("sq:refresh"));const s=(null==(n=this.frame)||null==(i=n.contentWindow)?void 0:i.squatch)||(null==(o=this.frame)||null==(r=o.contentWindow)?void 0:r.widgetIdent);this._loadEvent(s),C("loaded")}close(){if(!this.frame)return C("no target element to close");this.element.style.visibility="hidden",this.element.style.height="0",this.element.style["overflow-y"]="hidden",C("Embed widget closed")}_error(e,t="embed",n=""){return super._error(e,t,n)}}const A=t("squatch-js:POPUPwidget");class x extends v{constructor(e,t=".squatchpop"){super(e);try{this.triggerElement=document.querySelector(t),t&&!this.triggerElement&&A("No element found with trigger selector",t)}catch(e){A("Not a valid selector",t)}this.triggerElement&&(this.triggerElement.onclick=()=>{this.open()}),this.triggerWhenCTA=document.querySelector(".squatchpop"),"#cta"===t&&this.triggerWhenCTA&&(this.triggerWhenCTA.onclick=()=>{this.open()}),this.popupdiv=document.createElement("div"),this.popupdiv.id="squatchModal",this.popupdiv.setAttribute("style","display: none; position: fixed; z-index: 1; padding-top: 5%; left: 0; top: -2000px; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.4);"),this.popupcontent=document.createElement("div"),this.popupcontent.setAttribute("style","margin: auto; width: 80%; max-width: 500px; position: relative;"),this.popupdiv.onclick=e=>{this._clickedOutside(e)}}load(){this.popupdiv.appendChild(this.popupcontent),document.body.appendChild(this.popupdiv),this.popupcontent.appendChild(this.frame);const e=this.frame.contentWindow.document;e.open(),e.write(this.content),e.write(`<script src="${this.npmCdn}/resize-observer-polyfill@1.5.x"><\/script>`),e.close(),A("Popup template loaded into iframe"),this._setupResizeHandler()}_setupResizeHandler(){var e=this;console.log("TESTING 123");const t=this.popupdiv,n=this.frame,{contentWindow:i}=n;if(!i)throw new Error("Frame needs a content window");const o=i.document;E(o,async function(){o.body.style.overflowY="hidden",t.style.visibility="hidden",t.style.display="block",n.height=`${o.body.offsetHeight}px`,new i.ResizeObserver(e=>{for(const i of e){const{top:e,bottom:o}=i.contentRect;n.height=o+e+"",i.target.style="",t.style.paddingTop=window.innerHeight>Number(n.height)?(window.innerHeight-Number(n.height))/2+"px":"5px"}}).observe(await e._findInnerContainer())})}open(){const e=this.popupdiv,t=this.frame,{contentWindow:n}=t;if(!n)throw new Error("Squatch.js has an empty iframe");const i=n.document;E(i,()=>{var o;const r=n.squatch||n.widgetIdent,s=i.getElementById("cta");s&&s.parentNode.removeChild(s),e.style.visibility="visible",e.style.top="0px",null==(o=t.contentDocument)||o.dispatchEvent(new CustomEvent("sq:refresh")),this._loadEvent(r),A("Popup opened")})}close(){this.popupdiv.style.visibility="hidden",this.popupdiv.style.top="-2000px",A("Popup closed")}_clickedOutside({target:e}){e===this.popupdiv&&this.close()}_error(e,t="modal",n=""){return super._error(e,t,n||"body { margin: 0; } .modal { box-shadow: none; border: 0; }")}}const U=e("squatch-js:CTAwidget");class q extends x{constructor(e,t){U("CTA constructor");const n=document.createElement("div");n.id="cta",document.body.appendChild(n),super(e,"#cta"),t.side||t.position||(t.position="bottom",t.side="right"),"middle"===t.position?(this.position="top: 45%;",this.side="center"===t.side?"right: 45%;":`${t.side}: -10px;`):(this.position=`${t.position}: -10px;`,this.side="center"===t.side?"right: 45%;":`${t.side}: 20px;`),this.positionClass=t.position,this.ctaFrame=document.createElement("iframe"),this.ctaFrame.squatchJsApi=this,this.ctaFrame.scrolling="no",this.ctaFrame.setAttribute("style",`border:0; background-color:transparent; position:fixed; display:none;${this.side}${this.position}`),document.body.appendChild(this.ctaFrame),U("ctaframe appended to body")}load(){if(super.load(),!this.frame.contentWindow)throw new Error("frame requires a contentWindow");const e=this.frame.contentWindow.document,t=this.ctaFrame,n=this.positionClass;E(e,()=>{const i=e.getElementById("cta");if(i){if(!i.parentNode)throw new Error("ctaElement requires a parentNode");i.parentNode.removeChild(i);const e=t.contentWindow;if(!e)throw new Error("ctaFrame requires a contentWindow");const o=e.document;o.open(),o.write(i.innerHTML),o.write(`<script src="${this.npmCdn}/resize-observer-polyfill@1.5.x"><\/script>`),o.close(),E(o,()=>{const i=o.getElementsByClassName("cta-container")[0];i.style.position="fixed",t.height=i.offsetHeight,t.width=i.scrollWidth,t.style.display="block",i.classList.contains(n)||(i.className+=` ${n}`),new e.ResizeObserver(e=>{for(const n of e){const{height:e,width:i}=n.contentRect;t.height=e,t.width=i}}).observe(i),U("CTA template loaded into iframe")})}else U(new Error("CTA element not found in theme"))})}open(){super.open()}close(){super.close()}}const _=t("squatch-js:widgets");class S{constructor(e){const t=p(e);this.tenantAlias=t.tenantAlias,this.domain=t.domain,this.npmCdn=t.npmCdn,this.eventBus=n,this.api=new g(t),n.addEventListener("submit_email",S._cb)}async createCookieUser(e){try{const t=await this.api.cookieUser(e);return{widget:this._renderWidget(t,e,{type:"cookie",engagementMedium:e.engagementMedium}),user:t.user}}catch(t){throw _(t),t.apiErrorCode&&this._renderErrorWidget(t,e.engagementMedium),t}}async upsertUser(e){const t=m(e);try{const n=await this.api.upsertUser(t);return{widget:this._renderWidget(n,t,{type:"upsert",user:t.user,engagementMedium:e.engagementMedium,container:e.container,trigger:e.trigger}),user:n.user}}catch(t){throw _(t),t.apiErrorCode&&this._renderErrorWidget(t,e.engagementMedium),t}}async render(e){const t=m(e);try{const e=await this.api.cookieUser(t);return{widget:this._renderWidget({template:e},t,{type:"cookie",engagementMedium:t.engagementMedium}),user:e.user}}catch(e){throw e.apiErrorCode&&this._renderErrorWidget(e,t.engagementMedium),e}}autofill(e){const t=e;if("function"==typeof t)return void this.api.squatchReferralCookie().then((...e)=>t(...e)).catch(e=>{throw _("Autofill error",e),e});if("string"!=typeof t)throw new Error("Autofill accepts a string or function");let n,i=document.querySelectorAll(t);if(!(i.length>0))throw _("Element id/class or function missing"),new Error("Element id/class or function missing");n=i[0],this.api.squatchReferralCookie().then(({code:e})=>{n.value=e}).catch(e=>{throw e})}submitEmail(e){n.removeEventListener("submit_email",S._cb),n.addEventListener("submit_email",e)}_renderWidget(e,t,n){if(_("Rendering Widget..."),!e)throw new Error("Unable to get a response");let i,o=!1,r=!1;const s=e.jsOptions||"",a={content:e.template,type:t.widgetType||s.widget.defaultWidgetType,api:this.api,domain:this.domain,npmCdn:this.npmCdn,context:n};return s.widgetUrlMappings&&s.widgetUrlMappings.forEach(t=>{S._matchesUrl(t.url)&&("CONVERSION_WIDGET"!==t.widgetType||e.user.referredBy&&e.user.referredBy.code?(o=t.displayOnLoad,r=t.showAsCTA,_(`Display ${t.widgetType} on ${t.url}`)):_(`Don't display ${t.widgetType} when no referral on widget rule match ${t.url}`))}),s.conversionUrls&&s.conversionUrls.forEach(t=>{e.user.referredBy&&S._matchesUrl(t)&&_("This is a conversion URL",t)}),s.fuelTankAutofillUrls&&(_("We found a fuel tank autofill!"),s.fuelTankAutofillUrls.forEach(({url:t,formSelector:n})=>{if(S._matchesUrl(t)&&(_("Fuel Tank URL matches"),e.user.referredBy&&e.user.referredBy.code)){const t=document.querySelector(n);t?t.value=e.user.referredBy.referredReward.fuelTankCode||"":_(new Error(`Element with id/class ${n} was not found.`))}})),r||"EMBED"!==t.engagementMedium?r||"POPUP"!==t.engagementMedium?r?(_("display CTA"),i=new q(a,{side:s.cta.content.buttonSide,position:s.cta.content.buttonPosition}),i.load(),o&&i.open()):(_("display popup on load"),i=new x(a),i.load(),o&&i.open()):(i=new x(a,a.context.trigger),i.load(),o&&i.open()):(i=new I(a,a.context.container),i.load()),i}_renderErrorWidget(e,t="POPUP"){const{apiErrorCode:n,rsCode:i,message:o}=e;_(new Error(`${n} (${i}) ${o}`));const r={content:"error",rsCode:i,api:this.api,domain:this.domain,npmCdn:this.npmCdn,type:"ERROR_WIDGET",context:{type:"error"}};let s;"EMBED"===t?(s=new I(r),s.load()):"POPUP"===t&&(s=new x(r),s.load())}static _matchesUrl(e){return!!window.location.href.match(new RegExp(e))}static _cb(e,t,n){let i;i="string"==typeof n||n instanceof String?{email:n}:n,t.reload(i)}}class ${constructor(e){const t=p(e);this.tenantAlias=t.tenantAlias,this.domain=t.domain}track(e,t){const n=t,i=function(e){if(h(e,"accountId","events","userId"),!Array.isArray(e.events))throw new Error("'events' should be an array");return e}(e),{jwt:o}=function(e){if(!u(e))throw new Error("'options' should be an object");return e}(n),r=encodeURIComponent(this.tenantAlias),s=encodeURIComponent(i.userId),c=encodeURIComponent(i.accountId);return a(this.domain+`/api/v1/${r}/open/account/${c}/user/${s}/events`,JSON.stringify(i),o)}}var P={};try{!function(e,t){if(new e("q=%2B").get("q")!==t||new e({q:t}).get("q")!==t||new e([["q",t]]).get("q")!==t||"q=%0A"!==new e("q=\n").toString()||"q=+%26"!==new e({q:" &"}).toString()||"q=%25zx"!==new e({q:"%zx"}).toString())throw e;P.URLSearchParams=e}(URLSearchParams,"+")}catch(e){!function(e,t,n){var i=e.create,o=e.defineProperty,r=/[!'\(\)~]|%20|%00/g,s=/%(?![0-9a-fA-F]{2})/g,a=/\+/g,c={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"},d={append:function(e,t){p(this._ungap,e,t)},delete:function(e){delete this._ungap[e]},get:function(e){return this.has(e)?this._ungap[e][0]:null},getAll:function(e){return this.has(e)?this._ungap[e].slice(0):[]},has:function(e){return e in this._ungap},set:function(e,n){this._ungap[e]=[t(n)]},forEach:function(e,n){var i=this;for(var o in i._ungap)i._ungap[o].forEach(r,o);function r(r){e.call(n,r,t(o),i)}},toJSON:function(){return{}},toString:function(){var e=[];for(var t in this._ungap)for(var n=g(t),i=0,o=this._ungap[t];i<o.length;i++)e.push(n+"="+g(o[i]));return e.join("&")}};for(var l in d)o(u.prototype,l,{configurable:!0,writable:!0,value:d[l]});function u(e){var t=i(null);switch(o(this,"_ungap",{value:t}),!0){case!e:break;case"string"==typeof e:"?"===e.charAt(0)&&(e=e.slice(1));for(var r=e.split("&"),s=0,a=r.length;s<a;s++){var c=(d=r[s]).indexOf("=");-1<c?p(t,m(d.slice(0,c)),m(d.slice(c+1))):d.length&&p(t,m(d),"")}break;case n(e):for(s=0,a=e.length;s<a;s++){var d;p(t,(d=e[s])[0],d[1])}break;case"forEach"in e:e.forEach(h,t);break;default:for(var l in e)p(t,l,e[l])}}function h(e,t){p(this,t,e)}function p(e,t,i){var o=n(i)?i.join(","):i;t in e?e[t].push(o):e[t]=[o]}function m(e){return decodeURIComponent(e.replace(s,"%25").replace(a," "))}function g(e){return encodeURIComponent(e).replace(r,f)}function f(e){return c[e]}P.URLSearchParams=u}(Object,String,Array.isArray)}!function(e){var t=!1;try{t=!!Symbol.iterator}catch(e){}function n(e,n){var i=[];return e.forEach(n,i),t?i[Symbol.iterator]():{next:function(){var e=i.shift();return{done:void 0===e,value:e}}}}"forEach"in e||(e.forEach=function(e,t){var n=this,i=Object.create(null);this.toString().replace(/=[\s\S]*?(?:&|$)/g,"=").split("=").forEach(function(o){o.length&&!(o in i)&&(i[o]=n.getAll(o)).forEach(function(i){e.call(t,i,o,n)})})}),"keys"in e||(e.keys=function(){return n(this,function(e,t){this.push(t)})}),"values"in e||(e.values=function(){return n(this,function(e,t){this.push(e)})}),"entries"in e||(e.entries=function(){return n(this,function(e,t){this.push([t,e])})}),t&&!(Symbol.iterator in e)&&(e[Symbol.iterator]=e.entries),"sort"in e||(e.sort=function(){for(var e,t,n,i=this.entries(),o=i.next(),r=o.done,s=[],a=Object.create(null);!r;)s.push(t=(n=o.value)[0]),t in a||(a[t]=[]),a[t].push(n[1]),r=(o=i.next()).done;for(s.sort(),e=0;e<s.length;e++)this.delete(s[e]);for(e=0;e<s.length;e++)this.append(t=s[e],a[t].shift())}),function(t){var n=t.defineProperty,i=t.getOwnPropertyDescriptor,o=function(t){var n=t.append;t.append=e.append,URLSearchParams.call(t,t._usp.search.slice(1)),t.append=n},r=function(e,t){if(!(e instanceof t))throw new TypeError("'searchParams' accessed on an object that does not implement interface "+t.name)},s=function(s){var a,c,d=s.prototype,l=i(d,"searchParams"),u=i(d,"href"),h=i(d,"search");!l&&h&&h.set&&(c=function(t){function i(n,i){e.append.call(this,n,i),n=this.toString(),t.set.call(this._usp,n?"?"+n:"")}function o(n){e.delete.call(this,n),n=this.toString(),t.set.call(this._usp,n?"?"+n:"")}function r(n,i){e.set.call(this,n,i),n=this.toString(),t.set.call(this._usp,n?"?"+n:"")}return function(e,t){return e.append=i,e.delete=o,e.set=r,n(e,"_usp",{configurable:!0,writable:!0,value:t})}}(h),a=function(e,t){return n(e,"_searchParams",{configurable:!0,writable:!0,value:c(t,e)}),t},t.defineProperties(d,{href:{get:function(){return u.get.call(this)},set:function(e){var t=this._searchParams;u.set.call(this,e),t&&o(t)}},search:{get:function(){return h.get.call(this)},set:function(e){var t=this._searchParams;h.set.call(this,e),t&&o(t)}},searchParams:{get:function(){return r(this,s),this._searchParams||a(this,new URLSearchParams(this.search.slice(1)))},set:function(e){r(this,s),a(this,e)}}}))};try{s(HTMLAnchorElement),/^function|object$/.test(typeof URL)&&URL.prototype&&s(URL)}catch(e){}}(Object)}(P.URLSearchParams.prototype);var R=P.URLSearchParams;const k=t("squatch-js"),O=e=>"object"==typeof e&&!Array.isArray(e),T=(e,t)=>{const n=n=>O(t[n])&&e.hasOwnProperty(n)&&O(e[n]),i=Object.getOwnPropertyNames(t).map(i=>({[i]:n(i)?T(e[i],t[i]):t[i]})).reduce((e,t)=>r({},e,t),{});return r({},e,i)};function M(e){return atob(e.replace(/_/g,"/").replace(/-/g,"+"))}function j(e){return btoa(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function N(){console.log("Having trouble using Squatch.js? Go to https://docs.referralsaasquatch.com/developer/ for tutorials, references and error codes.")}const L=t("squatch-js");let W=null,J=null,B=null;function D(){return W}function H(){return J}function z(){return B}function F(e){const n=p(e);(n.tenantAlias.match("^test")||n.debug)&&t.enable("squatch-js*"),L("initializing ..."),W=new g(n),J=new S(n),B=new $(n),L("Widget API instance",W),L("Widgets instance",J),L("Events API instance",B)}function G(e){e()}function X(e){H().autofill(e)}function Y(e){H().submitEmail(e)}function V(){!function(){const e=window.location.search,t=new R(e).get("_saasquatch")||"";if(t){let e="",n="",i="";try{e=JSON.parse(M(t))}catch(e){return void k("Unable to decode params",e)}try{n=JSON.parse(M(o.get("_saasquatch"))),k("existing cookie",n)}catch(e){k("Unable to retrieve cookie",e)}try{const t=function(){var e,t,n="weird_get_top_level_domain=cookie",i=document.location.hostname.split(".");for(e=i.length-1;e>=0;e--)if(t=i.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(k("domain retrieved:",t),n){const t=T(n,e);i=j(JSON.stringify(t)),k("cookie to store:",t)}else i=j(JSON.stringify(e)),k("cookie to store:",e);o.set("_saasquatch",i,{expires:365,secure:!1,sameSite:"Lax",domain:t,path:"/"})}catch(e){k("Unable to set cookie",e)}}}()}"undefined"==typeof document||window.SaaSquatchDoNotAutoDrop||V(),"undefined"!=typeof document&&function(){const e=window.squatch||null,t=window._squatch||null;if(e&&t){(t.ready||[]).forEach(e=>setTimeout(()=>e(),0)),window._squatch=void 0;try{delete window._squatch}catch(e){throw e}}}();export{q as CtaWidget,I as EmbedWidget,x as PopupWidget,g as WidgetApi,S as Widgets,D as api,X as autofill,z as events,N as help,F as init,V as pushCookie,G as ready,Y as submitEmail,H as widgets};
|
|
2
2
|
//# sourceMappingURL=squatch.modern.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"squatch.modern.js","sources":["../node_modules/@ungap/url-search-params/esm/index.js"],"sourcesContent":["/*! (c) Andrea Giammarchi - ISC */\nvar self = this || /* istanbul ignore next */ {};\ntry {\n (function (URLSearchParams, plus) {\n if (\n new URLSearchParams('q=%2B').get('q') !== plus ||\n new URLSearchParams({q: plus}).get('q') !== plus ||\n new URLSearchParams([['q', plus]]).get('q') !== plus ||\n new URLSearchParams('q=\\n').toString() !== 'q=%0A' ||\n new URLSearchParams({q: ' &'}).toString() !== 'q=+%26' ||\n new URLSearchParams({q: '%zx'}).toString() !== 'q=%25zx'\n )\n throw URLSearchParams;\n self.URLSearchParams = URLSearchParams;\n }(URLSearchParams, '+'));\n} catch(URLSearchParams) {\n (function (Object, String, isArray) {'use strict';\n var create = Object.create;\n var defineProperty = Object.defineProperty;\n var find = /[!'\\(\\)~]|%20|%00/g;\n var findPercentSign = /%(?![0-9a-fA-F]{2})/g;\n var plus = /\\+/g;\n var replace = {\n '!': '%21',\n \"'\": '%27',\n '(': '%28',\n ')': '%29',\n '~': '%7E',\n '%20': '+',\n '%00': '\\x00'\n };\n var proto = {\n append: function (key, value) {\n appendTo(this._ungap, key, value);\n },\n delete: function (key) {\n delete this._ungap[key];\n },\n get: function (key) {\n return this.has(key) ? this._ungap[key][0] : null;\n },\n getAll: function (key) {\n return this.has(key) ? this._ungap[key].slice(0) : [];\n },\n has: function (key) {\n return key in this._ungap;\n },\n set: function (key, value) {\n this._ungap[key] = [String(value)];\n },\n forEach: function (callback, thisArg) {\n var self = this;\n for (var key in self._ungap)\n self._ungap[key].forEach(invoke, key);\n function invoke(value) {\n callback.call(thisArg, value, String(key), self);\n }\n },\n toJSON: function () {\n return {};\n },\n toString: function () {\n var query = [];\n for (var key in this._ungap) {\n var encoded = encode(key);\n for (var\n i = 0,\n value = this._ungap[key];\n i < value.length; i++\n ) {\n query.push(encoded + '=' + encode(value[i]));\n }\n }\n return query.join('&');\n }\n };\n for (var key in proto)\n defineProperty(URLSearchParams.prototype, key, {\n configurable: true,\n writable: true,\n value: proto[key]\n });\n self.URLSearchParams = URLSearchParams;\n function URLSearchParams(query) {\n var dict = create(null);\n defineProperty(this, '_ungap', {value: dict});\n switch (true) {\n case !query:\n break;\n case typeof query === 'string':\n if (query.charAt(0) === '?') {\n query = query.slice(1);\n }\n for (var\n pairs = query.split('&'),\n i = 0,\n length = pairs.length; i < length; i++\n ) {\n var value = pairs[i];\n var index = value.indexOf('=');\n if (-1 < index) {\n appendTo(\n dict,\n decode(value.slice(0, index)),\n decode(value.slice(index + 1))\n );\n } else if (value.length){\n appendTo(\n dict,\n decode(value),\n ''\n );\n }\n }\n break;\n case isArray(query):\n for (var\n i = 0,\n length = query.length; i < length; i++\n ) {\n var value = query[i];\n appendTo(dict, value[0], value[1]);\n }\n break;\n case 'forEach' in query:\n query.forEach(addEach, dict);\n break;\n default:\n for (var key in query)\n appendTo(dict, key, query[key]);\n }\n }\n\n function addEach(value, key) {\n appendTo(this, key, value);\n }\n\n function appendTo(dict, key, value) {\n var res = isArray(value) ? value.join(',') : value;\n if (key in dict)\n dict[key].push(res);\n else\n dict[key] = [res];\n }\n\n function decode(str) {\n return decodeURIComponent(str.replace(findPercentSign, '%25').replace(plus, ' '));\n }\n\n function encode(str) {\n return encodeURIComponent(str).replace(find, replacer);\n }\n\n function replacer(match) {\n return replace[match];\n }\n\n }(Object, String, Array.isArray));\n}\n\n(function (URLSearchParamsProto) {\n\n var iterable = false;\n try { iterable = !!Symbol.iterator; } catch (o_O) {}\n\n /* istanbul ignore else */\n if (!('forEach' in URLSearchParamsProto)) {\n URLSearchParamsProto.forEach = function forEach(callback, thisArg) {\n var self = this;\n var names = Object.create(null);\n this.toString()\n .replace(/=[\\s\\S]*?(?:&|$)/g, '=')\n .split('=')\n .forEach(function (name) {\n if (!name.length || name in names)\n return;\n (names[name] = self.getAll(name)).forEach(function(value) {\n callback.call(thisArg, value, name, self);\n });\n });\n };\n }\n\n /* istanbul ignore else */\n if (!('keys' in URLSearchParamsProto)) {\n URLSearchParamsProto.keys = function keys() {\n return iterator(this, function(value, key) { this.push(key); });\n };\n }\n\n /* istanbul ignore else */\n if (!('values' in URLSearchParamsProto)) {\n URLSearchParamsProto.values = function values() {\n return iterator(this, function(value, key) { this.push(value); });\n };\n }\n\n /* istanbul ignore else */\n if (!('entries' in URLSearchParamsProto)) {\n URLSearchParamsProto.entries = function entries() {\n return iterator(this, function(value, key) { this.push([key, value]); });\n };\n }\n\n /* istanbul ignore else */\n if (iterable && !(Symbol.iterator in URLSearchParamsProto)) {\n URLSearchParamsProto[Symbol.iterator] = URLSearchParamsProto.entries;\n }\n\n /* istanbul ignore else */\n if (!('sort' in URLSearchParamsProto)) {\n URLSearchParamsProto.sort = function sort() {\n var\n entries = this.entries(),\n entry = entries.next(),\n done = entry.done,\n keys = [],\n values = Object.create(null),\n i, key, value\n ;\n while (!done) {\n value = entry.value;\n key = value[0];\n keys.push(key);\n if (!(key in values)) {\n values[key] = [];\n }\n values[key].push(value[1]);\n entry = entries.next();\n done = entry.done;\n }\n // not the champion in efficiency\n // but these two bits just do the job\n keys.sort();\n for (i = 0; i < keys.length; i++) {\n this.delete(keys[i]);\n }\n for (i = 0; i < keys.length; i++) {\n key = keys[i];\n this.append(key, values[key].shift());\n }\n };\n }\n\n function iterator(self, callback) {\n var items = [];\n self.forEach(callback, items);\n /* istanbul ignore next */\n return iterable ?\n items[Symbol.iterator]() :\n {\n next: function() {\n var value = items.shift();\n return {done: value === void 0, value: value};\n }\n };\n }\n\n /* istanbul ignore next */\n (function (Object) {\n var\n dP = Object.defineProperty,\n gOPD = Object.getOwnPropertyDescriptor,\n createSearchParamsPollute = function (search) {\n function append(name, value) {\n URLSearchParamsProto.append.call(this, name, value);\n name = this.toString();\n search.set.call(this._usp, name ? ('?' + name) : '');\n }\n function del(name) {\n URLSearchParamsProto.delete.call(this, name);\n name = this.toString();\n search.set.call(this._usp, name ? ('?' + name) : '');\n }\n function set(name, value) {\n URLSearchParamsProto.set.call(this, name, value);\n name = this.toString();\n search.set.call(this._usp, name ? ('?' + name) : '');\n }\n return function (sp, value) {\n sp.append = append;\n sp.delete = del;\n sp.set = set;\n return dP(sp, '_usp', {\n configurable: true,\n writable: true,\n value: value\n });\n };\n },\n createSearchParamsCreate = function (polluteSearchParams) {\n return function (obj, sp) {\n dP(\n obj, '_searchParams', {\n configurable: true,\n writable: true,\n value: polluteSearchParams(sp, obj)\n }\n );\n return sp;\n };\n },\n updateSearchParams = function (sp) {\n var append = sp.append;\n sp.append = URLSearchParamsProto.append;\n URLSearchParams.call(sp, sp._usp.search.slice(1));\n sp.append = append;\n },\n verifySearchParams = function (obj, Class) {\n if (!(obj instanceof Class)) throw new TypeError(\n \"'searchParams' accessed on an object that \" +\n \"does not implement interface \" + Class.name\n );\n },\n upgradeClass = function (Class) {\n var\n ClassProto = Class.prototype,\n searchParams = gOPD(ClassProto, 'searchParams'),\n href = gOPD(ClassProto, 'href'),\n search = gOPD(ClassProto, 'search'),\n createSearchParams\n ;\n if (!searchParams && search && search.set) {\n createSearchParams = createSearchParamsCreate(\n createSearchParamsPollute(search)\n );\n Object.defineProperties(\n ClassProto,\n {\n href: {\n get: function () {\n return href.get.call(this);\n },\n set: function (value) {\n var sp = this._searchParams;\n href.set.call(this, value);\n if (sp) updateSearchParams(sp);\n }\n },\n search: {\n get: function () {\n return search.get.call(this);\n },\n set: function (value) {\n var sp = this._searchParams;\n search.set.call(this, value);\n if (sp) updateSearchParams(sp);\n }\n },\n searchParams: {\n get: function () {\n verifySearchParams(this, Class);\n return this._searchParams || createSearchParams(\n this,\n new URLSearchParams(this.search.slice(1))\n );\n },\n set: function (sp) {\n verifySearchParams(this, Class);\n createSearchParams(this, sp);\n }\n }\n }\n );\n }\n }\n ;\n try {\n upgradeClass(HTMLAnchorElement);\n if (/^function|object$/.test(typeof URL) && URL.prototype)\n upgradeClass(URL);\n } catch (meh) {}\n }(Object));\n\n}(self.URLSearchParams.prototype, Object));\nexport default self.URLSearchParams;\n"],"names":["self","URLSearchParams","plus","get","q","toString","Object","String","isArray","create","defineProperty","find","findPercentSign","replace","!","'","(",")","~","%20","%00","proto","append","key","value","appendTo","this","_ungap","delete","has","getAll","slice","set","forEach","callback","thisArg","invoke","call","toJSON","query","encoded","encode","i","length","push","join","prototype","configurable","writable","dict","charAt","pairs","split","index","indexOf","decode","addEach","res","str","decodeURIComponent","encodeURIComponent","replacer","match","Array","URLSearchParamsProto","iterable","Symbol","iterator","o_O","items","next","shift","done","names","name","keys","values","entries","sort","entry","dP","gOPD","getOwnPropertyDescriptor","updateSearchParams","sp","_usp","search","verifySearchParams","obj","Class","TypeError","upgradeClass","createSearchParams","polluteSearchParams","ClassProto","searchParams","href","del","createSearchParamsPollute","defineProperties","_searchParams","HTMLAnchorElement","test","URL","meh"],"mappings":"0ioBACA,IAAIA,EAA0C,GAC9C,KACG,SAAUC,EAAiBC,GAC1B,GACE,IAAID,EAAgB,SAASE,IAAI,OAASD,GAC1C,IAAID,EAAgB,CAACG,EAAGF,IAAOC,IAAI,OAASD,GAC5C,IAAID,EAAgB,CAAC,CAAC,IAAKC,KAAQC,IAAI,OAASD,GACL,UAA3C,IAAID,EAAgB,QAAQI,YACkB,WAA9C,IAAIJ,EAAgB,CAACG,EAAG,OAAOC,YACgB,YAA/C,IAAIJ,EAAgB,CAACG,EAAG,QAAQC,WAEhC,MAAMJ,EACRD,EAAKC,gBAAkBA,EAVzB,CAWEA,gBAAiB,KACnB,MAAMA,IACL,SAAUK,EAAQC,EAAQC,GACzB,IAAIC,EAASH,EAAOG,OAChBC,EAAiBJ,EAAOI,eACxBC,EAAO,qBACPC,EAAkB,uBAClBV,EAAO,MACPW,EAAU,CACZC,IAAK,MACLC,IAAK,MACLC,IAAK,MACLC,IA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D,KAAMX,EAAQ,IAAMA,EAAQ,IAEnD,OAAO,SAAUU,EAAI5D,GAInB,OAHA4D,EAAG9D,OAASA,EACZ8D,EAAGxD,OAASqE,EACZb,EAAGpD,IAAMA,EACFgD,EAAGI,EAAI,OAAQ,CACpBrC,cAAc,EACdC,UAAU,EACVxB,MAAOA,KAsCP0E,CAA0BZ,GAD5BM,EAhCK,SAAUJ,EAAKJ,GAQpB,OAPAJ,EACEQ,EAAK,gBAAiB,CACpBzC,cAAc,EACdC,UAAU,EACVxB,MAAOqE,EAAoBT,EAAII,KAG5BJ,GA2BP9E,EAAO6F,iBACLL,EACA,CACEE,KAAM,CACJ7F,IAAK,WACH,OAAO6F,EAAK7F,IAAIkC,KAAKX,OAEvBM,IAAK,SAAUR,GACb,IAAI4D,EAAK1D,KAAK0E,cACdJ,EAAKhE,IAAIK,KAAKX,KAAMF,GAChB4D,GAAID,EAAmBC,KAG/BE,OAAQ,CACNnF,IAAK,WACH,OAAOmF,EAAOnF,IAAIkC,KAAKX,OAEzBM,IAAK,SAAUR,GACb,IAAI4D,EAAK1D,KAAK0E,cACdd,EAAOtD,IAAIK,KAAKX,KAAMF,GAClB4D,GAAID,EAAmBC,KAG/BW,aAAc,CACZ5F,IAAK,WAEH,OADAoF,EAAmB7D,KAAM+D,GAClB/D,KAAK0E,eAAiBR,EAC3BlE,KACA,IAAIzB,gBAAgByB,KAAK4D,OAAOvD,MAAM,MAG1CC,IAAK,SAAUoD,GACbG,EAAmB7D,KAAM+D,GACzBG,EAAmBlE,KAAM0D,SAQvC,IACEO,EAAaU,mBACT,oBAAoBC,YAAYC,MAAQA,IAAIzD,WAC9C6C,EAAaY,KACf,MAAOC,KAhHX,CAiHElG,QApNJ,CAsNEN,EAAKC,gBAAgB6C,WACvB,MAAe9C,EAAKC"}
|
|
1
|
+
{"version":3,"file":"squatch.modern.js","sources":["../node_modules/@ungap/url-search-params/esm/index.js"],"sourcesContent":["/*! (c) Andrea Giammarchi - ISC */\nvar self = this || /* istanbul ignore next */ {};\ntry {\n (function (URLSearchParams, plus) {\n if (\n new URLSearchParams('q=%2B').get('q') !== plus ||\n new URLSearchParams({q: plus}).get('q') !== plus ||\n new URLSearchParams([['q', plus]]).get('q') !== plus ||\n new URLSearchParams('q=\\n').toString() !== 'q=%0A' ||\n new URLSearchParams({q: ' &'}).toString() !== 'q=+%26' ||\n new URLSearchParams({q: '%zx'}).toString() !== 'q=%25zx'\n )\n throw URLSearchParams;\n self.URLSearchParams = URLSearchParams;\n }(URLSearchParams, '+'));\n} catch(URLSearchParams) {\n (function (Object, String, isArray) {'use strict';\n var create = Object.create;\n var defineProperty = Object.defineProperty;\n var find = /[!'\\(\\)~]|%20|%00/g;\n var findPercentSign = /%(?![0-9a-fA-F]{2})/g;\n var plus = /\\+/g;\n var replace = {\n '!': '%21',\n \"'\": '%27',\n '(': '%28',\n ')': '%29',\n '~': '%7E',\n '%20': '+',\n '%00': '\\x00'\n };\n var proto = {\n append: function (key, value) {\n appendTo(this._ungap, key, value);\n },\n delete: function (key) {\n delete this._ungap[key];\n },\n get: function (key) {\n return this.has(key) ? this._ungap[key][0] : null;\n },\n getAll: function (key) {\n return this.has(key) ? this._ungap[key].slice(0) : [];\n },\n has: function (key) {\n return key in this._ungap;\n },\n set: function (key, value) {\n this._ungap[key] = [String(value)];\n },\n forEach: function (callback, thisArg) {\n var self = this;\n for (var key in self._ungap)\n self._ungap[key].forEach(invoke, key);\n function invoke(value) {\n callback.call(thisArg, value, String(key), self);\n }\n },\n toJSON: function () {\n return {};\n },\n toString: function () {\n var query = [];\n for (var key in this._ungap) {\n var encoded = encode(key);\n for (var\n i = 0,\n value = this._ungap[key];\n i < value.length; i++\n ) {\n query.push(encoded + '=' + encode(value[i]));\n }\n }\n return query.join('&');\n }\n };\n for (var key in proto)\n defineProperty(URLSearchParams.prototype, key, {\n configurable: true,\n writable: true,\n value: proto[key]\n });\n self.URLSearchParams = URLSearchParams;\n function URLSearchParams(query) {\n var dict = create(null);\n defineProperty(this, '_ungap', {value: dict});\n switch (true) {\n case !query:\n break;\n case typeof query === 'string':\n if (query.charAt(0) === '?') {\n query = query.slice(1);\n }\n for (var\n pairs = query.split('&'),\n i = 0,\n length = pairs.length; i < length; i++\n ) {\n var value = pairs[i];\n var index = value.indexOf('=');\n if (-1 < index) {\n appendTo(\n dict,\n decode(value.slice(0, index)),\n decode(value.slice(index + 1))\n );\n } else if (value.length){\n appendTo(\n dict,\n decode(value),\n ''\n );\n }\n }\n break;\n case isArray(query):\n for (var\n i = 0,\n length = query.length; i < length; i++\n ) {\n var value = query[i];\n appendTo(dict, value[0], value[1]);\n }\n break;\n case 'forEach' in query:\n query.forEach(addEach, dict);\n break;\n default:\n for (var key in query)\n appendTo(dict, key, query[key]);\n }\n }\n\n function addEach(value, key) {\n appendTo(this, key, value);\n }\n\n function appendTo(dict, key, value) {\n var res = isArray(value) ? value.join(',') : value;\n if (key in dict)\n dict[key].push(res);\n else\n dict[key] = [res];\n }\n\n function decode(str) {\n return decodeURIComponent(str.replace(findPercentSign, '%25').replace(plus, ' '));\n }\n\n function encode(str) {\n return encodeURIComponent(str).replace(find, replacer);\n }\n\n function replacer(match) {\n return replace[match];\n }\n\n }(Object, String, Array.isArray));\n}\n\n(function (URLSearchParamsProto) {\n\n var iterable = false;\n try { iterable = !!Symbol.iterator; } catch (o_O) {}\n\n /* istanbul ignore else */\n if (!('forEach' in URLSearchParamsProto)) {\n URLSearchParamsProto.forEach = function forEach(callback, thisArg) {\n var self = this;\n var names = Object.create(null);\n this.toString()\n .replace(/=[\\s\\S]*?(?:&|$)/g, '=')\n .split('=')\n .forEach(function (name) {\n if (!name.length || name in names)\n return;\n (names[name] = self.getAll(name)).forEach(function(value) {\n callback.call(thisArg, value, name, self);\n });\n });\n };\n }\n\n /* istanbul ignore else */\n if (!('keys' in URLSearchParamsProto)) {\n URLSearchParamsProto.keys = function keys() {\n return iterator(this, function(value, key) { this.push(key); });\n };\n }\n\n /* istanbul ignore else */\n if (!('values' in URLSearchParamsProto)) {\n URLSearchParamsProto.values = function values() {\n return iterator(this, function(value, key) { this.push(value); });\n };\n }\n\n /* istanbul ignore else */\n if (!('entries' in URLSearchParamsProto)) {\n URLSearchParamsProto.entries = function entries() {\n return iterator(this, function(value, key) { this.push([key, value]); });\n };\n }\n\n /* istanbul ignore else */\n if (iterable && !(Symbol.iterator in URLSearchParamsProto)) {\n URLSearchParamsProto[Symbol.iterator] = URLSearchParamsProto.entries;\n }\n\n /* istanbul ignore else */\n if (!('sort' in URLSearchParamsProto)) {\n URLSearchParamsProto.sort = function sort() {\n var\n entries = this.entries(),\n entry = entries.next(),\n done = entry.done,\n keys = [],\n values = Object.create(null),\n i, key, value\n ;\n while (!done) {\n value = entry.value;\n key = value[0];\n keys.push(key);\n if (!(key in values)) {\n values[key] = [];\n }\n values[key].push(value[1]);\n entry = entries.next();\n done = entry.done;\n }\n // not the champion in efficiency\n // but these two bits just do the job\n keys.sort();\n for (i = 0; i < keys.length; i++) {\n this.delete(keys[i]);\n }\n for (i = 0; i < keys.length; i++) {\n key = keys[i];\n this.append(key, values[key].shift());\n }\n };\n }\n\n function iterator(self, callback) {\n var items = [];\n self.forEach(callback, items);\n /* istanbul ignore next */\n return iterable ?\n items[Symbol.iterator]() :\n {\n next: function() {\n var value = items.shift();\n return {done: value === void 0, value: value};\n }\n };\n }\n\n /* istanbul ignore next */\n (function (Object) {\n var\n dP = Object.defineProperty,\n gOPD = Object.getOwnPropertyDescriptor,\n createSearchParamsPollute = function (search) {\n function append(name, value) {\n URLSearchParamsProto.append.call(this, name, value);\n name = this.toString();\n search.set.call(this._usp, name ? ('?' + name) : '');\n }\n function del(name) {\n URLSearchParamsProto.delete.call(this, name);\n name = this.toString();\n search.set.call(this._usp, name ? ('?' + name) : '');\n }\n function set(name, value) {\n URLSearchParamsProto.set.call(this, name, value);\n name = this.toString();\n search.set.call(this._usp, name ? ('?' + name) : '');\n }\n return function (sp, value) {\n sp.append = append;\n sp.delete = del;\n sp.set = set;\n return dP(sp, '_usp', {\n configurable: true,\n writable: true,\n value: value\n });\n };\n },\n createSearchParamsCreate = function (polluteSearchParams) {\n return function (obj, sp) {\n dP(\n obj, '_searchParams', {\n configurable: true,\n writable: true,\n value: polluteSearchParams(sp, obj)\n }\n );\n return sp;\n };\n },\n updateSearchParams = function (sp) {\n var append = sp.append;\n sp.append = URLSearchParamsProto.append;\n URLSearchParams.call(sp, sp._usp.search.slice(1));\n sp.append = append;\n },\n verifySearchParams = function (obj, Class) {\n if (!(obj instanceof Class)) throw new TypeError(\n \"'searchParams' accessed on an object that \" +\n \"does not implement interface \" + Class.name\n );\n },\n upgradeClass = function (Class) {\n var\n ClassProto = Class.prototype,\n searchParams = gOPD(ClassProto, 'searchParams'),\n href = gOPD(ClassProto, 'href'),\n search = gOPD(ClassProto, 'search'),\n createSearchParams\n ;\n if (!searchParams && search && search.set) {\n createSearchParams = createSearchParamsCreate(\n createSearchParamsPollute(search)\n );\n Object.defineProperties(\n ClassProto,\n {\n href: {\n get: function () {\n return href.get.call(this);\n },\n set: function (value) {\n var sp = this._searchParams;\n href.set.call(this, value);\n if (sp) updateSearchParams(sp);\n }\n },\n search: {\n get: function () {\n return search.get.call(this);\n },\n set: function (value) {\n var sp = this._searchParams;\n search.set.call(this, value);\n if (sp) updateSearchParams(sp);\n }\n },\n searchParams: {\n get: function () {\n verifySearchParams(this, Class);\n return this._searchParams || createSearchParams(\n this,\n new URLSearchParams(this.search.slice(1))\n );\n },\n set: function (sp) {\n verifySearchParams(this, Class);\n createSearchParams(this, sp);\n }\n }\n }\n );\n }\n }\n ;\n try {\n upgradeClass(HTMLAnchorElement);\n if (/^function|object$/.test(typeof URL) && URL.prototype)\n upgradeClass(URL);\n } catch (meh) {}\n }(Object));\n\n}(self.URLSearchParams.prototype, Object));\nexport default self.URLSearchParams;\n"],"names":["self","URLSearchParams","plus","get","q","toString","Object","String","isArray","create","defineProperty","find","findPercentSign","replace","!","'","(",")","~","%20","%00","proto","append","key","value","appendTo","this","_ungap","delete","has","getAll","slice","set","forEach","callback","thisArg","invoke","call","toJSON","query","encoded","encode","i","length","push","join","prototype","configurable","writable","dict","charAt","pairs","split","index","indexOf","decode","addEach","res","str","decodeURIComponent","encodeURIComponent","replacer","match","Array","URLSearchParamsProto","iterable","Symbol","iterator","o_O","items","next","shift","done","names","name","keys","values","entries","sort","entry","dP","gOPD","getOwnPropertyDescriptor","updateSearchParams","sp","_usp","search","verifySearchParams","obj","Class","TypeError","upgradeClass","createSearchParams","polluteSearchParams","ClassProto","searchParams","href","del","createSearchParamsPollute","defineProperties","_searchParams","HTMLAnchorElement","test","URL","meh"],"mappings":"sooBACA,IAAIA,EAA0C,GAC9C,KACG,SAAUC,EAAiBC,GAC1B,GACE,IAAID,EAAgB,SAASE,IAAI,OAASD,GAC1C,IAAID,EAAgB,CAACG,EAAGF,IAAOC,IAAI,OAASD,GAC5C,IAAID,EAAgB,CAAC,CAAC,IAAKC,KAAQC,IAAI,OAASD,GACL,UAA3C,IAAID,EAAgB,QAAQI,YACkB,WAA9C,IAAIJ,EAAgB,CAACG,EAAG,OAAOC,YACgB,YAA/C,IAAIJ,EAAgB,CAACG,EAAG,QAAQC,WAEhC,MAAMJ,EACRD,EAAKC,gBAAkBA,EAVzB,CAWEA,gBAAiB,KACnB,MAAMA,IACL,SAAUK,EAAQC,EAAQC,GACzB,IAAIC,EAASH,EAAOG,OAChBC,EAAiBJ,EAAOI,eACxBC,EAAO,qBACPC,EAAkB,uBAClBV,EAAO,MACPW,EAAU,CACZC,IAAK,MACLC,IAAK,MACLC,IAAK,MACLC,IAAK,MACLC,IAAK,MACLC,MAAO,IACPC,MAAO,MAELC,EAAQ,CACVC,OAAQ,SAAUC,EAAKC,GACrBC,EAASC,KAAKC,OAAQJ,EAAKC,IAE7BI,OAAQ,SAAUL,UACTG,KAAKC,OAAOJ,IAErBpB,IAAK,SAAUoB,GACb,OAAOG,KAAKG,IAAIN,GAAOG,KAAKC,OAAOJ,GAAK,GAAK,MAE/CO,OA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