@analytics/aws-pinpoint
Advanced tools
Comparing version 0.6.20 to 0.7.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [0.7.0](https://github.com/DavidWells/analytics/compare/@analytics/aws-pinpoint@0.6.20...@analytics/aws-pinpoint@0.7.0) (2021-10-23) | ||
### Features | ||
* add node.js AWS pinpoint integration ([90f8f6e](https://github.com/DavidWells/analytics/commit/90f8f6e)) | ||
## [0.6.20](https://github.com/DavidWells/analytics/compare/@analytics/aws-pinpoint@0.6.19...@analytics/aws-pinpoint@0.6.20) (2021-10-17) | ||
@@ -8,0 +19,0 @@ |
@@ -1,1 +0,1 @@ | ||
var analyticsAWSPinpoint=function(e){"use strict";var t=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e};function n(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}var r=function(e){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?n(Object(i),!0).forEach(function(n){t(e,n,i[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):n(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e};function i(e,t){return e(t={exports:{}},t.exports),t.exports}var o=i(function(e){function t(n){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=t=function(e){return typeof e}:e.exports=t=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(n)}e.exports=t}),s=i(function(e){var t=function(e){var t,n=Object.prototype,r=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",a=i.toStringTag||"@@toStringTag";function c(e,t,n,r){var i=t&&t.prototype instanceof g?t:g,o=Object.create(i.prototype),s=new O(r||[]);return o._invoke=function(e,t,n){var r=l;return function(i,o){if(r===f)throw new Error("Generator is already running");if(r===h){if("throw"===i)throw o;return j()}for(n.method=i,n.arg=o;;){var s=n.delegate;if(s){var a=E(s,n);if(a){if(a===p)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===l)throw r=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=f;var c=u(e,t,n);if("normal"===c.type){if(r=n.done?h:d,c.arg===p)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r=h,n.method="throw",n.arg=c.arg)}}}(e,n,s),o}function u(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var l="suspendedStart",d="suspendedYield",f="executing",h="completed",p={};function g(){}function v(){}function y(){}var m={};m[o]=function(){return this};var w=Object.getPrototypeOf,b=w&&w(w(T([])));b&&b!==n&&r.call(b,o)&&(m=b);var S=y.prototype=g.prototype=Object.create(m);function x(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function A(e,t){var n;this._invoke=function(i,o){function s(){return new t(function(n,s){!function n(i,o,s,a){var c=u(e[i],e,o);if("throw"!==c.type){var l=c.arg,d=l.value;return d&&"object"==typeof d&&r.call(d,"__await")?t.resolve(d.__await).then(function(e){n("next",e,s,a)},function(e){n("throw",e,s,a)}):t.resolve(d).then(function(e){l.value=e,s(l)},function(e){return n("throw",e,s,a)})}a(c.arg)}(i,o,n,s)})}return n=n?n.then(s,s):s()}}function E(e,n){var r=e.iterator[n.method];if(r===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method))return p;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var i=u(r,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,p;var o=i.arg;return o?o.done?(n[e.resultName]=o.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,p):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,p)}function k(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(k,this),this.reset(!0)}function T(e){if(e){var n=e[o];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,s=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return s.next=s}}return{next:j}}function j(){return{value:t,done:!0}}return v.prototype=S.constructor=y,y.constructor=v,y[a]=v.displayName="GeneratorFunction",e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,y):(e.__proto__=y,a in e||(e[a]="GeneratorFunction")),e.prototype=Object.create(S),e},e.awrap=function(e){return{__await:e}},x(A.prototype),A.prototype[s]=function(){return this},e.AsyncIterator=A,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var s=new A(c(t,n,r,i),o);return e.isGeneratorFunction(n)?s:s.next().then(function(e){return e.done?e.value:s.next()})},x(S),S[a]="Generator",S[o]=function(){return this},S.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=T,O.prototype={constructor:O,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(I),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return a.type="throw",a.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var c=r.call(s,"catchLoc"),u=r.call(s,"finallyLoc");if(c&&u){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(c){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=e,s.arg=t,o?(this.method="next",this.next=o.finallyLoc,p):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),I(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;I(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:T(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),p}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}});function a(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}var c=function(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){a(o,r,i,s,c,"next",e)}function c(e){a(o,r,i,s,c,"throw",e)}s(void 0)})}},u=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===l}(e)}(e)};var l="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function d(e,t){return!1!==t.clone&&t.isMergeableObject(e)?v((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function f(e,t,n){return e.concat(t).map(function(e){return d(e,n)})}function h(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return e.propertyIsEnumerable(t)}):[]}(e))}function p(e,t){try{return t in e}catch(e){return!1}}function g(e,t,n){var r={};return n.isMergeableObject(e)&&h(e).forEach(function(t){r[t]=d(e[t],n)}),h(t).forEach(function(i){(function(e,t){return p(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,i)||(p(e,i)&&n.isMergeableObject(t[i])?r[i]=function(e,t){if(!t.customMerge)return v;var n=t.customMerge(e);return"function"==typeof n?n:v}(i,n)(e[i],t[i],n):r[i]=d(t[i],n))}),r}function v(e,t,n){(n=n||{}).arrayMerge=n.arrayMerge||f,n.isMergeableObject=n.isMergeableObject||u,n.cloneUnlessOtherwiseSpecified=d;var r=Array.isArray(t);return r===Array.isArray(e)?r?n.arrayMerge(e,t,n):g(e,t,n):d(t,n)}v.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(e,n){return v(e,n,t)},{})};var y=v,m=function(){},w="undefined"!=typeof window;function b(){for(var e="",t=0,n=4294967295*Math.random()|0;t++<36;){var r="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"[t-1],i=15&n;e+="-"==r||"4"==r?r:("x"==r?i:3&i|8).toString(16),n=t%8==0?4294967295*Math.random()|0:n>>4}return e}const S=new TextEncoder,x={appstream2:"appstream",cloudhsmv2:"cloudhsm",email:"ses",marketplace:"aws-marketplace",mobile:"AWSMobileHubService",pinpoint:"mobiletargeting",queue:"sqs","git-codecommit":"codecommit","mturk-requester-sandbox":"mturk-requester","personalize-runtime":"personalize"},A=["authorization","content-type","content-length","user-agent","presigned-expires","expect","x-amzn-trace-id","range","connection"];class E{constructor({accessKeyId:e,secretAccessKey:t,sessionToken:n,service:r,region:i,cache:o,retries:s,initRetryMs:a}){if(null==e)throw new TypeError("accessKeyId is a required option");if(null==t)throw new TypeError("secretAccessKey is a required option");this.accessKeyId=e,this.secretAccessKey=t,this.sessionToken=n,this.service=r,this.region=i,this.cache=o||new Map,this.retries=null!=s?s:10,this.initRetryMs=a||50}async sign(e,t){if(e instanceof Request){const{method:n,url:r,headers:i,body:o}=e;null==(t=Object.assign({method:n,url:r,headers:i},t)).body&&i.has("Content-Type")&&(t.body=null!=o&&i.has("X-Amz-Content-Sha256")?o:await e.clone().arrayBuffer()),e=r}const n=new k(Object.assign({url:e},t,this,t&&t.aws)),r=Object.assign({},t,await n.sign());return delete r.aws,new Request(r.url.toString(),r)}async fetch(e,t){for(let n=0;n<=this.retries;n++){const r=fetch(await this.sign(e,t));if(n===this.retries)return r;const i=await r;if(i.status<500&&429!==i.status)return i;await new Promise(e=>setTimeout(e,Math.random()*this.initRetryMs*Math.pow(2,n)))}throw new Error("An unknown error occurred, ensure retries is not negative")}}class k{constructor({method:e,url:t,headers:n,body:r,accessKeyId:i,secretAccessKey:o,sessionToken:s,service:a,region:c,cache:u,datetime:l,signQuery:d,appendSessionToken:f,allHeaders:h,singleEncode:p}){if(null==t)throw new TypeError("url is a required option");if(null==i)throw new TypeError("accessKeyId is a required option");if(null==o)throw new TypeError("secretAccessKey is a required option");let g,v;this.method=e||(r?"POST":"GET"),this.url=new URL(t),this.headers=new Headers(n||{}),this.body=r,this.accessKeyId=i,this.secretAccessKey=o,this.sessionToken=s,a&&c||([g,v]=function(e,t){const{hostname:n,pathname:r}=e,i=n.replace("dualstack.","").match(/([^.]+)\.(?:([^.]*)\.)?amazonaws\.com(?:\.cn)?$/);let[o,s]=(i||["",""]).slice(1,3);if("us-gov"===s)s="us-gov-west-1";else if("s3"===s||"s3-accelerate"===s)s="us-east-1",o="s3";else if("iot"===o)o=n.startsWith("iot.")?"execute-api":n.startsWith("data.jobs.iot.")?"iot-jobs-data":"/mqtt"===r?"iotdevicegateway":"iotdata";else if("autoscaling"===o){const e=(t.get("X-Amz-Target")||"").split(".")[0];"AnyScaleFrontendService"===e?o="application-autoscaling":"AnyScaleScalingPlannerFrontendService"===e&&(o="autoscaling-plans")}else null==s&&o.startsWith("s3-")?(s=o.slice(3).replace(/^fips-|^external-1/,""),o="s3"):o.endsWith("-fips")?o=o.slice(0,-5):s&&/-\d$/.test(o)&&!/-\d$/.test(s)&&([o,s]=[s,o]);return[x[o]||o,s]}(this.url,this.headers)),this.service=a||g||"",this.region=c||v||"us-east-1",this.cache=u||new Map,this.datetime=l||(new Date).toISOString().replace(/[:-]|\.\d{3}/g,""),this.signQuery=d,this.appendSessionToken=f||"iotdevicegateway"===this.service,this.headers.delete("Host");const y=this.signQuery?this.url.searchParams:this.headers;if("s3"!==this.service||this.headers.has("X-Amz-Content-Sha256")||this.headers.set("X-Amz-Content-Sha256","UNSIGNED-PAYLOAD"),y.set("X-Amz-Date",this.datetime),this.sessionToken&&!this.appendSessionToken&&y.set("X-Amz-Security-Token",this.sessionToken),this.signableHeaders=["host",...this.headers.keys()].filter(e=>h||!A.includes(e)).sort(),this.signedHeaders=this.signableHeaders.join(";"),this.canonicalHeaders=this.signableHeaders.map(e=>e+":"+("host"===e?this.url.host:(this.headers.get(e)||"").replace(/\s+/g," "))).join("\n"),this.credentialString=[this.datetime.slice(0,8),this.region,this.service,"aws4_request"].join("/"),this.signQuery&&("s3"!==this.service||y.has("X-Amz-Expires")||y.set("X-Amz-Expires","86400"),y.set("X-Amz-Algorithm","AWS4-HMAC-SHA256"),y.set("X-Amz-Credential",this.accessKeyId+"/"+this.credentialString),y.set("X-Amz-SignedHeaders",this.signedHeaders)),"s3"===this.service)try{this.encodedPath=decodeURIComponent(this.url.pathname.replace(/\+/g," "))}catch(e){this.encodedPath=this.url.pathname}else this.encodedPath=this.url.pathname.replace(/\/+/g,"/");p||(this.encodedPath=encodeURIComponent(this.encodedPath).replace(/%2F/g,"/")),this.encodedPath=j(this.encodedPath);const m=new Set;this.encodedSearch=[...this.url.searchParams].filter(([e])=>{if(!e)return!1;if("s3"===this.service){if(m.has(e))return!1;m.add(e)}return!0}).map(e=>e.map(e=>j(encodeURIComponent(e)))).sort(([e,t],[n,r])=>e<n?-1:e>n?1:t<r?-1:t>r?1:0).map(e=>e.join("=")).join("&")}async sign(){return this.signQuery?(this.url.searchParams.set("X-Amz-Signature",await this.signature()),this.sessionToken&&this.appendSessionToken&&this.url.searchParams.set("X-Amz-Security-Token",this.sessionToken)):this.headers.set("Authorization",await this.authHeader()),{method:this.method,url:this.url,headers:this.headers,body:this.body}}async authHeader(){return["AWS4-HMAC-SHA256 Credential="+this.accessKeyId+"/"+this.credentialString,"SignedHeaders="+this.signedHeaders,"Signature="+await this.signature()].join(", ")}async signature(){const e=this.datetime.slice(0,8),t=[this.secretAccessKey,e,this.region,this.service].join();let n=this.cache.get(t);if(!n){const r=await I("AWS4"+this.secretAccessKey,e),i=await I(r,this.region),o=await I(i,this.service);n=await I(o,"aws4_request"),this.cache.set(t,n)}return T(await I(n,await this.stringToSign()))}async stringToSign(){return["AWS4-HMAC-SHA256",this.datetime,this.credentialString,T(await O(await this.canonicalString()))].join("\n")}async canonicalString(){return[this.method.toUpperCase(),this.encodedPath,this.encodedSearch,this.canonicalHeaders+"\n",this.signedHeaders,await this.hexBodyHash()].join("\n")}async hexBodyHash(){let e=this.headers.get("X-Amz-Content-Sha256");if(null==e){if(this.body&&"string"!=typeof this.body&&!("byteLength"in this.body))throw new Error("body must be a string, ArrayBuffer or ArrayBufferView, unless you include the X-Amz-Content-Sha256 header");e=T(await O(this.body||""))}return e}}async function I(e,t){const n=await crypto.subtle.importKey("raw","string"==typeof e?S.encode(e):e,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);return crypto.subtle.sign("HMAC",n,S.encode(t))}async function O(e){return crypto.subtle.digest("SHA-256","string"==typeof e?S.encode(e):e)}function T(e){return Array.prototype.map.call(new Uint8Array(e),e=>("0"+e.toString(16)).slice(-2)).join("")}function j(e){return e.replace(/[!'()*]/g,e=>"%"+e.charCodeAt(0).toString(16).toUpperCase())}var P="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||void 0,M="undefined";function N(e){return P[e]}function _(e,t){return P[e]=t,t}function U(e){_(e)}var C=function(){if(typeof C!==M)return C;C=!0;try{sessionStorage.setItem(M,M),sessionStorage.removeItem(M)}catch(e){C=!1}return C}();function L(e){return C?sessionStorage.getItem(e)||void 0:N(e)}function D(e,t){return C?sessionStorage.setItem(e,t):_(e,t)}var H=function(){if(typeof H!==M)return H;try{R(M,"1"),H=-1!==document.cookie.indexOf(M),e=M,H?R(e,"",-1):U(e)}catch(e){H=!1}var e;return H}(),z=R,K=R;function R(e,t,n,r,i,o){if(typeof window!==M){var s=arguments.length>1;return H||(s?_(e,t):N(e)),s?document.cookie=e+"="+encodeURIComponent(t)+(n?"; expires="+new Date(+new Date+1e3*n).toUTCString()+(r?"; path="+r:"")+(i?"; domain="+i:"")+(o?"; secure":""):""):decodeURIComponent((("; "+document.cookie).split("; "+e+"=")[1]||"").split(";")[0])}}var V=["id","createdAt","created"];function q(e){var t=e?new Date(e):new Date;return[t.toISOString(),t.getTime()]}function W(){var e=q(),t=e[0],n=e[1];return{id:b(),created:n,createdAt:t}}function X(e,t){for(var n={session:[L,D],page:[N,_]}[e],r=n[0],i=n[1],o=W(),s=!1,a={},c=0;c<V.length;c++){var u=V[c],l="__"+e+"__session__"+u,d=r(l);s=t||!d;var f=d&&!t?d:i(l,o[u]),h="created"!==u?f:Number(f);a[u]=h}return F(a,s)}function F(e,t){var n=Date.now();return e.elapsed=n-e.created,e.expires&&(e.remaining=Math.abs(e.expires-n)),e.isNew=t,e}function B(e,t){void 0===e&&(e=30);var n=z("__session"),r=n?JSON.parse(n):G(e);return t?r:F(r,!n)}function G(e,t,n){void 0===e&&(e=30);var r=n?B(e,!0):W(),i=60*e,o=r.created;if(n){var s=q(),a=s[0],c=s[1];r.modified=c,r.modifiedAt=a,o=c}var u=q(o+1e3*i),l=u[0];return r.expires=u[1],r.expiresAt=l,t&&(r=Object.assign(r,t)),K("__session",JSON.stringify(r),i),F(r,!n)}var J=function(e,t){return void 0===e&&(e=30),G(e||1,t,!0)},Q=X.bind(null,"session"),Y=X.bind(null,"session",!0),$=X.bind(null,"page"),Z=X.bind(null,"page",!0),ee=function(){};var te=function(){if(typeof te!==M)return te;te=!0;try{typeof localStorage!==M&&typeof JSON!==M||(te=!1),localStorage.setItem(M,M),localStorage.removeItem(M)}catch(e){te=!1}return te}();function ne(e){return te?localStorage.getItem(e):N(e)}var re="object",ie="string",oe="?",se="name",ae="version",ce="",ue="function",le="undefined",de={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2000:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},fe=[[/microsoft (windows) (vista|xp)/i],[se,ae],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[se,[ae,he,de]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[se,"Windows"],[ae,he,de]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[ae,/_/g,"."],[se,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[se,"MacOS"],[ae,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[ae,se],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[se,ae],[/\(bb(10);/i],[ae,[se,"BlackBerry"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[ae,[se,"Firefox OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[ae,[se,"webOS"]],[/crkey\/([\d\.]+)/i],[ae,[se,"Chromecast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[se,"Chromium OS"],ae],[/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/(unix) ?([\w\.]*)/i],[se,ae]];function he(e,t){for(var n in t)if(o(t[n])===re&&t[n].length>0){for(var r=0;r<t[n].length;r++)if(pe(t[n][r],e))return n===oe?void 0:n}else if(pe(t[n],e))return n===oe?void 0:n;return e}function pe(e,t){return o(e)===ie&&-1!==ge(t).indexOf(ge(e))}function ge(e){return e.toLowerCase()}function ve(e){var t=e||(("undefined"==typeof window?"undefined":o(window))!==le&&window.navigator&&window.navigator.userAgent?window.navigator.userAgent:ce),n={};return n[se]=void 0,n[ae]=void 0,function(e,t){for(var n,r,i,s,a,c,u=0;u<t.length&&!a;){var l=t[u],d=t[u+1];for(n=r=0;n<l.length&&!a;)if(a=l[n++].exec(e))for(i=0;i<d.length;i++)c=a[++r],s=d[i],o(s)===re&&s.length>0?2==s.length?o(s[1])==ue?this[s[0]]=s[1].call(this,c):this[s[0]]=s[1]:3==s.length?o(s[1])!==ue||s[1].exec&&s[1].test?this[s[0]]=c?c.replace(s[1],s[2]):void 0:this[s[0]]=c?s[1].call(this,c,s[2]):void 0:4==s.length&&(this[s[0]]=c?s[3].call(this,c.replace(s[1],s[2])):void 0):this[s]=c||void 0;u+=2}}.call(n,t,fe),n}var ye="Brave";function me(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})[e]||e}var we=["PUSH","GCM","APNS","APNS_SANDBOX","APNS_VOIP","APNS_VOIP_SANDBOX","ADM","SMS","VOICE","EMAIL","BAIDU","CUSTOM"].reduce(function(e,t){return e[t]=t,e},{}),be="_session.start",Se="_session.stop",xe="pageView",Ae=Object.freeze({SESSION_START:be,SESSION_STOP:Se,SESSION_PAUSE:"_session.pause",SESSION_RESUME:"_session.resume",AUTH_SIGN_IN:"_userauth.sign_in",AUTH_SIGN_UP:"_userauth.sign_up",AUTH_FAIL:"_userauth.auth_fail",ECOM_PURCHASE:"_monetization.purchase",PAGE_VIEW:xe}),Ee="undefined"!=typeof window,ke=be,Ie=Se,Oe=("undefined"!=typeof navigator&&navigator&&navigator.sendBeacon,"__endpoint"),Te=[429,500],je=[202],Pe=400,Me=function(){if("undefined"==typeof window)return{};if(!window.navigator)return{};var e,t,n,r,i,o=window.navigator,s=o.platform,a=o.product,c=o.vendor,u=(o.userAgent,function(e){var t=e.userAgent,n=/.+(Opera[\s[A-Z]*|OPR[\sA-Z]*)\/([0-9\.]+).*/i.exec(t);if(n)return{type:n[1],version:n[2]};var r=/.+(Trident|Edge)\/([0-9\.]+).*/i.exec(t);if(r)return{type:r[1],version:r[2]};var i=/(headlesschrome)(?:\/([\w\.]+)| )/i.exec(t);if(i)return{type:i[1],version:i[2]};var o=/.+(Chrome|Firefox|FxiOS)\/([0-9\.]+).*/i.exec(t);if(o){var s=e.brave&&e.brave.isBrave||!1;return{type:s?ye:o[1],version:o[2]}}var a=/.+(Safari)\/([0-9\.]+).*/i.exec(t);if(a)return{type:a[1],version:a[2]};var c=/.+(AppleWebKit)\/([0-9\.]+).*/i.exec(t);if(c)return{type:c[1],version:c[2]};var u=/.*([A-Z]+)\/([0-9\.]+).*/i.exec(t)||["","NA","0.0.0"];return{type:u[1],version:u[2]}}(window.navigator)),l=u.type,d=u.version,f=l===ye?l:(c||"").split(" ")[0];return{platform:s,os:ve(),make:f||a,model:l,version:d,name:[l,d].join("/"),language:(t=window.navigator,n=t.language,r=t.browserLanguage,i=t.languages,(n||r||(i||["en_US"])[0]).toLowerCase().replace("-","_")),timezone:(e=/\(([A-Za-z\s].*)\)/.exec((new Date).toString()),e&&e[1]||"")}}();function Ne(){return{}}var _e=/.+\@.+\..+/;function Ue(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=r({getContext:e.getContext||Ne,credentials:e.credentials||{},getEndpointId:e.getEndpointId},e),n=t.debug?console.log:function(){},i=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.getEndpointId,n=e.debug;return function(){var r=c(s.mark(function r(){var i,a,c,u,l,d,f,h,p,g=arguments;return s.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return i=g.length>0&&void 0!==g[0]?g[0]:[],a=g.length>1&&void 0!==g[1]?g[1]:{},r.next=4,t();case 4:if(c=r.sent){r.next=8;break}return console.error("No endpoint id. check getEndpointId()"),r.abrupt("return");case 8:if("object"===o(a)&&Object.keys(a).length){r.next=13;break}r.t0=Le(c),r.next=16;break;case 13:return r.next=15,Be(a,e);case 15:r.t0=r.sent;case 16:return u=r.t0,l=u.ChannelType,u.Address&&(s=u.Address,_e.test(s))&&(l=we.EMAIL),!l&&u.Address&&(l="android"===Me.platform?l||we.GCM:l||we.APNS),n&&(console.log("Endpoint",u),l&&console.log("CHANNEL_TYPE",l)),u.RequestId=b(),u.ChannelType=l,u.Address&&(u.OptOut=u.OptOut||"NONE"),d=He(i),f=ze(c,u,d),r.prev=26,r.next=29,Ve(f,e);case 29:h=r.sent,r.next=36;break;case 32:r.prev=32,r.t1=r.catch(26),console.log("Error calling AWS",r.t1),p=r.t1;case 36:return r.abrupt("return",{endpoint:u,response:h,error:p,events:i});case 37:case"end":return r.stop()}var s},r,null,[[26,32]])}));return function(){return r.apply(this,arguments)}}()}(t),a=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(){var n=c(s.mark(function n(r){var i,o,a,c,u=arguments;return s.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return i=u.length>1&&void 0!==u[1]?u[1]:{},o=u.length>2&&void 0!==u[2]?u[2]:{},a=u.length>3&&void 0!==u[3]&&u[3],"boolean"==typeof i&&(a=i={}),"boolean"==typeof o&&(a=o={}),n.next=7,Ke(r,i,t);case 7:if(c=n.sent,!Object.entries(o).length&&r!==xe){n.next=12;break}return n.next=11,Be(o,t);case 11:o=n.sent;case 12:if(e.push(c),!a){n.next=17;break}return n.abrupt("return",e.flush());case 17:case"end":return n.stop()}},n)}));return function(e){return n.apply(this,arguments)}}()}(function(e,t){var n,r,i,o=(t=t||{}).initial||[],s=t.max||1/0,a=t.interval||1e4,c=t.onEmpty||ee,u=t.onPause||ee;function l(t){clearInterval(n);var r=o.splice(0,s);return r.length&&e(r,o),o.length?t?l():d():(i=!1,c(o))}function d(){i=!0,n=setInterval(l,a)}return o.length&&d(),{flush:function(e){l(e)},resume:l,push:function(e){return(r=o.push(e))>=s&&!t.throttle&&l(),i||d(),r},size:function(){return o.length},pause:function(e){e&&l(),clearInterval(n),i=!1,u(o)}}}(function(){var e=c(s.mark(function e(t,r){var o;return s.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t.forEach(function(e){return n(">>>>> PROCESS queue",e)}),e.next=3,i(t,{});case 3:o=e.sent,n(">>>>> PROCESS queue response",o);case 5:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}(),{max:10,interval:3e3,throttle:!0}),t);Be({},e);var u=function(e){if(!Ee)return Ne;var t=function(e){return function(){e(Ie,!0)}}(e);return window.addEventListener("beforeunload",t),function(){return window.removeEventListener("beforeunload",t)}}(a);return{updateEndpoint:function(e){return i([],e)},recordEvent:a,disable:function(){u()}}}function Ce(e){return"".concat(Oe,".").concat(e)}function Le(e){try{return JSON.parse(ne(Ce(e)))||{}}catch(e){}return{}}function De(e,t){var n,r,i=Ce(e),o="string"==typeof t?t:JSON.stringify(t);return n=i,r=o,te?localStorage.setItem(n,r):_(n,r),t}function He(e){return e.sort(function(e,t){var n=e.EventType,r=t.EventType;return n==ke?-1:r==ke?1:n==Ie?1:r==Ie?-1:void 0}).reduce(function(e,t){return r({},t,{},e)},{})}function ze(e,n,r){return{BatchItem:t({},e,{Endpoint:n,Events:r})}}function Ke(e){return Re.apply(this,arguments)}function Re(){return(Re=c(s.mark(function e(n){var i,o,a,c,u,l,d,f,h,p,g,v,y,m,w,S,x,A,E,k,I,O,T,j,P,M,N,_,U,C,L,D=arguments;return s.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i=D.length>1&&void 0!==D[1]?D[1]:{},o=D.length>2&&void 0!==D[2]?D[2]:{},a=o.appTitle,c=o.appPackageName,u=o.appVersionCode,l=o.eventMapping,d=o.enrichEventAttributes,f=o.enrichEventMetrics,h=o.debug,p=h?console.log:function(){},g=me(n,l),v=$(),y=Q(),m=Ee?B():{},w=i.sessionId||m.id,S=i.sessionStart||m.createdAt,x=i.sessionStart?new Date(i.sessionStart).getTime():m.created,p("event pageSessionInfo",JSON.stringify(v)),p("event tabSessionData ",JSON.stringify(y)),p("event sessionData ",JSON.stringify(m)),A=i.attributes||{},E=i.eventId||b(),k=i.time?new Date(i.time):new Date,I=k.toISOString(),O=k.getTime()-x,T=r({date:I,sessionId:w},Ee?{pageSession:v.id}:{}),!d){e.next=26;break}return e.next=23,d();case 23:e.t0=e.sent,e.next=27;break;case 26:e.t0={};case 27:if(j=e.t0,P=r({},T,{},j,{},A),M=i.metrics||{},N={sessionTime:m.elapsed||O,hour:k.getHours(),day:k.getDay()+1,month:k.getMonth()+1,year:k.getFullYear()},!f){e.next=37;break}return e.next=34,f();case 34:e.t1=e.sent,e.next=38;break;case 37:e.t1={};case 38:return _=e.t1,U=r({},N,{},_,{},M),e.next=42,nt(P);case 42:return e.t2=e.sent,e.next=45,ot(U);case 45:return e.t3=e.sent,C={attributes:e.t2,metrics:e.t3},p("".concat(E,":").concat(g)),p("eventAttributes",C.attributes),p("eventMetrics",C.metrics),p("clientInfo",Me),Xe(o),L=t({},E,{EventType:g,Timestamp:I,AppPackageName:c,AppTitle:a,AppVersionCode:u,Attributes:C.attributes,Metrics:C.metrics,Session:{Id:w,StartTimestamp:S}}),n===Se&&(L[E].Session.Duration=O,L[E].Session.StopTimestamp=I),e.abrupt("return",L);case 55:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Ve(e,t){return qe.apply(this,arguments)}function qe(){return(qe=c(s.mark(function e(t,n){var r,i,o,a,c,u,l,d,f,h,p,g,v,y,m,w,b;return s.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=n.pinpointRegion,i=n.pinpointAppId,o=n.lambdaArn,a=n.lambdaRegion,c=n.credentials,u=n.getCredentials,n.debug,l=c,Object.keys(l).length||!u){e.next=12;break}return e.prev=3,e.next=6,u();case 6:l=e.sent,e.next=12;break;case 9:throw e.prev=9,e.t0=e.catch(3),new Error(e.t0);case 12:return d={accessKeyId:l.accessKeyId||l.AccessKeyId,secretAccessKey:l.secretAccessKey||l.SecretKey,sessionToken:l.sessionToken||l.SessionToken,retries:5},f=new E(d),h=a||r,p=r||a,g=!0===n.fips?"-fips":"",v="https://lambda.".concat(h,".amazonaws.com/2015-03-31/functions/").concat(o,"/invocations"),y="https://pinpoint".concat(g,".").concat(p,".amazonaws.com/v1/apps/").concat(i,"/events"),m=o?v:y,w={body:JSON.stringify(t)},e.next=23,f.fetch(m,w).then(function(e){return e.json()});case 23:return(b=e.sent)&&b.Results&&Object.keys(b.Results).map(function(e){return b.Results[e]}).forEach(function(e){var t=e.EndpointItemResponse||{},n=e.EventsItemResponse||{};Object.keys(t).length&&(je.includes(t.StatusCode)||Te.includes(t.StatusCode)||We(t,Endpoint));var r=Object.keys(n);r.length&&r.forEach(function(e){})}),e.abrupt("return",b);case 26:case"end":return e.stop()}},e,null,[[3,9]])}))).apply(this,arguments)}function We(e,t){var n=e.StatusCode,r=e.Message;if(n===Pe){if(r.startsWith("Missing ChannelType"))throw new Error("Missing ChannelType");if(r.startsWith("Exceeded maximum endpoint per user count"))throw new Error("Exceeded maximum endpoint per user count")}}function Xe(e){var t=e.appTitle||e.appPackageName||"",n=e.appVersionCode||"0.0.0";return t?"".concat(t,"@").concat(n):n}var Fe=!1;function Be(){return Ge.apply(this,arguments)}function Ge(){return(Ge=c(s.mark(function e(){var t,n,r,i,o,a,c,u,l,d,f,h,p,g,v,m,w,b,S,x,A=arguments;return s.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=A.length>0&&void 0!==A[0]?A[0]:{},n=A.length>1&&void 0!==A[1]?A[1]:{},r=n.getUserId,i=n.getEndpointId,n.enrichUserAttributes,o=n.endpointMigration,a=Qe(n),c=a.sessionKey?a.sessionKey():"sessions",u=a.pageViewKey?a.pageViewKey():"pageViews",l=$(),d=l.id,f=B(),e.next=11,i();case 11:if(h=e.sent,Fe||(Fe=!0,(p=ne(Oe))&&(De(h,p),s=Oe,te?localStorage.removeItem(s):U(s))),g=Le(h),v=Xe(n),m={AppVersion:v,Locale:Me.language,Make:Me.make,Model:Me.model,ModelVersion:Me.version,Platform:Me.os.name||Me.platform},Me.os&&Me.os.version&&(m.PlatformVersion=Me.os.version),w={Attributes:{},Demographic:m,Location:{},Metrics:{}},Me.device&&Me.device.vendor&&(w.Attributes.DeviceMake=[Me.device.vendor]),Me.device&&Me.device.model&&(w.Attributes.DeviceModel=[Me.device.model]),Me.device&&Me.device.type&&(w.Attributes.DeviceType=[Me.device.type]),!(t=y.all([g,w,t],{arrayMerge:Je})).User||!t.User.UserId){e.next=27;break}return e.next=25,r();case 25:b=e.sent,t.User.UserId!==b&&(t.User.UserId=b);case 27:if(t.User&&t.User.UserId){e.next=32;break}return e.next=30,r();case 30:(S=e.sent)&&(t.User=t.User||{},t.User.UserId=S);case 32:if(!t.User||!t.User.UserAttributes){e.next=36;break}return e.next=35,nt(t.User.UserAttributes,!0);case 35:t.User.UserAttributes=e.sent;case 36:return e.next=38,nt(t.Attributes,!0);case 38:return t.Attributes=e.sent,e.next=41,ot(t.Metrics);case 41:if(t.Metrics=e.sent,t.Metrics[c]||(t.Metrics[c]=1),t.Metrics[u]||(t.Metrics[u]=1),o&&(t=o(h,t)),x=t.Attributes.lastSession){e.next=51;break}return t.Attributes.lastSessionDate=[f.createdAt],t.Attributes.lastSession=[f.id],t.Attributes.lastPageSession=[d],e.abrupt("return",De(h,t));case 51:return x&&x[0]!==f.id&&(t.Attributes.lastSessionDate=[f.createdAt],t.Attributes.lastSession=[f.id],t.Metrics[c]+=1),t.Attributes.lastPageSession[0]!==d&&(t.Attributes.lastPageSession=[d],t.Metrics[u]+=1),e.abrupt("return",De(h,t));case 54:case"end":return e.stop()}var s},e)}))).apply(this,arguments)}function Je(e,t){return t}function Qe(e){var t=e.getContext;return"function"==typeof t?t():t}function Ye(e,t){return $e.apply(this,arguments)}function $e(){return($e=c(s.mark(function e(t,n){return s.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("function"!=typeof t){e.next=4;break}return e.next=3,t();case 3:t=e.sent;case 4:return e.abrupt("return",n(t));case 5:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Ze(e){if(null!=e)return Array.isArray(e)?e.filter(et).map(function(e){return e.toString()}):tt(e)?e:e.toString()}function et(e){return null!=e}function tt(e){return null==e}function nt(e){return rt.apply(this,arguments)}function rt(){return(rt=c(s.mark(function e(t){var n,r,i,o,a,c,u=arguments;return s.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=u.length>1&&void 0!==u[1]&&u[1],r={},e.t0=s.keys(t);case 3:if((e.t1=e.t0()).done){e.next=13;break}return i=e.t1.value,o=Array.isArray(t[i])?t[i]:[t[i]],a=n?o:o[0],e.next=9,Ye(a,Ze);case 9:tt(c=e.sent)||(r[i]=c),e.next=3;break;case 13:return e.abrupt("return",r);case 14:case"end":return e.stop()}},e)}))).apply(this,arguments)}function it(e){return parseFloat(Number(Array.isArray(e)?e[0]:e))}function ot(e){return st.apply(this,arguments)}function st(){return(st=c(s.mark(function e(t){var n,r;return s.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n={},e.t0=s.keys(t);case 2:if((e.t1=e.t0()).done){e.next=9;break}return r=e.t1.value,e.next=6,Ye(t[r],it);case 6:n[r]=e.sent,e.next=2;break;case 9:return e.abrupt("return",n);case 10:case"end":return e.stop()}},e)}))).apply(this,arguments)}function at(e,t){if("string"==typeof e)return t?at(document.querySelectorAll(e)):e.split(" ").map(function(e){return e.trim()});if(NodeList.prototype.isPrototypeOf(e)){for(var n=[],r=e.length>>>0;r--;)n[r]=e[r];return n}return function(e){return"[object Array]"===Object.prototype.toString.call(e)}(e)?e:[e]}function ct(e,t){return t&&t.once?function(e,t){var n;return function(){return e&&(n=e.apply(t||this,arguments),e=null),n}}(e):e}var ut,lt=(ut="Event",function(e,t,n,r){var i=n||m;if(!w)return i;var o=r||!1,s=at(t),a=at(e,!0),c=[];if(!a.length)throw new Error("noElements");if(!s.length)throw new Error("noEvent");return function e(t){var n=t?"addEventListener":"removeEventListener";t&&(c=[]);for(var r=0;r<a.length;r++){var u=a[r];c[r]=t?ct(i,o):c[r]||i;for(var l=0;l<s.length;l++)u[n]?u[n](s[l],c[r],o):u["on"+s[l]]=t?c[r]:null}return e.bind(null,!t)}(ut)}),dt="undefined"==typeof window,ft="hidden";function ht(e){if(dt)return!1;var t=dt||ft in document?ft:["webkit","moz","ms","o"].reduce(function(e,t){var n=t+"Hidden";return!e&&n in document?n:e},null),n="".concat(t.replace(/[H|h]idden/,""),"visibilitychange"),r=function(){return e(Boolean(document[t]))},i=function(){return document.addEventListener(n,r)};return i(),function(){return document.removeEventListener(n,r),i}}var pt=["mousemove","mousedown","touchmove","touchstart","touchend","keydown"];function gt(e){var t,n,r=e.onIdle,i=e.onWakeUp,o=e.onHeartbeat,s=e.timeout,a=void 0===s?1e4:s,c=e.throttle,u=void 0===c?2e3:c,l=!1,d=!1,f=new Date,h=function(){return clearTimeout(t)};function p(e){h(),o&&!l&&o(vt(f),e),i&&l&&(l=!1,i(vt(n),e),f=new Date),t=setTimeout(function(){l=!0,r&&(n=new Date,r(vt(f),e))},a)}var g=function(e,t){void 0===t&&(t={});var n=function(e,t){var n=this,r=!1;return function(i){r||(e.call(n,i),r=!0,setTimeout(function(){return r=!1},t))}}(e,t.throttle||1e4),r=[];function i(){var e=ht(function(e){e||n({type:"tabVisible"})});return r=[e].concat(pt.map(function(e){return lt(document,e,n)})).concat(lt(window,"load",n)).concat(lt(window,"scroll",n,{capture:!0,passive:!0})),o}function o(){r.map(function(e){return e()})}return i(),function(){return o(),i}}(p,{throttle:u});return{disable:function(){d=!0,l=!1,h();var e=g();return function(){return d=!1,f=new Date,p({type:"load"}),e()}},getStatus:function(){return{isIdle:l,isDisabled:d,active:l?0:vt(f,d),idle:l?vt(n,d):0}}}}function vt(e,t){return t?0:Math.round((new Date-e)/1e3)}var yt={disableAnonymousTraffic:!1,pinpointRegion:"us-east-1",eventMapping:{}};function mt(){throw new Error("Pinpoint not loaded")}var wt=function(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=!1;return{name:"aws-pinpoint",config:r({},yt,{},n),bootstrap:function(e){var t=e.config,n=e.instance;t.disableAnonymousTraffic&&!n.user("userId")&&n.once("identifyStart",function(e){e.plugins["aws-pinpoint"].loaded()||n.loadPlugin("aws-pinpoint")})},initialize:function(i){var o=i.config,s=i.instance,a=o.disableAnonymousTraffic,c=o.debug?console.log:function(){},u=s.getState(),l=u.user||{},d=l.userId,f=l.anonymousId,h=u.context||{},p=h.app,g=h.version,v=h.campaign,y=$(),m=Q(),w=B();if(c("initPageSession",y),c("initTabSession",m),c("initSessionData",w),w&&w.anonId&&w.anonId!==f){c("anonId different refresh session details"),Z(),Y();var b=G(30,{anonId:f,userId:d});c("newSessionForNewUser",b)}if(!d&&a)return!1;var S=Object.keys(v).reduce(function(e,t){return e["utm_".concat(t)]=v[t],e},{}),x=Ue(r({},o,{appTitle:o.appTitle||p,appPackageName:o.appPackageName||p,appVersionCode:o.appVersionCode||g,eventMapping:o.eventMapping,getEndpointId:function(){return s.user("anonymousId")},getUserId:function(){return s.user("userId")},getContext:function(){return{sessionKey:o.sessionKey,pageViewKey:o.pageViewKey,initialSession:w}},enrichEventAttributes:function(){return r({anonId:s.user("anonymousId"),userId:s.user("userId"),hash:window.location.hash,path:window.location.pathname,referrer:document.referrer,search:window.location.search,title:document.title,host:window.location.hostname,url:window.location.origin+window.location.pathname},S)},enrichUserAttributes:o.enrichUserAttributes,enrichEventMetrics:function(){return{}}}));e=x.recordEvent,t=x.updateEndpoint,w&&w.isNew&&(c("Start brand new session because cookie not found"),e(be)),gt({timeout:18e5,throttle:2e4,onIdle:function(t,r){var i;c("Session idle. Active ".concat(t," seconds")),i=B(),n.debug&&console.log("Stop session",i),e(Se,!0)},onWakeUp:function(t,r){var i;c("Session wakeup. Idle ".concat(t," seconds")),i=G(30),n.debug&&console.log("START SESSION",i),e(be)},onHeartbeat:function(e,t){c("ping session",new Date),c("total active time",e);var n=s.user();J(30,{anonId:n.anonymousId,userId:n.userId})}})},page:function(t){if(t.payload,t.config,!e)return mt();i&&Z(),e(xe),i=!0},track:function(t){var n=t.payload,r=t.config;if(t.instance,!e)return mt();if(!r.disableAnonymousTraffic||n.userId){var i,o=(i=n.properties,Object.keys(i).reduce(function(e,t){var n=i[t];return"number"==typeof n&&(e.metrics[t]=n),"string"!=typeof n&&"boolean"!=typeof n||(e.attributes[t]=n),e},{attributes:{},metrics:{}}));e(n.event,o)}},identify:function(e){var n=e.payload,r=n.userId,i=n.traits;if(!t)return mt();var o={},s={};r&&(s.UserId=r),i&&Object.keys(i).length&&(s.UserAttributes=i),i.email&&(o.Address=i.email,o.ChannelType=we.EMAIL),Object.keys(s).length&&(o.User=s),t(o,!0)},reset:function(e){var t=Ce(e.instance.user("anonymousId"));storage.removeItem(t)},loaded:function(){return!!e}}};return e.default=wt,e.PINPOINT_EVENTS=Ae,e.formatEvent=Ke,e}({}); | ||
var analyticsAWSPinpoint=function(e){"use strict";var t=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e};function n(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}var r=function(e){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?n(Object(i),!0).forEach(function(n){t(e,n,i[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):n(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e};function i(e,t){return e(t={exports:{}},t.exports),t.exports}var o=i(function(e){var t=function(e){var t,n=Object.prototype,r=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",a=i.toStringTag||"@@toStringTag";function c(e,t,n,r){var i=t&&t.prototype instanceof v?t:v,o=Object.create(i.prototype),s=new O(r||[]);return o._invoke=function(e,t,n){var r=l;return function(i,o){if(r===d)throw new Error("Generator is already running");if(r===p){if("throw"===i)throw o;return j()}for(n.method=i,n.arg=o;;){var s=n.delegate;if(s){var a=E(s,n);if(a){if(a===h)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===l)throw r=p,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=d;var c=u(e,t,n);if("normal"===c.type){if(r=n.done?p:f,c.arg===h)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r=p,n.method="throw",n.arg=c.arg)}}}(e,n,s),o}function u(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var l="suspendedStart",f="suspendedYield",d="executing",p="completed",h={};function v(){}function g(){}function y(){}var m={};m[o]=function(){return this};var w=Object.getPrototypeOf,b=w&&w(w(T([])));b&&b!==n&&r.call(b,o)&&(m=b);var x=y.prototype=v.prototype=Object.create(m);function S(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function A(e,t){var n;this._invoke=function(i,o){function s(){return new t(function(n,s){!function n(i,o,s,a){var c=u(e[i],e,o);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==typeof f&&r.call(f,"__await")?t.resolve(f.__await).then(function(e){n("next",e,s,a)},function(e){n("throw",e,s,a)}):t.resolve(f).then(function(e){l.value=e,s(l)},function(e){return n("throw",e,s,a)})}a(c.arg)}(i,o,n,s)})}return n=n?n.then(s,s):s()}}function E(e,n){var r=e.iterator[n.method];if(r===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method))return h;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var i=u(r,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,h;var o=i.arg;return o?o.done?(n[e.resultName]=o.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,h):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}function k(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(k,this),this.reset(!0)}function T(e){if(e){var n=e[o];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,s=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return s.next=s}}return{next:j}}function j(){return{value:t,done:!0}}return g.prototype=x.constructor=y,y.constructor=g,y[a]=g.displayName="GeneratorFunction",e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,y):(e.__proto__=y,a in e||(e[a]="GeneratorFunction")),e.prototype=Object.create(x),e},e.awrap=function(e){return{__await:e}},S(A.prototype),A.prototype[s]=function(){return this},e.AsyncIterator=A,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var s=new A(c(t,n,r,i),o);return e.isGeneratorFunction(n)?s:s.next().then(function(e){return e.done?e.value:s.next()})},S(x),x[a]="Generator",x[o]=function(){return this},x.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=T,O.prototype={constructor:O,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(I),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return a.type="throw",a.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var c=r.call(s,"catchLoc"),u=r.call(s,"finallyLoc");if(c&&u){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(c){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=e,s.arg=t,o?(this.method="next",this.next=o.finallyLoc,h):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),h},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),I(n),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;I(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:T(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),h}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}});function s(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}var a=function(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){s(o,r,i,a,c,"next",e)}function c(e){s(o,r,i,a,c,"throw",e)}a(void 0)})}},c=function(){};var u=function(){},l="undefined"!=typeof window;function f(){for(var e="",t=0,n=4294967295*Math.random()|0;t++<36;){var r="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"[t-1],i=15&n;e+="-"==r||"4"==r?r:("x"==r?i:3&i|8).toString(16),n=t%8==0?4294967295*Math.random()|0:n>>4}return e}var d="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||void 0,p="undefined";function h(e){return d[e]}function v(e,t){return d[e]=t,t}function g(e){v(e)}var y=function(){if(typeof y!==p)return y;y=!0;try{sessionStorage.setItem(p,p),sessionStorage.removeItem(p)}catch(e){y=!1}return y}();function m(e){return y?sessionStorage.getItem(e)||void 0:h(e)}function w(e,t){return y?sessionStorage.setItem(e,t):v(e,t)}var b=function(){if(typeof b!==p)return b;try{A("__x","__x"),b=-1!==document.cookie.indexOf("__x"),e="__x",b?A(e,"",-1):g(e)}catch(e){b=!1}var e;return b}(),x=A,S=A;function A(e,t,n,r,i,o){if(typeof window!==p){var s=arguments.length>1;return b||(s?v(e,t):h(e)),s?document.cookie=e+"="+encodeURIComponent(t)+(n?"; expires="+new Date(+new Date+1e3*n).toUTCString()+(r?"; path="+r:"")+(i?"; domain="+i:"")+(o?"; secure":""):""):decodeURIComponent((("; "+document.cookie).split("; "+e+"=")[1]||"").split(";")[0])}}var E=["id","createdAt","created"];function k(e){var t=e?new Date(e):new Date;return[t.toISOString(),t.getTime()]}function I(){var e=k(),t=e[0],n=e[1];return{id:f(),created:n,createdAt:t}}function O(e,t){for(var n={session:[m,w],page:[h,v]}[e],r=n[0],i=n[1],o=I(),s=!1,a={},c=0;c<E.length;c++){var u=E[c],l="__"+e+"__session__"+u,f=r(l);s=t||!f;var d=f&&!t?f:i(l,o[u]),p="created"!==u?d:Number(d);a[u]=p}return T(a,s)}function T(e,t){var n=Date.now();return e.elapsed=n-e.created,e.expires&&(e.remaining=Math.abs(e.expires-n)),e.isNew=t,e}function j(e,t){void 0===e&&(e=30);var n=x("__session"),r=n?JSON.parse(n):P(e);return t?r:T(r,!n)}function P(e,t,n){void 0===e&&(e=30);var r=n?j(e,!0):I(),i=60*e,o=r.created;if(n){var s=k(),a=s[0],c=s[1];r.modified=c,r.modifiedAt=a,o=c}var u=k(o+1e3*i),l=u[0];return r.expires=u[1],r.expiresAt=l,t&&(r=Object.assign(r,t)),S("__session",JSON.stringify(r),i),T(r,!n)}var _=function(e,t){return void 0===e&&(e=30),P(e||1,t,!0)},N=O.bind(null,"session"),M=O.bind(null,"session",!0),U=O.bind(null,"page"),C=O.bind(null,"page",!0),L="undefined"!=typeof window;function D(e){return"boolean"==typeof e}var H=i(function(e){function t(n){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=t=function(e){return typeof e}:e.exports=t=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(n)}e.exports=t}),z="object",K="string",R="?",V="name",q="version",W="",X="function",F="undefined",B={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2000:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},G=[[/microsoft (windows) (vista|xp)/i],[V,q],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[V,[q,J,B]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[V,"Windows"],[q,J,B]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[q,/_/g,"."],[V,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[V,"MacOS"],[q,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[q,V],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[V,q],[/\(bb(10);/i],[q,[V,"BlackBerry"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[q,[V,"Firefox OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[q,[V,"webOS"]],[/crkey\/([\d\.]+)/i],[q,[V,"Chromecast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[V,"Chromium OS"],q],[/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/(unix) ?([\w\.]*)/i],[V,q]];function J(e,t){for(var n in t)if(H(t[n])===z&&t[n].length>0){for(var r=0;r<t[n].length;r++)if(Q(t[n][r],e))return n===R?void 0:n}else if(Q(t[n],e))return n===R?void 0:n;return e}function Q(e,t){return H(e)===K&&-1!==Y(t).indexOf(Y(e))}function Y(e){return e.toLowerCase()}function $(e){var t=e||(("undefined"==typeof window?"undefined":H(window))!==F&&window.navigator&&window.navigator.userAgent?window.navigator.userAgent:W),n={};return n[V]=void 0,n[q]=void 0,function(e,t){for(var n,r,i,o,s,a,c=0;c<t.length&&!s;){var u=t[c],l=t[c+1];for(n=r=0;n<u.length&&!s;)if(s=u[n++].exec(e))for(i=0;i<l.length;i++)a=s[++r],o=l[i],H(o)===z&&o.length>0?2==o.length?H(o[1])==X?this[o[0]]=o[1].call(this,a):this[o[0]]=o[1]:3==o.length?H(o[1])!==X||o[1].exec&&o[1].test?this[o[0]]=a?a.replace(o[1],o[2]):void 0:this[o[0]]=a?o[1].call(this,a,o[2]):void 0:4==o.length&&(this[o[0]]=a?o[3].call(this,a.replace(o[1],o[2])):void 0):this[o]=a||void 0;c+=2}}.call(n,t,G),n}var Z="Brave";function ee(){if("undefined"==typeof window)return{};if(!window.navigator)return{};var e,t,n,r,i,o=window.navigator,s=o.platform,a=o.product,c=o.vendor,u=(o.userAgent,function(e){var t=e.userAgent,n=/.+(Opera[\s[A-Z]*|OPR[\sA-Z]*)\/([0-9\.]+).*/i.exec(t);if(n)return{type:n[1],version:n[2]};var r=/.+(Trident|Edge)\/([0-9\.]+).*/i.exec(t);if(r)return{type:r[1],version:r[2]};var i=/(headlesschrome)(?:\/([\w\.]+)| )/i.exec(t);if(i)return{type:i[1],version:i[2]};var o=/.+(Chrome|Firefox|FxiOS)\/([0-9\.]+).*/i.exec(t);if(o){var s=e.brave&&e.brave.isBrave||!1;return{type:s?Z:o[1],version:o[2]}}var a=/.+(Safari)\/([0-9\.]+).*/i.exec(t);if(a)return{type:a[1],version:a[2]};var c=/.+(AppleWebKit)\/([0-9\.]+).*/i.exec(t);if(c)return{type:c[1],version:c[2]};var u=/.*([A-Z]+)\/([0-9\.]+).*/i.exec(t)||["","NA","0.0.0"];return{type:u[1],version:u[2]}}(window.navigator)),l=u.type,f=u.version,d=l===Z?l:(c||"").split(" ")[0];return{platform:s,os:$(),make:d||a,model:l,version:f,name:[l,f].join("/"),language:(t=window.navigator,n=t.language,r=t.browserLanguage,i=t.languages,(n||r||(i||["en_US"])[0]).toLowerCase().replace("-","_")),timezone:(e=/\(([A-Za-z\s].*)\)/.exec((new Date).toString()),e&&e[1]||"")}}function te(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})[e]||e}function ne(e){return re.apply(this,arguments)}function re(){return(re=a(o.mark(function e(t){var n,r,i,s,a,c,u=arguments;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=u.length>1&&void 0!==u[1]&&u[1],r={},e.t0=o.keys(t);case 3:if((e.t1=e.t0()).done){e.next=13;break}return i=e.t1.value,s=Array.isArray(t[i])?t[i]:[t[i]],a=n?s:s[0],e.next=9,se(a,ce);case 9:fe(c=e.sent)||(r[i]=c),e.next=3;break;case 13:return e.abrupt("return",r);case 14:case"end":return e.stop()}},e)}))).apply(this,arguments)}function ie(e){return oe.apply(this,arguments)}function oe(){return(oe=a(o.mark(function e(t){var n,r;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n={},e.t0=o.keys(t);case 2:if((e.t1=e.t0()).done){e.next=9;break}return r=e.t1.value,e.next=6,se(t[r],ue);case 6:n[r]=e.sent,e.next=2;break;case 9:return e.abrupt("return",n);case 10:case"end":return e.stop()}},e)}))).apply(this,arguments)}function se(e,t){return ae.apply(this,arguments)}function ae(){return(ae=a(o.mark(function e(t,n){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("function"!=typeof t){e.next=4;break}return e.next=3,t();case 3:t=e.sent;case 4:return e.abrupt("return",n(t));case 5:case"end":return e.stop()}},e)}))).apply(this,arguments)}function ce(e){if(null!=e)return Array.isArray(e)?e.filter(le).map(function(e){return e.toString()}):fe(e)?e:e.toString()}function ue(e){return parseFloat(Number(Array.isArray(e)?e[0]:e))}function le(e){return null!=e}function fe(e){return null==e}var de="_session.start",pe="_session.stop",he="pageView",ve=Object.freeze({SESSION_START:de,SESSION_STOP:pe,SESSION_PAUSE:"_session.pause",SESSION_RESUME:"_session.resume",AUTH_SIGN_IN:"_userauth.sign_in",AUTH_SIGN_UP:"_userauth.sign_up",AUTH_FAIL:"_userauth.auth_fail",ECOM_PURCHASE:"_monetization.purchase",PAGE_VIEW:he});function ge(e){return ye.apply(this,arguments)}function ye(){return(ye=a(o.mark(function e(n){var i,s,a,c,u,l,d,p,h,v,g,y,m,w,b,x,S,A,E,k,I,O,T,P,_,M,C,D,H,z,K,R=arguments;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i=R.length>1&&void 0!==R[1]?R[1]:{},s=R.length>2&&void 0!==R[2]?R[2]:{},a=s.appTitle,c=s.appPackageName,u=s.appVersionCode,l=s.eventMapping,d=s.enrichEventAttributes,p=s.enrichEventMetrics,h=s.debug,v=h?console.log:function(){},g=te(n,l),y=j(),m=i.sessionId||y.id,w=i.sessionStart||y.createdAt,b=i.sessionStart?new Date(i.sessionStart).getTime():y.created,v("event sessionData ",JSON.stringify(y)),L&&(x=U(),S=N(),v("event pageSessionInfo",JSON.stringify(x)),v("event tabSessionData ",JSON.stringify(S))),A=i.attributes||{},E=i.eventId||f(),k=i.time?new Date(i.time):new Date,I=k.toISOString(),O=k.getTime()-b,T=r({date:I,sessionId:m},L?{pageSession:x.id}:{}),!d){e.next=23;break}return e.next=20,d();case 20:e.t0=e.sent,e.next=24;break;case 23:e.t0={};case 24:if(P=e.t0,_=r({},T,{},P,{},A),M=i.metrics||{},C={sessionTime:y.elapsed||O,hour:k.getHours(),day:k.getDay()+1,month:k.getMonth()+1,year:k.getFullYear()},!p){e.next=34;break}return e.next=31,p();case 31:e.t1=e.sent,e.next=35;break;case 34:e.t1={};case 35:return D=e.t1,H=r({},C,{},D,{},M),e.next=39,ne(_);case 39:return e.t2=e.sent,e.next=42,ie(H);case 42:return e.t3=e.sent,z={attributes:e.t2,metrics:e.t3},v("".concat(E,":").concat(g)),v("eventAttributes",z.attributes),v("eventMetrics",z.metrics),L&&v("clientInfo",ee()),K=t({},E,r({EventType:g,Timestamp:I,AppPackageName:c,AppTitle:a},u?{AppVersionCode:u}:{},{Attributes:z.attributes,Metrics:z.metrics,Session:{Id:m,StartTimestamp:w}})),n===pe&&(K[E].Session.Duration=O,K[E].Session.StopTimestamp=I),e.abrupt("return",K);case 51:case"end":return e.stop()}},e)}))).apply(this,arguments)}var me=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===we}(e)}(e)};var we="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function be(e,t){return!1!==t.clone&&t.isMergeableObject(e)?ke((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function xe(e,t,n){return e.concat(t).map(function(e){return be(e,n)})}function Se(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return e.propertyIsEnumerable(t)}):[]}(e))}function Ae(e,t){try{return t in e}catch(e){return!1}}function Ee(e,t,n){var r={};return n.isMergeableObject(e)&&Se(e).forEach(function(t){r[t]=be(e[t],n)}),Se(t).forEach(function(i){(function(e,t){return Ae(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,i)||(Ae(e,i)&&n.isMergeableObject(t[i])?r[i]=function(e,t){if(!t.customMerge)return ke;var n=t.customMerge(e);return"function"==typeof n?n:ke}(i,n)(e[i],t[i],n):r[i]=be(t[i],n))}),r}function ke(e,t,n){(n=n||{}).arrayMerge=n.arrayMerge||xe,n.isMergeableObject=n.isMergeableObject||me,n.cloneUnlessOtherwiseSpecified=be;var r=Array.isArray(t);return r===Array.isArray(e)?r?n.arrayMerge(e,t,n):Ee(e,t,n):be(t,n)}ke.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(e,n){return ke(e,n,t)},{})};var Ie=ke,Oe=function(){if(typeof Oe!==p)return Oe;Oe=!0;try{typeof localStorage!==p&&typeof JSON!==p||(Oe=!1),localStorage.setItem(p,p),localStorage.removeItem(p)}catch(e){Oe=!1}return Oe}();function Te(e){return Oe?localStorage.getItem(e):h(e)}var je="__endpoint";function Pe(e){return"".concat(je,".").concat(e)}var _e="__endpoint",Ne=!1;function Me(){return Ue.apply(this,arguments)}function Ue(){return(Ue=a(o.mark(function e(){var t,n,r,i,s,a,c,u,l,f,d,p,h,v,y,m,w,b,x,S,A,E=arguments;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=E.length>0&&void 0!==E[0]?E[0]:{},n=E.length>1&&void 0!==E[1]?E[1]:{},r=n.getUserId,i=n.getEndpointId,n.enrichUserAttributes,s=n.endpointMigration,a=Ke(n),c=a.sessionKey?a.sessionKey():"sessions",u=a.pageViewKey?a.pageViewKey():"pageViews",L&&(d=ee(),l=U(),f=l.id),p=j(),e.next=10,i();case 10:if(h=e.sent,Ne||(Ne=!0,(v=Te(_e))&&(Ce(h,v),o=_e,Oe?localStorage.removeItem(o):g(o))),y=Le(h),m=He(n),w=De(m,d),b={Attributes:{},Demographic:w,Location:{},Metrics:{}},L&&(d.device&&d.device.vendor&&(b.Attributes.DeviceMake=[d.device.vendor]),d.device&&d.device.model&&(b.Attributes.DeviceModel=[d.device.model]),d.device&&d.device.type&&(b.Attributes.DeviceType=[d.device.type])),!(t=Ie.all([y,b,t],{arrayMerge:ze})).User||!t.User.UserId){e.next=23;break}return e.next=21,r();case 21:x=e.sent,t.User.UserId!==x&&(t.User.UserId=x);case 23:if(t.User&&t.User.UserId){e.next=28;break}return e.next=26,r();case 26:(S=e.sent)&&(t.User=t.User||{},t.User.UserId=S);case 28:if(!t.User||!t.User.UserAttributes){e.next=32;break}return e.next=31,ne(t.User.UserAttributes,!0);case 31:t.User.UserAttributes=e.sent;case 32:return e.next=34,ne(t.Attributes,!0);case 34:return t.Attributes=e.sent,e.next=37,ie(t.Metrics);case 37:if(t.Metrics=e.sent,t.Metrics[c]||(t.Metrics[c]=1),t.Metrics[u]||(t.Metrics[u]=1),s&&(t=s(h,t)),A=t.Attributes.lastSession){e.next=47;break}return t.Attributes.lastSessionDate=[p.createdAt],t.Attributes.lastSession=[p.id],f&&(t.Attributes.lastPageSession=[f]),e.abrupt("return",Ce(h,t));case 47:return A&&A[0]!==p.id&&(t.Attributes.lastSessionDate=[p.createdAt],t.Attributes.lastSession=[p.id],t.Metrics[c]+=1),t.Attributes.lastPageSession[0]!==f&&(t.Attributes.lastPageSession=[f],t.Metrics[u]+=1),e.abrupt("return",Ce(h,t));case 50:case"end":return e.stop()}var o},e)}))).apply(this,arguments)}function Ce(e,t){return function(e,t){Oe?localStorage.setItem(e,t):v(e,t)}(Pe(e),"string"==typeof t?t:JSON.stringify(t)),t}function Le(e){try{return JSON.parse(Te(Pe(e)))||{}}catch(e){}return{}}function De(e,t){return L?function(e,t){var n={AppVersion:e,Locale:t.language,Make:t.make,Model:t.model,ModelVersion:t.version,Platform:t.os.name||t.platform};t.os&&t.os.version&&(n.PlatformVersion=t.os.version);return n}(e,t):function(e){return{AppVersion:e,Make:"generic server",Platform:"Node.js",PlatformVersion:process.version}}(e)}function He(e){var t=e.appTitle||e.appPackageName||"",n=e.appVersionCode||"0.0.0";return t?"".concat(t,"@").concat(n):n}function ze(e,t){return t}function Ke(e){var t=e.getContext;return"function"==typeof t?t():t}"undefined"!=typeof navigator&&navigator&&navigator.sendBeacon;const Re=new TextEncoder,Ve={appstream2:"appstream",cloudhsmv2:"cloudhsm",email:"ses",marketplace:"aws-marketplace",mobile:"AWSMobileHubService",pinpoint:"mobiletargeting",queue:"sqs","git-codecommit":"codecommit","mturk-requester-sandbox":"mturk-requester","personalize-runtime":"personalize"},qe=["authorization","content-type","content-length","user-agent","presigned-expires","expect","x-amzn-trace-id","range","connection"];class We{constructor({accessKeyId:e,secretAccessKey:t,sessionToken:n,service:r,region:i,cache:o,retries:s,initRetryMs:a}){if(null==e)throw new TypeError("accessKeyId is a required option");if(null==t)throw new TypeError("secretAccessKey is a required option");this.accessKeyId=e,this.secretAccessKey=t,this.sessionToken=n,this.service=r,this.region=i,this.cache=o||new Map,this.retries=null!=s?s:10,this.initRetryMs=a||50}async sign(e,t){if(e instanceof Request){const{method:n,url:r,headers:i,body:o}=e;null==(t=Object.assign({method:n,url:r,headers:i},t)).body&&i.has("Content-Type")&&(t.body=null!=o&&i.has("X-Amz-Content-Sha256")?o:await e.clone().arrayBuffer()),e=r}const n=new Xe(Object.assign({url:e},t,this,t&&t.aws)),r=Object.assign({},t,await n.sign());return delete r.aws,new Request(r.url.toString(),r)}async fetch(e,t){for(let n=0;n<=this.retries;n++){const r=fetch(await this.sign(e,t));if(n===this.retries)return r;const i=await r;if(i.status<500&&429!==i.status)return i;await new Promise(e=>setTimeout(e,Math.random()*this.initRetryMs*Math.pow(2,n)))}throw new Error("An unknown error occurred, ensure retries is not negative")}}class Xe{constructor({method:e,url:t,headers:n,body:r,accessKeyId:i,secretAccessKey:o,sessionToken:s,service:a,region:c,cache:u,datetime:l,signQuery:f,appendSessionToken:d,allHeaders:p,singleEncode:h}){if(null==t)throw new TypeError("url is a required option");if(null==i)throw new TypeError("accessKeyId is a required option");if(null==o)throw new TypeError("secretAccessKey is a required option");let v,g;this.method=e||(r?"POST":"GET"),this.url=new URL(t),this.headers=new Headers(n||{}),this.body=r,this.accessKeyId=i,this.secretAccessKey=o,this.sessionToken=s,a&&c||([v,g]=function(e,t){const{hostname:n,pathname:r}=e,i=n.replace("dualstack.","").match(/([^.]+)\.(?:([^.]*)\.)?amazonaws\.com(?:\.cn)?$/);let[o,s]=(i||["",""]).slice(1,3);if("us-gov"===s)s="us-gov-west-1";else if("s3"===s||"s3-accelerate"===s)s="us-east-1",o="s3";else if("iot"===o)o=n.startsWith("iot.")?"execute-api":n.startsWith("data.jobs.iot.")?"iot-jobs-data":"/mqtt"===r?"iotdevicegateway":"iotdata";else if("autoscaling"===o){const e=(t.get("X-Amz-Target")||"").split(".")[0];"AnyScaleFrontendService"===e?o="application-autoscaling":"AnyScaleScalingPlannerFrontendService"===e&&(o="autoscaling-plans")}else null==s&&o.startsWith("s3-")?(s=o.slice(3).replace(/^fips-|^external-1/,""),o="s3"):o.endsWith("-fips")?o=o.slice(0,-5):s&&/-\d$/.test(o)&&!/-\d$/.test(s)&&([o,s]=[s,o]);return[Ve[o]||o,s]}(this.url,this.headers)),this.service=a||v||"",this.region=c||g||"us-east-1",this.cache=u||new Map,this.datetime=l||(new Date).toISOString().replace(/[:-]|\.\d{3}/g,""),this.signQuery=f,this.appendSessionToken=d||"iotdevicegateway"===this.service,this.headers.delete("Host");const y=this.signQuery?this.url.searchParams:this.headers;if("s3"!==this.service||this.headers.has("X-Amz-Content-Sha256")||this.headers.set("X-Amz-Content-Sha256","UNSIGNED-PAYLOAD"),y.set("X-Amz-Date",this.datetime),this.sessionToken&&!this.appendSessionToken&&y.set("X-Amz-Security-Token",this.sessionToken),this.signableHeaders=["host",...this.headers.keys()].filter(e=>p||!qe.includes(e)).sort(),this.signedHeaders=this.signableHeaders.join(";"),this.canonicalHeaders=this.signableHeaders.map(e=>e+":"+("host"===e?this.url.host:(this.headers.get(e)||"").replace(/\s+/g," "))).join("\n"),this.credentialString=[this.datetime.slice(0,8),this.region,this.service,"aws4_request"].join("/"),this.signQuery&&("s3"!==this.service||y.has("X-Amz-Expires")||y.set("X-Amz-Expires","86400"),y.set("X-Amz-Algorithm","AWS4-HMAC-SHA256"),y.set("X-Amz-Credential",this.accessKeyId+"/"+this.credentialString),y.set("X-Amz-SignedHeaders",this.signedHeaders)),"s3"===this.service)try{this.encodedPath=decodeURIComponent(this.url.pathname.replace(/\+/g," "))}catch(e){this.encodedPath=this.url.pathname}else this.encodedPath=this.url.pathname.replace(/\/+/g,"/");h||(this.encodedPath=encodeURIComponent(this.encodedPath).replace(/%2F/g,"/")),this.encodedPath=Je(this.encodedPath);const m=new Set;this.encodedSearch=[...this.url.searchParams].filter(([e])=>{if(!e)return!1;if("s3"===this.service){if(m.has(e))return!1;m.add(e)}return!0}).map(e=>e.map(e=>Je(encodeURIComponent(e)))).sort(([e,t],[n,r])=>e<n?-1:e>n?1:t<r?-1:t>r?1:0).map(e=>e.join("=")).join("&")}async sign(){return this.signQuery?(this.url.searchParams.set("X-Amz-Signature",await this.signature()),this.sessionToken&&this.appendSessionToken&&this.url.searchParams.set("X-Amz-Security-Token",this.sessionToken)):this.headers.set("Authorization",await this.authHeader()),{method:this.method,url:this.url,headers:this.headers,body:this.body}}async authHeader(){return["AWS4-HMAC-SHA256 Credential="+this.accessKeyId+"/"+this.credentialString,"SignedHeaders="+this.signedHeaders,"Signature="+await this.signature()].join(", ")}async signature(){const e=this.datetime.slice(0,8),t=[this.secretAccessKey,e,this.region,this.service].join();let n=this.cache.get(t);if(!n){const r=await Fe("AWS4"+this.secretAccessKey,e),i=await Fe(r,this.region),o=await Fe(i,this.service);n=await Fe(o,"aws4_request"),this.cache.set(t,n)}return Ge(await Fe(n,await this.stringToSign()))}async stringToSign(){return["AWS4-HMAC-SHA256",this.datetime,this.credentialString,Ge(await Be(await this.canonicalString()))].join("\n")}async canonicalString(){return[this.method.toUpperCase(),this.encodedPath,this.encodedSearch,this.canonicalHeaders+"\n",this.signedHeaders,await this.hexBodyHash()].join("\n")}async hexBodyHash(){let e=this.headers.get("X-Amz-Content-Sha256");if(null==e){if(this.body&&"string"!=typeof this.body&&!("byteLength"in this.body))throw new Error("body must be a string, ArrayBuffer or ArrayBufferView, unless you include the X-Amz-Content-Sha256 header");e=Ge(await Be(this.body||""))}return e}}async function Fe(e,t){const n=await crypto.subtle.importKey("raw","string"==typeof e?Re.encode(e):e,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);return crypto.subtle.sign("HMAC",n,Re.encode(t))}async function Be(e){return crypto.subtle.digest("SHA-256","string"==typeof e?Re.encode(e):e)}function Ge(e){return Array.prototype.map.call(new Uint8Array(e),e=>("0"+e.toString(16)).slice(-2)).join("")}function Je(e){return e.replace(/[!'()*]/g,e=>"%"+e.charCodeAt(0).toString(16).toUpperCase())}var Qe,Ye=[429,500],$e=[202],Ze=400;function et(e,t){return tt.apply(this,arguments)}function tt(){return(tt=a(o.mark(function e(t,n){var r,i,s,a,c,u,l,f,d,p,h,v,g,y,m,w,b,x;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.pinpointRegion,i=n.pinpointAppId,s=n.lambdaArn,a=n.lambdaRegion,c=n.credentials,u=n.getCredentials,l=n.debug,e.next=3,nt(c,u);case 3:return f=e.sent,l&&console.log("pinpoint auth",f),d=a||r,p=r||a,h=!0===n.fips?"-fips":"",v="https://lambda.".concat(d,".amazonaws.com/2015-03-31/functions/").concat(s,"/invocations"),g="https://pinpoint".concat(h,".").concat(p,".amazonaws.com/v1/apps/").concat(i,"/events"),y=s?v:g,b={body:JSON.stringify(t)},m=new We(f),e.next=16,m.fetch(y,b).then(function(e){return e.json()});case 16:w=e.sent,e.next=24;break;case 19:return m=new Qe.PinpointClient({credentials:f,region:r}),x=new Qe.PutEventsCommand({ApplicationId:i,EventsRequest:t}),e.next=23,m.send(x);case 23:w=e.sent;case 24:return w&&w.Results&&Object.keys(w.Results).map(function(e){return w.Results[e]}).forEach(function(e){var t=e.EndpointItemResponse||{},n=e.EventsItemResponse||{};Object.keys(t).length&&($e.includes(t.StatusCode)||Ye.includes(t.StatusCode)||it(t,Endpoint));var r=Object.keys(n);r.length&&r.forEach(function(e){})}),e.abrupt("return",w);case 26:case"end":return e.stop()}},e)}))).apply(this,arguments)}function nt(e,t){return rt.apply(this,arguments)}function rt(){return(rt=a(o.mark(function e(t,n){var r,i;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t,Object.keys(r).length||!n){e.next=11;break}return e.prev=2,e.next=5,n();case 5:r=e.sent,e.next=11;break;case 8:throw e.prev=8,e.t0=e.catch(2),new Error(e.t0);case 11:return i={accessKeyId:r.accessKeyId||r.AccessKeyId,secretAccessKey:r.secretAccessKey||r.SecretKey,sessionToken:r.sessionToken||r.SessionToken,retries:5},e.abrupt("return",i);case 13:case"end":return e.stop()}},e,null,[[2,8]])}))).apply(this,arguments)}function it(e,t){var n=e.StatusCode,r=e.Message;if(n===Ze){if(r.startsWith("Missing ChannelType"))throw new Error("Missing ChannelType");if(r.startsWith("Exceeded maximum endpoint per user count"))throw new Error("Exceeded maximum endpoint per user count")}}var ot=["PUSH","GCM","APNS","APNS_SANDBOX","APNS_VOIP","APNS_VOIP_SANDBOX","ADM","SMS","VOICE","EMAIL","BAIDU","CUSTOM"].reduce(function(e,t){return e[t]=t,e},{}),st=ee(),at=de,ct=pe,ut=/.+\@.+\..+/;function lt(e){try{return JSON.parse(Te(Pe(e)))||{}}catch(e){}return{}}function ft(e){return e.sort(function(e,t){var n=e.EventType,r=t.EventType;return n==at?-1:r==at?1:n==ct?1:r==ct?-1:void 0}).reduce(function(e,t){return r({},t,{},e)},{})}function dt(e,n,r){return{BatchItem:t({},e,{Endpoint:n,Events:r})}}var pt=pe;function ht(){return{}}function vt(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=r({getContext:e.getContext||ht,credentials:e.credentials||{},getEndpointId:e.getEndpointId},e),n=t.debug?console.log:function(){},i=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.getEndpointId,n=e.debug;return r=a(o.mark(function r(){var i,s,a,c,u,l,d,p,h,v=arguments;return o.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return i=v.length>0&&void 0!==v[0]?v[0]:[],s=v.length>1&&void 0!==v[1]?v[1]:{},r.next=4,t();case 4:if(a=r.sent){r.next=8;break}return console.error("No endpoint id. check getEndpointId()"),r.abrupt("return");case 8:if("object"===H(s)&&Object.keys(s).length){r.next=13;break}r.t0=lt(a),r.next=16;break;case 13:return r.next=15,Me(s,e);case 15:r.t0=r.sent;case 16:return c=r.t0,u=c.ChannelType,c.Address&&(o=c.Address,ut.test(o))&&(u=ot.EMAIL),!u&&c.Address&&(u="android"===st.platform?u||ot.GCM:u||ot.APNS),n&&(console.log("Endpoint",c),console.log("CHANNEL_TYPE",u)),c.RequestId=f(),c.ChannelType=u,c.Address&&(c.OptOut=c.OptOut||"NONE"),l=ft(i),d=dt(a,c,l),r.prev=26,r.next=29,et(d,e);case 29:p=r.sent,r.next=36;break;case 32:r.prev=32,r.t1=r.catch(26),console.log("Error calling AWS",r.t1),h=r.t1;case 36:return r.abrupt("return",{endpoint:c,response:p,error:h,events:i});case 37:case"end":return r.stop()}var o},r,null,[[26,32]])})),function(){return r.apply(this,arguments)};var r}(t),s=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return n=a(o.mark(function n(r){var i,s,a,c,u=arguments;return o.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return i=u.length>1&&void 0!==u[1]?u[1]:{},s=u.length>2&&void 0!==u[2]?u[2]:{},a=u.length>3&&void 0!==u[3]&&u[3],D(i)&&(a=i={}),D(s)&&(a=s={}),n.next=7,ge(r,i,t);case 7:if(c=n.sent,!Object.entries(s).length&&r!==he){n.next=12;break}return n.next=11,Me(s,t);case 11:s=n.sent;case 12:if(e.push(c),!a){n.next=17;break}return n.abrupt("return",e.flush());case 17:case"end":return n.stop()}},n)})),function(e){return n.apply(this,arguments)};var n}(function(e,t){var n,r,i,o=(t=t||{}).initial||[],s=t.max||1/0,a=t.interval||1e4,u=t.onEmpty||c,l=t.onPause||c;function f(t){clearInterval(n);var r=o.splice(0,s);return r.length&&e(r,o),o.length?t?f():d():(i=!1,u(o))}function d(){i=!0,n=setInterval(f,a)}return o.length&&d(),{flush:function(e){f(e)},resume:f,push:function(e){return(r=o.push(e))>=s&&!t.throttle&&f(),i||d(),r},size:function(){return o.length},pause:function(e){e&&f(),clearInterval(n),i=!1,l(o)}}}(function(){var e=a(o.mark(function e(t,r){var s;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t.forEach(function(e){return n("> Queue event",e)}),e.next=3,i(t,{});case 3:s=e.sent,n("> Queue response",s);case 5:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}(),{max:10,interval:e.flushInterval||3e3,throttle:!0}),t);Me({},e);var u=function(e){if(!L)return ht;var t=function(e){return function(){e(pt,!0)}}(e);return window.addEventListener("beforeunload",t),function(){return window.removeEventListener("beforeunload",t)}}(s);return{updateEndpoint:function(e){return i([],e)},recordEvent:s,disable:function(){u()}}}function gt(){throw new Error("Pinpoint not loaded")}function yt(e){var t=e.config,n=e.instance;(null==t?void 0:t.disableAnonymousTraffic)&&!n.user("userId")&&n.once("identifyStart",function(e){e.plugins["aws-pinpoint"].loaded()||n.loadPlugin("aws-pinpoint")})}function mt(e,t){if("string"==typeof e)return t?mt(document.querySelectorAll(e)):e.split(" ").map(function(e){return e.trim()});if(NodeList.prototype.isPrototypeOf(e)){for(var n=[],r=e.length>>>0;r--;)n[r]=e[r];return n}return function(e){return"[object Array]"===Object.prototype.toString.call(e)}(e)?e:[e]}function wt(e,t){return t&&t.once?function(e,t){var n;return function(){return e&&(n=e.apply(t||this,arguments),e=null),n}}(e):e}var bt=function(e){return function(t,n,r,i){var o=r||u;if(!l)return o;var s=i||!1,a=mt(n),c=mt(t,!0),f=[];if(!c.length)throw new Error("noElements");if(!a.length)throw new Error("noEvent");return function e(t){var n=t?"addEventListener":"removeEventListener";t&&(f=[]);for(var r=0;r<c.length;r++){var i=c[r];f[r]=t?wt(o,s):f[r]||o;for(var u=0;u<a.length;u++)i[n]?i[n](a[u],f[r],s):i["on"+a[u]]=t?f[r]:null}return e.bind(null,!t)}(e)}}("Event"),xt="undefined"==typeof window,St="hidden";function At(e){if(xt)return!1;var t=xt||St in document?St:["webkit","moz","ms","o"].reduce(function(e,t){var n=t+"Hidden";return!e&&n in document?n:e},null),n="".concat(t.replace(/[H|h]idden/,""),"visibilitychange"),r=function(){return e(Boolean(document[t]))},i=function(){return document.addEventListener(n,r)};return i(),function(){return document.removeEventListener(n,r),i}}var Et=["mousemove","mousedown","touchmove","touchstart","touchend","keydown"];function kt(e){var t,n,r=e.onIdle,i=e.onWakeUp,o=e.onHeartbeat,s=e.timeout,a=void 0===s?1e4:s,c=e.throttle,u=void 0===c?2e3:c,l=!1,f=!1,d=new Date,p=function(){return clearTimeout(t)};function h(e){p(),o&&!l&&o(It(d),e),i&&l&&(l=!1,i(It(n),e),d=new Date),t=setTimeout(function(){l=!0,r&&(n=new Date,r(It(d),e))},a)}var v=function(e,t){void 0===t&&(t={});var n=function(e,t){var n=this,r=!1;return function(i){r||(e.call(n,i),r=!0,setTimeout(function(){return r=!1},t))}}(e,t.throttle||1e4),r=[];function i(){var e=At(function(e){e||n({type:"tabVisible"})});return r=[e].concat(Et.map(function(e){return bt(document,e,n)})).concat(bt(window,"load",n)).concat(bt(window,"scroll",n,{capture:!0,passive:!0})),o}function o(){r.map(function(e){return e()})}return i(),function(){return o(),i}}(h,{throttle:u});return{disable:function(){f=!0,l=!1,p();var e=v();return function(){return f=!1,d=new Date,h({type:"load"}),e()}},getStatus:function(){return{isIdle:l,isDisabled:f,active:l?0:It(d,f),idle:l?It(n,f):0}}}}function It(e,t){return t?0:Math.round((new Date-e)/1e3)}var Ot={disableAnonymousTraffic:!1,pinpointRegion:"us-east-1",eventMapping:{}};var Tt=function(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=!1;return{name:"aws-pinpoint",config:r({},Ot,{},n),bootstrap:yt,initialize:function(i){var o=i.config,s=i.instance,a=o.disableAnonymousTraffic,c=o.debug?console.log:function(){},u=s.getState(),l=u.user||{},f=l.userId,d=l.anonymousId,p=u.context||{},h=p.app,v=p.version,g=p.campaign,y=U(),m=N(),w=j();if(c("initPageSession",y),c("initTabSession",m),c("initSessionData",w),w&&w.anonId&&w.anonId!==d){c("anonId different refresh session details"),C(),M();var b=P(30,{anonId:d,userId:f});c("newSessionForNewUser",b)}if(!f&&a)return!1;var x=Object.keys(g).reduce(function(e,t){return e["utm_".concat(t)]=g[t],e},{}),S=vt(r({},o,{appTitle:o.appTitle||h,appPackageName:o.appPackageName||h,appVersionCode:o.appVersionCode||v,eventMapping:o.eventMapping,getEndpointId:function(){return s.user("anonymousId")},getUserId:function(){return s.user("userId")},getContext:function(){return{sessionKey:o.sessionKey,pageViewKey:o.pageViewKey,initialSession:w}},enrichEventAttributes:function(){return r({anonId:s.user("anonymousId"),userId:s.user("userId"),hash:window.location.hash,path:window.location.pathname,referrer:document.referrer,search:window.location.search,title:document.title,host:window.location.hostname,url:window.location.origin+window.location.pathname},x)},enrichUserAttributes:o.enrichUserAttributes,enrichEventMetrics:function(){return{}}}));e=S.recordEvent,t=S.updateEndpoint,w&&w.isNew&&(c("Start brand new session because cookie not found"),e(de)),kt({timeout:18e5,throttle:2e4,onIdle:function(t,r){var i;c("Session idle. Active ".concat(t," seconds")),i=j(),n.debug&&console.log("Stop session",i),e(pe,!0)},onWakeUp:function(t,r){var i;c("Session wakeup. Idle ".concat(t," seconds")),i=P(30),n.debug&&console.log("START SESSION",i),e(de)},onHeartbeat:function(e,t){c("ping session",new Date),c("total active time",e);var n=s.user();_(30,{anonId:n.anonymousId,userId:n.userId})}})},page:function(t){if(t.payload,t.config,!e)return gt();i&&C(),e(he),i=!0},track:function(t){var n=t.payload,r=t.config;if(t.instance,!e)return gt();if(!r.disableAnonymousTraffic||n.userId){var i,o=(i=n.properties,Object.keys(i).reduce(function(e,t){var n=i[t];return"number"==typeof n&&(e.metrics[t]=n),"string"!=typeof n&&"boolean"!=typeof n||(e.attributes[t]=n),e},{attributes:{},metrics:{}}));e(n.event,o)}},identify:function(e){var n=e.payload,r=n.userId,i=n.traits;if(!t)return gt();var o={},s={};r&&(s.UserId=r),i&&Object.keys(i).length&&(s.UserAttributes=i),Object.keys(s).length&&(o.User=s),t(o,!0)},reset:function(e){var t=Pe(e.instance.user("anonymousId"));storage.removeItem(t)},loaded:function(){return!!e}}};return e.default=Tt,e.PINPOINT_EVENTS=ve,e.formatEvent=ge,e}({}); |
{ | ||
"name": "@analytics/aws-pinpoint", | ||
"version": "0.6.20", | ||
"version": "0.7.0", | ||
"description": "AWS Pinpoint integration for 'analytics' module", | ||
@@ -8,6 +8,7 @@ "projectMeta": { | ||
"name": "AWSPinpoint", | ||
"url": "https://www.aws-pinpoint.com/" | ||
"url": "https://aws.amazon.com/pinpoint/" | ||
}, | ||
"platforms": { | ||
"browser": "./src/browser.js" | ||
"browser": "./src/browser.js", | ||
"node": "./src/node.js" | ||
} | ||
@@ -24,2 +25,5 @@ }, | ||
"scripts": { | ||
"test": "ava -v -s", | ||
"test:watch": "ava -v -s --watch", | ||
"coverage": "c8 ava -s", | ||
"docs": "node ../analytics-cli/bin/run docs", | ||
@@ -47,3 +51,3 @@ "build": "node ../../scripts/build/index.js", | ||
], | ||
"homepage": "https://github.com/DavidWells/analytics#readme", | ||
"homepage": "https://github.com/DavidWells/analytics/tree/master/packages/analytics-plugin-aws-pinpoint", | ||
"repository": { | ||
@@ -53,2 +57,14 @@ "type": "git", | ||
}, | ||
"ava": { | ||
"files": [ | ||
"**/**/*.test.js" | ||
], | ||
"require": [ | ||
"esm", | ||
"@babel/register" | ||
], | ||
"verbose": true, | ||
"failFast": true, | ||
"failWithoutAssertions": false | ||
}, | ||
"dependencies": { | ||
@@ -58,3 +74,5 @@ "@analytics/activity-utils": "^0.1.7", | ||
"@analytics/queue-utils": "^0.1.1", | ||
"@analytics/session-utils": "^0.1.11", | ||
"@analytics/session-utils": "^0.1.10", | ||
"@analytics/type-utils": "^0.3.1", | ||
"@aws-sdk/client-pinpoint": "^3.31.0", | ||
"analytics-plugin-tab-events": "^0.2.0", | ||
@@ -68,5 +86,8 @@ "analytics-utils": "^1.0.4", | ||
"@babel/plugin-transform-runtime": "7.5.5", | ||
"@babel/preset-env": "^7.3.1" | ||
"@babel/preset-env": "^7.3.1", | ||
"@babel/register": "^7.15.3", | ||
"aws-sdk-client-mock": "^0.5.5", | ||
"c8": "^7.10.0" | ||
}, | ||
"gitHead": "3f0e5884ba0e491e999bc00bf0ebc9f94e6a94a9" | ||
"gitHead": "054f739981e6e814042f6f710ab6be9673bc9ec2" | ||
} |
@@ -44,3 +44,3 @@ <!-- | ||
The `@analytics/aws-pinpoint` package works in [the browser](#browser-usage). To use, install the package, include in your project and initialize the plugin with [analytics](https://www.npmjs.com/package/analytics). | ||
The `@analytics/aws-pinpoint` package works in [the browser](#browser-usage) and on [the server](#server-usage) in [Node.js](https://nodejs.org/en/). To use, install the package, include in your project and initialize the plugin with [analytics](https://www.npmjs.com/package/analytics). | ||
@@ -115,2 +115,27 @@ Below is an example of how to use the browser plugin. | ||
## Server usage | ||
The AWSPinpoint server side Node.js plugin works with these analytic api methods: | ||
- **[analytics.track](https://getanalytics.io/api/#analyticstrack)** - Track custom events and send to AWSPinpoint | ||
- **[analytics.identify](https://getanalytics.io/api/#analyticsidentify)** - Identify visitors and send details to AWSPinpoint | ||
### Server API | ||
```js | ||
import Analytics from 'analytics' | ||
import awsPinpointPlugin from '@analytics/aws-pinpoint' | ||
const analytics = Analytics({ | ||
app: 'awesome-app', | ||
plugins: [ | ||
awsPinpointPlugin({ | ||
pinpoingAppId: '938bebb1ae954e123133213160f2b3be4', | ||
getCredentials: () => Auth.currentCredentials() | ||
}) | ||
] | ||
}) | ||
``` | ||
### Configuration options for browser | ||
@@ -117,0 +142,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
545839
12701
330
10
6
+ Added@analytics/type-utils@^0.3.1
+ Added@analytics/type-utils@0.3.1(transitive)
+ Added@aws-crypto/sha256-browser@5.2.0(transitive)
+ Added@aws-crypto/sha256-js@5.2.0(transitive)
+ Added@aws-crypto/supports-web-crypto@5.2.0(transitive)
+ Added@aws-crypto/util@5.2.0(transitive)
+ Added@aws-sdk/client-pinpoint@3.699.0(transitive)
+ Added@aws-sdk/client-sso@3.696.0(transitive)
+ Added@aws-sdk/client-sso-oidc@3.699.0(transitive)
+ Added@aws-sdk/client-sts@3.699.0(transitive)
+ Added@aws-sdk/core@3.696.0(transitive)
+ Added@aws-sdk/credential-provider-env@3.696.0(transitive)
+ Added@aws-sdk/credential-provider-http@3.696.0(transitive)
+ Added@aws-sdk/credential-provider-ini@3.699.0(transitive)
+ Added@aws-sdk/credential-provider-node@3.699.0(transitive)
+ Added@aws-sdk/credential-provider-process@3.696.0(transitive)
+ Added@aws-sdk/credential-provider-sso@3.699.0(transitive)
+ Added@aws-sdk/credential-provider-web-identity@3.696.0(transitive)
+ Added@aws-sdk/middleware-host-header@3.696.0(transitive)
+ Added@aws-sdk/middleware-logger@3.696.0(transitive)
+ Added@aws-sdk/middleware-recursion-detection@3.696.0(transitive)
+ Added@aws-sdk/middleware-user-agent@3.696.0(transitive)
+ Added@aws-sdk/region-config-resolver@3.696.0(transitive)
+ Added@aws-sdk/token-providers@3.699.0(transitive)
+ Added@aws-sdk/types@3.696.0(transitive)
+ Added@aws-sdk/util-endpoints@3.696.0(transitive)
+ Added@aws-sdk/util-locate-window@3.693.0(transitive)
+ Added@aws-sdk/util-user-agent-browser@3.696.0(transitive)
+ Added@aws-sdk/util-user-agent-node@3.696.0(transitive)
+ Added@smithy/abort-controller@3.1.8(transitive)
+ Added@smithy/config-resolver@3.0.12(transitive)
+ Added@smithy/core@2.5.4(transitive)
+ Added@smithy/credential-provider-imds@3.2.7(transitive)
+ Added@smithy/fetch-http-handler@4.1.1(transitive)
+ Added@smithy/hash-node@3.0.10(transitive)
+ Added@smithy/invalid-dependency@3.0.10(transitive)
+ Added@smithy/is-array-buffer@2.2.03.0.0(transitive)
+ Added@smithy/middleware-content-length@3.0.12(transitive)
+ Added@smithy/middleware-endpoint@3.2.4(transitive)
+ Added@smithy/middleware-retry@3.0.28(transitive)
+ Added@smithy/middleware-serde@3.0.10(transitive)
+ Added@smithy/middleware-stack@3.0.10(transitive)
+ Added@smithy/node-config-provider@3.1.11(transitive)
+ Added@smithy/node-http-handler@3.3.1(transitive)
+ Added@smithy/property-provider@3.1.10(transitive)
+ Added@smithy/protocol-http@4.1.7(transitive)
+ Added@smithy/querystring-builder@3.0.10(transitive)
+ Added@smithy/querystring-parser@3.0.10(transitive)
+ Added@smithy/service-error-classification@3.0.10(transitive)
+ Added@smithy/shared-ini-file-loader@3.1.11(transitive)
+ Added@smithy/signature-v4@4.2.3(transitive)
+ Added@smithy/smithy-client@3.4.5(transitive)
+ Added@smithy/types@3.7.1(transitive)
+ Added@smithy/url-parser@3.0.10(transitive)
+ Added@smithy/util-base64@3.0.0(transitive)
+ Added@smithy/util-body-length-browser@3.0.0(transitive)
+ Added@smithy/util-body-length-node@3.0.0(transitive)
+ Added@smithy/util-buffer-from@2.2.03.0.0(transitive)
+ Added@smithy/util-config-provider@3.0.0(transitive)
+ Added@smithy/util-defaults-mode-browser@3.0.28(transitive)
+ Added@smithy/util-defaults-mode-node@3.0.28(transitive)
+ Added@smithy/util-endpoints@2.1.6(transitive)
+ Added@smithy/util-hex-encoding@3.0.0(transitive)
+ Added@smithy/util-middleware@3.0.10(transitive)
+ Added@smithy/util-retry@3.0.10(transitive)
+ Added@smithy/util-stream@3.3.1(transitive)
+ Added@smithy/util-uri-escape@3.0.0(transitive)
+ Added@smithy/util-utf8@2.3.03.0.0(transitive)
+ Addedbowser@2.11.0(transitive)
+ Addedfast-xml-parser@4.4.1(transitive)
+ Addedstrnum@1.0.5(transitive)
+ Addedtslib@2.8.1(transitive)
+ Addeduuid@9.0.1(transitive)