From f7bc602305df67f1824cda8179355c86df8447c9 Mon Sep 17 00:00:00 2001 From: minkyngkm Date: Mon, 31 Oct 2022 14:24:51 +0100 Subject: [PATCH] Add description checkbox --- static/js/src/PurchaseModal/PurchaseModal.tsx | 1 + .../components/BuyButton/BuyButton.tsx | 6 +++++- .../components/ConfirmAndBuy/ConfirmAndBuy.tsx | 15 ++++++++++++++- static/js/src/PurchaseModal/utils/utils.ts | 2 ++ .../advantage/offers/components/Offer/Offer.tsx | 1 + .../Subscriptions/RenewalModal/RenewalModal.tsx | 1 + .../components/PaymentModal/PaymentModal.tsx | 1 + .../components/PaymentModal/PaymentModal.tsx | 1 + static/sass/_pattern_checkout.scss | 10 +++++----- 9 files changed, 31 insertions(+), 7 deletions(-) diff --git a/static/js/src/PurchaseModal/PurchaseModal.tsx b/static/js/src/PurchaseModal/PurchaseModal.tsx index cffdf82fb48..f6642fb260b 100644 --- a/static/js/src/PurchaseModal/PurchaseModal.tsx +++ b/static/js/src/PurchaseModal/PurchaseModal.tsx @@ -200,6 +200,7 @@ const PurchaseModal = ({ content: ( ), diff --git a/static/js/src/PurchaseModal/components/BuyButton/BuyButton.tsx b/static/js/src/PurchaseModal/components/BuyButton/BuyButton.tsx index b2979b00c7e..79c5e39f3e4 100644 --- a/static/js/src/PurchaseModal/components/BuyButton/BuyButton.tsx +++ b/static/js/src/PurchaseModal/components/BuyButton/BuyButton.tsx @@ -28,7 +28,10 @@ const BuyButton = ({ setError, quantity, product, action }: Props) => { const genericPurchaseMutation = useMakePurchase(); const isButtonDisabled = - !values.captchaValue || !values.TermsAndConditions || isLoading; + !values.captchaValue || + !values.TermsAndConditions || + !values.Description || + isLoading; const buyAction = values.FreeTrial === "useFreeTrial" ? "trial" : action; @@ -148,6 +151,7 @@ const BuyButton = ({ setError, quantity, product, action }: Props) => { } } setFieldValue("MarketingOptIn", false); + setFieldValue("Description", false); setFieldValue("TermsAndConditions", false); } }, [purchaseError]); diff --git a/static/js/src/PurchaseModal/components/ConfirmAndBuy/ConfirmAndBuy.tsx b/static/js/src/PurchaseModal/components/ConfirmAndBuy/ConfirmAndBuy.tsx index 63d8b740e13..36be187c94a 100644 --- a/static/js/src/PurchaseModal/components/ConfirmAndBuy/ConfirmAndBuy.tsx +++ b/static/js/src/PurchaseModal/components/ConfirmAndBuy/ConfirmAndBuy.tsx @@ -4,10 +4,15 @@ import { Row, Col, CheckboxInput } from "@canonical/react-components"; type Props = { termsLabel: React.ReactNode; + descriptionLabel: React.ReactNode; marketingLabel: React.ReactNode; }; -const ConfirmAndBuy = ({ termsLabel, marketingLabel }: Props) => { +const ConfirmAndBuy = ({ + termsLabel, + descriptionLabel, + marketingLabel, +}: Props) => { return ( @@ -18,6 +23,14 @@ const ConfirmAndBuy = ({ termsLabel, marketingLabel }: Props) => { defaultChecked={false} /> + + + { termsLabel={termsLabel} product={product} quantity={items.length} + descriptionLabel={descriptionLabel} marketingLabel={marketingLabel} Summary={OfferSummary} closeModal={closePortal} diff --git a/static/js/src/advantage/react/components/Subscriptions/RenewalModal/RenewalModal.tsx b/static/js/src/advantage/react/components/Subscriptions/RenewalModal/RenewalModal.tsx index f936abb9d24..48ae47ec2dc 100644 --- a/static/js/src/advantage/react/components/Subscriptions/RenewalModal/RenewalModal.tsx +++ b/static/js/src/advantage/react/components/Subscriptions/RenewalModal/RenewalModal.tsx @@ -99,6 +99,7 @@ const RenewalModal = ({ subscription, editing }: Props) => {