founder-schema 0.2.0 → 0.4.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.
- package/README.md +18 -15
- package/dist/access/access.d.ts +76 -0
- package/dist/access/access.d.ts.map +1 -0
- package/dist/access/access.js +66 -0
- package/dist/access/access.js.map +1 -0
- package/dist/access/permissions.d.ts +153 -0
- package/dist/access/permissions.d.ts.map +1 -0
- package/dist/access/permissions.js +80 -0
- package/dist/access/permissions.js.map +1 -0
- package/dist/access/roles.d.ts +71 -0
- package/dist/access/roles.d.ts.map +1 -0
- package/dist/access/roles.js +72 -0
- package/dist/access/roles.js.map +1 -0
- package/dist/account.d.ts +40 -0
- package/dist/account.d.ts.map +1 -0
- package/dist/account.js +39 -0
- package/dist/account.js.map +1 -0
- package/dist/chat.d.ts +4 -4
- package/dist/chat.d.ts.map +1 -1
- package/dist/chat.js +7 -2
- package/dist/chat.js.map +1 -1
- package/dist/core/common.d.ts +304 -0
- package/dist/core/common.d.ts.map +1 -0
- package/dist/core/common.js +340 -0
- package/dist/core/common.js.map +1 -0
- package/dist/core/errors.d.ts +105 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +115 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/limits.d.ts +99 -0
- package/dist/core/limits.d.ts.map +1 -0
- package/dist/core/limits.js +109 -0
- package/dist/core/limits.js.map +1 -0
- package/dist/core/responses.d.ts +195 -0
- package/dist/core/responses.d.ts.map +1 -0
- package/dist/core/responses.js +73 -0
- package/dist/core/responses.js.map +1 -0
- package/dist/core/validation.d.ts +144 -0
- package/dist/core/validation.d.ts.map +1 -0
- package/dist/core/validation.js +150 -0
- package/dist/core/validation.js.map +1 -0
- package/dist/domains/account/account.d.ts +40 -0
- package/dist/domains/account/account.d.ts.map +1 -0
- package/dist/domains/account/account.js +39 -0
- package/dist/domains/account/account.js.map +1 -0
- package/dist/domains/audit/audit.d.ts +169 -0
- package/dist/domains/audit/audit.d.ts.map +1 -0
- package/dist/domains/audit/audit.js +84 -0
- package/dist/domains/audit/audit.js.map +1 -0
- package/dist/domains/chat/chat.d.ts +187 -0
- package/dist/domains/chat/chat.d.ts.map +1 -0
- package/dist/domains/chat/chat.js +189 -0
- package/dist/domains/chat/chat.js.map +1 -0
- package/dist/domains/dashboard/dashboard.d.ts +48 -0
- package/dist/domains/dashboard/dashboard.d.ts.map +1 -0
- package/dist/domains/dashboard/dashboard.js +58 -0
- package/dist/domains/dashboard/dashboard.js.map +1 -0
- package/dist/domains/discover/discover.d.ts +245 -0
- package/dist/domains/discover/discover.d.ts.map +1 -0
- package/dist/domains/discover/discover.js +68 -0
- package/dist/domains/discover/discover.js.map +1 -0
- package/dist/domains/feed/feed.d.ts +1658 -0
- package/dist/domains/feed/feed.d.ts.map +1 -0
- package/dist/domains/feed/feed.js +623 -0
- package/dist/domains/feed/feed.js.map +1 -0
- package/dist/domains/members/members.d.ts +175 -0
- package/dist/domains/members/members.d.ts.map +1 -0
- package/dist/domains/members/members.js +106 -0
- package/dist/domains/members/members.js.map +1 -0
- package/dist/domains/moderation/moderation.d.ts +184 -0
- package/dist/domains/moderation/moderation.d.ts.map +1 -0
- package/dist/domains/moderation/moderation.js +90 -0
- package/dist/domains/moderation/moderation.js.map +1 -0
- package/dist/domains/onboarding/onboarding.d.ts +1018 -0
- package/dist/domains/onboarding/onboarding.d.ts.map +1 -0
- package/dist/domains/onboarding/onboarding.js +717 -0
- package/dist/domains/onboarding/onboarding.js.map +1 -0
- package/dist/domains/profile/founder-profile.d.ts +387 -0
- package/dist/domains/profile/founder-profile.d.ts.map +1 -0
- package/dist/domains/profile/founder-profile.js +180 -0
- package/dist/domains/profile/founder-profile.js.map +1 -0
- package/dist/domains/support/support.d.ts +305 -0
- package/dist/domains/support/support.d.ts.map +1 -0
- package/dist/domains/support/support.js +129 -0
- package/dist/domains/support/support.js.map +1 -0
- package/dist/domains/team/team.d.ts +79 -0
- package/dist/domains/team/team.d.ts.map +1 -0
- package/dist/domains/team/team.js +54 -0
- package/dist/domains/team/team.js.map +1 -0
- package/dist/domains/uploads/uploads.d.ts +113 -0
- package/dist/domains/uploads/uploads.d.ts.map +1 -0
- package/dist/domains/uploads/uploads.js +106 -0
- package/dist/domains/uploads/uploads.js.map +1 -0
- package/dist/env.d.ts +85 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +150 -0
- package/dist/env.js.map +1 -0
- package/dist/index.d.ts +21 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -17
- package/dist/index.js.map +1 -1
- package/dist/onboarding.d.ts +58 -32
- package/dist/onboarding.d.ts.map +1 -1
- package/dist/onboarding.js +155 -32
- package/dist/onboarding.js.map +1 -1
- package/package.json +14 -2
|
@@ -0,0 +1,717 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* founder-schema — Onboarding: steps, enums, and the two shapes of the answers
|
|
3
|
+
*
|
|
4
|
+
* ONE LIST DEFINES THE FLOW, AND IT IS DERIVED. Each step's fields are a pick
|
|
5
|
+
* of the finish body (`ONBOARDING_STEP_SCHEMAS`), and `FOUNDER_ONBOARDING_STEPS`
|
|
6
|
+
* is built FROM those picks: its `fields`, and even whether a step may be
|
|
7
|
+
* skipped, come from the schema rather than from a second hand-written list.
|
|
8
|
+
* GymMonk arrived at one list after keeping two in sync by hand, where a step
|
|
9
|
+
* could exist with no title or, worse, no validation gate at all; until 0.2.0
|
|
10
|
+
* this file still wrote the field lists twice.
|
|
11
|
+
*
|
|
12
|
+
* TWO SHAPES, ONE SET OF RULES. A half-filled form legitimately holds `null`
|
|
13
|
+
* for a choice nobody has made yet; the finalize body only ever sees completed
|
|
14
|
+
* answers. So the rules are written once and expressed over both shapes:
|
|
15
|
+
* `onboardingFormSchema` for work in progress and `completeOnboardingBodySchema`
|
|
16
|
+
* for the end. Letting those two drift is how a wizard says a step is optional
|
|
17
|
+
* and then answers 422 at Finish.
|
|
18
|
+
*
|
|
19
|
+
* NO COPY IN HERE. Step titles, help lines and topic category names are
|
|
20
|
+
* translation KEYS (`titleKey`, `helpKey`, `labelKey`), Jansathi's rule for
|
|
21
|
+
* every config string: an English sentence in a shared package is a sentence
|
|
22
|
+
* every other language has to match by wording.
|
|
23
|
+
*
|
|
24
|
+
* @module founder-schema/domains/onboarding
|
|
25
|
+
*/
|
|
26
|
+
import { z } from 'zod';
|
|
27
|
+
import { GENDER_VALUES, GOAL_VALUES, genderSchema, goalSchema, INDUSTRY_VALUES, industrySchema, locationSchema, optionalTrimmedString, phoneSchema, SKILL_VALUES, STARTUP_STAGE_VALUES, skillSchema, startupStageSchema, } from '../../core/common.js';
|
|
28
|
+
import { ABOUT_MAX, CITY_MAX, COUNTRY_MAX, DISPLAY_NAME_MAX, GOALS_MIN, HEADLINE_MAX, LINK_URL_MAX, SKILLS_MAX, STATE_MAX, TEAM_SIZE_MAX, VENTURE_NAME_MAX, } from '../../core/limits.js';
|
|
29
|
+
import { VALIDATION_MESSAGE } from '../../core/validation.js';
|
|
30
|
+
import { founderLinksSchema, ventureSchema } from '../profile/founder-profile.js';
|
|
31
|
+
import { uploadKeySchema } from '../uploads/uploads.js';
|
|
32
|
+
// ─── Age ─────────────────────────────────────────────────────────────────────
|
|
33
|
+
/**
|
|
34
|
+
* 18, ruled by the user 2026-09-21. Under-18 would pull in parental-consent
|
|
35
|
+
* duties under the DPDP Act, which is a different and larger problem than a
|
|
36
|
+
* validation rule.
|
|
37
|
+
*
|
|
38
|
+
* ⚠️ The SERVER refuses at finalize. This schema exists so the member sees a
|
|
39
|
+
* useful message; it is not the gate.
|
|
40
|
+
*/
|
|
41
|
+
export const MIN_AGE_YEARS = 18;
|
|
42
|
+
/** A sanity ceiling, not a product rule. Catches a mistyped year. */
|
|
43
|
+
export const MAX_AGE_YEARS = 120;
|
|
44
|
+
/**
|
|
45
|
+
* Whole years completed, by the calendar.
|
|
46
|
+
*
|
|
47
|
+
* ⚠️ NOT `elapsedMs / (365.25 * day)`, which is what the sibling product uses.
|
|
48
|
+
* That approximation reads 17.9986 at the start of somebody's eighteenth
|
|
49
|
+
* birthday and only crosses 18 about halfway through the day, so it refuses
|
|
50
|
+
* them for the half of their birthday they are most likely to be signing up on.
|
|
51
|
+
* Measured: it disagrees with the calendar on all 400 of the next 400 days.
|
|
52
|
+
* An age gate is exactly the place an approximation is not good enough.
|
|
53
|
+
*/
|
|
54
|
+
export function ageInYears(isoDate, now = new Date()) {
|
|
55
|
+
// ⚠️ A STRING, `YYYY-MM-DD`, not a `Date`. This is a wire contract, so it
|
|
56
|
+
// takes the wire type. The backend is the obvious caller and the backend
|
|
57
|
+
// holds a `Date`, so it must format first; passing the Date straight in used
|
|
58
|
+
// to fail with `isoDate.split is not a function`, which says nothing useful.
|
|
59
|
+
// Naming the fix costs one line and saves the next person the detour.
|
|
60
|
+
if (typeof isoDate !== 'string') {
|
|
61
|
+
throw new TypeError('ageInYears expects a YYYY-MM-DD string, not a Date. Format it first, e.g. date.toISOString().slice(0, 10).');
|
|
62
|
+
}
|
|
63
|
+
const [y, m, d] = isoDate.split('-').map(Number);
|
|
64
|
+
let age = now.getUTCFullYear() - y;
|
|
65
|
+
const monthNow = now.getUTCMonth() + 1;
|
|
66
|
+
if (monthNow < m || (monthNow === m && now.getUTCDate() < d))
|
|
67
|
+
age -= 1;
|
|
68
|
+
return age;
|
|
69
|
+
}
|
|
70
|
+
/** A calendar date with no time component, `YYYY-MM-DD`. */
|
|
71
|
+
export const isoDateSchema = z
|
|
72
|
+
.string()
|
|
73
|
+
.trim()
|
|
74
|
+
.regex(/^\d{4}-\d{2}-\d{2}$/, VALIDATION_MESSAGE.dateInvalid);
|
|
75
|
+
/** True only for a date that exists. Rejects 2026-02-30 and 2026-13-01. */
|
|
76
|
+
function isRealDate(iso) {
|
|
77
|
+
const [y, m, d] = iso.split('-').map(Number);
|
|
78
|
+
if (m < 1 || m > 12 || d < 1)
|
|
79
|
+
return false;
|
|
80
|
+
const asDate = new Date(Date.UTC(y, m - 1, d));
|
|
81
|
+
return (asDate.getUTCFullYear() === y && asDate.getUTCMonth() === m - 1 && asDate.getUTCDate() === d);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Date of birth, with the age gate applied per parse.
|
|
85
|
+
*
|
|
86
|
+
* ⚠️ THE CLIENT IS NOT THE GATE. This schema exists so the member sees a useful
|
|
87
|
+
* message, and the server must refuse the same dates at finalize regardless.
|
|
88
|
+
* The sibling dating product validates the identical rule on its client and
|
|
89
|
+
* still shipped a defect where an under-age date of birth produced a live,
|
|
90
|
+
* discoverable profile, because the client was the only thing checking.
|
|
91
|
+
*/
|
|
92
|
+
export const dateOfBirthSchema = isoDateSchema
|
|
93
|
+
.refine(isRealDate, { error: VALIDATION_MESSAGE.dobInvalid })
|
|
94
|
+
.refine((v) => ageInYears(v) >= MIN_AGE_YEARS, { error: VALIDATION_MESSAGE.dobUnderAge })
|
|
95
|
+
.refine((v) => ageInYears(v) <= MAX_AGE_YEARS, { error: VALIDATION_MESSAGE.dobTooOld });
|
|
96
|
+
// ─── Business ────────────────────────────────────────────────────────────────
|
|
97
|
+
export const BUSINESS_TYPE_VALUES = ['startup', 'sme', 'enterprise'];
|
|
98
|
+
export const businessTypeSchema = z.enum(BUSINESS_TYPE_VALUES);
|
|
99
|
+
// ─── Topics: the shared vocabulary ───────────────────────────────────────────────────────────────
|
|
100
|
+
/**
|
|
101
|
+
* ONE vocabulary, used TWICE: a member picks these as their `interests`, and a
|
|
102
|
+
* post carries them as its `topics`. That is what makes relevance an index
|
|
103
|
+
* lookup rather than a guess, and it is why this list is not called "interests"
|
|
104
|
+
* - naming it for one of its two jobs would have invited a second list for the
|
|
105
|
+
* other, which is the mistake this package has already made once with goals.
|
|
106
|
+
* (User's ruling via hary, 2026-09-21.)
|
|
107
|
+
*
|
|
108
|
+
* Deliberately DISTINCT from two neighbours that will otherwise collect the
|
|
109
|
+
* same words:
|
|
110
|
+
*
|
|
111
|
+
* industry what your company does
|
|
112
|
+
* skills what you can do
|
|
113
|
+
* interests what you want to read about
|
|
114
|
+
*
|
|
115
|
+
* If the copy does not keep them apart, members fill all three identically and
|
|
116
|
+
* every one of them stops telling us anything.
|
|
117
|
+
*
|
|
118
|
+
* A closed list, consistent with industry, skill and stage, for the reason
|
|
119
|
+
* already written beside those: free text means two people typing "growth" and
|
|
120
|
+
* "Growth Marketing" never match, and matching is the entire point. The cost is
|
|
121
|
+
* that adding an interest needs a publish.
|
|
122
|
+
*
|
|
123
|
+
* Tuned down from the dating product's 246, which is mostly dating material.
|
|
124
|
+
* Values reuse its exact strings wherever one existed, so its Hindi
|
|
125
|
+
* translations can be lifted across.
|
|
126
|
+
*
|
|
127
|
+
* ⚠️ Stored per member. Append only; removing a value orphans data.
|
|
128
|
+
*/
|
|
129
|
+
export const TOPIC_VALUES = [
|
|
130
|
+
// Career growth
|
|
131
|
+
'mentoring',
|
|
132
|
+
'leadership',
|
|
133
|
+
'networking',
|
|
134
|
+
'public_speaking',
|
|
135
|
+
'teaching',
|
|
136
|
+
'hiring_talent',
|
|
137
|
+
'personal_branding',
|
|
138
|
+
'career_transition',
|
|
139
|
+
'remote_work',
|
|
140
|
+
// Innovation and tech
|
|
141
|
+
'ai_ml',
|
|
142
|
+
'blockchain',
|
|
143
|
+
'crypto_web3',
|
|
144
|
+
'robotics',
|
|
145
|
+
'data_science',
|
|
146
|
+
'cybersecurity',
|
|
147
|
+
'game_dev',
|
|
148
|
+
'ux_design',
|
|
149
|
+
'app_development',
|
|
150
|
+
'open_source',
|
|
151
|
+
'electronics',
|
|
152
|
+
'space_exploration',
|
|
153
|
+
'green_tech',
|
|
154
|
+
'deeptech',
|
|
155
|
+
'no_code',
|
|
156
|
+
// Business
|
|
157
|
+
'entrepreneurship',
|
|
158
|
+
'investing',
|
|
159
|
+
'stock_trading',
|
|
160
|
+
'personal_finance',
|
|
161
|
+
'fundraising',
|
|
162
|
+
'marketing',
|
|
163
|
+
'sales',
|
|
164
|
+
'consulting',
|
|
165
|
+
'ecommerce',
|
|
166
|
+
'retail',
|
|
167
|
+
'real_estate',
|
|
168
|
+
'supply_chain',
|
|
169
|
+
'product_management',
|
|
170
|
+
'growth',
|
|
171
|
+
'b2b_saas',
|
|
172
|
+
'd2c',
|
|
173
|
+
// Personal development
|
|
174
|
+
'meditation',
|
|
175
|
+
'journaling',
|
|
176
|
+
'self_improvement',
|
|
177
|
+
'productivity',
|
|
178
|
+
'reading',
|
|
179
|
+
'online_courses',
|
|
180
|
+
'philosophy',
|
|
181
|
+
'psychology',
|
|
182
|
+
'therapy',
|
|
183
|
+
'sleep_optimization',
|
|
184
|
+
'gym',
|
|
185
|
+
'yoga',
|
|
186
|
+
// Creative
|
|
187
|
+
'photography',
|
|
188
|
+
'writing',
|
|
189
|
+
'graphic_design',
|
|
190
|
+
'filmmaking',
|
|
191
|
+
'digital_art',
|
|
192
|
+
'content_creation',
|
|
193
|
+
'blogging',
|
|
194
|
+
'vlogging',
|
|
195
|
+
'podcasts',
|
|
196
|
+
'animation',
|
|
197
|
+
'music_production',
|
|
198
|
+
// Impact and community
|
|
199
|
+
'volunteering',
|
|
200
|
+
'ngo_work',
|
|
201
|
+
'environmental',
|
|
202
|
+
'women_empowerment',
|
|
203
|
+
'community_service',
|
|
204
|
+
'social_enterprise',
|
|
205
|
+
'education_access',
|
|
206
|
+
];
|
|
207
|
+
export const topicSchema = z.enum(TOPIC_VALUES);
|
|
208
|
+
/**
|
|
209
|
+
* The grouping the picker renders.
|
|
210
|
+
*
|
|
211
|
+
* ⚠️ `TOPIC_VALUES` above is the single source of truth and this is typed
|
|
212
|
+
* against it, so a typo here is a compile error rather than a chip that renders
|
|
213
|
+
* and can never be selected. The dating product keeps a categorised list and a
|
|
214
|
+
* flat list side by side and they have already drifted apart by two values;
|
|
215
|
+
* a test in this package asserts these two agree exactly, in both directions.
|
|
216
|
+
*/
|
|
217
|
+
export const TOPIC_CATEGORY_KEYS = [
|
|
218
|
+
'career',
|
|
219
|
+
'tech',
|
|
220
|
+
'business',
|
|
221
|
+
'growth',
|
|
222
|
+
'creative',
|
|
223
|
+
'impact',
|
|
224
|
+
];
|
|
225
|
+
const topicCategory = (key, values) => ({
|
|
226
|
+
key,
|
|
227
|
+
labelKey: `topics.category.${key}`,
|
|
228
|
+
values,
|
|
229
|
+
});
|
|
230
|
+
export const TOPIC_CATEGORIES = [
|
|
231
|
+
topicCategory('career', [
|
|
232
|
+
'mentoring',
|
|
233
|
+
'leadership',
|
|
234
|
+
'networking',
|
|
235
|
+
'public_speaking',
|
|
236
|
+
'teaching',
|
|
237
|
+
'hiring_talent',
|
|
238
|
+
'personal_branding',
|
|
239
|
+
'career_transition',
|
|
240
|
+
'remote_work',
|
|
241
|
+
]),
|
|
242
|
+
topicCategory('tech', [
|
|
243
|
+
'ai_ml',
|
|
244
|
+
'blockchain',
|
|
245
|
+
'crypto_web3',
|
|
246
|
+
'robotics',
|
|
247
|
+
'data_science',
|
|
248
|
+
'cybersecurity',
|
|
249
|
+
'game_dev',
|
|
250
|
+
'ux_design',
|
|
251
|
+
'app_development',
|
|
252
|
+
'open_source',
|
|
253
|
+
'electronics',
|
|
254
|
+
'space_exploration',
|
|
255
|
+
'green_tech',
|
|
256
|
+
'deeptech',
|
|
257
|
+
'no_code',
|
|
258
|
+
]),
|
|
259
|
+
topicCategory('business', [
|
|
260
|
+
'entrepreneurship',
|
|
261
|
+
'investing',
|
|
262
|
+
'stock_trading',
|
|
263
|
+
'personal_finance',
|
|
264
|
+
'fundraising',
|
|
265
|
+
'marketing',
|
|
266
|
+
'sales',
|
|
267
|
+
'consulting',
|
|
268
|
+
'ecommerce',
|
|
269
|
+
'retail',
|
|
270
|
+
'real_estate',
|
|
271
|
+
'supply_chain',
|
|
272
|
+
'product_management',
|
|
273
|
+
'growth',
|
|
274
|
+
'b2b_saas',
|
|
275
|
+
'd2c',
|
|
276
|
+
]),
|
|
277
|
+
topicCategory('growth', [
|
|
278
|
+
'meditation',
|
|
279
|
+
'journaling',
|
|
280
|
+
'self_improvement',
|
|
281
|
+
'productivity',
|
|
282
|
+
'reading',
|
|
283
|
+
'online_courses',
|
|
284
|
+
'philosophy',
|
|
285
|
+
'psychology',
|
|
286
|
+
'therapy',
|
|
287
|
+
'sleep_optimization',
|
|
288
|
+
'gym',
|
|
289
|
+
'yoga',
|
|
290
|
+
]),
|
|
291
|
+
topicCategory('creative', [
|
|
292
|
+
'photography',
|
|
293
|
+
'writing',
|
|
294
|
+
'graphic_design',
|
|
295
|
+
'filmmaking',
|
|
296
|
+
'digital_art',
|
|
297
|
+
'content_creation',
|
|
298
|
+
'blogging',
|
|
299
|
+
'vlogging',
|
|
300
|
+
'podcasts',
|
|
301
|
+
'animation',
|
|
302
|
+
'music_production',
|
|
303
|
+
]),
|
|
304
|
+
topicCategory('impact', [
|
|
305
|
+
'volunteering',
|
|
306
|
+
'ngo_work',
|
|
307
|
+
'environmental',
|
|
308
|
+
'women_empowerment',
|
|
309
|
+
'community_service',
|
|
310
|
+
'social_enterprise',
|
|
311
|
+
'education_access',
|
|
312
|
+
]),
|
|
313
|
+
];
|
|
314
|
+
/**
|
|
315
|
+
* How many a member must pick. A minimum exists because these drive feed
|
|
316
|
+
* relevance and zero of them means no relevance at all.
|
|
317
|
+
*
|
|
318
|
+
* ⚠️ If 3 turns out to be hard to reach against this list, that is a signal
|
|
319
|
+
* about the LIST, not about the minimum. The sibling product enforces no
|
|
320
|
+
* minimum at all, and its own field config says "pick up to 10" while every
|
|
321
|
+
* screen and schema enforces 20.
|
|
322
|
+
*/
|
|
323
|
+
export const INTERESTS_MIN = 3;
|
|
324
|
+
export const INTERESTS_MAX = 10;
|
|
325
|
+
// ─── The step keys ───────────────────────────────────────────────────────────
|
|
326
|
+
/**
|
|
327
|
+
* The step keys, in order, as a literal union, so a consumer can key a table by
|
|
328
|
+
* step and have TypeScript insist on every one. Before 0.2.0 `key` was a plain
|
|
329
|
+
* string and the web client kept its own copy of this list to get the same
|
|
330
|
+
* check; a test there held the two together. Now there is one list.
|
|
331
|
+
*/
|
|
332
|
+
export const ONBOARDING_STEP_KEYS = [
|
|
333
|
+
'identity',
|
|
334
|
+
'contact',
|
|
335
|
+
'location',
|
|
336
|
+
'goals',
|
|
337
|
+
'interests',
|
|
338
|
+
'business',
|
|
339
|
+
'guidelines',
|
|
340
|
+
];
|
|
341
|
+
// ─── Guidelines ──────────────────────────────────────────────────────────────
|
|
342
|
+
/**
|
|
343
|
+
* The community guidelines a member agrees to at the last step, by version.
|
|
344
|
+
*
|
|
345
|
+
* The finish body accepts THIS version and no other: an old tab still showing
|
|
346
|
+
* last month's text cannot record agreement to text it never displayed, and
|
|
347
|
+
* `'whatever'` is not a version. Until 0.2.0 any non-empty string passed, and
|
|
348
|
+
* the web client held this constant on its own.
|
|
349
|
+
*
|
|
350
|
+
* ⚠ Changing the guidelines text means bumping this, in the same publish.
|
|
351
|
+
* Every member who agreed to an earlier version keeps that version on their
|
|
352
|
+
* profile; that record is the point.
|
|
353
|
+
*/
|
|
354
|
+
export const GUIDELINES_VERSION = '2026-10-03';
|
|
355
|
+
export const guidelinesVersionSchema = z.literal(GUIDELINES_VERSION, {
|
|
356
|
+
error: VALIDATION_MESSAGE.guidelinesOutdated,
|
|
357
|
+
});
|
|
358
|
+
// ─── Contact ─────────────────────────────────────────────────────────────────
|
|
359
|
+
/**
|
|
360
|
+
* The links the contact step collects, picked from the profile's own links so
|
|
361
|
+
* the two cannot disagree on what a link is. The phone is `phoneSchema`: ten
|
|
362
|
+
* digits, stored raw with no country code, on the account rather than here.
|
|
363
|
+
*/
|
|
364
|
+
export const contactLinksSchema = founderLinksSchema.pick({
|
|
365
|
+
linkedin: true,
|
|
366
|
+
x: true,
|
|
367
|
+
instagram: true,
|
|
368
|
+
});
|
|
369
|
+
/** A team size has at most this many digits: `TEAM_SIZE_MAX` written out. */
|
|
370
|
+
export const TEAM_SIZE_DIGITS_MAX = String(TEAM_SIZE_MAX).length;
|
|
371
|
+
// ─── The form, mid-flight: the draft each step saves ──────────────────────────
|
|
372
|
+
/**
|
|
373
|
+
* The answers so far, keyed by the finish body's own field names: what each
|
|
374
|
+
* step SAVES (`PATCH /onboarding`, merged per field), what `GET` hands back
|
|
375
|
+
* to resume, and so the only keys a draft may hold
|
|
376
|
+
* (`ONBOARDING_DRAFT_KEYS`).
|
|
377
|
+
*
|
|
378
|
+
* RAW, on purpose: a draft is what the member TYPED, not what Finish will send.
|
|
379
|
+
* A half-typed link is ordinary text, a team size is digits as typed, and every
|
|
380
|
+
* choice is `null` until made ("not answered" is not "answered with nothing").
|
|
381
|
+
* Nothing here is required; whether a member may FINISH is
|
|
382
|
+
* `completeOnboardingBodySchema`'s decision, and the client builds that body
|
|
383
|
+
* from these answers.
|
|
384
|
+
*
|
|
385
|
+
* Screens may hold a different shape on top of this one (the web draws first
|
|
386
|
+
* and last name as two fields and joins them into `displayName`). Derive that
|
|
387
|
+
* type from `OnboardingForm` rather than writing it out, so a field added here
|
|
388
|
+
* reaches every screen.
|
|
389
|
+
*
|
|
390
|
+
* A stored draft is UNTRUSTED when it comes back: an older client, or another
|
|
391
|
+
* one, wrote it, and the server stores values opaquely. Read it with
|
|
392
|
+
* `readOnboardingDraft`, never by casting.
|
|
393
|
+
*/
|
|
394
|
+
export const onboardingFormSchema = z.object({
|
|
395
|
+
displayName: z.string().max(DISPLAY_NAME_MAX),
|
|
396
|
+
gender: genderSchema.nullable(),
|
|
397
|
+
/** `YYYY-MM-DD` once complete; whatever has been typed until then. */
|
|
398
|
+
dateOfBirth: z.string(),
|
|
399
|
+
headline: z.string().max(HEADLINE_MAX),
|
|
400
|
+
about: z.string().max(ABOUT_MAX),
|
|
401
|
+
/**
|
|
402
|
+
* Allowed as a key, and NEVER restored by `readOnboardingDraft`: an upload
|
|
403
|
+
* not attached within a day is deleted by the storage lifecycle rule, so a
|
|
404
|
+
* key from an older draft would fail at Finish, on the last screen, about a
|
|
405
|
+
* photo picked days ago. Clients hold it for the visit and do not save it.
|
|
406
|
+
*/
|
|
407
|
+
avatarUploadKey: uploadKeySchema.nullable(),
|
|
408
|
+
skills: z.array(skillSchema).max(SKILLS_MAX),
|
|
409
|
+
/** As typed; the finish body takes `phoneSchema`'s ten digits. */
|
|
410
|
+
phone: z.string(),
|
|
411
|
+
/** As typed; the finish body takes full `https://` URLs. */
|
|
412
|
+
links: z.object({
|
|
413
|
+
linkedin: z.string().max(LINK_URL_MAX),
|
|
414
|
+
x: z.string().max(LINK_URL_MAX),
|
|
415
|
+
instagram: z.string().max(LINK_URL_MAX),
|
|
416
|
+
}),
|
|
417
|
+
/** `null` until the member opens the location step, and when they skip it. */
|
|
418
|
+
location: z
|
|
419
|
+
.object({
|
|
420
|
+
city: z.string().max(CITY_MAX),
|
|
421
|
+
state: z.string().max(STATE_MAX),
|
|
422
|
+
country: z.string().max(COUNTRY_MAX),
|
|
423
|
+
})
|
|
424
|
+
.nullable(),
|
|
425
|
+
goals: z.array(goalSchema).max(GOAL_VALUES.length),
|
|
426
|
+
interests: z.array(topicSchema).max(INTERESTS_MAX),
|
|
427
|
+
/**
|
|
428
|
+
* Always present; empty until started. Onboarding does not ask for a
|
|
429
|
+
* tagline (the profile does, later), so the draft has none.
|
|
430
|
+
*/
|
|
431
|
+
venture: z.object({
|
|
432
|
+
name: z.string().max(VENTURE_NAME_MAX),
|
|
433
|
+
website: z.string().max(LINK_URL_MAX),
|
|
434
|
+
industry: industrySchema.nullable(),
|
|
435
|
+
stage: startupStageSchema.nullable(),
|
|
436
|
+
/** Digits as typed, at most `TEAM_SIZE_DIGITS_MAX`; the body sends a number. */
|
|
437
|
+
teamSize: z.string().max(TEAM_SIZE_DIGITS_MAX),
|
|
438
|
+
}),
|
|
439
|
+
businessType: businessTypeSchema.nullable(),
|
|
440
|
+
/** The guidelines text the member agreed to, or `null`. */
|
|
441
|
+
guidelinesVersion: z.string().nullable(),
|
|
442
|
+
});
|
|
443
|
+
// ─── Reading a stored draft back ─────────────────────────────────────────────
|
|
444
|
+
/** Longest date of birth worth keeping from a draft: `YYYY-MM-DD`. */
|
|
445
|
+
const DATE_INPUT_MAX = 10;
|
|
446
|
+
/** Longest phone number worth keeping from a draft, as typed with spaces. */
|
|
447
|
+
const PHONE_INPUT_MAX = 20;
|
|
448
|
+
/** Text, cut to its limit; anything that is not text is "not answered". */
|
|
449
|
+
const draftText = (max) => z
|
|
450
|
+
.string()
|
|
451
|
+
.catch('')
|
|
452
|
+
.transform((v) => v.slice(0, max));
|
|
453
|
+
/** One of a vocabulary, or `null` ("not answered"). */
|
|
454
|
+
const draftChoice = (values) => z.enum(values).nullable().catch(null);
|
|
455
|
+
/**
|
|
456
|
+
* Items of a vocabulary, deduplicated and capped. Unknown items (a value since
|
|
457
|
+
* retired, or junk) are dropped one by one, so the rest of the answer survives.
|
|
458
|
+
*/
|
|
459
|
+
const draftList = (values, max) => z
|
|
460
|
+
.array(z.unknown())
|
|
461
|
+
.catch([])
|
|
462
|
+
.transform((items) => {
|
|
463
|
+
const allowed = new Set(values);
|
|
464
|
+
const kept = items.filter((v) => typeof v === 'string' && allowed.has(v));
|
|
465
|
+
return [...new Set(kept)].slice(0, max);
|
|
466
|
+
});
|
|
467
|
+
/** An object of the given fields, or `null` when the draft holds none. */
|
|
468
|
+
const draftObject = (shape) => z
|
|
469
|
+
.record(z.string(), z.unknown())
|
|
470
|
+
.nullable()
|
|
471
|
+
.catch(null)
|
|
472
|
+
.pipe(z.union([z.null(), z.object(shape)]));
|
|
473
|
+
const draftReaderSchema = z.object({
|
|
474
|
+
displayName: draftText(DISPLAY_NAME_MAX),
|
|
475
|
+
gender: draftChoice(GENDER_VALUES),
|
|
476
|
+
dateOfBirth: draftText(DATE_INPUT_MAX),
|
|
477
|
+
headline: draftText(HEADLINE_MAX),
|
|
478
|
+
about: draftText(ABOUT_MAX),
|
|
479
|
+
avatarUploadKey: z
|
|
480
|
+
.unknown()
|
|
481
|
+
.optional()
|
|
482
|
+
.transform(() => null),
|
|
483
|
+
skills: draftList(SKILL_VALUES, SKILLS_MAX),
|
|
484
|
+
phone: draftText(PHONE_INPUT_MAX),
|
|
485
|
+
links: draftObject({
|
|
486
|
+
linkedin: draftText(LINK_URL_MAX),
|
|
487
|
+
x: draftText(LINK_URL_MAX),
|
|
488
|
+
instagram: draftText(LINK_URL_MAX),
|
|
489
|
+
}).transform((links) => links ?? { linkedin: '', x: '', instagram: '' }),
|
|
490
|
+
location: draftObject({
|
|
491
|
+
city: draftText(CITY_MAX),
|
|
492
|
+
state: draftText(STATE_MAX),
|
|
493
|
+
country: draftText(COUNTRY_MAX),
|
|
494
|
+
}),
|
|
495
|
+
goals: draftList(GOAL_VALUES, GOAL_VALUES.length),
|
|
496
|
+
interests: draftList(TOPIC_VALUES, INTERESTS_MAX),
|
|
497
|
+
venture: draftObject({
|
|
498
|
+
name: draftText(VENTURE_NAME_MAX),
|
|
499
|
+
website: draftText(LINK_URL_MAX),
|
|
500
|
+
industry: draftChoice(INDUSTRY_VALUES),
|
|
501
|
+
stage: draftChoice(STARTUP_STAGE_VALUES),
|
|
502
|
+
teamSize: z
|
|
503
|
+
.string()
|
|
504
|
+
.catch('')
|
|
505
|
+
.transform((v) => v.replace(/\D/g, '').slice(0, TEAM_SIZE_DIGITS_MAX)),
|
|
506
|
+
}).transform((venture) => venture ?? { ...EMPTY_ONBOARDING_VENTURE }),
|
|
507
|
+
businessType: draftChoice(BUSINESS_TYPE_VALUES),
|
|
508
|
+
/** Agreement to an OLDER text is not agreement to this one. */
|
|
509
|
+
guidelinesVersion: z
|
|
510
|
+
.unknown()
|
|
511
|
+
.optional()
|
|
512
|
+
.transform((v) => (v === GUIDELINES_VERSION ? GUIDELINES_VERSION : null)),
|
|
513
|
+
});
|
|
514
|
+
/** The business step before anything is chosen. */
|
|
515
|
+
export const EMPTY_ONBOARDING_VENTURE = {
|
|
516
|
+
name: '',
|
|
517
|
+
website: '',
|
|
518
|
+
industry: null,
|
|
519
|
+
stage: null,
|
|
520
|
+
teamSize: '',
|
|
521
|
+
};
|
|
522
|
+
/**
|
|
523
|
+
* A stored draft as an `OnboardingForm`, FIELD BY FIELD.
|
|
524
|
+
*
|
|
525
|
+
* Every field is checked against its own vocabulary and cut to its own limit;
|
|
526
|
+
* one that does not fit becomes "not answered" (`''`, `null`, `[]`) and the
|
|
527
|
+
* rest of the draft survives. Never coerced into a different answer: a value
|
|
528
|
+
* outside a vocabulary is dropped, not mapped to the nearest one. A photo key
|
|
529
|
+
* is never restored (see `avatarUploadKey`), and agreement only counts for the
|
|
530
|
+
* CURRENT guidelines.
|
|
531
|
+
*
|
|
532
|
+
* It fills in no answer the member did not give: a blank country stays blank.
|
|
533
|
+
* Whatever a screen shows by default is that screen's choice.
|
|
534
|
+
*/
|
|
535
|
+
export function readOnboardingDraft(draft) {
|
|
536
|
+
const source = draft && typeof draft === 'object' && !Array.isArray(draft) ? draft : {};
|
|
537
|
+
return draftReaderSchema.parse(source);
|
|
538
|
+
}
|
|
539
|
+
// ─── The finalize body ───────────────────────────────────────────────────────
|
|
540
|
+
/**
|
|
541
|
+
* What the client sends to finish. Completed answers only.
|
|
542
|
+
*
|
|
543
|
+
* ⚠️ EVERY OPTIONAL FIELD HERE MUST BE ABSENT WHEN UNANSWERED, never a default
|
|
544
|
+
* standing in for one. The sibling gym product sent `bloodGroup ?? 'O+'`, so
|
|
545
|
+
* every member who skipped the question was recorded as O-positive: a real
|
|
546
|
+
* answer, indistinguishable from one somebody gave, sitting on a screen staff
|
|
547
|
+
* would read in an emergency. Absent has to stay absent.
|
|
548
|
+
*
|
|
549
|
+
* ⚠️ AND THIS IS NOT THE GATE EITHER. The server re-checks the age and refuses
|
|
550
|
+
* at finalize. `isOnboarded` may be set here and nowhere else: four of the
|
|
551
|
+
* profile's partial indexes are gated on it, so a half-built profile carrying
|
|
552
|
+
* it true appears in Discover half-built.
|
|
553
|
+
*
|
|
554
|
+
* Location, venture and links are the profile's own shapes, not copies: the
|
|
555
|
+
* copies are how the profile model came to lack Instagram.
|
|
556
|
+
*/
|
|
557
|
+
export const completeOnboardingBodySchema = z.object({
|
|
558
|
+
// Plain bounds, no custom message: `too_small` with minimum 1 already says
|
|
559
|
+
// "required", and the client words it in the member's language.
|
|
560
|
+
displayName: z.string().trim().min(1).max(DISPLAY_NAME_MAX),
|
|
561
|
+
/**
|
|
562
|
+
* ⚠️ NO `username` HERE, and its absence is deliberate.
|
|
563
|
+
*
|
|
564
|
+
* It used to be required, and that was a defect: no onboarding step collects
|
|
565
|
+
* one, the design draws no screen for one, and it was not even on the
|
|
566
|
+
* in-progress form, so a finalize could never have succeeded. Found by
|
|
567
|
+
* checking every finalize-required field against the step list; a test now
|
|
568
|
+
* asserts that relationship in both directions.
|
|
569
|
+
*
|
|
570
|
+
* The handle is DERIVED SERVER-SIDE at finalize and edited later from the Me
|
|
571
|
+
* tab, which is what the product describes. That also makes the collision
|
|
572
|
+
* case kinder: a server deriving a handle can suffix it and move on, whereas
|
|
573
|
+
* a member who picked one six steps ago can only be told, at the end, that
|
|
574
|
+
* step one failed.
|
|
575
|
+
*/
|
|
576
|
+
gender: genderSchema,
|
|
577
|
+
dateOfBirth: dateOfBirthSchema,
|
|
578
|
+
headline: optionalTrimmedString(HEADLINE_MAX),
|
|
579
|
+
about: optionalTrimmedString(ABOUT_MAX),
|
|
580
|
+
/**
|
|
581
|
+
* The key the presign handed out, in the minted format. It was a bare
|
|
582
|
+
* string until 0.2.0, so `'../../etc/passwd'` passed this schema and only
|
|
583
|
+
* the server's own commit check stood in the way.
|
|
584
|
+
*/
|
|
585
|
+
avatarUploadKey: uploadKeySchema.optional(),
|
|
586
|
+
phone: phoneSchema,
|
|
587
|
+
links: contactLinksSchema.optional(),
|
|
588
|
+
/** Absent when the member skipped the step or refused the permission. */
|
|
589
|
+
location: locationSchema.optional(),
|
|
590
|
+
goals: z.array(goalSchema).min(GOALS_MIN).max(GOAL_VALUES.length),
|
|
591
|
+
interests: z.array(topicSchema).min(INTERESTS_MIN).max(INTERESTS_MAX),
|
|
592
|
+
skills: z.array(skillSchema).max(SKILLS_MAX).optional(),
|
|
593
|
+
/**
|
|
594
|
+
* Absent when the member skipped the business step. The profile's venture
|
|
595
|
+
* without `foundedYear`, which onboarding does not ask; the Me tab does.
|
|
596
|
+
*/
|
|
597
|
+
venture: ventureSchema.omit({ foundedYear: true }).optional(),
|
|
598
|
+
businessType: businessTypeSchema.optional(),
|
|
599
|
+
/**
|
|
600
|
+
* The version of the guidelines this member read: `GUIDELINES_VERSION`,
|
|
601
|
+
* exactly.
|
|
602
|
+
*
|
|
603
|
+
* A version and not a boolean, and the server stamps the time. A boolean says
|
|
604
|
+
* somebody agreed; a version and a timestamp say WHAT they agreed to and
|
|
605
|
+
* WHEN, which is the only form worth anything the day the text changes or a
|
|
606
|
+
* moderation decision is disputed.
|
|
607
|
+
*/
|
|
608
|
+
guidelinesVersion: guidelinesVersionSchema,
|
|
609
|
+
});
|
|
610
|
+
// ─── The steps ───────────────────────────────────────────────────────────────
|
|
611
|
+
/**
|
|
612
|
+
* Each step's slice of the finish body, picked FROM it, so a client validating
|
|
613
|
+
* "may I leave this step" and the server validating the finish apply the very
|
|
614
|
+
* same rules. A copy would drift, and the drift shows up as a wizard that lets
|
|
615
|
+
* a step pass and a finish that refuses it, on the last screen.
|
|
616
|
+
*
|
|
617
|
+
* THIS IS THE ONE PLACE A STEP'S FIELDS ARE WRITTEN. `FOUNDER_ONBOARDING_STEPS`
|
|
618
|
+
* below reads them from here. A test asserts that every finish field belongs to
|
|
619
|
+
* exactly one step.
|
|
620
|
+
*
|
|
621
|
+
* These validate the FINISH shape (skipped = absent), not the in-progress form:
|
|
622
|
+
* a client maps its form state to the slice first. The server does not run them
|
|
623
|
+
* on a draft save, because a half-answered step must be storable.
|
|
624
|
+
*/
|
|
625
|
+
export const ONBOARDING_STEP_SCHEMAS = {
|
|
626
|
+
identity: completeOnboardingBodySchema.pick({
|
|
627
|
+
displayName: true,
|
|
628
|
+
gender: true,
|
|
629
|
+
dateOfBirth: true,
|
|
630
|
+
headline: true,
|
|
631
|
+
about: true,
|
|
632
|
+
avatarUploadKey: true,
|
|
633
|
+
// Here because ruling D8 folded the design's orphan "title, achievements,
|
|
634
|
+
// skills" screen into step one. It was on no step until 0.2.0, which made
|
|
635
|
+
// it the one finish field no step owned.
|
|
636
|
+
skills: true,
|
|
637
|
+
}),
|
|
638
|
+
contact: completeOnboardingBodySchema.pick({ phone: true, links: true }),
|
|
639
|
+
location: completeOnboardingBodySchema.pick({ location: true }),
|
|
640
|
+
goals: completeOnboardingBodySchema.pick({ goals: true }),
|
|
641
|
+
interests: completeOnboardingBodySchema.pick({ interests: true }),
|
|
642
|
+
business: completeOnboardingBodySchema.pick({ venture: true, businessType: true }),
|
|
643
|
+
guidelines: completeOnboardingBodySchema.pick({ guidelinesVersion: true }),
|
|
644
|
+
};
|
|
645
|
+
export const FOUNDER_ONBOARDING_STEPS = ONBOARDING_STEP_KEYS.map((key) => {
|
|
646
|
+
const slice = ONBOARDING_STEP_SCHEMAS[key];
|
|
647
|
+
return {
|
|
648
|
+
key,
|
|
649
|
+
titleKey: `onboarding.steps.${key}.title`,
|
|
650
|
+
helpKey: `onboarding.steps.${key}.help`,
|
|
651
|
+
fields: Object.keys(slice.shape),
|
|
652
|
+
required: !slice.safeParse({}).success,
|
|
653
|
+
};
|
|
654
|
+
});
|
|
655
|
+
export const ONBOARDING_TOTAL_STEPS = FOUNDER_ONBOARDING_STEPS.length;
|
|
656
|
+
/** Fields gating each step, in step order. Read from the same picks. */
|
|
657
|
+
export const ONBOARDING_STEP_FIELDS = FOUNDER_ONBOARDING_STEPS.map((s) => s.fields);
|
|
658
|
+
/** What finishing answers: the new profile's id and the handle derived for it. */
|
|
659
|
+
export const completeOnboardingResponseSchema = z.object({
|
|
660
|
+
id: z.string(),
|
|
661
|
+
username: z.string(),
|
|
662
|
+
});
|
|
663
|
+
// ─── The resume cursor ───────────────────────────────────────────────────────
|
|
664
|
+
/**
|
|
665
|
+
* The keys a draft may hold: exactly the in-progress form's fields.
|
|
666
|
+
*
|
|
667
|
+
* ⚠ The server writes each key as a dot path (`draft.<key>`). Unchecked, a key
|
|
668
|
+
* holding a dot writes somewhere nested the form never asked for, and the
|
|
669
|
+
* collection fills with whatever a client invents. Until 0.2.0 the backend
|
|
670
|
+
* kept its own copy of this list and DROPPED unknown keys without a word; now a
|
|
671
|
+
* draft carrying one is refused, with the key in the issue's path.
|
|
672
|
+
*/
|
|
673
|
+
export const onboardingDraftKeySchema = onboardingFormSchema.keyof();
|
|
674
|
+
export const ONBOARDING_DRAFT_KEYS = onboardingDraftKeySchema.options;
|
|
675
|
+
/**
|
|
676
|
+
* Where the member got to, kept in its own collection, separate from the
|
|
677
|
+
* profile.
|
|
678
|
+
*
|
|
679
|
+
* `step` is a flat index into `FOUNDER_ONBOARDING_STEPS`, not a `(step, sub)`
|
|
680
|
+
* pair: one number is what lets a member start on the web and resume elsewhere,
|
|
681
|
+
* provided both ends agree on the encoding.
|
|
682
|
+
*
|
|
683
|
+
* The draft's KEYS come from the form; its VALUES are opaque on purpose. A
|
|
684
|
+
* half-answered step must be storable even though it would fail the finish,
|
|
685
|
+
* and everything in it is re-validated strictly at finalize.
|
|
686
|
+
*
|
|
687
|
+
* `partialRecord`, not `record`: in Zod 4 an enum-keyed `z.record` demands
|
|
688
|
+
* every key, and a draft holds whichever steps the member has reached.
|
|
689
|
+
*/
|
|
690
|
+
export const onboardingDraftSchema = z.partialRecord(onboardingDraftKeySchema, z.unknown());
|
|
691
|
+
export const onboardingProgressSchema = z.object({
|
|
692
|
+
step: z.number().int().min(0).max(ONBOARDING_TOTAL_STEPS),
|
|
693
|
+
draft: onboardingDraftSchema.optional(),
|
|
694
|
+
});
|
|
695
|
+
/**
|
|
696
|
+
* `PATCH` body: any subset of the cursor, merged server-side. No defaults.
|
|
697
|
+
* `step` may equal `ONBOARDING_TOTAL_STEPS`: "past the last step", which the
|
|
698
|
+
* client sends on its way to finish.
|
|
699
|
+
*/
|
|
700
|
+
export const onboardingProgressUpdateSchema = z.object({
|
|
701
|
+
step: z.number().int().min(0).max(ONBOARDING_TOTAL_STEPS).optional(),
|
|
702
|
+
draft: onboardingDraftSchema.optional(),
|
|
703
|
+
});
|
|
704
|
+
/**
|
|
705
|
+
* What the client reads on return, from `GET` and from every `PATCH`.
|
|
706
|
+
*
|
|
707
|
+
* ⚠️ `onboarded` is the gate and it comes from the profile, not from the
|
|
708
|
+
* cursor: a finished member on a new device must be recognised even when the
|
|
709
|
+
* cursor row is gone, and a cursor that failed to load must never make an
|
|
710
|
+
* unfinished member look finished.
|
|
711
|
+
*/
|
|
712
|
+
export const onboardingStatusSchema = z.object({
|
|
713
|
+
onboarded: z.boolean(),
|
|
714
|
+
step: z.number().int().min(0).max(ONBOARDING_TOTAL_STEPS),
|
|
715
|
+
draft: onboardingDraftSchema.optional(),
|
|
716
|
+
});
|
|
717
|
+
//# sourceMappingURL=onboarding.js.map
|