founder-schema 0.34.0 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/domains/billing/billing.d.ts +35 -2
- package/dist/domains/billing/billing.d.ts.map +1 -1
- package/dist/domains/billing/billing.js +5 -3
- package/dist/domains/billing/billing.js.map +1 -1
- package/dist/domains/billing/gst.d.ts +5 -0
- package/dist/domains/billing/gst.d.ts.map +1 -1
- package/dist/domains/billing/gst.js +7 -0
- package/dist/domains/billing/gst.js.map +1 -1
- package/dist/domains/membership/membership.d.ts +84 -12
- package/dist/domains/membership/membership.d.ts.map +1 -1
- package/dist/domains/membership/membership.js +106 -30
- package/dist/domains/membership/membership.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -75,13 +75,27 @@ export declare const planTierSchema: z.ZodEnum<{
|
|
|
75
75
|
export type PlanTier = z.infer<typeof planTierSchema>;
|
|
76
76
|
/** Which tier outranks which: Business above Premium. */
|
|
77
77
|
export declare const PLAN_TIER_RANK: Readonly<Record<PlanTier, number>>;
|
|
78
|
-
/**
|
|
79
|
-
|
|
78
|
+
/**
|
|
79
|
+
* One payment buys 1, 3, 6 or 12 calendar months (four terms: the user,
|
|
80
|
+
* 2026-11-30; a month or a year before). ⚠ Stored: append only, which is why the
|
|
81
|
+
* order here is not the length's: `PLAN_PERIODS_SHORTEST_FIRST` is.
|
|
82
|
+
*/
|
|
83
|
+
export declare const PLAN_PERIOD_VALUES: readonly ["month", "year", "quarter", "half_year"];
|
|
80
84
|
export declare const planPeriodSchema: z.ZodEnum<{
|
|
81
85
|
month: "month";
|
|
82
86
|
year: "year";
|
|
87
|
+
quarter: "quarter";
|
|
88
|
+
half_year: "half_year";
|
|
83
89
|
}>;
|
|
84
90
|
export type PlanPeriod = z.infer<typeof planPeriodSchema>;
|
|
91
|
+
/**
|
|
92
|
+
* How many calendar months each is: the ONE place a period becomes a number.
|
|
93
|
+
* Exhaustive by type, so a term added without its length does not compile.
|
|
94
|
+
* Never `period === 'year' ? 12 : 1`: that grants one month for any new term.
|
|
95
|
+
*/
|
|
96
|
+
export declare const PLAN_PERIOD_MONTHS: Readonly<Record<PlanPeriod, number>>;
|
|
97
|
+
/** The terms as every screen lists them. */
|
|
98
|
+
export declare const PLAN_PERIODS_SHORTEST_FIRST: readonly PlanPeriod[];
|
|
85
99
|
/** Integer paise, never negative. Rs 399 is 39900. */
|
|
86
100
|
export declare const paiseSchema: z.ZodNumber;
|
|
87
101
|
export type Paise = z.infer<typeof paiseSchema>;
|
|
@@ -155,14 +169,20 @@ export declare const PLAN_SPECS: Readonly<Record<PlanTier, {
|
|
|
155
169
|
/** The number of days a member (no plan) is told "N people viewed your profile" over. */
|
|
156
170
|
export declare const MEMBER_PROFILE_VIEW_COUNT_DAYS = 30;
|
|
157
171
|
/**
|
|
158
|
-
* A
|
|
159
|
-
*
|
|
160
|
-
*
|
|
172
|
+
* A term later on India's calendar (`count` of them), the day clamped to the
|
|
173
|
+
* month's last: 31 January plus a month is 28 or 29 February. India has one
|
|
174
|
+
* offset all year, so its calendar is UTC's, shifted.
|
|
161
175
|
*/
|
|
162
176
|
export declare function addPlanPeriod(from: Date, period: PlanPeriod, count?: number): Date;
|
|
163
|
-
/**
|
|
177
|
+
/**
|
|
178
|
+
* What an upgrade costs for each whole term of Premium left: what that term
|
|
179
|
+
* costs on Business less what it costs on Premium, at today's prices. The one
|
|
180
|
+
* source of every upgrade price, and of the Terms' sentence.
|
|
181
|
+
*/
|
|
182
|
+
export declare const UPGRADE_PER: Readonly<Record<PlanPeriod, number>>;
|
|
183
|
+
/** ...each whole calendar year of it. */
|
|
164
184
|
export declare const UPGRADE_PER_YEAR: number;
|
|
165
|
-
/** ...
|
|
185
|
+
/** ...each whole calendar month of it (a 31-day month and February alike). */
|
|
166
186
|
export declare const UPGRADE_PER_MONTH: number;
|
|
167
187
|
/** The days left over are charged as this many to a month. */
|
|
168
188
|
export declare const UPGRADE_DAYS_PER_MONTH = 30;
|
|
@@ -170,11 +190,11 @@ export declare const UPGRADE_DAYS_PER_MONTH = 30;
|
|
|
170
190
|
export declare const UPGRADE_PER_DAY: number;
|
|
171
191
|
/**
|
|
172
192
|
* What an upgrade of `convertedMs` of Premium, from `now`, costs in paise (the
|
|
173
|
-
* user: "ask for the rest of the money, the difference")
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
193
|
+
* user: "ask for the rest of the money, the difference"): `upgradeCover` of its
|
|
194
|
+
* whole calendar months and the days left over. A part day counts as a day;
|
|
195
|
+
* rounded up to the rupee. What each part was BOUGHT at is not read, and not
|
|
196
|
+
* stored: refunds, stacking and Business put in front move time, and "today's
|
|
197
|
+
* prices for the time left" is one sentence a member can check.
|
|
178
198
|
*/
|
|
179
199
|
export declare function upgradePrice(convertedMs: number, now: Date): number;
|
|
180
200
|
/**
|
|
@@ -213,6 +233,8 @@ export declare const planOfferSchema: z.ZodObject<{
|
|
|
213
233
|
name: z.ZodString;
|
|
214
234
|
prices: z.ZodObject<{
|
|
215
235
|
month: z.ZodNumber;
|
|
236
|
+
quarter: z.ZodNumber;
|
|
237
|
+
half_year: z.ZodNumber;
|
|
216
238
|
year: z.ZodNumber;
|
|
217
239
|
}, z.core.$strip>;
|
|
218
240
|
limits: z.ZodObject<{
|
|
@@ -266,6 +288,8 @@ export declare const planCatalogSchema: z.ZodObject<{
|
|
|
266
288
|
name: z.ZodString;
|
|
267
289
|
prices: z.ZodObject<{
|
|
268
290
|
month: z.ZodNumber;
|
|
291
|
+
quarter: z.ZodNumber;
|
|
292
|
+
half_year: z.ZodNumber;
|
|
269
293
|
year: z.ZodNumber;
|
|
270
294
|
}, z.core.$strip>;
|
|
271
295
|
limits: z.ZodObject<{
|
|
@@ -291,6 +315,12 @@ export declare const planCatalogSchema: z.ZodObject<{
|
|
|
291
315
|
paymentsEnabled: z.ZodBoolean;
|
|
292
316
|
paymentsLiveAt: z.ZodDefault<z.ZodNullable<z.ZodISODateTime>>;
|
|
293
317
|
autoRenewEnabled: z.ZodDefault<z.ZodBoolean>;
|
|
318
|
+
autoRenewPeriods: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
319
|
+
month: "month";
|
|
320
|
+
year: "year";
|
|
321
|
+
quarter: "quarter";
|
|
322
|
+
half_year: "half_year";
|
|
323
|
+
}>>>;
|
|
294
324
|
}, z.core.$strip>;
|
|
295
325
|
export type PlanCatalog = z.infer<typeof planCatalogSchema>;
|
|
296
326
|
/**
|
|
@@ -348,6 +378,8 @@ export declare const autoRenewalSchema: z.ZodObject<{
|
|
|
348
378
|
period: z.ZodEnum<{
|
|
349
379
|
month: "month";
|
|
350
380
|
year: "year";
|
|
381
|
+
quarter: "quarter";
|
|
382
|
+
half_year: "half_year";
|
|
351
383
|
}>;
|
|
352
384
|
amount: z.ZodNumber;
|
|
353
385
|
nextChargeAt: z.ZodNullable<z.ZodISODateTime>;
|
|
@@ -503,6 +535,44 @@ export declare const meMembershipSchema: z.ZodObject<{
|
|
|
503
535
|
legalName: z.ZodOptional<z.ZodString>;
|
|
504
536
|
address: z.ZodOptional<z.ZodString>;
|
|
505
537
|
}, z.core.$strip>>;
|
|
538
|
+
billingStateHint: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
539
|
+
"01": "01";
|
|
540
|
+
"02": "02";
|
|
541
|
+
"03": "03";
|
|
542
|
+
"04": "04";
|
|
543
|
+
"05": "05";
|
|
544
|
+
"06": "06";
|
|
545
|
+
"07": "07";
|
|
546
|
+
"08": "08";
|
|
547
|
+
"09": "09";
|
|
548
|
+
10: "10";
|
|
549
|
+
11: "11";
|
|
550
|
+
12: "12";
|
|
551
|
+
13: "13";
|
|
552
|
+
14: "14";
|
|
553
|
+
15: "15";
|
|
554
|
+
16: "16";
|
|
555
|
+
17: "17";
|
|
556
|
+
18: "18";
|
|
557
|
+
19: "19";
|
|
558
|
+
20: "20";
|
|
559
|
+
21: "21";
|
|
560
|
+
22: "22";
|
|
561
|
+
23: "23";
|
|
562
|
+
24: "24";
|
|
563
|
+
26: "26";
|
|
564
|
+
27: "27";
|
|
565
|
+
29: "29";
|
|
566
|
+
30: "30";
|
|
567
|
+
31: "31";
|
|
568
|
+
32: "32";
|
|
569
|
+
33: "33";
|
|
570
|
+
34: "34";
|
|
571
|
+
35: "35";
|
|
572
|
+
36: "36";
|
|
573
|
+
37: "37";
|
|
574
|
+
38: "38";
|
|
575
|
+
}>>>;
|
|
506
576
|
autoRenewal: z.ZodDefault<z.ZodNullable<z.ZodObject<{
|
|
507
577
|
id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
508
578
|
status: z.ZodEnum<{
|
|
@@ -523,6 +593,8 @@ export declare const meMembershipSchema: z.ZodObject<{
|
|
|
523
593
|
period: z.ZodEnum<{
|
|
524
594
|
month: "month";
|
|
525
595
|
year: "year";
|
|
596
|
+
quarter: "quarter";
|
|
597
|
+
half_year: "half_year";
|
|
526
598
|
}>;
|
|
527
599
|
amount: z.ZodNumber;
|
|
528
600
|
nextChargeAt: z.ZodNullable<z.ZodISODateTime>;
|
|
@@ -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+B,CAAC;AACrE,eAAO,MAAM,sBAAsB;;;EAAmC,CAAC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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"}
|
|
@@ -24,7 +24,7 @@ import { z } from 'zod';
|
|
|
24
24
|
import { standingSchema } from '../../access/standing.js';
|
|
25
25
|
import { objectIdSchema } from '../../core/common.js';
|
|
26
26
|
import { DAY_MS, INDIA_UTC_OFFSET_MS } from '../../core/limits.js';
|
|
27
|
-
import { billingDetailsSchema } from '../billing/gst.js';
|
|
27
|
+
import { billingDetailsSchema, gstStateCodeSchema } from '../billing/gst.js';
|
|
28
28
|
import { paymentMethodSnapshotSchema } from '../billing/payment-method.js';
|
|
29
29
|
/**
|
|
30
30
|
* How someone came to hold a membership. ⚠ Stored: append only.
|
|
@@ -66,9 +66,26 @@ export const PLAN_TIER_VALUES = ['premium', 'business'];
|
|
|
66
66
|
export const planTierSchema = z.enum(PLAN_TIER_VALUES);
|
|
67
67
|
/** Which tier outranks which: Business above Premium. */
|
|
68
68
|
export const PLAN_TIER_RANK = { premium: 1, business: 2 };
|
|
69
|
-
/**
|
|
70
|
-
|
|
69
|
+
/**
|
|
70
|
+
* One payment buys 1, 3, 6 or 12 calendar months (four terms: the user,
|
|
71
|
+
* 2026-11-30; a month or a year before). ⚠ Stored: append only, which is why the
|
|
72
|
+
* order here is not the length's: `PLAN_PERIODS_SHORTEST_FIRST` is.
|
|
73
|
+
*/
|
|
74
|
+
export const PLAN_PERIOD_VALUES = ['month', 'year', 'quarter', 'half_year'];
|
|
71
75
|
export const planPeriodSchema = z.enum(PLAN_PERIOD_VALUES);
|
|
76
|
+
/**
|
|
77
|
+
* How many calendar months each is: the ONE place a period becomes a number.
|
|
78
|
+
* Exhaustive by type, so a term added without its length does not compile.
|
|
79
|
+
* Never `period === 'year' ? 12 : 1`: that grants one month for any new term.
|
|
80
|
+
*/
|
|
81
|
+
export const PLAN_PERIOD_MONTHS = {
|
|
82
|
+
month: 1,
|
|
83
|
+
quarter: 3,
|
|
84
|
+
half_year: 6,
|
|
85
|
+
year: 12,
|
|
86
|
+
};
|
|
87
|
+
/** The terms as every screen lists them. */
|
|
88
|
+
export const PLAN_PERIODS_SHORTEST_FIRST = [...PLAN_PERIOD_VALUES].sort((a, b) => PLAN_PERIOD_MONTHS[a] - PLAN_PERIOD_MONTHS[b]);
|
|
72
89
|
/** Integer paise, never negative. Rs 399 is 39900. */
|
|
73
90
|
export const paiseSchema = z.number().int().nonnegative();
|
|
74
91
|
/**
|
|
@@ -119,7 +136,10 @@ export const planFeaturesSchema = z.object({
|
|
|
119
136
|
// serves them, and the web's Terms of Service are written FROM them, so the
|
|
120
137
|
// Terms can never state a price the server does not charge. A change here is
|
|
121
138
|
// a schema release, then the backend, then the web. Integer PAISE, GST
|
|
122
|
-
// included. hary's India-first prices (the user: "you decide, India first")
|
|
139
|
+
// included. hary's India-first prices (the user: "you decide, India first"); four
|
|
140
|
+
// terms, each cheaper per month, the user's own numbers (2026-11-30): 16, 25 and
|
|
141
|
+
// 40 percent less than the same months bought one by one, and every price a whole
|
|
142
|
+
// rupee a month. Each is written out: never computed from a percent.
|
|
123
143
|
/** The membership: once, for life. */
|
|
124
144
|
export const MEMBERSHIP_PRICE_PAISE = 9_900;
|
|
125
145
|
/** What a member with no plan may: 1 live product, no conversations with people they do not know. */
|
|
@@ -139,7 +159,8 @@ export const MEMBER_FEATURE_VALUES = {
|
|
|
139
159
|
export const PLAN_SPECS = {
|
|
140
160
|
premium: {
|
|
141
161
|
name: 'Premium',
|
|
142
|
-
|
|
162
|
+
// 399, 333, 299 and 239 a month.
|
|
163
|
+
prices: { month: 39_900, quarter: 99_900, half_year: 179_400, year: 286_800 },
|
|
143
164
|
limits: { productsLive: 5, newPeoplePerMonth: 15 },
|
|
144
165
|
features: {
|
|
145
166
|
badge: true,
|
|
@@ -151,7 +172,8 @@ export const PLAN_SPECS = {
|
|
|
151
172
|
},
|
|
152
173
|
business: {
|
|
153
174
|
name: 'Business',
|
|
154
|
-
|
|
175
|
+
// 999, 833, 749 and 599 a month.
|
|
176
|
+
prices: { month: 99_900, quarter: 249_900, half_year: 449_400, year: 718_800 },
|
|
155
177
|
limits: { productsLive: null, newPeoplePerMonth: 50 },
|
|
156
178
|
features: {
|
|
157
179
|
badge: true,
|
|
@@ -171,12 +193,12 @@ export const MEMBER_PROFILE_VIEW_COUNT_DAYS = 30;
|
|
|
171
193
|
// "Rs 20 a day for the rest" for a week after the server stopped charging it
|
|
172
194
|
// (2026-10-13).
|
|
173
195
|
/**
|
|
174
|
-
* A
|
|
175
|
-
*
|
|
176
|
-
*
|
|
196
|
+
* A term later on India's calendar (`count` of them), the day clamped to the
|
|
197
|
+
* month's last: 31 January plus a month is 28 or 29 February. India has one
|
|
198
|
+
* offset all year, so its calendar is UTC's, shifted.
|
|
177
199
|
*/
|
|
178
200
|
export function addPlanPeriod(from, period, count = 1) {
|
|
179
|
-
const months = period
|
|
201
|
+
const months = PLAN_PERIOD_MONTHS[period] * count;
|
|
180
202
|
const local = new Date(from.getTime() + INDIA_UTC_OFFSET_MS);
|
|
181
203
|
const m = local.getUTCMonth() + months;
|
|
182
204
|
const targetYear = local.getUTCFullYear() + Math.floor(m / 12);
|
|
@@ -185,35 +207,62 @@ export function addPlanPeriod(from, period, count = 1) {
|
|
|
185
207
|
const shifted = Date.UTC(targetYear, targetMonth, Math.min(local.getUTCDate(), lastDay), local.getUTCHours(), local.getUTCMinutes(), local.getUTCSeconds(), local.getUTCMilliseconds());
|
|
186
208
|
return new Date(shifted - INDIA_UTC_OFFSET_MS);
|
|
187
209
|
}
|
|
188
|
-
/**
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
210
|
+
/**
|
|
211
|
+
* What an upgrade costs for each whole term of Premium left: what that term
|
|
212
|
+
* costs on Business less what it costs on Premium, at today's prices. The one
|
|
213
|
+
* source of every upgrade price, and of the Terms' sentence.
|
|
214
|
+
*/
|
|
215
|
+
export const UPGRADE_PER = {
|
|
216
|
+
month: PLAN_SPECS.business.prices.month - PLAN_SPECS.premium.prices.month,
|
|
217
|
+
quarter: PLAN_SPECS.business.prices.quarter - PLAN_SPECS.premium.prices.quarter,
|
|
218
|
+
half_year: PLAN_SPECS.business.prices.half_year - PLAN_SPECS.premium.prices.half_year,
|
|
219
|
+
year: PLAN_SPECS.business.prices.year - PLAN_SPECS.premium.prices.year,
|
|
220
|
+
};
|
|
221
|
+
/** ...each whole calendar year of it. */
|
|
222
|
+
export const UPGRADE_PER_YEAR = UPGRADE_PER.year;
|
|
223
|
+
/** ...each whole calendar month of it (a 31-day month and February alike). */
|
|
224
|
+
export const UPGRADE_PER_MONTH = UPGRADE_PER.month;
|
|
192
225
|
/** The days left over are charged as this many to a month. */
|
|
193
226
|
export const UPGRADE_DAYS_PER_MONTH = 30;
|
|
194
227
|
/** ...so each day left over costs this, never more than `UPGRADE_PER_MONTH` for them all. */
|
|
195
228
|
export const UPGRADE_PER_DAY = UPGRADE_PER_MONTH / UPGRADE_DAYS_PER_MONTH;
|
|
229
|
+
/**
|
|
230
|
+
* What `months` whole months and `days` left over cost to upgrade: the largest
|
|
231
|
+
* whole term first (a year, then 6 months, 3 months, a month, then days), and
|
|
232
|
+
* what is left after any piece never costs more than ONE more of it. So it is
|
|
233
|
+
* the cheapest cover of the time by whole terms, it never falls as the time
|
|
234
|
+
* grows, and it is, to the paisa, what that time costs on Business less what it
|
|
235
|
+
* costs on Premium, each at its cheapest (docs/plans-four-terms.md, proved on
|
|
236
|
+
* every day to 3 years). Buying Premium and upgrading at once therefore costs
|
|
237
|
+
* exactly what buying Business does: no way round, and no overcharge.
|
|
238
|
+
*/
|
|
239
|
+
function upgradeCover(months, days) {
|
|
240
|
+
const longestFirst = [...PLAN_PERIODS_SHORTEST_FIRST].reverse();
|
|
241
|
+
const cover = (left, at) => {
|
|
242
|
+
const period = longestFirst[at];
|
|
243
|
+
if (period === undefined)
|
|
244
|
+
return days * UPGRADE_PER_DAY;
|
|
245
|
+
const whole = Math.floor(left / PLAN_PERIOD_MONTHS[period]);
|
|
246
|
+
const rest = cover(left - whole * PLAN_PERIOD_MONTHS[period], at + 1);
|
|
247
|
+
return whole * UPGRADE_PER[period] + Math.min(rest, UPGRADE_PER[period]);
|
|
248
|
+
};
|
|
249
|
+
return cover(months, 0);
|
|
250
|
+
}
|
|
196
251
|
/**
|
|
197
252
|
* What an upgrade of `convertedMs` of Premium, from `now`, costs in paise (the
|
|
198
|
-
* user: "ask for the rest of the money, the difference")
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
*
|
|
253
|
+
* user: "ask for the rest of the money, the difference"): `upgradeCover` of its
|
|
254
|
+
* whole calendar months and the days left over. A part day counts as a day;
|
|
255
|
+
* rounded up to the rupee. What each part was BOUGHT at is not read, and not
|
|
256
|
+
* stored: refunds, stacking and Business put in front move time, and "today's
|
|
257
|
+
* prices for the time left" is one sentence a member can check.
|
|
203
258
|
*/
|
|
204
259
|
export function upgradePrice(convertedMs, now) {
|
|
205
260
|
const end = now.getTime() + Math.max(convertedMs, 1);
|
|
206
|
-
let years = 0;
|
|
207
|
-
while (addPlanPeriod(now, 'year', years + 1).getTime() <= end)
|
|
208
|
-
years += 1;
|
|
209
|
-
const afterYears = addPlanPeriod(now, 'year', years);
|
|
210
261
|
let months = 0;
|
|
211
|
-
while (addPlanPeriod(
|
|
262
|
+
while (addPlanPeriod(now, 'month', months + 1).getTime() <= end)
|
|
212
263
|
months += 1;
|
|
213
|
-
const
|
|
214
|
-
|
|
215
|
-
const paise = years * UPGRADE_PER_YEAR + Math.min(belowAYear, UPGRADE_PER_YEAR);
|
|
216
|
-
return Math.ceil(paise / 100) * 100;
|
|
264
|
+
const days = Math.ceil((end - addPlanPeriod(now, 'month', months).getTime()) / DAY_MS);
|
|
265
|
+
return Math.ceil(upgradeCover(months, days) / 100) * 100;
|
|
217
266
|
}
|
|
218
267
|
/**
|
|
219
268
|
* Free founding memberships (0.14.0): the first 100 people to join the launch
|
|
@@ -254,8 +303,17 @@ export const planOfferSchema = z.object({
|
|
|
254
303
|
tier: planTierSchema,
|
|
255
304
|
/** "Premium", "Business": the server's word, so a rename needs no client release. */
|
|
256
305
|
name: z.string(),
|
|
257
|
-
/**
|
|
258
|
-
|
|
306
|
+
/**
|
|
307
|
+
* One price for each term, GST included. All four REQUIRED: a server that does
|
|
308
|
+
* not sell one is older than the client reading this, so the server ships
|
|
309
|
+
* first. (An object of two would have stripped the other two silently.)
|
|
310
|
+
*/
|
|
311
|
+
prices: z.object({
|
|
312
|
+
month: paiseSchema,
|
|
313
|
+
quarter: paiseSchema,
|
|
314
|
+
half_year: paiseSchema,
|
|
315
|
+
year: paiseSchema,
|
|
316
|
+
}),
|
|
259
317
|
limits: planLimitsSchema,
|
|
260
318
|
/** What it unlocks (0.32.0). Defaults to the member's when an older server leaves it out. */
|
|
261
319
|
features: planFeaturesSchema.default(MEMBER_FEATURE_VALUES),
|
|
@@ -296,6 +354,16 @@ export const planCatalogSchema = z.object({
|
|
|
296
354
|
* when an older server leaves it out.
|
|
297
355
|
*/
|
|
298
356
|
autoRenewEnabled: z.boolean().default(false),
|
|
357
|
+
/**
|
|
358
|
+
* WHICH terms may renew automatically here (four terms, 2026-11-30): the
|
|
359
|
+
* server's fact, never assumed from the list of terms. A client offers the
|
|
360
|
+
* switch only for one in it, and only while `autoRenewEnabled`; any other is
|
|
361
|
+
* prepaid, and says so. Empty while subscriptions are off. A term joins it by
|
|
362
|
+
* a server change alone, once its recurring charge is PROVED on each payment
|
|
363
|
+
* method. Defaults to the two that always could when an older server leaves
|
|
364
|
+
* it out.
|
|
365
|
+
*/
|
|
366
|
+
autoRenewPeriods: z.array(planPeriodSchema).default(['month', 'year']),
|
|
299
367
|
});
|
|
300
368
|
// ─── Auto-renewal (0.31.0, payments v2) ──────────────────────────────────────
|
|
301
369
|
//
|
|
@@ -422,6 +490,14 @@ export const meMembershipSchema = z.object({
|
|
|
422
490
|
}),
|
|
423
491
|
/** The billing details they last used, to prefill the next checkout; null before the first. */
|
|
424
492
|
billing: billingDetailsSchema.nullable(),
|
|
493
|
+
/**
|
|
494
|
+
* A first checkout's state, SUGGESTED (2026-11-30): the state of the member's own
|
|
495
|
+
* profile location, only while they have no `billing` to prefill from. The
|
|
496
|
+
* invoice of every online sale names the buyer's state (GST), so it is asked
|
|
497
|
+
* once; this fills it in, and the member can change it before they pay. Never
|
|
498
|
+
* stored by being suggested. Null when there is none; absent from an older server.
|
|
499
|
+
*/
|
|
500
|
+
billingStateHint: gstStateCodeSchema.nullable().optional(),
|
|
425
501
|
/**
|
|
426
502
|
* The auto-renewal that runs (0.31.0): authorised, charging, or retrying a
|
|
427
503
|
* failed charge. Null when none does. Defaults to null when an older server
|
|
@@ -1 +1 @@
|
|
|
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,EAA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IG;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 } 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/** One payment buys a calendar month or a calendar year. ⚠ Stored: append only. */\nexport const PLAN_PERIOD_VALUES = ['month', 'year'] as const;\nexport const planPeriodSchema = z.enum(PLAN_PERIOD_VALUES);\nexport type PlanPeriod = z.infer<typeof planPeriodSchema>;\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\").\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 prices: { month: 39_900, year: 399_900 },\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 prices: { month: 99_900, year: 999_900 },\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 calendar month or year later on India's calendar (`count` of them), the\n * day clamped to the month's last: 31 January plus a month is 28 or 29\n * February. India has one offset all year, so its calendar is UTC's, shifted.\n */\nexport function addPlanPeriod(from: Date, period: PlanPeriod, count = 1): Date {\n const months = period === 'year' ? 12 * count : 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/** What an upgrade costs for each whole calendar year of Premium left: the yearly difference. */\nexport const UPGRADE_PER_YEAR = PLAN_SPECS.business.prices.year - PLAN_SPECS.premium.prices.year;\n/** ...for each whole calendar month after the years: the monthly difference (a 31-day month and February alike). */\nexport const UPGRADE_PER_MONTH = PLAN_SPECS.business.prices.month - PLAN_SPECS.premium.prices.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 an upgrade of `convertedMs` of Premium, from `now`, costs in paise (the\n * user: \"ask for the rest of the money, the difference\"). Each whole calendar\n * year left costs `UPGRADE_PER_YEAR`; each whole calendar month after that,\n * `UPGRADE_PER_MONTH`; the days left over `UPGRADE_PER_DAY` each, but never\n * more than one month's. The part below a year never costs more than a year's.\n * A part day counts as a day; rounded up to the rupee.\n */\nexport function upgradePrice(convertedMs: number, now: Date): number {\n const end = now.getTime() + Math.max(convertedMs, 1);\n let years = 0;\n while (addPlanPeriod(now, 'year', years + 1).getTime() <= end) years += 1;\n const afterYears = addPlanPeriod(now, 'year', years);\n let months = 0;\n while (addPlanPeriod(afterYears, 'month', months + 1).getTime() <= end) months += 1;\n const restDays = Math.ceil((end - addPlanPeriod(afterYears, 'month', months).getTime()) / DAY_MS);\n const belowAYear =\n months * UPGRADE_PER_MONTH + Math.min(restDays * UPGRADE_PER_DAY, UPGRADE_PER_MONTH);\n const paise = years * UPGRADE_PER_YEAR + Math.min(belowAYear, UPGRADE_PER_YEAR);\n return Math.ceil(paise / 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 /** GST included. */\n prices: z.object({ month: paiseSchema, year: 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});\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 * 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,sBAAs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,CAAC,yBAAyB,CAAC,CAAC,QAAQ,EAAE;IACrD,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;QACb,gDAAgD;QAChD,IAAI,EAAE,cAAc,CAAC,QAAQ,EAAE;QAC/B,qEAAqE;QACrE,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC;KACjC,CAAC;IACF,MAAM,EAAE,gBAAgB;IACxB;;;;OAIG;IACH,QAAQ,EAAE,kBAAkB,CAAC,OAAO,CAAC,qBAAqB,CAAC;IAC3D,QAAQ,EAAE,CAAC,CAAC,MAAM,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, 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"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export { type ApiError, type ApiErrorDetails, apiErrorDetailsSchema, apiErrorSch
|
|
|
22
22
|
export { REQUEST_PART_VALUES, type RequestPart, requestPartSchema, toValidationIssues, VALIDATION_MESSAGE, type ValidationIssue, type ValidationMessageKey, validationIssueSchema, } from './core/validation.js';
|
|
23
23
|
export { type DeleteAccountResponse, deleteAccountResponseSchema, } from './domains/account/account.js';
|
|
24
24
|
export { AUDIT_ACTION_VALUES, type AuditAction, type AuditActor, type AuditEntry, type AuditPage, auditActionSchema, auditActorSchema, auditEntrySchema, auditPageSchema, } from './domains/audit/audit.js';
|
|
25
|
-
export { type AppliedCoupon, type AutoRenewalParams, type AutoRenewalState, type AutoRenewTerms, appliedCouponSchema, autoRenewalParamsSchema, autoRenewalStateSchema, autoRenewTermsSchema, type BillingDetails, billingDetailsSchema, COUPON_KIND_VALUES, COUPON_TARGET_VALUES, type ConfirmAutoRenewalBody, type ConfirmOrderBody, type Coupon, type CouponBenefit, type CouponKind, type CouponList, type CouponParams, type CouponTarget, type CreateCouponBody, type CreateOrderBody, type CreateOrderResponse, type CreditNote, confirmAutoRenewalBodySchema, confirmOrderBodySchema, couponBenefitSchema, couponCodeSchema, couponListSchema, couponParamsSchema, couponSchema, couponTargetSchema, createCouponBodySchema, createOrderBodySchema, createOrderResponseSchema, creditNoteSchema, GRANT_FAILURE_VALUES, type GrantFailure, GST_RATE_PERCENT, GST_STATE_CODE_VALUES, GST_STATES, type GstStateCode, grantFailureSchema, gstinChecksumValid, gstinSchema, gstStateCodeSchema, gstStateName, INVOICE_KIND_VALUES, type Invoice, type InvoiceKind, type InvoiceParty, invoiceKindSchema, invoicePartySchema, invoiceSchema, ORDER_SOURCE_VALUES, ORDER_STATUS_VALUES, type OrderParams, type OrderSource, type OrderState, type OrderStatus, orderParamsSchema, orderSourceSchema, orderStateSchema, orderStatusSchema, type Payer, type PaymentDetail, type PaymentMethodUpdate, type PaymentPage, type PaymentSummary, type PlanEffect, PURCHASE_KIND_VALUES, type PurchaseItem, type PurchaseKind, payerSchema, paymentDetailSchema, paymentMethodUpdateSchema, paymentPageSchema, paymentSummarySchema, planEffectSchema, purchaseItemSchema, type Quote, type QuoteBody, quoteBodySchema, quoteSchema, type RefundPaymentBody, refundPaymentBodySchema, type SetMembershipBody, type StaffPaymentDetail, type StaffPaymentPage, type StaffPaymentSummary, type StaffPaymentsQuery, type StaffPaymentsQueryInput, type StartAutoRenewalBody, setMembershipBodySchema, staffPaymentDetailSchema, staffPaymentPageSchema, staffPaymentSummarySchema, staffPaymentsQuerySchema, startAutoRenewalBodySchema, type TaxSplit, taxSplitSchema, type UpdateCouponBody, updateCouponBodySchema, } from './domains/billing/billing.js';
|
|
25
|
+
export { type AppliedCoupon, type AutoRenewalParams, type AutoRenewalState, type AutoRenewTerms, appliedCouponSchema, autoRenewalParamsSchema, autoRenewalStateSchema, autoRenewTermsSchema, type BillingDetails, billingDetailsSchema, COUPON_KIND_VALUES, COUPON_TARGET_VALUES, type ConfirmAutoRenewalBody, type ConfirmOrderBody, type Coupon, type CouponBenefit, type CouponKind, type CouponList, type CouponParams, type CouponTarget, type CreateCouponBody, type CreateOrderBody, type CreateOrderResponse, type CreditNote, confirmAutoRenewalBodySchema, confirmOrderBodySchema, couponBenefitSchema, couponCodeSchema, couponListSchema, couponParamsSchema, couponSchema, couponTargetSchema, createCouponBodySchema, createOrderBodySchema, createOrderResponseSchema, creditNoteSchema, GRANT_FAILURE_VALUES, type GrantFailure, GST_RATE_PERCENT, GST_STATE_CODE_VALUES, GST_STATES, type GstStateCode, grantFailureSchema, gstinChecksumValid, gstinSchema, gstStateCodeOf, gstStateCodeSchema, gstStateName, INVOICE_KIND_VALUES, type Invoice, type InvoiceKind, type InvoiceParty, invoiceKindSchema, invoicePartySchema, invoiceSchema, ORDER_SOURCE_VALUES, ORDER_STATUS_VALUES, type OrderParams, type OrderSource, type OrderState, type OrderStatus, orderParamsSchema, orderSourceSchema, orderStateSchema, orderStatusSchema, type Payer, type PaymentDetail, type PaymentMethodUpdate, type PaymentPage, type PaymentSummary, type PlanEffect, PURCHASE_KIND_VALUES, type PurchaseItem, type PurchaseKind, payerSchema, paymentDetailSchema, paymentMethodUpdateSchema, paymentPageSchema, paymentSummarySchema, planEffectSchema, purchaseItemSchema, type Quote, type QuoteBody, quoteBodySchema, quoteSchema, type RefundPaymentBody, refundPaymentBodySchema, type SetMembershipBody, type StaffPaymentDetail, type StaffPaymentPage, type StaffPaymentSummary, type StaffPaymentsQuery, type StaffPaymentsQueryInput, type StartAutoRenewalBody, setMembershipBodySchema, staffPaymentDetailSchema, staffPaymentPageSchema, staffPaymentSummarySchema, staffPaymentsQuerySchema, startAutoRenewalBodySchema, type TaxSplit, taxSplitSchema, type UpdateCouponBody, updateCouponBodySchema, } from './domains/billing/billing.js';
|
|
26
26
|
export { AUTO_RENEW_STOP_REASON_VALUES, type AutoRenewStopReason, autoRenewStopReasonSchema, FC_EMAIL_DATA_SCHEMAS, FC_EMAIL_TEMPLATE_VALUES, type FcEmailData, type FcEmailTemplate, fcAutoRenewStoppedEmailSchema, fcPaymentReceivedEmailSchema, fcPlanEndsSoonEmailSchema, fcPlanRenewsSoonEmailSchema, fcRefundProcessedEmailSchema, fcRenewalDoneEmailSchema, fcRenewalFailedEmailSchema, } from './domains/billing/emails.js';
|
|
27
27
|
export { PAYMENT_METHOD_TEXT_MAX, PAYMENT_METHOD_VALUES, type PaymentMethod, type PaymentMethodSnapshot, paymentMethodSchema, paymentMethodSnapshotSchema, } from './domains/billing/payment-method.js';
|
|
28
28
|
export { BLOCKS_MAX, type BlockAnswer, type BlockedMember, type BlockedPage, type BlockTargetParams, blockAnswerSchema, blockedMemberSchema, blockedPageSchema, blockTargetParamsSchema, } from './domains/blocks/blocks.js';
|
|
@@ -39,7 +39,7 @@ export { AREA_TYPE_VALUES, type AreaList, type AreaOption, type AreaPage, type A
|
|
|
39
39
|
export { CITY_ALIASES, canonicalCityName, canonicalIndiaLocation, findIndiaState, INDIA, INDIA_DIALING_CODE, INDIA_STATE_NAMES, INDIA_STATES, type IndiaState, type IndiaStateName, listedCityName, publicCityOf, STATE_ALIASES, townName, } from './domains/location/india.js';
|
|
40
40
|
export { MEDIA_ATTACHMENT_KIND_VALUES, MEDIA_PURPOSE_VALUES, MEDIA_SIZES, MEDIA_STATUS_VALUES, MEDIA_UPLOAD_CONTENT_TYPES, MEDIA_VARIANTS_MAX, type MediaAttachmentKind, type MediaImage, type MediaPurpose, type MediaStatus, type MediaUploadContentType, type MediaVariant, mediaAttachmentKindSchema, mediaImageSchema, mediaPurposeSchema, mediaStatusSchema, mediaUploadContentTypeSchema, mediaVariantSchema, type UploadedMedia, uploadedMediaSchema, } from './domains/media/media.js';
|
|
41
41
|
export { MEMBER_STATUS_VALUES, type MemberDetail, type MemberDirectoryPage, type MemberDirectoryQuery, type MemberDirectoryQueryInput, type MemberParams, type MemberStatus, type MemberSummary, memberDetailSchema, memberDirectoryPageSchema, memberDirectoryQuerySchema, memberParamsSchema, memberStatusSchema, memberSummarySchema, type SuspendMemberBody, type Suspension, suspendMemberBodySchema, suspensionSchema, } from './domains/members/members.js';
|
|
42
|
-
export { AUTO_RENEWAL_RUNNING_VALUES, AUTO_RENEWAL_STATUS_VALUES, type AutoRenewal, type AutoRenewalStatus, addPlanPeriod, autoRenewalSchema, autoRenewalStatusSchema, EARLY_BIRD_UNTIL, earlyBirdOpen, FEATURED_KIND_VALUES, type FeaturedKind, FOUNDING_PLACES, featuredKindSchema, isEarlyBird, MEMBER_FEATURE_VALUES, MEMBER_LIMIT_VALUES, MEMBER_PROFILE_VIEW_COUNT_DAYS, MEMBERSHIP_END_REASON_VALUES, MEMBERSHIP_KIND_VALUES, MEMBERSHIP_PRICE_PAISE, MEMBERSHIP_STATUS_VALUES, type MeMembership, type Membership, type MembershipEndReason, type MembershipKind, type MembershipStatus, meMembershipSchema, membershipEndReasonSchema, membershipKindSchema, membershipSchema, membershipStatusSchema, type Paise, PLAN_PERIOD_VALUES, PLAN_SPECS, PLAN_TIER_RANK, PLAN_TIER_VALUES, type PlanBlock, type PlanCatalog, type PlanFeatures, type PlanLimits, type PlanOffer, type PlanPeriod, type PlanTier, paiseSchema, planBlockSchema, planCatalogSchema, planFeaturesSchema, planLimitsSchema, planOfferSchema, planPeriodSchema, planTierSchema, TAKES_PART_THROUGH_VALUES, type TakesPartThrough, UPGRADE_DAYS_PER_MONTH, UPGRADE_PER_DAY, UPGRADE_PER_MONTH, UPGRADE_PER_YEAR, upgradePrice, } from './domains/membership/membership.js';
|
|
42
|
+
export { AUTO_RENEWAL_RUNNING_VALUES, AUTO_RENEWAL_STATUS_VALUES, type AutoRenewal, type AutoRenewalStatus, addPlanPeriod, autoRenewalSchema, autoRenewalStatusSchema, EARLY_BIRD_UNTIL, earlyBirdOpen, FEATURED_KIND_VALUES, type FeaturedKind, FOUNDING_PLACES, featuredKindSchema, isEarlyBird, MEMBER_FEATURE_VALUES, MEMBER_LIMIT_VALUES, MEMBER_PROFILE_VIEW_COUNT_DAYS, MEMBERSHIP_END_REASON_VALUES, MEMBERSHIP_KIND_VALUES, MEMBERSHIP_PRICE_PAISE, MEMBERSHIP_STATUS_VALUES, type MeMembership, type Membership, type MembershipEndReason, type MembershipKind, type MembershipStatus, meMembershipSchema, membershipEndReasonSchema, membershipKindSchema, membershipSchema, membershipStatusSchema, type Paise, PLAN_PERIOD_MONTHS, PLAN_PERIOD_VALUES, PLAN_PERIODS_SHORTEST_FIRST, PLAN_SPECS, PLAN_TIER_RANK, PLAN_TIER_VALUES, type PlanBlock, type PlanCatalog, type PlanFeatures, type PlanLimits, type PlanOffer, type PlanPeriod, type PlanTier, paiseSchema, planBlockSchema, planCatalogSchema, planFeaturesSchema, planLimitsSchema, planOfferSchema, planPeriodSchema, planTierSchema, TAKES_PART_THROUGH_VALUES, type TakesPartThrough, UPGRADE_DAYS_PER_MONTH, UPGRADE_PER, UPGRADE_PER_DAY, UPGRADE_PER_MONTH, UPGRADE_PER_YEAR, upgradePrice, } from './domains/membership/membership.js';
|
|
43
43
|
export { MODERATION_ACTION_VALUES, MODERATION_ACTIONS_BY_TARGET_KIND, MODERATION_CONTEXT_KIND_VALUES, MODERATION_STATE_VALUES, type ModerationAction, type ModerationContentQuery, type ModerationContentQueryInput, type ModerationContextKind, type ModerationDecisionBody, type ModerationItem, type ModerationPage, type ModerationState, type ModerationTargetParams, moderationActionSchema, moderationContentQuerySchema, moderationContextKindSchema, moderationDecisionBodySchema, moderationItemSchema, moderationPageSchema, moderationStateSchema, moderationTargetParamsSchema, } from './domains/moderation/moderation.js';
|
|
44
44
|
export { NOTIFICATION_FILTER_VALUES, NOTIFICATION_KIND_VALUES, NOTIFICATION_PREFERENCE_OF, NOTIFICATION_PREFERENCE_VALUES, type Notification, type NotificationFilter, type NotificationKeyParams, type NotificationKind, type NotificationListQuery, type NotificationListQueryInput, type NotificationPage, type NotificationParams, type NotificationPreference, type NotificationPreferences, type NotificationUnreadCount, notificationFilterSchema, notificationKeyParamsSchema, notificationKindSchema, notificationListQuerySchema, notificationPageSchema, notificationParamsSchema, notificationPreferencesSchema, notificationSchema, notificationUnreadCountSchema, type SetNotificationHiddenBody, setNotificationHiddenBodySchema, type UpdateNotificationPreferencesBody, updateNotificationPreferencesBodySchema, } from './domains/notifications/notifications.js';
|
|
45
45
|
export { PUSH_DEVICE_LABEL_MAX, type PushPublicKey, type PushStatus, type PushSubscribeBody, type PushSubscriptionResult, pushPublicKeySchema, pushStatusSchema, pushSubscribeBodySchema, pushSubscriptionResultSchema, } from './domains/notifications/push.js';
|