website-rule.js 855 B

12345678910111213141516171819202122232425262728293031
  1. /**
  2. * Copyright © Magento, Inc. All rights reserved.
  3. * See COPYING.txt for license details.
  4. */
  5. define([
  6. 'uiClass'
  7. ], function (Element) {
  8. 'use strict';
  9. return Element.extend({
  10. defaults: {
  11. scopeConfig: {}
  12. },
  13. /**
  14. * Takes website id from current customer data and compare it with current website id
  15. * If customer belongs to another scope, we need to invalidate current section
  16. *
  17. * @param {Object} customerData
  18. */
  19. process: function (customerData) {
  20. var customer = customerData.get('customer');
  21. if (this.scopeConfig && customer() &&
  22. ~~customer().websiteId !== ~~this.scopeConfig.websiteId && ~~customer().websiteId !== 0) {
  23. customerData.reload(['customer']);
  24. }
  25. }
  26. });
  27. });