founder-schema 0.31.0 → 0.33.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 +21 -2
- package/dist/access/permissions.d.ts.map +1 -1
- package/dist/access/permissions.js +6 -0
- package/dist/access/permissions.js.map +1 -1
- package/dist/core/errors.d.ts +3 -1
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +6 -0
- package/dist/core/errors.js.map +1 -1
- package/dist/core/responses.d.ts +2 -0
- package/dist/core/responses.d.ts.map +1 -1
- package/dist/domains/audit/audit.d.ts +28 -0
- package/dist/domains/audit/audit.d.ts.map +1 -1
- package/dist/domains/billing/billing.d.ts +16 -0
- package/dist/domains/billing/billing.d.ts.map +1 -1
- package/dist/domains/billing/billing.js +14 -7
- package/dist/domains/billing/billing.js.map +1 -1
- package/dist/domains/blocks/blocks.d.ts +8 -0
- package/dist/domains/blocks/blocks.d.ts.map +1 -1
- package/dist/domains/chat/chat.d.ts +8 -0
- package/dist/domains/chat/chat.d.ts.map +1 -1
- package/dist/domains/communities/communities.d.ts +76 -0
- package/dist/domains/communities/communities.d.ts.map +1 -1
- package/dist/domains/contributions/contributions.d.ts +16 -0
- package/dist/domains/contributions/contributions.d.ts.map +1 -1
- package/dist/domains/discover/discover.d.ts +4 -0
- package/dist/domains/discover/discover.d.ts.map +1 -1
- package/dist/domains/feed/feed.d.ts +88 -0
- package/dist/domains/feed/feed.d.ts.map +1 -1
- package/dist/domains/feed/mentions.d.ts +4 -0
- package/dist/domains/feed/mentions.d.ts.map +1 -1
- package/dist/domains/follows/follows.d.ts +8 -0
- package/dist/domains/follows/follows.d.ts.map +1 -1
- package/dist/domains/follows/follows.js +7 -0
- package/dist/domains/follows/follows.js.map +1 -1
- package/dist/domains/insights/insights.d.ts +210 -0
- package/dist/domains/insights/insights.d.ts.map +1 -0
- package/dist/domains/insights/insights.js +154 -0
- package/dist/domains/insights/insights.js.map +1 -0
- package/dist/domains/members/members.d.ts +20 -0
- package/dist/domains/members/members.d.ts.map +1 -1
- package/dist/domains/membership/membership.d.ts +103 -1
- package/dist/domains/membership/membership.d.ts.map +1 -1
- package/dist/domains/membership/membership.js +67 -1
- package/dist/domains/membership/membership.js.map +1 -1
- package/dist/domains/moderation/moderation.d.ts +8 -0
- package/dist/domains/moderation/moderation.d.ts.map +1 -1
- package/dist/domains/notifications/notifications.d.ts +56 -3
- package/dist/domains/notifications/notifications.d.ts.map +1 -1
- package/dist/domains/notifications/notifications.js +40 -4
- package/dist/domains/notifications/notifications.js.map +1 -1
- package/dist/domains/people/person.d.ts +15 -0
- package/dist/domains/people/person.d.ts.map +1 -1
- package/dist/domains/people/person.js +23 -1
- package/dist/domains/people/person.js.map +1 -1
- package/dist/domains/products/product-comments.d.ts +8 -0
- package/dist/domains/products/product-comments.d.ts.map +1 -1
- package/dist/domains/products/product-featured.d.ts +266 -0
- package/dist/domains/products/product-featured.d.ts.map +1 -0
- package/dist/domains/products/product-featured.js +72 -0
- package/dist/domains/products/product-featured.js.map +1 -0
- package/dist/domains/products/products.d.ts +60 -0
- package/dist/domains/products/products.d.ts.map +1 -1
- package/dist/domains/products/products.js +6 -0
- package/dist/domains/products/products.js.map +1 -1
- package/dist/domains/profile/founder-profile.d.ts +8 -0
- package/dist/domains/profile/founder-profile.d.ts.map +1 -1
- package/dist/domains/profile/founder-profile.js +7 -1
- package/dist/domains/profile/founder-profile.js.map +1 -1
- package/dist/domains/reviews/reviews.d.ts +20 -0
- package/dist/domains/reviews/reviews.d.ts.map +1 -1
- package/dist/domains/support/support.d.ts +45 -5
- package/dist/domains/support/support.d.ts.map +1 -1
- package/dist/domains/team/team.d.ts +8 -0
- package/dist/domains/team/team.d.ts.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Insights and visibility (0.32.0, plans v1; founder-circle-backend
|
|
3
|
+
* docs/plans-v1-features.md, the user 2026-11-28)
|
|
4
|
+
* ==========================================================================
|
|
5
|
+
*
|
|
6
|
+
* POST /api/v1/products/:productId/views recordViewBodySchema -> 204 (always)
|
|
7
|
+
* GET /api/v1/products/:productId/insights insightsQuerySchema -> productInsightsSchema
|
|
8
|
+
* POST /api/v1/founders/:userId/views recordViewBodySchema -> 204 (always)
|
|
9
|
+
* GET /api/v1/me/profile-views profileViewsQuerySchema -> profileViewsSchema
|
|
10
|
+
* GET /api/v1/me/visibility -> visibilitySettingsSchema
|
|
11
|
+
* PUT /api/v1/me/visibility visibilitySettingsSchema -> visibilitySettingsSchema
|
|
12
|
+
*
|
|
13
|
+
* WHAT IS RECORDED. A product page or a member page opened by a MEMBER acting as
|
|
14
|
+
* a member (never a viewer, never staff acting as staff), who is not its team
|
|
15
|
+
* (or the member themselves) and not blocked either way. Answered 204 whatever
|
|
16
|
+
* happens, a rate limit included, so the answer tells a viewer nothing about the
|
|
17
|
+
* other side.
|
|
18
|
+
*
|
|
19
|
+
* COUNTING. A product's `views` are VISITS: one per viewer per day (India time),
|
|
20
|
+
* so a refresh is not a view; `visitors` are distinct members over the range. A
|
|
21
|
+
* profile's `count` is distinct members over the range. Upvotes and comments in
|
|
22
|
+
* a product's series are activity on that day (one taken back later stays
|
|
23
|
+
* counted on its day).
|
|
24
|
+
*
|
|
25
|
+
* HOW MUCH IS SHOWN is the plan's (`planFeaturesSchema`): a product's depth is
|
|
26
|
+
* its OWNER's plan, who viewed you is your own. More than the plan covers
|
|
27
|
+
* answers what it may (the totals, the count) with `locked: true`, never a 403,
|
|
28
|
+
* so a screen shows the upgrade in place. A viewer is refused
|
|
29
|
+
* (`MEMBERSHIP_REQUIRED`).
|
|
30
|
+
*
|
|
31
|
+
* DPDP: who looked at which product is used to count unique visitors and is
|
|
32
|
+
* never shown to the product's team; profile views name a viewer only to the
|
|
33
|
+
* member they viewed, never a viewer who browses privately, never across a
|
|
34
|
+
* block. Both are kept 100 days and erased with either account.
|
|
35
|
+
*
|
|
36
|
+
* @module domains/insights/insights
|
|
37
|
+
*/
|
|
38
|
+
import { z } from 'zod';
|
|
39
|
+
import { objectIdSchema } from '../../core/common.js';
|
|
40
|
+
import { paginatedSchema } from '../../core/responses.js';
|
|
41
|
+
import { personSchema } from '../people/person.js';
|
|
42
|
+
/**
|
|
43
|
+
* Where a view came from: the link the web drew it from. ⚠ Stored: append only.
|
|
44
|
+
*
|
|
45
|
+
* discover Discover (people or products)
|
|
46
|
+
* feed a post, a comment, a mention
|
|
47
|
+
* profile a member page (their products, their team)
|
|
48
|
+
* search a search result
|
|
49
|
+
* direct a typed or shared link
|
|
50
|
+
* other anything else
|
|
51
|
+
*/
|
|
52
|
+
export const VIEW_SOURCE_VALUES = [
|
|
53
|
+
'discover',
|
|
54
|
+
'feed',
|
|
55
|
+
'profile',
|
|
56
|
+
'search',
|
|
57
|
+
'direct',
|
|
58
|
+
'other',
|
|
59
|
+
];
|
|
60
|
+
export const viewSourceSchema = z.enum(VIEW_SOURCE_VALUES);
|
|
61
|
+
/**
|
|
62
|
+
* How long a record naming WHO viewed is kept (0.32.0): the product visitors
|
|
63
|
+
* behind the unique counts and every profile view. The server's TTL and the
|
|
64
|
+
* Privacy policy's sentence both read this one number. Counts with no person
|
|
65
|
+
* (a product's day totals) are kept for good.
|
|
66
|
+
*/
|
|
67
|
+
export const VIEW_RETENTION_DAYS = 100;
|
|
68
|
+
/** A page view, as the web reports it. Unknown or missing is `other`. */
|
|
69
|
+
export const recordViewBodySchema = z.object({
|
|
70
|
+
source: viewSourceSchema.catch('other').default('other'),
|
|
71
|
+
});
|
|
72
|
+
/** The ranges a screen offers, in days. */
|
|
73
|
+
export const INSIGHTS_RANGE_VALUES = ['30', '90'];
|
|
74
|
+
const rangeSchema = z.enum(INSIGHTS_RANGE_VALUES).default('30').transform(Number);
|
|
75
|
+
export const insightsQuerySchema = z.object({ range: rangeSchema });
|
|
76
|
+
/** One day of a product's series, India's calendar day (`2026-11-28`). */
|
|
77
|
+
export const insightDaySchema = z.object({
|
|
78
|
+
day: z.string().regex(/^\d{4}-\d{2}-\d{2}$/),
|
|
79
|
+
views: z.number().int().nonnegative(),
|
|
80
|
+
visitors: z.number().int().nonnegative(),
|
|
81
|
+
upvotes: z.number().int().nonnegative(),
|
|
82
|
+
comments: z.number().int().nonnegative(),
|
|
83
|
+
});
|
|
84
|
+
export const productInsightsSchema = z.object({
|
|
85
|
+
productId: objectIdSchema,
|
|
86
|
+
/** The range asked for, in days. */
|
|
87
|
+
range: z.number().int().positive(),
|
|
88
|
+
/**
|
|
89
|
+
* The owner's plan does not cover this range (or any series): `days` is
|
|
90
|
+
* empty and `sources` null; `totals` are still given. The screen shows the
|
|
91
|
+
* upgrade in place.
|
|
92
|
+
*/
|
|
93
|
+
locked: z.boolean(),
|
|
94
|
+
/** How far back the owner's plan reaches, in days (0: totals only). */
|
|
95
|
+
allowedDays: z.number().int().nonnegative(),
|
|
96
|
+
totals: z.object({
|
|
97
|
+
/** All time. */
|
|
98
|
+
upvotes: z.number().int().nonnegative(),
|
|
99
|
+
comments: z.number().int().nonnegative(),
|
|
100
|
+
reviews: z.number().int().nonnegative(),
|
|
101
|
+
/** Within the range; 0 when locked. */
|
|
102
|
+
views: z.number().int().nonnegative(),
|
|
103
|
+
/** Distinct members within the range; 0 when locked. */
|
|
104
|
+
visitors: z.number().int().nonnegative(),
|
|
105
|
+
}),
|
|
106
|
+
/** Oldest first, every day of the range present (zeros included); empty when locked. */
|
|
107
|
+
days: z.array(insightDaySchema),
|
|
108
|
+
/** Views by source within the range: only where the plan includes sources (Business). */
|
|
109
|
+
sources: z.record(viewSourceSchema, z.number().int().nonnegative()).nullable(),
|
|
110
|
+
});
|
|
111
|
+
// ─── Who viewed your profile ─────────────────────────────────────────────────
|
|
112
|
+
export const profileViewsQuerySchema = z.object({
|
|
113
|
+
range: rangeSchema,
|
|
114
|
+
cursor: z.string().max(200).optional(),
|
|
115
|
+
limit: z.coerce.number().int().min(1).max(50).default(20),
|
|
116
|
+
});
|
|
117
|
+
/** One person who viewed you: their latest view within the range. */
|
|
118
|
+
export const profileViewerSchema = z.object({
|
|
119
|
+
person: personSchema,
|
|
120
|
+
lastViewedAt: z.iso.datetime(),
|
|
121
|
+
source: viewSourceSchema,
|
|
122
|
+
});
|
|
123
|
+
export const profileViewsSchema = z.object({
|
|
124
|
+
range: z.number().int().positive(),
|
|
125
|
+
/** Their plan does not name viewers for this range: `viewers` is empty, `count` still given. */
|
|
126
|
+
locked: z.boolean(),
|
|
127
|
+
/** How far back their plan names viewers, in days (0: the count only). */
|
|
128
|
+
allowedDays: z.number().int().nonnegative(),
|
|
129
|
+
/** Distinct members who viewed them within the range, private ones included. */
|
|
130
|
+
count: z.number().int().nonnegative(),
|
|
131
|
+
/** Of `count`, those who browse privately: counted, never named. */
|
|
132
|
+
privateCount: z.number().int().nonnegative(),
|
|
133
|
+
/** Newest first; never a private viewer, a blocked one either way, or a former member. */
|
|
134
|
+
viewers: paginatedSchema(profileViewerSchema),
|
|
135
|
+
});
|
|
136
|
+
// ─── Visibility settings ─────────────────────────────────────────────────────
|
|
137
|
+
/**
|
|
138
|
+
* How a member appears to others (0.32.0). Both are theirs to change at any
|
|
139
|
+
* time, and both take effect at once.
|
|
140
|
+
*
|
|
141
|
+
* showPlanBadge their plan's badge shows on their person (default on)
|
|
142
|
+
* browsePrivately their profile views are counted but never named, to anyone
|
|
143
|
+
* (default off, LinkedIn's model). It changes how THEY appear,
|
|
144
|
+
* not what they see.
|
|
145
|
+
*/
|
|
146
|
+
export const visibilitySettingsSchema = z.object({
|
|
147
|
+
showPlanBadge: z.boolean(),
|
|
148
|
+
browsePrivately: z.boolean(),
|
|
149
|
+
});
|
|
150
|
+
export const VISIBILITY_SETTINGS_DEFAULT = {
|
|
151
|
+
showPlanBadge: true,
|
|
152
|
+
browsePrivately: false,
|
|
153
|
+
};
|
|
154
|
+
//# sourceMapp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rC,oEAAoE;IACpE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IAC5C,0FAA0F;IAC1F,OAAO,EAAE,eAAe,CAAC,mBAAmB,CAAC;CAC9C,CAAC,CAAC;AAGH,gFAAgF;AAEhF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,aAAa,EAAE,CAAC,CAAC,OAAO,EAAE;IAC1B,eAAe,EAAE,CAAC,CAAC,OAAO,EAAE;CAC7B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,2BAA2B,GAAuB;IAC7D,aAAa,EAAE,IAAI;IACnB,eAAe,EAAE,KAAK;CACvB,CAAC","sourcesContent":["/**\n * Insights and visibility (0.32.0, plans v1; founder-circle-backend\n * docs/plans-v1-features.md, the user 2026-11-28)\n * ==========================================================================\n *\n * POST /api/v1/products/:productId/views recordViewBodySchema -> 204 (always)\n * GET /api/v1/products/:productId/insights insightsQuerySchema -> productInsightsSchema\n * POST /api/v1/founders/:userId/views recordViewBodySchema -> 204 (always)\n * GET /api/v1/me/profile-views profileViewsQuerySchema -> profileViewsSchema\n * GET /api/v1/me/visibility -> visibilitySettingsSchema\n * PUT /api/v1/me/visibility visibilitySettingsSchema -> visibilitySettingsSchema\n *\n * WHAT IS RECORDED. A product page or a member page opened by a MEMBER acting as\n * a member (never a viewer, never staff acting as staff), who is not its team\n * (or the member themselves) and not blocked either way. Answered 204 whatever\n * happens, a rate limit included, so the answer tells a viewer nothing about the\n * other side.\n *\n * COUNTING. A product's `views` are VISITS: one per viewer per day (India time),\n * so a refresh is not a view; `visitors` are distinct members over the range. A\n * profile's `count` is distinct members over the range. Upvotes and comments in\n * a product's series are activity on that day (one taken back later stays\n * counted on its day).\n *\n * HOW MUCH IS SHOWN is the plan's (`planFeaturesSchema`): a product's depth is\n * its OWNER's plan, who viewed you is your own. More than the plan covers\n * answers what it may (the totals, the count) with `locked: true`, never a 403,\n * so a screen shows the upgrade in place. A viewer is refused\n * (`MEMBERSHIP_REQUIRED`).\n *\n * DPDP: who looked at which product is used to count unique visitors and is\n * never shown to the product's team; profile views name a viewer only to the\n * member they viewed, never a viewer who browses privately, never across a\n * block. Both are kept 100 days and erased with either account.\n *\n * @module domains/insights/insights\n */\n\nimport { z } from 'zod';\nimport { objectIdSchema } from '../../core/common.js';\nimport { paginatedSchema } from '../../core/responses.js';\nimport { personSchema } from '../people/person.js';\n\n/**\n * Where a view came from: the link the web drew it from. ⚠ Stored: append only.\n *\n * discover Discover (people or products)\n * feed a post, a comment, a mention\n * profile a member page (their products, their team)\n * search a search result\n * direct a typed or shared link\n * other anything else\n */\nexport const VIEW_SOURCE_VALUES = [\n 'discover',\n 'feed',\n 'profile',\n 'search',\n 'direct',\n 'other',\n] as const;\nexport const viewSourceSchema = z.enum(VIEW_SOURCE_VALUES);\nexport type ViewSource = z.infer<typeof viewSourceSchema>;\n\n/**\n * How long a record naming WHO viewed is kept (0.32.0): the product visitors\n * behind the unique counts and every profile view. The server's TTL and the\n * Privacy policy's sentence both read this one number. Counts with no person\n * (a product's day totals) are kept for good.\n */\nexport const VIEW_RETENTION_DAYS = 100;\n\n/** A page view, as the web reports it. Unknown or missing is `other`. */\nexport const recordViewBodySchema = z.object({\n source: viewSourceSchema.catch('other').default('other'),\n});\nexport type RecordViewBody = z.infer<typeof recordViewBodySchema>;\n\n/** The ranges a screen offers, in days. */\nexport const INSIGHTS_RANGE_VALUES = ['30', '90'] as const;\nconst rangeSchema = z.enum(INSIGHTS_RANGE_VALUES).default('30').transform(Number);\n\nexport const insightsQuerySchema = z.object({ range: rangeSchema });\nexport type InsightsQuery = z.infer<typeof insightsQuerySchema>;\nexport type InsightsQueryInput = z.input<typeof insightsQuerySchema>;\n\n/** One day of a product's series, India's calendar day (`2026-11-28`). */\nexport const insightDaySchema = z.object({\n day: z.string().regex(/^\\d{4}-\\d{2}-\\d{2}$/),\n views: z.number().int().nonnegative(),\n visitors: z.number().int().nonnegative(),\n upvotes: z.number().int().nonnegative(),\n comments: z.number().int().nonnegative(),\n});\nexport type InsightDay = z.infer<typeof insightDaySchema>;\n\nexport const productInsightsSchema = z.object({\n productId: objectIdSchema,\n /** The range asked for, in days. */\n range: z.number().int().positive(),\n /**\n * The owner's plan does not cover this range (or any series): `days` is\n * empty and `sources` null; `totals` are still given. The screen shows the\n * upgrade in place.\n */\n locked: z.boolean(),\n /** How far back the owner's plan reaches, in days (0: totals only). */\n allowedDays: z.number().int().nonnegative(),\n totals: z.object({\n /** All time. */\n upvotes: z.number().int().nonnegative(),\n comments: z.number().int().nonnegative(),\n reviews: z.number().int().nonnegative(),\n /** Within the range; 0 when locked. */\n views: z.number().int().nonnegative(),\n /** Distinct members within the range; 0 when locked. */\n visitors: z.number().int().nonnegative(),\n }),\n /** Oldest first, every day of the range present (zeros included); empty when locked. */\n days: z.array(insightDaySchema),\n /** Views by source within the range: only where the plan includes sources (Business). */\n sources: z.record(viewSourceSchema, z.number().int().nonnegative()).nullable(),\n});\nexport type ProductInsights = z.infer<typeof productInsightsSchema>;\n\n// ─── Who viewed your profile ─────────────────────────────────────────────────\n\nexport const profileViewsQuerySchema = z.object({\n range: rangeSchema,\n cursor: z.string().max(200).optional(),\n limit: z.coerce.number().int().min(1).max(50).default(20),\n});\nexport type ProfileViewsQuery = z.infer<typeof profileViewsQuerySchema>;\nexport type ProfileViewsQueryInput = z.input<typeof profileViewsQuerySchema>;\n\n/** One person who viewed you: their latest view within the range. */\nexport const profileViewerSchema = z.object({\n person: personSchema,\n lastViewedAt: z.iso.datetime(),\n source: viewSourceSchema,\n});\nexport type ProfileViewer = z.infer<typeof profileViewerSchema>;\n\nexport const profileViewsSchema = z.object({\n range: z.number().int().positive(),\n /** Their plan does not name viewers for this range: `viewers` is empty, `count` still given. */\n locked: z.boolean(),\n /** How far back their plan names viewers, in days (0: the count only). */\n allowedDays: z.number().int().nonnegative(),\n /** Distinct members who viewed them within the range, private ones included. */\n count: z.number().int().nonnegative(),\n /** Of `count`, those who browse privately: counted, never named. */\n privateCount: z.number().int().nonnegative(),\n /** Newest first; never a private viewer, a blocked one either way, or a former member. */\n viewers: paginatedSchema(profileViewerSchema),\n});\nexport type ProfileViews = z.infer<typeof profileViewsSchema>;\n\n// ─── Visibility settings ─────────────────────────────────────────────────────\n\n/**\n * How a member appears to others (0.32.0). Both are theirs to change at any\n * time, and both take effect at once.\n *\n * showPlanBadge their plan's badge shows on their person (default on)\n * browsePrivately their profile views are counted but never named, to anyone\n * (default off, LinkedIn's model). It changes how THEY appear,\n * not what they see.\n */\nexport const visibilitySettingsSchema = z.object({\n showPlanBadge: z.boolean(),\n browsePrivately: z.boolean(),\n});\nexport type VisibilitySettings = z.infer<typeof visibilitySettingsSchema>;\nexport const VISIBILITY_SETTINGS_DEFAULT: VisibilitySettings = {\n showPlanBadge: true,\n browsePrivately: false,\n};\n"]}
|
|
@@ -75,6 +75,10 @@ export declare const memberSummarySchema: z.ZodObject<{
|
|
|
75
75
|
firstName: z.ZodString;
|
|
76
76
|
avatarUrl: z.ZodNullable<z.ZodURL>;
|
|
77
77
|
former: z.ZodBoolean;
|
|
78
|
+
planBadge: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
|
|
79
|
+
premium: "premium";
|
|
80
|
+
business: "business";
|
|
81
|
+
}>>>;
|
|
78
82
|
email: z.ZodNullable<z.ZodString>;
|
|
79
83
|
status: z.ZodEnum<{
|
|
80
84
|
active: "active";
|
|
@@ -98,6 +102,10 @@ export declare const memberDirectoryPageSchema: z.ZodObject<{
|
|
|
98
102
|
firstName: z.ZodString;
|
|
99
103
|
avatarUrl: z.ZodNullable<z.ZodURL>;
|
|
100
104
|
former: z.ZodBoolean;
|
|
105
|
+
planBadge: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
|
|
106
|
+
premium: "premium";
|
|
107
|
+
business: "business";
|
|
108
|
+
}>>>;
|
|
101
109
|
email: z.ZodNullable<z.ZodString>;
|
|
102
110
|
status: z.ZodEnum<{
|
|
103
111
|
active: "active";
|
|
@@ -126,6 +134,10 @@ export declare const suspensionSchema: z.ZodObject<{
|
|
|
126
134
|
firstName: z.ZodString;
|
|
127
135
|
avatarUrl: z.ZodNullable<z.ZodURL>;
|
|
128
136
|
former: z.ZodBoolean;
|
|
137
|
+
planBadge: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
|
|
138
|
+
premium: "premium";
|
|
139
|
+
business: "business";
|
|
140
|
+
}>>>;
|
|
129
141
|
}, z.core.$strip>>;
|
|
130
142
|
}, z.core.$strip>;
|
|
131
143
|
export type Suspension = z.infer<typeof suspensionSchema>;
|
|
@@ -137,6 +149,10 @@ export declare const memberDetailSchema: z.ZodObject<{
|
|
|
137
149
|
firstName: z.ZodString;
|
|
138
150
|
avatarUrl: z.ZodNullable<z.ZodURL>;
|
|
139
151
|
former: z.ZodBoolean;
|
|
152
|
+
planBadge: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
|
|
153
|
+
premium: "premium";
|
|
154
|
+
business: "business";
|
|
155
|
+
}>>>;
|
|
140
156
|
email: z.ZodNullable<z.ZodString>;
|
|
141
157
|
status: z.ZodEnum<{
|
|
142
158
|
active: "active";
|
|
@@ -169,6 +185,10 @@ export declare const memberDetailSchema: z.ZodObject<{
|
|
|
169
185
|
firstName: z.ZodString;
|
|
170
186
|
avatarUrl: z.ZodNullable<z.ZodURL>;
|
|
171
187
|
former: z.ZodBoolean;
|
|
188
|
+
planBadge: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
|
|
189
|
+
premium: "premium";
|
|
190
|
+
business: "business";
|
|
191
|
+
}>>>;
|
|
172
192
|
}, z.core.$strip>>;
|
|
173
193
|
}, z.core.$strip>>;
|
|
174
194
|
viewer: z.ZodObject<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"members.d.ts","sourceRoot":"","sources":["../../../src/domains/members/members.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;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AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAC9E,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAEnF;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;iBAQ9B,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAuC,CAAC;AAC9E,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,6BAA6B;AAC7B,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;iBAK3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,qCAAqC;AACrC,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiD7B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,sFAAsF;AACtF,eAAO,MAAM,uBAAuB;;iBAElC,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
|
|
@@ -98,16 +98,62 @@ export declare const planLimitsSchema: z.ZodObject<{
|
|
|
98
98
|
newPeoplePerMonth: z.ZodNumber;
|
|
99
99
|
}, z.core.$strip>;
|
|
100
100
|
export type PlanLimits = z.infer<typeof planLimitsSchema>;
|
|
101
|
+
/**
|
|
102
|
+
* What a standing or a plan UNLOCKS beyond the counted limits (0.32.0, plans v1;
|
|
103
|
+
* founder-circle-backend docs/plans-v1-features.md, the user 2026-11-28).
|
|
104
|
+
*
|
|
105
|
+
* badge a "Premium" / "Business" badge on the member's person
|
|
106
|
+
* insightsDays how far back a product's insights go: 0 = the totals only
|
|
107
|
+
* (what a card already shows), else that many days of series
|
|
108
|
+
* insightsSources where a product's visitors came from (Discover, feed...)
|
|
109
|
+
* profileViewersDays who viewed your profile: 0 = the count only, else the
|
|
110
|
+
* names for that many days
|
|
111
|
+
* featured Discover's "Featured" row:
|
|
112
|
+
* none not offered
|
|
113
|
+
* monthly_run one run of `runDays` days a calendar
|
|
114
|
+
* month (India time), one product
|
|
115
|
+
* always one product at a time, with no end of its own
|
|
116
|
+
*/
|
|
117
|
+
export declare const FEATURED_KIND_VALUES: readonly ["none", "monthly_run", "always"];
|
|
118
|
+
export declare const featuredKindSchema: z.ZodEnum<{
|
|
119
|
+
none: "none";
|
|
120
|
+
monthly_run: "monthly_run";
|
|
121
|
+
always: "always";
|
|
122
|
+
}>;
|
|
123
|
+
export type FeaturedKind = z.infer<typeof featuredKindSchema>;
|
|
124
|
+
export declare const planFeaturesSchema: z.ZodObject<{
|
|
125
|
+
badge: z.ZodBoolean;
|
|
126
|
+
insightsDays: z.ZodNumber;
|
|
127
|
+
insightsSources: z.ZodBoolean;
|
|
128
|
+
profileViewersDays: z.ZodNumber;
|
|
129
|
+
featured: z.ZodObject<{
|
|
130
|
+
kind: z.ZodEnum<{
|
|
131
|
+
none: "none";
|
|
132
|
+
monthly_run: "monthly_run";
|
|
133
|
+
always: "always";
|
|
134
|
+
}>;
|
|
135
|
+
runDays: z.ZodNumber;
|
|
136
|
+
}, z.core.$strip>;
|
|
137
|
+
}, z.core.$strip>;
|
|
138
|
+
export type PlanFeatures = z.infer<typeof planFeaturesSchema>;
|
|
101
139
|
/** The membership: once, for life. */
|
|
102
140
|
export declare const MEMBERSHIP_PRICE_PAISE = 9900;
|
|
103
141
|
/** What a member with no plan may: 1 live product, no conversations with people they do not know. */
|
|
104
142
|
export declare const MEMBER_LIMIT_VALUES: PlanLimits;
|
|
105
|
-
/**
|
|
143
|
+
/**
|
|
144
|
+
* What a member with no plan has unlocked (0.32.0): no badge, a product's totals
|
|
145
|
+
* only, the COUNT of who viewed them (last 30 days), nothing featured.
|
|
146
|
+
*/
|
|
147
|
+
export declare const MEMBER_FEATURE_VALUES: PlanFeatures;
|
|
148
|
+
/** Each plan's name, prices, limits and features. Exhaustive by type. */
|
|
106
149
|
export declare const PLAN_SPECS: Readonly<Record<PlanTier, {
|
|
107
150
|
name: string;
|
|
108
151
|
prices: Readonly<Record<PlanPeriod, number>>;
|
|
109
152
|
limits: PlanLimits;
|
|
153
|
+
features: PlanFeatures;
|
|
110
154
|
}>>;
|
|
155
|
+
/** The number of days a member (no plan) is told "N people viewed your profile" over. */
|
|
156
|
+
export declare const MEMBER_PROFILE_VIEW_COUNT_DAYS = 30;
|
|
111
157
|
/**
|
|
112
158
|
* A calendar month or year later on India's calendar (`count` of them), the
|
|
113
159
|
* day clamped to the month's last: 31 January plus a month is 28 or 29
|
|
@@ -173,6 +219,20 @@ export declare const planOfferSchema: z.ZodObject<{
|
|
|
173
219
|
productsLive: z.ZodNullable<z.ZodNumber>;
|
|
174
220
|
newPeoplePerMonth: z.ZodNumber;
|
|
175
221
|
}, z.core.$strip>;
|
|
222
|
+
features: z.ZodDefault<z.ZodObject<{
|
|
223
|
+
badge: z.ZodBoolean;
|
|
224
|
+
insightsDays: z.ZodNumber;
|
|
225
|
+
insightsSources: z.ZodBoolean;
|
|
226
|
+
profileViewersDays: z.ZodNumber;
|
|
227
|
+
featured: z.ZodObject<{
|
|
228
|
+
kind: z.ZodEnum<{
|
|
229
|
+
none: "none";
|
|
230
|
+
monthly_run: "monthly_run";
|
|
231
|
+
always: "always";
|
|
232
|
+
}>;
|
|
233
|
+
runDays: z.ZodNumber;
|
|
234
|
+
}, z.core.$strip>;
|
|
235
|
+
}, z.core.$strip>>;
|
|
176
236
|
}, z.core.$strip>;
|
|
177
237
|
export type PlanOffer = z.infer<typeof planOfferSchema>;
|
|
178
238
|
export declare const planCatalogSchema: z.ZodObject<{
|
|
@@ -183,6 +243,20 @@ export declare const planCatalogSchema: z.ZodObject<{
|
|
|
183
243
|
productsLive: z.ZodNullable<z.ZodNumber>;
|
|
184
244
|
newPeoplePerMonth: z.ZodNumber;
|
|
185
245
|
}, z.core.$strip>;
|
|
246
|
+
features: z.ZodDefault<z.ZodObject<{
|
|
247
|
+
badge: z.ZodBoolean;
|
|
248
|
+
insightsDays: z.ZodNumber;
|
|
249
|
+
insightsSources: z.ZodBoolean;
|
|
250
|
+
profileViewersDays: z.ZodNumber;
|
|
251
|
+
featured: z.ZodObject<{
|
|
252
|
+
kind: z.ZodEnum<{
|
|
253
|
+
none: "none";
|
|
254
|
+
monthly_run: "monthly_run";
|
|
255
|
+
always: "always";
|
|
256
|
+
}>;
|
|
257
|
+
runDays: z.ZodNumber;
|
|
258
|
+
}, z.core.$strip>;
|
|
259
|
+
}, z.core.$strip>>;
|
|
186
260
|
}, z.core.$strip>;
|
|
187
261
|
plans: z.ZodArray<z.ZodObject<{
|
|
188
262
|
tier: z.ZodEnum<{
|
|
@@ -198,6 +272,20 @@ export declare const planCatalogSchema: z.ZodObject<{
|
|
|
198
272
|
productsLive: z.ZodNullable<z.ZodNumber>;
|
|
199
273
|
newPeoplePerMonth: z.ZodNumber;
|
|
200
274
|
}, z.core.$strip>;
|
|
275
|
+
features: z.ZodDefault<z.ZodObject<{
|
|
276
|
+
badge: z.ZodBoolean;
|
|
277
|
+
insightsDays: z.ZodNumber;
|
|
278
|
+
insightsSources: z.ZodBoolean;
|
|
279
|
+
profileViewersDays: z.ZodNumber;
|
|
280
|
+
featured: z.ZodObject<{
|
|
281
|
+
kind: z.ZodEnum<{
|
|
282
|
+
none: "none";
|
|
283
|
+
monthly_run: "monthly_run";
|
|
284
|
+
always: "always";
|
|
285
|
+
}>;
|
|
286
|
+
runDays: z.ZodNumber;
|
|
287
|
+
}, z.core.$strip>;
|
|
288
|
+
}, z.core.$strip>>;
|
|
201
289
|
}, z.core.$strip>>;
|
|
202
290
|
refundWindowDays: z.ZodNumber;
|
|
203
291
|
paymentsEnabled: z.ZodBoolean;
|
|
@@ -349,6 +437,20 @@ export declare const meMembershipSchema: z.ZodObject<{
|
|
|
349
437
|
productsLive: z.ZodNullable<z.ZodNumber>;
|
|
350
438
|
newPeoplePerMonth: z.ZodNumber;
|
|
351
439
|
}, z.core.$strip>;
|
|
440
|
+
features: z.ZodDefault<z.ZodObject<{
|
|
441
|
+
badge: z.ZodBoolean;
|
|
442
|
+
insightsDays: z.ZodNumber;
|
|
443
|
+
insightsSources: z.ZodBoolean;
|
|
444
|
+
profileViewersDays: z.ZodNumber;
|
|
445
|
+
featured: z.ZodObject<{
|
|
446
|
+
kind: z.ZodEnum<{
|
|
447
|
+
none: "none";
|
|
448
|
+
monthly_run: "monthly_run";
|
|
449
|
+
always: "always";
|
|
450
|
+
}>;
|
|
451
|
+
runDays: z.ZodNumber;
|
|
452
|
+
}, z.core.$strip>;
|
|
453
|
+
}, z.core.$strip>>;
|
|
352
454
|
products: z.ZodObject<{
|
|
353
455
|
live: z.ZodNumber;
|
|
354
456
|
owned: z.ZodNumber;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"membership.d.ts","sourceRoot":"","sources":["../../../src/domains/membership/membership.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,sBAAsB,kEAMzB,CAAC;AACX,eAAO,MAAM,oBAAoB;;;;;;EAAiC,CAAC;AACnE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,8BAA+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AC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,qFAAqF;AACrF,eAAO,MAAM,eAAe;;;;;;;iBAI1B,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,qFAAqF;AACrF,eAAO,MAAM,yBAAyB,kCAAmC,CAAC;AAC1E,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1E,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6C7B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
|
@@ -83,6 +83,35 @@ export const planLimitsSchema = z.object({
|
|
|
83
83
|
productsLive: z.number().int().nonnegative().nullable(),
|
|
84
84
|
newPeoplePerMonth: z.number().int().nonnegative(),
|
|
85
85
|
});
|
|
86
|
+
/**
|
|
87
|
+
* What a standing or a plan UNLOCKS beyond the counted limits (0.32.0, plans v1;
|
|
88
|
+
* founder-circle-backend docs/plans-v1-features.md, the user 2026-11-28).
|
|
89
|
+
*
|
|
90
|
+
* badge a "Premium" / "Business" badge on the member's person
|
|
91
|
+
* insightsDays how far back a product's insights go: 0 = the totals only
|
|
92
|
+
* (what a card already shows), else that many days of series
|
|
93
|
+
* insightsSources where a product's visitors came from (Discover, feed...)
|
|
94
|
+
* profileViewersDays who viewed your profile: 0 = the count only, else the
|
|
95
|
+
* names for that many days
|
|
96
|
+
* featured Discover's "Featured" row:
|
|
97
|
+
* none not offered
|
|
98
|
+
* monthly_run one run of `runDays` days a calendar
|
|
99
|
+
* month (India time), one product
|
|
100
|
+
* always one product at a time, with no end of its own
|
|
101
|
+
*/
|
|
102
|
+
export const FEATURED_KIND_VALUES = ['none', 'monthly_run', 'always'];
|
|
103
|
+
export const featuredKindSchema = z.enum(FEATURED_KIND_VALUES);
|
|
104
|
+
export const planFeaturesSchema = z.object({
|
|
105
|
+
badge: z.boolean(),
|
|
106
|
+
insightsDays: z.number().int().nonnegative(),
|
|
107
|
+
insightsSources: z.boolean(),
|
|
108
|
+
profileViewersDays: z.number().int().nonnegative(),
|
|
109
|
+
featured: z.object({
|
|
110
|
+
kind: featuredKindSchema,
|
|
111
|
+
/** For `monthly_run`: the run's length in days; 0 otherwise. */
|
|
112
|
+
runDays: z.number().int().nonnegative(),
|
|
113
|
+
}),
|
|
114
|
+
});
|
|
86
115
|
// ─── The price list ──────────────────────────────────────────────────────────
|
|
87
116
|
//
|
|
88
117
|
// THE ONE PLACE a price or a plan's limit is written (0.12.0). The backend
|
|
@@ -95,19 +124,46 @@ export const planLimitsSchema = z.object({
|
|
|
95
124
|
export const MEMBERSHIP_PRICE_PAISE = 9_900;
|
|
96
125
|
/** What a member with no plan may: 1 live product, no conversations with people they do not know. */
|
|
97
126
|
export const MEMBER_LIMIT_VALUES = { productsLive: 1, newPeoplePerMonth: 0 };
|
|
98
|
-
/**
|
|
127
|
+
/**
|
|
128
|
+
* What a member with no plan has unlocked (0.32.0): no badge, a product's totals
|
|
129
|
+
* only, the COUNT of who viewed them (last 30 days), nothing featured.
|
|
130
|
+
*/
|
|
131
|
+
export const MEMBER_FEATURE_VALUES = {
|
|
132
|
+
badge: false,
|
|
133
|
+
insightsDays: 0,
|
|
134
|
+
insightsSources: false,
|
|
135
|
+
profileViewersDays: 0,
|
|
136
|
+
featured: { kind: 'none', runDays: 0 },
|
|
137
|
+
};
|
|
138
|
+
/** Each plan's name, prices, limits and features. Exhaustive by type. */
|
|
99
139
|
export const PLAN_SPECS = {
|
|
100
140
|
premium: {
|
|
101
141
|
name: 'Premium',
|
|
102
142
|
prices: { month: 39_900, year: 399_900 },
|
|
103
143
|
limits: { productsLive: 5, newPeoplePerMonth: 15 },
|
|
144
|
+
features: {
|
|
145
|
+
badge: true,
|
|
146
|
+
insightsDays: 30,
|
|
147
|
+
insightsSources: false,
|
|
148
|
+
profileViewersDays: 30,
|
|
149
|
+
featured: { kind: 'monthly_run', runDays: 7 },
|
|
150
|
+
},
|
|
104
151
|
},
|
|
105
152
|
business: {
|
|
106
153
|
name: 'Business',
|
|
107
154
|
prices: { month: 99_900, year: 999_900 },
|
|
108
155
|
limits: { productsLive: null, newPeoplePerMonth: 50 },
|
|
156
|
+
features: {
|
|
157
|
+
badge: true,
|
|
158
|
+
insightsDays: 90,
|
|
159
|
+
insightsSources: true,
|
|
160
|
+
profileViewersDays: 90,
|
|
161
|
+
featured: { kind: 'always', runDays: 0 },
|
|
162
|
+
},
|
|
109
163
|
},
|
|
110
164
|
};
|
|
165
|
+
/** The number of days a member (no plan) is told "N people viewed your profile" over. */
|
|
166
|
+
export const MEMBER_PROFILE_VIEW_COUNT_DAYS = 30;
|
|
111
167
|
// ─── Plan time on India's calendar, and an upgrade's price (0.18.0) ──────────
|
|
112
168
|
//
|
|
113
169
|
// Moved here from the backend's plan timeline so the price a member is charged
|
|
@@ -201,6 +257,8 @@ export const planOfferSchema = z.object({
|
|
|
201
257
|
/** GST included. */
|
|
202
258
|
prices: z.object({ month: paiseSchema, year: paiseSchema }),
|
|
203
259
|
limits: planLimitsSchema,
|
|
260
|
+
/** What it unlocks (0.32.0). Defaults to the member's when an older server leaves it out. */
|
|
261
|
+
features: planFeaturesSchema.default(MEMBER_FEATURE_VALUES),
|
|
204
262
|
});
|
|
205
263
|
export const planCatalogSchema = z.object({
|
|
206
264
|
currency: z.literal('INR'),
|
|
@@ -208,6 +266,8 @@ export const planCatalogSchema = z.object({
|
|
|
208
266
|
/** Once, for life, GST included. */
|
|
209
267
|
price: paiseSchema,
|
|
210
268
|
limits: planLimitsSchema,
|
|
269
|
+
/** What a member with no plan has unlocked (0.32.0). */
|
|
270
|
+
features: planFeaturesSchema.default(MEMBER_FEATURE_VALUES),
|
|
211
271
|
}),
|
|
212
272
|
/** Lowest first. */
|
|
213
273
|
plans: z.array(planOfferSchema),
|
|
@@ -336,6 +396,12 @@ export const meMembershipSchema = z.object({
|
|
|
336
396
|
blocks: z.array(planBlockSchema),
|
|
337
397
|
}),
|
|
338
398
|
limits: planLimitsSchema,
|
|
399
|
+
/**
|
|
400
|
+
* What the plan in force unlocks (0.32.0), with the renewal grace, and the
|
|
401
|
+
* top plan's while payments are off, as `limits`. Defaults to the member's
|
|
402
|
+
* when an older server leaves it out.
|
|
403
|
+
*/
|
|
404
|
+
features: planFeaturesSchema.default(MEMBER_FEATURE_VALUES),
|
|
339
405
|
products: z.object({
|
|
340
406
|
/** Products they own that are live now. */
|
|
341
407
|
live: z.number().int().nonnegative(),
|