jansathi-community-schema 0.33.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/constants.d.ts +0 -58
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +17 -64
- package/dist/constants.js.map +1 -1
- package/dist/crowdfunding.d.ts +158 -188
- package/dist/crowdfunding.d.ts.map +1 -1
- package/dist/crowdfunding.js +119 -155
- package/dist/crowdfunding.js.map +1 -1
- package/dist/feed.d.ts +52 -68
- package/dist/feed.d.ts.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
package/dist/constants.d.ts
CHANGED
|
@@ -160,67 +160,9 @@ export declare const CROWDFUNDING_BENEFICIARY_RELATION_MAX_CHARS = 50;
|
|
|
160
160
|
/** Rejection reason length (verifier-supplied). */
|
|
161
161
|
export declare const CROWDFUNDING_REJECTION_REASON_MIN_CHARS = 10;
|
|
162
162
|
export declare const CROWDFUNDING_REJECTION_REASON_MAX_CHARS = 500;
|
|
163
|
-
/** Identity-tier thresholds keyed to Indian regulatory practice:
|
|
164
|
-
* ≤ 25k → Basic (UDP step 9 verified identity only)
|
|
165
|
-
* 25k–2L → Standard (+ PAN + bank-holder-name match)
|
|
166
|
-
* 2L–10L → Enhanced (+ Aadhaar last-4 + category supporting docs)
|
|
167
|
-
* > 10L → Maximum (+ video KYC or in-person verification by
|
|
168
|
-
* district leader)
|
|
169
|
-
* ₹25k = PAN-mandatory threshold for cash deposits.
|
|
170
|
-
* ₹2L = "substantial money" line for verification scrutiny.
|
|
171
|
-
* ₹10L = mandatory video/in-person KYC tier in Indian fintech. */
|
|
172
|
-
export declare const CROWDFUNDING_TIER_STANDARD_INR = 25000;
|
|
173
|
-
export declare const CROWDFUNDING_TIER_ENHANCED_INR = 200000;
|
|
174
|
-
export declare const CROWDFUNDING_TIER_MAXIMUM_INR = 1000000;
|
|
175
163
|
/** Max single self-attested donation amount. Capped at the campaign
|
|
176
164
|
* ceiling — a single donor can't claim more than the entire goal. */
|
|
177
165
|
export declare const CROWDFUNDING_MAX_DONATION_INR = 2500000;
|
|
178
166
|
/** Listing page size when crowdfunding is fetched as its own list. */
|
|
179
167
|
export declare const CROWDFUNDING_PAGE_SIZE = 20;
|
|
180
|
-
import type { CrowdfundingScope } from './crowdfunding.js';
|
|
181
|
-
/**
|
|
182
|
-
* Flat upfront platform-fee tiers, in INR rupees. Mapped on the
|
|
183
|
-
* `CrowdfundingScope` axis so the same lookup serves the composer's
|
|
184
|
-
* Pricing step UI, the backend Razorpay dispatcher, and any future
|
|
185
|
-
* surface that needs to surface "what would this campaign cost".
|
|
186
|
-
*
|
|
187
|
-
* The numbers reflect the relative verifier load each tier represents:
|
|
188
|
-
* a global campaign reaches every viewer in every area and demands
|
|
189
|
-
* far more moderation than a single locality.
|
|
190
|
-
*/
|
|
191
|
-
export declare const CROWDFUNDING_UPFRONT_FEE_INR_BY_SCOPE: {
|
|
192
|
-
readonly local: 500;
|
|
193
|
-
readonly district: 1000;
|
|
194
|
-
readonly state: 2000;
|
|
195
|
-
readonly national: 5000;
|
|
196
|
-
readonly global: 10000;
|
|
197
|
-
};
|
|
198
|
-
/**
|
|
199
|
-
* Deferred-billing rate. Applied at disbursement time to the actual
|
|
200
|
-
* `verifiedAmountInr` collected by the campaign. Lives next to the
|
|
201
|
-
* upfront map so future readers see both paths in one place.
|
|
202
|
-
*/
|
|
203
|
-
export declare const CROWDFUNDING_DEFERRED_FEE_RATE = 0.05;
|
|
204
|
-
/**
|
|
205
|
-
* Look up the flat upfront fee for a given scope. Pure function over
|
|
206
|
-
* the constant map — the indirection exists so the call-sites read as
|
|
207
|
-
* "look up the fee", not "index a map" (and so we have one place to
|
|
208
|
-
* add validation if the scope ever loses a tier).
|
|
209
|
-
*/
|
|
210
|
-
export declare function getCrowdfundingUpfrontFee(scope: CrowdfundingScope): number;
|
|
211
|
-
/**
|
|
212
|
-
* Authoritative deferred-billing deduction — the rupee figure the
|
|
213
|
-
* disbursement pipeline subtracts from `collectedInr` before paying
|
|
214
|
-
* the rest to the creator. Returns 0 for non-positive / non-finite
|
|
215
|
-
* input so the call-site doesn't have to guard.
|
|
216
|
-
*/
|
|
217
|
-
export declare function computeCrowdfundingDeferredFee(collectedInr: number): number;
|
|
218
|
-
/**
|
|
219
|
-
* Display-only "what would this campaign owe if it hits the full
|
|
220
|
-
* target" estimate, surfaced on the Pricing step's Pay-later card so
|
|
221
|
-
* the creator sees a concrete rupee preview before ticking the
|
|
222
|
-
* promise. Same math as the disbursement deduction but parameterised
|
|
223
|
-
* by the GOAL (an upper bound) instead of the realised collection.
|
|
224
|
-
*/
|
|
225
|
-
export declare function getCrowdfundingDeferredEstimate(goalInr: number): number;
|
|
226
168
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,mCAAmC;AACnC,eAAO,MAAM,cAAc,KAAK,CAAC;AAEjC,qCAAqC;AACrC,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC,0CAA0C;AAC1C,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC,yEAAyE;AACzE,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAIvC,2BAA2B;AAC3B,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC,2BAA2B;AAC3B,eAAO,MAAM,eAAe,IAAI,CAAC;AAEjC,0DAA0D;AAC1D,eAAO,MAAM,sBAAsB,QAAU,CAAC;AAE9C,sEAAsE;AACtE,eAAO,MAAM,oBAAoB,QAAmB,CAAC;AAErD,mCAAmC;AACnC,eAAO,MAAM,oBAAoB,QAAoB,CAAC;AAItD;kCACkC;AAClC,eAAO,MAAM,mBAAmB,OAAO,CAAC;AAExC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;AACzD,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC;;aAEa;AACb,eAAO,MAAM,gCAAgC,IAAI,CAAC;AAElD;;;;;kCAKkC;AAClC,eAAO,MAAM,2BAA2B,KAAK,CAAC;AAC9C;gEACgE;AAChE,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAC7C;sDACsD;AACtD,eAAO,MAAM,4CAA4C,IAAI,CAAC;AAC9D,eAAO,MAAM,4CAA4C,MAAM,CAAC;AAEhE;;;;wDAIwD;AACxD,eAAO,MAAM,0BAA0B,SAAS,CAAC;AAEjD;;wEAEwE;AACxE,eAAO,MAAM,oCAAoC,KAAK,CAAC;AAEvD,0BAA0B;AAC1B,eAAO,MAAM,uCAAuC,MAAM,CAAC;AAC3D,eAAO,MAAM,2CAA2C,KAAK,CAAC;AAE9D,mDAAmD;AACnD,eAAO,MAAM,uCAAuC,KAAK,CAAC;AAC1D,eAAO,MAAM,uCAAuC,MAAM,CAAC;AAS3D;sEACsE;AACtE,eAAO,MAAM,6BAA6B,UAA4B,CAAC;AAEvE,sEAAsE;AACtE,eAAO,MAAM,sBAAsB,KAAK,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -169,73 +169,26 @@ export const CROWDFUNDING_BENEFICIARY_RELATION_MAX_CHARS = 50;
|
|
|
169
169
|
/** Rejection reason length (verifier-supplied). */
|
|
170
170
|
export const CROWDFUNDING_REJECTION_REASON_MIN_CHARS = 10;
|
|
171
171
|
export const CROWDFUNDING_REJECTION_REASON_MAX_CHARS = 500;
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
* ₹25k = PAN-mandatory threshold for cash deposits.
|
|
179
|
-
* ₹2L = "substantial money" line for verification scrutiny.
|
|
180
|
-
* ₹10L = mandatory video/in-person KYC tier in Indian fintech. */
|
|
181
|
-
export const CROWDFUNDING_TIER_STANDARD_INR = 25_000;
|
|
182
|
-
export const CROWDFUNDING_TIER_ENHANCED_INR = 2_00_000;
|
|
183
|
-
export const CROWDFUNDING_TIER_MAXIMUM_INR = 10_00_000;
|
|
172
|
+
// v0.37: dropped the composer-side identity-tier thresholds (PAN at
|
|
173
|
+
// 25k, Aadhaar at 2L, video KYC at 10L). KYC is fully delegated to
|
|
174
|
+
// Razorpay's hosted onboarding on the bank-link step — they validate
|
|
175
|
+
// PAN against the IT department, bank account via penny-drop, and
|
|
176
|
+
// Aadhaar via UIDAI's own services. Doing it ourselves earlier was
|
|
177
|
+
// redundant and weakened privacy.
|
|
184
178
|
/** Max single self-attested donation amount. Capped at the campaign
|
|
185
179
|
* ceiling — a single donor can't claim more than the entire goal. */
|
|
186
180
|
export const CROWDFUNDING_MAX_DONATION_INR = CROWDFUNDING_MAX_GOAL_INR;
|
|
187
181
|
/** Listing page size when crowdfunding is fetched as its own list. */
|
|
188
182
|
export const CROWDFUNDING_PAGE_SIZE = 20;
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
local: 500,
|
|
201
|
-
district: 1_000,
|
|
202
|
-
state: 2_000,
|
|
203
|
-
national: 5_000,
|
|
204
|
-
global: 10_000,
|
|
205
|
-
};
|
|
206
|
-
/**
|
|
207
|
-
* Deferred-billing rate. Applied at disbursement time to the actual
|
|
208
|
-
* `verifiedAmountInr` collected by the campaign. Lives next to the
|
|
209
|
-
* upfront map so future readers see both paths in one place.
|
|
210
|
-
*/
|
|
211
|
-
export const CROWDFUNDING_DEFERRED_FEE_RATE = 0.05;
|
|
212
|
-
/**
|
|
213
|
-
* Look up the flat upfront fee for a given scope. Pure function over
|
|
214
|
-
* the constant map — the indirection exists so the call-sites read as
|
|
215
|
-
* "look up the fee", not "index a map" (and so we have one place to
|
|
216
|
-
* add validation if the scope ever loses a tier).
|
|
217
|
-
*/
|
|
218
|
-
export function getCrowdfundingUpfrontFee(scope) {
|
|
219
|
-
return CROWDFUNDING_UPFRONT_FEE_INR_BY_SCOPE[scope];
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* Authoritative deferred-billing deduction — the rupee figure the
|
|
223
|
-
* disbursement pipeline subtracts from `collectedInr` before paying
|
|
224
|
-
* the rest to the creator. Returns 0 for non-positive / non-finite
|
|
225
|
-
* input so the call-site doesn't have to guard.
|
|
226
|
-
*/
|
|
227
|
-
export function computeCrowdfundingDeferredFee(collectedInr) {
|
|
228
|
-
const safe = Number.isFinite(collectedInr) && collectedInr > 0 ? collectedInr : 0;
|
|
229
|
-
return Math.round(safe * CROWDFUNDING_DEFERRED_FEE_RATE);
|
|
230
|
-
}
|
|
231
|
-
/**
|
|
232
|
-
* Display-only "what would this campaign owe if it hits the full
|
|
233
|
-
* target" estimate, surfaced on the Pricing step's Pay-later card so
|
|
234
|
-
* the creator sees a concrete rupee preview before ticking the
|
|
235
|
-
* promise. Same math as the disbursement deduction but parameterised
|
|
236
|
-
* by the GOAL (an upper bound) instead of the realised collection.
|
|
237
|
-
*/
|
|
238
|
-
export function getCrowdfundingDeferredEstimate(goalInr) {
|
|
239
|
-
return computeCrowdfundingDeferredFee(goalInr);
|
|
240
|
-
}
|
|
183
|
+
// ─── Platform-fee model ──────────────────────────────────────────────
|
|
184
|
+
//
|
|
185
|
+
// v0.34 retired the dual upfront/deferred billing model and the
|
|
186
|
+
// per-scope tier table. The platform now retains a flat 5 % commission
|
|
187
|
+
// via Razorpay Route at donation-disbursement time — there is no
|
|
188
|
+
// creator-side billing choice to capture, and there are no scope
|
|
189
|
+
// tiers. The constants/helpers that used to live here have been
|
|
190
|
+
// deleted. The 5 % rate is implemented at the donation-disbursement
|
|
191
|
+
// pipeline (Razorpay `transfers[]` split, see the V2 payment
|
|
192
|
+
// integration) and is not exposed as a schema-level constant since
|
|
193
|
+
// no UI surfaces the rate as a user-facing figure today.
|
|
241
194
|
//# sourceMappingURL=constants.js.map
|
package/dist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AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,IAAI,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CAAC,KAAwB;IAChE,OAAO,qCAAqC,CAAC,KAAK,CAAC,CAAC;AACtD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,8BAA8B,CAAC,YAAoB;IACjE,MAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,YAAY,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;IAClF,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,8BAA8B,CAAC,CAAC;AAC3D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,+BAA+B,CAAC,OAAe;IAC7D,OAAO,8BAA8B,CAAC,OAAO,CAAC,CAAC;AACjD,CAAC","sourcesContent":["/**\n * Tunable constants shared across the community feature.\n *\n * Live here (not inline in feature code) so backend and every frontend\n * agree byte-for-byte on the same limits, paginations, and timeouts.\n * Bump versions of this package when these change.\n *\n * @module community-schema/constants\n */\n\n// ─── Pagination ─────────────────────────────────────────────────────────────\n\n/** Feed list default page size. */\nexport const FEED_PAGE_SIZE = 20;\n\n/** People list default page size. */\nexport const PEOPLE_PAGE_SIZE = 30;\n\n/** Comments per page on a single post. */\nexport const COMMENTS_PAGE_SIZE = 20;\n\n/** Replies per top-level comment loaded with the first comments page. */\nexport const REPLIES_PRELOAD_COUNT = 3;\n\n// ─── Post media limits ─────────────────────────────────────────────────────\n\n/** Max images per post. */\nexport const POST_MAX_IMAGES = 10;\n\n/** Max videos per post. */\nexport const POST_MAX_VIDEOS = 5;\n\n/** Max duration of a single video in seconds (10 min). */\nexport const POST_MAX_VIDEO_SECONDS = 10 * 60;\n\n/** Per-image hard cap (15 MB). The file service compresses to fit. */\nexport const POST_MAX_IMAGE_BYTES = 15 * 1024 * 1024;\n\n/** Per-video hard cap (200 MB). */\nexport const POST_MAX_VIDEO_BYTES = 200 * 1024 * 1024;\n\n// ─── Text limits ────────────────────────────────────────────────────────────\n\n/** Post body character cap. Long enough for long-form, short enough to\n * keep feed rendering snappy. */\nexport const POST_MAX_BODY_CHARS = 5000;\n\n/** Comment + reply body character cap. */\nexport const COMMENT_MAX_BODY_CHARS = 2000;\n\n/** Free-text bio on a public profile. */\nexport const PROFILE_MAX_BIO_CHARS = 280;\n\n// ─── Engagement ─────────────────────────────────────────────────────────────\n\n/** Window during which an author can edit their own post / comment, in ms. */\nexport const EDIT_GRACE_WINDOW_MS = 5 * 60 * 1000;\n\n// ─── Groups ─────────────────────────────────────────────────────────────────\n\n/** Max members in a single user-created group chat. */\nexport const GROUP_MAX_MEMBERS = 256;\n\n/** Group name length. */\nexport const GROUP_NAME_MAX_CHARS = 60;\nexport const GROUP_NAME_MIN_CHARS = 2;\n\n// ─── Communities ───────────────────────────────────────────────────────────\n\n/** Community name length. Same range as a group, with room for a real\n * topic title. */\nexport const COMMUNITY_NAME_MAX_CHARS = 60;\nexport const COMMUNITY_NAME_MIN_CHARS = 2;\n\n/** Slug is auto-generated from name on create (lowercase, hyphenated)\n * but the user may also pick one explicitly on the create form. Match\n * Reddit's vibes: 3-21 chars, lower alphanumeric + underscore + hyphen. */\nexport const COMMUNITY_SLUG_MAX_CHARS = 21;\nexport const COMMUNITY_SLUG_MIN_CHARS = 3;\n/** Slug character class — kept in lockstep with the regex enforced by\n * the create-body Zod schema and the backend's slug normaliser. */\nexport const COMMUNITY_SLUG_PATTERN = /^[a-z0-9_-]+$/;\n\n/** Description shown on the community card + header. */\nexport const COMMUNITY_DESCRIPTION_MAX_CHARS = 500;\n\n/** Communities discover + members + posts page sizes. */\nexport const COMMUNITIES_PAGE_SIZE = 20;\nexport const COMMUNITY_MEMBERS_PAGE_SIZE = 50;\n\n// ─── Community v2 (taxonomy + reach + tags + verification + designation) ──\n\n/** Max tags a community can carry. Tags are picked from a curated\n * enum (`COMMUNITY_TAG_VALUES`), not free text — keeps the picker\n * + discovery filters meaningful. */\nexport const COMMUNITY_MAX_TAGS = 10;\n\n/** Hyperlocal discovery radius. Set generously because GPS accuracy\n * is noisy on phones — 5 km usually covers a viewer's neighborhood\n * plus a buffer of adjacent localities. Single source of truth so\n * backend filter + frontend copy agree. */\nexport const COMMUNITY_HYPERLOCAL_RADIUS_KM = 5;\n\n/** Custom (free-text) designation length bounds — used when the\n * owner / admin types a designation that isn't in the preset enum.\n * The preset path takes precedence; custom is the fallback. */\nexport const COMMUNITY_DESIGNATION_CUSTOM_MIN_CHARS = 2;\nexport const COMMUNITY_DESIGNATION_CUSTOM_MAX_CHARS = 30;\n/** Alphanumeric + space + ampersand — covers natural English labels\n * (\"Vice Chairman\", \"Press & Media\") without opening the door to\n * punctuation soup. */\nexport const COMMUNITY_DESIGNATION_CUSTOM_PATTERN = /^[A-Za-z0-9 &]+$/;\n\n// ─── Polls ─────────────────────────────────────────────────────────────────\n\n/** Poll question (the \"What's your favourite Diwali sweet?\" prompt).\n * Twitter caps at 280; we match for a snappy feed read. */\nexport const POLL_QUESTION_MAX_CHARS = 280;\nexport const POLL_QUESTION_MIN_CHARS = 1;\n\n/** Per-option label length. Long enough for a phrase, short enough that\n * options stack readably in a feed card on a phone. */\nexport const POLL_OPTION_MAX_CHARS = 80;\nexport const POLL_OPTION_MIN_CHARS = 1;\n\n/** A poll must offer at least two options (else it's not a choice) and\n * at most six (more than that fragments votes and tanks readability —\n * matches Twitter's 4 / WhatsApp's 12 / our pick is the middle). */\nexport const POLL_MIN_OPTIONS = 2;\nexport const POLL_MAX_OPTIONS = 6;\n\n/** Duration bounds. Polls MUST have an expiry — open-ended polls go\n * stale and clutter feeds (see PoLLs spec discussion). The floor stops\n * accidental \"1 second\" polls; the ceiling caps a single poll's\n * visibility window so authors think about timing. */\nexport const POLL_MIN_DURATION_MS = 5 * 60 * 1000; // 5 minutes\nexport const POLL_MAX_DURATION_MS = 30 * 24 * 60 * 60 * 1000; // 30 days\n\n/** Composer presets (the radio chips in the duration picker). Custom\n * date entry covers everything in between. Server still validates the\n * resolved `closesAt` against the bounds above. */\nexport const POLL_DURATION_PRESETS_MS = {\n oneDay: 24 * 60 * 60 * 1000,\n threeDays: 3 * 24 * 60 * 60 * 1000,\n sevenDays: 7 * 24 * 60 * 60 * 1000,\n fourteenDays: 14 * 24 * 60 * 60 * 1000,\n} as const;\n\n/** Feed page size for polls when fetched as their own list (rare —\n * polls usually surface via the unified feed). Keeps memory bounded. */\nexport const POLLS_PAGE_SIZE = 20;\n\n// ─── Crowdfunding ──────────────────────────────────────────────────────────\n\n/** Min goal in ₹. Filters spam while staying low enough for genuine\n * community-level requests (small medical bills, school fees, etc.). */\nexport const CROWDFUNDING_MIN_GOAL_INR = 500;\n\n/** Max goal in ₹. v1 ceiling — high enough for real medical/disaster\n * cases, low enough to discourage professional-fundraising adoption\n * before we have escrow infrastructure. */\nexport const CROWDFUNDING_MAX_GOAL_INR = 25_00_000;\n\n/** Minimum campaign duration in days. Below this and there's not enough\n * time for verification + visibility. */\nexport const CROWDFUNDING_MIN_DURATION_DAYS = 7;\n\n/** Max campaign duration in days. Industry norm — active campaigns feel\n * urgent; stagnant ones don't. Creator can always re-launch a follow-up. */\nexport const CROWDFUNDING_MAX_DURATION_DAYS = 60;\n\n/** Title + body limits. Title is the card headline; body is the\n * scrollable story below the goal block. */\nexport const CROWDFUNDING_TITLE_MAX_CHARS = 120;\nexport const CROWDFUNDING_TITLE_MIN_CHARS = 5;\nexport const CROWDFUNDING_DESCRIPTION_MAX_CHARS = 4000;\nexport const CROWDFUNDING_DESCRIPTION_MIN_CHARS = 50;\n\n/** Max story images (different from supporting docs). */\nexport const CROWDFUNDING_MAX_IMAGES = 5;\n\n/** Max supporting documents (medical invoice, school admission letter,\n * etc.). Kept off the wire; only the verifier and the creator see\n * these. */\nexport const CROWDFUNDING_MAX_SUPPORTING_DOCS = 5;\n\n/** Max proof documents the v0.33+ composer accepts. Typed + described\n * per-document; the verifier reviews each one against the campaign's\n * category-specific required-doc matrix. Set higher than\n * `MAX_SUPPORTING_DOCS` because the typed flow expects multiple\n * per-category (e.g. medical: hospital bill + diagnosis + doctor\n * letter + insurance denial). */\nexport const CROWDFUNDING_MAX_PROOF_DOCS = 10;\n/** Minimum proof documents required at submit time. Hard floor; the\n * per-category required-type matrix is enforced separately. */\nexport const CROWDFUNDING_MIN_PROOF_DOCS = 1;\n/** Min / max character length of the per-doc free-text description\n * the creator writes alongside each proof upload. */\nexport const CROWDFUNDING_PROOF_DOC_DESCRIPTION_MIN_CHARS = 3;\nexport const CROWDFUNDING_PROOF_DOC_DESCRIPTION_MAX_CHARS = 200;\n\n/** Current Terms & Conditions version. Bump when material clauses\n * change (fee structure, dispute resolution, KYC obligations); the\n * submit-for-review handler accepts only campaigns whose\n * `acceptedTermsVersion` matches THIS string. The composer's T&C\n * step renders the full body keyed by this version. */\nexport const CROWDFUNDING_TERMS_VERSION = 'v1.0';\n\n/** Days the creator has from approval to complete Razorpay Linked\n * Account KYC. After this window a scheduled job auto-reverts the\n * campaign to `rejected` with a \"bank link deadline missed\" reason. */\nexport const CROWDFUNDING_BANK_LINK_DEADLINE_DAYS = 30;\n\n/** Beneficiary fields. */\nexport const CROWDFUNDING_BENEFICIARY_NAME_MAX_CHARS = 100;\nexport const CROWDFUNDING_BENEFICIARY_RELATION_MAX_CHARS = 50;\n\n/** Rejection reason length (verifier-supplied). */\nexport const CROWDFUNDING_REJECTION_REASON_MIN_CHARS = 10;\nexport const CROWDFUNDING_REJECTION_REASON_MAX_CHARS = 500;\n\n/** Identity-tier thresholds keyed to Indian regulatory practice:\n * ≤ 25k → Basic (UDP step 9 verified identity only)\n * 25k–2L → Standard (+ PAN + bank-holder-name match)\n * 2L–10L → Enhanced (+ Aadhaar last-4 + category supporting docs)\n * > 10L → Maximum (+ video KYC or in-person verification by\n * district leader)\n * ₹25k = PAN-mandatory threshold for cash deposits.\n * ₹2L = \"substantial money\" line for verification scrutiny.\n * ₹10L = mandatory video/in-person KYC tier in Indian fintech. */\nexport const CROWDFUNDING_TIER_STANDARD_INR = 25_000;\nexport const CROWDFUNDING_TIER_ENHANCED_INR = 2_00_000;\nexport const CROWDFUNDING_TIER_MAXIMUM_INR = 10_00_000;\n\n/** Max single self-attested donation amount. Capped at the campaign\n * ceiling — a single donor can't claim more than the entire goal. */\nexport const CROWDFUNDING_MAX_DONATION_INR = CROWDFUNDING_MAX_GOAL_INR;\n\n/** Listing page size when crowdfunding is fetched as its own list. */\nexport const CROWDFUNDING_PAGE_SIZE = 20;\n\n// ─── Platform-fee model ──────────────────────────────────────────────\n//\n// Two settlement paths the creator picks on the composer's Pricing step:\n//\n// • UPFRONT — a flat, scope-tiered fee paid via Razorpay before the\n// campaign goes to leader review. The amount depends only on the\n// reach (local / district / state / national / global) because\n// higher-reach campaigns burn more verifier + moderation work.\n// This is the rupee number the user sees on the \"Pay now\" button.\n//\n// • DEFERRED — the platform deducts 5 % of the COLLECTED amount at\n// disbursement. No money changes hands at submit time; the creator\n// accepts an \"I promise to pay\" attestation on the UI. Whatever\n// donors actually send becomes the basis for the deduction.\n//\n// These constants are the SINGLE SOURCE OF TRUTH consumed by the\n// frontend composer UI, the backend payment dispatcher, and the\n// disbursement pipeline. Changing a fee tier or the deferred rate\n// requires exactly one edit here followed by `npm publish` of this\n// package.\n//\n// NOTE: The flat upfront figures are GST-inclusive (the user sees one\n// final rupee number on the button). Internal accounting splits out\n// the GST component for invoicing — but on the wire and in this math\n// the figure is the total.\n\nimport type { CrowdfundingScope } from './crowdfunding.js';\n\n/**\n * Flat upfront platform-fee tiers, in INR rupees. Mapped on the\n * `CrowdfundingScope` axis so the same lookup serves the composer's\n * Pricing step UI, the backend Razorpay dispatcher, and any future\n * surface that needs to surface \"what would this campaign cost\".\n *\n * The numbers reflect the relative verifier load each tier represents:\n * a global campaign reaches every viewer in every area and demands\n * far more moderation than a single locality.\n */\nexport const CROWDFUNDING_UPFRONT_FEE_INR_BY_SCOPE = {\n local: 500,\n district: 1_000,\n state: 2_000,\n national: 5_000,\n global: 10_000,\n} as const satisfies Record<CrowdfundingScope, number>;\n\n/**\n * Deferred-billing rate. Applied at disbursement time to the actual\n * `verifiedAmountInr` collected by the campaign. Lives next to the\n * upfront map so future readers see both paths in one place.\n */\nexport const CROWDFUNDING_DEFERRED_FEE_RATE = 0.05;\n\n/**\n * Look up the flat upfront fee for a given scope. Pure function over\n * the constant map — the indirection exists so the call-sites read as\n * \"look up the fee\", not \"index a map\" (and so we have one place to\n * add validation if the scope ever loses a tier).\n */\nexport function getCrowdfundingUpfrontFee(scope: CrowdfundingScope): number {\n return CROWDFUNDING_UPFRONT_FEE_INR_BY_SCOPE[scope];\n}\n\n/**\n * Authoritative deferred-billing deduction — the rupee figure the\n * disbursement pipeline subtracts from `collectedInr` before paying\n * the rest to the creator. Returns 0 for non-positive / non-finite\n * input so the call-site doesn't have to guard.\n */\nexport function computeCrowdfundingDeferredFee(collectedInr: number): number {\n const safe = Number.isFinite(collectedInr) && collectedInr > 0 ? collectedInr : 0;\n return Math.round(safe * CROWDFUNDING_DEFERRED_FEE_RATE);\n}\n\n/**\n * Display-only \"what would this campaign owe if it hits the full\n * target\" estimate, surfaced on the Pricing step's Pay-later card so\n * the creator sees a concrete rupee preview before ticking the\n * promise. Same math as the disbursement deduction but parameterised\n * by the GOAL (an upper bound) instead of the realised collection.\n */\nexport function getCrowdfundingDeferredEstimate(goalInr: number): number {\n return computeCrowdfundingDeferredFee(goalInr);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,+EAA+E;AAE/E,mCAAmC;AACnC,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAC;AAEjC,qCAAqC;AACrC,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAEnC,0CAA0C;AAC1C,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAErC,yEAAyE;AACzE,MAAM,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AAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC;AAEjD;;wEAEwE;AACxE,MAAM,CAAC,MAAM,oCAAoC,GAAG,EAAE,CAAC;AAEvD,0BAA0B;AAC1B,MAAM,CAAC,MAAM,uCAAuC,GAAG,GAAG,CAAC;AAC3D,MAAM,CAAC,MAAM,2CAA2C,GAAG,EAAE,CAAC;AAE9D,mDAAmD;AACnD,MAAM,CAAC,MAAM,uCAAuC,GAAG,EAAE,CAAC;AAC1D,MAAM,CAAC,MAAM,uCAAuC,GAAG,GAAG,CAAC;AAE3D,oEAAoE;AACpE,mEAAmE;AACnE,qEAAqE;AACrE,kEAAkE;AAClE,mEAAmE;AACnE,kCAAkC;AAElC;sEACsE;AACtE,MAAM,CAAC,MAAM,6BAA6B,GAAG,yBAAyB,CAAC;AAEvE,sEAAsE;AACtE,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAEzC,wEAAwE;AACxE,EAAE;AACF,gEAAgE;AAChE,uEAAuE;AACvE,iEAAiE;AACjE,iEAAiE;AACjE,gEAAgE;AAChE,oEAAoE;AACpE,6DAA6D;AAC7D,mEAAmE;AACnE,yDAAyD","sourcesContent":["/**\n * Tunable constants shared across the community feature.\n *\n * Live here (not inline in feature code) so backend and every frontend\n * agree byte-for-byte on the same limits, paginations, and timeouts.\n * Bump versions of this package when these change.\n *\n * @module community-schema/constants\n */\n\n// ─── Pagination ─────────────────────────────────────────────────────────────\n\n/** Feed list default page size. */\nexport const FEED_PAGE_SIZE = 20;\n\n/** People list default page size. */\nexport const PEOPLE_PAGE_SIZE = 30;\n\n/** Comments per page on a single post. */\nexport const COMMENTS_PAGE_SIZE = 20;\n\n/** Replies per top-level comment loaded with the first comments page. */\nexport const REPLIES_PRELOAD_COUNT = 3;\n\n// ─── Post media limits ─────────────────────────────────────────────────────\n\n/** Max images per post. */\nexport const POST_MAX_IMAGES = 10;\n\n/** Max videos per post. */\nexport const POST_MAX_VIDEOS = 5;\n\n/** Max duration of a single video in seconds (10 min). */\nexport const POST_MAX_VIDEO_SECONDS = 10 * 60;\n\n/** Per-image hard cap (15 MB). The file service compresses to fit. */\nexport const POST_MAX_IMAGE_BYTES = 15 * 1024 * 1024;\n\n/** Per-video hard cap (200 MB). */\nexport const POST_MAX_VIDEO_BYTES = 200 * 1024 * 1024;\n\n// ─── Text limits ────────────────────────────────────────────────────────────\n\n/** Post body character cap. Long enough for long-form, short enough to\n * keep feed rendering snappy. */\nexport const POST_MAX_BODY_CHARS = 5000;\n\n/** Comment + reply body character cap. */\nexport const COMMENT_MAX_BODY_CHARS = 2000;\n\n/** Free-text bio on a public profile. */\nexport const PROFILE_MAX_BIO_CHARS = 280;\n\n// ─── Engagement ─────────────────────────────────────────────────────────────\n\n/** Window during which an author can edit their own post / comment, in ms. */\nexport const EDIT_GRACE_WINDOW_MS = 5 * 60 * 1000;\n\n// ─── Groups ─────────────────────────────────────────────────────────────────\n\n/** Max members in a single user-created group chat. */\nexport const GROUP_MAX_MEMBERS = 256;\n\n/** Group name length. */\nexport const GROUP_NAME_MAX_CHARS = 60;\nexport const GROUP_NAME_MIN_CHARS = 2;\n\n// ─── Communities ───────────────────────────────────────────────────────────\n\n/** Community name length. Same range as a group, with room for a real\n * topic title. */\nexport const COMMUNITY_NAME_MAX_CHARS = 60;\nexport const COMMUNITY_NAME_MIN_CHARS = 2;\n\n/** Slug is auto-generated from name on create (lowercase, hyphenated)\n * but the user may also pick one explicitly on the create form. Match\n * Reddit's vibes: 3-21 chars, lower alphanumeric + underscore + hyphen. */\nexport const COMMUNITY_SLUG_MAX_CHARS = 21;\nexport const COMMUNITY_SLUG_MIN_CHARS = 3;\n/** Slug character class — kept in lockstep with the regex enforced by\n * the create-body Zod schema and the backend's slug normaliser. */\nexport const COMMUNITY_SLUG_PATTERN = /^[a-z0-9_-]+$/;\n\n/** Description shown on the community card + header. */\nexport const COMMUNITY_DESCRIPTION_MAX_CHARS = 500;\n\n/** Communities discover + members + posts page sizes. */\nexport const COMMUNITIES_PAGE_SIZE = 20;\nexport const COMMUNITY_MEMBERS_PAGE_SIZE = 50;\n\n// ─── Community v2 (taxonomy + reach + tags + verification + designation) ──\n\n/** Max tags a community can carry. Tags are picked from a curated\n * enum (`COMMUNITY_TAG_VALUES`), not free text — keeps the picker\n * + discovery filters meaningful. */\nexport const COMMUNITY_MAX_TAGS = 10;\n\n/** Hyperlocal discovery radius. Set generously because GPS accuracy\n * is noisy on phones — 5 km usually covers a viewer's neighborhood\n * plus a buffer of adjacent localities. Single source of truth so\n * backend filter + frontend copy agree. */\nexport const COMMUNITY_HYPERLOCAL_RADIUS_KM = 5;\n\n/** Custom (free-text) designation length bounds — used when the\n * owner / admin types a designation that isn't in the preset enum.\n * The preset path takes precedence; custom is the fallback. */\nexport const COMMUNITY_DESIGNATION_CUSTOM_MIN_CHARS = 2;\nexport const COMMUNITY_DESIGNATION_CUSTOM_MAX_CHARS = 30;\n/** Alphanumeric + space + ampersand — covers natural English labels\n * (\"Vice Chairman\", \"Press & Media\") without opening the door to\n * punctuation soup. */\nexport const COMMUNITY_DESIGNATION_CUSTOM_PATTERN = /^[A-Za-z0-9 &]+$/;\n\n// ─── Polls ─────────────────────────────────────────────────────────────────\n\n/** Poll question (the \"What's your favourite Diwali sweet?\" prompt).\n * Twitter caps at 280; we match for a snappy feed read. */\nexport const POLL_QUESTION_MAX_CHARS = 280;\nexport const POLL_QUESTION_MIN_CHARS = 1;\n\n/** Per-option label length. Long enough for a phrase, short enough that\n * options stack readably in a feed card on a phone. */\nexport const POLL_OPTION_MAX_CHARS = 80;\nexport const POLL_OPTION_MIN_CHARS = 1;\n\n/** A poll must offer at least two options (else it's not a choice) and\n * at most six (more than that fragments votes and tanks readability —\n * matches Twitter's 4 / WhatsApp's 12 / our pick is the middle). */\nexport const POLL_MIN_OPTIONS = 2;\nexport const POLL_MAX_OPTIONS = 6;\n\n/** Duration bounds. Polls MUST have an expiry — open-ended polls go\n * stale and clutter feeds (see PoLLs spec discussion). The floor stops\n * accidental \"1 second\" polls; the ceiling caps a single poll's\n * visibility window so authors think about timing. */\nexport const POLL_MIN_DURATION_MS = 5 * 60 * 1000; // 5 minutes\nexport const POLL_MAX_DURATION_MS = 30 * 24 * 60 * 60 * 1000; // 30 days\n\n/** Composer presets (the radio chips in the duration picker). Custom\n * date entry covers everything in between. Server still validates the\n * resolved `closesAt` against the bounds above. */\nexport const POLL_DURATION_PRESETS_MS = {\n oneDay: 24 * 60 * 60 * 1000,\n threeDays: 3 * 24 * 60 * 60 * 1000,\n sevenDays: 7 * 24 * 60 * 60 * 1000,\n fourteenDays: 14 * 24 * 60 * 60 * 1000,\n} as const;\n\n/** Feed page size for polls when fetched as their own list (rare —\n * polls usually surface via the unified feed). Keeps memory bounded. */\nexport const POLLS_PAGE_SIZE = 20;\n\n// ─── Crowdfunding ──────────────────────────────────────────────────────────\n\n/** Min goal in ₹. Filters spam while staying low enough for genuine\n * community-level requests (small medical bills, school fees, etc.). */\nexport const CROWDFUNDING_MIN_GOAL_INR = 500;\n\n/** Max goal in ₹. v1 ceiling — high enough for real medical/disaster\n * cases, low enough to discourage professional-fundraising adoption\n * before we have escrow infrastructure. */\nexport const CROWDFUNDING_MAX_GOAL_INR = 25_00_000;\n\n/** Minimum campaign duration in days. Below this and there's not enough\n * time for verification + visibility. */\nexport const CROWDFUNDING_MIN_DURATION_DAYS = 7;\n\n/** Max campaign duration in days. Industry norm — active campaigns feel\n * urgent; stagnant ones don't. Creator can always re-launch a follow-up. */\nexport const CROWDFUNDING_MAX_DURATION_DAYS = 60;\n\n/** Title + body limits. Title is the card headline; body is the\n * scrollable story below the goal block. */\nexport const CROWDFUNDING_TITLE_MAX_CHARS = 120;\nexport const CROWDFUNDING_TITLE_MIN_CHARS = 5;\nexport const CROWDFUNDING_DESCRIPTION_MAX_CHARS = 4000;\nexport const CROWDFUNDING_DESCRIPTION_MIN_CHARS = 50;\n\n/** Max story images (different from supporting docs). */\nexport const CROWDFUNDING_MAX_IMAGES = 5;\n\n/** Max supporting documents (medical invoice, school admission letter,\n * etc.). Kept off the wire; only the verifier and the creator see\n * these. */\nexport const CROWDFUNDING_MAX_SUPPORTING_DOCS = 5;\n\n/** Max proof documents the v0.33+ composer accepts. Typed + described\n * per-document; the verifier reviews each one against the campaign's\n * category-specific required-doc matrix. Set higher than\n * `MAX_SUPPORTING_DOCS` because the typed flow expects multiple\n * per-category (e.g. medical: hospital bill + diagnosis + doctor\n * letter + insurance denial). */\nexport const CROWDFUNDING_MAX_PROOF_DOCS = 10;\n/** Minimum proof documents required at submit time. Hard floor; the\n * per-category required-type matrix is enforced separately. */\nexport const CROWDFUNDING_MIN_PROOF_DOCS = 1;\n/** Min / max character length of the per-doc free-text description\n * the creator writes alongside each proof upload. */\nexport const CROWDFUNDING_PROOF_DOC_DESCRIPTION_MIN_CHARS = 3;\nexport const CROWDFUNDING_PROOF_DOC_DESCRIPTION_MAX_CHARS = 200;\n\n/** Current Terms & Conditions version. Bump when material clauses\n * change (fee structure, dispute resolution, KYC obligations); the\n * submit-for-review handler accepts only campaigns whose\n * `acceptedTermsVersion` matches THIS string. The composer's T&C\n * step renders the full body keyed by this version. */\nexport const CROWDFUNDING_TERMS_VERSION = 'v1.0';\n\n/** Days the creator has from approval to complete Razorpay Linked\n * Account KYC. After this window a scheduled job auto-reverts the\n * campaign to `rejected` with a \"bank link deadline missed\" reason. */\nexport const CROWDFUNDING_BANK_LINK_DEADLINE_DAYS = 30;\n\n/** Beneficiary fields. */\nexport const CROWDFUNDING_BENEFICIARY_NAME_MAX_CHARS = 100;\nexport const CROWDFUNDING_BENEFICIARY_RELATION_MAX_CHARS = 50;\n\n/** Rejection reason length (verifier-supplied). */\nexport const CROWDFUNDING_REJECTION_REASON_MIN_CHARS = 10;\nexport const CROWDFUNDING_REJECTION_REASON_MAX_CHARS = 500;\n\n// v0.37: dropped the composer-side identity-tier thresholds (PAN at\n// 25k, Aadhaar at 2L, video KYC at 10L). KYC is fully delegated to\n// Razorpay's hosted onboarding on the bank-link step — they validate\n// PAN against the IT department, bank account via penny-drop, and\n// Aadhaar via UIDAI's own services. Doing it ourselves earlier was\n// redundant and weakened privacy.\n\n/** Max single self-attested donation amount. Capped at the campaign\n * ceiling — a single donor can't claim more than the entire goal. */\nexport const CROWDFUNDING_MAX_DONATION_INR = CROWDFUNDING_MAX_GOAL_INR;\n\n/** Listing page size when crowdfunding is fetched as its own list. */\nexport const CROWDFUNDING_PAGE_SIZE = 20;\n\n// ─── Platform-fee model ──────────────────────────────────────────────\n//\n// v0.34 retired the dual upfront/deferred billing model and the\n// per-scope tier table. The platform now retains a flat 5 % commission\n// via Razorpay Route at donation-disbursement time — there is no\n// creator-side billing choice to capture, and there are no scope\n// tiers. The constants/helpers that used to live here have been\n// deleted. The 5 % rate is implemented at the donation-disbursement\n// pipeline (Razorpay `transfers[]` split, see the V2 payment\n// integration) and is not exposed as a schema-level constant since\n// no UI surfaces the rate as a user-facing figure today.\n"]}
|