{ "version": 3, "sources": ["src/app/main/components/base/baseActivity.component.ts"], "sourcesContent": ["import { OnDestroy } from '@angular/core';\r\nimport { ActivityService } from '../../service/activity.service';\r\nimport { GaFieldsObject } from 'src/app/core/model';\r\nimport { BaseComponent } from './base.component';\r\nimport { GaInfo } from 'src/app/config/ga-info.constant';\r\nimport { Payment, SubmitPaymentPlanDetails, PaymentPlan } from '../../model';\r\nimport { environment } from 'src/environments/environment';\r\nimport { utils } from '../../utils/utils.constant';\r\n\r\nexport class BaseActivityComponent extends BaseComponent implements OnDestroy {\r\n\r\n constructor(public activity: ActivityService, protected eventCategory: string) {\r\n super();\r\n }\r\n\r\n protected getGaLinkerParam(): string {\r\n return this.activity.getGaLinkerParam();\r\n }\r\n\r\n protected sendCategoryEvent(category: string, action: string, label?: string | number, data?: Map<string, any>, callback?: Function) {\r\n const fieldObject: GaFieldsObject = {\r\n gaEvent: null,\r\n eventCategory: category,\r\n eventAction: action,\r\n eventLabel: typeof label === 'string' ? label : label?.toString(),\r\n hitCallback: callback\r\n };\r\n\r\n this.activity.sendEvent(fieldObject, data);\r\n }\r\n\r\n protected sendNamedCategoryEvent(gaEvent: string, category: string, action: string, label: string | number, data?: Map<string, any>, callback?: Function) {\r\n const fieldObject: GaFieldsObject = {\r\n gaEvent,\r\n eventCategory: category,\r\n eventAction: action,\r\n eventLabel: typeof label === 'string' ? label : label?.toString(),\r\n hitCallback: callback\r\n };\r\n\r\n this.activity.sendEvent(fieldObject, data);\r\n }\r\n\r\n protected sendEvent(action: string, label?: string, data?: Map<string, any>, callback?: Function) {\r\n this.sendNamedCategoryEvent(null, this.eventCategory, action, label, data, callback);\r\n }\r\n\r\n protected sendNamedEvent(gaEvent: string, action: string, label?: string, data?: Map<string, any>, callback?: Function) {\r\n this.sendNamedCategoryEvent(gaEvent, this.eventCategory, action, label, data, callback);\r\n }\r\n\r\n protected sendAccountEvent(action: string, label: string, acctId: number, acctKey?: string, callback?: Function) {\r\n this.sendNamedCategoryEvent(null, this.eventCategory, action, label, new Map([['acctId', acctId?.toString()], ['acctKey', acctKey]]), callback);\r\n }\r\n\r\n protected sendNamedAccountEvent(gaEvent: string, action: string, label: string, acctId: number, acctKey?: string, callback?: Function) {\r\n this.sendNamedCategoryEvent(gaEvent, this.eventCategory, action, label, new Map([['acctId', acctId?.toString()], ['acctKey', acctKey]]), callback);\r\n }\r\n\r\n protected sendPaymentEvent(action: string, label: string | number, payment: Payment | SubmitPaymentPlanDetails, acctId?: number, callback?: Function) {\r\n const data = new Map([['payment', this.activity.formatPayment(payment)]]);\r\n if (acctId) {\r\n data.set('acctId', acctId.toString());\r\n } else if (payment && payment instanceof Payment && payment.accountId) {\r\n data.set('acctId', payment.accountId.toString());\r\n } else if (payment && payment instanceof SubmitPaymentPlanDetails && payment.account?.acctKey) {\r\n data.set('acctKey', payment.account.acctKey);\r\n }\r\n this.sendNamedCategoryEvent(null, GaInfo.event.category.payments, action, label, data, callback);\r\n }\r\n\r\n protected sendAmDataDisclosureEvent(accountValue: string, disclosureVerbiageId?: number) {\r\n const key = utils.isNumeric(accountValue) ? 'acctId' : 'acctKey';\r\n const accountDisclosureDetailsMap = new Map<string, any>([[key, accountValue], ['disclosureVerbiageId', disclosureVerbiageId]]);\r\n this.activity.sendNamedCategoryEvent(\r\n 'amDataDisclosure',\r\n GaInfo.event.category.user,\r\n 'Disclosures from AM Data',\r\n `Disclosures from AM Data for Account ${accountValue}`,\r\n accountDisclosureDetailsMap);\r\n }\r\n\r\n protected sendPaymentPlanDisplayedEvent(action: string, label: string, plan: PaymentPlan, setIdentifier: string, setNumber: string, acctKey?: string, callback?: Function) {\r\n const data = new Map([['payment', this.activity.formatPaymentPlan(plan)]]);\r\n\r\n const displayedOffer = {\r\n acctKey: acctKey,\r\n term: plan.term,\r\n displayText: plan.description,\r\n totalPayoff: plan.totalPlanAmount,\r\n currBalance: plan.balance,\r\n paymentStructure: plan.paymentStructure,\r\n setIdentifier: setIdentifier,\r\n setNumber: setNumber,\r\n settlementOfferId: plan.settlementOfferId\r\n };\r\n data.set('displayedOffer', displayedOffer);\r\n if (acctKey) {\r\n data.set('acctKey', acctKey);\r\n }\r\n\r\n this.sendNamedCategoryEvent(null, this.eventCategory, action, label, data, callback);\r\n }\r\n\r\n logLink(evt: Event, gaName: string, action?: string, category?: string) {\r\n // We are leaving the portal. This log request doesn't work locally so disable the developer nag alerts\r\n environment.disableErrorAlerts();\r\n const url = this.getHrefFromLink(evt);\r\n action = action || 'Go to Link';\r\n const gaEvent = '_' + (gaName ? 'goToLink_' + gaName : utils.toCamelCase(action, ' '));\r\n this.logUrl(url, gaEvent, category, action);\r\n return true;\r\n }\r\n\r\n protected logUrl(url: string, gaEvent: string, category?: string, action?: string) {\r\n this.sendNamedCategoryEvent(gaEvent, category || this.eventCategory, action , url);\r\n }\r\n\r\n private getHrefFromLink(evt: Event): string {\r\n return (<HTMLAnchorElement> evt.target).href || (<HTMLAnchorElement>(<HTMLElement> evt.target).parentElement).href;\r\n }\r\n}\r\n"], "mappings": "8KASM,IAAOA,EAAP,cAAqCC,CAAa,CAEpDC,YAAmBC,EAAqCC,EAAqB,CACzE,MAAK,EADU,KAAAD,SAAAA,EAAqC,KAAAC,cAAAA,CAExD,CAEUC,kBAAgB,CACtB,OAAO,KAAKF,SAASE,iBAAgB,CACzC,CAEUC,kBAAkBC,EAAkBC,EAAgBC,EAAyBC,EAAyBC,EAAmB,CAC/H,IAAMC,EAA8B,CAChCC,QAAS,KACTT,cAAeG,EACfO,YAAaN,EACbO,WAAY,OAAON,GAAU,SAAWA,EAAQA,GAAAA,YAAAA,EAAOO,WACvDC,YAAaN,GAGjB,KAAKR,SAASe,UAAUN,EAAaF,CAAI,CAC7C,CAEUS,uBAAuBN,EAAiBN,EAAkBC,EAAgBC,EAAwBC,EAAyBC,EAAmB,CACpJ,IAAMC,EAA8B,CAChCC,QAAAA,EACAT,cAAeG,EACfO,YAAaN,EACbO,WAAY,OAAON,GAAU,SAAWA,EAAQA,GAAAA,YAAAA,EAA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AEU6D,OAAOH,EAAarD,EAAiBN,EAAmBC,EAAe,CAC7E,KAAKW,uBAAuBN,EAASN,GAAY,KAAKH,cAAeI,EAAS0D,CAAG,CACrF,CAEQC,gBAAgBL,EAAU,CAC9B,OAA4BA,EAAIQ,OAAQC,MAA2CT,EAAIQ,OAAQE,cAAeD,IAClH", "names": ["BaseActivityComponent", "BaseComponent", "constructor", "activity", "eventCategory", "getGaLinkerParam", "sendCategoryEvent", "category", "action", "label", "data", "callback", "fieldObject", "gaEvent", "eventAction", "eventLabel", "toString", "hitCallback", "sendEvent", "sendNamedCategoryEvent", "sendNamedEvent", "sendAccountEvent", "acctId", "acctKey", "Map", "sendNamedAccountEvent", "sendPaymentEvent", "payment", "_a", "formatPayment", "set", "Payment", "accountId", "SubmitPaymentPlanDetails", "account", "GaInfo", "event", "payments", "sendAmDataDisclosureEvent", "accountValue", "disclosureVerbiageId", "key", "utils", "isNumeric", "accountDisclosureDetailsMap", "user", "sendPaymentPlanDisplayedEvent", "plan", "setIdentifier", "setNumber", "formatPaymentPlan", "displayedOffer", "term", "displayText", "description", "totalPayoff", "totalPlanAmount", "currBalance", "balance", "paymentStructure", "settlementOfferId", "logLink", "evt", "gaName", "environment", "disableErrorAlerts", "url", "getHrefFromLink", "toCamelCase", "logUrl", "target", "href", "parentElement"] }