customerio-gist-web 3.15.0 → 3.15.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.
@@ -34,7 +34,7 @@ jobs:
34
34
  AWS_DEST="web/$RELEASE_VERSION"
35
35
  echo "AWS_DEST=$AWS_DEST" >> $GITHUB_ENV
36
36
  echo "AWS_DEST=$AWS_DEST"
37
- - uses: shallwefootball/s3-upload-action@master
37
+ - uses: shallwefootball/s3-upload-action@0d261a6f15b3b2e209dfebdecace4b100c04f95b # master
38
38
  with:
39
39
  aws_key_id: ${{ env.AWS_ACCESS_KEY_ID }}
40
40
  aws_secret_access_key: ${{ env.AWS_SECRET_ACCESS_KEY }}
@@ -43,6 +43,6 @@ jobs:
43
43
  destination_dir: ${{ env.AWS_DEST }}
44
44
  endpoint: 'ams3.digitaloceanspaces.com'
45
45
  - name: Publish to NPM
46
- uses: JS-DevTools/npm-publish@v3
46
+ uses: JS-DevTools/npm-publish@9ff4ebfbe48473265867fb9608c047e7995edfa3 # v3.1.1
47
47
  with:
48
48
  token: ${{ secrets.NPM_TOKEN }}
@@ -12,9 +12,9 @@ jobs:
12
12
  fetch-depth: 0
13
13
  ref: master
14
14
  token: ${{ secrets.SRE_GHACTIONS_TOKEN }}
15
- - uses: actions-ecosystem/action-get-latest-tag@v1
15
+ - uses: actions-ecosystem/action-get-latest-tag@b7c32daec3395a9616f88548363a42652b22d435 # v1.6.0
16
16
  id: get-latest-tag
17
- - uses: actions-ecosystem/action-bump-semver@v1
17
+ - uses: actions-ecosystem/action-bump-semver@8f82919001e67c7561b5f240af5df8234d2ac3fc # v1.0.0
18
18
  id: bump-semver
19
19
  with:
20
20
  current_version: ${{ steps.get-latest-tag.outputs.tag }}
@@ -22,9 +22,9 @@ jobs:
22
22
  fetch-depth: 0
23
23
  ref: develop
24
24
  token: ${{ secrets.SRE_GHACTIONS_TOKEN }}
25
- - uses: actions-ecosystem/action-get-latest-tag@v1
25
+ - uses: actions-ecosystem/action-get-latest-tag@b7c32daec3395a9616f88548363a42652b22d435 # v1.6.0
26
26
  id: get-latest-tag
27
- - uses: actions-ecosystem/action-bump-semver@v1
27
+ - uses: actions-ecosystem/action-bump-semver@8f82919001e67c7561b5f240af5df8234d2ac3fc # v1.0.0
28
28
  id: bump-semver
29
29
  with:
30
30
  current_version: ${{ steps.get-latest-tag.outputs.tag }}
package/dist/gist.min.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Gist=t():e.Gist=t()}(this,(()=>(()=>{var e={505:(e,t,n)=>{e.exports=n(15)},592:(e,t,n)=>{"use strict";var r=n(516),s=n(522),i=n(948),o=n(106),a=n(615),u=n(631),c=n(202),l=n(896),d=n(845),f=n(563),p=n(656),g=n(721);e.exports=function(e){return new Promise((function(t,n){var h,m=e.data,v=e.headers,y=e.responseType,w=e.withXSRFToken;function b(){e.cancelToken&&e.cancelToken.unsubscribe(h),e.signal&&e.signal.removeEventListener("abort",h)}r.isFormData(m)&&r.isStandardBrowserEnv()&&delete v["Content-Type"];var x=new XMLHttpRequest;if(e.auth){var E=e.auth.username||"",S=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";v.Authorization="Basic "+btoa(E+":"+S)}var I=a(e.baseURL,e.url);function R(){if(x){var r="getAllResponseHeaders"in x?u(x.getAllResponseHeaders()):null,i={data:y&&"text"!==y&&"json"!==y?x.response:x.responseText,status:x.status,statusText:x.statusText,headers:r,config:e,request:x};s((function(e){t(e),b()}),(function(e){n(e),b()}),i),x=null}}if(x.open(e.method.toUpperCase(),o(I,e.params,e.paramsSerializer),!0),x.timeout=e.timeout,"onloadend"in x?x.onloadend=R:x.onreadystatechange=function(){x&&4===x.readyState&&(0!==x.status||x.responseURL&&0===x.responseURL.indexOf("file:"))&&setTimeout(R)},x.onabort=function(){x&&(n(new d("Request aborted",d.ECONNABORTED,e,x)),x=null)},x.onerror=function(){n(new d("Network Error",d.ERR_NETWORK,e,x)),x=null},x.ontimeout=function(){var t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",r=e.transitional||l;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(new d(t,r.clarifyTimeoutError?d.ETIMEDOUT:d.ECONNABORTED,e,x)),x=null},r.isStandardBrowserEnv()&&(w&&r.isFunction(w)&&(w=w(e)),w||!1!==w&&c(I))){var O=e.xsrfHeaderName&&e.xsrfCookieName&&i.read(e.xsrfCookieName);O&&(v[e.xsrfHeaderName]=O)}"setRequestHeader"in x&&r.forEach(v,(function(e,t){void 0===m&&"content-type"===t.toLowerCase()?delete v[t]:x.setRequestHeader(t,e)})),r.isUndefined(e.withCredentials)||(x.withCredentials=!!e.withCredentials),y&&"json"!==y&&(x.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&x.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&x.upload&&x.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(h=function(t){x&&(n(!t||t.type?new f(null,e,x):t),x.abort(),x=null)},e.cancelToken&&e.cancelToken.subscribe(h),e.signal&&(e.signal.aborted?h():e.signal.addEventListener("abort",h))),m||!1===m||0===m||""===m||(m=null);var T=p(I);T&&-1===g.protocols.indexOf(T)?n(new d("Unsupported protocol "+T+":",d.ERR_BAD_REQUEST,e)):x.send(m)}))}},15:(e,t,n)=>{"use strict";var r=n(516),s=n(12),i=n(155),o=n(343),a=n(412),u=n(298),c=function e(t){var n=new i(t),a=s(i.prototype.request,n);return r.extend(a,i.prototype,n),r.extend(a,n),a.create=function(n){return e(o(t,n))},a}(a);c.Axios=i,c.CanceledError=n(563),c.CancelToken=n(191),c.isCancel=n(864),c.VERSION=n(641).version,c.toFormData=n(440),c.AxiosError=n(845),c.Cancel=c.CanceledError,c.all=function(e){return Promise.all(e)},c.spread=n(980),c.isAxiosError=n(19),c.formToJSON=function(e){return u(r.isHTMLForm(e)?new FormData(e):e)},e.exports=c,e.exports.default=c},191:(e,t,n)=>{"use strict";var r=n(563);function s(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;this.promise.then((function(e){if(n._listeners){for(var t=n._listeners.length;t-- >0;)n._listeners[t](e);n._listeners=null}})),this.promise.then=function(e){var t,r=new Promise((function(e){n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e((function(e,s,i){n.reason||(n.reason=new r(e,s,i),t(n.reason))}))}s.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},s.prototype.subscribe=function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]},s.prototype.unsubscribe=function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}},s.source=function(){var e;return{token:new s((function(t){e=t})),cancel:e}},e.exports=s},563:(e,t,n)=>{"use strict";var r=n(845);function s(e,t,n){r.call(this,null==e?"canceled":e,r.ERR_CANCELED,t,n),this.name="CanceledError"}n(516).inherits(s,r,{__CANCEL__:!0}),e.exports=s},864:e=>{"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},155:(e,t,n)=>{"use strict";var r=n(516),s=n(106),i=n(471),o=n(490),a=n(343),u=n(615),c=n(841),l=c.validators;function d(e){this.defaults=e,this.interceptors={request:new i,response:new i}}d.prototype.request=function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},(t=a(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var n=t.transitional;void 0!==n&&c.assertOptions(n,{silentJSONParsing:l.transitional(l.boolean),forcedJSONParsing:l.transitional(l.boolean),clarifyTimeoutError:l.transitional(l.boolean)},!1);var s=t.paramsSerializer;void 0!==s&&c.assertOptions(s,{encode:l.function,serialize:l.function},!0),r.isFunction(s)&&(t.paramsSerializer={serialize:s});var i=[],u=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(u=u&&e.synchronous,i.unshift(e.fulfilled,e.rejected))}));var d,f=[];if(this.interceptors.response.forEach((function(e){f.push(e.fulfilled,e.rejected)})),!u){var p=[o,void 0];for(Array.prototype.unshift.apply(p,i),p=p.concat(f),d=Promise.resolve(t);p.length;)d=d.then(p.shift(),p.shift());return d}for(var g=t;i.length;){var h=i.shift(),m=i.shift();try{g=h(g)}catch(e){m(e);break}}try{d=o(g)}catch(e){return Promise.reject(e)}for(;f.length;)d=d.then(f.shift(),f.shift());return d},d.prototype.getUri=function(e){e=a(this.defaults,e);var t=u(e.baseURL,e.url);return s(t,e.params,e.paramsSerializer)},r.forEach(["delete","get","head","options"],(function(e){d.prototype[e]=function(t,n){return this.request(a(n||{},{method:e,url:t,data:(n||{}).data}))}})),r.forEach(["post","put","patch"],(function(e){function t(t){return function(n,r,s){return this.request(a(s||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}d.prototype[e]=t(),d.prototype[e+"Form"]=t(!0)})),e.exports=d},845:(e,t,n)=>{"use strict";var r=n(516);function s(e,t,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s)}r.inherits(s,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var i=s.prototype,o={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((function(e){o[e]={value:e}})),Object.defineProperties(s,o),Object.defineProperty(i,"isAxiosError",{value:!0}),s.from=function(e,t,n,o,a,u){var c=Object.create(i);return r.toFlatObject(e,c,(function(e){return e!==Error.prototype})),s.call(c,e.message,t,n,o,a),c.cause=e,c.name=e.name,u&&Object.assign(c,u),c},e.exports=s},471:(e,t,n)=>{"use strict";var r=n(516);function s(){this.handlers=[]}s.prototype.use=function(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1},s.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},s.prototype.clear=function(){this.handlers&&(this.handlers=[])},s.prototype.forEach=function(e){r.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=s},615:(e,t,n)=>{"use strict";var r=n(137),s=n(680);e.exports=function(e,t){return e&&!r(t)?s(e,t):t}},490:(e,t,n)=>{"use strict";var r=n(516),s=n(881),i=n(864),o=n(412),a=n(563),u=n(18);function c(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new a}e.exports=function(e){return c(e),e.headers=e.headers||{},e.data=s.call(e,e.data,e.headers,null,e.transformRequest),u(e.headers,"Accept"),u(e.headers,"Content-Type"),e.headers=r.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),r.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||o.adapter)(e).then((function(t){return c(e),t.data=s.call(e,t.data,t.headers,t.status,e.transformResponse),t}),(function(t){return i(t)||(c(e),t&&t.response&&(t.response.data=s.call(e,t.response.data,t.response.headers,t.response.status,e.transformResponse))),Promise.reject(t)}))}},343:(e,t,n)=>{"use strict";var r=n(516);e.exports=function(e,t){t=t||{};var n={};function s(e,t){return r.isPlainObject(e)&&r.isPlainObject(t)?r.merge(e,t):r.isEmptyObject(t)?r.merge({},e):r.isPlainObject(t)?r.merge({},t):r.isArray(t)?t.slice():t}function i(n){return r.isUndefined(t[n])?r.isUndefined(e[n])?void 0:s(void 0,e[n]):s(e[n],t[n])}function o(e){if(!r.isUndefined(t[e]))return s(void 0,t[e])}function a(n){return r.isUndefined(t[n])?r.isUndefined(e[n])?void 0:s(void 0,e[n]):s(void 0,t[n])}function u(n){return n in t?s(e[n],t[n]):n in e?s(void 0,e[n]):void 0}var c={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:u};return r.forEach(Object.keys(e).concat(Object.keys(t)),(function(e){var t=c[e]||i,s=t(e);r.isUndefined(s)&&t!==u||(n[e]=s)})),n}},522:(e,t,n)=>{"use strict";var r=n(845);e.exports=function(e,t,n){var s=n.config.validateStatus;n.status&&s&&!s(n.status)?t(new r("Request failed with status code "+n.status,[r.ERR_BAD_REQUEST,r.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}},881:(e,t,n)=>{"use strict";var r=n(516),s=n(412);e.exports=function(e,t,n,i){var o=this||s;return r.forEach(i,(function(r){e=r.call(o,e,t,n)})),e}},412:(e,t,n)=>{"use strict";var r=n(516),s=n(18),i=n(845),o=n(896),a=n(440),u=n(69),c=n(721),l=n(298),d={"Content-Type":"application/x-www-form-urlencoded"};function f(e,t){!r.isUndefined(e)&&r.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var p,g={transitional:o,adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(p=n(592)),p),transformRequest:[function(e,t){s(t,"Accept"),s(t,"Content-Type");var n,i=t&&t["Content-Type"]||"",o=i.indexOf("application/json")>-1,c=r.isObject(e);if(c&&r.isHTMLForm(e)&&(e=new FormData(e)),r.isFormData(e))return o?JSON.stringify(l(e)):e;if(r.isArrayBuffer(e)||r.isBuffer(e)||r.isStream(e)||r.isFile(e)||r.isBlob(e))return e;if(r.isArrayBufferView(e))return e.buffer;if(r.isURLSearchParams(e))return f(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString();if(c){if(-1!==i.indexOf("application/x-www-form-urlencoded"))return u(e,this.formSerializer).toString();if((n=r.isFileList(e))||i.indexOf("multipart/form-data")>-1){var d=this.env&&this.env.FormData;return a(n?{"files[]":e}:e,d&&new d,this.formSerializer)}}return c||o?(f(t,"application/json"),function(e,t,n){if(r.isString(e))try{return(0,JSON.parse)(e),r.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||g.transitional,n=t&&t.forcedJSONParsing,s="json"===this.responseType;if(e&&r.isString(e)&&(n&&!this.responseType||s)){var o=!(t&&t.silentJSONParsing)&&s;try{return JSON.parse(e)}catch(e){if(o){if("SyntaxError"===e.name)throw i.from(e,i.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:c.classes.FormData,Blob:c.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};r.forEach(["delete","get","head"],(function(e){g.headers[e]={}})),r.forEach(["post","put","patch"],(function(e){g.headers[e]=r.merge(d)})),e.exports=g},896:e=>{"use strict";e.exports={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}},786:(e,t,n)=>{e.exports=n(894)},641:e=>{e.exports={version:"0.28.1"}},170:(e,t,n)=>{"use strict";var r=n(440);function s(e){var t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'\(\)~]|%20|%00/g,(function(e){return t[e]}))}function i(e,t){this._pairs=[],e&&r(e,this,t)}var o=i.prototype;o.append=function(e,t){this._pairs.push([e,t])},o.toString=function(e){var t=e?function(t){return e.call(this,t,s)}:s;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")},e.exports=i},12:e=>{"use strict";e.exports=function(e,t){return function(){return e.apply(t,arguments)}}},106:(e,t,n)=>{"use strict";var r=n(516),s=n(170);function i(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,n){if(!t)return e;var o=e.indexOf("#");-1!==o&&(e=e.slice(0,o));var a,u=n&&n.encode||i,c=n&&n.serialize;return(a=c?c(t,n):r.isURLSearchParams(t)?t.toString():new s(t,n).toString(u))&&(e+=(-1===e.indexOf("?")?"?":"&")+a),e}},680:e=>{"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},948:(e,t,n)=>{"use strict";var r=n(516);e.exports=r.isStandardBrowserEnv()?{write:function(e,t,n,s,i,o){var a=[];a.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),r.isString(s)&&a.push("path="+s),r.isString(i)&&a.push("domain="+i),!0===o&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},298:(e,t,n)=>{"use strict";var r=n(516);e.exports=function(e){function t(e,n,s,i){var o=e[i++],a=Number.isFinite(+o),u=i>=e.length;return o=!o&&r.isArray(s)?s.length:o,u?(r.hasOwnProperty(s,o)?s[o]=[s[o],n]:s[o]=n,!a):(s[o]&&r.isObject(s[o])||(s[o]=[]),t(e,n,s[o],i)&&r.isArray(s[o])&&(s[o]=function(e){var t,n,r={},s=Object.keys(e),i=s.length;for(t=0;t<i;t++)r[n=s[t]]=e[n];return r}(s[o])),!a)}if(r.isFormData(e)&&r.isFunction(e.entries)){var n={};return r.forEachEntry(e,(function(e,s){t(function(e){return r.matchAll(/\w+|\[(\w*)]/g,e).map((function(e){return"[]"===e[0]?"":e[1]||e[0]}))}(e),s,n,0)})),n}return null}},137:e=>{"use strict";e.exports=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}},19:(e,t,n)=>{"use strict";var r=n(516);e.exports=function(e){return r.isObject(e)&&!0===e.isAxiosError}},202:(e,t,n)=>{"use strict";var r=n(516);e.exports=r.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function s(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=s(window.location.href),function(t){var n=r.isString(t)?s(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0}},18:(e,t,n)=>{"use strict";var r=n(516);e.exports=function(e,t){r.forEach(e,(function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])}))}},631:(e,t,n)=>{"use strict";var r=n(516),s=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,n,i,o={};return e?(r.forEach(e.split("\n"),(function(e){if(i=e.indexOf(":"),t=r.trim(e.slice(0,i)).toLowerCase(),n=r.trim(e.slice(i+1)),t){if(o[t]&&s.indexOf(t)>=0)return;o[t]="set-cookie"===t?(o[t]?o[t]:[]).concat([n]):o[t]?o[t]+", "+n:n}})),o):o}},656:e=>{"use strict";e.exports=function(e){var t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}},980:e=>{"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},440:(e,t,n)=>{"use strict";var r=n(516),s=n(845),i=n(786);function o(e){return r.isPlainObject(e)||r.isArray(e)}function a(e){return r.endsWith(e,"[]")?e.slice(0,-2):e}function u(e,t,n){return e?e.concat(t).map((function(e,t){return e=a(e),!n&&t?"["+e+"]":e})).join(n?".":""):t}var c=r.toFlatObject(r,{},null,(function(e){return/^is[A-Z]/.test(e)}));e.exports=function(e,t,n){if(!r.isObject(e))throw new TypeError("target must be an object");t=t||new(i||FormData);var l,d=(n=r.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!r.isUndefined(t[e])}))).metaTokens,f=n.visitor||v,p=n.dots,g=n.indexes,h=(n.Blob||"undefined"!=typeof Blob&&Blob)&&(l=t)&&r.isFunction(l.append)&&"FormData"===l[Symbol.toStringTag]&&l[Symbol.iterator];if(!r.isFunction(f))throw new TypeError("visitor must be a function");function m(e){if(null===e)return"";if(r.isDate(e))return e.toISOString();if(!h&&r.isBlob(e))throw new s("Blob is not supported. Use a Buffer instead.");return r.isArrayBuffer(e)||r.isTypedArray(e)?h&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function v(e,n,s){var i=e;if(e&&!s&&"object"==typeof e)if(r.endsWith(n,"{}"))n=d?n:n.slice(0,-2),e=JSON.stringify(e);else if(r.isArray(e)&&function(e){return r.isArray(e)&&!e.some(o)}(e)||r.isFileList(e)||r.endsWith(n,"[]")&&(i=r.toArray(e)))return n=a(n),i.forEach((function(e,s){!r.isUndefined(e)&&t.append(!0===g?u([n],s,p):null===g?n:n+"[]",m(e))})),!1;return!!o(e)||(t.append(u(s,n,p),m(e)),!1)}var y=[],w=Object.assign(c,{defaultVisitor:v,convertValue:m,isVisitable:o});if(!r.isObject(e))throw new TypeError("data must be an object");return function e(n,s){if(!r.isUndefined(n)){if(-1!==y.indexOf(n))throw Error("Circular reference detected in "+s.join("."));y.push(n),r.forEach(n,(function(n,i){!0===(!r.isUndefined(n)&&f.call(t,n,r.isString(i)?i.trim():i,s,w))&&e(n,s?s.concat(i):[i])})),y.pop()}}(e),t}},69:(e,t,n)=>{"use strict";var r=n(516),s=n(440),i=n(721);e.exports=function(e,t){return s(e,new i.classes.URLSearchParams,Object.assign({visitor:function(e,t,n,s){return i.isNode&&r.isBuffer(e)?(this.append(t,e.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}},841:(e,t,n)=>{"use strict";var r=n(641).version,s=n(845),i={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){i[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));var o={};i.transitional=function(e,t,n){function i(e,t){return"[Axios v"+r+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return function(n,r,a){if(!1===e)throw new s(i(r," has been removed"+(t?" in "+t:"")),s.ERR_DEPRECATED);return t&&!o[r]&&(o[r]=!0,console.warn(i(r," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,r,a)}},e.exports={assertOptions:function(e,t,n){if("object"!=typeof e)throw new s("options must be an object",s.ERR_BAD_OPTION_VALUE);for(var r=Object.keys(e),i=r.length;i-- >0;){var o=r[i],a=t[o];if(a){var u=e[o],c=void 0===u||a(u,o,e);if(!0!==c)throw new s("option "+o+" must be "+c,s.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new s("Unknown option "+o,s.ERR_BAD_OPTION)}},validators:i}},243:e=>{"use strict";e.exports=FormData},2:(e,t,n)=>{"use strict";var r=n(170);e.exports="undefined"!=typeof URLSearchParams?URLSearchParams:r},109:(e,t,n)=>{"use strict";e.exports={isBrowser:!0,classes:{URLSearchParams:n(2),FormData:n(243),Blob},protocols:["http","https","file","blob","url","data"]}},721:(e,t,n)=>{"use strict";e.exports=n(109)},516:(e,t,n)=>{"use strict";var r,s=n(12),i=Object.prototype.toString,o=(r=Object.create(null),function(e){var t=i.call(e);return r[t]||(r[t]=t.slice(8,-1).toLowerCase())});function a(e){return e=e.toLowerCase(),function(t){return o(t)===e}}function u(e){return Array.isArray(e)}function c(e){return void 0===e}var l=a("ArrayBuffer");function d(e){return"number"==typeof e}function f(e){return null!==e&&"object"==typeof e}function p(e){if("object"!==o(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}var g=a("Date"),h=a("File"),m=a("Blob"),v=a("FileList");function y(e){return"[object Function]"===i.call(e)}var w=a("URLSearchParams");function b(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),u(e))for(var n=0,r=e.length;n<r;n++)t.call(null,e[n],n,e);else for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.call(null,e[s],s,e)}var x,E,S=(x="undefined"!=typeof Uint8Array&&Object.getPrototypeOf(Uint8Array),function(e){return x&&e instanceof x}),I=a("HTMLFormElement"),R=(E=Object.prototype.hasOwnProperty,function(e,t){return E.call(e,t)});e.exports={isArray:u,isArrayBuffer:l,isBuffer:function(e){return null!==e&&!c(e)&&null!==e.constructor&&!c(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){var t="[object FormData]";return e&&("function"==typeof FormData&&e instanceof FormData||i.call(e)===t||y(e.toString)&&e.toString()===t)},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&l(e.buffer)},isString:function(e){return"string"==typeof e},isNumber:d,isObject:f,isPlainObject:p,isEmptyObject:function(e){return e&&0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype},isUndefined:c,isDate:g,isFile:h,isBlob:m,isFunction:y,isStream:function(e){return f(e)&&y(e.pipe)},isURLSearchParams:w,isStandardBrowserEnv:function(){var e;return("undefined"==typeof navigator||"ReactNative"!==(e=navigator.product)&&"NativeScript"!==e&&"NS"!==e)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:b,merge:function e(){var t={};function n(n,r){p(t[r])&&p(n)?t[r]=e(t[r],n):p(n)?t[r]=e({},n):u(n)?t[r]=n.slice():t[r]=n}for(var r=0,s=arguments.length;r<s;r++)b(arguments[r],n);return t},extend:function(e,t,n){return b(t,(function(t,r){e[r]=n&&"function"==typeof t?s(t,n):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e},inherits:function(e,t,n,r){e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,n&&Object.assign(e.prototype,n)},toFlatObject:function(e,t,n,r){var s,i,o,a={};if(t=t||{},null==e)return t;do{for(i=(s=Object.getOwnPropertyNames(e)).length;i-- >0;)o=s[i],r&&!r(o,e,t)||a[o]||(t[o]=e[o],a[o]=!0);e=!1!==n&&Object.getPrototypeOf(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:o,kindOfTest:a,endsWith:function(e,t,n){e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;var r=e.indexOf(t,n);return-1!==r&&r===n},toArray:function(e){if(!e)return null;if(u(e))return e;var t=e.length;if(!d(t))return null;for(var n=new Array(t);t-- >0;)n[t]=e[t];return n},isTypedArray:S,isFileList:v,forEachEntry:function(e,t){for(var n,r=(e&&e[Symbol.iterator]).call(e);(n=r.next())&&!n.done;){var s=n.value;t.call(e,s[0],s[1])}},matchAll:function(e,t){for(var n,r=[];null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:I,hasOwnProperty:R}},894:e=>{e.exports="object"==typeof self?self.FormData:window.FormData},548:(e,t,n)=>{"use strict";n.d(t,{A:()=>Se});class r{on(e,t){var n=this[e];n?n.push(t):this[e]=[t]}dispatch(e,t){var n=this[e];n&&n.forEach((e=>e(t)))}}function s(e){Se.config.logging&&console.log(`Gist: ${e}`)}var i,o=new Uint8Array(16);function a(){if(!i&&!(i="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return i(o)}const u=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var c=[],l=0;l<256;++l)c.push((l+256).toString(16).substr(1));const d=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(c[e[t+0]]+c[e[t+1]]+c[e[t+2]]+c[e[t+3]]+"-"+c[e[t+4]]+c[e[t+5]]+"-"+c[e[t+6]]+c[e[t+7]]+"-"+c[e[t+8]]+c[e[t+9]]+"-"+c[e[t+10]]+c[e[t+11]]+c[e[t+12]]+c[e[t+13]]+c[e[t+14]]+c[e[t+15]]).toLowerCase();if(!function(e){return"string"==typeof e&&u.test(e)}(n))throw TypeError("Stringified UUID is invalid");return n},f=function(e,t,n){var r=(e=e||{}).random||(e.rng||a)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var s=0;s<16;++s)t[n+s]=r[s];return t}return d(r)},p=365,g="gist.web.isPersistingSession";function h(e,t,n=null){var r=n;r||(r=new Date).setDate(r.getDate()+p);const s={value:t,expiry:r};w().setItem(e,JSON.stringify(s))}function m(e){const t=w().getItem(e);if(!t)return null;const n=JSON.parse(t);return(new Date).getTime()>new Date(n.expiry).getTime()?(v(e),null):n.value}function v(e){w().removeItem(e)}function y(){const e=sessionStorage.getItem(g);return null===e?(sessionStorage.setItem(g,"true"),!0):"true"===e}function w(){return y()?localStorage:sessionStorage}var b=n(505),x=n.n(b);const E="gist.web.userQueueVersion",S={ENGINE_API_ENDPOINT:{prod:"https://engine.api.gist.build",dev:"https://engine.api.dev.gist.build",local:"http://engine.api.local.gist.build:82"},GIST_QUEUE_API_ENDPOINT:{prod:"https://gist-queue-consumer-api.cloud.gist.build",dev:"https://gist-queue-consumer-api.cloud.dev.gist.build",local:"http://api.local.gist.build:86"},GIST_QUEUE_V3_API_ENDPOINT:{prod:"https://consumer.cloud.gist.build",dev:"https://consumer.cloud.dev.gist.build",local:"http://api.local.gist.build:86"},GIST_VIEW_ENDPOINT:{prod:"https://renderer.gist.build/3.0",dev:"https://renderer.gist.build/3.0",local:"http://app.local.gist.build:8080/web"},getQueueAPIVersion:function(){return m(E)??"2"},setQueueAPIVersion:function(e){h(E,e),s(`Set user queue version to "${e}"`)}};function I(){var e=x().create({baseURL:S.GIST_QUEUE_API_ENDPOINT[Se.config.env],timeout:5e3});"3"===S.getQueueAPIVersion()&&(e.defaults.baseURL=S.GIST_QUEUE_V3_API_ENDPOINT[Se.config.env]),e.defaults.headers.common["X-CIO-Site-Id"]=Se.config.siteId,e.defaults.headers.common["X-CIO-Client-Platform"]="web";var t=k();return null!=t&&(e.defaults.headers.common["X-Gist-Encoded-User-Token"]=btoa(t)),e}const R="gist.web.userLocale";var O=600,T=!1;const A="gist.web.userQueueNextPullCheck",D="gist.web.sessionId";const P="gist.web.userToken",$="gist.web.usingGuestUserToken",C="gist.web.guestUserToken";function N(){return null!==m($)}function k(){return m(P)}function _(){if(null===k()){var e=m(C);null==e&&(e=f(),h(C,e),s(`Set guest user token "${e}" with expiry date set to 1 year from today`)),h(P,e),h($,!0),s(`Using anonymous session with token: "${e}"`)}}async function j(){var e=k();return null===e?null:await async function(e){const t=(new TextEncoder).encode(e),n=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(n)).map((e=>e.toString(16).padStart(2,"0"))).join("")}(e)}function U(e){const t={isEmbedded:!1,elementId:"",hasRouteRule:!1,routeRule:"",position:"",hasPosition:!1,shouldScale:!1,campaignId:null,messageWidth:414,overlayColor:"#00000033",persistent:!1,exitClick:!1,hasCustomWidth:!1},n=e?.properties?.gist;return n?{isEmbedded:!!n.elementId,elementId:n.elementId||"",hasRouteRule:!!n.routeRuleWeb,routeRule:n.routeRuleWeb||"",position:n.position||"",hasPosition:!!n.position,shouldScale:!!n.scale,campaignId:n.campaignId??null,messageWidth:n.messageWidth>0?n.messageWidth:t.messageWidth,hasCustomWidth:n.messageWidth>0,overlayColor:n.overlayColor||t.overlayColor,persistent:!!n.persistent,exitClick:!!n.exitClick}:t}var L=["x-gist-top","x-gist-floating-top","x-gist-bottom","x-gist-floating-bottom","x-gist-floating-bottom-left","x-gist-floating-bottom-right","x-gist-floating-top-left","x-gist-floating-top-right"];const q=e=>new Promise((t=>setTimeout(t,e))),B=["x-gist-top","x-gist-bottom","x-gist-floating-top","x-gist-floating-bottom"];function F(e){var t=z(e);if(t)return t.style&&t.style.height&&"0px"!=t.style.height}function M(e,t){const n=document.getElementById(e);n&&(n.onload=function(){!function(e,t){const n=document.getElementById(e);n&&n.contentWindow&&n.contentWindow.postMessage({options:t},"*")}(e,t)})}function V(){var e=document.querySelector("#gist-embed-message");e&&e.parentNode.removeChild(e)}function W(e){return`gist-${e}`}function H(){var e=document.querySelector(".gist-message");e&&e.classList.add("visible")}function z(e){try{return document.querySelector(`#${e}`)||null}catch{return null}}const G="gist.web.message.broadcasts";async function J(e,t){return m(e).find((e=>e.queueId===t))}function Q(e){return e.properties&&e.properties.gist&&e.properties.gist.broadcast}async function X(){const e=await j();return e?`${G}.${e}`:null}function K(e,t){return`${e}.${t}.numberOfTimesShown`}function Y(e,t){return`${e}.${t}.shouldShow`}const Z="gist.web.message.user";async function ee(){const e=await j();return e?`${Z}.${e}`:null}async function te(){const e=await j();return e?`${Z}.${e}.seen`:null}async function ne(e){const t=await j();return t?`${Z}.${t}.message.${e}.loading`:null}async function re(e){if(Se.isDocumentVisible){if(Se.overlayInstanceId)return s(`Message ${Se.overlayInstanceId} already showing.`),null;var t=U(e);return e.instanceId=f(),e.overlay=!0,e.firstLoad=!0,e.shouldResizeHeight=!0,e.shouldScale=t.shouldScale,e.renderStartTime=(new Date).getTime(),Se.overlayInstanceId=e.instanceId,Se.currentMessages.push(e),ce(e)}return s("Document hidden, not showing message now."),null}async function se(e,t){return Se.isDocumentVisible?(e.instanceId=f(),e.overlay=!1,e.firstLoad=!0,e.shouldScale=!1,e.elementId=t,e.shouldResizeHeight=!F(t),e.renderStartTime=(new Date).getTime(),Se.currentMessages.push(e),ce(e,t)):(s("Document hidden, not showing message now."),null)}async function ie(e){e?(Se.messageDismissed(e),e.overlay?await ue(!0,e):ae(e)):s(`Message with instance id: ${e.instanceId} not found`)}async function oe(e){var t=U(e);e?t.persistent&&(s("Persistent message dismissed, logging view"),await me(e),await le(e)):s(`Message with instance id: ${e.instanceId} not found`)}function ae(e){var t;fe(e.instanceId),(t=z(e.elementId))&&(t.classList.remove("gist-visible"),t.style.removeProperty("height"),t.innerHTML="")}async function ue(e,t){fe(t.instanceId),Se.overlayInstanceId=null,e?await async function(){var e=document.querySelector(".gist-message");e&&(e.classList.remove("visible"),await q(300)),V()}():V(),0==Se.currentMessages.length&&(window.removeEventListener("message",he),window.removeEventListener("touchstart",ge))}function ce(e,t=null){if(t&&function(e){var t=z(e);return!(!t||!t.classList.contains("gist-visible"))}(t))return s(`Message ${e.messageId} already showing in element ${t}.`),null;var n={endpoint:S.ENGINE_API_ENDPOINT[Se.config.env],siteId:Se.config.siteId,dataCenter:Se.config.dataCenter,messageId:e.messageId,instanceId:e.instanceId,livePreview:!1,properties:e.properties},r=`${S.GIST_VIEW_ENDPOINT[Se.config.env]}/index.html`;return window.addEventListener("message",he),window.addEventListener("touchstart",ge),t?(L.includes(t)&&function(e){const t=document.createElement("div");t.id=e,"x-gist-top"===e?document.body.insertBefore(t,document.body.firstChild):document.body.insertAdjacentElement("beforeend",t),s("Top & bottom elements injected into page")}(t),function(e,t,n,r){var i=z(e);if(i){var o=W(n.instanceId);i.classList.add(o);var a=U(n),u=a.messageWidth+"px";B.includes(e)&&!a.hasCustomWidth&&(u="100%"),L.includes(e)&&(i.style.width=u),F(e)||(i.style.height="0px"),i.innerHTML=function(e,t,n){var r=function(e,t,n){var r=800;return t.messageWidth>r&&(r=t.messageWidth),`\n <div id="gist-embed">\n <style>\n #x-gist-floating-top, #x-gist-floating-top-left, #x-gist-floating-top-right {\n position: fixed;\n top: 0px;\n z-index: 1000000;\n }\n #x-gist-floating-bottom, #x-gist-floating-bottom-left, #x-gist-floating-bottom-right {\n position: fixed;\n bottom: 0px;\n z-index: 1000000;\n }\n #x-gist-bottom, #x-gist-top, #x-gist-floating-top, #x-gist-floating-bottom {\n left: 50%;\n transform: translate(-50%, 0%);\n }\n #x-gist-floating-top-right, #x-gist-floating-bottom-right {\n right: 0px;\n }\n #gist-embed {\n position: relative;\n height: 100%;\n width: 100%;\n }\n #gist-embed-container {\n position: relative;\n height: 100%;\n width: 100%;\n }\n #gist-embed-container .gist-frame {\n height: 100%;\n width: 100%;\n border: none;\n }\n #x-gist-top.${e},\n #x-gist-bottom.${e},\n #x-gist-floating-top.${e},\n #x-gist-floating-bottom.${e},\n #x-gist-floating-top-left.${e},\n #x-gist-floating-top-right.${e},\n #x-gist-floating-bottom-left.${e},\n #x-gist-floating-bottom-right.${e} {\n transition: height 0.1s ease-in-out;\n }\n @media (max-width: ${r}px) {\n #x-gist-top.${e},\n #x-gist-bottom.${e},\n #x-gist-floating-top.${e},\n #x-gist-floating-bottom.${e},\n #x-gist-floating-top-left.${e},\n #x-gist-floating-top-right.${e},\n #x-gist-floating-bottom-left.${e},\n #x-gist-floating-bottom-right.${e} {\n width: 100% !important;\n }\n }\n </style>\n <div id="gist-embed-container">\n <iframe id="${e}" class="gist-frame" src="${n}"></iframe>\n </div>\n </div>`}(W(t.instanceId),n,e);return r}(t,n,a),M(o,r)}else s(`Message could not be embedded, elementId ${e} not found.`)}(t,r,e,n)):function(e,t,n){document.body.insertAdjacentHTML("afterbegin",function(e,t){var n=U(t),r=function(e,t,n){var r=600;return t.messageWidth>r&&(r=t.messageWidth),`\n <div id="gist-embed-message">\n <style>\n #gist-overlay.background {\n position: fixed;\n z-index: 9999999998;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n background-color: ${t.overlayColor};\n visibility: hidden;\n }\n #gist-overlay.background.visible {\n visibility: visible;\n }\n #gist-overlay.background.is-blacked-out {\n display: block;\n }\n .gist-message {\n width: ${t.messageWidth}px;\n position: absolute;\n border: none;\n opacity: 0;\n transition: opacity 0.3s ease-in-out, height 0.1s ease-in-out;\n z-index: 9999999999;\n left: 50%;\n transform: translateX(-50%);\n }\n .gist-message.visible {\n opacity: 1;\n pointer-events: auto;\n }\n .gist-message.center {\n transform: translate(-50%, -50%);\n top: 50%;\n }\n .gist-message.bottom {\n bottom: 0;\n }\n .gist-message.top {\n top: 0;\n }\n @media (max-width: ${r}px) {\n .gist-message {\n width: 100%;\n }\n }\n </style>\n <div id="gist-overlay" class="background">\n <iframe id="${e}" class="gist-message" src="${n}"></iframe>\n </div>\n </div>`}(W(t.instanceId),n,e);return r}(e,t)),M(W(t.instanceId),n)}(r,e,n),e}async function le(e){s(`Message shown, logging view for: ${e.messageId}`);var t={};null!=e.queueId?(await me(e),t=await async function(e){try{return await I().post(`/api/v1/logs/queue/${e}`)}catch(e){return e.response}}(e.queueId)):t=await async function(e){try{return await I().post(`/api/v1/logs/message/${e}`)}catch(e){return e.response}}(e.messageId),200===t.status?s("Message view logged"):s(`Problem logging message: ${t.status}`)}function de(e){return Se.currentMessages.find((t=>t.instanceId===e))}function fe(e){Se.currentMessages=Se.currentMessages.filter((t=>t.instanceId!==e))}function pe(e,t){fe(e),Se.currentMessages.push(t)}function ge(){}async function he(e){if(e.data.gist){var t=e.data.gist.instanceId,n=de(t);if(!n)return;var r=U(n);switch(e.data.gist.method){case"routeLoaded":var i=.001*((new Date).getTime()-n.renderStartTime);s(`Engine render for message: ${n.messageId} timer elapsed in ${i.toFixed(3)} seconds`),async function(e){const t=await ne(e);if(!t)return!1;v(t)}(n.queueId),n.currentRoute=e.data.gist.parameters.route,n.firstLoad&&(n.overlay?function(e){var t=U(e),n=document.querySelector("#gist-overlay");if(n){n.classList.add("visible");var r=document.querySelector(".gist-message");e.position?r.classList.add(e.position):r.classList.add("center"),setTimeout(H,100),t.exitClick&&setTimeout((()=>function(e){var t=document.querySelector("#gist-overlay");t&&t.addEventListener("click",(function(){Se.dismissMessage(e)}))}(e.instanceId)),1e3)}else V()}(n):(d=z(n.elementId))&&d.classList.add("gist-visible"),Se.messageShown(n),r.persistent?s("Persistent message shown, skipping logging view"):await le(n),n.firstLoad=!1),pe(t,n);break;case"tap":var o=e.data.gist.parameters.action,a=e.data.gist.parameters.name;if(Se.messageAction(n,o,a),e.data.gist.parameters.system&&!r.persistent){await ie(n);break}try{var u=new URL(o);if(u&&"gist:"===u.protocol)switch(u.href.replace("gist://","").split("?")[0]){case"close":await ie(n),await oe(n),await ve(n),await xe();break;case"showMessage":var c=u.searchParams.get("messageId"),l=u.searchParams.get("properties");c&&(l&&(l=JSON.parse(atob(l))),await Se.showMessage({messageId:c,properties:l}));break;case"loadPage":(u=u.href.substring(u.href.indexOf("?url=")+5))&&(u.startsWith("https://")||u.startsWith("http://")||u.startsWith("/")?window.location.href=u:window.location.href=window.location+u)}}catch{}break;case"routeChanged":n.currentRoute=e.data.gist.parameters.route,n.renderStartTime=(new Date).getTime(),pe(t,n),s(`Route changed to: ${n.currentRoute}`);break;case"sizeChanged":s(`Size Changed Width: ${e.data.gist.parameters.width} - Height: ${e.data.gist.parameters.height}`),n.elementId&&!n.shouldResizeHeight||function(e,t){var n=z(e.elementId?e.elementId:W(e.instanceId));if(n){var r=n.style;if(t.height>0)if(t.height>window.innerHeight){var s=1-(t.height/window.innerHeight-1);e.shouldScale&&s>=.4?(r.height=`${t.height}px`,r.transform=`translateX(-50%) translateY(-50%) scale(${s})`):r.height=`${window.innerHeight}px`}else r.height=`${t.height}px`}}(n,e.data.gist.parameters);break;case"titleChanged":s(`Overlay title changed to: ${e.data.gist.parameters.title}`),function(e,t){var n=z(W(e));n&&(n.title=t)}(t,e.data.gist.parameters.title);break;case"eventDispatched":Se.events.dispatch("eventDispatched",{name:e.data.gist.parameters.name,payload:e.data.gist.parameters.payload});break;case"error":case"routeError":Se.messageError(n),Se.overlayInstanceId?ue(!1,n):ae(n)}}var d}async function me(e){s(`Logging user message view locally for: ${e.queueId}`),Q(e)?await async function(e){s(`Marking broadcast ${e} as seen.`);const t=await X();if(!t)return;const n=await J(t,e);if(!n)return;const{broadcast:r}=n.properties.gist,i=K(t,e),o=Y(t,e);let a=m(i)||0;if(h(i,a+1),1===r.frequency.count)h(o,!1),s(`Marked broadcast ${e} as seen.`);else{let t=new Date;t.setSeconds(t.getSeconds()+r.frequency.delay),h(o,!1,t),s(`Marked broadcast ${e} as seen, broadcast was seen ${a+1} times, next show date is ${t}.`)}}(e.queueId):await async function(e){const t=await te();if(!t)return;const n=m(t)??[];n.push(e),h(t,n)}(e.queueId)}async function ve(e){Q(e)&&(s(`Logging broadcast dismissed locally for: ${e.queueId}`),await async function(e){s(`Marking broadcast ${e} as dismissed.`);const t=await X();if(!t)return;const n=await J(t,e);if(!n)return;const{broadcast:r}=n.properties.gist;!0!==r.frequency.ignoreDismiss?(h(Y(t,e),!1),s(`Marked broadcast ${e} as dismissed and will not show again.`)):s(`Broadcast ${e} is set to ignore dismiss.`)}(e.queueId))}var ye=(e,t)=>e().then((e=>new Promise((t=>setTimeout(t,e))))(t).then((()=>ye(e,t)))),we=!1;async function be(){we?xe():(async function(){var e=`G${f().substring(0,8)}`,t=document.createElement("div");t.setAttribute("id",e),t.style.display="none",document.body.appendChild(t),await q(5e3),se({messageId:""},e)}(),k()?(s("Queue watcher started"),we=!0,ye((()=>new Promise((()=>async function(){if(k())if(Se.isDocumentVisible)if(null===m(A)){var e=await async function(){var e,t;try{if(!T){T=!0;var n={"X-Gist-User-Anonymous":N(),"Content-Language":null!==m(R)?m(R):navigator.language};if("3"===S.getQueueAPIVersion())e=await I().post(`/api/v3/users?sessionId=${t=m(D),t||(t=f()),h(D,t,new Date((new Date).getTime()+18e5)),t}`,{},{headers:n});else{var r=(new Date).getTime();e=await I().post(`/api/v2/users?timestamp=${r}`,{},{headers:n})}}}catch(t){t.response?e=t.response:s(`Error getting user queue: ${t}`)}finally{T=!1,function(e){if(e&&e.headers){var t=e.headers["x-gist-queue-polling-interval"];t&&t>0&&(O=t)}var n=new Date((new Date).getTime()+1e3*O);h(A,O,n)}(e),function(e){if(e&&e.headers){var t=e.headers["x-cio-queue-version"];t&&S.setQueueAPIVersion(t)}}(e)}return e}(),t=[];e?(200===e.status||204===e.status?(s("200 response, updating local store."),async function(e){const t=await ee();t&&h(t,e.filter((e=>!(e.properties&&e.properties.gist&&e.properties.gist.broadcast))),new Date(Date.now()+36e5))}(t=e.data),async function(e){const t=await X();if(!t)return;const n=new Date;n.setDate(n.getDate()+30),h(t,e.filter(Q),n)}(t)):304===e.status&&s("304 response, using local store."),await xe()):s("There was an error while checking message queue.")}else s("Next queue pull scheduled for later.");else s("Document not visible, skipping queue check.");else s("User token reset, skipping queue check.")}()))),1e3)):s("User token not setup, queue not started."))}async function xe(){var e=await async function(){const e=await X();return e?(m(e)??[]).filter((t=>{const{broadcast:n}=t.properties.gist,r=m(Y(e,t.queueId))??!0,s=m(K(e,t.queueId))||0,i=0===n.frequency.count;return r&&(i||s<n.frequency.count)})):[]}(),t=await async function(){const e=await ee();if(!e)return[];const t=m(e)??[],n=await async function(){const e=await te();return e?m(e)??[]:[]}();return t.filter((e=>!n.includes(e.queueId)))}(),n=e.concat(t);s(`Messages in local queue: ${n.length}`);var r=n.sort(((e,t)=>e.priority-t.priority));for(const e of r)await Ee(e)}async function Ee(e){var t=U(e);if(t.hasRouteRule){var n=Se.currentRoute;null==n&&(n=new URL(window.location.href).pathname);var r=t.routeRule;if(s(`Verifying route against rule: ${r}`),!new RegExp(r).test(n))return s(`Route ${n} does not match rule.`),!1}if(t.hasPosition&&(e.position=t.position),t.persistent||function(e){if(!Q(e))return!1;const{broadcast:t}=e.properties.gist;return 0===t.frequency.delay&&0===t.frequency.count}(e)||!await async function(e){const t=await ne(e);return!!t&&null!==m(t)}(e.queueId)){var i;return(i=t.isEmbedded?await se(e,t.elementId):await re(e))&&async function(e){const t=await ne(e);if(!t)return!1;h(t,!0,new Date(Date.now()+5e3))}(e.queueId),i}return s(`Not showing message with queueId ${e.queueId} because its already loading.`),!1}const Se=class{static async setup(e){this.events=new r,this.config={useAnonymousSession:void 0!==e.useAnonymousSession&&e.useAnonymousSession,siteId:e.siteId,dataCenter:e.dataCenter,env:void 0===e.env?"prod":e.env,logging:void 0!==e.logging&&e.logging,experiments:void 0!==e.experiments&&e.experiments},this.currentMessages=[],this.overlayInstanceId=null,this.currentRoute=null,this.isDocumentVisible=!0,this.config.isPreviewSession=function(){const e=new URLSearchParams(window.location.search).get("cioPreviewId");return e&&(sessionStorage.setItem(g,!1),Se.setUserToken(e),s(`Preview mode enabled with user token: ${e}`)),!y()}(),s(`Setup complete on ${this.config.env} environment.`),!this.config.isPreviewSession&&this.config.useAnonymousSession&&_(),await be(),document.addEventListener("visibilitychange",(async()=>{"hidden"===document.visibilityState?this.isDocumentVisible=!1:(this.isDocumentVisible=!0,await xe())}),!1)}static async setCurrentRoute(e){this.currentRoute=e,s(`Current route set to: ${e}`),await xe()}static async setUserToken(e,t){this.config.isPreviewSession||(function(e,t){void 0===t&&(t=new Date).setDate(t.getDate()+30),h(P,e,t),N()&&(v(A),v($)),s(`Set user token "${e}" with expiry date set to ${t}`)}(e,t),await be())}static setUserLocale(e){var t;h(R,t=e),s(`Set user locate to "${t}"`)}static async clearUserToken(){this.config.isPreviewSession||(v(P),s("Cleared user token"),this.config.useAnonymousSession&&_(),await be())}static async dismissMessage(e){var t=de(e);await ie(t),await oe(t),await ve(t),await xe()}static async embedMessage(e,t){var n=await se(e,t);return n?n.instanceId:null}static async showMessage(e){var t=await re(e);return t?t.instanceId:null}static messageShown(e){s(`Message shown: ${e.messageId}`),this.events.dispatch("messageShown",e)}static messageDismissed(e){null!==e&&(s(`Message dismissed: ${e.messageId}`),this.events.dispatch("messageDismissed",e))}static messageError(e){s(`Message error: ${e.messageId}`),this.events.dispatch("messageError",e)}static messageAction(e,t,n){s(`Message action: ${e.currentRoute}, ${t} with name ${n} on ${e.instanceId}`),this.events.dispatch("messageAction",{message:e,action:t,name:n})}}},44:(e,t,n)=>{const r=n(548).A;e.exports=r}},t={};function n(r){var s=t[r];if(void 0!==s)return s.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}return n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(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=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n(44)})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Gist=t():e.Gist=t()}(this,(()=>(()=>{var e={548:(e,t,n)=>{"use strict";n.d(t,{A:()=>Ie});class s{on(e,t){var n=this[e];n?n.push(t):this[e]=[t]}dispatch(e,t){var n=this[e];n&&n.forEach((e=>e(t)))}}function i(e){Ie.config.logging&&console.log(`Gist: ${e}`)}var a,o=new Uint8Array(16);function r(){if(!a&&!(a="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return a(o)}const u=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var c=[],d=0;d<256;++d)c.push((d+256).toString(16).substr(1));const g=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(c[e[t+0]]+c[e[t+1]]+c[e[t+2]]+c[e[t+3]]+"-"+c[e[t+4]]+c[e[t+5]]+"-"+c[e[t+6]]+c[e[t+7]]+"-"+c[e[t+8]]+c[e[t+9]]+"-"+c[e[t+10]]+c[e[t+11]]+c[e[t+12]]+c[e[t+13]]+c[e[t+14]]+c[e[t+15]]).toLowerCase();if(!function(e){return"string"==typeof e&&u.test(e)}(n))throw TypeError("Stringified UUID is invalid");return n},l=function(e,t,n){var s=(e=e||{}).random||(e.rng||r)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t){n=n||0;for(var i=0;i<16;++i)t[n+i]=s[i];return t}return g(s)},m=365,f="gist.web.isPersistingSession";function h(e,t,n=null){var s=n;s||(s=new Date).setDate(s.getDate()+m);const i={value:t,expiry:s};y().setItem(e,JSON.stringify(i))}function p(e){const t=y().getItem(e);if(!t)return null;const n=JSON.parse(t);return(new Date).getTime()>new Date(n.expiry).getTime()?(w(e),null):n.value}function w(e){y().removeItem(e)}function v(){const e=sessionStorage.getItem(f);return null===e?(sessionStorage.setItem(f,"true"),!0):"true"===e}function y(){return v()?localStorage:sessionStorage}const b="gist.web.userQueueVersion",I={ENGINE_API_ENDPOINT:{prod:"https://engine.api.gist.build",dev:"https://engine.api.dev.gist.build",local:"http://engine.api.local.gist.build:82"},GIST_QUEUE_API_ENDPOINT:{prod:"https://gist-queue-consumer-api.cloud.gist.build",dev:"https://gist-queue-consumer-api.cloud.dev.gist.build",local:"http://api.local.gist.build:86"},GIST_QUEUE_V3_API_ENDPOINT:{prod:"https://consumer.cloud.gist.build",dev:"https://consumer.cloud.dev.gist.build",local:"http://api.local.gist.build:86"},GIST_VIEW_ENDPOINT:{prod:"https://renderer.gist.build/3.0",dev:"https://renderer.gist.build/3.0",local:"http://app.local.gist.build:8080/web"},getQueueAPIVersion:function(){return p(b)??"2"},setQueueAPIVersion:function(e){h(b,e,new Date((new Date).getTime()+18e5)),i(`Set user queue version to "${e}"`)}};function $(){const e="3"===I.getQueueAPIVersion()?I.GIST_QUEUE_V3_API_ENDPOINT[Ie.config.env]:I.GIST_QUEUE_API_ENDPOINT[Ie.config.env],t={"X-CIO-Site-Id":Ie.config.siteId,"X-CIO-Client-Platform":"web"},n=M();async function s(n,s={}){const i=e+n,a=new AbortController,o=setTimeout((()=>a.abort()),5e3);try{const e=await fetch(i,{method:s.method||"GET",headers:{...t,...s.headers||{}},body:s.method&&"GET"!==s.method.toUpperCase()?s.body:void 0,signal:a.signal});clearTimeout(o);const n=e.headers.get("content-type")?.includes("application/json"),r=n?await e.json():await e.text(),u=Object.fromEntries(e.headers.entries());if(e.status<200||e.status>=400)throw{response:{status:e.status,data:r,headers:u}};return{status:e.status,headers:u,data:r}}catch(e){throw clearTimeout(o),e.response||(e.response={status:0,data:e.message||"Unknown error"}),e}}return null!=n&&(t["X-Gist-Encoded-User-Token"]=btoa(n)),s.post=(e,t={},n={})=>s(e,{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json",...n.headers||{}}}),s}const x="gist.web.userLocale";var S=600,T=!1;const D="gist.web.userQueueNextPullCheck",E="gist.web.sessionId";const k="gist.web.userToken",P="gist.web.usingGuestUserToken",q="gist.web.guestUserToken";function C(){return null!==p(P)}function M(){return p(k)}function R(){if(null===M()){var e=p(q);null==e&&(e=l(),h(q,e),i(`Set guest user token "${e}" with expiry date set to 1 year from today`)),h(k,e),h(P,!0),i(`Using anonymous session with token: "${e}"`)}}async function L(){var e=M();return null===e?null:await async function(e){const t=(new TextEncoder).encode(e),n=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(n)).map((e=>e.toString(16).padStart(2,"0"))).join("")}(e)}function A(e){const t={isEmbedded:!1,elementId:"",hasRouteRule:!1,routeRule:"",position:"",hasPosition:!1,shouldScale:!1,campaignId:null,messageWidth:414,overlayColor:"#00000033",persistent:!1,exitClick:!1,hasCustomWidth:!1},n=e?.properties?.gist;return n?{isEmbedded:!!n.elementId,elementId:n.elementId||"",hasRouteRule:!!n.routeRuleWeb,routeRule:n.routeRuleWeb||"",position:n.position||"",hasPosition:!!n.position,shouldScale:!!n.scale,campaignId:n.campaignId??null,messageWidth:n.messageWidth>0?n.messageWidth:t.messageWidth,hasCustomWidth:n.messageWidth>0,overlayColor:n.overlayColor||t.overlayColor,persistent:!!n.persistent,exitClick:!!n.exitClick}:t}var N=["x-gist-top","x-gist-floating-top","x-gist-bottom","x-gist-floating-bottom","x-gist-floating-bottom-left","x-gist-floating-bottom-right","x-gist-floating-top-left","x-gist-floating-top-right"];const U=e=>new Promise((t=>setTimeout(t,e))),W=["x-gist-top","x-gist-bottom","x-gist-floating-top","x-gist-floating-bottom"];function O(e){var t=Q(e);if(t)return t.style&&t.style.height&&"0px"!=t.style.height}function V(e,t){const n=document.getElementById(e);n&&(n.onload=function(){!function(e,t){const n=document.getElementById(e);n&&n.contentWindow&&n.contentWindow.postMessage({options:t},"*")}(e,t)})}function _(){var e=document.querySelector("#gist-embed-message");e&&e.parentNode.removeChild(e)}function G(e){return`gist-${e}`}function j(){var e=document.querySelector(".gist-message");e&&e.classList.add("visible")}function Q(e){try{return document.querySelector(`#${e}`)||null}catch{return null}}const H="gist.web.message.broadcasts";async function z(e,t){return p(e).find((e=>e.queueId===t))}function X(e){return e.properties&&e.properties.gist&&e.properties.gist.broadcast}async function B(){const e=await L();return e?`${H}.${e}`:null}function J(e,t){return`${e}.${t}.numberOfTimesShown`}function F(e,t){return`${e}.${t}.shouldShow`}const Y="gist.web.message.user";async function K(){const e=await L();return e?`${Y}.${e}`:null}async function Z(){const e=await L();return e?`${Y}.${e}.seen`:null}async function ee(e){const t=await L();return t?`${Y}.${t}.message.${e}.loading`:null}async function te(e){if(Ie.isDocumentVisible){if(Ie.overlayInstanceId)return i(`Message ${Ie.overlayInstanceId} already showing.`),null;var t=A(e);return e.instanceId=l(),e.overlay=!0,e.firstLoad=!0,e.shouldResizeHeight=!0,e.shouldScale=t.shouldScale,e.renderStartTime=(new Date).getTime(),Ie.overlayInstanceId=e.instanceId,Ie.currentMessages.push(e),re(e)}return i("Document hidden, not showing message now."),null}async function ne(e,t){return Ie.isDocumentVisible?(e.instanceId=l(),e.overlay=!1,e.firstLoad=!0,e.shouldScale=!1,e.elementId=t,e.shouldResizeHeight=!O(t),e.renderStartTime=(new Date).getTime(),Ie.currentMessages.push(e),re(e,t)):(i("Document hidden, not showing message now."),null)}async function se(e){e?(Ie.messageDismissed(e),e.overlay?await oe(!0,e):ae(e)):i(`Message with instance id: ${e.instanceId} not found`)}async function ie(e){var t=A(e);e?t.persistent&&(i("Persistent message dismissed, logging view"),await fe(e),await ue(e)):i(`Message with instance id: ${e.instanceId} not found`)}function ae(e){var t;de(e.instanceId),(t=Q(e.elementId))&&(t.classList.remove("gist-visible"),t.style.removeProperty("height"),t.innerHTML="")}async function oe(e,t){de(t.instanceId),Ie.overlayInstanceId=null,e?await async function(){var e=document.querySelector(".gist-message");e&&(e.classList.remove("visible"),await U(300)),_()}():_(),0==Ie.currentMessages.length&&(window.removeEventListener("message",me),window.removeEventListener("touchstart",le))}function re(e,t=null){if(t&&function(e){var t=Q(e);return!(!t||!t.classList.contains("gist-visible"))}(t))return i(`Message ${e.messageId} already showing in element ${t}.`),null;var n={endpoint:I.ENGINE_API_ENDPOINT[Ie.config.env],siteId:Ie.config.siteId,dataCenter:Ie.config.dataCenter,messageId:e.messageId,instanceId:e.instanceId,livePreview:!1,properties:e.properties},s=`${I.GIST_VIEW_ENDPOINT[Ie.config.env]}/index.html`;return window.addEventListener("message",me),window.addEventListener("touchstart",le),t?(N.includes(t)&&function(e){const t=document.createElement("div");t.id=e,"x-gist-top"===e?document.body.insertBefore(t,document.body.firstChild):document.body.insertAdjacentElement("beforeend",t),i("Top & bottom elements injected into page")}(t),function(e,t,n,s){var a=Q(e);if(a){var o=G(n.instanceId);a.classList.add(o);var r=A(n),u=r.messageWidth+"px";W.includes(e)&&!r.hasCustomWidth&&(u="100%"),N.includes(e)&&(a.style.width=u),O(e)||(a.style.height="0px"),a.innerHTML=function(e,t,n){var s=function(e,t,n){var s=800;return t.messageWidth>s&&(s=t.messageWidth),`\n <div id="gist-embed">\n <style>\n #x-gist-floating-top, #x-gist-floating-top-left, #x-gist-floating-top-right {\n position: fixed;\n top: 0px;\n z-index: 1000000;\n }\n #x-gist-floating-bottom, #x-gist-floating-bottom-left, #x-gist-floating-bottom-right {\n position: fixed;\n bottom: 0px;\n z-index: 1000000;\n }\n #x-gist-bottom, #x-gist-top, #x-gist-floating-top, #x-gist-floating-bottom {\n left: 50%;\n transform: translate(-50%, 0%);\n }\n #x-gist-floating-top-right, #x-gist-floating-bottom-right {\n right: 0px;\n }\n #gist-embed {\n position: relative;\n height: 100%;\n width: 100%;\n }\n #gist-embed-container {\n position: relative;\n height: 100%;\n width: 100%;\n }\n #gist-embed-container .gist-frame {\n height: 100%;\n width: 100%;\n border: none;\n }\n #x-gist-top.${e},\n #x-gist-bottom.${e},\n #x-gist-floating-top.${e},\n #x-gist-floating-bottom.${e},\n #x-gist-floating-top-left.${e},\n #x-gist-floating-top-right.${e},\n #x-gist-floating-bottom-left.${e},\n #x-gist-floating-bottom-right.${e} {\n transition: height 0.1s ease-in-out;\n }\n @media (max-width: ${s}px) {\n #x-gist-top.${e},\n #x-gist-bottom.${e},\n #x-gist-floating-top.${e},\n #x-gist-floating-bottom.${e},\n #x-gist-floating-top-left.${e},\n #x-gist-floating-top-right.${e},\n #x-gist-floating-bottom-left.${e},\n #x-gist-floating-bottom-right.${e} {\n width: 100% !important;\n }\n }\n </style>\n <div id="gist-embed-container">\n <iframe id="${e}" class="gist-frame" src="${n}"></iframe>\n </div>\n </div>`}(G(t.instanceId),n,e);return s}(t,n,r),V(o,s)}else i(`Message could not be embedded, elementId ${e} not found.`)}(t,s,e,n)):function(e,t,n){document.body.insertAdjacentHTML("afterbegin",function(e,t){var n=A(t),s=function(e,t,n){var s=600;return t.messageWidth>s&&(s=t.messageWidth),`\n <div id="gist-embed-message">\n <style>\n #gist-overlay.background {\n position: fixed;\n z-index: 9999999998;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n background-color: ${t.overlayColor};\n visibility: hidden;\n }\n #gist-overlay.background.visible {\n visibility: visible;\n }\n #gist-overlay.background.is-blacked-out {\n display: block;\n }\n .gist-message {\n width: ${t.messageWidth}px;\n position: absolute;\n border: none;\n opacity: 0;\n transition: opacity 0.3s ease-in-out, height 0.1s ease-in-out;\n z-index: 9999999999;\n left: 50%;\n transform: translateX(-50%);\n }\n .gist-message.visible {\n opacity: 1;\n pointer-events: auto;\n }\n .gist-message.center {\n transform: translate(-50%, -50%);\n top: 50%;\n }\n .gist-message.bottom {\n bottom: 0;\n }\n .gist-message.top {\n top: 0;\n }\n @media (max-width: ${s}px) {\n .gist-message {\n width: 100%;\n }\n }\n </style>\n <div id="gist-overlay" class="background">\n <iframe id="${e}" class="gist-message" src="${n}"></iframe>\n </div>\n </div>`}(G(t.instanceId),n,e);return s}(e,t)),V(G(t.instanceId),n)}(s,e,n),e}async function ue(e){i(`Message shown, logging view for: ${e.messageId}`);var t={};null!=e.queueId?(await fe(e),t=await async function(e){try{return await $().post(`/api/v1/logs/queue/${e}`)}catch(e){return e.response}}(e.queueId)):t=await async function(e){try{return await $().post(`/api/v1/logs/message/${e}`)}catch(e){return e.response}}(e.messageId),200===t.status?i("Message view logged"):i(`Problem logging message: ${t.status}`)}function ce(e){return Ie.currentMessages.find((t=>t.instanceId===e))}function de(e){Ie.currentMessages=Ie.currentMessages.filter((t=>t.instanceId!==e))}function ge(e,t){de(e),Ie.currentMessages.push(t)}function le(){}async function me(e){if(e.data.gist){var t=e.data.gist.instanceId,n=ce(t);if(!n)return;var s=A(n);switch(e.data.gist.method){case"routeLoaded":var a=.001*((new Date).getTime()-n.renderStartTime);i(`Engine render for message: ${n.messageId} timer elapsed in ${a.toFixed(3)} seconds`),async function(e){const t=await ee(e);if(!t)return!1;w(t)}(n.queueId),n.currentRoute=e.data.gist.parameters.route,n.firstLoad&&(n.overlay?function(e){var t=A(e),n=document.querySelector("#gist-overlay");if(n){n.classList.add("visible");var s=document.querySelector(".gist-message");e.position?s.classList.add(e.position):s.classList.add("center"),setTimeout(j,100),t.exitClick&&setTimeout((()=>function(e){var t=document.querySelector("#gist-overlay");t&&t.addEventListener("click",(function(){Ie.dismissMessage(e)}))}(e.instanceId)),1e3)}else _()}(n):(g=Q(n.elementId))&&g.classList.add("gist-visible"),Ie.messageShown(n),s.persistent?i("Persistent message shown, skipping logging view"):await ue(n),n.firstLoad=!1),ge(t,n);break;case"tap":var o=e.data.gist.parameters.action,r=e.data.gist.parameters.name;if(Ie.messageAction(n,o,r),e.data.gist.parameters.system&&!s.persistent){await se(n);break}try{var u=new URL(o);if(u&&"gist:"===u.protocol)switch(u.href.replace("gist://","").split("?")[0]){case"close":await se(n),await ie(n),await he(n),await ye();break;case"showMessage":var c=u.searchParams.get("messageId"),d=u.searchParams.get("properties");c&&(d&&(d=JSON.parse(atob(d))),await Ie.showMessage({messageId:c,properties:d}));break;case"loadPage":(u=u.href.substring(u.href.indexOf("?url=")+5))&&(u.startsWith("https://")||u.startsWith("http://")||u.startsWith("/")?window.location.href=u:window.location.href=window.location+u)}}catch{}break;case"routeChanged":n.currentRoute=e.data.gist.parameters.route,n.renderStartTime=(new Date).getTime(),ge(t,n),i(`Route changed to: ${n.currentRoute}`);break;case"sizeChanged":i(`Size Changed Width: ${e.data.gist.parameters.width} - Height: ${e.data.gist.parameters.height}`),n.elementId&&!n.shouldResizeHeight||function(e,t){var n=Q(e.elementId?e.elementId:G(e.instanceId));if(n){var s=n.style;if(t.height>0)if(t.height>window.innerHeight){var i=1-(t.height/window.innerHeight-1);e.shouldScale&&i>=.4?(s.height=`${t.height}px`,s.transform=`translateX(-50%) translateY(-50%) scale(${i})`):s.height=`${window.innerHeight}px`}else s.height=`${t.height}px`}}(n,e.data.gist.parameters);break;case"titleChanged":i(`Overlay title changed to: ${e.data.gist.parameters.title}`),function(e,t){var n=Q(G(e));n&&(n.title=t)}(t,e.data.gist.parameters.title);break;case"eventDispatched":Ie.events.dispatch("eventDispatched",{name:e.data.gist.parameters.name,payload:e.data.gist.parameters.payload});break;case"error":case"routeError":Ie.messageError(n),Ie.overlayInstanceId?oe(!1,n):ae(n)}}var g}async function fe(e){i(`Logging user message view locally for: ${e.queueId}`),X(e)?await async function(e){i(`Marking broadcast ${e} as seen.`);const t=await B();if(!t)return;const n=await z(t,e);if(!n)return;const{broadcast:s}=n.properties.gist,a=J(t,e),o=F(t,e);let r=p(a)||0;if(h(a,r+1),1===s.frequency.count)h(o,!1),i(`Marked broadcast ${e} as seen.`);else{let t=new Date;t.setSeconds(t.getSeconds()+s.frequency.delay),h(o,!1,t),i(`Marked broadcast ${e} as seen, broadcast was seen ${r+1} times, next show date is ${t}.`)}}(e.queueId):await async function(e){const t=await Z();if(!t)return;const n=p(t)??[];n.push(e),h(t,n)}(e.queueId)}async function he(e){X(e)&&(i(`Logging broadcast dismissed locally for: ${e.queueId}`),await async function(e){i(`Marking broadcast ${e} as dismissed.`);const t=await B();if(!t)return;const n=await z(t,e);if(!n)return;const{broadcast:s}=n.properties.gist;!0!==s.frequency.ignoreDismiss?(h(F(t,e),!1),i(`Marked broadcast ${e} as dismissed and will not show again.`)):i(`Broadcast ${e} is set to ignore dismiss.`)}(e.queueId))}var pe=(e,t)=>e().then((e=>new Promise((t=>setTimeout(t,e))))(t).then((()=>pe(e,t)))),we=!1;async function ve(){we?ye():(async function(){var e=`G${l().substring(0,8)}`,t=document.createElement("div");t.setAttribute("id",e),t.style.display="none",document.body.appendChild(t),await U(5e3),ne({messageId:""},e)}(),M()?(i("Queue watcher started"),we=!0,pe((()=>new Promise((()=>async function(){if(M())if(Ie.isDocumentVisible)if(null===p(D)){var e=await async function(){var e,t;try{if(!T){T=!0;var n={"X-Gist-User-Anonymous":C(),"Content-Language":null!==p(x)?p(x):navigator.language};if("3"===I.getQueueAPIVersion())e=await $().post(`/api/v3/users?sessionId=${t=p(E),t||(t=l()),h(E,t,new Date((new Date).getTime()+18e5)),t}`,{},{headers:n});else{var s=(new Date).getTime();e=await $().post(`/api/v2/users?timestamp=${s}`,{},{headers:n})}}}catch(t){t.response?e=t.response:i(`Error getting user queue: ${t}`)}finally{T=!1,function(e){if(e&&e.headers){var t=e.headers["x-gist-queue-polling-interval"];t&&t>0&&(S=t)}var n=new Date((new Date).getTime()+1e3*S);h(D,S,n)}(e),function(e){if(e&&e.headers){var t=e.headers["x-cio-queue-version"];t&&I.setQueueAPIVersion(t)}}(e)}return e}(),t=[];e?(200===e.status||204===e.status?(i("200 response, updating local store."),async function(e){const t=await K();t&&h(t,e.filter((e=>!(e.properties&&e.properties.gist&&e.properties.gist.broadcast))),new Date(Date.now()+36e5))}(t=e.data),async function(e){const t=await B();if(!t)return;const n=new Date;n.setDate(n.getDate()+30),h(t,e.filter(X),n)}(t)):304===e.status&&i("304 response, using local store."),await ye()):i("There was an error while checking message queue.")}else i("Next queue pull scheduled for later.");else i("Document not visible, skipping queue check.");else i("User token reset, skipping queue check.")}()))),1e3)):i("User token not setup, queue not started."))}async function ye(){var e=await async function(){const e=await B();return e?(p(e)??[]).filter((t=>{const{broadcast:n}=t.properties.gist,s=p(F(e,t.queueId))??!0,i=p(J(e,t.queueId))||0,a=0===n.frequency.count;return s&&(a||i<n.frequency.count)})):[]}(),t=await async function(){const e=await K();if(!e)return[];const t=p(e)??[],n=await async function(){const e=await Z();return e?p(e)??[]:[]}();return t.filter((e=>!n.includes(e.queueId)))}(),n=e.concat(t);i(`Messages in local queue: ${n.length}`);var s=n.sort(((e,t)=>e.priority-t.priority));for(const e of s)await be(e)}async function be(e){var t=A(e);if(t.hasRouteRule){var n=Ie.currentRoute;null==n&&(n=new URL(window.location.href).pathname);var s=t.routeRule;if(i(`Verifying route against rule: ${s}`),!new RegExp(s).test(n))return i(`Route ${n} does not match rule.`),!1}if(t.hasPosition&&(e.position=t.position),t.persistent||function(e){if(!X(e))return!1;const{broadcast:t}=e.properties.gist;return 0===t.frequency.delay&&0===t.frequency.count}(e)||!await async function(e){const t=await ee(e);return!!t&&null!==p(t)}(e.queueId)){var a;return(a=t.isEmbedded?await ne(e,t.elementId):await te(e))&&async function(e){const t=await ee(e);if(!t)return!1;h(t,!0,new Date(Date.now()+5e3))}(e.queueId),a}return i(`Not showing message with queueId ${e.queueId} because its already loading.`),!1}const Ie=class{static async setup(e){this.events=new s,this.config={useAnonymousSession:void 0!==e.useAnonymousSession&&e.useAnonymousSession,siteId:e.siteId,dataCenter:e.dataCenter,env:void 0===e.env?"prod":e.env,logging:void 0!==e.logging&&e.logging,experiments:void 0!==e.experiments&&e.experiments},this.currentMessages=[],this.overlayInstanceId=null,this.currentRoute=null,this.isDocumentVisible=!0,this.config.isPreviewSession=function(){const e=new URLSearchParams(window.location.search).get("cioPreviewId");return e&&(sessionStorage.setItem(f,!1),Ie.setUserToken(e),i(`Preview mode enabled with user token: ${e}`)),!v()}(),i(`Setup complete on ${this.config.env} environment.`),!this.config.isPreviewSession&&this.config.useAnonymousSession&&R(),await ve(),document.addEventListener("visibilitychange",(async()=>{"hidden"===document.visibilityState?this.isDocumentVisible=!1:(this.isDocumentVisible=!0,await ye())}),!1)}static async setCurrentRoute(e){this.currentRoute=e,i(`Current route set to: ${e}`),await ye()}static async setUserToken(e,t){this.config.isPreviewSession||(function(e,t){void 0===t&&(t=new Date).setDate(t.getDate()+30),h(k,e,t),C()&&(w(D),w(P)),i(`Set user token "${e}" with expiry date set to ${t}`)}(e,t),await ve())}static setUserLocale(e){var t;h(x,t=e),i(`Set user locate to "${t}"`)}static async clearUserToken(){this.config.isPreviewSession||(w(k),i("Cleared user token"),this.config.useAnonymousSession&&R(),await ve())}static async dismissMessage(e){var t=ce(e);await se(t),await ie(t),await he(t),await ye()}static async embedMessage(e,t){var n=await ne(e,t);return n?n.instanceId:null}static async showMessage(e){var t=await te(e);return t?t.instanceId:null}static messageShown(e){i(`Message shown: ${e.messageId}`),this.events.dispatch("messageShown",e)}static messageDismissed(e){null!==e&&(i(`Message dismissed: ${e.messageId}`),this.events.dispatch("messageDismissed",e))}static messageError(e){i(`Message error: ${e.messageId}`),this.events.dispatch("messageError",e)}static messageAction(e,t,n){i(`Message action: ${e.currentRoute}, ${t} with name ${n} on ${e.instanceId}`),this.events.dispatch("messageAction",{message:e,action:t,name:n})}}},44:(e,t,n)=>{const s=n(548).A;e.exports=s}},t={};function n(s){var i=t[s];if(void 0!==i)return i.exports;var a=t[s]={exports:{}};return e[s](a,a.exports,n),a.exports}return n.d=(e,t)=>{for(var s in t)n.o(t,s)&&!n.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n(44)})()));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "customerio-gist-web",
3
- "version": "3.15.0",
3
+ "version": "3.15.2",
4
4
  "description": "Build beautiful in-app flows with no code and deliver them instantly to your app. http://customer.io",
5
5
  "private": false,
6
6
  "scripts": {
@@ -1,21 +1,85 @@
1
1
  import Gist from '../gist';
2
- import axios from 'axios';
3
2
  import { settings } from './settings';
4
3
  import { getUserToken } from "../managers/user-manager";
5
4
 
6
5
  export function UserNetworkInstance() {
7
- var instance = axios.create({
8
- baseURL: settings.GIST_QUEUE_API_ENDPOINT[Gist.config.env],
9
- timeout: 5000
10
- });
11
- if (settings.getQueueAPIVersion() === "3") {
12
- instance.defaults.baseURL = settings.GIST_QUEUE_V3_API_ENDPOINT[Gist.config.env];
13
- }
14
- instance.defaults.headers.common['X-CIO-Site-Id'] = Gist.config.siteId;
15
- instance.defaults.headers.common['X-CIO-Client-Platform'] = 'web';
16
- var userToken = getUserToken();
6
+ const baseURL =
7
+ settings.getQueueAPIVersion() === "3"
8
+ ? settings.GIST_QUEUE_V3_API_ENDPOINT[Gist.config.env]
9
+ : settings.GIST_QUEUE_API_ENDPOINT[Gist.config.env];
10
+
11
+ const defaultHeaders = {
12
+ 'X-CIO-Site-Id': Gist.config.siteId,
13
+ 'X-CIO-Client-Platform': 'web',
14
+ };
15
+
16
+ const userToken = getUserToken();
17
17
  if (userToken != null) {
18
- instance.defaults.headers.common['X-Gist-Encoded-User-Token'] = btoa(userToken);
18
+ defaultHeaders['X-Gist-Encoded-User-Token'] = btoa(userToken);
19
19
  }
20
- return instance;
21
- }
20
+
21
+ async function request(path, options = {}) {
22
+ const url = baseURL + path;
23
+ const controller = new AbortController();
24
+ const timeout = setTimeout(() => controller.abort(), 5000);
25
+
26
+ try {
27
+ const response = await fetch(url, {
28
+ method: options.method || 'GET',
29
+ headers: {
30
+ ...defaultHeaders,
31
+ ...(options.headers || {}),
32
+ },
33
+ body: options.method && options.method.toUpperCase() !== 'GET' ? options.body : undefined,
34
+ signal: controller.signal,
35
+ });
36
+
37
+ clearTimeout(timeout);
38
+
39
+ const isJSON = response.headers.get("content-type")?.includes("application/json");
40
+ const data = isJSON ? await response.json() : await response.text();
41
+
42
+ const headersObj = Object.fromEntries(response.headers.entries());
43
+
44
+ if (response.status < 200 || response.status >= 400) {
45
+ throw {
46
+ response: {
47
+ status: response.status,
48
+ data,
49
+ headers: headersObj,
50
+ }
51
+ };
52
+ }
53
+
54
+ return {
55
+ status: response.status,
56
+ headers: headersObj,
57
+ data,
58
+ };
59
+ } catch (err) {
60
+ clearTimeout(timeout);
61
+
62
+ if (!err.response) {
63
+ err.response = {
64
+ status: 0,
65
+ data: err.message || 'Unknown error',
66
+ };
67
+ }
68
+
69
+ throw err;
70
+ }
71
+ }
72
+
73
+ request.post = (path, data = {}, config = {}) => {
74
+ return request(path, {
75
+ method: 'POST',
76
+ body: JSON.stringify(data),
77
+ headers: {
78
+ 'Content-Type': 'application/json',
79
+ ...(config.headers || {})
80
+ }
81
+ });
82
+ };
83
+
84
+ return request;
85
+ }
@@ -27,7 +27,8 @@ export const settings = {
27
27
  return getKeyFromLocalStore(userQueueVersionLocalStoreName) ?? "2";
28
28
  },
29
29
  setQueueAPIVersion: function(version) {
30
- setKeyToLocalStore(userQueueVersionLocalStoreName, version);
30
+ // The Queue API version TTL is renewed with every poll request and extended by 30 minutes.
31
+ setKeyToLocalStore(userQueueVersionLocalStoreName, version, new Date(new Date().getTime() + 1800000));
31
32
  log(`Set user queue version to "${version}"`);
32
33
  }
33
34
  }