11<?php
22/**
3- * Copyright © Magento, Inc. All rights reserved.
4- * See COPYING.txt for license details .
3+ * Copyright 2015 Adobe
4+ * All Rights Reserved .
55 */
66use Magento \Customer \ViewModel \Customer \Data ;
7- use Magento \Framework \App \ObjectManager ;
87use Magento \Customer \ViewModel \CookieSettings ;
98
10- /** @var \Magento\Customer\Block\CustomerData $block */
9+ /**
10+ * @var \Magento\Customer\Block\CustomerData $block
11+ * @var \Magento\Framework\Escaper $escaper
12+ */
1113
1214// phpcs:disable Magento2.Templates.ThisInTemplate.FoundHelper
1315/** @var Auth $auth */
14- $ auth = $ block ->getAuth () ?? ObjectManager:: getInstance ()-> get (Auth::class) ;
16+ $ auth = $ block ->getAuth ();
1517/** @var JsonSerializer $jsonSerializer */
16- $ jsonSerializer = $ block ->getJsonSerializer () ??
17- ObjectManager::getInstance ()->get (JsonSerializer::class);
18+ $ jsonSerializer = $ block ->getJsonSerializer ();
1819$ customerDataUrl = $ block ->getCustomerDataUrl ('customer/account/updateSession ' );
1920$ expirableSectionNames = $ block ->getExpirableSectionNames ();
2021/** @var CookieSettings $cookieSettings */
@@ -24,14 +25,14 @@ $cookieSettings = $block->getCookieSettings();
2425 {
2526 "*": {
2627 "Magento_Customer/js/customer-data": {
27- "sectionLoadUrl": "<?= $ block ->escapeJs ($ block ->getCustomerDataUrl ('customer/section/load ' )) ?> ",
28+ "sectionLoadUrl": "<?= $ escaper ->escapeJs ($ block ->getCustomerDataUrl ('customer/section/load ' )) ?> ",
2829 "expirableSectionLifetime": <?= (int )$ block ->getExpirableSectionLifetime () ?> ,
2930 "expirableSectionNames": <?= /* @noEscape */ $ jsonSerializer ->serialize (
3031 $ expirableSectionNames
3132 ) ?> ,
32- "cookieLifeTime": "<?= $ block ->escapeJs ($ block ->getCookieLifeTime ()) ?> ",
33- "cookieDomain": "<?= $ block ->escapeJs ($ cookieSettings ->getCookieDomain ()) ?> ",
34- "updateSessionUrl": "<?= $ block ->escapeJs ($ customerDataUrl ) ?> ",
33+ "cookieLifeTime": "<?= $ escaper ->escapeJs ($ block ->getCookieLifeTime ()) ?> ",
34+ "cookieDomain": "<?= $ escaper ->escapeJs ($ cookieSettings ->getCookieDomain ()) ?> ",
35+ "updateSessionUrl": "<?= $ escaper ->escapeJs ($ customerDataUrl ) ?> ",
3536 "isLoggedIn": "<?= /* @noEscape */ $ auth ->isLoggedIn () ?> "
3637 }
3738 }
0 commit comments