customerio-gist-web 3.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,42 @@
1
+ name: Build Gist Web
2
+ run-name: Build gist-web - ${{ github.event.commits[0].message }}
3
+
4
+ on:
5
+ push:
6
+ branches:
7
+ - 'develop'
8
+ - 'master'
9
+
10
+ jobs:
11
+ build:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v3
15
+ with:
16
+ fetch-depth: 0
17
+ - name: Use Node.js ${{ matrix.node-version }}
18
+ uses: actions/setup-node@v2
19
+ with:
20
+ node-version: 16
21
+ - name: Build
22
+ shell: bash
23
+ run: |
24
+ npm install
25
+ npm run build:prod
26
+ - name: Commit any changes
27
+ shell: bash
28
+ run: |
29
+ git config user.name "ami-ci"
30
+ git config user.email "<>"
31
+ git add .
32
+ set +e # Grep succeeds with nonzero exit codes to show results.
33
+ git status | grep modified
34
+ if [ $? -eq 0 ]
35
+ then
36
+ set -e
37
+ git commit -am "New version of gist-web"
38
+ git push
39
+ else
40
+ set -e
41
+ echo "No changes since last run"
42
+ fi
@@ -0,0 +1,48 @@
1
+ name: Release Gist Web
2
+ run-name: Release gist-web
3
+
4
+ on:
5
+ push:
6
+ tags:
7
+ - '*'
8
+
9
+ jobs:
10
+ release:
11
+ runs-on: ubuntu-latest
12
+ env:
13
+ AWS_ACCESS_KEY_ID: ${{ secrets.GIST_WEB_AWS_KEY_ID }}
14
+ AWS_SECRET_ACCESS_KEY: ${{ secrets.GIST_WEB_AWS_SECRET_ACCESS_KEY }}
15
+ AWS_BUCKET: 'gist-code'
16
+ steps:
17
+ - uses: actions/checkout@v3
18
+ - name: Use Node.js ${{ matrix.node-version }}
19
+ uses: actions/setup-node@v2
20
+ with:
21
+ node-version: 16
22
+ - name: Build
23
+ shell: bash
24
+ run: |
25
+ npm install
26
+ npm run build:prod
27
+ - name: Version name
28
+ shell: bash
29
+ run: |
30
+ RELEASE_VERSION="${GITHUB_REF#refs/*/}"
31
+ echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
32
+ echo "RELEASE_VERSION=$RELEASE_VERSION"
33
+
34
+ AWS_DEST="web/$RELEASE_VERSION"
35
+ echo "AWS_DEST=$AWS_DEST" >> $GITHUB_ENV
36
+ echo "AWS_DEST=$AWS_DEST"
37
+ - uses: shallwefootball/s3-upload-action@master
38
+ with:
39
+ aws_key_id: ${{ env.AWS_ACCESS_KEY_ID }}
40
+ aws_secret_access_key: ${{ env.AWS_SECRET_ACCESS_KEY }}
41
+ aws_bucket: ${{ env.AWS_BUCKET }}
42
+ source_dir: 'dist'
43
+ destination_dir: ${{ env.AWS_DEST }}
44
+ endpoint: 'ams3.digitaloceanspaces.com'
45
+ - name: Publish to NPM
46
+ uses: JS-DevTools/npm-publish@v3
47
+ with:
48
+ token: ${{ secrets.NPM_TOKEN }}
@@ -0,0 +1,53 @@
1
+ name: Trigger a Gist Web Release
2
+ run-name: Release gist-web
3
+
4
+ on:
5
+ workflow_dispatch:
6
+ inputs:
7
+ version:
8
+ description: 'Semantic version change'
9
+ type: choice
10
+ required: true
11
+ options:
12
+ - 'patch'
13
+ - 'minor'
14
+ - 'major'
15
+ default: 'patch'
16
+
17
+ jobs:
18
+ release:
19
+ runs-on: ubuntu-latest
20
+ steps:
21
+ - name: Use Node.js 16
22
+ uses: actions/setup-node@v2
23
+ with:
24
+ node-version: 16
25
+ - name: Checkout
26
+ uses: actions/checkout@v3
27
+ with:
28
+ fetch-depth: 0
29
+ ref: develop
30
+ token: ${{ secrets.SRE_GHACTIONS_TOKEN }}
31
+ - name: Increment package.json version
32
+ uses: 'phips28/gh-action-bump-version@master'
33
+ env:
34
+ GITHUB_TOKEN: ${{ secrets.SRE_GHACTIONS_TOKEN }}
35
+ with:
36
+ version-type: '${{ inputs.version }}'
37
+ skip-tag: 'true'
38
+ - name: Extract new npm version
39
+ id: package-version
40
+ uses: martinbeentjes/npm-get-version-action@v1.3.1
41
+ - name: Release to master
42
+ shell: bash
43
+ env:
44
+ GIT_AUTH_TOKEN: ${{ secrets.SRE_GHACTIONS_TOKEN }}
45
+ run: |
46
+ git pull origin develop
47
+ git checkout master
48
+ git merge develop
49
+ git push origin master
50
+ git tag ${{ steps.package-version.outputs.current-version }}
51
+ git push origin ${{ steps.package-version.outputs.current-version }}
52
+
53
+
@@ -0,0 +1,61 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ChangeListManager">
4
+ <list default="true" id="18cd2a20-4fa4-4881-8ab9-4e2279ac2b51" name="Changes" comment="">
5
+ <change beforePath="$PROJECT_DIR$/examples/index.html" beforeDir="false" afterPath="$PROJECT_DIR$/examples/index.html" afterDir="false" />
6
+ <change beforePath="$PROJECT_DIR$/package-lock.json" beforeDir="false" afterPath="$PROJECT_DIR$/package-lock.json" afterDir="false" />
7
+ </list>
8
+ <option name="SHOW_DIALOG" value="false" />
9
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
10
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
11
+ <option name="LAST_RESOLUTION" value="IGNORE" />
12
+ </component>
13
+ <component name="MarkdownSettingsMigration">
14
+ <option name="stateVersion" value="1" />
15
+ </component>
16
+ <component name="ProjectId" id="2IuUfACJNeIaXkt98fr0s8BPZgf" />
17
+ <component name="ProjectViewState">
18
+ <option name="hideEmptyMiddlePackages" value="true" />
19
+ <option name="showLibraryContents" value="true" />
20
+ </component>
21
+ <component name="PropertiesComponent"><![CDATA[{
22
+ "keyToString": {
23
+ "RunOnceActivity.OpenProjectViewOnStart": "true",
24
+ "RunOnceActivity.ShowReadmeOnStart": "true",
25
+ "WebServerToolWindowFactoryState": "false",
26
+ "nodejs_package_manager_path": "npm",
27
+ "vue.rearranger.settings.migration": "true"
28
+ }
29
+ }]]></component>
30
+ <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
31
+ <component name="TaskManager">
32
+ <task active="true" id="Default" summary="Default task">
33
+ <changelist id="18cd2a20-4fa4-4881-8ab9-4e2279ac2b51" name="Changes" comment="" />
34
+ <created>1671031062282</created>
35
+ <option name="number" value="Default" />
36
+ <option name="presentableId" value="Default" />
37
+ <updated>1671031062282</updated>
38
+ <workItem from="1671031064434" duration="1791000" />
39
+ </task>
40
+ <servers />
41
+ </component>
42
+ <component name="TypeScriptGeneratedFilesManager">
43
+ <option name="version" value="3" />
44
+ </component>
45
+ <component name="UnityCheckinConfiguration" checkUnsavedScenes="true" />
46
+ <component name="UnityUnitTestConfiguration" currentTestLauncher="NUnit" />
47
+ <component name="Vcs.Log.Tabs.Properties">
48
+ <option name="TAB_STATES">
49
+ <map>
50
+ <entry key="MAIN">
51
+ <value>
52
+ <State />
53
+ </value>
54
+ </entry>
55
+ </map>
56
+ </option>
57
+ </component>
58
+ <component name="VcsManagerConfiguration">
59
+ <option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="true" />
60
+ </component>
61
+ </project>
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 Customer IO
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # Gist for Web
2
+
3
+ Gist enables you to create embeddable experiences that range from simple welcome messages to complex multi-step flows.
4
+
5
+ For installation guide, please follow our [documentation](https://docs.gist.build).
@@ -0,0 +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,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var s=t[r]={i:r,l:!1,exports:{}};return e[r].call(s.exports,s,s.exports,n),s.l=!0,s.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)n.d(r,s,function(t){return e[t]}.bind(null,s));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=11)}([function(e,t,n){"use strict";var r=n(2),s=Object.prototype.toString;function i(e){return"[object Array]"===s.call(e)}function o(e){return void 0===e}function a(e){return null!==e&&"object"==typeof e}function u(e){if("[object Object]"!==s.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function c(e){return"[object Function]"===s.call(e)}function d(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),i(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)}e.exports={isArray:i,isArrayBuffer:function(e){return"[object ArrayBuffer]"===s.call(e)},isBuffer:function(e){return null!==e&&!o(e)&&null!==e.constructor&&!o(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:a,isPlainObject:u,isUndefined:o,isDate:function(e){return"[object Date]"===s.call(e)},isFile:function(e){return"[object File]"===s.call(e)},isBlob:function(e){return"[object Blob]"===s.call(e)},isFunction:c,isStream:function(e){return a(e)&&c(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:d,merge:function e(){var t={};function n(n,r){u(t[r])&&u(n)?t[r]=e(t[r],n):u(n)?t[r]=e({},n):i(n)?t[r]=n.slice():t[r]=n}for(var r=0,s=arguments.length;r<s;r++)d(arguments[r],n);return t},extend:function(e,t,n){return d(t,(function(t,s){e[s]=n&&"function"==typeof t?r(t,n):t})),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}}},,function(e,t,n){"use strict";e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}}},function(e,t,n){"use strict";var r=n(0);function s(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 i;if(n)i=n(t);else if(r.isURLSearchParams(t))i=t.toString();else{var o=[];r.forEach(t,(function(e,t){null!=e&&(r.isArray(e)?t+="[]":e=[e],r.forEach(e,(function(e){r.isDate(e)?e=e.toISOString():r.isObject(e)&&(e=JSON.stringify(e)),o.push(s(t)+"="+s(e))})))})),i=o.join("&")}if(i){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}},function(e,t,n){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t,n){"use strict";(function(t){var r=n(0),s=n(18),i={"Content-Type":"application/x-www-form-urlencoded"};function o(e,t){!r.isUndefined(e)&&r.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var a,u={adapter:(("undefined"!=typeof XMLHttpRequest||void 0!==t&&"[object process]"===Object.prototype.toString.call(t))&&(a=n(6)),a),transformRequest:[function(e,t){return s(t,"Accept"),s(t,"Content-Type"),r.isFormData(e)||r.isArrayBuffer(e)||r.isBuffer(e)||r.isStream(e)||r.isFile(e)||r.isBlob(e)?e:r.isArrayBufferView(e)?e.buffer:r.isURLSearchParams(e)?(o(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):r.isObject(e)?(o(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};u.headers={common:{Accept:"application/json, text/plain, */*"}},r.forEach(["delete","get","head"],(function(e){u.headers[e]={}})),r.forEach(["post","put","patch"],(function(e){u.headers[e]=r.merge(i)})),e.exports=u}).call(this,n(17))},function(e,t,n){"use strict";var r=n(0),s=n(19),i=n(21),o=n(3),a=n(22),u=n(25),c=n(26),d=n(7);e.exports=function(e){return new Promise((function(t,n){var f=e.data,l=e.headers;r.isFormData(f)&&delete l["Content-Type"];var p=new XMLHttpRequest;if(e.auth){var g=e.auth.username||"",h=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";l.Authorization="Basic "+btoa(g+":"+h)}var m=a(e.baseURL,e.url);if(p.open(e.method.toUpperCase(),o(m,e.params,e.paramsSerializer),!0),p.timeout=e.timeout,p.onreadystatechange=function(){if(p&&4===p.readyState&&(0!==p.status||p.responseURL&&0===p.responseURL.indexOf("file:"))){var r="getAllResponseHeaders"in p?u(p.getAllResponseHeaders()):null,i={data:e.responseType&&"text"!==e.responseType?p.response:p.responseText,status:p.status,statusText:p.statusText,headers:r,config:e,request:p};s(t,n,i),p=null}},p.onabort=function(){p&&(n(d("Request aborted",e,"ECONNABORTED",p)),p=null)},p.onerror=function(){n(d("Network Error",e,null,p)),p=null},p.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(d(t,e,"ECONNABORTED",p)),p=null},r.isStandardBrowserEnv()){var v=(e.withCredentials||c(m))&&e.xsrfCookieName?i.read(e.xsrfCookieName):void 0;v&&(l[e.xsrfHeaderName]=v)}if("setRequestHeader"in p&&r.forEach(l,(function(e,t){void 0===f&&"content-type"===t.toLowerCase()?delete l[t]:p.setRequestHeader(t,e)})),r.isUndefined(e.withCredentials)||(p.withCredentials=!!e.withCredentials),e.responseType)try{p.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&p.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&p.upload&&p.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){p&&(p.abort(),n(e),p=null)})),f||(f=null),p.send(f)}))}},function(e,t,n){"use strict";var r=n(20);e.exports=function(e,t,n,s,i){var o=new Error(e);return r(o,t,n,s,i)}},function(e,t,n){"use strict";var r=n(0);e.exports=function(e,t){t=t||{};var n={},s=["url","method","data"],i=["headers","auth","proxy","params"],o=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function u(e,t){return r.isPlainObject(e)&&r.isPlainObject(t)?r.merge(e,t):r.isPlainObject(t)?r.merge({},t):r.isArray(t)?t.slice():t}function c(s){r.isUndefined(t[s])?r.isUndefined(e[s])||(n[s]=u(void 0,e[s])):n[s]=u(e[s],t[s])}r.forEach(s,(function(e){r.isUndefined(t[e])||(n[e]=u(void 0,t[e]))})),r.forEach(i,c),r.forEach(o,(function(s){r.isUndefined(t[s])?r.isUndefined(e[s])||(n[s]=u(void 0,e[s])):n[s]=u(void 0,t[s])})),r.forEach(a,(function(r){r in t?n[r]=u(e[r],t[r]):r in e&&(n[r]=u(void 0,e[r]))}));var d=s.concat(i).concat(o).concat(a),f=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===d.indexOf(e)}));return r.forEach(f,c),n}},function(e,t,n){"use strict";function r(e){this.message=e}r.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},r.prototype.__CANCEL__=!0,e.exports=r},function(e,t,n){e.exports=n(12)},function(e,t,n){const r=n(32).default;e.exports=r},function(e,t,n){"use strict";var r=n(0),s=n(2),i=n(13),o=n(8);function a(e){var t=new i(e),n=s(i.prototype.request,t);return r.extend(n,i.prototype,t),r.extend(n,t),n}var u=a(n(5));u.Axios=i,u.create=function(e){return a(o(u.defaults,e))},u.Cancel=n(9),u.CancelToken=n(27),u.isCancel=n(4),u.all=function(e){return Promise.all(e)},u.spread=n(28),u.isAxiosError=n(29),e.exports=u,e.exports.default=u},function(e,t,n){"use strict";var r=n(0),s=n(3),i=n(14),o=n(15),a=n(8);function u(e){this.defaults=e,this.interceptors={request:new i,response:new i}}u.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=a(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[o,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)n=n.then(t.shift(),t.shift());return n},u.prototype.getUri=function(e){return e=a(this.defaults,e),s(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},r.forEach(["delete","get","head","options"],(function(e){u.prototype[e]=function(t,n){return this.request(a(n||{},{method:e,url:t,data:(n||{}).data}))}})),r.forEach(["post","put","patch"],(function(e){u.prototype[e]=function(t,n,r){return this.request(a(r||{},{method:e,url:t,data:n}))}})),e.exports=u},function(e,t,n){"use strict";var r=n(0);function s(){this.handlers=[]}s.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},s.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},s.prototype.forEach=function(e){r.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=s},function(e,t,n){"use strict";var r=n(0),s=n(16),i=n(4),o=n(5);function a(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return a(e),e.headers=e.headers||{},e.data=s(e.data,e.headers,e.transformRequest),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 a(e),t.data=s(t.data,t.headers,e.transformResponse),t}),(function(t){return i(t)||(a(e),t&&t.response&&(t.response.data=s(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},function(e,t,n){"use strict";var r=n(0);e.exports=function(e,t,n){return r.forEach(n,(function(n){e=n(e,t)})),e}},function(e,t){var n,r,s=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var u,c=[],d=!1,f=-1;function l(){d&&u&&(d=!1,u.length?c=u.concat(c):f=-1,c.length&&p())}function p(){if(!d){var e=a(l);d=!0;for(var t=c.length;t;){for(u=c,c=[];++f<t;)u&&u[f].run();f=-1,t=c.length}u=null,d=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function g(e,t){this.fun=e,this.array=t}function h(){}s.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];c.push(new g(e,t)),1!==c.length||d||a(p)},g.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=h,s.addListener=h,s.once=h,s.off=h,s.removeListener=h,s.removeAllListeners=h,s.emit=h,s.prependListener=h,s.prependOnceListener=h,s.listeners=function(e){return[]},s.binding=function(e){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(e){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},function(e,t,n){"use strict";var r=n(0);e.exports=function(e,t){r.forEach(e,(function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])}))}},function(e,t,n){"use strict";var r=n(7);e.exports=function(e,t,n){var s=n.config.validateStatus;n.status&&s&&!s(n.status)?t(r("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}},function(e,t,n){"use strict";e.exports=function(e,t,n,r,s){return e.config=t,n&&(e.code=n),e.request=r,e.response=s,e.isAxiosError=!0,e.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}},e}},function(e,t,n){"use strict";var r=n(0);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(){}}},function(e,t,n){"use strict";var r=n(23),s=n(24);e.exports=function(e,t){return e&&!r(t)?s(e,t):t}},function(e,t,n){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t,n){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,n){"use strict";var r=n(0),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.substr(0,i)).toLowerCase(),n=r.trim(e.substr(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}},function(e,t,n){"use strict";var r=n(0);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}},function(e,t,n){"use strict";var r=n(9);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;e((function(e){n.reason||(n.reason=new r(e),t(n.reason))}))}s.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},s.source=function(){var e;return{token:new s((function(t){e=t})),cancel:e}},e.exports=s},function(e,t,n){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t,n){"use strict";e.exports=function(e){return"object"==typeof e&&!0===e.isAxiosError}},function(e,t){e.exports='<div id="gist-embed"> <style>#x-gist-floating-top,#x-gist-floating-top-left,#x-gist-floating-top-right{position:fixed;top:0;z-index:1000000}#x-gist-floating-bottom,#x-gist-floating-bottom-left,#x-gist-floating-bottom-right{position:fixed;bottom:0;z-index:1000000}#x-gist-bottom,#x-gist-floating-bottom,#x-gist-floating-top,#x-gist-top{left:50%;transform:translate(-50%,0);width:\'${topBottomMessageWidth}\'}#x-gist-floating-bottom-left,#x-gist-floating-bottom-right,#x-gist-floating-top-left,#x-gist-floating-top-right{width:\'${cornersMessageWidth}\'}#x-gist-floating-bottom-right,#x-gist-floating-top-right{right:0}#gist-embed{position:relative;height:100%;width:100%}#gist-embed-container{position:relative;height:100%;width:100%}#gist-embed-container .gist-frame{height:100%;width:100%;border:none}@media (max-width:\'${maxWidth}\'){#x-gist-bottom,#x-gist-floating-bottom,#x-gist-floating-bottom-left,#x-gist-floating-bottom-right,#x-gist-floating-top,#x-gist-floating-top-left,#x-gist-floating-top-right{width:100%}}</style> <div id="gist-embed-container"> <iframe class="gist-frame" src="${url}"></iframe> </div> </div>'},function(e,t){e.exports='<div id="gist-embed-message"> <style>#gist-overlay.background{position:fixed;z-index:9999999998;left:0;top:0;width:100%;height:100%;background-color:\'${overlayColor}\';visibility:hidden}#gist-overlay.background.visible{visibility:visible}#gist-overlay.background.is-blacked-out{display:block}#gist-message{width:\'${messageWidth}\';position:absolute;border:none;opacity:0;transition:opacity .3s ease-in-out;z-index:9999999999;left:50%;transform:translateX(-50%)}#gist-message.visible{opacity:1}#gist-message.center{transform:translate(-50%,-50%);top:50%}#gist-message.bottom{bottom:0}#gist-message.top{top:0}@media (max-width:\'${maxWidth}\'){#gist-message{width:100%}}</style> <div id="gist-overlay" class="background"> <iframe id="gist-message" class="message" src="${url}"></iframe> </div> </div>'},function(e,t,n){"use strict";n.r(t);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){Z.config.logging&&console.log("Gist: "+e)}function i(e,t,n){const r={value:t,expiry:n};localStorage.setItem(e,JSON.stringify(r))}function o(e){const t=localStorage.getItem(e);if(!t)return null;const n=JSON.parse(t),r=new Date,s=new Date(n.expiry);return r.getTime()>s.getTime()?(localStorage.removeItem(e),null):n.value}function a(e){localStorage.removeItem(e)}var u,c=new Uint8Array(16);function d(){if(!u&&!(u="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 u(c)}var f=/^(?:[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 l=function(e){return"string"==typeof e&&f.test(e)},p=[],g=0;g<256;++g)p.push((g+256).toString(16).substr(1));var h=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(p[e[t+0]]+p[e[t+1]]+p[e[t+2]]+p[e[t+3]]+"-"+p[e[t+4]]+p[e[t+5]]+"-"+p[e[t+6]]+p[e[t+7]]+"-"+p[e[t+8]]+p[e[t+9]]+"-"+p[e[t+10]]+p[e[t+11]]+p[e[t+12]]+p[e[t+13]]+p[e[t+14]]+p[e[t+15]]).toLowerCase();if(!l(n))throw TypeError("Stringified UUID is invalid");return n};var m=function(e,t,n){var r=(e=e||{}).random||(e.rng||d)();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 h(r)};function v(){return o("gist.web.userToken")}function y(){var e=new Date;if(e.setDate(e.getDate()+365),null===v()){var t=o("gist.web.guestUserToken");null==t&&(i("gist.web.guestUserToken",t=m(),e),s(`Set guest user token "${t}" with expiry date set to 1 year from today`)),i("gist.web.userToken",t,e),i("gist.web.usingGuestUserToken",!0,e)}}var w=n(10),b=n.n(w);const x={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_VIEW_ENDPOINT:{prod:"https://renderer.gist.build/2.0",dev:"https://renderer.gist.build/2.0",local:"http://app.local.gist.build:8080/web"}};function I(){var e={"X-CIO-Site-Id":Z.config.siteId,"X-CIO-Datacenter":Z.config.dataCenter},t=v();return null!=t&&(e["X-Gist-Encoded-User-Token"]=btoa(t)),b.a.create({baseURL:x.GIST_QUEUE_API_ENDPOINT[Z.config.env],timeout:2e4,headers:e})}function S(e){var t="",n="",r="",s=!1,i=!1,o=!1,a=!1,u=null,c=!1,d="#00000033",f=414,l=!1;return e.properties&&e.properties.gist&&(e.properties.gist.campaignId&&(u=e.properties.gist.campaignId),e.properties.gist.elementId&&(t=e.properties.gist.elementId,s=!0),e.properties.gist.routeRuleWeb&&(n=e.properties.gist.routeRuleWeb,i=!0),e.properties.gist.position&&(r=e.properties.gist.position,o=!0),e.properties.gist.scale&&(a=e.properties.gist.scale),e.properties.gist.overlayColor&&(d=e.properties.gist.overlayColor),e.properties.gist.messageWidth&&e.properties.gist.messageWidth>0&&(f=e.properties.gist.messageWidth,l=!0),e.properties.gist.persistent&&(c=!0)),{isEmbedded:s,elementId:t,hasRouteRule:i,routeRule:n,position:r,hasPosition:o,shouldScale:a,campaignId:u,messageWidth:f,overlayColor:d,persistent:c,hasCustomWidth:l}}const T=e=>new Promise(t=>setTimeout(t,e));function E(e,t,r){var i=N(e);i?(C(e)||(i.style.height="0px"),i.innerHTML=function(e,t){var r=S(t),s=800;r.messageWidth>s&&(s=r.messageWidth);var i=r.messageWidth+"px";["x-gist-bottom","x-gist-bottom","x-gist-floating-top","x-gist-floating-bottom"].includes(r.elementId)&&!r.hasCustomWidth&&(i="100%");var o=n(30);return o=(o=(o=(o=o.replace("'${topBottomMessageWidth}'",i)).replace("'${cornersMessageWidth}'",i)).replace("'${maxWidth}'",s+"px")).replace("${url}",e)}(t,r)):s(`Message could not be embedded, elementId ${e} not found.`)}function C(e){var t=N(e);if(t)return t.style&&t.style.height&&"0px"!=t.style.height}function R(e,t,n){var r=N(e);if(r){var s=r.style;if(t.height>0)if(t.height>window.innerHeight){var i=1-(t.height/window.innerHeight-1);n&&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"}}function k(e,t){document.body.insertAdjacentHTML("beforeend",function(e,t){var r=S(t),s=600;r.messageWidth>s&&(s=r.messageWidth);var i=n(31);return i=(i=(i=(i=(i=i.replace("'${messageWidth}'",r.messageWidth+"px")).replace("'${maxWidth}'",s+"px")).replace("'${overlayColor}'",r.overlayColor)).replace("${url}",e)).replace("${instanceId}",t.instanceId)}(e,t))}function O(){var e=document.querySelector("#gist-embed-message");e&&e.parentNode.removeChild(e)}function L(){var e=document.querySelector("#gist-message");e&&e.classList.add("visible")}function N(e){try{var t=document.querySelector("#"+e);return t||null}catch{return null}}var P=["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"];var j=[];async function D(e){if(Z.isDocumentVisible){if(Z.overlayInstanceId)return s(`Message ${Z.overlayInstanceId} already showing.`),null;var t=S(e);return e.instanceId=m(),e.overlay=!0,e.firstLoad=!0,e.shouldResizeHeight=!0,e.shouldScale=t.shouldScale,e.renderStartTime=(new Date).getTime(),Z.overlayInstanceId=e.instanceId,Z.currentMessages.push(e),B(e)}return s("Document hidden, not showing message now."),null}async function U(e,t){return Z.isDocumentVisible?(e.instanceId=m(),e.overlay=!1,e.firstLoad=!0,e.shouldScale=!1,e.elementId=t,e.shouldResizeHeight=!C(t),e.renderStartTime=(new Date).getTime(),Z.currentMessages.push(e),B(e,t)):(s("Document hidden, not showing message now."),null)}async function A(e){e?(Z.messageDismissed(e),e.overlay?await M(!0,e):q(e)):s(`Message with instance id: ${instanceId} not found`)}async function $(e){var t=S(e);e?t.persistent&&(s("Persistent message dismissed, logging view"),await W(e)):s(`Message with instance id: ${instanceId} not found`)}function q(e){var t,n;G(e.instanceId),t=e.elementId,(n=N(t))&&(n.classList.remove("gist-visible"),n.style.removeProperty("height"),n.innerHTML="")}async function M(e,t){G(t.instanceId),Z.overlayInstanceId=null,e?await async function(){var e=document.querySelector("#gist-message");e&&(e.classList.remove("visible"),await T(300)),O()}():O(),0==Z.currentMessages.length&&(window.removeEventListener("message",z),window.removeEventListener("touchstart",V))}function B(e,t=null){if(t&&function(e){var t=N(e);return!(!t||!t.classList.contains("gist-visible"))}(t))return s(`Message ${e.messageId} already showing in element ${t}.`),null;var n,r,i={endpoint:x.ENGINE_API_ENDPOINT[Z.config.env],siteId:Z.config.siteId,dataCenter:Z.config.dataCenter,messageId:e.messageId,instanceId:e.instanceId,livePreview:!1,properties:e.properties},o=`${x.GIST_VIEW_ENDPOINT[Z.config.env]}/index.html?options=${n=JSON.stringify(i),r=btoa(encodeURIComponent(n).replace(/%([0-9A-F]{2})/g,(function(e,t){return String.fromCharCode("0x"+t)}))),encodeURIComponent(r)}`;return window.addEventListener("message",z),window.addEventListener("touchstart",V),t?(P.includes(t)&&function(e){const t=document.createElement("div");switch(t.id=e,e){case"x-gist-top":document.body.insertBefore(t,document.body.firstChild);break;default:document.body.insertAdjacentElement("beforeend",t)}s("Top & bottom elements injected into page")}(t),E(t,o,e)):k(o,e),e}async function W(e){Z.messageShown(e),s("Message shown, logging view for: "+e.messageId);var t={};200===(t=null!=e.queueId?await async function(e){try{return await I().post("/api/v1/logs/queue/"+e)}catch(e){return e.response}}(e.queueId):await async function(e){try{return await I().post("/api/v1/logs/message/"+e)}catch(e){return e.response}}(e.messageId)).status?s("Message view logged"):s("Problem logging message: "+t.status)}function _(e){return Z.currentMessages.find(t=>t.instanceId===e)}function G(e){Z.currentMessages=Z.currentMessages.filter(t=>t.instanceId!==e)}function H(e,t){G(e),Z.currentMessages.push(t)}function V(e){}async function z(e){if(e.data.gist){var t=e.data.gist.instanceId,n=_(t);if(!n)return;var r=S(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`),n.currentRoute=e.data.gist.parameters.route,n.firstLoad&&(j.push(n),n.overlay?function(e){var t=document.querySelector("#gist-overlay");if(t){t.classList.add("visible");var n=document.querySelector("#gist-message");e.position?n.classList.add(e.position):n.classList.add("center"),setTimeout(L,100)}else O()}(n):(f=n.elementId,(l=N(f))&&l.classList.add("gist-visible")),r.persistent?s("Persistent message shown, skipping logging view"):await W(n),n.firstLoad=!1),H(t,n);break;case"tap":var o=e.data.gist.parameters.action,a=e.data.gist.parameters.name;if(Z.messageAction(n,o,a),e.data.gist.parameters.system&&!r.persistent){await A(n);break}try{if((d=new URL(o))&&"gist:"===d.protocol)switch(d.href.replace("gist://","").split("?")[0]){case"close":await A(n),await $(n),await K();break;case"showMessage":var u=d.searchParams.get("messageId"),c=d.searchParams.get("properties");u&&(c&&(c=JSON.parse(atob(c))),await Z.showMessage({messageId:u,properties:c}));break;case"loadPage":var d;(d=d.href.substring(d.href.indexOf("?url=")+5))&&(d.startsWith("https://")||d.startsWith("http://")||d.startsWith("/")?window.location.href=d:window.location.href=window.location+d)}}catch(e){}break;case"routeChanged":n.currentRoute=e.data.gist.parameters.route,n.renderStartTime=(new Date).getTime(),H(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?R(n.elementId,e.data.gist.parameters,n.shouldScale):R("gist-message",e.data.gist.parameters,n.shouldScale);break;case"error":case"routeError":Z.messageError(n),Z.overlayInstanceId?M(!1,n):q(n)}}var f,l}var F=(e,t)=>e().then((e=>new Promise(t=>setTimeout(t,e)))(t).then(()=>F(e,t))),X=!1,J=[];async function Q(){X?await K():(!async function(){var e="G"+m().substring(0,8),t=document.createElement("div");t.setAttribute("id",e),t.style.display="none",document.body.appendChild(t),await T(5e3),U({messageId:""},e)}(),v()?(s("Queue watcher started"),X=!0,F(()=>new Promise(()=>async function(){if(v())if(Z.isDocumentVisible){var e=await async function(){try{return await I().post("/api/v1/users",{})}catch(e){return e.response}}(),t=[];if(e){if(200===e.status||204===e.status){var n=new Date((new Date).getTime()+6e4);i("gist.web.userQueue",e.data,n),t=e.data}else 304===e.status&&(t=o("gist.web.userQueue"));t&&t.length>0?(s(`Message queue checked for user ${v()}, ${t.length} messages found.`),J=t,await K()):(J=[],s("No messages for user token."))}else s("There was an error while checking message queue.")}else s("Document not visible, skipping queue check.");else s("User token reset, skipping queue check.")}()),1e4)):s("User token not setup, queue not started."))}async function K(){s("Messages in local queue: "+J.length);var e=[],t=J.sort((e,t)=>e.priority-t.priority);for(const i of t){if(!await Y(i)){var n=e.find(e=>e.queueId===i.queueId),r=Z.currentMessages.find(e=>e.queueId===i.queueId);n||r?s(`Message with queueId: ${i.queueId} already in queue, discarding.`):e.push(i)}}J=e}async function Y(e){if(!function(e){return void 0!==j.find(t=>t.queueId===e.queueId)}(e)){var t=S(e);if(t.hasRouteRule){var n=Z.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}return t.hasPosition&&(e.position=t.position),t.isEmbedded?await U(e,t.elementId):await D(e)}s(`Message with ${e.queueId} has been shown before, skipping.`)}var Z=t.default=class{static async setup(e){this.events=new r,this.config={useGuestSession:void 0!==e.useGuestSession&&e.useGuestSession,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,s(`Setup complete on ${this.config.env} environment.`),this.config.useGuestSession&&y(),await Q(),document.addEventListener("visibilitychange",async()=>{"hidden"===document.visibilityState?this.isDocumentVisible=!1:(this.isDocumentVisible=!0,await K())},!1)}static async setCurrentRoute(e){this.currentRoute=e,s("Current route set to: "+e),await K()}static async setUserToken(e,t){!function(e,t){void 0===t&&(t=new Date).setDate(t.getDate()+30),i("gist.web.userToken",e,t),a("gist.web.usingGuestUserToken"),s(`Set user token "${e}" with expiry date set to ${t}`)}(e,t),await Q()}static async clearUserToken(){a("gist.web.userToken"),s("Cleared user token"),this.config.useGuestSession&&y(),await Q()}static async dismissMessage(e){var t=_(e);await A(t),await $(t),await K()}static async embedMessage(e,t){return(await U(e,t)).instanceId}static async showMessage(e){var t=await D(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})}}}])}));
@@ -0,0 +1,83 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <title>Gist for Web</title>
5
+ <meta content="width=device-width, initial-scale=1" name="viewport" />
6
+ <meta charset="utf-8" />
7
+ <link href="styles.css" rel="stylesheet">
8
+ </head>
9
+ <body>
10
+ <div id="banner"></div>
11
+ <div class="row header">
12
+ <h1>Gist for Web</h1>
13
+ </div>
14
+ <div class="row examples">
15
+ <a href="#" class="button" onClick="showSimpleMessage()">Show Simple Message</a>
16
+ <a href="#" class="button" onClick="showMessageWithProperties()">Show Message With Properties</a>
17
+ <a href="#" class="button" onClick="showComplexMessage()">Show Complex Message</a>
18
+ <a href="#" class="button" onClick="embedBanner()">Embed Banner</a>
19
+ <a href="#" class="button" onClick="embedFloatingMessage()">Embed Floating Message</a>
20
+ </div>
21
+ <div class="row docs">
22
+ <p>More information can be found on our <a target="_blank" href="https://docs.gist.build">docs</a>, if you have any question you can email us at <a target="_blank" href="mailto:support@gist.build">support@gist.build</a></p>
23
+ </div>
24
+ <script src="../dist/gist.js"></script>
25
+ <script type="text/javascript">
26
+ /*
27
+ Dev Setup Options
28
+ { siteId: "a9dbcd8d5644fbb673ef", dataCenter: "us", useGuestSession: true, env: "local", logging: true, experiments: true }
29
+ */
30
+ Gist.setup({ siteId: "a5ec106751ef4b34a0b9", dataCenter: "eu", logging: true, env: "prod" });
31
+ Gist.setUserToken("ABC123");
32
+ Gist.setCurrentRoute("home");
33
+
34
+ Gist.events.on("messageShown", message => {
35
+ console.log(`onMessageShown: ${message.messageId} with instanceId: ${message.instanceId}`);
36
+ });
37
+
38
+ Gist.events.on("messageDismissed", message => {
39
+ console.log(`onMessageDismissed: ${message.messageId} with instanceId: ${message.instanceId}`);
40
+ });
41
+
42
+ Gist.events.on("messageError", message => {
43
+ console.log(`onMessageError: ${message.messageId} with instanceId: ${message.instanceId}`);
44
+ });
45
+
46
+ Gist.events.on("messageAction", params => {
47
+ console.log(`onMessageAction, Action: ${params.action} with name ${params.name} on route: ${params.message.currentRoute} with instanceId: ${params.message.instanceId}`);
48
+ });
49
+
50
+ function showComplexMessage() {
51
+ Gist.showMessage({messageId: 'version-2-0', position: 'center'});
52
+ }
53
+
54
+ function showSimpleMessage() {
55
+ Gist.showMessage({messageId: 'welcome', position: 'center'});
56
+ }
57
+
58
+ function showMessageWithProperties() {
59
+ Gist.showMessage(
60
+ {
61
+ messageId: 'artists',
62
+ position: 'center',
63
+ properties: {
64
+ gist: { 'scale': true },
65
+ title: 'Top Artists',
66
+ list: [ { name: 'Beatles', discography: [ 'Please Please Me', 'With The Beatles', 'A Hard Day’s Night', 'Beatles For Sale', 'Help!', 'Rubber Soul', 'Revolver', 'Sgt Pepper’s Lonely Hearts Club Band', 'The Beatles', 'Yellow Submarine', 'Abbey Road', 'Let It Be' ] }, { name: 'The Doors', discography: ['The Doors', 'Strange Days', 'Waiting for the Sun', 'The Soft Parade', 'Absolutely Live', 'Morrison Hotel', 'L.A. Woman', 'Other Voices', 'Full Circle', 'An American Prayer'] }]
67
+ }
68
+ });
69
+ }
70
+
71
+ function embedBanner() {
72
+ // Loads example-banner message in element id "banner".
73
+ Gist.embedMessage({ messageId: "example-banner" }, "banner");
74
+ }
75
+
76
+ function embedFloatingMessage() {
77
+ // Loads example-notice message in a Gist preset position.
78
+ // Available positions are: "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".
79
+ Gist.embedMessage({ messageId: "example-notice" }, "x-gist-floating-bottom-right");
80
+ }
81
+ </script>
82
+ </body>
83
+ </html>
@@ -0,0 +1,55 @@
1
+ html, body {
2
+ padding: 0px;
3
+ margin: 0px;
4
+ font-family: Sans-Serif;
5
+ font-weight: 400;
6
+ font-size: 18px;
7
+ line-height: 1.4;
8
+ }
9
+
10
+ .row {
11
+ margin: 0px 16px;
12
+ display: flex;
13
+ }
14
+
15
+ .row.examples {
16
+ flex-wrap: wrap;
17
+ gap: 16px;
18
+ }
19
+
20
+ h1 {
21
+ font-size: 34px;
22
+ line-height: 1.5;
23
+ }
24
+
25
+ .button {
26
+ display: flex;
27
+ font-size: 15px;
28
+ font-weight: bold;
29
+ background-color: #e76f51;
30
+ color: #fff;
31
+ border-radius: 10px;
32
+ min-width: 100px;
33
+ padding: 10px;
34
+ font-style: normal;
35
+ text-decoration: none;
36
+ height: 60px;
37
+ justify-content: center;
38
+ align-items: center;
39
+ padding: 16px;
40
+ }
41
+
42
+ #banner {
43
+ opacity: 0;
44
+ transition: opacity 0.5s ease-in-out;
45
+ }
46
+
47
+ #banner.gist-visible {
48
+ opacity: 1;
49
+ }
50
+
51
+ @media (max-width: 800px) {
52
+ .button {
53
+ width: 100%;
54
+ }
55
+ }
package/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ declare module 'Gist';
package/index.js ADDED
@@ -0,0 +1,2 @@
1
+ import Gist from './dist/gist.min.js';
2
+ export default Gist;
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "customerio-gist-web",
3
+ "version": "3.6.1",
4
+ "description": "Build beautiful in-app flows with no code and deliver them instantly to your app. http://customer.io",
5
+ "private": false,
6
+ "browser": "dist/gist.min.js",
7
+ "scripts": {
8
+ "start": "npm-run-all --parallel watch:server watch:build",
9
+ "build:prod": "webpack -p --mode=production -o dist/gist.min.js",
10
+ "watch:build": "webpack --watch --progress --mode=development",
11
+ "watch:server": "http-server"
12
+ },
13
+ "author": "Customer.io (https://customer.io)",
14
+ "license": "SEE LICENSE IN LICENSE",
15
+ "devDependencies": {
16
+ "html-loader": "^1.1.0",
17
+ "http-server": "^0.12.3",
18
+ "npm-run-all": "^4.1.5",
19
+ "webpack": "^4.44.1",
20
+ "webpack-cli": "^3.3.12"
21
+ },
22
+ "dependencies": {
23
+ "axios": "^0.21.1",
24
+ "uuid": "^8.3.2"
25
+ },
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "git://github.com/customerio/gist-web.git"
29
+ },
30
+ "keywords": [
31
+ "gist",
32
+ "in-app",
33
+ "messages",
34
+ "product",
35
+ "messaging",
36
+ "in-product",
37
+ "gist.build",
38
+ "customerio"
39
+ ],
40
+ "bugs": {
41
+ "url": "https://github.com/customerio/gist-web/issues"
42
+ },
43
+ "homepage": "https://github.com/customerio/gist-web"
44
+ }
package/src/gist.js ADDED
@@ -0,0 +1,100 @@
1
+ import EventEmitter from "./utilities/event-emitter";
2
+ import { log } from "./utilities/log";
3
+ import { startQueueListener, checkMessageQueue } from "./managers/queue-manager";
4
+ import { setUserToken, clearUserToken, useGuestSession } from "./managers/user-manager";
5
+ import { showMessage, embedMessage, hideMessage, removePersistentMessage, fetchMessageByInstanceId } from "./managers/message-manager";
6
+
7
+ export default class {
8
+ static async setup(config) {
9
+ this.events = new EventEmitter();
10
+ this.config = {
11
+ useGuestSession: config.useGuestSession === undefined ? false : config.useGuestSession,
12
+ siteId: config.siteId,
13
+ dataCenter: config.dataCenter,
14
+ env: config.env === undefined ? "prod" : config.env,
15
+ logging: config.logging === undefined ? false : config.logging,
16
+ experiments: config.experiments === undefined ? false : config.experiments
17
+ }
18
+ this.currentMessages = [];
19
+ this.overlayInstanceId = null;
20
+ this.currentRoute = null;
21
+ this.isDocumentVisible = true;
22
+
23
+ log(`Setup complete on ${this.config.env} environment.`);
24
+
25
+ if (this.config.useGuestSession) {
26
+ useGuestSession();
27
+ }
28
+ await startQueueListener();
29
+
30
+ document.addEventListener("visibilitychange", async () => {
31
+ if (document.visibilityState === "hidden") {
32
+ this.isDocumentVisible = false;
33
+ } else {
34
+ this.isDocumentVisible = true;
35
+ await checkMessageQueue();
36
+ }
37
+ }, false);
38
+ }
39
+
40
+ static async setCurrentRoute(route) {
41
+ this.currentRoute = route;
42
+ log(`Current route set to: ${route}`);
43
+ await checkMessageQueue();
44
+ }
45
+
46
+ static async setUserToken(userToken, expiryDate) {
47
+ setUserToken(userToken, expiryDate);
48
+ await startQueueListener();
49
+ }
50
+
51
+ static async clearUserToken() {
52
+ clearUserToken();
53
+ if (this.config.useGuestSession) {
54
+ useGuestSession();
55
+ }
56
+ await startQueueListener();
57
+ }
58
+
59
+ static async dismissMessage(instanceId) {
60
+ var message = fetchMessageByInstanceId(instanceId);
61
+ await hideMessage(message);
62
+ await removePersistentMessage(message);
63
+ await checkMessageQueue();
64
+ }
65
+
66
+ static async embedMessage(message, elementId) {
67
+ var messageResponse = await embedMessage(message, elementId);
68
+ return messageResponse.instanceId;
69
+ }
70
+
71
+ static async showMessage(message) {
72
+ var messageResponse = await showMessage(message);
73
+ return messageResponse ? messageResponse.instanceId : null;
74
+ }
75
+
76
+ // Actions
77
+
78
+ static messageShown(message) {
79
+ log(`Message shown: ${message.messageId}`);
80
+ this.events.dispatch('messageShown', message);
81
+ }
82
+
83
+ static messageDismissed(message) {
84
+ if (message !== null) {
85
+ log(`Message dismissed: ${message.messageId}`);
86
+ this.events.dispatch('messageDismissed', message);
87
+ }
88
+ }
89
+
90
+ static messageError(message) {
91
+ log(`Message error: ${message.messageId}`);
92
+ this.events.dispatch('messageError', message);
93
+ }
94
+
95
+ static messageAction(message, action, name) {
96
+ log(`Message action: ${message.currentRoute}, ${action} with name ${name} on ${message.instanceId}`);
97
+ this.events.dispatch('messageAction', {message: message, action: action, name: name});
98
+ }
99
+
100
+ }
package/src/index.js ADDED
@@ -0,0 +1,2 @@
1
+ const Gist = require('./gist').default;
2
+ module.exports = Gist;