@clickview/lite 0.52.4-rc.2 → 0.52.5-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bundles.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "appBundle": "bundle-3908df5fdf.min.js",
2
+ "appBundle": "bundle-3d06481af8.min.js",
3
3
  "cssBundle": "lite-app-67cb0ca9a1.css",
4
4
  "polyfillBundle": "polyfills-365f92d668.min.js"
5
5
  }
@@ -0,0 +1,3 @@
1
+ /*! For license information please see 2676-05aaf9a93a-lite.chunk.js.LICENSE.txt */
2
+ "use strict";(self.webpackChunk_clickview_lite=self.webpackChunk_clickview_lite||[]).push([[2676],{92676:(t,e,r)=>{r.r(e),r.d(e,{BrazeClientService:()=>m,BrazeNewIamEvent:()=>g});var n=r(63093),i=r(81886),o=r(72688),a=r(99504),u=r(52003),c=r(60735);function s(t){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s(t)}function l(){l=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",u=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(t){f=function(t,e,r){return t[e]=r}}function h(t,e,r,n){var o=e&&e.prototype instanceof b?e:b,a=Object.create(o.prototype),u=new A(n||[]);return i(a,"_invoke",{value:j(t,r,u)}),a}function p(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var v="suspendedStart",y="suspendedYield",d="executing",g="completed",m={};function b(){}function w(){}function k(){}var O={};f(O,a,(function(){return this}));var C=Object.getPrototypeOf,E=C&&C(C(D([])));E&&E!==r&&n.call(E,a)&&(O=E);var L=k.prototype=b.prototype=Object.create(O);function x(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function r(i,o,a,u){var c=p(t[i],t,o);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==s(f)&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,a,u)}),(function(t){r("throw",t,a,u)})):e.resolve(f).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,u)}))}u(c.arg)}var o;i(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,i){r(t,n,e,i)}))}return o=o?o.then(i,i):i()}})}function j(e,r,n){var i=v;return function(o,a){if(i===d)throw Error("Generator is already running");if(i===g){if("throw"===o)throw a;return{value:t,done:!0}}for(n.method=o,n.arg=a;;){var u=n.delegate;if(u){var c=z(u,n);if(c){if(c===m)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===v)throw i=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=d;var s=p(e,r,n);if("normal"===s.type){if(i=n.done?g:y,s.arg===m)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(i=g,n.method="throw",n.arg=s.arg)}}}function z(e,r){var n=r.method,i=e.iterator[n];if(i===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,z(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var o=p(i,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,m;var a=o.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function I(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function D(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function r(){for(;++i<e.length;)if(n.call(e,i))return r.value=e[i],r.done=!1,r;return r.value=t,r.done=!0,r};return o.next=o}}throw new TypeError(s(e)+" is not iterable")}return w.prototype=k,i(L,"constructor",{value:k,configurable:!0}),i(k,"constructor",{value:w,configurable:!0}),w.displayName=f(k,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,k):(t.__proto__=k,f(t,c,"GeneratorFunction")),t.prototype=Object.create(L),t},e.awrap=function(t){return{__await:t}},x(_.prototype),f(_.prototype,u,(function(){return this})),e.AsyncIterator=_,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new _(h(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(L),f(L,c,"Generator"),f(L,a,(function(){return this})),f(L,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=D,A.prototype={constructor:A,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 r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function i(n,i){return u.type="throw",u.arg=e,r.next=n,i&&(r.method="next",r.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],u=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(c&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),I(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;I(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:D(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function f(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,h(n.key),n)}}function h(t){var e=function(t,e){if("object"!=s(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=s(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==s(e)?e:e+""}function p(t,e,r){return e=y(e),function(t,e){if(e&&("object"==s(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,v()?Reflect.construct(e,r||[],y(t).constructor):e.apply(t,r))}function v(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(v=function(){return!!t})()}function y(t){return y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},y(t)}function d(t,e){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},d(t,e)}var g="braze:new:iam",m=function(t){function e(t){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),p(this,e,[t])}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&d(t,e)}(e,t),r=e,(i=[{key:"name",get:function(){return c.D.BrazeClient}},{key:"channelName",get:function(){return u.Q4.BRAZE}},{key:"clientInstance",get:function(){if(this.ready)return this.brazeClient}},{key:"initialize",value:function(){var t,e;(null===(t=this.options.eventOptions)||void 0===t?void 0:t.logUtmParameters)&&(this.utmParameters=a.F.getUtmParameters()),(null===(e=this.options.eventOptions)||void 0===e?void 0:e.logAttributionData)&&(this.attributionData=o.N.getDecodedAttributionData()),this.setup()}},{key:"isReady",get:function(){return this.ready}},{key:"setup",value:function(){var t,e=this,r=this.options.context;if(this.iamQueue=[],this.brazeClient=new n.BrazeClient({apiOptions:this.getInstanceOptions(),allowAnonymous:!1,shouldInitialize:this.options.client.shouldInitialize,subscriptions:{subscribeToInAppMessage:function(t){return e.subscribeToInAppMessage(t)}}}),r.user.isAuthenticated&&this.options.client.shouldInitialize){var i=this.getBrazeUser(r.user);(null===(t=this.options.geoLocation)||void 0===t?void 0:t.countryCode)&&(i.country=this.options.geoLocation.countryCode),this.setUser(i)}this.ready=!0}},{key:"setUser",value:function(t){this.brazeClient.setUser(t)}},{key:"setUserInit",value:function(t){this.brazeClient.setUserInit(t)}},{key:"getBrazeUser",value:function(t){return{email:t.email,firstName:t.givenName,lastName:t.familyName,custom:{masterId:t.id}}}},{key:"getInstanceOptions",value:function(){return{productName:this.options.client.productName,productVersion:this.options.client.version,apiKey:this.options.client.apiKey,baseUrl:this.options.client.baseUrl,enableLogging:!1,automaticallyShowInAppMessages:!1,allowUserSuppliedJavascript:!0}}},{key:"subscribeToInAppMessage",value:function(t){var e,r;if((null===(r=null===(e=this.options)||void 0===e?void 0:e.subscriptions)||void 0===r?void 0:r.inAppMessage)&&!t.isControl){var n=this.getChannel();this.iamQueue.push(t),n.trigger(g)}}},{key:"getContentCards",value:function(){var t,e,r,n,i;return e=this,r=void 0,n=void 0,i=l().mark((function e(){return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null===(t=this.brazeClient.card)||void 0===t?void 0:t.getContentCards();case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})),new(n||(n=Promise))((function(t,o){function a(t){try{c(i.next(t))}catch(t){o(t)}}function u(t){try{c(i.throw(t))}catch(t){o(t)}}function c(e){var r;e.done?t(e.value):(r=e.value,r instanceof n?r:new n((function(t){t(r)}))).then(a,u)}c((i=i.apply(e,r||[])).next())}))}},{key:"logContentCardDismissal",value:function(t){var e;return null===(e=this.brazeClient.card)||void 0===e?void 0:e.logDismissal(t)}},{key:"logContentCardClick",value:function(t){var e;return null===(e=this.brazeClient.card)||void 0===e?void 0:e.logClick(t)}},{key:"logContentCardImpressions",value:function(t){var e;return null===(e=this.brazeClient.card)||void 0===e?void 0:e.logImpressions(t)}},{key:"logFormEvent",value:function(t){var e=this.hydrateAdditionalData(t);this.brazeClient.event.logForm(e)}},{key:"logAnalyticsEvent",value:function(t){var e=this.hydrateAdditionalData(t);this.brazeClient.event.logAnalytics(e)}},{key:"logEvent",value:function(t){var e=this.hydrateAdditionalData(t);return this.brazeClient.event.log(e)}},{key:"showInAppMessage",value:function(t,e,r){return this.brazeClient.bam.show(t,e,r)}},{key:"handleInAppMessages",value:function(t){if(this.iamQueue.length)for(;this.iamQueue.length;){var e=this.iamQueue.pop();if(!e)return;t(e)}}},{key:"hydrateAdditionalData",value:function(t){var e,r,n=t.additionalData||{};return this.utmParameters&&(n.utms=this.utmParameters),(null===(e=this.attributionData)||void 0===e?void 0:e.originalReferrer)&&(n.original_referrer=this.attributionData.originalReferrer),(null===(r=this.attributionData)||void 0===r?void 0:r.internalReferrer)&&(n.internal_referrer=this.attributionData.internalReferrer),Object.assign(Object.assign({},t),{additionalData:n})}}])&&f(r.prototype,i),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,i}(i.Q.t6)}}]);
3
+ //# sourceMappingURL=2676-05aaf9a93a-lite.chunk.js.map
@@ -0,0 +1 @@
1
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scripts/2676-05aaf9a93a-lite.chunk.js","mappings":";yhQAuCaA,EAAmB,gBAEnBC,EAAmB,YA0B9B,WAAYC,GAAkC,sHACtCA,GACR,CAAC,0TAjBD,WACE,OAAO,eACT,GAEA,uBACA,WACE,OAAO,UACT,GAAC,0BAED,WACE,GAAKC,KAAKC,MAEV,OAAOD,KAAKE,WACd,GAAC,wBAMM,oBACwB,QAAzB,EAAAF,KAAKD,QAAQI,oBAAY,eAAEC,oBAC7BJ,KAAKK,cAAgB,yBAGM,QAAzB,EAAAL,KAAKD,QAAQI,oBAAY,eAAEG,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AkC,kBAAIxE,KAAKO,gBAAgBkE,mBAGrC,QAApB,EAAAzE,KAAKO,uBAAe,eAAEmE,oBACxBF,EAAkC,kBAAIxE,KAAKO,gBAAgBmE,kBAGtD,OAAP,wBACKhB,GAAK,CACRc,eAAAA,GAEJ,mFAAC,CAxL6B,CAAQ","sources":["file:///app/packages/libs/shared/src/services/BrazeClientService.ts"],"sourcesContent":["import type { AnalyticsEventType, BrazeClientOptions, BrazeUser, CaptionedImageCard, Card, ControlMessage, EventType, FormEventType, InAppMessage, LogEventOptions } from '@clickview/braze-client';\nimport { BrazeClient } from '@clickview/braze-client';\n\nimport { Core } from 'libs/common/core';\nimport { HashObject } from 'libs/common/react/interfaces';\n\nimport { AnalyticsClientOptions } from 'libs/analytics/clients/BaseAnalyticsClient';\nimport { AttributionData, UtmParameters } from 'libs/analytics/models/CollectionEvent';\nimport { AttributionHelper } from 'libs/analytics/utils/AttributionHelper';\nimport { UtmHelper } from 'libs/analytics/utils/UtmHelper';\n\nimport { SharedServiceChannels } from 'libs/shared/constants/RadioChannels';\nimport { SharedServices } from 'libs/shared/constants/SharedServices';\nimport { CurrentUser } from 'libs/shared/interfaces';\nimport { HandleIamCallback } from 'libs/shared/interfaces/braze/BrazeIam';\nimport { GeoLocation } from 'libs/shared/interfaces/responses/GeoLocation';\n\nexport interface BrazeClientServiceOptions extends AnalyticsClientOptions {\n client: {\n productName: string;\n version: string;\n apiKey: string;\n baseUrl: string;\n geoLocation: GeoLocation;\n shouldInitialize: boolean;\n },\n subscriptions?: {\n inAppMessage?: boolean;\n contentCards?: boolean;\n }\n context: {\n user: CurrentUser;\n };\n eventOptions?: {\n logUtmParameters?: boolean;\n logAttributionData?: boolean;\n },\n}\n\nexport const BrazeNewIamEvent = 'braze:new:iam';\n\nexport class BrazeClientService extends Core.Service {\n private brazeClient: BrazeClient;\n \n private iamQueue: InAppMessage[];\n private utmParameters?: UtmParameters;\n private attributionData?: AttributionData;\n\n protected options: BrazeClientServiceOptions;\n protected ready: boolean;\n\n // @ts-ignore\n public get name(): string {\n return SharedServices.BrazeClient;\n }\n\n // @ts-ignore\n public get channelName(): string {\n return SharedServiceChannels.BRAZE;\n }\n\n public get clientInstance(): BrazeClient {\n if (!this.ready) return;\n\n return this.brazeClient;\n }\n\n constructor(options: BrazeClientServiceOptions) {\n super(options);\n }\n\n public initialize(): void {\n if (this.options.eventOptions?.logUtmParameters) {\n this.utmParameters = UtmHelper.getUtmParameters();\n }\n\n if (this.options.eventOptions?.logAttributionData) {\n this.attributionData = AttributionHelper.getDecodedAttributionData();\n }\n\n this.setup();\n }\n\n public get isReady() {\n return this.ready;\n }\n\n public setup() {\n const { context } = this.options;\n\n this.iamQueue = [];\n\n this.brazeClient = new BrazeClient({\n apiOptions: this.getInstanceOptions(),\n allowAnonymous: false,\n shouldInitialize: this.options.client.shouldInitialize,\n subscriptions: {\n subscribeToInAppMessage: iam => this.subscribeToInAppMessage(iam)\n }\n });\n\n if (context.user.isAuthenticated && this.options.client.shouldInitialize) {\n const brazeUser: BrazeUser = this.getBrazeUser(context.user);\n \n if (this.options.geoLocation?.countryCode) {\n brazeUser.country = this.options.geoLocation.countryCode;\n }\n\n this.setUser(brazeUser);\n }\n\n this.ready = true;\n }\n\n public setUser(user: BrazeUser) {\n this.brazeClient.setUser(user);\n }\n\n public setUserInit(user: BrazeUser) {\n this.brazeClient.setUserInit(user);\n }\n\n private getBrazeUser(currentUser: CurrentUser): BrazeUser {\n return {\n email: currentUser.email,\n firstName: currentUser.givenName,\n lastName: currentUser.familyName,\n custom: {\n masterId: currentUser.id\n }\n };\n }\n\n private getInstanceOptions(): BrazeClientOptions {\n return {\n productName: this.options.client.productName,\n productVersion: this.options.client.version,\n apiKey: this.options.client.apiKey,\n baseUrl: this.options.client.baseUrl,\n enableLogging: false,\n automaticallyShowInAppMessages: false,\n allowUserSuppliedJavascript: true\n };\n }\n\n private subscribeToInAppMessage(iam: InAppMessage | ControlMessage) {\n if (!this.options?.subscriptions?.inAppMessage || iam.isControl) return;\n \n const channel = this.getChannel();\n this.iamQueue.push(iam as InAppMessage);\n channel.trigger(BrazeNewIamEvent);\n }\n\n public async getContentCards(): Promise<CaptionedImageCard[]> {\n return await this.brazeClient.card?.getContentCards() as CaptionedImageCard[];\n }\n\n public logContentCardDismissal(card: Card): void {\n return this.brazeClient.card?.logDismissal(card);\n }\n\n public logContentCardClick(card: Card): void {\n return this.brazeClient.card?.logClick(card);\n }\n\n public logContentCardImpressions(cards: Card[]): void {\n return this.brazeClient.card?.logImpressions(cards);\n }\n\n public logFormEvent(event: LogEventOptions<FormEventType>) {\n const hydratedEvent = this.hydrateAdditionalData(event);\n \n this.brazeClient.event.logForm(hydratedEvent);\n }\n\n public logAnalyticsEvent(event: LogEventOptions<AnalyticsEventType>) {\n const hydratedEvent = this.hydrateAdditionalData(event);\n\n this.brazeClient.event.logAnalytics(hydratedEvent);\n }\n\n public logEvent(event: LogEventOptions): void {\n const hydratedEvent = this.hydrateAdditionalData(event);\n\n return this.brazeClient.event.log(hydratedEvent);\n }\n\n public showInAppMessage(\n inAppMessage: InAppMessage | ControlMessage,\n parentNode?: Element | null,\n onDisplayCallback?: undefined | (() => void)\n ) {\n return this.brazeClient.bam.show(inAppMessage, parentNode, onDisplayCallback);\n }\n\n public handleInAppMessages(callback: HandleIamCallback) {\n if (!this.iamQueue.length) return;\n\n while (this.iamQueue.length) {\n const currIam = this.iamQueue.pop();\n \n if (!currIam) return;\n\n callback(currIam);\n }\n }\n\n private hydrateAdditionalData<T = EventType>(event: LogEventOptions<T>): LogEventOptions<T> {\n const additionalData: HashObject<any> = event.additionalData || {};\n if (this.utmParameters) {\n additionalData['utms'] = this.utmParameters;\n }\n\n if (this.attributionData?.originalReferrer) {\n additionalData['original_referrer'] = this.attributionData.originalReferrer;\n }\n\n if (this.attributionData?.internalReferrer) {\n additionalData['internal_referrer'] = this.attributionData.internalReferrer;\n }\n \n return {\n ...event,\n additionalData\n };\n }\n}"],"names":["BrazeNewIamEvent","BrazeClientService","options","this","ready","brazeClient","eventOptions","logUtmParameters","utmParameters","logAttributionData","attributionData","setup","context","iamQueue","BrazeClient","apiOptions","getInstanceOptions","allowAnonymous","shouldInitialize","client","subscriptions","subscribeToInAppMessage","iam","user","isAuthenticated","brazeUser","getBrazeUser","geoLocation","countryCode","country","setUser","setUserInit","currentUser","email","firstName","givenName","lastName","familyName","custom","masterId","id","productName","productVersion","version","apiKey","baseUrl","enableLogging","automaticallyShowInAppMessages","allowUserSuppliedJavascript","inAppMessage","isControl","channel","getChannel","push","trigger","card","getContentCards","logDismissal","logClick","cards","logImpressions","event","hydratedEvent","hydrateAdditionalData","logForm","logAnalytics","log","parentNode","onDisplayCallback","bam","show","callback","length","currIam","pop","additionalData","originalReferrer","internalReferrer"],"sourceRoot":""}