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