founder-schema 0.35.0 → 0.37.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/dist/access/permissions.d.ts +5 -1
- package/dist/access/permissions.d.ts.map +1 -1
- package/dist/access/permissions.js +2 -0
- package/dist/access/permissions.js.map +1 -1
- package/dist/access/standing.d.ts +1 -1
- package/dist/access/standing.js +1 -1
- package/dist/access/standing.js.map +1 -1
- package/dist/domains/audit/audit.d.ts +6 -1
- package/dist/domains/audit/audit.d.ts.map +1 -1
- package/dist/domains/audit/audit.js +8 -0
- package/dist/domains/audit/audit.js.map +1 -1
- package/dist/domains/billing/billing.d.ts +35 -2
- package/dist/domains/billing/billing.d.ts.map +1 -1
- package/dist/domains/billing/billing.js +5 -3
- package/dist/domains/billing/billing.js.map +1 -1
- package/dist/domains/members/signups.d.ts +113 -0
- package/dist/domains/members/signups.d.ts.map +1 -0
- package/dist/domains/members/signups.js +69 -0
- package/dist/domains/members/signups.js.map +1 -0
- package/dist/domains/membership/membership.d.ts +74 -16
- package/dist/domains/membership/membership.d.ts.map +1 -1
- package/dist/domains/membership/membership.js +136 -34
- package/dist/domains/membership/membership.js.map +1 -1
- package/dist/domains/onboarding/onboarding.d.ts +142 -93
- package/dist/domains/onboarding/onboarding.d.ts.map +1 -1
- package/dist/domains/onboarding/onboarding.js +107 -20
- package/dist/domains/onboarding/onboarding.js.map +1 -1
- package/dist/domains/profile/founder-profile.d.ts +3 -3
- package/dist/domains/profile/founder-profile.js +3 -3
- package/dist/domains/profile/founder-profile.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onboarding.js","sourceRoot":"","sources":["../../../src/domains/onboarding/onboarding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;A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E;CACd,CAAC,CAAC;AAGH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;IACtB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,sBAAsB,CAAC;IACzD,KAAK,EAAE,qBAAqB,CAAC,QAAQ,EAAE;IACvC;;;;;;OAMG;IACH,KAAK,EAAE,gBAAgB,CAAC,QAAQ,EAAE;CACnC,CAAC,CAAC","sourcesContent":["/**\n * founder-schema — Onboarding: steps, enums, and the two shapes of the answers\n *\n * ONE LIST DEFINES THE FLOW, AND IT IS DERIVED. Each step's fields are a pick\n * of the finish body (`ONBOARDING_STEP_SCHEMAS`), and `FOUNDER_ONBOARDING_STEPS`\n * is built FROM those picks: its `fields`, and even whether a step may be\n * skipped, come from the schema rather than from a second hand-written list.\n * GymMonk arrived at one list after keeping two in sync by hand, where a step\n * could exist with no title or, worse, no validation gate at all; until 0.2.0\n * this file still wrote the field lists twice.\n *\n * TWO SHAPES, ONE SET OF RULES. A half-filled form legitimately holds `null`\n * for a choice nobody has made yet; the finalize body only ever sees completed\n * answers. So the rules are written once and expressed over both shapes:\n * `onboardingFormSchema` for work in progress and `completeOnboardingBodySchema`\n * for the end. Letting those two drift is how a wizard says a step is optional\n * and then answers 422 at Finish.\n *\n * NO COPY IN HERE. A step's label and title are translation KEYS\n * (`labelKey`, `titleKey`), Jansathi's rule for every config string: an English\n * sentence in a shared package is a sentence every other language has to match\n * by wording. A topic category is named by its `key`, which the client words\n * (0.6.0 dropped its `labelKey`: the web, English-only since 2026-10-06, read\n * nothing from it).\n *\n * @module founder-schema/domains/onboarding\n */\n\nimport { z } from 'zod';\nimport {\n eachOnce,\n fullNameSchema,\n GENDER_VALUES,\n GOAL_VALUES,\n type Goal,\n genderSchema,\n goalSchema,\n INDUSTRY_VALUES,\n industrySchema,\n objectIdSchema,\n optionalTrimmedString,\n phoneSchema,\n requiredGoalListSchema,\n SKILL_VALUES,\n STARTUP_STAGE_VALUES,\n skillSchema,\n startupStageSchema,\n usernameSchema,\n} from '../../core/common.js';\nimport {\n ABOUT_MAX,\n DAY_MS,\n DISPLAY_NAME_MAX,\n HEADLINE_MAX,\n INDIA_UTC_OFFSET_MS,\n LINK_URL_MAX,\n SKILLS_MAX,\n TEAM_SIZE_MAX,\n VENTURE_NAME_MAX,\n VENTURE_TAGLINE_MAX,\n} from '../../core/limits.js';\nimport { VALIDATION_MESSAGE } from '../../core/validation.js';\nimport { locationPickSchema, placeSchema } from '../location/areas.js';\nimport { mediaImageSchema } from '../media/media.js';\nimport {\n founderLinksSchema,\n VENTURE_ROLE_VALUES,\n ventureRoleSchema,\n ventureWriteSchema,\n} from '../profile/founder-profile.js';\n\n// ─── Age ─────────────────────────────────────────────────────────────────────\n\n/**\n * 18, ruled by the user 2026-09-21. Under-18 would pull in parental-consent\n * duties under the DPDP Act, which is a different and larger problem than a\n * validation rule.\n *\n * ⚠️ The SERVER refuses at finalize. This schema exists so the member sees a\n * useful message; it is not the gate.\n */\nexport const MIN_AGE_YEARS = 18;\n/** A sanity ceiling, not a product rule. Catches a mistyped year. */\nexport const MAX_AGE_YEARS = 120;\n\n/**\n * Whole years completed, by the calendar.\n *\n * ⚠️ NOT `elapsedMs / (365.25 * day)`, which is what the sibling product uses.\n * That approximation reads 17.9986 at the start of somebody's eighteenth\n * birthday and only crosses 18 about halfway through the day, so it refuses\n * them for the half of their birthday they are most likely to be signing up on.\n * Measured: it disagrees with the calendar on all 400 of the next 400 days.\n * An age gate is exactly the place an approximation is not good enough.\n */\nexport function ageInYears(isoDate: string, now: Date = new Date()): number {\n // ⚠️ A STRING, `YYYY-MM-DD`, not a `Date`. This is a wire contract, so it\n // takes the wire type. The backend is the obvious caller and the backend\n // holds a `Date`, so it must format first; passing the Date straight in used\n // to fail with `isoDate.split is not a function`, which says nothing useful.\n // Naming the fix costs one line and saves the next person the detour.\n if (typeof isoDate !== 'string') {\n throw new TypeError(\n 'ageInYears expects a YYYY-MM-DD string, not a Date. Format it first, e.g. date.toISOString().slice(0, 10).',\n );\n }\n const [y, m, d] = isoDate.split('-').map(Number) as [number, number, number];\n // The date TODAY IS IN INDIA (0.13.0), where the members are: a birthday\n // begins at midnight there, not five and a half hours later at UTC's\n // midnight. India keeps one offset all year.\n const today = new Date(now.getTime() + INDIA_UTC_OFFSET_MS);\n let age = today.getUTCFullYear() - y;\n const monthNow = today.getUTCMonth() + 1;\n if (monthNow < m || (monthNow === m && today.getUTCDate() < d)) age -= 1;\n return age;\n}\n\n/** A calendar date with no time component, `YYYY-MM-DD`. */\nexport const isoDateSchema = z\n .string()\n .trim()\n .regex(/^\\d{4}-\\d{2}-\\d{2}$/, VALIDATION_MESSAGE.dateInvalid);\nexport type IsoDate = z.infer<typeof isoDateSchema>;\n\n/** True only for a date that exists. Rejects 2026-02-30 and 2026-13-01. */\nfunction isRealDate(iso: string): boolean {\n const [y, m, d] = iso.split('-').map(Number) as [number, number, number];\n if (m < 1 || m > 12 || d < 1) return false;\n const asDate = new Date(Date.UTC(y, m - 1, d));\n return (\n asDate.getUTCFullYear() === y && asDate.getUTCMonth() === m - 1 && asDate.getUTCDate() === d\n );\n}\n\n/**\n * True for a `YYYY-MM-DD` that is a real calendar date (0.17.0, exported so a\n * client's date picker checks a date exactly as `dateOfBirthSchema` does):\n * not 2026-02-30, not 2026-13-01.\n */\nexport function isRealIsoDate(value: string): boolean {\n return isoDateSchema.safeParse(value).success && isRealDate(value.trim());\n}\n\n/** `YYYY-MM-DD` for a moment, counted in India's calendar. */\nconst isoInIndia = (moment: number): IsoDate =>\n new Date(moment + INDIA_UTC_OFFSET_MS).toISOString().slice(0, 10);\n\n/**\n * Today in India, `YYYY-MM-DD` (0.17.0): the day every age here is counted\n * from (`ageInYears`), so a client's \"today\" must be this one, never the\n * device's own: east of India the device is already on tomorrow.\n */\nexport function todayInIndia(now: Date = new Date()): IsoDate {\n return isoInIndia(now.getTime());\n}\n\nconst isoOfUtc = (ms: number): IsoDate => new Date(ms).toISOString().slice(0, 10);\n\n/**\n * The dates of birth `dateOfBirthSchema` accepts TODAY, both ends included\n * (0.17.0): `latest` makes someone exactly `MIN_AGE_YEARS` today, `earliest`\n * exactly `MAX_AGE_YEARS`. Worked out with `ageInYears` itself, so a picker\n * that offers only this window can never offer a date the schema refuses, a\n * 29 February included.\n */\nexport function dateOfBirthBounds(now: Date = new Date()): { earliest: IsoDate; latest: IsoDate } {\n const [y, m, d] = todayInIndia(now).split('-').map(Number) as [number, number, number];\n let latest = Date.UTC(y - MIN_AGE_YEARS, m - 1, d);\n while (ageInYears(isoOfUtc(latest), now) < MIN_AGE_YEARS) latest -= DAY_MS;\n let earliest = Date.UTC(y - MAX_AGE_YEARS - 1, m - 1, d);\n while (ageInYears(isoOfUtc(earliest), now) > MAX_AGE_YEARS) earliest += DAY_MS;\n return { earliest: isoOfUtc(earliest), latest: isoOfUtc(latest) };\n}\n\n/**\n * True only for a COMPLETE, real date of birth that is under `MIN_AGE_YEARS`\n * today (0.17.0): the rule the server applies to a draft, where a date still\n * being typed must pass (\"19\" says nothing about anyone's age yet). Until\n * 0.17.0 the backend wrote this out by hand and skipped the real-date check.\n */\nexport function isUnderAgeDateOfBirth(value: unknown, now: Date = new Date()): boolean {\n if (typeof value !== 'string' || !isRealIsoDate(value)) return false;\n return ageInYears(value.trim(), now) < MIN_AGE_YEARS;\n}\n\n/** A `YYYY-MM-DD` as the instant it is stored as: midnight UTC that day (0.17.0). */\nexport const isoDateToDate = (iso: IsoDate): Date => new Date(`${iso.trim()}T00:00:00.000Z`);\n\n/** A stored date (midnight UTC) as `YYYY-MM-DD` (0.17.0): `isoDateToDate`'s inverse. */\nexport const dateToIsoDate = (date: Date): IsoDate => date.toISOString().slice(0, 10);\n\n/**\n * Date of birth, with the age gate applied per parse.\n *\n * ⚠️ THE CLIENT IS NOT THE GATE. This schema exists so the member sees a useful\n * message, and the server must refuse the same dates at finalize regardless.\n * The sibling dating product validates the identical rule on its client and\n * still shipped a defect where an under-age date of birth produced a live,\n * discoverable profile, because the client was the only thing checking.\n */\nexport const dateOfBirthSchema = isoDateSchema\n .refine(isRealDate, { error: VALIDATION_MESSAGE.dobInvalid })\n .refine((v) => ageInYears(v) >= MIN_AGE_YEARS, { error: VALIDATION_MESSAGE.dobUnderAge })\n .refine((v) => ageInYears(v) <= MAX_AGE_YEARS, { error: VALIDATION_MESSAGE.dobTooOld });\nexport type DateOfBirth = z.infer<typeof dateOfBirthSchema>;\n\n// ─── Business ────────────────────────────────────────────────────────────────\n\n/**\n * How the business is registered in India, or that it is not yet (0.16.0, the\n * user, 2026-10-18: \"the categories that we have in India like private\n * limited, LLP or OPC or proprietorship\").\n *\n * The forms Indian law provides: a sole proprietorship and a partnership firm\n * (Indian Partnership Act, 1932), a limited liability partnership (LLP Act,\n * 2008), a one person, private limited, public limited or Section 8 (not for\n * profit) company (Companies Act, 2013), a trust or society, and a\n * co-operative society. Two more are answers a founder often has: not\n * registered yet (an idea, or a side project), and registered outside India\n * (an Indian team whose company is incorporated abroad, often in the US).\n *\n * Optional, and private to the member: nothing here verifies it (documents\n * are a settings matter, by the user's ruling).\n *\n * ⚠ Stored on the profile's venture and a Mongoose enum. Append only.\n */\nexport const LEGAL_STRUCTURE_VALUES = [\n 'not_registered',\n 'sole_proprietorship',\n 'partnership',\n 'llp',\n 'opc',\n 'private_limited',\n 'public_limited',\n 'section_8',\n 'trust_or_society',\n 'cooperative',\n 'registered_abroad',\n] as const;\nexport const legalStructureSchema = z.enum(LEGAL_STRUCTURE_VALUES);\nexport type LegalStructure = z.infer<typeof legalStructureSchema>;\n\n// ─── Topics: the shared vocabulary ───────────────────────────────────────────────────────────────\n\n/**\n * ONE vocabulary, used TWICE: a member picks these as their `interests`, and a\n * post carries them as its `topics`. That is what makes relevance an index\n * lookup rather than a guess, and it is why this list is not called \"interests\"\n * - naming it for one of its two jobs would have invited a second list for the\n * other, which is the mistake this package has already made once with goals.\n * (User's ruling via hary, 2026-09-21.)\n *\n * Deliberately DISTINCT from two neighbours that will otherwise collect the\n * same words:\n *\n * industry what your company does\n * skills what you can do\n * interests what you want to read about\n *\n * If the copy does not keep them apart, members fill all three identically and\n * every one of them stops telling us anything.\n *\n * A closed list, consistent with industry, skill and stage, for the reason\n * already written beside those: free text means two people typing \"growth\" and\n * \"Growth Marketing\" never match, and matching is the entire point. The cost is\n * that adding an interest needs a publish.\n *\n * Tuned down from the dating product's 246, which is mostly dating material.\n * Values reuse its exact strings wherever one existed, so its Hindi\n * translations can be lifted across.\n *\n * ⚠️ Stored per member. Append only; removing a value orphans data.\n */\nexport const TOPIC_VALUES = [\n // Career growth\n 'mentoring',\n 'leadership',\n 'networking',\n 'public_speaking',\n 'teaching',\n 'hiring_talent',\n 'personal_branding',\n 'career_transition',\n 'remote_work',\n // Innovation and tech\n 'ai_ml',\n 'blockchain',\n 'crypto_web3',\n 'robotics',\n 'data_science',\n 'cybersecurity',\n 'game_dev',\n 'ux_design',\n 'app_development',\n 'open_source',\n 'electronics',\n 'space_exploration',\n 'green_tech',\n 'deeptech',\n 'no_code',\n // Business\n 'entrepreneurship',\n 'investing',\n 'stock_trading',\n 'personal_finance',\n 'fundraising',\n 'marketing',\n 'sales',\n 'consulting',\n 'ecommerce',\n 'retail',\n 'real_estate',\n 'supply_chain',\n 'product_management',\n 'growth',\n 'b2b_saas',\n 'd2c',\n // Personal development\n 'meditation',\n 'journaling',\n 'self_improvement',\n 'productivity',\n 'reading',\n 'online_courses',\n 'philosophy',\n 'psychology',\n 'therapy',\n 'sleep_optimization',\n 'gym',\n 'yoga',\n // Creative\n 'photography',\n 'writing',\n 'graphic_design',\n 'filmmaking',\n 'digital_art',\n 'content_creation',\n 'blogging',\n 'vlogging',\n 'podcasts',\n 'animation',\n 'music_production',\n // Impact and community\n 'volunteering',\n 'ngo_work',\n 'environmental',\n 'women_empowerment',\n 'community_service',\n 'social_enterprise',\n 'education_access',\n] as const;\nexport const topicSchema = z.enum(TOPIC_VALUES);\nexport type Topic = z.infer<typeof topicSchema>;\n\n/**\n * The grouping the picker renders.\n *\n * ⚠️ `TOPIC_VALUES` above is the single source of truth and this is typed\n * against it, so a typo here is a compile error rather than a chip that renders\n * and can never be selected. The dating product keeps a categorised list and a\n * flat list side by side and they have already drifted apart by two values;\n * a test in this package asserts these two agree exactly, in both directions.\n */\nexport const TOPIC_CATEGORY_KEYS = [\n 'career',\n 'tech',\n 'business',\n 'growth',\n 'creative',\n 'impact',\n] as const;\nexport type TopicCategoryKey = (typeof TOPIC_CATEGORY_KEYS)[number];\n\n/**\n * One group of the picker: its `key` (the client words it) and its topics.\n * Breaking in 0.6.0: no `labelKey`.\n */\nexport interface TopicCategory {\n key: TopicCategoryKey;\n values: readonly Topic[];\n}\n\nconst topicCategory = (key: TopicCategoryKey, values: readonly Topic[]): TopicCategory => ({\n key,\n values,\n});\n\nexport const TOPIC_CATEGORIES: readonly TopicCategory[] = [\n topicCategory('career', [\n 'mentoring',\n 'leadership',\n 'networking',\n 'public_speaking',\n 'teaching',\n 'hiring_talent',\n 'personal_branding',\n 'career_transition',\n 'remote_work',\n ]),\n topicCategory('tech', [\n 'ai_ml',\n 'blockchain',\n 'crypto_web3',\n 'robotics',\n 'data_science',\n 'cybersecurity',\n 'game_dev',\n 'ux_design',\n 'app_development',\n 'open_source',\n 'electronics',\n 'space_exploration',\n 'green_tech',\n 'deeptech',\n 'no_code',\n ]),\n topicCategory('business', [\n 'entrepreneurship',\n 'investing',\n 'stock_trading',\n 'personal_finance',\n 'fundraising',\n 'marketing',\n 'sales',\n 'consulting',\n 'ecommerce',\n 'retail',\n 'real_estate',\n 'supply_chain',\n 'product_management',\n 'growth',\n 'b2b_saas',\n 'd2c',\n ]),\n topicCategory('growth', [\n 'meditation',\n 'journaling',\n 'self_improvement',\n 'productivity',\n 'reading',\n 'online_courses',\n 'philosophy',\n 'psychology',\n 'therapy',\n 'sleep_optimization',\n 'gym',\n 'yoga',\n ]),\n topicCategory('creative', [\n 'photography',\n 'writing',\n 'graphic_design',\n 'filmmaking',\n 'digital_art',\n 'content_creation',\n 'blogging',\n 'vlogging',\n 'podcasts',\n 'animation',\n 'music_production',\n ]),\n topicCategory('impact', [\n 'volunteering',\n 'ngo_work',\n 'environmental',\n 'women_empowerment',\n 'community_service',\n 'social_enterprise',\n 'education_access',\n ]),\n];\n\n// ─── Goals: the grouping the picker renders ──────────────────────────────────\n\n/**\n * The goals step's three headings (0.17.0, moved here from the web, where the\n * grouping lived in the screen): eighteen goals since 0.16.0, shown a group at\n * a time so the eye takes six tiles, not a wall of eighteen. A group is named\n * by its `key`, which the client words, like a topic category.\n *\n * ⚠ `GOAL_VALUES` stays the single source of truth for what a goal IS; this is\n * typed against it, and a test holds the two together in both directions:\n * every goal in exactly one group, nothing in a group that is not a goal.\n */\nexport const GOAL_CATEGORY_KEYS = ['build', 'grow', 'learn'] as const;\nexport type GoalCategoryKey = (typeof GOAL_CATEGORY_KEYS)[number];\n\n/** One group of the goals picker: its `key` (the client words it) and its goals, in order. */\nexport interface GoalCategory {\n key: GoalCategoryKey;\n values: readonly Goal[];\n}\n\nexport const GOAL_CATEGORIES: readonly GoalCategory[] = [\n {\n key: 'build',\n values: [\n 'start_company',\n 'get_feedback',\n 'find_cofounder',\n 'find_testers',\n 'hiring',\n 'find_service_providers',\n ],\n },\n {\n key: 'grow',\n values: [\n 'find_customers',\n 'find_investors',\n 'partnerships',\n 'market_insights',\n 'business_ideas',\n 'grow_network',\n ],\n },\n {\n key: 'learn',\n values: [\n 'learn_startup',\n 'mentorship',\n 'attend_events',\n 'join_startup',\n 'mentor_others',\n 'invest_in_startups',\n ],\n },\n];\n\n/**\n * How many a member must pick. A minimum exists because these drive feed\n * relevance and zero of them means no relevance at all.\n *\n * ⚠️ If 3 turns out to be hard to reach against this list, that is a signal\n * about the LIST, not about the minimum. The sibling product enforces no\n * minimum at all, and its own field config says \"pick up to 10\" while every\n * screen and schema enforces 20.\n */\nexport const INTERESTS_MIN = 3;\nexport const INTERESTS_MAX = 10;\n\n/**\n * A member's interests, by ONE rule (0.16.0): onboarding's finish and the Me\n * tab's editor (`putMyInterestsBodySchema`) both apply this very schema, so a\n * list one accepts the other can never refuse.\n *\n * Each topic only once: without that, three copies of one topic met the\n * minimum of three while meaning one interest.\n */\nexport const interestsSchema = z\n .array(topicSchema)\n .min(INTERESTS_MIN)\n .max(INTERESTS_MAX)\n .refine(eachOnce, {\n error: VALIDATION_MESSAGE.topicsDuplicate,\n });\n\n// ─── The step keys ───────────────────────────────────────────────────────────\n\n/**\n * The step keys, in order, as a literal union, so a consumer can key a table by\n * step and have TypeScript insist on every one. Before 0.2.0 `key` was a plain\n * string and the web client kept its own copy of this list to get the same\n * check; a test there held the two together. Now there is one list.\n *\n * 0.16.0 (the user, 2026-10-18) split the old first step, `identity`, into\n * three: `basics` (full name, gender, date of birth, nothing else), `photo`\n * (the photo alone) and `professional` (title, about, skills). Nine steps, up\n * from seven.\n *\n * 2026-11-22 (the user: \"lets remove this step from onboring\"): `professional`\n * went. Eight steps. The title, about and skills stay on the profile, edited\n * in Me; a member who typed them into a draft before keeps them (the server\n * carries them at finish, `legacyProfessionalAnswers`).\n *\n * ⚠ THE SERVER'S RESUME CURSOR IS AN INDEX INTO THIS LIST, so re-ordering it\n * moves every member who stopped part-way. A cursor saved under an older list\n * is translated by the backend, by step NAME (its progress rows carry the\n * list's version); any further change needs the same.\n */\nexport const ONBOARDING_STEP_KEYS = [\n 'basics',\n 'photo',\n 'contact',\n 'location',\n 'goals',\n 'interests',\n 'business',\n 'guidelines',\n] as const;\nexport type OnboardingStepKey = (typeof ONBOARDING_STEP_KEYS)[number];\n\n// ─── Guidelines ──────────────────────────────────────────────────────────────\n\n/**\n * The community guidelines a member agrees to at the last step, by version.\n *\n * The finish body accepts THIS version and no other: an old tab still showing\n * last month's text cannot record agreement to text it never displayed, and\n * `'whatever'` is not a version. Until 0.2.0 any non-empty string passed, and\n * the web client held this constant on its own.\n *\n * ⚠ Changing the guidelines text means bumping this, in the same publish.\n * Every member who agreed to an earlier version keeps that version on their\n * profile; that record is the point.\n */\nexport const GUIDELINES_VERSION = '2026-10-03' as const;\n/**\n * Not agreed at all (the box left unticked) is `guidelinesRequired`; agreed to\n * another text is `guidelinesOutdated` (0.17.0: both were the second, so a\n * client had to word an unticked box itself).\n */\nexport const guidelinesVersionSchema = z.literal(GUIDELINES_VERSION, {\n error: (issue) =>\n issue.input === undefined || issue.input === null\n ? VALIDATION_MESSAGE.guidelinesRequired\n : VALIDATION_MESSAGE.guidelinesOutdated,\n});\n\n// ─── Contact ─────────────────────────────────────────────────────────────────\n\n/**\n * The links the contact step collects, picked from the profile's own links so\n * the two cannot disagree on what a link is. The phone is `phoneSchema`: ten\n * digits, stored raw with no country code, on the account rather than here.\n */\nexport const contactLinksSchema = founderLinksSchema.pick({\n linkedin: true,\n x: true,\n instagram: true,\n});\nexport type ContactLinks = z.infer<typeof contactLinksSchema>;\n\n/** A team size has at most this many digits: `TEAM_SIZE_MAX` written out. */\nexport const TEAM_SIZE_DIGITS_MAX = String(TEAM_SIZE_MAX).length;\n\n/**\n * A team size as typed, kept to what the field may hold: digits only, at most\n * `TEAM_SIZE_DIGITS_MAX` (0.17.0: the draft reader and every client's field\n * clean it with this one rule).\n */\nexport const teamSizeDigits = (raw: string): string =>\n raw.replace(/\\D/g, '').slice(0, TEAM_SIZE_DIGITS_MAX);\n\n// ─── The form, mid-flight: the draft each step saves ──────────────────────────\n\n/**\n * The answers so far, keyed by the finish body's own field names: what each\n * step SAVES (`PATCH /onboarding`, merged per field), what `GET` hands back\n * to resume, and so the only keys a draft may hold\n * (`ONBOARDING_DRAFT_KEYS`).\n *\n * RAW, on purpose: a draft is what the member TYPED, not what Finish will send.\n * A half-typed link is ordinary text, a team size is digits as typed, and every\n * choice is `null` until made (\"not answered\" is not \"answered with nothing\").\n * Nothing here is required; whether a member may FINISH is\n * `completeOnboardingBodySchema`'s decision, and the client builds that body\n * from these answers.\n *\n * Screens may hold a different shape on top of this one. Derive that type from\n * `OnboardingForm` rather than writing it out, so a field added here reaches\n * every screen. (Since 0.16.0 the name is asked as one full name; since 0.20.0\n * its key is `fullName`, and the server splits it into the first and last name\n * it stores, the display name being those two joined.)\n *\n * A stored draft is UNTRUSTED when it comes back: an older client, or another\n * one, wrote it, and the server stores values opaquely. Read it with\n * `readOnboardingDraft`, never by casting.\n */\n/** Longest date of birth an answer may be: `YYYY-MM-DD` (0.18.0: exported; the form and the draft reader use it). */\nexport const DATE_INPUT_MAX = 10;\n/** Longest phone number an answer may be, as typed with spaces and a `+91`. */\nexport const PHONE_INPUT_MAX = 20;\n/** Longest guidelines version an answer may carry (`GUIDELINES_VERSION` is a date). */\nexport const GUIDELINES_VERSION_MAX = 32;\n\nexport const onboardingFormSchema = z.object({\n fullName: z.string().max(DISPLAY_NAME_MAX),\n gender: genderSchema.nullable(),\n /** `YYYY-MM-DD` once complete; whatever has been typed until then. */\n dateOfBirth: z.string().max(DATE_INPUT_MAX),\n /**\n * The completed upload's id (`media`, purpose `avatar`), or `null` for no\n * photo.\n *\n * SAVED BY THE PHOTO STEP, KEPT BY THE SERVER, NOT IN THE DRAFT (0.17.0). A\n * step save carrying this key hands the upload to the server, which holds it\n * for the draft (so the unattached sweep, `MEDIA_UNATTACHED_TTL_HOURS`, never\n * deletes it) and lets go of the one it replaces; `null` lets go of it. It\n * comes back as the status's `photo`, read from what the server holds, never\n * from a stored draft: `readOnboardingDraft` still gives `null` here, so an\n * id an older client left in a draft is never trusted.\n */\n avatarMediaId: objectIdSchema.nullable(),\n\n /** As typed; the finish body takes `phoneSchema`'s ten digits. */\n phone: z.string().max(PHONE_INPUT_MAX),\n /** As typed; the finish body takes full `https://` URLs. */\n links: z.object({\n linkedin: z.string().max(LINK_URL_MAX),\n x: z.string().max(LINK_URL_MAX),\n instagram: z.string().max(LINK_URL_MAX),\n }),\n\n /**\n * `null` until the member picks a place (the drawer, or GPS then confirmed),\n * and when they leave the step without one (0.19.0: a place from\n * `master_db`, with its names, so the step shows it again after a reload).\n */\n location: placeSchema.nullable(),\n\n goals: z.array(goalSchema).max(GOAL_VALUES.length),\n interests: z.array(topicSchema).max(INTERESTS_MAX),\n\n /**\n * Always present; empty until started. The startup step (2026-11-22) asks\n * its description (the venture's `tagline`) and the member's roles too.\n * Those two DEFAULT when absent, so a draft from a client older than them\n * still saves.\n */\n venture: z.object({\n name: z.string().max(VENTURE_NAME_MAX),\n tagline: z.string().max(VENTURE_TAGLINE_MAX).default(''),\n roles: z.array(ventureRoleSchema).max(VENTURE_ROLE_VALUES.length).default([]),\n website: z.string().max(LINK_URL_MAX),\n industry: industrySchema.nullable(),\n stage: startupStageSchema.nullable(),\n /** Digits as typed, at most `TEAM_SIZE_DIGITS_MAX`; the body sends a number. */\n teamSize: z.string().max(TEAM_SIZE_DIGITS_MAX),\n }),\n legalStructure: legalStructureSchema.nullable(),\n\n /** The guidelines text the member agreed to, or `null`. */\n guidelinesVersion: z.string().max(GUIDELINES_VERSION_MAX).nullable(),\n});\nexport type OnboardingForm = z.infer<typeof onboardingFormSchema>;\n\n// ─── Reading a stored draft back ─────────────────────────────────────────────\n\n/** Text, cut to its limit; anything that is not text is \"not answered\". */\nconst draftText = (max: number) =>\n z\n .string()\n .catch('')\n .transform((v) => v.slice(0, max));\n\n/** One of a vocabulary, or `null` (\"not answered\"). */\nconst draftChoice = <T extends readonly [string, ...string[]]>(values: T) =>\n z.enum(values).nullable().catch(null);\n\n/**\n * Items of a vocabulary, deduplicated and capped. Unknown items (a value since\n * retired, or junk) are dropped one by one, so the rest of the answer survives.\n */\nconst draftList = <T extends readonly [string, ...string[]]>(values: T, max: number) =>\n z\n .array(z.unknown())\n .catch([])\n .transform((items) => {\n const allowed = new Set<string>(values);\n const kept = items.filter((v): v is T[number] => typeof v === 'string' && allowed.has(v));\n return [...new Set(kept)].slice(0, max);\n });\n\n/** An object of the given fields, or `null` when the draft holds none. */\nconst draftObject = <S extends z.ZodRawShape>(shape: S) =>\n z\n .record(z.string(), z.unknown())\n .nullable()\n .catch(null)\n .pipe(z.union([z.null(), z.object(shape)]));\n\nconst draftReaderSchema = z.object({\n fullName: draftText(DISPLAY_NAME_MAX),\n gender: draftChoice(GENDER_VALUES),\n dateOfBirth: draftText(DATE_INPUT_MAX),\n avatarMediaId: z\n .unknown()\n .optional()\n .transform(() => null),\n phone: draftText(PHONE_INPUT_MAX),\n links: draftObject({\n linkedin: draftText(LINK_URL_MAX),\n x: draftText(LINK_URL_MAX),\n instagram: draftText(LINK_URL_MAX),\n }).transform((links) => links ?? { linkedin: '', x: '', instagram: '' }),\n // A place, whole or not at all: a draft saved before 0.19.0 held a typed\n // city and state, which name no area, so it reads as \"not answered yet\".\n location: placeSchema.nullable().catch(null),\n goals: draftList(GOAL_VALUES, GOAL_VALUES.length),\n interests: draftList(TOPIC_VALUES, INTERESTS_MAX),\n venture: draftObject({\n name: draftText(VENTURE_NAME_MAX),\n // A draft saved before the startup step asked these holds neither.\n tagline: z.unknown().optional().pipe(draftText(VENTURE_TAGLINE_MAX)),\n roles: z.unknown().optional().pipe(draftList(VENTURE_ROLE_VALUES, VENTURE_ROLE_VALUES.length)),\n website: draftText(LINK_URL_MAX),\n industry: draftChoice(INDUSTRY_VALUES),\n stage: draftChoice(STARTUP_STAGE_VALUES),\n teamSize: z.string().catch('').transform(teamSizeDigits),\n }).transform((venture) => venture ?? { ...EMPTY_ONBOARDING_VENTURE, roles: [] }),\n legalStructure: draftChoice(LEGAL_STRUCTURE_VALUES),\n /** Agreement to an OLDER text is not agreement to this one. */\n guidelinesVersion: z\n .unknown()\n .optional()\n .transform((v) => (v === GUIDELINES_VERSION ? GUIDELINES_VERSION : null)),\n});\n\n/** The business step before anything is chosen. */\nexport const EMPTY_ONBOARDING_VENTURE: OnboardingForm['venture'] = {\n name: '',\n tagline: '',\n roles: [],\n website: '',\n industry: null,\n stage: null,\n teamSize: '',\n};\n\n/**\n * A stored draft as an `OnboardingForm`, FIELD BY FIELD.\n *\n * Every field is checked against its own vocabulary and cut to its own limit;\n * one that does not fit becomes \"not answered\" (`''`, `null`, `[]`) and the\n * rest of the draft survives. Never coerced into a different answer: a value\n * outside a vocabulary is dropped, not mapped to the nearest one. A photo\n * is never restored from here (it comes back as the status's `photo`; see\n * `avatarMediaId`), and agreement only counts for the CURRENT guidelines.\n *\n * It fills in no answer the member did not give: a blank country stays blank.\n * Whatever a screen shows by default is that screen's choice.\n */\nexport function readOnboardingDraft(draft: unknown): OnboardingForm {\n const raw: Record<string, unknown> =\n draft && typeof draft === 'object' && !Array.isArray(draft)\n ? (draft as Record<string, unknown>)\n : {};\n // 0.20.0 renamed the name answer `displayName` to `fullName`: a draft saved\n // before keeps the name its member typed.\n const source =\n 'fullName' in raw || !('displayName' in raw) ? raw : { ...raw, fullName: raw.displayName };\n return draftReaderSchema.parse(source);\n}\n\n// ─── The finalize body ───────────────────────────────────────────────────────\n\n/**\n * The finish body's fields, before the rules that span fields: what each\n * step's slice is PICKED from (Zod 4 refuses `.pick` on a refined object).\n * Everything outside this file reads `completeOnboardingBodySchema`, whose\n * note below says what the body is.\n */\nconst completeOnboardingBodyFields = z.object({\n // Plain bounds, no custom message: `too_small` with minimum 1 already says\n // \"required\", and the client words it in the member's language. The full\n // name as typed (0.20.0): the server splits it and stores first and last.\n fullName: fullNameSchema,\n /**\n * ⚠️ NO `username` HERE, and its absence is deliberate.\n *\n * It used to be required, and that was a defect: no onboarding step collects\n * one, the design draws no screen for one, and it was not even on the\n * in-progress form, so a finalize could never have succeeded. Found by\n * checking every finalize-required field against the step list; a test now\n * asserts that relationship in both directions.\n *\n * The handle is DERIVED SERVER-SIDE at finalize and edited later from the Me\n * tab, which is what the product describes. That also makes the collision\n * case kinder: a server deriving a handle can suffix it and move on, whereas\n * a member who picked one six steps ago can only be told, at the end, that\n * step one failed.\n */\n gender: genderSchema,\n dateOfBirth: dateOfBirthSchema,\n /**\n * A completed avatar upload (`media`, purpose `avatar`). The server attaches\n * it inside the same transaction that creates the profile, so a refused\n * Finish leaves the upload unattached (and swept), never half-used.\n */\n avatarMediaId: objectIdSchema.optional(),\n\n phone: phoneSchema,\n links: contactLinksSchema.optional(),\n\n /**\n * Absent when the member left the step without a place. Area ids (0.19.0,\n * `locationPickSchema`): the server names the place from `master_db`.\n */\n location: locationPickSchema.optional(),\n\n /** The shared list rule (each goal once, 0.17.0) plus finish's minimum. */\n goals: requiredGoalListSchema,\n interests: interestsSchema,\n\n /**\n * Absent when the member skipped the business step. The profile's venture\n * without `foundedYear`, which onboarding does not ask; the Me tab does.\n */\n venture: ventureWriteSchema.omit({ foundedYear: true }).optional(),\n /** How the venture is registered, if the member says. Stored on the venture. */\n legalStructure: legalStructureSchema.optional(),\n\n /**\n * The version of the guidelines this member read: `GUIDELINES_VERSION`,\n * exactly.\n *\n * A version and not a boolean, and the server stamps the time. A boolean says\n * somebody agreed; a version and a timestamp say WHAT they agreed to and\n * WHEN, which is the only form worth anything the day the text changes or a\n * moderation decision is disputed.\n */\n guidelinesVersion: guidelinesVersionSchema,\n});\n\n/**\n * How it is registered DESCRIBES a venture, and is stored on it (0.17.0):\n * without one there is nothing to describe. It is refused ON ITS OWN FIELD\n * (`ventureRequired`: add the business, or clear this answer), never dropped\n * without a word, as the server did and as the web did with a lone \"Not\n * registered yet\" (hary's ruling: no silent drop). (The business type went,\n * 2026-11-22.)\n */\ntype VentureAnswers = { venture?: unknown; legalStructure?: unknown };\nconst registrationHasVenture = (body: VentureAnswers): boolean =>\n body.venture !== undefined || body.legalStructure === undefined;\nconst REGISTRATION_NEEDS_VENTURE = {\n error: VALIDATION_MESSAGE.ventureRequired,\n path: ['legalStructure'],\n};\n\n/**\n * What the client sends to finish. Completed answers only.\n *\n * ⚠️ EVERY OPTIONAL FIELD HERE MUST BE ABSENT WHEN UNANSWERED, never a default\n * standing in for one. The sibling gym product sent `bloodGroup ?? 'O+'`, so\n * every member who skipped the question was recorded as O-positive: a real\n * answer, indistinguishable from one somebody gave, sitting on a screen staff\n * would read in an emergency. Absent has to stay absent.\n *\n * ⚠️ AND THIS IS NOT THE GATE EITHER. The server re-checks the age and refuses\n * at finalize. `isOnboarded` may be set here and nowhere else: four of the\n * profile's partial indexes are gated on it, so a half-built profile carrying\n * it true appears in Discover half-built.\n *\n * Location, venture and links are the profile's own shapes, not copies: the\n * copies are how the profile model came to lack Instagram.\n *\n * Refined (the registration needs a venture, above), so Zod 4 throws on\n * `.pick` / `.omit` / `.partial` / `.merge` of it: read a field with\n * `.shape.<field>`, a step's with `ONBOARDING_STEP_SCHEMAS.<step>`.\n *\n * A plain object, not strict: a key from an older client (the business type,\n * or the title, about and skills of the step that went, 2026-11-22) is\n * dropped, never refused.\n */\nexport const completeOnboardingBodySchema = completeOnboardingBodyFields.refine(\n registrationHasVenture,\n REGISTRATION_NEEDS_VENTURE,\n);\nexport type CompleteOnboardingBody = z.infer<typeof completeOnboardingBodySchema>;\n/** What a form may hand to the finish body before parsing. */\nexport type CompleteOnboardingBodyInput = z.input<typeof completeOnboardingBodySchema>;\n\n// ─── The steps ───────────────────────────────────────────────────────────────\n\n/**\n * Each step's slice of the finish body, picked FROM it, so a client validating\n * \"may I leave this step\" and the server validating the finish apply the very\n * same rules. A copy would drift, and the drift shows up as a wizard that lets\n * a step pass and a finish that refuses it, on the last screen.\n *\n * THIS IS THE ONE PLACE A STEP'S FIELDS ARE WRITTEN. `FOUNDER_ONBOARDING_STEPS`\n * below reads them from here. A test asserts that every finish field belongs to\n * exactly one step.\n *\n * These validate the FINISH shape (skipped = absent), not the in-progress form:\n * a client maps its form state to the slice first. The server does not run them\n * on a draft save, because a half-answered step must be storable.\n */\nexport const ONBOARDING_STEP_SCHEMAS = {\n // 0.16.0: the old `identity` step, split by the user. The basics are the\n // step's only required answers; the photo may be passed over. (The third\n // part, `professional`, went on 2026-11-22.)\n basics: completeOnboardingBodyFields.pick({ fullName: true, gender: true, dateOfBirth: true }),\n photo: completeOnboardingBodyFields.pick({ avatarMediaId: true }),\n contact: completeOnboardingBodyFields.pick({ phone: true, links: true }),\n location: completeOnboardingBodyFields.pick({ location: true }),\n goals: completeOnboardingBodyFields.pick({ goals: true }),\n interests: completeOnboardingBodyFields.pick({ interests: true }),\n // \"Tell us about your startup\" (2026-11-22).\n business: completeOnboardingBodyFields\n .pick({\n venture: true,\n legalStructure: true,\n })\n .refine(registrationHasVenture, REGISTRATION_NEEDS_VENTURE),\n guidelines: completeOnboardingBodyFields.pick({ guidelinesVersion: true }),\n} as const satisfies Record<OnboardingStepKey, z.ZodObject>;\n\n/** One step's slice, parsed: `OnboardingStepBody<'contact'>` is `{ phone, links? }`. */\nexport type OnboardingStepBody<K extends OnboardingStepKey> = z.infer<\n (typeof ONBOARDING_STEP_SCHEMAS)[K]\n>;\n\n/** A finish-body field name. */\nexport type OnboardingField = keyof CompleteOnboardingBody;\n\n/**\n * One step of the wizard, as a client renders it.\n *\n * `fields` is what gates leaving this step: a field that appears in no step is\n * unreachable twice over, because Continue will not surface its error and the\n * final submit's jump-to-the-bad-step finds no step to jump to and leaves the\n * last screen dead.\n */\nexport interface OnboardingStepConfig {\n /** Stable identifier. Safe for analytics and for a resume cursor, unlike an index. */\n key: OnboardingStepKey;\n /**\n * Translation keys for what the step's header shows: its short label beside\n * the step number (\"STEP 4 OF 8 · LOCATION\") and its one question. The words\n * live in each client. There is no help line (the user removed it,\n * 2026-10-19; `helpKey` went in 0.17.0): who sees an answer is said on the\n * field it is about.\n */\n labelKey: `onboarding.steps.${OnboardingStepKey}.label`;\n titleKey: `onboarding.steps.${OnboardingStepKey}.title`;\n /** The step's slice of the finish body, in schema order. */\n fields: readonly OnboardingField[];\n /**\n * False when the whole step may be passed without answering anything.\n * DERIVED: a step is optional exactly when its slice accepts an empty\n * object, so \"skippable\" can never disagree with what the finish accepts.\n */\n required: boolean;\n}\n\nexport const FOUNDER_ONBOARDING_STEPS: readonly OnboardingStepConfig[] = ONBOARDING_STEP_KEYS.map(\n (key): OnboardingStepConfig => {\n const slice = ONBOARDING_STEP_SCHEMAS[key];\n return {\n key,\n labelKey: `onboarding.steps.${key}.label`,\n titleKey: `onboarding.steps.${key}.title`,\n fields: Object.keys(slice.shape) as OnboardingField[],\n required: !slice.safeParse({}).success,\n };\n },\n);\n\nexport const ONBOARDING_TOTAL_STEPS = FOUNDER_ONBOARDING_STEPS.length;\n\n/** Fields gating each step, in step order. Read from the same picks. */\nexport const ONBOARDING_STEP_FIELDS: readonly (readonly OnboardingField[])[] =\n FOUNDER_ONBOARDING_STEPS.map((s) => s.fields);\n\n/** What finishing answers: the new profile's id and the handle derived for it. */\nexport const completeOnboardingResponseSchema = z.object({\n id: objectIdSchema,\n username: usernameSchema,\n});\nexport type CompleteOnboardingResponse = z.infer<typeof completeOnboardingResponseSchema>;\n\n// ─── What a client older than 2026-11-22 still sends ──────────────────────────\n\n/** How many steps the list had before `professional` went: an older client's \"past the last step\". */\nexport const LEGACY_ONBOARDING_TOTAL_STEPS = 9;\n\n/**\n * The step that went (2026-11-22) asked a title, an about and skills. A client\n * loaded before still saves them, and they are KEPT, in its draft, with their\n * old bounds, so finish can carry them to the profile\n * (`legacyProfessionalAnswers`): what a member typed is never dropped. Never\n * handed back on resume (they are not the form's keys any more).\n */\nconst LEGACY_DRAFT_KEYS = {\n headline: z.string().max(HEADLINE_MAX).optional(),\n about: z.string().max(ABOUT_MAX).optional(),\n skills: z.array(skillSchema).max(SKILLS_MAX).optional(),\n /**\n * The business type went END TO END (2026-11-22): an older client's answer\n * is accepted, never refused, and dropped (`withoutBusinessType`), never\n * stored.\n */\n businessType: z.unknown().optional(),\n};\n\n/** The draft without the business type (an older client's), whatever it held. */\nfunction withoutBusinessType<T extends { businessType?: unknown }>(\n draft: T,\n): Omit<T, 'businessType'> {\n const { businessType: _gone, ...rest } = draft;\n return rest;\n}\n\n/**\n * A title, about and skills a member typed into the step that went\n * (2026-11-22), read from their STORED draft, each by its profile rule:\n * trimmed text within its limit, known skills each once. One that does not fit\n * is left out. The server writes these at finish, never from the body.\n */\nexport function legacyProfessionalAnswers(draft: unknown): {\n headline?: string;\n about?: string;\n skills?: z.infer<typeof skillSchema>[];\n} {\n const raw: Record<string, unknown> =\n draft && typeof draft === 'object' && !Array.isArray(draft)\n ? (draft as Record<string, unknown>)\n : {};\n const out: { headline?: string; about?: string; skills?: z.infer<typeof skillSchema>[] } = {};\n const headline = optionalTrimmedString(HEADLINE_MAX).safeParse(raw.headline);\n if (headline.success && headline.data) out.headline = headline.data;\n const about = optionalTrimmedString(ABOUT_MAX).safeParse(raw.about);\n if (about.success && about.data) out.about = about.data;\n const skills = draftList(SKILL_VALUES, SKILLS_MAX).safeParse(raw.skills ?? []);\n if (skills.success && skills.data.length > 0) out.skills = skills.data;\n return out;\n}\n\n// ─── The resume cursor ───────────────────────────────────────────────────────\n\n/**\n * The keys a draft may hold: exactly the in-progress form's fields.\n *\n * ⚠ The server writes each key as a dot path (`draft.<key>`). Unchecked, a key\n * holding a dot writes somewhere nested the form never asked for, and the\n * collection fills with whatever a client invents. Until 0.2.0 the backend\n * kept its own copy of this list and DROPPED unknown keys without a word; now a\n * draft carrying one is refused, with the key in the issue's path.\n */\nexport const onboardingDraftKeySchema = onboardingFormSchema.keyof();\nexport const ONBOARDING_DRAFT_KEYS = onboardingDraftKeySchema.options;\nexport type OnboardingDraftKey = z.infer<typeof onboardingDraftKeySchema>;\n\n/**\n * Where the member got to, kept in its own collection, separate from the\n * profile.\n *\n * `step` is a flat index into `FOUNDER_ONBOARDING_STEPS`, not a `(step, sub)`\n * pair: one number is what lets a member start on the web and resume elsewhere,\n * provided both ends agree on the encoding.\n *\n * What is READ BACK: the draft's KEYS come from the form, its VALUES are\n * opaque, since a stored draft may predate 0.18.0 (any JSON was stored then);\n * read it through `readOnboardingDraft`, never by casting. What is WRITTEN is\n * the form's own shape (`onboardingProgressUpdateSchema.draft`, 0.18.0), and\n * everything is re-validated strictly at finalize.\n *\n * `partialRecord`, not `record`: in Zod 4 an enum-keyed `z.record` demands\n * every key, and a draft holds whichever steps the member has reached.\n */\nexport const onboardingDraftSchema = z.partialRecord(onboardingDraftKeySchema, z.unknown());\nexport type OnboardingDraft = z.infer<typeof onboardingDraftSchema>;\n\n/**\n * `PATCH` body: any subset of the cursor, merged server-side. No defaults.\n * `step` may equal `ONBOARDING_TOTAL_STEPS`: \"past the last step\", which the\n * client sends on its way to finish.\n *\n * The photo step's `avatarMediaId` is not kept in the draft (0.17.0): it is\n * handed to the server, which holds that upload for the member.\n */\nexport const onboardingProgressUpdateSchema = z.object({\n /**\n * Up to the OLD list's end (nine steps, 2026-11-22), brought within today's:\n * a client loaded before the step went still sends \"past the last step\" as 9\n * on its way to finish, and is not refused for it.\n */\n step: z\n .number()\n .int()\n .min(0)\n .max(LEGACY_ONBOARDING_TOTAL_STEPS)\n .transform((step) => Math.min(step, ONBOARDING_TOTAL_STEPS))\n .optional(),\n /**\n * The answers of the step being saved, IN THE FORM'S OWN SHAPE (0.18.0):\n * half-answered is fine (that is the form: text as typed, `null` for \"not\n * yet\"), but every value has its type and its bound, and no other key is\n * taken. Before 0.18.0 any JSON up to the body limit was stored as sent,\n * for 90 days, and sent back. The photo's id reads as `objectIdSchema` reads\n * every id (lower case), since the server compares it with the upload it\n * holds.\n */\n draft: onboardingFormSchema\n .partial()\n .extend(LEGACY_DRAFT_KEYS)\n .strict()\n .transform(withoutBusinessType)\n .optional(),\n});\nexport type OnboardingProgressUpdate = z.infer<typeof onboardingProgressUpdateSchema>;\n\n/**\n * What the client reads on return, from `GET` and from every `PATCH`.\n *\n * ⚠️ `onboarded` is the gate and it comes from the profile, not from the\n * cursor: a finished member on a new device must be recognised even when the\n * cursor row is gone, and a cursor that failed to load must never make an\n * unfinished member look finished.\n */\nexport const onboardingStatusSchema = z.object({\n onboarded: z.boolean(),\n step: z.number().int().min(0).max(ONBOARDING_TOTAL_STEPS),\n draft: onboardingDraftSchema.optional(),\n /**\n * The photo the member saved on the photo step, as it will appear (0.17.0):\n * the upload the server holds for this member's draft. Absent when they\n * saved none, removed it, or have finished. A client resumes the photo step\n * from this (its `id` is the finish body's `avatarMediaId`), never from the\n * draft.\n */\n photo: mediaImageSchema.optional(),\n});\nexport type OnboardingStatus = z.infer<typeof onboardingStatusSchema>;\n"]}
|
|
1
|
+
{"version":3,"file":"onboarding.js","sourceRoot":"","sources":["../../../src/domains/onboarding/onboarding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,QAAQ,EACR,cAAc,EACd,aAAa,EACb,WAAW,EAEX,YAAY,EACZ,UAAU,EACV,eAAe,EACf,cAAc,EACd,cAAc,EACd,qBAAqB,EACrB,WAAW,EACX,sBAAsB,EACtB,YAAY,EACZ,oBAAoB,EACpB,WAAW,EACX,kBAAkB,EAClB,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,SAAS,EACT,MAAM,EACN,gBAAgB,EAChB,YAAY,EACZ,mBAAmB,EACnB,YAAY,EACZ,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,+BAA+B,CAAC;AAEvC,gFAAgF;AAEhF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAC;AAChC,qEAAqE;AACrE,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,CAAC;AAEjC;;;;;;;;;GASG;AACH,MAAM,UAAU,UAAU,CAAC,OAAe,EAAE,MAAY,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K,EAAE,qBAAqB,CAAC,QAAQ,EAAE;IACvC;;;;;;OAMG;IACH,KAAK,EAAE,gBAAgB,CAAC,QAAQ,EAAE;IAClC;;;;;;;;;;;;;;;OAeG;IACH,eAAe,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;CAC5C,CAAC,CAAC","sourcesContent":["/**\n * founder-schema — Onboarding: steps, enums, and the two shapes of the answers\n *\n * ONE LIST DEFINES THE FLOW, AND IT IS DERIVED. Each step's fields are a pick\n * of the finish body (`ONBOARDING_STEP_SCHEMAS`), and `FOUNDER_ONBOARDING_STEPS`\n * is built FROM those picks: its `fields`, and even whether a step may be\n * skipped, come from the schema rather than from a second hand-written list.\n * GymMonk arrived at one list after keeping two in sync by hand, where a step\n * could exist with no title or, worse, no validation gate at all; until 0.2.0\n * this file still wrote the field lists twice.\n *\n * TWO SHAPES, ONE SET OF RULES. A half-filled form legitimately holds `null`\n * for a choice nobody has made yet; the finalize body only ever sees completed\n * answers. So the rules are written once and expressed over both shapes:\n * `onboardingFormSchema` for work in progress and `completeOnboardingBodySchema`\n * for the end. Letting those two drift is how a wizard says a step is optional\n * and then answers 422 at Finish.\n *\n * NO COPY IN HERE. A step's label and title are translation KEYS\n * (`labelKey`, `titleKey`), Jansathi's rule for every config string: an English\n * sentence in a shared package is a sentence every other language has to match\n * by wording. A topic category is named by its `key`, which the client words\n * (0.6.0 dropped its `labelKey`: the web, English-only since 2026-10-06, read\n * nothing from it).\n *\n * @module founder-schema/domains/onboarding\n */\n\nimport { z } from 'zod';\nimport {\n eachOnce,\n fullNameSchema,\n GENDER_VALUES,\n GOAL_VALUES,\n type Goal,\n genderSchema,\n goalSchema,\n INDUSTRY_VALUES,\n industrySchema,\n objectIdSchema,\n optionalTrimmedString,\n phoneSchema,\n requiredGoalListSchema,\n SKILL_VALUES,\n STARTUP_STAGE_VALUES,\n skillSchema,\n startupStageSchema,\n usernameSchema,\n} from '../../core/common.js';\nimport {\n ABOUT_MAX,\n DAY_MS,\n DISPLAY_NAME_MAX,\n HEADLINE_MAX,\n INDIA_UTC_OFFSET_MS,\n LINK_URL_MAX,\n SKILLS_MAX,\n TEAM_SIZE_MAX,\n VENTURE_NAME_MAX,\n VENTURE_TAGLINE_MAX,\n} from '../../core/limits.js';\nimport { VALIDATION_MESSAGE } from '../../core/validation.js';\nimport { locationPickSchema, placeSchema } from '../location/areas.js';\nimport { mediaImageSchema } from '../media/media.js';\nimport {\n founderLinksSchema,\n VENTURE_ROLE_VALUES,\n ventureRoleSchema,\n ventureWriteSchema,\n} from '../profile/founder-profile.js';\n\n// ─── Age ─────────────────────────────────────────────────────────────────────\n\n/**\n * 18, ruled by the user 2026-09-21. Under-18 would pull in parental-consent\n * duties under the DPDP Act, which is a different and larger problem than a\n * validation rule.\n *\n * ⚠️ The SERVER refuses at finalize. This schema exists so the member sees a\n * useful message; it is not the gate.\n */\nexport const MIN_AGE_YEARS = 18;\n/** A sanity ceiling, not a product rule. Catches a mistyped year. */\nexport const MAX_AGE_YEARS = 120;\n\n/**\n * Whole years completed, by the calendar.\n *\n * ⚠️ NOT `elapsedMs / (365.25 * day)`, which is what the sibling product uses.\n * That approximation reads 17.9986 at the start of somebody's eighteenth\n * birthday and only crosses 18 about halfway through the day, so it refuses\n * them for the half of their birthday they are most likely to be signing up on.\n * Measured: it disagrees with the calendar on all 400 of the next 400 days.\n * An age gate is exactly the place an approximation is not good enough.\n */\nexport function ageInYears(isoDate: string, now: Date = new Date()): number {\n // ⚠️ A STRING, `YYYY-MM-DD`, not a `Date`. This is a wire contract, so it\n // takes the wire type. The backend is the obvious caller and the backend\n // holds a `Date`, so it must format first; passing the Date straight in used\n // to fail with `isoDate.split is not a function`, which says nothing useful.\n // Naming the fix costs one line and saves the next person the detour.\n if (typeof isoDate !== 'string') {\n throw new TypeError(\n 'ageInYears expects a YYYY-MM-DD string, not a Date. Format it first, e.g. date.toISOString().slice(0, 10).',\n );\n }\n const [y, m, d] = isoDate.split('-').map(Number) as [number, number, number];\n // The date TODAY IS IN INDIA (0.13.0), where the members are: a birthday\n // begins at midnight there, not five and a half hours later at UTC's\n // midnight. India keeps one offset all year.\n const today = new Date(now.getTime() + INDIA_UTC_OFFSET_MS);\n let age = today.getUTCFullYear() - y;\n const monthNow = today.getUTCMonth() + 1;\n if (monthNow < m || (monthNow === m && today.getUTCDate() < d)) age -= 1;\n return age;\n}\n\n/** A calendar date with no time component, `YYYY-MM-DD`. */\nexport const isoDateSchema = z\n .string()\n .trim()\n .regex(/^\\d{4}-\\d{2}-\\d{2}$/, VALIDATION_MESSAGE.dateInvalid);\nexport type IsoDate = z.infer<typeof isoDateSchema>;\n\n/** True only for a date that exists. Rejects 2026-02-30 and 2026-13-01. */\nfunction isRealDate(iso: string): boolean {\n const [y, m, d] = iso.split('-').map(Number) as [number, number, number];\n if (m < 1 || m > 12 || d < 1) return false;\n const asDate = new Date(Date.UTC(y, m - 1, d));\n return (\n asDate.getUTCFullYear() === y && asDate.getUTCMonth() === m - 1 && asDate.getUTCDate() === d\n );\n}\n\n/**\n * True for a `YYYY-MM-DD` that is a real calendar date (0.17.0, exported so a\n * client's date picker checks a date exactly as `dateOfBirthSchema` does):\n * not 2026-02-30, not 2026-13-01.\n */\nexport function isRealIsoDate(value: string): boolean {\n return isoDateSchema.safeParse(value).success && isRealDate(value.trim());\n}\n\n/** `YYYY-MM-DD` for a moment, counted in India's calendar. */\nconst isoInIndia = (moment: number): IsoDate =>\n new Date(moment + INDIA_UTC_OFFSET_MS).toISOString().slice(0, 10);\n\n/**\n * Today in India, `YYYY-MM-DD` (0.17.0): the day every age here is counted\n * from (`ageInYears`), so a client's \"today\" must be this one, never the\n * device's own: east of India the device is already on tomorrow.\n */\nexport function todayInIndia(now: Date = new Date()): IsoDate {\n return isoInIndia(now.getTime());\n}\n\nconst isoOfUtc = (ms: number): IsoDate => new Date(ms).toISOString().slice(0, 10);\n\n/**\n * The dates of birth `dateOfBirthSchema` accepts TODAY, both ends included\n * (0.17.0): `latest` makes someone exactly `MIN_AGE_YEARS` today, `earliest`\n * exactly `MAX_AGE_YEARS`. Worked out with `ageInYears` itself, so a picker\n * that offers only this window can never offer a date the schema refuses, a\n * 29 February included.\n */\nexport function dateOfBirthBounds(now: Date = new Date()): { earliest: IsoDate; latest: IsoDate } {\n const [y, m, d] = todayInIndia(now).split('-').map(Number) as [number, number, number];\n let latest = Date.UTC(y - MIN_AGE_YEARS, m - 1, d);\n while (ageInYears(isoOfUtc(latest), now) < MIN_AGE_YEARS) latest -= DAY_MS;\n let earliest = Date.UTC(y - MAX_AGE_YEARS - 1, m - 1, d);\n while (ageInYears(isoOfUtc(earliest), now) > MAX_AGE_YEARS) earliest += DAY_MS;\n return { earliest: isoOfUtc(earliest), latest: isoOfUtc(latest) };\n}\n\n/**\n * True only for a COMPLETE, real date of birth that is under `MIN_AGE_YEARS`\n * today (0.17.0): the rule the server applies to a draft, where a date still\n * being typed must pass (\"19\" says nothing about anyone's age yet). Until\n * 0.17.0 the backend wrote this out by hand and skipped the real-date check.\n */\nexport function isUnderAgeDateOfBirth(value: unknown, now: Date = new Date()): boolean {\n if (typeof value !== 'string' || !isRealIsoDate(value)) return false;\n return ageInYears(value.trim(), now) < MIN_AGE_YEARS;\n}\n\n/** A `YYYY-MM-DD` as the instant it is stored as: midnight UTC that day (0.17.0). */\nexport const isoDateToDate = (iso: IsoDate): Date => new Date(`${iso.trim()}T00:00:00.000Z`);\n\n/** A stored date (midnight UTC) as `YYYY-MM-DD` (0.17.0): `isoDateToDate`'s inverse. */\nexport const dateToIsoDate = (date: Date): IsoDate => date.toISOString().slice(0, 10);\n\n/**\n * Date of birth, with the age gate applied per parse.\n *\n * ⚠️ THE CLIENT IS NOT THE GATE. This schema exists so the member sees a useful\n * message, and the server must refuse the same dates at finalize regardless.\n * The sibling dating product validates the identical rule on its client and\n * still shipped a defect where an under-age date of birth produced a live,\n * discoverable profile, because the client was the only thing checking.\n */\nexport const dateOfBirthSchema = isoDateSchema\n .refine(isRealDate, { error: VALIDATION_MESSAGE.dobInvalid })\n .refine((v) => ageInYears(v) >= MIN_AGE_YEARS, { error: VALIDATION_MESSAGE.dobUnderAge })\n .refine((v) => ageInYears(v) <= MAX_AGE_YEARS, { error: VALIDATION_MESSAGE.dobTooOld });\nexport type DateOfBirth = z.infer<typeof dateOfBirthSchema>;\n\n// ─── Business ────────────────────────────────────────────────────────────────\n\n/**\n * How the business is registered in India, or that it is not yet (0.16.0, the\n * user, 2026-10-18: \"the categories that we have in India like private\n * limited, LLP or OPC or proprietorship\").\n *\n * The forms Indian law provides: a sole proprietorship and a partnership firm\n * (Indian Partnership Act, 1932), a limited liability partnership (LLP Act,\n * 2008), a one person, private limited, public limited or Section 8 (not for\n * profit) company (Companies Act, 2013), a trust or society, and a\n * co-operative society. Two more are answers a founder often has: not\n * registered yet (an idea, or a side project), and registered outside India\n * (an Indian team whose company is incorporated abroad, often in the US).\n *\n * Optional, and private to the member: nothing here verifies it (documents\n * are a settings matter, by the user's ruling).\n *\n * ⚠ Stored on the profile's venture and a Mongoose enum. Append only.\n */\nexport const LEGAL_STRUCTURE_VALUES = [\n 'not_registered',\n 'sole_proprietorship',\n 'partnership',\n 'llp',\n 'opc',\n 'private_limited',\n 'public_limited',\n 'section_8',\n 'trust_or_society',\n 'cooperative',\n 'registered_abroad',\n] as const;\nexport const legalStructureSchema = z.enum(LEGAL_STRUCTURE_VALUES);\nexport type LegalStructure = z.infer<typeof legalStructureSchema>;\n\n// ─── Topics: the shared vocabulary ───────────────────────────────────────────────────────────────\n\n/**\n * ONE vocabulary, used TWICE: a member picks these as their `interests`, and a\n * post carries them as its `topics`. That is what makes relevance an index\n * lookup rather than a guess, and it is why this list is not called \"interests\"\n * - naming it for one of its two jobs would have invited a second list for the\n * other, which is the mistake this package has already made once with goals.\n * (User's ruling via hary, 2026-09-21.)\n *\n * Deliberately DISTINCT from two neighbours that will otherwise collect the\n * same words:\n *\n * industry what your company does\n * skills what you can do\n * interests what you want to read about\n *\n * If the copy does not keep them apart, members fill all three identically and\n * every one of them stops telling us anything.\n *\n * A closed list, consistent with industry, skill and stage, for the reason\n * already written beside those: free text means two people typing \"growth\" and\n * \"Growth Marketing\" never match, and matching is the entire point. The cost is\n * that adding an interest needs a publish.\n *\n * Tuned down from the dating product's 246, which is mostly dating material.\n * Values reuse its exact strings wherever one existed, so its Hindi\n * translations can be lifted across.\n *\n * ⚠️ Stored per member. Append only; removing a value orphans data.\n */\nexport const TOPIC_VALUES = [\n // Career growth\n 'mentoring',\n 'leadership',\n 'networking',\n 'public_speaking',\n 'teaching',\n 'hiring_talent',\n 'personal_branding',\n 'career_transition',\n 'remote_work',\n // Innovation and tech\n 'ai_ml',\n 'blockchain',\n 'crypto_web3',\n 'robotics',\n 'data_science',\n 'cybersecurity',\n 'game_dev',\n 'ux_design',\n 'app_development',\n 'open_source',\n 'electronics',\n 'space_exploration',\n 'green_tech',\n 'deeptech',\n 'no_code',\n // Business\n 'entrepreneurship',\n 'investing',\n 'stock_trading',\n 'personal_finance',\n 'fundraising',\n 'marketing',\n 'sales',\n 'consulting',\n 'ecommerce',\n 'retail',\n 'real_estate',\n 'supply_chain',\n 'product_management',\n 'growth',\n 'b2b_saas',\n 'd2c',\n // Personal development\n 'meditation',\n 'journaling',\n 'self_improvement',\n 'productivity',\n 'reading',\n 'online_courses',\n 'philosophy',\n 'psychology',\n 'therapy',\n 'sleep_optimization',\n 'gym',\n 'yoga',\n // Creative\n 'photography',\n 'writing',\n 'graphic_design',\n 'filmmaking',\n 'digital_art',\n 'content_creation',\n 'blogging',\n 'vlogging',\n 'podcasts',\n 'animation',\n 'music_production',\n // Impact and community\n 'volunteering',\n 'ngo_work',\n 'environmental',\n 'women_empowerment',\n 'community_service',\n 'social_enterprise',\n 'education_access',\n] as const;\nexport const topicSchema = z.enum(TOPIC_VALUES);\nexport type Topic = z.infer<typeof topicSchema>;\n\n/**\n * The grouping the picker renders.\n *\n * ⚠️ `TOPIC_VALUES` above is the single source of truth and this is typed\n * against it, so a typo here is a compile error rather than a chip that renders\n * and can never be selected. The dating product keeps a categorised list and a\n * flat list side by side and they have already drifted apart by two values;\n * a test in this package asserts these two agree exactly, in both directions.\n */\nexport const TOPIC_CATEGORY_KEYS = [\n 'career',\n 'tech',\n 'business',\n 'growth',\n 'creative',\n 'impact',\n] as const;\nexport type TopicCategoryKey = (typeof TOPIC_CATEGORY_KEYS)[number];\n\n/**\n * One group of the picker: its `key` (the client words it) and its topics.\n * Breaking in 0.6.0: no `labelKey`.\n */\nexport interface TopicCategory {\n key: TopicCategoryKey;\n values: readonly Topic[];\n}\n\nconst topicCategory = (key: TopicCategoryKey, values: readonly Topic[]): TopicCategory => ({\n key,\n values,\n});\n\nexport const TOPIC_CATEGORIES: readonly TopicCategory[] = [\n topicCategory('career', [\n 'mentoring',\n 'leadership',\n 'networking',\n 'public_speaking',\n 'teaching',\n 'hiring_talent',\n 'personal_branding',\n 'career_transition',\n 'remote_work',\n ]),\n topicCategory('tech', [\n 'ai_ml',\n 'blockchain',\n 'crypto_web3',\n 'robotics',\n 'data_science',\n 'cybersecurity',\n 'game_dev',\n 'ux_design',\n 'app_development',\n 'open_source',\n 'electronics',\n 'space_exploration',\n 'green_tech',\n 'deeptech',\n 'no_code',\n ]),\n topicCategory('business', [\n 'entrepreneurship',\n 'investing',\n 'stock_trading',\n 'personal_finance',\n 'fundraising',\n 'marketing',\n 'sales',\n 'consulting',\n 'ecommerce',\n 'retail',\n 'real_estate',\n 'supply_chain',\n 'product_management',\n 'growth',\n 'b2b_saas',\n 'd2c',\n ]),\n topicCategory('growth', [\n 'meditation',\n 'journaling',\n 'self_improvement',\n 'productivity',\n 'reading',\n 'online_courses',\n 'philosophy',\n 'psychology',\n 'therapy',\n 'sleep_optimization',\n 'gym',\n 'yoga',\n ]),\n topicCategory('creative', [\n 'photography',\n 'writing',\n 'graphic_design',\n 'filmmaking',\n 'digital_art',\n 'content_creation',\n 'blogging',\n 'vlogging',\n 'podcasts',\n 'animation',\n 'music_production',\n ]),\n topicCategory('impact', [\n 'volunteering',\n 'ngo_work',\n 'environmental',\n 'women_empowerment',\n 'community_service',\n 'social_enterprise',\n 'education_access',\n ]),\n];\n\n// ─── Goals: the grouping the picker renders ──────────────────────────────────\n\n/**\n * The goals step's three headings (0.17.0, moved here from the web, where the\n * grouping lived in the screen): eighteen goals since 0.16.0, shown a group at\n * a time so the eye takes six tiles, not a wall of eighteen. A group is named\n * by its `key`, which the client words, like a topic category.\n *\n * ⚠ `GOAL_VALUES` stays the single source of truth for what a goal IS; this is\n * typed against it, and a test holds the two together in both directions:\n * every goal in exactly one group, nothing in a group that is not a goal.\n */\nexport const GOAL_CATEGORY_KEYS = ['build', 'grow', 'learn'] as const;\nexport type GoalCategoryKey = (typeof GOAL_CATEGORY_KEYS)[number];\n\n/** One group of the goals picker: its `key` (the client words it) and its goals, in order. */\nexport interface GoalCategory {\n key: GoalCategoryKey;\n values: readonly Goal[];\n}\n\nexport const GOAL_CATEGORIES: readonly GoalCategory[] = [\n {\n key: 'build',\n values: [\n 'start_company',\n 'get_feedback',\n 'find_cofounder',\n 'find_testers',\n 'hiring',\n 'find_service_providers',\n ],\n },\n {\n key: 'grow',\n values: [\n 'find_customers',\n 'find_investors',\n 'partnerships',\n 'market_insights',\n 'business_ideas',\n 'grow_network',\n ],\n },\n {\n key: 'learn',\n values: [\n 'learn_startup',\n 'mentorship',\n 'attend_events',\n 'join_startup',\n 'mentor_others',\n 'invest_in_startups',\n ],\n },\n];\n\n/**\n * How many a member must pick. A minimum exists because these drive feed\n * relevance and zero of them means no relevance at all.\n *\n * ⚠️ If 3 turns out to be hard to reach against this list, that is a signal\n * about the LIST, not about the minimum. The sibling product enforces no\n * minimum at all, and its own field config says \"pick up to 10\" while every\n * screen and schema enforces 20.\n */\nexport const INTERESTS_MIN = 3;\nexport const INTERESTS_MAX = 10;\n\n/**\n * A member's interests, by ONE rule (0.16.0): onboarding's finish and the Me\n * tab's editor (`putMyInterestsBodySchema`) both apply this very schema, so a\n * list one accepts the other can never refuse.\n *\n * Each topic only once: without that, three copies of one topic met the\n * minimum of three while meaning one interest.\n */\nexport const interestsSchema = z\n .array(topicSchema)\n .min(INTERESTS_MIN)\n .max(INTERESTS_MAX)\n .refine(eachOnce, {\n error: VALIDATION_MESSAGE.topicsDuplicate,\n });\n\n// ─── The step keys ───────────────────────────────────────────────────────────\n\n/**\n * The step keys, in order, as a literal union, so a consumer can key a table by\n * step and have TypeScript insist on every one. Before 0.2.0 `key` was a plain\n * string and the web client kept its own copy of this list to get the same\n * check; a test there held the two together. Now there is one list.\n *\n * 0.16.0 (the user, 2026-10-18) split the old first step, `identity`, into\n * three: `basics` (full name, gender, date of birth, nothing else), `photo`\n * (the photo alone) and `professional` (title, about, skills). Nine steps, up\n * from seven.\n *\n * 2026-11-22 (the user: \"lets remove this step from onboring\"): `professional`\n * went. Eight steps. The title, about and skills stay on the profile, edited\n * in Me; a member who typed them into a draft before keeps them (the server\n * carries them at finish, `legacyProfessionalAnswers`).\n *\n * 2026-12-06 (the user): a new order, and a PAID step. Basics, then \"what\n * brings you here\" (goals), then the MEMBERSHIP (bought here, mandatory: no\n * \"Not now\"), then the business, interests, location, photo and the\n * guidelines. Eight steps. The membership step asks nothing (no fields): what\n * passes it is the server's `needsMembership` (`onboardingStatusSchema`),\n * never an answer. The CONTACT step went the same day (the user: \"remove the\n * contact details step, put the phone number in the 1st step because we need\n * it in case the user doesn't complete the payment\"): the phone is a basics\n * answer, asked and saved first; the links are no step's (Me edits them, and\n * the finish still takes what an older tab typed).\n *\n * ⚠ THE SERVER'S RESUME CURSOR IS AN INDEX INTO THIS LIST, so re-ordering it\n * moves every member who stopped part-way. A cursor saved under an older list\n * is translated by the backend, by step NAME (its progress rows carry the\n * list's version, `ONBOARDING_STEPS_VERSION`); any further change bumps that\n * version and needs the same.\n */\nexport const ONBOARDING_STEP_KEYS = [\n 'basics',\n 'goals',\n 'membership',\n 'business',\n 'interests',\n 'location',\n 'photo',\n 'guidelines',\n] as const;\nexport type OnboardingStepKey = (typeof ONBOARDING_STEP_KEYS)[number];\n\n/**\n * Which version of the step list `ONBOARDING_STEP_KEYS` is (0.37.0; until\n * then the backend held this number alone). A step NUMBER means something only\n * against the list it was counted in, so the progress rows carry it, and the\n * `PATCH` body says which list its `step` counts in (`stepsVersion`).\n *\n * 1 up to 0.15.0: seven steps, the first `identity`\n * 2 0.16.0: nine, `identity` split into basics, photo, professional\n * 3 2026-11-22: eight, `professional` gone\n * 4 2026-12-06: eight, a new order with the paid `membership` third and\n * `contact` gone (the phone joined the basics)\n *\n * ⚠ ANY change to `ONBOARDING_STEP_KEYS` bumps this, and the backend keeps the\n * list it replaces (by name), so a member half-way through resumes on the\n * same step and an older client's numbers are read in its own list.\n */\nexport const ONBOARDING_STEPS_VERSION = 4;\n\n/**\n * What a step is (0.37.0): `answers`, the member answers its fields; or\n * `membership`, the paid step, which asks nothing and is passed when the\n * server says the member holds a membership (`needsMembership` false). A\n * client shows the membership step only while `needsMembership` is true.\n */\nexport const ONBOARDING_STEP_KINDS = ['answers', 'membership'] as const;\nexport type OnboardingStepKind = (typeof ONBOARDING_STEP_KINDS)[number];\n\n/** The paid step's place in `ONBOARDING_STEP_KEYS` (0.37.0): a cursor past it needs the membership. */\nexport const ONBOARDING_MEMBERSHIP_STEP = ONBOARDING_STEP_KEYS.indexOf('membership');\n\n// ─── Guidelines ──────────────────────────────────────────────────────────────\n\n/**\n * The community guidelines a member agrees to at the last step, by version.\n *\n * The finish body accepts THIS version and no other: an old tab still showing\n * last month's text cannot record agreement to text it never displayed, and\n * `'whatever'` is not a version. Until 0.2.0 any non-empty string passed, and\n * the web client held this constant on its own.\n *\n * ⚠ Changing the guidelines text means bumping this, in the same publish.\n * Every member who agreed to an earlier version keeps that version on their\n * profile; that record is the point.\n */\nexport const GUIDELINES_VERSION = '2026-10-03' as const;\n/**\n * Not agreed at all (the box left unticked) is `guidelinesRequired`; agreed to\n * another text is `guidelinesOutdated` (0.17.0: both were the second, so a\n * client had to word an unticked box itself).\n */\nexport const guidelinesVersionSchema = z.literal(GUIDELINES_VERSION, {\n error: (issue) =>\n issue.input === undefined || issue.input === null\n ? VALIDATION_MESSAGE.guidelinesRequired\n : VALIDATION_MESSAGE.guidelinesOutdated,\n});\n\n// ─── Contact ─────────────────────────────────────────────────────────────────\n\n/**\n * The links sign-up takes, picked from the profile's own links so the two\n * cannot disagree on what a link is. No step asks them since 2026-12-06 (the\n * contact step went); a tab loaded before still sends them. The phone is\n * `phoneSchema`: ten digits, stored raw with no country code, on the account\n * rather than here, and a basics answer since 2026-12-06.\n */\nexport const contactLinksSchema = founderLinksSchema.pick({\n linkedin: true,\n x: true,\n instagram: true,\n});\nexport type ContactLinks = z.infer<typeof contactLinksSchema>;\n\n/** A team size has at most this many digits: `TEAM_SIZE_MAX` written out. */\nexport const TEAM_SIZE_DIGITS_MAX = String(TEAM_SIZE_MAX).length;\n\n/**\n * A team size as typed, kept to what the field may hold: digits only, at most\n * `TEAM_SIZE_DIGITS_MAX` (0.17.0: the draft reader and every client's field\n * clean it with this one rule).\n */\nexport const teamSizeDigits = (raw: string): string =>\n raw.replace(/\\D/g, '').slice(0, TEAM_SIZE_DIGITS_MAX);\n\n// ─── The form, mid-flight: the draft each step saves ──────────────────────────\n\n/**\n * The answers so far, keyed by the finish body's own field names: what each\n * step SAVES (`PATCH /onboarding`, merged per field), what `GET` hands back\n * to resume, and so the only keys a draft may hold\n * (`ONBOARDING_DRAFT_KEYS`).\n *\n * RAW, on purpose: a draft is what the member TYPED, not what Finish will send.\n * A half-typed link is ordinary text, a team size is digits as typed, and every\n * choice is `null` until made (\"not answered\" is not \"answered with nothing\").\n * Nothing here is required; whether a member may FINISH is\n * `completeOnboardingBodySchema`'s decision, and the client builds that body\n * from these answers.\n *\n * Screens may hold a different shape on top of this one. Derive that type from\n * `OnboardingForm` rather than writing it out, so a field added here reaches\n * every screen. (Since 0.16.0 the name is asked as one full name; since 0.20.0\n * its key is `fullName`, and the server splits it into the first and last name\n * it stores, the display name being those two joined.)\n *\n * A stored draft is UNTRUSTED when it comes back: an older client, or another\n * one, wrote it, and the server stores values opaquely. Read it with\n * `readOnboardingDraft`, never by casting.\n */\n/** Longest date of birth an answer may be: `YYYY-MM-DD` (0.18.0: exported; the form and the draft reader use it). */\nexport const DATE_INPUT_MAX = 10;\n/** Longest phone number an answer may be, as typed with spaces and a `+91`. */\nexport const PHONE_INPUT_MAX = 20;\n/** Longest guidelines version an answer may carry (`GUIDELINES_VERSION` is a date). */\nexport const GUIDELINES_VERSION_MAX = 32;\n\nexport const onboardingFormSchema = z.object({\n fullName: z.string().max(DISPLAY_NAME_MAX),\n gender: genderSchema.nullable(),\n /** `YYYY-MM-DD` once complete; whatever has been typed until then. */\n dateOfBirth: z.string().max(DATE_INPUT_MAX),\n /**\n * The completed upload's id (`media`, purpose `avatar`), or `null` for no\n * photo.\n *\n * SAVED BY THE PHOTO STEP, KEPT BY THE SERVER, NOT IN THE DRAFT (0.17.0). A\n * step save carrying this key hands the upload to the server, which holds it\n * for the draft (so the unattached sweep, `MEDIA_UNATTACHED_TTL_HOURS`, never\n * deletes it) and lets go of the one it replaces; `null` lets go of it. It\n * comes back as the status's `photo`, read from what the server holds, never\n * from a stored draft: `readOnboardingDraft` still gives `null` here, so an\n * id an older client left in a draft is never trusted.\n */\n avatarMediaId: objectIdSchema.nullable(),\n\n /** As typed; the finish body takes `phoneSchema`'s ten digits. */\n phone: z.string().max(PHONE_INPUT_MAX),\n /** As typed; the finish body takes full `https://` URLs. */\n links: z.object({\n linkedin: z.string().max(LINK_URL_MAX),\n x: z.string().max(LINK_URL_MAX),\n instagram: z.string().max(LINK_URL_MAX),\n }),\n\n /**\n * `null` until the member picks a place (the drawer, or GPS then confirmed),\n * and when they leave the step without one (0.19.0: a place from\n * `master_db`, with its names, so the step shows it again after a reload).\n */\n location: placeSchema.nullable(),\n\n goals: z.array(goalSchema).max(GOAL_VALUES.length),\n interests: z.array(topicSchema).max(INTERESTS_MAX),\n\n /**\n * Always present; empty until started. The startup step (2026-11-22) asks\n * its description (the venture's `tagline`) and the member's roles too.\n * Those two DEFAULT when absent, so a draft from a client older than them\n * still saves.\n */\n venture: z.object({\n name: z.string().max(VENTURE_NAME_MAX),\n tagline: z.string().max(VENTURE_TAGLINE_MAX).default(''),\n roles: z.array(ventureRoleSchema).max(VENTURE_ROLE_VALUES.length).default([]),\n website: z.string().max(LINK_URL_MAX),\n industry: industrySchema.nullable(),\n stage: startupStageSchema.nullable(),\n /** Digits as typed, at most `TEAM_SIZE_DIGITS_MAX`; the body sends a number. */\n teamSize: z.string().max(TEAM_SIZE_DIGITS_MAX),\n }),\n legalStructure: legalStructureSchema.nullable(),\n\n /** The guidelines text the member agreed to, or `null`. */\n guidelinesVersion: z.string().max(GUIDELINES_VERSION_MAX).nullable(),\n});\nexport type OnboardingForm = z.infer<typeof onboardingFormSchema>;\n\n// ─── Reading a stored draft back ─────────────────────────────────────────────\n\n/** Text, cut to its limit; anything that is not text is \"not answered\". */\nconst draftText = (max: number) =>\n z\n .string()\n .catch('')\n .transform((v) => v.slice(0, max));\n\n/** One of a vocabulary, or `null` (\"not answered\"). */\nconst draftChoice = <T extends readonly [string, ...string[]]>(values: T) =>\n z.enum(values).nullable().catch(null);\n\n/**\n * Items of a vocabulary, deduplicated and capped. Unknown items (a value since\n * retired, or junk) are dropped one by one, so the rest of the answer survives.\n */\nconst draftList = <T extends readonly [string, ...string[]]>(values: T, max: number) =>\n z\n .array(z.unknown())\n .catch([])\n .transform((items) => {\n const allowed = new Set<string>(values);\n const kept = items.filter((v): v is T[number] => typeof v === 'string' && allowed.has(v));\n return [...new Set(kept)].slice(0, max);\n });\n\n/** An object of the given fields, or `null` when the draft holds none. */\nconst draftObject = <S extends z.ZodRawShape>(shape: S) =>\n z\n .record(z.string(), z.unknown())\n .nullable()\n .catch(null)\n .pipe(z.union([z.null(), z.object(shape)]));\n\nconst draftReaderSchema = z.object({\n fullName: draftText(DISPLAY_NAME_MAX),\n gender: draftChoice(GENDER_VALUES),\n dateOfBirth: draftText(DATE_INPUT_MAX),\n avatarMediaId: z\n .unknown()\n .optional()\n .transform(() => null),\n phone: draftText(PHONE_INPUT_MAX),\n links: draftObject({\n linkedin: draftText(LINK_URL_MAX),\n x: draftText(LINK_URL_MAX),\n instagram: draftText(LINK_URL_MAX),\n }).transform((links) => links ?? { linkedin: '', x: '', instagram: '' }),\n // A place, whole or not at all: a draft saved before 0.19.0 held a typed\n // city and state, which name no area, so it reads as \"not answered yet\".\n location: placeSchema.nullable().catch(null),\n goals: draftList(GOAL_VALUES, GOAL_VALUES.length),\n interests: draftList(TOPIC_VALUES, INTERESTS_MAX),\n venture: draftObject({\n name: draftText(VENTURE_NAME_MAX),\n // A draft saved before the startup step asked these holds neither.\n tagline: z.unknown().optional().pipe(draftText(VENTURE_TAGLINE_MAX)),\n roles: z.unknown().optional().pipe(draftList(VENTURE_ROLE_VALUES, VENTURE_ROLE_VALUES.length)),\n website: draftText(LINK_URL_MAX),\n industry: draftChoice(INDUSTRY_VALUES),\n stage: draftChoice(STARTUP_STAGE_VALUES),\n teamSize: z.string().catch('').transform(teamSizeDigits),\n }).transform((venture) => venture ?? { ...EMPTY_ONBOARDING_VENTURE, roles: [] }),\n legalStructure: draftChoice(LEGAL_STRUCTURE_VALUES),\n /** Agreement to an OLDER text is not agreement to this one. */\n guidelinesVersion: z\n .unknown()\n .optional()\n .transform((v) => (v === GUIDELINES_VERSION ? GUIDELINES_VERSION : null)),\n});\n\n/** The business step before anything is chosen. */\nexport const EMPTY_ONBOARDING_VENTURE: OnboardingForm['venture'] = {\n name: '',\n tagline: '',\n roles: [],\n website: '',\n industry: null,\n stage: null,\n teamSize: '',\n};\n\n/**\n * A stored draft as an `OnboardingForm`, FIELD BY FIELD.\n *\n * Every field is checked against its own vocabulary and cut to its own limit;\n * one that does not fit becomes \"not answered\" (`''`, `null`, `[]`) and the\n * rest of the draft survives. Never coerced into a different answer: a value\n * outside a vocabulary is dropped, not mapped to the nearest one. A photo\n * is never restored from here (it comes back as the status's `photo`; see\n * `avatarMediaId`), and agreement only counts for the CURRENT guidelines.\n *\n * It fills in no answer the member did not give: a blank country stays blank.\n * Whatever a screen shows by default is that screen's choice.\n */\nexport function readOnboardingDraft(draft: unknown): OnboardingForm {\n const raw: Record<string, unknown> =\n draft && typeof draft === 'object' && !Array.isArray(draft)\n ? (draft as Record<string, unknown>)\n : {};\n // 0.20.0 renamed the name answer `displayName` to `fullName`: a draft saved\n // before keeps the name its member typed.\n const source =\n 'fullName' in raw || !('displayName' in raw) ? raw : { ...raw, fullName: raw.displayName };\n return draftReaderSchema.parse(source);\n}\n\n// ─── The finalize body ───────────────────────────────────────────────────────\n\n/**\n * The finish body's fields, before the rules that span fields: what each\n * step's slice is PICKED from (Zod 4 refuses `.pick` on a refined object).\n * Everything outside this file reads `completeOnboardingBodySchema`, whose\n * note below says what the body is.\n */\nconst completeOnboardingBodyFields = z.object({\n // Plain bounds, no custom message: `too_small` with minimum 1 already says\n // \"required\", and the client words it in the member's language. The full\n // name as typed (0.20.0): the server splits it and stores first and last.\n fullName: fullNameSchema,\n /**\n * ⚠️ NO `username` HERE, and its absence is deliberate.\n *\n * It used to be required, and that was a defect: no onboarding step collects\n * one, the design draws no screen for one, and it was not even on the\n * in-progress form, so a finalize could never have succeeded. Found by\n * checking every finalize-required field against the step list; a test now\n * asserts that relationship in both directions.\n *\n * The handle is DERIVED SERVER-SIDE at finalize and edited later from the Me\n * tab, which is what the product describes. That also makes the collision\n * case kinder: a server deriving a handle can suffix it and move on, whereas\n * a member who picked one six steps ago can only be told, at the end, that\n * step one failed.\n */\n gender: genderSchema,\n dateOfBirth: dateOfBirthSchema,\n /**\n * A completed avatar upload (`media`, purpose `avatar`). The server attaches\n * it inside the same transaction that creates the profile, so a refused\n * Finish leaves the upload unattached (and swept), never half-used.\n */\n avatarMediaId: objectIdSchema.optional(),\n\n phone: phoneSchema,\n /**\n * IN NO STEP since 2026-12-06 (the contact step went; Me edits the links).\n * Still taken, optional: a tab loaded before sends what its member typed,\n * and a draft saved then holds it, so the finish keeps it, never drops it.\n */\n links: contactLinksSchema.optional(),\n\n /**\n * Absent when the member left the step without a place. Area ids (0.19.0,\n * `locationPickSchema`): the server names the place from `master_db`.\n */\n location: locationPickSchema.optional(),\n\n /** The shared list rule (each goal once, 0.17.0) plus finish's minimum. */\n goals: requiredGoalListSchema,\n interests: interestsSchema,\n\n /**\n * Absent when the member skipped the business step. The profile's venture\n * without `foundedYear`, which onboarding does not ask; the Me tab does.\n */\n venture: ventureWriteSchema.omit({ foundedYear: true }).optional(),\n /** How the venture is registered, if the member says. Stored on the venture. */\n legalStructure: legalStructureSchema.optional(),\n\n /**\n * The version of the guidelines this member read: `GUIDELINES_VERSION`,\n * exactly.\n *\n * A version and not a boolean, and the server stamps the time. A boolean says\n * somebody agreed; a version and a timestamp say WHAT they agreed to and\n * WHEN, which is the only form worth anything the day the text changes or a\n * moderation decision is disputed.\n */\n guidelinesVersion: guidelinesVersionSchema,\n});\n\n/**\n * How it is registered DESCRIBES a venture, and is stored on it (0.17.0):\n * without one there is nothing to describe. It is refused ON ITS OWN FIELD\n * (`ventureRequired`: add the business, or clear this answer), never dropped\n * without a word, as the server did and as the web did with a lone \"Not\n * registered yet\" (hary's ruling: no silent drop). (The business type went,\n * 2026-11-22.)\n */\ntype VentureAnswers = { venture?: unknown; legalStructure?: unknown };\nconst registrationHasVenture = (body: VentureAnswers): boolean =>\n body.venture !== undefined || body.legalStructure === undefined;\nconst REGISTRATION_NEEDS_VENTURE = {\n error: VALIDATION_MESSAGE.ventureRequired,\n path: ['legalStructure'],\n};\n\n/**\n * What the client sends to finish. Completed answers only.\n *\n * ⚠️ EVERY OPTIONAL FIELD HERE MUST BE ABSENT WHEN UNANSWERED, never a default\n * standing in for one. The sibling gym product sent `bloodGroup ?? 'O+'`, so\n * every member who skipped the question was recorded as O-positive: a real\n * answer, indistinguishable from one somebody gave, sitting on a screen staff\n * would read in an emergency. Absent has to stay absent.\n *\n * ⚠️ AND THIS IS NOT THE GATE EITHER. The server re-checks the age and refuses\n * at finalize. `isOnboarded` may be set here and nowhere else: four of the\n * profile's partial indexes are gated on it, so a half-built profile carrying\n * it true appears in Discover half-built.\n *\n * Location, venture and links are the profile's own shapes, not copies: the\n * copies are how the profile model came to lack Instagram.\n *\n * Refined (the registration needs a venture, above), so Zod 4 throws on\n * `.pick` / `.omit` / `.partial` / `.merge` of it: read a field with\n * `.shape.<field>`, a step's with `ONBOARDING_STEP_SCHEMAS.<step>`.\n *\n * A plain object, not strict: a key from an older client (the business type,\n * or the title, about and skills of the step that went, 2026-11-22) is\n * dropped, never refused.\n */\nexport const completeOnboardingBodySchema = completeOnboardingBodyFields.refine(\n registrationHasVenture,\n REGISTRATION_NEEDS_VENTURE,\n);\nexport type CompleteOnboardingBody = z.infer<typeof completeOnboardingBodySchema>;\n/** What a form may hand to the finish body before parsing. */\nexport type CompleteOnboardingBodyInput = z.input<typeof completeOnboardingBodySchema>;\n\n// ─── The steps ───────────────────────────────────────────────────────────────\n\n/**\n * Each step's slice of the finish body, picked FROM it, so a client validating\n * \"may I leave this step\" and the server validating the finish apply the very\n * same rules. A copy would drift, and the drift shows up as a wizard that lets\n * a step pass and a finish that refuses it, on the last screen.\n *\n * THIS IS THE ONE PLACE A STEP'S FIELDS ARE WRITTEN. `FOUNDER_ONBOARDING_STEPS`\n * below reads them from here. A test asserts that every finish field belongs to\n * exactly one step, but `links` (no step's since 2026-12-06, kept for older tabs).\n *\n * These validate the FINISH shape (skipped = absent), not the in-progress form:\n * a client maps its form state to the slice first. The server does not run them\n * on a draft save, because a half-answered step must be storable.\n */\nexport const ONBOARDING_STEP_SCHEMAS = {\n // 0.16.0: the old `identity` step, split by the user. (The third part,\n // `professional`, went on 2026-11-22.) 2026-12-06: the phone joined it,\n // the user's order, all four required: the phone is asked and SAVED first,\n // so a member who stops at the payment can still be reached.\n basics: completeOnboardingBodyFields.pick({\n fullName: true,\n phone: true,\n dateOfBirth: true,\n gender: true,\n }),\n goals: completeOnboardingBodyFields.pick({ goals: true }),\n // The paid step (2026-12-06): it asks nothing, so nothing of it is in the\n // finish body. What passes it is the server's `needsMembership`.\n membership: completeOnboardingBodyFields.pick({}),\n // \"Tell us about your startup\" (2026-11-22).\n business: completeOnboardingBodyFields\n .pick({\n venture: true,\n legalStructure: true,\n })\n .refine(registrationHasVenture, REGISTRATION_NEEDS_VENTURE),\n interests: completeOnboardingBodyFields.pick({ interests: true }),\n location: completeOnboardingBodyFields.pick({ location: true }),\n photo: completeOnboardingBodyFields.pick({ avatarMediaId: true }),\n guidelines: completeOnboardingBodyFields.pick({ guidelinesVersion: true }),\n} as const satisfies Record<OnboardingStepKey, z.ZodObject>;\n\n/** One step's slice, parsed: `OnboardingStepBody<'basics'>` is `{ fullName, phone, dateOfBirth, gender }`. */\nexport type OnboardingStepBody<K extends OnboardingStepKey> = z.infer<\n (typeof ONBOARDING_STEP_SCHEMAS)[K]\n>;\n\n/** A finish-body field name. */\nexport type OnboardingField = keyof CompleteOnboardingBody;\n\n/**\n * One step of the wizard, as a client renders it.\n *\n * `fields` is what gates leaving this step: a field that appears in no step is\n * unreachable twice over, because Continue will not surface its error and the\n * final submit's jump-to-the-bad-step finds no step to jump to and leaves the\n * last screen dead.\n */\nexport interface OnboardingStepConfig {\n /** Stable identifier. Safe for analytics and for a resume cursor, unlike an index. */\n key: OnboardingStepKey;\n /**\n * Translation keys for what the step's header shows: its short label beside\n * the step number (\"STEP 4 OF 8 · LOCATION\") and its one question. The words\n * live in each client. There is no help line (the user removed it,\n * 2026-10-19; `helpKey` went in 0.17.0): who sees an answer is said on the\n * field it is about.\n */\n labelKey: `onboarding.steps.${OnboardingStepKey}.label`;\n titleKey: `onboarding.steps.${OnboardingStepKey}.title`;\n /** The step's slice of the finish body, in schema order (none for the membership step). */\n fields: readonly OnboardingField[];\n /**\n * False when the whole step may be passed without answering anything.\n * DERIVED: a step of answers is optional exactly when its slice accepts an\n * empty object, so \"skippable\" can never disagree with what the finish\n * accepts. The membership step is ALWAYS required (the user, 2026-12-06: no\n * \"Not now\"): it asks nothing, and the server passes it.\n */\n required: boolean;\n /**\n * `membership` for the paid step, `answers` for every other (0.37.0). A\n * client shows the membership step only while the status's\n * `needsMembership` is true, and moves past it once that is false.\n */\n kind: OnboardingStepKind;\n}\n\nexport const FOUNDER_ONBOARDING_STEPS: readonly OnboardingStepConfig[] = ONBOARDING_STEP_KEYS.map(\n (key): OnboardingStepConfig => {\n const slice = ONBOARDING_STEP_SCHEMAS[key];\n const kind: OnboardingStepKind = key === 'membership' ? 'membership' : 'answers';\n return {\n key,\n labelKey: `onboarding.steps.${key}.label`,\n titleKey: `onboarding.steps.${key}.title`,\n fields: Object.keys(slice.shape) as OnboardingField[],\n required: kind === 'membership' || !slice.safeParse({}).success,\n kind,\n };\n },\n);\n\nexport const ONBOARDING_TOTAL_STEPS = FOUNDER_ONBOARDING_STEPS.length;\n\n/** Fields gating each step, in step order. Read from the same picks. */\nexport const ONBOARDING_STEP_FIELDS: readonly (readonly OnboardingField[])[] =\n FOUNDER_ONBOARDING_STEPS.map((s) => s.fields);\n\n/** What finishing answers: the new profile's id and the handle derived for it. */\nexport const completeOnboardingResponseSchema = z.object({\n id: objectIdSchema,\n username: usernameSchema,\n});\nexport type CompleteOnboardingResponse = z.infer<typeof completeOnboardingResponseSchema>;\n\n// ─── What a client older than 2026-11-22 still sends ──────────────────────────\n\n/**\n * How many steps the list had before `professional` went: an older client's\n * \"past the last step\". (Which list a `PATCH` step counts in is the body's\n * `stepsVersion`, 2026-12-06.)\n */\nexport const LEGACY_ONBOARDING_TOTAL_STEPS = 9;\n\n/**\n * The step that went (2026-11-22) asked a title, an about and skills. A client\n * loaded before still saves them, and they are KEPT, in its draft, with their\n * old bounds, so finish can carry them to the profile\n * (`legacyProfessionalAnswers`): what a member typed is never dropped. Never\n * handed back on resume (they are not the form's keys any more).\n */\nconst LEGACY_DRAFT_KEYS = {\n headline: z.string().max(HEADLINE_MAX).optional(),\n about: z.string().max(ABOUT_MAX).optional(),\n skills: z.array(skillSchema).max(SKILLS_MAX).optional(),\n /**\n * The business type went END TO END (2026-11-22): an older client's answer\n * is accepted, never refused, and dropped (`withoutBusinessType`), never\n * stored.\n */\n businessType: z.unknown().optional(),\n};\n\n/** The draft without the business type (an older client's), whatever it held. */\nfunction withoutBusinessType<T extends { businessType?: unknown }>(\n draft: T,\n): Omit<T, 'businessType'> {\n const { businessType: _gone, ...rest } = draft;\n return rest;\n}\n\n/**\n * A title, about and skills a member typed into the step that went\n * (2026-11-22), read from their STORED draft, each by its profile rule:\n * trimmed text within its limit, known skills each once. One that does not fit\n * is left out. The server writes these at finish, never from the body.\n */\nexport function legacyProfessionalAnswers(draft: unknown): {\n headline?: string;\n about?: string;\n skills?: z.infer<typeof skillSchema>[];\n} {\n const raw: Record<string, unknown> =\n draft && typeof draft === 'object' && !Array.isArray(draft)\n ? (draft as Record<string, unknown>)\n : {};\n const out: { headline?: string; about?: string; skills?: z.infer<typeof skillSchema>[] } = {};\n const headline = optionalTrimmedString(HEADLINE_MAX).safeParse(raw.headline);\n if (headline.success && headline.data) out.headline = headline.data;\n const about = optionalTrimmedString(ABOUT_MAX).safeParse(raw.about);\n if (about.success && about.data) out.about = about.data;\n const skills = draftList(SKILL_VALUES, SKILLS_MAX).safeParse(raw.skills ?? []);\n if (skills.success && skills.data.length > 0) out.skills = skills.data;\n return out;\n}\n\n// ─── The resume cursor ───────────────────────────────────────────────────────\n\n/**\n * The keys a draft may hold: exactly the in-progress form's fields.\n *\n * ⚠ The server writes each key as a dot path (`draft.<key>`). Unchecked, a key\n * holding a dot writes somewhere nested the form never asked for, and the\n * collection fills with whatever a client invents. Until 0.2.0 the backend\n * kept its own copy of this list and DROPPED unknown keys without a word; now a\n * draft carrying one is refused, with the key in the issue's path.\n */\nexport const onboardingDraftKeySchema = onboardingFormSchema.keyof();\nexport const ONBOARDING_DRAFT_KEYS = onboardingDraftKeySchema.options;\nexport type OnboardingDraftKey = z.infer<typeof onboardingDraftKeySchema>;\n\n/**\n * Where the member got to, kept in its own collection, separate from the\n * profile.\n *\n * `step` is a flat index into `FOUNDER_ONBOARDING_STEPS`, not a `(step, sub)`\n * pair: one number is what lets a member start on the web and resume elsewhere,\n * provided both ends agree on the encoding.\n *\n * What is READ BACK: the draft's KEYS come from the form, its VALUES are\n * opaque, since a stored draft may predate 0.18.0 (any JSON was stored then);\n * read it through `readOnboardingDraft`, never by casting. What is WRITTEN is\n * the form's own shape (`onboardingProgressUpdateSchema.draft`, 0.18.0), and\n * everything is re-validated strictly at finalize.\n *\n * `partialRecord`, not `record`: in Zod 4 an enum-keyed `z.record` demands\n * every key, and a draft holds whichever steps the member has reached.\n */\nexport const onboardingDraftSchema = z.partialRecord(onboardingDraftKeySchema, z.unknown());\nexport type OnboardingDraft = z.infer<typeof onboardingDraftSchema>;\n\n/**\n * `PATCH` body: any subset of the cursor, merged server-side. No defaults.\n * `step` may equal `ONBOARDING_TOTAL_STEPS`: \"past the last step\", which the\n * client sends on its way to finish.\n *\n * The photo step's `avatarMediaId` is not kept in the draft (0.17.0): it is\n * handed to the server, which holds that upload for the member.\n */\nexport const onboardingProgressUpdateSchema = z.object({\n /**\n * Up to the OLD list's end (nine steps, 2026-11-22), brought within today's:\n * a client loaded before the step went still sends \"past the last step\" as 9\n * on its way to finish, and is not refused for it.\n *\n * ⚠ A NUMBER IN THE LIST NAMED BY `stepsVersion`. The server reads it in\n * that list and saves the same step, by name, in today's.\n */\n step: z\n .number()\n .int()\n .min(0)\n .max(Math.max(LEGACY_ONBOARDING_TOTAL_STEPS, ONBOARDING_TOTAL_STEPS))\n .transform((step) => Math.min(step, ONBOARDING_TOTAL_STEPS))\n .optional(),\n /**\n * Which step list `step` counts in (0.37.0): a client sends\n * `ONBOARDING_STEPS_VERSION`, always. ABSENT is a client from before this\n * field (2026-12-06), whose numbers are the eight-step list's (version 3):\n * the server translates them by name, so a tab loaded before the new order\n * saves the step it means and not the one now in its place.\n */\n stepsVersion: z.number().int().min(1).max(ONBOARDING_STEPS_VERSION).optional(),\n /**\n * The answers of the step being saved, IN THE FORM'S OWN SHAPE (0.18.0):\n * half-answered is fine (that is the form: text as typed, `null` for \"not\n * yet\"), but every value has its type and its bound, and no other key is\n * taken. Before 0.18.0 any JSON up to the body limit was stored as sent,\n * for 90 days, and sent back. The photo's id reads as `objectIdSchema` reads\n * every id (lower case), since the server compares it with the upload it\n * holds.\n */\n draft: onboardingFormSchema\n .partial()\n .extend(LEGACY_DRAFT_KEYS)\n .strict()\n .transform(withoutBusinessType)\n .optional(),\n});\nexport type OnboardingProgressUpdate = z.infer<typeof onboardingProgressUpdateSchema>;\n\n/**\n * What the client reads on return, from `GET` and from every `PATCH`.\n *\n * ⚠️ `onboarded` is the gate and it comes from the profile, not from the\n * cursor: a finished member on a new device must be recognised even when the\n * cursor row is gone, and a cursor that failed to load must never make an\n * unfinished member look finished.\n */\nexport const onboardingStatusSchema = z.object({\n onboarded: z.boolean(),\n step: z.number().int().min(0).max(ONBOARDING_TOTAL_STEPS),\n draft: onboardingDraftSchema.optional(),\n /**\n * The photo the member saved on the photo step, as it will appear (0.17.0):\n * the upload the server holds for this member's draft. Absent when they\n * saved none, removed it, or have finished. A client resumes the photo step\n * from this (its `id` is the finish body's `avatarMediaId`), never from the\n * draft.\n */\n photo: mediaImageSchema.optional(),\n /**\n * The member must buy the membership before going past the membership step\n * (0.37.0; the user, 2026-12-06: mandatory, no \"Not now\"). The SERVER\n * decides, and refuses a `PATCH` past that step and the finish\n * (`MEMBERSHIP_REQUIRED`) while it is true: payments are live, the account\n * holds no membership (one granted free for life, the early bird or \"joined\n * before payments\", counts as held), and holds no staff role.\n *\n * While true, `step` is never past the membership step. When false the\n * client does not show that step: it moves on with a `PATCH` to the step\n * after it. After a purchase the client asks again (`GET`) until this is\n * false: the membership is granted when the payment is captured.\n *\n * Always false once `onboarded`. Defaults to false so a client reading an\n * older server sees no paid step.\n */\n needsMembership: z.boolean().default(false),\n});\nexport type OnboardingStatus = z.infer<typeof onboardingStatusSchema>;\n"]}
|
|
@@ -210,9 +210,9 @@ export declare const contributionSummarySchema: z.ZodObject<{
|
|
|
210
210
|
}, z.core.$strip>;
|
|
211
211
|
export type ContributionSummary = z.infer<typeof contributionSummarySchema>;
|
|
212
212
|
/**
|
|
213
|
-
* The founder's off-platform links. ONE shape: onboarding's
|
|
214
|
-
*
|
|
215
|
-
* other. (It was written twice until 0.2.0, and the profile side lacked
|
|
213
|
+
* The founder's off-platform links. ONE shape: onboarding's links (an older
|
|
214
|
+
* tab's, since its contact step went on 2026-12-06) pick their three from
|
|
215
|
+
* this, so a link one side knows can never be missing on the other. (It was written twice until 0.2.0, and the profile side lacked
|
|
216
216
|
* Instagram, which onboarding collected.)
|
|
217
217
|
*
|
|
218
218
|
* Defined without a default, because the read side wants one and the write
|
|
@@ -133,9 +133,9 @@ export const contributionSummarySchema = z.object({
|
|
|
133
133
|
});
|
|
134
134
|
// ─── Profile ─────────────────────────────────────────────────────────────────
|
|
135
135
|
/**
|
|
136
|
-
* The founder's off-platform links. ONE shape: onboarding's
|
|
137
|
-
*
|
|
138
|
-
* other. (It was written twice until 0.2.0, and the profile side lacked
|
|
136
|
+
* The founder's off-platform links. ONE shape: onboarding's links (an older
|
|
137
|
+
* tab's, since its contact step went on 2026-12-06) pick their three from
|
|
138
|
+
* this, so a link one side knows can never be missing on the other. (It was written twice until 0.2.0, and the profile side lacked
|
|
139
139
|
* Instagram, which onboarding collected.)
|
|
140
140
|
*
|
|
141
141
|
* Defined without a default, because the read side wants one and the write
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"founder-profile.js","sourceRoot":"","sources":["../../../src/domains/profile/founder-profile.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,oBAAoB,EACpB,QAAQ,EACR,cAAc,EACd,WAAW,EACX,YAAY,EACZ,UAAU,EACV,aAAa,EACb,cAAc,E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;;;;;OAMG;IACH,QAAQ,EAAE,kBAAkB,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAClD,+CAA+C;IAC/C,UAAU,EAAE,uBAAuB,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CACzD,CAAC,CAAC;AAGH,gFAAgF;AAEhF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC,CAAC;AAGzE;;;;GAIG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,gBAAgB,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC","sourcesContent":["/**\n * founder-schema — The founder profile\n *\n * One member, one profile. The central auth account owns identity (email,\n * verification, deletion); this owns everything Founder Circle shows.\n *\n * @module founder-schema/domains/profile\n */\n\nimport { z } from 'zod';\nimport {\n chosenUsernameSchema,\n eachOnce,\n fullNameSchema,\n GOAL_VALUES,\n genderSchema,\n goalSchema,\n httpUrlSchema,\n industrySchema,\n locationSchema,\n objectIdSchema,\n optionalTrimmedString,\n phoneSchema,\n requiredGoalListSchema,\n skillListSchema,\n skillSchema,\n startupStageSchema,\n usernameSchema,\n} from '../../core/common.js';\nimport {\n ABOUT_MAX,\n DISPLAY_NAME_MAX,\n FOUNDED_YEAR_MIN,\n HEADLINE_MAX,\n SKILLS_MAX,\n TEAM_SIZE_MAX,\n TEAM_SIZE_MIN,\n VENTURE_NAME_MAX,\n VENTURE_TAGLINE_MAX,\n} from '../../core/limits.js';\nimport { VALIDATION_MESSAGE } from '../../core/validation.js';\nimport { followCountsSchema, followRelationSchema } from '../follows/relation.js';\nimport { locationPickSchema, placeSchema } from '../location/areas.js';\nimport { mediaImageSchema } from '../media/media.js';\nimport { personSchema, planBadgeSchema } from '../people/person.js';\n\n// ─── Venture ─────────────────────────────────────────────────────────────────\n\n/**\n * The member's role at their startup (2026-11-22, the user: \"role at startup\n * (give dropdown options like founder, cofounder, ceo, cto, cfo etc let user\n * chose mutliple of them)\"). Several at once: a founder is often its CEO too.\n * Public with the rest of the venture (the member's page shows it).\n *\n * ⚠ Stored on the profile's venture and a Mongoose enum. Append only.\n */\nexport const VENTURE_ROLE_VALUES = [\n 'founder',\n 'co_founder',\n 'ceo',\n 'cto',\n 'coo',\n 'cfo',\n 'cmo',\n 'cpo',\n 'other',\n] as const;\nexport const ventureRoleSchema = z.enum(VENTURE_ROLE_VALUES);\nexport type VentureRole = z.infer<typeof ventureRoleSchema>;\n\n/**\n * The roles a venture's member holds: each once, at least one. ABSENT when\n * none is picked, never an empty list: \"not answered\" stays absent.\n */\nexport const ventureRolesSchema = z\n .array(ventureRoleSchema)\n .min(1)\n .max(VENTURE_ROLE_VALUES.length)\n .refine(eachOnce, { error: VALIDATION_MESSAGE.rolesDuplicate });\n\n/**\n * ⚠ NUMBERS ARE NUMBERS, never coerced. This is a BODY, which arrives as JSON\n * and already carries types. `z.coerce.number()` here accepted `teamSize: true`\n * as 1 and `\" \"` as 0, and made the schema's input type `unknown`, so a form\n * typed against it could put anything in the field. Coercion belongs to query\n * strings, where everything is text; a form converts its text input before it\n * builds the body.\n */\nexport const ventureSchema = z.object({\n name: z.string().trim().min(1).max(VENTURE_NAME_MAX),\n tagline: optionalTrimmedString(VENTURE_TAGLINE_MAX),\n website: httpUrlSchema.optional(),\n industry: industrySchema,\n stage: startupStageSchema,\n /**\n * The member's roles at it (2026-11-22). OPTIONAL HERE, on what is READ: every\n * venture saved before has none, and a card or a page must still show it.\n * Every WRITE requires them (`ventureWriteSchema`, the user: \"keep the role\n * field mendetory\"): a member is asked the next time they save their business.\n */\n roles: ventureRolesSchema.optional(),\n /** Team size including the founder. Optional: a solo pre-idea founder has none to report. */\n teamSize: z.number().int().min(TEAM_SIZE_MIN).max(TEAM_SIZE_MAX).optional(),\n /**\n * Not in the future. The bound is read per parse, never captured once.\n *\n * `.max(new Date().getUTCFullYear())` looks equivalent and is not: it is\n * evaluated when this module is imported, so a server process still up on\n * 1 January rejects the new year until somebody restarts it. The backend's\n * Mongoose model deliberately carries no upper bound for the same reason, a\n * `max` there being frozen at schema construction. This is where the ceiling\n * lives.\n */\n foundedYear: z\n .number()\n .int()\n .min(FOUNDED_YEAR_MIN)\n .refine((year) => year <= new Date().getUTCFullYear(), {\n error: VALIDATION_MESSAGE.foundedYearFuture,\n })\n .optional(),\n});\nexport type Venture = z.infer<typeof ventureSchema>;\n\n/**\n * A venture as it is WRITTEN (2026-11-22): onboarding's startup step and\n * finish, and Me's business editor. The roles are REQUIRED, at least one, beside\n * the name, industry and stage (the user: \"keep the role field mendetory\"); the\n * READ shape (`ventureSchema`) keeps them optional for the ventures saved before.\n */\nexport const ventureWriteSchema = ventureSchema.extend({ roles: ventureRolesSchema });\n\n/**\n * A venture's fields, in order, and which of them may be left out (0.17.0):\n * what the backend lists when it saves or compares a venture, read from here.\n */\nexport const VENTURE_KEYS = ventureSchema.keyof().options;\nexport type VentureKey = (typeof VENTURE_KEYS)[number];\nexport const VENTURE_OPTIONAL_KEYS: readonly VentureKey[] = VENTURE_KEYS.filter(\n (key) => ventureSchema.shape[key].safeParse(undefined).success,\n);\n\n// ─── A member as other surfaces name them ────────────────────────────────────\n\n/**\n * A member as a byline renders them: on a post (`feedAuthorSchema` is this), a\n * product's team, a review, a notification, the top-helpers list. Since\n * 0.20.0 it is `personSchema` (one shape for every person, its doc says why)\n * with the member's one-line headline.\n *\n * Every field is LIVE, joined at read time rather than frozen onto the post or\n * review at write time. So a new name, handle, photo or headline shows\n * everywhere, the link always targets the current username, and nothing\n * personal survives in other people's rows once an account is deleted: the\n * byline of a deleted account is `former: true` with no name or picture.\n */\nexport const memberBylineSchema = personSchema.extend({\n /** The member's one-line headline, live-joined. Absent for a former member. */\n headline: z.string().optional(),\n});\nexport type MemberByline = z.infer<typeof memberBylineSchema>;\n\n/**\n * What a member has given the community, on their profile and card.\n *\n * `score` is points earned from OTHER members' recognition only: a product's\n * team marking your feedback helpful, confirming you tested their product,\n * and members finding your review helpful (writing one earns nothing by\n * itself). Nothing a member\n * does to their own product counts, so the score cannot be bought by having a\n * popular one. `helpedCount` is how many different founders recognised that\n * help (\"Helped 12 founders\"). See `domains/contributions`.\n */\nexport const contributionSummarySchema = z.object({\n score: z.number().int().nonnegative(),\n helpedCount: z.number().int().nonnegative(),\n});\nexport type ContributionSummary = z.infer<typeof contributionSummarySchema>;\n\n// ─── Profile ─────────────────────────────────────────────────────────────────\n\n/**\n * The founder's off-platform links. ONE shape: onboarding's contact step picks\n * its three from this, so a link one side knows can never be missing on the\n * other. (It was written twice until 0.2.0, and the profile side lacked\n * Instagram, which onboarding collected.)\n *\n * Defined without a default, because the read side wants one and the write\n * side must not have one; each adds its own.\n */\nexport const founderLinksSchema = z.object({\n linkedin: httpUrlSchema.optional(),\n x: httpUrlSchema.optional(),\n instagram: httpUrlSchema.optional(),\n github: httpUrlSchema.optional(),\n website: httpUrlSchema.optional(),\n});\nexport type FounderLinks = z.infer<typeof founderLinksSchema>;\n\n/**\n * The profile's links, by key, in order (0.17.0): what the backend's model and\n * its projections list. Read from here, never written out again: a copy of\n * this list is how the profile model once lost Instagram.\n */\nexport const FOUNDER_LINK_KEYS = founderLinksSchema.keyof().options;\nexport type FounderLinkKey = (typeof FOUNDER_LINK_KEYS)[number];\n\n/**\n * The profile as the owner sees it. A peer sees the redacted projection\n * (`founderCardSchema`), which is built on the server and never by dropping\n * fields on the client.\n */\nexport const founderProfileSchema = z.object({\n id: z.string(),\n userId: z.string(),\n username: usernameSchema,\n /**\n * First and last name joined (0.20.0): DERIVED by the server from\n * `firstName` and `lastName`, never written as a value of its own.\n */\n displayName: z.string().trim().min(1).max(DISPLAY_NAME_MAX),\n /** The first word of the member's full name (0.20.0). */\n firstName: z.string(),\n /** Everything after the first space; `''` for a one-word name (0.20.0). */\n lastName: z.string(),\n headline: optionalTrimmedString(HEADLINE_MAX),\n about: optionalTrimmedString(ABOUT_MAX),\n /**\n * Plain `z.url()`, NOT `httpUrlSchema`, and the difference is deliberate.\n *\n * No member can write this field: it appears in no write body, and\n * `public-surface.test.ts` asserts that and will fail the day somebody adds it\n * to a form. So the scheme restriction would be defending a field that takes\n * no member input, while refusing hosts we legitimately serve avatars from,\n * our own dev host among them. A read schema that rejects our own response is\n * a self-inflicted outage.\n *\n * ⚠️ That argument holds only while nothing member-supplied reaches this\n * field. Two sources write an avatar today and NEITHER is a member typing a\n * URL: our own upload path, and the central-auth `user.created` /\n * `user.updated` webhook, which carries the Google OAuth picture. If a\n * \"paste a link to your photo\" control is ever added, this goes back to\n * `httpUrlSchema` and the ruling behind it is void.\n *\n * WHICH picture: the member's uploaded photo at its small size (192, see\n * `MEDIA_SIZES.avatar`), else their sign-in provider's picture, else absent.\n * Every surface that shows this member resolves it the same way.\n */\n avatarUrl: z.url().optional(),\n /**\n * The uploaded photo itself, every size, when the member has one. Absent\n * means `avatarUrl` (if any) is the sign-in provider's picture, so a client\n * offers \"Remove photo\" only when this is present. Not on `founderCardSchema`:\n * a card needs one small picture, not the set.\n */\n avatar: mediaImageSchema.optional(),\n /**\n * The member's choice about their sign-in provider's picture (0.20.0): when\n * false it is never shown, so with no upload they appear with their\n * initials. `hasProviderPhoto` says whether there is one to offer at all.\n */\n useProviderPhoto: z.boolean(),\n hasProviderPhoto: z.boolean(),\n location: locationSchema.optional(),\n /**\n * The member's own location as picked (0.19.0): state, district and\n * locality with their area ids, for Me's location field and the drawer.\n * OWNER-ONLY: no card or member page carries it (they pick `location`).\n * Absent for a location stored as text before 0.19.0.\n */\n place: placeSchema.optional(),\n venture: ventureSchema.optional(),\n skills: z.array(skillSchema).max(SKILLS_MAX).default([]),\n goals: z.array(goalSchema).max(GOAL_VALUES.length).default([]),\n links: founderLinksSchema.default({}),\n /**\n * Their contribution to other founders. Server-computed, never written by a\n * member. REQUIRED, no default: a read-side default would let a server that\n * forgot the field pass as a real zero.\n */\n contribution: contributionSummarySchema,\n createdAt: z.iso.datetime(),\n updatedAt: z.iso.datetime(),\n});\nexport type FounderProfile = z.infer<typeof founderProfileSchema>;\n\n/**\n * What one founder sees of another in Discover and on a profile page.\n *\n * Built server-side. Keep it a strict subset of `founderProfileSchema` — if a\n * private field ever needs to show here, that is a product decision, not an\n * accident of spreading the full document.\n */\n// ⚠ The web's Discover cache follows the member's own saves of exactly these\n// fields (`discoverChangedBy` in the web's features/profile/api.ts derives its\n// list from this shape): adding a field here is enough, there is no second list.\nexport const founderCardSchema = founderProfileSchema.pick({\n id: true,\n /**\n * The MEMBER's id (0.6.0): what a team invitation, a chat and every byline\n * key on. `id` is the profile's own id, which nothing takes as input.\n */\n userId: true,\n username: true,\n displayName: true,\n headline: true,\n avatarUrl: true,\n location: true,\n venture: true,\n skills: true,\n goals: true,\n contribution: true,\n});\nexport type FounderCard = z.infer<typeof founderCardSchema>;\n\n/** The fields a Discover card shows. */\nexport const FOUNDER_CARD_FIELDS = founderCardSchema.keyof().options;\nexport type FounderCardField = (typeof FOUNDER_CARD_FIELDS)[number];\n\n/**\n * The card fields a member's own edit can change, the ones that move them up\n * Discover: every card field but the ids, which never change, and the points\n * (`contribution`), which other people's acts move all day and which would\n * otherwise reorder Discover with every helpful mark.\n */\nexport const FOUNDER_CARD_EDIT_FIELDS = FOUNDER_CARD_FIELDS.filter(\n (field) => field !== 'id' && field !== 'userId' && field !== 'contribution',\n);\n\n/**\n * Whether a write changed what a member's Discover card shows (0.18.0): ONE\n * rule for every profile writer, which decides whether the member moves up\n * Discover (its \"recently updated\" order) and whether a client reloads it.\n * `changed` names the fields the write actually changed: a body's keys, or\n * for the business editor `venture` only when its PUBLIC part changed. Before\n * 0.18.0 five writers decided it four ways: an edit to the About text alone\n * lifted a member to the top of everyone's Discover, a new username never did.\n * Points never count (`FOUNDER_CARD_EDIT_FIELDS`): they are not the member's\n * edit.\n */\nexport function changesDiscoverCard(changed: readonly string[]): boolean {\n return changed.some((field) => (FOUNDER_CARD_EDIT_FIELDS as readonly string[]).includes(field));\n}\n\n// ─── What a member chooses to show (0.11.0) ──────────────────────────────────\n\n/**\n * The four personal details a member MAY show on their profile page (the\n * user's ruling, 2026-10-11). Each is PRIVATE until its owner turns it on;\n * everything else on a profile is public as before. Changed only through\n * `PATCH /profiles/me/personal`.\n */\nexport const CONTACT_VISIBILITY_FIELDS = ['email', 'phone', 'gender', 'birthday'] as const;\nexport type ContactVisibilityField = (typeof CONTACT_VISIBILITY_FIELDS)[number];\n\n/**\n * WHO sees each of the four once its owner turns it on (0.18.0). The user,\n * 2026-10-20: \"any person who has the platform membership can view them if\n * they are public\", so all four go to members only (and to the member\n * themself), never to an account without membership. One table: the server\n * builds `shown` from it, and every screen words its switch from it.\n */\nexport const PROFILE_AUDIENCE_VALUES = ['members'] as const;\nexport type ProfileAudience = (typeof PROFILE_AUDIENCE_VALUES)[number];\nexport const CONTACT_VISIBILITY_AUDIENCE = {\n email: 'members',\n phone: 'members',\n gender: 'members',\n birthday: 'members',\n} as const satisfies Record<ContactVisibilityField, ProfileAudience>;\n\n/** Which of the four the member shows. Every key present on a read: false is private. */\nexport const contactVisibilitySchema = z.object(\n Object.fromEntries(CONTACT_VISIBILITY_FIELDS.map((field) => [field, z.boolean()])) as Record<\n ContactVisibilityField,\n z.ZodBoolean\n >,\n);\nexport type ContactVisibility = z.infer<typeof contactVisibilitySchema>;\n\n/**\n * A birthday as OTHERS see it: day and month, NEVER the year (the user's\n * ruling). The year would give away the age and, with the name, the full date\n * of birth that identity checks ask for. The year is never on the wire.\n */\nexport const publicBirthdaySchema = z.object({\n day: z.number().int().min(1).max(31),\n month: z.number().int().min(1).max(12),\n});\nexport type PublicBirthday = z.infer<typeof publicBirthdaySchema>;\n\n/**\n * `GET /api/v1/founders/by-username/:username` (0.11.0): one member's profile\n * page, as a signed-in member (or the member themself) sees it.\n *\n * The card's fields, what only a page has room for (about, links, member\n * since), and `shown`: the personal details this member has CHOSEN to show,\n * and nothing else, to the audience `CONTACT_VISIBILITY_AUDIENCE` names\n * (members only, all four, 0.18.0); the server decides, and a client renders\n * what arrives. Built field by field on the server\n * (`toMemberPublic`), never by dropping fields from a fuller document.\n *\n * `viewer.canMessage` is the server's answer to \"offer Message\": the tap\n * opens a conversation, or (0.13.0) the sheet that makes one possible (the\n * membership for a viewer, the plans for a member without one). Who may\n * message whom follows membership and plans, so no client works it out.\n */\nexport const memberProfileSchema = founderProfileSchema\n .pick({\n id: true,\n userId: true,\n username: true,\n displayName: true,\n headline: true,\n about: true,\n avatarUrl: true,\n location: true,\n venture: true,\n skills: true,\n goals: true,\n links: true,\n contribution: true,\n createdAt: true,\n })\n .extend({\n shown: z.object({\n email: z.string().optional(),\n phone: z.string().optional(),\n gender: genderSchema.optional(),\n birthday: publicBirthdaySchema.optional(),\n }),\n viewer: z.object({\n isSelf: z.boolean(),\n canMessage: z.boolean(),\n /**\n * The viewer has BLOCKED this member (2026-11-23, `domains/blocks`): the\n * page says so and offers Unblock, and shows nothing they wrote. (Blocked\n * BY them, the viewer gets \"not available\" instead of a page.) Absent\n * from a server before blocking existed: not blocked.\n */\n blocked: z.boolean().default(false),\n }),\n /** How many follow them and whom they follow, counted when read (2026-11-20). */\n follows: followCountsSchema,\n /** The viewer and them (2026-11-20): all false for the viewer's own page. */\n follow: followRelationSchema,\n /**\n * Their plan badge (0.32.0), as `personSchema.planBadge` says; hidden on\n * their own page too when they turned it off. Defaults to null when an\n * older server leaves it out.\n */\n planBadge: planBadgeSchema.nullable().default(null),\n });\nexport type MemberProfile = z.infer<typeof memberProfileSchema>;\n\n/** The member page's address: `/discover/<username>`. */\nexport const memberHandleParamsSchema = z.object({ username: usernameSchema });\nexport type MemberHandleParams = z.infer<typeof memberHandleParamsSchema>;\n\n// ─── Write bodies ────────────────────────────────────────────────────────────\n\n/**\n * A text field the member is allowed to empty.\n *\n * Three states, and they are deliberately distinct:\n * absent do not touch this field\n * null clear it (the backend turns this into an `$unset`)\n * \"\" REJECTED\n *\n * The empty string is refused on purpose. A form that forgets to convert a\n * cleared input to `null` then fails loudly at the boundary, instead of being\n * silently dropped and leaving the member staring at text they just deleted.\n * `optionalTrimmedString` does the dropping, which is right for a create body\n * and wrong for a patch.\n */\nconst clearableText = (maxLength: number) =>\n z.string().trim().min(1, VALIDATION_MESSAGE.clearWithNull).max(maxLength).nullable().optional();\n\n/**\n * Patch body for the Me tab. Only the keys the member actually changed.\n *\n * ⚠️ Written as its own object ON PURPOSE. Do NOT rebuild it as\n * `founderProfileSchema.pick({...}).partial()`: `.partial()` does not switch\n * off `.default()`, so `skills`, `goals` and `links` would materialise as\n * `[]`, `[]` and `{}` on every request, including an empty one. Under a `$set`\n * that wipes a member's skills and every one of their links the moment they\n * edit their display name. `tsc` cannot see it and the request looks correct in\n * the network tab.\n *\n * The rule this comes from: defaults belong on the READ side. A write body\n * states what the caller sent and nothing else.\n *\n * ONE WRITER PER FIELD (0.18.0): the name and the city are the personal\n * details' (`PATCH /profiles/me/personal`), the venture is the business\n * editor's (`PUT /profiles/me/business`), the handle has its own route. They\n * were taken here too, a second path with its own rules for Discover's order.\n * STRICT: any other key is refused (a 400 naming it), never dropped without a\n * word, so a client still sending a name here learns it at once instead of\n * losing the member's edit.\n */\nexport const updateFounderProfileBodySchema = z\n .object({\n headline: clearableText(HEADLINE_MAX),\n about: clearableText(ABOUT_MAX),\n /** The same list rules as onboarding's finish (each value once, 0.17.0). */\n skills: skillListSchema.optional(),\n /**\n * The same rules as onboarding's finish, its minimum included (0.18.0, the\n * user: \"we already have at least one goal required\"): Me cannot save a\n * member down to no goals.\n */\n goals: requiredGoalListSchema.optional(),\n /** Sent whole. To drop one link, send the object without that key. */\n links: founderLinksSchema.optional(),\n })\n .strict();\nexport type UpdateFounderProfileBody = z.infer<typeof updateFounderProfileBodySchema>;\n\n/**\n * Username change. Separate from the profile patch because it needs a\n * uniqueness check, and it refuses a reserved handle (`chosenUsernameSchema`).\n */\nexport const updateUsernameBodySchema = z.object({ username: chosenUsernameSchema });\nexport type UpdateUsernameBody = z.infer<typeof updateUsernameBodySchema>;\n\n/** `GET /api/v1/profiles/username-available?username=` (0.13.0): the handle asked about. */\nexport const usernameAvailabilityQuerySchema = z.object({ username: usernameSchema });\nexport type UsernameAvailabilityQuery = z.infer<typeof usernameAvailabilityQuerySchema>;\n\n/** Why a username is not available. */\nexport const USERNAME_UNAVAILABLE_REASON_VALUES = ['taken', 'reserved'] as const;\nexport type UsernameUnavailableReason = (typeof USERNAME_UNAVAILABLE_REASON_VALUES)[number];\n\nexport const usernameAvailabilitySchema = z.object({\n username: usernameSchema,\n available: z.boolean(),\n /** Present when unavailable. */\n reason: z.enum(USERNAME_UNAVAILABLE_REASON_VALUES).optional(),\n});\nexport type UsernameAvailability = z.infer<typeof usernameAvailabilitySchema>;\n\n// ─── The member's own personal details ──────────────────────────────────────\n\n/**\n * `GET /api/v1/profiles/me/personal` (0.10.0): what ONLY the member sees of\n * themselves, the \"Personal details\" card of the Me tab's Profile.\n *\n * ⚠ OWNER ONLY, and kept OFF `founderProfileSchema` on purpose. Email, phone,\n * gender and date of birth are personal data: they appear on no card, no\n * search, no team list, no byline and no audit detail. The profile is read on\n * every page by the app shell; these do not travel with it, they are asked\n * for only where they are shown.\n *\n * Read shapes are plain where the stored value may predate today's rule (a\n * phone seeded from the sign-in provider in another format): a read schema\n * that rejects our own stored value is a self-inflicted outage. The write\n * body holds the rules.\n */\nexport const myPersonalDetailsSchema = z.object({\n /** First and last name joined, derived (0.20.0): the card's first row. */\n displayName: z.string(),\n /** As stored (0.20.0): what Me's \"Full name\" box is filled from, joined. */\n firstName: z.string(),\n lastName: z.string(),\n /** The sign-in account's. Changed there (Account settings), never here. */\n email: z.string().optional(),\n /** Ten digits as stored on the account mirror; display adds the `+91`. */\n phone: z.string().optional(),\n gender: genderSchema.optional(),\n /**\n * `YYYY-MM-DD`. READ ONLY: it is the 18+ check's input, given once at\n * onboarding. A date of birth that could be edited later would be an age\n * gate anyone could walk around.\n */\n dateOfBirth: z.string().optional(),\n /** Which of email, phone, gender and birthday the member shows on their page (0.11.0). */\n visibility: contactVisibilitySchema,\n});\nexport type MyPersonalDetails = z.infer<typeof myPersonalDetailsSchema>;\n\n/**\n * `PATCH /api/v1/profiles/me/personal` (0.10.0): name, phone and gender. Only\n * the keys the member changed; answers with `myPersonalDetailsSchema`.\n *\n * ONE RULE PER FIELD: the very schemas onboarding finishes with (the display\n * name, the ten-digit phone, the gender enum with prefer-not-to-say), so a\n * value one accepts the other can never refuse.\n *\n * ⚠ NO `.default()` and no `.partial()` of a read shape (see\n * `updateFounderProfileBodySchema`): absent means unchanged, and a default\n * would overwrite what is stored. No `dateOfBirth`: read only, above. No\n * `email`: the sign-in account owns it.\n *\n * Name and phone are PRODUCT-OWNED on Founder Circle's account mirror: the\n * sign-in service seeds them once and never overwrites them, so this edits\n * Founder Circle's copy and never calls the sign-in service.\n */\nexport const updateMyPersonalDetailsBodySchema = z.object({\n /**\n * The full name as typed (0.20.0; `displayName` until 0.19.0): the server\n * splits it at the first space into first and last name and derives the\n * display name from them (`splitFullName`, `joinFullName`).\n */\n fullName: fullNameSchema.optional(),\n phone: phoneSchema.optional(),\n gender: genderSchema.optional(),\n /**\n * The location, or `null` to remove it (0.11.0): it moved to the Personal\n * Details card, so its editor saves it here, with the rest, in one\n * transaction; only here since 0.18.0 (`PATCH /profiles/me` took it too).\n * Area ids from the drawer or GPS (0.19.0, `locationPickSchema`): the server\n * names the place and its public city from `master_db`.\n */\n location: locationPickSchema.nullable().optional(),\n /** Only the switches that changed (0.11.0). */\n visibility: contactVisibilitySchema.partial().optional(),\n});\nexport type UpdateMyPersonalDetailsBody = z.infer<typeof updateMyPersonalDetailsBodySchema>;\n\n// ─── The member's own photo ──────────────────────────────────────────────────\n\n/**\n * `PUT /api/v1/profiles/me/avatar`: use a completed upload (purpose `avatar`)\n * as the member's photo. Answers with the updated `founderProfileSchema`.\n *\n * The previous photo is deleted from storage, not merely unlinked, so its old\n * address stops working. `DELETE /api/v1/profiles/me/avatar` removes the photo\n * the same way and the member falls back to their sign-in provider's picture.\n */\nexport const setAvatarBodySchema = z.object({ mediaId: objectIdSchema });\nexport type SetAvatarBody = z.infer<typeof setAvatarBodySchema>;\n\n/**\n * `PATCH /api/v1/profiles/me/photo-settings` (0.20.0): show or hide the\n * sign-in provider's picture (Google's). Off, a member with no upload appears\n * with their initials everywhere. Answers with the updated `founderProfileSchema`.\n */\nexport const updatePhotoSettingsBodySchema = z.object({ useProviderPhoto: z.boolean() }).strict();\nexport type UpdatePhotoSettingsBody = z.infer<typeof updatePhotoSettingsBodySchema>;\n"]}
|
|
1
|
+
{"version":3,"file":"founder-profile.js","sourceRoot":"","sources":["../../../src/domains/profile/founder-profile.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,oBAAoB,EACpB,QAAQ,EACR,cAAc,EACd,WAAW,EACX,YAAY,EACZ,UAAU,EACV,aAAa,EACb,cAAc,EACd,cAAc,EACd,cAAc,EACd,qBAAqB,EACrB,WAAW,EACX,sBAAsB,EACtB,eAAe,EACf,WAAW,EACX,kBAAkB,EAClB,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEpE,gFAAgF;AAEhF;;;;;;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,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,2EAA2E;IAC3E,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,0EAA0E;IAC1E,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,MAAM,EAAE,YAAY,CAAC,QAAQ,EAAE;IAC/B;;;;OAIG;IACH,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,0FAA0F;IAC1F,UAAU,EAAE,uBAAuB;CACpC,CAAC,CAAC;AAGH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC,CAAC,MAAM,CAAC;IACxD;;;;OAIG;IACH,QAAQ,EAAE,cAAc,CAAC,QAAQ,EAAE;IACnC,KAAK,EAAE,WAAW,CAAC,QAAQ,EAAE;IAC7B,MAAM,EAAE,YAAY,CAAC,QAAQ,EAAE;IAC/B;;;;;;OAMG;IACH,QAAQ,EAAE,kBAAkB,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAClD,+CAA+C;IAC/C,UAAU,EAAE,uBAAuB,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CACzD,CAAC,CAAC;AAGH,gFAAgF;AAEhF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC,CAAC;AAGzE;;;;GAIG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,gBAAgB,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC","sourcesContent":["/**\n * founder-schema — The founder profile\n *\n * One member, one profile. The central auth account owns identity (email,\n * verification, deletion); this owns everything Founder Circle shows.\n *\n * @module founder-schema/domains/profile\n */\n\nimport { z } from 'zod';\nimport {\n chosenUsernameSchema,\n eachOnce,\n fullNameSchema,\n GOAL_VALUES,\n genderSchema,\n goalSchema,\n httpUrlSchema,\n industrySchema,\n locationSchema,\n objectIdSchema,\n optionalTrimmedString,\n phoneSchema,\n requiredGoalListSchema,\n skillListSchema,\n skillSchema,\n startupStageSchema,\n usernameSchema,\n} from '../../core/common.js';\nimport {\n ABOUT_MAX,\n DISPLAY_NAME_MAX,\n FOUNDED_YEAR_MIN,\n HEADLINE_MAX,\n SKILLS_MAX,\n TEAM_SIZE_MAX,\n TEAM_SIZE_MIN,\n VENTURE_NAME_MAX,\n VENTURE_TAGLINE_MAX,\n} from '../../core/limits.js';\nimport { VALIDATION_MESSAGE } from '../../core/validation.js';\nimport { followCountsSchema, followRelationSchema } from '../follows/relation.js';\nimport { locationPickSchema, placeSchema } from '../location/areas.js';\nimport { mediaImageSchema } from '../media/media.js';\nimport { personSchema, planBadgeSchema } from '../people/person.js';\n\n// ─── Venture ─────────────────────────────────────────────────────────────────\n\n/**\n * The member's role at their startup (2026-11-22, the user: \"role at startup\n * (give dropdown options like founder, cofounder, ceo, cto, cfo etc let user\n * chose mutliple of them)\"). Several at once: a founder is often its CEO too.\n * Public with the rest of the venture (the member's page shows it).\n *\n * ⚠ Stored on the profile's venture and a Mongoose enum. Append only.\n */\nexport const VENTURE_ROLE_VALUES = [\n 'founder',\n 'co_founder',\n 'ceo',\n 'cto',\n 'coo',\n 'cfo',\n 'cmo',\n 'cpo',\n 'other',\n] as const;\nexport const ventureRoleSchema = z.enum(VENTURE_ROLE_VALUES);\nexport type VentureRole = z.infer<typeof ventureRoleSchema>;\n\n/**\n * The roles a venture's member holds: each once, at least one. ABSENT when\n * none is picked, never an empty list: \"not answered\" stays absent.\n */\nexport const ventureRolesSchema = z\n .array(ventureRoleSchema)\n .min(1)\n .max(VENTURE_ROLE_VALUES.length)\n .refine(eachOnce, { error: VALIDATION_MESSAGE.rolesDuplicate });\n\n/**\n * ⚠ NUMBERS ARE NUMBERS, never coerced. This is a BODY, which arrives as JSON\n * and already carries types. `z.coerce.number()` here accepted `teamSize: true`\n * as 1 and `\" \"` as 0, and made the schema's input type `unknown`, so a form\n * typed against it could put anything in the field. Coercion belongs to query\n * strings, where everything is text; a form converts its text input before it\n * builds the body.\n */\nexport const ventureSchema = z.object({\n name: z.string().trim().min(1).max(VENTURE_NAME_MAX),\n tagline: optionalTrimmedString(VENTURE_TAGLINE_MAX),\n website: httpUrlSchema.optional(),\n industry: industrySchema,\n stage: startupStageSchema,\n /**\n * The member's roles at it (2026-11-22). OPTIONAL HERE, on what is READ: every\n * venture saved before has none, and a card or a page must still show it.\n * Every WRITE requires them (`ventureWriteSchema`, the user: \"keep the role\n * field mendetory\"): a member is asked the next time they save their business.\n */\n roles: ventureRolesSchema.optional(),\n /** Team size including the founder. Optional: a solo pre-idea founder has none to report. */\n teamSize: z.number().int().min(TEAM_SIZE_MIN).max(TEAM_SIZE_MAX).optional(),\n /**\n * Not in the future. The bound is read per parse, never captured once.\n *\n * `.max(new Date().getUTCFullYear())` looks equivalent and is not: it is\n * evaluated when this module is imported, so a server process still up on\n * 1 January rejects the new year until somebody restarts it. The backend's\n * Mongoose model deliberately carries no upper bound for the same reason, a\n * `max` there being frozen at schema construction. This is where the ceiling\n * lives.\n */\n foundedYear: z\n .number()\n .int()\n .min(FOUNDED_YEAR_MIN)\n .refine((year) => year <= new Date().getUTCFullYear(), {\n error: VALIDATION_MESSAGE.foundedYearFuture,\n })\n .optional(),\n});\nexport type Venture = z.infer<typeof ventureSchema>;\n\n/**\n * A venture as it is WRITTEN (2026-11-22): onboarding's startup step and\n * finish, and Me's business editor. The roles are REQUIRED, at least one, beside\n * the name, industry and stage (the user: \"keep the role field mendetory\"); the\n * READ shape (`ventureSchema`) keeps them optional for the ventures saved before.\n */\nexport const ventureWriteSchema = ventureSchema.extend({ roles: ventureRolesSchema });\n\n/**\n * A venture's fields, in order, and which of them may be left out (0.17.0):\n * what the backend lists when it saves or compares a venture, read from here.\n */\nexport const VENTURE_KEYS = ventureSchema.keyof().options;\nexport type VentureKey = (typeof VENTURE_KEYS)[number];\nexport const VENTURE_OPTIONAL_KEYS: readonly VentureKey[] = VENTURE_KEYS.filter(\n (key) => ventureSchema.shape[key].safeParse(undefined).success,\n);\n\n// ─── A member as other surfaces name them ────────────────────────────────────\n\n/**\n * A member as a byline renders them: on a post (`feedAuthorSchema` is this), a\n * product's team, a review, a notification, the top-helpers list. Since\n * 0.20.0 it is `personSchema` (one shape for every person, its doc says why)\n * with the member's one-line headline.\n *\n * Every field is LIVE, joined at read time rather than frozen onto the post or\n * review at write time. So a new name, handle, photo or headline shows\n * everywhere, the link always targets the current username, and nothing\n * personal survives in other people's rows once an account is deleted: the\n * byline of a deleted account is `former: true` with no name or picture.\n */\nexport const memberBylineSchema = personSchema.extend({\n /** The member's one-line headline, live-joined. Absent for a former member. */\n headline: z.string().optional(),\n});\nexport type MemberByline = z.infer<typeof memberBylineSchema>;\n\n/**\n * What a member has given the community, on their profile and card.\n *\n * `score` is points earned from OTHER members' recognition only: a product's\n * team marking your feedback helpful, confirming you tested their product,\n * and members finding your review helpful (writing one earns nothing by\n * itself). Nothing a member\n * does to their own product counts, so the score cannot be bought by having a\n * popular one. `helpedCount` is how many different founders recognised that\n * help (\"Helped 12 founders\"). See `domains/contributions`.\n */\nexport const contributionSummarySchema = z.object({\n score: z.number().int().nonnegative(),\n helpedCount: z.number().int().nonnegative(),\n});\nexport type ContributionSummary = z.infer<typeof contributionSummarySchema>;\n\n// ─── Profile ─────────────────────────────────────────────────────────────────\n\n/**\n * The founder's off-platform links. ONE shape: onboarding's links (an older\n * tab's, since its contact step went on 2026-12-06) pick their three from\n * this, so a link one side knows can never be missing on the other. (It was written twice until 0.2.0, and the profile side lacked\n * Instagram, which onboarding collected.)\n *\n * Defined without a default, because the read side wants one and the write\n * side must not have one; each adds its own.\n */\nexport const founderLinksSchema = z.object({\n linkedin: httpUrlSchema.optional(),\n x: httpUrlSchema.optional(),\n instagram: httpUrlSchema.optional(),\n github: httpUrlSchema.optional(),\n website: httpUrlSchema.optional(),\n});\nexport type FounderLinks = z.infer<typeof founderLinksSchema>;\n\n/**\n * The profile's links, by key, in order (0.17.0): what the backend's model and\n * its projections list. Read from here, never written out again: a copy of\n * this list is how the profile model once lost Instagram.\n */\nexport const FOUNDER_LINK_KEYS = founderLinksSchema.keyof().options;\nexport type FounderLinkKey = (typeof FOUNDER_LINK_KEYS)[number];\n\n/**\n * The profile as the owner sees it. A peer sees the redacted projection\n * (`founderCardSchema`), which is built on the server and never by dropping\n * fields on the client.\n */\nexport const founderProfileSchema = z.object({\n id: z.string(),\n userId: z.string(),\n username: usernameSchema,\n /**\n * First and last name joined (0.20.0): DERIVED by the server from\n * `firstName` and `lastName`, never written as a value of its own.\n */\n displayName: z.string().trim().min(1).max(DISPLAY_NAME_MAX),\n /** The first word of the member's full name (0.20.0). */\n firstName: z.string(),\n /** Everything after the first space; `''` for a one-word name (0.20.0). */\n lastName: z.string(),\n headline: optionalTrimmedString(HEADLINE_MAX),\n about: optionalTrimmedString(ABOUT_MAX),\n /**\n * Plain `z.url()`, NOT `httpUrlSchema`, and the difference is deliberate.\n *\n * No member can write this field: it appears in no write body, and\n * `public-surface.test.ts` asserts that and will fail the day somebody adds it\n * to a form. So the scheme restriction would be defending a field that takes\n * no member input, while refusing hosts we legitimately serve avatars from,\n * our own dev host among them. A read schema that rejects our own response is\n * a self-inflicted outage.\n *\n * ⚠️ That argument holds only while nothing member-supplied reaches this\n * field. Two sources write an avatar today and NEITHER is a member typing a\n * URL: our own upload path, and the central-auth `user.created` /\n * `user.updated` webhook, which carries the Google OAuth picture. If a\n * \"paste a link to your photo\" control is ever added, this goes back to\n * `httpUrlSchema` and the ruling behind it is void.\n *\n * WHICH picture: the member's uploaded photo at its small size (192, see\n * `MEDIA_SIZES.avatar`), else their sign-in provider's picture, else absent.\n * Every surface that shows this member resolves it the same way.\n */\n avatarUrl: z.url().optional(),\n /**\n * The uploaded photo itself, every size, when the member has one. Absent\n * means `avatarUrl` (if any) is the sign-in provider's picture, so a client\n * offers \"Remove photo\" only when this is present. Not on `founderCardSchema`:\n * a card needs one small picture, not the set.\n */\n avatar: mediaImageSchema.optional(),\n /**\n * The member's choice about their sign-in provider's picture (0.20.0): when\n * false it is never shown, so with no upload they appear with their\n * initials. `hasProviderPhoto` says whether there is one to offer at all.\n */\n useProviderPhoto: z.boolean(),\n hasProviderPhoto: z.boolean(),\n location: locationSchema.optional(),\n /**\n * The member's own location as picked (0.19.0): state, district and\n * locality with their area ids, for Me's location field and the drawer.\n * OWNER-ONLY: no card or member page carries it (they pick `location`).\n * Absent for a location stored as text before 0.19.0.\n */\n place: placeSchema.optional(),\n venture: ventureSchema.optional(),\n skills: z.array(skillSchema).max(SKILLS_MAX).default([]),\n goals: z.array(goalSchema).max(GOAL_VALUES.length).default([]),\n links: founderLinksSchema.default({}),\n /**\n * Their contribution to other founders. Server-computed, never written by a\n * member. REQUIRED, no default: a read-side default would let a server that\n * forgot the field pass as a real zero.\n */\n contribution: contributionSummarySchema,\n createdAt: z.iso.datetime(),\n updatedAt: z.iso.datetime(),\n});\nexport type FounderProfile = z.infer<typeof founderProfileSchema>;\n\n/**\n * What one founder sees of another in Discover and on a profile page.\n *\n * Built server-side. Keep it a strict subset of `founderProfileSchema` — if a\n * private field ever needs to show here, that is a product decision, not an\n * accident of spreading the full document.\n */\n// ⚠ The web's Discover cache follows the member's own saves of exactly these\n// fields (`discoverChangedBy` in the web's features/profile/api.ts derives its\n// list from this shape): adding a field here is enough, there is no second list.\nexport const founderCardSchema = founderProfileSchema.pick({\n id: true,\n /**\n * The MEMBER's id (0.6.0): what a team invitation, a chat and every byline\n * key on. `id` is the profile's own id, which nothing takes as input.\n */\n userId: true,\n username: true,\n displayName: true,\n headline: true,\n avatarUrl: true,\n location: true,\n venture: true,\n skills: true,\n goals: true,\n contribution: true,\n});\nexport type FounderCard = z.infer<typeof founderCardSchema>;\n\n/** The fields a Discover card shows. */\nexport const FOUNDER_CARD_FIELDS = founderCardSchema.keyof().options;\nexport type FounderCardField = (typeof FOUNDER_CARD_FIELDS)[number];\n\n/**\n * The card fields a member's own edit can change, the ones that move them up\n * Discover: every card field but the ids, which never change, and the points\n * (`contribution`), which other people's acts move all day and which would\n * otherwise reorder Discover with every helpful mark.\n */\nexport const FOUNDER_CARD_EDIT_FIELDS = FOUNDER_CARD_FIELDS.filter(\n (field) => field !== 'id' && field !== 'userId' && field !== 'contribution',\n);\n\n/**\n * Whether a write changed what a member's Discover card shows (0.18.0): ONE\n * rule for every profile writer, which decides whether the member moves up\n * Discover (its \"recently updated\" order) and whether a client reloads it.\n * `changed` names the fields the write actually changed: a body's keys, or\n * for the business editor `venture` only when its PUBLIC part changed. Before\n * 0.18.0 five writers decided it four ways: an edit to the About text alone\n * lifted a member to the top of everyone's Discover, a new username never did.\n * Points never count (`FOUNDER_CARD_EDIT_FIELDS`): they are not the member's\n * edit.\n */\nexport function changesDiscoverCard(changed: readonly string[]): boolean {\n return changed.some((field) => (FOUNDER_CARD_EDIT_FIELDS as readonly string[]).includes(field));\n}\n\n// ─── What a member chooses to show (0.11.0) ──────────────────────────────────\n\n/**\n * The four personal details a member MAY show on their profile page (the\n * user's ruling, 2026-10-11). Each is PRIVATE until its owner turns it on;\n * everything else on a profile is public as before. Changed only through\n * `PATCH /profiles/me/personal`.\n */\nexport const CONTACT_VISIBILITY_FIELDS = ['email', 'phone', 'gender', 'birthday'] as const;\nexport type ContactVisibilityField = (typeof CONTACT_VISIBILITY_FIELDS)[number];\n\n/**\n * WHO sees each of the four once its owner turns it on (0.18.0). The user,\n * 2026-10-20: \"any person who has the platform membership can view them if\n * they are public\", so all four go to members only (and to the member\n * themself), never to an account without membership. One table: the server\n * builds `shown` from it, and every screen words its switch from it.\n */\nexport const PROFILE_AUDIENCE_VALUES = ['members'] as const;\nexport type ProfileAudience = (typeof PROFILE_AUDIENCE_VALUES)[number];\nexport const CONTACT_VISIBILITY_AUDIENCE = {\n email: 'members',\n phone: 'members',\n gender: 'members',\n birthday: 'members',\n} as const satisfies Record<ContactVisibilityField, ProfileAudience>;\n\n/** Which of the four the member shows. Every key present on a read: false is private. */\nexport const contactVisibilitySchema = z.object(\n Object.fromEntries(CONTACT_VISIBILITY_FIELDS.map((field) => [field, z.boolean()])) as Record<\n ContactVisibilityField,\n z.ZodBoolean\n >,\n);\nexport type ContactVisibility = z.infer<typeof contactVisibilitySchema>;\n\n/**\n * A birthday as OTHERS see it: day and month, NEVER the year (the user's\n * ruling). The year would give away the age and, with the name, the full date\n * of birth that identity checks ask for. The year is never on the wire.\n */\nexport const publicBirthdaySchema = z.object({\n day: z.number().int().min(1).max(31),\n month: z.number().int().min(1).max(12),\n});\nexport type PublicBirthday = z.infer<typeof publicBirthdaySchema>;\n\n/**\n * `GET /api/v1/founders/by-username/:username` (0.11.0): one member's profile\n * page, as a signed-in member (or the member themself) sees it.\n *\n * The card's fields, what only a page has room for (about, links, member\n * since), and `shown`: the personal details this member has CHOSEN to show,\n * and nothing else, to the audience `CONTACT_VISIBILITY_AUDIENCE` names\n * (members only, all four, 0.18.0); the server decides, and a client renders\n * what arrives. Built field by field on the server\n * (`toMemberPublic`), never by dropping fields from a fuller document.\n *\n * `viewer.canMessage` is the server's answer to \"offer Message\": the tap\n * opens a conversation, or (0.13.0) the sheet that makes one possible (the\n * membership for a viewer, the plans for a member without one). Who may\n * message whom follows membership and plans, so no client works it out.\n */\nexport const memberProfileSchema = founderProfileSchema\n .pick({\n id: true,\n userId: true,\n username: true,\n displayName: true,\n headline: true,\n about: true,\n avatarUrl: true,\n location: true,\n venture: true,\n skills: true,\n goals: true,\n links: true,\n contribution: true,\n createdAt: true,\n })\n .extend({\n shown: z.object({\n email: z.string().optional(),\n phone: z.string().optional(),\n gender: genderSchema.optional(),\n birthday: publicBirthdaySchema.optional(),\n }),\n viewer: z.object({\n isSelf: z.boolean(),\n canMessage: z.boolean(),\n /**\n * The viewer has BLOCKED this member (2026-11-23, `domains/blocks`): the\n * page says so and offers Unblock, and shows nothing they wrote. (Blocked\n * BY them, the viewer gets \"not available\" instead of a page.) Absent\n * from a server before blocking existed: not blocked.\n */\n blocked: z.boolean().default(false),\n }),\n /** How many follow them and whom they follow, counted when read (2026-11-20). */\n follows: followCountsSchema,\n /** The viewer and them (2026-11-20): all false for the viewer's own page. */\n follow: followRelationSchema,\n /**\n * Their plan badge (0.32.0), as `personSchema.planBadge` says; hidden on\n * their own page too when they turned it off. Defaults to null when an\n * older server leaves it out.\n */\n planBadge: planBadgeSchema.nullable().default(null),\n });\nexport type MemberProfile = z.infer<typeof memberProfileSchema>;\n\n/** The member page's address: `/discover/<username>`. */\nexport const memberHandleParamsSchema = z.object({ username: usernameSchema });\nexport type MemberHandleParams = z.infer<typeof memberHandleParamsSchema>;\n\n// ─── Write bodies ────────────────────────────────────────────────────────────\n\n/**\n * A text field the member is allowed to empty.\n *\n * Three states, and they are deliberately distinct:\n * absent do not touch this field\n * null clear it (the backend turns this into an `$unset`)\n * \"\" REJECTED\n *\n * The empty string is refused on purpose. A form that forgets to convert a\n * cleared input to `null` then fails loudly at the boundary, instead of being\n * silently dropped and leaving the member staring at text they just deleted.\n * `optionalTrimmedString` does the dropping, which is right for a create body\n * and wrong for a patch.\n */\nconst clearableText = (maxLength: number) =>\n z.string().trim().min(1, VALIDATION_MESSAGE.clearWithNull).max(maxLength).nullable().optional();\n\n/**\n * Patch body for the Me tab. Only the keys the member actually changed.\n *\n * ⚠️ Written as its own object ON PURPOSE. Do NOT rebuild it as\n * `founderProfileSchema.pick({...}).partial()`: `.partial()` does not switch\n * off `.default()`, so `skills`, `goals` and `links` would materialise as\n * `[]`, `[]` and `{}` on every request, including an empty one. Under a `$set`\n * that wipes a member's skills and every one of their links the moment they\n * edit their display name. `tsc` cannot see it and the request looks correct in\n * the network tab.\n *\n * The rule this comes from: defaults belong on the READ side. A write body\n * states what the caller sent and nothing else.\n *\n * ONE WRITER PER FIELD (0.18.0): the name and the city are the personal\n * details' (`PATCH /profiles/me/personal`), the venture is the business\n * editor's (`PUT /profiles/me/business`), the handle has its own route. They\n * were taken here too, a second path with its own rules for Discover's order.\n * STRICT: any other key is refused (a 400 naming it), never dropped without a\n * word, so a client still sending a name here learns it at once instead of\n * losing the member's edit.\n */\nexport const updateFounderProfileBodySchema = z\n .object({\n headline: clearableText(HEADLINE_MAX),\n about: clearableText(ABOUT_MAX),\n /** The same list rules as onboarding's finish (each value once, 0.17.0). */\n skills: skillListSchema.optional(),\n /**\n * The same rules as onboarding's finish, its minimum included (0.18.0, the\n * user: \"we already have at least one goal required\"): Me cannot save a\n * member down to no goals.\n */\n goals: requiredGoalListSchema.optional(),\n /** Sent whole. To drop one link, send the object without that key. */\n links: founderLinksSchema.optional(),\n })\n .strict();\nexport type UpdateFounderProfileBody = z.infer<typeof updateFounderProfileBodySchema>;\n\n/**\n * Username change. Separate from the profile patch because it needs a\n * uniqueness check, and it refuses a reserved handle (`chosenUsernameSchema`).\n */\nexport const updateUsernameBodySchema = z.object({ username: chosenUsernameSchema });\nexport type UpdateUsernameBody = z.infer<typeof updateUsernameBodySchema>;\n\n/** `GET /api/v1/profiles/username-available?username=` (0.13.0): the handle asked about. */\nexport const usernameAvailabilityQuerySchema = z.object({ username: usernameSchema });\nexport type UsernameAvailabilityQuery = z.infer<typeof usernameAvailabilityQuerySchema>;\n\n/** Why a username is not available. */\nexport const USERNAME_UNAVAILABLE_REASON_VALUES = ['taken', 'reserved'] as const;\nexport type UsernameUnavailableReason = (typeof USERNAME_UNAVAILABLE_REASON_VALUES)[number];\n\nexport const usernameAvailabilitySchema = z.object({\n username: usernameSchema,\n available: z.boolean(),\n /** Present when unavailable. */\n reason: z.enum(USERNAME_UNAVAILABLE_REASON_VALUES).optional(),\n});\nexport type UsernameAvailability = z.infer<typeof usernameAvailabilitySchema>;\n\n// ─── The member's own personal details ──────────────────────────────────────\n\n/**\n * `GET /api/v1/profiles/me/personal` (0.10.0): what ONLY the member sees of\n * themselves, the \"Personal details\" card of the Me tab's Profile.\n *\n * ⚠ OWNER ONLY, and kept OFF `founderProfileSchema` on purpose. Email, phone,\n * gender and date of birth are personal data: they appear on no card, no\n * search, no team list, no byline and no audit detail. The profile is read on\n * every page by the app shell; these do not travel with it, they are asked\n * for only where they are shown.\n *\n * Read shapes are plain where the stored value may predate today's rule (a\n * phone seeded from the sign-in provider in another format): a read schema\n * that rejects our own stored value is a self-inflicted outage. The write\n * body holds the rules.\n */\nexport const myPersonalDetailsSchema = z.object({\n /** First and last name joined, derived (0.20.0): the card's first row. */\n displayName: z.string(),\n /** As stored (0.20.0): what Me's \"Full name\" box is filled from, joined. */\n firstName: z.string(),\n lastName: z.string(),\n /** The sign-in account's. Changed there (Account settings), never here. */\n email: z.string().optional(),\n /** Ten digits as stored on the account mirror; display adds the `+91`. */\n phone: z.string().optional(),\n gender: genderSchema.optional(),\n /**\n * `YYYY-MM-DD`. READ ONLY: it is the 18+ check's input, given once at\n * onboarding. A date of birth that could be edited later would be an age\n * gate anyone could walk around.\n */\n dateOfBirth: z.string().optional(),\n /** Which of email, phone, gender and birthday the member shows on their page (0.11.0). */\n visibility: contactVisibilitySchema,\n});\nexport type MyPersonalDetails = z.infer<typeof myPersonalDetailsSchema>;\n\n/**\n * `PATCH /api/v1/profiles/me/personal` (0.10.0): name, phone and gender. Only\n * the keys the member changed; answers with `myPersonalDetailsSchema`.\n *\n * ONE RULE PER FIELD: the very schemas onboarding finishes with (the display\n * name, the ten-digit phone, the gender enum with prefer-not-to-say), so a\n * value one accepts the other can never refuse.\n *\n * ⚠ NO `.default()` and no `.partial()` of a read shape (see\n * `updateFounderProfileBodySchema`): absent means unchanged, and a default\n * would overwrite what is stored. No `dateOfBirth`: read only, above. No\n * `email`: the sign-in account owns it.\n *\n * Name and phone are PRODUCT-OWNED on Founder Circle's account mirror: the\n * sign-in service seeds them once and never overwrites them, so this edits\n * Founder Circle's copy and never calls the sign-in service.\n */\nexport const updateMyPersonalDetailsBodySchema = z.object({\n /**\n * The full name as typed (0.20.0; `displayName` until 0.19.0): the server\n * splits it at the first space into first and last name and derives the\n * display name from them (`splitFullName`, `joinFullName`).\n */\n fullName: fullNameSchema.optional(),\n phone: phoneSchema.optional(),\n gender: genderSchema.optional(),\n /**\n * The location, or `null` to remove it (0.11.0): it moved to the Personal\n * Details card, so its editor saves it here, with the rest, in one\n * transaction; only here since 0.18.0 (`PATCH /profiles/me` took it too).\n * Area ids from the drawer or GPS (0.19.0, `locationPickSchema`): the server\n * names the place and its public city from `master_db`.\n */\n location: locationPickSchema.nullable().optional(),\n /** Only the switches that changed (0.11.0). */\n visibility: contactVisibilitySchema.partial().optional(),\n});\nexport type UpdateMyPersonalDetailsBody = z.infer<typeof updateMyPersonalDetailsBodySchema>;\n\n// ─── The member's own photo ──────────────────────────────────────────────────\n\n/**\n * `PUT /api/v1/profiles/me/avatar`: use a completed upload (purpose `avatar`)\n * as the member's photo. Answers with the updated `founderProfileSchema`.\n *\n * The previous photo is deleted from storage, not merely unlinked, so its old\n * address stops working. `DELETE /api/v1/profiles/me/avatar` removes the photo\n * the same way and the member falls back to their sign-in provider's picture.\n */\nexport const setAvatarBodySchema = z.object({ mediaId: objectIdSchema });\nexport type SetAvatarBody = z.infer<typeof setAvatarBodySchema>;\n\n/**\n * `PATCH /api/v1/profiles/me/photo-settings` (0.20.0): show or hide the\n * sign-in provider's picture (Google's). Off, a member with no upload appears\n * with their initials everywhere. Answers with the updated `founderProfileSchema`.\n */\nexport const updatePhotoSettingsBodySchema = z.object({ useProviderPhoto: z.boolean() }).strict();\nexport type UpdatePhotoSettingsBody = z.infer<typeof updatePhotoSettingsBodySchema>;\n"]}
|