{
  "version": 3,
  "sources": ["../../src/web/pages/projects/lib/useQuery.ts", "../../src/web/pages/projects/providers/DashboardModalProvider.tsx", "../../src/web/pages/projects/components/settings/team/components/ApplyPromotionCodeModal.tsx", "../../src/web/pages/projects/components/settings/team/components/FlexToYearlyModal.tsx", "../../src/web/pages/projects/components/settings/team/hooks/useFlexToYearly.ts", "../../src/web/pages/projects/components/settings/team/api/flexToYearly.ts", "../../src/web/pages/projects/components/settings/team/components/ManageSeatsModal.tsx", "../../src/web/pages/projects/components/settings/team/hooks/useManageSeats.ts", "../../src/web/pages/projects/components/settings/team/api/teamBillingPreview.ts", "../../src/web/pages/projects/components/settings/team/api/billing.ts", "../../src/web/pages/projects/components/settings/team/components/ManageSeatsModal.styles.ts", "../../src/web/pages/projects/components/settings/team/components/MigrateBillingModal.tsx", "../../src/web/pages/projects/components/settings/team/components/MigrateBillingModal.styles.ts", "../../src/web/pages/projects/components/settings/team/components/SelectProjectToUpgradeModal.tsx", "../../src/web/pages/projects/components/settings/team/api/getProjectsForTeam.ts", "../../src/web/pages/projects/components/settings/team/components/SelectProjectToUpgradeModal.styles.ts", "../../src/web/pages/projects/components/settings/team/components/SwitchToYearlyModal.tsx", "../../src/web/pages/projects/components/settings/team/hooks/useSwitchToYearly.ts", "../../src/web/pages/projects/providers/DashboardModalRenderer.tsx", "../../src/web/pages/projects/components/Domains/domainTab.ts", "../../src/web/pages/projects/DashboardStore.ts"],
  "sourcesContent": ["import { useMemo } from \"react\"\nimport { useLocation } from \"react-router-dom\"\n\n/**\n * A custom hook that builds on useLocation to parse\n * the query string for you.\n * based on https://v5.reactrouter.com/web/example/query-parameters\n */\nexport function useQuery() {\n\tconst { search } = useLocation()\n\n\treturn useMemo(() => new URLSearchParams(search), [search])\n}\n", "import type { Modal } from \"document/stores/ModalStore.ts\"\nimport type { ModalType } from \"document/utils/ModalType.ts\"\nimport type React from \"react\"\nimport { createContext, startTransition, useCallback, useContext, useMemo, useState } from \"react\"\nimport { DashboardModalRenderer } from \"./DashboardModalRenderer.tsx\"\n\nexport type DashboardModal = Extract<\n\tModal,\n\t| { type: ModalType.Confirmation }\n\t| { type: ModalType.ApplyPromotionCode }\n\t| { type: ModalType.FlexToYearly }\n\t| { type: ModalType.SelectProjectToUpgrade }\n\t| { type: ModalType.SwitchToYearly }\n\t| { type: ModalType.ManageSeats }\n\t| { type: ModalType.MigrateBilling }\n>\n\nexport interface DashboardModalContextValue {\n\tactive: DashboardModal | null\n\tshow(modal: DashboardModal): void\n\tdismiss(): void\n\tupdate(updates: Partial<DashboardModal>): void\n}\n\n/** @note This is only exported for testing purposes, please use `useDashboardModal` instead. */\nexport const DashboardModalContext = createContext<DashboardModalContextValue | null>(null)\nDashboardModalContext.displayName = \"DashboardModalContext\"\n\nexport function DashboardModalProvider({ children }: { children: React.ReactNode }) {\n\tconst [active, setActive] = useState<DashboardModal | null>(null)\n\tconst show = useCallback((m: DashboardModal) => {\n\t\tstartTransition(() => {\n\t\t\tsetActive(m)\n\t\t})\n\t}, [])\n\tconst dismiss = useCallback(() => {\n\t\tstartTransition(() => {\n\t\t\tsetActive(null)\n\t\t})\n\t}, [])\n\tconst update = useCallback((updates: Partial<DashboardModal>) => {\n\t\tstartTransition(() => {\n\t\t\tsetActive(prev => {\n\t\t\t\tif (!prev) return null\n\n\t\t\t\t// Only spread updates that do not include 'type'\n\t\t\t\tconst { type, ...rest } = updates\n\t\t\t\t// TypeScript: preserve the original type, and only update allowed fields\n\t\t\t\treturn { ...prev, ...rest } as typeof prev\n\t\t\t})\n\t\t})\n\t}, [])\n\n\tconst value = useMemo(() => ({ active, show, dismiss, update }), [active, show, dismiss, update])\n\treturn (\n\t\t<DashboardModalContext.Provider value={value}>\n\t\t\t{children}\n\t\t\t<DashboardModalRenderer />\n\t\t</DashboardModalContext.Provider>\n\t)\n}\n\nexport function useDashboardModal(): DashboardModalContextValue\nexport function useDashboardModal<T>(selector: (ctx: DashboardModalContextValue | null) => T): T\nexport function useDashboardModal<T>(\n\tselector?: (ctx: DashboardModalContextValue | null) => T,\n): DashboardModalContextValue | T {\n\tconst ctx = useContext(DashboardModalContext)\n\tif (!ctx) throw new Error(\"useDashboardModal must be used within DashboardModalProvider\")\n\n\tif (selector) {\n\t\treturn selector(ctx)\n\t} else {\n\t\treturn ctx\n\t}\n}\n", "import { ConfirmationModal, InputWrapper, Modal, Stack, TextInput } from \"@framerjs/fresco\"\nimport { assertNever } from \"@framerjs/shared\"\nimport {\n\tPutProjectSubscriptionStatus,\n\tputProjectSubscription,\n} from \"document/components/chrome/siteSettings/Plans/Stripe/api/projectSubscription.ts\"\nimport { showPaymentErrorToast } from \"document/components/chrome/siteSettings/Plans/Stripe/showPaymentErrorToast.ts\"\nimport { useCallback, useEffect, useRef, useState } from \"react\"\nimport { useRecordEffect } from \"utils/useRecordEffect.ts\"\nimport { Separator } from \"web/components/Separator.tsx\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\n\ninterface ApplyPromotionCodeModalProps {\n\tprojectId: string\n\tteamId: string\n\tonClose: () => void\n\tonSuccess: () => void\n}\n\nconst page = Pages.applyPromotionCodeModal\n\nexport function ApplyPromotionCodeModal({ projectId, teamId, onClose, onSuccess }: ApplyPromotionCodeModalProps) {\n\tconst [promotionCode, setPromotionCode] = useState(\"\")\n\tconst [isSubmitting, setIsSubmitting] = useState(false)\n\tconst handleConfirmRef = useRef<() => void>(() => {})\n\n\tuseRecordEffect(\"ui_impression\", { page })\n\n\tconst handleCancel = useCallback(() => {\n\t\trecord(\"ui_interaction\", { page, id: UIInteraction.applyPromotionCodeCancel })\n\t\tonClose()\n\t}, [onClose])\n\n\tconst handleConfirm = useCallback(async () => {\n\t\tconst trimmedPromotionCode = promotionCode.trim()\n\t\tif (!trimmedPromotionCode || isSubmitting) return\n\n\t\trecord(\"ui_interaction\", { page, id: UIInteraction.applyPromotionCodeConfirm })\n\t\tsetIsSubmitting(true)\n\n\t\tconst result = await putProjectSubscription({\n\t\t\tprojectId,\n\t\t\tisBillingV3: true,\n\t\t\tpromotionCode: trimmedPromotionCode,\n\t\t})\n\n\t\tswitch (result.status) {\n\t\t\tcase PutProjectSubscriptionStatus.Success:\n\t\t\t\trecord(\"ui_interaction\", { page, id: UIInteraction.applyPromotionCodeSuccess })\n\t\t\t\ttoast({\n\t\t\t\t\ttype: \"add\",\n\t\t\t\t\tvariant: \"success\",\n\t\t\t\t\tprimaryText: \"Promotion code\",\n\t\t\t\t\tsecondaryText: \"applied.\",\n\t\t\t\t\taction: { title: \"Dismiss\", onClick: () => {} },\n\t\t\t\t\tduration: 5000,\n\t\t\t\t})\n\t\t\t\tonSuccess()\n\t\t\t\treturn\n\t\t\tcase PutProjectSubscriptionStatus.PaymentError:\n\t\t\t\tshowPaymentErrorToast(result.error, {\n\t\t\t\t\tteamId,\n\t\t\t\t\tgetPage: () => Pages.applyPromotionCodeModal,\n\t\t\t\t\tretry: () => handleConfirmRef.current(),\n\t\t\t\t})\n\t\t\t\tsetIsSubmitting(false)\n\t\t\t\treturn\n\t\t\tcase PutProjectSubscriptionStatus.OverEditorLimitError:\n\t\t\tcase PutProjectSubscriptionStatus.OverProjectEditorLimitError:\n\t\t\t\trecord(\"ui_interaction\", { page, id: UIInteraction.applyPromotionCodeError })\n\t\t\t\ttoast({\n\t\t\t\t\ttype: \"add\",\n\t\t\t\t\tvariant: \"error\",\n\t\t\t\t\tprimaryText: \"Something went wrong.\",\n\t\t\t\t\tsecondaryText: \"Please try again.\",\n\t\t\t\t\tduration: 5000,\n\t\t\t\t})\n\t\t\t\tsetIsSubmitting(false)\n\t\t\t\treturn\n\t\t\tcase PutProjectSubscriptionStatus.InvalidPromotionCode:\n\t\t\t\trecord(\"ui_interaction\", { page, id: UIInteraction.applyPromotionCodeError })\n\t\t\t\ttoast({\n\t\t\t\t\ttype: \"add\",\n\t\t\t\t\tvariant: \"error\",\n\t\t\t\t\tprimaryText: \"Promotion code\",\n\t\t\t\t\tsecondaryText: \"invalid.\",\n\t\t\t\t\tduration: 5000,\n\t\t\t\t})\n\t\t\t\tsetIsSubmitting(false)\n\t\t\t\treturn\n\t\t\tdefault:\n\t\t\t\tassertNever(result)\n\t\t}\n\t}, [promotionCode, isSubmitting, onSuccess, projectId, teamId])\n\n\tuseEffect(() => {\n\t\thandleConfirmRef.current = () => {\n\t\t\tvoid handleConfirm()\n\t\t}\n\t}, [handleConfirm])\n\n\tconst trimmedPromotionCode = promotionCode.trim()\n\n\treturn (\n\t\t<ConfirmationModal\n\t\t\ttitle=\"Promotion Code\"\n\t\t\tconfirmLabel=\"Apply\"\n\t\t\tcancelLabel=\"Cancel\"\n\t\t\tonConfirm={handleConfirm}\n\t\t\tonCancel={handleCancel}\n\t\t\tonDismiss={isSubmitting ? undefined : handleCancel}\n\t\t\tconfirmButtonEnabled={Boolean(trimmedPromotionCode) && !isSubmitting}\n\t\t\tconfirmButtonLoading={isSubmitting}\n\t\t\tcancelButtonEnabled={!isSubmitting}\n\t\t\thasBackdrop\n\t\t>\n\t\t\t<Stack gap={10}>\n\t\t\t\t<Separator height={1} />\n\t\t\t\t<Modal.Text>\n\t\t\t\t\tAdd a valid promotion code to apply a discount to your subscription. Any existing discounts will be removed.\n\t\t\t\t</Modal.Text>\n\t\t\t\t<InputWrapper large>\n\t\t\t\t\t<TextInput\n\t\t\t\t\t\taria-label=\"Promotion Code\"\n\t\t\t\t\t\tname={`promotion-code-${projectId}`}\n\t\t\t\t\t\tplaceholder=\"Code\"\n\t\t\t\t\t\tvalue={promotionCode}\n\t\t\t\t\t\tconstantChange\n\t\t\t\t\t\tenabled={!isSubmitting}\n\t\t\t\t\t\tonChange={setPromotionCode}\n\t\t\t\t\t/>\n\t\t\t\t</InputWrapper>\n\t\t\t</Stack>\n\t\t</ConfirmationModal>\n\t)\n}\n", "import { ConfirmationModal, Stack } from \"@framerjs/fresco\"\nimport { showPaymentErrorToast } from \"document/components/chrome/siteSettings/Plans/Stripe/showPaymentErrorToast.ts\"\nimport pluralize from \"pluralize\"\nimport { useCallback, useEffect, useMemo, useRef } from \"react\"\nimport { useRecordEffect } from \"utils/useRecordEffect.ts\"\nimport { PriceItemList, PriceItemRow } from \"web/components/PriceItemRow.tsx\"\nimport { Separator } from \"web/components/Separator.tsx\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\nimport type { FlexToYearlyPreview } from \"../api/flexToYearly.ts\"\nimport { FlexToYearlyStatus, useFlexToYearly } from \"../hooks/useFlexToYearly.ts\"\n\nexport function FlexToYearlyModal({\n\tteamId,\n\tonClose,\n\tonSuccess,\n\tcurrency,\n\teditorCount,\n}: {\n\tteamId: string\n\tonClose: () => void\n\tcurrency: string\n\tonSuccess: () => void\n\teditorCount: number\n}) {\n\tconst { flexToYearlyState, handleUpdate, handlePreview } = useFlexToYearly({ teamId })\n\n\tuseRecordEffect(\"ui_impression\", { page: Pages.flexToYearlyPreviewModal })\n\n\tconst previewRef = useRef<FlexToYearlyPreview | undefined>(undefined)\n\tconst cachedPreview = useMemo(() => {\n\t\tif (flexToYearlyState.status === FlexToYearlyStatus.Preview && \"preview\" in flexToYearlyState) {\n\t\t\tpreviewRef.current = flexToYearlyState.preview\n\t\t\treturn flexToYearlyState.preview\n\t\t}\n\t\treturn previewRef.current\n\t}, [flexToYearlyState])\n\n\tconst handleCancel = useCallback(() => {\n\t\trecord(\"ui_interaction\", {\n\t\t\tpage: Pages.flexToYearlyPreviewModal,\n\t\t\tid: UIInteraction.flexToYearlyCancel,\n\t\t})\n\t\tonClose()\n\t}, [onClose])\n\n\tconst handleUpdateClick = useCallback(() => {\n\t\trecord(\"ui_interaction\", {\n\t\t\tpage: Pages.flexToYearlyPreviewModal,\n\t\t\tid: UIInteraction.flexToYearlyUpdate,\n\t\t})\n\t\tvoid handleUpdate()\n\t}, [handleUpdate])\n\n\tuseEffect(() => {\n\t\tvoid handlePreview()\n\t}, [handlePreview])\n\n\tuseEffect(() => {\n\t\tif (flexToYearlyState.status === FlexToYearlyStatus.UpdateSuccess) {\n\t\t\ttoast({\n\t\t\t\ttype: \"add\",\n\t\t\t\tvariant: \"success\",\n\t\t\t\tprimaryText: \"Upgraded\",\n\t\t\t\tsecondaryText: \"to yearly.\",\n\t\t\t\tduration: 5000,\n\t\t\t})\n\t\t\tonSuccess()\n\t\t}\n\t}, [flexToYearlyState.status, onSuccess])\n\n\tuseEffect(() => {\n\t\tif (flexToYearlyState.status !== FlexToYearlyStatus.Error) return\n\t\tshowPaymentErrorToast(flexToYearlyState.error, {\n\t\t\tteamId,\n\t\t\tretry: () => void handleUpdate(),\n\t\t\tgetPage: () => Pages.flexToYearlyPreviewModal,\n\t\t})\n\t}, [flexToYearlyState, teamId, handleUpdate])\n\n\tconst isUpdating =\n\t\tflexToYearlyState.status === FlexToYearlyStatus.Updating ||\n\t\tflexToYearlyState.status === FlexToYearlyStatus.UpdateSuccess\n\tconst isLoading = !cachedPreview\n\tconst canConfirm =\n\t\tflexToYearlyState.status === FlexToYearlyStatus.Preview ||\n\t\t(flexToYearlyState.status === FlexToYearlyStatus.Error && cachedPreview !== undefined)\n\tconst isDismissable = flexToYearlyState.status !== FlexToYearlyStatus.Updating\n\n\tconst { items, totalWithCredit, subtotal, tax, discount, appliedCredit } = cachedPreview || {}\n\n\tconst quantity = items?.editor?.quantity ?? editorCount\n\tconst editorTitle = `${quantity} \u00D7 ${pluralize(\"Editor\", quantity)}`\n\tconst editorPrice = items?.editor?.totalAmount\n\n\tconst displayProration = items?.editor?.proration !== undefined ? parseFloat(items.editor.proration) : null\n\tconst displayTax = tax !== undefined ? tax : null\n\tconst displayDiscount = discount != null && discount !== 0 ? discount : null\n\n\treturn (\n\t\t<ConfirmationModal\n\t\t\ttitle=\"Upgrade to Yearly\"\n\t\t\tonDismiss={isDismissable ? handleCancel : undefined}\n\t\t\tconfirmLabel=\"Confirm\"\n\t\t\tonConfirm={handleUpdateClick}\n\t\t\tconfirmButtonEnabled={canConfirm}\n\t\t\tconfirmButtonLoading={isUpdating}\n\t\t\tcancelLabel=\"Cancel\"\n\t\t\tonCancel={handleCancel}\n\t\t\tcancelButtonEnabled={isDismissable}\n\t\t\thasBackdrop\n\t\t>\n\t\t\t<Stack gap={10}>\n\t\t\t\t<Separator height={1} />\n\n\t\t\t\t<PriceItemList isLoading={isLoading}>\n\t\t\t\t\t<PriceItemRow title={editorTitle} price={editorPrice} currency={currency} />\n\t\t\t\t</PriceItemList>\n\n\t\t\t\t<Separator height={1} />\n\n\t\t\t\t<PriceItemList isLoading={isLoading}>\n\t\t\t\t\t<PriceItemRow title=\"Proration\" price={displayProration} currency={currency} />\n\t\t\t\t\t{displayDiscount !== null && <PriceItemRow title=\"Discount\" price={-displayDiscount} currency={currency} />}\n\t\t\t\t\t<PriceItemRow title=\"Subtotal\" price={subtotal} currency={currency} />\n\t\t\t\t\t<PriceItemRow title=\"VAT\" price={displayTax} currency={currency} />\n\t\t\t\t\t{appliedCredit !== undefined && appliedCredit < 0 && (\n\t\t\t\t\t\t<PriceItemRow title=\"Credit\" price={appliedCredit} currency={currency} />\n\t\t\t\t\t)}\n\t\t\t\t\t<PriceItemRow title=\"Pay Now\" price={totalWithCredit} currency={currency} bold />\n\t\t\t\t</PriceItemList>\n\t\t\t</Stack>\n\t\t</ConfirmationModal>\n\t)\n}\n", "import {\n\tPaymentErrorStatus,\n\ttype PaymentError,\n} from \"document/components/chrome/siteSettings/Plans/Stripe/api/errors/paymentError.ts\"\nimport { assertNever } from \"library/utils/assert.ts\"\nimport { useCallback, useState } from \"react\"\nimport {\n\ttype FlexToYearlyPreview,\n\ttype FlexToYearlyPreviewResponse,\n\tFlexToYearlyPreviewStatus,\n\ttype FlexToYearlyUpdateResponse,\n\tFlexToYearlyUpdateStatus,\n\tgetFlexToYearlyPreview,\n\tupdateFlexToYearly,\n} from \"../api/flexToYearly.ts\"\n\ntype FlexToYearlyState =\n\t| { status: FlexToYearlyStatus.Loading }\n\t| { status: FlexToYearlyStatus.Error; error: PaymentError }\n\t| { status: FlexToYearlyStatus.UpdateSuccess }\n\t| { status: FlexToYearlyStatus.Updating }\n\t| { status: FlexToYearlyStatus.Preview; preview: FlexToYearlyPreview }\n\nexport enum FlexToYearlyStatus {\n\tPreview,\n\tLoading,\n\tUpdating,\n\tUpdateSuccess,\n\tError,\n}\n\nexport function useFlexToYearly({ teamId }: { teamId: string }) {\n\tconst [flexToYearlyState, setFlexToYearlyState] = useState<FlexToYearlyState>({\n\t\tstatus: FlexToYearlyStatus.Loading,\n\t})\n\n\tconst handleUpdate = useCallback(async () => {\n\t\tsetFlexToYearlyState({ status: FlexToYearlyStatus.Updating })\n\n\t\tconst result = await updateFlexToYearly(teamId)\n\t\tconst nextState = getNextStateAfterUpdate(result)\n\t\tsetFlexToYearlyState(nextState)\n\t}, [teamId])\n\n\tconst handlePreview = useCallback(async () => {\n\t\tsetFlexToYearlyState({ status: FlexToYearlyStatus.Loading })\n\n\t\tconst preview = await getFlexToYearlyPreview(teamId)\n\t\tconst nextState = getNextStateAfterPreview(preview)\n\t\tsetFlexToYearlyState(nextState)\n\t}, [teamId])\n\n\treturn { flexToYearlyState, handleUpdate, handlePreview }\n}\n\nfunction getNextStateAfterPreview(preview: FlexToYearlyPreviewResponse): FlexToYearlyState {\n\tswitch (preview.status) {\n\t\tcase FlexToYearlyPreviewStatus.Success:\n\t\t\treturn { status: FlexToYearlyStatus.Preview, preview: preview.preview }\n\t\tcase FlexToYearlyPreviewStatus.UnauthorizedError:\n\t\t\treturn { status: FlexToYearlyStatus.Error, error: { status: PaymentErrorStatus.Unauthorized } }\n\t\tcase FlexToYearlyPreviewStatus.UnhandledError:\n\t\t\treturn { status: FlexToYearlyStatus.Error, error: { status: PaymentErrorStatus.UnhandledError } }\n\t\tdefault:\n\t\t\tassertNever(preview)\n\t}\n}\n\nfunction getNextStateAfterUpdate(result: FlexToYearlyUpdateResponse): FlexToYearlyState {\n\tswitch (result.status) {\n\t\tcase FlexToYearlyUpdateStatus.Success:\n\t\t\treturn { status: FlexToYearlyStatus.UpdateSuccess }\n\t\tcase FlexToYearlyUpdateStatus.PaymentError:\n\t\t\treturn { status: FlexToYearlyStatus.Error, error: result.error }\n\t\tdefault:\n\t\t\tassertNever(result)\n\t}\n}\n", "import { ApiError, HTTP_ERROR_CODES } from \"@framerjs/app-shared\"\nimport { assertNever, getLogger } from \"@framerjs/shared\"\nimport { transformPreviewResponseBody } from \"document/components/chrome/siteSettings/Plans/Stripe/api/checkoutPreview.ts\"\nimport type { CheckoutPreview } from \"document/components/chrome/siteSettings/Plans/Stripe/api/checkoutPreview.ts\"\nimport {\n\tPaymentErrorStatus,\n\tclassifyPaymentError,\n\thandleRequiredAction,\n\ttype PaymentError,\n\ttype PutSubscriptionResponseAction,\n} from \"document/components/chrome/siteSettings/Plans/Stripe/api/errors/paymentError.ts\"\nimport { apiFetcher } from \"web/lib/apiFetcher.ts\"\n\nconst log = getLogger(\"flexToYearly\")\n\nexport enum FlexToYearlyPreviewStatus {\n\tSuccess,\n\tUnauthorizedError,\n\tUnhandledError,\n}\n\nexport enum FlexToYearlyUpdateStatus {\n\tSuccess,\n\tPaymentError,\n}\n\nexport type FlexToYearlyPreview = Omit<CheckoutPreview, \"planId\">\n\nexport type FlexToYearlyPreviewResponse =\n\t| { status: FlexToYearlyPreviewStatus.Success; preview: FlexToYearlyPreview }\n\t| { status: FlexToYearlyPreviewStatus.UnauthorizedError }\n\t| { status: FlexToYearlyPreviewStatus.UnhandledError }\n\nexport type FlexToYearlyUpdateResponse =\n\t| { status: FlexToYearlyUpdateStatus.Success }\n\t| { status: FlexToYearlyUpdateStatus.PaymentError; error: PaymentError }\n\nexport async function getFlexToYearlyPreview(teamId: string): Promise<FlexToYearlyPreviewResponse> {\n\ttry {\n\t\tconst response = await apiFetcher.get(`/web/v2/teams/${teamId}/subscription/flex-to-yearly/preview`)\n\t\treturn {\n\t\t\tstatus: FlexToYearlyPreviewStatus.Success,\n\t\t\tpreview: transformPreviewResponseBody(response),\n\t\t}\n\t} catch (error) {\n\t\tif (error instanceof ApiError && error.status === HTTP_ERROR_CODES.Forbidden) {\n\t\t\treturn { status: FlexToYearlyPreviewStatus.UnauthorizedError }\n\t\t}\n\n\t\tlog.reportError(error, { extras: { teamId } })\n\t\treturn { status: FlexToYearlyPreviewStatus.UnhandledError }\n\t}\n}\n\nexport async function updateFlexToYearly(teamId: string): Promise<FlexToYearlyUpdateResponse> {\n\ttry {\n\t\tconst response: { result: \"success\" } | { result: \"action_required\"; action: PutSubscriptionResponseAction } =\n\t\t\tawait apiFetcher.put(`/web/v2/teams/${teamId}/subscription/flex-to-yearly`)\n\n\t\tif (response.result === \"success\") {\n\t\t\treturn { status: FlexToYearlyUpdateStatus.Success }\n\t\t}\n\n\t\tif (response.result === \"action_required\") {\n\t\t\tconst error = await handleRequiredAction(response.action)\n\t\t\treturn error\n\t\t\t\t? { status: FlexToYearlyUpdateStatus.PaymentError, error }\n\t\t\t\t: { status: FlexToYearlyUpdateStatus.Success }\n\t\t}\n\n\t\tassertNever(response, `Unexpected response`)\n\t} catch (error) {\n\t\tconst paymentError = classifyPaymentError(error)\n\t\tif (paymentError) return { status: FlexToYearlyUpdateStatus.PaymentError, error: paymentError }\n\n\t\tlog.reportError(error, { extras: { teamId } })\n\t\treturn {\n\t\t\tstatus: FlexToYearlyUpdateStatus.PaymentError,\n\t\t\terror: { status: PaymentErrorStatus.UnhandledError },\n\t\t}\n\t}\n}\n", "import { ProjectLicensePeriod, openNewTab } from \"@framerjs/app-shared\"\nimport { Modal, SegmentedControl, SegmentedControlItem, Spinner, Stack } from \"@framerjs/fresco\"\nimport { IconMinus, IconPlus } from \"@framerjs/fresco/icons\"\nimport { assertNever } from \"@framerjs/shared\"\nimport { noop } from \"@framerjs/shared/src/noop.ts\"\nimport { cx } from \"@linaria/core\"\nimport { tabularNumbers } from \"app/styles/typography.styles.ts\"\nimport {\n\ttype PaymentError,\n\tPaymentErrorStatus,\n} from \"document/components/chrome/siteSettings/Plans/Stripe/api/errors/paymentError.ts\"\nimport { InlinePaymentError } from \"document/components/chrome/siteSettings/Plans/Stripe/components/InlinePaymentError.tsx\"\nimport type React from \"react\"\nimport { useCallback, useEffect } from \"react\"\nimport { pricingFaqURL } from \"utils/staticURLs.ts\"\nimport { useRecordEffect } from \"utils/useRecordEffect.ts\"\nimport { summaryContainer } from \"web/components/PriceItemRow.styles.ts\"\nimport { PriceItemList, PriceItemRow } from \"web/components/PriceItemRow.tsx\"\nimport { Separator } from \"web/components/Separator.tsx\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\nimport type { TeamSubscriptionPreview } from \"../api/teamBillingPreview.ts\"\nimport { ManageSeatsErrorStatus, ManageSeatsStatus, useManageSeats } from \"../hooks/useManageSeats.ts\"\nimport * as styles from \"./ManageSeatsModal.styles.ts\"\n\nconst manageSeatsToastKey = \"manage-seats\"\n\nfunction getManageSeatsErrorPage(error: PaymentError): Pages {\n\tswitch (error.status) {\n\t\tcase PaymentErrorStatus.PaymentDeclined:\n\t\t\treturn Pages.manageSeatsErrorPaymentDeclined\n\t\tcase PaymentErrorStatus.ActionRequiredError:\n\t\t\treturn Pages.manageSeatsErrorActionsRequired\n\t\tcase PaymentErrorStatus.TaxLocationInvalid:\n\t\t\treturn Pages.manageSeatsErrorTaxLocationInvalid\n\t\tcase PaymentErrorStatus.Unauthorized:\n\t\t\treturn Pages.manageSeatsErrorUnhandled\n\t\tcase PaymentErrorStatus.UnhandledError:\n\t\t\treturn Pages.manageSeatsErrorUnhandled\n\t\tdefault:\n\t\t\tassertNever(error)\n\t}\n}\n\nfunction SeatStepper({\n\tvalue,\n\tonChange,\n\tmin,\n\tenabled = true,\n}: {\n\tvalue: number\n\tonChange: (value: number) => void\n\tmin?: number\n\tenabled?: boolean\n}) {\n\tconst stepDownEnabled = enabled && (min === undefined || value > min)\n\tconst stepUpEnabled = enabled\n\n\tconst decrement = useCallback(\n\t\t(_id: -1, event?: React.MouseEvent) => {\n\t\t\tconst step = event?.shiftKey ? 10 : 1\n\t\t\tonChange(min !== undefined ? Math.max(value - step, min) : value - step)\n\t\t},\n\t\t[value, onChange, min],\n\t)\n\n\tconst increment = useCallback(\n\t\t(_id: 1, event?: React.MouseEvent) => {\n\t\t\tconst step = event?.shiftKey ? 10 : 1\n\t\t\tonChange(value + step)\n\t\t},\n\t\t[value, onChange],\n\t)\n\n\treturn (\n\t\t<SegmentedControl enabled={enabled}>\n\t\t\t<SegmentedControlItem\n\t\t\t\tidentifier={-1 as const}\n\t\t\t\ttitle=\"Decrease\"\n\t\t\t\tselected={false}\n\t\t\t\tonSelect={decrement}\n\t\t\t\tenabled={stepDownEnabled}\n\t\t\t>\n\t\t\t\t<IconMinus />\n\t\t\t</SegmentedControlItem>\n\t\t\t<SegmentedControlItem\n\t\t\t\tidentifier={0}\n\t\t\t\ttitle={String(value)}\n\t\t\t\tselected={false}\n\t\t\t\tonSelect={noop}\n\t\t\t\tclassName={cx(styles.seatStepperValue, tabularNumbers)}\n\t\t\t>\n\t\t\t\t{value}\n\t\t\t</SegmentedControlItem>\n\t\t\t<SegmentedControlItem\n\t\t\t\tidentifier={1 as const}\n\t\t\t\ttitle=\"Increase\"\n\t\t\t\tselected={false}\n\t\t\t\tonSelect={increment}\n\t\t\t\tenabled={stepUpEnabled}\n\t\t\t>\n\t\t\t\t<IconPlus />\n\t\t\t</SegmentedControlItem>\n\t\t</SegmentedControl>\n\t)\n}\n\nfunction PriceBreakdown({\n\tpreview,\n\thasChanges,\n\tcurrency,\n\tisLoading,\n}: {\n\tpreview?: TeamSubscriptionPreview\n\thasChanges: boolean\n\tcurrency: string\n\tisLoading: boolean\n}) {\n\tconst { totalWithCredit, subtotal, tax, proration, discount, appliedCredit } = preview || {}\n\tconst displayProration = proration !== 0 ? proration : null\n\tconst displayTax = tax !== undefined && tax !== 0 ? tax : null\n\tconst displayDiscount = discount !== undefined && discount !== 0 ? discount : null\n\n\tif (hasChanges) {\n\t\treturn (\n\t\t\t<Stack gap={10} className={summaryContainer}>\n\t\t\t\t<span className={styles.seatLabel}>Summary</span>\n\t\t\t\t<PriceItemList isLoading={isLoading}>\n\t\t\t\t\t<PriceItemRow title=\"Proration\" price={displayProration} currency={currency} />\n\t\t\t\t\t{displayDiscount !== null && <PriceItemRow title=\"Discount\" price={-displayDiscount} currency={currency} />}\n\t\t\t\t\t<PriceItemRow title=\"Subtotal\" price={subtotal} currency={currency} />\n\t\t\t\t\t<PriceItemRow title=\"VAT\" price={displayTax} currency={currency} />\n\t\t\t\t\t{appliedCredit !== undefined && appliedCredit < 0 && (\n\t\t\t\t\t\t<PriceItemRow title=\"Credit\" price={appliedCredit} currency={currency} />\n\t\t\t\t\t)}\n\t\t\t\t</PriceItemList>\n\t\t\t\t<div className={styles.summaryDivider} />\n\t\t\t\t<PriceItemList isLoading={isLoading}>\n\t\t\t\t\t<PriceItemRow title=\"Pay Now\" price={totalWithCredit} currency={currency} bold />\n\t\t\t\t</PriceItemList>\n\t\t\t</Stack>\n\t\t)\n\t}\n\n\treturn (\n\t\t<Stack gap={10} className={summaryContainer}>\n\t\t\t<span className={styles.seatLabel}>Summary</span>\n\t\t\t<PriceItemList isLoading={isLoading} disabled>\n\t\t\t\t<PriceItemRow title=\"Proration\" currency={currency} />\n\t\t\t\t<PriceItemRow title=\"Subtotal\" currency={currency} />\n\t\t\t\t<PriceItemRow title=\"VAT\" currency={currency} />\n\t\t\t</PriceItemList>\n\t\t\t<div className={styles.summaryDivider} />\n\t\t\t<PriceItemList isLoading={isLoading} disabled>\n\t\t\t\t<PriceItemRow title=\"Pay Now\" currency={currency} />\n\t\t\t</PriceItemList>\n\t\t</Stack>\n\t)\n}\n\nexport function ManageSeatsModal({\n\tteamId,\n\tcurrency,\n\tperiod,\n\tcurrentEditorQuantity,\n\tminAllowedEditorCount,\n\tminAllowedContentEditorCount,\n\tcurrentContentEditorQuantity,\n\tonClose,\n\tonSuccess,\n}: {\n\tteamId: string\n\tcurrency: string\n\tperiod: ProjectLicensePeriod\n\tcurrentEditorQuantity: number\n\tminAllowedEditorCount: number\n\tminAllowedContentEditorCount: number\n\tcurrentContentEditorQuantity: number\n\tonClose: () => void\n\tonSuccess: (targets: { editorQuantity: number; contentEditorQuantity: number }) => void\n}) {\n\tconst {\n\t\tapi,\n\t\teditorQuantity,\n\t\tsetEditorQuantity,\n\t\tcontentEditorQuantity,\n\t\tsetContentEditorQuantity,\n\t\thasChanges,\n\t\thasPendingAddedSeats,\n\t\tisUpdating,\n\t\tisLoading,\n\t\tisDisabled,\n\t} = useManageSeats({\n\t\tteamId,\n\t\tperiod,\n\t\tcurrentEditorQuantity,\n\t\tminAllowedEditorCount,\n\t\tcurrentContentEditorQuantity,\n\t\tminAllowedContentEditorCount,\n\t\tonSuccess,\n\t})\n\n\tconst preview = \"preview\" in api.state ? api.state.preview : undefined\n\tconst inlinePaymentError: PaymentError | null =\n\t\tapi.state.status === ManageSeatsStatus.UpdateFailed ? api.state.error : null\n\n\tconst handleCancel = useCallback(() => {\n\t\trecord(\"ui_interaction\", {\n\t\t\tpage: Pages.manageSeatsModal,\n\t\t\tid: UIInteraction.manageSeatsCancel,\n\t\t})\n\t\tonClose()\n\t}, [onClose])\n\n\tconst handleUpdateClick = useCallback(() => {\n\t\trecord(\"ui_interaction\", {\n\t\t\tpage: Pages.manageSeatsModal,\n\t\t\tid: UIInteraction.manageSeatsUpdate,\n\t\t})\n\t\ttoast({ type: \"remove\", key: manageSeatsToastKey })\n\t\tvoid api.handleUpdate()\n\t}, [api])\n\n\tuseRecordEffect(\"ui_impression\", { page: Pages.manageSeatsModal })\n\n\tuseEffect(() => {\n\t\tif (api.state.status !== ManageSeatsStatus.Error) return\n\n\t\tconst { error } = api.state\n\n\t\tswitch (error.status) {\n\t\t\tcase ManageSeatsErrorStatus.BelowCurrentEditors:\n\t\t\tcase ManageSeatsErrorStatus.BelowCurrentContentEditors:\n\t\t\t\ttoast({\n\t\t\t\t\ttype: \"add\",\n\t\t\t\t\tkey: manageSeatsToastKey,\n\t\t\t\t\tvariant: \"warning\",\n\t\t\t\t\tprimaryText: `Minimum ${error.status === ManageSeatsErrorStatus.BelowCurrentEditors ? \"editor\" : \"content editor\"} seats`,\n\t\t\t\t\tsecondaryText: \"reached.\",\n\t\t\t\t\tduration: 5000,\n\t\t\t\t\taction: {\n\t\t\t\t\t\ttitle: \"Learn more\",\n\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\trecord(\"ui_interaction\", {\n\t\t\t\t\t\t\t\tpage: Pages.manageSeatsModal,\n\t\t\t\t\t\t\t\tid: UIInteraction.learnMore,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\topenNewTab(pricingFaqURL)\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t\treturn\n\t\t\tcase ManageSeatsErrorStatus.Unauthorized:\n\t\t\t\ttoast({\n\t\t\t\t\ttype: \"add\",\n\t\t\t\t\tkey: manageSeatsToastKey,\n\t\t\t\t\tvariant: \"error\",\n\t\t\t\t\tprimaryText: \"Unauthorized.\",\n\t\t\t\t\tsecondaryText: \"Contact your admin.\",\n\t\t\t\t\tduration: 5000,\n\t\t\t\t})\n\t\t\t\treturn\n\t\t\tcase ManageSeatsErrorStatus.UnhandledPreview:\n\t\t\t\ttoast({\n\t\t\t\t\ttype: \"add\",\n\t\t\t\t\tkey: manageSeatsToastKey,\n\t\t\t\t\tvariant: \"error\",\n\t\t\t\t\tprimaryText: \"Something went wrong.\",\n\t\t\t\t\tsecondaryText: \"Please try again later or contact support.\",\n\t\t\t\t\tduration: 5000,\n\t\t\t\t})\n\t\t\t\treturn\n\t\t\tdefault:\n\t\t\t\tassertNever(error)\n\t\t}\n\t}, [api])\n\n\tconst periodLabel = (() => {\n\t\tswitch (period) {\n\t\t\tcase ProjectLicensePeriod.Month:\n\t\t\t\treturn \"Monthly\"\n\t\t\tcase ProjectLicensePeriod.Year:\n\t\t\t\treturn \"Yearly\"\n\t\t\tdefault:\n\t\t\t\tassertNever(period)\n\t\t}\n\t})()\n\n\treturn (\n\t\t<Modal.Root\n\t\t\tonDismiss={isUpdating ? undefined : handleCancel}\n\t\t\tonConfirm={hasChanges ? handleUpdateClick : undefined}\n\t\t\tkeyboardConfirmMode={hasChanges && !isDisabled ? \"Enter\" : false}\n\t\t\thasBackdrop\n\t\t\tfixPositionAfterMount\n\t\t>\n\t\t\t<Modal.Header separator={false} accessory={<span className={styles.periodLabel}>{periodLabel}</span>}>\n\t\t\t\tManage Seats\n\t\t\t</Modal.Header>\n\n\t\t\t<Stack gap={10}>\n\t\t\t\t<Separator height={1} />\n\n\t\t\t\t{hasPendingAddedSeats && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<p className={styles.pendingSeatsMessage}>\n\t\t\t\t\t\t\tEditors were added to your workspace. Seat count will update within 24 hours, or you can confirm these\n\t\t\t\t\t\t\tchanges now.\n\t\t\t\t\t\t</p>\n\t\t\t\t\t\t<Separator height={1} />\n\t\t\t\t\t</>\n\t\t\t\t)}\n\n\t\t\t\t<Stack justifyContent=\"space-between\" alignItems=\"center\" direction=\"row\">\n\t\t\t\t\t<span className={styles.seatLabel}>Editor Seats</span>\n\t\t\t\t\t<SeatStepper\n\t\t\t\t\t\tvalue={editorQuantity}\n\t\t\t\t\t\tonChange={setEditorQuantity}\n\t\t\t\t\t\tmin={Math.max(minAllowedEditorCount, 1)}\n\t\t\t\t\t\tenabled={!isUpdating}\n\t\t\t\t\t/>\n\t\t\t\t</Stack>\n\n\t\t\t\t<Separator height={1} />\n\n\t\t\t\t<Stack justifyContent=\"space-between\" alignItems=\"center\" direction=\"row\">\n\t\t\t\t\t<span className={styles.seatLabel}>Content Seats</span>\n\t\t\t\t\t<SeatStepper\n\t\t\t\t\t\tvalue={contentEditorQuantity}\n\t\t\t\t\t\tonChange={setContentEditorQuantity}\n\t\t\t\t\t\tmin={minAllowedContentEditorCount}\n\t\t\t\t\t\tenabled={!isUpdating}\n\t\t\t\t\t/>\n\t\t\t\t</Stack>\n\n\t\t\t\t<PriceBreakdown preview={preview} hasChanges={hasChanges} currency={currency} isLoading={isLoading} />\n\t\t\t</Stack>\n\n\t\t\t<Modal.Footer>\n\t\t\t\t{inlinePaymentError ? (\n\t\t\t\t\t<InlinePaymentError\n\t\t\t\t\t\terror={inlinePaymentError}\n\t\t\t\t\t\tteamId={teamId}\n\t\t\t\t\t\tpage={Pages.manageSeatsModal}\n\t\t\t\t\t\terrorPage={getManageSeatsErrorPage(inlinePaymentError)}\n\t\t\t\t\t\tonDismiss={api.clearError}\n\t\t\t\t\t\tonRetry={() => void api.handleUpdate()}\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Modal.CancelButton enabled={!isUpdating} onClick={handleCancel}>\n\t\t\t\t\t\t\t{hasChanges ? \"Cancel\" : \"OK\"}\n\t\t\t\t\t\t</Modal.CancelButton>\n\n\t\t\t\t\t\t{hasChanges && (\n\t\t\t\t\t\t\t<Modal.ActionButton type=\"submit\" title=\"Confirm\" enabled={!isDisabled && !isUpdating}>\n\t\t\t\t\t\t\t\t{isUpdating ? <Spinner /> : \"Confirm\"}\n\t\t\t\t\t\t\t</Modal.ActionButton>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t</Modal.Footer>\n\t\t</Modal.Root>\n\t)\n}\n", "import { type ProjectLicensePeriod, getContentEditorAddOnPlan } from \"@framerjs/app-shared\"\nimport {\n\ttype PaymentError,\n\tPaymentErrorStatus,\n} from \"document/components/chrome/siteSettings/Plans/Stripe/api/errors/paymentError.ts\"\nimport { assertNever } from \"library/utils/assert.ts\"\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\"\n\nimport { isAbortError } from \"web/lib/Fetcher.ts\"\nimport {\n\ttype TeamSubscriptionPreviewResponse,\n\tTeamSubscriptionPreviewStatus,\n\ttype TeamSubscriptionUpdateResponse,\n\tTeamSubscriptionUpdateStatus,\n\tpreviewTeamSubscriptionUpdate,\n\tupdateTeamSubscription,\n} from \"../api/billing.ts\"\nimport type { TeamSubscriptionPreview } from \"../api/teamBillingPreview.ts\"\n\ntype ManageSeatsState =\n\t| { status: ManageSeatsStatus.Loading }\n\t| { status: ManageSeatsStatus.Error; error: ManageSeatsError }\n\t| { status: ManageSeatsStatus.UpdateFailed; preview: TeamSubscriptionPreview; error: PaymentError }\n\t| { status: ManageSeatsStatus.UpdateSuccess }\n\t| {\n\t\t\tstatus: ManageSeatsStatus.Preview | ManageSeatsStatus.Updating | ManageSeatsStatus.UpdatingPreview\n\t\t\tpreview: TeamSubscriptionPreview\n\t  }\n\nexport enum ManageSeatsStatus {\n\tPreview,\n\tLoading,\n\tUpdating,\n\tUpdatingPreview,\n\tUpdateSuccess,\n\tError,\n\tUpdateFailed,\n}\n\nexport enum ManageSeatsErrorStatus {\n\tBelowCurrentEditors,\n\tBelowCurrentContentEditors,\n\tUnhandledPreview,\n\tUnauthorized,\n}\n\ntype ManageSeatsError =\n\t| { status: ManageSeatsErrorStatus.BelowCurrentEditors; expectedFullEditors: number }\n\t| { status: ManageSeatsErrorStatus.BelowCurrentContentEditors; expectedContentEditors: number }\n\t| { status: ManageSeatsErrorStatus.UnhandledPreview }\n\t| { status: ManageSeatsErrorStatus.Unauthorized }\n\ninterface ManageSeatsParams {\n\tteamId: string\n\tperiod: ProjectLicensePeriod\n\tcurrentEditorQuantity: number\n\tminAllowedEditorCount: number\n\tcurrentContentEditorQuantity: number\n\tminAllowedContentEditorCount: number\n\tonSuccess: (targets: { editorQuantity: number; contentEditorQuantity: number }) => void\n}\n\ninterface SeatQuantities {\n\tquantity: number\n\tcontentEditorQuantity: number\n}\n\nfunction buildBody({ quantity, contentEditorQuantity }: SeatQuantities, period: ProjectLicensePeriod) {\n\treturn {\n\t\tquantity,\n\t\taddOns: [{ plan: getContentEditorAddOnPlan(period), quantity: contentEditorQuantity }],\n\t}\n}\n\nexport function useManageSeats({\n\tteamId,\n\tperiod,\n\tcurrentEditorQuantity,\n\tminAllowedEditorCount,\n\tcurrentContentEditorQuantity,\n\tminAllowedContentEditorCount,\n\tonSuccess,\n}: ManageSeatsParams) {\n\tconst initialEditorQuantity = Math.max(currentEditorQuantity, minAllowedEditorCount, 1)\n\tconst initialContentEditorQuantity = Math.max(currentContentEditorQuantity, minAllowedContentEditorCount)\n\tconst [editorQuantity, setEditorQuantity] = useState(initialEditorQuantity)\n\tconst [contentEditorQuantity, setContentEditorQuantity] = useState(initialContentEditorQuantity)\n\tconst [state, setState] = useState<ManageSeatsState>({\n\t\tstatus: ManageSeatsStatus.Loading,\n\t})\n\tconst previewAbortController = useRef<AbortController | undefined>(undefined)\n\n\tconst handlePreview = useCallback(\n\t\tasync (quantities: SeatQuantities) => {\n\t\t\tpreviewAbortController.current?.abort()\n\t\t\tconst controller = new AbortController()\n\t\t\tpreviewAbortController.current = controller\n\t\t\tsetState(prev => {\n\t\t\t\tif (\"preview\" in prev) {\n\t\t\t\t\treturn { status: ManageSeatsStatus.UpdatingPreview, preview: prev.preview }\n\t\t\t\t}\n\t\t\t\treturn { status: ManageSeatsStatus.Loading }\n\t\t\t})\n\t\t\ttry {\n\t\t\t\tconst body = buildBody(quantities, period)\n\t\t\t\tconst result = await previewTeamSubscriptionUpdate(teamId, body, controller.signal)\n\t\t\t\tsetState(getNextStateAfterPreview(result))\n\t\t\t} catch (error) {\n\t\t\t\tif (isAbortError(error)) return\n\t\t\t\tsetState({ status: ManageSeatsStatus.Error, error: { status: ManageSeatsErrorStatus.UnhandledPreview } })\n\t\t\t}\n\t\t},\n\t\t[teamId, period],\n\t)\n\n\tconst handleUpdate = useCallback(async () => {\n\t\tpreviewAbortController.current?.abort()\n\t\tsetState(prev => {\n\t\t\tif (!(\"preview\" in prev)) return prev\n\t\t\treturn { status: ManageSeatsStatus.Updating, preview: prev.preview }\n\t\t})\n\n\t\tconst body = buildBody({ quantity: editorQuantity, contentEditorQuantity }, period)\n\t\tconst result = await updateTeamSubscription(teamId, body)\n\t\tsetState(prev => {\n\t\t\tconst preview = \"preview\" in prev ? prev.preview : undefined\n\t\t\treturn getNextStateAfterUpdate(result, preview)\n\t\t})\n\t\tif (result.status === TeamSubscriptionUpdateStatus.Success) {\n\t\t\tonSuccess({ editorQuantity, contentEditorQuantity })\n\t\t}\n\t}, [teamId, period, editorQuantity, contentEditorQuantity, onSuccess])\n\n\tconst clearError = useCallback(() => {\n\t\tif (state.status === ManageSeatsStatus.UpdateFailed) {\n\t\t\tsetState({ status: ManageSeatsStatus.Preview, preview: state.preview })\n\t\t}\n\t}, [state])\n\n\tuseEffect(() => {\n\t\tvoid handlePreview({ quantity: editorQuantity, contentEditorQuantity })\n\t}, [handlePreview, editorQuantity, contentEditorQuantity])\n\n\tconst hasChanges = editorQuantity !== currentEditorQuantity || contentEditorQuantity !== currentContentEditorQuantity\n\tconst hasPendingAddedSeats =\n\t\tcurrentEditorQuantity < minAllowedEditorCount || currentContentEditorQuantity < minAllowedContentEditorCount\n\tconst isUpdating = state.status === ManageSeatsStatus.Updating || state.status === ManageSeatsStatus.UpdateSuccess\n\tconst isLoading = state.status === ManageSeatsStatus.Loading || state.status === ManageSeatsStatus.UpdatingPreview\n\tconst isDisabled = state.status !== ManageSeatsStatus.Preview || !hasChanges\n\tconst api = useMemo(\n\t\t() => ({ state, handlePreview, handleUpdate, clearError }),\n\t\t[state, handlePreview, handleUpdate, clearError],\n\t)\n\n\treturn {\n\t\tapi,\n\t\teditorQuantity,\n\t\tsetEditorQuantity,\n\t\tcontentEditorQuantity,\n\t\tsetContentEditorQuantity,\n\t\thasChanges,\n\t\thasPendingAddedSeats,\n\t\tisUpdating,\n\t\tisLoading,\n\t\tisDisabled,\n\t}\n}\n\nfunction getNextStateAfterPreview(preview: TeamSubscriptionPreviewResponse): ManageSeatsState {\n\tswitch (preview.status) {\n\t\tcase TeamSubscriptionPreviewStatus.Success:\n\t\t\treturn { status: ManageSeatsStatus.Preview, preview: preview.preview }\n\t\tcase TeamSubscriptionPreviewStatus.BelowCurrentEditors:\n\t\t\treturn {\n\t\t\t\tstatus: ManageSeatsStatus.Error,\n\t\t\t\terror: {\n\t\t\t\t\tstatus: ManageSeatsErrorStatus.BelowCurrentEditors,\n\t\t\t\t\texpectedFullEditors: preview.expectedFullEditors,\n\t\t\t\t},\n\t\t\t}\n\t\tcase TeamSubscriptionPreviewStatus.BelowCurrentContentEditors:\n\t\t\treturn {\n\t\t\t\tstatus: ManageSeatsStatus.Error,\n\t\t\t\terror: {\n\t\t\t\t\tstatus: ManageSeatsErrorStatus.BelowCurrentContentEditors,\n\t\t\t\t\texpectedContentEditors: preview.expectedContentEditors,\n\t\t\t\t},\n\t\t\t}\n\t\tcase TeamSubscriptionPreviewStatus.UnauthorizedError:\n\t\t\treturn { status: ManageSeatsStatus.Error, error: { status: ManageSeatsErrorStatus.Unauthorized } }\n\t\tcase TeamSubscriptionPreviewStatus.UnhandledError:\n\t\t\treturn { status: ManageSeatsStatus.Error, error: { status: ManageSeatsErrorStatus.UnhandledPreview } }\n\t\tdefault:\n\t\t\tassertNever(preview)\n\t}\n}\n\nfunction getNextStateAfterUpdate(\n\tresult: TeamSubscriptionUpdateResponse,\n\tpreview: TeamSubscriptionPreview | undefined,\n): ManageSeatsState {\n\tswitch (result.status) {\n\t\tcase TeamSubscriptionUpdateStatus.Success:\n\t\t\treturn { status: ManageSeatsStatus.UpdateSuccess }\n\t\tcase TeamSubscriptionUpdateStatus.BelowCurrentEditors:\n\t\t\treturn {\n\t\t\t\tstatus: ManageSeatsStatus.Error,\n\t\t\t\terror: {\n\t\t\t\t\tstatus: ManageSeatsErrorStatus.BelowCurrentEditors,\n\t\t\t\t\texpectedFullEditors: result.expectedFullEditors,\n\t\t\t\t},\n\t\t\t}\n\t\tcase TeamSubscriptionUpdateStatus.BelowCurrentContentEditors:\n\t\t\treturn {\n\t\t\t\tstatus: ManageSeatsStatus.Error,\n\t\t\t\terror: {\n\t\t\t\t\tstatus: ManageSeatsErrorStatus.BelowCurrentContentEditors,\n\t\t\t\t\texpectedContentEditors: result.expectedContentEditors,\n\t\t\t\t},\n\t\t\t}\n\t\tcase TeamSubscriptionUpdateStatus.PaymentError:\n\t\t\tif (result.error.status === PaymentErrorStatus.Unauthorized) {\n\t\t\t\treturn { status: ManageSeatsStatus.Error, error: { status: ManageSeatsErrorStatus.Unauthorized } }\n\t\t\t}\n\t\t\tif (preview) {\n\t\t\t\treturn { status: ManageSeatsStatus.UpdateFailed, preview, error: result.error }\n\t\t\t}\n\t\t\treturn { status: ManageSeatsStatus.Error, error: { status: ManageSeatsErrorStatus.UnhandledPreview } }\n\t\tdefault:\n\t\t\tassertNever(result)\n\t}\n}\n", "import {\n\ttype ProjectLicensePeriod,\n\ttype TeamAddOnLicenseType,\n\ttype TeamLicenseType,\n\tisValidTeamAddOnLicense,\n\tisValidTeamLicense,\n} from \"@framerjs/app-shared\"\nimport type { CheckoutPreview } from \"document/components/chrome/siteSettings/Plans/Stripe/api/checkoutPreview.ts\"\n\ninterface TeamPreviewItemApiResponse {\n\tplan: string\n\tquantity: number\n\tamountWithProration: string\n\tamountWithoutProration: string\n\tproration: string\n\tunitAmount: string\n\tlicenseType: string\n\tdiscount: string\n\tunitAmountTiers?: Record<string, string>\n}\n\nexport interface TeamPreviewApiResponse {\n\ttotal: string\n\tsubtotal: string\n\ttax: string | null\n\tcredit: string\n\ttotalWithCredit: string\n\tappliedCredit: string\n\tproration: string\n\tdiscount: string\n\tcurrency: string\n\tnextBillDate?: string\n\tprorationDate?: string\n\tperiod: ProjectLicensePeriod\n\titems: TeamPreviewItemApiResponse[]\n}\n\ninterface TeamPreviewItem {\n\tplan: string\n\tquantity: number\n\tamountWithProration: number\n\tamountWithoutProration: number\n\tproration: number\n\tunitAmount: number\n\tdiscount: number\n\ttotalAmount: number\n\tunitAmountTiers?: Record<string, string>\n}\n\ntype TeamPlanItem = TeamPreviewItem & { licenseType: TeamLicenseType }\ntype TeamAddOnItem = TeamPreviewItem & { licenseType: TeamAddOnLicenseType }\n\ninterface TeamTransformedItemList {\n\tteamPlan: TeamPlanItem | null\n\tteamAddons: TeamAddOnItem[]\n}\n\nexport interface TeamSubscriptionPreview extends Omit<\n\tCheckoutPreview,\n\t\"planId\" | \"items\" | \"creditedAmount\" | \"proration\" | \"nextBillDate\"\n> {\n\tdiscount: number\n\tnextBillDate?: Date\n\tprorationDate?: Date\n\tproration: number\n\titems: TeamTransformedItemList\n}\n\nexport function transformTeamPreviewResponseBody(res: TeamPreviewApiResponse): TeamSubscriptionPreview {\n\tconst transformedItems: TeamTransformedItemList = {\n\t\tteamPlan: null,\n\t\tteamAddons: [],\n\t}\n\n\tfor (const line of res.items) {\n\t\tconst amountWithProration = parseFloat(line.amountWithProration)\n\t\tconst amountWithoutProration = parseFloat(line.amountWithoutProration)\n\t\tconst transformedItem = {\n\t\t\t...line,\n\t\t\tamountWithProration,\n\t\t\tamountWithoutProration,\n\t\t\tunitAmount: parseFloat(line.unitAmount),\n\t\t\tdiscount: parseFloat(line.discount),\n\t\t\ttotalAmount: amountWithoutProration,\n\t\t\tproration: parseFloat(line.proration) || 0,\n\t\t}\n\t\tconst { licenseType } = transformedItem\n\n\t\tif (isValidTeamAddOnLicense(licenseType)) {\n\t\t\ttransformedItems.teamAddons.push({ ...transformedItem, licenseType })\n\t\t}\n\t\tif (isValidTeamLicense(licenseType)) {\n\t\t\ttransformedItems.teamPlan = { ...transformedItem, licenseType }\n\t\t}\n\t}\n\n\treturn {\n\t\ttotal: parseFloat(res.total),\n\t\tsubtotal: parseFloat(res.subtotal),\n\t\ttax: res.tax !== null ? parseFloat(res.tax) : null,\n\t\tcredit: parseFloat(res.credit),\n\t\ttotalWithCredit: parseFloat(res.totalWithCredit),\n\t\tproration: parseFloat(res.proration) || 0,\n\t\tappliedCredit: parseFloat(res.appliedCredit),\n\t\tdiscount: parseFloat(res.discount),\n\t\tcurrency: res.currency,\n\t\tnextBillDate: res.nextBillDate ? new Date(res.nextBillDate) : undefined,\n\t\tprorationDate: res.prorationDate ? new Date(res.prorationDate) : undefined,\n\t\tperiod: res.period,\n\t\titems: transformedItems,\n\t}\n}\n", "import { ApiError, HTTP_ERROR_CODES, type ProjectLicensePeriod, type TeamAddOnPlan } from \"@framerjs/app-shared\"\nimport { assertNever, getLogger } from \"@framerjs/shared\"\nimport {\n\tPaymentErrorStatus,\n\tclassifyPaymentError,\n\thandleRequiredAction,\n\ttype PaymentError,\n\ttype PutSubscriptionResponseAction,\n} from \"document/components/chrome/siteSettings/Plans/Stripe/api/errors/paymentError.ts\"\nimport { isAbortError } from \"web/lib/Fetcher.ts\"\nimport { apiFetcher } from \"web/lib/apiFetcher.ts\"\nimport {\n\ttype TeamPreviewApiResponse,\n\ttype TeamSubscriptionPreview,\n\ttransformTeamPreviewResponseBody,\n} from \"./teamBillingPreview.ts\"\n\nconst log = getLogger(\"billing-v3-api\")\n\nexport enum TeamSubscriptionPreviewStatus {\n\tSuccess,\n\tBelowCurrentEditors,\n\tBelowCurrentContentEditors,\n\tUnauthorizedError,\n\tUnhandledError,\n}\n\nexport enum TeamSubscriptionUpdateStatus {\n\tSuccess,\n\tBelowCurrentEditors,\n\tBelowCurrentContentEditors,\n\tPaymentError,\n}\n\nexport type TeamSubscriptionPreviewResponse =\n\t| { status: TeamSubscriptionPreviewStatus.Success; preview: TeamSubscriptionPreview }\n\t| { status: TeamSubscriptionPreviewStatus.BelowCurrentEditors; expectedFullEditors: number }\n\t| { status: TeamSubscriptionPreviewStatus.BelowCurrentContentEditors; expectedContentEditors: number }\n\t| { status: TeamSubscriptionPreviewStatus.UnauthorizedError }\n\t| { status: TeamSubscriptionPreviewStatus.UnhandledError }\n\nexport type TeamSubscriptionUpdateResponse =\n\t| { status: TeamSubscriptionUpdateStatus.Success }\n\t| { status: TeamSubscriptionUpdateStatus.BelowCurrentEditors; expectedFullEditors: number }\n\t| { status: TeamSubscriptionUpdateStatus.BelowCurrentContentEditors; expectedContentEditors: number }\n\t| { status: TeamSubscriptionUpdateStatus.PaymentError; error: PaymentError }\n\nfunction getBelowCurrentEditorsCount(error: ApiError): number | null {\n\tif (error.data?.reason !== \"below_current_editors\") return null\n\treturn typeof error.data?.expectedFullEditors === \"number\" ? error.data.expectedFullEditors : null\n}\n\nfunction getBelowCurrentContentEditorsCount(error: ApiError): number | null {\n\tif (error.data?.reason !== \"below_current_content_editors\") return null\n\treturn typeof error.data?.expectedContentEditors === \"number\" ? error.data.expectedContentEditors : null\n}\n\ninterface UpdateTeamSubscriptionBody {\n\tquantity?: number\n\tperiod?: ProjectLicensePeriod\n\taddOns?: {\n\t\tplan: TeamAddOnPlan\n\t\tquantity: number\n\t}[]\n}\n\nexport async function previewTeamSubscriptionUpdate(\n\tteamId: string,\n\tbody: UpdateTeamSubscriptionBody,\n\tsignal?: AbortSignal,\n): Promise<TeamSubscriptionPreviewResponse> {\n\ttry {\n\t\tconst response: TeamPreviewApiResponse = await apiFetcher.post(\n\t\t\t`/web/v3/teams/${teamId}/subscription/preview`,\n\t\t\tbody,\n\t\t\tsignal,\n\t\t)\n\t\treturn {\n\t\t\tstatus: TeamSubscriptionPreviewStatus.Success,\n\t\t\tpreview: transformTeamPreviewResponseBody(response),\n\t\t}\n\t} catch (error) {\n\t\tif (isAbortError(error)) throw error\n\n\t\tif (error instanceof ApiError && error.status === HTTP_ERROR_CODES.BadRequest) {\n\t\t\tconst expectedFullEditors = getBelowCurrentEditorsCount(error)\n\t\t\tif (expectedFullEditors !== null) {\n\t\t\t\treturn { status: TeamSubscriptionPreviewStatus.BelowCurrentEditors, expectedFullEditors }\n\t\t\t}\n\t\t\tconst expectedContentEditors = getBelowCurrentContentEditorsCount(error)\n\t\t\tif (expectedContentEditors !== null) {\n\t\t\t\treturn { status: TeamSubscriptionPreviewStatus.BelowCurrentContentEditors, expectedContentEditors }\n\t\t\t}\n\t\t}\n\n\t\tif (error instanceof ApiError && error.status === HTTP_ERROR_CODES.Forbidden) {\n\t\t\treturn { status: TeamSubscriptionPreviewStatus.UnauthorizedError }\n\t\t}\n\n\t\tlog.reportError(error, { extras: { teamId } })\n\t\treturn { status: TeamSubscriptionPreviewStatus.UnhandledError }\n\t}\n}\n\nexport enum TeamSubscriptionMigrateStatus {\n\tSuccess,\n\tPartialSuccess,\n\tUnauthorizedError,\n\tUnhandledError,\n}\n\nexport interface PartialMigrationFailedProject {\n\tprojectId: string\n\tprojectTitle: string\n}\n\ninterface PartialMigrationError {\n\tprojectId: string\n\tprojectTitle: string\n}\n\ntype MigrateApiResponse = { result: \"success\" } | { result: \"partial_success\"; errors: PartialMigrationError[] }\n\ntype TeamSubscriptionMigrateResponse =\n\t| { status: TeamSubscriptionMigrateStatus.Success }\n\t| { status: TeamSubscriptionMigrateStatus.PartialSuccess; failedProjects: PartialMigrationFailedProject[] }\n\t| { status: TeamSubscriptionMigrateStatus.UnauthorizedError }\n\t| { status: TeamSubscriptionMigrateStatus.UnhandledError }\n\nexport async function migrateTeamSubscription(\n\tteamId: string,\n\tbody: { period?: ProjectLicensePeriod },\n): Promise<TeamSubscriptionMigrateResponse> {\n\ttry {\n\t\tconst response: MigrateApiResponse = await apiFetcher.post(`/web/v3/teams/${teamId}/subscription/migrate`, body)\n\n\t\tif (response.result === \"partial_success\") {\n\t\t\tconst failedProjects: PartialMigrationFailedProject[] = response.errors.map(error => ({\n\t\t\t\tprojectId: error.projectId,\n\t\t\t\tprojectTitle: error.projectTitle,\n\t\t\t}))\n\n\t\t\treturn { status: TeamSubscriptionMigrateStatus.PartialSuccess, failedProjects }\n\t\t}\n\n\t\treturn { status: TeamSubscriptionMigrateStatus.Success }\n\t} catch (error) {\n\t\tif (error instanceof ApiError && error.status === HTTP_ERROR_CODES.Forbidden) {\n\t\t\treturn { status: TeamSubscriptionMigrateStatus.UnauthorizedError }\n\t\t}\n\n\t\tlog.reportError(error, { extras: { teamId } })\n\t\treturn { status: TeamSubscriptionMigrateStatus.UnhandledError }\n\t}\n}\n\nexport async function updateTeamSubscription(\n\tteamId: string,\n\tbody: UpdateTeamSubscriptionBody,\n): Promise<TeamSubscriptionUpdateResponse> {\n\ttry {\n\t\tconst response: { result: \"success\" } | { result: \"action_required\"; action: PutSubscriptionResponseAction } =\n\t\t\tawait apiFetcher.put(`/web/v3/teams/${teamId}/subscription`, body)\n\n\t\tif (response.result === \"success\") {\n\t\t\treturn { status: TeamSubscriptionUpdateStatus.Success }\n\t\t}\n\n\t\tif (response.result === \"action_required\") {\n\t\t\tconst error = await handleRequiredAction(response.action)\n\t\t\treturn error\n\t\t\t\t? { status: TeamSubscriptionUpdateStatus.PaymentError, error }\n\t\t\t\t: { status: TeamSubscriptionUpdateStatus.Success }\n\t\t}\n\n\t\tassertNever(response, \"Unexpected response\")\n\t} catch (error) {\n\t\tif (error instanceof ApiError && error.status === HTTP_ERROR_CODES.BadRequest) {\n\t\t\tconst expectedFullEditors = getBelowCurrentEditorsCount(error)\n\t\t\tif (expectedFullEditors !== null) {\n\t\t\t\treturn { status: TeamSubscriptionUpdateStatus.BelowCurrentEditors, expectedFullEditors }\n\t\t\t}\n\t\t\tconst expectedContentEditors = getBelowCurrentContentEditorsCount(error)\n\t\t\tif (expectedContentEditors !== null) {\n\t\t\t\treturn { status: TeamSubscriptionUpdateStatus.BelowCurrentContentEditors, expectedContentEditors }\n\t\t\t}\n\t\t}\n\n\t\tconst paymentError = classifyPaymentError(error)\n\t\tif (paymentError) return { status: TeamSubscriptionUpdateStatus.PaymentError, error: paymentError }\n\n\t\tlog.reportError(error, { extras: { teamId } })\n\t\treturn {\n\t\t\tstatus: TeamSubscriptionUpdateStatus.PaymentError,\n\t\t\terror: { status: PaymentErrorStatus.UnhandledError },\n\t\t}\n\t}\n}\n", "import \"ManageSeatsModal.styles_1kgld0o.wyw.css\"; export const summaryDivider = \"summaryDivider_s1n7o0jh\";\nexport const pendingSeatsMessage = \"pendingSeatsMessage_pmflm7o\";\nexport const seatLabel = \"seatLabel_s1hyktft\";\nexport const seatStepperValue = \"seatStepperValue_s1b2ev6f\";\nexport const periodLabel = \"periodLabel_p1e22lcu\";", "import { ProjectLicensePeriod, dashboardPath } from \"@framerjs/app-shared\"\nimport {\n\tConfirmationModal,\n\tIconChevronRight,\n\tLink,\n\tModal,\n\tSegmentedControl,\n\tSegmentedControlItem,\n\tStack,\n} from \"@framerjs/fresco\"\nimport { assertNever } from \"@framerjs/shared\"\nimport React, { useCallback, useState } from \"react\"\nimport { pricingFaqURL } from \"utils/staticURLs.ts\"\nimport { useRecordEffect } from \"utils/useRecordEffect.ts\"\nimport { Separator } from \"web/components/Separator.tsx\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\nimport {\n\ttype PartialMigrationFailedProject,\n\tTeamSubscriptionMigrateStatus,\n\tmigrateTeamSubscription,\n} from \"../api/billing.ts\"\nimport * as styles from \"./MigrateBillingModal.styles.ts\"\n\nconst slowMigrationToastKey = \"migrate-billing-slow\"\n\ninterface MigrateBillingModalProps {\n\tteamId: string\n\thasMultipleSites: boolean\n\thasFlexEditors: boolean\n\tonClose: () => void\n\tonSuccess: () => void\n}\n\nexport function MigrateBillingModal({\n\tteamId,\n\thasMultipleSites,\n\thasFlexEditors,\n\tonClose,\n\tonSuccess,\n}: MigrateBillingModalProps) {\n\tconst [isSubmitting, setIsSubmitting] = useState(false)\n\tconst showPeriodSelector = hasFlexEditors\n\tconst [period, setPeriod] = useState(ProjectLicensePeriod.Year)\n\tconst [failedProjects, setFailedProjects] = useState<PartialMigrationFailedProject[] | null>(null)\n\n\tuseRecordEffect(\"ui_impression\", { page: Pages.migrateBillingModal })\n\n\tconst handleCancel = useCallback(() => {\n\t\trecord(\"ui_interaction\", {\n\t\t\tpage: Pages.migrateBillingModal,\n\t\t\tid: UIInteraction.migrateBillingCancel,\n\t\t})\n\t\tonClose()\n\t}, [onClose])\n\n\tconst handleConfirm = useCallback(async () => {\n\t\trecord(\"ui_interaction\", {\n\t\t\tpage: Pages.migrateBillingModal,\n\t\t\tid: UIInteraction.migrateBillingConfirm,\n\t\t})\n\n\t\tsetIsSubmitting(true)\n\t\tconst body = showPeriodSelector ? { period } : {}\n\n\t\tlet migrationFinished = false\n\t\tconst slowMigrationTimeout = setTimeout(() => {\n\t\t\tif (migrationFinished) return\n\t\t\ttoast({\n\t\t\t\ttype: \"add\",\n\t\t\t\tvariant: \"warning\",\n\t\t\t\tprimaryText: \"Taking a bit longer\",\n\t\t\t\tsecondaryText: \"Please wait...\",\n\t\t\t\tduration: Infinity,\n\t\t\t\tshowCloseButton: \"never\",\n\t\t\t\tkey: slowMigrationToastKey,\n\t\t\t})\n\t\t}, 10_000)\n\n\t\tconst result = await migrateTeamSubscription(teamId, body)\n\t\tmigrationFinished = true\n\t\tclearTimeout(slowMigrationTimeout)\n\t\ttoast({ type: \"remove\", key: slowMigrationToastKey })\n\n\t\tswitch (result.status) {\n\t\t\tcase TeamSubscriptionMigrateStatus.Success:\n\t\t\t\ttoast({\n\t\t\t\t\ttype: \"add\",\n\t\t\t\t\tvariant: \"info\",\n\t\t\t\t\tprimaryText: \"Migration\",\n\t\t\t\t\tsecondaryText: \"completed.\",\n\t\t\t\t\tduration: 5000,\n\t\t\t\t})\n\t\t\t\tonSuccess()\n\t\t\t\treturn\n\t\t\tcase TeamSubscriptionMigrateStatus.PartialSuccess:\n\t\t\t\tsetFailedProjects(result.failedProjects)\n\t\t\t\trecord(\"ui_impression\", { page: Pages.partialMigration })\n\t\t\t\treturn\n\t\t\tcase TeamSubscriptionMigrateStatus.UnauthorizedError:\n\t\t\t\ttoast({\n\t\t\t\t\ttype: \"add\",\n\t\t\t\t\tvariant: \"error\",\n\t\t\t\t\tprimaryText: \"Permission denied\",\n\t\t\t\t\tsecondaryText: \"Only workspace editors or admins can perform this action.\",\n\t\t\t\t\tduration: 5000,\n\t\t\t\t})\n\t\t\t\tbreak\n\t\t\tcase TeamSubscriptionMigrateStatus.UnhandledError:\n\t\t\t\ttoast({\n\t\t\t\t\ttype: \"add\",\n\t\t\t\t\tvariant: \"error\",\n\t\t\t\t\tprimaryText: \"Something went wrong\",\n\t\t\t\t\tsecondaryText: \"Please try again later or contact support.\",\n\t\t\t\t\tduration: 5000,\n\t\t\t\t})\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\tassertNever(result)\n\t\t}\n\n\t\tsetIsSubmitting(false)\n\t}, [teamId, showPeriodSelector, period, onSuccess])\n\n\tif (failedProjects) {\n\t\treturn (\n\t\t\t<Modal.Root onDismiss={onClose} hasBackdrop>\n\t\t\t\t<Modal.Header separator={false}>Migration Failed</Modal.Header>\n\n\t\t\t\t<Stack gap={10}>\n\t\t\t\t\t<Separator height={1} />\n\n\t\t\t\t\t<p className={styles.failedDescription}>\n\t\t\t\t\t\tWe couldn\u2019t migrate all your projects, and some of your subscriptions were cancelled. You\u2019ve been credited\n\t\t\t\t\t\tfor the unused time. Review the projects below and reactivate them as needed.\n\t\t\t\t\t</p>\n\n\t\t\t\t\t{failedProjects.map(project => (\n\t\t\t\t\t\t<React.Fragment key={project.projectId}>\n\t\t\t\t\t\t\t<Separator height={1} />\n\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\tclassName={styles.failedProjectLink}\n\t\t\t\t\t\t\t\thref={`${dashboardPath}${project.projectId}`}\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\trel=\"noreferrer\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<span>{project.projectTitle}</span>\n\t\t\t\t\t\t\t\t<IconChevronRight />\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t</React.Fragment>\n\t\t\t\t\t))}\n\n\t\t\t\t\t<Separator height={1} />\n\t\t\t\t</Stack>\n\n\t\t\t\t<Modal.Footer>\n\t\t\t\t\t<Modal.CancelButton onClick={onClose}>Dismiss</Modal.CancelButton>\n\t\t\t\t</Modal.Footer>\n\t\t\t</Modal.Root>\n\t\t)\n\t}\n\n\treturn (\n\t\t<ConfirmationModal\n\t\t\ttitle=\"New Billing\"\n\t\t\tconfirmLabel=\"Confirm\"\n\t\t\tcancelLabel=\"Cancel\"\n\t\t\tonConfirm={handleConfirm}\n\t\t\tonCancel={handleCancel}\n\t\t\tonDismiss={isSubmitting ? undefined : handleCancel}\n\t\t\tconfirmButtonEnabled={!isSubmitting}\n\t\t\tconfirmButtonLoading={isSubmitting}\n\t\t\tcancelButtonEnabled={!isSubmitting}\n\t\t\thasBackdrop\n\t\t>\n\t\t\t<Stack>\n\t\t\t\t<Separator height={1} />\n\n\t\t\t\t<span className={styles.body}>\n\t\t\t\t\t{\"Our billing system has been \"}\n\t\t\t\t\t<Link variant=\"linkLined\" href={pricingFaqURL}>\n\t\t\t\t\t\tupdated\n\t\t\t\t\t</Link>\n\t\t\t\t\t{\". \"}\n\t\t\t\t\t{hasMultipleSites\n\t\t\t\t\t\t? \"To use certain features, your account needs to be migrated. Site subscriptions will be billed separately, and new editors are charged on a prorated basis. This action will not cause any immediate charges.\"\n\t\t\t\t\t\t: \"To use certain features, your account needs to be migrated. New editors are charged on a prorated basis. This migration will not cause any immediate charges.\"}\n\t\t\t\t</span>\n\n\t\t\t\t{showPeriodSelector && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Separator height={1} />\n\n\t\t\t\t\t\t<Stack direction=\"row\" justifyContent=\"space-between\" alignItems=\"center\">\n\t\t\t\t\t\t\t<span className={styles.editorsBillingLabel}>Editors Billing</span>\n\t\t\t\t\t\t\t<SegmentedControl>\n\t\t\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\t\t\tidentifier={ProjectLicensePeriod.Month}\n\t\t\t\t\t\t\t\t\ttitle=\"Monthly\"\n\t\t\t\t\t\t\t\t\tselected={period === ProjectLicensePeriod.Month}\n\t\t\t\t\t\t\t\t\tonSelect={() => setPeriod(ProjectLicensePeriod.Month)}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\tMonthly\n\t\t\t\t\t\t\t\t</SegmentedControlItem>\n\t\t\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\t\t\tidentifier={ProjectLicensePeriod.Year}\n\t\t\t\t\t\t\t\t\ttitle=\"Yearly\"\n\t\t\t\t\t\t\t\t\tselected={period === ProjectLicensePeriod.Year}\n\t\t\t\t\t\t\t\t\tonSelect={() => setPeriod(ProjectLicensePeriod.Year)}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\tYearly\n\t\t\t\t\t\t\t\t</SegmentedControlItem>\n\t\t\t\t\t\t\t</SegmentedControl>\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t</Stack>\n\t\t</ConfirmationModal>\n\t)\n}\n", "import \"MigrateBillingModal.styles_162dc9t.wyw.css\"; export const body = \"body_b1bb3q3t\";\nexport const editorsBillingLabel = \"editorsBillingLabel_eyy6rsj\";\nexport const failedDescription = \"failedDescription_f1wf60qc\";\nexport const failedProjectLink = \"failedProjectLink_f3mkic2\";", "import type { ProjectBase } from \"@framerjs/app-shared\"\nimport {\n\tProjectLicenseType,\n\tTeamLicenseType,\n\tdashboardPath,\n\tgetProjectLicenseName,\n\topenNewTab,\n} from \"@framerjs/app-shared\"\nimport { UpsellType } from \"@framerjs/events\"\nimport { Button, ConfirmationModal, CustomModal, Spinner, Stack, Translatable as T } from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { SitesBadge } from \"document/components/chrome/SitesBadge/SitesBadge.tsx\"\nimport { EnterpriseUpsellModal } from \"document/components/chrome/shared/UpsellModal/EnterpriseUpsellModal.tsx\"\nimport { UpsellFeature } from \"document/components/chrome/siteSettings/Plans/Stripe/utils/upsell.ts\"\nimport {\n\tSettingSectionContainer,\n\tSettingSectionHeader,\n} from \"document/components/chrome/siteSettings/SettingSection.tsx\"\nimport { useModalTheme } from \"document/components/chrome/utils/useModalTheme.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport type { ModalType } from \"document/utils/ModalType.ts\"\nimport React from \"react\"\nimport { enterpriseUpsellURL } from \"utils/staticURLs.ts\"\nimport { useRecordEffect } from \"utils/useRecordEffect.ts\"\nimport { UpsellUIInteraction, record } from \"web/lib/tracker.ts\"\nimport { usePurchaseOriginLocalStorage } from \"web/lib/usePurchaseOriginLocalStorage.ts\"\nimport type { ProjectToUpgrade } from \"../api/getProjectsForTeam.ts\"\nimport { GetProjectsForTeam, getProjectsForTeam } from \"../api/getProjectsForTeam.ts\"\nimport * as styles from \"./SelectProjectToUpgradeModal.styles.ts\"\nimport { itemHeight, listVerticalPadding } from \"./SelectProjectToUpgradeModal.styles.ts\"\n\nexport function SelectProjectToUpgradeModal(props: ModalProps<ModalType.SelectProjectToUpgrade>) {\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\tconst { teamId, currentTeamLicense, hasActiveSubscription, onDismiss, projects } = props\n\n\tconst modalThemeProps = useModalTheme(\"darker\")\n\n\tconst isActiveBusinessPlan = currentTeamLicense === TeamLicenseType.TeamBusinessPlan && hasActiveSubscription\n\n\tconst upsell =\n\t\tisActiveBusinessPlan || currentTeamLicense === TeamLicenseType.EnterprisePlan\n\t\t\t? UpsellType.enterpriseEditorLimitUpsell\n\t\t\t: UpsellType.teamEditorLimitUpsell\n\n\tuseRecordEffect(\"ui_impression\", { page: upsell }, [upsell])\n\n\tconst onCancel = React.useCallback(() => {\n\t\trecord(\"ui_interaction\", { page: upsell, id: UpsellUIInteraction.cancelUpsell })\n\t\tonDismiss()\n\t}, [onDismiss, upsell])\n\n\t/**\n\t * The assumption here is that if the team is on a business plan,\n\t * then it has the highest editor limit available (=== 10).\n\t * The only way to increase it is to go to Enterprise.\n\t * However, if the subscription is inactive, treat the workspace like a free plan\n\t * and prompt the user to upgrade a project to a paid business plan.\n\t */\n\tif (isActiveBusinessPlan) {\n\t\treturn (\n\t\t\t<EnterpriseUpsellModal\n\t\t\t\tdescription=\"Upgrade your workspace to add more editors and unlock powerful features that help scale your site.\"\n\t\t\t\tonConfirm={() => {\n\t\t\t\t\trecord(\"ui_interaction\", { page: upsell, id: UpsellUIInteraction.contactUs })\n\t\t\t\t\topenNewTab(enterpriseUpsellURL)\n\t\t\t\t\tonDismiss()\n\t\t\t\t}}\n\t\t\t\tonCancel={onCancel}\n\t\t\t\tupsellFeatures={[\n\t\t\t\t\t\"Advanced Permissions\",\n\t\t\t\t\t\"Custom Limits\",\n\t\t\t\t\t\"Custom Hosting\",\n\t\t\t\t\t\"Custom Proxy Support\",\n\t\t\t\t\t\"Enterprise Security\",\n\t\t\t\t\t\"Dedicated Support\",\n\t\t\t\t]}\n\t\t\t\t{...modalThemeProps}\n\t\t\t/>\n\t\t)\n\t}\n\n\tif (currentTeamLicense === TeamLicenseType.EnterprisePlan) {\n\t\treturn (\n\t\t\t<ConfirmationModal\n\t\t\t\ttitle=\"Add More Editors\"\n\t\t\t\tdescription={\n\t\t\t\t\t<T>This invite exceeds your editor limit. Contact us to increase the number of editors on your plan.</T>\n\t\t\t\t}\n\t\t\t\tconfirmLabel={Dictionary.ContactUs}\n\t\t\t\tcancelLabel=\"Dismiss\"\n\t\t\t\tonConfirm={() => {\n\t\t\t\t\trecord(\"ui_interaction\", { page: upsell, id: UpsellUIInteraction.contactUs })\n\t\t\t\t\topenNewTab(enterpriseUpsellURL)\n\t\t\t\t}}\n\t\t\t\tonCancel={onCancel}\n\t\t\t\tonDismiss={onCancel}\n\t\t\t\tlegacy={!isAgentExperimentOn}\n\t\t\t/>\n\t\t)\n\t}\n\n\tconst targetPlans = (\n\t\t<>\n\t\t\t<span className={styles.highlight}>{getProjectLicenseName(ProjectLicenseType.ProSite2025)}</span>\n\t\t\t<T> or </T>\n\t\t\t<span className={styles.highlight}>{getProjectLicenseName(ProjectLicenseType.ScaleSite2025)}</span>\n\t\t</>\n\t)\n\n\treturn (\n\t\t<CustomModal visible hasBackdrop className={styles.modal} onDismiss={onCancel} {...modalThemeProps}>\n\t\t\t<SettingSectionContainer compact className={styles.section}>\n\t\t\t\t<SettingSectionHeader\n\t\t\t\t\ttitle=\"Upgrade\"\n\t\t\t\t\tdescription={\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<T>Editors in your workspace are billed and limited based on the</T>\n\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t<T>highest-tier site plan in your workspace. Upgrade a site to a </T>\n\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t{targetPlans}\n\t\t\t\t\t\t\t<T> plan to add more editors to your workspace.</T>\n\t\t\t\t\t\t</>\n\t\t\t\t\t}\n\t\t\t\t\taction={\n\t\t\t\t\t\t<Button onClick={onDismiss} variant=\"default\" bold>\n\t\t\t\t\t\t\t<T>Cancel</T>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t}\n\t\t\t\t\tcompact\n\t\t\t\t\tdivider\n\t\t\t\t/>\n\t\t\t\t<ProjectsToUpgrade teamId={teamId} upsell={upsell} projects={projects} />\n\t\t\t</SettingSectionContainer>\n\t\t</CustomModal>\n\t)\n}\n\ntype ProjectsToUpgradeState =\n\t| { status: \"loading\" }\n\t| { status: \"success\"; projects: ProjectToUpgrade[] }\n\t| { status: \"error\" }\n\nfunction ProjectsToUpgrade(props: { teamId: string; upsell: UpsellType; projects?: ProjectBase[] }) {\n\tconst { teamId, upsell, projects } = props\n\tconst [state, setState] = React.useState<ProjectsToUpgradeState>({ status: \"loading\" })\n\tconst { updatePurchaseOrigin } = usePurchaseOriginLocalStorage()\n\n\tReact.useEffect(() => {\n\t\tasync function fetchProjects() {\n\t\t\ttry {\n\t\t\t\tconst licensedResponse = await getProjectsForTeam(teamId)\n\n\t\t\t\tif (licensedResponse.status !== GetProjectsForTeam.Success) {\n\t\t\t\t\tsetState({ status: \"error\" })\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// If there are projects with licenses, use them\n\t\t\t\tif (licensedResponse.projects.length > 0) {\n\t\t\t\t\tsetState({ status: \"success\", projects: licensedResponse.projects })\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// No licenses, check if there are projects without licenses\n\t\t\t\tif (projects && projects.length > 0) {\n\t\t\t\t\tconst projectsWithoutLicense = projects.map(project => ({\n\t\t\t\t\t\tprojectId: project.id,\n\t\t\t\t\t\tprojectTitle: project.title || \"Untitled\",\n\t\t\t\t\t\ttype: ProjectLicenseType.FreeSite,\n\t\t\t\t\t}))\n\n\t\t\t\t\tsetState({ status: \"success\", projects: projectsWithoutLicense })\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\tsetState({ status: \"error\" })\n\t\t\t}\n\t\t}\n\n\t\tvoid fetchProjects()\n\t}, [teamId, projects])\n\n\tconst onUpgradeProjectClick = React.useCallback(\n\t\t(project: ProjectToUpgrade) => {\n\t\t\tupdatePurchaseOrigin(\n\t\t\t\tupsell,\n\t\t\t\t{\n\t\t\t\t\tprojectId: project.projectId,\n\t\t\t\t\tsite: project.type,\n\t\t\t\t\tteam: null,\n\t\t\t\t},\n\t\t\t\tnull,\n\t\t\t)\n\t\t\trecord(\"ui_interaction\", { page: upsell, id: UpsellUIInteraction.confirmUpsell })\n\t\t\twindow.location.href = `${dashboardPath}${project.projectId}?view=settings:plans:${UpsellFeature.canInviteEditors}`\n\t\t},\n\t\t[upsell, updatePurchaseOrigin],\n\t)\n\n\tif (state.status === \"loading\") {\n\t\treturn (\n\t\t\t<Stack className={styles.projectsToUpgrade} style={{ height: getContainerHeight(1) }}>\n\t\t\t\t<Spinner />\n\t\t\t</Stack>\n\t\t)\n\t}\n\n\tif (state.status === \"error\") {\n\t\treturn (\n\t\t\t<Stack className={styles.projectsToUpgrade} style={{ height: getContainerHeight(1) }}>\n\t\t\t\t<div className={styles.error}>Failed to load projects</div>\n\t\t\t</Stack>\n\t\t)\n\t}\n\n\treturn (\n\t\t<Stack\n\t\t\tdirection=\"column\"\n\t\t\tclassName={styles.projectsToUpgrade}\n\t\t\tgap={0}\n\t\t\tstyle={{ height: getContainerHeight(state.projects.length) }}\n\t\t>\n\t\t\t{state.projects.map(project => (\n\t\t\t\t<ProjectItem key={project.projectId} project={project} onUpgradeProjectClick={onUpgradeProjectClick} />\n\t\t\t))}\n\t\t</Stack>\n\t)\n}\n\n/** Max 3 items, plus the vertical padding */\nfunction getContainerHeight(items: number): number {\n\treturn Math.min(3, items) * itemHeight + 2 * listVerticalPadding\n}\n\nfunction ProjectItem({\n\tproject,\n\tonUpgradeProjectClick,\n}: {\n\tproject: ProjectToUpgrade\n\tonUpgradeProjectClick: (project: ProjectToUpgrade) => void\n}) {\n\tconst [isHovered, setIsHovered] = React.useState(false)\n\tconst [isLoading, setIsLoading] = React.useState(false)\n\n\tconst onClick = () => {\n\t\tsetIsLoading(true)\n\t\tonUpgradeProjectClick(project)\n\t}\n\n\treturn (\n\t\t<Stack\n\t\t\tdirection=\"row\"\n\t\t\tjustifyContent=\"space-between\"\n\t\t\talignItems=\"center\"\n\t\t\tgap={15}\n\t\t\tonMouseEnter={() => setIsHovered(true)}\n\t\t\tonMouseLeave={() => setIsHovered(false)}\n\t\t\tclassName={cx(styles.projectToUpgrade, isHovered && styles.isHovered)}\n\t\t>\n\t\t\t<Stack gap={5} direction=\"row\">\n\t\t\t\t<div className={styles.projectToUpgradeTitle} title={project.projectTitle}>\n\t\t\t\t\t{project.projectTitle}\n\t\t\t\t</div>\n\t\t\t\t<SitesBadge variant={project.type} />\n\t\t\t</Stack>\n\t\t\t{isHovered && (\n\t\t\t\t<Button variant=\"primary\" bold className={styles.projectToUpgradeButton} onClick={onClick}>\n\t\t\t\t\t{isLoading ? <Spinner /> : <T>Upgrade</T>}\n\t\t\t\t</Button>\n\t\t\t)}\n\t\t</Stack>\n\t)\n}\n", "import type { ProjectLicenseType } from \"@framerjs/app-shared\"\nimport { getLogger } from \"@framerjs/shared\"\nimport { apiFetcher } from \"web/lib/apiFetcher.ts\"\n\nconst log = getLogger(\"getProjectsForTeam\")\n\nexport enum GetProjectsForTeam {\n\tSuccess,\n\tUnhandledError,\n}\n\nexport interface ProjectToUpgrade {\n\tprojectId: string\n\tprojectTitle: string\n\ttype: ProjectLicenseType\n}\n\ntype ProjectsForTeamResponse =\n\t| {\n\t\t\tstatus: GetProjectsForTeam.Success\n\t\t\tprojects: ProjectToUpgrade[]\n\t  }\n\t| {\n\t\t\tstatus: GetProjectsForTeam.UnhandledError\n\t  }\n\nexport async function getProjectsForTeam(teamId: string): Promise<ProjectsForTeamResponse> {\n\ttry {\n\t\tconst projects = await apiFetcher.get(`/web/projects/licenses`, { teamId })\n\t\treturn { status: GetProjectsForTeam.Success, projects }\n\t} catch (error) {\n\t\tlog.reportError(error)\n\t\treturn { status: GetProjectsForTeam.UnhandledError }\n\t}\n}\n", "import \"SelectProjectToUpgradeModal.styles_1j992k8.wyw.css\"; export const modal = \"modal_mjz9uwv\";\nexport const highlight = \"highlight_h7rnq5c\";\nexport const section = \"section_s1kjd3qf\";\nexport const error = \"error_ep7opey\";\nexport const itemHeight = 50;\nexport const listVerticalPadding = 20;\nexport const projectsToUpgrade = \"projectsToUpgrade_pfuxw9u\";\nexport const projectToUpgrade = \"projectToUpgrade_p1050hmd\";\nexport const isHovered = \"isHovered_if8wwcu\";\nexport const projectToUpgradeTitle = \"projectToUpgradeTitle_p15ru8k6\";\nexport const projectToUpgradeButton = \"projectToUpgradeButton_p11sqhij\";", "import { getTeamAddOnLicenseTypeName, getTeamLicenseName } from \"@framerjs/app-shared\"\nimport { Modal, Spinner, Stack } from \"@framerjs/fresco\"\nimport { assertNever } from \"@framerjs/shared\"\nimport {\n\ttype PaymentError,\n\tPaymentErrorStatus,\n} from \"document/components/chrome/siteSettings/Plans/Stripe/api/errors/paymentError.ts\"\nimport { InlinePaymentError } from \"document/components/chrome/siteSettings/Plans/Stripe/components/InlinePaymentError.tsx\"\nimport type { SwitchToYearlyCurrentItems } from \"document/stores/ModalStore.ts\"\nimport pluralize from \"pluralize\"\nimport { useCallback, useEffect } from \"react\"\nimport { useRecordEffect } from \"utils/useRecordEffect.ts\"\nimport { summaryContainer } from \"web/components/PriceItemRow.styles.ts\"\nimport { PriceItemList, PriceItemRow } from \"web/components/PriceItemRow.tsx\"\nimport { Separator } from \"web/components/Separator.tsx\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\nimport { SwitchToYearlyStatus, useSwitchToYearly } from \"../hooks/useSwitchToYearly.ts\"\nimport * as styles from \"./ManageSeatsModal.styles.ts\"\n\nfunction getSwitchToYearlyErrorPage(error: PaymentError): Pages {\n\tswitch (error.status) {\n\t\tcase PaymentErrorStatus.PaymentDeclined:\n\t\t\treturn Pages.switchToYearlyErrorPaymentDeclined\n\t\tcase PaymentErrorStatus.ActionRequiredError:\n\t\t\treturn Pages.switchToYearlyErrorActionsRequired\n\t\tcase PaymentErrorStatus.TaxLocationInvalid:\n\t\t\treturn Pages.switchToYearlyErrorTaxLocationInvalid\n\t\tcase PaymentErrorStatus.Unauthorized:\n\t\t\treturn Pages.switchToYearlyErrorUnhandled\n\t\tcase PaymentErrorStatus.UnhandledError:\n\t\t\treturn Pages.switchToYearlyErrorUnhandled\n\t\tdefault:\n\t\t\tassertNever(error)\n\t}\n}\n\nexport function SwitchToYearlyModal({\n\tteamId,\n\tonClose,\n\tonSuccess,\n\tcurrency,\n\tcurrentItems,\n}: {\n\tteamId: string\n\tonClose: () => void\n\tcurrency: string\n\tcurrentItems: SwitchToYearlyCurrentItems\n\tonSuccess: () => void\n}) {\n\tconst { state, handleUpdate, handlePreview, clearError } = useSwitchToYearly({\n\t\tteamId,\n\t})\n\tconst preview = \"preview\" in state ? state.preview : undefined\n\tconst inlinePaymentError = state.status === SwitchToYearlyStatus.UpdateFailed ? state.error : null\n\n\tuseRecordEffect(\"ui_impression\", { page: Pages.switchToYearlyPreviewModal })\n\n\tconst handleCancel = useCallback(() => {\n\t\trecord(\"ui_interaction\", {\n\t\t\tpage: Pages.switchToYearlyPreviewModal,\n\t\t\tid: UIInteraction.switchToYearlyCancel,\n\t\t})\n\t\tonClose()\n\t}, [onClose])\n\n\tconst handleUpdateClick = useCallback(() => {\n\t\trecord(\"ui_interaction\", {\n\t\t\tpage: Pages.switchToYearlyPreviewModal,\n\t\t\tid: UIInteraction.switchToYearlyUpdate,\n\t\t})\n\t\tvoid handleUpdate()\n\t}, [handleUpdate])\n\n\tuseEffect(() => {\n\t\tvoid handlePreview()\n\t}, [handlePreview])\n\n\tuseEffect(() => {\n\t\tif (state.status === SwitchToYearlyStatus.UpdateSuccess) {\n\t\t\ttoast({\n\t\t\t\ttype: \"add\",\n\t\t\t\tvariant: \"success\",\n\t\t\t\tprimaryText: \"Switched\",\n\t\t\t\tsecondaryText: \"to yearly.\",\n\t\t\t\tduration: 5000,\n\t\t\t})\n\t\t\tonSuccess()\n\t\t}\n\t}, [state.status, onSuccess])\n\n\tuseEffect(() => {\n\t\tif (state.status !== SwitchToYearlyStatus.Error) return\n\t\tif (state.error.status === PaymentErrorStatus.Unauthorized) {\n\t\t\ttoast({\n\t\t\t\ttype: \"add\",\n\t\t\t\tvariant: \"error\",\n\t\t\t\tprimaryText: \"Unauthorized.\",\n\t\t\t\tsecondaryText: \"Contact your admin.\",\n\t\t\t\tduration: 5000,\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\ttoast({\n\t\t\ttype: \"add\",\n\t\t\tvariant: \"error\",\n\t\t\tprimaryText: \"Something went wrong.\",\n\t\t\tsecondaryText: \"Please try again later or contact support.\",\n\t\t\tduration: 5000,\n\t\t})\n\t}, [state])\n\n\tconst isUpdating =\n\t\tstate.status === SwitchToYearlyStatus.Updating || state.status === SwitchToYearlyStatus.UpdateSuccess\n\tconst isLoading = state.status === SwitchToYearlyStatus.Loading\n\tconst canConfirm = state.status === SwitchToYearlyStatus.Preview || state.status === SwitchToYearlyStatus.UpdateFailed\n\tconst isDismissable = state.status !== SwitchToYearlyStatus.Updating\n\n\tconst { items, totalWithCredit, subtotal, tax, proration, discount, appliedCredit } = preview || {}\n\n\t// Current items from the dashboard can be stale. We treat them as a placeholder in the loading state\n\tconst teamPlan = items?.teamPlan ?? currentItems.teamPlan\n\tconst teamAddons = items?.teamAddons ?? currentItems.teamAddons\n\n\tconst teamPlanPrice = items?.teamPlan?.totalAmount\n\tconst teamAddonPriceByPlan = new Map(items?.teamAddons.map(addon => [addon.plan, addon.totalAmount]))\n\n\tconst displayProration = proration || null\n\tconst displayTax = tax !== undefined ? tax : null\n\tconst displayDiscount = discount != null && discount !== 0 ? discount : null\n\n\treturn (\n\t\t<Modal.Root\n\t\t\tonDismiss={isDismissable ? handleCancel : undefined}\n\t\t\tonConfirm={canConfirm ? handleUpdateClick : undefined}\n\t\t\tkeyboardConfirmMode={canConfirm && !inlinePaymentError ? \"Enter\" : false}\n\t\t\thasBackdrop\n\t\t\tfixPositionAfterMount\n\t\t>\n\t\t\t<Modal.Header separator={false}>Switch to Yearly</Modal.Header>\n\n\t\t\t<Stack gap={10}>\n\t\t\t\t<Separator height={1} />\n\n\t\t\t\t<PriceItemList isLoading={isLoading}>\n\t\t\t\t\t{teamPlan && (\n\t\t\t\t\t\t<PriceItemRow\n\t\t\t\t\t\t\ttitle={`${teamPlan.quantity} \u00D7 ${getTeamLicenseName(teamPlan.licenseType)} ${pluralize(\"Editor\", teamPlan.quantity)}`}\n\t\t\t\t\t\t\tprice={teamPlanPrice}\n\t\t\t\t\t\t\tcurrency={currency}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t\t{teamAddons.map(addon => (\n\t\t\t\t\t\t<PriceItemRow\n\t\t\t\t\t\t\tkey={addon.plan}\n\t\t\t\t\t\t\ttitle={`${addon.quantity} \u00D7 ${getTeamAddOnLicenseTypeName(addon.licenseType)}`}\n\t\t\t\t\t\t\tprice={teamAddonPriceByPlan.get(addon.plan)}\n\t\t\t\t\t\t\tcurrency={currency}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t</PriceItemList>\n\n\t\t\t\t<Stack gap={10} className={summaryContainer}>\n\t\t\t\t\t<span className={styles.seatLabel}>Summary</span>\n\t\t\t\t\t<PriceItemList isLoading={isLoading}>\n\t\t\t\t\t\t<PriceItemRow title=\"Proration\" price={displayProration} currency={currency} />\n\t\t\t\t\t\t{displayDiscount !== null && <PriceItemRow title=\"Discount\" price={-displayDiscount} currency={currency} />}\n\t\t\t\t\t\t<PriceItemRow title=\"Subtotal\" price={subtotal} currency={currency} />\n\t\t\t\t\t\t<PriceItemRow title=\"VAT\" price={displayTax} currency={currency} />\n\t\t\t\t\t\t{appliedCredit !== undefined && appliedCredit < 0 && (\n\t\t\t\t\t\t\t<PriceItemRow title=\"Credit\" price={appliedCredit} currency={currency} />\n\t\t\t\t\t\t)}\n\t\t\t\t\t</PriceItemList>\n\t\t\t\t\t<div className={styles.summaryDivider} />\n\t\t\t\t\t<PriceItemList isLoading={isLoading}>\n\t\t\t\t\t\t<PriceItemRow title=\"Pay Now\" price={totalWithCredit} currency={currency} bold />\n\t\t\t\t\t</PriceItemList>\n\t\t\t\t</Stack>\n\t\t\t</Stack>\n\n\t\t\t<Modal.Footer>\n\t\t\t\t{inlinePaymentError ? (\n\t\t\t\t\t<InlinePaymentError\n\t\t\t\t\t\terror={inlinePaymentError}\n\t\t\t\t\t\tteamId={teamId}\n\t\t\t\t\t\tpage={Pages.switchToYearlyPreviewModal}\n\t\t\t\t\t\terrorPage={getSwitchToYearlyErrorPage(inlinePaymentError)}\n\t\t\t\t\t\tonDismiss={clearError}\n\t\t\t\t\t\tonRetry={() => void handleUpdate()}\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Modal.CancelButton enabled={isDismissable} onClick={handleCancel}>\n\t\t\t\t\t\t\tCancel\n\t\t\t\t\t\t</Modal.CancelButton>\n\t\t\t\t\t\t<Modal.ActionButton type=\"submit\" title=\"Confirm\" enabled={canConfirm && !isUpdating}>\n\t\t\t\t\t\t\t{isUpdating ? <Spinner /> : \"Confirm\"}\n\t\t\t\t\t\t</Modal.ActionButton>\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t</Modal.Footer>\n\t\t</Modal.Root>\n\t)\n}\n", "import { ProjectLicensePeriod } from \"@framerjs/app-shared\"\nimport {\n\ttype PaymentError,\n\tPaymentErrorStatus,\n} from \"document/components/chrome/siteSettings/Plans/Stripe/api/errors/paymentError.ts\"\nimport { assertNever } from \"library/utils/assert.ts\"\nimport { useCallback, useState } from \"react\"\nimport {\n\ttype TeamSubscriptionPreviewResponse,\n\tTeamSubscriptionPreviewStatus,\n\ttype TeamSubscriptionUpdateResponse,\n\tTeamSubscriptionUpdateStatus,\n\tpreviewTeamSubscriptionUpdate,\n\tupdateTeamSubscription,\n} from \"../api/billing.ts\"\nimport type { TeamSubscriptionPreview } from \"../api/teamBillingPreview.ts\"\n\ntype SwitchToYearlyState =\n\t| { status: SwitchToYearlyStatus.Loading }\n\t| { status: SwitchToYearlyStatus.Error; error: PaymentError }\n\t| { status: SwitchToYearlyStatus.Preview | SwitchToYearlyStatus.Updating; preview: TeamSubscriptionPreview }\n\t| { status: SwitchToYearlyStatus.UpdateFailed; preview: TeamSubscriptionPreview; error: PaymentError }\n\t| { status: SwitchToYearlyStatus.UpdateSuccess }\n\nexport enum SwitchToYearlyStatus {\n\tPreview,\n\tLoading,\n\tUpdating,\n\tUpdateSuccess,\n\tError,\n\tUpdateFailed,\n}\n\nconst unhandledError: PaymentError = { status: PaymentErrorStatus.UnhandledError }\n\nexport function useSwitchToYearly({ teamId }: { teamId: string }) {\n\tconst [state, setState] = useState<SwitchToYearlyState>({\n\t\tstatus: SwitchToYearlyStatus.Loading,\n\t})\n\n\tconst handleUpdate = useCallback(async () => {\n\t\tsetState(prev => {\n\t\t\tif (prev.status !== SwitchToYearlyStatus.Preview && prev.status !== SwitchToYearlyStatus.UpdateFailed) {\n\t\t\t\treturn prev\n\t\t\t}\n\t\t\treturn { status: SwitchToYearlyStatus.Updating, preview: prev.preview }\n\t\t})\n\n\t\tconst result = await updateTeamSubscription(teamId, { period: ProjectLicensePeriod.Year })\n\t\tsetState(prev => {\n\t\t\tconst preview = \"preview\" in prev ? prev.preview : undefined\n\t\t\treturn getNextStateAfterUpdate(result, preview)\n\t\t})\n\t}, [teamId])\n\n\tconst handlePreview = useCallback(async () => {\n\t\tsetState({ status: SwitchToYearlyStatus.Loading })\n\t\tconst preview = await previewTeamSubscriptionUpdate(teamId, { period: ProjectLicensePeriod.Year })\n\t\tsetState(getNextStateAfterPreview(preview))\n\t}, [teamId])\n\n\tconst clearError = useCallback(() => {\n\t\tif (state.status === SwitchToYearlyStatus.UpdateFailed) {\n\t\t\tsetState({ status: SwitchToYearlyStatus.Preview, preview: state.preview })\n\t\t}\n\t}, [state])\n\n\treturn { state, handleUpdate, handlePreview, clearError }\n}\n\nfunction getNextStateAfterPreview(preview: TeamSubscriptionPreviewResponse): SwitchToYearlyState {\n\tswitch (preview.status) {\n\t\tcase TeamSubscriptionPreviewStatus.Success:\n\t\t\treturn { status: SwitchToYearlyStatus.Preview, preview: preview.preview }\n\t\tcase TeamSubscriptionPreviewStatus.UnauthorizedError:\n\t\t\treturn { status: SwitchToYearlyStatus.Error, error: { status: PaymentErrorStatus.Unauthorized } }\n\t\tcase TeamSubscriptionPreviewStatus.BelowCurrentEditors:\n\t\tcase TeamSubscriptionPreviewStatus.BelowCurrentContentEditors:\n\t\tcase TeamSubscriptionPreviewStatus.UnhandledError:\n\t\t\treturn { status: SwitchToYearlyStatus.Error, error: unhandledError }\n\t\tdefault:\n\t\t\tassertNever(preview)\n\t}\n}\n\nfunction getNextStateAfterUpdate(\n\tresult: TeamSubscriptionUpdateResponse,\n\tpreview: TeamSubscriptionPreview | undefined,\n): SwitchToYearlyState {\n\tswitch (result.status) {\n\t\tcase TeamSubscriptionUpdateStatus.Success:\n\t\t\treturn { status: SwitchToYearlyStatus.UpdateSuccess }\n\t\tcase TeamSubscriptionUpdateStatus.BelowCurrentEditors:\n\t\tcase TeamSubscriptionUpdateStatus.BelowCurrentContentEditors:\n\t\t\treturn { status: SwitchToYearlyStatus.Error, error: unhandledError }\n\t\tcase TeamSubscriptionUpdateStatus.PaymentError:\n\t\t\tif (result.error.status === PaymentErrorStatus.Unauthorized) {\n\t\t\t\treturn { status: SwitchToYearlyStatus.Error, error: result.error }\n\t\t\t}\n\t\t\tif (preview) {\n\t\t\t\treturn { status: SwitchToYearlyStatus.UpdateFailed, preview, error: result.error }\n\t\t\t}\n\t\t\treturn { status: SwitchToYearlyStatus.Error, error: result.error }\n\t\tdefault:\n\t\t\tassertNever(result)\n\t}\n}\n", "import { ConfirmationModal } from \"@framerjs/fresco\"\nimport { assertNever } from \"@framerjs/shared\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { ApplyPromotionCodeModal } from \"web/pages/projects/components/settings/team/components/ApplyPromotionCodeModal.tsx\"\nimport { FlexToYearlyModal } from \"web/pages/projects/components/settings/team/components/FlexToYearlyModal.tsx\"\nimport { ManageSeatsModal } from \"web/pages/projects/components/settings/team/components/ManageSeatsModal.tsx\"\nimport { MigrateBillingModal } from \"web/pages/projects/components/settings/team/components/MigrateBillingModal.tsx\"\nimport { SelectProjectToUpgradeModal } from \"web/pages/projects/components/settings/team/components/SelectProjectToUpgradeModal.tsx\"\nimport { SwitchToYearlyModal } from \"web/pages/projects/components/settings/team/components/SwitchToYearlyModal.tsx\"\nimport { useDashboardModal } from \"./DashboardModalProvider.tsx\"\n\nexport function DashboardModalRenderer() {\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\n\tconst { active, dismiss } = useDashboardModal()\n\n\tif (!active) return null\n\n\tswitch (active.type) {\n\t\tcase ModalType.ApplyPromotionCode:\n\t\t\treturn <ApplyPromotionCodeModal {...active} />\n\t\tcase ModalType.Confirmation:\n\t\t\treturn (\n\t\t\t\t<ConfirmationModal\n\t\t\t\t\t{...active}\n\t\t\t\t\tonDismiss={() => {\n\t\t\t\t\t\tactive.onDismiss?.()\n\t\t\t\t\t\tdismiss()\n\t\t\t\t\t}}\n\t\t\t\t\tlegacy={!isAgentExperimentOn}\n\t\t\t\t/>\n\t\t\t)\n\t\tcase ModalType.SelectProjectToUpgrade:\n\t\t\treturn <SelectProjectToUpgradeModal {...active} />\n\t\tcase ModalType.FlexToYearly:\n\t\t\treturn <FlexToYearlyModal {...active} />\n\t\tcase ModalType.SwitchToYearly:\n\t\t\treturn <SwitchToYearlyModal {...active} />\n\t\tcase ModalType.ManageSeats:\n\t\t\treturn <ManageSeatsModal {...active} />\n\t\tcase ModalType.MigrateBilling:\n\t\t\treturn <MigrateBillingModal {...active} />\n\t\tdefault:\n\t\t\tassertNever(active)\n\t}\n}\n", "import { assertNever } from \"@framerjs/shared\"\n\nexport const allDomainTabs = [\"overview\", \"multi-site\", \"headers\", \"redirects\", \"files\"] as const\nexport type DomainTab = (typeof allDomainTabs)[number]\n\nexport const defaultDomainTab = allDomainTabs[0]\n\nexport function isValidDomainTab(tab: string | null): tab is DomainTab {\n\treturn allDomainTabs.includes(tab as DomainTab)\n}\n\nexport function getDomainTabTitle(tab: DomainTab): string {\n\tswitch (tab) {\n\t\tcase \"overview\":\n\t\t\treturn \"Overview\"\n\t\tcase \"multi-site\":\n\t\t\treturn \"Multi Site\"\n\t\tcase \"headers\":\n\t\t\treturn \"Headers\"\n\t\tcase \"redirects\":\n\t\t\treturn \"Redirects\"\n\t\tcase \"files\":\n\t\t\treturn \"Files\"\n\t\tdefault:\n\t\t\tassertNever(tab)\n\t}\n}\n", "import { useSyncExternalStore } from \"react\"\n\ntype Unsubscribe = VoidFunction\n\nexport abstract class DashboardStore<State extends object> {\n\tprivate state: Readonly<State>\n\tprivate subscriptions: Set<VoidFunction> = new Set()\n\n\tconstructor(initialState: State) {\n\t\tthis.state = initialState\n\t}\n\n\treadonly subscribe = (callback: VoidFunction): Unsubscribe => {\n\t\tthis.subscriptions.add(callback)\n\n\t\treturn () => {\n\t\t\tthis.subscriptions.delete(callback)\n\t\t}\n\t}\n\n\treadonly getState = (): Readonly<State> => {\n\t\treturn this.state\n\t}\n\n\tprotected setState<K extends keyof State>(newState: Pick<State, K> | State): void {\n\t\tif (newState === this.state) return\n\n\t\tthis.state = { ...this.state, ...newState }\n\n\t\tthis.subscriptions.forEach(callback => callback())\n\t}\n\n\treadonly useState = () => {\n\t\treturn useSyncExternalStore(this.subscribe, this.getState)\n\t}\n}\n"],
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mBAAwB;AAQjB,SAAS,WAAW;AAC1B,QAAM,EAAE,OAAO,IAAI,YAAY;AAE/B,aAAO,sBAAQ,MAAM,IAAI,gBAAgB,MAAM,GAAG,CAAC,MAAM,CAAC;AAC3D;;;ACTA,IAAAA,iBAA2F;;;ACI3F,IAAAC,gBAAyD;AA8GtD;AAjGH,IAAM;AAEC,SAAS,wBAAwB,EAAE,WAAW,QAAQ,SAAS,UAAU,GAAiC;AAChH,QAAM,CAAC,eAAe,gBAAgB,QAAI,wBAAS,EAAE;AACrD,QAAM,CAAC,cAAc,eAAe,QAAI,wBAAS,KAAK;AACtD,QAAM,uBAAmB,sBAAmB,MAAM;AAAA,EAAC,CAAC;AAEpD,kBAAgB,iBAAiB,EAAE,KAAK,CAAC;AAEzC,QAAM,mBAAe,2BAAY,MAAM;AACtC,WAAO,kBAAkB,EAAE,MAAM,iEAA2C,CAAC;AAC7E,YAAQ;AAAA,EACT,GAAG,CAAC,OAAO,CAAC;AAEZ,QAAM,oBAAgB,2BAAY,YAAY;AAC7C,UAAMC,wBAAuB,cAAc,KAAK;AAChD,QAAI,CAACA,yBAAwB,aAAc;AAE3C,WAAO,kBAAkB,EAAE,MAAM,mEAA4C,CAAC;AAC9E,oBAAgB,IAAI;AAEpB,UAAM,SAAS,MAAM,uBAAuB;AAAA,MAC3C;AAAA,MACA,aAAa;AAAA,MACb,eAAeA;AAAA,IAChB,CA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,mBAAmB,cAAc,CAAC;AAExC,SAAS,iBAAiB,KAAsC;AACtE,SAAO,cAAc,SAAS,GAAgB;AAC/C;AAEO,SAAS,kBAAkB,KAAwB;AACzD,UAAQ,KAAK;AAAA,IACZ,KAAK;AACJ,aAAO;AAAA,IACR,KAAK;AACJ,aAAO;AAAA,IACR,KAAK;AACJ,aAAO;AAAA,IACR,KAAK;AACJ,aAAO;AAAA,IACR,KAAK;AACJ,aAAO;AAAA,IACR;AACC,kBAAY,GAAG;AAAA,EACjB;AACD;;;AC1BA,IAAAC,iBAAqC;AAI9B,IAAe,iBAAf,MAAoD;AAAA,EAI1D,YAAY,cAAqB;AAHjC,wBAAQ;AACR,wBAAQ,iBAAmC,oBAAI,IAAI;AAMnD,wBAAS,aAAY,CAAC,aAAwC;AAC7D,WAAK,cAAc,IAAI,QAAQ;AAE/B,aAAO,MAAM;AACZ,aAAK,cAAc,OAAO,QAAQ;AAAA,MACnC;AAAA,IACD;AAEA,wBAAS,YAAW,MAAuB;AAC1C,aAAO,KAAK;AAAA,IACb;AAUA,wBAAS,YAAW,MAAM;AACzB,iBAAO,qCAAqB,KAAK,WAAW,KAAK,QAAQ;AAAA,IAC1D;AAzBC,SAAK,QAAQ;AAAA,EACd;AAAA,EAcU,SAAgC,UAAwC;AACjF,QAAI,aAAa,KAAK,MAAO;AAE7B,SAAK,QAAQ,EAAE,GAAG,KAAK,OAAO,GAAG,SAAS;AAE1C,SAAK,cAAc,QAAQ,cAAY,SAAS,CAAC;AAAA,EAClD;AAKD;",
  "names": ["import_react", "import_react", "trimmedPromotionCode", "import_react", "import_react", "error", "assertNever", "import_jsx_runtime", "pluralize", "import_react", "import_react", "log", "error", "body", "log", "body", "error", "log", "body", "getNextStateAfterPreview", "error", "getNextStateAfterUpdate", "assertNever", "import_jsx_runtime", "error", "periodLabel", "import_react", "import_jsx_runtime", "body", "React", "import_react", "log", "error", "log", "import_jsx_runtime", "React", "isHovered", "import_pluralize", "import_react", "import_react", "getNextStateAfterUpdate", "getNextStateAfterPreview", "assertNever", "import_jsx_runtime", "error", "pluralize", "import_jsx_runtime", "import_jsx_runtime", "import_react"]
}
