{"version":3,"sources":["webpack:///js/give-stripe.js","webpack:///webpack/bootstrap 2b1ef9f3274198a44a19","webpack:///./assets/src/js/frontend/give-stripe.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","stripe","Stripe","give_stripe_vars","publishable_key","stripe_account_id","stripeAccount","document","addEventListener","e","giveStripeTriggerFloatLabels","idPrefix","form","classList","contains","Array","forEach","querySelectorAll","element","index","ccLabelSelector","querySelector","ccInnerDivSelector","ccInputSelector","ccWrapSelector","parentElement","includes","className","globalCardElements","globalElement","selector","indexOf","id","item","on","empty","complete","remove","giveStripeMountCardElements","cardElements","arguments","length","undefined","keys","card","value","isCardMounted","mount","giveStripeUnmountCardElements","unmount","giveStripePrepareCardElements","form_element","elements","prepareCardElements","baseStyles","element_base_styles","completeStyles","element_complete_styles","emptyStyles","element_empty_styles","invalidStyles","element_invalid_styles","elementStyles","base","invalid","elementClasses","focus","cc_fields_format","cardNumber","create","style","classes","placeholder","card_number_placeholder_text","event","brand","cardExpiry","cardCvc","card_cvc_placeholder_text","push","hidePostalCode","checkout_address","give_stripe_response_handler","$form","response","find","val","submit","give_stripe_process_card","additionalData","type","owner","$form_id","$form_submit_btn","card_name","attr","address1","address2","city","state","zip","country","address","line1","line2","postal_code","createSource","then","result","error","message","jQuery","fadeOut","html","give_global_vars","complete_purchase","data","source","defaultGateway","cardElementSelectors","fontStyles","preferredLocale","preferred_locale","formWraps","fontIterator","entries","element_font_styles","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_step","_iterator","Symbol","iterator","next","done","fontElement","err","return","formWrap","locale","fonts","getAttribute","donateButton","xhr","settings","setAttribute","removeAttribute","this","$idPrefix","stripe_card_update","preventDefault"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,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Q4B,OAAQqC,MAChBC,EAAYlE,EAAME,KAAM,qCAAsCC,OAE/D,WAAaH,EAAME,KAAM,8BAA+BC,OAASnF,iBAAiBmJ,sBACtF9D,EAA0BL,EAAOvD,EAAoByH,GAAY,GAAGpH,MACpEyC,EAAM6E,uBFqXH,SAAU7K,EAAQD","file":"js/give-stripe.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 5);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */,\n/* 1 */,\n/* 2 */,\n/* 3 */,\n/* 4 */,\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n__webpack_require__(6);\nmodule.exports = __webpack_require__(7);\n\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports) {\n\n/**\n * Give - Stripe Gateway Add-on JS\n */\n\nvar stripe = Stripe(give_stripe_vars.publishable_key);\nif (give_stripe_vars.stripe_account_id) {\n\tstripe = Stripe(give_stripe_vars.publishable_key, { stripeAccount: give_stripe_vars.stripe_account_id });\n}\n\ndocument.addEventListener('DOMContentLoaded', function (e) {\n\n\t// Register Variables.\n\tvar card = {};\n\tvar cardElements = [];\n\tvar defaultGateway = '';\n\tvar globalCardElements = [];\n\tvar cardElementSelectors = [];\n\tvar fontStyles = [];\n\tvar preferredLocale = give_stripe_vars.preferred_locale;\n\tvar formWraps = document.querySelectorAll('.give-form-wrap');\n\tvar fontIterator = Object.entries(give_stripe_vars.element_font_styles);\n\n\t// Loop through each font element to convert its object to array.\n\tvar _iteratorNormalCompletion = true;\n\tvar _didIteratorError = false;\n\tvar _iteratorError = undefined;\n\n\ttry {\n\t\tfor (var _iterator = fontIterator[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n\t\t\tvar fontElement = _step.value;\n\n\t\t\tfontStyles[fontElement[0]] = fontElement[1];\n\t\t}\n\n\t\t// Loop through the number of forms on the page.\n\t} catch (err) {\n\t\t_didIteratorError = true;\n\t\t_iteratorError = err;\n\t} finally {\n\t\ttry {\n\t\t\tif (!_iteratorNormalCompletion && _iterator.return) {\n\t\t\t\t_iterator.return();\n\t\t\t}\n\t\t} finally {\n\t\t\tif (_didIteratorError) {\n\t\t\t\tthrow _iteratorError;\n\t\t\t}\n\t\t}\n\t}\n\n\tArray.prototype.forEach.call(formWraps, function (formWrap) {\n\n\t\tvar form_element = formWrap.querySelector('.give-form');\n\n\t\tvar elements = stripe.elements({\n\t\t\tlocale: preferredLocale\n\t\t});\n\n\t\t// Update fonts of Stripe Elements.\n\t\tif (fontStyles.length > 0) {\n\t\t\telements = stripe.elements({\n\t\t\t\tfonts: fontStyles,\n\t\t\t\tlocale: preferredLocale\n\t\t\t});\n\t\t}\n\n\t\tif (null !== form_element.querySelector('.give-gateway:checked').value) {\n\t\t\tdefaultGateway = form_element.querySelector('.give-gateway:checked').value;\n\t\t}\n\n\t\tvar idPrefix = form_element.getAttribute('data-id');\n\t\tvar donateButton = form_element.querySelector('.give-submit');\n\n\t\t// Create Card Elements for each form.\n\t\tcardElements = giveStripePrepareCardElements(form_element, elements, idPrefix);\n\n\t\tif ('single' === give_stripe_vars.cc_fields_format) {\n\t\t\tcardElementSelectors = ['#give-stripe-single-cc-fields-'];\n\t\t} else if ('multi' === give_stripe_vars.cc_fields_format) {\n\t\t\tcardElementSelectors = ['#give-card-number-field-', '#give-card-cvc-field-', '#give-card-expiration-field-'];\n\t\t}\n\n\t\t// Prepare Card Elements for each form on a single page.\n\t\tglobalCardElements[idPrefix] = [];\n\n\t\tArray.prototype.forEach.call(cardElementSelectors, function (selector, index) {\n\t\t\tglobalCardElements[idPrefix][index] = [];\n\t\t\tglobalCardElements[idPrefix][index]['item'] = cardElements[index];\n\t\t\tglobalCardElements[idPrefix][index]['selector'] = selector;\n\t\t\tglobalCardElements[idPrefix][index]['isCardMounted'] = false;\n\t\t});\n\n\t\t// Mount and Un-Mount Stripe CC Fields on gateway load.\n\t\tjQuery(document).on('give_gateway_loaded', function (event, xhr, settings) {\n\n\t\t\t// Un-mount card elements when stripe is not the selected gateway.\n\t\t\tgiveStripeUnmountCardElements(globalCardElements[idPrefix]);\n\n\t\t\tif (form_element.querySelector('.give-gateway-option-selected .give-gateway').value === 'stripe') {\n\n\t\t\t\t// Disable the donate button of the form.\n\t\t\t\tdonateButton.setAttribute('disabled', 'disabled');\n\n\t\t\t\t// Mount card elements when stripe is the selected gateway.\n\t\t\t\tgiveStripeMountCardElements(idPrefix, globalCardElements[idPrefix]);\n\n\t\t\t\t// Enable the donate button of the form after successful mounting of CC fields.\n\t\t\t\tdonateButton.removeAttribute('disabled');\n\t\t\t}\n\n\t\t\t// Convert normal fields to float labels.\n\t\t\tgiveStripeTriggerFloatLabels(idPrefix, form_element);\n\t\t});\n\n\t\t// Mount Card Elements, if default gateway is stripe.\n\t\tif ('stripe' === defaultGateway) {\n\n\t\t\t// Disabled the donate button of the form.\n\t\t\tdonateButton.setAttribute('disabled', 'disabled');\n\n\t\t\tgiveStripeMountCardElements(idPrefix, globalCardElements[idPrefix]);\n\n\t\t\t// Enable the donate button of the form after successful mounting of CC fields.\n\t\t\tdonateButton.removeAttribute('disabled');\n\t\t} else {\n\t\t\tgiveStripeUnmountCardElements(cardElements);\n\t\t}\n\n\t\t// Convert normal fields to float labels.\n\t\tgiveStripeTriggerFloatLabels(idPrefix, form_element);\n\t});\n\n\t// Process Donation using Stripe Elements on form submission.\n\tjQuery('body').on('submit', '.give-form', function (event) {\n\n\t\tvar $form = jQuery(this);\n\t\tvar $idPrefix = $form.find('input[name=\"give-form-id-prefix\"]').val();\n\n\t\tif ('stripe' === $form.find('input.give-gateway:checked').val() || give_stripe_vars.stripe_card_update) {\n\t\t\tgive_stripe_process_card($form, globalCardElements[$idPrefix][0].item);\n\t\t\tevent.preventDefault();\n\t\t}\n\t});\n\n\t/**\n * Trigger Float Labels when enabled.\n *\n * @param {string} idPrefix ID Prefix.\n * @param {object} form Form Object.\n *\n * @since 2.0\n */\n\tfunction giveStripeTriggerFloatLabels(idPrefix, form) {\n\t\t// Process it when float labels is enabled.\n\t\tif (form.classList.contains('float-labels-enabled')) {\n\t\t\tArray.prototype.forEach.call(form.querySelectorAll('.give-stripe-cc-field-wrap'), function (element, index) {\n\t\t\t\tvar ccLabelSelector = element.querySelector('label');\n\t\t\t\tvar ccInnerDivSelector = element.querySelector('div');\n\t\t\t\tvar ccInputSelector = element.querySelector('.give-stripe-cc-field');\n\t\t\t\tvar ccWrapSelector = ccLabelSelector.parentElement;\n\n\t\t\t\tif (!Array.prototype.includes('give-fl-label', ccLabelSelector.classList)) {\n\t\t\t\t\tccLabelSelector.className = ccLabelSelector.classList + ' give-fl-label';\n\t\t\t\t}\n\n\t\t\t\tif (!Array.prototype.includes('give-fl-label', ccLabelSelector.classList)) {\n\t\t\t\t\tccInputSelector.className = ccInputSelector.classList + ' give-fl-input';\n\t\t\t\t}\n\n\t\t\t\tif (!Array.prototype.includes('give-fl-wrap give-fl-wrap-input give-fl-is-required', ccInnerDivSelector.classList)) {\n\t\t\t\t\tccInnerDivSelector.className = ccInnerDivSelector.classList + ' give-fl-wrap give-fl-wrap-input give-fl-is-required';\n\t\t\t\t}\n\n\t\t\t\tArray.prototype.forEach.call(globalCardElements[idPrefix], function (globalElement) {\n\t\t\t\t\tif (globalElement.selector.indexOf(ccInputSelector.id) > 0) {\n\t\t\t\t\t\tglobalElement.item.on('change', function (e) {\n\t\t\t\t\t\t\tif ((e.empty === false || e.complete === true) && !Array.prototype.includes('give-fl-is-active', ccWrapSelector.classList)) {\n\t\t\t\t\t\t\t\tccWrapSelector.className = ccWrapSelector.classList + ' give-fl-is-active';\n\t\t\t\t\t\t\t} else if (e.empty === true && e.complete === false) {\n\t\t\t\t\t\t\t\tccWrapSelector.classList.remove('give-fl-is-active');\n\t\t\t\t\t\t\t\tccWrapSelector.className = ccWrapSelector.classList;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n * Mount Card Elements\n *\n * @param {string} idPrefix ID Prefix.\n * @param {array} cardElements List of card elements to be mounted.\n *\n * @since 1.6\n */\n\tfunction giveStripeMountCardElements(idPrefix) {\n\t\tvar cardElements = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n\n\n\t\tvar cardElementsLength = Object.keys(cardElements).length;\n\n\t\t// Assign any card element to variable to create source.\n\t\tif (cardElementsLength > 0) {\n\t\t\tcard = cardElements[0].item;\n\t\t}\n\n\t\t// Mount required card elements.\n\t\tArray.prototype.forEach.call(cardElements, function (value, index) {\n\t\t\tif (false === value.isCardMounted) {\n\t\t\t\tvalue.item.mount(value.selector + idPrefix);\n\t\t\t\tvalue.isCardMounted = true;\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n * Un-mount Card Elements\n *\n * @param {array} cardElements List of card elements to be unmounted.\n *\n * @since 1.6\n */\n\tfunction giveStripeUnmountCardElements() {\n\t\tvar cardElements = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n\n\n\t\t// Un-mount required card elements.\n\t\tArray.prototype.forEach.call(cardElements, function (value, index) {\n\t\t\tif (true === value.isCardMounted) {\n\t\t\t\tvalue.item.unmount();\n\t\t\t\tvalue.isCardMounted = false;\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n * Create required card elements.\n *\n * @param {object} elements Stripe Element.\n * @param {object} form_element Form Element.\n * @param {string} idPrefix ID Prefix.\n *\n * @since 1.6\n *\n * @returns {array}\n */\n\tfunction giveStripePrepareCardElements(form_element, elements, idPrefix) {\n\n\t\tvar prepareCardElements = [];\n\t\tvar baseStyles = give_stripe_vars.element_base_styles;\n\t\tvar completeStyles = give_stripe_vars.element_complete_styles;\n\t\tvar emptyStyles = give_stripe_vars.element_empty_styles;\n\t\tvar invalidStyles = give_stripe_vars.element_invalid_styles;\n\n\t\tvar elementStyles = {\n\t\t\tbase: baseStyles,\n\t\t\tcomplete: completeStyles,\n\t\t\tempty: emptyStyles,\n\t\t\tinvalid: invalidStyles\n\t\t};\n\n\t\tvar elementClasses = {\n\t\t\tfocus: 'focus',\n\t\t\tempty: 'empty',\n\t\t\tinvalid: 'invalid'\n\t\t};\n\n\t\t// Mount CC Fields based on the settings.\n\t\tif ('multi' === give_stripe_vars.cc_fields_format) {\n\n\t\t\tvar cardNumber = elements.create('cardNumber', {\n\t\t\t\tstyle: elementStyles,\n\t\t\t\tclasses: elementClasses,\n\t\t\t\tplaceholder: give_stripe_vars.card_number_placeholder_text\n\t\t\t});\n\n\t\t\t// Update Card Type for Stripe Multi Fields.\n\t\t\tcardNumber.addEventListener('change', function (event) {\n\n\t\t\t\t// Workaround for class name of Diners Club Card.\n\t\t\t\tvar brand = 'diners' === event.brand ? 'dinersclub' : event.brand;\n\n\t\t\t\t// Add Brand to card type wrapper to display specific brand logo based on card number.\n\t\t\t\tform_element.querySelector('.card-type').className = 'card-type ' + brand;\n\t\t\t});\n\n\t\t\tvar cardExpiry = elements.create('cardExpiry', {\n\t\t\t\tstyle: elementStyles,\n\t\t\t\tclasses: elementClasses\n\t\t\t});\n\n\t\t\tvar cardCvc = elements.create('cardCvc', {\n\t\t\t\tstyle: elementStyles,\n\t\t\t\tclasses: elementClasses,\n\t\t\t\tplaceholder: give_stripe_vars.card_cvc_placeholder_text\n\t\t\t});\n\n\t\t\tprepareCardElements.push(cardNumber, cardCvc, cardExpiry);\n\t\t} else if ('single' === give_stripe_vars.cc_fields_format) {\n\n\t\t\tvar card = elements.create('card', {\n\t\t\t\tstyle: elementStyles,\n\t\t\t\tclasses: elementClasses,\n\t\t\t\thidePostalCode: !!give_stripe_vars.checkout_address\n\t\t\t});\n\n\t\t\tprepareCardElements.push(card);\n\t\t}\n\n\t\treturn prepareCardElements;\n\t}\n\n\t/**\n * Stripe Response Handler\n *\n * @see https://stripe.com/docs/tutorials/forms\n *\n * @param {object} $form Form Object.\n * @param {object} response Response Object containing source.\n */\n\tfunction give_stripe_response_handler($form, response) {\n\n\t\t// Add Source to hidden field for form submission.\n\t\t$form.find('input[name=\"give_stripe_source\"]').val(response.id);\n\n\t\t// Submit the form.\n\t\t$form.get(0).submit();\n\t}\n\n\t/**\n * Stripe Process CC\n *\n * @param {object} $form Form Object.\n * @param {object} card Card Object.\n *\n * @returns {boolean}\n */\n\tfunction give_stripe_process_card($form, card) {\n\n\t\tvar additionalData = {\n\t\t\ttype: 'card',\n\t\t\towner: {}\n\t\t};\n\t\tvar $form_id = $form.find('input[name=\"give-form-id\"]').val();\n\t\tvar $form_submit_btn = $form.find('[id^=give-purchase-button]');\n\t\tvar card_name = $form.find('.card-name').val();\n\n\t\t// disable the submit button to prevent repeated clicks.\n\t\t$form.find('[id^=give-purchase-button]').attr('disabled', 'disabled');\n\n\t\t// Set Card Name to Source.\n\t\tif ('multi' === give_stripe_vars.cc_fields_format && '' !== card_name) {\n\t\t\tadditionalData.owner.name = card_name;\n\t\t}\n\n\t\t// Gather additional customer data we may have collected in our form.\n\t\tif (give_stripe_vars.checkout_address) {\n\t\t\tvar address1 = $form.find('.card-address').val();\n\t\t\tvar address2 = $form.find('.card-address-2').val();\n\t\t\tvar city = $form.find('.card-city').val();\n\t\t\tvar state = $form.find('.card_state').val();\n\t\t\tvar zip = $form.find('.card-zip').val();\n\t\t\tvar country = $form.find('.billing-country').val();\n\n\t\t\tadditionalData.owner.address = {\n\t\t\t\tline1: address1 ? address1 : '',\n\t\t\t\tline2: address2 ? address2 : '',\n\t\t\t\tcity: city ? city : '',\n\t\t\t\tstate: state ? state : '',\n\t\t\t\tpostal_code: zip ? zip : '',\n\t\t\t\tcountry: country ? country : ''\n\t\t\t};\n\t\t}\n\n\t\t// createSource returns immediately - the supplied callback submits the form if there are no errors.\n\t\tstripe.createSource(card, additionalData).then(function (result) {\n\n\t\t\tif (result.error) {\n\n\t\t\t\tvar error = '

' + result.error.message + '

';\n\n\t\t\t\t// re-enable the submit button.\n\t\t\t\t$form_submit_btn.attr('disabled', false);\n\n\t\t\t\t// Hide the loading animation.\n\t\t\t\tjQuery('.give-loading-animation').fadeOut();\n\n\t\t\t\t// Display Error on the form.\n\t\t\t\t$form.find('[id^=give-stripe-payment-errors-' + $form_id + ']').html(error);\n\n\t\t\t\t// Reset Donate Button.\n\t\t\t\tif (give_global_vars.complete_purchase) {\n\t\t\t\t\t$form_submit_btn.val(give_global_vars.complete_purchase);\n\t\t\t\t} else {\n\t\t\t\t\t$form_submit_btn.val($form_submit_btn.data('before-validation-label'));\n\t\t\t\t}\n\t\t\t} else {\n\n\t\t\t\t// Send source to server for processing payment.\n\t\t\t\tgive_stripe_response_handler($form, result.source);\n\t\t\t}\n\t\t});\n\n\t\treturn false; // Submit from callback.\n\t}\n});\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports) {\n\n// removed by extract-text-webpack-plugin\n\n/***/ })\n/******/ ]);\n\n\n// WEBPACK FOOTER //\n// js/give-stripe.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 5);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 2b1ef9f3274198a44a19","/**\n * Give - Stripe Gateway Add-on JS\n */\n\nlet stripe = Stripe( give_stripe_vars.publishable_key );\nif ( give_stripe_vars.stripe_account_id ) {\n\tstripe = Stripe( give_stripe_vars.publishable_key, { stripeAccount: give_stripe_vars.stripe_account_id } );\n}\n\ndocument.addEventListener( 'DOMContentLoaded', function( e ) {\n\n\t// Register Variables.\n\tlet card = {};\n\tlet cardElements = [];\n\tlet defaultGateway = '';\n\tlet globalCardElements = [];\n\tlet cardElementSelectors = [];\n\tlet fontStyles = [];\n\tlet preferredLocale = give_stripe_vars.preferred_locale;\n\tconst formWraps = document.querySelectorAll( '.give-form-wrap' );\n\tconst fontIterator = Object.entries(give_stripe_vars.element_font_styles);\n\n\t// Loop through each font element to convert its object to array.\n\tfor ( let fontElement of fontIterator ) {\n\t\tfontStyles[fontElement[0]] = fontElement[1];\n\t}\n\n\t// Loop through the number of forms on the page.\n\tArray.prototype.forEach.call( formWraps, function( formWrap ) {\n\n\t\tconst form_element = formWrap.querySelector( '.give-form' );\n\n\t\tlet elements = stripe.elements({\n\t\t\t\tlocale: preferredLocale,\n\t\t});\n\n\t\t// Update fonts of Stripe Elements.\n\t\tif ( fontStyles.length > 0 ) {\n\t\t\telements = stripe.elements({\n\t\t\t\tfonts: fontStyles,\n\t\t\t\tlocale: preferredLocale,\n\t\t\t});\n\t\t}\n\n\t\tif ( null !== form_element.querySelector( '.give-gateway:checked' ).value ) {\n\t\t\tdefaultGateway = form_element.querySelector( '.give-gateway:checked' ).value;\n\t\t}\n\n\t\tlet idPrefix = form_element.getAttribute('data-id');\n\t\tconst donateButton = form_element.querySelector( '.give-submit' );\n\n\t\t// Create Card Elements for each form.\n\t\tcardElements = giveStripePrepareCardElements( form_element, elements, idPrefix );\n\n\t\tif ( 'single' === give_stripe_vars.cc_fields_format ) {\n\t\t\tcardElementSelectors = [ '#give-stripe-single-cc-fields-' ]\n\t\t} else if ( 'multi' === give_stripe_vars.cc_fields_format ) {\n\t\t\tcardElementSelectors = [ '#give-card-number-field-', '#give-card-cvc-field-' ,'#give-card-expiration-field-' ]\n\t\t}\n\n\t\t// Prepare Card Elements for each form on a single page.\n\t\tglobalCardElements[ idPrefix ] = [];\n\n\t\tArray.prototype.forEach.call( cardElementSelectors, function( selector, index ) {\n\t\t\tglobalCardElements[idPrefix][index] = [];\n\t\t\tglobalCardElements[idPrefix][index]['item'] = cardElements[index];\n\t\t\tglobalCardElements[idPrefix][index]['selector'] = selector;\n\t\t\tglobalCardElements[idPrefix][index]['isCardMounted'] = false;\n\t\t});\n\n\t\t// Mount and Un-Mount Stripe CC Fields on gateway load.\n\t\tjQuery( document ).on( 'give_gateway_loaded', function( event, xhr, settings ) {\n\n\t\t\t// Un-mount card elements when stripe is not the selected gateway.\n\t\t\tgiveStripeUnmountCardElements( globalCardElements[idPrefix] );\n\n\t\t\tif ( form_element.querySelector( '.give-gateway-option-selected .give-gateway').value === 'stripe' ) {\n\n\t\t\t\t// Disable the donate button of the form.\n\t\t\t\tdonateButton.setAttribute( 'disabled', 'disabled' );\n\n\t\t\t\t// Mount card elements when stripe is the selected gateway.\n\t\t\t\tgiveStripeMountCardElements( idPrefix, globalCardElements[idPrefix] );\n\n\t\t\t\t// Enable the donate button of the form after successful mounting of CC fields.\n\t\t\t\tdonateButton.removeAttribute( 'disabled' );\n\t\t\t}\n\n\t\t\t// Convert normal fields to float labels.\n\t\t\tgiveStripeTriggerFloatLabels( idPrefix, form_element );\n\n\t\t});\n\n\t\t// Mount Card Elements, if default gateway is stripe.\n\t\tif ( 'stripe' === defaultGateway ) {\n\n\t\t\t// Disabled the donate button of the form.\n\t\t\tdonateButton.setAttribute( 'disabled', 'disabled' );\n\n\t\t\tgiveStripeMountCardElements( idPrefix, globalCardElements[idPrefix] );\n\n\t\t\t// Enable the donate button of the form after successful mounting of CC fields.\n\t\t\tdonateButton.removeAttribute( 'disabled' );\n\t\t} else {\n\t\t\tgiveStripeUnmountCardElements( cardElements );\n\t\t}\n\n\t\t// Convert normal fields to float labels.\n\t\tgiveStripeTriggerFloatLabels( idPrefix, form_element );\n\n\t});\n\n\t// Process Donation using Stripe Elements on form submission.\n\tjQuery( 'body' ).on( 'submit', '.give-form', function( event ) {\n\n\t\tconst $form = jQuery( this );\n\t\tconst $idPrefix = $form.find( 'input[name=\"give-form-id-prefix\"]' ).val();\n\n\t\tif ( 'stripe' === $form.find( 'input.give-gateway:checked' ).val() || give_stripe_vars.stripe_card_update ) {\n\t\t\tgive_stripe_process_card( $form, globalCardElements[ $idPrefix ][0].item );\n\t\t\tevent.preventDefault();\n\t\t}\n\n\t});\n\n\t/**\n\t * Trigger Float Labels when enabled.\n\t *\n\t * @param {string} idPrefix ID Prefix.\n\t * @param {object} form Form Object.\n\t *\n\t * @since 2.0\n\t */\n\tfunction giveStripeTriggerFloatLabels( idPrefix, form ) {\n\t\t// Process it when float labels is enabled.\n\t\tif ( form.classList.contains( 'float-labels-enabled' ) ) {\n\t\t\tArray.prototype.forEach.call( form.querySelectorAll( '.give-stripe-cc-field-wrap' ), function( element, index ) {\n\t\t\t\tconst ccLabelSelector = element.querySelector( 'label' );\n\t\t\t\tconst ccInnerDivSelector = element.querySelector( 'div' );\n\t\t\t\tconst ccInputSelector = element.querySelector( '.give-stripe-cc-field' );\n\t\t\t\tconst ccWrapSelector = ccLabelSelector.parentElement;\n\n\t\t\t\tif ( ! Array.prototype.includes( 'give-fl-label', ccLabelSelector.classList ) ) {\n\t\t\t\t\tccLabelSelector.className = ccLabelSelector.classList + ' give-fl-label';\n\t\t\t\t}\n\n\t\t\t\tif ( ! Array.prototype.includes( 'give-fl-label', ccLabelSelector.classList ) ) {\n\t\t\t\t\tccInputSelector.className = ccInputSelector.classList + ' give-fl-input';\n\t\t\t\t}\n\n\t\t\t\tif ( ! Array.prototype.includes( 'give-fl-wrap give-fl-wrap-input give-fl-is-required', ccInnerDivSelector.classList ) ) {\n\t\t\t\t\tccInnerDivSelector.className = ccInnerDivSelector.classList + ' give-fl-wrap give-fl-wrap-input give-fl-is-required';\n\t\t\t\t}\n\n\t\t\t\tArray.prototype.forEach.call( globalCardElements[ idPrefix ], function( globalElement ) {\n\t\t\t\t\tif ( globalElement.selector.indexOf( ccInputSelector.id ) > 0 ) {\n\t\t\t\t\t\tglobalElement.item.on( 'change', function( e ) {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t( e.empty === false || e.complete === true ) &&\n\t\t\t\t\t\t\t\t! Array.prototype.includes( 'give-fl-is-active', ccWrapSelector.classList )\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tccWrapSelector.className = ccWrapSelector.classList + ' give-fl-is-active';\n\t\t\t\t\t\t\t} else if ( e.empty === true && e.complete === false) {\n\t\t\t\t\t\t\t\tccWrapSelector.classList.remove( 'give-fl-is-active' );\n\t\t\t\t\t\t\t\tccWrapSelector.className = ccWrapSelector.classList;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Mount Card Elements\n\t *\n\t * @param {string} idPrefix ID Prefix.\n\t * @param {array} cardElements List of card elements to be mounted.\n\t *\n\t * @since 1.6\n\t */\n\tfunction giveStripeMountCardElements( idPrefix, cardElements = [] ) {\n\n\t\tvar cardElementsLength = Object.keys( cardElements ).length;\n\n\t\t// Assign any card element to variable to create source.\n\t\tif ( cardElementsLength > 0 ) {\n\t\t\tcard = cardElements[0].item;\n\t\t}\n\n\t\t// Mount required card elements.\n\t\tArray.prototype.forEach.call( cardElements, function( value, index ) {\n\t\t\tif ( false === value.isCardMounted ) {\n\t\t\t\tvalue.item.mount( value.selector + idPrefix );\n\t\t\t\tvalue.isCardMounted = true;\n\t\t\t}\n\t\t});\n\n\t}\n\n\t/**\n\t * Un-mount Card Elements\n\t *\n\t * @param {array} cardElements List of card elements to be unmounted.\n\t *\n\t * @since 1.6\n\t */\n\tfunction giveStripeUnmountCardElements( cardElements = [] ) {\n\n\t\t// Un-mount required card elements.\n\t\tArray.prototype.forEach.call( cardElements, function( value, index ) {\n\t\t\tif ( true === value.isCardMounted ) {\n\t\t\t\tvalue.item.unmount();\n\t\t\t\tvalue.isCardMounted = false;\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Create required card elements.\n\t *\n\t * @param {object} elements Stripe Element.\n\t * @param {object} form_element Form Element.\n\t * @param {string} idPrefix ID Prefix.\n\t *\n\t * @since 1.6\n\t *\n\t * @returns {array}\n\t */\n\tfunction giveStripePrepareCardElements( form_element, elements, idPrefix ) {\n\n\t\tvar prepareCardElements = [];\n\t\tvar baseStyles = give_stripe_vars.element_base_styles;\n\t\tvar completeStyles = give_stripe_vars.element_complete_styles;\n\t\tvar emptyStyles = give_stripe_vars.element_empty_styles;\n\t\tvar invalidStyles = give_stripe_vars.element_invalid_styles;\n\n\t\tvar elementStyles = {\n\t\t\tbase: baseStyles,\n\t\t\tcomplete: completeStyles,\n\t\t\tempty: emptyStyles,\n\t\t\tinvalid: invalidStyles,\n\t\t};\n\n\t\tvar elementClasses = {\n\t\t\tfocus: 'focus',\n\t\t\tempty: 'empty',\n\t\t\tinvalid: 'invalid',\n\t\t};\n\n\t\t// Mount CC Fields based on the settings.\n\t\tif ( 'multi' === give_stripe_vars.cc_fields_format ) {\n\n\t\t\tvar cardNumber = elements.create(\n\t\t\t\t'cardNumber',\n\t\t\t\t{\n\t\t\t\t\tstyle: elementStyles,\n\t\t\t\t\tclasses: elementClasses,\n\t\t\t\t\tplaceholder: give_stripe_vars.card_number_placeholder_text,\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// Update Card Type for Stripe Multi Fields.\n\t\t\tcardNumber.addEventListener('change', function (event) {\n\n\t\t\t\t// Workaround for class name of Diners Club Card.\n\t\t\t\tvar brand = ('diners' === event.brand) ? 'dinersclub' : event.brand;\n\n\t\t\t\t// Add Brand to card type wrapper to display specific brand logo based on card number.\n\t\t\t\tform_element.querySelector('.card-type').className = 'card-type ' + brand;\n\t\t\t});\n\n\t\t\tvar cardExpiry = elements.create(\n\t\t\t\t'cardExpiry',\n\t\t\t\t{\n\t\t\t\t\tstyle: elementStyles,\n\t\t\t\t\tclasses: elementClasses,\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tvar cardCvc = elements.create(\n\t\t\t\t'cardCvc',\n\t\t\t\t{\n\t\t\t\t\tstyle: elementStyles,\n\t\t\t\t\tclasses: elementClasses,\n\t\t\t\t\tplaceholder: give_stripe_vars.card_cvc_placeholder_text,\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tprepareCardElements.push( cardNumber, cardCvc, cardExpiry );\n\n\t\t} else if ('single' === give_stripe_vars.cc_fields_format) {\n\n\t\t\tvar card = elements.create(\n\t\t\t\t'card',\n\t\t\t\t{\n\t\t\t\t\tstyle: elementStyles,\n\t\t\t\t\tclasses: elementClasses,\n\t\t\t\t\thidePostalCode: !!(give_stripe_vars.checkout_address),\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tprepareCardElements.push( card );\n\n\t\t}\n\n\t\treturn prepareCardElements;\n\n\t}\n\n\t/**\n\t * Stripe Response Handler\n\t *\n\t * @see https://stripe.com/docs/tutorials/forms\n\t *\n\t * @param {object} $form Form Object.\n\t * @param {object} response Response Object containing source.\n\t */\n\tfunction give_stripe_response_handler( $form, response ) {\n\n\t\t// Add Source to hidden field for form submission.\n\t\t$form.find( 'input[name=\"give_stripe_source\"]' ).val( response.id );\n\n\t\t// Submit the form.\n\t\t$form.get(0).submit();\n\n\t}\n\n\t/**\n\t * Stripe Process CC\n\t *\n\t * @param {object} $form Form Object.\n\t * @param {object} card Card Object.\n\t *\n\t * @returns {boolean}\n\t */\n\tfunction give_stripe_process_card( $form, card ) {\n\n\t\tlet additionalData = {\n\t\t\ttype: 'card',\n\t\t\towner: {},\n\t\t};\n\t\tlet $form_id = $form.find( 'input[name=\"give-form-id\"]').val();\n\t\tlet $form_submit_btn = $form.find('[id^=give-purchase-button]');\n\t\tconst card_name = $form.find( '.card-name').val();\n\n\t\t// disable the submit button to prevent repeated clicks.\n\t\t$form.find('[id^=give-purchase-button]').attr('disabled', 'disabled');\n\n\t\t// Set Card Name to Source.\n\t\tif ( 'multi' === give_stripe_vars.cc_fields_format && '' !== card_name ) {\n\t\t\tadditionalData.owner.name = card_name;\n\t\t}\n\n\t\t// Gather additional customer data we may have collected in our form.\n\t\tif ( give_stripe_vars.checkout_address ) {\n\t\t\tconst address1 = $form.find( '.card-address').val();\n\t\t\tconst address2 = $form.find( '.card-address-2').val();\n\t\t\tconst city = $form.find( '.card-city').val();\n\t\t\tconst state = $form.find( '.card_state').val();\n\t\t\tconst zip = $form.find( '.card-zip').val();\n\t\t\tconst country = $form.find( '.billing-country').val();\n\n\t\t\tadditionalData.owner.address = {\n\t\t\t\tline1: address1 ? address1 : '',\n\t\t\t\tline2: address2 ? address2 : '',\n\t\t\t\tcity: city ? city : '',\n\t\t\t\tstate: state ? state : '',\n\t\t\t\tpostal_code: zip ? zip : '',\n\t\t\t\tcountry: country ? country : '',\n\t\t\t};\n\t\t}\n\n\t\t// createSource returns immediately - the supplied callback submits the form if there are no errors.\n\t\tstripe.createSource( card, additionalData ).then( function( result ) {\n\n\t\t\tif ( result.error ) {\n\n\t\t\t\tvar error = '

' + result.error.message + '

';\n\n\t\t\t\t// re-enable the submit button.\n\t\t\t\t$form_submit_btn.attr( 'disabled', false );\n\n\t\t\t\t// Hide the loading animation.\n\t\t\t\tjQuery( '.give-loading-animation' ).fadeOut();\n\n\t\t\t\t// Display Error on the form.\n\t\t\t\t$form.find( '[id^=give-stripe-payment-errors-' + $form_id + ']' ).html( error );\n\n\t\t\t\t// Reset Donate Button.\n\t\t\t\tif ( give_global_vars.complete_purchase ) {\n\t\t\t\t\t$form_submit_btn.val( give_global_vars.complete_purchase );\n\t\t\t\t} else {\n\t\t\t\t\t$form_submit_btn.val( $form_submit_btn.data( 'before-validation-label' ) );\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// Send source to server for processing payment.\n\t\t\t\tgive_stripe_response_handler( $form, result.source );\n\t\t\t}\n\t\t});\n\n\t\treturn false; // Submit from callback.\n\t}\n\n});\n\n\n\n// WEBPACK FOOTER //\n// ./assets/src/js/frontend/give-stripe.js"],"sourceRoot":""}