@odla-ai/chapter 0.53.0 → 0.54.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -2
- package/dist/{chunk-PTC43J7F.js → chunk-NDZCR3OW.js} +5 -5
- package/dist/chunk-NDZCR3OW.js.map +1 -0
- package/dist/{chunk-TEHCORNC.js → chunk-SPEL4OGE.js} +57 -23
- package/dist/chunk-SPEL4OGE.js.map +1 -0
- package/dist/index.cjs +219 -106
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +30 -10
- package/dist/index.d.ts +30 -10
- package/dist/index.js +219 -106
- package/dist/index.js.map +1 -1
- package/dist/ui/admin/index.js +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +8 -2
- package/dist/ui/member/index.d.ts +32 -1
- package/dist/ui/member/index.js +7 -1
- package/dist/worker/index.cjs +297 -128
- package/dist/worker/index.cjs.map +1 -1
- package/dist/worker/index.d.cts +92 -9
- package/dist/worker/index.d.ts +92 -9
- package/dist/worker/index.js +297 -128
- package/dist/worker/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-PTC43J7F.js.map +0 -1
- package/dist/chunk-TEHCORNC.js.map +0 -1
|
@@ -76,8 +76,8 @@ function SlotPicker(props) {
|
|
|
76
76
|
const byDay = useMemo(() => groupSlotsByDay(slots, timezone), [slots, timezone]);
|
|
77
77
|
const dayKeys = [...byDay.keys()];
|
|
78
78
|
const [activeDay, setActiveDay] = useState(dayKeys[0]);
|
|
79
|
-
const
|
|
80
|
-
const times = (
|
|
79
|
+
const day2 = activeDay !== void 0 && byDay.has(activeDay) ? activeDay : dayKeys[0];
|
|
80
|
+
const times = (day2 !== void 0 ? byDay.get(day2) : void 0) ?? [];
|
|
81
81
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
82
82
|
/* @__PURE__ */ jsx("div", { className: classes.days, children: dayKeys.map((key) => {
|
|
83
83
|
const first = byDay.get(key)?.[0];
|
|
@@ -86,7 +86,7 @@ function SlotPicker(props) {
|
|
|
86
86
|
{
|
|
87
87
|
type: "button",
|
|
88
88
|
className: classes.day,
|
|
89
|
-
"aria-pressed": key ===
|
|
89
|
+
"aria-pressed": key === day2,
|
|
90
90
|
onClick: () => {
|
|
91
91
|
setActiveDay(key);
|
|
92
92
|
onDayChange?.();
|
|
@@ -673,10 +673,31 @@ var MemberGifts = GiftPurchases;
|
|
|
673
673
|
// src/ui/member-named-seat.tsx
|
|
674
674
|
import { useEffect as useEffect4, useState as useState7 } from "preact/hooks";
|
|
675
675
|
import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs9 } from "preact/jsx-runtime";
|
|
676
|
+
var NAMED_SEAT_RECIPIENT_WORDS = {
|
|
677
|
+
payment_pending: "payment in progress",
|
|
678
|
+
invited: "invited, waiting for them to accept",
|
|
679
|
+
accepted: "accepted, their application is in review",
|
|
680
|
+
joined: "joined as a member",
|
|
681
|
+
declined: "declined the seat",
|
|
682
|
+
refunded: "seat refunded",
|
|
683
|
+
canceled: "seat canceled"
|
|
684
|
+
};
|
|
685
|
+
var day = (at) => new Date(at).toLocaleDateString("en-US", { timeZone: "UTC" });
|
|
686
|
+
function NamedSeatRecipientLine({ seat }) {
|
|
687
|
+
const words = NAMED_SEAT_RECIPIENT_WORDS[seat.recipientState] ?? seat.status.replaceAll("_", " ");
|
|
688
|
+
return /* @__PURE__ */ jsxs9("p", { className: "member-named-seat-recipient", children: [
|
|
689
|
+
seat.recipientName,
|
|
690
|
+
" \xB7 ",
|
|
691
|
+
seat.recipientEmail,
|
|
692
|
+
" \xB7 ",
|
|
693
|
+
words,
|
|
694
|
+
seat.recipientState === "joined" && seat.joinedAt ? ` on ${day(seat.joinedAt)}` : seat.acceptedAt && seat.recipientState === "accepted" ? ` on ${day(seat.acceptedAt)}` : ""
|
|
695
|
+
] });
|
|
696
|
+
}
|
|
676
697
|
function NamedSeatPurchase({ api }) {
|
|
677
698
|
const [data, setData] = useState7(null), [error, setError] = useState7("");
|
|
678
699
|
const [name, setName] = useState7(""), [email, setEmail] = useState7(""), [reviewing, setReviewing] = useState7(false);
|
|
679
|
-
const [terms, setTerms] = useState7(false), [pending, setPending] = useState7(false);
|
|
700
|
+
const [terms, setTerms] = useState7(false), [pending, setPending] = useState7(false), [granting, setGranting] = useState7(false);
|
|
680
701
|
const load = async () => {
|
|
681
702
|
try {
|
|
682
703
|
const value = await api("/api/named-seat");
|
|
@@ -693,25 +714,38 @@ function NamedSeatPurchase({ api }) {
|
|
|
693
714
|
useEffect4(() => {
|
|
694
715
|
void load();
|
|
695
716
|
}, []);
|
|
717
|
+
const checkout = () => api("/api/named-seat/checkout", {
|
|
718
|
+
method: "POST",
|
|
719
|
+
headers: { "content-type": "application/json" },
|
|
720
|
+
body: JSON.stringify({ recipientName: name, recipientEmail: email, quoteDigest: data?.digest, seatTermsAck: true, refundPolicyAck: true })
|
|
721
|
+
});
|
|
722
|
+
const grant = async () => {
|
|
723
|
+
setGranting(true);
|
|
724
|
+
setError("");
|
|
725
|
+
try {
|
|
726
|
+
const receipt = await checkout();
|
|
727
|
+
if (receipt.included !== true) throw new Error("grant");
|
|
728
|
+
setReviewing(false);
|
|
729
|
+
await load();
|
|
730
|
+
} catch {
|
|
731
|
+
setError("The seat could not be granted. Refresh to check its status before trying again.");
|
|
732
|
+
} finally {
|
|
733
|
+
setGranting(false);
|
|
734
|
+
}
|
|
735
|
+
};
|
|
696
736
|
const money = data ? new Intl.NumberFormat("en-US", { style: "currency", currency: data.currency }).format(data.amountCents / 100) : "";
|
|
697
737
|
return /* @__PURE__ */ jsx9(JourneyFrame, { children: /* @__PURE__ */ jsxs9("section", { className: "card member-named-seat", "aria-label": "Named additional seat", children: [
|
|
698
738
|
/* @__PURE__ */ jsx9("h2", { children: "Named additional seat" }),
|
|
699
739
|
error ? /* @__PURE__ */ jsx9("p", { role: "alert", children: error }) : null,
|
|
700
740
|
data ? /* @__PURE__ */ jsxs9(Fragment3, { children: [
|
|
701
|
-
data.seat ? /* @__PURE__ */
|
|
702
|
-
data.seat.recipientName,
|
|
703
|
-
" \xB7 ",
|
|
704
|
-
data.seat.recipientEmail,
|
|
705
|
-
" \xB7 ",
|
|
706
|
-
data.seat.status.replaceAll("_", " ")
|
|
707
|
-
] }) : null,
|
|
741
|
+
data.seat ? /* @__PURE__ */ jsx9(NamedSeatRecipientLine, { seat: data.seat }) : null,
|
|
708
742
|
data.eligible ? /* @__PURE__ */ jsxs9(Fragment3, { children: [
|
|
709
743
|
/* @__PURE__ */ jsxs9("p", { children: [
|
|
710
|
-
money
|
|
711
|
-
"
|
|
744
|
+
data.included ? "Included with your membership at no charge." : `${money} paid in full now.`,
|
|
745
|
+
" This seat ",
|
|
712
746
|
data.autoRenew ? "renews with your primary membership" : "ends with your primary membership",
|
|
713
747
|
" on ",
|
|
714
|
-
|
|
748
|
+
day(data.termEndsAt),
|
|
715
749
|
".",
|
|
716
750
|
data.autoRenew ? ` Renewal then repeats every ${data.interval}; cancel renewal through your primary membership.` : " Your primary membership renewal is canceled; buying this seat does not turn it back on.",
|
|
717
751
|
" ",
|
|
@@ -746,19 +780,16 @@ function NamedSeatPurchase({ api }) {
|
|
|
746
780
|
}, children: "Back to recipient" }),
|
|
747
781
|
/* @__PURE__ */ jsxs9("label", { className: "journey-consent", children: [
|
|
748
782
|
/* @__PURE__ */ jsx9("input", { type: "checkbox", checked: terms, onChange: (event) => setTerms(event.currentTarget.checked) }),
|
|
749
|
-
/* @__PURE__ */ jsx9("span", { children: data.autoRenew ? "I agree to the full initial payment and automatic renewal with my membership; I can cancel renewal." : "I agree to the full initial payment and the displayed end date, with no automatic renewal while my membership renewal is canceled." })
|
|
783
|
+
/* @__PURE__ */ jsx9("span", { children: data.included ? "I agree to the seat terms and the refund policy; the seat is included with my membership and follows its renewal." : data.autoRenew ? "I agree to the full initial payment and automatic renewal with my membership; I can cancel renewal." : "I agree to the full initial payment and the displayed end date, with no automatic renewal while my membership renewal is canceled." })
|
|
750
784
|
] }),
|
|
751
|
-
terms ? /* @__PURE__ */ jsx9(
|
|
785
|
+
terms && data.included ? /* @__PURE__ */ jsx9("button", { className: "btn primary", type: "button", disabled: granting, onClick: () => void grant(), children: granting ? "Sending the invitation\u2026" : "Send the invitation" }) : null,
|
|
786
|
+
terms && !data.included ? /* @__PURE__ */ jsx9(
|
|
752
787
|
PaymentStep,
|
|
753
788
|
{
|
|
754
789
|
applicationId: data.membershipId,
|
|
755
790
|
refundPolicyText: data.refundPolicyText,
|
|
756
791
|
merchantDisclosureText: data.merchantDisclosureText,
|
|
757
|
-
startCheckout:
|
|
758
|
-
method: "POST",
|
|
759
|
-
headers: { "content-type": "application/json" },
|
|
760
|
-
body: JSON.stringify({ recipientName: name, recipientEmail: email, quoteDigest: data.digest, seatTermsAck: true, refundPolicyAck: true })
|
|
761
|
-
}),
|
|
792
|
+
startCheckout: checkout,
|
|
762
793
|
onPaid: () => {
|
|
763
794
|
setPending(true);
|
|
764
795
|
setReviewing(false);
|
|
@@ -767,7 +798,7 @@ function NamedSeatPurchase({ api }) {
|
|
|
767
798
|
}
|
|
768
799
|
) : null
|
|
769
800
|
] })
|
|
770
|
-
] }) : !data.seat ? /* @__PURE__ */ jsx9("p", { children: data.purchaseWindowed === false ? "An additional seat can be purchased for as long as your membership stays paid." : `Additional seats can be purchased until ${
|
|
801
|
+
] }) : !data.seat ? /* @__PURE__ */ jsx9("p", { children: data.purchaseWindowed === false ? "An additional seat can be purchased for as long as your membership stays paid." : `Additional seats can be purchased until ${day(data.purchaseEndsAt)}.` }) : null,
|
|
771
802
|
pending ? /* @__PURE__ */ jsx9("p", { role: "status", children: "Payment confirmation is being reconciled. The recipient\u2019s access begins only after their own acceptance and approval." }) : null
|
|
772
803
|
] }) : !error ? /* @__PURE__ */ jsx9("p", { children: "Loading your seat terms\u2026" }) : null,
|
|
773
804
|
/* @__PURE__ */ jsx9("button", { className: "btn secondary", onClick: () => void load(), children: "Refresh seat status" })
|
|
@@ -2042,6 +2073,9 @@ export {
|
|
|
2042
2073
|
GiftOfferCards,
|
|
2043
2074
|
GiftPurchases,
|
|
2044
2075
|
MemberGifts,
|
|
2076
|
+
NAMED_SEAT_RECIPIENT_WORDS,
|
|
2077
|
+
NamedSeatRecipientLine,
|
|
2078
|
+
NamedSeatPurchase,
|
|
2045
2079
|
MemberContentArea,
|
|
2046
2080
|
MembersArea,
|
|
2047
2081
|
useTierSelection,
|
|
@@ -2054,4 +2088,4 @@ export {
|
|
|
2054
2088
|
membershipApplicationHref,
|
|
2055
2089
|
MembershipCards
|
|
2056
2090
|
};
|
|
2057
|
-
//# sourceMappingURL=chunk-
|
|
2091
|
+
//# sourceMappingURL=chunk-SPEL4OGE.js.map
|