@saasquatch/squatch-js 2.8.3-0 → 2.8.3-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -8
- package/coverage/clover.xml +630 -593
- package/coverage/coverage-final.json +22 -20
- package/coverage/lcov.info +1087 -997
- package/dist/squatch.cjs.js +275 -18
- package/dist/squatch.cjs.js.map +1 -1
- package/dist/squatch.esm.js +752 -438
- package/dist/squatch.esm.js.map +1 -1
- package/dist/squatch.js +70 -61
- package/dist/squatch.js.map +1 -1
- package/dist/squatch.min.js +2 -2
- package/dist/types.d.ts +134 -1
- package/dist/utils/logger.d.ts +4 -1
- package/dist/widgets/PopupWidget.d.ts +3 -2
- package/dist/widgets/SkeletonTemplate.d.ts +1 -3
- package/dist/widgets/Widget.d.ts +12 -1
- package/package.json +1 -2
- package/dist/SkeletonTemplate-CIRGs_GB.js +0 -258
- package/dist/SkeletonTemplate-CIRGs_GB.js.map +0 -1
- package/dist/SkeletonTemplate-hwDwv3Ys.cjs +0 -250
- package/dist/SkeletonTemplate-hwDwv3Ys.cjs.map +0 -1
package/dist/squatch.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var Ce=Object.defineProperty;var Ae=(o,t,e)=>t in o?Ce(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e;var l=(o,t,e)=>Ae(o,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let C=null;function Ie(o){const e=o.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");C=new RegExp(`^${e}$`)}function _e(){C=null}function k(o){const t=(...e)=>{C&&C.test(o)&&console.log(`[${o}]`,...e)};return Object.defineProperty(t,"enabled",{get(){return!!(C&&C.test(o))}}),t}/*! js-cookie v3.0.5 | MIT */function M(o){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var n in e)o[n]=e[n]}return o}var Te={read:function(o){return o[0]==='"'&&(o=o.slice(1,-1)),o.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(o){return encodeURIComponent(o).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function X(o,t){function e(i,s,r){if(!(typeof document>"u")){r=M({},t,r),typeof r.expires=="number"&&(r.expires=new Date(Date.now()+r.expires*864e5)),r.expires&&(r.expires=r.expires.toUTCString()),i=encodeURIComponent(i).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var a="";for(var d in r)r[d]&&(a+="; "+d,r[d]!==!0&&(a+="="+r[d].split(";")[0]));return document.cookie=i+"="+o.write(s,i)+a}}function n(i){if(!(typeof document>"u"||arguments.length&&!i)){for(var s=document.cookie?document.cookie.split("; "):[],r={},a=0;a<s.length;a++){var d=s[a].split("="),c=d.slice(1).join("=");try{var h=decodeURIComponent(d[0]);if(r[h]=o.read(c,h),i===h)break}catch{}}return i?r[i]:r}}return Object.create({set:e,get:n,remove:function(i,s){e(i,"",M({},s,{expires:-1}))},withAttributes:function(i){return X(this.converter,M({},this.attributes,i))},withConverter:function(i){return X(M({},this.converter,i),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(o)}})}var D=X(Te,{path:"/"});const A="https://app.referralsaasquatch.com",Q="https://fast.ssqt.io/npm",L="squatch",V="impact";function P(o){if(typeof o!="object")throw new Error("config must be an object");const t=window.squatchTenant,e=Z(),n={tenantAlias:(o==null?void 0:o.tenantAlias)||t,domain:(o==null?void 0:o.domain)||(e==null?void 0:e.domain),npmCdn:(o==null?void 0:o.npmCdn)||(e==null?void 0:e.npmCdn),debug:(o==null?void 0:o.debug)||(e==null?void 0:e.debug)};if(typeof n.tenantAlias!="string")throw new Error("tenantAlias not provided");const i=n.tenantAlias,s=typeof n.domain=="string"&&n.domain||A,r=typeof n.debug=="boolean"&&n.debug||!1,a=typeof n.npmCdn=="string"&&n.npmCdn||Q;return{tenantAlias:i,domain:s,debug:r,npmCdn:a}}function I(o){return typeof o=="object"&&!Array.isArray(o)&&o!==null}function We(o){if(o&&/^[a-z]{2}_(?:[A-Z]{2}|[0-9]{3})$/.test(o))return o}function he(o){if(!I(o))throw new Error("Widget properties must be an object");if(!(o!=null&&o.user))throw new Error("Required properties missing.");return o}function ue(o){if(!I(o))throw new Error("Widget properties must be an object");return o}function R(){return window.impactToken||window.squatchToken}function Z(){return window.impactConfig||window.squatchConfig}async function $e(o,t,e,n){const i=n||R(),s={Accept:"application/json","Content-Type":"application/json",...i?{Authorization:`Bearer ${i}`}:{},"X-SaaSquatch-Referrer":window?window.location.href:""};try{const r=await fetch(o,{method:"POST",body:JSON.stringify({query:t,variables:e}),headers:s});if(!r.ok)throw new Error(await r.text());return await r.json()}catch(r){throw r}}async function qe(o,t=""){const e={Accept:"application/json","Content-Type":"application/json"},n=t||R();n&&(e["X-SaaSquatch-User-Token"]=n);try{const i=await fetch(o,{method:"GET",credentials:"include",headers:e}),s=await i.text();if(!i.ok)throw new Error(s);return s&&JSON.parse(s)}catch(i){throw i}}async function Y(o,t,e){const n={Accept:"application/json","Content-Type":"application/json"},i=e||R();i&&(n["X-SaaSquatch-User-Token"]=i);try{const s=await fetch(o,{method:"POST",body:t,headers:n}),r=await s.text();if(!s.ok)throw new Error(r);return r&&JSON.parse(r)}catch(s){throw s}}async function Se(o,t,e){const n={Accept:"application/json","Content-Type":"application/json","X-SaaSquatch-Referrer":window?window.location.href:""},i=e||R();i&&(n["X-SaaSquatch-User-Token"]=i);try{const s=await fetch(o,{headers:n,method:"PUT",credentials:"include",body:t}),r=await s.text();if(!s.ok)throw new Error(r);return r&&JSON.parse(r)}catch(s){throw s}}const Pe=`
|
|
2
2
|
query renderWidget ($user: UserIdInput, $engagementMedium: UserEngagementMedium, $widgetType: WidgetType, $locale: RSLocale) {
|
|
3
3
|
renderWidget(user: $user, engagementMedium: $engagementMedium, widgetType: $widgetType, locale: $locale) {
|
|
4
4
|
template
|
|
@@ -12,17 +12,265 @@
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
`;class
|
|
15
|
+
`;class z{constructor(t){l(this,"tenantAlias");l(this,"domain");l(this,"npmCdn");l(this,"referralCookie",this.squatchReferralCookie);const n=P(t);this.tenantAlias=n.tenantAlias,this.domain=n.domain,this.npmCdn=n.npmCdn}upsertUser(t){const n=he(t),{widgetType:i,engagementMedium:s="POPUP",jwt:r,locale:a,user:d}=n,c=encodeURIComponent(this.tenantAlias),h=d.accountId?encodeURIComponent(d.accountId):null,u=d.id?encodeURIComponent(d.id):null,p=Re({widgetType:i,engagementMedium:s,locale:a}),g=`/api/v1/${c}/widget/account/${h}/user/${u}/upsert${p}`,m=this.domain+g,w=(D||window.Cookies).get("_saasquatch");return w&&(d.cookies=w),Se(m,JSON.stringify(d),r)}render(t){const n=ue(t),{widgetType:i,engagementMedium:s="POPUP",jwt:r,user:a}=n,d=encodeURIComponent(this.tenantAlias),c=a!=null&&a.accountId?encodeURIComponent(a.accountId):null,h=a!=null&&a.id?encodeURIComponent(a.id):null,u=n.locale??We(navigator.language.replace(/\-/g,"_")),p=`/api/v1/${d}/graphql`,g=this.domain+p;return new Promise(async(m,w)=>{var b;try{const f=await $e(g,Pe,{user:h&&c?{id:h,accountId:c}:null,engagementMedium:s,widgetType:i,locale:u},r);m((b=f==null?void 0:f.data)==null?void 0:b.renderWidget)}catch(f){w(f)}})}async squatchReferralCookie(){const t=encodeURIComponent(this.tenantAlias),e=(D||window.Cookies).get("_saasquatch")||"",n=e?`?cookies=${encodeURIComponent(e)}`:"",i=`${this.domain}/a/${t}/widgets/squatchcookiejson${n}`,s=await qe(i);return Promise.resolve({...s,encodedCookie:e})}}function Re({widgetType:o,engagementMedium:t,locale:e}){const n=new URLSearchParams;return n.append("engagementMedium",t),o&&n.append("widgetType",o),e&&n.append("locale",e),`?${n.toString()}`}/*!
|
|
16
16
|
* domready (c) Dustin Diaz 2014 - License MIT
|
|
17
17
|
*
|
|
18
|
-
*/function
|
|
18
|
+
*/function K(o,t){let e=[],n,i=o,s=i.documentElement.doScroll,r="DOMContentLoaded",a=(s?/^loaded|^c/:/^loaded|^i|^c/).test(i.readyState);return a||i.addEventListener(r,n=()=>{for(i.removeEventListener(r,n),a=!0;n=e.shift();)n()}),a?setTimeout(t,0):e.push(t)}function N({value:o,unit:t}){switch(t){case"px":return`${o}px`;case"%":return`${o}%`;default:return`${o}px`}}class pe{constructor(t){l(this,"domain");var i;const n=Ue(t);this.domain=(n==null?void 0:n.domain)||((i=Z())==null?void 0:i.domain)||A}pushAnalyticsLoadEvent(t){if(!t.externalUserId||!t.externalAccountId)return;const e=encodeURIComponent(t.tenantAlias),n=encodeURIComponent(t.externalAccountId),i=encodeURIComponent(t.externalUserId),s=encodeURIComponent(t.engagementMedium),r=t.programId?`&programId=${encodeURIComponent(t.programId)}`:"",a=`/a/${e}/widgets/analytics/loaded?externalAccountId=${n}&externalUserId=${i}&engagementMedium=${s}${r}`,d=this.domain+a;return Y(d,JSON.stringify({}))}pushAnalyticsShareClickedEvent(t){const e=encodeURIComponent(t.tenantAlias),n=encodeURIComponent(t.externalAccountId),i=encodeURIComponent(t.externalUserId),s=encodeURIComponent(t.engagementMedium),r=encodeURIComponent(t.shareMedium),a=`/a/${e}/widgets/analytics/shared?externalAccountId=${n}&externalUserId=${i}&engagementMedium=${s}&shareMedium=${r}`,d=this.domain+a;return Y(d,JSON.stringify({}))}}function Ue(o){if(!I(o))throw new Error("'options' should be an object");return o}const me=({type:o="verified-access",height:t="500px"})=>{const e="#e0e0e0";return`
|
|
19
|
+
<style>
|
|
20
|
+
* {
|
|
21
|
+
box-sizing: border-box;
|
|
22
|
+
padding: 0;
|
|
23
|
+
margin: 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.widget-container {
|
|
27
|
+
background: white;
|
|
28
|
+
width: 100%;
|
|
29
|
+
padding: 40px;
|
|
30
|
+
box-sizing: border-box;
|
|
31
|
+
overflow: hidden;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@keyframes shimmer {
|
|
35
|
+
0% { background-position: -100% 0; }
|
|
36
|
+
100% { background-position: 100% 0; }
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.skeleton {
|
|
40
|
+
background: ${e};
|
|
41
|
+
background: linear-gradient(
|
|
42
|
+
90deg,
|
|
43
|
+
${e} 25%,
|
|
44
|
+
#f5f5f5 50%,
|
|
45
|
+
${e} 75%
|
|
46
|
+
);
|
|
47
|
+
background-size: 200% 100%;
|
|
48
|
+
animation: shimmer 1.5s infinite linear;
|
|
49
|
+
border-radius: 6px;
|
|
50
|
+
margin-bottom: 12px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* Typography Skeletons */
|
|
54
|
+
.sk-title-lg { height: 36px; width: 80%; margin-bottom: 16px; }
|
|
55
|
+
.sk-title-md { height: 28px; width: 30%; margin-bottom: 20px; margin-top: 40px; }
|
|
56
|
+
.sk-text { height: 16px; width: 90%; margin-bottom: 8px; }
|
|
57
|
+
.sk-text-short { width: 40%; }
|
|
58
|
+
.sk-label { height: 14px; width: 25%; margin-bottom: 10px; }
|
|
59
|
+
|
|
60
|
+
/* Layouts */
|
|
61
|
+
.hero-section {
|
|
62
|
+
display: flex;
|
|
63
|
+
gap: 40px;
|
|
64
|
+
margin-bottom: 40px;
|
|
65
|
+
padding-bottom: 40px;
|
|
66
|
+
flex-direction: row;
|
|
67
|
+
height: 100%;
|
|
68
|
+
/* Removed border-bottom */
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.hero-content {
|
|
72
|
+
flex: 1;
|
|
73
|
+
display: flex;
|
|
74
|
+
flex-direction: column;
|
|
75
|
+
justify-content: center;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.hero-image {
|
|
79
|
+
flex: 1;
|
|
80
|
+
height: 300px;
|
|
81
|
+
border-radius: 12px;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* -- Specific Instant Access Overrides -- */
|
|
85
|
+
.instant-access-layout {
|
|
86
|
+
margin-bottom: 0;
|
|
87
|
+
padding-bottom: 0;
|
|
88
|
+
align-items: center;
|
|
89
|
+
}
|
|
90
|
+
.ia-image {
|
|
91
|
+
height: 400px;
|
|
92
|
+
}
|
|
93
|
+
.ia-center {
|
|
94
|
+
margin-left: auto;
|
|
95
|
+
margin-right: auto;
|
|
96
|
+
}
|
|
97
|
+
.ia-content {
|
|
98
|
+
align-items: center;
|
|
99
|
+
text-align: center;
|
|
100
|
+
}
|
|
101
|
+
.sk-btn-action {
|
|
102
|
+
height: 45px;
|
|
103
|
+
width: 140px;
|
|
104
|
+
border-radius: 6px;
|
|
105
|
+
margin: 24px auto;
|
|
106
|
+
}
|
|
107
|
+
.input-group {
|
|
108
|
+
display: flex;
|
|
109
|
+
gap: 10px;
|
|
110
|
+
width: 100%;
|
|
111
|
+
max-width: 400px;
|
|
112
|
+
}
|
|
113
|
+
.sk-btn-copy {
|
|
114
|
+
height: 50px;
|
|
115
|
+
width: 120px;
|
|
116
|
+
border-radius: 8px;
|
|
117
|
+
}
|
|
118
|
+
/* ------------------------------------- */
|
|
119
|
+
|
|
120
|
+
.share-section { margin-bottom: 40px; }
|
|
121
|
+
.sk-input { height: 50px; width: 100%; border-radius: 8px; margin-bottom: 16px; }
|
|
122
|
+
|
|
123
|
+
.social-buttons { display: flex; gap: 12px; }
|
|
124
|
+
.sk-btn-social { flex: 1; height: 50px; border-radius: 8px; }
|
|
125
|
+
|
|
126
|
+
.stats-section {
|
|
127
|
+
display: flex;
|
|
128
|
+
gap: 24px;
|
|
129
|
+
margin-bottom: 40px;
|
|
130
|
+
padding: 30px 0;
|
|
131
|
+
/* Removed border-top and border-bottom */
|
|
132
|
+
}
|
|
133
|
+
.stat-card { flex: 1; display: flex; flex-direction: column; align-items: center; }
|
|
134
|
+
.stat-divider { padding-left: 24px; }
|
|
135
|
+
.sk-stat-num { height: 48px; width: 120px; margin-bottom: 8px; }
|
|
136
|
+
.sk-stat-label { height: 18px; width: 80px; }
|
|
137
|
+
|
|
138
|
+
/* Table Styles */
|
|
139
|
+
.table-header { display: flex; gap: 16px; margin-bottom: 16px; }
|
|
140
|
+
.sk-th { height: 16px; }
|
|
141
|
+
.table-row {
|
|
142
|
+
display: flex;
|
|
143
|
+
align-items: center;
|
|
144
|
+
gap: 16px;
|
|
145
|
+
padding: 16px 0;
|
|
146
|
+
/* Removed border-bottom */
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.col-user { flex: 2; }
|
|
150
|
+
.col-status { flex: 1; }
|
|
151
|
+
.col-reward { flex: 2; }
|
|
152
|
+
.col-date { flex: 1; }
|
|
153
|
+
|
|
154
|
+
.sk-badge { height: 28px; width: 90px; border-radius: 14px; }
|
|
155
|
+
.sk-reward-block { height: 36px; width: 100%; border-radius: 6px; }
|
|
156
|
+
|
|
157
|
+
.pagination { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
|
|
158
|
+
.sk-btn-page { height: 36px; width: 64px; border-radius: 6px; margin-bottom: 0; }
|
|
159
|
+
|
|
160
|
+
@media (max-width: 768px) {
|
|
161
|
+
body { padding: 20px; }
|
|
162
|
+
.widget-container { padding: 24px; }
|
|
163
|
+
|
|
164
|
+
.hero-section { flex-direction: column-reverse; gap: 24px; }
|
|
165
|
+
.instant-access-layout { flex-direction: column; }
|
|
166
|
+
|
|
167
|
+
.hero-image { height: 220px; width: 100%; }
|
|
168
|
+
.sk-title-lg { width: 100%; }
|
|
169
|
+
|
|
170
|
+
.col-date { display: none; }
|
|
171
|
+
}
|
|
172
|
+
</style>
|
|
173
|
+
|
|
174
|
+
<div class="widget-container">
|
|
175
|
+
${o==="verified-access"?`
|
|
176
|
+
<div class="hero-section">
|
|
177
|
+
<div class="hero-content">
|
|
178
|
+
<div class="skeleton sk-title-lg"></div>
|
|
179
|
+
<div class="skeleton sk-text"></div>
|
|
180
|
+
<div class="skeleton sk-text sk-text-short"></div>
|
|
181
|
+
</div>
|
|
182
|
+
<div class="skeleton hero-image"></div>
|
|
183
|
+
</div>
|
|
184
|
+
|
|
185
|
+
<div class="share-section">
|
|
186
|
+
<div class="skeleton sk-label"></div>
|
|
187
|
+
<div class="skeleton sk-input"></div>
|
|
188
|
+
<div class="social-buttons">
|
|
189
|
+
<div class="skeleton sk-btn-social"></div>
|
|
190
|
+
<div class="skeleton sk-btn-social"></div>
|
|
191
|
+
<div class="skeleton sk-btn-social"></div>
|
|
192
|
+
<div class="skeleton sk-btn-social"></div>
|
|
193
|
+
</div>
|
|
194
|
+
</div>
|
|
195
|
+
|
|
196
|
+
<div class="skeleton sk-title-md" style="margin-top: 0; width: 30%; margin-left: auto; margin-right: auto"></div>
|
|
197
|
+
<div class="skeleton sk-text" style="width: 60%; margin-left: auto; margin-right: auto"></div>
|
|
198
|
+
|
|
199
|
+
<div class="stats-section">
|
|
200
|
+
<div class="stat-card">
|
|
201
|
+
<div class="skeleton sk-stat-num"></div>
|
|
202
|
+
<div class="skeleton sk-stat-label"></div>
|
|
203
|
+
</div>
|
|
204
|
+
<div class="stat-card stat-divider">
|
|
205
|
+
<div class="skeleton sk-stat-num"></div>
|
|
206
|
+
<div class="skeleton sk-stat-label"></div>
|
|
207
|
+
</div>
|
|
208
|
+
</div>
|
|
209
|
+
|
|
210
|
+
<div class="skeleton sk-title-md"></div>
|
|
211
|
+
|
|
212
|
+
<div class="table-header">
|
|
213
|
+
<div class="skeleton sk-th col-user"></div>
|
|
214
|
+
<div class="skeleton sk-th col-status"></div>
|
|
215
|
+
<div class="skeleton sk-th col-reward"></div>
|
|
216
|
+
<div class="skeleton sk-th col-date"></div>
|
|
217
|
+
</div>
|
|
218
|
+
|
|
219
|
+
<div class="table-row">
|
|
220
|
+
<div class="col-user"><div class="skeleton sk-text" style="width: 70%; margin: 0"></div></div>
|
|
221
|
+
<div class="col-status"><div class="skeleton sk-badge" style="margin: 0"></div></div>
|
|
222
|
+
<div class="col-reward"><div class="skeleton sk-reward-block" style="margin: 0"></div></div>
|
|
223
|
+
<div class="col-date"><div class="skeleton sk-text" style="width: 80%; margin: 0"></div></div>
|
|
224
|
+
</div>
|
|
225
|
+
|
|
226
|
+
<div class="table-row">
|
|
227
|
+
<div class="col-user"><div class="skeleton sk-text" style="width: 60%; margin: 0"></div></div>
|
|
228
|
+
<div class="col-status"><div class="skeleton sk-badge" style="margin: 0"></div></div>
|
|
229
|
+
<div class="col-reward"><div class="skeleton sk-reward-block" style="margin: 0"></div></div>
|
|
230
|
+
<div class="col-date"><div class="skeleton sk-text" style="width: 80%; margin: 0"></div></div>
|
|
231
|
+
</div>
|
|
232
|
+
|
|
233
|
+
<div class="table-row">
|
|
234
|
+
<div class="col-user"><div class="skeleton sk-text" style="width: 75%; margin: 0"></div></div>
|
|
235
|
+
<div class="col-status"><div class="skeleton sk-badge" style="margin: 0"></div></div>
|
|
236
|
+
<div class="col-reward"><div class="skeleton sk-reward-block" style="margin: 0"></div></div>
|
|
237
|
+
<div class="col-date"><div class="skeleton sk-text" style="width: 80%; margin: 0"></div></div>
|
|
238
|
+
</div>
|
|
239
|
+
|
|
240
|
+
<div class="pagination">
|
|
241
|
+
<div class="skeleton sk-btn-page"></div>
|
|
242
|
+
<div class="skeleton sk-btn-page"></div>
|
|
243
|
+
</div>
|
|
244
|
+
`:`
|
|
245
|
+
<div class="hero-section instant-access-layout">
|
|
246
|
+
<div class="skeleton hero-image ia-image"></div>
|
|
247
|
+
|
|
248
|
+
<div class="hero-content ia-content">
|
|
249
|
+
<div class="skeleton sk-title-lg ia-center"></div>
|
|
250
|
+
<div class="skeleton sk-text ia-center"></div>
|
|
251
|
+
|
|
252
|
+
<div class="skeleton sk-btn-action"></div>
|
|
253
|
+
|
|
254
|
+
<div class="skeleton sk-label"></div>
|
|
255
|
+
<div class="input-group">
|
|
256
|
+
<div class="skeleton sk-input"></div>
|
|
257
|
+
<div class="skeleton sk-btn-copy"></div>
|
|
258
|
+
</div>
|
|
259
|
+
|
|
260
|
+
<div class="skeleton sk-text-short ia-center" style="margin-top: 20px; width: 30%"></div>
|
|
261
|
+
<div class="skeleton sk-text-short ia-center" style="width: 20%"></div>
|
|
262
|
+
</div>
|
|
263
|
+
</div>
|
|
264
|
+
`}
|
|
265
|
+
</div>
|
|
266
|
+
`},Me=Object.freeze(Object.defineProperty({__proto__:null,getSkeleton:me},Symbol.toStringTag,{value:"Module"})),y=k("squatch-js:widget");class ge{constructor(t){l(this,"type");l(this,"content");l(this,"analyticsApi");l(this,"widgetApi");l(this,"context");l(this,"npmCdn");l(this,"container");l(this,"loadEventListener",null);var e;y("widget initializing ..."),this.content=t.content==="error"?this._error(t.rsCode):t.content,this.type=t.type,this.widgetApi=t.api,this.npmCdn=t.npmCdn,this.analyticsApi=new pe({domain:t.domain}),this.context=t.context,this.container=((e=t.context)==null?void 0:e.container)||t.container}_findElement(){let t;if(typeof this.container=="string"?(t=document.querySelector(this.container),y("loading widget with selector",t)):this.container instanceof HTMLElement?(t=this.container,y("loading widget with container",t)):this.container?(t=null,y("container must be an HTMLElement or string",this.container)):(t=document.querySelector("#squatchembed")||document.querySelector(".squatchembed")||document.querySelector("#impactembed")||document.querySelector(".impactembed"),y("loading widget with default selector",t)),!(t instanceof HTMLElement))throw new Error(`element with selector '${this.container||"#squatchembed, .squatchembed, #impactembed, or .impactembed"}' not found.'`);return t}_createFrame(t){const 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%; display: block;"),t!=null&&t.minWidth&&(e.style.minWidth=t.minWidth),t!=null&&t.maxWidth&&(e.style.maxWidth=t.maxWidth),(t!=null&&t.maxWidth||t!=null&&t.minWidth)&&(e.style.width="100%"),t!=null&&t.initialHeight&&(e.height=String(t.initialHeight)),e}_findFrame(){const t=this.container?this._findElement():document.body;return(t.shadowRoot||t).querySelector("iframe#squatchFrame")}_detachLoadEventListener(t){this.loadEventListener&&(t.removeEventListener("sq:user-registration",this.loadEventListener),this.loadEventListener=null)}_attachLoadEventListener(t,e){this.loadEventListener===null&&(this.loadEventListener=n=>{this._loadEvent({...e,userId:n.detail.userId,accountId:n.detail.accountId})},t.addEventListener("sq:user-registration",this.loadEventListener))}_loadEvent(t){var n;if(!t)return;if(!I(t))throw new Error("Widget Load event identity property is not an object");let e;if("programId"in t){if(!t.tenantAlias||!t.accountId||!t.userId||!t.engagementMedium)throw new Error("Widget Load event missing required properties");e={tenantAlias:t.tenantAlias,externalAccountId:t.accountId,externalUserId:t.userId,engagementMedium:t.engagementMedium,programId:t.programId}}else{const{analytics:i,mode:s}=t;e={tenantAlias:i.attributes.tenant,externalAccountId:i.attributes.accountId,externalUserId:i.attributes.userId,engagementMedium:s.widgetMode}}(n=this.analyticsApi.pushAnalyticsLoadEvent(e))==null||n.then(i=>{y(`${e.engagementMedium} loaded event recorded.`)}).catch(i=>{y(`ERROR: pushAnalyticsLoadEvent() ${i}`)})}_shareEvent(t,e){t&&this.analyticsApi.pushAnalyticsShareClickedEvent({tenantAlias:t.analytics.attributes.tenant,externalAccountId:t.analytics.attributes.accountId,externalUserId:t.analytics.attributes.userId,engagementMedium:t.mode.widgetMode,shareMedium:e}).then(n=>{y(`${t.mode.widgetMode} share ${e} event recorded. ${n}`)}).catch(n=>{y(`ERROR: pushAnalyticsShareClickedEvent() ${n}`)})}_error(t,e="modal",n=""){return`<!DOCTYPE html>
|
|
19
267
|
<!--[if IE 7]><html class="ie7 oldie" lang="en"><![endif]-->
|
|
20
268
|
<!--[if IE 8]><html class="ie8 oldie" lang="en"><![endif]-->
|
|
21
269
|
<!--[if gt IE 8]><!--><html lang="en"><!--<![endif]-->
|
|
22
270
|
<head>
|
|
23
271
|
<link rel="stylesheet" media="all" href="https://fast.ssqt.io/assets/css/widget/errorpage.css">
|
|
24
272
|
<style>
|
|
25
|
-
${
|
|
273
|
+
${n}
|
|
26
274
|
</style>
|
|
27
275
|
</head>
|
|
28
276
|
<body>
|
|
@@ -45,31 +293,40 @@
|
|
|
45
293
|
</div>
|
|
46
294
|
</div>
|
|
47
295
|
</body>
|
|
48
|
-
</html>`}async _findInnerContainer(t){const{contentWindow:e}=t;if(!e)throw new Error("Squatch.js frame inner frame is empty");const
|
|
49
|
-
|
|
50
|
-
|
|
296
|
+
</html>`}async _findInnerContainer(t){const{contentWindow:e}=t;if(!e)throw new Error("Squatch.js frame inner frame is empty");const n=e.document;function i(){const r=n.getElementsByTagName("sqh-global-container"),a=n.getElementsByClassName("squatch-container");return r.length>0?r[0]:a.length>0?a[0]:null}let s=null;for(let r=0;r<5&&(s=i(),!s);r++)await Le(100);return s||n.body}_getSkeletonPreloadHTML(t,e){if(!t)return"";const n=this.context.type==="passwordless"?"instant-access":"verified-access",i=me({type:n,height:"100%"});return`
|
|
297
|
+
<div id="sq-preload" style="visibility: visible; position: absolute; top: 0; left: 0; width: 100%; z-index: 9999; background: ${e||"white"};">
|
|
298
|
+
${i}
|
|
299
|
+
</div>
|
|
300
|
+
<script>(${Oe.toString()})()<\/script>
|
|
301
|
+
`}reload({email:t,firstName:e,lastName:n},i){const s=this._findFrame();if(!s)throw new Error("Could not find widget iframe");const r=s.contentWindow,a=this.context.engagementMedium||"POPUP";if(!r)throw new Error("Frame needs a content window");let d;if(this.context.type==="upsert"){if(!this.context.user)throw new Error("Can't reload without user ids");let c={email:t||null,firstName:e||null,lastName:n||null,id:this.context.user.id,accountId:this.context.user.accountId};d=this.widgetApi.upsertUser({user:c,engagementMedium:a,widgetType:this.type,jwt:i})}else if(this.context.type==="passwordless")d=this.widgetApi.render({user:void 0,engagementMedium:a,widgetType:this.type,jwt:void 0});else throw new Error("can't reload an error widget");d.then(({template:c})=>{c&&(this.content=c,this.__deprecated__register(s,{email:t,engagementMedium:a},()=>{this.load(),a==="POPUP"&&this.open()}))}).catch(({message:c})=>{y(`${c}`)})}__deprecated__register(t,e,n){const s=t.contentWindow.document,r=s.createElement("button"),a=s.getElementsByClassName("squatch-register")[0];if(a){r.className="btn btn-primary",r.id="show-stats-btn",r.textContent=this.type==="REFERRER_WIDGET"?"Show Stats":"Show Reward";const d=e.engagementMedium==="POPUP"?"margin-top: 10px; max-width: 130px; width: 100%;":"margin-top: 10px;";r.setAttribute("style",d),r.onclick=n,a.style.paddingTop="30px",a.innerHTML=`<p><strong>${e.email}</strong><br>Has been successfully registered</p>`,a.appendChild(r)}}}function Le(o){return new Promise(t=>{setTimeout(t,o)})}function Oe(){var o=setTimeout(t,1e4);function t(){var n=document.getElementById("sq-preload");n&&n.remove(),clearTimeout(o)}function e(){var n=new Set;if(document.querySelectorAll("*").forEach(function(i){i.tagName.includes("-")&&n.add(i.tagName.toLowerCase())}),!n.size)return t();Promise.all(Array.from(n).map(function(i){return customElements.whenDefined(i)})).then(function(){requestAnimationFrame(function(){requestAnimationFrame(t)})})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e):setTimeout(e,0)}const E=k("squatch-js:EMBEDwidget");class $ extends ge{constructor(e,n){super(e);l(this,"show",this.open);l(this,"hide",this.close);n&&(this.container=n)}async load(){var m,w,b,f,_,ne,ie,oe,se;const e=(w=(m=this.context.widgetConfig)==null?void 0:m.values)==null?void 0:w.brandingConfig,n=(b=this.content)==null?void 0:b.includes("mint-components"),i=(e==null?void 0:e.loadingHeight)||500,s=(f=e==null?void 0:e.widgetSize)==null?void 0:f.embeddedWidgets,r=s!=null&&s.maxWidth?N(s.maxWidth):"",a=s!=null&&s.minWidth?N(s.minWidth):"",d=this._createFrame({minWidth:a,maxWidth:r,initialHeight:i}),c=this._findElement();(_=this.context)!=null&&_.container&&(c.style.visibility="hidden",c.style.height="0",c.style["overflow-y"]="hidden"),this.container?c.shadowRoot?((ne=c.shadowRoot.lastChild)==null?void 0:ne.nodeName)==="IFRAME"?c.shadowRoot.replaceChild(d,c.shadowRoot.lastChild):c.shadowRoot.appendChild(d):c.firstChild?c.replaceChild(d,c.firstChild):c.appendChild(d):(!c.firstChild||c.firstChild.nodeName==="#text")&&c.appendChild(d);const{contentWindow:h}=d;if(!h)throw new Error("Frame needs a content window");const u=h.document;u.open();const g=this.widgetApi.domain==="https://staging.referralsaasquatch.com"?"-staging":"";u.write(`
|
|
302
|
+
${(ie=e==null?void 0:e.main)!=null&&ie.brandFont?`
|
|
303
|
+
<link rel="preconnect" href="https://fast${g}.ssqt.io">
|
|
51
304
|
<link rel="preconnect" href="https://fonts.gstatic.com">
|
|
52
305
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
53
|
-
<link rel="preload" href="https://fonts.googleapis.com/css2?family=${encodeURIComponent((
|
|
306
|
+
<link rel="preload" href="https://fonts.googleapis.com/css2?family=${encodeURIComponent((oe=e==null?void 0:e.main)==null?void 0:oe.brandFont)}" as="style">`:""}
|
|
54
307
|
<link rel="dns-prefetch" href="https://res.cloudinary.com">
|
|
55
308
|
<link rel="preconnect" href="https://res.cloudinary.com" crossorigin>
|
|
309
|
+
${n?`
|
|
56
310
|
<style data-styles>
|
|
57
|
-
html { visibility:hidden;}
|
|
58
|
-
</style
|
|
311
|
+
html { visibility: hidden; }
|
|
312
|
+
</style>`:""}
|
|
313
|
+
${this._getSkeletonPreloadHTML(n,(se=e==null?void 0:e.color)==null?void 0:se.backgroundColor)}
|
|
59
314
|
${this.content}
|
|
60
|
-
|
|
61
|
-
`),
|
|
62
|
-
${(
|
|
63
|
-
<link rel="preconnect" href="https://fast${
|
|
315
|
+
<script src="${this.npmCdn}/resize-observer-polyfill@1.5.x"><\/script>
|
|
316
|
+
`),u.close(),K(u,async()=>{const re=h.squatch||h.widgetIdent;d.height=i;const ve=new h.ResizeObserver(be=>{for(const xe of be){const{height:Ee}=xe.contentRect;d.height=Ee}}),ke=await this._findInnerContainer(d);ve.observe(ke),this._shouldFireLoadEvent()?(this._loadEvent(re),E("loaded")):u&&this._attachLoadEventListener(u,re)})}open(){const e=this._findFrame();if(!e)return E("no target element to open");if(!e.contentWindow)return E("Frame needs a content window");const n=this._findElement();n.style.visibility="unset",n.style.height="auto",n.style["overflow-y"]="auto",e.contentWindow.document.dispatchEvent(new CustomEvent("sq:refresh"));const i=e.contentWindow.squatch||e.contentWindow.widgetIdent;if(this.context.user)this._loadEvent(i),E("loaded");else{if(!e.contentDocument)return;this._attachLoadEventListener(e.contentDocument,i)}}close(){const e=this._findFrame();if(!e)return E("no target element to close");e.contentDocument&&this._detachLoadEventListener(e.contentDocument);const n=this._findElement();n.style.visibility="hidden",n.style.height="0",n.style["overflow-y"]="hidden",E("Embed widget closed")}_error(e,n="embed",i=""){return super._error(e,n,i)}_shouldFireLoadEvent(){const e=!this.container,n=this.container instanceof HTMLElement&&(this.container.tagName.startsWith("SQUATCH-")||this.container.tagName.startsWith("IMPACT-"));return!!this.context.user&&(e||n)}}const T=k("squatch-js:POPUPwidget");let O=0;class q extends ge{constructor(e,n=".squatchpop"){super(e);l(this,"trigger");l(this,"id");l(this,"show",this.open);l(this,"hide",this.close);this.trigger=n,this.container?this.id="squatchModal":(this.id=O===0?"squatchModal":`squatchModal__${O}`,O=O+1),document.head.insertAdjacentHTML("beforeend",`<style>#${this.id}::-webkit-scrollbar { display: none; }</style>`)}_initialiseCTA(){if(!this.trigger)return;let e;try{e=document.querySelector(this.trigger)||document.querySelector(".impactpop"),this.trigger&&!e&&T("No element found with trigger selector",this.trigger)}catch{T("Not a valid selector",this.trigger)}e&&(e.onclick=()=>{this.open()})}_createPopupDialog(e){var d;const n=document.createElement("dialog"),i=(d=e==null?void 0:e.widgetSize)==null?void 0:d.popupWidgets,s=i!=null&&i.minWidth?N(i.minWidth):"auto",r=i!=null&&i.maxWidth?N(i.maxWidth):"500px";n.id=this.id,n.setAttribute("style",`width: 100%; min-width: ${s}; max-width: ${r}; border: none; padding: 0;`);const a=c=>{c.stopPropagation(),c.target===n&&n.close()};return n.addEventListener("click",a),n}async load(){var p,g,m,w,b,f,_;const e=(g=(p=this.context.widgetConfig)==null?void 0:p.values)==null?void 0:g.brandingConfig,n=(e==null?void 0:e.loadingHeight)||500,i=(m=this.content)==null?void 0:m.includes("mint-components"),s=this._createFrame();s.style.height=n+"px",this._initialiseCTA();const r=this.container?this._findElement():document.body,a=(r==null?void 0:r.shadowRoot)||r,d=this._createPopupDialog(e);d.appendChild(s),((w=a.lastChild)==null?void 0:w.nodeName)==="DIALOG"?a.replaceChild(d,a.lastChild):a.appendChild(d);const{contentWindow:c}=s;if(!c)throw new Error("Frame needs a content window");const h=c.document;h.open();const u=this.widgetApi.domain;h.write(`
|
|
317
|
+
${(b=e==null?void 0:e.main)!=null&&b.brandFont?`
|
|
318
|
+
<link rel="preconnect" href="https://fast${u==="https://staging.referralsaasquatch.com"?"-staging":""}.ssqt.io">
|
|
64
319
|
<link rel="preconnect" href="https://fonts.gstatic.com">
|
|
65
320
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
66
321
|
<link rel="preload" href="https://fonts.googleapis.com/css2?family=${encodeURIComponent((f=e==null?void 0:e.main)==null?void 0:f.brandFont)}" as="style">`:""}
|
|
67
322
|
<link rel="dns-prefetch" href="https://res.cloudinary.com">
|
|
68
323
|
<link rel="preconnect" href="https://res.cloudinary.com" crossorigin>
|
|
324
|
+
${i?`
|
|
69
325
|
<style data-styles>
|
|
70
|
-
html { visibility:hidden;}
|
|
71
|
-
</style
|
|
326
|
+
html { visibility: hidden; }
|
|
327
|
+
</style>`:""}
|
|
328
|
+
${this._getSkeletonPreloadHTML(i,(_=e==null?void 0:e.color)==null?void 0:_.backgroundColor)}
|
|
72
329
|
${this.content}
|
|
73
|
-
|
|
74
|
-
`),d.close(),k("Popup template loaded into iframe"),await this._setupResizeHandler(n,i)}async _setupResizeHandler(e,i){const{contentWindow:n}=e;if(!n)throw new Error("Frame needs a content window");const s=n.document;Y(s,async()=>{s.body.style.overflowY="hidden",e.height=i||s.body.offsetHeight,new ResizeObserver(a=>{for(const c of a){const{top:d,bottom:h}=c.contentRect,u=h+d;e.height=u+"",c.target.style=""}}).observe(await this._findInnerContainer(e))})}open(){const e=this.container?this._findElement():document.body,n=(e.shadowRoot||e).querySelector(`#${this.id}`);if(!n)throw new Error("Could not determine container div");n.showModal();const s=this._findFrame();if(!s)throw new Error("Could not find iframe");const{contentWindow:r}=s;if(!r)throw new Error("Squatch.js has an empty iframe");const a=r.document;Y(a,()=>{var d;const c=r.squatch||r.widgetIdent;(d=s.contentDocument)==null||d.dispatchEvent(new CustomEvent("sq:refresh")),this.context.user?(this._loadEvent(c),k("Popup opened")):this._attachLoadEventListener(a,c)})}close(){const e=this._findFrame();e!=null&&e.contentDocument&&this._detachLoadEventListener(e.contentDocument);const i=this.container?this._findElement():document.body,s=(i.shadowRoot||i).querySelector(`#${this.id}`);if(!s)throw new Error("Could not determine container div");s.close(),k("Popup closed")}_clickedOutside({target:e}){}_error(e,i="modal",n=""){return super._error(e,i,n||"body { margin: 0; } .modal { box-shadow: none; border: 0; }")}}const y=E("squatch-js:widgets");class T{constructor(t){l(this,"api");l(this,"tenantAlias");l(this,"domain");l(this,"npmCdn");const e=U(t);this.tenantAlias=e.tenantAlias,this.domain=e.domain,this.npmCdn=e.npmCdn,this.api=new J(e)}async upsertUser(t){const i=ae(t);try{const n=await this.api.upsertUser(i);return{widget:this._renderWidget(n,i,{type:"upsert",user:i.user,engagementMedium:t.engagementMedium,container:t.container,trigger:t.trigger,widgetConfig:{values:{brandingConfig:n==null?void 0:n.brandingConfig}}}),user:n.user}}catch(n){throw y(n),n.apiErrorCode&&this._renderErrorWidget(n,t.engagementMedium),new Error(n)}}async render(t){const i=ce(t);try{const n=await this.api.render(i);return{widget:this._renderWidget(n,i,{type:"passwordless",engagementMedium:i.engagementMedium,container:i.container,trigger:i.trigger,widgetConfig:n==null?void 0:n.widgetConfig}),user:n.user}}catch(n){throw n.apiErrorCode&&this._renderErrorWidget(n,i.engagementMedium),new Error(n)}}async autofill(t){const e=t;if(typeof e=="function"){try{const s=await this.api.squatchReferralCookie();e(s)}catch(s){throw y("Autofill error",s),new Error(s)}return}if(typeof e!="string")throw new Error("Autofill accepts a string or function");let i=document.querySelectorAll(e),n;if(i.length>0)n=i[0];else throw y("Element id/class or function missing"),new Error("Element id/class or function missing");try{const s=await this.api.squatchReferralCookie();n.value=s.codes[0]}catch(s){throw new Error(s)}}_renderWidget(t,e,i){var c;if(y("Rendering Widget..."),!t)throw new Error("Unable to get a response");let n,s=!!e.displayOnLoad;const r=t.jsOptions||{},a={content:t.template,type:e.widgetType||((c=r.widget)==null?void 0:c.defaultWidgetType),api:this.api,domain:this.domain,npmCdn:this.npmCdn,context:i};return r.widgetUrlMappings&&r.widgetUrlMappings.forEach(d=>{var h,u;T._matchesUrl(d.url)&&(d.widgetType!=="CONVERSION_WIDGET"||(u=(h=t.user)==null?void 0:h.referredBy)!=null&&u.code?(s=d.displayOnLoad,y(`Display ${d.widgetType} on ${d.url}`)):y(`Don't display ${d.widgetType} when no referral on widget rule match ${d.url}`))}),r.fuelTankAutofillUrls&&(y("We found a fuel tank autofill!"),r.fuelTankAutofillUrls.forEach(({url:d,formSelector:h})=>{var u,p,m;if(T._matchesUrl(d)&&(y("Fuel Tank URL matches"),(p=(u=t.user)==null?void 0:u.referredBy)!=null&&p.code)){const g=document.querySelector(h);g?g.value=((m=t.user.referredBy.referredReward)==null?void 0:m.fuelTankCode)||"":y(new Error(`Element with id/class ${h} was not found.`))}})),e.engagementMedium==="EMBED"?n=this._renderEmbedWidget(a):(n=this._renderPopupWidget(a),s&&n.open()),n}_renderPopupWidget(t){const e=new q(t,t.context.trigger);return e.load(),e}_renderEmbedWidget(t){const e=new x(t,t.context.container);return e.load(),e}_renderErrorWidget(t,e="POPUP"){const{apiErrorCode:i,rsCode:n,message:s}=t;y(new Error(`${i} (${n}) ${s}`));const r={content:"error",rsCode:n,api:this.api,domain:this.domain,npmCdn:this.npmCdn,type:"ERROR_WIDGET",context:{type:"error"}};let a;e==="EMBED"?(a=new x(r),a.load()):e==="POPUP"&&(a=new q(r),a.load())}static _matchesUrl(t){return!!window.location.href.match(new RegExp(t))}}class Re{constructor(t){l(this,"tenantAlias");l(this,"domain");const i=U(t);this.tenantAlias=i.tenantAlias,this.domain=i.domain}track(t,e){const i=t,n=e,s=$e(i),{jwt:r}=Pe(n),a=encodeURIComponent(this.tenantAlias),c=encodeURIComponent(s.userId),d=encodeURIComponent(s.accountId),h=`/api/v1/${a}/open/account/${d}/user/${c}/events`,u=this.domain+h;return Q(u,JSON.stringify(s),r)}}function $e(o){if(!I(o))throw new Error("tracking parameter must be an object");if(!(o!=null&&o.accountId))throw new Error("accountId field is required");if(!(o!=null&&o.events))throw new Error("events field is required");if(!(o!=null&&o.userId))throw new Error("userId field is required");const t=o;if(!Array.isArray(t.events))throw new Error("'events' should be an array");return t}function Pe(o){if(!I(o))throw new Error("'options' should be an object");return o}function Se(){var n;const o=window[z]?z:S,t=((n=window["_"+o])==null?void 0:n.ready)||[],e=window.impactOnReady||window.squatchOnReady,i=[...t,e].filter(s=>!!s);setTimeout(()=>{window[S]&&(window[z]=window[S],i.forEach(s=>s()),window[S]._auto(),window["_"+o]=void 0,delete window["_"+o])},0)}const v=E("squatch-js"),ie=o=>typeof o=="object"&&!Array.isArray(o),he=(o,t)=>{const e=n=>ie(t[n])&&o.hasOwnProperty(n)&&ie(o[n]),i=Object.getOwnPropertyNames(t).map(n=>({[n]:e(n)?he(o[n],t[n]):t[n]})).reduce((n,s)=>({...n,...s}),{});return{...o,...i}};function N(o){const t=atob(o.replace(/_/g,"/").replace(/-/g,"+")),e=new Uint8Array(t.length);for(let i=0;i<t.length;i++)e[i]=t.charCodeAt(i);return new TextDecoder("utf8").decode(e)}function oe(o){const t=new TextEncoder().encode(o),e=Array.from(t,i=>String.fromCodePoint(i)).join("");return btoa(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Me(){var o,t,e="weird_get_top_level_domain=cookie",i=document.location.hostname.split(".");for(o=i.length-1;o>=0;o--)if(t=i.slice(o).join("."),document.cookie=e+";domain=."+t+";",document.cookie.indexOf(e)>-1)return document.cookie=e.split("=")[0]+"=;domain=."+t+";expires=Thu, 01 Jan 1970 00:00:01 GMT;",t}function Oe(){const o=window.location.search,e=new URLSearchParams(o).get("_saasquatch")||"";if(e){let i="",n="",s="";try{i=JSON.parse(N(e))}catch(r){v("Unable to decode params",r);return}try{n=JSON.parse(N(j.get("_saasquatch"))),v("existing cookie",n)}catch(r){v("Unable to retrieve cookie",r)}try{const r=Me();if(v("domain retrieved:",r),n){const a=he(n,i);s=oe(JSON.stringify(a)),v("cookie to store:",a)}else s=oe(JSON.stringify(i)),v("cookie to store:",i);j.set("_saasquatch",s,{expires:365,secure:!1,sameSite:"Lax",domain:r,path:"/"})}catch(r){v("Unable to set cookie",r)}}}const O=E("squatch-js");function Le(){var u;const o=window.location.search,e=new URLSearchParams(o).get("_saasquatchExtra")||"";if(!e){O("No _saasquatchExtra param");return}const i=U({tenantAlias:"UNKNOWN"});if(!i.domain){O("domain must be provided in config to use _saasquatchExtra");return}let n;try{n=JSON.parse(N(e))}catch{O("Unable to decode _saasquatchExtra config");return}function s(p){return p.replace(/^https?:\/\//,"")}const r=s(i.domain),a=Object.keys((n==null?void 0:n[r])||{})[0],c=(u=n==null?void 0:n[r])==null?void 0:u[a];if(!c){O("_saasquatchExtra did not have an expected structure");return}const{autoPopupWidgetType:d,...h}=c;return{widgetConfig:{widgetType:d,displayOnLoad:!0,...h},squatchConfig:{...i,tenantAlias:a}}}const je=E("squatch-js:decodeUserJwt");function De(o){var t;try{const e=o.split(".")[1];if(e===void 0)return null;const i=N(e);return(t=JSON.parse(i))==null?void 0:t.user}catch(e){return je(e),null}}const se=E("squatch-js:DeclarativeWidget");class ue extends HTMLElement{constructor(){super();l(this,"config");l(this,"token");l(this,"tenant");l(this,"widgetType");l(this,"locale");l(this,"widgetApi");l(this,"analyticsApi");l(this,"widgetInstance");l(this,"type");l(this,"container");l(this,"element");l(this,"loaded");l(this,"_setWidget",(e,i)=>{var s;const n={api:this.widgetApi,content:e.template,context:{type:i.type,user:i.user,container:this.container||void 0,engagementMedium:this.type,widgetConfig:e.widgetConfig},type:this.widgetType,domain:((s=this.config)==null?void 0:s.domain)||A,npmCdn:X,container:this};if(this.type==="EMBED")return new x(n);{const r=this.firstChild?null:void 0;return new q(n,r)}});l(this,"setErrorWidget",e=>{var n;const i={api:this.widgetApi,content:"error",context:{type:"error",container:this.container||void 0},type:"ERROR_WIDGET",domain:((n=this.config)==null?void 0:n.domain)||A,npmCdn:X,container:this};if(this.type==="EMBED")return new x(i);{const s=this.firstChild?null:void 0;return new q(i,s)}});l(this,"reload",this.renderWidget);l(this,"show",this.open);l(this,"hide",this.close);this.attachShadow({mode:"open"}).innerHTML="<style>:host { display: block; }</style><slot></slot>",this.config=K(),this.token=R(),this.tenant=window.squatchTenant,this.container=this}_setupApis(e){var i,n;if(!this.tenant)throw new Error("tenantAlias not provided");this.widgetApi=new J({tenantAlias:(e==null?void 0:e.tenantAlias)||this.tenant,domain:(e==null?void 0:e.domain)||((i=this.config)==null?void 0:i.domain)||A}),this.analyticsApi=new de({domain:(e==null?void 0:e.domain)||((n=this.config)==null?void 0:n.domain)||A})}getWidgetType(e){return e&&(e.includes("websiteReferralWidget")||e.includes("friendWidget"))?"instant-access":"verified-access"}async renderPasswordlessVariant(){return this._setupApis(),se("Rendering as an Instant Access widget"),await this.widgetApi.render({engagementMedium:this.type,widgetType:this.widgetType,locale:this.locale}).then(e=>this._setWidget(e,{type:"passwordless"})).catch(this.setErrorWidget)}async renderUserUpsertVariant(){this._setupApis();const e=De(this.token);return e?(se("Rendering as a Verified widget"),await this.widgetApi.upsertUser({user:e,locale:this.locale,engagementMedium:this.type,widgetType:this.widgetType,jwt:this.token}),await this.widgetApi.render({locale:this.locale,engagementMedium:this.type,widgetType:this.widgetType}).then(n=>this._setWidget(n,{type:"upsert",user:e})).catch(this.setErrorWidget)):this.setErrorWidget(Error("No user object in token."))}async getWidgetInstance(){let e;if(this.widgetType=this.getAttribute("widget")||void 0,this.locale=this.getAttribute("locale")||this.locale,!this.widgetType)throw new Error("No widget has been specified");return this.token?e=await this.renderUserUpsertVariant():e=await this.renderPasswordlessVariant(),this.widgetInstance=e,this.widgetInstance&&this.dispatchEvent(new CustomEvent("sq:widget-loaded")),e}async renderWidget(){await this.getWidgetInstance(),await this.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()}static get observedAttributes(){return["widget","locale"]}attributeChangedCallback(e,i,n){if(!(i===n||!this.loaded))switch(e){case"locale":case"widget":this.connectedCallback();break}}async connectedCallback(){this.loaded=!0,this.container=this.getAttribute("container"),this.widgetType=this.getAttribute("widget")||void 0;const e=this.getWidgetType(this.widgetType),{getSkeleton:i}=await Promise.resolve().then(()=>require("./SkeletonTemplate-hwDwv3Ys.cjs")),n=i({height:"100%",type:e}),s=document.createElement("div");s.id="loading-skeleton",s.innerHTML=n;const r=this.shadowRoot||this.attachShadow({mode:"open"});if(this.type==="POPUP"){const c=r.getElementById("#squatchModal");c&&(c.innerHTML="",c.appendChild(s))}else r.innerHTML="",r.appendChild(s);await this.renderWidget();const a=r.getElementById("loading-skeleton");a&&a.remove(),this.getAttribute("open")!==null&&this.open()}}class Z extends ue{constructor(){super(),this.type="EMBED",this.loaded=!1}}class ee extends ue{constructor(){super(),this.type="POPUP",this.loaded=!1,this.addEventListener("click",t=>{t.stopPropagation(),this.open()})}}class Ne extends Z{}class Fe extends ee{}class He extends Z{}class Be extends ee{}window.customElements.get("squatch-embed")||window.customElements.define("squatch-embed",Ne);window.customElements.get("impact-embed")||window.customElements.define("impact-embed",He);window.customElements.get("squatch-popup")||window.customElements.define("squatch-popup",Fe);window.customElements.get("impact-popup")||window.customElements.define("impact-popup",Be);function Je(){console.log("Having trouble using Squatch.js? Go to https://docs.referralsaasquatch.com/developer/ for tutorials, references and error codes.")}const W=E("squatch-js");let F=null,H=null,B=null;function Ge(){return F||$({}),F}function G(){return H||$({}),H}function ze(){return B||$({}),B}function Ve(o){var t;return(t=G())==null?void 0:t.render(o)}function Xe(){var t;const o=Le();if(o){const{squatchConfig:e,widgetConfig:i}=o;return $(e),(t=G())==null?void 0:t.render(i)}}function $(o){const e=U(o);e.tenantAlias.match("^test")||e.debug?ve("squatch-js*"):be(),W("initializing ..."),F=new J(e),H=new T(e),B=new Re(e),W("Widget API instance",F),W("Widgets instance",H),W("Events API instance",B)}function Qe(o){o()}function Ye(o){G().autofill(o)}function pe(){Oe()}typeof document<"u"&&!window.SaaSquatchDoNotAutoDrop&&pe();var re;(re=window.squatch)!=null&&re.init&&W("Squatchjs is being loaded more than once. This may lead to multiple load events being sent, duplicated widgets, and inaccurate analytics.");typeof document<"u"&&Se();exports.DeclarativeEmbedWidget=Z;exports.DeclarativePopupWidget=ee;exports.EmbedWidget=x;exports.PopupWidget=q;exports.WidgetApi=J;exports.Widgets=T;exports._auto=Xe;exports.api=Ge;exports.autofill=Ye;exports.events=ze;exports.help=Je;exports.init=$;exports.pushCookie=pe;exports.ready=Qe;exports.widget=Ve;exports.widgets=G;
|
|
330
|
+
<script src="${this.npmCdn}/resize-observer-polyfill@1.5.x"><\/script>
|
|
331
|
+
`),h.close(),T("Popup template loaded into iframe"),await this._setupResizeHandler(s)}async _setupResizeHandler(e){const{contentWindow:n}=e;if(!n)throw new Error("Frame needs a content window");const i=n.document;K(i,async()=>{i.body.style.overflowY="hidden";let s=!0;new n.ResizeObserver(a=>{for(const d of a){const{top:c,bottom:h}=d.contentRect,u=h+c;u<=0||(s?(s=!1,e.style.height="0",e.height=i.body.scrollHeight+"",e.style.height=""):e.height=u+"",d.target.style="")}}).observe(await this._findInnerContainer(e))})}open(){const e=this.container?this._findElement():document.body,i=(e.shadowRoot||e).querySelector(`#${this.id}`);if(!i)throw new Error("Could not determine container div");i.showModal();const s=this._findFrame();if(!s)throw new Error("Could not find iframe");const{contentWindow:r}=s;if(!r)throw new Error("Squatch.js has an empty iframe");const a=r.document;K(a,()=>{var c;const d=r.squatch||r.widgetIdent;(c=s.contentDocument)==null||c.dispatchEvent(new CustomEvent("sq:refresh")),this.context.user?(this._loadEvent(d),T("Popup opened")):this._attachLoadEventListener(a,d)})}close(){const e=this._findFrame();e!=null&&e.contentDocument&&this._detachLoadEventListener(e.contentDocument);const n=this.container?this._findElement():document.body,s=(n.shadowRoot||n).querySelector(`#${this.id}`);if(!s)throw new Error("Could not determine container div");s.close(),T("Popup closed")}_clickedOutside({target:e}){}_error(e,n="modal",i=""){return super._error(e,n,i||"body { margin: 0; } .modal { box-shadow: none; border: 0; }")}}const v=k("squatch-js:widgets");class S{constructor(t){l(this,"api");l(this,"tenantAlias");l(this,"domain");l(this,"npmCdn");const e=P(t);this.tenantAlias=e.tenantAlias,this.domain=e.domain,this.npmCdn=e.npmCdn,this.api=new z(e)}async upsertUser(t){const n=he(t);try{const i=await this.api.upsertUser(n);return{widget:this._renderWidget(i,n,{type:"upsert",user:n.user,engagementMedium:t.engagementMedium,container:t.container,trigger:t.trigger,widgetConfig:{values:{brandingConfig:i==null?void 0:i.brandingConfig}}}),user:i.user}}catch(i){throw v(i),i.apiErrorCode&&this._renderErrorWidget(i,t.engagementMedium),new Error(i)}}async render(t){const n=ue(t);try{const i=await this.api.render(n);return{widget:this._renderWidget(i,n,{type:"passwordless",engagementMedium:n.engagementMedium,container:n.container,trigger:n.trigger,widgetConfig:i==null?void 0:i.widgetConfig}),user:i.user}}catch(i){throw i.apiErrorCode&&this._renderErrorWidget(i,n.engagementMedium),new Error(i)}}async autofill(t){const e=t;if(typeof e=="function"){try{const s=await this.api.squatchReferralCookie();e(s)}catch(s){throw v("Autofill error",s),new Error(s)}return}if(typeof e!="string")throw new Error("Autofill accepts a string or function");let n=document.querySelectorAll(e),i;if(n.length>0)i=n[0];else throw v("Element id/class or function missing"),new Error("Element id/class or function missing");try{const s=await this.api.squatchReferralCookie();i.value=s.codes[0]}catch(s){throw new Error(s)}}_renderWidget(t,e,n){var d;if(v("Rendering Widget..."),!t)throw new Error("Unable to get a response");let i,s=!!e.displayOnLoad;const r=t.jsOptions||{},a={content:t.template,type:e.widgetType||((d=r.widget)==null?void 0:d.defaultWidgetType),api:this.api,domain:this.domain,npmCdn:this.npmCdn,context:n};return r.widgetUrlMappings&&r.widgetUrlMappings.forEach(c=>{var h,u;S._matchesUrl(c.url)&&(c.widgetType!=="CONVERSION_WIDGET"||(u=(h=t.user)==null?void 0:h.referredBy)!=null&&u.code?(s=c.displayOnLoad,v(`Display ${c.widgetType} on ${c.url}`)):v(`Don't display ${c.widgetType} when no referral on widget rule match ${c.url}`))}),r.fuelTankAutofillUrls&&(v("We found a fuel tank autofill!"),r.fuelTankAutofillUrls.forEach(({url:c,formSelector:h})=>{var u,p,g;if(S._matchesUrl(c)&&(v("Fuel Tank URL matches"),(p=(u=t.user)==null?void 0:u.referredBy)!=null&&p.code)){const m=document.querySelector(h);m?m.value=((g=t.user.referredBy.referredReward)==null?void 0:g.fuelTankCode)||"":v(new Error(`Element with id/class ${h} was not found.`))}})),e.engagementMedium==="EMBED"?i=this._renderEmbedWidget(a):(i=this._renderPopupWidget(a),s&&i.open()),i}_renderPopupWidget(t){const e=new q(t,t.context.trigger);return e.load(),e}_renderEmbedWidget(t){const e=new $(t,t.context.container);return e.load(),e}_renderErrorWidget(t,e="POPUP"){const{apiErrorCode:n,rsCode:i,message:s}=t;v(new Error(`${n} (${i}) ${s}`));const r={content:"error",rsCode:i,api:this.api,domain:this.domain,npmCdn:this.npmCdn,type:"ERROR_WIDGET",context:{type:"error"}};let a;e==="EMBED"?(a=new $(r),a.load()):e==="POPUP"&&(a=new q(r),a.load())}static _matchesUrl(t){return!!window.location.href.match(new RegExp(t))}}class je{constructor(t){l(this,"tenantAlias");l(this,"domain");const n=P(t);this.tenantAlias=n.tenantAlias,this.domain=n.domain}track(t,e){const n=t,i=e,s=De(n),{jwt:r}=Ne(i),a=encodeURIComponent(this.tenantAlias),d=encodeURIComponent(s.userId),c=encodeURIComponent(s.accountId),h=`/api/v1/${a}/open/account/${c}/user/${d}/events`,u=this.domain+h;return Y(u,JSON.stringify(s),r)}}function De(o){if(!I(o))throw new Error("tracking parameter must be an object");if(!(o!=null&&o.accountId))throw new Error("accountId field is required");if(!(o!=null&&o.events))throw new Error("events field is required");if(!(o!=null&&o.userId))throw new Error("userId field is required");const t=o;if(!Array.isArray(t.events))throw new Error("'events' should be an array");return t}function Ne(o){if(!I(o))throw new Error("'options' should be an object");return o}function Fe(){var i;const o=window[V]?V:L,t=((i=window["_"+o])==null?void 0:i.ready)||[],e=window.impactOnReady||window.squatchOnReady,n=[...t,e].filter(s=>!!s);setTimeout(()=>{window[L]&&(window[V]=window[L],n.forEach(s=>s()),window[L]._auto(),window["_"+o]=void 0,delete window["_"+o])},0)}const x=k("squatch-js"),ae=o=>typeof o=="object"&&!Array.isArray(o),fe=(o,t)=>{const e=i=>ae(t[i])&&o.hasOwnProperty(i)&&ae(o[i]),n=Object.getOwnPropertyNames(t).map(i=>({[i]:e(i)?fe(o[i],t[i]):t[i]})).reduce((i,s)=>({...i,...s}),{});return{...o,...n}};function F(o){const t=atob(o.replace(/_/g,"/").replace(/-/g,"+")),e=new Uint8Array(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return new TextDecoder("utf8").decode(e)}function de(o){const t=new TextEncoder().encode(o),e=Array.from(t,n=>String.fromCodePoint(n)).join("");return btoa(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function He(){var o,t,e="weird_get_top_level_domain=cookie",n=document.location.hostname.split(".");for(o=n.length-1;o>=0;o--)if(t=n.slice(o).join("."),document.cookie=e+";domain=."+t+";",document.cookie.indexOf(e)>-1)return document.cookie=e.split("=")[0]+"=;domain=."+t+";expires=Thu, 01 Jan 1970 00:00:01 GMT;",t}function Be(){const o=window.location.search,e=new URLSearchParams(o).get("_saasquatch")||"";if(e){let n="",i="",s="";try{n=JSON.parse(F(e))}catch(r){x("Unable to decode params",r);return}try{i=JSON.parse(F(D.get("_saasquatch"))),x("existing cookie",i)}catch(r){x("Unable to retrieve cookie",r)}try{const r=He();if(x("domain retrieved:",r),i){const a=fe(i,n);s=de(JSON.stringify(a)),x("cookie to store:",a)}else s=de(JSON.stringify(n)),x("cookie to store:",n);D.set("_saasquatch",s,{expires:365,secure:!1,sameSite:"Lax",domain:r,path:"/"})}catch(r){x("Unable to set cookie",r)}}}const j=k("squatch-js");function Je(){var u;const o=window.location.search,e=new URLSearchParams(o).get("_saasquatchExtra")||"";if(!e){j("No _saasquatchExtra param");return}const n=P({tenantAlias:"UNKNOWN"});if(!n.domain){j("domain must be provided in config to use _saasquatchExtra");return}let i;try{i=JSON.parse(F(e))}catch{j("Unable to decode _saasquatchExtra config");return}function s(p){return p.replace(/^https?:\/\//,"")}const r=s(n.domain),a=Object.keys((i==null?void 0:i[r])||{})[0],d=(u=i==null?void 0:i[r])==null?void 0:u[a];if(!d){j("_saasquatchExtra did not have an expected structure");return}const{autoPopupWidgetType:c,...h}=d;return{widgetConfig:{widgetType:c,displayOnLoad:!0,...h},squatchConfig:{...n,tenantAlias:a}}}const ze=k("squatch-js:decodeUserJwt");function Ge(o){var t;try{const e=o.split(".")[1];if(e===void 0)return null;const n=F(e);return(t=JSON.parse(n))==null?void 0:t.user}catch(e){return ze(e),null}}const ce=k("squatch-js:DeclarativeWidget");class we extends HTMLElement{constructor(){super();l(this,"config");l(this,"token");l(this,"tenant");l(this,"widgetType");l(this,"locale");l(this,"widgetApi");l(this,"analyticsApi");l(this,"widgetInstance");l(this,"type");l(this,"container");l(this,"element");l(this,"loaded");l(this,"_setWidget",(e,n)=>{var s;const i={api:this.widgetApi,content:e.template,context:{type:n.type,user:n.user,container:this.container||void 0,engagementMedium:this.type,widgetConfig:e.widgetConfig},type:this.widgetType,domain:((s=this.config)==null?void 0:s.domain)||A,npmCdn:Q,container:this};if(this.type==="EMBED")return new $(i);{const r=this.firstChild?null:void 0;return new q(i,r)}});l(this,"setErrorWidget",e=>{var i;const n={api:this.widgetApi,content:"error",context:{type:"error",container:this.container||void 0},type:"ERROR_WIDGET",domain:((i=this.config)==null?void 0:i.domain)||A,npmCdn:Q,container:this};if(this.type==="EMBED")return new $(n);{const s=this.firstChild?null:void 0;return new q(n,s)}});l(this,"reload",this.renderWidget);l(this,"show",this.open);l(this,"hide",this.close);this.attachShadow({mode:"open"}).innerHTML="<style>:host { display: block; }</style><slot></slot>",this.config=Z(),this.token=R(),this.tenant=window.squatchTenant,this.container=this}_setupApis(e){var n,i;if(!this.tenant)throw new Error("tenantAlias not provided");this.widgetApi=new z({tenantAlias:(e==null?void 0:e.tenantAlias)||this.tenant,domain:(e==null?void 0:e.domain)||((n=this.config)==null?void 0:n.domain)||A}),this.analyticsApi=new pe({domain:(e==null?void 0:e.domain)||((i=this.config)==null?void 0:i.domain)||A})}getWidgetType(e){return e&&(e.includes("websiteReferralWidget")||e.includes("friendWidget"))?"instant-access":"verified-access"}async renderPasswordlessVariant(){return this._setupApis(),ce("Rendering as an Instant Access widget"),await this.widgetApi.render({engagementMedium:this.type,widgetType:this.widgetType,locale:this.locale}).then(e=>this._setWidget(e,{type:"passwordless"})).catch(this.setErrorWidget)}async renderUserUpsertVariant(){this._setupApis();const e=Ge(this.token);return e?(ce("Rendering as a Verified widget"),await this.widgetApi.upsertUser({user:e,locale:this.locale,engagementMedium:this.type,widgetType:this.widgetType,jwt:this.token}),await this.widgetApi.render({locale:this.locale,engagementMedium:this.type,widgetType:this.widgetType}).then(i=>this._setWidget(i,{type:"upsert",user:e})).catch(this.setErrorWidget)):this.setErrorWidget(Error("No user object in token."))}async getWidgetInstance(){let e;if(this.widgetType=this.getAttribute("widget")||void 0,this.locale=this.getAttribute("locale")||this.locale,!this.widgetType)throw new Error("No widget has been specified");return this.token?e=await this.renderUserUpsertVariant():e=await this.renderPasswordlessVariant(),this.widgetInstance=e,this.widgetInstance&&this.dispatchEvent(new CustomEvent("sq:widget-loaded")),e}async renderWidget(){await this.getWidgetInstance(),await this.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()}static get observedAttributes(){return["widget","locale"]}attributeChangedCallback(e,n,i){if(!(n===i||!this.loaded))switch(e){case"locale":case"widget":this.connectedCallback();break}}async connectedCallback(){this.loaded=!0,this.container=this.getAttribute("container"),this.widgetType=this.getAttribute("widget")||void 0;const e=this.getWidgetType(this.widgetType),{getSkeleton:n}=await Promise.resolve().then(()=>Me),i=n({height:"100%",type:e}),s=document.createElement("div");s.id="loading-skeleton",s.innerHTML=i;const r=this.shadowRoot||this.attachShadow({mode:"open"});if(this.type==="POPUP"){const d=r.getElementById("#squatchModal");d&&(d.innerHTML="",d.appendChild(s))}else r.innerHTML="",r.appendChild(s);await this.renderWidget();const a=r.getElementById("loading-skeleton");a&&a.remove(),this.getAttribute("open")!==null&&this.open()}}class ee extends we{constructor(){super(),this.type="EMBED",this.loaded=!1}}class te extends we{constructor(){super(),this.type="POPUP",this.loaded=!1,this.addEventListener("click",t=>{t.stopPropagation(),this.open()})}}class Ve extends ee{}class Xe extends te{}class Qe extends ee{}class Ye extends te{}window.customElements.get("squatch-embed")||window.customElements.define("squatch-embed",Ve);window.customElements.get("impact-embed")||window.customElements.define("impact-embed",Qe);window.customElements.get("squatch-popup")||window.customElements.define("squatch-popup",Xe);window.customElements.get("impact-popup")||window.customElements.define("impact-popup",Ye);function Ke(){console.log("Having trouble using Squatch.js? Go to https://docs.referralsaasquatch.com/developer/ for tutorials, references and error codes.")}const W=k("squatch-js");let H=null,B=null,J=null;function Ze(){return H||U({}),H}function G(){return B||U({}),B}function et(){return J||U({}),J}function tt(o){var t;return(t=G())==null?void 0:t.render(o)}function nt(){var t;const o=Je();if(o){const{squatchConfig:e,widgetConfig:n}=o;return U(e),(t=G())==null?void 0:t.render(n)}}function U(o){const e=P(o);e.tenantAlias.match("^test")||e.debug?Ie("squatch-js*"):_e(),W("initializing ..."),H=new z(e),B=new S(e),J=new je(e),W("Widget API instance",H),W("Widgets instance",B),W("Events API instance",J)}function it(o){o()}function ot(o){G().autofill(o)}function ye(){Be()}typeof document<"u"&&!window.SaaSquatchDoNotAutoDrop&&ye();var le;(le=window.squatch)!=null&&le.init&&W("Squatchjs is being loaded more than once. This may lead to multiple load events being sent, duplicated widgets, and inaccurate analytics.");typeof document<"u"&&Fe();exports.DeclarativeEmbedWidget=ee;exports.DeclarativePopupWidget=te;exports.EmbedWidget=$;exports.PopupWidget=q;exports.WidgetApi=z;exports.Widgets=S;exports._auto=nt;exports.api=Ze;exports.autofill=ot;exports.events=et;exports.help=Ke;exports.init=U;exports.pushCookie=ye;exports.ready=it;exports.widget=tt;exports.widgets=G;
|
|
75
332
|
//# sourceMappingURL=squatch.cjs.js.map
|