gymmonk-schema 0.40.0 → 0.41.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/center.d.ts CHANGED
@@ -490,11 +490,22 @@ export type NearbyGym = z.infer<typeof nearbyGymSchema>;
490
490
  * address `ancestry` array every center stores.
491
491
  */
492
492
  export declare const GYM_SEARCH_MAX_RESULTS = 20;
493
+ /**
494
+ * How far "near me" reaches, in kilometres.
495
+ *
496
+ * A bound rather than "the nearest 20 wherever they are". Without one, a member
497
+ * in a town with no gyms is shown the nearest one 400km away as though it were
498
+ * a suggestion — a list that is technically sorted and practically useless. The
499
+ * empty state points them at a different location or a gym id instead, which
500
+ * are the two things that can actually help.
501
+ */
502
+ export declare const GYM_SEARCH_NEARBY_RADIUS_KM = 50;
493
503
  export declare const gymSearchQuerySchema: z.ZodObject<{
494
504
  code: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
495
505
  q: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
496
506
  stateId: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
497
507
  districtId: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
508
+ areaId: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
498
509
  lat: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
499
510
  lng: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
500
511
  limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
@@ -1 +1 @@
1
- {"version":3,"file":"center.d.ts","sourceRoot":"","sources":["../src/center.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAexB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,eAAO,MAAM,YAAY,oTAgCf,CAAC;AACX,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;EAAuB,CAAC;AACrD,MAA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AAC,OAAO,oBAAoB,CAAC,CAAC;AAElE;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;iBAIhC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAKpE,eAAO,MAAM,qBAAqB;;;;iBAIhC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
package/dist/center.js CHANGED
@@ -244,6 +244,16 @@ export const nearbyGymSchema = z.object({
244
244
  * address `ancestry` array every center stores.
245
245
  */
246
246
  export const GYM_SEARCH_MAX_RESULTS = 20;
247
+ /**
248
+ * How far "near me" reaches, in kilometres.
249
+ *
250
+ * A bound rather than "the nearest 20 wherever they are". Without one, a member
251
+ * in a town with no gyms is shown the nearest one 400km away as though it were
252
+ * a suggestion — a list that is technically sorted and practically useless. The
253
+ * empty state points them at a different location or a gym id instead, which
254
+ * are the two things that can actually help.
255
+ */
256
+ export const GYM_SEARCH_NEARBY_RADIUS_KM = 50;
247
257
  export const gymSearchQuerySchema = z
248
258
  .object({
249
259
  /** Exact public gym id, e.g. `GYM-2025-001`. Unscoped by geography. */
@@ -252,6 +262,16 @@ export const gymSearchQuerySchema = z
252
262
  q: optionalTrimmedString(120),
253
263
  stateId: optionalTrimmedString(40),
254
264
  districtId: optionalTrimmedString(40),
265
+ /**
266
+ * Any master-area id — state, district, or one of the eight sub-district
267
+ * types the location drawer can reach.
268
+ *
269
+ * Matched against the `ancestry` every centre stores, exactly as
270
+ * `stateId` / `districtId` are, so one parameter covers every depth the
271
+ * picker offers. Those two stay because callers already send them and they
272
+ * read more clearly at the two levels that have their own control.
273
+ */
274
+ areaId: optionalTrimmedString(40),
255
275
  lat: z.coerce.number().min(-90).max(90).optional(),
256
276
  lng: z.coerce.number().min(-180).max(180).optional(),
257
277
  limit: z.coerce
@@ -265,7 +285,7 @@ export const gymSearchQuerySchema = z
265
285
  message: 'Pick a state to search gyms by name',
266
286
  path: ['stateId'],
267
287
  })
268
- .refine((v) => Boolean(v.code || v.q || v.stateId || v.districtId), {
288
+ .refine((v) => Boolean(v.code || v.q || v.stateId || v.districtId || v.areaId || (v.lat != null && v.lng != null)), {
269
289
  message: 'Enter a gym id, or pick where to look',
270
290
  path: ['stateId'],
271
291
  });
@@ -1 +1 @@
1
- {"version":3,"file":"center.js","sourceRoot":"","sources":["../src/center.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE/D,gFAAgF;AAEhF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,UAAU;IACV,KAAK;IACL,WAAW;IACX,UAAU;IACV,UAAU;IACV,YAAY;IACZ,cAAc;IACd,cAAc;IACd,cAAc;IACd,0BAA0B;IAC1B,QAAQ;IACR,MAAM;IACN,UAAU;IACV,UAAU;IACV,UAAU;IACV,qBAAqB;IACrB,cAAc;IACd,MAAM;IACN,SAAS;IACT,YAAY;IACZ,QAAQ;IACR,OAAO;IACP,OAAO;IACP,SAAS;IACT,QAAQ;IACR,YAAY;IACZ,KAAK;IACL,cAAc;IACd,aAAa;IACb,UAAU;IACV,eAAe;CACP,CAAC;AACX,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC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I,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,UAAU,CAAC,EAAE;IAClE,OAAO,EAAE,uCAAuC;IAChD,IAAI,EAAE,CAAC,SAAS,CAAC;CAClB,CAAC,CAAC;AAGL;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC;IAC/B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IACrC,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;CACvB,CAAC,CAAC;AAGH,gFAAgF;AAChF,+EAA+E;AAC/E,2BAA2B;AAC3B,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE;IAClD,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IACpD,CAAC,EAAE,qBAAqB,CAAC,GAAG,CAAC;CAC9B,CAAC,CAAC","sourcesContent":["/**\n * gymmonk-schema — Center (branch)\n * ================================\n * A physical gym location belonging to an organisation. Carries the public gym\n * code members use to join, opening hours, equipment scope, and contact info.\n * v1 memberships are single-center, so a Center is the unit a member joins.\n *\n * @module gymmonk-schema/center\n */\n\nimport { z } from 'zod';\nimport { centerCodeSchema } from './codes.js';\nimport {\n isoDateTimeSchema,\n objectIdSchema,\n optionalEmailSchema,\n optionalPhoneSchema,\n optionalTrimmedString,\n phoneSchema,\n} from './common.js';\nimport { mapLinkInputSchema, placePinSchema, timezoneSchema } from './location.js';\nimport { addressSchema, weeklyHoursSchema } from './shared.js';\n\n// ─── Center type ─────────────────────────────────────────────────────────────\n\n/**\n * What a centre OFFERS, multi-select.\n *\n * ── The axis, and why `personal-training` is gone ───────────────────────────\n * Every value here answers one question: what does somebody DO at this place.\n * That makes them disciplines and training modalities, so an owner ticking\n * three of them describes a real branch and a member reading them knows what\n * they are walking into.\n *\n * `personal-training` answered a different question — HOW coaching is\n * delivered, one-to-one instead of in a class — and nearly every gym in the\n * list offers it. A value almost everyone can tick separates nobody from\n * anybody, which is the opposite of what a type is for. Business model\n * (big-box, boutique, 24-hour) is a third axis again, and one this product\n * already answers better elsewhere: floor area and opening hours are recorded\n * fields, not a guess from a chip.\n *\n * ── Where the list comes from ───────────────────────────────────────────────\n * Cross-referenced rather than invented: Google Business Profile's fitness\n * categories (what gyms actually file themselves under, and therefore what\n * members search), ClassPass and Mindbody's activity taxonomies, and the\n * formats the Indian market actually runs — cult.fit's S&C, HRX, boxing, dance\n * fitness and yoga, plus the bodybuilding and martial-arts traditions that a\n * list drawn only from US sources would miss entirely.\n *\n * Deliberately NOT included, so the next person does not re-litigate it:\n * rock climbing, gymnastics and aerial/pole are real facility categories but\n * not gyms in the sense this product manages; women-only and kids' fitness\n * describe an AUDIENCE, not an activity; 24-hour and big-box describe hours\n * and size, both of which are already their own fields.\n *\n * Values are stable slugs — the LABELS are the frontend's business, so\n * rewording a chip never rewrites stored data.\n *\n * ── The field is called `types`; the screen says \"What this center offers\" ──\n * That divergence is deliberate, not an oversight. \"Type\" reads as one thing a\n * place IS, and a real branch runs several — a weights floor, a yoga room and\n * Zumba on weekends — so a singular-sounding label pushed owners to pick one\n * and misdescribe themselves. (The picker was once a single-select with a\n * \"Mixed\" option that saved as plain `gym`, which is how a CrossFit-and-boxing\n * branch came back as neither.) The label was changed to match what is stored;\n * the identifiers were not, because the values are a wire contract and\n * renaming them would rewrite data to fix a word.\n */\nexport const CENTER_TYPES = [\n // General\n 'gym',\n // Strength\n 'strength',\n 'crossfit',\n 'functional',\n 'bodybuilding',\n 'powerlifting',\n 'calisthenics',\n // Cardio & group training\n 'cardio',\n 'hiit',\n 'spinning',\n 'bootcamp',\n 'aerobics',\n 'sports-conditioning',\n // Mind & body\n 'yoga',\n 'pilates',\n 'meditation',\n // Dance\n 'zumba',\n 'dance',\n // Combat\n 'boxing',\n 'kickboxing',\n 'mma',\n 'martial-arts',\n // Facilities\n 'swimming',\n 'physiotherapy',\n] as const;\nexport const centerTypeSchema = z.enum(CENTER_TYPES);\nexport type CenterType = z.infer<typeof centerTypeSchema>;\n\n// ─── Status ──────────────────────────────────────────────────────────────────\n\nexport const centerStatusSchema = z.enum(['active', 'inactive']);\nexport type CenterStatus = z.infer<typeof centerStatusSchema>;\n\n// The public gym code (`IRN-1-7K2M`) is defined in `codes.ts` alongside the\n// member ids built on the same stem, so the four identifier shapes this product\n// issues can be read — and kept from colliding — in one place. Re-exported here\n// because a centre's code is a fact about a centre.\nexport { type CenterCode, centerCodeSchema } from './codes.js';\n\n// ─── Create / update bodies ──────────────────────────────────────────────────\n\nexport const createCenterBodySchema = z.object({\n name: z.string().trim().min(1, 'Center name is required').max(160),\n description: optionalTrimmedString(2000),\n types: z.array(centerTypeSchema).min(1, 'Pick at least one'),\n address: addressSchema,\n /** Usable floor area in square feet. */\n floorAreaSqft: z.number().int().min(0).max(1_000_000).optional(),\n /**\n * How many people the branch holds at once.\n *\n * The denominator behind \"how full are we\" — the centre detail screen shows\n * it beside the active-member count, and crowd-load has no meaning without\n * it. Optional: a gym that has never measured it should not be blocked from\n * saving the rest of its details.\n */\n capacity: z.number().int().min(1).max(100_000).optional(),\n primaryPhone: phoneSchema,\n secondaryPhone: optionalPhoneSchema,\n email: optionalEmailSchema,\n website: optionalTrimmedString(200),\n hours: weeklyHoursSchema,\n /** Uploaded gallery image URLs. */\n photos: z.array(z.string().trim().max(2000)).max(20).default([]),\n /**\n * A pasted Google Maps link. The server reads the coordinates out of it; the\n * client never sends them.\n *\n * This is the pin attendance is measured against, and it is NOT the same as\n * `address.coords`: that is an area centroid resolved from master data, which\n * can be a whole district's midpoint and is useless for proximity.\n */\n ...mapLinkInputSchema.shape,\n /**\n * How close a member must be for a check-in to count, metres. Optional — the\n * server applies its own default when a gym has not chosen one.\n */\n checkInRadiusM: z.number().int().min(50).max(5000).optional(),\n});\nexport type CreateCenterBody = z.infer<typeof createCenterBodySchema>;\n\nexport const updateCenterBodySchema = createCenterBodySchema.partial();\nexport type UpdateCenterBody = z.infer<typeof updateCenterBodySchema>;\n\n// ─── Entity (API response) ───────────────────────────────────────────────────\n\nexport const centerSchema = z.object({\n id: objectIdSchema,\n organisationId: objectIdSchema,\n /** Public join code, `IRN-1-7K2M`. */\n code: centerCodeSchema,\n /**\n * Which centre this is within its organisation — 1 for the first branch the\n * owner opened, 2 for the next.\n *\n * Stored rather than counted on read, because it is baked into this centre's\n * code AND into every member id the centre issues. Deleting branch 2 must not\n * renumber branch 3 into codes that are already printed.\n */\n sequence: z.number().int().positive(),\n name: z.string(),\n description: z.string().nullable(),\n types: z.array(centerTypeSchema),\n address: addressSchema,\n floorAreaSqft: z.number().int().nullable(),\n capacity: z.number().int().nullable(),\n primaryPhone: z.string(),\n secondaryPhone: z.string().nullable(),\n email: z.string().nullable(),\n website: z.string().nullable(),\n hours: weeklyHoursSchema,\n photos: z.array(z.string()),\n status: centerStatusSchema,\n /** Denormalised active-member count for roster headers. */\n memberCount: z.number().int().nonnegative(),\n // The resolved pin. Absent until an owner pastes a Maps link, which is why\n // attendance is unenforceable rather than failing for a gym without one.\n ...placePinSchema.shape,\n checkInRadiusM: z.number().int().nullable().optional(),\n /**\n * The centre's own timezone, as an IANA identifier (\"Asia/Kolkata\").\n *\n * WHY THE CENTRE'S AND NOT THE VIEWER'S. Attendance is filed under a calendar\n * DAY, and a day is not timezone-free — whichever zone derives it defines when\n * it starts. Deriving it from whoever is looking would put one visit on\n * different days for the member and the owner, and would make an owner's daily\n * roll-up change depending on where they opened the app. A visit belongs to the\n * gym's operating day; only the display of times follows the reader.\n *\n * An IANA NAME, never a UTC offset. Offsets are a property of an instant, not\n * of a place: they move with DST, so a stored \"+05:30\" is already wrong for\n * half the year anywhere that observes it.\n *\n * Server-derived from the centre's pin, never accepted from a client — the\n * same rule the coordinates follow, and for the same reason.\n */\n timezone: timezoneSchema,\n createdAt: isoDateTimeSchema,\n updatedAt: isoDateTimeSchema,\n});\nexport type Center = z.infer<typeof centerSchema>;\n\n// ─── Center stats (owner detail header) ──────────────────────────────────────\n\n/**\n * The three-up header on a centre's detail screen.\n *\n * Computed, never stored — `activeMembers` counts live memberships and\n * `monthlyRevenueInr` sums this month's successful payments, so the card can\n * never drift from the ledger the way a denormalised total would. `capacity`\n * is the one stored value, and is null until the owner fills it in.\n */\nexport const centerStatsSchema = z.object({\n capacity: z.number().int().nullable(),\n activeMembers: z.number().int().nonnegative(),\n monthlyRevenueInr: z.number().nonnegative(),\n});\nexport type CenterStats = z.infer<typeof centerStatsSchema>;\n\n// ─── Gym directory (member \"find a gym\") ─────────────────────────────────────\n\n/** A lightweight public directory result for the \"find a gym\" screen. */\nexport const nearbyGymSchema = z.object({\n id: objectIdSchema,\n code: centerCodeSchema,\n name: z.string(),\n /** The narrowest place name we hold (locality → district → state). */\n area: z.string(),\n district: z.string().nullable(),\n state: z.string().nullable(),\n /**\n * Kilometres from the coordinates the caller supplied.\n *\n * NULL, not 0, when it cannot be computed — the caller sent no position, or\n * the gym's address carries no coordinates. Zero is a real distance (\"you are\n * standing in it\") and using it as the unknown value put every un-geocoded\n * gym at the top of a nearest-first list.\n */\n distanceKm: z.number().nonnegative().nullable(),\n memberCount: z.number().int().nonnegative().optional(),\n});\nexport type NearbyGym = z.infer<typeof nearbyGymSchema>;\n\n/**\n * The gym directory has THREE ways in, and they differ in how far they reach.\n *\n * `code` exact public gym id — matches anywhere in the country, because\n * a member holding the id already knows which gym they mean and\n * may well be joining one in another state.\n * `q` name search — deliberately narrowed to ONE STATE. Gym names\n * repeat heavily (\"Fitness First\"), so a nationwide name search\n * returns a list nobody can pick from.\n * `districtId` browse — the gyms around them, nearest first when they share\n * their position.\n *\n * `stateId` / `districtId` are master-area ids (`area.ts`), matched against the\n * address `ancestry` array every center stores.\n */\nexport const GYM_SEARCH_MAX_RESULTS = 20;\n\nexport const gymSearchQuerySchema = z\n .object({\n /** Exact public gym id, e.g. `GYM-2025-001`. Unscoped by geography. */\n code: optionalTrimmedString(40),\n /** Name fragment. Requires `stateId`. */\n q: optionalTrimmedString(120),\n stateId: optionalTrimmedString(40),\n districtId: optionalTrimmedString(40),\n lat: z.coerce.number().min(-90).max(90).optional(),\n lng: z.coerce.number().min(-180).max(180).optional(),\n limit: z.coerce\n .number()\n .int()\n .min(1)\n .max(GYM_SEARCH_MAX_RESULTS)\n .default(GYM_SEARCH_MAX_RESULTS),\n })\n .refine((v) => !v.q || Boolean(v.stateId), {\n message: 'Pick a state to search gyms by name',\n path: ['stateId'],\n })\n .refine((v) => Boolean(v.code || v.q || v.stateId || v.districtId), {\n message: 'Enter a gym id, or pick where to look',\n path: ['stateId'],\n });\nexport type GymSearchQuery = z.infer<typeof gymSearchQuerySchema>;\n\n/**\n * The directory response.\n *\n * `truncated` says the district holds more gyms than were returned, which is\n * what the screen turns into \"showing the 20 nearest — enter a gym id if yours\n * is not here\" rather than letting the member assume their gym is absent.\n */\nexport const gymSearchResultSchema = z.object({\n items: z.array(nearbyGymSchema),\n total: z.number().int().nonnegative(),\n truncated: z.boolean(),\n});\nexport type GymSearchResult = z.infer<typeof gymSearchResultSchema>;\n\n// ─── Retained: nearby-gyms query ─────────────────────────────────────────────\n// Kept for the gym-search route the owner console's repo still serves. See the\n// note in `onboarding.ts`.\nexport const nearbyGymsQuerySchema = z.object({\n lat: z.coerce.number().min(-90).max(90).optional(),\n lng: z.coerce.number().min(-180).max(180).optional(),\n q: optionalTrimmedString(120),\n});\nexport type NearbyGymsQuery = z.infer<typeof nearbyGymsQuerySchema>;\n"]}
1
+ {"version":3,"file":"center.js","sourceRo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CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,CAC3F,EACH;IACE,OAAO,EAAE,uCAAuC;IAChD,IAAI,EAAE,CAAC,SAAS,CAAC;CAClB,CACF,CAAC;AAGJ;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC;IAC/B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IACrC,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;CACvB,CAAC,CAAC;AAGH,gFAAgF;AAChF,+EAA+E;AAC/E,2BAA2B;AAC3B,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE;IAClD,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IACpD,CAAC,EAAE,qBAAqB,CAAC,GAAG,CAAC;CAC9B,CAAC,CAAC","sourcesContent":["/**\n * gymmonk-schema — Center (branch)\n * ================================\n * A physical gym location belonging to an organisation. Carries the public gym\n * code members use to join, opening hours, equipment scope, and contact info.\n * v1 memberships are single-center, so a Center is the unit a member joins.\n *\n * @module gymmonk-schema/center\n */\n\nimport { z } from 'zod';\nimport { centerCodeSchema } from './codes.js';\nimport {\n isoDateTimeSchema,\n objectIdSchema,\n optionalEmailSchema,\n optionalPhoneSchema,\n optionalTrimmedString,\n phoneSchema,\n} from './common.js';\nimport { mapLinkInputSchema, placePinSchema, timezoneSchema } from './location.js';\nimport { addressSchema, weeklyHoursSchema } from './shared.js';\n\n// ─── Center type ─────────────────────────────────────────────────────────────\n\n/**\n * What a centre OFFERS, multi-select.\n *\n * ── The axis, and why `personal-training` is gone ───────────────────────────\n * Every value here answers one question: what does somebody DO at this place.\n * That makes them disciplines and training modalities, so an owner ticking\n * three of them describes a real branch and a member reading them knows what\n * they are walking into.\n *\n * `personal-training` answered a different question — HOW coaching is\n * delivered, one-to-one instead of in a class — and nearly every gym in the\n * list offers it. A value almost everyone can tick separates nobody from\n * anybody, which is the opposite of what a type is for. Business model\n * (big-box, boutique, 24-hour) is a third axis again, and one this product\n * already answers better elsewhere: floor area and opening hours are recorded\n * fields, not a guess from a chip.\n *\n * ── Where the list comes from ───────────────────────────────────────────────\n * Cross-referenced rather than invented: Google Business Profile's fitness\n * categories (what gyms actually file themselves under, and therefore what\n * members search), ClassPass and Mindbody's activity taxonomies, and the\n * formats the Indian market actually runs — cult.fit's S&C, HRX, boxing, dance\n * fitness and yoga, plus the bodybuilding and martial-arts traditions that a\n * list drawn only from US sources would miss entirely.\n *\n * Deliberately NOT included, so the next person does not re-litigate it:\n * rock climbing, gymnastics and aerial/pole are real facility categories but\n * not gyms in the sense this product manages; women-only and kids' fitness\n * describe an AUDIENCE, not an activity; 24-hour and big-box describe hours\n * and size, both of which are already their own fields.\n *\n * Values are stable slugs — the LABELS are the frontend's business, so\n * rewording a chip never rewrites stored data.\n *\n * ── The field is called `types`; the screen says \"What this center offers\" ──\n * That divergence is deliberate, not an oversight. \"Type\" reads as one thing a\n * place IS, and a real branch runs several — a weights floor, a yoga room and\n * Zumba on weekends — so a singular-sounding label pushed owners to pick one\n * and misdescribe themselves. (The picker was once a single-select with a\n * \"Mixed\" option that saved as plain `gym`, which is how a CrossFit-and-boxing\n * branch came back as neither.) The label was changed to match what is stored;\n * the identifiers were not, because the values are a wire contract and\n * renaming them would rewrite data to fix a word.\n */\nexport const CENTER_TYPES = [\n // General\n 'gym',\n // Strength\n 'strength',\n 'crossfit',\n 'functional',\n 'bodybuilding',\n 'powerlifting',\n 'calisthenics',\n // Cardio & group training\n 'cardio',\n 'hiit',\n 'spinning',\n 'bootcamp',\n 'aerobics',\n 'sports-conditioning',\n // Mind & body\n 'yoga',\n 'pilates',\n 'meditation',\n // Dance\n 'zumba',\n 'dance',\n // Combat\n 'boxing',\n 'kickboxing',\n 'mma',\n 'martial-arts',\n // Facilities\n 'swimming',\n 'physiotherapy',\n] as const;\nexport const centerTypeSchema = z.enum(CENTER_TYPES);\nexport type CenterType = z.infer<typeof centerTypeSchema>;\n\n// ─── Status ──────────────────────────────────────────────────────────────────\n\nexport const centerStatusSchema = z.enum(['active', 'inactive']);\nexport type CenterStatus = z.infer<typeof centerStatusSchema>;\n\n// The public gym code (`IRN-1-7K2M`) is defined in `codes.ts` alongside the\n// member ids built on the same stem, so the four identifier shapes this product\n// issues can be read — and kept from colliding — in one place. Re-exported here\n// because a centre's code is a fact about a centre.\nexport { type CenterCode, centerCodeSchema } from './codes.js';\n\n// ─── Create / update bodies ──────────────────────────────────────────────────\n\nexport const createCenterBodySchema = z.object({\n name: z.string().trim().min(1, 'Center name is required').max(160),\n description: optionalTrimmedString(2000),\n types: z.array(centerTypeSchema).min(1, 'Pick at least one'),\n address: addressSchema,\n /** Usable floor area in square feet. */\n floorAreaSqft: z.number().int().min(0).max(1_000_000).optional(),\n /**\n * How many people the branch holds at once.\n *\n * The denominator behind \"how full are we\" — the centre detail screen shows\n * it beside the active-member count, and crowd-load has no meaning without\n * it. Optional: a gym that has never measured it should not be blocked from\n * saving the rest of its details.\n */\n capacity: z.number().int().min(1).max(100_000).optional(),\n primaryPhone: phoneSchema,\n secondaryPhone: optionalPhoneSchema,\n email: optionalEmailSchema,\n website: optionalTrimmedString(200),\n hours: weeklyHoursSchema,\n /** Uploaded gallery image URLs. */\n photos: z.array(z.string().trim().max(2000)).max(20).default([]),\n /**\n * A pasted Google Maps link. The server reads the coordinates out of it; the\n * client never sends them.\n *\n * This is the pin attendance is measured against, and it is NOT the same as\n * `address.coords`: that is an area centroid resolved from master data, which\n * can be a whole district's midpoint and is useless for proximity.\n */\n ...mapLinkInputSchema.shape,\n /**\n * How close a member must be for a check-in to count, metres. Optional — the\n * server applies its own default when a gym has not chosen one.\n */\n checkInRadiusM: z.number().int().min(50).max(5000).optional(),\n});\nexport type CreateCenterBody = z.infer<typeof createCenterBodySchema>;\n\nexport const updateCenterBodySchema = createCenterBodySchema.partial();\nexport type UpdateCenterBody = z.infer<typeof updateCenterBodySchema>;\n\n// ─── Entity (API response) ───────────────────────────────────────────────────\n\nexport const centerSchema = z.object({\n id: objectIdSchema,\n organisationId: objectIdSchema,\n /** Public join code, `IRN-1-7K2M`. */\n code: centerCodeSchema,\n /**\n * Which centre this is within its organisation — 1 for the first branch the\n * owner opened, 2 for the next.\n *\n * Stored rather than counted on read, because it is baked into this centre's\n * code AND into every member id the centre issues. Deleting branch 2 must not\n * renumber branch 3 into codes that are already printed.\n */\n sequence: z.number().int().positive(),\n name: z.string(),\n description: z.string().nullable(),\n types: z.array(centerTypeSchema),\n address: addressSchema,\n floorAreaSqft: z.number().int().nullable(),\n capacity: z.number().int().nullable(),\n primaryPhone: z.string(),\n secondaryPhone: z.string().nullable(),\n email: z.string().nullable(),\n website: z.string().nullable(),\n hours: weeklyHoursSchema,\n photos: z.array(z.string()),\n status: centerStatusSchema,\n /** Denormalised active-member count for roster headers. */\n memberCount: z.number().int().nonnegative(),\n // The resolved pin. Absent until an owner pastes a Maps link, which is why\n // attendance is unenforceable rather than failing for a gym without one.\n ...placePinSchema.shape,\n checkInRadiusM: z.number().int().nullable().optional(),\n /**\n * The centre's own timezone, as an IANA identifier (\"Asia/Kolkata\").\n *\n * WHY THE CENTRE'S AND NOT THE VIEWER'S. Attendance is filed under a calendar\n * DAY, and a day is not timezone-free — whichever zone derives it defines when\n * it starts. Deriving it from whoever is looking would put one visit on\n * different days for the member and the owner, and would make an owner's daily\n * roll-up change depending on where they opened the app. A visit belongs to the\n * gym's operating day; only the display of times follows the reader.\n *\n * An IANA NAME, never a UTC offset. Offsets are a property of an instant, not\n * of a place: they move with DST, so a stored \"+05:30\" is already wrong for\n * half the year anywhere that observes it.\n *\n * Server-derived from the centre's pin, never accepted from a client — the\n * same rule the coordinates follow, and for the same reason.\n */\n timezone: timezoneSchema,\n createdAt: isoDateTimeSchema,\n updatedAt: isoDateTimeSchema,\n});\nexport type Center = z.infer<typeof centerSchema>;\n\n// ─── Center stats (owner detail header) ──────────────────────────────────────\n\n/**\n * The three-up header on a centre's detail screen.\n *\n * Computed, never stored — `activeMembers` counts live memberships and\n * `monthlyRevenueInr` sums this month's successful payments, so the card can\n * never drift from the ledger the way a denormalised total would. `capacity`\n * is the one stored value, and is null until the owner fills it in.\n */\nexport const centerStatsSchema = z.object({\n capacity: z.number().int().nullable(),\n activeMembers: z.number().int().nonnegative(),\n monthlyRevenueInr: z.number().nonnegative(),\n});\nexport type CenterStats = z.infer<typeof centerStatsSchema>;\n\n// ─── Gym directory (member \"find a gym\") ─────────────────────────────────────\n\n/** A lightweight public directory result for the \"find a gym\" screen. */\nexport const nearbyGymSchema = z.object({\n id: objectIdSchema,\n code: centerCodeSchema,\n name: z.string(),\n /** The narrowest place name we hold (locality → district → state). */\n area: z.string(),\n district: z.string().nullable(),\n state: z.string().nullable(),\n /**\n * Kilometres from the coordinates the caller supplied.\n *\n * NULL, not 0, when it cannot be computed — the caller sent no position, or\n * the gym's address carries no coordinates. Zero is a real distance (\"you are\n * standing in it\") and using it as the unknown value put every un-geocoded\n * gym at the top of a nearest-first list.\n */\n distanceKm: z.number().nonnegative().nullable(),\n memberCount: z.number().int().nonnegative().optional(),\n});\nexport type NearbyGym = z.infer<typeof nearbyGymSchema>;\n\n/**\n * The gym directory has THREE ways in, and they differ in how far they reach.\n *\n * `code` exact public gym id — matches anywhere in the country, because\n * a member holding the id already knows which gym they mean and\n * may well be joining one in another state.\n * `q` name search — deliberately narrowed to ONE STATE. Gym names\n * repeat heavily (\"Fitness First\"), so a nationwide name search\n * returns a list nobody can pick from.\n * `districtId` browse — the gyms around them, nearest first when they share\n * their position.\n *\n * `stateId` / `districtId` are master-area ids (`area.ts`), matched against the\n * address `ancestry` array every center stores.\n */\nexport const GYM_SEARCH_MAX_RESULTS = 20;\n\n/**\n * How far \"near me\" reaches, in kilometres.\n *\n * A bound rather than \"the nearest 20 wherever they are\". Without one, a member\n * in a town with no gyms is shown the nearest one 400km away as though it were\n * a suggestion — a list that is technically sorted and practically useless. The\n * empty state points them at a different location or a gym id instead, which\n * are the two things that can actually help.\n */\nexport const GYM_SEARCH_NEARBY_RADIUS_KM = 50;\n\nexport const gymSearchQuerySchema = z\n .object({\n /** Exact public gym id, e.g. `GYM-2025-001`. Unscoped by geography. */\n code: optionalTrimmedString(40),\n /** Name fragment. Requires `stateId`. */\n q: optionalTrimmedString(120),\n stateId: optionalTrimmedString(40),\n districtId: optionalTrimmedString(40),\n /**\n * Any master-area id — state, district, or one of the eight sub-district\n * types the location drawer can reach.\n *\n * Matched against the `ancestry` every centre stores, exactly as\n * `stateId` / `districtId` are, so one parameter covers every depth the\n * picker offers. Those two stay because callers already send them and they\n * read more clearly at the two levels that have their own control.\n */\n areaId: optionalTrimmedString(40),\n lat: z.coerce.number().min(-90).max(90).optional(),\n lng: z.coerce.number().min(-180).max(180).optional(),\n limit: z.coerce\n .number()\n .int()\n .min(1)\n .max(GYM_SEARCH_MAX_RESULTS)\n .default(GYM_SEARCH_MAX_RESULTS),\n })\n .refine((v) => !v.q || Boolean(v.stateId), {\n message: 'Pick a state to search gyms by name',\n path: ['stateId'],\n })\n .refine(\n (v) =>\n Boolean(\n v.code || v.q || v.stateId || v.districtId || v.areaId || (v.lat != null && v.lng != null),\n ),\n {\n message: 'Enter a gym id, or pick where to look',\n path: ['stateId'],\n },\n );\nexport type GymSearchQuery = z.infer<typeof gymSearchQuerySchema>;\n\n/**\n * The directory response.\n *\n * `truncated` says the district holds more gyms than were returned, which is\n * what the screen turns into \"showing the 20 nearest — enter a gym id if yours\n * is not here\" rather than letting the member assume their gym is absent.\n */\nexport const gymSearchResultSchema = z.object({\n items: z.array(nearbyGymSchema),\n total: z.number().int().nonnegative(),\n truncated: z.boolean(),\n});\nexport type GymSearchResult = z.infer<typeof gymSearchResultSchema>;\n\n// ─── Retained: nearby-gyms query ─────────────────────────────────────────────\n// Kept for the gym-search route the owner console's repo still serves. See the\n// note in `onboarding.ts`.\nexport const nearbyGymsQuerySchema = z.object({\n lat: z.coerce.number().min(-90).max(90).optional(),\n lng: z.coerce.number().min(-180).max(180).optional(),\n q: optionalTrimmedString(120),\n});\nexport type NearbyGymsQuery = z.infer<typeof nearbyGymsQuerySchema>;\n"]}
@@ -53,48 +53,14 @@ export declare const planVariantSchema: z.ZodObject<{
53
53
  month: "month";
54
54
  }>;
55
55
  originalPriceInr: z.ZodNumber;
56
- finalPriceInr: z.ZodNumber;
56
+ discountPercent: z.ZodDefault<z.ZodNumber>;
57
57
  popular: z.ZodOptional<z.ZodBoolean>;
58
58
  }, z.core.$strip>;
59
59
  export type PlanVariant = z.infer<typeof planVariantSchema>;
60
- /**
61
- * The same variant, with the one rule the two prices have between them.
62
- *
63
- * Separate from `planVariantSchema` because a `.refine()` turns a schema into
64
- * a ZodEffects, and `.partial()` or `.omit()` on one of those throws at MODULE
65
- * LOAD — invisible to a build, and the page simply dies on import. Keeping
66
- * the plain object available means the plan bodies can go on composing it
67
- * while the API still validates the pair.
68
- */
69
- export declare const checkedPlanVariantSchema: z.ZodObject<{
70
- id: z.ZodString;
71
- durationCount: z.ZodNumber;
72
- durationUnit: z.ZodEnum<{
73
- year: "year";
74
- day: "day";
75
- week: "week";
76
- month: "month";
77
- }>;
78
- originalPriceInr: z.ZodNumber;
79
- finalPriceInr: z.ZodNumber;
80
- popular: z.ZodOptional<z.ZodBoolean>;
81
- }, z.core.$strip>;
82
60
  /** What the member actually pays, in whole rupees. */
83
- export declare function variantFinalPrice(variant: Pick<PlanVariant, 'finalPriceInr'>): number;
61
+ export declare function variantFinalPrice(variant: Pick<PlanVariant, 'originalPriceInr' | 'discountPercent'>): number;
84
62
  /** Whole rupees saved, or 0 on an undiscounted variant. */
85
- export declare function variantSavings(variant: Pick<PlanVariant, 'originalPriceInr' | 'finalPriceInr'>): number;
86
- /**
87
- * The discount as a percentage, for the "25% off" ribbon.
88
- *
89
- * DERIVED, and rounded only here where rounding is harmless: this number is
90
- * shown, never stored and never used to compute a price. That is the whole
91
- * point of the change — the rounding used to happen before the value was
92
- * saved, so it moved the money.
93
- *
94
- * Zero when there is no discount, or when the original price is zero and the
95
- * question has no answer.
96
- */
97
- export declare function variantDiscountPercent(variant: Pick<PlanVariant, 'originalPriceInr' | 'finalPriceInr'>): number;
63
+ export declare function variantSavings(variant: Pick<PlanVariant, 'originalPriceInr' | 'discountPercent'>): number;
98
64
  /** `{ 3, 'month' }` → `"3 Months"`. One spelling of a duration, everywhere. */
99
65
  export declare function variantLabel(variant: Pick<PlanVariant, 'durationCount' | 'durationUnit'>): string;
100
66
  /**
@@ -623,7 +589,7 @@ export declare const createMembershipPlanBodySchema: z.ZodObject<{
623
589
  month: "month";
624
590
  }>;
625
591
  originalPriceInr: z.ZodNumber;
626
- finalPriceInr: z.ZodNumber;
592
+ discountPercent: z.ZodDefault<z.ZodNumber>;
627
593
  popular: z.ZodOptional<z.ZodBoolean>;
628
594
  }, z.core.$strip>>;
629
595
  }, z.core.$strip>;
@@ -720,7 +686,7 @@ export declare const updateMembershipPlanBodySchema: z.ZodObject<{
720
686
  month: "month";
721
687
  }>;
722
688
  originalPriceInr: z.ZodNumber;
723
- finalPriceInr: z.ZodNumber;
689
+ discountPercent: z.ZodDefault<z.ZodNumber>;
724
690
  popular: z.ZodOptional<z.ZodBoolean>;
725
691
  }, z.core.$strip>>>;
726
692
  isActive: z.ZodOptional<z.ZodBoolean>;
@@ -820,7 +786,7 @@ export declare const membershipPlanSchema: z.ZodObject<{
820
786
  month: "month";
821
787
  }>;
822
788
  originalPriceInr: z.ZodNumber;
823
- finalPriceInr: z.ZodNumber;
789
+ discountPercent: z.ZodDefault<z.ZodNumber>;
824
790
  popular: z.ZodOptional<z.ZodBoolean>;
825
791
  }, z.core.$strip>>;
826
792
  isActive: z.ZodBoolean;
@@ -1 +1 @@
1
- {"version":3,"file":"membership-plan.d.ts","sourceRoot":"","sources":["../src/membership-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,0CAA0C;AAC1C,eAAO,MAAM,gBAAgB;;;;;EAAgD,CAAC;AAC9E,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAI1D;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB;;;;;EAA2C,CAAC;AAC3E,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,+EAA+E;AAC/E,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,YAAY,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAKnF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;iBAyB5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;iBAGpC,CAAC;AAEF,sDAAsD;AACtD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,eAAe,CAAC,GAAG,MAAM,CAErF;AAED,2DAA2D;AAC3D,wBAAgB,cAAc,CAC5B,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,kBAAkB,GAAG,eAAe,CAAC,GAC/D,MAAM,CAER;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,IAAI,C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BAA8B,CAAC,CAAC;AAEtF,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAGI,CAAC;AAChD,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAItF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAe/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -7,7 +7,6 @@
7
7
  * @module gymmonk-schema/membership-plan
8
8
  */
9
9
  import { z } from 'zod';
10
- import { ERROR_MESSAGE } from './messages.js';
11
10
  import { isoDateTimeSchema, objectIdSchema, optionalTrimmedString, priceInrSchema, } from './common.js';
12
11
  // ─── Accent ──────────────────────────────────────────────────────────────────
13
12
  /** UI accent colour for the plan card. */
@@ -48,54 +47,19 @@ export const planVariantSchema = z.object({
48
47
  durationUnit: durationUnitSchema,
49
48
  /** The list price, before any discount. Struck through on the card. */
50
49
  originalPriceInr: priceInrSchema,
51
- /**
52
- * What the member actually pays. THE STORED TRUTH, not a derivation.
53
- *
54
- * It used to be a whole-number `discountPercent` with the price computed
55
- * from it, which cannot represent most prices a gym would name. A gym
56
- * pricing ${'₹'}1000 down to ${'₹'}999 is offering 0.1% off; rounded to the nearest
57
- * whole percent that is 0, so the price came back as ${'₹'}1000 and the ${'₹'}999
58
- * they typed was quietly gone. Owners think in the price on the poster, not
59
- * in percentages, so the price is what is kept and the percentage is worked
60
- * out for display.
61
- */
62
- finalPriceInr: priceInrSchema,
50
+ /** Whole percent off. 0 means the plan sells at its list price. */
51
+ discountPercent: z.number().int().min(0).max(100).default(0),
63
52
  /** Ribbon on the variant tile. Editorial, like the plan badge. */
64
53
  popular: z.boolean().optional(),
65
54
  });
66
- /**
67
- * The same variant, with the one rule the two prices have between them.
68
- *
69
- * Separate from `planVariantSchema` because a `.refine()` turns a schema into
70
- * a ZodEffects, and `.partial()` or `.omit()` on one of those throws at MODULE
71
- * LOAD — invisible to a build, and the page simply dies on import. Keeping
72
- * the plain object available means the plan bodies can go on composing it
73
- * while the API still validates the pair.
74
- */
75
- export const checkedPlanVariantSchema = planVariantSchema.refine((v) => v.finalPriceInr <= v.originalPriceInr, { message: ERROR_MESSAGE.planFinalPriceAboveOriginal, path: ['finalPriceInr'] });
76
55
  /** What the member actually pays, in whole rupees. */
77
56
  export function variantFinalPrice(variant) {
78
- return variant.finalPriceInr;
57
+ const off = Math.round((variant.originalPriceInr * variant.discountPercent) / 100);
58
+ return Math.max(0, variant.originalPriceInr - off);
79
59
  }
80
60
  /** Whole rupees saved, or 0 on an undiscounted variant. */
81
61
  export function variantSavings(variant) {
82
- return Math.max(0, variant.originalPriceInr - variant.finalPriceInr);
83
- }
84
- /**
85
- * The discount as a percentage, for the "25% off" ribbon.
86
- *
87
- * DERIVED, and rounded only here where rounding is harmless: this number is
88
- * shown, never stored and never used to compute a price. That is the whole
89
- * point of the change — the rounding used to happen before the value was
90
- * saved, so it moved the money.
91
- *
92
- * Zero when there is no discount, or when the original price is zero and the
93
- * question has no answer.
94
- */
95
- export function variantDiscountPercent(variant) {
96
- if (variant.originalPriceInr <= 0)
97
- return 0;
98
- return Math.round((variantSavings(variant) / variant.originalPriceInr) * 100);
62
+ return variant.originalPriceInr - variantFinalPrice(variant);
99
63
  }
100
64
  /** `{ 3, 'month' }` → `"3 Months"`. One spelling of a duration, everywhere. */
101
65
  export function variantLabel(variant) {
@@ -250,7 +214,7 @@ export const createMembershipPlanBodySchema = z.object({
250
214
  * equally is pushing none of them. */
251
215
  badge: planBadgeSchema.nullish(),
252
216
  features: z.array(planFeatureSchema).max(40).default([]),
253
- variants: z.array(checkedPlanVariantSchema).min(1, 'Add at least one variant'),
217
+ variants: z.array(planVariantSchema).min(1, 'Add at least one variant'),
254
218
  });
255
219
  export const updateMembershipPlanBodySchema = createMembershipPlanBodySchema
256
220
  .omit({ centerId: true })
@@ -265,7 +229,7 @@ export const membershipPlanSchema = z.object({
265
229
  accent: planAccentSchema,
266
230
  badge: planBadgeSchema.nullable(),
267
231
  features: z.array(planFeatureSchema),
268
- variants: z.array(checkedPlanVariantSchema),
232
+ variants: z.array(planVariantSchema),
269
233
  isActive: z.boolean(),
270
234
  sortOrder: z.number().int(),
271
235
  /** Denormalised count of active members on this plan (owner list view). */
@@ -1 +1 @@
1
- {"version":3,"file":"membership-plan.js","sourceRoot":"","sources":["../src/membership-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,qBAAqB,EACrB,cAAc,GACf,MAAM,aAAa,CAAC;AAErB,gFAAgF;AAEhF,0CAA0C;AAC1C,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;AAG9E,gFAAgF;AAEhF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;AAG3E,+EAA+E;AAC/E,MAAM,CAAC,MAAM,mBAAmB,GAAwD;IACtF,GAAG,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE;IACjC,IAAI,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE;IACpC,KAAK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AAC;AAGH,MAAM,CAAC,MAAM,8BAA8B,GAAG,8BAA8B;KACzE,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;KACxB,OAAO,EAAE;KACT,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AAGhD,gFAAgF;AAEhF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,EAAE,EAAE,cAAc;IAClB,QAAQ,EAAE,cAAc;IACxB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,MAAM,EAAE,gBAAgB;IACxB,KAAK,EAAE,eAAe,CAAC,QAAQ,EAAE;IACjC,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC;IACpC,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,wBAAwB,CAAC;IAC3C,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE;IACrB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;IAC3B,2EAA2E;IAC3E,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IAC3C,SAAS,EAAE,iBAAiB;IAC5B,SAAS,EAAE,iBAAiB;CAC7B,CAAC,CAAC","sourcesContent":["/**\n * gymmonk-schema — Membership plan (owner-defined catalog)\n * ========================================================\n * The plans a gym owner defines and sells to members, scoped to a center. A\n * member's active `membership` references one of these by id + variant.\n *\n * @module gymmonk-schema/membership-plan\n */\n\nimport { z } from 'zod';\nimport { ERROR_MESSAGE } from './messages.js';\nimport {\n isoDateTimeSchema,\n objectIdSchema,\n optionalTrimmedString,\n priceInrSchema,\n} from './common.js';\n\n// ─── Accent ──────────────────────────────────────────────────────────────────\n\n/** UI accent colour for the plan card. */\nexport const planAccentSchema = z.enum(['neutral', 'teal', 'purple', 'gold']);\nexport type PlanAccent = z.infer<typeof planAccentSchema>;\n\n// ─── Variants (duration + price) ─────────────────────────────────────────────\n\n/**\n * The unit a plan's duration is counted in.\n *\n * `day` earns its place: a gym selling a one-day trial pass or a ten-day\n * tourist package cannot express either in months, and the fixed\n * 1m/3m/6m/1y list it replaces forced them to.\n */\nexport const durationUnitSchema = z.enum(['day', 'week', 'month', 'year']);\nexport type DurationUnit = z.infer<typeof durationUnitSchema>;\n\n/** Singular / plural label for each unit, so no caller writes `unit + 's'`. */\nexport const DURATION_UNIT_LABEL: Record<DurationUnit, { one: string; many: string }> = {\n day: { one: 'Day', many: 'Days' },\n week: { one: 'Week', many: 'Weeks' },\n month: { one: 'Month', many: 'Months' },\n year: { one: 'Year', many: 'Years' },\n};\n\n/**\n * One buyable duration of a plan: how long it runs, what it lists at, and what\n * comes off.\n *\n * The gym enters the ORIGINAL price and a DISCOUNT; the selling price is\n * derived (`variantFinalPrice`) rather than stored. Storing all three invites\n * the arithmetic to drift — a gym edits the discount, forgets the total, and\n * the card advertises a saving the checkout does not honour.\n */\nexport const planVariantSchema = z.object({\n /**\n * Stable per plan, minted by the client when a variant is added, because a\n * live `membership` points back at it. Reusing an array index instead would\n * silently re-point every membership when a variant is deleted.\n */\n id: z.string().trim().min(1).max(40),\n durationCount: z.number().int().min(1).max(365),\n durationUnit: durationUnitSchema,\n /** The list price, before any discount. Struck through on the card. */\n originalPriceInr: priceInrSchema,\n /**\n * What the member actually pays. THE STORED TRUTH, not a derivation.\n *\n * It used to be a whole-number `discountPercent` with the price computed\n * from it, which cannot represent most prices a gym would name. A gym\n * pricing ${'₹'}1000 down to ${'₹'}999 is offering 0.1% off; rounded to the nearest\n * whole percent that is 0, so the price came back as ${'₹'}1000 and the ${'₹'}999\n * they typed was quietly gone. Owners think in the price on the poster, not\n * in percentages, so the price is what is kept and the percentage is worked\n * out for display.\n */\n finalPriceInr: priceInrSchema,\n /** Ribbon on the variant tile. Editorial, like the plan badge. */\n popular: z.boolean().optional(),\n});\nexport type PlanVariant = z.infer<typeof planVariantSchema>;\n\n/**\n * The same variant, with the one rule the two prices have between them.\n *\n * Separate from `planVariantSchema` because a `.refine()` turns a schema into\n * a ZodEffects, and `.partial()` or `.omit()` on one of those throws at MODULE\n * LOAD — invisible to a build, and the page simply dies on import. Keeping\n * the plain object available means the plan bodies can go on composing it\n * while the API still validates the pair.\n */\nexport const checkedPlanVariantSchema = planVariantSchema.refine(\n (v) => v.finalPriceInr <= v.originalPriceInr,\n { message: ERROR_MESSAGE.planFinalPriceAboveOriginal, path: ['finalPriceInr'] },\n);\n\n/** What the member actually pays, in whole rupees. */\nexport function variantFinalPrice(variant: Pick<PlanVariant, 'finalPriceInr'>): number {\n return variant.finalPriceInr;\n}\n\n/** Whole rupees saved, or 0 on an undiscounted variant. */\nexport function variantSavings(\n variant: Pick<PlanVariant, 'originalPriceInr' | 'finalPriceInr'>,\n): number {\n return Math.max(0, variant.originalPriceInr - variant.finalPriceInr);\n}\n\n/**\n * The discount as a percentage, for the \"25% off\" ribbon.\n *\n * DERIVED, and rounded only here where rounding is harmless: this number is\n * shown, never stored and never used to compute a price. That is the whole\n * point of the change — the rounding used to happen before the value was\n * saved, so it moved the money.\n *\n * Zero when there is no discount, or when the original price is zero and the\n * question has no answer.\n */\nexport function variantDiscountPercent(\n variant: Pick<PlanVariant, 'originalPriceInr' | 'finalPriceInr'>,\n): number {\n if (variant.originalPriceInr <= 0) return 0;\n return Math.round((variantSavings(variant) / variant.originalPriceInr) * 100);\n}\n\n/** `{ 3, 'month' }` → `\"3 Months\"`. One spelling of a duration, everywhere. */\nexport function variantLabel(variant: Pick<PlanVariant, 'durationCount' | 'durationUnit'>): string {\n const label = DURATION_UNIT_LABEL[variant.durationUnit];\n return `${variant.durationCount} ${variant.durationCount === 1 ? label.one : label.many}`;\n}\n\n// ─── Badge ───────────────────────────────────────────────────────────────────\n\n/**\n * The ribbon above a plan card. Editorial, not derived: which plan a gym wants\n * to push is a commercial decision, not something to infer from price.\n */\nexport const planBadgeSchema = z.enum(['popular', 'best-value']);\nexport type PlanBadge = z.infer<typeof planBadgeSchema>;\n\nexport const PLAN_BADGE_LABEL: Record<PlanBadge, string> = {\n popular: 'Most Popular',\n 'best-value': 'Best Value',\n};\n\n// ─── Amenities ───────────────────────────────────────────────────────────────\n\n/**\n * What a gym can advertise on a plan, grouped the way the picker shows them.\n *\n * Deliberately EXHAUSTIVE. The old sixteen-key list made an owner describe a\n * real gym in someone else's vocabulary: no drinking water, no washroom, no\n * air conditioning, no parking — the things members actually ask about before\n * they join — so plans all read the same and the chips stopped meaning\n * anything.\n *\n * Keys are stable ids, never shown. The LABEL is the default caption and a gym\n * may override it per plan (see `planFeatureSchema.label`), which is how a\n * studio calls `classes` \"Group Sessions\" without needing a new key.\n */\nexport const AMENITY_CATEGORIES = [\n 'training',\n 'classes',\n 'facilities',\n 'wellness',\n 'services',\n 'extras',\n] as const;\nexport type AmenityCategory = (typeof AMENITY_CATEGORIES)[number];\n\nexport const AMENITY_CATEGORY_LABEL: Record<AmenityCategory, string> = {\n training: 'Training',\n classes: 'Classes',\n facilities: 'Facilities',\n wellness: 'Wellness & Recovery',\n services: 'Services',\n extras: 'Extras',\n};\n\n/**\n * The full catalogue: key → default caption + which group it sits in.\n *\n * Labels live HERE rather than in the client. They used to be duplicated in\n * two frontend maps that had drifted apart — the same key drew a different\n * icon on the owner's screen and the member's, and three keys drew nothing at\n * all on one of them. One source, and the client maps keys to icons only.\n */\nexport const AMENITY_CATALOG = {\n // ── Training floor ─────────────────────────────────────────────────────────\n cardio: { label: 'Cardio Machines', category: 'training' },\n strength: { label: 'Strength Training', category: 'training' },\n freeWeights: { label: 'Free Weights', category: 'training' },\n machines: { label: 'Weight Machines', category: 'training' },\n functional: { label: 'Functional Area', category: 'training' },\n crossfit: { label: 'CrossFit', category: 'training' },\n calisthenics: { label: 'Calisthenics', category: 'training' },\n powerlifting: { label: 'Powerlifting', category: 'training' },\n boxing: { label: 'Boxing', category: 'training' },\n martialArts: { label: 'Martial Arts', category: 'training' },\n treadmill: { label: 'Treadmills', category: 'training' },\n cycling: { label: 'Cycling', category: 'training' },\n rowing: { label: 'Rowing', category: 'training' },\n stretchZone: { label: 'Stretching Zone', category: 'training' },\n turfArea: { label: 'Turf Area', category: 'training' },\n\n // ── Classes ────────────────────────────────────────────────────────────────\n classes: { label: 'Group Classes', category: 'classes' },\n yoga: { label: 'Yoga', category: 'classes' },\n yogaArea: { label: 'Yoga Area', category: 'classes' },\n zumba: { label: 'Zumba', category: 'classes' },\n pilates: { label: 'Pilates', category: 'classes' },\n aerobics: { label: 'Aerobics', category: 'classes' },\n dance: { label: 'Dance', category: 'classes' },\n spinning: { label: 'Spinning', category: 'classes' },\n bootcamp: { label: 'Bootcamp', category: 'classes' },\n meditation: { label: 'Meditation', category: 'classes' },\n\n // ── Facilities ─────────────────────────────────────────────────────────────\n ac: { label: 'Air Conditioned', category: 'facilities' },\n drinkingWater: { label: 'Drinking Water', category: 'facilities' },\n washroom: { label: 'Washroom', category: 'facilities' },\n restroom: { label: 'Restroom', category: 'facilities' },\n shower: { label: 'Showers', category: 'facilities' },\n changingRoom: { label: 'Changing Room', category: 'facilities' },\n locker: { label: 'Lockers', category: 'facilities' },\n parking: { label: 'Parking', category: 'facilities' },\n wifi: { label: 'Free WiFi', category: 'facilities' },\n musicSystem: { label: 'Music System', category: 'facilities' },\n powerBackup: { label: 'Power Backup', category: 'facilities' },\n lift: { label: 'Lift Access', category: 'facilities' },\n cctv: { label: 'CCTV Security', category: 'facilities' },\n wheelchairAccess: { label: 'Wheelchair Access', category: 'facilities' },\n\n // ── Wellness & recovery ────────────────────────────────────────────────────\n steam: { label: 'Steam Room', category: 'wellness' },\n sauna: { label: 'Sauna', category: 'wellness' },\n spa: { label: 'Spa', category: 'wellness' },\n massage: { label: 'Massage', category: 'wellness' },\n iceBath: { label: 'Ice Bath', category: 'wellness' },\n pool: { label: 'Swimming Pool', category: 'wellness' },\n physiotherapy: { label: 'Physiotherapy', category: 'wellness' },\n\n // ── Services ───────────────────────────────────────────────────────────────\n trainer: { label: 'Trainer Support', category: 'services' },\n personalTraining: { label: 'Personal Training', category: 'services' },\n diet: { label: 'Diet Plan', category: 'services' },\n nutritionist: { label: 'Nutritionist', category: 'services' },\n health: { label: 'Health Stats', category: 'services' },\n bodyComposition: { label: 'Body Composition', category: 'services' },\n doctorConsult: { label: 'Doctor Consultation', category: 'services' },\n priority: { label: 'Priority Support', category: 'services' },\n\n // ── Extras ─────────────────────────────────────────────────────────────────\n cafe: { label: 'Cafe', category: 'extras' },\n coffeeMachine: { label: 'Coffee Machine', category: 'extras' },\n proteinBar: { label: 'Protein Bar', category: 'extras' },\n supplementStore: { label: 'Supplement Store', category: 'extras' },\n childArea: { label: 'Kids Play Area', category: 'extras' },\n towelService: { label: 'Towel Service', category: 'extras' },\n laundry: { label: 'Laundry', category: 'extras' },\n guestPass: { label: 'Guest Pass', category: 'extras' },\n unlimited: { label: 'Unlimited Access', category: 'extras' },\n multiCenter: { label: 'All Branches', category: 'extras' },\n} as const satisfies Record<string, { label: string; category: AmenityCategory }>;\n\n/** Every amenity key, in catalogue order. */\nexport const FEATURE_ICONS = Object.keys(AMENITY_CATALOG) as [FeatureIcon, ...FeatureIcon[]];\nexport type FeatureIcon = keyof typeof AMENITY_CATALOG;\n\nexport const featureIconSchema = z.enum(\n Object.keys(AMENITY_CATALOG) as [FeatureIcon, ...FeatureIcon[]],\n);\n\n/** The amenity keys in one category, for a grouped picker. */\nexport function amenitiesInCategory(category: AmenityCategory): FeatureIcon[] {\n return (Object.keys(AMENITY_CATALOG) as FeatureIcon[]).filter(\n (key) => AMENITY_CATALOG[key].category === category,\n );\n}\n\nexport const planFeatureSchema = z.object({\n icon: featureIconSchema,\n label: z.string().trim().min(1).max(80),\n});\nexport type PlanFeature = z.infer<typeof planFeatureSchema>;\n\n// ─── Create / update body ────────────────────────────────────────────────────\n\nexport const createMembershipPlanBodySchema = z.object({\n centerId: objectIdSchema,\n name: z.string().trim().min(1, 'Plan name is required').max(80),\n /**\n * What the gym wants to say about the plan in its own words.\n *\n * Replaces a 60-character `note` that the card rendered but no screen could\n * ever set — a caption nobody could write. One optional field, roomy enough\n * for a sentence or two.\n */\n description: optionalTrimmedString(300),\n accent: planAccentSchema,\n /** Ribbon above the card. Null on most plans — a gym pushing every plan\n * equally is pushing none of them. */\n badge: planBadgeSchema.nullish(),\n features: z.array(planFeatureSchema).max(40).default([]),\n variants: z.array(checkedPlanVariantSchema).min(1, 'Add at least one variant'),\n});\nexport type CreateMembershipPlanBody = z.infer<typeof createMembershipPlanBodySchema>;\n\nexport const updateMembershipPlanBodySchema = createMembershipPlanBodySchema\n .omit({ centerId: true })\n .partial()\n .extend({ isActive: z.boolean().optional() });\nexport type UpdateMembershipPlanBody = z.infer<typeof updateMembershipPlanBodySchema>;\n\n// ─── Entity (API response) ───────────────────────────────────────────────────\n\nexport const membershipPlanSchema = z.object({\n id: objectIdSchema,\n centerId: objectIdSchema,\n name: z.string(),\n description: z.string().nullable(),\n accent: planAccentSchema,\n badge: planBadgeSchema.nullable(),\n features: z.array(planFeatureSchema),\n variants: z.array(checkedPlanVariantSchema),\n isActive: z.boolean(),\n sortOrder: z.number().int(),\n /** Denormalised count of active members on this plan (owner list view). */\n memberCount: z.number().int().nonnegative(),\n createdAt: isoDateTimeSchema,\n updatedAt: isoDateTimeSchema,\n});\nexport type MembershipPlan = z.infer<typeof membershipPlanSchema>;\n"]}
1
+ {"version":3,"file":"membership-plan.js","sourceRoot":"","sources":["../src/membership-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,qBAAqB,EACrB,cAAc,GACf,MAAM,aAAa,CAAC;AAErB,gFAAgF;AAEhF,0CAA0C;AAC1C,MAAM,CAAC,MAAM,gBAAgB,GA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AC,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IACxD,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,0BAA0B,CAAC;CACxE,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,8BAA8B,GAAG,8BAA8B;KACzE,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;KACxB,OAAO,EAAE;KACT,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AAGhD,gFAAgF;AAEhF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,EAAE,EAAE,cAAc;IAClB,QAAQ,EAAE,cAAc;IACxB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,MAAM,EAAE,gBAAgB;IACxB,KAAK,EAAE,eAAe,CAAC,QAAQ,EAAE;IACjC,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC;IACpC,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC;IACpC,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE;IACrB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;IAC3B,2EAA2E;IAC3E,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IAC3C,SAAS,EAAE,iBAAiB;IAC5B,SAAS,EAAE,iBAAiB;CAC7B,CAAC,CAAC","sourcesContent":["/**\n * gymmonk-schema — Membership plan (owner-defined catalog)\n * ========================================================\n * The plans a gym owner defines and sells to members, scoped to a center. A\n * member's active `membership` references one of these by id + variant.\n *\n * @module gymmonk-schema/membership-plan\n */\n\nimport { z } from 'zod';\nimport {\n isoDateTimeSchema,\n objectIdSchema,\n optionalTrimmedString,\n priceInrSchema,\n} from './common.js';\n\n// ─── Accent ──────────────────────────────────────────────────────────────────\n\n/** UI accent colour for the plan card. */\nexport const planAccentSchema = z.enum(['neutral', 'teal', 'purple', 'gold']);\nexport type PlanAccent = z.infer<typeof planAccentSchema>;\n\n// ─── Variants (duration + price) ─────────────────────────────────────────────\n\n/**\n * The unit a plan's duration is counted in.\n *\n * `day` earns its place: a gym selling a one-day trial pass or a ten-day\n * tourist package cannot express either in months, and the fixed\n * 1m/3m/6m/1y list it replaces forced them to.\n */\nexport const durationUnitSchema = z.enum(['day', 'week', 'month', 'year']);\nexport type DurationUnit = z.infer<typeof durationUnitSchema>;\n\n/** Singular / plural label for each unit, so no caller writes `unit + 's'`. */\nexport const DURATION_UNIT_LABEL: Record<DurationUnit, { one: string; many: string }> = {\n day: { one: 'Day', many: 'Days' },\n week: { one: 'Week', many: 'Weeks' },\n month: { one: 'Month', many: 'Months' },\n year: { one: 'Year', many: 'Years' },\n};\n\n/**\n * One buyable duration of a plan: how long it runs, what it lists at, and what\n * comes off.\n *\n * The gym enters the ORIGINAL price and a DISCOUNT; the selling price is\n * derived (`variantFinalPrice`) rather than stored. Storing all three invites\n * the arithmetic to drift — a gym edits the discount, forgets the total, and\n * the card advertises a saving the checkout does not honour.\n */\nexport const planVariantSchema = z.object({\n /**\n * Stable per plan, minted by the client when a variant is added, because a\n * live `membership` points back at it. Reusing an array index instead would\n * silently re-point every membership when a variant is deleted.\n */\n id: z.string().trim().min(1).max(40),\n durationCount: z.number().int().min(1).max(365),\n durationUnit: durationUnitSchema,\n /** The list price, before any discount. Struck through on the card. */\n originalPriceInr: priceInrSchema,\n /** Whole percent off. 0 means the plan sells at its list price. */\n discountPercent: z.number().int().min(0).max(100).default(0),\n /** Ribbon on the variant tile. Editorial, like the plan badge. */\n popular: z.boolean().optional(),\n});\nexport type PlanVariant = z.infer<typeof planVariantSchema>;\n\n/** What the member actually pays, in whole rupees. */\nexport function variantFinalPrice(\n variant: Pick<PlanVariant, 'originalPriceInr' | 'discountPercent'>,\n): number {\n const off = Math.round((variant.originalPriceInr * variant.discountPercent) / 100);\n return Math.max(0, variant.originalPriceInr - off);\n}\n\n/** Whole rupees saved, or 0 on an undiscounted variant. */\nexport function variantSavings(\n variant: Pick<PlanVariant, 'originalPriceInr' | 'discountPercent'>,\n): number {\n return variant.originalPriceInr - variantFinalPrice(variant);\n}\n\n/** `{ 3, 'month' }` → `\"3 Months\"`. One spelling of a duration, everywhere. */\nexport function variantLabel(variant: Pick<PlanVariant, 'durationCount' | 'durationUnit'>): string {\n const label = DURATION_UNIT_LABEL[variant.durationUnit];\n return `${variant.durationCount} ${variant.durationCount === 1 ? label.one : label.many}`;\n}\n\n// ─── Badge ───────────────────────────────────────────────────────────────────\n\n/**\n * The ribbon above a plan card. Editorial, not derived: which plan a gym wants\n * to push is a commercial decision, not something to infer from price.\n */\nexport const planBadgeSchema = z.enum(['popular', 'best-value']);\nexport type PlanBadge = z.infer<typeof planBadgeSchema>;\n\nexport const PLAN_BADGE_LABEL: Record<PlanBadge, string> = {\n popular: 'Most Popular',\n 'best-value': 'Best Value',\n};\n\n// ─── Amenities ───────────────────────────────────────────────────────────────\n\n/**\n * What a gym can advertise on a plan, grouped the way the picker shows them.\n *\n * Deliberately EXHAUSTIVE. The old sixteen-key list made an owner describe a\n * real gym in someone else's vocabulary: no drinking water, no washroom, no\n * air conditioning, no parking — the things members actually ask about before\n * they join — so plans all read the same and the chips stopped meaning\n * anything.\n *\n * Keys are stable ids, never shown. The LABEL is the default caption and a gym\n * may override it per plan (see `planFeatureSchema.label`), which is how a\n * studio calls `classes` \"Group Sessions\" without needing a new key.\n */\nexport const AMENITY_CATEGORIES = [\n 'training',\n 'classes',\n 'facilities',\n 'wellness',\n 'services',\n 'extras',\n] as const;\nexport type AmenityCategory = (typeof AMENITY_CATEGORIES)[number];\n\nexport const AMENITY_CATEGORY_LABEL: Record<AmenityCategory, string> = {\n training: 'Training',\n classes: 'Classes',\n facilities: 'Facilities',\n wellness: 'Wellness & Recovery',\n services: 'Services',\n extras: 'Extras',\n};\n\n/**\n * The full catalogue: key → default caption + which group it sits in.\n *\n * Labels live HERE rather than in the client. They used to be duplicated in\n * two frontend maps that had drifted apart — the same key drew a different\n * icon on the owner's screen and the member's, and three keys drew nothing at\n * all on one of them. One source, and the client maps keys to icons only.\n */\nexport const AMENITY_CATALOG = {\n // ── Training floor ─────────────────────────────────────────────────────────\n cardio: { label: 'Cardio Machines', category: 'training' },\n strength: { label: 'Strength Training', category: 'training' },\n freeWeights: { label: 'Free Weights', category: 'training' },\n machines: { label: 'Weight Machines', category: 'training' },\n functional: { label: 'Functional Area', category: 'training' },\n crossfit: { label: 'CrossFit', category: 'training' },\n calisthenics: { label: 'Calisthenics', category: 'training' },\n powerlifting: { label: 'Powerlifting', category: 'training' },\n boxing: { label: 'Boxing', category: 'training' },\n martialArts: { label: 'Martial Arts', category: 'training' },\n treadmill: { label: 'Treadmills', category: 'training' },\n cycling: { label: 'Cycling', category: 'training' },\n rowing: { label: 'Rowing', category: 'training' },\n stretchZone: { label: 'Stretching Zone', category: 'training' },\n turfArea: { label: 'Turf Area', category: 'training' },\n\n // ── Classes ────────────────────────────────────────────────────────────────\n classes: { label: 'Group Classes', category: 'classes' },\n yoga: { label: 'Yoga', category: 'classes' },\n yogaArea: { label: 'Yoga Area', category: 'classes' },\n zumba: { label: 'Zumba', category: 'classes' },\n pilates: { label: 'Pilates', category: 'classes' },\n aerobics: { label: 'Aerobics', category: 'classes' },\n dance: { label: 'Dance', category: 'classes' },\n spinning: { label: 'Spinning', category: 'classes' },\n bootcamp: { label: 'Bootcamp', category: 'classes' },\n meditation: { label: 'Meditation', category: 'classes' },\n\n // ── Facilities ─────────────────────────────────────────────────────────────\n ac: { label: 'Air Conditioned', category: 'facilities' },\n drinkingWater: { label: 'Drinking Water', category: 'facilities' },\n washroom: { label: 'Washroom', category: 'facilities' },\n restroom: { label: 'Restroom', category: 'facilities' },\n shower: { label: 'Showers', category: 'facilities' },\n changingRoom: { label: 'Changing Room', category: 'facilities' },\n locker: { label: 'Lockers', category: 'facilities' },\n parking: { label: 'Parking', category: 'facilities' },\n wifi: { label: 'Free WiFi', category: 'facilities' },\n musicSystem: { label: 'Music System', category: 'facilities' },\n powerBackup: { label: 'Power Backup', category: 'facilities' },\n lift: { label: 'Lift Access', category: 'facilities' },\n cctv: { label: 'CCTV Security', category: 'facilities' },\n wheelchairAccess: { label: 'Wheelchair Access', category: 'facilities' },\n\n // ── Wellness & recovery ────────────────────────────────────────────────────\n steam: { label: 'Steam Room', category: 'wellness' },\n sauna: { label: 'Sauna', category: 'wellness' },\n spa: { label: 'Spa', category: 'wellness' },\n massage: { label: 'Massage', category: 'wellness' },\n iceBath: { label: 'Ice Bath', category: 'wellness' },\n pool: { label: 'Swimming Pool', category: 'wellness' },\n physiotherapy: { label: 'Physiotherapy', category: 'wellness' },\n\n // ── Services ───────────────────────────────────────────────────────────────\n trainer: { label: 'Trainer Support', category: 'services' },\n personalTraining: { label: 'Personal Training', category: 'services' },\n diet: { label: 'Diet Plan', category: 'services' },\n nutritionist: { label: 'Nutritionist', category: 'services' },\n health: { label: 'Health Stats', category: 'services' },\n bodyComposition: { label: 'Body Composition', category: 'services' },\n doctorConsult: { label: 'Doctor Consultation', category: 'services' },\n priority: { label: 'Priority Support', category: 'services' },\n\n // ── Extras ─────────────────────────────────────────────────────────────────\n cafe: { label: 'Cafe', category: 'extras' },\n coffeeMachine: { label: 'Coffee Machine', category: 'extras' },\n proteinBar: { label: 'Protein Bar', category: 'extras' },\n supplementStore: { label: 'Supplement Store', category: 'extras' },\n childArea: { label: 'Kids Play Area', category: 'extras' },\n towelService: { label: 'Towel Service', category: 'extras' },\n laundry: { label: 'Laundry', category: 'extras' },\n guestPass: { label: 'Guest Pass', category: 'extras' },\n unlimited: { label: 'Unlimited Access', category: 'extras' },\n multiCenter: { label: 'All Branches', category: 'extras' },\n} as const satisfies Record<string, { label: string; category: AmenityCategory }>;\n\n/** Every amenity key, in catalogue order. */\nexport const FEATURE_ICONS = Object.keys(AMENITY_CATALOG) as [FeatureIcon, ...FeatureIcon[]];\nexport type FeatureIcon = keyof typeof AMENITY_CATALOG;\n\nexport const featureIconSchema = z.enum(\n Object.keys(AMENITY_CATALOG) as [FeatureIcon, ...FeatureIcon[]],\n);\n\n/** The amenity keys in one category, for a grouped picker. */\nexport function amenitiesInCategory(category: AmenityCategory): FeatureIcon[] {\n return (Object.keys(AMENITY_CATALOG) as FeatureIcon[]).filter(\n (key) => AMENITY_CATALOG[key].category === category,\n );\n}\n\nexport const planFeatureSchema = z.object({\n icon: featureIconSchema,\n label: z.string().trim().min(1).max(80),\n});\nexport type PlanFeature = z.infer<typeof planFeatureSchema>;\n\n// ─── Create / update body ────────────────────────────────────────────────────\n\nexport const createMembershipPlanBodySchema = z.object({\n centerId: objectIdSchema,\n name: z.string().trim().min(1, 'Plan name is required').max(80),\n /**\n * What the gym wants to say about the plan in its own words.\n *\n * Replaces a 60-character `note` that the card rendered but no screen could\n * ever set — a caption nobody could write. One optional field, roomy enough\n * for a sentence or two.\n */\n description: optionalTrimmedString(300),\n accent: planAccentSchema,\n /** Ribbon above the card. Null on most plans — a gym pushing every plan\n * equally is pushing none of them. */\n badge: planBadgeSchema.nullish(),\n features: z.array(planFeatureSchema).max(40).default([]),\n variants: z.array(planVariantSchema).min(1, 'Add at least one variant'),\n});\nexport type CreateMembershipPlanBody = z.infer<typeof createMembershipPlanBodySchema>;\n\nexport const updateMembershipPlanBodySchema = createMembershipPlanBodySchema\n .omit({ centerId: true })\n .partial()\n .extend({ isActive: z.boolean().optional() });\nexport type UpdateMembershipPlanBody = z.infer<typeof updateMembershipPlanBodySchema>;\n\n// ─── Entity (API response) ───────────────────────────────────────────────────\n\nexport const membershipPlanSchema = z.object({\n id: objectIdSchema,\n centerId: objectIdSchema,\n name: z.string(),\n description: z.string().nullable(),\n accent: planAccentSchema,\n badge: planBadgeSchema.nullable(),\n features: z.array(planFeatureSchema),\n variants: z.array(planVariantSchema),\n isActive: z.boolean(),\n sortOrder: z.number().int(),\n /** Denormalised count of active members on this plan (owner list view). */\n memberCount: z.number().int().nonnegative(),\n createdAt: isoDateTimeSchema,\n updatedAt: isoDateTimeSchema,\n});\nexport type MembershipPlan = z.infer<typeof membershipPlanSchema>;\n"]}
@@ -312,6 +312,14 @@ export declare const ERROR_MESSAGE: {
312
312
  * not as a hand-written string at the throw site.
313
313
  */
314
314
  readonly gymRegistrationDraftTooLarge: "Those gym details are too large to save. Please shorten the descriptions and try again.";
315
+ /**
316
+ * "Near me" found nothing inside the radius.
317
+ *
318
+ * Deliberately not the same as `gymSearchNoResults`: this member searched
319
+ * nowhere in particular, so telling them to refine their search would be
320
+ * advice they cannot act on. What helps is a different place or a gym id.
321
+ */
322
+ readonly gymSearchNoneNearby: "No gyms within 50 km of you yet. Try a different location, or enter a gym id if you have one.";
315
323
  /** One organisation per account — registering a second is not supported. */
316
324
  readonly gymAlreadyRegistered: "You have already registered a gym on this account.";
317
325
  /** Registering a gym is something a MEMBER does, so the profile must exist. */
@@ -346,8 +354,6 @@ export declare const ERROR_MESSAGE: {
346
354
  readonly planNameTaken: "This center already has a plan with that name. Pick another name.";
347
355
  readonly planVariantDurationRequired: "Enter how long this variant runs for";
348
356
  readonly planVariantPriceRequired: "Enter the price for this variant";
349
- /** A "discount" that raises the price is a typo, every time. */
350
- readonly planFinalPriceAboveOriginal: "The final price cannot be more than the original price";
351
357
  readonly centerAddressRequired: "Add the center address before creating it.";
352
358
  readonly noCenterForPlans: "No gym center found. Add a center before creating plans.";
353
359
  readonly noCenterForWorkouts: "No gym center found. Add a center before creating workouts.";
@@ -1 +1 @@
1
- {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../src/messages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH;;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,iBAAiB,GAAG,MAAM,OAAO,eAAe,CAAC;AAE7D,0DAA0D;AAC1D,eAAO,MAAM,mBAAmB;iCACV,MAAM,KAAG,aAAa;gCAIvB,MAAM,KAAG,aAAa;sCAIhB,MAAM,KAAG,aAAa;uCAIrB,MAAM,KAAG,aAAa;uCAGtB,MAAM,KAAG,aAAa;uCAItB,MAAM,KAAG,aAAa;CAIxC,CAAC;AAIX;;;;GAIG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;IAiBxB;;;;;OAKG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;OAMG;;IAGH,4EAA4E;;IAE5E,+EAA+E;;IAE/E,gFAAgF;;IAGhF,iDAAiD;;;IAKjD,kDAAkD;;IAElD;;;;OAIG;;IAEH;;;;OAIG;;IAEH,qEAAqE;;IAErE,2EAA2E;;IAE3E,wEAAwE;;;;;;;;;;;;;;;;IAsBxE,2EAA2E;;;IAI3E;;;OAGG;;;IAIH;;;OAGG;;IAGH,mEAAmE;;;;;IAKnE,8EAA8E;;;;;;;;;;;;;IAgB9E;;;OAGG;;;;IAMH,wEAAwE;;IAExE,uEAAuE;;IAEvE,yEAAyE;;IAEzE,8EAA8E;;IAE9E,0DAA0D;;;IAG1D;;;;OAIG;;IAIH,4EAA4E;;IAG5E,6DAA6D;;IAE7D,kDAAkD;;IAElD,+DAA+D;;IAE/D,sEAAsE;;;IAItE,kEAAkE;;;;IAIlE,uEAAuE;;IAEvE,8EAA8E;;;;;;;;;;;;;;;;;CAyBrC,CAAC;AAE5C,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,aAAa,CAAC;AAEzD,iDAAiD;AACjD,eAAO,MAAM,iBAAiB;8BACX,MAAM,KAAG,MAAM;IAChC,2DAA2D;sCAClC,MAAM,KAAG,MAAM;CAEhC,CAAC"}
package/dist/messages.js CHANGED
@@ -271,6 +271,14 @@ export const ERROR_MESSAGE = {
271
271
  * not as a hand-written string at the throw site.
272
272
  */
273
273
  gymRegistrationDraftTooLarge: 'Those gym details are too large to save. Please shorten the descriptions and try again.',
274
+ /**
275
+ * "Near me" found nothing inside the radius.
276
+ *
277
+ * Deliberately not the same as `gymSearchNoResults`: this member searched
278
+ * nowhere in particular, so telling them to refine their search would be
279
+ * advice they cannot act on. What helps is a different place or a gym id.
280
+ */
281
+ gymSearchNoneNearby: 'No gyms within 50 km of you yet. Try a different location, or enter a gym id if you have one.',
274
282
  /** One organisation per account — registering a second is not supported. */
275
283
  gymAlreadyRegistered: 'You have already registered a gym on this account.',
276
284
  /** Registering a gym is something a MEMBER does, so the profile must exist. */
@@ -307,8 +315,6 @@ export const ERROR_MESSAGE = {
307
315
  planNameTaken: 'This center already has a plan with that name. Pick another name.',
308
316
  planVariantDurationRequired: 'Enter how long this variant runs for',
309
317
  planVariantPriceRequired: 'Enter the price for this variant',
310
- /** A "discount" that raises the price is a typo, every time. */
311
- planFinalPriceAboveOriginal: 'The final price cannot be more than the original price',
312
318
  centerAddressRequired: 'Add the center address before creating it.',
313
319
  noCenterForPlans: 'No gym center found. Add a center before creating plans.',
314
320
  noCenterForWorkouts: 'No gym center found. Add a center before creating workouts.',
@@ -1 +1 @@
1
- {"version":3,"file":"messages.js","sourceRoot":"","sources":["../src/messages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,gFAAgF;AAEhF;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,UAAU;IACV,cAAc,EAAE,gBAAgB;IAChC,gBAAgB,EAAE,kBAAkB;IACpC,SAAS,EAAE,WAAW;IAEtB,OAAO;IACP,aAAa,EAAE,eAAe;IAC9B,aAAa,EAAE,eAAe;IAC9B,YAAY,EAAE,cAAc;IAC5B,SAAS,EAAE,WAAW;IACtB,mBAAmB,EAAE,qBAAqB;IAE1C,OAAO;IACP,cAAc,EAAE,gBAAgB;IAChC,mBAAmB,EAAE,qBAAqB;IAC1C,YAAY,EAAE,cAAc;IAE5B,gBAAgB;IAChB,YAAY,EAAE,cAAc;I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qCAAqC;IAEtD,UAAU;IACV,iBAAiB,EAAE,gDAAgD;IACnE,kBAAkB,EAAE,iDAAiD;CAC5B,CAAC;AAI5C,iDAAiD;AACjD,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,SAAS,EAAE,CAAC,GAAW,EAAU,EAAE,CAAC,qBAAqB,GAAG,SAAS;IACrE,2DAA2D;IAC3D,aAAa,EAAE,CAAC,OAAe,EAAU,EAAE,CACzC,mCAAmC,OAAO,UAAU,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG;CACvE,CAAC","sourcesContent":["/**\n * gymmonk-schema — API result messages\n * ====================================\n * Single source of truth for every user-facing SUCCESS and ERROR message the\n * product shows, plus the API error codes both sides key off.\n *\n * Why it lives here: the schema package is already the SSOT for data shapes,\n * types and validation. Result copy is part of that contract — the backend\n * raises a message, the client shows it, and neither should invent its own\n * wording. Both repos import from here, so copy changes land in one place and\n * can never drift between server and client.\n *\n * Usage:\n * backend → `throw new BadRequestError(ERROR_MESSAGE.centerAddressRequired)`\n * frontend → `showSuccess(...toast(SUCCESS_MESSAGE.profileUpdated))`\n *\n * @module gymmonk-schema/messages\n */\n\n// ─── API error codes ─────────────────────────────────────────────────────────\n\n/**\n * Machine-readable error codes returned in the API envelope\n * (`{ success: false, error: { code, message } }`). The client can branch on a\n * code; the message is what a human reads.\n */\nexport const ERROR_CODE = {\n // General\n INTERNAL_ERROR: 'INTERNAL_ERROR',\n VALIDATION_ERROR: 'VALIDATION_ERROR',\n NOT_FOUND: 'NOT_FOUND',\n\n // Auth\n INVALID_TOKEN: 'INVALID_TOKEN',\n TOKEN_EXPIRED: 'TOKEN_EXPIRED',\n UNAUTHORIZED: 'UNAUTHORIZED',\n FORBIDDEN: 'FORBIDDEN',\n SESSION_INVALIDATED: 'SESSION_INVALIDATED',\n\n // User\n USER_NOT_FOUND: 'USER_NOT_FOUND',\n USER_ALREADY_EXISTS: 'USER_ALREADY_EXISTS',\n INVALID_ROLE: 'INVALID_ROLE',\n\n // Rate limiting\n RATE_LIMITED: 'RATE_LIMITED',\n RATE_LIMIT_EXCEEDED: 'RATE_LIMIT_EXCEEDED',\n\n // Upstream / dependency unavailable\n SERVICE_UNAVAILABLE: 'SERVICE_UNAVAILABLE',\n} as const;\n\nexport type ErrorCode = (typeof ERROR_CODE)[keyof typeof ERROR_CODE];\n\n// ─── Message shape ───────────────────────────────────────────────────────────\n\n/** A result message: a headline and an optional quieter second line. */\nexport interface ResultMessage {\n title: string;\n description?: string;\n}\n\n// ─── Success messages ────────────────────────────────────────────────────────\n\n/**\n * Confirmation shown after a write succeeds, keyed by action. Interpolating\n * entries are functions so the caller supplies the value without re-wording.\n */\nexport const SUCCESS_MESSAGE = {\n // Onboarding\n memberOnboardingComplete: {\n title: \"You're all set\",\n description: 'Welcome to GymMonk.',\n },\n ownerOnboardingComplete: {\n title: 'Your gym is ready',\n description: 'Welcome to GymMonk.',\n },\n /** Each wizard step is persisted on its own, so each one confirms. */\n onboardingStepSaved: { title: 'Saved' },\n\n // Identity & profile\n profileUpdated: { title: 'Profile updated' },\n organisationUpdated: { title: 'Organisation updated' },\n\n // Gym structure\n centerAdded: { title: 'Center added' },\n centerUpdated: { title: 'Center updated' },\n membershipPlanCreated: { title: 'Membership plan created' },\n membershipPlanUpdated: { title: 'Membership plan updated' },\n equipmentSaved: { title: 'Equipment updated' },\n\n // Membership (member-side)\n membershipUpdated: { title: 'Membership updated' },\n membershipRenewed: { title: 'Membership renewed' },\n membershipCancelled: { title: 'Membership cancelled' },\n membershipPauseRequested: {\n title: 'Pause request sent',\n description: 'Your gym will confirm the pause.',\n },\n\n // Owner SaaS subscription\n subscriptionUpdated: { title: 'Subscription updated' },\n\n // Training\n workoutPlanCreated: { title: 'Workout plan created' },\n workoutPlanUpdated: { title: 'Workout plan saved' },\n workoutPlanDeleted: {\n title: 'Workout plan deleted',\n description: 'Members on this plan no longer have one.',\n },\n workoutCreated: { title: 'Workout created' },\n workoutUpdated: { title: 'Workout saved' },\n workoutDeleted: { title: 'Workout removed' },\n workoutPlanAssigned: { title: 'Workout plan assigned' },\n\n // Roster (owner console)\n attendanceMarked: { title: 'Attendance saved' },\n memberMarkedInactive: {\n title: 'Member marked inactive',\n description: 'They can no longer check in.',\n },\n memberMarkedActive: { title: 'Member reactivated' },\n memberDeleted: { title: 'Member removed' },\n /**\n * Says what actually happened. Assigning a plan no longer starts it —\n * nothing does until the payment is marked done — so a bare \"Plan\n * updated\" would send the owner away believing the member could train.\n */\n memberPlanAssigned: {\n title: 'Plan assigned',\n description: 'It starts once you mark the payment done.',\n },\n memberMembershipPaused: { title: 'Membership paused' },\n memberMembershipCancelled: { title: 'Membership cancelled' },\n paymentCollected: { title: 'Payment recorded' },\n\n // Sessions\n checkedIn: { title: 'Checked in', description: 'Your session has started.' },\n checkedOut: { title: 'Checked out', description: 'Session saved.' },\n checkInQrRotated: {\n title: 'New QR generated',\n description: 'Print it and replace the old poster.',\n },\n\n // Membership join requests\n membershipRequestSent: {\n title: 'Request sent',\n description: 'The gym will review it shortly.',\n },\n membershipRequestApproved: {\n title: 'Member approved',\n description: 'They can now check in at your gym.',\n },\n membershipRequestRejected: {\n title: 'Request declined',\n description: 'The member has been told.',\n },\n\n // Membership payment confirmation\n membershipRequested: {\n title: 'Plan requested',\n description: 'It starts once your gym confirms the payment.',\n },\n membershipRequestWithdrawn: {\n title: 'Request withdrawn',\n description: 'Pick another plan whenever you are ready.',\n },\n membershipPaymentConfirmed: {\n title: 'Payment confirmed',\n description: 'The plan is now active for this member.',\n },\n membershipPaymentRejected: {\n title: 'Payment turned down',\n description: 'The member has been told and can send it again.',\n },\n\n // Gym registration + platform review\n gymRegistered: {\n title: 'Gym submitted',\n description: 'Our team will review it and let you know.',\n },\n gymApproved: {\n title: 'Gym approved',\n description: 'It is now listed for members to find.',\n },\n gymRejected: {\n title: 'Gym rejected',\n description: 'The owner has been told.',\n },\n\n // Engagement\n feedbackSubmitted: {\n title: 'Feedback sent',\n description: 'Thank you for helping us improve.',\n },\n complaintSubmitted: {\n title: 'Complaint submitted',\n description: 'Your gym will look into it.',\n },\n announcementSent: { title: 'Announcement sent' },\n announcementScheduled: { title: 'Announcement scheduled' },\n announcementDraftSaved: { title: 'Draft saved' },\n announcementDeleted: { title: 'Announcement deleted' },\n announcementCancelled: {\n title: 'Announcement cancelled',\n description: 'It will not be sent.',\n },\n\n // Notification feed\n notificationHidden: { title: 'Notification hidden' },\n notificationRestored: { title: 'Notification restored' },\n allNotificationsRead: { title: 'All caught up' },\n\n // Security (role-switch PIN)\n mpinSet: { title: 'PIN set' },\n mpinReset: { title: 'Your PIN has been reset.' },\n mpinResetLinkSent: {\n title: \"We've emailed you a reset link\",\n description: 'Check your inbox.',\n },\n\n // ── Platform console (superadmin / platform manager) ────────────────────────\n platformRolesUpdated: { title: 'Platform roles updated' },\n platformUserSuspended: {\n title: 'Account suspended',\n description: 'They can no longer sign in.',\n },\n platformUserReinstated: { title: 'Account reinstated' },\n platformUserDeleted: {\n title: 'Account deleted',\n description: 'It is hidden everywhere but can still be restored.',\n },\n platformUserRestored: { title: 'Account restored' },\n platformGymDeleted: {\n title: 'Gym deleted',\n description: 'It is hidden everywhere but can still be restored.',\n },\n platformGymRestored: {\n title: 'Gym restored',\n description: 'It is back in the directory and its owner has the console again.',\n },\n} as const satisfies Record<string, ResultMessage>;\n\nexport type SuccessMessageKey = keyof typeof SUCCESS_MESSAGE;\n\n/** Success messages that name the thing they acted on. */\nexport const SUCCESS_MESSAGE_FOR = {\n memberAdded: (name: string): ResultMessage => ({\n title: 'Member added',\n description: `Share the invite with ${name}.`,\n }),\n staffAdded: (name: string): ResultMessage => ({\n title: 'Staff added',\n description: `Share the invite with ${name}.`,\n }),\n inviteClaimed: (gymName: string): ResultMessage => ({\n title: \"You're all set\",\n description: `Your account is linked to ${gymName}.`,\n }),\n roleSwitched: (roleLabel: string): ResultMessage => ({\n title: `Switched to ${roleLabel}`,\n }),\n gymApprovedFor: (gymName: string): ResultMessage => ({\n title: 'Gym approved',\n description: `${gymName} is now live on GymMonk.`,\n }),\n gymRejectedFor: (gymName: string): ResultMessage => ({\n title: 'Gym rejected',\n description: `The owner of ${gymName} has been told why.`,\n }),\n} as const;\n\n// ─── Error messages ──────────────────────────────────────────────────────────\n\n/**\n * Failure copy. Transport entries describe a request that never reached the\n * API; the rest are domain rules the backend enforces and the client can also\n * check up-front — same wording either way.\n */\nexport const ERROR_MESSAGE = {\n // Transport / generic\n generic: 'Something went wrong. Please try again.',\n network: 'Network error. Check your connection and try again.',\n timeout: 'That took too long. Please try again.',\n sessionExpired: 'Your session expired. Please sign in again.',\n\n // Client-side validation\n formInvalid: 'Please check the highlighted fields.',\n\n // Onboarding\n roleRequired: 'Choose a role to continue',\n ownerOnboardingFailed: 'We could not create your gym. Please try again.',\n memberOnboardingFailed: 'We could not save your details. Please try again.',\n\n // ── Gym registration (\"list your gym\") ─────────────────────────────────────\n gymRegistrationFailed: 'We could not register your gym. Please try again.',\n /**\n * The wizard could not read what the owner had already saved.\n *\n * It refuses to open on a blank form rather than risk the next Continue\n * overwriting a real draft, so this is the whole screen, not a toast.\n */\n gymRegistrationDraftLoadFailed:\n 'We could not open your saved gym details. Check your connection and try again.',\n /**\n * The step the wizard tried to save is implausibly large.\n *\n * A guard against a client sending something absurd rather than a limit the\n * real form approaches, but it is raised by the SERVER and shown verbatim in\n * the step-save toast — so the wording lives here with the rest of the copy,\n * not as a hand-written string at the throw site.\n */\n gymRegistrationDraftTooLarge:\n 'Those gym details are too large to save. Please shorten the descriptions and try again.',\n /** One organisation per account — registering a second is not supported. */\n gymAlreadyRegistered: 'You have already registered a gym on this account.',\n /** Registering a gym is something a MEMBER does, so the profile must exist. */\n gymRegistrationNeedsProfile: 'Finish setting up your profile before registering a gym.',\n /** Every owner action other than editing their own details, before approval. */\n gymAwaitingApproval:\n 'Your gym is waiting for approval. You can manage it once our team has reviewed it.',\n /** The reviewer turned the registration down. */\n gymRegistrationRejected: 'Your gym registration was not approved.',\n organisationNotFound: 'That gym could not be found.',\n\n // ── Platform console ────────────────────────────────────────────────────────\n /** The account is gone, or was already erased. */\n platformUserNotFound: 'That account could not be found.',\n /**\n * An admin acting on their OWN row. Suspending or deleting yourself takes away\n * the access needed to undo it, so the console refuses rather than letting one\n * mis-tap lock the platform's last superadmin out of it.\n */\n platformCannotActOnSelf: 'You cannot do that to your own account.',\n /**\n * Removing the last superadmin. `manage GymApproval` is held by nobody else,\n * so the gym review queue would become unreachable with no way back in short\n * of a database edit.\n */\n platformLastSuperadmin: 'The platform must keep at least one superadmin.',\n /** The typed confirmation did not match the record being deleted. */\n platformConfirmationMismatch: 'That did not match. Nothing was changed.',\n /** Two reviewers acting on the same registration; the second one loses. */\n organisationAlreadyDecided: 'Someone has already reviewed this gym.',\n /** A step failed to persist — the user stays put so nothing is lost. */\n onboardingStepSaveFailed: 'We could not save this step. Please try again.',\n\n // Gym structure prerequisites\n centerRequiredForPlan: 'Pick the center this plan belongs to.',\n planVariantRequired: 'Add at least one pricing variant before saving the plan.',\n planNameTaken: 'This center already has a plan with that name. Pick another name.',\n planVariantDurationRequired: 'Enter how long this variant runs for',\n planVariantPriceRequired: 'Enter the price for this variant',\n /** A \"discount\" that raises the price is a typo, every time. */\n planFinalPriceAboveOriginal: 'The final price cannot be more than the original price',\n centerAddressRequired: 'Add the center address before creating it.',\n noCenterForPlans: 'No gym center found. Add a center before creating plans.',\n noCenterForWorkouts: 'No gym center found. Add a center before creating workouts.',\n noCenterForAnnouncements: 'No gym center found. Add a center before sending announcements.',\n announcementAlreadySent: 'That announcement has already gone out, so it cannot be cancelled.',\n\n // Notification feed\n notificationHideFailed: 'Could not hide that notification.',\n notificationRestoreFailed: 'Could not restore that notification.',\n\n // Membership\n planUnavailable: 'That plan is not available right now.',\n membershipPlanRequired: 'Choose a membership plan to continue',\n /** The member was created, but the plan the owner picked did not stick. */\n initialPlanNotAssigned:\n 'Member added, but the plan could not be assigned. Assign it from their profile.',\n noPlansToAssign: 'No membership plans yet. Create one to assign it while adding a member.',\n /**\n * Not an error the member can act on by trying harder — it is the whole\n * point of the flow, so it reads as a status rather than a refusal.\n */\n membershipAwaitingPayment:\n 'Your gym is checking your payment. The plan starts as soon as they confirm it.',\n membershipNoPendingRequest: 'There is no plan waiting for confirmation.',\n /**\n * The owner reached for the roster toggle on a plan that has not been paid\n * for. Points at the action that WOULD start it rather than just refusing.\n */\n membershipPendingUseConfirm:\n 'This plan is waiting for payment confirmation. Mark the payment done to start it.',\n /** Two managers opening the same request; the second one loses. */\n membershipAlreadyDecided: 'Someone has already answered this payment.',\n membershipConfirmFailed: 'Could not confirm that payment. Please try again.',\n membershipRejectFailed: 'Could not turn down that payment. Please try again.',\n membershipWithdrawFailed: 'Could not withdraw that request. Please try again.',\n /** The URL did not come from our own storage — a broken or hostile client. */\n paymentProofInvalid: 'That payment screenshot could not be attached. Upload it again.',\n\n // Training\n workoutPlanRequired: 'Choose a plan to assign',\n // Roster (owner console)\n attendanceMarkFailed: 'Could not save that attendance. Please try again.',\n memberStatusFailed: \"Could not change that member's status. Please try again.\",\n memberDeleteFailed: 'Could not remove that member. Please try again.',\n memberPlanAssignFailed: 'Could not update that plan. Please try again.',\n memberPauseFailed: 'Could not pause that membership. Please try again.',\n memberCancelFailed: 'Could not cancel that membership. Please try again.',\n paymentCollectFailed: 'Could not record that payment. Please try again.',\n paymentAmountRequired: 'Enter the amount collected',\n pauseDatesRequired: 'Pick both pause dates',\n pauseDatesOrder: 'The end date has to be after the start date',\n /**\n * Attendance, workout plans and payments are all keyed on the central-auth\n * user, which an invited record does not have until the person claims it.\n */\n memberNotClaimed: 'This member has not claimed their invite yet.',\n\n // Sessions\n checkInFailed: 'Could not check you in. Please try again.',\n checkOutFailed: 'Could not check you out. Please try again.',\n /** The camera decoded a QR, but it is not a gymmonk check-in poster. */\n qrNotRecognised: 'That is not a gym check-in QR. Point at the poster at the gym.',\n /** A valid gymmonk QR, but for a gym the member does not belong to. */\n qrWrongGym: 'That QR belongs to a different gym.',\n /** The scanned code matches no center — a retired or mistyped poster. */\n qrUnknown: 'This QR is no longer valid. Ask the gym for the current poster.',\n /** Checking out with a poster from somewhere other than where you started. */\n qrWrongGymForCheckOut: 'Scan the QR at the gym where you checked in.',\n /** Manual entry only accepts a full, well-formed code. */\n checkInCodeInvalid: 'Enter the 16-character code printed under the QR.',\n checkInQrRotateFailed: 'Could not generate a new QR. Please try again.',\n /**\n * Ticking an exercise off records it against a live session, so there has to\n * be one. Shown when a member opens an exercise outside a workout and taps\n * Mark As Done.\n */\n noSessionToTrack: 'Check in at your gym to track this workout.',\n\n // ── Membership join requests ───────────────────────────────────────────────\n /** Scanned a valid poster, but the gym has not accepted this member yet. */\n membershipNotApproved:\n 'Your gym has not accepted your join request yet. You can check in once they do.',\n /** Accepted, but with no live plan — check-in needs both. */\n membershipNotActive: 'Your membership plan is not active. Renew it to start checking in again.',\n /** A second request while one is already open. */\n membershipRequestPending: 'You already have a request waiting with this gym.',\n /** Requesting a gym they are already an accepted member of. */\n membershipRequestAlreadyMember: 'You are already a member of this gym.',\n /** v1 memberships are single-center — leave the current gym first. */\n membershipRequestAlreadyAtAnotherGym:\n 'You already belong to a gym. Cancel that membership before joining another.',\n membershipRequestNotFound: 'That join request no longer exists.',\n /** Two staff acting on the same request; the second one loses. */\n membershipRequestAlreadyDecided: 'Someone has already answered this request.',\n membershipRequestFailed: 'Could not send your request. Please try again.',\n gymCodeUnknown: 'No gym found with that id. Check it with your gym.',\n /** Actions that only make sense once a gym has taken the member on. */\n noGymJoined: 'Join a gym first. You can find one from your Me tab.',\n /** Searching by name needs somewhere to look — see `gymSearchQuerySchema`. */\n gymSearchStateRequired: 'Pick a state to search gyms by name.',\n gymSearchNoResults: 'No gyms matched. Try a different area, or enter the gym id.',\n\n // Camera (QR scanning)\n cameraDenied: 'Camera access is blocked. Allow it in your browser settings to scan.',\n cameraUnavailable: 'No camera found on this device. Enter the code printed under the QR.',\n cameraInsecure: 'Scanning needs a secure (https) connection.',\n cameraFailed: 'Could not start the camera. Enter the code printed under the QR.',\n\n // Engagement\n feedbackRatingRequired: 'Choose a rating to submit your feedback',\n complaintIssueRequired: 'Choose the issue you are reporting',\n\n // Security (role-switch PIN)\n mpinIncorrect: 'Incorrect PIN.',\n mpinVerifyFailed: \"Couldn't verify. Try again.\",\n mpinSetFailed: \"Couldn't set your PIN. Try again.\",\n mpinMismatch: \"Those didn't match. Try again.\",\n mpinResetLinkFailed: \"Couldn't send the reset link. Try again.\",\n mpinResetFailed: \"Couldn't reset your PIN. Try again.\",\n\n // Uploads\n imageUploadFailed: 'Could not upload that image. Please try again.',\n imageProcessFailed: 'Could not process that image. Please try again.',\n} as const satisfies Record<string, string>;\n\nexport type ErrorMessageKey = keyof typeof ERROR_MESSAGE;\n\n/** Error messages that name a limit or value. */\nexport const ERROR_MESSAGE_FOR = {\n maxPhotos: (max: number): string => `You can add up to ${max} photos`,\n /** Role-switch PIN lockout, in whole minutes remaining. */\n mpinLockedOut: (minutes: number): string =>\n `Too many attempts. Try again in ${minutes} minute${minutes > 1 ? 's' : ''}.`,\n} as const;\n"]}
1
+ {"version":3,"file":"messages.js","sourceRoot":"","sources":["../src/messages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,gFAAgF;AAEhF;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,UAAU;IACV,cAAc,EAAE,gBAAgB;IAChC,gBAAgB,EAAE,kBAAkB;IACpC,SAAS,EAAE,WAAW;IAEtB,OAAO;IACP,aAAa,EAAE,eAAe;IAC9B,aAAa,EAAE,eAAe;IAC9B,YAAY,EAAE,cAAc;IAC5B,SAAS,EAAE,WAAW;IACtB,mBAAmB,EAAE,qBAAqB;IAE1C,OAAO;IACP,cAAc,EAAE,gBAAgB;IAChC,mBAAmB,EAAE,qBAAqB;IAC1C,YAAY,EAAE,cAAc;IAE5B,gBAAgB;IAChB,YAAY,EAAE,cAAc;IAC5B,mBAAm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AEtD,UAAU;IACV,iBAAiB,EAAE,gDAAgD;IACnE,kBAAkB,EAAE,iDAAiD;CAC5B,CAAC;AAI5C,iDAAiD;AACjD,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,SAAS,EAAE,CAAC,GAAW,EAAU,EAAE,CAAC,qBAAqB,GAAG,SAAS;IACrE,2DAA2D;IAC3D,aAAa,EAAE,CAAC,OAAe,EAAU,EAAE,CACzC,mCAAmC,OAAO,UAAU,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG;CACvE,CAAC","sourcesContent":["/**\n * gymmonk-schema — API result messages\n * ====================================\n * Single source of truth for every user-facing SUCCESS and ERROR message the\n * product shows, plus the API error codes both sides key off.\n *\n * Why it lives here: the schema package is already the SSOT for data shapes,\n * types and validation. Result copy is part of that contract — the backend\n * raises a message, the client shows it, and neither should invent its own\n * wording. Both repos import from here, so copy changes land in one place and\n * can never drift between server and client.\n *\n * Usage:\n * backend → `throw new BadRequestError(ERROR_MESSAGE.centerAddressRequired)`\n * frontend → `showSuccess(...toast(SUCCESS_MESSAGE.profileUpdated))`\n *\n * @module gymmonk-schema/messages\n */\n\n// ─── API error codes ─────────────────────────────────────────────────────────\n\n/**\n * Machine-readable error codes returned in the API envelope\n * (`{ success: false, error: { code, message } }`). The client can branch on a\n * code; the message is what a human reads.\n */\nexport const ERROR_CODE = {\n // General\n INTERNAL_ERROR: 'INTERNAL_ERROR',\n VALIDATION_ERROR: 'VALIDATION_ERROR',\n NOT_FOUND: 'NOT_FOUND',\n\n // Auth\n INVALID_TOKEN: 'INVALID_TOKEN',\n TOKEN_EXPIRED: 'TOKEN_EXPIRED',\n UNAUTHORIZED: 'UNAUTHORIZED',\n FORBIDDEN: 'FORBIDDEN',\n SESSION_INVALIDATED: 'SESSION_INVALIDATED',\n\n // User\n USER_NOT_FOUND: 'USER_NOT_FOUND',\n USER_ALREADY_EXISTS: 'USER_ALREADY_EXISTS',\n INVALID_ROLE: 'INVALID_ROLE',\n\n // Rate limiting\n RATE_LIMITED: 'RATE_LIMITED',\n RATE_LIMIT_EXCEEDED: 'RATE_LIMIT_EXCEEDED',\n\n // Upstream / dependency unavailable\n SERVICE_UNAVAILABLE: 'SERVICE_UNAVAILABLE',\n} as const;\n\nexport type ErrorCode = (typeof ERROR_CODE)[keyof typeof ERROR_CODE];\n\n// ─── Message shape ───────────────────────────────────────────────────────────\n\n/** A result message: a headline and an optional quieter second line. */\nexport interface ResultMessage {\n title: string;\n description?: string;\n}\n\n// ─── Success messages ────────────────────────────────────────────────────────\n\n/**\n * Confirmation shown after a write succeeds, keyed by action. Interpolating\n * entries are functions so the caller supplies the value without re-wording.\n */\nexport const SUCCESS_MESSAGE = {\n // Onboarding\n memberOnboardingComplete: {\n title: \"You're all set\",\n description: 'Welcome to GymMonk.',\n },\n ownerOnboardingComplete: {\n title: 'Your gym is ready',\n description: 'Welcome to GymMonk.',\n },\n /** Each wizard step is persisted on its own, so each one confirms. */\n onboardingStepSaved: { title: 'Saved' },\n\n // Identity & profile\n profileUpdated: { title: 'Profile updated' },\n organisationUpdated: { title: 'Organisation updated' },\n\n // Gym structure\n centerAdded: { title: 'Center added' },\n centerUpdated: { title: 'Center updated' },\n membershipPlanCreated: { title: 'Membership plan created' },\n membershipPlanUpdated: { title: 'Membership plan updated' },\n equipmentSaved: { title: 'Equipment updated' },\n\n // Membership (member-side)\n membershipUpdated: { title: 'Membership updated' },\n membershipRenewed: { title: 'Membership renewed' },\n membershipCancelled: { title: 'Membership cancelled' },\n membershipPauseRequested: {\n title: 'Pause request sent',\n description: 'Your gym will confirm the pause.',\n },\n\n // Owner SaaS subscription\n subscriptionUpdated: { title: 'Subscription updated' },\n\n // Training\n workoutPlanCreated: { title: 'Workout plan created' },\n workoutPlanUpdated: { title: 'Workout plan saved' },\n workoutPlanDeleted: {\n title: 'Workout plan deleted',\n description: 'Members on this plan no longer have one.',\n },\n workoutCreated: { title: 'Workout created' },\n workoutUpdated: { title: 'Workout saved' },\n workoutDeleted: { title: 'Workout removed' },\n workoutPlanAssigned: { title: 'Workout plan assigned' },\n\n // Roster (owner console)\n attendanceMarked: { title: 'Attendance saved' },\n memberMarkedInactive: {\n title: 'Member marked inactive',\n description: 'They can no longer check in.',\n },\n memberMarkedActive: { title: 'Member reactivated' },\n memberDeleted: { title: 'Member removed' },\n /**\n * Says what actually happened. Assigning a plan no longer starts it —\n * nothing does until the payment is marked done — so a bare \"Plan\n * updated\" would send the owner away believing the member could train.\n */\n memberPlanAssigned: {\n title: 'Plan assigned',\n description: 'It starts once you mark the payment done.',\n },\n memberMembershipPaused: { title: 'Membership paused' },\n memberMembershipCancelled: { title: 'Membership cancelled' },\n paymentCollected: { title: 'Payment recorded' },\n\n // Sessions\n checkedIn: { title: 'Checked in', description: 'Your session has started.' },\n checkedOut: { title: 'Checked out', description: 'Session saved.' },\n checkInQrRotated: {\n title: 'New QR generated',\n description: 'Print it and replace the old poster.',\n },\n\n // Membership join requests\n membershipRequestSent: {\n title: 'Request sent',\n description: 'The gym will review it shortly.',\n },\n membershipRequestApproved: {\n title: 'Member approved',\n description: 'They can now check in at your gym.',\n },\n membershipRequestRejected: {\n title: 'Request declined',\n description: 'The member has been told.',\n },\n\n // Membership payment confirmation\n membershipRequested: {\n title: 'Plan requested',\n description: 'It starts once your gym confirms the payment.',\n },\n membershipRequestWithdrawn: {\n title: 'Request withdrawn',\n description: 'Pick another plan whenever you are ready.',\n },\n membershipPaymentConfirmed: {\n title: 'Payment confirmed',\n description: 'The plan is now active for this member.',\n },\n membershipPaymentRejected: {\n title: 'Payment turned down',\n description: 'The member has been told and can send it again.',\n },\n\n // Gym registration + platform review\n gymRegistered: {\n title: 'Gym submitted',\n description: 'Our team will review it and let you know.',\n },\n gymApproved: {\n title: 'Gym approved',\n description: 'It is now listed for members to find.',\n },\n gymRejected: {\n title: 'Gym rejected',\n description: 'The owner has been told.',\n },\n\n // Engagement\n feedbackSubmitted: {\n title: 'Feedback sent',\n description: 'Thank you for helping us improve.',\n },\n complaintSubmitted: {\n title: 'Complaint submitted',\n description: 'Your gym will look into it.',\n },\n announcementSent: { title: 'Announcement sent' },\n announcementScheduled: { title: 'Announcement scheduled' },\n announcementDraftSaved: { title: 'Draft saved' },\n announcementDeleted: { title: 'Announcement deleted' },\n announcementCancelled: {\n title: 'Announcement cancelled',\n description: 'It will not be sent.',\n },\n\n // Notification feed\n notificationHidden: { title: 'Notification hidden' },\n notificationRestored: { title: 'Notification restored' },\n allNotificationsRead: { title: 'All caught up' },\n\n // Security (role-switch PIN)\n mpinSet: { title: 'PIN set' },\n mpinReset: { title: 'Your PIN has been reset.' },\n mpinResetLinkSent: {\n title: \"We've emailed you a reset link\",\n description: 'Check your inbox.',\n },\n\n // ── Platform console (superadmin / platform manager) ────────────────────────\n platformRolesUpdated: { title: 'Platform roles updated' },\n platformUserSuspended: {\n title: 'Account suspended',\n description: 'They can no longer sign in.',\n },\n platformUserReinstated: { title: 'Account reinstated' },\n platformUserDeleted: {\n title: 'Account deleted',\n description: 'It is hidden everywhere but can still be restored.',\n },\n platformUserRestored: { title: 'Account restored' },\n platformGymDeleted: {\n title: 'Gym deleted',\n description: 'It is hidden everywhere but can still be restored.',\n },\n platformGymRestored: {\n title: 'Gym restored',\n description: 'It is back in the directory and its owner has the console again.',\n },\n} as const satisfies Record<string, ResultMessage>;\n\nexport type SuccessMessageKey = keyof typeof SUCCESS_MESSAGE;\n\n/** Success messages that name the thing they acted on. */\nexport const SUCCESS_MESSAGE_FOR = {\n memberAdded: (name: string): ResultMessage => ({\n title: 'Member added',\n description: `Share the invite with ${name}.`,\n }),\n staffAdded: (name: string): ResultMessage => ({\n title: 'Staff added',\n description: `Share the invite with ${name}.`,\n }),\n inviteClaimed: (gymName: string): ResultMessage => ({\n title: \"You're all set\",\n description: `Your account is linked to ${gymName}.`,\n }),\n roleSwitched: (roleLabel: string): ResultMessage => ({\n title: `Switched to ${roleLabel}`,\n }),\n gymApprovedFor: (gymName: string): ResultMessage => ({\n title: 'Gym approved',\n description: `${gymName} is now live on GymMonk.`,\n }),\n gymRejectedFor: (gymName: string): ResultMessage => ({\n title: 'Gym rejected',\n description: `The owner of ${gymName} has been told why.`,\n }),\n} as const;\n\n// ─── Error messages ──────────────────────────────────────────────────────────\n\n/**\n * Failure copy. Transport entries describe a request that never reached the\n * API; the rest are domain rules the backend enforces and the client can also\n * check up-front — same wording either way.\n */\nexport const ERROR_MESSAGE = {\n // Transport / generic\n generic: 'Something went wrong. Please try again.',\n network: 'Network error. Check your connection and try again.',\n timeout: 'That took too long. Please try again.',\n sessionExpired: 'Your session expired. Please sign in again.',\n\n // Client-side validation\n formInvalid: 'Please check the highlighted fields.',\n\n // Onboarding\n roleRequired: 'Choose a role to continue',\n ownerOnboardingFailed: 'We could not create your gym. Please try again.',\n memberOnboardingFailed: 'We could not save your details. Please try again.',\n\n // ── Gym registration (\"list your gym\") ─────────────────────────────────────\n gymRegistrationFailed: 'We could not register your gym. Please try again.',\n /**\n * The wizard could not read what the owner had already saved.\n *\n * It refuses to open on a blank form rather than risk the next Continue\n * overwriting a real draft, so this is the whole screen, not a toast.\n */\n gymRegistrationDraftLoadFailed:\n 'We could not open your saved gym details. Check your connection and try again.',\n /**\n * The step the wizard tried to save is implausibly large.\n *\n * A guard against a client sending something absurd rather than a limit the\n * real form approaches, but it is raised by the SERVER and shown verbatim in\n * the step-save toast — so the wording lives here with the rest of the copy,\n * not as a hand-written string at the throw site.\n */\n gymRegistrationDraftTooLarge:\n 'Those gym details are too large to save. Please shorten the descriptions and try again.',\n /**\n * \"Near me\" found nothing inside the radius.\n *\n * Deliberately not the same as `gymSearchNoResults`: this member searched\n * nowhere in particular, so telling them to refine their search would be\n * advice they cannot act on. What helps is a different place or a gym id.\n */\n gymSearchNoneNearby:\n 'No gyms within 50 km of you yet. Try a different location, or enter a gym id if you have one.',\n /** One organisation per account — registering a second is not supported. */\n gymAlreadyRegistered: 'You have already registered a gym on this account.',\n /** Registering a gym is something a MEMBER does, so the profile must exist. */\n gymRegistrationNeedsProfile: 'Finish setting up your profile before registering a gym.',\n /** Every owner action other than editing their own details, before approval. */\n gymAwaitingApproval:\n 'Your gym is waiting for approval. You can manage it once our team has reviewed it.',\n /** The reviewer turned the registration down. */\n gymRegistrationRejected: 'Your gym registration was not approved.',\n organisationNotFound: 'That gym could not be found.',\n\n // ── Platform console ────────────────────────────────────────────────────────\n /** The account is gone, or was already erased. */\n platformUserNotFound: 'That account could not be found.',\n /**\n * An admin acting on their OWN row. Suspending or deleting yourself takes away\n * the access needed to undo it, so the console refuses rather than letting one\n * mis-tap lock the platform's last superadmin out of it.\n */\n platformCannotActOnSelf: 'You cannot do that to your own account.',\n /**\n * Removing the last superadmin. `manage GymApproval` is held by nobody else,\n * so the gym review queue would become unreachable with no way back in short\n * of a database edit.\n */\n platformLastSuperadmin: 'The platform must keep at least one superadmin.',\n /** The typed confirmation did not match the record being deleted. */\n platformConfirmationMismatch: 'That did not match. Nothing was changed.',\n /** Two reviewers acting on the same registration; the second one loses. */\n organisationAlreadyDecided: 'Someone has already reviewed this gym.',\n /** A step failed to persist — the user stays put so nothing is lost. */\n onboardingStepSaveFailed: 'We could not save this step. Please try again.',\n\n // Gym structure prerequisites\n centerRequiredForPlan: 'Pick the center this plan belongs to.',\n planVariantRequired: 'Add at least one pricing variant before saving the plan.',\n planNameTaken: 'This center already has a plan with that name. Pick another name.',\n planVariantDurationRequired: 'Enter how long this variant runs for',\n planVariantPriceRequired: 'Enter the price for this variant',\n centerAddressRequired: 'Add the center address before creating it.',\n noCenterForPlans: 'No gym center found. Add a center before creating plans.',\n noCenterForWorkouts: 'No gym center found. Add a center before creating workouts.',\n noCenterForAnnouncements: 'No gym center found. Add a center before sending announcements.',\n announcementAlreadySent: 'That announcement has already gone out, so it cannot be cancelled.',\n\n // Notification feed\n notificationHideFailed: 'Could not hide that notification.',\n notificationRestoreFailed: 'Could not restore that notification.',\n\n // Membership\n planUnavailable: 'That plan is not available right now.',\n membershipPlanRequired: 'Choose a membership plan to continue',\n /** The member was created, but the plan the owner picked did not stick. */\n initialPlanNotAssigned:\n 'Member added, but the plan could not be assigned. Assign it from their profile.',\n noPlansToAssign: 'No membership plans yet. Create one to assign it while adding a member.',\n /**\n * Not an error the member can act on by trying harder — it is the whole\n * point of the flow, so it reads as a status rather than a refusal.\n */\n membershipAwaitingPayment:\n 'Your gym is checking your payment. The plan starts as soon as they confirm it.',\n membershipNoPendingRequest: 'There is no plan waiting for confirmation.',\n /**\n * The owner reached for the roster toggle on a plan that has not been paid\n * for. Points at the action that WOULD start it rather than just refusing.\n */\n membershipPendingUseConfirm:\n 'This plan is waiting for payment confirmation. Mark the payment done to start it.',\n /** Two managers opening the same request; the second one loses. */\n membershipAlreadyDecided: 'Someone has already answered this payment.',\n membershipConfirmFailed: 'Could not confirm that payment. Please try again.',\n membershipRejectFailed: 'Could not turn down that payment. Please try again.',\n membershipWithdrawFailed: 'Could not withdraw that request. Please try again.',\n /** The URL did not come from our own storage — a broken or hostile client. */\n paymentProofInvalid: 'That payment screenshot could not be attached. Upload it again.',\n\n // Training\n workoutPlanRequired: 'Choose a plan to assign',\n // Roster (owner console)\n attendanceMarkFailed: 'Could not save that attendance. Please try again.',\n memberStatusFailed: \"Could not change that member's status. Please try again.\",\n memberDeleteFailed: 'Could not remove that member. Please try again.',\n memberPlanAssignFailed: 'Could not update that plan. Please try again.',\n memberPauseFailed: 'Could not pause that membership. Please try again.',\n memberCancelFailed: 'Could not cancel that membership. Please try again.',\n paymentCollectFailed: 'Could not record that payment. Please try again.',\n paymentAmountRequired: 'Enter the amount collected',\n pauseDatesRequired: 'Pick both pause dates',\n pauseDatesOrder: 'The end date has to be after the start date',\n /**\n * Attendance, workout plans and payments are all keyed on the central-auth\n * user, which an invited record does not have until the person claims it.\n */\n memberNotClaimed: 'This member has not claimed their invite yet.',\n\n // Sessions\n checkInFailed: 'Could not check you in. Please try again.',\n checkOutFailed: 'Could not check you out. Please try again.',\n /** The camera decoded a QR, but it is not a gymmonk check-in poster. */\n qrNotRecognised: 'That is not a gym check-in QR. Point at the poster at the gym.',\n /** A valid gymmonk QR, but for a gym the member does not belong to. */\n qrWrongGym: 'That QR belongs to a different gym.',\n /** The scanned code matches no center — a retired or mistyped poster. */\n qrUnknown: 'This QR is no longer valid. Ask the gym for the current poster.',\n /** Checking out with a poster from somewhere other than where you started. */\n qrWrongGymForCheckOut: 'Scan the QR at the gym where you checked in.',\n /** Manual entry only accepts a full, well-formed code. */\n checkInCodeInvalid: 'Enter the 16-character code printed under the QR.',\n checkInQrRotateFailed: 'Could not generate a new QR. Please try again.',\n /**\n * Ticking an exercise off records it against a live session, so there has to\n * be one. Shown when a member opens an exercise outside a workout and taps\n * Mark As Done.\n */\n noSessionToTrack: 'Check in at your gym to track this workout.',\n\n // ── Membership join requests ───────────────────────────────────────────────\n /** Scanned a valid poster, but the gym has not accepted this member yet. */\n membershipNotApproved:\n 'Your gym has not accepted your join request yet. You can check in once they do.',\n /** Accepted, but with no live plan — check-in needs both. */\n membershipNotActive: 'Your membership plan is not active. Renew it to start checking in again.',\n /** A second request while one is already open. */\n membershipRequestPending: 'You already have a request waiting with this gym.',\n /** Requesting a gym they are already an accepted member of. */\n membershipRequestAlreadyMember: 'You are already a member of this gym.',\n /** v1 memberships are single-center — leave the current gym first. */\n membershipRequestAlreadyAtAnotherGym:\n 'You already belong to a gym. Cancel that membership before joining another.',\n membershipRequestNotFound: 'That join request no longer exists.',\n /** Two staff acting on the same request; the second one loses. */\n membershipRequestAlreadyDecided: 'Someone has already answered this request.',\n membershipRequestFailed: 'Could not send your request. Please try again.',\n gymCodeUnknown: 'No gym found with that id. Check it with your gym.',\n /** Actions that only make sense once a gym has taken the member on. */\n noGymJoined: 'Join a gym first. You can find one from your Me tab.',\n /** Searching by name needs somewhere to look — see `gymSearchQuerySchema`. */\n gymSearchStateRequired: 'Pick a state to search gyms by name.',\n gymSearchNoResults: 'No gyms matched. Try a different area, or enter the gym id.',\n\n // Camera (QR scanning)\n cameraDenied: 'Camera access is blocked. Allow it in your browser settings to scan.',\n cameraUnavailable: 'No camera found on this device. Enter the code printed under the QR.',\n cameraInsecure: 'Scanning needs a secure (https) connection.',\n cameraFailed: 'Could not start the camera. Enter the code printed under the QR.',\n\n // Engagement\n feedbackRatingRequired: 'Choose a rating to submit your feedback',\n complaintIssueRequired: 'Choose the issue you are reporting',\n\n // Security (role-switch PIN)\n mpinIncorrect: 'Incorrect PIN.',\n mpinVerifyFailed: \"Couldn't verify. Try again.\",\n mpinSetFailed: \"Couldn't set your PIN. Try again.\",\n mpinMismatch: \"Those didn't match. Try again.\",\n mpinResetLinkFailed: \"Couldn't send the reset link. Try again.\",\n mpinResetFailed: \"Couldn't reset your PIN. Try again.\",\n\n // Uploads\n imageUploadFailed: 'Could not upload that image. Please try again.',\n imageProcessFailed: 'Could not process that image. Please try again.',\n} as const satisfies Record<string, string>;\n\nexport type ErrorMessageKey = keyof typeof ERROR_MESSAGE;\n\n/** Error messages that name a limit or value. */\nexport const ERROR_MESSAGE_FOR = {\n maxPhotos: (max: number): string => `You can add up to ${max} photos`,\n /** Role-switch PIN lockout, in whole minutes remaining. */\n mpinLockedOut: (minutes: number): string =>\n `Too many attempts. Try again in ${minutes} minute${minutes > 1 ? 's' : ''}.`,\n} as const;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gymmonk-schema",
3
- "version": "0.40.0",
3
+ "version": "0.41.0",
4
4
  "description": "Shared Zod schemas, enums and domain types for GymMonk (fitness SaaS) — single source of truth (SSOT) consumed by gymmonk-backend and gymmonk-web-client.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",