@bash-app/bash-common 30.447.0 → 30.449.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/__tests__/partnerBookingAgreement.test.d.ts +2 -0
- package/dist/__tests__/partnerBookingAgreement.test.d.ts.map +1 -0
- package/dist/__tests__/partnerBookingAgreement.test.js +62 -0
- package/dist/__tests__/partnerBookingAgreement.test.js.map +1 -0
- package/dist/__tests__/vendorBookingAgreement.test.d.ts +2 -0
- package/dist/__tests__/vendorBookingAgreement.test.d.ts.map +1 -0
- package/dist/__tests__/vendorBookingAgreement.test.js +32 -0
- package/dist/__tests__/vendorBookingAgreement.test.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/partnerBookingAgreement.d.ts +55 -0
- package/dist/partnerBookingAgreement.d.ts.map +1 -0
- package/dist/partnerBookingAgreement.js +251 -0
- package/dist/partnerBookingAgreement.js.map +1 -0
- package/dist/utils/__tests__/recurrenceUtils.test.js +51 -0
- package/dist/utils/__tests__/recurrenceUtils.test.js.map +1 -1
- package/dist/utils/__tests__/slugUtils.test.js +17 -0
- package/dist/utils/__tests__/slugUtils.test.js.map +1 -1
- package/dist/utils/recurrenceUtils.d.ts +2 -2
- package/dist/utils/recurrenceUtils.d.ts.map +1 -1
- package/dist/utils/recurrenceUtils.js +50 -32
- package/dist/utils/recurrenceUtils.js.map +1 -1
- package/dist/utils/service/__tests__/serviceUtils.test.js +5 -1
- package/dist/utils/service/__tests__/serviceUtils.test.js.map +1 -1
- package/dist/utils/service/serviceUtils.d.ts +2 -0
- package/dist/utils/service/serviceUtils.d.ts.map +1 -1
- package/dist/utils/service/serviceUtils.js +7 -0
- package/dist/utils/service/serviceUtils.js.map +1 -1
- package/dist/utils/slugUtils.d.ts +1 -1
- package/dist/utils/slugUtils.d.ts.map +1 -1
- package/dist/utils/slugUtils.js +17 -5
- package/dist/utils/slugUtils.js.map +1 -1
- package/dist/vendorBookingAgreement.d.ts +25 -0
- package/dist/vendorBookingAgreement.d.ts.map +1 -0
- package/dist/vendorBookingAgreement.js +114 -0
- package/dist/vendorBookingAgreement.js.map +1 -0
- package/package.json +1 -1
- package/prisma/schema.prisma +26 -2
- package/src/__tests__/partnerBookingAgreement.test.ts +84 -0
- package/src/__tests__/vendorBookingAgreement.test.ts +53 -0
- package/src/index.ts +2 -0
- package/src/partnerBookingAgreement.ts +429 -0
- package/src/utils/__tests__/recurrenceUtils.test.ts +54 -0
- package/src/utils/__tests__/slugUtils.test.ts +19 -0
- package/src/utils/recurrenceUtils.ts +55 -34
- package/src/utils/service/__tests__/serviceUtils.test.ts +10 -0
- package/src/utils/service/serviceUtils.ts +12 -0
- package/src/utils/slugUtils.ts +16 -5
- package/src/vendorBookingAgreement.ts +158 -0
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Marketplace partner booking agreements for bookable service subtypes.
|
|
3
|
+
*
|
|
4
|
+
* One product pattern, six roles: vendor, exhibitor, sponsor, venue, entertainment,
|
|
5
|
+
* eventService. Each has a standard Bash contract (§7 force majeure inside the doc).
|
|
6
|
+
*
|
|
7
|
+
* Storage shape differs only for vendor: agreement fields live on VendorPreferences
|
|
8
|
+
* (`vendorBookingAgreementText`, `acceptsVendorBookingTerms`). Every other subtype uses
|
|
9
|
+
* the same flat columns (`partnerBookingAgreementText`, `acceptsPartnerBookingTerms`).
|
|
10
|
+
*
|
|
11
|
+
* Use this module for UI, checkout (`readPartnerBookingAgreementFromService`), and
|
|
12
|
+
* app-side save (`resolvePartnerBookingAgreementForSave` / `resolveVendorBookingAgreementForSave`).
|
|
13
|
+
* The API persists payloads without re-importing standard text (see api bookingAgreementPersistUtils).
|
|
14
|
+
*
|
|
15
|
+
* `vendorBookingAgreement.ts` holds the vendor standard body (section 4/5 are vendor-specific)
|
|
16
|
+
* and vendor-named save helpers; re-exported from the package root via index.ts.
|
|
17
|
+
*/
|
|
18
|
+
import type { ServiceExt } from "./extendedSchemas.js";
|
|
19
|
+
import {
|
|
20
|
+
STANDARD_VENDOR_BOOKING_AGREEMENT,
|
|
21
|
+
normalizeVendorBookingAgreementText,
|
|
22
|
+
getVendorBookingAgreementDisplayText,
|
|
23
|
+
isVendorBookingAgreementCustomized,
|
|
24
|
+
} from "./vendorBookingAgreement.js";
|
|
25
|
+
|
|
26
|
+
export const PARTNER_BOOKING_AGREEMENT_ROLES = [
|
|
27
|
+
"vendor",
|
|
28
|
+
"exhibitor",
|
|
29
|
+
"sponsor",
|
|
30
|
+
"venue",
|
|
31
|
+
"entertainment",
|
|
32
|
+
"eventService",
|
|
33
|
+
] as const;
|
|
34
|
+
|
|
35
|
+
export type PartnerBookingAgreementRole =
|
|
36
|
+
(typeof PARTNER_BOOKING_AGREEMENT_ROLES)[number];
|
|
37
|
+
|
|
38
|
+
const SHARED_SECTIONS = `2. Booking confirmation. The confirmed booking details (date, time, location, fees, deliverables, and special requirements) are those shown in the booking confirmation and the provider's listing at the time of booking. Changes must be agreed by both parties in writing (including in-app messages or email).
|
|
39
|
+
|
|
40
|
+
3. Fees and payment. The provider charges the fees stated in the listing or booking confirmation. Payment timing follows the booking checkout terms and any host cancellation policy published for the event. The provider is responsible for its own taxes on amounts received unless otherwise required by law.
|
|
41
|
+
|
|
42
|
+
4. Provider obligations. The provider will perform professionally, comply with applicable laws and permits, maintain any insurance represented on its profile, and meet the requirements stated on its listing.
|
|
43
|
+
|
|
44
|
+
5. Host obligations. The host will provide the agreed venue access, load-in window, and utilities represented in the booking, and will communicate material event changes promptly.
|
|
45
|
+
|
|
46
|
+
6. Cancellations and schedule changes. If the host cancels for reasons other than provider breach, the provider receives any cancellation fee or minimum guarantee stated in the booking or listing. If the provider cannot perform, the provider must notify the host as soon as practicable and cooperate on rescheduling or refund handling per the booking payment terms. Material changes to date, time, location, or scope may be declined by either party if the change makes performance unreasonable, when notice is given as stated in the booking confirmation.
|
|
47
|
+
|
|
48
|
+
7. Force majeure. Neither party is liable for failure or delay caused by a Force Majeure Event — circumstances beyond reasonable control, including severe weather, natural disaster, epidemic, governmental order, utility failure, terrorism, civil unrest, or venue closure not caused by the provider. The affected party must notify the other promptly and use reasonable efforts to mitigate. Deposits and prepaid amounts are handled under Section 6 and the host's published cancellation policy. Neither party owes indirect, consequential, or punitive damages for force majeure.
|
|
49
|
+
|
|
50
|
+
8. Limitation of liability. Except for fraud or willful misconduct, each party's total liability arising from the booking is limited to the fees paid or payable for that booking. This limitation does not apply where prohibited by law.
|
|
51
|
+
|
|
52
|
+
9. Independent contractor. The provider is an independent contractor, not an employee or agent of the host or Bash.
|
|
53
|
+
|
|
54
|
+
10. Entire agreement. This standard agreement applies to the booking unless the host and provider supersede it with a signed written contract. Custom text saved on the provider's Bash listing replaces this standard text for hosts reviewing that listing.`;
|
|
55
|
+
|
|
56
|
+
function buildStandardAgreement(
|
|
57
|
+
title: string,
|
|
58
|
+
scopeParagraph: string,
|
|
59
|
+
acceptanceLine: string
|
|
60
|
+
): string {
|
|
61
|
+
return `${title}
|
|
62
|
+
|
|
63
|
+
1. Scope. ${scopeParagraph}
|
|
64
|
+
|
|
65
|
+
${SHARED_SECTIONS}
|
|
66
|
+
|
|
67
|
+
${acceptanceLine}`;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export const STANDARD_EXHIBITOR_BOOKING_AGREEMENT = buildStandardAgreement(
|
|
71
|
+
"STANDARD EXHIBITOR BOOKING AGREEMENT (Bash Marketplace)",
|
|
72
|
+
"This agreement applies when a host books the exhibitor for an event through Bash. It governs the relationship between the exhibitor and the host for that booking. Bash facilitates the introduction and booking tools; the performance obligation is between host and exhibitor unless Bash is explicitly a party in writing.",
|
|
73
|
+
"By accepting, the exhibitor agrees that this agreement (or its customized version on the listing) governs marketplace bookings through Bash."
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
export const STANDARD_SPONSOR_BOOKING_AGREEMENT = buildStandardAgreement(
|
|
77
|
+
"STANDARD SPONSOR BOOKING AGREEMENT (Bash Marketplace)",
|
|
78
|
+
"This agreement applies when a host books the sponsor for an event through Bash. It governs the relationship between the sponsor and the host for that sponsorship opportunity. Bash facilitates the introduction and booking tools; the performance obligation is between host and sponsor unless Bash is explicitly a party in writing.",
|
|
79
|
+
"By accepting, the sponsor agrees that this agreement (or its customized version on the listing) governs marketplace bookings through Bash."
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
export const STANDARD_VENUE_BOOKING_AGREEMENT = buildStandardAgreement(
|
|
83
|
+
"STANDARD VENUE BOOKING AGREEMENT (Bash Marketplace)",
|
|
84
|
+
"This agreement applies when a host books the venue for an event through Bash. It governs the relationship between the venue and the host for that space rental or venue package. Bash facilitates the introduction and booking tools; the performance obligation is between host and venue unless Bash is explicitly a party in writing.",
|
|
85
|
+
"By accepting, the venue agrees that this agreement (or its customized version on the listing) governs marketplace bookings through Bash."
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
export const STANDARD_ENTERTAINMENT_BOOKING_AGREEMENT = buildStandardAgreement(
|
|
89
|
+
"STANDARD ENTERTAINMENT BOOKING AGREEMENT (Bash Marketplace)",
|
|
90
|
+
"This agreement applies when a host books the entertainment provider for an event through Bash. It governs the relationship between the entertainer and the host for that performance or appearance. Bash facilitates the introduction and booking tools; the performance obligation is between host and entertainment provider unless Bash is explicitly a party in writing.",
|
|
91
|
+
"By accepting, the entertainment provider agrees that this agreement (or its customized version on the listing) governs marketplace bookings through Bash."
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
export const STANDARD_EVENT_SERVICE_BOOKING_AGREEMENT = buildStandardAgreement(
|
|
95
|
+
"STANDARD EVENT SERVICE BOOKING AGREEMENT (Bash Marketplace)",
|
|
96
|
+
"This agreement applies when a host books the event service provider for an event through Bash. It governs the relationship between the event service provider and the host for that engagement. Bash facilitates the introduction and booking tools; the performance obligation is between host and event service provider unless Bash is explicitly a party in writing.",
|
|
97
|
+
"By accepting, the event service provider agrees that this agreement (or its customized version on the listing) governs marketplace bookings through Bash."
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
export type PartnerBookingServicePick = Pick<
|
|
101
|
+
ServiceExt,
|
|
102
|
+
| "vendor"
|
|
103
|
+
| "exhibitor"
|
|
104
|
+
| "sponsor"
|
|
105
|
+
| "venue"
|
|
106
|
+
| "entertainmentService"
|
|
107
|
+
| "eventService"
|
|
108
|
+
>;
|
|
109
|
+
|
|
110
|
+
export function getStandardPartnerBookingAgreement(
|
|
111
|
+
role: PartnerBookingAgreementRole
|
|
112
|
+
): string {
|
|
113
|
+
switch (role) {
|
|
114
|
+
case "vendor":
|
|
115
|
+
return STANDARD_VENDOR_BOOKING_AGREEMENT;
|
|
116
|
+
case "exhibitor":
|
|
117
|
+
return STANDARD_EXHIBITOR_BOOKING_AGREEMENT;
|
|
118
|
+
case "sponsor":
|
|
119
|
+
return STANDARD_SPONSOR_BOOKING_AGREEMENT;
|
|
120
|
+
case "venue":
|
|
121
|
+
return STANDARD_VENUE_BOOKING_AGREEMENT;
|
|
122
|
+
case "entertainment":
|
|
123
|
+
return STANDARD_ENTERTAINMENT_BOOKING_AGREEMENT;
|
|
124
|
+
case "eventService":
|
|
125
|
+
return STANDARD_EVENT_SERVICE_BOOKING_AGREEMENT;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export function partnerBookingAgreementRoleLabel(
|
|
130
|
+
role: PartnerBookingAgreementRole
|
|
131
|
+
): string {
|
|
132
|
+
switch (role) {
|
|
133
|
+
case "vendor":
|
|
134
|
+
return "vendor";
|
|
135
|
+
case "exhibitor":
|
|
136
|
+
return "exhibitor";
|
|
137
|
+
case "sponsor":
|
|
138
|
+
return "sponsor";
|
|
139
|
+
case "venue":
|
|
140
|
+
return "venue";
|
|
141
|
+
case "entertainment":
|
|
142
|
+
return "entertainment";
|
|
143
|
+
case "eventService":
|
|
144
|
+
return "event service";
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export function partnerBookingAgreementTitle(role: PartnerBookingAgreementRole): string {
|
|
149
|
+
switch (role) {
|
|
150
|
+
case "vendor":
|
|
151
|
+
return "Vendor booking agreement";
|
|
152
|
+
case "exhibitor":
|
|
153
|
+
return "Exhibitor booking agreement";
|
|
154
|
+
case "sponsor":
|
|
155
|
+
return "Sponsor booking agreement";
|
|
156
|
+
case "venue":
|
|
157
|
+
return "Venue booking agreement";
|
|
158
|
+
case "entertainment":
|
|
159
|
+
return "Entertainment booking agreement";
|
|
160
|
+
case "eventService":
|
|
161
|
+
return "Event service booking agreement";
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export type PartnerBookingAgreementDiffLineKind =
|
|
166
|
+
| "unchanged"
|
|
167
|
+
| "removed"
|
|
168
|
+
| "added"
|
|
169
|
+
| "changed";
|
|
170
|
+
|
|
171
|
+
export type PartnerBookingAgreementDiffLine = {
|
|
172
|
+
kind: PartnerBookingAgreementDiffLineKind;
|
|
173
|
+
standardLine?: string;
|
|
174
|
+
customLine?: string;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
export function normalizePartnerBookingAgreementText(text: string): string {
|
|
178
|
+
return normalizeVendorBookingAgreementText(text);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export function getPartnerBookingAgreementDisplayText(
|
|
182
|
+
storedText: string | null | undefined,
|
|
183
|
+
role: PartnerBookingAgreementRole
|
|
184
|
+
): string {
|
|
185
|
+
if (role === "vendor") {
|
|
186
|
+
return getVendorBookingAgreementDisplayText(storedText);
|
|
187
|
+
}
|
|
188
|
+
const trimmed = storedText?.trim();
|
|
189
|
+
if (trimmed) {
|
|
190
|
+
return trimmed;
|
|
191
|
+
}
|
|
192
|
+
return getStandardPartnerBookingAgreement(role);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export function isPartnerBookingAgreementCustomized(
|
|
196
|
+
storedText: string | null | undefined,
|
|
197
|
+
storedFlag: boolean | null | undefined,
|
|
198
|
+
role: PartnerBookingAgreementRole
|
|
199
|
+
): boolean {
|
|
200
|
+
if (role === "vendor") {
|
|
201
|
+
return isVendorBookingAgreementCustomized(storedText, storedFlag);
|
|
202
|
+
}
|
|
203
|
+
if (storedFlag === true) {
|
|
204
|
+
return true;
|
|
205
|
+
}
|
|
206
|
+
if (!storedText?.trim()) {
|
|
207
|
+
return false;
|
|
208
|
+
}
|
|
209
|
+
return (
|
|
210
|
+
normalizePartnerBookingAgreementText(storedText) !==
|
|
211
|
+
normalizePartnerBookingAgreementText(getStandardPartnerBookingAgreement(role))
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export function resolvePartnerBookingAgreementForSave(
|
|
216
|
+
editedText: string,
|
|
217
|
+
role: Exclude<PartnerBookingAgreementRole, "vendor">
|
|
218
|
+
): {
|
|
219
|
+
partnerBookingAgreementText: string | null;
|
|
220
|
+
partnerBookingAgreementCustomized: boolean;
|
|
221
|
+
} {
|
|
222
|
+
const normalized = normalizePartnerBookingAgreementText(editedText);
|
|
223
|
+
const standard = normalizePartnerBookingAgreementText(
|
|
224
|
+
getStandardPartnerBookingAgreement(role)
|
|
225
|
+
);
|
|
226
|
+
if (normalized === standard) {
|
|
227
|
+
return {
|
|
228
|
+
partnerBookingAgreementText: null,
|
|
229
|
+
partnerBookingAgreementCustomized: false,
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
return {
|
|
233
|
+
partnerBookingAgreementText: normalized,
|
|
234
|
+
partnerBookingAgreementCustomized: true,
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export function diffPartnerBookingAgreement(
|
|
239
|
+
standardText: string,
|
|
240
|
+
customText: string
|
|
241
|
+
): PartnerBookingAgreementDiffLine[] {
|
|
242
|
+
const standardLines = normalizePartnerBookingAgreementText(standardText).split(
|
|
243
|
+
"\n"
|
|
244
|
+
);
|
|
245
|
+
const customLines = normalizePartnerBookingAgreementText(customText).split("\n");
|
|
246
|
+
const result: PartnerBookingAgreementDiffLine[] = [];
|
|
247
|
+
let i = 0;
|
|
248
|
+
let j = 0;
|
|
249
|
+
|
|
250
|
+
while (i < standardLines.length || j < customLines.length) {
|
|
251
|
+
const standardLine = standardLines[i];
|
|
252
|
+
const customLine = customLines[j];
|
|
253
|
+
|
|
254
|
+
if (i >= standardLines.length) {
|
|
255
|
+
result.push({ kind: "added", customLine });
|
|
256
|
+
j += 1;
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
if (j >= customLines.length) {
|
|
260
|
+
result.push({ kind: "removed", standardLine });
|
|
261
|
+
i += 1;
|
|
262
|
+
continue;
|
|
263
|
+
}
|
|
264
|
+
if (standardLine === customLine) {
|
|
265
|
+
result.push({ kind: "unchanged", standardLine, customLine });
|
|
266
|
+
i += 1;
|
|
267
|
+
j += 1;
|
|
268
|
+
continue;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
const standardRemainder = standardLines.slice(i + 1);
|
|
272
|
+
const customRemainder = customLines.slice(j + 1);
|
|
273
|
+
const customAppearsLater = standardRemainder.includes(customLine);
|
|
274
|
+
const standardAppearsLater = customRemainder.includes(standardLine);
|
|
275
|
+
|
|
276
|
+
if (customAppearsLater && !standardAppearsLater) {
|
|
277
|
+
result.push({ kind: "removed", standardLine });
|
|
278
|
+
i += 1;
|
|
279
|
+
continue;
|
|
280
|
+
}
|
|
281
|
+
if (standardAppearsLater && !customAppearsLater) {
|
|
282
|
+
result.push({ kind: "added", customLine });
|
|
283
|
+
j += 1;
|
|
284
|
+
continue;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
result.push({ kind: "changed", standardLine, customLine });
|
|
288
|
+
i += 1;
|
|
289
|
+
j += 1;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
return result;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
export function partnerBookingAgreementDiffHasChanges(
|
|
296
|
+
lines: PartnerBookingAgreementDiffLine[]
|
|
297
|
+
): boolean {
|
|
298
|
+
return lines.some((line) => line.kind !== "unchanged");
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
export type PartnerBookingAgreementSnapshot = {
|
|
302
|
+
role: PartnerBookingAgreementRole;
|
|
303
|
+
roleLabel: string;
|
|
304
|
+
accepts: boolean;
|
|
305
|
+
displayText: string;
|
|
306
|
+
customized: boolean;
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
/** Agreement on file for marketplace service subtypes. */
|
|
310
|
+
export function readPartnerBookingAgreementFromService(
|
|
311
|
+
service: PartnerBookingServicePick
|
|
312
|
+
): PartnerBookingAgreementSnapshot | null {
|
|
313
|
+
if (service.vendor) {
|
|
314
|
+
const prefs = service.vendor.preferences;
|
|
315
|
+
return {
|
|
316
|
+
role: "vendor",
|
|
317
|
+
roleLabel: partnerBookingAgreementRoleLabel("vendor"),
|
|
318
|
+
accepts: prefs?.acceptsVendorBookingTerms !== false,
|
|
319
|
+
displayText: getVendorBookingAgreementDisplayText(
|
|
320
|
+
prefs?.vendorBookingAgreementText
|
|
321
|
+
),
|
|
322
|
+
customized: isVendorBookingAgreementCustomized(
|
|
323
|
+
prefs?.vendorBookingAgreementText,
|
|
324
|
+
prefs?.vendorBookingAgreementCustomized
|
|
325
|
+
),
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
if (service.exhibitor) {
|
|
329
|
+
const ex = service.exhibitor;
|
|
330
|
+
return {
|
|
331
|
+
role: "exhibitor",
|
|
332
|
+
roleLabel: partnerBookingAgreementRoleLabel("exhibitor"),
|
|
333
|
+
accepts: ex.acceptsPartnerBookingTerms !== false,
|
|
334
|
+
displayText: getPartnerBookingAgreementDisplayText(
|
|
335
|
+
ex.partnerBookingAgreementText,
|
|
336
|
+
"exhibitor"
|
|
337
|
+
),
|
|
338
|
+
customized: isPartnerBookingAgreementCustomized(
|
|
339
|
+
ex.partnerBookingAgreementText,
|
|
340
|
+
ex.partnerBookingAgreementCustomized,
|
|
341
|
+
"exhibitor"
|
|
342
|
+
),
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
if (service.sponsor) {
|
|
346
|
+
const sp = service.sponsor;
|
|
347
|
+
return {
|
|
348
|
+
role: "sponsor",
|
|
349
|
+
roleLabel: partnerBookingAgreementRoleLabel("sponsor"),
|
|
350
|
+
accepts: sp.acceptsPartnerBookingTerms !== false,
|
|
351
|
+
displayText: getPartnerBookingAgreementDisplayText(
|
|
352
|
+
sp.partnerBookingAgreementText,
|
|
353
|
+
"sponsor"
|
|
354
|
+
),
|
|
355
|
+
customized: isPartnerBookingAgreementCustomized(
|
|
356
|
+
sp.partnerBookingAgreementText,
|
|
357
|
+
sp.partnerBookingAgreementCustomized,
|
|
358
|
+
"sponsor"
|
|
359
|
+
),
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
if (service.venue) {
|
|
363
|
+
const venue = service.venue;
|
|
364
|
+
return {
|
|
365
|
+
role: "venue",
|
|
366
|
+
roleLabel: partnerBookingAgreementRoleLabel("venue"),
|
|
367
|
+
accepts: venue.acceptsPartnerBookingTerms !== false,
|
|
368
|
+
displayText: getPartnerBookingAgreementDisplayText(
|
|
369
|
+
venue.partnerBookingAgreementText,
|
|
370
|
+
"venue"
|
|
371
|
+
),
|
|
372
|
+
customized: isPartnerBookingAgreementCustomized(
|
|
373
|
+
venue.partnerBookingAgreementText,
|
|
374
|
+
venue.partnerBookingAgreementCustomized,
|
|
375
|
+
"venue"
|
|
376
|
+
),
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
if (service.entertainmentService) {
|
|
380
|
+
const ent = service.entertainmentService;
|
|
381
|
+
return {
|
|
382
|
+
role: "entertainment",
|
|
383
|
+
roleLabel: partnerBookingAgreementRoleLabel("entertainment"),
|
|
384
|
+
accepts: ent.acceptsPartnerBookingTerms !== false,
|
|
385
|
+
displayText: getPartnerBookingAgreementDisplayText(
|
|
386
|
+
ent.partnerBookingAgreementText,
|
|
387
|
+
"entertainment"
|
|
388
|
+
),
|
|
389
|
+
customized: isPartnerBookingAgreementCustomized(
|
|
390
|
+
ent.partnerBookingAgreementText,
|
|
391
|
+
ent.partnerBookingAgreementCustomized,
|
|
392
|
+
"entertainment"
|
|
393
|
+
),
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
if (service.eventService) {
|
|
397
|
+
const es = service.eventService;
|
|
398
|
+
return {
|
|
399
|
+
role: "eventService",
|
|
400
|
+
roleLabel: partnerBookingAgreementRoleLabel("eventService"),
|
|
401
|
+
accepts: es.acceptsPartnerBookingTerms !== false,
|
|
402
|
+
displayText: getPartnerBookingAgreementDisplayText(
|
|
403
|
+
es.partnerBookingAgreementText,
|
|
404
|
+
"eventService"
|
|
405
|
+
),
|
|
406
|
+
customized: isPartnerBookingAgreementCustomized(
|
|
407
|
+
es.partnerBookingAgreementText,
|
|
408
|
+
es.partnerBookingAgreementCustomized,
|
|
409
|
+
"eventService"
|
|
410
|
+
),
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
return null;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
export function serviceBookingCheckoutTermsComplete(
|
|
417
|
+
agreeToBashTerms: boolean,
|
|
418
|
+
agreeToPartnerAgreement: boolean,
|
|
419
|
+
service: PartnerBookingServicePick
|
|
420
|
+
): boolean {
|
|
421
|
+
if (!agreeToBashTerms) {
|
|
422
|
+
return false;
|
|
423
|
+
}
|
|
424
|
+
const snapshot = readPartnerBookingAgreementFromService(service);
|
|
425
|
+
if (!snapshot) {
|
|
426
|
+
return true;
|
|
427
|
+
}
|
|
428
|
+
return agreeToPartnerAgreement;
|
|
429
|
+
}
|
|
@@ -219,3 +219,57 @@ describe("occurrence exceptions in getRecurringBashEventPossibleLuxonTimes", ()
|
|
|
219
219
|
expect(result.map((d) => d.toMillis())).not.toContain(original.toMillis());
|
|
220
220
|
});
|
|
221
221
|
});
|
|
222
|
+
|
|
223
|
+
describe("monthly weekday rules", () => {
|
|
224
|
+
it("generates first Thursdays across the year boundary", () => {
|
|
225
|
+
const start = DateTime.local(2026, 11, 5, 19);
|
|
226
|
+
const recurrence = buildRecurrence({ frequency: RecurringFrequency.Monthly, repeatOnDays: ["Thursday"], repeatOnDayOfMonth: null, repeatCount: 3, ends: new Date(2027, 1, 1) });
|
|
227
|
+
expect(getRecurringBashEventPossibleLuxonTimes(start.toJSDate(), recurrence).map(date => date.toISODate())).toEqual(["2026-11-05", "2026-12-03", "2027-01-07"]);
|
|
228
|
+
});
|
|
229
|
+
it("skips months without a fifth weekday rather than overflowing", () => {
|
|
230
|
+
const start = DateTime.local(2027, 1, 29, 19);
|
|
231
|
+
const recurrence = buildRecurrence({ frequency: RecurringFrequency.Monthly, repeatOnDays: ["Friday"], repeatOnDayOfMonth: null, repeatCount: 3, ends: new Date(2027, 7, 1) });
|
|
232
|
+
expect(getRecurringBashEventPossibleLuxonTimes(start.toJSDate(), recurrence).map(date => date.toISODate())).toEqual(["2027-01-29", "2027-04-30", "2027-07-30"]);
|
|
233
|
+
});
|
|
234
|
+
it("keeps explicit day-of-month rules unchanged", () => {
|
|
235
|
+
const start = DateTime.local(2026, 11, 5, 19);
|
|
236
|
+
const recurrence = buildRecurrence({ frequency: RecurringFrequency.Monthly, repeatOnDayOfMonth: 5, repeatCount: 3, ends: new Date(2027, 1, 1) });
|
|
237
|
+
expect(getRecurringBashEventPossibleLuxonTimes(start.toJSDate(), recurrence).map(date => date.toISODate())).toEqual(["2026-11-05", "2026-12-05", "2027-01-05"]);
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
describe("calendar edge cases in the event timezone", () => {
|
|
242
|
+
it("keeps Jan 31 monthly anchored after February", () => {
|
|
243
|
+
const start = DateTime.fromISO("2027-01-31T19:00", { zone: "America/Denver" });
|
|
244
|
+
const rule = buildRecurrence({ frequency: RecurringFrequency.Monthly, repeatOnDayOfMonth: 31, repeatCount: 3 });
|
|
245
|
+
expect(getRecurringBashEventPossibleLuxonTimes(start.toJSDate(), rule, "America/Denver").map(date => date.toISODate())).toEqual(["2027-01-31", "2027-02-28", "2027-03-31"]);
|
|
246
|
+
});
|
|
247
|
+
it("skips non-leap years for a Feb 29 annual rule", () => {
|
|
248
|
+
const start = DateTime.fromISO("2028-02-29T19:00", { zone: "America/Denver" });
|
|
249
|
+
const rule = buildRecurrence({ frequency: RecurringFrequency.Yearly, repeatYearlyDate: start.toJSDate(), repeatCount: null, ends: DateTime.fromISO("2032-12-31", { zone: "America/Denver" }).toJSDate() });
|
|
250
|
+
expect(getRecurringBashEventPossibleLuxonTimes(start.toJSDate(), rule, "America/Denver").map(date => date.toFormat("yyyy-MM-dd HH:mm"))).toEqual(["2028-02-29 19:00", "2032-02-29 19:00"]);
|
|
251
|
+
});
|
|
252
|
+
it.each(["2027-03-13T19:00", "2027-11-06T19:00"])("keeps daily wall-clock times across DST starting %s", iso => {
|
|
253
|
+
const start = DateTime.fromISO(iso, { zone: "America/New_York" });
|
|
254
|
+
const rule = buildRecurrence({ frequency: RecurringFrequency.Daily, repeatCount: 3 });
|
|
255
|
+
const dates = getRecurringBashEventPossibleLuxonTimes(start.toJSDate(), rule, "America/New_York");
|
|
256
|
+
expect(dates.map(date => date.hour)).toEqual([19, 19, 19]);
|
|
257
|
+
expect(dates[0].offset).not.toBe(dates[2].offset);
|
|
258
|
+
});
|
|
259
|
+
it("normalizes a skipped hour only on the DST transition day", () => {
|
|
260
|
+
const start = DateTime.fromISO("2027-03-13T02:30", { zone: "America/New_York" });
|
|
261
|
+
const rule = buildRecurrence({ frequency: RecurringFrequency.Daily, repeatCount: 3 });
|
|
262
|
+
expect(getRecurringBashEventPossibleLuxonTimes(start.toJSDate(), rule, "America/New_York").map(date => date.toFormat("MM-dd HH:mm"))).toEqual(["03-13 02:30", "03-14 03:30", "03-15 02:30"]);
|
|
263
|
+
});
|
|
264
|
+
it("keeps past-midnight daily starts on their calendar days", () => {
|
|
265
|
+
const start = DateTime.fromISO("2027-03-13T23:00", { zone: "America/Denver" });
|
|
266
|
+
const rule = buildRecurrence({ frequency: RecurringFrequency.Daily, repeatCount: 3 });
|
|
267
|
+
expect(getRecurringBashEventPossibleLuxonTimes(start.toJSDate(), rule, "America/Denver").map(date => date.toFormat("MM-dd HH:mm"))).toEqual(["03-13 23:00", "03-14 23:00", "03-15 23:00"]);
|
|
268
|
+
});
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
it("keeps a Jan 31 fifth-Sunday preset on fifth Sundays", () => {
|
|
272
|
+
const start = DateTime.fromISO("2027-01-31T19:00", { zone: "America/Denver" });
|
|
273
|
+
const rule = buildRecurrence({ frequency: RecurringFrequency.Monthly, repeatOnDayOfMonth: null, repeatOnDays: ["Sunday"], repeatCount: 3 });
|
|
274
|
+
expect(getRecurringBashEventPossibleLuxonTimes(start.toJSDate(), rule, "America/Denver").map(date => date.toISODate())).toEqual(["2027-01-31", "2027-05-30", "2027-08-29"]);
|
|
275
|
+
});
|
|
@@ -218,6 +218,25 @@ describe("parseBashUrlParams", () => {
|
|
|
218
218
|
slug: "game-night",
|
|
219
219
|
});
|
|
220
220
|
});
|
|
221
|
+
|
|
222
|
+
test("legacy id-slug with hyphens in id uses first dash when head is short", () => {
|
|
223
|
+
expect(parseBashUrlParams("abc-123-summer-bash")).toEqual({
|
|
224
|
+
id: "abc",
|
|
225
|
+
slug: "123-summer-bash",
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
test("single-dash id-slug with long id head", () => {
|
|
230
|
+
const longId = "a".repeat(100);
|
|
231
|
+
expect(parseBashUrlParams(`${longId}-slug`)).toEqual({
|
|
232
|
+
id: longId,
|
|
233
|
+
slug: "slug",
|
|
234
|
+
});
|
|
235
|
+
expect(parseBashUrlParams("abc_123-slug")).toEqual({
|
|
236
|
+
id: "abc_123",
|
|
237
|
+
slug: "slug",
|
|
238
|
+
});
|
|
239
|
+
});
|
|
221
240
|
});
|
|
222
241
|
|
|
223
242
|
describe("validateSlug", () => {
|