@scopetickets/checkout 0.1.3 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/{chunk-GJZKPJB5.js → chunk-B7AHG2OO.js} +334 -242
- package/dist/chunk-B7AHG2OO.js.map +1 -0
- package/dist/index.cjs +4523 -2628
- package/dist/index.cjs.map +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +218 -189
- package/dist/index.d.ts +218 -189
- package/dist/index.js +3925 -2109
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +109 -68
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.css +20 -2
- package/dist/pickers.css.map +1 -1
- package/dist/pickers.d.cts +45 -37
- package/dist/pickers.d.ts +45 -37
- package/dist/pickers.js +1 -1
- package/dist/styles.css +39 -7
- package/package.json +11 -9
- package/dist/chunk-GJZKPJB5.js.map +0 -1
package/dist/pickers.cjs
CHANGED
|
@@ -82,7 +82,7 @@ module.exports = __toCommonJS(pickers_exports);
|
|
|
82
82
|
// src/island/DayPicker.tsx
|
|
83
83
|
var import_react3 = require("react");
|
|
84
84
|
|
|
85
|
-
// src/
|
|
85
|
+
// ../checkout-core/src/domain/island-calendar.ts
|
|
86
86
|
var HIGH_FROM = 2 / 3;
|
|
87
87
|
var MEDIUM_FROM = 1 / 3;
|
|
88
88
|
function toAvailabilityLevel(remaining) {
|
|
@@ -399,7 +399,7 @@ function CalendarDayIndicator({ level }) {
|
|
|
399
399
|
// src/island/island-press.ts
|
|
400
400
|
var import_react = require("react");
|
|
401
401
|
|
|
402
|
-
// src/
|
|
402
|
+
// ../checkout-core/src/motion/island-motion.ts
|
|
403
403
|
var SURFACE_MORPH_MS = 250;
|
|
404
404
|
var SURFACE_DAMPING = 0.82;
|
|
405
405
|
var SURFACE_SPRING = {
|
|
@@ -804,6 +804,18 @@ function CalendarWeekdayNames() {
|
|
|
804
804
|
);
|
|
805
805
|
}
|
|
806
806
|
|
|
807
|
+
// ../checkout-core/src/view/component-copy.ts
|
|
808
|
+
var PARTY_COPY = {
|
|
809
|
+
remove: (name) => `Remove one ${name}`,
|
|
810
|
+
add: (name) => `Add one ${name}`,
|
|
811
|
+
count: (count, name) => `${count} ${name}. Change the number`,
|
|
812
|
+
field: (name) => `Number of ${name}`
|
|
813
|
+
};
|
|
814
|
+
var ISLAND_COPY = {
|
|
815
|
+
order: "Your order",
|
|
816
|
+
runWeeks: "Weeks of the run"
|
|
817
|
+
};
|
|
818
|
+
|
|
807
819
|
// src/island/DayPicker.tsx
|
|
808
820
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
809
821
|
function DayPicker({
|
|
@@ -848,7 +860,7 @@ function DayPicker({
|
|
|
848
860
|
row,
|
|
849
861
|
onRowChange: setRow,
|
|
850
862
|
onRowPreview: setShownRow,
|
|
851
|
-
label:
|
|
863
|
+
label: ISLAND_COPY.runWeeks,
|
|
852
864
|
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
853
865
|
CalendarRunGrid,
|
|
854
866
|
{
|
|
@@ -971,7 +983,7 @@ var import_react5 = require("react");
|
|
|
971
983
|
// src/island/CounterRing.tsx
|
|
972
984
|
var import_icons2 = require("@scopetickets/icons");
|
|
973
985
|
|
|
974
|
-
// src/
|
|
986
|
+
// ../checkout-core/src/geometry/island-timer.ts
|
|
975
987
|
var TIMER_GRID = 20;
|
|
976
988
|
var TIMER_CENTRE = TIMER_GRID / 2;
|
|
977
989
|
var RING_OUTER = 10;
|
|
@@ -1027,7 +1039,7 @@ function ringAnnulus(outer, inner) {
|
|
|
1027
1039
|
return { d: annulus(outer, inner), evenodd: true };
|
|
1028
1040
|
}
|
|
1029
1041
|
|
|
1030
|
-
// src/
|
|
1042
|
+
// ../checkout-core/src/geometry/island-counter-ring.ts
|
|
1031
1043
|
var RING_OUTER2 = 10;
|
|
1032
1044
|
var RING_STROKE = 2.5;
|
|
1033
1045
|
var RING_INNER2 = RING_OUTER2 - RING_STROKE;
|
|
@@ -1108,6 +1120,19 @@ function CounterRing({
|
|
|
1108
1120
|
);
|
|
1109
1121
|
}
|
|
1110
1122
|
|
|
1123
|
+
// ../checkout-core/src/domain/money.ts
|
|
1124
|
+
var MONEY_LOCALE = "en-IE";
|
|
1125
|
+
function formatterFor(currency) {
|
|
1126
|
+
return new Intl.NumberFormat(MONEY_LOCALE, { style: "currency", currency });
|
|
1127
|
+
}
|
|
1128
|
+
function minorUnitDigits(formatter) {
|
|
1129
|
+
return formatter.resolvedOptions().maximumFractionDigits ?? 2;
|
|
1130
|
+
}
|
|
1131
|
+
function formatMoney(minorUnits, currency) {
|
|
1132
|
+
const formatter = formatterFor(currency);
|
|
1133
|
+
return formatter.format(minorUnits / 10 ** minorUnitDigits(formatter));
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1111
1136
|
// src/island/Timeslot.tsx
|
|
1112
1137
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1113
1138
|
var REMAINING_SIZE = "var(--scopetickets-island-space-4)";
|
|
@@ -1115,6 +1140,7 @@ var SELECTED_ARC = "var(--scopetickets-island-timeslot-ring-selected)";
|
|
|
1115
1140
|
var TRACK = "var(--scopetickets-island-timeslot-track)";
|
|
1116
1141
|
var SELECTED_TRACK = "var(--scopetickets-island-timeslot-track-selected)";
|
|
1117
1142
|
var SOLD_OUT = "Sold Out";
|
|
1143
|
+
var FROM = "From";
|
|
1118
1144
|
function Timeslot({ cell, accessory, onSelect }) {
|
|
1119
1145
|
if (isDatePickerCellSelectable(cell.state)) {
|
|
1120
1146
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TimeslotButton, { cell, accessory, onSelect });
|
|
@@ -1122,36 +1148,47 @@ function Timeslot({ cell, accessory, onSelect }) {
|
|
|
1122
1148
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TimeslotFixed, { cell });
|
|
1123
1149
|
}
|
|
1124
1150
|
function TimeslotRow({ cell }) {
|
|
1151
|
+
const price = slotPrice(cell);
|
|
1125
1152
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "scopetickets-island-timeslot__times", children: [
|
|
1126
1153
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "scopetickets-island-timeslot__time", children: cell.slot.startTime }),
|
|
1127
1154
|
cell.slot.endTime === null ? null : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
1128
1155
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "scopetickets-island-timeslot__dash", "aria-hidden": "true", children: "-" }),
|
|
1129
1156
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "scopetickets-island-timeslot__time", children: cell.slot.endTime })
|
|
1130
1157
|
] }),
|
|
1131
|
-
|
|
1132
|
-
/*
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
{
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1158
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "scopetickets-island-timeslot__trailing", children: [
|
|
1159
|
+
price === null ? null : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "scopetickets-island-timeslot__price", children: price }),
|
|
1160
|
+
cell.state === "UNAVAILABLE" ? (
|
|
1161
|
+
/*
|
|
1162
|
+
* THE WORDS INSTEAD OF THE MARK, AND ONLY WHERE THE MARK WOULD SAY NOTHING.
|
|
1163
|
+
*
|
|
1164
|
+
* `UNAVAILABLE` is the one state the ring cannot draw: `timeslotState` reaches it
|
|
1165
|
+
* only for `remaining <= 0`, which is an arc of zero length. A slot that has
|
|
1166
|
+
* merely BEGUN keeps its ring — it still has seats, and "Sold Out" over them
|
|
1167
|
+
* would be false.
|
|
1168
|
+
*/
|
|
1169
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "scopetickets-island-timeslot__soldout", children: SOLD_OUT })
|
|
1170
|
+
) : cell.slot.remaining === null ? null : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "scopetickets-island-timeslot__remaining", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1171
|
+
CounterRing,
|
|
1172
|
+
{
|
|
1173
|
+
progress: cell.slot.remaining,
|
|
1174
|
+
color: cell.state === "SELECTED" ? SELECTED_ARC : availabilityColor(cell.slot.remaining),
|
|
1175
|
+
trackColor: cell.state === "SELECTED" ? SELECTED_TRACK : TRACK,
|
|
1176
|
+
size: REMAINING_SIZE
|
|
1177
|
+
}
|
|
1178
|
+
) })
|
|
1179
|
+
] })
|
|
1150
1180
|
] });
|
|
1151
1181
|
}
|
|
1182
|
+
function slotPrice(cell, spoken = false) {
|
|
1183
|
+
if (!isDatePickerCellSelectable(cell.state)) return null;
|
|
1184
|
+
const price = cell.slot.fromPrice;
|
|
1185
|
+
if (price === void 0 || price === null) return null;
|
|
1186
|
+
const money = formatMoney(price.minorUnits, price.currency);
|
|
1187
|
+
return spoken ? `${FROM} ${money}` : money;
|
|
1188
|
+
}
|
|
1152
1189
|
function timeslotLabel(cell, announcement) {
|
|
1153
1190
|
const range = cell.slot.endTime === null ? cell.slot.startTime : `${cell.slot.startTime} - ${cell.slot.endTime}`;
|
|
1154
|
-
return [range, cell.duration, announcement].filter((part) => part !== null).join(", ");
|
|
1191
|
+
return [range, cell.duration, slotPrice(cell, true), announcement].filter((part) => part !== null).join(", ");
|
|
1155
1192
|
}
|
|
1156
1193
|
function TimeslotButton({ cell, accessory, onSelect }) {
|
|
1157
1194
|
const press = useIslandPress("element");
|
|
@@ -1194,7 +1231,7 @@ function TimeslotGroupSection({ group, accessory, onSelect }) {
|
|
|
1194
1231
|
] });
|
|
1195
1232
|
}
|
|
1196
1233
|
|
|
1197
|
-
// src/
|
|
1234
|
+
// ../checkout-core/src/domain/island-timeslots.ts
|
|
1198
1235
|
var MAX_TIME_INPUT = 40;
|
|
1199
1236
|
var WALL_CLOCK = /^(?:\d{4}-\d{2}-\d{2}[T ])?(\d{2}):(\d{2})(?::\d{2})?/;
|
|
1200
1237
|
function parseWallClockTime(value) {
|
|
@@ -1345,7 +1382,7 @@ function TimeslotPicker({
|
|
|
1345
1382
|
)) });
|
|
1346
1383
|
}
|
|
1347
1384
|
|
|
1348
|
-
// src/
|
|
1385
|
+
// ../checkout-core/src/motion/island-step-order.ts
|
|
1349
1386
|
function dayDirection(from, to) {
|
|
1350
1387
|
if (from === to) return "NONE";
|
|
1351
1388
|
return to > from ? "FORWARD" : "BACKWARD";
|
|
@@ -1356,9 +1393,7 @@ function stepDirectionSign(direction) {
|
|
|
1356
1393
|
return 0;
|
|
1357
1394
|
}
|
|
1358
1395
|
|
|
1359
|
-
// src/
|
|
1360
|
-
var DAY_SWAP_OUT_ANIMATION = "scopetickets-island-day-swap-out";
|
|
1361
|
-
var DAY_SWAP_IN_ANIMATION = "scopetickets-island-day-swap-in";
|
|
1396
|
+
// ../checkout-core/src/motion/island-day-swap.ts
|
|
1362
1397
|
function daySwapAtRest(content) {
|
|
1363
1398
|
return { phase: "REST", shown: content };
|
|
1364
1399
|
}
|
|
@@ -1388,6 +1423,10 @@ function reduceDaySwap(state, event) {
|
|
|
1388
1423
|
}
|
|
1389
1424
|
}
|
|
1390
1425
|
|
|
1426
|
+
// src/island/island-day-swap-css.ts
|
|
1427
|
+
var DAY_SWAP_OUT_ANIMATION = "scopetickets-island-day-swap-out";
|
|
1428
|
+
var DAY_SWAP_IN_ANIMATION = "scopetickets-island-day-swap-in";
|
|
1429
|
+
|
|
1391
1430
|
// src/island/TimePicker.tsx
|
|
1392
1431
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1393
1432
|
function TimePicker({
|
|
@@ -1456,6 +1495,40 @@ function TimePicker({
|
|
|
1456
1495
|
// src/island/PartyStepper.tsx
|
|
1457
1496
|
var import_react7 = require("react");
|
|
1458
1497
|
var import_icons3 = require("@scopetickets/icons");
|
|
1498
|
+
|
|
1499
|
+
// ../checkout-core/src/domain/user-types.ts
|
|
1500
|
+
var SOLO_KEY = "default";
|
|
1501
|
+
function agreed(values) {
|
|
1502
|
+
const first = values[0];
|
|
1503
|
+
if (first === void 0) return null;
|
|
1504
|
+
return values.every((value) => value === first) ? first : null;
|
|
1505
|
+
}
|
|
1506
|
+
function groupUserTypes(rows) {
|
|
1507
|
+
const byName = /* @__PURE__ */ new Map();
|
|
1508
|
+
for (const row of rows) {
|
|
1509
|
+
if (row.Name === "") continue;
|
|
1510
|
+
const group = byName.get(row.Name);
|
|
1511
|
+
if (group === void 0) byName.set(row.Name, [row]);
|
|
1512
|
+
else group.push(row);
|
|
1513
|
+
}
|
|
1514
|
+
return [...byName.entries()].map(([name, group]) => ({
|
|
1515
|
+
key: name,
|
|
1516
|
+
name,
|
|
1517
|
+
note: agreed(group.map((row) => row.Note ?? null))
|
|
1518
|
+
}));
|
|
1519
|
+
}
|
|
1520
|
+
function assignmentFor(product, key) {
|
|
1521
|
+
if (product.UserTypes === void 0) return key;
|
|
1522
|
+
const offered = product.UserTypes ?? [];
|
|
1523
|
+
const byName = offered.find((type) => type.Name === key);
|
|
1524
|
+
if (byName !== void 0) return byName.AssignmentKey;
|
|
1525
|
+
return offered.some((type) => type.AssignmentKey === key) ? key : void 0;
|
|
1526
|
+
}
|
|
1527
|
+
function userTypeNames(rows) {
|
|
1528
|
+
return Object.fromEntries(rows.map((row) => [row.AssignmentKey, row.Name]));
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1531
|
+
// src/island/PartyStepper.tsx
|
|
1459
1532
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1460
1533
|
function UserTypeRow({
|
|
1461
1534
|
option,
|
|
@@ -1508,7 +1581,7 @@ function UserTypeStepper({
|
|
|
1508
1581
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1509
1582
|
StepperButton,
|
|
1510
1583
|
{
|
|
1511
|
-
label:
|
|
1584
|
+
label: PARTY_COPY.remove(name),
|
|
1512
1585
|
onPress: onRemove,
|
|
1513
1586
|
kind: "remove",
|
|
1514
1587
|
state: chosen ? "LIVE" : "CLOSED"
|
|
@@ -1533,7 +1606,7 @@ function UserTypeStepper({
|
|
|
1533
1606
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1534
1607
|
StepperButton,
|
|
1535
1608
|
{
|
|
1536
|
-
label:
|
|
1609
|
+
label: PARTY_COPY.add(name),
|
|
1537
1610
|
onPress: onAdd,
|
|
1538
1611
|
kind: "add",
|
|
1539
1612
|
state: atLimit ? "REFUSING" : "LIVE"
|
|
@@ -1568,7 +1641,7 @@ function SoloPartyStepper({ max, name, count, onSet, onRemove, onRefuse }) {
|
|
|
1568
1641
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1569
1642
|
StepperButton,
|
|
1570
1643
|
{
|
|
1571
|
-
label:
|
|
1644
|
+
label: PARTY_COPY.remove(name),
|
|
1572
1645
|
onPress: onRemove,
|
|
1573
1646
|
kind: "remove",
|
|
1574
1647
|
state: count === 0 ? "REFUSING" : "LIVE"
|
|
@@ -1589,7 +1662,7 @@ function SoloPartyStepper({ max, name, count, onSet, onRemove, onRefuse }) {
|
|
|
1589
1662
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1590
1663
|
StepperButton,
|
|
1591
1664
|
{
|
|
1592
|
-
label:
|
|
1665
|
+
label: PARTY_COPY.add(name),
|
|
1593
1666
|
onPress: () => onSet(count + 1),
|
|
1594
1667
|
kind: "add",
|
|
1595
1668
|
state: count >= max ? "REFUSING" : "LIVE"
|
|
@@ -1632,7 +1705,7 @@ function TypedCount({
|
|
|
1632
1705
|
{
|
|
1633
1706
|
type: "button",
|
|
1634
1707
|
className: valueClassName,
|
|
1635
|
-
"aria-label":
|
|
1708
|
+
"aria-label": PARTY_COPY.count(count, name),
|
|
1636
1709
|
onClick: () => setTyping(String(count)),
|
|
1637
1710
|
disabled: closed,
|
|
1638
1711
|
children: count
|
|
@@ -1648,7 +1721,7 @@ function TypedCount({
|
|
|
1648
1721
|
pattern: "[0-9]*",
|
|
1649
1722
|
size: 1,
|
|
1650
1723
|
ref: field,
|
|
1651
|
-
"aria-label":
|
|
1724
|
+
"aria-label": PARTY_COPY.field(name),
|
|
1652
1725
|
value: typing,
|
|
1653
1726
|
onChange: (event) => setTyping(event.target.value.replace(/\D/g, "")),
|
|
1654
1727
|
onBlur: commit,
|
|
@@ -1714,7 +1787,6 @@ function PartyStepper({
|
|
|
1714
1787
|
option.key
|
|
1715
1788
|
)) });
|
|
1716
1789
|
}
|
|
1717
|
-
var SOLO_KEY = "default";
|
|
1718
1790
|
|
|
1719
1791
|
// src/island/CalendarGrainButton.tsx
|
|
1720
1792
|
var import_react8 = require("react");
|
|
@@ -1796,37 +1868,6 @@ function CalendarGrainButton({ month, grain, onPress }) {
|
|
|
1796
1868
|
);
|
|
1797
1869
|
}
|
|
1798
1870
|
|
|
1799
|
-
// src/domain/user-types.ts
|
|
1800
|
-
function agreed(values) {
|
|
1801
|
-
const first = values[0];
|
|
1802
|
-
if (first === void 0) return null;
|
|
1803
|
-
return values.every((value) => value === first) ? first : null;
|
|
1804
|
-
}
|
|
1805
|
-
function groupUserTypes(rows) {
|
|
1806
|
-
const byName = /* @__PURE__ */ new Map();
|
|
1807
|
-
for (const row of rows) {
|
|
1808
|
-
if (row.Name === "") continue;
|
|
1809
|
-
const group = byName.get(row.Name);
|
|
1810
|
-
if (group === void 0) byName.set(row.Name, [row]);
|
|
1811
|
-
else group.push(row);
|
|
1812
|
-
}
|
|
1813
|
-
return [...byName.entries()].map(([name, group]) => ({
|
|
1814
|
-
key: name,
|
|
1815
|
-
name,
|
|
1816
|
-
note: agreed(group.map((row) => row.Note ?? null))
|
|
1817
|
-
}));
|
|
1818
|
-
}
|
|
1819
|
-
function assignmentFor(product, key) {
|
|
1820
|
-
if (product.UserTypes === void 0) return key;
|
|
1821
|
-
const offered = product.UserTypes ?? [];
|
|
1822
|
-
const byName = offered.find((type) => type.Name === key);
|
|
1823
|
-
if (byName !== void 0) return byName.AssignmentKey;
|
|
1824
|
-
return offered.some((type) => type.AssignmentKey === key) ? key : void 0;
|
|
1825
|
-
}
|
|
1826
|
-
function userTypeNames(rows) {
|
|
1827
|
-
return Object.fromEntries(rows.map((row) => [row.AssignmentKey, row.Name]));
|
|
1828
|
-
}
|
|
1829
|
-
|
|
1830
1871
|
// src/island/Switch.tsx
|
|
1831
1872
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1832
1873
|
function Switch({ checked, onChange, label, size = "wide", disabled = false }) {
|