founder-schema 0.25.0 → 0.26.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/domains/communities/communities.d.ts +9 -9
- package/dist/domains/discover/discover.d.ts +88 -0
- package/dist/domains/discover/discover.d.ts.map +1 -1
- package/dist/domains/feed/feed.d.ts +11 -11
- package/dist/domains/follows/follows.d.ts +186 -3
- package/dist/domains/follows/follows.d.ts.map +1 -1
- package/dist/domains/follows/follows.js +15 -4
- package/dist/domains/follows/follows.js.map +1 -1
- package/dist/domains/follows/relation.d.ts +24 -0
- package/dist/domains/follows/relation.d.ts.map +1 -1
- package/dist/domains/follows/relation.js +24 -0
- package/dist/domains/follows/relation.js.map +1 -1
- package/dist/domains/onboarding/onboarding-answers.d.ts +12 -8
- package/dist/domains/onboarding/onboarding-answers.d.ts.map +1 -1
- package/dist/domains/onboarding/onboarding-answers.js +20 -21
- package/dist/domains/onboarding/onboarding-answers.js.map +1 -1
- package/dist/domains/onboarding/onboarding.d.ts +210 -174
- package/dist/domains/onboarding/onboarding.d.ts.map +1 -1
- package/dist/domains/onboarding/onboarding.js +104 -70
- package/dist/domains/onboarding/onboarding.js.map +1 -1
- package/dist/domains/products/products.d.ts +3 -3
- package/dist/domains/profile/founder-profile.d.ts +143 -1
- package/dist/domains/profile/founder-profile.d.ts.map +1 -1
- package/dist/domains/profile/founder-profile.js +44 -1
- package/dist/domains/profile/founder-profile.js.map +1 -1
- package/dist/domains/profile/my-profile.d.ts +119 -40
- package/dist/domains/profile/my-profile.d.ts.map +1 -1
- package/dist/domains/profile/my-profile.js +28 -14
- package/dist/domains/profile/my-profile.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -19,9 +19,10 @@
|
|
|
19
19
|
import { z } from 'zod';
|
|
20
20
|
import { objectIdSchema } from '../../core/common.js';
|
|
21
21
|
import { paginatedSchema } from '../../core/responses.js';
|
|
22
|
+
import { INTERESTS_MAX, topicSchema } from '../onboarding/onboarding.js';
|
|
22
23
|
import { founderCardSchema } from '../profile/founder-profile.js';
|
|
23
24
|
import { followRelationSchema } from './relation.js';
|
|
24
|
-
export { followCountsSchema, followedBySchema, followRelationSchema, } from './relation.js';
|
|
25
|
+
export { followCountsSchema, followedBySchema, followRelationSchema, MUTUALS_SAMPLE_SIZE, mutualsSchema, } from './relation.js';
|
|
25
26
|
/** Whom to follow or stop following: the MEMBER's id (`userId`), as chats and bylines key on. */
|
|
26
27
|
export const followTargetParamsSchema = z.object({ userId: objectIdSchema });
|
|
27
28
|
/** The answer to a follow or an unfollow: the state now, and their follower count now. */
|
|
@@ -32,10 +33,20 @@ export const followAnswerSchema = z.object({
|
|
|
32
33
|
});
|
|
33
34
|
/**
|
|
34
35
|
* A person on a list (Discover's People, someone's followers and following):
|
|
35
|
-
* their card, and how the viewer relates to them, for the
|
|
36
|
-
* and its Follow button.
|
|
36
|
+
* their card, their interests, and how the viewer relates to them, for the
|
|
37
|
+
* card's mutuals line and its Follow button.
|
|
38
|
+
*
|
|
39
|
+
* `interests` (2026-11-22, the user's People card): the topics the member
|
|
40
|
+
* picked, in their order, each once. ON THIS CARD ONLY: not on
|
|
41
|
+
* `founderCardSchema` (other cards, the member page) and not on
|
|
42
|
+
* `founderProfileSchema` (the owner reads theirs from `GET /profiles/me/interests`).
|
|
43
|
+
* It lives here and not in `domains/profile` because the topics are
|
|
44
|
+
* onboarding's, and onboarding imports the profile.
|
|
37
45
|
*/
|
|
38
|
-
export const personCardSchema = founderCardSchema.extend({
|
|
46
|
+
export const personCardSchema = founderCardSchema.extend({
|
|
47
|
+
interests: z.array(topicSchema).max(INTERESTS_MAX).default([]),
|
|
48
|
+
follow: followRelationSchema,
|
|
49
|
+
});
|
|
39
50
|
/** A page of people, newest follow first on the followers and following lists. */
|
|
40
51
|
export const personPageSchema = paginatedSchema(personCardSchema);
|
|
41
52
|
//# sourceMappingURL=follows.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"follows.js","sourceRoot":"","sources":["../../../src/domains/follows/follows.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,EAIL,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"follows.js","sourceRoot":"","sources":["../../../src/domains/follows/follows.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,EAIL,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EAEnB,aAAa,GACd,MAAM,eAAe,CAAC;AAEvB,iGAAiG;AACjG,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC;AAG7E,0FAA0F;AAC1F,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,MAAM,EAAE,cAAc;IACtB,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;IACtB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;CAC1C,CAAC,CAAC;AAGH;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,iBAAiB,CAAC,MAAM,CAAC;IACvD,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IAC9D,MAAM,EAAE,oBAAoB;CAC7B,CAAC,CAAC;AAGH,kFAAkF;AAClF,MAAM,CAAC,MAAM,gBAAgB,GAAG,eAAe,CAAC,gBAAgB,CAAC,CAAC","sourcesContent":["/**\n * founder-schema: following a member (2026-11-20; Jansathi's one-way follow)\n *\n * One way, no acceptance: following someone puts their posts in your home\n * feed (the ones you may read) and tells you when they post; they hear that\n * you followed them. Never yourself; never a deleted account. Following is\n * taking part: a viewer is refused (MEMBERSHIP_REQUIRED).\n *\n * PUT /api/v1/founders/:userId/follow followTargetParamsSchema -> followAnswerSchema\n * DELETE /api/v1/founders/:userId/follow followTargetParamsSchema -> followAnswerSchema\n * GET /api/v1/founders/:userId/followers paginationQuerySchema -> personPageSchema\n * GET /api/v1/founders/:userId/following paginationQuerySchema -> personPageSchema\n *\n * PUT and DELETE are idempotent (not a toggle): a double tap or a retry\n * cannot flip it back. Both answer the state as it now stands.\n *\n * @module founder-schema/domains/follows\n */\n\nimport { z } from 'zod';\nimport { objectIdSchema } from '../../core/common.js';\nimport { paginatedSchema } from '../../core/responses.js';\nimport { INTERESTS_MAX, topicSchema } from '../onboarding/onboarding.js';\nimport { founderCardSchema } from '../profile/founder-profile.js';\nimport { followRelationSchema } from './relation.js';\n\nexport {\n type FollowCounts,\n type FollowedBy,\n type FollowRelation,\n followCountsSchema,\n followedBySchema,\n followRelationSchema,\n MUTUALS_SAMPLE_SIZE,\n type Mutuals,\n mutualsSchema,\n} from './relation.js';\n\n/** Whom to follow or stop following: the MEMBER's id (`userId`), as chats and bylines key on. */\nexport const followTargetParamsSchema = z.object({ userId: objectIdSchema });\nexport type FollowTargetParams = z.infer<typeof followTargetParamsSchema>;\n\n/** The answer to a follow or an unfollow: the state now, and their follower count now. */\nexport const followAnswerSchema = z.object({\n userId: objectIdSchema,\n following: z.boolean(),\n followers: z.number().int().nonnegative(),\n});\nexport type FollowAnswer = z.infer<typeof followAnswerSchema>;\n\n/**\n * A person on a list (Discover's People, someone's followers and following):\n * their card, their interests, and how the viewer relates to them, for the\n * card's mutuals line and its Follow button.\n *\n * `interests` (2026-11-22, the user's People card): the topics the member\n * picked, in their order, each once. ON THIS CARD ONLY: not on\n * `founderCardSchema` (other cards, the member page) and not on\n * `founderProfileSchema` (the owner reads theirs from `GET /profiles/me/interests`).\n * It lives here and not in `domains/profile` because the topics are\n * onboarding's, and onboarding imports the profile.\n */\nexport const personCardSchema = founderCardSchema.extend({\n interests: z.array(topicSchema).max(INTERESTS_MAX).default([]),\n follow: followRelationSchema,\n});\nexport type PersonCard = z.infer<typeof personCardSchema>;\n\n/** A page of people, newest follow first on the followers and following lists. */\nexport const personPageSchema = paginatedSchema(personCardSchema);\nexport type PersonPage = z.infer<typeof personPageSchema>;\n"]}
|
|
@@ -16,6 +16,25 @@ export declare const followedBySchema: z.ZodObject<{
|
|
|
16
16
|
others: z.ZodNumber;
|
|
17
17
|
}, z.core.$strip>;
|
|
18
18
|
export type FollowedBy = z.infer<typeof followedBySchema>;
|
|
19
|
+
/** How many faces and names a mutuals line carries (GymMonk's `MUTUALS_SAMPLE_SIZE`). */
|
|
20
|
+
export declare const MUTUALS_SAMPLE_SIZE = 3;
|
|
21
|
+
/**
|
|
22
|
+
* "Followed by Neha, Rohit + 3 more" (2026-11-22, the People card; GymMonk's
|
|
23
|
+
* and Jansathi's mutuals line): the same people as `followedBy`, of the people
|
|
24
|
+
* the VIEWER follows the ones who follow this person, newest follow first,
|
|
25
|
+
* deleted accounts left out.
|
|
26
|
+
*
|
|
27
|
+
* `count` is ALL of them; `sampleNames` and `avatars` only the first
|
|
28
|
+
* `MUTUALS_SAMPLE_SIZE`, in the same order, so face `i` falls back to the
|
|
29
|
+
* initial of name `i`. The line names two and counts the rest. An avatar is
|
|
30
|
+
* null when that person has no photo.
|
|
31
|
+
*/
|
|
32
|
+
export declare const mutualsSchema: z.ZodObject<{
|
|
33
|
+
count: z.ZodNumber;
|
|
34
|
+
sampleNames: z.ZodArray<z.ZodString>;
|
|
35
|
+
avatars: z.ZodArray<z.ZodNullable<z.ZodURL>>;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
export type Mutuals = z.infer<typeof mutualsSchema>;
|
|
19
38
|
/** The viewer and this person, both ways. Always all false / none for the viewer themselves. */
|
|
20
39
|
export declare const followRelationSchema: z.ZodObject<{
|
|
21
40
|
following: z.ZodBoolean;
|
|
@@ -24,6 +43,11 @@ export declare const followRelationSchema: z.ZodObject<{
|
|
|
24
43
|
firstName: z.ZodNullable<z.ZodString>;
|
|
25
44
|
others: z.ZodNumber;
|
|
26
45
|
}, z.core.$strip>;
|
|
46
|
+
mutuals: z.ZodOptional<z.ZodObject<{
|
|
47
|
+
count: z.ZodNumber;
|
|
48
|
+
sampleNames: z.ZodArray<z.ZodString>;
|
|
49
|
+
avatars: z.ZodArray<z.ZodNullable<z.ZodURL>>;
|
|
50
|
+
}, z.core.$strip>>;
|
|
27
51
|
}, z.core.$strip>;
|
|
28
52
|
export type FollowRelation = z.infer<typeof followRelationSchema>;
|
|
29
53
|
/** How many follow this person, and how many they follow. Counted when read, never stored. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relation.d.ts","sourceRoot":"","sources":["../../../src/domains/follows/relation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,eAAO,MAAM,gBAAgB;;;iBAG3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,gGAAgG;AAChG,eAAO,MAAM,oBAAoB
|
|
1
|
+
{"version":3,"file":"relation.d.ts","sourceRoot":"","sources":["../../../src/domains/follows/relation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,eAAO,MAAM,gBAAgB;;;iBAG3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,yFAAyF;AACzF,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAErC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,aAAa;;;;iBAIxB,CAAC;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpD,gGAAgG;AAChG,eAAO,MAAM,oBAAoB;;;;;;;;;;;;iBAY/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,8FAA8F;AAC9F,eAAO,MAAM,kBAAkB;;;iBAG7B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
|
@@ -15,6 +15,24 @@ export const followedBySchema = z.object({
|
|
|
15
15
|
firstName: z.string().nullable(),
|
|
16
16
|
others: z.number().int().nonnegative(),
|
|
17
17
|
});
|
|
18
|
+
/** How many faces and names a mutuals line carries (GymMonk's `MUTUALS_SAMPLE_SIZE`). */
|
|
19
|
+
export const MUTUALS_SAMPLE_SIZE = 3;
|
|
20
|
+
/**
|
|
21
|
+
* "Followed by Neha, Rohit + 3 more" (2026-11-22, the People card; GymMonk's
|
|
22
|
+
* and Jansathi's mutuals line): the same people as `followedBy`, of the people
|
|
23
|
+
* the VIEWER follows the ones who follow this person, newest follow first,
|
|
24
|
+
* deleted accounts left out.
|
|
25
|
+
*
|
|
26
|
+
* `count` is ALL of them; `sampleNames` and `avatars` only the first
|
|
27
|
+
* `MUTUALS_SAMPLE_SIZE`, in the same order, so face `i` falls back to the
|
|
28
|
+
* initial of name `i`. The line names two and counts the rest. An avatar is
|
|
29
|
+
* null when that person has no photo.
|
|
30
|
+
*/
|
|
31
|
+
export const mutualsSchema = z.object({
|
|
32
|
+
count: z.number().int().nonnegative(),
|
|
33
|
+
sampleNames: z.array(z.string()).max(MUTUALS_SAMPLE_SIZE),
|
|
34
|
+
avatars: z.array(z.url().nullable()).max(MUTUALS_SAMPLE_SIZE),
|
|
35
|
+
});
|
|
18
36
|
/** The viewer and this person, both ways. Always all false / none for the viewer themselves. */
|
|
19
37
|
export const followRelationSchema = z.object({
|
|
20
38
|
/** The viewer follows them: the button reads "Following". */
|
|
@@ -22,6 +40,12 @@ export const followRelationSchema = z.object({
|
|
|
22
40
|
/** They follow the viewer: "Follows you", and the button reads "Follow back". */
|
|
23
41
|
followsYou: z.boolean(),
|
|
24
42
|
followedBy: followedBySchema,
|
|
43
|
+
/**
|
|
44
|
+
* The People card's mutuals line (2026-11-22). OPTIONAL, and absent means
|
|
45
|
+
* none: added beside `followedBy` without changing it, so a page or a
|
|
46
|
+
* server from before still parses.
|
|
47
|
+
*/
|
|
48
|
+
mutuals: mutualsSchema.optional(),
|
|
25
49
|
});
|
|
26
50
|
/** How many follow this person, and how many they follow. Counted when read, never stored. */
|
|
27
51
|
export const followCountsSchema = z.object({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relation.js","sourceRoot":"","sources":["../../../src/domains/follows/relation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,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AAC;CAC9D,CAAC,CAAC;AAGH,gGAAgG;AAChG,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,6DAA6D;IAC7D,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;IACtB,iFAAiF;IACjF,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE;IACvB,UAAU,EAAE,gBAAgB;IAC5B;;;;OAIG;IACH,OAAO,EAAE,aAAa,CAAC,QAAQ,EAAE;CAClC,CAAC,CAAC;AAGH,8FAA8F;AAC9F,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IACzC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;CAC1C,CAAC,CAAC","sourcesContent":["/**\n * founder-schema: one member's follow relation to another, as a viewer sees it\n * (2026-11-20). A leaf module, imported by the member page (`domains/profile`)\n * and the people lists (`domains/follows`), so neither imports the other.\n *\n * @module founder-schema/domains/follows/relation\n */\n\nimport { z } from 'zod';\n\n/**\n * \"Followed by Neha + 3\": of the people the VIEWER follows, the ones who\n * follow this person. `firstName` is one of them (null when none), `others`\n * how many more.\n */\nexport const followedBySchema = z.object({\n firstName: z.string().nullable(),\n others: z.number().int().nonnegative(),\n});\nexport type FollowedBy = z.infer<typeof followedBySchema>;\n\n/** How many faces and names a mutuals line carries (GymMonk's `MUTUALS_SAMPLE_SIZE`). */\nexport const MUTUALS_SAMPLE_SIZE = 3;\n\n/**\n * \"Followed by Neha, Rohit + 3 more\" (2026-11-22, the People card; GymMonk's\n * and Jansathi's mutuals line): the same people as `followedBy`, of the people\n * the VIEWER follows the ones who follow this person, newest follow first,\n * deleted accounts left out.\n *\n * `count` is ALL of them; `sampleNames` and `avatars` only the first\n * `MUTUALS_SAMPLE_SIZE`, in the same order, so face `i` falls back to the\n * initial of name `i`. The line names two and counts the rest. An avatar is\n * null when that person has no photo.\n */\nexport const mutualsSchema = z.object({\n count: z.number().int().nonnegative(),\n sampleNames: z.array(z.string()).max(MUTUALS_SAMPLE_SIZE),\n avatars: z.array(z.url().nullable()).max(MUTUALS_SAMPLE_SIZE),\n});\nexport type Mutuals = z.infer<typeof mutualsSchema>;\n\n/** The viewer and this person, both ways. Always all false / none for the viewer themselves. */\nexport const followRelationSchema = z.object({\n /** The viewer follows them: the button reads \"Following\". */\n following: z.boolean(),\n /** They follow the viewer: \"Follows you\", and the button reads \"Follow back\". */\n followsYou: z.boolean(),\n followedBy: followedBySchema,\n /**\n * The People card's mutuals line (2026-11-22). OPTIONAL, and absent means\n * none: added beside `followedBy` without changing it, so a page or a\n * server from before still parses.\n */\n mutuals: mutualsSchema.optional(),\n});\nexport type FollowRelation = z.infer<typeof followRelationSchema>;\n\n/** How many follow this person, and how many they follow. Counted when read, never stored. */\nexport const followCountsSchema = z.object({\n followers: z.number().int().nonnegative(),\n following: z.number().int().nonnegative(),\n});\nexport type FollowCounts = z.infer<typeof followCountsSchema>;\n"]}
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
*/
|
|
22
22
|
import { type Industry, type StartupStage } from '../../core/common.js';
|
|
23
23
|
import { type Place } from '../location/areas.js';
|
|
24
|
+
import type { VentureRole } from '../profile/founder-profile.js';
|
|
24
25
|
import { type CompleteOnboardingBodyInput, type OnboardingForm, type OnboardingStepKey } from './onboarding.js';
|
|
25
26
|
type DeepPartial<T> = T extends readonly (infer Item)[] ? DeepPartial<Item>[] : T extends object ? {
|
|
26
27
|
[K in keyof T]?: DeepPartial<T[K]>;
|
|
@@ -35,8 +36,9 @@ export declare const foundedYearDigits: (raw: string) => string;
|
|
|
35
36
|
* business step and Me's business editor, which each built it by hand and
|
|
36
37
|
* cleaned the team size two ways. Text trimmed, the website made a link
|
|
37
38
|
* (`normalizeLinkUrl`), digits kept (`teamSizeDigits`, `foundedYearDigits`);
|
|
38
|
-
* an empty optional answer is ABSENT
|
|
39
|
-
* left missing, so `ventureSchema` refuses it under
|
|
39
|
+
* an empty optional answer is ABSENT (no roles picked: no `roles`). A missing
|
|
40
|
+
* name, industry or stage is left missing, so `ventureSchema` refuses it under
|
|
41
|
+
* its field.
|
|
40
42
|
*/
|
|
41
43
|
export declare function ventureBodyFrom(v: {
|
|
42
44
|
name: string;
|
|
@@ -45,12 +47,14 @@ export declare function ventureBodyFrom(v: {
|
|
|
45
47
|
stage: StartupStage | null;
|
|
46
48
|
teamSize: string;
|
|
47
49
|
tagline?: string;
|
|
50
|
+
roles?: readonly VentureRole[];
|
|
48
51
|
foundedYear?: string;
|
|
49
52
|
}): {
|
|
50
53
|
name: string;
|
|
51
54
|
industry: Industry | undefined;
|
|
52
55
|
stage: StartupStage | undefined;
|
|
53
56
|
tagline?: string;
|
|
57
|
+
roles?: VentureRole[];
|
|
54
58
|
website?: string;
|
|
55
59
|
teamSize?: number;
|
|
56
60
|
foundedYear?: number;
|
|
@@ -65,13 +69,13 @@ export type CompleteOnboardingBodyCandidate = DeepPartial<CompleteOnboardingBody
|
|
|
65
69
|
export declare function emptyOnboardingForm(): OnboardingForm;
|
|
66
70
|
/**
|
|
67
71
|
* True when the member has started describing a business: any of the
|
|
68
|
-
* venture's own answers
|
|
69
|
-
*
|
|
72
|
+
* venture's own answers (its description and the member's roles included,
|
|
73
|
+
* 2026-11-22). Then it is sent, and the schema asks for its name, industry
|
|
74
|
+
* and stage: a role picked alone is refused under those, never dropped.
|
|
70
75
|
*
|
|
71
|
-
* The
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
* without a word (hary's ruling).
|
|
76
|
+
* The registration does not start it: it DESCRIBES a business. Picked without
|
|
77
|
+
* one, it is sent anyway and refused on its own field (`ventureRequired`: add
|
|
78
|
+
* the business, or clear this), never dropped without a word (hary's ruling).
|
|
75
79
|
*/
|
|
76
80
|
export declare function ventureStarted(form: Pick<OnboardingForm, 'venture'>): boolean;
|
|
77
81
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onboarding-answers.d.ts","sourceRoot":"","sources":["../../../src/domains/onboarding/onboarding-answers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EACL,KAAK,QAAQ,EAGb,KAAK,YAAY,EAElB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,KAAK,KAAK,EAAe,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EACL,KAAK,2BAA2B,EAIhC,KAAK,cAAc,EACnB,KAAK,iBAAiB,EAGvB,MAAM,iBAAiB,CAAC;AAEzB,KAAK,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,CAAC,MAAM,IAAI,CAAC,EAAE,GACnD,WAAW,CAAC,IAAI,CAAC,EAAE,GACnB,CAAC,SAAS,MAAM,GACd;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GACtC,CAAC,CAAC;AAER;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,KAAK,MAAM,KAAG,MACkB,CAAC;AAEnE
|
|
1
|
+
{"version":3,"file":"onboarding-answers.d.ts","sourceRoot":"","sources":["../../../src/domains/onboarding/onboarding-answers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EACL,KAAK,QAAQ,EAGb,KAAK,YAAY,EAElB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,KAAK,KAAK,EAAe,MAAM,sBAAsB,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EACL,KAAK,2BAA2B,EAIhC,KAAK,cAAc,EACnB,KAAK,iBAAiB,EAGvB,MAAM,iBAAiB,CAAC;AAEzB,KAAK,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,CA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AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,GAAG,OAAO,CAE5D;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,cAAc,EACpB,GAAG,EAAE,iBAAiB,GACrB,OAAO,CAAC,cAAc,CAAC,CAKzB;AAWD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,cAAc,GAAG,+BAA+B,CA+BhG"}
|
|
@@ -33,11 +33,13 @@ export const foundedYearDigits = (raw) => raw.replace(/\D/g, '').slice(0, String
|
|
|
33
33
|
* business step and Me's business editor, which each built it by hand and
|
|
34
34
|
* cleaned the team size two ways. Text trimmed, the website made a link
|
|
35
35
|
* (`normalizeLinkUrl`), digits kept (`teamSizeDigits`, `foundedYearDigits`);
|
|
36
|
-
* an empty optional answer is ABSENT
|
|
37
|
-
* left missing, so `ventureSchema` refuses it under
|
|
36
|
+
* an empty optional answer is ABSENT (no roles picked: no `roles`). A missing
|
|
37
|
+
* name, industry or stage is left missing, so `ventureSchema` refuses it under
|
|
38
|
+
* its field.
|
|
38
39
|
*/
|
|
39
40
|
export function ventureBodyFrom(v) {
|
|
40
41
|
const tagline = v.tagline?.trim();
|
|
42
|
+
const roles = v.roles?.length ? [...v.roles] : undefined;
|
|
41
43
|
const website = normalizeLinkUrl(v.website);
|
|
42
44
|
const teamSize = teamSizeDigits(v.teamSize);
|
|
43
45
|
const foundedYear = foundedYearDigits(v.foundedYear ?? '');
|
|
@@ -46,6 +48,7 @@ export function ventureBodyFrom(v) {
|
|
|
46
48
|
industry: v.industry ?? undefined,
|
|
47
49
|
stage: v.stage ?? undefined,
|
|
48
50
|
...(tagline ? { tagline } : {}),
|
|
51
|
+
...(roles ? { roles } : {}),
|
|
49
52
|
...(website ? { website } : {}),
|
|
50
53
|
...(teamSize ? { teamSize: Number(teamSize) } : {}),
|
|
51
54
|
...(foundedYear ? { foundedYear: Number(foundedYear) } : {}),
|
|
@@ -57,17 +60,23 @@ export function emptyOnboardingForm() {
|
|
|
57
60
|
}
|
|
58
61
|
/**
|
|
59
62
|
* True when the member has started describing a business: any of the
|
|
60
|
-
* venture's own answers
|
|
61
|
-
*
|
|
63
|
+
* venture's own answers (its description and the member's roles included,
|
|
64
|
+
* 2026-11-22). Then it is sent, and the schema asks for its name, industry
|
|
65
|
+
* and stage: a role picked alone is refused under those, never dropped.
|
|
62
66
|
*
|
|
63
|
-
* The
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* without a word (hary's ruling).
|
|
67
|
+
* The registration does not start it: it DESCRIBES a business. Picked without
|
|
68
|
+
* one, it is sent anyway and refused on its own field (`ventureRequired`: add
|
|
69
|
+
* the business, or clear this), never dropped without a word (hary's ruling).
|
|
67
70
|
*/
|
|
68
71
|
export function ventureStarted(form) {
|
|
69
72
|
const v = form.venture;
|
|
70
|
-
return Boolean(v.name.trim() ||
|
|
73
|
+
return Boolean(v.name.trim() ||
|
|
74
|
+
v.tagline.trim() ||
|
|
75
|
+
v.roles.length ||
|
|
76
|
+
v.website.trim() ||
|
|
77
|
+
v.industry ||
|
|
78
|
+
v.stage ||
|
|
79
|
+
v.teamSize.trim());
|
|
71
80
|
}
|
|
72
81
|
/**
|
|
73
82
|
* True when a place has been given (0.19.0). The drawer hands back only a
|
|
@@ -112,8 +121,6 @@ function copyField(to, from, key) {
|
|
|
112
121
|
* refused there, under the field.
|
|
113
122
|
*/
|
|
114
123
|
export function completeOnboardingBodyFrom(form) {
|
|
115
|
-
const headline = form.headline.trim();
|
|
116
|
-
const about = form.about.trim();
|
|
117
124
|
const links = {};
|
|
118
125
|
for (const k of Object.keys(form.links)) {
|
|
119
126
|
const url = normalizeLinkUrl(form.links[k]);
|
|
@@ -132,24 +139,16 @@ export function completeOnboardingBodyFrom(form) {
|
|
|
132
139
|
// consent to this one.
|
|
133
140
|
guidelinesVersion: form.guidelinesVersion === GUIDELINES_VERSION ? GUIDELINES_VERSION : undefined,
|
|
134
141
|
};
|
|
135
|
-
if (headline)
|
|
136
|
-
body.headline = headline;
|
|
137
|
-
if (about)
|
|
138
|
-
body.about = about;
|
|
139
142
|
if (form.avatarMediaId)
|
|
140
143
|
body.avatarMediaId = form.avatarMediaId;
|
|
141
|
-
if (form.skills.length)
|
|
142
|
-
body.skills = form.skills;
|
|
143
144
|
if (Object.keys(links).length)
|
|
144
145
|
body.links = links;
|
|
145
146
|
if (form.location)
|
|
146
147
|
body.location = pickOfPlace(form.location);
|
|
147
148
|
if (ventureStarted(form))
|
|
148
149
|
body.venture = ventureBodyFrom(form.venture);
|
|
149
|
-
// Sent whenever given: with a business
|
|
150
|
-
// schema refuses
|
|
151
|
-
if (form.businessType)
|
|
152
|
-
body.businessType = form.businessType;
|
|
150
|
+
// Sent whenever given: with a business it describes it, without one the
|
|
151
|
+
// schema refuses it on its own field rather than it vanishing.
|
|
153
152
|
if (form.legalStructure)
|
|
154
153
|
body.legalStructure = form.legalStructure;
|
|
155
154
|
return body;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onboarding-answers.js","sourceRoot":"","sources":["../../../src/domains/onboarding/onboarding-answers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAEL,gBAAgB,EAChB,cAAc,EAEd,YAAY,GACb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAc,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAEL,wBAAwB,EACxB,kBAAkB,EAClB,oBAAoB,EAGpB,mBAAmB,EACnB,cAAc,GACf,MAAM,iBAAiB,CAAC;AAQzB;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,GAAW,EAAU,EAAE,CACvD,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,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GAAG,IAAI,CAAC,YAAY,CAAC;IAC7D,IAAI,IAAI,CAAC,cAAc;QAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;IAEnE,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["/**\n * founder-schema — From a member's onboarding answers to what is sent (0.17.0)\n *\n * The answers are an `OnboardingForm` (the in-progress shape: raw text, `null`\n * for a choice not made). Two things are built from them, and until 0.17.0\n * each client built them by hand, so a second client (the app) would have had\n * to copy every rule below and keep it in step:\n *\n * the draft a step SAVES exactly the fields that step owns, as typed\n * (`onboardingDraftForStep`)\n * the body FINISH sends completed answers only, cleaned, every\n * unanswered optional field ABSENT\n * (`completeOnboardingBodyFrom`)\n *\n * Neither validates: `ONBOARDING_STEP_SCHEMAS` and `completeOnboardingBodySchema`\n * do, on what these build. A half-filled form builds a half-filled body on\n * purpose, so the schema refuses it with the reason under each field instead\n * of a builder hiding the gap.\n *\n * @module founder-schema/domains/onboarding/onboarding-answers\n */\n\nimport {\n type Industry,\n normalizeLinkUrl,\n normalizePhone,\n type StartupStage,\n tidyFullName,\n} from '../../core/common.js';\nimport { FOUNDED_YEAR_MIN } from '../../core/limits.js';\nimport { type Place, pickOfPlace } from '../location/areas.js';\nimport {\n type CompleteOnboardingBodyInput,\n FOUNDER_ONBOARDING_STEPS,\n GUIDELINES_VERSION,\n ONBOARDING_STEP_KEYS,\n type OnboardingForm,\n type OnboardingStepKey,\n readOnboardingDraft,\n teamSizeDigits,\n} from './onboarding.js';\n\ntype DeepPartial<T> = T extends readonly (infer Item)[]\n ? DeepPartial<Item>[]\n : T extends object\n ? { [K in keyof T]?: DeepPartial<T[K]> }\n : T;\n\n/**\n * A founding year as typed, kept to digits, as many as a year has (0.18.0,\n * moved from the web's Me editor beside `teamSizeDigits`).\n */\nexport const foundedYearDigits = (raw: string): string =>\n raw.replace(/\\D/g, '').slice(0, String(FOUNDED_YEAR_MIN).length);\n\n/**\n * A venture body from what was typed (0.18.0): ONE builder for onboarding's\n * business step and Me's business editor, which each built it by hand and\n * cleaned the team size two ways. Text trimmed, the website made a link\n * (`normalizeLinkUrl`), digits kept (`teamSizeDigits`, `foundedYearDigits`);\n * an empty optional answer is ABSENT. A missing name, industry or stage is\n * left missing, so `ventureSchema` refuses it under its field.\n */\nexport function ventureBodyFrom(v: {\n name: string;\n website: string;\n industry: Industry | null;\n stage: StartupStage | null;\n teamSize: string;\n tagline?: string;\n foundedYear?: string;\n}): {\n name: string;\n industry: Industry | undefined;\n stage: StartupStage | undefined;\n tagline?: string;\n website?: string;\n teamSize?: number;\n foundedYear?: number;\n} {\n const tagline = v.tagline?.trim();\n const website = normalizeLinkUrl(v.website);\n const teamSize = teamSizeDigits(v.teamSize);\n const foundedYear = foundedYearDigits(v.foundedYear ?? '');\n return {\n name: v.name.trim(),\n industry: v.industry ?? undefined,\n stage: v.stage ?? undefined,\n ...(tagline ? { tagline } : {}),\n ...(website ? { website } : {}),\n ...(teamSize ? { teamSize: Number(teamSize) } : {}),\n ...(foundedYear ? { foundedYear: Number(foundedYear) } : {}),\n };\n}\n\n/**\n * What `completeOnboardingBodyFrom` builds: the finish body's INPUT, any part\n * of it possibly still missing. Not a valid body until\n * `completeOnboardingBodySchema` says so.\n */\nexport type CompleteOnboardingBodyCandidate = DeepPartial<CompleteOnboardingBodyInput>;\n\n/** Answers with nothing filled in: what a new member starts from. */\nexport function emptyOnboardingForm(): OnboardingForm {\n return readOnboardingDraft({});\n}\n\n/**\n * True when the member has started describing a business: any of the\n * venture's own answers. Then it is sent, and the schema asks for its name,\n * industry and stage.\n *\n * The business type and the registration do not start it: they DESCRIBE a\n * business. Picked without one, each is sent anyway and refused on its own\n * field (`ventureRequired`: add the business, or clear this), never dropped\n * without a word (hary's ruling).\n */\nexport function ventureStarted(form: Pick<OnboardingForm, 'venture'>): boolean {\n const v = form.venture;\n return Boolean(v.name.trim() || v.website.trim() || v.industry || v.stage || v.teamSize.trim());\n}\n\n/**\n * True when a place has been given (0.19.0). The drawer hands back only a\n * whole place (state, district, and a locality or the whole district), so\n * there is no half answer: a place is there or it is not.\n */\nexport function locationStarted(place: Place | null): boolean {\n return place !== null;\n}\n\n/**\n * The draft one step saves: exactly the fields that step owns\n * (`FOUNDER_ONBOARDING_STEPS[].fields`, the same picks its validation uses),\n * as typed. Only the step's own fields, so a save can never overwrite another\n * step's answers (the server merges per field); raw, so a member who comes back\n * sees what they typed. The photo step's field is its upload id, which the\n * server holds rather than drafts.\n */\nexport function onboardingDraftForStep(\n form: OnboardingForm,\n key: OnboardingStepKey,\n): Partial<OnboardingForm> {\n const step = FOUNDER_ONBOARDING_STEPS[ONBOARDING_STEP_KEYS.indexOf(key)];\n const draft: Partial<OnboardingForm> = {};\n for (const field of step?.fields ?? []) copyField(draft, form, field);\n return draft;\n}\n\n/** One field across, typed by its key (0.18.0: the draft is the FORM's shape, never `unknown`). */\nfunction copyField<K extends keyof OnboardingForm>(\n to: Partial<OnboardingForm>,\n from: OnboardingForm,\n key: K,\n): void {\n to[key] = from[key];\n}\n\n/**\n * What Finish sends, and what every step is CHECKED as (each step's slice\n * reads its own fields from it).\n *\n * ⚠ ABSENT, NEVER A DEFAULT. The sibling gym product sent `bloodGroup ?? 'O+'`\n * and recorded everyone who skipped the question as O-positive. An optional\n * answer not given is left out; nothing is filled with a plausible value.\n *\n * Cleaned the way the schema reads it: the name tidied (`tidyFullName`), the\n * phone to ten digits (`normalizePhone`), links given their scheme\n * (`normalizeLinkUrl`), the place as its area ids (`pickOfPlace`, 0.19.0:\n * the server names it), the team size a number. A half-answered part is\n * SENT, not hidden: a business without its stage reaches the schema and is\n * refused there, under the field.\n */\nexport function completeOnboardingBodyFrom(form: OnboardingForm): CompleteOnboardingBodyCandidate {\n const headline = form.headline.trim();\n const about = form.about.trim();\n\n const links: Partial<Record<keyof OnboardingForm['links'], string>> = {};\n for (const k of Object.keys(form.links) as (keyof OnboardingForm['links'])[]) {\n const url = normalizeLinkUrl(form.links[k]);\n if (url) links[k] = url;\n }\n\n const body: CompleteOnboardingBodyCandidate = {\n fullName: tidyFullName(form.fullName),\n gender: form.gender ?? undefined,\n dateOfBirth: form.dateOfBirth.trim(),\n phone: normalizePhone(form.phone),\n goals: form.goals,\n interests: form.interests,\n // Only agreement to the CURRENT text is sent; anything else is absent, so\n // the schema refuses it as not agreed. Consent to an older text is not\n // consent to this one.\n guidelinesVersion:\n form.guidelinesVersion === GUIDELINES_VERSION ? GUIDELINES_VERSION : undefined,\n };\n if (headline) body.headline = headline;\n if (about) body.about = about;\n if (form.avatarMediaId) body.avatarMediaId = form.avatarMediaId;\n if (form.skills.length) body.skills = form.skills;\n if (Object.keys(links).length) body.links = links;\n\n if (form.location) body.location = pickOfPlace(form.location);\n\n if (ventureStarted(form)) body.venture = ventureBodyFrom(form.venture);\n // Sent whenever given: with a business they describe it, without one the\n // schema refuses each on its own field rather than anything vanishing.\n if (form.businessType) body.businessType = form.businessType;\n if (form.legalStructure) body.legalStructure = form.legalStructure;\n\n return body;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"onboarding-answers.js","sourceRoot":"","sources":["../../../src/domains/onboarding/onboarding-answers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAEL,gBAAgB,EAChB,cAAc,EAEd,YAAY,GACb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAc,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAE/D,OAAO,EAEL,wBAAwB,EACxB,kBAAkB,EAClB,oBAAoB,EAGpB,mBAAmB,EACnB,cAAc,GACf,MAAM,iBAAiB,CAAC;AAQzB;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,GAAW,EAAU,EAAE,CACvD,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,gBAAgB,CAAC,C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ourcesContent":["/**\n * founder-schema — From a member's onboarding answers to what is sent (0.17.0)\n *\n * The answers are an `OnboardingForm` (the in-progress shape: raw text, `null`\n * for a choice not made). Two things are built from them, and until 0.17.0\n * each client built them by hand, so a second client (the app) would have had\n * to copy every rule below and keep it in step:\n *\n * the draft a step SAVES exactly the fields that step owns, as typed\n * (`onboardingDraftForStep`)\n * the body FINISH sends completed answers only, cleaned, every\n * unanswered optional field ABSENT\n * (`completeOnboardingBodyFrom`)\n *\n * Neither validates: `ONBOARDING_STEP_SCHEMAS` and `completeOnboardingBodySchema`\n * do, on what these build. A half-filled form builds a half-filled body on\n * purpose, so the schema refuses it with the reason under each field instead\n * of a builder hiding the gap.\n *\n * @module founder-schema/domains/onboarding/onboarding-answers\n */\n\nimport {\n type Industry,\n normalizeLinkUrl,\n normalizePhone,\n type StartupStage,\n tidyFullName,\n} from '../../core/common.js';\nimport { FOUNDED_YEAR_MIN } from '../../core/limits.js';\nimport { type Place, pickOfPlace } from '../location/areas.js';\nimport type { VentureRole } from '../profile/founder-profile.js';\nimport {\n type CompleteOnboardingBodyInput,\n FOUNDER_ONBOARDING_STEPS,\n GUIDELINES_VERSION,\n ONBOARDING_STEP_KEYS,\n type OnboardingForm,\n type OnboardingStepKey,\n readOnboardingDraft,\n teamSizeDigits,\n} from './onboarding.js';\n\ntype DeepPartial<T> = T extends readonly (infer Item)[]\n ? DeepPartial<Item>[]\n : T extends object\n ? { [K in keyof T]?: DeepPartial<T[K]> }\n : T;\n\n/**\n * A founding year as typed, kept to digits, as many as a year has (0.18.0,\n * moved from the web's Me editor beside `teamSizeDigits`).\n */\nexport const foundedYearDigits = (raw: string): string =>\n raw.replace(/\\D/g, '').slice(0, String(FOUNDED_YEAR_MIN).length);\n\n/**\n * A venture body from what was typed (0.18.0): ONE builder for onboarding's\n * business step and Me's business editor, which each built it by hand and\n * cleaned the team size two ways. Text trimmed, the website made a link\n * (`normalizeLinkUrl`), digits kept (`teamSizeDigits`, `foundedYearDigits`);\n * an empty optional answer is ABSENT (no roles picked: no `roles`). A missing\n * name, industry or stage is left missing, so `ventureSchema` refuses it under\n * its field.\n */\nexport function ventureBodyFrom(v: {\n name: string;\n website: string;\n industry: Industry | null;\n stage: StartupStage | null;\n teamSize: string;\n tagline?: string;\n roles?: readonly VentureRole[];\n foundedYear?: string;\n}): {\n name: string;\n industry: Industry | undefined;\n stage: StartupStage | undefined;\n tagline?: string;\n roles?: VentureRole[];\n website?: string;\n teamSize?: number;\n foundedYear?: number;\n} {\n const tagline = v.tagline?.trim();\n const roles = v.roles?.length ? [...v.roles] : undefined;\n const website = normalizeLinkUrl(v.website);\n const teamSize = teamSizeDigits(v.teamSize);\n const foundedYear = foundedYearDigits(v.foundedYear ?? '');\n return {\n name: v.name.trim(),\n industry: v.industry ?? undefined,\n stage: v.stage ?? undefined,\n ...(tagline ? { tagline } : {}),\n ...(roles ? { roles } : {}),\n ...(website ? { website } : {}),\n ...(teamSize ? { teamSize: Number(teamSize) } : {}),\n ...(foundedYear ? { foundedYear: Number(foundedYear) } : {}),\n };\n}\n\n/**\n * What `completeOnboardingBodyFrom` builds: the finish body's INPUT, any part\n * of it possibly still missing. Not a valid body until\n * `completeOnboardingBodySchema` says so.\n */\nexport type CompleteOnboardingBodyCandidate = DeepPartial<CompleteOnboardingBodyInput>;\n\n/** Answers with nothing filled in: what a new member starts from. */\nexport function emptyOnboardingForm(): OnboardingForm {\n return readOnboardingDraft({});\n}\n\n/**\n * True when the member has started describing a business: any of the\n * venture's own answers (its description and the member's roles included,\n * 2026-11-22). Then it is sent, and the schema asks for its name, industry\n * and stage: a role picked alone is refused under those, never dropped.\n *\n * The registration does not start it: it DESCRIBES a business. Picked without\n * one, it is sent anyway and refused on its own field (`ventureRequired`: add\n * the business, or clear this), never dropped without a word (hary's ruling).\n */\nexport function ventureStarted(form: Pick<OnboardingForm, 'venture'>): boolean {\n const v = form.venture;\n return Boolean(\n v.name.trim() ||\n v.tagline.trim() ||\n v.roles.length ||\n v.website.trim() ||\n v.industry ||\n v.stage ||\n v.teamSize.trim(),\n );\n}\n\n/**\n * True when a place has been given (0.19.0). The drawer hands back only a\n * whole place (state, district, and a locality or the whole district), so\n * there is no half answer: a place is there or it is not.\n */\nexport function locationStarted(place: Place | null): boolean {\n return place !== null;\n}\n\n/**\n * The draft one step saves: exactly the fields that step owns\n * (`FOUNDER_ONBOARDING_STEPS[].fields`, the same picks its validation uses),\n * as typed. Only the step's own fields, so a save can never overwrite another\n * step's answers (the server merges per field); raw, so a member who comes back\n * sees what they typed. The photo step's field is its upload id, which the\n * server holds rather than drafts.\n */\nexport function onboardingDraftForStep(\n form: OnboardingForm,\n key: OnboardingStepKey,\n): Partial<OnboardingForm> {\n const step = FOUNDER_ONBOARDING_STEPS[ONBOARDING_STEP_KEYS.indexOf(key)];\n const draft: Partial<OnboardingForm> = {};\n for (const field of step?.fields ?? []) copyField(draft, form, field);\n return draft;\n}\n\n/** One field across, typed by its key (0.18.0: the draft is the FORM's shape, never `unknown`). */\nfunction copyField<K extends keyof OnboardingForm>(\n to: Partial<OnboardingForm>,\n from: OnboardingForm,\n key: K,\n): void {\n to[key] = from[key];\n}\n\n/**\n * What Finish sends, and what every step is CHECKED as (each step's slice\n * reads its own fields from it).\n *\n * ⚠ ABSENT, NEVER A DEFAULT. The sibling gym product sent `bloodGroup ?? 'O+'`\n * and recorded everyone who skipped the question as O-positive. An optional\n * answer not given is left out; nothing is filled with a plausible value.\n *\n * Cleaned the way the schema reads it: the name tidied (`tidyFullName`), the\n * phone to ten digits (`normalizePhone`), links given their scheme\n * (`normalizeLinkUrl`), the place as its area ids (`pickOfPlace`, 0.19.0:\n * the server names it), the team size a number. A half-answered part is\n * SENT, not hidden: a business without its stage reaches the schema and is\n * refused there, under the field.\n */\nexport function completeOnboardingBodyFrom(form: OnboardingForm): CompleteOnboardingBodyCandidate {\n const links: Partial<Record<keyof OnboardingForm['links'], string>> = {};\n for (const k of Object.keys(form.links) as (keyof OnboardingForm['links'])[]) {\n const url = normalizeLinkUrl(form.links[k]);\n if (url) links[k] = url;\n }\n\n const body: CompleteOnboardingBodyCandidate = {\n fullName: tidyFullName(form.fullName),\n gender: form.gender ?? undefined,\n dateOfBirth: form.dateOfBirth.trim(),\n phone: normalizePhone(form.phone),\n goals: form.goals,\n interests: form.interests,\n // Only agreement to the CURRENT text is sent; anything else is absent, so\n // the schema refuses it as not agreed. Consent to an older text is not\n // consent to this one.\n guidelinesVersion:\n form.guidelinesVersion === GUIDELINES_VERSION ? GUIDELINES_VERSION : undefined,\n };\n if (form.avatarMediaId) body.avatarMediaId = form.avatarMediaId;\n if (Object.keys(links).length) body.links = links;\n\n if (form.location) body.location = pickOfPlace(form.location);\n\n if (ventureStarted(form)) body.venture = ventureBodyFrom(form.venture);\n // Sent whenever given: with a business it describes it, without one the\n // schema refuses it on its own field rather than it vanishing.\n if (form.legalStructure) body.legalStructure = form.legalStructure;\n\n return body;\n}\n"]}
|