@shipfox/client-auth 17.0.0 → 22.0.0

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.
Files changed (36) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/CHANGELOG.md +34 -0
  3. package/dist/pages/workspace-onboarding-page.d.ts.map +1 -1
  4. package/dist/pages/workspace-onboarding-page.js +100 -235
  5. package/dist/pages/workspace-onboarding-page.js.map +1 -1
  6. package/dist/routes/index.d.ts +3 -0
  7. package/dist/routes/index.d.ts.map +1 -1
  8. package/dist/routes/index.js +3 -0
  9. package/dist/routes/index.js.map +1 -1
  10. package/dist/routes/login.d.ts +3 -0
  11. package/dist/routes/login.js +3 -0
  12. package/dist/routes/login.js.map +1 -1
  13. package/dist/routes/logout.d.ts +3 -0
  14. package/dist/routes/logout.js +3 -0
  15. package/dist/routes/logout.js.map +1 -1
  16. package/dist/routes/reset.d.ts +3 -0
  17. package/dist/routes/reset.js +3 -0
  18. package/dist/routes/reset.js.map +1 -1
  19. package/dist/routes/signup.d.ts +3 -0
  20. package/dist/routes/signup.js +3 -0
  21. package/dist/routes/signup.js.map +1 -1
  22. package/dist/routes/workspace-onboarding.d.ts +3 -0
  23. package/dist/routes/workspace-onboarding.d.ts.map +1 -1
  24. package/dist/routes/workspace-onboarding.js +3 -0
  25. package/dist/routes/workspace-onboarding.js.map +1 -1
  26. package/dist/tsconfig.test.tsbuildinfo +1 -1
  27. package/package.json +5 -5
  28. package/src/pages/workspace-onboarding-page.test.tsx +16 -6
  29. package/src/pages/workspace-onboarding-page.tsx +104 -174
  30. package/src/routes/index.tsx +1 -0
  31. package/src/routes/login.tsx +1 -0
  32. package/src/routes/logout.tsx +5 -1
  33. package/src/routes/reset.tsx +1 -0
  34. package/src/routes/signup.tsx +1 -0
  35. package/src/routes/workspace-onboarding.tsx +1 -0
  36. package/tsconfig.build.tsbuildinfo +1 -1
@@ -1,2 +1,2 @@
1
1
  $ shipfox-swc
2
- Successfully compiled: 42 files with swc (427.37ms)
2
+ Successfully compiled: 42 files with swc (701.38ms)
package/CHANGELOG.md CHANGED
@@ -1,5 +1,39 @@
1
1
  # @shipfox/client-auth
2
2
 
3
+ ## 22.0.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 50b3867: Consolidate authentication, onboarding, integration-install, and callback surfaces onto the shared focused frame.
8
+ - Updated dependencies [50b3867]
9
+ - Updated dependencies [00c1cb8]
10
+ - Updated dependencies [7693eb3]
11
+ - Updated dependencies [00c1cb8]
12
+ - Updated dependencies [56f4526]
13
+ - @shipfox/client-invitations@22.0.0
14
+ - @shipfox/client-shell@22.0.0
15
+ - @shipfox/react-ui@2.1.0
16
+ - @shipfox/client-ui@22.0.0
17
+
18
+ ## 21.0.0
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies [0f4abe4]
23
+ - Updated dependencies [71d0c44]
24
+ - Updated dependencies [9c21429]
25
+ - Updated dependencies [30beb8f]
26
+ - Updated dependencies [16733a7]
27
+ - Updated dependencies [163c40a]
28
+ - Updated dependencies [c4376a1]
29
+ - Updated dependencies [6703982]
30
+ - Updated dependencies [f1d127e]
31
+ - Updated dependencies [0e860d7]
32
+ - @shipfox/react-ui@2.0.0
33
+ - @shipfox/client-shell@21.0.0
34
+ - @shipfox/client-invitations@21.0.0
35
+ - @shipfox/client-ui@21.0.0
36
+
3
37
  ## 17.0.0
4
38
 
5
39
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"workspace-onboarding-page.d.ts","sourceRoot":"","sources":["../../src/pages/workspace-onboarding-page.tsx"],"names":[],"mappings":"AAwCA,wBAAgB,uBAAuB,gCA6MtC"}
1
+ {"version":3,"file":"workspace-onboarding-page.d.ts","sourceRoot":"","sources":["../../src/pages/workspace-onboarding-page.tsx"],"names":[],"mappings":"AAwBA,wBAAgB,uBAAuB,gCA8KtC"}
@@ -1,12 +1,13 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { slugifyName, slugSchema } from '@shipfox/api-common-dto';
3
3
  import { createWorkspaceBodySchema } from '@shipfox/api-workspaces-dto';
4
+ import { FocusedFrame } from '@shipfox/client-shell/runtime';
4
5
  import { displayNameFieldError, SlugField } from '@shipfox/client-ui';
5
6
  import { Button } from '@shipfox/react-ui/button';
6
7
  import { Callout } from '@shipfox/react-ui/callout';
7
- import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@shipfox/react-ui/card';
8
8
  import { FormField, FormFieldInput, fieldError } from '@shipfox/react-ui/form-field';
9
9
  import { Icon } from '@shipfox/react-ui/icon';
10
+ import { Panel, PanelBody, PanelHeader, PanelTitle } from '@shipfox/react-ui/panel';
10
11
  import { toast } from '@shipfox/react-ui/toast';
11
12
  import { Text } from '@shipfox/react-ui/typography';
12
13
  import { useForm } from '@tanstack/react-form';
@@ -17,58 +18,6 @@ import { checkWorkspaceSlugAvailability, useCreateWorkspaceAuth } from '#hooks/a
17
18
  import { useAuthState } from '#hooks/use-auth-state.js';
18
19
  import { lastWorkspaceIdAtom, rememberLastWorkspaceId } from '#state/last-workspace.js';
19
20
  import { workspaceOnboardingErrorToFormError } from './form-errors.js';
20
- const previewMetrics = [
21
- {
22
- label: 'Runs',
23
- value: '--'
24
- },
25
- {
26
- label: 'Passed',
27
- value: '--'
28
- },
29
- {
30
- label: 'Failed',
31
- value: '--'
32
- },
33
- {
34
- label: 'Duration',
35
- value: '--'
36
- }
37
- ];
38
- const previewBars = [
39
- {
40
- id: 'runs-start',
41
- height: 32
42
- },
43
- {
44
- id: 'runs-mid-low',
45
- height: 48
46
- },
47
- {
48
- id: 'runs-dip',
49
- height: 28
50
- },
51
- {
52
- id: 'runs-mid-high',
53
- height: 66
54
- },
55
- {
56
- id: 'runs-mid',
57
- height: 54
58
- },
59
- {
60
- id: 'runs-peak',
61
- height: 82
62
- },
63
- {
64
- id: 'runs-late-low',
65
- height: 44
66
- },
67
- {
68
- id: 'runs-late-high',
69
- height: 74
70
- }
71
- ];
72
21
  function isSlugValid(value) {
73
22
  return slugSchema.safeParse(value).success;
74
23
  }
@@ -124,9 +73,9 @@ export function WorkspaceOnboardingPage() {
124
73
  }
125
74
  });
126
75
  return /*#__PURE__*/ _jsx("main", {
127
- className: "min-h-screen bg-background-subtle-base px-frame py-frame max-[520px]:px-row",
128
- children: /*#__PURE__*/ _jsxs("div", {
129
- className: "mx-auto flex min-h-[calc(100vh-64px)] w-full max-w-[1120px] flex-col gap-section",
76
+ className: "min-h-screen px-frame py-frame max-[520px]:px-row",
77
+ children: /*#__PURE__*/ _jsxs(FocusedFrame, {
78
+ className: "flex min-h-[calc(100vh-64px)] flex-col gap-section",
130
79
  children: [
131
80
  /*#__PURE__*/ _jsx("header", {
132
81
  className: "flex items-center justify-between",
@@ -148,204 +97,120 @@ export function WorkspaceOnboardingPage() {
148
97
  ]
149
98
  })
150
99
  }),
151
- /*#__PURE__*/ _jsxs("section", {
152
- className: "grid flex-1 items-center gap-region lg:grid-cols-[minmax(0,440px)_minmax(0,1fr)]",
153
- children: [
154
- /*#__PURE__*/ _jsx("form", {
155
- className: "relative z-10 w-full",
156
- noValidate: true,
157
- "aria-labelledby": "workspace-onboarding-title",
158
- onSubmit: (event)=>{
159
- event.preventDefault();
160
- event.stopPropagation();
161
- void form.handleSubmit();
162
- },
163
- children: /*#__PURE__*/ _jsxs(Card, {
164
- className: "gap-section p-panel shadow-button-neutral",
165
- children: [
166
- /*#__PURE__*/ _jsxs(CardHeader, {
167
- className: "gap-inline",
168
- children: [
169
- /*#__PURE__*/ _jsx(CardTitle, {
170
- id: "workspace-onboarding-title",
171
- variant: "h1",
172
- children: "Create your workspace"
173
- }),
174
- /*#__PURE__*/ _jsx(CardDescription, {
175
- children: "Give your team a place to collaborate."
176
- })
177
- ]
178
- }),
179
- formError ? /*#__PURE__*/ _jsx(Callout, {
180
- role: "alert",
181
- type: "error",
182
- children: formError
183
- }) : null,
184
- /*#__PURE__*/ _jsxs(CardContent, {
185
- className: "flex flex-col gap-inline",
186
- children: [
187
- /*#__PURE__*/ _jsx(form.Field, {
188
- name: "name",
189
- validators: {
190
- onBlur: ({ value })=>displayNameFieldError(value, 'Workspace name', createWorkspaceBodySchema.shape.name),
191
- onSubmit: ({ value })=>displayNameFieldError(value, 'Workspace name', createWorkspaceBodySchema.shape.name)
192
- },
193
- children: (field)=>/*#__PURE__*/ _jsx(FormField, {
194
- label: "Workspace name",
195
- id: "workspace-name",
196
- error: fieldError(field),
197
- children: /*#__PURE__*/ _jsx(FormFieldInput, {
198
- autoComplete: "organization",
199
- name: "name",
200
- placeholder: "Acme",
201
- type: "text",
202
- value: field.state.value,
203
- onChange: (event)=>{
204
- const name = event.target.value;
205
- field.handleChange(name);
206
- if (!slugTouched) {
207
- form.setFieldValue('slug', name ? slugifyName(name, {
208
- fallback: 'workspace'
209
- }) : '');
210
- }
211
- },
212
- onBlur: field.handleBlur
213
- })
214
- })
215
- }),
216
- /*#__PURE__*/ _jsx(form.Field, {
217
- name: "slug",
218
- validators: {
219
- onBlur: createWorkspaceBodySchema.shape.slug,
220
- onSubmit: createWorkspaceBodySchema.shape.slug
221
- },
222
- children: (field)=>/*#__PURE__*/ _jsx(SlugField, {
223
- id: "workspace-slug",
224
- label: "Workspace slug",
225
- name: "slug",
226
- value: field.state.value,
227
- onChange: (value)=>{
228
- setSlugTouched(true);
229
- field.handleChange(value);
230
- },
231
- onBlur: field.handleBlur,
232
- error: fieldError(field),
233
- description: /*#__PURE__*/ _jsx("span", {
234
- className: "break-all font-code",
235
- children: `${window.location.origin}/w/${field.state.value || 'acme'}`
236
- }),
237
- placeholder: "acme",
238
- checkEnabled: slugTouched,
239
- isValid: isSlugValid,
240
- checkAvailability: checkWorkspaceSlugAvailability
241
- })
242
- })
243
- ]
244
- }),
245
- /*#__PURE__*/ _jsx(Button, {
246
- className: "w-full",
247
- iconRight: "chevronRight",
248
- isLoading: createWorkspace.isPending,
249
- type: "submit",
250
- children: createWorkspace.isPending ? 'Creating workspace...' : 'Create workspace'
251
- })
252
- ]
253
- })
254
- }),
255
- /*#__PURE__*/ _jsxs("div", {
256
- className: "hidden flex-col gap-group lg:flex",
257
- "aria-hidden": "true",
100
+ /*#__PURE__*/ _jsx("section", {
101
+ className: "flex flex-1 items-center",
102
+ children: /*#__PURE__*/ _jsx("form", {
103
+ className: "w-full",
104
+ noValidate: true,
105
+ "aria-labelledby": "workspace-onboarding-title",
106
+ onSubmit: (event)=>{
107
+ event.preventDefault();
108
+ event.stopPropagation();
109
+ void form.handleSubmit();
110
+ },
111
+ children: /*#__PURE__*/ _jsxs(Panel, {
258
112
  children: [
259
- /*#__PURE__*/ _jsx("div", {
260
- className: "grid grid-cols-4 gap-cluster",
261
- children: previewMetrics.map((metric)=>/*#__PURE__*/ _jsxs("div", {
262
- className: "rounded-8 border border-border-neutral-base bg-background-neutral-base p-panel-compact shadow-button-neutral",
263
- children: [
264
- /*#__PURE__*/ _jsx(Text, {
265
- size: "xs",
266
- className: "text-foreground-neutral-muted",
267
- children: metric.label
268
- }),
269
- /*#__PURE__*/ _jsx(Text, {
270
- size: "xl",
271
- bold: true,
272
- children: metric.value
273
- })
274
- ]
275
- }, metric.label))
276
- }),
277
- /*#__PURE__*/ _jsxs("div", {
278
- className: "grid grid-cols-2 gap-group",
113
+ /*#__PURE__*/ _jsxs(PanelHeader, {
114
+ variant: "plain",
115
+ className: "flex-col items-start gap-inline",
279
116
  children: [
280
- /*#__PURE__*/ _jsx(PreviewPanel, {
281
- title: "Performance over time"
117
+ /*#__PURE__*/ _jsx(PanelTitle, {
118
+ id: "workspace-onboarding-title",
119
+ variant: "h1",
120
+ children: "Create your workspace"
282
121
  }),
283
- /*#__PURE__*/ _jsx(PreviewPanel, {
284
- title: "Duration distribution",
285
- bars: true
122
+ /*#__PURE__*/ _jsx(Text, {
123
+ size: "sm",
124
+ className: "text-foreground-neutral-muted",
125
+ children: "Give your team a place to collaborate."
286
126
  })
287
127
  ]
288
128
  }),
289
- /*#__PURE__*/ _jsxs("div", {
290
- className: "flex flex-col gap-cluster rounded-8 border border-border-neutral-base bg-background-neutral-base p-panel-compact shadow-button-neutral",
129
+ /*#__PURE__*/ _jsxs(PanelBody, {
130
+ className: "flex flex-col gap-section p-panel",
291
131
  children: [
292
- /*#__PURE__*/ _jsx(Text, {
293
- size: "sm",
294
- bold: true,
295
- children: "Jobs breakdown"
296
- }),
297
- /*#__PURE__*/ _jsx("div", {
132
+ formError ? /*#__PURE__*/ _jsx(Callout, {
133
+ role: "alert",
134
+ type: "error",
135
+ children: formError
136
+ }) : null,
137
+ /*#__PURE__*/ _jsxs("div", {
298
138
  className: "flex flex-col gap-inline",
299
139
  children: [
300
- 0,
301
- 1,
302
- 2,
303
- 3
304
- ].map((row)=>/*#__PURE__*/ _jsxs("div", {
305
- className: "grid grid-cols-[1fr_80px_80px] gap-cluster border-t border-border-neutral-base pt-[10px]",
306
- children: [
307
- /*#__PURE__*/ _jsx("div", {
308
- className: "h-12 rounded-full bg-background-neutral-disabled"
309
- }),
310
- /*#__PURE__*/ _jsx("div", {
311
- className: "h-12 rounded-full bg-background-neutral-disabled"
312
- }),
313
- /*#__PURE__*/ _jsx("div", {
314
- className: "h-12 rounded-full bg-background-neutral-disabled"
140
+ /*#__PURE__*/ _jsx(form.Field, {
141
+ name: "name",
142
+ validators: {
143
+ onBlur: ({ value })=>displayNameFieldError(value, 'Workspace name', createWorkspaceBodySchema.shape.name),
144
+ onSubmit: ({ value })=>displayNameFieldError(value, 'Workspace name', createWorkspaceBodySchema.shape.name)
145
+ },
146
+ children: (field)=>/*#__PURE__*/ _jsx(FormField, {
147
+ label: "Workspace name",
148
+ id: "workspace-name",
149
+ error: fieldError(field),
150
+ children: /*#__PURE__*/ _jsx(FormFieldInput, {
151
+ autoComplete: "organization",
152
+ name: "name",
153
+ placeholder: "Acme",
154
+ type: "text",
155
+ value: field.state.value,
156
+ onChange: (event)=>{
157
+ const name = event.target.value;
158
+ field.handleChange(name);
159
+ if (!slugTouched) {
160
+ form.setFieldValue('slug', name ? slugifyName(name, {
161
+ fallback: 'workspace'
162
+ }) : '');
163
+ }
164
+ },
165
+ onBlur: field.handleBlur
166
+ })
167
+ })
168
+ }),
169
+ /*#__PURE__*/ _jsx(form.Field, {
170
+ name: "slug",
171
+ validators: {
172
+ onBlur: createWorkspaceBodySchema.shape.slug,
173
+ onSubmit: createWorkspaceBodySchema.shape.slug
174
+ },
175
+ children: (field)=>/*#__PURE__*/ _jsx(SlugField, {
176
+ id: "workspace-slug",
177
+ label: "Workspace slug",
178
+ name: "slug",
179
+ value: field.state.value,
180
+ onChange: (value)=>{
181
+ setSlugTouched(true);
182
+ field.handleChange(value);
183
+ },
184
+ onBlur: field.handleBlur,
185
+ error: fieldError(field),
186
+ description: /*#__PURE__*/ _jsx("span", {
187
+ className: "break-all font-code",
188
+ children: `${window.location.origin}/w/${field.state.value || 'acme'}`
189
+ }),
190
+ placeholder: "acme",
191
+ checkEnabled: slugTouched,
192
+ isValid: isSlugValid,
193
+ checkAvailability: checkWorkspaceSlugAvailability
315
194
  })
316
- ]
317
- }, row))
195
+ })
196
+ ]
197
+ }),
198
+ /*#__PURE__*/ _jsx(Button, {
199
+ className: "w-full",
200
+ iconRight: "chevronRight",
201
+ isLoading: createWorkspace.isPending,
202
+ type: "submit",
203
+ children: createWorkspace.isPending ? 'Creating workspace...' : 'Create workspace'
318
204
  })
319
205
  ]
320
206
  })
321
207
  ]
322
208
  })
323
- ]
209
+ })
324
210
  })
325
211
  ]
326
212
  })
327
213
  });
328
214
  }
329
- function PreviewPanel({ title, bars = false }) {
330
- return /*#__PURE__*/ _jsxs("div", {
331
- className: "flex flex-col gap-group rounded-8 border border-border-neutral-base bg-background-neutral-base p-panel-compact shadow-button-neutral",
332
- children: [
333
- /*#__PURE__*/ _jsx(Text, {
334
- size: "sm",
335
- bold: true,
336
- children: title
337
- }),
338
- /*#__PURE__*/ _jsx("div", {
339
- className: "flex h-[220px] items-end gap-inline border-b border-l border-border-neutral-base px-row pb-[10px]",
340
- children: previewBars.map((bar)=>/*#__PURE__*/ _jsx("div", {
341
- className: bars ? 'w-full rounded-t-4 bg-background-neutral-disabled' : 'w-full rounded-full bg-background-neutral-disabled',
342
- style: {
343
- height: `${bar.height}%`
344
- }
345
- }, `${title}-${bar.id}`))
346
- })
347
- ]
348
- });
349
- }
350
215
 
351
216
  //# sourceMappingURL=workspace-onboarding-page.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/pages/workspace-onboarding-page.tsx"],"sourcesContent":["import {slugifyName, slugSchema} from '@shipfox/api-common-dto';\nimport {createWorkspaceBodySchema} from '@shipfox/api-workspaces-dto';\nimport {displayNameFieldError, SlugField} from '@shipfox/client-ui';\nimport {Button} from '@shipfox/react-ui/button';\nimport {Callout} from '@shipfox/react-ui/callout';\nimport {Card, CardContent, CardDescription, CardHeader, CardTitle} from '@shipfox/react-ui/card';\nimport {FormField, FormFieldInput, fieldError} from '@shipfox/react-ui/form-field';\nimport {Icon} from '@shipfox/react-ui/icon';\nimport {toast} from '@shipfox/react-ui/toast';\nimport {Text} from '@shipfox/react-ui/typography';\nimport {useForm} from '@tanstack/react-form';\nimport {useNavigate} from '@tanstack/react-router';\nimport {useSetAtom} from 'jotai';\nimport {useState} from 'react';\nimport {checkWorkspaceSlugAvailability, useCreateWorkspaceAuth} from '#hooks/api/workspace-auth.js';\nimport {useAuthState} from '#hooks/use-auth-state.js';\nimport {lastWorkspaceIdAtom, rememberLastWorkspaceId} from '#state/last-workspace.js';\nimport {workspaceOnboardingErrorToFormError} from './form-errors.js';\n\nconst previewMetrics = [\n {label: 'Runs', value: '--'},\n {label: 'Passed', value: '--'},\n {label: 'Failed', value: '--'},\n {label: 'Duration', value: '--'},\n];\nconst previewBars = [\n {id: 'runs-start', height: 32},\n {id: 'runs-mid-low', height: 48},\n {id: 'runs-dip', height: 28},\n {id: 'runs-mid-high', height: 66},\n {id: 'runs-mid', height: 54},\n {id: 'runs-peak', height: 82},\n {id: 'runs-late-low', height: 44},\n {id: 'runs-late-high', height: 74},\n];\n\nfunction isSlugValid(value: string): boolean {\n return slugSchema.safeParse(value).success;\n}\n\nexport function WorkspaceOnboardingPage() {\n const createWorkspace = useCreateWorkspaceAuth();\n const {user} = useAuthState();\n const navigate = useNavigate();\n const setLastWorkspaceId = useSetAtom(lastWorkspaceIdAtom);\n const [formError, setFormError] = useState<string | undefined>();\n const [slugTouched, setSlugTouched] = useState(false);\n\n const form = useForm({\n defaultValues: {name: '', slug: ''},\n onSubmit: async ({value}) => {\n setFormError(undefined);\n try {\n const command = createWorkspaceBodySchema.parse({name: value.name, slug: value.slug});\n const created = await createWorkspace.mutateAsync(command);\n toast.success('Workspace created.');\n // Pin the new workspace as the last-active one so a page refresh and\n // future visits to `/` land on it.\n try {\n setLastWorkspaceId(created.id);\n if (user?.id) rememberLastWorkspaceId(user.id, created.id);\n } catch {\n // localStorage may throw in private browsing or quota-exceeded.\n }\n await navigate({to: '/w/$workspaceSlug', params: {workspaceSlug: created.slug}});\n } catch (error) {\n const mapped = workspaceOnboardingErrorToFormError(error);\n if (mapped.kind === 'field') {\n form.setFieldMeta(mapped.field, (previous) => ({\n ...previous,\n errorMap: {...previous.errorMap, onServer: mapped.message},\n }));\n } else {\n setFormError(mapped.message);\n }\n }\n },\n });\n\n return (\n <main className=\"min-h-screen bg-background-subtle-base px-frame py-frame max-[520px]:px-row\">\n <div className=\"mx-auto flex min-h-[calc(100vh-64px)] w-full max-w-[1120px] flex-col gap-section\">\n <header className=\"flex items-center justify-between\">\n <div className=\"flex items-center gap-inline\">\n <div className=\"flex size-36 items-center justify-center rounded-8 border border-border-neutral-base bg-background-neutral-base shadow-button-neutral\">\n <Icon name=\"shipfox\" className=\"size-24 text-background-highlight-interactive\" />\n </div>\n <Text size=\"md\" bold>\n Shipfox\n </Text>\n </div>\n </header>\n\n <section className=\"grid flex-1 items-center gap-region lg:grid-cols-[minmax(0,440px)_minmax(0,1fr)]\">\n <form\n className=\"relative z-10 w-full\"\n noValidate\n aria-labelledby=\"workspace-onboarding-title\"\n onSubmit={(event) => {\n event.preventDefault();\n event.stopPropagation();\n void form.handleSubmit();\n }}\n >\n <Card className=\"gap-section p-panel shadow-button-neutral\">\n <CardHeader className=\"gap-inline\">\n <CardTitle id=\"workspace-onboarding-title\" variant=\"h1\">\n Create your workspace\n </CardTitle>\n <CardDescription>Give your team a place to collaborate.</CardDescription>\n </CardHeader>\n\n {formError ? (\n <Callout role=\"alert\" type=\"error\">\n {formError}\n </Callout>\n ) : null}\n\n <CardContent className=\"flex flex-col gap-inline\">\n <form.Field\n name=\"name\"\n validators={{\n onBlur: ({value}) =>\n displayNameFieldError(\n value,\n 'Workspace name',\n createWorkspaceBodySchema.shape.name,\n ),\n onSubmit: ({value}) =>\n displayNameFieldError(\n value,\n 'Workspace name',\n createWorkspaceBodySchema.shape.name,\n ),\n }}\n >\n {(field) => (\n <FormField label=\"Workspace name\" id=\"workspace-name\" error={fieldError(field)}>\n <FormFieldInput\n autoComplete=\"organization\"\n name=\"name\"\n placeholder=\"Acme\"\n type=\"text\"\n value={field.state.value}\n onChange={(event) => {\n const name = event.target.value;\n field.handleChange(name);\n if (!slugTouched) {\n form.setFieldValue(\n 'slug',\n name ? slugifyName(name, {fallback: 'workspace'}) : '',\n );\n }\n }}\n onBlur={field.handleBlur}\n />\n </FormField>\n )}\n </form.Field>\n <form.Field\n name=\"slug\"\n validators={{\n onBlur: createWorkspaceBodySchema.shape.slug,\n onSubmit: createWorkspaceBodySchema.shape.slug,\n }}\n >\n {(field) => (\n <SlugField\n id=\"workspace-slug\"\n label=\"Workspace slug\"\n name=\"slug\"\n value={field.state.value}\n onChange={(value) => {\n setSlugTouched(true);\n field.handleChange(value);\n }}\n onBlur={field.handleBlur}\n error={fieldError(field)}\n description={\n <span className=\"break-all font-code\">\n {`${window.location.origin}/w/${field.state.value || 'acme'}`}\n </span>\n }\n placeholder=\"acme\"\n checkEnabled={slugTouched}\n isValid={isSlugValid}\n checkAvailability={checkWorkspaceSlugAvailability}\n />\n )}\n </form.Field>\n </CardContent>\n\n <Button\n className=\"w-full\"\n iconRight=\"chevronRight\"\n isLoading={createWorkspace.isPending}\n type=\"submit\"\n >\n {createWorkspace.isPending ? 'Creating workspace...' : 'Create workspace'}\n </Button>\n </Card>\n </form>\n\n <div className=\"hidden flex-col gap-group lg:flex\" aria-hidden=\"true\">\n <div className=\"grid grid-cols-4 gap-cluster\">\n {previewMetrics.map((metric) => (\n <div\n className=\"rounded-8 border border-border-neutral-base bg-background-neutral-base p-panel-compact shadow-button-neutral\"\n key={metric.label}\n >\n <Text size=\"xs\" className=\"text-foreground-neutral-muted\">\n {metric.label}\n </Text>\n <Text size=\"xl\" bold>\n {metric.value}\n </Text>\n </div>\n ))}\n </div>\n <div className=\"grid grid-cols-2 gap-group\">\n <PreviewPanel title=\"Performance over time\" />\n <PreviewPanel title=\"Duration distribution\" bars />\n </div>\n <div className=\"flex flex-col gap-cluster rounded-8 border border-border-neutral-base bg-background-neutral-base p-panel-compact shadow-button-neutral\">\n <Text size=\"sm\" bold>\n Jobs breakdown\n </Text>\n <div className=\"flex flex-col gap-inline\">\n {[0, 1, 2, 3].map((row) => (\n <div\n className=\"grid grid-cols-[1fr_80px_80px] gap-cluster border-t border-border-neutral-base pt-[10px]\"\n key={row}\n >\n <div className=\"h-12 rounded-full bg-background-neutral-disabled\" />\n <div className=\"h-12 rounded-full bg-background-neutral-disabled\" />\n <div className=\"h-12 rounded-full bg-background-neutral-disabled\" />\n </div>\n ))}\n </div>\n </div>\n </div>\n </section>\n </div>\n </main>\n );\n}\n\nfunction PreviewPanel({title, bars = false}: {title: string; bars?: boolean}) {\n return (\n <div className=\"flex flex-col gap-group rounded-8 border border-border-neutral-base bg-background-neutral-base p-panel-compact shadow-button-neutral\">\n <Text size=\"sm\" bold>\n {title}\n </Text>\n <div className=\"flex h-[220px] items-end gap-inline border-b border-l border-border-neutral-base px-row pb-[10px]\">\n {previewBars.map((bar) => (\n <div\n className={\n bars\n ? 'w-full rounded-t-4 bg-background-neutral-disabled'\n : 'w-full rounded-full bg-background-neutral-disabled'\n }\n key={`${title}-${bar.id}`}\n style={{height: `${bar.height}%`}}\n />\n ))}\n </div>\n </div>\n );\n}\n"],"names":["slugifyName","slugSchema","createWorkspaceBodySchema","displayNameFieldError","SlugField","Button","Callout","Card","CardContent","CardDescription","CardHeader","CardTitle","FormField","FormFieldInput","fieldError","Icon","toast","Text","useForm","useNavigate","useSetAtom","useState","checkWorkspaceSlugAvailability","useCreateWorkspaceAuth","useAuthState","lastWorkspaceIdAtom","rememberLastWorkspaceId","workspaceOnboardingErrorToFormError","previewMetrics","label","value","previewBars","id","height","isSlugValid","safeParse","success","WorkspaceOnboardingPage","createWorkspace","user","navigate","setLastWorkspaceId","formError","setFormError","slugTouched","setSlugTouched","form","defaultValues","name","slug","onSubmit","undefined","command","parse","created","mutateAsync","to","params","workspaceSlug","error","mapped","kind","setFieldMeta","field","previous","errorMap","onServer","message","main","className","div","header","size","bold","section","noValidate","aria-labelledby","event","preventDefault","stopPropagation","handleSubmit","variant","role","type","Field","validators","onBlur","shape","autoComplete","placeholder","state","onChange","target","handleChange","setFieldValue","fallback","handleBlur","description","span","window","location","origin","checkEnabled","isValid","checkAvailability","iconRight","isLoading","isPending","aria-hidden","map","metric","PreviewPanel","title","bars","row","bar","style"],"mappings":";AAAA,SAAQA,WAAW,EAAEC,UAAU,QAAO,0BAA0B;AAChE,SAAQC,yBAAyB,QAAO,8BAA8B;AACtE,SAAQC,qBAAqB,EAAEC,SAAS,QAAO,qBAAqB;AACpE,SAAQC,MAAM,QAAO,2BAA2B;AAChD,SAAQC,OAAO,QAAO,4BAA4B;AAClD,SAAQC,IAAI,EAAEC,WAAW,EAAEC,eAAe,EAAEC,UAAU,EAAEC,SAAS,QAAO,yBAAyB;AACjG,SAAQC,SAAS,EAAEC,cAAc,EAAEC,UAAU,QAAO,+BAA+B;AACnF,SAAQC,IAAI,QAAO,yBAAyB;AAC5C,SAAQC,KAAK,QAAO,0BAA0B;AAC9C,SAAQC,I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AC5C;oDACCD,WAAU;;sEAGV,KAACC;4DAAID,WAAU;;sEACf,KAACC;4DAAID,WAAU;;sEACf,KAACC;4DAAID,WAAU;;;mDAJV6C;;;;;;;;;;;AAczB;AAEA,SAASH,aAAa,EAACC,KAAK,EAAEC,OAAO,KAAK,EAAkC;IAC1E,qBACE,MAAC3C;QAAID,WAAU;;0BACb,KAACpD;gBAAKuD,MAAK;gBAAKC,IAAI;0BACjBuC;;0BAEH,KAAC1C;gBAAID,WAAU;0BACZtC,YAAY8E,GAAG,CAAC,CAACM,oBAChB,KAAC7C;wBACCD,WACE4C,OACI,sDACA;wBAGNG,OAAO;4BAACnF,QAAQ,GAAGkF,IAAIlF,MAAM,CAAC,CAAC,CAAC;wBAAA;uBAD3B,GAAG+E,MAAM,CAAC,EAAEG,IAAInF,EAAE,EAAE;;;;AAOrC"}
1
+ {"version":3,"sources":["../../src/pages/workspace-onboarding-page.tsx"],"sourcesContent":["import {slugifyName, slugSchema} from '@shipfox/api-common-dto';\nimport {createWorkspaceBodySchema} from '@shipfox/api-workspaces-dto';\nimport {FocusedFrame} from '@shipfox/client-shell/runtime';\nimport {displayNameFieldError, SlugField} from '@shipfox/client-ui';\nimport {Button} from '@shipfox/react-ui/button';\nimport {Callout} from '@shipfox/react-ui/callout';\nimport {FormField, FormFieldInput, fieldError} from '@shipfox/react-ui/form-field';\nimport {Icon} from '@shipfox/react-ui/icon';\nimport {Panel, PanelBody, PanelHeader, PanelTitle} from '@shipfox/react-ui/panel';\nimport {toast} from '@shipfox/react-ui/toast';\nimport {Text} from '@shipfox/react-ui/typography';\nimport {useForm} from '@tanstack/react-form';\nimport {useNavigate} from '@tanstack/react-router';\nimport {useSetAtom} from 'jotai';\nimport {useState} from 'react';\nimport {checkWorkspaceSlugAvailability, useCreateWorkspaceAuth} from '#hooks/api/workspace-auth.js';\nimport {useAuthState} from '#hooks/use-auth-state.js';\nimport {lastWorkspaceIdAtom, rememberLastWorkspaceId} from '#state/last-workspace.js';\nimport {workspaceOnboardingErrorToFormError} from './form-errors.js';\n\nfunction isSlugValid(value: string): boolean {\n return slugSchema.safeParse(value).success;\n}\n\nexport function WorkspaceOnboardingPage() {\n const createWorkspace = useCreateWorkspaceAuth();\n const {user} = useAuthState();\n const navigate = useNavigate();\n const setLastWorkspaceId = useSetAtom(lastWorkspaceIdAtom);\n const [formError, setFormError] = useState<string | undefined>();\n const [slugTouched, setSlugTouched] = useState(false);\n\n const form = useForm({\n defaultValues: {name: '', slug: ''},\n onSubmit: async ({value}) => {\n setFormError(undefined);\n try {\n const command = createWorkspaceBodySchema.parse({name: value.name, slug: value.slug});\n const created = await createWorkspace.mutateAsync(command);\n toast.success('Workspace created.');\n // Pin the new workspace as the last-active one so a page refresh and\n // future visits to `/` land on it.\n try {\n setLastWorkspaceId(created.id);\n if (user?.id) rememberLastWorkspaceId(user.id, created.id);\n } catch {\n // localStorage may throw in private browsing or quota-exceeded.\n }\n await navigate({to: '/w/$workspaceSlug', params: {workspaceSlug: created.slug}});\n } catch (error) {\n const mapped = workspaceOnboardingErrorToFormError(error);\n if (mapped.kind === 'field') {\n form.setFieldMeta(mapped.field, (previous) => ({\n ...previous,\n errorMap: {...previous.errorMap, onServer: mapped.message},\n }));\n } else {\n setFormError(mapped.message);\n }\n }\n },\n });\n\n return (\n <main className=\"min-h-screen px-frame py-frame max-[520px]:px-row\">\n <FocusedFrame className=\"flex min-h-[calc(100vh-64px)] flex-col gap-section\">\n <header className=\"flex items-center justify-between\">\n <div className=\"flex items-center gap-inline\">\n <div className=\"flex size-36 items-center justify-center rounded-8 border border-border-neutral-base bg-background-neutral-base shadow-button-neutral\">\n <Icon name=\"shipfox\" className=\"size-24 text-background-highlight-interactive\" />\n </div>\n <Text size=\"md\" bold>\n Shipfox\n </Text>\n </div>\n </header>\n\n <section className=\"flex flex-1 items-center\">\n <form\n className=\"w-full\"\n noValidate\n aria-labelledby=\"workspace-onboarding-title\"\n onSubmit={(event) => {\n event.preventDefault();\n event.stopPropagation();\n void form.handleSubmit();\n }}\n >\n <Panel>\n <PanelHeader variant=\"plain\" className=\"flex-col items-start gap-inline\">\n <PanelTitle id=\"workspace-onboarding-title\" variant=\"h1\">\n Create your workspace\n </PanelTitle>\n <Text size=\"sm\" className=\"text-foreground-neutral-muted\">\n Give your team a place to collaborate.\n </Text>\n </PanelHeader>\n\n <PanelBody className=\"flex flex-col gap-section p-panel\">\n {formError ? (\n <Callout role=\"alert\" type=\"error\">\n {formError}\n </Callout>\n ) : null}\n\n <div className=\"flex flex-col gap-inline\">\n <form.Field\n name=\"name\"\n validators={{\n onBlur: ({value}) =>\n displayNameFieldError(\n value,\n 'Workspace name',\n createWorkspaceBodySchema.shape.name,\n ),\n onSubmit: ({value}) =>\n displayNameFieldError(\n value,\n 'Workspace name',\n createWorkspaceBodySchema.shape.name,\n ),\n }}\n >\n {(field) => (\n <FormField\n label=\"Workspace name\"\n id=\"workspace-name\"\n error={fieldError(field)}\n >\n <FormFieldInput\n autoComplete=\"organization\"\n name=\"name\"\n placeholder=\"Acme\"\n type=\"text\"\n value={field.state.value}\n onChange={(event) => {\n const name = event.target.value;\n field.handleChange(name);\n if (!slugTouched) {\n form.setFieldValue(\n 'slug',\n name ? slugifyName(name, {fallback: 'workspace'}) : '',\n );\n }\n }}\n onBlur={field.handleBlur}\n />\n </FormField>\n )}\n </form.Field>\n <form.Field\n name=\"slug\"\n validators={{\n onBlur: createWorkspaceBodySchema.shape.slug,\n onSubmit: createWorkspaceBodySchema.shape.slug,\n }}\n >\n {(field) => (\n <SlugField\n id=\"workspace-slug\"\n label=\"Workspace slug\"\n name=\"slug\"\n value={field.state.value}\n onChange={(value) => {\n setSlugTouched(true);\n field.handleChange(value);\n }}\n onBlur={field.handleBlur}\n error={fieldError(field)}\n description={\n <span className=\"break-all font-code\">\n {`${window.location.origin}/w/${field.state.value || 'acme'}`}\n </span>\n }\n placeholder=\"acme\"\n checkEnabled={slugTouched}\n isValid={isSlugValid}\n checkAvailability={checkWorkspaceSlugAvailability}\n />\n )}\n </form.Field>\n </div>\n\n <Button\n className=\"w-full\"\n iconRight=\"chevronRight\"\n isLoading={createWorkspace.isPending}\n type=\"submit\"\n >\n {createWorkspace.isPending ? 'Creating workspace...' : 'Create workspace'}\n </Button>\n </PanelBody>\n </Panel>\n </form>\n </section>\n </FocusedFrame>\n </main>\n );\n}\n"],"names":["slugifyName","slugSchema","createWorkspaceBodySchema","FocusedFrame","displayNameFieldError","SlugField","Button","Callout","FormField","FormFieldInput","fieldError","Icon","Panel","PanelBody","PanelHeader","PanelTitle","toast","Text","useForm","useNavigate","useSetAtom","useState","checkWorkspaceSlugAvailability","useCreateWorkspaceAuth","useAuthState","lastWorkspaceIdAtom","rememberLastWorkspaceId","workspaceOnboardingErrorToFormError","isSlugValid","value","safeParse","success","WorkspaceOnboardingPage","createWorkspace","user","navigate","setLastWorkspaceId","formError","setFormError","slugTouched","setSlugTouched","form","defaultValues","name","slug","onSubmit","undefined","command","parse","created","mutateAsync","id","to","params","workspaceSlug","error","mapped","kind","setFieldMeta","field","previous","errorMap","onServer","message","main","className","header","div","size","bold","section","noValidate","aria-labelledby","event","preventDefault","stopPropagation","handleSubmit","variant","role","type","Field","validators","onBlur","shape","label","autoComplete","placeholder","state","onChange","target","handleChange","setFieldValue","fallback","handleBlur","description","span","window","location","origin","checkEnabled","isValid","checkAvailability","iconRight","isLoading","isPending"],"mappings":";AAAA,SAAQA,WAAW,EAAEC,UAAU,QAAO,0BAA0B;AAChE,SAAQC,yBAAyB,QAAO,8BAA8B;AACtE,SAAQC,YAAY,QAAO,gCAAgC;AAC3D,SAAQC,qBAAqB,EAAEC,SAAS,QAAO,qBAAqB;AACpE,SAAQC,MAAM,QAAO,2BAA2B;AAChD,SAAQC,OAAO,QAAO,4BAA4B;AAClD,SAAQC,SAAS,EAAEC,cAAc,EAAEC,UAAU,QAAO,+BAA+B;AACnF,SAAQC,IAAI,QAAO,yBAAyB;AAC5C,SAAQC,KAAK,EAAEC,SAAS,EAAEC,WAAW,E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AK,CAAC1D,KAAK,IAAI,QAAQ;;4DAGjEyD,aAAY;4DACZa,cAAc5D;4DACd6D,SAASxE;4DACTyE,mBAAmB/E;;;;;sDAM3B,KAAChB;4CACC2D,WAAU;4CACVqC,WAAU;4CACVC,WAAWtE,gBAAgBuE,SAAS;4CACpCzB,MAAK;sDAEJ9C,gBAAgBuE,SAAS,GAAG,0BAA0B;;;;;;;;;;;AASzE"}
@@ -1,6 +1,9 @@
1
1
  import type { RouterContext } from '@shipfox/client-shell/runtime';
2
2
  import { FullPageLoader } from '@shipfox/react-ui/loader';
3
3
  declare const _default: import("@shipfox/client-shell/runtime").RouteImpl<{
4
+ readonly staticData: {
5
+ readonly frame: "focused";
6
+ };
4
7
  readonly beforeLoad: ({ context }: {
5
8
  context: RouterContext;
6
9
  }) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/routes/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,+BAA+B,CAAC;AAEjE,OAAO,EAAC,cAAc,EAAC,MAAM,0BAA0B,CAAC;;uCAI9B;QAAC,OAAO,EAAE,aAAa,CAAA;KAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/routes/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,+BAA+B,CAAC;AAEjE,OAAO,EAAC,cAAc,EAAC,MAAM,0BAA0B,CAAC;;;;;uCAK9B;QAAC,OAAO,EAAE,aAAa,CAAA;KAAC"}
@@ -2,6 +2,9 @@ import { defineRoute, getLastWorkspaceId } from '@shipfox/client-shell/runtime';
2
2
  import { FullPageLoader } from '@shipfox/react-ui/loader';
3
3
  import { redirect } from '@tanstack/react-router';
4
4
  export default defineRoute({
5
+ staticData: {
6
+ frame: 'focused'
7
+ },
5
8
  beforeLoad: ({ context })=>{
6
9
  const auth = context.auth;
7
10
  if (!auth || auth.isLoading) return;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/routes/index.tsx"],"sourcesContent":["import type {RouterContext} from '@shipfox/client-shell/runtime';\nimport {defineRoute, getLastWorkspaceId} from '@shipfox/client-shell/runtime';\nimport {FullPageLoader} from '@shipfox/react-ui/loader';\nimport {redirect} from '@tanstack/react-router';\n\nexport default defineRoute({\n beforeLoad: ({context}: {context: RouterContext}) => {\n const auth = context.auth;\n if (!auth || auth.isLoading) return;\n if (!auth.isAuthenticated) throw redirect({to: '/auth/login'});\n const [first, ...rest] = auth.workspaces;\n if (!first) throw redirect({to: '/setup/workspaces/new'});\n const principalId = auth.user?.id;\n const target = principalId\n ? [first, ...rest].find((workspace) => workspace.id === getLastWorkspaceId(principalId))\n : undefined;\n throw redirect({\n to: '/w/$workspaceSlug',\n params: {workspaceSlug: (target ?? first).slug},\n });\n },\n component: FullPageLoader,\n});\n"],"names":["defineRoute","getLastWorkspaceId","FullPageLoader","redirect","beforeLoad","context","auth","isLoading","isAuthenticated","to","first","rest","workspaces","principalId","user","id","target","find","workspace","undefined","params","workspaceSlug","slug","component"],"mappings":"AACA,SAAQA,WAAW,EAAEC,kBAAkB,QAAO,gCAAgC;AAC9E,SAAQC,cAAc,QAAO,2BAA2B;AACxD,SAAQC,QAAQ,QAAO,yBAAyB;AAEhD,eAAeH,YAAY;IACzBI,YAAY,CAAC,EAACC,OAAO,EAA2B;QAC9C,MAAMC,OAAOD,QAAQC,IAAI;QACzB,IAAI,CAACA,QAAQA,KAAKC,SAAS,EAAE;QAC7B,IAAI,CAACD,KAAKE,eAAe,EAAE,MAAML,SAAS;YAACM,IAAI;QAAa;QAC5D,MAAM,CAACC,OAAO,GAAGC,KAAK,GAAGL,KAAKM,UAAU;QACxC,IAAI,CAACF,OAAO,MAAMP,SAAS;YAACM,IAAI;QAAuB;QACvD,MAAMI,cAAcP,KAAKQ,IAAI,EAAEC;QAC/B,MAAMC,SAASH,cACX;YAACH;eAAUC;SAAK,CAACM,IAAI,CAAC,CAACC,YAAcA,UAAUH,EAAE,KAAKd,mBAAmBY,gBACzEM;QACJ,MAAMhB,SAAS;YACbM,IAAI;YACJW,QAAQ;gBAACC,eAAe,AAACL,CAAAA,UAAUN,KAAI,EAAGY,IAAI;YAAA;QAChD;IACF;IACAC,WAAWrB;AACb,GAAG"}
1
+ {"version":3,"sources":["../../src/routes/index.tsx"],"sourcesContent":["import type {RouterContext} from '@shipfox/client-shell/runtime';\nimport {defineRoute, getLastWorkspaceId} from '@shipfox/client-shell/runtime';\nimport {FullPageLoader} from '@shipfox/react-ui/loader';\nimport {redirect} from '@tanstack/react-router';\n\nexport default defineRoute({\n staticData: {frame: 'focused'},\n beforeLoad: ({context}: {context: RouterContext}) => {\n const auth = context.auth;\n if (!auth || auth.isLoading) return;\n if (!auth.isAuthenticated) throw redirect({to: '/auth/login'});\n const [first, ...rest] = auth.workspaces;\n if (!first) throw redirect({to: '/setup/workspaces/new'});\n const principalId = auth.user?.id;\n const target = principalId\n ? [first, ...rest].find((workspace) => workspace.id === getLastWorkspaceId(principalId))\n : undefined;\n throw redirect({\n to: '/w/$workspaceSlug',\n params: {workspaceSlug: (target ?? first).slug},\n });\n },\n component: FullPageLoader,\n});\n"],"names":["defineRoute","getLastWorkspaceId","FullPageLoader","redirect","staticData","frame","beforeLoad","context","auth","isLoading","isAuthenticated","to","first","rest","workspaces","principalId","user","id","target","find","workspace","undefined","params","workspaceSlug","slug","component"],"mappings":"AACA,SAAQA,WAAW,EAAEC,kBAAkB,QAAO,gCAAgC;AAC9E,SAAQC,cAAc,QAAO,2BAA2B;AACxD,SAAQC,QAAQ,QAAO,yBAAyB;AAEhD,eAAeH,YAAY;IACzBI,YAAY;QAACC,OAAO;IAAS;IAC7BC,YAAY,CAAC,EAACC,OAAO,EAA2B;QAC9C,MAAMC,OAAOD,QAAQC,IAAI;QACzB,IAAI,CAACA,QAAQA,KAAKC,SAAS,EAAE;QAC7B,IAAI,CAACD,KAAKE,eAAe,EAAE,MAAMP,SAAS;YAACQ,IAAI;QAAa;QAC5D,MAAM,CAACC,OAAO,GAAGC,KAAK,GAAGL,KAAKM,UAAU;QACxC,IAAI,CAACF,OAAO,MAAMT,SAAS;YAACQ,IAAI;QAAuB;QACvD,MAAMI,cAAcP,KAAKQ,IAAI,EAAEC;QAC/B,MAAMC,SAASH,cACX;YAACH;eAAUC;SAAK,CAACM,IAAI,CAAC,CAACC,YAAcA,UAAUH,EAAE,KAAKhB,mBAAmBc,gBACzEM;QACJ,MAAMlB,SAAS;YACbQ,IAAI;YACJW,QAAQ;gBAACC,eAAe,AAACL,CAAAA,UAAUN,KAAI,EAAGY,IAAI;YAAA;QAChD;IACF;IACAC,WAAWvB;AACb,GAAG"}
@@ -1,5 +1,8 @@
1
1
  import { validateRedirectSearch } from './inputs.js';
2
2
  declare const _default: import("@shipfox/client-shell/runtime").RouteImpl<{
3
+ readonly staticData: {
4
+ readonly frame: "focused";
5
+ };
3
6
  readonly validateSearch: typeof validateRedirectSearch;
4
7
  readonly component: () => import("react").JSX.Element;
5
8
  }>;
@@ -4,6 +4,9 @@ import { GuestGuard } from '#components/auth-guard.js';
4
4
  import { LoginPage } from '#pages/login-page.js';
5
5
  import { validateRedirectSearch } from './inputs.js';
6
6
  export default defineRoute({
7
+ staticData: {
8
+ frame: 'focused'
9
+ },
7
10
  validateSearch: validateRedirectSearch,
8
11
  component: ()=>/*#__PURE__*/ _jsx(GuestGuard, {
9
12
  children: /*#__PURE__*/ _jsx(LoginPage, {})
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/routes/login.tsx"],"sourcesContent":["import {defineRoute} from '@shipfox/client-shell/runtime';\nimport {GuestGuard} from '#components/auth-guard.js';\nimport {LoginPage} from '#pages/login-page.js';\nimport {validateRedirectSearch} from './inputs.js';\n\nexport default defineRoute({\n validateSearch: validateRedirectSearch,\n component: () => (\n <GuestGuard>\n <LoginPage />\n </GuestGuard>\n ),\n});\n"],"names":["defineRoute","GuestGuard","LoginPage","validateRedirectSearch","validateSearch","component"],"mappings":";AAAA,SAAQA,WAAW,QAAO,gCAAgC;AAC1D,SAAQC,UAAU,QAAO,4BAA4B;AACrD,SAAQC,SAAS,QAAO,uBAAuB;AAC/C,SAAQC,sBAAsB,QAAO,cAAc;AAEnD,eAAeH,YAAY;IACzBI,gBAAgBD;IAChBE,WAAW,kBACT,KAACJ;sBACC,cAAA,KAACC;;AAGP,GAAG"}
1
+ {"version":3,"sources":["../../src/routes/login.tsx"],"sourcesContent":["import {defineRoute} from '@shipfox/client-shell/runtime';\nimport {GuestGuard} from '#components/auth-guard.js';\nimport {LoginPage} from '#pages/login-page.js';\nimport {validateRedirectSearch} from './inputs.js';\n\nexport default defineRoute({\n staticData: {frame: 'focused'},\n validateSearch: validateRedirectSearch,\n component: () => (\n <GuestGuard>\n <LoginPage />\n </GuestGuard>\n ),\n});\n"],"names":["defineRoute","GuestGuard","LoginPage","validateRedirectSearch","staticData","frame","validateSearch","component"],"mappings":";AAAA,SAAQA,WAAW,QAAO,gCAAgC;AAC1D,SAAQC,UAAU,QAAO,4BAA4B;AACrD,SAAQC,SAAS,QAAO,uBAAuB;AAC/C,SAAQC,sBAAsB,QAAO,cAAc;AAEnD,eAAeH,YAAY;IACzBI,YAAY;QAACC,OAAO;IAAS;IAC7BC,gBAAgBH;IAChBI,WAAW,kBACT,KAACN;sBACC,cAAA,KAACC;;AAGP,GAAG"}
@@ -1,6 +1,9 @@
1
1
  import { LogoutPage } from '#pages/logout-page.js';
2
2
  import { validateRedirectSearch } from './inputs.js';
3
3
  declare const _default: import("@shipfox/client-shell/runtime").RouteImpl<{
4
+ readonly staticData: {
5
+ readonly frame: "focused";
6
+ };
4
7
  readonly validateSearch: typeof validateRedirectSearch;
5
8
  readonly component: typeof LogoutPage;
6
9
  }>;
@@ -2,6 +2,9 @@ import { defineRoute } from '@shipfox/client-shell/runtime';
2
2
  import { LogoutPage } from '#pages/logout-page.js';
3
3
  import { validateRedirectSearch } from './inputs.js';
4
4
  export default defineRoute({
5
+ staticData: {
6
+ frame: 'focused'
7
+ },
5
8
  validateSearch: validateRedirectSearch,
6
9
  component: LogoutPage
7
10
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/routes/logout.tsx"],"sourcesContent":["import {defineRoute} from '@shipfox/client-shell/runtime';\nimport {LogoutPage} from '#pages/logout-page.js';\nimport {validateRedirectSearch} from './inputs.js';\n\nexport default defineRoute({validateSearch: validateRedirectSearch, component: LogoutPage});\n"],"names":["defineRoute","LogoutPage","validateRedirectSearch","validateSearch","component"],"mappings":"AAAA,SAAQA,WAAW,QAAO,gCAAgC;AAC1D,SAAQC,UAAU,QAAO,wBAAwB;AACjD,SAAQC,sBAAsB,QAAO,cAAc;AAEnD,eAAeF,YAAY;IAACG,gBAAgBD;IAAwBE,WAAWH;AAAU,GAAG"}
1
+ {"version":3,"sources":["../../src/routes/logout.tsx"],"sourcesContent":["import {defineRoute} from '@shipfox/client-shell/runtime';\nimport {LogoutPage} from '#pages/logout-page.js';\nimport {validateRedirectSearch} from './inputs.js';\n\nexport default defineRoute({\n staticData: {frame: 'focused'},\n validateSearch: validateRedirectSearch,\n component: LogoutPage,\n});\n"],"names":["defineRoute","LogoutPage","validateRedirectSearch","staticData","frame","validateSearch","component"],"mappings":"AAAA,SAAQA,WAAW,QAAO,gCAAgC;AAC1D,SAAQC,UAAU,QAAO,wBAAwB;AACjD,SAAQC,sBAAsB,QAAO,cAAc;AAEnD,eAAeF,YAAY;IACzBG,YAAY;QAACC,OAAO;IAAS;IAC7BC,gBAAgBH;IAChBI,WAAWL;AACb,GAAG"}