vendor: 650 bytes, lines 1-12
1/* 2 * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). 3 * This devtool is neither made for production nor for readable output files. 4 * It uses "eval()" calls to create a separate source file in the browser devtools. 5 * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) 6 * or disable the default devtool with "devtool: false". 7 * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). 8 */ 9/******/ (() => { // webpackBootstrap 10/******/ var __webpack_modules__ = ({ 11 12/***/ "./
12assets/js/spreedly.js": 13/*!*******************************!*\ 14 !*** ./assets/js/spreedly.js ***! 15 \*******************************/ 16/***/ (() => { 17 18eval(" function letSpreedlyLifecycleHandleIt(token, publishable_key) {\n\n var lifecycle = new Spreedly.ThreeDS.Lifecycle({\n // The environmentKey field is highly recommended,\n // if omitted lifecycle may miss certain update events\n // but the transaction will still succeed.\n environmentKey: publishable_key,\n\n // The DOM node that you'd like to inject hidden iframes\n hiddenIframeLocation: 'spreedly-3ds-device-fingerprint', // (required)\n\n // The DOM node that you'd like to inject the challenge flow\n challengeIframeLocation: 'spreedly-3ds-challenge', // (required)\n\n // The token for the transaction - used to poll for state\n transactionToken: token, // (required)\n\n // The css classes that you'd like to apply to the challenge iframe.\n // e.g. 'red-border left-positioned custom-styles'\n // challengeIframeClasses: '', // (optional)\n });\n\n lifecycle.start()\n}\n\nfunction refresh_fragments_and_update_cart() {\n jQuery(document.body).trigger('wc_fragment_refresh');\n jQuery(document.body).trigger('update_checkout');\n jQuery('#spreedly-loader').addClass('hidden');\n}\n\nfunction displayInlineError(messages) {\n const newStyle = jQuery(\"body\").hasClass('new-checkout-landing-body');\n if(newStyle) {\n let svgEl = '<svg width=\"24\" height=\"21\" viewBox=\"0 0 24 21\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\\n' +\n '<path d=\"M12.0005 15.0003C11.8027 15.0003 11.6093 15.0589 11.4449 15.1688C11.2804 15.2787 11.1523 15.4349 11.0766 15.6176C11.0009 15.8003 10.9811 16.0014 11.0197 16.1954C11.0583 16.3893 11.1535 16.5675 11.2933 16.7074C11.4332 16.8472 11.6114 16.9425 11.8054 16.9811C11.9993 17.0196 12.2004 16.9998 12.3831 16.9242C12.5659 16.8485 12.722 16.7203 12.8319 16.5558C12.9418 16.3914 13.0005 16.1981 13.0005 16.0003C13.0005 15.7351 12.8951 15.4807 12.7076 15.2932C12.52 15.1056 12.2657 15.0003 12.0005 15.0003ZM22.6705 16.4703L14.6205 2.47027C14.3603 2.00379 13.9802 1.61523 13.5196 1.34474C13.0591 1.07425 12.5346 0.931641 12.0005 0.931641C11.4663 0.931641 10.9419 1.07425 10.4813 1.34474C10.0207 1.61523 9.64065 2.00379 9.38046 2.47027L1.38046 16.4703C1.11125 16.9243 0.966598 17.4413 0.9611 17.9691C0.955602 18.4969 1.08945 19.0168 1.34914 19.4763C1.60883 19.9358 1.98516 20.3187 2.44014 20.5863C2.89512 20.8539 3.41264 20.9967 3.94046 21.0003H20.0605C20.5925 21.0055 21.1164 20.8692 21.5784 20.6052C22.0403 20.3412 22.4238 19.9591 22.6894 19.4981C22.9551 19.0371 23.0933 18.5137 23.09 17.9816C23.0866 17.4495 22.9418 16.9279 22.6705 16.4703ZM20.9405 18.4703C20.8528 18.6262 20.7249 18.7558 20.5701 18.8455C20.4154 18.9352 20.2393 18.9817 20.0605 18.9803H3.94046C3.76157 18.9817 3.58556 18.9352 3.43077 18.8455C3.27599 18.7558 3.14811 18.6262 3.06046 18.4703C2.97269 18.3183 2.92648 18.1458 2.92648 17.9703C2.92648 17.7947 2.97269 17.6223 3.06046 17.4703L11.0605 3.47027C11.1444 3.30647 11.2719 3.169 11.4289 3.07301C11.5859 2.97702 11.7664 2.92623 11.9505 2.92623C12.1345 2.92623 12.315 2.97702 12.472 3.07301C12.629 3.169 12.7565 3.30647 12.8405 3.47027L20.8905 17.4703C20.9897 17.6201 21.0467 17.7939 21.0555 17.9734C21.0643 18.1529 21.0245 18.3314 20.9405 18.4903V18.4703ZM12.0005 7.00027C11.7352 7.00027 11.4809 7.10563 11.2933 7.29316C11.1058 7.4807 11.0005 7.73505 11.0005 8.00027V12.0003C11.0005 12.2655 11.1058 12.5198 11.2933 12.7074C11.4809 12.8949 11.7352 13.0003 12.0005 13.0003C12.2657 13.0003 12.52 12.8949 12.7076 12.7074C12.8951 12.5198 13.0005 12.2655 13.0005 12.0003V8.00027C13.0005 7.73505 12.8951 7.4807 12.7076 7.29316C12.52 7.10563 12.2657 7.00027 12.0005 7.00027Z\" fill=\"#FF6060\"/>\\n' +\n '</svg>\\n';\n var inlineMessagesEl = \"<div class='inline-error-message' role='alert' style='margin: 0 auto;margin-bottom: 30px;margin-top: -20px;max-width: 310px;'><div class='error-svg'>\"+svgEl+\"</div><div class='checkout-inline-error-text'>\" + messages + \"</div></div>\";\n const newInlineError = jQuery('#inline-errors');\n const newInlineErrorEl = jQuery(\"<div id='inline-errors'></div>\")\n if (newInlineError.length) {\n newInlineError.addClass('inline-error').html(inlineMessagesEl);\n } else {\n jQuery(newInlineErrorEl).insertAfter('.woocommerce-checkout-review-order');\n jQuery('#inline-errors').addClass('inline-error').html(inlineMessagesEl);\n }\n const id = 'inline-errors';\n const yOffset = -20;\n const element = document.getElementById(id);\n const y = element.getBoundingClientRect().top + window.pageYOffset + yOffset;\n window.scrollTo({top: y, behavior: 'smooth'});\n }\n else{\n var messagesEr = \"<ul class='woocommerce-error' role='alert'><li>\"+ messages +\"</li><ul>\";\n var existingNotice = jQuery(\".woocommerce-NoticeGroup-checkout\");\n if (existingNotice.length > 0) {\n existingNotice.html(messagesEr);\n } else {\n var newDiv = jQuery(\"<div></div>\")\n .addClass(\"woocommerce-NoticeGroup woocommerce-NoticeGroup-checkout\")\n .html(messagesEr);\n jQuery(\"#wfacp_checkout_form\").prepend(newDiv);\n }\n }\n\n}\n\nfunction setInputError(errorEl, errorMessage){\n jQuery('#'+errorEl).html(errorMessage);\n}\n\n\nSpreedly.on('paymentMethod', function (token, paymentMethod) {\n\n jQuery('#spreedly-loader').removeClass('hidden');\n\n var browser_size = '05';\n\n // The accept header from your server side rendered page.\n // You'll need to inject it into the page. Below is an example.\n var acceptHeader = 'text/html,application/xhtml+xml;q=0.9,*/*;q=0.8'\n\n // Capture browser data by using `Spreedly.ThreeDS.serialize().\n var browser_info = Spreedly.ThreeDS.serialize(\n browser_size,\n acceptHeader\n );\n\n var checkout_form = jQuery('form.woocommerce-checkout');\n\n checkout_form.find('#spreedly_payment_token').val(token);\n checkout_form.find('#browser_info').val(browser_info);\n\n var formData = checkout_form.serialize();\n\n jQuery.ajax({\n type: 'POST',\n url: wc_checkout_params.checkout_url,\n data: formData,\n dataType : 'json',\n success: function (response) {\n if (response.state === 'pending') {\n var transaction_token = response.transaction_token;\n var publishable_key = response.publishable_key;
18\n setCookie('spreedly_order_id', response.order_id, 1);\n setCookie('spreedly_redirect_url', response.redirect, 1);\n letSpreedlyLifecycleHandleIt(transaction_token, publishable_key);\n } else if (response.state === 'succeeded') {\n window.location.href = response.redirect;\n } else if (response.state === 'gateway_processing_failed') {\n var product_id = getSelectedProductCookie();\n console.log('product_id: '+ product_id);\n\n jQuery.ajax({\n type: 'POST',\n dataType: 'json',\n url: spreedly_params.ajaxurl,\n data: {\n action: 'spreedly_failed_order',\n order_id: response.order_id,\n attempt_no: 1,\n reason: 'gatewayFailed',\n product_id: product_id\n },\n success: function () {\n refresh_fragments_and_update_cart();\n document.getElementById('spreedly-3ds-challenge-modal').classList.add('hidden');\n }\n });\n displayInlineError(spreedly_params.gatewayFailed);\n }\n else {\n var product_id = getSelectedProductCookie();\n console.log('product_id: '+ product_id);\n\n jQuery.ajax({\n type: 'POST',\n dataType: 'json',\n url: spreedly_params.ajaxurl,\n data: {\n action: 'spreedly_failed_order',\n order_id: response.order_id,\n attempt_no: 1,\n reason: 'failed',\n product_id: product_id\n },\n success: function () {\n refresh_fragments_and_update_cart();\n document.getElementById('spreedly-3ds-challenge-modal').classList.add('hidden');\n }\n });\n displayInlineError(spreedly_params.failed);\n }\n\n if (response.result === 'failure' && response.messages) {\n let messageDisplay = response.messages.replace(/(<([^>]+)>)/gi, \"\")\n displayInlineError(messageDisplay);\n }\n\n // jQuery('#spreedly-loader').addClass('hidden');\n },\n error: function(error) {\n if(spreedly_params.error) {\n displayInlineError(spreedly_params.error);\n }\n jQuery('#spreedly-loader').addClass('hidden');\n console.log(error);\n }\n });\n\n});\n\nSpreedly.on('errors', function (errors) {\n document.getElementById('errors').innerHTML = \"\";\n var messageEl = document.getElementById('errors');\n var errorBorder = \"1px solid #EF4444\";\n for (var i = 0; i < errors.length; i++) {\n var error = errors[i];\n if (error[\"attribute\"]) {\n if (error[\"attribute\"] === 'month' || error[\"attribute\"] === 'year') {\n document.getElementById('spreedly-exp-date').style.border = errorBorder;\n setInputError('inline-expiry-cvv-error', error.message);\n }\n if (error[\"attribute\"] === 'number') {\n document.getElementById('spreedly-number').style.border = errorBorder;\n setInputError('inline-card-error', error.message);\n }\n if (error[\"attribute\"] === 'cvv') {\n document.getElementById('spreedly-cvv').style.border = errorBorder;\n setInputError('inline-cvv-error', error.message);\n }\n }\n //messageEl.innerHTML += error[\"message\"] + \"<br/>\";\n }\n});\n\n Spreedly.on('validation', function(inputProperties) {\n if(!inputProperties[\"validNumber\"]) {\n messageEl = document.getElementById(\"message\");\n messageEl.innerHTML = \"Please enter a valid credit card number\";\n }\n });\n\n\n\nSpreedly.on('ready', function (frame) {\n Spreedly.setFieldType('number', 'text');\n Spreedly.setNumberFormat(\"prettyFormat\");\n Spreedly.setFieldType('cvv', 'text');\n Spreedly.setParam('allow_blank_name', true);\n Spreedly.setPlaceholder(\"number\", \"1234 1234 1234 1234\");\n Spreedly.setPlaceholder(\"cvv\", \"CVC\");\n Spreedly.setStyle('number', 'border: none; padding: 12px 60px 17px 10px; font-size: 16px; color: #343A40; width: 100%;');\n Spreedly.setStyle('cvv', 'border: none; padding: 12px 60px 17px 10px; font-size: 16px; color: #343A40; width: 100%;');\n if (jQuery('body').hasClass('new-checkout-landing-body')) {\n Spreedly.setStyle('number', 'border: none; padding: 15px 60px 16px 15px; font-size: 16px; color: #343A40; width: 100%;');\n Spreedly.setStyle('cvv', 'border: none; padding: 15px 60px 16px 15px; font-size: 16px; color: #343A40; width: 100%;');\n }\n Spreedly.setStyle('placeholder', 'border: none; font-size: 16px;');\n});\n\nfunction cvvLengthValidation(length, cardType){\n if( cardType === 'visa' ) {\n return length > 15 && length < 21;\n }\n else{\n return length > 10 && length < 21;\n }\n}\nfunction cvcLengthValidation(length){\n return length < 3;\n}\n\nfunction resetErrorAndBorder(field){\n const defaultBorder = \"1px solid #cccccc\";\n\n const errorDiv = document.querySelector('.spf-field-errors #errors');\n if(errorDiv){\n errorDiv.innerHTML = \"\";\n }\n const inlineCardErrorEl = document.getElementById('inline-card-error');\n const inlineExpCvcErrorEl = document.getElementById('inline-expiry-cvv-error');\n const inlineCvcErrorEl = document.getElementById('inline-cvv-error');\n\n if (field === 'exp') {\n if(inlineExpCvcErrorEl){\n inlineExpCvcErrorEl.innerHTML = \"\";\n }\n document.getElementById('spreedly-exp-date').style.border = defaultBorder;\n return;\n }\n if (field === 'number') {\n if(inlineCardErrorEl){\n inlineCardErrorEl.innerHTML = \"\";\n }\n document.getElementById('spreedly-number').style.border = defaultBorder;\n return;\n }\n if (field === 'cvv') {\n if(inlineCvcErrorEl){\n inlineCvcErrorEl.innerHTML = \"\";\n }\n document.getElementById('spreedly-cvv').style.border = defaultBorder;\n return;\n }\n}\n\nlet errorBorder = \"1px solid #EF4444\";\nlet defaultBorder = \"1px solid #D1E0F2\";\n\n// Note: Expiration date is handled outside this scope\nlet validationData = {\n cvvError: false,\n cvvLength: 0,\n numberError: false,\n numberLength: 0\n}\n\nfunction applyFormValidation(){\n if( validationData.cvvError && validationData.cvvLength > 0){\n document.getElementById('cvc_inline_validation').setAttribute(\"value\", false);\n document.getElementById('spreedly-cvv').style.border = errorBorder;\n document.getElementById('inline-cvv-error').innerHTML = \"Check if CVC code is valid\";\n }\n if( validationData.numberError && validationData.numberLength > 0) {\n document.getElementById('card_inline_validation').setAttribute(\"value\", false);\n document.getElementById('inline-card-error').innerHTML = \"Credit card number entered is not val
18id\";\n document.getElementById('spreedly-number').style.border = errorBorder;\n }\n}\n\n\nSpreedly.on('fieldEvent', function (name, event, activeElement, inputData) {\n const bodyEl= document.querySelector('body');\n\n let checkoutLandingPageCheck = false;\n if( bodyEl.classList.contains('new-checkout-landing-body') ){\n checkoutLandingPageCheck = true;\n }\n\n\n if (event === 'input') {\n if (name === 'cvv') {\n resetErrorAndBorder('cvv');\n validationData.cvvLength = inputData['cvvLength'];\n if (inputData['validCvv'] || inputData['cvvLength'] > 2) {\n validationData.cvvError = false;\n if(!checkoutLandingPageCheck) {\n Spreedly.setStyle('cvv', \"background-color: #CDFFE6;\");\n }\n document.getElementById('cvc_inline_validation').setAttribute(\"value\", true);\n if(checkoutLandingPageCheck) {\n document.getElementById('spreedly-cvv').style.border = defaultBorder;\n document.getElementById('inline-cvv-error').innerHTML = \"\";\n }\n } else {\n validationData.cvvError = true;\n if(!checkoutLandingPageCheck) {\n Spreedly.setStyle('cvv', \"background-color: transparent;\");\n }\n }\n }\n if (name === 'number') {\n validationData.numberLength = inputData['numberLength'];\n resetErrorAndBorder('number');\n if (inputData['validNumber']) {\n validationData.numberError = false;\n if (!checkoutLandingPageCheck) {\n Spreedly.setStyle('number', \"background-color: #CDFFE6;\");\n }\n document.getElementById('card_inline_validation').setAttribute(\"value\", true);\n } else {\n if (!checkoutLandingPageCheck) {\n Spreedly.setStyle('number', \"background-color: transparent;\");\n }\n validationData.numberError = true;\n\n }\n\n if (inputData[\"validNumber\"]) {\n if(!checkoutLandingPageCheck) {\n Spreedly.setStyle('number', \"background-color: #CDFFE6;\");\n }\n if(checkoutLandingPageCheck) {\n document.getElementById('inline-card-error').innerHTML = \"\";\n document.getElementById('spreedly-number').style.border = defaultBorder;\n }\n } else {\n if(!checkoutLandingPageCheck) {\n Spreedly.setStyle('number', \"background-color: #ffc5c5;\")\n }\n }\n\n\n site_url = document.location.origin;\n img_path = site_url + '/wp-content/plugins/woocommerce-spreedly/assets/img/';\n if (inputData['cardType'] === 'visa') {\n document.getElementById('card-img').src = img_path + \"visa.svg\";\n } else if (inputData['cardType'] === 'master') {\n document.getElementById('card-img').src = img_path + \"mastercard.svg\";\n } else {\n document.getElementById('card-img').src = img_path + \"card.svg\";\n }\n\n }\n }\n if( event === 'blur' && checkoutLandingPageCheck) {\n applyFormValidation();\n }\n});\n\nvar on3DSstatusUpdatesFn = function (threeDsStatusEvent) {\n let spreedly_order_id = getCookie('spreedly_order_id');\n switch (threeDsStatusEvent.action) {\n case \"challenge\":\n document.getElementById('spreedly-3ds-challenge-modal').classList.remove('hidden');\n break;\n case \"succeeded\":\n jQuery.ajax({\n type: 'POST',\n dataType : 'json',\n url: spreedly_params.ajaxurl,\n data: {\n action: 'complete_spreedly_order',\n order_id: spreedly_order_id,\n },\n success: function (response) {\n if (response.redirect) {\n window.location.href = response.redirect;\n }\n }\n });\n break;\n case \"finalization-timeout\":\n case \"error\":\n var product_id = getSelectedProductCookie();\n jQuery.ajax({\n type: 'POST',\n dataType: 'json',\n url: spreedly_params.ajaxurl,\n data: {\n action: 'spreedly_failed_order',\n order_id: spreedly_order_id,\n attempt_no: 1,\n reason: 'challengeFailed',\n product_id: product_id\n },\n success: function () {\n refresh_fragments_and_update_cart();\n document.getElementById('spreedly-3ds-challenge-modal').classList.add('hidden');\n }\n });\n document.getElementById('spreedly-3ds-challenge').innerHTML = '';\n displayInlineError(spreedly_params.authDenied);\n\n break;\n default:\n console.log(`Event ${{threeDsStatusEvent}} not handled`)\n document.getElementById('spreedly-3ds-challenge-modal').classList.add('hidden');\n }\n}\n\n// Setup event handling and kickoff 3DSecure lifecycle\nSpreedly.on('3ds:status', on3DSstatusUpdatesFn);\n\nfunction setCookie(name, value, daysToExpire) {\n var date = new Date();\n date.setTime(date.getTime() + (daysToExpire * 24 * 60 * 60 * 1000));\n var expires = \"expires=\" + date.toUTCString();\n document.cookie = name + \"=\" + value + \";\" + expires + \";path=/\";\n}\n\nfunction getCookie(key) {\n var keyValue = document.cookie.match('(^|;) ?' + key + '=([^;]*)(;|$)');\n return keyValue ? keyValue[2] : null;\n}\nfunction getSelectedProductCookie() {\n const cookies = document.cookie.split(';');\n for (let i = 0; i < cookies.length;
18 i++) {\n let cookie = cookies[i].trim();\n\n const [name, value] = cookie.split('=');\n\n if (name.endsWith('selected_product')) {\n return value.trim();\n }\n }\n return null; // Return null if the cookie is not found\n}\n\n//# sourceURL=webpack:///./assets/js/spreedly.js?"); 19 20/***/ })
20 21 22/******/ }); 23/************************************************************************/ 24/******/ 25/******/ // startup 26/******/ // Load entry module and return exports 27/******/ // This entry module can't be inlined because the eval devtool is used. 28/******/ var __webpack_exports__ = {}; 29/******/ __webpack_modules__["./assets/js/spreedly.js"](); 30/******/ 31/******/ })() 32;
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.