@scopetickets/checkout 0.4.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -10
- package/dist/analytics.cjs +91 -0
- package/dist/analytics.cjs.map +1 -0
- package/dist/analytics.d.cts +285 -0
- package/dist/analytics.d.ts +285 -0
- package/dist/analytics.js +65 -0
- package/dist/analytics.js.map +1 -0
- package/dist/{chunk-WT7WSYIH.js → chunk-SUAJAOHM.js} +808 -790
- package/dist/chunk-SUAJAOHM.js.map +1 -0
- package/dist/index.cjs +8425 -5937
- package/dist/index.cjs.map +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +307 -10
- package/dist/index.d.ts +307 -10
- package/dist/index.js +8549 -6085
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +27 -14
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.css +77 -1
- package/dist/pickers.css.map +1 -1
- package/dist/pickers.d.cts +31 -7
- package/dist/pickers.d.ts +31 -7
- package/dist/pickers.js +1 -1
- package/dist/styles.css +186 -7
- package/package.json +6 -1
- package/dist/chunk-WT7WSYIH.js.map +0 -1
|
@@ -180,6 +180,10 @@ function formatterFor(currency) {
|
|
|
180
180
|
function minorUnitDigits(formatter) {
|
|
181
181
|
return formatter.resolvedOptions().maximumFractionDigits ?? 2;
|
|
182
182
|
}
|
|
183
|
+
function majorUnits(minorUnits, currency) {
|
|
184
|
+
const digits = minorUnitDigits(formatterFor(currency));
|
|
185
|
+
return Number((minorUnits / 10 ** digits).toFixed(digits));
|
|
186
|
+
}
|
|
183
187
|
function formatMoney(minorUnits, currency) {
|
|
184
188
|
const formatter = formatterFor(currency);
|
|
185
189
|
return formatter.format(minorUnits / 10 ** minorUnitDigits(formatter));
|
|
@@ -317,12 +321,11 @@ function sameTimeslots(a, b) {
|
|
|
317
321
|
if (a.length !== b.length) return false;
|
|
318
322
|
return a.every((slot, index) => {
|
|
319
323
|
const other = b[index];
|
|
320
|
-
return slot.startTime === other.startTime && slot.endTime === other.endTime && slot.remaining === other.remaining;
|
|
324
|
+
return slot.startTime === other.startTime && slot.endTime === other.endTime && slot.remaining === other.remaining && slot.product === other.product;
|
|
321
325
|
});
|
|
322
326
|
}
|
|
323
327
|
function buildTimeslotGroups(slots, options) {
|
|
324
328
|
const groups = [];
|
|
325
|
-
const byPart = /* @__PURE__ */ new Map();
|
|
326
329
|
const chronological = [...slots].sort((a, b) => a.startTime.localeCompare(b.startTime));
|
|
327
330
|
const cellFor = (slot) => ({
|
|
328
331
|
slot,
|
|
@@ -330,15 +333,25 @@ function buildTimeslotGroups(slots, options) {
|
|
|
330
333
|
state: timeslotState(slot, options),
|
|
331
334
|
duration: formatSlotDuration(slot.startTime, slot.endTime)
|
|
332
335
|
});
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
336
|
+
const grouping = options.grouping ?? "PART_OF_DAY";
|
|
337
|
+
if (grouping === "NONE") {
|
|
338
|
+
return chronological.length === 0 ? [] : [{ key: "ALL", part: null, label: null, cells: chronological.map(cellFor) }];
|
|
339
|
+
}
|
|
340
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
341
|
+
const groupOf = (slot) => {
|
|
342
|
+
if (grouping === "PRODUCT") {
|
|
343
|
+
const product = slot.product?.trim() ?? "";
|
|
344
|
+
return product === "" ? { key: "PRODUCT:", part: null, label: null } : { key: `PRODUCT:${product}`, part: null, label: product };
|
|
345
|
+
}
|
|
337
346
|
const part = partOfDay(slot.startTime);
|
|
338
|
-
|
|
347
|
+
return { key: part, part, label: partOfDayLabel(part) };
|
|
348
|
+
};
|
|
349
|
+
for (const slot of chronological) {
|
|
350
|
+
const head = groupOf(slot);
|
|
351
|
+
let group = byKey.get(head.key);
|
|
339
352
|
if (!group) {
|
|
340
|
-
group = {
|
|
341
|
-
|
|
353
|
+
group = { ...head, cells: [] };
|
|
354
|
+
byKey.set(head.key, group);
|
|
342
355
|
groups.push(group);
|
|
343
356
|
}
|
|
344
357
|
group.cells.push(cellFor(slot));
|
|
@@ -661,526 +674,199 @@ function toggleSelectedDay(selected, day) {
|
|
|
661
674
|
return selected === day ? null : day;
|
|
662
675
|
}
|
|
663
676
|
|
|
664
|
-
// src/island/
|
|
665
|
-
import {
|
|
666
|
-
|
|
677
|
+
// src/island/ContentFlag.tsx
|
|
678
|
+
import {
|
|
679
|
+
CheckInCircleFilledIcon,
|
|
680
|
+
ExclamationMarkInCircleFilledIcon,
|
|
681
|
+
XMarkInCircleFilledIcon
|
|
682
|
+
} from "@scopetickets/icons";
|
|
667
683
|
|
|
668
|
-
// ../
|
|
669
|
-
var
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
684
|
+
// ../api/src/environment.ts
|
|
685
|
+
var ENVIRONMENT_URLS = {
|
|
686
|
+
sandbox: {
|
|
687
|
+
apiUrl: "https://testlink.scopetickets.com",
|
|
688
|
+
paymentHostUrl: "https://sandbox.pay.scopetickets.com",
|
|
689
|
+
artworkUrl: "https://cdn.scopetickets.com",
|
|
690
|
+
passkeyRpId: "testlink.scopetickets.com",
|
|
691
|
+
passkeyHostUrl: "https://passkeys.testlink.scopetickets.com"
|
|
692
|
+
},
|
|
693
|
+
production: {
|
|
694
|
+
apiUrl: "https://link.scopetickets.com",
|
|
695
|
+
paymentHostUrl: "https://pay.scopetickets.com",
|
|
696
|
+
artworkUrl: "https://cdn.scopetickets.com",
|
|
697
|
+
passkeyRpId: "link.scopetickets.com",
|
|
698
|
+
passkeyHostUrl: "https://passkeys.link.scopetickets.com"
|
|
699
|
+
},
|
|
700
|
+
internal: {
|
|
701
|
+
apiUrl: "https://testlink.scopetickets.com",
|
|
702
|
+
paymentHostUrl: "http://localhost:3001",
|
|
703
|
+
artworkUrl: "https://cdn.scopetickets.com",
|
|
704
|
+
/*
|
|
705
|
+
* `localhost` IS ITS OWN RP ID, and the one origin a browser will do WebAuthn on
|
|
706
|
+
* without TLS. A local host cannot borrow the staging id: `localhost` is not a
|
|
707
|
+
* suffix of `testlink.scopetickets.com`, so a credential made here is a local one
|
|
708
|
+
* and does not carry to staging.
|
|
709
|
+
*/
|
|
710
|
+
passkeyRpId: "localhost",
|
|
711
|
+
passkeyHostUrl: "http://localhost:3002"
|
|
712
|
+
}
|
|
677
713
|
};
|
|
678
|
-
var
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
714
|
+
var MAX_HOST_URL_LENGTH = 256;
|
|
715
|
+
var HOST_PROTOCOLS = /* @__PURE__ */ new Set(["https:", "http:"]);
|
|
716
|
+
function acceptableHostUrl(value) {
|
|
717
|
+
if (typeof value !== "string") return null;
|
|
718
|
+
const text = value.trim();
|
|
719
|
+
if (text.length === 0 || text.length > MAX_HOST_URL_LENGTH) return null;
|
|
720
|
+
let url;
|
|
721
|
+
try {
|
|
722
|
+
url = new URL(text);
|
|
723
|
+
} catch {
|
|
724
|
+
return null;
|
|
725
|
+
}
|
|
726
|
+
if (!HOST_PROTOCOLS.has(url.protocol)) return null;
|
|
727
|
+
if (url.username !== "" || url.password !== "") return null;
|
|
728
|
+
if (url.search !== "" || url.hash !== "") return null;
|
|
729
|
+
return `${url.origin}${url.pathname.replace(/\/+$/, "")}`;
|
|
730
|
+
}
|
|
731
|
+
function resolveEnvironmentUrls(environment, overrides = {}) {
|
|
732
|
+
const defaults = ENVIRONMENT_URLS[environment];
|
|
733
|
+
return {
|
|
734
|
+
apiUrl: acceptableHostUrl(overrides.apiUrl) ?? defaults.apiUrl,
|
|
735
|
+
paymentHostUrl: acceptableHostUrl(overrides.paymentHostUrl) ?? defaults.paymentHostUrl,
|
|
736
|
+
artworkUrl: acceptableHostUrl(overrides.artworkUrl) ?? defaults.artworkUrl,
|
|
737
|
+
passkeyRpId: defaults.passkeyRpId,
|
|
738
|
+
passkeyHostUrl: acceptableHostUrl(overrides.passkeyHostUrl) ?? defaults.passkeyHostUrl
|
|
739
|
+
};
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
// ../api/src/client.ts
|
|
743
|
+
var ApiError = class extends Error {
|
|
744
|
+
constructor(reason, message) {
|
|
745
|
+
super(message);
|
|
746
|
+
this.reason = reason;
|
|
747
|
+
this.name = "ApiError";
|
|
748
|
+
}
|
|
749
|
+
};
|
|
750
|
+
var ScopeClient = class {
|
|
751
|
+
constructor(config) {
|
|
752
|
+
this.sessionAuthorization = null;
|
|
753
|
+
this.onRefused = null;
|
|
754
|
+
this.config = config;
|
|
755
|
+
}
|
|
683
756
|
/**
|
|
684
|
-
*
|
|
685
|
-
* name worth showing per row, so the one line it draws names the whole party.
|
|
757
|
+
* WHO TO TELL WHEN A SESSION IS REFUSED — the one signal a session has that it is over.
|
|
686
758
|
*
|
|
687
|
-
*
|
|
688
|
-
*
|
|
689
|
-
*
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
returnToOrder: "Return to Order",
|
|
697
|
-
payNow: "Pay Now",
|
|
698
|
-
tryAgain: "Try Again"
|
|
699
|
-
};
|
|
700
|
-
var DISMISS_COPY = {
|
|
701
|
-
back: "Back",
|
|
702
|
-
close: "Close",
|
|
703
|
-
/*
|
|
704
|
-
* ASKING ABOUT LEAVING IS STILL LEAVING, as far as the button's NAME is concerned: what
|
|
705
|
-
* a buyer presses it for is the same thing, and "Close, but we will check first" is a
|
|
706
|
-
* sentence nobody needs read to them.
|
|
759
|
+
* `LoginResult` carries no expiry, so nothing can know a header has stopped working
|
|
760
|
+
* until the platform says so. This is where that arrives, and it is a callback on the
|
|
761
|
+
* INSTANCE rather than anything global: this library runs inside somebody else's page,
|
|
762
|
+
* and a handler registered anywhere a host could also reach is a handler two things
|
|
763
|
+
* fight over.
|
|
764
|
+
*
|
|
765
|
+
* IT FIRES ONLY WHERE A USER SESSION WAS ACTUALLY SENT. A 401 on the app key alone is
|
|
766
|
+
* the app being wrong about itself, not a buyer being signed out, and waking the session
|
|
767
|
+
* machinery for it would expire somebody who was never signed in.
|
|
707
768
|
*/
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
order: "Your order",
|
|
712
|
-
runWeeks: "Weeks of the run"
|
|
713
|
-
};
|
|
714
|
-
var TIMESLOT_COPY = {
|
|
769
|
+
setRefusedHandler(handler) {
|
|
770
|
+
this.onRefused = handler;
|
|
771
|
+
}
|
|
715
772
|
/**
|
|
716
|
-
*
|
|
717
|
-
*
|
|
718
|
-
*
|
|
719
|
-
*
|
|
773
|
+
* Holds the header a signed-in user's session gave us, or clears it on sign-out.
|
|
774
|
+
*
|
|
775
|
+
* Stored and sent VERBATIM, which is right: staging answers `POST /api/Auth/Login`
|
|
776
|
+
* with the `Bearer ` already on it. Nothing here adds a scheme, and nothing should.
|
|
720
777
|
*/
|
|
721
|
-
|
|
778
|
+
setAuthorization(authorization) {
|
|
779
|
+
this.sessionAuthorization = authorization;
|
|
780
|
+
}
|
|
781
|
+
/** Whether a user session is in force, rather than the app key alone. */
|
|
782
|
+
hasAuthorization() {
|
|
783
|
+
return this.sessionAuthorization !== null;
|
|
784
|
+
}
|
|
785
|
+
getAuthHeaders() {
|
|
786
|
+
if (this.sessionAuthorization !== null) {
|
|
787
|
+
return { Authorization: this.sessionAuthorization };
|
|
788
|
+
}
|
|
789
|
+
if (this.config.apiKey) {
|
|
790
|
+
return { Authorization: `Bearer ${this.config.apiKey}` };
|
|
791
|
+
}
|
|
792
|
+
return {};
|
|
793
|
+
}
|
|
794
|
+
/** A 401 on a call that carried a session, and nothing else. See `setRefusedHandler`. */
|
|
795
|
+
reportIfRefused(status) {
|
|
796
|
+
if (status === 401 && this.sessionAuthorization !== null) this.onRefused?.();
|
|
797
|
+
}
|
|
798
|
+
async fetch(endpoint, options) {
|
|
799
|
+
const response = await fetch(`${this.config.apiUrl}${endpoint}`, {
|
|
800
|
+
...options,
|
|
801
|
+
headers: {
|
|
802
|
+
"Content-Type": "application/json",
|
|
803
|
+
...this.getAuthHeaders(),
|
|
804
|
+
...options?.headers
|
|
805
|
+
}
|
|
806
|
+
});
|
|
807
|
+
if (!response.ok) {
|
|
808
|
+
this.reportIfRefused(response.status);
|
|
809
|
+
let errorResponse;
|
|
810
|
+
try {
|
|
811
|
+
errorResponse = await response.json();
|
|
812
|
+
} catch (e) {
|
|
813
|
+
console.error("Failed to parse API error response:", e);
|
|
814
|
+
throw new ApiError("UnknownError", `API error: ${response.status} ${response.statusText}`);
|
|
815
|
+
}
|
|
816
|
+
throw new ApiError(errorResponse.Reason, errorResponse.Message);
|
|
817
|
+
}
|
|
818
|
+
const text = await response.text();
|
|
819
|
+
if (!text) {
|
|
820
|
+
return void 0;
|
|
821
|
+
}
|
|
822
|
+
try {
|
|
823
|
+
return JSON.parse(text);
|
|
824
|
+
} catch {
|
|
825
|
+
return text;
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
async fetchVoid(endpoint, options) {
|
|
829
|
+
const response = await fetch(`${this.config.apiUrl}${endpoint}`, {
|
|
830
|
+
...options,
|
|
831
|
+
headers: {
|
|
832
|
+
"Content-Type": "application/json",
|
|
833
|
+
...this.getAuthHeaders(),
|
|
834
|
+
...options?.headers
|
|
835
|
+
}
|
|
836
|
+
});
|
|
837
|
+
if (!response.ok) {
|
|
838
|
+
this.reportIfRefused(response.status);
|
|
839
|
+
let errorResponse;
|
|
840
|
+
try {
|
|
841
|
+
errorResponse = await response.json();
|
|
842
|
+
} catch (e) {
|
|
843
|
+
console.error("Failed to parse API error response:", e);
|
|
844
|
+
throw new ApiError("UnknownError", `API error: ${response.status} ${response.statusText}`);
|
|
845
|
+
}
|
|
846
|
+
throw new ApiError(errorResponse.Reason, errorResponse.Message);
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
// ===========================================================================
|
|
850
|
+
// v2 Events
|
|
851
|
+
// ===========================================================================
|
|
852
|
+
async getDisplayEvents(signal) {
|
|
853
|
+
const response = await this.fetch("/api/v2/EventSummaries", { signal });
|
|
854
|
+
return response.Events;
|
|
855
|
+
}
|
|
856
|
+
async getEventInfo(eventKey, read) {
|
|
857
|
+
return this.eventInformation("event", eventKey, read);
|
|
858
|
+
}
|
|
859
|
+
async getSeriesInfo(seriesKey, read) {
|
|
860
|
+
return this.eventInformation("series", seriesKey, read);
|
|
861
|
+
}
|
|
722
862
|
/**
|
|
723
|
-
*
|
|
724
|
-
*
|
|
725
|
-
*
|
|
726
|
-
*
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
// src/island/PartyStepper.tsx
|
|
732
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
733
|
-
function UserTypeRow({
|
|
734
|
-
option,
|
|
735
|
-
count,
|
|
736
|
-
atLimit,
|
|
737
|
-
onAdd,
|
|
738
|
-
onRemove,
|
|
739
|
-
onSet,
|
|
740
|
-
max,
|
|
741
|
-
onRefuse
|
|
742
|
-
}) {
|
|
743
|
-
return /* @__PURE__ */ jsxs("div", { className: "scopetickets-island-party-row", children: [
|
|
744
|
-
/* @__PURE__ */ jsxs("span", { className: "scopetickets-island-party-row__text", children: [
|
|
745
|
-
/* @__PURE__ */ jsx("span", { className: "scopetickets-island-party-row__name", children: option.name }),
|
|
746
|
-
option.note !== null && /* @__PURE__ */ jsx("span", { className: "scopetickets-island-party-row__note", children: option.note })
|
|
747
|
-
] }),
|
|
748
|
-
/* @__PURE__ */ jsx(
|
|
749
|
-
UserTypeStepper,
|
|
750
|
-
{
|
|
751
|
-
name: option.name,
|
|
752
|
-
count,
|
|
753
|
-
atLimit,
|
|
754
|
-
onAdd,
|
|
755
|
-
onRemove,
|
|
756
|
-
onSet,
|
|
757
|
-
max,
|
|
758
|
-
onRefuse
|
|
759
|
-
}
|
|
760
|
-
)
|
|
761
|
-
] });
|
|
762
|
-
}
|
|
763
|
-
function UserTypeStepper({
|
|
764
|
-
name,
|
|
765
|
-
count,
|
|
766
|
-
atLimit,
|
|
767
|
-
onAdd,
|
|
768
|
-
onRemove,
|
|
769
|
-
onSet,
|
|
770
|
-
max,
|
|
771
|
-
onRefuse
|
|
772
|
-
}) {
|
|
773
|
-
const chosen = count > 0;
|
|
774
|
-
return /* @__PURE__ */ jsxs("span", { className: "scopetickets-island-stepper", "data-expanded": chosen ? "" : void 0, children: [
|
|
775
|
-
/* @__PURE__ */ jsx(
|
|
776
|
-
"span",
|
|
777
|
-
{
|
|
778
|
-
className: "scopetickets-island-stepper__opening",
|
|
779
|
-
"aria-hidden": chosen ? void 0 : "true",
|
|
780
|
-
children: /* @__PURE__ */ jsxs("span", { className: "scopetickets-island-stepper__opening-inner", children: [
|
|
781
|
-
/* @__PURE__ */ jsx(
|
|
782
|
-
StepperButton,
|
|
783
|
-
{
|
|
784
|
-
label: PARTY_COPY.remove(name),
|
|
785
|
-
onPress: onRemove,
|
|
786
|
-
kind: "remove",
|
|
787
|
-
state: chosen ? "LIVE" : "CLOSED"
|
|
788
|
-
}
|
|
789
|
-
),
|
|
790
|
-
/* @__PURE__ */ jsx(
|
|
791
|
-
TypedCount,
|
|
792
|
-
{
|
|
793
|
-
count,
|
|
794
|
-
name,
|
|
795
|
-
onSet,
|
|
796
|
-
valueClassName: "scopetickets-island-stepper__value",
|
|
797
|
-
inputClassName: "scopetickets-island-stepper__input",
|
|
798
|
-
closed: !chosen,
|
|
799
|
-
max,
|
|
800
|
-
onRefuse
|
|
801
|
-
}
|
|
802
|
-
)
|
|
803
|
-
] })
|
|
804
|
-
}
|
|
805
|
-
),
|
|
806
|
-
/* @__PURE__ */ jsx(
|
|
807
|
-
StepperButton,
|
|
808
|
-
{
|
|
809
|
-
label: PARTY_COPY.add(name),
|
|
810
|
-
onPress: onAdd,
|
|
811
|
-
kind: "add",
|
|
812
|
-
state: atLimit ? "REFUSING" : "LIVE"
|
|
813
|
-
}
|
|
814
|
-
)
|
|
815
|
-
] });
|
|
816
|
-
}
|
|
817
|
-
function StepperButton({
|
|
818
|
-
label,
|
|
819
|
-
onPress,
|
|
820
|
-
kind,
|
|
821
|
-
state = "LIVE"
|
|
822
|
-
}) {
|
|
823
|
-
const press = useIslandPress("element");
|
|
824
|
-
return /* @__PURE__ */ jsx(
|
|
825
|
-
"button",
|
|
826
|
-
{
|
|
827
|
-
type: "button",
|
|
828
|
-
className: "scopetickets-island-stepper__button",
|
|
829
|
-
"data-kind": kind,
|
|
830
|
-
"aria-label": label,
|
|
831
|
-
"aria-disabled": state === "REFUSING" ? true : void 0,
|
|
832
|
-
disabled: state === "CLOSED",
|
|
833
|
-
onClick: state === "LIVE" ? onPress : void 0,
|
|
834
|
-
...press,
|
|
835
|
-
children: /* @__PURE__ */ jsx("span", { className: "scopetickets-island-stepper__mark", children: kind === "add" ? /* @__PURE__ */ jsx(PlusMarkIcon, { fill: true, color: "currentColor" }) : /* @__PURE__ */ jsx(MinusMarkIcon, { fill: true, color: "currentColor" }) })
|
|
836
|
-
}
|
|
837
|
-
);
|
|
838
|
-
}
|
|
839
|
-
function SoloPartyStepper({ max, name, count, onSet, onRemove, onRefuse }) {
|
|
840
|
-
return /* @__PURE__ */ jsxs("div", { className: "scopetickets-island-party-solo", children: [
|
|
841
|
-
/* @__PURE__ */ jsx(
|
|
842
|
-
StepperButton,
|
|
843
|
-
{
|
|
844
|
-
label: PARTY_COPY.remove(name),
|
|
845
|
-
onPress: onRemove,
|
|
846
|
-
kind: "remove",
|
|
847
|
-
state: count === 0 ? "REFUSING" : "LIVE"
|
|
848
|
-
}
|
|
849
|
-
),
|
|
850
|
-
/* @__PURE__ */ jsx(
|
|
851
|
-
TypedCount,
|
|
852
|
-
{
|
|
853
|
-
count,
|
|
854
|
-
name,
|
|
855
|
-
onSet,
|
|
856
|
-
valueClassName: "scopetickets-island-party-solo__value",
|
|
857
|
-
inputClassName: "scopetickets-island-party-solo__input",
|
|
858
|
-
max,
|
|
859
|
-
onRefuse
|
|
860
|
-
}
|
|
861
|
-
),
|
|
862
|
-
/* @__PURE__ */ jsx(
|
|
863
|
-
StepperButton,
|
|
864
|
-
{
|
|
865
|
-
label: PARTY_COPY.add(name),
|
|
866
|
-
onPress: () => onSet(count + 1),
|
|
867
|
-
kind: "add",
|
|
868
|
-
state: count >= max ? "REFUSING" : "LIVE"
|
|
869
|
-
}
|
|
870
|
-
)
|
|
871
|
-
] });
|
|
872
|
-
}
|
|
873
|
-
function TypedCount({
|
|
874
|
-
count,
|
|
875
|
-
name,
|
|
876
|
-
onSet,
|
|
877
|
-
valueClassName,
|
|
878
|
-
inputClassName,
|
|
879
|
-
onRefuse,
|
|
880
|
-
closed = false,
|
|
881
|
-
max
|
|
882
|
-
}) {
|
|
883
|
-
const [typing, setTyping] = useState2(null);
|
|
884
|
-
const field = useRef2(null);
|
|
885
|
-
const editing = typing !== null;
|
|
886
|
-
useEffect2(() => {
|
|
887
|
-
if (!editing) return;
|
|
888
|
-
field.current?.focus({ preventScroll: true });
|
|
889
|
-
}, [editing]);
|
|
890
|
-
const commit = () => {
|
|
891
|
-
if (typing === null) return;
|
|
892
|
-
const asked = Number.parseInt(typing, 10);
|
|
893
|
-
setTyping(null);
|
|
894
|
-
if (!Number.isFinite(asked)) return;
|
|
895
|
-
if (max !== void 0 && asked > max) {
|
|
896
|
-
onRefuse?.(asked);
|
|
897
|
-
return;
|
|
898
|
-
}
|
|
899
|
-
onRefuse?.(null);
|
|
900
|
-
onSet(Math.max(0, asked));
|
|
901
|
-
};
|
|
902
|
-
if (typing === null) {
|
|
903
|
-
return /* @__PURE__ */ jsx(
|
|
904
|
-
"button",
|
|
905
|
-
{
|
|
906
|
-
type: "button",
|
|
907
|
-
className: valueClassName,
|
|
908
|
-
"aria-label": PARTY_COPY.count(count, name),
|
|
909
|
-
onClick: () => setTyping(String(count)),
|
|
910
|
-
disabled: closed,
|
|
911
|
-
children: count
|
|
912
|
-
}
|
|
913
|
-
);
|
|
914
|
-
}
|
|
915
|
-
return /* @__PURE__ */ jsx(
|
|
916
|
-
"input",
|
|
917
|
-
{
|
|
918
|
-
className: inputClassName,
|
|
919
|
-
type: "text",
|
|
920
|
-
inputMode: "numeric",
|
|
921
|
-
pattern: "[0-9]*",
|
|
922
|
-
size: 1,
|
|
923
|
-
ref: field,
|
|
924
|
-
"aria-label": PARTY_COPY.field(name),
|
|
925
|
-
value: typing,
|
|
926
|
-
onChange: (event) => setTyping(event.target.value.replace(/\D/g, "")),
|
|
927
|
-
onBlur: commit,
|
|
928
|
-
onKeyDown: (event) => {
|
|
929
|
-
if (event.key === "Enter") commit();
|
|
930
|
-
else if (event.key === "Escape") setTyping(null);
|
|
931
|
-
else return;
|
|
932
|
-
event.preventDefault();
|
|
933
|
-
event.stopPropagation();
|
|
934
|
-
}
|
|
935
|
-
}
|
|
936
|
-
);
|
|
937
|
-
}
|
|
938
|
-
function PartyStepper({
|
|
939
|
-
userTypes,
|
|
940
|
-
counts,
|
|
941
|
-
onChange,
|
|
942
|
-
max,
|
|
943
|
-
soloName = PARTY_COPY.soloName,
|
|
944
|
-
onRefuse,
|
|
945
|
-
refused = null
|
|
946
|
-
}) {
|
|
947
|
-
const headcount = Object.values(counts).reduce((total, n2) => total + n2, 0);
|
|
948
|
-
const refuse = (asked) => onRefuse?.(asked);
|
|
949
|
-
const shown = (count) => refused === null ? count : refused;
|
|
950
|
-
if (userTypes.length === 0) {
|
|
951
|
-
return /* @__PURE__ */ jsx("div", { className: "scopetickets-island-party", "data-excess": refused === null ? void 0 : "", children: /* @__PURE__ */ jsx(
|
|
952
|
-
SoloPartyStepper,
|
|
953
|
-
{
|
|
954
|
-
max,
|
|
955
|
-
name: soloName,
|
|
956
|
-
count: shown(headcount),
|
|
957
|
-
onSet: (next) => {
|
|
958
|
-
refuse(null);
|
|
959
|
-
onChange(SOLO_KEY, next);
|
|
960
|
-
},
|
|
961
|
-
onRemove: () => refused === null ? onChange(SOLO_KEY, Math.max(0, headcount - 1)) : (refuse(null), onChange(SOLO_KEY, max)),
|
|
962
|
-
onRefuse: refuse
|
|
963
|
-
}
|
|
964
|
-
) });
|
|
965
|
-
}
|
|
966
|
-
return /* @__PURE__ */ jsx("div", { className: "scopetickets-island-party", "data-excess": refused === null ? void 0 : "", children: userTypes.map((option) => /* @__PURE__ */ jsx(
|
|
967
|
-
UserTypeRow,
|
|
968
|
-
{
|
|
969
|
-
option,
|
|
970
|
-
count: counts[option.key] ?? 0,
|
|
971
|
-
atLimit: headcount >= max,
|
|
972
|
-
onAdd: () => {
|
|
973
|
-
refuse(null);
|
|
974
|
-
onChange(option.key, (counts[option.key] ?? 0) + 1);
|
|
975
|
-
},
|
|
976
|
-
onRemove: () => {
|
|
977
|
-
refuse(null);
|
|
978
|
-
onChange(option.key, Math.max(0, (counts[option.key] ?? 0) - 1));
|
|
979
|
-
},
|
|
980
|
-
onSet: (next) => {
|
|
981
|
-
refuse(null);
|
|
982
|
-
onChange(option.key, next);
|
|
983
|
-
},
|
|
984
|
-
max,
|
|
985
|
-
onRefuse: refuse
|
|
986
|
-
},
|
|
987
|
-
option.key
|
|
988
|
-
)) });
|
|
989
|
-
}
|
|
990
|
-
|
|
991
|
-
// src/island/ContentFlag.tsx
|
|
992
|
-
import {
|
|
993
|
-
CheckInCircleFilledIcon,
|
|
994
|
-
ExclamationMarkInCircleFilledIcon,
|
|
995
|
-
XMarkInCircleFilledIcon
|
|
996
|
-
} from "@scopetickets/icons";
|
|
997
|
-
|
|
998
|
-
// ../api/src/environment.ts
|
|
999
|
-
var ENVIRONMENT_URLS = {
|
|
1000
|
-
sandbox: {
|
|
1001
|
-
apiUrl: "https://testlink.scopetickets.com",
|
|
1002
|
-
paymentHostUrl: "https://sandbox.pay.scopetickets.com",
|
|
1003
|
-
artworkUrl: "https://cdn.scopetickets.com",
|
|
1004
|
-
passkeyRpId: "testlink.scopetickets.com",
|
|
1005
|
-
passkeyHostUrl: "https://passkeys.testlink.scopetickets.com"
|
|
1006
|
-
},
|
|
1007
|
-
production: {
|
|
1008
|
-
apiUrl: "https://link.scopetickets.com",
|
|
1009
|
-
paymentHostUrl: "https://pay.scopetickets.com",
|
|
1010
|
-
artworkUrl: "https://cdn.scopetickets.com",
|
|
1011
|
-
passkeyRpId: "link.scopetickets.com",
|
|
1012
|
-
passkeyHostUrl: "https://passkeys.link.scopetickets.com"
|
|
1013
|
-
},
|
|
1014
|
-
internal: {
|
|
1015
|
-
apiUrl: "https://testlink.scopetickets.com",
|
|
1016
|
-
paymentHostUrl: "http://localhost:3001",
|
|
1017
|
-
artworkUrl: "https://cdn.scopetickets.com",
|
|
1018
|
-
/*
|
|
1019
|
-
* `localhost` IS ITS OWN RP ID, and the one origin a browser will do WebAuthn on
|
|
1020
|
-
* without TLS. A local host cannot borrow the staging id: `localhost` is not a
|
|
1021
|
-
* suffix of `testlink.scopetickets.com`, so a credential made here is a local one
|
|
1022
|
-
* and does not carry to staging.
|
|
1023
|
-
*/
|
|
1024
|
-
passkeyRpId: "localhost",
|
|
1025
|
-
passkeyHostUrl: "http://localhost:3002"
|
|
1026
|
-
}
|
|
1027
|
-
};
|
|
1028
|
-
var MAX_HOST_URL_LENGTH = 256;
|
|
1029
|
-
var HOST_PROTOCOLS = /* @__PURE__ */ new Set(["https:", "http:"]);
|
|
1030
|
-
function acceptableHostUrl(value) {
|
|
1031
|
-
if (typeof value !== "string") return null;
|
|
1032
|
-
const text = value.trim();
|
|
1033
|
-
if (text.length === 0 || text.length > MAX_HOST_URL_LENGTH) return null;
|
|
1034
|
-
let url;
|
|
1035
|
-
try {
|
|
1036
|
-
url = new URL(text);
|
|
1037
|
-
} catch {
|
|
1038
|
-
return null;
|
|
1039
|
-
}
|
|
1040
|
-
if (!HOST_PROTOCOLS.has(url.protocol)) return null;
|
|
1041
|
-
if (url.username !== "" || url.password !== "") return null;
|
|
1042
|
-
if (url.search !== "" || url.hash !== "") return null;
|
|
1043
|
-
return `${url.origin}${url.pathname.replace(/\/+$/, "")}`;
|
|
1044
|
-
}
|
|
1045
|
-
function resolveEnvironmentUrls(environment, overrides = {}) {
|
|
1046
|
-
const defaults = ENVIRONMENT_URLS[environment];
|
|
1047
|
-
return {
|
|
1048
|
-
apiUrl: acceptableHostUrl(overrides.apiUrl) ?? defaults.apiUrl,
|
|
1049
|
-
paymentHostUrl: acceptableHostUrl(overrides.paymentHostUrl) ?? defaults.paymentHostUrl,
|
|
1050
|
-
artworkUrl: acceptableHostUrl(overrides.artworkUrl) ?? defaults.artworkUrl,
|
|
1051
|
-
passkeyRpId: defaults.passkeyRpId,
|
|
1052
|
-
passkeyHostUrl: acceptableHostUrl(overrides.passkeyHostUrl) ?? defaults.passkeyHostUrl
|
|
1053
|
-
};
|
|
1054
|
-
}
|
|
1055
|
-
|
|
1056
|
-
// ../api/src/client.ts
|
|
1057
|
-
var ApiError = class extends Error {
|
|
1058
|
-
constructor(reason, message) {
|
|
1059
|
-
super(message);
|
|
1060
|
-
this.reason = reason;
|
|
1061
|
-
this.name = "ApiError";
|
|
1062
|
-
}
|
|
1063
|
-
};
|
|
1064
|
-
var ScopeClient = class {
|
|
1065
|
-
constructor(config) {
|
|
1066
|
-
this.sessionAuthorization = null;
|
|
1067
|
-
this.onRefused = null;
|
|
1068
|
-
this.config = config;
|
|
1069
|
-
}
|
|
1070
|
-
/**
|
|
1071
|
-
* WHO TO TELL WHEN A SESSION IS REFUSED — the one signal a session has that it is over.
|
|
1072
|
-
*
|
|
1073
|
-
* `LoginResult` carries no expiry, so nothing can know a header has stopped working
|
|
1074
|
-
* until the platform says so. This is where that arrives, and it is a callback on the
|
|
1075
|
-
* INSTANCE rather than anything global: this library runs inside somebody else's page,
|
|
1076
|
-
* and a handler registered anywhere a host could also reach is a handler two things
|
|
1077
|
-
* fight over.
|
|
1078
|
-
*
|
|
1079
|
-
* IT FIRES ONLY WHERE A USER SESSION WAS ACTUALLY SENT. A 401 on the app key alone is
|
|
1080
|
-
* the app being wrong about itself, not a buyer being signed out, and waking the session
|
|
1081
|
-
* machinery for it would expire somebody who was never signed in.
|
|
1082
|
-
*/
|
|
1083
|
-
setRefusedHandler(handler) {
|
|
1084
|
-
this.onRefused = handler;
|
|
1085
|
-
}
|
|
1086
|
-
/**
|
|
1087
|
-
* Holds the header a signed-in user's session gave us, or clears it on sign-out.
|
|
1088
|
-
*
|
|
1089
|
-
* Stored and sent VERBATIM, which is right: staging answers `POST /api/Auth/Login`
|
|
1090
|
-
* with the `Bearer ` already on it. Nothing here adds a scheme, and nothing should.
|
|
1091
|
-
*/
|
|
1092
|
-
setAuthorization(authorization) {
|
|
1093
|
-
this.sessionAuthorization = authorization;
|
|
1094
|
-
}
|
|
1095
|
-
/** Whether a user session is in force, rather than the app key alone. */
|
|
1096
|
-
hasAuthorization() {
|
|
1097
|
-
return this.sessionAuthorization !== null;
|
|
1098
|
-
}
|
|
1099
|
-
getAuthHeaders() {
|
|
1100
|
-
if (this.sessionAuthorization !== null) {
|
|
1101
|
-
return { Authorization: this.sessionAuthorization };
|
|
1102
|
-
}
|
|
1103
|
-
if (this.config.apiKey) {
|
|
1104
|
-
return { Authorization: `Bearer ${this.config.apiKey}` };
|
|
1105
|
-
}
|
|
1106
|
-
return {};
|
|
1107
|
-
}
|
|
1108
|
-
/** A 401 on a call that carried a session, and nothing else. See `setRefusedHandler`. */
|
|
1109
|
-
reportIfRefused(status) {
|
|
1110
|
-
if (status === 401 && this.sessionAuthorization !== null) this.onRefused?.();
|
|
1111
|
-
}
|
|
1112
|
-
async fetch(endpoint, options) {
|
|
1113
|
-
const response = await fetch(`${this.config.apiUrl}${endpoint}`, {
|
|
1114
|
-
...options,
|
|
1115
|
-
headers: {
|
|
1116
|
-
"Content-Type": "application/json",
|
|
1117
|
-
...this.getAuthHeaders(),
|
|
1118
|
-
...options?.headers
|
|
1119
|
-
}
|
|
1120
|
-
});
|
|
1121
|
-
if (!response.ok) {
|
|
1122
|
-
this.reportIfRefused(response.status);
|
|
1123
|
-
let errorResponse;
|
|
1124
|
-
try {
|
|
1125
|
-
errorResponse = await response.json();
|
|
1126
|
-
} catch (e) {
|
|
1127
|
-
console.error("Failed to parse API error response:", e);
|
|
1128
|
-
throw new ApiError("UnknownError", `API error: ${response.status} ${response.statusText}`);
|
|
1129
|
-
}
|
|
1130
|
-
throw new ApiError(errorResponse.Reason, errorResponse.Message);
|
|
1131
|
-
}
|
|
1132
|
-
const text = await response.text();
|
|
1133
|
-
if (!text) {
|
|
1134
|
-
return void 0;
|
|
1135
|
-
}
|
|
1136
|
-
try {
|
|
1137
|
-
return JSON.parse(text);
|
|
1138
|
-
} catch {
|
|
1139
|
-
return text;
|
|
1140
|
-
}
|
|
1141
|
-
}
|
|
1142
|
-
async fetchVoid(endpoint, options) {
|
|
1143
|
-
const response = await fetch(`${this.config.apiUrl}${endpoint}`, {
|
|
1144
|
-
...options,
|
|
1145
|
-
headers: {
|
|
1146
|
-
"Content-Type": "application/json",
|
|
1147
|
-
...this.getAuthHeaders(),
|
|
1148
|
-
...options?.headers
|
|
1149
|
-
}
|
|
1150
|
-
});
|
|
1151
|
-
if (!response.ok) {
|
|
1152
|
-
this.reportIfRefused(response.status);
|
|
1153
|
-
let errorResponse;
|
|
1154
|
-
try {
|
|
1155
|
-
errorResponse = await response.json();
|
|
1156
|
-
} catch (e) {
|
|
1157
|
-
console.error("Failed to parse API error response:", e);
|
|
1158
|
-
throw new ApiError("UnknownError", `API error: ${response.status} ${response.statusText}`);
|
|
1159
|
-
}
|
|
1160
|
-
throw new ApiError(errorResponse.Reason, errorResponse.Message);
|
|
1161
|
-
}
|
|
1162
|
-
}
|
|
1163
|
-
// ===========================================================================
|
|
1164
|
-
// v2 Events
|
|
1165
|
-
// ===========================================================================
|
|
1166
|
-
async getDisplayEvents(signal) {
|
|
1167
|
-
const response = await this.fetch("/api/v2/EventSummaries", { signal });
|
|
1168
|
-
return response.Events;
|
|
1169
|
-
}
|
|
1170
|
-
async getEventInfo(eventKey, read) {
|
|
1171
|
-
return this.eventInformation("event", eventKey, read);
|
|
1172
|
-
}
|
|
1173
|
-
async getSeriesInfo(seriesKey, read) {
|
|
1174
|
-
return this.eventInformation("series", seriesKey, read);
|
|
1175
|
-
}
|
|
1176
|
-
/**
|
|
1177
|
-
* `EventInformation`, for a run or a single event.
|
|
1178
|
-
*
|
|
1179
|
-
* `inventories` NARROWS THE RUN ITSELF, and the platform does the narrowing: the events
|
|
1180
|
-
* that sell nothing from those inventories are gone from `Events`, and the user types are
|
|
1181
|
-
* the ones those inventories' products assign. Repeated on the wire, like
|
|
1182
|
-
* `TicketInformation`'s — see `TicketInformationQuery.inventories`, which is the same
|
|
1183
|
-
* parameter on the other endpoint and the reason both are ANDed rather than substituted.
|
|
863
|
+
* `EventInformation`, for a run or a single event.
|
|
864
|
+
*
|
|
865
|
+
* `inventories` NARROWS THE RUN ITSELF, and the platform does the narrowing: the events
|
|
866
|
+
* that sell nothing from those inventories are gone from `Events`, and the user types are
|
|
867
|
+
* the ones those inventories' products assign. Repeated on the wire, like
|
|
868
|
+
* `TicketInformation`'s — see `TicketInformationQuery.inventories`, which is the same
|
|
869
|
+
* parameter on the other endpoint and the reason both are ANDed rather than substituted.
|
|
1184
870
|
*/
|
|
1185
871
|
async eventInformation(type, key, read) {
|
|
1186
872
|
const params = new URLSearchParams({ type, key });
|
|
@@ -2308,7 +1994,7 @@ function splitFullName(full) {
|
|
|
2308
1994
|
}
|
|
2309
1995
|
|
|
2310
1996
|
// src/island/ContentFlag.tsx
|
|
2311
|
-
import { jsx
|
|
1997
|
+
import { jsx } from "react/jsx-runtime";
|
|
2312
1998
|
var GLYPH = {
|
|
2313
1999
|
success: CheckInCircleFilledIcon,
|
|
2314
2000
|
warning: ExclamationMarkInCircleFilledIcon,
|
|
@@ -2316,233 +2002,348 @@ var GLYPH = {
|
|
|
2316
2002
|
};
|
|
2317
2003
|
function ContentFlag({ tone, title }) {
|
|
2318
2004
|
const Glyph = GLYPH[tone];
|
|
2319
|
-
return /* @__PURE__ */
|
|
2005
|
+
return /* @__PURE__ */ jsx("span", { className: `scopetickets-island-content-flag scopetickets-island-content-flag--${tone}`, children: /* @__PURE__ */ jsx(Glyph, { fill: true, color: "currentColor", title }) });
|
|
2320
2006
|
}
|
|
2321
2007
|
|
|
2322
|
-
// src/island/
|
|
2323
|
-
import {
|
|
2324
|
-
|
|
2325
|
-
const press = useIslandPress("element");
|
|
2326
|
-
return /* @__PURE__ */ jsx3(
|
|
2327
|
-
"button",
|
|
2328
|
-
{
|
|
2329
|
-
type: "button",
|
|
2330
|
-
role: "switch",
|
|
2331
|
-
"aria-checked": checked,
|
|
2332
|
-
"aria-label": label,
|
|
2333
|
-
disabled,
|
|
2334
|
-
className: `scopetickets-island-switch scopetickets-island-switch--${size}`,
|
|
2335
|
-
onClick: () => onChange(!checked),
|
|
2336
|
-
...disabled ? {} : press,
|
|
2337
|
-
children: /* @__PURE__ */ jsx3("span", { className: "scopetickets-island-switch__thumb", "aria-hidden": "true" })
|
|
2338
|
-
}
|
|
2339
|
-
);
|
|
2340
|
-
}
|
|
2008
|
+
// src/island/PartyStepper.tsx
|
|
2009
|
+
import { useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
|
|
2010
|
+
import { MinusMarkIcon, PlusMarkIcon } from "@scopetickets/icons";
|
|
2341
2011
|
|
|
2342
|
-
// src/
|
|
2343
|
-
|
|
2012
|
+
// ../checkout-core/src/view/component-copy.ts
|
|
2013
|
+
var FIELD_COPY = {
|
|
2014
|
+
firstName: "First Name",
|
|
2015
|
+
lastName: "Last Name",
|
|
2016
|
+
email: "Email",
|
|
2017
|
+
countryCode: "Country Code",
|
|
2018
|
+
phoneNumber: "Phone Number",
|
|
2019
|
+
confirmPassword: "Confirm Password",
|
|
2020
|
+
verificationCode: "Verification code"
|
|
2021
|
+
};
|
|
2022
|
+
var PARTY_COPY = {
|
|
2023
|
+
remove: (name) => `Remove one ${name}`,
|
|
2024
|
+
add: (name) => `Add one ${name}`,
|
|
2025
|
+
count: (count, name) => `${count} ${name}. Change the number`,
|
|
2026
|
+
field: (name) => `Number of ${name}`,
|
|
2027
|
+
/**
|
|
2028
|
+
* AND WHAT AN UNDIFFERENTIATED PARTY IS CALLED — a run selling a single UserType has no
|
|
2029
|
+
* name worth showing per row, so the one line it draws names the whole party.
|
|
2030
|
+
*
|
|
2031
|
+
* A PROP DEFAULT ON THE WEB IS INVISIBLE TO THE OTHER RENDERER, which is why this is
|
|
2032
|
+
* here: `PartyStepper`'s own `soloName = 'Guests'` could not be read from native, so
|
|
2033
|
+
* native re-typed it.
|
|
2034
|
+
*/
|
|
2035
|
+
soloName: "Guests"
|
|
2036
|
+
};
|
|
2037
|
+
var ACTION_COPY = {
|
|
2038
|
+
cancel: "Cancel",
|
|
2039
|
+
confirm: "Confirm",
|
|
2040
|
+
returnToOrder: "Return to Order",
|
|
2041
|
+
payNow: "Pay Now",
|
|
2042
|
+
tryAgain: "Try Again"
|
|
2043
|
+
};
|
|
2044
|
+
var DISMISS_COPY = {
|
|
2045
|
+
back: "Back",
|
|
2046
|
+
close: "Close",
|
|
2047
|
+
/*
|
|
2048
|
+
* ASKING ABOUT LEAVING IS STILL LEAVING, as far as the button's NAME is concerned: what
|
|
2049
|
+
* a buyer presses it for is the same thing, and "Close, but we will check first" is a
|
|
2050
|
+
* sentence nobody needs read to them.
|
|
2051
|
+
*/
|
|
2052
|
+
abandon: "Close"
|
|
2053
|
+
};
|
|
2054
|
+
var ISLAND_COPY = {
|
|
2055
|
+
order: "Your order",
|
|
2056
|
+
runWeeks: "Weeks of the run",
|
|
2057
|
+
inventories: "Show sessions"
|
|
2058
|
+
};
|
|
2059
|
+
var TIMESLOT_COPY = {
|
|
2060
|
+
/**
|
|
2061
|
+
* WHAT A SLOT WITH NOTHING LEFT SAYS, IN WORDS. The ring is a reading of how full a
|
|
2062
|
+
* slot is, and at zero it draws nothing — an arc of no length is an absence, not a
|
|
2063
|
+
* statement, and a buyer scanning a column for a time cannot be asked to notice an
|
|
2064
|
+
* opacity.
|
|
2065
|
+
*/
|
|
2066
|
+
soldOut: "Sold Out",
|
|
2067
|
+
/**
|
|
2068
|
+
* AND WHAT QUALIFIES THE PRICE — IN THE ROW'S NAME ONLY, not on its face. A column of
|
|
2069
|
+
* forty rows each repeating the word says it forty times and the figure once. A screen
|
|
2070
|
+
* reader gets one row at a time and no column, so a bare "€17.90" beside a time is a
|
|
2071
|
+
* price with no qualifier at all.
|
|
2072
|
+
*/
|
|
2073
|
+
from: "From"
|
|
2074
|
+
};
|
|
2344
2075
|
|
|
2345
|
-
//
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
}
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2076
|
+
// src/island/PartyStepper.tsx
|
|
2077
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
2078
|
+
function UserTypeRow({
|
|
2079
|
+
option,
|
|
2080
|
+
count,
|
|
2081
|
+
atLimit,
|
|
2082
|
+
onAdd,
|
|
2083
|
+
onRemove,
|
|
2084
|
+
onSet,
|
|
2085
|
+
max,
|
|
2086
|
+
onRefuse
|
|
2087
|
+
}) {
|
|
2088
|
+
return /* @__PURE__ */ jsxs("div", { className: "scopetickets-island-party-row", children: [
|
|
2089
|
+
/* @__PURE__ */ jsxs("span", { className: "scopetickets-island-party-row__text", children: [
|
|
2090
|
+
/* @__PURE__ */ jsx2("span", { className: "scopetickets-island-party-row__name", children: option.name }),
|
|
2091
|
+
option.note !== null && /* @__PURE__ */ jsx2("span", { className: "scopetickets-island-party-row__note", children: option.note })
|
|
2092
|
+
] }),
|
|
2093
|
+
/* @__PURE__ */ jsx2(
|
|
2094
|
+
UserTypeStepper,
|
|
2095
|
+
{
|
|
2096
|
+
name: option.name,
|
|
2097
|
+
count,
|
|
2098
|
+
atLimit,
|
|
2099
|
+
onAdd,
|
|
2100
|
+
onRemove,
|
|
2101
|
+
onSet,
|
|
2102
|
+
max,
|
|
2103
|
+
onRefuse
|
|
2104
|
+
}
|
|
2105
|
+
)
|
|
2106
|
+
] });
|
|
2371
2107
|
}
|
|
2372
|
-
function
|
|
2373
|
-
|
|
2374
|
-
|
|
2108
|
+
function UserTypeStepper({
|
|
2109
|
+
name,
|
|
2110
|
+
count,
|
|
2111
|
+
atLimit,
|
|
2112
|
+
onAdd,
|
|
2113
|
+
onRemove,
|
|
2114
|
+
onSet,
|
|
2115
|
+
max,
|
|
2116
|
+
onRefuse
|
|
2117
|
+
}) {
|
|
2118
|
+
const chosen = count > 0;
|
|
2119
|
+
return /* @__PURE__ */ jsxs("span", { className: "scopetickets-island-stepper", "data-expanded": chosen ? "" : void 0, children: [
|
|
2120
|
+
/* @__PURE__ */ jsx2(
|
|
2121
|
+
"span",
|
|
2122
|
+
{
|
|
2123
|
+
className: "scopetickets-island-stepper__opening",
|
|
2124
|
+
"aria-hidden": chosen ? void 0 : "true",
|
|
2125
|
+
children: /* @__PURE__ */ jsxs("span", { className: "scopetickets-island-stepper__opening-inner", children: [
|
|
2126
|
+
/* @__PURE__ */ jsx2(
|
|
2127
|
+
StepperButton,
|
|
2128
|
+
{
|
|
2129
|
+
label: PARTY_COPY.remove(name),
|
|
2130
|
+
onPress: onRemove,
|
|
2131
|
+
kind: "remove",
|
|
2132
|
+
state: chosen ? "LIVE" : "CLOSED"
|
|
2133
|
+
}
|
|
2134
|
+
),
|
|
2135
|
+
/* @__PURE__ */ jsx2(
|
|
2136
|
+
TypedCount,
|
|
2137
|
+
{
|
|
2138
|
+
count,
|
|
2139
|
+
name,
|
|
2140
|
+
onSet,
|
|
2141
|
+
valueClassName: "scopetickets-island-stepper__value",
|
|
2142
|
+
inputClassName: "scopetickets-island-stepper__input",
|
|
2143
|
+
closed: !chosen,
|
|
2144
|
+
max,
|
|
2145
|
+
onRefuse
|
|
2146
|
+
}
|
|
2147
|
+
)
|
|
2148
|
+
] })
|
|
2149
|
+
}
|
|
2150
|
+
),
|
|
2151
|
+
/* @__PURE__ */ jsx2(
|
|
2152
|
+
StepperButton,
|
|
2153
|
+
{
|
|
2154
|
+
label: PARTY_COPY.add(name),
|
|
2155
|
+
onPress: onAdd,
|
|
2156
|
+
kind: "add",
|
|
2157
|
+
state: atLimit ? "REFUSING" : "LIVE"
|
|
2158
|
+
}
|
|
2159
|
+
)
|
|
2160
|
+
] });
|
|
2375
2161
|
}
|
|
2376
|
-
function
|
|
2377
|
-
|
|
2162
|
+
function StepperButton({
|
|
2163
|
+
label,
|
|
2164
|
+
onPress,
|
|
2165
|
+
kind,
|
|
2166
|
+
state = "LIVE"
|
|
2167
|
+
}) {
|
|
2168
|
+
const press = useIslandPress("element");
|
|
2169
|
+
return /* @__PURE__ */ jsx2(
|
|
2170
|
+
"button",
|
|
2171
|
+
{
|
|
2172
|
+
type: "button",
|
|
2173
|
+
className: "scopetickets-island-stepper__button",
|
|
2174
|
+
"data-kind": kind,
|
|
2175
|
+
"aria-label": label,
|
|
2176
|
+
"aria-disabled": state === "REFUSING" ? true : void 0,
|
|
2177
|
+
disabled: state === "CLOSED",
|
|
2178
|
+
onClick: state === "LIVE" ? onPress : void 0,
|
|
2179
|
+
...press,
|
|
2180
|
+
children: /* @__PURE__ */ jsx2("span", { className: "scopetickets-island-stepper__mark", children: kind === "add" ? /* @__PURE__ */ jsx2(PlusMarkIcon, { fill: true, color: "currentColor" }) : /* @__PURE__ */ jsx2(MinusMarkIcon, { fill: true, color: "currentColor" }) })
|
|
2181
|
+
}
|
|
2182
|
+
);
|
|
2378
2183
|
}
|
|
2379
|
-
function
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
const absolute = (x, y) => {
|
|
2389
|
-
const to = linear(x - SOURCE_OFFSET_X - SOURCE_GRID / 2, y - SOURCE_GRID / 2);
|
|
2390
|
-
return { x: TIMER_CENTRE + to.x, y: TIMER_CENTRE + to.y };
|
|
2391
|
-
};
|
|
2392
|
-
const pair = (p) => `${n(p.x)},${n(p.y)}`;
|
|
2393
|
-
const segments = source.match(/[a-zA-Z][^a-zA-Z]*/g) ?? [];
|
|
2394
|
-
return segments.map((segment) => {
|
|
2395
|
-
const command = segment[0];
|
|
2396
|
-
const numbers = (segment.slice(1).match(/-?(?:\d*\.\d+|\d+)/g) ?? []).map(Number);
|
|
2397
|
-
const deltas = (stride) => {
|
|
2398
|
-
if (numbers.length === 0 || numbers.length % stride !== 0) {
|
|
2399
|
-
throw new Error(`path: \`${command}\` wants multiples of ${stride}`);
|
|
2184
|
+
function SoloPartyStepper({ max, name, count, onSet, onRemove, onRefuse }) {
|
|
2185
|
+
return /* @__PURE__ */ jsxs("div", { className: "scopetickets-island-party-solo", children: [
|
|
2186
|
+
/* @__PURE__ */ jsx2(
|
|
2187
|
+
StepperButton,
|
|
2188
|
+
{
|
|
2189
|
+
label: PARTY_COPY.remove(name),
|
|
2190
|
+
onPress: onRemove,
|
|
2191
|
+
kind: "remove",
|
|
2192
|
+
state: count === 0 ? "REFUSING" : "LIVE"
|
|
2400
2193
|
}
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2194
|
+
),
|
|
2195
|
+
/* @__PURE__ */ jsx2(
|
|
2196
|
+
TypedCount,
|
|
2197
|
+
{
|
|
2198
|
+
count,
|
|
2199
|
+
name,
|
|
2200
|
+
onSet,
|
|
2201
|
+
valueClassName: "scopetickets-island-party-solo__value",
|
|
2202
|
+
inputClassName: "scopetickets-island-party-solo__input",
|
|
2203
|
+
max,
|
|
2204
|
+
onRefuse
|
|
2404
2205
|
}
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2206
|
+
),
|
|
2207
|
+
/* @__PURE__ */ jsx2(
|
|
2208
|
+
StepperButton,
|
|
2209
|
+
{
|
|
2210
|
+
label: PARTY_COPY.add(name),
|
|
2211
|
+
onPress: () => onSet(count + 1),
|
|
2212
|
+
kind: "add",
|
|
2213
|
+
state: count >= max ? "REFUSING" : "LIVE"
|
|
2411
2214
|
}
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
case "c":
|
|
2415
|
-
return deltas(6);
|
|
2416
|
-
case "s":
|
|
2417
|
-
return deltas(4);
|
|
2418
|
-
case "Z":
|
|
2419
|
-
case "z":
|
|
2420
|
-
return "Z";
|
|
2421
|
-
default:
|
|
2422
|
-
throw new Error(`path: unsupported command \`${command}\``);
|
|
2423
|
-
}
|
|
2424
|
-
}).join("");
|
|
2425
|
-
}
|
|
2426
|
-
function annulus(outer = RING_OUTER, inner = RING_INNER) {
|
|
2427
|
-
const centre = pointAt(0, 0);
|
|
2428
|
-
return circlePath(centre, outer) + circlePath(centre, inner);
|
|
2429
|
-
}
|
|
2430
|
-
function ringSector(fraction, outer, inner, direction = "cw") {
|
|
2431
|
-
const filled = clampRemaining(fraction);
|
|
2432
|
-
if (filled <= 0 || filled >= 1) return null;
|
|
2433
|
-
const mirrored = direction === "ccw";
|
|
2434
|
-
const sweep = filled * TURN_DEGREES * (mirrored ? -1 : 1);
|
|
2435
|
-
const capRadius = (outer - inner) / 2;
|
|
2436
|
-
const outerStart = pointAt(outer, 0);
|
|
2437
|
-
const outerEnd = pointAt(outer, sweep);
|
|
2438
|
-
const innerEnd = pointAt(inner, sweep);
|
|
2439
|
-
const innerStart = pointAt(inner, 0);
|
|
2440
|
-
const out = mirrored ? 0 : 1;
|
|
2441
|
-
const back = mirrored ? 1 : 0;
|
|
2442
|
-
const large = Math.abs(sweep) > 180 ? 1 : 0;
|
|
2443
|
-
const cap = `${n(capRadius)},${n(capRadius)}`;
|
|
2444
|
-
const at = (p) => `${n(p.x)},${n(p.y)}`;
|
|
2445
|
-
return {
|
|
2446
|
-
d: `M${at(outerStart)}A${n(outer)},${n(outer)} 0 ${large} ${out} ${at(outerEnd)}A${cap} 0 0 ${out} ${at(innerEnd)}A${n(inner)},${n(inner)} 0 ${large} ${back} ${at(innerStart)}A${cap} 0 0 ${out} ${at(outerStart)}Z`
|
|
2447
|
-
};
|
|
2448
|
-
}
|
|
2449
|
-
function ringAnnulus(outer, inner) {
|
|
2450
|
-
return { d: annulus(outer, inner), evenodd: true };
|
|
2451
|
-
}
|
|
2452
|
-
function trackPaths() {
|
|
2453
|
-
return [{ d: annulus(), evenodd: true }];
|
|
2454
|
-
}
|
|
2455
|
-
function timerPaths(remaining) {
|
|
2456
|
-
const left = clampRemaining(remaining);
|
|
2457
|
-
const paths = [];
|
|
2458
|
-
if (left >= 1) paths.push(ringAnnulus(RING_OUTER, RING_INNER));
|
|
2459
|
-
else {
|
|
2460
|
-
const sector = ringSector(left, RING_OUTER, RING_INNER);
|
|
2461
|
-
if (sector) paths.push(sector);
|
|
2462
|
-
}
|
|
2463
|
-
paths.push({ d: transformPath(HAND_SOURCE, handRotation(left)) });
|
|
2464
|
-
return paths;
|
|
2465
|
-
}
|
|
2466
|
-
|
|
2467
|
-
// ../checkout-core/src/geometry/island-counter-ring.ts
|
|
2468
|
-
var RING_OUTER2 = 10;
|
|
2469
|
-
var RING_STROKE = 2.5;
|
|
2470
|
-
var RING_INNER2 = RING_OUTER2 - RING_STROKE;
|
|
2471
|
-
function counterTrackPaths() {
|
|
2472
|
-
return [ringAnnulus(RING_OUTER2, RING_INNER2)];
|
|
2473
|
-
}
|
|
2474
|
-
function counterRingPaths(progress, direction = "cw") {
|
|
2475
|
-
if (progress >= 1) return [ringAnnulus(RING_OUTER2, RING_INNER2)];
|
|
2476
|
-
const sector = ringSector(progress, RING_OUTER2, RING_INNER2, direction);
|
|
2477
|
-
return sector ? [sector] : [];
|
|
2215
|
+
)
|
|
2216
|
+
] });
|
|
2478
2217
|
}
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
size = "1em",
|
|
2489
|
-
title,
|
|
2490
|
-
color = DEFAULT_FILL,
|
|
2491
|
-
trackColor = DEFAULT_TRACK,
|
|
2492
|
-
direction = "cw",
|
|
2493
|
-
track = true
|
|
2218
|
+
function TypedCount({
|
|
2219
|
+
count,
|
|
2220
|
+
name,
|
|
2221
|
+
onSet,
|
|
2222
|
+
valueClassName,
|
|
2223
|
+
inputClassName,
|
|
2224
|
+
onRefuse,
|
|
2225
|
+
closed = false,
|
|
2226
|
+
max
|
|
2494
2227
|
}) {
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2228
|
+
const [typing, setTyping] = useState2(null);
|
|
2229
|
+
const field = useRef2(null);
|
|
2230
|
+
const editing = typing !== null;
|
|
2231
|
+
useEffect2(() => {
|
|
2232
|
+
if (!editing) return;
|
|
2233
|
+
field.current?.focus({ preventScroll: true });
|
|
2234
|
+
}, [editing]);
|
|
2235
|
+
const commit = () => {
|
|
2236
|
+
if (typing === null) return;
|
|
2237
|
+
const asked = Number.parseInt(typing, 10);
|
|
2238
|
+
setTyping(null);
|
|
2239
|
+
if (!Number.isFinite(asked)) return;
|
|
2240
|
+
if (max !== void 0 && asked > max) {
|
|
2241
|
+
onRefuse?.(asked);
|
|
2242
|
+
return;
|
|
2243
|
+
}
|
|
2244
|
+
onRefuse?.(null);
|
|
2245
|
+
onSet(Math.max(0, asked));
|
|
2246
|
+
};
|
|
2247
|
+
if (typing === null) {
|
|
2248
|
+
return /* @__PURE__ */ jsx2(
|
|
2249
|
+
"button",
|
|
2498
2250
|
{
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2251
|
+
type: "button",
|
|
2252
|
+
className: valueClassName,
|
|
2253
|
+
"aria-label": PARTY_COPY.count(count, name),
|
|
2254
|
+
onClick: () => setTyping(String(count)),
|
|
2255
|
+
disabled: closed,
|
|
2256
|
+
children: count
|
|
2502
2257
|
}
|
|
2503
2258
|
);
|
|
2504
2259
|
}
|
|
2505
|
-
return /* @__PURE__ */
|
|
2506
|
-
"
|
|
2260
|
+
return /* @__PURE__ */ jsx2(
|
|
2261
|
+
"input",
|
|
2507
2262
|
{
|
|
2508
|
-
className:
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
)
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
color,
|
|
2526
|
-
title,
|
|
2527
|
-
fill: true
|
|
2528
|
-
}
|
|
2529
|
-
) })
|
|
2530
|
-
]
|
|
2263
|
+
className: inputClassName,
|
|
2264
|
+
type: "text",
|
|
2265
|
+
inputMode: "numeric",
|
|
2266
|
+
pattern: "[0-9]*",
|
|
2267
|
+
size: 1,
|
|
2268
|
+
ref: field,
|
|
2269
|
+
"aria-label": PARTY_COPY.field(name),
|
|
2270
|
+
value: typing,
|
|
2271
|
+
onChange: (event) => setTyping(event.target.value.replace(/\D/g, "")),
|
|
2272
|
+
onBlur: commit,
|
|
2273
|
+
onKeyDown: (event) => {
|
|
2274
|
+
if (event.key === "Enter") commit();
|
|
2275
|
+
else if (event.key === "Escape") setTyping(null);
|
|
2276
|
+
else return;
|
|
2277
|
+
event.preventDefault();
|
|
2278
|
+
event.stopPropagation();
|
|
2279
|
+
}
|
|
2531
2280
|
}
|
|
2532
2281
|
);
|
|
2533
2282
|
}
|
|
2283
|
+
function PartyStepper({
|
|
2284
|
+
userTypes,
|
|
2285
|
+
counts,
|
|
2286
|
+
onChange,
|
|
2287
|
+
max,
|
|
2288
|
+
soloName = PARTY_COPY.soloName,
|
|
2289
|
+
onRefuse,
|
|
2290
|
+
refused = null
|
|
2291
|
+
}) {
|
|
2292
|
+
const headcount = Object.values(counts).reduce((total, n2) => total + n2, 0);
|
|
2293
|
+
const refuse = (asked) => onRefuse?.(asked);
|
|
2294
|
+
const shown = (count) => refused === null ? count : refused;
|
|
2295
|
+
if (userTypes.length === 0) {
|
|
2296
|
+
return /* @__PURE__ */ jsx2("div", { className: "scopetickets-island-party", "data-excess": refused === null ? void 0 : "", children: /* @__PURE__ */ jsx2(
|
|
2297
|
+
SoloPartyStepper,
|
|
2298
|
+
{
|
|
2299
|
+
max,
|
|
2300
|
+
name: soloName,
|
|
2301
|
+
count: shown(headcount),
|
|
2302
|
+
onSet: (next) => {
|
|
2303
|
+
refuse(null);
|
|
2304
|
+
onChange(SOLO_KEY, next);
|
|
2305
|
+
},
|
|
2306
|
+
onRemove: () => refused === null ? onChange(SOLO_KEY, Math.max(0, headcount - 1)) : (refuse(null), onChange(SOLO_KEY, max)),
|
|
2307
|
+
onRefuse: refuse
|
|
2308
|
+
}
|
|
2309
|
+
) });
|
|
2310
|
+
}
|
|
2311
|
+
return /* @__PURE__ */ jsx2("div", { className: "scopetickets-island-party", "data-excess": refused === null ? void 0 : "", children: userTypes.map((option) => /* @__PURE__ */ jsx2(
|
|
2312
|
+
UserTypeRow,
|
|
2313
|
+
{
|
|
2314
|
+
option,
|
|
2315
|
+
count: counts[option.key] ?? 0,
|
|
2316
|
+
atLimit: headcount >= max,
|
|
2317
|
+
onAdd: () => {
|
|
2318
|
+
refuse(null);
|
|
2319
|
+
onChange(option.key, (counts[option.key] ?? 0) + 1);
|
|
2320
|
+
},
|
|
2321
|
+
onRemove: () => {
|
|
2322
|
+
refuse(null);
|
|
2323
|
+
onChange(option.key, Math.max(0, (counts[option.key] ?? 0) - 1));
|
|
2324
|
+
},
|
|
2325
|
+
onSet: (next) => {
|
|
2326
|
+
refuse(null);
|
|
2327
|
+
onChange(option.key, next);
|
|
2328
|
+
},
|
|
2329
|
+
max,
|
|
2330
|
+
onRefuse: refuse
|
|
2331
|
+
},
|
|
2332
|
+
option.key
|
|
2333
|
+
)) });
|
|
2334
|
+
}
|
|
2534
2335
|
|
|
2535
2336
|
// src/island/DayPicker.tsx
|
|
2536
2337
|
import { useCallback as useCallback2, useEffect as useEffect4, useMemo as useMemo2, useState as useState4 } from "react";
|
|
2537
2338
|
|
|
2538
2339
|
// src/island/CalendarMonthHeading.tsx
|
|
2539
|
-
import { jsx as
|
|
2340
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
2540
2341
|
function CalendarMonthHeading({ month }) {
|
|
2541
|
-
return /* @__PURE__ */
|
|
2342
|
+
return /* @__PURE__ */ jsx3("h3", { className: "scopetickets-island-calendar__heading", children: formatMonthName(month) });
|
|
2542
2343
|
}
|
|
2543
2344
|
|
|
2544
2345
|
// src/island/CalendarDayIndicator.tsx
|
|
2545
|
-
import { jsx as
|
|
2346
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
2546
2347
|
var SEGMENTS = 3;
|
|
2547
2348
|
var FILLED_SEGMENTS = {
|
|
2548
2349
|
LOW: 1,
|
|
@@ -2553,21 +2354,21 @@ function CalendarDayIndicator({ level }) {
|
|
|
2553
2354
|
const filled = FILLED_SEGMENTS[level];
|
|
2554
2355
|
return (
|
|
2555
2356
|
// DECORATIVE, and now correctly so.
|
|
2556
|
-
/* @__PURE__ */
|
|
2557
|
-
/* @__PURE__ */
|
|
2357
|
+
/* @__PURE__ */ jsxs2("span", { className: "scopetickets-island-day-indicator", "aria-hidden": "true", children: [
|
|
2358
|
+
/* @__PURE__ */ jsx4(
|
|
2558
2359
|
"span",
|
|
2559
2360
|
{
|
|
2560
2361
|
className: `scopetickets-island-day-indicator__fill scopetickets-island-day-indicator__fill--${level.toLowerCase()}`,
|
|
2561
2362
|
style: { flexGrow: filled }
|
|
2562
2363
|
}
|
|
2563
2364
|
),
|
|
2564
|
-
filled < SEGMENTS ? /* @__PURE__ */
|
|
2365
|
+
filled < SEGMENTS ? /* @__PURE__ */ jsx4("span", { style: { flexGrow: SEGMENTS - filled } }) : null
|
|
2565
2366
|
] })
|
|
2566
2367
|
);
|
|
2567
2368
|
}
|
|
2568
2369
|
|
|
2569
2370
|
// src/island/CalendarDay.tsx
|
|
2570
|
-
import { jsx as
|
|
2371
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
2571
2372
|
function CalendarDay({
|
|
2572
2373
|
cell,
|
|
2573
2374
|
accessory,
|
|
@@ -2579,10 +2380,10 @@ function CalendarDay({
|
|
|
2579
2380
|
const press = useIslandPress("element");
|
|
2580
2381
|
const dimmed = outsideMonth ? { "data-outside-month": "" } : null;
|
|
2581
2382
|
if (cell.kind === "EMPTY") {
|
|
2582
|
-
return /* @__PURE__ */
|
|
2383
|
+
return /* @__PURE__ */ jsx5("span", { className: "scopetickets-island-day", "aria-hidden": "true" });
|
|
2583
2384
|
}
|
|
2584
2385
|
if (isSelectableCalendarCell(cell)) {
|
|
2585
|
-
return /* @__PURE__ */
|
|
2386
|
+
return /* @__PURE__ */ jsx5(
|
|
2586
2387
|
CalendarDayButton,
|
|
2587
2388
|
{
|
|
2588
2389
|
cell,
|
|
@@ -2596,7 +2397,7 @@ function CalendarDay({
|
|
|
2596
2397
|
);
|
|
2597
2398
|
}
|
|
2598
2399
|
if (cell.kind === "UNAVAILABLE") {
|
|
2599
|
-
return /* @__PURE__ */
|
|
2400
|
+
return /* @__PURE__ */ jsx5(
|
|
2600
2401
|
CalendarDayButton,
|
|
2601
2402
|
{
|
|
2602
2403
|
cell,
|
|
@@ -2608,7 +2409,7 @@ function CalendarDay({
|
|
|
2608
2409
|
}
|
|
2609
2410
|
);
|
|
2610
2411
|
}
|
|
2611
|
-
return /* @__PURE__ */
|
|
2412
|
+
return /* @__PURE__ */ jsx5("span", { className: "scopetickets-island-day", ...dimmed, ...press, children: /* @__PURE__ */ jsx5("span", { className: "scopetickets-island-day__well", "data-state": cell.kind, children: /* @__PURE__ */ jsx5("span", { className: "scopetickets-island-day__number", children: cell.dayOfMonth }) }) });
|
|
2612
2413
|
}
|
|
2613
2414
|
function CalendarDayButton({
|
|
2614
2415
|
cell,
|
|
@@ -2621,7 +2422,7 @@ function CalendarDayButton({
|
|
|
2621
2422
|
}) {
|
|
2622
2423
|
const selected = cell.kind === "SELECTED";
|
|
2623
2424
|
const availability = readAvailability(remaining);
|
|
2624
|
-
return /* @__PURE__ */
|
|
2425
|
+
return /* @__PURE__ */ jsx5(
|
|
2625
2426
|
"button",
|
|
2626
2427
|
{
|
|
2627
2428
|
type: "button",
|
|
@@ -2632,17 +2433,17 @@ function CalendarDayButton({
|
|
|
2632
2433
|
"aria-label": availability === null ? label : `${label}, ${availability.announcement}`,
|
|
2633
2434
|
onClick: onSelect ? () => onSelect(cell.day) : void 0,
|
|
2634
2435
|
...press,
|
|
2635
|
-
children: /* @__PURE__ */
|
|
2636
|
-
/* @__PURE__ */
|
|
2637
|
-
cell.kind === "UNAVAILABLE" ? /* @__PURE__ */
|
|
2638
|
-
accessory === "LINE" && availability !== null ? /* @__PURE__ */
|
|
2436
|
+
children: /* @__PURE__ */ jsxs3("span", { className: "scopetickets-island-day__well", "data-state": cell.kind, children: [
|
|
2437
|
+
/* @__PURE__ */ jsx5("span", { className: "scopetickets-island-day__number", children: cell.dayOfMonth }),
|
|
2438
|
+
cell.kind === "UNAVAILABLE" ? /* @__PURE__ */ jsx5("span", { className: "scopetickets-island-day__strike", "aria-hidden": "true" }) : null,
|
|
2439
|
+
accessory === "LINE" && availability !== null ? /* @__PURE__ */ jsx5("span", { className: "scopetickets-island-day__accessory", children: /* @__PURE__ */ jsx5(CalendarDayIndicator, { level: availability.level }) }) : null
|
|
2639
2440
|
] })
|
|
2640
2441
|
}
|
|
2641
2442
|
);
|
|
2642
2443
|
}
|
|
2643
2444
|
|
|
2644
2445
|
// src/island/CalendarRunGrid.tsx
|
|
2645
|
-
import { jsx as
|
|
2446
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
2646
2447
|
function CalendarRunGrid({
|
|
2647
2448
|
series,
|
|
2648
2449
|
weeks,
|
|
@@ -2653,10 +2454,10 @@ function CalendarRunGrid({
|
|
|
2653
2454
|
selectedDay,
|
|
2654
2455
|
onSelectDay
|
|
2655
2456
|
}) {
|
|
2656
|
-
return /* @__PURE__ */
|
|
2457
|
+
return /* @__PURE__ */ jsx6("div", { className: "scopetickets-island-calendar__grid", children: weeks.map((weekStart) => (
|
|
2657
2458
|
// A presentational row: the seven columns are a layout, and announcing "row 3
|
|
2658
2459
|
// of 9" describes the grid rather than the run.
|
|
2659
|
-
/* @__PURE__ */
|
|
2460
|
+
/* @__PURE__ */ jsx6("div", { className: "scopetickets-island-calendar__week", children: buildWeekRow(series, weekStart, { today, selectedDay }).map((cell, dayIndex) => /* @__PURE__ */ jsx6(
|
|
2660
2461
|
CalendarDay,
|
|
2661
2462
|
{
|
|
2662
2463
|
cell,
|
|
@@ -2678,7 +2479,7 @@ import {
|
|
|
2678
2479
|
useRef as useRef3,
|
|
2679
2480
|
useState as useState3
|
|
2680
2481
|
} from "react";
|
|
2681
|
-
import { jsx as
|
|
2482
|
+
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2682
2483
|
var WHEEL_IDLE_MS = 200;
|
|
2683
2484
|
var CALENDAR_DRAG_SLOP = 4;
|
|
2684
2485
|
function CalendarScroller({
|
|
@@ -2816,7 +2617,7 @@ function CalendarScroller({
|
|
|
2816
2617
|
},
|
|
2817
2618
|
[]
|
|
2818
2619
|
);
|
|
2819
|
-
return /* @__PURE__ */
|
|
2620
|
+
return /* @__PURE__ */ jsxs4(
|
|
2820
2621
|
"div",
|
|
2821
2622
|
{
|
|
2822
2623
|
ref: viewportRef,
|
|
@@ -2833,8 +2634,8 @@ function CalendarScroller({
|
|
|
2833
2634
|
onPointerCancel,
|
|
2834
2635
|
onClickCapture,
|
|
2835
2636
|
children: [
|
|
2836
|
-
/* @__PURE__ */
|
|
2837
|
-
/* @__PURE__ */
|
|
2637
|
+
/* @__PURE__ */ jsx7("div", { className: "scopetickets-island-calendar-scroller__window", "aria-hidden": "true" }),
|
|
2638
|
+
/* @__PURE__ */ jsx7(
|
|
2838
2639
|
"div",
|
|
2839
2640
|
{
|
|
2840
2641
|
ref: trackRef,
|
|
@@ -2852,19 +2653,20 @@ function CalendarScroller({
|
|
|
2852
2653
|
}
|
|
2853
2654
|
|
|
2854
2655
|
// src/island/CalendarWeekdayNames.tsx
|
|
2855
|
-
import { jsx as
|
|
2656
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
2856
2657
|
var WEEKDAY_NAMES = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
|
|
2857
2658
|
function CalendarWeekdayNames() {
|
|
2858
2659
|
return (
|
|
2859
2660
|
// `aria-hidden`, and it is not a shortcut.
|
|
2860
|
-
/* @__PURE__ */
|
|
2661
|
+
/* @__PURE__ */ jsx8("div", { className: "scopetickets-island-calendar__weekdays", "aria-hidden": "true", children: WEEKDAY_NAMES.map((name) => /* @__PURE__ */ jsx8("span", { className: "scopetickets-island-calendar__weekday", children: name }, name)) })
|
|
2861
2662
|
);
|
|
2862
2663
|
}
|
|
2863
2664
|
|
|
2864
2665
|
// src/island/DayPicker.tsx
|
|
2865
|
-
import { jsx as
|
|
2666
|
+
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
2866
2667
|
function DayPicker({
|
|
2867
2668
|
series,
|
|
2669
|
+
offered = series,
|
|
2868
2670
|
today,
|
|
2869
2671
|
selectedDay,
|
|
2870
2672
|
onSelectDay,
|
|
@@ -2875,7 +2677,7 @@ function DayPicker({
|
|
|
2875
2677
|
const weeks = useMemo2(() => weeksInCalendar(series), [series]);
|
|
2876
2678
|
const starts = useMemo2(() => monthStartRows(weeks), [weeks]);
|
|
2877
2679
|
const [row, setRow] = useState4(
|
|
2878
|
-
() => monthOpeningRow(weeks, starts, selectedDay ?? soonestRelevantDay(
|
|
2680
|
+
() => monthOpeningRow(weeks, starts, selectedDay ?? soonestRelevantDay(offered, today))
|
|
2879
2681
|
);
|
|
2880
2682
|
const [shownRow, setShownRow] = useState4(row);
|
|
2881
2683
|
const currentMonth = monthAtRow(starts, shownRow);
|
|
@@ -2895,10 +2697,10 @@ function DayPicker({
|
|
|
2895
2697
|
[starts, currentMonth, onSelectDay]
|
|
2896
2698
|
);
|
|
2897
2699
|
if (weeks.length === 0) return null;
|
|
2898
|
-
return /* @__PURE__ */
|
|
2899
|
-
currentMonth !== null && /* @__PURE__ */
|
|
2900
|
-
/* @__PURE__ */
|
|
2901
|
-
/* @__PURE__ */
|
|
2700
|
+
return /* @__PURE__ */ jsxs5("div", { className: "scopetickets-island-calendar", "data-accessory": accessory, children: [
|
|
2701
|
+
currentMonth !== null && /* @__PURE__ */ jsx9(CalendarMonthHeading, { month: currentMonth }),
|
|
2702
|
+
/* @__PURE__ */ jsx9(CalendarWeekdayNames, {}),
|
|
2703
|
+
/* @__PURE__ */ jsx9(
|
|
2902
2704
|
CalendarScroller,
|
|
2903
2705
|
{
|
|
2904
2706
|
rowCount: weeks.length,
|
|
@@ -2906,10 +2708,10 @@ function DayPicker({
|
|
|
2906
2708
|
onRowChange: setRow,
|
|
2907
2709
|
onRowPreview: setShownRow,
|
|
2908
2710
|
label: ISLAND_COPY.runWeeks,
|
|
2909
|
-
children: /* @__PURE__ */
|
|
2711
|
+
children: /* @__PURE__ */ jsx9(
|
|
2910
2712
|
CalendarRunGrid,
|
|
2911
2713
|
{
|
|
2912
|
-
series,
|
|
2714
|
+
series: offered,
|
|
2913
2715
|
weeks,
|
|
2914
2716
|
currentMonth,
|
|
2915
2717
|
accessory,
|
|
@@ -2924,11 +2726,204 @@ function DayPicker({
|
|
|
2924
2726
|
] });
|
|
2925
2727
|
}
|
|
2926
2728
|
|
|
2729
|
+
// src/island/CounterRing.tsx
|
|
2730
|
+
import { IconGlyph } from "@scopetickets/icons";
|
|
2731
|
+
|
|
2732
|
+
// ../checkout-core/src/geometry/island-timer.ts
|
|
2733
|
+
var TIMER_GRID = 20;
|
|
2734
|
+
var TIMER_CENTRE = TIMER_GRID / 2;
|
|
2735
|
+
var RING_OUTER = 10;
|
|
2736
|
+
var RING_INNER = 8;
|
|
2737
|
+
var RING_RADIUS = (RING_OUTER + RING_INNER) / 2;
|
|
2738
|
+
var RING_WIDTH = RING_OUTER - RING_INNER;
|
|
2739
|
+
var TURN_DEGREES = 360;
|
|
2740
|
+
var SOURCE_GRID = 100;
|
|
2741
|
+
var SOURCE_OFFSET_X = 0.2;
|
|
2742
|
+
var SOURCE_SCALE = TIMER_GRID / SOURCE_GRID;
|
|
2743
|
+
var HAND_SOURCE = "M55.2,49.9l-.7-26c0-1-.4-2.1-1.2-2.9-1.7-1.7-4.4-1.7-6,0s-1.2,1.8-1.2,2.9l-.7,26c0,1.3.4,2.7,1.5,3.7,2,2,5.1,2,7.1,0s1.5-2.4,1.5-3.7Z";
|
|
2744
|
+
function n(value) {
|
|
2745
|
+
const rounded = Number(value.toFixed(3));
|
|
2746
|
+
return String(Object.is(rounded, -0) ? 0 : rounded);
|
|
2747
|
+
}
|
|
2748
|
+
function pointAt(radius, degrees) {
|
|
2749
|
+
const radians = degrees * Math.PI / 180;
|
|
2750
|
+
return {
|
|
2751
|
+
x: TIMER_CENTRE + radius * Math.sin(radians),
|
|
2752
|
+
y: TIMER_CENTRE - radius * Math.cos(radians)
|
|
2753
|
+
};
|
|
2754
|
+
}
|
|
2755
|
+
function circlePath(centre, radius) {
|
|
2756
|
+
const r = `${n(radius)},${n(radius)}`;
|
|
2757
|
+
return `M${n(centre.x - radius)},${n(centre.y)}A${r} 0 1 0 ${n(centre.x + radius)},${n(centre.y)}A${r} 0 1 0 ${n(centre.x - radius)},${n(centre.y)}Z`;
|
|
2758
|
+
}
|
|
2759
|
+
function clampRemaining(remaining) {
|
|
2760
|
+
if (!Number.isFinite(remaining)) return 0;
|
|
2761
|
+
return Math.min(1, Math.max(0, remaining));
|
|
2762
|
+
}
|
|
2763
|
+
function handRotation(remaining) {
|
|
2764
|
+
return (clampRemaining(remaining) - 1) * TURN_DEGREES;
|
|
2765
|
+
}
|
|
2766
|
+
function transformPath(source, degrees) {
|
|
2767
|
+
const radians = degrees * Math.PI / 180;
|
|
2768
|
+
const cos = Math.cos(radians);
|
|
2769
|
+
const sin = Math.sin(radians);
|
|
2770
|
+
const linear = (x, y) => {
|
|
2771
|
+
const sx = x * SOURCE_SCALE;
|
|
2772
|
+
const sy = y * SOURCE_SCALE;
|
|
2773
|
+
return { x: sx * cos - sy * sin, y: sx * sin + sy * cos };
|
|
2774
|
+
};
|
|
2775
|
+
const absolute = (x, y) => {
|
|
2776
|
+
const to = linear(x - SOURCE_OFFSET_X - SOURCE_GRID / 2, y - SOURCE_GRID / 2);
|
|
2777
|
+
return { x: TIMER_CENTRE + to.x, y: TIMER_CENTRE + to.y };
|
|
2778
|
+
};
|
|
2779
|
+
const pair = (p) => `${n(p.x)},${n(p.y)}`;
|
|
2780
|
+
const segments = source.match(/[a-zA-Z][^a-zA-Z]*/g) ?? [];
|
|
2781
|
+
return segments.map((segment) => {
|
|
2782
|
+
const command = segment[0];
|
|
2783
|
+
const numbers = (segment.slice(1).match(/-?(?:\d*\.\d+|\d+)/g) ?? []).map(Number);
|
|
2784
|
+
const deltas = (stride) => {
|
|
2785
|
+
if (numbers.length === 0 || numbers.length % stride !== 0) {
|
|
2786
|
+
throw new Error(`path: \`${command}\` wants multiples of ${stride}`);
|
|
2787
|
+
}
|
|
2788
|
+
const out = [];
|
|
2789
|
+
for (let i = 0; i < numbers.length; i += 2) {
|
|
2790
|
+
out.push(pair(linear(numbers[i], numbers[i + 1])));
|
|
2791
|
+
}
|
|
2792
|
+
return command + out.join(" ");
|
|
2793
|
+
};
|
|
2794
|
+
switch (command) {
|
|
2795
|
+
case "M": {
|
|
2796
|
+
if (numbers.length !== 2) throw new Error("path: `M` wants exactly one point");
|
|
2797
|
+
return `M${pair(absolute(numbers[0], numbers[1]))}`;
|
|
2798
|
+
}
|
|
2799
|
+
case "l":
|
|
2800
|
+
return deltas(2);
|
|
2801
|
+
case "c":
|
|
2802
|
+
return deltas(6);
|
|
2803
|
+
case "s":
|
|
2804
|
+
return deltas(4);
|
|
2805
|
+
case "Z":
|
|
2806
|
+
case "z":
|
|
2807
|
+
return "Z";
|
|
2808
|
+
default:
|
|
2809
|
+
throw new Error(`path: unsupported command \`${command}\``);
|
|
2810
|
+
}
|
|
2811
|
+
}).join("");
|
|
2812
|
+
}
|
|
2813
|
+
function annulus(outer = RING_OUTER, inner = RING_INNER) {
|
|
2814
|
+
const centre = pointAt(0, 0);
|
|
2815
|
+
return circlePath(centre, outer) + circlePath(centre, inner);
|
|
2816
|
+
}
|
|
2817
|
+
function ringSector(fraction, outer, inner, direction = "cw") {
|
|
2818
|
+
const filled = clampRemaining(fraction);
|
|
2819
|
+
if (filled <= 0 || filled >= 1) return null;
|
|
2820
|
+
const mirrored = direction === "ccw";
|
|
2821
|
+
const sweep = filled * TURN_DEGREES * (mirrored ? -1 : 1);
|
|
2822
|
+
const capRadius = (outer - inner) / 2;
|
|
2823
|
+
const outerStart = pointAt(outer, 0);
|
|
2824
|
+
const outerEnd = pointAt(outer, sweep);
|
|
2825
|
+
const innerEnd = pointAt(inner, sweep);
|
|
2826
|
+
const innerStart = pointAt(inner, 0);
|
|
2827
|
+
const out = mirrored ? 0 : 1;
|
|
2828
|
+
const back = mirrored ? 1 : 0;
|
|
2829
|
+
const large = Math.abs(sweep) > 180 ? 1 : 0;
|
|
2830
|
+
const cap = `${n(capRadius)},${n(capRadius)}`;
|
|
2831
|
+
const at = (p) => `${n(p.x)},${n(p.y)}`;
|
|
2832
|
+
return {
|
|
2833
|
+
d: `M${at(outerStart)}A${n(outer)},${n(outer)} 0 ${large} ${out} ${at(outerEnd)}A${cap} 0 0 ${out} ${at(innerEnd)}A${n(inner)},${n(inner)} 0 ${large} ${back} ${at(innerStart)}A${cap} 0 0 ${out} ${at(outerStart)}Z`
|
|
2834
|
+
};
|
|
2835
|
+
}
|
|
2836
|
+
function ringAnnulus(outer, inner) {
|
|
2837
|
+
return { d: annulus(outer, inner), evenodd: true };
|
|
2838
|
+
}
|
|
2839
|
+
function trackPaths() {
|
|
2840
|
+
return [{ d: annulus(), evenodd: true }];
|
|
2841
|
+
}
|
|
2842
|
+
function timerPaths(remaining) {
|
|
2843
|
+
const left = clampRemaining(remaining);
|
|
2844
|
+
const paths = [];
|
|
2845
|
+
if (left >= 1) paths.push(ringAnnulus(RING_OUTER, RING_INNER));
|
|
2846
|
+
else {
|
|
2847
|
+
const sector = ringSector(left, RING_OUTER, RING_INNER);
|
|
2848
|
+
if (sector) paths.push(sector);
|
|
2849
|
+
}
|
|
2850
|
+
paths.push({ d: transformPath(HAND_SOURCE, handRotation(left)) });
|
|
2851
|
+
return paths;
|
|
2852
|
+
}
|
|
2853
|
+
|
|
2854
|
+
// ../checkout-core/src/geometry/island-counter-ring.ts
|
|
2855
|
+
var RING_OUTER2 = 10;
|
|
2856
|
+
var RING_STROKE = 2.5;
|
|
2857
|
+
var RING_INNER2 = RING_OUTER2 - RING_STROKE;
|
|
2858
|
+
function counterTrackPaths() {
|
|
2859
|
+
return [ringAnnulus(RING_OUTER2, RING_INNER2)];
|
|
2860
|
+
}
|
|
2861
|
+
function counterRingPaths(progress, direction = "cw") {
|
|
2862
|
+
if (progress >= 1) return [ringAnnulus(RING_OUTER2, RING_INNER2)];
|
|
2863
|
+
const sector = ringSector(progress, RING_OUTER2, RING_INNER2, direction);
|
|
2864
|
+
return sector ? [sector] : [];
|
|
2865
|
+
}
|
|
2866
|
+
|
|
2867
|
+
// src/island/CounterRing.tsx
|
|
2868
|
+
import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2869
|
+
var LAYER = { position: "absolute", inset: 0 };
|
|
2870
|
+
var DEFAULT_FILL = "var(--scopetickets-island-counter-ring-fill)";
|
|
2871
|
+
var DEFAULT_TRACK = "var(--scopetickets-island-counter-ring-track)";
|
|
2872
|
+
function CounterRing({
|
|
2873
|
+
progress,
|
|
2874
|
+
complete,
|
|
2875
|
+
size = "1em",
|
|
2876
|
+
title,
|
|
2877
|
+
color = DEFAULT_FILL,
|
|
2878
|
+
trackColor = DEFAULT_TRACK,
|
|
2879
|
+
direction = "cw",
|
|
2880
|
+
track = true
|
|
2881
|
+
}) {
|
|
2882
|
+
if (complete !== void 0) {
|
|
2883
|
+
return /* @__PURE__ */ jsx10(
|
|
2884
|
+
"span",
|
|
2885
|
+
{
|
|
2886
|
+
className: "scopetickets-island-counter-ring",
|
|
2887
|
+
style: { width: size, height: size, flex: "none" },
|
|
2888
|
+
children: /* @__PURE__ */ jsx10(ContentFlag, { tone: complete, title })
|
|
2889
|
+
}
|
|
2890
|
+
);
|
|
2891
|
+
}
|
|
2892
|
+
return /* @__PURE__ */ jsxs6(
|
|
2893
|
+
"span",
|
|
2894
|
+
{
|
|
2895
|
+
className: "scopetickets-island-counter-ring",
|
|
2896
|
+
style: { position: "relative", display: "block", width: size, height: size, flex: "none" },
|
|
2897
|
+
children: [
|
|
2898
|
+
track ? /* @__PURE__ */ jsx10("span", { style: LAYER, children: /* @__PURE__ */ jsx10(
|
|
2899
|
+
IconGlyph,
|
|
2900
|
+
{
|
|
2901
|
+
glyph: "StepCompletionProgressRingTrack",
|
|
2902
|
+
paths: counterTrackPaths(),
|
|
2903
|
+
color: trackColor,
|
|
2904
|
+
fill: true
|
|
2905
|
+
}
|
|
2906
|
+
) }) : null,
|
|
2907
|
+
/* @__PURE__ */ jsx10("span", { style: LAYER, children: /* @__PURE__ */ jsx10(
|
|
2908
|
+
IconGlyph,
|
|
2909
|
+
{
|
|
2910
|
+
glyph: "StepCompletionProgressRing",
|
|
2911
|
+
paths: counterRingPaths(progress, direction),
|
|
2912
|
+
color,
|
|
2913
|
+
title,
|
|
2914
|
+
fill: true
|
|
2915
|
+
}
|
|
2916
|
+
) })
|
|
2917
|
+
]
|
|
2918
|
+
}
|
|
2919
|
+
);
|
|
2920
|
+
}
|
|
2921
|
+
|
|
2927
2922
|
// src/island/TimeslotPicker.tsx
|
|
2928
2923
|
import { useMemo as useMemo3 } from "react";
|
|
2929
2924
|
|
|
2930
2925
|
// src/island/Timeslot.tsx
|
|
2931
|
-
import { Fragment, jsx as
|
|
2926
|
+
import { Fragment, jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2932
2927
|
var REMAINING_SIZE = "var(--scopetickets-island-space-4)";
|
|
2933
2928
|
var SELECTED_ARC = "var(--scopetickets-island-timeslot-ring-selected)";
|
|
2934
2929
|
var TRACK = "var(--scopetickets-island-timeslot-track)";
|
|
@@ -2936,20 +2931,20 @@ var SELECTED_TRACK = "var(--scopetickets-island-timeslot-track-selected)";
|
|
|
2936
2931
|
var { soldOut: SOLD_OUT, from: FROM } = TIMESLOT_COPY;
|
|
2937
2932
|
function Timeslot({ cell, accessory, onSelect }) {
|
|
2938
2933
|
if (isDatePickerCellSelectable(cell.state)) {
|
|
2939
|
-
return /* @__PURE__ */
|
|
2934
|
+
return /* @__PURE__ */ jsx11(TimeslotButton, { cell, accessory, onSelect });
|
|
2940
2935
|
}
|
|
2941
|
-
return /* @__PURE__ */
|
|
2936
|
+
return /* @__PURE__ */ jsx11(TimeslotFixed, { cell });
|
|
2942
2937
|
}
|
|
2943
2938
|
function TimeslotRow({ cell }) {
|
|
2944
2939
|
const price = slotPrice(cell);
|
|
2945
2940
|
return /* @__PURE__ */ jsxs7("span", { className: "scopetickets-island-timeslot__times", children: [
|
|
2946
|
-
/* @__PURE__ */
|
|
2941
|
+
/* @__PURE__ */ jsx11("span", { className: "scopetickets-island-timeslot__time", children: cell.slot.startTime }),
|
|
2947
2942
|
cell.slot.endTime === null ? null : /* @__PURE__ */ jsxs7(Fragment, { children: [
|
|
2948
|
-
/* @__PURE__ */
|
|
2949
|
-
/* @__PURE__ */
|
|
2943
|
+
/* @__PURE__ */ jsx11("span", { className: "scopetickets-island-timeslot__dash", "aria-hidden": "true", children: "-" }),
|
|
2944
|
+
/* @__PURE__ */ jsx11("span", { className: "scopetickets-island-timeslot__time", children: cell.slot.endTime })
|
|
2950
2945
|
] }),
|
|
2951
2946
|
/* @__PURE__ */ jsxs7("span", { className: "scopetickets-island-timeslot__trailing", children: [
|
|
2952
|
-
price === null ? null : /* @__PURE__ */
|
|
2947
|
+
price === null ? null : /* @__PURE__ */ jsx11("span", { className: "scopetickets-island-timeslot__price", children: price }),
|
|
2953
2948
|
cell.state === "UNAVAILABLE" ? (
|
|
2954
2949
|
/*
|
|
2955
2950
|
* THE WORDS INSTEAD OF THE MARK, AND ONLY WHERE THE MARK WOULD SAY NOTHING.
|
|
@@ -2959,8 +2954,8 @@ function TimeslotRow({ cell }) {
|
|
|
2959
2954
|
* merely BEGUN keeps its ring — it still has seats, and "Sold Out" over them
|
|
2960
2955
|
* would be false.
|
|
2961
2956
|
*/
|
|
2962
|
-
/* @__PURE__ */
|
|
2963
|
-
) : cell.slot.remaining === null ? null : /* @__PURE__ */
|
|
2957
|
+
/* @__PURE__ */ jsx11("span", { className: "scopetickets-island-timeslot__soldout", children: SOLD_OUT })
|
|
2958
|
+
) : cell.slot.remaining === null ? null : /* @__PURE__ */ jsx11("span", { className: "scopetickets-island-timeslot__remaining", children: /* @__PURE__ */ jsx11(
|
|
2964
2959
|
CounterRing,
|
|
2965
2960
|
{
|
|
2966
2961
|
progress: cell.slot.remaining,
|
|
@@ -2987,7 +2982,7 @@ function TimeslotButton({ cell, accessory, onSelect }) {
|
|
|
2987
2982
|
const press = useIslandPress("element");
|
|
2988
2983
|
const selected = cell.state === "SELECTED";
|
|
2989
2984
|
const availability = readAvailability(cell.slot.remaining);
|
|
2990
|
-
return /* @__PURE__ */
|
|
2985
|
+
return /* @__PURE__ */ jsx11(
|
|
2991
2986
|
"button",
|
|
2992
2987
|
{
|
|
2993
2988
|
type: "button",
|
|
@@ -2997,22 +2992,22 @@ function TimeslotButton({ cell, accessory, onSelect }) {
|
|
|
2997
2992
|
onClick: () => onSelect(cell.slot.startTime),
|
|
2998
2993
|
...press,
|
|
2999
2994
|
children: /* @__PURE__ */ jsxs7("span", { className: "scopetickets-island-timeslot__pill", "data-state": cell.state, children: [
|
|
3000
|
-
/* @__PURE__ */
|
|
3001
|
-
accessory === "LINE" && availability !== null ? /* @__PURE__ */
|
|
2995
|
+
/* @__PURE__ */ jsx11(TimeslotRow, { cell }),
|
|
2996
|
+
accessory === "LINE" && availability !== null ? /* @__PURE__ */ jsx11("span", { className: "scopetickets-island-timeslot__accessory", children: /* @__PURE__ */ jsx11(CalendarDayIndicator, { level: availability.level }) }) : null
|
|
3002
2997
|
] })
|
|
3003
2998
|
}
|
|
3004
2999
|
);
|
|
3005
3000
|
}
|
|
3006
3001
|
function TimeslotFixed({ cell }) {
|
|
3007
|
-
return /* @__PURE__ */
|
|
3002
|
+
return /* @__PURE__ */ jsx11("span", { className: "scopetickets-island-timeslot", children: /* @__PURE__ */ jsx11("span", { className: "scopetickets-island-timeslot__pill", "data-state": cell.state, children: /* @__PURE__ */ jsx11(TimeslotRow, { cell }) }) });
|
|
3008
3003
|
}
|
|
3009
3004
|
|
|
3010
3005
|
// src/island/TimeslotGroupSection.tsx
|
|
3011
|
-
import { jsx as
|
|
3006
|
+
import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3012
3007
|
function TimeslotGroupSection({ group, accessory, onSelect }) {
|
|
3013
3008
|
return /* @__PURE__ */ jsxs8("section", { className: "scopetickets-island-timeslots__group", children: [
|
|
3014
|
-
group.label === null ? null : /* @__PURE__ */
|
|
3015
|
-
/* @__PURE__ */
|
|
3009
|
+
group.label === null ? null : /* @__PURE__ */ jsx12("h4", { className: "scopetickets-island-timeslots__label", children: group.label }),
|
|
3010
|
+
/* @__PURE__ */ jsx12("div", { className: "scopetickets-island-timeslots__list", children: group.cells.map((cell, index) => /* @__PURE__ */ jsx12(
|
|
3016
3011
|
Timeslot,
|
|
3017
3012
|
{
|
|
3018
3013
|
cell,
|
|
@@ -3025,7 +3020,7 @@ function TimeslotGroupSection({ group, accessory, onSelect }) {
|
|
|
3025
3020
|
}
|
|
3026
3021
|
|
|
3027
3022
|
// src/island/TimeslotPicker.tsx
|
|
3028
|
-
import { jsx as
|
|
3023
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
3029
3024
|
function TimeslotPicker({
|
|
3030
3025
|
slots,
|
|
3031
3026
|
selection,
|
|
@@ -3039,14 +3034,14 @@ function TimeslotPicker({
|
|
|
3039
3034
|
() => buildTimeslotGroups(slots, { selection, today, nowTime, grouping }),
|
|
3040
3035
|
[slots, selection, today, nowTime, grouping]
|
|
3041
3036
|
);
|
|
3042
|
-
return /* @__PURE__ */
|
|
3037
|
+
return /* @__PURE__ */ jsx13("div", { className: "scopetickets-island-timeslots", children: groups.map((group) => /* @__PURE__ */ jsx13(
|
|
3043
3038
|
TimeslotGroupSection,
|
|
3044
3039
|
{
|
|
3045
3040
|
group,
|
|
3046
3041
|
accessory,
|
|
3047
3042
|
onSelect
|
|
3048
3043
|
},
|
|
3049
|
-
group.
|
|
3044
|
+
group.key
|
|
3050
3045
|
)) });
|
|
3051
3046
|
}
|
|
3052
3047
|
|
|
@@ -3055,7 +3050,7 @@ import { useEffect as useEffect6, useReducer } from "react";
|
|
|
3055
3050
|
|
|
3056
3051
|
// src/island/CalendarWeekSection.tsx
|
|
3057
3052
|
import { useCallback as useCallback3, useEffect as useEffect5, useLayoutEffect, useRef as useRef4, useState as useState5 } from "react";
|
|
3058
|
-
import { jsx as
|
|
3053
|
+
import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3059
3054
|
function CalendarWeekSection({
|
|
3060
3055
|
series,
|
|
3061
3056
|
today,
|
|
@@ -3111,15 +3106,15 @@ function CalendarWeekSection({
|
|
|
3111
3106
|
}, [weeks.length, visibleWeek, selectedWeek, selectedDay, onVisibleMonthChange]);
|
|
3112
3107
|
if (weeks.length === 0) return null;
|
|
3113
3108
|
return /* @__PURE__ */ jsxs9("div", { className: "scopetickets-island-week", children: [
|
|
3114
|
-
/* @__PURE__ */
|
|
3115
|
-
/* @__PURE__ */
|
|
3109
|
+
/* @__PURE__ */ jsx14(CalendarWeekdayNames, {}),
|
|
3110
|
+
/* @__PURE__ */ jsx14("div", { className: "scopetickets-island-week__pager", ref: pagerRef, onScroll: paint, children: weeks.map((weekStart, index) => /* @__PURE__ */ jsx14(
|
|
3116
3111
|
"div",
|
|
3117
3112
|
{
|
|
3118
3113
|
className: "scopetickets-island-week__page",
|
|
3119
3114
|
ref: (node) => {
|
|
3120
3115
|
pageRefs.current[index] = node;
|
|
3121
3116
|
},
|
|
3122
|
-
children: /* @__PURE__ */
|
|
3117
|
+
children: /* @__PURE__ */ jsx14("div", { className: "scopetickets-island-week__row", children: buildWeekRow(series, weekStart, { today, selectedDay }).map((cell, dayIndex) => /* @__PURE__ */ jsx14(
|
|
3123
3118
|
CalendarDay,
|
|
3124
3119
|
{
|
|
3125
3120
|
cell,
|
|
@@ -3137,14 +3132,14 @@ function CalendarWeekSection({
|
|
|
3137
3132
|
}
|
|
3138
3133
|
|
|
3139
3134
|
// src/island/SelectedDayHeading.tsx
|
|
3140
|
-
import { jsx as
|
|
3135
|
+
import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3141
3136
|
function SelectedDayHeading({ day }) {
|
|
3142
3137
|
return /* @__PURE__ */ jsxs10("h3", { className: "scopetickets-island-day-heading", children: [
|
|
3143
3138
|
/* @__PURE__ */ jsxs10("span", { className: "scopetickets-island-day-heading__weekday", children: [
|
|
3144
3139
|
formatDayWeekday(day),
|
|
3145
3140
|
","
|
|
3146
3141
|
] }),
|
|
3147
|
-
/* @__PURE__ */
|
|
3142
|
+
/* @__PURE__ */ jsx15("span", { className: "scopetickets-island-day-heading__date", children: formatDayDate(day) })
|
|
3148
3143
|
] });
|
|
3149
3144
|
}
|
|
3150
3145
|
|
|
@@ -3194,7 +3189,7 @@ var DAY_SWAP_OUT_ANIMATION = "scopetickets-island-day-swap-out";
|
|
|
3194
3189
|
var DAY_SWAP_IN_ANIMATION = "scopetickets-island-day-swap-in";
|
|
3195
3190
|
|
|
3196
3191
|
// src/island/TimePicker.tsx
|
|
3197
|
-
import { jsx as
|
|
3192
|
+
import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3198
3193
|
function TimePicker({
|
|
3199
3194
|
series,
|
|
3200
3195
|
today,
|
|
@@ -3205,7 +3200,8 @@ function TimePicker({
|
|
|
3205
3200
|
onSelectTime,
|
|
3206
3201
|
remaining,
|
|
3207
3202
|
accessory = DATE_PICKER_ACCESSORY,
|
|
3208
|
-
onVisibleMonthChange
|
|
3203
|
+
onVisibleMonthChange,
|
|
3204
|
+
grouping
|
|
3209
3205
|
}) {
|
|
3210
3206
|
const [swap, dispatch] = useReducer(reduceDaySwap, { day: selection.day, slots }, daySwapAtRest);
|
|
3211
3207
|
useEffect6(() => {
|
|
@@ -3220,7 +3216,7 @@ function TimePicker({
|
|
|
3220
3216
|
};
|
|
3221
3217
|
const shownSelection = swap.shown.day === selection.day ? selection : { day: swap.shown.day, startTime: null };
|
|
3222
3218
|
return /* @__PURE__ */ jsxs11("div", { className: "scopetickets-island-time", "data-accessory": accessory, children: [
|
|
3223
|
-
/* @__PURE__ */
|
|
3219
|
+
/* @__PURE__ */ jsx16(
|
|
3224
3220
|
CalendarWeekSection,
|
|
3225
3221
|
{
|
|
3226
3222
|
series,
|
|
@@ -3240,8 +3236,8 @@ function TimePicker({
|
|
|
3240
3236
|
style: swap.phase === "REST" ? void 0 : { "--scopetickets-island-swap-sign": swap.sign },
|
|
3241
3237
|
onAnimationEnd: onSwapAnimationEnd,
|
|
3242
3238
|
children: [
|
|
3243
|
-
/* @__PURE__ */
|
|
3244
|
-
/* @__PURE__ */
|
|
3239
|
+
/* @__PURE__ */ jsx16(SelectedDayHeading, { day: swap.shown.day }),
|
|
3240
|
+
/* @__PURE__ */ jsx16(
|
|
3245
3241
|
TimeslotPicker,
|
|
3246
3242
|
{
|
|
3247
3243
|
slots: swap.shown.slots,
|
|
@@ -3249,7 +3245,8 @@ function TimePicker({
|
|
|
3249
3245
|
today,
|
|
3250
3246
|
nowTime,
|
|
3251
3247
|
onSelect: onSelectTime,
|
|
3252
|
-
accessory
|
|
3248
|
+
accessory,
|
|
3249
|
+
grouping
|
|
3253
3250
|
}
|
|
3254
3251
|
)
|
|
3255
3252
|
]
|
|
@@ -3260,7 +3257,7 @@ function TimePicker({
|
|
|
3260
3257
|
|
|
3261
3258
|
// src/island/CalendarGrainButton.tsx
|
|
3262
3259
|
import { useCallback as useCallback4, useLayoutEffect as useLayoutEffect2, useRef as useRef5, useState as useState6 } from "react";
|
|
3263
|
-
import { jsx as
|
|
3260
|
+
import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3264
3261
|
function useShortenedMonth(long) {
|
|
3265
3262
|
const [short, setShort] = useState6(false);
|
|
3266
3263
|
const title = useRef5(null);
|
|
@@ -3311,7 +3308,7 @@ function CalendarGrainButton({ month, grain, onPress }) {
|
|
|
3311
3308
|
...grain === "MONTH" && short ? { "data-grain-short": "" } : null,
|
|
3312
3309
|
children: [
|
|
3313
3310
|
shown,
|
|
3314
|
-
grain === "MONTH" ? /* @__PURE__ */
|
|
3311
|
+
grain === "MONTH" ? /* @__PURE__ */ jsx17(
|
|
3315
3312
|
"span",
|
|
3316
3313
|
{
|
|
3317
3314
|
className: "scopetickets-island-header-button__probe",
|
|
@@ -3324,9 +3321,9 @@ function CalendarGrainButton({ month, grain, onPress }) {
|
|
|
3324
3321
|
}
|
|
3325
3322
|
);
|
|
3326
3323
|
if (onPress === void 0) {
|
|
3327
|
-
return /* @__PURE__ */
|
|
3324
|
+
return /* @__PURE__ */ jsx17("span", { className: "scopetickets-island-chrome-pill scopetickets-island-grain-pill", children: title });
|
|
3328
3325
|
}
|
|
3329
|
-
return /* @__PURE__ */
|
|
3326
|
+
return /* @__PURE__ */ jsx17(
|
|
3330
3327
|
"button",
|
|
3331
3328
|
{
|
|
3332
3329
|
type: "button",
|
|
@@ -3338,6 +3335,26 @@ function CalendarGrainButton({ month, grain, onPress }) {
|
|
|
3338
3335
|
);
|
|
3339
3336
|
}
|
|
3340
3337
|
|
|
3338
|
+
// src/island/Switch.tsx
|
|
3339
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
3340
|
+
function Switch({ checked, onChange, label, size = "wide", disabled = false }) {
|
|
3341
|
+
const press = useIslandPress("element");
|
|
3342
|
+
return /* @__PURE__ */ jsx18(
|
|
3343
|
+
"button",
|
|
3344
|
+
{
|
|
3345
|
+
type: "button",
|
|
3346
|
+
role: "switch",
|
|
3347
|
+
"aria-checked": checked,
|
|
3348
|
+
"aria-label": label,
|
|
3349
|
+
disabled,
|
|
3350
|
+
className: `scopetickets-island-switch scopetickets-island-switch--${size}`,
|
|
3351
|
+
onClick: () => onChange(!checked),
|
|
3352
|
+
...disabled ? {} : press,
|
|
3353
|
+
children: /* @__PURE__ */ jsx18("span", { className: "scopetickets-island-switch__thumb", "aria-hidden": "true" })
|
|
3354
|
+
}
|
|
3355
|
+
);
|
|
3356
|
+
}
|
|
3357
|
+
|
|
3341
3358
|
export {
|
|
3342
3359
|
SURFACE_MORPH_MS,
|
|
3343
3360
|
SURFACE_SPRING,
|
|
@@ -3405,6 +3422,7 @@ export {
|
|
|
3405
3422
|
clampRemaining,
|
|
3406
3423
|
trackPaths,
|
|
3407
3424
|
timerPaths,
|
|
3425
|
+
majorUnits,
|
|
3408
3426
|
formatMoney,
|
|
3409
3427
|
moneyParts,
|
|
3410
3428
|
widestAmount,
|
|
@@ -3456,13 +3474,13 @@ export {
|
|
|
3456
3474
|
monthAtRow,
|
|
3457
3475
|
monthOpeningRow,
|
|
3458
3476
|
toggleSelectedDay,
|
|
3459
|
-
PartyStepper,
|
|
3460
3477
|
ContentFlag,
|
|
3461
|
-
|
|
3462
|
-
CounterRing,
|
|
3478
|
+
PartyStepper,
|
|
3463
3479
|
DayPicker,
|
|
3480
|
+
CounterRing,
|
|
3464
3481
|
TimeslotPicker,
|
|
3465
3482
|
TimePicker,
|
|
3466
|
-
CalendarGrainButton
|
|
3483
|
+
CalendarGrainButton,
|
|
3484
|
+
Switch
|
|
3467
3485
|
};
|
|
3468
|
-
//# sourceMappingURL=chunk-
|
|
3486
|
+
//# sourceMappingURL=chunk-SUAJAOHM.js.map
|