analytica.click 0.0.222 → 0.0.225
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1585 -3
- package/package.json +2 -1
package/dist/index.js
CHANGED
@@ -1,4 +1,1586 @@
|
|
1
|
-
var Ft=Object.create;var Q=Object.defineProperty,Vt=Object.defineProperties,Ut=Object.getOwnPropertyDescriptor,Bt=Object.getOwnPropertyDescriptors,Kt=Object.getOwnPropertyNames,Fe=Object.getOwnPropertySymbols,Nt=Object.getPrototypeOf,Ue=Object.prototype.hasOwnProperty,Jt=Object.prototype.propertyIsEnumerable;var Ve=(e,t,r)=>t in e?Q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,h=(e,t)=>{for(var r in t||(t={}))Ue.call(t,r)&&Ve(e,r,t[r]);if(Fe)for(var r of Fe(t))Jt.call(t,r)&&Ve(e,r,t[r]);return e},y=(e,t)=>Vt(e,Bt(t));var v=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Mt=(e,t)=>{for(var r in t)Q(e,r,{get:t[r],enumerable:!0})},Be=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Kt(t))!Ue.call(e,o)&&o!==r&&Q(e,o,{get:()=>t[o],enumerable:!(n=Ut(t,o))||n.enumerable});return e};var O=(e,t,r)=>(r=e!=null?Ft(Nt(e)):{},Be(t||!e||!e.__esModule?Q(r,"default",{value:e,enumerable:!0}):r,e)),Lt=e=>Be(Q({},"__esModule",{value:!0}),e);var b=(e,t,r)=>new Promise((n,o)=>{var i=c=>{try{s(r.next(c))}catch(u){o(u)}},a=c=>{try{s(r.throw(c))}catch(u){o(u)}},s=c=>c.done?n(c.value):Promise.resolve(c.value).then(i,a);s((r=r.apply(e,t)).next())});var Ke=v(j=>{var Ht=j&&j.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(j,"__esModule",{value:!0});j.RequiredError=j.BaseAPI=j.COLLECTION_FORMATS=j.BASE_PATH=void 0;var zt=Ht(require("axios"));j.BASE_PATH="https://api.analytica.click".replace(/\/+$/,"");j.COLLECTION_FORMATS={csv:",",ssv:" ",tsv:" ",pipes:"|"};var we=class{constructor(t,r=j.BASE_PATH,n=zt.default){this.basePath=r,this.axios=n,t&&(this.configuration=t,this.basePath=t.basePath||this.basePath)}};j.BaseAPI=we;var Ae=class extends Error{constructor(t,r){super(r),this.field=t,this.name="RequiredError"}};j.RequiredError=Ae});var re=v(d=>{var $t=d&&d.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Gt=d&&d.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Wt=d&&d.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&$t(t,e,r);return Gt(t,e),t},A=d&&d.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(l){try{u(n.next(l))}catch(p){a(p)}}function c(l){try{u(n.throw(l))}catch(p){a(p)}}function u(l){l.done?i(l.value):o(l.value).then(s,c)}u((n=n.apply(e,t||[])).next())})},Qt=d&&d.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(d,"__esModule",{value:!0});d.DefaultApi=d.DefaultApiFactory=d.DefaultApiFp=d.DefaultApiAxiosParamCreator=d.Sentiment=void 0;var w=Wt(require("url")),T=Qt(require("axios")),m=Ke(),Xt;(function(e){e.Good="good",e.Bad="bad",e.Neutral="neutral"})(Xt=d.Sentiment||(d.Sentiment={}));var Yt=function(e){return{accountGet:(t={})=>A(this,void 0,void 0,function*(){let r="/account",n=w.parse(r,!0),o;e&&(o=e.baseOptions);let i=Object.assign(Object.assign({method:"GET"},o),t),a={},s={};if(e&&e.apiKey){let u=typeof e.apiKey=="function"?yield e.apiKey("authorization"):yield e.apiKey;a.authorization=u}n.query=Object.assign(Object.assign(Object.assign({},n.query),s),t.query),delete n.search;let c=o&&o.headers?o.headers:{};return i.headers=Object.assign(Object.assign(Object.assign({},a),c),t.headers),{url:w.format(n),options:i}}),archiveError:(t,r={})=>A(this,void 0,void 0,function*(){if(t==null)throw new m.RequiredError("id","Required parameter id was null or undefined when calling archiveError.");let n="/errors/{id}".replace("{id}",encodeURIComponent(String(t))),o=w.parse(n,!0),i;e&&(i=e.baseOptions);let a=Object.assign(Object.assign({method:"DELETE"},i),r),s={},c={};if(e&&e.apiKey){let l=typeof e.apiKey=="function"?yield e.apiKey("authorization"):yield e.apiKey;s.authorization=l}o.query=Object.assign(Object.assign(Object.assign({},o.query),c),r.query),delete o.search;let u=i&&i.headers?i.headers:{};return a.headers=Object.assign(Object.assign(Object.assign({},s),u),r.headers),{url:w.format(o),options:a}}),archiveErrors:(t,r={})=>A(this,void 0,void 0,function*(){if(t==null)throw new m.RequiredError("archiveErrors","Required parameter archiveErrors was null or undefined when calling archiveErrors.");let n="/errors",o=w.parse(n,!0),i;e&&(i=e.baseOptions);let a=Object.assign(Object.assign({method:"DELETE"},i),r),s={},c={};if(e&&e.apiKey){let p=typeof e.apiKey=="function"?yield e.apiKey("authorization"):yield e.apiKey;s.authorization=p}s["Content-Type"]="application/json",o.query=Object.assign(Object.assign(Object.assign({},o.query),c),r.query),delete o.search;let u=i&&i.headers?i.headers:{};a.headers=Object.assign(Object.assign(Object.assign({},s),u),r.headers);let l=typeof t!="string"||a.headers["Content-Type"]==="application/json";return a.data=l?JSON.stringify(t!==void 0?t:{}):t||"",{url:w.format(o),options:a}}),bingIntegrationPost:(t,r={})=>A(this,void 0,void 0,function*(){if(t==null)throw new m.RequiredError("bingIntegration","Required parameter bingIntegration was null or undefined when calling bingIntegrationPost.");let n="/account/integrations/bing",o=w.parse(n,!0),i;e&&(i=e.baseOptions);let a=Object.assign(Object.assign({method:"POST"},i),r),s={},c={};if(e&&e.apiKey){let p=typeof e.apiKey=="function"?yield e.apiKey("authorization"):yield e.apiKey;s.authorization=p}s["Content-Type"]="application/json",o.query=Object.assign(Object.assign(Object.assign({},o.query),c),r.query),delete o.search;let u=i&&i.headers?i.headers:{};a.headers=Object.assign(Object.assign(Object.assign({},s),u),r.headers);let l=typeof t!="string"||a.headers["Content-Type"]==="application/json";return a.data=l?JSON.stringify(t!==void 0?t:{}):t||"",{url:w.format(o),options:a}}),getTrackingAllSites:(t,r,n={})=>A(this,void 0,void 0,function*(){if(t==null)throw new m.RequiredError("minDate","Required parameter minDate was null or undefined when calling getTrackingAllSites.");if(r==null)throw new m.RequiredError("maxDate","Required parameter maxDate was null or undefined when calling getTrackingAllSites.");let o="/site/tracking",i=w.parse(o,!0),a;e&&(a=e.baseOptions);let s=Object.assign(Object.assign({method:"GET"},a),n),c={},u={};if(e&&e.apiKey){let p=typeof e.apiKey=="function"?yield e.apiKey("authorization"):yield e.apiKey;c.authorization=p}t!==void 0&&(u.minDate=t),r!==void 0&&(u.maxDate=r),i.query=Object.assign(Object.assign(Object.assign({},i.query),u),n.query),delete i.search;let l=a&&a.headers?a.headers:{};return s.headers=Object.assign(Object.assign(Object.assign({},c),l),n.headers),{url:w.format(i),options:s}}),getTrackingSite:(t,r,n,o={})=>A(this,void 0,void 0,function*(){if(t==null)throw new m.RequiredError("id","Required parameter id was null or undefined when calling getTrackingSite.");if(r==null)throw new m.RequiredError("minDate","Required parameter minDate was null or undefined when calling getTrackingSite.");if(n==null)throw new m.RequiredError("maxDate","Required parameter maxDate was null or undefined when calling getTrackingSite.");let i="/site/tracking/{id}".replace("{id}",encodeURIComponent(String(t))),a=w.parse(i,!0),s;e&&(s=e.baseOptions);let c=Object.assign(Object.assign({method:"GET"},s),o),u={},l={};if(e&&e.apiKey){let _=typeof e.apiKey=="function"?yield e.apiKey("authorization"):yield e.apiKey;u.authorization=_}r!==void 0&&(l.minDate=r),n!==void 0&&(l.maxDate=n),a.query=Object.assign(Object.assign(Object.assign({},a.query),l),o.query),delete a.search;let p=s&&s.headers?s.headers:{};return c.headers=Object.assign(Object.assign(Object.assign({},u),p),o.headers),{url:w.format(a),options:c}}),googleIntegrationPost:(t,r={})=>A(this,void 0,void 0,function*(){if(t==null)throw new m.RequiredError("googleIntegration","Required parameter googleIntegration was null or undefined when calling googleIntegrationPost.");let n="/account/integrations/google",o=w.parse(n,!0),i;e&&(i=e.baseOptions);let a=Object.assign(Object.assign({method:"POST"},i),r),s={},c={};if(e&&e.apiKey){let p=typeof e.apiKey=="function"?yield e.apiKey("authorization"):yield e.apiKey;s.authorization=p}s["Content-Type"]="application/json",o.query=Object.assign(Object.assign(Object.assign({},o.query),c),r.query),delete o.search;let u=i&&i.headers?i.headers:{};a.headers=Object.assign(Object.assign(Object.assign({},s),u),r.headers);let l=typeof t!="string"||a.headers["Content-Type"]==="application/json";return a.data=l?JSON.stringify(t!==void 0?t:{}):t||"",{url:w.format(o),options:a}}),postError:(t,r={})=>A(this,void 0,void 0,function*(){if(t==null)throw new m.RequiredError("postError","Required parameter postError was null or undefined when calling postError.");let n="/errors",o=w.parse(n,!0),i;e&&(i=e.baseOptions);let a=Object.assign(Object.assign({method:"POST"},i),r),s={},c={};s["Content-Type"]="application/json",o.query=Object.assign(Object.assign(Object.assign({},o.query),c),r.query),delete o.search;let u=i&&i.headers?i.headers:{};a.headers=Object.assign(Object.assign(Object.assign({},s),u),r.headers);let l=typeof t!="string"||a.headers["Content-Type"]==="application/json";return a.data=l?JSON.stringify(t!==void 0?t:{}):t||"",{url:w.format(o),options:a}}),postPageTrack:(t,r={})=>A(this,void 0,void 0,function*(){if(t==null)throw new m.RequiredError("postSiteTrack","Required parameter postSiteTrack was null or undefined when calling postPageTrack.");let n="/site",o=w.parse(n,!0),i;e&&(i=e.baseOptions);let a=Object.assign(Object.assign({method:"POST"},i),r),s={},c={};s["Content-Type"]="application/json",o.query=Object.assign(Object.assign(Object.assign({},o.query),c),r.query),delete o.search;let u=i&&i.headers?i.headers:{};a.headers=Object.assign(Object.assign(Object.assign({},s),u),r.headers);let l=typeof t!="string"||a.headers["Content-Type"]==="application/json";return a.data=l?JSON.stringify(t!==void 0?t:{}):t||"",{url:w.format(o),options:a}}),putFeedback:(t,r={})=>A(this,void 0,void 0,function*(){if(t==null)throw new m.RequiredError("feedbackPutData","Required parameter feedbackPutData was null or undefined when calling putFeedback.");let n="/feedback",o=w.parse(n,!0),i;e&&(i=e.baseOptions);let a=Object.assign(Object.assign({method:"PUT"},i),r),s={},c={};s["Content-Type"]="application/json",o.query=Object.assign(Object.assign(Object.assign({},o.query),c),r.query),delete o.search;let u=i&&i.headers?i.headers:{};a.headers=Object.assign(Object.assign(Object.assign({},s),u),r.headers);let l=typeof t!="string"||a.headers["Content-Type"]==="application/json";return a.data=l?JSON.stringify(t!==void 0?t:{}):t||"",{url:w.format(o),options:a}}),sitePost:(t,r={})=>A(this,void 0,void 0,function*(){if(t==null)throw new m.RequiredError("postAccount","Required parameter postAccount was null or undefined when calling sitePost.");let n="/account/site",o=w.parse(n,!0),i;e&&(i=e.baseOptions);let a=Object.assign(Object.assign({method:"POST"},i),r),s={},c={};if(e&&e.apiKey){let p=typeof e.apiKey=="function"?yield e.apiKey("authorization"):yield e.apiKey;s.authorization=p}s["Content-Type"]="application/json",o.query=Object.assign(Object.assign(Object.assign({},o.query),c),r.query),delete o.search;let u=i&&i.headers?i.headers:{};a.headers=Object.assign(Object.assign(Object.assign({},s),u),r.headers);let l=typeof t!="string"||a.headers["Content-Type"]==="application/json";return a.data=l?JSON.stringify(t!==void 0?t:{}):t||"",{url:w.format(o),options:a}})}};d.DefaultApiAxiosParamCreator=Yt;var Zt=function(e){return{accountGet(t){return A(this,void 0,void 0,function*(){let r=yield(0,d.DefaultApiAxiosParamCreator)(e).accountGet(t);return(n=T.default,o=m.BASE_PATH)=>{let i=Object.assign(Object.assign({},r.options),{url:o+r.url});return n.request(i)}})},archiveError(t,r){return A(this,void 0,void 0,function*(){let n=yield(0,d.DefaultApiAxiosParamCreator)(e).archiveError(t,r);return(o=T.default,i=m.BASE_PATH)=>{let a=Object.assign(Object.assign({},n.options),{url:i+n.url});return o.request(a)}})},archiveErrors(t,r){return A(this,void 0,void 0,function*(){let n=yield(0,d.DefaultApiAxiosParamCreator)(e).archiveErrors(t,r);return(o=T.default,i=m.BASE_PATH)=>{let a=Object.assign(Object.assign({},n.options),{url:i+n.url});return o.request(a)}})},bingIntegrationPost(t,r){return A(this,void 0,void 0,function*(){let n=yield(0,d.DefaultApiAxiosParamCreator)(e).bingIntegrationPost(t,r);return(o=T.default,i=m.BASE_PATH)=>{let a=Object.assign(Object.assign({},n.options),{url:i+n.url});return o.request(a)}})},getTrackingAllSites(t,r,n){return A(this,void 0,void 0,function*(){let o=yield(0,d.DefaultApiAxiosParamCreator)(e).getTrackingAllSites(t,r,n);return(i=T.default,a=m.BASE_PATH)=>{let s=Object.assign(Object.assign({},o.options),{url:a+o.url});return i.request(s)}})},getTrackingSite(t,r,n,o){return A(this,void 0,void 0,function*(){let i=yield(0,d.DefaultApiAxiosParamCreator)(e).getTrackingSite(t,r,n,o);return(a=T.default,s=m.BASE_PATH)=>{let c=Object.assign(Object.assign({},i.options),{url:s+i.url});return a.request(c)}})},googleIntegrationPost(t,r){return A(this,void 0,void 0,function*(){let n=yield(0,d.DefaultApiAxiosParamCreator)(e).googleIntegrationPost(t,r);return(o=T.default,i=m.BASE_PATH)=>{let a=Object.assign(Object.assign({},n.options),{url:i+n.url});return o.request(a)}})},postError(t,r){return A(this,void 0,void 0,function*(){let n=yield(0,d.DefaultApiAxiosParamCreator)(e).postError(t,r);return(o=T.default,i=m.BASE_PATH)=>{let a=Object.assign(Object.assign({},n.options),{url:i+n.url});return o.request(a)}})},postPageTrack(t,r){return A(this,void 0,void 0,function*(){let n=yield(0,d.DefaultApiAxiosParamCreator)(e).postPageTrack(t,r);return(o=T.default,i=m.BASE_PATH)=>{let a=Object.assign(Object.assign({},n.options),{url:i+n.url});return o.request(a)}})},putFeedback(t,r){return A(this,void 0,void 0,function*(){let n=yield(0,d.DefaultApiAxiosParamCreator)(e).putFeedback(t,r);return(o=T.default,i=m.BASE_PATH)=>{let a=Object.assign(Object.assign({},n.options),{url:i+n.url});return o.request(a)}})},sitePost(t,r){return A(this,void 0,void 0,function*(){let n=yield(0,d.DefaultApiAxiosParamCreator)(e).sitePost(t,r);return(o=T.default,i=m.BASE_PATH)=>{let a=Object.assign(Object.assign({},n.options),{url:i+n.url});return o.request(a)}})}}};d.DefaultApiFp=Zt;var er=function(e,t,r){return{accountGet(n){return(0,d.DefaultApiFp)(e).accountGet(n).then(o=>o(r,t))},archiveError(n,o){return(0,d.DefaultApiFp)(e).archiveError(n,o).then(i=>i(r,t))},archiveErrors(n,o){return(0,d.DefaultApiFp)(e).archiveErrors(n,o).then(i=>i(r,t))},bingIntegrationPost(n,o){return(0,d.DefaultApiFp)(e).bingIntegrationPost(n,o).then(i=>i(r,t))},getTrackingAllSites(n,o,i){return(0,d.DefaultApiFp)(e).getTrackingAllSites(n,o,i).then(a=>a(r,t))},getTrackingSite(n,o,i,a){return(0,d.DefaultApiFp)(e).getTrackingSite(n,o,i,a).then(s=>s(r,t))},googleIntegrationPost(n,o){return(0,d.DefaultApiFp)(e).googleIntegrationPost(n,o).then(i=>i(r,t))},postError(n,o){return(0,d.DefaultApiFp)(e).postError(n,o).then(i=>i(r,t))},postPageTrack(n,o){return(0,d.DefaultApiFp)(e).postPageTrack(n,o).then(i=>i(r,t))},putFeedback(n,o){return(0,d.DefaultApiFp)(e).putFeedback(n,o).then(i=>i(r,t))},sitePost(n,o){return(0,d.DefaultApiFp)(e).sitePost(n,o).then(i=>i(r,t))}}};d.DefaultApiFactory=er;var Oe=class extends m.BaseAPI{accountGet(t){return(0,d.DefaultApiFp)(this.configuration).accountGet(t).then(r=>r(this.axios,this.basePath))}archiveError(t,r){return(0,d.DefaultApiFp)(this.configuration).archiveError(t,r).then(n=>n(this.axios,this.basePath))}archiveErrors(t,r){return(0,d.DefaultApiFp)(this.configuration).archiveErrors(t,r).then(n=>n(this.axios,this.basePath))}bingIntegrationPost(t,r){return(0,d.DefaultApiFp)(this.configuration).bingIntegrationPost(t,r).then(n=>n(this.axios,this.basePath))}getTrackingAllSites(t,r,n){return(0,d.DefaultApiFp)(this.configuration).getTrackingAllSites(t,r,n).then(o=>o(this.axios,this.basePath))}getTrackingSite(t,r,n,o){return(0,d.DefaultApiFp)(this.configuration).getTrackingSite(t,r,n,o).then(i=>i(this.axios,this.basePath))}googleIntegrationPost(t,r){return(0,d.DefaultApiFp)(this.configuration).googleIntegrationPost(t,r).then(n=>n(this.axios,this.basePath))}postError(t,r){return(0,d.DefaultApiFp)(this.configuration).postError(t,r).then(n=>n(this.axios,this.basePath))}postPageTrack(t,r){return(0,d.DefaultApiFp)(this.configuration).postPageTrack(t,r).then(n=>n(this.axios,this.basePath))}putFeedback(t,r){return(0,d.DefaultApiFp)(this.configuration).putFeedback(t,r).then(n=>n(this.axios,this.basePath))}sitePost(t,r){return(0,d.DefaultApiFp)(this.configuration).sitePost(t,r).then(n=>n(this.axios,this.basePath))}};d.DefaultApi=Oe});var Ze=v(J=>{var Ye=J&&J.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(J,"__esModule",{value:!0});J.ErrorBoundary=void 0;var ur=require("ag-common/dist/ui/components/Modal"),ae=Ye(require("react")),dr=Ye(require("styled-components")),lr=dr.default.div`
|
1
|
+
var __create = Object.create;
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __defProps = Object.defineProperties;
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
12
|
+
var __spreadValues = (a, b) => {
|
13
|
+
for (var prop in b || (b = {}))
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
16
|
+
if (__getOwnPropSymbols)
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
18
|
+
if (__propIsEnum.call(b, prop))
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
20
|
+
}
|
21
|
+
return a;
|
22
|
+
};
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
24
|
+
var __commonJS = (cb, mod) => function __require() {
|
25
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
26
|
+
};
|
27
|
+
var __export = (target, all) => {
|
28
|
+
for (var name in all)
|
29
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
30
|
+
};
|
31
|
+
var __copyProps = (to, from, except, desc) => {
|
32
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
33
|
+
for (let key of __getOwnPropNames(from))
|
34
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
35
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
36
|
+
}
|
37
|
+
return to;
|
38
|
+
};
|
39
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
40
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
41
|
+
var __async = (__this, __arguments, generator) => {
|
42
|
+
return new Promise((resolve, reject) => {
|
43
|
+
var fulfilled = (value) => {
|
44
|
+
try {
|
45
|
+
step(generator.next(value));
|
46
|
+
} catch (e) {
|
47
|
+
reject(e);
|
48
|
+
}
|
49
|
+
};
|
50
|
+
var rejected = (value) => {
|
51
|
+
try {
|
52
|
+
step(generator.throw(value));
|
53
|
+
} catch (e) {
|
54
|
+
reject(e);
|
55
|
+
}
|
56
|
+
};
|
57
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
58
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
59
|
+
});
|
60
|
+
};
|
61
|
+
|
62
|
+
// ../common/dist/api/base.js
|
63
|
+
var require_base = __commonJS({
|
64
|
+
"../common/dist/api/base.js"(exports) {
|
65
|
+
var __importDefault = exports && exports.__importDefault || function(mod) {
|
66
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
67
|
+
};
|
68
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
69
|
+
exports.RequiredError = exports.BaseAPI = exports.COLLECTION_FORMATS = exports.BASE_PATH = void 0;
|
70
|
+
var axios_1 = __importDefault(require("axios"));
|
71
|
+
exports.BASE_PATH = "https://api.analytica.click".replace(/\/+$/, "");
|
72
|
+
exports.COLLECTION_FORMATS = {
|
73
|
+
csv: ",",
|
74
|
+
ssv: " ",
|
75
|
+
tsv: " ",
|
76
|
+
pipes: "|"
|
77
|
+
};
|
78
|
+
var BaseAPI = class {
|
79
|
+
constructor(configuration, basePath = exports.BASE_PATH, axios = axios_1.default) {
|
80
|
+
this.basePath = basePath;
|
81
|
+
this.axios = axios;
|
82
|
+
if (configuration) {
|
83
|
+
this.configuration = configuration;
|
84
|
+
this.basePath = configuration.basePath || this.basePath;
|
85
|
+
}
|
86
|
+
}
|
87
|
+
};
|
88
|
+
exports.BaseAPI = BaseAPI;
|
89
|
+
var RequiredError = class extends Error {
|
90
|
+
constructor(field, msg) {
|
91
|
+
super(msg);
|
92
|
+
this.field = field;
|
93
|
+
this.name = "RequiredError";
|
94
|
+
}
|
95
|
+
};
|
96
|
+
exports.RequiredError = RequiredError;
|
97
|
+
}
|
98
|
+
});
|
99
|
+
|
100
|
+
// ../common/dist/api/api.js
|
101
|
+
var require_api = __commonJS({
|
102
|
+
"../common/dist/api/api.js"(exports) {
|
103
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
104
|
+
if (k2 === void 0)
|
105
|
+
k2 = k;
|
106
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
107
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
108
|
+
desc = { enumerable: true, get: function() {
|
109
|
+
return m[k];
|
110
|
+
} };
|
111
|
+
}
|
112
|
+
Object.defineProperty(o, k2, desc);
|
113
|
+
} : function(o, m, k, k2) {
|
114
|
+
if (k2 === void 0)
|
115
|
+
k2 = k;
|
116
|
+
o[k2] = m[k];
|
117
|
+
});
|
118
|
+
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
|
119
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
120
|
+
} : function(o, v) {
|
121
|
+
o["default"] = v;
|
122
|
+
});
|
123
|
+
var __importStar = exports && exports.__importStar || function(mod) {
|
124
|
+
if (mod && mod.__esModule)
|
125
|
+
return mod;
|
126
|
+
var result = {};
|
127
|
+
if (mod != null) {
|
128
|
+
for (var k in mod)
|
129
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
130
|
+
__createBinding(result, mod, k);
|
131
|
+
}
|
132
|
+
__setModuleDefault(result, mod);
|
133
|
+
return result;
|
134
|
+
};
|
135
|
+
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
|
136
|
+
function adopt(value) {
|
137
|
+
return value instanceof P ? value : new P(function(resolve) {
|
138
|
+
resolve(value);
|
139
|
+
});
|
140
|
+
}
|
141
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
142
|
+
function fulfilled(value) {
|
143
|
+
try {
|
144
|
+
step(generator.next(value));
|
145
|
+
} catch (e) {
|
146
|
+
reject(e);
|
147
|
+
}
|
148
|
+
}
|
149
|
+
function rejected(value) {
|
150
|
+
try {
|
151
|
+
step(generator["throw"](value));
|
152
|
+
} catch (e) {
|
153
|
+
reject(e);
|
154
|
+
}
|
155
|
+
}
|
156
|
+
function step(result) {
|
157
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
158
|
+
}
|
159
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
160
|
+
});
|
161
|
+
};
|
162
|
+
var __importDefault = exports && exports.__importDefault || function(mod) {
|
163
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
164
|
+
};
|
165
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
166
|
+
exports.DefaultApi = exports.DefaultApiFactory = exports.DefaultApiFp = exports.DefaultApiAxiosParamCreator = exports.Sentiment = void 0;
|
167
|
+
var globalImportUrl = __importStar(require("url"));
|
168
|
+
var axios_1 = __importDefault(require("axios"));
|
169
|
+
var base_1 = require_base();
|
170
|
+
var Sentiment;
|
171
|
+
(function(Sentiment2) {
|
172
|
+
Sentiment2["Good"] = "good";
|
173
|
+
Sentiment2["Bad"] = "bad";
|
174
|
+
Sentiment2["Neutral"] = "neutral";
|
175
|
+
})(Sentiment = exports.Sentiment || (exports.Sentiment = {}));
|
176
|
+
var DefaultApiAxiosParamCreator = function(configuration) {
|
177
|
+
return {
|
178
|
+
accountGet: (options = {}) => __awaiter(this, void 0, void 0, function* () {
|
179
|
+
const localVarPath = `/account`;
|
180
|
+
const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
|
181
|
+
let baseOptions;
|
182
|
+
if (configuration) {
|
183
|
+
baseOptions = configuration.baseOptions;
|
184
|
+
}
|
185
|
+
const localVarRequestOptions = Object.assign(Object.assign({ method: "GET" }, baseOptions), options);
|
186
|
+
const localVarHeaderParameter = {};
|
187
|
+
const localVarQueryParameter = {};
|
188
|
+
if (configuration && configuration.apiKey) {
|
189
|
+
const localVarApiKeyValue = typeof configuration.apiKey === "function" ? yield configuration.apiKey("authorization") : yield configuration.apiKey;
|
190
|
+
localVarHeaderParameter["authorization"] = localVarApiKeyValue;
|
191
|
+
}
|
192
|
+
localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
|
193
|
+
delete localVarUrlObj.search;
|
194
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
195
|
+
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
|
196
|
+
return {
|
197
|
+
url: globalImportUrl.format(localVarUrlObj),
|
198
|
+
options: localVarRequestOptions
|
199
|
+
};
|
200
|
+
}),
|
201
|
+
archiveError: (id, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
202
|
+
if (id === null || id === void 0) {
|
203
|
+
throw new base_1.RequiredError("id", "Required parameter id was null or undefined when calling archiveError.");
|
204
|
+
}
|
205
|
+
const localVarPath = `/errors/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(id)));
|
206
|
+
const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
|
207
|
+
let baseOptions;
|
208
|
+
if (configuration) {
|
209
|
+
baseOptions = configuration.baseOptions;
|
210
|
+
}
|
211
|
+
const localVarRequestOptions = Object.assign(Object.assign({ method: "DELETE" }, baseOptions), options);
|
212
|
+
const localVarHeaderParameter = {};
|
213
|
+
const localVarQueryParameter = {};
|
214
|
+
if (configuration && configuration.apiKey) {
|
215
|
+
const localVarApiKeyValue = typeof configuration.apiKey === "function" ? yield configuration.apiKey("authorization") : yield configuration.apiKey;
|
216
|
+
localVarHeaderParameter["authorization"] = localVarApiKeyValue;
|
217
|
+
}
|
218
|
+
localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
|
219
|
+
delete localVarUrlObj.search;
|
220
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
221
|
+
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
|
222
|
+
return {
|
223
|
+
url: globalImportUrl.format(localVarUrlObj),
|
224
|
+
options: localVarRequestOptions
|
225
|
+
};
|
226
|
+
}),
|
227
|
+
archiveErrors: (archiveErrors, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
228
|
+
if (archiveErrors === null || archiveErrors === void 0) {
|
229
|
+
throw new base_1.RequiredError("archiveErrors", "Required parameter archiveErrors was null or undefined when calling archiveErrors.");
|
230
|
+
}
|
231
|
+
const localVarPath = `/errors`;
|
232
|
+
const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
|
233
|
+
let baseOptions;
|
234
|
+
if (configuration) {
|
235
|
+
baseOptions = configuration.baseOptions;
|
236
|
+
}
|
237
|
+
const localVarRequestOptions = Object.assign(Object.assign({ method: "DELETE" }, baseOptions), options);
|
238
|
+
const localVarHeaderParameter = {};
|
239
|
+
const localVarQueryParameter = {};
|
240
|
+
if (configuration && configuration.apiKey) {
|
241
|
+
const localVarApiKeyValue = typeof configuration.apiKey === "function" ? yield configuration.apiKey("authorization") : yield configuration.apiKey;
|
242
|
+
localVarHeaderParameter["authorization"] = localVarApiKeyValue;
|
243
|
+
}
|
244
|
+
localVarHeaderParameter["Content-Type"] = "application/json";
|
245
|
+
localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
|
246
|
+
delete localVarUrlObj.search;
|
247
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
248
|
+
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
|
249
|
+
const needsSerialization = typeof archiveErrors !== "string" || localVarRequestOptions.headers["Content-Type"] === "application/json";
|
250
|
+
localVarRequestOptions.data = needsSerialization ? JSON.stringify(archiveErrors !== void 0 ? archiveErrors : {}) : archiveErrors || "";
|
251
|
+
return {
|
252
|
+
url: globalImportUrl.format(localVarUrlObj),
|
253
|
+
options: localVarRequestOptions
|
254
|
+
};
|
255
|
+
}),
|
256
|
+
bingIntegrationPost: (bingIntegration, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
257
|
+
if (bingIntegration === null || bingIntegration === void 0) {
|
258
|
+
throw new base_1.RequiredError("bingIntegration", "Required parameter bingIntegration was null or undefined when calling bingIntegrationPost.");
|
259
|
+
}
|
260
|
+
const localVarPath = `/account/integrations/bing`;
|
261
|
+
const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
|
262
|
+
let baseOptions;
|
263
|
+
if (configuration) {
|
264
|
+
baseOptions = configuration.baseOptions;
|
265
|
+
}
|
266
|
+
const localVarRequestOptions = Object.assign(Object.assign({ method: "POST" }, baseOptions), options);
|
267
|
+
const localVarHeaderParameter = {};
|
268
|
+
const localVarQueryParameter = {};
|
269
|
+
if (configuration && configuration.apiKey) {
|
270
|
+
const localVarApiKeyValue = typeof configuration.apiKey === "function" ? yield configuration.apiKey("authorization") : yield configuration.apiKey;
|
271
|
+
localVarHeaderParameter["authorization"] = localVarApiKeyValue;
|
272
|
+
}
|
273
|
+
localVarHeaderParameter["Content-Type"] = "application/json";
|
274
|
+
localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
|
275
|
+
delete localVarUrlObj.search;
|
276
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
277
|
+
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
|
278
|
+
const needsSerialization = typeof bingIntegration !== "string" || localVarRequestOptions.headers["Content-Type"] === "application/json";
|
279
|
+
localVarRequestOptions.data = needsSerialization ? JSON.stringify(bingIntegration !== void 0 ? bingIntegration : {}) : bingIntegration || "";
|
280
|
+
return {
|
281
|
+
url: globalImportUrl.format(localVarUrlObj),
|
282
|
+
options: localVarRequestOptions
|
283
|
+
};
|
284
|
+
}),
|
285
|
+
getTrackingAllSites: (minDate, maxDate, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
286
|
+
if (minDate === null || minDate === void 0) {
|
287
|
+
throw new base_1.RequiredError("minDate", "Required parameter minDate was null or undefined when calling getTrackingAllSites.");
|
288
|
+
}
|
289
|
+
if (maxDate === null || maxDate === void 0) {
|
290
|
+
throw new base_1.RequiredError("maxDate", "Required parameter maxDate was null or undefined when calling getTrackingAllSites.");
|
291
|
+
}
|
292
|
+
const localVarPath = `/site/tracking`;
|
293
|
+
const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
|
294
|
+
let baseOptions;
|
295
|
+
if (configuration) {
|
296
|
+
baseOptions = configuration.baseOptions;
|
297
|
+
}
|
298
|
+
const localVarRequestOptions = Object.assign(Object.assign({ method: "GET" }, baseOptions), options);
|
299
|
+
const localVarHeaderParameter = {};
|
300
|
+
const localVarQueryParameter = {};
|
301
|
+
if (configuration && configuration.apiKey) {
|
302
|
+
const localVarApiKeyValue = typeof configuration.apiKey === "function" ? yield configuration.apiKey("authorization") : yield configuration.apiKey;
|
303
|
+
localVarHeaderParameter["authorization"] = localVarApiKeyValue;
|
304
|
+
}
|
305
|
+
if (minDate !== void 0) {
|
306
|
+
localVarQueryParameter["minDate"] = minDate;
|
307
|
+
}
|
308
|
+
if (maxDate !== void 0) {
|
309
|
+
localVarQueryParameter["maxDate"] = maxDate;
|
310
|
+
}
|
311
|
+
localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
|
312
|
+
delete localVarUrlObj.search;
|
313
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
314
|
+
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
|
315
|
+
return {
|
316
|
+
url: globalImportUrl.format(localVarUrlObj),
|
317
|
+
options: localVarRequestOptions
|
318
|
+
};
|
319
|
+
}),
|
320
|
+
getTrackingSite: (id, minDate, maxDate, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
321
|
+
if (id === null || id === void 0) {
|
322
|
+
throw new base_1.RequiredError("id", "Required parameter id was null or undefined when calling getTrackingSite.");
|
323
|
+
}
|
324
|
+
if (minDate === null || minDate === void 0) {
|
325
|
+
throw new base_1.RequiredError("minDate", "Required parameter minDate was null or undefined when calling getTrackingSite.");
|
326
|
+
}
|
327
|
+
if (maxDate === null || maxDate === void 0) {
|
328
|
+
throw new base_1.RequiredError("maxDate", "Required parameter maxDate was null or undefined when calling getTrackingSite.");
|
329
|
+
}
|
330
|
+
const localVarPath = `/site/tracking/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(id)));
|
331
|
+
const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
|
332
|
+
let baseOptions;
|
333
|
+
if (configuration) {
|
334
|
+
baseOptions = configuration.baseOptions;
|
335
|
+
}
|
336
|
+
const localVarRequestOptions = Object.assign(Object.assign({ method: "GET" }, baseOptions), options);
|
337
|
+
const localVarHeaderParameter = {};
|
338
|
+
const localVarQueryParameter = {};
|
339
|
+
if (configuration && configuration.apiKey) {
|
340
|
+
const localVarApiKeyValue = typeof configuration.apiKey === "function" ? yield configuration.apiKey("authorization") : yield configuration.apiKey;
|
341
|
+
localVarHeaderParameter["authorization"] = localVarApiKeyValue;
|
342
|
+
}
|
343
|
+
if (minDate !== void 0) {
|
344
|
+
localVarQueryParameter["minDate"] = minDate;
|
345
|
+
}
|
346
|
+
if (maxDate !== void 0) {
|
347
|
+
localVarQueryParameter["maxDate"] = maxDate;
|
348
|
+
}
|
349
|
+
localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
|
350
|
+
delete localVarUrlObj.search;
|
351
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
352
|
+
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
|
353
|
+
return {
|
354
|
+
url: globalImportUrl.format(localVarUrlObj),
|
355
|
+
options: localVarRequestOptions
|
356
|
+
};
|
357
|
+
}),
|
358
|
+
googleIntegrationPost: (googleIntegration, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
359
|
+
if (googleIntegration === null || googleIntegration === void 0) {
|
360
|
+
throw new base_1.RequiredError("googleIntegration", "Required parameter googleIntegration was null or undefined when calling googleIntegrationPost.");
|
361
|
+
}
|
362
|
+
const localVarPath = `/account/integrations/google`;
|
363
|
+
const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
|
364
|
+
let baseOptions;
|
365
|
+
if (configuration) {
|
366
|
+
baseOptions = configuration.baseOptions;
|
367
|
+
}
|
368
|
+
const localVarRequestOptions = Object.assign(Object.assign({ method: "POST" }, baseOptions), options);
|
369
|
+
const localVarHeaderParameter = {};
|
370
|
+
const localVarQueryParameter = {};
|
371
|
+
if (configuration && configuration.apiKey) {
|
372
|
+
const localVarApiKeyValue = typeof configuration.apiKey === "function" ? yield configuration.apiKey("authorization") : yield configuration.apiKey;
|
373
|
+
localVarHeaderParameter["authorization"] = localVarApiKeyValue;
|
374
|
+
}
|
375
|
+
localVarHeaderParameter["Content-Type"] = "application/json";
|
376
|
+
localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
|
377
|
+
delete localVarUrlObj.search;
|
378
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
379
|
+
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
|
380
|
+
const needsSerialization = typeof googleIntegration !== "string" || localVarRequestOptions.headers["Content-Type"] === "application/json";
|
381
|
+
localVarRequestOptions.data = needsSerialization ? JSON.stringify(googleIntegration !== void 0 ? googleIntegration : {}) : googleIntegration || "";
|
382
|
+
return {
|
383
|
+
url: globalImportUrl.format(localVarUrlObj),
|
384
|
+
options: localVarRequestOptions
|
385
|
+
};
|
386
|
+
}),
|
387
|
+
postError: (postError, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
388
|
+
if (postError === null || postError === void 0) {
|
389
|
+
throw new base_1.RequiredError("postError", "Required parameter postError was null or undefined when calling postError.");
|
390
|
+
}
|
391
|
+
const localVarPath = `/errors`;
|
392
|
+
const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
|
393
|
+
let baseOptions;
|
394
|
+
if (configuration) {
|
395
|
+
baseOptions = configuration.baseOptions;
|
396
|
+
}
|
397
|
+
const localVarRequestOptions = Object.assign(Object.assign({ method: "POST" }, baseOptions), options);
|
398
|
+
const localVarHeaderParameter = {};
|
399
|
+
const localVarQueryParameter = {};
|
400
|
+
localVarHeaderParameter["Content-Type"] = "application/json";
|
401
|
+
localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
|
402
|
+
delete localVarUrlObj.search;
|
403
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
404
|
+
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
|
405
|
+
const needsSerialization = typeof postError !== "string" || localVarRequestOptions.headers["Content-Type"] === "application/json";
|
406
|
+
localVarRequestOptions.data = needsSerialization ? JSON.stringify(postError !== void 0 ? postError : {}) : postError || "";
|
407
|
+
return {
|
408
|
+
url: globalImportUrl.format(localVarUrlObj),
|
409
|
+
options: localVarRequestOptions
|
410
|
+
};
|
411
|
+
}),
|
412
|
+
postPageTrack: (postSiteTrack, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
413
|
+
if (postSiteTrack === null || postSiteTrack === void 0) {
|
414
|
+
throw new base_1.RequiredError("postSiteTrack", "Required parameter postSiteTrack was null or undefined when calling postPageTrack.");
|
415
|
+
}
|
416
|
+
const localVarPath = `/site`;
|
417
|
+
const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
|
418
|
+
let baseOptions;
|
419
|
+
if (configuration) {
|
420
|
+
baseOptions = configuration.baseOptions;
|
421
|
+
}
|
422
|
+
const localVarRequestOptions = Object.assign(Object.assign({ method: "POST" }, baseOptions), options);
|
423
|
+
const localVarHeaderParameter = {};
|
424
|
+
const localVarQueryParameter = {};
|
425
|
+
localVarHeaderParameter["Content-Type"] = "application/json";
|
426
|
+
localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
|
427
|
+
delete localVarUrlObj.search;
|
428
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
429
|
+
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
|
430
|
+
const needsSerialization = typeof postSiteTrack !== "string" || localVarRequestOptions.headers["Content-Type"] === "application/json";
|
431
|
+
localVarRequestOptions.data = needsSerialization ? JSON.stringify(postSiteTrack !== void 0 ? postSiteTrack : {}) : postSiteTrack || "";
|
432
|
+
return {
|
433
|
+
url: globalImportUrl.format(localVarUrlObj),
|
434
|
+
options: localVarRequestOptions
|
435
|
+
};
|
436
|
+
}),
|
437
|
+
putFeedback: (feedbackPutData, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
438
|
+
if (feedbackPutData === null || feedbackPutData === void 0) {
|
439
|
+
throw new base_1.RequiredError("feedbackPutData", "Required parameter feedbackPutData was null or undefined when calling putFeedback.");
|
440
|
+
}
|
441
|
+
const localVarPath = `/feedback`;
|
442
|
+
const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
|
443
|
+
let baseOptions;
|
444
|
+
if (configuration) {
|
445
|
+
baseOptions = configuration.baseOptions;
|
446
|
+
}
|
447
|
+
const localVarRequestOptions = Object.assign(Object.assign({ method: "PUT" }, baseOptions), options);
|
448
|
+
const localVarHeaderParameter = {};
|
449
|
+
const localVarQueryParameter = {};
|
450
|
+
localVarHeaderParameter["Content-Type"] = "application/json";
|
451
|
+
localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
|
452
|
+
delete localVarUrlObj.search;
|
453
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
454
|
+
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
|
455
|
+
const needsSerialization = typeof feedbackPutData !== "string" || localVarRequestOptions.headers["Content-Type"] === "application/json";
|
456
|
+
localVarRequestOptions.data = needsSerialization ? JSON.stringify(feedbackPutData !== void 0 ? feedbackPutData : {}) : feedbackPutData || "";
|
457
|
+
return {
|
458
|
+
url: globalImportUrl.format(localVarUrlObj),
|
459
|
+
options: localVarRequestOptions
|
460
|
+
};
|
461
|
+
}),
|
462
|
+
sitePost: (postAccount, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
463
|
+
if (postAccount === null || postAccount === void 0) {
|
464
|
+
throw new base_1.RequiredError("postAccount", "Required parameter postAccount was null or undefined when calling sitePost.");
|
465
|
+
}
|
466
|
+
const localVarPath = `/account/site`;
|
467
|
+
const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
|
468
|
+
let baseOptions;
|
469
|
+
if (configuration) {
|
470
|
+
baseOptions = configuration.baseOptions;
|
471
|
+
}
|
472
|
+
const localVarRequestOptions = Object.assign(Object.assign({ method: "POST" }, baseOptions), options);
|
473
|
+
const localVarHeaderParameter = {};
|
474
|
+
const localVarQueryParameter = {};
|
475
|
+
if (configuration && configuration.apiKey) {
|
476
|
+
const localVarApiKeyValue = typeof configuration.apiKey === "function" ? yield configuration.apiKey("authorization") : yield configuration.apiKey;
|
477
|
+
localVarHeaderParameter["authorization"] = localVarApiKeyValue;
|
478
|
+
}
|
479
|
+
localVarHeaderParameter["Content-Type"] = "application/json";
|
480
|
+
localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
|
481
|
+
delete localVarUrlObj.search;
|
482
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
483
|
+
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
|
484
|
+
const needsSerialization = typeof postAccount !== "string" || localVarRequestOptions.headers["Content-Type"] === "application/json";
|
485
|
+
localVarRequestOptions.data = needsSerialization ? JSON.stringify(postAccount !== void 0 ? postAccount : {}) : postAccount || "";
|
486
|
+
return {
|
487
|
+
url: globalImportUrl.format(localVarUrlObj),
|
488
|
+
options: localVarRequestOptions
|
489
|
+
};
|
490
|
+
})
|
491
|
+
};
|
492
|
+
};
|
493
|
+
exports.DefaultApiAxiosParamCreator = DefaultApiAxiosParamCreator;
|
494
|
+
var DefaultApiFp = function(configuration) {
|
495
|
+
return {
|
496
|
+
accountGet(options) {
|
497
|
+
return __awaiter(this, void 0, void 0, function* () {
|
498
|
+
const localVarAxiosArgs = yield (0, exports.DefaultApiAxiosParamCreator)(configuration).accountGet(options);
|
499
|
+
return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
|
500
|
+
const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
|
501
|
+
return axios.request(axiosRequestArgs);
|
502
|
+
};
|
503
|
+
});
|
504
|
+
},
|
505
|
+
archiveError(id, options) {
|
506
|
+
return __awaiter(this, void 0, void 0, function* () {
|
507
|
+
const localVarAxiosArgs = yield (0, exports.DefaultApiAxiosParamCreator)(configuration).archiveError(id, options);
|
508
|
+
return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
|
509
|
+
const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
|
510
|
+
return axios.request(axiosRequestArgs);
|
511
|
+
};
|
512
|
+
});
|
513
|
+
},
|
514
|
+
archiveErrors(archiveErrors, options) {
|
515
|
+
return __awaiter(this, void 0, void 0, function* () {
|
516
|
+
const localVarAxiosArgs = yield (0, exports.DefaultApiAxiosParamCreator)(configuration).archiveErrors(archiveErrors, options);
|
517
|
+
return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
|
518
|
+
const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
|
519
|
+
return axios.request(axiosRequestArgs);
|
520
|
+
};
|
521
|
+
});
|
522
|
+
},
|
523
|
+
bingIntegrationPost(bingIntegration, options) {
|
524
|
+
return __awaiter(this, void 0, void 0, function* () {
|
525
|
+
const localVarAxiosArgs = yield (0, exports.DefaultApiAxiosParamCreator)(configuration).bingIntegrationPost(bingIntegration, options);
|
526
|
+
return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
|
527
|
+
const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
|
528
|
+
return axios.request(axiosRequestArgs);
|
529
|
+
};
|
530
|
+
});
|
531
|
+
},
|
532
|
+
getTrackingAllSites(minDate, maxDate, options) {
|
533
|
+
return __awaiter(this, void 0, void 0, function* () {
|
534
|
+
const localVarAxiosArgs = yield (0, exports.DefaultApiAxiosParamCreator)(configuration).getTrackingAllSites(minDate, maxDate, options);
|
535
|
+
return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
|
536
|
+
const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
|
537
|
+
return axios.request(axiosRequestArgs);
|
538
|
+
};
|
539
|
+
});
|
540
|
+
},
|
541
|
+
getTrackingSite(id, minDate, maxDate, options) {
|
542
|
+
return __awaiter(this, void 0, void 0, function* () {
|
543
|
+
const localVarAxiosArgs = yield (0, exports.DefaultApiAxiosParamCreator)(configuration).getTrackingSite(id, minDate, maxDate, options);
|
544
|
+
return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
|
545
|
+
const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
|
546
|
+
return axios.request(axiosRequestArgs);
|
547
|
+
};
|
548
|
+
});
|
549
|
+
},
|
550
|
+
googleIntegrationPost(googleIntegration, options) {
|
551
|
+
return __awaiter(this, void 0, void 0, function* () {
|
552
|
+
const localVarAxiosArgs = yield (0, exports.DefaultApiAxiosParamCreator)(configuration).googleIntegrationPost(googleIntegration, options);
|
553
|
+
return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
|
554
|
+
const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
|
555
|
+
return axios.request(axiosRequestArgs);
|
556
|
+
};
|
557
|
+
});
|
558
|
+
},
|
559
|
+
postError(postError, options) {
|
560
|
+
return __awaiter(this, void 0, void 0, function* () {
|
561
|
+
const localVarAxiosArgs = yield (0, exports.DefaultApiAxiosParamCreator)(configuration).postError(postError, options);
|
562
|
+
return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
|
563
|
+
const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
|
564
|
+
return axios.request(axiosRequestArgs);
|
565
|
+
};
|
566
|
+
});
|
567
|
+
},
|
568
|
+
postPageTrack(postSiteTrack, options) {
|
569
|
+
return __awaiter(this, void 0, void 0, function* () {
|
570
|
+
const localVarAxiosArgs = yield (0, exports.DefaultApiAxiosParamCreator)(configuration).postPageTrack(postSiteTrack, options);
|
571
|
+
return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
|
572
|
+
const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
|
573
|
+
return axios.request(axiosRequestArgs);
|
574
|
+
};
|
575
|
+
});
|
576
|
+
},
|
577
|
+
putFeedback(feedbackPutData, options) {
|
578
|
+
return __awaiter(this, void 0, void 0, function* () {
|
579
|
+
const localVarAxiosArgs = yield (0, exports.DefaultApiAxiosParamCreator)(configuration).putFeedback(feedbackPutData, options);
|
580
|
+
return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
|
581
|
+
const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
|
582
|
+
return axios.request(axiosRequestArgs);
|
583
|
+
};
|
584
|
+
});
|
585
|
+
},
|
586
|
+
sitePost(postAccount, options) {
|
587
|
+
return __awaiter(this, void 0, void 0, function* () {
|
588
|
+
const localVarAxiosArgs = yield (0, exports.DefaultApiAxiosParamCreator)(configuration).sitePost(postAccount, options);
|
589
|
+
return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
|
590
|
+
const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
|
591
|
+
return axios.request(axiosRequestArgs);
|
592
|
+
};
|
593
|
+
});
|
594
|
+
}
|
595
|
+
};
|
596
|
+
};
|
597
|
+
exports.DefaultApiFp = DefaultApiFp;
|
598
|
+
var DefaultApiFactory = function(configuration, basePath, axios) {
|
599
|
+
return {
|
600
|
+
accountGet(options) {
|
601
|
+
return (0, exports.DefaultApiFp)(configuration).accountGet(options).then((request) => request(axios, basePath));
|
602
|
+
},
|
603
|
+
archiveError(id, options) {
|
604
|
+
return (0, exports.DefaultApiFp)(configuration).archiveError(id, options).then((request) => request(axios, basePath));
|
605
|
+
},
|
606
|
+
archiveErrors(archiveErrors, options) {
|
607
|
+
return (0, exports.DefaultApiFp)(configuration).archiveErrors(archiveErrors, options).then((request) => request(axios, basePath));
|
608
|
+
},
|
609
|
+
bingIntegrationPost(bingIntegration, options) {
|
610
|
+
return (0, exports.DefaultApiFp)(configuration).bingIntegrationPost(bingIntegration, options).then((request) => request(axios, basePath));
|
611
|
+
},
|
612
|
+
getTrackingAllSites(minDate, maxDate, options) {
|
613
|
+
return (0, exports.DefaultApiFp)(configuration).getTrackingAllSites(minDate, maxDate, options).then((request) => request(axios, basePath));
|
614
|
+
},
|
615
|
+
getTrackingSite(id, minDate, maxDate, options) {
|
616
|
+
return (0, exports.DefaultApiFp)(configuration).getTrackingSite(id, minDate, maxDate, options).then((request) => request(axios, basePath));
|
617
|
+
},
|
618
|
+
googleIntegrationPost(googleIntegration, options) {
|
619
|
+
return (0, exports.DefaultApiFp)(configuration).googleIntegrationPost(googleIntegration, options).then((request) => request(axios, basePath));
|
620
|
+
},
|
621
|
+
postError(postError, options) {
|
622
|
+
return (0, exports.DefaultApiFp)(configuration).postError(postError, options).then((request) => request(axios, basePath));
|
623
|
+
},
|
624
|
+
postPageTrack(postSiteTrack, options) {
|
625
|
+
return (0, exports.DefaultApiFp)(configuration).postPageTrack(postSiteTrack, options).then((request) => request(axios, basePath));
|
626
|
+
},
|
627
|
+
putFeedback(feedbackPutData, options) {
|
628
|
+
return (0, exports.DefaultApiFp)(configuration).putFeedback(feedbackPutData, options).then((request) => request(axios, basePath));
|
629
|
+
},
|
630
|
+
sitePost(postAccount, options) {
|
631
|
+
return (0, exports.DefaultApiFp)(configuration).sitePost(postAccount, options).then((request) => request(axios, basePath));
|
632
|
+
}
|
633
|
+
};
|
634
|
+
};
|
635
|
+
exports.DefaultApiFactory = DefaultApiFactory;
|
636
|
+
var DefaultApi4 = class extends base_1.BaseAPI {
|
637
|
+
accountGet(options) {
|
638
|
+
return (0, exports.DefaultApiFp)(this.configuration).accountGet(options).then((request) => request(this.axios, this.basePath));
|
639
|
+
}
|
640
|
+
archiveError(id, options) {
|
641
|
+
return (0, exports.DefaultApiFp)(this.configuration).archiveError(id, options).then((request) => request(this.axios, this.basePath));
|
642
|
+
}
|
643
|
+
archiveErrors(archiveErrors, options) {
|
644
|
+
return (0, exports.DefaultApiFp)(this.configuration).archiveErrors(archiveErrors, options).then((request) => request(this.axios, this.basePath));
|
645
|
+
}
|
646
|
+
bingIntegrationPost(bingIntegration, options) {
|
647
|
+
return (0, exports.DefaultApiFp)(this.configuration).bingIntegrationPost(bingIntegration, options).then((request) => request(this.axios, this.basePath));
|
648
|
+
}
|
649
|
+
getTrackingAllSites(minDate, maxDate, options) {
|
650
|
+
return (0, exports.DefaultApiFp)(this.configuration).getTrackingAllSites(minDate, maxDate, options).then((request) => request(this.axios, this.basePath));
|
651
|
+
}
|
652
|
+
getTrackingSite(id, minDate, maxDate, options) {
|
653
|
+
return (0, exports.DefaultApiFp)(this.configuration).getTrackingSite(id, minDate, maxDate, options).then((request) => request(this.axios, this.basePath));
|
654
|
+
}
|
655
|
+
googleIntegrationPost(googleIntegration, options) {
|
656
|
+
return (0, exports.DefaultApiFp)(this.configuration).googleIntegrationPost(googleIntegration, options).then((request) => request(this.axios, this.basePath));
|
657
|
+
}
|
658
|
+
postError(postError, options) {
|
659
|
+
return (0, exports.DefaultApiFp)(this.configuration).postError(postError, options).then((request) => request(this.axios, this.basePath));
|
660
|
+
}
|
661
|
+
postPageTrack(postSiteTrack, options) {
|
662
|
+
return (0, exports.DefaultApiFp)(this.configuration).postPageTrack(postSiteTrack, options).then((request) => request(this.axios, this.basePath));
|
663
|
+
}
|
664
|
+
putFeedback(feedbackPutData, options) {
|
665
|
+
return (0, exports.DefaultApiFp)(this.configuration).putFeedback(feedbackPutData, options).then((request) => request(this.axios, this.basePath));
|
666
|
+
}
|
667
|
+
sitePost(postAccount, options) {
|
668
|
+
return (0, exports.DefaultApiFp)(this.configuration).sitePost(postAccount, options).then((request) => request(this.axios, this.basePath));
|
669
|
+
}
|
670
|
+
};
|
671
|
+
exports.DefaultApi = DefaultApi4;
|
672
|
+
}
|
673
|
+
});
|
674
|
+
|
675
|
+
// ../common-ui/dist/components/ErrorBoundary/index.js
|
676
|
+
var require_ErrorBoundary = __commonJS({
|
677
|
+
"../common-ui/dist/components/ErrorBoundary/index.js"(exports) {
|
678
|
+
var __importDefault = exports && exports.__importDefault || function(mod) {
|
679
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
680
|
+
};
|
681
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
682
|
+
exports.ErrorBoundary = void 0;
|
683
|
+
var Modal_1 = require("ag-common/dist/ui/components/Modal");
|
684
|
+
var react_1 = __importDefault(require("react"));
|
685
|
+
var styled_components_1 = __importDefault(require("styled-components"));
|
686
|
+
var Base = styled_components_1.default.div`
|
2
687
|
font-size: 2rem;
|
3
|
-
`,ke=class extends ae.default.Component{constructor(t){super(t),this.state={hasError:void 0}}static getDerivedStateFromError(t){var r;let n=typeof window<"u"&&((r=window?.location)===null||r===void 0?void 0:r.href);return{hasError:Object.assign(Object.assign(Object.assign(Object.assign({},t),{message:t?.message||t}),t?.stack&&{stack:t?.stack}),n&&{href:n})}}render(){let{hasError:t}=this.state,{children:r,notify:n}=this.props;return t?(n&&n(t),ae.default.createElement(ur.Modal,{open:!0,setOpen:()=>{}},ae.default.createElement(lr,null,"A fatal error has occurred - the admin has been notified.",ae.default.createElement("button",{type:"button",onClick:()=>window.location.reload()},"Press here to restart app")))):r}};J.ErrorBoundary=ke});var rt=v(se=>{"use strict";se.__esModule=!0;se.createRequires=void 0;var hr=function(e){return typeof e=="function"?e():e||{}},mr=function(e){var t=!1;return function(r){if(t||(e=hr(e),t=!0),!(r in e))throw new Error("Could not require '"+r+"'. '"+r+"' does not exist in dependencies.");return e[r]}};se.createRequires=mr});var nt=v(_e=>{"use strict";_e.__esModule=!0;var gr=function(e){var t={};return function(r){return r in t||(t[r]=e(r)),t[r]}};_e.default=gr});var Pe=v(M=>{"use strict";M.__esModule=!0;M.InternalServerError=M.OK=void 0;M.OK=200;M.InternalServerError=500});var st=v(Y=>{"use strict";var it=Y&&Y.__spreadArray||function(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))};Y.__esModule=!0;var ot=require("http"),at=require("https"),yr=Pe(),br=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return typeof e!="string"?{on:function(n,o){o(new Error("URL must be a string."))}}:e.indexOf("https://")===0?at.get.apply(at,it([e],t,!1)):ot.get.apply(ot,it([e],t,!1))},wr=function(e){return new Promise(function(t,r){br(e,function(n){if(n.statusCode!==yr.OK)return r(new Error("HTTP Error Response: "+n.statusCode+" "+n.statusMessage+" ("+e+")"));var o=null;n.on("data",function(i){if(o===null){o=i;return}o+=i}),n.on("end",function(){return t(o)})}).on("error",r)})};Y.default=wr});var ct=v(I=>{"use strict";I.__esModule=!0;I.DONE=I.OPENED=I.UNSENT=void 0;I.UNSENT=0;I.OPENED=1;I.DONE=4});var ut=v(Te=>{"use strict";Te.__esModule=!0;var Ar=Pe(),Or=ct(),vr=function(e){return new Promise(function(t,r){var n=new XMLHttpRequest;n.onreadystatechange=function(){n.readyState===Or.DONE&&(n.status===Ar.OK?t(n.responseText):r(new Error("HTTP Error Response: "+n.status+" "+n.statusText+" ("+e+")")))},n.open("GET",e,!0),n.send()})};Te.default=vr});var dt=v(ce=>{"use strict";ce.__esModule=!0;ce.createLoadRemoteModule=void 0;var jr=nt(),kr=st(),_r=ut(),Pr=typeof window<"u"&&typeof window.document<"u",Tr=Pr?_r.default:kr.default,Er=function(e){throw new Error("Could not require '"+e+"'. The 'requires' function was not provided.")},xr=function(e){var t=e===void 0?{}:e,r=t.requires,n=t.fetcher,o=r||Er,i=n||Tr;return(0,jr.default)(function(a){return i(a).then(function(s){var c={},u={exports:c},l=new Function("require","module","exports",s);return l(o,u,c),u.exports})})};ce.createLoadRemoteModule=xr});var lt=v(ue=>{"use strict";ue.__esModule=!0;ue.createRequires=void 0;var Cr=function(e){return function(t){var r=e||{};if(!(t in r))throw new Error("Could not require '"+t+"'. '"+t+"' does not exist in dependencies.");return r[t]}};ue.createRequires=Cr});var pt=v(F=>{"use strict";var ft=F&&F.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]});F.__esModule=!0;F.createRequires=F.default=void 0;var qr=dt();ft(F,qr,"createLoadRemoteModule","default");var Sr=lt();ft(F,Sr,"createRequires")});var mt=v(L=>{"use strict";var Dr=L&&L.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};L.__esModule=!0;L.createUseRemoteComponent=void 0;var ht=require("react"),Rr=Dr(pt()),Ir=function(e){var t=Rr.default(e),r=function(n){var o=ht.useState({loading:!0,err:void 0,component:void 0}),i=o[0],a=i.loading,s=i.err,c=i.component,u=o[1];return ht.useEffect(function(){var l=u;return l({loading:!0,err:void 0,component:void 0}),t(n).then(function(p){return l({loading:!1,err:void 0,component:p.default})}).catch(function(p){return l({loading:!1,err:p,component:void 0})}),function(){l=function(){}}},[n]),[a,s,c]};return r};L.createUseRemoteComponent=Ir});var he=v(k=>{Object.defineProperty(k,"__esModule",{value:!0});k.stringify=k.extractQs=k.getClientY=k.getChildrenPositions=k.getChildrenArray=void 0;var Ot=require("ag-common/dist/common/helpers/log"),Ur=require("querystring"),Br=e=>{var t;let r=((t=e.current)===null||t===void 0?void 0:t.children)||[],n=[];for(let o=0;o<r.length;o+=1)n.push(r[o]);return n};k.getChildrenArray=Br;var Kr=e=>(0,k.getChildrenArray)(e).map(t=>t.getBoundingClientRect().top+t.getBoundingClientRect().height);k.getChildrenPositions=Kr;var Nr=e=>{var t,r,n,o;if(!e)return;let i;if(e?.changedTouches||e?.touches){let a=e;i=((r=(t=a.changedTouches)===null||t===void 0?void 0:t[0])===null||r===void 0?void 0:r.clientY)||((o=(n=a.touches)===null||n===void 0?void 0:n[0])===null||o===void 0?void 0:o.clientY)}else e?.clientY&&(i=e.clientY);return i};k.getClientY=Nr;var vt=e=>e.replace(/[^a-zA-Z0-9\-_]/gim,"");function Jr({search:e,sanatise:t}){if(!e)return{};let r=(0,Ur.parse)(e.replace(/^[?]/,"")),n={};return Object.keys(r).forEach(o=>{let i=t?vt(o):o;o!==i&&(0,Ot.debug)("sanatising qs input key for ",i),Array.isArray(r[i])?n[i]=r[i].join(""):n[i]=r[i];let a=t?vt(n[i]):n[i];a!==n[i]&&((0,Ot.debug)("sanatising qs input for ",i),n[i]=a)}),n}k.extractQs=Jr;var Mr=e=>{let t=new URLSearchParams;return Object.entries(e).forEach(([r,n])=>t.append(r,n)),t};k.stringify=Mr});var Hr={};Mt(Hr,{AnalyticaConfigContext:()=>x,AnalyticaConfigProvider:()=>ir,CognitoAuthContext:()=>xt,CognitoAuthProvider:()=>Lr,DashboardAuthValidation:()=>Dt,ErrorBoundary:()=>pr,ExternalComponent:()=>Ee,Feedback:()=>Vr,decodeIdToken:()=>ie,errorTrack:()=>U,feedback:()=>ne,getUserFromIdToken:()=>N,page:()=>Xe,tokenMissing:()=>q,track:()=>je,useFeedback:()=>ar,useTrack:()=>cr});module.exports=Lt(Hr);var ve=require("ag-common/dist/common/helpers/log"),Ne=require("ag-common/dist/ui/helpers/callOpenApi"),Je=O(re());function tr(e){return(0,Ne.callOpenApi)(y(h({},e),{func:t=>e.func(t),newDefaultApi:t=>new Je.DefaultApi(t),logout:()=>window.location.reload(),refreshToken:()=>b(this,null,function*(){})}))}var U=r=>b(void 0,[r],function*({data:e,overrideBaseUrl:t="https://api.analytica.click"}){var o;if(typeof window!="undefined"&&((o=window==null?void 0:window.location)==null?void 0:o.hostname)==="localhost")return(0,ve.debug)(`local error tracking ignored:${e.data.message} ${JSON.stringify(e)}, to ${t}`),{};(0,ve.debug)("error track",e.data.message,JSON.stringify(e));let n=yield tr({apiUrl:t,func:i=>i.postError(e)});return n.error?{error:n.error.message}:{}});var D=O(require("react")),rr={analyticaToken:void 0,overrideBaseUrl:void 0},x=D.default.createContext(rr);function nr(e){if(!e.analyticaToken)return;let t=window.console.error;window.console.error=(...n)=>U({data:{data:{href:window.location.href,message:JSON.stringify(n)},key:e.analyticaToken},overrideBaseUrl:e.overrideBaseUrl}).finally(()=>t(...n));let r=window.console.warn;window.console.warn=(...n)=>U({data:{data:{href:window.location.href,message:JSON.stringify(n)},key:e.analyticaToken},overrideBaseUrl:e.overrideBaseUrl}).finally(()=>r(...n))}var ir=({children:e,values:t})=>{let[r,n]=(0,D.useState)(t);return(0,D.useEffect)(()=>{JSON.stringify(t)!==JSON.stringify(r)&&n(t)},[r,t]),(0,D.useEffect)(()=>{nr(t)},[]),D.default.createElement(x.Provider,{value:r},e)};var q=e=>`[Analytica.${e}] Please load analytica token in AnalyticaConfigProvider to use this component`;var X=require("ag-common/dist/common/helpers/log"),Me=require("react"),Le=require("ag-common/dist/ui/helpers/callOpenApi"),He=O(re());function or(e){return(0,Le.callOpenApi)(y(h({},e),{func:t=>e.func(t),newDefaultApi:t=>new He.DefaultApi(t),logout:()=>window.location.reload(),refreshToken:()=>b(this,null,function*(){})}))}var ne=n=>b(void 0,[n],function*({data:e,analyticaToken:t,overrideBaseUrl:r="https://api.analytica.click"}){var i;if(typeof window!="undefined"&&((i=window==null?void 0:window.location)==null?void 0:i.hostname)==="localhost")return(0,X.debug)(`local feedback ignored:${JSON.stringify(e)}, to ${r}`),{};(0,X.debug)("feedback",JSON.stringify(e));let o=yield or({apiUrl:r,func:a=>a.putFeedback({key:t,data:e})});return o.error?{error:o.error.message}:{}}),ar=()=>{let{analyticaToken:e,overrideBaseUrl:t}=(0,Me.useContext)(x);return e?{trackWithToken:r=>ne(y(h({},r),{analyticaToken:e,overrideBaseUrl:t}))}:((0,X.warn)(q("useFeedback")),{trackWithToken:()=>({error:"no token"})})};var ze=e=>{var t,r;try{return(r=(t=JSON.parse(e))==null?void 0:t.data)==null?void 0:r.url}catch(n){return e}};var $e=require("jsonwebtoken"),ie=e=>(0,$e.decode)(e),N=e=>{var n;let t=ie(e);if(!t)throw new Error("bad token");return{userId:t.email,fullname:t.name,nickname:t.nickname,picture:ze(t.picture),updatedAt:new Date().getTime(),idJwt:t,isAdmin:(n=t==null?void 0:t["cognito:groups"])==null?void 0:n.includes("Admin")}};var oe=require("ag-common/dist/common/helpers/log"),Ge=require("react"),We=O(re()),Qe=require("ag-common/dist/ui/helpers/callOpenApi");function sr(e){return(0,Qe.callOpenApi)(y(h({},e),{func:t=>e.func(t),newDefaultApi:t=>new We.DefaultApi(t),logout:()=>window.location.reload(),refreshToken:()=>b(this,null,function*(){})}))}var je=o=>b(void 0,[o],function*({analyticaToken:e,userData:t,overrideBaseUrl:r="https://api.analytica.click",eventName:n}){var s,c,u;let i={eventName:n};if(typeof window!="undefined"&&(i=y(h({},i),{pageLocation:window.location.href,browserResolution:`${(s=window==null?void 0:window.screen)==null?void 0:s.width}:${(c=window==null?void 0:window.screen)==null?void 0:c.height}`})),typeof document!="undefined"&&(i=y(h({},i),{pageReferrer:document.referrer,pageTitle:document.title})),typeof navigator!="undefined"&&(i=y(h({},i),{browserLanguage:navigator.language})),typeof window!="undefined"&&((u=window==null?void 0:window.location)==null?void 0:u.hostname)==="localhost")return(0,oe.debug)(`local page ignored: ${JSON.stringify(i)}, to ${r}`),{};let a=yield sr({apiUrl:r,func:l=>l.postPageTrack({key:e,data:i,userData:t})});return a.error?{error:a.error.message}:{}}),Xe=n=>b(void 0,[n],function*({analyticaToken:e,userData:t,overrideBaseUrl:r="https://api.analytica.click"}){return je({analyticaToken:e,userData:t,overrideBaseUrl:r,eventName:"PAGE"})}),cr=()=>{let{analyticaToken:e,overrideBaseUrl:t}=(0,Ge.useContext)(x);if(!e){(0,oe.warn)(q("useTrack"));let r=()=>b(void 0,null,function*(){return{error:"no token"}});return{page:r,track:r}}return{page:r=>Xe(y(h({},r),{analyticaToken:e,overrideBaseUrl:t})),track:r=>je(y(h({},r),{analyticaToken:e,overrideBaseUrl:t}))}};var et=O(Ze()),R=O(require("react")),tt=require("ag-common/dist/common/helpers/log");function fr(n){return b(this,arguments,function*({ev:e,analyticaToken:t,filterBrowserError:r}){if(r&&r(e)===!1)return;let o=(e==null?void 0:e.message)||(e==null?void 0:e.error),{href:i}=window.location,a=e==null?void 0:e.stack,s=e==null?void 0:e.filename;yield U({data:{key:t,data:{message:o,stack:a,filename:s,href:i}}})})}var pr=({children:e,filterBrowserError:t})=>{let{analyticaToken:r}=(0,R.useContext)(x);return(0,R.useEffect)(()=>{if(!r)return()=>{};let n=o=>fr({ev:o,analyticaToken:r,filterBrowserError:t});return window.addEventListener("error",n),()=>{window.removeEventListener("error",n)}},[r,t]),r?R.default.createElement(et.ErrorBoundary,{notify:n=>b(void 0,null,function*(){let{href:o}=window.location;yield U({data:{key:r,data:y(h({},n),{href:o})}})})},e):((0,tt.warn)(q("ErrorBoundary")),R.default.createElement(R.default.Fragment,null,e))};var Z=O(require("react")),gt=O(rt()),yt=O(mt()),bt=O(require("react-dom")),Fr=require("styled-components"),de={},Ee=({url:e,props:t})=>{let r=(0,gt.createRequires)(()=>({react:Z.default,"react-dom":bt.default,"styled-components":Fr})),n,o=!1,i;return de[e]?n=de[e]:[o,i,n]=(0,yt.createUseRemoteComponent)({requires:r})(e),!de[e]&&!o&&!i&&n&&(de[e]=n),Z.default.createElement(Z.default.Fragment,null,!o&&!i&&Z.default.createElement(n,h({},t)),i&&i)};var H=O(require("react")),wt=require("ag-common/dist/common/helpers/log"),Vr=e=>{let{analyticaToken:t,overrideBaseUrl:r,devMode:n}=(0,H.useContext)(x);if(!t)return(0,wt.warn)(q("Feedback")),H.default.createElement(H.default.Fragment,null);let o=y(h({},e),{submitFeedback:ne,analyticaToken:t,overrideBaseUrl:r}),i="https://cdn.analytica.click/feedback.js";return n&&(i="/feedback.js"),H.default.createElement(Ee,{url:i,props:o})};var At=O(require("aws-sdk/clients/cognitoidentity"));function le(r){return b(this,arguments,function*({user:e,config:t}){var p,_,f;if(!((p=e==null?void 0:e.jwt)!=null&&p.id_token)||!e.idJwt||!t.identityPool)return;let n=(_=e==null?void 0:e.jwt)==null?void 0:_.id_token,o={[e.idJwt.iss.replace("https://","")]:n},i=new At.default({region:t.AWSRegion}),a=yield i.getId({IdentityPoolId:t.identityPool,Logins:o}).promise();if(!(a!=null&&a.IdentityId))return;let c={CustomRoleArn:(f=e.idJwt)==null?void 0:f["cognito:preferred_role"],IdentityId:a.IdentityId,Logins:o},{Credentials:u}=yield i.getCredentialsForIdentity(c).promise();return!(u!=null&&u.AccessKeyId)||!u.SecretKey||!u.SessionToken||!u.Expiration?void 0:{accessKeyId:u.AccessKeyId,sessionToken:u.SessionToken,secretAccessKey:u.SecretKey}})}var fe=e=>!(e!=null&&e.expires_at)||new Date().getTime()>e.expires_at,pe=({expires_in:e})=>new Date().getTime()+parseInt(`${e}000`,10);var jt=require("ag-common/dist/ui/helpers/axiosHelper"),me=require("ag-common/dist/common/helpers/log"),kt=O(he());function xe(i){return b(this,arguments,function*({user:e,setUser:t,setError:r,config:n,logout:o}){var a,s;try{if(((a=e==null?void 0:e.jwt)==null?void 0:a.id_token)&&!fe(e==null?void 0:e.jwt))return e;let c=(s=e==null?void 0:e.jwt)==null?void 0:s.refresh_token;if(!c||!e){(0,me.warn)("no refresh token, wipe"),o();return}let u=yield(0,jt.axiosHelper)({url:n.cognitoRefresh,verb:"post",body:(0,kt.stringify)({grant_type:"refresh_token",client_id:n.ClientId,refresh_token:c}),headers:{"Content-Type":"application/x-www-form-urlencoded"}}),l=y(h({},e),{jwt:y(h({},u.data),{refresh_token:c,expires_at:pe({expires_in:u.data.expires_in})})});return l.credentials=yield le({user:l,config:n}),t(l),l}catch(c){let u=c.toString();if(u.includes(400)||u.includes(401)||u.includes(403)){(0,me.debug)("old refresh token, wipe"),t(void 0),r(void 0);return}r(c)}})}var _t=require("ag-common/dist/ui/helpers/axiosHelper"),Pt=O(he());function Tt(o){return b(this,arguments,function*({code:e,setUser:t,redirectUrl:r,config:n}){try{let i=yield(0,_t.axiosHelper)({verb:"post",url:n.cognitoRefresh,body:(0,Pt.stringify)({grant_type:"authorization_code",client_id:n.ClientId,code:e,redirect_uri:r}),headers:{"Content-Type":"application/x-www-form-urlencoded"}}),a=y(h({},N(i.data.id_token)),{jwt:y(h({},i.data),{expires_at:pe({expires_in:i.data.expires_in})})});return n.identityPool&&(a.credentials=yield le({user:a,config:n})),t(a),!0}catch(i){}return!1})}var B=require("ag-common/dist/common/helpers/log"),C=O(require("react")),z=require("ag-common/dist/ui/helpers/useLocalStorage"),ee=require("ag-common/dist/ui/helpers/cookie"),Et=O(he()),xt=C.default.createContext(void 0),Lr=({config:e,children:t,goToPageUrl:r,location:n,redirectUrl:o=n.origin,onMessage:i,cookieDocument:a})=>{var qe,Se;let[s,c]=(0,C.useState)(),[u,l]=(0,ee.useCookieString)({name:"id_token",cookieDocument:typeof window=="undefined"?a:void 0,defaultValue:""}),p=u;p&&!ie(p)&&((0,B.warn)("bad token, logging out"),(0,ee.wipeCookies)("id_token"),r({url:n.origin,login:!1}),p="");let _;p&&!(0,z.getLocalStorageItem)("user",void 0)&&(_=N(p));let[f,V]=(0,z.UseLocalStorage)("user",_),[te,$]=(0,C.useState)(!1),g=(0,Et.extractQs)({search:typeof window=="undefined"?"":window.location.search,sanatise:!1}),ge=()=>b(void 0,null,function*(){(0,ee.wipeCookies)("id_token"),(0,z.clearLocalStorageItem)("user"),l(""),V(void 0),c(void 0),$(!0),yield r({url:n.origin,login:!1}),$(!1)}),Ce=ge;(0,C.useEffect)(()=>{var S;let E=(S=f==null?void 0:f.jwt)==null?void 0:S.id_token;E!==p&&l(E||"")},[p,l,f,(qe=f==null?void 0:f.jwt)==null?void 0:qe.id_token]);let Rt=E=>b(void 0,null,function*(){var G;if(s||te||n.hash&&Object.keys(n.hash).length>0||n.search&&((G=Object.keys(n.search))==null?void 0:G.length)>0)return;$(!0);let S={back:n.pathname},K=e.vendToken+o;E&&(K+=`&state=${E}`),yield r({url:K,state:S,login:!0})});(0,C.useEffect)(()=>{function E(){return b(this,null,function*(){var De,Re,Ie;let S=!!(g!=null&&g.code)||!!(g!=null&&g.error),K=fe(f==null?void 0:f.jwt),G=!(f!=null&&f.userId)&&!!(f!=null&&f.jwt);if(!(!S&&!K&&!G))try{if($(!0),S&&!K)yield r({url:o,login:!0});else if(S){if(g!=null&&g.error){let be={message:(g==null?void 0:g.error_description)||"auth error"};JSON.stringify(be||{})!==JSON.stringify(s||{})&&c(be)}else g!=null&&g.code&&(yield Tt({code:g.code,redirectUrl:o,config:e,setUser:V}));let W=""||o||"/";if(g!=null&&g.state)try{W.includes("?")?W+="&":W+="?",W+=`state=${g.state}`}catch(be){(0,B.warn)("bad state passed in")}yield r({url:W,login:!0})}else if(K&&((De=f==null?void 0:f.jwt)==null?void 0:De.refresh_token))yield xe({setUser:V,setError:c,user:f,config:e,logout:Ce});else if(G){let ye=(Ie=(Re=f==null?void 0:f.jwt)==null?void 0:Re.id_token)==null?void 0:Ie.substr(f.jwt.id_token.indexOf(" ")+1);!f||!ye?((0,B.info)("logging out no token"),V(void 0),c(void 0)):V(y(h({},N(ye)),{jwt:f.jwt,credentials:f.credentials}))}}finally{$(!1)}})}!te&&!s&&E()},[e,s,r,Ce,te,g,o,V,f]),(0,C.useEffect)(()=>{var E;s&&((0,B.error)(JSON.stringify(s)),i&&i(`error:${(E=s.response)==null?void 0:E.status}`,{appearance:"error"}))},[i,s]);let It={loading:!s&&(te||!!(g!=null&&g.code)),isAuthenticated:!s&&!!((Se=f==null?void 0:f.idJwt)!=null&&Se.email),refreshToken:()=>xe({setUser:V,setError:c,user:f,config:e,logout:ge}),loginWithRedirect:Rt,logout:ge,error:s,user:f};return C.default.createElement(xt.Provider,{value:It},t)};var Ct=require("ag-common/dist/common/helpers/log"),qt=require("ag-common/dist/common/helpers/string"),St=require("ag-common/dist/ui/components/Loader"),P=O(require("react")),Dt=({rc:{request:e,pushPath:t},cac:{error:r,loginWithRedirect:n,logout:o,isAuthenticated:i,loading:a},getDashboardPath:s,getUnauthedPage:c,addToast:u})=>{if((0,P.useEffect)(()=>{if(r){let _=r.message.includes("email")?` We require the use of your email for the functionality of this app.
|
4
|
-
|
688
|
+
`;
|
689
|
+
var ErrorBoundary2 = class extends react_1.default.Component {
|
690
|
+
constructor(props) {
|
691
|
+
super(props);
|
692
|
+
this.state = { hasError: void 0 };
|
693
|
+
}
|
694
|
+
static getDerivedStateFromError(errorV) {
|
695
|
+
var _a;
|
696
|
+
const href = typeof window !== "undefined" && ((_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.href);
|
697
|
+
return {
|
698
|
+
hasError: Object.assign(Object.assign(Object.assign(Object.assign({}, errorV), { message: (errorV === null || errorV === void 0 ? void 0 : errorV.message) || errorV }), (errorV === null || errorV === void 0 ? void 0 : errorV.stack) && { stack: errorV === null || errorV === void 0 ? void 0 : errorV.stack }), href && { href })
|
699
|
+
};
|
700
|
+
}
|
701
|
+
render() {
|
702
|
+
const { hasError } = this.state;
|
703
|
+
const { children, notify } = this.props;
|
704
|
+
if (hasError) {
|
705
|
+
if (notify) {
|
706
|
+
notify(hasError);
|
707
|
+
}
|
708
|
+
return react_1.default.createElement(Modal_1.Modal, { open: true, setOpen: () => {
|
709
|
+
} }, react_1.default.createElement(Base, null, "A fatal error has occurred - the admin has been notified.", react_1.default.createElement("button", { type: "button", onClick: () => window.location.reload() }, "Press here to restart app")));
|
710
|
+
}
|
711
|
+
return children;
|
712
|
+
}
|
713
|
+
};
|
714
|
+
exports.ErrorBoundary = ErrorBoundary2;
|
715
|
+
}
|
716
|
+
});
|
717
|
+
|
718
|
+
// ../common-ui/dist/helpers/dom.js
|
719
|
+
var require_dom = __commonJS({
|
720
|
+
"../common-ui/dist/helpers/dom.js"(exports) {
|
721
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
722
|
+
exports.stringify = exports.extractQs = exports.getClientY = exports.getChildrenPositions = exports.getChildrenArray = void 0;
|
723
|
+
var log_1 = require("ag-common/dist/common/helpers/log");
|
724
|
+
var querystring_1 = require("querystring");
|
725
|
+
var getChildrenArray = (ref) => {
|
726
|
+
var _a;
|
727
|
+
const children = ((_a = ref.current) === null || _a === void 0 ? void 0 : _a.children) || [];
|
728
|
+
const ret = [];
|
729
|
+
for (let i = 0; i < children.length; i += 1) {
|
730
|
+
ret.push(children[i]);
|
731
|
+
}
|
732
|
+
return ret;
|
733
|
+
};
|
734
|
+
exports.getChildrenArray = getChildrenArray;
|
735
|
+
var getChildrenPositions = (ref) => (0, exports.getChildrenArray)(ref).map((c) => c.getBoundingClientRect().top + c.getBoundingClientRect().height);
|
736
|
+
exports.getChildrenPositions = getChildrenPositions;
|
737
|
+
var getClientY = (e) => {
|
738
|
+
var _a, _b, _c, _d;
|
739
|
+
if (!e) {
|
740
|
+
return void 0;
|
741
|
+
}
|
742
|
+
let ret;
|
743
|
+
if ((e === null || e === void 0 ? void 0 : e.changedTouches) || (e === null || e === void 0 ? void 0 : e.touches)) {
|
744
|
+
const et = e;
|
745
|
+
ret = ((_b = (_a = et.changedTouches) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.clientY) || ((_d = (_c = et.touches) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.clientY);
|
746
|
+
} else if (e === null || e === void 0 ? void 0 : e.clientY) {
|
747
|
+
const me = e;
|
748
|
+
ret = me.clientY;
|
749
|
+
}
|
750
|
+
return ret;
|
751
|
+
};
|
752
|
+
exports.getClientY = getClientY;
|
753
|
+
var sanatiseString = (str) => str.replace(/[^a-zA-Z0-9\-_]/gim, "");
|
754
|
+
function extractQs2({ search, sanatise }) {
|
755
|
+
if (!search) {
|
756
|
+
return {};
|
757
|
+
}
|
758
|
+
const qs = (0, querystring_1.parse)(search.replace(/^[?]/, ""));
|
759
|
+
const ret = {};
|
760
|
+
Object.keys(qs).forEach((qk1) => {
|
761
|
+
const qk = !sanatise ? qk1 : sanatiseString(qk1);
|
762
|
+
if (qk1 !== qk) {
|
763
|
+
(0, log_1.debug)("sanatising qs input key for ", qk);
|
764
|
+
}
|
765
|
+
if (Array.isArray(qs[qk])) {
|
766
|
+
ret[qk] = qs[qk].join("");
|
767
|
+
} else {
|
768
|
+
ret[qk] = qs[qk];
|
769
|
+
}
|
770
|
+
const newV = !sanatise ? ret[qk] : sanatiseString(ret[qk]);
|
771
|
+
if (newV !== ret[qk]) {
|
772
|
+
(0, log_1.debug)("sanatising qs input for ", qk);
|
773
|
+
ret[qk] = newV;
|
774
|
+
}
|
775
|
+
});
|
776
|
+
return ret;
|
777
|
+
}
|
778
|
+
exports.extractQs = extractQs2;
|
779
|
+
var stringify3 = (p) => {
|
780
|
+
const params = new URLSearchParams();
|
781
|
+
Object.entries(p).forEach(([a, b]) => params.append(a, b));
|
782
|
+
return params;
|
783
|
+
};
|
784
|
+
exports.stringify = stringify3;
|
785
|
+
}
|
786
|
+
});
|
787
|
+
|
788
|
+
// src/index.tsx
|
789
|
+
var src_exports = {};
|
790
|
+
__export(src_exports, {
|
791
|
+
AnalyticaConfigContext: () => AnalyticaConfigContext,
|
792
|
+
AnalyticaConfigProvider: () => AnalyticaConfigProvider,
|
793
|
+
CognitoAuthContext: () => CognitoAuthContext,
|
794
|
+
CognitoAuthProvider: () => CognitoAuthProvider,
|
795
|
+
DashboardAuthValidation: () => DashboardAuthValidation,
|
796
|
+
ErrorBoundary: () => ErrorBoundary,
|
797
|
+
ExternalComponent: () => ExternalComponent,
|
798
|
+
Feedback: () => Feedback,
|
799
|
+
decodeIdToken: () => decodeIdToken,
|
800
|
+
errorTrack: () => errorTrack,
|
801
|
+
feedback: () => feedback,
|
802
|
+
getUserFromIdToken: () => getUserFromIdToken,
|
803
|
+
page: () => page,
|
804
|
+
tokenMissing: () => tokenMissing,
|
805
|
+
track: () => track,
|
806
|
+
useFeedback: () => useFeedback,
|
807
|
+
useTrack: () => useTrack
|
808
|
+
});
|
809
|
+
module.exports = __toCommonJS(src_exports);
|
810
|
+
|
811
|
+
// src/helpers/errorTrack.tsx
|
812
|
+
var import_log = require("ag-common/dist/common/helpers/log");
|
813
|
+
var import_callOpenApi = require("ag-common/dist/ui/helpers/callOpenApi");
|
814
|
+
var import_api = __toESM(require_api());
|
815
|
+
function callOpenApi(p) {
|
816
|
+
return (0, import_callOpenApi.callOpenApi)(__spreadProps(__spreadValues({}, p), {
|
817
|
+
func: (d) => p.func(d),
|
818
|
+
newDefaultApi: (opts) => new import_api.DefaultApi(opts),
|
819
|
+
logout: () => window.location.reload(),
|
820
|
+
refreshToken: () => __async(this, null, function* () {
|
821
|
+
return void 0;
|
822
|
+
})
|
823
|
+
}));
|
824
|
+
}
|
825
|
+
var errorTrack = (_0) => __async(void 0, [_0], function* ({
|
826
|
+
data,
|
827
|
+
overrideBaseUrl = "https://api.analytica.click"
|
828
|
+
}) {
|
829
|
+
var _a;
|
830
|
+
if (typeof window !== "undefined" && ((_a = window == null ? void 0 : window.location) == null ? void 0 : _a.hostname) === "localhost") {
|
831
|
+
(0, import_log.debug)(`local error tracking ignored:${data.data.message} ${JSON.stringify(data)}, to ${overrideBaseUrl}`);
|
832
|
+
return {};
|
833
|
+
}
|
834
|
+
(0, import_log.debug)("error track", data.data.message, JSON.stringify(data));
|
835
|
+
const x = yield callOpenApi({
|
836
|
+
apiUrl: overrideBaseUrl,
|
837
|
+
func: (s) => s.postError(data)
|
838
|
+
});
|
839
|
+
if (x.error) {
|
840
|
+
return { error: x.error.message };
|
841
|
+
}
|
842
|
+
return {};
|
843
|
+
});
|
844
|
+
|
845
|
+
// src/components/AnalyticaConfig/index.tsx
|
846
|
+
var import_react = __toESM(require("react"));
|
847
|
+
var stubState = {
|
848
|
+
analyticaToken: void 0,
|
849
|
+
overrideBaseUrl: void 0
|
850
|
+
};
|
851
|
+
var AnalyticaConfigContext = import_react.default.createContext(stubState);
|
852
|
+
function overloadConsole(values) {
|
853
|
+
if (!values.analyticaToken) {
|
854
|
+
return;
|
855
|
+
}
|
856
|
+
const tempError = window.console.error;
|
857
|
+
window.console.error = (...obj) => errorTrack({
|
858
|
+
data: {
|
859
|
+
data: { href: window.location.href, message: JSON.stringify(obj) },
|
860
|
+
key: values.analyticaToken
|
861
|
+
},
|
862
|
+
overrideBaseUrl: values.overrideBaseUrl
|
863
|
+
}).finally(() => tempError(...obj));
|
864
|
+
const tempWarn = window.console.warn;
|
865
|
+
window.console.warn = (...obj) => errorTrack({
|
866
|
+
data: {
|
867
|
+
data: { href: window.location.href, message: JSON.stringify(obj) },
|
868
|
+
key: values.analyticaToken
|
869
|
+
},
|
870
|
+
overrideBaseUrl: values.overrideBaseUrl
|
871
|
+
}).finally(() => tempWarn(...obj));
|
872
|
+
}
|
873
|
+
var AnalyticaConfigProvider = ({
|
874
|
+
children,
|
875
|
+
values
|
876
|
+
}) => {
|
877
|
+
const [state, setState] = (0, import_react.useState)(values);
|
878
|
+
(0, import_react.useEffect)(() => {
|
879
|
+
if (JSON.stringify(values) !== JSON.stringify(state)) {
|
880
|
+
setState(values);
|
881
|
+
}
|
882
|
+
}, [state, values]);
|
883
|
+
(0, import_react.useEffect)(() => {
|
884
|
+
overloadConsole(values);
|
885
|
+
}, []);
|
886
|
+
return /* @__PURE__ */ import_react.default.createElement(AnalyticaConfigContext.Provider, {
|
887
|
+
value: state
|
888
|
+
}, children);
|
889
|
+
};
|
890
|
+
|
891
|
+
// src/helpers/log.ts
|
892
|
+
var tokenMissing = (comp) => `[Analytica.${comp}] Please load analytica token in AnalyticaConfigProvider to use this component`;
|
893
|
+
|
894
|
+
// src/helpers/feedback.tsx
|
895
|
+
var import_log3 = require("ag-common/dist/common/helpers/log");
|
896
|
+
var import_react2 = require("react");
|
897
|
+
var import_callOpenApi2 = require("ag-common/dist/ui/helpers/callOpenApi");
|
898
|
+
var import_api2 = __toESM(require_api());
|
899
|
+
function callOpenApi2(p) {
|
900
|
+
return (0, import_callOpenApi2.callOpenApi)(__spreadProps(__spreadValues({}, p), {
|
901
|
+
func: (d) => p.func(d),
|
902
|
+
newDefaultApi: (opts) => new import_api2.DefaultApi(opts),
|
903
|
+
logout: () => window.location.reload(),
|
904
|
+
refreshToken: () => __async(this, null, function* () {
|
905
|
+
return void 0;
|
906
|
+
})
|
907
|
+
}));
|
908
|
+
}
|
909
|
+
var feedback = (_0) => __async(void 0, [_0], function* ({
|
910
|
+
data,
|
911
|
+
analyticaToken,
|
912
|
+
overrideBaseUrl = "https://api.analytica.click"
|
913
|
+
}) {
|
914
|
+
var _a;
|
915
|
+
if (typeof window !== "undefined" && ((_a = window == null ? void 0 : window.location) == null ? void 0 : _a.hostname) === "localhost") {
|
916
|
+
(0, import_log3.debug)(`local feedback ignored:${JSON.stringify(data)}, to ${overrideBaseUrl}`);
|
917
|
+
return {};
|
918
|
+
}
|
919
|
+
(0, import_log3.debug)("feedback", JSON.stringify(data));
|
920
|
+
const x = yield callOpenApi2({
|
921
|
+
apiUrl: overrideBaseUrl,
|
922
|
+
func: (s) => s.putFeedback({ key: analyticaToken, data })
|
923
|
+
});
|
924
|
+
if (x.error) {
|
925
|
+
return { error: x.error.message };
|
926
|
+
}
|
927
|
+
return {};
|
928
|
+
});
|
929
|
+
var useFeedback = () => {
|
930
|
+
const { analyticaToken, overrideBaseUrl } = (0, import_react2.useContext)(AnalyticaConfigContext);
|
931
|
+
if (!analyticaToken) {
|
932
|
+
(0, import_log3.warn)(tokenMissing("useFeedback"));
|
933
|
+
return { trackWithToken: () => ({ error: "no token" }) };
|
934
|
+
}
|
935
|
+
return {
|
936
|
+
trackWithToken: (d) => feedback(__spreadProps(__spreadValues({}, d), { analyticaToken, overrideBaseUrl }))
|
937
|
+
};
|
938
|
+
};
|
939
|
+
|
940
|
+
// src/components/UserProvider/picture.ts
|
941
|
+
var parsePicture = (raw) => {
|
942
|
+
var _a, _b;
|
943
|
+
try {
|
944
|
+
return (_b = (_a = JSON.parse(raw)) == null ? void 0 : _a.data) == null ? void 0 : _b.url;
|
945
|
+
} catch (e) {
|
946
|
+
return raw;
|
947
|
+
}
|
948
|
+
};
|
949
|
+
|
950
|
+
// src/helpers/jwt.ts
|
951
|
+
var import_jsonwebtoken = require("jsonwebtoken");
|
952
|
+
var decodeIdToken = (s) => (0, import_jsonwebtoken.decode)(s);
|
953
|
+
var getUserFromIdToken = (idToken) => {
|
954
|
+
var _a;
|
955
|
+
const idJwt = decodeIdToken(idToken);
|
956
|
+
if (!idJwt) {
|
957
|
+
throw new Error("bad token");
|
958
|
+
}
|
959
|
+
const defUser = {
|
960
|
+
userId: idJwt.email,
|
961
|
+
fullname: idJwt.name,
|
962
|
+
nickname: idJwt.nickname,
|
963
|
+
picture: parsePicture(idJwt.picture),
|
964
|
+
updatedAt: new Date().getTime(),
|
965
|
+
idJwt,
|
966
|
+
isAdmin: (_a = idJwt == null ? void 0 : idJwt["cognito:groups"]) == null ? void 0 : _a.includes("Admin")
|
967
|
+
};
|
968
|
+
return defUser;
|
969
|
+
};
|
970
|
+
|
971
|
+
// src/helpers/track.ts
|
972
|
+
var import_log5 = require("ag-common/dist/common/helpers/log");
|
973
|
+
var import_react3 = require("react");
|
974
|
+
var import_api3 = __toESM(require_api());
|
975
|
+
var import_callOpenApi3 = require("ag-common/dist/ui/helpers/callOpenApi");
|
976
|
+
function callOpenApi3(p) {
|
977
|
+
return (0, import_callOpenApi3.callOpenApi)(__spreadProps(__spreadValues({}, p), {
|
978
|
+
func: (d) => p.func(d),
|
979
|
+
newDefaultApi: (opts) => new import_api3.DefaultApi(opts),
|
980
|
+
logout: () => window.location.reload(),
|
981
|
+
refreshToken: () => __async(this, null, function* () {
|
982
|
+
return void 0;
|
983
|
+
})
|
984
|
+
}));
|
985
|
+
}
|
986
|
+
var track = (_0) => __async(void 0, [_0], function* ({
|
987
|
+
analyticaToken,
|
988
|
+
userData,
|
989
|
+
overrideBaseUrl = "https://api.analytica.click",
|
990
|
+
eventName
|
991
|
+
}) {
|
992
|
+
var _a, _b, _c;
|
993
|
+
let data = { eventName };
|
994
|
+
if (typeof window !== "undefined") {
|
995
|
+
data = __spreadProps(__spreadValues({}, data), {
|
996
|
+
pageLocation: window.location.href,
|
997
|
+
browserResolution: `${(_a = window == null ? void 0 : window.screen) == null ? void 0 : _a.width}:${(_b = window == null ? void 0 : window.screen) == null ? void 0 : _b.height}`
|
998
|
+
});
|
999
|
+
}
|
1000
|
+
if (typeof document !== "undefined") {
|
1001
|
+
data = __spreadProps(__spreadValues({}, data), {
|
1002
|
+
pageReferrer: document.referrer,
|
1003
|
+
pageTitle: document.title
|
1004
|
+
});
|
1005
|
+
}
|
1006
|
+
if (typeof navigator !== "undefined") {
|
1007
|
+
data = __spreadProps(__spreadValues({}, data), {
|
1008
|
+
browserLanguage: navigator.language
|
1009
|
+
});
|
1010
|
+
}
|
1011
|
+
if (typeof window !== "undefined" && ((_c = window == null ? void 0 : window.location) == null ? void 0 : _c.hostname) === "localhost") {
|
1012
|
+
(0, import_log5.debug)(`local page ignored: ${JSON.stringify(data)}, to ${overrideBaseUrl}`);
|
1013
|
+
return {};
|
1014
|
+
}
|
1015
|
+
const x = yield callOpenApi3({
|
1016
|
+
apiUrl: overrideBaseUrl,
|
1017
|
+
func: (s) => s.postPageTrack({
|
1018
|
+
key: analyticaToken,
|
1019
|
+
data,
|
1020
|
+
userData
|
1021
|
+
})
|
1022
|
+
});
|
1023
|
+
if (x.error) {
|
1024
|
+
return { error: x.error.message };
|
1025
|
+
}
|
1026
|
+
return {};
|
1027
|
+
});
|
1028
|
+
var page = (_0) => __async(void 0, [_0], function* ({
|
1029
|
+
analyticaToken,
|
1030
|
+
userData,
|
1031
|
+
overrideBaseUrl = "https://api.analytica.click"
|
1032
|
+
}) {
|
1033
|
+
return track({ analyticaToken, userData, overrideBaseUrl, eventName: "PAGE" });
|
1034
|
+
});
|
1035
|
+
var useTrack = () => {
|
1036
|
+
const { analyticaToken, overrideBaseUrl } = (0, import_react3.useContext)(AnalyticaConfigContext);
|
1037
|
+
if (!analyticaToken) {
|
1038
|
+
(0, import_log5.warn)(tokenMissing("useTrack"));
|
1039
|
+
const def = () => __async(void 0, null, function* () {
|
1040
|
+
return { error: "no token" };
|
1041
|
+
});
|
1042
|
+
return { page: def, track: def };
|
1043
|
+
}
|
1044
|
+
return {
|
1045
|
+
page: (d) => page(__spreadProps(__spreadValues({}, d), { analyticaToken, overrideBaseUrl })),
|
1046
|
+
track: (d) => track(__spreadProps(__spreadValues({}, d), { analyticaToken, overrideBaseUrl }))
|
1047
|
+
};
|
1048
|
+
};
|
1049
|
+
|
1050
|
+
// src/components/ErrorBoundary/index.tsx
|
1051
|
+
var import_ErrorBoundary = __toESM(require_ErrorBoundary());
|
1052
|
+
var import_react4 = __toESM(require("react"));
|
1053
|
+
var import_log6 = require("ag-common/dist/common/helpers/log");
|
1054
|
+
function onBrowserError(_0) {
|
1055
|
+
return __async(this, arguments, function* ({
|
1056
|
+
ev,
|
1057
|
+
analyticaToken,
|
1058
|
+
filterBrowserError
|
1059
|
+
}) {
|
1060
|
+
if (filterBrowserError && filterBrowserError(ev) === false) {
|
1061
|
+
return;
|
1062
|
+
}
|
1063
|
+
const message = (ev == null ? void 0 : ev.message) || (ev == null ? void 0 : ev.error);
|
1064
|
+
const { href } = window.location;
|
1065
|
+
const stack = ev == null ? void 0 : ev.stack;
|
1066
|
+
const filename = ev == null ? void 0 : ev.filename;
|
1067
|
+
yield errorTrack({
|
1068
|
+
data: {
|
1069
|
+
key: analyticaToken,
|
1070
|
+
data: {
|
1071
|
+
message,
|
1072
|
+
stack,
|
1073
|
+
filename,
|
1074
|
+
href
|
1075
|
+
}
|
1076
|
+
}
|
1077
|
+
});
|
1078
|
+
});
|
1079
|
+
}
|
1080
|
+
var ErrorBoundary = ({
|
1081
|
+
children,
|
1082
|
+
filterBrowserError
|
1083
|
+
}) => {
|
1084
|
+
const { analyticaToken } = (0, import_react4.useContext)(AnalyticaConfigContext);
|
1085
|
+
(0, import_react4.useEffect)(() => {
|
1086
|
+
if (!analyticaToken) {
|
1087
|
+
return () => {
|
1088
|
+
};
|
1089
|
+
}
|
1090
|
+
const obe = (ev) => onBrowserError({ ev, analyticaToken, filterBrowserError });
|
1091
|
+
window.addEventListener("error", obe);
|
1092
|
+
return () => {
|
1093
|
+
window.removeEventListener("error", obe);
|
1094
|
+
};
|
1095
|
+
}, [analyticaToken, filterBrowserError]);
|
1096
|
+
if (!analyticaToken) {
|
1097
|
+
(0, import_log6.warn)(tokenMissing("ErrorBoundary"));
|
1098
|
+
return /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, children);
|
1099
|
+
}
|
1100
|
+
return /* @__PURE__ */ import_react4.default.createElement(import_ErrorBoundary.ErrorBoundary, {
|
1101
|
+
notify: (data) => __async(void 0, null, function* () {
|
1102
|
+
const { href } = window.location;
|
1103
|
+
yield errorTrack({
|
1104
|
+
data: {
|
1105
|
+
key: analyticaToken,
|
1106
|
+
data: __spreadProps(__spreadValues({}, data), {
|
1107
|
+
href
|
1108
|
+
})
|
1109
|
+
}
|
1110
|
+
});
|
1111
|
+
})
|
1112
|
+
}, children);
|
1113
|
+
};
|
1114
|
+
|
1115
|
+
// src/components/ExternalComponent/index.tsx
|
1116
|
+
var import_react5 = __toESM(require("react"));
|
1117
|
+
var import_createRequires = require("@paciolan/remote-component/dist/createRequires");
|
1118
|
+
var import_useRemoteComponent = require("@paciolan/remote-component/dist/hooks/useRemoteComponent");
|
1119
|
+
var import_react_dom = __toESM(require("react-dom"));
|
1120
|
+
var styled = require("styled-components");
|
1121
|
+
var cache = {};
|
1122
|
+
var ExternalComponent = ({
|
1123
|
+
url,
|
1124
|
+
props
|
1125
|
+
}) => {
|
1126
|
+
const requires = (0, import_createRequires.createRequires)(() => ({
|
1127
|
+
react: import_react5.default,
|
1128
|
+
"react-dom": import_react_dom.default,
|
1129
|
+
"styled-components": styled
|
1130
|
+
}));
|
1131
|
+
let Component;
|
1132
|
+
let loading = false;
|
1133
|
+
let error2;
|
1134
|
+
if (cache[url]) {
|
1135
|
+
Component = cache[url];
|
1136
|
+
} else {
|
1137
|
+
[loading, error2, Component] = (0, import_useRemoteComponent.createUseRemoteComponent)({ requires })(url);
|
1138
|
+
}
|
1139
|
+
if (!cache[url] && !loading && !error2 && Component) {
|
1140
|
+
cache[url] = Component;
|
1141
|
+
}
|
1142
|
+
return /* @__PURE__ */ import_react5.default.createElement(import_react5.default.Fragment, null, !loading && !error2 && /* @__PURE__ */ import_react5.default.createElement(Component, __spreadValues({}, props)), error2 && error2);
|
1143
|
+
};
|
1144
|
+
|
1145
|
+
// src/components/Feedback/index.tsx
|
1146
|
+
var import_react6 = __toESM(require("react"));
|
1147
|
+
var import_log7 = require("ag-common/dist/common/helpers/log");
|
1148
|
+
var Feedback = (props) => {
|
1149
|
+
const { analyticaToken, overrideBaseUrl, devMode } = (0, import_react6.useContext)(AnalyticaConfigContext);
|
1150
|
+
if (!analyticaToken) {
|
1151
|
+
(0, import_log7.warn)(tokenMissing("Feedback"));
|
1152
|
+
return /* @__PURE__ */ import_react6.default.createElement(import_react6.default.Fragment, null);
|
1153
|
+
}
|
1154
|
+
const int = __spreadProps(__spreadValues({}, props), {
|
1155
|
+
submitFeedback: feedback,
|
1156
|
+
analyticaToken,
|
1157
|
+
overrideBaseUrl
|
1158
|
+
});
|
1159
|
+
let url = `https://cdn.analytica.click/feedback.js`;
|
1160
|
+
if (devMode) {
|
1161
|
+
url = `/feedback.js`;
|
1162
|
+
}
|
1163
|
+
return /* @__PURE__ */ import_react6.default.createElement(ExternalComponent, {
|
1164
|
+
url,
|
1165
|
+
props: int
|
1166
|
+
});
|
1167
|
+
};
|
1168
|
+
|
1169
|
+
// src/components/UserProvider/cognito.ts
|
1170
|
+
var import_cognitoidentity = __toESM(require("aws-sdk/clients/cognitoidentity"));
|
1171
|
+
function getAwsCreds(_0) {
|
1172
|
+
return __async(this, arguments, function* ({
|
1173
|
+
user,
|
1174
|
+
config
|
1175
|
+
}) {
|
1176
|
+
var _a, _b, _c;
|
1177
|
+
if (!((_a = user == null ? void 0 : user.jwt) == null ? void 0 : _a.id_token) || !user.idJwt || !config.identityPool) {
|
1178
|
+
return void 0;
|
1179
|
+
}
|
1180
|
+
const idToken = (_b = user == null ? void 0 : user.jwt) == null ? void 0 : _b.id_token;
|
1181
|
+
const logins = {
|
1182
|
+
[user.idJwt.iss.replace("https://", "")]: idToken
|
1183
|
+
};
|
1184
|
+
const cognito = new import_cognitoidentity.default({ region: config.AWSRegion });
|
1185
|
+
const identityId = yield cognito.getId({
|
1186
|
+
IdentityPoolId: config.identityPool,
|
1187
|
+
Logins: logins
|
1188
|
+
}).promise();
|
1189
|
+
if (!(identityId == null ? void 0 : identityId.IdentityId)) {
|
1190
|
+
return void 0;
|
1191
|
+
}
|
1192
|
+
const roleArn = (_c = user.idJwt) == null ? void 0 : _c["cognito:preferred_role"];
|
1193
|
+
const params = {
|
1194
|
+
CustomRoleArn: roleArn,
|
1195
|
+
IdentityId: identityId.IdentityId,
|
1196
|
+
Logins: logins
|
1197
|
+
};
|
1198
|
+
const { Credentials: creds } = yield cognito.getCredentialsForIdentity(params).promise();
|
1199
|
+
if (!(creds == null ? void 0 : creds.AccessKeyId) || !creds.SecretKey || !creds.SessionToken || !creds.Expiration) {
|
1200
|
+
return void 0;
|
1201
|
+
}
|
1202
|
+
const credentials = {
|
1203
|
+
accessKeyId: creds.AccessKeyId,
|
1204
|
+
sessionToken: creds.SessionToken,
|
1205
|
+
secretAccessKey: creds.SecretKey
|
1206
|
+
};
|
1207
|
+
return credentials;
|
1208
|
+
});
|
1209
|
+
}
|
1210
|
+
|
1211
|
+
// src/components/UserProvider/jwt.ts
|
1212
|
+
var jwtExpired = (j) => !(j == null ? void 0 : j.expires_at) || new Date().getTime() > j.expires_at;
|
1213
|
+
var jwtGenerateExpiresAt = ({ expires_in }) => new Date().getTime() + parseInt(`${expires_in}000`, 10);
|
1214
|
+
|
1215
|
+
// src/components/UserProvider/refreshToken.ts
|
1216
|
+
var import_axiosHelper = require("ag-common/dist/ui/helpers/axiosHelper");
|
1217
|
+
var import_log8 = require("ag-common/dist/common/helpers/log");
|
1218
|
+
var import_dom = __toESM(require_dom());
|
1219
|
+
function refreshToken(_0) {
|
1220
|
+
return __async(this, arguments, function* ({
|
1221
|
+
user,
|
1222
|
+
setUser,
|
1223
|
+
setError,
|
1224
|
+
config,
|
1225
|
+
logout
|
1226
|
+
}) {
|
1227
|
+
var _a, _b;
|
1228
|
+
try {
|
1229
|
+
if (((_a = user == null ? void 0 : user.jwt) == null ? void 0 : _a.id_token) && !jwtExpired(user == null ? void 0 : user.jwt)) {
|
1230
|
+
return user;
|
1231
|
+
}
|
1232
|
+
const token = (_b = user == null ? void 0 : user.jwt) == null ? void 0 : _b.refresh_token;
|
1233
|
+
if (!token || !user) {
|
1234
|
+
(0, import_log8.warn)("no refresh token, wipe");
|
1235
|
+
logout();
|
1236
|
+
return void 0;
|
1237
|
+
}
|
1238
|
+
const resp = yield (0, import_axiosHelper.axiosHelper)({
|
1239
|
+
url: config.cognitoRefresh,
|
1240
|
+
verb: "post",
|
1241
|
+
body: (0, import_dom.stringify)({
|
1242
|
+
grant_type: "refresh_token",
|
1243
|
+
client_id: config.ClientId,
|
1244
|
+
refresh_token: token
|
1245
|
+
}),
|
1246
|
+
headers: {
|
1247
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
1248
|
+
}
|
1249
|
+
});
|
1250
|
+
const newUser = __spreadProps(__spreadValues({}, user), {
|
1251
|
+
jwt: __spreadProps(__spreadValues({}, resp.data), {
|
1252
|
+
refresh_token: token,
|
1253
|
+
expires_at: jwtGenerateExpiresAt({ expires_in: resp.data.expires_in })
|
1254
|
+
})
|
1255
|
+
});
|
1256
|
+
newUser.credentials = yield getAwsCreds({ user: newUser, config });
|
1257
|
+
setUser(newUser);
|
1258
|
+
return newUser;
|
1259
|
+
} catch (e) {
|
1260
|
+
const es = e.toString();
|
1261
|
+
if (es.includes(400) || es.includes(401) || es.includes(403)) {
|
1262
|
+
(0, import_log8.debug)("old refresh token, wipe");
|
1263
|
+
setUser(void 0);
|
1264
|
+
setError(void 0);
|
1265
|
+
return void 0;
|
1266
|
+
}
|
1267
|
+
setError(e);
|
1268
|
+
}
|
1269
|
+
return void 0;
|
1270
|
+
});
|
1271
|
+
}
|
1272
|
+
|
1273
|
+
// src/components/UserProvider/getTokensFromCode.ts
|
1274
|
+
var import_axiosHelper2 = require("ag-common/dist/ui/helpers/axiosHelper");
|
1275
|
+
var import_dom2 = __toESM(require_dom());
|
1276
|
+
function getTokensFromCode(_0) {
|
1277
|
+
return __async(this, arguments, function* ({
|
1278
|
+
code,
|
1279
|
+
setUser,
|
1280
|
+
redirectUrl,
|
1281
|
+
config
|
1282
|
+
}) {
|
1283
|
+
try {
|
1284
|
+
const resp = yield (0, import_axiosHelper2.axiosHelper)({
|
1285
|
+
verb: "post",
|
1286
|
+
url: config.cognitoRefresh,
|
1287
|
+
body: (0, import_dom2.stringify)({
|
1288
|
+
grant_type: "authorization_code",
|
1289
|
+
client_id: config.ClientId,
|
1290
|
+
code,
|
1291
|
+
redirect_uri: redirectUrl
|
1292
|
+
}),
|
1293
|
+
headers: {
|
1294
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
1295
|
+
}
|
1296
|
+
});
|
1297
|
+
const newUser = __spreadProps(__spreadValues({}, getUserFromIdToken(resp.data.id_token)), {
|
1298
|
+
jwt: __spreadProps(__spreadValues({}, resp.data), {
|
1299
|
+
expires_at: jwtGenerateExpiresAt({ expires_in: resp.data.expires_in })
|
1300
|
+
})
|
1301
|
+
});
|
1302
|
+
if (config.identityPool) {
|
1303
|
+
newUser.credentials = yield getAwsCreds({ user: newUser, config });
|
1304
|
+
}
|
1305
|
+
setUser(newUser);
|
1306
|
+
return true;
|
1307
|
+
} catch (e) {
|
1308
|
+
}
|
1309
|
+
return false;
|
1310
|
+
});
|
1311
|
+
}
|
1312
|
+
|
1313
|
+
// src/components/UserProvider/index.tsx
|
1314
|
+
var import_log9 = require("ag-common/dist/common/helpers/log");
|
1315
|
+
var import_react7 = __toESM(require("react"));
|
1316
|
+
var import_useLocalStorage = require("ag-common/dist/ui/helpers/useLocalStorage");
|
1317
|
+
var import_cookie = require("ag-common/dist/ui/helpers/cookie");
|
1318
|
+
var import_dom3 = __toESM(require_dom());
|
1319
|
+
var CognitoAuthContext = import_react7.default.createContext(void 0);
|
1320
|
+
var CognitoAuthProvider = ({
|
1321
|
+
config,
|
1322
|
+
children,
|
1323
|
+
goToPageUrl,
|
1324
|
+
location,
|
1325
|
+
redirectUrl = location.origin,
|
1326
|
+
onMessage,
|
1327
|
+
cookieDocument
|
1328
|
+
}) => {
|
1329
|
+
var _a, _b;
|
1330
|
+
const [error2, setError] = (0, import_react7.useState)();
|
1331
|
+
const [idTokenRaw, setIdToken] = (0, import_cookie.useCookieString)({
|
1332
|
+
name: "id_token",
|
1333
|
+
cookieDocument: typeof window === "undefined" ? cookieDocument : void 0,
|
1334
|
+
defaultValue: ""
|
1335
|
+
});
|
1336
|
+
let idToken = idTokenRaw;
|
1337
|
+
if (idToken && !decodeIdToken(idToken)) {
|
1338
|
+
(0, import_log9.warn)(`bad token, logging out`);
|
1339
|
+
(0, import_cookie.wipeCookies)("id_token");
|
1340
|
+
void goToPageUrl({ url: location.origin, login: false });
|
1341
|
+
idToken = "";
|
1342
|
+
}
|
1343
|
+
let defUser;
|
1344
|
+
if (idToken && !(0, import_useLocalStorage.getLocalStorageItem)("user", void 0)) {
|
1345
|
+
defUser = getUserFromIdToken(idToken);
|
1346
|
+
}
|
1347
|
+
const [user, setUser] = (0, import_useLocalStorage.UseLocalStorage)("user", defUser);
|
1348
|
+
const [loading, setLoading] = (0, import_react7.useState)(false);
|
1349
|
+
const qs = (0, import_dom3.extractQs)({
|
1350
|
+
search: typeof window === "undefined" ? "" : window.location.search,
|
1351
|
+
sanatise: false
|
1352
|
+
});
|
1353
|
+
const logout = () => __async(void 0, null, function* () {
|
1354
|
+
(0, import_cookie.wipeCookies)("id_token");
|
1355
|
+
(0, import_useLocalStorage.clearLocalStorageItem)("user");
|
1356
|
+
setIdToken("");
|
1357
|
+
setUser(void 0);
|
1358
|
+
setError(void 0);
|
1359
|
+
setLoading(true);
|
1360
|
+
yield goToPageUrl({ url: location.origin, login: false });
|
1361
|
+
setLoading(false);
|
1362
|
+
});
|
1363
|
+
const logoutCopy = logout;
|
1364
|
+
(0, import_react7.useEffect)(() => {
|
1365
|
+
var _a2;
|
1366
|
+
const newT = (_a2 = user == null ? void 0 : user.jwt) == null ? void 0 : _a2.id_token;
|
1367
|
+
if (!!newT && newT !== idToken) {
|
1368
|
+
setIdToken(newT || "");
|
1369
|
+
}
|
1370
|
+
}, [idToken, setIdToken, user, (_a = user == null ? void 0 : user.jwt) == null ? void 0 : _a.id_token]);
|
1371
|
+
const loginWithRedirect = (stateqs) => __async(void 0, null, function* () {
|
1372
|
+
var _a2;
|
1373
|
+
if (error2 || loading || location.hash && Object.keys(location.hash).length > 0 || location.search && ((_a2 = Object.keys(location.search)) == null ? void 0 : _a2.length) > 0) {
|
1374
|
+
return;
|
1375
|
+
}
|
1376
|
+
setLoading(true);
|
1377
|
+
const state = {
|
1378
|
+
back: location.pathname
|
1379
|
+
};
|
1380
|
+
let url = config.vendToken + redirectUrl;
|
1381
|
+
if (stateqs) {
|
1382
|
+
url += `&state=${stateqs}`;
|
1383
|
+
}
|
1384
|
+
yield goToPageUrl({
|
1385
|
+
url,
|
1386
|
+
state,
|
1387
|
+
login: true
|
1388
|
+
});
|
1389
|
+
});
|
1390
|
+
(0, import_react7.useEffect)(() => {
|
1391
|
+
function run() {
|
1392
|
+
return __async(this, null, function* () {
|
1393
|
+
var _a2, _b2, _c;
|
1394
|
+
const hasQs = !!(qs == null ? void 0 : qs.code) || !!(qs == null ? void 0 : qs.error);
|
1395
|
+
const expired = jwtExpired(user == null ? void 0 : user.jwt);
|
1396
|
+
const onlyJwt = !(user == null ? void 0 : user.userId) && !!(user == null ? void 0 : user.jwt);
|
1397
|
+
if (!hasQs && !expired && !onlyJwt) {
|
1398
|
+
return;
|
1399
|
+
}
|
1400
|
+
try {
|
1401
|
+
setLoading(true);
|
1402
|
+
if (hasQs && !expired) {
|
1403
|
+
yield goToPageUrl({ url: redirectUrl, login: true });
|
1404
|
+
} else if (hasQs) {
|
1405
|
+
if (qs == null ? void 0 : qs.error) {
|
1406
|
+
const newerror = {
|
1407
|
+
message: (qs == null ? void 0 : qs.error_description) || "auth error"
|
1408
|
+
};
|
1409
|
+
if (JSON.stringify(newerror || {}) !== JSON.stringify(error2 || {})) {
|
1410
|
+
setError(newerror);
|
1411
|
+
}
|
1412
|
+
} else if (qs == null ? void 0 : qs.code) {
|
1413
|
+
yield getTokensFromCode({
|
1414
|
+
code: qs.code,
|
1415
|
+
redirectUrl,
|
1416
|
+
config,
|
1417
|
+
setUser
|
1418
|
+
});
|
1419
|
+
}
|
1420
|
+
const newPath = "";
|
1421
|
+
let url = newPath || redirectUrl || "/";
|
1422
|
+
if (qs == null ? void 0 : qs.state) {
|
1423
|
+
try {
|
1424
|
+
if (!url.includes("?")) {
|
1425
|
+
url += "?";
|
1426
|
+
} else {
|
1427
|
+
url += "&";
|
1428
|
+
}
|
1429
|
+
url += `state=${qs.state}`;
|
1430
|
+
} catch (e) {
|
1431
|
+
(0, import_log9.warn)("bad state passed in");
|
1432
|
+
}
|
1433
|
+
}
|
1434
|
+
yield goToPageUrl({ url, login: true });
|
1435
|
+
} else if (expired && ((_a2 = user == null ? void 0 : user.jwt) == null ? void 0 : _a2.refresh_token)) {
|
1436
|
+
yield refreshToken({
|
1437
|
+
setUser,
|
1438
|
+
setError,
|
1439
|
+
user,
|
1440
|
+
config,
|
1441
|
+
logout: logoutCopy
|
1442
|
+
});
|
1443
|
+
} else if (onlyJwt) {
|
1444
|
+
const token = (_c = (_b2 = user == null ? void 0 : user.jwt) == null ? void 0 : _b2.id_token) == null ? void 0 : _c.substr(user.jwt.id_token.indexOf(" ") + 1);
|
1445
|
+
if (!user || !token) {
|
1446
|
+
(0, import_log9.info)("logging out no token");
|
1447
|
+
setUser(void 0);
|
1448
|
+
setError(void 0);
|
1449
|
+
} else {
|
1450
|
+
setUser(__spreadProps(__spreadValues({}, getUserFromIdToken(token)), {
|
1451
|
+
jwt: user.jwt,
|
1452
|
+
credentials: user.credentials
|
1453
|
+
}));
|
1454
|
+
}
|
1455
|
+
}
|
1456
|
+
} finally {
|
1457
|
+
setLoading(false);
|
1458
|
+
}
|
1459
|
+
});
|
1460
|
+
}
|
1461
|
+
if (!loading && !error2) {
|
1462
|
+
run();
|
1463
|
+
}
|
1464
|
+
}, [
|
1465
|
+
config,
|
1466
|
+
error2,
|
1467
|
+
goToPageUrl,
|
1468
|
+
logoutCopy,
|
1469
|
+
loading,
|
1470
|
+
qs,
|
1471
|
+
redirectUrl,
|
1472
|
+
setUser,
|
1473
|
+
user
|
1474
|
+
]);
|
1475
|
+
(0, import_react7.useEffect)(() => {
|
1476
|
+
var _a2;
|
1477
|
+
if (error2) {
|
1478
|
+
(0, import_log9.error)(JSON.stringify(error2));
|
1479
|
+
if (onMessage) {
|
1480
|
+
onMessage(`error:${(_a2 = error2.response) == null ? void 0 : _a2.status}`, { appearance: "error" });
|
1481
|
+
}
|
1482
|
+
}
|
1483
|
+
}, [onMessage, error2]);
|
1484
|
+
const l2 = !error2 && (loading || !!(qs == null ? void 0 : qs.code));
|
1485
|
+
const value = {
|
1486
|
+
loading: l2,
|
1487
|
+
isAuthenticated: !error2 && !!((_b = user == null ? void 0 : user.idJwt) == null ? void 0 : _b.email),
|
1488
|
+
refreshToken: () => refreshToken({
|
1489
|
+
setUser,
|
1490
|
+
setError,
|
1491
|
+
user,
|
1492
|
+
config,
|
1493
|
+
logout
|
1494
|
+
}),
|
1495
|
+
loginWithRedirect,
|
1496
|
+
logout,
|
1497
|
+
error: error2,
|
1498
|
+
user
|
1499
|
+
};
|
1500
|
+
return /* @__PURE__ */ import_react7.default.createElement(CognitoAuthContext.Provider, {
|
1501
|
+
value
|
1502
|
+
}, children);
|
1503
|
+
};
|
1504
|
+
|
1505
|
+
// src/components/UserProvider/DashboardAuthValidation.tsx
|
1506
|
+
var import_log10 = require("ag-common/dist/common/helpers/log");
|
1507
|
+
var import_string = require("ag-common/dist/common/helpers/string");
|
1508
|
+
var import_Loader = require("ag-common/dist/ui/components/Loader");
|
1509
|
+
var import_react8 = __toESM(require("react"));
|
1510
|
+
var DashboardAuthValidation = ({
|
1511
|
+
rc: { request, pushPath },
|
1512
|
+
cac: {
|
1513
|
+
error: authError,
|
1514
|
+
loginWithRedirect,
|
1515
|
+
logout,
|
1516
|
+
isAuthenticated,
|
1517
|
+
loading: authLoading
|
1518
|
+
},
|
1519
|
+
getDashboardPath,
|
1520
|
+
getUnauthedPage,
|
1521
|
+
addToast
|
1522
|
+
}) => {
|
1523
|
+
(0, import_react8.useEffect)(() => {
|
1524
|
+
if (authError) {
|
1525
|
+
const emailOption = authError.message.includes("email") ? ` We require the use of your email for the functionality of this app.
|
1526
|
+
You can update your settings at https://www.facebook.com/settings?tab=applications` : "";
|
1527
|
+
addToast(`An Error has occured with your login attempt.${emailOption}`, {
|
1528
|
+
appearance: "error"
|
1529
|
+
});
|
1530
|
+
(0, import_log10.error)(`auth error:`, JSON.stringify(authError, null, 2));
|
1531
|
+
void logout();
|
1532
|
+
}
|
1533
|
+
}, [authError]);
|
1534
|
+
const forceLogin = Object.keys(request.url.query || {}).includes("login");
|
1535
|
+
if (forceLogin) {
|
1536
|
+
if (!isAuthenticated) {
|
1537
|
+
void loginWithRedirect(request.url.query.state);
|
1538
|
+
return { render: /* @__PURE__ */ import_react8.default.createElement(import_react8.default.Fragment, null), openApiDisabled: true };
|
1539
|
+
}
|
1540
|
+
if (isAuthenticated) {
|
1541
|
+
void pushPath(getDashboardPath());
|
1542
|
+
return { render: /* @__PURE__ */ import_react8.default.createElement(import_react8.default.Fragment, null), openApiDisabled: true };
|
1543
|
+
}
|
1544
|
+
}
|
1545
|
+
if (request.url.query.state && isAuthenticated) {
|
1546
|
+
const decoded = JSON.parse((0, import_string.fromBase64)(request.url.query.state));
|
1547
|
+
if (decoded.redirect) {
|
1548
|
+
void pushPath(decoded.redirect);
|
1549
|
+
return { render: /* @__PURE__ */ import_react8.default.createElement(import_react8.default.Fragment, null), openApiDisabled: true };
|
1550
|
+
}
|
1551
|
+
}
|
1552
|
+
if (authLoading) {
|
1553
|
+
return {
|
1554
|
+
render: /* @__PURE__ */ import_react8.default.createElement(import_Loader.Loader, {
|
1555
|
+
name: "authload"
|
1556
|
+
}),
|
1557
|
+
openApiDisabled: true
|
1558
|
+
};
|
1559
|
+
}
|
1560
|
+
if (!isAuthenticated && !authLoading && !authError && getUnauthedPage) {
|
1561
|
+
void pushPath(getUnauthedPage());
|
1562
|
+
return { render: /* @__PURE__ */ import_react8.default.createElement(import_react8.default.Fragment, null), openApiDisabled: true };
|
1563
|
+
}
|
1564
|
+
const openApiDisabled = !isAuthenticated || authLoading || !!authError;
|
1565
|
+
return { openApiDisabled };
|
1566
|
+
};
|
1567
|
+
// Annotate the CommonJS export names for ESM import in node:
|
1568
|
+
0 && (module.exports = {
|
1569
|
+
AnalyticaConfigContext,
|
1570
|
+
AnalyticaConfigProvider,
|
1571
|
+
CognitoAuthContext,
|
1572
|
+
CognitoAuthProvider,
|
1573
|
+
DashboardAuthValidation,
|
1574
|
+
ErrorBoundary,
|
1575
|
+
ExternalComponent,
|
1576
|
+
Feedback,
|
1577
|
+
decodeIdToken,
|
1578
|
+
errorTrack,
|
1579
|
+
feedback,
|
1580
|
+
getUserFromIdToken,
|
1581
|
+
page,
|
1582
|
+
tokenMissing,
|
1583
|
+
track,
|
1584
|
+
useFeedback,
|
1585
|
+
useTrack
|
1586
|
+
});
|