@wodira/browser 1.1.0 → 1.2.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/CHANGELOG.md +17 -0
- 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/boxes/index.js +4 -4
- 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-dqnha6dj.js +1625 -0
- package/dist/ui/index-h2b598n9.js +1624 -0
- package/dist/ui/{index-tfej862z.js → index-k8s7q1sf.js} +50 -1568
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +288 -121
- package/dist/ui/map-view-8tyrehav.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-k8s7q1sf.js";
|
|
11
|
+
import {
|
|
10
12
|
wodiraUiStyles,
|
|
11
13
|
WodiraShirtAuction2,
|
|
12
14
|
defineWodiraShirtElements2
|
|
13
|
-
} from "./index-
|
|
14
|
-
|
|
15
|
+
} from "./index-h2b598n9.js";
|
|
16
|
+
import {
|
|
17
|
+
WodiraRoute3d2,
|
|
18
|
+
defineWodiraRouteElements2
|
|
19
|
+
} from "./index-dqnha6dj.js";
|
|
20
|
+
__chunks(import.meta.url,["1xp38xw4","k8s7q1sf","h2b598n9","dqnha6dj","jyks1h8f","8tyrehav","xdhg885t"],[["./index.js",1,2,3],["./index-k8s7q1sf.js"],["./index-h2b598n9.js",1],["./index-dqnha6dj.js",1],["./shirt-3d-renderer-jyks1h8f.js",6],["./map-view-8tyrehav.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
|
|
@@ -8777,6 +8887,7 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
8777
8887
|
${this.renderFieldError(genderErrorKey)}
|
|
8778
8888
|
</label>
|
|
8779
8889
|
</div>
|
|
8890
|
+
${index > 0 ? this.renderCustomFields(this.categoryId, undefined, index) : nothing}
|
|
8780
8891
|
`}
|
|
8781
8892
|
</fieldset>
|
|
8782
8893
|
`;
|
|
@@ -8805,22 +8916,26 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
8805
8916
|
</div>
|
|
8806
8917
|
`;
|
|
8807
8918
|
}
|
|
8808
|
-
renderCustomFields(categoryId = this.categoryId, guestIndex) {
|
|
8809
|
-
const
|
|
8919
|
+
renderCustomFields(categoryId = this.categoryId, guestIndex, participantIndex) {
|
|
8920
|
+
const conditionIds = this.conditionFieldIds(categoryId);
|
|
8921
|
+
const fields = this.event?.eventFormFields.filter((field) => isFormFieldTargetAthlete(field) && isFormFieldAvailableForCategory(field, categoryId) && (participantIndex === undefined || conditionIds.has(field.id))) ?? [];
|
|
8810
8922
|
if (!fields.length)
|
|
8811
8923
|
return nothing;
|
|
8812
8924
|
return html`
|
|
8813
8925
|
<fieldset part="card custom-fields">
|
|
8814
8926
|
<legend part="title">${t(this.locale, "customFieldsTitle")}</legend>
|
|
8815
8927
|
<div part="grid custom-fields-grid">
|
|
8816
|
-
${fields.map((field) => this.renderCustomField(field, guestIndex))}
|
|
8928
|
+
${fields.map((field) => this.renderCustomField(field, conditionIds.has(field.id), guestIndex, participantIndex))}
|
|
8817
8929
|
</div>
|
|
8818
8930
|
</fieldset>
|
|
8819
8931
|
`;
|
|
8820
8932
|
}
|
|
8821
|
-
renderCustomField(field, guestIndex) {
|
|
8822
|
-
const
|
|
8823
|
-
const
|
|
8933
|
+
renderCustomField(field, drivesVisibility, guestIndex, participantIndex) {
|
|
8934
|
+
const guest = guestIndex === undefined ? undefined : this.guestRegistrations[guestIndex];
|
|
8935
|
+
const athlete = participantIndex === undefined ? undefined : (guest?.athletes ?? this.athletes)[participantIndex];
|
|
8936
|
+
const values = participantIndex === undefined ? guest ? guest.customFieldValues ?? {} : this.customFieldValues : athlete?.conditionalFieldValues ?? {};
|
|
8937
|
+
const errorKey = this.customFieldErrorKey(field.id, guestIndex, participantIndex);
|
|
8938
|
+
const update = (value) => this.updateCustomField(field.id, value, guestIndex, participantIndex);
|
|
8824
8939
|
const id = fieldErrorId(errorKey);
|
|
8825
8940
|
if (field.type === "MULTI_SELECT") {
|
|
8826
8941
|
const selected = Array.isArray(values[field.id]) ? values[field.id] : [];
|
|
@@ -8831,7 +8946,7 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
8831
8946
|
multiple
|
|
8832
8947
|
aria-invalid=${this.fieldErrors[errorKey] ? "true" : "false"}
|
|
8833
8948
|
aria-describedby=${this.fieldErrors[errorKey] ? id : nothing}
|
|
8834
|
-
@change=${(event) =>
|
|
8949
|
+
@change=${(event) => update(Array.from(event.target.selectedOptions, (option) => option.value))}
|
|
8835
8950
|
>
|
|
8836
8951
|
${field.options.map((option) => html`<option value=${option} ?selected=${selected.includes(option)}>${option}</option>`)}</select
|
|
8837
8952
|
>${this.renderFieldError(errorKey)}</label
|
|
@@ -8851,7 +8966,7 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
8851
8966
|
name=${errorKey}
|
|
8852
8967
|
value=${option}
|
|
8853
8968
|
.checked=${values[field.id] === option}
|
|
8854
|
-
@change=${() =>
|
|
8969
|
+
@change=${() => update(option)}
|
|
8855
8970
|
/>${option}</span
|
|
8856
8971
|
></label
|
|
8857
8972
|
>`)}
|
|
@@ -8867,7 +8982,7 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
8867
8982
|
.value=${String(values[field.id] ?? "")}
|
|
8868
8983
|
aria-invalid=${this.fieldErrors[errorKey] ? "true" : "false"}
|
|
8869
8984
|
aria-describedby=${this.fieldErrors[errorKey] ? id : nothing}
|
|
8870
|
-
@change=${(event) =>
|
|
8985
|
+
@change=${(event) => update(event.target.value)}
|
|
8871
8986
|
>
|
|
8872
8987
|
<option value="">${t(this.locale, "selectOption")}</option>
|
|
8873
8988
|
${field.options.map((option) => html`<option value=${option}>${option}</option>`)}
|
|
@@ -8876,6 +8991,28 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
8876
8991
|
</label>
|
|
8877
8992
|
`;
|
|
8878
8993
|
}
|
|
8994
|
+
if (isCheckboxField(field) && drivesVisibility) {
|
|
8995
|
+
return html`
|
|
8996
|
+
<label part="label field custom-field">
|
|
8997
|
+
<span>${field.label}${field.isRequired ? " *" : ""}</span>
|
|
8998
|
+
<select
|
|
8999
|
+
part="select"
|
|
9000
|
+
.value=${typeof values[field.id] === "boolean" ? String(values[field.id]) : ""}
|
|
9001
|
+
aria-invalid=${this.fieldErrors[errorKey] ? "true" : "false"}
|
|
9002
|
+
aria-describedby=${this.fieldErrors[errorKey] ? id : nothing}
|
|
9003
|
+
@change=${(event) => {
|
|
9004
|
+
const value = event.target.value;
|
|
9005
|
+
update(value ? value === "true" : undefined);
|
|
9006
|
+
}}
|
|
9007
|
+
>
|
|
9008
|
+
<option value="">${t(this.locale, "selectOption")}</option>
|
|
9009
|
+
<option value="true">${t(this.locale, "yesAnswer")}</option>
|
|
9010
|
+
<option value="false">${t(this.locale, "noAnswer")}</option>
|
|
9011
|
+
</select>
|
|
9012
|
+
${this.renderFieldError(errorKey)}
|
|
9013
|
+
</label>
|
|
9014
|
+
`;
|
|
9015
|
+
}
|
|
8879
9016
|
if (isCheckboxField(field)) {
|
|
8880
9017
|
return html`
|
|
8881
9018
|
<label part="label checkbox custom-field">
|
|
@@ -8885,7 +9022,7 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
8885
9022
|
type="checkbox"
|
|
8886
9023
|
.checked=${values[field.id] === true}
|
|
8887
9024
|
aria-invalid=${this.fieldErrors[errorKey] ? "true" : "false"}
|
|
8888
|
-
@change=${(event) =>
|
|
9025
|
+
@change=${(event) => update(event.target.checked)}
|
|
8889
9026
|
/>
|
|
8890
9027
|
${field.label}${field.isRequired ? " *" : ""}
|
|
8891
9028
|
</span>
|
|
@@ -8902,7 +9039,7 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
8902
9039
|
.value=${String(values[field.id] ?? "")}
|
|
8903
9040
|
aria-invalid=${this.fieldErrors[errorKey] ? "true" : "false"}
|
|
8904
9041
|
aria-describedby=${this.fieldErrors[errorKey] ? id : nothing}
|
|
8905
|
-
@input=${(event) =>
|
|
9042
|
+
@input=${(event) => update(event.target.value)}
|
|
8906
9043
|
></textarea>
|
|
8907
9044
|
${this.renderFieldError(errorKey)}
|
|
8908
9045
|
</label>
|
|
@@ -8918,7 +9055,7 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
8918
9055
|
.value=${String(values[field.id] ?? "")}
|
|
8919
9056
|
aria-invalid=${this.fieldErrors[errorKey] ? "true" : "false"}
|
|
8920
9057
|
aria-describedby=${this.fieldErrors[errorKey] ? id : nothing}
|
|
8921
|
-
@input=${(event) =>
|
|
9058
|
+
@input=${(event) => update(event.target.value)}
|
|
8922
9059
|
/>
|
|
8923
9060
|
${this.renderFieldError(errorKey)}
|
|
8924
9061
|
</label>
|
|
@@ -8928,19 +9065,22 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
8928
9065
|
return this.renderCategorySupplements(this.categoryId);
|
|
8929
9066
|
}
|
|
8930
9067
|
renderCategorySupplements(categoryId, guestIndex) {
|
|
8931
|
-
const
|
|
9068
|
+
const guest = guestIndex === undefined ? undefined : this.guestRegistrations[guestIndex];
|
|
9069
|
+
const supplements = this.getSupplementsForCategory(categoryId, this.conditionAnswers(categoryId, guest));
|
|
8932
9070
|
if (!supplements.length)
|
|
8933
9071
|
return nothing;
|
|
9072
|
+
const category = this.event?.categories.find((item) => item.id === categoryId);
|
|
9073
|
+
const isTeam = (category?.teamSize ?? 1) > 1;
|
|
8934
9074
|
return html`<fieldset
|
|
8935
9075
|
part="card ${guestIndex === undefined ? "supplements" : "guest-supplements"}"
|
|
8936
9076
|
>
|
|
8937
9077
|
<legend part="title">Extras</legend>
|
|
8938
9078
|
<div part="stack">
|
|
8939
|
-
${supplements.map((supplement) => this.renderSupplement(supplement, guestIndex))}
|
|
9079
|
+
${supplements.map((supplement) => this.renderSupplement(supplement, isTeam, guestIndex))}
|
|
8940
9080
|
</div>
|
|
8941
9081
|
</fieldset>`;
|
|
8942
9082
|
}
|
|
8943
|
-
renderSupplement(supplement, guestIndex) {
|
|
9083
|
+
renderSupplement(supplement, isTeam, guestIndex) {
|
|
8944
9084
|
const ids = guestIndex === undefined ? this.selectedSupplementIds : this.guestRegistrations[guestIndex]?.selectedSupplementIds ?? [];
|
|
8945
9085
|
const selections = guestIndex === undefined ? this.supplementSelections : this.guestRegistrations[guestIndex]?.supplementSelections ?? [];
|
|
8946
9086
|
const selection = selections.find((item) => item.supplementId === supplement.id);
|
|
@@ -9003,7 +9143,7 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9003
9143
|
@input=${(event) => update({ quantity: event.target.valueAsNumber })}
|
|
9004
9144
|
/>
|
|
9005
9145
|
</label>` : nothing}
|
|
9006
|
-
${supplement.pricingMode === "PER_TEAM_MEMBER" ? html`<small part="hint">${t(this.locale, "perParticipant")}</small>` : nothing}
|
|
9146
|
+
${isTeam && supplement.pricingMode === "PER_TEAM_MEMBER" ? html`<small part="hint">${t(this.locale, "perParticipant")}</small>` : nothing}
|
|
9007
9147
|
${perUnit ? html`<small part="hint">${t(this.locale, "perUnit")}</small>` : nothing}
|
|
9008
9148
|
${supplement.description ? html`<small part="hint">${supplement.description}</small>` : nothing}
|
|
9009
9149
|
${this.renderFieldError(errorKey)}
|
|
@@ -9070,7 +9210,7 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9070
9210
|
</select>
|
|
9071
9211
|
${this.renderFieldError(`guestRegistrations.${index}.categoryId`)}
|
|
9072
9212
|
</label>
|
|
9073
|
-
${this.renderGuestInput(index, "teamName", t(this.locale, "teamName"), guest.teamName, "text", true)}
|
|
9213
|
+
${this.renderGuestInput(index, "teamName", t(this.locale, guestCategory?.teamSize === 1 ? "bibName" : "teamName"), guest.teamName, "text", true)}
|
|
9074
9214
|
${this.renderGuestInput(index, "club", t(this.locale, "club"), guest.club, "text", false)}
|
|
9075
9215
|
</div>
|
|
9076
9216
|
${guestCategory ? this.renderEligibilitySummary(guestCategory) : nothing}
|
|
@@ -9080,6 +9220,7 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9080
9220
|
${this.renderFieldError(`guestRegistrations.${index}.ageRule`)}
|
|
9081
9221
|
${this.renderCustomFields(guest.categoryId, index)}
|
|
9082
9222
|
${this.renderGuestSupplements(guest, index)}
|
|
9223
|
+
${this.checkoutWaivers(guest.categoryId, guest).filter((waiver) => this.isEntryWaiver(waiver)).map((waiver) => this.renderWaiver(waiver, guest))}
|
|
9083
9224
|
<button
|
|
9084
9225
|
part="button secondary remove-guest"
|
|
9085
9226
|
type="button"
|
|
@@ -9087,7 +9228,7 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9087
9228
|
>
|
|
9088
9229
|
${t(this.locale, "remove")}
|
|
9089
9230
|
</button>
|
|
9090
|
-
${guestCategory ? html`<small part="hint"
|
|
9231
|
+
${guestCategory && guestCategory.teamSize > 1 ? html`<small part="hint"
|
|
9091
9232
|
>${t(this.locale, "teamSize")}
|
|
9092
9233
|
${formatNumber(guestCategory.teamSize, this.locale)}</small
|
|
9093
9234
|
>` : nothing}
|
|
@@ -9150,6 +9291,7 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9150
9291
|
${this.renderFieldError(genderErrorKey)}
|
|
9151
9292
|
</label>
|
|
9152
9293
|
</div>
|
|
9294
|
+
${athleteIndex > 0 ? this.renderCustomFields(this.guestRegistrations[guestIndex]?.categoryId, guestIndex, athleteIndex) : nothing}
|
|
9153
9295
|
</fieldset>
|
|
9154
9296
|
`;
|
|
9155
9297
|
}
|
|
@@ -9182,10 +9324,7 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9182
9324
|
return this.renderCategorySupplements(guest.categoryId, guestIndex);
|
|
9183
9325
|
}
|
|
9184
9326
|
get signatureWaivers() {
|
|
9185
|
-
return
|
|
9186
|
-
this.categoryId,
|
|
9187
|
-
...this.guestRegistrations.map((guest) => guest.categoryId)
|
|
9188
|
-
]).filter((waiver) => waiver.requiresSignature);
|
|
9327
|
+
return this.visibleWaivers.filter((waiver) => waiver.requiresSignature);
|
|
9189
9328
|
}
|
|
9190
9329
|
get hasMinorParticipants() {
|
|
9191
9330
|
const today = new Date;
|
|
@@ -9285,10 +9424,10 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9285
9424
|
</section>`;
|
|
9286
9425
|
}
|
|
9287
9426
|
renderWaivers() {
|
|
9288
|
-
const waivers =
|
|
9289
|
-
this.
|
|
9290
|
-
...this.
|
|
9291
|
-
]
|
|
9427
|
+
const waivers = [
|
|
9428
|
+
...this.visibleWaivers.filter((waiver) => !this.isEntryWaiver(waiver)),
|
|
9429
|
+
...this.checkoutWaivers(this.categoryId).filter((waiver) => this.isEntryWaiver(waiver))
|
|
9430
|
+
];
|
|
9292
9431
|
if (!waivers.length)
|
|
9293
9432
|
return nothing;
|
|
9294
9433
|
return html`
|
|
@@ -9298,17 +9437,18 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9298
9437
|
</fieldset>
|
|
9299
9438
|
`;
|
|
9300
9439
|
}
|
|
9301
|
-
renderWaiver(waiver) {
|
|
9302
|
-
const
|
|
9440
|
+
renderWaiver(waiver, guest) {
|
|
9441
|
+
const acceptanceKey = this.waiverAcceptanceKey(waiver, guest);
|
|
9442
|
+
const errorKey = `waivers.${acceptanceKey}`;
|
|
9303
9443
|
return html`
|
|
9304
9444
|
<label part="label checkbox waiver">
|
|
9305
9445
|
<span>
|
|
9306
9446
|
<input
|
|
9307
9447
|
part="checkbox"
|
|
9308
9448
|
type="checkbox"
|
|
9309
|
-
.checked=${this.waiversAccepted[
|
|
9449
|
+
.checked=${this.waiversAccepted[acceptanceKey] === true}
|
|
9310
9450
|
aria-invalid=${this.fieldErrors[errorKey] ? "true" : "false"}
|
|
9311
|
-
@change=${(event) => this.updateWaiver(
|
|
9451
|
+
@change=${(event) => this.updateWaiver(acceptanceKey, event.target.checked)}
|
|
9312
9452
|
/>
|
|
9313
9453
|
${waiver.name}${waiver.isRequired ? " *" : ""}
|
|
9314
9454
|
</span>
|
|
@@ -9470,8 +9610,8 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9470
9610
|
if (JSON.stringify(selections) !== JSON.stringify(this.supplementSelections))
|
|
9471
9611
|
this.supplementSelections = selections;
|
|
9472
9612
|
}
|
|
9473
|
-
normalizeSupplementSelections(categoryId, selections) {
|
|
9474
|
-
return this.getSupplementsForCategory(categoryId).flatMap((supplement) => {
|
|
9613
|
+
normalizeSupplementSelections(categoryId, selections, answers = this.conditionAnswers(categoryId)) {
|
|
9614
|
+
return this.getSupplementsForCategory(categoryId, answers).flatMap((supplement) => {
|
|
9475
9615
|
const selection = selections.find((item) => item.supplementId === supplement.id);
|
|
9476
9616
|
const options = (supplement.options ?? []).filter((option) => option.isActive);
|
|
9477
9617
|
if (options.length && !options.some((option) => option.id === selection?.optionId))
|
|
@@ -9496,14 +9636,14 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9496
9636
|
this.guestRegistrations = next;
|
|
9497
9637
|
}
|
|
9498
9638
|
}
|
|
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);
|
|
9639
|
+
getRequiredSupplementIds(categoryId, answers = this.conditionAnswers(categoryId)) {
|
|
9640
|
+
return this.getSupplementsForCategory(categoryId, answers).filter((supplement) => supplement.isRequired && supplement.pricingMode !== "PER_UNIT" && !(supplement.options ?? []).some((option) => option.isActive)).map((supplement) => supplement.id);
|
|
9501
9641
|
}
|
|
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));
|
|
9642
|
+
normalizeSupplementIdsForCategory(categoryId, selectedIds, answers = this.conditionAnswers(categoryId)) {
|
|
9643
|
+
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
9644
|
return [
|
|
9505
9645
|
...new Set([
|
|
9506
|
-
...this.getRequiredSupplementIds(categoryId),
|
|
9646
|
+
...this.getRequiredSupplementIds(categoryId, answers),
|
|
9507
9647
|
...selectedIds.filter((supplementId) => availableIds.has(supplementId))
|
|
9508
9648
|
])
|
|
9509
9649
|
];
|
|
@@ -9514,13 +9654,14 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9514
9654
|
createGuestRegistration() {
|
|
9515
9655
|
const categoryId = (categoryAvailabilityMessage(this.selectedCategory, this.locale) ? "" : this.categoryId) || this.event?.categories.find((category) => !categoryAvailabilityMessage(category, this.locale))?.id || "";
|
|
9516
9656
|
return this.normalizeGuestRegistration({
|
|
9657
|
+
draftId: this.nextGuestDraftId++,
|
|
9517
9658
|
guestName: "",
|
|
9518
9659
|
guestEmail: "",
|
|
9519
9660
|
categoryId,
|
|
9520
9661
|
teamName: "",
|
|
9521
9662
|
club: "",
|
|
9522
9663
|
athletes: [emptyAthlete()],
|
|
9523
|
-
selectedSupplementIds:
|
|
9664
|
+
selectedSupplementIds: [],
|
|
9524
9665
|
selectedGenderCompositionIndex: this.defaultGenderCompositionIndex(this.getCategory(categoryId))
|
|
9525
9666
|
});
|
|
9526
9667
|
}
|
|
@@ -9530,8 +9671,8 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9530
9671
|
const sizedAthletes = Array.from({ length: teamSize }, (_, index) => guest.athletes[index] ?? emptyAthlete());
|
|
9531
9672
|
const selectedGenderCompositionIndex = this.normalizeGenderCompositionIndex(category, guest.selectedGenderCompositionIndex);
|
|
9532
9673
|
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 ?? []);
|
|
9674
|
+
const selectedSupplementIds = this.normalizeSupplementIdsForCategory(guest.categoryId, guest.selectedSupplementIds, this.conditionAnswers(guest.categoryId, { ...guest, athletes }));
|
|
9675
|
+
const supplementSelections = this.normalizeSupplementSelections(guest.categoryId, guest.supplementSelections ?? [], this.conditionAnswers(guest.categoryId, { ...guest, athletes }));
|
|
9535
9676
|
return {
|
|
9536
9677
|
...guest,
|
|
9537
9678
|
athletes,
|
|
@@ -9615,21 +9756,30 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9615
9756
|
this.clearFieldError("genderComposition");
|
|
9616
9757
|
this.clearFieldError("genderPolicy");
|
|
9617
9758
|
}
|
|
9618
|
-
|
|
9759
|
+
customFieldErrorKey(fieldId, guestIndex, participantIndex) {
|
|
9760
|
+
const registration = guestIndex === undefined ? "" : `guestRegistrations.${guestIndex}.`;
|
|
9761
|
+
const participant = participantIndex === undefined ? "" : `athletes.${participantIndex}.`;
|
|
9762
|
+
return `${registration}${participant}customFields.${fieldId}`;
|
|
9763
|
+
}
|
|
9764
|
+
updateCustomField(fieldId, value, guestIndex, participantIndex) {
|
|
9765
|
+
const updateAthletes = (athletes) => athletes.map((athlete, position) => position === participantIndex ? {
|
|
9766
|
+
...athlete,
|
|
9767
|
+
conditionalFieldValues: { ...athlete.conditionalFieldValues, [fieldId]: value }
|
|
9768
|
+
} : athlete);
|
|
9619
9769
|
if (guestIndex === undefined) {
|
|
9620
|
-
|
|
9621
|
-
|
|
9770
|
+
if (participantIndex === undefined) {
|
|
9771
|
+
this.customFieldValues = { ...this.customFieldValues, [fieldId]: value };
|
|
9772
|
+
} else {
|
|
9773
|
+
this.athletes = updateAthletes(this.athletes);
|
|
9774
|
+
}
|
|
9622
9775
|
} 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}`);
|
|
9776
|
+
this.guestRegistrations = this.guestRegistrations.map((guest, index) => index !== guestIndex ? guest : participantIndex === undefined ? { ...guest, customFieldValues: { ...guest.customFieldValues, [fieldId]: value } } : { ...guest, athletes: updateAthletes(guest.athletes) });
|
|
9628
9777
|
}
|
|
9778
|
+
this.clearFieldError(this.customFieldErrorKey(fieldId, guestIndex, participantIndex));
|
|
9629
9779
|
}
|
|
9630
|
-
updateWaiver(
|
|
9631
|
-
this.waiversAccepted = { ...this.waiversAccepted, [
|
|
9632
|
-
this.clearFieldError(`waivers.${
|
|
9780
|
+
updateWaiver(acceptanceKey, accepted) {
|
|
9781
|
+
this.waiversAccepted = { ...this.waiversAccepted, [acceptanceKey]: accepted };
|
|
9782
|
+
this.clearFieldError(`waivers.${acceptanceKey}`);
|
|
9633
9783
|
}
|
|
9634
9784
|
updateSupplement(supplementId, selected) {
|
|
9635
9785
|
this.selectedSupplementIds = selected ? [...new Set([...this.selectedSupplementIds, supplementId])] : this.selectedSupplementIds.filter((id) => id !== supplementId);
|
|
@@ -9654,8 +9804,8 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9654
9804
|
const positionsAreValid = uniquePositions.size === this.pendingParticipantPositions.length && this.pendingParticipantPositions.every((position) => Number.isInteger(position) && position > 0 && position < category.teamSize);
|
|
9655
9805
|
return positionsAreValid ? null : t(this.locale, "invalidSelection");
|
|
9656
9806
|
}
|
|
9657
|
-
validateSupplements(errors, categoryId, ids, selections, prefix = "") {
|
|
9658
|
-
for (const supplement of this.getSupplementsForCategory(categoryId)) {
|
|
9807
|
+
validateSupplements(errors, categoryId, ids, selections, prefix = "", guest) {
|
|
9808
|
+
for (const supplement of this.getSupplementsForCategory(categoryId, this.conditionAnswers(categoryId, guest))) {
|
|
9659
9809
|
const selection = selections.find((item) => item.supplementId === supplement.id);
|
|
9660
9810
|
const options = (supplement.options ?? []).filter((option) => option.isActive);
|
|
9661
9811
|
const key = `${prefix}supplements.${supplement.id}`;
|
|
@@ -9667,10 +9817,24 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9667
9817
|
errors[key] = t(this.locale, "invalidNumber");
|
|
9668
9818
|
}
|
|
9669
9819
|
}
|
|
9820
|
+
validateRegistrationFields(errors, categoryId, values, guestIndex, participantIndex) {
|
|
9821
|
+
const conditions = this.conditionFieldIds(categoryId);
|
|
9822
|
+
for (const field of this.event?.eventFormFields ?? []) {
|
|
9823
|
+
if (!isFormFieldTargetAthlete(field) || !isFormFieldAvailableForCategory(field, categoryId) || participantIndex !== undefined && !conditions.has(field.id))
|
|
9824
|
+
continue;
|
|
9825
|
+
const value = values?.[field.id];
|
|
9826
|
+
const input = isCheckboxField(field) && conditions.has(field.id) ? {
|
|
9827
|
+
value: typeof value === "boolean" ? String(value) : undefined,
|
|
9828
|
+
type: "SELECT",
|
|
9829
|
+
options: ["true", "false"]
|
|
9830
|
+
} : { value, type: field.type, options: field.options };
|
|
9831
|
+
setValidationError(errors, this.locale, this.customFieldErrorKey(field.id, guestIndex, participantIndex), validateCustomFieldValue(input.value, input.type, input.options, field.isRequired));
|
|
9832
|
+
}
|
|
9833
|
+
}
|
|
9670
9834
|
validate() {
|
|
9671
9835
|
const errors = {};
|
|
9672
9836
|
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}
|
|
9837
|
+
this.guestRegistrations.forEach((guest, index) => this.validateSupplements(errors, guest.categoryId, guest.selectedSupplementIds, guest.supplementSelections ?? [], `guestRegistrations.${index}.`, guest));
|
|
9674
9838
|
setValidationError(errors, this.locale, "purchaserName", validateRequiredText(this.purchaserName));
|
|
9675
9839
|
setValidationError(errors, this.locale, "purchaserEmail", validateEmail(this.purchaserEmail, true));
|
|
9676
9840
|
setValidationError(errors, this.locale, "teamName", validateRequiredText(this.teamName));
|
|
@@ -9714,9 +9878,7 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9714
9878
|
}
|
|
9715
9879
|
for (const [guestIndex, guest] of this.guestRegistrations.entries()) {
|
|
9716
9880
|
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
|
-
}
|
|
9881
|
+
this.validateRegistrationFields(errors, guest.categoryId, guest.customFieldValues, guestIndex);
|
|
9720
9882
|
setValidationError(errors, this.locale, `guestRegistrations.${guestIndex}.guestName`, validateRequiredText(guest.guestName));
|
|
9721
9883
|
setValidationError(errors, this.locale, `guestRegistrations.${guestIndex}.guestEmail`, validateEmail(guest.guestEmail, true));
|
|
9722
9884
|
setValidationError(errors, this.locale, `guestRegistrations.${guestIndex}.teamName`, validateRequiredText(guest.teamName));
|
|
@@ -9724,6 +9886,8 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9724
9886
|
if (guestUnavailable)
|
|
9725
9887
|
errors[`guestRegistrations.${guestIndex}.categoryId`] = guestUnavailable;
|
|
9726
9888
|
for (const [athleteIndex, athlete] of guest.athletes.entries()) {
|
|
9889
|
+
if (athleteIndex > 0)
|
|
9890
|
+
this.validateRegistrationFields(errors, guest.categoryId, athlete.conditionalFieldValues, guestIndex, athleteIndex);
|
|
9727
9891
|
setValidationError(errors, this.locale, `guestRegistrations.${guestIndex}.athletes.${athleteIndex}.fullname`, validateRequiredText(athlete.fullname));
|
|
9728
9892
|
setValidationError(errors, this.locale, `guestRegistrations.${guestIndex}.athletes.${athleteIndex}.email`, validateEmail(athlete.email, true));
|
|
9729
9893
|
setValidationError(errors, this.locale, `guestRegistrations.${guestIndex}.athletes.${athleteIndex}.phone`, validateRequiredText(athlete.phone));
|
|
@@ -9749,15 +9913,15 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9749
9913
|
}
|
|
9750
9914
|
}
|
|
9751
9915
|
}
|
|
9752
|
-
|
|
9753
|
-
|
|
9916
|
+
this.validateRegistrationFields(errors, this.categoryId, this.customFieldValues);
|
|
9917
|
+
for (const [index, athlete] of this.athletes.entries()) {
|
|
9918
|
+
if (index > 0 && !this.isParticipantDeferred(index))
|
|
9919
|
+
this.validateRegistrationFields(errors, this.categoryId, athlete.conditionalFieldValues, undefined, index);
|
|
9754
9920
|
}
|
|
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");
|
|
9921
|
+
for (const { waiver, guest } of this.waiverEntries) {
|
|
9922
|
+
const acceptanceKey = this.waiverAcceptanceKey(waiver, guest);
|
|
9923
|
+
if (waiver.isRequired && this.waiversAccepted[acceptanceKey] !== true) {
|
|
9924
|
+
errors[`waivers.${acceptanceKey}`] = t(this.locale, "requiredWaiver");
|
|
9761
9925
|
}
|
|
9762
9926
|
}
|
|
9763
9927
|
if (this.signatureWaivers.length && (!this.signatureInput() || this.hasMinorParticipants && (!this.signatureDraft.minorRelationship || !this.signatureDraft.guardianAuthorityAccepted)))
|
|
@@ -9778,10 +9942,23 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9778
9942
|
buildGuestRegistrationsSummaryInput() {
|
|
9779
9943
|
return this.guestRegistrations.filter((guest) => hasText(guest.categoryId)).map((guest) => ({
|
|
9780
9944
|
categoryId: guest.categoryId.trim(),
|
|
9945
|
+
...this.conditionFieldIds(guest.categoryId).size ? { participantCustomFields: this.conditionAnswers(guest.categoryId, guest) } : {},
|
|
9781
9946
|
...guest.supplementSelections?.length ? { supplementSelections: guest.supplementSelections } : {},
|
|
9782
9947
|
...guest.selectedSupplementIds.length > 0 ? { selectedSupplementIds: guest.selectedSupplementIds } : {}
|
|
9783
9948
|
}));
|
|
9784
9949
|
}
|
|
9950
|
+
checkoutAthlete(athlete, categoryId) {
|
|
9951
|
+
const { conditionalFieldValues, ...details } = athlete;
|
|
9952
|
+
const customFields = this.fieldAnswers(categoryId, conditionalFieldValues);
|
|
9953
|
+
return {
|
|
9954
|
+
...details,
|
|
9955
|
+
fullname: details.fullname.trim(),
|
|
9956
|
+
email: details.email.trim(),
|
|
9957
|
+
phone: details.phone.trim(),
|
|
9958
|
+
idNumber: details.idNumber.trim(),
|
|
9959
|
+
...customFields.length ? { customFields } : {}
|
|
9960
|
+
};
|
|
9961
|
+
}
|
|
9785
9962
|
buildGuestRegistrationsCheckoutInput() {
|
|
9786
9963
|
if (!this.guestRegistrations.length)
|
|
9787
9964
|
return;
|
|
@@ -9796,14 +9973,8 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9796
9973
|
...guest.customFieldValues ? {
|
|
9797
9974
|
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
9975
|
} : {},
|
|
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
|
-
}))
|
|
9976
|
+
waiversAccepted: this.checkoutWaiverAcceptances(guest),
|
|
9977
|
+
athletes: guest.athletes.map((athlete) => this.checkoutAthlete(athlete, guest.categoryId))
|
|
9807
9978
|
}));
|
|
9808
9979
|
}
|
|
9809
9980
|
buildDeferredTeamCompletion() {
|
|
@@ -9817,7 +9988,7 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9817
9988
|
pendingParticipantPositions,
|
|
9818
9989
|
...slotGenders ? { slotGenders } : {},
|
|
9819
9990
|
participantWaivers: Array.from({ length: providedParticipantCount }, () => ({
|
|
9820
|
-
waiversAccepted:
|
|
9991
|
+
waiversAccepted: this.checkoutWaiverAcceptances()
|
|
9821
9992
|
}))
|
|
9822
9993
|
};
|
|
9823
9994
|
}
|
|
@@ -9841,6 +10012,7 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9841
10012
|
const input = {
|
|
9842
10013
|
categoryId: this.categoryId.trim(),
|
|
9843
10014
|
purchaserEmail: this.purchaserEmail.trim(),
|
|
10015
|
+
...this.conditionFieldIds(this.categoryId).size ? { participantCustomFields: this.conditionAnswers(this.categoryId) } : {},
|
|
9844
10016
|
selectedSupplementIds: this.selectedSupplementIds,
|
|
9845
10017
|
...this.supplementSelections.length ? { supplementSelections: this.supplementSelections } : {},
|
|
9846
10018
|
...this.buildGuestRegistrationsSummaryInput().length > 0 ? { guestRegistrations: this.buildGuestRegistrationsSummaryInput() } : {},
|
|
@@ -9949,22 +10121,14 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
9949
10121
|
purchaserName: this.purchaserName.trim(),
|
|
9950
10122
|
teamName: this.teamName.trim(),
|
|
9951
10123
|
termsAccepted: this.termsAccepted,
|
|
9952
|
-
waiversAccepted:
|
|
10124
|
+
waiversAccepted: this.checkoutWaiverAcceptances(),
|
|
9953
10125
|
selectedSupplementIds: this.selectedSupplementIds,
|
|
9954
10126
|
...this.supplementSelections.length ? { supplementSelections: this.supplementSelections } : {},
|
|
9955
10127
|
successUrl: this.successUrl.trim(),
|
|
9956
10128
|
cancelUrl: this.cancelUrl.trim(),
|
|
9957
10129
|
customFields,
|
|
9958
10130
|
...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
|
-
])
|
|
10131
|
+
athletes: this.athletes.flatMap((athlete, position) => this.isParticipantDeferred(position) ? [] : [this.checkoutAthlete(athlete, this.categoryId)])
|
|
9968
10132
|
};
|
|
9969
10133
|
const deferredTeamCompletion = this.buildDeferredTeamCompletion();
|
|
9970
10134
|
if (deferredTeamCompletion)
|
|
@@ -10010,7 +10174,6 @@ class WodiraRegistrationForm extends RegistrationWindowElement {
|
|
|
10010
10174
|
globalThis.location.assign(session.sessionUrl);
|
|
10011
10175
|
}
|
|
10012
10176
|
}
|
|
10013
|
-
|
|
10014
10177
|
class WodiraRegistrationReceiptSender extends LitElement {
|
|
10015
10178
|
static styles = [wodiraUiStyles, wodiraLayoutStyles];
|
|
10016
10179
|
static properties = {
|
|
@@ -10132,6 +10295,7 @@ class WodiraRegistrationReceiptSender extends LitElement {
|
|
|
10132
10295
|
}
|
|
10133
10296
|
}
|
|
10134
10297
|
}
|
|
10298
|
+
|
|
10135
10299
|
class WodiraCheckoutFlow extends LitElement {
|
|
10136
10300
|
static styles = [wodiraUiStyles, wodiraLayoutStyles];
|
|
10137
10301
|
static properties = {
|
|
@@ -10310,6 +10474,7 @@ class WodiraCheckoutFlow extends LitElement {
|
|
|
10310
10474
|
var ELEMENTS = [
|
|
10311
10475
|
["wodira-signature-pad", WodiraSignaturePad],
|
|
10312
10476
|
["wodira-shirt-auction", WodiraShirtAuction2],
|
|
10477
|
+
["wodira-route-3d", WodiraRoute3d2],
|
|
10313
10478
|
["wodira-event-card", WodiraEventCard],
|
|
10314
10479
|
["wodira-event-list", WodiraEventList],
|
|
10315
10480
|
["wodira-pricing-cards", WodiraPricingCards],
|
|
@@ -10365,12 +10530,14 @@ export {
|
|
|
10365
10530
|
WodiraPricingCards,
|
|
10366
10531
|
WodiraRegistrationForm,
|
|
10367
10532
|
WodiraRegistrationReceiptSender,
|
|
10533
|
+
WodiraRoute3d2 as WodiraRoute3d,
|
|
10368
10534
|
WodiraShirtAuction2 as WodiraShirtAuction,
|
|
10369
10535
|
WodiraSignaturePad,
|
|
10370
10536
|
applyWodiraTheme,
|
|
10371
10537
|
createWodiraCheckoutFlow,
|
|
10372
10538
|
createWodiraRegistrationReceiptSender,
|
|
10373
10539
|
defineWodiraElements,
|
|
10540
|
+
defineWodiraRouteElements2 as defineWodiraRouteElements,
|
|
10374
10541
|
defineWodiraShirtElements2 as defineWodiraShirtElements,
|
|
10375
10542
|
wodiraThemeTokens,
|
|
10376
10543
|
wodiraThemes
|