@burdenoff/microfe-notification 2026.1129.1 → 2026.1129.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 (75) hide show
  1. package/dist/NotificationRoutes.js +73 -72
  2. package/dist/NotificationRoutes.js.map +1 -1
  3. package/dist/generated/global-operations.d.ts +4 -0
  4. package/dist/generated/global-operations.js +4 -0
  5. package/dist/generated/global-operations.js.map +1 -1
  6. package/dist/hooks/useNotificationTemplates.d.ts +3 -0
  7. package/dist/hooks/useSendNotification.d.ts +1 -1
  8. package/dist/hooks/useSendNotification.js.map +1 -1
  9. package/dist/translations/en.d.ts +179 -0
  10. package/dist/v2/InboxPage.js +113 -97
  11. package/dist/v2/InboxPage.js.map +1 -1
  12. package/dist/v2/NotificationDetailPanel.d.ts +9 -4
  13. package/dist/v2/NotificationDetailPanel.js +66 -51
  14. package/dist/v2/NotificationDetailPanel.js.map +1 -1
  15. package/dist/v2/admin/ChoiceSelect.d.ts +9 -0
  16. package/dist/v2/admin/ChoiceSelect.js +24 -0
  17. package/dist/v2/admin/ChoiceSelect.js.map +1 -0
  18. package/dist/v2/admin/DeliveryLogPage.d.ts +1 -0
  19. package/dist/v2/admin/DeliveryLogPage.js +207 -0
  20. package/dist/v2/admin/DeliveryLogPage.js.map +1 -0
  21. package/dist/v2/admin/InsertDetail.d.ts +6 -0
  22. package/dist/v2/admin/InsertDetail.js +77 -0
  23. package/dist/v2/admin/InsertDetail.js.map +1 -0
  24. package/dist/v2/admin/TemplateEditor.d.ts +6 -0
  25. package/dist/v2/admin/TemplateEditor.js +92 -0
  26. package/dist/v2/admin/TemplateEditor.js.map +1 -0
  27. package/dist/v2/admin/TemplateFields.d.ts +9 -0
  28. package/dist/v2/admin/TemplateFields.js +130 -0
  29. package/dist/v2/admin/TemplateFields.js.map +1 -0
  30. package/dist/v2/admin/TemplatePage.d.ts +1 -0
  31. package/dist/v2/admin/TemplatePage.js +62 -0
  32. package/dist/v2/admin/TemplatePage.js.map +1 -0
  33. package/dist/v2/admin/TemplatePreview.d.ts +8 -0
  34. package/dist/v2/admin/TemplatePreview.js +112 -0
  35. package/dist/v2/admin/TemplatePreview.js.map +1 -0
  36. package/dist/v2/admin/TemplatesPage.d.ts +1 -0
  37. package/dist/v2/admin/TemplatesPage.js +173 -0
  38. package/dist/v2/admin/TemplatesPage.js.map +1 -0
  39. package/dist/v2/admin/TopicDialog.d.ts +11 -0
  40. package/dist/v2/admin/TopicDialog.js +113 -0
  41. package/dist/v2/admin/TopicDialog.js.map +1 -0
  42. package/dist/v2/admin/TopicsPage.d.ts +1 -0
  43. package/dist/v2/admin/TopicsPage.js +152 -0
  44. package/dist/v2/admin/TopicsPage.js.map +1 -0
  45. package/dist/v2/admin/templateText.d.ts +35 -0
  46. package/dist/v2/admin/templateText.js +114 -0
  47. package/dist/v2/admin/templateText.js.map +1 -0
  48. package/dist/v2/admin/useTemplateDraft.d.ts +32 -0
  49. package/dist/v2/admin/useTemplateDraft.js +117 -0
  50. package/dist/v2/admin/useTemplateDraft.js.map +1 -0
  51. package/dist/v2/admin/words.d.ts +15 -0
  52. package/dist/v2/admin/words.js +67 -0
  53. package/dist/v2/admin/words.js.map +1 -0
  54. package/dist/v2/send/MessageTab.d.ts +4 -0
  55. package/dist/v2/send/MessageTab.js +152 -0
  56. package/dist/v2/send/MessageTab.js.map +1 -0
  57. package/dist/v2/send/PeopleTab.d.ts +4 -0
  58. package/dist/v2/send/PeopleTab.js +156 -0
  59. package/dist/v2/send/PeopleTab.js.map +1 -0
  60. package/dist/v2/send/SendNotificationDialog.d.ts +4 -0
  61. package/dist/v2/send/SendNotificationDialog.js +98 -0
  62. package/dist/v2/send/SendNotificationDialog.js.map +1 -0
  63. package/dist/v2/send/SendRedirect.d.ts +1 -0
  64. package/dist/v2/send/SendRedirect.js +20 -0
  65. package/dist/v2/send/SendRedirect.js.map +1 -0
  66. package/dist/v2/send/WhenTab.d.ts +4 -0
  67. package/dist/v2/send/WhenTab.js +64 -0
  68. package/dist/v2/send/WhenTab.js.map +1 -0
  69. package/dist/v2/send/sendModel.d.ts +47 -0
  70. package/dist/v2/send/sendModel.js +90 -0
  71. package/dist/v2/send/sendModel.js.map +1 -0
  72. package/dist/v2/send/useSendDraft.d.ts +24 -0
  73. package/dist/v2/send/useSendDraft.js +120 -0
  74. package/dist/v2/send/useSendDraft.js.map +1 -0
  75. package/package.json +1 -1
@@ -0,0 +1,114 @@
1
+ // src/v2/admin/templateText.ts
2
+ function e(e) {
3
+ let t = e.replace(/[_-]+/g, " ").replace(/([a-z0-9])([A-Z])/g, "$1 $2").trim().toLowerCase();
4
+ return t ? t.charAt(0).toUpperCase() + t.slice(1) : e;
5
+ }
6
+ function t(e) {
7
+ let t = e.normalize("NFKD").replace(/[̀-ͯ]/g, "").replace(/[^A-Za-z0-9]+/g, " ").trim().split(" ").filter(Boolean).map((e, t) => t === 0 ? e.toLowerCase() : e.charAt(0).toUpperCase() + e.slice(1).toLowerCase()).join("");
8
+ return /^[A-Za-z]/.test(t) ? t : t ? `detail${t}` : "";
9
+ }
10
+ var n = /\{\{\s*([A-Za-z_][\w.]*)\s*\}\}/g;
11
+ function r(t, r) {
12
+ let i = new Set(r.map((e) => e.name));
13
+ return t.replace(n, (t, n) => i.has(n) ? `[${e(n)}]` : t);
14
+ }
15
+ function i(t, n) {
16
+ let r = new Map(n.map((t) => [e(t.name), t.name]));
17
+ return t.replace(/\[([^[\]\n]+)\]/g, (e, t) => {
18
+ let n = r.get(t.trim());
19
+ return n ? `{{${n}}}` : e;
20
+ });
21
+ }
22
+ function a(e) {
23
+ let t = /* @__PURE__ */ new Set();
24
+ for (let r of e.matchAll(n)) t.add(r[1]);
25
+ return [...t];
26
+ }
27
+ var o = {
28
+ firstname: "Maya",
29
+ lastname: "Fernandes",
30
+ name: "Maya Fernandes",
31
+ fullname: "Maya Fernandes",
32
+ email: "maya@northwind.example",
33
+ workflow: "Lead routing",
34
+ workflowname: "Lead routing",
35
+ step: "New lead",
36
+ stepname: "New lead",
37
+ workspace: "Northwind",
38
+ workspacename: "Northwind",
39
+ organization: "Northwind Labs",
40
+ link: "https://app.example/runs/81",
41
+ url: "https://app.example/runs/81"
42
+ };
43
+ function s(t, n) {
44
+ if (t.defaultValue) return t.defaultValue;
45
+ let r = o[t.name.toLowerCase()];
46
+ if (r) return r;
47
+ switch (t.type) {
48
+ case "number": return "3";
49
+ case "boolean": return "yes";
50
+ case "date": return new Intl.DateTimeFormat(n, { dateStyle: "medium" }).format(new Date(2026, 10, 28));
51
+ default: return e(t.name);
52
+ }
53
+ }
54
+ function c(e, t, r) {
55
+ let i = new Map(t.map((e) => [e.name, e]));
56
+ return e.replace(n, (e, t) => {
57
+ let n = i.get(t);
58
+ return n ? s(n, r) : e;
59
+ });
60
+ }
61
+ function l(e) {
62
+ return typeof e == "object" && !!e && !Array.isArray(e);
63
+ }
64
+ function u(e) {
65
+ return e === "number" || e === "boolean" || e === "date" ? e : "string";
66
+ }
67
+ function d(e) {
68
+ return Array.isArray(e) ? e.filter(l).flatMap((e) => typeof e.name == "string" && e.name ? [{
69
+ name: e.name,
70
+ type: u(e.type),
71
+ defaultValue: e.defaultValue ? String(e.defaultValue) : ""
72
+ }] : []) : l(e) ? Object.entries(e).map(([e, t]) => ({
73
+ name: e,
74
+ type: u(l(t) ? t.type : void 0),
75
+ defaultValue: l(t) && t.defaultValue ? String(t.defaultValue) : ""
76
+ })) : [];
77
+ }
78
+ function f(e) {
79
+ let t = {};
80
+ for (let n of e) t[n.name] = {
81
+ type: n.type,
82
+ required: !0,
83
+ ...n.defaultValue ? { defaultValue: n.defaultValue } : {}
84
+ };
85
+ return t;
86
+ }
87
+ function p(e) {
88
+ return e.normalize("NFKD").replace(/[̀-ͯ]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60).replace(/-+$/g, "");
89
+ }
90
+ var m = [
91
+ {
92
+ name: "firstName",
93
+ type: "string",
94
+ defaultValue: ""
95
+ },
96
+ {
97
+ name: "workflowName",
98
+ type: "string",
99
+ defaultValue: ""
100
+ },
101
+ {
102
+ name: "stepName",
103
+ type: "string",
104
+ defaultValue: ""
105
+ },
106
+ {
107
+ name: "link",
108
+ type: "string",
109
+ defaultValue: ""
110
+ }
111
+ ];
112
+ export { m as COMMON_DETAILS, e as detailLabel, t as detailName, c as fillSamples, d as readDetails, s as sampleValue, p as templateSlug, r as toReadable, i as toStored, a as usedDetailNames, f as writeDetails };
113
+
114
+ //# sourceMappingURL=templateText.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templateText.js","names":["detailLabel","words","name","detailName","label","index","word","STORED","toReadable","known","details","detail","text","match","toStored","byLabel","usedDetailNames","names","stored","SAMPLES","sampleValue","locale","fillSamples","byName","isRecord","value","asType","readDetails","json","item","writeDetails","out","templateSlug","COMMON_DETAILS"],"sources":["../../../src/v2/admin/templateText.ts"],"sourcesContent":["/**\n * A template's text as people read it (BOFF-16785, C2; the mockup's `ntemplate`): the stored\n * `{{firstName}}` shows as the detail `[First name]`, and Insert adds details, so nobody types\n * braces. Saving turns each known `[Label]` back into `{{name}}`; anything else in brackets stays\n * as written. The template's details are its `variables`, stored as today\n * (`{name: {type, required, defaultValue}}`).\n */\n\nexport type DetailType = 'string' | 'number' | 'boolean' | 'date';\n\nexport interface TemplateDetail {\n name: string;\n type: DetailType;\n defaultValue: string;\n}\n\n/** \"firstName\" → \"First name\", \"workflow_name\" → \"Workflow name\", \"url\" → \"Url\". */\nexport function detailLabel(name: string): string {\n const words = name\n .replace(/[_-]+/g, ' ')\n .replace(/([a-z0-9])([A-Z])/g, '$1 $2')\n .trim()\n .toLowerCase();\n return words ? words.charAt(0).toUpperCase() + words.slice(1) : name;\n}\n\n/** \"First name\" → \"firstName\": the stored name for a detail someone adds. */\nexport function detailName(label: string): string {\n const words = label\n .normalize('NFKD')\n .replace(/[̀-ͯ]/g, '')\n .replace(/[^A-Za-z0-9]+/g, ' ')\n .trim()\n .split(' ')\n .filter(Boolean);\n const name = words\n .map((word, index) =>\n index === 0 ? word.toLowerCase() : word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()\n )\n .join('');\n return /^[A-Za-z]/.test(name) ? name : name ? `detail${name}` : '';\n}\n\nconst STORED = /\\{\\{\\s*([A-Za-z_][\\w.]*)\\s*\\}\\}/g;\n\n/** Stored text as people read it: each `{{name}}` of a known detail becomes `[Label]`. */\nexport function toReadable(text: string, details: readonly Pick<TemplateDetail, 'name'>[]): string {\n const known = new Set(details.map((detail) => detail.name));\n return text.replace(STORED, (match, name: string) =>\n known.has(name) ? `[${detailLabel(name)}]` : match\n );\n}\n\n/** Text as people wrote it, ready to store: each `[Label]` of a known detail becomes `{{name}}`. */\nexport function toStored(text: string, details: readonly Pick<TemplateDetail, 'name'>[]): string {\n const byLabel = new Map(details.map((detail) => [detailLabel(detail.name), detail.name]));\n return text.replace(/\\[([^[\\]\\n]+)\\]/g, (match, label: string) => {\n const name = byLabel.get(label.trim());\n return name ? `{{${name}}}` : match;\n });\n}\n\n/** The details a stored text uses (`{{name}}`), in order, once each. */\nexport function usedDetailNames(stored: string): string[] {\n const names = new Set<string>();\n for (const match of stored.matchAll(STORED)) names.add(match[1]);\n return [...names];\n}\n\nconst SAMPLES: Record<string, string> = {\n firstname: 'Maya',\n lastname: 'Fernandes',\n name: 'Maya Fernandes',\n fullname: 'Maya Fernandes',\n email: 'maya@northwind.example',\n workflow: 'Lead routing',\n workflowname: 'Lead routing',\n step: 'New lead',\n stepname: 'New lead',\n workspace: 'Northwind',\n workspacename: 'Northwind',\n organization: 'Northwind Labs',\n link: 'https://app.example/runs/81',\n url: 'https://app.example/runs/81',\n};\n\n/** A sample for the preview: the detail's default, else a likely value, else its label. */\nexport function sampleValue(detail: TemplateDetail, locale?: string): string {\n if (detail.defaultValue) return detail.defaultValue;\n const known = SAMPLES[detail.name.toLowerCase()];\n if (known) return known;\n switch (detail.type) {\n case 'number':\n return '3';\n case 'boolean':\n return 'yes';\n case 'date':\n return new Intl.DateTimeFormat(locale, { dateStyle: 'medium' }).format(\n new Date(2026, 10, 28)\n );\n default:\n return detailLabel(detail.name);\n }\n}\n\n/** Stored text with samples filled in, for the preview. Unknown `{{x}}` stay as they are. */\nexport function fillSamples(\n stored: string,\n details: readonly TemplateDetail[],\n locale?: string\n): string {\n const byName = new Map(details.map((detail) => [detail.name, detail]));\n return stored.replace(STORED, (match, name: string) => {\n const detail = byName.get(name);\n return detail ? sampleValue(detail, locale) : match;\n });\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction asType(value: unknown): DetailType {\n return value === 'number' || value === 'boolean' || value === 'date' ? value : 'string';\n}\n\n/** The stored `variables` (object, or the older array) as details. */\nexport function readDetails(json: unknown): TemplateDetail[] {\n if (Array.isArray(json)) {\n return json.filter(isRecord).flatMap((item) =>\n typeof item.name === 'string' && item.name\n ? [\n {\n name: item.name,\n type: asType(item.type),\n defaultValue: item.defaultValue ? String(item.defaultValue) : '',\n },\n ]\n : []\n );\n }\n if (!isRecord(json)) return [];\n return Object.entries(json).map(([name, value]) => ({\n name,\n type: asType(isRecord(value) ? value.type : undefined),\n defaultValue: isRecord(value) && value.defaultValue ? String(value.defaultValue) : '',\n }));\n}\n\n/** Details as stored today: `{name: {type, required, defaultValue?}}`. */\nexport function writeDetails(details: readonly TemplateDetail[]): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n for (const detail of details) {\n out[detail.name] = {\n type: detail.type,\n required: true,\n ...(detail.defaultValue ? { defaultValue: detail.defaultValue } : {}),\n };\n }\n return out;\n}\n\n/** \"Hi there, Maya\" → \"hi-there-maya\": a template's web-safe key from its name. */\nexport function templateSlug(name: string): string {\n return name\n .normalize('NFKD')\n .replace(/[̀-ͯ]/g, '')\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^-+|-+$/g, '')\n .slice(0, 60)\n .replace(/-+$/g, '');\n}\n\n/** Details most messages need, offered when the template doesn't have them yet. */\nexport const COMMON_DETAILS: readonly TemplateDetail[] = [\n { name: 'firstName', type: 'string', defaultValue: '' },\n { name: 'workflowName', type: 'string', defaultValue: '' },\n { name: 'stepName', type: 'string', defaultValue: '' },\n { name: 'link', type: 'string', defaultValue: '' },\n];\n"],"mappings":";AAiBA,SAAgBA,EAAY,GAAsB;CAChD,IAAMC,IAAQC,EACX,QAAQ,UAAU,GAAG,CAAC,CACtB,QAAQ,sBAAsB,OAAO,CAAC,CACtC,KAAK,CAAC,CACN,YAAY;CACf,OAAOD,IAAQA,EAAM,OAAO,CAAC,CAAC,CAAC,YAAY,IAAIA,EAAM,MAAM,CAAC,IAAIC;AAClE;AAGA,SAAgBC,EAAW,GAAuB;CAQhD,IAAMD,IAPQE,EACX,UAAU,MAAM,CAAC,CACjB,QAAQ,UAAU,EAAE,CAAC,CACrB,QAAQ,kBAAkB,GAAG,CAAC,CAC9B,KAAK,CAAC,CACN,MAAM,GAAG,CAAC,CACV,OAAO,OACG,CAAA,CACV,KAAK,GAAM,MACVC,MAAU,IAAIC,EAAK,YAAY,IAAIA,EAAK,OAAO,CAAC,CAAC,CAAC,YAAY,IAAIA,EAAK,MAAM,CAAC,CAAC,CAAC,YAAY,CAC9F,CAAC,CACA,KAAK,EAAE;CACV,OAAO,YAAY,KAAKJ,CAAI,IAAIA,IAAOA,IAAO,SAASA,MAAS;AAClE;AAEA,IAAMK,IAAS;AAGf,SAAgBC,EAAW,GAAc,GAA0D;CACjG,IAAMC,IAAQ,IAAI,IAAIC,EAAQ,KAAK,MAAWC,EAAO,IAAI,CAAC;CAC1D,OAAOC,EAAK,QAAQL,IAAS,GAAO,MAClCE,EAAM,IAAIP,CAAI,IAAI,IAAIF,EAAYE,CAAI,EAAE,KAAKW,CAC/C;AACF;AAGA,SAAgBC,EAAS,GAAc,GAA0D;CAC/F,IAAMC,IAAU,IAAI,IAAIL,EAAQ,KAAK,MAAW,CAACV,EAAYW,EAAO,IAAI,GAAGA,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ACtD;EAAE,MAAM;EAAgB,MAAM;EAAU,cAAc;CAAG;CACzD;EAAE,MAAM;EAAY,MAAM;EAAU,cAAc;CAAG;CACrD;EAAE,MAAM;EAAQ,MAAM;EAAU,cAAc;CAAG;AACnD"}
@@ -0,0 +1,32 @@
1
+ import { RefObject } from 'react';
2
+ import { BackendNotificationTemplate } from '../../hooks/useNotificationTemplates';
3
+ import { TemplateDetail } from './templateText';
4
+ export type DraftField = 'title' | 'message';
5
+ export declare function useTemplateDraft(template: BackendNotificationTemplate | null,
6
+ /** The title and message boxes, so Insert can put a detail at the cursor. */
7
+ titleRef: RefObject<HTMLInputElement | null>, messageRef: RefObject<HTMLTextAreaElement | null>, onChanged?: () => void): {
8
+ details: TemplateDetail[];
9
+ name: string;
10
+ setName: import('react').Dispatch<import('react').SetStateAction<string>>;
11
+ kind: "TRANSACTIONAL" | "MARKETING" | "SYSTEM" | "ALERT";
12
+ setKind: import('react').Dispatch<import('react').SetStateAction<"TRANSACTIONAL" | "MARKETING" | "SYSTEM" | "ALERT">>;
13
+ channel: "EMAIL" | "IN_APP" | "SMS" | "PUSH";
14
+ setChannel: import('react').Dispatch<import('react').SetStateAction<"EMAIL" | "IN_APP" | "SMS" | "PUSH">>;
15
+ title: string;
16
+ setTitle: import('react').Dispatch<import('react').SetStateAction<string>>;
17
+ message: string;
18
+ setMessage: import('react').Dispatch<import('react').SetStateAction<string>>;
19
+ problem: string | null;
20
+ rememberField: (field: DraftField) => void;
21
+ stored: {
22
+ title: string;
23
+ message: string;
24
+ };
25
+ saving: boolean;
26
+ ready: boolean;
27
+ insertInto: (field: DraftField, detail: TemplateDetail) => void;
28
+ save: () => Promise<void>;
29
+ remove: () => Promise<void>;
30
+ toggle: () => Promise<void>;
31
+ };
32
+ export type TemplateDraft = ReturnType<typeof useTemplateDraft>;
@@ -0,0 +1,117 @@
1
+ import { useNotificationTemplates as e } from "../../hooks/useNotificationTemplates.js";
2
+ import { useTr as t } from "../../shared/hooks/useTr.js";
3
+ import { useNotificationPaths as n } from "../../navigation-v2/paths.js";
4
+ import { detailLabel as r, readDetails as i, templateSlug as a, toReadable as o, toStored as s, writeDetails as c } from "./templateText.js";
5
+ import { isChannel as l, isKind as u } from "./words.js";
6
+ import { useMemo as d, useRef as f, useState as p } from "react";
7
+ import { useNavigate as m } from "react-router";
8
+ import { useConfirm as h, useNotify as g } from "@burdenoff/fe-libs/ui";
9
+ // src/v2/admin/useTemplateDraft.ts
10
+ function _(_, v, y, b) {
11
+ let x = t(), S = m(), C = g(), w = h(), T = n(), E = e(), [D, O] = p(() => i(_?.variables)), [k, A] = p(_?.name ?? ""), [j, M] = p(_ && u(_.type) ? _.type : "TRANSACTIONAL"), [N, P] = p(_ && l(_.channel) ? _.channel : "IN_APP"), [F, I] = p(() => o(_?.subject ?? "", D)), [L, R] = p(() => o(_?.bodyTemplate ?? "", D)), [z, B] = p(null), V = f("message"), H = d(() => ({
12
+ title: s(F, D),
13
+ message: s(L, D)
14
+ }), [
15
+ D,
16
+ L,
17
+ F
18
+ ]), U = E.isCreating || E.isUpdating, W = k.trim().length > 1 && L.trim().length > 0, G = (e) => {
19
+ D.some((t) => t.name === e.name) || O([...D, e]);
20
+ let t = V.current, n = t === "title" ? v.current : y.current, i = `[${r(e.name)}]`, a = t === "title" ? F : L, o = n?.selectionStart ?? a.length, s = n?.selectionEnd ?? a.length, c = a.slice(0, o) + i + a.slice(s);
21
+ t === "title" ? I(c) : R(c), requestAnimationFrame(() => {
22
+ n?.focus(), n?.setSelectionRange(o + i.length, o + i.length);
23
+ });
24
+ };
25
+ return {
26
+ details: D,
27
+ name: k,
28
+ setName: A,
29
+ kind: j,
30
+ setKind: M,
31
+ channel: N,
32
+ setChannel: P,
33
+ title: F,
34
+ setTitle: I,
35
+ message: L,
36
+ setMessage: R,
37
+ problem: z,
38
+ rememberField: (e) => {
39
+ V.current = e;
40
+ },
41
+ stored: H,
42
+ saving: U,
43
+ ready: W,
44
+ insertInto: (e, t) => {
45
+ V.current = e, G(t);
46
+ },
47
+ save: async () => {
48
+ B(null);
49
+ let e = c(D);
50
+ try {
51
+ if (_) {
52
+ await E.updateTemplate(_.id, {
53
+ name: k.trim(),
54
+ subject: H.title.trim() || void 0,
55
+ bodyTemplate: H.message,
56
+ variables: e
57
+ }), C({
58
+ title: x("notifications.v3.template.saved", "Saved. It’s used from the next message."),
59
+ tone: "success"
60
+ });
61
+ return;
62
+ }
63
+ let t = a(k), n = await E.createTemplate({
64
+ slug: t,
65
+ name: k.trim(),
66
+ type: j,
67
+ channel: N,
68
+ locale: "en",
69
+ subject: H.title.trim() || void 0,
70
+ bodyTemplate: H.message,
71
+ variables: e
72
+ });
73
+ C({
74
+ title: x("notifications.v3.template.created", "{{name}} is ready to send", { name: n.name }),
75
+ tone: "success"
76
+ }), S(T.template(n.slug), { replace: !0 });
77
+ } catch (e) {
78
+ B(e instanceof Error && e.message ? e.message : x("notifications.v3.templates.saveFailed", "Couldn’t save. Try again."));
79
+ }
80
+ },
81
+ remove: async () => {
82
+ if (_ && await w({
83
+ title: x("notifications.v3.templates.deleteTitle", "Delete {{name}}?", { name: _.name }),
84
+ description: x("notifications.v3.templates.deleteBody", "Anything that sends this template stops sending it. Messages already sent stay as they are."),
85
+ confirmLabel: x("notifications.v3.templates.delete", "Delete"),
86
+ tone: "danger",
87
+ typeToConfirm: _.name
88
+ })) try {
89
+ await E.deleteTemplate(_.id), C({
90
+ title: x("notifications.v3.templates.deleted", "Deleted {{name}}", { name: _.name }),
91
+ tone: "success"
92
+ }), S(T.templates, { replace: !0 });
93
+ } catch {
94
+ C({
95
+ title: x("notifications.v3.templates.deleteFailed", "Couldn’t delete it. Try again."),
96
+ tone: "error"
97
+ });
98
+ }
99
+ },
100
+ toggle: async () => {
101
+ if (_) try {
102
+ await E.updateTemplate(_.id, { enabled: !_.enabled }), C({
103
+ title: _.enabled ? x("notifications.v3.templates.turnedOff", "{{name}} is off", { name: _.name }) : x("notifications.v3.templates.turnedOn", "{{name}} is on", { name: _.name }),
104
+ tone: "success"
105
+ }), b?.();
106
+ } catch {
107
+ C({
108
+ title: x("notifications.v3.templates.saveFailed", "Couldn’t save. Try again."),
109
+ tone: "error"
110
+ });
111
+ }
112
+ }
113
+ };
114
+ }
115
+ export { _ as useTemplateDraft };
116
+
117
+ //# sourceMappingURL=useTemplateDraft.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTemplateDraft.js","names":["useTemplateDraft","tr","useTr","navigate","useNavigate","notify","useNotify","confirm","useConfirm","paths","useNotificationPaths","templates","useNotificationTemplates","details","setDetails","useState","readDetails","template","name","setName","kind","setKind","isKind","channel","setChannel","isChannel","title","setTitle","toReadable","message","setMessage","problem","setProblem","lastField","useRef","stored","useMemo","toStored","saving","ready","insert","known","detail","field","element","titleRef","messageRef","token","detailLabel","value","start","end","next","variables","writeDetails","slug","templateSlug","created","failure","onChanged"],"sources":["../../../src/v2/admin/useTemplateDraft.ts"],"sourcesContent":["/**\n * A template being edited (BOFF-16785, C2): its fields as people read them, Insert, and Save,\n * Turn off or on and Delete with today's hook (`useNotificationTemplates`). Saving stores today's\n * text (`{{firstName}}`) and the details as today's `variables`.\n */\nimport { useMemo, useRef, useState, type RefObject } from 'react';\nimport { useNavigate } from 'react-router';\nimport { useConfirm, useNotify } from '@burdenoff/fe-libs/ui';\nimport {\n useNotificationTemplates,\n type BackendNotificationTemplate,\n} from '../../hooks/useNotificationTemplates';\nimport { useTr } from '../../shared/hooks/useTr';\nimport { useNotificationPaths } from '../../navigation-v2/paths';\nimport {\n detailLabel,\n readDetails,\n templateSlug,\n toReadable,\n toStored,\n writeDetails,\n type TemplateDetail,\n} from './templateText';\nimport { isChannel, isKind, type TemplateChannel, type TemplateKind } from './words';\n\nexport type DraftField = 'title' | 'message';\n\nexport function useTemplateDraft(\n template: BackendNotificationTemplate | null,\n /** The title and message boxes, so Insert can put a detail at the cursor. */\n titleRef: RefObject<HTMLInputElement | null>,\n messageRef: RefObject<HTMLTextAreaElement | null>,\n onChanged?: () => void\n) {\n const tr = useTr();\n const navigate = useNavigate();\n const notify = useNotify();\n const confirm = useConfirm();\n const paths = useNotificationPaths();\n const templates = useNotificationTemplates();\n const [details, setDetails] = useState<TemplateDetail[]>(() => readDetails(template?.variables));\n const [name, setName] = useState(template?.name ?? '');\n const [kind, setKind] = useState<TemplateKind>(\n template && isKind(template.type) ? template.type : 'TRANSACTIONAL'\n );\n const [channel, setChannel] = useState<TemplateChannel>(\n template && isChannel(template.channel) ? template.channel : 'IN_APP'\n );\n const [title, setTitle] = useState(() => toReadable(template?.subject ?? '', details));\n const [message, setMessage] = useState(() => toReadable(template?.bodyTemplate ?? '', details));\n const [problem, setProblem] = useState<string | null>(null);\n const lastField = useRef<DraftField>('message');\n const stored = useMemo(\n () => ({ title: toStored(title, details), message: toStored(message, details) }),\n [details, message, title]\n );\n const saving = templates.isCreating || templates.isUpdating;\n const ready = name.trim().length > 1 && message.trim().length > 0;\n\n const insert = (detail: TemplateDetail) => {\n if (!details.some((known) => known.name === detail.name)) setDetails([...details, detail]);\n const field = lastField.current;\n const element = field === 'title' ? titleRef.current : messageRef.current;\n const token = `[${detailLabel(detail.name)}]`;\n const value = field === 'title' ? title : message;\n const start = element?.selectionStart ?? value.length;\n const end = element?.selectionEnd ?? value.length;\n const next = value.slice(0, start) + token + value.slice(end);\n if (field === 'title') setTitle(next);\n else setMessage(next);\n requestAnimationFrame(() => {\n element?.focus();\n element?.setSelectionRange(start + token.length, start + token.length);\n });\n };\n\n const save = async () => {\n setProblem(null);\n const variables = writeDetails(details);\n try {\n if (template) {\n await templates.updateTemplate(template.id, {\n name: name.trim(),\n subject: stored.title.trim() || undefined,\n bodyTemplate: stored.message,\n variables,\n });\n notify({\n title: tr('notifications.v3.template.saved', 'Saved. It’s used from the next message.'),\n tone: 'success',\n });\n return;\n }\n const slug = templateSlug(name);\n const created = await templates.createTemplate({\n slug,\n name: name.trim(),\n type: kind,\n channel,\n locale: 'en',\n subject: stored.title.trim() || undefined,\n bodyTemplate: stored.message,\n variables,\n });\n notify({\n title: tr('notifications.v3.template.created', '{{name}} is ready to send', {\n name: created.name,\n }),\n tone: 'success',\n });\n navigate(paths.template(created.slug), { replace: true });\n } catch (failure) {\n setProblem(\n failure instanceof Error && failure.message\n ? failure.message\n : tr('notifications.v3.templates.saveFailed', 'Couldn’t save. Try again.')\n );\n }\n };\n\n const remove = async () => {\n if (!template) return;\n const yes = await confirm({\n title: tr('notifications.v3.templates.deleteTitle', 'Delete {{name}}?', {\n name: template.name,\n }),\n description: tr(\n 'notifications.v3.templates.deleteBody',\n 'Anything that sends this template stops sending it. Messages already sent stay as they are.'\n ),\n confirmLabel: tr('notifications.v3.templates.delete', 'Delete'),\n tone: 'danger',\n typeToConfirm: template.name,\n });\n if (!yes) return;\n try {\n await templates.deleteTemplate(template.id);\n notify({\n title: tr('notifications.v3.templates.deleted', 'Deleted {{name}}', {\n name: template.name,\n }),\n tone: 'success',\n });\n navigate(paths.templates, { replace: true });\n } catch {\n notify({\n title: tr('notifications.v3.templates.deleteFailed', 'Couldn’t delete it. Try again.'),\n tone: 'error',\n });\n }\n };\n\n /** Remember which box Insert should write into. */\n const rememberField = (field: DraftField) => {\n lastField.current = field;\n };\n\n /** Put a detail where the cursor was in the title or the message. */\n const insertInto = (field: DraftField, detail: TemplateDetail) => {\n lastField.current = field;\n insert(detail);\n };\n\n const toggle = async () => {\n if (!template) return;\n try {\n await templates.updateTemplate(template.id, { enabled: !template.enabled });\n notify({\n title: template.enabled\n ? tr('notifications.v3.templates.turnedOff', '{{name}} is off', { name: template.name })\n : tr('notifications.v3.templates.turnedOn', '{{name}} is on', { name: template.name }),\n tone: 'success',\n });\n onChanged?.();\n } catch {\n notify({\n title: tr('notifications.v3.templates.saveFailed', 'Couldn’t save. Try again.'),\n tone: 'error',\n });\n }\n };\n\n return {\n details,\n name,\n setName,\n kind,\n setKind,\n channel,\n setChannel,\n title,\n setTitle,\n message,\n setMessage,\n problem,\n rememberField,\n stored,\n saving,\n ready,\n insertInto,\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["TRANSACTIONAL", "SYSTEM", "ALERT", "MARKETING"];
3
+ export type TemplateKind = (typeof TEMPLATE_KINDS)[number];
4
+ export declare function isKind(value: string): value is TemplateKind;
5
+ export declare function kindWord(kind: string, tr: Tr): string;
6
+ export declare const TEMPLATE_CHANNELS: readonly ["IN_APP", "EMAIL", "PUSH", "SMS"];
7
+ export type TemplateChannel = (typeof TEMPLATE_CHANNELS)[number];
8
+ export declare function isChannel(value: string): value is TemplateChannel;
9
+ export declare function channelWord(channel: string, tr: Tr): string;
10
+ /** A delivery's status as a tone and words. */
11
+ export type DeliveryTone = 'ok' | 'bad' | 'waiting';
12
+ export declare function deliveryState(status: string | undefined, tr: Tr): {
13
+ tone: DeliveryTone;
14
+ word: string;
15
+ };
@@ -0,0 +1,67 @@
1
+ // src/v2/admin/words.ts
2
+ var e = [
3
+ "TRANSACTIONAL",
4
+ "SYSTEM",
5
+ "ALERT",
6
+ "MARKETING"
7
+ ];
8
+ function t(t) {
9
+ return e.some((e) => e === t);
10
+ }
11
+ function n(e, t) {
12
+ switch (e) {
13
+ case "TRANSACTIONAL": return t("notifications.v3.kind.activity", "Account and activity");
14
+ case "SYSTEM": return t("notifications.v3.kind.updates", "Product updates");
15
+ case "ALERT": return t("notifications.v3.kind.alerts", "Urgent alerts");
16
+ case "MARKETING": return t("notifications.v3.kind.news", "News and offers");
17
+ default: return t("notifications.v3.kind.other", "Other");
18
+ }
19
+ }
20
+ var r = [
21
+ "IN_APP",
22
+ "EMAIL",
23
+ "PUSH",
24
+ "SMS"
25
+ ];
26
+ function i(e) {
27
+ return r.some((t) => t === e);
28
+ }
29
+ function a(e, t) {
30
+ switch (e) {
31
+ case "IN_APP": return t("notifications.v3.channel.inApp", "In app");
32
+ case "EMAIL": return t("notifications.v3.channel.email", "Email");
33
+ case "PUSH": return t("notifications.v3.channel.push", "Push");
34
+ case "SMS": return t("notifications.v3.channel.sms", "Text message");
35
+ case "WHATSAPP": return t("notifications.v3.channel.whatsapp", "WhatsApp");
36
+ case "SLACK": return t("notifications.v3.channel.slack", "Slack");
37
+ default: return t("notifications.v3.channel.other", "Another channel");
38
+ }
39
+ }
40
+ function o(e, t) {
41
+ switch (e) {
42
+ case "DELIVERED":
43
+ case "OPENED":
44
+ case "CLICKED": return {
45
+ tone: "ok",
46
+ word: t("notifications.v3.delivery.delivered", "Delivered")
47
+ };
48
+ case "FAILED":
49
+ case "BOUNCED":
50
+ case "COMPLAINED":
51
+ case "UNSUBSCRIBED": return {
52
+ tone: "bad",
53
+ word: t("notifications.v3.delivery.failed", "Didn’t arrive")
54
+ };
55
+ case "SENT": return {
56
+ tone: "ok",
57
+ word: t("notifications.v3.delivery.sent", "Sent")
58
+ };
59
+ default: return {
60
+ tone: "waiting",
61
+ word: t("notifications.v3.delivery.waiting", "Waiting to go")
62
+ };
63
+ }
64
+ }
65
+ export { r as TEMPLATE_CHANNELS, e as TEMPLATE_KINDS, a as channelWord, o as deliveryState, i as isChannel, t as isKind, n as kindWord };
66
+
67
+ //# sourceMappingURL=words.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"words.js","names":["TEMPLATE_KINDS","isKind","kind","value","kindWord","tr","TEMPLATE_CHANNELS","isChannel","channel","channelWord","deliveryState","status"],"sources":["../../../src/v2/admin/words.ts"],"sourcesContent":["/**\n * Notification kinds and channels in plain words (BOFF-16785, C2): what a template or topic is\n * about, and how it's sent.\n */\nimport type { Tr } from '../model/tr';\n\nexport const TEMPLATE_KINDS = ['TRANSACTIONAL', 'SYSTEM', 'ALERT', 'MARKETING'] as const;\nexport type TemplateKind = (typeof TEMPLATE_KINDS)[number];\n\nexport function isKind(value: string): value is TemplateKind {\n return TEMPLATE_KINDS.some((kind) => kind === value);\n}\n\nexport function kindWord(kind: string, tr: Tr): string {\n switch (kind) {\n case 'TRANSACTIONAL':\n return tr('notifications.v3.kind.activity', 'Account and activity');\n case 'SYSTEM':\n return tr('notifications.v3.kind.updates', 'Product updates');\n case 'ALERT':\n return tr('notifications.v3.kind.alerts', 'Urgent alerts');\n case 'MARKETING':\n return tr('notifications.v3.kind.news', 'News and offers');\n default:\n return tr('notifications.v3.kind.other', 'Other');\n }\n}\n\nexport const TEMPLATE_CHANNELS = ['IN_APP', 'EMAIL', 'PUSH', 'SMS'] as const;\nexport type TemplateChannel = (typeof TEMPLATE_CHANNELS)[number];\n\nexport function isChannel(value: string): value is TemplateChannel {\n return TEMPLATE_CHANNELS.some((channel) => channel === value);\n}\n\nexport function channelWord(channel: string, tr: Tr): string {\n switch (channel) {\n case 'IN_APP':\n return tr('notifications.v3.channel.inApp', 'In app');\n case 'EMAIL':\n return tr('notifications.v3.channel.email', 'Email');\n case 'PUSH':\n return tr('notifications.v3.channel.push', 'Push');\n case 'SMS':\n return tr('notifications.v3.channel.sms', 'Text message');\n case 'WHATSAPP':\n return tr('notifications.v3.channel.whatsapp', 'WhatsApp');\n case 'SLACK':\n return tr('notifications.v3.channel.slack', 'Slack');\n default:\n return tr('notifications.v3.channel.other', 'Another channel');\n }\n}\n\n/** A delivery's status as a tone and words. */\nexport type DeliveryTone = 'ok' | 'bad' | 'waiting';\n\nexport function deliveryState(\n status: string | undefined,\n tr: Tr\n): { tone: DeliveryTone; word: string } {\n switch (status) {\n case 'DELIVERED':\n case 'OPENED':\n case 'CLICKED':\n return { tone: 'ok', word: tr('notifications.v3.delivery.delivered', 'Delivered') };\n case 'FAILED':\n case 'BOUNCED':\n case 'COMPLAINED':\n case 'UNSUBSCRIBED':\n return { tone: 'bad', word: tr('notifications.v3.delivery.failed', 'Didn’t arrive') };\n case 'SENT':\n return { tone: 'ok', word: tr('notifications.v3.delivery.sent', 'Sent') };\n default:\n return { tone: 'waiting', word: tr('notifications.v3.delivery.waiting', 'Waiting to go') };\n }\n}\n"],"mappings":";AAMA,IAAaA,IAAiB;CAAC;CAAiB;CAAU;CAAS;AAAW;AAG9E,SAAgBC,EAAO,GAAsC;CAC3D,OAAOD,EAAe,MAAM,MAASE,MAASC,CAAK;AACrD;AAEA,SAAgBC,E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from './useSendDraft';
2
+ export declare function MessageTab({ draft }: {
3
+ draft: SendDraft;
4
+ }): import('react').JSX.Element;
@@ -0,0 +1,152 @@
1
+ import { useNotificationTemplates as e } from "../../hooks/useNotificationTemplates.js";
2
+ import { useTr as t } from "../../shared/hooks/useTr.js";
3
+ import { ChoiceSelect as n } from "../admin/ChoiceSelect.js";
4
+ import { detailLabel as r } from "../admin/templateText.js";
5
+ import { TEMPLATE_KINDS as i, channelWord as a, kindWord as o } from "../admin/words.js";
6
+ import { SEND_CHANNELS as s, detailsInUse as c } from "./sendModel.js";
7
+ import { useId as l } from "react";
8
+ import { Check as u } from "lucide-react";
9
+ import { jsx as d, jsxs as f } from "react/jsx-runtime";
10
+ import { Button as p, Input as m, Label as h, Textarea as g } from "@burdenoff/fe-libs/ui";
11
+ // src/v2/send/MessageTab.tsx
12
+ var _ = "blank", v = { enabled: !0 };
13
+ function y({ id: r, draft: i }) {
14
+ let a = t(), { templates: o } = e(v), s = new Map(o.map((e) => [e.id, e.name]));
15
+ return /* @__PURE__ */ f("div", {
16
+ className: "flex flex-col gap-1.5",
17
+ children: [/* @__PURE__ */ d(h, {
18
+ htmlFor: r,
19
+ children: a("notifications.v3.send.startFrom", "Start from")
20
+ }), /* @__PURE__ */ d(n, {
21
+ id: r,
22
+ value: i.templateId ?? _,
23
+ options: [_, ...o.map((e) => e.id)],
24
+ word: (e) => e === _ ? a("notifications.v3.send.blank", "A blank message") : s.get(e) ?? e,
25
+ onChange: (e) => i.startFrom(o.find((t) => t.id === e) ?? null),
26
+ className: "max-w-sm"
27
+ })]
28
+ });
29
+ }
30
+ function b({ id: e, draft: n }) {
31
+ let i = t(), { title: a, message: o, details: s, values: l } = n.draft, u = c(a, o, s);
32
+ return u.length === 0 ? null : /* @__PURE__ */ f("fieldset", {
33
+ className: "m-0 flex flex-col gap-3 border-0 p-0",
34
+ "data-testid": "send-details",
35
+ children: [
36
+ /* @__PURE__ */ d("legend", {
37
+ className: "mb-1 p-0 text-sm font-medium text-text-primary",
38
+ children: i("notifications.v3.send.details", "Fill in the details")
39
+ }),
40
+ /* @__PURE__ */ d("p", {
41
+ className: "m-0 -mt-2 text-xs text-text-muted",
42
+ children: i("notifications.v3.send.detailsHelp", "Each one is the same for everyone who gets it.")
43
+ }),
44
+ /* @__PURE__ */ d("div", {
45
+ className: "grid grid-cols-2 gap-3 max-sm:grid-cols-1",
46
+ children: u.map((t) => /* @__PURE__ */ f("div", {
47
+ className: "flex flex-col gap-1.5",
48
+ children: [/* @__PURE__ */ d(h, {
49
+ htmlFor: `${e}-${t.name}`,
50
+ children: r(t.name)
51
+ }), /* @__PURE__ */ d(m, {
52
+ id: `${e}-${t.name}`,
53
+ value: l[t.name] ?? "",
54
+ onChange: (e) => n.setValue(t.name, e.target.value)
55
+ })]
56
+ }, t.name))
57
+ })
58
+ ]
59
+ });
60
+ }
61
+ function x({ id: e, draft: n }) {
62
+ let r = t(), i = n.draft.channels;
63
+ return /* @__PURE__ */ f("div", {
64
+ className: "flex flex-col gap-1.5",
65
+ children: [/* @__PURE__ */ d("span", {
66
+ className: "text-sm font-medium text-text-primary",
67
+ id: e,
68
+ children: r("notifications.v3.template.channel", "Sent by")
69
+ }), /* @__PURE__ */ d("div", {
70
+ className: "flex flex-wrap gap-2",
71
+ role: "group",
72
+ "aria-labelledby": e,
73
+ children: s.map((e) => {
74
+ let t = i.includes(e);
75
+ return /* @__PURE__ */ f(p, {
76
+ type: "button",
77
+ size: "sm",
78
+ variant: t ? "secondary" : "outline",
79
+ "aria-pressed": t,
80
+ onClick: () => n.toggleChannel(e),
81
+ "data-testid": `send-by-${e}`,
82
+ children: [t ? /* @__PURE__ */ d(u, { "aria-hidden": "true" }) : null, a(e, r)]
83
+ }, e);
84
+ })
85
+ })]
86
+ });
87
+ }
88
+ function S({ draft: e }) {
89
+ let r = t(), a = l();
90
+ return /* @__PURE__ */ f("div", {
91
+ className: "flex flex-col gap-4",
92
+ children: [
93
+ /* @__PURE__ */ d(y, {
94
+ id: `${a}-start`,
95
+ draft: e
96
+ }),
97
+ /* @__PURE__ */ f("div", {
98
+ className: "flex flex-col gap-1.5",
99
+ children: [/* @__PURE__ */ d(h, {
100
+ htmlFor: `${a}-title`,
101
+ children: r("notifications.v3.template.title", "Title")
102
+ }), /* @__PURE__ */ d(m, {
103
+ id: `${a}-title`,
104
+ value: e.draft.title,
105
+ placeholder: r("notifications.v3.send.titlePlaceholder", "What it’s about"),
106
+ onChange: (t) => e.setTitle(t.target.value),
107
+ "data-testid": "send-title"
108
+ })]
109
+ }),
110
+ /* @__PURE__ */ f("div", {
111
+ className: "flex flex-col gap-1.5",
112
+ children: [/* @__PURE__ */ d(h, {
113
+ htmlFor: `${a}-message`,
114
+ children: r("notifications.v3.template.message", "Message")
115
+ }), /* @__PURE__ */ d(g, {
116
+ id: `${a}-message`,
117
+ rows: 4,
118
+ value: e.draft.message,
119
+ placeholder: r("notifications.v3.send.messagePlaceholder", "Write the message"),
120
+ onChange: (t) => e.setMessage(t.target.value),
121
+ "data-testid": "send-message"
122
+ })]
123
+ }),
124
+ /* @__PURE__ */ d(b, {
125
+ id: `${a}-detail`,
126
+ draft: e
127
+ }),
128
+ /* @__PURE__ */ f("div", {
129
+ className: "grid grid-cols-2 gap-3 max-sm:grid-cols-1",
130
+ children: [/* @__PURE__ */ f("div", {
131
+ className: "flex flex-col gap-1.5",
132
+ children: [/* @__PURE__ */ d(h, {
133
+ htmlFor: `${a}-kind`,
134
+ children: r("notifications.v3.template.kind", "About")
135
+ }), /* @__PURE__ */ d(n, {
136
+ id: `${a}-kind`,
137
+ value: e.draft.kind,
138
+ options: i,
139
+ word: (e) => o(e, r),
140
+ onChange: e.setKind
141
+ })]
142
+ }), /* @__PURE__ */ d(x, {
143
+ id: `${a}-by`,
144
+ draft: e
145
+ })]
146
+ })
147
+ ]
148
+ });
149
+ }
150
+ export { S as MessageTab };
151
+
152
+ //# sourceMappingURL=MessageTab.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MessageTab.js","names":["BLANK","TEMPLATE_FILTER","StartFrom","tr","useTr","useNotificationTemplates","names","templates","template","Label","id","ChoiceSelect","draft","option","DetailValues","used","detailsInUse","title","message","details","detail","detailLabel","Input","values","event","SendBy","chosen","SEND_CHANNELS","on","channel","Button","Check","channelWord","MessageTab","useId","Textarea","TEMPLATE_KINDS","kindWord"],"sources":["../../../src/v2/send/MessageTab.tsx"],"sourcesContent":["/**\n * The send dialog's Message tab (BOFF-16785, C2b): start from a blank message or a template, the\n * title and message, a value for each of the template's details still in the words, what it's\n * about, and the ways it's sent (In app · Email · Push).\n */\nimport { useId } from 'react';\nimport { Check } from 'lucide-react';\nimport { Button, Input, Label, Textarea } from '@burdenoff/fe-libs/ui';\nimport { useNotificationTemplates } from '../../hooks/useNotificationTemplates';\nimport { useTr } from '../../shared/hooks/useTr';\nimport { ChoiceSelect } from '../admin/ChoiceSelect';\nimport { detailLabel } from '../admin/templateText';\nimport { channelWord, kindWord, TEMPLATE_KINDS } from '../admin/words';\nimport { detailsInUse, SEND_CHANNELS } from './sendModel';\nimport type { SendDraft } from './useSendDraft';\n\nconst BLANK = 'blank';\nconst TEMPLATE_FILTER = { enabled: true };\n\nfunction StartFrom({ id, draft }: { id: string; draft: SendDraft }) {\n const tr = useTr();\n const { templates } = useNotificationTemplates(TEMPLATE_FILTER);\n const names = new Map(templates.map((template) => [template.id, template.name]));\n return (\n <div className=\"flex flex-col gap-1.5\">\n <Label htmlFor={id}>{tr('notifications.v3.send.startFrom', 'Start from')}</Label>\n <ChoiceSelect\n id={id}\n value={draft.templateId ?? BLANK}\n options={[BLANK, ...templates.map((template) => template.id)]}\n word={(option) =>\n option === BLANK\n ? tr('notifications.v3.send.blank', 'A blank message')\n : (names.get(option) ?? option)\n }\n onChange={(option) =>\n draft.startFrom(templates.find((template) => template.id === option) ?? null)\n }\n className=\"max-w-sm\"\n />\n </div>\n );\n}\n\nfunction DetailValues({ id, draft }: { id: string; draft: SendDraft }) {\n const tr = useTr();\n const { title, message, details, values } = draft.draft;\n const used = detailsInUse(title, message, details);\n if (used.length === 0) return null;\n return (\n <fieldset className=\"m-0 flex flex-col gap-3 border-0 p-0\" data-testid=\"send-details\">\n <legend className=\"mb-1 p-0 text-sm font-medium text-text-primary\">\n {tr('notifications.v3.send.details', 'Fill in the details')}\n </legend>\n <p className=\"m-0 -mt-2 text-xs text-text-muted\">\n {tr('notifications.v3.send.detailsHelp', 'Each one is the same for everyone who gets it.')}\n </p>\n <div className=\"grid grid-cols-2 gap-3 max-sm:grid-cols-1\">\n {used.map((detail) => (\n <div key={detail.name} className=\"flex flex-col gap-1.5\">\n <Label htmlFor={`${id}-${detail.name}`}>{detailLabel(detail.name)}</Label>\n <Input\n id={`${id}-${detail.name}`}\n value={values[detail.name] ?? ''}\n onChange={(event) => draft.setValue(detail.name, event.target.value)}\n />\n </div>\n ))}\n </div>\n </fieldset>\n );\n}\n\nfunction SendBy({ id, draft }: { id: string; draft: SendDraft }) {\n const tr = useTr();\n const chosen = draft.draft.channels;\n return (\n <div className=\"flex flex-col gap-1.5\">\n <span className=\"text-sm font-medium text-text-primary\" id={id}>\n {tr('notifications.v3.template.channel', 'Sent by')}\n </span>\n <div className=\"flex flex-wrap gap-2\" role=\"group\" aria-labelledby={id}>\n {SEND_CHANNELS.map((channel) => {\n const on = chosen.includes(channel);\n return (\n <Button\n key={channel}\n type=\"button\"\n size=\"sm\"\n variant={on ? 'secondary' : 'outline'}\n aria-pressed={on}\n onClick={() => draft.toggleChannel(channel)}\n data-testid={`send-by-${channel}`}\n >\n {on ? <Check aria-hidden=\"true\" /> : null}\n {channelWord(channel, tr)}\n </Button>\n );\n })}\n </div>\n </div>\n );\n}\n\nexport function MessageTab({ draft }: { draft: SendDraft }) {\n const tr = useTr();\n const id = useId();\n return (\n <div className=\"flex flex-col gap-4\">\n <StartFrom id={`${id}-start`} draft={draft} />\n <div className=\"flex flex-col gap-1.5\">\n <Label htmlFor={`${id}-title`}>{tr('notifications.v3.template.title', 'Title')}</Label>\n <Input\n id={`${id}-title`}\n value={draft.draft.title}\n placeholder={tr('notifications.v3.send.titlePlaceholder', 'What it’s about')}\n onChange={(event) => draft.setTitle(event.target.value)}\n data-testid=\"send-title\"\n />\n </div>\n <div className=\"flex flex-col gap-1.5\">\n <Label htmlFor={`${id}-message`}>\n {tr('notifications.v3.template.message', 'Message')}\n </Label>\n <Textarea\n id={`${id}-message`}\n rows={4}\n value={draft.draft.message}\n placeholder={tr('notifications.v3.send.messagePlaceholder', 'Write the message')}\n onChange={(event) => draft.setMessage(event.target.value)}\n data-testid=\"send-message\"\n />\n </div>\n <DetailValues id={`${id}-detail`} draft={draft} />\n <div className=\"grid grid-cols-2 gap-3 max-sm:grid-cols-1\">\n <div className=\"flex flex-col gap-1.5\">\n <Label htmlFor={`${id}-kind`}>{tr('notifications.v3.template.kind', 'About')}</Label>\n <ChoiceSelect\n id={`${id}-kind`}\n value={draft.draft.kind}\n options={TEMPLATE_KINDS}\n word={(option) => kindWord(option, tr)}\n onChange={draft.setKind}\n />\n </div>\n <SendBy id={`${id}-by`} draft={draft} />\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;AAgBA,IAAMA,IAAQ,SACRC,IAAkB,EAAE,SAAS,GAAK;AAExC,SAASC,EAAU,EAAE,OAAI,YAA2C;CAClE,IAAMC,IAAKC,EAAM,GACX,EAAE,iBAAcC,EAAyBJ,CAAe,GACxDK,IAAQ,IAAI,IAAIC,EAAU,KAAK,MAAa,CAACC,EAAS,IAAIA,EAAS,IAAI,CAAC,CAAC;CAC/E,OACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,kBAACC,GAAD;GAAO,SAASC;GAAK,UAAAP,EAAG,mCAAmC,YAAY;EAAS,CAAA,GAChF,kBAACQ,GAAD;GACM;GACJ,OAAOC,EAAM,cAAcZ;GAC3B,SAAS,CAACA,GAAO,GAAGO,EAAU,KAAK,MAAaC,EAAS,EAAE,CAAC;GAC5D,OAAO,MACLK,MAAWb,IACPG,EA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AK;KACxD,eAAY;IACb,CAAA,CACE;;GACL,kBAACV,GAAD;IAAc,IAAI,GAAGJ,EAAG;IAAiB;GAAQ,CAAA;GACjD,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACE,kBAACD,GAAD;MAAO,SAAS,GAAGC,EAAG;MAAS,UAAAP,EAAG,kCAAkC,OAAO;KAAS,CAAA,GACpF,kBAACQ,GAAD;MACE,IAAI,GAAGD,EAAG;MACV,OAAOE,EAAM,MAAM;MACnB,SAASwB;MACT,OAAO,MAAWC,EAASxB,GAAQV,CAAE;MACrC,UAAUS,EAAM;KACjB,CAAA,CACE;IACL,CAAA,GAAA,kBAACa,GAAD;KAAQ,IAAI,GAAGf,EAAG;KAAa;IAAQ,CAAA,CACpC;;EACF;;AAET"}
@@ -0,0 +1,4 @@
1
+ import { SendDraft } from './useSendDraft';
2
+ export declare function PeopleTab({ draft }: {
3
+ draft: SendDraft;
4
+ }): import('react').JSX.Element;