{"version":3,"file":"js/splits/account.js","sources":["webpack:///./org_colony/cartridge/js/giftcert.js","webpack:///./org_colony/cartridge/js/login.js","webpack:///./org_colony/cartridge/js/paymentutils.js"],"sourcesContent":["const ajax = require('./ajax');\nconst minicart = require('./minicart');\nconst util = require('./util');\n\nconst setAddToCartHandler = (event) => {\n event.preventDefault();\n const form = $(event.currentTarget).closest('form');\n\n const options = {\n url: util.ajaxUrl(form.attr('action')),\n method: 'POST',\n cache: false,\n data: form.serialize(),\n };\n $.ajax(options).done((data) => {\n if (data.success) {\n ajax.load({\n url: Urls.minicartGC,\n data: {lineItemId: data.result.lineItemId},\n callback(response) {\n minicart.show(response);\n form.find('input,textarea').val('');\n },\n });\n } else {\n form.find('span.error').hide();\n Object.keys(data.errors.FormErrors).forEach((id) => {\n let $errorEl = $(`#${id}`).addClass('error').removeClass('valid').next('.error');\n if (!$errorEl || $errorEl.length === 0) {\n $errorEl = $(``);\n $(`#${id}`).after($errorEl);\n }\n $errorEl.text(data.errors.FormErrors[id].replace(/\\\\'/g, '\\'')).show();\n });\n }\n }).fail((xhr, textStatus) => {\n if (textStatus === 'parsererror') {\n window.alert(Resources.BAD_RESPONSE);\n } else {\n window.alert(Resources.SERVER_CONNECTION_ERROR);\n }\n });\n};\n\nexports.init = () => {\n $('#AddToBasketButton').on('click', setAddToCartHandler);\n};\n","const dialog = require('./dialog');\nconst page = require('./page');\nconst util = require('./util');\nconst validator = require('./validator');\n\nconst login = {\n /**\n * @private\n * @function\n * @description init events for the loginPage\n */\n init() {\n // o-auth binding for which icon is clicked\n $('.oAuthIcon').bind('click', (event) => {\n $('#OAuthProvider').val(event.currentTarget.id);\n });\n\n // toggle the value of the rememberme checkbox\n $('#dwfrm_login_rememberme').bind('change', () => {\n if ($('#dwfrm_login_rememberme').attr('checked')) {\n $('#rememberme').val('true');\n } else {\n $('#rememberme').val('false');\n }\n });\n\n const $passwordReset = $('#password-reset');\n $passwordReset.on('click', (e) => {\n e.preventDefault();\n const $target = $(e.target);\n const isLegacy = $target.hasClass('legacy');\n const url = $target.attr('href');\n dialog.open({\n url: isLegacy ? util.appendParamToURL(url, 'email', $('.email input').val()) : url,\n options: {\n title: isLegacy ? Resources.TITLE_FORGOTPASSWORDLEGACY : Resources.TITLE_FORGOTPASSWORD,\n dialogClass: 'ui-dialog-resetpass',\n height: 'auto',\n open() {\n validator.init();\n const $requestPasswordForm = $('[name$=\"_requestpassword\"]');\n const $submit = $requestPasswordForm.find('[name$=\"_requestpassword_send\"]');\n $($submit).on('click', (event) => {\n if (!$requestPasswordForm.valid()) {\n return;\n }\n event.preventDefault();\n let data = $requestPasswordForm.serialize();\n // add form action to data\n data += `&${$submit.attr('name')}=`;\n // make sure the server knows this is an ajax request\n if (data.indexOf('ajax') === -1) {\n data += '&format=ajax';\n }\n $.ajax({\n type: 'POST',\n url: $requestPasswordForm.attr('action'),\n data,\n success(response) {\n if (typeof response === 'object'\n && !response.success\n && response.error === 'CSRF Token Mismatch') {\n page.redirect(Urls.csrffailed);\n } else if (typeof response === 'string') {\n dialog.$container.html(response);\n }\n },\n failure() {\n dialog.$container.html(`