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KAAKN,MAAKoD,wBARV,iBAQA,iBARA,aAQA,EAAgCC,SAAS,cAE1C,EAEF3D,EAASE,MAAMC,SAASC,qBAAqByD,UAAUyG,iBACtD,WACC,IAAIvE,EAAgBnF,KAAKc,qBAAqBK,QAC9C,MAAM,SAAEwI,GAAa1K,EAAIE,IAAIkG,UAE7B,GAAIsE,EAASrD,OAAQ,CACpB,MAAMsD,EAASD,EAASE,MAAMC,GAA0B,QAAlBA,EAAI9E,YACpC+E,EAAUJ,EAASE,MACvBC,GAA0B,SAAlBA,EAAI9E,YAERgF,EAAeL,EAASE,MAC5BC,GAA0B,SAAlBA,EAAI7E,YAA0C,IAAlB6E,EAAI7E,YAEpCgF,GAAgBN,EAASE,MAC7BC,GACkB,UAAlBA,EAAI7E,YAA2C,IAAlB6E,EAAI7E,YAIlCE,EADGyE,GAAUG,EACG/J,KAAKc,qBAAqBI,IAChC0I,EACM5J,KAAKc,qBAAqBC,IAEhCkJ,EACMjK,KAAKc,qBAAqBG,UAChC+I,EACMhK,KAAKc,qBAAqBI,IAE1BlB,KAAKc,qBAAqBE,IAE3C,CACD,OAAOmE,CACP,CAhCF,C,kCC9kBD,MAoBA,EApBqB,CAACoC,EAAOC,EAASb,KACrC,MAAMuD,EAAgB3C,aAAH,EAAGA,EAAQ,0BAC9B,IAAK2C,IAAkBC,MAAMC,QAAQF,GAEpC,OAAO,EAcR,OATcA,EAAcL,MAC1BQ,KACkB,gBAAjBA,EAAK7C,SAA6B6C,EAAK7C,UAAYA,GACpC,cAAf6C,EAAK1D,OAAyB0D,EAAK1D,QAAUA,IAMhD,C","sources":["webpack://ws-tagging/./src/utils/eventShouldBeTracked.js","webpack://ws-tagging/./src/utils/legacy/projects/shift/handlers/AbstractEventHandler.js","webpack://ws-tagging/./src/utils/nrSwitcher.js"],"sourcesContent":["import getEnv, { PROD } from './getEnv';\n\n/**\n * On nonprod always returns true and if on live returns true 10% of the time.\n *\n * @returns {boolean} true 10% of the time on prod and 100% of the time on NP\n * @example\n */\nconst eventShouldBeTracked = () =>\n\tgetEnv() !== PROD || Math.floor(Math.random() * (100 - 0) + 1) <= 10;\n\nexport default eventShouldBeTracked;\n","import { namespace, extend } from 'wsm-tagging-utils';\nimport eventShouldBeTracked from '../../../../eventShouldBeTracked';\nimport nrSwitcherOn from '../../../../nrSwitcher';\nimport getEnv from '../../../../getEnv';\n\nconst runAbstractEventHandler = (win) => {\n\tnamespace(win, 'DDC.tracking.shift.handlers');\n\n\tconst {\n\t\tDDC,\n\t\tDDC: { tracking },\n\t\tnewrelic\n\t} = win;\n\n\t/**\n\t * The standard EventHandler implementation\n\t *\n\t * @param {Object} window an instance of the global window object\n\t * @param {tracking.framework.runtime.Page} page A Page instance for page related queries\n\t * @constructor\n\t */\n\ttracking.shift.handlers.AbstractEventHandler =\n\t\tfunction AbstractEventHandler(thisWin, page, form) {\n\t\t\ttracking.framework.runtime.EventHandler.call(\n\t\t\t\tthis,\n\t\t\t\tthisWin,\n\t\t\t\tpage,\n\t\t\t\tform\n\t\t\t);\n\t\t\tthis.scriptLocation = undefined;\n\t\t\tthis.scriptObjectName = undefined;\n\t\t\tthis.clientId = undefined;\n\t\t\tthis.dealerCodeType = undefined;\n\t\t\tthis.retailerId = undefined;\n\t\t\tthis.providerId = undefined;\n\t\t\tthis.dealerAreaCode = undefined;\n\t\t\tthis.accelerateInitialClick = true;\n\t\t\tthis.myWalletInteracted = false;\n\t\t\t// DDC Form Tracking ID to Shift Form Type\n\t\t\tif (win?.DDC?.WidgetData?.['ws-tagging']?.mapping?.shift) {\n\t\t\t\tthis.formTrackingIdMapping =\n\t\t\t\t\twin.DDC.WidgetData['ws-tagging'].mapping.shift.form || {};\n\t\t\t}\n\n\t\t\t// DDC Inventory Type to Shift status mapping\n\t\t\tthis.inventoryTypeMapping = {\n\t\t\t\tNEW: 'New',\n\t\t\t\tUSED: 'Used',\n\t\t\t\tCERTIFIED: 'CPO',\n\t\t\t\tALL: 'Mixed',\n\t\t\t\tDEFAULT: ''\n\t\t\t};\n\t\t\t// DDC Page Alias to client page name mapping\n\n\t\t\t// DDC dealerCodeType to Shift pageBrand mapping\n\t\t\tthis.pageBrandMapping = {\n\t\t\t\tCLLC: 'CDJR',\n\t\t\t\tGENESISDWCP: 'Genesis',\n\t\t\t\tJAG: 'Jaguar',\n\t\t\t\tKIA: 'Kia',\n\t\t\t\tLR: 'Land Rover',\n\t\t\t\tMAZDA: 'Mazda',\n\t\t\t\tMBZ: 'Mercedes',\n\t\t\t\tAR: 'AlfaRomeo',\n\t\t\t\tFIAT: 'Fiat',\n\t\t\t\tPORSCHE: 'Porsche',\n\t\t\t\tTOYOTA: 'Toyota',\n\t\t\t\tLEXUS: 'Lexus',\n\t\t\t\tSUBARU: 'Subaru',\n\t\t\t\tSOA: 'Subaru',\n\t\t\t\tMASERATI: 'Maserati',\n\t\t\t\tBMW: 'BMW',\n\t\t\t\tVW: 'VW'\n\t\t\t};\n\t\t\t// Mapped name of current page\n\t\t\tthis.pageName = undefined;\n\n\t\t\t// DDC Inventory Type to Shift status mapping\n\t\t\tthis.fuelTypeMapping = {\n\t\t\t\tGASOLINE: 'Gasoline',\n\t\t\t\tDIESEL: 'Diesel',\n\t\t\t\tELECTRIC: 'Electric',\n\t\t\t\tHYBRID: 'Hybrid',\n\t\t\t\tDEFAULT: 'Gasoline'\n\t\t\t};\n\n\t\t\tthis.isFeaturedVehiclePage =\n\t\t\t\tthis?.page?.widgetIsPresent?.(\n\t\t\t\t\t/v9.widgets.inventory-featured.default.v1/\n\t\t\t\t) &&\n\t\t\t\t!(\n\t\t\t\t\tthis?.page\n\t\t\t\t\t\t?.currentPageAlias?.()\n\t\t\t\t\t\t?.includes?.('PROMOTIONS_LISTING') ||\n\t\t\t\t\tthis?.page\n\t\t\t\t\t\t?.currentPageAlias?.()\n\t\t\t\t\t\t?.includes?.('NO_RESULTS') ||\n\t\t\t\t\tthis?.page?.currentPageAlias?.() === 'INDEX'\n\t\t\t\t);\n\t\t};\n\n\t// Make AbstractEventHandler inherit from EventHandler\n\textend(\n\t\ttracking.shift.handlers.AbstractEventHandler,\n\t\ttracking.framework.runtime.EventHandler\n\t);\n\n\ttracking.shift.handlers.AbstractEventHandler.prototype.logCategory =\n\t\t'ws-tagging:AbstractEventHandler';\n\n\t// ======================================================================\n\t// --------------------- Configurable Properties ------------------------\n\t// ======================================================================\n\n\ttracking.shift.handlers.AbstractEventHandler.prototype.getScriptLocation =\n\t\tfunction getScriptLocation() {\n\t\t\treturn this.scriptLocation;\n\t\t};\n\n\t/**\n\t * Sets the location of the Shift-provided script that will be injected into the\n\t * current page.\n\t *\n\t * @param {string} scriptLocation The location of the Shift-provided script that will be\n\t * injected into the current page\n\t */\n\ttracking.shift.handlers.AbstractEventHandler.prototype.setScriptLocation =\n\t\tfunction setScriptLocation(scriptLocation) {\n\t\t\tthis.scriptLocation = scriptLocation;\n\t\t};\n\n\ttracking.shift.handlers.AbstractEventHandler.prototype.getScriptObjectName =\n\t\tfunction getScriptObjectName() {\n\t\t\treturn this.scriptObjectName;\n\t\t};\n\n\t/**\n\t * Sets the name of the provided script that will be injected into the current page.\n\t *\n\t * @param {string} scriptObjectName The name of the provided script that will be\n\t * injected into the current page\n\t */\n\ttracking.shift.handlers.AbstractEventHandler.prototype.setScriptObjectName =\n\t\tfunction setScriptObjectName(scriptObjectName) {\n\t\t\tthis.scriptObjectName = scriptObjectName;\n\t\t};\n\n\ttracking.shift.handlers.AbstractEventHandler.prototype.getClientId =\n\t\tfunction getClientId() {\n\t\t\treturn this.clientId;\n\t\t};\n\n\t/**\n\t * Sets the client identifier that is sent to Shift as part of the create event.\n\t *\n\t * @param {string} clientId The client identifier that is sent to Shift as part of the\n\t * create event.\n\t */\n\ttracking.shift.handlers.AbstractEventHandler.prototype.setClientId =\n\t\tfunction setClientId(clientId) {\n\t\t\tthis.clientId = clientId;\n\t\t};\n\n\ttracking.shift.handlers.AbstractEventHandler.prototype.getDealerCodeType =\n\t\tfunction getDealerCodeType() {\n\t\t\treturn this.dealerCodeType;\n\t\t};\n\n\t/**\n\t * Sets the DDC dealer code type used to determine Shift page brands.\n\t *\n\t * @param {string} dealerCodeType The DDC dealer code type.\n\t */\n\ttracking.shift.handlers.AbstractEventHandler.prototype.setDealerCodeType =\n\t\tfunction setDealerCodeType(dealerCodeType) {\n\t\t\tthis.dealerCodeType = dealerCodeType;\n\t\t};\n\n\ttracking.shift.handlers.AbstractEventHandler.prototype.getRetailerId =\n\t\tfunction getRetailerId() {\n\t\t\treturn this.retailerId;\n\t\t};\n\n\t/**\n\t * Sets the retailer identifier that is sent to Shift as part of the create event.\n\t *\n\t * @param {string} retailerId The retailer identifier that is sent to Shift as part of the\n\t * create event.\n\t */\n\ttracking.shift.handlers.AbstractEventHandler.prototype.setRetailerId =\n\t\tfunction setRetailerId(retailerId) {\n\t\t\tthis.retailerId = retailerId;\n\t\t};\n\n\ttracking.shift.handlers.AbstractEventHandler.prototype.getProviderId =\n\t\tfunction getProviderId() {\n\t\t\treturn this.providerId;\n\t\t};\n\n\t/**\n\t * Sets the provider identifier that is sent to Shift as part of the create event.\n\t *\n\t * @param {string} providerId The provider identifier that is sent to Shift as part of the\n\t * create event.\n\t */\n\ttracking.shift.handlers.AbstractEventHandler.prototype.setProviderId =\n\t\tfunction setProviderId(providerId) {\n\t\t\tthis.providerId = providerId;\n\t\t};\n\n\t// ======================================================================\n\t// ------------------------ Lifecycle Operations ------------------------\n\t// ======================================================================\n\n\t/**\n\t * Initializes the AbstractEventHandler by injecting the configured\n\t * tag container script into the DOM then sending the create event\n\t * to Shift.\n\t *\n\t * This method is guaranteed to be called only after the configurable\n\t * properties have been specified.\n\t */\n\ttracking.shift.handlers.AbstractEventHandler.prototype.initialize =\n\t\tfunction initializeAbstractEventHandler() {\n\t\t\tthis.log.info('initializing...');\n\n\t\t\tthis.log.info(\n\t\t\t\t`sending create event for clientId: ${this.clientId}, retailerId: ${this.retailerId}, providerId: ${this.providerId}`\n\t\t\t);\n\n\t\t\tthis.win[this.scriptObjectName](\n\t\t\t\t'create',\n\t\t\t\tthis.clientId,\n\t\t\t\tthis.retailerId,\n\t\t\t\tthis.providerId\n\t\t\t);\n\n\t\t\tthis.win?.CAIEventBus?.on('wallet:updated', (walletData) => {\n\t\t\t\tif (!this.myWalletInteracted) {\n\t\t\t\t\tthis.handleWalletUpdated(walletData);\n\t\t\t\t\tthis.myWalletInteracted = true;\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tif (this.saveShiftSessionId || getEnv() !== 'prod') {\n\t\t\t\tthis.win[this.scriptObjectName]('getSessionId', (sessionId) => {\n\t\t\t\t\tthis.win.sessionStorage.setItem(\n\t\t\t\t\t\t'SaveShiftSession',\n\t\t\t\t\t\tsessionId\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tthis.log.info('initialized');\n\t\t};\n\n\t// ======================================================================\n\t// --------------------------- Utilities --------------------------------\n\t// ======================================================================\n\n\t/**\n\t * Returns the form type to send to Shift given the DDC form tracking\n\t * identifier.\n\t *\n\t * @param {string} trackingId The DDC form tracking identifier\n\t * @returns {string} The form type to send to Shift\n\t */\n\ttracking.shift.handlers.AbstractEventHandler.prototype.mapFormTrackingId =\n\t\tfunction mapFormTrackingId(trackingId) {\n\t\t\tconst newTrackingId = trackingId && trackingId.toUpperCase();\n\t\t\treturn (\n\t\t\t\tthis.formTrackingIdMapping[newTrackingId] ||\n\t\t\t\tthis.formTrackingIdMapping.DEFAULT\n\t\t\t);\n\t\t};\n\n\t/**\n\t * Returns the inventory type to send to Shift given the DDC compositeType\n\t * query facet value.\n\t *\n\t * @param {string} compositeType The DDC compositeType query facet value\n\t * @returns {string} The inventory type to send to Shift\n\t */\n\ttracking.shift.handlers.AbstractEventHandler.prototype.mapInventoryType =\n\t\tfunction mapInventoryType(compositeType, newOrUsed, certified) {\n\t\t\tconst compositeTypeUppercase = compositeType\n\t\t\t\t? compositeType?.toUpperCase?.()\n\t\t\t\t: 'DEFAULT';\n\t\t\tlet inventoryType =\n\t\t\t\tthis.inventoryTypeMapping[compositeTypeUppercase];\n\t\t\tif (inventoryType === undefined) {\n\t\t\t\tif (\n\t\t\t\t\tnewOrUsed === 'used' &&\n\t\t\t\t\t(certified === 'true' || certified === true)\n\t\t\t\t) {\n\t\t\t\t\tinventoryType = this.inventoryTypeMapping.CERTIFIED; // Used Certified\n\t\t\t\t} else {\n\t\t\t\t\tinventoryType =\n\t\t\t\t\t\tthis.inventoryTypeMapping[\n\t\t\t\t\t\t\t(newOrUsed || 'DEFAULT').toUpperCase()\n\t\t\t\t\t\t]; // New or Used\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn inventoryType;\n\t\t};\n\n\t/**\n\t * Returns the page name to send to Shift given the DDC page alias.\n\t * Mapping keys are treated as regular expressions used to test\n\t * the current page alias for a match.\n\t *\n\t * If a page has a pageType page property set, that will be used instead.\n\t *\n\t * @param {string} pageAlias The DDC page alias\n\t * @returns {string} The page name to send to Shift\n\t */\n\ttracking.shift.handlers.AbstractEventHandler.prototype.mapPageAlias =\n\t\tfunction mapPageAlias() {\n\t\t\treturn (\n\t\t\t\tDDC?.dataLayer?.page?.trackingTags?.pageType ||\n\t\t\t\twin?.DDC?.WidgetData?.['ws-tagging']?.mapping?.shift?.pagealias\n\t\t\t\t\t?.pageType ||\n\t\t\t\t(this.hasInventoryWidget() && 'Vehicle Listing') ||\n\t\t\t\t// TODO: Remove this temporary fix when it is no longer temporary: US793715 Not sure when that will be.\n\t\t\t\t(DDC?.dataLayer?.site?.franchises?.includes?.('subaru') &&\n\t\t\t\t\tDDC?.dataLayer?.page?.pageInfo?.pagePath ===\n\t\t\t\t\t\t'/financing/index.htm' &&\n\t\t\t\t\t'Finance') ||\n\t\t\t\t'Other'\n\t\t\t);\n\t\t};\n\n\t/**\n\t * Maps the pageBrand required by Shift from the DDC dealerCodeType.\n\t *\n\t * @returns {string} pageBrand The page brand to send to Shift.\n\t */\n\ttracking.shift.handlers.AbstractEventHandler.prototype.mapPageBrand =\n\t\tfunction mapPageBrand() {\n\t\t\tconst { dealerCodeType } = this;\n\t\t\tlet pageBrand;\n\n\t\t\tif (\n\t\t\t\t(dealerCodeType !== '' || dealerCodeType !== undefined) &&\n\t\t\t\ttypeof dealerCodeType === 'string'\n\t\t\t) {\n\t\t\t\tif (\n\t\t\t\t\tDDC?.dataLayer?.site?.franchises &&\n\t\t\t\t\tdealerCodeType.toLowerCase() === 'gmus'\n\t\t\t\t) {\n\t\t\t\t\tpageBrand = '';\n\t\t\t\t\tconst sortedFranchises =\n\t\t\t\t\t\tDDC.dataLayer.site.franchises.sort();\n\t\t\t\t\tsortedFranchises.forEach((val, index, arr) => {\n\t\t\t\t\t\tif (index === arr.length - 1) {\n\t\t\t\t\t\t\tpageBrand += val.substring(0, 2);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tpageBrand += `${val.substring(0, 2)}|`;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tpageBrand =\n\t\t\t\t\t\tthis.pageBrandMapping[dealerCodeType.toUpperCase()] ||\n\t\t\t\t\t\t'';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn pageBrand;\n\t\t};\n\n\t// ======================================================================\n\t// ------------------------- Page Data Building -------------------------\n\t// ======================================================================\n\n\t/**\n\t * Builds the data object to send Shift on a page view event.\n\t *\n\t * @param {string} alias the DDC page alias of the page being viewed\n\t * @returns {Object} The shift data object to send\n\t */\n\ttracking.shift.handlers.AbstractEventHandler.prototype.buildDataForPageView =\n\t\tfunction buildDataForPageView() {\n\t\t\treturn {};\n\t\t};\n\n\t// ======================================================================\n\t// -------------------------- Send Events to Shift ----------------------\n\t// ======================================================================\n\n\t/**\n\t * Sends the specified data to Shift.\n\t *\n\t * @param {Object} data An object containing the data to send to Shift\n\t * @param {string} event An optional event name, may be undefined\n\t */\n\ttracking.shift.handlers.AbstractEventHandler.prototype.sendData =\n\t\tfunction sendData(data, event) {\n\t\t\tconst immutabledata = JSON.parse(JSON.stringify(data));\n\t\t\tif (newrelic) {\n\t\t\t\tconst pageActionAttributes = {\n\t\t\t\t\twsTaggingGrouping: this?.form?.wsTaggingGrouping || '',\n\t\t\t\t\tuseFormAPI: true // always true via useFormAPI: true\n\t\t\t\t};\n\t\t\t\tconst eventName = (data && data.events) || event;\n\t\t\t\tif (eventName) {\n\t\t\t\t\tpageActionAttributes.eventName = eventName;\n\t\t\t\t}\n\t\t\t\tif (\n\t\t\t\t\teventShouldBeTracked() &&\n\t\t\t\t\tnrSwitcherOn(\n\t\t\t\t\t\tthis.flags,\n\t\t\t\t\t\tthis.project,\n\t\t\t\t\t\tpageActionAttributes.eventName\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tnewrelic.addPageAction(\n\t\t\t\t\t\t`${this.project}_send_data`,\n\t\t\t\t\t\tpageActionAttributes\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.win[this.scriptObjectName]('dataLayer', data);\n\n\t\t\tif (event !== undefined) {\n\t\t\t\tthis.win[this.scriptObjectName]('send', event);\n\t\t\t} else {\n\t\t\t\tthis.win[this.scriptObjectName]('send');\n\t\t\t}\n\n\t\t\t// Send event to BCF event viewer.\n\t\t\twindow.dispatchEvent(\n\t\t\t\tnew CustomEvent('eventViewerData', {\n\t\t\t\t\tdetail: {\n\t\t\t\t\t\tcommon: {\n\t\t\t\t\t\t\tproject: this.project,\n\t\t\t\t\t\t\tevent: data.events || event || immutabledata.events,\n\t\t\t\t\t\t\tsource: 'ws-tagging',\n\t\t\t\t\t\t\tpayload: {\n\t\t\t\t\t\t\t\t...data\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\teventHandler: this.eventHandlerName\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t);\n\t\t};\n\n\t/**\n\t * Handles the page view event.\n\t *\n\t * @param {Object} eventData The event data object Relevant properties:\n\t * {string} alias The DDC page alias\n\t */\n\ttracking.shift.handlers.AbstractEventHandler.prototype.handlePageView =\n\t\tfunction handlePageView(eventData) {\n\t\t\t// custom pageType for feature vehicle pages for Toyota (US687839)\n\t\t\t// this.pageName = this.isFeaturedVehiclePage ? 'Vehicle Listing' : this.mapPageAlias();\n\t\t\tif (this.isFeaturedVehiclePage) {\n\t\t\t\tthis.pageName = 'Vehicle Listing';\n\t\t\t} else {\n\t\t\t\tthis.pageName = this.mapPageAlias();\n\t\t\t}\n\n\t\t\tconst dataLayer = this.buildDataForPageView(eventData.alias);\n\t\t\t// custom pageView for showroom/modal showroom: US917544\n\t\t\tdataLayer.pageType = this.page.isModelShowroomPage()\n\t\t\t\t? 'Model Showroom'\n\t\t\t\t: dataLayer.pageType;\n\t\t\tthis.sendData(dataLayer, 'pageview');\n\t\t};\n\n\t/**\n\t * Handles the slideshow click event.\n\t *\n\t * @param {Object} eventData The event data object\n\t *\n\t * eventData contains the following properties of interest -\n\t * position: The position of the slide that was clicked\n\t * name: The name of the slide that was clicked\n\t */\n\ttracking.shift.handlers.AbstractEventHandler.prototype.handleSlideshowClick =\n\t\tfunction handleSlideshowClick(eventData) {\n\t\t\tthis.sendData({\n\t\t\t\tcarouselClick: {\n\t\t\t\t\tassetPosition: eventData.position,\n\t\t\t\t\tassetName: eventData.name\n\t\t\t\t},\n\t\t\t\tevents: 'carouselClick'\n\t\t\t});\n\t\t};\n\n\t/**\n\t * Maps the Fuel required by Shift from the Vehicle Details.\n\t *\n\t * @returns {string} FuelType to send to Shift.\n\t */\n\ttracking.shift.handlers.AbstractEventHandler.prototype.mapFuelType =\n\t\tfunction mapFuelType(fuelType) {\n\t\t\tlet newFuelType = this.fuelTypeMapping[fuelType];\n\t\t\tif (newFuelType === undefined) {\n\t\t\t\tnewFuelType = this.fuelTypeMapping.DEFAULT;\n\t\t\t}\n\n\t\t\treturn newFuelType;\n\t\t};\n\n\t/**\n\t * Sets the dealerAreaCode code, which is used to distinguish regions for Toyota/Lexus dealers.\n\t *\n\t * @param {string} dealerAreaCode The DDC dealer code type.\n\t */\n\ttracking.shift.handlers.AbstractEventHandler.prototype.setDealerAreaCode =\n\t\tfunction setDealerAreaCode(dealerAreaCode) {\n\t\t\tthis.dealerAreaCode = dealerAreaCode;\n\t\t};\n\n\t/**\n\t * Given eventData will return the form displayType\n\t *\n\t * @param {object} The eventData object from a dataLayer event.\n\t */\n\ttracking.shift.handlers.AbstractEventHandler.prototype.formDisplayType = (\n\t\tisModal = false\n\t) => (isModal ? 'modal' : 'in-page');\n\n\t/**\n\t *\n\t * @param {String} fieldName The form field name attribute\n\t * @returns A mapping to match the client spec in this story: US971128\n\t *\n\t * Client said: firstname, lastname, middlename, phonenumber, emailaddress, address, city, state, zipcode, comments, other\n\t *\n\t * So not specifying whether it is regular form or coapp/email a friend/share etc.\n\t */\n\ttracking.shift.handlers.AbstractEventHandler.prototype.getFormFieldName = (\n\t\tfieldName = ''\n\t) => {\n\t\tlet formFieldName = 'other';\n\n\t\tif (fieldName) {\n\t\t\tconst fieldNameFormatted = fieldName.toLowerCase();\n\n\t\t\tif (fieldNameFormatted.includes('firstname')) {\n\t\t\t\tformFieldName = 'firstname';\n\t\t\t} else if (fieldNameFormatted.includes('lastname')) {\n\t\t\t\tformFieldName = 'lastname';\n\t\t\t} else if (fieldNameFormatted.includes('middlename')) {\n\t\t\t\tformFieldName = 'middlename';\n\t\t\t} else if (fieldNameFormatted.includes('phone')) {\n\t\t\t\tformFieldName = 'phonenumber';\n\t\t\t} else if (fieldNameFormatted.includes('email')) {\n\t\t\t\tformFieldName = 'emailaddress';\n\t\t\t} else if (fieldNameFormatted.includes('street')) {\n\t\t\t\tformFieldName = 'address';\n\t\t\t} else if (fieldNameFormatted.includes('city')) {\n\t\t\t\tformFieldName = 'city';\n\t\t\t} else if (fieldNameFormatted.includes('state')) {\n\t\t\t\tformFieldName = 'state';\n\t\t\t} else if (fieldNameFormatted.includes('postalcode')) {\n\t\t\t\tformFieldName = 'zipcode';\n\t\t\t} else if (fieldNameFormatted.includes('comments')) {\n\t\t\t\tformFieldName = 'comments';\n\t\t\t}\n\t\t}\n\n\t\treturn formFieldName;\n\t};\n\n\ttracking.shift.handlers.AbstractEventHandler.prototype.hasInventoryWidget =\n\t\tfunction hasInventoryWidget() {\n\t\t\tconst legacyVLPWidget = this.page.widgetIsPresent(\n\t\t\t\t/^v9.widgets.inventory-listing.default/\n\t\t\t);\n\t\t\tconst legacyVLP =\n\t\t\t\twin.DDC.dataLayer.page.pageInfo.isVlp && legacyVLPWidget;\n\n\t\t\treturn (\n\t\t\t\t(win.DDC.dataLayer.page.pageInfo.isVlp && !legacyVLP) ||\n\t\t\t\t(legacyVLP &&\n\t\t\t\t\t![null, ''].includes(\n\t\t\t\t\t\tthis.page.dataLayerProperty(\n\t\t\t\t\t\t\t'page.attributes.vehicleResultCount'\n\t\t\t\t\t\t)\n\t\t\t\t\t)) ||\n\t\t\t\tthis.page.widgetIsPresent(/^ws-inv-listing$/) ||\n\t\t\t\tthis.page.currentPageAlias?.()?.includes('NO_RESULTS')\n\t\t\t);\n\t\t};\n\n\ttracking.shift.handlers.AbstractEventHandler.prototype.getInventoryType =\n\t\tfunction getInventoryType() {\n\t\t\tlet inventoryType = this.inventoryTypeMapping.DEFAULT;\n\t\t\tconst { vehicles } = win.DDC.dataLayer;\n\n\t\t\tif (vehicles.length) {\n\t\t\t\tconst hasNew = vehicles.some((car) => car.newOrUsed === 'new');\n\t\t\t\tconst hasUsed = vehicles.some(\n\t\t\t\t\t(car) => car.newOrUsed === 'used'\n\t\t\t\t);\n\t\t\t\tconst hasCertified = vehicles.some(\n\t\t\t\t\t(car) => car.certified === 'true' || car.certified === true\n\t\t\t\t);\n\t\t\t\tconst allCertified = !vehicles.some(\n\t\t\t\t\t(car) =>\n\t\t\t\t\t\tcar.certified === 'false' || car.certified === false\n\t\t\t\t);\n\n\t\t\t\tif (hasNew && hasUsed) {\n\t\t\t\t\tinventoryType = this.inventoryTypeMapping.ALL;\n\t\t\t\t} else if (hasNew) {\n\t\t\t\t\tinventoryType = this.inventoryTypeMapping.NEW;\n\t\t\t\t\t// note the next blocks have all vehicles used\n\t\t\t\t} else if (allCertified) {\n\t\t\t\t\tinventoryType = this.inventoryTypeMapping.CERTIFIED;\n\t\t\t\t} else if (hasCertified) {\n\t\t\t\t\tinventoryType = this.inventoryTypeMapping.ALL;\n\t\t\t\t} else {\n\t\t\t\t\tinventoryType = this.inventoryTypeMapping.USED;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn inventoryType;\n\t\t};\n};\n\nexport default runAbstractEventHandler;\n","// TODO: implement originator param\nconst nrSwitcherOn = (flags, project, event) => {\n\tconst switcherRules = flags?.['ws-tagging-nr-switcher'];\n\tif (!switcherRules || !Array.isArray(switcherRules)) {\n\t\t// if no flag, allow reporting\n\t\treturn true;\n\t}\n\n\t// turn off reporting only if project, event and originator match what we have specified in a rule\n\t// the flag is an array so we can combine rules\n\tconst isOff = switcherRules.some(\n\t\t(rule) =>\n\t\t\t(rule.project === 'allProjects' || rule.project === project) &&\n\t\t\t(rule.event === 'allEvents' || rule.event === event)\n\t\t// && (\n\t\t// rule.originator === 'allOriginators' ||\n\t\t// rule.originator === originator\n\t\t// )\n\t);\n\treturn !isOff;\n};\nexport default nrSwitcherOn;\n"],"names":["getEnv","PROD","Math","floor","random","win","namespace","DDC","tracking","newrelic","shift","handlers","AbstractEventHandler","thisWin","page","form","framework","runtime","EventHandler","call","this","scriptLocation","undefined","scriptObjectName","clientId","dealerCodeType","retailerId","providerId","dealerAreaCode","accelerateInitialClick","myWalletInteracted","WidgetData","mapping","formTrackingIdMapping","inventoryTypeMapping","NEW","USED","CERTIFIED","ALL","DEFAULT","pageBrandMapping","CLLC","GENESISDWCP","JAG","KIA","LR","MAZDA","MBZ","AR","FIAT","PORSCHE","TOYOTA","LEXUS","SUBARU","SOA","MASERATI","BMW","VW","pageName","fuelTypeMapping","GASOLINE","DIESEL","ELECTRIC","HYBRID","isFeaturedVehiclePage","widgetIsPresent","currentPageAlias","includes","extend","prototype","logCategory","getScriptLocation","setScriptLocation","getScriptObjectName","setScriptObjectName","getClientId","setClientId","getDealerCodeType","setDealerCodeType","getRetailerId","setRetailerId","getProviderId","setProviderId","initialize","log","info","CAIEventBus","on","walletData","handleWalletUpdated","saveShiftSessionId","sessionId","sessionStorage","setItem","mapFormTrackingId","trackingId","newTrackingId","toUpperCase","mapInventoryType","compositeType","newOrUsed","certified","compositeTypeUppercase","inventoryType","mapPageAlias","dataLayer","trackingTags","pageType","pagealias","hasInventoryWidget","site","franchises","pageInfo","pagePath","mapPageBrand","pageBrand","toLowerCase","sort","forEach","val","index","arr","length","substring","buildDataForPageView","sendData","data","event","immutabledata","JSON","parse","stringify","pageActionAttributes","wsTaggingGrouping","useFormAPI","eventName","events","eventShouldBeTracked","nrSwitcherOn","flags","project","addPageAction","window","dispatchEvent","CustomEvent","detail","common","source","payload","eventHandler","eventHandlerName","handlePageView","eventData","alias","isModelShowroomPage","handleSlideshowClick","carouselClick","assetPosition","position","assetName","name","mapFuelType","fuelType","newFuelType","setDealerAreaCode","formDisplayType","getFormFieldName","fieldName","formFieldName","fieldNameFormatted","legacyVLPWidget","legacyVLP","isVlp","dataLayerProperty","getInventoryType","vehicles","hasNew","some","car","hasUsed","hasCertified","allCertified","switcherRules","Array","isArray","rule"],"sourceRoot":""}