@arbidocs/blocks 0.5.133 → 0.5.134

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,7 +28,7 @@ require('../chunk-OUYBYZ7Y.cjs');
28
28
  require('../chunk-QQMMCXBP.cjs');
29
29
  require('../chunk-DTMBAFIL.cjs');
30
30
  require('../chunk-7NJKDJVO.cjs');
31
- require('../chunk-VCEX7COE.cjs');
31
+ require('../chunk-LIDXIX36.cjs');
32
32
  require('../chunk-34HQO4ZQ.cjs');
33
33
  require('../chunk-IFJBE7M5.cjs');
34
34
  require('../chunk-K4763GD5.cjs');
@@ -30,6 +30,7 @@ function ConnectedSsoCallback() {
30
30
  const passwordRules = auth.passwordRules;
31
31
  const isProcessing = useRef(false);
32
32
  const hasCheckedStatus = useRef(false);
33
+ const [statusAttempt, setStatusAttempt] = useState(0);
33
34
  const [accessToken, setAccessToken] = useState(null);
34
35
  const [ssoStatus, setSsoStatus] = useState(null);
35
36
  const ssoName = useMemo(() => resolveSsoName(user ?? {}, ssoStatus ?? {}), [user, ssoStatus]);
@@ -215,16 +216,13 @@ function ConnectedSsoCallback() {
215
216
  setSsoStatus(response);
216
217
  } catch (error2) {
217
218
  console.error("[SSO] Error checking status:", error2);
218
- const errorMsg = error2 instanceof Error ? error2.message : "Failed to check account status";
219
- setError({ message: errorMsg });
220
- notify("Unable to verify account status", "error");
221
- navigate("/");
219
+ setError({ message: "We couldn\u2019t complete sign-in. Please try again." });
222
220
  } finally {
223
221
  setIsCheckingStatus(false);
224
222
  }
225
223
  };
226
224
  checkStatus();
227
- }, [accessToken, user, arbi, navigate, notify]);
225
+ }, [accessToken, user, arbi, statusAttempt]);
228
226
  const handlePasswordSubmit = useCallback(
229
227
  async (e) => {
230
228
  e.preventDefault();
@@ -391,6 +389,24 @@ function ConnectedSsoCallback() {
391
389
  ] })
392
390
  ] });
393
391
  }
392
+ if (error && !ssoStatus && !isCheckingStatus) {
393
+ return /* @__PURE__ */ jsxs(AuthLayout, { brand: auth.brand, corner: auth.corner, children: [
394
+ /* @__PURE__ */ jsx(AuthAlert, { testId: "sso-status-error", children: error.message }),
395
+ /* @__PURE__ */ jsx(
396
+ Button,
397
+ {
398
+ className: "mt-4 w-full",
399
+ onClick: () => {
400
+ hasCheckedStatus.current = false;
401
+ setError(null);
402
+ setStatusAttempt((attempt) => attempt + 1);
403
+ },
404
+ children: "Try again"
405
+ }
406
+ ),
407
+ /* @__PURE__ */ jsx(Button, { onClick: () => navigate("/login"), variant: "ghost", className: "w-full", children: "Cancel" })
408
+ ] });
409
+ }
394
410
  if (isCheckingStatus || !ssoStatus) {
395
411
  return /* @__PURE__ */ jsxs(AuthLayout, { brand: auth.brand, corner: auth.corner, children: [
396
412
  /* @__PURE__ */ jsxs("div", { className: "text-center py-8", "data-testid": "sso-loading", children: [
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/connection/auth/ConnectedSsoCallback.tsx"],
4
- "sourcesContent": ["/**\n * The SSO callback page (`/sso`): the provider (Auth0) signed the user in and comes back here.\n * 1. The provider's token, then the account's status for its email (`arbi.sso.status`).\n * 2. The master password, by status:\n * - `new_user`: create one (with confirmation), register, back up, sign in;\n * - `sso_exists`: enter it, sign in;\n * - `local_exists`: the existing password, which links the account to SSO.\n * 3. The provider's own messages: an account link to continue, an email to verify (with resend),\n * an email just verified, errors.\n * The site's look and follow-ups come from the host configuration's `auth`, the provider from `sso`.\n */\n\nimport { LinkedInIcon, GoogleIcon, AppleIcon, GitHubIcon, useArbi } from '@arbidocs/react'\nimport { Input, Button, ArbiIcon } from '@arbidocs/react/ui'\nimport {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type FormEvent,\n type ReactElement,\n type ReactNode,\n} from 'react'\nimport type { components } from '@arbidocs/client'\nimport { Loader2, Link as LinkIcon } from 'lucide-react'\nimport { AuthAlert, AuthField, AuthLink } from '../../auth/AuthForm'\nimport { AuthLayout } from '../../auth/AuthLayout'\nimport { AuthConsent } from '../../auth/AuthFooter'\nimport { PasswordStrengthInput } from '../../auth/PasswordStrengthInput'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { ConnectedPasswordChangeDialog } from '../ConnectedSettings'\nimport { ConnectedForgotPassword } from './ConnectedForgotPassword'\nimport { SsoResendVerificationButton } from './SsoResendVerificationButton'\nimport { resolveSsoName } from './sso-name'\nimport { completeSsoSignIn, ssoAccountStatus } from './sso-sign-in'\nimport { useAuthPages, useSsoSignIn } from './support'\n\ntype SSOStatusResponse = components['schemas']['SSOStatusResponse']\n\nconst NO_RECOVERY_KEY_WARNING =\n 'Without your password or a recovery key, we cannot recover your account or data.'\n\nexport function ConnectedSsoCallback(): ReactElement {\n const sso = useSsoSignIn()\n const { isAuthenticated, isLoading, user } = sso\n const auth = useAuthPages()\n const { notify, navigate } = useBlocksEnvironment()\n const passwordRules = auth.passwordRules\n const isProcessing = useRef(false)\n const hasCheckedStatus = useRef(false)\n\n // Auth state\n const [accessToken, setAccessToken] = useState<string | null>(null)\n const [ssoStatus, setSsoStatus] = useState<SSOStatusResponse | null>(null)\n const ssoName = useMemo(() => resolveSsoName(user ?? {}, ssoStatus ?? {}), [user, ssoStatus])\n\n // Password form state\n const [password, setPassword] = useState('')\n const [confirmPassword, setConfirmPassword] = useState('')\n const [error, setError] = useState<{ message: string } | null>(null)\n\n // Terms acceptance state (for new user registration)\n const [termsAccepted, setTermsAccepted] = useState(false)\n // Download the recovery key on signup (opt-out; unchecking shows a warning)\n const [saveRecoveryKey, setSaveRecoveryKey] = useState(true)\n\n // Dialog states for password recovery\n const [showForgotPasswordModal, setShowForgotPasswordModal] = useState(false)\n const [showChangePasswordModal, setShowChangePasswordModal] = useState(false)\n\n // Auth0 message state\n type Auth0Message = {\n message: string\n description?: string\n auth0UserId?: string\n originalProvider?: string\n state?: string\n originalProviderIcon?: ReactNode\n newProviderIcon?: ReactNode\n }\n const [auth0Message, setAuth0Message] = useState<Auth0Message | null>(null)\n const [specialAuth0State, setSpecialAuth0State] = useState<\n 'not-verified' | 'newly-verified' | 'sso-linking' | 'sso-linked' | null\n >(null)\n\n // The sign-in goes through the host's `Arbi` (the app's sign-in hooks run around it)\n const arbi = useArbi()\n\n const [isCheckingStatus, setIsCheckingStatus] = useState(false)\n const [isSubmitting, setIsSubmitting] = useState(false)\n\n // Track if we've triggered a fresh login after account linking\n const hasTriggeredPostLinkingLogin = useRef(false)\n\n // Memoized submit button disabled state\n const isSubmitDisabled = useMemo(() => {\n if (isSubmitting) return true\n // For new users, validate password strength, confirmation, and terms acceptance\n if (ssoStatus?.status === 'new_user') {\n return (\n !password ||\n !confirmPassword ||\n !passwordRules.isValid(password) ||\n password !== confirmPassword ||\n !termsAccepted\n )\n }\n // For existing users (sso_exists, local_exists), only disable during submission\n return false\n }, [isSubmitting, password, confirmPassword, ssoStatus?.status, termsAccepted, passwordRules])\n\n // Auth0 Account Linking\n const handleAccountLinking = useCallback((urlParams: URLSearchParams) => {\n const state = urlParams.get('state')\n const email = urlParams.get('email')\n const newProvider = urlParams.get('new_provider')\n const originalProvider = urlParams.get('original_provider')\n\n if (!state || !email || !newProvider || !originalProvider) {\n return\n }\n const prettyProvider = (provider: string) => {\n const prettyProviderMap = {\n 'google-oauth2': 'Google',\n apple: 'Apple',\n linkedin: 'LinkedIn',\n github: 'GitHub',\n auth0: 'SSO username/password',\n }\n if (provider in prettyProviderMap) {\n return prettyProviderMap[provider as keyof typeof prettyProviderMap]\n }\n return provider\n }\n\n const getProviderIcon = (provider: string): ReactNode => {\n switch (provider) {\n case 'linkedin':\n return <LinkedInIcon size={20} aria-label=\"LinkedIn\" aria-hidden={false} />\n case 'google-oauth2':\n return <GoogleIcon size={20} aria-label=\"Google\" aria-hidden={false} />\n case 'apple':\n return <AppleIcon size={20} aria-label=\"Apple\" aria-hidden={false} />\n case 'github':\n return <GitHubIcon size={20} aria-label=\"GitHub\" aria-hidden={false} />\n default:\n return <ArbiIcon size={20} aria-label=\"ARBI Docs\" aria-hidden={false} />\n }\n }\n\n setSpecialAuth0State('sso-linking')\n setAuth0Message({\n message: 'Linking SSO accounts',\n description: `Your ${prettyProvider(newProvider)} login for ${email} will be linked with your previous method (${prettyProvider(originalProvider)}). Please verify your ${prettyProvider(originalProvider)} login to complete the process.`,\n originalProvider: prettyProvider(originalProvider ?? ''),\n state,\n originalProviderIcon: getProviderIcon(originalProvider),\n newProviderIcon: getProviderIcon(newProvider),\n })\n }, [])\n\n // Handle post-linking callback: trigger loginWithRedirect to refresh authentication state\n const handlePostLinking = useCallback(() => {\n const urlParams = new URLSearchParams(window.location.search)\n\n // If this is a post-linking callback and we haven't triggered a fresh login yet\n if (!hasTriggeredPostLinkingLogin.current) {\n hasTriggeredPostLinkingLogin.current = true\n\n // Clear the post_linking param from URL to avoid loops\n urlParams.delete('post_linking')\n const newUrl = `${window.location.pathname}${urlParams.toString() ? '?' + urlParams.toString() : ''}`\n window.history.replaceState({}, '', newUrl)\n\n // Trigger a fresh loginWithRedirect - this will create a new transaction\n // and the callback will have matching transaction state\n sso.signIn({ redirectUri: `${window.location.origin}/sso` }).catch((error) => {\n console.error('[SSO] Error during post-linking:', error)\n })\n return\n }\n }, [sso])\n\n // Auth0 Email Verification Success\n const handleEmailVerificationSuccess = useCallback(() => {\n setAuth0Message({\n message: 'Success!',\n description: 'Your email has been verified.',\n })\n setSpecialAuth0State('newly-verified')\n }, [setAuth0Message, setSpecialAuth0State])\n\n const handleAuth0Message = useCallback(\n (auth0Message: string) => {\n setAuth0Message({\n message: 'Error',\n description: auth0Message,\n })\n },\n [setAuth0Message]\n )\n\n // Auth0 Message or Error\n const handleAuth0Error = useCallback(\n (auth0Error: string, auth0ErrorDescription: string) => {\n console.error('[SSO] Auth0 error:', auth0Error, auth0ErrorDescription)\n\n // Handle email_not_verified error\n if (\n (auth0Error === 'access_denied' && // ? comes from api.access.denied in Auth0 Action\n auth0ErrorDescription.startsWith('Email not verified')) ||\n auth0Error === 'email_not_verified' // ? comes from redirect in Auth0 Action\n ) {\n const auth0UserId = auth0ErrorDescription.split('(')[1].split(')')[0]\n setAuth0Message({\n message: 'Please verify your email',\n description:\n 'Your email is not verified. Please check your inbox for a verification message from us to get started.',\n auth0UserId,\n })\n setSpecialAuth0State('not-verified')\n return\n }\n\n // Other Auth0 errors\n const message =\n auth0Error.replace('_', ' ').charAt(0).toUpperCase() + auth0Error.replace('_', ' ').slice(1)\n setAuth0Message({\n message,\n description: auth0ErrorDescription,\n })\n },\n [setAuth0Message, setSpecialAuth0State]\n )\n\n // Handle Auth0 callback messages (account linking, email verification success/failure, and other errors)\n useEffect(() => {\n const urlParams = new URLSearchParams(window.location.search)\n const auth0AccountLinking = urlParams.get('account_linking')\n const auth0PostLinking = urlParams.get('post_linking')\n const auth0Code = urlParams.get('code')\n const auth0Success = urlParams.get('success')\n const auth0Message = urlParams.get('message')\n const auth0Error = urlParams.get('error')\n const auth0ErrorDescription = urlParams.get('error_description') || ''\n\n if (auth0AccountLinking === 'true') {\n handleAccountLinking(urlParams)\n } else if (auth0PostLinking === 'true') {\n handlePostLinking()\n } else if (auth0Code === 'success' && auth0Success === 'true') {\n handleEmailVerificationSuccess()\n } else if (auth0Message && auth0Success === 'false') {\n handleAuth0Message(auth0Message)\n } else if (auth0Error) {\n handleAuth0Error(auth0Error, auth0ErrorDescription)\n }\n }, [\n handleAccountLinking,\n handlePostLinking,\n handleEmailVerificationSuccess,\n handleAuth0Message,\n handleAuth0Error,\n ])\n\n // Fetch Auth0 access token\n useEffect(() => {\n const fetchAccessToken = async () => {\n if (isLoading) {\n console.debug('[SSO] Auth0 is processing callback, waiting...')\n return\n }\n\n if (!isAuthenticated) {\n console.debug('[SSO] User not authenticated with Auth0 yet, waiting...')\n return\n }\n\n console.info('[SSO] User authenticated with Auth0, getting access token...')\n const token = await sso.getToken()\n if (token) {\n console.info('[SSO] Successfully retrieved Auth0 token')\n setAccessToken(token)\n return\n }\n console.error('[SSO] Error getting access token')\n setError({ message: 'Error getting access token' })\n notify('Failed to get authentication token', 'error')\n navigate('/')\n }\n\n fetchAccessToken()\n }, [isAuthenticated, sso, navigate, isLoading, notify])\n\n // Check SSO status once we have the token\n useEffect(() => {\n const checkStatus = async () => {\n if (!accessToken || !user?.email || hasCheckedStatus.current) {\n return\n }\n\n hasCheckedStatus.current = true\n setError(null)\n setIsCheckingStatus(true)\n\n try {\n console.info('[SSO] Checking user status...')\n const response = await ssoAccountStatus(arbi, accessToken, user)\n console.info('[SSO] User status:', response.status)\n setSsoStatus(response)\n } catch (error) {\n console.error('[SSO] Error checking status:', error)\n const errorMsg = error instanceof Error ? error.message : 'Failed to check account status'\n setError({ message: errorMsg })\n notify('Unable to verify account status', 'error')\n navigate('/')\n } finally {\n setIsCheckingStatus(false)\n }\n }\n\n checkStatus()\n }, [accessToken, user, arbi, navigate, notify])\n\n // Handle password form submission\n const handlePasswordSubmit = useCallback(\n async (e: FormEvent) => {\n e.preventDefault()\n\n if (isProcessing.current || !accessToken || !user?.email || !ssoStatus) {\n return\n }\n\n // Validation\n if (!password) {\n setError({ message: 'Please enter a password' })\n return\n }\n\n if (ssoStatus.status === 'new_user') {\n if (!confirmPassword) {\n setError({ message: 'Please confirm your password' })\n return\n }\n if (password !== confirmPassword) {\n setError({ message: 'Passwords do not match' })\n return\n }\n\n // Validate password requirements\n const passwordError = passwordRules.error(password)\n if (passwordError) {\n setError({ message: passwordError })\n return\n }\n }\n\n isProcessing.current = true\n setIsSubmitting(true)\n setError(null)\n\n try {\n const { login, registered, linked } = await completeSsoSignIn(arbi, {\n token: accessToken,\n user,\n status: ssoStatus,\n password,\n saveRecoveryKey,\n })\n // Where a fresh registration lands is the site's (its first landing); the site also\n // navigates on the sign-in itself \u2014 no navigate() here, see below.\n if (registered && login) {\n auth.onRegistered?.(login)\n return\n }\n\n // Welcome notification is shown from WebSocket auth handler (includes new message count)\n\n if (linked) {\n notify('Your local account has been linked to SSO', 'success')\n }\n\n // No navigate() here \u2014 App.tsx's post-auth effect is the sole\n // navigator for a successful login (it fires on the same\n // isArbiAuthenticated flip, reliably before this async handler\n // resumes from its trailing awaits; a second navigate() here used\n // to run after it and silently overwrite its correct destination).\n } catch (err) {\n console.error('[SSO] Error during authentication:', err)\n const apiError = err as { detail?: string }\n setError({ message: apiError.detail || 'Authentication failed' })\n } finally {\n isProcessing.current = false\n setIsSubmitting(false)\n }\n },\n [\n accessToken,\n user,\n ssoStatus,\n password,\n confirmPassword,\n saveRecoveryKey,\n arbi,\n auth,\n notify,\n passwordRules,\n ]\n )\n\n // Handle cancel - logout from Auth0 which redirects to their logout endpoint\n const handleCancel = () => {\n console.info('[SSO] User canceled, logging out from Auth0')\n\n // Call Auth0 logout immediately - this redirects to Auth0's server to clear the session\n // Local cleanup happens when user returns to /login\n sso.signOut({ returnTo: window.location.origin + '/login' })\n }\n\n // Handle recovery success - open change password dialog in recovery mode\n const handleRecoverySuccess = () => {\n setShowForgotPasswordModal(false)\n setShowChangePasswordModal(true)\n }\n\n // Get appropriate UI text based on status\n const getTitle = () => {\n if (!ssoStatus) {\n if (auth0Message && auth0Message.message) {\n return auth0Message.message\n }\n return 'Completing Authentication...'\n }\n switch (ssoStatus.status) {\n case 'new_user':\n return 'Create a password to encrypt your data'\n case 'sso_exists':\n return 'Enter Master Password'\n case 'local_exists':\n return 'Link Your Account'\n default:\n return 'Complete Authentication'\n }\n }\n\n const getDescription = () => {\n if (!ssoStatus) {\n if (auth0Message && auth0Message.description) {\n return auth0Message.description\n }\n return ''\n }\n switch (ssoStatus.status) {\n case 'new_user':\n return ''\n case 'sso_exists':\n return 'Enter your master password to unlock your workspace.'\n case 'local_exists':\n return 'Enter your existing password to link your account. After linking, use Arbicity sign-in and your master password; email and password alone will no longer work.'\n default:\n return ''\n }\n }\n\n if (\n (auth0Message && !ssoStatus && !isCheckingStatus) ||\n (auth0Message && specialAuth0State === 'sso-linking')\n ) {\n const buttonText =\n specialAuth0State === 'newly-verified'\n ? 'Continue'\n : specialAuth0State === 'sso-linking'\n ? 'Continue'\n : 'Return to ARBI Docs'\n const buttonOnClick =\n specialAuth0State === 'newly-verified'\n ? () => void sso.signIn({ redirectUri: `${window.location.origin}/sso` })\n : specialAuth0State === 'sso-linking'\n ? () => {\n if (sso.continueUrl && auth0Message.state) {\n window.location.href = sso.continueUrl('link', auth0Message.state)\n }\n }\n : () => navigate('/')\n return (\n <AuthLayout brand={auth.brand} corner={auth.corner}>\n <div className=\"text-center py-8\" data-testid=\"auth0-message\">\n <h2 className=\"text-lg font-semibold text-foreground mb-2\">{getTitle()}</h2>\n <p className=\"text-sm text-muted-foreground\">{getDescription()}</p>\n {specialAuth0State === 'not-verified' && auth0Message.auth0UserId && (\n <SsoResendVerificationButton providerUserId={auth0Message.auth0UserId} />\n )}\n </div>\n <div className=\"mt-6 text-center space-y-2\">\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={buttonOnClick}\n disabled={isSubmitting}\n className=\"w-full flex items-center justify-center gap-2\"\n data-testid=\"auth0-continue-button\"\n aria-label={\n auth0Message.originalProviderIcon && auth0Message.newProviderIcon\n ? `${buttonText} with original provider and new provider`\n : buttonText\n }\n >\n {buttonText}\n {auth0Message.originalProviderIcon && auth0Message.newProviderIcon && (\n <span className=\"ml-2 flex items-center gap-1\">\n {auth0Message.originalProviderIcon}\n <LinkIcon className=\"h-4 w-4\" aria-hidden=\"true\" />\n {auth0Message.newProviderIcon}\n </span>\n )}\n </Button>\n {specialAuth0State === 'sso-linking' && (\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => {\n if (sso.continueUrl && auth0Message.state) {\n window.location.href = sso.continueUrl('cancel', auth0Message.state)\n }\n }}\n disabled={isSubmitting}\n className=\"w-full flex items-center justify-center gap-2\"\n data-testid=\"auth0-cancel-button\"\n aria-label={\n auth0Message.originalProviderIcon ? `Cancel and use original provider` : 'Cancel'\n }\n >\n Cancel and use {auth0Message.originalProviderIcon}\n </Button>\n )}\n </div>\n </AuthLayout>\n )\n }\n\n // Show loading state while checking status\n if (isCheckingStatus || !ssoStatus) {\n return (\n <AuthLayout brand={auth.brand} corner={auth.corner}>\n <div className=\"text-center py-8\" data-testid=\"sso-loading\">\n <Loader2 className=\"h-8 w-8 animate-spin mx-auto mb-4\" />\n <p className=\"text-sm text-muted-foreground\">Completing authentication...</p>\n </div>\n <Button onClick={() => navigate('/login')} variant=\"ghost\" className=\"w-full text-sm\">\n Cancel\n </Button>\n </AuthLayout>\n )\n }\n\n // Show password form\n return (\n <AuthLayout brand={auth.brand} corner={auth.corner}>\n <div className=\"pt-3\" data-testid=\"sso-password-form\">\n <div className=\"mb-6 text-center\">\n <h2 className=\"text-lg font-semibold text-foreground\">{getTitle()}</h2>\n {getDescription() && (\n <p className=\"mt-2 text-sm text-muted-foreground\">{getDescription()}</p>\n )}\n </div>\n\n <form onSubmit={handlePasswordSubmit} className=\"space-y-4\">\n <AuthField htmlFor=\"email\" label=\"Email\">\n <Input\n type=\"email\"\n id=\"email\"\n name=\"email\"\n value={user?.email || ''}\n disabled\n autoComplete=\"email\"\n className=\"bg-muted cursor-not-allowed\"\n data-testid=\"sso-email-display\"\n />\n </AuthField>\n\n {ssoStatus.status === 'new_user' ? (\n <>\n <div className=\"flex gap-4\">\n <AuthField htmlFor=\"firstName\" label=\"First Name\" className=\"flex-1\">\n <Input\n type=\"text\"\n id=\"firstName\"\n name=\"firstName\"\n value={ssoName.given_name}\n disabled\n autoComplete=\"given-name\"\n className=\"bg-muted cursor-not-allowed\"\n data-testid=\"sso-firstname-display\"\n />\n </AuthField>\n <AuthField htmlFor=\"lastName\" label=\"Last Name\" className=\"flex-1\">\n <Input\n type=\"text\"\n id=\"lastName\"\n name=\"lastName\"\n value={ssoName.family_name}\n disabled\n autoComplete=\"family-name\"\n className=\"bg-muted cursor-not-allowed\"\n data-testid=\"sso-lastname-display\"\n />\n </AuthField>\n </div>\n <PasswordStrengthInput\n password={password}\n confirmPassword={confirmPassword}\n onPasswordChange={setPassword}\n onConfirmPasswordChange={setConfirmPassword}\n showConfirmation={true}\n passwordLabel=\"Master Password\"\n confirmLabel=\"Confirm Password\"\n layout=\"side-by-side\"\n showStrengthIndicator={true}\n getUnmetRequirement={passwordRules.unmet}\n />\n </>\n ) : (\n <AuthField htmlFor=\"password\" label=\"Password\" required>\n <Input\n type=\"password\"\n id=\"password\"\n name=\"password\"\n placeholder=\"\"\n value={password}\n onChange={(e) => setPassword(e.target.value)}\n disabled={isSubmitting}\n autoFocus\n autoComplete=\"current-password\"\n required\n className=\"placeholder:text-muted-foreground/40\"\n data-testid=\"sso-password-input\"\n />\n {ssoStatus?.status === 'sso_exists' && (\n <AuthLink\n onClick={() => setShowForgotPasswordModal(true)}\n className=\"mt-2\"\n data-testid=\"sso-forgot-password-link\"\n >\n Forgot your password?\n </AuthLink>\n )}\n </AuthField>\n )}\n\n {error && <AuthAlert testId=\"sso-error-message\">{error.message}</AuthAlert>}\n\n {/* Terms Checkbox (for new user registration, above submit button) */}\n {ssoStatus.status === 'new_user' && (\n <AuthConsent\n termsAccepted={termsAccepted}\n onTermsAcceptedChange={setTermsAccepted}\n saveRecoveryKey={saveRecoveryKey}\n onSaveRecoveryKeyChange={setSaveRecoveryKey}\n termsLink={auth.consent?.termsLink ?? { href: '#', label: 'Terms of Use' }}\n privacyLink={auth.consent?.privacyLink ?? { href: '#', label: 'Privacy Policy' }}\n noRecoveryKeyWarning={auth.consent?.noRecoveryKeyWarning ?? NO_RECOVERY_KEY_WARNING}\n />\n )}\n\n <div className=\"space-y-2\">\n <Button\n type=\"submit\"\n className=\"w-full\"\n disabled={isSubmitDisabled}\n data-testid=\"sso-submit-button\"\n >\n {isSubmitting ? (\n <>\n <Loader2 className=\"mr-2 h-4 w-4 animate-spin\" />\n Submitting...\n </>\n ) : (\n 'Submit'\n )}\n </Button>\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={handleCancel}\n disabled={isSubmitting}\n className=\"w-full\"\n data-testid=\"sso-cancel-button\"\n >\n Reset\n </Button>\n </div>\n </form>\n\n {/* Footer (links only for existing users, checkbox is inside form for new users) */}\n {ssoStatus.status !== 'new_user' && auth.footer}\n </div>\n {/* Forgot Password Modal */}\n <ConnectedForgotPassword\n open={showForgotPasswordModal}\n onOpenChange={setShowForgotPasswordModal}\n onRecovered={handleRecoverySuccess}\n />\n\n {/* Change Password Dialog (Recovery Mode) */}\n <ConnectedPasswordChangeDialog\n open={showChangePasswordModal}\n onClose={() => setShowChangePasswordModal(false)}\n recoveryMode\n />\n </AuthLayout>\n )\n}\n"],
5
- "mappings": ";AA2IiB,SA2bL,UA3bK,KA4VT,YA5VS;AA/HjB,SAAS,cAAc,YAAY,WAAW,YAAY,eAAe;AACzE,SAAS,OAAO,QAAQ,gBAAgB;AACxC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AAEP,SAAS,SAAS,QAAQ,gBAAgB;AAC1C,SAAS,WAAW,WAAW,gBAAgB;AAC/C,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAC5B,SAAS,6BAA6B;AACtC,SAAS,4BAA4B;AACrC,SAAS,qCAAqC;AAC9C,SAAS,+BAA+B;AACxC,SAAS,mCAAmC;AAC5C,SAAS,sBAAsB;AAC/B,SAAS,mBAAmB,wBAAwB;AACpD,SAAS,cAAc,oBAAoB;AAI3C,MAAM,0BACJ;AAEK,SAAS,uBAAqC;AACnD,QAAM,MAAM,aAAa;AACzB,QAAM,EAAE,iBAAiB,WAAW,KAAK,IAAI;AAC7C,QAAM,OAAO,aAAa;AAC1B,QAAM,EAAE,QAAQ,SAAS,IAAI,qBAAqB;AAClD,QAAM,gBAAgB,KAAK;AAC3B,QAAM,eAAe,OAAO,KAAK;AACjC,QAAM,mBAAmB,OAAO,KAAK;AAGrC,QAAM,CAAC,aAAa,cAAc,IAAI,SAAwB,IAAI;AAClE,QAAM,CAAC,WAAW,YAAY,IAAI,SAAmC,IAAI;AACzE,QAAM,UAAU,QAAQ,MAAM,eAAe,QAAQ,CAAC,GAAG,aAAa,CAAC,C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AGA;AAAA,MAAC;AAAA;AAAA,QACC,MAAM;AAAA,QACN,SAAS,MAAM,2BAA2B,KAAK;AAAA,QAC/C,cAAY;AAAA;AAAA,IACd;AAAA,KACF;AAEJ;",
4
+ "sourcesContent": ["/**\n * The SSO callback page (`/sso`): the provider (Auth0) signed the user in and comes back here.\n * 1. The provider's token, then the account's status for its email (`arbi.sso.status`).\n * 2. The master password, by status:\n * - `new_user`: create one (with confirmation), register, back up, sign in;\n * - `sso_exists`: enter it, sign in;\n * - `local_exists`: the existing password, which links the account to SSO.\n * 3. The provider's own messages: an account link to continue, an email to verify (with resend),\n * an email just verified, errors.\n * The site's look and follow-ups come from the host configuration's `auth`, the provider from `sso`.\n */\n\nimport { LinkedInIcon, GoogleIcon, AppleIcon, GitHubIcon, useArbi } from '@arbidocs/react'\nimport { Input, Button, ArbiIcon } from '@arbidocs/react/ui'\nimport {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type FormEvent,\n type ReactElement,\n type ReactNode,\n} from 'react'\nimport type { components } from '@arbidocs/client'\nimport { Loader2, Link as LinkIcon } from 'lucide-react'\nimport { AuthAlert, AuthField, AuthLink } from '../../auth/AuthForm'\nimport { AuthLayout } from '../../auth/AuthLayout'\nimport { AuthConsent } from '../../auth/AuthFooter'\nimport { PasswordStrengthInput } from '../../auth/PasswordStrengthInput'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { ConnectedPasswordChangeDialog } from '../ConnectedSettings'\nimport { ConnectedForgotPassword } from './ConnectedForgotPassword'\nimport { SsoResendVerificationButton } from './SsoResendVerificationButton'\nimport { resolveSsoName } from './sso-name'\nimport { completeSsoSignIn, ssoAccountStatus } from './sso-sign-in'\nimport { useAuthPages, useSsoSignIn } from './support'\n\ntype SSOStatusResponse = components['schemas']['SSOStatusResponse']\n\nconst NO_RECOVERY_KEY_WARNING =\n 'Without your password or a recovery key, we cannot recover your account or data.'\n\nexport function ConnectedSsoCallback(): ReactElement {\n const sso = useSsoSignIn()\n const { isAuthenticated, isLoading, user } = sso\n const auth = useAuthPages()\n const { notify, navigate } = useBlocksEnvironment()\n const passwordRules = auth.passwordRules\n const isProcessing = useRef(false)\n const hasCheckedStatus = useRef(false)\n const [statusAttempt, setStatusAttempt] = useState(0)\n\n // Auth state\n const [accessToken, setAccessToken] = useState<string | null>(null)\n const [ssoStatus, setSsoStatus] = useState<SSOStatusResponse | null>(null)\n const ssoName = useMemo(() => resolveSsoName(user ?? {}, ssoStatus ?? {}), [user, ssoStatus])\n\n // Password form state\n const [password, setPassword] = useState('')\n const [confirmPassword, setConfirmPassword] = useState('')\n const [error, setError] = useState<{ message: string } | null>(null)\n\n // Terms acceptance state (for new user registration)\n const [termsAccepted, setTermsAccepted] = useState(false)\n // Download the recovery key on signup (opt-out; unchecking shows a warning)\n const [saveRecoveryKey, setSaveRecoveryKey] = useState(true)\n\n // Dialog states for password recovery\n const [showForgotPasswordModal, setShowForgotPasswordModal] = useState(false)\n const [showChangePasswordModal, setShowChangePasswordModal] = useState(false)\n\n // Auth0 message state\n type Auth0Message = {\n message: string\n description?: string\n auth0UserId?: string\n originalProvider?: string\n state?: string\n originalProviderIcon?: ReactNode\n newProviderIcon?: ReactNode\n }\n const [auth0Message, setAuth0Message] = useState<Auth0Message | null>(null)\n const [specialAuth0State, setSpecialAuth0State] = useState<\n 'not-verified' | 'newly-verified' | 'sso-linking' | 'sso-linked' | null\n >(null)\n\n // The sign-in goes through the host's `Arbi` (the app's sign-in hooks run around it)\n const arbi = useArbi()\n\n const [isCheckingStatus, setIsCheckingStatus] = useState(false)\n const [isSubmitting, setIsSubmitting] = useState(false)\n\n // Track if we've triggered a fresh login after account linking\n const hasTriggeredPostLinkingLogin = useRef(false)\n\n // Memoized submit button disabled state\n const isSubmitDisabled = useMemo(() => {\n if (isSubmitting) return true\n // For new users, validate password strength, confirmation, and terms acceptance\n if (ssoStatus?.status === 'new_user') {\n return (\n !password ||\n !confirmPassword ||\n !passwordRules.isValid(password) ||\n password !== confirmPassword ||\n !termsAccepted\n )\n }\n // For existing users (sso_exists, local_exists), only disable during submission\n return false\n }, [isSubmitting, password, confirmPassword, ssoStatus?.status, termsAccepted, passwordRules])\n\n // Auth0 Account Linking\n const handleAccountLinking = useCallback((urlParams: URLSearchParams) => {\n const state = urlParams.get('state')\n const email = urlParams.get('email')\n const newProvider = urlParams.get('new_provider')\n const originalProvider = urlParams.get('original_provider')\n\n if (!state || !email || !newProvider || !originalProvider) {\n return\n }\n const prettyProvider = (provider: string) => {\n const prettyProviderMap = {\n 'google-oauth2': 'Google',\n apple: 'Apple',\n linkedin: 'LinkedIn',\n github: 'GitHub',\n auth0: 'SSO username/password',\n }\n if (provider in prettyProviderMap) {\n return prettyProviderMap[provider as keyof typeof prettyProviderMap]\n }\n return provider\n }\n\n const getProviderIcon = (provider: string): ReactNode => {\n switch (provider) {\n case 'linkedin':\n return <LinkedInIcon size={20} aria-label=\"LinkedIn\" aria-hidden={false} />\n case 'google-oauth2':\n return <GoogleIcon size={20} aria-label=\"Google\" aria-hidden={false} />\n case 'apple':\n return <AppleIcon size={20} aria-label=\"Apple\" aria-hidden={false} />\n case 'github':\n return <GitHubIcon size={20} aria-label=\"GitHub\" aria-hidden={false} />\n default:\n return <ArbiIcon size={20} aria-label=\"ARBI Docs\" aria-hidden={false} />\n }\n }\n\n setSpecialAuth0State('sso-linking')\n setAuth0Message({\n message: 'Linking SSO accounts',\n description: `Your ${prettyProvider(newProvider)} login for ${email} will be linked with your previous method (${prettyProvider(originalProvider)}). Please verify your ${prettyProvider(originalProvider)} login to complete the process.`,\n originalProvider: prettyProvider(originalProvider ?? ''),\n state,\n originalProviderIcon: getProviderIcon(originalProvider),\n newProviderIcon: getProviderIcon(newProvider),\n })\n }, [])\n\n // Handle post-linking callback: trigger loginWithRedirect to refresh authentication state\n const handlePostLinking = useCallback(() => {\n const urlParams = new URLSearchParams(window.location.search)\n\n // If this is a post-linking callback and we haven't triggered a fresh login yet\n if (!hasTriggeredPostLinkingLogin.current) {\n hasTriggeredPostLinkingLogin.current = true\n\n // Clear the post_linking param from URL to avoid loops\n urlParams.delete('post_linking')\n const newUrl = `${window.location.pathname}${urlParams.toString() ? '?' + urlParams.toString() : ''}`\n window.history.replaceState({}, '', newUrl)\n\n // Trigger a fresh loginWithRedirect - this will create a new transaction\n // and the callback will have matching transaction state\n sso.signIn({ redirectUri: `${window.location.origin}/sso` }).catch((error) => {\n console.error('[SSO] Error during post-linking:', error)\n })\n return\n }\n }, [sso])\n\n // Auth0 Email Verification Success\n const handleEmailVerificationSuccess = useCallback(() => {\n setAuth0Message({\n message: 'Success!',\n description: 'Your email has been verified.',\n })\n setSpecialAuth0State('newly-verified')\n }, [setAuth0Message, setSpecialAuth0State])\n\n const handleAuth0Message = useCallback(\n (auth0Message: string) => {\n setAuth0Message({\n message: 'Error',\n description: auth0Message,\n })\n },\n [setAuth0Message]\n )\n\n // Auth0 Message or Error\n const handleAuth0Error = useCallback(\n (auth0Error: string, auth0ErrorDescription: string) => {\n console.error('[SSO] Auth0 error:', auth0Error, auth0ErrorDescription)\n\n // Handle email_not_verified error\n if (\n (auth0Error === 'access_denied' && // ? comes from api.access.denied in Auth0 Action\n auth0ErrorDescription.startsWith('Email not verified')) ||\n auth0Error === 'email_not_verified' // ? comes from redirect in Auth0 Action\n ) {\n const auth0UserId = auth0ErrorDescription.split('(')[1].split(')')[0]\n setAuth0Message({\n message: 'Please verify your email',\n description:\n 'Your email is not verified. Please check your inbox for a verification message from us to get started.',\n auth0UserId,\n })\n setSpecialAuth0State('not-verified')\n return\n }\n\n // Other Auth0 errors\n const message =\n auth0Error.replace('_', ' ').charAt(0).toUpperCase() + auth0Error.replace('_', ' ').slice(1)\n setAuth0Message({\n message,\n description: auth0ErrorDescription,\n })\n },\n [setAuth0Message, setSpecialAuth0State]\n )\n\n // Handle Auth0 callback messages (account linking, email verification success/failure, and other errors)\n useEffect(() => {\n const urlParams = new URLSearchParams(window.location.search)\n const auth0AccountLinking = urlParams.get('account_linking')\n const auth0PostLinking = urlParams.get('post_linking')\n const auth0Code = urlParams.get('code')\n const auth0Success = urlParams.get('success')\n const auth0Message = urlParams.get('message')\n const auth0Error = urlParams.get('error')\n const auth0ErrorDescription = urlParams.get('error_description') || ''\n\n if (auth0AccountLinking === 'true') {\n handleAccountLinking(urlParams)\n } else if (auth0PostLinking === 'true') {\n handlePostLinking()\n } else if (auth0Code === 'success' && auth0Success === 'true') {\n handleEmailVerificationSuccess()\n } else if (auth0Message && auth0Success === 'false') {\n handleAuth0Message(auth0Message)\n } else if (auth0Error) {\n handleAuth0Error(auth0Error, auth0ErrorDescription)\n }\n }, [\n handleAccountLinking,\n handlePostLinking,\n handleEmailVerificationSuccess,\n handleAuth0Message,\n handleAuth0Error,\n ])\n\n // Fetch Auth0 access token\n useEffect(() => {\n const fetchAccessToken = async () => {\n if (isLoading) {\n console.debug('[SSO] Auth0 is processing callback, waiting...')\n return\n }\n\n if (!isAuthenticated) {\n console.debug('[SSO] User not authenticated with Auth0 yet, waiting...')\n return\n }\n\n console.info('[SSO] User authenticated with Auth0, getting access token...')\n const token = await sso.getToken()\n if (token) {\n console.info('[SSO] Successfully retrieved Auth0 token')\n setAccessToken(token)\n return\n }\n console.error('[SSO] Error getting access token')\n setError({ message: 'Error getting access token' })\n notify('Failed to get authentication token', 'error')\n navigate('/')\n }\n\n fetchAccessToken()\n }, [isAuthenticated, sso, navigate, isLoading, notify])\n\n // Check SSO status once we have the token\n useEffect(() => {\n const checkStatus = async () => {\n if (!accessToken || !user?.email || hasCheckedStatus.current) {\n return\n }\n\n hasCheckedStatus.current = true\n setError(null)\n setIsCheckingStatus(true)\n\n try {\n console.info('[SSO] Checking user status...')\n const response = await ssoAccountStatus(arbi, accessToken, user)\n console.info('[SSO] User status:', response.status)\n setSsoStatus(response)\n } catch (error) {\n console.error('[SSO] Error checking status:', error)\n setError({ message: 'We couldn\u2019t complete sign-in. Please try again.' })\n } finally {\n setIsCheckingStatus(false)\n }\n }\n\n checkStatus()\n }, [accessToken, user, arbi, statusAttempt])\n\n // Handle password form submission\n const handlePasswordSubmit = useCallback(\n async (e: FormEvent) => {\n e.preventDefault()\n\n if (isProcessing.current || !accessToken || !user?.email || !ssoStatus) {\n return\n }\n\n // Validation\n if (!password) {\n setError({ message: 'Please enter a password' })\n return\n }\n\n if (ssoStatus.status === 'new_user') {\n if (!confirmPassword) {\n setError({ message: 'Please confirm your password' })\n return\n }\n if (password !== confirmPassword) {\n setError({ message: 'Passwords do not match' })\n return\n }\n\n // Validate password requirements\n const passwordError = passwordRules.error(password)\n if (passwordError) {\n setError({ message: passwordError })\n return\n }\n }\n\n isProcessing.current = true\n setIsSubmitting(true)\n setError(null)\n\n try {\n const { login, registered, linked } = await completeSsoSignIn(arbi, {\n token: accessToken,\n user,\n status: ssoStatus,\n password,\n saveRecoveryKey,\n })\n // Where a fresh registration lands is the site's (its first landing); the site also\n // navigates on the sign-in itself \u2014 no navigate() here, see below.\n if (registered && login) {\n auth.onRegistered?.(login)\n return\n }\n\n // Welcome notification is shown from WebSocket auth handler (includes new message count)\n\n if (linked) {\n notify('Your local account has been linked to SSO', 'success')\n }\n\n // No navigate() here \u2014 App.tsx's post-auth effect is the sole\n // navigator for a successful login (it fires on the same\n // isArbiAuthenticated flip, reliably before this async handler\n // resumes from its trailing awaits; a second navigate() here used\n // to run after it and silently overwrite its correct destination).\n } catch (err) {\n console.error('[SSO] Error during authentication:', err)\n const apiError = err as { detail?: string }\n setError({ message: apiError.detail || 'Authentication failed' })\n } finally {\n isProcessing.current = false\n setIsSubmitting(false)\n }\n },\n [\n accessToken,\n user,\n ssoStatus,\n password,\n confirmPassword,\n saveRecoveryKey,\n arbi,\n auth,\n notify,\n passwordRules,\n ]\n )\n\n // Handle cancel - logout from Auth0 which redirects to their logout endpoint\n const handleCancel = () => {\n console.info('[SSO] User canceled, logging out from Auth0')\n\n // Call Auth0 logout immediately - this redirects to Auth0's server to clear the session\n // Local cleanup happens when user returns to /login\n sso.signOut({ returnTo: window.location.origin + '/login' })\n }\n\n // Handle recovery success - open change password dialog in recovery mode\n const handleRecoverySuccess = () => {\n setShowForgotPasswordModal(false)\n setShowChangePasswordModal(true)\n }\n\n // Get appropriate UI text based on status\n const getTitle = () => {\n if (!ssoStatus) {\n if (auth0Message && auth0Message.message) {\n return auth0Message.message\n }\n return 'Completing Authentication...'\n }\n switch (ssoStatus.status) {\n case 'new_user':\n return 'Create a password to encrypt your data'\n case 'sso_exists':\n return 'Enter Master Password'\n case 'local_exists':\n return 'Link Your Account'\n default:\n return 'Complete Authentication'\n }\n }\n\n const getDescription = () => {\n if (!ssoStatus) {\n if (auth0Message && auth0Message.description) {\n return auth0Message.description\n }\n return ''\n }\n switch (ssoStatus.status) {\n case 'new_user':\n return ''\n case 'sso_exists':\n return 'Enter your master password to unlock your workspace.'\n case 'local_exists':\n return 'Enter your existing password to link your account. After linking, use Arbicity sign-in and your master password; email and password alone will no longer work.'\n default:\n return ''\n }\n }\n\n if (\n (auth0Message && !ssoStatus && !isCheckingStatus) ||\n (auth0Message && specialAuth0State === 'sso-linking')\n ) {\n const buttonText =\n specialAuth0State === 'newly-verified'\n ? 'Continue'\n : specialAuth0State === 'sso-linking'\n ? 'Continue'\n : 'Return to ARBI Docs'\n const buttonOnClick =\n specialAuth0State === 'newly-verified'\n ? () => void sso.signIn({ redirectUri: `${window.location.origin}/sso` })\n : specialAuth0State === 'sso-linking'\n ? () => {\n if (sso.continueUrl && auth0Message.state) {\n window.location.href = sso.continueUrl('link', auth0Message.state)\n }\n }\n : () => navigate('/')\n return (\n <AuthLayout brand={auth.brand} corner={auth.corner}>\n <div className=\"text-center py-8\" data-testid=\"auth0-message\">\n <h2 className=\"text-lg font-semibold text-foreground mb-2\">{getTitle()}</h2>\n <p className=\"text-sm text-muted-foreground\">{getDescription()}</p>\n {specialAuth0State === 'not-verified' && auth0Message.auth0UserId && (\n <SsoResendVerificationButton providerUserId={auth0Message.auth0UserId} />\n )}\n </div>\n <div className=\"mt-6 text-center space-y-2\">\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={buttonOnClick}\n disabled={isSubmitting}\n className=\"w-full flex items-center justify-center gap-2\"\n data-testid=\"auth0-continue-button\"\n aria-label={\n auth0Message.originalProviderIcon && auth0Message.newProviderIcon\n ? `${buttonText} with original provider and new provider`\n : buttonText\n }\n >\n {buttonText}\n {auth0Message.originalProviderIcon && auth0Message.newProviderIcon && (\n <span className=\"ml-2 flex items-center gap-1\">\n {auth0Message.originalProviderIcon}\n <LinkIcon className=\"h-4 w-4\" aria-hidden=\"true\" />\n {auth0Message.newProviderIcon}\n </span>\n )}\n </Button>\n {specialAuth0State === 'sso-linking' && (\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => {\n if (sso.continueUrl && auth0Message.state) {\n window.location.href = sso.continueUrl('cancel', auth0Message.state)\n }\n }}\n disabled={isSubmitting}\n className=\"w-full flex items-center justify-center gap-2\"\n data-testid=\"auth0-cancel-button\"\n aria-label={\n auth0Message.originalProviderIcon ? `Cancel and use original provider` : 'Cancel'\n }\n >\n Cancel and use {auth0Message.originalProviderIcon}\n </Button>\n )}\n </div>\n </AuthLayout>\n )\n }\n\n if (error && !ssoStatus && !isCheckingStatus) {\n return (\n <AuthLayout brand={auth.brand} corner={auth.corner}>\n <AuthAlert testId=\"sso-status-error\">{error.message}</AuthAlert>\n <Button\n className=\"mt-4 w-full\"\n onClick={() => {\n hasCheckedStatus.current = false\n setError(null)\n setStatusAttempt((attempt) => attempt + 1)\n }}\n >\n Try again\n </Button>\n <Button onClick={() => navigate('/login')} variant=\"ghost\" className=\"w-full\">\n Cancel\n </Button>\n </AuthLayout>\n )\n }\n\n // Show loading state while checking status\n if (isCheckingStatus || !ssoStatus) {\n return (\n <AuthLayout brand={auth.brand} corner={auth.corner}>\n <div className=\"text-center py-8\" data-testid=\"sso-loading\">\n <Loader2 className=\"h-8 w-8 animate-spin mx-auto mb-4\" />\n <p className=\"text-sm text-muted-foreground\">Completing authentication...</p>\n </div>\n <Button onClick={() => navigate('/login')} variant=\"ghost\" className=\"w-full text-sm\">\n Cancel\n </Button>\n </AuthLayout>\n )\n }\n\n // Show password form\n return (\n <AuthLayout brand={auth.brand} corner={auth.corner}>\n <div className=\"pt-3\" data-testid=\"sso-password-form\">\n <div className=\"mb-6 text-center\">\n <h2 className=\"text-lg font-semibold text-foreground\">{getTitle()}</h2>\n {getDescription() && (\n <p className=\"mt-2 text-sm text-muted-foreground\">{getDescription()}</p>\n )}\n </div>\n\n <form onSubmit={handlePasswordSubmit} className=\"space-y-4\">\n <AuthField htmlFor=\"email\" label=\"Email\">\n <Input\n type=\"email\"\n id=\"email\"\n name=\"email\"\n value={user?.email || ''}\n disabled\n autoComplete=\"email\"\n className=\"bg-muted cursor-not-allowed\"\n data-testid=\"sso-email-display\"\n />\n </AuthField>\n\n {ssoStatus.status === 'new_user' ? (\n <>\n <div className=\"flex gap-4\">\n <AuthField htmlFor=\"firstName\" label=\"First Name\" className=\"flex-1\">\n <Input\n type=\"text\"\n id=\"firstName\"\n name=\"firstName\"\n value={ssoName.given_name}\n disabled\n autoComplete=\"given-name\"\n className=\"bg-muted cursor-not-allowed\"\n data-testid=\"sso-firstname-display\"\n />\n </AuthField>\n <AuthField htmlFor=\"lastName\" label=\"Last Name\" className=\"flex-1\">\n <Input\n type=\"text\"\n id=\"lastName\"\n name=\"lastName\"\n value={ssoName.family_name}\n disabled\n autoComplete=\"family-name\"\n className=\"bg-muted cursor-not-allowed\"\n data-testid=\"sso-lastname-display\"\n />\n </AuthField>\n </div>\n <PasswordStrengthInput\n password={password}\n confirmPassword={confirmPassword}\n onPasswordChange={setPassword}\n onConfirmPasswordChange={setConfirmPassword}\n showConfirmation={true}\n passwordLabel=\"Master Password\"\n confirmLabel=\"Confirm Password\"\n layout=\"side-by-side\"\n showStrengthIndicator={true}\n getUnmetRequirement={passwordRules.unmet}\n />\n </>\n ) : (\n <AuthField htmlFor=\"password\" label=\"Password\" required>\n <Input\n type=\"password\"\n id=\"password\"\n name=\"password\"\n placeholder=\"\"\n value={password}\n onChange={(e) => setPassword(e.target.value)}\n disabled={isSubmitting}\n autoFocus\n autoComplete=\"current-password\"\n required\n className=\"placeholder:text-muted-foreground/40\"\n data-testid=\"sso-password-input\"\n />\n {ssoStatus?.status === 'sso_exists' && (\n <AuthLink\n onClick={() => setShowForgotPasswordModal(true)}\n className=\"mt-2\"\n data-testid=\"sso-forgot-password-link\"\n >\n Forgot your password?\n </AuthLink>\n )}\n </AuthField>\n )}\n\n {error && <AuthAlert testId=\"sso-error-message\">{error.message}</AuthAlert>}\n\n {/* Terms Checkbox (for new user registration, above submit button) */}\n {ssoStatus.status === 'new_user' && (\n <AuthConsent\n termsAccepted={termsAccepted}\n onTermsAcceptedChange={setTermsAccepted}\n saveRecoveryKey={saveRecoveryKey}\n onSaveRecoveryKeyChange={setSaveRecoveryKey}\n termsLink={auth.consent?.termsLink ?? { href: '#', label: 'Terms of Use' }}\n privacyLink={auth.consent?.privacyLink ?? { href: '#', label: 'Privacy Policy' }}\n noRecoveryKeyWarning={auth.consent?.noRecoveryKeyWarning ?? NO_RECOVERY_KEY_WARNING}\n />\n )}\n\n <div className=\"space-y-2\">\n <Button\n type=\"submit\"\n className=\"w-full\"\n disabled={isSubmitDisabled}\n data-testid=\"sso-submit-button\"\n >\n {isSubmitting ? (\n <>\n <Loader2 className=\"mr-2 h-4 w-4 animate-spin\" />\n Submitting...\n </>\n ) : (\n 'Submit'\n )}\n </Button>\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={handleCancel}\n disabled={isSubmitting}\n className=\"w-full\"\n data-testid=\"sso-cancel-button\"\n >\n Reset\n </Button>\n </div>\n </form>\n\n {/* Footer (links only for existing users, checkbox is inside form for new users) */}\n {ssoStatus.status !== 'new_user' && auth.footer}\n </div>\n {/* Forgot Password Modal */}\n <ConnectedForgotPassword\n open={showForgotPasswordModal}\n onOpenChange={setShowForgotPasswordModal}\n onRecovered={handleRecoverySuccess}\n />\n\n {/* Change Password Dialog (Recovery Mode) */}\n <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A,cACV,eAAY;AAAA,cACb;AAAA;AAAA,UAED;AAAA,WACF;AAAA,SACF;AAAA,MAGC,UAAU,WAAW,cAAc,KAAK;AAAA,OAC3C;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,MAAM;AAAA,QACN,cAAc;AAAA,QACd,aAAa;AAAA;AAAA,IACf;AAAA,IAGA;AAAA,MAAC;AAAA;AAAA,QACC,MAAM;AAAA,QACN,SAAS,MAAM,2BAA2B,KAAK;AAAA,QAC/C,cAAY;AAAA;AAAA,IACd;AAAA,KACF;AAEJ;",
6
6
  "names": ["error", "auth0Message"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/connection/runtime/ConnectedAppRuntime.tsx"],
4
- "sourcesContent": ["/**\n * The global effects a signed-in app runs once, beside its shell: mount it once. Each effect can\n * be turned off (`effects`); those that depend on a part of the product run only while it is on,\n * and those that need something of the host only when it is given.\n *\n * - `liveUpdates`: show what the live connection brings (`useLiveUpdates`: notification, chat\n * and batch toasts, AI review updates, a connection taken over); needs the host's\n * `ArbiWebSocketProvider`;\n * - `releaseStaleModals`: repair the pointer-events / aria-hidden a dismissed modal can leak;\n * - `retiredModelNotice`: say once that a chosen Premium model is no longer offered;\n * - `pausedMutationNotice`: say why an action is waiting while offline;\n * - `paymentReturn`: land the return from checkout (only where the site sells plans);\n * - `userNameFromWorkspaces`: fill in the user's name from the workspace member lists;\n * - `firstLoginRouting`: land a fresh registration (`FIRST_LOGIN_WORKSPACES_VIEW`);\n * - `welcomeDialog`: greet a free user once with the welcome dialog (only where the site sells\n * plans; a fresh registration's landing and `skipWelcomeDialogThisSession` skip it);\n * - `pendingWorkspaceShare`: send the access request of an expired invite-and-share\n * (`PENDING_WORKSPACE_SHARE_VIEW`);\n * - `pendingNotification`: open a notification link's target (`PENDING_NOTIFICATION_VIEW`);\n * - `pendingAccessReview`: open an access-request email's review (`PENDING_ACCESS_REVIEW_VIEW`);\n * - `addonNotice`: announce, once, an add-on that arrived on its own;\n * - `connectorAutoSync`: start the due connector auto-syncs into the open workspace;\n * - `pageTransition`: lift a workspace switch's cover once the new page has painted\n * (`PAGE_TRANSITION_VIEW`);\n * - `freshChatModel`: the chat configuration for the next message starts fresh;\n * - `workspaceOpenMetrics`: measure a workspace's open and first paint (with `measure`);\n * - `prefetch`: load the kit's heavy chunks (`KIT_CHUNK_LOADERS`: grid, calendar, Word editor,\n * PDF viewer) and the host's lazy chunks (`prefetch`) when idle;\n * - `guidedRuns`: the guided cursor (\"Show me\", remote control, with the host's mark) and,\n * where the site turned remote control on (`guided.remoteControl`), its consent prompt\n * (`ConnectedRemoteControlConsent`).\n *\n * The one-shot requests are session transient views the host sets where they arrive (see\n * `./requests`); nothing happens while none is set.\n */\nimport { useBillingSupport } from '../billing/support'\nimport { GuidedCursor } from '../../guided/GuidedCursor'\nimport { useGuidedRuns } from '../../guided/useGuidedRuns'\nimport { ConnectedRemoteControlConsent } from '../remote-control/ConnectedRemoteControlConsent'\nimport { useRemoteControlSessionReset } from '../remote-control/remoteControl'\nimport { useAddonArrivalNotice } from './useAddonArrivalNotice'\nimport { useFirstLoginRouting } from './useFirstLoginRouting'\nimport { useLiveUpdates } from './useLiveUpdates'\nimport { usePausedMutationNotice } from './usePausedMutationNotice'\nimport { usePaymentReturn } from './usePaymentReturn'\nimport { usePendingAccessReview } from './usePendingAccessReview'\nimport { usePendingNotification } from './usePendingNotification'\nimport { usePendingWorkspaceShare } from './usePendingWorkspaceShare'\nimport { useReleaseStaleModalState } from './useReleaseStaleModalState'\nimport { useRetiredModelNotice } from './useRetiredModelNotice'\nimport {\n useFreshChatModel,\n usePageTransition,\n usePrefetchChunks,\n useWorkspaceAutoSync,\n useWorkspaceOpenMetrics,\n type RuntimeMeasure,\n} from './useSessionBootstrap'\nimport { useUserNameFromWorkspaces } from './useUserNameFromWorkspaces'\nimport { useWelcomeDialog } from './useWelcomeDialog'\nimport { skipWelcomeDialogThisSession } from './requests'\nimport { KIT_CHUNK_LOADERS } from '../../lazy-chunks'\n\nexport type AppRuntimeEffect =\n | 'liveUpdates'\n | 'releaseStaleModals'\n | 'retiredModelNotice'\n | 'pausedMutationNotice'\n | 'paymentReturn'\n | 'userNameFromWorkspaces'\n | 'firstLoginRouting'\n | 'welcomeDialog'\n | 'pendingWorkspaceShare'\n | 'pendingNotification'\n | 'pendingAccessReview'\n | 'addonNotice'\n | 'connectorAutoSync'\n | 'pageTransition'\n | 'freshChatModel'\n | 'workspaceOpenMetrics'\n | 'prefetch'\n | 'guidedRuns'\n\nexport interface ConnectedAppRuntimeProps {\n /** Effects to turn off (`{ paymentReturn: false }`). Default: every effect on. */\n effects?: Partial<Record<AppRuntimeEffect, boolean>>\n /**\n * A fresh registration's landing is being decided (`firstLoginRouting`): the host skips its own\n * first-visit prompts for this landing.\n */\n onFirstLogin?: () => void\n /** Report the time between two performance marks (`workspaceOpenMetrics`). None: not measured. */\n measure?: RuntimeMeasure\n /** The host's lazy chunks to load when idle after the first paint (`prefetch`). */\n prefetch?: readonly (() => Promise<unknown>)[]\n}\n\nconst LiveUpdates = () => (useLiveUpdates(), null)\nconst ReleaseStaleModals = () => (useReleaseStaleModalState(), null)\nconst RetiredModelNotice = () => (useRetiredModelNotice(), null)\nconst PausedMutationNotice = () => (usePausedMutationNotice(), null)\nconst PaymentReturn = () => (usePaymentReturn(), null)\nconst UserNameFromWorkspaces = () => (useUserNameFromWorkspaces(), null)\nconst FirstLoginRouting = ({ onResolve }: { onResolve?: () => void }) => (\n useFirstLoginRouting(onResolve),\n null\n)\nconst WelcomeDialog = () => (useWelcomeDialog(), null)\nconst PendingWorkspaceShare = () => (usePendingWorkspaceShare(), null)\nconst PendingNotification = () => (usePendingNotification(), null)\nconst PendingAccessReview = () => (usePendingAccessReview(), null)\nconst AddonNotice = () => (useAddonArrivalNotice(), null)\nconst ConnectorAutoSync = () => (useWorkspaceAutoSync(), null)\nconst PageTransition = () => (usePageTransition(), null)\nconst FreshChatModel = () => (useFreshChatModel(), null)\nconst WorkspaceOpenMetrics = ({ measure }: { measure: RuntimeMeasure }) => (\n useWorkspaceOpenMetrics(measure),\n null\n)\nconst Prefetch = ({ loaders }: { loaders: readonly (() => Promise<unknown>)[] }) => (\n usePrefetchChunks(loaders),\n null\n)\n\n/**\n * The guided cursor and remote control's consent prompt (shown only where the site turned remote\n * control on). A sign-in or sign-out stops a run in flight and drops remote control's grant.\n */\nfunction GuidedRuns() {\n useRemoteControlSessionReset()\n const { cursorMark } = useGuidedRuns()\n return (\n <>\n <GuidedCursor markSrc={cursorMark} />\n <ConnectedRemoteControlConsent />\n </>\n )\n}\n\nexport function ConnectedAppRuntime({\n effects = {},\n onFirstLogin,\n measure,\n prefetch,\n}: ConnectedAppRuntimeProps) {\n const on = (effect: AppRuntimeEffect) => effects[effect] !== false\n const { stripeEnabled } = useBillingSupport()\n const welcomeDialog = on('welcomeDialog') && stripeEnabled\n const resolveFirstLogin = () => {\n // A fresh registration's landing has its own purpose: no welcome dialog on it.\n if (welcomeDialog) skipWelcomeDialogThisSession()\n onFirstLogin?.()\n }\n return (\n <>\n {/* First: a fresh registration's landing is decided before the host's own first-visit\n effects (its parent's) run in the same commit. */}\n {on('firstLoginRouting') && <FirstLoginRouting onResolve={resolveFirstLogin} />}\n {/* After the landing above, so its effect sees a registration's skip. */}\n {welcomeDialog && <WelcomeDialog />}\n {on('liveUpdates') && <LiveUpdates />}\n {on('releaseStaleModals') && <ReleaseStaleModals />}\n {on('retiredModelNotice') && <RetiredModelNotice />}\n {on('pausedMutationNotice') && <PausedMutationNotice />}\n {on('paymentReturn') && stripeEnabled && <PaymentReturn />}\n {on('userNameFromWorkspaces') && <UserNameFromWorkspaces />}\n {on('pendingWorkspaceShare') && <PendingWorkspaceShare />}\n {on('pendingNotification') && <PendingNotification />}\n {on('pendingAccessReview') && <PendingAccessReview />}\n {on('addonNotice') && <AddonNotice />}\n {on('connectorAutoSync') && <ConnectorAutoSync />}\n {on('pageTransition') && <PageTransition />}\n {on('freshChatModel') && <FreshChatModel />}\n {on('workspaceOpenMetrics') && measure && <WorkspaceOpenMetrics measure={measure} />}\n {on('prefetch') && <Prefetch loaders={[...(prefetch ?? []), ...KIT_CHUNK_LOADERS]} />}\n {on('guidedRuns') && <GuidedRuns />}\n </>\n )\n}\n"],
4
+ "sourcesContent": ["/**\n * The global effects a signed-in app runs once, beside its shell: mount it once. Each effect can\n * be turned off (`effects`); those that depend on a part of the product run only while it is on,\n * and those that need something of the host only when it is given.\n *\n * - `liveUpdates`: show what the live connection brings (`useLiveUpdates`: notification, chat\n * and batch toasts, AI review updates, a connection taken over); needs the host's\n * `ArbiWebSocketProvider`;\n * - `releaseStaleModals`: repair the pointer-events / aria-hidden a dismissed modal can leak;\n * - `retiredModelNotice`: say once that a chosen Premium model is no longer offered;\n * - `pausedMutationNotice`: say why an action is waiting while offline;\n * - `paymentReturn`: land the return from checkout (only where the site sells plans);\n * - `userNameFromWorkspaces`: fill in the user's name from the workspace member lists;\n * - `firstLoginRouting`: land a fresh registration (`FIRST_LOGIN_WORKSPACES_VIEW`);\n * - `welcomeDialog`: greet a free user once per login with the welcome dialog (only where the site sells\n * plans; a fresh registration's landing and `skipWelcomeDialogThisSession` skip it);\n * - `pendingWorkspaceShare`: send the access request of an expired invite-and-share\n * (`PENDING_WORKSPACE_SHARE_VIEW`);\n * - `pendingNotification`: open a notification link's target (`PENDING_NOTIFICATION_VIEW`);\n * - `pendingAccessReview`: open an access-request email's review (`PENDING_ACCESS_REVIEW_VIEW`);\n * - `addonNotice`: announce, once, an add-on that arrived on its own;\n * - `connectorAutoSync`: start the due connector auto-syncs into the open workspace;\n * - `pageTransition`: lift a workspace switch's cover once the new page has painted\n * (`PAGE_TRANSITION_VIEW`);\n * - `freshChatModel`: the chat configuration for the next message starts fresh;\n * - `workspaceOpenMetrics`: measure a workspace's open and first paint (with `measure`);\n * - `prefetch`: load the kit's heavy chunks (`KIT_CHUNK_LOADERS`: grid, calendar, Word editor,\n * PDF viewer) and the host's lazy chunks (`prefetch`) when idle;\n * - `guidedRuns`: the guided cursor (\"Show me\", remote control, with the host's mark) and,\n * where the site turned remote control on (`guided.remoteControl`), its consent prompt\n * (`ConnectedRemoteControlConsent`).\n *\n * The one-shot requests are session transient views the host sets where they arrive (see\n * `./requests`); nothing happens while none is set.\n */\nimport { useBillingSupport } from '../billing/support'\nimport { GuidedCursor } from '../../guided/GuidedCursor'\nimport { useGuidedRuns } from '../../guided/useGuidedRuns'\nimport { ConnectedRemoteControlConsent } from '../remote-control/ConnectedRemoteControlConsent'\nimport { useRemoteControlSessionReset } from '../remote-control/remoteControl'\nimport { useAddonArrivalNotice } from './useAddonArrivalNotice'\nimport { useFirstLoginRouting } from './useFirstLoginRouting'\nimport { useLiveUpdates } from './useLiveUpdates'\nimport { usePausedMutationNotice } from './usePausedMutationNotice'\nimport { usePaymentReturn } from './usePaymentReturn'\nimport { usePendingAccessReview } from './usePendingAccessReview'\nimport { usePendingNotification } from './usePendingNotification'\nimport { usePendingWorkspaceShare } from './usePendingWorkspaceShare'\nimport { useReleaseStaleModalState } from './useReleaseStaleModalState'\nimport { useRetiredModelNotice } from './useRetiredModelNotice'\nimport {\n useFreshChatModel,\n usePageTransition,\n usePrefetchChunks,\n useWorkspaceAutoSync,\n useWorkspaceOpenMetrics,\n type RuntimeMeasure,\n} from './useSessionBootstrap'\nimport { useUserNameFromWorkspaces } from './useUserNameFromWorkspaces'\nimport { useWelcomeDialog } from './useWelcomeDialog'\nimport { skipWelcomeDialogThisSession } from './requests'\nimport { KIT_CHUNK_LOADERS } from '../../lazy-chunks'\n\nexport type AppRuntimeEffect =\n | 'liveUpdates'\n | 'releaseStaleModals'\n | 'retiredModelNotice'\n | 'pausedMutationNotice'\n | 'paymentReturn'\n | 'userNameFromWorkspaces'\n | 'firstLoginRouting'\n | 'welcomeDialog'\n | 'pendingWorkspaceShare'\n | 'pendingNotification'\n | 'pendingAccessReview'\n | 'addonNotice'\n | 'connectorAutoSync'\n | 'pageTransition'\n | 'freshChatModel'\n | 'workspaceOpenMetrics'\n | 'prefetch'\n | 'guidedRuns'\n\nexport interface ConnectedAppRuntimeProps {\n /** Effects to turn off (`{ paymentReturn: false }`). Default: every effect on. */\n effects?: Partial<Record<AppRuntimeEffect, boolean>>\n /**\n * A fresh registration's landing is being decided (`firstLoginRouting`): the host skips its own\n * first-visit prompts for this landing.\n */\n onFirstLogin?: () => void\n /** Report the time between two performance marks (`workspaceOpenMetrics`). None: not measured. */\n measure?: RuntimeMeasure\n /** The host's lazy chunks to load when idle after the first paint (`prefetch`). */\n prefetch?: readonly (() => Promise<unknown>)[]\n}\n\nconst LiveUpdates = () => (useLiveUpdates(), null)\nconst ReleaseStaleModals = () => (useReleaseStaleModalState(), null)\nconst RetiredModelNotice = () => (useRetiredModelNotice(), null)\nconst PausedMutationNotice = () => (usePausedMutationNotice(), null)\nconst PaymentReturn = () => (usePaymentReturn(), null)\nconst UserNameFromWorkspaces = () => (useUserNameFromWorkspaces(), null)\nconst FirstLoginRouting = ({ onResolve }: { onResolve?: () => void }) => (\n useFirstLoginRouting(onResolve),\n null\n)\nconst WelcomeDialog = () => (useWelcomeDialog(), null)\nconst PendingWorkspaceShare = () => (usePendingWorkspaceShare(), null)\nconst PendingNotification = () => (usePendingNotification(), null)\nconst PendingAccessReview = () => (usePendingAccessReview(), null)\nconst AddonNotice = () => (useAddonArrivalNotice(), null)\nconst ConnectorAutoSync = () => (useWorkspaceAutoSync(), null)\nconst PageTransition = () => (usePageTransition(), null)\nconst FreshChatModel = () => (useFreshChatModel(), null)\nconst WorkspaceOpenMetrics = ({ measure }: { measure: RuntimeMeasure }) => (\n useWorkspaceOpenMetrics(measure),\n null\n)\nconst Prefetch = ({ loaders }: { loaders: readonly (() => Promise<unknown>)[] }) => (\n usePrefetchChunks(loaders),\n null\n)\n\n/**\n * The guided cursor and remote control's consent prompt (shown only where the site turned remote\n * control on). A sign-in or sign-out stops a run in flight and drops remote control's grant.\n */\nfunction GuidedRuns() {\n useRemoteControlSessionReset()\n const { cursorMark } = useGuidedRuns()\n return (\n <>\n <GuidedCursor markSrc={cursorMark} />\n <ConnectedRemoteControlConsent />\n </>\n )\n}\n\nexport function ConnectedAppRuntime({\n effects = {},\n onFirstLogin,\n measure,\n prefetch,\n}: ConnectedAppRuntimeProps) {\n const on = (effect: AppRuntimeEffect) => effects[effect] !== false\n const { stripeEnabled } = useBillingSupport()\n const welcomeDialog = on('welcomeDialog') && stripeEnabled\n const resolveFirstLogin = () => {\n // A fresh registration's landing has its own purpose: no welcome dialog on it.\n if (welcomeDialog) skipWelcomeDialogThisSession()\n onFirstLogin?.()\n }\n return (\n <>\n {/* First: a fresh registration's landing is decided before the host's own first-visit\n effects (its parent's) run in the same commit. */}\n {on('firstLoginRouting') && <FirstLoginRouting onResolve={resolveFirstLogin} />}\n {/* After the landing above, so its effect sees a registration's skip. */}\n {welcomeDialog && <WelcomeDialog />}\n {on('liveUpdates') && <LiveUpdates />}\n {on('releaseStaleModals') && <ReleaseStaleModals />}\n {on('retiredModelNotice') && <RetiredModelNotice />}\n {on('pausedMutationNotice') && <PausedMutationNotice />}\n {on('paymentReturn') && stripeEnabled && <PaymentReturn />}\n {on('userNameFromWorkspaces') && <UserNameFromWorkspaces />}\n {on('pendingWorkspaceShare') && <PendingWorkspaceShare />}\n {on('pendingNotification') && <PendingNotification />}\n {on('pendingAccessReview') && <PendingAccessReview />}\n {on('addonNotice') && <AddonNotice />}\n {on('connectorAutoSync') && <ConnectorAutoSync />}\n {on('pageTransition') && <PageTransition />}\n {on('freshChatModel') && <FreshChatModel />}\n {on('workspaceOpenMetrics') && measure && <WorkspaceOpenMetrics measure={measure} />}\n {on('prefetch') && <Prefetch loaders={[...(prefetch ?? []), ...KIT_CHUNK_LOADERS]} />}\n {on('guidedRuns') && <GuidedRuns />}\n </>\n )\n}\n"],
5
5
  "mappings": ";AAoII,mBACE,KADF;AAjGJ,SAAS,yBAAyB;AAClC,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;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K,oBAAC,YAAS,SAAS,CAAC,GAAI,YAAY,CAAC,GAAI,GAAG,iBAAiB,GAAG;AAAA,IAClF,GAAG,YAAY,KAAK,oBAAC,cAAW;AAAA,KACnC;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1 @@
1
- /** Its code in the user's `dismissed_tips` once it has been shown. */
2
- export declare const WELCOME_DIALOG_TIP = "welcome-modal";
3
1
  export declare function useWelcomeDialog(): void;
@@ -1,16 +1,9 @@
1
1
  "use client";
2
- import { useEffect } from "react";
3
- import {
4
- useArbiSession,
5
- useDismissedTips,
6
- useProjects,
7
- useTransientView,
8
- useUserSettings
9
- } from "@arbidocs/react";
2
+ import { useEffect, useRef } from "react";
3
+ import { useArbiSession, useProjects, useTransientView } from "@arbidocs/react";
10
4
  import { openDialog } from "../../provider/dialog-registry.js";
11
5
  import { useAccessRequestUnderReview } from "../workspace-access/access-review.js";
12
6
  import { PENDING_ACCESS_REVIEW_VIEW, WELCOME_DIALOG_SESSION_KEY } from "./requests.js";
13
- const WELCOME_DIALOG_TIP = "welcome-modal";
14
7
  function consideredThisSession() {
15
8
  try {
16
9
  return sessionStorage.getItem(WELCOME_DIALOG_SESSION_KEY) !== null;
@@ -25,15 +18,18 @@ function useWelcomeDialog() {
25
18
  const currentUserExtId = user?.external_id;
26
19
  const [pendingAccessReviewId] = useTransientView(PENDING_ACCESS_REVIEW_VIEW, null);
27
20
  const accessRequestReview = useAccessRequestUnderReview();
28
- const { data: settings, isLoading: settingsLoading } = useUserSettings();
29
21
  const { data: projects, isLoading: projectsLoading } = useProjects();
30
- const { dismissTip } = useDismissedTips();
22
+ const considered = useRef(false);
31
23
  useEffect(() => {
32
- if (!isAuthenticated || isExternal) return;
24
+ if (!isAuthenticated) {
25
+ considered.current = false;
26
+ return;
27
+ }
28
+ if (isExternal) return;
33
29
  if (pendingAccessReviewId || accessRequestReview) return;
34
- if (settingsLoading || projectsLoading || !settings) return;
35
- if (consideredThisSession()) return;
36
- if (settings.dismissed_tips?.includes(WELCOME_DIALOG_TIP)) return;
30
+ if (projectsLoading || !projects) return;
31
+ if (considered.current || consideredThisSession()) return;
32
+ considered.current = true;
37
33
  try {
38
34
  sessionStorage.setItem(WELCOME_DIALOG_SESSION_KEY, "1");
39
35
  } catch {
@@ -43,22 +39,17 @@ function useWelcomeDialog() {
43
39
  );
44
40
  if (ownsPaidProject) return;
45
41
  openDialog("welcome");
46
- dismissTip(WELCOME_DIALOG_TIP);
47
42
  }, [
48
43
  isAuthenticated,
49
44
  isExternal,
50
45
  currentUserExtId,
51
- settings,
52
- settingsLoading,
53
46
  projects,
54
47
  projectsLoading,
55
- dismissTip,
56
48
  pendingAccessReviewId,
57
49
  accessRequestReview
58
50
  ]);
59
51
  }
60
52
  export {
61
- WELCOME_DIALOG_TIP,
62
53
  useWelcomeDialog
63
54
  };
64
55
  //# sourceMappingURL=useWelcomeDialog.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/connection/runtime/useWelcomeDialog.ts"],
4
- "sourcesContent": ["/**\n * Opens the welcome dialog (`openDialog('welcome')`) once per user, for free users, on a site that\n * sells plans (the runtime runs it only then).\n *\n * It waits for the user settings and projects. \"Free\" means the user owns no project with an\n * active or past-due subscription, so paying customers never see it. Once shown it is recorded in\n * the user's `dismissed_tips` (server side, so every later sign-in and device skips it; resetting\n * the tips brings it back). A session flag (`WELCOME_DIALOG_SESSION_KEY`) keeps it to one\n * evaluation per session and lets a landing with its own purpose skip it without recording it.\n * An access review opened from its email is an intentional action: the dialog never preempts it.\n */\nimport { useEffect } from 'react'\nimport {\n useArbiSession,\n useDismissedTips,\n useProjects,\n useTransientView,\n useUserSettings,\n} from '@arbidocs/react'\nimport { openDialog } from '../../provider/dialog-registry'\nimport { useAccessRequestUnderReview } from '../workspace-access/access-review'\nimport { PENDING_ACCESS_REVIEW_VIEW, WELCOME_DIALOG_SESSION_KEY } from './requests'\n\n/** Its code in the user's `dismissed_tips` once it has been shown. */\nexport const WELCOME_DIALOG_TIP = 'welcome-modal'\n\nfunction consideredThisSession(): boolean {\n try {\n return sessionStorage.getItem(WELCOME_DIALOG_SESSION_KEY) !== null\n } catch {\n return false\n }\n}\n\nexport function useWelcomeDialog(): void {\n const { status, user } = useArbiSession()\n const isAuthenticated = status === 'signed-in'\n const isExternal = user?.temporary_access_only === true\n const currentUserExtId = user?.external_id\n const [pendingAccessReviewId] = useTransientView<string | null>(PENDING_ACCESS_REVIEW_VIEW, null)\n const accessRequestReview = useAccessRequestUnderReview()\n const { data: settings, isLoading: settingsLoading } = useUserSettings()\n const { data: projects, isLoading: projectsLoading } = useProjects()\n const { dismissTip } = useDismissedTips()\n\n useEffect(() => {\n if (!isAuthenticated || isExternal) return\n if (pendingAccessReviewId || accessRequestReview) return\n // Wait for the data that decides \"free vs paying\", so it doesn't flash.\n if (settingsLoading || projectsLoading || !settings) return\n if (consideredThisSession()) return\n if (settings.dismissed_tips?.includes(WELCOME_DIALOG_TIP)) return\n\n // Evaluated once per session, whatever the outcome.\n try {\n sessionStorage.setItem(WELCOME_DIALOG_SESSION_KEY, '1')\n } catch {\n // Without session storage the server-side record still keeps it to once.\n }\n const ownsPaidProject = (projects ?? []).some(\n (p) =>\n p.created_by === currentUserExtId &&\n (p.subscription === 'active' || p.subscription === 'past_due')\n )\n if (ownsPaidProject) return\n openDialog('welcome')\n dismissTip(WELCOME_DIALOG_TIP)\n }, [\n isAuthenticated,\n isExternal,\n currentUserExtId,\n settings,\n settingsLoading,\n projects,\n projectsLoading,\n dismissTip,\n pendingAccessReviewId,\n accessRequestReview,\n ])\n}\n"],
5
- "mappings": ";AAWA,SAAS,iBAAiB;AAC1B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,kBAAkB;AAC3B,SAAS,mCAAmC;AAC5C,SAAS,4BAA4B,kCAAkC;AAGhE,MAAM,qBAAqB;AAElC,SAAS,wBAAiC;AACxC,MAAI;AACF,WAAO,eAAe,QAAQ,0BAA0B,MAAM;AAAA,EAChE,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEO,SAAS,mBAAyB;AACvC,QAAM,EAAE,QAAQ,KAAK,IAAI,eAAe;AACxC,QAAM,kBAAkB,WAAW;AACnC,QAAM,aAAa,MAAM,0BAA0B;AACnD,QAAM,mBAAmB,MAAM;AAC/B,QAAM,CAAC,qBAAqB,IAAI,iBAAgC,4BAA4B,IAAI;AAChG,QAAM,sBAAsB,4BAA4B;AACxD,QAAM,EAAE,MAAM,UAAU,WAAW,gBAAgB,IAAI,gBAAgB;AACvE,QAAM,EAAE,MAAM,UAAU,WAAW,gBAAgB,IAAI,YAAY;AACnE,QAAM,EAAE,WAAW,IAAI,iBAAiB;AAExC,YAAU,MAAM;AACd,QAAI,CAAC,mBAAmB,WAAY;AACpC,QAAI,yBAAyB,oBAAqB;AAElD,QAAI,mBAAmB,mBAAmB,CAAC,SAAU;AACrD,QAAI,sBAAsB,EAAG;AAC7B,QAAI,SAAS,gBAAgB,SAAS,kBAAkB,EAAG;AAG3D,QAAI;AACF,qBAAe,QAAQ,4BAA4B,GAAG;AAAA,IACxD,QAAQ;AAAA,IAER;AACA,UAAM,mBAAmB,YAAY,CAAC,GAAG;AAAA,MACvC,CAAC,MACC,EAAE,eAAe,qBAChB,EAAE,iBAAiB,YAAY,EAAE,iBAAiB;AAAA,IACvD;AACA,QAAI,gBAAiB;AACrB,eAAW,SAAS;AACpB,eAAW,kBAAkB;AAAA,EAC/B,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH;",
4
+ "sourcesContent": ["/** Show the Free subscription chooser once per login where Stripe billing is enabled.\n * Account-level tip dismissals do not suppress it on later logins.\n */\nimport { useEffect, useRef } from 'react'\nimport { useArbiSession, useProjects, useTransientView } from '@arbidocs/react'\nimport { openDialog } from '../../provider/dialog-registry'\nimport { useAccessRequestUnderReview } from '../workspace-access/access-review'\nimport { PENDING_ACCESS_REVIEW_VIEW, WELCOME_DIALOG_SESSION_KEY } from './requests'\n\nfunction consideredThisSession(): boolean {\n try {\n return sessionStorage.getItem(WELCOME_DIALOG_SESSION_KEY) !== null\n } catch {\n return false\n }\n}\n\nexport function useWelcomeDialog(): void {\n const { status, user } = useArbiSession()\n const isAuthenticated = status === 'signed-in'\n const isExternal = user?.temporary_access_only === true\n const currentUserExtId = user?.external_id\n const [pendingAccessReviewId] = useTransientView<string | null>(PENDING_ACCESS_REVIEW_VIEW, null)\n const accessRequestReview = useAccessRequestUnderReview()\n const { data: projects, isLoading: projectsLoading } = useProjects()\n const considered = useRef(false)\n\n useEffect(() => {\n if (!isAuthenticated) {\n considered.current = false\n return\n }\n if (isExternal) return\n if (pendingAccessReviewId || accessRequestReview) return\n // Wait for the data that decides \"free vs paying\", so it doesn't flash.\n if (projectsLoading || !projects) return\n if (considered.current || consideredThisSession()) return\n considered.current = true\n\n // Evaluated once per session, whatever the outcome.\n try {\n sessionStorage.setItem(WELCOME_DIALOG_SESSION_KEY, '1')\n } catch {\n // The in-memory guard still prevents repeat openings in this mounted session.\n }\n const ownsPaidProject = (projects ?? []).some(\n (p) =>\n p.created_by === currentUserExtId &&\n (p.subscription === 'active' || p.subscription === 'past_due')\n )\n if (ownsPaidProject) return\n openDialog('welcome')\n }, [\n isAuthenticated,\n isExternal,\n currentUserExtId,\n projects,\n projectsLoading,\n pendingAccessReviewId,\n accessRequestReview,\n ])\n}\n"],
5
+ "mappings": ";AAGA,SAAS,WAAW,cAAc;AAClC,SAAS,gBAAgB,aAAa,wBAAwB;AAC9D,SAAS,kBAAkB;AAC3B,SAAS,mCAAmC;AAC5C,SAAS,4BAA4B,kCAAkC;AAEvE,SAAS,wBAAiC;AACxC,MAAI;AACF,WAAO,eAAe,QAAQ,0BAA0B,MAAM;AAAA,EAChE,QAAQ;AACN,WAAO;AAAA,E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