gymmonk-schema 0.12.0 → 0.13.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
@@ -91,6 +91,7 @@ export declare const createCenterBodySchema: z.ZodObject<{
91
91
  }, z.core.$strip>>;
92
92
  }, z.core.$strip>;
93
93
  floorAreaSqft: z.ZodOptional<z.ZodNumber>;
94
+ capacity: z.ZodOptional<z.ZodNumber>;
94
95
  primaryPhone: z.ZodString;
95
96
  secondaryPhone: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
96
97
  email: z.ZodPreprocess<z.ZodOptional<z.ZodEmail>>;
@@ -190,6 +191,7 @@ export declare const updateCenterBodySchema: z.ZodObject<{
190
191
  }, z.core.$strip>>;
191
192
  }, z.core.$strip>>;
192
193
  floorAreaSqft: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
194
+ capacity: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
193
195
  primaryPhone: z.ZodOptional<z.ZodString>;
194
196
  secondaryPhone: z.ZodOptional<z.ZodPreprocess<z.ZodOptional<z.ZodString>>>;
195
197
  email: z.ZodOptional<z.ZodPreprocess<z.ZodOptional<z.ZodEmail>>>;
@@ -292,6 +294,7 @@ export declare const centerSchema: z.ZodObject<{
292
294
  }, z.core.$strip>>;
293
295
  }, z.core.$strip>;
294
296
  floorAreaSqft: z.ZodNullable<z.ZodNumber>;
297
+ capacity: z.ZodNullable<z.ZodNumber>;
295
298
  primaryPhone: z.ZodString;
296
299
  secondaryPhone: z.ZodNullable<z.ZodString>;
297
300
  email: z.ZodNullable<z.ZodString>;
@@ -343,6 +346,20 @@ export declare const centerSchema: z.ZodObject<{
343
346
  updatedAt: z.ZodISODateTime;
344
347
  }, z.core.$strip>;
345
348
  export type Center = z.infer<typeof centerSchema>;
349
+ /**
350
+ * The three-up header on a centre's detail screen.
351
+ *
352
+ * Computed, never stored — `activeMembers` counts live memberships and
353
+ * `monthlyRevenueInr` sums this month's successful payments, so the card can
354
+ * never drift from the ledger the way a denormalised total would. `capacity`
355
+ * is the one stored value, and is null until the owner fills it in.
356
+ */
357
+ export declare const centerStatsSchema: z.ZodObject<{
358
+ capacity: z.ZodNullable<z.ZodNumber>;
359
+ activeMembers: z.ZodNumber;
360
+ monthlyRevenueInr: z.ZodNumber;
361
+ }, z.core.$strip>;
362
+ export type CenterStats = z.infer<typeof centerStatsSchema>;
346
363
  /** A lightweight public directory result for the "find a gym" screen. */
347
364
  export declare const nearbyGymSchema: z.ZodObject<{
348
365
  id: z.ZodString;
@@ -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;AAaxB,yDAAyD;AACzD,eAAO,MAAM,YAAY,8IAaf,CAAC;AACX,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;EAAuB,CAAC;AACrD,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAI1D,eAAO,MAAM,kBAAkB;;;EAAiC,CAAC;AACjE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D;;;GAGG;AACH,eAAO,MAAM,aAAa,aAGwB,CAAC;AACnD,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAIpD,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAcjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;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S,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC,eAAO,MAAM,oBAAoB;;;;;;;;iBAwB7B,CAAC;AACL,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,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"}
package/dist/center.js CHANGED
@@ -45,6 +45,15 @@ export const createCenterBodySchema = z.object({
45
45
  address: addressSchema,
46
46
  /** Usable floor area in square feet. */
47
47
  floorAreaSqft: z.number().int().min(0).max(1_000_000).optional(),
48
+ /**
49
+ * How many people the branch holds at once.
50
+ *
51
+ * The denominator behind "how full are we" — the centre detail screen shows
52
+ * it beside the active-member count, and crowd-load has no meaning without
53
+ * it. Optional: a gym that has never measured it should not be blocked from
54
+ * saving the rest of its details.
55
+ */
56
+ capacity: z.number().int().min(1).max(100_000).optional(),
48
57
  primaryPhone: phoneSchema,
49
58
  secondaryPhone: optionalPhoneSchema,
50
59
  email: optionalEmailSchema,
@@ -65,6 +74,7 @@ export const centerSchema = z.object({
65
74
  types: z.array(centerTypeSchema),
66
75
  address: addressSchema,
67
76
  floorAreaSqft: z.number().int().nullable(),
77
+ capacity: z.number().int().nullable(),
68
78
  primaryPhone: z.string(),
69
79
  secondaryPhone: z.string().nullable(),
70
80
  email: z.string().nullable(),
@@ -77,6 +87,20 @@ export const centerSchema = z.object({
77
87
  createdAt: isoDateTimeSchema,
78
88
  updatedAt: isoDateTimeSchema,
79
89
  });
90
+ // ─── Center stats (owner detail header) ──────────────────────────────────────
91
+ /**
92
+ * The three-up header on a centre's detail screen.
93
+ *
94
+ * Computed, never stored — `activeMembers` counts live memberships and
95
+ * `monthlyRevenueInr` sums this month's successful payments, so the card can
96
+ * never drift from the ledger the way a denormalised total would. `capacity`
97
+ * is the one stored value, and is null until the owner fills it in.
98
+ */
99
+ export const centerStatsSchema = z.object({
100
+ capacity: z.number().int().nullable(),
101
+ activeMembers: z.number().int().nonnegative(),
102
+ monthlyRevenueInr: z.number().nonnegative(),
103
+ });
80
104
  // ─── Gym directory (member "find a gym") ─────────────────────────────────────
81
105
  /** A lightweight public directory result for the "find a gym" screen. */
82
106
  export const nearbyGymSchema = z.object({
@@ -124,7 +148,12 @@ export const gymSearchQuerySchema = z
124
148
  districtId: optionalTrimmedString(40),
125
149
  lat: z.coerce.number().min(-90).max(90).optional(),
126
150
  lng: z.coerce.number().min(-180).max(180).optional(),
127
- limit: z.coerce.number().int().min(1).max(GYM_SEARCH_MAX_RESULTS).default(GYM_SEARCH_MAX_RESULTS),
151
+ limit: z.coerce
152
+ .number()
153
+ .int()
154
+ .min(1)
155
+ .max(GYM_SEARCH_MAX_RESULTS)
156
+ .default(GYM_SEARCH_MAX_RESULTS),
128
157
  })
129
158
  .refine((v) => !v.q || Boolean(v.stateId), {
130
159
  message: 'Pick a state to search gyms by name',
@@ -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,EACL,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE/D,gFAAgF;AAEhF,yDAAyD;AACzD,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,KAAK;IACL,UAAU;IACV,MAAM;IACN,SAAS;IACT,OAAO;IACP,QAAQ;IACR,UAAU;IACV,KAAK;IACL,QAAQ;IACR,UAAU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D,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE;IACzC,OAAO,EAAE,qCAAqC;IAC9C,IAAI,EAAE,CAAC,SAAS,CAAC;CAClB,CAAC;KACD,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI,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","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 {\n isoDateTimeSchema,\n objectIdSchema,\n optionalEmailSchema,\n optionalPhoneSchema,\n optionalTrimmedString,\n phoneSchema,\n} from './common.js';\nimport { addressSchema, weeklyHoursSchema } from './shared.js';\n\n// ─── Center type ─────────────────────────────────────────────────────────────\n\n/** The activity types a center offers (multi-select). */\nexport const CENTER_TYPES = [\n 'gym',\n 'crossfit',\n 'yoga',\n 'pilates',\n 'zumba',\n 'cardio',\n 'strength',\n 'mma',\n 'boxing',\n 'swimming',\n 'aerobics',\n 'personal-training',\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/**\n * The public gym code a member enters at onboarding to join, `GYM-YYYY-NNN`.\n * Server-generated and unique; never accepted in a create body.\n */\nexport const gymCodeSchema = z\n .string()\n .trim()\n .regex(/^GYM-\\d{4}-\\d{3,}$/, 'Invalid gym code');\nexport type GymCode = z.infer<typeof gymCodeSchema>;\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 type'),\n address: addressSchema,\n /** Usable floor area in square feet. */\n floorAreaSqft: z.number().int().min(0).max(1_000_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});\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, `GYM-YYYY-NNN`. */\n code: gymCodeSchema,\n name: z.string(),\n description: z.string().nullable(),\n types: z.array(centerTypeSchema),\n address: addressSchema,\n floorAreaSqft: 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 createdAt: isoDateTimeSchema,\n updatedAt: isoDateTimeSchema,\n});\nexport type Center = z.infer<typeof centerSchema>;\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: gymCodeSchema,\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.number().int().min(1).max(GYM_SEARCH_MAX_RESULTS).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"]}
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,EACL,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE/D,gFAAgF;AAEhF,yDAAyD;AACzD,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,KAAK;IACL,UAAU;IACV,MAAM;IACN,SAAS;IACT,OAAO;IACP,QAAQ;IACR,UAAU;IACV,KAAK;IACL,QAAQ;IACR,UAAU;IACV,UAAU;IACV,mBAAmB;CACX,CAAC;AACX,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;AAGrD,gFAAgF;AAEhF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;AAGjE;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC;KAC3B,MAAM,EAAE;KAC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GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IACpD,KAAK,EAAE,CAAC,CAAC,MAAM;SACZ,MAAM,EAAE;SACR,GAAG,EAAE;SACL,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,sBAAsB,CAAC;SAC3B,OAAO,CAAC,sBAAsB,CAAC;CACnC,CAAC;KACD,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE;IACzC,OAAO,EAAE,qCAAqC;IAC9C,IAAI,EAAE,CAAC,SAAS,CAAC;CAClB,CAAC;KACD,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI,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","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 {\n isoDateTimeSchema,\n objectIdSchema,\n optionalEmailSchema,\n optionalPhoneSchema,\n optionalTrimmedString,\n phoneSchema,\n} from './common.js';\nimport { addressSchema, weeklyHoursSchema } from './shared.js';\n\n// ─── Center type ─────────────────────────────────────────────────────────────\n\n/** The activity types a center offers (multi-select). */\nexport const CENTER_TYPES = [\n 'gym',\n 'crossfit',\n 'yoga',\n 'pilates',\n 'zumba',\n 'cardio',\n 'strength',\n 'mma',\n 'boxing',\n 'swimming',\n 'aerobics',\n 'personal-training',\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/**\n * The public gym code a member enters at onboarding to join, `GYM-YYYY-NNN`.\n * Server-generated and unique; never accepted in a create body.\n */\nexport const gymCodeSchema = z\n .string()\n .trim()\n .regex(/^GYM-\\d{4}-\\d{3,}$/, 'Invalid gym code');\nexport type GymCode = z.infer<typeof gymCodeSchema>;\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 type'),\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});\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, `GYM-YYYY-NNN`. */\n code: gymCodeSchema,\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 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: gymCodeSchema,\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"]}
@@ -78,6 +78,55 @@ export declare const updateEquipmentBodySchema: z.ZodObject<{
78
78
  notes: z.ZodOptional<z.ZodPreprocess<z.ZodOptional<z.ZodString>>>;
79
79
  }, z.core.$strip>;
80
80
  export type UpdateEquipmentBody = z.infer<typeof updateEquipmentBodySchema>;
81
+ /**
82
+ * The equipment an owner can add by tapping, per category.
83
+ *
84
+ * A SHARED vocabulary, not a UI list: an owner who types "Treadmill" at one
85
+ * gym and "treadmill" at another produces two rows that never roll up, and the
86
+ * usage analytics that key off equipment name would split in half. The picker
87
+ * offers these; anything genuinely unusual is still addable as a free-text
88
+ * `custom` item, which is what that category is for.
89
+ */
90
+ export declare const EQUIPMENT_CATALOG: Record<EquipmentCategory, readonly string[]>;
91
+ /**
92
+ * Set a center's inventory for a set of items in one call.
93
+ *
94
+ * The add screen is a grid of steppers the owner nudges up and down, and it
95
+ * saves once at the end. Sending each nudge as its own create/update/delete
96
+ * would make a half-saved screen the normal outcome of a flaky connection, so
97
+ * the whole intent goes over as one idempotent statement: after this call,
98
+ * these items are at these quantities. A quantity of ZERO removes the item,
99
+ * which is how the stepper's "back to none" is expressed.
100
+ */
101
+ export declare const equipmentQuantityEntrySchema: z.ZodObject<{
102
+ category: z.ZodEnum<{
103
+ custom: "custom";
104
+ cardio: "cardio";
105
+ strength: "strength";
106
+ weight: "weight";
107
+ training: "training";
108
+ recovery: "recovery";
109
+ }>;
110
+ name: z.ZodString;
111
+ quantity: z.ZodNumber;
112
+ }, z.core.$strip>;
113
+ export type EquipmentQuantityEntry = z.infer<typeof equipmentQuantityEntrySchema>;
114
+ export declare const setEquipmentQuantitiesBodySchema: z.ZodObject<{
115
+ centerId: z.ZodString;
116
+ items: z.ZodArray<z.ZodObject<{
117
+ category: z.ZodEnum<{
118
+ custom: "custom";
119
+ cardio: "cardio";
120
+ strength: "strength";
121
+ weight: "weight";
122
+ training: "training";
123
+ recovery: "recovery";
124
+ }>;
125
+ name: z.ZodString;
126
+ quantity: z.ZodNumber;
127
+ }, z.core.$strip>>;
128
+ }, z.core.$strip>;
129
+ export type SetEquipmentQuantitiesBody = z.infer<typeof setEquipmentQuantitiesBodySchema>;
81
130
  export declare const equipmentQuerySchema: z.ZodObject<{
82
131
  centerId: z.ZodString;
83
132
  category: z.ZodOptional<z.ZodEnum<{
@@ -1 +1 @@
1
- {"version":3,"file":"equipment.d.ts","sourceRoot":"","sources":["../src/equipment.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,oBAAoB,6EAOvB,CAAC;AACX,eAAO,MAAM,uBAAuB;;;;;;;EAA+B,CAAC;AACpE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAIxE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;iBAS1B,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,4DAA4D;AAC5D,eAAO,MAAM,8BAA8B;;;;;;;;;;;iBAIzC,CAAC;AACH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAItF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;iBAMpC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,eAAO,MAAM,yBAAyB;;;;;;;;;;;;iBAE1B,CAAC;AACb,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAI5E,eAAO,MAAM,oBAAoB;;;;;;;;;;iBAG/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
1
+ {"version":3,"file":"equipment.d.ts","sourceRoot":"","sources":["../src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,eAAO,MAAM,oBAAoB;;;;;;;;;;iBAG/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
package/dist/equipment.js CHANGED
@@ -46,6 +46,66 @@ export const createEquipmentBodySchema = z.object({
46
46
  export const updateEquipmentBodySchema = createEquipmentBodySchema
47
47
  .omit({ centerId: true })
48
48
  .partial();
49
+ // ─── Catalog ─────────────────────────────────────────────────────────────────
50
+ /**
51
+ * The equipment an owner can add by tapping, per category.
52
+ *
53
+ * A SHARED vocabulary, not a UI list: an owner who types "Treadmill" at one
54
+ * gym and "treadmill" at another produces two rows that never roll up, and the
55
+ * usage analytics that key off equipment name would split in half. The picker
56
+ * offers these; anything genuinely unusual is still addable as a free-text
57
+ * `custom` item, which is what that category is for.
58
+ */
59
+ export const EQUIPMENT_CATALOG = {
60
+ cardio: [
61
+ 'Treadmill',
62
+ 'Elliptical',
63
+ 'Stationary Bike',
64
+ 'Rowing Machine',
65
+ 'Stair Climber',
66
+ 'Spin Bike',
67
+ ],
68
+ strength: [
69
+ 'Chest Press',
70
+ 'Lat Pulldown',
71
+ 'Leg Press',
72
+ 'Shoulder Press',
73
+ 'Cable Crossover',
74
+ 'Smith Machine',
75
+ 'Seated Row',
76
+ ],
77
+ weight: ['Dumbbells', 'Barbells', 'Weight Plates', 'Kettlebells', 'Bench Press', 'Squat Rack'],
78
+ training: [
79
+ 'Battle Ropes',
80
+ 'Plyo Box',
81
+ 'Medicine Ball',
82
+ 'TRX Straps',
83
+ 'Agility Ladder',
84
+ 'Punching Bag',
85
+ ],
86
+ recovery: ['Foam Roller', 'Massage Gun', 'Stretching Mat', 'Ice Bath', 'Sauna', 'Steam Room'],
87
+ custom: [],
88
+ };
89
+ // ─── Bulk quantity set (the "Add New Equipment" screen) ──────────────────────
90
+ /**
91
+ * Set a center's inventory for a set of items in one call.
92
+ *
93
+ * The add screen is a grid of steppers the owner nudges up and down, and it
94
+ * saves once at the end. Sending each nudge as its own create/update/delete
95
+ * would make a half-saved screen the normal outcome of a flaky connection, so
96
+ * the whole intent goes over as one idempotent statement: after this call,
97
+ * these items are at these quantities. A quantity of ZERO removes the item,
98
+ * which is how the stepper's "back to none" is expressed.
99
+ */
100
+ export const equipmentQuantityEntrySchema = z.object({
101
+ category: equipmentCategorySchema,
102
+ name: z.string().trim().min(1).max(120),
103
+ quantity: z.number().int().min(0).max(100000),
104
+ });
105
+ export const setEquipmentQuantitiesBodySchema = z.object({
106
+ centerId: objectIdSchema,
107
+ items: z.array(equipmentQuantityEntrySchema).min(1).max(200),
108
+ });
49
109
  // ─── List query ──────────────────────────────────────────────────────────────
50
110
  export const equipmentQuerySchema = z.object({
51
111
  centerId: objectIdSchema,
@@ -1 +1 @@
1
- {"version":3,"file":"equipment.js","sourceRoot":"","sources":["../src/equipment.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEvF,gFAAgF;AAEhF,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,QAAQ;IACR,UAAU;IACV,QAAQ;IACR,UAAU;IACV,UAAU;IACV,QAAQ;CACA,CAAC;AACX,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;AAGpE,gFAAgF;AAEhF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,EAAE,EAAE,cAAc;IAClB,QAAQ,EAAE,cAAc;IACxB,QAAQ,EAAE,uBAAuB;IACjC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IACxC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,SAAS,EAAE,iBAAiB;IAC5B,SAAS,EAAE,iBAAiB;CAC7B,CAAC,CAAC;AAGH,4DAA4D;AAC5D,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC,MAAM,CAAC;IACrD,QAAQ,EAAE,uBAAuB;IACjC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;CACtC,CAAC,CAAC;AAGH,gFAAgF;AAEhF,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,QAAQ,EAAE,cAAc;IACxB,QAAQ,EAAE,uBAAuB;IACjC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IAC3D,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IACxD,KAAK,EAAE,qBAAqB,CAAC,GAAG,CAAC;CAClC,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,yBAAyB,GAAG,yBAAyB;KAC/D,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;KACxB,OAAO,EAAE,CAAC;AAGb,gFAAgF;AAEhF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,QAAQ,EAAE,cAAc;IACxB,QAAQ,EAAE,uBAAuB,CAAC,QAAQ,EAAE;CAC7C,CAAC,CAAC","sourcesContent":["/**\n * gymmonk-schema — Equipment\n * ==========================\n * A center's equipment inventory. The owner UI groups items by category and\n * shows per-category counts; the entity is a per-item record scoped to a center.\n *\n * @module gymmonk-schema/equipment\n */\n\nimport { z } from 'zod';\nimport { isoDateTimeSchema, objectIdSchema, optionalTrimmedString } from './common.js';\n\n// ─── Category ────────────────────────────────────────────────────────────────\n\nexport const EQUIPMENT_CATEGORIES = [\n 'cardio',\n 'strength',\n 'weight',\n 'training',\n 'recovery',\n 'custom',\n] as const;\nexport const equipmentCategorySchema = z.enum(EQUIPMENT_CATEGORIES);\nexport type EquipmentCategory = z.infer<typeof equipmentCategorySchema>;\n\n// ─── Entity ──────────────────────────────────────────────────────────────────\n\nexport const equipmentSchema = z.object({\n id: objectIdSchema,\n centerId: objectIdSchema,\n category: equipmentCategorySchema,\n name: z.string(),\n quantity: z.number().int().nonnegative(),\n notes: z.string().nullable(),\n createdAt: isoDateTimeSchema,\n updatedAt: isoDateTimeSchema,\n});\nexport type Equipment = z.infer<typeof equipmentSchema>;\n\n/** Per-category rollup the owner equipment list renders. */\nexport const equipmentCategorySummarySchema = z.object({\n category: equipmentCategorySchema,\n label: z.string(),\n count: z.number().int().nonnegative(),\n});\nexport type EquipmentCategorySummary = z.infer<typeof equipmentCategorySummarySchema>;\n\n// ─── Create / update body ────────────────────────────────────────────────────\n\nexport const createEquipmentBodySchema = z.object({\n centerId: objectIdSchema,\n category: equipmentCategorySchema,\n name: z.string().trim().min(1, 'Name is required').max(120),\n quantity: z.number().int().min(1).max(100000).default(1),\n notes: optionalTrimmedString(500),\n});\nexport type CreateEquipmentBody = z.infer<typeof createEquipmentBodySchema>;\n\nexport const updateEquipmentBodySchema = createEquipmentBodySchema\n .omit({ centerId: true })\n .partial();\nexport type UpdateEquipmentBody = z.infer<typeof updateEquipmentBodySchema>;\n\n// ─── List query ──────────────────────────────────────────────────────────────\n\nexport const equipmentQuerySchema = z.object({\n centerId: objectIdSchema,\n category: equipmentCategorySchema.optional(),\n});\nexport type EquipmentQuery = z.infer<typeof equipmentQuerySchema>;\n"]}
1
+ {"version":3,"file":"equipment.js","sourceRoot":"","sources":["../src/equipment.ts"],"names":[],"mappings":"AAAA;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CAAC;IACvC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC;CAC9C,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC,MAAM,CAAC;IACvD,QAAQ,EAAE,cAAc;IACxB,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;CAC7D,CAAC,CAAC;AAGH,gFAAgF;AAEhF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,QAAQ,EAAE,cAAc;IACxB,QAAQ,EAAE,uBAAuB,CAAC,QAAQ,EAAE;CAC7C,CAAC,CAAC","sourcesContent":["/**\n * gymmonk-schema — Equipment\n * ==========================\n * A center's equipment inventory. The owner UI groups items by category and\n * shows per-category counts; the entity is a per-item record scoped to a center.\n *\n * @module gymmonk-schema/equipment\n */\n\nimport { z } from 'zod';\nimport { isoDateTimeSchema, objectIdSchema, optionalTrimmedString } from './common.js';\n\n// ─── Category ────────────────────────────────────────────────────────────────\n\nexport const EQUIPMENT_CATEGORIES = [\n 'cardio',\n 'strength',\n 'weight',\n 'training',\n 'recovery',\n 'custom',\n] as const;\nexport const equipmentCategorySchema = z.enum(EQUIPMENT_CATEGORIES);\nexport type EquipmentCategory = z.infer<typeof equipmentCategorySchema>;\n\n// ─── Entity ──────────────────────────────────────────────────────────────────\n\nexport const equipmentSchema = z.object({\n id: objectIdSchema,\n centerId: objectIdSchema,\n category: equipmentCategorySchema,\n name: z.string(),\n quantity: z.number().int().nonnegative(),\n notes: z.string().nullable(),\n createdAt: isoDateTimeSchema,\n updatedAt: isoDateTimeSchema,\n});\nexport type Equipment = z.infer<typeof equipmentSchema>;\n\n/** Per-category rollup the owner equipment list renders. */\nexport const equipmentCategorySummarySchema = z.object({\n category: equipmentCategorySchema,\n label: z.string(),\n count: z.number().int().nonnegative(),\n});\nexport type EquipmentCategorySummary = z.infer<typeof equipmentCategorySummarySchema>;\n\n// ─── Create / update body ────────────────────────────────────────────────────\n\nexport const createEquipmentBodySchema = z.object({\n centerId: objectIdSchema,\n category: equipmentCategorySchema,\n name: z.string().trim().min(1, 'Name is required').max(120),\n quantity: z.number().int().min(1).max(100000).default(1),\n notes: optionalTrimmedString(500),\n});\nexport type CreateEquipmentBody = z.infer<typeof createEquipmentBodySchema>;\n\nexport const updateEquipmentBodySchema = createEquipmentBodySchema\n .omit({ centerId: true })\n .partial();\nexport type UpdateEquipmentBody = z.infer<typeof updateEquipmentBodySchema>;\n\n// ─── Catalog ─────────────────────────────────────────────────────────────────\n\n/**\n * The equipment an owner can add by tapping, per category.\n *\n * A SHARED vocabulary, not a UI list: an owner who types \"Treadmill\" at one\n * gym and \"treadmill\" at another produces two rows that never roll up, and the\n * usage analytics that key off equipment name would split in half. The picker\n * offers these; anything genuinely unusual is still addable as a free-text\n * `custom` item, which is what that category is for.\n */\nexport const EQUIPMENT_CATALOG: Record<EquipmentCategory, readonly string[]> = {\n cardio: [\n 'Treadmill',\n 'Elliptical',\n 'Stationary Bike',\n 'Rowing Machine',\n 'Stair Climber',\n 'Spin Bike',\n ],\n strength: [\n 'Chest Press',\n 'Lat Pulldown',\n 'Leg Press',\n 'Shoulder Press',\n 'Cable Crossover',\n 'Smith Machine',\n 'Seated Row',\n ],\n weight: ['Dumbbells', 'Barbells', 'Weight Plates', 'Kettlebells', 'Bench Press', 'Squat Rack'],\n training: [\n 'Battle Ropes',\n 'Plyo Box',\n 'Medicine Ball',\n 'TRX Straps',\n 'Agility Ladder',\n 'Punching Bag',\n ],\n recovery: ['Foam Roller', 'Massage Gun', 'Stretching Mat', 'Ice Bath', 'Sauna', 'Steam Room'],\n custom: [],\n};\n\n// ─── Bulk quantity set (the \"Add New Equipment\" screen) ──────────────────────\n\n/**\n * Set a center's inventory for a set of items in one call.\n *\n * The add screen is a grid of steppers the owner nudges up and down, and it\n * saves once at the end. Sending each nudge as its own create/update/delete\n * would make a half-saved screen the normal outcome of a flaky connection, so\n * the whole intent goes over as one idempotent statement: after this call,\n * these items are at these quantities. A quantity of ZERO removes the item,\n * which is how the stepper's \"back to none\" is expressed.\n */\nexport const equipmentQuantityEntrySchema = z.object({\n category: equipmentCategorySchema,\n name: z.string().trim().min(1).max(120),\n quantity: z.number().int().min(0).max(100000),\n});\nexport type EquipmentQuantityEntry = z.infer<typeof equipmentQuantityEntrySchema>;\n\nexport const setEquipmentQuantitiesBodySchema = z.object({\n centerId: objectIdSchema,\n items: z.array(equipmentQuantityEntrySchema).min(1).max(200),\n});\nexport type SetEquipmentQuantitiesBody = z.infer<typeof setEquipmentQuantitiesBodySchema>;\n\n// ─── List query ──────────────────────────────────────────────────────────────\n\nexport const equipmentQuerySchema = z.object({\n centerId: objectIdSchema,\n category: equipmentCategorySchema.optional(),\n});\nexport type EquipmentQuery = z.infer<typeof equipmentQuerySchema>;\n"]}
@@ -71,6 +71,7 @@ export declare const gymRegistrationBodySchema: z.ZodObject<{
71
71
  }, z.core.$strip>;
72
72
  gstNumber: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
73
73
  registrationNumber: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
74
+ email: z.ZodPreprocess<z.ZodOptional<z.ZodEmail>>;
74
75
  website: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
75
76
  socials: z.ZodObject<{
76
77
  jansathi: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
@@ -135,6 +136,7 @@ export declare const gymRegistrationBodySchema: z.ZodObject<{
135
136
  }, z.core.$strip>>;
136
137
  }, z.core.$strip>;
137
138
  floorAreaSqft: z.ZodOptional<z.ZodNumber>;
139
+ capacity: z.ZodOptional<z.ZodNumber>;
138
140
  primaryPhone: z.ZodString;
139
141
  secondaryPhone: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
140
142
  email: z.ZodPreprocess<z.ZodOptional<z.ZodEmail>>;
@@ -1 +1 @@
1
- {"version":3,"file":"gym-registration.d.ts","sourceRoot":"","sources":["../src/gym-registration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,sEAAsE;AACtE,eAAO,MAAM,sBAAsB;;;iBAGjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAIpC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
1
+ {"version":3,"file":"gym-registration.d.ts","sourceRoot":"","sources":["../src/gym-registration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,sEAAsE;AACtE,eAAO,MAAM,sBAAsB;;;iBAGjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAIpC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
@@ -75,6 +75,12 @@ export declare const SUCCESS_MESSAGE: {
75
75
  readonly membershipPlanCreated: {
76
76
  readonly title: "Membership plan created";
77
77
  };
78
+ readonly membershipPlanUpdated: {
79
+ readonly title: "Membership plan updated";
80
+ };
81
+ readonly equipmentSaved: {
82
+ readonly title: "Equipment updated";
83
+ };
78
84
  readonly membershipUpdated: {
79
85
  readonly title: "Membership updated";
80
86
  };
@@ -199,6 +205,8 @@ export declare const ERROR_MESSAGE: {
199
205
  /** A step failed to persist — the user stays put so nothing is lost. */
200
206
  readonly onboardingStepSaveFailed: "We could not save this step. Please try again.";
201
207
  readonly centerRequiredForPlan: "Pick the center this plan belongs to.";
208
+ readonly planTierTaken: "This center already has a plan on that tier. Pick another tier.";
209
+ readonly planVariantRequired: "Add at least one pricing variant before saving the plan.";
202
210
  readonly centerAddressRequired: "Add the center address before creating it.";
203
211
  readonly noCenterForPlans: "No gym center found. Add a center before creating plans.";
204
212
  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;;;;GAIG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;CAwBb,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAIrE,wEAAwE;AACxE,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAID;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;;;;IAI1B,sEAAsE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AID;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;;;;IAI1B,sEAAsE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiFtB,CAAC;AAEnD,MAAM,MAAM,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;CAGxC,CAAC;AAIX;;;;GAIG;AACH,eAAO,MAAM,aAAa;;;;;;;;IAexB,4EAA4E;;IAE5E,+EAA+E;;IAE/E,gFAAgF;;IAGhF,iDAAiD;;;IAGjD,2EAA2E;;IAE3E,wEAAwE;;;;;;;;;;;IAexE,2EAA2E;;;;;;IAW3E,wEAAwE;;IAExE,uEAAuE;;IAEvE,yEAAyE;;IAEzE,8EAA8E;;IAE9E,0DAA0D;;;IAK1D,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
@@ -61,6 +61,8 @@ export const SUCCESS_MESSAGE = {
61
61
  centerAdded: { title: 'Center added' },
62
62
  centerUpdated: { title: 'Center updated' },
63
63
  membershipPlanCreated: { title: 'Membership plan created' },
64
+ membershipPlanUpdated: { title: 'Membership plan updated' },
65
+ equipmentSaved: { title: 'Equipment updated' },
64
66
  // Membership (member-side)
65
67
  membershipUpdated: { title: 'Membership updated' },
66
68
  membershipRenewed: { title: 'Membership renewed' },
@@ -173,6 +175,8 @@ export const ERROR_MESSAGE = {
173
175
  onboardingStepSaveFailed: 'We could not save this step. Please try again.',
174
176
  // Gym structure prerequisites
175
177
  centerRequiredForPlan: 'Pick the center this plan belongs to.',
178
+ planTierTaken: 'This center already has a plan on that tier. Pick another tier.',
179
+ planVariantRequired: 'Add at least one pricing variant before saving the plan.',
176
180
  centerAddressRequired: 'Add the center address before creating it.',
177
181
  noCenterForPlans: 'No gym center found. Add a center before creating plans.',
178
182
  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;IAC5B,mBAAmB,EAAE,qBAAqB;IAE1C,oCAAoC;IACpC,mBAAmB,EAAE,qBAAqB;CAClC,CAAC;AAYX,gFAAgF;AAEhF;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,aAAa;IACb,wBAAwB,EAAE,EAAE,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,qBAAqB,EAAE;IACzF,uB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E,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: { title: \"You're all set\", description: 'Welcome to GymMonk.' },\n ownerOnboardingComplete: { title: 'Your gym is ready', description: 'Welcome to GymMonk.' },\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\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 workoutCreated: { title: 'Workout created' },\n workoutPlanAssigned: { title: 'Workout plan assigned' },\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 // 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: { title: 'Feedback sent', description: 'Thank you for helping us improve.' },\n complaintSubmitted: { title: 'Complaint submitted', description: 'Your gym will look into it.' },\n announcementSent: { title: 'Announcement sent' },\n announcementScheduled: { title: 'Announcement scheduled' },\n announcementDraftSaved: { title: 'Draft saved' },\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} 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} 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 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 /** 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 /** 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 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\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 // Training\n workoutPlanRequired: 'Choose a plan to assign',\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 // ── 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,mBAAmB,EAAE,qBAAqB;IAE1C,oCAAoC;IACpC,mBAAmB,EAAE,qBAAqB;CAClC,CAAC;AAYX,gFAAgF;AAEhF;;;GAGG;AACH,MAAM,CAAC,MAA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yC;IACjE,sBAAsB,EAAE,oCAAoC;IAE5D,6BAA6B;IAC7B,aAAa,EAAE,gBAAgB;IAC/B,gBAAgB,EAAE,6BAA6B;IAC/C,aAAa,EAAE,mCAAmC;IAClD,YAAY,EAAE,gCAAgC;IAC9C,mBAAmB,EAAE,0CAA0C;IAC/D,eAAe,EAAE,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: { title: \"You're all set\", description: 'Welcome to GymMonk.' },\n ownerOnboardingComplete: { title: 'Your gym is ready', description: 'Welcome to GymMonk.' },\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 workoutCreated: { title: 'Workout created' },\n workoutPlanAssigned: { title: 'Workout plan assigned' },\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 // 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: { title: 'Feedback sent', description: 'Thank you for helping us improve.' },\n complaintSubmitted: { title: 'Complaint submitted', description: 'Your gym will look into it.' },\n announcementSent: { title: 'Announcement sent' },\n announcementScheduled: { title: 'Announcement scheduled' },\n announcementDraftSaved: { title: 'Draft saved' },\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} 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} 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 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 /** 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 /** 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 planTierTaken: 'This center already has a plan on that tier. Pick another tier.',\n planVariantRequired: 'Add at least one pricing variant before saving the plan.',\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\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 // Training\n workoutPlanRequired: 'Choose a plan to assign',\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 // ── 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 +1 @@
1
- {"version":3,"file":"onboarding-form.d.ts","sourceRoot":"","sources":["../src/onboarding-form.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,KAAK,O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;IAChB,WAAW,EAAE,EAAE;IACf,KAAK,EAAE,eAAe,CAAC,wBAAwB,CAAC;IAChD,MAAM,EAAE,EAAE;IACV,MAAM,EAAE,IAAI;IACZ,QAAQ,EAAE,IAAI;CACf,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAE7B;IACJ;QACE,GAAG,EAAE,cAAc;QACnB,KAAK,EAAE,mBAAmB;QAC1B,QAAQ,EAAE,+CAA+C;QACzD,MAAM,EAAE,CAAC,SAAS,EAAE,WAAW,EAAE,iBAAiB,CAAC;KACpD;IACD;QACE,GAAG,EAAE,QAAQ;QACb,KAAK,EAAE,mBAAmB;QAC1B,QAAQ,EAAE,qDAAqD;QAC/D,MAAM,EAAE;YACN,YAAY;YACZ,aAAa;YACb,eAAe;YACf,cAAc;YACd,cAAc;YACd,aAAa;SACd;KACF;IACD;QACE,GAAG,EAAE,MAAM;QACX,KAAK,EAAE,kBAAkB;QACzB,QAAQ,EAAE,mCAAmC;QAC7C,MAAM,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC;KAC/B;CACO,CAAC;AAEX,MAAM,CAAC,MAAM,4BAA4B,GAAG,sBAAsB,CAAC,MAAM,CAAC;AAE1E;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GACvC,sBAAsB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC","sourcesContent":["/**\n * gymmonk-schema — Onboarding & gym-registration FORM schemas\n * ===========================================================\n * The client-side validation contract for the member onboarding wizard and the\n * \"list your gym\" wizard.\n *\n * Why these live here and are distinct from the `*OnboardingBody` API schemas:\n * a half-filled form legitimately holds `null` for a choice the user has not\n * made yet, whereas the API body only ever sees completed values. So these are\n * the SAME rules expressed over the form's working shape — every message,\n * regex and bound is defined once, here, and both sides agree on it.\n *\n * Everything reuses the primitives in `shared.ts` / `common.ts`\n * (`INDIAN_STATES`, `CENTER_TYPES`, `WEEKDAYS`, phone/pincode rules) rather\n * than restating them.\n *\n * @module gymmonk-schema/onboarding-form\n */\n\nimport { z } from 'zod';\nimport { ageInYears, isRealDate, PHONE_REGEX } from './common.js';\nimport type { WEEKDAYS } from './shared.js';\nimport { type Address, addressSchema } from './shared.js';\n\n// ─── Field-level rules (shared by both wizards) ──────────────────────────────\n\n/** A required 10-digit Indian mobile, as typed into a form field. */\nconst formPhone = z.string().regex(PHONE_REGEX, 'Enter a valid 10-digit mobile number');\n\n/** An optional phone: blank is allowed, anything else must be valid. */\nconst optionalFormPhone = z\n .string()\n .refine((v) => v === '' || PHONE_REGEX.test(v), 'Enter a valid 10-digit mobile number');\n\n/** An optional email: blank is allowed, anything else must look like an email. */\nconst optionalFormEmail = z\n .string()\n .refine((v) => v === '' || /^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$/.test(v), {\n message: 'Enter a valid email',\n });\n\n/** A choice the user has not made yet is `null` until they pick one. */\nconst requiredChoice = <T extends z.ZodTypeAny>(inner: T, message: string) =>\n inner.nullable().refine((v: unknown) => v !== null, { message });\n\n// ─── Address (form shape: one atomic value, null until picked) ────────────\n\n/**\n * An address inside an onboarding form is ONE cell, not four.\n *\n * It used to be `street` + `city` + `state` + `pincode`, each independently\n * fillable, which is why this module needed rules for a half-filled address.\n * Now it is picked through the location drawer, which either hands back a\n * complete `Address` — area chain, ids, names, ancestry, coordinates — or\n * nothing at all. So there is no partial state left to validate, and `null`\n * simply means \"not chosen yet\".\n */\nexport const onboardingAddressSchema = requiredChoice(addressSchema, 'Add your address');\n\n/** Working shape of an address inside an onboarding form. */\nexport type OnboardingAddress = Address | null;\n\n/** An address has been picked. */\nexport function isOnboardingAddressComplete(a: OnboardingAddress): boolean {\n return a !== null;\n}\n\n// ─── Social links (form shape: every handle is a plain string) ───────────────\n\nexport const onboardingSocialLinksSchema = z.object({\n jansathi: z.string(),\n youtube: z.string(),\n instagram: z.string(),\n facebook: z.string(),\n});\nexport type OnboardingSocialLinks = z.infer<typeof onboardingSocialLinksSchema>;\n\n// ─── Opening hours (form shape) ─────────────────────────────────────────────\n\nexport const onboardingDayHoursSchema = z.object({\n open: z.boolean(),\n from: z.string(),\n to: z.string(),\n});\nexport type OnboardingDayHours = z.infer<typeof onboardingDayHoursSchema>;\nexport type OnboardingWeeklyHours = Record<(typeof WEEKDAYS)[number], OnboardingDayHours>;\n\n// ─── Member onboarding form ─────────────────────────────────────────────────\n\n/** Age bounds a gym membership realistically spans. */\nexport const MEMBER_MIN_AGE_YEARS = 10;\nexport const MEMBER_MAX_AGE_YEARS = 100;\n\nexport const memberOnboardingFormSchema = z\n .object({\n firstName: z.string().trim().min(1, 'First name is required'),\n lastName: z.string().trim(),\n dobDay: z.string().min(1, 'Enter the day'),\n dobMonth: z.string().min(1, 'Enter the month'),\n dobYear: z.string().length(4, 'Enter a 4-digit year'),\n gender: requiredChoice(z.enum(['male', 'female', 'other']), 'Select your gender'),\n heightCm: requiredChoice(z.number(), 'Add your height'),\n weightKg: requiredChoice(z.number(), 'Add your weight'),\n neckCm: requiredChoice(z.number(), 'Add your neck'),\n waistCm: requiredChoice(z.number(), 'Add your waist'),\n hipsCm: z.number().nullable(),\n phone: formPhone,\n emergencyName: z.string().trim().min(1, 'Add an emergency contact name'),\n emergencyPhone: formPhone,\n bloodGroup: requiredChoice(z.string(), 'Select your blood group'),\n /** GCS URL of the uploaded photo. Optional — it can be added later. */\n avatarUrl: z.string(),\n })\n /**\n * The three DOB cells are individually bounded by the input, but only the\n * assembled date can catch an impossible one (31 Feb) or an implausible age.\n * The issue is attached to `dobDay` so it renders under the field group.\n */\n .superRefine((v, ctx) => {\n if (!v.dobDay || !v.dobMonth || v.dobYear.length !== 4) return;\n\n const day = Number(v.dobDay);\n const month = Number(v.dobMonth);\n const year = Number(v.dobYear);\n\n if (!isRealDate(year, month, day)) {\n ctx.addIssue({ code: 'custom', path: ['dobDay'], message: 'That date does not exist' });\n return;\n }\n\n const age = ageInYears(year, month, day);\n if (age < MEMBER_MIN_AGE_YEARS) {\n ctx.addIssue({\n code: 'custom',\n path: ['dobDay'],\n message: `You must be at least ${MEMBER_MIN_AGE_YEARS} to join`,\n });\n } else if (age > MEMBER_MAX_AGE_YEARS) {\n ctx.addIssue({ code: 'custom', path: ['dobDay'], message: 'Check the year of birth' });\n }\n })\n /**\n * The API requires the hips measurement for female members (needed for the\n * body-fat estimate), so it fails inline on the measurements step instead of\n * 422-ing at Finish. Own refine — no early-return coupling with the DOB rule.\n */\n .superRefine((v, ctx) => {\n if (v.gender === 'female' && v.hipsCm == null) {\n ctx.addIssue({ code: 'custom', path: ['hipsCm'], message: 'Hips measurement is required' });\n }\n });\n\n/**\n * The form's working shape. Hand-written (not `z.infer`) so unset numeric /\n * choice fields can hold `null` while the schema's `requiredChoice` rules still\n * drive the field errors — the resolver is cast to this type at `useForm`.\n */\nexport type MemberOnboardingForm = {\n firstName: string;\n lastName: string;\n dobDay: string;\n dobMonth: string;\n dobYear: string;\n gender: 'male' | 'female' | 'other' | null;\n heightCm: number | null;\n weightKg: number | null;\n neckCm: number | null;\n waistCm: number | null;\n hipsCm: number | null;\n phone: string;\n emergencyName: string;\n emergencyPhone: string;\n bloodGroup: string | null;\n avatarUrl: string;\n};\n\nexport const EMPTY_MEMBER_ONBOARDING_FORM: MemberOnboardingForm = {\n firstName: '',\n lastName: '',\n dobDay: '',\n dobMonth: '',\n dobYear: '',\n gender: null,\n heightCm: null,\n weightKg: null,\n neckCm: null,\n waistCm: null,\n hipsCm: null,\n phone: '',\n emergencyName: '',\n emergencyPhone: '',\n bloodGroup: null,\n avatarUrl: '',\n};\n\n/**\n * One onboarding step, described ONCE.\n *\n * The wizard chrome (screen name, help line, progress denominator) and the\n * validation gate used to live in the page as a local `META` array beside a\n * separate field map — two lists that had to be kept the same length by hand.\n * They are one list here, so a step cannot exist without a title or be left\n * without a validation gate.\n */\nexport interface OnboardingStepConfig<TField extends string> {\n /** Stable identifier — safe for analytics and resume, unlike the index. */\n key: string;\n /** Screen name in the step header. */\n title: string;\n /** Help line under the screen name. */\n helpText: string;\n /**\n * Fields validated before this step may be left. Naming a parent path (e.g.\n * `address`) validates its nested fields too.\n */\n fields: readonly TField[];\n}\n\nexport const MEMBER_ONBOARDING_STEPS: readonly OnboardingStepConfig<\n keyof MemberOnboardingForm & string\n>[] = [\n {\n key: 'basics',\n title: 'Basic information',\n helpText: \"Enter your details, we'll need these to set things up.\",\n fields: ['firstName', 'dobDay', 'dobMonth', 'dobYear', 'gender'],\n },\n {\n key: 'body-metrics',\n title: 'Personal details',\n helpText: 'Your height and weight, to calculate your BMI.',\n fields: ['heightCm', 'weightKg'],\n },\n {\n key: 'body-composition',\n title: 'Personal details',\n helpText: 'A few measurements, to estimate your body fat.',\n fields: ['neckCm', 'waistCm', 'hipsCm'],\n },\n {\n key: 'emergency',\n title: 'Emergency info',\n helpText: 'In case something happens during training.',\n fields: ['phone', 'emergencyName', 'emergencyPhone', 'bloodGroup'],\n },\n] as const;\n\nexport const MEMBER_ONBOARDING_TOTAL_STEPS = MEMBER_ONBOARDING_STEPS.length;\n\n/**\n * Fields validated before advancing each member step.\n * DERIVED from `MEMBER_ONBOARDING_STEPS` so the two can never disagree.\n */\nexport const MEMBER_STEP_FIELDS: (keyof MemberOnboardingForm)[][] = MEMBER_ONBOARDING_STEPS.map(\n (s) => [...s.fields],\n);\n\n\n// ─── Gym registration form (\"list your gym\") ────────────────────────────────\n\n/**\n * The gym-registration wizard's working shape.\n *\n * THREE steps, not five. The two it used to open with — \"your details\" and\n * \"contact details\" — asked a signed-in member for their name, gender, date of\n * birth and phone, every one of which onboarding already captured. Registering\n * a business asks about the BUSINESS; the person is already known.\n */\nexport const gymRegistrationFormSchema = z.object({\n // 1 — organisation\n orgName: z.string().trim().min(1, 'Organisation name is required'),\n orgDescription: z.string(),\n hqAddress: onboardingAddressSchema,\n orgWebsite: z.string(),\n gstNumber: z.string(),\n cinNumber: z.string(),\n numberOfCenters: requiredChoice(z.number(), 'Add the number of centers'),\n orgSocials: onboardingSocialLinksSchema,\n // 2 — center\n centerName: z.string().trim().min(1, 'Center name is required'),\n centerDescription: z.string(),\n centerTypes: z.array(z.string()).min(1, 'Pick at least one type'),\n centerAddress: onboardingAddressSchema,\n floorArea: z.number().nullable(),\n centerPhone1: formPhone,\n centerPhone2: optionalFormPhone,\n centerEmail: optionalFormEmail,\n hours: z.object({\n mon: onboardingDayHoursSchema,\n tue: onboardingDayHoursSchema,\n wed: onboardingDayHoursSchema,\n thu: onboardingDayHoursSchema,\n fri: onboardingDayHoursSchema,\n sat: onboardingDayHoursSchema,\n sun: onboardingDayHoursSchema,\n }),\n photos: z.array(z.string()),\n // 3 — plan\n planId: requiredChoice(z.string(), 'Choose a plan'),\n tenureId: z.string().nullable(),\n});\n\n/** Hand-written working shape (nullable \"unset\" fields); see the member form. */\nexport type GymRegistrationForm = {\n orgName: string;\n orgDescription: string;\n hqAddress: OnboardingAddress;\n orgWebsite: string;\n gstNumber: string;\n cinNumber: string;\n numberOfCenters: number | null;\n orgSocials: OnboardingSocialLinks;\n centerName: string;\n centerDescription: string;\n centerTypes: string[];\n centerAddress: OnboardingAddress;\n floorArea: number | null;\n centerPhone1: string;\n centerPhone2: string;\n centerEmail: string;\n hours: OnboardingWeeklyHours;\n photos: string[];\n planId: string | null;\n tenureId: string | null;\n};\n\nconst EMPTY_ONBOARDING_SOCIALS: OnboardingSocialLinks = {\n jansathi: '',\n youtube: '',\n instagram: '',\n facebook: '',\n};\n\n/** The opening hours a new center starts with. */\nexport const DEFAULT_ONBOARDING_HOURS: OnboardingWeeklyHours = {\n mon: { open: true, from: '06:00', to: '22:00' },\n tue: { open: true, from: '06:00', to: '22:00' },\n wed: { open: true, from: '06:00', to: '22:00' },\n thu: { open: true, from: '06:00', to: '22:00' },\n fri: { open: true, from: '06:00', to: '22:00' },\n sat: { open: true, from: '07:00', to: '21:00' },\n sun: { open: false, from: '07:00', to: '13:00' },\n};\n\nexport const EMPTY_GYM_REGISTRATION_FORM: GymRegistrationForm = {\n orgName: '',\n orgDescription: '',\n hqAddress: null,\n orgWebsite: '',\n gstNumber: '',\n cinNumber: '',\n numberOfCenters: null,\n orgSocials: { ...EMPTY_ONBOARDING_SOCIALS },\n centerName: '',\n centerDescription: '',\n centerTypes: [],\n centerAddress: null,\n floorArea: null,\n centerPhone1: '',\n centerPhone2: '',\n centerEmail: '',\n hours: structuredClone(DEFAULT_ONBOARDING_HOURS),\n photos: [],\n planId: null,\n tenureId: null,\n};\n\n/**\n * The gym-registration wizard, described once.\n *\n * The last step is the pricing screen, which renders its own header; its title\n * and help line are unused by the wizard chrome but kept so every step has one.\n */\nexport const GYM_REGISTRATION_STEPS: readonly OnboardingStepConfig<\n keyof GymRegistrationForm & string\n>[] = [\n {\n key: 'organisation',\n title: 'Your organisation',\n helpText: 'Tell us about the business that runs the gym.',\n fields: ['orgName', 'hqAddress', 'numberOfCenters'],\n },\n {\n key: 'center',\n title: 'Your first center',\n helpText: 'Set up your primary center. You can add more later.',\n fields: [\n 'centerName',\n 'centerTypes',\n 'centerAddress',\n 'centerPhone1',\n 'centerPhone2',\n 'centerEmail',\n ],\n },\n {\n key: 'plan',\n title: 'Choose your plan',\n helpText: 'Pick the plan that fits your gym.',\n fields: ['planId', 'tenureId'],\n },\n] as const;\n\nexport const GYM_REGISTRATION_TOTAL_STEPS = GYM_REGISTRATION_STEPS.length;\n\n/**\n * Fields validated (via `form.trigger`) before advancing each step.\n * DERIVED from `GYM_REGISTRATION_STEPS` so the two can never disagree.\n */\nexport const GYM_REGISTRATION_STEP_FIELDS: (keyof GymRegistrationForm)[][] =\n GYM_REGISTRATION_STEPS.map((s) => [...s.fields]);\n"]}
1
+ {"version":3,"file":"onboarding-form.js","sourceRoot":"","sources":["../src/onboarding-form.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,W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I;IACZ,QAAQ,EAAE,IAAI;CACf,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAE7B;IACJ;QACE,GAAG,EAAE,cAAc;QACnB,KAAK,EAAE,mBAAmB;QAC1B,QAAQ,EAAE,+CAA+C;QACzD,MAAM,EAAE,CAAC,SAAS,EAAE,WAAW,EAAE,iBAAiB,CAAC;KACpD;IACD;QACE,GAAG,EAAE,QAAQ;QACb,KAAK,EAAE,mBAAmB;QAC1B,QAAQ,EAAE,qDAAqD;QAC/D,MAAM,EAAE;YACN,YAAY;YACZ,aAAa;YACb,eAAe;YACf,cAAc;YACd,cAAc;YACd,aAAa;SACd;KACF;IACD;QACE,GAAG,EAAE,MAAM;QACX,KAAK,EAAE,kBAAkB;QACzB,QAAQ,EAAE,mCAAmC;QAC7C,MAAM,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC;KAC/B;CACO,CAAC;AAEX,MAAM,CAAC,MAAM,4BAA4B,GAAG,sBAAsB,CAAC,MAAM,CAAC;AAE1E;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GACvC,sBAAsB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC","sourcesContent":["/**\n * gymmonk-schema — Onboarding & gym-registration FORM schemas\n * ===========================================================\n * The client-side validation contract for the member onboarding wizard and the\n * \"list your gym\" wizard.\n *\n * Why these live here and are distinct from the `*OnboardingBody` API schemas:\n * a half-filled form legitimately holds `null` for a choice the user has not\n * made yet, whereas the API body only ever sees completed values. So these are\n * the SAME rules expressed over the form's working shape — every message,\n * regex and bound is defined once, here, and both sides agree on it.\n *\n * Everything reuses the primitives in `shared.ts` / `common.ts`\n * (`INDIAN_STATES`, `CENTER_TYPES`, `WEEKDAYS`, phone/pincode rules) rather\n * than restating them.\n *\n * @module gymmonk-schema/onboarding-form\n */\n\nimport { z } from 'zod';\nimport { ageInYears, isRealDate, PHONE_REGEX } from './common.js';\nimport type { WEEKDAYS } from './shared.js';\nimport { type Address, addressSchema } from './shared.js';\n\n// ─── Field-level rules (shared by both wizards) ──────────────────────────────\n\n/** A required 10-digit Indian mobile, as typed into a form field. */\nconst formPhone = z.string().regex(PHONE_REGEX, 'Enter a valid 10-digit mobile number');\n\n/** An optional phone: blank is allowed, anything else must be valid. */\nconst optionalFormPhone = z\n .string()\n .refine((v) => v === '' || PHONE_REGEX.test(v), 'Enter a valid 10-digit mobile number');\n\n/** An optional email: blank is allowed, anything else must look like an email. */\nconst optionalFormEmail = z\n .string()\n .refine((v) => v === '' || /^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$/.test(v), {\n message: 'Enter a valid email',\n });\n\n/** A choice the user has not made yet is `null` until they pick one. */\nconst requiredChoice = <T extends z.ZodTypeAny>(inner: T, message: string) =>\n inner.nullable().refine((v: unknown) => v !== null, { message });\n\n// ─── Address (form shape: one atomic value, null until picked) ────────────\n\n/**\n * An address inside an onboarding form is ONE cell, not four.\n *\n * It used to be `street` + `city` + `state` + `pincode`, each independently\n * fillable, which is why this module needed rules for a half-filled address.\n * Now it is picked through the location drawer, which either hands back a\n * complete `Address` — area chain, ids, names, ancestry, coordinates — or\n * nothing at all. So there is no partial state left to validate, and `null`\n * simply means \"not chosen yet\".\n */\nexport const onboardingAddressSchema = requiredChoice(addressSchema, 'Add your address');\n\n/** Working shape of an address inside an onboarding form. */\nexport type OnboardingAddress = Address | null;\n\n/** An address has been picked. */\nexport function isOnboardingAddressComplete(a: OnboardingAddress): boolean {\n return a !== null;\n}\n\n// ─── Social links (form shape: every handle is a plain string) ───────────────\n\nexport const onboardingSocialLinksSchema = z.object({\n jansathi: z.string(),\n youtube: z.string(),\n instagram: z.string(),\n facebook: z.string(),\n});\nexport type OnboardingSocialLinks = z.infer<typeof onboardingSocialLinksSchema>;\n\n// ─── Opening hours (form shape) ─────────────────────────────────────────────\n\nexport const onboardingDayHoursSchema = z.object({\n open: z.boolean(),\n from: z.string(),\n to: z.string(),\n});\nexport type OnboardingDayHours = z.infer<typeof onboardingDayHoursSchema>;\nexport type OnboardingWeeklyHours = Record<(typeof WEEKDAYS)[number], OnboardingDayHours>;\n\n// ─── Member onboarding form ─────────────────────────────────────────────────\n\n/** Age bounds a gym membership realistically spans. */\nexport const MEMBER_MIN_AGE_YEARS = 10;\nexport const MEMBER_MAX_AGE_YEARS = 100;\n\nexport const memberOnboardingFormSchema = z\n .object({\n firstName: z.string().trim().min(1, 'First name is required'),\n lastName: z.string().trim(),\n dobDay: z.string().min(1, 'Enter the day'),\n dobMonth: z.string().min(1, 'Enter the month'),\n dobYear: z.string().length(4, 'Enter a 4-digit year'),\n gender: requiredChoice(z.enum(['male', 'female', 'other']), 'Select your gender'),\n heightCm: requiredChoice(z.number(), 'Add your height'),\n weightKg: requiredChoice(z.number(), 'Add your weight'),\n neckCm: requiredChoice(z.number(), 'Add your neck'),\n waistCm: requiredChoice(z.number(), 'Add your waist'),\n hipsCm: z.number().nullable(),\n phone: formPhone,\n emergencyName: z.string().trim().min(1, 'Add an emergency contact name'),\n emergencyPhone: formPhone,\n bloodGroup: requiredChoice(z.string(), 'Select your blood group'),\n /** GCS URL of the uploaded photo. Optional — it can be added later. */\n avatarUrl: z.string(),\n })\n /**\n * The three DOB cells are individually bounded by the input, but only the\n * assembled date can catch an impossible one (31 Feb) or an implausible age.\n * The issue is attached to `dobDay` so it renders under the field group.\n */\n .superRefine((v, ctx) => {\n if (!v.dobDay || !v.dobMonth || v.dobYear.length !== 4) return;\n\n const day = Number(v.dobDay);\n const month = Number(v.dobMonth);\n const year = Number(v.dobYear);\n\n if (!isRealDate(year, month, day)) {\n ctx.addIssue({ code: 'custom', path: ['dobDay'], message: 'That date does not exist' });\n return;\n }\n\n const age = ageInYears(year, month, day);\n if (age < MEMBER_MIN_AGE_YEARS) {\n ctx.addIssue({\n code: 'custom',\n path: ['dobDay'],\n message: `You must be at least ${MEMBER_MIN_AGE_YEARS} to join`,\n });\n } else if (age > MEMBER_MAX_AGE_YEARS) {\n ctx.addIssue({ code: 'custom', path: ['dobDay'], message: 'Check the year of birth' });\n }\n })\n /**\n * The API requires the hips measurement for female members (needed for the\n * body-fat estimate), so it fails inline on the measurements step instead of\n * 422-ing at Finish. Own refine — no early-return coupling with the DOB rule.\n */\n .superRefine((v, ctx) => {\n if (v.gender === 'female' && v.hipsCm == null) {\n ctx.addIssue({ code: 'custom', path: ['hipsCm'], message: 'Hips measurement is required' });\n }\n });\n\n/**\n * The form's working shape. Hand-written (not `z.infer`) so unset numeric /\n * choice fields can hold `null` while the schema's `requiredChoice` rules still\n * drive the field errors — the resolver is cast to this type at `useForm`.\n */\nexport type MemberOnboardingForm = {\n firstName: string;\n lastName: string;\n dobDay: string;\n dobMonth: string;\n dobYear: string;\n gender: 'male' | 'female' | 'other' | null;\n heightCm: number | null;\n weightKg: number | null;\n neckCm: number | null;\n waistCm: number | null;\n hipsCm: number | null;\n phone: string;\n emergencyName: string;\n emergencyPhone: string;\n bloodGroup: string | null;\n avatarUrl: string;\n};\n\nexport const EMPTY_MEMBER_ONBOARDING_FORM: MemberOnboardingForm = {\n firstName: '',\n lastName: '',\n dobDay: '',\n dobMonth: '',\n dobYear: '',\n gender: null,\n heightCm: null,\n weightKg: null,\n neckCm: null,\n waistCm: null,\n hipsCm: null,\n phone: '',\n emergencyName: '',\n emergencyPhone: '',\n bloodGroup: null,\n avatarUrl: '',\n};\n\n/**\n * One onboarding step, described ONCE.\n *\n * The wizard chrome (screen name, help line, progress denominator) and the\n * validation gate used to live in the page as a local `META` array beside a\n * separate field map — two lists that had to be kept the same length by hand.\n * They are one list here, so a step cannot exist without a title or be left\n * without a validation gate.\n */\nexport interface OnboardingStepConfig<TField extends string> {\n /** Stable identifier — safe for analytics and resume, unlike the index. */\n key: string;\n /** Screen name in the step header. */\n title: string;\n /** Help line under the screen name. */\n helpText: string;\n /**\n * Fields validated before this step may be left. Naming a parent path (e.g.\n * `address`) validates its nested fields too.\n */\n fields: readonly TField[];\n}\n\nexport const MEMBER_ONBOARDING_STEPS: readonly OnboardingStepConfig<\n keyof MemberOnboardingForm & string\n>[] = [\n {\n key: 'basics',\n title: 'Basic information',\n helpText: \"Enter your details, we'll need these to set things up.\",\n fields: ['firstName', 'dobDay', 'dobMonth', 'dobYear', 'gender'],\n },\n {\n key: 'body-metrics',\n title: 'Personal details',\n helpText: 'Your height and weight, to calculate your BMI.',\n fields: ['heightCm', 'weightKg'],\n },\n {\n key: 'body-composition',\n title: 'Personal details',\n helpText: 'A few measurements, to estimate your body fat.',\n fields: ['neckCm', 'waistCm', 'hipsCm'],\n },\n {\n key: 'emergency',\n title: 'Emergency info',\n helpText: 'In case something happens during training.',\n fields: ['phone', 'emergencyName', 'emergencyPhone', 'bloodGroup'],\n },\n] as const;\n\nexport const MEMBER_ONBOARDING_TOTAL_STEPS = MEMBER_ONBOARDING_STEPS.length;\n\n/**\n * Fields validated before advancing each member step.\n * DERIVED from `MEMBER_ONBOARDING_STEPS` so the two can never disagree.\n */\nexport const MEMBER_STEP_FIELDS: (keyof MemberOnboardingForm)[][] = MEMBER_ONBOARDING_STEPS.map(\n (s) => [...s.fields],\n);\n\n// ─── Gym registration form (\"list your gym\") ────────────────────────────────\n\n/**\n * The gym-registration wizard's working shape.\n *\n * THREE steps, not five. The two it used to open with — \"your details\" and\n * \"contact details\" — asked a signed-in member for their name, gender, date of\n * birth and phone, every one of which onboarding already captured. Registering\n * a business asks about the BUSINESS; the person is already known.\n */\nexport const gymRegistrationFormSchema = z.object({\n // 1 — organisation\n orgName: z.string().trim().min(1, 'Organisation name is required'),\n orgDescription: z.string(),\n hqAddress: onboardingAddressSchema,\n orgWebsite: z.string(),\n gstNumber: z.string(),\n cinNumber: z.string(),\n numberOfCenters: requiredChoice(z.number(), 'Add the number of centers'),\n orgSocials: onboardingSocialLinksSchema,\n // 2 — center\n centerName: z.string().trim().min(1, 'Center name is required'),\n centerDescription: z.string(),\n centerTypes: z.array(z.string()).min(1, 'Pick at least one type'),\n centerAddress: onboardingAddressSchema,\n floorArea: z.number().nullable(),\n centerPhone1: formPhone,\n centerPhone2: optionalFormPhone,\n centerEmail: optionalFormEmail,\n hours: z.object({\n mon: onboardingDayHoursSchema,\n tue: onboardingDayHoursSchema,\n wed: onboardingDayHoursSchema,\n thu: onboardingDayHoursSchema,\n fri: onboardingDayHoursSchema,\n sat: onboardingDayHoursSchema,\n sun: onboardingDayHoursSchema,\n }),\n photos: z.array(z.string()),\n // 3 — plan\n planId: requiredChoice(z.string(), 'Choose a plan'),\n tenureId: z.string().nullable(),\n});\n\n/** Hand-written working shape (nullable \"unset\" fields); see the member form. */\nexport type GymRegistrationForm = {\n orgName: string;\n orgDescription: string;\n hqAddress: OnboardingAddress;\n orgWebsite: string;\n gstNumber: string;\n cinNumber: string;\n numberOfCenters: number | null;\n orgSocials: OnboardingSocialLinks;\n centerName: string;\n centerDescription: string;\n centerTypes: string[];\n centerAddress: OnboardingAddress;\n floorArea: number | null;\n centerPhone1: string;\n centerPhone2: string;\n centerEmail: string;\n hours: OnboardingWeeklyHours;\n photos: string[];\n planId: string | null;\n tenureId: string | null;\n};\n\nconst EMPTY_ONBOARDING_SOCIALS: OnboardingSocialLinks = {\n jansathi: '',\n youtube: '',\n instagram: '',\n facebook: '',\n};\n\n/** The opening hours a new center starts with. */\nexport const DEFAULT_ONBOARDING_HOURS: OnboardingWeeklyHours = {\n mon: { open: true, from: '06:00', to: '22:00' },\n tue: { open: true, from: '06:00', to: '22:00' },\n wed: { open: true, from: '06:00', to: '22:00' },\n thu: { open: true, from: '06:00', to: '22:00' },\n fri: { open: true, from: '06:00', to: '22:00' },\n sat: { open: true, from: '07:00', to: '21:00' },\n sun: { open: false, from: '07:00', to: '13:00' },\n};\n\nexport const EMPTY_GYM_REGISTRATION_FORM: GymRegistrationForm = {\n orgName: '',\n orgDescription: '',\n hqAddress: null,\n orgWebsite: '',\n gstNumber: '',\n cinNumber: '',\n numberOfCenters: null,\n orgSocials: { ...EMPTY_ONBOARDING_SOCIALS },\n centerName: '',\n centerDescription: '',\n centerTypes: [],\n centerAddress: null,\n floorArea: null,\n centerPhone1: '',\n centerPhone2: '',\n centerEmail: '',\n hours: structuredClone(DEFAULT_ONBOARDING_HOURS),\n photos: [],\n planId: null,\n tenureId: null,\n};\n\n/**\n * The gym-registration wizard, described once.\n *\n * The last step is the pricing screen, which renders its own header; its title\n * and help line are unused by the wizard chrome but kept so every step has one.\n */\nexport const GYM_REGISTRATION_STEPS: readonly OnboardingStepConfig<\n keyof GymRegistrationForm & string\n>[] = [\n {\n key: 'organisation',\n title: 'Your organisation',\n helpText: 'Tell us about the business that runs the gym.',\n fields: ['orgName', 'hqAddress', 'numberOfCenters'],\n },\n {\n key: 'center',\n title: 'Your first center',\n helpText: 'Set up your primary center. You can add more later.',\n fields: [\n 'centerName',\n 'centerTypes',\n 'centerAddress',\n 'centerPhone1',\n 'centerPhone2',\n 'centerEmail',\n ],\n },\n {\n key: 'plan',\n title: 'Choose your plan',\n helpText: 'Pick the plan that fits your gym.',\n fields: ['planId', 'tenureId'],\n },\n] as const;\n\nexport const GYM_REGISTRATION_TOTAL_STEPS = GYM_REGISTRATION_STEPS.length;\n\n/**\n * Fields validated (via `form.trigger`) before advancing each step.\n * DERIVED from `GYM_REGISTRATION_STEPS` so the two can never disagree.\n */\nexport const GYM_REGISTRATION_STEP_FIELDS: (keyof GymRegistrationForm)[][] =\n GYM_REGISTRATION_STEPS.map((s) => [...s.fields]);\n"]}
@@ -75,6 +75,7 @@ export declare const createOrganisationBodySchema: z.ZodObject<{
75
75
  }, z.core.$strip>;
76
76
  gstNumber: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
77
77
  registrationNumber: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
78
+ email: z.ZodPreprocess<z.ZodOptional<z.ZodEmail>>;
78
79
  website: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
79
80
  socials: z.ZodObject<{
80
81
  jansathi: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
@@ -127,6 +128,7 @@ export declare const updateOrganisationBodySchema: z.ZodObject<{
127
128
  }, z.core.$strip>>;
128
129
  gstNumber: z.ZodOptional<z.ZodPreprocess<z.ZodOptional<z.ZodString>>>;
129
130
  registrationNumber: z.ZodOptional<z.ZodPreprocess<z.ZodOptional<z.ZodString>>>;
131
+ email: z.ZodOptional<z.ZodPreprocess<z.ZodOptional<z.ZodEmail>>>;
130
132
  website: z.ZodOptional<z.ZodPreprocess<z.ZodOptional<z.ZodString>>>;
131
133
  socials: z.ZodOptional<z.ZodObject<{
132
134
  jansathi: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
@@ -181,6 +183,7 @@ export declare const organisationSchema: z.ZodObject<{
181
183
  }, z.core.$strip>;
182
184
  gstNumber: z.ZodNullable<z.ZodString>;
183
185
  registrationNumber: z.ZodNullable<z.ZodString>;
186
+ email: z.ZodNullable<z.ZodString>;
184
187
  website: z.ZodNullable<z.ZodString>;
185
188
  socials: z.ZodObject<{
186
189
  jansathi: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
@@ -252,6 +255,7 @@ export declare const platformOrganisationSchema: z.ZodObject<{
252
255
  }, z.core.$strip>;
253
256
  gstNumber: z.ZodNullable<z.ZodString>;
254
257
  registrationNumber: z.ZodNullable<z.ZodString>;
258
+ email: z.ZodNullable<z.ZodString>;
255
259
  website: z.ZodNullable<z.ZodString>;
256
260
  socials: z.ZodObject<{
257
261
  jansathi: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
@@ -1 +1 @@
1
- {"version":3,"file":"organisation.d.ts","sourceRoot":"","sources":["../src/organisation.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,eAAO,MAAM,wBAAwB;;;EAAiC,CAAC;AACvE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAI1E;;;;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AO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAMrC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E,eAAO,MAAM,+BAA+B;;;;;;;;;iBAI1C,CAAC;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AAExF,2EAA2E;AAC3E,eAAO,MAAM,4BAA4B;;iBAEvC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF;;;GAGG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;kBASvB,CAAC;AACd,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
@@ -7,7 +7,7 @@
7
7
  * @module gymmonk-schema/organisation
8
8
  */
9
9
  import { z } from 'zod';
10
- import { isoDateTimeSchema, objectIdSchema, optionalTrimmedString, paginationSchema, } from './common.js';
10
+ import { isoDateTimeSchema, objectIdSchema, optionalEmailSchema, optionalTrimmedString, paginationSchema, } from './common.js';
11
11
  import { addressSchema, socialLinksSchema } from './shared.js';
12
12
  // ─── Status ──────────────────────────────────────────────────────────────────
13
13
  export const organisationStatusSchema = z.enum(['active', 'inactive']);
@@ -41,6 +41,14 @@ export const createOrganisationBodySchema = z.object({
41
41
  gstNumber: gstNumberSchema,
42
42
  /** Company Identification Number (CIN) or other registration id. */
43
43
  registrationNumber: optionalTrimmedString(40),
44
+ /**
45
+ * The BUSINESS's contact address, alongside GST/CIN/website.
46
+ *
47
+ * Not a centre's `email`: a branch's address is where a member writes about
48
+ * that branch, while this is where the business is reached — and a
49
+ * multi-centre gym has one of the first per branch and exactly one of these.
50
+ */
51
+ email: optionalEmailSchema,
44
52
  website: optionalTrimmedString(200),
45
53
  socials: socialLinksSchema,
46
54
  /** Owner-declared number of centers (for planning; actual centers are docs). */
@@ -56,6 +64,7 @@ export const organisationSchema = z.object({
56
64
  address: addressSchema,
57
65
  gstNumber: z.string().nullable(),
58
66
  registrationNumber: z.string().nullable(),
67
+ email: z.string().nullable(),
59
68
  website: z.string().nullable(),
60
69
  socials: socialLinksSchema,
61
70
  numberOfCenters: z.number().int(),
@@ -1 +1 @@
1
- {"version":3,"file":"organisation.js","sourceRoot":"","sources":["../src/organisation.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE/D,gFAAgF;AAEhF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;AAGvE,gFAAgF;AAEhF;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;AAG5F,gFAAgF;AAEhF,qEAAqE;AACrE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,UAAU,CACzC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,EACjE,CAAC;KACE,MAAM,EAAE;KACR,IAAI,EAAE;KACN,KAAK,CAAC,gBAAgB,EAAE,kCAAkC,CAAC;KAC3D,QAAQ,EAAE,CACd,CAAC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CAC/B,CAAC;KACD,QAAQ,EAAE,CAAC","sourcesContent":["/**\n * gymmonk-schema — Organisation\n * =============================\n * The gym business an owner runs. One owner → one organisation → many centers\n * (branches). Created at owner onboarding; edited from the owner console.\n *\n * @module gymmonk-schema/organisation\n */\n\nimport { z } from 'zod';\nimport {\n isoDateTimeSchema,\n objectIdSchema,\n optionalTrimmedString,\n paginationSchema,\n} from './common.js';\nimport { addressSchema, socialLinksSchema } from './shared.js';\n\n// ─── Status ──────────────────────────────────────────────────────────────────\n\nexport const organisationStatusSchema = z.enum(['active', 'inactive']);\nexport type OrganisationStatus = z.infer<typeof organisationStatusSchema>;\n\n// ─── Platform approval ───────────────────────────────────────────────────────\n\n/**\n * Whether the PLATFORM has vetted this gym business.\n *\n * Anyone signed in can register a gym — it is an ordinary action a member\n * takes, not a separate account type. What they cannot do is start operating\n * one: an unapproved organisation is invisible in the member-facing gym\n * directory and its owner holds the owner ROLE but none of its powers (see\n * `casl-ability#grantOwner`). A superadmin or platform manager decides.\n *\n * Distinct from `status`, which is the OWNER's own switch for a business that\n * has been approved and later paused. Approval is the platform's word; status\n * is the owner's.\n */\nexport const organisationApprovalStatusSchema = z.enum(['pending', 'approved', 'rejected']);\nexport type OrganisationApprovalStatus = z.infer<typeof organisationApprovalStatusSchema>;\n\n// ─── Registration identifiers ────────────────────────────────────────────────\n\n/** GSTIN — 15 chars; optional (many small gyms are unregistered). */\nexport const gstNumberSchema = z.preprocess(\n (v) => (typeof v === 'string' && v.trim() === '' ? undefined : v),\n z\n .string()\n .trim()\n .regex(/^[0-9A-Z]{15}$/, 'Enter a valid 15-character GSTIN')\n .optional(),\n);\n\n// ─── Create / update bodies ──────────────────────────────────────────────────\n\nexport const createOrganisationBodySchema = z.object({\n name: z.string().trim().min(1, 'Organisation name is required').max(160),\n description: optionalTrimmedString(2000),\n address: addressSchema,\n gstNumber: gstNumberSchema,\n /** Company Identification Number (CIN) or other registration id. */\n registrationNumber: optionalTrimmedString(40),\n website: optionalTrimmedString(200),\n socials: socialLinksSchema,\n /** Owner-declared number of centers (for planning; actual centers are docs). */\n numberOfCenters: z.number().int().min(1).max(500),\n});\nexport type CreateOrganisationBody = z.infer<typeof createOrganisationBodySchema>;\n\nexport const updateOrganisationBodySchema = createOrganisationBodySchema.partial();\nexport type UpdateOrganisationBody = z.infer<typeof updateOrganisationBodySchema>;\n\n// ─── Entity (API response) ───────────────────────────────────────────────────\n\nexport const organisationSchema = z.object({\n id: objectIdSchema,\n ownerId: objectIdSchema,\n name: z.string(),\n description: z.string().nullable(),\n address: addressSchema,\n gstNumber: z.string().nullable(),\n registrationNumber: z.string().nullable(),\n website: z.string().nullable(),\n socials: socialLinksSchema,\n numberOfCenters: z.number().int(),\n status: organisationStatusSchema,\n /** The platform's decision — see `organisationApprovalStatusSchema`. */\n approvalStatus: organisationApprovalStatusSchema,\n /** When the platform decided. Null while pending. */\n approvedAt: isoDateTimeSchema.nullable(),\n /** The reviewer's note, shown to the owner on a rejection. */\n reviewNote: z.string().nullable(),\n createdAt: isoDateTimeSchema,\n updatedAt: isoDateTimeSchema,\n});\nexport type Organisation = z.infer<typeof organisationSchema>;\n\n// ─── Platform review (superadmin / platform manager) ─────────────────────────\n\n/**\n * A row in the platform's gym-approvals queue: the organisation plus the owner\n * and estate detail a reviewer needs to decide without opening each one.\n */\nexport const platformOrganisationSchema = organisationSchema.extend({\n ownerName: z.string(),\n ownerEmail: z.string(),\n ownerPhone: z.string().nullable(),\n /** Centers actually created under it (`numberOfCenters` is owner-declared). */\n centerCount: z.number().int().nonnegative(),\n});\nexport type PlatformOrganisation = z.infer<typeof platformOrganisationSchema>;\n\nexport const platformOrganisationQuerySchema = paginationSchema.extend({\n approvalStatus: organisationApprovalStatusSchema.optional(),\n /** Free-text over organisation name / owner email. */\n q: optionalTrimmedString(120),\n});\nexport type PlatformOrganisationQuery = z.infer<typeof platformOrganisationQuerySchema>;\n\n/** Approve or reject. The note is surfaced to the owner on a rejection. */\nexport const decideOrganisationBodySchema = z.object({\n note: optionalTrimmedString(300),\n});\nexport type DecideOrganisationBody = z.infer<typeof decideOrganisationBodySchema>;\n\n/**\n * What the OWNER's own surfaces need: where their gym registration stands, and\n * why if it was turned down. `null` when they have not registered a gym.\n */\nexport const myGymRegistrationSchema = z\n .object({\n organisationId: objectIdSchema,\n organisationName: z.string(),\n approvalStatus: organisationApprovalStatusSchema,\n approvedAt: isoDateTimeSchema.nullable(),\n reviewNote: z.string().nullable(),\n submittedAt: isoDateTimeSchema,\n })\n .nullable();\nexport type MyGymRegistration = z.infer<typeof myGymRegistrationSchema>;\n"]}
1
+ {"version":3,"file":"organisation.js","sourceRoot":"","sources":["../src/organisation.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE/D,gFAAgF;AAEhF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;AAGvE,gFAAgF;AAEhF;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;AAG5F,gFAAgF;AAEhF,qEAAqE;AACrE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,UAAU,CACzC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,EACjE,CAAC;KACE,MAAM,EAAE;KACR,IAAI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AAE,CAAC,CAAC,MAAM,EAAE;IAC5B,cAAc,EAAE,gCAAgC;IAChD,UAAU,EAAE,iBAAiB,CAAC,QAAQ,EAAE;IACxC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,WAAW,EAAE,iBAAiB;CAC/B,CAAC;KACD,QAAQ,EAAE,CAAC","sourcesContent":["/**\n * gymmonk-schema — Organisation\n * =============================\n * The gym business an owner runs. One owner → one organisation → many centers\n * (branches). Created at owner onboarding; edited from the owner console.\n *\n * @module gymmonk-schema/organisation\n */\n\nimport { z } from 'zod';\nimport {\n isoDateTimeSchema,\n objectIdSchema,\n optionalEmailSchema,\n optionalTrimmedString,\n paginationSchema,\n} from './common.js';\nimport { addressSchema, socialLinksSchema } from './shared.js';\n\n// ─── Status ──────────────────────────────────────────────────────────────────\n\nexport const organisationStatusSchema = z.enum(['active', 'inactive']);\nexport type OrganisationStatus = z.infer<typeof organisationStatusSchema>;\n\n// ─── Platform approval ───────────────────────────────────────────────────────\n\n/**\n * Whether the PLATFORM has vetted this gym business.\n *\n * Anyone signed in can register a gym — it is an ordinary action a member\n * takes, not a separate account type. What they cannot do is start operating\n * one: an unapproved organisation is invisible in the member-facing gym\n * directory and its owner holds the owner ROLE but none of its powers (see\n * `casl-ability#grantOwner`). A superadmin or platform manager decides.\n *\n * Distinct from `status`, which is the OWNER's own switch for a business that\n * has been approved and later paused. Approval is the platform's word; status\n * is the owner's.\n */\nexport const organisationApprovalStatusSchema = z.enum(['pending', 'approved', 'rejected']);\nexport type OrganisationApprovalStatus = z.infer<typeof organisationApprovalStatusSchema>;\n\n// ─── Registration identifiers ────────────────────────────────────────────────\n\n/** GSTIN — 15 chars; optional (many small gyms are unregistered). */\nexport const gstNumberSchema = z.preprocess(\n (v) => (typeof v === 'string' && v.trim() === '' ? undefined : v),\n z\n .string()\n .trim()\n .regex(/^[0-9A-Z]{15}$/, 'Enter a valid 15-character GSTIN')\n .optional(),\n);\n\n// ─── Create / update bodies ──────────────────────────────────────────────────\n\nexport const createOrganisationBodySchema = z.object({\n name: z.string().trim().min(1, 'Organisation name is required').max(160),\n description: optionalTrimmedString(2000),\n address: addressSchema,\n gstNumber: gstNumberSchema,\n /** Company Identification Number (CIN) or other registration id. */\n registrationNumber: optionalTrimmedString(40),\n /**\n * The BUSINESS's contact address, alongside GST/CIN/website.\n *\n * Not a centre's `email`: a branch's address is where a member writes about\n * that branch, while this is where the business is reached — and a\n * multi-centre gym has one of the first per branch and exactly one of these.\n */\n email: optionalEmailSchema,\n website: optionalTrimmedString(200),\n socials: socialLinksSchema,\n /** Owner-declared number of centers (for planning; actual centers are docs). */\n numberOfCenters: z.number().int().min(1).max(500),\n});\nexport type CreateOrganisationBody = z.infer<typeof createOrganisationBodySchema>;\n\nexport const updateOrganisationBodySchema = createOrganisationBodySchema.partial();\nexport type UpdateOrganisationBody = z.infer<typeof updateOrganisationBodySchema>;\n\n// ─── Entity (API response) ───────────────────────────────────────────────────\n\nexport const organisationSchema = z.object({\n id: objectIdSchema,\n ownerId: objectIdSchema,\n name: z.string(),\n description: z.string().nullable(),\n address: addressSchema,\n gstNumber: z.string().nullable(),\n registrationNumber: z.string().nullable(),\n email: z.string().nullable(),\n website: z.string().nullable(),\n socials: socialLinksSchema,\n numberOfCenters: z.number().int(),\n status: organisationStatusSchema,\n /** The platform's decision — see `organisationApprovalStatusSchema`. */\n approvalStatus: organisationApprovalStatusSchema,\n /** When the platform decided. Null while pending. */\n approvedAt: isoDateTimeSchema.nullable(),\n /** The reviewer's note, shown to the owner on a rejection. */\n reviewNote: z.string().nullable(),\n createdAt: isoDateTimeSchema,\n updatedAt: isoDateTimeSchema,\n});\nexport type Organisation = z.infer<typeof organisationSchema>;\n\n// ─── Platform review (superadmin / platform manager) ─────────────────────────\n\n/**\n * A row in the platform's gym-approvals queue: the organisation plus the owner\n * and estate detail a reviewer needs to decide without opening each one.\n */\nexport const platformOrganisationSchema = organisationSchema.extend({\n ownerName: z.string(),\n ownerEmail: z.string(),\n ownerPhone: z.string().nullable(),\n /** Centers actually created under it (`numberOfCenters` is owner-declared). */\n centerCount: z.number().int().nonnegative(),\n});\nexport type PlatformOrganisation = z.infer<typeof platformOrganisationSchema>;\n\nexport const platformOrganisationQuerySchema = paginationSchema.extend({\n approvalStatus: organisationApprovalStatusSchema.optional(),\n /** Free-text over organisation name / owner email. */\n q: optionalTrimmedString(120),\n});\nexport type PlatformOrganisationQuery = z.infer<typeof platformOrganisationQuerySchema>;\n\n/** Approve or reject. The note is surfaced to the owner on a rejection. */\nexport const decideOrganisationBodySchema = z.object({\n note: optionalTrimmedString(300),\n});\nexport type DecideOrganisationBody = z.infer<typeof decideOrganisationBodySchema>;\n\n/**\n * What the OWNER's own surfaces need: where their gym registration stands, and\n * why if it was turned down. `null` when they have not registered a gym.\n */\nexport const myGymRegistrationSchema = z\n .object({\n organisationId: objectIdSchema,\n organisationName: z.string(),\n approvalStatus: organisationApprovalStatusSchema,\n approvedAt: isoDateTimeSchema.nullable(),\n reviewNote: z.string().nullable(),\n submittedAt: isoDateTimeSchema,\n })\n .nullable();\nexport type MyGymRegistration = z.infer<typeof myGymRegistrationSchema>;\n"]}
package/dist/user.d.ts CHANGED
@@ -60,4 +60,44 @@ export declare const updateUserBodySchema: z.ZodObject<{
60
60
  avatar: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
61
61
  }, z.core.$strip>;
62
62
  export type UpdateUserBody = z.infer<typeof updateUserBodySchema>;
63
+ /**
64
+ * What a person wants to be told about.
65
+ *
66
+ * `pauseAll` is a MASTER switch, not a sixth category: it silences everything
67
+ * without the user having to remember which four they had turned on, and
68
+ * un-pausing restores exactly what they had. The dispatcher checks it first
69
+ * (see `notification/gym.dispatch`), so a paused account cannot be woken by a
70
+ * new notification kind added later that nobody thought to gate.
71
+ */
72
+ export declare const notificationPreferencesSchema: z.ZodObject<{
73
+ pauseAll: z.ZodBoolean;
74
+ gymTime: z.ZodBoolean;
75
+ dailyWorkout: z.ZodBoolean;
76
+ calorieBurn: z.ZodBoolean;
77
+ membershipRenewal: z.ZodBoolean;
78
+ }, z.core.$strip>;
79
+ export type NotificationPreferences = z.infer<typeof notificationPreferencesSchema>;
80
+ /** Everything on, nothing paused — what a new account gets. */
81
+ export declare const DEFAULT_NOTIFICATION_PREFERENCES: NotificationPreferences;
82
+ export declare const updateNotificationPreferencesBodySchema: z.ZodObject<{
83
+ pauseAll: z.ZodOptional<z.ZodBoolean>;
84
+ gymTime: z.ZodOptional<z.ZodBoolean>;
85
+ dailyWorkout: z.ZodOptional<z.ZodBoolean>;
86
+ calorieBurn: z.ZodOptional<z.ZodBoolean>;
87
+ membershipRenewal: z.ZodOptional<z.ZodBoolean>;
88
+ }, z.core.$strip>;
89
+ export type UpdateNotificationPreferencesBody = z.infer<typeof updateNotificationPreferencesBodySchema>;
90
+ /**
91
+ * A request to erase the account.
92
+ *
93
+ * Recorded, not executed. Deleting a gym owner cascades into the organisation,
94
+ * its centres, every member and staff record, the membership ledger and the
95
+ * payment history — some of which the business is legally required to keep for
96
+ * a period. So the account is marked, signed out and queued for an operator,
97
+ * which is also what "right to erasure with a verification step" looks like.
98
+ */
99
+ export declare const accountDeletionRequestSchema: z.ZodObject<{
100
+ requestedAt: z.ZodISODateTime;
101
+ }, z.core.$strip>;
102
+ export type AccountDeletionRequest = z.infer<typeof accountDeletionRequestSchema>;
63
103
  //# sourceMappingURL=user.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../src/user.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,kFAAkF;AAClF,eAAO,MAAM,aAAa;;;;;EAAkE,CAAC;AAC7F,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpD,eAAO,MAAM,gBAAgB;;;;;EAAyD,CAAC;AACvF,MAAM,MAAM,UAAU,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AAC;AAEF,eAAO,MAAM,uCAAuC;;;;;;iBAA0C,CAAC;AAC/F,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,KAAK,CACrD,OAAO,uCAAuC,CAC/C,CAAC;AAIF;;;;;;;;GAQG;AACH,eAAO,MAAM,4BAA4B;;iBAEvC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC"}
package/dist/user.js CHANGED
@@ -41,4 +41,47 @@ export const updateUserBodySchema = z.object({
41
41
  phone: z.preprocess((v) => (typeof v === 'string' && v.trim() === '' ? undefined : v), phoneSchema.optional()),
42
42
  avatar: optionalTrimmedString(2000),
43
43
  });
44
+ // ─── Notification preferences ────────────────────────────────────────────────
45
+ /**
46
+ * What a person wants to be told about.
47
+ *
48
+ * `pauseAll` is a MASTER switch, not a sixth category: it silences everything
49
+ * without the user having to remember which four they had turned on, and
50
+ * un-pausing restores exactly what they had. The dispatcher checks it first
51
+ * (see `notification/gym.dispatch`), so a paused account cannot be woken by a
52
+ * new notification kind added later that nobody thought to gate.
53
+ */
54
+ export const notificationPreferencesSchema = z.object({
55
+ pauseAll: z.boolean(),
56
+ /** Reminders before a booked or habitual gym session. */
57
+ gymTime: z.boolean(),
58
+ /** The day's assigned workout plan. */
59
+ dailyWorkout: z.boolean(),
60
+ /** Estimated calorie-burn updates through the day. */
61
+ calorieBurn: z.boolean(),
62
+ /** "Your membership expires in N days". */
63
+ membershipRenewal: z.boolean(),
64
+ });
65
+ /** Everything on, nothing paused — what a new account gets. */
66
+ export const DEFAULT_NOTIFICATION_PREFERENCES = {
67
+ pauseAll: false,
68
+ gymTime: true,
69
+ dailyWorkout: true,
70
+ calorieBurn: true,
71
+ membershipRenewal: true,
72
+ };
73
+ export const updateNotificationPreferencesBodySchema = notificationPreferencesSchema.partial();
74
+ // ─── Account deletion ────────────────────────────────────────────────────────
75
+ /**
76
+ * A request to erase the account.
77
+ *
78
+ * Recorded, not executed. Deleting a gym owner cascades into the organisation,
79
+ * its centres, every member and staff record, the membership ledger and the
80
+ * payment history — some of which the business is legally required to keep for
81
+ * a period. So the account is marked, signed out and queued for an operator,
82
+ * which is also what "right to erasure with a verification step" looks like.
83
+ */
84
+ export const accountDeletionRequestSchema = z.object({
85
+ requestedAt: isoDateTimeSchema,
86
+ });
44
87
  //# sourceMappingURL=user.js.map
package/dist/user.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"user.js","sourceRoot":"","sources":["../src/user.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAEpG,gFAAgF;AAEhF,kFAAkF;AAClF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC;AAG7F,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC;AAGvF,gFAAgF;AAEhF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/B,EAAE,EAAE,cAAc;IAClB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,6EAA6E;IAC7E,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC;IAChC,MAAM,EAAE,gBAAgB;IACxB,SAAS,EAAE,iBAAiB;IAC5B,SAAS,EAAE,iBAAiB;CAC7B,CAAC,CAAC;AAGH,gFAAgF;AAEhF;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,SAAS,EAAE,qBAAqB,CAAC,EAAE,CAAC;IACpC,QAAQ,EAAE,qBAAqB,CAAC,EAAE,CAAC;IACnC,WAAW,EAAE,qBAAqB,CAAC,GAAG,CAAC;IACvC,KAAK,EAAE,CAAC,CAAC,UAAU,CACjB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,EACjE,WAAW,CAAC,QAAQ,EAAE,CACvB;IACD,MAAM,EAAE,qBAAqB,CAAC,IAAI,CAAC;CACpC,CAAC,CAAC","sourcesContent":["/**\n * gymmonk-schema — Authenticated user identity (\"me\")\n * ===================================================\n * The identity the whole app boots from — the shape of `GET /users/me`, mirrored\n * from the auth-synced `User`. This is the SSOT for the signed-in user's name,\n * avatar, email, phone, platform roles and status; the member/owner profile\n * modules layer product-specific data on top of it.\n *\n * @module gymmonk-schema/user\n */\n\nimport { z } from 'zod';\nimport { isoDateTimeSchema, objectIdSchema, optionalTrimmedString, phoneSchema } from './common.js';\n\n// ─── Platform roles & status ─────────────────────────────────────────────────\n\n/** Platform-wide roles (empty for most users). Distinct from gym owner/member. */\nexport const appRoleSchema = z.enum(['support_agent', 'moderator', 'manager', 'superadmin']);\nexport type AppRole = z.infer<typeof appRoleSchema>;\n\nexport const userStatusSchema = z.enum(['active', 'inactive', 'suspended', 'deleted']);\nexport type UserStatus = z.infer<typeof userStatusSchema>;\n\n// ─── The \"me\" entity ─────────────────────────────────────────────────────────\n\nexport const meSchema = z.object({\n id: objectIdSchema,\n email: z.string(),\n firstName: z.string(),\n lastName: z.string().nullable(),\n /** Free, user-chosen display name (falls back to first/last at the edge). */\n displayName: z.string().nullable(),\n phone: z.string().nullable(),\n avatar: z.string().nullable(),\n appRoles: z.array(appRoleSchema),\n status: userStatusSchema,\n createdAt: isoDateTimeSchema,\n updatedAt: isoDateTimeSchema,\n});\nexport type Me = z.infer<typeof meSchema>;\n\n// ─── Update the caller's own identity fields ─────────────────────────────────\n\n/**\n * Patch the product-owned identity fields (name/displayName/phone/avatar).\n * `email` is auth-owned and never updated here.\n */\nexport const updateUserBodySchema = z.object({\n firstName: optionalTrimmedString(80),\n lastName: optionalTrimmedString(80),\n displayName: optionalTrimmedString(100),\n phone: z.preprocess(\n (v) => (typeof v === 'string' && v.trim() === '' ? undefined : v),\n phoneSchema.optional(),\n ),\n avatar: optionalTrimmedString(2000),\n});\nexport type UpdateUserBody = z.infer<typeof updateUserBodySchema>;\n"]}
1
+ {"version":3,"file":"user.js","sourceRoot":"","sources":["../src/user.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAEpG,gFAAgF;AAEhF,kFAAkF;AAClF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC;AAG7F,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC;AAGvF,gFAAgF;AAEhF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/B,EAAE,EAAE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AE;IACpB,uCAAuC;IACvC,YAAY,EAAE,CAAC,CAAC,OAAO,EAAE;IACzB,sDAAsD;IACtD,WAAW,EAAE,CAAC,CAAC,OAAO,EAAE;IACxB,2CAA2C;IAC3C,iBAAiB,EAAE,CAAC,CAAC,OAAO,EAAE;CAC/B,CAAC,CAAC;AAGH,+DAA+D;AAC/D,MAAM,CAAC,MAAM,gCAAgC,GAA4B;IACvE,QAAQ,EAAE,KAAK;IACf,OAAO,EAAE,IAAI;IACb,YAAY,EAAE,IAAI;IAClB,WAAW,EAAE,IAAI;IACjB,iBAAiB,EAAE,IAAI;CACxB,CAAC;AAEF,MAAM,CAAC,MAAM,uCAAuC,GAAG,6BAA6B,CAAC,OAAO,EAAE,CAAC;AAK/F,gFAAgF;AAEhF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,WAAW,EAAE,iBAAiB;CAC/B,CAAC,CAAC","sourcesContent":["/**\n * gymmonk-schema — Authenticated user identity (\"me\")\n * ===================================================\n * The identity the whole app boots from — the shape of `GET /users/me`, mirrored\n * from the auth-synced `User`. This is the SSOT for the signed-in user's name,\n * avatar, email, phone, platform roles and status; the member/owner profile\n * modules layer product-specific data on top of it.\n *\n * @module gymmonk-schema/user\n */\n\nimport { z } from 'zod';\nimport { isoDateTimeSchema, objectIdSchema, optionalTrimmedString, phoneSchema } from './common.js';\n\n// ─── Platform roles & status ─────────────────────────────────────────────────\n\n/** Platform-wide roles (empty for most users). Distinct from gym owner/member. */\nexport const appRoleSchema = z.enum(['support_agent', 'moderator', 'manager', 'superadmin']);\nexport type AppRole = z.infer<typeof appRoleSchema>;\n\nexport const userStatusSchema = z.enum(['active', 'inactive', 'suspended', 'deleted']);\nexport type UserStatus = z.infer<typeof userStatusSchema>;\n\n// ─── The \"me\" entity ─────────────────────────────────────────────────────────\n\nexport const meSchema = z.object({\n id: objectIdSchema,\n email: z.string(),\n firstName: z.string(),\n lastName: z.string().nullable(),\n /** Free, user-chosen display name (falls back to first/last at the edge). */\n displayName: z.string().nullable(),\n phone: z.string().nullable(),\n avatar: z.string().nullable(),\n appRoles: z.array(appRoleSchema),\n status: userStatusSchema,\n createdAt: isoDateTimeSchema,\n updatedAt: isoDateTimeSchema,\n});\nexport type Me = z.infer<typeof meSchema>;\n\n// ─── Update the caller's own identity fields ─────────────────────────────────\n\n/**\n * Patch the product-owned identity fields (name/displayName/phone/avatar).\n * `email` is auth-owned and never updated here.\n */\nexport const updateUserBodySchema = z.object({\n firstName: optionalTrimmedString(80),\n lastName: optionalTrimmedString(80),\n displayName: optionalTrimmedString(100),\n phone: z.preprocess(\n (v) => (typeof v === 'string' && v.trim() === '' ? undefined : v),\n phoneSchema.optional(),\n ),\n avatar: optionalTrimmedString(2000),\n});\nexport type UpdateUserBody = z.infer<typeof updateUserBodySchema>;\n\n// ─── Notification preferences ────────────────────────────────────────────────\n\n/**\n * What a person wants to be told about.\n *\n * `pauseAll` is a MASTER switch, not a sixth category: it silences everything\n * without the user having to remember which four they had turned on, and\n * un-pausing restores exactly what they had. The dispatcher checks it first\n * (see `notification/gym.dispatch`), so a paused account cannot be woken by a\n * new notification kind added later that nobody thought to gate.\n */\nexport const notificationPreferencesSchema = z.object({\n pauseAll: z.boolean(),\n /** Reminders before a booked or habitual gym session. */\n gymTime: z.boolean(),\n /** The day's assigned workout plan. */\n dailyWorkout: z.boolean(),\n /** Estimated calorie-burn updates through the day. */\n calorieBurn: z.boolean(),\n /** \"Your membership expires in N days\". */\n membershipRenewal: z.boolean(),\n});\nexport type NotificationPreferences = z.infer<typeof notificationPreferencesSchema>;\n\n/** Everything on, nothing paused — what a new account gets. */\nexport const DEFAULT_NOTIFICATION_PREFERENCES: NotificationPreferences = {\n pauseAll: false,\n gymTime: true,\n dailyWorkout: true,\n calorieBurn: true,\n membershipRenewal: true,\n};\n\nexport const updateNotificationPreferencesBodySchema = notificationPreferencesSchema.partial();\nexport type UpdateNotificationPreferencesBody = z.infer<\n typeof updateNotificationPreferencesBodySchema\n>;\n\n// ─── Account deletion ────────────────────────────────────────────────────────\n\n/**\n * A request to erase the account.\n *\n * Recorded, not executed. Deleting a gym owner cascades into the organisation,\n * its centres, every member and staff record, the membership ledger and the\n * payment history — some of which the business is legally required to keep for\n * a period. So the account is marked, signed out and queued for an operator,\n * which is also what \"right to erasure with a verification step\" looks like.\n */\nexport const accountDeletionRequestSchema = z.object({\n requestedAt: isoDateTimeSchema,\n});\nexport type AccountDeletionRequest = z.infer<typeof accountDeletionRequestSchema>;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gymmonk-schema",
3
- "version": "0.12.0",
3
+ "version": "0.13.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",