kaafil-react-uikit 0.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +70 -0
- package/LICENSE +21 -0
- package/README.md +187 -0
- package/dist/OfflineFallbackScreen-B5dfaJBN.d.ts +37 -0
- package/dist/OfflineFallbackScreen-Ctm7nBa-.d.cts +37 -0
- package/dist/SessionExpiredScreen-CytQNuak.d.cts +50 -0
- package/dist/SessionExpiredScreen-D8GHyZc3.d.ts +50 -0
- package/dist/admin/index.cjs +23779 -0
- package/dist/admin/index.cjs.map +1 -0
- package/dist/admin/index.d.cts +1157 -0
- package/dist/admin/index.d.ts +1157 -0
- package/dist/admin/index.js +23724 -0
- package/dist/admin/index.js.map +1 -0
- package/dist/chunk-6FPAGGFL.js +6028 -0
- package/dist/chunk-6FPAGGFL.js.map +1 -0
- package/dist/chunk-ACVU55PZ.cjs +294 -0
- package/dist/chunk-ACVU55PZ.cjs.map +1 -0
- package/dist/chunk-EM7JV3D7.cjs +6051 -0
- package/dist/chunk-EM7JV3D7.cjs.map +1 -0
- package/dist/chunk-IIPQ4JNC.js +287 -0
- package/dist/chunk-IIPQ4JNC.js.map +1 -0
- package/dist/chunk-LL243STJ.cjs +2195 -0
- package/dist/chunk-LL243STJ.cjs.map +1 -0
- package/dist/chunk-PJRZCOFF.cjs +958 -0
- package/dist/chunk-PJRZCOFF.cjs.map +1 -0
- package/dist/chunk-PTQ2CJKE.cjs +40 -0
- package/dist/chunk-PTQ2CJKE.cjs.map +1 -0
- package/dist/chunk-PZKXLQSU.js +10 -0
- package/dist/chunk-PZKXLQSU.js.map +1 -0
- package/dist/chunk-QHUDOVKW.cjs +111 -0
- package/dist/chunk-QHUDOVKW.cjs.map +1 -0
- package/dist/chunk-TOBZFADB.cjs +12 -0
- package/dist/chunk-TOBZFADB.cjs.map +1 -0
- package/dist/chunk-UUGMNP27.js +936 -0
- package/dist/chunk-UUGMNP27.js.map +1 -0
- package/dist/chunk-UYJ6LIWP.js +2154 -0
- package/dist/chunk-UYJ6LIWP.js.map +1 -0
- package/dist/chunk-VHTSTUCJ.cjs +346 -0
- package/dist/chunk-VHTSTUCJ.cjs.map +1 -0
- package/dist/chunk-WUAFL77X.js +340 -0
- package/dist/chunk-WUAFL77X.js.map +1 -0
- package/dist/chunk-XI7MK4Y7.js +38 -0
- package/dist/chunk-XI7MK4Y7.js.map +1 -0
- package/dist/chunk-YDGR7JSY.js +107 -0
- package/dist/chunk-YDGR7JSY.js.map +1 -0
- package/dist/core/index.cjs +1254 -0
- package/dist/core/index.cjs.map +1 -0
- package/dist/core/index.d.cts +1267 -0
- package/dist/core/index.d.ts +1267 -0
- package/dist/core/index.js +995 -0
- package/dist/core/index.js.map +1 -0
- package/dist/index.css +1 -0
- package/dist/manager/index.cjs +13562 -0
- package/dist/manager/index.cjs.map +1 -0
- package/dist/manager/index.d.cts +1054 -0
- package/dist/manager/index.d.ts +1054 -0
- package/dist/manager/index.js +13518 -0
- package/dist/manager/index.js.map +1 -0
- package/dist/testing/index.cjs +221 -0
- package/dist/testing/index.cjs.map +1 -0
- package/dist/testing/index.d.cts +269 -0
- package/dist/testing/index.d.ts +269 -0
- package/dist/testing/index.js +208 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/tokenStyle-CToG5oOS.d.cts +3 -0
- package/dist/tokenStyle-CToG5oOS.d.ts +3 -0
- package/dist/traveller/index.cjs +1799 -0
- package/dist/traveller/index.cjs.map +1 -0
- package/dist/traveller/index.d.cts +58 -0
- package/dist/traveller/index.d.ts +58 -0
- package/dist/traveller/index.js +1789 -0
- package/dist/traveller/index.js.map +1 -0
- package/dist/useAgencyTrip-BUYSIaC2.d.cts +454 -0
- package/dist/useAgencyTrip-BzyJB1D9.d.ts +454 -0
- package/dist/useNotifications-BZW1Z_ur.d.cts +356 -0
- package/dist/useNotifications-D262i5BQ.d.ts +356 -0
- package/dist/useVendors-DXOuZWhZ.d.cts +784 -0
- package/dist/useVendors-DXOuZWhZ.d.ts +784 -0
- package/package.json +95 -0
|
@@ -0,0 +1,1789 @@
|
|
|
1
|
+
import { useShareSnapshot, BrandShell, useShareForms } from '../chunk-WUAFL77X.js';
|
|
2
|
+
import '../chunk-PZKXLQSU.js';
|
|
3
|
+
import '../chunk-XI7MK4Y7.js';
|
|
4
|
+
export { BootErrorScreen, OfflineFallbackScreen } from '../chunk-IIPQ4JNC.js';
|
|
5
|
+
import { createRegistry, useKaafilChrome, useSession, tokenStyle, OfflineEngineContext } from '../chunk-6FPAGGFL.js';
|
|
6
|
+
import { useState, useRef, useEffect, useMemo, useContext } from 'react';
|
|
7
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
|
+
|
|
9
|
+
// src/traveller/KaafilShareView/internal/formatShareDate.ts
|
|
10
|
+
var WEEKDAY_FORMAT_CACHE = /* @__PURE__ */ new Map();
|
|
11
|
+
var DAY_MONTH_FORMAT_CACHE = /* @__PURE__ */ new Map();
|
|
12
|
+
var TIME_FORMAT_CACHE = /* @__PURE__ */ new Map();
|
|
13
|
+
function cachedFormatter(cache, timezone, options) {
|
|
14
|
+
const existing = cache.get(timezone);
|
|
15
|
+
if (existing !== void 0) {
|
|
16
|
+
return existing;
|
|
17
|
+
}
|
|
18
|
+
const created = new Intl.DateTimeFormat("en-GB", { ...options, timeZone: timezone });
|
|
19
|
+
cache.set(timezone, created);
|
|
20
|
+
return created;
|
|
21
|
+
}
|
|
22
|
+
function formatWeekdayShort(isoDate, timezone) {
|
|
23
|
+
const formatter = cachedFormatter(WEEKDAY_FORMAT_CACHE, timezone, { weekday: "short" });
|
|
24
|
+
return formatter.format(new Date(isoDate)).toUpperCase();
|
|
25
|
+
}
|
|
26
|
+
function formatDayMonth(isoDate, timezone) {
|
|
27
|
+
const formatter = cachedFormatter(DAY_MONTH_FORMAT_CACHE, timezone, {
|
|
28
|
+
day: "numeric",
|
|
29
|
+
month: "short"
|
|
30
|
+
});
|
|
31
|
+
return formatter.format(new Date(isoDate)).toUpperCase();
|
|
32
|
+
}
|
|
33
|
+
function formatWeekdayDay(isoDate, timezone) {
|
|
34
|
+
return `${formatWeekdayShort(isoDate, timezone)} ${new Intl.DateTimeFormat("en-GB", { day: "numeric", timeZone: timezone }).format(new Date(isoDate))}`;
|
|
35
|
+
}
|
|
36
|
+
function formatTimeOfDay(isoDateTime, timezone) {
|
|
37
|
+
const formatter = cachedFormatter(TIME_FORMAT_CACHE, timezone, {
|
|
38
|
+
hour: "2-digit",
|
|
39
|
+
minute: "2-digit",
|
|
40
|
+
hour12: false
|
|
41
|
+
});
|
|
42
|
+
return formatter.format(new Date(isoDateTime));
|
|
43
|
+
}
|
|
44
|
+
function wholeDaysBetween(fromIso, toIso, timezone) {
|
|
45
|
+
const dayKeyFormatter = new Intl.DateTimeFormat("en-CA", { timeZone: timezone });
|
|
46
|
+
const fromKey = dayKeyFormatter.format(new Date(fromIso));
|
|
47
|
+
const toKey = dayKeyFormatter.format(new Date(toIso));
|
|
48
|
+
const fromUtc = Date.parse(`${fromKey}T00:00:00Z`);
|
|
49
|
+
const toUtc = Date.parse(`${toKey}T00:00:00Z`);
|
|
50
|
+
const diffDays = Math.round((toUtc - fromUtc) / (24 * 60 * 60 * 1e3));
|
|
51
|
+
return diffDays > 0 ? diffDays : 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// src/traveller/KaafilShareView/internal/deriveTripStatus.ts
|
|
55
|
+
var PHASE_LABEL_KEY = {
|
|
56
|
+
PRE_DEPARTURE: "chrome.shareView.trip.phase.preDeparture",
|
|
57
|
+
ON_TRIP: "chrome.shareView.trip.phase.onTrip",
|
|
58
|
+
POST_TRIP: "chrome.shareView.trip.phase.postTrip"
|
|
59
|
+
};
|
|
60
|
+
function deriveTripStatus(trip, itinerary, serverTime, t) {
|
|
61
|
+
const totalDays = itinerary?.days.length ?? wholeDaysBetween(trip.startDate, trip.endDate, trip.timezone) + 1;
|
|
62
|
+
const todayDay = itinerary?.days.find((day) => day.isToday);
|
|
63
|
+
const currentDayNumber = todayDay !== void 0 ? todayDay.dayIndex + 1 : null;
|
|
64
|
+
const dayLabel2 = currentDayNumber !== null ? t("chrome.shareView.trip.dayOf").replace("{current}", String(currentDayNumber)).replace("{total}", String(totalDays)) : t(PHASE_LABEL_KEY[trip.phase]);
|
|
65
|
+
const dateRangeLabel = `${formatDayMonth(trip.startDate, trip.timezone)} \u2192 ${formatDayMonth(trip.endDate, trip.timezone)}`;
|
|
66
|
+
let daysLeftLabel = null;
|
|
67
|
+
if (trip.phase === "ON_TRIP" && serverTime !== void 0) {
|
|
68
|
+
const daysLeft = wholeDaysBetween(serverTime, trip.endDate, trip.timezone);
|
|
69
|
+
daysLeftLabel = daysLeft === 1 ? t("chrome.shareView.trip.daysLeftOne") : t("chrome.shareView.trip.daysLeftMany").replace("{count}", String(daysLeft));
|
|
70
|
+
} else if (trip.phase === "PRE_DEPARTURE" && serverTime !== void 0) {
|
|
71
|
+
const daysToStart = wholeDaysBetween(serverTime, trip.startDate, trip.timezone);
|
|
72
|
+
daysLeftLabel = daysToStart === 1 ? t("chrome.shareView.trip.startsInOne") : t("chrome.shareView.trip.startsInMany").replace("{count}", String(daysToStart));
|
|
73
|
+
}
|
|
74
|
+
let progressPercent = 0;
|
|
75
|
+
if (trip.phase === "POST_TRIP") {
|
|
76
|
+
progressPercent = 100;
|
|
77
|
+
} else if (trip.phase === "ON_TRIP" && currentDayNumber !== null && totalDays > 0) {
|
|
78
|
+
progressPercent = Math.min(100, Math.round(currentDayNumber / totalDays * 100));
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
phase: trip.phase,
|
|
82
|
+
phaseLabel: t(PHASE_LABEL_KEY[trip.phase]),
|
|
83
|
+
totalDays,
|
|
84
|
+
currentDayNumber,
|
|
85
|
+
dayLabel: dayLabel2,
|
|
86
|
+
dateRangeLabel,
|
|
87
|
+
daysLeftLabel,
|
|
88
|
+
progressPercent
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function HouseholdSheet({
|
|
92
|
+
open,
|
|
93
|
+
onClose,
|
|
94
|
+
label,
|
|
95
|
+
travellers
|
|
96
|
+
}) {
|
|
97
|
+
const { t } = useKaafilChrome();
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
if (!open) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
function handleKeyDown(event) {
|
|
103
|
+
if (event.key === "Escape") {
|
|
104
|
+
onClose();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
108
|
+
return () => {
|
|
109
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
110
|
+
};
|
|
111
|
+
}, [open, onClose]);
|
|
112
|
+
if (!open) {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
return /* @__PURE__ */ jsx("div", { className: "kf-share-view__sheet-backdrop", children: /* @__PURE__ */ jsxs(
|
|
116
|
+
"div",
|
|
117
|
+
{
|
|
118
|
+
className: "kf-share-view__sheet",
|
|
119
|
+
role: "dialog",
|
|
120
|
+
"aria-modal": "true",
|
|
121
|
+
"aria-label": label ?? t("chrome.shareView.household.ariaLabelFallback"),
|
|
122
|
+
children: [
|
|
123
|
+
/* @__PURE__ */ jsxs("div", { className: "kf-share-view__sheet-header", children: [
|
|
124
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
125
|
+
/* @__PURE__ */ jsx("p", { className: "kf-eyebrow", children: t("chrome.shareView.household.eyebrow") }),
|
|
126
|
+
label !== null ? /* @__PURE__ */ jsx("p", { className: "kf-share-view__sheet-title", children: label }) : null
|
|
127
|
+
] }),
|
|
128
|
+
/* @__PURE__ */ jsx(
|
|
129
|
+
"button",
|
|
130
|
+
{
|
|
131
|
+
type: "button",
|
|
132
|
+
className: "kf-share-view__sheet-close kf-press",
|
|
133
|
+
onClick: onClose,
|
|
134
|
+
"aria-label": t("chrome.shareView.close"),
|
|
135
|
+
children: "\u2715"
|
|
136
|
+
}
|
|
137
|
+
)
|
|
138
|
+
] }),
|
|
139
|
+
/* @__PURE__ */ jsx("ul", { className: "kf-share-view__list", children: travellers.map((traveller, index) => /* @__PURE__ */ jsxs(
|
|
140
|
+
"li",
|
|
141
|
+
{
|
|
142
|
+
className: "kf-share-view__row kf-share-view__sheet-row",
|
|
143
|
+
children: [
|
|
144
|
+
/* @__PURE__ */ jsx("span", { className: "kf-share-view__household-avatar", "aria-hidden": "true", children: traveller.initials }),
|
|
145
|
+
/* @__PURE__ */ jsx("div", { className: "kf-share-view__sheet-row-body", children: /* @__PURE__ */ jsxs("p", { className: "kf-share-view__contact-name", children: [
|
|
146
|
+
traveller.firstName,
|
|
147
|
+
traveller.isSubject ? /* @__PURE__ */ jsxs("span", { className: "kf-share-view__sheet-you", children: [
|
|
148
|
+
" ",
|
|
149
|
+
"\xB7 ",
|
|
150
|
+
t("chrome.shareView.household.you")
|
|
151
|
+
] }) : null
|
|
152
|
+
] }) })
|
|
153
|
+
]
|
|
154
|
+
},
|
|
155
|
+
`${traveller.firstName}-${String(index)}`
|
|
156
|
+
)) }),
|
|
157
|
+
/* @__PURE__ */ jsxs("p", { className: "kf-share-view__sheet-footer kf-eyebrow", children: [
|
|
158
|
+
travellers.length,
|
|
159
|
+
" ",
|
|
160
|
+
travellers.length === 1 ? t("chrome.shareView.household.travellerSingular") : t("chrome.shareView.household.travellerPlural"),
|
|
161
|
+
" ",
|
|
162
|
+
"\xB7 ",
|
|
163
|
+
t("chrome.shareView.household.readOnlyView")
|
|
164
|
+
] })
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
) });
|
|
168
|
+
}
|
|
169
|
+
var COPY_KEY = {
|
|
170
|
+
ended: "chrome.shareView.ended.ended",
|
|
171
|
+
"not-found": "chrome.shareView.ended.notFound"
|
|
172
|
+
};
|
|
173
|
+
function ShareEndedScreen({ reason }) {
|
|
174
|
+
const { t } = useKaafilChrome();
|
|
175
|
+
return /* @__PURE__ */ jsx("div", { className: "kf-share-view__ended", role: "alert", "aria-live": "assertive", children: /* @__PURE__ */ jsx("p", { className: "kf-share-view__ended-message", children: t(COPY_KEY[reason]) }) });
|
|
176
|
+
}
|
|
177
|
+
function ShareSkeleton() {
|
|
178
|
+
const { t } = useKaafilChrome();
|
|
179
|
+
return /* @__PURE__ */ jsxs("div", { className: "kf-share-view__skeleton", role: "status", "aria-live": "polite", "aria-busy": "true", children: [
|
|
180
|
+
/* @__PURE__ */ jsx("span", { className: "kf-visually-hidden", children: t("chrome.shareView.loading") }),
|
|
181
|
+
/* @__PURE__ */ jsx("div", { className: "kf-share-view__skeleton-line kf-share-view__skeleton-line--eyebrow kf-shimmer" }),
|
|
182
|
+
/* @__PURE__ */ jsx("div", { className: "kf-share-view__skeleton-line kf-share-view__skeleton-line--headline kf-shimmer" }),
|
|
183
|
+
/* @__PURE__ */ jsx("div", { className: "kf-share-view__skeleton-block kf-shimmer" }),
|
|
184
|
+
/* @__PURE__ */ jsx("div", { className: "kf-share-view__skeleton-block kf-share-view__skeleton-block--short kf-shimmer" }),
|
|
185
|
+
/* @__PURE__ */ jsx("div", { className: "kf-share-view__skeleton-block kf-shimmer" })
|
|
186
|
+
] });
|
|
187
|
+
}
|
|
188
|
+
function svg(children, size = 16) {
|
|
189
|
+
return /* @__PURE__ */ jsx(
|
|
190
|
+
"svg",
|
|
191
|
+
{
|
|
192
|
+
width: size,
|
|
193
|
+
height: size,
|
|
194
|
+
viewBox: "0 0 24 24",
|
|
195
|
+
fill: "none",
|
|
196
|
+
stroke: "currentColor",
|
|
197
|
+
strokeWidth: 1.75,
|
|
198
|
+
strokeLinecap: "round",
|
|
199
|
+
strokeLinejoin: "round",
|
|
200
|
+
"aria-hidden": "true",
|
|
201
|
+
children
|
|
202
|
+
}
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
function PhoneIcon({ size }) {
|
|
206
|
+
return svg(
|
|
207
|
+
/* @__PURE__ */ jsx("path", { d: "M4 4h3.2l1.4 4.4-2 1.6a12.5 12.5 0 0 0 5.4 5.4l1.6-2 4.4 1.4V18a2 2 0 0 1-2 2C10 20 4 14 4 6a2 2 0 0 1 0-2Z" }),
|
|
208
|
+
size
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
function WhatsappIcon({ size }) {
|
|
212
|
+
return svg(
|
|
213
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
214
|
+
/* @__PURE__ */ jsx("path", { d: "M6.3 17.7 5 20l2.4-1.3A8 8 0 1 0 4 12a8 8 0 0 0 2.3 5.7Z" }),
|
|
215
|
+
/* @__PURE__ */ jsx("path", { d: "M9 9.5c0 3.5 2.9 6 6 6 .6 0 1-.9.6-1.4l-1.2-1.4a.7.7 0 0 0-.8-.2l-1 .4a5 5 0 0 1-2.5-2.5l.4-1a.7.7 0 0 0-.2-.8L9.4 7.4C8.9 7 8 7.4 8 8c0 .5.2 1 1 1.5Z" })
|
|
216
|
+
] }),
|
|
217
|
+
size
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
function PlaneIcon({ size }) {
|
|
221
|
+
return svg(
|
|
222
|
+
/* @__PURE__ */ jsx("path", { d: "M10.5 20.5 12 15l6.5-6.5a2.1 2.1 0 0 0-3-3L9 12l-5.5 1.5 3 2 1 3 2-1Z" }),
|
|
223
|
+
size
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
function HouseIcon({ size }) {
|
|
227
|
+
return svg(
|
|
228
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
229
|
+
/* @__PURE__ */ jsx("path", { d: "M4 11 12 4l8 7" }),
|
|
230
|
+
/* @__PURE__ */ jsx("path", { d: "M6 10v9a1 1 0 0 0 1 1h3v-5h4v5h3a1 1 0 0 0 1-1v-9" })
|
|
231
|
+
] }),
|
|
232
|
+
size
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
function CarIcon({ size }) {
|
|
236
|
+
return svg(
|
|
237
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
238
|
+
/* @__PURE__ */ jsx("path", { d: "M4 16V12l2-5h12l2 5v4" }),
|
|
239
|
+
/* @__PURE__ */ jsx("path", { d: "M4 16h16v2a1 1 0 0 1-1 1h-1a1 1 0 0 1-1-1v-1H7v1a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1Z" }),
|
|
240
|
+
/* @__PURE__ */ jsx("circle", { cx: "7.5", cy: "16", r: "1.2" }),
|
|
241
|
+
/* @__PURE__ */ jsx("circle", { cx: "16.5", cy: "16", r: "1.2" })
|
|
242
|
+
] }),
|
|
243
|
+
size
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
function CompassIcon({ size }) {
|
|
247
|
+
return svg(
|
|
248
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
249
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "8" }),
|
|
250
|
+
/* @__PURE__ */ jsx("path", { d: "m14.5 9.5-1.8 4.2-4.2 1.8 1.8-4.2Z" })
|
|
251
|
+
] }),
|
|
252
|
+
size
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
function BedIcon({ size }) {
|
|
256
|
+
return svg(
|
|
257
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
258
|
+
/* @__PURE__ */ jsx("path", { d: "M3 18v-7a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v3" }),
|
|
259
|
+
/* @__PURE__ */ jsx("path", { d: "M3 18v2M21 18v2M3 15h18v3H3z" }),
|
|
260
|
+
/* @__PURE__ */ jsx("path", { d: "M13 11h6a2 2 0 0 1 2 2v2" }),
|
|
261
|
+
/* @__PURE__ */ jsx("circle", { cx: "7", cy: "11", r: "1.4" })
|
|
262
|
+
] }),
|
|
263
|
+
size
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
function DownloadIcon({ size }) {
|
|
267
|
+
return svg(
|
|
268
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
269
|
+
/* @__PURE__ */ jsx("path", { d: "M12 4v11" }),
|
|
270
|
+
/* @__PURE__ */ jsx("path", { d: "m7.5 11.5 4.5 4.5 4.5-4.5" }),
|
|
271
|
+
/* @__PURE__ */ jsx("path", { d: "M4 19.5h16" })
|
|
272
|
+
] }),
|
|
273
|
+
size
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
function PinIcon({ size }) {
|
|
277
|
+
return svg(
|
|
278
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
279
|
+
/* @__PURE__ */ jsx("path", { d: "M12 21s-6.5-5.6-6.5-10.5a6.5 6.5 0 0 1 13 0C18.5 15.4 12 21 12 21Z" }),
|
|
280
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "10.5", r: "2.2" })
|
|
281
|
+
] }),
|
|
282
|
+
size
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
function initialsOf(name) {
|
|
286
|
+
const parts = name.trim().split(/\s+/).filter(Boolean);
|
|
287
|
+
const first = parts[0]?.[0] ?? "";
|
|
288
|
+
const last = parts.length > 1 ? parts[parts.length - 1]?.[0] ?? "" : "";
|
|
289
|
+
return `${first}${last}`.toUpperCase();
|
|
290
|
+
}
|
|
291
|
+
function ContactActions({ row }) {
|
|
292
|
+
const { t } = useKaafilChrome();
|
|
293
|
+
if (row.phoneHref === null && row.whatsappHref === null) {
|
|
294
|
+
return null;
|
|
295
|
+
}
|
|
296
|
+
return /* @__PURE__ */ jsxs("div", { className: "kf-share-view__contact-actions", children: [
|
|
297
|
+
row.phoneHref !== null ? /* @__PURE__ */ jsxs(
|
|
298
|
+
"a",
|
|
299
|
+
{
|
|
300
|
+
className: "kf-share-view__contact-action kf-share-view__contact-action--call kf-press",
|
|
301
|
+
href: row.phoneHref,
|
|
302
|
+
children: [
|
|
303
|
+
/* @__PURE__ */ jsx(PhoneIcon, {}),
|
|
304
|
+
/* @__PURE__ */ jsx("span", { className: "kf-visually-hidden", children: t("chrome.shareView.contact.call").replace("{name}", row.name) })
|
|
305
|
+
]
|
|
306
|
+
}
|
|
307
|
+
) : null,
|
|
308
|
+
row.whatsappHref !== null ? /* @__PURE__ */ jsxs(
|
|
309
|
+
"a",
|
|
310
|
+
{
|
|
311
|
+
className: "kf-share-view__contact-action kf-share-view__contact-action--whatsapp kf-press",
|
|
312
|
+
href: row.whatsappHref,
|
|
313
|
+
children: [
|
|
314
|
+
/* @__PURE__ */ jsx(WhatsappIcon, {}),
|
|
315
|
+
/* @__PURE__ */ jsx("span", { className: "kf-visually-hidden", children: t("chrome.shareView.contact.whatsapp").replace("{name}", row.name) })
|
|
316
|
+
]
|
|
317
|
+
}
|
|
318
|
+
) : null
|
|
319
|
+
] });
|
|
320
|
+
}
|
|
321
|
+
function ContactCard({
|
|
322
|
+
row,
|
|
323
|
+
roleLabel,
|
|
324
|
+
footer
|
|
325
|
+
}) {
|
|
326
|
+
return /* @__PURE__ */ jsxs("div", { className: "kf-share-view__card kf-share-view__contact", children: [
|
|
327
|
+
/* @__PURE__ */ jsxs("div", { className: "kf-share-view__contact-main", children: [
|
|
328
|
+
/* @__PURE__ */ jsx("span", { className: "kf-share-view__contact-avatar", "aria-hidden": "true", children: initialsOf(row.name) }),
|
|
329
|
+
/* @__PURE__ */ jsxs("div", { className: "kf-share-view__contact-identity", children: [
|
|
330
|
+
/* @__PURE__ */ jsx("p", { className: "kf-share-view__contact-name", children: row.name }),
|
|
331
|
+
/* @__PURE__ */ jsxs("p", { className: "kf-share-view__contact-role kf-num", children: [
|
|
332
|
+
roleLabel,
|
|
333
|
+
row.phoneDisplay !== null ? ` \xB7 ${row.phoneDisplay}` : ""
|
|
334
|
+
] })
|
|
335
|
+
] }),
|
|
336
|
+
/* @__PURE__ */ jsx(ContactActions, { row })
|
|
337
|
+
] }),
|
|
338
|
+
footer
|
|
339
|
+
] });
|
|
340
|
+
}
|
|
341
|
+
function AgencyContactSection({ data }) {
|
|
342
|
+
const { t } = useKaafilChrome();
|
|
343
|
+
return /* @__PURE__ */ jsxs("section", { "aria-label": t("chrome.shareView.agency.eyebrow"), children: [
|
|
344
|
+
/* @__PURE__ */ jsx("div", { className: "kf-share-view__eyebrow-row", children: /* @__PURE__ */ jsx("span", { className: "kf-eyebrow", children: t("chrome.shareView.agency.eyebrow") }) }),
|
|
345
|
+
/* @__PURE__ */ jsx(ContactCard, { row: data, roleLabel: t("chrome.shareView.agency.roleLabel") })
|
|
346
|
+
] });
|
|
347
|
+
}
|
|
348
|
+
var PARTY_KIND_KEY = {
|
|
349
|
+
FAMILY: "chrome.shareView.brand.partyKind.family",
|
|
350
|
+
COUPLE: "chrome.shareView.brand.partyKind.couple",
|
|
351
|
+
FRIENDS: "chrome.shareView.brand.partyKind.friends",
|
|
352
|
+
CORPORATE: "chrome.shareView.brand.partyKind.corporate",
|
|
353
|
+
OTHER: "chrome.shareView.brand.partyKind.other"
|
|
354
|
+
};
|
|
355
|
+
function BrandHeaderSection({
|
|
356
|
+
agencyContact,
|
|
357
|
+
partyKind
|
|
358
|
+
}) {
|
|
359
|
+
const { t } = useKaafilChrome();
|
|
360
|
+
const initial = agencyContact.name.trim().slice(0, 1).toUpperCase();
|
|
361
|
+
const kindLabel = partyKind !== null ? t(PARTY_KIND_KEY[partyKind]) : null;
|
|
362
|
+
return /* @__PURE__ */ jsxs("div", { className: "kf-share-view__brand-header", children: [
|
|
363
|
+
/* @__PURE__ */ jsx("span", { className: "kf-share-view__brand-mark", "aria-hidden": "true", children: initial }),
|
|
364
|
+
/* @__PURE__ */ jsxs("p", { className: "kf-share-view__brand-name", children: [
|
|
365
|
+
agencyContact.name,
|
|
366
|
+
kindLabel !== null ? /* @__PURE__ */ jsxs("span", { className: "kf-share-view__brand-kind", children: [
|
|
367
|
+
" \xB7 ",
|
|
368
|
+
kindLabel
|
|
369
|
+
] }) : null
|
|
370
|
+
] }),
|
|
371
|
+
/* @__PURE__ */ jsx("span", { className: "kf-share-view__brand-readonly kf-eyebrow", children: t("chrome.shareView.brand.readOnly") })
|
|
372
|
+
] });
|
|
373
|
+
}
|
|
374
|
+
function groupBySectionTitle(items) {
|
|
375
|
+
const groups = /* @__PURE__ */ new Map();
|
|
376
|
+
for (const item of items) {
|
|
377
|
+
const existing = groups.get(item.sectionTitle);
|
|
378
|
+
if (existing !== void 0) {
|
|
379
|
+
existing.push(item);
|
|
380
|
+
} else {
|
|
381
|
+
groups.set(item.sectionTitle, [item]);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
return groups;
|
|
385
|
+
}
|
|
386
|
+
function ChecklistSection({ data }) {
|
|
387
|
+
if (data.items.length === 0) {
|
|
388
|
+
return null;
|
|
389
|
+
}
|
|
390
|
+
const groups = groupBySectionTitle(data.items);
|
|
391
|
+
return /* @__PURE__ */ jsx(Fragment, { children: Array.from(groups.entries()).map(([sectionTitle, items]) => /* @__PURE__ */ jsxs("section", { "aria-label": sectionTitle, children: [
|
|
392
|
+
/* @__PURE__ */ jsx("div", { className: "kf-share-view__eyebrow-row", children: /* @__PURE__ */ jsx("span", { className: "kf-eyebrow", children: sectionTitle }) }),
|
|
393
|
+
/* @__PURE__ */ jsx("ul", { className: "kf-share-view__card kf-share-view__list", children: items.map((item) => /* @__PURE__ */ jsxs("li", { className: "kf-share-view__row kf-share-view__checklist-row", children: [
|
|
394
|
+
/* @__PURE__ */ jsx("span", { className: "kf-share-view__checklist-marker", "aria-hidden": "true" }),
|
|
395
|
+
/* @__PURE__ */ jsxs("div", { className: "kf-share-view__checklist-body", children: [
|
|
396
|
+
/* @__PURE__ */ jsx("p", { className: "kf-share-view__checklist-title", children: item.title }),
|
|
397
|
+
item.subLine !== null ? /* @__PURE__ */ jsx("p", { className: "kf-share-view__checklist-sub", children: item.subLine }) : null
|
|
398
|
+
] })
|
|
399
|
+
] }, item.title)) })
|
|
400
|
+
] }, sectionTitle)) });
|
|
401
|
+
}
|
|
402
|
+
function formatSize(sizeBytes) {
|
|
403
|
+
if (sizeBytes < 1024) {
|
|
404
|
+
return `${String(sizeBytes)} B`;
|
|
405
|
+
}
|
|
406
|
+
const kb = sizeBytes / 1024;
|
|
407
|
+
if (kb < 1024) {
|
|
408
|
+
return `${kb.toFixed(0)} KB`;
|
|
409
|
+
}
|
|
410
|
+
return `${(kb / 1024).toFixed(1)} MB`;
|
|
411
|
+
}
|
|
412
|
+
function DocumentsSection({ data, timezone }) {
|
|
413
|
+
const { t } = useKaafilChrome();
|
|
414
|
+
const files = data.files ?? [];
|
|
415
|
+
if (data.vouchers.length === 0 && files.length === 0) {
|
|
416
|
+
return null;
|
|
417
|
+
}
|
|
418
|
+
return /* @__PURE__ */ jsxs("section", { "aria-label": t("chrome.shareView.documents.eyebrow"), children: [
|
|
419
|
+
/* @__PURE__ */ jsx("div", { className: "kf-share-view__eyebrow-row", children: /* @__PURE__ */ jsx("span", { className: "kf-eyebrow", children: t("chrome.shareView.documents.eyebrow") }) }),
|
|
420
|
+
/* @__PURE__ */ jsxs("ul", { className: "kf-share-view__card kf-share-view__list", children: [
|
|
421
|
+
files.map((file) => /* @__PURE__ */ jsxs("li", { className: "kf-share-view__row kf-share-view__document-row", children: [
|
|
422
|
+
/* @__PURE__ */ jsx("span", { className: "kf-share-view__document-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx(DownloadIcon, {}) }),
|
|
423
|
+
/* @__PURE__ */ jsx(
|
|
424
|
+
"a",
|
|
425
|
+
{
|
|
426
|
+
className: "kf-share-view__document-link",
|
|
427
|
+
href: file.url,
|
|
428
|
+
target: "_blank",
|
|
429
|
+
rel: "noreferrer",
|
|
430
|
+
children: file.title
|
|
431
|
+
}
|
|
432
|
+
),
|
|
433
|
+
/* @__PURE__ */ jsxs("span", { className: "kf-share-view__document-meta kf-num", children: [
|
|
434
|
+
file.scope === "yours" ? `${t("chrome.shareView.documents.yours")} \xB7 ` : "",
|
|
435
|
+
formatSize(file.sizeBytes)
|
|
436
|
+
] })
|
|
437
|
+
] }, file.id)),
|
|
438
|
+
data.vouchers.map((voucher) => /* @__PURE__ */ jsxs("li", { className: "kf-share-view__row kf-share-view__document-row", children: [
|
|
439
|
+
/* @__PURE__ */ jsx("span", { className: "kf-share-view__document-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx(DownloadIcon, {}) }),
|
|
440
|
+
/* @__PURE__ */ jsx(
|
|
441
|
+
"a",
|
|
442
|
+
{
|
|
443
|
+
className: "kf-share-view__document-link",
|
|
444
|
+
href: voucher.url,
|
|
445
|
+
target: "_blank",
|
|
446
|
+
rel: "noreferrer",
|
|
447
|
+
children: voucher.bookingLabel
|
|
448
|
+
}
|
|
449
|
+
),
|
|
450
|
+
/* @__PURE__ */ jsxs("span", { className: "kf-share-view__document-meta kf-num", children: [
|
|
451
|
+
formatDayMonth(voucher.isoDate, timezone),
|
|
452
|
+
" \xB7 ",
|
|
453
|
+
formatSize(voucher.sizeBytes)
|
|
454
|
+
] })
|
|
455
|
+
] }, voucher.id))
|
|
456
|
+
] })
|
|
457
|
+
] });
|
|
458
|
+
}
|
|
459
|
+
function SelectFieldEditor({
|
|
460
|
+
id,
|
|
461
|
+
value,
|
|
462
|
+
options,
|
|
463
|
+
required,
|
|
464
|
+
onChange
|
|
465
|
+
}) {
|
|
466
|
+
const { t } = useKaafilChrome();
|
|
467
|
+
const [open, setOpen] = useState(false);
|
|
468
|
+
const rootRef = useRef(null);
|
|
469
|
+
const selected = options.find((option) => option.value === value);
|
|
470
|
+
useEffect(() => {
|
|
471
|
+
if (!open) {
|
|
472
|
+
return;
|
|
473
|
+
}
|
|
474
|
+
function handlePointerDown(event) {
|
|
475
|
+
if (rootRef.current !== null && !rootRef.current.contains(event.target)) {
|
|
476
|
+
setOpen(false);
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
function handleKeyDown(event) {
|
|
480
|
+
if (event.key === "Escape") {
|
|
481
|
+
setOpen(false);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
document.addEventListener("pointerdown", handlePointerDown);
|
|
485
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
486
|
+
return () => {
|
|
487
|
+
document.removeEventListener("pointerdown", handlePointerDown);
|
|
488
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
489
|
+
};
|
|
490
|
+
}, [open]);
|
|
491
|
+
return /* @__PURE__ */ jsxs("div", { className: "kf-share-view__select", ref: rootRef, children: [
|
|
492
|
+
/* @__PURE__ */ jsxs(
|
|
493
|
+
"button",
|
|
494
|
+
{
|
|
495
|
+
type: "button",
|
|
496
|
+
id,
|
|
497
|
+
className: "kf-share-view__select-trigger",
|
|
498
|
+
"aria-haspopup": "listbox",
|
|
499
|
+
"aria-expanded": open,
|
|
500
|
+
onClick: () => setOpen((current) => !current),
|
|
501
|
+
children: [
|
|
502
|
+
/* @__PURE__ */ jsxs("span", { className: selected === void 0 ? "kf-share-view__select-placeholder" : void 0, children: [
|
|
503
|
+
selected?.label ?? t("chrome.shareView.form.choosePlaceholder"),
|
|
504
|
+
required && selected === void 0 ? " *" : ""
|
|
505
|
+
] }),
|
|
506
|
+
/* @__PURE__ */ jsx("span", { className: "kf-share-view__select-chevron", "aria-hidden": "true" })
|
|
507
|
+
]
|
|
508
|
+
}
|
|
509
|
+
),
|
|
510
|
+
open ? /* @__PURE__ */ jsx("div", { className: "kf-share-view__select-listbox", role: "listbox", children: options.map((option) => /* @__PURE__ */ jsx(
|
|
511
|
+
"button",
|
|
512
|
+
{
|
|
513
|
+
type: "button",
|
|
514
|
+
role: "option",
|
|
515
|
+
"aria-selected": option.value === value,
|
|
516
|
+
className: "kf-share-view__select-option",
|
|
517
|
+
onClick: () => {
|
|
518
|
+
onChange(option.value);
|
|
519
|
+
setOpen(false);
|
|
520
|
+
},
|
|
521
|
+
children: option.label
|
|
522
|
+
},
|
|
523
|
+
option.value
|
|
524
|
+
)) }) : null
|
|
525
|
+
] });
|
|
526
|
+
}
|
|
527
|
+
function configOf(field) {
|
|
528
|
+
return field.config;
|
|
529
|
+
}
|
|
530
|
+
function textValue(value) {
|
|
531
|
+
return typeof value === "string" ? value : "";
|
|
532
|
+
}
|
|
533
|
+
function numberValue(value) {
|
|
534
|
+
return typeof value === "number" ? String(value) : "";
|
|
535
|
+
}
|
|
536
|
+
function PlainPreview({ value }) {
|
|
537
|
+
return /* @__PURE__ */ jsx("p", { className: "kf-share-view__form-preview", children: typeof value === "string" ? value : "" });
|
|
538
|
+
}
|
|
539
|
+
var fallback = {
|
|
540
|
+
editor: ({ field, t }) => /* @__PURE__ */ jsx("p", { className: "kf-share-view__form-unsupported", children: t("chrome.shareView.form.unsupported").replace("{label}", field.label) }),
|
|
541
|
+
preview: PlainPreview
|
|
542
|
+
};
|
|
543
|
+
var fieldRegistry = createRegistry({ fallback });
|
|
544
|
+
fieldRegistry.register("HEADING", {
|
|
545
|
+
editor: ({ field }) => /* @__PURE__ */ jsx("h3", { className: "kf-share-view__form-heading", children: field.label }),
|
|
546
|
+
preview: ({ field }) => /* @__PURE__ */ jsx("h3", { className: "kf-share-view__form-heading", children: field.label })
|
|
547
|
+
});
|
|
548
|
+
fieldRegistry.register("INFO_BLOCK", {
|
|
549
|
+
editor: ({ field }) => /* @__PURE__ */ jsx("p", { className: "kf-share-view__form-info", children: field.contentText }),
|
|
550
|
+
preview: ({ field }) => /* @__PURE__ */ jsx("p", { className: "kf-share-view__form-info", children: field.contentText })
|
|
551
|
+
});
|
|
552
|
+
fieldRegistry.register("SHORT_TEXT", {
|
|
553
|
+
editor: ({ field, value, onChange }) => {
|
|
554
|
+
const config = configOf(field);
|
|
555
|
+
return /* @__PURE__ */ jsx(
|
|
556
|
+
"input",
|
|
557
|
+
{
|
|
558
|
+
type: "text",
|
|
559
|
+
className: "kf-share-view__form-input",
|
|
560
|
+
value: textValue(value),
|
|
561
|
+
maxLength: config.maxLength,
|
|
562
|
+
pattern: config.pattern,
|
|
563
|
+
required: field.required,
|
|
564
|
+
onChange: (event) => onChange(event.target.value)
|
|
565
|
+
}
|
|
566
|
+
);
|
|
567
|
+
},
|
|
568
|
+
preview: PlainPreview
|
|
569
|
+
});
|
|
570
|
+
fieldRegistry.register("LONG_TEXT", {
|
|
571
|
+
editor: ({ field, value, onChange }) => {
|
|
572
|
+
const config = configOf(field);
|
|
573
|
+
return /* @__PURE__ */ jsx(
|
|
574
|
+
"textarea",
|
|
575
|
+
{
|
|
576
|
+
className: "kf-share-view__form-textarea",
|
|
577
|
+
value: textValue(value),
|
|
578
|
+
maxLength: config.maxLength,
|
|
579
|
+
required: field.required,
|
|
580
|
+
onChange: (event) => onChange(event.target.value)
|
|
581
|
+
}
|
|
582
|
+
);
|
|
583
|
+
},
|
|
584
|
+
preview: PlainPreview
|
|
585
|
+
});
|
|
586
|
+
fieldRegistry.register("EMAIL", {
|
|
587
|
+
editor: ({ field, value, onChange }) => {
|
|
588
|
+
void configOf(field);
|
|
589
|
+
return /* @__PURE__ */ jsx(
|
|
590
|
+
"input",
|
|
591
|
+
{
|
|
592
|
+
type: "email",
|
|
593
|
+
className: "kf-share-view__form-input",
|
|
594
|
+
value: textValue(value),
|
|
595
|
+
required: field.required,
|
|
596
|
+
onChange: (event) => onChange(event.target.value)
|
|
597
|
+
}
|
|
598
|
+
);
|
|
599
|
+
},
|
|
600
|
+
preview: PlainPreview
|
|
601
|
+
});
|
|
602
|
+
fieldRegistry.register("PHONE", {
|
|
603
|
+
editor: ({ field, value, onChange }) => {
|
|
604
|
+
void configOf(field);
|
|
605
|
+
return /* @__PURE__ */ jsx(
|
|
606
|
+
"input",
|
|
607
|
+
{
|
|
608
|
+
type: "tel",
|
|
609
|
+
className: "kf-share-view__form-input",
|
|
610
|
+
value: textValue(value),
|
|
611
|
+
required: field.required,
|
|
612
|
+
onChange: (event) => onChange(event.target.value)
|
|
613
|
+
}
|
|
614
|
+
);
|
|
615
|
+
},
|
|
616
|
+
preview: PlainPreview
|
|
617
|
+
});
|
|
618
|
+
fieldRegistry.register("URL", {
|
|
619
|
+
editor: ({ field, value, onChange }) => /* @__PURE__ */ jsx(
|
|
620
|
+
"input",
|
|
621
|
+
{
|
|
622
|
+
type: "url",
|
|
623
|
+
className: "kf-share-view__form-input",
|
|
624
|
+
value: textValue(value),
|
|
625
|
+
required: field.required,
|
|
626
|
+
onChange: (event) => onChange(event.target.value)
|
|
627
|
+
}
|
|
628
|
+
),
|
|
629
|
+
preview: PlainPreview
|
|
630
|
+
});
|
|
631
|
+
fieldRegistry.register("NUMBER", {
|
|
632
|
+
editor: ({ field, value, onChange }) => {
|
|
633
|
+
const config = configOf(field);
|
|
634
|
+
return /* @__PURE__ */ jsx(
|
|
635
|
+
"input",
|
|
636
|
+
{
|
|
637
|
+
type: "number",
|
|
638
|
+
className: "kf-share-view__form-input",
|
|
639
|
+
value: numberValue(value),
|
|
640
|
+
min: config.min,
|
|
641
|
+
max: config.max,
|
|
642
|
+
step: config.step ?? 1,
|
|
643
|
+
required: field.required,
|
|
644
|
+
onChange: (event) => onChange(event.target.value === "" ? void 0 : Number(event.target.value))
|
|
645
|
+
}
|
|
646
|
+
);
|
|
647
|
+
},
|
|
648
|
+
preview: ({ value }) => /* @__PURE__ */ jsx("p", { className: "kf-share-view__form-preview kf-num", children: numberValue(value) })
|
|
649
|
+
});
|
|
650
|
+
fieldRegistry.register("CURRENCY", {
|
|
651
|
+
editor: ({ field, value, onChange }) => {
|
|
652
|
+
const config = configOf(field);
|
|
653
|
+
return /* @__PURE__ */ jsx(
|
|
654
|
+
"input",
|
|
655
|
+
{
|
|
656
|
+
type: "number",
|
|
657
|
+
className: "kf-share-view__form-input",
|
|
658
|
+
value: numberValue(value),
|
|
659
|
+
min: config.minMinor !== void 0 ? config.minMinor / 100 : void 0,
|
|
660
|
+
max: config.maxMinor !== void 0 ? config.maxMinor / 100 : void 0,
|
|
661
|
+
step: 0.01,
|
|
662
|
+
required: field.required,
|
|
663
|
+
onChange: (event) => onChange(
|
|
664
|
+
event.target.value === "" ? void 0 : Math.round(Number(event.target.value) * 100)
|
|
665
|
+
)
|
|
666
|
+
}
|
|
667
|
+
);
|
|
668
|
+
},
|
|
669
|
+
preview: ({ value }) => /* @__PURE__ */ jsx("p", { className: "kf-share-view__form-preview kf-num", children: typeof value === "number" ? (value / 100).toFixed(2) : "" })
|
|
670
|
+
});
|
|
671
|
+
fieldRegistry.register("RATING", {
|
|
672
|
+
editor: ({ field, value, onChange }) => {
|
|
673
|
+
const config = configOf(field);
|
|
674
|
+
const max = config.ratingMax ?? 5;
|
|
675
|
+
return /* @__PURE__ */ jsxs("fieldset", { className: "kf-share-view__form-rating", children: [
|
|
676
|
+
/* @__PURE__ */ jsx("legend", { className: "kf-visually-hidden", children: field.label }),
|
|
677
|
+
Array.from({ length: max }, (_unused, index) => index + 1).map((score) => /* @__PURE__ */ jsx(
|
|
678
|
+
"button",
|
|
679
|
+
{
|
|
680
|
+
type: "button",
|
|
681
|
+
"aria-pressed": value === score,
|
|
682
|
+
className: `kf-share-view__form-rating-dot kf-press ${value === score ? "kf-share-view__form-rating-dot--selected" : ""}`,
|
|
683
|
+
onClick: () => onChange(score),
|
|
684
|
+
children: score
|
|
685
|
+
},
|
|
686
|
+
score
|
|
687
|
+
))
|
|
688
|
+
] });
|
|
689
|
+
},
|
|
690
|
+
preview: ({ value }) => /* @__PURE__ */ jsx("p", { className: "kf-share-view__form-preview kf-num", children: numberValue(value) })
|
|
691
|
+
});
|
|
692
|
+
fieldRegistry.register("NPS", {
|
|
693
|
+
editor: ({ field, value, onChange }) => {
|
|
694
|
+
void configOf(field);
|
|
695
|
+
return /* @__PURE__ */ jsxs("fieldset", { className: "kf-share-view__form-rating", children: [
|
|
696
|
+
/* @__PURE__ */ jsx("legend", { className: "kf-visually-hidden", children: field.label }),
|
|
697
|
+
Array.from({ length: 11 }, (_unused, index) => index).map((score) => /* @__PURE__ */ jsx(
|
|
698
|
+
"button",
|
|
699
|
+
{
|
|
700
|
+
type: "button",
|
|
701
|
+
"aria-pressed": value === score,
|
|
702
|
+
className: `kf-share-view__form-rating-dot kf-press ${value === score ? "kf-share-view__form-rating-dot--selected" : ""}`,
|
|
703
|
+
onClick: () => onChange(score),
|
|
704
|
+
children: score
|
|
705
|
+
},
|
|
706
|
+
score
|
|
707
|
+
))
|
|
708
|
+
] });
|
|
709
|
+
},
|
|
710
|
+
preview: ({ value }) => /* @__PURE__ */ jsx("p", { className: "kf-share-view__form-preview kf-num", children: numberValue(value) })
|
|
711
|
+
});
|
|
712
|
+
fieldRegistry.register("DATE", {
|
|
713
|
+
editor: ({ field, value, onChange }) => {
|
|
714
|
+
const config = configOf(field);
|
|
715
|
+
return /* @__PURE__ */ jsx(
|
|
716
|
+
"input",
|
|
717
|
+
{
|
|
718
|
+
type: "date",
|
|
719
|
+
className: "kf-share-view__form-input",
|
|
720
|
+
value: textValue(value),
|
|
721
|
+
min: config.minDate,
|
|
722
|
+
max: config.maxDate,
|
|
723
|
+
required: field.required,
|
|
724
|
+
onChange: (event) => onChange(event.target.value)
|
|
725
|
+
}
|
|
726
|
+
);
|
|
727
|
+
},
|
|
728
|
+
preview: PlainPreview
|
|
729
|
+
});
|
|
730
|
+
fieldRegistry.register("DATETIME", {
|
|
731
|
+
editor: ({ field, value, onChange }) => {
|
|
732
|
+
const config = configOf(field);
|
|
733
|
+
return /* @__PURE__ */ jsx(
|
|
734
|
+
"input",
|
|
735
|
+
{
|
|
736
|
+
type: "datetime-local",
|
|
737
|
+
className: "kf-share-view__form-input",
|
|
738
|
+
value: textValue(value),
|
|
739
|
+
step: config.minuteStep !== void 0 ? config.minuteStep * 60 : void 0,
|
|
740
|
+
required: field.required,
|
|
741
|
+
onChange: (event) => onChange(event.target.value)
|
|
742
|
+
}
|
|
743
|
+
);
|
|
744
|
+
},
|
|
745
|
+
preview: PlainPreview
|
|
746
|
+
});
|
|
747
|
+
fieldRegistry.register("TIME", {
|
|
748
|
+
editor: ({ field, value, onChange }) => {
|
|
749
|
+
void configOf(field);
|
|
750
|
+
const minutes = typeof value === "number" ? value : void 0;
|
|
751
|
+
const hh = minutes !== void 0 ? String(Math.floor(minutes / 60)).padStart(2, "0") : "";
|
|
752
|
+
const mm = minutes !== void 0 ? String(minutes % 60).padStart(2, "0") : "";
|
|
753
|
+
return /* @__PURE__ */ jsx(
|
|
754
|
+
"input",
|
|
755
|
+
{
|
|
756
|
+
type: "time",
|
|
757
|
+
className: "kf-share-view__form-input",
|
|
758
|
+
value: minutes !== void 0 ? `${hh}:${mm}` : "",
|
|
759
|
+
required: field.required,
|
|
760
|
+
onChange: (event) => {
|
|
761
|
+
const [h, m] = event.target.value.split(":");
|
|
762
|
+
if (h === void 0 || m === void 0) {
|
|
763
|
+
onChange(void 0);
|
|
764
|
+
return;
|
|
765
|
+
}
|
|
766
|
+
onChange(Number(h) * 60 + Number(m));
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
);
|
|
770
|
+
},
|
|
771
|
+
preview: ({ value }) => {
|
|
772
|
+
const minutes = typeof value === "number" ? value : void 0;
|
|
773
|
+
return /* @__PURE__ */ jsx("p", { className: "kf-share-view__form-preview kf-num", children: minutes !== void 0 ? `${String(Math.floor(minutes / 60)).padStart(2, "0")}:${String(minutes % 60).padStart(2, "0")}` : "" });
|
|
774
|
+
}
|
|
775
|
+
});
|
|
776
|
+
fieldRegistry.register("SELECT", {
|
|
777
|
+
editor: ({ field, value, onChange, t }) => {
|
|
778
|
+
const config = configOf(field);
|
|
779
|
+
const options = [...config.options].sort((a, b) => a.sortOrder - b.sortOrder);
|
|
780
|
+
const withOther = config.otherAllowed === true ? [...options, { value: "__other__", label: t("chrome.shareView.form.other") }] : options;
|
|
781
|
+
return /* @__PURE__ */ jsx(
|
|
782
|
+
SelectFieldEditor,
|
|
783
|
+
{
|
|
784
|
+
id: field.id,
|
|
785
|
+
value: textValue(value),
|
|
786
|
+
options: withOther,
|
|
787
|
+
required: field.required,
|
|
788
|
+
onChange
|
|
789
|
+
}
|
|
790
|
+
);
|
|
791
|
+
},
|
|
792
|
+
preview: PlainPreview
|
|
793
|
+
});
|
|
794
|
+
fieldRegistry.register("MULTISELECT", {
|
|
795
|
+
editor: ({ field, value, onChange }) => {
|
|
796
|
+
const config = configOf(field);
|
|
797
|
+
const options = [...config.options].sort((a, b) => a.sortOrder - b.sortOrder);
|
|
798
|
+
const selected = Array.isArray(value) ? value : [];
|
|
799
|
+
return /* @__PURE__ */ jsxs("fieldset", { className: "kf-share-view__form-multiselect", children: [
|
|
800
|
+
/* @__PURE__ */ jsx("legend", { className: "kf-visually-hidden", children: field.label }),
|
|
801
|
+
options.map((option) => {
|
|
802
|
+
const checked = selected.includes(option.value);
|
|
803
|
+
return /* @__PURE__ */ jsxs("label", { className: "kf-share-view__form-checkbox-row", children: [
|
|
804
|
+
/* @__PURE__ */ jsx(
|
|
805
|
+
"input",
|
|
806
|
+
{
|
|
807
|
+
type: "checkbox",
|
|
808
|
+
checked,
|
|
809
|
+
onChange: (event) => {
|
|
810
|
+
const max = config.maxSelections ?? 50;
|
|
811
|
+
if (event.target.checked) {
|
|
812
|
+
if (selected.length >= max) {
|
|
813
|
+
return;
|
|
814
|
+
}
|
|
815
|
+
onChange([...selected, option.value]);
|
|
816
|
+
} else {
|
|
817
|
+
onChange(selected.filter((entry) => entry !== option.value));
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
),
|
|
822
|
+
option.label
|
|
823
|
+
] }, option.value);
|
|
824
|
+
})
|
|
825
|
+
] });
|
|
826
|
+
},
|
|
827
|
+
preview: ({ value }) => /* @__PURE__ */ jsx("p", { className: "kf-share-view__form-preview", children: Array.isArray(value) ? value.join(", ") : "" })
|
|
828
|
+
});
|
|
829
|
+
fieldRegistry.register("CHECKBOX", {
|
|
830
|
+
editor: ({ field, value, onChange }) => {
|
|
831
|
+
void configOf(field);
|
|
832
|
+
return /* @__PURE__ */ jsxs("label", { className: "kf-share-view__form-checkbox-row", children: [
|
|
833
|
+
/* @__PURE__ */ jsx(
|
|
834
|
+
"input",
|
|
835
|
+
{
|
|
836
|
+
type: "checkbox",
|
|
837
|
+
checked: value === true,
|
|
838
|
+
onChange: (event) => onChange(event.target.checked)
|
|
839
|
+
}
|
|
840
|
+
),
|
|
841
|
+
field.label
|
|
842
|
+
] });
|
|
843
|
+
},
|
|
844
|
+
preview: ({ value, t }) => /* @__PURE__ */ jsx("p", { className: "kf-share-view__form-preview", children: value === true ? t("chrome.shareView.form.yes") : t("chrome.shareView.form.no") })
|
|
845
|
+
});
|
|
846
|
+
fieldRegistry.register("CONSENT", {
|
|
847
|
+
editor: ({ field, value, onChange }) => {
|
|
848
|
+
void configOf(field);
|
|
849
|
+
return /* @__PURE__ */ jsxs("label", { className: "kf-share-view__form-checkbox-row", children: [
|
|
850
|
+
/* @__PURE__ */ jsx(
|
|
851
|
+
"input",
|
|
852
|
+
{
|
|
853
|
+
type: "checkbox",
|
|
854
|
+
checked: value === true,
|
|
855
|
+
required: field.required,
|
|
856
|
+
onChange: (event) => onChange(event.target.checked)
|
|
857
|
+
}
|
|
858
|
+
),
|
|
859
|
+
field.contentText ?? field.label
|
|
860
|
+
] });
|
|
861
|
+
},
|
|
862
|
+
preview: ({ value, t }) => /* @__PURE__ */ jsx("p", { className: "kf-share-view__form-preview", children: value === true ? t("chrome.shareView.form.agreed") : "" })
|
|
863
|
+
});
|
|
864
|
+
fieldRegistry.register("SIGNATURE", {
|
|
865
|
+
editor: ({ field, value, onChange }) => {
|
|
866
|
+
void configOf(field);
|
|
867
|
+
return /* @__PURE__ */ jsxs("div", { className: "kf-share-view__form-file", children: [
|
|
868
|
+
/* @__PURE__ */ jsx(
|
|
869
|
+
"input",
|
|
870
|
+
{
|
|
871
|
+
type: "file",
|
|
872
|
+
accept: "image/*",
|
|
873
|
+
onChange: (event) => onChange(event.target.files?.[0]?.name)
|
|
874
|
+
}
|
|
875
|
+
),
|
|
876
|
+
typeof value === "string" ? /* @__PURE__ */ jsx("p", { className: "kf-share-view__form-file-name", children: value }) : null
|
|
877
|
+
] });
|
|
878
|
+
},
|
|
879
|
+
preview: ({ value }) => /* @__PURE__ */ jsx("p", { className: "kf-share-view__form-preview", children: typeof value === "string" ? value : "" })
|
|
880
|
+
});
|
|
881
|
+
fieldRegistry.register("FILE_UPLOAD", {
|
|
882
|
+
editor: ({ field, value, onChange }) => {
|
|
883
|
+
const config = configOf(field);
|
|
884
|
+
return /* @__PURE__ */ jsxs("div", { className: "kf-share-view__form-file", children: [
|
|
885
|
+
/* @__PURE__ */ jsx(
|
|
886
|
+
"input",
|
|
887
|
+
{
|
|
888
|
+
type: "file",
|
|
889
|
+
accept: config.accept?.join(","),
|
|
890
|
+
multiple: (config.maxFiles ?? 1) > 1,
|
|
891
|
+
onChange: (event) => onChange(Array.from(event.target.files ?? []).map((file) => file.name))
|
|
892
|
+
}
|
|
893
|
+
),
|
|
894
|
+
Array.isArray(value) ? /* @__PURE__ */ jsx("p", { className: "kf-share-view__form-file-name", children: value.join(", ") }) : null
|
|
895
|
+
] });
|
|
896
|
+
},
|
|
897
|
+
preview: ({ value }) => /* @__PURE__ */ jsx("p", { className: "kf-share-view__form-preview", children: Array.isArray(value) ? value.join(", ") : "" })
|
|
898
|
+
});
|
|
899
|
+
fieldRegistry.register("ADDRESS", {
|
|
900
|
+
editor: ({ field, value, onChange, t }) => {
|
|
901
|
+
void configOf(field);
|
|
902
|
+
const address = value ?? {};
|
|
903
|
+
const update = (patch) => onChange({ ...address, ...patch });
|
|
904
|
+
return /* @__PURE__ */ jsxs("div", { className: "kf-share-view__form-address", children: [
|
|
905
|
+
/* @__PURE__ */ jsx(
|
|
906
|
+
"input",
|
|
907
|
+
{
|
|
908
|
+
type: "text",
|
|
909
|
+
className: "kf-share-view__form-input",
|
|
910
|
+
placeholder: t("chrome.shareView.form.address.line1"),
|
|
911
|
+
value: address.line1 ?? "",
|
|
912
|
+
onChange: (event) => update({ line1: event.target.value })
|
|
913
|
+
}
|
|
914
|
+
),
|
|
915
|
+
/* @__PURE__ */ jsx(
|
|
916
|
+
"input",
|
|
917
|
+
{
|
|
918
|
+
type: "text",
|
|
919
|
+
className: "kf-share-view__form-input",
|
|
920
|
+
placeholder: t("chrome.shareView.form.address.city"),
|
|
921
|
+
value: address.city ?? "",
|
|
922
|
+
onChange: (event) => update({ city: event.target.value })
|
|
923
|
+
}
|
|
924
|
+
),
|
|
925
|
+
/* @__PURE__ */ jsx(
|
|
926
|
+
"input",
|
|
927
|
+
{
|
|
928
|
+
type: "text",
|
|
929
|
+
className: "kf-share-view__form-input",
|
|
930
|
+
placeholder: t("chrome.shareView.form.address.postalCode"),
|
|
931
|
+
value: address.postalCode ?? "",
|
|
932
|
+
onChange: (event) => update({ postalCode: event.target.value })
|
|
933
|
+
}
|
|
934
|
+
),
|
|
935
|
+
/* @__PURE__ */ jsx(
|
|
936
|
+
"input",
|
|
937
|
+
{
|
|
938
|
+
type: "text",
|
|
939
|
+
className: "kf-share-view__form-input",
|
|
940
|
+
placeholder: t("chrome.shareView.form.address.country"),
|
|
941
|
+
value: address.country ?? "",
|
|
942
|
+
onChange: (event) => update({ country: event.target.value })
|
|
943
|
+
}
|
|
944
|
+
)
|
|
945
|
+
] });
|
|
946
|
+
},
|
|
947
|
+
preview: ({ value }) => {
|
|
948
|
+
const address = value;
|
|
949
|
+
return /* @__PURE__ */ jsx("p", { className: "kf-share-view__form-preview", children: address !== void 0 ? [address.line1, address.city, address.postalCode, address.country].filter(Boolean).join(", ") : "" });
|
|
950
|
+
}
|
|
951
|
+
});
|
|
952
|
+
function initialAnswers(fields) {
|
|
953
|
+
const map = /* @__PURE__ */ new Map();
|
|
954
|
+
for (const field of fields) {
|
|
955
|
+
if (field.kind === "HEADING" || field.kind === "INFO_BLOCK") {
|
|
956
|
+
continue;
|
|
957
|
+
}
|
|
958
|
+
map.set(field.key, field.prefill);
|
|
959
|
+
}
|
|
960
|
+
return map;
|
|
961
|
+
}
|
|
962
|
+
function FormFillScreen({
|
|
963
|
+
form,
|
|
964
|
+
save,
|
|
965
|
+
submit,
|
|
966
|
+
writeStatus,
|
|
967
|
+
travellerRef
|
|
968
|
+
}) {
|
|
969
|
+
const { t } = useKaafilChrome();
|
|
970
|
+
const [clientToken] = useState(() => crypto.randomUUID());
|
|
971
|
+
const [answers, setAnswers] = useState(() => initialAnswers(form.fields));
|
|
972
|
+
const readOnly = form.responseStatus === "SUBMITTED";
|
|
973
|
+
const answerList = useMemo(() => {
|
|
974
|
+
const list = [];
|
|
975
|
+
for (const field of form.fields) {
|
|
976
|
+
if (field.kind === "HEADING" || field.kind === "INFO_BLOCK") {
|
|
977
|
+
continue;
|
|
978
|
+
}
|
|
979
|
+
list.push({ fieldKey: field.key, value: answers.get(field.key) });
|
|
980
|
+
}
|
|
981
|
+
return list;
|
|
982
|
+
}, [answers, form.fields]);
|
|
983
|
+
const setAnswer = (key, value) => {
|
|
984
|
+
setAnswers((current) => {
|
|
985
|
+
const next = new Map(current);
|
|
986
|
+
next.set(key, value);
|
|
987
|
+
return next;
|
|
988
|
+
});
|
|
989
|
+
};
|
|
990
|
+
const writeInput = () => ({
|
|
991
|
+
formId: form.formId,
|
|
992
|
+
answers: answerList,
|
|
993
|
+
clientToken,
|
|
994
|
+
...travellerRef !== void 0 ? { travellerRef } : {}
|
|
995
|
+
});
|
|
996
|
+
return /* @__PURE__ */ jsxs("section", { className: "kf-share-view__form-fill", "aria-label": form.title, children: [
|
|
997
|
+
form.introText !== null ? /* @__PURE__ */ jsx("p", { className: "kf-share-view__form-intro", children: form.introText }) : null,
|
|
998
|
+
/* @__PURE__ */ jsx("div", { className: "kf-share-view__form-fields", children: form.fields.map((field) => {
|
|
999
|
+
const handler = fieldRegistry.resolve(field.kind);
|
|
1000
|
+
const value = answers.get(field.key);
|
|
1001
|
+
const showPreview = readOnly || field.locked;
|
|
1002
|
+
return /* @__PURE__ */ jsxs("div", { className: "kf-share-view__form-field", children: [
|
|
1003
|
+
field.kind !== "HEADING" && field.kind !== "INFO_BLOCK" ? /* @__PURE__ */ jsxs("label", { className: "kf-share-view__form-label", htmlFor: field.id, children: [
|
|
1004
|
+
field.label,
|
|
1005
|
+
field.required ? " *" : ""
|
|
1006
|
+
] }) : null,
|
|
1007
|
+
showPreview ? handler.preview({ field, value, t }) : handler.editor({
|
|
1008
|
+
field,
|
|
1009
|
+
value,
|
|
1010
|
+
onChange: (next) => setAnswer(field.key, next),
|
|
1011
|
+
t
|
|
1012
|
+
}),
|
|
1013
|
+
field.helpText !== null ? /* @__PURE__ */ jsx("p", { className: "kf-share-view__form-help", children: field.helpText }) : null
|
|
1014
|
+
] }, field.id);
|
|
1015
|
+
}) }),
|
|
1016
|
+
form.outroText !== null ? /* @__PURE__ */ jsx("p", { className: "kf-share-view__form-outro", children: form.outroText }) : null,
|
|
1017
|
+
!readOnly ? /* @__PURE__ */ jsxs("div", { className: "kf-share-view__form-actions", children: [
|
|
1018
|
+
/* @__PURE__ */ jsx(
|
|
1019
|
+
"button",
|
|
1020
|
+
{
|
|
1021
|
+
type: "button",
|
|
1022
|
+
className: "kf-share-view__form-action kf-share-view__form-action--save kf-press",
|
|
1023
|
+
disabled: writeStatus === "saving" || writeStatus === "submitting",
|
|
1024
|
+
onClick: () => void save(writeInput()),
|
|
1025
|
+
children: t("chrome.shareView.form.saveDraft")
|
|
1026
|
+
}
|
|
1027
|
+
),
|
|
1028
|
+
/* @__PURE__ */ jsx(
|
|
1029
|
+
"button",
|
|
1030
|
+
{
|
|
1031
|
+
type: "button",
|
|
1032
|
+
className: "kf-share-view__form-action kf-share-view__form-action--submit kf-press",
|
|
1033
|
+
disabled: writeStatus === "saving" || writeStatus === "submitting",
|
|
1034
|
+
onClick: () => void submit(writeInput()),
|
|
1035
|
+
children: t("chrome.shareView.form.submit")
|
|
1036
|
+
}
|
|
1037
|
+
)
|
|
1038
|
+
] }) : null,
|
|
1039
|
+
writeStatus === "submitted" ? /* @__PURE__ */ jsx("p", { className: "kf-share-view__form-status", role: "status", children: t("chrome.shareView.form.submittedMessage") }) : null,
|
|
1040
|
+
writeStatus === "queued-offline" ? /* @__PURE__ */ jsx("p", { className: "kf-share-view__form-status", role: "status", children: t("chrome.shareView.form.queuedOffline") }) : null,
|
|
1041
|
+
writeStatus === "conflicted" ? /* @__PURE__ */ jsx("p", { className: "kf-share-view__form-status", role: "alert", children: t("chrome.shareView.form.conflicted") }) : null
|
|
1042
|
+
] });
|
|
1043
|
+
}
|
|
1044
|
+
var FILL_STATE_KEY = {
|
|
1045
|
+
ok: "chrome.shareView.forms.status.open",
|
|
1046
|
+
window_closed: "chrome.shareView.forms.status.windowClosed",
|
|
1047
|
+
form_closed: "chrome.shareView.forms.status.closed",
|
|
1048
|
+
not_open_yet: "chrome.shareView.forms.status.notOpenYet",
|
|
1049
|
+
awaiting_dispatch: "chrome.shareView.forms.status.notSentYet",
|
|
1050
|
+
already_submitted: "chrome.shareView.forms.status.submitted",
|
|
1051
|
+
response_limit_reached: "chrome.shareView.forms.status.limitReached",
|
|
1052
|
+
trip_cancelled: "chrome.shareView.forms.status.tripCancelled"
|
|
1053
|
+
};
|
|
1054
|
+
function statusLabel(form, t) {
|
|
1055
|
+
if (form.responseStatus === "IN_PROGRESS") {
|
|
1056
|
+
return t("chrome.shareView.forms.status.inProgress");
|
|
1057
|
+
}
|
|
1058
|
+
if (form.responseStatus === "SUBMITTED") {
|
|
1059
|
+
return t("chrome.shareView.forms.status.submitted");
|
|
1060
|
+
}
|
|
1061
|
+
const key = FILL_STATE_KEY[form.fillState];
|
|
1062
|
+
return key !== void 0 ? t(key) : form.fillState;
|
|
1063
|
+
}
|
|
1064
|
+
function isPendingRequired(form) {
|
|
1065
|
+
return form.required && form.fillState === "ok" && form.responseStatus === null;
|
|
1066
|
+
}
|
|
1067
|
+
function FormsSection({ token, travellerRef }) {
|
|
1068
|
+
const engine = useContext(OfflineEngineContext);
|
|
1069
|
+
if (engine === null) {
|
|
1070
|
+
return null;
|
|
1071
|
+
}
|
|
1072
|
+
return /* @__PURE__ */ jsx(ReadyFormsSection, { token, travellerRef });
|
|
1073
|
+
}
|
|
1074
|
+
function ReadyFormsSection({ token, travellerRef }) {
|
|
1075
|
+
const { t } = useKaafilChrome();
|
|
1076
|
+
const { status, forms, renderForm, save, submit, writeStatus, refresh } = useShareForms(token);
|
|
1077
|
+
const [openFormId, setOpenFormId] = useState(null);
|
|
1078
|
+
const [openForm, setOpenForm] = useState(null);
|
|
1079
|
+
const autoOpenedRef = useRef(false);
|
|
1080
|
+
useEffect(() => {
|
|
1081
|
+
if (autoOpenedRef.current || status !== "list-populated") {
|
|
1082
|
+
return;
|
|
1083
|
+
}
|
|
1084
|
+
autoOpenedRef.current = true;
|
|
1085
|
+
const pending = forms.find(isPendingRequired);
|
|
1086
|
+
if (pending !== void 0) {
|
|
1087
|
+
setOpenFormId(pending.formId);
|
|
1088
|
+
}
|
|
1089
|
+
}, [status, forms]);
|
|
1090
|
+
useEffect(() => {
|
|
1091
|
+
if (openFormId === null) {
|
|
1092
|
+
setOpenForm(null);
|
|
1093
|
+
return;
|
|
1094
|
+
}
|
|
1095
|
+
let cancelled = false;
|
|
1096
|
+
void renderForm(openFormId, { travellerRef }).then((response) => {
|
|
1097
|
+
if (!cancelled) {
|
|
1098
|
+
setOpenForm(response);
|
|
1099
|
+
}
|
|
1100
|
+
});
|
|
1101
|
+
return () => {
|
|
1102
|
+
cancelled = true;
|
|
1103
|
+
};
|
|
1104
|
+
}, [openFormId, renderForm, travellerRef]);
|
|
1105
|
+
useEffect(() => {
|
|
1106
|
+
if (writeStatus === "submitted") {
|
|
1107
|
+
void refresh();
|
|
1108
|
+
}
|
|
1109
|
+
}, [writeStatus, refresh]);
|
|
1110
|
+
if (status === "loading") {
|
|
1111
|
+
return null;
|
|
1112
|
+
}
|
|
1113
|
+
if (status === "not-found" || status === "list-empty") {
|
|
1114
|
+
return null;
|
|
1115
|
+
}
|
|
1116
|
+
return /* @__PURE__ */ jsxs("section", { "aria-label": t("chrome.shareView.forms.eyebrow"), children: [
|
|
1117
|
+
/* @__PURE__ */ jsx("div", { className: "kf-share-view__eyebrow-row", children: /* @__PURE__ */ jsx("span", { className: "kf-eyebrow", children: t("chrome.shareView.forms.eyebrow") }) }),
|
|
1118
|
+
/* @__PURE__ */ jsx("ul", { className: "kf-share-view__card kf-share-view__list", children: forms.map((form) => /* @__PURE__ */ jsx("li", { className: "kf-share-view__row kf-share-view__form-row", children: /* @__PURE__ */ jsxs(
|
|
1119
|
+
"button",
|
|
1120
|
+
{
|
|
1121
|
+
type: "button",
|
|
1122
|
+
className: "kf-share-view__form-row-button kf-press",
|
|
1123
|
+
onClick: () => setOpenFormId(form.formId),
|
|
1124
|
+
children: [
|
|
1125
|
+
/* @__PURE__ */ jsx("span", { className: "kf-share-view__form-row-title", children: form.title }),
|
|
1126
|
+
/* @__PURE__ */ jsxs("span", { className: "kf-share-view__form-row-end", children: [
|
|
1127
|
+
/* @__PURE__ */ jsxs("span", { className: "kf-share-view__form-row-meta kf-eyebrow", children: [
|
|
1128
|
+
statusLabel(form, t),
|
|
1129
|
+
form.required ? ` \xB7 ${t("chrome.shareView.forms.required")}` : ""
|
|
1130
|
+
] }),
|
|
1131
|
+
/* @__PURE__ */ jsx("span", { className: "kf-share-view__form-row-chevron", "aria-hidden": "true" })
|
|
1132
|
+
] })
|
|
1133
|
+
]
|
|
1134
|
+
}
|
|
1135
|
+
) }, form.formId)) }),
|
|
1136
|
+
openForm !== null ? (
|
|
1137
|
+
// A popup, not an inline replacement of this section's own content
|
|
1138
|
+
// (user feedback: opening a form used to swap the whole "Forms"
|
|
1139
|
+
// section's body in place) — same backdrop/sheet dialog pattern as
|
|
1140
|
+
// `HouseholdSheet`.
|
|
1141
|
+
/* @__PURE__ */ jsx("div", { className: "kf-share-view__sheet-backdrop", children: /* @__PURE__ */ jsxs(
|
|
1142
|
+
"div",
|
|
1143
|
+
{
|
|
1144
|
+
className: "kf-share-view__sheet",
|
|
1145
|
+
role: "dialog",
|
|
1146
|
+
"aria-modal": "true",
|
|
1147
|
+
"aria-label": openForm.title,
|
|
1148
|
+
children: [
|
|
1149
|
+
/* @__PURE__ */ jsxs("div", { className: "kf-share-view__sheet-header", children: [
|
|
1150
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1151
|
+
/* @__PURE__ */ jsx("p", { className: "kf-eyebrow", children: t("chrome.shareView.forms.dialogEyebrow") }),
|
|
1152
|
+
/* @__PURE__ */ jsx("p", { className: "kf-share-view__sheet-title", children: openForm.title })
|
|
1153
|
+
] }),
|
|
1154
|
+
/* @__PURE__ */ jsx(
|
|
1155
|
+
"button",
|
|
1156
|
+
{
|
|
1157
|
+
type: "button",
|
|
1158
|
+
className: "kf-share-view__sheet-close kf-press",
|
|
1159
|
+
onClick: () => setOpenFormId(null),
|
|
1160
|
+
"aria-label": t("chrome.shareView.close"),
|
|
1161
|
+
children: "\u2715"
|
|
1162
|
+
}
|
|
1163
|
+
)
|
|
1164
|
+
] }),
|
|
1165
|
+
/* @__PURE__ */ jsx("div", { className: "kf-share-view__sheet-body", children: /* @__PURE__ */ jsx(
|
|
1166
|
+
FormFillScreen,
|
|
1167
|
+
{
|
|
1168
|
+
form: openForm,
|
|
1169
|
+
save,
|
|
1170
|
+
submit,
|
|
1171
|
+
writeStatus,
|
|
1172
|
+
travellerRef
|
|
1173
|
+
}
|
|
1174
|
+
) })
|
|
1175
|
+
]
|
|
1176
|
+
}
|
|
1177
|
+
) })
|
|
1178
|
+
) : null
|
|
1179
|
+
] });
|
|
1180
|
+
}
|
|
1181
|
+
var PHASE_MODIFIER = {
|
|
1182
|
+
PRE_DEPARTURE: "pre-departure",
|
|
1183
|
+
ON_TRIP: "on-trip",
|
|
1184
|
+
POST_TRIP: "post-trip"
|
|
1185
|
+
};
|
|
1186
|
+
function HeroSection({
|
|
1187
|
+
tripName,
|
|
1188
|
+
status,
|
|
1189
|
+
travellers,
|
|
1190
|
+
onOpenHousehold
|
|
1191
|
+
}) {
|
|
1192
|
+
const { t } = useKaafilChrome();
|
|
1193
|
+
return /* @__PURE__ */ jsxs("section", { className: "kf-share-view__hero", "aria-label": t("chrome.shareView.trip.ariaLabel"), children: [
|
|
1194
|
+
/* @__PURE__ */ jsx("p", { className: "kf-share-view__hero-code kf-eyebrow", children: tripName }),
|
|
1195
|
+
/* @__PURE__ */ jsx(
|
|
1196
|
+
"span",
|
|
1197
|
+
{
|
|
1198
|
+
className: `kf-share-view__hero-pill kf-share-view__hero-pill--${PHASE_MODIFIER[status.phase]}`,
|
|
1199
|
+
children: status.phaseLabel
|
|
1200
|
+
}
|
|
1201
|
+
),
|
|
1202
|
+
/* @__PURE__ */ jsx("p", { className: "kf-share-view__hero-headline", children: status.dayLabel }),
|
|
1203
|
+
/* @__PURE__ */ jsx(
|
|
1204
|
+
"div",
|
|
1205
|
+
{
|
|
1206
|
+
className: "kf-share-view__hero-progress",
|
|
1207
|
+
role: "progressbar",
|
|
1208
|
+
"aria-valuenow": status.progressPercent,
|
|
1209
|
+
"aria-valuemin": 0,
|
|
1210
|
+
"aria-valuemax": 100,
|
|
1211
|
+
"aria-label": t("chrome.shareView.trip.progressAriaLabel"),
|
|
1212
|
+
children: /* @__PURE__ */ jsx(
|
|
1213
|
+
"div",
|
|
1214
|
+
{
|
|
1215
|
+
className: "kf-share-view__hero-progress-fill",
|
|
1216
|
+
style: { inlineSize: `${String(status.progressPercent)}%` }
|
|
1217
|
+
}
|
|
1218
|
+
)
|
|
1219
|
+
}
|
|
1220
|
+
),
|
|
1221
|
+
/* @__PURE__ */ jsxs("div", { className: "kf-share-view__hero-meta", children: [
|
|
1222
|
+
/* @__PURE__ */ jsx("span", { className: "kf-eyebrow", children: status.dateRangeLabel }),
|
|
1223
|
+
status.daysLeftLabel !== null ? /* @__PURE__ */ jsx("span", { className: "kf-eyebrow", children: status.daysLeftLabel }) : null
|
|
1224
|
+
] }),
|
|
1225
|
+
travellers.length > 0 ? /* @__PURE__ */ jsxs(
|
|
1226
|
+
"button",
|
|
1227
|
+
{
|
|
1228
|
+
type: "button",
|
|
1229
|
+
className: "kf-share-view__hero-travellers kf-press",
|
|
1230
|
+
onClick: onOpenHousehold,
|
|
1231
|
+
disabled: onOpenHousehold === void 0,
|
|
1232
|
+
children: [
|
|
1233
|
+
/* @__PURE__ */ jsx("ul", { className: "kf-share-view__household-avatars", "aria-hidden": "true", children: travellers.map((traveller, index) => /* @__PURE__ */ jsx(
|
|
1234
|
+
"li",
|
|
1235
|
+
{
|
|
1236
|
+
className: "kf-share-view__household-avatar kf-share-view__household-avatar--on-dark",
|
|
1237
|
+
children: traveller.initials
|
|
1238
|
+
},
|
|
1239
|
+
`${traveller.firstName}-${String(index)}`
|
|
1240
|
+
)) }),
|
|
1241
|
+
/* @__PURE__ */ jsx("span", { className: "kf-share-view__hero-travellers-names", children: travellers.map((traveller) => traveller.firstName).join(" & ") })
|
|
1242
|
+
]
|
|
1243
|
+
}
|
|
1244
|
+
) : null
|
|
1245
|
+
] });
|
|
1246
|
+
}
|
|
1247
|
+
function HouseholdBanner({ label, names }) {
|
|
1248
|
+
const { t } = useKaafilChrome();
|
|
1249
|
+
if (names.length === 0 && label === null) {
|
|
1250
|
+
return null;
|
|
1251
|
+
}
|
|
1252
|
+
return /* @__PURE__ */ jsxs(
|
|
1253
|
+
"section",
|
|
1254
|
+
{
|
|
1255
|
+
className: "kf-share-view__household",
|
|
1256
|
+
"aria-label": t("chrome.shareView.household.ariaLabelFallback"),
|
|
1257
|
+
children: [
|
|
1258
|
+
names.length > 0 ? /* @__PURE__ */ jsxs("p", { className: "kf-share-view__household-greeting", children: [
|
|
1259
|
+
t("chrome.shareView.household.greeting"),
|
|
1260
|
+
" ",
|
|
1261
|
+
/* @__PURE__ */ jsx("span", { className: "kf-share-view__household-name", children: names }),
|
|
1262
|
+
","
|
|
1263
|
+
] }) : null,
|
|
1264
|
+
label !== null ? /* @__PURE__ */ jsx("p", { className: "kf-share-view__household-label", children: label }) : null
|
|
1265
|
+
]
|
|
1266
|
+
}
|
|
1267
|
+
);
|
|
1268
|
+
}
|
|
1269
|
+
function ItineraryDayStrip({
|
|
1270
|
+
itinerary,
|
|
1271
|
+
timezone,
|
|
1272
|
+
selectedIndex,
|
|
1273
|
+
onSelectIndex
|
|
1274
|
+
}) {
|
|
1275
|
+
const { t } = useKaafilChrome();
|
|
1276
|
+
const todayIndex = itinerary.days.findIndex((day) => day.isToday);
|
|
1277
|
+
const selectedDay = itinerary.days[selectedIndex] ?? itinerary.days[0];
|
|
1278
|
+
if (itinerary.days.length === 0 || selectedDay === void 0) {
|
|
1279
|
+
return null;
|
|
1280
|
+
}
|
|
1281
|
+
return /* @__PURE__ */ jsxs("section", { "aria-label": t("chrome.shareView.itinerary.ariaLabel"), children: [
|
|
1282
|
+
/* @__PURE__ */ jsx("div", { className: "kf-share-view__eyebrow-row", children: /* @__PURE__ */ jsx("span", { className: "kf-eyebrow", children: t("chrome.shareView.itinerary.eyebrow") }) }),
|
|
1283
|
+
/* @__PURE__ */ jsx(
|
|
1284
|
+
"div",
|
|
1285
|
+
{
|
|
1286
|
+
className: "kf-share-view__day-strip",
|
|
1287
|
+
role: "tablist",
|
|
1288
|
+
"aria-label": t("chrome.shareView.itinerary.tripDaysAriaLabel"),
|
|
1289
|
+
children: itinerary.days.map((day, index) => {
|
|
1290
|
+
const isSelected = index === selectedIndex;
|
|
1291
|
+
const isPast = index < todayIndex;
|
|
1292
|
+
return /* @__PURE__ */ jsxs(
|
|
1293
|
+
"button",
|
|
1294
|
+
{
|
|
1295
|
+
type: "button",
|
|
1296
|
+
role: "tab",
|
|
1297
|
+
"aria-selected": isSelected,
|
|
1298
|
+
className: `kf-share-view__day-chip kf-press ${isSelected ? "kf-share-view__day-chip--selected" : isPast ? "kf-share-view__day-chip--past" : ""}`,
|
|
1299
|
+
onClick: () => onSelectIndex(index),
|
|
1300
|
+
children: [
|
|
1301
|
+
/* @__PURE__ */ jsx("span", { className: "kf-share-view__day-chip-number", children: day.dayIndex + 1 }),
|
|
1302
|
+
/* @__PURE__ */ jsx("span", { className: "kf-share-view__day-chip-label kf-eyebrow", children: formatWeekdayDay(day.isoDate, timezone) }),
|
|
1303
|
+
isSelected ? /* @__PURE__ */ jsx("span", { className: "kf-share-view__day-chip-dot", "aria-hidden": "true" }) : null
|
|
1304
|
+
]
|
|
1305
|
+
},
|
|
1306
|
+
day.dayIndex
|
|
1307
|
+
);
|
|
1308
|
+
})
|
|
1309
|
+
}
|
|
1310
|
+
),
|
|
1311
|
+
/* @__PURE__ */ jsxs("div", { className: "kf-share-view__card kf-share-view__day-detail", children: [
|
|
1312
|
+
/* @__PURE__ */ jsxs("div", { className: "kf-share-view__day-detail-header", children: [
|
|
1313
|
+
/* @__PURE__ */ jsxs("p", { className: "kf-share-view__day-detail-eyebrow kf-eyebrow", children: [
|
|
1314
|
+
t("chrome.shareView.dayLabel").replace("{n}", String(selectedDay.dayIndex + 1)),
|
|
1315
|
+
" \xB7",
|
|
1316
|
+
" ",
|
|
1317
|
+
formatWeekdayDay(selectedDay.isoDate, timezone)
|
|
1318
|
+
] }),
|
|
1319
|
+
/* @__PURE__ */ jsx("p", { className: "kf-share-view__day-detail-title", children: selectedDay.cardTitle }),
|
|
1320
|
+
selectedDay.summaryLine !== null ? /* @__PURE__ */ jsx("p", { className: "kf-share-view__day-detail-summary", children: selectedDay.summaryLine }) : null
|
|
1321
|
+
] }),
|
|
1322
|
+
selectedDay.items.length > 0 ? /* @__PURE__ */ jsx("ul", { className: "kf-share-view__list kf-share-view__day-detail-items", children: selectedDay.items.map((item) => /* @__PURE__ */ jsxs(
|
|
1323
|
+
"li",
|
|
1324
|
+
{
|
|
1325
|
+
className: `kf-share-view__row kf-share-view__plan-row kf-share-view__plan-row--${item.timeState}`,
|
|
1326
|
+
children: [
|
|
1327
|
+
/* @__PURE__ */ jsx("span", { className: "kf-share-view__plan-time kf-num", children: item.timeState === "now" ? t("chrome.shareView.plan.now") : item.startTime !== null ? formatTimeOfDay(item.startTime, timezone) : "" }),
|
|
1328
|
+
/* @__PURE__ */ jsx("span", { className: "kf-share-view__plan-title", children: item.title })
|
|
1329
|
+
]
|
|
1330
|
+
},
|
|
1331
|
+
item.id
|
|
1332
|
+
)) }) : null
|
|
1333
|
+
] })
|
|
1334
|
+
] });
|
|
1335
|
+
}
|
|
1336
|
+
function ManagerContactSection({ data }) {
|
|
1337
|
+
const { t } = useKaafilChrome();
|
|
1338
|
+
return /* @__PURE__ */ jsxs("section", { "aria-label": t("chrome.shareView.manager.eyebrow"), children: [
|
|
1339
|
+
/* @__PURE__ */ jsxs("div", { className: "kf-share-view__eyebrow-row", children: [
|
|
1340
|
+
/* @__PURE__ */ jsx("span", { className: "kf-eyebrow", children: t("chrome.shareView.manager.eyebrow") }),
|
|
1341
|
+
/* @__PURE__ */ jsx("span", { className: "kf-eyebrow", children: t("chrome.shareView.manager.available") })
|
|
1342
|
+
] }),
|
|
1343
|
+
/* @__PURE__ */ jsx(
|
|
1344
|
+
ContactCard,
|
|
1345
|
+
{
|
|
1346
|
+
row: data,
|
|
1347
|
+
roleLabel: t("chrome.shareView.manager.roleLabel"),
|
|
1348
|
+
footer: data.coManagers?.map((coManager) => /* @__PURE__ */ jsxs("div", { className: "kf-share-view__contact-footer", children: [
|
|
1349
|
+
/* @__PURE__ */ jsx("span", { className: "kf-share-view__contact-footer-label kf-eyebrow", children: t("chrome.shareView.manager.coManagerLabel").replace("{name}", coManager.name) }),
|
|
1350
|
+
coManager.phoneDisplay !== null ? coManager.phoneHref !== null ? /* @__PURE__ */ jsx(
|
|
1351
|
+
"a",
|
|
1352
|
+
{
|
|
1353
|
+
href: coManager.phoneHref,
|
|
1354
|
+
className: "kf-share-view__contact-footer-phone kf-num",
|
|
1355
|
+
children: coManager.phoneDisplay
|
|
1356
|
+
}
|
|
1357
|
+
) : /* @__PURE__ */ jsx("span", { className: "kf-share-view__contact-footer-phone kf-num", children: coManager.phoneDisplay }) : null
|
|
1358
|
+
] }, coManager.name))
|
|
1359
|
+
}
|
|
1360
|
+
)
|
|
1361
|
+
] });
|
|
1362
|
+
}
|
|
1363
|
+
function formatMinor(minor, currency) {
|
|
1364
|
+
return new Intl.NumberFormat(void 0, { style: "currency", currency }).format(minor / 100);
|
|
1365
|
+
}
|
|
1366
|
+
function MoneySection({ data }) {
|
|
1367
|
+
const { t } = useKaafilChrome();
|
|
1368
|
+
return /* @__PURE__ */ jsxs("section", { "aria-label": t("chrome.shareView.money.eyebrow"), children: [
|
|
1369
|
+
/* @__PURE__ */ jsx("div", { className: "kf-share-view__eyebrow-row", children: /* @__PURE__ */ jsx("span", { className: "kf-eyebrow", children: t("chrome.shareView.money.eyebrow") }) }),
|
|
1370
|
+
/* @__PURE__ */ jsxs("dl", { className: "kf-share-view__card kf-share-view__money", children: [
|
|
1371
|
+
/* @__PURE__ */ jsxs("div", { className: "kf-share-view__money-row", children: [
|
|
1372
|
+
/* @__PURE__ */ jsx("dt", { children: t("chrome.shareView.money.total") }),
|
|
1373
|
+
/* @__PURE__ */ jsx("dd", { className: "kf-num", children: formatMinor(data.totalMinor, data.currency) })
|
|
1374
|
+
] }),
|
|
1375
|
+
/* @__PURE__ */ jsxs("div", { className: "kf-share-view__money-row", children: [
|
|
1376
|
+
/* @__PURE__ */ jsx("dt", { children: t("chrome.shareView.money.collected") }),
|
|
1377
|
+
/* @__PURE__ */ jsx("dd", { className: "kf-num", children: formatMinor(data.collectedMinor, data.currency) })
|
|
1378
|
+
] }),
|
|
1379
|
+
/* @__PURE__ */ jsxs("div", { className: "kf-share-view__money-row kf-share-view__money-row--due", children: [
|
|
1380
|
+
/* @__PURE__ */ jsx("dt", { children: t("chrome.shareView.money.due") }),
|
|
1381
|
+
/* @__PURE__ */ jsx("dd", { className: "kf-num", children: formatMinor(data.dueMinor, data.currency) })
|
|
1382
|
+
] })
|
|
1383
|
+
] })
|
|
1384
|
+
] });
|
|
1385
|
+
}
|
|
1386
|
+
var ITEM_TYPE_ICON = createRegistry({
|
|
1387
|
+
fallback: () => /* @__PURE__ */ jsx(CompassIcon, {})
|
|
1388
|
+
});
|
|
1389
|
+
ITEM_TYPE_ICON.register("FLIGHT", () => /* @__PURE__ */ jsx(PlaneIcon, {}));
|
|
1390
|
+
ITEM_TYPE_ICON.register("TRANSPORT", () => /* @__PURE__ */ jsx(CarIcon, {}));
|
|
1391
|
+
ITEM_TYPE_ICON.register("ACCOMMODATION", () => /* @__PURE__ */ jsx(HouseIcon, {}));
|
|
1392
|
+
ITEM_TYPE_ICON.register("STAY", () => /* @__PURE__ */ jsx(HouseIcon, {}));
|
|
1393
|
+
function pickNextItem(itinerary) {
|
|
1394
|
+
const todayIndex = itinerary.days.findIndex((day) => day.isToday);
|
|
1395
|
+
if (todayIndex !== -1) {
|
|
1396
|
+
const today = itinerary.days[todayIndex];
|
|
1397
|
+
if (today !== void 0) {
|
|
1398
|
+
const nowItem = today.items.find((item) => item.timeState === "now");
|
|
1399
|
+
if (nowItem !== void 0) {
|
|
1400
|
+
return nowItem;
|
|
1401
|
+
}
|
|
1402
|
+
const upcomingItem = today.items.find((item) => item.timeState === "upcoming");
|
|
1403
|
+
if (upcomingItem !== void 0) {
|
|
1404
|
+
return upcomingItem;
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
for (let index = todayIndex + 1; index < itinerary.days.length; index += 1) {
|
|
1408
|
+
const day = itinerary.days[index];
|
|
1409
|
+
const firstItem = day?.items[0];
|
|
1410
|
+
if (firstItem !== void 0) {
|
|
1411
|
+
return firstItem;
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
return void 0;
|
|
1415
|
+
}
|
|
1416
|
+
for (const day of itinerary.days) {
|
|
1417
|
+
const firstItem = day.items[0];
|
|
1418
|
+
if (firstItem !== void 0) {
|
|
1419
|
+
return firstItem;
|
|
1420
|
+
}
|
|
1421
|
+
}
|
|
1422
|
+
return void 0;
|
|
1423
|
+
}
|
|
1424
|
+
function NextUpBanner({ itinerary, timezone }) {
|
|
1425
|
+
const { t } = useKaafilChrome();
|
|
1426
|
+
const item = pickNextItem(itinerary);
|
|
1427
|
+
if (item === void 0) {
|
|
1428
|
+
return null;
|
|
1429
|
+
}
|
|
1430
|
+
return /* @__PURE__ */ jsxs("section", { className: "kf-share-view__next-up", "aria-label": t("chrome.shareView.nextUp.ariaLabel"), children: [
|
|
1431
|
+
/* @__PURE__ */ jsx("div", { className: "kf-share-view__next-up-icon", "aria-hidden": "true", children: ITEM_TYPE_ICON.resolve(item.type)() }),
|
|
1432
|
+
/* @__PURE__ */ jsxs("div", { className: "kf-share-view__next-up-body", children: [
|
|
1433
|
+
/* @__PURE__ */ jsx("p", { className: "kf-share-view__next-up-title", children: item.title }),
|
|
1434
|
+
item.startTime !== null ? /* @__PURE__ */ jsx("p", { className: "kf-share-view__next-up-time kf-num", children: formatTimeOfDay(item.startTime, timezone) }) : null
|
|
1435
|
+
] })
|
|
1436
|
+
] });
|
|
1437
|
+
}
|
|
1438
|
+
function deriveBookingState(startAt, endAt, serverTime) {
|
|
1439
|
+
if (serverTime === void 0) {
|
|
1440
|
+
return null;
|
|
1441
|
+
}
|
|
1442
|
+
const now = new Date(serverTime).getTime();
|
|
1443
|
+
const start = new Date(startAt).getTime();
|
|
1444
|
+
const end = endAt !== null ? new Date(endAt).getTime() : start;
|
|
1445
|
+
if (now < start) {
|
|
1446
|
+
return "upcoming";
|
|
1447
|
+
}
|
|
1448
|
+
if (now > end) {
|
|
1449
|
+
return "done";
|
|
1450
|
+
}
|
|
1451
|
+
return "now";
|
|
1452
|
+
}
|
|
1453
|
+
var STATE_LABEL_KEY = {
|
|
1454
|
+
done: "chrome.shareView.stay.state.done",
|
|
1455
|
+
now: "chrome.shareView.plan.now",
|
|
1456
|
+
upcoming: "chrome.shareView.stay.state.upcoming"
|
|
1457
|
+
};
|
|
1458
|
+
function dayLabel(t, n) {
|
|
1459
|
+
return t("chrome.shareView.dayLabel").replace("{n}", String(n));
|
|
1460
|
+
}
|
|
1461
|
+
var ROW_ICON = createRegistry({ fallback: () => /* @__PURE__ */ jsx(CompassIcon, {}) });
|
|
1462
|
+
ROW_ICON.register("transport", () => /* @__PURE__ */ jsx(CarIcon, {}));
|
|
1463
|
+
ROW_ICON.register("stay", () => /* @__PURE__ */ jsx(HouseIcon, {}));
|
|
1464
|
+
ROW_ICON.register("activity", () => /* @__PURE__ */ jsx(CompassIcon, {}));
|
|
1465
|
+
ROW_ICON.register("rooming", () => /* @__PURE__ */ jsx(BedIcon, {}));
|
|
1466
|
+
ROW_ICON.register("pickup", () => /* @__PURE__ */ jsx(PinIcon, {}));
|
|
1467
|
+
ROW_ICON.register("vehicle", () => /* @__PURE__ */ jsx(CarIcon, {}));
|
|
1468
|
+
function mergeDayBookings(section, kind, typeLabel, timezone, serverTime, t) {
|
|
1469
|
+
if (section === void 0) {
|
|
1470
|
+
return [];
|
|
1471
|
+
}
|
|
1472
|
+
const rows = [];
|
|
1473
|
+
for (const day of section.days) {
|
|
1474
|
+
for (const item of day.items) {
|
|
1475
|
+
const whenLabel = item.endAt !== null ? `${formatDayMonth(item.startAt, timezone)} \u2192 ${formatDayMonth(item.endAt, timezone)}` : formatDayMonth(item.startAt, timezone);
|
|
1476
|
+
const state = deriveBookingState(item.startAt, item.endAt, serverTime);
|
|
1477
|
+
const eyebrow = `${typeLabel} \xB7 ${dayLabel(t, item.dayIndex + 1)}${state !== null ? ` \xB7 ${t(STATE_LABEL_KEY[state])}` : ""}`;
|
|
1478
|
+
rows.push({
|
|
1479
|
+
key: item.bookingId,
|
|
1480
|
+
sortKey: item.dayIndex,
|
|
1481
|
+
dayEnd: item.dayIndex,
|
|
1482
|
+
kind,
|
|
1483
|
+
eyebrow,
|
|
1484
|
+
title: item.title,
|
|
1485
|
+
whenLabel: t("chrome.shareView.stay.when").replace("{when}", whenLabel),
|
|
1486
|
+
locationText: item.locationText
|
|
1487
|
+
});
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1490
|
+
return rows;
|
|
1491
|
+
}
|
|
1492
|
+
function dayRangeLabel(assignment, t) {
|
|
1493
|
+
return assignment.startDayIndex === assignment.endDayIndex ? dayLabel(t, assignment.startDayIndex + 1) : t("chrome.shareView.dayRangeLabel").replace("{start}", String(assignment.startDayIndex + 1)).replace("{end}", String(assignment.endDayIndex + 1));
|
|
1494
|
+
}
|
|
1495
|
+
function mergeRooming(section, t) {
|
|
1496
|
+
if (section === void 0) {
|
|
1497
|
+
return [];
|
|
1498
|
+
}
|
|
1499
|
+
return section.assignments.map((assignment) => {
|
|
1500
|
+
const roomLabel = t("chrome.shareView.stay.room").replace("{room}", assignment.room);
|
|
1501
|
+
const roomBed = assignment.bed !== null ? t("chrome.shareView.stay.roomBed").replace("{room}", assignment.room).replace("{bed}", assignment.bed) : roomLabel;
|
|
1502
|
+
return {
|
|
1503
|
+
key: assignment.stayWindowId,
|
|
1504
|
+
sortKey: assignment.startDayIndex,
|
|
1505
|
+
dayEnd: assignment.endDayIndex,
|
|
1506
|
+
kind: "rooming",
|
|
1507
|
+
eyebrow: `${t("chrome.shareView.stay.rooming")} \xB7 ${dayRangeLabel(assignment, t)}`,
|
|
1508
|
+
title: assignment.label !== "" ? assignment.label : roomLabel,
|
|
1509
|
+
whenLabel: roomBed,
|
|
1510
|
+
locationText: assignment.roommates.length > 0 ? t("chrome.shareView.stay.with").replace("{names}", assignment.roommates.join(", ")) : null
|
|
1511
|
+
};
|
|
1512
|
+
});
|
|
1513
|
+
}
|
|
1514
|
+
var PICKUP_KIND_LABEL_KEY = {
|
|
1515
|
+
PICKUP: "chrome.shareView.stay.pickup.kind.pickup",
|
|
1516
|
+
DROP: "chrome.shareView.stay.pickup.kind.drop"
|
|
1517
|
+
};
|
|
1518
|
+
var PICKUP_STATUS_LABEL_KEY = {
|
|
1519
|
+
PENDING: "chrome.shareView.stay.pickup.status.pending",
|
|
1520
|
+
BOARDED: "chrome.shareView.stay.pickup.status.boarded",
|
|
1521
|
+
NO_SHOW: "chrome.shareView.stay.pickup.status.noShow"
|
|
1522
|
+
};
|
|
1523
|
+
function pickupRow(stop, index, timezone, t) {
|
|
1524
|
+
const kindLabel = PICKUP_KIND_LABEL_KEY[stop.kind];
|
|
1525
|
+
const statusLabel2 = PICKUP_STATUS_LABEL_KEY[stop.status];
|
|
1526
|
+
return {
|
|
1527
|
+
key: `pickup-${String(index)}`,
|
|
1528
|
+
sortKey: Number.POSITIVE_INFINITY,
|
|
1529
|
+
dayEnd: Number.POSITIVE_INFINITY,
|
|
1530
|
+
kind: "pickup",
|
|
1531
|
+
eyebrow: `${kindLabel !== void 0 ? t(kindLabel) : stop.kind} \xB7 ${statusLabel2 !== void 0 ? t(statusLabel2) : stop.status}`,
|
|
1532
|
+
title: stop.point,
|
|
1533
|
+
whenLabel: formatTimeOfDay(stop.time, timezone),
|
|
1534
|
+
locationText: stop.locationLabel
|
|
1535
|
+
};
|
|
1536
|
+
}
|
|
1537
|
+
function StayAndTransportSection({
|
|
1538
|
+
accommodation,
|
|
1539
|
+
transport,
|
|
1540
|
+
activities,
|
|
1541
|
+
rooming,
|
|
1542
|
+
seating,
|
|
1543
|
+
pickup,
|
|
1544
|
+
timezone,
|
|
1545
|
+
selectedDayIndex,
|
|
1546
|
+
serverTime
|
|
1547
|
+
}) {
|
|
1548
|
+
const { t } = useKaafilChrome();
|
|
1549
|
+
const allDayRows = [
|
|
1550
|
+
...mergeDayBookings(
|
|
1551
|
+
transport,
|
|
1552
|
+
"transport",
|
|
1553
|
+
t("chrome.shareView.stay.typeLabel.transport"),
|
|
1554
|
+
timezone,
|
|
1555
|
+
serverTime,
|
|
1556
|
+
t
|
|
1557
|
+
),
|
|
1558
|
+
...mergeDayBookings(
|
|
1559
|
+
accommodation,
|
|
1560
|
+
"stay",
|
|
1561
|
+
t("chrome.shareView.stay.typeLabel.stay"),
|
|
1562
|
+
timezone,
|
|
1563
|
+
serverTime,
|
|
1564
|
+
t
|
|
1565
|
+
),
|
|
1566
|
+
...mergeDayBookings(
|
|
1567
|
+
activities,
|
|
1568
|
+
"activity",
|
|
1569
|
+
t("chrome.shareView.stay.typeLabel.activity"),
|
|
1570
|
+
timezone,
|
|
1571
|
+
serverTime,
|
|
1572
|
+
t
|
|
1573
|
+
),
|
|
1574
|
+
...mergeRooming(rooming, t)
|
|
1575
|
+
].sort((a, b) => a.sortKey - b.sortKey || a.key.localeCompare(b.key));
|
|
1576
|
+
const dayRows = selectedDayIndex === void 0 ? allDayRows : allDayRows.filter(
|
|
1577
|
+
(row) => row.sortKey <= selectedDayIndex && selectedDayIndex <= row.dayEnd
|
|
1578
|
+
);
|
|
1579
|
+
const rows = [
|
|
1580
|
+
...dayRows,
|
|
1581
|
+
...pickup?.stops.map((stop, index) => pickupRow(stop, index, timezone, t)) ?? []
|
|
1582
|
+
];
|
|
1583
|
+
const hasVehicle = seating !== void 0;
|
|
1584
|
+
if (rows.length === 0 && !hasVehicle) {
|
|
1585
|
+
return null;
|
|
1586
|
+
}
|
|
1587
|
+
return /* @__PURE__ */ jsxs("section", { "aria-label": t("chrome.shareView.stay.eyebrow"), children: [
|
|
1588
|
+
/* @__PURE__ */ jsxs("div", { className: "kf-share-view__eyebrow-row", children: [
|
|
1589
|
+
/* @__PURE__ */ jsx("span", { className: "kf-eyebrow", children: t("chrome.shareView.stay.eyebrow") }),
|
|
1590
|
+
selectedDayIndex !== void 0 ? /* @__PURE__ */ jsx("span", { className: "kf-eyebrow", children: dayLabel(t, selectedDayIndex + 1) }) : null
|
|
1591
|
+
] }),
|
|
1592
|
+
/* @__PURE__ */ jsxs("ul", { className: "kf-share-view__card kf-share-view__list", children: [
|
|
1593
|
+
hasVehicle && seating !== void 0 ? /* @__PURE__ */ jsxs("li", { className: "kf-share-view__row kf-share-view__booking-row", children: [
|
|
1594
|
+
/* @__PURE__ */ jsx("div", { className: "kf-share-view__booking-icon", "aria-hidden": "true", children: ROW_ICON.resolve("vehicle")() }),
|
|
1595
|
+
/* @__PURE__ */ jsxs("div", { className: "kf-share-view__booking-body", children: [
|
|
1596
|
+
/* @__PURE__ */ jsx("p", { className: "kf-share-view__booking-eyebrow kf-eyebrow", children: t("chrome.shareView.stay.vehicle") }),
|
|
1597
|
+
/* @__PURE__ */ jsx("p", { className: "kf-share-view__booking-title", children: seating.vehicle.regNo }),
|
|
1598
|
+
/* @__PURE__ */ jsxs("p", { className: "kf-share-view__booking-when", children: [
|
|
1599
|
+
seating.vehicle.label,
|
|
1600
|
+
" \xB7 ",
|
|
1601
|
+
seating.vehicle.regNo
|
|
1602
|
+
] }),
|
|
1603
|
+
/* @__PURE__ */ jsx("p", { className: "kf-share-view__booking-when", children: t("chrome.shareView.stay.capacity").replace(
|
|
1604
|
+
"{n}",
|
|
1605
|
+
String(seating.vehicle.capacity)
|
|
1606
|
+
) }),
|
|
1607
|
+
seating.vehicle.driver !== null ? /* @__PURE__ */ jsx("p", { className: "kf-share-view__booking-when", children: t("chrome.shareView.stay.driver").replace("{name}", seating.vehicle.driver.name) }) : null,
|
|
1608
|
+
seating.seat !== null && seating.seat !== void 0 || seating.vehicle.driver !== null && seating.vehicle.driver.phoneHref !== null ? /* @__PURE__ */ jsxs("div", { className: "kf-share-view__booking-assignment", children: [
|
|
1609
|
+
seating.seat !== null && seating.seat !== void 0 ? /* @__PURE__ */ jsx("p", { className: "kf-share-view__booking-when", children: t("chrome.shareView.stay.yourSeat").replace("{seat}", seating.seat) }) : null,
|
|
1610
|
+
seating.vehicle.driver !== null && seating.vehicle.driver.phoneHref !== null ? /* @__PURE__ */ jsxs(
|
|
1611
|
+
"a",
|
|
1612
|
+
{
|
|
1613
|
+
className: "kf-share-view__booking-driver-link",
|
|
1614
|
+
href: seating.vehicle.driver.phoneHref,
|
|
1615
|
+
children: [
|
|
1616
|
+
t("chrome.shareView.stay.callDriver"),
|
|
1617
|
+
seating.vehicle.driver.phoneDisplay !== null ? ` \xB7 ${seating.vehicle.driver.phoneDisplay}` : ""
|
|
1618
|
+
]
|
|
1619
|
+
}
|
|
1620
|
+
) : null
|
|
1621
|
+
] }) : null
|
|
1622
|
+
] })
|
|
1623
|
+
] }) : null,
|
|
1624
|
+
rows.map((row) => /* @__PURE__ */ jsxs("li", { className: "kf-share-view__row kf-share-view__booking-row", children: [
|
|
1625
|
+
/* @__PURE__ */ jsx("div", { className: "kf-share-view__booking-icon", "aria-hidden": "true", children: ROW_ICON.resolve(row.kind)() }),
|
|
1626
|
+
/* @__PURE__ */ jsxs("div", { className: "kf-share-view__booking-body", children: [
|
|
1627
|
+
/* @__PURE__ */ jsx("p", { className: "kf-share-view__booking-eyebrow kf-eyebrow", children: row.eyebrow }),
|
|
1628
|
+
/* @__PURE__ */ jsx("p", { className: "kf-share-view__booking-title", children: row.title }),
|
|
1629
|
+
/* @__PURE__ */ jsx("p", { className: "kf-share-view__booking-when", children: row.whenLabel }),
|
|
1630
|
+
row.locationText !== null ? /* @__PURE__ */ jsx("p", { className: "kf-share-view__booking-when", children: row.locationText }) : null
|
|
1631
|
+
] })
|
|
1632
|
+
] }, row.key))
|
|
1633
|
+
] })
|
|
1634
|
+
] });
|
|
1635
|
+
}
|
|
1636
|
+
function TodayPlanSection({ itinerary, timezone }) {
|
|
1637
|
+
const { t } = useKaafilChrome();
|
|
1638
|
+
const today = itinerary.days.find((day) => day.isToday);
|
|
1639
|
+
if (today === void 0 || today.items.length === 0) {
|
|
1640
|
+
return null;
|
|
1641
|
+
}
|
|
1642
|
+
return /* @__PURE__ */ jsxs("section", { "aria-label": t("chrome.shareView.today.eyebrow"), children: [
|
|
1643
|
+
/* @__PURE__ */ jsxs("div", { className: "kf-share-view__eyebrow-row", children: [
|
|
1644
|
+
/* @__PURE__ */ jsx("span", { className: "kf-eyebrow", children: t("chrome.shareView.today.eyebrow") }),
|
|
1645
|
+
/* @__PURE__ */ jsx("span", { className: "kf-eyebrow", children: t("chrome.shareView.dayLabel").replace("{n}", String(today.dayIndex + 1)) })
|
|
1646
|
+
] }),
|
|
1647
|
+
/* @__PURE__ */ jsx("ul", { className: "kf-share-view__card kf-share-view__list", children: today.items.map((item) => /* @__PURE__ */ jsxs(
|
|
1648
|
+
"li",
|
|
1649
|
+
{
|
|
1650
|
+
className: `kf-share-view__row kf-share-view__plan-row kf-share-view__plan-row--${item.timeState}`,
|
|
1651
|
+
children: [
|
|
1652
|
+
/* @__PURE__ */ jsx("span", { className: "kf-share-view__plan-time kf-num", children: item.timeState === "now" ? t("chrome.shareView.plan.now") : item.startTime !== null ? formatTimeOfDay(item.startTime, timezone) : "" }),
|
|
1653
|
+
/* @__PURE__ */ jsx("span", { className: "kf-share-view__plan-title", children: item.title })
|
|
1654
|
+
]
|
|
1655
|
+
},
|
|
1656
|
+
item.id
|
|
1657
|
+
)) })
|
|
1658
|
+
] });
|
|
1659
|
+
}
|
|
1660
|
+
function isVisible(key, overrides) {
|
|
1661
|
+
return overrides?.[key] !== false;
|
|
1662
|
+
}
|
|
1663
|
+
function KaafilShareView(props) {
|
|
1664
|
+
const session = useSession();
|
|
1665
|
+
if (session.status !== "authenticated") {
|
|
1666
|
+
return /* @__PURE__ */ jsx("div", { className: "kf-share-view", "data-kf-family": "traveller", children: /* @__PURE__ */ jsx(ShareSkeleton, {}) });
|
|
1667
|
+
}
|
|
1668
|
+
return /* @__PURE__ */ jsx(ReadyKaafilShareView, { ...props });
|
|
1669
|
+
}
|
|
1670
|
+
function ReadyKaafilShareView({
|
|
1671
|
+
token,
|
|
1672
|
+
travellerRef,
|
|
1673
|
+
headStrategy = "own-page",
|
|
1674
|
+
sections: sectionOverrides,
|
|
1675
|
+
household: householdProp,
|
|
1676
|
+
renderSection,
|
|
1677
|
+
style
|
|
1678
|
+
}) {
|
|
1679
|
+
const { t } = useKaafilChrome();
|
|
1680
|
+
const snapshot = useShareSnapshot(token, { travellerRef });
|
|
1681
|
+
const [householdSheetOpen, setHouseholdSheetOpen] = useState(false);
|
|
1682
|
+
const [chosenDayIndex, setChosenDayIndex] = useState(-1);
|
|
1683
|
+
const itinerary = snapshot.sections.get("itinerary");
|
|
1684
|
+
const rooming = isVisible("rooming", sectionOverrides) ? snapshot.sections.get("rooming") : void 0;
|
|
1685
|
+
const seating = isVisible("seating", sectionOverrides) ? snapshot.sections.get("seating") : void 0;
|
|
1686
|
+
const pickup = isVisible("pickup", sectionOverrides) ? snapshot.sections.get("pickup") : void 0;
|
|
1687
|
+
const accommodation = isVisible("accommodation", sectionOverrides) ? snapshot.sections.get("accommodation") : void 0;
|
|
1688
|
+
const transport = isVisible("transport", sectionOverrides) ? snapshot.sections.get("transport") : void 0;
|
|
1689
|
+
const activities = isVisible("activities", sectionOverrides) ? snapshot.sections.get("activities") : void 0;
|
|
1690
|
+
const checklists = snapshot.sections.get("checklists");
|
|
1691
|
+
const documents = snapshot.sections.get("documents");
|
|
1692
|
+
const money = snapshot.sections.get("money");
|
|
1693
|
+
const managerContact = snapshot.sections.get("managerContact");
|
|
1694
|
+
const agencyContact = snapshot.sections.get("agencyContact");
|
|
1695
|
+
const household = snapshot.sections.get("household");
|
|
1696
|
+
const tripStatus = useMemo(
|
|
1697
|
+
() => snapshot.trip !== void 0 ? deriveTripStatus(snapshot.trip, itinerary, snapshot.serverTime, t) : void 0,
|
|
1698
|
+
[snapshot.trip, itinerary, snapshot.serverTime, t]
|
|
1699
|
+
);
|
|
1700
|
+
const rootStyle = tokenStyle(style);
|
|
1701
|
+
if (snapshot.status === "loading") {
|
|
1702
|
+
return /* @__PURE__ */ jsx("div", { className: "kf-share-view", "data-kf-family": "traveller", style: rootStyle, children: /* @__PURE__ */ jsx(ShareSkeleton, {}) });
|
|
1703
|
+
}
|
|
1704
|
+
if (snapshot.status === "expired" || snapshot.status === "revoked") {
|
|
1705
|
+
return /* @__PURE__ */ jsx("div", { className: "kf-share-view", "data-kf-family": "traveller", style: rootStyle, children: /* @__PURE__ */ jsx(ShareEndedScreen, { reason: "ended" }) });
|
|
1706
|
+
}
|
|
1707
|
+
if (snapshot.status === "not-found" || snapshot.trip === void 0 || tripStatus === void 0) {
|
|
1708
|
+
return /* @__PURE__ */ jsx("div", { className: "kf-share-view", "data-kf-family": "traveller", style: rootStyle, children: /* @__PURE__ */ jsx(ShareEndedScreen, { reason: "not-found" }) });
|
|
1709
|
+
}
|
|
1710
|
+
const timezone = snapshot.trip.timezone;
|
|
1711
|
+
const tripName = snapshot.trip.name;
|
|
1712
|
+
const householdLabel = household?.partyLabel ?? householdProp?.label ?? null;
|
|
1713
|
+
const householdTravellers = household?.travellers ?? householdProp?.travellers?.map((entry) => ({ ...entry, isSubject: false })) ?? [];
|
|
1714
|
+
const householdNames = householdTravellers.map((traveller) => traveller.firstName).join(" & ");
|
|
1715
|
+
const showHousehold = isVisible("household", sectionOverrides) && (householdTravellers.length > 0 || householdLabel !== null);
|
|
1716
|
+
const showItinerary = isVisible("itinerary", sectionOverrides) && itinerary !== void 0;
|
|
1717
|
+
const todayDayIndex = itinerary?.days.findIndex((day) => day.isToday) ?? -1;
|
|
1718
|
+
const selectedDayIndex = chosenDayIndex !== -1 ? chosenDayIndex : todayDayIndex !== -1 ? todayDayIndex : 0;
|
|
1719
|
+
const showStayAndTransport = accommodation !== void 0 || transport !== void 0 || activities !== void 0 || rooming !== void 0 || seating !== void 0 || pickup !== void 0;
|
|
1720
|
+
return /* @__PURE__ */ jsxs("div", { className: "kf-share-view", "data-kf-family": "traveller", style: rootStyle, children: [
|
|
1721
|
+
/* @__PURE__ */ jsxs(BrandShell, { headStrategy, appName: tripName, children: [
|
|
1722
|
+
agencyContact !== void 0 ? /* @__PURE__ */ jsx(
|
|
1723
|
+
BrandHeaderSection,
|
|
1724
|
+
{
|
|
1725
|
+
agencyContact,
|
|
1726
|
+
partyKind: household?.partyKind ?? null
|
|
1727
|
+
}
|
|
1728
|
+
) : null,
|
|
1729
|
+
showHousehold ? (renderSection?.household ?? (() => /* @__PURE__ */ jsx(HouseholdBanner, { label: householdLabel, names: householdNames })))(household) : null,
|
|
1730
|
+
/* @__PURE__ */ jsx(
|
|
1731
|
+
HeroSection,
|
|
1732
|
+
{
|
|
1733
|
+
tripName,
|
|
1734
|
+
status: tripStatus,
|
|
1735
|
+
travellers: householdTravellers,
|
|
1736
|
+
onOpenHousehold: householdTravellers.length > 0 ? () => setHouseholdSheetOpen(true) : void 0
|
|
1737
|
+
}
|
|
1738
|
+
),
|
|
1739
|
+
showItinerary && itinerary !== void 0 ? /* @__PURE__ */ jsx(NextUpBanner, { itinerary, timezone }) : null,
|
|
1740
|
+
showItinerary && itinerary !== void 0 ? /* @__PURE__ */ jsx(TodayPlanSection, { itinerary, timezone }) : null,
|
|
1741
|
+
isVisible("managerContact", sectionOverrides) && managerContact !== void 0 ? (renderSection?.managerContact ?? (() => /* @__PURE__ */ jsx(ManagerContactSection, { data: managerContact })))(managerContact) : null,
|
|
1742
|
+
showItinerary && itinerary !== void 0 ? (renderSection?.itinerary ?? (() => /* @__PURE__ */ jsx(
|
|
1743
|
+
ItineraryDayStrip,
|
|
1744
|
+
{
|
|
1745
|
+
itinerary,
|
|
1746
|
+
timezone,
|
|
1747
|
+
selectedIndex: selectedDayIndex,
|
|
1748
|
+
onSelectIndex: setChosenDayIndex
|
|
1749
|
+
}
|
|
1750
|
+
)))(itinerary) : null,
|
|
1751
|
+
showStayAndTransport ? /* @__PURE__ */ jsx(
|
|
1752
|
+
StayAndTransportSection,
|
|
1753
|
+
{
|
|
1754
|
+
accommodation,
|
|
1755
|
+
transport,
|
|
1756
|
+
activities,
|
|
1757
|
+
rooming,
|
|
1758
|
+
seating,
|
|
1759
|
+
pickup,
|
|
1760
|
+
timezone,
|
|
1761
|
+
selectedDayIndex: showItinerary ? selectedDayIndex : void 0,
|
|
1762
|
+
serverTime: snapshot.serverTime
|
|
1763
|
+
}
|
|
1764
|
+
) : null,
|
|
1765
|
+
isVisible("checklists", sectionOverrides) && checklists !== void 0 ? (renderSection?.checklists ?? (() => /* @__PURE__ */ jsx(ChecklistSection, { data: checklists })))(
|
|
1766
|
+
checklists
|
|
1767
|
+
) : null,
|
|
1768
|
+
isVisible("documents", sectionOverrides) && documents !== void 0 ? (renderSection?.documents ?? (() => /* @__PURE__ */ jsx(DocumentsSection, { data: documents, timezone })))(documents) : null,
|
|
1769
|
+
isVisible("money", sectionOverrides) && money !== void 0 ? (renderSection?.money ?? (() => /* @__PURE__ */ jsx(MoneySection, { data: money })))(money) : null,
|
|
1770
|
+
isVisible("agencyContact", sectionOverrides) && agencyContact !== void 0 ? (renderSection?.agencyContact ?? (() => /* @__PURE__ */ jsx(AgencyContactSection, { data: agencyContact })))(
|
|
1771
|
+
agencyContact
|
|
1772
|
+
) : null,
|
|
1773
|
+
isVisible("forms", sectionOverrides) ? (renderSection?.forms ?? (() => /* @__PURE__ */ jsx(FormsSection, { token, travellerRef })))(void 0) : null
|
|
1774
|
+
] }),
|
|
1775
|
+
/* @__PURE__ */ jsx(
|
|
1776
|
+
HouseholdSheet,
|
|
1777
|
+
{
|
|
1778
|
+
open: householdSheetOpen,
|
|
1779
|
+
onClose: () => setHouseholdSheetOpen(false),
|
|
1780
|
+
label: householdLabel,
|
|
1781
|
+
travellers: householdTravellers
|
|
1782
|
+
}
|
|
1783
|
+
)
|
|
1784
|
+
] });
|
|
1785
|
+
}
|
|
1786
|
+
|
|
1787
|
+
export { KaafilShareView };
|
|
1788
|
+
//# sourceMappingURL=index.js.map
|
|
1789
|
+
//# sourceMappingURL=index.js.map
|