({
productOptions,
selectedOption,
onChange,
onContinue,
shouldShowPlusHeader = true,
showPlusList = true,
showDailyDevLogo = false,
showGiftButton = true,
showTrustReviews = true,
title,
description,
subtitle,
continueEnabled = true,
isContinueLoading = false,
}: PlusInfoProps & CommonPlusPageProps)
| 130 | }; |
| 131 | |
| 132 | export const PlusInfo = ({ |
| 133 | productOptions, |
| 134 | selectedOption, |
| 135 | onChange, |
| 136 | onContinue, |
| 137 | shouldShowPlusHeader = true, |
| 138 | showPlusList = true, |
| 139 | showDailyDevLogo = false, |
| 140 | showGiftButton = true, |
| 141 | showTrustReviews = true, |
| 142 | title, |
| 143 | description, |
| 144 | subtitle, |
| 145 | continueEnabled = true, |
| 146 | isContinueLoading = false, |
| 147 | }: PlusInfoProps & CommonPlusPageProps): ReactElement => { |
| 148 | const router = useRouter(); |
| 149 | const { giftOneYear, isOrganization, checkoutItemsLoading } = |
| 150 | usePaymentContext(); |
| 151 | const { openModal } = useLazyModal(); |
| 152 | const { isPlus, logSubscriptionEvent } = usePlusSubscription(); |
| 153 | const { giftToUser } = useGiftUserContext(); |
| 154 | |
| 155 | const [itemQuantity, setItemQuantity] = useState<number>(1); |
| 156 | |
| 157 | const { value: isApiLanding } = useConditionalFeature({ |
| 158 | feature: featurePlusApiLanding, |
| 159 | shouldEvaluate: !isPlus, |
| 160 | }); |
| 161 | |
| 162 | const plusType = getPlusType({ |
| 163 | isGift: !!giftToUser, |
| 164 | isOrganization, |
| 165 | }); |
| 166 | const copySource = isApiLanding |
| 167 | ? plusInfoCopyApi |
| 168 | : defaultPlusInfoCopyControl; |
| 169 | const defaultCopy = copySource[plusType]; |
| 170 | const titleCopy = title || defaultCopy.title; |
| 171 | const descriptionCopy = description || defaultCopy.description; |
| 172 | const subtitleCopy = subtitle || defaultCopy.subtitle; |
| 173 | |
| 174 | const isOnboarding = router.pathname.startsWith('/onboarding'); |
| 175 | const showBuyAsAGiftButton = |
| 176 | !giftToUser && showGiftButton && !!giftOneYear && !isOnboarding; |
| 177 | let plusListContent: ReactElement; |
| 178 | if (isOrganization) { |
| 179 | plusListContent = <PlusList items={plusOrganizationFeatureList} />; |
| 180 | } else if (isApiLanding && plusType === PlusType.Self) { |
| 181 | plusListContent = <PlusList items={plusFeatureListApiFirst} />; |
| 182 | } else { |
| 183 | plusListContent = <PlusList />; |
| 184 | } |
| 185 | |
| 186 | return ( |
| 187 | <> |
| 188 | {shouldShowPlusHeader && ( |
| 189 | <div className="mb-6 flex items-center"> |
nothing calls this directly
no test coverage detected