founder-schema 0.17.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +125 -17
- package/dist/access/access.d.ts +1 -1
- package/dist/access/access.d.ts.map +1 -1
- package/dist/access/access.js +4 -1
- package/dist/access/access.js.map +1 -1
- package/dist/access/permissions.d.ts +27 -29
- package/dist/access/permissions.d.ts.map +1 -1
- package/dist/access/permissions.js +39 -3
- package/dist/access/permissions.js.map +1 -1
- package/dist/core/common.d.ts +47 -10
- package/dist/core/common.d.ts.map +1 -1
- package/dist/core/common.js +42 -13
- package/dist/core/common.js.map +1 -1
- package/dist/core/errors.d.ts +7 -5
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +17 -11
- package/dist/core/errors.js.map +1 -1
- package/dist/core/limits.d.ts +48 -17
- package/dist/core/limits.d.ts.map +1 -1
- package/dist/core/limits.js +52 -22
- package/dist/core/limits.js.map +1 -1
- package/dist/core/money.d.ts +33 -0
- package/dist/core/money.d.ts.map +1 -0
- package/dist/core/money.js +36 -0
- package/dist/core/money.js.map +1 -0
- package/dist/core/responses.d.ts +14 -4
- package/dist/core/responses.d.ts.map +1 -1
- package/dist/core/responses.js.map +1 -1
- package/dist/core/validation.d.ts +6 -2
- package/dist/core/validation.d.ts.map +1 -1
- package/dist/core/validation.js +6 -2
- package/dist/core/validation.js.map +1 -1
- package/dist/domains/billing/billing.d.ts +61 -8
- package/dist/domains/billing/billing.d.ts.map +1 -1
- package/dist/domains/billing/billing.js +58 -22
- package/dist/domains/billing/billing.js.map +1 -1
- package/dist/domains/billing/gst.d.ts.map +1 -1
- package/dist/domains/billing/gst.js +4 -3
- package/dist/domains/billing/gst.js.map +1 -1
- package/dist/domains/chat/chat.d.ts +0 -21
- package/dist/domains/chat/chat.d.ts.map +1 -1
- package/dist/domains/chat/chat.js +0 -20
- package/dist/domains/chat/chat.js.map +1 -1
- package/dist/domains/communities/communities.d.ts +30 -12
- package/dist/domains/communities/communities.d.ts.map +1 -1
- package/dist/domains/communities/communities.js +43 -15
- package/dist/domains/communities/communities.js.map +1 -1
- package/dist/domains/contributions/contributions.d.ts +1 -1
- package/dist/domains/contributions/contributions.js +1 -1
- package/dist/domains/contributions/contributions.js.map +1 -1
- package/dist/domains/dashboard/dashboard.d.ts +3 -1
- package/dist/domains/dashboard/dashboard.d.ts.map +1 -1
- package/dist/domains/dashboard/dashboard.js +23 -7
- package/dist/domains/dashboard/dashboard.js.map +1 -1
- package/dist/domains/discover/discover.d.ts +8 -8
- package/dist/domains/feed/feed.d.ts +55 -153
- package/dist/domains/feed/feed.d.ts.map +1 -1
- package/dist/domains/feed/feed.js +53 -58
- package/dist/domains/feed/feed.js.map +1 -1
- package/dist/domains/location/india.d.ts +14 -4
- package/dist/domains/location/india.d.ts.map +1 -1
- package/dist/domains/location/india.js +36 -8
- package/dist/domains/location/india.js.map +1 -1
- package/dist/domains/members/members.d.ts +2 -2
- package/dist/domains/membership/membership.d.ts +26 -0
- package/dist/domains/membership/membership.d.ts.map +1 -1
- package/dist/domains/membership/membership.js +55 -1
- package/dist/domains/membership/membership.js.map +1 -1
- package/dist/domains/moderation/moderation.d.ts +2 -2
- package/dist/domains/moderation/moderation.js +3 -3
- package/dist/domains/moderation/moderation.js.map +1 -1
- package/dist/domains/notifications/notifications.d.ts +1 -10
- package/dist/domains/notifications/notifications.d.ts.map +1 -1
- package/dist/domains/notifications/notifications.js +2 -3
- package/dist/domains/notifications/notifications.js.map +1 -1
- package/dist/domains/onboarding/onboarding-answers.d.ts +33 -2
- package/dist/domains/onboarding/onboarding-answers.d.ts.map +1 -1
- package/dist/domains/onboarding/onboarding-answers.js +38 -15
- package/dist/domains/onboarding/onboarding-answers.js.map +1 -1
- package/dist/domains/onboarding/onboarding.d.ts +229 -57
- package/dist/domains/onboarding/onboarding.d.ts.map +1 -1
- package/dist/domains/onboarding/onboarding.js +34 -41
- package/dist/domains/onboarding/onboarding.js.map +1 -1
- package/dist/domains/products/products.d.ts +43 -8
- package/dist/domains/products/products.d.ts.map +1 -1
- package/dist/domains/products/products.js +57 -11
- package/dist/domains/products/products.js.map +1 -1
- package/dist/domains/profile/founder-profile.d.ts +68 -104
- package/dist/domains/profile/founder-profile.d.ts.map +1 -1
- package/dist/domains/profile/founder-profile.js +66 -32
- package/dist/domains/profile/founder-profile.js.map +1 -1
- package/dist/domains/profile/my-profile.d.ts +3 -3
- package/dist/domains/reviews/reviews.d.ts +1 -1
- package/dist/domains/reviews/reviews.d.ts.map +1 -1
- package/dist/domains/reviews/reviews.js +2 -2
- package/dist/domains/reviews/reviews.js.map +1 -1
- package/dist/domains/support/support.d.ts +22 -3
- package/dist/domains/support/support.d.ts.map +1 -1
- package/dist/domains/support/support.js +19 -5
- package/dist/domains/support/support.js.map +1 -1
- package/dist/domains/team/team.d.ts.map +1 -1
- package/dist/domains/team/team.js +3 -6
- package/dist/domains/team/team.js.map +1 -1
- package/dist/domains/uploads/uploads.d.ts +7 -22
- package/dist/domains/uploads/uploads.d.ts.map +1 -1
- package/dist/domains/uploads/uploads.js +7 -21
- package/dist/domains/uploads/uploads.js.map +1 -1
- package/dist/env.d.ts +26 -13
- package/dist/env.d.ts.map +1 -1
- package/dist/env.js +58 -23
- package/dist/env.js.map +1 -1
- package/dist/index.d.ts +18 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -38,6 +38,16 @@ import { type Goal } from '../../core/common.js';
|
|
|
38
38
|
export declare const MIN_AGE_YEARS = 18;
|
|
39
39
|
/** A sanity ceiling, not a product rule. Catches a mistyped year. */
|
|
40
40
|
export declare const MAX_AGE_YEARS = 120;
|
|
41
|
+
/**
|
|
42
|
+
* Whole years completed, by the calendar.
|
|
43
|
+
*
|
|
44
|
+
* ⚠️ NOT `elapsedMs / (365.25 * day)`, which is what the sibling product uses.
|
|
45
|
+
* That approximation reads 17.9986 at the start of somebody's eighteenth
|
|
46
|
+
* birthday and only crosses 18 about halfway through the day, so it refuses
|
|
47
|
+
* them for the half of their birthday they are most likely to be signing up on.
|
|
48
|
+
* Measured: it disagrees with the calendar on all 400 of the next 400 days.
|
|
49
|
+
* An age gate is exactly the place an approximation is not good enough.
|
|
50
|
+
*/
|
|
41
51
|
export declare function ageInYears(isoDate: string, now?: Date): number;
|
|
42
52
|
/** A calendar date with no time component, `YYYY-MM-DD`. */
|
|
43
53
|
export declare const isoDateSchema: z.ZodString;
|
|
@@ -454,6 +464,12 @@ export declare const teamSizeDigits: (raw: string) => string;
|
|
|
454
464
|
* one, wrote it, and the server stores values opaquely. Read it with
|
|
455
465
|
* `readOnboardingDraft`, never by casting.
|
|
456
466
|
*/
|
|
467
|
+
/** Longest date of birth an answer may be: `YYYY-MM-DD` (0.18.0: exported; the form and the draft reader use it). */
|
|
468
|
+
export declare const DATE_INPUT_MAX = 10;
|
|
469
|
+
/** Longest phone number an answer may be, as typed with spaces and a `+91`. */
|
|
470
|
+
export declare const PHONE_INPUT_MAX = 20;
|
|
471
|
+
/** Longest guidelines version an answer may carry (`GUIDELINES_VERSION` is a date). */
|
|
472
|
+
export declare const GUIDELINES_VERSION_MAX = 32;
|
|
457
473
|
export declare const onboardingFormSchema: z.ZodObject<{
|
|
458
474
|
displayName: z.ZodString;
|
|
459
475
|
gender: z.ZodNullable<z.ZodEnum<{
|
|
@@ -696,8 +712,8 @@ export declare const completeOnboardingBodySchema: z.ZodObject<{
|
|
|
696
712
|
prefer_not_to_say: "prefer_not_to_say";
|
|
697
713
|
}>;
|
|
698
714
|
dateOfBirth: z.ZodString;
|
|
699
|
-
headline: z.
|
|
700
|
-
about: z.
|
|
715
|
+
headline: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string | undefined, string>>>;
|
|
716
|
+
about: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string | undefined, string>>>;
|
|
701
717
|
avatarMediaId: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
702
718
|
phone: z.ZodString;
|
|
703
719
|
links: z.ZodOptional<z.ZodObject<{
|
|
@@ -707,7 +723,7 @@ export declare const completeOnboardingBodySchema: z.ZodObject<{
|
|
|
707
723
|
}, z.core.$strip>>;
|
|
708
724
|
location: z.ZodOptional<z.ZodObject<{
|
|
709
725
|
city: z.ZodString;
|
|
710
|
-
state: z.
|
|
726
|
+
state: z.ZodPipe<z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<string, string>>, z.ZodEnum<{
|
|
711
727
|
"Jammu and Kashmir": "Jammu and Kashmir";
|
|
712
728
|
"Himachal Pradesh": "Himachal Pradesh";
|
|
713
729
|
Punjab: "Punjab";
|
|
@@ -744,7 +760,7 @@ export declare const completeOnboardingBodySchema: z.ZodObject<{
|
|
|
744
760
|
Telangana: "Telangana";
|
|
745
761
|
"Andhra Pradesh": "Andhra Pradesh";
|
|
746
762
|
Ladakh: "Ladakh";
|
|
747
|
-
}
|
|
763
|
+
}>>;
|
|
748
764
|
country: z.ZodLiteral<"India">;
|
|
749
765
|
}, z.core.$strip>>;
|
|
750
766
|
goals: z.ZodArray<z.ZodEnum<{
|
|
@@ -857,7 +873,7 @@ export declare const completeOnboardingBodySchema: z.ZodObject<{
|
|
|
857
873
|
community: "community";
|
|
858
874
|
}>>>;
|
|
859
875
|
venture: z.ZodOptional<z.ZodObject<{
|
|
860
|
-
tagline: z.
|
|
876
|
+
tagline: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string | undefined, string>>>;
|
|
861
877
|
name: z.ZodString;
|
|
862
878
|
industry: z.ZodEnum<{
|
|
863
879
|
agritech: "agritech";
|
|
@@ -952,8 +968,8 @@ export declare const ONBOARDING_STEP_SCHEMAS: {
|
|
|
952
968
|
avatarMediaId: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
953
969
|
}, z.core.$strip>;
|
|
954
970
|
readonly professional: z.ZodObject<{
|
|
955
|
-
about: z.
|
|
956
|
-
headline: z.
|
|
971
|
+
about: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string | undefined, string>>>;
|
|
972
|
+
headline: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string | undefined, string>>>;
|
|
957
973
|
skills: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
958
974
|
engineering: "engineering";
|
|
959
975
|
product: "product";
|
|
@@ -983,7 +999,7 @@ export declare const ONBOARDING_STEP_SCHEMAS: {
|
|
|
983
999
|
readonly location: z.ZodObject<{
|
|
984
1000
|
location: z.ZodOptional<z.ZodObject<{
|
|
985
1001
|
city: z.ZodString;
|
|
986
|
-
state: z.
|
|
1002
|
+
state: z.ZodPipe<z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<string, string>>, z.ZodEnum<{
|
|
987
1003
|
"Jammu and Kashmir": "Jammu and Kashmir";
|
|
988
1004
|
"Himachal Pradesh": "Himachal Pradesh";
|
|
989
1005
|
Punjab: "Punjab";
|
|
@@ -1020,7 +1036,7 @@ export declare const ONBOARDING_STEP_SCHEMAS: {
|
|
|
1020
1036
|
Telangana: "Telangana";
|
|
1021
1037
|
"Andhra Pradesh": "Andhra Pradesh";
|
|
1022
1038
|
Ladakh: "Ladakh";
|
|
1023
|
-
}
|
|
1039
|
+
}>>;
|
|
1024
1040
|
country: z.ZodLiteral<"India">;
|
|
1025
1041
|
}, z.core.$strip>>;
|
|
1026
1042
|
}, z.core.$strip>;
|
|
@@ -1122,7 +1138,7 @@ export declare const ONBOARDING_STEP_SCHEMAS: {
|
|
|
1122
1138
|
}, z.core.$strip>;
|
|
1123
1139
|
readonly business: z.ZodObject<{
|
|
1124
1140
|
venture: z.ZodOptional<z.ZodObject<{
|
|
1125
|
-
tagline: z.
|
|
1141
|
+
tagline: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string | undefined, string>>>;
|
|
1126
1142
|
name: z.ZodString;
|
|
1127
1143
|
industry: z.ZodEnum<{
|
|
1128
1144
|
agritech: "agritech";
|
|
@@ -1227,7 +1243,7 @@ export declare const ONBOARDING_TOTAL_STEPS: number;
|
|
|
1227
1243
|
export declare const ONBOARDING_STEP_FIELDS: readonly (readonly OnboardingField[])[];
|
|
1228
1244
|
/** What finishing answers: the new profile's id and the handle derived for it. */
|
|
1229
1245
|
export declare const completeOnboardingResponseSchema: z.ZodObject<{
|
|
1230
|
-
id: z.ZodString
|
|
1246
|
+
id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
1231
1247
|
username: z.ZodString;
|
|
1232
1248
|
}, z.core.$strip>;
|
|
1233
1249
|
export type CompleteOnboardingResponse = z.infer<typeof completeOnboardingResponseSchema>;
|
|
@@ -1268,9 +1284,11 @@ export type OnboardingDraftKey = z.infer<typeof onboardingDraftKeySchema>;
|
|
|
1268
1284
|
* pair: one number is what lets a member start on the web and resume elsewhere,
|
|
1269
1285
|
* provided both ends agree on the encoding.
|
|
1270
1286
|
*
|
|
1271
|
-
*
|
|
1272
|
-
*
|
|
1273
|
-
*
|
|
1287
|
+
* What is READ BACK: the draft's KEYS come from the form, its VALUES are
|
|
1288
|
+
* opaque, since a stored draft may predate 0.18.0 (any JSON was stored then);
|
|
1289
|
+
* read it through `readOnboardingDraft`, never by casting. What is WRITTEN is
|
|
1290
|
+
* the form's own shape (`onboardingProgressUpdateSchema.draft`, 0.18.0), and
|
|
1291
|
+
* everything is re-validated strictly at finalize.
|
|
1274
1292
|
*
|
|
1275
1293
|
* `partialRecord`, not `record`: in Zod 4 an enum-keyed `z.record` demands
|
|
1276
1294
|
* every key, and a draft holds whichever steps the member has reached.
|
|
@@ -1294,57 +1312,211 @@ export declare const onboardingDraftSchema: z.ZodRecord<z.ZodEnum<{
|
|
|
1294
1312
|
guidelinesVersion: "guidelinesVersion";
|
|
1295
1313
|
}> & z.core.$partial, z.ZodUnknown>;
|
|
1296
1314
|
export type OnboardingDraft = z.infer<typeof onboardingDraftSchema>;
|
|
1297
|
-
export declare const onboardingProgressSchema: z.ZodObject<{
|
|
1298
|
-
step: z.ZodNumber;
|
|
1299
|
-
draft: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
1300
|
-
location: "location";
|
|
1301
|
-
about: "about";
|
|
1302
|
-
displayName: "displayName";
|
|
1303
|
-
headline: "headline";
|
|
1304
|
-
venture: "venture";
|
|
1305
|
-
skills: "skills";
|
|
1306
|
-
goals: "goals";
|
|
1307
|
-
links: "links";
|
|
1308
|
-
phone: "phone";
|
|
1309
|
-
gender: "gender";
|
|
1310
|
-
dateOfBirth: "dateOfBirth";
|
|
1311
|
-
interests: "interests";
|
|
1312
|
-
avatarMediaId: "avatarMediaId";
|
|
1313
|
-
businessType: "businessType";
|
|
1314
|
-
legalStructure: "legalStructure";
|
|
1315
|
-
guidelinesVersion: "guidelinesVersion";
|
|
1316
|
-
}> & z.core.$partial, z.ZodUnknown>>;
|
|
1317
|
-
}, z.core.$strip>;
|
|
1318
|
-
export type OnboardingProgress = z.infer<typeof onboardingProgressSchema>;
|
|
1319
1315
|
/**
|
|
1320
1316
|
* `PATCH` body: any subset of the cursor, merged server-side. No defaults.
|
|
1321
1317
|
* `step` may equal `ONBOARDING_TOTAL_STEPS`: "past the last step", which the
|
|
1322
1318
|
* client sends on its way to finish.
|
|
1323
1319
|
*
|
|
1324
|
-
* The
|
|
1325
|
-
*
|
|
1326
|
-
* upload, so it must be an upload id or `null` like the form's own field.
|
|
1320
|
+
* The photo step's `avatarMediaId` is not kept in the draft (0.17.0): it is
|
|
1321
|
+
* handed to the server, which holds that upload for the member.
|
|
1327
1322
|
*/
|
|
1328
1323
|
export declare const onboardingProgressUpdateSchema: z.ZodObject<{
|
|
1329
1324
|
step: z.ZodOptional<z.ZodNumber>;
|
|
1330
|
-
draft: z.ZodOptional<z.
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1325
|
+
draft: z.ZodOptional<z.ZodObject<{
|
|
1326
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
1327
|
+
gender: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
1328
|
+
other: "other";
|
|
1329
|
+
male: "male";
|
|
1330
|
+
female: "female";
|
|
1331
|
+
prefer_not_to_say: "prefer_not_to_say";
|
|
1332
|
+
}>>>;
|
|
1333
|
+
dateOfBirth: z.ZodOptional<z.ZodString>;
|
|
1334
|
+
headline: z.ZodOptional<z.ZodString>;
|
|
1335
|
+
about: z.ZodOptional<z.ZodString>;
|
|
1336
|
+
avatarMediaId: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
|
|
1337
|
+
skills: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
1338
|
+
engineering: "engineering";
|
|
1339
|
+
product: "product";
|
|
1340
|
+
design: "design";
|
|
1341
|
+
data: "data";
|
|
1342
|
+
growth: "growth";
|
|
1343
|
+
sales: "sales";
|
|
1344
|
+
marketing: "marketing";
|
|
1345
|
+
operations: "operations";
|
|
1346
|
+
finance: "finance";
|
|
1347
|
+
legal: "legal";
|
|
1348
|
+
hr_people: "hr_people";
|
|
1349
|
+
supply_chain: "supply_chain";
|
|
1350
|
+
research: "research";
|
|
1351
|
+
fundraising: "fundraising";
|
|
1352
|
+
community: "community";
|
|
1353
|
+
}>>>;
|
|
1354
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
1355
|
+
links: z.ZodOptional<z.ZodObject<{
|
|
1356
|
+
linkedin: z.ZodString;
|
|
1357
|
+
x: z.ZodString;
|
|
1358
|
+
instagram: z.ZodString;
|
|
1359
|
+
}, z.core.$strip>>;
|
|
1360
|
+
location: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1361
|
+
city: z.ZodString;
|
|
1362
|
+
state: z.ZodString;
|
|
1363
|
+
country: z.ZodString;
|
|
1364
|
+
}, z.core.$strip>>>;
|
|
1365
|
+
goals: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
1366
|
+
find_cofounder: "find_cofounder";
|
|
1367
|
+
find_investors: "find_investors";
|
|
1368
|
+
find_customers: "find_customers";
|
|
1369
|
+
hiring: "hiring";
|
|
1370
|
+
partnerships: "partnerships";
|
|
1371
|
+
mentorship: "mentorship";
|
|
1372
|
+
grow_network: "grow_network";
|
|
1373
|
+
business_ideas: "business_ideas";
|
|
1374
|
+
market_insights: "market_insights";
|
|
1375
|
+
learn_startup: "learn_startup";
|
|
1376
|
+
start_company: "start_company";
|
|
1377
|
+
get_feedback: "get_feedback";
|
|
1378
|
+
find_testers: "find_testers";
|
|
1379
|
+
mentor_others: "mentor_others";
|
|
1380
|
+
invest_in_startups: "invest_in_startups";
|
|
1381
|
+
join_startup: "join_startup";
|
|
1382
|
+
find_service_providers: "find_service_providers";
|
|
1383
|
+
attend_events: "attend_events";
|
|
1384
|
+
}>>>;
|
|
1385
|
+
interests: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
1386
|
+
ai_ml: "ai_ml";
|
|
1387
|
+
b2b_saas: "b2b_saas";
|
|
1388
|
+
d2c: "d2c";
|
|
1389
|
+
deeptech: "deeptech";
|
|
1390
|
+
robotics: "robotics";
|
|
1391
|
+
growth: "growth";
|
|
1392
|
+
sales: "sales";
|
|
1393
|
+
marketing: "marketing";
|
|
1394
|
+
supply_chain: "supply_chain";
|
|
1395
|
+
fundraising: "fundraising";
|
|
1396
|
+
social_enterprise: "social_enterprise";
|
|
1397
|
+
mentoring: "mentoring";
|
|
1398
|
+
leadership: "leadership";
|
|
1399
|
+
networking: "networking";
|
|
1400
|
+
public_speaking: "public_speaking";
|
|
1401
|
+
teaching: "teaching";
|
|
1402
|
+
hiring_talent: "hiring_talent";
|
|
1403
|
+
personal_branding: "personal_branding";
|
|
1404
|
+
career_transition: "career_transition";
|
|
1405
|
+
remote_work: "remote_work";
|
|
1406
|
+
blockchain: "blockchain";
|
|
1407
|
+
crypto_web3: "crypto_web3";
|
|
1408
|
+
data_science: "data_science";
|
|
1409
|
+
cybersecurity: "cybersecurity";
|
|
1410
|
+
game_dev: "game_dev";
|
|
1411
|
+
ux_design: "ux_design";
|
|
1412
|
+
app_development: "app_development";
|
|
1413
|
+
open_source: "open_source";
|
|
1414
|
+
electronics: "electronics";
|
|
1415
|
+
space_exploration: "space_exploration";
|
|
1416
|
+
green_tech: "green_tech";
|
|
1417
|
+
no_code: "no_code";
|
|
1418
|
+
entrepreneurship: "entrepreneurship";
|
|
1419
|
+
investing: "investing";
|
|
1420
|
+
stock_trading: "stock_trading";
|
|
1421
|
+
personal_finance: "personal_finance";
|
|
1422
|
+
consulting: "consulting";
|
|
1423
|
+
ecommerce: "ecommerce";
|
|
1424
|
+
retail: "retail";
|
|
1425
|
+
real_estate: "real_estate";
|
|
1426
|
+
product_management: "product_management";
|
|
1427
|
+
meditation: "meditation";
|
|
1428
|
+
journaling: "journaling";
|
|
1429
|
+
self_improvement: "self_improvement";
|
|
1430
|
+
productivity: "productivity";
|
|
1431
|
+
reading: "reading";
|
|
1432
|
+
online_courses: "online_courses";
|
|
1433
|
+
philosophy: "philosophy";
|
|
1434
|
+
psychology: "psychology";
|
|
1435
|
+
therapy: "therapy";
|
|
1436
|
+
sleep_optimization: "sleep_optimization";
|
|
1437
|
+
gym: "gym";
|
|
1438
|
+
yoga: "yoga";
|
|
1439
|
+
photography: "photography";
|
|
1440
|
+
writing: "writing";
|
|
1441
|
+
graphic_design: "graphic_design";
|
|
1442
|
+
filmmaking: "filmmaking";
|
|
1443
|
+
digital_art: "digital_art";
|
|
1444
|
+
content_creation: "content_creation";
|
|
1445
|
+
blogging: "blogging";
|
|
1446
|
+
vlogging: "vlogging";
|
|
1447
|
+
podcasts: "podcasts";
|
|
1448
|
+
animation: "animation";
|
|
1449
|
+
music_production: "music_production";
|
|
1450
|
+
volunteering: "volunteering";
|
|
1451
|
+
ngo_work: "ngo_work";
|
|
1452
|
+
environmental: "environmental";
|
|
1453
|
+
women_empowerment: "women_empowerment";
|
|
1454
|
+
community_service: "community_service";
|
|
1455
|
+
education_access: "education_access";
|
|
1456
|
+
}>>>;
|
|
1457
|
+
venture: z.ZodOptional<z.ZodObject<{
|
|
1458
|
+
name: z.ZodString;
|
|
1459
|
+
website: z.ZodString;
|
|
1460
|
+
industry: z.ZodNullable<z.ZodEnum<{
|
|
1461
|
+
agritech: "agritech";
|
|
1462
|
+
ai_ml: "ai_ml";
|
|
1463
|
+
b2b_saas: "b2b_saas";
|
|
1464
|
+
consumer: "consumer";
|
|
1465
|
+
climate: "climate";
|
|
1466
|
+
d2c: "d2c";
|
|
1467
|
+
deeptech: "deeptech";
|
|
1468
|
+
edtech: "edtech";
|
|
1469
|
+
fintech: "fintech";
|
|
1470
|
+
gaming: "gaming";
|
|
1471
|
+
healthtech: "healthtech";
|
|
1472
|
+
logistics: "logistics";
|
|
1473
|
+
manufacturing: "manufacturing";
|
|
1474
|
+
marketplace: "marketplace";
|
|
1475
|
+
media: "media";
|
|
1476
|
+
mobility: "mobility";
|
|
1477
|
+
proptech: "proptech";
|
|
1478
|
+
robotics: "robotics";
|
|
1479
|
+
services: "services";
|
|
1480
|
+
space: "space";
|
|
1481
|
+
other: "other";
|
|
1482
|
+
}>>;
|
|
1483
|
+
stage: z.ZodNullable<z.ZodEnum<{
|
|
1484
|
+
idea: "idea";
|
|
1485
|
+
validation: "validation";
|
|
1486
|
+
mvp: "mvp";
|
|
1487
|
+
pre_seed: "pre_seed";
|
|
1488
|
+
seed: "seed";
|
|
1489
|
+
series_a_plus: "series_a_plus";
|
|
1490
|
+
profitable: "profitable";
|
|
1491
|
+
exited: "exited";
|
|
1492
|
+
}>>;
|
|
1493
|
+
teamSize: z.ZodString;
|
|
1494
|
+
}, z.core.$strip>>;
|
|
1495
|
+
businessType: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
1496
|
+
startup: "startup";
|
|
1497
|
+
sme: "sme";
|
|
1498
|
+
enterprise: "enterprise";
|
|
1499
|
+
freelancer: "freelancer";
|
|
1500
|
+
agency: "agency";
|
|
1501
|
+
social_enterprise: "social_enterprise";
|
|
1502
|
+
family_business: "family_business";
|
|
1503
|
+
franchise: "franchise";
|
|
1504
|
+
}>>>;
|
|
1505
|
+
legalStructure: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
1506
|
+
not_registered: "not_registered";
|
|
1507
|
+
sole_proprietorship: "sole_proprietorship";
|
|
1508
|
+
partnership: "partnership";
|
|
1509
|
+
llp: "llp";
|
|
1510
|
+
opc: "opc";
|
|
1511
|
+
private_limited: "private_limited";
|
|
1512
|
+
public_limited: "public_limited";
|
|
1513
|
+
section_8: "section_8";
|
|
1514
|
+
trust_or_society: "trust_or_society";
|
|
1515
|
+
cooperative: "cooperative";
|
|
1516
|
+
registered_abroad: "registered_abroad";
|
|
1517
|
+
}>>>;
|
|
1518
|
+
guidelinesVersion: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1519
|
+
}, z.core.$strict>>;
|
|
1348
1520
|
}, z.core.$strip>;
|
|
1349
1521
|
export type OnboardingProgressUpdate = z.infer<typeof onboardingProgressUpdateSchema>;
|
|
1350
1522
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onboarding.d.ts","sourceRoot":"","sources":["../../../src/domains/onboarding/onboarding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,
|
|
1
|
+
{"version":3,"file":"onboarding.d.ts","sourceRoot":"","sources":["../../../src/domains/onboarding/onboarding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAYzC,CAAC;AACH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAEtF;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAYjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
* @module founder-schema/domains/onboarding
|
|
27
27
|
*/
|
|
28
28
|
import { z } from 'zod';
|
|
29
|
-
import { displayNameSchema, GENDER_VALUES, GOAL_VALUES, genderSchema,
|
|
30
|
-
import { ABOUT_MAX, CITY_MAX, COUNTRY_MAX,
|
|
29
|
+
import { displayNameSchema, eachOnce, GENDER_VALUES, GOAL_VALUES, genderSchema, goalSchema, INDUSTRY_VALUES, industrySchema, objectIdSchema, optionalTrimmedString, phoneSchema, requiredGoalListSchema, SKILL_VALUES, STARTUP_STAGE_VALUES, skillListSchema, skillSchema, startupStageSchema, usernameSchema, } from '../../core/common.js';
|
|
30
|
+
import { ABOUT_MAX, CITY_MAX, COUNTRY_MAX, DAY_MS, DISPLAY_NAME_MAX, HEADLINE_MAX, INDIA_UTC_OFFSET_MS, LINK_URL_MAX, SKILLS_MAX, STATE_MAX, TEAM_SIZE_MAX, VENTURE_NAME_MAX, } from '../../core/limits.js';
|
|
31
31
|
import { VALIDATION_MESSAGE } from '../../core/validation.js';
|
|
32
32
|
import { indiaLocationSchema } from '../location/india.js';
|
|
33
33
|
import { mediaImageSchema } from '../media/media.js';
|
|
@@ -54,8 +54,6 @@ export const MAX_AGE_YEARS = 120;
|
|
|
54
54
|
* Measured: it disagrees with the calendar on all 400 of the next 400 days.
|
|
55
55
|
* An age gate is exactly the place an approximation is not good enough.
|
|
56
56
|
*/
|
|
57
|
-
/** India Standard Time, UTC+05:30, with no daylight saving. */
|
|
58
|
-
const INDIA_OFFSET_MS = (5 * 60 + 30) * 60 * 1000;
|
|
59
57
|
export function ageInYears(isoDate, now = new Date()) {
|
|
60
58
|
// ⚠️ A STRING, `YYYY-MM-DD`, not a `Date`. This is a wire contract, so it
|
|
61
59
|
// takes the wire type. The backend is the obvious caller and the backend
|
|
@@ -69,7 +67,7 @@ export function ageInYears(isoDate, now = new Date()) {
|
|
|
69
67
|
// The date TODAY IS IN INDIA (0.13.0), where the members are: a birthday
|
|
70
68
|
// begins at midnight there, not five and a half hours later at UTC's
|
|
71
69
|
// midnight. India keeps one offset all year.
|
|
72
|
-
const today = new Date(now.getTime() +
|
|
70
|
+
const today = new Date(now.getTime() + INDIA_UTC_OFFSET_MS);
|
|
73
71
|
let age = today.getUTCFullYear() - y;
|
|
74
72
|
const monthNow = today.getUTCMonth() + 1;
|
|
75
73
|
if (monthNow < m || (monthNow === m && today.getUTCDate() < d))
|
|
@@ -98,7 +96,7 @@ export function isRealIsoDate(value) {
|
|
|
98
96
|
return isoDateSchema.safeParse(value).success && isRealDate(value.trim());
|
|
99
97
|
}
|
|
100
98
|
/** `YYYY-MM-DD` for a moment, counted in India's calendar. */
|
|
101
|
-
const isoInIndia = (moment) => new Date(moment +
|
|
99
|
+
const isoInIndia = (moment) => new Date(moment + INDIA_UTC_OFFSET_MS).toISOString().slice(0, 10);
|
|
102
100
|
/**
|
|
103
101
|
* Today in India, `YYYY-MM-DD` (0.17.0): the day every age here is counted
|
|
104
102
|
* from (`ageInYears`), so a client's "today" must be this one, never the
|
|
@@ -107,7 +105,6 @@ const isoInIndia = (moment) => new Date(moment + INDIA_OFFSET_MS).toISOString().
|
|
|
107
105
|
export function todayInIndia(now = new Date()) {
|
|
108
106
|
return isoInIndia(now.getTime());
|
|
109
107
|
}
|
|
110
|
-
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
111
108
|
const isoOfUtc = (ms) => new Date(ms).toISOString().slice(0, 10);
|
|
112
109
|
/**
|
|
113
110
|
* The dates of birth `dateOfBirthSchema` accepts TODAY, both ends included
|
|
@@ -494,7 +491,7 @@ export const interestsSchema = z
|
|
|
494
491
|
.array(topicSchema)
|
|
495
492
|
.min(INTERESTS_MIN)
|
|
496
493
|
.max(INTERESTS_MAX)
|
|
497
|
-
.refine(
|
|
494
|
+
.refine(eachOnce, {
|
|
498
495
|
error: VALIDATION_MESSAGE.topicsDuplicate,
|
|
499
496
|
});
|
|
500
497
|
// ─── The step keys ───────────────────────────────────────────────────────────
|
|
@@ -591,11 +588,17 @@ export const teamSizeDigits = (raw) => raw.replace(/\D/g, '').slice(0, TEAM_SIZE
|
|
|
591
588
|
* one, wrote it, and the server stores values opaquely. Read it with
|
|
592
589
|
* `readOnboardingDraft`, never by casting.
|
|
593
590
|
*/
|
|
591
|
+
/** Longest date of birth an answer may be: `YYYY-MM-DD` (0.18.0: exported; the form and the draft reader use it). */
|
|
592
|
+
export const DATE_INPUT_MAX = 10;
|
|
593
|
+
/** Longest phone number an answer may be, as typed with spaces and a `+91`. */
|
|
594
|
+
export const PHONE_INPUT_MAX = 20;
|
|
595
|
+
/** Longest guidelines version an answer may carry (`GUIDELINES_VERSION` is a date). */
|
|
596
|
+
export const GUIDELINES_VERSION_MAX = 32;
|
|
594
597
|
export const onboardingFormSchema = z.object({
|
|
595
598
|
displayName: z.string().max(DISPLAY_NAME_MAX),
|
|
596
599
|
gender: genderSchema.nullable(),
|
|
597
600
|
/** `YYYY-MM-DD` once complete; whatever has been typed until then. */
|
|
598
|
-
dateOfBirth: z.string(),
|
|
601
|
+
dateOfBirth: z.string().max(DATE_INPUT_MAX),
|
|
599
602
|
headline: z.string().max(HEADLINE_MAX),
|
|
600
603
|
about: z.string().max(ABOUT_MAX),
|
|
601
604
|
/**
|
|
@@ -613,7 +616,7 @@ export const onboardingFormSchema = z.object({
|
|
|
613
616
|
avatarMediaId: objectIdSchema.nullable(),
|
|
614
617
|
skills: z.array(skillSchema).max(SKILLS_MAX),
|
|
615
618
|
/** As typed; the finish body takes `phoneSchema`'s ten digits. */
|
|
616
|
-
phone: z.string(),
|
|
619
|
+
phone: z.string().max(PHONE_INPUT_MAX),
|
|
617
620
|
/** As typed; the finish body takes full `https://` URLs. */
|
|
618
621
|
links: z.object({
|
|
619
622
|
linkedin: z.string().max(LINK_URL_MAX),
|
|
@@ -645,13 +648,9 @@ export const onboardingFormSchema = z.object({
|
|
|
645
648
|
businessType: businessTypeSchema.nullable(),
|
|
646
649
|
legalStructure: legalStructureSchema.nullable(),
|
|
647
650
|
/** The guidelines text the member agreed to, or `null`. */
|
|
648
|
-
guidelinesVersion: z.string().nullable(),
|
|
651
|
+
guidelinesVersion: z.string().max(GUIDELINES_VERSION_MAX).nullable(),
|
|
649
652
|
});
|
|
650
653
|
// ─── Reading a stored draft back ─────────────────────────────────────────────
|
|
651
|
-
/** Longest date of birth worth keeping from a draft: `YYYY-MM-DD`. */
|
|
652
|
-
const DATE_INPUT_MAX = 10;
|
|
653
|
-
/** Longest phone number worth keeping from a draft, as typed with spaces. */
|
|
654
|
-
const PHONE_INPUT_MAX = 20;
|
|
655
654
|
/** Text, cut to its limit; anything that is not text is "not answered". */
|
|
656
655
|
const draftText = (max) => z
|
|
657
656
|
.string()
|
|
@@ -786,7 +785,7 @@ const completeOnboardingBodyFields = z.object({
|
|
|
786
785
|
*/
|
|
787
786
|
location: indiaLocationSchema.optional(),
|
|
788
787
|
/** The shared list rule (each goal once, 0.17.0) plus finish's minimum. */
|
|
789
|
-
goals:
|
|
788
|
+
goals: requiredGoalListSchema,
|
|
790
789
|
interests: interestsSchema,
|
|
791
790
|
skills: skillListSchema.optional(),
|
|
792
791
|
/**
|
|
@@ -896,8 +895,8 @@ export const ONBOARDING_TOTAL_STEPS = FOUNDER_ONBOARDING_STEPS.length;
|
|
|
896
895
|
export const ONBOARDING_STEP_FIELDS = FOUNDER_ONBOARDING_STEPS.map((s) => s.fields);
|
|
897
896
|
/** What finishing answers: the new profile's id and the handle derived for it. */
|
|
898
897
|
export const completeOnboardingResponseSchema = z.object({
|
|
899
|
-
id:
|
|
900
|
-
username:
|
|
898
|
+
id: objectIdSchema,
|
|
899
|
+
username: usernameSchema,
|
|
901
900
|
});
|
|
902
901
|
// ─── The resume cursor ───────────────────────────────────────────────────────
|
|
903
902
|
/**
|
|
@@ -919,42 +918,36 @@ export const ONBOARDING_DRAFT_KEYS = onboardingDraftKeySchema.options;
|
|
|
919
918
|
* pair: one number is what lets a member start on the web and resume elsewhere,
|
|
920
919
|
* provided both ends agree on the encoding.
|
|
921
920
|
*
|
|
922
|
-
*
|
|
923
|
-
*
|
|
924
|
-
*
|
|
921
|
+
* What is READ BACK: the draft's KEYS come from the form, its VALUES are
|
|
922
|
+
* opaque, since a stored draft may predate 0.18.0 (any JSON was stored then);
|
|
923
|
+
* read it through `readOnboardingDraft`, never by casting. What is WRITTEN is
|
|
924
|
+
* the form's own shape (`onboardingProgressUpdateSchema.draft`, 0.18.0), and
|
|
925
|
+
* everything is re-validated strictly at finalize.
|
|
925
926
|
*
|
|
926
927
|
* `partialRecord`, not `record`: in Zod 4 an enum-keyed `z.record` demands
|
|
927
928
|
* every key, and a draft holds whichever steps the member has reached.
|
|
928
929
|
*/
|
|
929
930
|
export const onboardingDraftSchema = z.partialRecord(onboardingDraftKeySchema, z.unknown());
|
|
930
|
-
export const onboardingProgressSchema = z.object({
|
|
931
|
-
step: z.number().int().min(0).max(ONBOARDING_TOTAL_STEPS),
|
|
932
|
-
draft: onboardingDraftSchema.optional(),
|
|
933
|
-
});
|
|
934
931
|
/**
|
|
935
932
|
* `PATCH` body: any subset of the cursor, merged server-side. No defaults.
|
|
936
933
|
* `step` may equal `ONBOARDING_TOTAL_STEPS`: "past the last step", which the
|
|
937
934
|
* client sends on its way to finish.
|
|
938
935
|
*
|
|
939
|
-
* The
|
|
940
|
-
*
|
|
941
|
-
* upload, so it must be an upload id or `null` like the form's own field.
|
|
936
|
+
* The photo step's `avatarMediaId` is not kept in the draft (0.17.0): it is
|
|
937
|
+
* handed to the server, which holds that upload for the member.
|
|
942
938
|
*/
|
|
943
939
|
export const onboardingProgressUpdateSchema = z.object({
|
|
944
940
|
step: z.number().int().min(0).max(ONBOARDING_TOTAL_STEPS).optional(),
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
}
|
|
956
|
-
: draft)
|
|
957
|
-
.optional(),
|
|
941
|
+
/**
|
|
942
|
+
* The answers of the step being saved, IN THE FORM'S OWN SHAPE (0.18.0):
|
|
943
|
+
* half-answered is fine (that is the form: text as typed, `null` for "not
|
|
944
|
+
* yet"), but every value has its type and its bound, and no other key is
|
|
945
|
+
* taken. Before 0.18.0 any JSON up to the body limit was stored as sent,
|
|
946
|
+
* for 90 days, and sent back. The photo's id reads as `objectIdSchema` reads
|
|
947
|
+
* every id (lower case), since the server compares it with the upload it
|
|
948
|
+
* holds.
|
|
949
|
+
*/
|
|
950
|
+
draft: onboardingFormSchema.partial().strict().optional(),
|
|
958
951
|
});
|
|
959
952
|
/**
|
|
960
953
|
* What the client reads on return, from `GET` and from every `PATCH`.
|