New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More →
Socket
Sign inDemoInstall
Socket

@aws-amplify/notifications

Package Overview
Dependencies
Maintainers
7
Versions
812
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-amplify/notifications - npm Package Compare versions

Comparing version 0.1.1-in-app-messaging.7067 to 0.1.1-in-app-messaging.7068

2

dist/aws-amplify-notifications.min.js

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("aws_amplify_core"),require("@aws-sdk/client-pinpoint"),require("aws_amplify_cache")):"function"==typeof define&&define.amd?define("aws_amplify_notifications",["aws_amplify_core","@aws-sdk/client-pinpoint","aws_amplify_cache"],e):"object"==typeof exports?exports.aws_amplify_notifications=e(require("aws_amplify_core"),require("@aws-sdk/client-pinpoint"),require("aws_amplify_cache")):t.aws_amplify_notifications=e(t.aws_amplify_core,t["@aws-sdk/client-pinpoint"],t.aws_amplify_cache)}(this,(function(t,e,n){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=53)}([function(e,n){e.exports=t},function(t,e,n){var r=n(11),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();t.exports=i},function(t,e,n){var r=n(38),o=n(41);t.exports=function(t,e){var n=o(t,e);return r(n)?n:void 0}},function(t,n){t.exports=e},function(t,e,n){var r=n(33),o=n(36),i=n(12),s=n(13),a=n(46),u=n(47),c=n(16),l=n(49),f=Object.prototype.hasOwnProperty;t.exports=function(t){if(null==t)return!0;if(a(t)&&(s(t)||"string"==typeof t||"function"==typeof t.splice||u(t)||l(t)||i(t)))return!t.length;var e=o(t);if("[object Map]"==e||"[object Set]"==e)return!t.size;if(c(t))return!r(t).length;for(var n in t)if(f.call(t,n))return!1;return!0}},function(t,e,n){var r=n(7),o=n(29),i=n(30),s=r?r.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":s&&s in Object(t)?o(t):i(t)}},function(t,e){t.exports=function(){}},function(t,e,n){var r=n(1).Symbol;t.exports=r},function(t,e){t.exports=function(t){return null!=t&&"object"==typeof t}},function(t,e){t.exports=n},function(t,e,n){var r=n(31),o=n(32),i=o;i.v1=r,i.v4=o,t.exports=i},function(t,e,n){(function(e){var n="object"==typeof e&&e&&e.Object===Object&&e;t.exports=n}).call(this,n(27))},function(t,e,n){var r=n(28),o=n(8),i=Object.prototype,s=i.hasOwnProperty,a=i.propertyIsEnumerable,u=r(function(){return arguments}())?r:function(t){return o(t)&&s.call(t,"callee")&&!a.call(t,"callee")};t.exports=u},function(t,e){var n=Array.isArray;t.exports=n},function(t,e){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);t.exports=function(){return n(r),r}}else{var o=new Array(16);t.exports=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),o[e]=t>>>((3&e)<<3)&255;return o}}},function(t,e){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);t.exports=function(t,e){var r=e||0,o=n;return[o[t[r++]],o[t[r++]],o[t[r++]],o[t[r++]],"-",o[t[r++]],o[t[r++]],"-",o[t[r++]],o[t[r++]],"-",o[t[r++]],o[t[r++]],"-",o[t[r++]],o[t[r++]],o[t[r++]],o[t[r++]],o[t[r++]],o[t[r++]]].join("")}},function(t,e){var n=Object.prototype;t.exports=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||n)}},function(t,e,n){var r=n(5),o=n(18);t.exports=function(t){if(!o(t))return!1;var e=r(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}},function(t,e){t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},function(t,e){var n=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return n.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},function(t,e){t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,n){var r=n(24);t.exports=function(t){return(null==t?0:t.length)?r(t,1):[]}},,function(t,e,n){var r=n(25),o=n(26);t.exports=function t(e,n,i,s,a){var u=-1,c=e.length;for(i||(i=o),a||(a=[]);++u<c;){var l=e[u];n>0&&i(l)?n>1?t(l,n-1,i,s,a):r(a,l):s||(a[a.length]=l)}return a}},function(t,e){t.exports=function(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t}},function(t,e,n){var r=n(7),o=n(12),i=n(13),s=r?r.isConcatSpreadable:void 0;t.exports=function(t){return i(t)||o(t)||!!(s&&t&&t[s])}},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){var r=n(5),o=n(8);t.exports=function(t){return o(t)&&"[object Arguments]"==r(t)}},function(t,e,n){var r=n(7),o=Object.prototype,i=o.hasOwnProperty,s=o.toString,a=r?r.toStringTag:void 0;t.exports=function(t){var e=i.call(t,a),n=t[a];try{t[a]=void 0;var r=!0}catch(t){}var o=s.call(t);return r&&(e?t[a]=n:delete t[a]),o}},function(t,e){var n=Object.prototype.toString;t.exports=function(t){return n.call(t)}},function(t,e,n){var r,o,i=n(14),s=n(15),a=0,u=0;t.exports=function(t,e,n){var c=e&&n||0,l=e||[],f=(t=t||{}).node||r,p=void 0!==t.clockseq?t.clockseq:o;if(null==f||null==p){var d=i();null==f&&(f=r=[1|d[0],d[1],d[2],d[3],d[4],d[5]]),null==p&&(p=o=16383&(d[6]<<8|d[7]))}var g=void 0!==t.msecs?t.msecs:(new Date).getTime(),v=void 0!==t.nsecs?t.nsecs:u+1,y=g-a+(v-u)/1e4;if(y<0&&void 0===t.clockseq&&(p=p+1&16383),(y<0||g>a)&&void 0===t.nsecs&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");a=g,u=v,o=p;var h=(1e4*(268435455&(g+=122192928e5))+v)%4294967296;l[c++]=h>>>24&255,l[c++]=h>>>16&255,l[c++]=h>>>8&255,l[c++]=255&h;var b=g/4294967296*1e4&268435455;l[c++]=b>>>8&255,l[c++]=255&b,l[c++]=b>>>24&15|16,l[c++]=b>>>16&255,l[c++]=p>>>8|128,l[c++]=255&p;for(var m=0;m<6;++m)l[c+m]=f[m];return e||s(l)}},function(t,e,n){var r=n(14),o=n(15);t.exports=function(t,e,n){var i=e&&n||0;"string"==typeof t&&(e="binary"===t?new Array(16):null,t=null);var s=(t=t||{}).random||(t.rng||r)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,e)for(var a=0;a<16;++a)e[i+a]=s[a];return e||o(s)}},function(t,e,n){var r=n(16),o=n(34),i=Object.prototype.hasOwnProperty;t.exports=function(t){if(!r(t))return o(t);var e=[];for(var n in Object(t))i.call(t,n)&&"constructor"!=n&&e.push(n);return e}},function(t,e,n){var r=n(35)(Object.keys,Object);t.exports=r},function(t,e){t.exports=function(t,e){return function(n){return t(e(n))}}},function(t,e,n){var r=n(37),o=n(42),i=n(43),s=n(44),a=n(45),u=n(5),c=n(19),l=c(r),f=c(o),p=c(i),d=c(s),g=c(a),v=u;(r&&"[object DataView]"!=v(new r(new ArrayBuffer(1)))||o&&"[object Map]"!=v(new o)||i&&"[object Promise]"!=v(i.resolve())||s&&"[object Set]"!=v(new s)||a&&"[object WeakMap]"!=v(new a))&&(v=function(t){var e=u(t),n="[object Object]"==e?t.constructor:void 0,r=n?c(n):"";if(r)switch(r){case l:return"[object DataView]";case f:return"[object Map]";case p:return"[object Promise]";case d:return"[object Set]";case g:return"[object WeakMap]"}return e}),t.exports=v},function(t,e,n){var r=n(2)(n(1),"DataView");t.exports=r},function(t,e,n){var r=n(17),o=n(39),i=n(18),s=n(19),a=/^\[object .+?Constructor\]$/,u=Function.prototype,c=Object.prototype,l=u.toString,f=c.hasOwnProperty,p=RegExp("^"+l.call(f).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!i(t)||o(t))&&(r(t)?p:a).test(s(t))}},function(t,e,n){var r,o=n(40),i=(r=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";t.exports=function(t){return!!i&&i in t}},function(t,e,n){var r=n(1)["__core-js_shared__"];t.exports=r},function(t,e){t.exports=function(t,e){return null==t?void 0:t[e]}},function(t,e,n){var r=n(2)(n(1),"Map");t.exports=r},function(t,e,n){var r=n(2)(n(1),"Promise");t.exports=r},function(t,e,n){var r=n(2)(n(1),"Set");t.exports=r},function(t,e,n){var r=n(2)(n(1),"WeakMap");t.exports=r},function(t,e,n){var r=n(17),o=n(20);t.exports=function(t){return null!=t&&o(t.length)&&!r(t)}},function(t,e,n){(function(t){var r=n(1),o=n(48),i=e&&!e.nodeType&&e,s=i&&"object"==typeof t&&t&&!t.nodeType&&t,a=s&&s.exports===i?r.Buffer:void 0,u=(a?a.isBuffer:void 0)||o;t.exports=u}).call(this,n(21)(t))},function(t,e){t.exports=function(){return!1}},function(t,e,n){var r=n(50),o=n(51),i=n(52),s=i&&i.isTypedArray,a=s?o(s):r;t.exports=a},function(t,e,n){var r=n(5),o=n(20),i=n(8),s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s["[object Arguments]"]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s["[object Function]"]=s["[object Map]"]=s["[object Number]"]=s["[object Object]"]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1,t.exports=function(t){return i(t)&&o(t.length)&&!!s[r(t)]}},function(t,e){t.exports=function(t){return function(e){return t(e)}}},function(t,e,n){(function(t){var r=n(11),o=e&&!e.nodeType&&e,i=o&&"object"==typeof t&&t&&!t.nodeType&&t,s=i&&i.exports===o&&r.process,a=function(){try{var t=i&&i.require&&i.require("util").types;return t||s&&s.binding&&s.binding("util")}catch(t){}}();t.exports=a}).call(this,n(21)(t))},function(t,e,n){"use strict";n.r(e),n.d(e,"Notifications",(function(){return z})),n.d(e,"InAppMessageInteractionEvent",(function(){return r}));var r,o,i=n(0),s=n(22),a=n.n(s),u=n(9),c=n.n(u),l=n(3),f=n(10);!function(t){t.MESSAGE_RECEIVED="MESSAGE_RECEIVED_EVENT",t.MESSAGE_DISPLAYED="MESSAGE_DISPLAYED_EVENT",t.MESSAGE_DISMISSED="MESSAGE_DISMISSED_EVENT",t.MESSAGE_ACTION_TAKEN="MESSAGE_ACTION_TAKEN_EVENT"}(r||(r={}));var p,d=((o={})[r.MESSAGE_RECEIVED]=new Set,o[r.MESSAGE_DISPLAYED]=new Set,o[r.MESSAGE_DISMISSED]=new Set,o[r.MESSAGE_ACTION_TAKEN]=new Set,o),g=function(t,e){d[e].forEach((function(e){e.handleEvent(t)}))},v=function(t,e){var n={handleEvent:t,remove:function(){d[e].delete(n)}};return d[e].add(n),n},y=n(6),h=n.n(y),b=function(t){void 0===t&&(t=h.a),this.start=h.a,this.end=h.a};!function(t){t.MESSAGE_DISPLAYED="_inapp.message_displayed",t.MESSAGE_DISMISSED="_inapp.message_dismissed",t.MESSAGE_ACTION_TAKEN="_inapp.message_clicked"}(p||(p={}));var m=n(4),S=n.n(m),E=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},A="undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("amplify_default"):"@@amplify_default",w={},C={},M={},I=new i.ConsoleLogger("AWSPinpointProvider"),_=function(t,e,n){i.Hub.dispatch("inAppMessaging",{event:t,data:e,message:n},"InAppMessaging",A)},j=function(){var t=new Date;return t.setHours(0,0,0,0),t.toISOString()},x=function(t){switch(t){case"EQUAL":return function(t,e){return t===e};case"GREATER_THAN":return function(t,e){return t<e};case"GREATER_THAN_OR_EQUAL":return function(t,e){return t<=e};case"LESS_THAN":return function(t,e){return t>e};case"LESS_THAN_OR_EQUAL":return function(t,e){return t>=e};default:return null}},O=function(t){var e,n,r=t.InAppMessage;return null!==(n=null===(e=null==r?void 0:r.Content)||void 0===e?void 0:e.map((function(t){var e=t.BackgroundColor,n=t.BodyConfig,r=t.HeaderConfig,o=t.ImageUrl,i=t.PrimaryBtn,s=t.SecondaryBtn,a=null==i?void 0:i.DefaultConfig,u=null==s?void 0:s.DefaultConfig,c={};return e&&(c.container={style:{backgroundColor:e}}),r&&(c.header={content:r.Header,style:{color:r.TextColor,textAlign:r.Alignment.toLowerCase()}}),n&&(c.body={content:n.Body,style:{color:n.TextColor,textAlign:n.Alignment.toLowerCase()}}),o&&(c.image={src:o}),a&&(c.primaryButton={title:a.Text,action:a.ButtonAction,url:a.Link,style:{backgroundColor:a.BackgroundColor,borderRadius:a.BorderRadius,color:a.TextColor}}),u&&(c.secondaryButton={title:u.Text,action:u.ButtonAction,url:u.Link,style:{backgroundColor:u.BackgroundColor,borderRadius:u.BorderRadius,color:u.TextColor}}),c})))&&void 0!==n?n:[]},P=function(t){var e=t.InAppMessage,n=t.Priority,r=t.Schedule,o=t.TreatmentId;return{customData:null==e?void 0:e.CustomConfig,endDate:null==r?void 0:r.EndDate,priority:n,treatmentId:o}},D=function(){return(D=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},T=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},N=function(t,e){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},k=function(){function t(){var t,e=this;this.config={},this.configured=!1,this.endpointInitialized=!1,this.initialized=!1,this.configure=function(t){return void 0===t&&(t={}),I.debug("configure",t),e.config=D(D({},e.config),t),e.configured||(e.sessionTracker=new b(e.sessionStateChangeHandler),e.sessionTracker.start(),v((function(t){e.recordMessageEvent(t,p.MESSAGE_DISPLAYED)}),r.MESSAGE_DISPLAYED),v((function(t){e.recordMessageEvent(t,p.MESSAGE_DISMISSED)}),r.MESSAGE_DISMISSED),v((function(t){e.recordMessageEvent(t,p.MESSAGE_ACTION_TAKEN)}),r.MESSAGE_ACTION_TAKEN)),e.configured=!0,_("pinpointProvider_configured",null),e.config},this.getInAppMessages=function(){return T(e,void 0,void 0,(function(){var t,e,n,r,o,i,s,a,u;return N(this,(function(c){switch(c.label){case 0:return this.initialized?[3,2]:[4,this.init()];case 1:c.sent(),c.label=2;case 2:w={},C={},M={},c.label=3;case 3:return c.trys.push([3,6,,7]),[4,this.updateEndpoint()];case 4:return c.sent(),t=this.config,e=t.appId,n=t.endpointId,r=t.pinpointClient,o={ApplicationId:e,EndpointId:n},i=new l.GetInAppMessagesCommand(o),I.debug("getting in-app messages",o),[4,r.send(i)];case 5:return s=c.sent(),a=s.InAppMessagesResponse.InAppMessageCampaigns,_("syncInAppMessages",a),[2,a];case 6:throw u=c.sent(),I.error("Error syncing in-app messages",u),u;case 7:return[2]}}))}))},this.processInAppMessages=function(t,n){return T(e,void 0,void 0,(function(){var e,r=this;return N(this,(function(o){switch(o.label){case 0:return this.initialized?[3,2]:[4,this.init()];case 1:o.sent(),o.label=2;case 2:return[2,this.normalizeMessages(t.reduce((function(t,o){if(function(t,e){var n,r=t.CampaignId,o=t.Schedule,i=e.name,s=(null===(n=null==o?void 0:o.EventFilter)||void 0===n?void 0:n.Dimensions).EventType,a=r+":"+i;return w.hasOwnProperty(a)||(w[a]=!!(null==s?void 0:s.Values.includes(i))),w[a]}(o,n)&&function(t,e){var n,r=t.CampaignId,o=t.Schedule,i=e.attributes,s=(null===(n=null==o?void 0:o.EventFilter)||void 0===n?void 0:n.Dimensions).Attributes;if(S()(s))return!0;if(S()(i))return!1;var a=r+":"+JSON.stringify(i);return C.hasOwnProperty(a)||(C[a]=Object.entries(s).every((function(t){var e=E(t,2),n=e[0];return e[1].Values.includes(i[n])}))),C[a]}(o,n)&&function(t,e){var n,r=t.CampaignId,o=t.Schedule,i=e.metrics,s=(null===(n=null==o?void 0:o.EventFilter)||void 0===n?void 0:n.Dimensions).Metrics;if(S()(s))return!0;if(S()(i))return!1;var a=r+":"+JSON.stringify(i);return M.hasOwnProperty(a)||(M[a]=Object.entries(s).every((function(t){var e=E(t,2),n=e[0],r=e[1],o=r.ComparisonOperator,s=r.Value,a=x(o);return!!a&&a(s,i[n])}))),M[a]}(o,n)&&function(t){var e=t.Schedule;return!(null==e?void 0:e.EndDate)||new Date<new Date(e.EndDate)}(o)&&r.isBelowCap(o))if(e){if(o.Priority){if(o.Priority<e)return e=o.Priority,[o];o.Priority===e&&t.push(o)}}else{if(o.Priority)return e=o.Priority,[o];t.push(o)}return t}),[]))]}}))}))},this.identifyUser=function(t,n){return T(e,void 0,void 0,(function(){var e;return N(this,(function(r){switch(r.label){case 0:return this.initialized?[3,2]:[4,this.init()];case 1:r.sent(),r.label=2;case 2:return r.trys.push([2,4,,5]),[4,this.updateEndpoint(t,n)];case 3:return r.sent(),[3,5];case 4:throw e=r.sent(),I.error("Error identifying user",e),e;case 5:return[2]}}))}))},this.init=function(){return T(e,void 0,void 0,(function(){var t,e,n,r,o,i;return N(this,(function(s){switch(s.label){case 0:t=this.config,e=t.endpointId,n=t.storage,r=this.getProviderName(),s.label=1;case 1:return s.trys.push([1,6,,7]),"function"!=typeof n.sync?[3,3]:[4,n.sync()];case 2:s.sent(),s.label=3;case 3:return e?[3,5]:(o=this.config,[4,this.getEndpointId()]);case 4:o.endpointId=s.sent(),s.label=5;case 5:return this.initialized=!0,[3,7];case 6:return i=s.sent(),I.error("Failed to initialize "+r,i),[3,7];case 7:return[2]}}))}))},this.initPinpointClient=function(){return T(e,void 0,void 0,(function(){var t,e,n,r,o;return N(this,(function(s){if(t=this.config,e=t.appId,n=t.credentials,r=t.pinpointClient,o=t.region,!e||!n||!o)throw new Error("One or more of credentials, appId or region is not configured");return r&&r.destroy(),this.config.pinpointClient=new l.PinpointClient({region:o,credentials:n,customUserAgent:Object(i.getAmplifyUserAgent)()}),[2]}))}))},this.getEndpointId=function(){return T(e,void 0,void 0,(function(){var t,e,n,r,o;return N(this,(function(i){switch(i.label){case 0:return t=this.config.appId,e=this.getSubCategory()+":"+this.getProviderName()+":"+t,[4,c.a.getItem(e)];case 1:return(n=i.sent())?[2,n]:(r=Object(f.v4)(),31536e8,o=(new Date).getTime()+31536e8,c.a.setItem(e,r,{expires:o,priority:1}),[2,r])}}))}))},this.updateEndpoint=function(t,n){return void 0===t&&(t=null),void 0===n&&(n=null),T(e,void 0,void 0,(function(){var e,r,o,s,a,u,c,p,d,g,v,y,h,b,m,S,E,A,w,C,M,_,j,x,O;return N(this,(function(P){switch(P.label){case 0:return e=this.config,r=e.appId,o=e.credentials,s=e.endpointId,a=e.endpointInfo,u=void 0===a?{}:a,c=e.pinpointClient,[4,this.getCredentials()];case 1:if(p=P.sent(),d=!o||Object.keys(p).some((function(t){return p[t]!==o[t]})),this.endpointInitialized&&!d&&!t&&!n)return[2];this.config.credentials=p,P.label=2;case 2:return P.trys.push([2,6,,7]),c&&!d?[3,4]:[4,this.initPinpointClient()];case 3:P.sent(),P.label=4;case 4:return v=(g=null!=n?n:{}).address,y=g.attributes,h=g.demographic,b=g.location,m=g.metrics,S=g.optOut,E=this.clientInfo,A=E.appVersion,w=E.make,C=E.model,M=E.platform,_=E.version,j={ApplicationId:r,EndpointId:s,EndpointRequest:{RequestId:Object(f.v4)(),EffectiveDate:(new Date).toISOString(),ChannelType:l.ChannelType.IN_APP,Address:null!=v?v:u.address,Attributes:D(D({},u.attributes),y),Demographic:D({AppVersion:A,Make:w,Model:C,ModelVersion:_,Platform:M},Object(i.transferKeyToUpperCase)(D(D({},u.demographic),h))),Location:Object(i.transferKeyToUpperCase)(D(D({},u.location),b)),Metrics:D(D({},u.metrics),m),OptOut:null!=S?S:u.optOut,User:{UserId:null!==(O=null!=t?t:u.userId)&&void 0!==O?O:p.identityId,UserAttributes:null!=y?y:u.userAttributes}}},x=new l.UpdateEndpointCommand(j),I.debug("updating endpoint",j),[4,this.config.pinpointClient.send(x)];case 5:return P.sent(),this.endpointInitialized=!0,[3,7];case 6:throw P.sent();case 7:return[2]}}))}))},this.getCredentials=function(){return T(e,void 0,void 0,(function(){var t,e;return N(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,i.Credentials.get()];case 1:return(t=n.sent())?[2,i.Credentials.shear(t)]:(I.debug("no credentials found"),[2,null]);case 2:return e=n.sent(),I.error("Error getting credentials:",e),[2,null];case 3:return[2]}}))}))},this.sessionStateChangeHandler=function(t){"started"===t&&(e.sessionMessageCountMap={})},this.isBelowCap=function(t){var n=t.CampaignId,r=t.SessionCap,o=t.DailyCap,i=t.TotalCap,s=e.getMessageCounts(n),a=s.sessionCount,u=s.dailyCount,c=s.totalCount;return!(a&&r||u&&o||c&&i)||a<r&&u<o&&c<i},this.getSessionCount=function(t){return e.sessionMessageCountMap[t]||0},this.getDailyCount=function(){var t=e.config.storage,n=j(),r=t.getItem("pinpointProvider_inAppMessages_dailyCount"),o=r?JSON.parse(r):{count:0,lastCountTimestamp:n};return o.lastCountTimestamp===n?o.count:0},this.getTotalCountMap=function(){var t=e.config.storage.getItem("pinpointProvider_inAppMessages_totalCount");return t?JSON.parse(t):{}},this.getTotalCount=function(t){return e.getTotalCountMap()[t]||0},this.getMessageCounts=function(t){try{return{sessionCount:e.getSessionCount(t),dailyCount:e.getDailyCount(),totalCount:e.getTotalCount(t)}}catch(t){I.error("Failed to get message counts from storage",t)}},this.setSessionCount=function(t,n){e.sessionMessageCountMap[t]=n},this.setDailyCount=function(t){var n=e.config.storage,r={count:t,lastCountTimestamp:j()};try{n.setItem("pinpointProvider_inAppMessages_dailyCount",JSON.stringify(r))}catch(t){I.error("Failed to save daily message count to storage",t)}},this.setTotalCountMap=function(t){var n=e.config.storage;try{n.setItem("pinpointProvider_inAppMessages_totalCount",JSON.stringify(t))}catch(t){I.error("Failed to save total count to storage",t)}},this.setTotalCount=function(t,n){var r,o=D(D({},e.getTotalCountMap()),((r={})[t]=n,r));e.setTotalCountMap(o)},this.incrementCounts=function(t){return T(e,void 0,void 0,(function(){var e,n,r,o;return N(this,(function(i){return e=this.getMessageCounts(t),n=e.sessionCount,r=e.dailyCount,o=e.totalCount,this.setSessionCount(t,n+1),this.setDailyCount(r+1),this.setTotalCount(t,o+1),[2]}))}))},this.normalizeMessages=function(t){return t.map((function(t){var e=t.CampaignId,n=t.InAppMessage;return{id:e,content:O(t),layout:n.Layout,metadata:P(t)}}))},this.recordMessageEvent=function(t,n){return T(e,void 0,void 0,(function(){return N(this,(function(e){switch(e.label){case 0:return this.initialized?[3,2]:[4,this.init()];case 1:e.sent(),e.label=2;case 2:return function(t,e){if(e)if(i.Amplify.Analytics&&"function"==typeof i.Amplify.Analytics.record){var n=e.id,r=e.metadata;i.Amplify.Analytics.record({name:t,attributes:{campaign_id:n,delivery_type:"IN_APP_MESSAGE",treatment_id:null==r?void 0:r.treatmentId}})}else I.debug("Analytics module is not registered into Amplify");else I.debug("Unable to record analytics event - no InAppMessage was received")}(n,t),n!==p.MESSAGE_DISPLAYED?[3,4]:[4,this.incrementCounts(t.id)];case 3:e.sent(),e.label=4;case 4:return[2]}}))}))},this.sessionMessageCountMap={},this.config={storage:(new i.StorageHelper).getStorage()},this.clientInfo=null!==(t=i.ClientDevice.clientInfo())&&void 0!==t?t:{}}return t.prototype.getCategory=function(){return t.category},t.prototype.getSubCategory=function(){return t.subCategory},t.prototype.getProviderName=function(){return t.providerName},t.category="Notifications",t.subCategory="InAppMessaging",t.providerName="AWSPinpoint",t}(),G=function(){return(G=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},F=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},R=function(t,e){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},L=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n},V=new i.ConsoleLogger("Notifications.InAppMessaging"),U=function(){function t(){var t=this;this.config={},this.listeningForAnalyticEvents=!1,this.pluggables=[],this.storageSynced=!1,this.configure=function(e){void 0===e&&(e={});var n=e.listenForAnalyticsEvents,r=void 0===n||n,o=L(e,["listenForAnalyticsEvents"]);return t.config=G(G({},t.config),o),V.debug("configure InAppMessaging",t.config),t.pluggables.forEach((function(e){var n;e.configure(G(G({},t.config),null!==(n=t.config[e.getProviderName()])&&void 0!==n?n:{}))})),0===t.pluggables.length&&t.addPluggable(new k),r&&!t.listeningForAnalyticEvents&&(i.Hub.listen("analytics",t.analyticsListener),t.listeningForAnalyticEvents=!0),t.config},this.getPluggable=function(e){var n,r=null!==(n=t.pluggables.find((function(t){return t.getProviderName()===e})))&&void 0!==n?n:null;return r||V.debug("No plugin found with name "+e),r},this.addPluggable=function(e){if(e&&"Notifications"===e.getCategory()&&"InAppMessaging"===e.getSubCategory()){if(t.getPluggable(e.getProviderName()))throw new Error("Pluggable "+e.getProviderName()+" has already been added.");t.pluggables.push(e),e.configure(t.config[e.getProviderName()])}},this.removePluggable=function(e){var n=t.pluggables.findIndex((function(t){return t.getProviderName()===e}));-1===n?V.debug("No plugin found with name "+e):t.pluggables.splice(n,1)},this.syncMessages=function(){return Promise.all(t.pluggables.map((function(e){return F(t,void 0,void 0,(function(){var t,n,r;return R(this,(function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),[4,e.getInAppMessages()];case 1:return t=o.sent(),n=e.getProviderName()+"_inAppMessages",[4,this.setMessages(n,t)];case 2:return o.sent(),[3,4];case 3:throw r=o.sent(),V.error("Failed to sync messages",r),r;case 4:return[2]}}))}))})))},this.clearMessages=function(){return Promise.all(t.pluggables.map((function(e){return F(t,void 0,void 0,(function(){var t;return R(this,(function(n){switch(n.label){case 0:return t=e.getProviderName()+"_inAppMessages",[4,this.removeMessages(t)];case 1:return n.sent(),[2]}}))}))})))},this.dispatchEvent=function(e){return F(t,void 0,void 0,(function(){var t,n,o=this;return R(this,(function(i){switch(i.label){case 0:return[4,Promise.all(this.pluggables.map((function(t){return F(o,void 0,void 0,(function(){var n,r;return R(this,(function(o){switch(o.label){case 0:return n=t.getProviderName()+"_inAppMessages",[4,this.getMessages(n)];case 1:return r=o.sent(),[2,t.processInAppMessages(r,e)]}}))}))})))];case 1:return t=i.sent(),(n=a()(t)).length&&g(this.conflictHandler(n),r.MESSAGE_RECEIVED),[2]}}))}))},this.identifyUser=function(e,n){return Promise.all(t.pluggables.map((function(r){return F(t,void 0,void 0,(function(){var t;return R(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,r.identifyUser(e,n)];case 1:return o.sent(),[3,3];case 2:throw t=o.sent(),V.error("Failed to identify user",t),t;case 3:return[2]}}))}))})))},this.onMessageReceived=function(t){return v(t,r.MESSAGE_RECEIVED)},this.onMessageDisplayed=function(t){return v(t,r.MESSAGE_DISPLAYED)},this.onMessageDismissed=function(t){return v(t,r.MESSAGE_DISMISSED)},this.onMessageActionTaken=function(t){return v(t,r.MESSAGE_ACTION_TAKEN)},this.notifyMessageInteraction=function(t,e){g(t,e)},this.setConflictHandler=function(e){t.conflictHandler=e},this.analyticsListener=function(e){var n=e.payload,r=n.event,o=n.data;switch(r){case"record":t.dispatchEvent(o)}},this.syncStorage=function(){return F(t,void 0,void 0,(function(){var t,e;return R(this,(function(n){switch(n.label){case 0:t=this.config.storage,n.label=1;case 1:return n.trys.push([1,4,,5]),"function"!=typeof t.sync?[3,3]:[4,t.sync()];case 2:n.sent(),n.label=3;case 3:return this.storageSynced=!0,[3,5];case 4:return e=n.sent(),V.error("Failed to sync storage",e),[3,5];case 5:return[2]}}))}))},this.getMessages=function(e){return F(t,void 0,void 0,(function(){var t,n,r;return R(this,(function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),this.storageSynced?[3,2]:[4,this.syncStorage()];case 1:o.sent(),o.label=2;case 2:return t=this.config.storage,[2,(n=t.getItem(e))?JSON.parse(n):[]];case 3:return r=o.sent(),V.error("Failed to retrieve in-app messages from storage",r),[3,4];case 4:return[2]}}))}))},this.setMessages=function(e,n){return F(t,void 0,void 0,(function(){var t;return R(this,(function(r){switch(r.label){case 0:if(!n)return[2];r.label=1;case 1:return r.trys.push([1,4,,5]),this.storageSynced?[3,3]:[4,this.syncStorage()];case 2:r.sent(),r.label=3;case 3:return this.config.storage.setItem(e,JSON.stringify(n)),[3,5];case 4:return t=r.sent(),V.error("Failed to store in-app messages",t),[3,5];case 5:return[2]}}))}))},this.removeMessages=function(e){return F(t,void 0,void 0,(function(){var t;return R(this,(function(n){switch(n.label){case 0:return n.trys.push([0,3,,4]),this.storageSynced?[3,2]:[4,this.syncStorage()];case 1:n.sent(),n.label=2;case 2:return this.config.storage.removeItem(e),[3,4];case 3:return t=n.sent(),V.error("Failed to remove in-app messages from storage",t),[3,4];case 4:return[2]}}))}))},this.defaultConflictHandler=function(t){return t.sort((function(t,e){var n,r,o=null===(n=t.metadata)||void 0===n?void 0:n.endDate,i=null===(r=e.metadata)||void 0===r?void 0:r.endDate;return o===i?0:o&&!i?-1:!o&&i?1:new Date(o)<new Date(i)?-1:1}))[0]},this.config={storage:(new i.StorageHelper).getStorage()},this.setConflictHandler(this.defaultConflictHandler)}return t.prototype.getModuleName=function(){return"InAppMessaging"},t}(),B=function(){return(B=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},H=new i.ConsoleLogger("Notifications"),q=new(function(){function t(){var t=this;this.config={},this.configure=function(e){var n=(void 0===e?{}:e).Notifications;return t.config=B(B({},t.config),n),H.debug("configure Notifications",n),t.inAppMessaging.configure(t.config.InAppMessaging),t.config},this.inAppMessaging=new U}return t.prototype.getModuleName=function(){return"Notifications"},Object.defineProperty(t.prototype,"InAppMessaging",{get:function(){return this.inAppMessaging},enumerable:!0,configurable:!0}),t}()),z=q;i.Amplify.register(q)}])}));
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("aws_amplify_core"),require("@aws-sdk/client-pinpoint"),require("aws_amplify_cache")):"function"==typeof define&&define.amd?define("aws_amplify_notifications",["aws_amplify_core","@aws-sdk/client-pinpoint","aws_amplify_cache"],e):"object"==typeof exports?exports.aws_amplify_notifications=e(require("aws_amplify_core"),require("@aws-sdk/client-pinpoint"),require("aws_amplify_cache")):t.aws_amplify_notifications=e(t.aws_amplify_core,t["@aws-sdk/client-pinpoint"],t.aws_amplify_cache)}(this,(function(t,e,n){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=53)}([function(e,n){e.exports=t},function(t,e,n){var r=n(11),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();t.exports=i},function(t,n){t.exports=e},function(t,e,n){var r=n(38),o=n(41);t.exports=function(t,e){var n=o(t,e);return r(n)?n:void 0}},function(t,e,n){var r=n(33),o=n(36),i=n(12),s=n(13),a=n(46),u=n(47),c=n(16),l=n(49),f=Object.prototype.hasOwnProperty;t.exports=function(t){if(null==t)return!0;if(a(t)&&(s(t)||"string"==typeof t||"function"==typeof t.splice||u(t)||l(t)||i(t)))return!t.length;var e=o(t);if("[object Map]"==e||"[object Set]"==e)return!t.size;if(c(t))return!r(t).length;for(var n in t)if(f.call(t,n))return!1;return!0}},function(t,e,n){var r=n(7),o=n(29),i=n(30),s=r?r.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":s&&s in Object(t)?o(t):i(t)}},function(t,e){t.exports=function(){}},function(t,e,n){var r=n(1).Symbol;t.exports=r},function(t,e){t.exports=function(t){return null!=t&&"object"==typeof t}},function(t,e){t.exports=n},function(t,e,n){var r=n(31),o=n(32),i=o;i.v1=r,i.v4=o,t.exports=i},function(t,e,n){(function(e){var n="object"==typeof e&&e&&e.Object===Object&&e;t.exports=n}).call(this,n(27))},function(t,e,n){var r=n(28),o=n(8),i=Object.prototype,s=i.hasOwnProperty,a=i.propertyIsEnumerable,u=r(function(){return arguments}())?r:function(t){return o(t)&&s.call(t,"callee")&&!a.call(t,"callee")};t.exports=u},function(t,e){var n=Array.isArray;t.exports=n},function(t,e){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);t.exports=function(){return n(r),r}}else{var o=new Array(16);t.exports=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),o[e]=t>>>((3&e)<<3)&255;return o}}},function(t,e){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);t.exports=function(t,e){var r=e||0,o=n;return[o[t[r++]],o[t[r++]],o[t[r++]],o[t[r++]],"-",o[t[r++]],o[t[r++]],"-",o[t[r++]],o[t[r++]],"-",o[t[r++]],o[t[r++]],"-",o[t[r++]],o[t[r++]],o[t[r++]],o[t[r++]],o[t[r++]],o[t[r++]]].join("")}},function(t,e){var n=Object.prototype;t.exports=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||n)}},function(t,e,n){var r=n(5),o=n(18);t.exports=function(t){if(!o(t))return!1;var e=r(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}},function(t,e){t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},function(t,e){var n=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return n.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},function(t,e){t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,n){var r=n(24);t.exports=function(t){return(null==t?0:t.length)?r(t,1):[]}},,function(t,e,n){var r=n(25),o=n(26);t.exports=function t(e,n,i,s,a){var u=-1,c=e.length;for(i||(i=o),a||(a=[]);++u<c;){var l=e[u];n>0&&i(l)?n>1?t(l,n-1,i,s,a):r(a,l):s||(a[a.length]=l)}return a}},function(t,e){t.exports=function(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t}},function(t,e,n){var r=n(7),o=n(12),i=n(13),s=r?r.isConcatSpreadable:void 0;t.exports=function(t){return i(t)||o(t)||!!(s&&t&&t[s])}},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){var r=n(5),o=n(8);t.exports=function(t){return o(t)&&"[object Arguments]"==r(t)}},function(t,e,n){var r=n(7),o=Object.prototype,i=o.hasOwnProperty,s=o.toString,a=r?r.toStringTag:void 0;t.exports=function(t){var e=i.call(t,a),n=t[a];try{t[a]=void 0;var r=!0}catch(t){}var o=s.call(t);return r&&(e?t[a]=n:delete t[a]),o}},function(t,e){var n=Object.prototype.toString;t.exports=function(t){return n.call(t)}},function(t,e,n){var r,o,i=n(14),s=n(15),a=0,u=0;t.exports=function(t,e,n){var c=e&&n||0,l=e||[],f=(t=t||{}).node||r,p=void 0!==t.clockseq?t.clockseq:o;if(null==f||null==p){var d=i();null==f&&(f=r=[1|d[0],d[1],d[2],d[3],d[4],d[5]]),null==p&&(p=o=16383&(d[6]<<8|d[7]))}var g=void 0!==t.msecs?t.msecs:(new Date).getTime(),v=void 0!==t.nsecs?t.nsecs:u+1,y=g-a+(v-u)/1e4;if(y<0&&void 0===t.clockseq&&(p=p+1&16383),(y<0||g>a)&&void 0===t.nsecs&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");a=g,u=v,o=p;var h=(1e4*(268435455&(g+=122192928e5))+v)%4294967296;l[c++]=h>>>24&255,l[c++]=h>>>16&255,l[c++]=h>>>8&255,l[c++]=255&h;var b=g/4294967296*1e4&268435455;l[c++]=b>>>8&255,l[c++]=255&b,l[c++]=b>>>24&15|16,l[c++]=b>>>16&255,l[c++]=p>>>8|128,l[c++]=255&p;for(var m=0;m<6;++m)l[c+m]=f[m];return e||s(l)}},function(t,e,n){var r=n(14),o=n(15);t.exports=function(t,e,n){var i=e&&n||0;"string"==typeof t&&(e="binary"===t?new Array(16):null,t=null);var s=(t=t||{}).random||(t.rng||r)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,e)for(var a=0;a<16;++a)e[i+a]=s[a];return e||o(s)}},function(t,e,n){var r=n(16),o=n(34),i=Object.prototype.hasOwnProperty;t.exports=function(t){if(!r(t))return o(t);var e=[];for(var n in Object(t))i.call(t,n)&&"constructor"!=n&&e.push(n);return e}},function(t,e,n){var r=n(35)(Object.keys,Object);t.exports=r},function(t,e){t.exports=function(t,e){return function(n){return t(e(n))}}},function(t,e,n){var r=n(37),o=n(42),i=n(43),s=n(44),a=n(45),u=n(5),c=n(19),l=c(r),f=c(o),p=c(i),d=c(s),g=c(a),v=u;(r&&"[object DataView]"!=v(new r(new ArrayBuffer(1)))||o&&"[object Map]"!=v(new o)||i&&"[object Promise]"!=v(i.resolve())||s&&"[object Set]"!=v(new s)||a&&"[object WeakMap]"!=v(new a))&&(v=function(t){var e=u(t),n="[object Object]"==e?t.constructor:void 0,r=n?c(n):"";if(r)switch(r){case l:return"[object DataView]";case f:return"[object Map]";case p:return"[object Promise]";case d:return"[object Set]";case g:return"[object WeakMap]"}return e}),t.exports=v},function(t,e,n){var r=n(3)(n(1),"DataView");t.exports=r},function(t,e,n){var r=n(17),o=n(39),i=n(18),s=n(19),a=/^\[object .+?Constructor\]$/,u=Function.prototype,c=Object.prototype,l=u.toString,f=c.hasOwnProperty,p=RegExp("^"+l.call(f).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!i(t)||o(t))&&(r(t)?p:a).test(s(t))}},function(t,e,n){var r,o=n(40),i=(r=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";t.exports=function(t){return!!i&&i in t}},function(t,e,n){var r=n(1)["__core-js_shared__"];t.exports=r},function(t,e){t.exports=function(t,e){return null==t?void 0:t[e]}},function(t,e,n){var r=n(3)(n(1),"Map");t.exports=r},function(t,e,n){var r=n(3)(n(1),"Promise");t.exports=r},function(t,e,n){var r=n(3)(n(1),"Set");t.exports=r},function(t,e,n){var r=n(3)(n(1),"WeakMap");t.exports=r},function(t,e,n){var r=n(17),o=n(20);t.exports=function(t){return null!=t&&o(t.length)&&!r(t)}},function(t,e,n){(function(t){var r=n(1),o=n(48),i=e&&!e.nodeType&&e,s=i&&"object"==typeof t&&t&&!t.nodeType&&t,a=s&&s.exports===i?r.Buffer:void 0,u=(a?a.isBuffer:void 0)||o;t.exports=u}).call(this,n(21)(t))},function(t,e){t.exports=function(){return!1}},function(t,e,n){var r=n(50),o=n(51),i=n(52),s=i&&i.isTypedArray,a=s?o(s):r;t.exports=a},function(t,e,n){var r=n(5),o=n(20),i=n(8),s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s["[object Arguments]"]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s["[object Function]"]=s["[object Map]"]=s["[object Number]"]=s["[object Object]"]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1,t.exports=function(t){return i(t)&&o(t.length)&&!!s[r(t)]}},function(t,e){t.exports=function(t){return function(e){return t(e)}}},function(t,e,n){(function(t){var r=n(11),o=e&&!e.nodeType&&e,i=o&&"object"==typeof t&&t&&!t.nodeType&&t,s=i&&i.exports===o&&r.process,a=function(){try{var t=i&&i.require&&i.require("util").types;return t||s&&s.binding&&s.binding("util")}catch(t){}}();t.exports=a}).call(this,n(21)(t))},function(t,e,n){"use strict";n.r(e),n.d(e,"Notifications",(function(){return z})),n.d(e,"InAppMessageInteractionEvent",(function(){return r}));var r,o,i=n(0),s=n(22),a=n.n(s),u=n(9),c=n.n(u),l=n(2),f=n(10);!function(t){t.MESSAGE_RECEIVED="MESSAGE_RECEIVED_EVENT",t.MESSAGE_DISPLAYED="MESSAGE_DISPLAYED_EVENT",t.MESSAGE_DISMISSED="MESSAGE_DISMISSED_EVENT",t.MESSAGE_ACTION_TAKEN="MESSAGE_ACTION_TAKEN_EVENT"}(r||(r={}));var p,d=((o={})[r.MESSAGE_RECEIVED]=new Set,o[r.MESSAGE_DISPLAYED]=new Set,o[r.MESSAGE_DISMISSED]=new Set,o[r.MESSAGE_ACTION_TAKEN]=new Set,o),g=function(t,e){d[e].forEach((function(e){e.handleEvent(t)}))},v=function(t,e){var n={handleEvent:t,remove:function(){d[e].delete(n)}};return d[e].add(n),n},y=n(6),h=n.n(y),b=function(t){void 0===t&&(t=h.a),this.start=h.a,this.end=h.a};!function(t){t.MESSAGE_DISPLAYED="_inapp.message_displayed",t.MESSAGE_DISMISSED="_inapp.message_dismissed",t.MESSAGE_ACTION_TAKEN="_inapp.message_clicked"}(p||(p={}));var m=n(4),S=n.n(m),E=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},A="undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("amplify_default"):"@@amplify_default",w={},C={},M={},I=new i.ConsoleLogger("AWSPinpointProvider"),_=function(t,e,n){i.Hub.dispatch("inAppMessaging",{event:t,data:e,message:n},"InAppMessaging",A)},j=function(){var t=new Date;return t.setHours(0,0,0,0),t.toISOString()},O=function(t){switch(t){case"EQUAL":return function(t,e){return t===e};case"GREATER_THAN":return function(t,e){return t<e};case"GREATER_THAN_OR_EQUAL":return function(t,e){return t<=e};case"LESS_THAN":return function(t,e){return t>e};case"LESS_THAN_OR_EQUAL":return function(t,e){return t>=e};default:return null}},x=function(t){var e,n,r=t.InAppMessage;return null!==(n=null===(e=null==r?void 0:r.Content)||void 0===e?void 0:e.map((function(t){var e=t.BackgroundColor,n=t.BodyConfig,r=t.HeaderConfig,o=t.ImageUrl,i=t.PrimaryBtn,s=t.SecondaryBtn,a=null==i?void 0:i.DefaultConfig,u=null==s?void 0:s.DefaultConfig,c={};return e&&(c.container={style:{backgroundColor:e}}),r&&(c.header={content:r.Header,style:{color:r.TextColor,textAlign:r.Alignment.toLowerCase()}}),n&&(c.body={content:n.Body,style:{color:n.TextColor,textAlign:n.Alignment.toLowerCase()}}),o&&(c.image={src:o}),a&&(c.primaryButton={title:a.Text,action:a.ButtonAction,url:a.Link,style:{backgroundColor:a.BackgroundColor,borderRadius:a.BorderRadius,color:a.TextColor}}),u&&(c.secondaryButton={title:u.Text,action:u.ButtonAction,url:u.Link,style:{backgroundColor:u.BackgroundColor,borderRadius:u.BorderRadius,color:u.TextColor}}),c})))&&void 0!==n?n:[]},P=function(t){var e=t.InAppMessage,n=t.Priority,r=t.Schedule,o=t.TreatmentId;return{customData:null==e?void 0:e.CustomConfig,endDate:null==r?void 0:r.EndDate,priority:n,treatmentId:o}},D=function(){return(D=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},T=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},N=function(t,e){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},k=function(){function t(){var t,e=this;this.config={},this.configured=!1,this.endpointInitialized=!1,this.initialized=!1,this.configure=function(t){return void 0===t&&(t={}),I.debug("configure",t),e.config=D(D({},e.config),t),e.configured||(e.sessionTracker=new b(e.sessionStateChangeHandler),e.sessionTracker.start(),v((function(t){e.recordMessageEvent(t,p.MESSAGE_DISPLAYED)}),r.MESSAGE_DISPLAYED),v((function(t){e.recordMessageEvent(t,p.MESSAGE_DISMISSED)}),r.MESSAGE_DISMISSED),v((function(t){e.recordMessageEvent(t,p.MESSAGE_ACTION_TAKEN)}),r.MESSAGE_ACTION_TAKEN)),e.configured=!0,_("pinpointProvider_configured",null),e.config},this.getInAppMessages=function(){return T(e,void 0,void 0,(function(){var t,e,n,r,o,i,s,a,u;return N(this,(function(c){switch(c.label){case 0:return this.initialized?[3,2]:[4,this.init()];case 1:c.sent(),c.label=2;case 2:w={},C={},M={},c.label=3;case 3:return c.trys.push([3,6,,7]),[4,this.updateEndpoint()];case 4:return c.sent(),t=this.config,e=t.appId,n=t.endpointId,r=t.pinpointClient,o={ApplicationId:e,EndpointId:n},i=new l.GetInAppMessagesCommand(o),I.debug("getting in-app messages",o),[4,r.send(i)];case 5:return s=c.sent(),a=s.InAppMessagesResponse.InAppMessageCampaigns,_("syncInAppMessages",a),[2,a];case 6:throw u=c.sent(),I.error("Error syncing in-app messages",u),u;case 7:return[2]}}))}))},this.processInAppMessages=function(t,n){return T(e,void 0,void 0,(function(){var e,r=this;return N(this,(function(o){switch(o.label){case 0:return this.initialized?[3,2]:[4,this.init()];case 1:o.sent(),o.label=2;case 2:return[2,this.normalizeMessages(t.reduce((function(t,o){if(function(t,e){var n,r=t.CampaignId,o=t.Schedule,i=e.name,s=(null===(n=null==o?void 0:o.EventFilter)||void 0===n?void 0:n.Dimensions).EventType,a=r+":"+i;return w.hasOwnProperty(a)||(w[a]=!!(null==s?void 0:s.Values.includes(i))),w[a]}(o,n)&&function(t,e){var n,r=t.CampaignId,o=t.Schedule,i=e.attributes,s=(null===(n=null==o?void 0:o.EventFilter)||void 0===n?void 0:n.Dimensions).Attributes;if(S()(s))return!0;if(S()(i))return!1;var a=r+":"+JSON.stringify(i);return C.hasOwnProperty(a)||(C[a]=Object.entries(s).every((function(t){var e=E(t,2),n=e[0];return e[1].Values.includes(i[n])}))),C[a]}(o,n)&&function(t,e){var n,r=t.CampaignId,o=t.Schedule,i=e.metrics,s=(null===(n=null==o?void 0:o.EventFilter)||void 0===n?void 0:n.Dimensions).Metrics;if(S()(s))return!0;if(S()(i))return!1;var a=r+":"+JSON.stringify(i);return M.hasOwnProperty(a)||(M[a]=Object.entries(s).every((function(t){var e=E(t,2),n=e[0],r=e[1],o=r.ComparisonOperator,s=r.Value,a=O(o);return!!a&&a(s,i[n])}))),M[a]}(o,n)&&function(t){var e=t.Schedule;return!(null==e?void 0:e.EndDate)||new Date<new Date(e.EndDate)}(o)&&r.isBelowCap(o))if(e){if(o.Priority){if(o.Priority<e)return e=o.Priority,[o];o.Priority===e&&t.push(o)}}else{if(o.Priority)return e=o.Priority,[o];t.push(o)}return t}),[]))]}}))}))},this.identifyUser=function(t,n){return T(e,void 0,void 0,(function(){var e;return N(this,(function(r){switch(r.label){case 0:return this.initialized?[3,2]:[4,this.init()];case 1:r.sent(),r.label=2;case 2:return r.trys.push([2,4,,5]),[4,this.updateEndpoint(t,n)];case 3:return r.sent(),[3,5];case 4:throw e=r.sent(),I.error("Error identifying user",e),e;case 5:return[2]}}))}))},this.init=function(){return T(e,void 0,void 0,(function(){var t,e,n,r,o,i;return N(this,(function(s){switch(s.label){case 0:t=this.config,e=t.endpointId,n=t.storage,r=this.getProviderName(),s.label=1;case 1:return s.trys.push([1,6,,7]),"function"!=typeof n.sync?[3,3]:[4,n.sync()];case 2:s.sent(),s.label=3;case 3:return e?[3,5]:(o=this.config,[4,this.getEndpointId()]);case 4:o.endpointId=s.sent(),s.label=5;case 5:return this.initialized=!0,[3,7];case 6:return i=s.sent(),I.error("Failed to initialize "+r,i),[3,7];case 7:return[2]}}))}))},this.initPinpointClient=function(){return T(e,void 0,void 0,(function(){var t,e,n,r,o;return N(this,(function(s){if(t=this.config,e=t.appId,n=t.credentials,r=t.pinpointClient,o=t.region,!e||!n||!o)throw new Error("One or more of credentials, appId or region is not configured");return r&&r.destroy(),this.config.pinpointClient=new l.PinpointClient({region:o,credentials:n,customUserAgent:Object(i.getAmplifyUserAgent)()}),[2]}))}))},this.getEndpointId=function(){return T(e,void 0,void 0,(function(){var t,e,n,r,o;return N(this,(function(i){switch(i.label){case 0:return t=this.config.appId,e=this.getSubCategory()+":"+this.getProviderName()+":"+t,[4,c.a.getItem(e)];case 1:return(n=i.sent())?[2,n]:(r=Object(f.v4)(),31536e8,o=(new Date).getTime()+31536e8,c.a.setItem(e,r,{expires:o,priority:1}),[2,r])}}))}))},this.updateEndpoint=function(t,n){return void 0===t&&(t=null),void 0===n&&(n=null),T(e,void 0,void 0,(function(){var e,r,o,s,a,u,c,p,d,g,v,y,h,b,m,S,E,A,w,C,M,_,j,O,x;return N(this,(function(P){switch(P.label){case 0:return e=this.config,r=e.appId,o=e.credentials,s=e.endpointId,a=e.endpointInfo,u=void 0===a?{}:a,c=e.pinpointClient,[4,this.getCredentials()];case 1:if(p=P.sent(),d=!o||Object.keys(p).some((function(t){return p[t]!==o[t]})),this.endpointInitialized&&!d&&!t&&!n)return[2];this.config.credentials=p,P.label=2;case 2:return P.trys.push([2,6,,7]),c&&!d?[3,4]:[4,this.initPinpointClient()];case 3:P.sent(),P.label=4;case 4:return v=(g=null!=n?n:{}).address,y=g.attributes,h=g.demographic,b=g.location,m=g.metrics,S=g.optOut,E=this.clientInfo,A=E.appVersion,w=E.make,C=E.model,M=E.platform,_=E.version,j={ApplicationId:r,EndpointId:s,EndpointRequest:{RequestId:Object(f.v4)(),EffectiveDate:(new Date).toISOString(),ChannelType:l.ChannelType.IN_APP,Address:null!=v?v:u.address,Attributes:D(D({},u.attributes),y),Demographic:D({AppVersion:A,Make:w,Model:C,ModelVersion:_,Platform:M},Object(i.transferKeyToUpperCase)(D(D({},u.demographic),h))),Location:Object(i.transferKeyToUpperCase)(D(D({},u.location),b)),Metrics:D(D({},u.metrics),m),OptOut:null!=S?S:u.optOut,User:{UserId:null!==(x=null!=t?t:u.userId)&&void 0!==x?x:p.identityId,UserAttributes:null!=y?y:u.userAttributes}}},O=new l.UpdateEndpointCommand(j),I.debug("updating endpoint",j),[4,this.config.pinpointClient.send(O)];case 5:return P.sent(),this.endpointInitialized=!0,[3,7];case 6:throw P.sent();case 7:return[2]}}))}))},this.getCredentials=function(){return T(e,void 0,void 0,(function(){var t,e;return N(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,i.Credentials.get()];case 1:return(t=n.sent())?[2,i.Credentials.shear(t)]:(I.debug("no credentials found"),[2,null]);case 2:return e=n.sent(),I.error("Error getting credentials:",e),[2,null];case 3:return[2]}}))}))},this.sessionStateChangeHandler=function(t){"started"===t&&(e.sessionMessageCountMap={})},this.isBelowCap=function(t){var n=t.CampaignId,r=t.SessionCap,o=t.DailyCap,i=t.TotalCap,s=e.getMessageCounts(n),a=s.sessionCount,u=s.dailyCount,c=s.totalCount;return!(a&&r||u&&o||c&&i)||a<r&&u<o&&c<i},this.getSessionCount=function(t){return e.sessionMessageCountMap[t]||0},this.getDailyCount=function(){var t=e.config.storage,n=j(),r=t.getItem("pinpointProvider_inAppMessages_dailyCount"),o=r?JSON.parse(r):{count:0,lastCountTimestamp:n};return o.lastCountTimestamp===n?o.count:0},this.getTotalCountMap=function(){var t=e.config.storage.getItem("pinpointProvider_inAppMessages_totalCount");return t?JSON.parse(t):{}},this.getTotalCount=function(t){return e.getTotalCountMap()[t]||0},this.getMessageCounts=function(t){try{return{sessionCount:e.getSessionCount(t),dailyCount:e.getDailyCount(),totalCount:e.getTotalCount(t)}}catch(t){I.error("Failed to get message counts from storage",t)}},this.setSessionCount=function(t,n){e.sessionMessageCountMap[t]=n},this.setDailyCount=function(t){var n=e.config.storage,r={count:t,lastCountTimestamp:j()};try{n.setItem("pinpointProvider_inAppMessages_dailyCount",JSON.stringify(r))}catch(t){I.error("Failed to save daily message count to storage",t)}},this.setTotalCountMap=function(t){var n=e.config.storage;try{n.setItem("pinpointProvider_inAppMessages_totalCount",JSON.stringify(t))}catch(t){I.error("Failed to save total count to storage",t)}},this.setTotalCount=function(t,n){var r,o=D(D({},e.getTotalCountMap()),((r={})[t]=n,r));e.setTotalCountMap(o)},this.incrementCounts=function(t){return T(e,void 0,void 0,(function(){var e,n,r,o;return N(this,(function(i){return e=this.getMessageCounts(t),n=e.sessionCount,r=e.dailyCount,o=e.totalCount,this.setSessionCount(t,n+1),this.setDailyCount(r+1),this.setTotalCount(t,o+1),[2]}))}))},this.normalizeMessages=function(t){return t.map((function(t){var e,n=t.CampaignId,r=t.InAppMessage;return{id:n,content:x(t),layout:(e=r.Layout,e===l.Layout.MOBILE_FEED?"MODAL":e===l.Layout.OVERLAYS?"FULL_SCREEN":e),metadata:P(t)}}))},this.recordMessageEvent=function(t,n){return T(e,void 0,void 0,(function(){return N(this,(function(e){switch(e.label){case 0:return this.initialized?[3,2]:[4,this.init()];case 1:e.sent(),e.label=2;case 2:return function(t,e){if(e)if(i.Amplify.Analytics&&"function"==typeof i.Amplify.Analytics.record){var n=e.id,r=e.metadata;i.Amplify.Analytics.record({name:t,attributes:{campaign_id:n,delivery_type:"IN_APP_MESSAGE",treatment_id:null==r?void 0:r.treatmentId}})}else I.debug("Analytics module is not registered into Amplify");else I.debug("Unable to record analytics event - no InAppMessage was received")}(n,t),n!==p.MESSAGE_DISPLAYED?[3,4]:[4,this.incrementCounts(t.id)];case 3:e.sent(),e.label=4;case 4:return[2]}}))}))},this.sessionMessageCountMap={},this.config={storage:(new i.StorageHelper).getStorage()},this.clientInfo=null!==(t=i.ClientDevice.clientInfo())&&void 0!==t?t:{}}return t.prototype.getCategory=function(){return t.category},t.prototype.getSubCategory=function(){return t.subCategory},t.prototype.getProviderName=function(){return t.providerName},t.category="Notifications",t.subCategory="InAppMessaging",t.providerName="AWSPinpoint",t}(),G=function(){return(G=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},L=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},F=function(t,e){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},R=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n},V=new i.ConsoleLogger("Notifications.InAppMessaging"),U=function(){function t(){var t=this;this.config={},this.listeningForAnalyticEvents=!1,this.pluggables=[],this.storageSynced=!1,this.configure=function(e){void 0===e&&(e={});var n=e.listenForAnalyticsEvents,r=void 0===n||n,o=R(e,["listenForAnalyticsEvents"]);return t.config=G(G({},t.config),o),V.debug("configure InAppMessaging",t.config),t.pluggables.forEach((function(e){var n;e.configure(G(G({},t.config),null!==(n=t.config[e.getProviderName()])&&void 0!==n?n:{}))})),0===t.pluggables.length&&t.addPluggable(new k),r&&!t.listeningForAnalyticEvents&&(i.Hub.listen("analytics",t.analyticsListener),t.listeningForAnalyticEvents=!0),t.config},this.getPluggable=function(e){var n,r=null!==(n=t.pluggables.find((function(t){return t.getProviderName()===e})))&&void 0!==n?n:null;return r||V.debug("No plugin found with name "+e),r},this.addPluggable=function(e){if(e&&"Notifications"===e.getCategory()&&"InAppMessaging"===e.getSubCategory()){if(t.getPluggable(e.getProviderName()))throw new Error("Pluggable "+e.getProviderName()+" has already been added.");t.pluggables.push(e),e.configure(t.config[e.getProviderName()])}},this.removePluggable=function(e){var n=t.pluggables.findIndex((function(t){return t.getProviderName()===e}));-1===n?V.debug("No plugin found with name "+e):t.pluggables.splice(n,1)},this.syncMessages=function(){return Promise.all(t.pluggables.map((function(e){return L(t,void 0,void 0,(function(){var t,n,r;return F(this,(function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),[4,e.getInAppMessages()];case 1:return t=o.sent(),n=e.getProviderName()+"_inAppMessages",[4,this.setMessages(n,t)];case 2:return o.sent(),[3,4];case 3:throw r=o.sent(),V.error("Failed to sync messages",r),r;case 4:return[2]}}))}))})))},this.clearMessages=function(){return Promise.all(t.pluggables.map((function(e){return L(t,void 0,void 0,(function(){var t;return F(this,(function(n){switch(n.label){case 0:return t=e.getProviderName()+"_inAppMessages",[4,this.removeMessages(t)];case 1:return n.sent(),[2]}}))}))})))},this.dispatchEvent=function(e){return L(t,void 0,void 0,(function(){var t,n,o=this;return F(this,(function(i){switch(i.label){case 0:return[4,Promise.all(this.pluggables.map((function(t){return L(o,void 0,void 0,(function(){var n,r;return F(this,(function(o){switch(o.label){case 0:return n=t.getProviderName()+"_inAppMessages",[4,this.getMessages(n)];case 1:return r=o.sent(),[2,t.processInAppMessages(r,e)]}}))}))})))];case 1:return t=i.sent(),(n=a()(t)).length&&g(this.conflictHandler(n),r.MESSAGE_RECEIVED),[2]}}))}))},this.identifyUser=function(e,n){return Promise.all(t.pluggables.map((function(r){return L(t,void 0,void 0,(function(){var t;return F(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,r.identifyUser(e,n)];case 1:return o.sent(),[3,3];case 2:throw t=o.sent(),V.error("Failed to identify user",t),t;case 3:return[2]}}))}))})))},this.onMessageReceived=function(t){return v(t,r.MESSAGE_RECEIVED)},this.onMessageDisplayed=function(t){return v(t,r.MESSAGE_DISPLAYED)},this.onMessageDismissed=function(t){return v(t,r.MESSAGE_DISMISSED)},this.onMessageActionTaken=function(t){return v(t,r.MESSAGE_ACTION_TAKEN)},this.notifyMessageInteraction=function(t,e){g(t,e)},this.setConflictHandler=function(e){t.conflictHandler=e},this.analyticsListener=function(e){var n=e.payload,r=n.event,o=n.data;switch(r){case"record":t.dispatchEvent(o)}},this.syncStorage=function(){return L(t,void 0,void 0,(function(){var t,e;return F(this,(function(n){switch(n.label){case 0:t=this.config.storage,n.label=1;case 1:return n.trys.push([1,4,,5]),"function"!=typeof t.sync?[3,3]:[4,t.sync()];case 2:n.sent(),n.label=3;case 3:return this.storageSynced=!0,[3,5];case 4:return e=n.sent(),V.error("Failed to sync storage",e),[3,5];case 5:return[2]}}))}))},this.getMessages=function(e){return L(t,void 0,void 0,(function(){var t,n,r;return F(this,(function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),this.storageSynced?[3,2]:[4,this.syncStorage()];case 1:o.sent(),o.label=2;case 2:return t=this.config.storage,[2,(n=t.getItem(e))?JSON.parse(n):[]];case 3:return r=o.sent(),V.error("Failed to retrieve in-app messages from storage",r),[3,4];case 4:return[2]}}))}))},this.setMessages=function(e,n){return L(t,void 0,void 0,(function(){var t;return F(this,(function(r){switch(r.label){case 0:if(!n)return[2];r.label=1;case 1:return r.trys.push([1,4,,5]),this.storageSynced?[3,3]:[4,this.syncStorage()];case 2:r.sent(),r.label=3;case 3:return this.config.storage.setItem(e,JSON.stringify(n)),[3,5];case 4:return t=r.sent(),V.error("Failed to store in-app messages",t),[3,5];case 5:return[2]}}))}))},this.removeMessages=function(e){return L(t,void 0,void 0,(function(){var t;return F(this,(function(n){switch(n.label){case 0:return n.trys.push([0,3,,4]),this.storageSynced?[3,2]:[4,this.syncStorage()];case 1:n.sent(),n.label=2;case 2:return this.config.storage.removeItem(e),[3,4];case 3:return t=n.sent(),V.error("Failed to remove in-app messages from storage",t),[3,4];case 4:return[2]}}))}))},this.defaultConflictHandler=function(t){return t.sort((function(t,e){var n,r,o=null===(n=t.metadata)||void 0===n?void 0:n.endDate,i=null===(r=e.metadata)||void 0===r?void 0:r.endDate;return o===i?0:o&&!i?-1:!o&&i?1:new Date(o)<new Date(i)?-1:1}))[0]},this.config={storage:(new i.StorageHelper).getStorage()},this.setConflictHandler(this.defaultConflictHandler)}return t.prototype.getModuleName=function(){return"InAppMessaging"},t}(),B=function(){return(B=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},H=new i.ConsoleLogger("Notifications"),q=new(function(){function t(){var t=this;this.config={},this.configure=function(e){var n=(void 0===e?{}:e).Notifications;return t.config=B(B({},t.config),n),H.debug("configure Notifications",n),t.inAppMessaging.configure(t.config.InAppMessaging),t.config},this.inAppMessaging=new U}return t.prototype.getModuleName=function(){return"Notifications"},Object.defineProperty(t.prototype,"InAppMessaging",{get:function(){return this.inAppMessaging},enumerable:!0,configurable:!0}),t}()),z=q;i.Amplify.register(q)}])}));
//# sourceMappingURL=aws-amplify-notifications.min.js.map

@@ -68,3 +68,3 @@ /*

import { AWSPinpointMessageEvent, } from './types';
import { clearMemo, dispatchInAppMessagingEvent, extractContent, extractMetadata, getStartOfDay, isBeforeEndDate, logger, matchesAttributes, matchesEventType, matchesMetrics, recordAnalyticsEvent, } from './utils';
import { clearMemo, dispatchInAppMessagingEvent, extractContent, extractMetadata, getStartOfDay, interpretLayout, isBeforeEndDate, logger, matchesAttributes, matchesEventType, matchesMetrics, recordAnalyticsEvent, } from './utils';
var MESSAGE_DAILY_COUNT_KEY = 'pinpointProvider_inAppMessages_dailyCount';

@@ -487,3 +487,3 @@ var MESSAGE_TOTAL_COUNT_KEY = 'pinpointProvider_inAppMessages_totalCount';

content: extractContent(message),
layout: InAppMessage.Layout,
layout: interpretLayout(InAppMessage.Layout),
metadata: extractMetadata(message),

@@ -490,0 +490,0 @@ };

import { ConsoleLogger } from '@aws-amplify/core';
import { InAppMessageCampaign as PinpointInAppMessage } from '@aws-sdk/client-pinpoint';
import { InAppMessage, InAppMessageContent, InAppMessagingEvent } from '../../types';
import { InAppMessage, InAppMessageContent, InAppMessageLayout, InAppMessagingEvent } from '../../types';
import { AWSPinpointMessageEvent, MetricsComparator } from './types';

@@ -16,3 +16,4 @@ export declare const logger: ConsoleLogger;

export declare const clearMemo: () => void;
export declare const interpretLayout: (layout: string) => InAppMessageLayout;
export declare const extractContent: ({ InAppMessage: message, }: PinpointInAppMessage) => InAppMessageContent[];
export declare const extractMetadata: ({ InAppMessage, Priority, Schedule, TreatmentId, }: PinpointInAppMessage) => any;

@@ -18,2 +18,3 @@ var __read = (this && this.__read) || function (o, n) {

import { Amplify, ConsoleLogger, Hub } from '@aws-amplify/core';
import { Layout as PinpointInAppMessageLayout, } from '@aws-sdk/client-pinpoint';
import isEmpty from 'lodash/isEmpty';

@@ -172,2 +173,21 @@ var AMPLIFY_SYMBOL = (typeof Symbol !== 'undefined' && typeof Symbol.for === 'function'

};
// in the pinpoint console when a message is created with a Modal or Full Screen layout,
// it is assigned a layout value of MOBILE_FEED or OVERLAYS respectively in the message payload.
// In the future, Pinpoint will be updating the layout values in the aforementioned scenario
// to MODAL and FULL_SCREEN.
//
// This utility acts as a safeguard to ensure that:
// - 1. the usage of MOBILE_FEED and OVERLAYS as values for message layouts are not leaked
// outside the Pinpoint provider
// - 2. Amplify correctly handles the legacy layout values from Pinpoint after they are updated
export var interpretLayout = function (layout) {
if (layout === PinpointInAppMessageLayout.MOBILE_FEED) {
return 'MODAL';
}
if (layout === PinpointInAppMessageLayout.OVERLAYS) {
return 'FULL_SCREEN';
}
// cast as PinpointInAppMessage['InAppMessage']['Layout'] allows `string` as a value
return layout;
};
export var extractContent = function (_a) {

@@ -174,0 +194,0 @@ var message = _a.InAppMessage;

@@ -44,3 +44,3 @@ import { NotificationsCategory } from '../types';

}
export declare type InAppMessageLayout = 'BOTTOM_BANNER' | 'CAROUSEL' | 'MIDDLE_BANNER' | 'OVERLAYS' | 'TOP_BANNER';
export declare type InAppMessageLayout = 'BOTTOM_BANNER' | 'CAROUSEL' | 'FULL_SCREEN' | 'MIDDLE_BANNER' | 'MODAL' | 'TOP_BANNER';
export declare type InAppMessageAction = 'CLOSE' | 'DEEP_LINK' | 'LINK';

@@ -47,0 +47,0 @@ export declare type InAppMessageTextAlign = 'center' | 'left' | 'right';

@@ -491,3 +491,3 @@ "use strict";

content: utils_1.extractContent(message),
layout: InAppMessage.Layout,
layout: utils_1.interpretLayout(InAppMessage.Layout),
metadata: utils_1.extractMetadata(message),

@@ -494,0 +494,0 @@ };

import { ConsoleLogger } from '@aws-amplify/core';
import { InAppMessageCampaign as PinpointInAppMessage } from '@aws-sdk/client-pinpoint';
import { InAppMessage, InAppMessageContent, InAppMessagingEvent } from '../../types';
import { InAppMessage, InAppMessageContent, InAppMessageLayout, InAppMessagingEvent } from '../../types';
import { AWSPinpointMessageEvent, MetricsComparator } from './types';

@@ -16,3 +16,4 @@ export declare const logger: ConsoleLogger;

export declare const clearMemo: () => void;
export declare const interpretLayout: (layout: string) => InAppMessageLayout;
export declare const extractContent: ({ InAppMessage: message, }: PinpointInAppMessage) => InAppMessageContent[];
export declare const extractMetadata: ({ InAppMessage, Priority, Schedule, TreatmentId, }: PinpointInAppMessage) => any;

@@ -23,2 +23,3 @@ "use strict";

var core_1 = require("@aws-amplify/core");
var client_pinpoint_1 = require("@aws-sdk/client-pinpoint");
var isEmpty_1 = __importDefault(require("lodash/isEmpty"));

@@ -177,2 +178,21 @@ var AMPLIFY_SYMBOL = (typeof Symbol !== 'undefined' && typeof Symbol.for === 'function'

};
// in the pinpoint console when a message is created with a Modal or Full Screen layout,
// it is assigned a layout value of MOBILE_FEED or OVERLAYS respectively in the message payload.
// In the future, Pinpoint will be updating the layout values in the aforementioned scenario
// to MODAL and FULL_SCREEN.
//
// This utility acts as a safeguard to ensure that:
// - 1. the usage of MOBILE_FEED and OVERLAYS as values for message layouts are not leaked
// outside the Pinpoint provider
// - 2. Amplify correctly handles the legacy layout values from Pinpoint after they are updated
exports.interpretLayout = function (layout) {
if (layout === client_pinpoint_1.Layout.MOBILE_FEED) {
return 'MODAL';
}
if (layout === client_pinpoint_1.Layout.OVERLAYS) {
return 'FULL_SCREEN';
}
// cast as PinpointInAppMessage['InAppMessage']['Layout'] allows `string` as a value
return layout;
};
exports.extractContent = function (_a) {

@@ -179,0 +199,0 @@ var message = _a.InAppMessage;

@@ -44,3 +44,3 @@ import { NotificationsCategory } from '../types';

}
export declare type InAppMessageLayout = 'BOTTOM_BANNER' | 'CAROUSEL' | 'MIDDLE_BANNER' | 'OVERLAYS' | 'TOP_BANNER';
export declare type InAppMessageLayout = 'BOTTOM_BANNER' | 'CAROUSEL' | 'FULL_SCREEN' | 'MIDDLE_BANNER' | 'MODAL' | 'TOP_BANNER';
export declare type InAppMessageAction = 'CLOSE' | 'DEEP_LINK' | 'LINK';

@@ -47,0 +47,0 @@ export declare type InAppMessageTextAlign = 'center' | 'left' | 'right';

{
"name": "@aws-amplify/notifications",
"version": "0.1.1-in-app-messaging.7067+72e99b94a",
"version": "0.1.1-in-app-messaging.7068+91ef04ded",
"description": "Notifications category of aws-amplify",

@@ -45,4 +45,4 @@ "main": "./lib/index.js",

"dependencies": {
"@aws-amplify/cache": "4.0.23-in-app-messaging.48+72e99b94a",
"@aws-amplify/core": "4.3.3-in-app-messaging.48+72e99b94a",
"@aws-amplify/cache": "4.0.23-in-app-messaging.49+91ef04ded",
"@aws-amplify/core": "4.3.3-in-app-messaging.49+91ef04ded",
"@aws-sdk/client-pinpoint": "^3.33.0",

@@ -101,3 +101,3 @@ "lodash": "^4.17.21",

},
"gitHead": "72e99b94afc8408ee2079b09897303b84ab5f15a"
"gitHead": "91ef04ded25e8e2d088b88ede8188ed0807fc7d6"
}

@@ -61,2 +61,3 @@ /*

getStartOfDay,
interpretLayout,
isBeforeEndDate,

@@ -521,3 +522,3 @@ logger,

content: extractContent(message),
layout: InAppMessage.Layout as InAppMessageLayout,
layout: interpretLayout(InAppMessage.Layout),
metadata: extractMetadata(message),

@@ -524,0 +525,0 @@ };

import { Amplify, ConsoleLogger, Hub } from '@aws-amplify/core';
import { InAppMessageCampaign as PinpointInAppMessage } from '@aws-sdk/client-pinpoint';
import {
InAppMessageCampaign as PinpointInAppMessage,
Layout as PinpointInAppMessageLayout,
} from '@aws-sdk/client-pinpoint';
import isEmpty from 'lodash/isEmpty';

@@ -8,2 +11,3 @@ import {

InAppMessageContent,
InAppMessageLayout,
InAppMessageTextAlign,

@@ -212,2 +216,26 @@ InAppMessagingEvent,

// in the pinpoint console when a message is created with a Modal or Full Screen layout,
// it is assigned a layout value of MOBILE_FEED or OVERLAYS respectively in the message payload.
// In the future, Pinpoint will be updating the layout values in the aforementioned scenario
// to MODAL and FULL_SCREEN.
//
// This utility acts as a safeguard to ensure that:
// - 1. the usage of MOBILE_FEED and OVERLAYS as values for message layouts are not leaked
// outside the Pinpoint provider
// - 2. Amplify correctly handles the legacy layout values from Pinpoint after they are updated
export const interpretLayout = (
layout: PinpointInAppMessage['InAppMessage']['Layout']
): InAppMessageLayout => {
if (layout === PinpointInAppMessageLayout.MOBILE_FEED) {
return 'MODAL';
}
if (layout === PinpointInAppMessageLayout.OVERLAYS) {
return 'FULL_SCREEN';
}
// cast as PinpointInAppMessage['InAppMessage']['Layout'] allows `string` as a value
return layout as InAppMessageLayout;
};
export const extractContent = ({

@@ -214,0 +242,0 @@ InAppMessage: message,

@@ -83,4 +83,5 @@ /*

| 'CAROUSEL'
| 'FULL_SCREEN'
| 'MIDDLE_BANNER'
| 'OVERLAYS'
| 'MODAL'
| 'TOP_BANNER';

@@ -87,0 +88,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc