Skip to content

A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.

TypeScript fluxerfluxerapp

feat(app): add Operator Pass checkout form, pricing and success

Hampus59a2709a8edf
diff --git a/fluxer_app/src/features/premium/components/modals/OperatorPassCheckoutForm.tsx b/fluxer_app/src/features/premium/components/modals/OperatorPassCheckoutForm.tsx
new file mode 100644
index 000000000..a7972d571
--- /dev/null
+++ b/fluxer_app/src/features/premium/components/modals/OperatorPassCheckoutForm.tsx
@@ -0,0 +1,172 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+import styles from '@app/features/premium/components/modals/OperatorPassCheckoutModal.module.css';
+import {OperatorPassWallNameField} from '@app/features/premium/components/operator_pass/OperatorPassWallNameField';
+import {
+ getOperatorPassWallNameProblem,
+ type OperatorPassWallNameProblem,
+} from '@app/features/premium/utils/OperatorPassUtils';
+import {Checkbox} from '@app/features/ui/checkbox/Checkbox';
+import {clsx} from 'clsx';
+import {makeAutoObservable} from 'mobx';
+import type {ReactNode} from 'react';
+
+export const WALL_NAME_FIELD_ID = 'operator-pass-checkout-wall-name';
+export const WAIVER_BOX_ID = 'operator-pass-checkout-waiver';
+export const AGE_BOX_ID = 'operator-pass-checkout-age';
+
+export class OperatorPassCheckoutDraft {
+ wallName: string;
+ wallOptOut = false;
+ wallNameProblem: OperatorPassWallNameProblem | null = null;
+ waiver = false;
+ ageConfirmed = false;
+ waiverMissing = false;
+ ageMissing = false;
+ revealWallField = false;
+
+ constructor(wallName: string) {
+ this.wallName = wallName;
+ makeAutoObservable(this, {}, {autoBind: true});
+ }
+
+ setWallName(value: string): void {
+ this.wallName = value;
+ }
+ setWallOptOut(value: boolean): void {
+ this.wallOptOut = value;
+ }
+ setWallNameProblem(value: OperatorPassWallNameProblem | null): void {
+ this.wallNameProblem = value;
+ }
+ setWaiver(value: boolean): void {
+ this.waiver = value;
+ }
+ setAgeConfirmed(value: boolean): void {
+ this.ageConfirmed = value;
+ }
+ setWaiverMissing(value: boolean): void {
+ this.waiverMissing = value;
+ }
+ setAgeMissing(value: boolean): void {
+ this.ageMissing = value;
+ }
+ setRevealWallField(value: boolean): void {
+ this.revealWallField = value;
+ }
+
+ resetConsents(): void {
+ this.waiver = false;
+ this.ageConfirmed = false;
+ this.waiverMissing = false;
+ this.ageMissing = false;
+ }
+}
+
+interface OperatorPassCheckoutFormProps {
+ draft: OperatorPassCheckoutDraft;
+ values: Pick<
+ OperatorPassCheckoutDraft,
+ 'wallName' | 'wallOptOut' | 'wallNameProblem' | 'waiver' | 'ageConfirmed' | 'waiverMissing' | 'ageMissing'
+ >;
+ asksWallChoice: boolean;
+ quantity: number;
+ submitting: boolean;
+ listingUnchanged: ReactNode;
+ waiverLabel: ReactNode;
+ waiverError: ReactNode;
+ ageLabel: ReactNode;
+ ageError: ReactNode;
+}
+
+export function OperatorPassCheckoutForm({
+ draft,
+ values,
+ asksWallChoice,
+ quantity,
+ submitting,
+ listingUnchanged,
+ waiverLabel,
+ waiverError,
+ ageLabel,
+ ageError,
+}: OperatorPassCheckoutFormProps) {
+ const {wallName, wallOptOut, wallNameProblem, waiver, ageConfirmed, waiverMissing, ageMissing} = values;
+ const {setWallName, setWallOptOut, setWallNameProblem, setWaiver, setAgeConfirmed, setWaiverMissing, setAgeMissing} =
+ draft;
+ return (
+ <>
+ {!asksWallChoice ? (
+ listingUnchanged
+ ) : (
+ <OperatorPassWallNameField
+ id={WALL_NAME_FIELD_ID}
+ name={wallName}
+ optOut={wallOptOut}
+ problem={wallNameProblem}
+ disabled={submitting}
+ context="checkout"
+ onNameChange={(value) => {
+ setWallName(value);
+ if (wallNameProblem) {
+ setWallNameProblem(getOperatorPassWallNameProblem(value, wallOptOut));
+ }
+ }}
+ onOptOutChange={(value) => {
+ setWallOptOut(value);
+ if (value) {
+ setWallNameProblem(null);
+ }
+ }}
+ data-flx="premium.operator-pass-checkout-modal.render-purchase.operator-pass-wall-name-field"
+ />
+ )}
+ <div
+ id={WAIVER_BOX_ID}
+ className={clsx(styles.consentBox, waiverMissing && styles.consentBoxError)}
+ data-flx="premium.operator-pass-checkout-modal.waiver"
+ >
+ <Checkbox
+ className={styles.consentCheckbox}
+ checked={waiver}
+ onChange={(value) => {
+ setWaiver(value);
+ if (value) {
+ setWaiverMissing(false);
+ }
+ }}
+ disabled={submitting}
+ aria-describedby={waiverMissing ? 'operator-pass-checkout-waiver-error' : undefined}
+ data-flx="premium.operator-pass-checkout-modal.checkbox.waiver"
+ >
+ {waiverLabel}
+ </Checkbox>
+ {waiverError}
+ </div>
+ {quantity > 1 && (
+ <div
+ id={AGE_BOX_ID}
+ className={clsx(styles.consentBox, ageMissing && styles.consentBoxError)}
+ data-flx="premium.operator-pass-checkout-modal.age"
+ >
+ <Checkbox
+ className={styles.consentCheckbox}
+ checked={ageConfirmed}
+ onChange={(value) => {
+ setAgeConfirmed(value);
+ if (value) {
+ setAgeMissing(false);
+ }
+ }}
+ disabled={submitting}
+ aria-describedby={ageMissing ? 'operator-pass-checkout-age-error' : undefined}
+ data-flx="premium.operator-pass-checkout-modal.checkbox.age"
+ >
+ {ageLabel}
+ </Checkbox>
+ {ageError}
+ </div>
+ )}
+ </>
+ );
+}
diff --git a/fluxer_app/src/features/premium/components/modals/OperatorPassCheckoutModal.module.css b/fluxer_app/src/features/premium/components/modals/OperatorPassCheckoutModal.module.css
new file mode 100644
index 000000000..984d46071
--- /dev/null
+++ b/fluxer_app/src/features/premium/components/modals/OperatorPassCheckoutModal.module.css
@@ -0,0 +1,205 @@
+/* SPDX-License-Identifier: AGPL-3.0-or-later */
+
+.quantity {
+ display: flex;
+ flex-direction: column;
+ gap: 0.375rem;
+}
+
+.quantityRow {
+ display: flex;
+ flex-wrap: wrap;
+ align-items: center;
+ justify-content: space-between;
+ gap: 0.75rem;
+}
+
+.stepper {
+ display: flex;
+ align-items: center;
+ gap: 0.5rem;
+}
+
+.quantityValue {
+ min-width: 2rem;
+ color: var(--text-primary);
+ font-size: 1rem;
+ font-weight: 700;
+ line-height: 1.5rem;
+ text-align: center;
+ font-variant-numeric: tabular-nums;
+}
+
+.loading {
+ display: flex;
+ justify-content: center;
+ padding: 2rem 0;
+}
+
+.priceBlock {
+ --operator-pass-accent: var(--brand-primary-light);
+ display: flex;
+ flex-direction: column;
+ gap: 0.25rem;
+ padding: 1rem;
+ border-radius: 0.75rem;
+ background-color: color-mix(in srgb, var(--brand-primary) 10%, var(--background-secondary));
+ border: 1px solid color-mix(in srgb, var(--brand-primary) 30%, transparent);
+}
+
+:global(.theme-light) .priceBlock {
+ --operator-pass-accent: var(--brand-primary-foreground);
+}
+
+.priceLabel {
+ color: var(--operator-pass-accent);
+ font-size: 0.75rem;
+ font-weight: 700;
+ line-height: 1rem;
+}
+
+.price {
+ color: var(--text-primary);
+ font-size: 2rem;
+ font-weight: 700;
+ line-height: 2.5rem;
+}
+
+.priceNote {
+ margin: 0;
+ color: var(--text-primary-muted);
+ font-size: 0.875rem;
+ line-height: 1.25rem;
+}
+
+.sectionTitle {
+ margin: 0;
+ color: var(--text-primary);
+ font-size: 1rem;
+ font-weight: 600;
+ line-height: 1.25rem;
+}
+
+.donation {
+ display: flex;
+ flex-direction: column;
+ gap: 0.5rem;
+}
+
+.total {
+ margin: 0;
+ color: var(--text-primary);
+ font-size: 0.875rem;
+ font-weight: 600;
+ line-height: 1.25rem;
+}
+
+.holder {
+ display: flex;
+ align-items: center;
+ gap: 0.75rem;
+ padding: 1rem;
+ border-radius: 0.75rem;
+ background-color: color-mix(in srgb, var(--brand-primary) 10%, var(--background-secondary));
+}
+
+.holderIcon {
+ flex-shrink: 0;
+ width: 2.5rem;
+ height: 2.5rem;
+ color: var(--brand-primary-light);
+}
+
+.holderText {
+ display: flex;
+ flex-direction: column;
+ gap: 0.125rem;
+ min-width: 0;
+}
+
+.holderTitle {
+ margin: 0;
+ color: var(--text-primary);
+ font-size: 1.125rem;
+ font-weight: 700;
+ line-height: 1.5rem;
+}
+
+.consentBox {
+ padding: 0.75rem;
+ border-radius: 0.5rem;
+ background-color: var(--background-secondary);
+ border: 1px solid var(--background-modifier-accent);
+}
+
+.consentCheckbox {
+ height: auto !important;
+ align-items: flex-start;
+}
+
+.consentCheckbox > :first-child {
+ flex-shrink: 0;
+}
+
+.consentLabel {
+ color: var(--text-secondary);
+ font-size: 0.875rem;
+ line-height: 1.25rem;
+}
+
+.consentLabel strong {
+ color: var(--text-primary);
+ font-weight: 600;
+}
+
+.consentBoxError {
+ border-color: var(--status-danger);
+}
+
+.consentError {
+ margin: 0.5rem 0 0;
+ color: var(--status-danger);
+ font-size: 0.875rem;
+ line-height: 1.25rem;
+}
+
+.summary {
+ display: flex;
+ flex-direction: column;
+ align-items: flex-start;
+ gap: 0.25rem;
+}
+
+.characteristics {
+ margin: 0;
+ color: var(--text-primary);
+ font-size: 1rem;
+ line-height: 1.5rem;
+}
+
+.includedLink {
+ font-size: 0.875rem;
+ line-height: 1.25rem;
+}
+
+.textButton {
+ align-self: flex-start;
+ padding: 0;
+ border: 0;
+ background: none;
+ color: var(--text-link);
+ font-family: inherit;
+ font-size: 0.875rem;
+ font-weight: 600;
+ line-height: 1.25rem;
+ cursor: pointer;
+}
+
+.textButton:hover {
+ text-decoration: underline;
+}
+
+.textButton:disabled {
+ cursor: not-allowed;
+ opacity: 0.5;
+}
diff --git a/fluxer_app/src/features/premium/components/modals/OperatorPassCheckoutPresentation.tsx b/fluxer_app/src/features/premium/components/modals/OperatorPassCheckoutPresentation.tsx
new file mode 100644
index 000000000..8ccfd7009
--- /dev/null
+++ b/fluxer_app/src/features/premium/components/modals/OperatorPassCheckoutPresentation.tsx
@@ -0,0 +1,140 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+import {OPERATOR_PASS_NAME} from '@app/features/app/config/I18nDisplayConstants';
+import styles from '@app/features/premium/components/modals/OperatorPassCheckoutModal.module.css';
+import {
+ formatOperatorPassDateTime,
+ formatOperatorPassEarlyBirdEnd,
+ formatOperatorPassLongDate,
+ formatOperatorPassSinceMonth,
+} from '@app/features/premium/utils/OperatorPassUtils';
+import type {OperatorPassStateResponse} from '@fluxer/schema/src/domains/operator_pass/OperatorPassSchemas';
+import type {I18n} from '@lingui/core';
+import {msg} from '@lingui/core/macro';
+import {TicketIcon} from '@phosphor-icons/react';
+
+interface CheckoutPriceOptions {
+ current: OperatorPassStateResponse;
+ count: number;
+ i18n: I18n;
+ formatPrice: (amountMinor: number, currency: string) => string;
+}
+
+interface OperatorCardOptions {
+ current: OperatorPassStateResponse;
+ i18n: I18n;
+}
+
+const EARLY_BIRD_PRICE_DESCRIPTOR = msg({
+ message: 'Early bird price',
+ comment: 'Label above the Operator Pass price while the early bird price is active.',
+});
+const PRICE_DESCRIPTOR = msg({
+ message: 'Price',
+ comment: 'Label above the Operator Pass price once the early bird price has ended.',
+});
+const PER_PASS_DESCRIPTOR = msg({
+ message: '{count} × {price}, including tax, paid once.',
+ comment:
+ 'Note under the Operator Pass total when buying more than one pass. {count} is the number of passes, 2 or more, and {price} the price of one pass with currency, including tax. The passes are paid once and never renew.',
+});
+const SINGLE_PASS_PRICE_DESCRIPTOR = msg({
+ message: 'Including tax, paid once.',
+ comment:
+ 'Note under the Operator Pass price when buying one pass. The price includes tax and is paid once, it never renews.',
+});
+const EARLY_BIRD_UNTIL_DESCRIPTOR = msg({
+ message: 'Early bird price until {date}.',
+ comment:
+ 'Note under the early bird Operator Pass price, saying the last day of the early bird price. {date} is a date such as January 1, 2027.',
+});
+const ON_SALE_FROM_DESCRIPTOR = msg({
+ message: 'On sale from {saleOpensAt}.',
+ comment:
+ 'Note in the Operator Pass dialog before the pass can be bought. {saleOpensAt} is a date without a time, such as November 1, 2026.',
+});
+const OPERATOR_TITLE_DESCRIPTOR = msg({
+ message: "You're an Operator",
+ comment:
+ 'Heading in the Operator Pass dialog when the account already has an Operator Pass. Operator is the badge and role name.',
+});
+const OPERATOR_SINCE_DESCRIPTOR = msg({
+ message: '{operatorPassName} since {sinceMonth}',
+ comment:
+ 'Line in the Operator Pass dialog for someone who already has an Operator Pass. {sinceMonth} is a month and year such as November 2026. Operator Pass is a product name and stays untranslated.',
+});
+const PASS_COUNT_DESCRIPTOR = msg({
+ message: '{count, plural, one {# Operator Pass} other {# Operator Passes}}',
+ comment:
+ 'How many Operator Passes the account has, in the Operator Pass dialog, after the line that says since when. Operator Pass is a product name and stays untranslated.',
+});
+
+export function renderOperatorPassPriceBlock({current, count, i18n, formatPrice}: CheckoutPriceOptions) {
+ const earlyBird = current.phase !== 'standard';
+ const priceRisesAt = current.price_rises_at;
+ return (
+ <div className={styles.priceBlock} data-flx="premium.operator-pass-checkout-modal.price-block">
+ <span className={styles.priceLabel} data-flx="premium.operator-pass-checkout-modal.price-label">
+ {earlyBird ? i18n._(EARLY_BIRD_PRICE_DESCRIPTOR) : i18n._(PRICE_DESCRIPTOR)}
+ </span>
+ <span className={styles.price} data-flx="premium.operator-pass-checkout-modal.price">
+ {formatPrice(current.price_minor * count, current.currency)}
+ </span>
+ <span className={styles.priceNote} data-flx="premium.operator-pass-checkout-modal.price-note">
+ {count > 1
+ ? i18n._(PER_PASS_DESCRIPTOR, {count, price: formatPrice(current.price_minor, current.currency)})
+ : i18n._(SINGLE_PASS_PRICE_DESCRIPTOR)}
+ </span>
+ {current.phase === 'waitlist' && current.sale_opens_at && (
+ <span
+ className={styles.priceNote}
+ title={formatOperatorPassDateTime(current.sale_opens_at)}
+ data-flx="premium.operator-pass-checkout-modal.on-sale-from"
+ >
+ {i18n._(ON_SALE_FROM_DESCRIPTOR, {saleOpensAt: formatOperatorPassLongDate(current.sale_opens_at)})}
+ </span>
+ )}
+ {earlyBird && priceRisesAt && (
+ <span
+ className={styles.priceNote}
+ title={formatOperatorPassDateTime(priceRisesAt)}
+ data-flx="premium.operator-pass-checkout-modal.early-bird-ends"
+ >
+ {i18n._(EARLY_BIRD_UNTIL_DESCRIPTOR, {date: formatOperatorPassEarlyBirdEnd(priceRisesAt)})}
+ </span>
+ )}
+ </div>
+ );
+}
+
+export function renderOperatorPassHolderCard({current, i18n}: OperatorCardOptions) {
+ if (!current.holder) return null;
+ const since = i18n._(OPERATOR_SINCE_DESCRIPTOR, {
+ operatorPassName: OPERATOR_PASS_NAME,
+ sinceMonth: formatOperatorPassSinceMonth(current.holder.since),
+ });
+ const count = current.holder.count > 1 ? i18n._(PASS_COUNT_DESCRIPTOR, {count: current.holder.count}) : null;
+ return (
+ <div className={styles.holder} data-flx="premium.operator-pass-checkout-modal.operator">
+ <TicketIcon
+ className={styles.holderIcon}
+ weight="fill"
+ aria-hidden="true"
+ data-flx="premium.operator-pass-checkout-modal.operator-icon"
+ />
+ <div className={styles.holderText} data-flx="premium.operator-pass-checkout-modal.operator-text">
+ <h3 className={styles.holderTitle} data-flx="premium.operator-pass-checkout-modal.operator-title">
+ {i18n._(OPERATOR_TITLE_DESCRIPTOR)}
+ </h3>
+ <span className={styles.priceNote} data-flx="premium.operator-pass-checkout-modal.operator-since">
+ {since}
+ </span>
+ {count && (
+ <span className={styles.priceNote} data-flx="premium.operator-pass-checkout-modal.operator-count">
+ {count}
+ </span>
+ )}
+ </div>
+ </div>
+ );
+}
diff --git a/fluxer_app/src/features/premium/components/operator_pass/OperatorPassCheckoutSuccess.tsx b/fluxer_app/src/features/premium/components/operator_pass/OperatorPassCheckoutSuccess.tsx
new file mode 100644
index 000000000..ca1a04f13
--- /dev/null
+++ b/fluxer_app/src/features/premium/components/operator_pass/OperatorPassCheckoutSuccess.tsx
@@ -0,0 +1,186 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+import {PRODUCT_LABS_COMMUNITY_NAME, PRODUCT_NAME} from '@app/features/app/config/I18nDisplayConstants';
+import * as InviteCommands from '@app/features/invite/commands/InviteCommands';
+import {currentInstanceTarget} from '@app/features/platform/transport/InstanceHTTP';
+import {Logger} from '@app/features/platform/utils/AppLogger';
+import * as OperatorPassCommands from '@app/features/premium/commands/OperatorPassCommands';
+import {DONT_LIST_ME_DESCRIPTOR} from '@app/features/premium/components/operator_pass/OperatorPassWallNameField';
+import styles from '@app/features/premium/components/pages/PremiumCallbackPage.module.css';
+import {
+ normalizeOperatorPassWallName,
+ OPERATOR_PASS_LABS_INVITE_CODE,
+} from '@app/features/premium/utils/OperatorPassUtils';
+import {OPERATOR_PASS_OPEN_LABS_DESCRIPTOR} from '@app/features/premium/utils/PremiumMessageDescriptors';
+import {Button} from '@app/features/ui/button/Button';
+import {Checkbox} from '@app/features/ui/checkbox/Checkbox';
+import * as ToastCommands from '@app/features/ui/commands/ToastCommands';
+import {Spinner} from '@app/features/ui/components/Spinner';
+import {WALL_SAVE_FAILED_DESCRIPTOR} from '@app/features/user/components/modals/tabs/my_profile_tab/OperatorPassWallSettings';
+import Users from '@app/features/user/state/Users';
+import type {OperatorPassListingResponse} from '@fluxer/schema/src/domains/operator_pass/OperatorPassSchemas';
+import {Trans, useLingui} from '@lingui/react/macro';
+import {observer} from 'mobx-react-lite';
+import {useEffect, useState} from 'react';
+
+const POLL_INTERVAL_MS = 2000;
+const MAX_ATTEMPTS = 15;
+
+type Outcome = {kind: 'loading'} | {kind: 'started'; listing: OperatorPassListingResponse | null} | {kind: 'unknown'};
+
+const logger = new Logger('OperatorPassCheckoutSuccess');
+
+function useCheckoutOutcome(sessionId: string | null): Outcome {
+ const [outcome, setOutcome] = useState<Outcome>(sessionId ? {kind: 'loading'} : {kind: 'unknown'});
+ useEffect(() => {
+ if (!sessionId) return;
+ let active = true;
+ let timer: ReturnType<typeof setTimeout> | null = null;
+ const listingNow = async (): Promise<OperatorPassListingResponse | null> => {
+ try {
+ return await OperatorPassCommands.fetchListing();
+ } catch (error) {
+ logger.warn("Failed to load the Operators' wall listing", error);
+ return null;
+ }
+ };
+ const check = async (attempt: number) => {
+ try {
+ const purchase = (await OperatorPassCommands.fetchPurchases()).find((entry) => entry.id === sessionId);
+ if (!active) return;
+ if (purchase?.status === 'completed') {
+ const listing = await listingNow();
+ if (active) setOutcome({kind: 'started', listing});
+ return;
+ }
+ if (purchase && purchase.status !== 'pending') {
+ setOutcome({kind: 'unknown'});
+ return;
+ }
+ } catch (error) {
+ logger.warn('Failed to load the Operator Pass purchase', error);
+ if (!active) return;
+ }
+ if (attempt + 1 >= MAX_ATTEMPTS) {
+ setOutcome({kind: 'unknown'});
+ return;
+ }
+ timer = setTimeout(() => void check(attempt + 1), POLL_INTERVAL_MS);
+ };
+ void check(0);
+ return () => {
+ active = false;
+ if (timer) clearTimeout(timer);
+ };
+ }, [sessionId]);
+ return outcome;
+}
+
+export const OperatorPassCheckoutSuccess = observer(function OperatorPassCheckoutSuccess({
+ sessionId,
+}: {
+ sessionId: string | null;
+}) {
+ const {i18n} = useLingui();
+ const outcome = useCheckoutOutcome(sessionId);
+ const [changed, setChanged] = useState<OperatorPassListingResponse | null>(null);
+ const [saving, setSaving] = useState(false);
+ const initial = outcome.kind === 'started' ? outcome.listing : null;
+ const listing = changed ?? initial;
+ const listed = listing ? listing.status === 'listed' : null;
+ const offersOptOut = initial != null && (initial.status === 'listed' || initial.wall_opt_out);
+ const wallName =
+ (initial?.status === 'listed' ? initial.wall_name : null) ??
+ normalizeOperatorPassWallName(Users.currentUser?.displayName ?? '');
+ const handleOptOutChange = async (optOut: boolean) => {
+ setSaving(true);
+ try {
+ setChanged(
+ await OperatorPassCommands.updateListing(
+ optOut ? {wall_name: null, wall_opt_out: true} : {wall_name: wallName, wall_opt_out: false},
+ ),
+ );
+ } catch (error) {
+ logger.warn("Failed to update the Operators' wall listing after checkout", error);
+ ToastCommands.error(i18n._(WALL_SAVE_FAILED_DESCRIPTOR));
+ } finally {
+ setSaving(false);
+ }
+ };
+ const renderDescription = () => {
+ switch (outcome.kind) {
+ case 'loading':
+ return <Spinner data-flx="premium.operator-pass-checkout-success.spinner" />;
+ case 'started':
+ if (listed === true) {
+ return (
+ <p className={styles.description} data-flx="premium.operator-pass-checkout-success.started-listed">
+ <Trans comment="Line after an Operator Pass purchase by someone listed on the Operators' wall, the list of Operators on the homepage. The badge is the Operator badge on their profile. Once we check it means after the team reviews the name.">
+ Your badge is live. Your name shows on the Operators' wall once we check it.
+ </Trans>
+ </p>
+ );
+ }
+ if (listed === false) {
+ return (
+ <p className={styles.description} data-flx="premium.operator-pass-checkout-success.started-unlisted">
+ <Trans comment="Line after an Operator Pass purchase by someone who chose not to be listed on the Operators' wall. The badge is the Operator badge on their profile.">
+ Your badge is live.
+ </Trans>
+ </p>
+ );
+ }
+ return (
+ <p className={styles.description} data-flx="premium.operator-pass-checkout-success.started">
+ <Trans comment="Line after an Operator Pass purchase when the app could not tell whether the buyer is listed on the Operators' wall. The badge is the Operator badge on their profile. The wall listing is their entry on the Operators' wall, which they can check in their settings.">
+ Your badge is live. Check your wall listing in settings.
+ </Trans>
+ </p>
+ );
+ case 'unknown':
+ return (
+ <p className={styles.description} data-flx="premium.operator-pass-checkout-success.unknown">
+ <Trans comment="Line after an Operator Pass purchase when the app could not load the purchase yet. The confirmation email says when the pass is delivered.">
+ Payment received. Your pass arrives in a moment. Details are in your email.
+ </Trans>
+ </p>
+ );
+ }
+ };
+ return (
+ <div className={styles.content} data-flx="premium.operator-pass-checkout-success.content">
+ <h1 className={styles.title} data-flx="premium.operator-pass-checkout-success.title">
+ <Trans comment="Heading after a successful Operator Pass purchase. Backing means supporting the project.">
+ Thanks for backing {PRODUCT_NAME}
+ </Trans>
+ </h1>
+ {renderDescription()}
+ {offersOptOut && wallName && (
+ <Checkbox
+ checked={listed === false}
+ onChange={(optOut) => void handleOptOutChange(optOut)}
+ disabled={saving}
+ data-flx="premium.operator-pass-checkout-success.checkbox.opt-out"
+ >
+ {i18n._(DONT_LIST_ME_DESCRIPTOR)}
+ </Checkbox>
+ )}
+ {outcome.kind !== 'loading' && (
+ <Button
+ variant="secondary"
+ onClick={() => void InviteCommands.openAcceptModal(OPERATOR_PASS_LABS_INVITE_CODE, currentInstanceTarget())}
+ data-flx="premium.operator-pass-checkout-success.button.labs"
+ >
+ {i18n._(OPERATOR_PASS_OPEN_LABS_DESCRIPTOR, {labsName: PRODUCT_LABS_COMMUNITY_NAME})}
+ </Button>
+ )}
+ {outcome.kind !== 'loading' && (
+ <p className={styles.description} data-flx="premium.operator-pass-checkout-success.close-tab">
+ <Trans comment="Muted line at the bottom of the page after an Operator Pass purchase, which opens in its own browser tab.">
+ You can close this tab.
+ </Trans>
+ </p>
+ )}
+ </div>
+ );
+});