1/******/ (function() { // webpackBootstrap 2/******/ "use strict"; 3/******/ var __webpack_modules__ = ({ 4 5/***/ 642: 6/***/ (function(__unused_webpack_module, exports) { 7 8 9Object.defineProperty(exports, "__esModule", ({ value: true })); 10exports.SecondaryActionsApi = void 0; 11var SecondaryActionsApi = /** @class */ (function () { 12 function SecondaryActionsApi(serviceFramework) { 13 this.serviceFramework = serviceFramework; 14 } 15 SecondaryActionsApi.prototype.getSettings = function (tabModuleId, formId, productId) { 16 var url = this.serviceFramework.getServiceRoot("Dominion/SecondaryActions") + "SecondaryActions/GetSecondaryActions"; 17 var data = { 18 tabModuleId: tabModuleId, 19 formId: formId, 20 productId: productId, 21 }; 22 return $.ajax({ 23 type: "POST", 24 url: url, 25 data: JSON.stringify(data), 26 contentType: "application/json", 27 beforeSend: this.serviceFramework.setModuleHeaders, 28 }); 29 }; 30 SecondaryActionsApi.prototype.loadContent = function () { 31 var ajaxOption = { 32 url: "//" + window.location.hostname + "/DesktopModules/Dominion/Common/Forms/SecondaryActions.aspx", 33 cache: false, 34 beforeSend: this.serviceFramework.setModuleHeaders, 35 }; 36 return $.ajax(ajaxOption); 37 }; 38 return SecondaryActionsApi; 39}()); 40exports.SecondaryActionsApi = SecondaryActionsApi; 41 42 43/***/ }), 44 45/***/ 168: 46/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 47 48 49var __importDefault = (this && this.__importDefault) || function (mod) { 50 return (mod && mod.__esModule) ? mod : { "default": mod }; 51}; 52Object.defineProperty(exports, "__esModule", ({ value: true })); 53var SessionStorageKey_1 = __importDefault(__webpack_require__(373)); 54/** 55 * Repository implementation for managing popup display memory using session storage 56 * Provides data persistence for tracking displayed popups per browser session 57 */ 58var PopupDisplayRepository = /** @class */ (function () { 59 function PopupDisplayRepository(sessionStorage) { 60 this.sessionStorage = sessionStorage; 61 } 62 /** 63 * Check if a popup has already been displayed in the current session 64 * @param popupId - Unique identifier of the popup 65 * @returns true if popup was already displayed, false otherwise 66 * @throws Error if session storage read fails 67 */ 68 PopupDisplayRepository.prototype.hasDisplayed = function (popupId) { 69 if (popupId === null || popupId === undefined) { 70 return false; 71 } 72 var displayedPopups = this.sessionStorage.get(SessionStorageKey_1.default.PopupDisplayedIds); 73 if (!displayedPopups) { 74 return false; 75 } 76 var popupIds = JSON.parse(displayedPopups); 77 return popupIds.includes(popupId); 78 }; 79 /** 80 * Mark a popup as displayed in the current session 81 * @param popupId - Unique identifier of the popup 82 * @throws Error if session storage write fails 83 */ 84 PopupDisplayRepository.prototype.markDisplayed = function (popupId) { 85 if (popupId === null || popupId === undefined) { 86 return; 87 } 88 var displayedPopups = []; 89 var stored = this.sessionStorage.get(SessionStorageKey_1.default.PopupDisplayedIds); 90 if (stored) { 91 displayedPopups = JSON.parse(stored); 92 } 93 if (!displayedPopups.includes(popupId)) { 94 displayedPopups.push(popupId); 95 this.sessionStorage.set(SessionStorageKey_1.default.PopupDisplayedIds, JSON.stringify(displayedPopups)); 96 } 97 }; 98 /** 99 * Clear all displayed popup records (typically called on page navigation) 100 */ 101 PopupDisplayRepository.prototype.clearAll = function () { 102 this.sessionStorage.remove(SessionStorageKey_1.default.PopupDisplayedIds); 103 }; 104 /** 105 * Get all displayed popup IDs 106 * @returns Array of popup IDs that have been displayed 107 */ 108 PopupDisplayRepository.prototype.getDisplayedPopupIds = function () { 109 var displayedPopups = this.sessionStorage.get(SessionStorageKey_1.default.PopupDisplayedIds); 110 if (!displayedPopups) { 111 return []; 112 } 113 return JSON.parse(displayedPopups); 114 }; 115 return PopupDisplayRepository;
116}()); 117exports["default"] = PopupDisplayRepository; 118 119 120/***/ }), 121 122/***/ 562: 123/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 124 125 126var __importDefault = (this && this.__importDefault) || function (mod) { 127 return (mod && mod.__esModule) ? mod : { "default": mod }; 128}; 129Object.defineProperty(exports, "__esModule", ({ value: true })); 130var SessionStorageKey_1 = __importDefault(__webpack_require__(373)); 131var SessionStorage = /** @class */ (function () { 132 function SessionStorage() { 133 } 134 SessionStorage.prototype.clear = function () { 135 window.sessionStorage.clear(); 136 }; 137 SessionStorage.prototype.keys = function () { 138 var len = window.sessionStorage.length; 139 var keys = []; 140 for (var i = 0; i < len; ++i) { 141 keys.push(window.sessionStorage.key(i)); 142 } 143 return keys; 144 }; 145 SessionStorage.prototype.containsKey = function (key) { 146 return this.getKeyString(key) !== undefined; 147 }; 148 SessionStorage.prototype.get = function (key) { 149 return window.sessionStorage.getItem(this.getKeyString(key)); 150 }; 151 SessionStorage.prototype.set = function (key, value) { 152 window.sessionStorage.setItem(this.getKeyString(key), value); 153 }; 154 SessionStorage.prototype.remove = function (key) { 155 window.sessionStorage.removeItem(this.getKeyString(key)); 156 }; 157 SessionStorage.prototype.getAllKeys = function () { 158 return Object.keys(SessionStorageKey_1.default) 159 .map(function (k) { return SessionStorageKey_1.default[k]; }) 160 .filter(function (v) { return typeof v === 'string'; }); 161 }; 162 SessionStorage.prototype.getKeyString = function (key) { 163 if (typeof key === 'string') { 164 return key; 165 } 166 var keyNames = this.getAllKeys(); 167 return keyNames[key]; 168 }; 169 return SessionStorage; 170}()); 171exports["default"] = SessionStorage; 172 173 174/***/ }), 175 176/***/ 373: 177/***/ (function(__unused_webpack_module, exports) { 178 179 180Object.defineProperty(exports, "__esModule", ({ value: true })); 181exports.SessionStorageKey = void 0; 182var SessionStorageKey; 183(function (SessionStorageKey) { 184 SessionStorageKey[SessionStorageKey["FormPrepopulate"] = 0] = "FormPrepopulate"; 185 SessionStorageKey[SessionStorageKey["PopupDisplayedIds"] = 1] = "PopupDisplayedIds"; 186})(SessionStorageKey = exports.SessionStorageKey || (exports.SessionStorageKey = {})); 187exports["default"] = SessionStorageKey; 188 189 190/***/ }), 191 192/***/ 729: 193/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 194 195 196var __importDefault = (this && this.__importDefault) || function (mod) { 197 return (mod && mod.__esModule) ? mod : { "default": mod }; 198}; 199Object.defineProperty(exports, "__esModule", ({ value: true })); 200var SessionStorage_1 = __importDefault(__webpack_require__(562)); 201var SessionStorageKey_1 = __importDefault(__webpack_require__(373)); 202var FormPrePopulate = /** @class */ (function () { 203 function FormPrePopulate() { 204 this.separator = "|||"; 205 this.sessionStorage = new SessionStorage_1.default(); 206 } 207 FormPrePopulate.prototype.saveFormData = function (data) { 208 var totalMilliseconds = new Date().getTime(); 209 var id = btoa(totalMilliseconds.toString()); 210 this.sessionStorage.set(SessionStorageKey_1.default.FormPrepopulate, "".concat(id).concat(this.separator).concat(JSON.stringify(data))); 211 return id; 212 }; 213 FormPrePopulate.prototype.getFormData = function (id) { 214 var value = this.sessionStorage.get(SessionStorageKey_1.default.FormPrepopulate); 215 if (!value) { 216 return null; 217 } 218 if (value.indexOf(this.separator) === -1) { 219 return null; 220 } 221 var splittedText = value.split(this.separator); 222 if (splittedText.length === 2) { 223 if (splittedText[0] !== id) { 224 return null; 225 } 226 try { 227 return JSON.parse(splittedText[1]); 228 } 229 catch (_a) { 230 return null; 231 } 232 } 233 return null; 234 }; 235 return FormPrePopulate; 236}()); 237exports["default"] = FormPrePopulate; 238 239 240/***/ }), 241 242/***/ 546: 243/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 244 245 246var __importDefault = (this && this.__importDefault) || function (mod) { 247 return (mod && mod.__esModule) ? mod : { "default": mod }; 248}; 249Object.defineProperty(exports, "__esModule", ({ value: true })); 250var PopupDisplayRepository_1 = __importDefault(__webpack_require__(168)); 251var SessionStorage_1 = __importDefault(__webpack_require__(562)); 252/** 253 * Domain interactor for managing popup display memory 254 * Implements business logic for tracking displayed popups with error handling 255 * Uses singleton factory pattern for instance management 256 */ 257var PopupDisplayMemoryInteractor = /** @class */ (function () { 258 function PopupDisplayMemoryInteractor(repository) { 259 this.repository = repository;
260 } 261 /** 262 * Get or create singleton instance of PopupDisplayMemoryInteractor 263 * @returns Singleton instance 264 */ 265 PopupDisplayMemoryInteractor.getInstance = function () { 266 if (!PopupDisplayMemoryInteractor.instance) { 267 var sessionStorage_1 = new SessionStorage_1.default(); 268 var repository = new PopupDisplayRepository_1.default(sessionStorage_1); 269 PopupDisplayMemoryInteractor.instance = new PopupDisplayMemoryInteractor(repository); 270 } 271 return PopupDisplayMemoryInteractor.instance; 272 }; 273 /** 274 * Create instance with custom repository (useful for testing) 275 * @param repository - Custom repository implementation 276 * @returns Instance with provided repository 277 */ 278 PopupDisplayMemoryInteractor.createWithRepository = function (repository) { 279 return new PopupDisplayMemoryInteractor(repository); 280 }; 281 /** 282 * Check if a popup has already been displayed in the current session 283 * @param popupId - Unique identifier of the popup 284 * @returns true if popup was already displayed, false otherwise 285 */ 286 PopupDisplayMemoryInteractor.prototype.hasDisplayed = function (popupId) { 287 try { 288 return this.repository.hasDisplayed(popupId); 289 } 290 catch (error) { 291 console.error('Error checking popup display status:', error); 292 return false; // Safe default: assume not displayed 293 } 294 }; 295 /** 296 * Mark a popup as displayed in the current session 297 * @param popupId - Unique identifier of the popup 298 */ 299 PopupDisplayMemoryInteractor.prototype.markDisplayed = function (popupId) { 300 try { 301 this.repository.markDisplayed(popupId); 302 } 303 catch (error) { 304 console.error('Error marking popup as displayed:', error); 305 // Silently fail - popup will be shown again if session storage fails 306 } 307 }; 308 /** 309 * Clear all displayed popup records (typically called on page navigation) 310 */ 311 PopupDisplayMemoryInteractor.prototype.clearAll = function () { 312 try { 313 this.repository.clearAll(); 314 } 315 catch (error) { 316 console.error('Error clearing popup display memory:', error); 317 // Silently fail 318 } 319 }; 320 /** 321 * Get all displayed popup IDs 322 * @returns Array of popup IDs that have been displayed 323 */ 324 PopupDisplayMemoryInteractor.prototype.getDisplayedPopupIds = function () { 325 try { 326 return this.repository.getDisplayedPopupIds(); 327 } 328 catch (error) { 329 console.error('Error retrieving displayed popup IDs:', error); 330 return []; // Safe default: empty array 331 } 332 }; 333 return PopupDisplayMemoryInteractor; 334}()); 335exports["default"] = PopupDisplayMemoryInteractor; 336 337 338/***/ }), 339 340/***/ 98: 341/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 342 343 344var __importDefault = (this && this.__importDefault) || function (mod) { 345 return (mod && mod.__esModule) ? mod : { "default": mod }; 346}; 347Object.defineProperty(exports, "__esModule", ({ value: true })); 348exports.FormDialogV2 = void 0; 349var FormDialogView_1 = __importDefault(__webpack_require__(875)); 350var FormDialogV2 = /** @class */ (function () { 351 function FormDialogV2(view) { 352 this.existForm = undefined; 353 this.view = view || new FormDialogView_1.default(); 354 } 355 FormDialogV2.getInstance = function () { 356 if (!FormDialogV2.sharedInstance) { 357 FormDialogV2.sharedInstance = new FormDialogV2(); 358 } 359 return FormDialogV2.sharedInstance; 360 }; 361 FormDialogV2.prototype.mergePageValidators = function (pageValidators) { 362 if (!pageValidators || pageValidators.length === 0) { 363 return; 364 } 365 pageValidators.forEach(function (item) { 366 window.Page_Validators.push(item); 367 }); 368 }; 369 FormDialogV2.prototype.getCustomOptionForInitFormView = function (option) { 370 var customOptions = null;
371 if (option.finalMessage || option.finalUrl || option.secondaryActionsDisabled || option.onPopupDismissed) { 372 customOptions = { 373 finalMessage: option.finalMessage, 374 finalUrl: option.finalUrl, 375 secondaryActionsDisabled: option.secondaryActionsDisabled, 376 onBeforeRedirect: option.onPopupDismissed, 377 }; 378 } 379 return customOptions; 380 }; 381 FormDialogV2.prototype.getBrpActionByFormName = function (formName) { 382 switch (formName) { 383 case 'Get Price': 384 return 'click to get_a_quote|regular'; 385 case 'Schedule a Test Drive': 386 return 'click to dealer_demo_std'; 387 case 'Secure Finance Application': 388 return 'click to financing'; 389 default: 390 return false; 391 } 392 }; 393 FormDialogV2.prototype.displayDialog = function (option) { 394 var _this = this; 395 if (this.existForm) { 396 this.existForm.clearReCaptcha(); 397 } 398 var deferred = $.Deferred(); 399 var $modal = this.view.getModal(option.panelSelector); 400 // Handle isDisplayForm option: if false, display only customContent without AJAX 401 if (option.isDisplayForm === false) { 402 if (!option.customContent || (typeof option.customContent === 'string' && option.customContent.trim() === '')) { 403 throw new Error('isDisplayForm is false but customContent is empty or null'); 404 } 405 var enforceModalFocusFn_1 = this.view.getEnforceFocus(); 406 this.view.bindModalHidden($modal, enforceModalFocusFn_1, option.modalVisibleCssClass, option.onPopupDismissed); 407 this.view.bindModalShown($modal, option.onPopupShown); 408 var showLoading_1 = option.showLoading !== false; 409 var $loadingDialog_1 = showLoading_1 ? this.view.getLoadingDialog() : null; 410 if (showLoading_1) { 411 this.view.showLoading($loadingDialog_1); 412 } 413 // Append only customContent without AJAX response 414 this.view.appendResponse($modal, '', option.customContent); 415 var loadingReadyPromise = option.onLoadingReady ? Promise.resolve(option.onLoadingReady()) : Promise.resolve(); 416 loadingReadyPromise.then(function () { 417 if (showLoading_1) { 418 _this.view.hideLoading($loadingDialog_1, function () { 419 _this.initAndShowModal($modal, option, deferred); 420 }); 421 return; 422 } 423 _this.initAndShowModal($modal, option, deferred); 424 }, function (error) { 425 if (showLoading_1) { 426 _this.view.hideLoading($loadingDialog_1, function () { 427 deferred.reject(error); 428 }); 429 return; 430 } 431 deferred.reject(error); 432 }); 433 return deferred.promise(); 434 } 435 if (option.isPhoto && this.view.isLoaded($modal)) { 436 this.view.addCustomCss(); 437 if (option.customContent) { 438 this.view.appendCustomContent($modal, option.customContent); 439 } 440 $modal.modal('show'); 441 this.view.hideErrors($modal); 442 return deferred.resolve().promise(); 443 } 444 var requestData = { 445 portalId: option.portalId, 446 moduleId: option.moduleId, 447 productId: option.productId, 448 formId: option.formId, 449 isFromFeatured: option.isFromFeatured, 450 prevSubmissionId: option.prevSubmissionId, 451 tabModuleId: option.tabModuleId, 452 useShowroomDetailsConfig: option.useShowroomDetailsConfig ? true : false, 453 }; 454 if (option.forceSendLeadToThirdParty) { 455 requestData.forceSendLeadToThirdParty = option.forceSendLeadToThirdParty; 456 } 457 var ajaxOption = { 458 url: '//' + window.location.hostname + option.url, 459 data: requestData, 460 cache: false, 461 }; 462 var enforceModalFocusFn = this.view.getEnforceFocus(); 463 this.view.bindModalHidden($modal, enforceModalFocusFn, option.modalVisibleCssClass, option.onPopupDismissed); 464 this.view.bindModalShown($modal, option.onPopupShown); 465 var currentPageValidators = window.Page_Validators; 466 var showLoading = option.showLoading !== false; 467 var $loadingDialog = showLoading ? this.view.getLoadingDialog() : null; 468 if (showLoading) { 469 this.view.showLoading($loadingDialog); 470 } 471 $.ajax(ajaxOption).then(function (responseData) { 472 if (responseData) { 473 _this.view.appendResponse($modal, responseData, option.customContent); 474 _this.mergePageValidators(currentPageValidators); 475 if (showLoading) { 476 _this.view.hideLoading($loadingDialog, function () { 477 _this.initAndShowModal($modal, option, deferred); 478 }); 479 } 480 else { 481 _this.initAndShowModal($modal, option, deferred); 482 } 483 } 484 }); 485 return deferred.promise(); 486 }; 487 FormDialogV2.prototype.initAndShowModal = function ($modal, option, deferred) { 488 this.view.setEnforceFocus(function () { });
489 this.view.replaceModalHeader($modal, option.customHeaderContent || null); 490 this.view.bindModalShowEvent($modal, option.modalVisibleCssClass || null); 491 this.view.showModal($modal); 492 var handlers = this.view.getViewFormHandlers(); 493 if (handlers) { 494 for (var i = 0; i < handlers.length; i++) { 495 var handler = handlers[i]; 496 if ($modal.find('#' + handler.clientId).length > 0) { 497 var customOptions = this.getCustomOptionForInitFormView(option); 498 this.existForm = handler.init($modal, customOptions); 499 break; 500 } 501 } 502 } 503 if (option.isFormBrpPromotion) { 504 this.view.setPromotionText($modal, option.brpPromotionText); 505 } 506 deferred.resolve(); 507 }; 508 FormDialogV2.prototype.init = function (option) { 509 var _this = this; 510 $(option.buttonSelector).off('click').on('click', function () { 511 _this.displayDialog(option); 512 if (window.sendByCTAEventToBrpAnalytics) { 513 var action = _this.getBrpActionByFormName(option.formName); 514 window.sendByCTAEventToBrpAnalytics(action, option.brpBrand); 515 } 516 }); 517 }; 518 FormDialogV2.prototype.initV2 = function (option) { 519 var _this = this; 520 $(option.buttonSelector).off('click').on('click', function () { 521 _this.addDialogContent(option); 522 _this.displayDialog(option); 523 if (window.sendByCTAEventToBrpAnalytics) { 524 var action = _this.getBrpActionByFormName(option.formName); 525 window.sendByCTAEventToBrpAnalytics(action, option.brpBrand); 526 } 527 }); 528 }; 529 FormDialogV2.prototype.addDialogContent = function (option) { 530 this.view.addDialogContent(option); 531 }; 532 FormDialogV2.prototype.updateModalTitle = function (modalId, modalTitle) { 533 this.view.updateModalTitle(modalId, modalTitle); 534 }; 535 FormDialogV2.prototype.handleBrpAnalyticsEvent = function (formName, brpBrand) { 536 if (!formName || !brpBrand) { 537 return; 538 } 539 if (window.sendByCTAEventToBrpAnalytics) { 540 var action = this.getBrpActionByFormName(formName); 541 window.sendByCTAEventToBrpAnalytics(action, brpBrand); 542 } 543 }; 544 // Static helpers to allow usage without constructing a new instance. 545 FormDialogV2.addDialogContent = function (option) { 546 return FormDialogV2.getInstance().addDialogContent(option); 547 }; 548 FormDialogV2.displayDialog = function (option) { 549 return FormDialogV2.getInstance().displayDialog(option); 550 }; 551 FormDialogV2.init = function (option) { 552 return FormDialogV2.getInstance().init(option); 553 }; 554 FormDialogV2.initV2 = function (option) { 555 return FormDialogV2.getInstance().initV2(option); 556 }; 557 FormDialogV2.updateModalTitle = function (modalId, modalTitle) { 558 return FormDialogV2.getInstance().updateModalTitle(modalId, modalTitle); 559 }; 560 FormDialogV2.handleBrpAnalyticsEvent = function (formName, brpBrand) { 561 return FormDialogV2.getInstance().handleBrpAnalyticsEvent(formName, brpBrand); 562 }; 563 FormDialogV2.sharedInstance = null; 564 return FormDialogV2; 565}()); 566exports.FormDialogV2 = FormDialogV2; 567 568 569/***/ }), 570 571/***/ 875: 572/***/ (function(__unused_webpack_module, exports) { 573 574 575Object.defineProperty(exports, "__esModule", ({ value: true })); 576var FormDialogView = /** @class */ (function () { 577 function FormDialogView() { 578 } 579 FormDialogView.prototype.getModal = function (panelSelector) { 580 return window.$(panelSelector); 581 }; 582 FormDialogView.prototype.getLoadingDialog = function () { 583 return window.$('<div class="modal fade in" id="loadingDialog" role="dialog" aria-hidden="true" aria-labelledby="loadingDialogLabel"><div class="modal-dialog modal-sm"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="myModalLabel">Loading..</h5> </div><div class="modal-body"><div class="progress"> <div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width:100%"></div></div></div></div></div></div>'); 584 }; 585 FormDialogView.prototype.addCustomCss = function () { 586 if (window.$('#modalStyle').length === 0) { 587 window.$('body').prepend(window.$('<style id="modalStyle">
587').html('html.modal-open{overflow: initial;}')); 588 } 589 }; 590 FormDialogView.prototype.addDialogContent = function (option) { 591 var modalId = option.modalId; 592 var modalSelector = '#' + modalId; 593 var modalLabelId = option.modalId + '_label'; 594 var modalTitle = option.modalTitle; 595 var modalCssClass = option.modalCssClass ? " ".concat(option.modalCssClass) : ''; 596 var modalDialogCssClass = option.modalDialogCssClass ? " ".concat(option.modalDialogCssClass) : ''; 597 var modalContentCssClass = option.modalContentCssClass ? " ".concat(option.modalContentCssClass) : ''; 598 var hideFooter = option.hideFooter === true; 599 var modalHeaderHtml = modalTitle && modalTitle.trim() 600 ? "\n <div class=\"modal-header\">\n <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\">×</button>\n <h4 class=\"modal-title\" id=\"".concat(modalLabelId, "\">").concat(modalTitle, "</h4>\n </div>") 601 : "\n <div class=\"modal-header\">\n <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\">×</button>\n </div>"; 602 var modalAriaLabelAttributes = modalTitle && modalTitle.trim() 603 ? "aria-labelledby=\"".concat(modalLabelId, "\"") 604 : 'aria-label="Dialog"'; 605 var modalHtml = "\n <div class=\"modal fade".concat(modalCssClass, "\" id=\"").concat(modalId, "\" tabindex=\"-1\" role=\"dialog\" ").concat(modalAriaLabelAttributes, " aria-hidden=\"true\">\n <div class=\"modal-dialog").concat(modalDialogCssClass, "\">\n <div class=\"modal-content").concat(modalContentCssClass, "\">\n").concat(modalHeaderHtml, "\n <div class=\"modal-body\"></div>\n").concat(hideFooter ? '' : ' <div class="modal-footer">\n </div>', "\n </div>\n </div>\n </div>"); 606 if (window.$(modalSelector).length == 0) { 607 window.$('body').append(modalHtml); 608 } 609 }; 610 FormDialogView.prototype.appendCustomContent = function ($modal, content) { 611 if (!content) { 612 return; 613 } 614 var $body = $modal.find('.modal-body'); 615 var $target = $body.length > 0 ? $body : $modal; 616 // Accept string HTML, jQuery-like wrapper (has nodes), or DOM element 617 if (typeof content === 'string') { 618 $target.append(content); 619 } 620 else if (content && content.nodes) { 621 $target.append(content); 622 } 623 else if (content instanceof Element || (content && (content.nodeType || content.nodeName))) { 624 $target.append(content); 625 } 626 else { 627 // Fallback: try append directly 628 $target.append(content); 629 } 630 }; 631 FormDialogView.prototype.updateModalTitle = function (modalId, modalTitle) { 632 window.$('#' + modalId).find('.modal-title').html(modalTitle); 633 }; 634 FormDialogView.prototype.appendResponse = function ($modal, responseData, customContent) { 635 if (customContent) { 636 this.appendCustomContent($modal, customContent); 637 } 638 $modal.find('.modal-body').append(responseData); 639 $modal.find('.recaptcha-section .error-message').hide(); 640 $modal.data('loaded', true); 641 }; 642 FormDialogView.prototype.isLoaded = function ($modal) { 643 return $modal.data('loaded'); 644 }; 645 FormDialogView.prototype.hideErrors = function ($modal) { 646 $modal.find('.error-message').hide(); 647 }; 648 FormDialogView.prototype.setPromotionText = function ($modal, text) { 649 $modal.find('.modal-body .CommentsField').text(text); 650 }; 651 FormDialogView.prototype.showModal = function ($modal) { 652 this.setModalAriaHidden($modal, false); 653 $modal.modal({ show: true, backdrop: 'static' }); 654 }; 655 FormDialogView.prototype.getEnforceFocus = function () { 656 return window.$.fn.modal.Constructor.prototype.enforceFocus; 657 }; 658 FormDialogView.prototype.setEnforceFocus = function (fn) { 659 window.$.fn.modal.Constructor.prototype.enforceFocus = fn; 660 }; 661 FormDialogView.prototype.bindModalHidden = function ($modal, enforceModalFocusFn, modalVisibleCssClass, onModalClosed) { 662 var view = this; 663 $modal.on('hidden.bs.modal', function () { 664 view.setModalAriaHidden($modal, true); 665 window.$('html, body').removeClass('modal-open'); 666 window.$('#modalStyle').remove(); 667 if (modalVisibleCssClass) { 668 $modal.removeClass(modalVisibleCssClass); 669 } 670 window.$.fn.modal.Constructor.prototype.enforceFocus = enforceModalFocusFn; 671 // Invoke callback if provided 672 if (onModalClosed) { 673 onModalClosed(); 674 } 675 }); 676 }; 677 FormDialogView.prototype.bindModalShown = function ($modal, onModalShown) { 678 if (!onModalShown) { 679 return; 680 } 681 $modal.on('shown.bs.modal', function () { 682 onModalShown(); 683 }); 684 }; 685 FormDialogView.prototype.bindModalShowEvent = function ($modal, modalVisibleCssClass) { 686 if (!modalVisibleCssClass) { 687 return; 688 } 689 $modal.on('show.bs.modal', function () { 690 $modal.addClass(modalVisibleCssClass); 691 }); 692 }; 693 FormDialogView.prototype.replaceModalHeader = function ($modal, customHeaderContent) { 694 if (!customHeaderContent) { 695 return; 696 }
697 var $header = $modal.find('.modal-header'); 698 if ($header.length > 0) { 699 if (typeof customHeaderContent === 'string') { 700 $header.replaceWith(customHeaderContent); 701 } 702 } 703 }; 704 FormDialogView.prototype.showLoading = function ($loadingDialog) { 705 $loadingDialog.modal({ show: true, backdrop: 'static' }); 706 }; 707 FormDialogView.prototype.hideLoading = function ($loadingDialog, onHidden) { 708 $loadingDialog.on('hidden.bs.modal', function () { 709 onHidden(); 710 }).modal('hide'); 711 }; 712 FormDialogView.prototype.getViewFormHandlers = function () { 713 return window.$(window).data('viewFormHandlers'); 714 }; 715 FormDialogView.prototype.setModalAriaHidden = function ($modal, isHidden) { 716 var value = isHidden ? 'true' : 'false'; 717 if ($modal && typeof $modal.attr === 'function') { 718 $modal.attr('aria-hidden', value); 719 return; 720 } 721 if ($modal && $modal.nodes) { 722 $modal.nodes.forEach(function (node) { return node.setAttribute('aria-hidden', value); }); 723 } 724 }; 725 return FormDialogView; 726}()); 727exports["default"] = FormDialogView; 728 729 730/***/ }), 731 732/***/ 363: 733/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 734 735 736Object.defineProperty(exports, "__esModule", ({ value: true })); 737exports.SubmissionCompleteView = void 0; 738var ButtonActions_1 = __webpack_require__(134); 739var SubmissionCompleteView = /** @class */ (function () { 740 function SubmissionCompleteView(clientIdSelector, options) { 741 this.isDisplaySecondaryActions = false; 742 this.selector = { 743 container: clientIdSelector, 744 }; 745 this.options = options; 746 this.initElements(); 747 this.secondaryActionsView = new ButtonActions_1.ButtonActions(this.options.portalId, this.options.moduleId); 748 this.isDisplaySecondaryActions = this.secondaryActionsView.isShowSecondaryActionsByFormName(this.options.formName); 749 } 750 SubmissionCompleteView.prototype.initElements = function () { 751 this.$element = { 752 container: $(this.selector.container) 753 }; 754 }; 755 SubmissionCompleteView.prototype.displaySubmissionCompletionModal = function () { 756 var _this = this; 757 var isDisplayAsDialog = this.isDisplaySecondaryActions; 758 if (isDisplayAsDialog) { 759 this.$element.container.modal("hide"); 760 this.addSubmissionCompletionModal(); 761 this.injectBodyContent().then(function () { 762 _this.openSubmissionCompletionModal(); 763 }); 764 } 765 else { 766 // the legacy scenario. 767 // display message in div 768 // for both open a form from dialog or normal page. 769 this.displayMessage(); 770 } 771 }; 772 SubmissionCompleteView.prototype.displayMessage = function () { 773 // legacy method for display message 774 if ($('.formControl').length) { 775 var formControl = this.$element.container.find('.formControl'); 776 var modalContent = formControl.closest(".modal-content"); 777 var modalFooter = modalContent.find(".modal-footer"); 778 modalFooter.find('.submit-button').hide(); 779 this.$element.container.find('.formControl').hide(); 780 } 781 else { 782 this.$element.container.find('.section-wrap').hide(); 783 this.$element.container.find('input[type="button"]').hide(); 784 this.$element.container.find('.form-title').hide(); 785 } 786 if (!this.$element.container.find('.em-message').length) { 787 this.$element.container.append('<p class="em-message"></p>'); 788 } 789 this.$element.container.find('.em-message').html(this.options.displayMessage).show(); 790 this.$element.container.find('.secure-image').hide(); 791 }; 792 SubmissionCompleteView.prototype.injectBodyContent = function () { 793 var modalSelector = "#".concat(this.options.modalId); 794 var $dialog = $(modalSelector);
795 $dialog.find(".modal-body").html("<div><span>".concat(this.options.displayMessage, "</span></div>")); 796 if (!this.isDisplaySecondaryActions) { 797 return Promise.resolve(); 798 } 799 if (this.options.secondaryActionsDisabled) { 800 return Promise.resolve(); 801 } 802 // binding event when open modal dialog 803 var view = this; 804 $dialog.off("show.bs.modal").on("show.bs.modal", function () { 805 view.secondaryActionsView.init(view.options.tabModuleId, view.options.formName, view.options.productId, ".modal-body", view.options.prevSubmissionId).then(function () { 806 // override event when show in dialog 807 var testRideButton = view.secondaryActionsView.getScheduleTestRideButton(); 808 testRideButton.off("click").on("click", function (e) { 809 // display schdule test ride 810 view.secondaryActionsView.onScheduleTestRideButtonClicked(e); 811 // then close submission dialog 812 $dialog.modal("hide"); 813 }); 814 }); 815 }); 816 return this.secondaryActionsView.loadContent() 817 .then(function (htmlContent) { 818 $dialog.find(".modal-body").append("<br>"); 819 $dialog.find(".modal-body").append(htmlContent); 820 }); 821 }; 822 SubmissionCompleteView.prototype.openSubmissionCompletionModal = function () { 823 var modalSelector = '#' + this.options.modalId; 824 var $dialog = $(modalSelector); 825 $dialog.modal("show"); 826 }; 827 SubmissionCompleteView.prototype.addSubmissionCompletionModal = function () { 828 if (!this.options.modalId || this.options.modalId === "") { 829 this.options.modalId = "SubmissionCompletionModal"; 830 } 831 var modalId = this.options.modalId; 832 var modalSelector = "#".concat(this.options.modalId); 833 // clone Title from Form Dialog 834 var modalTitle = this.options.formName; 835 if (this.$element.container 836 && this.$element.container.find(".modal-title").length > 0) { 837 modalTitle = this.$element.container.find(".modal-title").html(); 838 } 839 if ($(modalSelector).length > 0) { 840 // already exist. just change the modal title. 841 var $dialog = $(modalSelector); 842 $dialog.find(".modal-title").html(modalTitle); 843 return; 844 } 845 var modalLabelId = this.options.modalId + '_label'; 846 var modalHtml = '\ 847 <div class="modal fade" id="' + modalId + '" tabindex="-1" role="dialog" aria-labelledby="' + modalLabelId + '" aria-hidden="true">\ 848 <div class="modal-dialog">\ 849 <div class="modal-content">\ 850 <div class="modal-header">\ 851 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>\ 852 <h4 class="modal-title" id="' + modalLabelId + '">' + modalTitle + '</h4>\ 853 </div>\ 854 <div class="modal-body"></div>\ 855 <div class="modal-footer">\ 856 </div>\ 857 </div>\ 858 </div>\ 859 </div>'; 860 if ($(modalSelector).length === 0) { 861 $("body").append(modalHtml); 862 } 863 }; 864 ; 865 return SubmissionCompleteView; 866}()); 867exports.SubmissionCompleteView = SubmissionCompleteView; 868 869 870/***/ }), 871 872/***/ 979: 873/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 874 875 876var __assign = (this && this.__assign) || function () { 877 __assign = Object.assign || function(t) { 878 for (var s, i = 1, n = arguments.length; i < n; i++) { 879 s = arguments[i]; 880 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) 881 t[p] = s[p]; 882 } 883 return t; 884 }; 885 return __assign.apply(this, arguments); 886}; 887var __importDefault = (this && this.__importDefault) || function (mod) { 888 return (mod && mod.__esModule) ? mod : { "default": mod }; 889}; 890Object.defineProperty(exports, "__esModule", ({ value: true })); 891exports.Dx1ViewForm = exports.Dx1ViewFormView = exports.ViewFormUtil = exports.PopupService = exports.FormDialogV2 = void 0; 892var shiftDigitalAnalyticsManager_1 = __importDefault(__webpack_require__(29)); 893var FormPrePopulate_1 = __importDefault(__webpack_require__(729)); 894var polarisDigitasManager_1 = __importDefault(__webpack_require__(542)); 895var SubmissionCompleteDialog_1 = __webpack_require__(363); 896var FormDialogV2_1 = __webpack_require__(98); 897Object.defineProperty(exports, "FormDialogV2", ({ enumerable: true, get: function () { return FormDialogV2_1.FormDialogV2; } })); 898var PopupService_1 = __webpack_require__(457); 899Object.defineProperty(exports, "PopupService", ({ enumerable: true, get: function () { return PopupService_1.PopupService; } })); 900exports.ViewFormUtil = {}; 901(function (ViewFormUtil) { 902 function createMappedKeyWithSuffixIndex(obj, questionMappedKey) { 903 for (var i = 1; i < 100; i++) { 904 var curKey = questionMappedKey + "_" + i; 905 var val = obj[curKey]; 906 if (!val && val !== 0) { 907 return curKey; 908 } 909 } 910 return questionMappedKey + "_100"; 911 } 912 function extractCheckedValuesFromMulitpleCheckboxes($multiChkDiv) { 913 var vals = $multiChkDiv 914 .find(":checkbox:checked") 915 .map(function (idx, elm) { 916 return $(elm).val(); 917 }).get(); 918 if ($.isArray(vals) && vals.length > 0) { 919 return vals.join(","); 920 } 921 return null; 922 } 923 function getProductIdJqueryObject(clientId) { 924 var $root = $("#" + clientId); 925 return $root.find("[data-question-mapped-key-name=\"ProductId\"]"); 926 } 927 function getProductIdManufacturerDropdownJqueryObject(clientId) { 928 return getProductIdJqueryObject(clientId).find("select.manufacturer-control"); 929 } 930 function getProductIdCategoryDropdownJqueryObject(clientId) { 931 return getProductIdJqueryObject(clientId).find("select.category-control"); 932 } 933 function getProductIdModelDropdownJqueryObject(clientId) { 934 return getProductIdJqueryObject(clientId).find("select.model-dropdown-control"); 935 } 936 function hasProductIdValue(clientId) { 937 var productId = getProductIdModelDropdownJqueryObject(clientId); 938 return !!productId.val(); 939 } 940 function getSelectedProductData(clientId) { 941 var $productId = getProductIdModelDropdownJqueryObject(clientId); 942 if (!$productId.val()) { 943 return null; 944 } 945 var selectedOptionSelector = "option:selected"; 946 var $option = $productId.find(selectedOptionSelector); 947 var isPolarisOrIndianVendor = $option.data("ispolarisorindianvendor").toString() === "1"; 948 if (!isPolarisOrIndianVendor) { 949 return null; 950 } 951 var manufacturerName = getProductIdManufacturerDropdownJqueryObject(clientId).val(); 952 var categoryName = getProductIdCategoryDropdownJqueryObject(clientId).val(); 953 var productTypeName = $option.data("type").toString(); 954 return { 955 isPolarisOrIndianVendor: isPolarisOrIndianVendor, 956 manufacturerName: manufacturerName, 957 categoryName: categoryName, 958 productTypeName: productTypeName 959 }; 960 } 961 function isElementModelControl($elm, questionMappedKey) { 962 return $elm.find("div.model-control").get(0) && questionMappedKey === "ProductId"; 963 } 964 function extractProductIdFromModelControl($elm) { 965 return $elm.find("select.model-dropdown-control").val(); 966 } 967 function extractValueFromInput($elm, questionMappedKey) { 968 var val = null; 969 var $input = $elm.find("input:visible"); 970 var $select = $elm.find("select:visible"); 971 var $textarea = $elm.find("textarea:visible"); 972 var $multiChkDiv = $elm.find("div.multi-choice"); 973 var isCheckEmptyValue = false; 974 if (isElementModelControl($elm, questionMappedKey)) { 975 val = extractProductIdFromModelControl($elm); 976 } 977 else if ($multiChkDiv.get(0) && questionMappedKey !== "HasJointApplicant") { 978 val = extractCheckedValuesFromMulitpleCheckboxes($multiChkDiv); 979 } 980 else if ($input.get(0)) { 981 if ($input.length > 1 && $input.is(":radio")) { 982 val = $elm.find("input[type=radio]:checked").val(); 983 } 984 else if ($input.is(":checkbox")) { 985 val = $input.is(":checked"); 986 } 987 else { 988 val = $input.val(); 989 isCheckEmptyValue = true; 990 } 991 } 992 else if ($select.get(0)) { 993 val = $select.val(); 994 isCheckEmptyValue = true; 995 } 996 else if ($textarea.get(0)) { 997 val = $textarea.val(); 998 isCheckEmptyValue = true; 999 } 1000 if (isCheckEmptyValue && val === "") { 1001 return null; 1002 } 1003 if (val && $.type(val) === "string") { 1004 val = val.trim(); 1005 } 1006 if (!val && val !== 0 && ["Comment", "JointApplicantComment"].indexOf(questionMappedKey) > -1) { 1007 return null; 1008 } 1009 return val; 1010 } 1011 function setPrintLeadInfoData($elm, val, data, questionMappedKey, isBrpRequestMoreInfo) { 1012 var printLeadInfo = data["PrintLeadInfo"]; 1013 if (!printLeadInfo) { 1014 printLeadInfo = {}; 1015 data["PrintLeadInfo"] = printLeadInfo; 1016 } 1017 if (["Comment", "JointApplicantComment"].indexOf(questionMappedKey) > -1) {
1018 var $financeAppPrint = $elm.find("[data-financeapp-isprint]"); 1019 if (!$financeAppPrint.length || $financeAppPrint.attr("data-financeapp-isprint").toLowerCase() !== "true") { 1020 return; 1021 } 1022 var commentLabelText = $elm.find("[data-relationship-name]").attr("data-relationship-name"); 1023 if (questionMappedKey === "JointApplicantComment") { 1024 commentLabelText = "JointApplicant - " + commentLabelText; 1025 } 1026 if (isBrpRequestMoreInfo) { 1027 if (!printLeadInfo[commentLabelText] && 1028 (commentLabelText.toLowerCase() == "comments" || commentLabelText.toLowerCase() == "comment")) { 1029 printLeadInfo[commentLabelText] = val; 1030 } 1031 } 1032 else { 1033 if (!printLeadInfo[commentLabelText]) { 1034 printLeadInfo[commentLabelText] = val; 1035 } 1036 else { 1037 var nextMappedKey = createMappedKeyWithSuffixIndex(printLeadInfo, commentLabelText); 1038 printLeadInfo[nextMappedKey] = val; 1039 } 1040 } 1041 } 1042 } 1043 function getFormName(clientId) { 1044 var $root = $("#" + clientId); 1045 if (!$root.get(0)) { 1046 return null; 1047 } 1048 return $root.find("[data-form-name]").attr("data-form-name"); 1049 } 1050 var shouldNotMapKeys = ["AdSourceName", "IncomeLevel"]; 1051 var brpRequestMoreInfoFormId = "b3b6cb33-3150-4c83-afff-0b4a497006fe"; 1052 function buildFormJsonRequestMessage(clientId, opts) { 1053 var $root = $("#" + clientId); 1054 if (!$root.get(0)) { 1055 return null; 1056 } 1057 var data = { 1058 FormName: getFormName(clientId) 1059 }; 1060 try { 1061 var isBrpRequestMoreInfo_1 = false; 1062 if (opts && opts.formId == brpRequestMoreInfoFormId) { 1063 isBrpRequestMoreInfo_1 = true; 1064 } 1065 $root.find("[data-question-mapped-key-name]").each(function (idx, elm) { 1066 try { 1067 var $elm = $(elm); 1068 var questionMappedKey = $elm.attr("data-question-mapped-key-name"); 1069 if (!questionMappedKey || shouldNotMapKeys.indexOf(questionMappedKey) >= 0) { 1070 return; 1071 } 1072 var nextMappedKey; 1073 var val = extractValueFromInput($elm, questionMappedKey); 1074 if (val === null) { 1075 return; 1076 } 1077 if (!data[questionMappedKey] && data[questionMappedKey] !== "" && ["Comment", "JointApplicantComment"].indexOf(questionMappedKey) === -1) { 1078 data[questionMappedKey] = val; 1079 } 1080 else { 1081 var leadInfo = data["LeadInfo"]; 1082 if (!leadInfo) { 1083 leadInfo = {}; 1084 data["LeadInfo"] = leadInfo; 1085 } 1086 if (["Comment", "JointApplicantComment"].indexOf(questionMappedKey) > -1) { 1087 var commentLabelText = $elm.find("[data-relationship-name]").attr("data-relationship-name"); 1088 if (questionMappedKey === "JointApplicantComment") { 1089 commentLabelText = "JointApplicant - " + commentLabelText; 1090 } 1091 var $discalimer = $elm.find("[data-financeapp-isdisclaimer]"); 1092 var isDisclaimer = false; 1093 if ($discalimer.length) { 1094 isDisclaimer = $discalimer.attr("data-financeapp-isdisclaimer").toLowerCase() === "true"; 1095 } 1096 if (!isDisclaimer) { 1097 if (isBrpRequestMoreInfo_1) { 1098 if (!leadInfo[commentLabelText] && 1099 (commentLabelText.toLowerCase() == "comments" || commentLabelText.toLowerCase() == "comment")) { 1100 leadInfo[commentLabelText]
1100= val; 1101 } 1102 } 1103 else { 1104 if (!leadInfo[commentLabelText]) { 1105 leadInfo[commentLabelText] = val; 1106 } 1107 else { 1108 nextMappedKey = createMappedKeyWithSuffixIndex(leadInfo, commentLabelText); 1109 leadInfo[nextMappedKey] = val; 1110 } 1111 } 1112 } 1113 } 1114 else if (!leadInfo[questionMappedKey]) { 1115 leadInfo[questionMappedKey] = val; 1116 } 1117 else { 1118 nextMappedKey = createMappedKeyWithSuffixIndex(leadInfo, questionMappedKey); 1119 leadInfo[nextMappedKey] = val; 1120 } 1121 setPrintLeadInfoData($elm, val, data, questionMappedKey, isBrpRequestMoreInfo_1); 1122 } 1123 } 1124 catch (error) { 1125 data["ErrorOnLoopQuestionMapped"] += "<br/>Error at idx-".concat(idx, ": ").concat(error.message); 1126 } 1127 }); 1128 if ($root.find("[data-question-mapped-key-name]") && $root.find("[data-question-mapped-key-name]").length === 0) { 1129 data["ErrorOnBuildFormRequestMessage"] += "<br/>Not Found data-question-mapped-key-name"; 1130 } 1131 } 1132 catch (error) { 1133 data["ErrorOnBuildFormRequestMessage"] += "<br/>".concat(error.message); 1134 } 1135 return data; 1136 } 1137 function clearForm(clientId) { 1138 var $root = $("#" + clientId); 1139 $root.find("[data-question-mapped-key-name] input:not([type=checkbox]):not([type=radio]):not([type=hidden])").val(""); 1140 $root.find("[data-question-mapped-key-name] select:visible").each(function (idx, elm) { 1141 var $select = $(elm); 1142 $select.val(""); 1143 $select.find("option:first").attr("selected", ""); 1144 }); 1145 } 1146 ViewFormUtil.clearForm = clearForm; 1147 ViewFormUtil.getFormName = getFormName; 1148 ViewFormUtil.buildFormJsonRequestMessage = buildFormJsonRequestMessage; 1149 ViewFormUtil.hasProductIdValue = hasProductIdValue; 1150 ViewFormUtil.getSelectedProductData = getSelectedProductData; 1151})(exports.ViewFormUtil); 1152var Dx1ViewFormView = /** @class */ (function () { 1153 function Dx1ViewFormView(clientIdSelector, options) { 1154 this.selector = { 1155 container: clientIdSelector, 1156 }; 1157 this.options = options; 1158 this.initElements(); 1159 } 1160 Dx1ViewFormView.prototype.displaySubmissionCompletionModal = function (responseMessage) { 1161 var message = responseMessage ? responseMessage : this.getFinalMessage(); 1162 if ($('.formControl').length) { 1163 var formControl = this.$element.container.find('.formControl'); 1164 var modalContent = formControl.closest(".modal-content"); 1165 var modalFooter = modalContent.find(".modal-footer"); 1166 modalFooter.find('.submit-button').hide(); 1167 this.$element.container.find('.formControl').hide(); 1168 } 1169 else { 1170 this.$element.container.find('.section-wrap').hide(); 1171 this.$element.container.find('input[type="button"]').hide(); 1172 this.$element.container.find('.form-title').hide(); 1173 } 1174 if (!this.$element.container.find('.em-message').length) { 1175 this.$element.container.append('<p class="em-message"></p>'); 1176 } 1177 this.$element.container.find('.em-message').html(message).show(); 1178 this.$element.container.find('.secure-image').hide(); 1179 }; 1180 Dx1ViewFormView.prototype.initElements = function () { 1181 this.$element = { 1182 container: $(this.selector.container) 1183 }; 1184 }; 1185 Dx1ViewFormView.prototype.getFinalMessage = function () {
1186 return this.options.finalMessage; 1187 }; 1188 return Dx1ViewFormView; 1189}()); 1190exports.Dx1ViewFormView = Dx1ViewFormView; 1191function Dx1ViewForm(clientId, options) { 1192 var reCaptchaTimeout = 60000; 1193 var self = this; 1194 var container = $('#' + clientId); 1195 var sf = (options && (options.moduleIdForDnnServicesFramework !== undefined && options.moduleIdForDnnServicesFramework !== null)) 1196 ? $.ServicesFramework(options.moduleIdForDnnServicesFramework) 1197 : $.ServicesFramework(0); 1198 self.sf = sf; 1199 self.clientId = clientId; 1200 self.options = $.extend({ 1201 submitText: 'Submit', 1202 submittingText: 'Submitting...', 1203 submittingClass: 'submitting', 1204 validationGroup: '', 1205 moduleId: null, 1206 tabModuleId: null 1207 }, options); 1208 var formPrepopulate = new FormPrePopulate_1.default(); 1209 var selectors = { 1210 preferredContactSection: "[data-question-mapped-key-name='PreferredContact']", 1211 isCcpaSection: "[data-question-mapped-key-name='IsCcpa']", 1212 isTcpaSection: "[data-question-mapped-key-name='IsTcpa']", 1213 cellPhoneSection: "[data-question-mapped-key-name='CellPhone']", 1214 consentCheckboxSection: ".dx1-consent", 1215 disclaimerCheckboxSection: ".dx1-disclaimer", 1216 }; 1217 var validationMessage = { 1218 emailInvalidFormat: "Email Address should be in [email protected] format.", 1219 phoneInvalidFormat: "Phone number should only consist of numbers, ( ), -, +", 1220 dateInvalidFormat: "Date must be in the format MM/DD/YYYY.", 1221 birthdateIsInvalid: "Date of Birth is not valid.", 1222 }; 1223 var guidEmpty = "00000000-0000-0000-0000-000000000000"; 1224 var submitFormRequiredFields = ["FirstName", "LastName", "Email"]; 1225 function sendValidationBindingIssueToServer(issue, diagnostics) { 1226 var _a; 1227 var payload = { 1228 issue: issue, 1229 eventName: (diagnostics === null || diagnostics === void 0 ? void 0 : diagnostics.eventName) || null, 1230 formName: exports.ViewFormUtil.getFormName(self.clientId), 1231 formId: (_a = self.options) === null || _a === void 0 ? void 0 : _a.formId, 1232 relativeUrl: container.find("[data-form-relative-url]").attr("data-form-relative-url"), 1233 pageUrl: window.location.href, 1234 referrer: document.referrer, 1235 clientId: self.clientId, 1236 diagnosticsJson: diagnostics ? JSON.stringify(diagnostics) : null 1237 }; 1238 $.ajax({
1239 type: "POST", 1240 url: sf.getServiceRoot('Dominion/Forms') + 'Forms/LogValidationBindingIssue', 1241 data: JSON.stringify(payload), 1242 contentType: "application/json; charset=utf-8", 1243 beforeSend: sf.setModuleHeaders, 1244 }); 1245 } 1246 function getMissingSubmitFormFields(formData) { 1247 return submitFormRequiredFields.filter(function (fieldName) { 1248 var value = formData ? formData[fieldName] : null; 1249 return value == null || (typeof value === "string" && value.trim() === ""); 1250 }); 1251 } 1252 function getFormMappedKeys() { 1253 return container.find("[data-question-mapped-key-name]") 1254 .map(function (index, element) { 1255 return ($(element).attr("data-question-mapped-key-name") || "").trim(); 1256 }) 1257 .get() 1258 .filter(function (name) { return name.length > 0; }); 1259 } 1260 function logMissingRequiredFieldsAfterSubmit(formData, responseContext) { 1261 var _a, _b, _c, _d; 1262 if (responseContext === void 0) { responseContext = {}; } 1263 var missingFields = getMissingSubmitFormFields(formData); 1264 if (!missingFields.length) { 1265 return; 1266 } 1267 var mappedKeys = getFormMappedKeys(); 1268 var mappedKeyNames = mappedKeys.join(", ") || "none"; 1269 var issue = "SubmitForm posted with missing required fields in formData. Missing: ".concat(missingFields.join(", "), ". Mapped keys: ").concat(mappedKeyNames, "."); 1270 var getFieldState = function (fieldName) { 1271 var hasField = !!formData && Object.prototype.hasOwnProperty.call(formData, fieldName); 1272 var value = hasField ? formData[fieldName] : null; 1273 if (!hasField) { 1274 return "missing"; 1275 } 1276 if (value == null) { 1277 return "null"; 1278 } 1279 if (typeof value === "string" && value.trim() === "") { 1280 return "empty"; 1281 } 1282 return "present"; 1283 }; 1284 var getControlValueLength = function ($control) { 1285 if (!$control || !$control.length) { 1286 return null; 1287 } 1288 var controlValue = $control.first().val(); 1289 if (typeof controlValue === "string") { 1290 return controlValue.trim().length; 1291 } 1292 if ($.isArray(controlValue)) { 1293 return controlValue.length; 1294 } 1295 if (typeof controlValue === "boolean") { 1296 return controlValue ? 1 : 0; 1297 } 1298 return controlValue == null ? null : "".concat(controlValue).length; 1299 }; 1300 var getDomFieldStates = function () { 1301 var states = {}; 1302 submitFormRequiredFields.forEach(function (fieldName) { 1303 var $question = container.find("[data-question-mapped-key-name='".concat(fieldName, "']")).first(); 1304 var $control = $question.length ? getValidationControl($question) : $(); 1305 var controlTagName = $control.length && $control[0] && $control[0].tagName 1306 ? $control[0].tagName.toLowerCase() 1307 : null; 1308 states[fieldName] = { 1309 existsInDom: $question.length > 0, 1310 hasInput: $control.length > 0, 1311 isVisible: ($question.length > 0 && $question.is(":visible")) || ($control.length > 0 && $control.is(":visible")), 1312 inputType: $control.length ? ($control.attr("type") || controlTagName) : null, 1313 valueLength: getControlValueLength($control), 1314 hasValidationMetadata: $question.is("[data-question-validation-rules]"), 1315 validationRules: $question.attr("data-question-validation-rules") || null 1316 }; 1317 }); 1318 return states; 1319 }; 1320 var visibleValidationMessages = container.find(".error-text") 1321 .map(function (index, element) { 1322 return ($(element).text() || "").trim(); 1323 }) 1324 .get() 1325 .filter(function (message) { return message.length > 0; }); 1326 var diagnostics = { 1327 eventName: "SubmitFormMissingRequiredFields", 1328 timestampUtc: new Date().toISOString(), 1329 requiredFields: submitFormRequiredFields, 1330 missingFields: missingFields, 1331 fieldStates: submitFormRequiredFields.reduce(function (states, fieldName) { 1332 states[fieldName] = getFieldState(fieldName); 1333 return states; 1334 }, {}), 1335 formDataKeys: formData ? Object.keys(formData) : [], 1336 formDataKeyCount: formData ? Object.keys(formData).length : 0, 1337 mappedKeys: mappedKeys, 1338 mappedKeyCount: mappedKeys.length, 1339 domFieldStates: getDomFieldStates(), 1340 validationRuleElementCount: container.find("[data-question-validation-rules]").length, 1341 visibleValidationMessages: visibleValidationMessages, 1342 errorOnBuildFormRequestMessage: (formData === null || formData === void 0 ? void 0 : formData.ErrorOnBuildFormRequestMessage) || null, 1343 errorOnLoopQuestionMapped: (formData === null || formData === void 0 ? void 0 : formData.ErrorOnLoopQuestionMapped) || null, 1344 siteId: (formData === null || formData === void 0 ? void 0 : formData.SiteId) || null, 1345 dealershipId: (formData === null || formData === void 0 ? void 0 : formData.DealershipId) || null, 1346 productId: (formData === null || formData === void 0 ? void 0 : formData.ProductId) || null, 1347 moduleId: (_b = (_a = self.options) === null || _a === void 0 ? void 0 : _a.moduleId) !== null && _b !== void 0 ? _b : null, 1348 tabModuleId: (_d = (_c = self.options) === null || _c === void 0 ? void 0 : _c.tabModuleId) !== null && _d !== void 0 ? _d : null, 1349 userAgent: navigator.userAgent, 1350 responseContext: responseContext 1351 }; 1352 sendValidationBindingIssueToServer(issue, diagnostics); 1353 } 1354 function getSelectedModelData() { 1355 var $selectedModel = container.find("[id$=SelectedModel]"); 1356 if (!$selectedModel || !$selectedModel.length) { 1357 return null; 1358 } 1359 var selectedModel = $selectedModel.val(); 1360 try { 1361 return JSON.parse(selectedModel); 1362 } 1363 catch (err) { 1364 return null; 1365 } 1366 } 1367 function setSelectedModelData(category, manufacturer, year, model) { 1368 var json = { 1369 category: category, 1370 manufacturer: manufacturer, 1371 year: year, 1372 model: model 1373 }; 1374 var jsonString = JSON.stringify(json); 1375 var selectedModelHiddenField = container.find("[id$=SelectedModel]"); 1376 selectedModelHiddenField.val(jsonString); 1377 } 1378 function setDropDownValue(control, value) { 1379 if (!control || !control.length || !value) { 1380 return; 1381 } 1382 control.val(value); 1383 } 1384 function callAjaxToGetModelLookUpData(url) { 1385 return $.ajax({
1386 type: "GET", 1387 url: url + "&_=" + new Date().getTime(), 1388 beforeSend: function (xhr) { var _a; return xhr.setRequestHeader("ModuleId", (_a = sf.getModuleId()) === null || _a === void 0 ? void 0 : _a.toString()); } 1389 }); 1390 } 1391 function getModelDropdownOptions(item) { 1392 var optionText = item.ProductName; 1393 if (item.ProductColor && item.ProductColor.length > 0) { 1394 optionText += "-" + item.ProductColor; 1395 } 1396 var isPolarisOrIndianVendor = item.IsPolarisOrIndianVendor ? "1" : "0"; 1397 var $option = $("<option/>").text(optionText) 1398 .val(item.ProductGuid) 1399 .attr({ 1400 "data-ispolarisorindianvendor": isPolarisOrIndianVendor, 1401 "data-type": item.ProductTypeName, 1402 }); 1403 return $option.get(0).outerHTML; 1404 } 1405 function activateAndFillDropdowWithData(ddl, data, defaultValue) { 1406 var $ddl = $(ddl); 1407 if (!$ddl.get(0) || !$.isArray(data)) { 1408 return; 1409 } 1410 $ddl.prop("disabled", false); 1411 $ddl.empty(); 1412 var optionItems = '<option value="">' + defaultValue + '</option>'; 1413 $.each(data, function (idx, obj) { 1414 if (defaultValue === "Model") { 1415 optionItems += getModelDropdownOptions(obj); 1416 } 1417 else { 1418 optionItems += '<option value="' + obj + '">' + obj + '</option>'; 1419 } 1420 }); 1421 $ddl.html(optionItems); 1422 if ($ddl.get(0) === self.modelDropDown) { 1423 if (self.options.productId !== guidEmpty) { 1424 self.modelDropDown.val(self.options.productId); 1425 } 1426 } 1427 } 1428 function populateManufacturerDropdown(selectedCategoryCode) { 1429 var url = sf.getServiceRoot('Dominion/Forms') 1430 + 'Forms/GetManufacturerByFilter?category=' 1431 + selectedCategoryCode; 1432 return callAjaxToGetModelLookUpData(url) 1433 .then(function (response) { 1434 if (response.IsSuccess) { 1435 activateAndFillDropdowWithData(self.manufacturerDropDown, response.Manufacturers, "Manufacturer"); 1436 } 1437 }); 1438 } 1439 function populateYearDropdown(category, manufacturer) { 1440 var url = sf.getServiceRoot('Dominion/Forms') 1441 + 'Forms/GetYearByFilter?' 1442 + 'category=' + category 1443 + '&manufacturer=' + manufacturer; 1444 return callAjaxToGetModelLookUpData(url) 1445 .then(function (response) { 1446 if (response.IsSuccess) { 1447 response.Years = normalizeYearOptions(response.Years); 1448 activateAndFillDropdowWithData(self.yearDropDown, response.Years, "Year"); 1449 } 1450 return response; 1451 }); 1452 } 1453 function normalizeYearOptions(years) { 1454 if (!$.isArray(years)) { 1455 return years; 1456 } 1457 var yearValues = years.filter(function (year) { 1458 return year !== null && year !== undefined; 1459 }); 1460 var hasZeroYear = yearValues.some(function (year) { 1461 return year.toString() === "0"; 1462 }); 1463 var hasNonZeroYear = yearValues.some(function (year) { 1464 return year.toString() !== "0"; 1465 }); 1466 if (hasZeroYear && hasNonZeroYear) { 1467 return yearValues.filter(function (year) { 1468 return year.toString() !== "0"; 1469 }); 1470 } 1471 return yearValues; 1472 } 1473 function populateYearAndMaybeLoadModel(selectedCategory, selectedManufacturer, selectedYear, shouldDisableYearDropDown) { 1474 return populateYearDropdown(selectedCategory, selectedManufacturer) 1475 .then(function (response) { 1476 if (!response || !response.IsSuccess) { 1477 return response; 1478 } 1479 if ($.isArray(response.Years) && response.Years.length === 1 && response.Years[0].toString() === "0") { 1480 self.yearDropDown.prop('disabled', true); 1481 if (shouldDisableYearDropDown) { 1482 self.yearDropDown.val(""); 1483 } 1484 setSelectedModelData(selectedCategory, selectedManufacturer, "0", null); 1485 return populateModelDropdown(selectedCategory, selectedManufacturer, "0"); 1486 } 1487 self.yearDropDown.prop('disabled', false); 1488 if (selectedYear) { 1489 return populateModelDropdown(selectedCategory, selectedManufacturer, selectedYear); 1490 } 1491 return response; 1492 }); 1493 } 1494 function populateModelDropdown(category, manufacturer, year) { 1495 var url = sf.getServiceRoot('Dominion/Forms') 1496 + 'Forms/GetModelByFilter?' 1497 + 'category=' + category 1498 + '&manufacturer=' + manufacturer 1499 + '&year=' + year; 1500 return callAjaxToGetModelLookUpData(url) 1501 .then(function (response) { 1502 if (response.IsSuccess) { 1503 activateAndFillDropdowWithData(self.modelDropDown, response.Models, "Model"); 1504 } 1505 }); 1506 } 1507 function initModelControlValue() { 1508 var deferred = $.Deferred(); 1509 var selectedModelJson = getSelectedModelData(); 1510 if (!selectedModelJson || !selectedModelJson.category) { 1511 return deferred.reject(); 1512 } 1513 return populateManufacturerDropdown(selectedModelJson.category) 1514 .then(function () { 1515 return populateYearAndMaybeLoadModel(selectedModelJson.category, selectedModelJson.manufacturer, selectedModelJson.year, false); 1516 }) 1517 .then(function () { 1518 setDropDownValue(self.manufacturerDropDown, selectedModelJson.manufacturer); 1519 setDropDownValue(self.yearDropDown, selectedModelJson.year); 1520 setDropDownValue(self.modelDropDown, selectedModelJson.model); 1521 if (!selectedModelJson.manufacturer) { 1522 self.yearDropDown.prop("disabled", true); 1523 self.modelDropDown.prop("disabled", true); 1524 } 1525 else if (!selectedModelJson.year) { 1526 self.modelDropDown.prop("disabled", true); 1527 } 1528 return $.Deferred().resolve().promise(); 1529 }); 1530 } 1531 function initCategoryDropDownEventHandler() { 1532 self.categoryDropDown.change(function () { 1533 self.modelDropDown.val(""); 1534 self.modelDropDown.prop('disabled', true); 1535 self.yearDropDown.val(""); 1536 self.yearDropDown.prop('disabled', true); 1537 self.manufacturerDropDown.val(""); 1538 var selectedCategory = self.categoryDropDown.val(); 1539 if (selectedCategory === '') { 1540 setSelectedModelData(null, null, null, null); 1541 self.manufacturerDropDown.prop('disabled', true); 1542 return; 1543 } 1544 populateManufacturerDropdown(selectedCategory); 1545 }); 1546 } 1547 function initManufacturerDropdOwnEventHandler() { 1548 self.manufacturerDropDown.change(function () { 1549 var selectedCategory = self.categoryDropDown.val(); 1550 var selectedManufacturer = self.manufacturerDropDown.val(); 1551 self.modelDropDown.val(""); 1552 self.modelDropDown.prop('disabled', true); 1553 self.yearDropDown.val(""); 1554 if (selectedManufacturer === '') { 1555 setSelectedModelData(selectedCategory, null, null, null); 1556 self.yearDropDown.prop('disabled', true); 1557 return; 1558 } 1559 setSelectedModelData(selectedCategory, selectedManufacturer, null, null); 1560 populateYearAndMaybeLoadModel(selectedCategory, selectedManufacturer, null, true); 1561 }); 1562 } 1563 function initYearDropDownEventHandler() { 1564 self.yearDropDown.change(function () { 1565 var selectedCategory = self.categoryDropDown.val(); 1566 var selectedManufacturer = self.manufacturerDropDown.val(); 1567 var selectedYear = self.yearDropDown.val(); 1568 if (selectedYear === '') { 1569 setSelectedModelData(selectedCategory, selectedManufacturer, null, null); 1570 self.modelDropDown.val(""); 1571 self.modelDropDown.prop('disabled', true); 1572 return; 1573 } 1574 setSelectedModelData(selectedCategory, selectedManufacturer, selectedYear, null); 1575 populateModelDropdown(selectedCategory, selectedManufacturer, selectedYear); 1576 }); 1577 } 1578 function initModelDropDownEventHandler() { 1579 self.modelDropDown.change(function () { 1580 var model = self.modelDropDown.val(); 1581 if (!model) { 1582 model = null; 1583 } 1584 setSelectedModelData(self.categoryDropDown.val(), self.manufacturerDropDown.val(), self.yearDropDown.val(), model); 1585 }); 1586 } 1587 function showModal(title, message) { 1588 var dialogHtml = '<div class="modal fade in" role="dialog" aria-hidden="true"><div class="modal-dialog modal-m"><div class="modal-content">'; 1589 dialogHtml += '<div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title">' + title + '</h4></div>'; 1590 dialogHtml += '<div class="modal-body">' + message + '</div>'; 1591 dialogHtml += '<div class="modal-footer" style="text-align:left;"><button type="button" class="btn btn-primary" data-dismiss="modal">OK</button></div>'; 1592 dialogHtml += '</div></div></div>'; 1593 var $dialog = $(dialogHtml); 1594 $dialog.modal("show"); 1595 $dialog.on("hidden.bs.modal", function (e) { 1596 $(e.currentTarget).remove(); 1597 }); 1598 } 1599 function showRecaptionSessionExpiredModel() { 1600 showModal("Session expired", "Please verify recaptcha to renew your session."); 1601 } 1602 function setReCaptchaTimeout() { 1603 var wrappers = container.find('.recaptcha-wrapper'); 1604 var $wrapper = $(wrappers[0]); 1605 $wrapper.closest(".form-group").find(".error-message").hide(); 1606 self.timeoutId = setTimeout(function () { 1607 grecaptcha.reset(self.widgetId); 1608 showRecaptionSessionExpiredModel(); 1609 }, reCaptchaTimeout); 1610 } 1611 function clearReCaptchaTimeout() { 1612 if (self.timeoutId !== undefined) { 1613 clearTimeout(self.timeoutId); 1614 self.timeoutId = undefined; 1615 } 1616 } 1617 function clearReCaptcha() { 1618 grecaptcha.reset(self.widgetId); 1619 clearReCaptchaTimeout(); 1620 } 1621 self.clearReCaptcha = clearReCaptcha; 1622 function checkReCaptcha() { 1623 var recaptchaResponse = grecaptcha.getResponse(container.find(".recaptcha-wrapper").attr("widget-id")); 1624 var errorMessageCtrl = container.find(".recaptcha-section.form-group").find('.error-message'); 1625 if (recaptchaResponse.length === 0) {
1626 errorMessageCtrl.show(); 1627 errorMessageCtrl.css('display', 'inline'); 1628 return false; 1629 } 1630 errorMessageCtrl.hide(); 1631 return true; 1632 } 1633 function resetFormAfterSubmitSuccess() { 1634 clearReCaptcha(); 1635 setSubmitButtonState(false); 1636 exports.ViewFormUtil.clearForm(self.clientId); 1637 } 1638 function handleErrorSubmitForm(button, isInvalidRecaptcha) { 1639 if (isInvalidRecaptcha) { 1640 showRecaptionSessionExpiredModel(); 1641 } 1642 else { 1643 alert("Sorry there was an error submitting your form."); 1644 } 1645 grecaptcha.reset(self.widgetId); 1646 setSubmitButtonState(false); 1647 } 1648 function handleShiftDigitalAnalyticsFormSubmissionError(opts, formName, errorThrown) { 1649 if (shiftDigitalAnalyticsManager_1.default === null || shiftDigitalAnalyticsManager_1.default === void 0 ? void 0 : shiftDigitalAnalyticsManager_1.default.isActivated()) { 1650 var $form = $("#" + self.clientId); 1651 var formEventData = { 1652 formName: formName, 1653 shiftDigitalAnalyticsVehicleData: opts.shiftDigitalAnalyticsVehicleData, 1654 errorMessage: errorThrown 1655 }; 1656 shiftDigitalAnalyticsManager_1.default.instance().sendFormSubmissionErrorEvent($form, formEventData); 1657 } 1658 } 1659 function hasShiftDigitalAnalyticsCookie() { 1660 var cookieName = "dx1dnn_sd"; 1661 var value = getCookie(cookieName); 1662 if (value === "") { 1663 return false; 1664 } 1665 try { 1666 var obj = JSON.parse(value); 1667 if (obj.CampaignName || obj.CampaignType) { 1668 return true; 1669 } 1670 return false; 1671 } 1672 catch (_a) { 1673 return false; 1674 } 1675 } 1676 function getShiftDigitalAnalyticsCookie(key) { 1677 var cookieName = "dx1dnn_sd"; 1678 var coookieValue = getCookie(cookieName); 1679 var json = JSON.parse(coookieValue); 1680 var value = json[key]; 1681 return value ? decodeURIComponent(value) : null; 1682 } 1683 function getShiftDigitalAnalyticsCampaignName() { 1684 return getShiftDigitalAnalyticsCookie("CampaignName"); 1685 } 1686 function getShiftDigitalAnalyticsCampaignType() { 1687 return getShiftDigitalAnalyticsCookie("CampaignType"); 1688 } 1689 function getDisclaimerFromConsentCheckbox(consentCheckboxSection) { 1690 if (consentCheckboxSection) { 1691 var disclaimer = consentCheckboxSection.find(".dx1-consent-label").html(); 1692 return disclaimer; 1693 } 1694 return null; 1695 } 1696 function getCustomDisclaimerText(customDisclaimerSection) { 1697 if (customDisclaimerSection) { 1698 var disclaimer = customDisclaimerSection.find(".dx1-disclaimer-label").text(); 1699 return disclaimer; 1700 } 1701 return null; 1702 } 1703 function getFormData(opts) { 1704 var data = exports.ViewFormUtil.buildFormJsonRequestMessage(self.clientId, opts); 1705 if (opts.productId && opts.productId !== guidEmpty) { 1706 data.ProductId = opts.productId; 1707 data.CurrentPrice = opts.currentPrice; 1708 } 1709 if (opts.dealershipId && opts.dealershipId !== guidEmpty) { 1710 data.DealershipId = opts.dealershipId; 1711 } 1712 data.SiteId = opts.siteId; 1713 data.BrandIntegrityTemplateSiteId = opts.brandIntegrityTemplateSiteId; 1714 data.TabModuleId = opts.tabModuleId; 1715 data.FormId = opts.formId; 1716 data.SessionId = window["sd"] ? opts.sessionId : null; 1717 if (hasShiftDigitalAnalyticsCookie()) { 1718 data.CampaignName = getShiftDigitalAnalyticsCampaignName(); 1719 data.CampaignType = getShiftDigitalAnalyticsCampaignType(); 1720 } 1721 var $isCcpaSection = container.find(selectors.isCcpaSection); 1722 if ($isCcpaSection) { 1723 data.CcpaDisclaimer = getDisclaimerFromConsentCheckbox($isCcpaSection); 1724 } 1725 var $isTcpaSection = container.find(selectors.isTcpaSection); 1726 if ($isTcpaSection) { 1727 data.TcpaDisclaimer = getDisclaimerFromConsentCheckbox($isTcpaSection); 1728 } 1729 var disclaimers = []; 1730 container.find(selectors.disclaimerCheckboxSection).each(function (index, element) { 1731 var disclaimerText = getCustomDisclaimerText($(element)); 1732 if (disclaimerText) { 1733 disclaimers.push(disclaimerText); 1734 } 1735 }); 1736 if (disclaimers.length > 0) { 1737 data.Disclaimers = disclaimers.join("; "); 1738 } 1739 if (opts && opts.forceSendLeadToThirdParty) { 1740 data.forceSendLeadToThirdParty = options.forceSendLeadToThirdParty; 1741 } 1742 return data; 1743 } 1744 function sendGoogleAnalyticForFormSubmission() { 1745 if (!window.ga || !$.isFunction(ga)) { 1746 return; 1747 } 1748 var trackers = ga.getAll(); 1749 if (!$.isArray(trackers)) { 1750 return; 1751 } 1752 var tracker = trackers[0]; 1753 if (!tracker) { 1754 return; 1755 } 1756 tracker.send('pageview', '/Submission-Confirmation'); 1757 }
1758 function checkPaidExisting() { 1759 var dx1SemName = "Dx1Sem"; 1760 var value = getCookie(dx1SemName); 1761 if (value === "") { 1762 return false; 1763 } 1764 var obj = JSON.parse(value); 1765 return Boolean.parse(obj.IsDx1Sem); 1766 } 1767 function getCookie(cookieName) { 1768 var name = cookieName + "="; 1769 var allCookies = document.cookie.split(';'); 1770 var cVal = []; 1771 for (var i = 0; i < allCookies.length; i++) { 1772 if (allCookies[i].trim().indexOf(name) === 0) { 1773 cVal = allCookies[i].trim().split("="); 1774 } 1775 } 1776 return cVal.length <= 0 ? "" : decodeURIComponent(cVal[1]); 1777 } 1778 function submitForm() { 1779 var deferred = $.Deferred(); 1780 var opts = self.options; 1781 var button = self.submitButton; 1782 setSubmitButtonState(true); 1783 var submitResponseContext = {}; 1784 var recaptchaResponse = grecaptcha.getResponse(self.widgetId); 1785 var formData = getFormData(opts); 1786 var formName = formData.FormName; 1787 var utm_campaign = ""; 1788 var isSemFromCookie = checkPaidExisting(); 1789 if (isSemFromCookie) { 1790 var value = getCookie("Dx1Sem"); 1791 if (value !== "") { 1792 utm_campaign = JSON.parse(value).utm_campaign; 1793 } 1794 } 1795 var requestData = { 1796 isDx1Sem: isSemFromCookie, 1797 utm_Campaign: utm_campaign, 1798 formData: formData, 1799 relativeUrl: $("#" + self.clientId).find("[data-form-relative-url]").attr("data-form-relative-url"), 1800 reCaptchaResponse: recaptchaResponse, 1801 reCaptchaEnabled: true, 1802 clientId: self.clientId 1803 }; 1804 var relativeUrl = requestData.relativeUrl; 1805 var submitUrl = sf.getServiceRoot('Dominion/Forms') + 'Forms/SubmitForm?formId=' + opts.formId; 1806 additionalRequestData(requestData, opts); 1807 if (window.brpAnalyticHelper) { 1808 // UCS144 - Submit Contact Form (get offer) 1809 window.brpAnalyticHelper.sendAnalyticsEvent("userAction", { 1810 "category": "form submit", 1811 "action": "Get Offer", 1812 "label": "from smartsite", 1813 "form_option": window.brpAnalyticHelper.selectItem.ProductName, 1814 "product_status": window.brpAnalyticHelper.selectItem.Condition 1815 }); 1816 } 1817 var requestJson = JSON.stringify(requestData); 1818 $.ajax({
1819 type: "POST", 1820 url: submitUrl, 1821 data: requestJson, 1822 crossDomain: true, 1823 dataType: "json", 1824 beforeSend: sf.setModuleHeaders, 1825 complete: function (jqXhr, textStatus) { 1826 var _a; 1827 logMissingRequiredFieldsAfterSubmit(formData, __assign({ ajaxStatusCode: (_a = jqXhr === null || jqXhr === void 0 ? void 0 : jqXhr.status) !== null && _a !== void 0 ? _a : null, ajaxTextStatus: textStatus, ajaxSucceeded: textStatus === "success" }, submitResponseContext)); 1828 }, 1829 error: function (jqXhr, textStatus, errorThrown) { 1830 submitResponseContext = { 1831 responseSuccess: false, 1832 responseMessage: null, 1833 transactionId: null, 1834 errorThrown: errorThrown || null, 1835 isInvalidRecaptcha: false 1836 }; 1837 console.warn(textStatus, errorThrown, jqXhr); 1838 handleErrorSubmitForm(button, null); 1839 handleShiftDigitalAnalyticsFormSubmissionError(opts, formName, errorThrown); 1840 deferred.reject(); 1841 }, 1842 success: function (response) { 1843 var _a, _b, _c, _d; 1844 submitResponseContext = { 1845 responseSuccess: (_a = response === null || response === void 0 ? void 0 : response.Success) !== null && _a !== void 0 ? _a : null, 1846 responseMessage: (_b = response === null || response === void 0 ? void 0 : response.Message) !== null && _b !== void 0 ? _b : null, 1847 transactionId: (_c = response === null || response === void 0 ? void 0 : response.TransactionId) !== null && _c !== void 0 ? _c : null, 1848 isInvalidRecaptcha: (_d = response === null || response === void 0 ? void 0 : response.IsInvalidRecaptcha) !== null && _d !== void 0 ? _d : null 1849 }; 1850 if (!response.Success) { 1851 handleErrorSubmitForm(button, response.IsInvalidRecaptcha); 1852 handleShiftDigitalAnalyticsFormSubmissionError(opts, formName); 1853 return; 1854 } 1855 var submissionSuccessFunc = function () { 1856 // Invoke onBeforeRedirect callback if provided (e.g., to close modal before redirect) 1857 if (opts.onBeforeRedirect && typeof opts.onBeforeRedirect === 'function') { 1858 opts.onBeforeRedirect(); 1859 } 1860 sendFormSubmissionEventToBrpAnalytics(formName, opts); 1861 var submissionId = saveFormPrepopulateData(formName, formData); 1862 if (opts.finalUrl) { 1863 var productId = formData.ProductId; 1864 sendPolarisDigitasSubmitEvent(response.TransactionId); 1865 redirectToSubmissionConfirmationPage(opts.finalUrl, productId, opts.tabModuleId, formName, submissionId, opts.secondaryActionsDisabled); 1866 } 1867 else if (opts.finalMessage) { 1868 sendGoogleAnalyticForFormSubmission(); 1869 sendPolarisDigitasEvents(response.TransactionId); 1870 var options_1 = { 1871 portalId: opts.portalId, 1872 moduleId: opts.moduleId, 1873 tabModuleId: opts.tabModuleId, 1874 productId: opts.productId, 1875 displayMessage: response.Message ? response.Message : opts.finalMessage, 1876 formName: formName, 1877 modalId: "", 1878 prevSubmissionId: submissionId, 1879 secondaryActionsDisabled: opts.secondaryActionsDisabled, 1880 }; 1881 var view = new SubmissionCompleteDialog_1.SubmissionCompleteView("#".concat(clientId), options_1); 1882 view.displaySubmissionCompletionModal(); 1883 resetFormAfterSubmitSuccess(); 1884 } 1885 deferred.resolve(); 1886 }; 1887 if (shiftDigitalAnalyticsManager_1.default === null || shiftDigitalAnalyticsManager_1.default === void 0 ? void 0 : shiftDigitalAnalyticsManager_1.default.isActivated()) { 1888 var shiftDigitalAnalyticsVehicleData = opts.shiftDigitalAnalyticsVehicleData; 1889 if (shiftDigitalAnalyticsVehicleData == null && relativeUrl.toLowerCase().indexOf('postfinanceapplicationlead') > -1) { 1890 shiftDigitalAnalyticsVehicleData = response.ShiftDigitalAnalyticsVehicleData; 1891 } 1892 var $form = $("#" + self.clientId); 1893 var formEventData = { 1894 formName: formName, 1895 shiftDigitalAnalyticsVehicleData: shiftDigitalAnalyticsVehicleData, 1896 leadTransactionId: response.TransactionId, 1897 }; 1898 shiftDigitalAnalyticsManager_1.default.instance().sendFormSubmissionEvent($form, formEventData).then(function () { 1899 submissionSuccessFunc(); 1900 }); 1901 } 1902 else { 1903 submissionSuccessFunc(); 1904 } 1905 } 1906 }); 1907 return deferred.promise(); 1908 } 1909 function additionalRequestData(requestData, options) { 1910 if (options && options.isFromFeatured) { 1911 requestData.isFromFeatured = true; 1912 } 1913 } 1914 function isSentWithSecondaryAction(formName) { 1915 var formList = [ 1916 "request more information", 1917 "schedule a test drive",
1918 "quick request more information" 1919 ]; 1920 var findFormName = formName.toLowerCase(); 1921 var index = formList.findIndex(function (e) { return e === findFormName; }); 1922 return index > -1; 1923 } 1924 function redirectToSubmissionConfirmationPage(url, productId, tabModuleId, formName, submissionId, secondaryActionsDisabled) { 1925 var redirectUrl = url; 1926 if (!secondaryActionsDisabled 1927 && productId 1928 && redirectUrl.indexOf(window.location.host) > -1) { 1929 redirectUrl = "".concat(redirectUrl, "/UnitId/").concat(productId); 1930 if (isSentWithSecondaryAction(formName)) { 1931 if (submissionId) { 1932 redirectUrl = "".concat(redirectUrl, "/PrevSubmissionId/").concat(submissionId); 1933 } 1934 if (tabModuleId !== undefined && tabModuleId !== null) { 1935 redirectUrl = "".concat(redirectUrl, "/tabModuleId/").concat(tabModuleId); 1936 } 1937 if (formName) { 1938 redirectUrl = "".concat(redirectUrl, "/reqFormName/").concat(formName); 1939 } 1940 } 1941 } 1942 window.location = redirectUrl; 1943 } 1944 function sendPolarisDigitasEvents(leadTransactionId) { 1945 if (!(polarisDigitasManager_1.default === null || polarisDigitasManager_1.default === void 0 ? void 0 : polarisDigitasManager_1.default.isActivated())) { 1946 return; 1947 } 1948 sendPolarisDigitasThankyouPageEvent(); 1949 sendPolarisDigitasSubmitEvent(leadTransactionId); 1950 } 1951 function sendPolarisDigitasThankyouPageEvent() { 1952 if (!(polarisDigitasManager_1.default === null || polarisDigitasManager_1.default === void 0 ? void 0 : polarisDigitasManager_1.default.isActivated())) { 1953 return; 1954 } 1955 var opts = self.options; 1956 if (!opts.isPolarisOrv) { 1957 return; 1958 } 1959 polarisDigitasManager_1.default.instance().sendThankyouPageEvent(opts.modelDisplayName); 1960 } 1961 function sendPolarisDigitasSubmitEvent(leadTransactionId) { 1962 if (!(polarisDigitasManager_1.default === null || polarisDigitasManager_1.default === void 0 ? void 0 : polarisDigitasManager_1.default.isActivated())) { 1963 return; 1964 } 1965 var clientId = self.clientId; 1966 var options = self.options; 1967 if (!options.isPolarisOrIndianVendor && !exports.ViewFormUtil.hasProductIdValue(clientId)) { 1968 return; 1969 } 1970 var data = getPolarisDigitasSubmitEventData(leadTransactionId, options.formTitle); 1971 if (data) { 1972 polarisDigitasManager_1.default.instance().sendFormSubmitEvent(data); 1973 } 1974 } 1975 function getPolarisDigitasSubmitEventData(leadTransactionId, formTitle) { 1976 var options = self.options; 1977 if (options.isPolarisOrIndianVendor) { 1978 return { 1979 leadTransactionId: leadTransactionId, 1980 isInventory: options.isInventory, 1981 manufacturerName: options.manufacturer, 1982 category: options.category, 1983 type: options.type, 1984 formTitle: formTitle 1985 }; 1986 } 1987 else { 1988 var productData = exports.ViewFormUtil.getSelectedProductData(clientId); 1989 if (!productData) { 1990 return null; 1991 } 1992 return { 1993 leadTransactionId: leadTransactionId, 1994 isInventory: options.isInventory, 1995 manufacturerName: productData.manufacturerName, 1996 category: productData.categoryName, 1997 type: productData.productTypeName, 1998 formTitle: formTitle 1999 }; 2000 } 2001 } 2002 function saveFormPrepopulateData(formName, formData) { 2003 if (!isSentWithSecondaryAction(formName)) { 2004 return; 2005 } 2006 var data = { 2007 firstName: formData.FirstName, 2008 lastName: formData.LastName, 2009 email: formData.Email, 2010 phone: formData.Phone, 2011 zipCode: formData.ZipCode,
2012 }; 2013 return formPrepopulate.saveFormData(data); 2014 } 2015 function getValidationControl(selector) { 2016 var $container = $(selector); 2017 var $control = $container.find(".form-control").first(); 2018 // finding Rating 2019 if (!$control.length && $container.find(".dx1-rating").length > 0) { 2020 $control = $container.find(".dx1-rating").find(":button"); 2021 // making input more identity. 2022 if (!$control[0].name) { 2023 $control[0].name = $container.find(".dx1-rating")[0].id; 2024 } 2025 } 2026 // finding Multi Choice 2027 var $multiChoice = $container.find(".multi-choice"); 2028 if (!$control.length && $multiChoice.length > 0) { 2029 $control = $multiChoice.find(":checkbox, :radio"); 2030 } 2031 if ($container.data("question-mapped-key-name") === "ProductId") { 2032 $control = $container.find(".form-control.model-dropdown-control").first(); 2033 } 2034 // finding Consent Checkbox 2035 if (!$control.length && $container.find(selectors.consentCheckboxSection).length > 0) { 2036 $control = $container.find(selectors.consentCheckboxSection).find(":checkbox"); 2037 } 2038 // finding Disclaimer Checkbox 2039 if (!$control.length && $container.find(selectors.disclaimerCheckboxSection).length > 0) { 2040 $control = $container.find(selectors.disclaimerCheckboxSection).find(":checkbox"); 2041 } 2042 return $control; 2043 } 2044 function getFormGroup($element) { 2045 var selector = ".form-group"; 2046 if ($element.is(selector)) { 2047 return $element; 2048 } 2049 return $element.closest(selector); 2050 } 2051 function validate(buttonElement) { 2052 var $validationRules = container.find("[data-question-validation-rules]"); 2053 if ($validationRules && $validationRules.length) { 2054 var isValidForm = true; 2055 var $invalidControl; 2056 var invalidMessages_1 = []; 2057 $validationRules.each(function (index, element) { 2058 var $control = getValidationControl(element); 2059 if (!$control || !$control.length) { 2060 return; 2061 } 2062 if ($control && $control.length && !$control.valid() && isValidForm) { 2063 isValidForm = false; 2064 $invalidControl = $control; 2065 } 2066 var $element = $(element); 2067 var $formGroup = getFormGroup($element); 2068 var invalidMessage = $formGroup.find(".error-text").text(); 2069 if (invalidMessage) { 2070 invalidMessages_1.push(invalidMessage); 2071 } 2072 }); 2073 var errorMsg = invalidMessages_1.join(","); 2074 if (errorMsg != '') { 2075 var opts = self.options; 2076 var formData = getFormData(opts); 2077 var formName = formData.FormName; 2078 handleShiftDigitalAnalyticsFormSubmissionError(opts, formName, errorMsg); 2079 } 2080 if (!isValidForm) { 2081 $invalidControl.focus(); 2082 return $.Deferred().reject().promise(); 2083 } 2084 } 2085 self.button = $(buttonElement); 2086 if (self.options.reCaptchaType === "invisible") { 2087 grecaptcha.execute(self.widgetId); 2088 } 2089 else { 2090 if (checkReCaptcha()) { 2091 clearReCaptchaTimeout(); 2092 return submitForm(); 2093 } 2094 } 2095 return $.Deferred().reject().promise(); 2096 } 2097 function moveSubmitButtonToDialogFooterIfShowOnDialog() { 2098 var newSubmitButton; 2099 var modalFooter = container.find(".modal-footer"); 2100 if (modalFooter.get(0)) { 2101 var originalSubmitButton = container.find(".em-view-form-wrap").find('.submit-button'); 2102 newSubmitButton = originalSubmitButton.clone(); 2103 modalFooter.find("input[type=submit]").remove(); 2104 originalSubmitButton.remove(); 2105 newSubmitButton[0].value = self.options.submitText; 2106 modalFooter.append(newSubmitButton); 2107 } 2108 else { 2109 newSubmitButton = container.find('.submit-button'); 2110 } 2111 return newSubmitButton; 2112 } 2113 function getFormElement() { 2114 var $form = container.find("form").first(); 2115 if (!$form || !$form.length) { 2116 $form = container.closest("form"); 2117 } 2118 return $form; 2119 } 2120 function initSubmitButton() { 2121 var newSubmitButton = moveSubmitButtonToDialogFooterIfShowOnDialog(); 2122 self.submitButton = newSubmitButton; 2123 self.submitButton.off("click"); 2124 self.submitButton.click(function () { 2125 self.submitButton.prop("disabled", true); 2126 validate(this) 2127 .fail(function () { 2128 self.submitButton.removeAttr('disabled'); 2129 }); 2130 }); 2131 self.submitButton.show(); 2132 } 2133 function setSubmitButtonState(isDisable) { 2134 // submitting data. 2135 var options = self.options; 2136 var $button = self.submitButton; 2137 if (isDisable) { 2138 if ($button.prop) { 2139 $button.prop('disabled', true); 2140 } 2141 else { 2142 $button.attr('disabled', 'disabled'); 2143 } 2144 $button.val(options.submittingText); 2145 container.addClass(options.submittingClass); 2146 } 2147 else { 2148 $button.val(options.submitText); 2149 $button.removeAttr("disabled"); 2150 } 2151 } 2152 function getValidationMessage(element) { 2153 // first try to get custom validation message from attribute "data-question-validation-error"
2154 var validationMessage = $(element).attr("data-question-validation-error"); 2155 if (validationMessage && validationMessage.length > 0) { 2156 return validationMessage; 2157 } 2158 // if custom validation message is not provided, try to find control label to generate default required validation message. 2159 // finding control label for default required validation message, the format of message is "{control label} is required." 2160 var controlLabel = $(element).find("label.question, span.question").first().text().replace("*", ""); 2161 if (controlLabel === "") { 2162 // in case, the label display type is Inside Textbox. 2163 controlLabel = $(element).find("[data-relationship-name]").attr("data-relationship-name"); 2164 } 2165 if (controlLabel) { 2166 validationMessage = "".concat(controlLabel, " is required."); 2167 return validationMessage; 2168 } 2169 if (validationMessage == undefined || validationMessage === "") { 2170 validationMessage = "This field is required."; 2171 } 2172 return validationMessage; 2173 } 2174 function initCustomValidatorMethods() { 2175 jQuery.validator.addMethod("dxRequired", function (value, element) { 2176 if ($(element).is(".form-control")) { 2177 return value && value.trim(); 2178 } 2179 if ($(element).closest(".multi-choice").length > 0) { 2180 return $(element).closest(".multi-choice").find(":checked").length > 0; 2181 } 2182 if ($(element).closest(".dx1-rating").length > 0) { 2183 return $(element).closest(".dx1-rating").find(":button").val() > "0"; 2184 } 2185 var $dx1Consent = $(element).closest(selectors.consentCheckboxSection); 2186 if ($dx1Consent.length > 0) { 2187 var checkboxCount = $dx1Consent.find("input:checkbox:visible").length; 2188 if (checkboxCount == 0) { 2189 return true; 2190 } 2191 var checkedCount = $dx1Consent.find("input:checkbox:checked:visible").length; 2192 return checkboxCount === checkedCount; 2193 } 2194 var $disclaimer = $(element).closest(selectors.disclaimerCheckboxSection); 2195 if ($disclaimer.length > 0) { 2196 var checkboxCount = $disclaimer.find("input:checkbox:visible").length; 2197 if (checkboxCount == 0) { 2198 return true; 2199 } 2200 var checkedCount = $disclaimer.find("input:checkbox:checked:visible").length; 2201 return checkboxCount === checkedCount; 2202 } 2203 return undefined; 2204 }, jQuery.validator.format("{0}")); 2205 jQuery.validator.addMethod("dxEmail", function (value) { 2206 if (!value || !value.trim()) { 2207 return true; 2208 } 2209 return /^[a-zA-Z0-9._%\-+']+@(?:[a-zA-Z0-9\-]+\.)+(?:[a-zA-Z]{2}|[Aa][Ee][Rr][Oo]|[Aa][Rr][Pp][Aa]|[Aa][Ss][Ii][Aa]|[Bb][Ii][Zz]|[Cc][Aa][Tt]|[Cc][Oo][Mm]|[Cc][Oo][Oo][Pp]|[Ee][dD][Uu]|[Gg][Oo][Vv]|[Ii][Nn][Ff][Oo]|[Ii][Nn][Tt]|[Jj][Oo][Bb][Ss]|[Mm][Ii][Ll]|[Mm][Oo][Bb][Ii]|[Mm][Uu][Ss][Ee][Uu][Mm]|[Nn][Aa][Mm][Ee]|[Nn][Ee][Tt]|[Oo][Rr][Gg]|[Pp][Rr][Oo]|[Rr][Oo][Oo][Tt]|[Tt][Ee][Ll]|[Tt][Rr][Aa][Vv][Ee][Ll]|[Cc][Yy][Mm]|[Gg][Ee][Oo]|[Pp][Oo][Ss][Tt])(?:,\\s?[a-zA-Z0-9._%\-+']+@(?:[a-zA-Z0-9\\-]+\\.)+(?:[a-zA-Z]{2}|[Aa][Ee][Rr][Oo]|[Aa][Rr][Pp][Aa]|[Aa][Ss][Ii][Aa]|[Bb][Ii][Zz]|[Cc][Aa][Tt]|[Cc][Oo][Mm]|[Cc][Oo][Oo][Pp]|[Ee][dD][Uu]|[Gg][Oo][Vv]|[Ii][Nn][Ff][Oo]|[Ii][Nn][Tt]|[Jj][Oo][Bb][Ss]|[Mm][Ii][Ll]|[Mm][Oo][Bb][Ii]|[Mm][Uu][Ss][Ee][Uu][Mm]|[Nn][Aa][Mm][Ee]|[Nn][Ee][Tt]|[Oo][Rr][Gg]|[Pp][Rr][Oo]|[Rr][Oo][Oo][Tt]|[Tt][Ee][Ll]|[Tt][Rr][Aa][Vv][Ee][Ll]|[Cc][Yy][Mm]|[Gg][Ee][Oo]|[Pp][Oo][Ss][Tt]))*$/.test(value); 2210 }, validationMessage.emailInvalidFormat); 2211 jQuery.validator.addMethod("dxPhone", function (value) { 2212 if (!value || !value.trim()) { 2213 return true; 2214 } 2215 return /^[\d+_.() \-]+$/.test(value); 2216 }, validationMessage.phoneInvalidFormat); 2217 jQuery.validator.addMethod("dxDate", function (value) { 2218 if (!value || !value.trim()) { 2219 return true; 2220 } 2221 return /^(0[1-9]|1[0-2])\/(0[1-9]|1\d|2\d|3[01])\/(19|20)\d{2}$/.test(value); 2222 }, validationMessage.dateInvalidFormat); 2223 jQuery.validator.addMethod("dxBirthdate", function (value) { 2224 if (value === null || value === '') { 2225 return true; 2226 } 2227 var today = new Date();
2228 var validDate = new Date(today.getFullYear(), 1 - 1, 1); 2229 var selectedDate = new Date(value); 2230 return selectedDate < validDate; 2231 }, validationMessage.birthdateIsInvalid); 2232 } 2233 function getJqueryValidationRules(validationRules, controlLabelText) { 2234 var mappedValidationRules = { 2235 "required": "dxRequired", 2236 "email": "dxEmail", 2237 "phone": "dxPhone", 2238 "date": "dxDate", 2239 "birthdate": "dxBirthdate" 2240 }; 2241 if (!validationRules || !validationRules.length) { 2242 return null; 2243 } 2244 var rules = {}; 2245 validationRules.forEach(function (validationRule) { 2246 var ruleName = mappedValidationRules[validationRule]; 2247 if (ruleName) { 2248 if (validationRule === "required") { 2249 rules[ruleName] = [controlLabelText]; 2250 } 2251 else { 2252 rules[ruleName] = true; 2253 } 2254 } 2255 }); 2256 return rules; 2257 } 2258 function removeDefaultValidationRules($control) { 2259 if (!$control || !$control.length || !$control.rules) { 2260 return; 2261 } 2262 var rules = $control.rules(); 2263 if (rules && rules["email"]) { 2264 $control.rules("add", { email: false }); 2265 } 2266 } 2267 function initFormValidation() { 2268 var $form = getFormElement(); 2269 $form.validate({ 2270 onsubmit: false, 2271 onkeyup: false, 2272 wrapper: "span", 2273 errorElement: "span", 2274 errorClass: "error-text", 2275 highlight: function (element, errorClass, validClass) { 2276 $(element).removeClass(errorClass).removeClass(validClass); 2277 }, 2278 unhighlight: function (element, errorClass, validClass) { 2279 $(element).removeClass(errorClass).addClass(validClass); 2280 }, 2281 errorPlacement: function ($error, $element) { 2282 $error.addClass("error-message"); 2283 if ($element.is(".form-control")) { 2284 $error.insertAfter($element); 2285 } 2286 else { 2287 if ($element.closest(".multi-choice").length > 0) { 2288 $error.insertAfter($element.closest(".multi-choice")); 2289 } 2290 if ($element.closest(".dx1-rating").length > 0) { 2291 $error.insertAfter($element.parents().eq(1)); 2292 } 2293 if ($element.closest(selectors.consentCheckboxSection).length > 0) { 2294 $error.insertAfter($element.closest(selectors.consentCheckboxSection)); 2295 } 2296 if ($element.closest(selectors.disclaimerCheckboxSection).length > 0) { 2297 $error.insertAfter($element.closest(selectors.disclaimerCheckboxSection)); 2298 } 2299 } 2300 } 2301 }); 2302 } 2303 function initValidationRules() { 2304 initCustomValidatorMethods(); 2305 initFormValidation(); 2306 var $validationRules = container.find("[data-question-validation-rules]"); 2307 if (!$validationRules || !$validationRules.length) { 2308 return; 2309 } 2310 $validationRules.each(function (index, element) { 2311 var validationRules = $(element).data("question-validation-rules"); 2312 var controlLabel = getValidationMessage(element); 2313 var $control = getValidationControl(element); 2314 if (!$control || !$control.length) { 2315 return; 2316 } 2317 var rules = getJqueryValidationRules(validationRules, controlLabel); 2318 if (!rules || !Object.keys(rules).length) { 2319 return; 2320 } 2321 removeDefaultValidationRules($control); 2322 $control.rules("add", rules); 2323 }); 2324 } 2325 function initModelDropdownControls() { 2326 var opts = self.options; 2327 if (opts.productId !== undefined && opts.productId !== '00000000-0000-0000-0000-000000000000') { 2328 self.modelControl.hide(); 2329 self.modelControl.siblings().hide(); 2330 return; 2331 } 2332 if (self.modelControl !== undefined) { 2333 initModelControlValue().always(function () { 2334 initCategoryDropDownEventHandler(); 2335 initManufacturerDropdOwnEventHandler(); 2336 initYearDropDownEventHandler(); 2337 initModelDropDownEventHandler(); 2338 }).fail(function () { 2339 if (self.categoryDropDown.val() === '') { 2340 self.manufacturerDropDown.prop('disabled', true); 2341 self.yearDropDown.prop('disabled', true); 2342 self.modelDropDown.prop('disabled', true); 2343 } 2344 }); 2345 } 2346 } 2347 function initControls() { 2348 container.find('.error-message').hide();
2349 container.find('.em-message').text(self.options.finalMessage).hide(); 2350 if (container.find(".datepicker").length > 0) { 2351 // init datepicker 2352 container.find(".datepicker").datepicker({ 2353 changeMonth: true, 2354 changeYear: true, 2355 }); 2356 // set year range for expire date 2357 var $expireDateElements = container.find(".datepicker.expiredate"); 2358 $expireDateElements.datepicker("option", "yearRange", "-80:+35"); 2359 // set mindate for birthdate 2360 var $birthdatelDatepickerElements = container.find(".datepicker.birthdate"); 2361 $birthdatelDatepickerElements.datepicker("option", "yearRange", "-100:-1"); 2362 $birthdatelDatepickerElements.datepicker("option", "defaultDate", "-1y"); 2363 // set year range for normal datepicker 2364 var $normalDatepickerElements = container.find(".datepicker.normaldate"); 2365 $normalDatepickerElements.datepicker("option", "yearRange", "-80:+10"); 2366 } 2367 // Rating 2368 container.find(".rating-star").on("click", function () { 2369 var $dx1Rating = $(this).parents(".dx1-rating"); 2370 $dx1Rating.find(".rating-star").removeClass("checked"); 2371 $(this).addClass('checked'); 2372 var submitStars = $(this).attr('data-value'); 2373 $dx1Rating.find(":button").val(submitStars); 2374 $dx1Rating.find(":button").valid(); 2375 }); 2376 self.modelControl = container.find('.model-control'); 2377 self.categoryDropDown = container.find('.category-control'); 2378 self.manufacturerDropDown = container.find('.manufacturer-control'); 2379 self.yearDropDown = container.find('.year-control'); 2380 self.modelDropDown = container.find('.model-dropdown-control'); 2381 initSubmitButton(); 2382 initValidationRules(); 2383 var opts = self.options; 2384 initModelDropdownControls(); 2385 initPreferredContact(); 2386 initDisclaimerLabelInteraction(); 2387 self.locationQuestion = container.find("[data-question-mapped-key-name='DealershipId']"); 2388 if (self.locationQuestion === undefined) { 2389 return; 2390 } 2391 if (opts.productId !== undefined && opts.productId !== '00000000-0000-0000-0000-000000000000') { 2392 self.locationQuestion.hide(); 2393 } 2394 initFormPrepopulate(); 2395 } 2396 function initJointApplication() { 2397 var jointApplication = container.find('.joint-application-wrapper'); 2398 if (!jointApplication) { 2399 return; 2400 } 2401 var checkbox = container.find(".joint-application-control"); 2402 var jointQuestion = container.find('.joint-application-question'); 2403 var jointSubmitButton = container.find('.joint-application-submit-button'); 2404 var submitButton = container.find('.submit-button'); 2405 jointQuestion.hide(); 2406 jointSubmitButton.hide(); 2407 jointApplication.on('change', function () { 2408 if (checkbox.prop("checked") === true) { 2409 jointQuestion.show(); 2410 jointSubmitButton.show(); 2411 submitButton.hide(); 2412 } 2413 else { 2414 jointQuestion.hide(); 2415 jointSubmitButton.hide(); 2416 submitButton.show(); 2417 } 2418 }); 2419 jointSubmitButton.on("click", function () { 2420 jointSubmitButton.prop("disabled", true); 2421 return validate(this) 2422 .fail(function () { 2423 jointSubmitButton.removeAttr('disabled'); 2424 }); 2425 }); 2426 } 2427 function onPreferredContactChanged(preferredContact) { 2428 var $isCcpaSection = container.find(selectors.isCcpaSection); 2429 var $isTcpaSection = container.find(selectors.isTcpaSection); 2430 var $cellPhoneSection = container.find(selectors.cellPhoneSection); 2431 switch (preferredContact.toLowerCase()) { 2432 case "email": 2433 $isCcpaSection.show(); 2434 $isTcpaSection.hide(); 2435 $cellPhoneSection.hide(); 2436 break; 2437 case "phone": 2438 case "sms": 2439 case "text": 2440 $isCcpaSection.show(); 2441 $isTcpaSection.show(); 2442 $cellPhoneSection.show(); 2443 break; 2444 default: 2445 $isCcpaSection.hide(); 2446 $isTcpaSection.hide(); 2447 $cellPhoneSection.hide(); 2448 } 2449 } 2450 function initPreferredContact() { 2451 var $preferredContactMethodSection = container.find(selectors.preferredContactSection); 2452 if ($preferredContactMethodSection.length === 0) { 2453 return; 2454 } 2455 // initial event on change. 2456 $preferredContactMethodSection.find(".multi-choice input").change(function () { 2457 var selectedPreferredContact = $(this).val().toString(); 2458 onPreferredContactChanged(selectedPreferredContact); 2459 }); 2460 // trigger event on change. 2461 var currentPreferredContact = $preferredContactMethodSection.find(".multi-choice input:checked").val(); 2462 onPreferredContactChanged(currentPreferredContact ? currentPreferredContact.toString() : ""); 2463 } 2464 function toggleDisclaimerCheckbox(disclaimerLabel) { 2465 var checkboxId = ($(disclaimerLabel).attr("data-disclaimer-checkbox-id") || "").toString(); 2466 var checkbox = checkboxId ? document.getElementById(checkboxId) : null; 2467 if (!checkbox) { 2468 return; 2469 } 2470 checkbox.checked = !checkbox.checked; 2471 $(checkbox).trigger("change"); 2472 } 2473 function initDisclaimerLabelInteraction() { 2474 var disclaimerLabelSelector = ".dx1-disclaimer.dx1-disclaimer--required .dx1-disclaimer-label[data-disclaimer-checkbox-id]"; 2475 container.off("click.disclaimerLabel"); 2476 container.on("click.disclaimerLabel", disclaimerLabelSelector, function (e) { 2477 if ($(e.target).closest("a, button, input, select, textarea, label").length > 0) { 2478 return; 2479 } 2480 toggleDisclaimerCheckbox(this); 2481 }); 2482 container.off("keydown.disclaimerLabel");
2483 container.on("keydown.disclaimerLabel", disclaimerLabelSelector, function (e) { 2484 var key = e.key; 2485 var keyCode = e.which; 2486 var isActivationKey = key === "Enter" || key === " " || keyCode === 13 || keyCode === 32; 2487 if (!isActivationKey) { 2488 return; 2489 } 2490 e.preventDefault(); 2491 toggleDisclaimerCheckbox(this); 2492 }); 2493 } 2494 function setRecaptchaAriaLabel(containerSelector, intervalId) { 2495 var textarea = $(containerSelector).find(".g-recaptcha-response"); 2496 if (textarea.length > 0) { 2497 if (!$(textarea).attr("aria-label")) { 2498 $(textarea).attr("aria-label", "Google Captcha"); 2499 } 2500 if (intervalId) { 2501 clearInterval(intervalId); 2502 } 2503 } 2504 } 2505 function initRecaptchaAriaLabel(containerSelector) { 2506 setRecaptchaAriaLabel(containerSelector, undefined); 2507 var intervalId = setInterval(function () { 2508 setRecaptchaAriaLabel(containerSelector, intervalId); 2509 }, 50); 2510 } 2511 function initInvisibleRecaptcha() { 2512 window.ReCaptchaUtil.overrideStyleForGoogleRecaptchaBadgeZIndex(); 2513 var invisibleRecaptcha = "<div id='" + self.clientId + "-invisible-recaptcha'></div>"; 2514 $(invisibleRecaptcha).insertAfter(container); 2515 self.widgetId = grecaptcha.render(self.clientId + '-invisible-recaptcha', { 2516 sitekey: self.options.reCaptchaSiteKey, 2517 callback: submitForm, 2518 size: "invisible" 2519 }); 2520 var containerSelector = "div#" + self.clientId + "-invisible-recaptcha"; 2521 initRecaptchaAriaLabel(containerSelector); 2522 } 2523 function initCheckboxRecaptcha() { 2524 var wrappers = container.find('.recaptcha-wrapper'); 2525 if (wrappers.length > 0) { 2526 var $wrapper = $(wrappers[0]); 2527 if ($wrapper.attr("widget-id")) { 2528 // already init 2529 return; 2530 } 2531 self.widgetId = grecaptcha.render($wrapper.prop("id"), { 2532 sitekey: self.options.reCaptchaSiteKey, 2533 callback: setReCaptchaTimeout 2534 }); 2535 $wrapper.attr("widget-id", self.widgetId); 2536 var containerSelector = ".recaptcha-wrapper[widget-id='" + self.widgetId + "']"; 2537 initRecaptchaAriaLabel(containerSelector); 2538 } 2539 } 2540 function initReCaptcha() { 2541 if (self.options.reCaptchaType === "invisible") { 2542 initInvisibleRecaptcha(); 2543 return; 2544 } 2545 initCheckboxRecaptcha(); 2546 } 2547 function getBrpActionByFormName(formName) { 2548 switch (formName) { 2549 case 'Quick Request More Information': 2550 case 'Request More Information': 2551 case 'Price on Request': 2552 case 'Price Alert': 2553 case 'Model Wanted': 2554 return 'get_a_quote|regular'; 2555 case 'Schedule a Test Drive': 2556 return 'dealer_demo_std'; 2557 case 'Quick Secure Finance Application': 2558 case 'Secure Finance Application': 2559 return 'financing'; 2560 case 'Contact Us': 2561 return 'contact us'; 2562 case 'Free Trade-In Evaluation': 2563 return 'get_a_quote|trade-in'; 2564 default: 2565 return false; 2566 } 2567 } 2568 function isProductEmpty(productId) { 2569 return productId == undefined || productId == guidEmpty; 2570 } 2571 function sendFormSubmissionEventToBrpAnalytics(formName, opts) { 2572 var action = getBrpActionByFormName(formName); 2573 if (!window.brpDataLayer || 2574 !window.brpAnalyticData || 2575 !action || 2576 (!isProductEmpty(opts.productId) && !opts.isBrpBrand)) { 2577 return; 2578 } 2579 var data = { 2580 "event": "userAction", 2581 "page": { 2582 "siteType": "dealer marketing", 2583 "vendor": "dx1" 2584 }, 2585 "interaction": { 2586 "category": 'form submit', 2587 "action": action, 2588 "label": "from dealer" 2589 }, 2590 "dealer": window.brpAnalyticData.dealer, 2591 "brand": { 2592 "brandName": opts.brpBrand.toLowerCase() 2593 } 2594 }; 2595 window.brpDataLayer.push(data); 2596 } 2597 function isFormRequireSendToBrpAnalytic(formName) { 2598 switch (formName) { 2599 case "Secure Finance Application": 2600 case "Contact Us": 2601 case "Parts Request": 2602 case "Service Request": 2603 case "Model Wanted": 2604 case "Free Trade-In Evaluation": 2605 case "VIN Checking Service": 2606 case "Quick Secure Finance Application": 2607 return true; 2608 } 2609 return false; 2610 } 2611 function hasBrpPageviewSubmitted() { 2612 return window.brpDataLayer.find(function (p) { return p.event == "PV"; });
2613 } 2614 function initPageViewEventToBrpAnalytics() { 2615 var formName = exports.ViewFormUtil.getFormName(self.clientId); 2616 var requireForm = isFormRequireSendToBrpAnalytic(formName); 2617 var data = window.brpAnalyticData; 2618 if (!window.brpDataLayer || 2619 !window.brpAnalyticData || 2620 !requireForm || 2621 data.page.pageType != "" || 2622 hasBrpPageviewSubmitted()) { 2623 return; 2624 } 2625 window.brpDataLayer.push(data); 2626 } 2627 function initFormPrepopulate() { 2628 var prevSubmissionId = self.options.prevSubmissionId; 2629 var data = formPrepopulate.getFormData(prevSubmissionId); 2630 if (data) { 2631 var $form = container.find("form").first(); 2632 setInputValue("FirstName", data.firstName); 2633 setInputValue("LastName", data.lastName); 2634 setInputValue("Email", data.email); 2635 setInputValue("Phone", data.phone); 2636 setInputValue("ZipCode", data.zipCode); 2637 } 2638 } 2639 function setInputValue(propertyName, value) { 2640 var $control = container.find("[data-question-mapped-key-name=\"".concat(propertyName, "\"] > :input")); 2641 if ($control && $control.length) { 2642 $control.val(value); 2643 } 2644 } 2645 initControls(); 2646 initJointApplication(); 2647 initReCaptcha(); 2648 if ((shiftDigitalAnalyticsManager_1.default === null || shiftDigitalAnalyticsManager_1.default === void 0 ? void 0 : shiftDigitalAnalyticsManager_1.default.isActivated()) 2649 && self.options 2650 && !self.options.isSendShiftDigitalAnalyticsFormSubmissionEventOnly) { 2651 var $root = $("#" + self.clientId); 2652 var formEventData = { 2653 formName: exports.ViewFormUtil.getFormName(self.clientId), 2654 shiftDigitalAnalyticsVehicleData: self.options.shiftDigitalAnalyticsVehicleData, 2655 }; 2656 shiftDigitalAnalyticsManager_1.default.instance().sendFormShownEvent($root, formEventData); 2657 shiftDigitalAnalyticsManager_1.default.instance().initFormInitiationEventHandler($root, formEventData); 2658 } 2659 initPageViewEventToBrpAnalytics(); 2660 self.updateOptions = function (options) { 2661 self.options = $.extend({ 2662 submitText: 'Submit', 2663 submittingText: 'Submitting...', 2664 submittingClass: 'submitting', 2665 validationGroup: '', 2666 moduleId: null, 2667 tabModuleId: null 2668 }, options); 2669 initModelDropdownControls(); 2670 }; 2671 return self; 2672} 2673exports.Dx1ViewForm = Dx1ViewForm; 2674 2675 2676/***/ }), 2677 2678/***/ 457: 2679/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 2680 2681 2682var __importDefault = (this && this.__importDefault) || function (mod) { 2683 return (mod && mod.__esModule) ? mod : { "default": mod }; 2684}; 2685Object.defineProperty(exports, "__esModule", ({ value: true })); 2686exports.PopupService = void 0; 2687var PopupDisplayMemoryInteractor_1 = __importDefault(__webpack_require__(546)); 2688var FormDialogV2_1 = __webpack_require__(98); 2689/** 2690 * Service to manage popup display lifecycle 2691 * Encapsulates FormDialogV2 usage and integrates with popup display memory 2692 */ 2693var PopupService = /** @class */ (function () { 2694 function PopupService() { 2695 } 2696 /** 2697 * Display a popup if it hasn't been shown before in this session 2698 * @param options - Configuration options for the popup 2699 * @param popupId - Unique identifier for the popup (used for memory tracking) 2700 * @param isOnExitPopup - Optional flag indicating this is an onExit popup (default: false) 2701 * @returns true if popup was displayed, false if already displayed 2702 */ 2703 PopupService.displayPopupIfNew = function (options, popupId, isOnExitPopup) { 2704 if (isOnExitPopup === void 0) { isOnExitPopup = false; } 2705 var popupInteractor = PopupDisplayMemoryInteractor_1.default.getInstance(); 2706 // Check if popup has already been displayed 2707 if (popupInteractor.hasDisplayed(popupId)) { 2708 return false; 2709 } 2710 // Set up callback to mark as displayed when modal closes 2711 options.onPopupDismissed = function () { 2712 popupInteractor.markDisplayed(popupId); 2713 // Clear onExit modal flag when modal closes 2714 if (isOnExitPopup) { 2715 PopupService.isOnExitModalOpen = false; 2716 } 2717 }; 2718 // Set onExit modal flag when displaying an onExit popup 2719 if (isOnExitPopup) { 2720 PopupService.isOnExitModalOpen = true; 2721 } 2722 // Display the popup 2723 this.displayPopup(options); 2724 return true; 2725 }; 2726 /**
2727 * Display a popup regardless of display memory 2728 * @param options - Configuration options for the popup 2729 */ 2730 PopupService.displayPopup = function (options) { 2731 try { 2732 // Completely remove existing modal element from the DOM if it exists 2733 if (options.modalId) { 2734 var existingModal = window.$('#' + options.modalId); 2735 if (existingModal.length > 0) { 2736 existingModal.remove(); 2737 } 2738 } 2739 var dialog = new FormDialogV2_1.FormDialogV2(); 2740 dialog.addDialogContent(options); 2741 dialog.displayDialog(options); 2742 } 2743 catch (error) { 2744 console.error('Error displaying popup:', error); 2745 } 2746 }; 2747 PopupService.registerOnExitEvent = function (options, popupId) { 2748 var _this = this; 2749 try { 2750 // Wrap event registration inside setTimeout 2751 this.onExitEventTimeoutId = setTimeout(function () { 2752 $(document).on("mouseleave", function () { 2753 // Skip if an onExit modal is already open 2754 if (PopupService.isOnExitModalOpen) { 2755 return; 2756 } 2757 _this.displayPopupIfNew(options, popupId, true); 2758 }); 2759 _this.onExitEventTimeoutId = null; 2760 }, 0); 2761 } 2762 catch (error) { 2763 console.error('Error registering OnExit event:', error); 2764 } 2765 }; 2766 /** 2767 * Flag to track if an onExit modal is currently open 2768 * Prevents multiple simultaneous onExit modal displays 2769 */ 2770 PopupService.isOnExitModalOpen = false; 2771 /** 2772 * Register OnExit popup event handler 2773 * Triggers popup display on document mouseleave with 1 second delay 2774 * Prevents multiple simultaneous onExit modals from displaying 2775 * @param options - Configuration options for the popup 2776 * @param popupId - Unique identifier for the popup 2777 */ 2778 PopupService.onExitEventTimeoutId = null; 2779 return PopupService; 2780}()); 2781exports.PopupService = PopupService; 2782 2783 2784/***/ }), 2785 2786/***/ 134: 2787/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 2788 2789 2790var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 2791 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 2792 return new (P || (P = Promise))(function (resolve, reject) { 2793 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 2794 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 2795 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 2796 step((generator = generator.apply(thisArg, _arguments || [])).next()); 2797 }); 2798}; 2799var __generator = (this && this.__generator) || function (thisArg, body) { 2800 var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; 2801 return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; 2802 function verb(n) { return function (v) { return step([n, v]); }; } 2803 function step(op) { 2804 if (f) throw new TypeError("Generator is already executing."); 2805 while (g && (g = 0, op[0] && (_ = 0)), _) try { 2806 if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; 2807 if (y = 0, t) op = [op[0] & 2, t.value]; 2808 switch (op[0]) { 2809 case 0: case 1: t = op; break; 2810 case 4: _.label++; return { value: op[1], done: false }; 2811 case 5: _.label++; y = op[1]; op = [0]; continue; 2812 case 7: op = _.ops.pop(); _.trys.pop(); continue; 2813 default: 2814 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } 2815 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } 2816 if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } 2817 if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } 2818 if (t[2]) _.ops.pop(); 2819 _.trys.pop(); continue; 2820 } 2821 op = body.call(thisArg, _); 2822 } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } 2823 if (op[0] & 5) throw op[1];
2823 return { value: op[0] ? op[1] : void 0, done: true }; 2824 } 2825}; 2826Object.defineProperty(exports, "__esModule", ({ value: true })); 2827exports.ButtonActions = void 0; 2828var SecondaryActionsApi_1 = __webpack_require__(642); 2829var ButtonActions = /** @class */ (function () { 2830 function ButtonActions(portalId, moduleId) { 2831 this.formList = [ 2832 "request more information", 2833 "schedule a test drive", 2834 "quick request more information" 2835 ]; 2836 this.scheduleTestRideModalId = "ScheduleATestRideModal"; 2837 this.initServiceFramework(moduleId); 2838 this.service = new SecondaryActionsApi_1.SecondaryActionsApi(this.serviceFramework); 2839 this.portalId = portalId; 2840 this.moduleId = moduleId; 2841 } 2842 ButtonActions.prototype.getProductDetailUrl = function () { 2843 if (this.settings 2844 && this.settings.unitDetailUrl 2845 && this.settings.unitDetailUrl !== "") { 2846 return this.settings.unitDetailUrl; 2847 } 2848 if (this.settings.productOption) { 2849 return "".concat(window.location.protocol, "//").concat(window.location.hostname, "/dx1inventory/").concat(this.productId); 2850 } 2851 return window.location.href; 2852 }; 2853 ButtonActions.prototype.onFacebookShareButtonClicked = function (e) { 2854 e.preventDefault(); 2855 var productUrl = this.getProductDetailUrl(); 2856 var url = "https://www.facebook.com/sharer/sharer.php?display=popup&u=".concat(productUrl); 2857 var options = "toolbar=0,status=0,resizable=1,width=626,height=436"; 2858 window.open(url, "sharer", options); 2859 return false; 2860 }; 2861 ButtonActions.prototype.onTwitterShareButtonClicked = function (e) { 2862 e.preventDefault(); 2863 var url = "https://twitter.com/share?text=Check out"; 2864 if (this.settings) { 2865 if (this.settings.productOption) { 2866 url = "".concat(url, " the %23").concat(this.settings.productOption.make, " ").concat(this.settings.productOption.year, " ").concat(this.settings.productOption.name); 2867 } 2868 var productUrl = this.getProductDetailUrl(); 2869 url = "".concat(url, "&url=").concat(productUrl); 2870 } 2871 var options = "toolbar=0,status=0,resizable=1,width=626,height=436"; 2872 window.open(url, "sharer", options); 2873 return false; 2874 }; 2875 ButtonActions.prototype.onFinancialButtonClicked = function (e) { 2876 if (this.settings.productOption.brpBrand && typeof window.sendByCTAEventToBrpAnalytics === "function") { 2877 window.sendByCTAEventToBrpAnalytics("click to financing", this.settings.productOption.brpBrand); 2878 } 2879 }; 2880 ButtonActions.prototype.onScheduleTestRideButtonClicked = function (e) { 2881 e.preventDefault(); 2882 if (this.settings.productOption.brpBrand && typeof window.sendByCTAEventToBrpAnalytics === "function") { 2883 window.sendByCTAEventToBrpAnalytics("click to dealer_demo_std", this.settings.productOption.brpBrand); 2884 } 2885 var option = { 2886 modalId: this.scheduleTestRideModalId, 2887 modalTitle: "Schedule a Test Ride", 2888 panelSelector: "#".concat(this.scheduleTestRideModalId), 2889 url: "/DesktopModules/Dominion/Common/Forms/ScheduleATestDrive.aspx", 2890 portalId: this.portalId, 2891 moduleId: this.moduleId, 2892 productId: this.productId, 2893 brpBrand: this.settings.productOption.brpBrand, 2894 prevSubmissionId: this.prevSubmissionId, 2895 tabModuleId: this.tabModuleId, 2896 }; 2897 // add dialog in case it doesn't have 2898 FormDialog.addDialogContent(option); 2899 // display dialog 2900 FormDialog.displayDialog(option); 2901 }; 2902 ButtonActions.prototype.initFinancingControl = function () { 2903 var _this = this; 2904 var $applyFinanceButton = this.$applyFinanceButton; 2905 var isShowApplyFinanceButton = this.settings 2906 && this.settings.financingButtonSetting 2907 && this.settings.financingButtonSetting.isDisplay; 2908 if (isShowApplyFinanceButton) { 2909 this.$applyFinanceButton.show(); 2910 var url = this.settings.financingButtonSetting.formUrl; 2911 if (url && url.indexOf(window.location.host) > -1) { 2912 url = "".concat(url, "/PrevSubmissionId/").concat(this.prevSubmissionId); 2913 } 2914 $applyFinanceButton.attr("href", url); 2915 $applyFinanceButton.off("click").on("click", function (e) { 2916 _this.onFinancialButtonClicked(e); 2917 }); 2918 if (this.settings.financingButtonSetting.isExternal) { 2919 $applyFinanceButton.attr("target", "_blank"); 2920 } 2921 else { 2922 $applyFinanceButton.removeAttr("target"); 2923 } 2924 return; 2925 } 2926 this.$applyFinanceButton.hide(); 2927 $applyFinanceButton.off("click"); 2928 }; 2929 ButtonActions.prototype.initSchduleTestRideControl = function () { 2930 var _this = this; 2931 var $button = this.$scheduleTestRideButton; 2932 var isShow = this.isShowSchduleTestRideByFormName(this.reqFormName) 2933 && this.settings 2934 && this.settings.scheduleTestRideButtonSetting 2935 && this.settings.scheduleTestRideButtonSetting.isDisplay; 2936 if (isShow) { 2937 $button.show(); 2938 $button.off("click").on("click", function (e) { 2939 _this.onScheduleTestRideButtonClicked(e); 2940 }); 2941 return; 2942 } 2943 $button.hide(); 2944 }; 2945 ButtonActions.prototype.intSocialControl = function () { 2946 var _this = this; 2947 this.$facebokButton.off("click").on("click", function (e) { 2948 _this.onFacebookShareButtonClicked(e); 2949 }); 2950 this.$twitterButton.off("click").on("click", function (e) { 2951 _this.onTwitterShareButtonClicked(e); 2952 }); 2953 if (this.settings 2954 && this.settings.productOption) { 2955 // set mail to url 2956 var productUrl = this.getProductDetailUrl(); 2957 var productNameEncode = encodeURIComponent(this.settings.productOption.name); 2958 var subject = "Check out this ".concat(this.settings.productOption.year, " ").concat(productNameEncode); 2959 var body = "Hi,%0D%0A%0D%0AWhile browsing the showroom, I found this ".concat(this.settings.productOption.year, " ").concat(productNameEncode, " and wanted to share it with you.%0D%0A%0D%0A").concat(encodeURIComponent(productUrl), "%0D%0A%0D%0AWhat do you think?"); 2960 var url = "mailto:?subject=".concat(subject, "&body=").concat(body); 2961 this.$mailToButton.attr("href", url); 2962 } 2963 }; 2964 ButtonActions.prototype.bindingSettings = function () { 2965 return __awaiter(this, void 0, void 0, function () { 2966 var data; 2967 return __generator(this, function (_a) { 2968 switch (_a.label) { 2969 case 0: return [4 /*yield*/, this.service.getSettings(this.tabModuleId, this.reqFormName, this.productId)]; 2970 case 1: 2971 data = _a.sent(); 2972 this.settings = data; 2973 return [2 /*return*/]; 2974 } 2975 }); 2976 }); 2977 }; 2978 ; 2979 ButtonActions.prototype.loadHtmlContent = function () { 2980 return __awaiter(this, void 0, void 0, function () { 2981 var data; 2982 return __generator(this, function (_a) { 2983 switch (_a.label) { 2984 case 0: return [4 /*yield*/, this.service.loadContent()]; 2985 case 1: 2986 data = _a.sent(); 2987 return [2 /*return*/, data]; 2988 } 2989 }); 2990 }); 2991 }; 2992 ; 2993 ButtonActions.prototype.initServiceFramework = function (moduleId) { 2994 this.serviceFramework = $.dnnSF(moduleId); 2995 }; 2996 ButtonActions.prototype.isShowSchduleTestRideByFormName = function (formName) { 2997 return formName.toLowerCase() !== this.formList[1]; 2998 }; 2999 ButtonActions.prototype.setDisplaySecondaryActions = function () { 3000 var isShow = this.settings 3001 && ((this.settings.financingButtonSetting && this.settings.financingButtonSetting.isDisplay) 3002 || (this.settings.scheduleTestRideButtonSetting && this.settings.scheduleTestRideButtonSetting.isDisplay)); 3003 this.displaySecondaryActions(isShow); 3004 }; 3005 ButtonActions.prototype.displaySecondaryActions = function (isShow) { 3006 if (isShow) { 3007 this.$secondaryActionsSection.show(); 3008 } 3009 else { 3010 this.$secondaryActionsSection.hide(); 3011 } 3012 }; 3013 ButtonActions.prototype.initElements = function (selector) { 3014 var scope = ".secondary-actions"; 3015 if (selector && selector != "") { 3016 scope = "".concat(selector, " ").concat(scope); 3017 } 3018 this.$secondaryActionsSection = $(scope); 3019 this.$applyFinanceButton = $("".concat(scope, " .apply-financing")); 3020 this.$scheduleTestRideButton = $("".concat(scope, " .schedule-test-ride")); 3021 this.$facebokButton = $("".concat(scope, " .fa-facebook-square")).parent("a"); 3022 this.$twitterButton = $("".concat(scope, " .x-icon")).parent("a"); 3023 this.$mailToButton = $("".concat(scope, " .fa-envelope")).parent("a"); 3024 }; 3025 ButtonActions.prototype.getScheduleTestRideButton = function () { 3026 return this.$scheduleTestRideButton; 3027 }; 3028 ButtonActions.prototype.isShowSecondaryActionsByFormName = function (formName) { 3029 var findFormName = formName.toLowerCase(); 3030 var index = this.formList.findIndex(function (e) { return e === findFormName; });
3031 return index > -1; 3032 }; 3033 ButtonActions.prototype.loadContent = function () { 3034 return this.loadHtmlContent().then(function (htmlContent) { 3035 return htmlContent; 3036 }); 3037 }; 3038 ButtonActions.prototype.init = function (tabModuleId, reqFormName, productId, selector, prevSubmissionId) { 3039 var _this = this; 3040 this.tabModuleId = tabModuleId; 3041 this.reqFormName = reqFormName; 3042 this.productId = productId; 3043 this.prevSubmissionId = prevSubmissionId; 3044 // binding selector 3045 this.initElements(selector); 3046 // hide all first 3047 this.$secondaryActionsSection.hide(); 3048 var isShow = this.isShowSecondaryActionsByFormName(reqFormName); 3049 if (!isShow) { 3050 return; 3051 } 3052 if (this.tabModuleId === 0 3053 || !this.productId 3054 || this.productId === "") { 3055 this.displaySecondaryActions(false); 3056 return; 3057 } 3058 return this.bindingSettings() 3059 .then(function () { 3060 _this.initFinancingControl(); 3061 _this.initSchduleTestRideControl(); 3062 _this.intSocialControl(); 3063 _this.setDisplaySecondaryActions(); 3064 }); 3065 }; 3066 return ButtonActions; 3067}()); 3068exports.ButtonActions = ButtonActions; 3069 3070 3071/***/ }), 3072 3073/***/ 542: 3074/***/ (function(module) { 3075 3076module.exports = window["PolarisDigitasManager"]; 3077 3078/***/ }), 3079 3080/***/ 29: 3081/***/ (function(module) { 3082 3083module.exports = window["ShiftDigitalAnalyticsManager"]; 3084 3085/***/ }) 3086 3087/******/ }); 3088/************************************************************************/ 3089/******/ // The module cache 3090/******/ var __webpack_module_cache__ = {}; 3091/******/ 3092/******/ // The require function 3093/******/ function __webpack_require__(moduleId) { 3094/******/ // Check if module is in cache 3095/******/ var cachedModule = __webpack_module_cache__[moduleId]; 3096/******/ if (cachedModule !== undefined) { 3097/******/ return cachedModule.exports; 3098/******/ } 3099/******/ // Create a new module (and put it into the cache) 3100/******/ var module = __webpack_module_cache__[moduleId] = { 3101/******/ // no module.id needed 3102/******/ // no module.loaded needed 3103/******/ exports: {} 3104/******/ }; 3105/******/ 3106/******/ // Execute the module function 3107/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); 3108/******/ 3109/******/ // Return the exports of the module 3110/******/ return module.exports; 3111/******/ } 3112/******/ 3113/************************************************************************/ 3114/******/ 3115/******/ // startup 3116/******/ // Load entry module and return exports 3117/******/ // This entry module is referenced by other modules so it can't be inlined 3118/******/ var __webpack_exports__ = __webpack_require__(979); 3119/******/ var __webpack_export_target__ = window; 3120/******/ for(var i in __webpack_exports__) __webpack_export_target__[i] = __webpack_exports__[i];
3121/******/ if(__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, "__esModule", { value: true }); 3122/******/ 3123/******/ })() 3124;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.