diff --git a/.env.tpl b/.env.tpl index 52463255c1..98c39973a8 100644 --- a/.env.tpl +++ b/.env.tpl @@ -73,6 +73,10 @@ NEXT_PUBLIC_ENV=dev # NEXT_PUBLIC_COUNTLY_KEY= # NEXT_PUBLIC_COUNTLY_URL= +# set to schedule when announcement banners should show about the w3up launch and related product sunsets +# NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_ANNOUNCEMENT_START='2023-11-21T00:00:00Z' +# set to schedule when certain features hide bcause the product has been sunset and w3up is launched +# NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_START='2024-01-10T00:00:00Z' ## ---- cron ------------------------------------------------------------------ diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index ef3900a8dc..19a1e47dcf 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -200,6 +200,7 @@ jobs: NEXT_PUBLIC_COUNTLY_KEY: ${{ secrets.COUNTLY_KEY }} NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY: ${{ secrets.TESTING_STRIPE_PUBLISHABLE_KEY }} NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_ANNOUNCEMENT_START: ${{ vars.NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_ANNOUNCEMENT_START }} + NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_START: ${{ vars.NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_START }} DID_DOCUMENT_ID: ${{ secrets.STAGING_DID_DOCUMENT_ID }} DID_DOCUMENT_PRIMARY_DID_KEY: ${{ secrets.STAGING_DID_DOCUMENT_PRIMARY_DID_KEY }} - name: Add to web3.storage @@ -296,6 +297,7 @@ jobs: NEXT_PUBLIC_COUNTLY_KEY: ${{ secrets.COUNTLY_KEY }} NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY: ${{ secrets.STRIPE_PUBLISHABLE_KEY }} NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_ANNOUNCEMENT_START: ${{ vars.NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_ANNOUNCEMENT_START }} + NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_START: ${{ vars.NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_START }} DID_DOCUMENT_ID: ${{ secrets.PRODUCTION_DID_DOCUMENT_ID }} DID_DOCUMENT_PRIMARY_DID_KEY: ${{ secrets.PRODUCTION_DID_DOCUMENT_PRIMARY_DID_KEY }} - name: Add to web3.storage diff --git a/packages/website/components/account/paymentTable.js/paymentTable.js b/packages/website/components/account/paymentTable.js/paymentTable.js index e5994f8fe6..7b5489c487 100644 --- a/packages/website/components/account/paymentTable.js/paymentTable.js +++ b/packages/website/components/account/paymentTable.js/paymentTable.js @@ -7,17 +7,37 @@ import { formatAsStorageAmount, formatCurrency } from '../../../lib/utils.js'; const getAdditionalStoragePrice = price => (typeof price === 'number' ? `${formatCurrency(price / 100)} / GiB` : 'N/A'); -const PaymentTable = ({ plans: plansProp, currentPlan, setPlanSelection, setIsPaymentPlanModalOpen }) => { +/** + * @typedef {import('../../../components/contexts/plansContext.js').Plan} Plan + * @typedef {import('../../../components/contexts/plansContext.js').StorageSubscription} StorageSubscription + * @typedef {import('../../../components/contexts/plansContext.js').StoragePrice} StoragePrice + */ + +/** + * @param {object} props + * @param {Plan} [props.currentPlan] + * @param {boolean} [props.disablePlanSwitching] - whether to disable plan switching e.g. hide 'select plan' buttons + * @param {Plan[]} props.plans + * @param {(isOpen: boolean) => void} props.setIsPaymentPlanModalOpen + * @param {(plan?: Plan) => void} props.setPlanSelection + */ +const PaymentTable = ({ + plans: plansProp, + currentPlan, + setPlanSelection, + setIsPaymentPlanModalOpen, + disablePlanSwitching, +}) => { const plans = useMemo(() => { - const isCurrentPlanStandard = ['free', 'lite', 'pro'].includes(currentPlan?.id); + const isCurrentPlanStandard = currentPlan ? ['free', 'lite', 'pro'].includes(currentPlan?.id) : false; if (!isCurrentPlanStandard) { - return [currentPlan, ...plansProp.slice(1)]; + return [...(currentPlan ? [currentPlan] : []), ...plansProp.slice(1)]; } return plansProp; }, [plansProp, currentPlan]); - + const shouldShowSelectPlanButtons = !disablePlanSwitching; return ( <> {currentPlan && ( @@ -42,7 +62,10 @@ const PaymentTable = ({ plans: plansProp, currentPlan, setPlanSelection, setIsPa
Base Storage Capacity
Additional Storage{' '}
-
{currentPlan.description}
{formatAsStorageAmount(plan.tiers?.[0]?.upTo)}
+{formatAsStorageAmount(plan.tiers?.[0]?.upTo ?? 0)}
{getAdditionalStoragePrice(plan.tiers?.[1]?.unitAmount)}
-{plan.bandwidth ? `${formatAsStorageAmount(plan.bandwidth)} / month` : 'N/A'}
++ {plan.bandwidth ? `${formatAsStorageAmount(parseInt(plan.bandwidth, 10) ?? 0)} / month` : 'N/A'} +