your-ai-workflow-firebase-os 2.0.1 → 2.0.3

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.
Files changed (183) hide show
  1. package/dist/AccessNotice-BZ5Gt1nP.js +40 -0
  2. package/dist/AccessNotice-CN7kc70o.cjs +1 -0
  3. package/dist/{AddressField-R-HvndkG.js → AddressField-9Sqn8TvC.js} +3 -3
  4. package/dist/{AddressField-BkzFOo2t.cjs → AddressField-B7wtV8yA.cjs} +1 -1
  5. package/dist/Assets-DBMwZ3bN.cjs +1 -0
  6. package/dist/Assets-DT-NU_WO.js +296 -0
  7. package/dist/Attachments-Bl9_dfsu.js +46 -0
  8. package/dist/Attachments-UVK9SRXf.cjs +1 -0
  9. package/dist/Billing-0RIHayHy.cjs +1 -0
  10. package/dist/Billing-FNE2r3_d.js +379 -0
  11. package/dist/BookingCalendar-BP5kiv3d.cjs +1 -0
  12. package/dist/BookingCalendar-DZ2fEFja.js +309 -0
  13. package/dist/Button-4lzOE31p.js +48 -0
  14. package/dist/Button-5DlB2MCi.cjs +1 -0
  15. package/dist/CalendarView-BimoXy_k.cjs +1 -0
  16. package/dist/CalendarView-D-ykjpvI.js +664 -0
  17. package/dist/ConfirmModal-Di9GR-vV.cjs +1 -0
  18. package/dist/ConfirmModal-gKQEpd4d.js +113 -0
  19. package/dist/ContactPopup-BXnHrRwl.js +1114 -0
  20. package/dist/ContactPopup-lxmRMoIa.cjs +1 -0
  21. package/dist/CopyLink-BpEQWmfI.cjs +1 -0
  22. package/dist/CopyLink-CBAVfcm1.js +43 -0
  23. package/dist/DashboardNav-CXa_ci-_.cjs +1 -0
  24. package/dist/DashboardNav-Dmn7PVSp.js +886 -0
  25. package/dist/EmailAdmin-CjN_rvxT.js +318 -0
  26. package/dist/EmailAdmin-lAEBdY1s.cjs +1 -0
  27. package/dist/EventCard-46EquygT.cjs +1 -0
  28. package/dist/EventCard-B6xD-mk3.js +97 -0
  29. package/dist/FileViewerPopup-CX-J75TM.js +1283 -0
  30. package/dist/FileViewerPopup-D8-MmIoS.cjs +3 -0
  31. package/dist/FormNote-BivRNA3J.js +50 -0
  32. package/dist/FormNote-BtdTGpml.cjs +1 -0
  33. package/dist/FormsAdmin-B5PBCG2W.js +812 -0
  34. package/dist/FormsAdmin-BQCULvi5.cjs +1 -0
  35. package/dist/Inbox-BPk2ZkE5.js +779 -0
  36. package/dist/Inbox-DNrcBx0o.cjs +3 -0
  37. package/dist/Loader-Bu89fsbB.cjs +1 -0
  38. package/dist/Loader-D4gwgBOq.js +32 -0
  39. package/dist/ManagePlanButton-B0dwqZBd.cjs +1 -0
  40. package/dist/ManagePlanButton-BSrOHYze.js +29 -0
  41. package/dist/MyBookings-6qr0GgzO.cjs +1 -0
  42. package/dist/MyBookings-BQjGM2LQ.js +113 -0
  43. package/dist/PageTitle-CZhgmmDT.cjs +3 -0
  44. package/dist/PageTitle-D93YCiN8.js +1606 -0
  45. package/dist/PagesAdmin-BcHIcqM5.cjs +34 -0
  46. package/dist/PagesAdmin-D69P9nRb.js +5802 -0
  47. package/dist/PagesAdmin-DNwZOKjA.cjs +1 -0
  48. package/dist/PagesAdmin-HUITEcHx.js +3 -0
  49. package/dist/PaymentsAdmin-C2iCI9qC.js +1291 -0
  50. package/dist/PaymentsAdmin-CoXi2vCm.cjs +2 -0
  51. package/dist/{PhoneInputField-B3P_vUDW.cjs → PhoneInputField-BEwYZMB7.cjs} +1 -1
  52. package/dist/{PhoneInputField-BlYHb5e0.js → PhoneInputField-BG0L2djE.js} +2 -2
  53. package/dist/PhoneInputField-DfOtCIH_.js +2 -0
  54. package/dist/{PhoneInputField-CdNTvWXQ.cjs → PhoneInputField-jhWvto8C.cjs} +1 -1
  55. package/dist/Popup-DHYGFl2-.cjs +1 -0
  56. package/dist/Popup-xROLytgr.js +142 -0
  57. package/dist/ProviderMark-BBfaM5Yl.js +52 -0
  58. package/dist/ProviderMark-xLkUN3Fx.cjs +1 -0
  59. package/dist/PublishApp-Bm-6r3Td.js +595 -0
  60. package/dist/PublishApp-D4XJUkJa.cjs +2 -0
  61. package/dist/Said-CoC15awL.js +94 -0
  62. package/dist/Said-IqCNofdh.cjs +1 -0
  63. package/dist/ScheduleAdmin-BKfQkrR8.js +1853 -0
  64. package/dist/ScheduleAdmin-DwK36GAZ.cjs +1 -0
  65. package/dist/SchedulePicker--urIH2Eb.js +112 -0
  66. package/dist/SchedulePicker-nmqzUnUH.cjs +1 -0
  67. package/dist/Setup-CHLgd-ag.js +849 -0
  68. package/dist/Setup-CaDranTm.cjs +1374 -0
  69. package/dist/SetupPayments-CVIwh1eQ.js +411 -0
  70. package/dist/SetupPayments-HNXWA25X.cjs +1 -0
  71. package/dist/SignInAdmin-C94-A-0w.cjs +4 -0
  72. package/dist/SignInAdmin-Yxgv_8U4.js +766 -0
  73. package/dist/SupportBar-CDT0HwdP.cjs +1 -0
  74. package/dist/SupportBar-CN_JGC-9.js +117 -0
  75. package/dist/SystemTabContent-L3vGGF3P.cjs +1 -0
  76. package/dist/SystemTabContent-QdxxLILE.js +35 -0
  77. package/dist/TemplateDrive-DV8zNjYe.cjs +1 -0
  78. package/dist/TemplateDrive-NJY_AAvV.js +1197 -0
  79. package/dist/ThemeAdmin-BzFjJkLg.js +269 -0
  80. package/dist/ThemeAdmin-DVnPNxe7.cjs +1 -0
  81. package/dist/ThemeAdmin-DY7Vc4Sj.cjs +3 -0
  82. package/dist/ThemeAdmin-DnC-D2N3.js +2 -0
  83. package/dist/{ContactPopup-9J_YeJrb.js → TimeZoneField-DkI1Bkcz.js} +3382 -5513
  84. package/dist/TimeZoneField-qs7NPR30.cjs +12 -0
  85. package/dist/TransactionsAdmin-BsZ-oQWi.js +582 -0
  86. package/dist/TransactionsAdmin-CTSTiPld.cjs +1 -0
  87. package/dist/Trouble-9es_AI4F.cjs +1 -0
  88. package/dist/Trouble-oWt9fMsm.js +164 -0
  89. package/dist/Users-CTitWXyd.cjs +1 -0
  90. package/dist/Users-DJjQTWJF.js +1207 -0
  91. package/dist/aiModels-DIP9fn8T.cjs +1 -0
  92. package/dist/{aiModels-BHlEfuRJ.js → aiModels-DnDhNGup.js} +29 -61
  93. package/dist/arrivalRoads-BJ-35vkk.js +228 -0
  94. package/dist/arrivalRoads-qoU-B4jt.cjs +4 -0
  95. package/dist/{bake-D0gLVNTL.cjs → bake-n2wyFw0B.cjs} +1 -1
  96. package/dist/{bake-OErV2MLy.js → bake-naZeMu98.js} +14 -14
  97. package/dist/bookingPages-C7a3srPG.js +102 -0
  98. package/dist/bookingPages-DvbFbD9X.cjs +1 -0
  99. package/dist/components/CustomSelect.d.ts +7 -1
  100. package/dist/components/RegistrationFields.d.ts +6 -1
  101. package/dist/components/Reveal.d.ts +12 -0
  102. package/dist/components/ScrollToTop.d.ts +4 -0
  103. package/dist/contentFallback-C9MZjdq7.cjs +1 -0
  104. package/dist/contentFallback-CEDY0Pwp.js +96 -0
  105. package/dist/contentKey-Bwry4lDa.js +13 -0
  106. package/dist/contentKey-DJGYYnAE.cjs +1 -0
  107. package/dist/{dist-_zWHDDrc.js → dist-DUPvBnOA.js} +1 -1
  108. package/dist/email-BfnZnMwD.cjs +1 -0
  109. package/dist/email-Ddj8Dlu6.js +58 -0
  110. package/dist/{fileBytes-B0qxHYQL.cjs → fileBytes-BJPaiX9Y.cjs} +1 -1
  111. package/dist/{fileBytes-uhq3pGCS.js → fileBytes-bjgvCfWu.js} +2 -2
  112. package/dist/forms-Bvx9HTM6.js +75 -0
  113. package/dist/forms-CmNeTETW.cjs +1 -0
  114. package/dist/lib/ThemeContext.d.ts +0 -14
  115. package/dist/lib/bareImgWatch.d.ts +6 -1
  116. package/dist/lib/localEdits.d.ts +2 -0
  117. package/dist/lib/pageDesignLines.d.ts +1 -1
  118. package/dist/lib/paymentProducts.d.ts +8 -0
  119. package/dist/lib/payments.d.ts +11 -1
  120. package/dist/lib/people.d.ts +9 -0
  121. package/dist/lib/recordsKey.d.ts +24 -0
  122. package/dist/{lucide-react-DiyP8FA_.js → lucide-react-CA7GD7Nv.js} +8 -8
  123. package/dist/notices-B7iIrIEg.js +29 -0
  124. package/dist/notices-upMg8UVh.cjs +1 -0
  125. package/dist/openOnArrival-Buwqb86D.cjs +1 -0
  126. package/dist/openOnArrival-S2K6v-lB.js +35 -0
  127. package/dist/pageFiles--Ih60ITP.js +45 -0
  128. package/dist/pageFiles-UtBmlOcD.cjs +1 -0
  129. package/dist/pages/PagesAdmin.d.ts +69 -7
  130. package/dist/{pdf-DLuvpvHg.js → pdf-DRXcPGkr.js} +1 -1
  131. package/dist/{pdf.worker.min-C0gkd2Ec.js → pdf.worker.min-CfKZezeM.js} +1 -1
  132. package/dist/people-2jZE_pdI.js +102 -0
  133. package/dist/people-BpVvIr9-.cjs +1 -0
  134. package/dist/personName-CFw3pxuu.js +18 -0
  135. package/dist/personName-CbzN_i57.cjs +1 -0
  136. package/dist/publishSteps-C1cDFzzB.js +88 -0
  137. package/dist/publishSteps-SSm8afDw.cjs +1 -0
  138. package/dist/recordLock-DHVvI9bP.js +61 -0
  139. package/dist/recordLock-DWeIxiwh.cjs +1 -0
  140. package/dist/recordsKey-B7QrxdeU.cjs +1 -0
  141. package/dist/recordsKey-D5-wC0Aw.js +141 -0
  142. package/dist/registrationFields-CLeR2lQJ.js +181 -0
  143. package/dist/registrationFields-v4pOoRdn.cjs +1 -0
  144. package/dist/renderer.cjs.js +1 -1
  145. package/dist/renderer.es.js +1 -1
  146. package/dist/roles-D6VaHWfV.js +147 -0
  147. package/dist/roles-DQUFFBQe.cjs +1 -0
  148. package/dist/scheduleData-ATN8w5hI.js +727 -0
  149. package/dist/scheduleData-Cltj0ABZ.cjs +1 -0
  150. package/dist/server.cjs.js +6 -6
  151. package/dist/server.es.js +716 -715
  152. package/dist/serviceStatus-TQyZO_Y_.cjs +1 -0
  153. package/dist/serviceStatus-vS8AI7SZ.js +125 -0
  154. package/dist/tabAudience-BqpN6dsR.cjs +1 -0
  155. package/dist/tabAudience-CRyMvv0v.js +34 -0
  156. package/dist/transactions-BqMQDRx3.js +343 -0
  157. package/dist/transactions-CufFrdAM.cjs +1 -0
  158. package/dist/useIsPhone-BVGx_X3e.js +13 -0
  159. package/dist/useIsPhone-o63tNneA.cjs +1 -0
  160. package/dist/{validate-DzSJWuyL.js → validate-CmC_tLK-.js} +433 -351
  161. package/dist/validate-DZMwqSrb.cjs +103 -0
  162. package/dist/vite/validate.d.ts +14 -0
  163. package/dist/vite.cjs.js +1 -1
  164. package/dist/vite.es.js +1 -1
  165. package/dist/your-ai-workflow-firebase-os.cjs.js +15 -1431
  166. package/dist/your-ai-workflow-firebase-os.css +1 -1
  167. package/dist/your-ai-workflow-firebase-os.es.js +11695 -35911
  168. package/package.json +1 -1
  169. package/src/index.css +122 -2
  170. package/dist/ContactPopup-DF8qQCoY.cjs +0 -12
  171. package/dist/PhoneInputField-Btx07xvM.js +0 -2
  172. package/dist/aiModels-BIhoTNH0.cjs +0 -1
  173. package/dist/validate-e48WXJdP.cjs +0 -103
  174. /package/dist/{address-DI1YaCI4.cjs → address-Bsb8COq2.cjs} +0 -0
  175. /package/dist/{address-Ca1h_UZX.js → address-C2bHNxJU.js} +0 -0
  176. /package/dist/{dist-BLGlDv1e.cjs → dist-E4jTFPs7.cjs} +0 -0
  177. /package/dist/{lucide-react-BYniZ3lQ.cjs → lucide-react-BwV6L6Is.cjs} +0 -0
  178. /package/dist/{mediaKind-dk396a03.cjs → mediaKind-D0MWyv6b.cjs} +0 -0
  179. /package/dist/{mediaKind-De2Cx_kB.js → mediaKind-DmKMsjeY.js} +0 -0
  180. /package/dist/{pdf-CC5g01eC.cjs → pdf-jLjjhvjp.cjs} +0 -0
  181. /package/dist/{pdf.worker.min-pI_P-OCl.cjs → pdf.worker.min-bLgNWd7w.cjs} +0 -0
  182. /package/dist/{verifiedAccount-C1iCxopN.js → verifiedAccount-DRbRFJ6H.js} +0 -0
  183. /package/dist/{verifiedAccount-D3OeaOBo.cjs → verifiedAccount-DScyKk96.cjs} +0 -0
@@ -0,0 +1,582 @@
1
+ import { t as e } from "./PageTitle-D93YCiN8.js";
2
+ import { Nn as t, T as n, Ta as r, Vn as i, cr as a, dr as o, g as s, ka as c, o as l, or as u, sr as d } from "./TimeZoneField-DkI1Bkcz.js";
3
+ import { t as f } from "./DashboardNav-Dmn7PVSp.js";
4
+ import { h as p } from "./verifiedAccount-DRbRFJ6H.js";
5
+ import { C as m, Ht as h, on as g } from "./lucide-react-CA7GD7Nv.js";
6
+ import { t as _ } from "./Loader-D4gwgBOq.js";
7
+ import { a as v, d as y, f as b, l as x, n as S, r as C, s as w, t as T, u as E } from "./transactions-BqMQDRx3.js";
8
+ import { t as D } from "./FileViewerPopup-CX-J75TM.js";
9
+ import { t as O } from "./FormNote-BivRNA3J.js";
10
+ import { t as k } from "./ConfirmModal-gKQEpd4d.js";
11
+ import { t as ee } from "./SupportBar-CN_JGC-9.js";
12
+ import { t as te } from "./openOnArrival-S2K6v-lB.js";
13
+ import { r as A } from "./serviceStatus-vS8AI7SZ.js";
14
+ import { t as j } from "./Attachments-Bl9_dfsu.js";
15
+ import { Fragment as M, useCallback as N, useEffect as P, useMemo as F, useRef as I, useState as L } from "react";
16
+ import { Fragment as R, jsx as z, jsxs as B } from "react/jsx-runtime";
17
+ import { collection as V, deleteDoc as ne, doc as re, onSnapshot as ie, orderBy as H, query as U, where as W } from "firebase/firestore";
18
+ import { Link as G, useSearchParams as K } from "react-router-dom";
19
+ //#region src/pages/TransactionsAdmin.tsx
20
+ function q(e) {
21
+ let [t, n] = L({}), [i, a] = L({}), [o, s] = L("");
22
+ return P(() => {
23
+ let t = T.map((t) => ie(e ? U(V(c, t), W("transaction", "==", !0)) : U(V(c, t), H("submittedAt", "desc")), (e) => {
24
+ let r = e.docs.map((e) => ({
25
+ ...e.data(),
26
+ id: e.id,
27
+ collection: t
28
+ })).filter(v);
29
+ n((e) => ({
30
+ ...e,
31
+ [t]: r
32
+ })), a((e) => ({
33
+ ...e,
34
+ [t]: !0
35
+ }));
36
+ }, (e) => {
37
+ s(r(e, "The orders could not be read.")), a((e) => ({
38
+ ...e,
39
+ [t]: !0
40
+ }));
41
+ }));
42
+ return () => t.forEach((e) => e());
43
+ }, [e]), {
44
+ entries: F(() => T.flatMap((e) => t[e] || []), [t]),
45
+ loading: T.some((e) => !i[e]),
46
+ error: o
47
+ };
48
+ }
49
+ function J(e) {
50
+ let { user: t } = o(), n = I(t);
51
+ P(() => {
52
+ n.current = t;
53
+ }, [t]);
54
+ let r = t?.uid || "", [i, a] = L([]), [s, c] = L([]), [l, u] = L({
55
+ charges: null,
56
+ subscriptions: null
57
+ }), [d, f] = L(!1), [p, m] = L(""), [h, g] = L(!1), [_, v] = L(!1), y = N(async (e, t) => {
58
+ let r = n.current, i = r ? await r.getIdToken() : "", a = await fetch(e, {
59
+ ...t,
60
+ headers: {
61
+ ...t?.body ? { "Content-Type": "application/json" } : {},
62
+ ...i ? { Authorization: `Bearer ${i}` } : {}
63
+ }
64
+ }), o = await a.json().catch(() => ({}));
65
+ if (!a.ok || o?.success === !1) throw Error(o?.error || "The server could not answer.");
66
+ return o;
67
+ }, []), b = N((e, t) => {
68
+ let n = e.charges || [], r = e.subscriptions || [];
69
+ a((e) => t ? [...e, ...n] : n), c((e) => t ? [...e, ...r] : r), g(!!(e.chargesHasMore || e.subscriptionsHasMore)), u((i) => {
70
+ let a = {
71
+ charges: e.chargesAfter || n[n.length - 1]?.id || (t ? i.charges : null),
72
+ subscriptions: e.subscriptionsAfter || r[r.length - 1]?.id || (t ? i.subscriptions : null)
73
+ };
74
+ return a.charges === i.charges && a.subscriptions === i.subscriptions ? i : a;
75
+ });
76
+ }, []);
77
+ P(() => {
78
+ if (!e || !r) return;
79
+ let t = !1;
80
+ return y("/api/payments/orders").then((e) => {
81
+ t || (b(e, !1), f(!0));
82
+ }).catch((e) => {
83
+ t || (m(e.message), f(!0));
84
+ }), () => {
85
+ t = !0;
86
+ };
87
+ }, [
88
+ e,
89
+ r,
90
+ y,
91
+ b
92
+ ]);
93
+ let x = async () => {
94
+ v(!0);
95
+ try {
96
+ let e = new URLSearchParams();
97
+ l.charges && e.set("starting_after", l.charges), l.subscriptions && e.set("subscriptions_after", l.subscriptions), b(await y(`/api/payments/orders?${e}`), !0);
98
+ } catch (e) {
99
+ m(e.message);
100
+ }
101
+ v(!1);
102
+ }, S = N((e, t) => {
103
+ e === "charge" ? a((e) => e.filter((e) => e.id !== t)) : c((e) => e.filter((e) => e.id !== t));
104
+ }, []);
105
+ return {
106
+ orders: [...i, ...s],
107
+ loaded: d,
108
+ error: p,
109
+ hasMore: h,
110
+ loadingMore: _,
111
+ loadMore: x,
112
+ authed: y,
113
+ drop: S
114
+ };
115
+ }
116
+ var ae = (e) => e ? new Date(e).toLocaleString(void 0, {
117
+ day: "numeric",
118
+ month: "short",
119
+ year: "numeric",
120
+ hour: "numeric",
121
+ minute: "2-digit"
122
+ }) : "", oe = (e) => e ? new Date(e).toLocaleDateString(void 0, {
123
+ day: "numeric",
124
+ month: "short",
125
+ year: "numeric"
126
+ }) : "";
127
+ function se(e) {
128
+ let t = e.order, n = [];
129
+ if (e.at) {
130
+ let r = t ? t.kind === "subscription" ? "Started" : t.paid ? "Paid on" : "Date" : "Sent on";
131
+ n.push({
132
+ label: r,
133
+ value: ae(e.at)
134
+ });
135
+ }
136
+ return t?.paidWith && n.push({ value: t.paidWith }), e.page && n.push({
137
+ label: "Sold on",
138
+ value: e.page
139
+ }), t && (t.amountRefunded || 0) > 0 && n.push({ value: `${C(t.amountRefunded, t.currency)} refunded` }), n;
140
+ }
141
+ var ce = (e) => /^(charge|subscription|entry):/.test(e) ? e : e.startsWith("sub_") ? `subscription:${e}` : `charge:${e}`, le = (e) => e.order ? e.order.kind === "subscription" ? {
142
+ title: "Delete this subscription?",
143
+ message: "It comes off this screen for good. The subscription itself stays in your Stripe account and keeps running — cancel it there if that is what you mean."
144
+ } : {
145
+ title: "Delete this payment?",
146
+ message: "It comes off this screen for good. The payment itself stays in your Stripe account, and nothing is refunded."
147
+ } : {
148
+ title: "Delete this order?",
149
+ message: "The order they started is deleted. Nothing was paid, so there is nothing in Stripe to keep."
150
+ }, Y = "grid grid-cols-[minmax(0,1fr)_auto_1rem] md:grid-cols-[minmax(0,1.5fr)_minmax(0,1.3fr)_6.5rem_7rem_8.5rem_1rem] items-center gap-x-3 md:gap-x-6 px-4 md:px-5";
151
+ function X({ status: e, className: t = "" }) {
152
+ return /* @__PURE__ */ B("span", {
153
+ className: `inline-flex items-center gap-2 text-[12.5px] font-medium text-foreground/60 leading-tight whitespace-nowrap ${t}`,
154
+ children: [/* @__PURE__ */ z("span", {
155
+ "aria-hidden": "true",
156
+ className: `w-1.5 h-1.5 rounded-full shrink-0 ${e.in ? "bg-emerald-500" : "bg-foreground/25"}`
157
+ }), e.label]
158
+ });
159
+ }
160
+ var Z = "text-[12.5px] font-semibold text-foreground/50 leading-tight mb-3", ue = "block text-[12px] font-medium text-foreground/45 leading-tight mb-0.5", Q = "text-[13.5px] text-foreground/85 leading-snug break-words [overflow-wrap:anywhere]";
161
+ function $({ row: e }) {
162
+ let t = e.name || e.email || "Someone", n = [];
163
+ return e.email && e.email !== t && n.push(["Email", e.email]), e.order?.phone && n.push(["Phone", e.order.phone]), e.order?.address && n.push(["Delivery address", e.order.address]), /* @__PURE__ */ B("section", {
164
+ className: "min-w-0",
165
+ children: [
166
+ /* @__PURE__ */ z("h3", {
167
+ className: Z,
168
+ children: "Who"
169
+ }),
170
+ /* @__PURE__ */ z("p", {
171
+ className: "text-[14px] font-semibold text-foreground leading-snug break-words [overflow-wrap:anywhere]",
172
+ children: t
173
+ }),
174
+ n.length > 0 && /* @__PURE__ */ z("div", {
175
+ className: "flex flex-col gap-2.5 mt-3",
176
+ children: n.map(([e, t]) => /* @__PURE__ */ B("p", {
177
+ className: "min-w-0",
178
+ children: [/* @__PURE__ */ z("span", {
179
+ className: ue,
180
+ children: e
181
+ }), /* @__PURE__ */ z("span", {
182
+ className: `block ${Q}`,
183
+ children: t
184
+ })]
185
+ }, e))
186
+ })
187
+ ]
188
+ });
189
+ }
190
+ function de({ lines: e, onOpen: n }) {
191
+ return /* @__PURE__ */ B("section", {
192
+ className: "min-w-0",
193
+ children: [/* @__PURE__ */ z("h3", {
194
+ className: Z,
195
+ children: "What they bought"
196
+ }), /* @__PURE__ */ z("div", {
197
+ className: "flex flex-col gap-2",
198
+ children: e.map((e, r) => {
199
+ let i = /* @__PURE__ */ z("span", {
200
+ className: e.kind === "total" ? "text-[13.5px] font-semibold text-foreground leading-snug" : e.kind === "extra" ? `${Q} text-foreground/60` : Q,
201
+ children: e.left
202
+ });
203
+ return /* @__PURE__ */ B("div", {
204
+ className: `flex justify-between gap-4 ${e.picture ? "items-center" : "items-baseline"} ${e.kind === "total" ? "border-t border-[var(--panel-border)]/70 pt-2.5 mt-1" : ""}`,
205
+ children: [e.picture ? /* @__PURE__ */ B("span", {
206
+ className: "flex items-center gap-3 min-w-0",
207
+ children: [/* @__PURE__ */ z("button", {
208
+ type: "button",
209
+ onClick: () => n({
210
+ src: e.picture,
211
+ name: e.left || "Picture"
212
+ }),
213
+ "aria-label": `Open the picture of ${e.left || "this"}`,
214
+ title: e.left,
215
+ className: "shrink-0 rounded-lg outline-none focus-visible:ring-2 focus-visible:ring-accent/50 hover:opacity-90 active:scale-[0.99] transition cursor-pointer",
216
+ children: /* @__PURE__ */ z(t, {
217
+ src: e.picture,
218
+ alt: "",
219
+ fit: "cover",
220
+ className: "w-10 h-10 rounded-lg border border-[var(--panel-border)]"
221
+ })
222
+ }), i]
223
+ }) : i, e.right && /* @__PURE__ */ z("span", {
224
+ className: `text-[13.5px] tabular-nums whitespace-nowrap shrink-0 leading-snug ${e.kind === "total" ? "font-semibold text-foreground" : "text-foreground/85"}`,
225
+ children: e.right
226
+ })]
227
+ }, r);
228
+ })
229
+ })]
230
+ });
231
+ }
232
+ function fe({ pairs: e, currency: t, onOpen: n }) {
233
+ return /* @__PURE__ */ B("section", {
234
+ className: "min-w-0",
235
+ children: [/* @__PURE__ */ z("h3", {
236
+ className: Z,
237
+ children: "What they told you"
238
+ }), /* @__PURE__ */ z("dl", {
239
+ className: "grid grid-cols-1 sm:grid-cols-[minmax(0,11rem)_minmax(0,1fr)] gap-x-8 gap-y-1 sm:gap-y-2",
240
+ children: e.map(([e, r]) => {
241
+ let a = S(e, r, t);
242
+ return /* @__PURE__ */ B(M, { children: [/* @__PURE__ */ z("dt", {
243
+ className: "text-[13px] text-foreground/50 leading-snug",
244
+ children: w(e)
245
+ }), i(r) ? /* @__PURE__ */ z("dd", {
246
+ className: "my-1 max-sm:mb-2.5",
247
+ children: /* @__PURE__ */ z(j, {
248
+ value: r,
249
+ onOpen: n,
250
+ className: "w-20 h-14"
251
+ })
252
+ }) : /* @__PURE__ */ z("dd", {
253
+ className: `${Q} max-sm:mb-2`,
254
+ children: (a.length ? a : ["—"]).map((e, t) => /* @__PURE__ */ z("span", {
255
+ className: "block",
256
+ children: e
257
+ }, t))
258
+ })] }, e);
259
+ })
260
+ })]
261
+ });
262
+ }
263
+ function pe({ row: e, open: t, onToggle: r, onDelete: i, onOpenFile: o }) {
264
+ let s = u(), c = E(e), f = e.name || e.email || "Someone", p = e.email && e.email !== f ? e.email : "", _ = e.order?.currency || null, v = e.order ? C(e.order.amount, e.order.currency) : "", b = e.order?.kind === "subscription" && e.order.interval ? `/ ${e.order.interval}` : "", { bought: S, told: w } = y(e.collected), T = new Set([
265
+ e.name,
266
+ e.email,
267
+ e.order?.phone,
268
+ e.order?.address
269
+ ].filter(Boolean)), D = w.filter(([, e]) => !(typeof e == "string" && T.has(e.trim()))), O = se(e), k = x(S, _);
270
+ return e.order && !k.some((e) => e.kind === "item") && k.unshift({
271
+ left: e.what,
272
+ right: b ? `${v} ${b}` : v,
273
+ kind: "item"
274
+ }), /* @__PURE__ */ B("div", {
275
+ "data-ledger-row": e.key,
276
+ className: `scroll-mt-6 ${t ? "bg-foreground/[0.02]" : ""}`,
277
+ children: [/* @__PURE__ */ B("button", {
278
+ type: "button",
279
+ onClick: r,
280
+ "aria-expanded": t,
281
+ className: `w-full ${Y} py-3 text-left cursor-pointer transition-colors hover:bg-foreground/[0.03]`,
282
+ children: [
283
+ /* @__PURE__ */ B("span", {
284
+ className: "flex flex-col min-w-0 gap-0.5",
285
+ children: [
286
+ /* @__PURE__ */ z("span", {
287
+ className: "text-[13.5px] font-bold text-foreground leading-tight truncate",
288
+ children: f
289
+ }),
290
+ /* @__PURE__ */ z("span", {
291
+ className: "md:hidden text-[12px] font-medium text-foreground/45 leading-tight truncate",
292
+ children: e.what
293
+ }),
294
+ p && /* @__PURE__ */ z("span", {
295
+ className: "max-md:hidden text-[12px] font-medium text-foreground/45 leading-tight truncate",
296
+ children: p
297
+ })
298
+ ]
299
+ }),
300
+ /* @__PURE__ */ B("span", {
301
+ className: "max-md:hidden md:flex flex-col min-w-0 gap-0.5",
302
+ children: [/* @__PURE__ */ z("span", {
303
+ className: "text-[13px] font-medium text-foreground/80 leading-tight truncate",
304
+ children: e.what
305
+ }), e.page && /* @__PURE__ */ z("span", {
306
+ className: "text-[11.5px] font-medium text-foreground/40 leading-tight truncate",
307
+ children: e.page
308
+ })]
309
+ }),
310
+ /* @__PURE__ */ z("span", {
311
+ className: "max-md:hidden text-[12.5px] font-medium text-foreground/45 tabular-nums whitespace-nowrap leading-tight",
312
+ children: oe(e.at)
313
+ }),
314
+ /* @__PURE__ */ z(X, {
315
+ status: c,
316
+ className: "max-md:hidden"
317
+ }),
318
+ /* @__PURE__ */ B("span", {
319
+ className: "flex flex-col items-end gap-1 min-w-0",
320
+ children: [/* @__PURE__ */ B("span", {
321
+ className: "text-[13.5px] font-semibold text-foreground tabular-nums whitespace-nowrap leading-tight",
322
+ children: [v || /* @__PURE__ */ z("span", {
323
+ className: "text-foreground/25 font-medium",
324
+ children: "—"
325
+ }), b && /* @__PURE__ */ B("span", {
326
+ className: "text-[12.5px] text-foreground/40 font-medium",
327
+ children: [" ", b]
328
+ })]
329
+ }), /* @__PURE__ */ z(X, {
330
+ status: c,
331
+ className: "md:hidden !text-[11.5px] !gap-1.5"
332
+ })]
333
+ }),
334
+ /* @__PURE__ */ z(g, { className: `w-4 h-4 text-foreground/35 shrink-0 justify-self-end transition-transform ${t ? "rotate-180" : ""}` })
335
+ ]
336
+ }), /* @__PURE__ */ z(a, {
337
+ initial: !1,
338
+ children: t && /* @__PURE__ */ z(d.div, {
339
+ initial: {
340
+ height: 0,
341
+ opacity: 0
342
+ },
343
+ animate: {
344
+ height: "auto",
345
+ opacity: 1
346
+ },
347
+ exit: {
348
+ height: 0,
349
+ opacity: 0
350
+ },
351
+ transition: s ? { duration: 0 } : n,
352
+ className: "overflow-hidden",
353
+ children: /* @__PURE__ */ B("div", {
354
+ className: "mx-4 md:mx-5 pt-4 pb-5 md:pt-5 md:pb-6 border-t border-[var(--panel-border)]/50 flex flex-col gap-6",
355
+ children: [
356
+ /* @__PURE__ */ B("div", {
357
+ className: "flex flex-col gap-1.5",
358
+ children: [/* @__PURE__ */ z("div", {
359
+ className: "flex items-center flex-wrap gap-x-4 gap-y-1",
360
+ children: v ? /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ B("span", {
361
+ className: "text-2xl font-semibold tracking-tight text-foreground tabular-nums leading-none",
362
+ children: [v, b && /* @__PURE__ */ B("span", {
363
+ className: "text-[15px] font-medium text-foreground/45 tracking-normal",
364
+ children: [" ", b]
365
+ })]
366
+ }), /* @__PURE__ */ z(X, {
367
+ status: c,
368
+ className: "!text-[13px]"
369
+ })] }) : /* @__PURE__ */ z("span", {
370
+ className: "text-lg font-semibold tracking-tight leading-none text-foreground/50",
371
+ children: c.label
372
+ })
373
+ }), O.length > 0 && /* @__PURE__ */ z("p", {
374
+ className: "flex flex-wrap items-baseline gap-x-2 text-[13px] text-foreground/60 leading-snug",
375
+ children: O.map((e, t) => /* @__PURE__ */ B("span", {
376
+ className: "inline-flex flex-wrap gap-x-1",
377
+ children: [
378
+ t > 0 && /* @__PURE__ */ z("span", {
379
+ "aria-hidden": "true",
380
+ className: "text-foreground/30 mr-1",
381
+ children: "·"
382
+ }),
383
+ e.label && /* @__PURE__ */ z("span", {
384
+ className: "text-foreground/45",
385
+ children: e.label
386
+ }),
387
+ /* @__PURE__ */ z("span", { children: e.value })
388
+ ]
389
+ }, t))
390
+ })]
391
+ }),
392
+ /* @__PURE__ */ B("div", {
393
+ className: "grid grid-cols-1 md:grid-cols-[minmax(0,2fr)_minmax(0,3fr)] gap-x-12 gap-y-6",
394
+ children: [/* @__PURE__ */ z($, { row: e }), k.length > 0 && /* @__PURE__ */ z(de, {
395
+ lines: k,
396
+ onOpen: o
397
+ })]
398
+ }),
399
+ D.length > 0 && /* @__PURE__ */ z(fe, {
400
+ pairs: D,
401
+ currency: _,
402
+ onOpen: o
403
+ }),
404
+ k.length === 0 && D.length === 0 && /* @__PURE__ */ z("p", {
405
+ className: "text-[13px] text-foreground/40",
406
+ children: "Nothing was asked before paying."
407
+ }),
408
+ /* @__PURE__ */ B("div", {
409
+ className: "flex items-center justify-between gap-3",
410
+ children: [e.order?.receiptUrl ? /* @__PURE__ */ B("a", {
411
+ href: e.order.receiptUrl,
412
+ target: "_blank",
413
+ rel: "noopener noreferrer",
414
+ className: "inline-flex items-center gap-1.5 text-[13px] font-medium text-foreground/55 hover:text-accent transition-colors",
415
+ children: ["Stripe receipt", /* @__PURE__ */ z(h, { className: "w-3.5 h-3.5" })]
416
+ }) : /* @__PURE__ */ z("span", {}), i && /* @__PURE__ */ z(l, {
417
+ icon: m,
418
+ tone: "danger",
419
+ compact: !0,
420
+ title: "Delete this transaction",
421
+ onClick: i,
422
+ children: "Delete"
423
+ })]
424
+ })
425
+ ]
426
+ })
427
+ })
428
+ })]
429
+ });
430
+ }
431
+ function me({ rows: t, waiting: n, configured: i, error: a, hasMore: o, loadingMore: c, onLoadMore: u, onDelete: p, initialOpen: m = null, help: h = !1, focus: g = null, onFocused: v }) {
432
+ let [y, b] = L(m), [x, S] = L(null), [C, w] = L(null), [T, E] = L(!1), [A, j] = L(""), M = g ? ce(g) : null;
433
+ te(M, !n && !!M && t.some((e) => e.key === M), b, v);
434
+ let N = async () => {
435
+ if (!(!C || !p)) {
436
+ E(!0), j("");
437
+ try {
438
+ await p(C), y === C.key && b(null), w(null);
439
+ } catch (e) {
440
+ j(r(e, e?.message || "It could not be deleted."));
441
+ }
442
+ E(!1);
443
+ }
444
+ }, P = C ? le(C) : null;
445
+ return /* @__PURE__ */ B("main", {
446
+ className: "flex-1 w-full max-w-7xl mx-auto p-4 pt-2 md:p-8 md:pt-4 z-10 flex flex-col min-h-screen",
447
+ children: [
448
+ /* @__PURE__ */ B(d.div, {
449
+ initial: {
450
+ opacity: 0,
451
+ y: 20
452
+ },
453
+ animate: {
454
+ opacity: 1,
455
+ y: 0
456
+ },
457
+ className: "mb-6",
458
+ children: [/* @__PURE__ */ z(e, { children: "Transactions" }), /* @__PURE__ */ B("div", {
459
+ className: "flex items-center gap-2 text-foreground/40 font-bold uppercase tracking-[0.2em] text-[11px]",
460
+ children: [/* @__PURE__ */ z("span", { className: "w-8 h-[1px] bg-foreground/10" }), "/transactions"]
461
+ })]
462
+ }),
463
+ /* @__PURE__ */ B("div", {
464
+ className: "flex flex-col gap-6 flex-1 pb-16",
465
+ children: [/* @__PURE__ */ z(f, {}), /* @__PURE__ */ z("div", {
466
+ className: "glass-panel border border-[var(--panel-border)] rounded-3xl p-4 sm:p-5 md:p-8 shadow-2xl relative bg-background flex flex-col fbos-tab-fill min-h-[400px] gap-4",
467
+ children: n ? /* @__PURE__ */ z(_, {
468
+ block: !0,
469
+ className: "flex-1"
470
+ }) : /* @__PURE__ */ B(R, { children: [
471
+ a && /* @__PURE__ */ z(s, {
472
+ tone: "error",
473
+ children: a
474
+ }),
475
+ !i && /* @__PURE__ */ B(s, { children: [
476
+ "Stripe is not connected yet, so there is no money to show — connect it on the",
477
+ " ",
478
+ /* @__PURE__ */ z(G, {
479
+ to: "/payments",
480
+ className: "font-bold text-accent hover:underline",
481
+ children: "Payments"
482
+ }),
483
+ " screen and every payment lands here on its own."
484
+ ] }),
485
+ t.length === 0 ? /* @__PURE__ */ z("div", {
486
+ className: "flex flex-col items-center justify-center flex-1 gap-3 py-16 text-center",
487
+ children: /* @__PURE__ */ z("p", {
488
+ className: "text-[13px] font-medium text-foreground/50 max-w-md leading-relaxed",
489
+ children: "Nothing yet. When somebody pays, or answers a payment’s form, it lands here on its own — with what they bought and everything they told the page beside it. A refund you make in Stripe shows here too."
490
+ })
491
+ }) : /* @__PURE__ */ B("div", {
492
+ className: "flex flex-col gap-3",
493
+ children: [/* @__PURE__ */ B("div", {
494
+ className: "rounded-2xl border border-[var(--panel-border)]/60 divide-y divide-[var(--panel-border)]/60 overflow-hidden",
495
+ children: [/* @__PURE__ */ B("div", {
496
+ className: `max-md:hidden ${Y} py-2.5 text-[11.5px] font-medium text-foreground/40`,
497
+ children: [
498
+ /* @__PURE__ */ z("span", { children: "Who" }),
499
+ /* @__PURE__ */ z("span", { children: "What" }),
500
+ /* @__PURE__ */ z("span", { children: "When" }),
501
+ /* @__PURE__ */ z("span", { children: "Status" }),
502
+ /* @__PURE__ */ z("span", {
503
+ className: "text-right",
504
+ children: "Amount"
505
+ }),
506
+ /* @__PURE__ */ z("span", {})
507
+ ]
508
+ }), t.map((e) => /* @__PURE__ */ z(pe, {
509
+ row: e,
510
+ open: y === e.key,
511
+ onToggle: () => b((t) => t === e.key ? null : e.key),
512
+ onDelete: p ? () => {
513
+ j(""), w(e);
514
+ } : void 0,
515
+ onOpenFile: S
516
+ }, e.key))]
517
+ }), o && /* @__PURE__ */ z(l, {
518
+ busy: c,
519
+ onClick: u,
520
+ className: "self-center mt-1",
521
+ children: "Show older payments"
522
+ })]
523
+ })
524
+ ] })
525
+ })]
526
+ }),
527
+ h && /* @__PURE__ */ z(ee, {}),
528
+ /* @__PURE__ */ z(D, {
529
+ open: !!x,
530
+ onClose: () => S(null),
531
+ src: x?.src || "",
532
+ name: x?.name
533
+ }),
534
+ /* @__PURE__ */ z(k, {
535
+ isOpen: !!C,
536
+ title: P?.title || "",
537
+ message: /* @__PURE__ */ B(R, { children: [P?.message, A && /* @__PURE__ */ z("span", {
538
+ className: "block mt-4 text-left",
539
+ children: /* @__PURE__ */ z(O, {
540
+ tone: "error",
541
+ children: A
542
+ })
543
+ })] }),
544
+ confirmText: "Delete",
545
+ isProcessing: T,
546
+ onConfirm: N,
547
+ onCancel: () => {
548
+ T || w(null);
549
+ }
550
+ })
551
+ ]
552
+ });
553
+ }
554
+ function he() {
555
+ let { userRole: e } = o(), t = p(e), { status: n, error: r } = A(), i = !!n?.configured, a = J(i), { entries: s, loading: l, error: u } = q(!t), d = F(() => b(a.orders, s), [a.orders, s]), f = !n && !r || l || i && !a.loaded, [m, h] = K();
556
+ return /* @__PURE__ */ z(me, {
557
+ rows: d,
558
+ waiting: f,
559
+ configured: i,
560
+ error: [a.error, u].filter(Boolean).join(" "),
561
+ hasMore: a.hasMore,
562
+ loadingMore: a.loadingMore,
563
+ onLoadMore: a.loadMore,
564
+ onDelete: t ? async (e) => {
565
+ e.order && await a.authed("/api/payments/orders/remove", {
566
+ method: "POST",
567
+ body: JSON.stringify({
568
+ kind: e.order.kind,
569
+ id: e.order.id
570
+ })
571
+ }), e.entry?.collection && await ne(re(c, e.entry.collection, e.entry.id)), e.order && a.drop(e.order.kind, e.order.id);
572
+ } : void 0,
573
+ help: t,
574
+ focus: m.get("open"),
575
+ onFocused: () => h((e) => {
576
+ let t = new URLSearchParams(e);
577
+ return t.delete("open"), t;
578
+ }, { replace: !0 })
579
+ });
580
+ }
581
+ //#endregion
582
+ export { he as TransactionsAdmin };
@@ -0,0 +1 @@
1
+ require(`./chunk-CiTBaPhY.cjs`);const e=require(`./PageTitle-CZhgmmDT.cjs`),t=require(`./TimeZoneField-qs7NPR30.cjs`),n=require(`./DashboardNav-CXa_ci-_.cjs`),r=require(`./verifiedAccount-DScyKk96.cjs`),i=require(`./lucide-react-BwV6L6Is.cjs`),a=require(`./Loader-Bu89fsbB.cjs`),o=require(`./transactions-CufFrdAM.cjs`),s=require(`./FileViewerPopup-D8-MmIoS.cjs`),c=require(`./FormNote-BtdTGpml.cjs`),l=require(`./ConfirmModal-Di9GR-vV.cjs`),u=require(`./SupportBar-CDT0HwdP.cjs`),d=require(`./openOnArrival-Buwqb86D.cjs`),f=require(`./serviceStatus-TQyZO_Y_.cjs`),p=require(`./Attachments-UVK9SRXf.cjs`);let m=require(`react`),h=require(`react/jsx-runtime`),g=require(`firebase/firestore`),_=require(`react-router-dom`);function v(e){let[n,r]=(0,m.useState)({}),[i,a]=(0,m.useState)({}),[s,c]=(0,m.useState)(``);return(0,m.useEffect)(()=>{let n=o.t.map(n=>(0,g.onSnapshot)(e?(0,g.query)((0,g.collection)(t.ka,n),(0,g.where)(`transaction`,`==`,!0)):(0,g.query)((0,g.collection)(t.ka,n),(0,g.orderBy)(`submittedAt`,`desc`)),e=>{let t=e.docs.map(e=>({...e.data(),id:e.id,collection:n})).filter(o.a);r(e=>({...e,[n]:t})),a(e=>({...e,[n]:!0}))},e=>{c(t.Ta(e,`The orders could not be read.`)),a(e=>({...e,[n]:!0}))}));return()=>n.forEach(e=>e())},[e]),{entries:(0,m.useMemo)(()=>o.t.flatMap(e=>n[e]||[]),[n]),loading:o.t.some(e=>!i[e]),error:s}}function y(e){let{user:n}=t.dr(),r=(0,m.useRef)(n);(0,m.useEffect)(()=>{r.current=n},[n]);let i=n?.uid||``,[a,o]=(0,m.useState)([]),[s,c]=(0,m.useState)([]),[l,u]=(0,m.useState)({charges:null,subscriptions:null}),[d,f]=(0,m.useState)(!1),[p,h]=(0,m.useState)(``),[g,_]=(0,m.useState)(!1),[v,y]=(0,m.useState)(!1),b=(0,m.useCallback)(async(e,t)=>{let n=r.current,i=n?await n.getIdToken():``,a=await fetch(e,{...t,headers:{...t?.body?{"Content-Type":`application/json`}:{},...i?{Authorization:`Bearer ${i}`}:{}}}),o=await a.json().catch(()=>({}));if(!a.ok||o?.success===!1)throw Error(o?.error||`The server could not answer.`);return o},[]),x=(0,m.useCallback)((e,t)=>{let n=e.charges||[],r=e.subscriptions||[];o(e=>t?[...e,...n]:n),c(e=>t?[...e,...r]:r),_(!!(e.chargesHasMore||e.subscriptionsHasMore)),u(i=>{let a={charges:e.chargesAfter||n[n.length-1]?.id||(t?i.charges:null),subscriptions:e.subscriptionsAfter||r[r.length-1]?.id||(t?i.subscriptions:null)};return a.charges===i.charges&&a.subscriptions===i.subscriptions?i:a})},[]);(0,m.useEffect)(()=>{if(!e||!i)return;let t=!1;return b(`/api/payments/orders`).then(e=>{t||(x(e,!1),f(!0))}).catch(e=>{t||(h(e.message),f(!0))}),()=>{t=!0}},[e,i,b,x]);let S=async()=>{y(!0);try{let e=new URLSearchParams;l.charges&&e.set(`starting_after`,l.charges),l.subscriptions&&e.set(`subscriptions_after`,l.subscriptions),x(await b(`/api/payments/orders?${e}`),!0)}catch(e){h(e.message)}y(!1)},C=(0,m.useCallback)((e,t)=>{e===`charge`?o(e=>e.filter(e=>e.id!==t)):c(e=>e.filter(e=>e.id!==t))},[]);return{orders:[...a,...s],loaded:d,error:p,hasMore:g,loadingMore:v,loadMore:S,authed:b,drop:C}}var b=e=>e?new Date(e).toLocaleString(void 0,{day:`numeric`,month:`short`,year:`numeric`,hour:`numeric`,minute:`2-digit`}):``,x=e=>e?new Date(e).toLocaleDateString(void 0,{day:`numeric`,month:`short`,year:`numeric`}):``;function S(e){let t=e.order,n=[];if(e.at){let r=t?t.kind===`subscription`?`Started`:t.paid?`Paid on`:`Date`:`Sent on`;n.push({label:r,value:b(e.at)})}return t?.paidWith&&n.push({value:t.paidWith}),e.page&&n.push({label:`Sold on`,value:e.page}),t&&(t.amountRefunded||0)>0&&n.push({value:`${o.r(t.amountRefunded,t.currency)} refunded`}),n}var C=e=>/^(charge|subscription|entry):/.test(e)?e:e.startsWith(`sub_`)?`subscription:${e}`:`charge:${e}`,w=e=>e.order?e.order.kind===`subscription`?{title:`Delete this subscription?`,message:`It comes off this screen for good. The subscription itself stays in your Stripe account and keeps running — cancel it there if that is what you mean.`}:{title:`Delete this payment?`,message:`It comes off this screen for good. The payment itself stays in your Stripe account, and nothing is refunded.`}:{title:`Delete this order?`,message:`The order they started is deleted. Nothing was paid, so there is nothing in Stripe to keep.`},T=`grid grid-cols-[minmax(0,1fr)_auto_1rem] md:grid-cols-[minmax(0,1.5fr)_minmax(0,1.3fr)_6.5rem_7rem_8.5rem_1rem] items-center gap-x-3 md:gap-x-6 px-4 md:px-5`;function E({status:e,className:t=``}){return(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-[12.5px] font-medium text-foreground/60 leading-tight whitespace-nowrap ${t}`,children:[(0,h.jsx)(`span`,{"aria-hidden":`true`,className:`w-1.5 h-1.5 rounded-full shrink-0 ${e.in?`bg-emerald-500`:`bg-foreground/25`}`}),e.label]})}var D=`text-[12.5px] font-semibold text-foreground/50 leading-tight mb-3`,O=`block text-[12px] font-medium text-foreground/45 leading-tight mb-0.5`,k=`text-[13.5px] text-foreground/85 leading-snug break-words [overflow-wrap:anywhere]`;function A({row:e}){let t=e.name||e.email||`Someone`,n=[];return e.email&&e.email!==t&&n.push([`Email`,e.email]),e.order?.phone&&n.push([`Phone`,e.order.phone]),e.order?.address&&n.push([`Delivery address`,e.order.address]),(0,h.jsxs)(`section`,{className:`min-w-0`,children:[(0,h.jsx)(`h3`,{className:D,children:`Who`}),(0,h.jsx)(`p`,{className:`text-[14px] font-semibold text-foreground leading-snug break-words [overflow-wrap:anywhere]`,children:t}),n.length>0&&(0,h.jsx)(`div`,{className:`flex flex-col gap-2.5 mt-3`,children:n.map(([e,t])=>(0,h.jsxs)(`p`,{className:`min-w-0`,children:[(0,h.jsx)(`span`,{className:O,children:e}),(0,h.jsx)(`span`,{className:`block ${k}`,children:t})]},e))})]})}function j({lines:e,onOpen:n}){return(0,h.jsxs)(`section`,{className:`min-w-0`,children:[(0,h.jsx)(`h3`,{className:D,children:`What they bought`}),(0,h.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.map((e,r)=>{let i=(0,h.jsx)(`span`,{className:e.kind===`total`?`text-[13.5px] font-semibold text-foreground leading-snug`:e.kind===`extra`?`${k} text-foreground/60`:k,children:e.left});return(0,h.jsxs)(`div`,{className:`flex justify-between gap-4 ${e.picture?`items-center`:`items-baseline`} ${e.kind===`total`?`border-t border-[var(--panel-border)]/70 pt-2.5 mt-1`:``}`,children:[e.picture?(0,h.jsxs)(`span`,{className:`flex items-center gap-3 min-w-0`,children:[(0,h.jsx)(`button`,{type:`button`,onClick:()=>n({src:e.picture,name:e.left||`Picture`}),"aria-label":`Open the picture of ${e.left||`this`}`,title:e.left,className:`shrink-0 rounded-lg outline-none focus-visible:ring-2 focus-visible:ring-accent/50 hover:opacity-90 active:scale-[0.99] transition cursor-pointer`,children:(0,h.jsx)(t.Nn,{src:e.picture,alt:``,fit:`cover`,className:`w-10 h-10 rounded-lg border border-[var(--panel-border)]`})}),i]}):i,e.right&&(0,h.jsx)(`span`,{className:`text-[13.5px] tabular-nums whitespace-nowrap shrink-0 leading-snug ${e.kind===`total`?`font-semibold text-foreground`:`text-foreground/85`}`,children:e.right})]},r)})})]})}function M({pairs:e,currency:n,onOpen:r}){return(0,h.jsxs)(`section`,{className:`min-w-0`,children:[(0,h.jsx)(`h3`,{className:D,children:`What they told you`}),(0,h.jsx)(`dl`,{className:`grid grid-cols-1 sm:grid-cols-[minmax(0,11rem)_minmax(0,1fr)] gap-x-8 gap-y-1 sm:gap-y-2`,children:e.map(([e,i])=>{let a=o.n(e,i,n);return(0,h.jsxs)(m.Fragment,{children:[(0,h.jsx)(`dt`,{className:`text-[13px] text-foreground/50 leading-snug`,children:o.s(e)}),t.Vn(i)?(0,h.jsx)(`dd`,{className:`my-1 max-sm:mb-2.5`,children:(0,h.jsx)(p.t,{value:i,onOpen:r,className:`w-20 h-14`})}):(0,h.jsx)(`dd`,{className:`${k} max-sm:mb-2`,children:(a.length?a:[`—`]).map((e,t)=>(0,h.jsx)(`span`,{className:`block`,children:e},t))})]},e)})})]})}function N({row:e,open:n,onToggle:r,onDelete:a,onOpenFile:s}){let c=t.or(),l=o.u(e),u=e.name||e.email||`Someone`,d=e.email&&e.email!==u?e.email:``,f=e.order?.currency||null,p=e.order?o.r(e.order.amount,e.order.currency):``,m=e.order?.kind===`subscription`&&e.order.interval?`/ ${e.order.interval}`:``,{bought:g,told:_}=o.d(e.collected),v=new Set([e.name,e.email,e.order?.phone,e.order?.address].filter(Boolean)),y=_.filter(([,e])=>!(typeof e==`string`&&v.has(e.trim()))),b=S(e),C=o.l(g,f);return e.order&&!C.some(e=>e.kind===`item`)&&C.unshift({left:e.what,right:m?`${p} ${m}`:p,kind:`item`}),(0,h.jsxs)(`div`,{"data-ledger-row":e.key,className:`scroll-mt-6 ${n?`bg-foreground/[0.02]`:``}`,children:[(0,h.jsxs)(`button`,{type:`button`,onClick:r,"aria-expanded":n,className:`w-full ${T} py-3 text-left cursor-pointer transition-colors hover:bg-foreground/[0.03]`,children:[(0,h.jsxs)(`span`,{className:`flex flex-col min-w-0 gap-0.5`,children:[(0,h.jsx)(`span`,{className:`text-[13.5px] font-bold text-foreground leading-tight truncate`,children:u}),(0,h.jsx)(`span`,{className:`md:hidden text-[12px] font-medium text-foreground/45 leading-tight truncate`,children:e.what}),d&&(0,h.jsx)(`span`,{className:`max-md:hidden text-[12px] font-medium text-foreground/45 leading-tight truncate`,children:d})]}),(0,h.jsxs)(`span`,{className:`max-md:hidden md:flex flex-col min-w-0 gap-0.5`,children:[(0,h.jsx)(`span`,{className:`text-[13px] font-medium text-foreground/80 leading-tight truncate`,children:e.what}),e.page&&(0,h.jsx)(`span`,{className:`text-[11.5px] font-medium text-foreground/40 leading-tight truncate`,children:e.page})]}),(0,h.jsx)(`span`,{className:`max-md:hidden text-[12.5px] font-medium text-foreground/45 tabular-nums whitespace-nowrap leading-tight`,children:x(e.at)}),(0,h.jsx)(E,{status:l,className:`max-md:hidden`}),(0,h.jsxs)(`span`,{className:`flex flex-col items-end gap-1 min-w-0`,children:[(0,h.jsxs)(`span`,{className:`text-[13.5px] font-semibold text-foreground tabular-nums whitespace-nowrap leading-tight`,children:[p||(0,h.jsx)(`span`,{className:`text-foreground/25 font-medium`,children:`—`}),m&&(0,h.jsxs)(`span`,{className:`text-[12.5px] text-foreground/40 font-medium`,children:[` `,m]})]}),(0,h.jsx)(E,{status:l,className:`md:hidden !text-[11.5px] !gap-1.5`})]}),(0,h.jsx)(i.on,{className:`w-4 h-4 text-foreground/35 shrink-0 justify-self-end transition-transform ${n?`rotate-180`:``}`})]}),(0,h.jsx)(t.cr,{initial:!1,children:n&&(0,h.jsx)(t.sr.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},transition:c?{duration:0}:t.T,className:`overflow-hidden`,children:(0,h.jsxs)(`div`,{className:`mx-4 md:mx-5 pt-4 pb-5 md:pt-5 md:pb-6 border-t border-[var(--panel-border)]/50 flex flex-col gap-6`,children:[(0,h.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,h.jsx)(`div`,{className:`flex items-center flex-wrap gap-x-4 gap-y-1`,children:p?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`span`,{className:`text-2xl font-semibold tracking-tight text-foreground tabular-nums leading-none`,children:[p,m&&(0,h.jsxs)(`span`,{className:`text-[15px] font-medium text-foreground/45 tracking-normal`,children:[` `,m]})]}),(0,h.jsx)(E,{status:l,className:`!text-[13px]`})]}):(0,h.jsx)(`span`,{className:`text-lg font-semibold tracking-tight leading-none text-foreground/50`,children:l.label})}),b.length>0&&(0,h.jsx)(`p`,{className:`flex flex-wrap items-baseline gap-x-2 text-[13px] text-foreground/60 leading-snug`,children:b.map((e,t)=>(0,h.jsxs)(`span`,{className:`inline-flex flex-wrap gap-x-1`,children:[t>0&&(0,h.jsx)(`span`,{"aria-hidden":`true`,className:`text-foreground/30 mr-1`,children:`·`}),e.label&&(0,h.jsx)(`span`,{className:`text-foreground/45`,children:e.label}),(0,h.jsx)(`span`,{children:e.value})]},t))})]}),(0,h.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-[minmax(0,2fr)_minmax(0,3fr)] gap-x-12 gap-y-6`,children:[(0,h.jsx)(A,{row:e}),C.length>0&&(0,h.jsx)(j,{lines:C,onOpen:s})]}),y.length>0&&(0,h.jsx)(M,{pairs:y,currency:f,onOpen:s}),C.length===0&&y.length===0&&(0,h.jsx)(`p`,{className:`text-[13px] text-foreground/40`,children:`Nothing was asked before paying.`}),(0,h.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[e.order?.receiptUrl?(0,h.jsxs)(`a`,{href:e.order.receiptUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1.5 text-[13px] font-medium text-foreground/55 hover:text-accent transition-colors`,children:[`Stripe receipt`,(0,h.jsx)(i.Ht,{className:`w-3.5 h-3.5`})]}):(0,h.jsx)(`span`,{}),a&&(0,h.jsx)(t.o,{icon:i.C,tone:`danger`,compact:!0,title:`Delete this transaction`,onClick:a,children:`Delete`})]})]})})})]})}function P({rows:r,waiting:i,configured:o,error:f,hasMore:p,loadingMore:g,onLoadMore:v,onDelete:y,initialOpen:b=null,help:x=!1,focus:S=null,onFocused:E}){let[D,O]=(0,m.useState)(b),[k,A]=(0,m.useState)(null),[j,M]=(0,m.useState)(null),[P,F]=(0,m.useState)(!1),[I,L]=(0,m.useState)(``),R=S?C(S):null;d.t(R,!i&&!!R&&r.some(e=>e.key===R),O,E);let z=async()=>{if(!(!j||!y)){F(!0),L(``);try{await y(j),D===j.key&&O(null),M(null)}catch(e){L(t.Ta(e,e?.message||`It could not be deleted.`))}F(!1)}},B=j?w(j):null;return(0,h.jsxs)(`main`,{className:`flex-1 w-full max-w-7xl mx-auto p-4 pt-2 md:p-8 md:pt-4 z-10 flex flex-col min-h-screen`,children:[(0,h.jsxs)(t.sr.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:`mb-6`,children:[(0,h.jsx)(e.t,{children:`Transactions`}),(0,h.jsxs)(`div`,{className:`flex items-center gap-2 text-foreground/40 font-bold uppercase tracking-[0.2em] text-[11px]`,children:[(0,h.jsx)(`span`,{className:`w-8 h-[1px] bg-foreground/10`}),`/transactions`]})]}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-6 flex-1 pb-16`,children:[(0,h.jsx)(n.t,{}),(0,h.jsx)(`div`,{className:`glass-panel border border-[var(--panel-border)] rounded-3xl p-4 sm:p-5 md:p-8 shadow-2xl relative bg-background flex flex-col fbos-tab-fill min-h-[400px] gap-4`,children:i?(0,h.jsx)(a.t,{block:!0,className:`flex-1`}):(0,h.jsxs)(h.Fragment,{children:[f&&(0,h.jsx)(t.g,{tone:`error`,children:f}),!o&&(0,h.jsxs)(t.g,{children:[`Stripe is not connected yet, so there is no money to show — connect it on the`,` `,(0,h.jsx)(_.Link,{to:`/payments`,className:`font-bold text-accent hover:underline`,children:`Payments`}),` screen and every payment lands here on its own.`]}),r.length===0?(0,h.jsx)(`div`,{className:`flex flex-col items-center justify-center flex-1 gap-3 py-16 text-center`,children:(0,h.jsx)(`p`,{className:`text-[13px] font-medium text-foreground/50 max-w-md leading-relaxed`,children:`Nothing yet. When somebody pays, or answers a payment’s form, it lands here on its own — with what they bought and everything they told the page beside it. A refund you make in Stripe shows here too.`})}):(0,h.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,h.jsxs)(`div`,{className:`rounded-2xl border border-[var(--panel-border)]/60 divide-y divide-[var(--panel-border)]/60 overflow-hidden`,children:[(0,h.jsxs)(`div`,{className:`max-md:hidden ${T} py-2.5 text-[11.5px] font-medium text-foreground/40`,children:[(0,h.jsx)(`span`,{children:`Who`}),(0,h.jsx)(`span`,{children:`What`}),(0,h.jsx)(`span`,{children:`When`}),(0,h.jsx)(`span`,{children:`Status`}),(0,h.jsx)(`span`,{className:`text-right`,children:`Amount`}),(0,h.jsx)(`span`,{})]}),r.map(e=>(0,h.jsx)(N,{row:e,open:D===e.key,onToggle:()=>O(t=>t===e.key?null:e.key),onDelete:y?()=>{L(``),M(e)}:void 0,onOpenFile:A},e.key))]}),p&&(0,h.jsx)(t.o,{busy:g,onClick:v,className:`self-center mt-1`,children:`Show older payments`})]})]})})]}),x&&(0,h.jsx)(u.t,{}),(0,h.jsx)(s.t,{open:!!k,onClose:()=>A(null),src:k?.src||``,name:k?.name}),(0,h.jsx)(l.t,{isOpen:!!j,title:B?.title||``,message:(0,h.jsxs)(h.Fragment,{children:[B?.message,I&&(0,h.jsx)(`span`,{className:`block mt-4 text-left`,children:(0,h.jsx)(c.t,{tone:`error`,children:I})})]}),confirmText:`Delete`,isProcessing:P,onConfirm:z,onCancel:()=>{P||M(null)}})]})}function F(){let{userRole:e}=t.dr(),n=r.h(e),{status:i,error:a}=f.r(),s=!!i?.configured,c=y(s),{entries:l,loading:u,error:d}=v(!n),p=(0,m.useMemo)(()=>o.f(c.orders,l),[c.orders,l]),b=!i&&!a||u||s&&!c.loaded,[x,S]=(0,_.useSearchParams)();return(0,h.jsx)(P,{rows:p,waiting:b,configured:s,error:[c.error,d].filter(Boolean).join(` `),hasMore:c.hasMore,loadingMore:c.loadingMore,onLoadMore:c.loadMore,onDelete:n?async e=>{e.order&&await c.authed(`/api/payments/orders/remove`,{method:`POST`,body:JSON.stringify({kind:e.order.kind,id:e.order.id})}),e.entry?.collection&&await(0,g.deleteDoc)((0,g.doc)(t.ka,e.entry.collection,e.entry.id)),e.order&&c.drop(e.order.kind,e.order.id)}:void 0,help:n,focus:x.get(`open`),onFocused:()=>S(e=>{let t=new URLSearchParams(e);return t.delete(`open`),t},{replace:!0})})}exports.TransactionsAdmin=F;
@@ -0,0 +1 @@
1
+ const e=require(`./chunk-CiTBaPhY.cjs`),t=require(`./TimeZoneField-qs7NPR30.cjs`),n=require(`./lucide-react-BwV6L6Is.cjs`);let r=require(`react`);r=e.a(r,1);let i=require(`react/jsx-runtime`);var a=`fbos:trouble`;function o(e){typeof window>`u`||window.dispatchEvent(new CustomEvent(a,{detail:e}))}var s=12e3,c=e=>String(e?.message??e??``).toLowerCase().includes(`websocket`),l=e=>{let t=String(e?.name||``),n=String(e?.code||``).toLowerCase(),r=String(e?.message??e??``).toLowerCase();return!(!r&&!n&&!t||c(e)||t===`AbortError`||n===`storage/canceled`||n===`cancelled`||r.includes(`resizeobserver`)||r===`script error.`||r===`script error`||r.includes(`the above error occurred`))};function u(){let[e,n]=(0,r.useState)(null),[i,o]=(0,r.useState)(()=>typeof navigator<`u`&&navigator.onLine===!1),u=(0,r.useRef)({words:``,at:0}),d=(0,r.useRef)(0),f=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(typeof window>`u`)return;let e=(e,r)=>{if(!l(e)){c(e)&&r?.preventDefault?.();return}console.warn(`Your AI Firebase: something did not finish —`,e),r?.preventDefault?.();let i=`${e?.code||``}|${e?.message??e??``}`,a=Date.now();u.current.words===i&&a-u.current.at<15e3||(u.current={words:i,at:a},d.current+=1,n({error:e,id:d.current}),f.current&&clearTimeout(f.current),t.Ea(e)||(f.current=setTimeout(()=>n(null),s)))},r=t=>e(t.reason,t),i=t=>e(t.detail),p=t=>{typeof t.target?.tagName!=`string`&&e(t.error??t.message,t)},m=()=>o(!0),h=()=>{o(!1),n(null),u.current={words:``,at:0}};return window.addEventListener(`unhandledrejection`,r),window.addEventListener(a,i),window.addEventListener(`error`,p,!0),window.addEventListener(`offline`,m),window.addEventListener(`online`,h),()=>{window.removeEventListener(`unhandledrejection`,r),window.removeEventListener(a,i),window.removeEventListener(`error`,p,!0),window.removeEventListener(`offline`,m),window.removeEventListener(`online`,h),f.current&&clearTimeout(f.current)}},[]),{problem:e,offline:i,dismiss:()=>n(null)}}var d=()=>{typeof window<`u`&&window.location.reload()},f=()=>{let e=typeof window<`u`?window.location.pathname:`/`;return e&&e!==`/login`&&e!==`/`?`/login?from=${encodeURIComponent(e)}`:`/login`},p={again:n.B,reload:n.B,signin:n.pt,none:n.B},m=`w-full flex items-center justify-center gap-2 py-2.5 bg-foreground/5 hover:bg-foreground/10 text-foreground text-[14px] font-bold rounded-xl transition-colors`,h=`w-full text-center py-2 mt-2 text-[13px] font-bold text-foreground/50 hover:text-foreground/80 transition-colors`;function g({found:e,onRetry:n,way:r,onTried:a}){let o=e.next===`again`&&!n?`reload`:e.next,s=p[o],c=t.ba[o];return o===`signin`?(0,i.jsxs)(`a`,{href:r.signInHref??f(),className:m,children:[(0,i.jsx)(s,{className:`w-4 h-4 shrink-0`}),c]}):(0,i.jsxs)(`button`,{type:`button`,onClick:()=>{a(),o===`again`&&n?n():(r.reload??d)()},className:m,children:[(0,i.jsx)(s,{className:`w-4 h-4 shrink-0`}),c]})}function _({error:e,override:n,onRetry:a,size:o=`page`,...s}){let[c,l]=(0,r.useState)(0),u={...t.wa(e),...n||{}},f=u.next===`again`&&!!a;return(0,i.jsx)(`div`,{className:o===`page`?`flex-1 flex flex-col items-center justify-center relative z-10 min-h-[60vh] px-4 fbos-fade-in`:`w-full flex flex-col items-center justify-center py-10 px-4 fbos-fade-in`,role:`alert`,children:(0,i.jsxs)(`div`,{className:`glass-panel p-8 md:p-10 rounded-3xl border border-[var(--panel-border)] text-center shadow-xl max-w-sm w-full relative overflow-hidden`,children:[(0,i.jsx)(`div`,{className:`absolute inset-0 bg-amber-500/5`}),(0,i.jsx)(`h2`,{className:`text-2xl font-bold text-foreground mb-3 relative z-10 tracking-tight`,children:u.title}),(0,i.jsx)(`p`,{className:`text-[14px] text-foreground/70 font-medium leading-relaxed relative z-10 mb-6`,children:u.message}),(0,i.jsxs)(`div`,{className:`relative z-10`,children:[(0,i.jsx)(g,{found:u,onRetry:a,way:s,onTried:()=>l(e=>e+1)}),f&&c>0&&(0,i.jsx)(`button`,{type:`button`,onClick:()=>(s.reload??d)(),className:h,children:`Still not working? Reload the page`})]})]})})}var v=0,y=new Set,b=()=>y.forEach(e=>e()),x=e=>(y.add(e),()=>{y.delete(e)});function S(){return(0,r.useSyncExternalStore)(x,()=>v>0,()=>!1)}function C({error:e,offline:a,onRetry:o,onDismiss:s,...c}){let l=t.wa(e),u=a?`You are offline. The app will catch up by itself the moment you are back.`:l.short;return(0,r.useEffect)(()=>(v+=1,b(),()=>{--v,b()}),[]),(0,i.jsx)(`div`,{className:`fixed bottom-4 left-1/2 -translate-x-1/2 z-[60] w-[calc(100%-2rem)] max-w-md px-0`,role:`status`,children:(0,i.jsxs)(`div`,{className:`glass-panel rounded-2xl border border-[var(--panel-border)] shadow-xl px-4 py-3 flex items-center gap-3`,children:[a?(0,i.jsx)(n.l,{className:`w-4 h-4 shrink-0 text-amber-500`}):(0,i.jsx)(n.B,{className:`w-4 h-4 shrink-0 text-amber-500`}),(0,i.jsx)(`p`,{className:`text-[13px] font-semibold text-foreground/80 leading-snug flex-1`,children:u}),!a&&(0,i.jsx)(`button`,{type:`button`,onClick:()=>o?o():(c.reload??d)(),className:`shrink-0 text-[13px] font-bold text-foreground hover:text-accent transition-colors whitespace-nowrap`,children:o?`Try again`:`Reload`}),s&&(0,i.jsx)(`button`,{type:`button`,onClick:s,"aria-label":`Hide this`,className:`shrink-0 text-[13px] font-bold text-foreground/40 hover:text-foreground/70 transition-colors`,children:`✕`})]})})}function w(){let{problem:e,offline:t,dismiss:n}=u();return t?(0,i.jsx)(C,{offline:!0}):e?(0,i.jsx)(C,{error:e.error,onDismiss:n},e.id):null}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return _}});