1/* eslint-disable no-undef */ 2/* eslint-disable no-unused-vars */ 3/* eslint-disable no-unused-expressions */ 4/* eslint-disable no-prototype-builtins */ 5/* eslint-disable camelcase */ 6 7// beusable ì¤ì 8// window.__beusablerumclient__ = { 9// load (src) { 10// const b = document.createElement('script') 11// b.src = src; b.async = true; b.type = 'text/javascript' 12// document.getElementsByTagName('head')[0].appendChild(b) 13// } 14// } 15// window.__beusablerumclient__.load('//rum.beusable.net/script/b171101e144206u678/f88ad03cce') 16 17(function (w, d, a) { 18 w.__beusablerumclient__ = { 19 load: function load (src) { 20 const b = d.createElement('script') 21 b.src = src; b.async = true; b.type = 'text/javascript' 22 d.getElementsByTagName('head')[0].appendChild(b) 23 } 24 }; w.__beusablerumclient__.load(a + '?url=' + encodeURIComponent(d.URL)) 25})(window, document, '//rum.beusable.net/load/b171101e144206u678') 26 27const hostname = window.location.host 28let CLIENT_ID = '86cd6422ba1c1dd78d122ad0b1158d6a' 29let dev_flag = '' 30let enviroment = 'local' 31let log_flag = 'false' 32const browser = navigator.userAgent 33let platform = '' 34let sendUrl = '' 35let brazeApiKey = '9a3af683-8a91-4a58-aa9b-80f55085de82' 36// LOCAL 37// if (hostname.includes('dev.kcar.com')) { 38// eslint-disable-next-line unicorn/prefer-includes 39if (hostname.indexOf('dev.kcar.com') > -1) { 40// if (hostname.includes('localhost')) { 41 CLIENT_ID = 'dac7bbefe0c481c136111fc6255d63a6' 42 dev_flag = 'Y' 43 log_flag = 'true' 44 enviroment = 'local' 45 sendUrl = 'http://dev.kcar.com:8090' 46 brazeApiKey = '9a3af683-8a91-4a58-aa9b-80f55085de82' 47// DEV 48// } else if (hostname.includes('aws-m.kcardev.com')) { 49 // eslint-disable-next-line unicorn/prefer-includes 50} else if (hostname.indexOf('www.kcardev.com') > -1) { 51 CLIENT_ID = 'dac7bbefe0c481c136111fc6255d63a6' 52 dev_flag = 'Y' 53 log_flag = 'true' 54 enviroment = 'dev' 55 sendUrl = 'https://api.kcardev.com' 56 brazeApiKey = '9a3af683-8a91-4a58-aa9b-80f55085de82' 57 // eslint-disable-next-line unicorn/prefer-includes 58} else if (hostname.indexOf('qa.kcar.com') > -1) { 59 CLIENT_ID = 'dac7bbefe0c481c136111fc6255d63a6' 60 dev_flag = 'Y' 61 log_flag = 'true' 62 enviroment = 'dev' 63 sendUrl = 'https://api-qa.kcar.com' 64 brazeApiKey = '9a3af683-8a91-4a58-aa9b-80f55085de82' 65 // eslint-disable-next-line unicorn/prefer-includes 66} else if (hostname.indexOf('www.kcar.com') > -1) { 67 CLIENT_ID = '86cd6422ba1c1dd78d122ad0b1158d6a' 68 dev_flag = 'N' 69 log_flag = 'true' 70 enviroment = 'prd' 71 sendUrl = 'https://api.kcar.com' 72 brazeApiKey = '79570721-e48c-4ca4-b9d6-e036e9bfeff8' 73} 74 75// console.log ì¬ì ì 76if (dev_flag === 'N') { 77 console.log = function () {} 78 window.console.log = function () {} 79} 80 81// IOS / AOS / WEB êµ¬ë¶ 82if (browser.indexOf('kcarIosApp') > 0) { 83 // if (browser.includes('kcarIosApp')) { 84 platform = 'IosApp' 85// } else if (browser.includes('kcarAndroid')) { 86} else if (browser.indexOf('kcarAndroid') > 0) { 87 platform = 'AndroidApp' 88} else { 89 platform = 'Web' 90} 91 92//= ================================================================================================ 93// Braze SDK ì°ë + Braze Initialize 94try { 95 // Braze SDK ì°ë (CDN ë°©ì/WEB íì ) 96 if (platform === 'Web') { 97 +(function (a, p, P, b, y) { 98 // eslint-disable-next-line no-new-func 99 a.braze = {} 100 a.brazeQueue = [] 101 102 const s = 'BrazeSdkMetadata DeviceProperties Card Card.prototype.dismissCard Card.prototype.removeAllSubscriptions Card.prototype.removeSubscription Card.prototype.subscribeToClickedEvent Card.prototype.subscribeToDismissedEvent Card.fromContentCardsJson ImageOnly CaptionedImage ClassicCard ControlCard ContentCards ContentCards.prototype.getUnviewedCardCount Feed Feed.prototype.getUnreadCardCount ControlMessage InAppMessage InAppMessage.SlideFrom InAppMessage.ClickAction InAppMessage.DismissType InAppMessage.OpenTarget InAppMessage.ImageStyle InAppMessage.Orientation InAppMessage.TextAlignment InAppMessage.CropType InAppMessage.prototype.closeMessage InAppMessage.prototype.removeAllSubscriptions InAppMessage.prototype.removeSubscription InAppMessage.prototype.subscribeToClickedEvent InAppMessage.prototype.subscribeToDismissedEvent InAppMessage.fromJson FullScreenMessage ModalMessage HtmlMessage Slide
102UpMessage User User.Genders User.NotificationSubscriptionTypes User.prototype.addAlias User.prototype.addToCustomAttributeArray User.prototype.addToSubscriptionGroup User.prototype.getUserId User.prototype.getUserId User.prototype.incrementCustomUserAttribute User.prototype.removeFromCustomAttributeArray User.prototype.removeFromSubscriptionGroup User.prototype.setCountry User.prototype.setCustomLocationAttribute User.prototype.setCustomUserAttribute User.prototype.setDateOfBirth User.prototype.setEmail User.prototype.setEmailNotificationSubscriptionType User.prototype.setFirstName User.prototype.setGender User.prototype.setHomeCity User.prototype.setLanguage User.prototype.setLastKnownLocation User.prototype.setLastName User.prototype.setPhoneNumber User.prototype.setPushNotificationSubscriptionType User.prototype.setLineId InAppMessageButton InAppMessageButton.prototype.removeAllSubscriptions InAppMessageButton.prototype.removeSubscription InAppMessageButton.prototype.subscribeToClickedEvent FeatureFlag FeatureFlag.prototype.getStringProperty FeatureFlag.prototype.getNumberProperty FeatureFlag.prototype.getBooleanProperty FeatureFlag.prototype.getImageProperty FeatureFlag.prototype.getJsonProperty FeatureFlag.prototype.getTimestampProperty Banner automaticallyShowInAppMessages destroyFeed hideContentCards showContentCards showFeed showInAppMessage deferInAppMessage toggleContentCards toggleFeed changeUser destroy getDeviceId getDeviceId initialize isPushBlocked isPushPermissionGranted isPushSupported logCardClick logCardDismissal logCardImpressions logContentCardImpressions logContentCardClick logCustomEvent logFeedDisplayed logInAppMessageButtonClick logInAppMessageClick logInAppMessageHtmlClick logInAppMessageImpression logPurchase openSession requestPushPermission removeAllSubscriptions removeSubscription requestContentCardsRefresh requestFeedRefresh refreshFeatureFlags requestImmediateDataFlush enableSDK isDisabled setLogger setSdkAuthenticationSignature addSdkMetadata disableSDK subscribeToContentCardsUpdates subscribeToFeedUpdates subscribeToInAppMessage subscribeToSdkAuthenticationFailures toggleLogging unregisterPush wipeData handleBrazeAction subscribeToFeatureFlagsUpdates getAllFeatureFlags logFeatureFlagImpression requestBannersRefresh insertBanner logBannerClick logBannerImpressions getAllBanners subscribeToBannersUpdates isInitialized'.split(' ') 103 let m, k, l, j 104 for (let i = 0; i < s.length; i++) { 105 for (m = s[i], k = a.braze, l = m.split('.'), j = 0; j < l.length - 1; j++) { 106 k = k[l[j]] 107 } 108 // eslint-disable-next-line 109 k[l[j]] = (new Function('return function ' + m.replace(/\./g, '_') + '(){window.brazeQueue.push(arguments); return true}'))() 110 }window.braze.getDeferredInAppMessage = function () { return new window.braze.InAppMessage() }; window.braze.getCachedContentCards = function () { return new window.braze.ContentCards() }; window.braze.getCachedFeed = function () { return new window.braze.Feed() }; window.braze.getUser = function () { return new window.braze.User() }; window.braze.getFeatureFlag = function () { return new window.braze.FeatureFlag() }; window.braze.getBanner = function () { return new window.braze.Banner() }; window.braze.newBannerFromJson = function () { return new window.braze.Banner() }; (y = p.createElement(P)).type = 'text/x-javascript' 111 112 y.src = 'https://js.appboycdn.com/web-sdk/5.9/braze.min.js' 113 y.async = 1; (b = p.getElementsByTagName(P)[0]).parentNode.insertBefore(y, b) 114 }(window, document, 'script')) 115 116 // Braze Initialize 117 window.braze.initialize(brazeApiKey, { 118 baseUrl: 'https://sdk.iad-03.braze.com/', 119 enableLogging: log_flag 120 }) 121 122 // Braze WEB í¸ì ë°ì¡ (service-worker.js ì¬ì©) 123 if (window.braze.isPushSupported()) { 124 if ('serviceWorker' in navigator) { 125 navigator.serviceWorker 126 .register('/service-worker.js') 127 .then(function (register) { 128 console.log('service work ë±ë¡ ì±ê³µ', register.scope) 129 }) 130 .catch(function (error) { 131 console.log('service work ë±ë¡ ì¤í¨ :', error) 132 }) 133 } 134 } 135 136 window.braze.subscribeToInAppMessage(function (inAppMessage) { 137 let shouldDisplay = true 138 if (inAppMessage instanceof braze.InAppMessage) {
139 const keyValuePairs = inAppMessage.extras || {} 140 141 if (keyValuePairs.softprompt === true) { 142 if (!window.braze.isPushSupported() || window.braze.isPushPermissionGranted() || window.braze.isPushBlocked()) { 143 // ì¹ í¸ì를 ì§ìíì§ ìì ë¸ë¼ì°ì ë ì´ë¯¸ ê¶í ë¶ì¬/ì°¨ë¨í ë¸ë¼ì°ì ì¼ ê²½ì° Softprompt ì¸ì± ë©ì¸ì§ë¥¼ ë ¸ì¶íì§ ììµëë¤. 144 shouldDisplay = false 145 } 146 // ë´ë¶ì ì¼ë¡ 커ì¤í°ë§ì´ì§ ì ì¬ì© - ì¶ê°ì ì¸ ë°ì´í° ì ì¡í ì ìë í¸ë¤ë§ ìì 147 if (inAppMessage.buttons[0]) { 148 inAppMessage.buttons[0].subscribeToClickedEvent(function () { 149 braze.requestPushPermission( 150 function () { 151 // ì림 íì© 152 }, 153 function () { 154 // ì림 ê±°ë¶ 155 } 156 ) 157 }) 158 } 159 } 160 } 161 if (shouldDisplay) { 162 window.braze.showInAppMessage(inAppMessage) 163 } 164 }) 165 window.braze.openSession() 166 } 167} catch (e) { 168 console.log(e) 169} 170//= ================================================================================================ 171// Amplitude SDK ì°ë + Amplitude Initialize 172try { 173 if (platform === 'Web') { 174 !(function () { 175 'use strict' 176 !(function (e, t) { 177 const r = e.amplitude || { _q: [], _iq: {} } 178 if (r.invoked) { 179 e.console && console.error && console.error('Amplitude snippet has been loaded.') 180 } else { 181 const n = function (e, t) { 182 e.prototype[t] = function () { 183 this._q.push({ name: t, args: Array.prototype.slice.call(arguments, 0) }) 184 return this 185 } 186 } 187 const s = function (e, t, r) { 188 return function (n) { e._q.push({ name: t, args: Array.prototype.slice.call(r, 0), resolve: n }) } 189 } 190 const i = function (e, t, r) { 191 e[t] = function () { 192 if (r) { 193 return { promise: new Promise(s(e, t, Array.prototype.slice.call(arguments))) } 194 } 195 !(function (e, t, r) { 196 e._q.push({ name: t, args: Array.prototype.slice.call(r, 0) }) 197 }(e, t, Array.prototype.slice.call(arguments))) 198 } 199 } 200 const o = function (e) { 201 for (let t = 0; t < y.length; t++) { i(e, y[t], !1) } 202 for (let r = 0; r < g.length; r++) { i(e, g[r], !0) } 203 } 204 r.invoked = !0 205 const c = t.createElement('script') 206 c.type = 'text/x-javascript' 207 c.integrity = 'sha384-0gwtzrGtOtHWfYCEWxJiQYriEUIRIhugiMW5pM7UQSw5m5ASVY+qUCLm5dWMyuTb' 208 c.crossOrigin = 'anonymous' 209 c.async = !0 210 c.src = 'https://cdn.amplitude.com/libs/analytics-browser-2.18.0-min.js.gz' 211 c.onload = function () { 212 e.amplitude.runQueuedFunctions || console.log('[Amplitude] Error: could not load SDK') 213 } 214 const a = t.getElementsByTagName('script')[0]; a.parentNode.insertBefore(c, a) 215 const u = function () { this._q = []; return this } 216 const p = ['add', 'append', 'clearAll', 'prepend', 'set', 'setOnce', 'unset', 'preInsert', 'postInsert', 'remove', 'getUserProperties'] 217 // for (const u = function () { this._q = []; return this }, p = ['add', 'append', 'clearAll', 'prepend', 'set', 'setOnce', 'unset', 'preInsert', 'postInsert', 'remove', 'getUserProperties'],const l = 0; l < p.length; l++) { n(u, p[l]) }r.Identify = u; for (const d = function () { this._q = []; return this }, f = ['getEventProperties', 'setProductId', 'setQuantity', 'setPrice', 'setRevenue', 'setRevenueType', 'setReceipt', 'setReceiptSig', 'setCurrency', 'setEventProperties'], v = 0; v < f.length; v++) { n(d, f[v]) }r.Revenue = d; const y = ['getDeviceId', 'setDeviceId', 'getSessionId', 'setSessionId', 'getUserId', 'setUserId', 'setOptOut', 'setTransport', 'reset', 'extendSession']; const g = ['init', 'add', 'remove', 'track', 'logEvent', 'identify', 'groupIdentify', 'setGroup', 'revenue', 'flush']; o(r), r.createInstance = function (e) { return r._iq[e] = { _q: [] }, o(r._iq[e]), r._iq[e] }, e.amplitude = r 218 for (let l = 0; l < p.length; l++) { n(u, p[l]) } 219 r.Identify = u 220 221 const d = function () { this._q = []; return this } 222 const f = ['getEventProperties', 'setProductId', 'setQuantity', 'setPrice', 'setRevenue', 'setRevenueType', 'setReceipt', 'setReceiptSig', 'setCurrency', 'setEventProperties'] 223 224 for (let v = 0; v < f.length; v++) { n(d, f[v]) } 225 r.Revenue = d 226 const y = ['getDeviceId', 'setDeviceId', 'getSessionId', 'setSessionId', 'getUserId', 'setUserId', 'setOptOut', 'setTransport', 'reset', 'extendSession'] 227 const g = ['init', 'add', 'remove', 'track', 'logEvent', 'identify', 'groupIdentify', 'setGroup', 'revenue', 'flush'] 228 o(r); r.createInstance = function (e) { 229 r._iq[e] = { _q: [] } 230 o(r._iq[e]) 231 return r._iq[e] 232 } 233 e.amplitude = r 234 } 235 }(window, document)) 236 }()) 237 238 const options = {} 239 window.amplitude.init(CLIENT_ID, { 240 autocapture: { 241 attribution: { 242 excludeReferrers: getExcludeReferrers() 243 }, // UTM ìì§ 244 pageViews: false, // 기본 íì´ì§ë·° ìì§ 245 sessions: true, // ì¸ì ì´ë²¤í¸ ìì§ 246 formInteractions: false, // í¼ ì´ë²¤í¸ ìì§ 247 fileDownloads: false, // íì¼ ë¤ì´ë¡ë ì´ë²¤í¸ êµ¬ì§ 248 elementInteractions: false // í´ë¦ ì´ë²¤í¸ ìì§(eg)visual label) 249 }, 250 options 251 }) 252 } 253} catch (e) { 254 console.log(e) 255} 256 257// Selper key ================================================================ã ã ============================= 258const __selperAccountId = '3e53e95e-ff5d-11ed-99f2-d4f5ef1417a0' 259const __selperFacebookPixelId = '937459457519559' 260const __selperGoogleAdsConversionId = 'AW-11200307604' 261const __selperGoogleViewItemConversionLabel = 'e-6JCMvC86UYEJTD3Nwp' 262const __selperGoogleAddToCartConversionLabel = 'x1o_CMK_7qUYEJTD3Nwp' 263const __selperGoogleSignUpConversionLabel = 'Bal0CMDX_aUYEJTD3Nwp' 264const __selperGoogleConversionLabel = 'iGLjCLy57qUYEJTD3Nwp' 265const __selperGoogleAnalyticsMeasurementId = ['UA-144849656-120', 'G-N2QC9KJL32'] 266// Selper key ============================================================================================= 267 268/** 269 * Amplitude Log Event 270 * @param key, value 271 */ 272function AmplitudeLogCall (key, type, param) { 273 // const axios = require('axios') 274 console.log(dev_flag) 275 // ê°ë°ìë²ììë§ ì½ìì°½ì log ì¶ë ¥ 276 if (dev_flag === 'Y') { 277 console.log('key : ' + key) 278 279 for (paramKey in param) { 280 console.log(paramKey + ' : ' + param[paramKey]) 281 } 282 console.log('\n') 283 } 284 let sendMarketUrl = '' 285 // eslint-disable-next-line unicorn/prefer-includes 286 if ((window.location.host).indexOf('dev.kcar.com') !== -1) { 287 // if (hostname.includes('localhost')) { 288 sendUrl = 'http://dev.kcar.com:8090' 289 sendMarketUrl = 'http://dev.kcar.com:18090' 290 // DEV 291 // } else if (hostname.includes('aws-m.kcardev.com')) { 292 // eslint-disable-next-line unicorn/prefer-includes 293 } else if ((window.location.host).indexOf('www.kcardev.com') !== -1) { 294 sendUrl = 'https://api.kcardev.com' 295 sendMarketUrl = 'https://marketm-api.kcardev.com' 296 // eslint-disable-next-line unicorn/prefer-includes 297 } else if ((window.location.host).indexOf('qa.kcar.com') !== -1) { 298 sendUrl = 'https://api-qa.kcar.com' 299 // eslint-disable-next-line unicorn/prefer-includes 300 } else if ((window.location.host).indexOf('www.kcar.com') !== -1) { 301 sendUrl = 'https://api.kcar.com' 302 sendMarketUrl = 'https://marketm-api.kcar.com' 303 } 304 305 // AJAX URL SETTING 306 if (type === 'ajax' || type === 'af_ajax') { 307 sendUrl = sendUrl + '/bc/mma/info' 308 } else if (type === 'acmajax') { 309 sendUrl = sendUrl + '/br/mma' 310 }
310 else if (type === 'rentajax') { 311 sendUrl = sendUrl + '/ur/rentCar/mma/info' 312 } else if (type === 'marketAjax') { 313 sendMarketUrl = sendMarketUrl + '/api/v1/ds/adDetail/adInfoDtl/mma/info' 314 } 315 316 // TYPE ë³ LOG EVENT 317 if (type === 'none') { 318 if (platform === 'IosApp') { 319 location.href = 'app://AmplitudeLog?key=' + key 320 } else if (platform === 'AndroidApp') { 321 app.AmplitudeLog(key) 322 } else { 323 window.amplitude.track(key).promise.then(function (result) { 324 if (result.message === 'Invalid id length for user_id or device_id') { 325 window.amplitude.reset() 326 window.amplitude.flush() 327 window.amplitude.setUserId(window.braze.getUser().getUserId()) 328 } 329 }) 330 window.braze.logCustomEvent(key) 331 } 332 } else if (type === 'prop') { 333 console.log('typeif:' + 'prop') 334 if (platform === 'IosApp') { 335 window.location.href = 'app://AmplitudeLogEvent?key=' + key + '&value=' + JSON.stringify(param) 336 } else if (platform === 'AndroidApp') { 337 window.app.AmplitudeLogEvent(key, JSON.stringify(param)) 338 } else { 339 window.amplitude.track(key, param).promise.then(function (result) { 340 if (result.message === 'Invalid id length for user_id or device_id') { 341 window.amplitude.reset() 342 window.amplitude.flush() 343 window.amplitude.setUserId(window.braze.getUser().getUserId()) 344 } 345 }) 346 window.braze.logCustomEvent(key, param) 347 } 348 } else if (type === 'ajax') { 349 let v_async = true 350 351 if (param.a_Type === 'insurance' || param.af_flag === 'Y') { 352 v_async = false 353 } 354 const httpRequest = new XMLHttpRequest() 355 httpRequest.onreadystatechange = function () { 356 if (httpRequest.readyState === XMLHttpRequest.DONE) { 357 if (httpRequest.status === 200) { 358 const json = httpRequest.response.data 359 const avo = json.avo 360 361 const amplProp = { 362 ì°¨ëë²í¸: avo.cno, 363 ì§ìì ëª : avo.cntrNm, 364 ì ì¡°ì¬: avo.mnuftrNm, 365 모ë¸: avo.modelNm, 366 ëë¶ë¥: avo.grdNm, 367 ìë¶ë¥: avo.grdDtlNm, 368 ì°ì: Number(avo.regModelyr), 369 주í거리: Number(avo.milg), 370 ìì: avo.extrColorNm, 371 ì°ë£: avo.fuelTypecdNm, 372 ì°¨ì¢ : avo.carctgrCdNm, 373 ì§ë¨ì¬ê³ : avo.acdtHistComnt, 374 ê´ê³ ë±ë¡íì : avo.view3dFg, 375 ê´ê³ ê°: Number(avo.salprc), 376 ìí´ë¦¬í¹ê°: Number(avo.wklyDcPrc), 377 ì¡°íì: Number(avo.viewCnt), 378 ì¢ììì: Number(avo.likeCnt), 379 ì¬ë£¨íì¬ë¶: avo.optSunroofYn, 380 ë¤ë¹ê²ì´ì ì¬ë¶: avo.optNaviYn, 381 'LDWS:ì°¨ì ì´í경보ìì¤í ': avo.optLdwsYn, 382 'í¤ëì ëì¤íë ì´(HUD)': avo.optHudYn, 383 '360ëì´ë¼ì´ëë·°': avo.optAroundviewYn, 384 íìí¸ë í¬: avo.optPwtrunkYn, 385 'ë©ëª¨ë¦¬ìí¸:ì´ì ì': avo.optMsDvYn, 386 'ë©ëª¨ë¦¬ìí¸:ì¡°ìì': avo.optMsSubYn, 387 'íµíìí¸:ì´ì ì': avo.optWsDvYn, 388 'íµíìí¸:ì¡°ìì': avo.optWsSubYn, 389 ë´ì°¨í¼í´ê±´ì: Number(avo.owncarDmgeAcdtCnt), 390 ê´ê³ ê°ê°ê²©ë: avo.priceRg, 391 주í거리ë²ì: avo.mileageRg, 392 구ëë°©ì: avo.wheel, 393 ì¸ì¹: avo.pasngrCnt + 'ì¸ì¹', 394 ë³ì기: avo.trnsmsnCd, 395 ì©ëë³ê²½ì´ë ¥: json.instnHistYn, 396 배기ë: Number(avo.engdispmnt), 397 ëíì§ì : avo.largeBrstCd, 398 íìë: avo.timeDealYn 399 } 400 console.log('amplProp >>> ', amplProp) 401 // ì°¨ëìì¸] ê´ì¬ì°¨ëì림 - ì íí ì±ëëª 402 if (param.a_channel != null && param.a_channel) { 403 amplProp['ì±ë'] = param.a_channel 404 } 405 406 // ì°¨ëìì¸] ê´ì¬ì°¨ëì림 - ì림ìë¹ì¤ ê¸°ê° 407 if (param.a_helpDate != null && param.a_helpDate) { 408 amplProp['ì림ì ì²ê¸°ê°'] = param.a_helpDate 409 } 410 411 amplProp['í ë§ê¸°íì '] = param.a_ThemeNm 412 413 if (param.a_leaseFlag != null && param.a_leaseFlag) { 414 amplProp['리ì¤ê²¬ì '] = param.a_leaseFlag 415 } 416 417 if (param.a_ReqSeqNo != null && param.a_ReqSeqNo) { 418 const homeVo = json.homeVo 419 let warranty = '' 420 const wrntyPrdNm = homeVo.gurntePrdCd.toString().slice(-2) 421 422 switch (wrntyPrdNm) { 423 case '03': warranty = 'KW3' 424 break
425 case '06': warranty = 'KW6' 426 break 427 case '12': warranty = 'KW12' 428 break 429 case '24': warranty = 'KW24' 430 break 431 default: warranty = '무보ì¦' 432 } 433 434 amplProp['ë³´ì¦êµ¬ë¶'] = warranty 435 436 if (param.a_Type === 'insurance') { 437 const paymentVo = json.paymentVo 438 // ìë² VOë iLoanSum, iCashSum, iCardSum ì¸ë° ë°ì´í ì ë¬ì iloanSum, icashSum, icardSum ë¡ ë³íë¨ 439 const loanSum = paymentVo.iLoanSum ? Number(paymentVo.iLoanSum) : Number(paymentVo.iloanSum) 440 const cashSum = paymentVo.iCashSum ? Number(paymentVo.iCashSum) : Number(paymentVo.icashSum) 441 const cardSum = paymentVo.iCardSum ? Number(paymentVo.iCardSum) : Number(paymentVo.icardSum) 442 443 amplProp['ì§ì'] = avo.centerRegionnm 444 amplProp['íê¸(ëì¶í¬í¨)ê²°ì ê¸ì¡'] = loanSum + cashSum 445 amplProp['ëì¶ì¬ì©ì¬ë¶'] = homeVo.vsoutUseYn 446 amplProp['ì¹´ëê²°ì ê¸ì¡'] = cardSum 447 amplProp['ëì¶ê¸ì¡'] = homeVo.vsoutAplAmt 448 } 449 } 450 451 // appsflyer & firebase ì´ë²¤í¸ 452 if (param.af_flag === 'Y') { 453 const af_param = { 454 af_price: avo.salprc, 455 af_carcd: param.i_sCarCd, 456 af_category: avo.carctgrCdNm 457 } 458 459 AF_LogCall(param.af_key, af_param) 460 FB_LogCall(param.fb_key, af_param) 461 } 462 window.amplitude.track(key, amplProp).promise.then(function (result) { 463 if (result.message === 'Invalid id length for user_id or device_id') { 464 window.amplitude.reset() 465 window.amplitude.flush() 466 window.amplitude.setUserId(window.braze.getUser().getUserId()) 467 } 468 }) 469 braze.logCustomEvent(key, amplProp) 470 } else { 471 console.log('httpRequest', httpRequest) 472 } 473 } 474 } 475 // console.log(' process.env.API_BASE_URL:' + process.env.API_BASE_URL) 476 // console.log('sendUrl:' + sendUrl) 477 httpRequest.open('POST', sendUrl, true) 478 httpRequest.responseType = 'json' 479 httpRequest.setRequestHeader('Content-Type', 'application/json') 480 // console.log('param:' + param) 481 // console.log(param) 482 httpRequest.send(JSON.stringify(param)) 483 } else if (type === 'acmajax') { // ë¸ëëì¸ì¦ê´ 484 const httpRequest = new XMLHttpRequest() 485 httpRequest.onreadystatechange = function () { 486 if (httpRequest.readyState === XMLHttpRequest.DONE) { 487 if (httpRequest.status === 200) { 488 const json = httpRequest.response.data 489 const avo = json.avo 490 const carhistory = json.carhistory 491 let a_instn_yn = 'N' 492 493 if (carhistory) { 494 if (carhistory.v_instn_yn === 'Y' || carhistory.v_bizs_yn === 'Y' || carhistory.v_rntl_yn === 'Y') { 495 a_instn_yn = 'Y' 496 } 497 } 498 499 const amplProp = { 500 ì°¨ëë²í¸: avo.cno, 501 ì ì¡°ì¬: avo.mnuftrNm, 502 모ë¸: avo.modelNm, 503 ëë¶ë¥: avo.grdNm, 504 ìë¶ë¥: avo.grdDtlNm, 505 ì°ì: Number(avo.regModelyr), 506 주í거리: Number(avo.milg), 507 ìì: avo.extrColorNm, 508 ì°ë£: avo.fuelTypeNm, 509 ì°¨ì¢ : avo.carctgrNm, 510 ë³ì기: avo.trnsmsnNm, 511 ìì¹: avo.rgnInfo, 512 ê´ê³ ê°: Number(avo.salPrc), 513 ê´ê³ ê°ê°ê²©ë: avo.priceRg, 514 주í거리ë²ì: avo.milgRg, 515 배기ë: Number(avo.engdispmnt), 516 ì¸ì¹: avo.pasngrCnt + 'ì¸ì¹', 517 í매ì: avo.dlercoNm, 518 ì ìì¥: avo.shwroomNm, 519 ë´ì°¨í¼í´ê±´ì: Number(avo.accCnt), 520 ì©ëë³ê²½ì´ë ¥: a_instn_yn, 521 리ì¤ì¢ ë¥: avo.leseKndNm 522 } 523 524 window.amplitude.track(key, amplProp).promise.then(function (result) { 525 if (result.message === 'Invalid id length for user_id or device_id') { 526 window.amplitude.reset() 527 window.amplitude.flush() 528 window.amplitude.setUserId(window.braze.getUser().getUserId()) 529 } 530 }) 531 braze.logCustomEvent(key, amplProp) 532 } else { 533 console.log('httpRequest', httpRequest) 534 } 535 } 536 } 537 httpRequest.open('POST', sendUrl, true) 538 httpRequest.responseType = 'json' 539 httpRequest.setRequestHeader('Content-Type', 'application/json') 540 httpRequest.send(JSON.stringify(param)) 541 }
541 else if (type === 'rentajax') { // ë í¸ì¹´ ìì¸ 542 const httpRequest = new XMLHttpRequest() 543 httpRequest.onreadystatechange = function () { 544 if (httpRequest.readyState === XMLHttpRequest.DONE) { 545 if (httpRequest.status === 200) { 546 const json = httpRequest.response.data 547 const avo = json.avo 548 549 const amplProp = { 550 ì°¨ëë²í¸: avo.cno, 551 ì ì¡°ì¬: avo.mnuftrNm, 552 모ë¸: avo.modelNm, 553 ëë¶ë¥: avo.grdNm, 554 ìë¶ë¥: avo.grdDtlNm, 555 ì°ì: Number(avo.prdcnYr), 556 주í거리: Number(avo.milg).toLocaleString('kr'), 557 주í거리ë²ì: avo.milgRg, 558 ìì: avo.extrColorNm, 559 ì°ë£: avo.fuelNm, 560 ê´ê³ ë±ë¡íì : avo.view3dFg, 561 ì¬ë£¨íì¬ë¶: avo.optSunroofYn, 562 ë¤ë¹ê²ì´ì ì¬ë¶: avo.optNaviYn, 563 ì ìê¸ë°©ìë í¸ë£: Number(avo.rentAmtN4 + '0000').toLocaleString('kr'), 564 ë³´ì¦ê¸ë°©ìë í¸ë£: Number(avo.rentAmtN2 + '0000').toLocaleString('kr'), 565 ë í¸ê¸°ê°: avo.rentMth + 'ê°ì', 566 'LDWS:ì°¨ì ì´í경보ìì¤í ': avo.optLdwsYn, 567 'í¤ëì ëì¤íë ì´(HUD)': avo.optHudYn, 568 '360ëì´ë¼ì´ëë·°': avo.optAroundviewYn, 569 íìí¸ë í¬: avo.optPwtrunkYn, 570 'ë©ëª¨ë¦¬ìí¸:ì´ì ì': avo.optMsDvYn, 571 'ë©ëª¨ë¦¬ìí¸:ì¡°ìì': avo.optMsSubYn, 572 'íµíìí¸:ì´ì ì': avo.optWsDvYn, 573 'íµíìí¸:ì¡°ìì': avo.optWsSubYn, 574 ë³ì기: avo.trnsmnsNm, 575 배기ë: Number(avo.engdispmnt).toLocaleString('kr'), 576 ë í¸í¹ê°: Number(avo.spclRentAmtN4 + '0000').toLocaleString('kr') 577 } 578 window.amplitude.track(key, amplProp).promise.then(function (result) { 579 if (result.message === 'Invalid id length for user_id or device_id') { 580 window.amplitude.reset() 581 window.amplitude.flush() 582 window.amplitude.setUserId(window.braze.getUser().getUserId()) 583 } 584 }) 585 braze.logCustomEvent(key, amplProp) 586 587 console.log(amplProp) 588 } else { 589 console.log('httpRequest', httpRequest) 590 } 591 } 592 } 593 httpRequest.open('POST', sendUrl, true) 594 httpRequest.responseType = 'json' 595 httpRequest.setRequestHeader('Content-Type', 'application/json') 596 httpRequest.send(JSON.stringify(param)) 597 } else if (type === 'marketAjax') { 598 const httpRequest = new XMLHttpRequest() 599 httpRequest.onreadystatechange = function () { 600 if (httpRequest.readyState === XMLHttpRequest.DONE) { 601 if (httpRequest.status === 200) { 602 const json = httpRequest.response.data 603 const avo = json.avo 604 605 const amplProp = { 606 ì°¨ëë²í¸: avo.cno, 607 í매ê°: avo.salprc * 10000, 608 ì ì¡°ì¬: avo.mnuftrNm, 609 ì°¨ì¢ : avo.carctgrCdNm, 610 모ë¸: avo.modelNm, 611 ì°ë£: avo.fuelNm, 612 ì°ì: avo.regModelyr, 613 주í거리: avo.adMilg, 614 ì°¨ëì ë³´: avo.carMmaInfo, 615 ì¢ììì: avo.likeCount, 616 ì±í ì: avo.chatroomCnt, 617 KCaríì§ì¸ì¦ì¬ë¶: avo.wrntyYn, // Y/N 618 ê°ê²©ì ìê°ë¥ì¬ë¶: avo.priceOfferYn, // Y/N 619 ìì: avo.extrColorNm, 620 // 3ì°¨ì¤í쪽 621 ì§ì ê²½ë¡: param.channel, 622 í¨í¤ì§: param.package, 623 구ë¶: param.type, 624 ê²°ì ìë¨: param.payMethod, 625 ê²°ì ê¸ì¡: param.payPrice, 626 ì´ì ë¶ê°ì¬ì : param.reason, 627 ë³´íì¬: param.insurance, 628 ì´ì ë±ë¡ë¹: param.transFee, 629 ì ìì·¨ìì¬ì : param.cancelRsn 630 } 631 window.amplitude.track(key, amplProp).promise.then(function (result) { 632 if (result.message === 'Invalid id length for user_id or device_id') { 633 window.amplitude.reset() 634 window.amplitude.flush() 635 window.amplitude.setUserId(window.braze.getUser().getUserId()) 636 } 637 }) 638 braze.logCustomEvent(key, amplProp) 639 640 console.log(amplProp) 641 } else { 642 console.log('httpRequest', httpRequest) 643 } 644 } 645 } 646 console.log('sendMarketUrl:' + sendMarketUrl) 647 httpRequest.open('POST', sendMarketUrl, true) 648 httpRequest.responseType = 'json' 649 httpRequest.setRequestHeader('Content-Type', 'application/json') 650 console.log('param:' + param) 651 console.log(param) 652 httpRequest.send(JSON.stringify(param)) 653 } 654} 655
656// AppsFlyer ì¸ì±ì´ë²¤í¸ 657function AF_LogCall (key, param) { 658 let af_carcd = '' 659 let af_price = '' 660 let af_category = '' 661 let af_param = '' 662 const af_key = [ 663 'af_easy_sellcar_step1', 664 'af_easy_sellcar_final', 665 'af_sellcar_mainpage' 666 667 ] 668 669 // [1] ë¡ê·¸ì¸ || ë´ì°¨í기ì ì² || íìê°ì 670 // if (af_key.includes(key)) { 671 // eslint-disable-next-line unicorn/prefer-includes 672 if (af_key.indexOf(key) !== -1) { 673 af_param = param 674 675 // [2] ê·¸ ì¸ 676 } else { 677 for (paramKey in param) { 678 console.log(paramKey + ' : ' + param[paramKey]) 679 if (paramKey === 'af_carcd') { 680 af_carcd = param[paramKey] 681 } else if (paramKey === 'af_price') { 682 af_price = param[paramKey] 683 } else if (paramKey === 'af_category') { 684 af_category = param[paramKey] 685 } 686 } 687 if (key === 'af_complete_buying_without_call') { 688 af_param = { 689 // eslint-disable-next-line object-shorthand 690 af_price: af_price, 691 af_revenue: af_price, 692 af_content_id: af_carcd, 693 af_content_type: af_category, 694 af_currency: 'KRW', 695 af_quantity: '1', 696 af_order_id: af_carcd, 697 af_receipt_id: af_carcd 698 } 699 } else { 700 af_param = { 701 // eslint-disable-next-line object-shorthand 702 af_price: af_price, 703 af_content_id: af_carcd, 704 af_content_type: af_category, 705 af_quantity: '1', 706 af_currency: 'KRW' 707 } 708 } 709 } 710 711 // ê°ë°ìë²ììë§ ì½ìì°½ì log ì¶ë ¥ 712 if (dev_flag === 'Y') { 713 console.log('AppsFlyer key : ' + key) 714 715 for (paramKey in param) { 716 console.log(paramKey + ' : ' + param[paramKey]) 717 } 718 console.log('\n') 719 } 720} 721 722// Firebase ì¸ì±ì´ë²¤í¸ 723function FB_LogCall (key, param) { 724 let af_carcd = '' 725 let af_price = '' 726 let af_category = '' 727 let af_param = '' 728 const af_key = [ 729 'login', 730 'sign_up', 731 'easy_sellcar_step1', 732 'easy_sellcar_final', 733 'marketprice_sellcar_step1', 734 'marketprice_sellcar_step2', 735 'marketprice_sellcar_step3', 736 'sellcar_mainpage' 737 738 ] 739 740 // [1] ë¡ê·¸ì¸ || ë´ì°¨í기ì ì² || íìê°ì 741 if (af_key.indexOf(key) > 0) { 742 // if (af_key.includes(key)) { 743 af_param = param 744 745 // [2] ê·¸ ì¸ 746 } else { 747 for (key in param) { 748 console.log(paramKey + ' : ' + param[paramKey]) 749 if (paramKey === 'af_carcd') { 750 af_carcd = param[paramKey] 751 } else if (paramKey === 'af_price') { 752 af_price = param[paramKey] 753 } else if (paramKey === 'af_category') { 754 af_category = param[paramKey] 755 } 756 } 757 758 if (key === 'purchase_buying_without_call') { 759 af_param = { 760 price: af_price, 761 value: af_price, 762 item_id: af_carcd, 763 item_category: af_category, 764 currency: 'KRW', 765 quantity: '1', 766 transaction_id: af_carcd 767 } 768 } else { 769 af_param = { 770 price: af_price, 771 item_id: af_carcd, 772 item_category: af_category, 773 quantity: '1', 774 currency: 'KRW' 775 } 776 } 777 } 778 779 // ê°ë°ìë²ììë§ ì½ìì°½ì log ì¶ë ¥ 780 if (dev_flag === 'Y') { 781 console.log('FireBase key : ' + key) 782 783 for (paramKey in param) { 784 console.log(paramKey + ' : ' + param[paramKey]) 785 } 786 787 console.log('\n') 788 } 789} 790 791// Ampitude & Braze ID <-> Kcar ID 매í 792function AmplitudeLogin (Loginid) { 793 try { 794 braze.changeUser(Loginid) 795 amplitude.setUserId(Loginid) 796 // } 797 } catch (e) { 798 console.log(e) 799 } 800} 801 802function checkMobileDevice () { 803 // eslint-disable-next-line no-array-constructor 804 const mobileKeyWords = new Array('Android', 'iPhone', 'iPod', 'BlackBerry', 'Windows CE', 'SAMSUNG', 'LG', 'MOT', 'SonyEricsson') 805 for (let arrayIndex = 0; arrayIndex < mobileKeyWords.length; arrayIndex++) { 806 if (navigator.userAgent.match(mobileKeyWords[arrayIndex]) != null) { 807 return true 808 } 809 } 810 return false 811} 812 813function openDetail (url) { 814 console.log(url) 815 if (platform === 'IosApp') { 816 location.href = 'app://openDetail?msg=' + encodeURIComponent(url) 817 } else if (platform === 'AndroidApp') { 818 window.app.openDetail(url) 819 } else { 820 openInNewTab(url) 821 } 822} 823 824function openInNewTab (url) { 825 const win = window.open(url, '_blank') 826 win.focus() 827} 828 829function getExcludeReferrers () { 830 const baseReferrers = ['accounts.kakao.com', 'nid.naver.com', 'appleid.apple.com'] 831 832 // ì ê·ìì¼ë¡ íë¼ë¯¸í° ì²´í¬ 833 const hasParams = /\?[^#]*[^=&]/.test(window.location.href) 834 835 if (!hasParams) { 836 baseReferrers.push('www.kcar.com', 'm.kcar.com') // ì ê·ì ìì¸ ì¼ì´ì¤ 837 } 838 839 return baseReferrers 840}
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.