-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #151 from magento-commerce/1.1.46-release
1.1.46 Release
- Loading branch information
Showing
14 changed files
with
3,193 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,300 @@ | ||
diff --git a/vendor/magento/module-re-captcha-gift-card/view/frontend/layout/checkout_cart_index.xml b/vendor/magento/module-re-captcha-gift-card/view/frontend/layout/checkout_cart_index.xml | ||
index 8a7e43ed..822f51a0 100644 | ||
--- a/vendor/magento/module-re-captcha-gift-card/view/frontend/layout/checkout_cart_index.xml | ||
+++ b/vendor/magento/module-re-captcha-gift-card/view/frontend/layout/checkout_cart_index.xml | ||
@@ -19,7 +19,7 @@ | ||
<argument name="jsLayout" xsi:type="array"> | ||
<item name="components" xsi:type="array"> | ||
<item name="recaptcha" xsi:type="array"> | ||
- <item name="component" xsi:type="string">Magento_ReCaptchaFrontendUi/js/reCaptcha</item> | ||
+ <item name="component" xsi:type="string">Magento_ReCaptchaGiftCard/js/checkoutReCaptcha</item> | ||
</item> | ||
</item> | ||
</argument> | ||
diff --git a/vendor/magento/module-re-captcha-gift-card/view/frontend/web/js/action/get-gift-card-information-mixin.js b/vendor/magento/module-re-captcha-gift-card/view/frontend/web/js/action/get-gift-card-information-mixin.js | ||
index 2eda05a0..c16606ad 100644 | ||
--- a/vendor/magento/module-re-captcha-gift-card/view/frontend/web/js/action/get-gift-card-information-mixin.js | ||
+++ b/vendor/magento/module-re-captcha-gift-card/view/frontend/web/js/action/get-gift-card-information-mixin.js | ||
@@ -3,7 +3,10 @@ | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
+ /* eslint-disable max-nested-callbacks */ | ||
+ | ||
define([ | ||
+ 'jquery', | ||
'ko', | ||
'mage/storage', | ||
'Magento_Customer/js/model/customer', | ||
@@ -15,6 +18,7 @@ define([ | ||
'mage/utils/wrapper', | ||
'Magento_ReCaptchaWebapiUi/js/webapiReCaptchaRegistry' | ||
], function ( | ||
+ $, | ||
ko, | ||
storage, | ||
customer, | ||
@@ -35,43 +39,57 @@ define([ | ||
* @param {Object} giftCardCode - giftCardCode model. | ||
*/ | ||
check: function (originFn, giftCardCode) { | ||
- var self = this, | ||
+ var recaptchaDeferred, | ||
+ self = this, | ||
serviceUrl, headers = {}; | ||
|
||
+ if (!customer.isLoggedIn()) { | ||
+ serviceUrl = urlBuilder.createUrl('/carts/guest-carts/:cartId/checkGiftCard/:giftCardCode', { | ||
+ cartId: quote.getQuoteId(), | ||
+ giftCardCode: giftCardCode | ||
+ }); | ||
+ } else { | ||
+ serviceUrl = urlBuilder.createUrl('/carts/mine/checkGiftCard/:giftCardCode', { | ||
+ giftCardCode: giftCardCode | ||
+ }); | ||
+ } | ||
+ messageList.clear(); | ||
+ | ||
this.isLoading(true); | ||
|
||
if (recaptchaRegistry.triggers.hasOwnProperty('recaptcha-checkout-gift-apply')) { | ||
+ //ReCaptcha is present for checkout | ||
+ recaptchaDeferred = $.Deferred(); | ||
recaptchaRegistry.addListener('recaptcha-checkout-gift-apply', function (token) { | ||
headers = { | ||
'X-ReCaptcha': token | ||
}; | ||
- }); | ||
|
||
- if (!customer.isLoggedIn()) { | ||
- serviceUrl = urlBuilder.createUrl('/carts/guest-carts/:cartId/checkGiftCard/:giftCardCode', { | ||
- cartId: quote.getQuoteId(), | ||
- giftCardCode: giftCardCode | ||
- }); | ||
- } else { | ||
- serviceUrl = urlBuilder.createUrl('/carts/mine/checkGiftCard/:giftCardCode', { | ||
- giftCardCode: giftCardCode | ||
+ storage.get( | ||
+ serviceUrl, true, 'application/json', headers | ||
+ ).done(function (response) { | ||
+ giftCardAccount.isChecked(true); | ||
+ giftCardAccount.code(giftCardCode); | ||
+ giftCardAccount.amount(response); | ||
+ giftCardAccount.isValid(true); | ||
+ }).fail(function (response) { | ||
+ giftCardAccount.isValid(false); | ||
+ errorProcessor.process(response, messageList); | ||
+ }).always(function () { | ||
+ self.isLoading(false); | ||
}); | ||
+ }); | ||
+ //Trigger ReCaptcha validation | ||
+ recaptchaRegistry.triggers['recaptcha-checkout-gift-apply'](); | ||
+ if ( | ||
+ !recaptchaRegistry._isInvisibleType.hasOwnProperty('recaptcha-checkout-gift-apply') || | ||
+ recaptchaRegistry._isInvisibleType['recaptcha-checkout-gift-apply'] === false | ||
+ ) { | ||
+ //remove listener so that get gift action is only triggered by the 'Gift Apply' button | ||
+ recaptchaRegistry.removeListener('recaptcha-checkout-gift-apply'); | ||
} | ||
- messageList.clear(); | ||
|
||
- return storage.get( | ||
- serviceUrl, true, 'application/json', headers | ||
- ).done(function (response) { | ||
- giftCardAccount.isChecked(true); | ||
- giftCardAccount.code(giftCardCode); | ||
- giftCardAccount.amount(response); | ||
- giftCardAccount.isValid(true); | ||
- }).fail(function (response) { | ||
- giftCardAccount.isValid(false); | ||
- errorProcessor.process(response, messageList); | ||
- }).always(function () { | ||
- self.isLoading(false); | ||
- }); | ||
+ return recaptchaDeferred; | ||
} | ||
|
||
return originFn(giftCardCode); | ||
diff --git a/vendor/magento/module-re-captcha-gift-card/view/frontend/web/js/action/set-gift-card-information-mixin.js b/vendor/magento/module-re-captcha-gift-card/view/frontend/web/js/action/set-gift-card-information-mixin.js | ||
index e8fd257e..25561f8e 100644 | ||
--- a/vendor/magento/module-re-captcha-gift-card/view/frontend/web/js/action/set-gift-card-information-mixin.js | ||
+++ b/vendor/magento/module-re-captcha-gift-card/view/frontend/web/js/action/set-gift-card-information-mixin.js | ||
@@ -3,6 +3,8 @@ | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
+ /* eslint-disable max-nested-callbacks */ | ||
+ | ||
define([ | ||
'jquery', | ||
'mage/storage', | ||
@@ -34,7 +36,8 @@ define([ | ||
|
||
return function (setGiftCardAction) { | ||
return wrapper.wrap(setGiftCardAction, function (originalAction, giftCardCode) { | ||
- var serviceUrl, | ||
+ var recaptchaDeferred, | ||
+ serviceUrl, | ||
payload, | ||
headers = {}, | ||
message = $.mage.__('Gift Card %1 was added.').replace('%1', giftCardCode); | ||
@@ -63,34 +66,46 @@ define([ | ||
} | ||
|
||
if (recaptchaRegistry.triggers.hasOwnProperty('recaptcha-checkout-gift-apply')) { | ||
+ //ReCaptcha is present for checkout | ||
+ recaptchaDeferred = $.Deferred(); | ||
recaptchaRegistry.addListener('recaptcha-checkout-gift-apply', function (token) { | ||
headers['X-ReCaptcha'] = token; | ||
- }); | ||
+ storage.post( | ||
+ serviceUrl, JSON.stringify(payload), true, 'application/json', headers | ||
+ ).done(function (response) { | ||
+ /** | ||
+ * Callback for getPaymentInformationAction. | ||
+ */ | ||
+ var onGetPaymentInformationAction = function () { | ||
+ totals.isLoading(false); | ||
+ }, | ||
+ deferred = $.Deferred(); | ||
|
||
- return storage.post( | ||
- serviceUrl, JSON.stringify(payload), true, 'application/json', headers | ||
- ).done(function (response) { | ||
- /** | ||
- * Callback for getPaymentInformationAction. | ||
- */ | ||
- var onGetPaymentInformationAction = function () { | ||
+ if (response) { | ||
+ totals.isLoading(true); | ||
+ $.when(getPaymentInformationAction(deferred)).done(onGetPaymentInformationAction); | ||
+ messageList.addSuccessMessage({ | ||
+ 'message': message | ||
+ }); | ||
+ } | ||
+ }).fail(function (response) { | ||
totals.isLoading(false); | ||
- }, | ||
- deferred = $.Deferred(); | ||
- | ||
- if (response) { | ||
- totals.isLoading(true); | ||
- $.when(getPaymentInformationAction(deferred)).done(onGetPaymentInformationAction); | ||
- messageList.addSuccessMessage({ | ||
- 'message': message | ||
- }); | ||
- } | ||
- }).fail(function (response) { | ||
- totals.isLoading(false); | ||
- errorProcessor.process(response, messageList); | ||
- }).always(function () { | ||
- fullScreenLoader.stopLoader(); | ||
+ errorProcessor.process(response, messageList); | ||
+ }).always(function () { | ||
+ fullScreenLoader.stopLoader(); | ||
+ }); | ||
}); | ||
+ //Trigger ReCaptcha validation | ||
+ recaptchaRegistry.triggers['recaptcha-checkout-gift-apply'](); | ||
+ if ( | ||
+ !recaptchaRegistry._isInvisibleType.hasOwnProperty('recaptcha-checkout-gift-apply') || | ||
+ recaptchaRegistry._isInvisibleType['recaptcha-checkout-gift-apply'] === false | ||
+ ) { | ||
+ //remove listener so that gift-apply action is only triggered by the 'Gift Apply' button | ||
+ recaptchaRegistry.removeListener('recaptcha-checkout-gift-apply'); | ||
+ } | ||
+ | ||
+ return recaptchaDeferred; | ||
} | ||
|
||
//No ReCaptcha, just sending the request | ||
diff --git a/vendor/magento/module-re-captcha-gift-card/view/frontend/web/js/checkoutReCaptcha.js b/vendor/magento/module-re-captcha-gift-card/view/frontend/web/js/checkoutReCaptcha.js | ||
new file mode 100644 | ||
index 00000000..8896649a | ||
--- /dev/null | ||
+++ b/vendor/magento/module-re-captcha-gift-card/view/frontend/web/js/checkoutReCaptcha.js | ||
@@ -0,0 +1,58 @@ | ||
+/************************************************************************ | ||
+ * | ||
+ * ADOBE CONFIDENTIAL | ||
+ * ___________________ | ||
+ * | ||
+ * Copyright 2023 Adobe | ||
+ * All Rights Reserved. | ||
+ * | ||
+ * NOTICE: All information contained herein is, and remains | ||
+ * the property of Adobe and its suppliers, if any. The intellectual | ||
+ * and technical concepts contained herein are proprietary to Adobe | ||
+ * and its suppliers and are protected by all applicable intellectual | ||
+ * property laws, including trade secret and copyright laws. | ||
+ * Dissemination of this information or reproduction of this material | ||
+ * is strictly forbidden unless prior written permission is obtained | ||
+ * from Adobe. | ||
+ * ************************************************************************ | ||
+ */ | ||
+ | ||
+define( | ||
+ [ | ||
+ 'Magento_ReCaptchaFrontendUi/js/reCaptcha' | ||
+ ], | ||
+ function (Component) { | ||
+ 'use strict'; | ||
+ | ||
+ return Component.extend({ | ||
+ /** | ||
+ * Auto-trigger validation so that ReCaptcha is ready for Quick Checkout | ||
+ * | ||
+ * @param {Object} parentForm | ||
+ * @param {String} widgetId | ||
+ */ | ||
+ initParentForm: function (parentForm, widgetId) { | ||
+ window.grecaptcha.execute(widgetId); | ||
+ parentForm.find('.action.check').click(function (event) { | ||
+ if (this.getIsInvisibleRecaptcha()) { | ||
+ window.grecaptcha.execute(widgetId); | ||
+ event.preventDefault(event); | ||
+ event.stopImmediatePropagation(); | ||
+ } | ||
+ }.bind(this)); | ||
+ }, | ||
+ | ||
+ /** | ||
+ * Recording the token | ||
+ * | ||
+ * @param {String} token | ||
+ */ | ||
+ reCaptchaCallback: function (token) { | ||
+ if (this.getIsInvisibleRecaptcha() && this.tokenField) { | ||
+ this.tokenField.value = token; | ||
+ } | ||
+ } | ||
+ }); | ||
+ } | ||
+); | ||
+ | ||
diff --git a/vendor/magento/module-re-captcha-gift-card/view/frontend/web/js/gift-card-recaptcha.js b/vendor/magento/module-re-captcha-gift-card/view/frontend/web/js/gift-card-recaptcha.js | ||
index 7587c258..53bd4834 100644 | ||
--- a/vendor/magento/module-re-captcha-gift-card/view/frontend/web/js/gift-card-recaptcha.js | ||
+++ b/vendor/magento/module-re-captcha-gift-card/view/frontend/web/js/gift-card-recaptcha.js | ||
@@ -2,7 +2,8 @@ | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
-/* global grecaptcha */ | ||
+ | ||
+/* eslint-disable no-unused-vars */ | ||
define( | ||
[ | ||
'Magento_ReCaptchaWebapiUi/js/webapiReCaptcha', | ||
@@ -41,10 +42,6 @@ define( | ||
captchaId = this.getReCaptchaId(); | ||
|
||
this._super(); | ||
- if (self.getIsInvisibleRecaptcha()) { | ||
- grecaptcha.execute(widgetId); | ||
- self.validateReCaptcha(true); | ||
- } | ||
if (GiftCode() != null) { | ||
if (isApplied) { | ||
self.validateReCaptcha(true); |
Oops, something went wrong.