Skip to content

Commit bcc5403

Browse files
authored
Merge pull request #8338 from magento-l3/JUN062023_PR_2.4.7-beta1-develop
[L3 Kings] 2.4.7-beta1-develop
2 parents 0ae05f8 + f29a42a commit bcc5403

File tree

7 files changed

+11
-201
lines changed

7 files changed

+11
-201
lines changed

app/code/Magento/Customer/Model/App/FrontController/DeleteCookieWhenCustomerNotExistPlugin.php

Lines changed: 0 additions & 55 deletions
This file was deleted.

app/code/Magento/Customer/Test/Unit/Model/App/FrontController/DeleteCookieWhenCustomerNotExistPluginTest.php

Lines changed: 0 additions & 56 deletions
This file was deleted.

app/code/Magento/Customer/ViewModel/Customer/Data.php

Lines changed: 0 additions & 63 deletions
This file was deleted.

app/code/Magento/Customer/etc/frontend/di.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,4 @@
130130
<type name="Magento\Customer\Model\Session">
131131
<plugin name="afterLogout" type="Magento\Customer\Model\Plugin\ClearSessionsAfterLogoutPlugin"/>
132132
</type>
133-
<type name="Magento\Framework\App\FrontControllerInterface">
134-
<plugin name="delete-cookie-when-customer-not-exist" type="Magento\Customer\Model\App\FrontController\DeleteCookieWhenCustomerNotExistPlugin"/>
135-
</type>
136133
</config>

app/code/Magento/Customer/view/frontend/layout/default.xml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,7 @@
4848
</arguments>
4949
</block>
5050
<block name="customer.customer.data" class="Magento\Customer\Block\CustomerData"
51-
template="Magento_Customer::js/customer-data.phtml">
52-
<arguments>
53-
<argument name="view_model" xsi:type="object">Magento\Customer\ViewModel\Customer\Data</argument>
54-
</arguments>
55-
</block>
51+
template="Magento_Customer::js/customer-data.phtml"/>
5652
<block name="customer.data.invalidation.rules" class="Magento\Customer\Block\CustomerScopeData"
5753
template="Magento_Customer::js/customer-data/invalidation-rules.phtml"/>
5854
</referenceContainer>

app/code/Magento/Customer/view/frontend/templates/js/customer-data.phtml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,28 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
use Magento\Customer\ViewModel\Customer\Data;
7-
use Magento\Framework\App\ObjectManager;
86

97
/** @var \Magento\Customer\Block\CustomerData $block */
8+
/** @var \Magento\Framework\Json\Helper\Data $jsonHelper */
9+
$expirableSectionNames = $block->getExpirableSectionNames();
1010

1111
// phpcs:disable Magento2.Templates.ThisInTemplate.FoundHelper
12-
/** @var Data $viewModel */
13-
$viewModel = $block->getViewModel() ?? ObjectManager::getInstance()->get(Data::class);
14-
$customerDataUrl = $block->getCustomerDataUrl('customer/account/updateSession');
15-
$expirableSectionNames = $block->getExpirableSectionNames();
12+
// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis
13+
$jsonHelper = $this->helper(\Magento\Framework\Json\Helper\Data::class);
1614
?>
1715
<script type="text/x-magento-init">
1816
{
1917
"*": {
2018
"Magento_Customer/js/customer-data": {
2119
"sectionLoadUrl": "<?= $block->escapeJs($block->getCustomerDataUrl('customer/section/load')) ?>",
2220
"expirableSectionLifetime": <?= (int)$block->getExpirableSectionLifetime() ?>,
23-
"expirableSectionNames": <?= /* @noEscape */ $viewModel->jsonEncode($expirableSectionNames) ?>,
21+
"expirableSectionNames": <?= /* @noEscape */ $jsonHelper->jsonEncode(
22+
$block->getExpirableSectionNames()
23+
) ?>,
2424
"cookieLifeTime": "<?= $block->escapeJs($block->getCookieLifeTime()) ?>",
25-
"updateSessionUrl": "<?= $block->escapeJs($customerDataUrl) ?>",
26-
"isLoggedIn": "<?= /* @noEscape */ $viewModel->isLoggedIn() ?>"
25+
"updateSessionUrl": "<?= $block->escapeJs(
26+
$block->getCustomerDataUrl('customer/account/updateSession')
27+
) ?>"
2728
}
2829
}
2930
}

app/code/Magento/Customer/view/frontend/web/js/customer-data.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,10 @@ define([
4747
* Invalidate Cache By Close Cookie Session
4848
*/
4949
invalidateCacheByCloseCookieSession = function () {
50-
var isLoggedIn = parseInt(options.isLoggedIn, 10) || 0;
51-
5250
if (!$.cookieStorage.isSet('mage-cache-sessid')) {
5351
storage.removeAll();
5452
}
5553

56-
if (!$.localStorage.isSet('mage-customer-login')) {
57-
$.localStorage.set('mage-customer-login', isLoggedIn);
58-
}
59-
if ($.localStorage.get('mage-customer-login') !== isLoggedIn) {
60-
$.localStorage.set('mage-customer-login', isLoggedIn);
61-
storage.removeAll();
62-
}
63-
6454
$.cookieStorage.set('mage-cache-sessid', true);
6555
};
6656

0 commit comments

Comments
 (0)