From 1b24d2669e20f6a2bb9ea2174af988b14b0d0044 Mon Sep 17 00:00:00 2001 From: Caleb Alldrin Date: Wed, 18 Dec 2024 18:06:36 -0800 Subject: [PATCH] Move checkout error messages to a new component --- .../branded-checkout-step-1.component.js | 2 + .../step-1/branded-checkout-step-1.tpl.html | 5 ++ .../checkout-error-messages.component.js | 19 +++++++ .../checkout-error-messages.tpl.html | 44 +++++++++++++++++ src/app/checkout/step-3/step-3.component.js | 4 +- src/app/checkout/step-3/step-3.tpl.html | 49 ++----------------- 6 files changed, 78 insertions(+), 45 deletions(-) create mode 100644 src/app/checkout/checkout-error-messages/checkout-error-messages.component.js create mode 100644 src/app/checkout/checkout-error-messages/checkout-error-messages.tpl.html diff --git a/src/app/branded/step-1/branded-checkout-step-1.component.js b/src/app/branded/step-1/branded-checkout-step-1.component.js index a6d16d249..2c5de9e44 100644 --- a/src/app/branded/step-1/branded-checkout-step-1.component.js +++ b/src/app/branded/step-1/branded-checkout-step-1.component.js @@ -4,6 +4,7 @@ import every from 'lodash/every' import productConfigForm from 'app/productConfig/productConfigForm/productConfigForm.component' import contactInfo from 'common/components/contactInfo/contactInfo.component' import checkoutStep2 from 'app/checkout/step-2/step-2.component' +import checkoutErrorMessages from 'app/checkout/checkout-error-messages/checkout-error-messages.component' import cartService from 'common/services/api/cart.service' import orderService from 'common/services/api/order.service' @@ -273,6 +274,7 @@ export default angular productConfigForm.name, contactInfo.name, checkoutStep2.name, + checkoutErrorMessages.name, cartService.name, orderService.name, analyticsFactory.name, diff --git a/src/app/branded/step-1/branded-checkout-step-1.tpl.html b/src/app/branded/step-1/branded-checkout-step-1.tpl.html index 8fd9bb70b..76de3fa51 100644 --- a/src/app/branded/step-1/branded-checkout-step-1.tpl.html +++ b/src/app/branded/step-1/branded-checkout-step-1.tpl.html @@ -1,3 +1,8 @@ + +
diff --git a/src/app/checkout/checkout-error-messages/checkout-error-messages.component.js b/src/app/checkout/checkout-error-messages/checkout-error-messages.component.js new file mode 100644 index 000000000..d6a5a7f60 --- /dev/null +++ b/src/app/checkout/checkout-error-messages/checkout-error-messages.component.js @@ -0,0 +1,19 @@ +import angular from 'angular' + +import template from './checkout-error-messages.tpl.html' + +const componentName = 'checkoutErrorMessages' + +class CheckoutErrorMessagesController {} + +export default angular + .module(componentName, []) + .component(componentName, { + controller: CheckoutErrorMessagesController, + templateUrl: template, + bindings: { + needinfoErrors: '<', + submissionError: '<', + submissionErrorStatus: '<' + } + }) diff --git a/src/app/checkout/checkout-error-messages/checkout-error-messages.tpl.html b/src/app/checkout/checkout-error-messages/checkout-error-messages.tpl.html new file mode 100644 index 000000000..187a80e06 --- /dev/null +++ b/src/app/checkout/checkout-error-messages/checkout-error-messages.tpl.html @@ -0,0 +1,44 @@ + diff --git a/src/app/checkout/step-3/step-3.component.js b/src/app/checkout/step-3/step-3.component.js index 6745c4153..f2d871741 100644 --- a/src/app/checkout/step-3/step-3.component.js +++ b/src/app/checkout/step-3/step-3.component.js @@ -2,6 +2,7 @@ import angular from 'angular' import 'rxjs/add/observable/throw' import displayAddressComponent from 'common/components/display-address/display-address.component' +import checkoutErrorMessages from 'app/checkout/checkout-error-messages/checkout-error-messages.component' import displayRateTotals from 'common/components/displayRateTotals/displayRateTotals.component' import commonService from 'common/services/api/common.service' @@ -163,7 +164,8 @@ export default angular analyticsFactory.name, cartService.name, commonService.name, - recaptchaComponent.name + recaptchaComponent.name, + checkoutErrorMessages.name ]) .component(componentName, { controller: Step3Controller, diff --git a/src/app/checkout/step-3/step-3.tpl.html b/src/app/checkout/step-3/step-3.tpl.html index fd65b98fe..67fa357a2 100644 --- a/src/app/checkout/step-3/step-3.tpl.html +++ b/src/app/checkout/step-3/step-3.tpl.html @@ -1,48 +1,9 @@
- + +