@enerex/template-studio 1.1.31 → 1.1.33
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 i, jsxs as I, Fragment as Ee } from "react/jsx-runtime";
|
|
2
|
+
import j, { useContext as de, useState as S, useRef as Ie, useEffect as E } from "react";
|
|
3
|
+
import { QueryClient as _e, QueryClientProvider as Ne, useQuery as z, useMutation as ce, useQueryClient as Pe } from "@tanstack/react-query";
|
|
4
|
+
import ee from "axios";
|
|
5
|
+
import { Spinner as J, Form as O, Card as te, Row as Ae, Col as A, Button as ne } from "react-bootstrap";
|
|
6
|
+
import { Controller as je, useForm as Oe } from "react-hook-form";
|
|
7
|
+
import re, { components as Le } from "react-select";
|
|
8
|
+
const F = `<!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,156 +361,155 @@ const U = `<!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 = j.createContext(
|
|
365
365
|
void 0
|
|
366
|
-
),
|
|
366
|
+
), Re = ({
|
|
367
367
|
children: e,
|
|
368
368
|
configs: r
|
|
369
369
|
}) => {
|
|
370
|
-
const [
|
|
370
|
+
const [s, l] = j.useState(r.clientId), [n, t] = j.useState(r.apiKey), [o, d] = j.useState(
|
|
371
371
|
r.enerexIdentifier
|
|
372
|
-
), [p,
|
|
373
|
-
t(
|
|
372
|
+
), [p, v] = j.useState(r.projectId), [N, b] = j.useState(r.userEmail), T = (w) => {
|
|
373
|
+
t(w.apiKey), l(w.clientId), v(w.projectId), d(w.enerexIdentifier), b(w.userEmail);
|
|
374
374
|
};
|
|
375
|
-
return /* @__PURE__ */
|
|
376
|
-
|
|
375
|
+
return /* @__PURE__ */ i(
|
|
376
|
+
pe.Provider,
|
|
377
377
|
{
|
|
378
378
|
value: {
|
|
379
|
-
clientId:
|
|
379
|
+
clientId: s,
|
|
380
380
|
apiKey: n,
|
|
381
381
|
setConfiguration: T,
|
|
382
|
-
enerexIdentifier:
|
|
383
|
-
projectId: p
|
|
382
|
+
enerexIdentifier: o,
|
|
383
|
+
projectId: p,
|
|
384
|
+
userEmail: N
|
|
384
385
|
},
|
|
385
386
|
children: e
|
|
386
387
|
}
|
|
387
388
|
);
|
|
388
|
-
},
|
|
389
|
-
const e =
|
|
389
|
+
}, _ = () => {
|
|
390
|
+
const e = de(pe);
|
|
390
391
|
if (!e)
|
|
391
392
|
throw new Error("widgetConfig must be used within a ConfigProvider");
|
|
392
393
|
return e;
|
|
393
|
-
},
|
|
394
|
+
}, me = (e = "", r) => ({ get: async (n, t) => {
|
|
394
395
|
try {
|
|
395
|
-
const
|
|
396
|
+
const o = await ee.get(
|
|
396
397
|
`${e}${n}`,
|
|
397
398
|
t ?? r
|
|
398
399
|
);
|
|
399
|
-
if (
|
|
400
|
-
return
|
|
401
|
-
} catch (
|
|
402
|
-
throw
|
|
400
|
+
if (o.status === 200)
|
|
401
|
+
return o.data;
|
|
402
|
+
} catch (o) {
|
|
403
|
+
throw o;
|
|
403
404
|
}
|
|
404
|
-
}, post: async (n, t,
|
|
405
|
+
}, post: async (n, t, o) => {
|
|
405
406
|
try {
|
|
406
|
-
const d = await
|
|
407
|
+
const d = await ee.post(
|
|
407
408
|
`${e}${n}`,
|
|
408
409
|
t,
|
|
409
|
-
|
|
410
|
+
o ?? r
|
|
410
411
|
);
|
|
411
412
|
if (d.status === 200)
|
|
412
413
|
return d.data;
|
|
413
414
|
} catch (d) {
|
|
414
415
|
throw d;
|
|
415
416
|
}
|
|
416
|
-
} }),
|
|
417
|
+
} }), H = {
|
|
417
418
|
EDITOR_SCRIPT_URL: "https://plugins.stripo.email/resources/uieditor/latest/UIEditor.js",
|
|
418
419
|
EDITOR_PLUGIN_ID: "1afdc3161ec7409a8627a1c8561d45f5",
|
|
419
420
|
EDITOR_SECRET_KEY: "54ba748ed7e94f2e929555783acb03da",
|
|
420
421
|
API_BASE_URL: "https://dev-socket.enerex.com/common/api"
|
|
421
422
|
//API_BASE_URL: "https://localhost:44338/api",
|
|
422
423
|
// more env variables...
|
|
423
|
-
},
|
|
424
|
+
}, ue = j.createContext({
|
|
424
425
|
get: () => {
|
|
425
426
|
throw new Error("HttpClientContext.get not implemented");
|
|
426
427
|
},
|
|
427
428
|
post: () => {
|
|
428
429
|
throw new Error("HttpClientContext.post not implemented");
|
|
429
430
|
}
|
|
430
|
-
}),
|
|
431
|
-
const { clientId: r, apiKey:
|
|
431
|
+
}), qe = ({ children: e }) => {
|
|
432
|
+
const { clientId: r, apiKey: s } = _(), l = {
|
|
432
433
|
headers: {
|
|
433
434
|
client_id: r,
|
|
434
|
-
"x-api-key":
|
|
435
|
+
"x-api-key": s
|
|
435
436
|
}
|
|
436
|
-
}, { get: n, post: t } =
|
|
437
|
-
return /* @__PURE__ */
|
|
438
|
-
},
|
|
439
|
-
const r = new
|
|
440
|
-
return /* @__PURE__ */
|
|
441
|
-
},
|
|
442
|
-
const r = Array.from(new Set(e.map((
|
|
443
|
-
return r.forEach((
|
|
444
|
-
const n = e.filter((t) => t.category ===
|
|
437
|
+
}, { get: n, post: t } = me(H.API_BASE_URL, l);
|
|
438
|
+
return /* @__PURE__ */ i(ue.Provider, { value: { get: n, post: t }, children: e });
|
|
439
|
+
}, De = ({ children: e }) => {
|
|
440
|
+
const r = new _e();
|
|
441
|
+
return /* @__PURE__ */ i(qe, { children: /* @__PURE__ */ i(Ne, { client: r, children: e }) });
|
|
442
|
+
}, $e = (e) => {
|
|
443
|
+
const r = Array.from(new Set(e.map((l) => l.category))), s = [];
|
|
444
|
+
return r.forEach((l) => {
|
|
445
|
+
const n = e.filter((t) => t.category === l).map((t) => ({
|
|
445
446
|
label: t.label,
|
|
446
447
|
value: t.value,
|
|
447
448
|
hint: t.hint,
|
|
448
449
|
hidden: t.hidden
|
|
449
450
|
}));
|
|
450
|
-
|
|
451
|
-
}),
|
|
451
|
+
s.push({ category: l, entries: n });
|
|
452
|
+
}), s;
|
|
452
453
|
}, D = () => {
|
|
453
|
-
const e =
|
|
454
|
+
const e = de(ue);
|
|
454
455
|
if (e)
|
|
455
456
|
return e;
|
|
456
457
|
throw new Error("useHttpClient must be used within a HttpClientProvider");
|
|
457
|
-
},
|
|
458
|
+
}, $ = {
|
|
458
459
|
Template_list: "/Template/list/",
|
|
459
460
|
Template: "/Template/GetTemplate/",
|
|
460
461
|
MergeTags: "/Template/TemplateMergeTags/",
|
|
461
462
|
ExcludeCategory: "/Template/GetExcludeCategories/",
|
|
462
463
|
SaveTemplate: "/Template/save-update/",
|
|
463
464
|
TemplateTypes: "/Template/TemplateTypes/"
|
|
464
|
-
},
|
|
465
|
-
const e = D(), { enerexIdentifier: r, projectId:
|
|
466
|
-
return
|
|
465
|
+
}, ke = () => {
|
|
466
|
+
const e = D(), { enerexIdentifier: r, projectId: s } = _();
|
|
467
|
+
return z({
|
|
467
468
|
queryKey: ["getTemplateTags"],
|
|
468
469
|
queryFn: async (n) => await e.get(
|
|
469
|
-
`${
|
|
470
|
+
`${$.MergeTags}${s}/${r}`
|
|
470
471
|
)
|
|
471
472
|
});
|
|
472
|
-
},
|
|
473
|
-
const e = D(), { enerexIdentifier: r, projectId:
|
|
474
|
-
return
|
|
473
|
+
}, Be = () => {
|
|
474
|
+
const e = D(), { enerexIdentifier: r, projectId: s } = _();
|
|
475
|
+
return z({
|
|
475
476
|
queryKey: ["getExcludeCategory"],
|
|
476
477
|
queryFn: async (n) => await e.get(
|
|
477
|
-
`${
|
|
478
|
+
`${$.ExcludeCategory}${s}/${r}`
|
|
478
479
|
)
|
|
479
480
|
});
|
|
480
|
-
},
|
|
481
|
-
console.log("uniqueId", W);
|
|
482
|
-
const $e = ({
|
|
481
|
+
}, Me = ({
|
|
483
482
|
templateHTML: e,
|
|
484
483
|
className: r = "",
|
|
485
|
-
loading:
|
|
484
|
+
loading: s = !1
|
|
486
485
|
}) => {
|
|
487
|
-
const { post:
|
|
488
|
-
e ?? { html:
|
|
489
|
-
), {
|
|
490
|
-
|
|
491
|
-
(async () => (await
|
|
486
|
+
const { post: l } = me(), { data: n } = ke(), { data: t } = Be(), [o, d] = S(
|
|
487
|
+
e ?? { html: F, css: "" }
|
|
488
|
+
), { userEmail: p } = _(), v = Ie(null), N = "https://plugin.stripocdn.email/content/guids/CABINET_eab4e7d5a4603ac03f4120652a3a5a540f0c79c688514939f095f67433ed4a67/images/photo256.png", b = "https://plugins.stripo.email/api/v1/auth";
|
|
489
|
+
E(() => {
|
|
490
|
+
(async () => (await T(), n && t && await w(H.EDITOR_SCRIPT_URL)))();
|
|
492
491
|
}, [n, t]);
|
|
493
|
-
async function
|
|
494
|
-
window.Zone || await new Promise((
|
|
495
|
-
const
|
|
496
|
-
|
|
497
|
-
const
|
|
498
|
-
|
|
492
|
+
async function T() {
|
|
493
|
+
window.Zone || await new Promise((c, g) => {
|
|
494
|
+
const f = document.createElement("script");
|
|
495
|
+
f.src = "https://unpkg.com/zone.js@0.13.1/bundles/zone.umd.min.js";
|
|
496
|
+
const y = document.querySelector("script[nonce]")?.nonce;
|
|
497
|
+
y && f.setAttribute("nonce", y), f.onload = () => c(), f.onerror = () => g(new Error("Failed to load zone.js")), document.head.appendChild(f);
|
|
499
498
|
});
|
|
500
499
|
}
|
|
501
|
-
async function
|
|
502
|
-
let
|
|
500
|
+
async function w(c) {
|
|
501
|
+
let g = document.getElementById(
|
|
503
502
|
"UiEditorScript"
|
|
504
503
|
);
|
|
505
|
-
|
|
506
|
-
await
|
|
507
|
-
}, document.body.appendChild(
|
|
508
|
-
(
|
|
504
|
+
g || (g = document.createElement("script"), g.id = "UiEditorScript", g.src = c, g.onload = async () => {
|
|
505
|
+
await P();
|
|
506
|
+
}, document.body.appendChild(g)), await new Promise(
|
|
507
|
+
(f) => g.addEventListener("load", () => f(), { once: !0 })
|
|
509
508
|
);
|
|
510
509
|
}
|
|
511
|
-
const
|
|
512
|
-
const
|
|
513
|
-
if (!
|
|
510
|
+
const P = async () => {
|
|
511
|
+
const c = v.current;
|
|
512
|
+
if (!c) {
|
|
514
513
|
console.error("Missing #stripoEditorContainer in DOM");
|
|
515
514
|
return;
|
|
516
515
|
}
|
|
@@ -518,45 +517,45 @@ const $e = ({
|
|
|
518
517
|
console.error("UIEditor script not loaded or not exposing initEditor");
|
|
519
518
|
return;
|
|
520
519
|
}
|
|
521
|
-
const
|
|
522
|
-
html:
|
|
523
|
-
css:
|
|
520
|
+
const g = {
|
|
521
|
+
html: o.html,
|
|
522
|
+
css: o.css,
|
|
524
523
|
modulesExcludedCategories: t ?? [],
|
|
525
524
|
forceRecreate: !0,
|
|
526
525
|
metadata: {
|
|
527
|
-
emailId:
|
|
526
|
+
emailId: p,
|
|
528
527
|
userId: "1",
|
|
529
528
|
// username: userName,
|
|
530
|
-
avatarUrl:
|
|
529
|
+
avatarUrl: N
|
|
531
530
|
},
|
|
532
531
|
locale: "en",
|
|
533
|
-
onTokenRefreshRequest: async (
|
|
534
|
-
const
|
|
535
|
-
pluginId:
|
|
536
|
-
secretKey:
|
|
537
|
-
userId:
|
|
532
|
+
onTokenRefreshRequest: async (f) => {
|
|
533
|
+
const y = {
|
|
534
|
+
pluginId: H.EDITOR_PLUGIN_ID,
|
|
535
|
+
secretKey: H.EDITOR_SECRET_KEY,
|
|
536
|
+
userId: p,
|
|
538
537
|
role: "user"
|
|
539
|
-
},
|
|
540
|
-
|
|
541
|
-
|
|
538
|
+
}, C = await l(
|
|
539
|
+
b,
|
|
540
|
+
y
|
|
542
541
|
);
|
|
543
|
-
|
|
542
|
+
C?.token && f(C.token);
|
|
544
543
|
},
|
|
545
|
-
mergeTags:
|
|
544
|
+
mergeTags: $e(n ?? [])
|
|
546
545
|
};
|
|
547
|
-
for (const [
|
|
546
|
+
for (const [f, y] of Object.entries({
|
|
548
547
|
codeEditorButtonSelector: "#codeEditor",
|
|
549
548
|
undoButtonSelector: "#undoButton",
|
|
550
549
|
redoButtonSelector: "#redoButton",
|
|
551
550
|
mobileViewButtonSelector: "#mobileViewButton",
|
|
552
551
|
desktopViewButtonSelector: "#desktopViewButton"
|
|
553
552
|
}))
|
|
554
|
-
|
|
555
|
-
await window.UIEditor.initEditor(
|
|
553
|
+
c.ownerDocument && c.getRootNode() instanceof ShadowRoot && c.getRootNode().querySelector(y) && (g[f] = y);
|
|
554
|
+
await window.UIEditor.initEditor(c, g);
|
|
556
555
|
};
|
|
557
|
-
return /* @__PURE__ */
|
|
558
|
-
|
|
559
|
-
|
|
556
|
+
return /* @__PURE__ */ i("div", { className: "position-relative", children: /* @__PURE__ */ I("div", { className: `editor-container ${r}`, children: [
|
|
557
|
+
s && /* @__PURE__ */ i("div", { className: "loading-overlay", children: /* @__PURE__ */ i(
|
|
558
|
+
J,
|
|
560
559
|
{
|
|
561
560
|
animation: "border",
|
|
562
561
|
style: { width: "11px", height: "11px" },
|
|
@@ -565,113 +564,130 @@ const $e = ({
|
|
|
565
564
|
className: "me-1"
|
|
566
565
|
}
|
|
567
566
|
) }),
|
|
568
|
-
/* @__PURE__ */
|
|
569
|
-
/* @__PURE__ */
|
|
567
|
+
/* @__PURE__ */ i("div", { id: "externalSystemContainer" }),
|
|
568
|
+
/* @__PURE__ */ i("div", { id: "stripoEditorContainer", ref: v })
|
|
570
569
|
] }) });
|
|
571
|
-
},
|
|
570
|
+
}, ie = ({
|
|
572
571
|
label: e,
|
|
573
572
|
register: r,
|
|
574
|
-
validation:
|
|
575
|
-
required:
|
|
573
|
+
validation: s,
|
|
574
|
+
required: l = !1,
|
|
576
575
|
name: n,
|
|
577
576
|
error: t,
|
|
578
|
-
className:
|
|
577
|
+
className: o = "",
|
|
579
578
|
...d
|
|
580
|
-
}) => /* @__PURE__ */
|
|
581
|
-
e ? /* @__PURE__ */
|
|
579
|
+
}) => /* @__PURE__ */ I(O.Group, { className: o + " mb-1", children: [
|
|
580
|
+
e ? /* @__PURE__ */ I(O.Label, { className: "mb-3 d-block form-label", children: [
|
|
582
581
|
e,
|
|
583
|
-
|
|
582
|
+
l && /* @__PURE__ */ i("label", { className: "text-danger", children: "*" })
|
|
584
583
|
] }) : null,
|
|
585
|
-
/* @__PURE__ */
|
|
586
|
-
|
|
584
|
+
/* @__PURE__ */ i(
|
|
585
|
+
O.Control,
|
|
587
586
|
{
|
|
588
587
|
name: n,
|
|
589
588
|
type: "text",
|
|
590
589
|
...d,
|
|
591
590
|
isInvalid: !!(t && t[n]),
|
|
592
591
|
...r ? r(n, {
|
|
593
|
-
...
|
|
592
|
+
...s
|
|
594
593
|
}) : {},
|
|
595
594
|
className: `react-select__control ${t && t[n] && "border border-danger"}`
|
|
596
595
|
}
|
|
597
596
|
),
|
|
598
|
-
t && t[n] ? /* @__PURE__ */
|
|
599
|
-
] }),
|
|
600
|
-
const e = D(), { enerexIdentifier: r, projectId:
|
|
601
|
-
return
|
|
597
|
+
t && t[n] ? /* @__PURE__ */ i(O.Control.Feedback, { type: "invalid", children: t[n].message }) : null
|
|
598
|
+
] }), Ue = () => {
|
|
599
|
+
const e = D(), { enerexIdentifier: r, projectId: s } = _();
|
|
600
|
+
return z({
|
|
602
601
|
queryKey: ["getTemplatesList"],
|
|
603
602
|
queryFn: async (n) => await e.get(
|
|
604
|
-
`${
|
|
603
|
+
`${$.Template_list}${s}/${r}`
|
|
605
604
|
)
|
|
606
605
|
});
|
|
607
606
|
};
|
|
608
|
-
function
|
|
609
|
-
return e.sort((r,
|
|
607
|
+
function Q(e) {
|
|
608
|
+
return e.sort((r, s) => r.name.localeCompare(s.name));
|
|
610
609
|
}
|
|
611
|
-
|
|
612
|
-
const
|
|
613
|
-
|
|
610
|
+
function Fe(e) {
|
|
611
|
+
const r = /* @__PURE__ */ new Map(), s = [];
|
|
612
|
+
e.forEach((t) => r.set(t.id, t));
|
|
613
|
+
let l = e.filter((t) => t.parent_id === 0), n = 0;
|
|
614
|
+
for (; l.length > 0; ) {
|
|
615
|
+
s.push({ level: n, data: l });
|
|
616
|
+
const t = l.map((d) => d.id);
|
|
617
|
+
l = e.filter(
|
|
618
|
+
(d) => t.includes(d.parent_id)
|
|
619
|
+
), n++;
|
|
620
|
+
}
|
|
621
|
+
return s;
|
|
622
|
+
}
|
|
623
|
+
function W(e, r) {
|
|
624
|
+
const l = Fe(e).find((n) => n.level === r);
|
|
625
|
+
return l ? l.data : [];
|
|
626
|
+
}
|
|
627
|
+
const He = () => {
|
|
628
|
+
const e = D(), { enerexIdentifier: r, projectId: s } = _();
|
|
629
|
+
return ce({
|
|
614
630
|
mutationKey: ["getTemplate"],
|
|
615
631
|
mutationFn: async ({ id: n }) => {
|
|
616
632
|
if (n)
|
|
617
633
|
return await e.get(
|
|
618
|
-
`${
|
|
634
|
+
`${$.Template}${r}/${n}/${s}`
|
|
619
635
|
);
|
|
620
636
|
}
|
|
621
637
|
});
|
|
622
|
-
},
|
|
623
|
-
const e = D(), { enerexIdentifier: r, projectId:
|
|
624
|
-
return
|
|
638
|
+
}, ze = () => {
|
|
639
|
+
const e = D(), { enerexIdentifier: r, projectId: s } = _();
|
|
640
|
+
return z({
|
|
625
641
|
queryKey: ["getTemplateTypes"],
|
|
626
642
|
queryFn: async (n) => await e.get(
|
|
627
|
-
`${
|
|
643
|
+
`${$.TemplateTypes}${r}/${s}`
|
|
628
644
|
)
|
|
629
645
|
});
|
|
630
646
|
};
|
|
631
|
-
function
|
|
647
|
+
function Ge(e) {
|
|
632
648
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
633
649
|
}
|
|
634
|
-
var
|
|
650
|
+
var Y = { exports: {} };
|
|
635
651
|
/*!
|
|
636
652
|
Copyright (c) 2018 Jed Watson.
|
|
637
653
|
Licensed under the MIT License (MIT), see
|
|
638
654
|
http://jedwatson.github.io/classnames
|
|
639
655
|
*/
|
|
640
|
-
var
|
|
641
|
-
function
|
|
642
|
-
return
|
|
656
|
+
var se;
|
|
657
|
+
function Ve() {
|
|
658
|
+
return se || (se = 1, function(e) {
|
|
643
659
|
(function() {
|
|
644
660
|
var r = {}.hasOwnProperty;
|
|
645
|
-
function
|
|
646
|
-
for (var t = "",
|
|
647
|
-
var d = arguments[
|
|
648
|
-
d && (t = n(t,
|
|
661
|
+
function s() {
|
|
662
|
+
for (var t = "", o = 0; o < arguments.length; o++) {
|
|
663
|
+
var d = arguments[o];
|
|
664
|
+
d && (t = n(t, l(d)));
|
|
649
665
|
}
|
|
650
666
|
return t;
|
|
651
667
|
}
|
|
652
|
-
function
|
|
668
|
+
function l(t) {
|
|
653
669
|
if (typeof t == "string" || typeof t == "number")
|
|
654
670
|
return t;
|
|
655
671
|
if (typeof t != "object")
|
|
656
672
|
return "";
|
|
657
673
|
if (Array.isArray(t))
|
|
658
|
-
return
|
|
674
|
+
return s.apply(null, t);
|
|
659
675
|
if (t.toString !== Object.prototype.toString && !t.toString.toString().includes("[native code]"))
|
|
660
676
|
return t.toString();
|
|
661
|
-
var
|
|
677
|
+
var o = "";
|
|
662
678
|
for (var d in t)
|
|
663
|
-
r.call(t, d) && t[d] && (
|
|
664
|
-
return
|
|
679
|
+
r.call(t, d) && t[d] && (o = n(o, d));
|
|
680
|
+
return o;
|
|
665
681
|
}
|
|
666
|
-
function n(t,
|
|
667
|
-
return
|
|
682
|
+
function n(t, o) {
|
|
683
|
+
return o ? t ? t + " " + o : t + o : t;
|
|
668
684
|
}
|
|
669
|
-
e.exports ? (
|
|
685
|
+
e.exports ? (s.default = s, e.exports = s) : window.classNames = s;
|
|
670
686
|
})();
|
|
671
|
-
}(
|
|
687
|
+
}(Y)), Y.exports;
|
|
672
688
|
}
|
|
673
|
-
var
|
|
674
|
-
const
|
|
689
|
+
var Ke = Ve();
|
|
690
|
+
const oe = /* @__PURE__ */ Ge(Ke), le = (e) => e.data.isSeparator ? /* @__PURE__ */ i("div", { style: { padding: 0, margin: "2px 0" }, children: /* @__PURE__ */ i(
|
|
675
691
|
"hr",
|
|
676
692
|
{
|
|
677
693
|
style: {
|
|
@@ -681,25 +697,25 @@ const re = /* @__PURE__ */ Ue(He), oe = (e) => e.data.isSeparator ? /* @__PURE__
|
|
|
681
697
|
margin: 0
|
|
682
698
|
}
|
|
683
699
|
}
|
|
684
|
-
) }) : /* @__PURE__ */
|
|
700
|
+
) }) : /* @__PURE__ */ i(Le.Option, { ...e }), Qe = ({
|
|
685
701
|
name: e = "",
|
|
686
702
|
control: r,
|
|
687
|
-
options:
|
|
688
|
-
multiple:
|
|
703
|
+
options: s,
|
|
704
|
+
multiple: l = !1,
|
|
689
705
|
placeholder: n,
|
|
690
706
|
validation: t,
|
|
691
|
-
labelKey:
|
|
707
|
+
labelKey: o = "name",
|
|
692
708
|
disabled: d,
|
|
693
709
|
isInvalid: p,
|
|
694
|
-
value:
|
|
695
|
-
onChange:
|
|
696
|
-
uncontrolled:
|
|
697
|
-
menuPlacement:
|
|
698
|
-
closeOnSelect:
|
|
710
|
+
value: v,
|
|
711
|
+
onChange: N,
|
|
712
|
+
uncontrolled: b,
|
|
713
|
+
menuPlacement: T = "auto",
|
|
714
|
+
closeOnSelect: w = !0
|
|
699
715
|
}) => {
|
|
700
|
-
const
|
|
701
|
-
control: (
|
|
702
|
-
...
|
|
716
|
+
const P = {
|
|
717
|
+
control: (c) => ({
|
|
718
|
+
...c,
|
|
703
719
|
minHeight: "33px",
|
|
704
720
|
// state.isFocused can display different borderColor if you need it
|
|
705
721
|
borderColor: p ? "var(--bs-form-invalid-border-color) !important" : "var(--ct-input-border-color)",
|
|
@@ -720,247 +736,272 @@ const re = /* @__PURE__ */ Ue(He), oe = (e) => e.data.isSeparator ? /* @__PURE__
|
|
|
720
736
|
display: "none"
|
|
721
737
|
}
|
|
722
738
|
}),
|
|
723
|
-
menu: (
|
|
724
|
-
...
|
|
739
|
+
menu: (c) => ({
|
|
740
|
+
...c,
|
|
725
741
|
marginTop: 0,
|
|
726
742
|
width: "max-content",
|
|
727
743
|
minWidth: "100%"
|
|
728
744
|
}),
|
|
729
|
-
menuPortal: (
|
|
730
|
-
...
|
|
745
|
+
menuPortal: (c) => ({
|
|
746
|
+
...c,
|
|
731
747
|
zIndex: 9999
|
|
732
748
|
}),
|
|
733
|
-
multiValueRemove: (
|
|
734
|
-
...
|
|
749
|
+
multiValueRemove: (c) => ({
|
|
750
|
+
...c,
|
|
735
751
|
display: d ? "none" : "block"
|
|
736
752
|
})
|
|
737
753
|
};
|
|
738
|
-
return
|
|
739
|
-
|
|
754
|
+
return b ? /* @__PURE__ */ i(
|
|
755
|
+
re,
|
|
740
756
|
{
|
|
741
|
-
components: { Option:
|
|
742
|
-
isOptionDisabled: (
|
|
743
|
-
className:
|
|
757
|
+
components: { Option: le },
|
|
758
|
+
isOptionDisabled: (c) => !!c.isSeparator,
|
|
759
|
+
className: oe({
|
|
744
760
|
"is-invalid": p
|
|
745
761
|
}),
|
|
746
|
-
styles:
|
|
762
|
+
styles: P,
|
|
747
763
|
classNamePrefix: "react-select",
|
|
748
|
-
isMulti:
|
|
749
|
-
options:
|
|
750
|
-
onChange:
|
|
764
|
+
isMulti: l,
|
|
765
|
+
options: s,
|
|
766
|
+
onChange: N,
|
|
751
767
|
placeholder: n,
|
|
752
768
|
menuPortalTarget: document.body,
|
|
753
|
-
value:
|
|
754
|
-
getOptionLabel: typeof
|
|
755
|
-
getOptionValue: (
|
|
769
|
+
value: v,
|
|
770
|
+
getOptionLabel: typeof o == "string" ? (c) => c[o] : o,
|
|
771
|
+
getOptionValue: (c) => c.id,
|
|
756
772
|
isDisabled: d,
|
|
757
|
-
menuPlacement:
|
|
758
|
-
closeMenuOnSelect:
|
|
773
|
+
menuPlacement: T,
|
|
774
|
+
closeMenuOnSelect: w
|
|
759
775
|
}
|
|
760
|
-
) : /* @__PURE__ */
|
|
761
|
-
|
|
776
|
+
) : /* @__PURE__ */ i(
|
|
777
|
+
je,
|
|
762
778
|
{
|
|
763
779
|
control: r,
|
|
764
780
|
name: e,
|
|
765
781
|
rules: t,
|
|
766
|
-
render: ({ field: { onChange:
|
|
767
|
-
|
|
782
|
+
render: ({ field: { onChange: c, value: g, onBlur: f } }) => /* @__PURE__ */ i(
|
|
783
|
+
re,
|
|
768
784
|
{
|
|
769
|
-
components: { Option:
|
|
770
|
-
isOptionDisabled: (
|
|
771
|
-
className:
|
|
785
|
+
components: { Option: le },
|
|
786
|
+
isOptionDisabled: (y) => !!y.isSeparator,
|
|
787
|
+
className: oe({
|
|
772
788
|
"is-invalid": p
|
|
773
789
|
}),
|
|
774
|
-
styles:
|
|
790
|
+
styles: P,
|
|
775
791
|
classNamePrefix: "react-select",
|
|
776
|
-
isMulti:
|
|
777
|
-
options:
|
|
778
|
-
onBlur:
|
|
779
|
-
onChange:
|
|
792
|
+
isMulti: l,
|
|
793
|
+
options: s,
|
|
794
|
+
onBlur: f,
|
|
795
|
+
onChange: c,
|
|
780
796
|
placeholder: n,
|
|
781
797
|
menuPortalTarget: document.body,
|
|
782
|
-
value:
|
|
783
|
-
getOptionLabel: typeof
|
|
784
|
-
getOptionValue: (
|
|
798
|
+
value: g,
|
|
799
|
+
getOptionLabel: typeof o == "string" ? (y) => y[o] : o,
|
|
800
|
+
getOptionValue: (y) => y.id,
|
|
785
801
|
isDisabled: d,
|
|
786
|
-
menuPlacement:
|
|
787
|
-
closeMenuOnSelect:
|
|
802
|
+
menuPlacement: T,
|
|
803
|
+
closeMenuOnSelect: w
|
|
788
804
|
},
|
|
789
|
-
|
|
805
|
+
g ? JSON.stringify(g) : "reset"
|
|
790
806
|
)
|
|
791
807
|
}
|
|
792
808
|
);
|
|
793
|
-
},
|
|
809
|
+
}, M = ({
|
|
794
810
|
label: e,
|
|
795
811
|
name: r,
|
|
796
|
-
validation:
|
|
797
|
-
control:
|
|
812
|
+
validation: s,
|
|
813
|
+
control: l,
|
|
798
814
|
error: n,
|
|
799
815
|
...t
|
|
800
|
-
}) => /* @__PURE__ */
|
|
801
|
-
e && /* @__PURE__ */
|
|
816
|
+
}) => /* @__PURE__ */ I(O.Group, { className: "mb-1", children: [
|
|
817
|
+
e && /* @__PURE__ */ I(O.Label, { className: "mb-3 d-block form-label", children: [
|
|
802
818
|
e,
|
|
803
819
|
" ",
|
|
804
|
-
t.required && /* @__PURE__ */
|
|
820
|
+
t.required && /* @__PURE__ */ i("span", { className: "text-danger", children: "*" })
|
|
805
821
|
] }),
|
|
806
|
-
/* @__PURE__ */
|
|
807
|
-
|
|
822
|
+
/* @__PURE__ */ i(
|
|
823
|
+
Qe,
|
|
808
824
|
{
|
|
809
|
-
control:
|
|
825
|
+
control: l,
|
|
810
826
|
options: t.options ?? [],
|
|
811
|
-
validation:
|
|
827
|
+
validation: s,
|
|
812
828
|
isInvalid: n && !!n[r],
|
|
813
829
|
name: r
|
|
814
830
|
}
|
|
815
831
|
),
|
|
816
|
-
n && n[r] ? /* @__PURE__ */
|
|
817
|
-
] }),
|
|
832
|
+
n && n[r] ? /* @__PURE__ */ i(O.Control.Feedback, { type: "invalid", children: n[r].message }) : null
|
|
833
|
+
] }), We = () => {
|
|
818
834
|
const e = D();
|
|
819
|
-
|
|
820
|
-
const { enerexIdentifier: r, projectId:
|
|
821
|
-
return
|
|
835
|
+
Pe();
|
|
836
|
+
const { enerexIdentifier: r, projectId: s } = _();
|
|
837
|
+
return ce({
|
|
822
838
|
mutationKey: ["saveTemplate"],
|
|
823
|
-
mutationFn: async (n) => (n.enerexIdentifier = r ?? "", n.projectId =
|
|
824
|
-
`${
|
|
839
|
+
mutationFn: async (n) => (n.enerexIdentifier = r ?? "", n.projectId = s ?? "", await e.post(
|
|
840
|
+
`${$.SaveTemplate}`,
|
|
825
841
|
n
|
|
826
842
|
))
|
|
827
843
|
});
|
|
828
|
-
},
|
|
844
|
+
}, U = {
|
|
829
845
|
id: "",
|
|
830
846
|
name: "New (Blank)"
|
|
831
|
-
},
|
|
847
|
+
}, ae = {
|
|
832
848
|
id: "",
|
|
833
849
|
name: "Separator",
|
|
834
850
|
isSeparator: !0
|
|
835
|
-
},
|
|
851
|
+
}, Ye = ({
|
|
836
852
|
onSelectItem: e,
|
|
837
853
|
templateLoading: r,
|
|
838
|
-
onReset:
|
|
854
|
+
onReset: s
|
|
839
855
|
}) => {
|
|
840
856
|
const {
|
|
841
|
-
register:
|
|
857
|
+
register: l,
|
|
842
858
|
handleSubmit: n,
|
|
843
859
|
clearErrors: t,
|
|
844
|
-
setValue:
|
|
860
|
+
setValue: o,
|
|
845
861
|
control: d,
|
|
846
862
|
watch: p,
|
|
847
|
-
reset:
|
|
848
|
-
setError:
|
|
849
|
-
formState: { errors:
|
|
850
|
-
} =
|
|
863
|
+
reset: v,
|
|
864
|
+
setError: N,
|
|
865
|
+
formState: { errors: b }
|
|
866
|
+
} = Oe({
|
|
851
867
|
defaultValues: {
|
|
852
868
|
templateName: "",
|
|
853
869
|
subTemplateType: void 0,
|
|
870
|
+
subTemplateType2: void 0,
|
|
854
871
|
subject: "",
|
|
855
872
|
templateType: void 0,
|
|
856
|
-
template:
|
|
873
|
+
template: U
|
|
857
874
|
},
|
|
858
875
|
mode: "onChange"
|
|
859
876
|
}), {
|
|
860
|
-
data:
|
|
861
|
-
refetch:
|
|
862
|
-
isLoading:
|
|
863
|
-
} =
|
|
864
|
-
|
|
865
|
-
if (
|
|
866
|
-
let
|
|
867
|
-
|
|
868
|
-
z(l.filter((c) => c.parent_id === 0))
|
|
869
|
-
), M(
|
|
870
|
-
z(
|
|
871
|
-
l.filter(
|
|
872
|
-
(c) => c.parent_id.toString() === `${p("templateType")?.id}`
|
|
873
|
-
)
|
|
874
|
-
)
|
|
875
|
-
);
|
|
877
|
+
data: T,
|
|
878
|
+
refetch: w,
|
|
879
|
+
isLoading: P
|
|
880
|
+
} = Ue(), [c, g] = S([]), [f, y] = S(), [C, X] = S(), { mutateAsync: fe, isPending: L } = He(), { mutateAsync: ge, isPending: B } = We(), { data: k, isLoading: Z } = ze(), [ye, he] = S([]), [R, G] = S([]), [q, V] = S([]);
|
|
881
|
+
E(() => {
|
|
882
|
+
if (k) {
|
|
883
|
+
let a = k.filter((u) => u.id != null), m = W(a, 0);
|
|
884
|
+
he(Q(m));
|
|
876
885
|
}
|
|
877
|
-
}, [
|
|
878
|
-
const
|
|
879
|
-
let
|
|
880
|
-
return
|
|
881
|
-
|
|
882
|
-
}),
|
|
886
|
+
}, [k]);
|
|
887
|
+
const be = (a, m) => {
|
|
888
|
+
let u = [];
|
|
889
|
+
return a.forEach((x, h) => {
|
|
890
|
+
m.includes(h) && h !== 0 && u.push(ae), u.push(x);
|
|
891
|
+
}), u;
|
|
883
892
|
};
|
|
884
|
-
|
|
885
|
-
r(!!
|
|
886
|
-
}, [
|
|
887
|
-
|
|
888
|
-
}, [
|
|
889
|
-
const
|
|
890
|
-
|
|
891
|
-
const
|
|
892
|
-
|
|
893
|
+
E(() => {
|
|
894
|
+
r(!!L);
|
|
895
|
+
}, [L]), E(() => {
|
|
896
|
+
T?.sort((a, m) => a.readonly !== m.readonly ? (a.readonly ? 0 : 1) - (m.readonly ? 0 : 1) : a.name.localeCompare(m.name)), g(T ?? []);
|
|
897
|
+
}, [T]);
|
|
898
|
+
const we = async (a) => {
|
|
899
|
+
y(a), a && !a.readonly ? (o("templateName", a?.name), t()) : (o("templateName", ""), o("subject", ""));
|
|
900
|
+
const m = await fe({ id: a?.id });
|
|
901
|
+
X(m || void 0);
|
|
893
902
|
};
|
|
894
|
-
|
|
895
|
-
if (
|
|
896
|
-
let
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
(
|
|
903
|
+
E(() => {
|
|
904
|
+
if (o("template", U), p("templateType")) {
|
|
905
|
+
let a = k?.filter((u) => u.id !== void 0) ?? [], m = W(a, 1);
|
|
906
|
+
G(
|
|
907
|
+
Q(
|
|
908
|
+
m.filter(
|
|
909
|
+
(u) => u.parent_id.toString() === `${p("templateType")?.id}`
|
|
901
910
|
)
|
|
902
911
|
)
|
|
903
|
-
),
|
|
912
|
+
), o("subTemplateType", void 0), o("subTemplateType2", void 0);
|
|
904
913
|
}
|
|
905
|
-
}, [p("templateType")]),
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
914
|
+
}, [p("templateType")]), E(() => {
|
|
915
|
+
if (o("template", U), p("subTemplateType")) {
|
|
916
|
+
let a = k?.filter((u) => u.id !== void 0) ?? [], m = W(a, 2);
|
|
917
|
+
V(
|
|
918
|
+
Q(
|
|
919
|
+
m.filter(
|
|
920
|
+
(u) => u.parent_id.toString() === `${p("subTemplateType")?.id}`
|
|
921
|
+
)
|
|
922
|
+
)
|
|
923
|
+
), o("subTemplateType2", void 0);
|
|
924
|
+
}
|
|
925
|
+
}, [p("subTemplateType")]), E(() => {
|
|
926
|
+
let a = c.find((m) => m.id === p("template")?.id);
|
|
927
|
+
we(a);
|
|
928
|
+
}, [p("template")]), E(() => {
|
|
929
|
+
C && f ? (e(C), o("subject", C.subject ?? "")) : e(void 0);
|
|
930
|
+
}, [C, f, e]);
|
|
931
|
+
const Te = () => {
|
|
932
|
+
let a = [U], m = "templateType";
|
|
933
|
+
q.length > 0 ? m = "subTemplateType2" : R.length > 0 && (m = "subTemplateType");
|
|
934
|
+
let u = c.filter(
|
|
935
|
+
(h) => (h.type?.toString() === p(m)?.id.toString() || h.type === null) && p(m)?.id != null
|
|
936
|
+
), x = be(u, [u.findIndex((h) => !h.readonly)]);
|
|
937
|
+
return x.length > 0 && (a.push(ae), a = [
|
|
938
|
+
...a,
|
|
939
|
+
...x.map((h) => ({
|
|
920
940
|
id: h.id,
|
|
921
|
-
name: h.
|
|
941
|
+
name: ve(u, h.id),
|
|
922
942
|
isSeparator: h.isSeparator
|
|
923
943
|
}))
|
|
924
|
-
]),
|
|
925
|
-
},
|
|
944
|
+
]), a.length ? a : [];
|
|
945
|
+
}, ve = (a, m) => {
|
|
946
|
+
let u = a.find((x) => x.id === m);
|
|
947
|
+
return u ? `${u.displayName}` : "";
|
|
948
|
+
}, xe = (a) => {
|
|
926
949
|
window.StripoEditorApi.actionsApi.getTemplateData(
|
|
927
|
-
async (
|
|
928
|
-
let
|
|
929
|
-
|
|
930
|
-
let
|
|
931
|
-
(
|
|
950
|
+
async (m) => {
|
|
951
|
+
let u = a.template.id, x = "";
|
|
952
|
+
f?.readonly && (u = "", x = a.template.id);
|
|
953
|
+
let h = c.find(
|
|
954
|
+
(Ce) => Ce.name === a.templateName.trim()
|
|
932
955
|
);
|
|
933
|
-
if (
|
|
934
|
-
|
|
956
|
+
if (h && h.id !== u) {
|
|
957
|
+
N("templateName", {
|
|
935
958
|
type: "validate",
|
|
936
959
|
message: "Template name already exists. Please choose a different name."
|
|
937
960
|
});
|
|
938
961
|
return;
|
|
939
962
|
}
|
|
940
|
-
let
|
|
941
|
-
|
|
963
|
+
let K = a.templateType.id;
|
|
964
|
+
q && q.length > 0 ? K = a.subTemplateType2.id : R && R.length > 0 && (K = a.subTemplateType.id);
|
|
965
|
+
const Se = {
|
|
942
966
|
enerexIdentifier: "",
|
|
943
967
|
projectId: "",
|
|
944
|
-
templateId:
|
|
945
|
-
templateType:
|
|
946
|
-
name:
|
|
947
|
-
html:
|
|
948
|
-
css:
|
|
949
|
-
subject:
|
|
950
|
-
parent_id:
|
|
968
|
+
templateId: u,
|
|
969
|
+
templateType: K,
|
|
970
|
+
name: a.templateName.trim(),
|
|
971
|
+
html: m.html,
|
|
972
|
+
css: m.css,
|
|
973
|
+
subject: a.templateType.id === "2" ? a?.subject ?? "" : "",
|
|
974
|
+
parent_id: x
|
|
951
975
|
};
|
|
952
|
-
await
|
|
976
|
+
await ge(Se) && (t(), v(), G([]), V([]), w());
|
|
953
977
|
}
|
|
954
978
|
);
|
|
955
979
|
};
|
|
956
|
-
return /* @__PURE__ */
|
|
957
|
-
/* @__PURE__ */
|
|
958
|
-
|
|
980
|
+
return /* @__PURE__ */ i(te, { className: "border border-0 text-start", children: /* @__PURE__ */ i(te.Body, { className: "pe-0 ps-2", children: /* @__PURE__ */ i("form", { onSubmit: n(xe), children: /* @__PURE__ */ i("div", { className: "template-list-container gap-3", children: /* @__PURE__ */ I(Ae, { children: [
|
|
981
|
+
/* @__PURE__ */ i(A, { children: /* @__PURE__ */ i(
|
|
982
|
+
M,
|
|
983
|
+
{
|
|
984
|
+
label: "Category",
|
|
985
|
+
control: d,
|
|
986
|
+
error: b,
|
|
987
|
+
options: ye,
|
|
988
|
+
required: !0,
|
|
989
|
+
validation: {
|
|
990
|
+
required: {
|
|
991
|
+
value: !0,
|
|
992
|
+
message: "Select a category"
|
|
993
|
+
}
|
|
994
|
+
},
|
|
995
|
+
...l("templateType")
|
|
996
|
+
}
|
|
997
|
+
) }),
|
|
998
|
+
R && R.length > 0 && /* @__PURE__ */ i(A, { children: /* @__PURE__ */ i(
|
|
999
|
+
M,
|
|
959
1000
|
{
|
|
960
1001
|
label: "Type",
|
|
961
1002
|
control: d,
|
|
962
|
-
error:
|
|
963
|
-
options:
|
|
1003
|
+
error: b,
|
|
1004
|
+
options: R,
|
|
964
1005
|
required: !0,
|
|
965
1006
|
validation: {
|
|
966
1007
|
required: {
|
|
@@ -968,43 +1009,43 @@ const re = /* @__PURE__ */ Ue(He), oe = (e) => e.data.isSeparator ? /* @__PURE__
|
|
|
968
1009
|
message: "Select a type"
|
|
969
1010
|
}
|
|
970
1011
|
},
|
|
971
|
-
...
|
|
1012
|
+
...l("subTemplateType")
|
|
972
1013
|
}
|
|
973
1014
|
) }),
|
|
974
|
-
|
|
975
|
-
|
|
1015
|
+
q && q.length > 0 && /* @__PURE__ */ i(A, { children: /* @__PURE__ */ i(
|
|
1016
|
+
M,
|
|
976
1017
|
{
|
|
977
1018
|
label: "Sub Type",
|
|
978
1019
|
control: d,
|
|
979
|
-
error:
|
|
980
|
-
options:
|
|
1020
|
+
error: b,
|
|
1021
|
+
options: q,
|
|
981
1022
|
required: !0,
|
|
982
1023
|
validation: {
|
|
983
1024
|
required: {
|
|
984
1025
|
value: !0,
|
|
985
|
-
message: "Select a
|
|
1026
|
+
message: "Select a subtype"
|
|
986
1027
|
}
|
|
987
1028
|
},
|
|
988
|
-
...
|
|
1029
|
+
...l("subTemplateType2")
|
|
989
1030
|
}
|
|
990
1031
|
) }),
|
|
991
|
-
/* @__PURE__ */
|
|
992
|
-
|
|
1032
|
+
/* @__PURE__ */ i(A, { children: /* @__PURE__ */ i(
|
|
1033
|
+
M,
|
|
993
1034
|
{
|
|
994
1035
|
label: "Template",
|
|
995
1036
|
control: d,
|
|
996
|
-
error:
|
|
997
|
-
options:
|
|
1037
|
+
error: b,
|
|
1038
|
+
options: Te(),
|
|
998
1039
|
required: !1,
|
|
999
|
-
...
|
|
1040
|
+
...l("template")
|
|
1000
1041
|
}
|
|
1001
1042
|
) }),
|
|
1002
|
-
/* @__PURE__ */
|
|
1003
|
-
|
|
1043
|
+
/* @__PURE__ */ i(A, { children: /* @__PURE__ */ i(
|
|
1044
|
+
ie,
|
|
1004
1045
|
{
|
|
1005
1046
|
label: "Name",
|
|
1006
|
-
register:
|
|
1007
|
-
error:
|
|
1047
|
+
register: l,
|
|
1048
|
+
error: b,
|
|
1008
1049
|
required: !0,
|
|
1009
1050
|
name: "templateName",
|
|
1010
1051
|
validation: {
|
|
@@ -1015,71 +1056,71 @@ const re = /* @__PURE__ */ Ue(He), oe = (e) => e.data.isSeparator ? /* @__PURE__
|
|
|
1015
1056
|
}
|
|
1016
1057
|
}
|
|
1017
1058
|
) }),
|
|
1018
|
-
p("templateType")?.id === "2" && /* @__PURE__ */
|
|
1019
|
-
|
|
1059
|
+
p("templateType")?.id === "2" && /* @__PURE__ */ i(A, { children: /* @__PURE__ */ i(
|
|
1060
|
+
ie,
|
|
1020
1061
|
{
|
|
1021
1062
|
label: "Subject",
|
|
1022
|
-
register:
|
|
1023
|
-
error:
|
|
1063
|
+
register: l,
|
|
1064
|
+
error: b,
|
|
1024
1065
|
required: !1,
|
|
1025
1066
|
name: "subject"
|
|
1026
1067
|
}
|
|
1027
1068
|
) }),
|
|
1028
|
-
/* @__PURE__ */
|
|
1029
|
-
/* @__PURE__ */
|
|
1030
|
-
|
|
1069
|
+
/* @__PURE__ */ I(A, { className: "d-flex align-items-end justify-content-end gap-2 mb-3", children: [
|
|
1070
|
+
/* @__PURE__ */ i(
|
|
1071
|
+
ne,
|
|
1031
1072
|
{
|
|
1032
1073
|
style: { width: "70px" },
|
|
1033
1074
|
variant: "primary",
|
|
1034
|
-
disabled:
|
|
1075
|
+
disabled: P || L || B || Z,
|
|
1035
1076
|
onClick: () => {
|
|
1036
|
-
|
|
1077
|
+
y(void 0), v(), G([]), V([]), s();
|
|
1037
1078
|
},
|
|
1038
|
-
children:
|
|
1039
|
-
|
|
1079
|
+
children: L || B ? /* @__PURE__ */ i(
|
|
1080
|
+
J,
|
|
1040
1081
|
{
|
|
1041
1082
|
animation: "border",
|
|
1042
1083
|
style: { width: "11px", height: "11px" },
|
|
1043
1084
|
size: "sm",
|
|
1044
1085
|
role: "status",
|
|
1045
1086
|
className: "me-1",
|
|
1046
|
-
children: /* @__PURE__ */
|
|
1087
|
+
children: /* @__PURE__ */ i("span", { className: "visually-hidden", children: "Loading..." })
|
|
1047
1088
|
}
|
|
1048
1089
|
) : "Clear"
|
|
1049
1090
|
}
|
|
1050
1091
|
),
|
|
1051
|
-
(p("templateType")?.id.toString() !== "2" || (p("templateType")?.id.toString() === "2" && (
|
|
1052
|
-
|
|
1092
|
+
(p("templateType")?.id.toString() !== "2" || (p("templateType")?.id.toString() === "2" && (f?.id ?? "")) !== "") && /* @__PURE__ */ i(Ee, { children: /* @__PURE__ */ i(
|
|
1093
|
+
ne,
|
|
1053
1094
|
{
|
|
1054
1095
|
type: "submit",
|
|
1055
1096
|
variant: "primary",
|
|
1056
1097
|
style: { width: "80px" },
|
|
1057
|
-
disabled:
|
|
1058
|
-
children:
|
|
1059
|
-
|
|
1098
|
+
disabled: P || L || B || Z,
|
|
1099
|
+
children: L || B ? /* @__PURE__ */ i(
|
|
1100
|
+
J,
|
|
1060
1101
|
{
|
|
1061
1102
|
animation: "border",
|
|
1062
1103
|
style: { width: "11px", height: "11px" },
|
|
1063
1104
|
size: "sm",
|
|
1064
1105
|
role: "status",
|
|
1065
1106
|
className: "me-1",
|
|
1066
|
-
children: /* @__PURE__ */
|
|
1107
|
+
children: /* @__PURE__ */ i("span", { className: "visually-hidden", children: "Loading..." })
|
|
1067
1108
|
}
|
|
1068
|
-
) :
|
|
1109
|
+
) : f?.readonly ? "Save as" : "Save"
|
|
1069
1110
|
}
|
|
1070
1111
|
) })
|
|
1071
1112
|
] })
|
|
1072
1113
|
] }) }) }) }) });
|
|
1073
|
-
},
|
|
1074
|
-
const [r,
|
|
1075
|
-
return /* @__PURE__ */
|
|
1076
|
-
/* @__PURE__ */
|
|
1077
|
-
|
|
1114
|
+
}, st = ({ config: e }) => {
|
|
1115
|
+
const [r, s] = S(), [l, n] = S(!1);
|
|
1116
|
+
return /* @__PURE__ */ i(Re, { configs: e, children: /* @__PURE__ */ i(De, { children: /* @__PURE__ */ I("div", { className: "root-widget", children: [
|
|
1117
|
+
/* @__PURE__ */ i(
|
|
1118
|
+
Ye,
|
|
1078
1119
|
{
|
|
1079
1120
|
templateLoading: n,
|
|
1080
1121
|
onSelectItem: (d) => {
|
|
1081
|
-
if (
|
|
1082
|
-
let p =
|
|
1122
|
+
if (s(d), window.StripoEditorApi && window.StripoEditorApi.actionsApi) {
|
|
1123
|
+
let p = F;
|
|
1083
1124
|
window.StripoEditorApi.actionsApi.updateHtmlAndCss(
|
|
1084
1125
|
d?.html ?? p,
|
|
1085
1126
|
d?.css ?? "",
|
|
@@ -1088,20 +1129,20 @@ const re = /* @__PURE__ */ Ue(He), oe = (e) => e.data.isSeparator ? /* @__PURE__
|
|
|
1088
1129
|
}
|
|
1089
1130
|
},
|
|
1090
1131
|
onReset: () => {
|
|
1091
|
-
n(!1),
|
|
1092
|
-
|
|
1132
|
+
n(!1), s(void 0), window.StripoEditorApi && window.StripoEditorApi.actionsApi && window.StripoEditorApi.actionsApi.updateHtmlAndCss(
|
|
1133
|
+
F,
|
|
1093
1134
|
"",
|
|
1094
1135
|
""
|
|
1095
1136
|
);
|
|
1096
1137
|
}
|
|
1097
1138
|
}
|
|
1098
1139
|
),
|
|
1099
|
-
/* @__PURE__ */
|
|
1100
|
-
|
|
1140
|
+
/* @__PURE__ */ i(
|
|
1141
|
+
Me,
|
|
1101
1142
|
{
|
|
1102
1143
|
templateHTML: {
|
|
1103
1144
|
css: r?.css ?? "",
|
|
1104
|
-
html: r?.html ??
|
|
1145
|
+
html: r?.html ?? F
|
|
1105
1146
|
},
|
|
1106
1147
|
loading: !1,
|
|
1107
1148
|
className: "col-span-5"
|
|
@@ -1110,5 +1151,5 @@ const re = /* @__PURE__ */ Ue(He), oe = (e) => e.data.isSeparator ? /* @__PURE__
|
|
|
1110
1151
|
] }) }) });
|
|
1111
1152
|
};
|
|
1112
1153
|
export {
|
|
1113
|
-
|
|
1154
|
+
st as EditorWidget
|
|
1114
1155
|
};
|