Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 
 

68 rindas
1.9 KiB

  1. /**
  2. * Copyright © Magento, Inc. All rights reserved.
  3. * See COPYING.txt for license details.
  4. */
  5. define([
  6. 'uiComponent',
  7. 'jquery',
  8. 'Magento_AdobeIms/js/action/authorization'
  9. ], function (Component, $, login) {
  10. 'use strict';
  11. return Component.extend({
  12. defaults: {
  13. loginConfig: {
  14. url: 'https://ims-na1-stg.adobelogin.com/ims/authorize',
  15. callbackParsingParams: {
  16. regexpPattern: /auth\[code=(success|error);message=(.+)\]/,
  17. codeIndex: 1,
  18. messageIndex: 2,
  19. nameIndex: 3,
  20. successCode: 'success',
  21. errorCode: 'error'
  22. },
  23. popupWindowParams: {
  24. width: 500,
  25. height: 600,
  26. top: 100,
  27. left: 300
  28. },
  29. popupWindowTimeout: 60000
  30. }
  31. },
  32. /**
  33. * @override
  34. */
  35. initialize: function () {
  36. this._super();
  37. this.login();
  38. },
  39. /**
  40. * Open popup for Adobe reauth
  41. *
  42. * @return {window.Promise}
  43. */
  44. login: function () {
  45. var deferred = $.Deferred(),
  46. loginConfig = this.loginConfig;
  47. $('input.ims_verification').on('click', function () {
  48. login(loginConfig)
  49. .then(function (response) {
  50. if (response.isAuthorized === true) {
  51. $('input.ims_verified').val(true);
  52. }
  53. deferred.resolve(response);
  54. })
  55. .fail(function (error) {
  56. deferred.reject(error);
  57. });
  58. });
  59. return deferred.promise();
  60. }
  61. });
  62. });