founder-schema 0.36.0 → 0.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/access/permissions.d.ts +5 -1
- package/dist/access/permissions.d.ts.map +1 -1
- package/dist/access/permissions.js +2 -0
- package/dist/access/permissions.js.map +1 -1
- package/dist/access/standing.d.ts +1 -1
- package/dist/access/standing.js +1 -1
- package/dist/access/standing.js.map +1 -1
- package/dist/domains/audit/audit.d.ts +6 -1
- package/dist/domains/audit/audit.d.ts.map +1 -1
- package/dist/domains/audit/audit.js +8 -0
- package/dist/domains/audit/audit.js.map +1 -1
- package/dist/domains/billing/billing.d.ts +1 -1
- package/dist/domains/billing/billing.js +1 -1
- package/dist/domains/billing/billing.js.map +1 -1
- package/dist/domains/members/signups.d.ts +113 -0
- package/dist/domains/members/signups.d.ts.map +1 -0
- package/dist/domains/members/signups.js +69 -0
- package/dist/domains/members/signups.js.map +1 -0
- package/dist/domains/membership/membership.d.ts +28 -4
- package/dist/domains/membership/membership.d.ts.map +1 -1
- package/dist/domains/membership/membership.js +39 -5
- package/dist/domains/membership/membership.js.map +1 -1
- package/dist/domains/onboarding/onboarding.d.ts +142 -93
- package/dist/domains/onboarding/onboarding.d.ts.map +1 -1
- package/dist/domains/onboarding/onboarding.js +107 -20
- package/dist/domains/onboarding/onboarding.js.map +1 -1
- package/dist/domains/profile/founder-profile.d.ts +3 -3
- package/dist/domains/profile/founder-profile.js +3 -3
- package/dist/domains/profile/founder-profile.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* founder-schema: unfinished sign-ups, for staff (2026-12-06)
|
|
3
|
+
*
|
|
4
|
+
* GET /api/v1/members/signups ?q&limit&cursor signupPageSchema
|
|
5
|
+
*
|
|
6
|
+
* The people who started signing up and have not finished, newest change
|
|
7
|
+
* first, so staff can call someone who stopped at the payment (the user:
|
|
8
|
+
* "the manager, the super admin, and then the support agent and other
|
|
9
|
+
* platform roles should be able to see the users' details"). Every platform
|
|
10
|
+
* role reads it (`read Signup`), a member never.
|
|
11
|
+
*
|
|
12
|
+
* DATA KEPT TO WHAT A CALL NEEDS (DPDP): the name and the phone they typed
|
|
13
|
+
* into sign-up, the account's email, how far they got and whether they paid.
|
|
14
|
+
* Never their date of birth, gender or any other answer. Every page read is
|
|
15
|
+
* audited (`signups.viewed`: who looked and how many rows, never the search).
|
|
16
|
+
*
|
|
17
|
+
* SEARCH (`q`): anything with an `@` is a whole email address, matched
|
|
18
|
+
* exactly; digits are matched inside the phone as typed (spaces and dashes
|
|
19
|
+
* ignored); anything else is the start of any word of the name, in any case.
|
|
20
|
+
* Pageable, search or not.
|
|
21
|
+
*
|
|
22
|
+
* A deleted account is never listed; a suspended one is.
|
|
23
|
+
*
|
|
24
|
+
* @module founder-schema/domains/members/signups
|
|
25
|
+
*/
|
|
26
|
+
import { z } from 'zod';
|
|
27
|
+
/** The list's query. An emptied search box is "no search", not an error. */
|
|
28
|
+
export declare const signupListQuerySchema: z.ZodObject<{
|
|
29
|
+
limit: z.ZodPreprocess<z.ZodDefault<z.ZodCoercedNumber<unknown>>, unknown>;
|
|
30
|
+
cursor: z.ZodPreprocess<z.ZodOptional<z.ZodString>, unknown>;
|
|
31
|
+
q: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string | undefined, string>>>;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
export type SignupListQuery = z.infer<typeof signupListQuerySchema>;
|
|
34
|
+
export type SignupListQueryInput = z.input<typeof signupListQuerySchema>;
|
|
35
|
+
/**
|
|
36
|
+
* Where their membership purchase stands, from their membership orders:
|
|
37
|
+
*
|
|
38
|
+
* none never started one
|
|
39
|
+
* open a checkout still open (they may be paying right now)
|
|
40
|
+
* failed a checkout that ended unpaid (it expired)
|
|
41
|
+
* paid one paid (or a free coupon), and not refunded
|
|
42
|
+
* refunded the last one was refunded, or is being, and none is paid
|
|
43
|
+
*/
|
|
44
|
+
export declare const SIGNUP_PAYMENT_VALUES: readonly ["none", "open", "failed", "paid", "refunded"];
|
|
45
|
+
export declare const signupPaymentSchema: z.ZodEnum<{
|
|
46
|
+
paid: "paid";
|
|
47
|
+
refunded: "refunded";
|
|
48
|
+
none: "none";
|
|
49
|
+
open: "open";
|
|
50
|
+
failed: "failed";
|
|
51
|
+
}>;
|
|
52
|
+
export type SignupPayment = z.infer<typeof signupPaymentSchema>;
|
|
53
|
+
/** One unfinished sign-up. */
|
|
54
|
+
export declare const signupRowSchema: z.ZodObject<{
|
|
55
|
+
id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
56
|
+
userId: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
57
|
+
fullName: z.ZodNullable<z.ZodString>;
|
|
58
|
+
phone: z.ZodNullable<z.ZodString>;
|
|
59
|
+
email: z.ZodString;
|
|
60
|
+
step: z.ZodEnum<{
|
|
61
|
+
location: "location";
|
|
62
|
+
business: "business";
|
|
63
|
+
membership: "membership";
|
|
64
|
+
goals: "goals";
|
|
65
|
+
basics: "basics";
|
|
66
|
+
interests: "interests";
|
|
67
|
+
photo: "photo";
|
|
68
|
+
guidelines: "guidelines";
|
|
69
|
+
}>;
|
|
70
|
+
needsMembership: z.ZodBoolean;
|
|
71
|
+
payment: z.ZodEnum<{
|
|
72
|
+
paid: "paid";
|
|
73
|
+
refunded: "refunded";
|
|
74
|
+
none: "none";
|
|
75
|
+
open: "open";
|
|
76
|
+
failed: "failed";
|
|
77
|
+
}>;
|
|
78
|
+
startedAt: z.ZodISODateTime;
|
|
79
|
+
lastChangedAt: z.ZodISODateTime;
|
|
80
|
+
}, z.core.$strip>;
|
|
81
|
+
export type SignupRow = z.infer<typeof signupRowSchema>;
|
|
82
|
+
export declare const signupPageSchema: z.ZodObject<{
|
|
83
|
+
items: z.ZodArray<z.ZodObject<{
|
|
84
|
+
id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
85
|
+
userId: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
86
|
+
fullName: z.ZodNullable<z.ZodString>;
|
|
87
|
+
phone: z.ZodNullable<z.ZodString>;
|
|
88
|
+
email: z.ZodString;
|
|
89
|
+
step: z.ZodEnum<{
|
|
90
|
+
location: "location";
|
|
91
|
+
business: "business";
|
|
92
|
+
membership: "membership";
|
|
93
|
+
goals: "goals";
|
|
94
|
+
basics: "basics";
|
|
95
|
+
interests: "interests";
|
|
96
|
+
photo: "photo";
|
|
97
|
+
guidelines: "guidelines";
|
|
98
|
+
}>;
|
|
99
|
+
needsMembership: z.ZodBoolean;
|
|
100
|
+
payment: z.ZodEnum<{
|
|
101
|
+
paid: "paid";
|
|
102
|
+
refunded: "refunded";
|
|
103
|
+
none: "none";
|
|
104
|
+
open: "open";
|
|
105
|
+
failed: "failed";
|
|
106
|
+
}>;
|
|
107
|
+
startedAt: z.ZodISODateTime;
|
|
108
|
+
lastChangedAt: z.ZodISODateTime;
|
|
109
|
+
}, z.core.$strip>>;
|
|
110
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
111
|
+
}, z.core.$strip>;
|
|
112
|
+
export type SignupPage = z.infer<typeof signupPageSchema>;
|
|
113
|
+
//# sourceMappingURL=signups.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signups.d.ts","sourceRoot":"","sources":["../../../src/domains/members/signups.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,4EAA4E;AAC5E,eAAO,MAAM,qBAAqB;;;;iBAEhC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACpE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEzE;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,yDAA0D,CAAC;AAC7F,eAAO,MAAM,mBAAmB;;;;;;EAAgC,CAAC;AACjE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,8BAA8B;AAC9B,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoB1B,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAmC,CAAC;AACjE,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* founder-schema: unfinished sign-ups, for staff (2026-12-06)
|
|
3
|
+
*
|
|
4
|
+
* GET /api/v1/members/signups ?q&limit&cursor signupPageSchema
|
|
5
|
+
*
|
|
6
|
+
* The people who started signing up and have not finished, newest change
|
|
7
|
+
* first, so staff can call someone who stopped at the payment (the user:
|
|
8
|
+
* "the manager, the super admin, and then the support agent and other
|
|
9
|
+
* platform roles should be able to see the users' details"). Every platform
|
|
10
|
+
* role reads it (`read Signup`), a member never.
|
|
11
|
+
*
|
|
12
|
+
* DATA KEPT TO WHAT A CALL NEEDS (DPDP): the name and the phone they typed
|
|
13
|
+
* into sign-up, the account's email, how far they got and whether they paid.
|
|
14
|
+
* Never their date of birth, gender or any other answer. Every page read is
|
|
15
|
+
* audited (`signups.viewed`: who looked and how many rows, never the search).
|
|
16
|
+
*
|
|
17
|
+
* SEARCH (`q`): anything with an `@` is a whole email address, matched
|
|
18
|
+
* exactly; digits are matched inside the phone as typed (spaces and dashes
|
|
19
|
+
* ignored); anything else is the start of any word of the name, in any case.
|
|
20
|
+
* Pageable, search or not.
|
|
21
|
+
*
|
|
22
|
+
* A deleted account is never listed; a suspended one is.
|
|
23
|
+
*
|
|
24
|
+
* @module founder-schema/domains/members/signups
|
|
25
|
+
*/
|
|
26
|
+
import { z } from 'zod';
|
|
27
|
+
import { objectIdSchema, optionalTrimmedString, paginationQuerySchema } from '../../core/common.js';
|
|
28
|
+
import { MEMBER_SEARCH_MAX } from '../../core/limits.js';
|
|
29
|
+
import { paginatedSchema } from '../../core/responses.js';
|
|
30
|
+
import { ONBOARDING_STEP_KEYS } from '../onboarding/onboarding.js';
|
|
31
|
+
/** The list's query. An emptied search box is "no search", not an error. */
|
|
32
|
+
export const signupListQuerySchema = paginationQuerySchema.extend({
|
|
33
|
+
q: optionalTrimmedString(MEMBER_SEARCH_MAX),
|
|
34
|
+
});
|
|
35
|
+
/**
|
|
36
|
+
* Where their membership purchase stands, from their membership orders:
|
|
37
|
+
*
|
|
38
|
+
* none never started one
|
|
39
|
+
* open a checkout still open (they may be paying right now)
|
|
40
|
+
* failed a checkout that ended unpaid (it expired)
|
|
41
|
+
* paid one paid (or a free coupon), and not refunded
|
|
42
|
+
* refunded the last one was refunded, or is being, and none is paid
|
|
43
|
+
*/
|
|
44
|
+
export const SIGNUP_PAYMENT_VALUES = ['none', 'open', 'failed', 'paid', 'refunded'];
|
|
45
|
+
export const signupPaymentSchema = z.enum(SIGNUP_PAYMENT_VALUES);
|
|
46
|
+
/** One unfinished sign-up. */
|
|
47
|
+
export const signupRowSchema = z.object({
|
|
48
|
+
/** The sign-up's own id (its progress row). */
|
|
49
|
+
id: objectIdSchema,
|
|
50
|
+
/** The account's id. */
|
|
51
|
+
userId: objectIdSchema,
|
|
52
|
+
/** As typed into the basics; null when not saved yet. */
|
|
53
|
+
fullName: z.string().nullable(),
|
|
54
|
+
/** As typed into the basics (spaces and all); null when not saved yet. */
|
|
55
|
+
phone: z.string().nullable(),
|
|
56
|
+
/** The account's email (the sign-in's own). */
|
|
57
|
+
email: z.string(),
|
|
58
|
+
/** The FURTHEST step reached, in today's list (an older cursor translated by name). */
|
|
59
|
+
step: z.enum(ONBOARDING_STEP_KEYS),
|
|
60
|
+
/** Whether they must still buy the membership to go on (the paid step). */
|
|
61
|
+
needsMembership: z.boolean(),
|
|
62
|
+
payment: signupPaymentSchema,
|
|
63
|
+
/** When they started signing up. */
|
|
64
|
+
startedAt: z.iso.datetime(),
|
|
65
|
+
/** When they last saved an answer: the list's order, newest first. */
|
|
66
|
+
lastChangedAt: z.iso.datetime(),
|
|
67
|
+
});
|
|
68
|
+
export const signupPageSchema = paginatedSchema(signupRowSchema);
|
|
69
|
+
//# sourceMappingURL=signups.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signups.js","sourceRoot":"","sources":["../../../src/domains/members/signups.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AACpG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,4EAA4E;AAC5E,MAAM,CAAC,MAAM,qBAAqB,GAAG,qBAAqB,CAAC,MAAM,CAAC;IAChE,CAAC,EAAE,qBAAqB,CAAC,iBAAiB,CAAC;CAC5C,CAAC,CAAC;AAIH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAU,CAAC;AAC7F,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;AAGjE,8BAA8B;AAC9B,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,+CAA+C;IAC/C,EAAE,EAAE,cAAc;IAClB,wBAAwB;IACxB,MAAM,EAAE,cAAc;IACtB,yDAAyD;IACzD,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,0EAA0E;IAC1E,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,+CAA+C;IAC/C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,uFAAuF;IACvF,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC;IAClC,2EAA2E;IAC3E,eAAe,EAAE,CAAC,CAAC,OAAO,EAAE;IAC5B,OAAO,EAAE,mBAAmB;IAC5B,oCAAoC;IACpC,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE;IAC3B,sEAAsE;IACtE,aAAa,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE;CAChC,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,gBAAgB,GAAG,eAAe,CAAC,eAAe,CAAC,CAAC","sourcesContent":["/**\n * founder-schema: unfinished sign-ups, for staff (2026-12-06)\n *\n * GET /api/v1/members/signups ?q&limit&cursor signupPageSchema\n *\n * The people who started signing up and have not finished, newest change\n * first, so staff can call someone who stopped at the payment (the user:\n * \"the manager, the super admin, and then the support agent and other\n * platform roles should be able to see the users' details\"). Every platform\n * role reads it (`read Signup`), a member never.\n *\n * DATA KEPT TO WHAT A CALL NEEDS (DPDP): the name and the phone they typed\n * into sign-up, the account's email, how far they got and whether they paid.\n * Never their date of birth, gender or any other answer. Every page read is\n * audited (`signups.viewed`: who looked and how many rows, never the search).\n *\n * SEARCH (`q`): anything with an `@` is a whole email address, matched\n * exactly; digits are matched inside the phone as typed (spaces and dashes\n * ignored); anything else is the start of any word of the name, in any case.\n * Pageable, search or not.\n *\n * A deleted account is never listed; a suspended one is.\n *\n * @module founder-schema/domains/members/signups\n */\n\nimport { z } from 'zod';\nimport { objectIdSchema, optionalTrimmedString, paginationQuerySchema } from '../../core/common.js';\nimport { MEMBER_SEARCH_MAX } from '../../core/limits.js';\nimport { paginatedSchema } from '../../core/responses.js';\nimport { ONBOARDING_STEP_KEYS } from '../onboarding/onboarding.js';\n\n/** The list's query. An emptied search box is \"no search\", not an error. */\nexport const signupListQuerySchema = paginationQuerySchema.extend({\n q: optionalTrimmedString(MEMBER_SEARCH_MAX),\n});\nexport type SignupListQuery = z.infer<typeof signupListQuerySchema>;\nexport type SignupListQueryInput = z.input<typeof signupListQuerySchema>;\n\n/**\n * Where their membership purchase stands, from their membership orders:\n *\n * none never started one\n * open a checkout still open (they may be paying right now)\n * failed a checkout that ended unpaid (it expired)\n * paid one paid (or a free coupon), and not refunded\n * refunded the last one was refunded, or is being, and none is paid\n */\nexport const SIGNUP_PAYMENT_VALUES = ['none', 'open', 'failed', 'paid', 'refunded'] as const;\nexport const signupPaymentSchema = z.enum(SIGNUP_PAYMENT_VALUES);\nexport type SignupPayment = z.infer<typeof signupPaymentSchema>;\n\n/** One unfinished sign-up. */\nexport const signupRowSchema = z.object({\n /** The sign-up's own id (its progress row). */\n id: objectIdSchema,\n /** The account's id. */\n userId: objectIdSchema,\n /** As typed into the basics; null when not saved yet. */\n fullName: z.string().nullable(),\n /** As typed into the basics (spaces and all); null when not saved yet. */\n phone: z.string().nullable(),\n /** The account's email (the sign-in's own). */\n email: z.string(),\n /** The FURTHEST step reached, in today's list (an older cursor translated by name). */\n step: z.enum(ONBOARDING_STEP_KEYS),\n /** Whether they must still buy the membership to go on (the paid step). */\n needsMembership: z.boolean(),\n payment: signupPaymentSchema,\n /** When they started signing up. */\n startedAt: z.iso.datetime(),\n /** When they last saved an answer: the list's order, newest first. */\n lastChangedAt: z.iso.datetime(),\n});\nexport type SignupRow = z.infer<typeof signupRowSchema>;\n\nexport const signupPageSchema = paginatedSchema(signupRowSchema);\nexport type SignupPage = z.infer<typeof signupPageSchema>;\n"]}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* GET /api/v1/me/membership meMembershipSchema (signed in: what I hold, what I have used)
|
|
6
6
|
*
|
|
7
7
|
* THE USER'S RULING (2026-10-11): looking is free; taking part needs a
|
|
8
|
-
* MEMBERSHIP,
|
|
8
|
+
* MEMBERSHIP, once, for life (`MEMBERSHIP_PRICE_PAISE`; the first 100 free). On top,
|
|
9
9
|
* two PLANS: Premium (5 live products, 15 new people a month to message) and
|
|
10
10
|
* Business (unlimited products, 50 new people). Prices and plan contents come
|
|
11
11
|
* from the server, so a change needs no client release.
|
|
@@ -29,7 +29,7 @@ import { z } from 'zod';
|
|
|
29
29
|
* the user's rule of 2026-10-16). Before that, the founding
|
|
30
30
|
* coupon (`FIRST100`), which no longer exists on main.
|
|
31
31
|
* coupon another free-membership coupon
|
|
32
|
-
* paid
|
|
32
|
+
* paid the membership price, captured
|
|
33
33
|
* granted staff gave it (a partner, a press account), with a reason on record
|
|
34
34
|
* early_bird free for life, because the account was created before
|
|
35
35
|
* `EARLY_BIRD_UNTIL` (0.21.0, the user's launch offer of 2026-11-14:
|
|
@@ -150,8 +150,29 @@ export declare const planFeaturesSchema: z.ZodObject<{
|
|
|
150
150
|
}, z.core.$strip>;
|
|
151
151
|
}, z.core.$strip>;
|
|
152
152
|
export type PlanFeatures = z.infer<typeof planFeaturesSchema>;
|
|
153
|
-
/**
|
|
154
|
-
|
|
153
|
+
/**
|
|
154
|
+
* The membership: once, for life. Its FULL price (the user, 2026-12-06): Rs 2,999,
|
|
155
|
+
* charged from the end of the launch offer below. Before 2026-12-06: Rs 99.
|
|
156
|
+
*/
|
|
157
|
+
export declare const MEMBERSHIP_PRICE_PAISE = 299900;
|
|
158
|
+
/**
|
|
159
|
+
* The launch offer (the user, 2026-12-06): Rs 299 until `endsAt`, with the full
|
|
160
|
+
* price shown struck through and the end date said beside it. The end is REAL:
|
|
161
|
+
* from that instant the full price is charged, by itself (`membershipPriceAt`):
|
|
162
|
+
* a struck price never charged and a "limited time" that never ends would mislead
|
|
163
|
+
* (Consumer Protection Act 2019; CCPA dark-pattern guidelines 2023, "false
|
|
164
|
+
* urgency"). Moving the end is a schema release, and the Terms move with it.
|
|
165
|
+
*/
|
|
166
|
+
export declare const MEMBERSHIP_LAUNCH_OFFER: {
|
|
167
|
+
readonly pricePaise: 29900;
|
|
168
|
+
/** The first instant at the FULL price: 1 January 2027, 00:00 India time. */
|
|
169
|
+
readonly endsAt: "2027-01-01T00:00:00+05:30";
|
|
170
|
+
readonly label: "Launch offer";
|
|
171
|
+
};
|
|
172
|
+
/** Whether the launch offer still runs at `now`. */
|
|
173
|
+
export declare function membershipOfferRuns(now?: Date): boolean;
|
|
174
|
+
/** What the membership costs at `now`, in paise: the offer while it runs, else the full price. */
|
|
175
|
+
export declare function membershipPriceAt(now?: Date): number;
|
|
155
176
|
/** What a member with no plan may: 1 live product, no conversations with people they do not know. */
|
|
156
177
|
export declare const MEMBER_LIMIT_VALUES: PlanLimits;
|
|
157
178
|
/**
|
|
@@ -261,6 +282,9 @@ export declare const planCatalogSchema: z.ZodObject<{
|
|
|
261
282
|
currency: z.ZodLiteral<"INR">;
|
|
262
283
|
membership: z.ZodObject<{
|
|
263
284
|
price: z.ZodNumber;
|
|
285
|
+
listPrice: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
|
|
286
|
+
offer: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
287
|
+
offerEndsAt: z.ZodDefault<z.ZodNullable<z.ZodISODateTime>>;
|
|
264
288
|
limits: z.ZodObject<{
|
|
265
289
|
productsLive: z.ZodNullable<z.ZodNumber>;
|
|
266
290
|
newPeoplePerMonth: z.ZodNumber;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"membership.d.ts","sourceRoot":"","sources":["../../../src/domains/membership/membership.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;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;;;;;iBAuB5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAI5D,eAAO,MAAM,gBAAgB;;;;;;;;;;iBAK3B,CAAC;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAqD7B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* GET /api/v1/me/membership meMembershipSchema (signed in: what I hold, what I have used)
|
|
6
6
|
*
|
|
7
7
|
* THE USER'S RULING (2026-10-11): looking is free; taking part needs a
|
|
8
|
-
* MEMBERSHIP,
|
|
8
|
+
* MEMBERSHIP, once, for life (`MEMBERSHIP_PRICE_PAISE`; the first 100 free). On top,
|
|
9
9
|
* two PLANS: Premium (5 live products, 15 new people a month to message) and
|
|
10
10
|
* Business (unlimited products, 50 new people). Prices and plan contents come
|
|
11
11
|
* from the server, so a change needs no client release.
|
|
@@ -34,7 +34,7 @@ import { paymentMethodSnapshotSchema } from '../billing/payment-method.js';
|
|
|
34
34
|
* the user's rule of 2026-10-16). Before that, the founding
|
|
35
35
|
* coupon (`FIRST100`), which no longer exists on main.
|
|
36
36
|
* coupon another free-membership coupon
|
|
37
|
-
* paid
|
|
37
|
+
* paid the membership price, captured
|
|
38
38
|
* granted staff gave it (a partner, a press account), with a reason on record
|
|
39
39
|
* early_bird free for life, because the account was created before
|
|
40
40
|
* `EARLY_BIRD_UNTIL` (0.21.0, the user's launch offer of 2026-11-14:
|
|
@@ -140,8 +140,33 @@ export const planFeaturesSchema = z.object({
|
|
|
140
140
|
// terms, each cheaper per month, the user's own numbers (2026-11-30): 16, 25 and
|
|
141
141
|
// 40 percent less than the same months bought one by one, and every price a whole
|
|
142
142
|
// rupee a month. Each is written out: never computed from a percent.
|
|
143
|
-
/**
|
|
144
|
-
|
|
143
|
+
/**
|
|
144
|
+
* The membership: once, for life. Its FULL price (the user, 2026-12-06): Rs 2,999,
|
|
145
|
+
* charged from the end of the launch offer below. Before 2026-12-06: Rs 99.
|
|
146
|
+
*/
|
|
147
|
+
export const MEMBERSHIP_PRICE_PAISE = 299_900;
|
|
148
|
+
/**
|
|
149
|
+
* The launch offer (the user, 2026-12-06): Rs 299 until `endsAt`, with the full
|
|
150
|
+
* price shown struck through and the end date said beside it. The end is REAL:
|
|
151
|
+
* from that instant the full price is charged, by itself (`membershipPriceAt`):
|
|
152
|
+
* a struck price never charged and a "limited time" that never ends would mislead
|
|
153
|
+
* (Consumer Protection Act 2019; CCPA dark-pattern guidelines 2023, "false
|
|
154
|
+
* urgency"). Moving the end is a schema release, and the Terms move with it.
|
|
155
|
+
*/
|
|
156
|
+
export const MEMBERSHIP_LAUNCH_OFFER = {
|
|
157
|
+
pricePaise: 29_900,
|
|
158
|
+
/** The first instant at the FULL price: 1 January 2027, 00:00 India time. */
|
|
159
|
+
endsAt: '2027-01-01T00:00:00+05:30',
|
|
160
|
+
label: 'Launch offer',
|
|
161
|
+
};
|
|
162
|
+
/** Whether the launch offer still runs at `now`. */
|
|
163
|
+
export function membershipOfferRuns(now = new Date()) {
|
|
164
|
+
return now.getTime() < Date.parse(MEMBERSHIP_LAUNCH_OFFER.endsAt);
|
|
165
|
+
}
|
|
166
|
+
/** What the membership costs at `now`, in paise: the offer while it runs, else the full price. */
|
|
167
|
+
export function membershipPriceAt(now = new Date()) {
|
|
168
|
+
return membershipOfferRuns(now) ? MEMBERSHIP_LAUNCH_OFFER.pricePaise : MEMBERSHIP_PRICE_PAISE;
|
|
169
|
+
}
|
|
145
170
|
/** What a member with no plan may: 1 live product, no conversations with people they do not know. */
|
|
146
171
|
export const MEMBER_LIMIT_VALUES = { productsLive: 1, newPeoplePerMonth: 0 };
|
|
147
172
|
/**
|
|
@@ -321,8 +346,17 @@ export const planOfferSchema = z.object({
|
|
|
321
346
|
export const planCatalogSchema = z.object({
|
|
322
347
|
currency: z.literal('INR'),
|
|
323
348
|
membership: z.object({
|
|
324
|
-
/** Once, for life, GST included. */
|
|
349
|
+
/** Once, for life, GST included: what is charged NOW. */
|
|
325
350
|
price: paiseSchema,
|
|
351
|
+
/**
|
|
352
|
+
* While an offer runs: the full price (shown struck through), else null
|
|
353
|
+
* (2026-12-06, additive: an older server leaves these out = no offer).
|
|
354
|
+
*/
|
|
355
|
+
listPrice: paiseSchema.nullable().default(null),
|
|
356
|
+
/** The offer's name ("Launch offer"), else null. */
|
|
357
|
+
offer: z.string().min(1).max(60).nullable().default(null),
|
|
358
|
+
/** The offer's end, said beside it: the first instant at the full price. Else null. */
|
|
359
|
+
offerEndsAt: z.iso.datetime({ offset: true }).nullable().default(null),
|
|
326
360
|
limits: planLimitsSchema,
|
|
327
361
|
/** What a member with no plan has unlocked (0.32.0). */
|
|
328
362
|
features: planFeaturesSchema.default(MEMBER_FEATURE_VALUES),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"membership.js","sourceRoot":"","sources":["../../../src/domains/membership/membership.ts"],"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C,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;QACrC;;;;WAIG;QACH,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;KACxC,CAAC;IACF,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC;QACjB,2EAA2E;QAC3E,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;QACpC,4CAA4C;QAC5C,QAAQ,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE;KAC3B,CAAC;IACF,+FAA+F;IAC/F,OAAO,EAAE,oBAAoB,CAAC,QAAQ,EAAE;IACxC;;;;;;OAMG;IACH,gBAAgB,EAAE,kBAAkB,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAC1D;;;;OAIG;IACH,WAAW,EAAE,iBAAiB,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;CACxD,CAAC,CAAC","sourcesContent":["/**\n * founder-schema: membership and plans, as a member holds them (0.12.0)\n *\n * GET /api/v1/plans planCatalogSchema (anyone: prices and what each includes)\n * GET /api/v1/me/membership meMembershipSchema (signed in: what I hold, what I have used)\n *\n * THE USER'S RULING (2026-10-11): looking is free; taking part needs a\n * MEMBERSHIP, Rs 99 once, for life (the first 100 free with a coupon). On top,\n * two PLANS: Premium (5 live products, 15 new people a month to message) and\n * Business (unlimited products, 50 new people). Prices and plan contents come\n * from the server, so a change needs no client release.\n *\n * A PLAN IS TIME, PREPAID, IN TWO BLOCKS: Business time first, then Premium\n * time. Buying more APPENDS; buying Premium while on Business waits its turn;\n * buying Business while on Premium is an upgrade that turns the Premium time\n * left into Business for the difference (`domains/billing`). `blocks` says it\n * as it stands, from now on.\n *\n * Money is integer PAISE everywhere in this package: never a float of rupees.\n *\n * @module founder-schema/domains/membership\n */\n\nimport { z } from 'zod';\nimport { standingSchema } from '../../access/standing.js';\nimport { objectIdSchema } from '../../core/common.js';\nimport { DAY_MS, INDIA_UTC_OFFSET_MS } from '../../core/limits.js';\nimport { billingDetailsSchema, gstStateCodeSchema } from '../billing/gst.js';\nimport { paymentMethodSnapshotSchema } from '../billing/payment-method.js';\n\n/**\n * How someone came to hold a membership. ⚠ Stored: append only.\n *\n * founding free for life, numbered \"Founding member #N\": one of the first\n * `FOUNDING_PLACES` people to join the launch WAITLIST (0.14.0,\n * the user's rule of 2026-10-16). Before that, the founding\n * coupon (`FIRST100`), which no longer exists on main.\n * coupon another free-membership coupon\n * paid Rs 99, captured\n * granted staff gave it (a partner, a press account), with a reason on record\n * early_bird free for life, because the account was created before\n * `EARLY_BIRD_UNTIL` (0.21.0, the user's launch offer of 2026-11-14:\n * everyone who joins before Tue 17 Nov 2026, 12:00 IST), or while\n * payments were not live yet: before the catalog's `paymentsLiveAt`,\n * or with none set (the user, 2026-11-19: whoever joins while\n * payments are \"coming soon\" keeps the membership free for life)\n */\nexport const MEMBERSHIP_KIND_VALUES = [\n 'founding',\n 'coupon',\n 'paid',\n 'granted',\n 'early_bird',\n] as const;\nexport const membershipKindSchema = z.enum(MEMBERSHIP_KIND_VALUES);\nexport type MembershipKind = z.infer<typeof membershipKindSchema>;\n\n/**\n * A stored membership's state (0.20.0: memberships are their own rows, so\n * none is ever erased). `active` is held now, at most one per member; `ended`\n * is history: a refunded payment, a staff revoke, or the account's deletion,\n * said by `MEMBERSHIP_END_REASON_VALUES`.\n */\nexport const MEMBERSHIP_STATUS_VALUES = ['active', 'ended'] as const;\nexport const membershipStatusSchema = z.enum(MEMBERSHIP_STATUS_VALUES);\nexport type MembershipStatus = z.infer<typeof membershipStatusSchema>;\n\nexport const MEMBERSHIP_END_REASON_VALUES = ['refunded', 'revoked', 'account_deleted'] as const;\nexport const membershipEndReasonSchema = z.enum(MEMBERSHIP_END_REASON_VALUES);\nexport type MembershipEndReason = z.infer<typeof membershipEndReasonSchema>;\n\n/** ⚠ Stored: append only. Highest last is NOT implied: compare with `PLAN_TIER_RANK`. */\nexport const PLAN_TIER_VALUES = ['premium', 'business'] as const;\nexport const planTierSchema = z.enum(PLAN_TIER_VALUES);\nexport type PlanTier = z.infer<typeof planTierSchema>;\n\n/** Which tier outranks which: Business above Premium. */\nexport const PLAN_TIER_RANK: Readonly<Record<PlanTier, number>> = { premium: 1, business: 2 };\n\n/**\n * One payment buys 1, 3, 6 or 12 calendar months (four terms: the user,\n * 2026-11-30; a month or a year before). ⚠ Stored: append only, which is why the\n * order here is not the length's: `PLAN_PERIODS_SHORTEST_FIRST` is.\n */\nexport const PLAN_PERIOD_VALUES = ['month', 'year', 'quarter', 'half_year'] as const;\nexport const planPeriodSchema = z.enum(PLAN_PERIOD_VALUES);\nexport type PlanPeriod = z.infer<typeof planPeriodSchema>;\n\n/**\n * How many calendar months each is: the ONE place a period becomes a number.\n * Exhaustive by type, so a term added without its length does not compile.\n * Never `period === 'year' ? 12 : 1`: that grants one month for any new term.\n */\nexport const PLAN_PERIOD_MONTHS: Readonly<Record<PlanPeriod, number>> = {\n month: 1,\n quarter: 3,\n half_year: 6,\n year: 12,\n};\n\n/** The terms as every screen lists them. */\nexport const PLAN_PERIODS_SHORTEST_FIRST: readonly PlanPeriod[] = [...PLAN_PERIOD_VALUES].sort(\n (a, b) => PLAN_PERIOD_MONTHS[a] - PLAN_PERIOD_MONTHS[b],\n);\n\n/** Integer paise, never negative. Rs 399 is 39900. */\nexport const paiseSchema = z.number().int().nonnegative();\nexport type Paise = z.infer<typeof paiseSchema>;\n\n/**\n * What a standing or a plan allows that is COUNTED (the ability says whether;\n * these say how many).\n *\n * productsLive products live at once; null is unlimited (the server\n * still holds a safety ceiling, `PRODUCTS_LIVE_SAFETY_MAX`)\n * newPeoplePerMonth conversations a month with people you do not know\n */\nexport const planLimitsSchema = z.object({\n productsLive: z.number().int().nonnegative().nullable(),\n newPeoplePerMonth: z.number().int().nonnegative(),\n});\nexport type PlanLimits = z.infer<typeof planLimitsSchema>;\n\n/**\n * What a standing or a plan UNLOCKS beyond the counted limits (0.32.0, plans v1;\n * founder-circle-backend docs/plans-v1-features.md, the user 2026-11-28).\n *\n * badge a \"Premium\" / \"Business\" badge on the member's person\n * insightsDays how far back a product's insights go: 0 = the totals only\n * (what a card already shows), else that many days of series\n * insightsSources where a product's visitors came from (Discover, feed...)\n * profileViewersDays who viewed your profile: 0 = the count only, else the\n * names for that many days\n * featured Discover's \"Featured\" row:\n * none not offered\n * monthly_run one run of `runDays` days a calendar\n * month (India time), one product\n * always one product at a time, with no end of its own\n */\nexport const FEATURED_KIND_VALUES = ['none', 'monthly_run', 'always'] as const;\nexport const featuredKindSchema = z.enum(FEATURED_KIND_VALUES);\nexport type FeaturedKind = z.infer<typeof featuredKindSchema>;\n\nexport const planFeaturesSchema = z.object({\n badge: z.boolean(),\n insightsDays: z.number().int().nonnegative(),\n insightsSources: z.boolean(),\n profileViewersDays: z.number().int().nonnegative(),\n featured: z.object({\n kind: featuredKindSchema,\n /** For `monthly_run`: the run's length in days; 0 otherwise. */\n runDays: z.number().int().nonnegative(),\n }),\n});\nexport type PlanFeatures = z.infer<typeof planFeaturesSchema>;\n\n// ─── The price list ──────────────────────────────────────────────────────────\n//\n// THE ONE PLACE a price or a plan's limit is written (0.12.0). The backend\n// prices and counts from these (`modules/plans/catalog.ts`), `GET /plans`\n// serves them, and the web's Terms of Service are written FROM them, so the\n// Terms can never state a price the server does not charge. A change here is\n// a schema release, then the backend, then the web. Integer PAISE, GST\n// included. hary's India-first prices (the user: \"you decide, India first\"); four\n// terms, each cheaper per month, the user's own numbers (2026-11-30): 16, 25 and\n// 40 percent less than the same months bought one by one, and every price a whole\n// rupee a month. Each is written out: never computed from a percent.\n\n/** The membership: once, for life. */\nexport const MEMBERSHIP_PRICE_PAISE = 9_900;\n\n/** What a member with no plan may: 1 live product, no conversations with people they do not know. */\nexport const MEMBER_LIMIT_VALUES: PlanLimits = { productsLive: 1, newPeoplePerMonth: 0 };\n\n/**\n * What a member with no plan has unlocked (0.32.0): no badge, a product's totals\n * only, the COUNT of who viewed them (last 30 days), nothing featured.\n */\nexport const MEMBER_FEATURE_VALUES: PlanFeatures = {\n badge: false,\n insightsDays: 0,\n insightsSources: false,\n profileViewersDays: 0,\n featured: { kind: 'none', runDays: 0 },\n};\n\n/** Each plan's name, prices, limits and features. Exhaustive by type. */\nexport const PLAN_SPECS: Readonly<\n Record<\n PlanTier,\n {\n name: string;\n prices: Readonly<Record<PlanPeriod, number>>;\n limits: PlanLimits;\n features: PlanFeatures;\n }\n >\n> = {\n premium: {\n name: 'Premium',\n // 399, 333, 299 and 239 a month.\n prices: { month: 39_900, quarter: 99_900, half_year: 179_400, year: 286_800 },\n limits: { productsLive: 5, newPeoplePerMonth: 15 },\n features: {\n badge: true,\n insightsDays: 30,\n insightsSources: false,\n profileViewersDays: 30,\n featured: { kind: 'monthly_run', runDays: 7 },\n },\n },\n business: {\n name: 'Business',\n // 999, 833, 749 and 599 a month.\n prices: { month: 99_900, quarter: 249_900, half_year: 449_400, year: 718_800 },\n limits: { productsLive: null, newPeoplePerMonth: 50 },\n features: {\n badge: true,\n insightsDays: 90,\n insightsSources: true,\n profileViewersDays: 90,\n featured: { kind: 'always', runDays: 0 },\n },\n },\n};\n\n/** The number of days a member (no plan) is told \"N people viewed your profile\" over. */\nexport const MEMBER_PROFILE_VIEW_COUNT_DAYS = 30;\n\n// ─── Plan time on India's calendar, and an upgrade's price (0.18.0) ──────────\n//\n// Moved here from the backend's plan timeline so the price a member is charged\n// and the rule the Terms of Service state are ONE function: the Terms said\n// \"Rs 20 a day for the rest\" for a week after the server stopped charging it\n// (2026-10-13).\n\n/**\n * A term later on India's calendar (`count` of them), the day clamped to the\n * month's last: 31 January plus a month is 28 or 29 February. India has one\n * offset all year, so its calendar is UTC's, shifted.\n */\nexport function addPlanPeriod(from: Date, period: PlanPeriod, count = 1): Date {\n const months = PLAN_PERIOD_MONTHS[period] * count;\n const local = new Date(from.getTime() + INDIA_UTC_OFFSET_MS);\n const m = local.getUTCMonth() + months;\n const targetYear = local.getUTCFullYear() + Math.floor(m / 12);\n const targetMonth = ((m % 12) + 12) % 12;\n const lastDay = new Date(Date.UTC(targetYear, targetMonth + 1, 0)).getUTCDate();\n const shifted = Date.UTC(\n targetYear,\n targetMonth,\n Math.min(local.getUTCDate(), lastDay),\n local.getUTCHours(),\n local.getUTCMinutes(),\n local.getUTCSeconds(),\n local.getUTCMilliseconds(),\n );\n return new Date(shifted - INDIA_UTC_OFFSET_MS);\n}\n\n/**\n * What an upgrade costs for each whole term of Premium left: what that term\n * costs on Business less what it costs on Premium, at today's prices. The one\n * source of every upgrade price, and of the Terms' sentence.\n */\nexport const UPGRADE_PER: Readonly<Record<PlanPeriod, number>> = {\n month: PLAN_SPECS.business.prices.month - PLAN_SPECS.premium.prices.month,\n quarter: PLAN_SPECS.business.prices.quarter - PLAN_SPECS.premium.prices.quarter,\n half_year: PLAN_SPECS.business.prices.half_year - PLAN_SPECS.premium.prices.half_year,\n year: PLAN_SPECS.business.prices.year - PLAN_SPECS.premium.prices.year,\n};\n/** ...each whole calendar year of it. */\nexport const UPGRADE_PER_YEAR = UPGRADE_PER.year;\n/** ...each whole calendar month of it (a 31-day month and February alike). */\nexport const UPGRADE_PER_MONTH = UPGRADE_PER.month;\n/** The days left over are charged as this many to a month. */\nexport const UPGRADE_DAYS_PER_MONTH = 30;\n/** ...so each day left over costs this, never more than `UPGRADE_PER_MONTH` for them all. */\nexport const UPGRADE_PER_DAY = UPGRADE_PER_MONTH / UPGRADE_DAYS_PER_MONTH;\n\n/**\n * What `months` whole months and `days` left over cost to upgrade: the largest\n * whole term first (a year, then 6 months, 3 months, a month, then days), and\n * what is left after any piece never costs more than ONE more of it. So it is\n * the cheapest cover of the time by whole terms, it never falls as the time\n * grows, and it is, to the paisa, what that time costs on Business less what it\n * costs on Premium, each at its cheapest (docs/plans-four-terms.md, proved on\n * every day to 3 years). Buying Premium and upgrading at once therefore costs\n * exactly what buying Business does: no way round, and no overcharge.\n */\nfunction upgradeCover(months: number, days: number): number {\n const longestFirst = [...PLAN_PERIODS_SHORTEST_FIRST].reverse();\n const cover = (left: number, at: number): number => {\n const period = longestFirst[at];\n if (period === undefined) return days * UPGRADE_PER_DAY;\n const whole = Math.floor(left / PLAN_PERIOD_MONTHS[period]);\n const rest = cover(left - whole * PLAN_PERIOD_MONTHS[period], at + 1);\n return whole * UPGRADE_PER[period] + Math.min(rest, UPGRADE_PER[period]);\n };\n return cover(months, 0);\n}\n\n/**\n * What an upgrade of `convertedMs` of Premium, from `now`, costs in paise (the\n * user: \"ask for the rest of the money, the difference\"): `upgradeCover` of its\n * whole calendar months and the days left over. A part day counts as a day;\n * rounded up to the rupee. What each part was BOUGHT at is not read, and not\n * stored: refunds, stacking and Business put in front move time, and \"today's\n * prices for the time left\" is one sentence a member can check.\n */\nexport function upgradePrice(convertedMs: number, now: Date): number {\n const end = now.getTime() + Math.max(convertedMs, 1);\n let months = 0;\n while (addPlanPeriod(now, 'month', months + 1).getTime() <= end) months += 1;\n const days = Math.ceil((end - addPlanPeriod(now, 'month', months).getTime()) / DAY_MS);\n return Math.ceil(upgradeCover(months, days) / 100) * 100;\n}\n\n/**\n * Free founding memberships (0.14.0): the first 100 people to join the launch\n * waitlist get their membership free, numbered #1 to #100 by their place\n * (the user, 2026-10-16). Everyone else pays `MEMBERSHIP_PRICE_PAISE` once.\n * No code gives a founding place any more.\n */\nexport const FOUNDING_PLACES = 100;\n\n/**\n * THE EARLY-BIRD OFFER (0.21.0; the user, 2026-11-14): everyone whose Founder\n * Circle account was CREATED before this instant gets the membership free, for\n * life, with no code and no limit on how many. After it, the membership costs\n * `MEMBERSHIP_PRICE_PAISE` as before.\n *\n * Tue 17 Nov 2026, 12:00 IST. The ONE place it is written: the server grants\n * from it (`isEarlyBird`), and the web's landing, pricing, membership screen,\n * Terms and llms.txt word the offer from it and stop offering it at this\n * instant. Moving it is a schema release, like a price.\n *\n * The server grants the same free membership to an account created while\n * payments are not live (before the catalog's `paymentsLiveAt`, or with none\n * set; the user, 2026-11-19). That rule is the server's: `isEarlyBird` here\n * answers for this instant alone.\n */\nexport const EARLY_BIRD_UNTIL = '2026-11-17T06:30:00.000Z';\n\nconst EARLY_BIRD_UNTIL_MS = Date.parse(EARLY_BIRD_UNTIL);\n\n/** Whether an account created at `createdAt` gets the early-bird membership. */\nexport function isEarlyBird(createdAt: Date | string | number): boolean {\n const at = createdAt instanceof Date ? createdAt.getTime() : new Date(createdAt).getTime();\n return Number.isFinite(at) && at < EARLY_BIRD_UNTIL_MS;\n}\n\n/** Whether the offer is still open at `now`: what the pages show. */\nexport function earlyBirdOpen(now: Date | number = Date.now()): boolean {\n return (now instanceof Date ? now.getTime() : now) < EARLY_BIRD_UNTIL_MS;\n}\n\n// ─── GET /plans ──────────────────────────────────────────────────────────────\n\nexport const planOfferSchema = z.object({\n tier: planTierSchema,\n /** \"Premium\", \"Business\": the server's word, so a rename needs no client release. */\n name: z.string(),\n /**\n * One price for each term, GST included. All four REQUIRED: a server that does\n * not sell one is older than the client reading this, so the server ships\n * first. (An object of two would have stripped the other two silently.)\n */\n prices: z.object({\n month: paiseSchema,\n quarter: paiseSchema,\n half_year: paiseSchema,\n year: paiseSchema,\n } satisfies Record<PlanPeriod, typeof paiseSchema>),\n limits: planLimitsSchema,\n /** What it unlocks (0.32.0). Defaults to the member's when an older server leaves it out. */\n features: planFeaturesSchema.default(MEMBER_FEATURE_VALUES),\n});\nexport type PlanOffer = z.infer<typeof planOfferSchema>;\n\nexport const planCatalogSchema = z.object({\n currency: z.literal('INR'),\n membership: z.object({\n /** Once, for life, GST included. */\n price: paiseSchema,\n limits: planLimitsSchema,\n /** What a member with no plan has unlocked (0.32.0). */\n features: planFeaturesSchema.default(MEMBER_FEATURE_VALUES),\n }),\n /** Lowest first. */\n plans: z.array(planOfferSchema),\n /** Every purchase is refunded in full within this many days of paying. */\n refundWindowDays: z.number().int().positive(),\n /**\n * Whether payments are LIVE here now: the server's `PAYMENTS_LIVE_AT` is set\n * and has passed, and its gateway is configured. While false, plans and\n * payments are \"coming soon\": a client shows no price, plan, pay button or\n * code box, and every quote and order (a free code's too) answers\n * `PAYMENTS_UNAVAILABLE` (the user, 2026-11-19).\n */\n paymentsEnabled: z.boolean(),\n /**\n * The instant payments go (or went) live, or null while none is set. Every\n * account CREATED before it, or while it is null, holds the membership free\n * for life (kind `early_bird`), so the Terms state it as a date. Defaults to\n * null when an older server leaves it out, so a client can ship first.\n */\n paymentsLiveAt: z.iso.datetime().nullable().default(null),\n /**\n * Whether a plan may renew AUTOMATICALLY here (0.31.0, payments v2). The\n * server's two keys: its `SUBSCRIPTIONS_ENABLED` is set AND its gateway plans\n * resolve, and payments are live. While false a client offers no\n * \"Renew automatically\" switch: every plan is prepaid. Defaults to false\n * when an older server leaves it out.\n */\n autoRenewEnabled: z.boolean().default(false),\n /**\n * WHICH terms may renew automatically here (four terms, 2026-11-30): the\n * server's fact, never assumed from the list of terms. A client offers the\n * switch only for one in it, and only while `autoRenewEnabled`; any other is\n * prepaid, and says so. Empty while subscriptions are off. A term joins it by\n * a server change alone, once its recurring charge is PROVED on each payment\n * method. Defaults to the two that always could when an older server leaves\n * it out.\n */\n autoRenewPeriods: z.array(planPeriodSchema).default(['month', 'year']),\n});\nexport type PlanCatalog = z.infer<typeof planCatalogSchema>;\n\n// ─── Auto-renewal (0.31.0, payments v2) ──────────────────────────────────────\n//\n// The user, 2026-11-25: plans RENEW AUTOMATICALLY BY DEFAULT, and the member can\n// turn it off (founder-circle-backend docs/payments-v2-plan.md, section 3a). An\n// auto-renewal is a Razorpay subscription for one tier and period: each charge\n// it makes is an ORDER that buys one period, appended to the blocks exactly as\n// a manual purchase is (same invoice, same 7-day refund). It adds time only\n// when a charge lands, so a failed charge takes nothing away: the plan ends\n// when its time runs out, as a prepaid one does.\n\n/**\n * Where an auto-renewal stands: Razorpay's subscription states, as it names\n * them. ⚠ Stored: append only.\n *\n * created made, waiting for the member to authorise it at Checkout\n * authenticated authorised; its first charge is on a later date (it starts\n * when the time already held ends)\n * active charging each period\n * pending a charge failed; Razorpay is retrying (T+1 to T+3 days)\n * halted every retry failed: no more charges (auto-renew is off)\n * cancelled turned off (at the end of the period, or at once after a\n * refund), or replaced\n * completed its cycles ran out\n * expired never authorised in time\n * paused paused at the gateway (Founder Circle never pauses one)\n */\nexport const AUTO_RENEWAL_STATUS_VALUES = [\n 'created',\n 'authenticated',\n 'active',\n 'pending',\n 'halted',\n 'cancelled',\n 'completed',\n 'expired',\n 'paused',\n] as const;\nexport const autoRenewalStatusSchema = z.enum(AUTO_RENEWAL_STATUS_VALUES);\nexport type AutoRenewalStatus = z.infer<typeof autoRenewalStatusSchema>;\n\n/** The statuses in which an auto-renewal will still charge (or is about to). */\nexport const AUTO_RENEWAL_RUNNING_VALUES = [\n 'authenticated',\n 'active',\n 'pending',\n] as const satisfies readonly AutoRenewalStatus[];\n\n/**\n * A member's auto-renewal, as `GET /me/membership` shows it: at most one, the\n * running one (null when none runs).\n */\nexport const autoRenewalSchema = z.object({\n id: objectIdSchema,\n status: autoRenewalStatusSchema,\n tier: planTierSchema,\n period: planPeriodSchema,\n /** What each charge takes, GST included: the price it was started at, kept. */\n amount: paiseSchema,\n /** When the next charge is due; null when none will come (turned off, halted). */\n nextChargeAt: z.iso.datetime().nullable(),\n /** Turned off: no more charges; the time already paid stays until it ends. */\n cancelAtCycleEnd: z.boolean(),\n /** How it pays, as last charged or authorised; null before the gateway says. */\n method: paymentMethodSnapshotSchema.nullable(),\n /** A failed charge (`pending`) can be fixed by updating the method. */\n canUpdateMethod: z.boolean(),\n /**\n * In the renewal grace (`RENEWAL_GRACE_DAYS`): the time held has ended and\n * the charge is awaited, so the tier stays in force until this instant.\n * Null outside it. A client says \"your renewal is being processed; your\n * plan stays active until <date>\" (or, with `status: 'pending'`, that the\n * charge failed and is being retried).\n */\n graceUntil: z.iso.datetime().nullable().default(null),\n});\nexport type AutoRenewal = z.infer<typeof autoRenewalSchema>;\n\n// ─── GET /me/membership ──────────────────────────────────────────────────────\n\nexport const membershipSchema = z.object({\n kind: membershipKindSchema,\n since: z.iso.datetime(),\n /** \"Founding member #N\": set only for `founding`. */\n foundingNumber: z.number().int().positive().nullable(),\n});\nexport type Membership = z.infer<typeof membershipSchema>;\n\n/** A stretch of one tier. Blocks never overlap and follow each other with no gap. */\nexport const planBlockSchema = z.object({\n tier: planTierSchema,\n startsAt: z.iso.datetime(),\n endsAt: z.iso.datetime(),\n});\nexport type PlanBlock = z.infer<typeof planBlockSchema>;\n\n/** Why someone takes part: their membership, or a staff role (staff are members). */\nexport const TAKES_PART_THROUGH_VALUES = ['membership', 'staff'] as const;\nexport type TakesPartThrough = (typeof TAKES_PART_THROUGH_VALUES)[number];\n\nexport const meMembershipSchema = z.object({\n standing: standingSchema,\n /** Null for a viewer, and for staff who hold none (they take part through their role). */\n membership: membershipSchema.nullable(),\n /** Why they take part: their membership, or a staff role (staff are members). Null for a viewer. */\n through: z.enum(TAKES_PART_THROUGH_VALUES).nullable(),\n plan: z.object({\n /** The tier in force now; null with no plan. */\n tier: planTierSchema.nullable(),\n /** From now on, Business first, then Premium. Empty with no plan. */\n blocks: z.array(planBlockSchema),\n }),\n limits: planLimitsSchema,\n /**\n * What the plan in force unlocks (0.32.0), with the renewal grace, and the\n * top plan's while payments are off, as `limits`. Defaults to the member's\n * when an older server leaves it out.\n */\n features: planFeaturesSchema.default(MEMBER_FEATURE_VALUES),\n products: z.object({\n /** Products they own that are live now. */\n live: z.number().int().nonnegative(),\n /** Products they own, paused ones included. */\n owned: z.number().int().nonnegative(),\n /**\n * What adding another counts against (0.13.0): live ones and the ones\n * they paused themselves, not those a plan's end paused. \"Add a product\"\n * stops when this reaches `limits.productsLive`: pausing never makes room.\n */\n counted: z.number().int().nonnegative(),\n }),\n messages: z.object({\n /** New people they started a conversation with this month (India time). */\n used: z.number().int().nonnegative(),\n /** When this month's count starts again. */\n resetsAt: z.iso.datetime(),\n }),\n /** The billing details they last used, to prefill the next checkout; null before the first. */\n billing: billingDetailsSchema.nullable(),\n /**\n * A first checkout's state, SUGGESTED (2026-11-30): the state of the member's own\n * profile location, only while they have no `billing` to prefill from. The\n * invoice of every online sale names the buyer's state (GST), so it is asked\n * once; this fills it in, and the member can change it before they pay. Never\n * stored by being suggested. Null when there is none; absent from an older server.\n */\n billingStateHint: gstStateCodeSchema.nullable().optional(),\n /**\n * The auto-renewal that runs (0.31.0): authorised, charging, or retrying a\n * failed charge. Null when none does. Defaults to null when an older server\n * leaves it out.\n */\n autoRenewal: autoRenewalSchema.nullable().default(null),\n});\nexport type MeMembership = z.infer<typeof meMembershipSchema>;\n"]}
|
|
1
|
+
{"version":3,"file":"membership.js","sourceRoot":"","sources":["../../../src/domains/membership/membership.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAE3E;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,UAAU;IACV,QAAQ;IACR,MAAM;IACN,SAAS;IACT,YAAY;CACJ,CAAC;AACX,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;AAGnE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAU,CAAC;AACrE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;AAGvE,MAA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,CAAC;QACjB,2CAA2C;QAC3C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;QACpC,+CAA+C;QAC/C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;QACrC;;;;WAIG;QACH,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;KACxC,CAAC;IACF,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC;QACjB,2EAA2E;QAC3E,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;QACpC,4CAA4C;QAC5C,QAAQ,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE;KAC3B,CAAC;IACF,+FAA+F;IAC/F,OAAO,EAAE,oBAAoB,CAAC,QAAQ,EAAE;IACxC;;;;;;OAMG;IACH,gBAAgB,EAAE,kBAAkB,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAC1D;;;;OAIG;IACH,WAAW,EAAE,iBAAiB,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;CACxD,CAAC,CAAC","sourcesContent":["/**\n * founder-schema: membership and plans, as a member holds them (0.12.0)\n *\n * GET /api/v1/plans planCatalogSchema (anyone: prices and what each includes)\n * GET /api/v1/me/membership meMembershipSchema (signed in: what I hold, what I have used)\n *\n * THE USER'S RULING (2026-10-11): looking is free; taking part needs a\n * MEMBERSHIP, once, for life (`MEMBERSHIP_PRICE_PAISE`; the first 100 free). On top,\n * two PLANS: Premium (5 live products, 15 new people a month to message) and\n * Business (unlimited products, 50 new people). Prices and plan contents come\n * from the server, so a change needs no client release.\n *\n * A PLAN IS TIME, PREPAID, IN TWO BLOCKS: Business time first, then Premium\n * time. Buying more APPENDS; buying Premium while on Business waits its turn;\n * buying Business while on Premium is an upgrade that turns the Premium time\n * left into Business for the difference (`domains/billing`). `blocks` says it\n * as it stands, from now on.\n *\n * Money is integer PAISE everywhere in this package: never a float of rupees.\n *\n * @module founder-schema/domains/membership\n */\n\nimport { z } from 'zod';\nimport { standingSchema } from '../../access/standing.js';\nimport { objectIdSchema } from '../../core/common.js';\nimport { DAY_MS, INDIA_UTC_OFFSET_MS } from '../../core/limits.js';\nimport { billingDetailsSchema, gstStateCodeSchema } from '../billing/gst.js';\nimport { paymentMethodSnapshotSchema } from '../billing/payment-method.js';\n\n/**\n * How someone came to hold a membership. ⚠ Stored: append only.\n *\n * founding free for life, numbered \"Founding member #N\": one of the first\n * `FOUNDING_PLACES` people to join the launch WAITLIST (0.14.0,\n * the user's rule of 2026-10-16). Before that, the founding\n * coupon (`FIRST100`), which no longer exists on main.\n * coupon another free-membership coupon\n * paid the membership price, captured\n * granted staff gave it (a partner, a press account), with a reason on record\n * early_bird free for life, because the account was created before\n * `EARLY_BIRD_UNTIL` (0.21.0, the user's launch offer of 2026-11-14:\n * everyone who joins before Tue 17 Nov 2026, 12:00 IST), or while\n * payments were not live yet: before the catalog's `paymentsLiveAt`,\n * or with none set (the user, 2026-11-19: whoever joins while\n * payments are \"coming soon\" keeps the membership free for life)\n */\nexport const MEMBERSHIP_KIND_VALUES = [\n 'founding',\n 'coupon',\n 'paid',\n 'granted',\n 'early_bird',\n] as const;\nexport const membershipKindSchema = z.enum(MEMBERSHIP_KIND_VALUES);\nexport type MembershipKind = z.infer<typeof membershipKindSchema>;\n\n/**\n * A stored membership's state (0.20.0: memberships are their own rows, so\n * none is ever erased). `active` is held now, at most one per member; `ended`\n * is history: a refunded payment, a staff revoke, or the account's deletion,\n * said by `MEMBERSHIP_END_REASON_VALUES`.\n */\nexport const MEMBERSHIP_STATUS_VALUES = ['active', 'ended'] as const;\nexport const membershipStatusSchema = z.enum(MEMBERSHIP_STATUS_VALUES);\nexport type MembershipStatus = z.infer<typeof membershipStatusSchema>;\n\nexport const MEMBERSHIP_END_REASON_VALUES = ['refunded', 'revoked', 'account_deleted'] as const;\nexport const membershipEndReasonSchema = z.enum(MEMBERSHIP_END_REASON_VALUES);\nexport type MembershipEndReason = z.infer<typeof membershipEndReasonSchema>;\n\n/** ⚠ Stored: append only. Highest last is NOT implied: compare with `PLAN_TIER_RANK`. */\nexport const PLAN_TIER_VALUES = ['premium', 'business'] as const;\nexport const planTierSchema = z.enum(PLAN_TIER_VALUES);\nexport type PlanTier = z.infer<typeof planTierSchema>;\n\n/** Which tier outranks which: Business above Premium. */\nexport const PLAN_TIER_RANK: Readonly<Record<PlanTier, number>> = { premium: 1, business: 2 };\n\n/**\n * One payment buys 1, 3, 6 or 12 calendar months (four terms: the user,\n * 2026-11-30; a month or a year before). ⚠ Stored: append only, which is why the\n * order here is not the length's: `PLAN_PERIODS_SHORTEST_FIRST` is.\n */\nexport const PLAN_PERIOD_VALUES = ['month', 'year', 'quarter', 'half_year'] as const;\nexport const planPeriodSchema = z.enum(PLAN_PERIOD_VALUES);\nexport type PlanPeriod = z.infer<typeof planPeriodSchema>;\n\n/**\n * How many calendar months each is: the ONE place a period becomes a number.\n * Exhaustive by type, so a term added without its length does not compile.\n * Never `period === 'year' ? 12 : 1`: that grants one month for any new term.\n */\nexport const PLAN_PERIOD_MONTHS: Readonly<Record<PlanPeriod, number>> = {\n month: 1,\n quarter: 3,\n half_year: 6,\n year: 12,\n};\n\n/** The terms as every screen lists them. */\nexport const PLAN_PERIODS_SHORTEST_FIRST: readonly PlanPeriod[] = [...PLAN_PERIOD_VALUES].sort(\n (a, b) => PLAN_PERIOD_MONTHS[a] - PLAN_PERIOD_MONTHS[b],\n);\n\n/** Integer paise, never negative. Rs 399 is 39900. */\nexport const paiseSchema = z.number().int().nonnegative();\nexport type Paise = z.infer<typeof paiseSchema>;\n\n/**\n * What a standing or a plan allows that is COUNTED (the ability says whether;\n * these say how many).\n *\n * productsLive products live at once; null is unlimited (the server\n * still holds a safety ceiling, `PRODUCTS_LIVE_SAFETY_MAX`)\n * newPeoplePerMonth conversations a month with people you do not know\n */\nexport const planLimitsSchema = z.object({\n productsLive: z.number().int().nonnegative().nullable(),\n newPeoplePerMonth: z.number().int().nonnegative(),\n});\nexport type PlanLimits = z.infer<typeof planLimitsSchema>;\n\n/**\n * What a standing or a plan UNLOCKS beyond the counted limits (0.32.0, plans v1;\n * founder-circle-backend docs/plans-v1-features.md, the user 2026-11-28).\n *\n * badge a \"Premium\" / \"Business\" badge on the member's person\n * insightsDays how far back a product's insights go: 0 = the totals only\n * (what a card already shows), else that many days of series\n * insightsSources where a product's visitors came from (Discover, feed...)\n * profileViewersDays who viewed your profile: 0 = the count only, else the\n * names for that many days\n * featured Discover's \"Featured\" row:\n * none not offered\n * monthly_run one run of `runDays` days a calendar\n * month (India time), one product\n * always one product at a time, with no end of its own\n */\nexport const FEATURED_KIND_VALUES = ['none', 'monthly_run', 'always'] as const;\nexport const featuredKindSchema = z.enum(FEATURED_KIND_VALUES);\nexport type FeaturedKind = z.infer<typeof featuredKindSchema>;\n\nexport const planFeaturesSchema = z.object({\n badge: z.boolean(),\n insightsDays: z.number().int().nonnegative(),\n insightsSources: z.boolean(),\n profileViewersDays: z.number().int().nonnegative(),\n featured: z.object({\n kind: featuredKindSchema,\n /** For `monthly_run`: the run's length in days; 0 otherwise. */\n runDays: z.number().int().nonnegative(),\n }),\n});\nexport type PlanFeatures = z.infer<typeof planFeaturesSchema>;\n\n// ─── The price list ──────────────────────────────────────────────────────────\n//\n// THE ONE PLACE a price or a plan's limit is written (0.12.0). The backend\n// prices and counts from these (`modules/plans/catalog.ts`), `GET /plans`\n// serves them, and the web's Terms of Service are written FROM them, so the\n// Terms can never state a price the server does not charge. A change here is\n// a schema release, then the backend, then the web. Integer PAISE, GST\n// included. hary's India-first prices (the user: \"you decide, India first\"); four\n// terms, each cheaper per month, the user's own numbers (2026-11-30): 16, 25 and\n// 40 percent less than the same months bought one by one, and every price a whole\n// rupee a month. Each is written out: never computed from a percent.\n\n/**\n * The membership: once, for life. Its FULL price (the user, 2026-12-06): Rs 2,999,\n * charged from the end of the launch offer below. Before 2026-12-06: Rs 99.\n */\nexport const MEMBERSHIP_PRICE_PAISE = 299_900;\n\n/**\n * The launch offer (the user, 2026-12-06): Rs 299 until `endsAt`, with the full\n * price shown struck through and the end date said beside it. The end is REAL:\n * from that instant the full price is charged, by itself (`membershipPriceAt`):\n * a struck price never charged and a \"limited time\" that never ends would mislead\n * (Consumer Protection Act 2019; CCPA dark-pattern guidelines 2023, \"false\n * urgency\"). Moving the end is a schema release, and the Terms move with it.\n */\nexport const MEMBERSHIP_LAUNCH_OFFER = {\n pricePaise: 29_900,\n /** The first instant at the FULL price: 1 January 2027, 00:00 India time. */\n endsAt: '2027-01-01T00:00:00+05:30',\n label: 'Launch offer',\n} as const;\n\n/** Whether the launch offer still runs at `now`. */\nexport function membershipOfferRuns(now: Date = new Date()): boolean {\n return now.getTime() < Date.parse(MEMBERSHIP_LAUNCH_OFFER.endsAt);\n}\n\n/** What the membership costs at `now`, in paise: the offer while it runs, else the full price. */\nexport function membershipPriceAt(now: Date = new Date()): number {\n return membershipOfferRuns(now) ? MEMBERSHIP_LAUNCH_OFFER.pricePaise : MEMBERSHIP_PRICE_PAISE;\n}\n\n/** What a member with no plan may: 1 live product, no conversations with people they do not know. */\nexport const MEMBER_LIMIT_VALUES: PlanLimits = { productsLive: 1, newPeoplePerMonth: 0 };\n\n/**\n * What a member with no plan has unlocked (0.32.0): no badge, a product's totals\n * only, the COUNT of who viewed them (last 30 days), nothing featured.\n */\nexport const MEMBER_FEATURE_VALUES: PlanFeatures = {\n badge: false,\n insightsDays: 0,\n insightsSources: false,\n profileViewersDays: 0,\n featured: { kind: 'none', runDays: 0 },\n};\n\n/** Each plan's name, prices, limits and features. Exhaustive by type. */\nexport const PLAN_SPECS: Readonly<\n Record<\n PlanTier,\n {\n name: string;\n prices: Readonly<Record<PlanPeriod, number>>;\n limits: PlanLimits;\n features: PlanFeatures;\n }\n >\n> = {\n premium: {\n name: 'Premium',\n // 399, 333, 299 and 239 a month.\n prices: { month: 39_900, quarter: 99_900, half_year: 179_400, year: 286_800 },\n limits: { productsLive: 5, newPeoplePerMonth: 15 },\n features: {\n badge: true,\n insightsDays: 30,\n insightsSources: false,\n profileViewersDays: 30,\n featured: { kind: 'monthly_run', runDays: 7 },\n },\n },\n business: {\n name: 'Business',\n // 999, 833, 749 and 599 a month.\n prices: { month: 99_900, quarter: 249_900, half_year: 449_400, year: 718_800 },\n limits: { productsLive: null, newPeoplePerMonth: 50 },\n features: {\n badge: true,\n insightsDays: 90,\n insightsSources: true,\n profileViewersDays: 90,\n featured: { kind: 'always', runDays: 0 },\n },\n },\n};\n\n/** The number of days a member (no plan) is told \"N people viewed your profile\" over. */\nexport const MEMBER_PROFILE_VIEW_COUNT_DAYS = 30;\n\n// ─── Plan time on India's calendar, and an upgrade's price (0.18.0) ──────────\n//\n// Moved here from the backend's plan timeline so the price a member is charged\n// and the rule the Terms of Service state are ONE function: the Terms said\n// \"Rs 20 a day for the rest\" for a week after the server stopped charging it\n// (2026-10-13).\n\n/**\n * A term later on India's calendar (`count` of them), the day clamped to the\n * month's last: 31 January plus a month is 28 or 29 February. India has one\n * offset all year, so its calendar is UTC's, shifted.\n */\nexport function addPlanPeriod(from: Date, period: PlanPeriod, count = 1): Date {\n const months = PLAN_PERIOD_MONTHS[period] * count;\n const local = new Date(from.getTime() + INDIA_UTC_OFFSET_MS);\n const m = local.getUTCMonth() + months;\n const targetYear = local.getUTCFullYear() + Math.floor(m / 12);\n const targetMonth = ((m % 12) + 12) % 12;\n const lastDay = new Date(Date.UTC(targetYear, targetMonth + 1, 0)).getUTCDate();\n const shifted = Date.UTC(\n targetYear,\n targetMonth,\n Math.min(local.getUTCDate(), lastDay),\n local.getUTCHours(),\n local.getUTCMinutes(),\n local.getUTCSeconds(),\n local.getUTCMilliseconds(),\n );\n return new Date(shifted - INDIA_UTC_OFFSET_MS);\n}\n\n/**\n * What an upgrade costs for each whole term of Premium left: what that term\n * costs on Business less what it costs on Premium, at today's prices. The one\n * source of every upgrade price, and of the Terms' sentence.\n */\nexport const UPGRADE_PER: Readonly<Record<PlanPeriod, number>> = {\n month: PLAN_SPECS.business.prices.month - PLAN_SPECS.premium.prices.month,\n quarter: PLAN_SPECS.business.prices.quarter - PLAN_SPECS.premium.prices.quarter,\n half_year: PLAN_SPECS.business.prices.half_year - PLAN_SPECS.premium.prices.half_year,\n year: PLAN_SPECS.business.prices.year - PLAN_SPECS.premium.prices.year,\n};\n/** ...each whole calendar year of it. */\nexport const UPGRADE_PER_YEAR = UPGRADE_PER.year;\n/** ...each whole calendar month of it (a 31-day month and February alike). */\nexport const UPGRADE_PER_MONTH = UPGRADE_PER.month;\n/** The days left over are charged as this many to a month. */\nexport const UPGRADE_DAYS_PER_MONTH = 30;\n/** ...so each day left over costs this, never more than `UPGRADE_PER_MONTH` for them all. */\nexport const UPGRADE_PER_DAY = UPGRADE_PER_MONTH / UPGRADE_DAYS_PER_MONTH;\n\n/**\n * What `months` whole months and `days` left over cost to upgrade: the largest\n * whole term first (a year, then 6 months, 3 months, a month, then days), and\n * what is left after any piece never costs more than ONE more of it. So it is\n * the cheapest cover of the time by whole terms, it never falls as the time\n * grows, and it is, to the paisa, what that time costs on Business less what it\n * costs on Premium, each at its cheapest (docs/plans-four-terms.md, proved on\n * every day to 3 years). Buying Premium and upgrading at once therefore costs\n * exactly what buying Business does: no way round, and no overcharge.\n */\nfunction upgradeCover(months: number, days: number): number {\n const longestFirst = [...PLAN_PERIODS_SHORTEST_FIRST].reverse();\n const cover = (left: number, at: number): number => {\n const period = longestFirst[at];\n if (period === undefined) return days * UPGRADE_PER_DAY;\n const whole = Math.floor(left / PLAN_PERIOD_MONTHS[period]);\n const rest = cover(left - whole * PLAN_PERIOD_MONTHS[period], at + 1);\n return whole * UPGRADE_PER[period] + Math.min(rest, UPGRADE_PER[period]);\n };\n return cover(months, 0);\n}\n\n/**\n * What an upgrade of `convertedMs` of Premium, from `now`, costs in paise (the\n * user: \"ask for the rest of the money, the difference\"): `upgradeCover` of its\n * whole calendar months and the days left over. A part day counts as a day;\n * rounded up to the rupee. What each part was BOUGHT at is not read, and not\n * stored: refunds, stacking and Business put in front move time, and \"today's\n * prices for the time left\" is one sentence a member can check.\n */\nexport function upgradePrice(convertedMs: number, now: Date): number {\n const end = now.getTime() + Math.max(convertedMs, 1);\n let months = 0;\n while (addPlanPeriod(now, 'month', months + 1).getTime() <= end) months += 1;\n const days = Math.ceil((end - addPlanPeriod(now, 'month', months).getTime()) / DAY_MS);\n return Math.ceil(upgradeCover(months, days) / 100) * 100;\n}\n\n/**\n * Free founding memberships (0.14.0): the first 100 people to join the launch\n * waitlist get their membership free, numbered #1 to #100 by their place\n * (the user, 2026-10-16). Everyone else pays `MEMBERSHIP_PRICE_PAISE` once.\n * No code gives a founding place any more.\n */\nexport const FOUNDING_PLACES = 100;\n\n/**\n * THE EARLY-BIRD OFFER (0.21.0; the user, 2026-11-14): everyone whose Founder\n * Circle account was CREATED before this instant gets the membership free, for\n * life, with no code and no limit on how many. After it, the membership costs\n * `MEMBERSHIP_PRICE_PAISE` as before.\n *\n * Tue 17 Nov 2026, 12:00 IST. The ONE place it is written: the server grants\n * from it (`isEarlyBird`), and the web's landing, pricing, membership screen,\n * Terms and llms.txt word the offer from it and stop offering it at this\n * instant. Moving it is a schema release, like a price.\n *\n * The server grants the same free membership to an account created while\n * payments are not live (before the catalog's `paymentsLiveAt`, or with none\n * set; the user, 2026-11-19). That rule is the server's: `isEarlyBird` here\n * answers for this instant alone.\n */\nexport const EARLY_BIRD_UNTIL = '2026-11-17T06:30:00.000Z';\n\nconst EARLY_BIRD_UNTIL_MS = Date.parse(EARLY_BIRD_UNTIL);\n\n/** Whether an account created at `createdAt` gets the early-bird membership. */\nexport function isEarlyBird(createdAt: Date | string | number): boolean {\n const at = createdAt instanceof Date ? createdAt.getTime() : new Date(createdAt).getTime();\n return Number.isFinite(at) && at < EARLY_BIRD_UNTIL_MS;\n}\n\n/** Whether the offer is still open at `now`: what the pages show. */\nexport function earlyBirdOpen(now: Date | number = Date.now()): boolean {\n return (now instanceof Date ? now.getTime() : now) < EARLY_BIRD_UNTIL_MS;\n}\n\n// ─── GET /plans ──────────────────────────────────────────────────────────────\n\nexport const planOfferSchema = z.object({\n tier: planTierSchema,\n /** \"Premium\", \"Business\": the server's word, so a rename needs no client release. */\n name: z.string(),\n /**\n * One price for each term, GST included. All four REQUIRED: a server that does\n * not sell one is older than the client reading this, so the server ships\n * first. (An object of two would have stripped the other two silently.)\n */\n prices: z.object({\n month: paiseSchema,\n quarter: paiseSchema,\n half_year: paiseSchema,\n year: paiseSchema,\n } satisfies Record<PlanPeriod, typeof paiseSchema>),\n limits: planLimitsSchema,\n /** What it unlocks (0.32.0). Defaults to the member's when an older server leaves it out. */\n features: planFeaturesSchema.default(MEMBER_FEATURE_VALUES),\n});\nexport type PlanOffer = z.infer<typeof planOfferSchema>;\n\nexport const planCatalogSchema = z.object({\n currency: z.literal('INR'),\n membership: z.object({\n /** Once, for life, GST included: what is charged NOW. */\n price: paiseSchema,\n /**\n * While an offer runs: the full price (shown struck through), else null\n * (2026-12-06, additive: an older server leaves these out = no offer).\n */\n listPrice: paiseSchema.nullable().default(null),\n /** The offer's name (\"Launch offer\"), else null. */\n offer: z.string().min(1).max(60).nullable().default(null),\n /** The offer's end, said beside it: the first instant at the full price. Else null. */\n offerEndsAt: z.iso.datetime({ offset: true }).nullable().default(null),\n limits: planLimitsSchema,\n /** What a member with no plan has unlocked (0.32.0). */\n features: planFeaturesSchema.default(MEMBER_FEATURE_VALUES),\n }),\n /** Lowest first. */\n plans: z.array(planOfferSchema),\n /** Every purchase is refunded in full within this many days of paying. */\n refundWindowDays: z.number().int().positive(),\n /**\n * Whether payments are LIVE here now: the server's `PAYMENTS_LIVE_AT` is set\n * and has passed, and its gateway is configured. While false, plans and\n * payments are \"coming soon\": a client shows no price, plan, pay button or\n * code box, and every quote and order (a free code's too) answers\n * `PAYMENTS_UNAVAILABLE` (the user, 2026-11-19).\n */\n paymentsEnabled: z.boolean(),\n /**\n * The instant payments go (or went) live, or null while none is set. Every\n * account CREATED before it, or while it is null, holds the membership free\n * for life (kind `early_bird`), so the Terms state it as a date. Defaults to\n * null when an older server leaves it out, so a client can ship first.\n */\n paymentsLiveAt: z.iso.datetime().nullable().default(null),\n /**\n * Whether a plan may renew AUTOMATICALLY here (0.31.0, payments v2). The\n * server's two keys: its `SUBSCRIPTIONS_ENABLED` is set AND its gateway plans\n * resolve, and payments are live. While false a client offers no\n * \"Renew automatically\" switch: every plan is prepaid. Defaults to false\n * when an older server leaves it out.\n */\n autoRenewEnabled: z.boolean().default(false),\n /**\n * WHICH terms may renew automatically here (four terms, 2026-11-30): the\n * server's fact, never assumed from the list of terms. A client offers the\n * switch only for one in it, and only while `autoRenewEnabled`; any other is\n * prepaid, and says so. Empty while subscriptions are off. A term joins it by\n * a server change alone, once its recurring charge is PROVED on each payment\n * method. Defaults to the two that always could when an older server leaves\n * it out.\n */\n autoRenewPeriods: z.array(planPeriodSchema).default(['month', 'year']),\n});\nexport type PlanCatalog = z.infer<typeof planCatalogSchema>;\n\n// ─── Auto-renewal (0.31.0, payments v2) ──────────────────────────────────────\n//\n// The user, 2026-11-25: plans RENEW AUTOMATICALLY BY DEFAULT, and the member can\n// turn it off (founder-circle-backend docs/payments-v2-plan.md, section 3a). An\n// auto-renewal is a Razorpay subscription for one tier and period: each charge\n// it makes is an ORDER that buys one period, appended to the blocks exactly as\n// a manual purchase is (same invoice, same 7-day refund). It adds time only\n// when a charge lands, so a failed charge takes nothing away: the plan ends\n// when its time runs out, as a prepaid one does.\n\n/**\n * Where an auto-renewal stands: Razorpay's subscription states, as it names\n * them. ⚠ Stored: append only.\n *\n * created made, waiting for the member to authorise it at Checkout\n * authenticated authorised; its first charge is on a later date (it starts\n * when the time already held ends)\n * active charging each period\n * pending a charge failed; Razorpay is retrying (T+1 to T+3 days)\n * halted every retry failed: no more charges (auto-renew is off)\n * cancelled turned off (at the end of the period, or at once after a\n * refund), or replaced\n * completed its cycles ran out\n * expired never authorised in time\n * paused paused at the gateway (Founder Circle never pauses one)\n */\nexport const AUTO_RENEWAL_STATUS_VALUES = [\n 'created',\n 'authenticated',\n 'active',\n 'pending',\n 'halted',\n 'cancelled',\n 'completed',\n 'expired',\n 'paused',\n] as const;\nexport const autoRenewalStatusSchema = z.enum(AUTO_RENEWAL_STATUS_VALUES);\nexport type AutoRenewalStatus = z.infer<typeof autoRenewalStatusSchema>;\n\n/** The statuses in which an auto-renewal will still charge (or is about to). */\nexport const AUTO_RENEWAL_RUNNING_VALUES = [\n 'authenticated',\n 'active',\n 'pending',\n] as const satisfies readonly AutoRenewalStatus[];\n\n/**\n * A member's auto-renewal, as `GET /me/membership` shows it: at most one, the\n * running one (null when none runs).\n */\nexport const autoRenewalSchema = z.object({\n id: objectIdSchema,\n status: autoRenewalStatusSchema,\n tier: planTierSchema,\n period: planPeriodSchema,\n /** What each charge takes, GST included: the price it was started at, kept. */\n amount: paiseSchema,\n /** When the next charge is due; null when none will come (turned off, halted). */\n nextChargeAt: z.iso.datetime().nullable(),\n /** Turned off: no more charges; the time already paid stays until it ends. */\n cancelAtCycleEnd: z.boolean(),\n /** How it pays, as last charged or authorised; null before the gateway says. */\n method: paymentMethodSnapshotSchema.nullable(),\n /** A failed charge (`pending`) can be fixed by updating the method. */\n canUpdateMethod: z.boolean(),\n /**\n * In the renewal grace (`RENEWAL_GRACE_DAYS`): the time held has ended and\n * the charge is awaited, so the tier stays in force until this instant.\n * Null outside it. A client says \"your renewal is being processed; your\n * plan stays active until <date>\" (or, with `status: 'pending'`, that the\n * charge failed and is being retried).\n */\n graceUntil: z.iso.datetime().nullable().default(null),\n});\nexport type AutoRenewal = z.infer<typeof autoRenewalSchema>;\n\n// ─── GET /me/membership ──────────────────────────────────────────────────────\n\nexport const membershipSchema = z.object({\n kind: membershipKindSchema,\n since: z.iso.datetime(),\n /** \"Founding member #N\": set only for `founding`. */\n foundingNumber: z.number().int().positive().nullable(),\n});\nexport type Membership = z.infer<typeof membershipSchema>;\n\n/** A stretch of one tier. Blocks never overlap and follow each other with no gap. */\nexport const planBlockSchema = z.object({\n tier: planTierSchema,\n startsAt: z.iso.datetime(),\n endsAt: z.iso.datetime(),\n});\nexport type PlanBlock = z.infer<typeof planBlockSchema>;\n\n/** Why someone takes part: their membership, or a staff role (staff are members). */\nexport const TAKES_PART_THROUGH_VALUES = ['membership', 'staff'] as const;\nexport type TakesPartThrough = (typeof TAKES_PART_THROUGH_VALUES)[number];\n\nexport const meMembershipSchema = z.object({\n standing: standingSchema,\n /** Null for a viewer, and for staff who hold none (they take part through their role). */\n membership: membershipSchema.nullable(),\n /** Why they take part: their membership, or a staff role (staff are members). Null for a viewer. */\n through: z.enum(TAKES_PART_THROUGH_VALUES).nullable(),\n plan: z.object({\n /** The tier in force now; null with no plan. */\n tier: planTierSchema.nullable(),\n /** From now on, Business first, then Premium. Empty with no plan. */\n blocks: z.array(planBlockSchema),\n }),\n limits: planLimitsSchema,\n /**\n * What the plan in force unlocks (0.32.0), with the renewal grace, and the\n * top plan's while payments are off, as `limits`. Defaults to the member's\n * when an older server leaves it out.\n */\n features: planFeaturesSchema.default(MEMBER_FEATURE_VALUES),\n products: z.object({\n /** Products they own that are live now. */\n live: z.number().int().nonnegative(),\n /** Products they own, paused ones included. */\n owned: z.number().int().nonnegative(),\n /**\n * What adding another counts against (0.13.0): live ones and the ones\n * they paused themselves, not those a plan's end paused. \"Add a product\"\n * stops when this reaches `limits.productsLive`: pausing never makes room.\n */\n counted: z.number().int().nonnegative(),\n }),\n messages: z.object({\n /** New people they started a conversation with this month (India time). */\n used: z.number().int().nonnegative(),\n /** When this month's count starts again. */\n resetsAt: z.iso.datetime(),\n }),\n /** The billing details they last used, to prefill the next checkout; null before the first. */\n billing: billingDetailsSchema.nullable(),\n /**\n * A first checkout's state, SUGGESTED (2026-11-30): the state of the member's own\n * profile location, only while they have no `billing` to prefill from. The\n * invoice of every online sale names the buyer's state (GST), so it is asked\n * once; this fills it in, and the member can change it before they pay. Never\n * stored by being suggested. Null when there is none; absent from an older server.\n */\n billingStateHint: gstStateCodeSchema.nullable().optional(),\n /**\n * The auto-renewal that runs (0.31.0): authorised, charging, or retrying a\n * failed charge. Null when none does. Defaults to null when an older server\n * leaves it out.\n */\n autoRenewal: autoRenewalSchema.nullable().default(null),\n});\nexport type MeMembership = z.infer<typeof meMembershipSchema>;\n"]}
|