Skip to content

Commit 669fd01

Browse files
committed
Merge remote-tracking branch 'origin/2.3-develop' into MC-20075
2 parents 1f3306c + d6ef3ef commit 669fd01

File tree

21 files changed

+110
-101
lines changed

21 files changed

+110
-101
lines changed

app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationTimeToSendDataTest.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
<amOnPage url="{{AdminConfigGeneralAnalyticsPage.url}}" stepKey="amOnAdminConfig"/>
2626
<selectOption selector="{{AdminConfigAdvancedReportingSection.advancedReportingService}}" userInput="Enable" stepKey="selectAdvancedReportingServiceEnabled"/>
2727
<selectOption selector="{{AdminConfigAdvancedReportingSection.advancedReportingIndustry}}" userInput="Apps and Games" stepKey="selectAdvancedReportingIndustry"/>
28-
<selectOption selector="{{AdminConfigAdvancedReportingSection.advancedReportingHour}}" userInput="11" stepKey="selectAdvancedReportingHour"/>
29-
<selectOption selector="{{AdminConfigAdvancedReportingSection.advancedReportingMinute}}" userInput="11" stepKey="selectAdvancedReportingMinute"/>
30-
<selectOption selector="{{AdminConfigAdvancedReportingSection.advancedReportingSeconds}}" userInput="00" stepKey="selectAdvancedReportingSeconds"/>
28+
<selectOption selector="{{AdminConfigAdvancedReportingSection.advancedReportingHour}}" userInput="23" stepKey="selectAdvancedReportingHour"/>
29+
<selectOption selector="{{AdminConfigAdvancedReportingSection.advancedReportingMinute}}" userInput="59" stepKey="selectAdvancedReportingMinute"/>
30+
<selectOption selector="{{AdminConfigAdvancedReportingSection.advancedReportingSeconds}}" userInput="59" stepKey="selectAdvancedReportingSeconds"/>
3131
<click selector="{{AdminMainActionsSection.save}}" stepKey="clickSaveConfigButton"/>
3232
<see selector="{{AdminMessagesSection.success}}" userInput="You saved the configuration." stepKey="seeSuccess"/>
3333
</test>

app/code/Magento/Checkout/etc/frontend/sections.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Customer:etc/sections.xsd">
1010
<action name="checkout/cart/add">
1111
<section name="cart"/>
12+
<section name="directory-data"/>
1213
</action>
1314
<action name="checkout/cart/delete">
1415
<section name="cart"/>

app/code/Magento/Checkout/view/frontend/web/js/view/minicart.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ define([
103103
});
104104

105105
if (
106-
cartData().website_id !== window.checkout.websiteId &&
107-
cartData().website_id !== undefined
106+
cartData().website_id !== window.checkout.websiteId && cartData().website_id !== undefined ||
107+
cartData().storeId !== window.checkout.storeId && cartData().storeId !== undefined
108108
) {
109109
customerData.reload(['cart'], false);
110110
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Customer\Block;
7+
8+
use Magento\Customer\CustomerData\SectionPool;
9+
use Magento\Framework\View\Element\Block\ArgumentInterface;
10+
11+
/**
12+
* ViewModel to get sections names array.
13+
*/
14+
class SectionNamesProvider implements ArgumentInterface
15+
{
16+
/**
17+
* @var SectionPool
18+
*/
19+
private $sectionPool;
20+
21+
/**
22+
* @param SectionPool $sectionPool
23+
*/
24+
public function __construct(
25+
SectionPool $sectionPool
26+
) {
27+
$this->sectionPool = $sectionPool;
28+
}
29+
30+
/**
31+
* Return array of section names based on config.
32+
*
33+
* @return array
34+
*/
35+
public function getSectionNames()
36+
{
37+
return $this->sectionPool->getSectionNames();
38+
}
39+
}

app/code/Magento/Customer/CustomerData/SectionPool.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,16 @@ public function getSectionsData(array $sectionNames = null, $forceNewTimestamp =
6262
return $sectionsData;
6363
}
6464

65+
/**
66+
* Return array of section names.
67+
*
68+
* @return array
69+
*/
70+
public function getSectionNames()
71+
{
72+
return array_keys($this->sectionSourceMap);
73+
}
74+
6575
/**
6676
* Get section sources by section names
6777
*

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@
157157
<argument name="sectionConfig" xsi:type="object">SectionInvalidationConfigData</argument>
158158
</arguments>
159159
</type>
160+
<type name="Magento\Customer\Block\SectionNamesProvider">
161+
<arguments>
162+
<argument name="sectionConfig" xsi:type="object">SectionInvalidationConfigData</argument>
163+
</arguments>
164+
</type>
160165
<preference for="Magento\Customer\CustomerData\JsLayoutDataProviderPoolInterface"
161166
type="Magento\Customer\CustomerData\JsLayoutDataProviderPool"/>
162167
<type name="Magento\Framework\Webapi\ServiceTypeToEntityTypeMap">

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,12 @@
4141
</arguments>
4242
</block>
4343
<block name="customer.section.config" class="Magento\Customer\Block\SectionConfig"
44-
template="Magento_Customer::js/section-config.phtml"/>
45-
<block name="customer.customer.data"
46-
class="Magento\Customer\Block\CustomerData"
44+
template="Magento_Customer::js/section-config.phtml">
45+
<arguments>
46+
<argument name="sectionNamesProvider" xsi:type="object">Magento\Customer\Block\SectionNamesProvider</argument>
47+
</arguments>
48+
</block>
49+
<block name="customer.customer.data" class="Magento\Customer\Block\CustomerData"
4750
template="Magento_Customer::js/customer-data.phtml"/>
4851
<block name="customer.data.invalidation.rules" class="Magento\Customer\Block\CustomerScopeData"
4952
template="Magento_Customer::js/customer-data/invalidation-rules.phtml"/>

app/code/Magento/Customer/view/frontend/templates/js/section-config.phtml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
"baseUrls": <?= /* @noEscape */ $this->helper(\Magento\Framework\Json\Helper\Data::class)->jsonEncode(array_unique([
1616
$block->getUrl(null, ['_secure' => true]),
1717
$block->getUrl(null, ['_secure' => false]),
18-
])) ?>
18+
])) ?>,
19+
"sectionNames": <?= /* @noEscape */ $this->helper(\Magento\Framework\Json\Helper\Data::class)
20+
->jsonEncode($block->getData('sectionNamesProvider')->getSectionNames()) ?>
1921
}
2022
}
2123
}

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

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -198,30 +198,9 @@ define([
198198
* Customer data initialization
199199
*/
200200
init: function () {
201-
var privateContentVersion = 'private_content_version',
202-
privateContent = $.cookieStorage.get(privateContentVersion),
203-
localPrivateContent = $.localStorage.get(privateContentVersion),
204-
needVersion = 'need_version',
205-
expiredSectionNames = this.getExpiredSectionNames();
206-
207-
if (privateContent &&
208-
!$.cookieStorage.isSet(privateContentVersion) &&
209-
!$.localStorage.isSet(privateContentVersion)
210-
) {
211-
$.cookieStorage.set(privateContentVersion, needVersion);
212-
$.localStorage.set(privateContentVersion, needVersion);
213-
this.reload([], false);
214-
} else if (localPrivateContent !== privateContent) {
215-
if (!$.cookieStorage.isSet(privateContentVersion)) {
216-
privateContent = needVersion;
217-
$.cookieStorage.set(privateContentVersion, privateContent);
218-
}
219-
$.localStorage.set(privateContentVersion, privateContent);
220-
_.each(dataProvider.getFromStorage(storage.keys()), function (sectionData, sectionName) {
221-
buffer.notify(sectionName, sectionData);
222-
});
223-
this.reload([], false);
224-
} else if (expiredSectionNames.length > 0) {
201+
var expiredSectionNames = this.getExpiredSectionNames();
202+
203+
if (expiredSectionNames.length > 0) {
225204
_.each(dataProvider.getFromStorage(storage.keys()), function (sectionData, sectionName) {
226205
buffer.notify(sectionName, sectionData);
227206
});
@@ -341,7 +320,9 @@ define([
341320
var sectionDataIds,
342321
sectionsNamesForInvalidation;
343322

344-
sectionsNamesForInvalidation = _.contains(sectionNames, '*') ? buffer.keys() : sectionNames;
323+
sectionsNamesForInvalidation = _.contains(sectionNames, '*') ? sectionConfig.getSectionNames() :
324+
sectionNames;
325+
345326
$(document).trigger('customer-data-invalidate', [sectionsNamesForInvalidation]);
346327
buffer.remove(sectionsNamesForInvalidation);
347328
sectionDataIds = $.cookieStorage.get('section_data_ids') || {};

app/code/Magento/Customer/view/frontend/web/js/section-config.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
define(['underscore'], function (_) {
77
'use strict';
88

9-
var baseUrls, sections, clientSideSections, canonize;
9+
var baseUrls, sections, clientSideSections, sectionNames, canonize;
1010

1111
/**
1212
* @param {String} url
@@ -70,6 +70,15 @@ define(['underscore'], function (_) {
7070
return _.contains(clientSideSections, sectionName);
7171
},
7272

73+
/**
74+
* Returns array of section names.
75+
*
76+
* @returns {Array}
77+
*/
78+
getSectionNames: function () {
79+
return sectionNames;
80+
},
81+
7382
/**
7483
* @param {Object} options
7584
* @constructor
@@ -78,6 +87,7 @@ define(['underscore'], function (_) {
7887
baseUrls = options.baseUrls;
7988
sections = options.sections;
8089
clientSideSections = options.clientSideSections;
90+
sectionNames = options.sectionNames;
8191
}
8292
};
8393
});

0 commit comments

Comments
 (0)