@agent-native/scheduling 0.1.11 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/react/components/SlotPicker.d.ts.map +1 -1
- package/dist/react/components/SlotPicker.js +3 -1
- package/dist/react/components/SlotPicker.js.map +1 -1
- package/dist/react/components/booking-links/AvailabilityEditor.d.ts +2 -1
- package/dist/react/components/booking-links/AvailabilityEditor.d.ts.map +1 -1
- package/dist/react/components/booking-links/AvailabilityEditor.js +28 -22
- package/dist/react/components/booking-links/AvailabilityEditor.js.map +1 -1
- package/dist/react/components/booking-links/BookingLinkCreateDialog.d.ts.map +1 -1
- package/dist/react/components/booking-links/BookingLinkCreateDialog.js +6 -4
- package/dist/react/components/booking-links/BookingLinkCreateDialog.js.map +1 -1
- package/dist/react/components/booking-links/ConferencingSelector.d.ts.map +1 -1
- package/dist/react/components/booking-links/ConferencingSelector.js +25 -19
- package/dist/react/components/booking-links/ConferencingSelector.js.map +1 -1
- package/dist/react/components/booking-links/CustomFieldsEditor.d.ts.map +1 -1
- package/dist/react/components/booking-links/CustomFieldsEditor.js +38 -24
- package/dist/react/components/booking-links/CustomFieldsEditor.js.map +1 -1
- package/dist/react/components/booking-links/DurationPicker.d.ts.map +1 -1
- package/dist/react/components/booking-links/DurationPicker.js +6 -2
- package/dist/react/components/booking-links/DurationPicker.js.map +1 -1
- package/dist/react/components/booking-links/SlugEditor.d.ts.map +1 -1
- package/dist/react/components/booking-links/SlugEditor.js +5 -3
- package/dist/react/components/booking-links/SlugEditor.js.map +1 -1
- package/dist/react/i18n.d.ts +103 -0
- package/dist/react/i18n.d.ts.map +1 -0
- package/dist/react/i18n.js +970 -0
- package/dist/react/i18n.js.map +1 -0
- package/dist/schema/bookings.d.ts +12 -12
- package/dist/schema/event-types.d.ts +12 -12
- package/dist/schema/routing-forms.d.ts +12 -12
- package/dist/schema/schedules.d.ts +12 -12
- package/dist/schema/teams.d.ts +12 -12
- package/dist/schema/workflows.d.ts +15 -15
- package/package.json +10 -11
- package/src/react/components/SlotPicker.tsx +6 -1
- package/src/react/components/booking-links/AvailabilityEditor.tsx +48 -27
- package/src/react/components/booking-links/BookingLinkCreateDialog.tsx +15 -13
- package/src/react/components/booking-links/ConferencingSelector.tsx +35 -30
- package/src/react/components/booking-links/CustomFieldsEditor.tsx +68 -49
- package/src/react/components/booking-links/DurationPicker.tsx +8 -4
- package/src/react/components/booking-links/SlugEditor.tsx +7 -5
- package/src/react/i18n.ts +1044 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SlotPicker.d.ts","sourceRoot":"","sources":["../../../src/react/components/SlotPicker.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"SlotPicker.d.ts","sourceRoot":"","sources":["../../../src/react/components/SlotPicker.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAKlD,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAC/B,UAAU,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,2CAmDhD"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { TZDate } from "@date-fns/tz";
|
|
3
3
|
import { format } from "date-fns";
|
|
4
|
+
import { useSchedulingT } from "../i18n.js";
|
|
4
5
|
export function SlotPicker(props) {
|
|
6
|
+
const t = useSchedulingT();
|
|
5
7
|
const grouped = new Map();
|
|
6
8
|
for (const s of props.slots) {
|
|
7
9
|
const localDay = format(new TZDate(new Date(s.start).getTime(), props.timezone), "yyyy-MM-dd");
|
|
@@ -10,6 +12,6 @@ export function SlotPicker(props) {
|
|
|
10
12
|
grouped.get(localDay).push(s);
|
|
11
13
|
}
|
|
12
14
|
const fmt = props.timeFormat === "24h" ? "HH:mm" : "h:mma";
|
|
13
|
-
return (_jsx("div", { className: props.className ?? "", children: Array.from(grouped.entries()).map(([date, daySlots]) => (_jsxs("section", { className: props.dayClassName ?? "", children: [_jsx("header", { children: format(new TZDate(`${date}T12:00:00Z`, props.timezone), "EEEE, MMM d") }), _jsx("ul", { children: daySlots.map((s) => (_jsx("li", { children: _jsxs("button", { type: "button", className: props.slotClassName ?? "", "aria-pressed": props.selectedStart === s.start, disabled: !s.available, onClick: () => props.onSelect(s), children: [format(new TZDate(new Date(s.start).getTime(), props.timezone), fmt), s.seatsRemaining != null && s.seatsRemaining > 0 && (_jsxs("span", { children: [" \u00B7 ", s.seatsRemaining, "
|
|
15
|
+
return (_jsx("div", { className: props.className ?? "", children: Array.from(grouped.entries()).map(([date, daySlots]) => (_jsxs("section", { className: props.dayClassName ?? "", children: [_jsx("header", { children: format(new TZDate(`${date}T12:00:00Z`, props.timezone), "EEEE, MMM d") }), _jsx("ul", { children: daySlots.map((s) => (_jsx("li", { children: _jsxs("button", { type: "button", className: props.slotClassName ?? "", "aria-pressed": props.selectedStart === s.start, disabled: !s.available, onClick: () => props.onSelect(s), children: [format(new TZDate(new Date(s.start).getTime(), props.timezone), fmt), s.seatsRemaining != null && s.seatsRemaining > 0 && (_jsxs("span", { children: [" ", "\u00B7 ", s.seatsRemaining, " ", t("availableLeft")] }))] }) }, s.start))) })] }, date))) }));
|
|
14
16
|
}
|
|
15
17
|
//# sourceMappingURL=SlotPicker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SlotPicker.js","sourceRoot":"","sources":["../../../src/react/components/SlotPicker.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"SlotPicker.js","sourceRoot":"","sources":["../../../src/react/components/SlotPicker.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAa5C,MAAM,UAAU,UAAU,CAAC,KAAsB;IAC/C,MAAM,CAAC,GAAG,cAAc,EAAE,CAAC;IAC3B,MAAM,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC1C,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;QAC5B,MAAM,QAAQ,GAAG,MAAM,CACrB,IAAI,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,KAAK,CAAC,QAAQ,CAAC,EACvD,YAAY,CACb,CAAC;QACF,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;YAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QACtD,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjC,CAAC;IACD,MAAM,GAAG,GAAG,KAAK,CAAC,UAAU,KAAK,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;IAE3D,OAAO,CACL,cAAK,SAAS,EAAE,KAAK,CAAC,SAAS,IAAI,EAAE,YAClC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE,CAAC,CACvD,mBAAoB,SAAS,EAAE,KAAK,CAAC,YAAY,IAAI,EAAE,aACrD,2BACG,MAAM,CACL,IAAI,MAAM,CAAC,GAAG,IAAI,YAAY,EAAE,KAAK,CAAC,QAAQ,CAAC,EAC/C,aAAa,CACd,GACM,EACT,uBACG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CACnB,uBACE,kBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,KAAK,CAAC,aAAa,IAAI,EAAE,kBACtB,KAAK,CAAC,aAAa,KAAK,CAAC,CAAC,KAAK,EAC7C,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,EACtB,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,aAE/B,MAAM,CACL,IAAI,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,KAAK,CAAC,QAAQ,CAAC,EACvD,GAAG,CACJ,EACA,CAAC,CAAC,cAAc,IAAI,IAAI,IAAI,CAAC,CAAC,cAAc,GAAG,CAAC,IAAI,CACnD,2BACG,GAAG,aACD,CAAC,CAAC,cAAc,OAAG,CAAC,CAAC,eAAe,CAAC,IACnC,CACR,IACM,IAlBF,CAAC,CAAC,KAAK,CAmBX,CACN,CAAC,GACC,KA9BO,IAAI,CA+BR,CACX,CAAC,GACE,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { LocaleCode } from "@agent-native/core/client";
|
|
1
2
|
export type DayKey = "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday" | "sunday";
|
|
2
3
|
export interface TimeSlot {
|
|
3
4
|
start: string;
|
|
@@ -17,5 +18,5 @@ export declare function AvailabilityEditor({ value, onChange, }: AvailabilityEdi
|
|
|
17
18
|
* Summarize a `WeeklySchedule` in a short phrase, e.g. "Weekdays, 9 am - 5 pm".
|
|
18
19
|
* Useful for list-row subtitles.
|
|
19
20
|
*/
|
|
20
|
-
export declare function summarizeAvailability(ws: WeeklySchedule): string;
|
|
21
|
+
export declare function summarizeAvailability(ws: WeeklySchedule, locale?: LocaleCode): string;
|
|
21
22
|
//# sourceMappingURL=AvailabilityEditor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AvailabilityEditor.d.ts","sourceRoot":"","sources":["../../../../src/react/components/booking-links/AvailabilityEditor.tsx"],"names":[],"mappings":"AAcA,MAAM,MAAM,MAAM,GACd,QAAQ,GACR,SAAS,GACT,WAAW,GACX,UAAU,GACV,QAAQ,GACR,UAAU,GACV,QAAQ,CAAC;AAEb,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB;AAED,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"AvailabilityEditor.d.ts","sourceRoot":"","sources":["../../../../src/react/components/booking-links/AvailabilityEditor.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D,MAAM,MAAM,MAAM,GACd,QAAQ,GACR,SAAS,GACT,WAAW,GACX,UAAU,GACV,QAAQ,GACR,UAAU,GACV,QAAQ,CAAC;AAEb,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB;AAED,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AAgBzD,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,cAAc,CAAC;IACtB,QAAQ,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,CAAC;CAC1C;AAED,wBAAgB,kBAAkB,CAAC,EACjC,KAAK,EACL,QAAQ,GACT,EAAE,uBAAuB,2CAwEzB;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,EAAE,EAAE,cAAc,EAClB,MAAM,GAAE,UAAoB,GAC3B,MAAM,CA+CR"}
|
|
@@ -12,16 +12,18 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
12
12
|
*/
|
|
13
13
|
import { Input } from "@/components/ui/input";
|
|
14
14
|
import { Switch } from "@/components/ui/switch";
|
|
15
|
+
import { schedulingMessage, useSchedulingT } from "../../i18n.js";
|
|
15
16
|
const DAYS = [
|
|
16
|
-
{ key: "monday",
|
|
17
|
-
{ key: "tuesday",
|
|
18
|
-
{ key: "wednesday",
|
|
19
|
-
{ key: "thursday",
|
|
20
|
-
{ key: "friday",
|
|
21
|
-
{ key: "saturday",
|
|
22
|
-
{ key: "sunday",
|
|
17
|
+
{ key: "monday", labelKey: "monday", shortKey: "mon" },
|
|
18
|
+
{ key: "tuesday", labelKey: "tuesday", shortKey: "tue" },
|
|
19
|
+
{ key: "wednesday", labelKey: "wednesday", shortKey: "wed" },
|
|
20
|
+
{ key: "thursday", labelKey: "thursday", shortKey: "thu" },
|
|
21
|
+
{ key: "friday", labelKey: "friday", shortKey: "fri" },
|
|
22
|
+
{ key: "saturday", labelKey: "saturday", shortKey: "sat" },
|
|
23
|
+
{ key: "sunday", labelKey: "sunday", shortKey: "sun" },
|
|
23
24
|
];
|
|
24
25
|
export function AvailabilityEditor({ value, onChange, }) {
|
|
26
|
+
const t = useSchedulingT();
|
|
25
27
|
const setDay = (day, patch) => {
|
|
26
28
|
onChange({
|
|
27
29
|
...value,
|
|
@@ -40,17 +42,19 @@ export function AvailabilityEditor({ value, onChange, }) {
|
|
|
40
42
|
},
|
|
41
43
|
});
|
|
42
44
|
};
|
|
43
|
-
return (_jsx("div", { className: "space-y-2.5", children: DAYS.map(({ key,
|
|
45
|
+
return (_jsx("div", { className: "space-y-2.5", children: DAYS.map(({ key, labelKey, shortKey }) => {
|
|
46
|
+
const label = t(labelKey);
|
|
47
|
+
const short = t(shortKey);
|
|
44
48
|
const day = value[key] ?? { enabled: false, slots: [] };
|
|
45
49
|
const slot = day.slots[0] ?? { start: "09:00", end: "17:00" };
|
|
46
|
-
return (_jsxs("div", { className: "flex flex-wrap items-center gap-3 rounded-lg border border-border px-3 py-3 sm:gap-4 sm:px-4", children: [_jsxs("div", { className: "flex w-28 items-center gap-3 sm:w-40", children: [_jsx(Switch, { checked: day.enabled, onCheckedChange: (checked) => setDay(key, { enabled: checked }), "aria-label":
|
|
50
|
+
return (_jsxs("div", { className: "flex flex-wrap items-center gap-3 rounded-lg border border-border px-3 py-3 sm:gap-4 sm:px-4", children: [_jsxs("div", { className: "flex w-28 items-center gap-3 sm:w-40", children: [_jsx(Switch, { checked: day.enabled, onCheckedChange: (checked) => setDay(key, { enabled: checked }), "aria-label": t("toggleDay", { day: label }) }), _jsxs("span", { className: "text-sm font-medium", children: [_jsx("span", { className: "hidden sm:inline", children: label }), _jsx("span", { className: "sm:hidden", children: short })] })] }), day.enabled ? (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Input, { type: "time", value: slot.start, onChange: (e) => setSlot(key, "start", e.target.value), className: "w-28 sm:w-32" }), _jsx("span", { className: "text-muted-foreground", children: t("to") }), _jsx(Input, { type: "time", value: slot.end, onChange: (e) => setSlot(key, "end", e.target.value), className: "w-28 sm:w-32" })] })) : (_jsx("span", { className: "text-sm text-muted-foreground", children: t("unavailable") }))] }, key));
|
|
47
51
|
}) }));
|
|
48
52
|
}
|
|
49
53
|
/**
|
|
50
54
|
* Summarize a `WeeklySchedule` in a short phrase, e.g. "Weekdays, 9 am - 5 pm".
|
|
51
55
|
* Useful for list-row subtitles.
|
|
52
56
|
*/
|
|
53
|
-
export function summarizeAvailability(ws) {
|
|
57
|
+
export function summarizeAvailability(ws, locale = "en-US") {
|
|
54
58
|
const weekdayKeys = [
|
|
55
59
|
"monday",
|
|
56
60
|
"tuesday",
|
|
@@ -62,29 +66,31 @@ export function summarizeAvailability(ws) {
|
|
|
62
66
|
const allDays = [...weekdayKeys, ...weekendKeys];
|
|
63
67
|
const enabled = allDays.filter((d) => ws[d]?.enabled);
|
|
64
68
|
if (enabled.length === 0)
|
|
65
|
-
return
|
|
69
|
+
return schedulingMessage(locale, "noAvailabilitySet");
|
|
66
70
|
const weekdaysOn = weekdayKeys.every((d) => ws[d]?.enabled);
|
|
67
71
|
const weekendsOn = weekendKeys.every((d) => ws[d]?.enabled);
|
|
68
72
|
const weekdaysOff = weekdayKeys.every((d) => !ws[d]?.enabled);
|
|
69
73
|
const weekendsOff = weekendKeys.every((d) => !ws[d]?.enabled);
|
|
70
74
|
let dayLabel;
|
|
71
75
|
if (weekdaysOn && weekendsOn)
|
|
72
|
-
dayLabel =
|
|
76
|
+
dayLabel = schedulingMessage(locale, "everyDay");
|
|
73
77
|
else if (weekdaysOn && weekendsOff)
|
|
74
|
-
dayLabel = "
|
|
78
|
+
dayLabel = schedulingMessage(locale, "weekdays");
|
|
75
79
|
else if (weekdaysOff && weekendsOn)
|
|
76
|
-
dayLabel = "
|
|
80
|
+
dayLabel = schedulingMessage(locale, "weekends");
|
|
77
81
|
else {
|
|
78
82
|
const shortNames = {
|
|
79
|
-
monday: "
|
|
80
|
-
tuesday: "
|
|
81
|
-
wednesday: "
|
|
82
|
-
thursday: "
|
|
83
|
-
friday: "
|
|
84
|
-
saturday: "
|
|
85
|
-
sunday: "
|
|
83
|
+
monday: "mon",
|
|
84
|
+
tuesday: "tue",
|
|
85
|
+
wednesday: "wed",
|
|
86
|
+
thursday: "thu",
|
|
87
|
+
friday: "fri",
|
|
88
|
+
saturday: "sat",
|
|
89
|
+
sunday: "sun",
|
|
86
90
|
};
|
|
87
|
-
dayLabel = enabled
|
|
91
|
+
dayLabel = enabled
|
|
92
|
+
.map((d) => schedulingMessage(locale, shortNames[d]))
|
|
93
|
+
.join(", ");
|
|
88
94
|
}
|
|
89
95
|
const slot = ws[enabled[0]].slots[0];
|
|
90
96
|
if (!slot)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AvailabilityEditor.js","sourceRoot":"","sources":["../../../../src/react/components/booking-links/AvailabilityEditor.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"AvailabilityEditor.js","sourceRoot":"","sources":["../../../../src/react/components/booking-links/AvailabilityEditor.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAwBlE,MAAM,IAAI,GAIJ;IACJ,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE;IACtD,EAAE,GAAG,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE;IACxD,EAAE,GAAG,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,EAAE;IAC5D,EAAE,GAAG,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE;IAC1D,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ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CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC3C,MAAM,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IACrC,MAAM,IAAI,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC;IAC1B,OAAO,CAAC;QACN,CAAC,CAAC,GAAG,IAAI,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,MAAM,EAAE;QACnD,CAAC,CAAC,GAAG,IAAI,IAAI,MAAM,EAAE,CAAC;AAC1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BookingLinkCreateDialog.d.ts","sourceRoot":"","sources":["../../../../src/react/components/booking-links/BookingLinkCreateDialog.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BookingLinkCreateDialog.d.ts","sourceRoot":"","sources":["../../../../src/react/components/booking-links/BookingLinkCreateDialog.tsx"],"names":[],"mappings":"AA0BA,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB,mDAAmD;IACnD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClE,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAUD,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,4BAA4B,2CA2I1E"}
|
|
@@ -16,6 +16,7 @@ import { Button } from "@/components/ui/button";
|
|
|
16
16
|
import { Input } from "@/components/ui/input";
|
|
17
17
|
import { Label } from "@/components/ui/label";
|
|
18
18
|
import { Textarea } from "@/components/ui/textarea";
|
|
19
|
+
import { useSchedulingT } from "../../i18n.js";
|
|
19
20
|
function slugify(value) {
|
|
20
21
|
return value
|
|
21
22
|
.toLowerCase()
|
|
@@ -24,7 +25,8 @@ function slugify(value) {
|
|
|
24
25
|
.replace(/^-+|-+$/g, "");
|
|
25
26
|
}
|
|
26
27
|
export function BookingLinkCreateDialog(props) {
|
|
27
|
-
const
|
|
28
|
+
const t = useSchedulingT();
|
|
29
|
+
const { open, onOpenChange, slugPrefix, defaultLength = 30, onSubmit, submitLabel = t("continue"), } = props;
|
|
28
30
|
const [form, setForm] = useState({
|
|
29
31
|
title: "",
|
|
30
32
|
slug: "",
|
|
@@ -57,14 +59,14 @@ export function BookingLinkCreateDialog(props) {
|
|
|
57
59
|
setSubmitting(false);
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
|
-
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "
|
|
62
|
+
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: t("addEventTypeTitle") }), _jsx(DialogDescription, { children: t("addEventTypeDescription") })] }), _jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "space-y-1.5", children: [_jsx(Label, { htmlFor: "blc-title", children: t("title") }), _jsx(Input, { id: "blc-title", placeholder: "Quick chat", value: form.title, onChange: (e) => {
|
|
61
63
|
const title = e.currentTarget.value;
|
|
62
64
|
setForm((prev) => ({
|
|
63
65
|
...prev,
|
|
64
66
|
title,
|
|
65
67
|
slug: slugEdited ? prev.slug : slugify(title),
|
|
66
68
|
}));
|
|
67
|
-
}, autoFocus: true })] }), _jsxs("div", { className: "space-y-1.5", children: [_jsx(Label, { htmlFor: "blc-slug", children: "
|
|
69
|
+
}, autoFocus: true })] }), _jsxs("div", { className: "space-y-1.5", children: [_jsx(Label, { htmlFor: "blc-slug", children: t("url") }), _jsxs("div", { className: "flex rounded-md border border-input focus-within:ring-2 focus-within:ring-ring", children: [_jsx("span", { className: "flex items-center rounded-l-md bg-muted px-3 text-xs text-muted-foreground", children: slugPrefix }), _jsx(Input, { id: "blc-slug", placeholder: "quick-chat", className: "rounded-l-none border-0 focus-visible:ring-0 focus-visible:ring-offset-0", value: form.slug, onChange: (e) => {
|
|
68
70
|
// Capture before setForm — React nulls e.currentTarget once
|
|
69
71
|
// the event finishes synchronous propagation, so reading it
|
|
70
72
|
// inside the updater closure throws "Cannot read properties
|
|
@@ -75,6 +77,6 @@ export function BookingLinkCreateDialog(props) {
|
|
|
75
77
|
...prev,
|
|
76
78
|
slug: slugify(next),
|
|
77
79
|
}));
|
|
78
|
-
} })] })] }), _jsxs("div", { className: "space-y-1.5", children: [_jsx(Label, { htmlFor: "blc-desc", children: "
|
|
80
|
+
} })] })] }), _jsxs("div", { className: "space-y-1.5", children: [_jsx(Label, { htmlFor: "blc-desc", children: t("description") }), _jsx(Textarea, { id: "blc-desc", placeholder: t("shortDescriptionPlaceholder"), rows: 2, value: form.description, onChange: (e) => setForm({ ...form, description: e.currentTarget.value }) })] }), _jsxs("div", { className: "space-y-1.5", children: [_jsx(Label, { htmlFor: "blc-len", children: t("duration") }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Input, { id: "blc-len", type: "number", className: "w-24", value: form.length, onChange: (e) => setForm({ ...form, length: Number(e.currentTarget.value) }) }), _jsx("span", { className: "text-sm text-muted-foreground", children: t("minutes") })] })] })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { variant: "outline", onClick: () => onOpenChange(false), children: t("cancel") }), _jsx(Button, { onClick: submit, disabled: !form.title || !form.slug || submitting, children: submitting ? t("saving") : submitLabel })] })] }) }));
|
|
79
81
|
}
|
|
80
82
|
//# sourceMappingURL=BookingLinkCreateDialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BookingLinkCreateDialog.js","sourceRoot":"","sources":["../../../../src/react/components/booking-links/BookingLinkCreateDialog.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EACL,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,WAAW,GACZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"BookingLinkCreateDialog.js","sourceRoot":"","sources":["../../../../src/react/components/booking-links/BookingLinkCreateDialog.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EACL,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,WAAW,GACZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAwB/C,SAAS,OAAO,CAAC,KAAa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,CAAC,GAE7D,EACF,eAAM,SAAS,EAAC,+BAA+B,YAC5C,CAAC,CAAC,SAAS,CAAC,GACR,IACH,IACF,IACF,EACN,MAAC,YAAY,eACX,KAAC,MAAM,IAAC,OAAO,EAAC,SAAS,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,YACzD,CAAC,CAAC,QAAQ,CAAC,GACL,EACT,KAAC,MAAM,IACL,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,UAAU,YAEhD,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,GAChC,IACI,IACD,GACT,CACV,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConferencingSelector.d.ts","sourceRoot":"","sources":["../../../../src/react/components/booking-links/ConferencingSelector.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ConferencingSelector.d.ts","sourceRoot":"","sources":["../../../../src/react/components/booking-links/ConferencingSelector.tsx"],"names":[],"mappings":"AA6CA,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,aAAa,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE1E,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,gBAAgB,CAAC;IACvB,+EAA+E;IAC/E,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,cAAc,GAAG,gBAAgB,CAAC;AAE7E,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,iBAAiB,CAAC;IACzB,QAAQ,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC5C,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,YAAY,CAAC,EAAE,cAAc,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,gFAAgF;IAChF,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAkCD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,2CA0LpE"}
|
|
@@ -30,33 +30,35 @@ import { Input } from "@/components/ui/input";
|
|
|
30
30
|
import { Label } from "@/components/ui/label";
|
|
31
31
|
import { Badge } from "@/components/ui/badge";
|
|
32
32
|
import { Select, SelectContent, SelectItem, SelectTrigger, } from "@/components/ui/select";
|
|
33
|
+
import { useSchedulingT } from "../../i18n.js";
|
|
33
34
|
const OPTIONS = [
|
|
34
35
|
{
|
|
35
36
|
type: "none",
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
labelKey: "noConferencing",
|
|
38
|
+
descriptionKey: "inPersonOrOther",
|
|
38
39
|
Icon: IconVideoOff,
|
|
39
40
|
},
|
|
40
41
|
{
|
|
41
42
|
type: "google_meet",
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
labelKey: "googleMeet",
|
|
44
|
+
descriptionKey: "googleMeetDescription",
|
|
44
45
|
Icon: IconBrandGoogle,
|
|
45
46
|
},
|
|
46
47
|
{
|
|
47
48
|
type: "zoom",
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
labelKey: "zoom",
|
|
50
|
+
descriptionKey: "zoomDescription",
|
|
50
51
|
Icon: IconBrandZoom,
|
|
51
52
|
},
|
|
52
53
|
{
|
|
53
54
|
type: "custom",
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
labelKey: "customLink",
|
|
56
|
+
descriptionKey: "customLinkDescription",
|
|
56
57
|
Icon: IconLink,
|
|
57
58
|
},
|
|
58
59
|
];
|
|
59
60
|
export function ConferencingSelector(props) {
|
|
61
|
+
const t = useSchedulingT();
|
|
60
62
|
const id = useId();
|
|
61
63
|
const { value, onChange, zoomStatus = "disconnected", googleStatus = "disconnected", onConnectZoom, onConnectGoogle, hideLabel, } = props;
|
|
62
64
|
const statusFor = (type) => {
|
|
@@ -69,23 +71,27 @@ export function ConferencingSelector(props) {
|
|
|
69
71
|
const selectedOption = OPTIONS.find((opt) => opt.type === value.type) ?? OPTIONS[0];
|
|
70
72
|
const selectedStatus = statusFor(selectedOption.type);
|
|
71
73
|
const SelectedIcon = selectedOption.Icon;
|
|
72
|
-
return (_jsxs("div", { className: "space-y-3", children: [!hideLabel && (_jsxs(Label, { className: "flex items-center gap-1.5", children: [_jsx(IconVideo, { className: "h-4 w-4" }), "
|
|
74
|
+
return (_jsxs("div", { className: "space-y-3", children: [!hideLabel && (_jsxs(Label, { className: "flex items-center gap-1.5", children: [_jsx(IconVideo, { className: "h-4 w-4" }), t("conferencing")] })), _jsxs(Select, { value: value.type, onValueChange: (type) => onChange({
|
|
73
75
|
type: type,
|
|
74
76
|
url: type === "custom" ? value.url : undefined,
|
|
75
|
-
}), children: [_jsx(SelectTrigger, { className: "h-auto min-h-11 py-2", children: _jsxs("div", { className: "flex min-w-0 items-center gap-2 text-left", children: [_jsx(SelectedIcon, { className: "h-4 w-4 shrink-0" }), _jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "truncate font-medium", children: selectedOption.
|
|
77
|
+
}), children: [_jsx(SelectTrigger, { className: "h-auto min-h-11 py-2", children: _jsxs("div", { className: "flex min-w-0 items-center gap-2 text-left", children: [_jsx(SelectedIcon, { className: "h-4 w-4 shrink-0" }), _jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "truncate font-medium", children: t(selectedOption.labelKey) }), selectedStatus === "connected" &&
|
|
76
78
|
selectedOption.type !== "none" &&
|
|
77
|
-
selectedOption.type !== "custom" && (_jsxs(Badge, { variant: "secondary", className: "h-5 gap-1 text-[10px] font-normal", children: [_jsx(IconCheck, { className: "h-3 w-3" }), "
|
|
78
|
-
?
|
|
79
|
-
|
|
79
|
+
selectedOption.type !== "custom" && (_jsxs(Badge, { variant: "secondary", className: "h-5 gap-1 text-[10px] font-normal", children: [_jsx(IconCheck, { className: "h-3 w-3" }), t("connected")] }))] }), _jsx("p", { className: "truncate text-xs text-muted-foreground", children: selectedStatus === "not-configured"
|
|
80
|
+
? t("providerNotConfigured", {
|
|
81
|
+
provider: t(selectedOption.labelKey),
|
|
82
|
+
})
|
|
83
|
+
: t(selectedOption.descriptionKey) })] })] }) }), _jsx(SelectContent, { children: OPTIONS.map((opt) => {
|
|
80
84
|
const status = statusFor(opt.type);
|
|
81
85
|
const isUnavailable = status === "not-configured";
|
|
82
|
-
return (_jsx(SelectItem, { value: opt.type, disabled: isUnavailable, className: "py-2", children: _jsxs("div", { className: "flex min-w-0 items-start gap-2", children: [_jsx(opt.Icon, { className: "mt-0.5 h-4 w-4 shrink-0" }), _jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "font-medium", children: opt.
|
|
86
|
+
return (_jsx(SelectItem, { value: opt.type, disabled: isUnavailable, className: "py-2", children: _jsxs("div", { className: "flex min-w-0 items-start gap-2", children: [_jsx(opt.Icon, { className: "mt-0.5 h-4 w-4 shrink-0" }), _jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "font-medium", children: t(opt.labelKey) }), status === "connected" &&
|
|
83
87
|
opt.type !== "none" &&
|
|
84
|
-
opt.type !== "custom" && (_jsx("span", { className: "text-[10px] text-muted-foreground", children: "
|
|
85
|
-
?
|
|
86
|
-
|
|
87
|
-
|
|
88
|
+
opt.type !== "custom" && (_jsx("span", { className: "text-[10px] text-muted-foreground", children: t("connected") }))] }), _jsx("p", { className: "text-xs text-muted-foreground", children: isUnavailable
|
|
89
|
+
? t("providerNeedsCredentials", {
|
|
90
|
+
provider: t(opt.labelKey),
|
|
91
|
+
})
|
|
92
|
+
: t(opt.descriptionKey) })] })] }) }, opt.type));
|
|
93
|
+
}) })] }), value.type === "zoom" && zoomStatus !== "connected" && onConnectZoom && (_jsxs("div", { className: "rounded-md border border-border/60 bg-muted/30 p-3", children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [_jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("p", { className: "text-sm font-medium", children: t("connectZoomAccount") }), _jsx("p", { className: "text-xs text-muted-foreground", children: t("connectZoomAccountDescription") })] }), _jsxs(Button, { type: "button", size: "sm", onClick: onConnectZoom, disabled: zoomStatus === "not-configured", children: [_jsx(IconBrandZoom, { className: "mr-1.5 h-4 w-4" }), t("connectZoom")] })] }), zoomStatus === "not-configured" && (_jsx("p", { className: "mt-2 text-[11px] text-muted-foreground", children: t("zoomNotConfigured") }))] })), value.type === "google_meet" &&
|
|
88
94
|
googleStatus !== "connected" &&
|
|
89
|
-
onConnectGoogle && (_jsx("div", { className: "rounded-md border border-border/60 bg-muted/30 p-3", children: _jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [_jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("p", { className: "text-sm font-medium", children: "
|
|
95
|
+
onConnectGoogle && (_jsx("div", { className: "rounded-md border border-border/60 bg-muted/30 p-3", children: _jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [_jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("p", { className: "text-sm font-medium", children: t("connectGoogleCalendar") }), _jsx("p", { className: "text-xs text-muted-foreground", children: t("connectGoogleCalendarDescription") })] }), _jsxs(Button, { type: "button", size: "sm", variant: "outline", onClick: onConnectGoogle, disabled: googleStatus === "not-configured", children: [_jsx(IconBrandGoogle, { className: "mr-1.5 h-4 w-4" }), t("connectGoogle")] })] }) })), value.type === "custom" && (_jsxs("div", { className: "space-y-1.5", children: [_jsx(Label, { htmlFor: `${id}-url`, className: "text-xs", children: t("meetingUrl") }), _jsx(Input, { id: `${id}-url`, type: "url", value: value.url ?? "", onChange: (e) => onChange({ type: "custom", url: e.currentTarget.value }), placeholder: "https://meet.example.com/room", className: "h-8 text-sm" })] }))] }));
|
|
90
96
|
}
|
|
91
97
|
//# sourceMappingURL=ConferencingSelector.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConferencingSelector.js","sourceRoot":"","sources":["../../../../src/react/components/booking-links/ConferencingSelector.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAE,KAAK,EAAsB,MAAM,OAAO,CAAC;AAClD,OAAO,EACL,eAAe,EACf,aAAa,EACb,SAAS,EACT,QAAQ,EACR,SAAS,EACT,YAAY,GACb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EACL,MAAM,EACN,aAAa,EACb,UAAU,EACV,aAAa,GACd,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"ConferencingSelector.js","sourceRoot":"","sources":["../../../../src/react/components/booking-links/ConferencingSelector.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAE,KAAK,EAAsB,MAAM,OAAO,CAAC;AAClD,OAAO,EACL,eAAe,EACf,aAAa,EACb,SAAS,EACT,QAAQ,EACR,SAAS,EACT,YAAY,GACb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EACL,MAAM,EACN,aAAa,EACb,UAAU,EACV,aAAa,GACd,MAAM,wBAAw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E,MAAM,EAAE,SAAS,EAAC,SAAS,YAC7C,CAAC,CAAC,YAAY,CAAC,GACV,EACR,KAAC,KAAK,IACJ,EAAE,EAAE,GAAG,EAAE,MAAM,EACf,IAAI,EAAC,KAAK,EACV,KAAK,EAAE,KAAK,CAAC,GAAG,IAAI,EAAE,EACtB,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CACd,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC,EAE1D,WAAW,EAAC,+BAA+B,EAC3C,SAAS,EAAC,aAAa,GACvB,IACE,CACP,IACG,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomFieldsEditor.d.ts","sourceRoot":"","sources":["../../../../src/react/components/booking-links/CustomFieldsEditor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CustomFieldsEditor.d.ts","sourceRoot":"","sources":["../../../../src/react/components/booking-links/CustomFieldsEditor.tsx"],"names":[],"mappings":"AA+BA,MAAM,MAAM,eAAe,GACvB,MAAM,GACN,OAAO,GACP,KAAK,GACL,KAAK,GACL,UAAU,GACV,QAAQ,GACR,UAAU,CAAC;AAEf,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,eAAe,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,QAAQ,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,IAAI,CAAC;IAC1C,gFAAgF;IAChF,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAuCD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,2CAuVhE"}
|
|
@@ -20,38 +20,40 @@ import { Input } from "@/components/ui/input";
|
|
|
20
20
|
import { Label } from "@/components/ui/label";
|
|
21
21
|
import { Textarea } from "@/components/ui/textarea";
|
|
22
22
|
import { Switch } from "@/components/ui/switch";
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
import { useSchedulingT } from "../../i18n.js";
|
|
24
|
+
const TYPE_LABEL_KEYS = {
|
|
25
|
+
text: "shortText",
|
|
26
|
+
email: "email",
|
|
27
|
+
url: "url",
|
|
28
|
+
tel: "phone",
|
|
29
|
+
textarea: "longText",
|
|
30
|
+
select: "dropdown",
|
|
31
|
+
checkbox: "checkbox",
|
|
31
32
|
};
|
|
32
33
|
const PRESETS = [
|
|
33
34
|
{
|
|
34
|
-
|
|
35
|
+
labelKey: "linkedInProfile",
|
|
35
36
|
type: "url",
|
|
36
37
|
placeholder: "https://linkedin.com/in/yourname",
|
|
37
38
|
pattern: "^https?://(www\\.)?linkedin\\.com/in/.+",
|
|
38
|
-
|
|
39
|
+
patternErrorKey: "linkedInUrlError",
|
|
39
40
|
},
|
|
40
|
-
{
|
|
41
|
-
{
|
|
42
|
-
{
|
|
41
|
+
{ labelKey: "company", type: "text", placeholderKey: "companyPlaceholder" },
|
|
42
|
+
{ labelKey: "phoneNumber", type: "tel", placeholder: "+1 (555) 123-4567" },
|
|
43
|
+
{ labelKey: "website", type: "url", placeholder: "https://example.com" },
|
|
43
44
|
];
|
|
44
45
|
function cls(...parts) {
|
|
45
46
|
return parts.filter(Boolean).join(" ");
|
|
46
47
|
}
|
|
47
48
|
export function CustomFieldsEditor(props) {
|
|
49
|
+
const t = useSchedulingT();
|
|
48
50
|
const { fields, onChange, hideLabel } = props;
|
|
49
51
|
const [editingId, setEditingId] = useState(null);
|
|
50
52
|
const [showPresets, setShowPresets] = useState(false);
|
|
51
53
|
function addField(partial) {
|
|
52
54
|
const field = {
|
|
53
55
|
id: nanoid(8),
|
|
54
|
-
label: partial?.label || "
|
|
56
|
+
label: partial?.label || t("newField"),
|
|
55
57
|
type: partial?.type || "text",
|
|
56
58
|
required: partial?.required ?? true,
|
|
57
59
|
placeholder: partial?.placeholder,
|
|
@@ -82,36 +84,48 @@ export function CustomFieldsEditor(props) {
|
|
|
82
84
|
[next[idx], next[target]] = [next[target], next[idx]];
|
|
83
85
|
onChange(next);
|
|
84
86
|
}
|
|
85
|
-
return (_jsxs("div", { className: "space-y-3", children: [!hideLabel && (_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs(Label, { className: "flex items-center gap-1.5", children: [_jsx(IconListCheck, { className: "h-4 w-4" }), "
|
|
87
|
+
return (_jsxs("div", { className: "space-y-3", children: [!hideLabel && (_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs(Label, { className: "flex items-center gap-1.5", children: [_jsx(IconListCheck, { className: "h-4 w-4" }), t("customFields")] }), _jsxs("div", { className: "flex items-center gap-1", children: [_jsxs("button", { type: "button", onClick: () => setShowPresets((p) => !p), className: "flex items-center gap-1 rounded-md border border-border px-2 py-1 text-xs text-muted-foreground hover:bg-accent/60 hover:text-foreground", children: [_jsx(IconChevronDown, { className: cls("h-3 w-3 transition-transform", showPresets && "rotate-180") }), t("presets")] }), _jsxs("button", { type: "button", onClick: () => addField(), className: "flex items-center gap-1 rounded-md border border-border px-2 py-1 text-xs text-muted-foreground hover:bg-accent/60 hover:text-foreground", children: [_jsx(IconPlus, { className: "h-3 w-3" }), t("add")] })] })] })), showPresets && (_jsx("div", { className: "grid grid-cols-1 gap-1.5 sm:grid-cols-2", children: PRESETS.map((preset) => (_jsxs("button", { type: "button", onClick: () => addField({
|
|
88
|
+
label: t(preset.labelKey),
|
|
89
|
+
type: preset.type,
|
|
90
|
+
placeholder: preset.placeholderKey
|
|
91
|
+
? t(preset.placeholderKey)
|
|
92
|
+
: preset.placeholder,
|
|
93
|
+
pattern: preset.pattern,
|
|
94
|
+
patternError: preset.patternErrorKey
|
|
95
|
+
? t(preset.patternErrorKey)
|
|
96
|
+
: undefined,
|
|
97
|
+
}), className: "rounded-lg border border-border/60 px-3 py-2 text-left text-xs hover:border-primary/30 hover:bg-accent/60", children: [_jsx("p", { className: "font-medium", children: t(preset.labelKey) }), _jsx("p", { className: "text-muted-foreground", children: t(TYPE_LABEL_KEYS[preset.type]) })] }, preset.labelKey))) })), fields.length === 0 && !showPresets && (_jsx("p", { className: "text-xs text-muted-foreground", children: t("customFieldsEmpty") })), _jsx("div", { className: "space-y-2", children: fields.map((field) => {
|
|
86
98
|
const isEditing = editingId === field.id;
|
|
87
99
|
return (_jsxs("div", { className: "overflow-hidden rounded-lg border border-border", children: [_jsxs("div", { role: "button", tabIndex: 0, onClick: () => setEditingId(isEditing ? null : field.id), onKeyDown: (event) => {
|
|
88
100
|
if (event.key === "Enter" || event.key === " ") {
|
|
89
101
|
event.preventDefault();
|
|
90
102
|
setEditingId(isEditing ? null : field.id);
|
|
91
103
|
}
|
|
92
|
-
}, className: "flex w-full items-center gap-2 px-3 py-2.5 text-left hover:bg-accent/40", children: [_jsx(IconGripVertical, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground/40" }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("span", { className: "block truncate text-sm font-medium", children: field.label }), _jsxs("span", { className: "text-[11px] text-muted-foreground", children: [
|
|
104
|
+
}, className: "flex w-full items-center gap-2 px-3 py-2.5 text-left hover:bg-accent/40", children: [_jsx(IconGripVertical, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground/40" }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("span", { className: "block truncate text-sm font-medium", children: field.label }), _jsxs("span", { className: "text-[11px] text-muted-foreground", children: [t(TYPE_LABEL_KEYS[field.type]), field.required
|
|
105
|
+
? ` · ${t("required")}`
|
|
106
|
+
: ` · ${t("optional")}`, field.pattern ? ` · ${t("pattern")}` : ""] })] }), _jsxs("div", { className: "flex shrink-0 items-center gap-1", children: [_jsx("button", { type: "button", onClick: (e) => {
|
|
93
107
|
e.stopPropagation();
|
|
94
108
|
moveField(field.id, -1);
|
|
95
|
-
}, className: "p-0.5 text-muted-foreground/40 hover:text-foreground", title: "
|
|
109
|
+
}, className: "p-0.5 text-muted-foreground/40 hover:text-foreground", title: t("moveUp"), children: _jsx(IconChevronLeft, { className: "h-3 w-3 rotate-90" }) }), _jsx("button", { type: "button", onClick: (e) => {
|
|
96
110
|
e.stopPropagation();
|
|
97
111
|
moveField(field.id, 1);
|
|
98
|
-
}, className: "p-0.5 text-muted-foreground/40 hover:text-foreground", title: "
|
|
112
|
+
}, className: "p-0.5 text-muted-foreground/40 hover:text-foreground", title: t("moveDown"), children: _jsx(IconChevronRight, { className: "h-3 w-3 rotate-90" }) }), _jsx("button", { type: "button", onClick: (e) => {
|
|
99
113
|
e.stopPropagation();
|
|
100
114
|
removeField(field.id);
|
|
101
|
-
}, className: "p-0.5 text-muted-foreground/40 hover:text-destructive", title: "
|
|
115
|
+
}, className: "p-0.5 text-muted-foreground/40 hover:text-destructive", title: t("removeField"), children: _jsx(IconTrash, { className: "h-3 w-3" }) })] })] }), isEditing && (_jsxs("div", { className: "space-y-3 border-t border-border bg-muted/20 px-3 py-3", children: [_jsxs("div", { className: "grid grid-cols-1 gap-3 sm:grid-cols-2", children: [_jsxs("div", { className: "space-y-1.5", children: [_jsx(Label, { className: "text-xs", children: t("label") }), _jsx(Input, { value: field.label, onChange: (e) => updateField(field.id, { label: e.target.value }), placeholder: t("fieldLabel"), className: "h-8 text-sm" })] }), _jsxs("div", { className: "space-y-1.5", children: [_jsx(Label, { className: "text-xs", children: t("type") }), _jsx("select", { value: field.type, onChange: (e) => updateField(field.id, {
|
|
102
116
|
type: e.target.value,
|
|
103
|
-
}), className: "h-8 w-full rounded-md border border-input bg-background px-2 text-sm", children: Object.entries(
|
|
117
|
+
}), className: "h-8 w-full rounded-md border border-input bg-background px-2 text-sm", children: Object.entries(TYPE_LABEL_KEYS).map(([value, labelKey]) => (_jsx("option", { value: value, children: t(labelKey) }, value))) })] })] }), _jsxs("div", { className: "space-y-1.5", children: [_jsx(Label, { className: "text-xs", children: t("placeholder") }), _jsx(Input, { value: field.placeholder || "", onChange: (e) => updateField(field.id, {
|
|
104
118
|
placeholder: e.target.value || undefined,
|
|
105
|
-
}), placeholder: "
|
|
119
|
+
}), placeholder: t("placeholderText"), className: "h-8 text-sm" })] }), _jsxs("div", { className: "flex items-center justify-between", children: [_jsx(Label, { className: "text-xs", children: t("required") }), _jsx(Switch, { checked: field.required, onCheckedChange: (checked) => updateField(field.id, { required: checked }) })] }), field.type === "select" && (_jsxs("div", { className: "space-y-1.5", children: [_jsxs(Label, { className: "text-xs", children: [t("options"), " ", _jsx("span", { className: "font-normal text-muted-foreground", children: t("onePerLine") })] }), _jsx(Textarea, { value: (field.options || []).join("\n"), onChange: (e) => {
|
|
106
120
|
const options = e.target.value
|
|
107
121
|
.split("\n")
|
|
108
122
|
.filter((o) => o.trim());
|
|
109
123
|
updateField(field.id, { options });
|
|
110
|
-
}, placeholder: "Option 1\nOption 2\nOption 3", rows: 3, className: "text-sm" })] })), field.type !== "checkbox" && field.type !== "select" && (_jsxs("div", { className: "space-y-1.5", children: [_jsxs(Label, { className: "text-xs", children: ["
|
|
124
|
+
}, placeholder: "Option 1\nOption 2\nOption 3", rows: 3, className: "text-sm" })] })), field.type !== "checkbox" && field.type !== "select" && (_jsxs("div", { className: "space-y-1.5", children: [_jsxs(Label, { className: "text-xs", children: [t("validationPattern"), " ", _jsx("span", { className: "font-normal text-muted-foreground", children: t("regexOptional") })] }), _jsx(Input, { value: field.pattern || "", onChange: (e) => updateField(field.id, {
|
|
111
125
|
pattern: e.target.value || undefined,
|
|
112
|
-
}), placeholder: "e.g. ^https?://(www\\.)?linkedin\\.com/in/.+", className: "h-8 font-mono text-sm" }), field.pattern && (_jsxs("div", { className: "space-y-1.5", children: [_jsxs(Label, { className: "text-xs", children: ["
|
|
126
|
+
}), placeholder: "e.g. ^https?://(www\\.)?linkedin\\.com/in/.+", className: "h-8 font-mono text-sm" }), field.pattern && (_jsxs("div", { className: "space-y-1.5", children: [_jsxs(Label, { className: "text-xs", children: [t("errorMessage"), " ", _jsx("span", { className: "font-normal text-muted-foreground", children: t("errorMessageHint") })] }), _jsx(Input, { value: field.patternError || "", onChange: (e) => updateField(field.id, {
|
|
113
127
|
patternError: e.target.value || undefined,
|
|
114
128
|
}), placeholder: "e.g. Please enter a valid LinkedIn URL", className: "h-8 text-sm" })] }))] }))] }))] }, field.id));
|
|
115
|
-
}) }), hideLabel && (_jsxs("div", { className: "flex items-center gap-1.5", children: [_jsxs("button", { type: "button", onClick: () => setShowPresets((p) => !p), className: "flex items-center gap-1 rounded-md border border-border px-2 py-1 text-xs text-muted-foreground hover:bg-accent/60 hover:text-foreground", children: [_jsx(IconChevronDown, { className: cls("h-3 w-3 transition-transform", showPresets && "rotate-180") }), "
|
|
129
|
+
}) }), hideLabel && (_jsxs("div", { className: "flex items-center gap-1.5", children: [_jsxs("button", { type: "button", onClick: () => setShowPresets((p) => !p), className: "flex items-center gap-1 rounded-md border border-border px-2 py-1 text-xs text-muted-foreground hover:bg-accent/60 hover:text-foreground", children: [_jsx(IconChevronDown, { className: cls("h-3 w-3 transition-transform", showPresets && "rotate-180") }), t("presets")] }), _jsxs("button", { type: "button", onClick: () => addField(), className: "flex items-center gap-1 rounded-md border border-border px-2 py-1 text-xs text-muted-foreground hover:bg-accent/60 hover:text-foreground", children: [_jsx(IconPlus, { className: "h-3 w-3" }), t("addField")] })] }))] }));
|
|
116
130
|
}
|
|
117
131
|
//# sourceMappingURL=CustomFieldsEditor.js.map
|