@wix/himalaya-cli 0.1947.0 → 0.1948.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/admob-ids.d.ts +4 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/index.d.ts +1 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/schema.d.ts +3 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +8 -2
- package/dist/browser-plane/assets.json +5 -5
- package/dist/browser-plane/preview-deferred/{da958a2a47eef7082c7892c1cc755a58bbeefcb4b617b47fde87f1ce567b3e64.bin → 1425fc7ef3149df8ba41fdbcca629cefd430a2cae524822c21985f0aade6430a.bin} +1 -1
- package/dist/browser-plane/sw.js +9 -9
- package/dist/cli.mjs +1820 -776
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/getting-started.md +6 -1
- package/guides/himi-skill.md +6 -1
- package/guides/himi-test.md +30 -1
- package/guides/one-app-section-mappings.md +1 -1
- package/guides/one-app-to-himi-app.md +21 -14
- package/guides/sdk-reference.json +1 -1
- package/guides/skill.md +1 -1
- package/package.json +2 -2
- package/templates/branded-lite/recipes/form-section.json +958 -0
- package/templates/branded-lite/tier5-src/_shared/event-agenda.ts +15 -15
- package/templates/branded-lite/tier5-src/_shared/event-schedule-section.ts +8 -8
- package/templates/branded-lite/tier5-src/_shared/form-section.ts +640 -0
- package/templates/branded-lite/tier5-src/himi-branded-lite-form/index.ts +4 -588
- package/templates/branded-lite/tier5-src/himi-events-detail/index.ts +7 -6
- package/templates/community-club/tier5-src/himi-events-detail/index.ts +7 -6
- package/templates/conference/tier5-src/_shared/event-agenda.ts +15 -15
- package/templates/conference/tier5-src/himi-conference-agenda/index.ts +3 -5
- package/templates/conference/tier5-src/himi-conference-home/index.ts +5 -6
- package/templates/conference/tier5-src/himi-events-detail/index.ts +7 -6
- package/templates/events-meetups/tier5-src/himi-events-detail/index.ts +7 -6
- package/templates/gym-fitness/tier5-src/himi-events-detail/index.ts +7 -6
- package/templates/nonprofit-cause/tier5-src/himi-events-detail/index.ts +7 -6
- package/templates/podcast-creator/tier5-src/himi-events-detail/index.ts +7 -6
- package/templates/portfolio-creative/tier5-src/himi-events-detail/index.ts +7 -6
- package/templates/professional-services/tier5-src/himi-events-detail/index.ts +7 -6
- package/templates/restaurant/tier5-src/himi-events-detail/index.ts +7 -6
- package/templates/yoga-studio/tier5-src/himi-events-detail/index.ts +7 -6
|
@@ -475,7 +475,7 @@ function calendarFallbackUrl(s: S, end: number): string {
|
|
|
475
475
|
|
|
476
476
|
/** The Events v3 fieldsets the detail reads (see `WixEventFieldset`). DETAILS carries mainImage and
|
|
477
477
|
* shortDescription: REGISTRATION fills eventType, which skips the query enrichment that used to supply them. */
|
|
478
|
-
export const EVENT_DETAIL_FIELDSETS: WixEventFieldset[] = ["DETAILS", "TEXTS", "REGISTRATION", "URLS", "FORM"
|
|
478
|
+
export const EVENT_DETAIL_FIELDSETS: WixEventFieldset[] = ["DETAILS", "TEXTS", "REGISTRATION", "URLS", "FORM"];
|
|
479
479
|
|
|
480
480
|
function detailCopy(key: string, fallback: string): string { return copyParam(key, fallback); }
|
|
481
481
|
|
|
@@ -1065,25 +1065,26 @@ const svc: ReturnType<typeof defineService<S, DetailActions>> = defineService<S,
|
|
|
1065
1065
|
const dates = detailDate(e);
|
|
1066
1066
|
const place = detailPlace(e);
|
|
1067
1067
|
const registration = registrationUi(e, Date.now());
|
|
1068
|
-
const rawEvent = e as unknown as { shortDescription?: string;
|
|
1068
|
+
const rawEvent = e as unknown as { shortDescription?: string; dateAndTimeSettings?: { recurrenceStatus?: string; recurringEvents?: { categoryId?: string } }; registration?: { allowedGuestTypes?: string; tickets?: { lowestPrice?: EventDetailMoney; highestPrice?: EventDetailMoney } } };
|
|
1069
1069
|
const lowest = detailMoney(rawEvent.registration?.tickets?.lowestPrice);
|
|
1070
1070
|
const highest = detailMoney(rawEvent.registration?.tickets?.highestPrice);
|
|
1071
1071
|
const price = kind === "tickets" && lowest ? (highest && highest !== lowest ? detailCopy("event.priceFrom", "From {price}").replace("{price}", lowest) : lowest) : "";
|
|
1072
1072
|
const memberProbeNeeded = kind === "rsvp" || rawEvent.registration?.allowedGuestTypes === "MEMBER";
|
|
1073
1073
|
const isMember = memberProbeNeeded ? await signedInMember() : false;
|
|
1074
1074
|
const [scheduleResponse, policyResponse, rsvpResponse] = await Promise.all([
|
|
1075
|
-
// `limit` is required: without it Wix answers the agenda's `total` with an EMPTY `items`.
|
|
1076
|
-
|
|
1075
|
+
// `limit` is required: without it Wix answers the agenda's `total` with an EMPTY `items`. Read whatever the
|
|
1076
|
+
// event's agenda switch says: it is the website's agenda page, and Wix still answers a visitor with it off.
|
|
1077
|
+
bestEffort("GET", `/events/v1/schedule?eventId=${encodeURIComponent(id)}&limit=100`),
|
|
1077
1078
|
bestEffort("POST", "/events-policies/v2/policies/query", { query: { filter: { eventId: { $eq: id } }, paging: { limit: 100 } } }),
|
|
1078
1079
|
kind === "rsvp" && isMember ? bestEffort("GET", `/events/v2/rsvps/current?eventId=${encodeURIComponent(id)}`) : undefined,
|
|
1079
1080
|
]);
|
|
1080
1081
|
let optionalReadFailed = [scheduleResponse, policyResponse, rsvpResponse].some((response) => response?.ok === false);
|
|
1081
1082
|
const scheduleRaw = (scheduleResponse?.ok ? scheduleResponse.value : undefined) as { agenda?: Array<Record<string, unknown>>; schedule?: Array<Record<string, unknown>>; items?: Array<Record<string, unknown>>; agendaItems?: Array<Record<string, unknown>> } | undefined;
|
|
1082
|
-
// A hidden or
|
|
1083
|
+
// A hidden, canceled or draft session is not on the agenda, and an item id is listed once (an owner's
|
|
1083
1084
|
// read carries a draft and its published copy); sessions in start order.
|
|
1084
1085
|
const seenItems = new Set<string>();
|
|
1085
1086
|
const scheduleSource = (scheduleRaw?.agenda ?? scheduleRaw?.agendaItems ?? scheduleRaw?.schedule ?? scheduleRaw?.items ?? [])
|
|
1086
|
-
.filter((item) => item.hidden !== true && String(item.status ?? "").toUpperCase() !== "CANCELED")
|
|
1087
|
+
.filter((item) => item.hidden !== true && item.draft !== true && String(item.status ?? "").toUpperCase() !== "CANCELED")
|
|
1087
1088
|
.filter((item) => { const key = String(item.id ?? ""); if (!key) return true; if (seenItems.has(key)) return false; seenItems.add(key); return true; })
|
|
1088
1089
|
.map((item) => ({ item, at: Date.parse(String((item.timeSlot as { start?: string } | undefined)?.start ?? item.startTime ?? item.startDate ?? "")) }))
|
|
1089
1090
|
.sort((a, b) => (Number.isNaN(a.at) ? Infinity : a.at) - (Number.isNaN(b.at) ? Infinity : b.at))
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
// visible session in start order, its time range and length in the EVENT's time zone (an
|
|
3
3
|
// attendee abroad plans by the venue's clock), its stage, and the day it falls on.
|
|
4
4
|
//
|
|
5
|
-
// Read from the visitor-readable `GET /events/v1/schedule?eventId
|
|
6
|
-
//
|
|
7
|
-
//
|
|
5
|
+
// Read from the visitor-readable `GET /events/v1/schedule?eventId=`, whatever the event's
|
|
6
|
+
// `agendaSettings.enabled` says: that switch is the website's agenda page, not the API's. With it
|
|
7
|
+
// off, Wix still answers a visitor 200 — the published sessions for a One App visitor, an empty
|
|
8
|
+
// list where there are none — and One App shows them. A failed read is reported (`ok: false`) so
|
|
9
|
+
// the caller can show an error with Retry, never an empty agenda.
|
|
8
10
|
import { calendarDay, formatClock, formatWeekdayMonthDayLong } from "./engine-intl.js";
|
|
9
11
|
import { copyParam, copyTemplate } from "./himi-copy.js";
|
|
10
12
|
|
|
@@ -55,14 +57,15 @@ export function durationLabel(minutes: number): string {
|
|
|
55
57
|
}
|
|
56
58
|
|
|
57
59
|
interface RawItem {
|
|
58
|
-
id?: unknown; name?: unknown; title?: unknown; hidden?: unknown; status?: unknown;
|
|
60
|
+
id?: unknown; name?: unknown; title?: unknown; hidden?: unknown; status?: unknown; draft?: unknown;
|
|
59
61
|
stageName?: unknown; description?: unknown;
|
|
60
62
|
timeSlot?: { start?: unknown; end?: unknown; timeZoneId?: unknown };
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
/** One session row from a Wix schedule item, or null for a hidden, draft or unnamed one. */
|
|
64
66
|
export function agendaSession(item: RawItem, eventZone: string): AgendaSession | null {
|
|
65
|
-
|
|
67
|
+
// An owner's read lists each item's draft copy too (`draft: true`), and only the draft until it is published.
|
|
68
|
+
if (item.hidden === true || item.draft === true) return null;
|
|
66
69
|
// Wix schedule items are SCHEDULED or CANCELED (a draft is a separate copy, not a status).
|
|
67
70
|
if (clean(item.status).toUpperCase() === "CANCELED") return null;
|
|
68
71
|
const id = clean(item.id), name = clean(item.name) || clean(item.title);
|
|
@@ -91,9 +94,9 @@ export function agendaSession(item: RawItem, eventZone: string): AgendaSession |
|
|
|
91
94
|
|
|
92
95
|
export type AgendaRead = { ok: true; sessions: AgendaSession[] } | { ok: false; sessions: AgendaSession[] };
|
|
93
96
|
|
|
94
|
-
/** The visible sessions of `eventId`, in start order.
|
|
95
|
-
export async function readAgenda(eventId: string,
|
|
96
|
-
if (!eventId
|
|
97
|
+
/** The visible sessions of `eventId`, in start order. */
|
|
98
|
+
export async function readAgenda(eventId: string, eventZone: string): Promise<AgendaRead> {
|
|
99
|
+
if (!eventId) return { ok: true, sessions: [] };
|
|
97
100
|
const api = wixApi();
|
|
98
101
|
if (!api) return { ok: false, sessions: [] };
|
|
99
102
|
try {
|
|
@@ -112,11 +115,8 @@ export async function readAgenda(eventId: string, agendaEnabled: boolean, eventZ
|
|
|
112
115
|
}
|
|
113
116
|
}
|
|
114
117
|
|
|
115
|
-
/** The event's own time zone
|
|
116
|
-
export function
|
|
117
|
-
const e = event as {
|
|
118
|
-
return
|
|
119
|
-
enabled: e?.agendaSettings?.enabled === true,
|
|
120
|
-
zone: clean(e?.dateAndTimeSettings?.timeZoneId) || clean(e?.scheduling?.config?.timeZoneId) || clean(e?.scheduling?.timeZoneId),
|
|
121
|
-
};
|
|
118
|
+
/** The event's own time zone, from an Events v3 record (the DETAILS fieldset carries it). */
|
|
119
|
+
export function eventZoneOf(event: unknown): string {
|
|
120
|
+
const e = event as { dateAndTimeSettings?: { timeZoneId?: unknown }; scheduling?: { timeZoneId?: unknown; config?: { timeZoneId?: unknown } } } | null;
|
|
121
|
+
return clean(e?.dateAndTimeSettings?.timeZoneId) || clean(e?.scheduling?.config?.timeZoneId) || clean(e?.scheduling?.timeZoneId);
|
|
122
122
|
}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import { defineService, navigate } from "@himalaya/state";
|
|
11
11
|
import { type WixEvent } from "@himalaya/wix-events";
|
|
12
12
|
import { readFeaturedEvent } from "../_shared/featured-event.js";
|
|
13
|
-
import {
|
|
13
|
+
import { eventZoneOf, readAgenda, type AgendaSession } from "../_shared/event-agenda.js";
|
|
14
14
|
import { starredSessions, toggleStar } from "../_shared/agenda-stars.js";
|
|
15
15
|
import { stashCopy, copyParam, copyTemplate } from "../_shared/himi-copy.js";
|
|
16
16
|
|
|
@@ -123,16 +123,14 @@ const now = (): S => (svc.getState?.() as S | undefined) ?? latest;
|
|
|
123
123
|
|
|
124
124
|
async function load(s: S): Promise<S> {
|
|
125
125
|
const mine = ++loadSeq;
|
|
126
|
-
|
|
127
|
-
const featured = await readFeaturedEvent(["DETAILS", "AGENDA"]);
|
|
126
|
+
const featured = await readFeaturedEvent(["DETAILS"]);
|
|
128
127
|
if (mine !== loadSeq) return now();
|
|
129
128
|
if (!featured.ok) return derive({ ...now(), status: "error" });
|
|
130
129
|
const e: WixEvent | null = featured.event;
|
|
131
130
|
// From the state as it is NOW (a filter tapped during the read stays), and with no message of
|
|
132
131
|
// an event that is gone.
|
|
133
132
|
if (!e?.id) return derive({ ...now(), status: "ready", eventId: "", eventTitle: "", sessions: [], starred: [], message: "" });
|
|
134
|
-
const
|
|
135
|
-
const agenda = await readAgenda(e.id, settings.enabled, settings.zone);
|
|
133
|
+
const agenda = await readAgenda(e.id, eventZoneOf(e));
|
|
136
134
|
if (mine !== loadSeq) return now();
|
|
137
135
|
// A failed read keeps the rows only when they are THIS event's: another event's sessions under
|
|
138
136
|
// this event's id would take stars for sessions it does not have.
|
|
@@ -15,7 +15,7 @@ import { queryDataItems, type WixDataItem } from "@himalaya/wix-data";
|
|
|
15
15
|
import { wixMediaUrl, WIX_DETAIL_IMAGE } from "@himalaya/wix-media";
|
|
16
16
|
import { open as openUrl } from "@himalaya/open-url";
|
|
17
17
|
import { readFeaturedEvent } from "../_shared/featured-event.js";
|
|
18
|
-
import {
|
|
18
|
+
import { eventZoneOf, readAgenda, type AgendaSession } from "../_shared/event-agenda.js";
|
|
19
19
|
import { registrationKindOf } from "../_shared/event-registration.js";
|
|
20
20
|
import { formatClock, formatDateMedium } from "../_shared/engine-intl.js";
|
|
21
21
|
import { signedInEmail } from "../_shared/himi-account.js";
|
|
@@ -255,8 +255,7 @@ async function load(_dispatched: S): Promise<S> {
|
|
|
255
255
|
const tapsAtStart = linkTaps;
|
|
256
256
|
const base = (): S => { const current = now(); return { ...current, linkMessage: linkTaps > tapsAtStart ? current.linkMessage : "" }; };
|
|
257
257
|
const [featured, speakers, workshops] = await Promise.all([
|
|
258
|
-
|
|
259
|
-
readFeaturedEvent(["DETAILS", "REGISTRATION", "AGENDA"]),
|
|
258
|
+
readFeaturedEvent(["DETAILS", "REGISTRATION"]),
|
|
260
259
|
readCollection(speakersCollection, (row) => speakerRow(row.id, row.data)),
|
|
261
260
|
readCollection(workshopsCollection, (row, index) => workshopRow(row.id, row.data, index + 1)),
|
|
262
261
|
]);
|
|
@@ -270,8 +269,8 @@ async function load(_dispatched: S): Promise<S> {
|
|
|
270
269
|
if (mine !== loadSeq) return now();
|
|
271
270
|
return derive({ ...base(), ...speakersPart, status: "ready", eventId: "", title: "", dateLine: "", venue: "", address: "", mapQuery: "", image: "", ctaLabel: "", agenda: [], agendaCountLabel: "" });
|
|
272
271
|
}
|
|
273
|
-
const
|
|
274
|
-
const agenda = await readAgenda(e.id,
|
|
272
|
+
const zone = eventZoneOf(e);
|
|
273
|
+
const agenda = await readAgenda(e.id, zone);
|
|
275
274
|
if (mine !== loadSeq) return now();
|
|
276
275
|
const venue = eventLocation(e);
|
|
277
276
|
const address = eventAddress(e);
|
|
@@ -281,7 +280,7 @@ async function load(_dispatched: S): Promise<S> {
|
|
|
281
280
|
status: "ready",
|
|
282
281
|
eventId: e.id,
|
|
283
282
|
title: clean(e.title) || copyParam("home.eventFallback", "Event"),
|
|
284
|
-
dateLine: heroDate(e,
|
|
283
|
+
dateLine: heroDate(e, zone),
|
|
285
284
|
venue: venue === "Location to be announced" ? copyParam("home.locationTbd", "Location to be announced") : venue,
|
|
286
285
|
// The full address, only when it says more than the venue's name.
|
|
287
286
|
address: address && address !== venue ? address : "",
|
|
@@ -475,7 +475,7 @@ function calendarFallbackUrl(s: S, end: number): string {
|
|
|
475
475
|
|
|
476
476
|
/** The Events v3 fieldsets the detail reads (see `WixEventFieldset`). DETAILS carries mainImage and
|
|
477
477
|
* shortDescription: REGISTRATION fills eventType, which skips the query enrichment that used to supply them. */
|
|
478
|
-
export const EVENT_DETAIL_FIELDSETS: WixEventFieldset[] = ["DETAILS", "TEXTS", "REGISTRATION", "URLS", "FORM"
|
|
478
|
+
export const EVENT_DETAIL_FIELDSETS: WixEventFieldset[] = ["DETAILS", "TEXTS", "REGISTRATION", "URLS", "FORM"];
|
|
479
479
|
|
|
480
480
|
function detailCopy(key: string, fallback: string): string { return copyParam(key, fallback); }
|
|
481
481
|
|
|
@@ -1065,25 +1065,26 @@ const svc: ReturnType<typeof defineService<S, DetailActions>> = defineService<S,
|
|
|
1065
1065
|
const dates = detailDate(e);
|
|
1066
1066
|
const place = detailPlace(e);
|
|
1067
1067
|
const registration = registrationUi(e, Date.now());
|
|
1068
|
-
const rawEvent = e as unknown as { shortDescription?: string;
|
|
1068
|
+
const rawEvent = e as unknown as { shortDescription?: string; dateAndTimeSettings?: { recurrenceStatus?: string; recurringEvents?: { categoryId?: string } }; registration?: { allowedGuestTypes?: string; tickets?: { lowestPrice?: EventDetailMoney; highestPrice?: EventDetailMoney } } };
|
|
1069
1069
|
const lowest = detailMoney(rawEvent.registration?.tickets?.lowestPrice);
|
|
1070
1070
|
const highest = detailMoney(rawEvent.registration?.tickets?.highestPrice);
|
|
1071
1071
|
const price = kind === "tickets" && lowest ? (highest && highest !== lowest ? detailCopy("event.priceFrom", "From {price}").replace("{price}", lowest) : lowest) : "";
|
|
1072
1072
|
const memberProbeNeeded = kind === "rsvp" || rawEvent.registration?.allowedGuestTypes === "MEMBER";
|
|
1073
1073
|
const isMember = memberProbeNeeded ? await signedInMember() : false;
|
|
1074
1074
|
const [scheduleResponse, policyResponse, rsvpResponse] = await Promise.all([
|
|
1075
|
-
// `limit` is required: without it Wix answers the agenda's `total` with an EMPTY `items`.
|
|
1076
|
-
|
|
1075
|
+
// `limit` is required: without it Wix answers the agenda's `total` with an EMPTY `items`. Read whatever the
|
|
1076
|
+
// event's agenda switch says: it is the website's agenda page, and Wix still answers a visitor with it off.
|
|
1077
|
+
bestEffort("GET", `/events/v1/schedule?eventId=${encodeURIComponent(id)}&limit=100`),
|
|
1077
1078
|
bestEffort("POST", "/events-policies/v2/policies/query", { query: { filter: { eventId: { $eq: id } }, paging: { limit: 100 } } }),
|
|
1078
1079
|
kind === "rsvp" && isMember ? bestEffort("GET", `/events/v2/rsvps/current?eventId=${encodeURIComponent(id)}`) : undefined,
|
|
1079
1080
|
]);
|
|
1080
1081
|
let optionalReadFailed = [scheduleResponse, policyResponse, rsvpResponse].some((response) => response?.ok === false);
|
|
1081
1082
|
const scheduleRaw = (scheduleResponse?.ok ? scheduleResponse.value : undefined) as { agenda?: Array<Record<string, unknown>>; schedule?: Array<Record<string, unknown>>; items?: Array<Record<string, unknown>>; agendaItems?: Array<Record<string, unknown>> } | undefined;
|
|
1082
|
-
// A hidden or
|
|
1083
|
+
// A hidden, canceled or draft session is not on the agenda, and an item id is listed once (an owner's
|
|
1083
1084
|
// read carries a draft and its published copy); sessions in start order.
|
|
1084
1085
|
const seenItems = new Set<string>();
|
|
1085
1086
|
const scheduleSource = (scheduleRaw?.agenda ?? scheduleRaw?.agendaItems ?? scheduleRaw?.schedule ?? scheduleRaw?.items ?? [])
|
|
1086
|
-
.filter((item) => item.hidden !== true && String(item.status ?? "").toUpperCase() !== "CANCELED")
|
|
1087
|
+
.filter((item) => item.hidden !== true && item.draft !== true && String(item.status ?? "").toUpperCase() !== "CANCELED")
|
|
1087
1088
|
.filter((item) => { const key = String(item.id ?? ""); if (!key) return true; if (seenItems.has(key)) return false; seenItems.add(key); return true; })
|
|
1088
1089
|
.map((item) => ({ item, at: Date.parse(String((item.timeSlot as { start?: string } | undefined)?.start ?? item.startTime ?? item.startDate ?? "")) }))
|
|
1089
1090
|
.sort((a, b) => (Number.isNaN(a.at) ? Infinity : a.at) - (Number.isNaN(b.at) ? Infinity : b.at))
|
|
@@ -475,7 +475,7 @@ function calendarFallbackUrl(s: S, end: number): string {
|
|
|
475
475
|
|
|
476
476
|
/** The Events v3 fieldsets the detail reads (see `WixEventFieldset`). DETAILS carries mainImage and
|
|
477
477
|
* shortDescription: REGISTRATION fills eventType, which skips the query enrichment that used to supply them. */
|
|
478
|
-
export const EVENT_DETAIL_FIELDSETS: WixEventFieldset[] = ["DETAILS", "TEXTS", "REGISTRATION", "URLS", "FORM"
|
|
478
|
+
export const EVENT_DETAIL_FIELDSETS: WixEventFieldset[] = ["DETAILS", "TEXTS", "REGISTRATION", "URLS", "FORM"];
|
|
479
479
|
|
|
480
480
|
function detailCopy(key: string, fallback: string): string { return copyParam(key, fallback); }
|
|
481
481
|
|
|
@@ -1065,25 +1065,26 @@ const svc: ReturnType<typeof defineService<S, DetailActions>> = defineService<S,
|
|
|
1065
1065
|
const dates = detailDate(e);
|
|
1066
1066
|
const place = detailPlace(e);
|
|
1067
1067
|
const registration = registrationUi(e, Date.now());
|
|
1068
|
-
const rawEvent = e as unknown as { shortDescription?: string;
|
|
1068
|
+
const rawEvent = e as unknown as { shortDescription?: string; dateAndTimeSettings?: { recurrenceStatus?: string; recurringEvents?: { categoryId?: string } }; registration?: { allowedGuestTypes?: string; tickets?: { lowestPrice?: EventDetailMoney; highestPrice?: EventDetailMoney } } };
|
|
1069
1069
|
const lowest = detailMoney(rawEvent.registration?.tickets?.lowestPrice);
|
|
1070
1070
|
const highest = detailMoney(rawEvent.registration?.tickets?.highestPrice);
|
|
1071
1071
|
const price = kind === "tickets" && lowest ? (highest && highest !== lowest ? detailCopy("event.priceFrom", "From {price}").replace("{price}", lowest) : lowest) : "";
|
|
1072
1072
|
const memberProbeNeeded = kind === "rsvp" || rawEvent.registration?.allowedGuestTypes === "MEMBER";
|
|
1073
1073
|
const isMember = memberProbeNeeded ? await signedInMember() : false;
|
|
1074
1074
|
const [scheduleResponse, policyResponse, rsvpResponse] = await Promise.all([
|
|
1075
|
-
// `limit` is required: without it Wix answers the agenda's `total` with an EMPTY `items`.
|
|
1076
|
-
|
|
1075
|
+
// `limit` is required: without it Wix answers the agenda's `total` with an EMPTY `items`. Read whatever the
|
|
1076
|
+
// event's agenda switch says: it is the website's agenda page, and Wix still answers a visitor with it off.
|
|
1077
|
+
bestEffort("GET", `/events/v1/schedule?eventId=${encodeURIComponent(id)}&limit=100`),
|
|
1077
1078
|
bestEffort("POST", "/events-policies/v2/policies/query", { query: { filter: { eventId: { $eq: id } }, paging: { limit: 100 } } }),
|
|
1078
1079
|
kind === "rsvp" && isMember ? bestEffort("GET", `/events/v2/rsvps/current?eventId=${encodeURIComponent(id)}`) : undefined,
|
|
1079
1080
|
]);
|
|
1080
1081
|
let optionalReadFailed = [scheduleResponse, policyResponse, rsvpResponse].some((response) => response?.ok === false);
|
|
1081
1082
|
const scheduleRaw = (scheduleResponse?.ok ? scheduleResponse.value : undefined) as { agenda?: Array<Record<string, unknown>>; schedule?: Array<Record<string, unknown>>; items?: Array<Record<string, unknown>>; agendaItems?: Array<Record<string, unknown>> } | undefined;
|
|
1082
|
-
// A hidden or
|
|
1083
|
+
// A hidden, canceled or draft session is not on the agenda, and an item id is listed once (an owner's
|
|
1083
1084
|
// read carries a draft and its published copy); sessions in start order.
|
|
1084
1085
|
const seenItems = new Set<string>();
|
|
1085
1086
|
const scheduleSource = (scheduleRaw?.agenda ?? scheduleRaw?.agendaItems ?? scheduleRaw?.schedule ?? scheduleRaw?.items ?? [])
|
|
1086
|
-
.filter((item) => item.hidden !== true && String(item.status ?? "").toUpperCase() !== "CANCELED")
|
|
1087
|
+
.filter((item) => item.hidden !== true && item.draft !== true && String(item.status ?? "").toUpperCase() !== "CANCELED")
|
|
1087
1088
|
.filter((item) => { const key = String(item.id ?? ""); if (!key) return true; if (seenItems.has(key)) return false; seenItems.add(key); return true; })
|
|
1088
1089
|
.map((item) => ({ item, at: Date.parse(String((item.timeSlot as { start?: string } | undefined)?.start ?? item.startTime ?? item.startDate ?? "")) }))
|
|
1089
1090
|
.sort((a, b) => (Number.isNaN(a.at) ? Infinity : a.at) - (Number.isNaN(b.at) ? Infinity : b.at))
|
|
@@ -475,7 +475,7 @@ function calendarFallbackUrl(s: S, end: number): string {
|
|
|
475
475
|
|
|
476
476
|
/** The Events v3 fieldsets the detail reads (see `WixEventFieldset`). DETAILS carries mainImage and
|
|
477
477
|
* shortDescription: REGISTRATION fills eventType, which skips the query enrichment that used to supply them. */
|
|
478
|
-
export const EVENT_DETAIL_FIELDSETS: WixEventFieldset[] = ["DETAILS", "TEXTS", "REGISTRATION", "URLS", "FORM"
|
|
478
|
+
export const EVENT_DETAIL_FIELDSETS: WixEventFieldset[] = ["DETAILS", "TEXTS", "REGISTRATION", "URLS", "FORM"];
|
|
479
479
|
|
|
480
480
|
function detailCopy(key: string, fallback: string): string { return copyParam(key, fallback); }
|
|
481
481
|
|
|
@@ -1065,25 +1065,26 @@ const svc: ReturnType<typeof defineService<S, DetailActions>> = defineService<S,
|
|
|
1065
1065
|
const dates = detailDate(e);
|
|
1066
1066
|
const place = detailPlace(e);
|
|
1067
1067
|
const registration = registrationUi(e, Date.now());
|
|
1068
|
-
const rawEvent = e as unknown as { shortDescription?: string;
|
|
1068
|
+
const rawEvent = e as unknown as { shortDescription?: string; dateAndTimeSettings?: { recurrenceStatus?: string; recurringEvents?: { categoryId?: string } }; registration?: { allowedGuestTypes?: string; tickets?: { lowestPrice?: EventDetailMoney; highestPrice?: EventDetailMoney } } };
|
|
1069
1069
|
const lowest = detailMoney(rawEvent.registration?.tickets?.lowestPrice);
|
|
1070
1070
|
const highest = detailMoney(rawEvent.registration?.tickets?.highestPrice);
|
|
1071
1071
|
const price = kind === "tickets" && lowest ? (highest && highest !== lowest ? detailCopy("event.priceFrom", "From {price}").replace("{price}", lowest) : lowest) : "";
|
|
1072
1072
|
const memberProbeNeeded = kind === "rsvp" || rawEvent.registration?.allowedGuestTypes === "MEMBER";
|
|
1073
1073
|
const isMember = memberProbeNeeded ? await signedInMember() : false;
|
|
1074
1074
|
const [scheduleResponse, policyResponse, rsvpResponse] = await Promise.all([
|
|
1075
|
-
// `limit` is required: without it Wix answers the agenda's `total` with an EMPTY `items`.
|
|
1076
|
-
|
|
1075
|
+
// `limit` is required: without it Wix answers the agenda's `total` with an EMPTY `items`. Read whatever the
|
|
1076
|
+
// event's agenda switch says: it is the website's agenda page, and Wix still answers a visitor with it off.
|
|
1077
|
+
bestEffort("GET", `/events/v1/schedule?eventId=${encodeURIComponent(id)}&limit=100`),
|
|
1077
1078
|
bestEffort("POST", "/events-policies/v2/policies/query", { query: { filter: { eventId: { $eq: id } }, paging: { limit: 100 } } }),
|
|
1078
1079
|
kind === "rsvp" && isMember ? bestEffort("GET", `/events/v2/rsvps/current?eventId=${encodeURIComponent(id)}`) : undefined,
|
|
1079
1080
|
]);
|
|
1080
1081
|
let optionalReadFailed = [scheduleResponse, policyResponse, rsvpResponse].some((response) => response?.ok === false);
|
|
1081
1082
|
const scheduleRaw = (scheduleResponse?.ok ? scheduleResponse.value : undefined) as { agenda?: Array<Record<string, unknown>>; schedule?: Array<Record<string, unknown>>; items?: Array<Record<string, unknown>>; agendaItems?: Array<Record<string, unknown>> } | undefined;
|
|
1082
|
-
// A hidden or
|
|
1083
|
+
// A hidden, canceled or draft session is not on the agenda, and an item id is listed once (an owner's
|
|
1083
1084
|
// read carries a draft and its published copy); sessions in start order.
|
|
1084
1085
|
const seenItems = new Set<string>();
|
|
1085
1086
|
const scheduleSource = (scheduleRaw?.agenda ?? scheduleRaw?.agendaItems ?? scheduleRaw?.schedule ?? scheduleRaw?.items ?? [])
|
|
1086
|
-
.filter((item) => item.hidden !== true && String(item.status ?? "").toUpperCase() !== "CANCELED")
|
|
1087
|
+
.filter((item) => item.hidden !== true && item.draft !== true && String(item.status ?? "").toUpperCase() !== "CANCELED")
|
|
1087
1088
|
.filter((item) => { const key = String(item.id ?? ""); if (!key) return true; if (seenItems.has(key)) return false; seenItems.add(key); return true; })
|
|
1088
1089
|
.map((item) => ({ item, at: Date.parse(String((item.timeSlot as { start?: string } | undefined)?.start ?? item.startTime ?? item.startDate ?? "")) }))
|
|
1089
1090
|
.sort((a, b) => (Number.isNaN(a.at) ? Infinity : a.at) - (Number.isNaN(b.at) ? Infinity : b.at))
|
|
@@ -475,7 +475,7 @@ function calendarFallbackUrl(s: S, end: number): string {
|
|
|
475
475
|
|
|
476
476
|
/** The Events v3 fieldsets the detail reads (see `WixEventFieldset`). DETAILS carries mainImage and
|
|
477
477
|
* shortDescription: REGISTRATION fills eventType, which skips the query enrichment that used to supply them. */
|
|
478
|
-
export const EVENT_DETAIL_FIELDSETS: WixEventFieldset[] = ["DETAILS", "TEXTS", "REGISTRATION", "URLS", "FORM"
|
|
478
|
+
export const EVENT_DETAIL_FIELDSETS: WixEventFieldset[] = ["DETAILS", "TEXTS", "REGISTRATION", "URLS", "FORM"];
|
|
479
479
|
|
|
480
480
|
function detailCopy(key: string, fallback: string): string { return copyParam(key, fallback); }
|
|
481
481
|
|
|
@@ -1065,25 +1065,26 @@ const svc: ReturnType<typeof defineService<S, DetailActions>> = defineService<S,
|
|
|
1065
1065
|
const dates = detailDate(e);
|
|
1066
1066
|
const place = detailPlace(e);
|
|
1067
1067
|
const registration = registrationUi(e, Date.now());
|
|
1068
|
-
const rawEvent = e as unknown as { shortDescription?: string;
|
|
1068
|
+
const rawEvent = e as unknown as { shortDescription?: string; dateAndTimeSettings?: { recurrenceStatus?: string; recurringEvents?: { categoryId?: string } }; registration?: { allowedGuestTypes?: string; tickets?: { lowestPrice?: EventDetailMoney; highestPrice?: EventDetailMoney } } };
|
|
1069
1069
|
const lowest = detailMoney(rawEvent.registration?.tickets?.lowestPrice);
|
|
1070
1070
|
const highest = detailMoney(rawEvent.registration?.tickets?.highestPrice);
|
|
1071
1071
|
const price = kind === "tickets" && lowest ? (highest && highest !== lowest ? detailCopy("event.priceFrom", "From {price}").replace("{price}", lowest) : lowest) : "";
|
|
1072
1072
|
const memberProbeNeeded = kind === "rsvp" || rawEvent.registration?.allowedGuestTypes === "MEMBER";
|
|
1073
1073
|
const isMember = memberProbeNeeded ? await signedInMember() : false;
|
|
1074
1074
|
const [scheduleResponse, policyResponse, rsvpResponse] = await Promise.all([
|
|
1075
|
-
// `limit` is required: without it Wix answers the agenda's `total` with an EMPTY `items`.
|
|
1076
|
-
|
|
1075
|
+
// `limit` is required: without it Wix answers the agenda's `total` with an EMPTY `items`. Read whatever the
|
|
1076
|
+
// event's agenda switch says: it is the website's agenda page, and Wix still answers a visitor with it off.
|
|
1077
|
+
bestEffort("GET", `/events/v1/schedule?eventId=${encodeURIComponent(id)}&limit=100`),
|
|
1077
1078
|
bestEffort("POST", "/events-policies/v2/policies/query", { query: { filter: { eventId: { $eq: id } }, paging: { limit: 100 } } }),
|
|
1078
1079
|
kind === "rsvp" && isMember ? bestEffort("GET", `/events/v2/rsvps/current?eventId=${encodeURIComponent(id)}`) : undefined,
|
|
1079
1080
|
]);
|
|
1080
1081
|
let optionalReadFailed = [scheduleResponse, policyResponse, rsvpResponse].some((response) => response?.ok === false);
|
|
1081
1082
|
const scheduleRaw = (scheduleResponse?.ok ? scheduleResponse.value : undefined) as { agenda?: Array<Record<string, unknown>>; schedule?: Array<Record<string, unknown>>; items?: Array<Record<string, unknown>>; agendaItems?: Array<Record<string, unknown>> } | undefined;
|
|
1082
|
-
// A hidden or
|
|
1083
|
+
// A hidden, canceled or draft session is not on the agenda, and an item id is listed once (an owner's
|
|
1083
1084
|
// read carries a draft and its published copy); sessions in start order.
|
|
1084
1085
|
const seenItems = new Set<string>();
|
|
1085
1086
|
const scheduleSource = (scheduleRaw?.agenda ?? scheduleRaw?.agendaItems ?? scheduleRaw?.schedule ?? scheduleRaw?.items ?? [])
|
|
1086
|
-
.filter((item) => item.hidden !== true && String(item.status ?? "").toUpperCase() !== "CANCELED")
|
|
1087
|
+
.filter((item) => item.hidden !== true && item.draft !== true && String(item.status ?? "").toUpperCase() !== "CANCELED")
|
|
1087
1088
|
.filter((item) => { const key = String(item.id ?? ""); if (!key) return true; if (seenItems.has(key)) return false; seenItems.add(key); return true; })
|
|
1088
1089
|
.map((item) => ({ item, at: Date.parse(String((item.timeSlot as { start?: string } | undefined)?.start ?? item.startTime ?? item.startDate ?? "")) }))
|
|
1089
1090
|
.sort((a, b) => (Number.isNaN(a.at) ? Infinity : a.at) - (Number.isNaN(b.at) ? Infinity : b.at))
|
|
@@ -475,7 +475,7 @@ function calendarFallbackUrl(s: S, end: number): string {
|
|
|
475
475
|
|
|
476
476
|
/** The Events v3 fieldsets the detail reads (see `WixEventFieldset`). DETAILS carries mainImage and
|
|
477
477
|
* shortDescription: REGISTRATION fills eventType, which skips the query enrichment that used to supply them. */
|
|
478
|
-
export const EVENT_DETAIL_FIELDSETS: WixEventFieldset[] = ["DETAILS", "TEXTS", "REGISTRATION", "URLS", "FORM"
|
|
478
|
+
export const EVENT_DETAIL_FIELDSETS: WixEventFieldset[] = ["DETAILS", "TEXTS", "REGISTRATION", "URLS", "FORM"];
|
|
479
479
|
|
|
480
480
|
function detailCopy(key: string, fallback: string): string { return copyParam(key, fallback); }
|
|
481
481
|
|
|
@@ -1065,25 +1065,26 @@ const svc: ReturnType<typeof defineService<S, DetailActions>> = defineService<S,
|
|
|
1065
1065
|
const dates = detailDate(e);
|
|
1066
1066
|
const place = detailPlace(e);
|
|
1067
1067
|
const registration = registrationUi(e, Date.now());
|
|
1068
|
-
const rawEvent = e as unknown as { shortDescription?: string;
|
|
1068
|
+
const rawEvent = e as unknown as { shortDescription?: string; dateAndTimeSettings?: { recurrenceStatus?: string; recurringEvents?: { categoryId?: string } }; registration?: { allowedGuestTypes?: string; tickets?: { lowestPrice?: EventDetailMoney; highestPrice?: EventDetailMoney } } };
|
|
1069
1069
|
const lowest = detailMoney(rawEvent.registration?.tickets?.lowestPrice);
|
|
1070
1070
|
const highest = detailMoney(rawEvent.registration?.tickets?.highestPrice);
|
|
1071
1071
|
const price = kind === "tickets" && lowest ? (highest && highest !== lowest ? detailCopy("event.priceFrom", "From {price}").replace("{price}", lowest) : lowest) : "";
|
|
1072
1072
|
const memberProbeNeeded = kind === "rsvp" || rawEvent.registration?.allowedGuestTypes === "MEMBER";
|
|
1073
1073
|
const isMember = memberProbeNeeded ? await signedInMember() : false;
|
|
1074
1074
|
const [scheduleResponse, policyResponse, rsvpResponse] = await Promise.all([
|
|
1075
|
-
// `limit` is required: without it Wix answers the agenda's `total` with an EMPTY `items`.
|
|
1076
|
-
|
|
1075
|
+
// `limit` is required: without it Wix answers the agenda's `total` with an EMPTY `items`. Read whatever the
|
|
1076
|
+
// event's agenda switch says: it is the website's agenda page, and Wix still answers a visitor with it off.
|
|
1077
|
+
bestEffort("GET", `/events/v1/schedule?eventId=${encodeURIComponent(id)}&limit=100`),
|
|
1077
1078
|
bestEffort("POST", "/events-policies/v2/policies/query", { query: { filter: { eventId: { $eq: id } }, paging: { limit: 100 } } }),
|
|
1078
1079
|
kind === "rsvp" && isMember ? bestEffort("GET", `/events/v2/rsvps/current?eventId=${encodeURIComponent(id)}`) : undefined,
|
|
1079
1080
|
]);
|
|
1080
1081
|
let optionalReadFailed = [scheduleResponse, policyResponse, rsvpResponse].some((response) => response?.ok === false);
|
|
1081
1082
|
const scheduleRaw = (scheduleResponse?.ok ? scheduleResponse.value : undefined) as { agenda?: Array<Record<string, unknown>>; schedule?: Array<Record<string, unknown>>; items?: Array<Record<string, unknown>>; agendaItems?: Array<Record<string, unknown>> } | undefined;
|
|
1082
|
-
// A hidden or
|
|
1083
|
+
// A hidden, canceled or draft session is not on the agenda, and an item id is listed once (an owner's
|
|
1083
1084
|
// read carries a draft and its published copy); sessions in start order.
|
|
1084
1085
|
const seenItems = new Set<string>();
|
|
1085
1086
|
const scheduleSource = (scheduleRaw?.agenda ?? scheduleRaw?.agendaItems ?? scheduleRaw?.schedule ?? scheduleRaw?.items ?? [])
|
|
1086
|
-
.filter((item) => item.hidden !== true && String(item.status ?? "").toUpperCase() !== "CANCELED")
|
|
1087
|
+
.filter((item) => item.hidden !== true && item.draft !== true && String(item.status ?? "").toUpperCase() !== "CANCELED")
|
|
1087
1088
|
.filter((item) => { const key = String(item.id ?? ""); if (!key) return true; if (seenItems.has(key)) return false; seenItems.add(key); return true; })
|
|
1088
1089
|
.map((item) => ({ item, at: Date.parse(String((item.timeSlot as { start?: string } | undefined)?.start ?? item.startTime ?? item.startDate ?? "")) }))
|
|
1089
1090
|
.sort((a, b) => (Number.isNaN(a.at) ? Infinity : a.at) - (Number.isNaN(b.at) ? Infinity : b.at))
|
|
@@ -475,7 +475,7 @@ function calendarFallbackUrl(s: S, end: number): string {
|
|
|
475
475
|
|
|
476
476
|
/** The Events v3 fieldsets the detail reads (see `WixEventFieldset`). DETAILS carries mainImage and
|
|
477
477
|
* shortDescription: REGISTRATION fills eventType, which skips the query enrichment that used to supply them. */
|
|
478
|
-
export const EVENT_DETAIL_FIELDSETS: WixEventFieldset[] = ["DETAILS", "TEXTS", "REGISTRATION", "URLS", "FORM"
|
|
478
|
+
export const EVENT_DETAIL_FIELDSETS: WixEventFieldset[] = ["DETAILS", "TEXTS", "REGISTRATION", "URLS", "FORM"];
|
|
479
479
|
|
|
480
480
|
function detailCopy(key: string, fallback: string): string { return copyParam(key, fallback); }
|
|
481
481
|
|
|
@@ -1065,25 +1065,26 @@ const svc: ReturnType<typeof defineService<S, DetailActions>> = defineService<S,
|
|
|
1065
1065
|
const dates = detailDate(e);
|
|
1066
1066
|
const place = detailPlace(e);
|
|
1067
1067
|
const registration = registrationUi(e, Date.now());
|
|
1068
|
-
const rawEvent = e as unknown as { shortDescription?: string;
|
|
1068
|
+
const rawEvent = e as unknown as { shortDescription?: string; dateAndTimeSettings?: { recurrenceStatus?: string; recurringEvents?: { categoryId?: string } }; registration?: { allowedGuestTypes?: string; tickets?: { lowestPrice?: EventDetailMoney; highestPrice?: EventDetailMoney } } };
|
|
1069
1069
|
const lowest = detailMoney(rawEvent.registration?.tickets?.lowestPrice);
|
|
1070
1070
|
const highest = detailMoney(rawEvent.registration?.tickets?.highestPrice);
|
|
1071
1071
|
const price = kind === "tickets" && lowest ? (highest && highest !== lowest ? detailCopy("event.priceFrom", "From {price}").replace("{price}", lowest) : lowest) : "";
|
|
1072
1072
|
const memberProbeNeeded = kind === "rsvp" || rawEvent.registration?.allowedGuestTypes === "MEMBER";
|
|
1073
1073
|
const isMember = memberProbeNeeded ? await signedInMember() : false;
|
|
1074
1074
|
const [scheduleResponse, policyResponse, rsvpResponse] = await Promise.all([
|
|
1075
|
-
// `limit` is required: without it Wix answers the agenda's `total` with an EMPTY `items`.
|
|
1076
|
-
|
|
1075
|
+
// `limit` is required: without it Wix answers the agenda's `total` with an EMPTY `items`. Read whatever the
|
|
1076
|
+
// event's agenda switch says: it is the website's agenda page, and Wix still answers a visitor with it off.
|
|
1077
|
+
bestEffort("GET", `/events/v1/schedule?eventId=${encodeURIComponent(id)}&limit=100`),
|
|
1077
1078
|
bestEffort("POST", "/events-policies/v2/policies/query", { query: { filter: { eventId: { $eq: id } }, paging: { limit: 100 } } }),
|
|
1078
1079
|
kind === "rsvp" && isMember ? bestEffort("GET", `/events/v2/rsvps/current?eventId=${encodeURIComponent(id)}`) : undefined,
|
|
1079
1080
|
]);
|
|
1080
1081
|
let optionalReadFailed = [scheduleResponse, policyResponse, rsvpResponse].some((response) => response?.ok === false);
|
|
1081
1082
|
const scheduleRaw = (scheduleResponse?.ok ? scheduleResponse.value : undefined) as { agenda?: Array<Record<string, unknown>>; schedule?: Array<Record<string, unknown>>; items?: Array<Record<string, unknown>>; agendaItems?: Array<Record<string, unknown>> } | undefined;
|
|
1082
|
-
// A hidden or
|
|
1083
|
+
// A hidden, canceled or draft session is not on the agenda, and an item id is listed once (an owner's
|
|
1083
1084
|
// read carries a draft and its published copy); sessions in start order.
|
|
1084
1085
|
const seenItems = new Set<string>();
|
|
1085
1086
|
const scheduleSource = (scheduleRaw?.agenda ?? scheduleRaw?.agendaItems ?? scheduleRaw?.schedule ?? scheduleRaw?.items ?? [])
|
|
1086
|
-
.filter((item) => item.hidden !== true && String(item.status ?? "").toUpperCase() !== "CANCELED")
|
|
1087
|
+
.filter((item) => item.hidden !== true && item.draft !== true && String(item.status ?? "").toUpperCase() !== "CANCELED")
|
|
1087
1088
|
.filter((item) => { const key = String(item.id ?? ""); if (!key) return true; if (seenItems.has(key)) return false; seenItems.add(key); return true; })
|
|
1088
1089
|
.map((item) => ({ item, at: Date.parse(String((item.timeSlot as { start?: string } | undefined)?.start ?? item.startTime ?? item.startDate ?? "")) }))
|
|
1089
1090
|
.sort((a, b) => (Number.isNaN(a.at) ? Infinity : a.at) - (Number.isNaN(b.at) ? Infinity : b.at))
|
|
@@ -475,7 +475,7 @@ function calendarFallbackUrl(s: S, end: number): string {
|
|
|
475
475
|
|
|
476
476
|
/** The Events v3 fieldsets the detail reads (see `WixEventFieldset`). DETAILS carries mainImage and
|
|
477
477
|
* shortDescription: REGISTRATION fills eventType, which skips the query enrichment that used to supply them. */
|
|
478
|
-
export const EVENT_DETAIL_FIELDSETS: WixEventFieldset[] = ["DETAILS", "TEXTS", "REGISTRATION", "URLS", "FORM"
|
|
478
|
+
export const EVENT_DETAIL_FIELDSETS: WixEventFieldset[] = ["DETAILS", "TEXTS", "REGISTRATION", "URLS", "FORM"];
|
|
479
479
|
|
|
480
480
|
function detailCopy(key: string, fallback: string): string { return copyParam(key, fallback); }
|
|
481
481
|
|
|
@@ -1065,25 +1065,26 @@ const svc: ReturnType<typeof defineService<S, DetailActions>> = defineService<S,
|
|
|
1065
1065
|
const dates = detailDate(e);
|
|
1066
1066
|
const place = detailPlace(e);
|
|
1067
1067
|
const registration = registrationUi(e, Date.now());
|
|
1068
|
-
const rawEvent = e as unknown as { shortDescription?: string;
|
|
1068
|
+
const rawEvent = e as unknown as { shortDescription?: string; dateAndTimeSettings?: { recurrenceStatus?: string; recurringEvents?: { categoryId?: string } }; registration?: { allowedGuestTypes?: string; tickets?: { lowestPrice?: EventDetailMoney; highestPrice?: EventDetailMoney } } };
|
|
1069
1069
|
const lowest = detailMoney(rawEvent.registration?.tickets?.lowestPrice);
|
|
1070
1070
|
const highest = detailMoney(rawEvent.registration?.tickets?.highestPrice);
|
|
1071
1071
|
const price = kind === "tickets" && lowest ? (highest && highest !== lowest ? detailCopy("event.priceFrom", "From {price}").replace("{price}", lowest) : lowest) : "";
|
|
1072
1072
|
const memberProbeNeeded = kind === "rsvp" || rawEvent.registration?.allowedGuestTypes === "MEMBER";
|
|
1073
1073
|
const isMember = memberProbeNeeded ? await signedInMember() : false;
|
|
1074
1074
|
const [scheduleResponse, policyResponse, rsvpResponse] = await Promise.all([
|
|
1075
|
-
// `limit` is required: without it Wix answers the agenda's `total` with an EMPTY `items`.
|
|
1076
|
-
|
|
1075
|
+
// `limit` is required: without it Wix answers the agenda's `total` with an EMPTY `items`. Read whatever the
|
|
1076
|
+
// event's agenda switch says: it is the website's agenda page, and Wix still answers a visitor with it off.
|
|
1077
|
+
bestEffort("GET", `/events/v1/schedule?eventId=${encodeURIComponent(id)}&limit=100`),
|
|
1077
1078
|
bestEffort("POST", "/events-policies/v2/policies/query", { query: { filter: { eventId: { $eq: id } }, paging: { limit: 100 } } }),
|
|
1078
1079
|
kind === "rsvp" && isMember ? bestEffort("GET", `/events/v2/rsvps/current?eventId=${encodeURIComponent(id)}`) : undefined,
|
|
1079
1080
|
]);
|
|
1080
1081
|
let optionalReadFailed = [scheduleResponse, policyResponse, rsvpResponse].some((response) => response?.ok === false);
|
|
1081
1082
|
const scheduleRaw = (scheduleResponse?.ok ? scheduleResponse.value : undefined) as { agenda?: Array<Record<string, unknown>>; schedule?: Array<Record<string, unknown>>; items?: Array<Record<string, unknown>>; agendaItems?: Array<Record<string, unknown>> } | undefined;
|
|
1082
|
-
// A hidden or
|
|
1083
|
+
// A hidden, canceled or draft session is not on the agenda, and an item id is listed once (an owner's
|
|
1083
1084
|
// read carries a draft and its published copy); sessions in start order.
|
|
1084
1085
|
const seenItems = new Set<string>();
|
|
1085
1086
|
const scheduleSource = (scheduleRaw?.agenda ?? scheduleRaw?.agendaItems ?? scheduleRaw?.schedule ?? scheduleRaw?.items ?? [])
|
|
1086
|
-
.filter((item) => item.hidden !== true && String(item.status ?? "").toUpperCase() !== "CANCELED")
|
|
1087
|
+
.filter((item) => item.hidden !== true && item.draft !== true && String(item.status ?? "").toUpperCase() !== "CANCELED")
|
|
1087
1088
|
.filter((item) => { const key = String(item.id ?? ""); if (!key) return true; if (seenItems.has(key)) return false; seenItems.add(key); return true; })
|
|
1088
1089
|
.map((item) => ({ item, at: Date.parse(String((item.timeSlot as { start?: string } | undefined)?.start ?? item.startTime ?? item.startDate ?? "")) }))
|
|
1089
1090
|
.sort((a, b) => (Number.isNaN(a.at) ? Infinity : a.at) - (Number.isNaN(b.at) ? Infinity : b.at))
|
|
@@ -475,7 +475,7 @@ function calendarFallbackUrl(s: S, end: number): string {
|
|
|
475
475
|
|
|
476
476
|
/** The Events v3 fieldsets the detail reads (see `WixEventFieldset`). DETAILS carries mainImage and
|
|
477
477
|
* shortDescription: REGISTRATION fills eventType, which skips the query enrichment that used to supply them. */
|
|
478
|
-
export const EVENT_DETAIL_FIELDSETS: WixEventFieldset[] = ["DETAILS", "TEXTS", "REGISTRATION", "URLS", "FORM"
|
|
478
|
+
export const EVENT_DETAIL_FIELDSETS: WixEventFieldset[] = ["DETAILS", "TEXTS", "REGISTRATION", "URLS", "FORM"];
|
|
479
479
|
|
|
480
480
|
function detailCopy(key: string, fallback: string): string { return copyParam(key, fallback); }
|
|
481
481
|
|
|
@@ -1065,25 +1065,26 @@ const svc: ReturnType<typeof defineService<S, DetailActions>> = defineService<S,
|
|
|
1065
1065
|
const dates = detailDate(e);
|
|
1066
1066
|
const place = detailPlace(e);
|
|
1067
1067
|
const registration = registrationUi(e, Date.now());
|
|
1068
|
-
const rawEvent = e as unknown as { shortDescription?: string;
|
|
1068
|
+
const rawEvent = e as unknown as { shortDescription?: string; dateAndTimeSettings?: { recurrenceStatus?: string; recurringEvents?: { categoryId?: string } }; registration?: { allowedGuestTypes?: string; tickets?: { lowestPrice?: EventDetailMoney; highestPrice?: EventDetailMoney } } };
|
|
1069
1069
|
const lowest = detailMoney(rawEvent.registration?.tickets?.lowestPrice);
|
|
1070
1070
|
const highest = detailMoney(rawEvent.registration?.tickets?.highestPrice);
|
|
1071
1071
|
const price = kind === "tickets" && lowest ? (highest && highest !== lowest ? detailCopy("event.priceFrom", "From {price}").replace("{price}", lowest) : lowest) : "";
|
|
1072
1072
|
const memberProbeNeeded = kind === "rsvp" || rawEvent.registration?.allowedGuestTypes === "MEMBER";
|
|
1073
1073
|
const isMember = memberProbeNeeded ? await signedInMember() : false;
|
|
1074
1074
|
const [scheduleResponse, policyResponse, rsvpResponse] = await Promise.all([
|
|
1075
|
-
// `limit` is required: without it Wix answers the agenda's `total` with an EMPTY `items`.
|
|
1076
|
-
|
|
1075
|
+
// `limit` is required: without it Wix answers the agenda's `total` with an EMPTY `items`. Read whatever the
|
|
1076
|
+
// event's agenda switch says: it is the website's agenda page, and Wix still answers a visitor with it off.
|
|
1077
|
+
bestEffort("GET", `/events/v1/schedule?eventId=${encodeURIComponent(id)}&limit=100`),
|
|
1077
1078
|
bestEffort("POST", "/events-policies/v2/policies/query", { query: { filter: { eventId: { $eq: id } }, paging: { limit: 100 } } }),
|
|
1078
1079
|
kind === "rsvp" && isMember ? bestEffort("GET", `/events/v2/rsvps/current?eventId=${encodeURIComponent(id)}`) : undefined,
|
|
1079
1080
|
]);
|
|
1080
1081
|
let optionalReadFailed = [scheduleResponse, policyResponse, rsvpResponse].some((response) => response?.ok === false);
|
|
1081
1082
|
const scheduleRaw = (scheduleResponse?.ok ? scheduleResponse.value : undefined) as { agenda?: Array<Record<string, unknown>>; schedule?: Array<Record<string, unknown>>; items?: Array<Record<string, unknown>>; agendaItems?: Array<Record<string, unknown>> } | undefined;
|
|
1082
|
-
// A hidden or
|
|
1083
|
+
// A hidden, canceled or draft session is not on the agenda, and an item id is listed once (an owner's
|
|
1083
1084
|
// read carries a draft and its published copy); sessions in start order.
|
|
1084
1085
|
const seenItems = new Set<string>();
|
|
1085
1086
|
const scheduleSource = (scheduleRaw?.agenda ?? scheduleRaw?.agendaItems ?? scheduleRaw?.schedule ?? scheduleRaw?.items ?? [])
|
|
1086
|
-
.filter((item) => item.hidden !== true && String(item.status ?? "").toUpperCase() !== "CANCELED")
|
|
1087
|
+
.filter((item) => item.hidden !== true && item.draft !== true && String(item.status ?? "").toUpperCase() !== "CANCELED")
|
|
1087
1088
|
.filter((item) => { const key = String(item.id ?? ""); if (!key) return true; if (seenItems.has(key)) return false; seenItems.add(key); return true; })
|
|
1088
1089
|
.map((item) => ({ item, at: Date.parse(String((item.timeSlot as { start?: string } | undefined)?.start ?? item.startTime ?? item.startDate ?? "")) }))
|
|
1089
1090
|
.sort((a, b) => (Number.isNaN(a.at) ? Infinity : a.at) - (Number.isNaN(b.at) ? Infinity : b.at))
|
|
@@ -475,7 +475,7 @@ function calendarFallbackUrl(s: S, end: number): string {
|
|
|
475
475
|
|
|
476
476
|
/** The Events v3 fieldsets the detail reads (see `WixEventFieldset`). DETAILS carries mainImage and
|
|
477
477
|
* shortDescription: REGISTRATION fills eventType, which skips the query enrichment that used to supply them. */
|
|
478
|
-
export const EVENT_DETAIL_FIELDSETS: WixEventFieldset[] = ["DETAILS", "TEXTS", "REGISTRATION", "URLS", "FORM"
|
|
478
|
+
export const EVENT_DETAIL_FIELDSETS: WixEventFieldset[] = ["DETAILS", "TEXTS", "REGISTRATION", "URLS", "FORM"];
|
|
479
479
|
|
|
480
480
|
function detailCopy(key: string, fallback: string): string { return copyParam(key, fallback); }
|
|
481
481
|
|
|
@@ -1065,25 +1065,26 @@ const svc: ReturnType<typeof defineService<S, DetailActions>> = defineService<S,
|
|
|
1065
1065
|
const dates = detailDate(e);
|
|
1066
1066
|
const place = detailPlace(e);
|
|
1067
1067
|
const registration = registrationUi(e, Date.now());
|
|
1068
|
-
const rawEvent = e as unknown as { shortDescription?: string;
|
|
1068
|
+
const rawEvent = e as unknown as { shortDescription?: string; dateAndTimeSettings?: { recurrenceStatus?: string; recurringEvents?: { categoryId?: string } }; registration?: { allowedGuestTypes?: string; tickets?: { lowestPrice?: EventDetailMoney; highestPrice?: EventDetailMoney } } };
|
|
1069
1069
|
const lowest = detailMoney(rawEvent.registration?.tickets?.lowestPrice);
|
|
1070
1070
|
const highest = detailMoney(rawEvent.registration?.tickets?.highestPrice);
|
|
1071
1071
|
const price = kind === "tickets" && lowest ? (highest && highest !== lowest ? detailCopy("event.priceFrom", "From {price}").replace("{price}", lowest) : lowest) : "";
|
|
1072
1072
|
const memberProbeNeeded = kind === "rsvp" || rawEvent.registration?.allowedGuestTypes === "MEMBER";
|
|
1073
1073
|
const isMember = memberProbeNeeded ? await signedInMember() : false;
|
|
1074
1074
|
const [scheduleResponse, policyResponse, rsvpResponse] = await Promise.all([
|
|
1075
|
-
// `limit` is required: without it Wix answers the agenda's `total` with an EMPTY `items`.
|
|
1076
|
-
|
|
1075
|
+
// `limit` is required: without it Wix answers the agenda's `total` with an EMPTY `items`. Read whatever the
|
|
1076
|
+
// event's agenda switch says: it is the website's agenda page, and Wix still answers a visitor with it off.
|
|
1077
|
+
bestEffort("GET", `/events/v1/schedule?eventId=${encodeURIComponent(id)}&limit=100`),
|
|
1077
1078
|
bestEffort("POST", "/events-policies/v2/policies/query", { query: { filter: { eventId: { $eq: id } }, paging: { limit: 100 } } }),
|
|
1078
1079
|
kind === "rsvp" && isMember ? bestEffort("GET", `/events/v2/rsvps/current?eventId=${encodeURIComponent(id)}`) : undefined,
|
|
1079
1080
|
]);
|
|
1080
1081
|
let optionalReadFailed = [scheduleResponse, policyResponse, rsvpResponse].some((response) => response?.ok === false);
|
|
1081
1082
|
const scheduleRaw = (scheduleResponse?.ok ? scheduleResponse.value : undefined) as { agenda?: Array<Record<string, unknown>>; schedule?: Array<Record<string, unknown>>; items?: Array<Record<string, unknown>>; agendaItems?: Array<Record<string, unknown>> } | undefined;
|
|
1082
|
-
// A hidden or
|
|
1083
|
+
// A hidden, canceled or draft session is not on the agenda, and an item id is listed once (an owner's
|
|
1083
1084
|
// read carries a draft and its published copy); sessions in start order.
|
|
1084
1085
|
const seenItems = new Set<string>();
|
|
1085
1086
|
const scheduleSource = (scheduleRaw?.agenda ?? scheduleRaw?.agendaItems ?? scheduleRaw?.schedule ?? scheduleRaw?.items ?? [])
|
|
1086
|
-
.filter((item) => item.hidden !== true && String(item.status ?? "").toUpperCase() !== "CANCELED")
|
|
1087
|
+
.filter((item) => item.hidden !== true && item.draft !== true && String(item.status ?? "").toUpperCase() !== "CANCELED")
|
|
1087
1088
|
.filter((item) => { const key = String(item.id ?? ""); if (!key) return true; if (seenItems.has(key)) return false; seenItems.add(key); return true; })
|
|
1088
1089
|
.map((item) => ({ item, at: Date.parse(String((item.timeSlot as { start?: string } | undefined)?.start ?? item.startTime ?? item.startDate ?? "")) }))
|
|
1089
1090
|
.sort((a, b) => (Number.isNaN(a.at) ? Infinity : a.at) - (Number.isNaN(b.at) ? Infinity : b.at))
|