on-demand release 4.0dev+
[moodle.git] / payment / amd / build / modal_gateways.min.js.map
... / ...
CommitLineData
1{"version":3,"sources":["../src/modal_gateways.js"],"names":["registered","SELECTORS","PROCEED_BUTTON","CANCEL_BUTTON","ModalGateways","root","getModal","on","CustomEvents","events","activate","e","data","proceedEvent","$","Event","PaymentEvents","proceed","getRoot","trigger","isDefaultPrevented","hide","originalEvent","preventDefault","cancelEvent","ModalEvents","cancel","Modal","TYPE","ModalRegistry","register"],"mappings":"gRAuBA,OACA,OACA,OACA,OACA,OACA,O,igEAEIA,CAAAA,CAAU,G,CACRC,CAAS,CAAG,CACdC,cAAc,CAAE,2BADF,CAEdC,aAAa,CAAE,0BAFD,C,CAKGC,C,+BAOjB,WAAYC,CAAZ,CAAkB,8BACRA,CADQ,CAEjB,C,0EAOwB,YAErB,2DAEA,KAAKC,QAAL,GAAgBC,EAAhB,CAAmBC,UAAaC,MAAb,CAAoBC,QAAvC,CAAiDT,CAAS,CAACC,cAA3D,CAA2E,SAACS,CAAD,CAAIC,CAAJ,CAAa,CACpF,GAAIC,CAAAA,CAAY,CAAGC,UAAEC,KAAF,CAAQC,UAAcC,OAAtB,CAAnB,CACA,CAAI,CAACC,OAAL,GAAeC,OAAf,CAAuBN,CAAvB,CAAqC,CAArC,EAEA,GAAI,CAACA,CAAY,CAACO,kBAAb,EAAL,CAAwC,CACpC,CAAI,CAACC,IAAL,GACAT,CAAI,CAACU,aAAL,CAAmBC,cAAnB,EACH,CACJ,CARD,EAUA,KAAKjB,QAAL,GAAgBC,EAAhB,CAAmBC,UAAaC,MAAb,CAAoBC,QAAvC,CAAiDT,CAAS,CAACE,aAA3D,CAA0E,SAACQ,CAAD,CAAIC,CAAJ,CAAa,CACnF,GAAIY,CAAAA,CAAW,CAAGV,UAAEC,KAAF,CAAQU,UAAYC,MAApB,CAAlB,CACA,CAAI,CAACR,OAAL,GAAeC,OAAf,CAAuBK,CAAvB,CAAoC,CAApC,EAEA,GAAI,CAACA,CAAW,CAACJ,kBAAZ,EAAL,CAAuC,CACnC,CAAI,CAACC,IAAL,GACAT,CAAI,CAACU,aAAL,CAAmBC,cAAnB,EACH,CACJ,CARD,CASH,C,cAvCsCI,S,cA0C3CvB,CAAa,CAACwB,IAAd,CAAqB,6BAArB,CAIA,GAAI,CAAC5B,CAAL,CAAiB,CACb6B,UAAcC,QAAd,CAAuB1B,CAAa,CAACwB,IAArC,CAA2CxB,CAA3C,CAA0D,6BAA1D,EACAJ,CAAU,GACb,C","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Contain the logic for the gateways modal: A modal with proceed and cancel buttons.\n *\n * @module core_payment/modal_gateways\n * @copyright 2020 Shamim Rezaie <shamim@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport $ from 'jquery';\nimport CustomEvents from 'core/custom_interaction_events';\nimport Modal from 'core/modal';\nimport ModalEvents from 'core/modal_events';\nimport PaymentEvents from 'core_payment/events';\nimport ModalRegistry from 'core/modal_registry';\n\nlet registered = false;\nconst SELECTORS = {\n PROCEED_BUTTON: '[data-action=\"proceed\"]',\n CANCEL_BUTTON: '[data-action=\"cancel\"]',\n};\n\nexport default class ModalGateways extends Modal {\n\n /**\n * Constructor for the Modal.\n *\n * @param {object} root The root jQuery element for the modal\n */\n constructor(root) {\n super(root);\n }\n\n /**\n * Set up all of the event handling for the modal.\n *\n * @method registerEventListeners\n */\n registerEventListeners() {\n // Apply parent event listeners.\n super.registerEventListeners();\n\n this.getModal().on(CustomEvents.events.activate, SELECTORS.PROCEED_BUTTON, (e, data) => {\n var proceedEvent = $.Event(PaymentEvents.proceed);\n this.getRoot().trigger(proceedEvent, this);\n\n if (!proceedEvent.isDefaultPrevented()) {\n this.hide();\n data.originalEvent.preventDefault();\n }\n });\n\n this.getModal().on(CustomEvents.events.activate, SELECTORS.CANCEL_BUTTON, (e, data) => {\n var cancelEvent = $.Event(ModalEvents.cancel);\n this.getRoot().trigger(cancelEvent, this);\n\n if (!cancelEvent.isDefaultPrevented()) {\n this.hide();\n data.originalEvent.preventDefault();\n }\n });\n }\n}\n\nModalGateways.TYPE = 'core_payment-modal_gateways';\n\n// Automatically register with the modal registry the first time this module is imported so that you can create modals\n// of this type using the modal factory.\nif (!registered) {\n ModalRegistry.register(ModalGateways.TYPE, ModalGateways, 'core_payment/modal_gateways');\n registered = true;\n}\n"],"file":"modal_gateways.min.js"}