@oondemand/oon-core-front 0.4.29 → 0.4.30

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
@@ -5090,9 +5090,9 @@ function CorePage2({ page, registry }) {
5090
5090
 
5091
5091
  // src/components/CoreTransactionalEmail.tsx
5092
5092
  import { useEffect as useEffect11, useMemo as useMemo11, useState as useState18 } from "react";
5093
- import { Badge as Badge5, Box as Box22, Button as Button16, Flex as Flex15, Heading as Heading13, Input as Input10, Stack as Stack9, Text as Text23, Textarea as Textarea3 } from "@chakra-ui/react";
5093
+ import { Badge as Badge5, Box as Box22, Button as Button16, Flex as Flex15, Heading as Heading13, IconButton as IconButton3, Input as Input10, Stack as Stack9, Text as Text23, Textarea as Textarea3 } from "@chakra-ui/react";
5094
5094
  import { useMutation as useMutation5, useQuery as useQuery11, useQueryClient as useQueryClient7 } from "@tanstack/react-query";
5095
- import { jsx as jsx31, jsxs as jsxs23 } from "react/jsx-runtime";
5095
+ import { Fragment as Fragment5, jsx as jsx31, jsxs as jsxs23 } from "react/jsx-runtime";
5096
5096
  var EMPTY_SCHEMA = '{\n "type": "object",\n "additionalProperties": false,\n "properties": {}\n}';
5097
5097
  var EMPTY_DRAFT = {
5098
5098
  code: "",
@@ -5155,6 +5155,9 @@ function CoreTransactionalEmail() {
5155
5155
  const [previewVariables, setPreviewVariables] = useState18("{}");
5156
5156
  const [testTarget, setTestTarget] = useState18(null);
5157
5157
  const [templateTest, setTemplateTest] = useState18({ to: "", variables: "{}" });
5158
+ const [templateModalOpen, setTemplateModalOpen] = useState18(false);
5159
+ const [templateModalTab, setTemplateModalTab] = useState18("versions");
5160
+ const [managedTemplateCode, setManagedTemplateCode] = useState18("");
5158
5161
  const health = useQuery11({
5159
5162
  queryKey: ["transactional-email", "health"],
5160
5163
  queryFn: async () => (await http.get("/core/transactional-email/health")).data
@@ -5199,6 +5202,12 @@ function CoreTransactionalEmail() {
5199
5202
  for (const item of templates.data || []) (groups[_a = item.code] || (groups[_a] = [])).push(item);
5200
5203
  return Object.entries(groups);
5201
5204
  }, [templates.data]);
5205
+ const managedVersions = useMemo11(
5206
+ () => (templates.data || []).filter((item) => item.code === managedTemplateCode),
5207
+ [managedTemplateCode, templates.data]
5208
+ );
5209
+ const managedTemplate = managedVersions.find((item) => item.status === "active") || managedVersions[0] || null;
5210
+ const draftContext = !managedTemplateCode || Boolean(editingBase);
5202
5211
  const saveConfiguration = useMutation5({
5203
5212
  mutationFn: async () => {
5204
5213
  const payload = {
@@ -5250,6 +5259,7 @@ function CoreTransactionalEmail() {
5250
5259
  setNotice("Nova vers\xE3o salva como rascunho. Ela ainda n\xE3o est\xE1 ativa.");
5251
5260
  setEditingBase(null);
5252
5261
  setTemplateDraft(EMPTY_DRAFT);
5262
+ setTemplateModalOpen(false);
5253
5263
  cache.invalidateQueries({ queryKey: ["transactional-email", "templates"] });
5254
5264
  },
5255
5265
  onError: (reason) => {
@@ -5315,6 +5325,7 @@ function CoreTransactionalEmail() {
5315
5325
  });
5316
5326
  function useAsBase(item) {
5317
5327
  setEditingBase(item);
5328
+ setManagedTemplateCode(item.code);
5318
5329
  setTemplateDraft({
5319
5330
  code: item.code,
5320
5331
  name: item.name,
@@ -5324,13 +5335,59 @@ function CoreTransactionalEmail() {
5324
5335
  variablesSchema: JSON.stringify(item.variablesSchema || {}, null, 2),
5325
5336
  locale: item.locale || "pt-BR"
5326
5337
  });
5338
+ setPreviewVariables(sampleVariables(item.variablesSchema));
5339
+ setPreviewTarget(null);
5340
+ preview.reset();
5341
+ setTemplateModalTab("content");
5342
+ setTemplateModalOpen(true);
5327
5343
  setNotice("Vers\xE3o " + item.version + " carregada como base. Ao salvar, uma nova vers\xE3o em rascunho ser\xE1 criada.");
5328
5344
  setError("");
5329
5345
  }
5346
+ function openNewTemplate() {
5347
+ setManagedTemplateCode("");
5348
+ setEditingBase(null);
5349
+ setTemplateDraft(EMPTY_DRAFT);
5350
+ setPreviewTarget(null);
5351
+ setTestTarget(null);
5352
+ setPreviewVariables("{}");
5353
+ setTemplateTest({ to: config?.senderEmail || "", variables: "{}" });
5354
+ preview.reset();
5355
+ setError("");
5356
+ setNotice("");
5357
+ setTemplateModalTab("content");
5358
+ setTemplateModalOpen(true);
5359
+ }
5360
+ function manageTemplate(code) {
5361
+ const versions = (templates.data || []).filter((item) => item.code === code);
5362
+ const target = versions.find((item) => item.status === "active") || versions[0] || null;
5363
+ setManagedTemplateCode(code);
5364
+ setEditingBase(null);
5365
+ setTemplateDraft(EMPTY_DRAFT);
5366
+ setPreviewTarget(target);
5367
+ setTestTarget(target);
5368
+ setPreviewVariables(sampleVariables(target?.variablesSchema));
5369
+ setTemplateTest({
5370
+ to: config?.senderEmail || "",
5371
+ variables: sampleVariables(target?.variablesSchema)
5372
+ });
5373
+ preview.reset();
5374
+ setError("");
5375
+ setNotice("");
5376
+ setTemplateModalTab("versions");
5377
+ setTemplateModalOpen(true);
5378
+ }
5379
+ function closeTemplateModal() {
5380
+ setTemplateModalOpen(false);
5381
+ setError("");
5382
+ preview.reset();
5383
+ }
5330
5384
  function selectPreview(item) {
5385
+ setManagedTemplateCode(item.code);
5331
5386
  setPreviewTarget(item);
5332
5387
  setPreviewVariables(sampleVariables(item.variablesSchema));
5333
5388
  preview.reset();
5389
+ setTemplateModalTab("preview");
5390
+ setTemplateModalOpen(true);
5334
5391
  setError("");
5335
5392
  setNotice("");
5336
5393
  }
@@ -5364,14 +5421,30 @@ function CoreTransactionalEmail() {
5364
5421
  }
5365
5422
  }
5366
5423
  function selectTest(item) {
5424
+ setManagedTemplateCode(item.code);
5367
5425
  setTestTarget(item);
5368
5426
  setTemplateTest((value3) => ({
5369
5427
  to: value3.to || config?.senderEmail || "",
5370
5428
  variables: sampleVariables(item.variablesSchema)
5371
5429
  }));
5430
+ setTemplateModalTab("test");
5431
+ setTemplateModalOpen(true);
5372
5432
  setError("");
5373
5433
  setNotice("");
5374
5434
  }
5435
+ useEffect11(() => {
5436
+ if (!templateModalOpen) return void 0;
5437
+ const previousOverflow = document.body.style.overflow;
5438
+ const onKeyDown = (event) => {
5439
+ if (event.key === "Escape") closeTemplateModal();
5440
+ };
5441
+ document.body.style.overflow = "hidden";
5442
+ document.addEventListener("keydown", onKeyDown);
5443
+ return () => {
5444
+ document.body.style.overflow = previousOverflow;
5445
+ document.removeEventListener("keydown", onKeyDown);
5446
+ };
5447
+ }, [templateModalOpen]);
5375
5448
  function activateVersion(item) {
5376
5449
  const confirmed = window.confirm(
5377
5450
  "Ativar " + item.code + " v" + item.version + "? A vers\xE3o ativa atual ser\xE1 arquivada."
@@ -5507,44 +5580,48 @@ function CoreTransactionalEmail() {
5507
5580
  ] })
5508
5581
  ] })
5509
5582
  ] }) : null,
5510
- tab === "templates" ? /* @__PURE__ */ jsxs23(Stack9, { gap: 5, children: [
5511
- /* @__PURE__ */ jsxs23(Box22, { borderWidth: "1px", borderRadius: "lg", p: { base: 4, md: 5 }, children: [
5512
- /* @__PURE__ */ jsxs23(Flex15, { justify: "space-between", align: "start", gap: 3, wrap: "wrap", mb: 4, children: [
5513
- /* @__PURE__ */ jsxs23(Box22, { children: [
5514
- /* @__PURE__ */ jsx31(Heading13, { size: "sm", children: "Templates e vers\xF5es" }),
5515
- /* @__PURE__ */ jsx31(Text23, { fontSize: "sm", color: "gray.600", children: "Visualize, use uma vers\xE3o como base ou envie um teste sem alterar a publica\xE7\xE3o atual." })
5516
- ] }),
5517
- /* @__PURE__ */ jsx31(
5518
- Button16,
5519
- {
5520
- size: "sm",
5521
- variant: "outline",
5522
- onClick: () => {
5523
- setEditingBase(null);
5524
- setTemplateDraft(EMPTY_DRAFT);
5525
- setNotice("");
5526
- },
5527
- children: "Novo template"
5528
- }
5529
- )
5583
+ tab === "templates" ? /* @__PURE__ */ jsxs23(Box22, { borderWidth: "1px", borderRadius: "lg", p: { base: 4, md: 5 }, children: [
5584
+ /* @__PURE__ */ jsxs23(Flex15, { justify: "space-between", align: "start", gap: 3, wrap: "wrap", mb: 4, children: [
5585
+ /* @__PURE__ */ jsxs23(Box22, { children: [
5586
+ /* @__PURE__ */ jsx31(Heading13, { size: "sm", children: "Templates e vers\xF5es" }),
5587
+ /* @__PURE__ */ jsx31(Text23, { fontSize: "sm", color: "gray.600", children: "Consulte o hist\xF3rico e abra o gerenciamento completo sem sair da lista." })
5530
5588
  ] }),
5531
- /* @__PURE__ */ jsxs23(Stack9, { gap: 4, children: [
5532
- groupedTemplates.map(([code, versions]) => /* @__PURE__ */ jsxs23(Box22, { borderWidth: "1px", borderRadius: "md", overflow: "hidden", children: [
5533
- /* @__PURE__ */ jsxs23(Flex15, { px: 4, py: 3, bg: "gray.50", justify: "space-between", align: "center", gap: 3, wrap: "wrap", children: [
5534
- /* @__PURE__ */ jsxs23(Box22, { children: [
5535
- /* @__PURE__ */ jsx31(Text23, { fontWeight: "bold", children: versions[0]?.name || code }),
5536
- /* @__PURE__ */ jsxs23(Text23, { fontSize: "xs", color: "gray.600", children: [
5537
- code,
5538
- " \xB7 ",
5539
- versions.length,
5540
- " vers\xE3o(\xF5es)"
5541
- ] })
5542
- ] }),
5543
- versions.find((item) => item.status === "active") ? /* @__PURE__ */ jsxs23(Badge5, { colorPalette: "green", children: [
5544
- "ativa v",
5545
- versions.find((item) => item.status === "active")?.version
5546
- ] }) : /* @__PURE__ */ jsx31(Badge5, { colorPalette: "yellow", children: "sem vers\xE3o ativa" })
5547
- ] }),
5589
+ /* @__PURE__ */ jsx31(Button16, { size: "sm", variant: "outline", onClick: openNewTemplate, children: "Novo template" })
5590
+ ] }),
5591
+ /* @__PURE__ */ jsxs23(Stack9, { gap: 4, children: [
5592
+ groupedTemplates.map(([code, versions]) => {
5593
+ const activeVersion = versions.find((item) => item.status === "active");
5594
+ return /* @__PURE__ */ jsxs23(Box22, { borderWidth: "1px", borderRadius: "md", overflow: "hidden", children: [
5595
+ /* @__PURE__ */ jsxs23(
5596
+ Flex15,
5597
+ {
5598
+ px: 4,
5599
+ py: 3,
5600
+ bg: "gray.50",
5601
+ justify: "space-between",
5602
+ align: "center",
5603
+ gap: 3,
5604
+ wrap: "wrap",
5605
+ children: [
5606
+ /* @__PURE__ */ jsxs23(Box22, { children: [
5607
+ /* @__PURE__ */ jsx31(Text23, { fontWeight: "bold", children: versions[0]?.name || code }),
5608
+ /* @__PURE__ */ jsxs23(Text23, { fontSize: "xs", color: "gray.600", children: [
5609
+ code,
5610
+ " \xB7 ",
5611
+ versions.length,
5612
+ " vers\xE3o(\xF5es)"
5613
+ ] })
5614
+ ] }),
5615
+ /* @__PURE__ */ jsxs23(Flex15, { gap: 2, align: "center", wrap: "wrap", children: [
5616
+ activeVersion ? /* @__PURE__ */ jsxs23(Badge5, { colorPalette: "green", children: [
5617
+ "ativa v",
5618
+ activeVersion.version
5619
+ ] }) : /* @__PURE__ */ jsx31(Badge5, { colorPalette: "yellow", children: "sem vers\xE3o ativa" }),
5620
+ /* @__PURE__ */ jsx31(Button16, { size: "sm", onClick: () => manageTemplate(code), children: "Gerenciar" })
5621
+ ] })
5622
+ ]
5623
+ }
5624
+ ),
5548
5625
  /* @__PURE__ */ jsx31(Stack9, { gap: 0, children: versions.map((item) => /* @__PURE__ */ jsxs23(
5549
5626
  Flex15,
5550
5627
  {
@@ -5568,237 +5645,408 @@ function CoreTransactionalEmail() {
5568
5645
  /* @__PURE__ */ jsx31(Text23, { mt: 1, fontSize: "sm", color: "gray.700", children: item.subject }),
5569
5646
  /* @__PURE__ */ jsx31(Text23, { fontSize: "xs", color: "gray.500", children: prettyDate(item.createdAt) })
5570
5647
  ] }),
5571
- /* @__PURE__ */ jsxs23(Flex15, { gap: 2, wrap: "wrap", children: [
5572
- /* @__PURE__ */ jsx31(Button16, { size: "xs", variant: "outline", onClick: () => selectPreview(item), children: "Visualizar" }),
5573
- /* @__PURE__ */ jsx31(Button16, { size: "xs", variant: "outline", onClick: () => useAsBase(item), children: "Usar como base" }),
5574
- /* @__PURE__ */ jsx31(Button16, { size: "xs", variant: "outline", onClick: () => selectTest(item), children: "Enviar teste" }),
5575
- item.status !== "active" ? /* @__PURE__ */ jsx31(
5576
- Button16,
5577
- {
5578
- size: "xs",
5579
- loading: activate.isPending,
5580
- onClick: () => activateVersion(item),
5581
- children: "Ativar vers\xE3o"
5582
- }
5583
- ) : null
5584
- ] })
5648
+ /* @__PURE__ */ jsx31(Button16, { size: "xs", variant: "outline", onClick: () => selectPreview(item), children: "Abrir vers\xE3o" })
5585
5649
  ]
5586
5650
  },
5587
5651
  item._id
5588
5652
  )) })
5589
- ] }, code)),
5590
- !templates.isLoading && !templates.data?.length ? /* @__PURE__ */ jsx31(Text23, { children: "Nenhum template declarado." }) : null
5591
- ] })
5592
- ] }),
5593
- /* @__PURE__ */ jsxs23(Box22, { borderWidth: "1px", borderRadius: "lg", p: { base: 4, md: 5 }, children: [
5594
- /* @__PURE__ */ jsxs23(Flex15, { justify: "space-between", gap: 3, align: "start", wrap: "wrap", mb: 4, children: [
5595
- /* @__PURE__ */ jsxs23(Box22, { children: [
5596
- /* @__PURE__ */ jsx31(Heading13, { size: "sm", children: editingBase ? "Nova vers\xE3o a partir de " + editingBase.code + " v" + editingBase.version : "Nova vers\xE3o em rascunho" }),
5597
- /* @__PURE__ */ jsx31(Text23, { fontSize: "sm", color: "gray.600", children: "Salvar sempre cria uma nova vers\xE3o e nunca a ativa automaticamente." })
5598
- ] }),
5599
- editingBase ? /* @__PURE__ */ jsx31(Button16, { size: "sm", variant: "ghost", onClick: () => {
5600
- setEditingBase(null);
5601
- setTemplateDraft(EMPTY_DRAFT);
5602
- }, children: "Cancelar edi\xE7\xE3o" }) : null
5603
- ] }),
5604
- /* @__PURE__ */ jsxs23(Stack9, { gap: 3, children: [
5605
- /* @__PURE__ */ jsxs23(Flex15, { gap: 3, wrap: "wrap", children: [
5606
- /* @__PURE__ */ jsxs23(Box22, { flex: "1", minW: "180px", children: [
5607
- /* @__PURE__ */ jsx31("label", { htmlFor: "template-code", style: { fontSize: "0.875rem", fontWeight: 600 }, children: "C\xF3digo" }),
5608
- /* @__PURE__ */ jsx31(
5609
- Input10,
5653
+ ] }, code);
5654
+ }),
5655
+ !templates.isLoading && !templates.data?.length ? /* @__PURE__ */ jsx31(Text23, { children: "Nenhum template declarado." }) : null
5656
+ ] })
5657
+ ] }) : null,
5658
+ templateModalOpen ? /* @__PURE__ */ jsx31(
5659
+ Flex15,
5660
+ {
5661
+ position: "fixed",
5662
+ inset: 0,
5663
+ zIndex: 1200,
5664
+ align: "center",
5665
+ justify: "center",
5666
+ p: { base: 2, md: 4 },
5667
+ bg: "rgba(15,23,42,.55)",
5668
+ children: /* @__PURE__ */ jsxs23(
5669
+ Box22,
5670
+ {
5671
+ role: "dialog",
5672
+ "aria-modal": "true",
5673
+ "aria-labelledby": "transactional-template-modal-title",
5674
+ display: "flex",
5675
+ flexDirection: "column",
5676
+ w: "min(1180px, 96vw)",
5677
+ h: "min(900px, 92vh)",
5678
+ maxH: "92vh",
5679
+ overflow: "hidden",
5680
+ bg: "white",
5681
+ borderRadius: "14px",
5682
+ boxShadow: "0 24px 70px rgba(15,23,42,.28)",
5683
+ children: [
5684
+ /* @__PURE__ */ jsxs23(
5685
+ Flex15,
5610
5686
  {
5611
- id: "template-code",
5612
- mt: 1,
5613
- disabled: Boolean(editingBase),
5614
- value: templateDraft.code,
5615
- onChange: (event) => setTemplateDraft({ ...templateDraft, code: event.target.value })
5687
+ minH: "72px",
5688
+ px: { base: 4, md: 5 },
5689
+ py: 3,
5690
+ align: "center",
5691
+ justify: "space-between",
5692
+ gap: 4,
5693
+ borderBottomWidth: "1px",
5694
+ borderColor: "gray.200",
5695
+ children: [
5696
+ /* @__PURE__ */ jsxs23(Box22, { minW: 0, children: [
5697
+ /* @__PURE__ */ jsx31(Text23, { color: "#0474AF", fontSize: "10px", fontWeight: "700", textTransform: "uppercase", children: "Template transacional" }),
5698
+ /* @__PURE__ */ jsx31(Heading13, { id: "transactional-template-modal-title", size: "md", lineClamp: 1, children: !managedTemplateCode ? "Novo template" : editingBase ? "Nova vers\xE3o de " + editingBase.name : managedTemplate?.name || managedTemplateCode }),
5699
+ managedTemplateCode ? /* @__PURE__ */ jsxs23(Text23, { fontSize: "xs", color: "gray.600", children: [
5700
+ managedTemplateCode,
5701
+ editingBase ? " \xB7 base v" + editingBase.version : ""
5702
+ ] }) : null
5703
+ ] }),
5704
+ /* @__PURE__ */ jsx31(
5705
+ IconButton3,
5706
+ {
5707
+ "aria-label": "Fechar gerenciamento do template",
5708
+ title: "Fechar",
5709
+ size: "sm",
5710
+ minW: "32px",
5711
+ h: "32px",
5712
+ borderRadius: "full",
5713
+ variant: "ghost",
5714
+ fontSize: "21px",
5715
+ onClick: closeTemplateModal,
5716
+ children: "\xD7"
5717
+ }
5718
+ )
5719
+ ]
5616
5720
  }
5617
- )
5618
- ] }),
5619
- /* @__PURE__ */ jsxs23(Box22, { flex: "2", minW: "220px", children: [
5620
- /* @__PURE__ */ jsx31("label", { htmlFor: "template-name", style: { fontSize: "0.875rem", fontWeight: 600 }, children: "Nome" }),
5721
+ ),
5621
5722
  /* @__PURE__ */ jsx31(
5622
- Input10,
5723
+ Flex15,
5623
5724
  {
5624
- id: "template-name",
5625
- mt: 1,
5626
- value: templateDraft.name,
5627
- onChange: (event) => setTemplateDraft({ ...templateDraft, name: event.target.value })
5725
+ flex: "0 0 auto",
5726
+ gap: 2,
5727
+ px: { base: 3, md: 5 },
5728
+ pt: 3,
5729
+ borderBottomWidth: "1px",
5730
+ borderColor: "gray.200",
5731
+ overflowX: "auto",
5732
+ children: [
5733
+ ["versions", "Vers\xF5es"],
5734
+ ["content", "Conte\xFAdo"],
5735
+ ["variables", "Vari\xE1veis"],
5736
+ ["preview", "Pr\xE9via"],
5737
+ ["test", "Teste"]
5738
+ ].map(([id, label]) => /* @__PURE__ */ jsx31(
5739
+ Button16,
5740
+ {
5741
+ type: "button",
5742
+ size: "sm",
5743
+ flex: "0 0 auto",
5744
+ variant: templateModalTab === id ? "solid" : "ghost",
5745
+ disabled: id === "versions" && !managedTemplateCode,
5746
+ onClick: () => {
5747
+ setTemplateModalTab(id);
5748
+ setError("");
5749
+ },
5750
+ children: label
5751
+ },
5752
+ id
5753
+ ))
5628
5754
  }
5629
- )
5630
- ] })
5631
- ] }),
5632
- /* @__PURE__ */ jsxs23(Box22, { children: [
5633
- /* @__PURE__ */ jsx31("label", { htmlFor: "template-subject", style: { fontSize: "0.875rem", fontWeight: 600 }, children: "Assunto Handlebars" }),
5634
- /* @__PURE__ */ jsx31(
5635
- Input10,
5636
- {
5637
- id: "template-subject",
5638
- mt: 1,
5639
- value: templateDraft.subject,
5640
- onChange: (event) => setTemplateDraft({ ...templateDraft, subject: event.target.value })
5641
- }
5642
- )
5643
- ] }),
5644
- /* @__PURE__ */ jsxs23(Box22, { children: [
5645
- /* @__PURE__ */ jsx31("label", { htmlFor: "template-html", style: { fontSize: "0.875rem", fontWeight: 600 }, children: "HTML" }),
5646
- /* @__PURE__ */ jsx31(
5647
- Textarea3,
5648
- {
5649
- id: "template-html",
5650
- mt: 1,
5651
- minH: "240px",
5652
- fontFamily: "mono",
5653
- value: templateDraft.htmlContent,
5654
- onChange: (event) => setTemplateDraft({ ...templateDraft, htmlContent: event.target.value })
5655
- }
5656
- ),
5657
- /* @__PURE__ */ jsx31(Text23, { fontSize: "xs", color: "gray.600", children: "Imagens embutidas com data:image/*;base64 s\xE3o aceitas; URLs remotas continuam bloqueadas." })
5658
- ] }),
5659
- /* @__PURE__ */ jsxs23(Box22, { children: [
5660
- /* @__PURE__ */ jsx31("label", { htmlFor: "template-text", style: { fontSize: "0.875rem", fontWeight: 600 }, children: "Texto simples" }),
5661
- /* @__PURE__ */ jsx31(
5662
- Textarea3,
5663
- {
5664
- id: "template-text",
5665
- mt: 1,
5666
- minH: "120px",
5667
- value: templateDraft.textContent,
5668
- onChange: (event) => setTemplateDraft({ ...templateDraft, textContent: event.target.value })
5669
- }
5670
- )
5671
- ] }),
5672
- /* @__PURE__ */ jsxs23(Box22, { children: [
5673
- /* @__PURE__ */ jsx31("label", { htmlFor: "template-schema", style: { fontSize: "0.875rem", fontWeight: 600 }, children: "JSON Schema das vari\xE1veis" }),
5674
- /* @__PURE__ */ jsx31(
5675
- Textarea3,
5676
- {
5677
- id: "template-schema",
5678
- mt: 1,
5679
- minH: "180px",
5680
- fontFamily: "mono",
5681
- value: templateDraft.variablesSchema,
5682
- onChange: (event) => setTemplateDraft({ ...templateDraft, variablesSchema: event.target.value })
5683
- }
5684
- )
5685
- ] }),
5686
- /* @__PURE__ */ jsxs23(Flex15, { gap: 2, wrap: "wrap", children: [
5687
- /* @__PURE__ */ jsx31(
5688
- Button16,
5689
- {
5690
- loading: createVersion.isPending,
5691
- onClick: () => {
5692
- try {
5693
- parseObject(templateDraft.variablesSchema, "JSON Schema inv\xE1lido.");
5694
- createVersion.mutate();
5695
- } catch (reason) {
5696
- setError(errorMessage(reason));
5697
- }
5698
- },
5699
- children: "Salvar nova vers\xE3o"
5700
- }
5701
- ),
5702
- /* @__PURE__ */ jsx31(
5703
- Button16,
5704
- {
5705
- variant: "outline",
5706
- loading: preview.isPending,
5707
- disabled: !templateDraft.code,
5708
- onClick: renderDraftPreview,
5709
- children: "Pr\xE9-visualizar rascunho"
5710
- }
5711
- )
5712
- ] })
5713
- ] })
5714
- ] }),
5715
- /* @__PURE__ */ jsxs23(Box22, { borderWidth: "1px", borderRadius: "lg", p: { base: 4, md: 5 }, children: [
5716
- /* @__PURE__ */ jsx31(Heading13, { size: "sm", children: "Pr\xE9-visualiza\xE7\xE3o" }),
5717
- /* @__PURE__ */ jsx31(Text23, { fontSize: "sm", color: "gray.600", mb: 4, children: previewTarget ? previewTarget.code + " \xB7 vers\xE3o " + previewTarget.version : "Pr\xE9via do conte\xFAdo em edi\xE7\xE3o" }),
5718
- /* @__PURE__ */ jsxs23(Stack9, { gap: 3, children: [
5719
- /* @__PURE__ */ jsxs23(Box22, { children: [
5720
- /* @__PURE__ */ jsx31("label", { htmlFor: "preview-variables", style: { fontSize: "0.875rem", fontWeight: 600 }, children: "Vari\xE1veis de exemplo" }),
5721
- /* @__PURE__ */ jsx31(
5722
- Textarea3,
5723
- {
5724
- id: "preview-variables",
5725
- mt: 1,
5726
- minH: "120px",
5727
- fontFamily: "mono",
5728
- value: previewVariables,
5729
- onChange: (event) => setPreviewVariables(event.target.value)
5730
- }
5731
- )
5732
- ] }),
5733
- previewTarget ? /* @__PURE__ */ jsx31(Button16, { alignSelf: "start", variant: "outline", loading: preview.isPending, onClick: renderSavedPreview, children: "Atualizar pr\xE9via" }) : null,
5734
- preview.data ? /* @__PURE__ */ jsxs23(Stack9, { gap: 3, children: [
5735
- /* @__PURE__ */ jsxs23(Box22, { bg: "gray.50", borderWidth: "1px", borderRadius: "md", p: 3, children: [
5736
- /* @__PURE__ */ jsx31(Text23, { fontSize: "xs", color: "gray.600", children: "Assunto renderizado" }),
5737
- /* @__PURE__ */ jsx31(Text23, { fontWeight: "semibold", children: preview.data.subject })
5738
- ] }),
5739
- /* @__PURE__ */ jsxs23(Box22, { children: [
5740
- /* @__PURE__ */ jsx31(Text23, { fontSize: "sm", fontWeight: "semibold", mb: 1, children: "HTML" }),
5741
- /* @__PURE__ */ jsx31(
5742
- "iframe",
5755
+ ),
5756
+ /* @__PURE__ */ jsxs23(Box22, { flex: "1", minH: 0, overflowY: "auto", p: { base: 4, md: 5 }, children: [
5757
+ error ? /* @__PURE__ */ jsx31(Box22, { role: "alert", mb: 4, borderWidth: "1px", borderColor: "red.200", bg: "red.50", p: 3, borderRadius: "md", children: /* @__PURE__ */ jsx31(Text23, { color: "red.700", children: error }) }) : null,
5758
+ notice ? /* @__PURE__ */ jsx31(Box22, { role: "status", mb: 4, borderWidth: "1px", borderColor: "green.200", bg: "green.50", p: 3, borderRadius: "md", children: /* @__PURE__ */ jsx31(Text23, { color: "green.800", children: notice }) }) : null,
5759
+ templateModalTab === "versions" ? /* @__PURE__ */ jsxs23(Stack9, { gap: 3, children: [
5760
+ /* @__PURE__ */ jsxs23(Box22, { children: [
5761
+ /* @__PURE__ */ jsx31(Heading13, { size: "sm", children: "Hist\xF3rico de vers\xF5es" }),
5762
+ /* @__PURE__ */ jsx31(Text23, { fontSize: "sm", color: "gray.600", children: "Escolha a vers\xE3o que deseja revisar, testar ou usar como base." })
5763
+ ] }),
5764
+ managedVersions.map((item) => /* @__PURE__ */ jsx31(Box22, { borderWidth: "1px", borderRadius: "md", p: 4, children: /* @__PURE__ */ jsxs23(Flex15, { justify: "space-between", align: "start", gap: 3, wrap: "wrap", children: [
5765
+ /* @__PURE__ */ jsxs23(Box22, { flex: "1", minW: "220px", children: [
5766
+ /* @__PURE__ */ jsxs23(Flex15, { gap: 2, align: "center", wrap: "wrap", children: [
5767
+ /* @__PURE__ */ jsxs23(Text23, { fontWeight: "bold", children: [
5768
+ "Vers\xE3o ",
5769
+ item.version
5770
+ ] }),
5771
+ /* @__PURE__ */ jsx31(Badge5, { colorPalette: color(item.status), children: item.status }),
5772
+ /* @__PURE__ */ jsx31(Badge5, { variant: "outline", children: item.origin })
5773
+ ] }),
5774
+ /* @__PURE__ */ jsx31(Text23, { mt: 2, fontSize: "sm", children: item.subject }),
5775
+ /* @__PURE__ */ jsx31(Text23, { fontSize: "xs", color: "gray.500", children: prettyDate(item.createdAt) })
5776
+ ] }),
5777
+ /* @__PURE__ */ jsxs23(Flex15, { gap: 2, wrap: "wrap", children: [
5778
+ /* @__PURE__ */ jsx31(Button16, { size: "xs", variant: "outline", onClick: () => selectPreview(item), children: "Visualizar" }),
5779
+ /* @__PURE__ */ jsx31(Button16, { size: "xs", variant: "outline", onClick: () => useAsBase(item), children: "Editar como nova" }),
5780
+ /* @__PURE__ */ jsx31(Button16, { size: "xs", variant: "outline", onClick: () => selectTest(item), children: "Enviar teste" }),
5781
+ item.status !== "active" ? /* @__PURE__ */ jsx31(
5782
+ Button16,
5783
+ {
5784
+ size: "xs",
5785
+ loading: activate.isPending,
5786
+ onClick: () => activateVersion(item),
5787
+ children: "Ativar vers\xE3o"
5788
+ }
5789
+ ) : null
5790
+ ] })
5791
+ ] }) }, item._id))
5792
+ ] }) : null,
5793
+ templateModalTab === "content" ? draftContext ? /* @__PURE__ */ jsxs23(Stack9, { gap: 4, children: [
5794
+ /* @__PURE__ */ jsxs23(Box22, { children: [
5795
+ /* @__PURE__ */ jsx31(Heading13, { size: "sm", children: editingBase ? "Nova vers\xE3o a partir da v" + editingBase.version : "Conte\xFAdo do novo template" }),
5796
+ /* @__PURE__ */ jsx31(Text23, { fontSize: "sm", color: "gray.600", children: "O salvamento cria um rascunho e nunca altera a vers\xE3o ativa." })
5797
+ ] }),
5798
+ /* @__PURE__ */ jsxs23(Flex15, { gap: 3, wrap: "wrap", children: [
5799
+ /* @__PURE__ */ jsxs23(Box22, { flex: "1", minW: "180px", children: [
5800
+ /* @__PURE__ */ jsx31("label", { htmlFor: "template-code", style: { fontSize: "0.875rem", fontWeight: 600 }, children: "C\xF3digo" }),
5801
+ /* @__PURE__ */ jsx31(
5802
+ Input10,
5803
+ {
5804
+ id: "template-code",
5805
+ mt: 1,
5806
+ disabled: Boolean(editingBase),
5807
+ value: templateDraft.code,
5808
+ onChange: (event) => setTemplateDraft({ ...templateDraft, code: event.target.value })
5809
+ }
5810
+ )
5811
+ ] }),
5812
+ /* @__PURE__ */ jsxs23(Box22, { flex: "2", minW: "220px", children: [
5813
+ /* @__PURE__ */ jsx31("label", { htmlFor: "template-name", style: { fontSize: "0.875rem", fontWeight: 600 }, children: "Nome" }),
5814
+ /* @__PURE__ */ jsx31(
5815
+ Input10,
5816
+ {
5817
+ id: "template-name",
5818
+ mt: 1,
5819
+ value: templateDraft.name,
5820
+ onChange: (event) => setTemplateDraft({ ...templateDraft, name: event.target.value })
5821
+ }
5822
+ )
5823
+ ] })
5824
+ ] }),
5825
+ /* @__PURE__ */ jsxs23(Box22, { children: [
5826
+ /* @__PURE__ */ jsx31("label", { htmlFor: "template-subject", style: { fontSize: "0.875rem", fontWeight: 600 }, children: "Assunto Handlebars" }),
5827
+ /* @__PURE__ */ jsx31(
5828
+ Input10,
5829
+ {
5830
+ id: "template-subject",
5831
+ mt: 1,
5832
+ value: templateDraft.subject,
5833
+ onChange: (event) => setTemplateDraft({ ...templateDraft, subject: event.target.value })
5834
+ }
5835
+ )
5836
+ ] }),
5837
+ /* @__PURE__ */ jsxs23(Box22, { children: [
5838
+ /* @__PURE__ */ jsx31("label", { htmlFor: "template-html", style: { fontSize: "0.875rem", fontWeight: 600 }, children: "HTML" }),
5839
+ /* @__PURE__ */ jsx31(
5840
+ Textarea3,
5841
+ {
5842
+ id: "template-html",
5843
+ mt: 1,
5844
+ minH: "280px",
5845
+ fontFamily: "mono",
5846
+ value: templateDraft.htmlContent,
5847
+ onChange: (event) => setTemplateDraft({ ...templateDraft, htmlContent: event.target.value })
5848
+ }
5849
+ ),
5850
+ /* @__PURE__ */ jsx31(Text23, { fontSize: "xs", color: "gray.600", children: "Imagens data:image/*;base64 s\xE3o aceitas; URLs remotas continuam bloqueadas." })
5851
+ ] }),
5852
+ /* @__PURE__ */ jsxs23(Box22, { children: [
5853
+ /* @__PURE__ */ jsx31("label", { htmlFor: "template-text", style: { fontSize: "0.875rem", fontWeight: 600 }, children: "Texto simples" }),
5854
+ /* @__PURE__ */ jsx31(
5855
+ Textarea3,
5856
+ {
5857
+ id: "template-text",
5858
+ mt: 1,
5859
+ minH: "140px",
5860
+ value: templateDraft.textContent,
5861
+ onChange: (event) => setTemplateDraft({ ...templateDraft, textContent: event.target.value })
5862
+ }
5863
+ )
5864
+ ] })
5865
+ ] }) : /* @__PURE__ */ jsxs23(Stack9, { gap: 4, align: "start", children: [
5866
+ /* @__PURE__ */ jsx31(Heading13, { size: "sm", children: "Escolha uma vers\xE3o como base" }),
5867
+ /* @__PURE__ */ jsx31(Text23, { color: "gray.600", children: "Para proteger o hist\xF3rico, uma vers\xE3o publicada n\xE3o \xE9 alterada diretamente." }),
5868
+ managedTemplate ? /* @__PURE__ */ jsx31(Button16, { onClick: () => useAsBase(managedTemplate), children: "Editar a vers\xE3o ativa como nova" }) : null
5869
+ ] }) : null,
5870
+ templateModalTab === "variables" ? draftContext ? /* @__PURE__ */ jsxs23(Stack9, { gap: 4, children: [
5871
+ /* @__PURE__ */ jsxs23(Box22, { children: [
5872
+ /* @__PURE__ */ jsx31(Heading13, { size: "sm", children: "Contrato de vari\xE1veis" }),
5873
+ /* @__PURE__ */ jsx31(Text23, { fontSize: "sm", color: "gray.600", children: "Defina os campos aceitos pelo Handlebars. O teste e a pr\xE9via validar\xE3o este schema." })
5874
+ ] }),
5875
+ /* @__PURE__ */ jsxs23(Box22, { children: [
5876
+ /* @__PURE__ */ jsx31("label", { htmlFor: "template-schema", style: { fontSize: "0.875rem", fontWeight: 600 }, children: "JSON Schema" }),
5877
+ /* @__PURE__ */ jsx31(
5878
+ Textarea3,
5879
+ {
5880
+ id: "template-schema",
5881
+ mt: 1,
5882
+ minH: "420px",
5883
+ fontFamily: "mono",
5884
+ value: templateDraft.variablesSchema,
5885
+ onChange: (event) => setTemplateDraft({ ...templateDraft, variablesSchema: event.target.value })
5886
+ }
5887
+ )
5888
+ ] })
5889
+ ] }) : /* @__PURE__ */ jsxs23(Stack9, { gap: 4, align: "start", children: [
5890
+ /* @__PURE__ */ jsx31(Heading13, { size: "sm", children: "Schema da vers\xE3o selecionada" }),
5891
+ /* @__PURE__ */ jsx31(Text23, { color: "gray.600", children: "Use a vers\xE3o como base para editar o contrato de vari\xE1veis em um novo rascunho." }),
5892
+ managedTemplate ? /* @__PURE__ */ jsxs23(Fragment5, { children: [
5893
+ /* @__PURE__ */ jsx31(Box22, { as: "pre", w: "100%", minH: "280px", overflow: "auto", whiteSpace: "pre-wrap", borderWidth: "1px", borderRadius: "md", p: 4, fontSize: "sm", children: JSON.stringify(managedTemplate.variablesSchema || {}, null, 2) }),
5894
+ /* @__PURE__ */ jsx31(Button16, { variant: "outline", onClick: () => useAsBase(managedTemplate), children: "Editar como nova vers\xE3o" })
5895
+ ] }) : null
5896
+ ] }) : null,
5897
+ templateModalTab === "preview" ? /* @__PURE__ */ jsxs23(Stack9, { gap: 4, children: [
5898
+ /* @__PURE__ */ jsxs23(Box22, { children: [
5899
+ /* @__PURE__ */ jsx31(Heading13, { size: "sm", children: "Pr\xE9-visualiza\xE7\xE3o" }),
5900
+ /* @__PURE__ */ jsx31(Text23, { fontSize: "sm", color: "gray.600", children: previewTarget ? previewTarget.code + " \xB7 vers\xE3o " + previewTarget.version : editingBase ? "Rascunho baseado na vers\xE3o " + editingBase.version : "Conte\xFAdo do novo template" })
5901
+ ] }),
5902
+ /* @__PURE__ */ jsxs23(Box22, { children: [
5903
+ /* @__PURE__ */ jsx31("label", { htmlFor: "preview-variables", style: { fontSize: "0.875rem", fontWeight: 600 }, children: "Vari\xE1veis de exemplo" }),
5904
+ /* @__PURE__ */ jsx31(
5905
+ Textarea3,
5906
+ {
5907
+ id: "preview-variables",
5908
+ mt: 1,
5909
+ minH: "140px",
5910
+ fontFamily: "mono",
5911
+ value: previewVariables,
5912
+ onChange: (event) => setPreviewVariables(event.target.value)
5913
+ }
5914
+ )
5915
+ ] }),
5916
+ /* @__PURE__ */ jsx31(
5917
+ Button16,
5918
+ {
5919
+ alignSelf: "start",
5920
+ variant: "outline",
5921
+ loading: preview.isPending,
5922
+ disabled: !previewTarget && !templateDraft.code,
5923
+ onClick: previewTarget ? renderSavedPreview : renderDraftPreview,
5924
+ children: "Atualizar pr\xE9via"
5925
+ }
5926
+ ),
5927
+ preview.data ? /* @__PURE__ */ jsxs23(Stack9, { gap: 3, children: [
5928
+ /* @__PURE__ */ jsxs23(Box22, { bg: "gray.50", borderWidth: "1px", borderRadius: "md", p: 3, children: [
5929
+ /* @__PURE__ */ jsx31(Text23, { fontSize: "xs", color: "gray.600", children: "Assunto renderizado" }),
5930
+ /* @__PURE__ */ jsx31(Text23, { fontWeight: "semibold", children: preview.data.subject })
5931
+ ] }),
5932
+ /* @__PURE__ */ jsxs23(Box22, { children: [
5933
+ /* @__PURE__ */ jsx31(Text23, { fontSize: "sm", fontWeight: "semibold", mb: 1, children: "HTML" }),
5934
+ /* @__PURE__ */ jsx31(
5935
+ "iframe",
5936
+ {
5937
+ title: "Pr\xE9-visualiza\xE7\xE3o segura do template",
5938
+ sandbox: "",
5939
+ srcDoc: preview.data.html,
5940
+ style: {
5941
+ width: "100%",
5942
+ minHeight: 420,
5943
+ border: "1px solid #E2E8F0",
5944
+ borderRadius: 8,
5945
+ background: "white"
5946
+ }
5947
+ }
5948
+ )
5949
+ ] }),
5950
+ /* @__PURE__ */ jsxs23(Box22, { children: [
5951
+ /* @__PURE__ */ jsx31(Text23, { fontSize: "sm", fontWeight: "semibold", mb: 1, children: "Texto simples" }),
5952
+ /* @__PURE__ */ jsx31(Box22, { as: "pre", whiteSpace: "pre-wrap", borderWidth: "1px", borderRadius: "md", p: 3, fontSize: "sm", children: preview.data.text })
5953
+ ] })
5954
+ ] }) : /* @__PURE__ */ jsx31(Text23, { fontSize: "sm", color: "gray.600", children: "Informe vari\xE1veis v\xE1lidas e atualize a pr\xE9via." })
5955
+ ] }) : null,
5956
+ templateModalTab === "test" ? /* @__PURE__ */ jsxs23(Stack9, { gap: 4, children: [
5957
+ /* @__PURE__ */ jsxs23(Box22, { children: [
5958
+ /* @__PURE__ */ jsx31(Heading13, { size: "sm", children: "Envio de teste" }),
5959
+ /* @__PURE__ */ jsx31(Text23, { fontSize: "sm", color: "gray.600", children: testTarget ? testTarget.code + " \xB7 vers\xE3o " + testTarget.version + " \xB7 " + testTarget.status : "Selecione uma vers\xE3o salva antes de enviar o teste." })
5960
+ ] }),
5961
+ testTarget ? /* @__PURE__ */ jsxs23(Fragment5, { children: [
5962
+ /* @__PURE__ */ jsxs23(Box22, { children: [
5963
+ /* @__PURE__ */ jsx31("label", { htmlFor: "template-test-recipient", style: { fontSize: "0.875rem", fontWeight: 600 }, children: "Destinat\xE1rio" }),
5964
+ /* @__PURE__ */ jsx31(
5965
+ Input10,
5966
+ {
5967
+ id: "template-test-recipient",
5968
+ type: "email",
5969
+ mt: 1,
5970
+ value: templateTest.to,
5971
+ onChange: (event) => setTemplateTest({ ...templateTest, to: event.target.value })
5972
+ }
5973
+ )
5974
+ ] }),
5975
+ /* @__PURE__ */ jsxs23(Box22, { children: [
5976
+ /* @__PURE__ */ jsx31("label", { htmlFor: "template-test-variables", style: { fontSize: "0.875rem", fontWeight: 600 }, children: "Vari\xE1veis" }),
5977
+ /* @__PURE__ */ jsx31(
5978
+ Textarea3,
5979
+ {
5980
+ id: "template-test-variables",
5981
+ mt: 1,
5982
+ minH: "260px",
5983
+ fontFamily: "mono",
5984
+ value: templateTest.variables,
5985
+ onChange: (event) => setTemplateTest({ ...templateTest, variables: event.target.value })
5986
+ }
5987
+ )
5988
+ ] }),
5989
+ /* @__PURE__ */ jsx31(
5990
+ Button16,
5991
+ {
5992
+ alignSelf: "start",
5993
+ loading: testTemplate.isPending,
5994
+ onClick: () => {
5995
+ try {
5996
+ parseObject(templateTest.variables, "JSON de vari\xE1veis inv\xE1lido.");
5997
+ testTemplate.mutate();
5998
+ } catch (reason) {
5999
+ setError(errorMessage(reason));
6000
+ }
6001
+ },
6002
+ children: "Enfileirar teste desta vers\xE3o"
6003
+ }
6004
+ )
6005
+ ] }) : null
6006
+ ] }) : null
6007
+ ] }),
6008
+ /* @__PURE__ */ jsxs23(
6009
+ Flex15,
5743
6010
  {
5744
- title: "Pr\xE9-visualiza\xE7\xE3o segura do template",
5745
- sandbox: "",
5746
- srcDoc: preview.data.html,
5747
- style: { width: "100%", minHeight: 360, border: "1px solid #E2E8F0", borderRadius: 8, background: "white" }
6011
+ flex: "0 0 auto",
6012
+ minH: "64px",
6013
+ px: { base: 4, md: 5 },
6014
+ py: 3,
6015
+ align: "center",
6016
+ justify: "space-between",
6017
+ gap: 3,
6018
+ borderTopWidth: "1px",
6019
+ borderColor: "gray.200",
6020
+ boxShadow: "0 -8px 24px rgba(15,23,42,.05)",
6021
+ children: [
6022
+ /* @__PURE__ */ jsx31(Text23, { fontSize: "xs", color: "gray.600", children: "Nenhuma altera\xE7\xE3o \xE9 publicada automaticamente." }),
6023
+ /* @__PURE__ */ jsxs23(Flex15, { gap: 2, children: [
6024
+ /* @__PURE__ */ jsx31(Button16, { variant: "ghost", onClick: closeTemplateModal, children: "Fechar" }),
6025
+ draftContext && ["content", "variables"].includes(templateModalTab) ? /* @__PURE__ */ jsx31(
6026
+ Button16,
6027
+ {
6028
+ loading: createVersion.isPending,
6029
+ disabled: !templateDraft.code,
6030
+ onClick: () => {
6031
+ try {
6032
+ parseObject(templateDraft.variablesSchema, "JSON Schema inv\xE1lido.");
6033
+ createVersion.mutate();
6034
+ } catch (reason) {
6035
+ setError(errorMessage(reason));
6036
+ }
6037
+ },
6038
+ children: "Salvar nova vers\xE3o"
6039
+ }
6040
+ ) : null
6041
+ ] })
6042
+ ]
5748
6043
  }
5749
6044
  )
5750
- ] }),
5751
- /* @__PURE__ */ jsxs23(Box22, { children: [
5752
- /* @__PURE__ */ jsx31(Text23, { fontSize: "sm", fontWeight: "semibold", mb: 1, children: "Texto simples" }),
5753
- /* @__PURE__ */ jsx31(Box22, { as: "pre", whiteSpace: "pre-wrap", borderWidth: "1px", borderRadius: "md", p: 3, fontSize: "sm", children: preview.data.text })
5754
- ] })
5755
- ] }) : /* @__PURE__ */ jsx31(Text23, { fontSize: "sm", color: "gray.600", children: "Selecione uma vers\xE3o ou use \u201CPr\xE9-visualizar rascunho\u201D." })
5756
- ] })
5757
- ] }),
5758
- /* @__PURE__ */ jsxs23(Box22, { borderWidth: "1px", borderRadius: "lg", p: { base: 4, md: 5 }, children: [
5759
- /* @__PURE__ */ jsx31(Heading13, { size: "sm", children: "Envio de teste da vers\xE3o" }),
5760
- /* @__PURE__ */ jsx31(Text23, { fontSize: "sm", color: "gray.600", mb: 4, children: testTarget ? testTarget.code + " \xB7 vers\xE3o " + testTarget.version + " \xB7 " + testTarget.status : "Escolha \u201CEnviar teste\u201D em uma vers\xE3o da lista." }),
5761
- /* @__PURE__ */ jsxs23(Stack9, { gap: 3, children: [
5762
- /* @__PURE__ */ jsx31(
5763
- Input10,
5764
- {
5765
- type: "email",
5766
- "aria-label": "Destinat\xE1rio do teste do template",
5767
- placeholder: "Destinat\xE1rio",
5768
- value: templateTest.to,
5769
- onChange: (event) => setTemplateTest({ ...templateTest, to: event.target.value })
5770
- }
5771
- ),
5772
- /* @__PURE__ */ jsx31(
5773
- Textarea3,
5774
- {
5775
- "aria-label": "Vari\xE1veis do teste do template",
5776
- minH: "120px",
5777
- fontFamily: "mono",
5778
- value: templateTest.variables,
5779
- onChange: (event) => setTemplateTest({ ...templateTest, variables: event.target.value })
5780
- }
5781
- ),
5782
- /* @__PURE__ */ jsx31(
5783
- Button16,
5784
- {
5785
- alignSelf: "start",
5786
- loading: testTemplate.isPending,
5787
- disabled: !testTarget,
5788
- onClick: () => {
5789
- try {
5790
- parseObject(templateTest.variables, "JSON de vari\xE1veis inv\xE1lido.");
5791
- testTemplate.mutate();
5792
- } catch (reason) {
5793
- setError(errorMessage(reason));
5794
- }
5795
- },
5796
- children: "Enfileirar teste desta vers\xE3o"
5797
- }
5798
- )
5799
- ] })
5800
- ] })
5801
- ] }) : null,
6045
+ ]
6046
+ }
6047
+ )
6048
+ }
6049
+ ) : null,
5802
6050
  tab === "dispatches" ? /* @__PURE__ */ jsxs23(Stack9, { gap: 3, children: [
5803
6051
  /* @__PURE__ */ jsxs23(Flex15, { justify: "space-between", align: "center", gap: 3, wrap: "wrap", children: [
5804
6052
  /* @__PURE__ */ jsxs23(Box22, { children: [
@@ -6148,7 +6396,7 @@ function Sidebar({ app, menu, registry }) {
6148
6396
  // package.json
6149
6397
  var package_default = {
6150
6398
  name: "@oondemand/oon-core-front",
6151
- version: "0.4.29",
6399
+ version: "0.4.30",
6152
6400
  repository: {
6153
6401
  type: "git",
6154
6402
  url: "git+https://github.com/oondemand/oon-platform.git",
@@ -6573,7 +6821,7 @@ function AccessDeniedPage({ app }) {
6573
6821
 
6574
6822
  // src/security/AppAccessGuard.tsx
6575
6823
  import { Navigate, useLocation as useLocation3 } from "react-router-dom";
6576
- import { Fragment as Fragment5, jsx as jsx37 } from "react/jsx-runtime";
6824
+ import { Fragment as Fragment6, jsx as jsx37 } from "react/jsx-runtime";
6577
6825
  function loginRedirect(pathname, search) {
6578
6826
  const destination = `${pathname}${search}`;
6579
6827
  return `/login?redirect=${encodeURIComponent(destination)}`;
@@ -6599,7 +6847,7 @@ function AppAccessGuard({ children }) {
6599
6847
  }
6600
6848
  );
6601
6849
  }
6602
- return /* @__PURE__ */ jsx37(Fragment5, { children });
6850
+ return /* @__PURE__ */ jsx37(Fragment6, { children });
6603
6851
  }
6604
6852
 
6605
6853
  // src/security/LoginPage.tsx
@@ -6783,7 +7031,7 @@ function FirstAccessPage() {
6783
7031
  // src/security/ActivationPage.tsx
6784
7032
  import { useEffect as useEffect12, useState as useState22 } from "react";
6785
7033
  import { Box as Box28, Button as Button21, Heading as Heading17, Input as Input13, Text as Text29, VStack as VStack7 } from "@chakra-ui/react";
6786
- import { Fragment as Fragment6, jsx as jsx40, jsxs as jsxs29 } from "react/jsx-runtime";
7034
+ import { Fragment as Fragment7, jsx as jsx40, jsxs as jsxs29 } from "react/jsx-runtime";
6787
7035
  function encodeBasicCredentials2(email, password) {
6788
7036
  const bytes = new TextEncoder().encode(`${email}:${password}`);
6789
7037
  let binary = "";
@@ -6938,7 +7186,7 @@ function ActivationPage() {
6938
7186
  ] }, field.name);
6939
7187
  }
6940
7188
  function renderDevLocalActivation() {
6941
- return /* @__PURE__ */ jsxs29(Fragment6, { children: [
7189
+ return /* @__PURE__ */ jsxs29(Fragment7, { children: [
6942
7190
  /* @__PURE__ */ jsx40(Text29, { color: "gray.700", children: "Entre com seu e-mail e senha para ativar esta Central em ambiente de desenvolvimento. Se o e-mail ainda n\xE3o existir na Central de Ativa\xE7\xF5es, o usu\xE1rio ser\xE1 criado automaticamente com perfil de desenvolvedor." }),
6943
7191
  /* @__PURE__ */ jsxs29(Box28, { w: "100%", children: [
6944
7192
  /* @__PURE__ */ jsx40(Text29, { fontWeight: "medium", children: "Nome do usu\xE1rio" }),
@@ -7042,7 +7290,7 @@ function ActivationPage() {
7042
7290
  config.technical.ambiente
7043
7291
  ] }),
7044
7292
  error ? /* @__PURE__ */ jsx40(Text29, { color: "red.600", children: error }) : null,
7045
- step !== 6 ? /* @__PURE__ */ jsxs29(Fragment6, { children: [
7293
+ step !== 6 ? /* @__PURE__ */ jsxs29(Fragment7, { children: [
7046
7294
  /* @__PURE__ */ jsxs29(Box28, { w: "100%", children: [
7047
7295
  /* @__PURE__ */ jsx40(Text29, { fontWeight: "medium", children: "E-mail do administrador *" }),
7048
7296
  /* @__PURE__ */ jsx40(
@@ -7080,7 +7328,7 @@ function ActivationPage() {
7080
7328
  children: "Criar ecossistema e ativar"
7081
7329
  }
7082
7330
  )
7083
- ] }) : /* @__PURE__ */ jsxs29(Fragment6, { children: [
7331
+ ] }) : /* @__PURE__ */ jsxs29(Fragment7, { children: [
7084
7332
  /* @__PURE__ */ jsx40(Heading17, { size: "md", children: "Ativa\xE7\xE3o conclu\xEDda" }),
7085
7333
  /* @__PURE__ */ jsx40(Text29, { children: "Usu\xE1rio, acesso do sistema e aplicativo root foram preparados. Redirecionando para o primeiro login..." })
7086
7334
  ] })
@@ -7112,7 +7360,7 @@ function ActivationPage() {
7112
7360
  ] }),
7113
7361
  error ? /* @__PURE__ */ jsx40(Text29, { color: "red.600", children: error }) : null,
7114
7362
  step === 1 && isDevelopmentMember && !showCodeFlow ? renderDevLocalActivation() : null,
7115
- step === 1 && (!isDevelopmentMember || showCodeFlow) && /* @__PURE__ */ jsxs29(Fragment6, { children: [
7363
+ step === 1 && (!isDevelopmentMember || showCodeFlow) && /* @__PURE__ */ jsxs29(Fragment7, { children: [
7116
7364
  /* @__PURE__ */ jsx40(Text29, { children: "Informe o c\xF3digo de ativa\xE7\xE3o para validar Tenant, App, Entitlement e Deployment. A licen\xE7a ser\xE1 validada somente para Apps comerciais." }),
7117
7365
  /* @__PURE__ */ jsx40(
7118
7366
  Input13,
@@ -7142,22 +7390,22 @@ function ActivationPage() {
7142
7390
  }
7143
7391
  ) : null
7144
7392
  ] }),
7145
- step === 2 && /* @__PURE__ */ jsxs29(Fragment6, { children: [
7393
+ step === 2 && /* @__PURE__ */ jsxs29(Fragment7, { children: [
7146
7394
  /* @__PURE__ */ jsx40(Heading17, { size: "md", children: "Confirma\xE7\xE3o" }),
7147
7395
  /* @__PURE__ */ jsx40("pre", { children: JSON.stringify(preview, null, 2) }),
7148
7396
  /* @__PURE__ */ jsx40(Button21, { onClick: () => setStep(3), children: "Continuar" })
7149
7397
  ] }),
7150
- step === 3 && /* @__PURE__ */ jsxs29(Fragment6, { children: [
7398
+ step === 3 && /* @__PURE__ */ jsxs29(Fragment7, { children: [
7151
7399
  config.globalFields.map(
7152
7400
  (field) => renderField(field, global, setGlobal)
7153
7401
  ),
7154
7402
  /* @__PURE__ */ jsx40(Button21, { onClick: () => setStep(4), children: "Continuar" })
7155
7403
  ] }),
7156
- step === 4 && /* @__PURE__ */ jsxs29(Fragment6, { children: [
7404
+ step === 4 && /* @__PURE__ */ jsxs29(Fragment7, { children: [
7157
7405
  config.appFields.length ? config.appFields.map((field) => renderField(field, app, setApp)) : /* @__PURE__ */ jsx40(Text29, { children: "Nenhum par\xE2metro adicional declarado." }),
7158
7406
  /* @__PURE__ */ jsx40(Button21, { onClick: () => setStep(5), children: "Revisar" })
7159
7407
  ] }),
7160
- step === 5 && /* @__PURE__ */ jsxs29(Fragment6, { children: [
7408
+ step === 5 && /* @__PURE__ */ jsxs29(Fragment7, { children: [
7161
7409
  /* @__PURE__ */ jsx40(Text29, { children: "Ao confirmar, o c\xF3digo ser\xE1 consumido e este runtime ser\xE1 vinculado ao Deployment do Ecossistema Oon." }),
7162
7410
  /* @__PURE__ */ jsx40(
7163
7411
  Button21,
@@ -7170,7 +7418,7 @@ function ActivationPage() {
7170
7418
  }
7171
7419
  )
7172
7420
  ] }),
7173
- step === 6 && /* @__PURE__ */ jsxs29(Fragment6, { children: [
7421
+ step === 6 && /* @__PURE__ */ jsxs29(Fragment7, { children: [
7174
7422
  /* @__PURE__ */ jsx40(Heading17, { size: "md", children: "Ativa\xE7\xE3o conclu\xEDda" }),
7175
7423
  devResult?.appCode ? /* @__PURE__ */ jsxs29(Text29, { children: [
7176
7424
  "C\xF3digo do app: ",
@@ -7194,7 +7442,7 @@ function InstanceBlockedPage({
7194
7442
  }
7195
7443
 
7196
7444
  // src/security/RouteGuard.tsx
7197
- import { Fragment as Fragment7, jsx as jsx41 } from "react/jsx-runtime";
7445
+ import { Fragment as Fragment8, jsx as jsx41 } from "react/jsx-runtime";
7198
7446
  function RouteGuard({
7199
7447
  permission,
7200
7448
  children
@@ -7205,7 +7453,7 @@ function RouteGuard({
7205
7453
  if (!hasPermission(permission)) {
7206
7454
  return /* @__PURE__ */ jsx41(LoadingScreen, { message: "Voc\xEA n\xE3o tem acesso a esta tela." });
7207
7455
  }
7208
- return /* @__PURE__ */ jsx41(Fragment7, { children });
7456
+ return /* @__PURE__ */ jsx41(Fragment8, { children });
7209
7457
  }
7210
7458
 
7211
7459
  // src/security/ActivationGuard.tsx