@adatechnology/notification-ui 0.1.0-rc.9 → 0.2.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/index.js CHANGED
@@ -9,6 +9,7 @@ import {
9
9
  flattenNotificationPages,
10
10
  formatNotificationTime,
11
11
  formatNotificationTimestamp,
12
+ isStandardEmailKey,
12
13
  resolveMessages,
13
14
  useCategoryPolicies,
14
15
  useDeactivateTemplate,
@@ -19,13 +20,14 @@ import {
19
20
  useNotificationStream,
20
21
  useNotifications,
21
22
  usePreferences,
23
+ useRestoreTemplateDefault,
22
24
  useTemplateEditor,
23
25
  useTemplateVariables,
24
26
  useTemplates,
25
27
  useUnreadCount,
26
28
  useUpdatePreferences,
27
29
  useUpsertTemplate
28
- } from "./chunk-7XDQ76IV.js";
30
+ } from "./chunk-SFMOFCHV.js";
29
31
 
30
32
  // src/components/NotificationBell.tsx
31
33
  import { Bell } from "lucide-react";
@@ -1145,7 +1147,10 @@ function NotificationSettingsWorkspace({
1145
1147
  label("settings.version"),
1146
1148
  template.version
1147
1149
  ] }),
1148
- /* @__PURE__ */ jsx10("td", { children: /* @__PURE__ */ jsxs10(
1150
+ /* @__PURE__ */ jsx10("td", { children: isStandardEmailKey(template.key) ? (
1151
+ /* Modelo do sistema não se remove: o servidor recusa e o envio depende dele. */
1152
+ /* @__PURE__ */ jsx10("span", { className: "adn-settings__badge", children: label("settings.systemTemplate") })
1153
+ ) : /* @__PURE__ */ jsxs10(
1149
1154
  "button",
1150
1155
  {
1151
1156
  type: "button",
@@ -1193,7 +1198,7 @@ function NotificationSettingsWorkspace({
1193
1198
  ]
1194
1199
  }
1195
1200
  ),
1196
- /* @__PURE__ */ jsxs10(
1201
+ isStandardEmailKey(template.key) ? /* @__PURE__ */ jsx10("span", { className: "adn-settings__badge", children: label("settings.systemTemplate") }) : /* @__PURE__ */ jsxs10(
1197
1202
  "button",
1198
1203
  {
1199
1204
  type: "button",
@@ -1213,7 +1218,10 @@ function NotificationSettingsWorkspace({
1213
1218
  editor.draft && /* @__PURE__ */ jsx10("section", { className: "adn-settings__editor", children: /* @__PURE__ */ jsxs10(Fragment2, { children: [
1214
1219
  /* @__PURE__ */ jsxs10("header", { className: "adn-settings__editor-header", children: [
1215
1220
  /* @__PURE__ */ jsxs10("div", { children: [
1216
- /* @__PURE__ */ jsx10("h2", { className: "adn-settings__section-title", children: editor.selected ? templateLabelOf?.(editor.selected) ?? editor.selected.key : "" }),
1221
+ /* @__PURE__ */ jsxs10("h2", { className: "adn-settings__section-title", children: [
1222
+ editor.selected ? templateLabelOf?.(editor.selected) ?? editor.selected.key : "",
1223
+ editor.isStandardEmail && /* @__PURE__ */ jsx10("span", { className: "adn-settings__badge", children: label("settings.systemTemplate") })
1224
+ ] }),
1217
1225
  /* @__PURE__ */ jsxs10("p", { className: "adn-settings__hint", children: [
1218
1226
  editor.draft.channels.join(" \xB7 "),
1219
1227
  " \xB7 ",
@@ -1225,6 +1233,16 @@ function NotificationSettingsWorkspace({
1225
1233
  ] }),
1226
1234
  /* @__PURE__ */ jsxs10("div", { className: "adn-settings__editor-actions", children: [
1227
1235
  editor.selected && renderEditorActions?.({ templateKey: editor.selected.key }),
1236
+ editor.isStandardEmail && editor.selected && /* @__PURE__ */ jsx10(
1237
+ "button",
1238
+ {
1239
+ type: "button",
1240
+ className: "adn-settings__restore",
1241
+ disabled: editor.isRestoring,
1242
+ onClick: () => editor.selected && editor.restoreDefault(editor.selected.id),
1243
+ children: editor.isRestoring ? label("settings.restoring") : label("settings.restoreDefault")
1244
+ }
1245
+ ),
1228
1246
  /* @__PURE__ */ jsxs10("button", { type: "button", className: "adn-settings__close", onClick: editor.clear, children: [
1229
1247
  /* @__PURE__ */ jsx10(X, { className: "adn-settings__button-icon", "aria-hidden": "true" }),
1230
1248
  label("settings.close")
@@ -1326,7 +1344,7 @@ function NotificationSettingsWorkspace({
1326
1344
  /* @__PURE__ */ jsx10("h3", { className: "adn-settings__preview-channel", children: channel.label }),
1327
1345
  channel.hint && /* @__PURE__ */ jsx10("span", { className: "adn-settings__hint", children: channel.hint })
1328
1346
  ] }),
1329
- /* @__PURE__ */ jsxs10("label", { className: "adn-settings__field", children: [
1347
+ editor.isStandardEmail ? /* @__PURE__ */ jsx10("p", { className: "adn-settings__hint", children: label("settings.standardEmailHint") }) : /* @__PURE__ */ jsxs10("label", { className: "adn-settings__field", children: [
1330
1348
  /* @__PURE__ */ jsx10("span", { className: "adn-settings__field-label", children: label("settings.subject") }),
1331
1349
  /* @__PURE__ */ jsx10("span", { className: "adn-settings__hint", children: label("settings.subjectHint") }),
1332
1350
  /* @__PURE__ */ jsx10(
@@ -1348,7 +1366,7 @@ function NotificationSettingsWorkspace({
1348
1366
  onChange: (next) => editor.updateChannel(channel.id, { body: next }),
1349
1367
  onSelect: (cursorIndex) => rememberCursor("body", cursorIndex),
1350
1368
  onFocus: () => setCursorChannel(channel.id),
1351
- ...validateEmailHtml ? { problems: validateEmailHtml(content?.body ?? "").problems } : {}
1369
+ ...validateEmailHtml && !editor.isStandardEmail ? { problems: validateEmailHtml(content?.body ?? "").problems } : {}
1352
1370
  }
1353
1371
  ) : /* @__PURE__ */ jsx10(
1354
1372
  MessageBodyField,
@@ -1361,6 +1379,18 @@ function NotificationSettingsWorkspace({
1361
1379
  }
1362
1380
  )
1363
1381
  ] }),
1382
+ editor.isStandardEmail && editor.standardAssessment && !editor.standardAssessment.usable && /* @__PURE__ */ jsxs10("ul", { className: "adn-settings__email-report", role: "alert", children: [
1383
+ editor.standardAssessment.missing.length > 0 && /* @__PURE__ */ jsxs10("li", { className: "adn-settings__email-problem adn-settings__email-problem--error", children: [
1384
+ label("settings.standardMissing"),
1385
+ " ",
1386
+ editor.standardAssessment.missing.map((name) => `{{${name}}}`).join(", ")
1387
+ ] }),
1388
+ editor.standardAssessment.unsafe.length > 0 && /* @__PURE__ */ jsxs10("li", { className: "adn-settings__email-problem adn-settings__email-problem--error", children: [
1389
+ label("settings.standardUnsafe"),
1390
+ " ",
1391
+ editor.standardAssessment.unsafe.map((rule) => label(`settings.standardUnsafe.${rule}`)).join(", ")
1392
+ ] })
1393
+ ] }),
1364
1394
  renderChannelFields?.({
1365
1395
  channel: channel.id,
1366
1396
  value: content?.whatsappTemplateName ?? "",
@@ -1386,7 +1416,7 @@ function NotificationSettingsWorkspace({
1386
1416
  channel: frame.channel,
1387
1417
  viewport: frame.viewport,
1388
1418
  rendered: frame.rendered,
1389
- ...frame.channel === "email" && isHtmlBody(content?.body ?? "") ? { emailHtml: content?.body ?? "" } : {},
1419
+ ...frame.channel === "email" && editor.standardPreviewHtml !== void 0 ? { emailHtml: editor.standardPreviewHtml } : frame.channel === "email" && !editor.isStandardEmail && isHtmlBody(content?.body ?? "") ? { emailHtml: content?.body ?? "" } : {},
1390
1420
  labels: {
1391
1421
  to: label("preview.to"),
1392
1422
  now: label("preview.now"),
@@ -1466,6 +1496,7 @@ export {
1466
1496
  useNotificationStream,
1467
1497
  useNotifications,
1468
1498
  usePreferences,
1499
+ useRestoreTemplateDefault,
1469
1500
  useTemplateEditor,
1470
1501
  useTemplateVariables,
1471
1502
  useTemplates,