Skip to content

Commit

Permalink
Merge pull request #8131 from magento-l3/PR-2023-02-07
Browse files Browse the repository at this point in the history
Pr 2023 02 07
  • Loading branch information
viktym committed Feb 15, 2023
2 parents 96ce2ed + ca3f061 commit 3218b12
Show file tree
Hide file tree
Showing 53 changed files with 1,274 additions and 228 deletions.
7 changes: 7 additions & 0 deletions app/code/Magento/Checkout/view/frontend/web/js/model/quote.js
Expand Up @@ -141,6 +141,13 @@ define([
});

return total;
},

/**
* @return {Boolean}
*/
isPersistent: function () {
return !!Number(quoteData['is_persistent']);
}
};
});
Expand Up @@ -52,8 +52,10 @@ define([
shippingService.setShippingRates(cache);
shippingService.isLoading(false);
} else {
let async = quote.isPersistent() ? false : true;

storage.post(
serviceUrl, payload, false
serviceUrl, payload, false, 'application/json', {}, async
).done(function (result) {
rateRegistry.set(address.getCacheKey(), result);
shippingService.setShippingRates(result);
Expand Down
Expand Up @@ -12,6 +12,9 @@
<body>
<referenceContainer name="content">
<block class="Magento\Contact\Block\ContactForm" name="contactForm" template="Magento_Contact::form.phtml">
<arguments>
<argument name="button_lock_manager" xsi:type="object">Magento\Framework\View\Element\ButtonLockManager</argument>
</arguments>
<container name="form.additional.info" label="Form Additional Info"/>
</block>
</referenceContainer>
Expand Down
6 changes: 5 additions & 1 deletion app/code/Magento/Contact/view/frontend/templates/form.phtml
Expand Up @@ -80,7 +80,11 @@ $viewModel = $block->getViewModel();
<div class="actions-toolbar">
<div class="primary">
<input type="hidden" name="hideit" id="hideit" value="" />
<button type="submit" title="<?= $block->escapeHtmlAttr(__('Submit')) ?>" class="action submit primary">
<button type="submit" title="<?= $block->escapeHtmlAttr(__('Submit')) ?>" class="action submit primary"
id="send2"
<?php if ($block->getButtonLockManager()->isDisabled('contact_us_form_submit')): ?>
disabled="disabled"
<?php endif; ?>>
<span><?= $block->escapeHtml(__('Submit')) ?></span>
</button>
</div>
Expand Down
Expand Up @@ -11,7 +11,7 @@
<element name="errorMessage" type="input" selector="[data-ui-id='checkout-cart-validationmessages-message-error']"/>
<element name="email" type="input" selector="#customer-email"/>
<element name="password" type="input" selector="#pass"/>
<element name="signIn" type="button" selector="#send2" timeout="30"/>
<element name="signIn" type="button" selector="(//button[@id='send2'][contains(@class, 'login')])[1]" timeout="30"/>
<element name="forgotYourPassword" type="button" selector="//a[@class='action']//span[contains(text(),'Forgot Your Password?')]" timeout="30"/>
<element name="createAnAccount" type="button" selector="//div[contains(@class,'actions-toolbar')]//a[contains(.,'Create an Account')]" timeout="30"/>
</section>
Expand Down
26 changes: 0 additions & 26 deletions app/code/Magento/Customer/ViewModel/CreateAccountButton.php

This file was deleted.

26 changes: 0 additions & 26 deletions app/code/Magento/Customer/ViewModel/ForgotPasswordButton.php

This file was deleted.

26 changes: 0 additions & 26 deletions app/code/Magento/Customer/ViewModel/LoginButton.php

This file was deleted.

Expand Up @@ -18,7 +18,7 @@
<arguments>
<argument name="attribute_data" xsi:type="object">Magento\Customer\Block\DataProviders\AddressAttributeData</argument>
<argument name="region_provider" xsi:type="object">Magento\Customer\ViewModel\Address\RegionProvider</argument>
<argument name="create_account_button_view_model" xsi:type="object">Magento\Customer\ViewModel\CreateAccountButton</argument>
<argument name="button_lock_manager" xsi:type="object">Magento\Framework\View\Element\ButtonLockManager</argument>
</arguments>
<container name="form.additional.info" as="form_additional_info"/>
<container name="customer.form.register.fields.before" as="form_fields_before" label="Form Fields Before" htmlTag="div" htmlClass="customer-form-before"/>
Expand Down
Expand Up @@ -21,6 +21,9 @@
</referenceBlock>
<referenceContainer name="content">
<block class="Magento\Customer\Block\Form\Edit" name="customer_edit" template="Magento_Customer::form/edit.phtml" cacheable="false">
<arguments>
<argument name="button_lock_manager" xsi:type="object">Magento\Framework\View\Element\ButtonLockManager</argument>
</arguments>
<container name="form.additional.info" as="form_additional_info"/>
</block>
</referenceContainer>
Expand Down
Expand Up @@ -18,7 +18,7 @@
<referenceContainer name="content">
<block class="Magento\Customer\Block\Account\Forgotpassword" name="forgotPassword" template="Magento_Customer::form/forgotpassword.phtml">
<arguments>
<argument name="forgot_password_button_view_model" xsi:type="object">Magento\Customer\ViewModel\ForgotPasswordButton</argument>
<argument name="button_lock_manager" xsi:type="object">Magento\Framework\View\Element\ButtonLockManager</argument>
</arguments>
<container name="form.additional.info" as="form_additional_info"/>
</block>
Expand Down
Expand Up @@ -16,7 +16,7 @@
<block class="Magento\Customer\Block\Form\Login" name="customer_form_login" template="Magento_Customer::form/login.phtml">
<container name="form.additional.info" as="form_additional_info"/>
<arguments>
<argument name="login_button_view_model" xsi:type="object">Magento\Customer\ViewModel\LoginButton</argument>
<argument name="button_lock_manager" xsi:type="object">Magento\Framework\View\Element\ButtonLockManager</argument>
</arguments>
</block>
<block class="Magento\Customer\Block\Form\Login\Info" name="customer.new" template="Magento_Customer::newcustomer.phtml"/>
Expand Down
Expand Up @@ -115,8 +115,11 @@ use Magento\Customer\Block\Widget\Name;

<div class="actions-toolbar">
<div class="primary">
<button type="submit" class="action save primary" title="<?= $block->escapeHtmlAttr(__('Save')) ?>">
<span><?= $block->escapeHtml(__('Save')) ?></span>
<button type="submit" class="action save primary" title="<?= $block->escapeHtmlAttr(__('Save')) ?>"
<?php if ($block->getButtonLockManager()->isDisabled('customer_edit_form_submit')): ?>
disabled="disabled"
<?php endif; ?>>
<span><?= $block->escapeHtml(__('Save')) ?></span>
</button>
</div>
<div class="secondary">
Expand Down
Expand Up @@ -9,8 +9,6 @@
// phpcs:disable Generic.Files.LineLength.TooLong

/** @var \Magento\Customer\Block\Account\Forgotpassword $block */
/** @var \Magento\Customer\ViewModel\ForgotPasswordButton $forgotPasswordButtonViewModel */
$forgotPasswordButtonViewModel = $block->getData('forgot_password_button_view_model');
?>
<form class="form password forget"
action="<?= $block->escapeUrl($block->getUrl('*/*/forgotpasswordpost')) ?>"
Expand All @@ -29,7 +27,7 @@ $forgotPasswordButtonViewModel = $block->getData('forgot_password_button_view_mo
</fieldset>
<div class="actions-toolbar">
<div class="primary">
<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>
<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>
</div>
<div class="secondary">
<a class="action back" href="<?= $block->escapeUrl($block->getLoginUrl()) ?>"><span><?= $block->escapeHtml(__('Go back')) ?></span></a>
Expand Down
Expand Up @@ -7,8 +7,6 @@
// phpcs:disable Generic.Files.LineLength.TooLong

/** @var \Magento\Customer\Block\Form\Login $block */
/** @var \Magento\Customer\ViewModel\LoginButton $loginButtonViewModel */
$loginButtonViewModel = $block->getData('login_button_view_model');
?>
<div class="block block-customer-login">
<div class="block-title">
Expand Down Expand Up @@ -49,7 +47,11 @@ $loginButtonViewModel = $block->getData('login_button_view_model');
</div>
<?= $block->getChildHtml('form_additional_info') ?>
<div class="actions-toolbar">
<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>
<div class="primary">
<button type="submit" class="action login primary" name="send" id="send2" <?php if ($block->getButtonLockManager()->isDisabled('customer_login_form_submit')): ?> disabled="disabled" <?php endif; ?>>
<span><?= $block->escapeHtml(__('Sign In')) ?></span>
</button>
</div>
<div class="secondary"><a class="action remind" href="<?= $block->escapeUrl($block->getForgotPasswordUrl()) ?>"><span><?= $block->escapeHtml(__('Forgot Your Password?')) ?></span></a></div>
</div>
</fieldset>
Expand Down
Expand Up @@ -17,8 +17,6 @@ $directoryHelper = $block->getData('directoryHelper');
/** @var \Magento\Customer\ViewModel\Address\RegionProvider $regionProvider */
$regionProvider = $block->getRegionProvider();
$formData = $block->getFormData();
/** @var \Magento\Customer\ViewModel\CreateAccountButton $createAccountButtonViewModel */
$createAccountButtonViewModel = $block->getData('create_account_button_view_model');
?>
<?php $displayAll = $block->getConfig('general/region/display_all'); ?>
<?= $block->getChildHtml('form_fields_before') ?>
Expand Down Expand Up @@ -296,7 +294,9 @@ $createAccountButtonViewModel = $block->getData('create_account_button_view_mode
class="action submit primary"
title="<?= $escaper->escapeHtmlAttr(__('Create an Account')) ?>"
id="send2"
<?php if ($createAccountButtonViewModel->disabled()): ?> disabled="disabled" <?php endif; ?>>
<?php if ($block->getButtonLockManager()->isDisabled('customer_create_form_submit')): ?>
disabled="disabled"
<?php endif; ?>>
<span><?= $escaper->escapeHtml(__('Create an Account')) ?></span>
</button>
</div>
Expand Down
95 changes: 95 additions & 0 deletions app/code/Magento/Email/Test/Fixture/FileTransport.php
@@ -0,0 +1,95 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Email\Test\Fixture;

use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\Framework\DataObject;
use Magento\Framework\DataObjectFactory;
use Magento\Framework\Filesystem;
use Magento\Framework\Serialize\Serializer\Json;
use Magento\TestFramework\Fixture\Data\ProcessorInterface;
use Magento\TestFramework\Fixture\RevertibleDataFixtureInterface;

class FileTransport implements RevertibleDataFixtureInterface
{
private const DEFAULT_DATA = [
'directory' => DirectoryList::TMP,
'path' => 'mail/%uniqid%',
];

private const CONFIG_FILE = 'mail-transport-config.json';

/**
* @var Filesystem
*/
private Filesystem $filesystem;

/**
* @var Json
*/
private Json $json;

/**
* @var ProcessorInterface
*/
private ProcessorInterface $dataProcessor;

/**
* @var DataObjectFactory
*/
private DataObjectFactory $dataObjectFactory;

/**
* @param Filesystem $filesystem
* @param Json $json
* @param ProcessorInterface $dataProcessor
* @param DataObjectFactory $dataObjectFactory
*/
public function __construct(
Filesystem $filesystem,
Json $json,
ProcessorInterface $dataProcessor,
DataObjectFactory $dataObjectFactory
) {
$this->filesystem = $filesystem;
$this->json = $json;
$this->dataProcessor = $dataProcessor;
$this->dataObjectFactory = $dataObjectFactory;
}

/**
* {@inheritdoc}
* @param array $data Parameters
* <pre>
* $data = [
* 'directory' => (string) Filesystem directory code. Optional. Default: tmp dir
* 'path' => (string) Relative path to "directory" where to save mails. Optional. Default: autogenerated
* ]
* </pre>
*/
public function apply(array $data = []): ?DataObject
{
$data = $this->dataProcessor->process($this, array_merge(self::DEFAULT_DATA, $data));
$directory = $this->filesystem->getDirectoryWrite(DirectoryList::VAR_DIR);
$directory->writeFile(self::CONFIG_FILE, $this->json->serialize($data));

return $this->dataObjectFactory->create(['data' => $data]);
}

/**
* @inheritDoc
*/
public function revert(DataObject $data): void
{
$directory = $this->filesystem->getDirectoryWrite(DirectoryList::VAR_DIR);
$config = $this->json->unserialize($directory->readFile(self::CONFIG_FILE));
$directory->delete(self::CONFIG_FILE);
$directory = $this->filesystem->getDirectoryWrite($config['directory']);
$directory->delete($config['path']);
}
}
Expand Up @@ -34,6 +34,8 @@ public function __construct(
}

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

return $result;
}
Expand Down

0 comments on commit 3218b12

Please sign in to comment.