@enerex/template-studio 1.1.18 → 1.1.19

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 i, jsxs as w } from "react/jsx-runtime";
2
- import I, { useContext as J, useState as E, useEffect as _ } from "react";
3
- import { QueryClient as le, QueryClientProvider as de, useQuery as k, useMutation as Z, useQueryClient as ce } from "@tanstack/react-query";
4
- import V from "axios";
5
- import { Spinner as U, Form as S, Card as K, Row as pe, Col as q, Button as z } from "react-bootstrap";
6
- import { Controller as me, useForm as ue } from "react-hook-form";
7
- import G from "react-select";
8
- const j = `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
1
+ import { jsx as s, jsxs as y } from "react/jsx-runtime";
2
+ import I, { useContext as te, useState as S, useEffect as _ } from "react";
3
+ import { QueryClient as pe, QueryClientProvider as me, useQuery as O, useMutation as ne, useQueryClient as ue } from "@tanstack/react-query";
4
+ import K from "axios";
5
+ import { Spinner as U, Form as E, Card as z, Row as G, Col as j, Button as Q } from "react-bootstrap";
6
+ import { Controller as ge, useForm as fe } from "react-hook-form";
7
+ import W from "react-select";
8
+ const D = `<!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,39 +361,39 @@ const j = `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:
361
361
  </div>\r
362
362
  </body>\r
363
363
  </html>\r
364
- `, ee = I.createContext(
364
+ `, re = I.createContext(
365
365
  void 0
366
- ), ge = ({
366
+ ), ye = ({
367
367
  children: t,
368
368
  configs: r
369
369
  }) => {
370
- const [s, o] = I.useState(r.clientId), [n, e] = I.useState(r.apiKey), [a, l] = I.useState(
370
+ const [i, l] = I.useState(r.clientId), [n, e] = I.useState(r.apiKey), [a, o] = I.useState(
371
371
  r.enerexIdentifier
372
- ), [u, y] = I.useState(r.userName), [f, h] = I.useState(r.projectId), b = (p) => {
373
- e(p.apiKey), o(p.clientId), h(p.projectId), l(p.enerexIdentifier), y(p.userName);
372
+ ), [p, h] = I.useState(r.userName), [f, b] = I.useState(r.projectId), w = (m) => {
373
+ e(m.apiKey), l(m.clientId), b(m.projectId), o(m.enerexIdentifier), h(m.userName);
374
374
  };
375
- return /* @__PURE__ */ i(
376
- ee.Provider,
375
+ return /* @__PURE__ */ s(
376
+ re.Provider,
377
377
  {
378
378
  value: {
379
- clientId: s,
379
+ clientId: i,
380
380
  apiKey: n,
381
- setConfiguration: b,
381
+ setConfiguration: w,
382
382
  enerexIdentifier: a,
383
383
  projectId: f,
384
- userName: u
384
+ userName: p
385
385
  },
386
386
  children: t
387
387
  }
388
388
  );
389
- }, v = () => {
390
- const t = J(ee);
389
+ }, T = () => {
390
+ const t = te(re);
391
391
  if (!t)
392
392
  throw new Error("widgetConfig must be used within a ConfigProvider");
393
393
  return t;
394
- }, te = (t = "", r) => ({ get: async (n, e) => {
394
+ }, se = (t = "", r) => ({ get: async (n, e) => {
395
395
  try {
396
- const a = await V.get(
396
+ const a = await K.get(
397
397
  `${t}${n}`,
398
398
  e ?? r
399
399
  );
@@ -404,54 +404,54 @@ const j = `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:
404
404
  }
405
405
  }, post: async (n, e, a) => {
406
406
  try {
407
- const l = await V.post(
407
+ const o = await K.post(
408
408
  `${t}${n}`,
409
409
  e,
410
410
  a ?? r
411
411
  );
412
- if (l.status === 200)
413
- return l.data;
414
- } catch (l) {
415
- throw l;
412
+ if (o.status === 200)
413
+ return o.data;
414
+ } catch (o) {
415
+ throw o;
416
416
  }
417
- } }), D = {
417
+ } }), k = {
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
- }, ne = I.createContext({
424
+ }, ie = I.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
- }), fe = ({ children: t }) => {
432
- const { clientId: r, apiKey: s } = v(), o = {
431
+ }), he = ({ children: t }) => {
432
+ const { clientId: r, apiKey: i } = T(), l = {
433
433
  headers: {
434
434
  client_id: r,
435
- "x-api-key": s
435
+ "x-api-key": i
436
436
  }
437
- }, { get: n, post: e } = te(D.API_BASE_URL, o);
438
- return /* @__PURE__ */ i(ne.Provider, { value: { get: n, post: e }, children: t });
439
- }, ye = ({ children: t }) => {
440
- const r = new le();
441
- return /* @__PURE__ */ i(fe, { children: /* @__PURE__ */ i(de, { client: r, children: t }) });
442
- }, he = (t) => {
443
- const r = Array.from(new Set(t.map((o) => o.category))), s = [];
444
- return r.forEach((o) => {
445
- const n = t.filter((e) => e.category === o).map((e) => ({
437
+ }, { get: n, post: e } = se(k.API_BASE_URL, l);
438
+ return /* @__PURE__ */ s(ie.Provider, { value: { get: n, post: e }, children: t });
439
+ }, be = ({ children: t }) => {
440
+ const r = new pe();
441
+ return /* @__PURE__ */ s(he, { children: /* @__PURE__ */ s(me, { client: r, children: t }) });
442
+ }, we = (t) => {
443
+ const r = Array.from(new Set(t.map((l) => l.category))), i = [];
444
+ return r.forEach((l) => {
445
+ const n = t.filter((e) => e.category === l).map((e) => ({
446
446
  label: e.label,
447
447
  value: e.value,
448
448
  hint: e.hint,
449
449
  hidden: e.hidden
450
450
  }));
451
- s.push({ category: o, entries: n });
452
- }), s;
451
+ i.push({ category: l, entries: n });
452
+ }), i;
453
453
  }, A = () => {
454
- const t = J(ne);
454
+ const t = te(ie);
455
455
  if (t)
456
456
  return t;
457
457
  throw new Error("useHttpClient must be used within a HttpClientProvider");
@@ -462,37 +462,37 @@ const j = `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:
462
462
  ExcludeCategory: "/Template/GetExcludeCategories/",
463
463
  SaveTemplate: "/Template/save-update/",
464
464
  TemplateTypes: "/Template/TemplateTypes/"
465
- }, be = () => {
466
- const t = A(), { enerexIdentifier: r, projectId: s } = v();
467
- return k({
465
+ }, Te = () => {
466
+ const t = A(), { enerexIdentifier: r, projectId: i } = T();
467
+ return O({
468
468
  queryKey: ["getTemplateTags"],
469
469
  queryFn: async (n) => await t.get(
470
- `${P.MergeTags}${s}/${r}`
470
+ `${P.MergeTags}${i}/${r}`
471
471
  )
472
472
  });
473
- }, we = () => {
474
- const t = A(), { enerexIdentifier: r, projectId: s } = v();
475
- return k({
473
+ }, ve = () => {
474
+ const t = A(), { enerexIdentifier: r, projectId: i } = T();
475
+ return O({
476
476
  queryKey: ["getExcludeCategory"],
477
477
  queryFn: async (n) => await t.get(
478
- `${P.ExcludeCategory}${s}/${r}`
478
+ `${P.ExcludeCategory}${i}/${r}`
479
479
  )
480
480
  });
481
- }, ve = ({
481
+ }, xe = ({
482
482
  templateHTML: t,
483
483
  className: r = "",
484
- loading: s = !1
484
+ loading: i = !1
485
485
  }) => {
486
- const { post: o } = te(), { data: n } = be(), { data: e } = we(), [a, l] = E(
487
- t ?? { html: j, css: "" }
488
- ), { enerexIdentifier: u, projectId: y, userName: f } = v(), h = "https://plugin.stripocdn.email/content/guids/CABINET_eab4e7d5a4603ac03f4120652a3a5a540f0c79c688514939f095f67433ed4a67/images/photo256.png", b = "https://plugins.stripo.email/api/v1/auth";
486
+ const { post: l } = se(), { data: n } = Te(), { data: e } = ve(), [a, o] = S(
487
+ t ?? { html: D, css: "" }
488
+ ), { enerexIdentifier: p, projectId: h, userName: f } = T(), b = "https://plugin.stripocdn.email/content/guids/CABINET_eab4e7d5a4603ac03f4120652a3a5a540f0c79c688514939f095f67433ed4a67/images/photo256.png", w = "https://plugins.stripo.email/api/v1/auth";
489
489
  _(() => {
490
490
  if (n && e && !document.getElementById("UiEditorScript")) {
491
- const m = document.createElement("script");
492
- m.id = "UiEditorScript", m.type = "module", m.src = D.EDITOR_SCRIPT_URL, m.onload = p, document.body.appendChild(m);
491
+ const u = document.createElement("script");
492
+ u.id = "UiEditorScript", u.type = "module", u.src = k.EDITOR_SCRIPT_URL, u.onload = m, document.body.appendChild(u);
493
493
  }
494
494
  }, [n, e]);
495
- const p = async () => {
495
+ const m = async () => {
496
496
  window.UIEditor.initEditor(
497
497
  document.querySelector("#stripoEditorContainer"),
498
498
  {
@@ -501,32 +501,32 @@ const j = `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:
501
501
  modulesExcludedCategories: e ?? [],
502
502
  forceRecreate: !0,
503
503
  metadata: {
504
- emailId: `${y}_${u}`,
504
+ emailId: `${h}_${p}`,
505
505
  userId: "1",
506
506
  username: f,
507
- avatarUrl: h
507
+ avatarUrl: b
508
508
  },
509
509
  locale: "en",
510
- onTokenRefreshRequest: async function(m) {
510
+ onTokenRefreshRequest: async function(u) {
511
511
  const c = {
512
- pluginId: D.EDITOR_PLUGIN_ID,
513
- secretKey: D.EDITOR_SECRET_KEY,
512
+ pluginId: k.EDITOR_PLUGIN_ID,
513
+ secretKey: k.EDITOR_SECRET_KEY,
514
514
  userId: "12",
515
515
  role: "user"
516
- }, g = await o(b, c);
517
- g && m(g.token);
516
+ }, g = await l(w, c);
517
+ g && u(g.token);
518
518
  },
519
519
  codeEditorButtonSelector: "#codeEditor",
520
520
  undoButtonSelector: "#undoButton",
521
521
  redoButtonSelector: "#redoButton",
522
522
  mobileViewButtonSelector: "#mobileViewButton",
523
523
  desktopViewButtonSelector: "#desktopViewButton",
524
- mergeTags: he(n ?? [])
524
+ mergeTags: we(n ?? [])
525
525
  }
526
526
  );
527
527
  };
528
- return /* @__PURE__ */ i("div", { className: "position-relative", children: /* @__PURE__ */ w("div", { className: `editor-container ${r}`, children: [
529
- s && /* @__PURE__ */ i("div", { className: "loading-overlay", children: /* @__PURE__ */ i(
528
+ return /* @__PURE__ */ s("div", { className: "position-relative", children: /* @__PURE__ */ y("div", { className: `editor-container ${r}`, children: [
529
+ i && /* @__PURE__ */ s("div", { className: "loading-overlay", children: /* @__PURE__ */ s(
530
530
  U,
531
531
  {
532
532
  animation: "border",
@@ -536,61 +536,62 @@ const j = `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:
536
536
  className: "me-1"
537
537
  }
538
538
  ) }),
539
- /* @__PURE__ */ i("div", { id: "externalSystemContainer" }),
540
- /* @__PURE__ */ i("div", { id: "stripoEditorContainer" })
539
+ /* @__PURE__ */ s("div", { id: "externalSystemContainer" }),
540
+ /* @__PURE__ */ s("div", { id: "stripoEditorContainer" })
541
541
  ] }) });
542
- }, Te = ({
542
+ }, Y = ({
543
543
  label: t,
544
544
  register: r,
545
- validation: s,
546
- required: o = !1,
545
+ validation: i,
546
+ required: l = !1,
547
547
  name: n,
548
548
  error: e,
549
- ...a
550
- }) => /* @__PURE__ */ w(S.Group, { className: "mb-1", children: [
551
- t ? /* @__PURE__ */ w(S.Label, { className: "mb-3 d-block form-label", children: [
549
+ className: a = "",
550
+ ...o
551
+ }) => /* @__PURE__ */ y(E.Group, { className: a + " mb-1", children: [
552
+ t ? /* @__PURE__ */ y(E.Label, { className: "mb-3 d-block form-label", children: [
552
553
  t,
553
- o && /* @__PURE__ */ i("label", { className: "text-danger", children: "*" })
554
+ l && /* @__PURE__ */ s("label", { className: "text-danger", children: "*" })
554
555
  ] }) : null,
555
- /* @__PURE__ */ i(
556
- S.Control,
556
+ /* @__PURE__ */ s(
557
+ E.Control,
557
558
  {
558
559
  name: n,
559
560
  type: "text",
560
- ...a,
561
+ ...o,
561
562
  isInvalid: !!(e && e[n]),
562
563
  ...r ? r(n, {
563
- ...s
564
+ ...i
564
565
  }) : {},
565
- className: `form-control ${e && e[n] && "border border-danger"}`
566
+ className: `react-select__control ${e && e[n] && "border border-danger"}`
566
567
  }
567
568
  ),
568
- e && e[n] ? /* @__PURE__ */ i(S.Control.Feedback, { type: "invalid", children: e[n].message }) : null
569
- ] }), xe = () => {
570
- const t = A(), { enerexIdentifier: r, projectId: s } = v();
571
- return k({
569
+ e && e[n] ? /* @__PURE__ */ s(E.Control.Feedback, { type: "invalid", children: e[n].message }) : null
570
+ ] }), Ce = () => {
571
+ const t = A(), { enerexIdentifier: r, projectId: i } = T();
572
+ return O({
572
573
  queryKey: ["getTemplatesList"],
573
574
  queryFn: async (n) => await t.get(
574
- `${P.Template_list}${s}/${r}`
575
+ `${P.Template_list}${i}/${r}`
575
576
  )
576
577
  });
577
- }, Ce = () => {
578
- const t = A(), { enerexIdentifier: r, projectId: s } = v();
579
- return Z({
578
+ }, Ie = () => {
579
+ const t = A(), { enerexIdentifier: r, projectId: i } = T();
580
+ return ne({
580
581
  mutationKey: ["getTemplate"],
581
582
  mutationFn: async ({ id: n }) => {
582
583
  if (n)
583
584
  return await t.get(
584
- `${P.Template}${r}/${n}/${s}`
585
+ `${P.Template}${r}/${n}/${i}`
585
586
  );
586
587
  }
587
588
  });
588
- }, Ie = () => {
589
- const t = A(), { enerexIdentifier: r, projectId: s } = v();
590
- return k({
589
+ }, Se = () => {
590
+ const t = A(), { enerexIdentifier: r, projectId: i } = T();
591
+ return O({
591
592
  queryKey: ["getTemplateTypes"],
592
593
  queryFn: async (n) => await t.get(
593
- `${P.TemplateTypes}${r}/${s}`
594
+ `${P.TemplateTypes}${r}/${i}`
594
595
  )
595
596
  });
596
597
  };
@@ -603,68 +604,68 @@ var B = { exports: {} };
603
604
  Licensed under the MIT License (MIT), see
604
605
  http://jedwatson.github.io/classnames
605
606
  */
606
- var Q;
607
- function Se() {
608
- return Q || (Q = 1, function(t) {
607
+ var X;
608
+ function Ne() {
609
+ return X || (X = 1, function(t) {
609
610
  (function() {
610
611
  var r = {}.hasOwnProperty;
611
- function s() {
612
+ function i() {
612
613
  for (var e = "", a = 0; a < arguments.length; a++) {
613
- var l = arguments[a];
614
- l && (e = n(e, o(l)));
614
+ var o = arguments[a];
615
+ o && (e = n(e, l(o)));
615
616
  }
616
617
  return e;
617
618
  }
618
- function o(e) {
619
+ function l(e) {
619
620
  if (typeof e == "string" || typeof e == "number")
620
621
  return e;
621
622
  if (typeof e != "object")
622
623
  return "";
623
624
  if (Array.isArray(e))
624
- return s.apply(null, e);
625
+ return i.apply(null, e);
625
626
  if (e.toString !== Object.prototype.toString && !e.toString.toString().includes("[native code]"))
626
627
  return e.toString();
627
628
  var a = "";
628
- for (var l in e)
629
- r.call(e, l) && e[l] && (a = n(a, l));
629
+ for (var o in e)
630
+ r.call(e, o) && e[o] && (a = n(a, o));
630
631
  return a;
631
632
  }
632
633
  function n(e, a) {
633
634
  return a ? e ? e + " " + a : e + a : e;
634
635
  }
635
- t.exports ? (s.default = s, t.exports = s) : window.classNames = s;
636
+ t.exports ? (i.default = i, t.exports = i) : window.classNames = i;
636
637
  })();
637
638
  }(B)), B.exports;
638
639
  }
639
- var Ne = Se();
640
- const W = /* @__PURE__ */ Ee(Ne), _e = ({
640
+ var _e = Ne();
641
+ const J = /* @__PURE__ */ Ee(_e), Ae = ({
641
642
  name: t = "",
642
643
  control: r,
643
- options: s,
644
- multiple: o = !1,
644
+ options: i,
645
+ multiple: l = !1,
645
646
  placeholder: n,
646
647
  validation: e,
647
648
  labelKey: a = "name",
648
- disabled: l,
649
- isInvalid: u,
650
- value: y,
649
+ disabled: o,
650
+ isInvalid: p,
651
+ value: h,
651
652
  onChange: f,
652
- uncontrolled: h,
653
- menuPlacement: b = "auto",
654
- closeOnSelect: p = !0
653
+ uncontrolled: b,
654
+ menuPlacement: w = "auto",
655
+ closeOnSelect: m = !0
655
656
  }) => {
656
- const m = {
657
+ const u = {
657
658
  control: (c) => ({
658
659
  ...c,
659
660
  minHeight: "33px",
660
661
  // state.isFocused can display different borderColor if you need it
661
- borderColor: u ? "var(--bs-form-invalid-border-color) !important" : "var(--ct-input-border-color)",
662
- backgroundImage: u ? '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",
662
+ borderColor: p ? "var(--bs-form-invalid-border-color) !important" : "var(--ct-input-border-color)",
663
+ 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",
663
664
  backgroundRepeat: "no-repeat",
664
665
  backgroundPosition: "right calc(0.375em + 0.225rem) center",
665
666
  backgroundSize: "calc(0.75em + 0.45rem) calc(0.75em + 0.45rem)",
666
667
  "&:hover": {
667
- borderColor: u ? "var(--bs-form-invalid-border-color)" : "var(--ct-input-border-color)"
668
+ borderColor: p ? "var(--bs-form-invalid-border-color)" : "var(--ct-input-border-color)"
668
669
  },
669
670
  "& .react-select__single-value": {
670
671
  color: "var(--ct-input-color) !important"
@@ -688,123 +689,124 @@ const W = /* @__PURE__ */ Ee(Ne), _e = ({
688
689
  }),
689
690
  multiValueRemove: (c) => ({
690
691
  ...c,
691
- display: l ? "none" : "block"
692
+ display: o ? "none" : "block"
692
693
  })
693
694
  };
694
- return h ? /* @__PURE__ */ i(
695
- G,
695
+ return b ? /* @__PURE__ */ s(
696
+ W,
696
697
  {
697
- className: W({
698
- "is-invalid": u
698
+ className: J({
699
+ "is-invalid": p
699
700
  }),
700
- styles: m,
701
+ styles: u,
701
702
  classNamePrefix: "react-select",
702
- isMulti: o,
703
- options: s,
703
+ isMulti: l,
704
+ options: i,
704
705
  onChange: f,
705
706
  placeholder: n,
706
707
  menuPortalTarget: document.body,
707
- value: y,
708
+ value: h,
708
709
  getOptionLabel: typeof a == "string" ? (c) => c[a] : a,
709
710
  getOptionValue: (c) => c.id,
710
- isDisabled: l,
711
- menuPlacement: b,
712
- closeMenuOnSelect: p
711
+ isDisabled: o,
712
+ menuPlacement: w,
713
+ closeMenuOnSelect: m
713
714
  }
714
- ) : /* @__PURE__ */ i(
715
- me,
715
+ ) : /* @__PURE__ */ s(
716
+ ge,
716
717
  {
717
718
  control: r,
718
719
  name: t,
719
720
  rules: e,
720
- render: ({ field: { onChange: c, value: g, onBlur: L } }) => /* @__PURE__ */ i(
721
- G,
721
+ render: ({ field: { onChange: c, value: g, onBlur: q } }) => /* @__PURE__ */ s(
722
+ W,
722
723
  {
723
- className: W({
724
- "is-invalid": u
724
+ className: J({
725
+ "is-invalid": p
725
726
  }),
726
- styles: m,
727
+ styles: u,
727
728
  classNamePrefix: "react-select",
728
- isMulti: o,
729
- options: s,
730
- onBlur: L,
729
+ isMulti: l,
730
+ options: i,
731
+ onBlur: q,
731
732
  onChange: c,
732
733
  placeholder: n,
733
734
  menuPortalTarget: document.body,
734
735
  value: g,
735
- getOptionLabel: typeof a == "string" ? (T) => T[a] : a,
736
- getOptionValue: (T) => T.id,
737
- isDisabled: l,
738
- menuPlacement: b,
739
- closeMenuOnSelect: p
736
+ getOptionLabel: typeof a == "string" ? (v) => v[a] : a,
737
+ getOptionValue: (v) => v.id,
738
+ isDisabled: o,
739
+ menuPlacement: w,
740
+ closeMenuOnSelect: m
740
741
  },
741
742
  g ? JSON.stringify(g) : "reset"
742
743
  )
743
744
  }
744
745
  );
745
- }, Y = ({
746
+ }, Z = ({
746
747
  label: t,
747
748
  name: r,
748
- validation: s,
749
- control: o,
749
+ validation: i,
750
+ control: l,
750
751
  error: n,
751
752
  ...e
752
- }) => /* @__PURE__ */ w(S.Group, { className: "mb-1", children: [
753
- t && /* @__PURE__ */ w(S.Label, { className: "mb-3 d-block form-label", children: [
753
+ }) => /* @__PURE__ */ y(E.Group, { className: "mb-1", children: [
754
+ t && /* @__PURE__ */ y(E.Label, { className: "mb-3 d-block form-label", children: [
754
755
  t,
755
756
  " ",
756
- e.required && /* @__PURE__ */ i("span", { className: "text-danger", children: "*" })
757
+ e.required && /* @__PURE__ */ s("span", { className: "text-danger", children: "*" })
757
758
  ] }),
758
- /* @__PURE__ */ i(
759
- _e,
759
+ /* @__PURE__ */ s(
760
+ Ae,
760
761
  {
761
- control: o,
762
+ control: l,
762
763
  options: e.options ?? [],
763
- validation: s,
764
+ validation: i,
764
765
  isInvalid: n && !!n[r],
765
766
  name: r
766
767
  }
767
768
  ),
768
- n && n[r] ? /* @__PURE__ */ i(S.Control.Feedback, { type: "invalid", children: n[r].message }) : null
769
- ] }), Ae = () => {
769
+ n && n[r] ? /* @__PURE__ */ s(E.Control.Feedback, { type: "invalid", children: n[r].message }) : null
770
+ ] }), Pe = () => {
770
771
  const t = A();
771
- ce();
772
- const { enerexIdentifier: r, projectId: s } = v();
773
- return Z({
772
+ ue();
773
+ const { enerexIdentifier: r, projectId: i } = T();
774
+ return ne({
774
775
  mutationKey: ["saveTemplate"],
775
- mutationFn: async (n) => (n.enerexIdentifier = r ?? "", n.projectId = s ?? "", await t.post(
776
+ mutationFn: async (n) => (n.enerexIdentifier = r ?? "", n.projectId = i ?? "", await t.post(
776
777
  `${P.SaveTemplate}`,
777
778
  n
778
779
  ))
779
780
  });
780
- }, X = { id: "", name: "New (Blank)" }, Pe = ({
781
+ }, ee = { id: "", name: "New (Blank)" }, $e = ({
781
782
  onSelectItem: t,
782
783
  templateLoading: r,
783
- onReset: s
784
+ onReset: i
784
785
  }) => {
785
786
  const {
786
- register: o,
787
+ register: l,
787
788
  handleSubmit: n,
788
789
  clearErrors: e,
789
790
  setValue: a,
790
- control: l,
791
- watch: u,
792
- reset: y,
791
+ control: o,
792
+ watch: p,
793
+ reset: h,
793
794
  formState: { errors: f }
794
- } = ue({
795
+ } = fe({
795
796
  defaultValues: {
796
797
  templateName: "",
798
+ subject: "",
797
799
  templateType: void 0,
798
- template: X
800
+ template: ee
799
801
  },
800
802
  mode: "onChange"
801
803
  }), {
802
- data: h,
803
- refetch: b,
804
- isLoading: p
805
- } = xe(), [m, c] = E([]), [g, L] = E(), [T, H] = E(), { mutateAsync: re, isPending: N } = Ce(), { mutateAsync: se, isPending: R } = Ae(), { data: $, isLoading: M } = Ie(), [F, ie] = E([]);
804
+ data: b,
805
+ refetch: w,
806
+ isLoading: m
807
+ } = Ce(), [u, c] = S([]), [g, q] = S(), [v, H] = S(), { mutateAsync: ae, isPending: N } = Ie(), { mutateAsync: le, isPending: L } = Pe(), { data: $, isLoading: M } = Se(), [F, oe] = S([]);
806
808
  _(() => {
807
- $ && ie(
809
+ $ && oe(
808
810
  $.map((d) => ({
809
811
  id: `${d.id}`,
810
812
  name: d.name
@@ -813,179 +815,195 @@ const W = /* @__PURE__ */ Ee(Ne), _e = ({
813
815
  }, [$]), _(() => {
814
816
  r(!!N);
815
817
  }, [N]), _(() => {
816
- c(h ?? []);
817
- }, [h]);
818
- const ae = async (d) => {
819
- if (L(d), d) {
818
+ c(b ?? []);
819
+ }, [b]);
820
+ const de = async (d) => {
821
+ if (q(d), d) {
820
822
  if (a("templateName", d?.name), $ && $.find((C) => C.id === d.type)) {
821
- const C = F.find((O) => O.id === `${d.type}`);
823
+ const C = F.find((R) => R.id === `${d.type}`);
822
824
  C && a("templateType", C);
823
825
  } else
824
826
  a("templateType", void 0);
825
827
  e();
826
828
  }
827
- const x = await re({ id: d?.id });
829
+ const x = await ae({ id: d?.id });
828
830
  H(x || void 0);
829
831
  };
830
832
  _(() => {
831
- let d = m.find((x) => x.id === u("template")?.id);
832
- ae(d);
833
- }, [u("template")]), _(() => {
834
- t(T && g ? T : void 0);
835
- }, [T, g, t]);
836
- const oe = (d) => {
833
+ let d = u.find((x) => x.id === p("template")?.id);
834
+ de(d);
835
+ }, [p("template")]), _(() => {
836
+ t(v && g ? v : void 0);
837
+ }, [v, g, t]);
838
+ const ce = (d) => {
837
839
  window.StripoEditorApi.actionsApi.getTemplateData(
838
840
  async (x) => {
839
- let C = d.template.id;
840
- g?.projectId === 0 && (C = "");
841
- const O = {
841
+ let C = d.template.id, R = "";
842
+ g?.projectId === 0 && (C = "", R = d.template.id);
843
+ const V = {
842
844
  enerexIdentifier: "",
843
845
  projectId: "",
844
846
  templateId: C,
845
847
  templateType: d.templateType.id,
846
848
  name: d.templateName,
847
- html: x.html,
848
- css: x.css
849
+ html: `<style>${x.css}</style>${x.html}`,
850
+ subject: d?.subject ?? "",
851
+ parent_id: R
849
852
  };
850
- await se(O) && (e(), y(), b());
853
+ console.log("request", V), await le(V) && (e(), h(), w());
851
854
  }
852
855
  );
853
856
  };
854
- return /* @__PURE__ */ i(K, { className: "border border-0 text-start", children: /* @__PURE__ */ i(K.Body, { className: "pe-0 ps-2", children: /* @__PURE__ */ i("form", { onSubmit: n(oe), children: /* @__PURE__ */ i("div", { className: "template-list-container mb-3", children: /* @__PURE__ */ w(pe, { children: [
855
- /* @__PURE__ */ i(q, { md: 3, children: /* @__PURE__ */ i(
856
- Y,
857
- {
858
- label: "Type",
859
- control: l,
860
- error: f,
861
- options: F,
862
- required: !0,
863
- validation: {
864
- required: {
865
- value: !0,
866
- message: "Template Type is required"
857
+ return /* @__PURE__ */ s(z, { className: "border border-0 text-start", children: /* @__PURE__ */ s(z.Body, { className: "pe-0 ps-2", children: /* @__PURE__ */ s("form", { onSubmit: n(ce), children: /* @__PURE__ */ y("div", { className: "template-list-container gap-3", children: [
858
+ /* @__PURE__ */ y(G, { children: [
859
+ /* @__PURE__ */ s(j, { md: 3, children: /* @__PURE__ */ s(
860
+ Z,
861
+ {
862
+ label: "Type",
863
+ control: o,
864
+ error: f,
865
+ options: F,
866
+ required: !0,
867
+ validation: {
868
+ required: {
869
+ value: !0,
870
+ message: "Template Type is required"
871
+ }
872
+ },
873
+ ...l("templateType")
874
+ }
875
+ ) }),
876
+ /* @__PURE__ */ s(j, { md: 3, children: /* @__PURE__ */ s(
877
+ Z,
878
+ {
879
+ label: "Template",
880
+ control: o,
881
+ error: f,
882
+ options: [
883
+ ee,
884
+ ...u.filter(
885
+ (d) => d.type?.toString() === p("templateType")?.id || d.type === null
886
+ ).map((d) => ({
887
+ id: d.id,
888
+ name: d.name
889
+ }))
890
+ ],
891
+ required: !1,
892
+ ...l("template")
893
+ }
894
+ ) }),
895
+ /* @__PURE__ */ s(j, { md: 3, children: /* @__PURE__ */ s(
896
+ Y,
897
+ {
898
+ label: "Name",
899
+ register: l,
900
+ error: f,
901
+ required: !0,
902
+ name: "templateName",
903
+ validation: {
904
+ required: {
905
+ value: !0,
906
+ message: "Template Name is required"
907
+ }
867
908
  }
868
- },
869
- ...o("templateType")
870
- }
871
- ) }),
872
- /* @__PURE__ */ i(q, { md: 3, children: /* @__PURE__ */ i(
909
+ }
910
+ ) }),
911
+ /* @__PURE__ */ y(
912
+ j,
913
+ {
914
+ md: 3,
915
+ className: "d-flex align-items-end justify-content-end gap-2 mb-3",
916
+ children: [
917
+ /* @__PURE__ */ s(
918
+ Q,
919
+ {
920
+ style: { width: "70px" },
921
+ variant: "primary",
922
+ disabled: m || N || L || M,
923
+ onClick: () => {
924
+ q(void 0), h(), i();
925
+ },
926
+ children: N || L ? /* @__PURE__ */ s(
927
+ U,
928
+ {
929
+ animation: "border",
930
+ style: { width: "11px", height: "11px" },
931
+ size: "sm",
932
+ role: "status",
933
+ className: "me-1",
934
+ children: /* @__PURE__ */ s("span", { className: "visually-hidden", children: "Loading..." })
935
+ }
936
+ ) : "Clear"
937
+ }
938
+ ),
939
+ /* @__PURE__ */ s(
940
+ Q,
941
+ {
942
+ type: "submit",
943
+ variant: "primary",
944
+ style: { width: "80px" },
945
+ disabled: m || N || L || M,
946
+ children: N || L ? /* @__PURE__ */ s(
947
+ U,
948
+ {
949
+ animation: "border",
950
+ style: { width: "11px", height: "11px" },
951
+ size: "sm",
952
+ role: "status",
953
+ className: "me-1",
954
+ children: /* @__PURE__ */ s("span", { className: "visually-hidden", children: "Loading..." })
955
+ }
956
+ ) : (g?.id ?? "") === "" ? "Save" : (g?.projectId ?? "") === 0 ? "Save as" : "Save"
957
+ }
958
+ )
959
+ ]
960
+ }
961
+ )
962
+ ] }),
963
+ p("templateType")?.id === "2" && /* @__PURE__ */ s(G, { children: /* @__PURE__ */ s(j, { md: 12, children: /* @__PURE__ */ s(
873
964
  Y,
874
965
  {
875
- label: "Template",
876
- control: l,
966
+ className: "mt-3",
967
+ label: "Subject",
968
+ register: l,
877
969
  error: f,
878
- options: [
879
- X,
880
- ...m.map((d) => ({
881
- id: d.id,
882
- name: d.name
883
- }))
884
- ],
885
970
  required: !1,
886
- ...o("template")
887
- }
888
- ) }),
889
- /* @__PURE__ */ i(q, { md: 3, children: /* @__PURE__ */ i(
890
- Te,
891
- {
892
- label: "Name",
893
- register: o,
894
- error: f,
895
- required: !0,
896
- name: "templateName",
897
- validation: {
898
- required: {
899
- value: !0,
900
- message: "Template Name is required"
901
- }
902
- }
903
- }
904
- ) }),
905
- /* @__PURE__ */ w(
906
- q,
907
- {
908
- md: 3,
909
- className: "d-flex align-items-end justify-content-end gap-2 mb-3",
910
- children: [
911
- /* @__PURE__ */ i(
912
- z,
913
- {
914
- style: { width: "70px" },
915
- variant: "primary",
916
- disabled: p || N || R || M,
917
- onClick: () => {
918
- L(void 0), y(), s();
919
- },
920
- children: N || R ? /* @__PURE__ */ i(
921
- U,
922
- {
923
- animation: "border",
924
- style: { width: "11px", height: "11px" },
925
- size: "sm",
926
- role: "status",
927
- className: "me-1",
928
- children: /* @__PURE__ */ i("span", { className: "visually-hidden", children: "Loading..." })
929
- }
930
- ) : "Clear"
931
- }
932
- ),
933
- /* @__PURE__ */ i(
934
- z,
935
- {
936
- type: "submit",
937
- variant: "primary",
938
- style: { width: "80px" },
939
- disabled: p || N || R || M,
940
- children: N || R ? /* @__PURE__ */ i(
941
- U,
942
- {
943
- animation: "border",
944
- style: { width: "11px", height: "11px" },
945
- size: "sm",
946
- role: "status",
947
- className: "me-1",
948
- children: /* @__PURE__ */ i("span", { className: "visually-hidden", children: "Loading..." })
949
- }
950
- ) : (g?.id ?? "") === "" ? "Save" : (g?.projectId ?? "") === 0 ? "Save as" : "Save"
951
- }
952
- )
953
- ]
971
+ name: "subject"
954
972
  }
955
- )
956
- ] }) }) }) }) });
957
- }, Be = ({ config: t }) => {
958
- const [r, s] = E(), [o, n] = E(!1);
959
- return /* @__PURE__ */ i(ge, { configs: t, children: /* @__PURE__ */ i(ye, { children: /* @__PURE__ */ w("div", { className: "root-widget", children: [
960
- /* @__PURE__ */ i(
961
- Pe,
973
+ ) }) })
974
+ ] }) }) }) });
975
+ }, Ue = ({ config: t }) => {
976
+ const [r, i] = S(), [l, n] = S(!1);
977
+ return /* @__PURE__ */ s(ye, { configs: t, children: /* @__PURE__ */ s(be, { children: /* @__PURE__ */ y("div", { className: "root-widget", children: [
978
+ /* @__PURE__ */ s(
979
+ $e,
962
980
  {
963
981
  templateLoading: n,
964
- onSelectItem: (l) => {
965
- s(l), window.StripoEditorApi && window.StripoEditorApi.actionsApi && window.StripoEditorApi.actionsApi.updateHtmlAndCss(
966
- l?.html ?? j,
967
- l?.css ?? "",
982
+ onSelectItem: (o) => {
983
+ i(o), window.StripoEditorApi && window.StripoEditorApi.actionsApi && window.StripoEditorApi.actionsApi.updateHtmlAndCss(
984
+ o?.html ?? D,
985
+ o?.css ?? "",
968
986
  ""
969
987
  );
970
988
  },
971
989
  onReset: () => {
972
- n(!1), s(void 0), window.StripoEditorApi && window.StripoEditorApi.actionsApi && window.StripoEditorApi.actionsApi.updateHtmlAndCss(j, "", "");
990
+ n(!1), i(void 0), window.StripoEditorApi && window.StripoEditorApi.actionsApi && window.StripoEditorApi.actionsApi.updateHtmlAndCss(D, "", "");
973
991
  }
974
992
  }
975
993
  ),
976
- /* @__PURE__ */ i(
977
- ve,
994
+ /* @__PURE__ */ s(
995
+ xe,
978
996
  {
979
997
  templateHTML: {
980
998
  css: r?.css ?? "",
981
- html: r?.html ?? j
999
+ html: r?.html ?? D
982
1000
  },
983
- loading: o,
1001
+ loading: l,
984
1002
  className: "col-span-5"
985
1003
  }
986
1004
  )
987
1005
  ] }) }) });
988
1006
  };
989
1007
  export {
990
- Be as EditorWidget
1008
+ Ue as EditorWidget
991
1009
  };
@@ -1,4 +1,4 @@
1
- (function(u,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("react/jsx-runtime"),require("react"),require("@tanstack/react-query"),require("axios"),require("react-bootstrap"),require("react-hook-form"),require("react-select")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","@tanstack/react-query","axios","react-bootstrap","react-hook-form","react-select"],n):(u=typeof globalThis<"u"?globalThis:u||self,n(u.EnerexTemplateEditor={},u.jsxRuntime,u.React,u.reactQuery,u.axios,u.reactBootstrap,u.reactHookForm,u.Select$1))})(this,function(u,n,d,b,O,c,F,M){"use strict";const A=`<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
1
+ (function(f,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("react/jsx-runtime"),require("react"),require("@tanstack/react-query"),require("axios"),require("react-bootstrap"),require("react-hook-form"),require("react-select")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","@tanstack/react-query","axios","react-bootstrap","react-hook-form","react-select"],n):(f=typeof globalThis<"u"?globalThis:f||self,n(f.EnerexTemplateEditor={},f.jsxRuntime,f.React,f.reactQuery,f.axios,f.reactBootstrap,f.reactHookForm,f.Select$1))})(this,function(f,n,c,w,O,p,F,M){"use strict";const j=`<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
2
2
  <html\r
3
3
  dir="ltr"\r
4
4
  xmlns:o="urn:schemas-microsoft-com:office:office"\r
@@ -354,8 +354,8 @@
354
354
  </div>\r
355
355
  </body>\r
356
356
  </html>\r
357
- `,U=d.createContext(void 0),J=({children:t,configs:s})=>{const[i,o]=d.useState(s.clientId),[r,e]=d.useState(s.apiKey),[l,a]=d.useState(s.enerexIdentifier),[y,v]=d.useState(s.userName),[w,x]=d.useState(s.projectId),C=f=>{e(f.apiKey),o(f.clientId),x(f.projectId),a(f.enerexIdentifier),v(f.userName)};return n.jsx(U.Provider,{value:{clientId:i,apiKey:r,setConfiguration:C,enerexIdentifier:l,projectId:w,userName:y},children:t})},T=()=>{const t=d.useContext(U);if(!t)throw new Error("widgetConfig must be used within a ConfigProvider");return t},H=(t="",s)=>({get:async(r,e)=>{try{const l=await O.get(`${t}${r}`,e??s);if(l.status===200)return l.data}catch(l){throw l}},post:async(r,e,l)=>{try{const a=await O.post(`${t}${r}`,e,l??s);if(a.status===200)return a.data}catch(a){throw a}}}),j={EDITOR_SCRIPT_URL:"https://plugins.stripo.email/resources/uieditor/latest/UIEditor.js",EDITOR_PLUGIN_ID:"1afdc3161ec7409a8627a1c8561d45f5",EDITOR_SECRET_KEY:"54ba748ed7e94f2e929555783acb03da",API_BASE_URL:"https://dev-socket.enerex.com/common/api"},V=d.createContext({get:()=>{throw new Error("HttpClientContext.get not implemented")},post:()=>{throw new Error("HttpClientContext.post not implemented")}}),Q=({children:t})=>{const{clientId:s,apiKey:i}=T(),o={headers:{client_id:s,"x-api-key":i}},{get:r,post:e}=H(j.API_BASE_URL,o);return n.jsx(V.Provider,{value:{get:r,post:e},children:t})},Z=({children:t})=>{const s=new b.QueryClient;return n.jsx(Q,{children:n.jsx(b.QueryClientProvider,{client:s,children:t})})},R=t=>{const s=Array.from(new Set(t.map(o=>o.category))),i=[];return s.forEach(o=>{const r=t.filter(e=>e.category===o).map(e=>({label:e.label,value:e.value,hint:e.hint,hidden:e.hidden}));i.push({category:o,entries:r})}),i},N=()=>{const t=d.useContext(V);if(t)return t;throw new Error("useHttpClient must be used within a HttpClientProvider")},_={Template_list:"/Template/list/",Template:"/Template/GetTemplate/",MergeTags:"/Template/TemplateMergeTags/",ExcludeCategory:"/Template/GetExcludeCategories/",SaveTemplate:"/Template/save-update/",TemplateTypes:"/Template/TemplateTypes/"},ee=()=>{const t=N(),{enerexIdentifier:s,projectId:i}=T();return b.useQuery({queryKey:["getTemplateTags"],queryFn:async r=>await t.get(`${_.MergeTags}${i}/${s}`)})},te=()=>{const t=N(),{enerexIdentifier:s,projectId:i}=T();return b.useQuery({queryKey:["getExcludeCategory"],queryFn:async r=>await t.get(`${_.ExcludeCategory}${i}/${s}`)})},ne=({templateHTML:t,className:s="",loading:i=!1})=>{const{post:o}=H(),{data:r}=ee(),{data:e}=te(),[l,a]=d.useState(t??{html:A,css:""}),{enerexIdentifier:y,projectId:v,userName:w}=T(),x="https://plugin.stripocdn.email/content/guids/CABINET_eab4e7d5a4603ac03f4120652a3a5a540f0c79c688514939f095f67433ed4a67/images/photo256.png",C="https://plugins.stripo.email/api/v1/auth";d.useEffect(()=>{if(r&&e&&!document.getElementById("UiEditorScript")){const g=document.createElement("script");g.id="UiEditorScript",g.type="module",g.src=j.EDITOR_SCRIPT_URL,g.onload=f,document.body.appendChild(g)}},[r,e]);const f=async()=>{window.UIEditor.initEditor(document.querySelector("#stripoEditorContainer"),{html:l.html,css:l.css,modulesExcludedCategories:e??[],forceRecreate:!0,metadata:{emailId:`${v}_${y}`,userId:"1",username:w,avatarUrl:x},locale:"en",onTokenRefreshRequest:async function(g){const m={pluginId:j.EDITOR_PLUGIN_ID,secretKey:j.EDITOR_SECRET_KEY,userId:"12",role:"user"},h=await o(C,m);h&&g(h.token)},codeEditorButtonSelector:"#codeEditor",undoButtonSelector:"#undoButton",redoButtonSelector:"#redoButton",mobileViewButtonSelector:"#mobileViewButton",desktopViewButtonSelector:"#desktopViewButton",mergeTags:R(r??[])})};return n.jsx("div",{className:"position-relative",children:n.jsxs("div",{className:`editor-container ${s}`,children:[i&&n.jsx("div",{className:"loading-overlay",children:n.jsx(c.Spinner,{animation:"border",style:{width:"11px",height:"11px"},size:"sm",role:"status",className:"me-1"})}),n.jsx("div",{id:"externalSystemContainer"}),n.jsx("div",{id:"stripoEditorContainer"})]})})},re=({label:t,register:s,validation:i,required:o=!1,name:r,error:e,...l})=>n.jsxs(c.Form.Group,{className:"mb-1",children:[t?n.jsxs(c.Form.Label,{className:"mb-3 d-block form-label",children:[t,o&&n.jsx("label",{className:"text-danger",children:"*"})]}):null,n.jsx(c.Form.Control,{name:r,type:"text",...l,isInvalid:!!(e&&e[r]),...s?s(r,{...i}):{},className:`form-control ${e&&e[r]&&"border border-danger"}`}),e&&e[r]?n.jsx(c.Form.Control.Feedback,{type:"invalid",children:e[r].message}):null]}),se=()=>{const t=N(),{enerexIdentifier:s,projectId:i}=T();return b.useQuery({queryKey:["getTemplatesList"],queryFn:async r=>await t.get(`${_.Template_list}${i}/${s}`)})},ie=()=>{const t=N(),{enerexIdentifier:s,projectId:i}=T();return b.useMutation({mutationKey:["getTemplate"],mutationFn:async({id:r})=>{if(r)return await t.get(`${_.Template}${s}/${r}/${i}`)}})},le=()=>{const t=N(),{enerexIdentifier:s,projectId:i}=T();return b.useQuery({queryKey:["getTemplateTypes"],queryFn:async r=>await t.get(`${_.TemplateTypes}${s}/${i}`)})};function oe(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var k={exports:{}};/*!
357
+ `,U=c.createContext(void 0),Z=({children:t,configs:s})=>{const[i,o]=c.useState(s.clientId),[r,e]=c.useState(s.apiKey),[l,a]=c.useState(s.enerexIdentifier),[u,v]=c.useState(s.userName),[b,x]=c.useState(s.projectId),C=g=>{e(g.apiKey),o(g.clientId),x(g.projectId),a(g.enerexIdentifier),v(g.userName)};return n.jsx(U.Provider,{value:{clientId:i,apiKey:r,setConfiguration:C,enerexIdentifier:l,projectId:b,userName:u},children:t})},T=()=>{const t=c.useContext(U);if(!t)throw new Error("widgetConfig must be used within a ConfigProvider");return t},H=(t="",s)=>({get:async(r,e)=>{try{const l=await O.get(`${t}${r}`,e??s);if(l.status===200)return l.data}catch(l){throw l}},post:async(r,e,l)=>{try{const a=await O.post(`${t}${r}`,e,l??s);if(a.status===200)return a.data}catch(a){throw a}}}),A={EDITOR_SCRIPT_URL:"https://plugins.stripo.email/resources/uieditor/latest/UIEditor.js",EDITOR_PLUGIN_ID:"1afdc3161ec7409a8627a1c8561d45f5",EDITOR_SECRET_KEY:"54ba748ed7e94f2e929555783acb03da",API_BASE_URL:"https://dev-socket.enerex.com/common/api"},V=c.createContext({get:()=>{throw new Error("HttpClientContext.get not implemented")},post:()=>{throw new Error("HttpClientContext.post not implemented")}}),R=({children:t})=>{const{clientId:s,apiKey:i}=T(),o={headers:{client_id:s,"x-api-key":i}},{get:r,post:e}=H(A.API_BASE_URL,o);return n.jsx(V.Provider,{value:{get:r,post:e},children:t})},ee=({children:t})=>{const s=new w.QueryClient;return n.jsx(R,{children:n.jsx(w.QueryClientProvider,{client:s,children:t})})},te=t=>{const s=Array.from(new Set(t.map(o=>o.category))),i=[];return s.forEach(o=>{const r=t.filter(e=>e.category===o).map(e=>({label:e.label,value:e.value,hint:e.hint,hidden:e.hidden}));i.push({category:o,entries:r})}),i},N=()=>{const t=c.useContext(V);if(t)return t;throw new Error("useHttpClient must be used within a HttpClientProvider")},_={Template_list:"/Template/list/",Template:"/Template/GetTemplate/",MergeTags:"/Template/TemplateMergeTags/",ExcludeCategory:"/Template/GetExcludeCategories/",SaveTemplate:"/Template/save-update/",TemplateTypes:"/Template/TemplateTypes/"},ne=()=>{const t=N(),{enerexIdentifier:s,projectId:i}=T();return w.useQuery({queryKey:["getTemplateTags"],queryFn:async r=>await t.get(`${_.MergeTags}${i}/${s}`)})},re=()=>{const t=N(),{enerexIdentifier:s,projectId:i}=T();return w.useQuery({queryKey:["getExcludeCategory"],queryFn:async r=>await t.get(`${_.ExcludeCategory}${i}/${s}`)})},se=({templateHTML:t,className:s="",loading:i=!1})=>{const{post:o}=H(),{data:r}=ne(),{data:e}=re(),[l,a]=c.useState(t??{html:j,css:""}),{enerexIdentifier:u,projectId:v,userName:b}=T(),x="https://plugin.stripocdn.email/content/guids/CABINET_eab4e7d5a4603ac03f4120652a3a5a540f0c79c688514939f095f67433ed4a67/images/photo256.png",C="https://plugins.stripo.email/api/v1/auth";c.useEffect(()=>{if(r&&e&&!document.getElementById("UiEditorScript")){const y=document.createElement("script");y.id="UiEditorScript",y.type="module",y.src=A.EDITOR_SCRIPT_URL,y.onload=g,document.body.appendChild(y)}},[r,e]);const g=async()=>{window.UIEditor.initEditor(document.querySelector("#stripoEditorContainer"),{html:l.html,css:l.css,modulesExcludedCategories:e??[],forceRecreate:!0,metadata:{emailId:`${v}_${u}`,userId:"1",username:b,avatarUrl:x},locale:"en",onTokenRefreshRequest:async function(y){const m={pluginId:A.EDITOR_PLUGIN_ID,secretKey:A.EDITOR_SECRET_KEY,userId:"12",role:"user"},h=await o(C,m);h&&y(h.token)},codeEditorButtonSelector:"#codeEditor",undoButtonSelector:"#undoButton",redoButtonSelector:"#redoButton",mobileViewButtonSelector:"#mobileViewButton",desktopViewButtonSelector:"#desktopViewButton",mergeTags:te(r??[])})};return n.jsx("div",{className:"position-relative",children:n.jsxs("div",{className:`editor-container ${s}`,children:[i&&n.jsx("div",{className:"loading-overlay",children:n.jsx(p.Spinner,{animation:"border",style:{width:"11px",height:"11px"},size:"sm",role:"status",className:"me-1"})}),n.jsx("div",{id:"externalSystemContainer"}),n.jsx("div",{id:"stripoEditorContainer"})]})})},K=({label:t,register:s,validation:i,required:o=!1,name:r,error:e,className:l="",...a})=>n.jsxs(p.Form.Group,{className:l+" mb-1",children:[t?n.jsxs(p.Form.Label,{className:"mb-3 d-block form-label",children:[t,o&&n.jsx("label",{className:"text-danger",children:"*"})]}):null,n.jsx(p.Form.Control,{name:r,type:"text",...a,isInvalid:!!(e&&e[r]),...s?s(r,{...i}):{},className:`react-select__control ${e&&e[r]&&"border border-danger"}`}),e&&e[r]?n.jsx(p.Form.Control.Feedback,{type:"invalid",children:e[r].message}):null]}),ie=()=>{const t=N(),{enerexIdentifier:s,projectId:i}=T();return w.useQuery({queryKey:["getTemplatesList"],queryFn:async r=>await t.get(`${_.Template_list}${i}/${s}`)})},le=()=>{const t=N(),{enerexIdentifier:s,projectId:i}=T();return w.useMutation({mutationKey:["getTemplate"],mutationFn:async({id:r})=>{if(r)return await t.get(`${_.Template}${s}/${r}/${i}`)}})},oe=()=>{const t=N(),{enerexIdentifier:s,projectId:i}=T();return w.useQuery({queryKey:["getTemplateTypes"],queryFn:async r=>await t.get(`${_.TemplateTypes}${s}/${i}`)})};function ae(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var D={exports:{}};/*!
358
358
  Copyright (c) 2018 Jed Watson.
359
359
  Licensed under the MIT License (MIT), see
360
360
  http://jedwatson.github.io/classnames
361
- */var K;function ae(){return K||(K=1,function(t){(function(){var s={}.hasOwnProperty;function i(){for(var e="",l=0;l<arguments.length;l++){var a=arguments[l];a&&(e=r(e,o(a)))}return e}function o(e){if(typeof e=="string"||typeof e=="number")return e;if(typeof e!="object")return"";if(Array.isArray(e))return i.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var l="";for(var a in e)s.call(e,a)&&e[a]&&(l=r(l,a));return l}function r(e,l){return l?e?e+" "+l:e+l:e}t.exports?(i.default=i,t.exports=i):window.classNames=i})()}(k)),k.exports}var de=ae();const z=oe(de),ce=({name:t="",control:s,options:i,multiple:o=!1,placeholder:r,validation:e,labelKey:l="name",disabled:a,isInvalid:y,value:v,onChange:w,uncontrolled:x,menuPlacement:C="auto",closeOnSelect:f=!0})=>{const g={control:m=>({...m,minHeight:"33px",borderColor:y?"var(--bs-form-invalid-border-color) !important":"var(--ct-input-border-color)",backgroundImage:y?'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",backgroundRepeat:"no-repeat",backgroundPosition:"right calc(0.375em + 0.225rem) center",backgroundSize:"calc(0.75em + 0.45rem) calc(0.75em + 0.45rem)","&:hover":{borderColor:y?"var(--bs-form-invalid-border-color)":"var(--ct-input-border-color)"},"& .react-select__single-value":{color:"var(--ct-input-color) !important"},"& .react-select__placeholder":{color:"var(--ct-input-placeholder-color) !important"},"& .react-select__indicators":{display:"none"}}),menu:m=>({...m,marginTop:0,width:"max-content",minWidth:"100%"}),menuPortal:m=>({...m,zIndex:9999}),multiValueRemove:m=>({...m,display:a?"none":"block"})};return x?n.jsx(M,{className:z({"is-invalid":y}),styles:g,classNamePrefix:"react-select",isMulti:o,options:i,onChange:w,placeholder:r,menuPortalTarget:document.body,value:v,getOptionLabel:typeof l=="string"?m=>m[l]:l,getOptionValue:m=>m.id,isDisabled:a,menuPlacement:C,closeMenuOnSelect:f}):n.jsx(F.Controller,{control:s,name:t,rules:e,render:({field:{onChange:m,value:h,onBlur:L}})=>n.jsx(M,{className:z({"is-invalid":y}),styles:g,classNamePrefix:"react-select",isMulti:o,options:i,onBlur:L,onChange:m,placeholder:r,menuPortalTarget:document.body,value:h,getOptionLabel:typeof l=="string"?S=>S[l]:l,getOptionValue:S=>S.id,isDisabled:a,menuPlacement:C,closeMenuOnSelect:f},h?JSON.stringify(h):"reset")})},G=({label:t,name:s,validation:i,control:o,error:r,...e})=>n.jsxs(c.Form.Group,{className:"mb-1",children:[t&&n.jsxs(c.Form.Label,{className:"mb-3 d-block form-label",children:[t," ",e.required&&n.jsx("span",{className:"text-danger",children:"*"})]}),n.jsx(ce,{control:o,options:e.options??[],validation:i,isInvalid:r&&!!r[s],name:s}),r&&r[s]?n.jsx(c.Form.Control.Feedback,{type:"invalid",children:r[s].message}):null]}),pe=()=>{const t=N();b.useQueryClient();const{enerexIdentifier:s,projectId:i}=T();return b.useMutation({mutationKey:["saveTemplate"],mutationFn:async r=>(r.enerexIdentifier=s??"",r.projectId=i??"",await t.post(`${_.SaveTemplate}`,r))})},W={id:"",name:"New (Blank)"},me=({onSelectItem:t,templateLoading:s,onReset:i})=>{const{register:o,handleSubmit:r,clearErrors:e,setValue:l,control:a,watch:y,reset:v,formState:{errors:w}}=F.useForm({defaultValues:{templateName:"",templateType:void 0,template:W},mode:"onChange"}),{data:x,refetch:C,isLoading:f}=se(),[g,m]=d.useState([]),[h,L]=d.useState(),[S,B]=d.useState(),{mutateAsync:fe,isPending:q}=ie(),{mutateAsync:ge,isPending:$}=pe(),{data:P,isLoading:Y}=le(),[X,ye]=d.useState([]);d.useEffect(()=>{P&&ye(P.map(p=>({id:`${p.id}`,name:p.name})))},[P]),d.useEffect(()=>{s(!!q)},[q]),d.useEffect(()=>{m(x??[])},[x]);const he=async p=>{if(L(p),p){if(l("templateName",p?.name),P&&P.find(I=>I.id===p.type)){const I=X.find(D=>D.id===`${p.type}`);I&&l("templateType",I)}else l("templateType",void 0);e()}const E=await fe({id:p?.id});B(E||void 0)};d.useEffect(()=>{let p=g.find(E=>E.id===y("template")?.id);he(p)},[y("template")]),d.useEffect(()=>{t(S&&h?S:void 0)},[S,h,t]);const be=p=>{window.StripoEditorApi.actionsApi.getTemplateData(async E=>{let I=p.template.id;h?.projectId===0&&(I="");const D={enerexIdentifier:"",projectId:"",templateId:I,templateType:p.templateType.id,name:p.templateName,html:E.html,css:E.css};await ge(D)&&(e(),v(),C())})};return n.jsx(c.Card,{className:"border border-0 text-start",children:n.jsx(c.Card.Body,{className:"pe-0 ps-2",children:n.jsx("form",{onSubmit:r(be),children:n.jsx("div",{className:"template-list-container mb-3",children:n.jsxs(c.Row,{children:[n.jsx(c.Col,{md:3,children:n.jsx(G,{label:"Type",control:a,error:w,options:X,required:!0,validation:{required:{value:!0,message:"Template Type is required"}},...o("templateType")})}),n.jsx(c.Col,{md:3,children:n.jsx(G,{label:"Template",control:a,error:w,options:[W,...g.map(p=>({id:p.id,name:p.name}))],required:!1,...o("template")})}),n.jsx(c.Col,{md:3,children:n.jsx(re,{label:"Name",register:o,error:w,required:!0,name:"templateName",validation:{required:{value:!0,message:"Template Name is required"}}})}),n.jsxs(c.Col,{md:3,className:"d-flex align-items-end justify-content-end gap-2 mb-3",children:[n.jsx(c.Button,{style:{width:"70px"},variant:"primary",disabled:f||q||$||Y,onClick:()=>{L(void 0),v(),i()},children:q||$?n.jsx(c.Spinner,{animation:"border",style:{width:"11px",height:"11px"},size:"sm",role:"status",className:"me-1",children:n.jsx("span",{className:"visually-hidden",children:"Loading..."})}):"Clear"}),n.jsx(c.Button,{type:"submit",variant:"primary",style:{width:"80px"},disabled:f||q||$||Y,children:q||$?n.jsx(c.Spinner,{animation:"border",style:{width:"11px",height:"11px"},size:"sm",role:"status",className:"me-1",children:n.jsx("span",{className:"visually-hidden",children:"Loading..."})}):(h?.id??"")===""?"Save":(h?.projectId??"")===0?"Save as":"Save"})]})]})})})})})},ue=({config:t})=>{const[s,i]=d.useState(),[o,r]=d.useState(!1),e=a=>{i(a),window.StripoEditorApi&&window.StripoEditorApi.actionsApi&&window.StripoEditorApi.actionsApi.updateHtmlAndCss(a?.html??A,a?.css??"","")},l=()=>{r(!1),i(void 0),window.StripoEditorApi&&window.StripoEditorApi.actionsApi&&window.StripoEditorApi.actionsApi.updateHtmlAndCss(A,"","")};return n.jsx(J,{configs:t,children:n.jsx(Z,{children:n.jsxs("div",{className:"root-widget",children:[n.jsx(me,{templateLoading:r,onSelectItem:e,onReset:l}),n.jsx(ne,{templateHTML:{css:s?.css??"",html:s?.html??A},loading:o,className:"col-span-5"})]})})})};u.EditorWidget=ue,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
361
+ */var z;function de(){return z||(z=1,function(t){(function(){var s={}.hasOwnProperty;function i(){for(var e="",l=0;l<arguments.length;l++){var a=arguments[l];a&&(e=r(e,o(a)))}return e}function o(e){if(typeof e=="string"||typeof e=="number")return e;if(typeof e!="object")return"";if(Array.isArray(e))return i.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var l="";for(var a in e)s.call(e,a)&&e[a]&&(l=r(l,a));return l}function r(e,l){return l?e?e+" "+l:e+l:e}t.exports?(i.default=i,t.exports=i):window.classNames=i})()}(D)),D.exports}var ce=de();const G=ae(ce),pe=({name:t="",control:s,options:i,multiple:o=!1,placeholder:r,validation:e,labelKey:l="name",disabled:a,isInvalid:u,value:v,onChange:b,uncontrolled:x,menuPlacement:C="auto",closeOnSelect:g=!0})=>{const y={control:m=>({...m,minHeight:"33px",borderColor:u?"var(--bs-form-invalid-border-color) !important":"var(--ct-input-border-color)",backgroundImage:u?'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",backgroundRepeat:"no-repeat",backgroundPosition:"right calc(0.375em + 0.225rem) center",backgroundSize:"calc(0.75em + 0.45rem) calc(0.75em + 0.45rem)","&:hover":{borderColor:u?"var(--bs-form-invalid-border-color)":"var(--ct-input-border-color)"},"& .react-select__single-value":{color:"var(--ct-input-color) !important"},"& .react-select__placeholder":{color:"var(--ct-input-placeholder-color) !important"},"& .react-select__indicators":{display:"none"}}),menu:m=>({...m,marginTop:0,width:"max-content",minWidth:"100%"}),menuPortal:m=>({...m,zIndex:9999}),multiValueRemove:m=>({...m,display:a?"none":"block"})};return x?n.jsx(M,{className:G({"is-invalid":u}),styles:y,classNamePrefix:"react-select",isMulti:o,options:i,onChange:b,placeholder:r,menuPortalTarget:document.body,value:v,getOptionLabel:typeof l=="string"?m=>m[l]:l,getOptionValue:m=>m.id,isDisabled:a,menuPlacement:C,closeMenuOnSelect:g}):n.jsx(F.Controller,{control:s,name:t,rules:e,render:({field:{onChange:m,value:h,onBlur:$}})=>n.jsx(M,{className:G({"is-invalid":u}),styles:y,classNamePrefix:"react-select",isMulti:o,options:i,onBlur:$,onChange:m,placeholder:r,menuPortalTarget:document.body,value:h,getOptionLabel:typeof l=="string"?S=>S[l]:l,getOptionValue:S=>S.id,isDisabled:a,menuPlacement:C,closeMenuOnSelect:g},h?JSON.stringify(h):"reset")})},W=({label:t,name:s,validation:i,control:o,error:r,...e})=>n.jsxs(p.Form.Group,{className:"mb-1",children:[t&&n.jsxs(p.Form.Label,{className:"mb-3 d-block form-label",children:[t," ",e.required&&n.jsx("span",{className:"text-danger",children:"*"})]}),n.jsx(pe,{control:o,options:e.options??[],validation:i,isInvalid:r&&!!r[s],name:s}),r&&r[s]?n.jsx(p.Form.Control.Feedback,{type:"invalid",children:r[s].message}):null]}),me=()=>{const t=N();w.useQueryClient();const{enerexIdentifier:s,projectId:i}=T();return w.useMutation({mutationKey:["saveTemplate"],mutationFn:async r=>(r.enerexIdentifier=s??"",r.projectId=i??"",await t.post(`${_.SaveTemplate}`,r))})},Y={id:"",name:"New (Blank)"},ue=({onSelectItem:t,templateLoading:s,onReset:i})=>{const{register:o,handleSubmit:r,clearErrors:e,setValue:l,control:a,watch:u,reset:v,formState:{errors:b}}=F.useForm({defaultValues:{templateName:"",subject:"",templateType:void 0,template:Y},mode:"onChange"}),{data:x,refetch:C,isLoading:g}=ie(),[y,m]=c.useState([]),[h,$]=c.useState(),[S,B]=c.useState(),{mutateAsync:ge,isPending:q}=le(),{mutateAsync:ye,isPending:L}=me(),{data:P,isLoading:X}=oe(),[J,he]=c.useState([]);c.useEffect(()=>{P&&he(P.map(d=>({id:`${d.id}`,name:d.name})))},[P]),c.useEffect(()=>{s(!!q)},[q]),c.useEffect(()=>{m(x??[])},[x]);const be=async d=>{if($(d),d){if(l("templateName",d?.name),P&&P.find(I=>I.id===d.type)){const I=J.find(k=>k.id===`${d.type}`);I&&l("templateType",I)}else l("templateType",void 0);e()}const E=await ge({id:d?.id});B(E||void 0)};c.useEffect(()=>{let d=y.find(E=>E.id===u("template")?.id);be(d)},[u("template")]),c.useEffect(()=>{t(S&&h?S:void 0)},[S,h,t]);const we=d=>{window.StripoEditorApi.actionsApi.getTemplateData(async E=>{let I=d.template.id,k="";h?.projectId===0&&(I="",k=d.template.id);const Q={enerexIdentifier:"",projectId:"",templateId:I,templateType:d.templateType.id,name:d.templateName,html:`<style>${E.css}</style>${E.html}`,subject:d?.subject??"",parent_id:k};console.log("request",Q),await ye(Q)&&(e(),v(),C())})};return n.jsx(p.Card,{className:"border border-0 text-start",children:n.jsx(p.Card.Body,{className:"pe-0 ps-2",children:n.jsx("form",{onSubmit:r(we),children:n.jsxs("div",{className:"template-list-container gap-3",children:[n.jsxs(p.Row,{children:[n.jsx(p.Col,{md:3,children:n.jsx(W,{label:"Type",control:a,error:b,options:J,required:!0,validation:{required:{value:!0,message:"Template Type is required"}},...o("templateType")})}),n.jsx(p.Col,{md:3,children:n.jsx(W,{label:"Template",control:a,error:b,options:[Y,...y.filter(d=>d.type?.toString()===u("templateType")?.id||d.type===null).map(d=>({id:d.id,name:d.name}))],required:!1,...o("template")})}),n.jsx(p.Col,{md:3,children:n.jsx(K,{label:"Name",register:o,error:b,required:!0,name:"templateName",validation:{required:{value:!0,message:"Template Name is required"}}})}),n.jsxs(p.Col,{md:3,className:"d-flex align-items-end justify-content-end gap-2 mb-3",children:[n.jsx(p.Button,{style:{width:"70px"},variant:"primary",disabled:g||q||L||X,onClick:()=>{$(void 0),v(),i()},children:q||L?n.jsx(p.Spinner,{animation:"border",style:{width:"11px",height:"11px"},size:"sm",role:"status",className:"me-1",children:n.jsx("span",{className:"visually-hidden",children:"Loading..."})}):"Clear"}),n.jsx(p.Button,{type:"submit",variant:"primary",style:{width:"80px"},disabled:g||q||L||X,children:q||L?n.jsx(p.Spinner,{animation:"border",style:{width:"11px",height:"11px"},size:"sm",role:"status",className:"me-1",children:n.jsx("span",{className:"visually-hidden",children:"Loading..."})}):(h?.id??"")===""?"Save":(h?.projectId??"")===0?"Save as":"Save"})]})]}),u("templateType")?.id==="2"&&n.jsx(p.Row,{children:n.jsx(p.Col,{md:12,children:n.jsx(K,{className:"mt-3",label:"Subject",register:o,error:b,required:!1,name:"subject"})})})]})})})})},fe=({config:t})=>{const[s,i]=c.useState(),[o,r]=c.useState(!1),e=a=>{i(a),window.StripoEditorApi&&window.StripoEditorApi.actionsApi&&window.StripoEditorApi.actionsApi.updateHtmlAndCss(a?.html??j,a?.css??"","")},l=()=>{r(!1),i(void 0),window.StripoEditorApi&&window.StripoEditorApi.actionsApi&&window.StripoEditorApi.actionsApi.updateHtmlAndCss(j,"","")};return n.jsx(Z,{configs:t,children:n.jsx(ee,{children:n.jsxs("div",{className:"root-widget",children:[n.jsx(ue,{templateLoading:r,onSelectItem:e,onReset:l}),n.jsx(se,{templateHTML:{css:s?.css??"",html:s?.html??j},loading:o,className:"col-span-5"})]})})})};f.EditorWidget=fe,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});
@@ -1 +1 @@
1
- .root-widget{margin:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif,Inter,system-ui,Avenir,Helvetica,Arial,sans-serif;-moz-osx-font-smoothing:grayscale;line-height:1.5;font-weight:400;-webkit-font-smoothing:antialiased}.root-widget code{font-family:source-code-pro,Menlo,Monaco,Consolas,Courier New,monospace}.root-widget .ng-star-inserted{display:none}.root-widget .wraped-text{text-wrap:nowrap;overflow:hidden;text-overflow:ellipsis}.root-widget .required:after{content:" *";color:#fa5c7c}.root-widget button{border-radius:8px;border:1px solid transparent;padding:.6em 1.2em;font-size:1em;font-weight:500;font-family:inherit;cursor:pointer;transition:border-color .25s}.root-widget button:hover{border-color:#646cff}.root-widget button:focus,.root-widget button:focus-visible{outline:4px auto -webkit-focus-ring-color}.root-widget .loader-container{display:flex;justify-content:center;align-items:center;height:100vh;width:100vw}.root-widget .info-icon{height:14px}.root-widget .info-icon img{width:100%;height:100%}.dark-popover{left:50%;transform:translate(-50%) translateY(-8px);z-index:9999;width:50px!important;font-size:.85rem!important;padding:.5rem;background-color:#1e1e1e!important;color:#f1f1f1;border:1px solid #444}.dark-popover.bs-popover-top>.popover-arrow:before,.dark-popover.bs-popover-bottom>.popover-arrow:before,.dark-popover.bs-popover-left>.popover-arrow:before,.dark-popover.bs-popover-right>.popover-arrow:before{border-color:transparent!important}.dark-popover.bs-popover-top>.popover-arrow:after{border-top-color:#1e1e1e!important}.dark-popover.bs-popover-bottom>.popover-arrow:after{border-bottom-color:#1e1e1e!important}.dark-popover.bs-popover-left>.popover-arrow:after{border-left-color:#1e1e1e!important}.dark-popover.bs-popover-right>.popover-arrow:after{border-right-color:#1e1e1e!important}.template-list-container{max-height:350px;overflow-y:auto}.react-select__control--is-focused{border-color:var(--ct-input-border-color)!important;box-shadow:none!important}.react-select__option{color:var(--ct-input-color)!important;background-color:#fff!important}.react-select__option:hover,.react-select__option--is-focused,.react-select__option--is-selected{color:var(--ct-input-color)!important;background-color:#deebff!important}.root-widget label{font-weight:600!important}.root-widget input{padding-block:1px!important;padding-inline:2px!important}.root-widget .form-control{display:block!important;outline:none!important;box-shadow:none!important;width:100%!important;padding:.45rem .9rem!important;font-size:.9rem!important;font-weight:400!important;line-height:1.5!important;color:var(--ct-input-color)!important;background-color:var(--ct-input-bg)!important;background-clip:padding-box!important;border:1px solid var(--ct-input-border-color)!important;appearance:none!important;border-radius:.25rem!important;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out!important}.root-widget .btn{--bs-btn-padding-x: .9rem !important;--bs-btn-padding-y: .25rem !important;--bs-btn-font-size: .9rem !important;--bs-btn-font-weight: 400 !important;--bs-btn-line-height: 1.5 !important;--bs-btn-color: #6c757d !important;--bs-btn-bg: transparent !important;--bs-btn-border-width: 1px !important;--bs-btn-border-color: transparent !important;--bs-btn-border-radius: .15rem !important;--bs-btn-hover-border-color: transparent !important;--bs-btn-box-shadow: 0px 2px 6px 0px !important;--bs-btn-disabled-opacity: .65 !important;--bs-btn-focus-box-shadow: 0 0 0 .2rem rgba(var(--bs-btn-focus-shadow-rgb), .5) !important;display:inline-block!important;padding:var(--bs-btn-padding-y) var(--bs-btn-padding-x)!important;font-family:var(--bs-btn-font-family)!important;font-size:var(--bs-btn-font-size)!important;font-weight:var(--bs-btn-font-weight)!important;line-height:var(--bs-btn-line-height)!important;color:var(--bs-btn-color)!important;text-align:center!important;vertical-align:middle!important;cursor:pointer!important;-webkit-user-select:none!important;user-select:none!important;border:var(--bs-btn-border-width) solid var(--bs-btn-border-color)!important;border-radius:var(--bs-btn-border-radius)!important;background-color:var(--bs-btn-bg)!important;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out!important}.root-widget .btn-primary{--bs-btn-color: #fff !important;--bs-btn-bg: #131c45 !important;--bs-btn-border-color: #131c45 !important;--bs-btn-hover-color: #fff !important;--bs-btn-hover-bg: #10183b !important;--bs-btn-hover-border-color: #0f1637 !important;--bs-btn-focus-shadow-rgb: 54, 62, 97 !important;--bs-btn-active-color: #fff !important;--bs-btn-active-bg: #0f1637 !important;--bs-btn-active-border-color: #0e1534 !important;--bs-btn-active-shadow: var(--ct-btn-active-box-shadow) !important;--bs-btn-disabled-color: #fff !important;--bs-btn-disabled-bg: #131c45 !important;--bs-btn-disabled-border-color: #131c45 !important}.root-widget .logo{height:6em;padding:1.5em;will-change:filter;transition:filter .3s}.root-widget .logo:hover{filter:drop-shadow(0 0 2em #646cffaa)}.root-widget .logo.react:hover{filter:drop-shadow(0 0 2em #61dafbaa)}.root-widget .requiredField:after{content:"";font-family:FontAwesome;position:absolute;left:10px;top:10px;color:red}@keyframes logo-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@media (prefers-reduced-motion: no-preference){a:nth-of-type(2) .logo{animation:logo-spin infinite 20s linear}}.root-widget .card{padding:.3em}.root-widget .read-the-docs{color:#888}.root-widget .row{margin:0!important}#stripoEditorContainer{height:calc(100% + -0px)}.editor-container{height:100vh;position:absolute;min-width:1200px;width:100%;overflow:auto}.root-widget .loading-overlay{position:absolute;top:0;left:0;width:100%;height:100%;background-color:#fffc;display:flex;justify-content:center;align-items:center;z-index:1000}
1
+ .root-widget{margin:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif,Inter,system-ui,Avenir,Helvetica,Arial,sans-serif;-moz-osx-font-smoothing:grayscale;line-height:1.5;font-weight:400;-webkit-font-smoothing:antialiased}.root-widget code{font-family:source-code-pro,Menlo,Monaco,Consolas,Courier New,monospace}.root-widget .ng-star-inserted{display:none}.root-widget .wraped-text{text-wrap:nowrap;overflow:hidden;text-overflow:ellipsis}.root-widget .required:after{content:" *";color:#fa5c7c}.root-widget button{border-radius:8px;border:1px solid transparent;padding:.6em 1.2em;font-size:1em;font-weight:500;font-family:inherit;cursor:pointer;transition:border-color .25s}.root-widget button:hover{border-color:#646cff}.root-widget button:focus,.root-widget button:focus-visible{outline:4px auto -webkit-focus-ring-color}.root-widget .loader-container{display:flex;justify-content:center;align-items:center;height:100vh;width:100vw}.root-widget .info-icon{height:14px}.root-widget .info-icon img{width:100%;height:100%}.dark-popover{left:50%;transform:translate(-50%) translateY(-8px);z-index:9999;width:50px!important;font-size:.85rem!important;padding:.5rem;background-color:#1e1e1e!important;color:#f1f1f1;border:1px solid #444}.dark-popover.bs-popover-top>.popover-arrow:before,.dark-popover.bs-popover-bottom>.popover-arrow:before,.dark-popover.bs-popover-left>.popover-arrow:before,.dark-popover.bs-popover-right>.popover-arrow:before{border-color:transparent!important}.dark-popover.bs-popover-top>.popover-arrow:after{border-top-color:#1e1e1e!important}.dark-popover.bs-popover-bottom>.popover-arrow:after{border-bottom-color:#1e1e1e!important}.dark-popover.bs-popover-left>.popover-arrow:after{border-left-color:#1e1e1e!important}.dark-popover.bs-popover-right>.popover-arrow:after{border-right-color:#1e1e1e!important}.template-list-container{max-height:350px;overflow-y:auto}.react-select__control--is-focused{border-color:var(--ct-input-border-color)!important;box-shadow:none!important}.react-select__option{color:var(--ct-input-color)!important;background-color:#fff!important}.react-select__option:hover,.react-select__option--is-focused,.react-select__option--is-selected{color:var(--ct-input-color)!important;background-color:#deebff!important}.root-widget label{font-weight:600!important}.root-widget input{padding-block:1px!important;padding-inline:2px!important}.root-widget .form-control{display:block!important;outline:none!important;box-shadow:none!important;width:100%!important;padding:.45rem .9rem!important;font-size:.9rem!important;font-weight:400!important;line-height:1.5!important;color:var(--ct-input-color)!important;background-color:var(--ct-input-bg)!important;background-clip:padding-box!important;border:1px solid var(--ct-input-border-color)!important;appearance:none!important;border-radius:.25rem!important;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out!important}.root-widget .btn{--bs-btn-padding-x: .9rem !important;--bs-btn-padding-y: .25rem !important;--bs-btn-font-size: .9rem !important;--bs-btn-font-weight: 400 !important;--bs-btn-line-height: 1.5 !important;--bs-btn-color: #6c757d !important;--bs-btn-bg: transparent !important;--bs-btn-border-width: 1px !important;--bs-btn-border-color: transparent !important;--bs-btn-border-radius: .15rem !important;--bs-btn-hover-border-color: transparent !important;--bs-btn-box-shadow: 0px 2px 6px 0px !important;--bs-btn-disabled-opacity: .65 !important;--bs-btn-focus-box-shadow: 0 0 0 .2rem rgba(var(--bs-btn-focus-shadow-rgb), .5) !important;display:inline-block!important;padding:var(--bs-btn-padding-y) var(--bs-btn-padding-x)!important;font-family:var(--bs-btn-font-family)!important;font-size:var(--bs-btn-font-size)!important;font-weight:var(--bs-btn-font-weight)!important;line-height:var(--bs-btn-line-height)!important;color:var(--bs-btn-color)!important;text-align:center!important;vertical-align:middle!important;cursor:pointer!important;-webkit-user-select:none!important;user-select:none!important;border:var(--bs-btn-border-width) solid var(--bs-btn-border-color)!important;border-radius:var(--bs-btn-border-radius)!important;background-color:var(--bs-btn-bg)!important;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out!important}.root-widget .btn-primary{--bs-btn-color: #fff !important;--bs-btn-bg: #131c45 !important;--bs-btn-border-color: #131c45 !important;--bs-btn-hover-color: #fff !important;--bs-btn-hover-bg: #10183b !important;--bs-btn-hover-border-color: #0f1637 !important;--bs-btn-focus-shadow-rgb: 54, 62, 97 !important;--bs-btn-active-color: #fff !important;--bs-btn-active-bg: #0f1637 !important;--bs-btn-active-border-color: #0e1534 !important;--bs-btn-active-shadow: var(--ct-btn-active-box-shadow) !important;--bs-btn-disabled-color: #fff !important;--bs-btn-disabled-bg: #131c45 !important;--bs-btn-disabled-border-color: #131c45 !important}.root-widget .logo{height:6em;padding:1.5em;will-change:filter;transition:filter .3s}.root-widget .logo:hover{filter:drop-shadow(0 0 2em #646cffaa)}.root-widget .logo.react:hover{filter:drop-shadow(0 0 2em #61dafbaa)}.root-widget .requiredField:after{content:"";font-family:FontAwesome;position:absolute;left:10px;top:10px;color:red}@keyframes logo-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@media (prefers-reduced-motion: no-preference){a:nth-of-type(2) .logo{animation:logo-spin infinite 20s linear}}.root-widget .card{padding:.3em}.root-widget .read-the-docs{color:#888}.root-widget .row{margin:0!important}.root-widget{--ct-input-border-color: #ced4da !important}#stripoEditorContainer{height:calc(100% + -0px)}.editor-container{height:100vh;position:absolute;min-width:1200px;width:100%;overflow:auto}.root-widget .loading-overlay{position:absolute;top:0;left:0;width:100%;height:100%;background-color:#fffc;display:flex;justify-content:center;align-items:center;z-index:1000}
@@ -5,6 +5,7 @@ interface TextBoxProps extends InputHTMLAttributes<HTMLInputElement> {
5
5
  error?: FieldErrors | undefined;
6
6
  name: string;
7
7
  required?: boolean;
8
+ className?: string;
8
9
  register?: any;
9
10
  validation?: Record<string, any>;
10
11
  }
@@ -29,7 +29,8 @@ export type ISaveTemplate = {
29
29
  templateType: number;
30
30
  name: string;
31
31
  html: string;
32
- css: string;
32
+ subject?: string;
33
+ parent_id: string;
33
34
  };
34
35
  export type TemplateTag = {
35
36
  id: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enerex/template-studio",
3
- "version": "1.1.18",
3
+ "version": "1.1.19",
4
4
  "main": "./dist/enerex-template-editor.umd.js",
5
5
  "module": "./dist/enerex-template-editor.es.js",
6
6
  "types": "./dist/types/index.d.ts",