+ {packages?.map((p) => {
+ const selected = selectedPackageId === p.identifier;
+ const price = p.rcBillingProduct.currentPrice.amountMicros / 1_000_000;
+ const periodDuration = p.rcBillingProduct?.normalPeriodDuration;
+ const pricePerMonth = periodDuration === 'P1Y' ? price / 12 : price;
+ const showSaveBadge = periodDuration === 'P1Y';
+
+ return (
+
setSelectedPackageId(p.identifier)}
+ onKeyDown={(e) => {
+ if (e.key === 'Enter' || e.key === ' ') {
+ setSelectedPackageId(p.identifier);
+ }
+ }}
+ role="button"
+ tabIndex={0}
+ aria-pressed={selected}
+ >
+ {showSaveBadge ?
Save 33%
: null}
+
+ {p.rcBillingProduct.title} ({periodDuration})
+
+
${price.toFixed(2)}
+
+ ${pricePerMonth.toFixed(2)}/month
+
+
+ );
+ })}
+
+ );
+}
+
+export default function PageWebEmbedPrimePurchase() {
+ const [packages, setPackages] = useState