@agimon-ai/po-native 0.0.1-alpha.71 → 0.0.1-alpha.72

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.
@@ -21,6 +21,7 @@ import welcomeLogoDark from '../../assets/welcome-logo-dark.png';
21
21
  import welcomeLogoLight from '../../assets/welcome-logo-light.png';
22
22
  import { SocialSignInButton } from '../components/SocialSignInButton';
23
23
  import { TAB_BAR_CLEARANCE } from '../components/TabBar';
24
+ import { SignInFormStep, type SignInFormStepProps, SignInWelcomeStep } from './HostedOnboarding';
24
25
 
25
26
  export interface AccountViewProps {
26
27
  page: AccountPage;
@@ -110,10 +111,80 @@ export function accountTitle(page: AccountPage, teamMode?: 'create' | 'choose'):
110
111
  return TITLES[page];
111
112
  }
112
113
 
114
+ /**
115
+ * Hosted Po Cloud sign-in outside Settings, on the onboarding silk. Same pages and actions as below; the
116
+ * team list and every self-hosted page keep the plain look.
117
+ */
118
+ function hostedSignInForm(props: AccountViewProps): SignInFormStepProps | undefined {
119
+ const { onAction } = props;
120
+ const shared = { busy: props.busy, error: props.error, notice: props.notice };
121
+ if (props.page === 'email')
122
+ return {
123
+ ...shared,
124
+ title: 'Continue with email',
125
+ summary: 'We will send you a code. No password to remember.',
126
+ label: 'Email',
127
+ kind: 'email',
128
+ value: props.email ?? '',
129
+ onChangeText: (value) => props.onEmail?.(value),
130
+ primary: 'Send code',
131
+ onPrimary: () => onAction('send-email'),
132
+ secondary: 'Use your own server',
133
+ onSecondary: () => onAction('methods'),
134
+ onBack: () => onAction('welcome'),
135
+ };
136
+ if (props.page === 'email-code')
137
+ return {
138
+ ...shared,
139
+ title: 'Check your email',
140
+ summary: `Enter the 6-digit code we sent to ${props.email ?? 'your email'}.`,
141
+ label: 'Email code',
142
+ kind: 'code',
143
+ value: props.code ?? '',
144
+ onChangeText: (value) => props.onCode?.(value),
145
+ primary: 'Continue',
146
+ onPrimary: () => onAction('verify-email'),
147
+ secondary: 'Send a new code',
148
+ onSecondary: () => onAction('send-email'),
149
+ onBack: () => onAction('Email code'),
150
+ };
151
+ if (props.page === 'team' && props.teamMode !== 'choose')
152
+ return {
153
+ ...shared,
154
+ title: 'Name your team',
155
+ summary: 'Your sessions and settings live in a team. You can invite people later.',
156
+ label: 'Team name',
157
+ kind: 'text',
158
+ value: props.teamName ?? '',
159
+ onChangeText: (value) => props.onTeamName?.(value),
160
+ primary: 'Create team',
161
+ onPrimary: () => onAction('create-team'),
162
+ secondary: 'Use a different email',
163
+ onSecondary: () => onAction('sign-out'),
164
+ // The team is the first step after signing in, so stepping back means another email.
165
+ onBack: () => onAction('sign-out'),
166
+ };
167
+ return undefined;
168
+ }
169
+
113
170
  /** Shared composition for onboarding and Account. Mockup fidelity awaits human approval. */
114
171
  export function AccountView(props: AccountViewProps) {
115
172
  const { page, onAction, busy, error } = props;
116
173
  const { theme } = useUnistyles();
174
+ if (props.hosted && !props.inStack && !props.embedded) {
175
+ if (page === 'welcome' && props.firstRun && !props.signInUnavailable)
176
+ return (
177
+ <SignInWelcomeStep
178
+ busy={busy}
179
+ error={error}
180
+ notice={props.notice}
181
+ onEmail={() => onAction('cloud-sign-in')}
182
+ onOwnServer={() => onAction('methods')}
183
+ />
184
+ );
185
+ const form = hostedSignInForm(props);
186
+ if (form) return <SignInFormStep {...form} />;
187
+ }
117
188
  if (props.firstRun && page === 'welcome') {
118
189
  return (
119
190
  // In a stack the header already names the screen and sits below the status bar.