Skip to content

Commit 3218b12

Browse files
authored
Merge pull request #8131 from magento-l3/PR-2023-02-07
Pr 2023 02 07
2 parents 96ce2ed + ca3f061 commit 3218b12

File tree

53 files changed

+1274
-228
lines changed

Some content is hidden

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

53 files changed

+1274
-228
lines changed

app/code/Magento/Checkout/view/frontend/web/js/model/quote.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,13 @@ define([
141141
});
142142

143143
return total;
144+
},
145+
146+
/**
147+
* @return {Boolean}
148+
*/
149+
isPersistent: function () {
150+
return !!Number(quoteData['is_persistent']);
144151
}
145152
};
146153
});

app/code/Magento/Checkout/view/frontend/web/js/model/shipping-rate-processor/new-address.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ define([
5252
shippingService.setShippingRates(cache);
5353
shippingService.isLoading(false);
5454
} else {
55+
let async = quote.isPersistent() ? false : true;
56+
5557
storage.post(
56-
serviceUrl, payload, false
58+
serviceUrl, payload, false, 'application/json', {}, async
5759
).done(function (result) {
5860
rateRegistry.set(address.getCacheKey(), result);
5961
shippingService.setShippingRates(result);

app/code/Magento/Contact/view/frontend/layout/contact_index_index.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
<body>
1313
<referenceContainer name="content">
1414
<block class="Magento\Contact\Block\ContactForm" name="contactForm" template="Magento_Contact::form.phtml">
15+
<arguments>
16+
<argument name="button_lock_manager" xsi:type="object">Magento\Framework\View\Element\ButtonLockManager</argument>
17+
</arguments>
1518
<container name="form.additional.info" label="Form Additional Info"/>
1619
</block>
1720
</referenceContainer>

app/code/Magento/Contact/view/frontend/templates/form.phtml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,11 @@ $viewModel = $block->getViewModel();
8080
<div class="actions-toolbar">
8181
<div class="primary">
8282
<input type="hidden" name="hideit" id="hideit" value="" />
83-
<button type="submit" title="<?= $block->escapeHtmlAttr(__('Submit')) ?>" class="action submit primary">
83+
<button type="submit" title="<?= $block->escapeHtmlAttr(__('Submit')) ?>" class="action submit primary"
84+
id="send2"
85+
<?php if ($block->getButtonLockManager()->isDisabled('contact_us_form_submit')): ?>
86+
disabled="disabled"
87+
<?php endif; ?>>
8488
<span><?= $block->escapeHtml(__('Submit')) ?></span>
8589
</button>
8690
</div>

app/code/Magento/Customer/Test/Mftf/Section/StorefrontCustomerSignInFormSection/StorefrontCustomerSignInPopupFormSection.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<element name="errorMessage" type="input" selector="[data-ui-id='checkout-cart-validationmessages-message-error']"/>
1212
<element name="email" type="input" selector="#customer-email"/>
1313
<element name="password" type="input" selector="#pass"/>
14-
<element name="signIn" type="button" selector="#send2" timeout="30"/>
14+
<element name="signIn" type="button" selector="(//button[@id='send2'][contains(@class, 'login')])[1]" timeout="30"/>
1515
<element name="forgotYourPassword" type="button" selector="//a[@class='action']//span[contains(text(),'Forgot Your Password?')]" timeout="30"/>
1616
<element name="createAnAccount" type="button" selector="//div[contains(@class,'actions-toolbar')]//a[contains(.,'Create an Account')]" timeout="30"/>
1717
</section>

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

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

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

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

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

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

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<arguments>
1919
<argument name="attribute_data" xsi:type="object">Magento\Customer\Block\DataProviders\AddressAttributeData</argument>
2020
<argument name="region_provider" xsi:type="object">Magento\Customer\ViewModel\Address\RegionProvider</argument>
21-
<argument name="create_account_button_view_model" xsi:type="object">Magento\Customer\ViewModel\CreateAccountButton</argument>
21+
<argument name="button_lock_manager" xsi:type="object">Magento\Framework\View\Element\ButtonLockManager</argument>
2222
</arguments>
2323
<container name="form.additional.info" as="form_additional_info"/>
2424
<container name="customer.form.register.fields.before" as="form_fields_before" label="Form Fields Before" htmlTag="div" htmlClass="customer-form-before"/>

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
</referenceBlock>
2222
<referenceContainer name="content">
2323
<block class="Magento\Customer\Block\Form\Edit" name="customer_edit" template="Magento_Customer::form/edit.phtml" cacheable="false">
24+
<arguments>
25+
<argument name="button_lock_manager" xsi:type="object">Magento\Framework\View\Element\ButtonLockManager</argument>
26+
</arguments>
2427
<container name="form.additional.info" as="form_additional_info"/>
2528
</block>
2629
</referenceContainer>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<referenceContainer name="content">
1919
<block class="Magento\Customer\Block\Account\Forgotpassword" name="forgotPassword" template="Magento_Customer::form/forgotpassword.phtml">
2020
<arguments>
21-
<argument name="forgot_password_button_view_model" xsi:type="object">Magento\Customer\ViewModel\ForgotPasswordButton</argument>
21+
<argument name="button_lock_manager" xsi:type="object">Magento\Framework\View\Element\ButtonLockManager</argument>
2222
</arguments>
2323
<container name="form.additional.info" as="form_additional_info"/>
2424
</block>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<block class="Magento\Customer\Block\Form\Login" name="customer_form_login" template="Magento_Customer::form/login.phtml">
1717
<container name="form.additional.info" as="form_additional_info"/>
1818
<arguments>
19-
<argument name="login_button_view_model" xsi:type="object">Magento\Customer\ViewModel\LoginButton</argument>
19+
<argument name="button_lock_manager" xsi:type="object">Magento\Framework\View\Element\ButtonLockManager</argument>
2020
</arguments>
2121
</block>
2222
<block class="Magento\Customer\Block\Form\Login\Info" name="customer.new" template="Magento_Customer::newcustomer.phtml"/>

app/code/Magento/Customer/view/frontend/templates/form/edit.phtml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,11 @@ use Magento\Customer\Block\Widget\Name;
115115

116116
<div class="actions-toolbar">
117117
<div class="primary">
118-
<button type="submit" class="action save primary" title="<?= $block->escapeHtmlAttr(__('Save')) ?>">
119-
<span><?= $block->escapeHtml(__('Save')) ?></span>
118+
<button type="submit" class="action save primary" title="<?= $block->escapeHtmlAttr(__('Save')) ?>"
119+
<?php if ($block->getButtonLockManager()->isDisabled('customer_edit_form_submit')): ?>
120+
disabled="disabled"
121+
<?php endif; ?>>
122+
<span><?= $block->escapeHtml(__('Save')) ?></span>
120123
</button>
121124
</div>
122125
<div class="secondary">

app/code/Magento/Customer/view/frontend/templates/form/forgotpassword.phtml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
// phpcs:disable Generic.Files.LineLength.TooLong
1010

1111
/** @var \Magento\Customer\Block\Account\Forgotpassword $block */
12-
/** @var \Magento\Customer\ViewModel\ForgotPasswordButton $forgotPasswordButtonViewModel */
13-
$forgotPasswordButtonViewModel = $block->getData('forgot_password_button_view_model');
1412
?>
1513
<form class="form password forget"
1614
action="<?= $block->escapeUrl($block->getUrl('*/*/forgotpasswordpost')) ?>"
@@ -29,7 +27,7 @@ $forgotPasswordButtonViewModel = $block->getData('forgot_password_button_view_mo
2927
</fieldset>
3028
<div class="actions-toolbar">
3129
<div class="primary">
32-
<button type="submit" class="action submit primary" id="send2" <?php if ($forgotPasswordButtonViewModel->disabled()): ?> disabled="disabled" <?php endif; ?>><span><?= $block->escapeHtml(__('Reset My Password')) ?></span></button>
30+
<button type="submit" class="action submit primary" id="send2" <?php if ($block->getButtonLockManager()->isDisabled('customer_forgot_password_form_submit')): ?> disabled="disabled" <?php endif; ?>><span><?= $block->escapeHtml(__('Reset My Password')) ?></span></button>
3331
</div>
3432
<div class="secondary">
3533
<a class="action back" href="<?= $block->escapeUrl($block->getLoginUrl()) ?>"><span><?= $block->escapeHtml(__('Go back')) ?></span></a>

app/code/Magento/Customer/view/frontend/templates/form/login.phtml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
// phpcs:disable Generic.Files.LineLength.TooLong
88

99
/** @var \Magento\Customer\Block\Form\Login $block */
10-
/** @var \Magento\Customer\ViewModel\LoginButton $loginButtonViewModel */
11-
$loginButtonViewModel = $block->getData('login_button_view_model');
1210
?>
1311
<div class="block block-customer-login">
1412
<div class="block-title">
@@ -49,7 +47,11 @@ $loginButtonViewModel = $block->getData('login_button_view_model');
4947
</div>
5048
<?= $block->getChildHtml('form_additional_info') ?>
5149
<div class="actions-toolbar">
52-
<div class="primary"><button type="submit" class="action login primary" name="send" id="send2" <?php if ($loginButtonViewModel->disabled()): ?> disabled="disabled" <?php endif; ?>><span><?= $block->escapeHtml(__('Sign In')) ?></span></button></div>
50+
<div class="primary">
51+
<button type="submit" class="action login primary" name="send" id="send2" <?php if ($block->getButtonLockManager()->isDisabled('customer_login_form_submit')): ?> disabled="disabled" <?php endif; ?>>
52+
<span><?= $block->escapeHtml(__('Sign In')) ?></span>
53+
</button>
54+
</div>
5355
<div class="secondary"><a class="action remind" href="<?= $block->escapeUrl($block->getForgotPasswordUrl()) ?>"><span><?= $block->escapeHtml(__('Forgot Your Password?')) ?></span></a></div>
5456
</div>
5557
</fieldset>

app/code/Magento/Customer/view/frontend/templates/form/register.phtml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ $directoryHelper = $block->getData('directoryHelper');
1717
/** @var \Magento\Customer\ViewModel\Address\RegionProvider $regionProvider */
1818
$regionProvider = $block->getRegionProvider();
1919
$formData = $block->getFormData();
20-
/** @var \Magento\Customer\ViewModel\CreateAccountButton $createAccountButtonViewModel */
21-
$createAccountButtonViewModel = $block->getData('create_account_button_view_model');
2220
?>
2321
<?php $displayAll = $block->getConfig('general/region/display_all'); ?>
2422
<?= $block->getChildHtml('form_fields_before') ?>
@@ -296,7 +294,9 @@ $createAccountButtonViewModel = $block->getData('create_account_button_view_mode
296294
class="action submit primary"
297295
title="<?= $escaper->escapeHtmlAttr(__('Create an Account')) ?>"
298296
id="send2"
299-
<?php if ($createAccountButtonViewModel->disabled()): ?> disabled="disabled" <?php endif; ?>>
297+
<?php if ($block->getButtonLockManager()->isDisabled('customer_create_form_submit')): ?>
298+
disabled="disabled"
299+
<?php endif; ?>>
300300
<span><?= $escaper->escapeHtml(__('Create an Account')) ?></span>
301301
</button>
302302
</div>
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Email\Test\Fixture;
9+
10+
use Magento\Framework\App\Filesystem\DirectoryList;
11+
use Magento\Framework\DataObject;
12+
use Magento\Framework\DataObjectFactory;
13+
use Magento\Framework\Filesystem;
14+
use Magento\Framework\Serialize\Serializer\Json;
15+
use Magento\TestFramework\Fixture\Data\ProcessorInterface;
16+
use Magento\TestFramework\Fixture\RevertibleDataFixtureInterface;
17+
18+
class FileTransport implements RevertibleDataFixtureInterface
19+
{
20+
private const DEFAULT_DATA = [
21+
'directory' => DirectoryList::TMP,
22+
'path' => 'mail/%uniqid%',
23+
];
24+
25+
private const CONFIG_FILE = 'mail-transport-config.json';
26+
27+
/**
28+
* @var Filesystem
29+
*/
30+
private Filesystem $filesystem;
31+
32+
/**
33+
* @var Json
34+
*/
35+
private Json $json;
36+
37+
/**
38+
* @var ProcessorInterface
39+
*/
40+
private ProcessorInterface $dataProcessor;
41+
42+
/**
43+
* @var DataObjectFactory
44+
*/
45+
private DataObjectFactory $dataObjectFactory;
46+
47+
/**
48+
* @param Filesystem $filesystem
49+
* @param Json $json
50+
* @param ProcessorInterface $dataProcessor
51+
* @param DataObjectFactory $dataObjectFactory
52+
*/
53+
public function __construct(
54+
Filesystem $filesystem,
55+
Json $json,
56+
ProcessorInterface $dataProcessor,
57+
DataObjectFactory $dataObjectFactory
58+
) {
59+
$this->filesystem = $filesystem;
60+
$this->json = $json;
61+
$this->dataProcessor = $dataProcessor;
62+
$this->dataObjectFactory = $dataObjectFactory;
63+
}
64+
65+
/**
66+
* {@inheritdoc}
67+
* @param array $data Parameters
68+
* <pre>
69+
* $data = [
70+
* 'directory' => (string) Filesystem directory code. Optional. Default: tmp dir
71+
* 'path' => (string) Relative path to "directory" where to save mails. Optional. Default: autogenerated
72+
* ]
73+
* </pre>
74+
*/
75+
public function apply(array $data = []): ?DataObject
76+
{
77+
$data = $this->dataProcessor->process($this, array_merge(self::DEFAULT_DATA, $data));
78+
$directory = $this->filesystem->getDirectoryWrite(DirectoryList::VAR_DIR);
79+
$directory->writeFile(self::CONFIG_FILE, $this->json->serialize($data));
80+
81+
return $this->dataObjectFactory->create(['data' => $data]);
82+
}
83+
84+
/**
85+
* @inheritDoc
86+
*/
87+
public function revert(DataObject $data): void
88+
{
89+
$directory = $this->filesystem->getDirectoryWrite(DirectoryList::VAR_DIR);
90+
$config = $this->json->unserialize($directory->readFile(self::CONFIG_FILE));
91+
$directory->delete(self::CONFIG_FILE);
92+
$directory = $this->filesystem->getDirectoryWrite($config['directory']);
93+
$directory->delete($config['path']);
94+
}
95+
}

app/code/Magento/GoogleOptimizer/Model/Plugin/Catalog/Category/DataProvider.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ public function __construct(
3434
}
3535

3636
/**
37+
* Updates metadata.
38+
*
3739
* @param \Magento\Catalog\Model\Category\DataProvider $subject
3840
* @param array $result
3941
* @return array
@@ -45,6 +47,7 @@ public function afterPrepareMeta(\Magento\Catalog\Model\Category\DataProvider $s
4547
!$this->_helper->isGoogleExperimentActive();
4648
$result['category_view_optimization']['arguments']['data']['config']['componentType'] =
4749
\Magento\Ui\Component\Form\Fieldset::NAME;
50+
$result['category_view_optimization']['arguments']['data']['config']['label'] = '';
4851

4952
return $result;
5053
}

0 commit comments

Comments
 (0)