()
| 9 | import PlusListModalSection from './PlusListModalSection'; |
| 10 | |
| 11 | const PlusWebapp = (): ReactElement => { |
| 12 | const { getMarketingCta } = useBoot(); |
| 13 | const marketingCta = getMarketingCta(MarketingCtaVariant.Plus); |
| 14 | const { flags } = marketingCta || {}; |
| 15 | const { openCheckout, productOptions, isPricesPending } = usePaymentContext(); |
| 16 | const [selectedOption, setSelectedOption] = useState<string | null>(); |
| 17 | const checkoutRef = useRef(); |
| 18 | const [showCheckout, setShowCheckout] = useState(false); |
| 19 | |
| 20 | useEffect(() => { |
| 21 | if (!isPricesPending && !selectedOption) { |
| 22 | setSelectedOption(productOptions?.[0]?.priceId); |
| 23 | } |
| 24 | }, [isPricesPending, productOptions, selectedOption]); |
| 25 | |
| 26 | return ( |
| 27 | <div className="flex flex-1 items-start justify-center gap-0"> |
| 28 | <div className="flex flex-1 flex-col pl-6 pr-10 pt-8"> |
| 29 | <PlusInfo |
| 30 | productOptions={productOptions} |
| 31 | selectedOption={selectedOption} |
| 32 | onChange={({ priceId }) => { |
| 33 | setSelectedOption(priceId); |
| 34 | }} |
| 35 | shouldShowPlusHeader |
| 36 | showPlusList={false} |
| 37 | showGiftButton={false} |
| 38 | showDailyDevLogo |
| 39 | title={flags?.title} |
| 40 | description={flags?.description} |
| 41 | showTrustReviews={false} |
| 42 | /> |
| 43 | {!showCheckout && ( |
| 44 | <Button |
| 45 | onClick={() => setShowCheckout(true)} |
| 46 | variant={ButtonVariant.Primary} |
| 47 | className="mt-8" |
| 48 | > |
| 49 | {flags?.ctaText} |
| 50 | </Button> |
| 51 | )} |
| 52 | </div> |
| 53 | {showCheckout ? ( |
| 54 | <div |
| 55 | className="h-full flex-1 pr-6" |
| 56 | ref={(element) => { |
| 57 | if (!element) { |
| 58 | return; |
| 59 | } |
| 60 | openCheckout({ priceId: selectedOption }); |
| 61 | }} |
| 62 | > |
| 63 | <PlusCheckoutContainer |
| 64 | checkoutRef={checkoutRef} |
| 65 | className={{ |
| 66 | container: |
| 67 | 'border-top-0 h-full min-h-40 flex-1 rounded-16 border border-b-0 border-r-0 border-t-0 border-border-subtlest-tertiary bg-raw-pepper-90 pb-5 pl-10 pt-8', |
| 68 | }} |
nothing calls this directly
no test coverage detected