@gatewaze/admin-embed 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -0
- package/dist/AiSkillsPicker-dbFhcanE.js +373 -0
- package/dist/ContentAccessPage-D0HRqPFc.js +264 -0
- package/dist/DataTable-fe6yRVpF.js +1984 -0
- package/dist/DetailPageHeader-D_v7924k.js +69 -0
- package/dist/EditionEmail-CyhC8232.js +8382 -0
- package/dist/GuideContent-DBXKCu7r.js +7580 -0
- package/dist/HostMediaTab-BsIBEQ1v.js +440 -0
- package/dist/InboxPage-C8ivCKdx.js +1112 -0
- package/dist/NewsletterCanvasEditor--B06apn3.js +11453 -0
- package/dist/NewsletterSetupWizard-BqV6-fa5.js +347 -0
- package/dist/NewsletterSignup-DRVZIpOs.js +224 -0
- package/dist/Page-D3u8IZ2a.js +14 -0
- package/dist/Toaster-Cde0i6IA.js +18 -0
- package/dist/Tooltip-CqxUlW1d.js +746 -0
- package/dist/_collectionSlug_-B3UN6M-Q.js +308 -0
- package/dist/_collection_-Qz4k_Qjl.js +139 -0
- package/dist/_edition_-DQXwkI_-.js +301 -0
- package/dist/_id_-CtT7rT9f.js +257 -0
- package/dist/_id_-CzScE4Qn.js +1197 -0
- package/dist/_virtual_gatewaze-modules-BeloWlOa.js +991 -0
- package/dist/admin-B0Mmrh_O.js +1239 -0
- package/dist/admin-CcfoK6vD.js +17 -0
- package/dist/admin-embed.js +21844 -0
- package/dist/admin.css +2 -0
- package/dist/block-editor-vXBShAue.js +226 -0
- package/dist/brand-DklYwIeA.js +11 -0
- package/dist/brick-editor-CmBitMMK.js +225 -0
- package/dist/broadcastService-CBqXNt_N.js +190 -0
- package/dist/classnames-uWIYaD6z.js +44 -0
- package/dist/contentAccessService-Cs7tdAo-.js +59 -0
- package/dist/context-jzuubYRz.js +5 -0
- package/dist/createSafeContext-P1pK0sAN.js +17 -0
- package/dist/detail-B8SVFJJr.js +26285 -0
- package/dist/detail-uFBxRbLF.js +2966 -0
- package/dist/dist-DTrOExw8.js +38806 -0
- package/dist/edition-slug-CARO24Bs.js +7 -0
- package/dist/export-edition-html-C_hdXQu5.js +18893 -0
- package/dist/floating-ui.dom-Cyv879E9.js +987 -0
- package/dist/hooks-C377EXJG.js +2974 -0
- package/dist/img/mlops-logo.png +0 -0
- package/dist/img/mlops-logo2.png +0 -0
- package/dist/index.d.ts +105 -0
- package/dist/jsx-runtime-CjozyJt-.js +180 -0
- package/dist/lib-CylJmhlJ.js +828 -0
- package/dist/list-C0cz0aQz.js +451 -0
- package/dist/list-CIVgIGsU.js +166 -0
- package/dist/logo/mlops-alt.png +0 -0
- package/dist/logo/mlops-logo.png +0 -0
- package/dist/new-r4KWpqa6.js +80 -0
- package/dist/outline-DwDYhYcF.js +6538 -0
- package/dist/pages-Ersfxcz7.js +216 -0
- package/dist/preview/12627f.jpg +0 -0
- package/dist/preview/af009d.jpg +0 -0
- package/dist/public-api-LD11kMxh.js +238 -0
- package/dist/react-DB2tPNit.js +933 -0
- package/dist/react-dom-giQNVXng.js +267 -0
- package/dist/registry-4XrV9iNG.js +7 -0
- package/dist/render-BtUWfMUt.js +59634 -0
- package/dist/resolvePeopleByEmail-hivX2l07.js +828 -0
- package/dist/runtime-config.js +10 -0
- package/dist/sends-BkPO6PG2.js +182 -0
- package/dist/server.browser-Pj3QUa7k.js +15227 -0
- package/dist/shim-BCerG8nb.js +6681 -0
- package/dist/sonnerHostBridge-CXuCMM3R.js +665 -0
- package/dist/src-BWDAOzZO.js +799 -0
- package/dist/starter-templates-CFs-QUdF.js +3077 -0
- package/dist/storage-VDSvnkvR.js +39 -0
- package/dist/templateParser-BQ2IsJ6c.js +49 -0
- package/dist/templates-rjQjWsRr.js +253 -0
- package/dist/theme/gatewaze/android-icon-144x144.png +0 -0
- package/dist/theme/gatewaze/android-icon-192x192.png +0 -0
- package/dist/theme/gatewaze/android-icon-36x36.png +0 -0
- package/dist/theme/gatewaze/android-icon-48x48.png +0 -0
- package/dist/theme/gatewaze/android-icon-72x72.png +0 -0
- package/dist/theme/gatewaze/android-icon-96x96.png +0 -0
- package/dist/theme/gatewaze/favicon-144x144.png +0 -0
- package/dist/theme/gatewaze/favicon-16x16.png +0 -0
- package/dist/theme/gatewaze/favicon-192x192.png +0 -0
- package/dist/theme/gatewaze/favicon-32x32.png +0 -0
- package/dist/theme/gatewaze/favicon-96x96.png +0 -0
- package/dist/theme/gatewaze/favicon.ico +0 -0
- package/dist/theme/gatewaze/gatewaze-icon-512.png +0 -0
- package/dist/theme/gatewaze/gatewaze-logo-black.svg +24 -0
- package/dist/theme/gatewaze/gatewaze-logo-white.svg +20 -0
- package/dist/theme/gatewaze/gatewaze-poweredby-black.svg +25 -0
- package/dist/theme/gatewaze/gatewaze-poweredby-white.svg +25 -0
- package/dist/theme/gatewaze/logo_black.svg +24 -0
- package/dist/theme/gatewaze/logo_white.svg +20 -0
- package/dist/theme-D6odw5nx.js +586 -0
- package/dist/ui-DRIo9Krs.js +9747 -0
- package/dist/upload-DMNfZ6FX.js +505 -0
- package/dist/useModuleFeature-DgsFIUpv.js +8 -0
- package/dist/utils-BcVvIjaY.js +36 -0
- package/dist/with-selector-B8eSdVx_.js +100 -0
- package/package.json +33 -0
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import { c as e, t } from "./react-DB2tPNit.js";
|
|
2
|
+
import { t as n } from "./jsx-runtime-CjozyJt-.js";
|
|
3
|
+
import { t as r } from "./storage-VDSvnkvR.js";
|
|
4
|
+
import "./src-BWDAOzZO.js";
|
|
5
|
+
import { n as i, t as a } from "./render-BtUWfMUt.js";
|
|
6
|
+
import { t as o } from "./edition-slug-CARO24Bs.js";
|
|
7
|
+
import { n as s, r as c, t as l } from "./brand-DklYwIeA.js";
|
|
8
|
+
//#region ../../../gatewaze-modules/modules/newsletters/lib/merge-fields.ts
|
|
9
|
+
var u = /* @__PURE__ */ e(t()), d = /* @__PURE__ */ e(c()), f = s(), p = l(), m = [
|
|
10
|
+
"first_name",
|
|
11
|
+
"last_name",
|
|
12
|
+
"name",
|
|
13
|
+
"company",
|
|
14
|
+
"job_title"
|
|
15
|
+
].join("|"), h = RegExp(`\\{\\{\\s*(${m})\\s*(?:\\|([^}]*))?\\}\\}`, "g");
|
|
16
|
+
function g(e) {
|
|
17
|
+
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
18
|
+
}
|
|
19
|
+
function _(e) {
|
|
20
|
+
let t = e.trim();
|
|
21
|
+
return t.length >= 2 && (t[0] === "\"" && t.endsWith("\"") || t[0] === "'" && t.endsWith("'")) ? t.slice(1, -1) : t;
|
|
22
|
+
}
|
|
23
|
+
function v(e, t, n = !0) {
|
|
24
|
+
let r = (e) => typeof e == "string" ? e.trim() : typeof e == "number" ? String(e) : "";
|
|
25
|
+
return e.replace(h, (e, i, a) => {
|
|
26
|
+
let o;
|
|
27
|
+
return o = i === "name" ? [r(t.first_name), r(t.last_name)].filter(Boolean).join(" ") : r(t[i]), o ||= _(a ?? ""), n ? g(o) : o;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
function y(e, t, n = !1) {
|
|
31
|
+
if (typeof e == "string") return v(e, t, n);
|
|
32
|
+
if (Array.isArray(e)) return e.map((e) => y(e, t, n));
|
|
33
|
+
if (e && typeof e == "object") {
|
|
34
|
+
let r = {};
|
|
35
|
+
for (let [i, a] of Object.entries(e)) r[i] = y(a, t, n);
|
|
36
|
+
return r;
|
|
37
|
+
}
|
|
38
|
+
return e;
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region ../../../gatewaze-modules/modules/newsletters/portal/pages/[collection]/[edition].tsx
|
|
42
|
+
var b = n(), x = {};
|
|
43
|
+
function S(e) {
|
|
44
|
+
return new Date(e).toLocaleDateString("en-US", {
|
|
45
|
+
year: "numeric",
|
|
46
|
+
month: "long",
|
|
47
|
+
day: "numeric"
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function C(e, t, n) {
|
|
51
|
+
return `/newsletters/${e}/${o(t, n)}`;
|
|
52
|
+
}
|
|
53
|
+
function w({ placeholder: e }) {
|
|
54
|
+
let t = e || {}, n = t.title || "Members only", r = t.body || "This section is available to AAIF member organizations. Sign in with your member email to read it.", i = t.cta_label || "Sign in", a = t.cta_url || "/auth/login";
|
|
55
|
+
return /* @__PURE__ */ (0, b.jsxs)("div", {
|
|
56
|
+
className: "nl-members-only",
|
|
57
|
+
style: {
|
|
58
|
+
border: "1px dashed rgba(0,0,0,0.18)",
|
|
59
|
+
background: "rgba(0,0,0,0.03)",
|
|
60
|
+
borderRadius: 12,
|
|
61
|
+
padding: "20px 22px",
|
|
62
|
+
margin: "14px 0",
|
|
63
|
+
textAlign: "center"
|
|
64
|
+
},
|
|
65
|
+
children: [
|
|
66
|
+
/* @__PURE__ */ (0, b.jsxs)("div", {
|
|
67
|
+
style: {
|
|
68
|
+
fontSize: 13,
|
|
69
|
+
fontWeight: 600,
|
|
70
|
+
letterSpacing: .3,
|
|
71
|
+
textTransform: "uppercase",
|
|
72
|
+
opacity: .6
|
|
73
|
+
},
|
|
74
|
+
children: ["🔒 ", n]
|
|
75
|
+
}),
|
|
76
|
+
/* @__PURE__ */ (0, b.jsx)("p", {
|
|
77
|
+
style: {
|
|
78
|
+
margin: "8px auto 14px",
|
|
79
|
+
maxWidth: 420,
|
|
80
|
+
opacity: .8
|
|
81
|
+
},
|
|
82
|
+
children: r
|
|
83
|
+
}),
|
|
84
|
+
a ? /* @__PURE__ */ (0, b.jsx)("a", {
|
|
85
|
+
href: a,
|
|
86
|
+
style: {
|
|
87
|
+
display: "inline-block",
|
|
88
|
+
padding: "8px 18px",
|
|
89
|
+
borderRadius: 8,
|
|
90
|
+
background: "#111",
|
|
91
|
+
color: "#fff",
|
|
92
|
+
fontWeight: 600,
|
|
93
|
+
fontSize: 14,
|
|
94
|
+
textDecoration: "none"
|
|
95
|
+
},
|
|
96
|
+
children: i
|
|
97
|
+
}) : null
|
|
98
|
+
]
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
function T({ params: e }) {
|
|
102
|
+
let [t, n] = (0, u.useState)(null), [s, c] = (0, u.useState)([]), [l, m] = (0, u.useState)({}), [h, g] = (0, u.useState)({}), [_, v] = (0, u.useState)(!0), [T, E] = (0, u.useState)(null), D = e.collection || "", O = e.edition || "", k = O.slice(0, 10);
|
|
103
|
+
if ((0, u.useEffect)(() => {
|
|
104
|
+
if (!D || !k) {
|
|
105
|
+
E("Invalid URL"), v(!1);
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
async function e() {
|
|
109
|
+
try {
|
|
110
|
+
let e = (0, f.getSupabaseClient)(), { data: t } = await e.from("newsletters_template_collections").select("id, name, slug, accent_color").eq("slug", D).single();
|
|
111
|
+
if (!t) {
|
|
112
|
+
E("Newsletter not found"), v(!1);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
let { data: r } = await e.from("newsletters_editions").select("id, title, edition_date, preheader, collection_id").eq("collection_id", t.id).eq("edition_date", k).eq("status", "published").order("created_at", { ascending: !1 }), i = (r || []).find((e) => o(e.edition_date, e.title) === O) || (r || [])[0];
|
|
116
|
+
if (!i) {
|
|
117
|
+
E("Edition not found"), v(!1);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
let { data: a } = await e.rpc("newsletters_blocks_for_viewer", { p_edition_id: i.id }), s = Array.from(new Set((a || []).filter((e) => !e.gated && e.templates_block_def_id).map((e) => e.templates_block_def_id))), l = {};
|
|
121
|
+
if (s.length) {
|
|
122
|
+
let { data: t } = await e.from("templates_block_defs").select("id, name, html, rich_text_template").in("id", s);
|
|
123
|
+
for (let e of t || []) l[e.id] = e;
|
|
124
|
+
}
|
|
125
|
+
let u = (a || []).map((e) => ({
|
|
126
|
+
id: e.id,
|
|
127
|
+
block_type: e.block_type,
|
|
128
|
+
content: e.content,
|
|
129
|
+
sort_order: e.sort_order,
|
|
130
|
+
gated: e.gated,
|
|
131
|
+
placeholder: e.placeholder,
|
|
132
|
+
block_template: e.gated ? null : l[e.templates_block_def_id] || null
|
|
133
|
+
}));
|
|
134
|
+
n({
|
|
135
|
+
...i,
|
|
136
|
+
newsletter_name: t.name,
|
|
137
|
+
newsletter_slug: t.slug,
|
|
138
|
+
accent_color: t.accent_color,
|
|
139
|
+
blocks: u
|
|
140
|
+
});
|
|
141
|
+
let { data: d } = await e.from("newsletters_editions").select("id, title, edition_date").eq("collection_id", t.id).eq("status", "published").neq("id", i.id).order("edition_date", { ascending: !1 }).limit(20);
|
|
142
|
+
c(d || []);
|
|
143
|
+
let p = u.filter((e) => !e.gated).map((e) => e.id);
|
|
144
|
+
if (p.length) {
|
|
145
|
+
let [n, r] = await Promise.all([e.from("newsletters_edition_bricks").select("id, block_id, brick_type, content, sort_order").in("block_id", p).order("sort_order"), e.from("templates_brick_defs").select("key, html, templates_block_defs!inner(library_id)").eq("templates_block_defs.library_id", t.id)]), i = {};
|
|
146
|
+
for (let e of n.data || []) (i[e.block_id] ||= []).push(e);
|
|
147
|
+
m(i);
|
|
148
|
+
let a = {};
|
|
149
|
+
for (let e of r.data || []) a[e.key] = e.html || "";
|
|
150
|
+
g(a);
|
|
151
|
+
}
|
|
152
|
+
} catch (e) {
|
|
153
|
+
console.error("Error loading edition:", e), E("Failed to load newsletter");
|
|
154
|
+
} finally {
|
|
155
|
+
v(!1);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
e();
|
|
159
|
+
}, [
|
|
160
|
+
D,
|
|
161
|
+
k,
|
|
162
|
+
O
|
|
163
|
+
]), _) return /* @__PURE__ */ (0, b.jsx)("main", {
|
|
164
|
+
className: "relative z-10",
|
|
165
|
+
children: /* @__PURE__ */ (0, b.jsx)("div", {
|
|
166
|
+
className: "max-w-7xl mx-auto px-6 py-12 flex justify-center",
|
|
167
|
+
children: /* @__PURE__ */ (0, b.jsx)("div", { className: "animate-spin w-6 h-6 border-2 border-white/30 border-t-white rounded-full" })
|
|
168
|
+
})
|
|
169
|
+
});
|
|
170
|
+
if (T || !t) return /* @__PURE__ */ (0, b.jsx)("main", {
|
|
171
|
+
className: "relative z-10",
|
|
172
|
+
children: /* @__PURE__ */ (0, b.jsxs)("div", {
|
|
173
|
+
className: "max-w-7xl mx-auto px-6 py-12 text-center",
|
|
174
|
+
children: [/* @__PURE__ */ (0, b.jsx)("h1", {
|
|
175
|
+
className: "text-2xl font-bold text-white mb-4",
|
|
176
|
+
children: T || "Edition not found"
|
|
177
|
+
}), /* @__PURE__ */ (0, b.jsx)(d.default, {
|
|
178
|
+
href: "/newsletters",
|
|
179
|
+
className: "text-white/60 hover:text-white underline",
|
|
180
|
+
children: "Back to newsletters"
|
|
181
|
+
})]
|
|
182
|
+
})
|
|
183
|
+
});
|
|
184
|
+
let A = (0, p.getClientBrandConfig)();
|
|
185
|
+
return /* @__PURE__ */ (0, b.jsxs)("div", {
|
|
186
|
+
className: "pub-article-wrap pub-fade",
|
|
187
|
+
children: [/* @__PURE__ */ (0, b.jsx)("style", { children: "\n .pub-article-main { min-width: 0; }\n .pub-article-main h1 { overflow-wrap: anywhere; }\n .nl-edition-render { max-width: 100%; }\n .nl-edition-render table { max-width: 100% !important; }\n .nl-edition-render img { max-width: 100% !important; height: auto !important; }\n\n /* CSS isolation for the inlined email render.\n *\n * The portal's global stylesheet collapses paragraph margins, resets\n * heading sizes, swaps the brand font in, and overrides line-height\n * — none of which match the email the recipient actually got. The\n * email itself ships email-safe inline styles inside a react-email\n * table layout; `all: revert` on every descendant inside the inner\n * container drops the portal cascade entirely so those inline styles\n * (and the browser's UA defaults for p / h1-h6 / li / blockquote /\n * etc.) take over. Result: the View Online page renders the same\n * spacing, font sizes, and typography as the sent email — without\n * iframes.\n *\n * The two .nl-edition-render-inner img/table rules are re-added\n * AFTER the reset because they're responsive-fitting overrides that\n * the email's inline styles don't include.\n */\n .nl-edition-render-inner,\n .nl-edition-render-inner * { all: revert; }\n .nl-edition-render-inner table { max-width: 100% !important; }\n .nl-edition-render-inner img { max-width: 100% !important; height: auto !important; }\n\n /* Small screens: the email is authored at a fixed ~650px and the panel\n * clips overflow (rounded corners), so on phones the right edge was\n * CROPPED with no way to scroll. Capping only table/img isn't enough:\n * fixed-width divs/columns inside blocks still force the layout wide,\n * and the reverted content-box sizing lets padding re-widen 100%-wide\n * elements. Cap EVERY element (border-box), kill inline min-widths, and\n * make long words/links breakable so table min-content can shrink —\n * the email then REFLOWS to the panel width. Scoped to narrow viewports\n * so the desktop render keeps the sent email's exact metrics.\n */\n @media (max-width: 760px) {\n .nl-edition-render-inner * {\n max-width: 100% !important;\n min-width: 0 !important;\n box-sizing: border-box !important;\n }\n .nl-edition-render-inner { overflow-wrap: anywhere; word-break: break-word; }\n }\n " }), /* @__PURE__ */ (0, b.jsxs)("div", {
|
|
188
|
+
className: "pub-article-grid",
|
|
189
|
+
children: [/* @__PURE__ */ (0, b.jsxs)("article", {
|
|
190
|
+
className: "pub-article-main",
|
|
191
|
+
style: { minWidth: 0 },
|
|
192
|
+
children: [
|
|
193
|
+
/* @__PURE__ */ (0, b.jsxs)("div", {
|
|
194
|
+
className: "pub-byline",
|
|
195
|
+
children: [
|
|
196
|
+
t.newsletter_name,
|
|
197
|
+
" · ",
|
|
198
|
+
S(t.edition_date)
|
|
199
|
+
]
|
|
200
|
+
}),
|
|
201
|
+
/* @__PURE__ */ (0, b.jsx)("h1", { children: t.title || "Newsletter Edition" }),
|
|
202
|
+
t.preheader && /* @__PURE__ */ (0, b.jsx)("p", {
|
|
203
|
+
className: "pub-byline",
|
|
204
|
+
style: { marginTop: 0 },
|
|
205
|
+
children: t.preheader
|
|
206
|
+
}),
|
|
207
|
+
/* @__PURE__ */ (0, b.jsx)("div", {
|
|
208
|
+
className: "nl-edition-render",
|
|
209
|
+
style: {
|
|
210
|
+
background: "#fff",
|
|
211
|
+
borderRadius: 14,
|
|
212
|
+
overflow: "hidden",
|
|
213
|
+
padding: "12px 16px",
|
|
214
|
+
marginTop: 20
|
|
215
|
+
},
|
|
216
|
+
children: /* @__PURE__ */ (0, b.jsx)("div", {
|
|
217
|
+
className: "nl-edition-render-inner",
|
|
218
|
+
children: t.blocks.filter((e) => !(e.block_type ?? "").startsWith("email_only_")).sort((e, t) => e.sort_order - t.sort_order).map((e) => {
|
|
219
|
+
if (e.gated) return /* @__PURE__ */ (0, b.jsx)(w, { placeholder: e.placeholder }, e.id);
|
|
220
|
+
let t = e.block_template, n = t?.html || t?.rich_text_template || "", o = y(A.storageBucketUrl ? r(e.content, A.storageBucketUrl) : e.content, x), s = [];
|
|
221
|
+
try {
|
|
222
|
+
s = i(n).nodes;
|
|
223
|
+
} catch {
|
|
224
|
+
s = [];
|
|
225
|
+
}
|
|
226
|
+
if (!s.length) return null;
|
|
227
|
+
let c = l[e.id] || [], u = o;
|
|
228
|
+
if (c.length) {
|
|
229
|
+
let e = c.map((e, t) => {
|
|
230
|
+
let n = [];
|
|
231
|
+
try {
|
|
232
|
+
n = i(h[e.brick_type] || "").nodes;
|
|
233
|
+
} catch {
|
|
234
|
+
n = [];
|
|
235
|
+
}
|
|
236
|
+
if (!n.length) return null;
|
|
237
|
+
let o = y(A.storageBucketUrl ? r(e.content, A.storageBucketUrl) : e.content, x);
|
|
238
|
+
return /* @__PURE__ */ (0, b.jsx)(a, {
|
|
239
|
+
nodes: n,
|
|
240
|
+
content: o
|
|
241
|
+
}, e.id || t);
|
|
242
|
+
}).filter(Boolean);
|
|
243
|
+
u = {
|
|
244
|
+
...o,
|
|
245
|
+
children: e
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
return /* @__PURE__ */ (0, b.jsx)(a, {
|
|
249
|
+
nodes: s,
|
|
250
|
+
content: u
|
|
251
|
+
}, e.id);
|
|
252
|
+
})
|
|
253
|
+
})
|
|
254
|
+
})
|
|
255
|
+
]
|
|
256
|
+
}), /* @__PURE__ */ (0, b.jsxs)("aside", {
|
|
257
|
+
className: "pub-article-side",
|
|
258
|
+
children: [/* @__PURE__ */ (0, b.jsxs)("div", {
|
|
259
|
+
className: "pub-side-card",
|
|
260
|
+
children: [/* @__PURE__ */ (0, b.jsxs)("div", {
|
|
261
|
+
className: "pub-side-h",
|
|
262
|
+
children: ["More from ", t.newsletter_name]
|
|
263
|
+
}), s.length === 0 ? /* @__PURE__ */ (0, b.jsx)("div", {
|
|
264
|
+
className: "pub-side-sub",
|
|
265
|
+
children: "No other editions yet."
|
|
266
|
+
}) : /* @__PURE__ */ (0, b.jsx)("div", {
|
|
267
|
+
style: {
|
|
268
|
+
display: "flex",
|
|
269
|
+
flexDirection: "column",
|
|
270
|
+
gap: 14
|
|
271
|
+
},
|
|
272
|
+
children: s.map((e) => /* @__PURE__ */ (0, b.jsxs)(d.default, {
|
|
273
|
+
href: C(t.newsletter_slug, e.edition_date, e.title),
|
|
274
|
+
style: {
|
|
275
|
+
display: "block",
|
|
276
|
+
textDecoration: "none"
|
|
277
|
+
},
|
|
278
|
+
children: [/* @__PURE__ */ (0, b.jsx)("div", {
|
|
279
|
+
className: "pub-side-val",
|
|
280
|
+
children: e.title || "Untitled"
|
|
281
|
+
}), /* @__PURE__ */ (0, b.jsx)("div", {
|
|
282
|
+
className: "pub-side-sub",
|
|
283
|
+
children: S(e.edition_date)
|
|
284
|
+
})]
|
|
285
|
+
}, e.id))
|
|
286
|
+
})]
|
|
287
|
+
}), /* @__PURE__ */ (0, b.jsx)("div", {
|
|
288
|
+
className: "pub-side-card",
|
|
289
|
+
children: /* @__PURE__ */ (0, b.jsx)(d.default, {
|
|
290
|
+
href: "/newsletters",
|
|
291
|
+
className: "pub-side-val",
|
|
292
|
+
style: { textDecoration: "none" },
|
|
293
|
+
children: "← All newsletters"
|
|
294
|
+
})
|
|
295
|
+
})]
|
|
296
|
+
})]
|
|
297
|
+
})]
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
//#endregion
|
|
301
|
+
export { T as default };
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import { c as e, t } from "./react-DB2tPNit.js";
|
|
2
|
+
import { d as n } from "./shim-BCerG8nb.js";
|
|
3
|
+
import { t as r } from "./jsx-runtime-CjozyJt-.js";
|
|
4
|
+
import { D as i, E as a, O as o, n as s } from "./ui-DRIo9Krs.js";
|
|
5
|
+
import { a as c, s as l } from "./hooks-C377EXJG.js";
|
|
6
|
+
import { n as u } from "./sonnerHostBridge-CXuCMM3R.js";
|
|
7
|
+
import { t as d } from "./outline-DwDYhYcF.js";
|
|
8
|
+
import { t as f } from "./Page-D3u8IZ2a.js";
|
|
9
|
+
//#region ../../../gatewaze-modules/modules/newsletters/admin/pages/sends/[id].tsx
|
|
10
|
+
var p = /* @__PURE__ */ e(t()), m = d(), h = r();
|
|
11
|
+
function g(e) {
|
|
12
|
+
return new Date(e).toLocaleDateString("en-US", {
|
|
13
|
+
year: "numeric",
|
|
14
|
+
month: "long",
|
|
15
|
+
day: "numeric",
|
|
16
|
+
hour: "2-digit",
|
|
17
|
+
minute: "2-digit"
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
function _() {
|
|
21
|
+
let { id: e } = l(), t = c(), [r, d] = (0, p.useState)(null), [_, v] = (0, p.useState)(!0);
|
|
22
|
+
(0, p.useEffect)(() => {
|
|
23
|
+
e && y();
|
|
24
|
+
}, [e]);
|
|
25
|
+
async function y() {
|
|
26
|
+
try {
|
|
27
|
+
let { data: t, error: r } = await n.from("newsletter_sends").select("\n *,\n edition:newsletters_editions(id, edition_date, subject, preheader)\n ").eq("id", e).single();
|
|
28
|
+
if (r) throw r;
|
|
29
|
+
d(t);
|
|
30
|
+
} catch (e) {
|
|
31
|
+
console.error("Error loading send:", e), u.error("Failed to load send details");
|
|
32
|
+
} finally {
|
|
33
|
+
v(!1);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
async function b() {
|
|
37
|
+
if (!(!r || !confirm("Cancel this scheduled send?"))) try {
|
|
38
|
+
let { error: e } = await n.from("newsletter_sends").update({
|
|
39
|
+
status: "cancelled",
|
|
40
|
+
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
41
|
+
}).eq("id", r.id);
|
|
42
|
+
if (e) throw e;
|
|
43
|
+
u.success("Send cancelled"), y();
|
|
44
|
+
} catch (e) {
|
|
45
|
+
console.error("Error cancelling send:", e), u.error("Failed to cancel send");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async function x() {
|
|
49
|
+
if (!(!r || !confirm("Retry sending this newsletter?"))) try {
|
|
50
|
+
let { error: e } = await n.from("newsletter_sends").update({
|
|
51
|
+
status: "scheduled",
|
|
52
|
+
error_message: null,
|
|
53
|
+
scheduled_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
54
|
+
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
55
|
+
}).eq("id", r.id);
|
|
56
|
+
if (e) throw e;
|
|
57
|
+
u.success("Send rescheduled"), y();
|
|
58
|
+
} catch (e) {
|
|
59
|
+
console.error("Error retrying send:", e), u.error("Failed to retry send");
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (_) return /* @__PURE__ */ (0, h.jsx)(f, {
|
|
63
|
+
title: "Send Details",
|
|
64
|
+
children: /* @__PURE__ */ (0, h.jsx)("div", {
|
|
65
|
+
className: "flex items-center justify-center p-12",
|
|
66
|
+
children: /* @__PURE__ */ (0, h.jsx)(s, {})
|
|
67
|
+
})
|
|
68
|
+
});
|
|
69
|
+
if (!r) return /* @__PURE__ */ (0, h.jsx)(f, {
|
|
70
|
+
title: "Send Not Found",
|
|
71
|
+
children: /* @__PURE__ */ (0, h.jsx)("div", {
|
|
72
|
+
className: "p-6 text-center text-[var(--gray-10)]",
|
|
73
|
+
children: "Send not found"
|
|
74
|
+
})
|
|
75
|
+
});
|
|
76
|
+
let S = r.total_recipients > 0 ? (r.delivered_count / r.total_recipients * 100).toFixed(1) : "0", C = r.delivered_count > 0 ? (r.open_count / r.delivered_count * 100).toFixed(1) : "0", w = r.delivered_count > 0 ? (r.click_count / r.delivered_count * 100).toFixed(1) : "0";
|
|
77
|
+
return /* @__PURE__ */ (0, h.jsx)(f, {
|
|
78
|
+
title: "Send Details",
|
|
79
|
+
children: /* @__PURE__ */ (0, h.jsxs)("div", {
|
|
80
|
+
className: "p-6",
|
|
81
|
+
children: [
|
|
82
|
+
/* @__PURE__ */ (0, h.jsxs)("div", {
|
|
83
|
+
className: "flex items-center justify-between mb-6",
|
|
84
|
+
children: [/* @__PURE__ */ (0, h.jsxs)("div", { children: [
|
|
85
|
+
/* @__PURE__ */ (0, h.jsxs)("button", {
|
|
86
|
+
onClick: () => t("/newsletters/sends"),
|
|
87
|
+
className: "inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-md bg-[var(--gray-a3)] border border-[var(--gray-a5)] text-[var(--gray-11)] hover:bg-[var(--gray-a4)] transition-colors mb-2",
|
|
88
|
+
children: [/* @__PURE__ */ (0, h.jsx)(m.ArrowLeftIcon, { className: "w-4 h-4" }), " Back"]
|
|
89
|
+
}),
|
|
90
|
+
/* @__PURE__ */ (0, h.jsx)("h1", {
|
|
91
|
+
className: "text-2xl font-semibold text-[var(--gray-12)]",
|
|
92
|
+
children: r.edition?.subject || "Newsletter Send"
|
|
93
|
+
}),
|
|
94
|
+
/* @__PURE__ */ (0, h.jsxs)("p", {
|
|
95
|
+
className: "text-sm text-[var(--gray-10)]",
|
|
96
|
+
children: ["Created ", g(r.created_at)]
|
|
97
|
+
})
|
|
98
|
+
] }), /* @__PURE__ */ (0, h.jsxs)("div", {
|
|
99
|
+
className: "flex items-center gap-2",
|
|
100
|
+
children: [
|
|
101
|
+
r.status === "scheduled" && /* @__PURE__ */ (0, h.jsxs)(i, {
|
|
102
|
+
variant: "outline",
|
|
103
|
+
onClick: b,
|
|
104
|
+
children: [/* @__PURE__ */ (0, h.jsx)(m.XMarkIcon, { className: "w-4 h-4 mr-1" }), "Cancel"]
|
|
105
|
+
}),
|
|
106
|
+
r.status === "failed" && /* @__PURE__ */ (0, h.jsxs)(i, {
|
|
107
|
+
variant: "primary",
|
|
108
|
+
onClick: x,
|
|
109
|
+
children: [/* @__PURE__ */ (0, h.jsx)(m.PaperAirplaneIcon, { className: "w-4 h-4 mr-1" }), "Retry"]
|
|
110
|
+
}),
|
|
111
|
+
/* @__PURE__ */ (0, h.jsx)(o, {
|
|
112
|
+
variant: r.status === "sent" ? "success" : r.status === "failed" ? "error" : r.status === "sending" ? "warning" : "neutral",
|
|
113
|
+
children: r.status
|
|
114
|
+
})
|
|
115
|
+
]
|
|
116
|
+
})]
|
|
117
|
+
}),
|
|
118
|
+
r.error_message && /* @__PURE__ */ (0, h.jsx)(a, {
|
|
119
|
+
className: "p-4 mb-6 border-[var(--red-6)] bg-[var(--red-a2)]",
|
|
120
|
+
children: /* @__PURE__ */ (0, h.jsx)("p", {
|
|
121
|
+
className: "text-sm text-[var(--red-11)]",
|
|
122
|
+
children: r.error_message
|
|
123
|
+
})
|
|
124
|
+
}),
|
|
125
|
+
/* @__PURE__ */ (0, h.jsxs)("div", {
|
|
126
|
+
className: "grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4 mb-6",
|
|
127
|
+
children: [
|
|
128
|
+
/* @__PURE__ */ (0, h.jsxs)(a, {
|
|
129
|
+
className: "p-4",
|
|
130
|
+
children: [/* @__PURE__ */ (0, h.jsx)("p", {
|
|
131
|
+
className: "text-xs text-[var(--gray-10)] uppercase",
|
|
132
|
+
children: "Recipients"
|
|
133
|
+
}), /* @__PURE__ */ (0, h.jsx)("p", {
|
|
134
|
+
className: "text-xl font-semibold text-[var(--gray-12)]",
|
|
135
|
+
children: r.total_recipients
|
|
136
|
+
})]
|
|
137
|
+
}),
|
|
138
|
+
/* @__PURE__ */ (0, h.jsxs)(a, {
|
|
139
|
+
className: "p-4",
|
|
140
|
+
children: [
|
|
141
|
+
/* @__PURE__ */ (0, h.jsx)("p", {
|
|
142
|
+
className: "text-xs text-[var(--gray-10)] uppercase",
|
|
143
|
+
children: "Delivered"
|
|
144
|
+
}),
|
|
145
|
+
/* @__PURE__ */ (0, h.jsx)("p", {
|
|
146
|
+
className: "text-xl font-semibold text-[var(--green-9)]",
|
|
147
|
+
children: r.delivered_count
|
|
148
|
+
}),
|
|
149
|
+
/* @__PURE__ */ (0, h.jsxs)("p", {
|
|
150
|
+
className: "text-xs text-[var(--gray-10)]",
|
|
151
|
+
children: [S, "%"]
|
|
152
|
+
})
|
|
153
|
+
]
|
|
154
|
+
}),
|
|
155
|
+
/* @__PURE__ */ (0, h.jsxs)(a, {
|
|
156
|
+
className: "p-4",
|
|
157
|
+
children: [
|
|
158
|
+
/* @__PURE__ */ (0, h.jsx)("p", {
|
|
159
|
+
className: "text-xs text-[var(--gray-10)] uppercase",
|
|
160
|
+
children: "Opens"
|
|
161
|
+
}),
|
|
162
|
+
/* @__PURE__ */ (0, h.jsx)("p", {
|
|
163
|
+
className: "text-xl font-semibold text-[var(--accent-9)]",
|
|
164
|
+
children: r.open_count
|
|
165
|
+
}),
|
|
166
|
+
/* @__PURE__ */ (0, h.jsxs)("p", {
|
|
167
|
+
className: "text-xs text-[var(--gray-10)]",
|
|
168
|
+
children: [C, "%"]
|
|
169
|
+
})
|
|
170
|
+
]
|
|
171
|
+
}),
|
|
172
|
+
/* @__PURE__ */ (0, h.jsxs)(a, {
|
|
173
|
+
className: "p-4",
|
|
174
|
+
children: [
|
|
175
|
+
/* @__PURE__ */ (0, h.jsx)("p", {
|
|
176
|
+
className: "text-xs text-[var(--gray-10)] uppercase",
|
|
177
|
+
children: "Clicks"
|
|
178
|
+
}),
|
|
179
|
+
/* @__PURE__ */ (0, h.jsx)("p", {
|
|
180
|
+
className: "text-xl font-semibold text-[var(--accent-9)]",
|
|
181
|
+
children: r.click_count
|
|
182
|
+
}),
|
|
183
|
+
/* @__PURE__ */ (0, h.jsxs)("p", {
|
|
184
|
+
className: "text-xs text-[var(--gray-10)]",
|
|
185
|
+
children: [w, "%"]
|
|
186
|
+
})
|
|
187
|
+
]
|
|
188
|
+
}),
|
|
189
|
+
/* @__PURE__ */ (0, h.jsxs)(a, {
|
|
190
|
+
className: "p-4",
|
|
191
|
+
children: [/* @__PURE__ */ (0, h.jsx)("p", {
|
|
192
|
+
className: "text-xs text-[var(--gray-10)] uppercase",
|
|
193
|
+
children: "Bounces"
|
|
194
|
+
}), /* @__PURE__ */ (0, h.jsx)("p", {
|
|
195
|
+
className: "text-xl font-semibold text-[var(--red-9)]",
|
|
196
|
+
children: r.bounce_count
|
|
197
|
+
})]
|
|
198
|
+
}),
|
|
199
|
+
/* @__PURE__ */ (0, h.jsxs)(a, {
|
|
200
|
+
className: "p-4",
|
|
201
|
+
children: [/* @__PURE__ */ (0, h.jsx)("p", {
|
|
202
|
+
className: "text-xs text-[var(--gray-10)] uppercase",
|
|
203
|
+
children: "Unsubscribes"
|
|
204
|
+
}), /* @__PURE__ */ (0, h.jsx)("p", {
|
|
205
|
+
className: "text-xl font-semibold text-[var(--red-9)]",
|
|
206
|
+
children: r.unsubscribe_count
|
|
207
|
+
})]
|
|
208
|
+
})
|
|
209
|
+
]
|
|
210
|
+
}),
|
|
211
|
+
/* @__PURE__ */ (0, h.jsxs)(a, {
|
|
212
|
+
className: "p-4",
|
|
213
|
+
children: [/* @__PURE__ */ (0, h.jsx)("h3", {
|
|
214
|
+
className: "text-sm font-medium text-[var(--gray-12)] mb-2",
|
|
215
|
+
children: "Timeline"
|
|
216
|
+
}), /* @__PURE__ */ (0, h.jsxs)("div", {
|
|
217
|
+
className: "space-y-2 text-sm",
|
|
218
|
+
children: [
|
|
219
|
+
/* @__PURE__ */ (0, h.jsxs)("div", {
|
|
220
|
+
className: "flex justify-between",
|
|
221
|
+
children: [/* @__PURE__ */ (0, h.jsx)("span", {
|
|
222
|
+
className: "text-[var(--gray-10)]",
|
|
223
|
+
children: "Created"
|
|
224
|
+
}), /* @__PURE__ */ (0, h.jsx)("span", {
|
|
225
|
+
className: "text-[var(--gray-12)]",
|
|
226
|
+
children: g(r.created_at)
|
|
227
|
+
})]
|
|
228
|
+
}),
|
|
229
|
+
r.scheduled_at && /* @__PURE__ */ (0, h.jsxs)("div", {
|
|
230
|
+
className: "flex justify-between",
|
|
231
|
+
children: [/* @__PURE__ */ (0, h.jsx)("span", {
|
|
232
|
+
className: "text-[var(--gray-10)]",
|
|
233
|
+
children: "Scheduled"
|
|
234
|
+
}), /* @__PURE__ */ (0, h.jsx)("span", {
|
|
235
|
+
className: "text-[var(--gray-12)]",
|
|
236
|
+
children: g(r.scheduled_at)
|
|
237
|
+
})]
|
|
238
|
+
}),
|
|
239
|
+
r.sent_at && /* @__PURE__ */ (0, h.jsxs)("div", {
|
|
240
|
+
className: "flex justify-between",
|
|
241
|
+
children: [/* @__PURE__ */ (0, h.jsx)("span", {
|
|
242
|
+
className: "text-[var(--gray-10)]",
|
|
243
|
+
children: "Sent"
|
|
244
|
+
}), /* @__PURE__ */ (0, h.jsx)("span", {
|
|
245
|
+
className: "text-[var(--gray-12)]",
|
|
246
|
+
children: g(r.sent_at)
|
|
247
|
+
})]
|
|
248
|
+
})
|
|
249
|
+
]
|
|
250
|
+
})]
|
|
251
|
+
})
|
|
252
|
+
]
|
|
253
|
+
})
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
//#endregion
|
|
257
|
+
export { _ as default };
|