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