@bash-app/bash-common 30.476.0 → 30.480.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.
Files changed (111) hide show
  1. package/dist/__tests__/bashEventCancellationPolicy.m300.test.d.ts +2 -0
  2. package/dist/__tests__/bashEventCancellationPolicy.m300.test.d.ts.map +1 -0
  3. package/dist/__tests__/bashEventCancellationPolicy.m300.test.js +17 -0
  4. package/dist/__tests__/bashEventCancellationPolicy.m300.test.js.map +1 -0
  5. package/dist/__tests__/bashEventLocationDisplay.test.d.ts +2 -0
  6. package/dist/__tests__/bashEventLocationDisplay.test.d.ts.map +1 -0
  7. package/dist/__tests__/bashEventLocationDisplay.test.js +11 -0
  8. package/dist/__tests__/bashEventLocationDisplay.test.js.map +1 -0
  9. package/dist/__tests__/bashEventMerchCatalogValidation.m299.test.d.ts +2 -0
  10. package/dist/__tests__/bashEventMerchCatalogValidation.m299.test.d.ts.map +1 -0
  11. package/dist/__tests__/bashEventMerchCatalogValidation.m299.test.js +33 -0
  12. package/dist/__tests__/bashEventMerchCatalogValidation.m299.test.js.map +1 -0
  13. package/dist/__tests__/bashEventWriteValidation.l193.test.d.ts +2 -0
  14. package/dist/__tests__/bashEventWriteValidation.l193.test.d.ts.map +1 -0
  15. package/dist/__tests__/bashEventWriteValidation.l193.test.js +20 -0
  16. package/dist/__tests__/bashEventWriteValidation.l193.test.js.map +1 -0
  17. package/dist/__tests__/hybridSearchQuery.test.d.ts +2 -0
  18. package/dist/__tests__/hybridSearchQuery.test.d.ts.map +1 -0
  19. package/dist/__tests__/hybridSearchQuery.test.js +42 -0
  20. package/dist/__tests__/hybridSearchQuery.test.js.map +1 -0
  21. package/dist/__tests__/promoCodeScope.test.js +7 -0
  22. package/dist/__tests__/promoCodeScope.test.js.map +1 -1
  23. package/dist/__tests__/serviceListingText.l195.test.d.ts +2 -0
  24. package/dist/__tests__/serviceListingText.l195.test.d.ts.map +1 -0
  25. package/dist/__tests__/serviceListingText.l195.test.js +7 -0
  26. package/dist/__tests__/serviceListingText.l195.test.js.map +1 -0
  27. package/dist/__tests__/serviceWizardSave.pipNov14.test.d.ts +2 -0
  28. package/dist/__tests__/serviceWizardSave.pipNov14.test.d.ts.map +1 -0
  29. package/dist/__tests__/serviceWizardSave.pipNov14.test.js +42 -0
  30. package/dist/__tests__/serviceWizardSave.pipNov14.test.js.map +1 -0
  31. package/dist/bashEventCancellationPolicy.d.ts +8 -0
  32. package/dist/bashEventCancellationPolicy.d.ts.map +1 -1
  33. package/dist/bashEventCancellationPolicy.js +20 -0
  34. package/dist/bashEventCancellationPolicy.js.map +1 -1
  35. package/dist/bashEventMerchCatalogValidation.d.ts +9 -0
  36. package/dist/bashEventMerchCatalogValidation.d.ts.map +1 -0
  37. package/dist/bashEventMerchCatalogValidation.js +39 -0
  38. package/dist/bashEventMerchCatalogValidation.js.map +1 -0
  39. package/dist/bashEventWriteValidation.d.ts +13 -0
  40. package/dist/bashEventWriteValidation.d.ts.map +1 -0
  41. package/dist/bashEventWriteValidation.js +24 -0
  42. package/dist/bashEventWriteValidation.js.map +1 -0
  43. package/dist/extendedSchemas.d.ts +675 -215
  44. package/dist/extendedSchemas.d.ts.map +1 -1
  45. package/dist/extendedSchemas.js +116 -4
  46. package/dist/extendedSchemas.js.map +1 -1
  47. package/dist/index.d.ts +5 -0
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.js +5 -0
  50. package/dist/index.js.map +1 -1
  51. package/dist/promoCodeScope.d.ts +2 -0
  52. package/dist/promoCodeScope.d.ts.map +1 -1
  53. package/dist/promoCodeScope.js +8 -3
  54. package/dist/promoCodeScope.js.map +1 -1
  55. package/dist/serviceWizardSave.d.ts +2 -0
  56. package/dist/serviceWizardSave.d.ts.map +1 -1
  57. package/dist/serviceWizardSave.js +43 -4
  58. package/dist/serviceWizardSave.js.map +1 -1
  59. package/dist/utils/__tests__/eventTaskVolunteerRewardUtils.test.js +10 -1
  60. package/dist/utils/__tests__/eventTaskVolunteerRewardUtils.test.js.map +1 -1
  61. package/dist/utils/__tests__/webLinkValidation.test.js +11 -1
  62. package/dist/utils/__tests__/webLinkValidation.test.js.map +1 -1
  63. package/dist/utils/bashEventLocationDisplay.d.ts +3 -0
  64. package/dist/utils/bashEventLocationDisplay.d.ts.map +1 -0
  65. package/dist/utils/bashEventLocationDisplay.js +21 -0
  66. package/dist/utils/bashEventLocationDisplay.js.map +1 -0
  67. package/dist/utils/hybridSearchQuery.d.ts +29 -0
  68. package/dist/utils/hybridSearchQuery.d.ts.map +1 -0
  69. package/dist/utils/hybridSearchQuery.js +77 -0
  70. package/dist/utils/hybridSearchQuery.js.map +1 -0
  71. package/dist/utils/richTextContent.d.ts +4 -0
  72. package/dist/utils/richTextContent.d.ts.map +1 -1
  73. package/dist/utils/richTextContent.js +26 -0
  74. package/dist/utils/richTextContent.js.map +1 -1
  75. package/dist/utils/serviceListingText.d.ts +3 -0
  76. package/dist/utils/serviceListingText.d.ts.map +1 -0
  77. package/dist/utils/serviceListingText.js +6 -0
  78. package/dist/utils/serviceListingText.js.map +1 -0
  79. package/dist/utils/userUtils.d.ts +3 -0
  80. package/dist/utils/userUtils.d.ts.map +1 -1
  81. package/dist/utils/userUtils.js +10 -0
  82. package/dist/utils/userUtils.js.map +1 -1
  83. package/dist/utils/webLinkValidation.d.ts +2 -0
  84. package/dist/utils/webLinkValidation.d.ts.map +1 -1
  85. package/dist/utils/webLinkValidation.js +9 -0
  86. package/dist/utils/webLinkValidation.js.map +1 -1
  87. package/package.json +1 -1
  88. package/prisma/schema.prisma +7 -0
  89. package/src/__tests__/bashEventCancellationPolicy.m300.test.ts +20 -0
  90. package/src/__tests__/bashEventLocationDisplay.test.ts +20 -0
  91. package/src/__tests__/bashEventMerchCatalogValidation.m299.test.ts +37 -0
  92. package/src/__tests__/bashEventWriteValidation.l193.test.ts +31 -0
  93. package/src/__tests__/hybridSearchQuery.test.ts +54 -0
  94. package/src/__tests__/promoCodeScope.test.ts +10 -0
  95. package/src/__tests__/serviceListingText.l195.test.ts +7 -0
  96. package/src/__tests__/serviceWizardSave.pipNov14.test.ts +47 -0
  97. package/src/bashEventCancellationPolicy.ts +23 -0
  98. package/src/bashEventMerchCatalogValidation.ts +45 -0
  99. package/src/bashEventWriteValidation.ts +31 -0
  100. package/src/extendedSchemas.ts +133 -6
  101. package/src/index.ts +5 -0
  102. package/src/promoCodeScope.ts +10 -3
  103. package/src/serviceWizardSave.ts +59 -6
  104. package/src/utils/__tests__/eventTaskVolunteerRewardUtils.test.ts +16 -0
  105. package/src/utils/__tests__/webLinkValidation.test.ts +18 -1
  106. package/src/utils/bashEventLocationDisplay.ts +24 -0
  107. package/src/utils/hybridSearchQuery.ts +93 -0
  108. package/src/utils/richTextContent.ts +26 -0
  109. package/src/utils/serviceListingText.ts +6 -0
  110. package/src/utils/userUtils.ts +13 -0
  111. package/src/utils/webLinkValidation.ts +10 -0
@@ -0,0 +1,37 @@
1
+ import {
2
+ BASH_EVENT_HOST_MERCH_MAX_PRICE_CENTS,
3
+ validateBashEventMerchCatalogForWrite,
4
+ } from "../bashEventMerchCatalogValidation";
5
+
6
+ describe("[M299] bash event merch catalog validation", () => {
7
+ it("rejects absurd per-item priceCents", () => {
8
+ const result = validateBashEventMerchCatalogForWrite({
9
+ items: [
10
+ {
11
+ id: "m1",
12
+ name: "Huge",
13
+ priceCents: 9_999_999_900,
14
+ quantity: 1,
15
+ },
16
+ ],
17
+ });
18
+ expect(result.ok).toBe(false);
19
+ if (!result.ok) {
20
+ expect(result.error).toMatch(/cannot exceed/i);
21
+ }
22
+ });
23
+
24
+ it("accepts prices at the cap", () => {
25
+ const result = validateBashEventMerchCatalogForWrite({
26
+ items: [
27
+ {
28
+ id: "m1",
29
+ name: "Jersey",
30
+ priceCents: BASH_EVENT_HOST_MERCH_MAX_PRICE_CENTS,
31
+ quantity: 1,
32
+ },
33
+ ],
34
+ });
35
+ expect(result.ok).toBe(true);
36
+ });
37
+ });
@@ -0,0 +1,31 @@
1
+ import {
2
+ BASH_EVENT_DESCRIPTION_MAX_LENGTH,
3
+ BASH_EVENT_TITLE_MAX_LENGTH,
4
+ normalizeBashEventTitleForWrite,
5
+ validateBashEventDescriptionForWrite,
6
+ } from "../bashEventWriteValidation.js";
7
+
8
+ describe("[L193] bash event description write limit", () => {
9
+ it("rejects descriptions over the visible character cap", () => {
10
+ const long = "D".repeat(BASH_EVENT_DESCRIPTION_MAX_LENGTH + 1);
11
+ expect(validateBashEventDescriptionForWrite(long)).toMatchObject({
12
+ ok: false,
13
+ });
14
+ });
15
+
16
+ it("accepts HTML within the visible cap", () => {
17
+ const inner = "a".repeat(BASH_EVENT_DESCRIPTION_MAX_LENGTH);
18
+ expect(
19
+ validateBashEventDescriptionForWrite(`<p>${inner}</p>`)
20
+ ).toEqual({ ok: true });
21
+ });
22
+ });
23
+
24
+ describe("bash event title write limit", () => {
25
+ it("truncates titles longer than the listing cap", () => {
26
+ const long = "x".repeat(BASH_EVENT_TITLE_MAX_LENGTH + 20);
27
+ expect(normalizeBashEventTitleForWrite(long)).toHaveLength(
28
+ BASH_EVENT_TITLE_MAX_LENGTH
29
+ );
30
+ });
31
+ });
@@ -0,0 +1,54 @@
1
+ import {
2
+ coerceSearchQueryParam,
3
+ escapePrismaContainsPattern,
4
+ normalizeUserSearchQuery,
5
+ parseHybridSearchQueryInput,
6
+ prismaInsensitiveContains,
7
+ searchQueryHasKeyword,
8
+ } from "../utils/hybridSearchQuery";
9
+
10
+ describe("hybridSearchQuery", () => {
11
+ describe("normalizeUserSearchQuery", () => {
12
+ it("[L183] replaces lone surrogates so search URLs do not break the UI", () => {
13
+ const loneHigh = "ab\uD800cd";
14
+ expect(normalizeUserSearchQuery(loneHigh)).toBe("ab\uFFFDcd");
15
+ expect(normalizeUserSearchQuery(" jazz ")).toBe("jazz");
16
+ });
17
+ });
18
+
19
+ describe("escapePrismaContainsPattern", () => {
20
+ it("[L184] escapes LIKE wildcards so % and _ match literally", () => {
21
+ expect(escapePrismaContainsPattern("%")).toBe("\\%");
22
+ expect(escapePrismaContainsPattern("_")).toBe("\\_");
23
+ expect(escapePrismaContainsPattern("50% off")).toBe("50\\% off");
24
+ expect(escapePrismaContainsPattern("a_b")).toBe("a\\_b");
25
+ });
26
+
27
+ it("prismaInsensitiveContains wraps escaped value", () => {
28
+ expect(prismaInsensitiveContains("%")).toEqual({
29
+ contains: "\\%",
30
+ mode: "insensitive",
31
+ });
32
+ });
33
+ });
34
+
35
+ it("[L221] rejects queries with a NUL byte", () => {
36
+ const parsed = parseHybridSearchQueryInput("ba\u0000sh");
37
+ expect(parsed.ok).toBe(false);
38
+ if (!parsed.ok) {
39
+ expect(parsed.error).toMatch(/null characters/i);
40
+ }
41
+ });
42
+
43
+ it("[L220] coerces express search query params", () => {
44
+ expect(coerceSearchQueryParam(undefined)).toBeUndefined();
45
+ expect(coerceSearchQueryParam(["bash", "qa"])).toBeUndefined();
46
+ expect(coerceSearchQueryParam(" QA ")).toBe(" QA ");
47
+ });
48
+
49
+ it("[L184] treats % and _ as not a keyword query", () => {
50
+ expect(searchQueryHasKeyword("%")).toBe(false);
51
+ expect(searchQueryHasKeyword("_")).toBe(false);
52
+ expect(searchQueryHasKeyword("50%")).toBe(true);
53
+ });
54
+ });
@@ -129,6 +129,16 @@ describe("buildBashOfferShareUrl", () => {
129
129
  );
130
130
  });
131
131
 
132
+ it("honors a fixed campaign path when path is set", () => {
133
+ expect(
134
+ buildBashOfferShareUrl({
135
+ ...base,
136
+ path: "/bashfest",
137
+ ref: "TEAM1",
138
+ })
139
+ ).toBe("https://bash.community/bashfest?ref=TEAM1");
140
+ });
141
+
132
142
  it("omits promo when the code does not apply to the shared tier", () => {
133
143
  const codes = [
134
144
  {
@@ -0,0 +1,7 @@
1
+ import { normalizeServiceNameForWrite } from "../utils/serviceListingText.js";
2
+
3
+ describe("[L195] service listing name write", () => {
4
+ it("strips HTML markup from service names", () => {
5
+ expect(normalizeServiceNameForWrite("<b>x</b><script>")).toBe("x");
6
+ });
7
+ });
@@ -0,0 +1,47 @@
1
+ import type { ServiceExt } from "../extendedSchemas.js";
2
+ import {
3
+ buildServiceHighImpactConfirmMessage,
4
+ } from "../serviceWizardSave.js";
5
+
6
+ describe("service high-impact save confirm (Pip Nov 14)", () => {
7
+ it("[L173] formats rate changes as dollar amounts, not [object Object]", () => {
8
+ const committed = {
9
+ id: "svc-1",
10
+ serviceRatesAssociation: {
11
+ id: "rates-1",
12
+ serviceGeneralRates: {
13
+ id: "gen-1",
14
+ flatRateCents: 5000,
15
+ hourlyRateCents: 100,
16
+ dailyRateCents: 800,
17
+ },
18
+ packages: [],
19
+ },
20
+ } as unknown as ServiceExt;
21
+
22
+ const pending = {
23
+ serviceRatesAssociation: {
24
+ id: "rates-1",
25
+ serviceGeneralRates: {
26
+ id: "gen-1",
27
+ flatRateCents: 5000,
28
+ hourlyRateCents: 100,
29
+ dailyRateCents: 800,
30
+ },
31
+ packages: [
32
+ {
33
+ id: "pkg-1",
34
+ name: "Test package",
35
+ priceCents: 100,
36
+ description: "",
37
+ },
38
+ ],
39
+ },
40
+ };
41
+
42
+ const message = buildServiceHighImpactConfirmMessage(committed, pending);
43
+ expect(message).not.toContain("[object Object]");
44
+ expect(message).toMatch(/\$1(\.00)?/);
45
+ expect(message).toMatch(/→/);
46
+ });
47
+ });
@@ -127,6 +127,29 @@ export function defaultBashEventCancellationPolicyDisplayText(): string {
127
127
  );
128
128
  }
129
129
 
130
+ /** Host PUT must not persist blank custom policy text (M300). */
131
+ export function validateBashEventCancellationPolicyWrite(
132
+ policy: unknown,
133
+ ): { ok: true; text: string } | { ok: false; error: string } {
134
+ if (policy === undefined) {
135
+ return { ok: false, error: "cancellationPolicy is required when provided" };
136
+ }
137
+ if (typeof policy !== "string") {
138
+ return { ok: false, error: "cancellationPolicy must be a string" };
139
+ }
140
+ const trimmed = policy.trim();
141
+ if (!trimmed) {
142
+ return {
143
+ ok: false,
144
+ error: "Cancellation policy text cannot be empty",
145
+ };
146
+ }
147
+ if (trimmed.length > 4000) {
148
+ return { ok: false, error: "Cancellation policy is too long" };
149
+ }
150
+ return { ok: true, text: trimmed };
151
+ }
152
+
130
153
  /**
131
154
  * Short label for bash detail / meta UI. Named presets use the host-picker name
132
155
  * (e.g. "Anytime"); custom/legacy free text returns the stored string.
@@ -0,0 +1,45 @@
1
+ import type { BashEventHostMerchItem } from "./extendedSchemas.js";
2
+
3
+ /** Per-item merch cap ($10,000) — above this is almost always wizard mistake / abuse. */
4
+ export const BASH_EVENT_HOST_MERCH_MAX_PRICE_CENTS = 1_000_000;
5
+
6
+ function merchItemsFromRaw(raw: unknown): BashEventHostMerchItem[] {
7
+ if (Array.isArray(raw)) {
8
+ return raw as BashEventHostMerchItem[];
9
+ }
10
+ if (raw && typeof raw === "object" && Array.isArray((raw as { items?: unknown }).items)) {
11
+ return (raw as { items: BashEventHostMerchItem[] }).items;
12
+ }
13
+ return [];
14
+ }
15
+
16
+ export function validateBashEventMerchCatalogForWrite(
17
+ raw: unknown,
18
+ ): { ok: true } | { ok: false; error: string } {
19
+ if (raw === undefined || raw === null) {
20
+ return { ok: false, error: "merchandiseItems is required when provided" };
21
+ }
22
+ if (typeof raw !== "object") {
23
+ return { ok: false, error: "merchandiseItems must be an object or array" };
24
+ }
25
+ const items = merchItemsFromRaw(raw);
26
+
27
+ for (const item of items) {
28
+ if (!item || typeof item !== "object") continue;
29
+ const priceCents = item.priceCents;
30
+ if (typeof priceCents !== "number" || !Number.isFinite(priceCents)) {
31
+ return { ok: false, error: "Each merch item needs a valid priceCents" };
32
+ }
33
+ if (priceCents < 0) {
34
+ return { ok: false, error: "Merch price cannot be negative" };
35
+ }
36
+ if (priceCents > BASH_EVENT_HOST_MERCH_MAX_PRICE_CENTS) {
37
+ return {
38
+ ok: false,
39
+ error: `Merch price cannot exceed $${(BASH_EVENT_HOST_MERCH_MAX_PRICE_CENTS / 100).toLocaleString()}`,
40
+ };
41
+ }
42
+ }
43
+
44
+ return { ok: true };
45
+ }
@@ -0,0 +1,31 @@
1
+ import { plainListingHeadline } from "./utils/plainListingHeadline.js";
2
+ import { richTextVisibleLength } from "./utils/richTextContent.js";
3
+
4
+ /** Keep in sync with bash-app `constants/bashEventLimits.ts`. */
5
+ export const BASH_EVENT_TITLE_MAX_LENGTH = 100;
6
+
7
+ /** Visible characters (HTML stripped). Keep in sync with bash-app. */
8
+ export const BASH_EVENT_DESCRIPTION_MAX_LENGTH = 2000;
9
+
10
+ export const BASH_EVENT_DESCRIPTION_TOO_LONG_MESSAGE = `Description is too long. Keep it to ${BASH_EVENT_DESCRIPTION_MAX_LENGTH} visible characters or less.`;
11
+
12
+ export function normalizeBashEventTitleForWrite(
13
+ title: string
14
+ ): string {
15
+ const plain = plainListingHeadline(title).trim();
16
+ if (plain.length <= BASH_EVENT_TITLE_MAX_LENGTH) return plain;
17
+ return plain.slice(0, BASH_EVENT_TITLE_MAX_LENGTH);
18
+ }
19
+
20
+ export function validateBashEventDescriptionForWrite(
21
+ description: string | null | undefined
22
+ ): { ok: true } | { ok: false; error: string } {
23
+ if (description == null || description === "") {
24
+ return { ok: true };
25
+ }
26
+ const visible = richTextVisibleLength(description);
27
+ if (visible > BASH_EVENT_DESCRIPTION_MAX_LENGTH) {
28
+ return { ok: false, error: BASH_EVENT_DESCRIPTION_TOO_LONG_MESSAGE };
29
+ }
30
+ return { ok: true };
31
+ }
@@ -828,6 +828,15 @@ export type BashEventUpsertWireInput = Override<
828
828
  | import("@prisma/client").Prisma.JsonValue
829
829
  | null;
830
830
  advertiseRecurrence?: boolean;
831
+ /**
832
+ * updatedAt the wizard tab last loaded. The API drops a stale title,
833
+ * subtitle, or description when another tab saved a newer version.
834
+ */
835
+ baseUpdatedAt?: string | null;
836
+ /** Title, subtitle, and description this wizard tab loaded. */
837
+ baseTitle?: string | null;
838
+ baseSubtitle?: string | null;
839
+ baseDescription?: string | null;
831
840
  }
832
841
  >,
833
842
  {
@@ -1145,6 +1154,7 @@ export const SERVICE_PUBLIC_LIST_DATA_TO_INCLUDE = {
1145
1154
  select: {
1146
1155
  id: true,
1147
1156
  venueTypes: true,
1157
+ secondaryVenueTypes: true,
1148
1158
  capacity: true,
1149
1159
  amenities: true,
1150
1160
  features: true,
@@ -1222,6 +1232,61 @@ export const SERVICE_PUBLIC_LIST_DATA_TO_INCLUDE = {
1222
1232
  },
1223
1233
  } satisfies Prisma.ServiceInclude;
1224
1234
 
1235
+ /** Full service detail for signed-out `GET /api/public-services/service/:id` (no owner/creator PII). */
1236
+ export const SERVICE_PUBLIC_DETAIL_DATA_TO_INCLUDE = {
1237
+ creator: {
1238
+ select: PUBLIC_TEASER_USER_DATA_TO_SELECT,
1239
+ },
1240
+ owner: {
1241
+ select: PUBLIC_TEASER_USER_DATA_TO_SELECT,
1242
+ },
1243
+ targetAudience: true,
1244
+ media: true,
1245
+ stripeAccount: {
1246
+ select: PUBLIC_STRIPE_ACCOUNT_DATA_TO_SELECT,
1247
+ },
1248
+ serviceLinks: {
1249
+ include: SERVICE_LINK_DATA_TO_INCLUDE,
1250
+ },
1251
+ serviceRatesAssociation: {
1252
+ include: SERVICE_RATES_ASSOCIATION_DATA_TO_INCLUDE,
1253
+ },
1254
+ bashEvent: {
1255
+ include: BASH_EVENT_DATA_TO_INCLUDE,
1256
+ },
1257
+ venue: {
1258
+ include: VENUE_DATA_TO_INCLUDE,
1259
+ },
1260
+ eventService: {
1261
+ include: EVENT_SERVICE_DATA_TO_INCLUDE,
1262
+ },
1263
+ entertainmentService: {
1264
+ include: ENTERTAINMENT_SERVICE_DATA_TO_INCLUDE,
1265
+ },
1266
+ vendor: {
1267
+ include: VENDOR_DATA_TO_INCLUDE,
1268
+ },
1269
+ exhibitor: {
1270
+ include: EXHIBITOR_DATA_TO_INCLUDE,
1271
+ },
1272
+ sponsor: {
1273
+ include: SPONSOR_DATA_TO_INCLUDE,
1274
+ },
1275
+ organization: {
1276
+ include: {
1277
+ _count: {
1278
+ select: {
1279
+ members: true,
1280
+ },
1281
+ },
1282
+ sportsProfile: true,
1283
+ },
1284
+ },
1285
+ complementaryProfiles: {
1286
+ select: { id: true, serviceType: true },
1287
+ },
1288
+ } satisfies Prisma.ServiceInclude;
1289
+
1225
1290
  export const SERVICE_DATA_TO_INCLUDE = {
1226
1291
  creator: {
1227
1292
  select: FRONT_END_USER_DATA_TO_SELECT,
@@ -2235,19 +2300,19 @@ export type PublicStripeAccount = Pick<
2235
2300
 
2236
2301
  export const BLOG_POST_DATA_TO_INCLUDE = {
2237
2302
  author: {
2238
- select: FRONT_END_USER_DATA_TO_SELECT,
2303
+ select: PUBLIC_TEASER_USER_DATA_TO_SELECT,
2239
2304
  },
2240
2305
  category: true,
2241
2306
  tags: true,
2242
2307
  comments: {
2243
2308
  include: {
2244
2309
  author: {
2245
- select: FRONT_END_USER_DATA_TO_SELECT,
2310
+ select: PUBLIC_TEASER_USER_DATA_TO_SELECT,
2246
2311
  },
2247
2312
  replies: {
2248
2313
  include: {
2249
2314
  author: {
2250
- select: FRONT_END_USER_DATA_TO_SELECT,
2315
+ select: PUBLIC_TEASER_USER_DATA_TO_SELECT,
2251
2316
  },
2252
2317
  },
2253
2318
  },
@@ -2263,7 +2328,7 @@ export const BLOG_POST_DATA_TO_INCLUDE = {
2263
2328
 
2264
2329
  export const BLOG_POST_PREVIEW_DATA_TO_INCLUDE = {
2265
2330
  author: {
2266
- select: FRONT_END_USER_DATA_TO_SELECT,
2331
+ select: PUBLIC_TEASER_USER_DATA_TO_SELECT,
2267
2332
  },
2268
2333
  category: true,
2269
2334
  tags: true,
@@ -2279,7 +2344,7 @@ export const BLOG_POST_PREVIEW_DATA_TO_INCLUDE = {
2279
2344
  } satisfies Prisma.BlogPostInclude;
2280
2345
 
2281
2346
  export interface BlogPostExt extends BlogPost {
2282
- author: PublicUser;
2347
+ author: PublicTeaserUser;
2283
2348
  category?: BlogCategory | null;
2284
2349
  tags: BlogTag[];
2285
2350
  comments?: BlogCommentExt[];
@@ -2289,7 +2354,7 @@ export interface BlogPostExt extends BlogPost {
2289
2354
  }
2290
2355
 
2291
2356
  export interface BlogCommentExt extends BlogComment {
2292
- author: PublicUser;
2357
+ author: PublicTeaserUser;
2293
2358
  replies?: BlogCommentExt[];
2294
2359
  }
2295
2360
 
@@ -2513,6 +2578,68 @@ export const ARTIST_REPRESENTATION_PUBLIC_SELECT = {
2513
2578
  artistUser: { select: FRONT_END_USER_DATA_TO_SELECT },
2514
2579
  } satisfies Prisma.OrganizationArtistRepresentationSelect;
2515
2580
 
2581
+ /**
2582
+ * Signed-out / non-member `GET /organizations/:id` and `/slug/:slug`.
2583
+ * Omits contact email and phone, street address, billing, SMS caps, SSO,
2584
+ * Stripe ids, and other workspace-admin fields (M294).
2585
+ */
2586
+ export const ORGANIZATION_PUBLIC_DETAIL_SELECT = {
2587
+ id: true,
2588
+ name: true,
2589
+ slug: true,
2590
+ organizationType: true,
2591
+ bio: true,
2592
+ mission: true,
2593
+ pocName: true,
2594
+ city: true,
2595
+ state: true,
2596
+ zipCode: true,
2597
+ country: true,
2598
+ coverPhoto: true,
2599
+ logoUrl: true,
2600
+ websiteUrl: true,
2601
+ socialLinks: true,
2602
+ goodsOrServices: true,
2603
+ venueTypes: true,
2604
+ secondaryVenueTypes: true,
2605
+ baseMembershipPriceCents: true,
2606
+ premiumMembershipPriceCents: true,
2607
+ membershipBillingInterval: true,
2608
+ allowGuestsByDefault: true,
2609
+ defaultGuestLimit: true,
2610
+ visibility: true,
2611
+ requiresApproval: true,
2612
+ memberAutoApproval: true,
2613
+ ownerId: true,
2614
+ parentOrganizationId: true,
2615
+ departmentName: true,
2616
+ hierarchyLevel: true,
2617
+ latitude: true,
2618
+ longitude: true,
2619
+ createdAt: true,
2620
+ updatedAt: true,
2621
+ accentColor: true,
2622
+ faviconUrl: true,
2623
+ secondaryBrandColor: true,
2624
+ fontPreset: true,
2625
+ coursesEnabled: true,
2626
+ communityEnabled: true,
2627
+ resourcesEnabled: true,
2628
+ removeBashBranding: true,
2629
+ isBashOfficial: true,
2630
+ customDomain: true,
2631
+ customDomainStatus: true,
2632
+ inheritBrandingFromParent: true,
2633
+ nonprofitVerifiedAt: true,
2634
+ nonprofitCountry: true,
2635
+ promotionalPackageRates: true,
2636
+ subscriptionTier: true,
2637
+ } satisfies Prisma.OrganizationSelect;
2638
+
2639
+ export type OrganizationPublicDetail = Prisma.OrganizationGetPayload<{
2640
+ select: typeof ORGANIZATION_PUBLIC_DETAIL_SELECT;
2641
+ }>;
2642
+
2516
2643
  export type ArtistRepresentationPublic =
2517
2644
  Prisma.OrganizationArtistRepresentationGetPayload<{
2518
2645
  select: typeof ARTIST_REPRESENTATION_PUBLIC_SELECT;
package/src/index.ts CHANGED
@@ -63,6 +63,7 @@ export * from "./promoCartEngine.js";
63
63
  export * from "./audienceImport.js";
64
64
  export * from "./eventStaffRoles.js";
65
65
  export * from "./bashEventCancellationPolicy.js";
66
+ export * from "./bashEventMerchCatalogValidation.js";
66
67
  export * from "./userReportTypes.js";
67
68
  export * from "./intros/index.js";
68
69
  export * from "./mirroredPrismaEnums.js";
@@ -387,6 +388,8 @@ export * from "./utils/awsS3Utils.js";
387
388
  export * from "./utils/badgeUtils.js";
388
389
  export * from "./utils/bashPointsPaymentUtils.js";
389
390
  export * from "./utils/contentFilterUtils.js";
391
+ export * from "./utils/hybridSearchQuery.js";
392
+ export * from "./utils/bashEventLocationDisplay.js";
390
393
  export * from "./utils/dateTimeUtils.js";
391
394
  export {
392
395
  getIanaTimezoneFromUsStateCode,
@@ -509,7 +512,9 @@ export * from "./utils/ticketTierValidation.js";
509
512
  export * from "./utils/organizationMembershipValidation.js";
510
513
  export * from "./utils/crowdSizeValidation.js";
511
514
  export * from "./utils/plainListingHeadline.js";
515
+ export * from "./utils/serviceListingText.js";
512
516
  export * from "./utils/webLinkValidation.js";
513
517
  export * from "./utils/listingContactValidation.js";
514
518
  export * from "./utils/p2pPaymentValidation.js";
515
519
  export * from "./utils/richTextContent.js";
520
+ export * from "./bashEventWriteValidation.js";
@@ -172,16 +172,23 @@ export function buildBashOfferShareUrl(args: {
172
172
  bashEventId: string;
173
173
  slug?: string | null;
174
174
  vanityPaths?: ReadonlyArray<{ segment: string; status: string }> | null;
175
+ /** When set, skips vanity/slug resolution (e.g. campaign `/bashfest`). */
176
+ path?: string | null;
175
177
  /** Absolute origin, e.g. "https://bash.community". Omit for a relative path. */
176
178
  origin?: string;
177
179
  promo?: string | null;
178
180
  ref?: string | null;
179
181
  tierId?: string | null;
180
182
  }): string {
183
+ const pathOverride = args.path?.trim();
181
184
  const active = args.vanityPaths?.find((v) => v.status === "Active" && v.segment.trim());
182
- const path = active
183
- ? `/bash/${encodeURIComponent(active.segment.trim().toLowerCase())}`
184
- : getPublicBashDetailPath(args.bashEventId, args.slug);
185
+ const path = pathOverride
186
+ ? pathOverride.startsWith("/")
187
+ ? pathOverride
188
+ : `/${pathOverride}`
189
+ : active
190
+ ? `/bash/${encodeURIComponent(active.segment.trim().toLowerCase())}`
191
+ : getPublicBashDetailPath(args.bashEventId, args.slug);
185
192
  const parts: string[] = [];
186
193
  const promo = args.promo?.trim();
187
194
  const ref = args.ref?.trim();
@@ -120,6 +120,58 @@ const SERVICE_HIGH_IMPACT_FIELD_LABELS: Record<
120
120
  cancellationPolicy: "Cancellation policy",
121
121
  };
122
122
 
123
+ function formatCentsAsDollars(cents: number): string {
124
+ return `$${(cents / 100).toFixed(2)}`;
125
+ }
126
+
127
+ /** Rates confirm copy must show dollar amounts, not "[object Object]" (L173). */
128
+ export function formatServiceRatesForConfirm(value: unknown): string {
129
+ if (!value || typeof value !== "object") return "—";
130
+ const assoc = value as {
131
+ serviceGeneralRates?: {
132
+ flatRateCents?: number | null;
133
+ hourlyRateCents?: number | null;
134
+ dailyRateCents?: number | null;
135
+ } | null;
136
+ packages?: Array<{ name?: string | null; priceCents?: number | null }>;
137
+ };
138
+ const parts: string[] = [];
139
+ const rates = assoc.serviceGeneralRates;
140
+ if (rates?.flatRateCents) {
141
+ parts.push(`flat ${formatCentsAsDollars(rates.flatRateCents)}`);
142
+ }
143
+ if (rates?.hourlyRateCents) {
144
+ parts.push(`hourly ${formatCentsAsDollars(rates.hourlyRateCents)}`);
145
+ }
146
+ if (rates?.dailyRateCents) {
147
+ parts.push(`daily ${formatCentsAsDollars(rates.dailyRateCents)}`);
148
+ }
149
+ for (const pkg of assoc.packages ?? []) {
150
+ const name = pkg.name?.trim() || "Package";
151
+ const price =
152
+ typeof pkg.priceCents === "number"
153
+ ? formatCentsAsDollars(pkg.priceCents)
154
+ : "—";
155
+ parts.push(`${name} ${price}`);
156
+ }
157
+ return parts.length > 0 ? parts.join(", ") : "—";
158
+ }
159
+
160
+ function formatServiceHighImpactValue(
161
+ key: (typeof SERVICE_HIGH_IMPACT_SAVE_KEYS)[number],
162
+ value: unknown
163
+ ): string {
164
+ if (value == null || value === "") return "—";
165
+ if (key === "serviceRatesAssociation") {
166
+ return formatServiceRatesForConfirm(value);
167
+ }
168
+ if (key === "availableHours") {
169
+ return typeof value === "string" ? value : "Updated hours";
170
+ }
171
+ if (typeof value === "object") return "Updated";
172
+ return String(value);
173
+ }
174
+
123
175
  /** High-impact Save confirm copy for published listing wizards. */
124
176
  export function buildServiceHighImpactConfirmMessage(
125
177
  committed: ServiceExt,
@@ -128,12 +180,13 @@ export function buildServiceHighImpactConfirmMessage(
128
180
  const lines = SERVICE_HIGH_IMPACT_SAVE_KEYS.filter((key) => key in pending).map(
129
181
  (key) => {
130
182
  const label = SERVICE_HIGH_IMPACT_FIELD_LABELS[key];
131
- const before =
132
- key in committed
133
- ? String(committed[key as keyof ServiceExt] ?? "—")
134
- : "—";
135
- const after = String(
136
- (pending as Record<string, unknown>)[key] ?? "—"
183
+ const before = formatServiceHighImpactValue(
184
+ key,
185
+ key in committed ? committed[key as keyof ServiceExt] : null
186
+ );
187
+ const after = formatServiceHighImpactValue(
188
+ key,
189
+ (pending as Record<string, unknown>)[key]
137
190
  );
138
191
  return `${label}: ${before} → ${after}`;
139
192
  }
@@ -1,11 +1,27 @@
1
1
  import {
2
2
  countEventTaskFilledSlots,
3
3
  eventTaskMaxBashPointsLiability,
4
+ isUserAssignedToEventTask,
4
5
  totalEventTaskBashPointsOffer,
5
6
  validateHostTaskBashPointsOffer,
6
7
  } from "../eventTaskVolunteerRewardUtils.js";
7
8
 
8
9
  describe("eventTaskVolunteerRewardUtils", () => {
10
+ it("[H7] treats the viewer as assigned when they have a row but legacy assignedToId is someone else", () => {
11
+ expect(
12
+ isUserAssignedToEventTask(
13
+ {
14
+ assignedToId: "other-volunteer",
15
+ status: "Accepted",
16
+ neededCount: 1,
17
+ bashPointsReward: 0,
18
+ assignments: [{ userId: "me", status: "Accepted", bashPointsPaidAt: null }],
19
+ },
20
+ "me"
21
+ )
22
+ ).toBe(true);
23
+ });
24
+
9
25
  it("counts legacy assignee plus assignment rows without double count", () => {
10
26
  expect(
11
27
  countEventTaskFilledSlots({