@licklist/design 0.44.486-dev.14 → 0.44.486-dev.16

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 +1 @@
1
- {"version":3,"file":"useImage.d.ts","sourceRoot":"","sources":["../../../../src/events/event-venue-map/hooks/useImage.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C,eAAO,MAAM,QAAQ,QACd,MAAM;WACiB,MAAM;YAAU,MAAM;MACjD,CAAC,SAAS,GAAG,gBAAgB,EAAE,mBAAmB,CA0EpD,CAAC"}
1
+ {"version":3,"file":"useImage.d.ts","sourceRoot":"","sources":["../../../../src/events/event-venue-map/hooks/useImage.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C,eAAO,MAAM,QAAQ,QACd,MAAM;WACiB,MAAM;YAAU,MAAM;MACjD,CAAC,SAAS,GAAG,gBAAgB,EAAE,mBAAmB,CAmFpD,CAAC"}
@@ -1 +1 @@
1
- "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),i=require("react"),a=(e(i),e(require("lodash/round")));exports.useImage=function(e,h){var r=h.width,c=h.height,d=i.useRef(void 0),n=t.__read(i.useState({width:0,height:0}),2),u=n[0],l=n[1],s=i.useCallback((function(e){d.current=new window.Image,d.current.src=e,d.current.addEventListener("load",(function(){d.current=this,l({width:this.naturalWidth,height:this.naturalHeight})}))}),[]);i.useEffect((function(){s(e)}),[e,s]);var o=i.useMemo((function(){if(!u.width||!u.height)return t.__assign({scaledWidth:1,scaledHeight:1,x:0,y:0,scale:1,widthScale:1,heightScale:1,imageScale:1,totalScaledWidth:0,totalScaledHeight:0},u);var e=r/u.width,i=c/u.height,h=Math.min(e,i),d=a(u.width*h,2),n=a(u.height*h,2),l=a(r/2-d/2,2),s=a(c/2-n/2,2),o=u.width/d,g=2*l+d,f=2*s+n;return t.__assign({scaledWidth:d,scaledHeight:n,x:l,y:s,scale:h,widthScale:e,heightScale:i,imageScale:o,totalScaledWidth:g,totalScaledHeight:f},u)}),[u,r,c]);return[d.current,o]};
1
+ "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),i=require("react"),r=(e(i),e(require("lodash/round")));exports.useImage=function(e,a){var h=a.width,n=a.height,c=i.useRef(void 0),d=t.__read(i.useState({width:0,height:0}),2),u=d[0],l=d[1],s=function(){c.current=this,l({width:this.naturalWidth,height:this.naturalHeight})},o=i.useCallback((function(e){c.current=new window.Image,c.current.src=e,c.current.addEventListener("load",s)}),[]);i.useEffect((function(){return o(e),function(){c.current.removeEventListener("load",s),c.current=void 0}}),[e,o]);var g=i.useMemo((function(){if(!u.width||!u.height)return t.__assign({scaledWidth:1,scaledHeight:1,x:0,y:0,scale:1,widthScale:1,heightScale:1,imageScale:1,totalScaledWidth:0,totalScaledHeight:0},u);var e=h/u.width,i=n/u.height,a=Math.min(e,i),c=r(u.width*a,2),d=r(u.height*a,2),l=r(h/2-c/2,2),s=r(n/2-d/2,2),o=u.width/c,g=2*l+c,f=2*s+d;return t.__assign({scaledWidth:c,scaledHeight:d,x:l,y:s,scale:a,widthScale:e,heightScale:i,imageScale:o,totalScaledWidth:g,totalScaledHeight:f},u)}),[u,h,n]);return[c.current,g]};
@@ -1 +1 @@
1
- {"version":3,"file":"EmailTemplateControl.d.ts","sourceRoot":"","sources":["../../../../src/notification/email-template/control/EmailTemplateControl.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAKnD,OAAO,EACL,cAAc,EAEf,MAAM,sEAAsE,CAAC;AAG9E,OAAO,EAAE,UAAU,EAAE,MAAM,kEAAkE,CAAC;AAM9F,OAAO,EAAE,gBAAgB,EAAE,MAAM,wEAAwE,CAAC;AAM1G,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,YAAY,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB,CAAC,EAAE,UAAU,EAAE,CAAC;IAClC,iBAAiB,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACvC,4BAA4B,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,gBAAgB,GAAG,IAAI,KAAK,MAAM,CAAC;CAC3E;AAED,eAAO,MAAM,oBAAoB,2FAuZhC,CAAC"}
1
+ {"version":3,"file":"EmailTemplateControl.d.ts","sourceRoot":"","sources":["../../../../src/notification/email-template/control/EmailTemplateControl.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAKnD,OAAO,EACL,cAAc,EAEf,MAAM,sEAAsE,CAAC;AAG9E,OAAO,EAAE,UAAU,EAAE,MAAM,kEAAkE,CAAC;AAM9F,OAAO,EAAE,gBAAgB,EAAE,MAAM,wEAAwE,CAAC;AAM1G,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,YAAY,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB,CAAC,EAAE,UAAU,EAAE,CAAC;IAClC,iBAAiB,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACvC,4BAA4B,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,gBAAgB,GAAG,IAAI,KAAK,MAAM,CAAC;CAC3E;AAED,eAAO,MAAM,oBAAoB,2FAgbhC,CAAC"}
@@ -1 +1 @@
1
- "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),a=require("react"),n=e(a),l=require("react-i18next"),r=require("react-bootstrap"),i=require("react-hook-form"),o=require("../../../file-upload/FileUpload.js"),s=e(require("react-email-editor")),u=require("@licklist/core/dist/DataMapper/Notification/TemplateOptionDataMapper"),m=require("@licklist/plugins/dist/hooks/Media/useAttachments"),c=require("@licklist/plugins/dist/hooks/Media/usePermanentImage"),d=require("@licklist/core/dist/DataMapper/Media/UploadPermanentImageDataMapper"),p=n.forwardRef((function(e,p){var g,f,E,v=e.setIsLoading,h=e.meta,_=e.options,F=void 0===_?[]:_,b=e.defaultAttachments,y=void 0===b?[]:b,N=e.notificationTypes,D=void 0===N?[]:N,T=e.getDefaultTemplateMetaByType,P=l.useTranslation(["Design"]).t,C=t.__read(a.useState(null),2),I=C[0],k=C[1],M=i.useFormContext(),O=M.register,q=M.setValue,R=M.formState.errors,x=M.getValues,A=M.watch,V=M.reset,j=t.__read(a.useState(!1),2),w=j[0],G=j[1],S=m.useAttachments(I),L=S.attachments,U=S.handleAttachmentRemove,Y=S.handleAttachmentUploading,B=S.isLoading,J=c.usePermanentImage(),H=J.permanentImages,z=J.handlePermanentImageRemove,K=J.handlePermanentImageUploading,Q=A("type"),W=A("id");a.useEffect((function(){var e;if(!W&&T&&Q){var a=x(),n=T(Q);V(t.__assign(t.__assign({},a),{meta:n})),null===(e=p.current)||void 0===e||e.loadDesign(JSON.parse(n))}}),[Q]),a.useEffect((function(){q("attachmentMetadata",L)}),[L,q]),a.useEffect((function(){H.length&&q("imagesMetadata",H)}),[H,q]),a.useEffect((function(){if(y&&y.length>0){var e=x("attachments");k(e)}else k([])}),[y]),a.useEffect((function(){if(null==F?void 0:F.length){var e=F.find((function(e){return e.type===u.OPTION_TYPE.files_selector}));(null==e?void 0:e.selectedValue)&&G(!0)}}),[F]);return n.createElement(n.Fragment,null,n.createElement(r.Row,null,n.createElement(r.Form.Group,{as:r.Col,controlId:"type",xs:!0,sm:12,md:8,lg:10,xl:12},n.createElement(r.Form.Label,null,P("type")),n.createElement(r.Form.Control,t.__assign({as:"select"},O("type",{required:P("Validation:fieldRequired",{attribute:P("type")})}),{name:"type",required:!0,isInvalid:Boolean(R.type),placeholder:P("Design:type"),disabled:!!W}),n.createElement("option",{value:""},P("Design:choose")),D.map((function(e){return n.createElement("option",{key:e,value:e},P("Design:".concat(e)))}))),n.createElement(r.Form.Control.Feedback,{type:"invalid"},null===(g=R.type)||void 0===g?void 0:g.message))),n.createElement(r.Row,null,n.createElement(r.Form.Group,{as:r.Col,controlId:"formGroupName",xs:!0,sm:12,md:8,lg:10,xl:12},n.createElement(r.Form.Label,null,P("templateName")),n.createElement(r.Form.Control,t.__assign({},O("name",{maxLength:255,required:P("Validation:fieldRequired",{attribute:P("name")})}),{name:"name",required:!0,isInvalid:Boolean(R.name),placeholder:P("Design:templateName")})),n.createElement(r.Form.Control.Feedback,{type:"invalid"},null===(f=R.name)||void 0===f?void 0:f.message))),n.createElement(r.Row,null,n.createElement(r.Form.Group,{as:r.Col,xs:!0,sm:12,md:8,lg:10,xl:12,controlId:"formGroupSubject"},n.createElement(r.Form.Label,null,P("subject")),n.createElement(r.Form.Control,t.__assign({},O("subject",{maxLength:255,required:P("Validation:fieldRequired",{attribute:P("subject")})}),{name:"subject",required:!0,isInvalid:Boolean(R.subject),placeholder:P("Design:subject")})),n.createElement(r.Form.Control.Feedback,{type:"invalid"},null===(E=R.subject)||void 0===E?void 0:E.message))),n.createElement(r.Row,null,n.createElement(r.Form.Group,{as:r.Col},n.createElement(r.Form.Check,t.__assign({},O("isActive"),{name:"isActive",label:P("Design:active"),id:"formGroupIsActive",custom:!0})),n.createElement(r.Form.Check,t.__assign({},O("isDefault"),{name:"isDefault",label:P("Design:defaultTemplateForTheType"),id:"formGroupIsDefault",custom:!0})))),n.createElement(r.Row,{className:"mb-4"},n.createElement(r.Form.Group,{as:r.Col},n.createElement(r.Form.Label,null,P("Design:emailBody")),n.createElement("div",{className:"email-editor"},n.createElement(s,{ref:p,onReady:function(){var e,a,n,l;v(!0),null===(e=p.current)||void 0===e||e.registerCallback("design:updated",(function(e){var t,a;null===(t=p.current)||void 0===t||t.editor.exportHtml((function(e){q("body",e.html),q("meta",JSON.stringify(e.design))})),"content:removed"===e.type&&"image"===(null===(a=e.item)||void 0===a?void 0:a.type)&&function(e){var t=e.item.values.src.url;if(!t.includes("unlayer")){var a=x("imagesMetadata");if(a){var n=a.find((function(e){return e.permanentUrl===t}));if(n)z(n.hash,d.PERMANENT_IMAGE_TYPE_TEMP);else{var l=t.split("/"),r=l[l.length-2];if(!r)return;z(r,d.PERMANENT_IMAGE_TYPE_PERMANENT)}}else{var i=t.split("/"),o=i[i.length-2];if(!o)return;z(o,d.PERMANENT_IMAGE_TYPE_PERMANENT)}}}(e)})),h&&(null===(a=p.current)||void 0===a||a.loadDesign(JSON.parse(h)),null===(n=p.current)||void 0===n||n.editor.exportHtml((function(e){q("body",e.html),q("meta",JSON.stringify(e.design))}))),v(!1),null===(l=p.current)||void 0===l||l.registerCallback("image",(function(e,a){return t.__awaiter(void 0,void 0,void 0,(function(){var n;return t.__generator(this,(function(t){switch(t.label){case 0:return[4,K(e.attachments[0])];case 1:return n=t.sent(),a({progress:100,url:n.permanentUrl}),[2]}}))}))}))},style:{height:"50rem"}})))),n.createElement(r.Row,null,n.createElement(o.FileUpload,{className:"ml-4 mr-4",allowedExtensions:["jpg","jpeg","png","txt","pdf","doc"],enablePreview:!0,allowMultiple:!0,defaultFiles:L,onFilesChange:function(e){Y(e)},title:P("Design:attachments"),onFileRemove:function(e,t){return U(String(e),t)},isLoading:B})),(null==F?void 0:F.length)>0&&n.createElement(r.Row,null,n.createElement(r.Form.Group,{as:r.Col},F.map((function(e){if(e.type===u.OPTION_TYPE.checkbox)return n.createElement(r.Form.Check,t.__assign({},O("templateOptionValues.".concat(null==e?void 0:e.id,".value")),{type:"checkbox",label:P("Design:".concat(e.name)),id:e.name+e.id,defaultChecked:"true"===e.selectedValue,custom:!0}));if(e.type===u.OPTION_TYPE.files_selector){var a=JSON.parse(e.defaultValue),l=Object.values(a),i=Object.keys(a);return n.createElement(n.Fragment,null,n.createElement(r.Form.Check,{checked:w,name:"IsIncludePDF",onChange:function(){G(!w),q("templateOptionValues.".concat(e.id,".value"),"")},label:P("Design:includePDF"),id:"formGroupIsIncludePdf",custom:!0}),w&&n.createElement(n.Fragment,null,n.createElement(r.Form.Label,{className:"mt-4"},P("Design:includeFile")),n.createElement(r.Form.Control,t.__assign({as:"select"},O("templateOptionValues.".concat(e.id,".value")),{defaultValue:e.selectedValue||""}),n.createElement("option",{value:""},P("Design:choose")),i.map((function(e,t){return n.createElement("option",{value:String(e),key:String(e)},l[t])})))))}return e.type===u.OPTION_TYPE.days_reminder?n.createElement(n.Fragment,null,n.createElement(r.Form.Label,{className:"mt-4"},P("Design:".concat(e.name))),n.createElement(r.Form.Control,t.__assign({},O("templateOptionValues.".concat(null==e?void 0:e.id,".value")),{type:"number",placeholder:P("Design:".concat(e.name)),id:e.name+e.id,defaultValue:e.selectedValue||""})),n.createElement(r.Form.Text,null,e.description)):null})))))}));p.displayName="EmailTemplateControl",exports.EmailTemplateControl=p;
1
+ "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),a=require("react"),n=e(a),l=require("react-i18next"),r=require("react-bootstrap"),i=require("react-hook-form"),o=require("../../../file-upload/FileUpload.js"),s=e(require("react-email-editor")),m=require("@licklist/core/dist/DataMapper/Notification/TemplateOptionDataMapper"),c=require("@licklist/plugins/dist/hooks/Media/useAttachments"),u=require("@licklist/plugins/dist/hooks/Media/usePermanentImage"),d=require("@licklist/core/dist/DataMapper/Media/UploadPermanentImageDataMapper"),p=n.forwardRef((function(e,p){var g,f,v,E,h=e.setIsLoading,b=e.meta,_=e.options,y=void 0===_?[]:_,F=e.defaultAttachments,N=void 0===F?[]:F,D=e.notificationTypes,T=void 0===D?[]:D,C=e.getDefaultTemplateMetaByType,P=l.useTranslation(["Design"]).t,I=t.__read(a.useState(null),2),k=I[0],x=I[1],M=i.useFormContext(),O=M.register,q=M.setValue,R=M.formState.errors,V=M.getValues,A=M.watch,j=M.reset,w=t.__read(a.useState(!1),2),G=w[0],L=w[1],S=c.useAttachments(k),U=S.attachments,Y=S.handleAttachmentRemove,B=S.handleAttachmentUploading,J=S.isLoading,H=u.usePermanentImage(),z=H.permanentImages,K=H.handlePermanentImageRemove,Q=H.handlePermanentImageUploading,W=A("type"),X=A("id");a.useEffect((function(){var e;if(!X&&C&&W){var a=V(),n=C(W);j(t.__assign(t.__assign({},a),{meta:n})),null===(e=p.current)||void 0===e||e.loadDesign(JSON.parse(n))}}),[W]),a.useEffect((function(){q("attachmentMetadata",U)}),[U,q]),a.useEffect((function(){z.length&&q("imagesMetadata",z)}),[z,q]),a.useEffect((function(){if(N&&N.length>0){var e=V("attachments");x(e)}else x([])}),[N]),a.useEffect((function(){if(null==y?void 0:y.length){var e=y.find((function(e){return e.type===m.OPTION_TYPE.files_selector}));(null==e?void 0:e.selectedValue)&&L(!0)}}),[y]);return n.createElement(n.Fragment,null,n.createElement(r.Row,null,n.createElement(r.Form.Group,{as:r.Col,controlId:"type",xs:!0,sm:12,md:8,lg:10,xl:12},n.createElement(r.Form.Label,null,P("type")),n.createElement(r.Form.Control,t.__assign({as:"select"},O("type",{required:P("Validation:fieldRequired",{attribute:P("type")})}),{name:"type",required:!0,isInvalid:Boolean(R.type),placeholder:P("Design:type"),disabled:!!X}),n.createElement("option",{value:""},P("Design:choose")),T.map((function(e){return n.createElement("option",{key:e,value:e},P("Design:".concat(e)))}))),n.createElement(r.Form.Control.Feedback,{type:"invalid"},null===(g=R.type)||void 0===g?void 0:g.message))),n.createElement(r.Row,null,n.createElement(r.Form.Group,{as:r.Col,controlId:"formGroupName",xs:!0,sm:12,md:8,lg:10,xl:12},n.createElement(r.Form.Label,null,P("templateName")),n.createElement(r.Form.Control,t.__assign({},O("name",{maxLength:255,required:P("Validation:fieldRequired",{attribute:P("name")})}),{name:"name",required:!0,isInvalid:Boolean(R.name),placeholder:P("Design:templateName")})),n.createElement(r.Form.Control.Feedback,{type:"invalid"},null===(f=R.name)||void 0===f?void 0:f.message))),n.createElement(r.Row,null,n.createElement(r.Form.Group,{as:r.Col,xs:!0,sm:12,md:8,lg:10,xl:12,controlId:"formGroupSubject"},n.createElement(r.Form.Label,null,P("subject")),n.createElement(r.Form.Control,t.__assign({},O("subject",{maxLength:255,required:P("Validation:fieldRequired",{attribute:P("subject")})}),{name:"subject",required:!0,isInvalid:Boolean(R.subject),placeholder:P("Design:subject")})),n.createElement(r.Form.Control.Feedback,{type:"invalid"},null===(v=R.subject)||void 0===v?void 0:v.message))),n.createElement(r.Row,null,n.createElement(r.Form.Group,{as:r.Col},n.createElement(r.Form.Check,t.__assign({},O("isActive"),{name:"isActive",label:P("Design:active"),id:"formGroupIsActive",custom:!0})),n.createElement(r.Form.Check,t.__assign({},O("isDefault"),{name:"isDefault",label:P("Design:defaultTemplateForTheType"),id:"formGroupIsDefault",custom:!0})))),n.createElement(r.Row,{className:"mb-4"},n.createElement(r.Form.Group,{as:r.Col},n.createElement(r.Form.Label,null,P("Design:emailBody")),n.createElement("div",{className:"alert alert-warning",role:"alert"},"Due to the mail services limitations on the length of the email body that can be sent or received - maximum length is set to 65,535 characters."),n.createElement("div",{className:"email-editor ".concat(R.body&&"is-invalid")},n.createElement(s,{ref:p,onReady:function(){var e,a,n,l;h(!0),null===(e=p.current)||void 0===e||e.registerCallback("design:updated",(function(e){var t,a;null===(t=p.current)||void 0===t||t.editor.exportHtml((function(e){q("body",e.html),q("meta",JSON.stringify(e.design))})),"content:removed"===e.type&&"image"===(null===(a=e.item)||void 0===a?void 0:a.type)&&function(e){var t=e.item.values.src.url;if(!t.includes("unlayer")){var a=V("imagesMetadata");if(a){var n=a.find((function(e){return e.permanentUrl===t}));if(n)K(n.hash,d.PERMANENT_IMAGE_TYPE_TEMP);else{var l=t.split("/"),r=l[l.length-2];if(!r)return;K(r,d.PERMANENT_IMAGE_TYPE_PERMANENT)}}else{var i=t.split("/"),o=i[i.length-2];if(!o)return;K(o,d.PERMANENT_IMAGE_TYPE_PERMANENT)}}}(e)})),b&&(null===(a=p.current)||void 0===a||a.loadDesign(JSON.parse(b)),null===(n=p.current)||void 0===n||n.editor.exportHtml((function(e){q("body",e.html),q("meta",JSON.stringify(e.design))}))),h(!1),null===(l=p.current)||void 0===l||l.registerCallback("image",(function(e,a){return t.__awaiter(void 0,void 0,void 0,(function(){var n;return t.__generator(this,(function(t){switch(t.label){case 0:return[4,Q(e.attachments[0])];case 1:return n=t.sent(),a({progress:100,url:n.permanentUrl}),[2]}}))}))}))},style:{height:"50rem"}}),n.createElement("input",t.__assign({type:"hidden",name:"body"},O("body",{maxLength:{value:65535,message:P("Validation:fieldMaxLength",{attribute:P("body"),max:65535})}})))),n.createElement(r.Form.Control.Feedback,{type:"invalid"},null===(E=R.body)||void 0===E?void 0:E.message))),n.createElement(r.Row,null,n.createElement(o.FileUpload,{className:"ml-4 mr-4",allowedExtensions:["jpg","jpeg","png","txt","pdf","doc"],enablePreview:!0,allowMultiple:!0,defaultFiles:U,onFilesChange:function(e){B(e)},title:P("Design:attachments"),onFileRemove:function(e,t){return Y(String(e),t)},isLoading:J})),(null==y?void 0:y.length)>0&&n.createElement(r.Row,null,n.createElement(r.Form.Group,{as:r.Col},y.map((function(e){if(e.type===m.OPTION_TYPE.checkbox)return n.createElement(r.Form.Check,t.__assign({},O("templateOptionValues.".concat(null==e?void 0:e.id,".value")),{type:"checkbox",label:P("Design:".concat(e.name)),id:e.name+e.id,defaultChecked:"true"===e.selectedValue,custom:!0}));if(e.type===m.OPTION_TYPE.files_selector){var a=JSON.parse(e.defaultValue),l=Object.values(a),i=Object.keys(a);return n.createElement(n.Fragment,null,n.createElement(r.Form.Check,{checked:G,name:"IsIncludePDF",onChange:function(){L(!G),q("templateOptionValues.".concat(e.id,".value"),"")},label:P("Design:includePDF"),id:"formGroupIsIncludePdf",custom:!0}),G&&n.createElement(n.Fragment,null,n.createElement(r.Form.Label,{className:"mt-4"},P("Design:includeFile")),n.createElement(r.Form.Control,t.__assign({as:"select"},O("templateOptionValues.".concat(e.id,".value")),{defaultValue:e.selectedValue||""}),n.createElement("option",{value:""},P("Design:choose")),i.map((function(e,t){return n.createElement("option",{value:String(e),key:String(e)},l[t])})))))}return e.type===m.OPTION_TYPE.days_reminder?n.createElement(n.Fragment,null,n.createElement(r.Form.Label,{className:"mt-4"},P("Design:".concat(e.name))),n.createElement(r.Form.Control,t.__assign({},O("templateOptionValues.".concat(null==e?void 0:e.id,".value")),{type:"number",placeholder:P("Design:".concat(e.name)),id:e.name+e.id,defaultValue:e.selectedValue||""})),n.createElement(r.Form.Text,null,e.description)):null})))))}));p.displayName="EmailTemplateControl",exports.EmailTemplateControl=p;
@@ -1 +1 @@
1
- {"version":3,"file":"ProductControl.d.ts","sourceRoot":"","sources":["../../../src/product-set/product/ProductControl.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,YAAY,EAMb,MAAM,kEAAkE,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,0DAA0D,CAAC;AAEvF,OAAO,EACL,mBAAmB,EACnB,UAAU,EACX,MAAM,8DAA8D,CAAC;AAEtE,OAAc,EACZ,WAAW,EAKZ,MAAM,OAAO,CAAC;AAef,OAAO,EACL,KAAK,EAEN,MAAM,sDAAsD,CAAC;AAO9D,OAAO,EAEL,oCAAoC,EACpC,qCAAqC,EACtC,MAAM,sDAAsD,CAAC;AAC9D,OAAO,EAEL,2BAA2B,EAC5B,MAAM,iCAAiC,CAAC;AAOzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAQ5C,MAAM,WAAW,oBACf,SAAQ,UAAU,EAChB,2BAA2B,EAC3B,qCAAqC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,mBAAmB,CAAC,CAAC,CACpC,SAAQ,gBAAgB,EACtB,mBAAmB,CAAC,CAAC,CAAC,EACtB,oCAAoC,CAAC,CAAC,CAAC;IACzC,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,YAAY,CAAC;IAC3B,aAAa,EAAE,OAAO,CAAC;IACvB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,mBAAmB,EAAE,CAAC,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAChE,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,UAAU,EAAE,EACnD,SAAiB,EACjB,eAAe,EACf,aAAqB,EACrB,oBAA4B,EAC5B,QAAa,EACb,MAAM,EACN,mBAAmB,EACnB,WAAW,EACX,SAAS,EACT,YAAY,EACZ,YAAY,GACb,EAAE,mBAAmB,CAAC,CAAC,CAAC,eAmhBxB"}
1
+ {"version":3,"file":"ProductControl.d.ts","sourceRoot":"","sources":["../../../src/product-set/product/ProductControl.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,YAAY,EAMb,MAAM,kEAAkE,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,0DAA0D,CAAC;AAEvF,OAAO,EACL,mBAAmB,EACnB,UAAU,EACX,MAAM,8DAA8D,CAAC;AAEtE,OAAc,EACZ,WAAW,EAKZ,MAAM,OAAO,CAAC;AAef,OAAO,EACL,KAAK,EAEN,MAAM,sDAAsD,CAAC;AAO9D,OAAO,EAEL,oCAAoC,EACpC,qCAAqC,EACtC,MAAM,sDAAsD,CAAC;AAC9D,OAAO,EAEL,2BAA2B,EAC5B,MAAM,iCAAiC,CAAC;AAOzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAQ5C,MAAM,WAAW,oBACf,SAAQ,UAAU,EAChB,2BAA2B,EAC3B,qCAAqC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,mBAAmB,CAAC,CAAC,CACpC,SAAQ,gBAAgB,EACtB,mBAAmB,CAAC,CAAC,CAAC,EACtB,oCAAoC,CAAC,CAAC,CAAC;IACzC,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,YAAY,CAAC;IAC3B,aAAa,EAAE,OAAO,CAAC;IACvB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,mBAAmB,EAAE,CAAC,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAChE,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,UAAU,EAAE,EACnD,SAAiB,EACjB,eAAe,EACf,aAAqB,EACrB,oBAA4B,EAC5B,QAAa,EACb,MAAM,EACN,mBAAmB,EACnB,WAAW,EACX,SAAS,EACT,YAAY,EACZ,YAAY,GACb,EAAE,mBAAmB,CAAC,CAAC,CAAC,eA2hBxB"}
@@ -1 +1 @@
1
- "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),a=require("react"),n=e(a),r=require("react-i18next"),o=e(require("react-bootstrap/Row")),l=e(require("react-bootstrap/Col")),i=require("react-bootstrap"),c=require("../../static/Icon.js"),s=require("react-hook-form"),d=e(require("@licklist/plugins/dist/services/Form/HookFormService")),m=require("@react-aria/utils"),u=require("../../static/switch/BooleanSwitch.js"),E=require("../../static/form-number-input/FormNumberInput.js");require("../../static/index.js");var p=require("../form/context.js"),g=require("@licklist/core/dist/DataMapper/Product/ProductCategoryDataMapper"),C=require("./booking-management/ProductBookingManagementControl.js"),f=require("./deposit/ProductDepositControl.js"),v=require("./quantity/ProductQuantityControl.js"),h=require("./quantity/ProductQuantityConstantControl.js"),b=require("./quantity/ProductQuantityRechargingControl.js"),I=e(require("react-bootstrap/Collapse")),F=require("@licklist/plugins/dist/hooks/Media/useImages"),P=require("@licklist/core/dist/DataMapper/Media/ImageDataMapper"),N=require("../../file-upload/FileUpload.js"),T=require("../../tiptap-editor/TipTapEditor.js"),q=require("./fixed-duration-fields/FixedDurationOptions.js"),y=require("./duration/ProductDurationControl.js"),_=require("./price/ProductPriceControl.js"),k=require("./constants.js");exports.ProductControl=function(e){var x=e.isLoading,A=void 0!==x&&x,L=e.fieldNamePrefix,S=e.allowDeposits,D=void 0!==S&&S,R=e.hasBookingManagement,G=void 0!==R&&R,j=e.zoneList,w=void 0===j?[]:j,M=e.onCopy,O=e.onProductNameChange,B=e.productName,Y=e.hasTicket,U=e.categoryType,H=e.zoneDuration,Q=s.useFormContext(),V=Q.register,X=Q.control,z=Q.formState.errors,Z=Q.setValue,W=Q.getValues,J=Q.setError,K=Q.watch,$=a.useContext(p.ProductSetLoadingContext),ee=$.setLoading,te=$.providerHasBookingManagement,ae=r.useTranslation(["Design","Validation"]).t,ne=t.__read(a.useState(!1),2),re=ne[0],oe=ne[1],le=t.__read(a.useState(null),2),ie=le[0],ce=le[1],se=Boolean(K("".concat(L,".isUnlimited"))),de=m.useId(),me=m.useId(),ue=m.useId(),Ee=m.useId(),pe=m.useId(),ge=m.useId(),Ce=m.useId(),fe=m.useId(),ve=m.useId(),he=m.useId(),be=m.useId(),Ie=[{id:1,value:ae("quantitySelector")},{id:2,value:ae("stockControl")}],Fe=a.useCallback((function(){return oe((function(e){return!e}))}),[]),Pe=s.useWatch({control:X,name:"".concat(L,".quantitySelector")}),Ne=F.useImages(ie),Te=Ne.images,qe=Ne.handleImageRemove,ye=Ne.handleImageUploading,_e=Ne.isLoading,ke=a.useCallback((function(e){ye(e,P.IMAGE_TYPE_IMAGE)}),[ye]),xe=a.useCallback((function(e,t){qe(String(e),t)}),[qe]),Ae=function(e){return e.target.select()};a.useEffect((function(){ee(_e)}),[ee,_e]),a.useEffect((function(){var e=W("".concat(L,".images"));ce(e)}),[W,ce,L]),a.useEffect((function(){Array.isArray(Te)&&Z("".concat(L,".images"),Te)}),[Te,L,Z]),a.useEffect((function(){U!==g.CATEGORY_TYPE_GAME||H||J("".concat(L,".duration"),{message:ae("Validation:categoryZoneDoesntHaveDefaultDuration")})}),[U,H,L]);var Le=null!=Pe?Pe:"1",Se=g.QUANTITY_TYPE_LIST_DTO[Le];return n.createElement(n.Fragment,null,n.createElement(o,null,n.createElement(l,{lg:8,md:8},n.createElement(i.Form.Group,{controlId:me},n.createElement(i.Form.Label,null,ae("name")),n.createElement(i.Form.Control,t.__assign({},V("".concat(L,".name")),{value:B,onChange:O,isInvalid:d.isInvalid("".concat(L,".name"),z),disabled:A,placeholder:ae("name")})),n.createElement(i.Form.Control.Feedback,{type:"invalid"},d.getErrors("".concat(L,".name"),z))),n.createElement(i.Form.Group,{controlId:ue},n.createElement(i.Form.Label,null,ae("description")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange;return n.createElement(T.TipTapEditor,{withEmoji:!1,viewMode:!1,onUpdate:r,content:a,disabled:A})},rules:{maxLength:{value:k.MAX_PRODUCT_DESCRIPTION_CHARACTERS_LENGTH,message:ae("Validation:descriptionTooManyCharactersMessage",{max:k.MAX_PRODUCT_DESCRIPTION_CHARACTERS_LENGTH})}},control:X,name:"".concat(L,".description")})),n.createElement("div",{className:"invalid-feedback field-values-error d-block"},d.getErrors("".concat(L,".description"),z)),D?n.createElement(o,null,n.createElement(f.ProductDepositControl,{isLoading:A,fieldNamePrefix:L}),n.createElement(_.ProductPriceControl,{isLoading:A,fieldNamePrefix:"".concat(L,".price"),title:ae("totalPrice"),allowDeposits:D})):n.createElement(_.ProductPriceControl,{isLoading:A,fieldNamePrefix:"".concat(L,".price")}),n.createElement("div",null,n.createElement(v.ProductQuantityControl,{isLoading:A,fieldNamePrefix:L,onFocus:Ae}),Se===g.QUANTITY_TYPE_CONSTANT&&n.createElement(h.ProductQuantityConstantControl,{isLoading:A,fieldNamePrefix:L,onFocus:Ae,disabled:se}),Se===g.QUANTITY_TYPE_RECHARGING&&n.createElement(b.ProductQuantityRechargingControl,{isLoading:A,fieldNamePrefix:L,onFocus:Ae,disabled:se}),n.createElement(i.Form.Group,{controlId:he,className:"custom-checkbox"},n.createElement(i.Form.Check,t.__assign({custom:!0,type:"checkbox"},V("".concat(L,".isUnlimited")),{name:"".concat(L,".isUnlimited"),disabled:A})),n.createElement(i.Form.Check.Label,null,ae("isUnlimited")))),n.createElement(i.Form.Group,{controlId:fe},n.createElement(i.Form.Label,null,ae("quantitySelectorType")),n.createElement(i.Form.Control,t.__assign({as:"select",defaultValue:Y?Ie[0].id:void 0},V("".concat(L,".quantitySelector")),{isInvalid:d.isInvalid("".concat(L,".quantitySelector"),z),disabled:A||Y}),Ie.map((function(e){return n.createElement("option",{value:e.id,key:e.id},e.value)}))),n.createElement(i.Form.Control.Feedback,{type:"invalid"},d.getErrors("".concat(L,".quantitySelector"),z))))),U===g.CATEGORY_TYPE_FIXED_DURATION&&n.createElement(o,{className:"align-items-start"},n.createElement(y.ProductDurationControl,{fieldNamePrefix:L,providerHasBookingManagement:te}),n.createElement(l,{lg:4,md:4},n.createElement(E.FormNumberInput,{fieldName:"".concat(L,".capacity"),label:ae("capacity")}))),U===g.CATEGORY_TYPE_GAME&&n.createElement(o,{className:"align-items-start"},n.createElement(l,{lg:4,md:4},n.createElement(E.FormNumberInput,{fieldName:"".concat(L,".capacity"),label:ae("capacity"),onChange:function(e){Z("".concat(L,".duration"),e*H)},rules:{min:{value:1,message:ae("Validation:fieldRequired",{attribute:ae("capacity")})}}})),n.createElement(l,{lg:4,md:4},n.createElement(E.FormNumberInput,{fieldName:"".concat(L,".duration"),label:ae("durationMinutes"),disabled:!0}))),n.createElement(o,null,n.createElement(l,{lg:8,md:8},n.createElement(i.Form.Group,{controlId:Ee},n.createElement(i.Form.Label,null,ae("productTermsConditions")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name,l=t.ref;return n.createElement(i.Form.Control,{ref:l,as:"textarea",rows:3,value:a,onChange:r,isInvalid:d.isInvalid("".concat(L,".termsAndConditions"),z),disabled:A,name:o})},control:X,name:"".concat(L,".termsAndConditions")}),n.createElement(i.Form.Control.Feedback,{type:"invalid"},d.getErrors("".concat(L,".termsAndConditions"),z)))),n.createElement(l,{lg:4,md:4,className:"licklist-file-upload-wrapper"},n.createElement(N.FileUpload,{onFilesChange:ke,allowedExtensions:["jpeg","jpg","png"],subTitle:".jpeg .jpg .png",enablePreview:!0,onFileRemove:xe,defaultFiles:Te,isLoading:_e,withIcon:!0,title:ae("addImage")}))),n.createElement(l,{lg:12,md:12,xl:!0,className:"p-0"},n.createElement(i.Form.Group,{controlId:pe,className:"advanced-switch-container"},n.createElement(i.Form.Label,null,ae("isAvailable")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(u.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:A})},control:X,name:"".concat(L,".isAvailable")})),n.createElement(i.Form.Group,{controlId:ge,className:"advanced-switch-container"},n.createElement(i.Form.Label,null,ae("isSoldOut")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(u.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:A})},control:X,name:"".concat(L,".isSoldOut")})),n.createElement(i.Form.Group,{controlId:de,className:"custom-checkbox"},n.createElement(i.Form.Check,{custom:!0,type:"checkbox",name:de,disabled:A},n.createElement(i.Form.Check.Input,{checked:re,onChange:Fe,type:"checkbox"}),n.createElement(i.Form.Check.Label,null,ae("showAdvancedOptions"))))),n.createElement(l,{lg:12,md:12,xl:!0,className:"p-0"},n.createElement(I,{in:re},n.createElement("div",null,n.createElement(i.Form.Group,{controlId:Ce,className:"advanced-switch-container"},n.createElement(i.Form.Label,null,ae("isRequired")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(u.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:A})},control:X,name:"".concat(L,".isRequired")})),n.createElement(i.Form.Group,{controlId:ve,className:"advanced-switch-container"},n.createElement(i.Form.Label,null,ae("hasSpecialNotes")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(u.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:A})},control:X,name:"".concat(L,".hasSpecialNotes")})),[g.CATEGORY_TYPE_GAME,g.CATEGORY_TYPE_FIXED_DURATION].includes(U)&&n.createElement(q.FixedDurationOptions,{fieldNamePrefix:L}),n.createElement(i.Form.Group,{controlId:be,className:"advanced-switch-container"},n.createElement(_.ProductPriceControl,{title:ae("minSpend"),isRequired:!1,isMoreThanZero:!0,allowDeposits:!1,isLoading:A,fieldNamePrefix:"".concat(L,".minSpend")})))),n.createElement(o,null,n.createElement(l,{xs:12},G&&n.createElement(C.ProductBookingManagementControl,{isLoading:A,zoneList:w,fieldNamePrefix:L})))),n.createElement(o,null,n.createElement(l,{xs:!0},n.createElement("div",{className:"d-flex justify-content-end mt-4"},Boolean(M)&&n.createElement(i.Button,{onClick:M,variant:"link",className:"d-flex align-items-center"},n.createElement(c.default,{type:"clipboard",height:"1rem",className:"mr-2"})," ",ae("copy"))))))};
1
+ "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),a=require("react"),n=e(a),r=require("react-i18next"),o=e(require("react-bootstrap/Row")),l=e(require("react-bootstrap/Col")),i=require("react-bootstrap"),c=require("../../static/Icon.js"),s=require("react-hook-form"),d=e(require("@licklist/plugins/dist/services/Form/HookFormService")),m=require("@react-aria/utils"),u=require("../../static/switch/BooleanSwitch.js"),E=require("../../static/form-number-input/FormNumberInput.js");require("../../static/index.js");var p=require("../form/context.js"),g=require("@licklist/core/dist/DataMapper/Product/ProductCategoryDataMapper"),C=require("./booking-management/ProductBookingManagementControl.js"),f=require("./deposit/ProductDepositControl.js"),v=require("./quantity/ProductQuantityControl.js"),b=require("./quantity/ProductQuantityConstantControl.js"),h=require("./quantity/ProductQuantityRechargingControl.js"),I=e(require("react-bootstrap/Collapse")),F=require("@licklist/plugins/dist/hooks/Media/useImages"),P=require("@licklist/core/dist/DataMapper/Media/ImageDataMapper"),N=require("../../file-upload/FileUpload.js"),T=require("../../tiptap-editor/TipTapEditor.js"),q=require("./fixed-duration-fields/FixedDurationOptions.js"),y=require("./duration/ProductDurationControl.js"),_=require("./price/ProductPriceControl.js"),k=require("./constants.js");exports.ProductControl=function(e){var x=e.isLoading,A=void 0!==x&&x,L=e.fieldNamePrefix,S=e.allowDeposits,D=void 0!==S&&S,R=e.hasBookingManagement,G=void 0!==R&&R,j=e.zoneList,w=void 0===j?[]:j,M=e.onCopy,O=e.onProductNameChange,B=e.productName,Y=e.hasTicket,U=e.categoryType,H=e.zoneDuration,Q=s.useFormContext(),V=Q.register,X=Q.control,z=Q.formState.errors,Z=Q.setValue,W=Q.getValues,J=Q.setError,K=Q.watch,$=a.useContext(p.ProductSetLoadingContext),ee=$.setLoading,te=$.providerHasBookingManagement,ae=r.useTranslation(["Design","Validation"]).t,ne=t.__read(a.useState(!1),2),re=ne[0],oe=ne[1],le=t.__read(a.useState(null),2),ie=le[0],ce=le[1],se=Boolean(K("".concat(L,".isUnlimited"))),de=m.useId(),me=m.useId(),ue=m.useId(),Ee=m.useId(),pe=m.useId(),ge=m.useId(),Ce=m.useId(),fe=m.useId(),ve=m.useId(),be=m.useId(),he=m.useId(),Ie=[{id:1,value:ae("quantitySelector")},{id:2,value:ae("stockControl")}],Fe=a.useCallback((function(){return oe((function(e){return!e}))}),[]),Pe=s.useWatch({control:X,name:"".concat(L,".quantitySelector")}),Ne=F.useImages(ie),Te=Ne.images,qe=Ne.handleImageRemove,ye=Ne.handleImageUploading,_e=Ne.isLoading,ke=a.useCallback((function(e){ye(e,P.IMAGE_TYPE_IMAGE)}),[ye]),xe=a.useCallback((function(e,t){qe(String(e),t)}),[qe]),Ae=function(e){return e.target.select()};a.useEffect((function(){ee(_e)}),[ee,_e]),a.useEffect((function(){var e=W("".concat(L,".images"));ce(e)}),[W,ce,L]),a.useEffect((function(){Array.isArray(Te)&&Z("".concat(L,".images"),Te)}),[Te,L,Z]),a.useEffect((function(){U!==g.CATEGORY_TYPE_GAME||H||J("".concat(L,".duration"),{message:ae("Validation:categoryZoneDoesntHaveDefaultDuration")})}),[U,H,L]);var Le=null!=Pe?Pe:"1",Se=g.QUANTITY_TYPE_LIST_DTO[Le];return n.createElement(n.Fragment,null,n.createElement(o,null,n.createElement(l,{lg:8,md:8},n.createElement(i.Form.Group,{controlId:me},n.createElement(i.Form.Label,null,ae("name")),n.createElement(i.Form.Control,t.__assign({},V("".concat(L,".name")),{value:B,onChange:O,isInvalid:d.isInvalid("".concat(L,".name"),z),disabled:A,placeholder:ae("name")})),n.createElement(i.Form.Control.Feedback,{type:"invalid"},d.getErrors("".concat(L,".name"),z))),n.createElement(i.Form.Group,{controlId:ue},n.createElement(i.Form.Label,null,ae("description")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange;return n.createElement(T.TipTapEditor,{withEmoji:!1,viewMode:!1,onUpdate:r,content:a,disabled:A})},rules:{maxLength:{value:k.MAX_PRODUCT_DESCRIPTION_CHARACTERS_LENGTH,message:ae("Validation:descriptionTooManyCharactersMessage",{max:k.MAX_PRODUCT_DESCRIPTION_CHARACTERS_LENGTH})}},control:X,name:"".concat(L,".description")})),n.createElement("div",{className:"invalid-feedback field-values-error d-block"},d.getErrors("".concat(L,".description"),z)),D?n.createElement(o,null,n.createElement(f.ProductDepositControl,{isLoading:A,fieldNamePrefix:L}),n.createElement(_.ProductPriceControl,{isLoading:A,fieldNamePrefix:"".concat(L,".price"),title:ae("totalPrice"),allowDeposits:D})):n.createElement(_.ProductPriceControl,{isLoading:A,fieldNamePrefix:"".concat(L,".price")}),n.createElement("div",null,n.createElement(v.ProductQuantityControl,{isLoading:A,fieldNamePrefix:L,onFocus:Ae}),Se===g.QUANTITY_TYPE_CONSTANT&&n.createElement(b.ProductQuantityConstantControl,{isLoading:A,fieldNamePrefix:L,onFocus:Ae,disabled:se}),Se===g.QUANTITY_TYPE_RECHARGING&&n.createElement(h.ProductQuantityRechargingControl,{isLoading:A,fieldNamePrefix:L,onFocus:Ae,disabled:se}),n.createElement(i.Form.Group,{controlId:be,className:"custom-checkbox"},n.createElement(i.Form.Check,t.__assign({custom:!0,type:"checkbox"},V("".concat(L,".isUnlimited")),{name:"".concat(L,".isUnlimited"),disabled:A})),n.createElement(i.Form.Check.Label,null,ae("isUnlimited")))),n.createElement(i.Form.Group,{controlId:fe},n.createElement(i.Form.Label,null,ae("quantitySelectorType")),n.createElement(i.Form.Control,t.__assign({as:"select",defaultValue:Y?Ie[0].id:void 0},V("".concat(L,".quantitySelector")),{isInvalid:d.isInvalid("".concat(L,".quantitySelector"),z),disabled:A||Y}),Ie.map((function(e){return n.createElement("option",{value:e.id,key:e.id},e.value)}))),n.createElement(i.Form.Control.Feedback,{type:"invalid"},d.getErrors("".concat(L,".quantitySelector"),z))))),U===g.CATEGORY_TYPE_FIXED_DURATION&&n.createElement(o,{className:"align-items-start"},n.createElement(y.ProductDurationControl,{fieldNamePrefix:L,providerHasBookingManagement:te}),n.createElement(l,{lg:4,md:4},n.createElement(E.FormNumberInput,{fieldName:"".concat(L,".capacity"),label:ae("capacity"),rules:{min:{value:1,message:ae("Validation:fieldRequired",{attribute:ae("capacity")})}}}))),U===g.CATEGORY_TYPE_GAME&&n.createElement(o,{className:"align-items-start"},n.createElement(l,{lg:4,md:4},n.createElement(E.FormNumberInput,{fieldName:"".concat(L,".capacity"),label:ae("capacity"),onChange:function(e){Z("".concat(L,".duration"),e*H)},rules:{min:{value:1,message:ae("Validation:fieldRequired",{attribute:ae("capacity")})}}})),n.createElement(l,{lg:4,md:4},n.createElement(E.FormNumberInput,{fieldName:"".concat(L,".duration"),label:ae("durationMinutes"),disabled:!0}))),n.createElement(o,null,n.createElement(l,{lg:8,md:8},n.createElement(i.Form.Group,{controlId:Ee},n.createElement(i.Form.Label,null,ae("productTermsConditions")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name,l=t.ref;return n.createElement(i.Form.Control,{ref:l,as:"textarea",rows:3,value:a,onChange:r,isInvalid:d.isInvalid("".concat(L,".termsAndConditions"),z),disabled:A,name:o})},control:X,name:"".concat(L,".termsAndConditions")}),n.createElement(i.Form.Control.Feedback,{type:"invalid"},d.getErrors("".concat(L,".termsAndConditions"),z)))),n.createElement(l,{lg:4,md:4,className:"licklist-file-upload-wrapper"},n.createElement(N.FileUpload,{onFilesChange:ke,allowedExtensions:["jpeg","jpg","png"],subTitle:".jpeg .jpg .png",enablePreview:!0,onFileRemove:xe,defaultFiles:Te,isLoading:_e,withIcon:!0,title:ae("addImage")}))),n.createElement(l,{lg:12,md:12,xl:!0,className:"p-0"},n.createElement(i.Form.Group,{controlId:pe,className:"advanced-switch-container"},n.createElement(i.Form.Label,null,ae("isAvailable")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(u.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:A})},control:X,name:"".concat(L,".isAvailable")})),n.createElement(i.Form.Group,{controlId:ge,className:"advanced-switch-container"},n.createElement(i.Form.Label,null,ae("isSoldOut")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(u.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:A})},control:X,name:"".concat(L,".isSoldOut")})),n.createElement(i.Form.Group,{controlId:de,className:"custom-checkbox"},n.createElement(i.Form.Check,{custom:!0,type:"checkbox",name:de,disabled:A},n.createElement(i.Form.Check.Input,{checked:re,onChange:Fe,type:"checkbox"}),n.createElement(i.Form.Check.Label,null,ae("showAdvancedOptions"))))),n.createElement(l,{lg:12,md:12,xl:!0,className:"p-0"},n.createElement(I,{in:re},n.createElement("div",null,n.createElement(i.Form.Group,{controlId:Ce,className:"advanced-switch-container"},n.createElement(i.Form.Label,null,ae("isRequired")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(u.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:A})},control:X,name:"".concat(L,".isRequired")})),n.createElement(i.Form.Group,{controlId:ve,className:"advanced-switch-container"},n.createElement(i.Form.Label,null,ae("hasSpecialNotes")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(u.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:A})},control:X,name:"".concat(L,".hasSpecialNotes")})),[g.CATEGORY_TYPE_GAME,g.CATEGORY_TYPE_FIXED_DURATION].includes(U)&&n.createElement(q.FixedDurationOptions,{fieldNamePrefix:L}),n.createElement(i.Form.Group,{controlId:he,className:"advanced-switch-container"},n.createElement(_.ProductPriceControl,{title:ae("minSpend"),isRequired:!1,isMoreThanZero:!0,allowDeposits:!1,isLoading:A,fieldNamePrefix:"".concat(L,".minSpend")})))),n.createElement(o,null,n.createElement(l,{xs:12},G&&n.createElement(C.ProductBookingManagementControl,{isLoading:A,zoneList:w,fieldNamePrefix:L})))),n.createElement(o,null,n.createElement(l,{xs:!0},n.createElement("div",{className:"d-flex justify-content-end mt-4"},Boolean(M)&&n.createElement(i.Button,{onClick:M,variant:"link",className:"d-flex align-items-center"},n.createElement(c.default,{type:"clipboard",height:"1rem",className:"mr-2"})," ",ae("copy"))))))};
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ import { RegisterOptions } from "react-hook-form";
2
3
  interface RecurrenceIntervalAndFrequencyInputProps {
3
4
  disabled?: boolean;
4
5
  minDate?: string;
@@ -6,7 +7,9 @@ interface RecurrenceIntervalAndFrequencyInputProps {
6
7
  startTimeLabel?: string;
7
8
  endDateLabel?: string;
8
9
  endTimeLabel?: string;
10
+ startTimeRules?: Pick<RegisterOptions, "max" | "min" | "validate" | "required" | "pattern">;
11
+ endTimeRules?: Pick<RegisterOptions, "max" | "min" | "validate" | "required" | "pattern">;
9
12
  }
10
- declare function RecurrenceIntervalAndFrequencyInput({ disabled, minDate, startDateLabel, startTimeLabel, endDateLabel, endTimeLabel, }: RecurrenceIntervalAndFrequencyInputProps): JSX.Element;
13
+ declare function RecurrenceIntervalAndFrequencyInput({ disabled, minDate, startDateLabel, startTimeLabel, endDateLabel, endTimeLabel, startTimeRules, endTimeRules, }: RecurrenceIntervalAndFrequencyInputProps): JSX.Element;
11
14
  export default RecurrenceIntervalAndFrequencyInput;
12
15
  //# sourceMappingURL=RecurrenceIntervalAndFrequencyInput.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RecurrenceIntervalAndFrequencyInput.d.ts","sourceRoot":"","sources":["../../src/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.tsx"],"names":[],"mappings":";AAQA,UAAU,wCAAwC;IAChD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,iBAAS,mCAAmC,CAAC,EAC3C,QAAgB,EAChB,OAAO,EACP,cAAc,EACd,cAAc,EACd,YAAY,EACZ,YAAY,GACb,EAAE,wCAAwC,eAmJ1C;AAED,eAAe,mCAAmC,CAAC"}
1
+ {"version":3,"file":"RecurrenceIntervalAndFrequencyInput.d.ts","sourceRoot":"","sources":["../../src/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,eAAe,EAAkB,MAAM,iBAAiB,CAAC;AAIlE,UAAU,wCAAwC;IAChD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,IAAI,CACnB,eAAe,EACf,KAAK,GAAG,KAAK,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,CACpD,CAAC;IACF,YAAY,CAAC,EAAE,IAAI,CACjB,eAAe,EACf,KAAK,GAAG,KAAK,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,CACpD,CAAC;CACH;AAED,iBAAS,mCAAmC,CAAC,EAC3C,QAAgB,EAChB,OAAO,EACP,cAAc,EACd,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,YAAY,GACb,EAAE,wCAAwC,eA0J1C;AAED,eAAe,mCAAmC,CAAC"}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),a=require("react"),l=(e=a)&&"object"==typeof e&&"default"in e?e.default:e,r=require("@licklist/core/dist/Config"),n=require("react-i18next"),i=require("react-bootstrap"),o=require("react-hook-form"),m=require("luxon");exports.default=function(e){var s,d,u,c=e.disabled,f=void 0!==c&&c,v=e.minDate,D=e.startDateLabel,g=e.startTimeLabel,E=e.endDateLabel,F=e.endTimeLabel,b=n.useTranslation(["Design","Notification","App"]).t,T=o.useFormContext(),p=T.getValues,C=T.formState.errors,h=T.register,_=T.trigger,q=T.setValue,y=p("startDate"),L=p("endDate"),x=p("startTime"),V=p("endTime");return a.useEffect((function(){y&&L&&_("endDate")}),[y]),a.useEffect((function(){_("endTime")}),[x]),l.createElement(l.Fragment,null,l.createElement(i.Row,null,l.createElement(i.Col,{xs:12,sm:6},l.createElement(i.Form.Group,null,l.createElement(i.Form.Label,null,null!=D?D:b("Design:fromDate")),l.createElement(i.Form.Control,t.__assign({type:"date"},h("startDate",{required:!0}),{defaultValue:y,className:y&&"date-input-with-value",disabled:f,min:v,isInvalid:Boolean(C.startDate)})),l.createElement(i.Form.Control.Feedback,{type:"invalid"},null===(s=C.startDate)||void 0===s?void 0:s.message))),l.createElement(i.Col,{xs:12,sm:6},l.createElement(i.Form.Group,null,l.createElement(i.Form.Label,null,null!=E?E:b("Design:toDate")),l.createElement(i.Form.Control,t.__assign({type:"date"},h("endDate",{required:!0,validate:function(e){if(!y||!e)return!0;var t=m.DateTime.fromFormat(y,r.DATE_FORMAT);return m.DateTime.fromFormat(e,r.DATE_FORMAT).diff(t,["days"]).days>=0||"".concat(b("Validation:fieldLaterDate",{attribute:b("Design:endDateSmall"),min:b("Design:startDateSmall")}))}}),{defaultValue:L,className:L&&"date-input-with-value",disabled:f,min:y||void 0,isInvalid:Boolean(C.endDate)})),l.createElement(i.Form.Control.Feedback,{type:"invalid"},null===(d=C.endDate)||void 0===d?void 0:d.message)))),l.createElement(i.Row,null,l.createElement(i.Col,{xs:12,sm:6},l.createElement(i.Form.Group,null,l.createElement(i.Form.Label,null,null!=g?g:b("Design:availableFrom")),l.createElement(i.Form.Control,t.__assign({type:"time"},h("startTime",{required:!1}),{onChange:function(e){var t=e.target.value;q("startTime","".concat(t,":00"))},placeholder:"hh:mm",defaultValue:x,disabled:f,isInvalid:Boolean(C.startTime)})))),l.createElement(i.Col,{xs:12,sm:6},l.createElement(i.Form.Group,null,l.createElement(i.Form.Label,null,null!=F?F:b("Design:availableTo")),l.createElement(i.Form.Control,t.__assign({type:"time"},h("endTime",{required:!1,validate:function(e){var t;if(!x||!e)return!0;var a=m.DateTime.fromISO(x),l=m.DateTime.fromISO(e);return(null===(t=null==l?void 0:l.diff(a,["seconds"]))||void 0===t?void 0:t.seconds)>0||"".concat(b("Validation:fieldLaterDate",{attribute:b("Design:endTimeSmall"),min:b("Design:startTimeSmall")}))}}),{onChange:function(e){var t=e.target.value;q("endTime","".concat(t,":59"),{shouldValidate:!0})},placeholder:"hh:mm",defaultValue:V,disabled:f,isInvalid:Boolean(C.endTime)})),l.createElement(i.Form.Control.Feedback,{type:"invalid"},null===(u=C.endTime)||void 0===u?void 0:u.message)))))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),a=require("react"),l=(e=a)&&"object"==typeof e&&"default"in e?e.default:e,n=require("@licklist/core/dist/Config"),r=require("react-i18next"),i=require("react-bootstrap"),o=require("react-hook-form"),m=require("luxon");exports.default=function(e){var s,d,u,c,f=e.disabled,v=void 0!==f&&f,D=e.minDate,g=e.startDateLabel,E=e.startTimeLabel,F=e.endDateLabel,T=e.endTimeLabel,b=e.startTimeRules,p=e.endTimeRules,C=r.useTranslation(["Design","Notification","App"]).t,_=o.useFormContext(),h=_.getValues,y=_.formState.errors,q=_.register,L=_.trigger,V=_.setValue,x=h("startDate"),S=h("endDate"),k=h("startTime"),I=h("endTime");return a.useEffect((function(){x&&S&&L("endDate")}),[x]),a.useEffect((function(){k&&I&&L("endTime")}),[k]),l.createElement(l.Fragment,null,l.createElement(i.Row,null,l.createElement(i.Col,{xs:12,sm:6},l.createElement(i.Form.Group,null,l.createElement(i.Form.Label,null,null!=g?g:C("Design:fromDate")),l.createElement(i.Form.Control,t.__assign({type:"date"},q("startDate",{required:!0}),{defaultValue:x,className:x&&"date-input-with-value",disabled:v,min:D,isInvalid:Boolean(y.startDate)})),l.createElement(i.Form.Control.Feedback,{type:"invalid"},null===(s=y.startDate)||void 0===s?void 0:s.message))),l.createElement(i.Col,{xs:12,sm:6},l.createElement(i.Form.Group,null,l.createElement(i.Form.Label,null,null!=F?F:C("Design:toDate")),l.createElement(i.Form.Control,t.__assign({type:"date"},q("endDate",{required:!0,validate:function(e){if(!x||!e)return!0;var t=m.DateTime.fromFormat(x,n.DATE_FORMAT);return m.DateTime.fromFormat(e,n.DATE_FORMAT).diff(t,["days"]).days>=0||"".concat(C("Validation:fieldLaterDate",{attribute:C("Design:endDateSmall"),min:C("Design:startDateSmall")}))}}),{defaultValue:S,className:S&&"date-input-with-value",disabled:v,min:x||void 0,isInvalid:Boolean(y.endDate)})),l.createElement(i.Form.Control.Feedback,{type:"invalid"},null===(d=y.endDate)||void 0===d?void 0:d.message)))),l.createElement(i.Row,null,l.createElement(i.Col,{xs:12,sm:6},l.createElement(i.Form.Group,null,l.createElement(i.Form.Label,null,null!=E?E:C("Design:availableFrom")),l.createElement(i.Form.Control,t.__assign({type:"time"},q("startTime",t.__assign({required:!1},b)),{onChange:function(e){var t=e.target.value;V("startTime","".concat(t,":00"),{shouldValidate:!0})},placeholder:"hh:mm",defaultValue:k,disabled:v,isInvalid:Boolean(y.startTime)})),l.createElement(i.Form.Control.Feedback,{type:"invalid"},null===(u=y.startTime)||void 0===u?void 0:u.message))),l.createElement(i.Col,{xs:12,sm:6},l.createElement(i.Form.Group,null,l.createElement(i.Form.Label,null,null!=T?T:C("Design:availableTo")),l.createElement(i.Form.Control,t.__assign({type:"time"},q("endTime",t.__assign({required:!1,validate:function(e){var t;if(!k||!e)return!0;var a=m.DateTime.fromISO(k),l=m.DateTime.fromISO(e);return(null===(t=null==l?void 0:l.diff(a,["seconds"]))||void 0===t?void 0:t.seconds)>0||"".concat(C("Validation:fieldLaterDate",{attribute:C("Design:endTimeSmall"),min:C("Design:startTimeSmall")}))}},p)),{onChange:function(e){var t=e.target.value;V("endTime","".concat(t,":59"),{shouldValidate:!0})},placeholder:"hh:mm",defaultValue:I,disabled:v,isInvalid:Boolean(y.endTime)})),l.createElement(i.Form.Control.Feedback,{type:"invalid"},null===(c=y.endTime)||void 0===c?void 0:c.message)))))};
@@ -15,6 +15,10 @@
15
15
  display: none !important;
16
16
  }
17
17
  }
18
+
19
+ &.is-invalid {
20
+ border-color: theme-color("danger");
21
+ }
18
22
  }
19
23
 
20
24
  .placeholder-row {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@licklist/design",
3
- "version": "0.44.486-dev.14",
3
+ "version": "0.44.486-dev.16",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+ssh://git@bitbucket.org/artelogicsoft/licklist_design.git"
@@ -12,21 +12,30 @@ export const useImage = (
12
12
  height: 0,
13
13
  });
14
14
 
15
+ const setImageEventHandler = function setImageEventHandler(
16
+ this: HTMLImageElement
17
+ ) {
18
+ imageRef.current = this;
19
+
20
+ setImageAttributes({
21
+ width: this.naturalWidth,
22
+ height: this.naturalHeight,
23
+ });
24
+ };
25
+
15
26
  const loadImage = useCallback((imageUrl?: string) => {
16
27
  imageRef.current = new window.Image();
17
28
  imageRef.current.src = imageUrl;
18
- imageRef.current.addEventListener("load", function () {
19
- imageRef.current = this;
20
-
21
- setImageAttributes({
22
- width: this.naturalWidth,
23
- height: this.naturalHeight,
24
- });
25
- });
29
+ imageRef.current.addEventListener("load", setImageEventHandler);
26
30
  }, []);
27
31
 
28
32
  useEffect(() => {
29
33
  loadImage(url);
34
+
35
+ return () => {
36
+ imageRef.current.removeEventListener("load", setImageEventHandler);
37
+ imageRef.current = undefined;
38
+ };
30
39
  }, [url, loadImage]);
31
40
 
32
41
  const memoizedImageAttributes = useMemo(() => {
@@ -314,13 +314,38 @@ export const EmailTemplateControl = React.forwardRef(
314
314
  <Row className="mb-4">
315
315
  <Form.Group as={Col}>
316
316
  <Form.Label>{t("Design:emailBody")}</Form.Label>
317
- <div className="email-editor">
317
+
318
+ <div className="alert alert-warning" role="alert">
319
+ Due to the mail services limitations on the length of the email
320
+ body that can be sent or received - maximum length is set to
321
+ 65,535 characters.
322
+ </div>
323
+
324
+ <div className={`email-editor ${errors.body && "is-invalid"}`}>
318
325
  <EmailEditor
319
326
  ref={ref}
320
327
  onReady={onReadyEditor}
321
328
  style={{ height: "50rem" }}
322
329
  />
330
+
331
+ <input
332
+ type="hidden"
333
+ name="body"
334
+ {...register("body", {
335
+ maxLength: {
336
+ value: 65535,
337
+ message: t("Validation:fieldMaxLength", {
338
+ attribute: t("body"),
339
+ max: 65535,
340
+ }) as string,
341
+ },
342
+ })}
343
+ />
323
344
  </div>
345
+
346
+ <Form.Control.Feedback type="invalid">
347
+ {errors.body?.message}
348
+ </Form.Control.Feedback>
324
349
  </Form.Group>
325
350
  </Row>
326
351
  <Row>
@@ -393,6 +393,14 @@ export function ProductControl<T extends FormValues>({
393
393
  <FormNumberInput
394
394
  fieldName={`${fieldNamePrefix}.capacity`}
395
395
  label={t("capacity")}
396
+ rules={{
397
+ min: {
398
+ value: 1,
399
+ message: t("Validation:fieldRequired", {
400
+ attribute: t("capacity"),
401
+ }) as string,
402
+ },
403
+ }}
396
404
  />
397
405
  </Col>
398
406
  </Row>
@@ -2,7 +2,7 @@ import React, { useEffect } from "react";
2
2
  import { DateTime } from "luxon";
3
3
  import { Col, Form, Row } from "react-bootstrap";
4
4
  import { useTranslation } from "react-i18next";
5
- import { useFormContext } from "react-hook-form";
5
+ import { RegisterOptions, useFormContext } from "react-hook-form";
6
6
  import { DATE_FORMAT } from "@licklist/core/dist/Config";
7
7
  import { RecurringDatePickerInputValues } from "./RecurringDatePickerInput";
8
8
 
@@ -13,6 +13,14 @@ interface RecurrenceIntervalAndFrequencyInputProps {
13
13
  startTimeLabel?: string;
14
14
  endDateLabel?: string;
15
15
  endTimeLabel?: string;
16
+ startTimeRules?: Pick<
17
+ RegisterOptions,
18
+ "max" | "min" | "validate" | "required" | "pattern"
19
+ >;
20
+ endTimeRules?: Pick<
21
+ RegisterOptions,
22
+ "max" | "min" | "validate" | "required" | "pattern"
23
+ >;
16
24
  }
17
25
 
18
26
  function RecurrenceIntervalAndFrequencyInput({
@@ -22,6 +30,8 @@ function RecurrenceIntervalAndFrequencyInput({
22
30
  startTimeLabel,
23
31
  endDateLabel,
24
32
  endTimeLabel,
33
+ startTimeRules,
34
+ endTimeRules,
25
35
  }: RecurrenceIntervalAndFrequencyInputProps) {
26
36
  const { t } = useTranslation(["Design", "Notification", "App"]);
27
37
 
@@ -47,6 +57,9 @@ function RecurrenceIntervalAndFrequencyInput({
47
57
  }, [startDate]);
48
58
 
49
59
  useEffect(() => {
60
+ if (!startTime || !endTime) {
61
+ return;
62
+ }
50
63
  trigger("endTime");
51
64
  // eslint-disable-next-line react-hooks/exhaustive-deps
52
65
  }, [startTime]);
@@ -118,15 +131,18 @@ function RecurrenceIntervalAndFrequencyInput({
118
131
  </Form.Label>
119
132
  <Form.Control
120
133
  type="time"
121
- {...register("startTime", { required: false })}
134
+ {...register("startTime", { required: false, ...startTimeRules })}
122
135
  onChange={({ target: { value } }) => {
123
- setValue("startTime", `${value}:00`);
136
+ setValue("startTime", `${value}:00`, { shouldValidate: true });
124
137
  }}
125
138
  placeholder="hh:mm"
126
139
  defaultValue={startTime}
127
140
  disabled={disabled}
128
141
  isInvalid={Boolean(errors.startTime)}
129
142
  />
143
+ <Form.Control.Feedback type="invalid">
144
+ {errors.startTime?.message}
145
+ </Form.Control.Feedback>
130
146
  </Form.Group>
131
147
  </Col>
132
148
 
@@ -152,6 +168,7 @@ function RecurrenceIntervalAndFrequencyInput({
152
168
  min: t("Design:startTimeSmall"),
153
169
  })}`;
154
170
  },
171
+ ...endTimeRules,
155
172
  })}
156
173
  onChange={({ target: { value } }) => {
157
174
  setValue("endTime", `${value}:59`, { shouldValidate: true });
@@ -15,6 +15,10 @@
15
15
  display: none !important;
16
16
  }
17
17
  }
18
+
19
+ &.is-invalid {
20
+ border-color: theme-color("danger");
21
+ }
18
22
  }
19
23
 
20
24
  .placeholder-row {