@contentgrowth/content-emailing 0.7.8 → 0.8.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/dist/{TemplateManager-Db41KyPN.d.cts → TemplateManager-DX_McznX.d.cts} +10 -1
- package/dist/{TemplateManager-Db41KyPN.d.ts → TemplateManager-DX_McznX.d.ts} +10 -1
- package/dist/backend/index.cjs +30 -0
- package/dist/backend/index.cjs.map +1 -1
- package/dist/backend/index.js +30 -0
- package/dist/backend/index.js.map +1 -1
- package/dist/backend/routes/index.cjs +86 -56
- package/dist/backend/routes/index.cjs.map +1 -1
- package/dist/backend/routes/index.d.cts +3 -0
- package/dist/backend/routes/index.d.ts +3 -0
- package/dist/backend/routes/index.js +86 -56
- package/dist/backend/routes/index.js.map +1 -1
- package/dist/frontend/index.cjs +40 -14
- package/dist/frontend/index.cjs.map +1 -1
- package/dist/frontend/index.d.cts +2 -1
- package/dist/frontend/index.d.ts +2 -1
- package/dist/frontend/index.js +40 -14
- package/dist/frontend/index.js.map +1 -1
- package/dist/index.cjs +55 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +55 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/frontend/index.js
CHANGED
|
@@ -152,9 +152,10 @@ var TemplateTester = ({
|
|
|
152
152
|
template,
|
|
153
153
|
onSendTest,
|
|
154
154
|
onCancel,
|
|
155
|
-
sending = false
|
|
155
|
+
sending = false,
|
|
156
|
+
defaultValues = {}
|
|
156
157
|
}) => {
|
|
157
|
-
const [toEmail, setToEmail] = useState2("");
|
|
158
|
+
const [toEmail, setToEmail] = useState2(defaultValues.to || "");
|
|
158
159
|
const [variables, setVariables] = useState2({});
|
|
159
160
|
const [detectedVariables, setDetectedVariables] = useState2([]);
|
|
160
161
|
const [error, setError] = useState2(null);
|
|
@@ -166,11 +167,18 @@ var TemplateTester = ({
|
|
|
166
167
|
const uniqueVars = Array.from(/* @__PURE__ */ new Set([...subjectVars, ...bodyVars]));
|
|
167
168
|
setDetectedVariables(uniqueVars);
|
|
168
169
|
const initialValues = {};
|
|
170
|
+
const defaults = defaultValues.variables || {};
|
|
169
171
|
uniqueVars.forEach((v) => {
|
|
170
|
-
|
|
172
|
+
if (defaults[v]) {
|
|
173
|
+
initialValues[v] = defaults[v];
|
|
174
|
+
} else if (v === "email" && toEmail) {
|
|
175
|
+
initialValues[v] = toEmail;
|
|
176
|
+
} else {
|
|
177
|
+
initialValues[v] = "";
|
|
178
|
+
}
|
|
171
179
|
});
|
|
172
180
|
setVariables(initialValues);
|
|
173
|
-
}, [template]);
|
|
181
|
+
}, [template, defaultValues]);
|
|
174
182
|
const handleSubmit = async (e) => {
|
|
175
183
|
e.preventDefault();
|
|
176
184
|
setError(null);
|
|
@@ -178,7 +186,7 @@ var TemplateTester = ({
|
|
|
178
186
|
try {
|
|
179
187
|
await onSendTest({
|
|
180
188
|
template_id: template.template_id,
|
|
181
|
-
|
|
189
|
+
to: toEmail,
|
|
182
190
|
variables
|
|
183
191
|
});
|
|
184
192
|
setSuccess("Test email sent successfully!");
|
|
@@ -192,7 +200,13 @@ var TemplateTester = ({
|
|
|
192
200
|
type: "email",
|
|
193
201
|
required: true,
|
|
194
202
|
value: toEmail,
|
|
195
|
-
onChange: (e) =>
|
|
203
|
+
onChange: (e) => {
|
|
204
|
+
const val = e.target.value;
|
|
205
|
+
setToEmail(val);
|
|
206
|
+
if (variables["email"] !== void 0) {
|
|
207
|
+
setVariables((prev) => ({ ...prev, email: val }));
|
|
208
|
+
}
|
|
209
|
+
},
|
|
196
210
|
className: "w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",
|
|
197
211
|
placeholder: "recipient@example.com"
|
|
198
212
|
}
|
|
@@ -245,8 +259,10 @@ var TemplateManager = ({
|
|
|
245
259
|
onSendTestEmail,
|
|
246
260
|
title = "Email Templates",
|
|
247
261
|
description = "Manage system email templates",
|
|
248
|
-
templateTypes
|
|
262
|
+
templateTypes,
|
|
263
|
+
defaultTestValues
|
|
249
264
|
}) => {
|
|
265
|
+
const props = { defaultTestValues };
|
|
250
266
|
const [templates, setTemplates] = useState3([]);
|
|
251
267
|
const [loading, setLoading] = useState3(true);
|
|
252
268
|
const [error, setError] = useState3(null);
|
|
@@ -453,7 +469,8 @@ var TemplateManager = ({
|
|
|
453
469
|
template: testingTemplate,
|
|
454
470
|
onSendTest: handleTest,
|
|
455
471
|
onCancel: () => setShowTester(false),
|
|
456
|
-
sending: saving
|
|
472
|
+
sending: saving,
|
|
473
|
+
defaultValues: props.defaultTestValues
|
|
457
474
|
}
|
|
458
475
|
), deleteConfirm && /* @__PURE__ */ React3.createElement("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4" }, /* @__PURE__ */ React3.createElement("div", { className: "bg-white rounded-lg shadow-xl max-w-sm w-full p-6" }, /* @__PURE__ */ React3.createElement("h3", { className: "text-lg font-semibold mb-2" }, "Delete Template?"), /* @__PURE__ */ React3.createElement("p", { className: "text-gray-600 mb-4" }, "This action cannot be undone."), /* @__PURE__ */ React3.createElement("div", { className: "flex justify-end gap-3" }, /* @__PURE__ */ React3.createElement(
|
|
459
476
|
"button",
|
|
@@ -538,13 +555,22 @@ var EmailSettings = ({
|
|
|
538
555
|
if (loading) {
|
|
539
556
|
return /* @__PURE__ */ React4.createElement("div", { className: "flex items-center justify-center p-12" }, /* @__PURE__ */ React4.createElement("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600" }));
|
|
540
557
|
}
|
|
541
|
-
return /* @__PURE__ */ React4.createElement("div", { className: "max-w-4xl p-6 space-y-8" }, /* @__PURE__ */ React4.createElement("div", null, /* @__PURE__ */ React4.createElement("h2", { className: "text-2xl font-bold text-gray-900" }, title), /* @__PURE__ */ React4.createElement("p", { className: "text-gray-500 mt-1" }, description)), /* @__PURE__ */ React4.createElement("div", { className: "bg-white rounded-lg border border-gray-200 shadow-sm overflow-hidden" }, /* @__PURE__ */ React4.createElement("div", { className: "px-6 py-4 border-b border-gray-100 bg-gray-50" }, /* @__PURE__ */ React4.createElement("h3", { className: "text-lg font-medium text-gray-900" }, "Global Configuration"), /* @__PURE__ */ React4.createElement("p", { className: "text-sm text-gray-500" }, "Default sender identity and delivery provider.")), /* @__PURE__ */ React4.createElement("div", { className: "p-6 space-y-6" }, /* @__PURE__ */ React4.createElement("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6" }, /* @__PURE__ */ React4.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React4.createElement("label", { className: "block text-sm font-medium text-gray-700" }, "
|
|
558
|
+
return /* @__PURE__ */ React4.createElement("div", { className: "max-w-4xl p-6 space-y-8" }, /* @__PURE__ */ React4.createElement("div", null, /* @__PURE__ */ React4.createElement("h2", { className: "text-2xl font-bold text-gray-900" }, title), /* @__PURE__ */ React4.createElement("p", { className: "text-gray-500 mt-1" }, description)), /* @__PURE__ */ React4.createElement("div", { className: "bg-white rounded-lg border border-gray-200 shadow-sm overflow-hidden" }, /* @__PURE__ */ React4.createElement("div", { className: "px-6 py-4 border-b border-gray-100 bg-gray-50" }, /* @__PURE__ */ React4.createElement("h3", { className: "text-lg font-medium text-gray-900" }, "Global Configuration"), /* @__PURE__ */ React4.createElement("p", { className: "text-sm text-gray-500" }, "Default sender identity and delivery provider.")), /* @__PURE__ */ React4.createElement("div", { className: "p-6 space-y-6" }, /* @__PURE__ */ React4.createElement("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6" }, /* @__PURE__ */ React4.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React4.createElement("label", { className: "block text-sm font-medium text-gray-700" }, "Brand Name"), /* @__PURE__ */ React4.createElement(
|
|
559
|
+
"input",
|
|
560
|
+
{
|
|
561
|
+
type: "text",
|
|
562
|
+
value: settings.brandName || "",
|
|
563
|
+
onChange: (e) => handleChange("brandName", e.target.value),
|
|
564
|
+
placeholder: "e.g. Content Growth",
|
|
565
|
+
className: "w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
|
|
566
|
+
}
|
|
567
|
+
), /* @__PURE__ */ React4.createElement("p", { className: "text-xs text-gray-500" }, "Used in email templates as ", "{{brandName}}")), /* @__PURE__ */ React4.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React4.createElement("label", { className: "block text-sm font-medium text-gray-700" }, "From Name"), /* @__PURE__ */ React4.createElement(
|
|
542
568
|
"input",
|
|
543
569
|
{
|
|
544
570
|
type: "text",
|
|
545
571
|
value: settings.fromName,
|
|
546
572
|
onChange: (e) => handleChange("fromName", e.target.value),
|
|
547
|
-
placeholder: "e.g.
|
|
573
|
+
placeholder: "e.g. Support Team",
|
|
548
574
|
className: "w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
|
|
549
575
|
}
|
|
550
576
|
)), /* @__PURE__ */ React4.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React4.createElement("label", { className: "block text-sm font-medium text-gray-700" }, "From Address"), /* @__PURE__ */ React4.createElement(
|
|
@@ -553,18 +579,18 @@ var EmailSettings = ({
|
|
|
553
579
|
type: "email",
|
|
554
580
|
value: settings.fromAddress,
|
|
555
581
|
onChange: (e) => handleChange("fromAddress", e.target.value),
|
|
556
|
-
placeholder: "e.g. noreply@
|
|
582
|
+
placeholder: "e.g. noreply@example.com",
|
|
557
583
|
className: "w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
|
|
558
584
|
}
|
|
559
|
-
))), /* @__PURE__ */ React4.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React4.createElement("label", { className: "block text-sm font-medium text-gray-700" }, "Email Provider"), /* @__PURE__ */ React4.createElement(
|
|
585
|
+
))), /* @__PURE__ */ React4.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React4.createElement("label", { className: "block text-sm font-medium text-gray-700" }, "Email Provider"), /* @__PURE__ */ React4.createElement("div", { className: "relative" }, /* @__PURE__ */ React4.createElement(
|
|
560
586
|
"select",
|
|
561
587
|
{
|
|
562
588
|
value: settings.provider,
|
|
563
589
|
onChange: (e) => handleChange("provider", e.target.value),
|
|
564
|
-
className: "w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 bg-white"
|
|
590
|
+
className: "appearance-none w-full px-3 py-2 pr-10 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 bg-white text-gray-900"
|
|
565
591
|
},
|
|
566
592
|
PROVIDERS.map((p) => /* @__PURE__ */ React4.createElement("option", { key: p.value, value: p.value }, p.label))
|
|
567
|
-
), /* @__PURE__ */ React4.createElement("p", { className: "text-xs text-gray-500 mt-1" }, settings.provider === "mailchannels" && "MailChannels is recommended for Cloudflare Workers (requires no API key for standard usage).", settings.provider === "resend" && "Modern email API, good for transactional data.")))), settings.provider !== "mailchannels" && /* @__PURE__ */ React4.createElement("div", { className: "bg-white rounded-lg border border-gray-200 shadow-sm overflow-hidden" }, /* @__PURE__ */ React4.createElement("div", { className: "px-6 py-4 border-b border-gray-100 bg-gray-50" }, /* @__PURE__ */ React4.createElement("h3", { className: "text-lg font-medium text-gray-900" }, PROVIDERS.find((p) => p.value === settings.provider)?.label, " Configuration")), /* @__PURE__ */ React4.createElement("div", { className: "p-6 space-y-6" }, settings.provider === "resend" && /* @__PURE__ */ React4.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React4.createElement("label", { className: "block text-sm font-medium text-gray-700" }, "API Key"), /* @__PURE__ */ React4.createElement(
|
|
593
|
+
), /* @__PURE__ */ React4.createElement("div", { className: "pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-gray-500" }, /* @__PURE__ */ React4.createElement("svg", { className: "h-5 w-5", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true" }, /* @__PURE__ */ React4.createElement("path", { fillRule: "evenodd", d: "M10 3a1 1 0 01.707.293l3 3a1 1 0 01-1.414 1.414L10 5.414 7.707 7.707a1 1 0 01-1.414-1.414l3-3A1 1 0 0110 3zm-3.707 9.293a1 1 0 011.414 0L10 14.586l2.293-2.293a1 1 0 011.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z", clipRule: "evenodd" })))), /* @__PURE__ */ React4.createElement("p", { className: "text-xs text-gray-500 mt-1" }, settings.provider === "mailchannels" && "MailChannels is recommended for Cloudflare Workers (requires no API key for standard usage).", settings.provider === "resend" && "Modern email API, good for transactional data.")))), settings.provider !== "mailchannels" && /* @__PURE__ */ React4.createElement("div", { className: "bg-white rounded-lg border border-gray-200 shadow-sm overflow-hidden" }, /* @__PURE__ */ React4.createElement("div", { className: "px-6 py-4 border-b border-gray-100 bg-gray-50" }, /* @__PURE__ */ React4.createElement("h3", { className: "text-lg font-medium text-gray-900" }, PROVIDERS.find((p) => p.value === settings.provider)?.label, " Configuration")), /* @__PURE__ */ React4.createElement("div", { className: "p-6 space-y-6" }, settings.provider === "resend" && /* @__PURE__ */ React4.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React4.createElement("label", { className: "block text-sm font-medium text-gray-700" }, "API Key"), /* @__PURE__ */ React4.createElement(
|
|
568
594
|
"input",
|
|
569
595
|
{
|
|
570
596
|
type: "password",
|