{"version":3,"file":"js/splits/wishlist.js","sources":["webpack:///./org_colony/cartridge/js/login.js","webpack:///./org_colony/cartridge/js/pages/login/mfaDialog.js","webpack:///./org_colony/cartridge/js/pages/wishlist.js"],"sourcesContent":["const dialog = require('./dialog');\nconst page = require('./page');\nconst util = require('./util');\nconst validator = require('./validator');\nconst mfaDialog = require('./pages/login/mfaDialog');\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(`<h1>${Resources.SERVER_ERROR}</h1>`);\n                                },\n                            });\n                        });\n                    },\n                },\n            });\n        });\n\n        // Trigger password reset dialog if marked as legacy\n        if ($passwordReset.hasClass('legacy')) {\n            $passwordReset.click();\n        }\n\n        const $mfaDialogTarget = $(mfaDialog.MFA_DIALOG_SELECTOR);\n        if ($mfaDialogTarget.length) {\n            mfaDialog.openMfaDialog();\n            mfaDialog.handleKeyPress();\n        }\n    },\n};\n\nmodule.exports = login;\n","const dialog = require('../../dialog');\nconst validator = require('../../validator');\n\nconst MFA_DIALOG_SELECTOR = '#mfa-dialog';\nconst MFA_INPUT_SELECTOR = '#dwfrm_login_otp';\nconst VERIFY_OTP_SELECTOR = '#cta-verifyotp';\n\nconst $body = $('body');\n\nfunction handleKeyPress() {\n    $body.on('keypress', MFA_INPUT_SELECTOR, (event) => {\n        if (event.key === 'Enter') {\n            // Prevent default form submission\n            event.preventDefault();\n\n            // Focus and Trigger click event on submit button\n            $(VERIFY_OTP_SELECTOR).trigger('focus').trigger('click');\n        }\n    });\n}\n\nfunction openMfaDialog() {\n    const $mfaDialogContainer = $(MFA_DIALOG_SELECTOR);\n    const mfaDialogUrl = $mfaDialogContainer.attr('href');\n    dialog.open({\n        url: mfaDialogUrl,\n        options: {\n            title: Resources.AUTHENTICATION,\n            width: 300,\n            draggable: false,\n            modal: true,\n            closeOnEscape: false,\n            dialogClass: 'no-close',\n            open() {\n                validator.init();\n                document.getElementById(MFA_INPUT_SELECTOR).focus();\n            },\n            beforeClose() {\n                // Prevent closing when clicking outside\n                return false;\n            },\n        },\n    });\n}\n\nmodule.exports = {\n    MFA_DIALOG_SELECTOR,\n    openMfaDialog,\n    handleKeyPress,\n};\n","const addProductToCart = require('./product/addToCart');\nconst page = require('../page');\nconst login = require('../login');\nconst productUtil = require('./product/productUtil');\nconst util = require('../util');\n\nexports.init = () => {\n    addProductToCart();\n    $('#editAddress').on('change', (event) => {\n        page.redirect(util.appendParamToURL(Urls.wishlistAddress, 'AddressID', $(event.currentTarget).val()));\n    });\n\n    // add js logic to remove the , from the qty feild to pass regex expression on client side\n    $('.option-quantity-desired input').on('focusout', (event) => {\n        $(event.currentTarget).val($(event.currentTarget).val().replace(',', ''));\n    });\n\n    login.init();\n\n    if ($('.item-list').hasClass('limit-error')) {\n        productUtil.showLimitErrorDialog();\n        // Remove limit error from query string to prevent it from showing on page refresh\n        if (window.history !== undefined && window.history.replaceState !== undefined) {\n            window.history.replaceState({}, document.title, window.location.pathname);\n        }\n    }\n};\n"],"mappings":";;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;;;;;;;;;;AC3FA;AACA;AAEA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACjDA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;A","sourceRoot":""}