@ohhwells/bridge 0.1.21 → 0.1.23
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/index.cjs +23 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +23 -17
- package/dist/index.js.map +1 -1
- package/dist/styles.css +4 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -256,10 +256,10 @@ function buildTimezoneLabel(tz) {
|
|
|
256
256
|
return tz;
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
|
-
function EmptyState({ inEditor }) {
|
|
259
|
+
function EmptyState({ inEditor, insertAfter }) {
|
|
260
260
|
const handleAddSchedule = () => {
|
|
261
261
|
if (inEditor) {
|
|
262
|
-
window.parent.postMessage({ type: "ow:scheduling-not-connected" }, "*");
|
|
262
|
+
window.parent.postMessage({ type: "ow:scheduling-not-connected", insertAfter }, "*");
|
|
263
263
|
}
|
|
264
264
|
};
|
|
265
265
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex flex-col items-center justify-center gap-6 p-12 bg-[#FAFAF9] border-2 border-dashed border-[#E7E5E4] rounded-[10px] h-[264px] w-full box-border", children: [
|
|
@@ -484,18 +484,21 @@ function ScheduleView({ schedule, dates, selectedIdx, onSelectDate, onOpenModal
|
|
|
484
484
|
const booked = getBookingsOnDate(cls, selectedDate);
|
|
485
485
|
const available = cls.maxParticipants - booked;
|
|
486
486
|
const isFull = available <= 0;
|
|
487
|
+
const isPrivate = cls.maxParticipants === 1;
|
|
487
488
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { children: [
|
|
488
489
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex gap-4 py-4 sm:items-center sm:gap-[60px] box-border", children: [
|
|
489
490
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex flex-col gap-2 shrink-0 sm:contents", children: [
|
|
490
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
491
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex flex-col gap-2 sm:w-[120px] sm:shrink-0", children: [
|
|
492
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "font-body text-base font-bold text-(--color-dark,#200C02) block", children: formatClassTime(cls) }),
|
|
493
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
494
|
+
"span",
|
|
495
|
+
{
|
|
496
|
+
className: "inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium w-fit",
|
|
497
|
+
style: isPrivate ? { background: "#DDFBE3", color: "#199130", border: "1px solid #199130", fontWeight: 500 } : { background: "#EEEDFF", color: "#5953FF", border: "1px solid #5953FF", fontWeight: 500 },
|
|
498
|
+
children: isPrivate ? "PRIVATE" : "GROUP"
|
|
499
|
+
}
|
|
500
|
+
)
|
|
501
|
+
] }),
|
|
499
502
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "sm:hidden flex flex-col gap-px", children: isFull ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "font-body text-sm text-(--color-dark,#200C02) opacity-80", children: "Full" }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
500
503
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "font-body text-sm text-(--color-dark,#200C02) opacity-80", children: [
|
|
501
504
|
available,
|
|
@@ -714,6 +717,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
|
|
|
714
717
|
window.parent.postMessage({ type: "ow:scheduling-not-connected", insertAfter }, "*");
|
|
715
718
|
}
|
|
716
719
|
};
|
|
720
|
+
if (!inEditor && !loading && !schedule) return null;
|
|
717
721
|
const sectionId = `scheduling-${insertAfter}`;
|
|
718
722
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
719
723
|
"section",
|
|
@@ -759,7 +763,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
|
|
|
759
763
|
] }),
|
|
760
764
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "w-full flex flex-col items-end gap-3", children: [
|
|
761
765
|
timezoneLabel && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "font-body text-sm font-normal text-(--color-accent,#A89B83)", children: timezoneLabel }),
|
|
762
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "w-full p-0 sm:p-10 box-border", children: loading ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(LoadingSkeleton, {}) : !schedule ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(EmptyState, { inEditor }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
766
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "w-full p-0 sm:p-10 box-border", children: loading ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(LoadingSkeleton, {}) : !schedule ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(EmptyState, { inEditor, insertAfter }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
763
767
|
ScheduleView,
|
|
764
768
|
{
|
|
765
769
|
schedule,
|
|
@@ -4378,9 +4382,10 @@ function initSectionsFromContent(content, removeExisting = false) {
|
|
|
4378
4382
|
const inEditor = typeof window !== "undefined" && window.self !== window.top;
|
|
4379
4383
|
if (inEditor) getSectionsTracker().textContent = raw;
|
|
4380
4384
|
const pageEntries = getPageSchedulingEntries(raw);
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4385
|
+
const notifyForEntry = inEditor ? (e) => !e.scheduleId : false;
|
|
4386
|
+
mountSchedulingEntries(pageEntries, notifyForEntry);
|
|
4387
|
+
requestAnimationFrame(() => retryMissingSchedulingMounts(pageEntries, notifyForEntry));
|
|
4388
|
+
setTimeout(() => retryMissingSchedulingMounts(pageEntries, notifyForEntry), 250);
|
|
4384
4389
|
} catch {
|
|
4385
4390
|
}
|
|
4386
4391
|
}
|
|
@@ -4439,8 +4444,9 @@ function mountSchedulingEntries(entries, notifyOnConnect = false) {
|
|
|
4439
4444
|
const pending = entries.filter((e) => e.type === "scheduling").sort((a, b) => schedulingMountDepth(a.insertAfter) - schedulingMountDepth(b.insertAfter));
|
|
4440
4445
|
for (let attempt = 0; attempt < pending.length + 1 && pending.length > 0; attempt++) {
|
|
4441
4446
|
for (let i = pending.length - 1; i >= 0; i--) {
|
|
4442
|
-
const
|
|
4443
|
-
|
|
4447
|
+
const entry = pending[i];
|
|
4448
|
+
const shouldNotify = typeof notifyOnConnect === "function" ? notifyOnConnect(entry) : notifyOnConnect;
|
|
4449
|
+
if (mountSchedulingWidget(entry.insertAfter, shouldNotify, entry.scheduleId)) {
|
|
4444
4450
|
pending.splice(i, 1);
|
|
4445
4451
|
}
|
|
4446
4452
|
}
|