{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./js/packages/utils/src/legacy.js","webpack:///external \"jQuery\""],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","$","window","spShared","init","document","body","find","on","e","validateAndUpdateAmountInput","this","unformatCurrency","amount","Math","abs","accounting","unformat","spGeneral","strings","decimalSeparator","formatCurrency","includeSymbol","args","format","currencyPosition","symbol","currencySymbol","decimal","thousand","thousandSeparator","precision","integers","decimalPlaces","formatMoney","convertToDollars","booleans","isZeroDecimal","toFixed","convertToCents","Number","el","val","globalMinAmount","minAmount","hasClass","type","debugLog","scriptDebug","console","log","ready","jQuery"],"mappings":"aACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QAKfF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO,KAQvDrB,EAAoBsB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQrB,EAAoBqB,IAC/B,EAAPE,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AUX,UAAUC,QAAQW,kBAC5BC,UAAWb,UAAUc,SAASC,cAC9BT,OAAQA,GAGFR,WAAWkB,YAAarB,EAAQU,IASxCY,iBAAkB,SAAUtB,GAK3B,OAJOK,UAAUkB,SAASC,gBACzBxB,EAASG,WAAWsB,QAASzB,EAAS,IAAK,IAGrCA,GASR0B,eAAgB,SAAU1B,GAKzB,OAJOK,UAAUkB,SAASC,gBACzBxB,EAAS2B,OAAQxB,WAAWsB,QAAkB,IAATzB,EAAc,KAG7CA,GAWRH,6BAA8B,SAAU+B,GAEvC,IAAI5B,EAAS4B,EAAGC,MAEZC,EAAkB7B,KAAKC,IAAKG,UAAUc,SAASY,WAGnD/B,EAASV,SAASS,iBAAkBC,GAK/B4B,EAAGI,SAAU,8BACZ,IAAMhC,EACV4B,EAAGC,IAAK,KAQLD,EAAGI,SAAU,mCACZhC,EAAS8B,IACb9B,EAAS8B,GAKX9B,EAASV,SAASkB,eAAgBR,GAAQ,GAIrC,WAAa4B,EAAG,GAAGK,MACvBL,EAAGC,IAAK7B,KASVkC,SAAU,SAAUvD,EAAKN,GAEjB,oBAAuBgC,YAAiB,IAASA,UAAUkB,SAASY,aAC1EC,QAAQC,IAAK1D,EAAKN,KAKrBe,EAAGI,UAAW8C,OAAO,SAAUlD,GAC9BC,OAAOC,SAASC,UAlKhB,CAqKCgD,K,mCCvKHpF,EAAOD,QAAUqF","file":"simpay-public-shared.min.js","sourcesContent":[" \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, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\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\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 330);\n","/* global spGeneral, jQuery, accounting */\n\n( function( $ ) {\n\t'use strict';\n\n\tvar body;\n\n\twindow.spShared = {\n\n\t\tinit: function() {\n\t\t\tbody = $( document.body );\n\n\t\t\t// Validate & update amount input fields on focus out (blur).\n\t\t\tbody.find( '.simpay-amount-input' ).on( 'blur.validateAndUpdateAmount', function( e ) {\n\t\t\t\tspShared.validateAndUpdateAmountInput( $( this ) );\n\t\t\t} );\n\t\t},\n\n\t\t/**\n\t\t * Return amount as number value.\n\t\t * Uses global decimal separator setting (\".\" or \",\").\n\t\t * accounting.unformat removes formatting/cruft first.\n\t\t * Respects decimal separator, but ignores zero decimal currency setting.\n\t\t * Also prevent negative values.\n\t\t * @returns number\n\t\t */\n\t\tunformatCurrency: function( amount ) {\n\t\t\treturn Math.abs( accounting.unformat( amount, spGeneral.strings.decimalSeparator ) );\n\t\t},\n\n\t\t/**\n\t\t * Return amount as formatted string.\n\t\t * With or without currency symbol.\n\t\t * Used for labels & amount inputs in admin & front-end.\n\t\t * Uses global currency settings.\n\t\t * @returns string\n\t\t */\n\t\tformatCurrency: function( amount, includeSymbol ) {\n\n\t\t\t// Default format is to the left with no space.\n\t\t\tvar format = '%s%v',\n\t\t\t\targs;\n\n\t\t\t// Include symbol param = false if omitted.\n\t\t\tincludeSymbol = includeSymbol || false;\n\n\t\t\tif ( includeSymbol ) {\n\n\t\t\t\t// Account for other symbol placement formats (besides default left without space).\n\t\t\t\tswitch ( spGeneral.strings.currencyPosition ) {\n\n\t\t\t\t\tcase 'left_space':\n\t\t\t\t\t\tformat = '%s %v'; // Left side with space\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'right':\n\t\t\t\t\t\tformat = '%v%s'; // Right side without space\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'right_space':\n\t\t\t\t\t\tformat = '%v %s'; // Right side with space\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\targs = {\n\t\t\t\tsymbol: includeSymbol ? spGeneral.strings.currencySymbol : '',\n\t\t\t\tdecimal: spGeneral.strings.decimalSeparator,\n\t\t\t\tthousand: spGeneral.strings.thousandSeparator,\n\t\t\t\tprecision: spGeneral.integers.decimalPlaces,\n\t\t\t\tformat: format\n\t\t\t};\n\n\t\t\treturn accounting.formatMoney( amount, args );\n\t\t},\n\n\t\t/**\n\t\t * Convert from cents to dollars (in USD).\n\t\t * Uses global zero decimal currency setting.\n\t\t * Leaves zero decimal currencies alone.\n\t\t * @returns number\n\t\t */\n\t\tconvertToDollars: function( amount ) {\n\t\t\tif ( ! spGeneral.booleans.isZeroDecimal ) {\n\t\t\t\tamount = accounting.toFixed( amount / 100, 2 );\n\t\t\t}\n\n\t\t\treturn amount;\n\t\t},\n\n\t\t/**\n\t\t * Convert from dollars to cents (in USD).\n\t\t * Uses global zero decimal currency setting.\n\t\t * Leaves zero decimal currencies alone.\n\t\t * @returns number\n\t\t */\n\t\tconvertToCents: function( amount ) {\n\t\t\tif ( ! spGeneral.booleans.isZeroDecimal ) {\n\t\t\t\tamount = Number( accounting.toFixed( amount * 100, 0 ) );\n\t\t\t}\n\n\t\t\treturn amount;\n\t\t},\n\n\t\t/**\n\t\t * Validate amount field client-side and update according to rules set by CSS classes.\n\t\t * Some fields display blank instead of \"0.00\" or \"0\".\n\t\t * Some fields require a minimum of \"1.00\" or \"100\" (100 currency units).\n\t\t * Invalid characters and the negative symbol will be removed.\n\t\t *\n\t\t * @param {jQuery} Input to validate.\n\t\t */\n\t\tvalidateAndUpdateAmountInput: function( el ) {\n\t\t\t// Amount is intially a string.\n\t\t\tvar amount = el.val();\n\n\t\t\tvar globalMinAmount = Math.abs( spGeneral.integers.minAmount );\n\n\t\t\t// Convert amount to number value.\n\t\t\tamount = spShared.unformatCurrency( amount );\n\n\t\t\t// Update amount field to blank if specific class is present.\n\t\t\t// If zero, convert to blank and exit function.\n\t\t\t// Ex: Default Custom Amount, Setup Fee\n\t\t\tif ( el.hasClass( 'simpay-allow-blank-amount' ) ) {\n\t\t\t\tif ( 0 === amount ) {\n\t\t\t\t\tel.val( '' );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Validate & update fields to the global minimum amount (usually $1.00) if specific class is present.\n\t\t\t// Namely this is just on admin pages, separate from the custom amount minimum amount set per form.\n\t\t\t// Ex: One-Time Amount, Minimum Custom Amount\n\t\t\tif ( el.hasClass( 'simpay-minimum-amount-required' ) ) {\n\t\t\t\tif ( amount < globalMinAmount ) {\n\t\t\t\t\tamount = globalMinAmount;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Convert amount back to string with proper thousands & decimal separators, but without symbol.\n\t\t\tamount = spShared.formatCurrency( amount, false );\n\n\t\t\t// Update format price string in input field.\n\t\t\t// Exception: If they changed to 'number' type via filters don't reformat (default type is 'tel').\n\t\t\tif ( 'number' !== el[0].type ) {\n\t\t\t\tel.val( amount );\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Log debug messages to console.\n\t\t * Alternative to console.log so doesn't show up in production environments.\n\t\t * Instead, only if SCRIPT_DEBUG PHP constant set to true.\n\t\t */\n\t\tdebugLog: function( key, value ) {\n\n\t\t\tif ( ( 'undefined' !== typeof spGeneral ) && ( true === spGeneral.booleans.scriptDebug ) ) {\n\t\t\t\tconsole.log( key, value );\n\t\t\t}\n\t\t}\n\t};\n\n\t$( document ).ready( function( $ ) {\n\t\twindow.spShared.init();\n\t} );\n\n}( jQuery ) );\n","module.exports = jQuery;"],"sourceRoot":""}