(self.webpackChunk_digicommerce_cms_admin=self.webpackChunk_digicommerce_cms_admin||[]).push([[8418],{16540:(F,L,d)=>{"use strict";F.exports=d(67468)},67468:function(F,L,d){(function(l,E){F.exports=E(d(32735),d(19615))})(this,function(l,E){return function(n){var i={};function t(r){if(i[r])return i[r].exports;var o=i[r]={i:r,l:!1,exports:{}};return n[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=n,t.c=i,t.d=function(r,o,c){t.o(r,o)||Object.defineProperty(r,o,{enumerable:!0,get:c})},t.r=function(r){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},t.t=function(r,o){if(1&o&&(r=t(r)),8&o||4&o&&typeof r=="object"&&r&&r.__esModule)return r;var c=Object.create(null);if(t.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:r}),2&o&&typeof r!="string")for(var a in r)t.d(c,a,function(p){return r[p]}.bind(null,a));return c},t.n=function(r){var o=r&&r.__esModule?function(){return r.default}:function(){return r};return t.d(o,"a",o),o},t.o=function(r,o){return Object.prototype.hasOwnProperty.call(r,o)},t.p="",t(t.s=110)}({0:function(n,i,t){n.exports=t(19)()},1:function(n,i){n.exports=l},10:function(n,i,t){var r=t(25),o=t(26),c=t(22),a=t(27);n.exports=function(p,f){return r(p)||o(p,f)||c(p,f)||a()},n.exports.default=n.exports,n.exports.__esModule=!0},110:function(n,i,t){"use strict";t.r(i),t.d(i,"Main",function(){return e}),t.d(i,"SkipToContent",function(){return G});var r,o=t(5),c=t.n(o),a=t(4),p=t.n(a),f=t(3),b=t.n(f),O=t(1),h=t.n(O),u=t(0),P=t.n(u),M=t(2),j=t.n(M),I=["labelledBy"],U=j.a.main(r||(r=b()([`
  // To prevent global outline on focus visible to force an outline when Main is focused
  &:focus-visible {
    outline: none;
  }
`]))),e=function(A){var W=A.labelledBy,Y=p()(A,I),J=W||"main-content-title";return h.a.createElement(U,c()({"aria-labelledby":J,id:"main-content",tabIndex:-1},Y))};e.defaultProps={labelledBy:void 0},e.propTypes={labelledBy:P.a.string};var s,y=t(6),H=j()(y.Box)(s||(s=b()([`
  text-decoration: none;
  position: absolute;
  z-index: 9999;
  left: -100%;
  top: -100%;

  &:focus {
    left: `,`;
    top: `,`;
  }
`])),function(A){return A.theme.spaces[3]},function(A){return A.theme.spaces[3]}),G=function(A){var W=A.children;return h.a.createElement(H,{as:"a",href:"#main-content",background:"primary600",color:"neutral0",padding:3,hasRadius:!0},W)};G.propTypes={children:P.a.node.isRequired}},13:function(n,i){function t(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?(n.exports=t=function(o){return typeof o},n.exports.default=n.exports,n.exports.__esModule=!0):(n.exports=t=function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},n.exports.default=n.exports,n.exports.__esModule=!0),t(r)}n.exports=t,n.exports.default=n.exports,n.exports.__esModule=!0},19:function(n,i,t){"use strict";var r=t(20);function o(){}function c(){}c.resetWarningCache=o,n.exports=function(){function a(b,O,h,u,P,M){if(M!==r){var j=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw j.name="Invariant Violation",j}}function p(){return a}a.isRequired=a;var f={array:a,bool:a,func:a,number:a,object:a,string:a,symbol:a,any:a,arrayOf:p,element:a,elementType:a,instanceOf:p,node:a,objectOf:p,oneOf:p,oneOfType:p,shape:p,exact:p,checkPropTypes:c,resetWarningCache:o};return f.PropTypes=f,f}},2:function(n,i){n.exports=E},20:function(n,i,t){"use strict";n.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},21:function(n,i){n.exports=function(t,r){(r==null||r>t.length)&&(r=t.length);for(var o=0,c=new Array(r);o<r;o++)c[o]=t[o];return c},n.exports.default=n.exports,n.exports.__esModule=!0},22:function(n,i,t){var r=t(21);n.exports=function(o,c){if(o){if(typeof o=="string")return r(o,c);var a=Object.prototype.toString.call(o).slice(8,-1);return a==="Object"&&o.constructor&&(a=o.constructor.name),a==="Map"||a==="Set"?Array.from(o):a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?r(o,c):void 0}},n.exports.default=n.exports,n.exports.__esModule=!0},24:function(n,i){n.exports=function(t,r){if(t==null)return{};var o,c,a={},p=Object.keys(t);for(c=0;c<p.length;c++)o=p[c],r.indexOf(o)>=0||(a[o]=t[o]);return a},n.exports.default=n.exports,n.exports.__esModule=!0},25:function(n,i){n.exports=function(t){if(Array.isArray(t))return t},n.exports.default=n.exports,n.exports.__esModule=!0},26:function(n,i){n.exports=function(t,r){var o=t==null?null:typeof Symbol!="undefined"&&t[Symbol.iterator]||t["@@iterator"];if(o!=null){var c,a,p=[],f=!0,b=!1;try{for(o=o.call(t);!(f=(c=o.next()).done)&&(p.push(c.value),!r||p.length!==r);f=!0);}catch(O){b=!0,a=O}finally{try{f||o.return==null||o.return()}finally{if(b)throw a}}return p}},n.exports.default=n.exports,n.exports.__esModule=!0},27:function(n,i){n.exports=function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)},n.exports.default=n.exports,n.exports.__esModule=!0},3:function(n,i){n.exports=function(t,r){return r||(r=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(r)}}))},n.exports.default=n.exports,n.exports.__esModule=!0},4:function(n,i,t){var r=t(24);n.exports=function(o,c){if(o==null)return{};var a,p,f=r(o,c);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(o);for(p=0;p<b.length;p++)a=b[p],c.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(o,a)&&(f[a]=o[a])}return f},n.exports.default=n.exports,n.exports.__esModule=!0},5:function(n,i){function t(){return n.exports=t=Object.assign||function(r){for(var o=1;o<arguments.length;o++){var c=arguments[o];for(var a in c)Object.prototype.hasOwnProperty.call(c,a)&&(r[a]=c[a])}return r},n.exports.default=n.exports,n.exports.__esModule=!0,t.apply(this,arguments)}n.exports=t,n.exports.default=n.exports,n.exports.__esModule=!0},6:function(n,i,t){"use strict";t.r(i),t.d(i,"Box",function(){return U});var r,o=t(3),c=t.n(o),a=t(2),p=t.n(a),f=t(7),b=t(1),O=t.n(b),h=t(0),u=t.n(h),P=function(e){return O.a.createElement("div",e)},M={background:void 0,borderColor:void 0,color:void 0,hiddenS:!1,hiddenXS:!1,padding:void 0,paddingTop:void 0,paddingRight:void 0,paddingBottom:void 0,paddingLeft:void 0,hasRadius:!1,shadow:void 0,children:null,shrink:void 0,grow:void 0,basis:void 0,flex:void 0,_hover:function(){}},j={_hover:u.a.func,background:u.a.string,basis:u.a.oneOfType([u.a.string,u.a.string]),borderColor:u.a.string,children:u.a.oneOfType([u.a.node,u.a.string]),color:u.a.string,flex:u.a.oneOfType([u.a.string,u.a.string]),grow:u.a.oneOfType([u.a.string,u.a.string]),hasRadius:u.a.bool,hiddenS:u.a.bool,hiddenXS:u.a.bool,padding:u.a.oneOfType([u.a.number,u.a.arrayOf(u.a.number)]),paddingBottom:u.a.oneOfType([u.a.number,u.a.arrayOf(u.a.number)]),paddingLeft:u.a.oneOfType([u.a.number,u.a.arrayOf(u.a.number)]),paddingRight:u.a.oneOfType([u.a.number,u.a.arrayOf(u.a.number)]),paddingTop:u.a.oneOfType([u.a.number,u.a.arrayOf(u.a.number)]),shadow:u.a.string,shrink:u.a.oneOfType([u.a.string,u.a.string])};P.defaultProps=M,P.propTypes=j;var I={color:!0},U=p.a.div.withConfig({shouldForwardProp:function(e,s){return!I[e]&&s(e)}})(r||(r=c()([`
  // Font
  font-size: `,`;

  // Colors
  background: `,`;
  color: `,`;

  // Spaces
  `,`
  `,`
  `,`
  `,`
  `,`
  `,`
  `,`
  `,`
  `,`

  // Responsive hiding
  `,`
  `,`
  

  // Borders
  border-radius: `,`;
  border-style: `,`;
  border-width: `,`;
  border-color: `,`;
  border: `,`;

  // Shadows
  box-shadow: `,`;

  // Handlers
  pointer-events: `,`;
  &:hover {
    `,`
  }

  // Display
  display: `,`;

  // Position
  position: `,`;
  left: `,`;
  right: `,`;
  top: `,`;
  bottom: `,`;
  z-index: `,`;
  overflow: `,`;
  cursor: `,`;

  // Size
  width: `,`;
  max-width: `,`;
  min-width: `,`;
  height: `,`;
  max-height: `,`;
  min-height: `,`;

  // Animation
  transition: `,`;
  transform: `,`;
  animation: `,`;

  //Flexbox children props
  flex-shrink: `,`;
  flex-grow: `,`;
  flex-basis: `,`;
  flex: `,`;

  // Text
  text-align: `,`;
  text-transform: `,`;
  line-height: `,`;

  // Cursor
  cursor: `,`;
`])),function(e){var s=e.fontSize;return e.theme.fontSizes[s]||s},function(e){var s=e.theme,y=e.background;return s.colors[y]},function(e){var s=e.theme,y=e.color;return s.colors[y]},function(e){var s=e.theme,y=e.padding;return Object(f.a)("padding",y,s)},function(e){var s=e.theme,y=e.paddingTop;return Object(f.a)("padding-top",y,s)},function(e){var s=e.theme,y=e.paddingRight;return Object(f.a)("padding-right",y,s)},function(e){var s=e.theme,y=e.paddingBottom;return Object(f.a)("padding-bottom",y,s)},function(e){var s=e.theme,y=e.paddingLeft;return Object(f.a)("padding-left",y,s)},function(e){var s=e.theme,y=e.marginLeft;return Object(f.a)("margin-left",y,s)},function(e){var s=e.theme,y=e.marginRight;return Object(f.a)("margin-right",y,s)},function(e){var s=e.theme,y=e.marginTop;return Object(f.a)("margin-top",y,s)},function(e){var s=e.theme,y=e.marginBottom;return Object(f.a)("margin-bottom",y,s)},function(e){var s=e.theme;return e.hiddenS?"".concat(s.mediaQueries.tablet," { display: none; }"):void 0},function(e){var s=e.theme;return e.hiddenXS?"".concat(s.mediaQueries.mobile," { display: none; }"):void 0},function(e){var s=e.theme,y=e.hasRadius,H=e.borderRadius;return y?s.borderRadius:H},function(e){return e.borderStyle},function(e){return e.borderWidth},function(e){var s=e.borderColor;return e.theme.colors[s]},function(e){var s=e.theme,y=e.borderColor,H=e.borderStyle,G=e.borderWidth;if(y&&!H&&!G)return"1px solid ".concat(s.colors[y])},function(e){var s=e.theme,y=e.shadow;return s.shadows[y]},function(e){return e.pointerEvents},function(e){var s=e._hover,y=e.theme;return s?s(y):void 0},function(e){return e.display},function(e){return e.position},function(e){var s=e.left;return e.theme.spaces[s]||s},function(e){var s=e.right;return e.theme.spaces[s]||s},function(e){var s=e.top;return e.theme.spaces[s]||s},function(e){var s=e.bottom;return e.theme.spaces[s]||s},function(e){return e.zIndex},function(e){return e.overflow},function(e){return e.cursor},function(e){var s=e.width;return e.theme.spaces[s]||s},function(e){var s=e.maxWidth;return e.theme.spaces[s]||s},function(e){var s=e.minWidth;return e.theme.spaces[s]||s},function(e){var s=e.height;return e.theme.spaces[s]||s},function(e){var s=e.maxHeight;return e.theme.spaces[s]||s},function(e){var s=e.minHeight;return e.theme.spaces[s]||s},function(e){return e.transition},function(e){return e.transform},function(e){return e.animation},function(e){return e.shrink},function(e){return e.grow},function(e){return e.basis},function(e){return e.flex},function(e){return e.textAlign},function(e){return e.textTransform},function(e){return e.lineHeight},function(e){return e.cursor});U.defaultProps=M,U.propTypes=j},7:function(n,i,t){"use strict";var r=t(10),o=t.n(r),c=t(13),a=t.n(c);i.a=function(p,f,b){var O=f;if(Array.isArray(f)||a()(f)!=="object"||(O=[f==null?void 0:f.desktop,f==null?void 0:f.tablet,f==null?void 0:f.mobile]),O!==void 0){if(Array.isArray(O)){var h=O,u=o()(h,3),P=u[0],M=u[1],j=u[2],I="".concat(p,": ").concat(b.spaces[P],";");return M!==void 0&&(I+="".concat(b.mediaQueries.tablet,`{
          `).concat(p,": ").concat(b.spaces[M],`;
        }`)),j!==void 0&&(I+="".concat(b.mediaQueries.mobile,`{
          `).concat(p,": ").concat(b.spaces[j],`;
        }`)),I}var U=b.spaces[O]||O;return"".concat(p,": ").concat(U,";")}}}})})},23101:function(F,L,d){(function(l,E){F.exports=E(d(32735))})(this,function(l){return function(E){var n={};function i(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return E[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=E,i.c=n,i.d=function(t,r,o){i.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:o})},i.r=function(t){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,r){if(1&r&&(t=i(t)),8&r||4&r&&typeof t=="object"&&t&&t.__esModule)return t;var o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&r&&typeof t!="string")for(var c in t)i.d(o,c,function(a){return t[a]}.bind(null,c));return o},i.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(r,"a",r),r},i.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},i.p="",i(i.s=154)}({0:function(E,n){E.exports=l},154:function(E,n,i){"use strict";i.r(n);var t=i(0);function r(){return(r=Object.assign||function(o){for(var c=1;c<arguments.length;c++){var a=arguments[c];for(var p in a)Object.prototype.hasOwnProperty.call(a,p)&&(o[p]=a[p])}return o}).apply(this,arguments)}n.default=function(o){return t.createElement("svg",r({width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o),t.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.681 2.804A9.64 9.64 0 0011.818 2C6.398 2 2 6.48 2 12c0 5.521 4.397 10 9.818 10 2.03 0 4.011-.641 5.67-1.835a9.987 9.987 0 003.589-4.831 1.117 1.117 0 00-.664-1.418 1.086 1.086 0 00-1.393.676 7.769 7.769 0 01-2.792 3.758 7.546 7.546 0 01-4.41 1.428V4.222h.002a7.492 7.492 0 013.003.625 7.61 7.61 0 012.5 1.762l.464.551-2.986 3.042a.186.186 0 00.129.316H22V3.317a.188.188 0 00-.112-.172.179.179 0 00-.199.04l-2.355 2.4-.394-.468-.02-.02a9.791 9.791 0 00-3.239-2.293zm-3.863 1.418V2v2.222zm0 0v15.556c-4.216 0-7.636-3.484-7.636-7.778s3.42-7.777 7.636-7.778z",fill:"#212134"}))}}})})},218:(F,L,d)=>{"use strict";d.r(L),d.d(L,{default:()=>Te});var l=d(32735),E=d(84968),n=d(5636),i=d(88425),t=d(29270),r=d(16540),o=d(11856),c=d(88369),a=d(59677),p=(v,g,m)=>new Promise((S,x)=>{var B=T=>{try{w(m.next(T))}catch(C){x(C)}},R=T=>{try{w(m.throw(T))}catch(C){x(C)}},w=T=>T.done?S(T.value):Promise.resolve(T.value).then(B,R);w((m=m.apply(v,g)).next())});const f=()=>p(void 0,null,function*(){const{data:v}=yield a.be.get((0,a.Gc)("email-templates"));return v}),b=v=>a.be.put((0,a.Gc)("email-templates"),v);var O=d(60216),h=d.n(O),u=d(53214),P=d(28004),M=d(95602),j=d(20763),I=d(78752),U=d(95717),e=d.n(U),s=d(23101),y=d.n(s),H=d(88677),G=d.n(H),A=Object.defineProperty,W=Object.getOwnPropertySymbols,Y=Object.prototype.hasOwnProperty,J=Object.prototype.propertyIsEnumerable,ee=(v,g,m)=>g in v?A(v,g,{enumerable:!0,configurable:!0,writable:!0,value:m}):v[g]=m,V=(v,g)=>{for(var m in g||(g={}))Y.call(g,m)&&ee(v,m,g[m]);if(W)for(var m of W(g))J.call(g,m)&&ee(v,m,g[m]);return v};const te=({canUpdate:v,onEditClick:g})=>{const{formatMessage:m}=(0,n.useIntl)();return l.createElement(u.Table,{colCount:3,rowCount:3},l.createElement(u.Thead,null,l.createElement(u.Tr,null,l.createElement(u.Th,{width:"1%"},l.createElement(P.VisuallyHidden,null,m({id:(0,a.OB)("Email.template.table.icon.label"),defaultMessage:"icon"}))),l.createElement(u.Th,null,l.createElement(M.Typography,{variant:"sigma",textColor:"neutral600"},m({id:(0,a.OB)("Email.template.table.name.label"),defaultMessage:"name"}))),l.createElement(u.Th,{width:"1%"},l.createElement(P.VisuallyHidden,null,m({id:(0,a.OB)("Email.template.table.action.label"),defaultMessage:"action"}))))),l.createElement(u.Tbody,null,l.createElement(u.Tr,V({},(0,i.onRowClick)({fn:()=>g("reset_password")})),l.createElement(u.Td,null,l.createElement(I.Icon,null,l.createElement(y(),{"aria-label":m({id:"global.reset-password",defaultMessage:"Reset password"})}))),l.createElement(u.Td,null,l.createElement(M.Typography,null,m({id:"global.reset-password",defaultMessage:"Reset password"}))),l.createElement(u.Td,V({},i.stopPropagation),l.createElement(j.IconButton,{onClick:()=>g("reset_password"),label:m({id:(0,a.OB)("Email.template.form.edit.label"),defaultMessage:"Edit a template"}),noBorder:!0,icon:v&&l.createElement(e(),null)}))),l.createElement(u.Tr,V({},(0,i.onRowClick)({fn:()=>g("email_confirmation")})),l.createElement(u.Td,null,l.createElement(I.Icon,null,l.createElement(G(),{"aria-label":m({id:(0,a.OB)("Email.template.email_confirmation"),defaultMessage:"Email address confirmation"})}))),l.createElement(u.Td,null,l.createElement(M.Typography,null,m({id:(0,a.OB)("Email.template.email_confirmation"),defaultMessage:"Email address confirmation"}))),l.createElement(u.Td,V({},i.stopPropagation),l.createElement(j.IconButton,{onClick:()=>g("email_confirmation"),label:m({id:(0,a.OB)("Email.template.form.edit.label"),defaultMessage:"Edit a template"}),noBorder:!0,icon:v&&l.createElement(e(),null)})))))};te.propTypes={canUpdate:h().bool.isRequired,onEditClick:h().func.isRequired};const se=te;var ue=d(83281),$=d(4122),N=d(78330),ne=d(44526),_=d(71657),ce=d(90353),D=d(5173);const de=D.Ry().shape({options:D.Ry().shape({from:D.Ry().shape({name:D.Z_().required(i.translatedErrors.required),email:D.Z_().email(i.translatedErrors.email).required(i.translatedErrors.required)}).required(),response_email:D.Z_().email(i.translatedErrors.email),object:D.Z_().required(i.translatedErrors.required),message:D.Z_().required(i.translatedErrors.required)}).required(i.translatedErrors.required)}),re=({template:v,onToggle:g,onSubmit:m})=>{const{formatMessage:S}=(0,n.useIntl)();return l.createElement($.ModalLayout,{onClose:g,labelledBy:`${S({id:(0,a.OB)("PopUpForm.header.edit.email-templates"),defaultMessage:"Edit email template"})}, ${S({id:(0,a.OB)(v.display),defaultMessage:v.display})}`},l.createElement($.ModalHeader,null,l.createElement(_.Breadcrumbs,{label:`${S({id:(0,a.OB)("PopUpForm.header.edit.email-templates"),defaultMessage:"Edit email template"})}, ${S({id:(0,a.OB)(v.display),defaultMessage:v.display})}`},l.createElement(_.Crumb,null,S({id:(0,a.OB)("PopUpForm.header.edit.email-templates"),defaultMessage:"Edit email template"})),l.createElement(_.Crumb,null,S({id:(0,a.OB)(v.display),defaultMessage:v.display})))),l.createElement(ue.Formik,{onSubmit:m,initialValues:v,validateOnChange:!1,validationSchema:de,enableReinitialize:!0},({errors:x,values:B,handleChange:R,isSubmitting:w})=>{var T,C,Z,Q,K,X,k;return l.createElement(i.Form,null,l.createElement($.ModalBody,null,l.createElement(N.Grid,{gap:5},l.createElement(N.GridItem,{col:6,s:12},l.createElement(i.GenericInput,{intlLabel:{id:(0,a.OB)("PopUpForm.Email.options.from.name.label"),defaultMessage:"Shipper name"},name:"options.from.name",onChange:R,value:B.options.from.name,error:(C=(T=x==null?void 0:x.options)==null?void 0:T.from)==null?void 0:C.name,type:"text"})),l.createElement(N.GridItem,{col:6,s:12},l.createElement(i.GenericInput,{intlLabel:{id:(0,a.OB)("PopUpForm.Email.options.from.email.label"),defaultMessage:"Shipper email"},name:"options.from.email",onChange:R,value:B.options.from.email,error:(Q=(Z=x==null?void 0:x.options)==null?void 0:Z.from)==null?void 0:Q.email,type:"text"})),l.createElement(N.GridItem,{col:6,s:12},l.createElement(i.GenericInput,{intlLabel:{id:(0,a.OB)("PopUpForm.Email.options.response_email.label"),defaultMessage:"Response email"},name:"options.response_email",onChange:R,value:B.options.response_email,error:(K=x==null?void 0:x.options)==null?void 0:K.response_email,type:"text"})),l.createElement(N.GridItem,{col:6,s:12},l.createElement(i.GenericInput,{intlLabel:{id:(0,a.OB)("PopUpForm.Email.options.object.label"),defaultMessage:"Subject"},name:"options.object",onChange:R,value:B.options.object,error:(X=x==null?void 0:x.options)==null?void 0:X.object,type:"text"})),l.createElement(N.GridItem,{col:12,s:12},l.createElement(ce.Textarea,{label:S({id:(0,a.OB)("PopUpForm.Email.options.message.label"),defaultMessage:"Message"}),name:"options.message",onChange:R,value:B.options.message,error:((k=x==null?void 0:x.options)==null?void 0:k.message)&&S({id:x.options.message,defaultMessage:x.options.message})})))),l.createElement($.ModalFooter,{startActions:l.createElement(ne.Button,{onClick:g,variant:"tertiary"},"Cancel"),endActions:l.createElement(ne.Button,{loading:w,type:"submit"},"Finish")}))}))};re.propTypes={template:h().shape({display:h().string,icon:h().string,options:h().shape({from:h().shape({name:h().string,email:h().string}),message:h().string,object:h().string,response_email:h().string})}).isRequired,onSubmit:h().func.isRequired,onToggle:h().func.isRequired};const pe=re;var me=Object.defineProperty,fe=Object.defineProperties,ve=Object.getOwnPropertyDescriptors,oe=Object.getOwnPropertySymbols,ge=Object.prototype.hasOwnProperty,ye=Object.prototype.propertyIsEnumerable,ae=(v,g,m)=>g in v?me(v,g,{enumerable:!0,configurable:!0,writable:!0,value:m}):v[g]=m,he=(v,g)=>{for(var m in g||(g={}))ge.call(g,m)&&ae(v,m,g[m]);if(oe)for(var m of oe(g))ye.call(g,m)&&ae(v,m,g[m]);return v},be=(v,g)=>fe(v,ve(g)),Ee=(v,g,m)=>new Promise((S,x)=>{var B=T=>{try{w(m.next(T))}catch(C){x(C)}},R=T=>{try{w(m.throw(T))}catch(C){x(C)}},w=T=>T.done?S(T.value):Promise.resolve(T.value).then(B,R);w((m=m.apply(v,g)).next())});const Oe=()=>l.createElement(i.CheckPagePermissions,{permissions:c.Z.readEmailTemplates},l.createElement(xe,null)),xe=()=>{const{formatMessage:v}=(0,n.useIntl)(),{trackUsage:g}=(0,i.useTracking)(),{notifyStatus:m}=(0,t.useNotifyAT)(),S=(0,i.useNotification)(),{lockApp:x,unlockApp:B}=(0,i.useOverlayBlocker)(),R=(0,l.useRef)(g),w=(0,E.useQueryClient)();(0,i.useFocusWhenNavigate)();const[T,C]=(0,l.useState)(!1),[Z,Q]=(0,l.useState)(null),K=(0,l.useMemo)(()=>({update:c.Z.updateEmailTemplates}),[]),{isLoading:X,allowedActions:{canUpdate:k}}=(0,i.useRBAC)(K),{status:Pe,data:ie}=(0,E.useQuery)("email-templates",()=>f(),{onSuccess:()=>{m(v({id:(0,a.OB)("Email.template.data.loaded"),defaultMessage:"Email templates has been loaded"}))},onError:()=>{S({type:"warning",message:{id:"notification.error",defaultMessage:"An error occured"}})}}),Me=X||Pe!=="success",q=()=>{C(z=>!z)},Se=z=>{Q(z),q()},le=(0,E.useMutation)(z=>b({"email-templates":z}),{onSuccess:()=>Ee(void 0,null,function*(){yield w.invalidateQueries("email-templates"),S({type:"success",message:{id:"notification.success.saved",defaultMessage:"Saved"}}),R.current("didEditEmailTemplates"),B(),q()}),onError:()=>{S({type:"warning",message:{id:"notification.error",defaultMessage:"An error occured"}}),B()},refetchActive:!0}),{isLoading:je}=le,Be=z=>{x(),R.current("willEditEmailTemplates");const Re=be(he({},ie),{[Z]:z});le.mutate(Re)};return Me?l.createElement(r.Main,{"aria-busy":"true"},l.createElement(i.SettingsPageTitle,{name:v({id:(0,a.OB)("HeaderNav.link.emailTemplates"),defaultMessage:"Email templates"})}),l.createElement(o.HeaderLayout,{title:v({id:(0,a.OB)("HeaderNav.link.emailTemplates"),defaultMessage:"Email templates"})}),l.createElement(o.ContentLayout,null,l.createElement(i.LoadingIndicatorPage,null))):l.createElement(r.Main,{"aria-busy":je},l.createElement(i.SettingsPageTitle,{name:v({id:(0,a.OB)("HeaderNav.link.emailTemplates"),defaultMessage:"Email templates"})}),l.createElement(o.HeaderLayout,{title:v({id:(0,a.OB)("HeaderNav.link.emailTemplates"),defaultMessage:"Email templates"})}),l.createElement(o.ContentLayout,null,l.createElement(se,{onEditClick:Se,canUpdate:k}),T&&l.createElement(pe,{template:ie[Z],onToggle:q,onSubmit:Be})))},Te=Oe},8917:(F,L,d)=>{"use strict";d.d(L,{Z:()=>o});var l=d(43653),E=d.n(l),n=d(88425),i=d.n(n),t=(c,a,p)=>new Promise((f,b)=>{var O=P=>{try{u(p.next(P))}catch(M){b(M)}},h=P=>{try{u(p.throw(P))}catch(M){b(M)}},u=P=>P.done?f(P.value):Promise.resolve(P.value).then(O,h);u((p=p.apply(c,a)).next())});const r=E().create({baseURL:"http://localhost:1337"});r.interceptors.request.use(c=>t(void 0,null,function*(){return c.headers={Authorization:`Bearer ${n.auth.getToken()}`,Accept:"application/json","Content-Type":"application/json"},c}),c=>{Promise.reject(c)}),r.interceptors.response.use(c=>c,c=>{var a;throw((a=c.response)==null?void 0:a.status)===401&&(n.auth.clearAppStorage(),window.location.reload()),c});const o=r},59677:(F,L,d)=>{"use strict";d.d(L,{be:()=>l.Z,YX:()=>i,Gc:()=>o,OB:()=>c.Z});var l=d(8917),E=d(92891);const i=a=>Object.keys(a).reduce((p,f)=>{const b=a[f].controllers,O=Object.keys(b).reduce((h,u)=>((0,E.isEmpty)(b[u])||(h[u]=b[u]),h),{});return(0,E.isEmpty)(O)||(p[f]={controllers:O}),p},{});var t=d(90201);const o=a=>`/${t.Z}/${a}`;var c=d(82069)}}]);
