Skip to content

Commit 57011bd

Browse files
authored
Merge branch '2.4-develop' into assert-discount
2 parents d4e7e1e + b941603 commit 57011bd

File tree

288 files changed

+12129
-3659
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

288 files changed

+12129
-3659
lines changed

app/code/Magento/AdminAnalytics/Test/Mftf/Test/AdminCheckAnalyticsTrackingTest.xml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,46 @@
3131

3232
<waitForPageLoad stepKey="waitForPageReloaded"/>
3333
<seeInPageSource html="var adminAnalyticsMetadata =" stepKey="seeInPageSource"/>
34+
<grabPageSource stepKey="pageSource"/>
35+
<assertRegExp message="adminAnalyticsMetadata object is invalid" stepKey="validateadminAnalyticsMetadata">
36+
<expectedResult type="string">#var\s+adminAnalyticsMetadata\s+=\s+{\s+("[\w_]+":\s+"[^"]*?",\s+)*?("[\w_]+":\s+"[^"]*?"\s+)};#s</expectedResult>
37+
<actualResult type="variable">$pageSource</actualResult>
38+
</assertRegExp>
39+
<assertRegExp message="adminAnalyticsMetadata object contains incorrect user ID" stepKey="validateUserId">
40+
<expectedResult type="string">#var\s+adminAnalyticsMetadata\s+=\s+{\s+("[\w_]+":\s+"[^"]*?",\s+)*?"user":\s+"[\w\d]{64}"#s</expectedResult>
41+
<actualResult type="variable">$pageSource</actualResult>
42+
</assertRegExp>
43+
<assertRegExp message="adminAnalyticsMetadata object contains incorrect secure base URL" stepKey="validateSecureBaseURL">
44+
<expectedResult type="string">#var\s+adminAnalyticsMetadata\s+=\s+{\s+("[\w_]+":\s+"[^"]*?",\s+)*?"secure_base_url":\s+"http(s)?\\\\u003A\\\\u002F\\\\u002F.+?\\\\u002F"#s</expectedResult>
45+
<actualResult type="variable">$pageSource</actualResult>
46+
</assertRegExp>
47+
<assertRegExp message="adminAnalyticsMetadata object contains incorrect product version" stepKey="validateProductVersion">
48+
<expectedResult type="string">#var\s+adminAnalyticsMetadata\s+=\s+{\s+("[\w_]+":\s+"[^"]*?",\s+)*?"version":\s+"[^\s]+"#s</expectedResult>
49+
<actualResult type="variable">$pageSource</actualResult>
50+
</assertRegExp>
51+
<assertRegExp message="adminAnalyticsMetadata object contains incorrect product edition" stepKey="validateProductEdition">
52+
<expectedResult type="string">#var\s+adminAnalyticsMetadata\s+=\s+{\s+("[\w_]+":\s+"[^"]*?",\s+)*?"product_edition":\s+"(Community|Enterprise|B2B)"#s</expectedResult>
53+
<actualResult type="variable">$pageSource</actualResult>
54+
</assertRegExp>
55+
<assertRegExp message="adminAnalyticsMetadata object contains incorrect application mode" stepKey="validateApplicationMode">
56+
<expectedResult type="string">#var\s+adminAnalyticsMetadata\s+=\s+{\s+("[\w_]+":\s+"[^"]*?",\s+)*?"mode":\s+"default|developer|production"#s</expectedResult>
57+
<actualResult type="variable">$pageSource</actualResult>
58+
</assertRegExp>
59+
<assertRegExp message="adminAnalyticsMetadata object contains incorrect store name" stepKey="validateStoreName">
60+
<expectedResult type="string">#var\s+adminAnalyticsMetadata\s+=\s+{\s+("[\w_]+":\s+"[^"]*?",\s+)*?"store_name_default":\s+".*?"#s</expectedResult>
61+
<actualResult type="variable">$pageSource</actualResult>
62+
</assertRegExp>
63+
<assertRegExp message="adminAnalyticsMetadata object contains incorrect admin user created date" stepKey="validateAdminUserCreatedDate">
64+
<expectedResult type="string">#var\s+adminAnalyticsMetadata\s+=\s+{\s+("[\w_]+":\s+"[^"]*?",\s+)*?"admin_user_created":\s+".+?"#s</expectedResult>
65+
<actualResult type="variable">$pageSource</actualResult>
66+
</assertRegExp>
67+
<assertRegExp message="adminAnalyticsMetadata object contains incorrect admin user log date" stepKey="validateAdminUserLogDate">
68+
<expectedResult type="string">#var\s+adminAnalyticsMetadata\s+=\s+{\s+("[\w_]+":\s+"[^"]*?",\s+)*?"admin_user_logdate":\s+".+?"#s</expectedResult>
69+
<actualResult type="variable">$pageSource</actualResult>
70+
</assertRegExp>
71+
<assertRegExp message="adminAnalyticsMetadata object contains incorrect admin user role name" stepKey="validateAdminUserRoleName">
72+
<expectedResult type="string">#var\s+adminAnalyticsMetadata\s+=\s+{\s+("[\w_]+":\s+"[^"]*?",\s+)*?"admin_user_role_name":\s+".+?"#s</expectedResult>
73+
<actualResult type="variable">$pageSource</actualResult>
74+
</assertRegExp>
3475
</test>
3576
</tests>

app/code/Magento/AdminAnalytics/ViewModel/Metadata.php

Lines changed: 85 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,18 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
7+
declare(strict_types=1);
8+
69
namespace Magento\AdminAnalytics\ViewModel;
710

11+
use Magento\Config\Model\Config\Backend\Admin\Custom;
12+
use Magento\Framework\App\Config\ScopeConfigInterface;
813
use Magento\Framework\App\ProductMetadataInterface;
914
use Magento\Backend\Model\Auth\Session;
1015
use Magento\Framework\App\State;
1116
use Magento\Framework\View\Element\Block\ArgumentInterface;
17+
use Magento\Store\Model\Information;
1218

1319
/**
1420
* Gets user version and mode
@@ -30,19 +36,27 @@ class Metadata implements ArgumentInterface
3036
*/
3137
private $productMetadata;
3238

39+
/**
40+
* @var ScopeConfigInterface
41+
*/
42+
private $config;
43+
3344
/**
3445
* @param ProductMetadataInterface $productMetadata
3546
* @param Session $authSession
3647
* @param State $appState
48+
* @param ScopeConfigInterface $config
3749
*/
3850
public function __construct(
3951
ProductMetadataInterface $productMetadata,
4052
Session $authSession,
41-
State $appState
53+
State $appState,
54+
ScopeConfigInterface $config
4255
) {
4356
$this->productMetadata = $productMetadata;
4457
$this->authSession = $authSession;
4558
$this->appState = $appState;
59+
$this->config = $config;
4660
}
4761

4862
/**
@@ -55,15 +69,26 @@ public function getMagentoVersion() :string
5569
return $this->productMetadata->getVersion();
5670
}
5771

72+
/**
73+
* Get product edition
74+
*
75+
* @return string
76+
*/
77+
public function getProductEdition(): string
78+
{
79+
return $this->productMetadata->getEdition();
80+
}
81+
5882
/**
5983
* Get current user id (hash generated from email)
6084
*
6185
* @return string
6286
*/
6387
public function getCurrentUser() :string
6488
{
65-
return hash('sha512', 'ADMIN_USER' . $this->authSession->getUser()->getEmail());
89+
return hash('sha256', 'ADMIN_USER' . $this->authSession->getUser()->getEmail());
6690
}
91+
6792
/**
6893
* Get Magento mode that the user is using
6994
*
@@ -73,4 +98,62 @@ public function getMode() :string
7398
{
7499
return $this->appState->getMode();
75100
}
101+
102+
/**
103+
* Get created date for current user
104+
*
105+
* @return string
106+
*/
107+
public function getCurrentUserCreatedDate(): string
108+
{
109+
return $this->authSession->getUser()->getCreated();
110+
}
111+
112+
/**
113+
* Get log date for current user
114+
*
115+
* @return string|null
116+
*/
117+
public function getCurrentUserLogDate(): ?string
118+
{
119+
return $this->authSession->getUser()->getLogdate();
120+
}
121+
122+
/**
123+
* Get secure base URL
124+
*
125+
* @param string $scope
126+
* @param string|null $scopeCode
127+
* @return string|null
128+
*/
129+
public function getSecureBaseUrlForScope(
130+
string $scope = ScopeConfigInterface::SCOPE_TYPE_DEFAULT,
131+
?string $scopeCode = null
132+
): ?string {
133+
return $this->config->getValue(Custom::XML_PATH_SECURE_BASE_URL, $scope, $scopeCode);
134+
}
135+
136+
/**
137+
* Get store name
138+
*
139+
* @param string $scope
140+
* @param string|null $scopeCode
141+
* @return string|null
142+
*/
143+
public function getStoreNameForScope(
144+
string $scope = ScopeConfigInterface::SCOPE_TYPE_DEFAULT,
145+
?string $scopeCode = null
146+
): ?string {
147+
return $this->config->getValue(Information::XML_PATH_STORE_INFO_NAME, $scope, $scopeCode);
148+
}
149+
150+
/**
151+
* Get current user role name
152+
*
153+
* @return string
154+
*/
155+
public function getCurrentUserRoleName(): string
156+
{
157+
return $this->authSession->getUser()->getRole()->getRoleName();
158+
}
76159
}

app/code/Magento/AdminAnalytics/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"magento/framework": "*",
1010
"magento/module-backend": "*",
1111
"magento/module-config": "*",
12+
"magento/module-store": "*",
1213
"magento/module-ui": "*",
1314
"magento/module-release-notification": "*"
1415
},
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<csp_whitelist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Csp:etc/csp_whitelist.xsd">
10+
<policies>
11+
<policy id="script-src">
12+
<values>
13+
<value id="aptrinsic" type="host">*.aptrinsic.com</value>
14+
</values>
15+
</policy>
16+
<policy id="style-src">
17+
<values>
18+
<value id="aptrinsic" type="host">*.aptrinsic.com</value>
19+
<value id="fonts_googleapis" type="host">fonts.googleapis.com</value>
20+
</values>
21+
</policy>
22+
<policy id="img-src">
23+
<values>
24+
<value id="aptrinsic" type="host">*.aptrinsic.com</value>
25+
<value id="storage_googleapis" type="host">storage.googleapis.com</value>
26+
</values>
27+
</policy>
28+
<policy id="connect-src">
29+
<values>
30+
<value id="aptrinsic" type="host">*.aptrinsic.com</value>
31+
</values>
32+
</policy>
33+
<policy id="font-src">
34+
<values>
35+
<value id="fonts_gstatic" type="host">fonts.gstatic.com</value>
36+
</values>
37+
</policy>
38+
</policies>
39+
</csp_whitelist>

app/code/Magento/AdminAnalytics/view/adminhtml/layout/default.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<referenceContainer name="header">
1111
<block name="tracking" as="tracking" template="Magento_AdminAnalytics::tracking.phtml" ifconfig="admin/usage/enabled">
1212
<arguments>
13-
<argument name="tracking_url" xsi:type="string">//assets.adobedtm.com/launch-EN30eb7ffa064444f1b8b0368ef38fd3a9.min.js</argument>
13+
<argument name="tracking_url" xsi:type="string">//assets.adobedtm.com/a7d65461e54e/37baabec1b6e/launch-177bc126c8e6.min.js</argument>
1414
<argument name="metadata" xsi:type="object">Magento\AdminAnalytics\ViewModel\Metadata</argument>
1515
</arguments>
1616
</block>

app/code/Magento/AdminAnalytics/view/adminhtml/templates/tracking.phtml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,20 @@
1919
false
2020
) ?>
2121

22-
<?php $scriptString = '
22+
<?php
23+
/** @var \Magento\AdminAnalytics\ViewModel\Metadata $metadata */
24+
$metadata = $block->getMetadata();
25+
$scriptString = '
2326
var adminAnalyticsMetadata = {
24-
"version": "' . $block->escapeJs($block->getMetadata()->getMagentoVersion()) . '",
25-
"user": "' . $block->escapeJs($block->getMetadata()->getCurrentUser()) . '",
26-
"mode": "' . $block->escapeJs($block->getMetadata()->getMode()) . '"
27+
"secure_base_url": "' . $block->escapeJs($metadata->getSecureBaseUrlForScope()) . '",
28+
"version": "' . $block->escapeJs($metadata->getMagentoVersion()) . '",
29+
"product_edition": "' . $block->escapeJs($metadata->getProductEdition()) . '",
30+
"user": "' . $block->escapeJs($metadata->getCurrentUser()) . '",
31+
"mode": "' . $block->escapeJs($metadata->getMode()) . '",
32+
"store_name_default": "' . $block->escapeJs($metadata->getStoreNameForScope()) . '",
33+
"admin_user_created": "' . $block->escapeJs($metadata->getCurrentUserCreatedDate()) . '",
34+
"admin_user_logdate": "' . $block->escapeJs($metadata->getCurrentUserLogDate()) . '",
35+
"admin_user_role_name": "' . $block->escapeJs($metadata->getCurrentUserRoleName()) . '"
2736
};
2837
';
2938
?>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AwsS3StorefrontCaptchaOnCustomerLoginTest" extends="StorefrontCaptchaOnCustomerLoginTest">
12+
<annotations>
13+
<features value="Captcha"/>
14+
<stories value="Login with Customer Account + Captcha"/>
15+
<title value="AWS S3 Captcha customer login page test"/>
16+
<description value="Check CAPTCHA on Storefront Login Page."/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="MC-39491" />
19+
<group value="remote_storage_aws_s3"/>
20+
</annotations>
21+
<before>
22+
<magentoCLI command="setup:config:set {{RemoteStorageAwsS3ConfigData.enable_options}}" stepKey="enableRemoteStorage"/>
23+
</before>
24+
<after>
25+
<magentoCLI command="setup:config:set {{RemoteStorageAwsS3ConfigData.disable_options}}" stepKey="disableRemoteStorage"/>
26+
</after>
27+
</test>
28+
</tests>

app/code/Magento/AwsS3/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "magento/module-aws-s-3",
2+
"name": "magento/module-aws-s3",
33
"description": "N/A",
44
"config": {
55
"sort-packages": true

app/code/Magento/Backend/Test/Mftf/Test/AdminExpireCustomerSessionTest.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
<after>
2323
<!-- 6. Restore default configuration settings. -->
2424
<magentoCLI command="config:set {{DefaultWebCookieLifetimeConfigData.path}} {{DefaultWebCookieLifetimeConfigData.value}}" stepKey="setDefaultCookieLifetime"/>
25+
<!-- Customer Log Out -->
26+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogout"/>
2527
<!-- Delete data -->
2628
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
2729
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>

app/code/Magento/BundleGraphQl/Model/Cart/BundleOptionDataProvider.php

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
use Magento\Bundle\Helper\Catalog\Product\Configuration;
1111
use Magento\Catalog\Model\Product;
12+
use Magento\Framework\App\ObjectManager;
13+
use Magento\Framework\GraphQl\Query\Uid;
1214
use Magento\Quote\Model\Quote\Item;
1315
use Magento\Framework\Pricing\Helper\Data;
1416
use Magento\Framework\Serialize\SerializerInterface;
@@ -18,6 +20,11 @@
1820
*/
1921
class BundleOptionDataProvider
2022
{
23+
/**
24+
* Option type name
25+
*/
26+
private const OPTION_TYPE = 'bundle';
27+
2128
/**
2229
* @var Data
2330
*/
@@ -33,19 +40,26 @@ class BundleOptionDataProvider
3340
*/
3441
private $configuration;
3542

43+
/** @var Uid */
44+
private $uidEncoder;
45+
3646
/**
3747
* @param Data $pricingHelper
3848
* @param SerializerInterface $serializer
3949
* @param Configuration $configuration
50+
* @param Uid|null $uidEncoder
4051
*/
4152
public function __construct(
4253
Data $pricingHelper,
4354
SerializerInterface $serializer,
44-
Configuration $configuration
55+
Configuration $configuration,
56+
Uid $uidEncoder = null
4557
) {
4658
$this->pricingHelper = $pricingHelper;
4759
$this->serializer = $serializer;
4860
$this->configuration = $configuration;
61+
$this->uidEncoder = $uidEncoder ?: ObjectManager::getInstance()
62+
->get(Uid::class);
4963
}
5064

5165
/**
@@ -103,6 +117,7 @@ private function buildBundleOptions(array $bundleOptions, Item $item): array
103117

104118
$options[] = [
105119
'id' => $bundleOption->getId(),
120+
'uid' => $this->uidEncoder->encode(self::OPTION_TYPE . '/' . $bundleOption->getId()),
106121
'label' => $bundleOption->getTitle(),
107122
'type' => $bundleOption->getType(),
108123
'values' => $this->buildBundleOptionValues($bundleOption->getSelections(), $item),
@@ -131,9 +146,15 @@ private function buildBundleOptionValues(array $selections, Item $item): array
131146
}
132147

133148
$selectionPrice = $this->configuration->getSelectionFinalPrice($item, $selection);
134-
149+
$optionDetails = [
150+
self::OPTION_TYPE,
151+
$selection->getData('option_id'),
152+
$selection->getData('selection_id'),
153+
(int) $selection->getData('selection_qty')
154+
];
135155
$values[] = [
136156
'id' => $selection->getSelectionId(),
157+
'uid' => $this->uidEncoder->encode(implode('/', $optionDetails)),
137158
'label' => $selection->getName(),
138159
'quantity' => $qty,
139160
'price' => $this->pricingHelper->currency($selectionPrice, false, false),

0 commit comments

Comments
 (0)