@wodira/browser 1.1.0 → 1.2.1
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/CHANGELOG.md +24 -1
- package/README.md +106 -1
- package/dist/index.cjs +36 -0
- package/dist/index.d.ts +90 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +36 -0
- package/dist/types.d.ts +3 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/ui/boxes/cdn.js +15 -15
- package/dist/ui/components.d.ts +18 -1
- package/dist/ui/components.d.ts.map +1 -1
- package/dist/ui/events.d.ts +1 -1
- package/dist/ui/events.d.ts.map +1 -1
- package/dist/ui/i18n.d.ts +1 -1
- package/dist/ui/i18n.d.ts.map +1 -1
- package/dist/ui/{index-tfej862z.js → index-1zshfsk6.js} +45 -1563
- package/dist/ui/index-3qe91gk8.js +1625 -0
- package/dist/ui/index-bjb0t7yn.js +1624 -0
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +290 -125
- package/dist/ui/map-view-rn3jgtqn.js +28737 -0
- package/dist/ui/maplibre-gl-worker.mjs +10 -0
- package/dist/ui/route-3d/cdn.d.ts +2 -0
- package/dist/ui/route-3d/cdn.d.ts.map +1 -0
- package/dist/ui/route-3d/cdn.js +1527 -0
- package/dist/ui/route-3d/gpx.d.ts +14 -0
- package/dist/ui/route-3d/gpx.d.ts.map +1 -0
- package/dist/ui/route-3d/index.d.ts +12 -0
- package/dist/ui/route-3d/index.d.ts.map +1 -0
- package/dist/ui/route-3d/index.js +16 -0
- package/dist/ui/route-3d/map-view.d.ts +73 -0
- package/dist/ui/route-3d/map-view.d.ts.map +1 -0
- package/dist/ui/route-3d/maplibre-gl-worker.mjs +10 -0
- package/dist/ui/route-3d/route-3d.d.ts +168 -0
- package/dist/ui/route-3d/route-3d.d.ts.map +1 -0
- package/dist/ui/route-3d/route-geo.d.ts +77 -0
- package/dist/ui/route-3d/route-geo.d.ts.map +1 -0
- package/dist/ui/shirt-sponsors/cdn.js +29 -27
- package/dist/ui/shirt-sponsors/index.js +5 -3
- package/dist/ui/shirt-sponsors/shirt-auction.d.ts +19 -0
- package/dist/ui/shirt-sponsors/shirt-auction.d.ts.map +1 -1
- package/package.json +15 -6
package/dist/ui/index.js
CHANGED
|
@@ -6,12 +6,18 @@ import {
|
|
|
6
6
|
nothing,
|
|
7
7
|
LitElement,
|
|
8
8
|
WodiraBrowserApiError,
|
|
9
|
-
createWodiraBrowserClient
|
|
9
|
+
createWodiraBrowserClient
|
|
10
|
+
} from "./index-1zshfsk6.js";
|
|
11
|
+
import {
|
|
10
12
|
wodiraUiStyles,
|
|
11
13
|
WodiraShirtAuction2,
|
|
12
14
|
defineWodiraShirtElements2
|
|
13
|
-
} from "./index-
|
|
14
|
-
|
|
15
|
+
} from "./index-bjb0t7yn.js";
|
|
16
|
+
import {
|
|
17
|
+
WodiraRoute3d2,
|
|
18
|
+
defineWodiraRouteElements2
|
|
19
|
+
} from "./index-3qe91gk8.js";
|
|
20
|
+
__chunks(import.meta.url,["2fc5rhxg","1zshfsk6","bjb0t7yn","3qe91gk8","jyks1h8f","rn3jgtqn","xdhg885t"],[["./index.js",1,2,3],["./index-1zshfsk6.js"],["./index-bjb0t7yn.js",1],["./index-3qe91gk8.js",1],["./shirt-3d-renderer-jyks1h8f.js",6],["./map-view-rn3jgtqn.js",3],["./index-xdhg885t.js"]],0);
|
|
15
21
|
|
|
16
22
|
// ../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/iso.js
|
|
17
23
|
var exports_iso = {};
|
|
@@ -117,6 +123,7 @@ var es = {
|
|
|
117
123
|
male: "Masculino",
|
|
118
124
|
phone: "Teléfono",
|
|
119
125
|
participantSlot: "Plaza",
|
|
126
|
+
participant: "Participante",
|
|
120
127
|
noPublishableKey: "Configura publishable-key.",
|
|
121
128
|
processingFee: "Fee procesamiento Stripe",
|
|
122
129
|
promocode: "Código promocional",
|
|
@@ -141,9 +148,12 @@ var es = {
|
|
|
141
148
|
select: "Seleccionar",
|
|
142
149
|
selectCategory: "Selecciona una categoría.",
|
|
143
150
|
selectEvent: "Ver inscripciones",
|
|
151
|
+
yesAnswer: "Sí",
|
|
152
|
+
noAnswer: "No",
|
|
144
153
|
selectOption: "Seleccionar",
|
|
145
154
|
summary: "Resumen",
|
|
146
155
|
teamName: "Nombre del dorsal/equipo",
|
|
156
|
+
bibName: "Nombre del dorsal",
|
|
147
157
|
teamSize: "Equipo de",
|
|
148
158
|
tierTicketsFrom: "Desde la inscripción",
|
|
149
159
|
tierTicketsRange: "Inscripciones",
|
|
@@ -244,6 +254,7 @@ var en = {
|
|
|
244
254
|
male: "Male",
|
|
245
255
|
phone: "Phone",
|
|
246
256
|
participantSlot: "Slot",
|
|
257
|
+
participant: "Participant",
|
|
247
258
|
noPublishableKey: "Configure publishable-key.",
|
|
248
259
|
processingFee: "Stripe processing fee",
|
|
249
260
|
promocode: "Promo code",
|
|
@@ -268,9 +279,12 @@ var en = {
|
|
|
268
279
|
select: "Select",
|
|
269
280
|
selectCategory: "Select a category.",
|
|
270
281
|
selectEvent: "View registrations",
|
|
282
|
+
yesAnswer: "Yes",
|
|
283
|
+
noAnswer: "No",
|
|
271
284
|
selectOption: "Select",
|
|
272
285
|
summary: "Summary",
|
|
273
286
|
teamName: "Bib/team name",
|
|
287
|
+
bibName: "Bib name",
|
|
274
288
|
teamSize: "Team of",
|
|
275
289
|
tierTicketsFrom: "From registration",
|
|
276
290
|
tierTicketsRange: "Registrations",
|
|
@@ -424,7 +438,7 @@ class WodiraSignaturePad extends LitElement {
|
|
|
424
438
|
}));
|
|
425
439
|
}
|
|
426
440
|
}
|
|
427
|
-
// ../../node_modules/.pnpm/@wodira+common@file+packages+common_@wodira+db@file+packages+database_@typescript+
|
|
441
|
+
// ../../node_modules/.pnpm/@wodira+common@file+packages+common_@wodira+db@file+packages+database_@typescript+types_7099b171df80daee011599dba9f7981d/node_modules/@wodira/common/dist/email-validation.js
|
|
428
442
|
var COMMON_EMAIL_DOMAINS = [
|
|
429
443
|
"gmail.com",
|
|
430
444
|
"outlook.com",
|
|
@@ -486,7 +500,7 @@ function suggestEmailCorrection(email) {
|
|
|
486
500
|
return null;
|
|
487
501
|
return `${value.slice(0, value.lastIndexOf("@"))}@${candidates[0]}`;
|
|
488
502
|
}
|
|
489
|
-
// ../../node_modules/.pnpm/@wodira+common@file+packages+common_@wodira+db@file+packages+database_@typescript+
|
|
503
|
+
// ../../node_modules/.pnpm/@wodira+common@file+packages+common_@wodira+db@file+packages+database_@typescript+types_7099b171df80daee011599dba9f7981d/node_modules/@wodira/common/dist/browser-modules/event-waivers.js
|
|
490
504
|
function applicableEventWaivers(waivers, categoryIds) {
|
|
491
505
|
const selected = new Set(typeof categoryIds === "string" ? [categoryIds] : categoryIds ?? []);
|
|
492
506
|
return waivers.filter((waiver) => {
|
|
@@ -6337,7 +6351,7 @@ function time2(params) {
|
|
|
6337
6351
|
function duration2(params) {
|
|
6338
6352
|
return _isoDuration(ZodISODuration, params);
|
|
6339
6353
|
}
|
|
6340
|
-
// ../../node_modules/.pnpm/@wodira+common@file+packages+common_@wodira+db@file+packages+database_@typescript+
|
|
6354
|
+
// ../../node_modules/.pnpm/@wodira+common@file+packages+common_@wodira+db@file+packages+database_@typescript+types_7099b171df80daee011599dba9f7981d/node_modules/@wodira/common/dist/browser-modules/validators/phone.validator.js
|
|
6341
6355
|
var E164_PHONE_PATTERN = /^\+[1-9]\d{6,14}$/;
|
|
6342
6356
|
var E164_VISUAL_SEPARATOR_PATTERN = /[\s().-]/g;
|
|
6343
6357
|
function normalizeE164Phone(value) {
|
|
@@ -6351,7 +6365,7 @@ var OptionalE164PhoneValidator = preprocess((value) => {
|
|
|
6351
6365
|
return normalized === "" ? "" : normalized;
|
|
6352
6366
|
}, E164PhoneValidator.optional().or(literal("")));
|
|
6353
6367
|
|
|
6354
|
-
// ../../node_modules/.pnpm/@wodira+common@file+packages+common_@wodira+db@file+packages+database_@typescript+
|
|
6368
|
+
// ../../node_modules/.pnpm/@wodira+common@file+packages+common_@wodira+db@file+packages+database_@typescript+types_7099b171df80daee011599dba9f7981d/node_modules/@wodira/common/dist/browser-modules/validators/commons.validators.js
|
|
6355
6369
|
var SortOrderEnum = _enum(["asc", "desc"]).describe("Sort Order Enum schema.");
|
|
6356
6370
|
var GenderEnum = _enum(["MALE", "FEMALE"]).describe("Gender Enum schema.");
|
|
6357
6371
|
var ActivityLevelEnum = _enum([
|
|
@@ -6473,7 +6487,7 @@ var SpectatorSchema = object({
|
|
|
6473
6487
|
birthDate: exports_iso.date("Spectator birthDate must be a valid date").describe("Birth Date field.")
|
|
6474
6488
|
});
|
|
6475
6489
|
|
|
6476
|
-
// ../../node_modules/.pnpm/@wodira+common@file+packages+common_@wodira+db@file+packages+database_@typescript+
|
|
6490
|
+
// ../../node_modules/.pnpm/@wodira+common@file+packages+common_@wodira+db@file+packages+database_@typescript+types_7099b171df80daee011599dba9f7981d/node_modules/@wodira/common/dist/browser-modules/validators/payment.validator.js
|
|
6477
6491
|
var promotionAttributionSchema = object({
|
|
6478
6492
|
campaignId: string2().min(1, "Campaign ID is required").describe("Campaign Id field."),
|
|
6479
6493
|
sessionId: string2().min(1, "Session ID is required").describe("Session Id field."),
|
|
@@ -6582,13 +6596,18 @@ var legalSignatureSchema = object({
|
|
|
6582
6596
|
var pendingLegalSignatureSchema = union([legalSignatureSchema, object({}).strict().transform(() => {
|
|
6583
6597
|
return;
|
|
6584
6598
|
})]);
|
|
6599
|
+
var registrationConditionAnswersSchema = array(object({
|
|
6600
|
+
fieldId: string2().min(1),
|
|
6601
|
+
value: unknown()
|
|
6602
|
+
})).max(250);
|
|
6603
|
+
var registrationAthleteSchema = AthleteSchema.extend({ customFields: registrationConditionAnswersSchema.optional() });
|
|
6585
6604
|
var guestRegistrationSchema = object({
|
|
6586
6605
|
guestEmail: email2("Guest email must be valid").describe("Guest Email field."),
|
|
6587
6606
|
guestName: string2().min(2, "Guest name is required").describe("Guest Name field."),
|
|
6588
6607
|
categoryId: string2().min(1, "Category ID is required").describe("Category Id field."),
|
|
6589
6608
|
teamName: string2().min(1, "Team name is required").describe("Team Name field."),
|
|
6590
6609
|
club: string2().optional().describe("Club field."),
|
|
6591
|
-
athletes: array(
|
|
6610
|
+
athletes: array(registrationAthleteSchema).min(1, "At least one athlete is required").describe("Athletes field."),
|
|
6592
6611
|
customFields: array(object({
|
|
6593
6612
|
fieldId: string2().min(1, "Field ID is required").describe("Field Id field."),
|
|
6594
6613
|
value: any().describe("Value field.")
|
|
@@ -6606,7 +6625,7 @@ var buyEventAthleteTicketBaseSchema = object({
|
|
|
6606
6625
|
promocode: string2().uppercase().optional().describe("Promocode field."),
|
|
6607
6626
|
referralCode: string2().trim().max(20).optional().describe("Referral code from a friend link (Invita a tus amigos)."),
|
|
6608
6627
|
useReferralCredit: boolean2().optional().describe("Spend referral credit on this checkout."),
|
|
6609
|
-
athletes: array(
|
|
6628
|
+
athletes: array(registrationAthleteSchema).min(1, "At least one athlete is required").describe("Athletes field."),
|
|
6610
6629
|
deferredTeamCompletion: deferredTeamCompletionSchema.optional().describe("Participant places that will be completed after payment."),
|
|
6611
6630
|
products: array(object({
|
|
6612
6631
|
productId: string2().min(1, "Product ID is required").describe("Product Id field."),
|
|
@@ -6637,11 +6656,13 @@ var buyEventAthleteTicketSchema = buyEventAthleteTicketBaseSchema.superRefine((v
|
|
|
6637
6656
|
});
|
|
6638
6657
|
});
|
|
6639
6658
|
var guestRegistrationSummaryInputSchema = object({
|
|
6659
|
+
participantCustomFields: array(registrationConditionAnswersSchema).max(100).optional(),
|
|
6640
6660
|
categoryId: string2().min(1, "Category ID is required").describe("Category Id field."),
|
|
6641
6661
|
selectedSupplementIds: array(string2()).optional().describe("Selected Supplement Ids field."),
|
|
6642
6662
|
supplementSelections: array(supplementSelectionSchema).optional().describe("Supplement Selections field.")
|
|
6643
6663
|
});
|
|
6644
6664
|
var getBuyAthleteTicketSummarySchema = object({
|
|
6665
|
+
participantCustomFields: array(registrationConditionAnswersSchema).max(100).optional(),
|
|
6645
6666
|
previewToken: string2().trim().min(1).optional().describe("Event preview token."),
|
|
6646
6667
|
categoryId: string2().min(1, "Category ID is required").describe("Category Id field."),
|
|
6647
6668
|
products: array(object({
|
|
@@ -6719,7 +6740,8 @@ var buyAthleteTicketSummaryResponseSchema = object({
|
|
|
6719
6740
|
unavailableReason: _enum([
|
|
6720
6741
|
"INDIVIDUAL_CATEGORY",
|
|
6721
6742
|
"SIGNATURE_REQUIRED",
|
|
6722
|
-
"DEADLINE_PASSED"
|
|
6743
|
+
"DEADLINE_PASSED",
|
|
6744
|
+
"CONDITIONAL_ITEMS"
|
|
6723
6745
|
]).optional()
|
|
6724
6746
|
}).optional().describe("Deferred team participant completion availability."),
|
|
6725
6747
|
referralDiscount: number2().min(0).default(0),
|
|
@@ -6892,7 +6914,7 @@ var boxInvoiceListItemSchema = object({
|
|
|
6892
6914
|
receiptNumber: string2().nullable().optional().describe("Manual operation receipt number.")
|
|
6893
6915
|
}).describe("A single row in the organizer box invoices list.");
|
|
6894
6916
|
var claimGuestRegistrationSchema = object({ claimToken: string2().min(1, "Claim token is required").describe("Claim Token field.") });
|
|
6895
|
-
// ../../node_modules/.pnpm/@wodira+common@file+packages+common_@wodira+db@file+packages+database_@typescript+
|
|
6917
|
+
// ../../node_modules/.pnpm/@wodira+common@file+packages+common_@wodira+db@file+packages+database_@typescript+types_7099b171df80daee011599dba9f7981d/node_modules/@wodira/common/dist/browser-modules/validators/event-form-answer.validator.js
|
|
6896
6918
|
function eventFormAnswerSchema(field) {
|
|
6897
6919
|
const options = field.options ?? [];
|
|
6898
6920
|
let schema;
|
|
@@ -6918,6 +6940,11 @@ function eventFormAnswerSchema(field) {
|
|
|
6918
6940
|
}
|
|
6919
6941
|
return preprocess((value) => value === null || value === undefined || typeof value === "string" && !value.trim() || Array.isArray(value) && !value.length ? undefined : value, field.isRequired ? schema : schema.optional());
|
|
6920
6942
|
}
|
|
6943
|
+
// ../../node_modules/.pnpm/@wodira+common@file+packages+common_@wodira+db@file+packages+database_@typescript+types_7099b171df80daee011599dba9f7981d/node_modules/@wodira/common/dist/browser-modules/registration-visibility.js
|
|
6944
|
+
function matchesRegistrationVisibilityCondition(condition, participants = []) {
|
|
6945
|
+
return condition == null || participants.some((answers) => answers.some(({ fieldId, value }) => fieldId === condition.fieldId && value === condition.value));
|
|
6946
|
+
}
|
|
6947
|
+
|
|
6921
6948
|
// src/ui/events.ts
|
|
6922
6949
|
function emitWodiraEvent(target, name, detail) {
|
|
6923
6950
|
target.dispatchEvent(new CustomEvent(name, {
|
|
@@ -8217,6 +8244,7 @@ class WodiraPricingCards extends RegistrationWindowElement {
|
|
|
8217
8244
|
error: { type: String, state: true }
|
|
8218
8245
|
};
|
|
8219
8246
|
didInitialLoad = false;
|
|
8247
|
+
pricingRequest = 0;
|
|
8220
8248
|
constructor() {
|
|
8221
8249
|
super();
|
|
8222
8250
|
this.publishableKey = "";
|
|
@@ -8262,6 +8290,10 @@ class WodiraPricingCards extends RegistrationWindowElement {
|
|
|
8262
8290
|
const selected = this.selectedCategoryId === card.id;
|
|
8263
8291
|
const unavailable = registrationWindowMessage(this.pricing, this.locale) || categoryAvailabilityMessage(card, this.locale);
|
|
8264
8292
|
const remaining = card.quota === null || card.quota === undefined ? null : Math.max(0, card.quota - card.registered);
|
|
8293
|
+
const details = [
|
|
8294
|
+
card.teamSize > 1 ? `${t(this.locale, "teamSize")} ${formatNumber(card.teamSize, this.locale)}` : "",
|
|
8295
|
+
remaining === null ? "" : `${formatNumber(remaining, this.locale)} ${t(this.locale, "availableSlots")}`
|
|
8296
|
+
].filter(Boolean).join(" · ");
|
|
8265
8297
|
return html`
|
|
8266
8298
|
<article part="card pricing-card ${selected ? "selected" : ""}">
|
|
8267
8299
|
<div part="stack">
|
|
@@ -8272,10 +8304,7 @@ class WodiraPricingCards extends RegistrationWindowElement {
|
|
|
8272
8304
|
zeroAsFree: true
|
|
8273
8305
|
})}
|
|
8274
8306
|
</div>
|
|
8275
|
-
|
|
8276
|
-
${t(this.locale, "teamSize")}
|
|
8277
|
-
${formatNumber(card.teamSize, this.locale)}${remaining === null ? "" : ` · ${formatNumber(remaining, this.locale)} ${t(this.locale, "availableSlots")}`}
|
|
8278
|
-
</p>
|
|
8307
|
+
${details ? html`<p part="meta">${details}</p>` : nothing}
|
|
8279
8308
|
${this.renderTiers(card, currency)}
|
|
8280
8309
|
${unavailable ? html`<p part="hint availability" role="status">${unavailable}</p>` : nothing}
|
|
8281
8310
|
<button
|
|
@@ -8332,23 +8361,36 @@ class WodiraPricingCards extends RegistrationWindowElement {
|
|
|
8332
8361
|
async loadPricing() {
|
|
8333
8362
|
if (!this.isConnected)
|
|
8334
8363
|
return;
|
|
8335
|
-
|
|
8364
|
+
const request = ++this.pricingRequest;
|
|
8365
|
+
const { publishableKey, baseUrl, eventId } = this;
|
|
8366
|
+
const isCurrent = () => request === this.pricingRequest && publishableKey === this.publishableKey && baseUrl === this.baseUrl && eventId === this.eventId;
|
|
8367
|
+
if (!hasText(publishableKey) || !hasText(eventId)) {
|
|
8368
|
+
this.pricing = undefined;
|
|
8369
|
+
this.loading = false;
|
|
8336
8370
|
return;
|
|
8371
|
+
}
|
|
8337
8372
|
this.loading = true;
|
|
8338
8373
|
this.error = "";
|
|
8339
8374
|
try {
|
|
8340
8375
|
this.validateClientConfig();
|
|
8341
|
-
const client = createClient({
|
|
8342
|
-
|
|
8343
|
-
|
|
8344
|
-
|
|
8345
|
-
this.pricing =
|
|
8376
|
+
const client = createClient({ publishableKey: publishableKey.trim(), baseUrl });
|
|
8377
|
+
const pricing = await client.getPricingCards(eventId.trim());
|
|
8378
|
+
if (!isCurrent())
|
|
8379
|
+
return;
|
|
8380
|
+
this.pricing = pricing;
|
|
8346
8381
|
} catch (error) {
|
|
8382
|
+
if (!isCurrent())
|
|
8383
|
+
return;
|
|
8347
8384
|
this.error = getErrorMessage(error);
|
|
8348
8385
|
emitWodiraEvent(this, "wodira:error", { error, message: this.error });
|
|
8386
|
+
return;
|
|
8349
8387
|
} finally {
|
|
8350
|
-
|
|
8388
|
+
if (isCurrent())
|
|
8389
|
+
this.loading = false;
|
|
8351
8390
|
}
|
|
8391
|
+
await this.updateComplete;
|
|
8392
|
+
if (isCurrent() && this.isConnected)
|
|
8393
|
+
emitWodiraEvent(this, "wodira:pricing-ready", { pricing: this.pricing });
|
|
8352
8394
|
}
|
|
8353
8395
|
selectCategory(category) {
|
|
8354
8396
|
if (registrationWindowMessage(this.pricing, this.locale) || categoryAvailabilityMessage(category, this.locale))
|
|
@@ -8400,6 +8442,7 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
8400
8442
|
completedSession: { state: true }
|
|
8401
8443
|
};
|
|
8402
8444
|
signatureDocumentKey = "";
|
|
8445
|
+
nextGuestDraftId = 0;
|
|
8403
8446
|
checkoutAttempt;
|
|
8404
8447
|
reviewedFingerprint = "";
|
|
8405
8448
|
summaryRequestId = 0;
|
|
@@ -8454,7 +8497,16 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
8454
8497
|
this.watchRegistrationWindow(this.event);
|
|
8455
8498
|
if (changed.has("eventId") || changed.has("categoryId") || changed.has("publishableKey") || changed.has("baseUrl"))
|
|
8456
8499
|
this.completedSession = undefined;
|
|
8457
|
-
const
|
|
8500
|
+
const waiverEntries = this.waiverEntries;
|
|
8501
|
+
const visibleWaiverKeys = new Set(waiverEntries.map(({ waiver, guest }) => this.waiverAcceptanceKey(waiver, guest)));
|
|
8502
|
+
if (Object.keys(this.waiversAccepted).some((key) => !visibleWaiverKeys.has(key))) {
|
|
8503
|
+
this.waiversAccepted = Object.fromEntries(Object.entries(this.waiversAccepted).filter(([key]) => visibleWaiverKeys.has(key)));
|
|
8504
|
+
}
|
|
8505
|
+
const signatureKey = JSON.stringify(this.signatureWaivers.map((waiver) => [
|
|
8506
|
+
waiver.id,
|
|
8507
|
+
waiver.version,
|
|
8508
|
+
waiver.visibilityCondition ? waiverEntries.filter((entry) => entry.waiver.id === waiver.id).map(({ guest }) => [this.waiverEntryId(guest), guest?.categoryId ?? this.categoryId]) : null
|
|
8509
|
+
]));
|
|
8458
8510
|
if (signatureKey !== this.signatureDocumentKey) {
|
|
8459
8511
|
this.signatureDocumentKey = signatureKey;
|
|
8460
8512
|
this.signatureDraft = {
|
|
@@ -8481,7 +8533,13 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
8481
8533
|
}
|
|
8482
8534
|
if (changed.has("summary") || changed.has("event"))
|
|
8483
8535
|
this.syncDeferredParticipantPositions();
|
|
8484
|
-
|
|
8536
|
+
const previousAthletes = changed.get("athletes");
|
|
8537
|
+
const conditionalAnswersChanged = this.conditionFieldIds(this.categoryId).size > 0 && (changed.has("customFieldValues") || changed.has("pendingParticipantPositions") || changed.has("athletes") && this.athletes.some((athlete, index) => athlete.conditionalFieldValues !== previousAthletes?.[index]?.conditionalFieldValues));
|
|
8538
|
+
if (conditionalAnswersChanged)
|
|
8539
|
+
this.syncRequiredSupplements();
|
|
8540
|
+
if (changed.has("guestRegistrations"))
|
|
8541
|
+
this.syncGuestRegistrations();
|
|
8542
|
+
if (changed.has("categoryId") || changed.has("purchaserEmail") || changed.has("promocode") || changed.has("selectedSupplementIds") || changed.has("supplementSelections") || changed.has("event") || conditionalAnswersChanged || changed.has("guestRegistrations")) {
|
|
8485
8543
|
this.scheduleSummaryLoad();
|
|
8486
8544
|
}
|
|
8487
8545
|
}
|
|
@@ -8517,7 +8575,7 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
8517
8575
|
<div part="grid purchaser-grid">
|
|
8518
8576
|
${this.renderInput(t(this.locale, "buyerName"), "purchaserName", this.purchaserName, "text", true)}
|
|
8519
8577
|
${this.renderInput(t(this.locale, "buyerEmail"), "purchaserEmail", this.purchaserEmail, "email", true)}
|
|
8520
|
-
${this.renderInput(t(this.locale, "teamName"), "teamName", this.teamName, "text", true)}
|
|
8578
|
+
${this.renderInput(t(this.locale, category?.teamSize === 1 ? "bibName" : "teamName"), "teamName", this.teamName, "text", true)}
|
|
8521
8579
|
${this.renderInput(t(this.locale, "club"), "club", this.club, "text", false)}
|
|
8522
8580
|
${this.renderInput(t(this.locale, "promocode"), "promocode", this.promocode, "text", false)}
|
|
8523
8581
|
</div>
|
|
@@ -8566,10 +8624,12 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
8566
8624
|
const category = this.selectedCategory;
|
|
8567
8625
|
if (!category || category.teamSize <= 1)
|
|
8568
8626
|
return false;
|
|
8627
|
+
if (this.conditionFieldIds(category.id).size)
|
|
8628
|
+
return false;
|
|
8569
8629
|
const summaryDecision = this.summary?.categoryId === category.id ? this.summary.teamCompletion : undefined;
|
|
8570
8630
|
if (summaryDecision)
|
|
8571
8631
|
return summaryDecision.available;
|
|
8572
|
-
if (applicableEventWaivers(this.event?.waivers ?? [], category.id).some((waiver) => waiver.requiresSignature))
|
|
8632
|
+
if (applicableEventWaivers(this.event?.waivers ?? [], category.id).some((waiver) => waiver.visibilityCondition == null && waiver.requiresSignature))
|
|
8573
8633
|
return false;
|
|
8574
8634
|
const eventStart = new Date(this.event?.startDate ?? "").getTime();
|
|
8575
8635
|
return Number.isFinite(eventStart) && eventStart - 24 * 60 * 60 * 1000 > Date.now();
|
|
@@ -8580,8 +8640,58 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
8580
8640
|
get activeSupplements() {
|
|
8581
8641
|
return this.getSupplementsForCategory(this.categoryId);
|
|
8582
8642
|
}
|
|
8583
|
-
getSupplementsForCategory(categoryId) {
|
|
8584
|
-
return (this.event?.supplements ?? []).filter((supplement) => supplement.isActive !== false && isSupplementAvailableForCategory(supplement, categoryId));
|
|
8643
|
+
getSupplementsForCategory(categoryId, answers = this.conditionAnswers(categoryId)) {
|
|
8644
|
+
return (this.event?.supplements ?? []).filter((supplement) => supplement.isActive !== false && isSupplementAvailableForCategory(supplement, categoryId) && matchesRegistrationVisibilityCondition(supplement.visibilityCondition, answers));
|
|
8645
|
+
}
|
|
8646
|
+
fieldAnswers(categoryId, values) {
|
|
8647
|
+
return (this.event?.eventFormFields ?? []).flatMap((field) => {
|
|
8648
|
+
const value = values?.[field.id];
|
|
8649
|
+
return !isBlank(value) && isFormFieldTargetAthlete(field) && isFormFieldAvailableForCategory(field, categoryId) ? [{ fieldId: field.id, value }] : [];
|
|
8650
|
+
});
|
|
8651
|
+
}
|
|
8652
|
+
conditionAnswers(categoryId, guest) {
|
|
8653
|
+
const conditionIds = this.conditionFieldIds(categoryId);
|
|
8654
|
+
const answersFor = (values) => this.fieldAnswers(categoryId, values).filter(({ fieldId }) => conditionIds.has(fieldId));
|
|
8655
|
+
const mainAnswers = answersFor(guest ? guest.customFieldValues : this.customFieldValues);
|
|
8656
|
+
const athletes = guest?.athletes ?? this.athletes;
|
|
8657
|
+
return [
|
|
8658
|
+
mainAnswers,
|
|
8659
|
+
...athletes.slice(1).flatMap((athlete, index) => !guest && this.isParticipantDeferred(index + 1) ? [] : [answersFor(athlete.conditionalFieldValues)])
|
|
8660
|
+
];
|
|
8661
|
+
}
|
|
8662
|
+
conditionFieldIds(categoryId) {
|
|
8663
|
+
const eligibleFields = new Set((this.event?.eventFormFields ?? []).filter((field) => isFormFieldTargetAthlete(field) && isFormFieldAvailableForCategory(field, categoryId)).map((field) => field.id));
|
|
8664
|
+
return new Set([
|
|
8665
|
+
...applicableEventWaivers(this.event?.waivers ?? [], categoryId),
|
|
8666
|
+
...(this.event?.supplements ?? []).filter((supplement) => supplement.isActive !== false && isSupplementAvailableForCategory(supplement, categoryId))
|
|
8667
|
+
].flatMap(({ visibilityCondition }) => visibilityCondition && eligibleFields.has(visibilityCondition.fieldId) ? [visibilityCondition.fieldId] : []));
|
|
8668
|
+
}
|
|
8669
|
+
checkoutWaivers(categoryId, guest) {
|
|
8670
|
+
const answers = this.conditionAnswers(categoryId, guest);
|
|
8671
|
+
return applicableEventWaivers(this.event?.waivers ?? [], categoryId).filter((waiver) => matchesRegistrationVisibilityCondition(waiver.visibilityCondition, answers));
|
|
8672
|
+
}
|
|
8673
|
+
get waiverEntries() {
|
|
8674
|
+
return [
|
|
8675
|
+
...this.checkoutWaivers(this.categoryId).map((waiver) => ({ waiver })),
|
|
8676
|
+
...this.guestRegistrations.flatMap((guest) => this.checkoutWaivers(guest.categoryId, guest).map((waiver) => ({ waiver, guest })))
|
|
8677
|
+
];
|
|
8678
|
+
}
|
|
8679
|
+
get visibleWaivers() {
|
|
8680
|
+
return [...new Map(this.waiverEntries.map(({ waiver }) => [waiver.id, waiver])).values()];
|
|
8681
|
+
}
|
|
8682
|
+
isEntryWaiver(waiver) {
|
|
8683
|
+
return waiver.visibilityCondition != null && !waiver.requiresSignature;
|
|
8684
|
+
}
|
|
8685
|
+
waiverEntryId(guest) {
|
|
8686
|
+
if (!guest)
|
|
8687
|
+
return "main";
|
|
8688
|
+
return guest.draftId === undefined ? `guest-index-${this.guestRegistrations.indexOf(guest)}` : `guest-${guest.draftId}`;
|
|
8689
|
+
}
|
|
8690
|
+
waiverAcceptanceKey(waiver, guest) {
|
|
8691
|
+
return this.isEntryWaiver(waiver) ? JSON.stringify([this.waiverEntryId(guest), waiver.id]) : waiver.id;
|
|
8692
|
+
}
|
|
8693
|
+
checkoutWaiverAcceptances(guest) {
|
|
8694
|
+
return Object.fromEntries(this.checkoutWaivers(guest?.categoryId ?? this.categoryId, guest).filter((waiver) => this.waiversAccepted[this.waiverAcceptanceKey(waiver, guest)] === true).map((waiver) => [waiver.id, true]));
|
|
8585
8695
|
}
|
|
8586
8696
|
renderEligibilitySummary(category) {
|
|
8587
8697
|
const messages = this.describeEligibility(category);
|
|
@@ -8632,13 +8742,13 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
8632
8742
|
if (category.genders.length === 1) {
|
|
8633
8743
|
messages.push(this.isEnglish ? `Allowed gender: ${this.genderLabel(allowed[0])}` : `Género permitido: ${this.genderLabel(allowed[0])}`);
|
|
8634
8744
|
}
|
|
8635
|
-
if (compositions.length === 1) {
|
|
8745
|
+
if (category.teamSize > 1 && compositions.length === 1) {
|
|
8636
8746
|
messages.push(`${this.isEnglish ? "Team composition" : "Composición del equipo"}: ${formatGenderComposition(compositions[0], this.locale)}`);
|
|
8637
|
-
} else if (category.genderPolicy === "ALL_SAME") {
|
|
8747
|
+
} else if (category.teamSize > 1 && category.genderPolicy === "ALL_SAME") {
|
|
8638
8748
|
messages.push(this.isEnglish ? "Every athlete must have the same gender." : "Todos los atletas deben tener el mismo género.");
|
|
8639
|
-
} else if (category.genderPolicy === "MINIMUM_ONE_EACH") {
|
|
8749
|
+
} else if (category.teamSize > 1 && category.genderPolicy === "MINIMUM_ONE_EACH") {
|
|
8640
8750
|
messages.push(this.isEnglish ? "The team must include at least one athlete of each allowed gender." : "El equipo debe incluir al menos un atleta de cada género permitido.");
|
|
8641
|
-
} else if (category.genderPolicy === "BALANCED") {
|
|
8751
|
+
} else if (category.teamSize > 1 && category.genderPolicy === "BALANCED") {
|
|
8642
8752
|
messages.push(this.isEnglish ? "No gender may represent more than 60% of the team." : "Ningún género puede representar más del 60 % del equipo.");
|
|
8643
8753
|
}
|
|
8644
8754
|
if (category.minAge != null && category.maxAge != null) {
|
|
@@ -8648,7 +8758,7 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
8648
8758
|
} else if (category.maxAge != null) {
|
|
8649
8759
|
messages.push(this.isEnglish ? `Maximum age on the event date: ${category.maxAge} years.` : `Edad máxima en la fecha del evento: ${category.maxAge} años.`);
|
|
8650
8760
|
}
|
|
8651
|
-
if (category.minimumCombinedAge != null) {
|
|
8761
|
+
if (category.teamSize > 1 && category.minimumCombinedAge != null) {
|
|
8652
8762
|
messages.push(this.isEnglish ? `Minimum combined team age: ${category.minimumCombinedAge} years.` : `Edad mínima combinada del equipo: ${category.minimumCombinedAge} años.`);
|
|
8653
8763
|
}
|
|
8654
8764
|
return messages;
|
|
@@ -8713,6 +8823,7 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
8713
8823
|
}
|
|
8714
8824
|
renderAthlete(athlete, index) {
|
|
8715
8825
|
const category = this.selectedCategory;
|
|
8826
|
+
const isTeam = (category?.teamSize ?? 1) > 1;
|
|
8716
8827
|
const allowedGenders = category ? getAllowedGenders(category) : ["FEMALE", "MALE"];
|
|
8717
8828
|
const slotPlan = this.getGenderSlotPlan(category, this.athletes, this.selectedGenderCompositionIndex);
|
|
8718
8829
|
const genderLocked = this.isGenderSlotLocked(category, slotPlan, index);
|
|
@@ -8721,8 +8832,7 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
8721
8832
|
return html`
|
|
8722
8833
|
<fieldset part="card athlete ${deferred ? "deferred" : ""}">
|
|
8723
8834
|
<legend part="title" id=${`participant-slot-title-${index}`}>
|
|
8724
|
-
${t(this.locale, "participantSlot")}
|
|
8725
|
-
${index + 1}${slotPlan?.[index] ? ` · ${this.genderLabel(slotPlan[index])}` : ""}${index === 0 ? ` · ${t(this.locale, "captain")}` : ""}
|
|
8835
|
+
${isTeam ? `${t(this.locale, "participantSlot")} ${index + 1}` : t(this.locale, "participant")}${slotPlan?.[index] ? ` · ${this.genderLabel(slotPlan[index])}` : ""}${isTeam && index === 0 ? ` · ${t(this.locale, "captain")}` : ""}
|
|
8726
8836
|
</legend>
|
|
8727
8837
|
${this.deferredTeamCompletionAvailable && index > 0 ? html`
|
|
8728
8838
|
<div
|
|
@@ -8761,14 +8871,13 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
8761
8871
|
<span>${t(this.locale, "gender")} *</span>
|
|
8762
8872
|
<select
|
|
8763
8873
|
part="select"
|
|
8764
|
-
.value=${athlete.gender}
|
|
8765
8874
|
?disabled=${genderLocked}
|
|
8766
8875
|
aria-invalid=${this.fieldErrors[genderErrorKey] ? "true" : "false"}
|
|
8767
8876
|
aria-describedby=${this.fieldErrors[genderErrorKey] ? fieldErrorId(genderErrorKey) : nothing}
|
|
8768
8877
|
@change=${(event) => this.updateAthlete(index, "gender", event.target.value)}
|
|
8769
8878
|
>
|
|
8770
8879
|
${allowedGenders.map((gender) => html`
|
|
8771
|
-
<option value=${gender}>
|
|
8880
|
+
<option value=${gender} .selected=${gender === athlete.gender}>
|
|
8772
8881
|
${t(this.locale, gender === "FEMALE" ? "female" : "male")}
|
|
8773
8882
|
</option>
|
|
8774
8883
|
`)}
|
|
@@ -8777,6 +8886,7 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
8777
8886
|
${this.renderFieldError(genderErrorKey)}
|
|
8778
8887
|
</label>
|
|
8779
8888
|
</div>
|
|
8889
|
+
${index > 0 ? this.renderCustomFields(this.categoryId, undefined, index) : nothing}
|
|
8780
8890
|
`}
|
|
8781
8891
|
</fieldset>
|
|
8782
8892
|
`;
|
|
@@ -8805,22 +8915,26 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
8805
8915
|
</div>
|
|
8806
8916
|
`;
|
|
8807
8917
|
}
|
|
8808
|
-
renderCustomFields(categoryId = this.categoryId, guestIndex) {
|
|
8809
|
-
const
|
|
8918
|
+
renderCustomFields(categoryId = this.categoryId, guestIndex, participantIndex) {
|
|
8919
|
+
const conditionIds = this.conditionFieldIds(categoryId);
|
|
8920
|
+
const fields = this.event?.eventFormFields.filter((field) => isFormFieldTargetAthlete(field) && isFormFieldAvailableForCategory(field, categoryId) && (participantIndex === undefined || conditionIds.has(field.id))) ?? [];
|
|
8810
8921
|
if (!fields.length)
|
|
8811
8922
|
return nothing;
|
|
8812
8923
|
return html`
|
|
8813
8924
|
<fieldset part="card custom-fields">
|
|
8814
8925
|
<legend part="title">${t(this.locale, "customFieldsTitle")}</legend>
|
|
8815
8926
|
<div part="grid custom-fields-grid">
|
|
8816
|
-
${fields.map((field) => this.renderCustomField(field, guestIndex))}
|
|
8927
|
+
${fields.map((field) => this.renderCustomField(field, conditionIds.has(field.id), guestIndex, participantIndex))}
|
|
8817
8928
|
</div>
|
|
8818
8929
|
</fieldset>
|
|
8819
8930
|
`;
|
|
8820
8931
|
}
|
|
8821
|
-
renderCustomField(field, guestIndex) {
|
|
8822
|
-
const
|
|
8823
|
-
const
|
|
8932
|
+
renderCustomField(field, drivesVisibility, guestIndex, participantIndex) {
|
|
8933
|
+
const guest = guestIndex === undefined ? undefined : this.guestRegistrations[guestIndex];
|
|
8934
|
+
const athlete = participantIndex === undefined ? undefined : (guest?.athletes ?? this.athletes)[participantIndex];
|
|
8935
|
+
const values = participantIndex === undefined ? guest ? guest.customFieldValues ?? {} : this.customFieldValues : athlete?.conditionalFieldValues ?? {};
|
|
8936
|
+
const errorKey = this.customFieldErrorKey(field.id, guestIndex, participantIndex);
|
|
8937
|
+
const update = (value) => this.updateCustomField(field.id, value, guestIndex, participantIndex);
|
|
8824
8938
|
const id = fieldErrorId(errorKey);
|
|
8825
8939
|
if (field.type === "MULTI_SELECT") {
|
|
8826
8940
|
const selected = Array.isArray(values[field.id]) ? values[field.id] : [];
|
|
@@ -8831,7 +8945,7 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
8831
8945
|
multiple
|
|
8832
8946
|
aria-invalid=${this.fieldErrors[errorKey] ? "true" : "false"}
|
|
8833
8947
|
aria-describedby=${this.fieldErrors[errorKey] ? id : nothing}
|
|
8834
|
-
@change=${(event) =>
|
|
8948
|
+
@change=${(event) => update(Array.from(event.target.selectedOptions, (option) => option.value))}
|
|
8835
8949
|
>
|
|
8836
8950
|
${field.options.map((option) => html`<option value=${option} ?selected=${selected.includes(option)}>${option}</option>`)}</select
|
|
8837
8951
|
>${this.renderFieldError(errorKey)}</label
|
|
@@ -8851,7 +8965,7 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
8851
8965
|
name=${errorKey}
|
|
8852
8966
|
value=${option}
|
|
8853
8967
|
.checked=${values[field.id] === option}
|
|
8854
|
-
@change=${() =>
|
|
8968
|
+
@change=${() => update(option)}
|
|
8855
8969
|
/>${option}</span
|
|
8856
8970
|
></label
|
|
8857
8971
|
>`)}
|
|
@@ -8867,7 +8981,7 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
8867
8981
|
.value=${String(values[field.id] ?? "")}
|
|
8868
8982
|
aria-invalid=${this.fieldErrors[errorKey] ? "true" : "false"}
|
|
8869
8983
|
aria-describedby=${this.fieldErrors[errorKey] ? id : nothing}
|
|
8870
|
-
@change=${(event) =>
|
|
8984
|
+
@change=${(event) => update(event.target.value)}
|
|
8871
8985
|
>
|
|
8872
8986
|
<option value="">${t(this.locale, "selectOption")}</option>
|
|
8873
8987
|
${field.options.map((option) => html`<option value=${option}>${option}</option>`)}
|
|
@@ -8876,6 +8990,28 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
8876
8990
|
</label>
|
|
8877
8991
|
`;
|
|
8878
8992
|
}
|
|
8993
|
+
if (isCheckboxField(field) && drivesVisibility) {
|
|
8994
|
+
return html`
|
|
8995
|
+
<label part="label field custom-field">
|
|
8996
|
+
<span>${field.label}${field.isRequired ? " *" : ""}</span>
|
|
8997
|
+
<select
|
|
8998
|
+
part="select"
|
|
8999
|
+
.value=${typeof values[field.id] === "boolean" ? String(values[field.id]) : ""}
|
|
9000
|
+
aria-invalid=${this.fieldErrors[errorKey] ? "true" : "false"}
|
|
9001
|
+
aria-describedby=${this.fieldErrors[errorKey] ? id : nothing}
|
|
9002
|
+
@change=${(event) => {
|
|
9003
|
+
const value = event.target.value;
|
|
9004
|
+
update(value ? value === "true" : undefined);
|
|
9005
|
+
}}
|
|
9006
|
+
>
|
|
9007
|
+
<option value="">${t(this.locale, "selectOption")}</option>
|
|
9008
|
+
<option value="true">${t(this.locale, "yesAnswer")}</option>
|
|
9009
|
+
<option value="false">${t(this.locale, "noAnswer")}</option>
|
|
9010
|
+
</select>
|
|
9011
|
+
${this.renderFieldError(errorKey)}
|
|
9012
|
+
</label>
|
|
9013
|
+
`;
|
|
9014
|
+
}
|
|
8879
9015
|
if (isCheckboxField(field)) {
|
|
8880
9016
|
return html`
|
|
8881
9017
|
<label part="label checkbox custom-field">
|
|
@@ -8885,7 +9021,7 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
8885
9021
|
type="checkbox"
|
|
8886
9022
|
.checked=${values[field.id] === true}
|
|
8887
9023
|
aria-invalid=${this.fieldErrors[errorKey] ? "true" : "false"}
|
|
8888
|
-
@change=${(event) =>
|
|
9024
|
+
@change=${(event) => update(event.target.checked)}
|
|
8889
9025
|
/>
|
|
8890
9026
|
${field.label}${field.isRequired ? " *" : ""}
|
|
8891
9027
|
</span>
|
|
@@ -8902,7 +9038,7 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
8902
9038
|
.value=${String(values[field.id] ?? "")}
|
|
8903
9039
|
aria-invalid=${this.fieldErrors[errorKey] ? "true" : "false"}
|
|
8904
9040
|
aria-describedby=${this.fieldErrors[errorKey] ? id : nothing}
|
|
8905
|
-
@input=${(event) =>
|
|
9041
|
+
@input=${(event) => update(event.target.value)}
|
|
8906
9042
|
></textarea>
|
|
8907
9043
|
${this.renderFieldError(errorKey)}
|
|
8908
9044
|
</label>
|
|
@@ -8918,7 +9054,7 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
8918
9054
|
.value=${String(values[field.id] ?? "")}
|
|
8919
9055
|
aria-invalid=${this.fieldErrors[errorKey] ? "true" : "false"}
|
|
8920
9056
|
aria-describedby=${this.fieldErrors[errorKey] ? id : nothing}
|
|
8921
|
-
@input=${(event) =>
|
|
9057
|
+
@input=${(event) => update(event.target.value)}
|
|
8922
9058
|
/>
|
|
8923
9059
|
${this.renderFieldError(errorKey)}
|
|
8924
9060
|
</label>
|
|
@@ -8928,19 +9064,22 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
8928
9064
|
return this.renderCategorySupplements(this.categoryId);
|
|
8929
9065
|
}
|
|
8930
9066
|
renderCategorySupplements(categoryId, guestIndex) {
|
|
8931
|
-
const
|
|
9067
|
+
const guest = guestIndex === undefined ? undefined : this.guestRegistrations[guestIndex];
|
|
9068
|
+
const supplements = this.getSupplementsForCategory(categoryId, this.conditionAnswers(categoryId, guest));
|
|
8932
9069
|
if (!supplements.length)
|
|
8933
9070
|
return nothing;
|
|
9071
|
+
const category = this.event?.categories.find((item) => item.id === categoryId);
|
|
9072
|
+
const isTeam = (category?.teamSize ?? 1) > 1;
|
|
8934
9073
|
return html`<fieldset
|
|
8935
9074
|
part="card ${guestIndex === undefined ? "supplements" : "guest-supplements"}"
|
|
8936
9075
|
>
|
|
8937
9076
|
<legend part="title">Extras</legend>
|
|
8938
9077
|
<div part="stack">
|
|
8939
|
-
${supplements.map((supplement) => this.renderSupplement(supplement, guestIndex))}
|
|
9078
|
+
${supplements.map((supplement) => this.renderSupplement(supplement, isTeam, guestIndex))}
|
|
8940
9079
|
</div>
|
|
8941
9080
|
</fieldset>`;
|
|
8942
9081
|
}
|
|
8943
|
-
renderSupplement(supplement, guestIndex) {
|
|
9082
|
+
renderSupplement(supplement, isTeam, guestIndex) {
|
|
8944
9083
|
const ids = guestIndex === undefined ? this.selectedSupplementIds : this.guestRegistrations[guestIndex]?.selectedSupplementIds ?? [];
|
|
8945
9084
|
const selections = guestIndex === undefined ? this.supplementSelections : this.guestRegistrations[guestIndex]?.supplementSelections ?? [];
|
|
8946
9085
|
const selection = selections.find((item) => item.supplementId === supplement.id);
|
|
@@ -9003,7 +9142,7 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9003
9142
|
@input=${(event) => update({ quantity: event.target.valueAsNumber })}
|
|
9004
9143
|
/>
|
|
9005
9144
|
</label>` : nothing}
|
|
9006
|
-
${supplement.pricingMode === "PER_TEAM_MEMBER" ? html`<small part="hint">${t(this.locale, "perParticipant")}</small>` : nothing}
|
|
9145
|
+
${isTeam && supplement.pricingMode === "PER_TEAM_MEMBER" ? html`<small part="hint">${t(this.locale, "perParticipant")}</small>` : nothing}
|
|
9007
9146
|
${perUnit ? html`<small part="hint">${t(this.locale, "perUnit")}</small>` : nothing}
|
|
9008
9147
|
${supplement.description ? html`<small part="hint">${supplement.description}</small>` : nothing}
|
|
9009
9148
|
${this.renderFieldError(errorKey)}
|
|
@@ -9070,7 +9209,7 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9070
9209
|
</select>
|
|
9071
9210
|
${this.renderFieldError(`guestRegistrations.${index}.categoryId`)}
|
|
9072
9211
|
</label>
|
|
9073
|
-
${this.renderGuestInput(index, "teamName", t(this.locale, "teamName"), guest.teamName, "text", true)}
|
|
9212
|
+
${this.renderGuestInput(index, "teamName", t(this.locale, guestCategory?.teamSize === 1 ? "bibName" : "teamName"), guest.teamName, "text", true)}
|
|
9074
9213
|
${this.renderGuestInput(index, "club", t(this.locale, "club"), guest.club, "text", false)}
|
|
9075
9214
|
</div>
|
|
9076
9215
|
${guestCategory ? this.renderEligibilitySummary(guestCategory) : nothing}
|
|
@@ -9080,6 +9219,7 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9080
9219
|
${this.renderFieldError(`guestRegistrations.${index}.ageRule`)}
|
|
9081
9220
|
${this.renderCustomFields(guest.categoryId, index)}
|
|
9082
9221
|
${this.renderGuestSupplements(guest, index)}
|
|
9222
|
+
${this.checkoutWaivers(guest.categoryId, guest).filter((waiver) => this.isEntryWaiver(waiver)).map((waiver) => this.renderWaiver(waiver, guest))}
|
|
9083
9223
|
<button
|
|
9084
9224
|
part="button secondary remove-guest"
|
|
9085
9225
|
type="button"
|
|
@@ -9087,7 +9227,7 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9087
9227
|
>
|
|
9088
9228
|
${t(this.locale, "remove")}
|
|
9089
9229
|
</button>
|
|
9090
|
-
${guestCategory ? html`<small part="hint"
|
|
9230
|
+
${guestCategory && guestCategory.teamSize > 1 ? html`<small part="hint"
|
|
9091
9231
|
>${t(this.locale, "teamSize")}
|
|
9092
9232
|
${formatNumber(guestCategory.teamSize, this.locale)}</small
|
|
9093
9233
|
>` : nothing}
|
|
@@ -9135,13 +9275,12 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9135
9275
|
<span>${t(this.locale, "gender")} *</span>
|
|
9136
9276
|
<select
|
|
9137
9277
|
part="select"
|
|
9138
|
-
.value=${athlete.gender}
|
|
9139
9278
|
?disabled=${genderLocked}
|
|
9140
9279
|
aria-invalid=${this.fieldErrors[genderErrorKey] ? "true" : "false"}
|
|
9141
9280
|
@change=${(event) => this.updateGuestAthlete(guestIndex, athleteIndex, "gender", event.target.value)}
|
|
9142
9281
|
>
|
|
9143
9282
|
${allowedGenders.map((gender) => html`
|
|
9144
|
-
<option value=${gender}>
|
|
9283
|
+
<option value=${gender} .selected=${gender === athlete.gender}>
|
|
9145
9284
|
${t(this.locale, gender === "FEMALE" ? "female" : "male")}
|
|
9146
9285
|
</option>
|
|
9147
9286
|
`)}
|
|
@@ -9150,6 +9289,7 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9150
9289
|
${this.renderFieldError(genderErrorKey)}
|
|
9151
9290
|
</label>
|
|
9152
9291
|
</div>
|
|
9292
|
+
${athleteIndex > 0 ? this.renderCustomFields(this.guestRegistrations[guestIndex]?.categoryId, guestIndex, athleteIndex) : nothing}
|
|
9153
9293
|
</fieldset>
|
|
9154
9294
|
`;
|
|
9155
9295
|
}
|
|
@@ -9182,10 +9322,7 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9182
9322
|
return this.renderCategorySupplements(guest.categoryId, guestIndex);
|
|
9183
9323
|
}
|
|
9184
9324
|
get signatureWaivers() {
|
|
9185
|
-
return
|
|
9186
|
-
this.categoryId,
|
|
9187
|
-
...this.guestRegistrations.map((guest) => guest.categoryId)
|
|
9188
|
-
]).filter((waiver) => waiver.requiresSignature);
|
|
9325
|
+
return this.visibleWaivers.filter((waiver) => waiver.requiresSignature);
|
|
9189
9326
|
}
|
|
9190
9327
|
get hasMinorParticipants() {
|
|
9191
9328
|
const today = new Date;
|
|
@@ -9285,10 +9422,10 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9285
9422
|
</section>`;
|
|
9286
9423
|
}
|
|
9287
9424
|
renderWaivers() {
|
|
9288
|
-
const waivers =
|
|
9289
|
-
this.
|
|
9290
|
-
...this.
|
|
9291
|
-
]
|
|
9425
|
+
const waivers = [
|
|
9426
|
+
...this.visibleWaivers.filter((waiver) => !this.isEntryWaiver(waiver)),
|
|
9427
|
+
...this.checkoutWaivers(this.categoryId).filter((waiver) => this.isEntryWaiver(waiver))
|
|
9428
|
+
];
|
|
9292
9429
|
if (!waivers.length)
|
|
9293
9430
|
return nothing;
|
|
9294
9431
|
return html`
|
|
@@ -9298,17 +9435,18 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9298
9435
|
</fieldset>
|
|
9299
9436
|
`;
|
|
9300
9437
|
}
|
|
9301
|
-
renderWaiver(waiver) {
|
|
9302
|
-
const
|
|
9438
|
+
renderWaiver(waiver, guest) {
|
|
9439
|
+
const acceptanceKey = this.waiverAcceptanceKey(waiver, guest);
|
|
9440
|
+
const errorKey = `waivers.${acceptanceKey}`;
|
|
9303
9441
|
return html`
|
|
9304
9442
|
<label part="label checkbox waiver">
|
|
9305
9443
|
<span>
|
|
9306
9444
|
<input
|
|
9307
9445
|
part="checkbox"
|
|
9308
9446
|
type="checkbox"
|
|
9309
|
-
.checked=${this.waiversAccepted[
|
|
9447
|
+
.checked=${this.waiversAccepted[acceptanceKey] === true}
|
|
9310
9448
|
aria-invalid=${this.fieldErrors[errorKey] ? "true" : "false"}
|
|
9311
|
-
@change=${(event) => this.updateWaiver(
|
|
9449
|
+
@change=${(event) => this.updateWaiver(acceptanceKey, event.target.checked)}
|
|
9312
9450
|
/>
|
|
9313
9451
|
${waiver.name}${waiver.isRequired ? " *" : ""}
|
|
9314
9452
|
</span>
|
|
@@ -9470,8 +9608,8 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9470
9608
|
if (JSON.stringify(selections) !== JSON.stringify(this.supplementSelections))
|
|
9471
9609
|
this.supplementSelections = selections;
|
|
9472
9610
|
}
|
|
9473
|
-
normalizeSupplementSelections(categoryId, selections) {
|
|
9474
|
-
return this.getSupplementsForCategory(categoryId).flatMap((supplement) => {
|
|
9611
|
+
normalizeSupplementSelections(categoryId, selections, answers = this.conditionAnswers(categoryId)) {
|
|
9612
|
+
return this.getSupplementsForCategory(categoryId, answers).flatMap((supplement) => {
|
|
9475
9613
|
const selection = selections.find((item) => item.supplementId === supplement.id);
|
|
9476
9614
|
const options = (supplement.options ?? []).filter((option) => option.isActive);
|
|
9477
9615
|
if (options.length && !options.some((option) => option.id === selection?.optionId))
|
|
@@ -9496,14 +9634,14 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9496
9634
|
this.guestRegistrations = next;
|
|
9497
9635
|
}
|
|
9498
9636
|
}
|
|
9499
|
-
getRequiredSupplementIds(categoryId) {
|
|
9500
|
-
return this.getSupplementsForCategory(categoryId).filter((supplement) => supplement.isRequired && supplement.pricingMode !== "PER_UNIT" && !(supplement.options ?? []).some((option) => option.isActive)).map((supplement) => supplement.id);
|
|
9637
|
+
getRequiredSupplementIds(categoryId, answers = this.conditionAnswers(categoryId)) {
|
|
9638
|
+
return this.getSupplementsForCategory(categoryId, answers).filter((supplement) => supplement.isRequired && supplement.pricingMode !== "PER_UNIT" && !(supplement.options ?? []).some((option) => option.isActive)).map((supplement) => supplement.id);
|
|
9501
9639
|
}
|
|
9502
|
-
normalizeSupplementIdsForCategory(categoryId, selectedIds) {
|
|
9503
|
-
const availableIds = new Set(this.getSupplementsForCategory(categoryId).filter((supplement) => supplement.pricingMode !== "PER_UNIT" && !(supplement.options ?? []).some((option) => option.isActive)).map((supplement) => supplement.id));
|
|
9640
|
+
normalizeSupplementIdsForCategory(categoryId, selectedIds, answers = this.conditionAnswers(categoryId)) {
|
|
9641
|
+
const availableIds = new Set(this.getSupplementsForCategory(categoryId, answers).filter((supplement) => supplement.pricingMode !== "PER_UNIT" && !(supplement.options ?? []).some((option) => option.isActive)).map((supplement) => supplement.id));
|
|
9504
9642
|
return [
|
|
9505
9643
|
...new Set([
|
|
9506
|
-
...this.getRequiredSupplementIds(categoryId),
|
|
9644
|
+
...this.getRequiredSupplementIds(categoryId, answers),
|
|
9507
9645
|
...selectedIds.filter((supplementId) => availableIds.has(supplementId))
|
|
9508
9646
|
])
|
|
9509
9647
|
];
|
|
@@ -9514,13 +9652,14 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9514
9652
|
createGuestRegistration() {
|
|
9515
9653
|
const categoryId = (categoryAvailabilityMessage(this.selectedCategory, this.locale) ? "" : this.categoryId) || this.event?.categories.find((category) => !categoryAvailabilityMessage(category, this.locale))?.id || "";
|
|
9516
9654
|
return this.normalizeGuestRegistration({
|
|
9655
|
+
draftId: this.nextGuestDraftId++,
|
|
9517
9656
|
guestName: "",
|
|
9518
9657
|
guestEmail: "",
|
|
9519
9658
|
categoryId,
|
|
9520
9659
|
teamName: "",
|
|
9521
9660
|
club: "",
|
|
9522
9661
|
athletes: [emptyAthlete()],
|
|
9523
|
-
selectedSupplementIds:
|
|
9662
|
+
selectedSupplementIds: [],
|
|
9524
9663
|
selectedGenderCompositionIndex: this.defaultGenderCompositionIndex(this.getCategory(categoryId))
|
|
9525
9664
|
});
|
|
9526
9665
|
}
|
|
@@ -9530,8 +9669,8 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9530
9669
|
const sizedAthletes = Array.from({ length: teamSize }, (_, index) => guest.athletes[index] ?? emptyAthlete());
|
|
9531
9670
|
const selectedGenderCompositionIndex = this.normalizeGenderCompositionIndex(category, guest.selectedGenderCompositionIndex);
|
|
9532
9671
|
const athletes = this.normalizeAthleteGenders(category, sizedAthletes, selectedGenderCompositionIndex);
|
|
9533
|
-
const selectedSupplementIds = this.normalizeSupplementIdsForCategory(guest.categoryId, guest.selectedSupplementIds);
|
|
9534
|
-
const supplementSelections = this.normalizeSupplementSelections(guest.categoryId, guest.supplementSelections ?? []);
|
|
9672
|
+
const selectedSupplementIds = this.normalizeSupplementIdsForCategory(guest.categoryId, guest.selectedSupplementIds, this.conditionAnswers(guest.categoryId, { ...guest, athletes }));
|
|
9673
|
+
const supplementSelections = this.normalizeSupplementSelections(guest.categoryId, guest.supplementSelections ?? [], this.conditionAnswers(guest.categoryId, { ...guest, athletes }));
|
|
9535
9674
|
return {
|
|
9536
9675
|
...guest,
|
|
9537
9676
|
athletes,
|
|
@@ -9615,21 +9754,30 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9615
9754
|
this.clearFieldError("genderComposition");
|
|
9616
9755
|
this.clearFieldError("genderPolicy");
|
|
9617
9756
|
}
|
|
9618
|
-
|
|
9757
|
+
customFieldErrorKey(fieldId, guestIndex, participantIndex) {
|
|
9758
|
+
const registration = guestIndex === undefined ? "" : `guestRegistrations.${guestIndex}.`;
|
|
9759
|
+
const participant = participantIndex === undefined ? "" : `athletes.${participantIndex}.`;
|
|
9760
|
+
return `${registration}${participant}customFields.${fieldId}`;
|
|
9761
|
+
}
|
|
9762
|
+
updateCustomField(fieldId, value, guestIndex, participantIndex) {
|
|
9763
|
+
const updateAthletes = (athletes) => athletes.map((athlete, position) => position === participantIndex ? {
|
|
9764
|
+
...athlete,
|
|
9765
|
+
conditionalFieldValues: { ...athlete.conditionalFieldValues, [fieldId]: value }
|
|
9766
|
+
} : athlete);
|
|
9619
9767
|
if (guestIndex === undefined) {
|
|
9620
|
-
|
|
9621
|
-
|
|
9768
|
+
if (participantIndex === undefined) {
|
|
9769
|
+
this.customFieldValues = { ...this.customFieldValues, [fieldId]: value };
|
|
9770
|
+
} else {
|
|
9771
|
+
this.athletes = updateAthletes(this.athletes);
|
|
9772
|
+
}
|
|
9622
9773
|
} else {
|
|
9623
|
-
this.guestRegistrations = this.guestRegistrations.map((guest, index) => index !== guestIndex ? guest : {
|
|
9624
|
-
...guest,
|
|
9625
|
-
customFieldValues: { ...guest.customFieldValues, [fieldId]: value }
|
|
9626
|
-
});
|
|
9627
|
-
this.clearFieldError(`guestRegistrations.${guestIndex}.customFields.${fieldId}`);
|
|
9774
|
+
this.guestRegistrations = this.guestRegistrations.map((guest, index) => index !== guestIndex ? guest : participantIndex === undefined ? { ...guest, customFieldValues: { ...guest.customFieldValues, [fieldId]: value } } : { ...guest, athletes: updateAthletes(guest.athletes) });
|
|
9628
9775
|
}
|
|
9776
|
+
this.clearFieldError(this.customFieldErrorKey(fieldId, guestIndex, participantIndex));
|
|
9629
9777
|
}
|
|
9630
|
-
updateWaiver(
|
|
9631
|
-
this.waiversAccepted = { ...this.waiversAccepted, [
|
|
9632
|
-
this.clearFieldError(`waivers.${
|
|
9778
|
+
updateWaiver(acceptanceKey, accepted) {
|
|
9779
|
+
this.waiversAccepted = { ...this.waiversAccepted, [acceptanceKey]: accepted };
|
|
9780
|
+
this.clearFieldError(`waivers.${acceptanceKey}`);
|
|
9633
9781
|
}
|
|
9634
9782
|
updateSupplement(supplementId, selected) {
|
|
9635
9783
|
this.selectedSupplementIds = selected ? [...new Set([...this.selectedSupplementIds, supplementId])] : this.selectedSupplementIds.filter((id) => id !== supplementId);
|
|
@@ -9654,8 +9802,8 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9654
9802
|
const positionsAreValid = uniquePositions.size === this.pendingParticipantPositions.length && this.pendingParticipantPositions.every((position) => Number.isInteger(position) && position > 0 && position < category.teamSize);
|
|
9655
9803
|
return positionsAreValid ? null : t(this.locale, "invalidSelection");
|
|
9656
9804
|
}
|
|
9657
|
-
validateSupplements(errors, categoryId, ids, selections, prefix = "") {
|
|
9658
|
-
for (const supplement of this.getSupplementsForCategory(categoryId)) {
|
|
9805
|
+
validateSupplements(errors, categoryId, ids, selections, prefix = "", guest) {
|
|
9806
|
+
for (const supplement of this.getSupplementsForCategory(categoryId, this.conditionAnswers(categoryId, guest))) {
|
|
9659
9807
|
const selection = selections.find((item) => item.supplementId === supplement.id);
|
|
9660
9808
|
const options = (supplement.options ?? []).filter((option) => option.isActive);
|
|
9661
9809
|
const key = `${prefix}supplements.${supplement.id}`;
|
|
@@ -9667,10 +9815,24 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9667
9815
|
errors[key] = t(this.locale, "invalidNumber");
|
|
9668
9816
|
}
|
|
9669
9817
|
}
|
|
9818
|
+
validateRegistrationFields(errors, categoryId, values, guestIndex, participantIndex) {
|
|
9819
|
+
const conditions = this.conditionFieldIds(categoryId);
|
|
9820
|
+
for (const field of this.event?.eventFormFields ?? []) {
|
|
9821
|
+
if (!isFormFieldTargetAthlete(field) || !isFormFieldAvailableForCategory(field, categoryId) || participantIndex !== undefined && !conditions.has(field.id))
|
|
9822
|
+
continue;
|
|
9823
|
+
const value = values?.[field.id];
|
|
9824
|
+
const input = isCheckboxField(field) && conditions.has(field.id) ? {
|
|
9825
|
+
value: typeof value === "boolean" ? String(value) : undefined,
|
|
9826
|
+
type: "SELECT",
|
|
9827
|
+
options: ["true", "false"]
|
|
9828
|
+
} : { value, type: field.type, options: field.options };
|
|
9829
|
+
setValidationError(errors, this.locale, this.customFieldErrorKey(field.id, guestIndex, participantIndex), validateCustomFieldValue(input.value, input.type, input.options, field.isRequired));
|
|
9830
|
+
}
|
|
9831
|
+
}
|
|
9670
9832
|
validate() {
|
|
9671
9833
|
const errors = {};
|
|
9672
9834
|
this.validateSupplements(errors, this.categoryId, this.selectedSupplementIds, this.supplementSelections);
|
|
9673
|
-
this.guestRegistrations.forEach((guest, index) => this.validateSupplements(errors, guest.categoryId, guest.selectedSupplementIds, guest.supplementSelections ?? [], `guestRegistrations.${index}
|
|
9835
|
+
this.guestRegistrations.forEach((guest, index) => this.validateSupplements(errors, guest.categoryId, guest.selectedSupplementIds, guest.supplementSelections ?? [], `guestRegistrations.${index}.`, guest));
|
|
9674
9836
|
setValidationError(errors, this.locale, "purchaserName", validateRequiredText(this.purchaserName));
|
|
9675
9837
|
setValidationError(errors, this.locale, "purchaserEmail", validateEmail(this.purchaserEmail, true));
|
|
9676
9838
|
setValidationError(errors, this.locale, "teamName", validateRequiredText(this.teamName));
|
|
@@ -9714,9 +9876,7 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9714
9876
|
}
|
|
9715
9877
|
for (const [guestIndex, guest] of this.guestRegistrations.entries()) {
|
|
9716
9878
|
const guestCategory = this.getCategory(guest.categoryId);
|
|
9717
|
-
|
|
9718
|
-
setValidationError(errors, this.locale, `guestRegistrations.${guestIndex}.customFields.${field.id}`, validateCustomFieldValue(guest.customFieldValues?.[field.id], field.type, field.options, field.isRequired));
|
|
9719
|
-
}
|
|
9879
|
+
this.validateRegistrationFields(errors, guest.categoryId, guest.customFieldValues, guestIndex);
|
|
9720
9880
|
setValidationError(errors, this.locale, `guestRegistrations.${guestIndex}.guestName`, validateRequiredText(guest.guestName));
|
|
9721
9881
|
setValidationError(errors, this.locale, `guestRegistrations.${guestIndex}.guestEmail`, validateEmail(guest.guestEmail, true));
|
|
9722
9882
|
setValidationError(errors, this.locale, `guestRegistrations.${guestIndex}.teamName`, validateRequiredText(guest.teamName));
|
|
@@ -9724,6 +9884,8 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9724
9884
|
if (guestUnavailable)
|
|
9725
9885
|
errors[`guestRegistrations.${guestIndex}.categoryId`] = guestUnavailable;
|
|
9726
9886
|
for (const [athleteIndex, athlete] of guest.athletes.entries()) {
|
|
9887
|
+
if (athleteIndex > 0)
|
|
9888
|
+
this.validateRegistrationFields(errors, guest.categoryId, athlete.conditionalFieldValues, guestIndex, athleteIndex);
|
|
9727
9889
|
setValidationError(errors, this.locale, `guestRegistrations.${guestIndex}.athletes.${athleteIndex}.fullname`, validateRequiredText(athlete.fullname));
|
|
9728
9890
|
setValidationError(errors, this.locale, `guestRegistrations.${guestIndex}.athletes.${athleteIndex}.email`, validateEmail(athlete.email, true));
|
|
9729
9891
|
setValidationError(errors, this.locale, `guestRegistrations.${guestIndex}.athletes.${athleteIndex}.phone`, validateRequiredText(athlete.phone));
|
|
@@ -9749,15 +9911,15 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9749
9911
|
}
|
|
9750
9912
|
}
|
|
9751
9913
|
}
|
|
9752
|
-
|
|
9753
|
-
|
|
9914
|
+
this.validateRegistrationFields(errors, this.categoryId, this.customFieldValues);
|
|
9915
|
+
for (const [index, athlete] of this.athletes.entries()) {
|
|
9916
|
+
if (index > 0 && !this.isParticipantDeferred(index))
|
|
9917
|
+
this.validateRegistrationFields(errors, this.categoryId, athlete.conditionalFieldValues, undefined, index);
|
|
9754
9918
|
}
|
|
9755
|
-
for (const waiver of
|
|
9756
|
-
this.
|
|
9757
|
-
|
|
9758
|
-
|
|
9759
|
-
if (waiver.isRequired && this.waiversAccepted[waiver.id] !== true) {
|
|
9760
|
-
errors[`waivers.${waiver.id}`] = t(this.locale, "requiredWaiver");
|
|
9919
|
+
for (const { waiver, guest } of this.waiverEntries) {
|
|
9920
|
+
const acceptanceKey = this.waiverAcceptanceKey(waiver, guest);
|
|
9921
|
+
if (waiver.isRequired && this.waiversAccepted[acceptanceKey] !== true) {
|
|
9922
|
+
errors[`waivers.${acceptanceKey}`] = t(this.locale, "requiredWaiver");
|
|
9761
9923
|
}
|
|
9762
9924
|
}
|
|
9763
9925
|
if (this.signatureWaivers.length && (!this.signatureInput() || this.hasMinorParticipants && (!this.signatureDraft.minorRelationship || !this.signatureDraft.guardianAuthorityAccepted)))
|
|
@@ -9778,10 +9940,23 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9778
9940
|
buildGuestRegistrationsSummaryInput() {
|
|
9779
9941
|
return this.guestRegistrations.filter((guest) => hasText(guest.categoryId)).map((guest) => ({
|
|
9780
9942
|
categoryId: guest.categoryId.trim(),
|
|
9943
|
+
...this.conditionFieldIds(guest.categoryId).size ? { participantCustomFields: this.conditionAnswers(guest.categoryId, guest) } : {},
|
|
9781
9944
|
...guest.supplementSelections?.length ? { supplementSelections: guest.supplementSelections } : {},
|
|
9782
9945
|
...guest.selectedSupplementIds.length > 0 ? { selectedSupplementIds: guest.selectedSupplementIds } : {}
|
|
9783
9946
|
}));
|
|
9784
9947
|
}
|
|
9948
|
+
checkoutAthlete(athlete, categoryId) {
|
|
9949
|
+
const { conditionalFieldValues, ...details } = athlete;
|
|
9950
|
+
const customFields = this.fieldAnswers(categoryId, conditionalFieldValues);
|
|
9951
|
+
return {
|
|
9952
|
+
...details,
|
|
9953
|
+
fullname: details.fullname.trim(),
|
|
9954
|
+
email: details.email.trim(),
|
|
9955
|
+
phone: details.phone.trim(),
|
|
9956
|
+
idNumber: details.idNumber.trim(),
|
|
9957
|
+
...customFields.length ? { customFields } : {}
|
|
9958
|
+
};
|
|
9959
|
+
}
|
|
9785
9960
|
buildGuestRegistrationsCheckoutInput() {
|
|
9786
9961
|
if (!this.guestRegistrations.length)
|
|
9787
9962
|
return;
|
|
@@ -9796,14 +9971,8 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9796
9971
|
...guest.customFieldValues ? {
|
|
9797
9972
|
customFields: Object.entries(guest.customFieldValues).filter(([fieldId, value]) => !isBlank(value) && this.event?.eventFormFields.some((field) => field.id === fieldId && isFormFieldTargetAthlete(field) && isFormFieldAvailableForCategory(field, guest.categoryId))).map(([fieldId, value]) => ({ fieldId, value }))
|
|
9798
9973
|
} : {},
|
|
9799
|
-
waiversAccepted:
|
|
9800
|
-
athletes: guest.athletes.map((athlete) => (
|
|
9801
|
-
...athlete,
|
|
9802
|
-
fullname: athlete.fullname.trim(),
|
|
9803
|
-
email: athlete.email.trim(),
|
|
9804
|
-
phone: athlete.phone.trim(),
|
|
9805
|
-
idNumber: athlete.idNumber.trim()
|
|
9806
|
-
}))
|
|
9974
|
+
waiversAccepted: this.checkoutWaiverAcceptances(guest),
|
|
9975
|
+
athletes: guest.athletes.map((athlete) => this.checkoutAthlete(athlete, guest.categoryId))
|
|
9807
9976
|
}));
|
|
9808
9977
|
}
|
|
9809
9978
|
buildDeferredTeamCompletion() {
|
|
@@ -9817,7 +9986,7 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9817
9986
|
pendingParticipantPositions,
|
|
9818
9987
|
...slotGenders ? { slotGenders } : {},
|
|
9819
9988
|
participantWaivers: Array.from({ length: providedParticipantCount }, () => ({
|
|
9820
|
-
waiversAccepted:
|
|
9989
|
+
waiversAccepted: this.checkoutWaiverAcceptances()
|
|
9821
9990
|
}))
|
|
9822
9991
|
};
|
|
9823
9992
|
}
|
|
@@ -9841,6 +10010,7 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9841
10010
|
const input = {
|
|
9842
10011
|
categoryId: this.categoryId.trim(),
|
|
9843
10012
|
purchaserEmail: this.purchaserEmail.trim(),
|
|
10013
|
+
...this.conditionFieldIds(this.categoryId).size ? { participantCustomFields: this.conditionAnswers(this.categoryId) } : {},
|
|
9844
10014
|
selectedSupplementIds: this.selectedSupplementIds,
|
|
9845
10015
|
...this.supplementSelections.length ? { supplementSelections: this.supplementSelections } : {},
|
|
9846
10016
|
...this.buildGuestRegistrationsSummaryInput().length > 0 ? { guestRegistrations: this.buildGuestRegistrationsSummaryInput() } : {},
|
|
@@ -9949,22 +10119,14 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9949
10119
|
purchaserName: this.purchaserName.trim(),
|
|
9950
10120
|
teamName: this.teamName.trim(),
|
|
9951
10121
|
termsAccepted: this.termsAccepted,
|
|
9952
|
-
waiversAccepted:
|
|
10122
|
+
waiversAccepted: this.checkoutWaiverAcceptances(),
|
|
9953
10123
|
selectedSupplementIds: this.selectedSupplementIds,
|
|
9954
10124
|
...this.supplementSelections.length ? { supplementSelections: this.supplementSelections } : {},
|
|
9955
10125
|
successUrl: this.successUrl.trim(),
|
|
9956
10126
|
cancelUrl: this.cancelUrl.trim(),
|
|
9957
10127
|
customFields,
|
|
9958
10128
|
...this.signatureInput() ? { legalSignature: this.signatureInput() } : {},
|
|
9959
|
-
athletes: this.athletes.flatMap((athlete, position) => this.isParticipantDeferred(position) ? [] : [
|
|
9960
|
-
{
|
|
9961
|
-
...athlete,
|
|
9962
|
-
fullname: athlete.fullname.trim(),
|
|
9963
|
-
email: athlete.email.trim(),
|
|
9964
|
-
phone: athlete.phone.trim(),
|
|
9965
|
-
idNumber: athlete.idNumber.trim()
|
|
9966
|
-
}
|
|
9967
|
-
])
|
|
10129
|
+
athletes: this.athletes.flatMap((athlete, position) => this.isParticipantDeferred(position) ? [] : [this.checkoutAthlete(athlete, this.categoryId)])
|
|
9968
10130
|
};
|
|
9969
10131
|
const deferredTeamCompletion = this.buildDeferredTeamCompletion();
|
|
9970
10132
|
if (deferredTeamCompletion)
|
|
@@ -10010,7 +10172,6 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
10010
10172
|
globalThis.location.assign(session.sessionUrl);
|
|
10011
10173
|
}
|
|
10012
10174
|
}
|
|
10013
|
-
|
|
10014
10175
|
class WodiraRegistrationReceiptSender extends LitElement {
|
|
10015
10176
|
static styles = [wodiraUiStyles, wodiraLayoutStyles];
|
|
10016
10177
|
static properties = {
|
|
@@ -10132,6 +10293,7 @@ class WodiraRegistrationReceiptSender extends LitElement {
|
|
|
10132
10293
|
}
|
|
10133
10294
|
}
|
|
10134
10295
|
}
|
|
10296
|
+
|
|
10135
10297
|
class WodiraCheckoutFlow extends LitElement {
|
|
10136
10298
|
static styles = [wodiraUiStyles, wodiraLayoutStyles];
|
|
10137
10299
|
static properties = {
|
|
@@ -10310,6 +10472,7 @@ class WodiraCheckoutFlow extends LitElement {
|
|
|
10310
10472
|
var ELEMENTS = [
|
|
10311
10473
|
["wodira-signature-pad", WodiraSignaturePad],
|
|
10312
10474
|
["wodira-shirt-auction", WodiraShirtAuction2],
|
|
10475
|
+
["wodira-route-3d", WodiraRoute3d2],
|
|
10313
10476
|
["wodira-event-card", WodiraEventCard],
|
|
10314
10477
|
["wodira-event-list", WodiraEventList],
|
|
10315
10478
|
["wodira-pricing-cards", WodiraPricingCards],
|
|
@@ -10365,12 +10528,14 @@ export {
|
|
|
10365
10528
|
WodiraPricingCards,
|
|
10366
10529
|
WodiraRegistrationForm,
|
|
10367
10530
|
WodiraRegistrationReceiptSender,
|
|
10531
|
+
WodiraRoute3d2 as WodiraRoute3d,
|
|
10368
10532
|
WodiraShirtAuction2 as WodiraShirtAuction,
|
|
10369
10533
|
WodiraSignaturePad,
|
|
10370
10534
|
applyWodiraTheme,
|
|
10371
10535
|
createWodiraCheckoutFlow,
|
|
10372
10536
|
createWodiraRegistrationReceiptSender,
|
|
10373
10537
|
defineWodiraElements,
|
|
10538
|
+
defineWodiraRouteElements2 as defineWodiraRouteElements,
|
|
10374
10539
|
defineWodiraShirtElements2 as defineWodiraShirtElements,
|
|
10375
10540
|
wodiraThemeTokens,
|
|
10376
10541
|
wodiraThemes
|