@enerex/template-studio 1.1.17 → 1.1.18

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.
@@ -386,7 +386,7 @@ const j = `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:
386
386
  children: t
387
387
  }
388
388
  );
389
- }, T = () => {
389
+ }, v = () => {
390
390
  const t = J(ee);
391
391
  if (!t)
392
392
  throw new Error("widgetConfig must be used within a ConfigProvider");
@@ -429,7 +429,7 @@ const j = `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:
429
429
  throw new Error("HttpClientContext.post not implemented");
430
430
  }
431
431
  }), fe = ({ children: t }) => {
432
- const { clientId: r, apiKey: s } = T(), o = {
432
+ const { clientId: r, apiKey: s } = v(), o = {
433
433
  headers: {
434
434
  client_id: r,
435
435
  "x-api-key": s
@@ -463,7 +463,7 @@ const j = `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:
463
463
  SaveTemplate: "/Template/save-update/",
464
464
  TemplateTypes: "/Template/TemplateTypes/"
465
465
  }, be = () => {
466
- const t = A(), { enerexIdentifier: r, projectId: s } = T();
466
+ const t = A(), { enerexIdentifier: r, projectId: s } = v();
467
467
  return k({
468
468
  queryKey: ["getTemplateTags"],
469
469
  queryFn: async (n) => await t.get(
@@ -471,21 +471,21 @@ const j = `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:
471
471
  )
472
472
  });
473
473
  }, we = () => {
474
- const t = A(), { enerexIdentifier: r, projectId: s } = T();
474
+ const t = A(), { enerexIdentifier: r, projectId: s } = v();
475
475
  return k({
476
476
  queryKey: ["getExcludeCategory"],
477
477
  queryFn: async (n) => await t.get(
478
478
  `${P.ExcludeCategory}${s}/${r}`
479
479
  )
480
480
  });
481
- }, Te = ({
481
+ }, ve = ({
482
482
  templateHTML: t,
483
483
  className: r = "",
484
484
  loading: s = !1
485
485
  }) => {
486
486
  const { post: o } = te(), { data: n } = be(), { data: e } = we(), [a, l] = E(
487
487
  t ?? { html: j, css: "" }
488
- ), { enerexIdentifier: u, projectId: y, userName: f } = T(), h = "https://plugin.stripocdn.email/content/guids/CABINET_eab4e7d5a4603ac03f4120652a3a5a540f0c79c688514939f095f67433ed4a67/images/photo256.png", b = "https://plugins.stripo.email/api/v1/auth";
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";
489
489
  _(() => {
490
490
  if (n && e && !document.getElementById("UiEditorScript")) {
491
491
  const m = document.createElement("script");
@@ -539,7 +539,7 @@ const j = `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:
539
539
  /* @__PURE__ */ i("div", { id: "externalSystemContainer" }),
540
540
  /* @__PURE__ */ i("div", { id: "stripoEditorContainer" })
541
541
  ] }) });
542
- }, ve = ({
542
+ }, Te = ({
543
543
  label: t,
544
544
  register: r,
545
545
  validation: s,
@@ -567,7 +567,7 @@ const j = `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:
567
567
  ),
568
568
  e && e[n] ? /* @__PURE__ */ i(S.Control.Feedback, { type: "invalid", children: e[n].message }) : null
569
569
  ] }), xe = () => {
570
- const t = A(), { enerexIdentifier: r, projectId: s } = T();
570
+ const t = A(), { enerexIdentifier: r, projectId: s } = v();
571
571
  return k({
572
572
  queryKey: ["getTemplatesList"],
573
573
  queryFn: async (n) => await t.get(
@@ -575,7 +575,7 @@ const j = `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:
575
575
  )
576
576
  });
577
577
  }, Ce = () => {
578
- const t = A(), { enerexIdentifier: r, projectId: s } = T();
578
+ const t = A(), { enerexIdentifier: r, projectId: s } = v();
579
579
  return Z({
580
580
  mutationKey: ["getTemplate"],
581
581
  mutationFn: async ({ id: n }) => {
@@ -586,7 +586,7 @@ const j = `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:
586
586
  }
587
587
  });
588
588
  }, Ie = () => {
589
- const t = A(), { enerexIdentifier: r, projectId: s } = T();
589
+ const t = A(), { enerexIdentifier: r, projectId: s } = v();
590
590
  return k({
591
591
  queryKey: ["getTemplateTypes"],
592
592
  queryFn: async (n) => await t.get(
@@ -732,8 +732,8 @@ const W = /* @__PURE__ */ Ee(Ne), _e = ({
732
732
  placeholder: n,
733
733
  menuPortalTarget: document.body,
734
734
  value: g,
735
- getOptionLabel: typeof a == "string" ? (v) => v[a] : a,
736
- getOptionValue: (v) => v.id,
735
+ getOptionLabel: typeof a == "string" ? (T) => T[a] : a,
736
+ getOptionValue: (T) => T.id,
737
737
  isDisabled: l,
738
738
  menuPlacement: b,
739
739
  closeMenuOnSelect: p
@@ -769,7 +769,7 @@ const W = /* @__PURE__ */ Ee(Ne), _e = ({
769
769
  ] }), Ae = () => {
770
770
  const t = A();
771
771
  ce();
772
- const { enerexIdentifier: r, projectId: s } = T();
772
+ const { enerexIdentifier: r, projectId: s } = v();
773
773
  return Z({
774
774
  mutationKey: ["saveTemplate"],
775
775
  mutationFn: async (n) => (n.enerexIdentifier = r ?? "", n.projectId = s ?? "", await t.post(
@@ -802,7 +802,7 @@ const W = /* @__PURE__ */ Ee(Ne), _e = ({
802
802
  data: h,
803
803
  refetch: b,
804
804
  isLoading: p
805
- } = xe(), [m, c] = E([]), [g, L] = E(), [v, H] = E(), { mutateAsync: re, isPending: N } = Ce(), { mutateAsync: se, isPending: R } = Ae(), { data: $, isLoading: M } = Ie(), [F, ie] = E([]);
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([]);
806
806
  _(() => {
807
807
  $ && ie(
808
808
  $.map((d) => ({
@@ -831,8 +831,8 @@ const W = /* @__PURE__ */ Ee(Ne), _e = ({
831
831
  let d = m.find((x) => x.id === u("template")?.id);
832
832
  ae(d);
833
833
  }, [u("template")]), _(() => {
834
- t(v && g ? v : void 0);
835
- }, [v, g, t]);
834
+ t(T && g ? T : void 0);
835
+ }, [T, g, t]);
836
836
  const oe = (d) => {
837
837
  window.StripoEditorApi.actionsApi.getTemplateData(
838
838
  async (x) => {
@@ -855,7 +855,7 @@ const W = /* @__PURE__ */ Ee(Ne), _e = ({
855
855
  /* @__PURE__ */ i(q, { md: 3, children: /* @__PURE__ */ i(
856
856
  Y,
857
857
  {
858
- label: "Template Type",
858
+ label: "Type",
859
859
  control: l,
860
860
  error: f,
861
861
  options: F,
@@ -872,7 +872,7 @@ const W = /* @__PURE__ */ Ee(Ne), _e = ({
872
872
  /* @__PURE__ */ i(q, { md: 3, children: /* @__PURE__ */ i(
873
873
  Y,
874
874
  {
875
- label: "Templates",
875
+ label: "Template",
876
876
  control: l,
877
877
  error: f,
878
878
  options: [
@@ -887,9 +887,9 @@ const W = /* @__PURE__ */ Ee(Ne), _e = ({
887
887
  }
888
888
  ) }),
889
889
  /* @__PURE__ */ i(q, { md: 3, children: /* @__PURE__ */ i(
890
- ve,
890
+ Te,
891
891
  {
892
- label: "Template Name",
892
+ label: "Name",
893
893
  register: o,
894
894
  error: f,
895
895
  required: !0,
@@ -974,7 +974,7 @@ const W = /* @__PURE__ */ Ee(Ne), _e = ({
974
974
  }
975
975
  ),
976
976
  /* @__PURE__ */ i(
977
- Te,
977
+ ve,
978
978
  {
979
979
  templateHTML: {
980
980
  css: r?.css ?? "",
@@ -358,4 +358,4 @@
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:"Template 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:"Templates",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:"Template 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 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"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enerex/template-studio",
3
- "version": "1.1.17",
3
+ "version": "1.1.18",
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",