@enerex/template-studio 1.1.37 → 1.1.38
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.
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { QueryClient as
|
|
4
|
-
import
|
|
5
|
-
import { Spinner as
|
|
6
|
-
import { Controller as
|
|
7
|
-
import
|
|
8
|
-
const
|
|
1
|
+
import { jsx as r, jsxs as S, Fragment as we } from "react/jsx-runtime";
|
|
2
|
+
import k, { useContext as je, useState as v, useRef as We, useEffect as x } from "react";
|
|
3
|
+
import { QueryClient as Ye, QueryClientProvider as ze, useQuery as le, useMutation as Le, useQueryClient as Je } from "@tanstack/react-query";
|
|
4
|
+
import xe from "axios";
|
|
5
|
+
import { Spinner as J, Form as F, Card as Se, Row as Xe, Col as H, Button as re } from "react-bootstrap";
|
|
6
|
+
import { Controller as Ze, useForm as et } from "react-hook-form";
|
|
7
|
+
import Ce, { components as tt } from "react-select";
|
|
8
|
+
const ie = `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
|
|
9
9
|
<html\r
|
|
10
10
|
dir="ltr"\r
|
|
11
11
|
xmlns:o="urn:schemas-microsoft-com:office:office"\r
|
|
@@ -361,45 +361,45 @@ const z = `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:
|
|
|
361
361
|
</div>\r
|
|
362
362
|
</body>\r
|
|
363
363
|
</html>\r
|
|
364
|
-
`,
|
|
364
|
+
`, Pe = k.createContext(
|
|
365
365
|
void 0
|
|
366
|
-
),
|
|
366
|
+
), nt = ({
|
|
367
367
|
children: t,
|
|
368
368
|
configs: s
|
|
369
369
|
}) => {
|
|
370
|
-
const [o,
|
|
370
|
+
const [o, l] = k.useState(s.clientId), [i, e] = k.useState(s.apiKey), [a, c] = k.useState(
|
|
371
371
|
s.enerexIdentifier
|
|
372
|
-
), [T,
|
|
372
|
+
), [T, g] = k.useState(s.projectId), [N, f] = k.useState(s.userEmail), [I, j] = k.useState(s.isAdmin), [L, y] = k.useState(s.meBaseUrl), [h, b] = k.useState(
|
|
373
373
|
s.defaultSelector
|
|
374
|
-
),
|
|
375
|
-
e(
|
|
374
|
+
), p = (u) => {
|
|
375
|
+
e(u.apiKey), l(u.clientId), g(u.projectId), c(u.enerexIdentifier), f(u.userEmail), j(u.isAdmin), b(u.defaultSelector), y(u.meBaseUrl);
|
|
376
376
|
};
|
|
377
|
-
return /* @__PURE__ */
|
|
378
|
-
|
|
377
|
+
return /* @__PURE__ */ r(
|
|
378
|
+
Pe.Provider,
|
|
379
379
|
{
|
|
380
380
|
value: {
|
|
381
381
|
clientId: o,
|
|
382
|
-
apiKey:
|
|
383
|
-
setConfiguration:
|
|
382
|
+
apiKey: i,
|
|
383
|
+
setConfiguration: p,
|
|
384
384
|
enerexIdentifier: a,
|
|
385
385
|
projectId: T,
|
|
386
|
-
userEmail:
|
|
387
|
-
isAdmin:
|
|
386
|
+
userEmail: N,
|
|
387
|
+
isAdmin: I,
|
|
388
388
|
defaultSelector: h,
|
|
389
|
-
meBaseUrl:
|
|
389
|
+
meBaseUrl: L
|
|
390
390
|
},
|
|
391
391
|
children: t
|
|
392
392
|
}
|
|
393
393
|
);
|
|
394
394
|
}, R = () => {
|
|
395
|
-
const t =
|
|
395
|
+
const t = je(Pe);
|
|
396
396
|
if (!t)
|
|
397
397
|
throw new Error("widgetConfig must be used within a ConfigProvider");
|
|
398
398
|
return t;
|
|
399
|
-
},
|
|
399
|
+
}, Oe = (t = "", s) => ({ get: async (i, e) => {
|
|
400
400
|
try {
|
|
401
|
-
const a = await
|
|
402
|
-
`${t}${
|
|
401
|
+
const a = await xe.get(
|
|
402
|
+
`${t}${i}`,
|
|
403
403
|
e ?? s
|
|
404
404
|
);
|
|
405
405
|
if (a.status === 200)
|
|
@@ -407,10 +407,10 @@ const z = `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:
|
|
|
407
407
|
} catch (a) {
|
|
408
408
|
throw a;
|
|
409
409
|
}
|
|
410
|
-
}, post: async (
|
|
410
|
+
}, post: async (i, e, a) => {
|
|
411
411
|
try {
|
|
412
|
-
const c = await
|
|
413
|
-
`${t}${
|
|
412
|
+
const c = await xe.post(
|
|
413
|
+
`${t}${i}`,
|
|
414
414
|
e,
|
|
415
415
|
a ?? s
|
|
416
416
|
);
|
|
@@ -419,100 +419,100 @@ const z = `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:
|
|
|
419
419
|
} catch (c) {
|
|
420
420
|
throw c;
|
|
421
421
|
}
|
|
422
|
-
} }),
|
|
422
|
+
} }), De = k.createContext({
|
|
423
423
|
get: () => {
|
|
424
424
|
throw new Error("HttpClientContext.get not implemented");
|
|
425
425
|
},
|
|
426
426
|
post: () => {
|
|
427
427
|
throw new Error("HttpClientContext.post not implemented");
|
|
428
428
|
}
|
|
429
|
-
}),
|
|
430
|
-
const { clientId: s, apiKey: o, isAdmin:
|
|
429
|
+
}), rt = ({ children: t }) => {
|
|
430
|
+
const { clientId: s, apiKey: o, isAdmin: l, meBaseUrl: i } = R(), e = {
|
|
431
431
|
headers: {
|
|
432
432
|
client_id: s,
|
|
433
433
|
"x-api-key": o,
|
|
434
|
-
"Security-Context":
|
|
434
|
+
"Security-Context": l ? "admin" : "viewer"
|
|
435
435
|
}
|
|
436
|
-
}, { get: a, post: c } =
|
|
437
|
-
return /* @__PURE__ */
|
|
438
|
-
},
|
|
439
|
-
const s = new
|
|
440
|
-
return /* @__PURE__ */
|
|
441
|
-
},
|
|
436
|
+
}, { get: a, post: c } = Oe(i, e);
|
|
437
|
+
return /* @__PURE__ */ r(De.Provider, { value: { get: a, post: c }, children: t });
|
|
438
|
+
}, st = ({ children: t }) => {
|
|
439
|
+
const s = new Ye();
|
|
440
|
+
return /* @__PURE__ */ r(rt, { children: /* @__PURE__ */ r(ze, { client: s, children: t }) });
|
|
441
|
+
}, ue = {
|
|
442
442
|
EDITOR_SCRIPT_URL: "https://plugins.stripo.email/resources/uieditor/latest/UIEditor.js",
|
|
443
443
|
EDITOR_PLUGIN_ID: "1afdc3161ec7409a8627a1c8561d45f5",
|
|
444
444
|
EDITOR_SECRET_KEY: "54ba748ed7e94f2e929555783acb03da"
|
|
445
|
-
},
|
|
446
|
-
const s = Array.from(new Set(t.map((
|
|
447
|
-
return s.forEach((
|
|
448
|
-
const
|
|
445
|
+
}, it = (t) => {
|
|
446
|
+
const s = Array.from(new Set(t.map((l) => l.category))), o = [];
|
|
447
|
+
return s.forEach((l) => {
|
|
448
|
+
const i = t.filter((e) => e.category === l).map((e) => ({
|
|
449
449
|
label: e.label,
|
|
450
450
|
value: e.value,
|
|
451
451
|
hint: e.hint,
|
|
452
452
|
hidden: e.hidden
|
|
453
453
|
}));
|
|
454
|
-
o.push({ category:
|
|
454
|
+
o.push({ category: l, entries: i });
|
|
455
455
|
}), o;
|
|
456
|
-
},
|
|
457
|
-
const t =
|
|
456
|
+
}, K = () => {
|
|
457
|
+
const t = je(De);
|
|
458
458
|
if (t)
|
|
459
459
|
return t;
|
|
460
460
|
throw new Error("useHttpClient must be used within a HttpClientProvider");
|
|
461
|
-
},
|
|
461
|
+
}, Q = {
|
|
462
462
|
Template_list: "/Template/list/",
|
|
463
463
|
Template: "/Template/GetTemplate/",
|
|
464
464
|
MergeTags: "/Template/TemplateMergeTags/",
|
|
465
465
|
ExcludeCategory: "/Template/GetExcludeCategories/",
|
|
466
466
|
SaveTemplate: "/Template/save-update/",
|
|
467
467
|
TemplateTypes: "/Template/TemplateTypes/"
|
|
468
|
-
},
|
|
469
|
-
const t =
|
|
470
|
-
return
|
|
468
|
+
}, lt = () => {
|
|
469
|
+
const t = K(), { enerexIdentifier: s, projectId: o } = R();
|
|
470
|
+
return le({
|
|
471
471
|
queryKey: ["getTemplateTags"],
|
|
472
|
-
queryFn: async (
|
|
473
|
-
`${
|
|
472
|
+
queryFn: async (i) => await t.get(
|
|
473
|
+
`${Q.MergeTags}${o}/${s}`
|
|
474
474
|
)
|
|
475
475
|
});
|
|
476
|
-
},
|
|
477
|
-
const t =
|
|
478
|
-
return
|
|
476
|
+
}, at = () => {
|
|
477
|
+
const t = K(), { enerexIdentifier: s, projectId: o } = R();
|
|
478
|
+
return le({
|
|
479
479
|
queryKey: ["getExcludeCategory"],
|
|
480
|
-
queryFn: async (
|
|
481
|
-
`${
|
|
480
|
+
queryFn: async (i) => await t.get(
|
|
481
|
+
`${Q.ExcludeCategory}${o}/${s}`
|
|
482
482
|
)
|
|
483
483
|
});
|
|
484
|
-
},
|
|
484
|
+
}, ot = ({
|
|
485
485
|
templateHTML: t,
|
|
486
486
|
className: s = "",
|
|
487
487
|
loading: o = !1,
|
|
488
|
-
onEditorInitialized:
|
|
488
|
+
onEditorInitialized: l
|
|
489
489
|
}) => {
|
|
490
|
-
const { post:
|
|
491
|
-
t ?? { html:
|
|
492
|
-
), { userEmail:
|
|
493
|
-
|
|
494
|
-
(async () => (await
|
|
490
|
+
const { post: i } = Oe(), { data: e } = lt(), { data: a } = at(), [c, T] = v(
|
|
491
|
+
t ?? { html: ie, css: "" }
|
|
492
|
+
), { userEmail: g } = R(), N = We(null), f = "https://plugin.stripocdn.email/content/guids/CABINET_eab4e7d5a4603ac03f4120652a3a5a540f0c79c688514939f095f67433ed4a67/images/photo256.png", I = "https://plugins.stripo.email/api/v1/auth";
|
|
493
|
+
x(() => {
|
|
494
|
+
(async () => (await j(), e && a && await L(ue.EDITOR_SCRIPT_URL)))();
|
|
495
495
|
}, [e, a]);
|
|
496
|
-
async function
|
|
497
|
-
window.Zone || await new Promise((h,
|
|
498
|
-
const
|
|
499
|
-
|
|
500
|
-
const
|
|
501
|
-
|
|
496
|
+
async function j() {
|
|
497
|
+
window.Zone || await new Promise((h, b) => {
|
|
498
|
+
const p = document.createElement("script");
|
|
499
|
+
p.src = "https://unpkg.com/zone.js@0.13.1/bundles/zone.umd.min.js";
|
|
500
|
+
const u = document.querySelector("script[nonce]")?.nonce;
|
|
501
|
+
u && p.setAttribute("nonce", u), p.onload = () => h(), p.onerror = () => b(new Error("Failed to load zone.js")), document.head.appendChild(p);
|
|
502
502
|
});
|
|
503
503
|
}
|
|
504
|
-
async function
|
|
505
|
-
let
|
|
504
|
+
async function L(h) {
|
|
505
|
+
let b = document.getElementById(
|
|
506
506
|
"UiEditorScript"
|
|
507
507
|
);
|
|
508
|
-
|
|
509
|
-
await
|
|
510
|
-
}, document.body.appendChild(
|
|
511
|
-
(
|
|
508
|
+
b || (b = document.createElement("script"), b.id = "UiEditorScript", b.src = h, b.onload = async () => {
|
|
509
|
+
await y();
|
|
510
|
+
}, document.body.appendChild(b)), await new Promise(
|
|
511
|
+
(p) => b.addEventListener("load", () => p(), { once: !0 })
|
|
512
512
|
);
|
|
513
513
|
}
|
|
514
|
-
const
|
|
515
|
-
const h =
|
|
514
|
+
const y = async () => {
|
|
515
|
+
const h = N.current;
|
|
516
516
|
if (!h) {
|
|
517
517
|
console.error("Missing #stripoEditorContainer in DOM");
|
|
518
518
|
return;
|
|
@@ -521,159 +521,230 @@ const z = `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:
|
|
|
521
521
|
console.error("UIEditor script not loaded or not exposing initEditor");
|
|
522
522
|
return;
|
|
523
523
|
}
|
|
524
|
-
const
|
|
524
|
+
const b = {
|
|
525
525
|
html: c.html,
|
|
526
526
|
css: c.css,
|
|
527
527
|
modulesExcludedCategories: a ?? [],
|
|
528
528
|
forceRecreate: !0,
|
|
529
529
|
metadata: {
|
|
530
|
-
emailId:
|
|
530
|
+
emailId: g,
|
|
531
531
|
userId: "1",
|
|
532
532
|
// username: userName,
|
|
533
533
|
avatarUrl: f
|
|
534
534
|
},
|
|
535
535
|
locale: "en",
|
|
536
|
-
onTokenRefreshRequest: async (
|
|
537
|
-
const
|
|
538
|
-
pluginId:
|
|
539
|
-
secretKey:
|
|
540
|
-
userId:
|
|
536
|
+
onTokenRefreshRequest: async (p) => {
|
|
537
|
+
const u = {
|
|
538
|
+
pluginId: ue.EDITOR_PLUGIN_ID,
|
|
539
|
+
secretKey: ue.EDITOR_SECRET_KEY,
|
|
540
|
+
userId: g,
|
|
541
541
|
role: "user"
|
|
542
|
-
}, B = await
|
|
543
|
-
|
|
544
|
-
|
|
542
|
+
}, B = await i(
|
|
543
|
+
I,
|
|
544
|
+
u
|
|
545
545
|
);
|
|
546
|
-
B?.token &&
|
|
546
|
+
B?.token && p(B.token);
|
|
547
547
|
},
|
|
548
548
|
onTemplateLoaded: () => {
|
|
549
|
-
|
|
549
|
+
l && l(!0);
|
|
550
550
|
},
|
|
551
|
-
mergeTags:
|
|
551
|
+
mergeTags: it(e ?? [])
|
|
552
552
|
};
|
|
553
|
-
for (const [
|
|
553
|
+
for (const [p, u] of Object.entries({
|
|
554
554
|
codeEditorButtonSelector: "#codeEditor",
|
|
555
555
|
undoButtonSelector: "#undoButton",
|
|
556
556
|
redoButtonSelector: "#redoButton",
|
|
557
557
|
mobileViewButtonSelector: "#mobileViewButton",
|
|
558
558
|
desktopViewButtonSelector: "#desktopViewButton"
|
|
559
559
|
}))
|
|
560
|
-
h.ownerDocument && h.getRootNode() instanceof ShadowRoot && h.getRootNode().querySelector(
|
|
561
|
-
await window.UIEditor.initEditor(h,
|
|
560
|
+
h.ownerDocument && h.getRootNode() instanceof ShadowRoot && h.getRootNode().querySelector(u) && (b[p] = u);
|
|
561
|
+
await window.UIEditor.initEditor(h, b);
|
|
562
562
|
};
|
|
563
|
-
return /* @__PURE__ */
|
|
564
|
-
o && /* @__PURE__ */
|
|
565
|
-
|
|
563
|
+
return /* @__PURE__ */ r("div", { className: "position-relative", children: /* @__PURE__ */ S("div", { className: `editor-container ${s}`, children: [
|
|
564
|
+
o && /* @__PURE__ */ r("div", { className: "loading-overlay", children: /* @__PURE__ */ r(
|
|
565
|
+
J,
|
|
566
566
|
{
|
|
567
567
|
animation: "border",
|
|
568
568
|
style: { width: "11px", height: "11px" },
|
|
569
569
|
size: "sm",
|
|
570
570
|
role: "status",
|
|
571
571
|
className: "me-1",
|
|
572
|
-
children: /* @__PURE__ */
|
|
572
|
+
children: /* @__PURE__ */ r("span", { className: "visually-hidden", children: "Loading..." })
|
|
573
573
|
}
|
|
574
574
|
) }),
|
|
575
|
-
/* @__PURE__ */
|
|
576
|
-
/* @__PURE__ */
|
|
575
|
+
/* @__PURE__ */ r("div", { id: "externalSystemContainer" }),
|
|
576
|
+
/* @__PURE__ */ r("div", { id: "stripoEditorContainer", ref: N })
|
|
577
577
|
] }) });
|
|
578
|
-
},
|
|
578
|
+
}, Ee = ({
|
|
579
579
|
label: t,
|
|
580
580
|
register: s,
|
|
581
581
|
validation: o,
|
|
582
|
-
required:
|
|
583
|
-
name:
|
|
582
|
+
required: l = !1,
|
|
583
|
+
name: i,
|
|
584
584
|
error: e,
|
|
585
585
|
className: a = "",
|
|
586
586
|
...c
|
|
587
|
-
}) => /* @__PURE__ */
|
|
588
|
-
t ? /* @__PURE__ */
|
|
587
|
+
}) => /* @__PURE__ */ S(F.Group, { className: a + " mb-1", children: [
|
|
588
|
+
t ? /* @__PURE__ */ S(F.Label, { className: "mb-3 d-block form-label ts-label-height", children: [
|
|
589
589
|
t,
|
|
590
|
-
|
|
590
|
+
l && /* @__PURE__ */ r("label", { className: "text-danger", children: "*" })
|
|
591
591
|
] }) : null,
|
|
592
|
-
/* @__PURE__ */
|
|
593
|
-
|
|
592
|
+
/* @__PURE__ */ r(
|
|
593
|
+
F.Control,
|
|
594
594
|
{
|
|
595
|
-
name:
|
|
595
|
+
name: i,
|
|
596
596
|
type: "text",
|
|
597
597
|
...c,
|
|
598
|
-
isInvalid: !!(e && e[
|
|
599
|
-
...s ? s(
|
|
598
|
+
isInvalid: !!(e && e[i]),
|
|
599
|
+
...s ? s(i, {
|
|
600
600
|
...o
|
|
601
601
|
}) : {},
|
|
602
|
-
className: `react-select__control ${e && e[
|
|
602
|
+
className: `react-select__control ${e && e[i] && "border border-danger"}`
|
|
603
603
|
}
|
|
604
604
|
),
|
|
605
|
-
e && e[
|
|
606
|
-
] }),
|
|
607
|
-
|
|
608
|
-
|
|
605
|
+
e && e[i] ? /* @__PURE__ */ r(F.Control.Feedback, { type: "invalid", children: e[i].message }) : null
|
|
606
|
+
] }), dt = ({
|
|
607
|
+
show: t,
|
|
608
|
+
variant: s,
|
|
609
|
+
title: o = "Are you sure?",
|
|
610
|
+
message: l,
|
|
611
|
+
label: i = "Name",
|
|
612
|
+
value: e = "",
|
|
613
|
+
placeholder: a = "",
|
|
614
|
+
requiredMessage: c = "This field is required",
|
|
615
|
+
externalError: T = !1,
|
|
616
|
+
externalErrorMessage: g = "",
|
|
617
|
+
confirmText: N = "Ok",
|
|
618
|
+
cancelText: f = "Cancel",
|
|
619
|
+
confirmButtonVariant: I = "danger",
|
|
620
|
+
onConfirm: j,
|
|
621
|
+
onCancel: L,
|
|
622
|
+
onInputChange: y
|
|
623
|
+
}) => {
|
|
624
|
+
const [h, b] = v(e), [p, u] = v(!1);
|
|
625
|
+
if (x(() => {
|
|
626
|
+
t && (b(e), u(!1));
|
|
627
|
+
}, [t, e]), x(() => {
|
|
628
|
+
T && u(!0);
|
|
629
|
+
}, [T]), !t) return null;
|
|
630
|
+
const B = s === "input" && !h.trim(), M = s === "input" && (B || T), ae = B ? c : T ? g : "", q = () => {
|
|
631
|
+
if (M) {
|
|
632
|
+
u(!0);
|
|
633
|
+
return;
|
|
634
|
+
}
|
|
635
|
+
j(h.trim());
|
|
636
|
+
};
|
|
637
|
+
return /* @__PURE__ */ r("div", { className: "template-studio-modal-overlay", children: /* @__PURE__ */ S("div", { className: "template-studio-modal", children: [
|
|
638
|
+
/* @__PURE__ */ S("div", { className: "template-studio-modal-header", children: [
|
|
639
|
+
/* @__PURE__ */ r("h4", { children: o }),
|
|
640
|
+
/* @__PURE__ */ r("button", { className: "template-studio-modal-close", onClick: L, children: "✕" })
|
|
641
|
+
] }),
|
|
642
|
+
/* @__PURE__ */ S("div", { className: "template-studio-modal-body", children: [
|
|
643
|
+
l && /* @__PURE__ */ r("p", { children: l }),
|
|
644
|
+
s === "input" && /* @__PURE__ */ S("div", { className: "mb-3", children: [
|
|
645
|
+
/* @__PURE__ */ S("label", { className: "form-label", children: [
|
|
646
|
+
i,
|
|
647
|
+
/* @__PURE__ */ r("span", { className: "text-danger", children: "*" })
|
|
648
|
+
] }),
|
|
649
|
+
/* @__PURE__ */ r(
|
|
650
|
+
"input",
|
|
651
|
+
{
|
|
652
|
+
type: "text",
|
|
653
|
+
className: `form-control ${p && M ? "is-invalid" : ""}`,
|
|
654
|
+
placeholder: a,
|
|
655
|
+
value: h,
|
|
656
|
+
onChange: (V) => {
|
|
657
|
+
b(V.target.value), p && u(!1), y?.(V.target.value);
|
|
658
|
+
},
|
|
659
|
+
autoFocus: !0
|
|
660
|
+
}
|
|
661
|
+
),
|
|
662
|
+
p && M && /* @__PURE__ */ r("div", { className: "invalid-feedback d-block", children: ae })
|
|
663
|
+
] })
|
|
664
|
+
] }),
|
|
665
|
+
/* @__PURE__ */ S("div", { className: "template-studio-modal-footer", children: [
|
|
666
|
+
/* @__PURE__ */ r("button", { className: "btn btn-secondary", onClick: L, children: f }),
|
|
667
|
+
/* @__PURE__ */ r(
|
|
668
|
+
"button",
|
|
669
|
+
{
|
|
670
|
+
className: `btn btn-${I}`,
|
|
671
|
+
onClick: q,
|
|
672
|
+
children: N
|
|
673
|
+
}
|
|
674
|
+
)
|
|
675
|
+
] })
|
|
676
|
+
] }) });
|
|
677
|
+
}, ct = () => {
|
|
678
|
+
const t = K(), { enerexIdentifier: s, projectId: o } = R();
|
|
679
|
+
return le({
|
|
609
680
|
queryKey: ["getTemplatesList"],
|
|
610
|
-
queryFn: async (
|
|
611
|
-
`${
|
|
681
|
+
queryFn: async (i) => await t.get(
|
|
682
|
+
`${Q.Template_list}${o}/${s}`
|
|
612
683
|
)
|
|
613
684
|
});
|
|
614
685
|
};
|
|
615
|
-
function
|
|
686
|
+
function fe(t) {
|
|
616
687
|
return t.sort((s, o) => s.name.localeCompare(o.name));
|
|
617
688
|
}
|
|
618
|
-
function
|
|
689
|
+
function pt(t) {
|
|
619
690
|
const s = /* @__PURE__ */ new Map(), o = [];
|
|
620
691
|
t.forEach((e) => s.set(e.id, e));
|
|
621
|
-
let
|
|
622
|
-
for (;
|
|
623
|
-
o.push({ level:
|
|
624
|
-
const e =
|
|
625
|
-
|
|
692
|
+
let l = t.filter((e) => e.parent_id === 0), i = 0;
|
|
693
|
+
for (; l.length > 0; ) {
|
|
694
|
+
o.push({ level: i, data: l });
|
|
695
|
+
const e = l.map((c) => c.id);
|
|
696
|
+
l = t.filter(
|
|
626
697
|
(c) => e.includes(c.parent_id)
|
|
627
|
-
),
|
|
698
|
+
), i++;
|
|
628
699
|
}
|
|
629
700
|
return o;
|
|
630
701
|
}
|
|
631
|
-
function
|
|
632
|
-
const
|
|
633
|
-
return
|
|
702
|
+
function ye(t, s) {
|
|
703
|
+
const l = pt(t).find((i) => i.level === s);
|
|
704
|
+
return l ? l.data : [];
|
|
634
705
|
}
|
|
635
|
-
const
|
|
636
|
-
const t =
|
|
637
|
-
return
|
|
706
|
+
const mt = () => {
|
|
707
|
+
const t = K(), { enerexIdentifier: s, projectId: o } = R();
|
|
708
|
+
return Le({
|
|
638
709
|
mutationKey: ["getTemplate"],
|
|
639
|
-
mutationFn: async ({ id:
|
|
640
|
-
if (
|
|
710
|
+
mutationFn: async ({ id: i }) => {
|
|
711
|
+
if (i)
|
|
641
712
|
return await t.get(
|
|
642
|
-
`${
|
|
713
|
+
`${Q.Template}${s}/${i}/${o}`
|
|
643
714
|
);
|
|
644
715
|
}
|
|
645
716
|
});
|
|
646
|
-
},
|
|
647
|
-
const t =
|
|
648
|
-
return
|
|
717
|
+
}, ut = () => {
|
|
718
|
+
const t = K(), { enerexIdentifier: s, projectId: o } = R();
|
|
719
|
+
return le({
|
|
649
720
|
queryKey: ["getTemplateTypes"],
|
|
650
|
-
queryFn: async (
|
|
651
|
-
`${
|
|
721
|
+
queryFn: async (i) => await t.get(
|
|
722
|
+
`${Q.TemplateTypes}${s}/${o}`
|
|
652
723
|
)
|
|
653
724
|
});
|
|
654
725
|
};
|
|
655
|
-
function
|
|
726
|
+
function ft(t) {
|
|
656
727
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
657
728
|
}
|
|
658
|
-
var
|
|
729
|
+
var ge = { exports: {} };
|
|
659
730
|
/*!
|
|
660
731
|
Copyright (c) 2018 Jed Watson.
|
|
661
732
|
Licensed under the MIT License (MIT), see
|
|
662
733
|
http://jedwatson.github.io/classnames
|
|
663
734
|
*/
|
|
664
|
-
var
|
|
665
|
-
function
|
|
666
|
-
return
|
|
735
|
+
var Ne;
|
|
736
|
+
function yt() {
|
|
737
|
+
return Ne || (Ne = 1, function(t) {
|
|
667
738
|
(function() {
|
|
668
739
|
var s = {}.hasOwnProperty;
|
|
669
740
|
function o() {
|
|
670
741
|
for (var e = "", a = 0; a < arguments.length; a++) {
|
|
671
742
|
var c = arguments[a];
|
|
672
|
-
c && (e =
|
|
743
|
+
c && (e = i(e, l(c)));
|
|
673
744
|
}
|
|
674
745
|
return e;
|
|
675
746
|
}
|
|
676
|
-
function
|
|
747
|
+
function l(e) {
|
|
677
748
|
if (typeof e == "string" || typeof e == "number")
|
|
678
749
|
return e;
|
|
679
750
|
if (typeof e != "object")
|
|
@@ -684,18 +755,18 @@ function tt() {
|
|
|
684
755
|
return e.toString();
|
|
685
756
|
var a = "";
|
|
686
757
|
for (var c in e)
|
|
687
|
-
s.call(e, c) && e[c] && (a =
|
|
758
|
+
s.call(e, c) && e[c] && (a = i(a, c));
|
|
688
759
|
return a;
|
|
689
760
|
}
|
|
690
|
-
function
|
|
761
|
+
function i(e, a) {
|
|
691
762
|
return a ? e ? e + " " + a : e + a : e;
|
|
692
763
|
}
|
|
693
764
|
t.exports ? (o.default = o, t.exports = o) : window.classNames = o;
|
|
694
765
|
})();
|
|
695
|
-
}(
|
|
766
|
+
}(ge)), ge.exports;
|
|
696
767
|
}
|
|
697
|
-
var
|
|
698
|
-
const
|
|
768
|
+
var gt = yt();
|
|
769
|
+
const Ie = /* @__PURE__ */ ft(gt), _e = (t) => t.data.isSeparator ? /* @__PURE__ */ r("div", { style: { padding: 0, margin: "2px 0" }, children: /* @__PURE__ */ r(
|
|
699
770
|
"hr",
|
|
700
771
|
{
|
|
701
772
|
style: {
|
|
@@ -705,25 +776,25 @@ const he = /* @__PURE__ */ et(nt), be = (t) => t.data.isSeparator ? /* @__PURE__
|
|
|
705
776
|
margin: 0
|
|
706
777
|
}
|
|
707
778
|
}
|
|
708
|
-
) }) : /* @__PURE__ */
|
|
779
|
+
) }) : /* @__PURE__ */ r(tt.Option, { ...t }), ht = ({
|
|
709
780
|
name: t = "",
|
|
710
781
|
control: s,
|
|
711
782
|
options: o,
|
|
712
|
-
multiple:
|
|
713
|
-
placeholder:
|
|
783
|
+
multiple: l = !1,
|
|
784
|
+
placeholder: i,
|
|
714
785
|
validation: e,
|
|
715
786
|
labelKey: a = "name",
|
|
716
787
|
disabled: c,
|
|
717
788
|
isInvalid: T,
|
|
718
|
-
value:
|
|
719
|
-
onChange:
|
|
789
|
+
value: g,
|
|
790
|
+
onChange: N,
|
|
720
791
|
uncontrolled: f,
|
|
721
|
-
menuPlacement:
|
|
722
|
-
closeOnSelect:
|
|
792
|
+
menuPlacement: I = "auto",
|
|
793
|
+
closeOnSelect: j = !0
|
|
723
794
|
}) => {
|
|
724
|
-
const
|
|
725
|
-
control: (
|
|
726
|
-
...
|
|
795
|
+
const L = {
|
|
796
|
+
control: (y) => ({
|
|
797
|
+
...y,
|
|
727
798
|
minHeight: "33px",
|
|
728
799
|
// state.isFocused can display different borderColor if you need it
|
|
729
800
|
borderColor: T ? "var(--bs-form-invalid-border-color) !important" : "var(--ct-input-border-color)",
|
|
@@ -744,505 +815,586 @@ const he = /* @__PURE__ */ et(nt), be = (t) => t.data.isSeparator ? /* @__PURE__
|
|
|
744
815
|
display: "none"
|
|
745
816
|
}
|
|
746
817
|
}),
|
|
747
|
-
menu: (
|
|
748
|
-
...
|
|
818
|
+
menu: (y) => ({
|
|
819
|
+
...y,
|
|
749
820
|
marginTop: 0,
|
|
750
821
|
width: "max-content",
|
|
751
822
|
minWidth: "100%"
|
|
752
823
|
}),
|
|
753
|
-
menuPortal: (
|
|
754
|
-
...
|
|
824
|
+
menuPortal: (y) => ({
|
|
825
|
+
...y,
|
|
755
826
|
zIndex: 9999
|
|
756
827
|
}),
|
|
757
|
-
multiValueRemove: (
|
|
758
|
-
...
|
|
828
|
+
multiValueRemove: (y) => ({
|
|
829
|
+
...y,
|
|
759
830
|
display: c ? "none" : "block"
|
|
760
831
|
})
|
|
761
832
|
};
|
|
762
|
-
return f ? /* @__PURE__ */
|
|
763
|
-
|
|
833
|
+
return f ? /* @__PURE__ */ r(
|
|
834
|
+
Ce,
|
|
764
835
|
{
|
|
765
|
-
components: { Option:
|
|
766
|
-
isOptionDisabled: (
|
|
767
|
-
className:
|
|
836
|
+
components: { Option: _e },
|
|
837
|
+
isOptionDisabled: (y) => !!y.isSeparator,
|
|
838
|
+
className: Ie({
|
|
768
839
|
"is-invalid": T
|
|
769
840
|
}),
|
|
770
|
-
styles:
|
|
841
|
+
styles: L,
|
|
771
842
|
classNamePrefix: "react-select",
|
|
772
|
-
isMulti:
|
|
843
|
+
isMulti: l,
|
|
773
844
|
options: o,
|
|
774
|
-
onChange:
|
|
775
|
-
placeholder:
|
|
845
|
+
onChange: N,
|
|
846
|
+
placeholder: i,
|
|
776
847
|
menuPortalTarget: document.body,
|
|
777
|
-
value:
|
|
778
|
-
getOptionLabel: typeof a == "string" ? (
|
|
779
|
-
getOptionValue: (
|
|
848
|
+
value: g,
|
|
849
|
+
getOptionLabel: typeof a == "string" ? (y) => y[a] : a,
|
|
850
|
+
getOptionValue: (y) => y.id,
|
|
780
851
|
isDisabled: c,
|
|
781
|
-
menuPlacement:
|
|
782
|
-
closeMenuOnSelect:
|
|
852
|
+
menuPlacement: I,
|
|
853
|
+
closeMenuOnSelect: j
|
|
783
854
|
}
|
|
784
|
-
) : /* @__PURE__ */
|
|
785
|
-
|
|
855
|
+
) : /* @__PURE__ */ r(
|
|
856
|
+
Ze,
|
|
786
857
|
{
|
|
787
858
|
control: s,
|
|
788
859
|
name: t,
|
|
789
860
|
rules: e,
|
|
790
|
-
render: ({ field: { onChange:
|
|
791
|
-
|
|
861
|
+
render: ({ field: { onChange: y, value: h, onBlur: b } }) => /* @__PURE__ */ r(
|
|
862
|
+
Ce,
|
|
792
863
|
{
|
|
793
|
-
components: { Option:
|
|
794
|
-
isOptionDisabled: (
|
|
795
|
-
className:
|
|
864
|
+
components: { Option: _e },
|
|
865
|
+
isOptionDisabled: (p) => !!p.isSeparator,
|
|
866
|
+
className: Ie({
|
|
796
867
|
"is-invalid": T
|
|
797
868
|
}),
|
|
798
|
-
styles:
|
|
869
|
+
styles: L,
|
|
799
870
|
classNamePrefix: "react-select",
|
|
800
|
-
isMulti:
|
|
871
|
+
isMulti: l,
|
|
801
872
|
options: o,
|
|
802
|
-
onBlur:
|
|
803
|
-
onChange:
|
|
804
|
-
placeholder:
|
|
873
|
+
onBlur: b,
|
|
874
|
+
onChange: y,
|
|
875
|
+
placeholder: i,
|
|
805
876
|
menuPortalTarget: document.body,
|
|
806
877
|
value: h,
|
|
807
|
-
getOptionLabel: typeof a == "string" ? (
|
|
808
|
-
getOptionValue: (
|
|
878
|
+
getOptionLabel: typeof a == "string" ? (p) => p[a] : a,
|
|
879
|
+
getOptionValue: (p) => p.id,
|
|
809
880
|
isDisabled: c,
|
|
810
|
-
menuPlacement:
|
|
811
|
-
closeMenuOnSelect:
|
|
881
|
+
menuPlacement: I,
|
|
882
|
+
closeMenuOnSelect: j
|
|
812
883
|
},
|
|
813
884
|
h ? JSON.stringify(h) : "reset"
|
|
814
885
|
)
|
|
815
886
|
}
|
|
816
887
|
);
|
|
817
|
-
},
|
|
888
|
+
}, se = ({
|
|
818
889
|
label: t,
|
|
819
890
|
name: s,
|
|
820
891
|
validation: o,
|
|
821
|
-
control:
|
|
822
|
-
error:
|
|
892
|
+
control: l,
|
|
893
|
+
error: i,
|
|
823
894
|
...e
|
|
824
|
-
}) => /* @__PURE__ */
|
|
825
|
-
t && /* @__PURE__ */
|
|
895
|
+
}) => /* @__PURE__ */ S(F.Group, { className: "mb-1", children: [
|
|
896
|
+
t && /* @__PURE__ */ S(F.Label, { className: "mb-3 d-block form-label ts-label-height", children: [
|
|
826
897
|
t,
|
|
827
898
|
" ",
|
|
828
|
-
e.required && /* @__PURE__ */
|
|
899
|
+
e.required && /* @__PURE__ */ r("span", { className: "text-danger", children: "*" })
|
|
829
900
|
] }),
|
|
830
|
-
/* @__PURE__ */
|
|
831
|
-
|
|
901
|
+
/* @__PURE__ */ r(
|
|
902
|
+
ht,
|
|
832
903
|
{
|
|
833
|
-
control:
|
|
904
|
+
control: l,
|
|
834
905
|
disabled: e.disabled,
|
|
835
906
|
options: e.options ?? [],
|
|
836
907
|
validation: o,
|
|
837
|
-
isInvalid:
|
|
908
|
+
isInvalid: i && !!i[s],
|
|
838
909
|
name: s
|
|
839
910
|
}
|
|
840
911
|
),
|
|
841
|
-
|
|
842
|
-
] }),
|
|
843
|
-
const t =
|
|
844
|
-
|
|
912
|
+
i && i[s] ? /* @__PURE__ */ r(F.Control.Feedback, { type: "invalid", children: i[s].message }) : null
|
|
913
|
+
] }), bt = () => {
|
|
914
|
+
const t = K();
|
|
915
|
+
Je();
|
|
845
916
|
const { enerexIdentifier: s, projectId: o } = R();
|
|
846
|
-
return
|
|
917
|
+
return Le({
|
|
847
918
|
mutationKey: ["saveTemplate"],
|
|
848
|
-
mutationFn: async (
|
|
849
|
-
`${
|
|
850
|
-
|
|
919
|
+
mutationFn: async (i) => (i.enerexIdentifier = s ?? "", i.projectId = o ?? "", await t.post(
|
|
920
|
+
`${Q.SaveTemplate}`,
|
|
921
|
+
i
|
|
851
922
|
))
|
|
852
923
|
});
|
|
853
|
-
},
|
|
924
|
+
}, z = {
|
|
854
925
|
id: "",
|
|
855
926
|
name: "New (Blank)"
|
|
856
|
-
},
|
|
927
|
+
}, Ae = {
|
|
857
928
|
id: "",
|
|
858
929
|
name: "Separator",
|
|
859
930
|
isSeparator: !0
|
|
860
|
-
},
|
|
931
|
+
}, Tt = ({
|
|
861
932
|
onSelectItem: t,
|
|
862
933
|
templateLoading: s,
|
|
863
934
|
onReset: o,
|
|
864
|
-
editorInitialized:
|
|
935
|
+
editorInitialized: l
|
|
865
936
|
}) => {
|
|
866
|
-
const { isAdmin:
|
|
937
|
+
const { isAdmin: i, defaultSelector: e } = R(), {
|
|
867
938
|
register: a,
|
|
868
939
|
handleSubmit: c,
|
|
869
940
|
clearErrors: T,
|
|
870
|
-
setValue:
|
|
871
|
-
control:
|
|
941
|
+
setValue: g,
|
|
942
|
+
control: N,
|
|
872
943
|
watch: f,
|
|
873
|
-
reset:
|
|
874
|
-
setError:
|
|
875
|
-
|
|
876
|
-
|
|
944
|
+
reset: I,
|
|
945
|
+
setError: j,
|
|
946
|
+
getValues: L,
|
|
947
|
+
formState: { errors: y }
|
|
948
|
+
} = et({
|
|
877
949
|
defaultValues: {
|
|
878
950
|
templateName: "",
|
|
879
951
|
subTemplateType: void 0,
|
|
880
952
|
subTemplateType2: void 0,
|
|
881
953
|
subject: "",
|
|
882
954
|
templateType: void 0,
|
|
883
|
-
template:
|
|
955
|
+
template: z
|
|
884
956
|
},
|
|
885
957
|
mode: "onChange"
|
|
886
958
|
}), {
|
|
887
|
-
data:
|
|
888
|
-
refetch:
|
|
889
|
-
isLoading:
|
|
890
|
-
} =
|
|
891
|
-
|
|
959
|
+
data: h,
|
|
960
|
+
refetch: b,
|
|
961
|
+
isLoading: p
|
|
962
|
+
} = ct(), [u, B] = v([]), [M, ae] = v(!1), [q, V] = v(), [X, Z] = v(), { mutateAsync: oe, isPending: _ } = mt(), { mutateAsync: de, isPending: A } = bt(), { data: U, isLoading: $ } = ut(), [ce, qe] = v([]), [P, ee] = v([]), [O, te] = v([]), [$e, pe] = v(!1), [G, ke] = v("confirm"), [Re, me] = v(!1), [he, be] = v(!1);
|
|
963
|
+
x(() => {
|
|
892
964
|
if (U) {
|
|
893
|
-
let n = U.filter((
|
|
894
|
-
|
|
965
|
+
let n = U.filter((m) => m.id != null), d = ye(n, 0);
|
|
966
|
+
qe(fe(d));
|
|
895
967
|
}
|
|
896
968
|
}, [U]);
|
|
897
|
-
const
|
|
898
|
-
let
|
|
899
|
-
return n.forEach((
|
|
900
|
-
d.includes(
|
|
901
|
-
}),
|
|
969
|
+
const Be = (n, d) => {
|
|
970
|
+
let m = [];
|
|
971
|
+
return n.forEach((C, E) => {
|
|
972
|
+
d.includes(E) && E !== 0 && m.push(Ae), m.push(C);
|
|
973
|
+
}), m;
|
|
902
974
|
};
|
|
903
|
-
|
|
904
|
-
s(!!(
|
|
905
|
-
}, [
|
|
906
|
-
|
|
907
|
-
}, [
|
|
908
|
-
const
|
|
909
|
-
|
|
910
|
-
const d = await
|
|
911
|
-
|
|
975
|
+
x(() => {
|
|
976
|
+
s(!!(p || _ || A || $ || !l));
|
|
977
|
+
}, [p, _, A, $, l]), x(() => {
|
|
978
|
+
h?.sort((n, d) => n.readonly !== d.readonly ? (n.readonly ? 0 : 1) - (d.readonly ? 0 : 1) : n.name.localeCompare(d.name)), B(h ?? []);
|
|
979
|
+
}, [h]);
|
|
980
|
+
const Me = async (n) => {
|
|
981
|
+
V(n), n && (i || !n.readonly) ? (g("templateName", n?.name), T()) : (g("templateName", ""), g("subject", ""));
|
|
982
|
+
const d = await oe({ id: n?.id });
|
|
983
|
+
d ? Z(d) : ne();
|
|
912
984
|
};
|
|
913
|
-
|
|
914
|
-
if ((e === void 0 || e.templateId === void 0 ||
|
|
915
|
-
let n = U?.filter((
|
|
916
|
-
|
|
917
|
-
|
|
985
|
+
x(() => {
|
|
986
|
+
if ((e === void 0 || e.templateId === void 0 || M) && g("template", z), f("templateType")) {
|
|
987
|
+
let n = U?.filter((m) => m.id !== void 0) ?? [], d = ye(n, 1);
|
|
988
|
+
ee(
|
|
989
|
+
fe(
|
|
918
990
|
d.filter(
|
|
919
|
-
(
|
|
991
|
+
(m) => m.parent_id.toString() === `${f("templateType")?.id}`
|
|
920
992
|
)
|
|
921
993
|
)
|
|
922
|
-
),
|
|
994
|
+
), g("subTemplateType", void 0), g("subTemplateType2", void 0);
|
|
923
995
|
}
|
|
924
|
-
}, [f("templateType")]),
|
|
925
|
-
if ((e === void 0 || e.templateId === void 0) &&
|
|
926
|
-
let n = U?.filter((
|
|
927
|
-
|
|
928
|
-
|
|
996
|
+
}, [f("templateType")]), x(() => {
|
|
997
|
+
if ((e === void 0 || e.templateId === void 0) && g("template", z), f("subTemplateType")) {
|
|
998
|
+
let n = U?.filter((m) => m.id !== void 0) ?? [], d = ye(n, 2);
|
|
999
|
+
te(
|
|
1000
|
+
fe(
|
|
929
1001
|
d.filter(
|
|
930
|
-
(
|
|
1002
|
+
(m) => m.parent_id.toString() === `${f("subTemplateType")?.id}`
|
|
931
1003
|
)
|
|
932
1004
|
)
|
|
933
|
-
),
|
|
1005
|
+
), g("subTemplateType2", void 0);
|
|
934
1006
|
}
|
|
935
|
-
}, [f("subTemplateType")]),
|
|
936
|
-
const n =
|
|
937
|
-
n.length > 0 && n[0].id !== "" ? (e === void 0 || e.templateId === void 0 ||
|
|
938
|
-
}, [f("subTemplateType2")]),
|
|
939
|
-
let n =
|
|
940
|
-
|
|
1007
|
+
}, [f("subTemplateType")]), x(() => {
|
|
1008
|
+
const n = ve();
|
|
1009
|
+
n.length > 0 && n[0].id !== "" ? (e === void 0 || e.templateId === void 0 || M) && g("template", n[0]) : (e === void 0 || e.templateId === void 0 || M) && g("template", z);
|
|
1010
|
+
}, [f("subTemplateType2")]), x(() => {
|
|
1011
|
+
let n = u.find((d) => d.id === f("template")?.id);
|
|
1012
|
+
Me(n);
|
|
941
1013
|
}, [f("template")]);
|
|
942
|
-
const [
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
}, 1e3))
|
|
947
|
-
}, [
|
|
948
|
-
const
|
|
949
|
-
let n = [
|
|
950
|
-
|
|
951
|
-
let
|
|
952
|
-
(
|
|
953
|
-
),
|
|
954
|
-
return
|
|
1014
|
+
const [Ue, Te] = v(!1);
|
|
1015
|
+
x(() => {
|
|
1016
|
+
he || Ue || X && q && l && (Te(!0), t(X), g("subject", X.subject ?? ""), setTimeout(() => {
|
|
1017
|
+
Te(!1);
|
|
1018
|
+
}, 1e3));
|
|
1019
|
+
}, [X, q, l, he]);
|
|
1020
|
+
const ve = () => {
|
|
1021
|
+
let n = [z], d = "templateType";
|
|
1022
|
+
O.length > 0 ? d = "subTemplateType2" : P.length > 0 && (d = "subTemplateType");
|
|
1023
|
+
let m = u.filter(
|
|
1024
|
+
(E) => (E.type?.toString() === f(d)?.id.toString() || E.type === null) && f(d)?.id != null
|
|
1025
|
+
), C = Be(m, [m.findIndex((E) => !E.readonly)]);
|
|
1026
|
+
return C.length > 0 && (C[0].readonly === !0 && !i ? n = [] : n.push(Ae), n = [
|
|
955
1027
|
...n,
|
|
956
|
-
...
|
|
957
|
-
id:
|
|
958
|
-
name:
|
|
959
|
-
isSeparator:
|
|
1028
|
+
...C.map((w) => ({
|
|
1029
|
+
id: w.id,
|
|
1030
|
+
name: He(m, w.id),
|
|
1031
|
+
isSeparator: w.isSeparator
|
|
960
1032
|
}))
|
|
961
1033
|
]), n.length ? n : [];
|
|
962
1034
|
};
|
|
963
|
-
|
|
1035
|
+
x(() => {
|
|
964
1036
|
if (e && e.type1) {
|
|
965
|
-
const n =
|
|
1037
|
+
const n = ce?.find(
|
|
966
1038
|
(d) => `${d.id}` === e.type1
|
|
967
1039
|
);
|
|
968
|
-
|
|
1040
|
+
g("templateType", n);
|
|
969
1041
|
}
|
|
970
|
-
}, [U,
|
|
1042
|
+
}, [U, ce]), x(() => {
|
|
971
1043
|
if (e && e.type2) {
|
|
972
|
-
const n =
|
|
1044
|
+
const n = P?.find(
|
|
973
1045
|
(d) => `${d.id}` === e.type2
|
|
974
1046
|
);
|
|
975
|
-
|
|
1047
|
+
g("subTemplateType", n);
|
|
976
1048
|
}
|
|
977
|
-
}, [U,
|
|
1049
|
+
}, [U, P]), x(() => {
|
|
978
1050
|
if (e && e.type3) {
|
|
979
|
-
const n =
|
|
1051
|
+
const n = O?.find(
|
|
980
1052
|
(d) => `${d.id}` === e.type3
|
|
981
1053
|
);
|
|
982
|
-
|
|
1054
|
+
g("subTemplateType2", n);
|
|
983
1055
|
}
|
|
984
|
-
}, [U,
|
|
985
|
-
if (e && e.templateId &&
|
|
986
|
-
const n =
|
|
1056
|
+
}, [U, O]), x(() => {
|
|
1057
|
+
if (e && e.templateId && u && u.length > 0 && !M && l) {
|
|
1058
|
+
const n = u?.find(
|
|
987
1059
|
(d) => `${d.id}` === e.templateId
|
|
988
1060
|
);
|
|
989
|
-
|
|
1061
|
+
ae(!0), n && (V(n), g("template", n));
|
|
990
1062
|
}
|
|
991
|
-
}, [
|
|
992
|
-
const
|
|
993
|
-
let
|
|
994
|
-
return
|
|
995
|
-
},
|
|
1063
|
+
}, [u, l]);
|
|
1064
|
+
const He = (n, d) => {
|
|
1065
|
+
let m = n.find((C) => C.id === d);
|
|
1066
|
+
return m ? `${m.displayName}` : "";
|
|
1067
|
+
}, Fe = (n) => {
|
|
996
1068
|
window.StripoEditorApi.actionsApi.getTemplateData(
|
|
997
1069
|
async (d) => {
|
|
998
|
-
let
|
|
999
|
-
|
|
1000
|
-
let
|
|
1001
|
-
(
|
|
1070
|
+
let m = n.template.id, C = "";
|
|
1071
|
+
q?.readonly && (m = "", C = n.template.id);
|
|
1072
|
+
let E = u.find(
|
|
1073
|
+
(D) => D.name === n.templateName.trim()
|
|
1002
1074
|
);
|
|
1003
|
-
if (
|
|
1004
|
-
|
|
1075
|
+
if (E && E.id !== m) {
|
|
1076
|
+
j("templateName", {
|
|
1005
1077
|
type: "validate",
|
|
1006
1078
|
message: "Template name already exists. Please choose a different name."
|
|
1007
1079
|
});
|
|
1008
1080
|
return;
|
|
1009
1081
|
}
|
|
1010
|
-
let
|
|
1011
|
-
|
|
1012
|
-
const
|
|
1082
|
+
let w = n.templateType.id;
|
|
1083
|
+
O && O.length > 0 ? w = n.subTemplateType2.id : P && P.length > 0 && (w = n.subTemplateType.id);
|
|
1084
|
+
const W = {
|
|
1013
1085
|
enerexIdentifier: "",
|
|
1014
1086
|
projectId: "",
|
|
1015
|
-
templateId:
|
|
1016
|
-
templateType:
|
|
1087
|
+
templateId: m,
|
|
1088
|
+
templateType: w,
|
|
1017
1089
|
name: n.templateName.trim(),
|
|
1018
1090
|
html: d.html,
|
|
1019
1091
|
css: d.css,
|
|
1020
1092
|
subject: n.templateType.id === "2" ? n?.subject ?? "" : "",
|
|
1021
|
-
parent_id:
|
|
1093
|
+
parent_id: C
|
|
1022
1094
|
};
|
|
1023
|
-
if (await de(
|
|
1024
|
-
if (T(),
|
|
1025
|
-
|
|
1095
|
+
if (await de(W)) {
|
|
1096
|
+
if (T(), q?.readonly && !i)
|
|
1097
|
+
I(), ee([]), te([]);
|
|
1026
1098
|
else {
|
|
1027
|
-
const
|
|
1028
|
-
|
|
1099
|
+
const D = await oe({ id: m });
|
|
1100
|
+
D ? Z(D) : ne();
|
|
1029
1101
|
}
|
|
1030
|
-
|
|
1102
|
+
b();
|
|
1031
1103
|
}
|
|
1032
1104
|
}
|
|
1033
1105
|
);
|
|
1034
|
-
},
|
|
1106
|
+
}, ne = () => {
|
|
1107
|
+
be(!0), s(!1), Z(void 0), t(void 0), setTimeout(() => {
|
|
1108
|
+
be(!1);
|
|
1109
|
+
}, 0);
|
|
1110
|
+
}, Ve = (n, d) => {
|
|
1111
|
+
const m = d.trim(), C = "";
|
|
1112
|
+
if (u.find(
|
|
1113
|
+
(w) => w.name === m && w.id !== C
|
|
1114
|
+
)) {
|
|
1115
|
+
me(!0);
|
|
1116
|
+
return;
|
|
1117
|
+
}
|
|
1118
|
+
pe(!1), window.StripoEditorApi.actionsApi.getTemplateData(
|
|
1119
|
+
async (w) => {
|
|
1120
|
+
const W = n.template.id;
|
|
1121
|
+
let Y = n.templateType.id;
|
|
1122
|
+
O?.length ? Y = n.subTemplateType2.id : P?.length && (Y = n.subTemplateType.id);
|
|
1123
|
+
const D = {
|
|
1124
|
+
enerexIdentifier: "",
|
|
1125
|
+
projectId: "",
|
|
1126
|
+
templateId: C,
|
|
1127
|
+
templateType: Y,
|
|
1128
|
+
name: m,
|
|
1129
|
+
html: w.html,
|
|
1130
|
+
css: w.css,
|
|
1131
|
+
subject: n.templateType.id === "2" ? n?.subject ?? "" : "",
|
|
1132
|
+
parent_id: W
|
|
1133
|
+
};
|
|
1134
|
+
await de(D) && (T(), ne(), I(), ee([]), te([]), b());
|
|
1135
|
+
}
|
|
1136
|
+
);
|
|
1137
|
+
}, Ge = (n) => {
|
|
1035
1138
|
window.StripoEditorApi.actionsApi.getTemplateData(
|
|
1036
1139
|
async (d) => {
|
|
1037
|
-
let
|
|
1038
|
-
(
|
|
1140
|
+
let m = n.template.id, C = "", E = u.find(
|
|
1141
|
+
(D) => D.name === n.templateName.trim()
|
|
1039
1142
|
);
|
|
1040
|
-
if (
|
|
1041
|
-
|
|
1143
|
+
if (E && E.id !== m) {
|
|
1144
|
+
j("templateName", {
|
|
1042
1145
|
type: "validate",
|
|
1043
1146
|
message: "Template name already exists. Please choose a different name."
|
|
1044
1147
|
});
|
|
1045
1148
|
return;
|
|
1046
1149
|
}
|
|
1047
|
-
let
|
|
1048
|
-
|
|
1049
|
-
const
|
|
1150
|
+
let w = n.templateType.id;
|
|
1151
|
+
O && O.length > 0 ? w = n.subTemplateType2.id : P && P.length > 0 && (w = n.subTemplateType.id);
|
|
1152
|
+
const W = {
|
|
1050
1153
|
enerexIdentifier: "",
|
|
1051
1154
|
projectId: "",
|
|
1052
|
-
templateId:
|
|
1053
|
-
templateType:
|
|
1155
|
+
templateId: m,
|
|
1156
|
+
templateType: w,
|
|
1054
1157
|
name: n.templateName.trim(),
|
|
1055
1158
|
html: d.html,
|
|
1056
1159
|
css: d.css,
|
|
1057
1160
|
subject: n.templateType.id === "2" ? n?.subject ?? "" : "",
|
|
1058
|
-
parent_id:
|
|
1161
|
+
parent_id: C
|
|
1059
1162
|
};
|
|
1060
|
-
if (await de(
|
|
1163
|
+
if (await de(W)) {
|
|
1061
1164
|
T();
|
|
1062
|
-
const
|
|
1063
|
-
|
|
1165
|
+
const D = await oe({ id: m });
|
|
1166
|
+
D ? Z(D) : ne(), b();
|
|
1064
1167
|
}
|
|
1065
1168
|
}
|
|
1066
1169
|
);
|
|
1170
|
+
}, Ke = () => {
|
|
1171
|
+
ke("input"), pe(!0), me(!1);
|
|
1172
|
+
}, Qe = (n) => {
|
|
1173
|
+
if (G === "input") {
|
|
1174
|
+
const d = L();
|
|
1175
|
+
Ve(d, n || "");
|
|
1176
|
+
return;
|
|
1177
|
+
}
|
|
1067
1178
|
};
|
|
1068
|
-
return /* @__PURE__ */
|
|
1069
|
-
/* @__PURE__ */
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
) }),
|
|
1087
|
-
L && L.length > 0 && /* @__PURE__ */ l(M, { children: /* @__PURE__ */ l(
|
|
1088
|
-
W,
|
|
1089
|
-
{
|
|
1090
|
-
label: "Type",
|
|
1091
|
-
control: C,
|
|
1092
|
-
error: x,
|
|
1093
|
-
options: L,
|
|
1094
|
-
required: !0,
|
|
1095
|
-
disabled: u || E || I || D || !i,
|
|
1096
|
-
validation: {
|
|
1097
|
-
required: {
|
|
1098
|
-
value: !0,
|
|
1099
|
-
message: "Select a type"
|
|
1100
|
-
}
|
|
1101
|
-
},
|
|
1102
|
-
...a("subTemplateType")
|
|
1103
|
-
}
|
|
1104
|
-
) }),
|
|
1105
|
-
j && j.length > 0 && /* @__PURE__ */ l(M, { children: /* @__PURE__ */ l(
|
|
1106
|
-
W,
|
|
1107
|
-
{
|
|
1108
|
-
label: "Sub Type",
|
|
1109
|
-
control: C,
|
|
1110
|
-
error: x,
|
|
1111
|
-
options: j,
|
|
1112
|
-
required: !0,
|
|
1113
|
-
disabled: u || E || I || D || !i,
|
|
1114
|
-
validation: {
|
|
1115
|
-
required: {
|
|
1116
|
-
value: !0,
|
|
1117
|
-
message: "Select a subtype"
|
|
1118
|
-
}
|
|
1119
|
-
},
|
|
1120
|
-
...a("subTemplateType2")
|
|
1121
|
-
}
|
|
1122
|
-
) }),
|
|
1123
|
-
/* @__PURE__ */ l(M, { children: /* @__PURE__ */ l(
|
|
1124
|
-
W,
|
|
1125
|
-
{
|
|
1126
|
-
label: "Template",
|
|
1127
|
-
control: C,
|
|
1128
|
-
error: x,
|
|
1129
|
-
disabled: u || E || I || D || !i,
|
|
1130
|
-
options: pe(),
|
|
1131
|
-
required: !1,
|
|
1132
|
-
...a("template")
|
|
1133
|
-
}
|
|
1134
|
-
) }),
|
|
1135
|
-
/* @__PURE__ */ l(M, { children: /* @__PURE__ */ l(
|
|
1136
|
-
ye,
|
|
1137
|
-
{
|
|
1138
|
-
label: "Name",
|
|
1139
|
-
register: a,
|
|
1140
|
-
error: x,
|
|
1141
|
-
required: !0,
|
|
1142
|
-
name: "templateName",
|
|
1143
|
-
validation: {
|
|
1144
|
-
required: {
|
|
1145
|
-
value: !0,
|
|
1146
|
-
message: "Enter a name"
|
|
1147
|
-
}
|
|
1179
|
+
return /* @__PURE__ */ S(we, { children: [
|
|
1180
|
+
/* @__PURE__ */ r(Se, { className: "border border-0 text-start", children: /* @__PURE__ */ r(Se.Body, { className: "pe-0 ps-2", children: /* @__PURE__ */ r("form", { children: /* @__PURE__ */ r("div", { className: "template-list-container gap-3", children: /* @__PURE__ */ S(Xe, { children: [
|
|
1181
|
+
/* @__PURE__ */ r(H, { children: /* @__PURE__ */ r(
|
|
1182
|
+
se,
|
|
1183
|
+
{
|
|
1184
|
+
label: "Category",
|
|
1185
|
+
control: N,
|
|
1186
|
+
error: y,
|
|
1187
|
+
options: ce,
|
|
1188
|
+
required: !0,
|
|
1189
|
+
disabled: p || _ || A || $ || !l,
|
|
1190
|
+
validation: {
|
|
1191
|
+
required: {
|
|
1192
|
+
value: !0,
|
|
1193
|
+
message: "Select a category"
|
|
1194
|
+
}
|
|
1195
|
+
},
|
|
1196
|
+
...a("templateType")
|
|
1148
1197
|
}
|
|
1149
|
-
}
|
|
1150
|
-
|
|
1151
|
-
f("templateType")?.id === "2" && /* @__PURE__ */ l(M, { children: /* @__PURE__ */ l(
|
|
1152
|
-
ye,
|
|
1153
|
-
{
|
|
1154
|
-
label: "Subject",
|
|
1155
|
-
register: a,
|
|
1156
|
-
error: x,
|
|
1157
|
-
required: !1,
|
|
1158
|
-
name: "subject"
|
|
1159
|
-
}
|
|
1160
|
-
) }),
|
|
1161
|
-
/* @__PURE__ */ $(M, { className: "d-flex align-self-start justify-content-end gap-2 mb-1 btn-padding", children: [
|
|
1162
|
-
/* @__PURE__ */ l(
|
|
1198
|
+
) }),
|
|
1199
|
+
P && P.length > 0 && /* @__PURE__ */ r(H, { children: /* @__PURE__ */ r(
|
|
1163
1200
|
se,
|
|
1164
1201
|
{
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1202
|
+
label: "Type",
|
|
1203
|
+
control: N,
|
|
1204
|
+
error: y,
|
|
1205
|
+
options: P,
|
|
1206
|
+
required: !0,
|
|
1207
|
+
disabled: p || _ || A || $ || !l,
|
|
1208
|
+
validation: {
|
|
1209
|
+
required: {
|
|
1210
|
+
value: !0,
|
|
1211
|
+
message: "Select a type"
|
|
1212
|
+
}
|
|
1170
1213
|
},
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1214
|
+
...a("subTemplateType")
|
|
1215
|
+
}
|
|
1216
|
+
) }),
|
|
1217
|
+
O && O.length > 0 && /* @__PURE__ */ r(H, { children: /* @__PURE__ */ r(
|
|
1218
|
+
se,
|
|
1219
|
+
{
|
|
1220
|
+
label: "Sub Type",
|
|
1221
|
+
control: N,
|
|
1222
|
+
error: y,
|
|
1223
|
+
options: O,
|
|
1224
|
+
required: !0,
|
|
1225
|
+
disabled: p || _ || A || $ || !l,
|
|
1226
|
+
validation: {
|
|
1227
|
+
required: {
|
|
1228
|
+
value: !0,
|
|
1229
|
+
message: "Select a subtype"
|
|
1180
1230
|
}
|
|
1181
|
-
|
|
1231
|
+
},
|
|
1232
|
+
...a("subTemplateType2")
|
|
1182
1233
|
}
|
|
1183
|
-
),
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1234
|
+
) }),
|
|
1235
|
+
/* @__PURE__ */ r(H, { children: /* @__PURE__ */ r(
|
|
1236
|
+
se,
|
|
1237
|
+
{
|
|
1238
|
+
label: "Template",
|
|
1239
|
+
control: N,
|
|
1240
|
+
error: y,
|
|
1241
|
+
disabled: p || _ || A || $ || !l,
|
|
1242
|
+
options: ve(),
|
|
1243
|
+
required: !1,
|
|
1244
|
+
...a("template")
|
|
1245
|
+
}
|
|
1246
|
+
) }),
|
|
1247
|
+
/* @__PURE__ */ r(H, { children: /* @__PURE__ */ r(
|
|
1248
|
+
Ee,
|
|
1249
|
+
{
|
|
1250
|
+
label: "Name",
|
|
1251
|
+
register: a,
|
|
1252
|
+
error: y,
|
|
1253
|
+
required: !0,
|
|
1254
|
+
name: "templateName",
|
|
1255
|
+
validation: {
|
|
1256
|
+
required: {
|
|
1257
|
+
value: !0,
|
|
1258
|
+
message: "Enter a name"
|
|
1259
|
+
}
|
|
1204
1260
|
}
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1261
|
+
}
|
|
1262
|
+
) }),
|
|
1263
|
+
f("templateType")?.id === "2" && /* @__PURE__ */ r(H, { children: /* @__PURE__ */ r(
|
|
1264
|
+
Ee,
|
|
1265
|
+
{
|
|
1266
|
+
label: "Subject",
|
|
1267
|
+
register: a,
|
|
1268
|
+
error: y,
|
|
1269
|
+
required: !1,
|
|
1270
|
+
name: "subject"
|
|
1271
|
+
}
|
|
1272
|
+
) }),
|
|
1273
|
+
/* @__PURE__ */ S(H, { className: "d-flex align-self-start justify-content-end gap-2 mb-1 btn-padding", children: [
|
|
1274
|
+
/* @__PURE__ */ r(
|
|
1275
|
+
re,
|
|
1208
1276
|
{
|
|
1209
|
-
|
|
1210
|
-
onClick: c(Oe),
|
|
1277
|
+
style: { width: "70px" },
|
|
1211
1278
|
variant: "primary",
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1279
|
+
disabled: p || _ || A || $ || !l,
|
|
1280
|
+
onClick: () => {
|
|
1281
|
+
V(void 0), I(), ee([]), te([]), o();
|
|
1282
|
+
},
|
|
1283
|
+
children: _ || A ? /* @__PURE__ */ r(
|
|
1284
|
+
J,
|
|
1216
1285
|
{
|
|
1217
1286
|
animation: "border",
|
|
1218
1287
|
style: { width: "11px", height: "11px" },
|
|
1219
1288
|
size: "sm",
|
|
1220
1289
|
role: "status",
|
|
1221
1290
|
className: "me-1",
|
|
1222
|
-
children: /* @__PURE__ */
|
|
1291
|
+
children: /* @__PURE__ */ r("span", { className: "visually-hidden", children: "Loading..." })
|
|
1223
1292
|
}
|
|
1224
|
-
) : "
|
|
1293
|
+
) : "Clear"
|
|
1225
1294
|
}
|
|
1226
|
-
)
|
|
1295
|
+
),
|
|
1296
|
+
(f("templateType")?.id.toString() !== "2" || (f("templateType")?.id.toString() === "2" && (q?.id ?? "")) !== "") && /* @__PURE__ */ S(we, { children: [
|
|
1297
|
+
!(q?.readonly && i) && /* @__PURE__ */ r(
|
|
1298
|
+
re,
|
|
1299
|
+
{
|
|
1300
|
+
type: "button",
|
|
1301
|
+
onClick: c(Fe),
|
|
1302
|
+
variant: "primary",
|
|
1303
|
+
style: { width: "80px" },
|
|
1304
|
+
disabled: p || _ || A || $ || !l,
|
|
1305
|
+
children: _ || A ? /* @__PURE__ */ r(
|
|
1306
|
+
J,
|
|
1307
|
+
{
|
|
1308
|
+
animation: "border",
|
|
1309
|
+
style: { width: "11px", height: "11px" },
|
|
1310
|
+
size: "sm",
|
|
1311
|
+
role: "status",
|
|
1312
|
+
className: "me-1",
|
|
1313
|
+
children: /* @__PURE__ */ r("span", { className: "visually-hidden", children: "Loading..." })
|
|
1314
|
+
}
|
|
1315
|
+
) : q?.readonly ? "Save as" : "Save"
|
|
1316
|
+
}
|
|
1317
|
+
),
|
|
1318
|
+
(f("templateType")?.id.toString() === "28" || f("subTemplateType")?.id.toString() === "9" && f("subTemplateType2")?.id.toString() === "12") && !!f("templateName")?.trim() && /* @__PURE__ */ r(
|
|
1319
|
+
re,
|
|
1320
|
+
{
|
|
1321
|
+
type: "button",
|
|
1322
|
+
variant: "primary",
|
|
1323
|
+
style: { width: "80px" },
|
|
1324
|
+
onClick: () => Ke(),
|
|
1325
|
+
disabled: p || _ || A || $ || !l,
|
|
1326
|
+
children: _ || A ? /* @__PURE__ */ r(
|
|
1327
|
+
J,
|
|
1328
|
+
{
|
|
1329
|
+
animation: "border",
|
|
1330
|
+
style: { width: "11px", height: "11px" },
|
|
1331
|
+
size: "sm",
|
|
1332
|
+
role: "status",
|
|
1333
|
+
className: "me-1",
|
|
1334
|
+
children: /* @__PURE__ */ r("span", { className: "visually-hidden", children: "Loading..." })
|
|
1335
|
+
}
|
|
1336
|
+
) : "Save as"
|
|
1337
|
+
}
|
|
1338
|
+
),
|
|
1339
|
+
q?.readonly && i && /* @__PURE__ */ r(
|
|
1340
|
+
re,
|
|
1341
|
+
{
|
|
1342
|
+
type: "button",
|
|
1343
|
+
onClick: c(Ge),
|
|
1344
|
+
variant: "primary",
|
|
1345
|
+
style: { width: "80px" },
|
|
1346
|
+
disabled: p || _ || A || $ || !l,
|
|
1347
|
+
children: _ || A ? /* @__PURE__ */ r(
|
|
1348
|
+
J,
|
|
1349
|
+
{
|
|
1350
|
+
animation: "border",
|
|
1351
|
+
style: { width: "11px", height: "11px" },
|
|
1352
|
+
size: "sm",
|
|
1353
|
+
role: "status",
|
|
1354
|
+
className: "me-1",
|
|
1355
|
+
children: /* @__PURE__ */ r("span", { className: "visually-hidden", children: "Loading..." })
|
|
1356
|
+
}
|
|
1357
|
+
) : "Save"
|
|
1358
|
+
}
|
|
1359
|
+
)
|
|
1360
|
+
] })
|
|
1227
1361
|
] })
|
|
1228
|
-
] })
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1362
|
+
] }) }) }) }) }),
|
|
1363
|
+
/* @__PURE__ */ r(
|
|
1364
|
+
dt,
|
|
1365
|
+
{
|
|
1366
|
+
show: $e,
|
|
1367
|
+
variant: G,
|
|
1368
|
+
title: G === "confirm" ? "Are you sure?" : "Save Template As",
|
|
1369
|
+
message: G === "confirm" ? 'Are you sure you want to remove custom template ""?' : "",
|
|
1370
|
+
label: "New Name",
|
|
1371
|
+
requiredMessage: "Enter a new name",
|
|
1372
|
+
externalError: Re,
|
|
1373
|
+
externalErrorMessage: "Template name already exists. Please choose a different name",
|
|
1374
|
+
confirmText: G === "confirm" ? "Ok" : "Save as",
|
|
1375
|
+
confirmButtonVariant: G === "confirm" ? "danger" : "primary",
|
|
1376
|
+
onConfirm: Qe,
|
|
1377
|
+
onCancel: () => pe(!1),
|
|
1378
|
+
onInputChange: () => me(!1)
|
|
1379
|
+
}
|
|
1380
|
+
)
|
|
1381
|
+
] });
|
|
1382
|
+
}, _t = ({ config: t }) => {
|
|
1383
|
+
const [s, o] = v(!1), [l, i] = v(), [e, a] = v(!1);
|
|
1384
|
+
x(() => {
|
|
1233
1385
|
t.isAdmin || a(!0);
|
|
1234
1386
|
}, []);
|
|
1235
|
-
const [c, T] =
|
|
1236
|
-
return /* @__PURE__ */
|
|
1237
|
-
/* @__PURE__ */
|
|
1238
|
-
|
|
1387
|
+
const [c, T] = v(!1);
|
|
1388
|
+
return /* @__PURE__ */ r(nt, { configs: t, children: /* @__PURE__ */ r(st, { children: /* @__PURE__ */ S("div", { className: "root-widget", children: [
|
|
1389
|
+
/* @__PURE__ */ r(
|
|
1390
|
+
Tt,
|
|
1239
1391
|
{
|
|
1240
1392
|
templateLoading: T,
|
|
1241
1393
|
onSelectItem: (f) => {
|
|
1242
|
-
if (
|
|
1243
|
-
let
|
|
1244
|
-
window.StripoEditorApi.actionsApi.updateHtmlAndCss(
|
|
1245
|
-
f?.html ??
|
|
1394
|
+
if (i(f), t.isAdmin && a(!0), window.StripoEditorApi && window.StripoEditorApi.actionsApi) {
|
|
1395
|
+
let I = ie;
|
|
1396
|
+
console.log("selected template:"), window.StripoEditorApi.actionsApi.updateHtmlAndCss(
|
|
1397
|
+
f?.html ?? I,
|
|
1246
1398
|
f?.css ?? "",
|
|
1247
1399
|
""
|
|
1248
1400
|
);
|
|
@@ -1250,21 +1402,21 @@ const he = /* @__PURE__ */ et(nt), be = (t) => t.data.isSeparator ? /* @__PURE__
|
|
|
1250
1402
|
},
|
|
1251
1403
|
editorInitialized: s,
|
|
1252
1404
|
onReset: () => {
|
|
1253
|
-
T(!1),
|
|
1254
|
-
|
|
1405
|
+
T(!1), i(void 0), window.StripoEditorApi && window.StripoEditorApi.actionsApi && window.StripoEditorApi.actionsApi.updateHtmlAndCss(
|
|
1406
|
+
ie,
|
|
1255
1407
|
"",
|
|
1256
1408
|
""
|
|
1257
1409
|
);
|
|
1258
1410
|
}
|
|
1259
1411
|
}
|
|
1260
1412
|
),
|
|
1261
|
-
e && /* @__PURE__ */
|
|
1262
|
-
|
|
1413
|
+
e && /* @__PURE__ */ r(
|
|
1414
|
+
ot,
|
|
1263
1415
|
{
|
|
1264
1416
|
onEditorInitialized: o,
|
|
1265
1417
|
templateHTML: {
|
|
1266
|
-
css:
|
|
1267
|
-
html:
|
|
1418
|
+
css: l?.css ?? "",
|
|
1419
|
+
html: l?.html ?? ie
|
|
1268
1420
|
},
|
|
1269
1421
|
loading: c,
|
|
1270
1422
|
className: "col-span-5"
|
|
@@ -1273,5 +1425,5 @@ const he = /* @__PURE__ */ et(nt), be = (t) => t.data.isSeparator ? /* @__PURE__
|
|
|
1273
1425
|
] }) }) });
|
|
1274
1426
|
};
|
|
1275
1427
|
export {
|
|
1276
|
-
|
|
1428
|
+
_t as EditorWidget
|
|
1277
1429
|
};
|