authentication-popup.js 1010 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /**
  2. * Copyright © Magento, Inc. All rights reserved.
  3. * See COPYING.txt for license details.
  4. */
  5. define([
  6. 'jquery',
  7. 'Magento_Ui/js/modal/modal'
  8. ], function ($, modal) {
  9. 'use strict';
  10. return {
  11. modalWindow: null,
  12. /**
  13. * Create popUp window for provided element
  14. *
  15. * @param {HTMLElement} element
  16. */
  17. createPopUp: function (element) {
  18. var options = {
  19. 'type': 'popup',
  20. 'modalClass': 'popup-authentication',
  21. 'focus': '[name=username]',
  22. 'responsive': true,
  23. 'innerScroll': true,
  24. 'trigger': '.proceed-to-checkout',
  25. 'buttons': []
  26. };
  27. this.modalWindow = element;
  28. modal(options, $(this.modalWindow));
  29. },
  30. /** Show login popup window */
  31. showModal: function () {
  32. $(this.modalWindow).modal('openModal').trigger('contentUpdated');
  33. }
  34. };
  35. });