|
| 1 | +diff --git a/view/frontend/templates/js/customer-data.phtml b/view/frontend/templates/js/customer-data.phtml |
| 2 | +index 0373b7b..5f79720 100644 |
| 3 | +--- a/view/frontend/templates/js/customer-data.phtml |
| 4 | ++++ b/view/frontend/templates/js/customer-data.phtml |
| 5 | +@@ -6,15 +6,14 @@ |
| 6 | + |
| 7 | + /** @var \Magento\Customer\Block\CustomerData $block */ |
| 8 | + ?> |
| 9 | +-<script type="text/x-magento-init"> |
| 10 | +-<?= /* @noEscape */ $this->helper(\Magento\Framework\Json\Helper\Data::class)->jsonEncode([ |
| 11 | +- '*' => ['Magento_Customer/js/customer-data' => [ |
| 12 | +- 'sectionLoadUrl' => $block->getCustomerDataUrl('customer/section/load'), |
| 13 | +- 'expirableSectionLifetime' => $block->getExpirableSectionLifetime(), |
| 14 | +- 'expirableSectionNames' => $block->getExpirableSectionNames(), |
| 15 | +- 'cookieLifeTime' => $block->getCookieLifeTime(), |
| 16 | +- 'updateSessionUrl' => $block->getCustomerDataUrl('customer/account/updateSession'), |
| 17 | +- ]], |
| 18 | +- ]); |
| 19 | +-?> |
| 20 | ++<script> |
| 21 | ++ requirejs.config({ |
| 22 | ++ config: <?= /* @noEscape */ $this->helper(\Magento\Framework\Json\Helper\Data::class)->jsonEncode(['Magento_Customer/js/customer-data' => [ |
| 23 | ++ 'sectionLoadUrl' => $block->getCustomerDataUrl('customer/section/load'), |
| 24 | ++ 'expirableSectionLifetime' => $block->getExpirableSectionLifetime(), |
| 25 | ++ 'expirableSectionNames' => $block->getExpirableSectionNames(), |
| 26 | ++ 'cookieLifeTime' => $block->getCookieLifeTime(), |
| 27 | ++ 'updateSessionUrl' => $block->getCustomerDataUrl('customer/account/updateSession'), |
| 28 | ++ ]]); ?> |
| 29 | ++ }); |
| 30 | + </script> |
| 31 | +diff --git a/view/frontend/templates/js/section-config.phtml b/view/frontend/templates/js/section-config.phtml |
| 32 | +index 94ab475..0c49af6 100644 |
| 33 | +--- a/view/frontend/templates/js/section-config.phtml |
| 34 | ++++ b/view/frontend/templates/js/section-config.phtml |
| 35 | +@@ -6,16 +6,17 @@ |
| 36 | + |
| 37 | + /** @var \Magento\Customer\Block\SectionConfig $block */ |
| 38 | + ?> |
| 39 | +-<script type="text/x-magento-init"> |
| 40 | +-<?= /* @noEscape */ $this->helper(\Magento\Framework\Json\Helper\Data::class)->jsonEncode([ |
| 41 | +- '*' => ['Magento_Customer/js/section-config' => [ |
| 42 | +- 'sections' => $block->getSections(), |
| 43 | +- 'clientSideSections' => $block->getClientSideSections(), |
| 44 | +- 'baseUrls' => array_unique([ |
| 45 | +- $block->getUrl(null, ['_secure' => true]), |
| 46 | +- $block->getUrl(null, ['_secure' => false]), |
| 47 | +- ]), |
| 48 | +- ]], |
| 49 | +- ]); |
| 50 | +-?> |
| 51 | ++<script> |
| 52 | ++ requirejs.config({ |
| 53 | ++ config: <?= /* @noEscape */ $this->helper(\Magento\Framework\Json\Helper\Data::class)->jsonEncode([ |
| 54 | ++ 'Magento_Customer/js/section-config' => [ |
| 55 | ++ 'sections' => $block->getSections(), |
| 56 | ++ 'clientSideSections' => $block->getClientSideSections(), |
| 57 | ++ 'baseUrls' => array_unique([ |
| 58 | ++ $block->getUrl(null, ['_secure' => true]), |
| 59 | ++ $block->getUrl(null, ['_secure' => false]), |
| 60 | ++ ]) |
| 61 | ++ ] |
| 62 | ++ ]); ?> |
| 63 | ++ }); |
| 64 | + </script> |
| 65 | +diff --git a/view/frontend/web/js/customer-data.js b/view/frontend/web/js/customer-data.js |
| 66 | +index 66d37cb..041b509 100644 |
| 67 | +--- a/view/frontend/web/js/customer-data.js |
| 68 | ++++ b/view/frontend/web/js/customer-data.js |
| 69 | +@@ -11,12 +11,13 @@ define([ |
| 70 | + 'underscore', |
| 71 | + 'ko', |
| 72 | + 'Magento_Customer/js/section-config', |
| 73 | ++ 'module', |
| 74 | + 'mage/storage', |
| 75 | + 'jquery/jquery-storageapi' |
| 76 | +-], function ($, _, ko, sectionConfig) { |
| 77 | ++], function ($, _, ko, sectionConfig, module) { |
| 78 | + 'use strict'; |
| 79 | + |
| 80 | +- var options, |
| 81 | ++ var options = module.config(), |
| 82 | + storage, |
| 83 | + storageInvalidation, |
| 84 | + invalidateCacheBySessionTimeOut, |
| 85 | +@@ -364,14 +365,13 @@ define([ |
| 86 | + * @param {Object} settings |
| 87 | + * @constructor |
| 88 | + */ |
| 89 | +- 'Magento_Customer/js/customer-data': function (settings) { |
| 90 | +- options = settings; |
| 91 | +- invalidateCacheBySessionTimeOut(settings); |
| 92 | +- invalidateCacheByCloseCookieSession(); |
| 93 | +- customerData.init(); |
| 94 | +- } |
| 95 | ++ 'Magento_Customer/js/customer-data': function () {} |
| 96 | + }; |
| 97 | + |
| 98 | ++ invalidateCacheBySessionTimeOut(options); |
| 99 | ++ invalidateCacheByCloseCookieSession(); |
| 100 | ++ customerData.init(); |
| 101 | ++ |
| 102 | + /** |
| 103 | + * Events listener |
| 104 | + */ |
| 105 | +diff --git a/view/frontend/web/js/section-config.js b/view/frontend/web/js/section-config.js |
| 106 | +index 76fe7f2..b638153 100644 |
| 107 | +--- a/view/frontend/web/js/section-config.js |
| 108 | ++++ b/view/frontend/web/js/section-config.js |
| 109 | +@@ -3,10 +3,14 @@ |
| 110 | + * See COPYING.txt for license details. |
| 111 | + */ |
| 112 | + |
| 113 | +-define(['underscore'], function (_) { |
| 114 | ++define(['underscore', 'module'], function (_, module) { |
| 115 | + 'use strict'; |
| 116 | + |
| 117 | +- var baseUrls, sections, clientSideSections, canonize; |
| 118 | ++ var options = module.config(), |
| 119 | ++ baseUrls = options.baseUrls, |
| 120 | ++ sections = options.sections, |
| 121 | ++ clientSideSections = options.clientSideSections, |
| 122 | ++ canonize; |
| 123 | + |
| 124 | + /** |
| 125 | + * @param {String} url |
| 126 | +@@ -74,10 +78,6 @@ define(['underscore'], function (_) { |
| 127 | + * @param {Object} options |
| 128 | + * @constructor |
| 129 | + */ |
| 130 | +- 'Magento_Customer/js/section-config': function (options) { |
| 131 | +- baseUrls = options.baseUrls; |
| 132 | +- sections = options.sections; |
| 133 | +- clientSideSections = options.clientSideSections; |
| 134 | +- } |
| 135 | ++ 'Magento_Customer/js/section-config': function () {} |
| 136 | + }; |
| 137 | + }); |
0 commit comments