@licklist/design 0.44.485-dev.30 → 0.44.485-dev.31
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.
- package/dist/notification/email-template/card/EmailTemplateCard.d.ts +3 -1
- package/dist/notification/email-template/card/EmailTemplateCard.d.ts.map +1 -1
- package/dist/notification/email-template/card/EmailTemplateCard.js +1 -1
- package/dist/notification/email-template/control/EmailTemplateControl.d.ts +3 -0
- package/dist/notification/email-template/control/EmailTemplateControl.d.ts.map +1 -1
- package/dist/notification/email-template/control/EmailTemplateControl.js +1 -1
- package/dist/notification/email-template/form/EmailTemplateForm.d.ts +6 -1
- package/dist/notification/email-template/form/EmailTemplateForm.d.ts.map +1 -1
- package/dist/notification/email-template/form/EmailTemplateForm.js +1 -1
- package/dist/notification/sms-template/card/SmsTemplateCard.d.ts +3 -1
- package/dist/notification/sms-template/card/SmsTemplateCard.d.ts.map +1 -1
- package/dist/notification/sms-template/card/SmsTemplateCard.js +1 -1
- package/dist/notification/sms-template/control/SmsTemplateControl.d.ts +6 -1
- package/dist/notification/sms-template/control/SmsTemplateControl.d.ts.map +1 -1
- package/dist/notification/sms-template/control/SmsTemplateControl.js +1 -1
- package/dist/notification/sms-template/form/SmsTemplateForm.d.ts +4 -1
- package/dist/notification/sms-template/form/SmsTemplateForm.d.ts.map +1 -1
- package/dist/notification/sms-template/form/SmsTemplateForm.js +1 -1
- package/dist/sales/manual-booking/select-menu/SelectMenu.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/notification/email-template/card/EmailTemplateCard.stories.tsx +1 -0
- package/src/notification/email-template/card/EmailTemplateCard.tsx +9 -2
- package/src/notification/email-template/control/EmailTemplateControl.tsx +61 -1
- package/src/notification/email-template/form/EmailTemplateForm.stories.tsx +21 -0
- package/src/notification/email-template/form/EmailTemplateForm.tsx +9 -1
- package/src/notification/sms-template/card/SmsTemplateCard.stories.tsx +1 -0
- package/src/notification/sms-template/card/SmsTemplateCard.tsx +7 -2
- package/src/notification/sms-template/control/SmsTemplateControl.tsx +36 -2
- package/src/notification/sms-template/form/SmsTemplateForm.stories.tsx +21 -0
- package/src/notification/sms-template/form/SmsTemplateForm.tsx +5 -1
- package/src/sales/manual-booking/select-menu/SelectMenu.tsx +3 -1
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { HasPermissionProp } from "@licklist/plugins/dist/types/permission/Permission";
|
|
3
|
+
import { NotificationType } from "@licklist/core/dist/DataMapper/Notification/NotificationTypeDataMapper";
|
|
3
4
|
export interface EmailTemplateCardProps extends HasPermissionProp {
|
|
4
5
|
name: string;
|
|
5
6
|
subject: string;
|
|
6
7
|
href: string;
|
|
7
8
|
isDefault: boolean;
|
|
8
9
|
onRemove: () => void;
|
|
10
|
+
type: NotificationType;
|
|
9
11
|
}
|
|
10
|
-
export declare function EmailTemplateCard({ name, href, subject, onRemove, isDefault, hasPermission, }: EmailTemplateCardProps): JSX.Element;
|
|
12
|
+
export declare function EmailTemplateCard({ name, href, subject, onRemove, isDefault, hasPermission, type, }: EmailTemplateCardProps): JSX.Element;
|
|
11
13
|
//# sourceMappingURL=EmailTemplateCard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmailTemplateCard.d.ts","sourceRoot":"","sources":["../../../../src/notification/email-template/card/EmailTemplateCard.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAC;
|
|
1
|
+
{"version":3,"file":"EmailTemplateCard.d.ts","sourceRoot":"","sources":["../../../../src/notification/email-template/card/EmailTemplateCard.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAC;AAEvF,OAAO,EAAE,gBAAgB,EAAE,MAAM,wEAAwE,CAAC;AAI1G,MAAM,WAAW,sBAAuB,SAAQ,iBAAiB;IAC/D,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,IAAI,EAAE,gBAAgB,CAAC;CACxB;AAED,wBAAgB,iBAAiB,CAAC,EAChC,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,SAAiB,EACjB,aAAoB,EACpB,IAAI,GACL,EAAE,sBAAsB,eA2CxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),a=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,r=require("react-router-dom"),n=require("react-i18next"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),a=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,r=require("react-router-dom"),n=require("react-i18next"),l=require("../../../static/Icon.js");require("../../../static/index.js");var o=require("../../../modals/confirmation/ConfirmModal.js");require("../../../modals/dialog/Dialog.js"),require("../../../modals/dialog/DialogContext.js"),exports.EmailTemplateCard=function(e){var t=e.name,i=e.href,s=e.subject,c=e.onRemove,m=e.isDefault,u=void 0!==m&&m,d=e.hasPermission,p=void 0===d||d,f=e.type,E=n.useTranslation(["Design"]).t;return a.createElement(a.Fragment,null,a.createElement("div",{className:"snippet-template-card"},a.createElement("div",{className:"snippet-template-card-header"},a.createElement(r.Link,{to:i},t),p&&Boolean(c)&&a.createElement(o.ConfirmModal,{type:o.ConfirmModalType.remove,content:E("areUSureYouWantToDelete",{name:t,type:E("emailTemplate").toLowerCase()})},(function(e){return a.createElement("button",{type:"button",className:"snippet-template-card-button",onClick:function(t){t.stopPropagation(),e(c)}},a.createElement(l.default,{type:"trash-alt"}))}))),a.createElement("div",{className:"mt-".concat(u?"3":"4")},Boolean(u)&&a.createElement("p",{className:"mb-1"},E("Design:default")),a.createElement("div",{className:"d-flex flex-column"},a.createElement("span",null,s),a.createElement("p",null,E("Design:type"),": ",E("Design:".concat(f)))))))};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { TemplateOption } from "@licklist/core/dist/DataMapper/Notification/TemplateOptionDataMapper";
|
|
3
3
|
import { Attachment } from "@licklist/core/dist/DataMapper/Notification/AttachmentDataMapper";
|
|
4
|
+
import { NotificationType } from "@licklist/core/dist/DataMapper/Notification/NotificationTypeDataMapper";
|
|
4
5
|
export interface EmailTemplateControlProps {
|
|
5
6
|
options: TemplateOption[];
|
|
6
7
|
setIsLoading: (isLoading: boolean) => void;
|
|
7
8
|
meta: string;
|
|
8
9
|
defaultAttachments?: Attachment[];
|
|
10
|
+
notificationTypes?: NotificationType[];
|
|
11
|
+
getDefaultTemplateMetaByType?: (type?: NotificationType | null) => string;
|
|
9
12
|
}
|
|
10
13
|
export declare const EmailTemplateControl: React.ForwardRefExoticComponent<EmailTemplateControlProps & React.RefAttributes<unknown>>;
|
|
11
14
|
//# sourceMappingURL=EmailTemplateControl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmailTemplateControl.d.ts","sourceRoot":"","sources":["../../../../src/notification/email-template/control/EmailTemplateControl.tsx"],"names":[],"mappings":"
|
|
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,2FA+XhC,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"),c=require("@licklist/plugins/dist/hooks/Media/useAttachments"),m=require("@licklist/plugins/dist/hooks/Media/usePermanentImage"),d=require("@licklist/core/dist/DataMapper/Media/UploadPermanentImageDataMapper"),p=n.forwardRef((function(e,p){var f,g,E=e.setIsLoading,
|
|
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"),c=require("@licklist/plugins/dist/hooks/Media/useAttachments"),m=require("@licklist/plugins/dist/hooks/Media/usePermanentImage"),d=require("@licklist/core/dist/DataMapper/Media/UploadPermanentImageDataMapper"),p=n.forwardRef((function(e,p){var f,g,E,v=e.setIsLoading,h=e.meta,_=e.options,b=void 0===_?[]:_,F=e.defaultAttachments,y=void 0===F?[]:F,N=e.notificationTypes,D=void 0===N?[]:N,C=e.getDefaultTemplateMetaByType,I=l.useTranslation(["Design"]).t,P=t.__read(a.useState(null),2),T=P[0],k=P[1],M=i.useFormContext(),q=M.register,R=M.setValue,x=M.formState.errors,O=M.getValues,A=M.watch,j=M.reset,w=t.__read(a.useState(!1),2),G=w[0],V=w[1],S=c.useAttachments(T),L=S.attachments,U=S.handleAttachmentRemove,Y=S.handleAttachmentUploading,B=S.isLoading,J=m.usePermanentImage(),H=J.permanentImages,z=J.handlePermanentImageRemove,K=J.handlePermanentImageUploading,Q=A("type"),W=A("id");a.useEffect((function(){var e;if(!W&&C&&Q){var a=O(),n=C(Q);j(t.__assign(t.__assign({},a),{meta:n})),null===(e=p.current)||void 0===e||e.loadDesign(JSON.parse(n))}}),[Q]),a.useEffect((function(){R("attachmentMetadata",L)}),[L,R]),a.useEffect((function(){H.length&&R("imagesMetadata",H)}),[H,R]),a.useEffect((function(){if(y&&y.length>0){var e=O("attachments");k(e)}else k([])}),[y]),a.useEffect((function(){b.length&&(b.find((function(e){return e.type===u.OPTION_TYPE.files_selector})).selectedValue&&V(!0))}),[b]);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,I("type")),n.createElement(r.Form.Control,t.__assign({as:"select"},q("type",{required:I("Validation:fieldRequired",{attribute:I("type")})}),{name:"type",required:!0,isInvalid:Boolean(x.type),placeholder:I("Design:type"),disabled:!!W}),n.createElement("option",{value:""},I("Design:choose")),D.map((function(e){return n.createElement("option",{key:e,value:e},I("Design:".concat(e)))}))),n.createElement(r.Form.Control.Feedback,{type:"invalid"},null===(f=x.type)||void 0===f?void 0:f.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,I("templateName")),n.createElement(r.Form.Control,t.__assign({},q("name",{maxLength:255,required:I("Validation:fieldRequired",{attribute:I("name")})}),{name:"name",required:!0,isInvalid:Boolean(x.name),placeholder:I("Design:templateName")})),n.createElement(r.Form.Control.Feedback,{type:"invalid"},null===(g=x.name)||void 0===g?void 0:g.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,I("subject")),n.createElement(r.Form.Control,t.__assign({},q("subject",{maxLength:255,required:I("Validation:fieldRequired",{attribute:I("subject")})}),{name:"subject",required:!0,isInvalid:Boolean(x.subject),placeholder:I("Design:subject")})),n.createElement(r.Form.Control.Feedback,{type:"invalid"},null===(E=x.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({},q("isActive"),{name:"isActive",label:I("Design:active"),id:"formGroupIsActive",custom:!0})),n.createElement(r.Form.Check,t.__assign({},q("isDefault"),{name:"isDefault",label:I("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,I("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){R("body",e.html),R("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=O("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){R("body",e.html),R("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:I("Design:attachments"),onFileRemove:function(e,t){return U(String(e),t)},isLoading:B})),b.length>0&&n.createElement(r.Row,null,n.createElement(r.Form.Group,{as:r.Col},b.map((function(e){if(e.type===u.OPTION_TYPE.checkbox)return n.createElement(r.Form.Check,t.__assign({},q("templateOptionValues.".concat(null==e?void 0:e.id,".value")),{type:"checkbox",label:I("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:G,name:"IsIncludePDF",onChange:function(){V(!G),R("templateOptionValues.".concat(e.id,".value"),"")},label:I("Design:includePDF"),id:"formGroupIsIncludePdf",custom:!0}),G&&n.createElement(n.Fragment,null,n.createElement(r.Form.Label,{className:"mt-4"},I("Design:includeFile")),n.createElement(r.Form.Control,t.__assign({as:"select"},q("templateOptionValues.".concat(e.id,".value")),{defaultValue:e.selectedValue||""}),n.createElement("option",{value:""},I("Design:choose")),i.map((function(e,t){return n.createElement("option",{value:String(e),key:String(e)},l[t])})))))}return null})))))}));p.displayName="EmailTemplateControl",exports.EmailTemplateControl=p;
|
|
@@ -9,7 +9,9 @@ import { Attachment } from "@licklist/core/dist/DataMapper/Notification/Attachme
|
|
|
9
9
|
import { ServerError } from "@licklist/plugins/dist/hooks/Api/useHttpQuery";
|
|
10
10
|
import { AttachmentsWithHash } from "@licklist/plugins/dist/hooks/Media/useAttachments";
|
|
11
11
|
import { UploadPermanentImage } from "@licklist/core/dist/DataMapper/Media/UploadPermanentImageDataMapper";
|
|
12
|
+
import { NotificationType } from "@licklist/core/dist/DataMapper/Notification/NotificationTypeDataMapper";
|
|
12
13
|
export interface EmailTemplateValues extends FormValues {
|
|
14
|
+
id?: number | string;
|
|
13
15
|
name: string;
|
|
14
16
|
subject: string;
|
|
15
17
|
isActive: boolean;
|
|
@@ -20,6 +22,7 @@ export interface EmailTemplateValues extends FormValues {
|
|
|
20
22
|
attachments?: Attachment[];
|
|
21
23
|
templateOptionValues?: TemplateOptionValue[];
|
|
22
24
|
imagesMetadata?: UploadPermanentImage[];
|
|
25
|
+
type?: NotificationType;
|
|
23
26
|
}
|
|
24
27
|
export interface EmailTemplateProps extends HasPermissionProp {
|
|
25
28
|
isLoading: boolean;
|
|
@@ -29,6 +32,8 @@ export interface EmailTemplateProps extends HasPermissionProp {
|
|
|
29
32
|
placeholders?: NotificationPlaceholder[];
|
|
30
33
|
options?: TemplateOption[];
|
|
31
34
|
serverErrors?: ServerError;
|
|
35
|
+
notificationTypes?: NotificationType[];
|
|
36
|
+
getDefaultTemplateMetaByType?: (type?: NotificationType | null) => string;
|
|
32
37
|
}
|
|
33
|
-
export declare function EmailTemplateForm({ defaultValues, onSubmitSave, onSubmitSaveAndSend, hasPermission, placeholders, options, serverErrors, }: EmailTemplateProps): JSX.Element;
|
|
38
|
+
export declare function EmailTemplateForm({ defaultValues, onSubmitSave, onSubmitSaveAndSend, hasPermission, placeholders, options, serverErrors, notificationTypes, getDefaultTemplateMetaByType, }: EmailTemplateProps): JSX.Element;
|
|
34
39
|
//# sourceMappingURL=EmailTemplateForm.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmailTemplateForm.d.ts","sourceRoot":"","sources":["../../../../src/notification/email-template/form/EmailTemplateForm.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,8DAA8D,CAAC;AAI1F,OAAO,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAC;AACvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,+EAA+E,CAAC;AACxH,OAAO,EAAE,cAAc,EAAE,MAAM,sEAAsE,CAAC;AACtG,OAAO,EAAE,mBAAmB,EAAE,MAAM,2EAA2E,CAAC;AAChH,OAAO,EAAE,kBAAkB,EAAE,MAAM,0EAA0E,CAAC;AAC9G,OAAO,EAAE,UAAU,EAAE,MAAM,kEAAkE,CAAC;AAC9F,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAE5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AACxF,OAAO,EAAE,oBAAoB,EAAE,MAAM,qEAAqE,CAAC;
|
|
1
|
+
{"version":3,"file":"EmailTemplateForm.d.ts","sourceRoot":"","sources":["../../../../src/notification/email-template/form/EmailTemplateForm.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,8DAA8D,CAAC;AAI1F,OAAO,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAC;AACvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,+EAA+E,CAAC;AACxH,OAAO,EAAE,cAAc,EAAE,MAAM,sEAAsE,CAAC;AACtG,OAAO,EAAE,mBAAmB,EAAE,MAAM,2EAA2E,CAAC;AAChH,OAAO,EAAE,kBAAkB,EAAE,MAAM,0EAA0E,CAAC;AAC9G,OAAO,EAAE,UAAU,EAAE,MAAM,kEAAkE,CAAC;AAC9F,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAE5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AACxF,OAAO,EAAE,oBAAoB,EAAE,MAAM,qEAAqE,CAAC;AAC3G,OAAO,EAAE,gBAAgB,EAAE,MAAM,wEAAwE,CAAC;AAK1G,MAAM,WAAW,mBAAoB,SAAQ,UAAU;IACrD,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kBAAkB,CAAC,EAAE,kBAAkB,EAAE,GAAG,mBAAmB,EAAE,CAAC;IAClE,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;IAC3B,oBAAoB,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAC7C,cAAc,CAAC,EAAE,oBAAoB,EAAE,CAAC;IACxC,IAAI,CAAC,EAAE,gBAAgB,CAAC;CACzB;AAED,MAAM,WAAW,kBAAmB,SAAQ,iBAAiB;IAC3D,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACpD,mBAAmB,CAAC,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC5D,aAAa,CAAC,EAAE,mBAAmB,CAAC;IACpC,YAAY,CAAC,EAAE,uBAAuB,EAAE,CAAC;IACzC,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;IAC3B,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,iBAAiB,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACvC,4BAA4B,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,gBAAgB,GAAG,IAAI,KAAK,MAAM,CAAC;CAC3E;AAED,wBAAgB,iBAAiB,CAAC,EAChC,aAAa,EACb,YAAY,EACZ,mBAAmB,EACnB,aAAoB,EACpB,YAAiB,EACjB,OAAY,EACZ,YAAY,EACZ,iBAAsB,EACtB,4BAA4B,GAC7B,EAAE,kBAAkB,eA2DpB"}
|
|
@@ -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"),r=require("react"),o=e(r),a=require("../../../static/loader/BlockLoader.js"),l=require("react-i18next"),n=require("react-bootstrap"),i=require("react-hook-form"),s=e(require("@licklist/plugins/dist/services/Form/FormErrorService"));require("../../../static/index.js");var m=require("../control/EmailTemplateControl.js"),
|
|
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"),r=require("react"),o=e(r),a=require("../../../static/loader/BlockLoader.js"),l=require("react-i18next"),n=require("react-bootstrap"),i=require("react-hook-form"),s=e(require("@licklist/plugins/dist/services/Form/FormErrorService"));require("../../../static/index.js");var m=require("../control/EmailTemplateControl.js"),u=require("../../components/NotificationPlaceholders.js");exports.EmailTemplateForm=function(e){var c=e.defaultValues,d=e.onSubmitSave,p=e.onSubmitSaveAndSend,f=e.hasPermission,v=void 0===f||f,E=e.placeholders,b=void 0===E?[]:E,h=e.options,y=void 0===h?[]:h,S=e.serverErrors,q=e.notificationTypes,T=void 0===q?[]:q,k=e.getDefaultTemplateMetaByType,g=l.useTranslation("Design").t,B=t.__read(r.useState(!1),2),j=B[0],F=B[1],_=r.useRef(null),C=i.useForm({mode:"onChange",defaultValues:c}),N=C.setError;return r.useEffect((function(){s.handleServerErrors(S,N)}),[S,N]),o.createElement(i.FormProvider,t.__assign({},C),j&&o.createElement(a.BlockLoader,null),o.createElement(n.Form,{onSubmit:C.handleSubmit(d),noValidate:!0,style:{display:j?"none":"block"}},o.createElement(m.EmailTemplateControl,{ref:_,setIsLoading:F,meta:(null==c?void 0:c.meta)||null,defaultAttachments:(null==c?void 0:c.attachments)||[],options:y,notificationTypes:T,getDefaultTemplateMetaByType:k}),o.createElement(u.NotificationPlaceholders,{placeholders:b}),v&&!p&&o.createElement(n.Button,{className:"mt-5 d-no dne d-md-block",type:"submit"},g("save")),v&&p&&o.createElement(n.Col,{as:n.Row},o.createElement(n.Button,{className:"mt-5 d-no dne d-md-block",type:"submit"},g("save")),o.createElement(n.Button,{className:"mt-5 ml-5 d-no dne d-md-block",onClick:C.handleSubmit(p)},g("saveAndSendEmail")))))};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { HasPermissionProp } from "@licklist/plugins/dist/types/permission/Permission";
|
|
3
|
+
import { NotificationType } from "@licklist/core/dist/DataMapper/Notification/NotificationTypeDataMapper";
|
|
3
4
|
export interface SmsTemplateCardProps extends HasPermissionProp {
|
|
4
5
|
name: string;
|
|
5
6
|
href: string;
|
|
6
7
|
onRemove: () => void;
|
|
7
8
|
isDefault: boolean;
|
|
9
|
+
type: NotificationType;
|
|
8
10
|
}
|
|
9
|
-
export declare function SmsTemplateCard({ name, href, onRemove, hasPermission, isDefault, }: SmsTemplateCardProps): JSX.Element;
|
|
11
|
+
export declare function SmsTemplateCard({ name, href, onRemove, hasPermission, isDefault, type, }: SmsTemplateCardProps): JSX.Element;
|
|
10
12
|
//# sourceMappingURL=SmsTemplateCard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SmsTemplateCard.d.ts","sourceRoot":"","sources":["../../../../src/notification/sms-template/card/SmsTemplateCard.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"SmsTemplateCard.d.ts","sourceRoot":"","sources":["../../../../src/notification/sms-template/card/SmsTemplateCard.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAC;AACvF,OAAO,EAAE,gBAAgB,EAAE,MAAM,wEAAwE,CAAC;AAI1G,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAC7D,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,gBAAgB,CAAC;CACxB;AAED,wBAAgB,eAAe,CAAC,EAC9B,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,aAAoB,EACpB,SAAiB,EACjB,IAAI,GACL,EAAE,oBAAoB,eAsCtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),a=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,r=require("react-router-dom"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),a=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,r=require("react-router-dom"),n=require("react-i18next"),o=require("../../../static/Icon.js");require("../../../static/index.js");var i=require("../../../modals/confirmation/ConfirmModal.js");require("../../../modals/dialog/Dialog.js"),require("../../../modals/dialog/DialogContext.js"),exports.SmsTemplateCard=function(e){var t=e.name,l=e.href,s=e.onRemove,m=e.hasPermission,c=void 0===m||m,u=e.isDefault,d=void 0!==u&&u,p=e.type,f=n.useTranslation(["Design"]).t;return a.createElement("div",{className:"snippet-template-card"},a.createElement("div",{className:"snippet-template-card-header"},a.createElement(r.Link,{to:l},t),c&&Boolean(s)&&a.createElement(i.ConfirmModal,{type:i.ConfirmModalType.remove,content:f("areUSureYouWantToDelete",{name:t,type:f("smsTemplate").toLowerCase()})},(function(e){return a.createElement("button",{type:"button",className:"snippet-template-card-button",onClick:function(t){t.stopPropagation(),e(s)}},a.createElement(o.default,{type:"trash-alt"}))}))),a.createElement("div",{className:"mt-2"},Boolean(d)&&a.createElement("p",{className:"mb-1"},f("Design:default")),a.createElement("p",null,f("Design:type"),": ",f("Design:".concat(p)))))};
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
2
|
+
import { NotificationType } from "@licklist/core/dist/DataMapper/Notification/NotificationTypeDataMapper";
|
|
3
|
+
type SmsTemplateControlProps = {
|
|
4
|
+
notificationTypes: NotificationType[];
|
|
5
|
+
};
|
|
6
|
+
export declare const SmsTemplateControl: ({ notificationTypes, }: SmsTemplateControlProps) => JSX.Element;
|
|
7
|
+
export {};
|
|
3
8
|
//# sourceMappingURL=SmsTemplateControl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SmsTemplateControl.d.ts","sourceRoot":"","sources":["../../../../src/notification/sms-template/control/SmsTemplateControl.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"SmsTemplateControl.d.ts","sourceRoot":"","sources":["../../../../src/notification/sms-template/control/SmsTemplateControl.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wEAAwE,CAAC;AAK1G,KAAK,uBAAuB,GAAG;IAC7B,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;CACvC,CAAC;AAEF,eAAO,MAAM,kBAAkB,2BAE5B,uBAAuB,gBAiJzB,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"),r=e(require("react")),o=require("react-i18next"),
|
|
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"),r=e(require("react")),o=require("react-i18next"),l=require("react-bootstrap"),a=require("react-hook-form"),n=e(require("@licklist/plugins/dist/services/Form/HookFormService")),i=300;exports.SmsTemplateControl=function(e){var s,m,d=e.notificationTypes,u=void 0===d?[]:d,c=o.useTranslation(["Design"]).t,p=a.useFormContext(),g=p.register,y=p.watch,b=p.formState.errors,E=p.setError,f=p.clearErrors,v=y("body");return r.createElement(r.Fragment,null,r.createElement(l.Row,null,r.createElement(l.Form.Group,{as:l.Col,controlId:"type",xs:!0,sm:12,md:8,lg:10,xl:12},r.createElement(l.Form.Label,null,c("type")),r.createElement(l.Form.Control,t.__assign({as:"select"},g("type",{required:c("Validation:fieldRequired",{attribute:c("type")})}),{name:"type",required:!0,isInvalid:Boolean(b.type),placeholder:c("Design:type")}),r.createElement("option",{value:""},c("Design:choose")),u.map((function(e){return r.createElement("option",{key:e,value:e},c("Design:".concat(e)))}))),r.createElement(l.Form.Control.Feedback,{type:"invalid"},null===(s=b.type)||void 0===s?void 0:s.message))),r.createElement(l.Row,null,r.createElement(l.Form.Group,{as:l.Col,controlId:"formGroupName",xs:!0,sm:12,md:8,lg:10,xl:12},r.createElement(l.Form.Label,null,c("templateName")),r.createElement(l.Form.Control,t.__assign({},g("name",{max:255,required:c("Validation:fieldRequired",{attribute:c("name")})}),{placeholder:c("Design:templateName"),isInvalid:Boolean(null==b?void 0:b.name)})),r.createElement(l.Form.Control.Feedback,{type:"invalid"},null===(m=b.name)||void 0===m?void 0:m.message))),r.createElement(l.Row,null,r.createElement(l.Form.Group,{as:l.Col,xs:!0,sm:12,md:8,lg:10,xl:12,controlId:"formGroupBdoy"},r.createElement(l.Form.Label,null,c("Design:smsBody")),r.createElement(l.Form.Control,t.__assign({isInvalid:Boolean(b.body)},g("body",{required:!0,maxLength:i,validate:function(){return!!v.length&&(v.length>i?(E("body",{type:"maxLength",message:c("Validation:fieldMaxLength",{attribute:c("Design:smsBody"),max:i})}),!1):(f("body"),!0))}}),{placeholder:c("Design:smsBody")})),(null==v?void 0:v.length)?!n.hasError(b.body,"maxLength")&&r.createElement("span",{className:"sms-template-body-left-symbols"},c("Design:symbolsLeft")," ",i-(null==v?void 0:v.length)," (",c("Design:max"),": ",i,")"):null,r.createElement(l.Form.Control.Feedback,{type:"invalid"},n.hasError(b.body,"required")&&c("Validation:fieldRequired",{attribute:c("Design:smsBody")}),n.hasError(b.body,"maxLength")&&c("Validation:fieldMaxLength",{attribute:c("Design:smsBody"),max:i})))),r.createElement(l.Row,null,r.createElement(l.Form.Group,{as:l.Col},r.createElement(l.Form.Check,t.__assign({},g("isActive"),{name:"isActive",label:c("Design:active"),id:"formGroupIsActive",custom:!0})),r.createElement(l.Form.Check,t.__assign({},g("isDefault"),{name:"isDefault",label:c("Design:defaultTemplateForTheType"),id:"formGroupIsDefault",custom:!0})))))};
|
|
@@ -3,11 +3,13 @@ import { FormValues } from "@licklist/plugins/dist/types/services/Form/hook-form
|
|
|
3
3
|
import { HasPermissionProp } from "@licklist/plugins/dist/types/permission/Permission";
|
|
4
4
|
import { NotificationPlaceholder } from "@licklist/core/dist/DataMapper/Notification/NotificationPlaceholderDataMapper";
|
|
5
5
|
import { ServerError } from "@licklist/plugins/dist/hooks/Api/useHttpQuery";
|
|
6
|
+
import { NotificationType } from "@licklist/core/dist/DataMapper/Notification/NotificationTypeDataMapper";
|
|
6
7
|
export interface SmsTemplateValues extends FormValues {
|
|
7
8
|
name: string;
|
|
8
9
|
isActive: boolean;
|
|
9
10
|
isDefault: boolean;
|
|
10
11
|
body: string;
|
|
12
|
+
type?: NotificationType;
|
|
11
13
|
}
|
|
12
14
|
export interface SmsTemplateProps extends HasPermissionProp {
|
|
13
15
|
isLoading: boolean;
|
|
@@ -15,6 +17,7 @@ export interface SmsTemplateProps extends HasPermissionProp {
|
|
|
15
17
|
defaultValues?: SmsTemplateValues;
|
|
16
18
|
placeholders?: NotificationPlaceholder[];
|
|
17
19
|
serverErrors?: ServerError;
|
|
20
|
+
notificationTypes?: NotificationType[];
|
|
18
21
|
}
|
|
19
|
-
export declare function SmsTemplateForm({ defaultValues, onSubmit, hasPermission, placeholders, serverErrors, }: SmsTemplateProps): JSX.Element;
|
|
22
|
+
export declare function SmsTemplateForm({ defaultValues, onSubmit, hasPermission, placeholders, serverErrors, notificationTypes, }: SmsTemplateProps): JSX.Element;
|
|
20
23
|
//# sourceMappingURL=SmsTemplateForm.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SmsTemplateForm.d.ts","sourceRoot":"","sources":["../../../../src/notification/sms-template/form/SmsTemplateForm.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,8DAA8D,CAAC;AAI1F,OAAO,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAC;AACvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,+EAA+E,CAAC;AACxH,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;
|
|
1
|
+
{"version":3,"file":"SmsTemplateForm.d.ts","sourceRoot":"","sources":["../../../../src/notification/sms-template/form/SmsTemplateForm.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,8DAA8D,CAAC;AAI1F,OAAO,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAC;AACvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,+EAA+E,CAAC;AACxH,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAG5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,wEAAwE,CAAC;AAI1G,MAAM,WAAW,iBAAkB,SAAQ,UAAU;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,gBAAgB,CAAC;CACzB;AAED,MAAM,WAAW,gBAAiB,SAAQ,iBAAiB;IACzD,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC9C,aAAa,CAAC,EAAE,iBAAiB,CAAC;IAClC,YAAY,CAAC,EAAE,uBAAuB,EAAE,CAAC;IACzC,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,iBAAiB,CAAC,EAAE,gBAAgB,EAAE,CAAC;CACxC;AAED,wBAAgB,eAAe,CAAC,EAC9B,aAAa,EACb,QAAQ,EACR,aAAoB,EACpB,YAAiB,EACjB,YAAY,EACZ,iBAAsB,GACvB,EAAE,gBAAgB,eAyBlB"}
|
|
@@ -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 r=require("tslib"),t=require("react"),o=e(t),
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var r=require("tslib"),t=require("react"),o=e(t),i=require("react-i18next"),s=require("react-bootstrap"),n=require("react-hook-form"),a=e(require("@licklist/plugins/dist/services/Form/FormErrorService")),l=require("../../components/NotificationPlaceholders.js"),c=require("../control/SmsTemplateControl.js");exports.SmsTemplateForm=function(e){var u=e.defaultValues,m=e.onSubmit,d=e.hasPermission,f=void 0===d||d,p=e.placeholders,v=void 0===p?[]:p,E=e.serverErrors,b=e.notificationTypes,h=void 0===b?[]:b,q=i.useTranslation("Design").t,S=n.useForm({defaultValues:u}),F=S.setError;return t.useEffect((function(){a.handleServerErrors(E,F)}),[E,F]),o.createElement(n.FormProvider,r.__assign({},S),o.createElement(s.Form,{onSubmit:S.handleSubmit(m)},o.createElement(c.SmsTemplateControl,{notificationTypes:h}),o.createElement(l.NotificationPlaceholders,{placeholders:v}),f&&o.createElement(s.Button,{className:"mt-5 d-no dne d-md-block",type:"submit"},q("save"))))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectMenu.d.ts","sourceRoot":"","sources":["../../../../src/sales/manual-booking/select-menu/SelectMenu.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,qDAAqD,CAAC;AAItF,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,eAAe,EAAE,CAAC;IAC1B,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,IAAI,CAAC;CAChD,CAAC;AAEF,eAAO,MAAM,UAAU,wCAIpB,eAAe,
|
|
1
|
+
{"version":3,"file":"SelectMenu.d.ts","sourceRoot":"","sources":["../../../../src/sales/manual-booking/select-menu/SelectMenu.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,qDAAqD,CAAC;AAItF,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,eAAe,EAAE,CAAC;IAC1B,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,IAAI,CAAC;CAChD,CAAC;AAEF,eAAO,MAAM,UAAU,wCAIpB,eAAe,gBA4CjB,CAAC"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { Link } from "react-router-dom";
|
|
3
3
|
import { HasPermissionProp } from "@licklist/plugins/dist/types/permission/Permission";
|
|
4
4
|
import { useTranslation } from "react-i18next";
|
|
5
|
-
|
|
5
|
+
import { NotificationType } from "@licklist/core/dist/DataMapper/Notification/NotificationTypeDataMapper";
|
|
6
6
|
import { ConfirmModal, ConfirmModalType } from "../../../modals";
|
|
7
7
|
import { Icon } from "../../../static";
|
|
8
8
|
|
|
@@ -12,6 +12,7 @@ export interface EmailTemplateCardProps extends HasPermissionProp {
|
|
|
12
12
|
href: string;
|
|
13
13
|
isDefault: boolean;
|
|
14
14
|
onRemove: () => void;
|
|
15
|
+
type: NotificationType;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
export function EmailTemplateCard({
|
|
@@ -21,6 +22,7 @@ export function EmailTemplateCard({
|
|
|
21
22
|
onRemove,
|
|
22
23
|
isDefault = false,
|
|
23
24
|
hasPermission = true,
|
|
25
|
+
type,
|
|
24
26
|
}: EmailTemplateCardProps) {
|
|
25
27
|
const { t } = useTranslation(["Design"]);
|
|
26
28
|
|
|
@@ -54,7 +56,12 @@ export function EmailTemplateCard({
|
|
|
54
56
|
</div>
|
|
55
57
|
<div className={`mt-${isDefault ? "3" : "4"}`}>
|
|
56
58
|
{Boolean(isDefault) && <p className="mb-1">{t("Design:default")}</p>}
|
|
57
|
-
<
|
|
59
|
+
<div className="d-flex flex-column">
|
|
60
|
+
<span>{subject}</span>
|
|
61
|
+
<p>
|
|
62
|
+
{t(`Design:type`)}: {t(`Design:${type}`)}
|
|
63
|
+
</p>
|
|
64
|
+
</div>
|
|
58
65
|
</div>
|
|
59
66
|
</div>
|
|
60
67
|
</>
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable react/display-name */
|
|
2
1
|
import React, { useState, useEffect } from "react";
|
|
3
2
|
import { Col, Row, Form } from "react-bootstrap";
|
|
4
3
|
import { useFormContext } from "react-hook-form";
|
|
@@ -16,6 +15,7 @@ import {
|
|
|
16
15
|
PERMANENT_IMAGE_TYPE_TEMP,
|
|
17
16
|
} from "@licklist/core/dist/DataMapper/Media/UploadPermanentImageDataMapper";
|
|
18
17
|
|
|
18
|
+
import { NotificationType } from "@licklist/core/dist/DataMapper/Notification/NotificationTypeDataMapper";
|
|
19
19
|
import { FileUpload } from "../../../file-upload";
|
|
20
20
|
import { EmailTemplateValues } from "../form";
|
|
21
21
|
|
|
@@ -26,6 +26,8 @@ export interface EmailTemplateControlProps {
|
|
|
26
26
|
setIsLoading: (isLoading: boolean) => void;
|
|
27
27
|
meta: string;
|
|
28
28
|
defaultAttachments?: Attachment[];
|
|
29
|
+
notificationTypes?: NotificationType[];
|
|
30
|
+
getDefaultTemplateMetaByType?: (type?: NotificationType | null) => string;
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
export const EmailTemplateControl = React.forwardRef(
|
|
@@ -35,6 +37,8 @@ export const EmailTemplateControl = React.forwardRef(
|
|
|
35
37
|
meta,
|
|
36
38
|
options = [],
|
|
37
39
|
defaultAttachments = [],
|
|
40
|
+
notificationTypes = [],
|
|
41
|
+
getDefaultTemplateMetaByType,
|
|
38
42
|
}: EmailTemplateControlProps,
|
|
39
43
|
ref: any
|
|
40
44
|
) => {
|
|
@@ -48,6 +52,8 @@ export const EmailTemplateControl = React.forwardRef(
|
|
|
48
52
|
setValue,
|
|
49
53
|
formState: { errors },
|
|
50
54
|
getValues,
|
|
55
|
+
watch,
|
|
56
|
+
reset,
|
|
51
57
|
} = useFormContext<EmailTemplateValues>();
|
|
52
58
|
const [isIncludePDF, setIsIncludePDF] = useState(false);
|
|
53
59
|
|
|
@@ -64,6 +70,22 @@ export const EmailTemplateControl = React.forwardRef(
|
|
|
64
70
|
handlePermanentImageUploading,
|
|
65
71
|
} = usePermanentImage();
|
|
66
72
|
|
|
73
|
+
const type = watch("type");
|
|
74
|
+
const id = watch("id");
|
|
75
|
+
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (id || !getDefaultTemplateMetaByType || !type) return;
|
|
78
|
+
|
|
79
|
+
const formValues = getValues();
|
|
80
|
+
|
|
81
|
+
const nextMeta = getDefaultTemplateMetaByType(type);
|
|
82
|
+
|
|
83
|
+
reset({ ...formValues, meta: nextMeta });
|
|
84
|
+
|
|
85
|
+
ref.current?.loadDesign(JSON.parse(nextMeta));
|
|
86
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
87
|
+
}, [type]);
|
|
88
|
+
|
|
67
89
|
useEffect(() => {
|
|
68
90
|
setValue("attachmentMetadata", attachments);
|
|
69
91
|
}, [attachments, setValue]);
|
|
@@ -175,6 +197,42 @@ export const EmailTemplateControl = React.forwardRef(
|
|
|
175
197
|
|
|
176
198
|
return (
|
|
177
199
|
<>
|
|
200
|
+
<Row>
|
|
201
|
+
<Form.Group
|
|
202
|
+
as={Col}
|
|
203
|
+
controlId="type"
|
|
204
|
+
xs
|
|
205
|
+
sm={12}
|
|
206
|
+
md={8}
|
|
207
|
+
lg={10}
|
|
208
|
+
xl={12}
|
|
209
|
+
>
|
|
210
|
+
<Form.Label>{t("type")}</Form.Label>
|
|
211
|
+
<Form.Control
|
|
212
|
+
as="select"
|
|
213
|
+
{...register("type", {
|
|
214
|
+
required: t("Validation:fieldRequired", {
|
|
215
|
+
attribute: t("type"),
|
|
216
|
+
}) as string,
|
|
217
|
+
})}
|
|
218
|
+
name="type"
|
|
219
|
+
required
|
|
220
|
+
isInvalid={Boolean(errors.type)}
|
|
221
|
+
placeholder={t("Design:type")}
|
|
222
|
+
disabled={!!id}
|
|
223
|
+
>
|
|
224
|
+
<option value="">{t("Design:choose")}</option>
|
|
225
|
+
{notificationTypes.map((key) => (
|
|
226
|
+
<option key={key} value={key}>
|
|
227
|
+
{t(`Design:${key}`)}
|
|
228
|
+
</option>
|
|
229
|
+
))}
|
|
230
|
+
</Form.Control>
|
|
231
|
+
<Form.Control.Feedback type="invalid">
|
|
232
|
+
{errors.type?.message}
|
|
233
|
+
</Form.Control.Feedback>
|
|
234
|
+
</Form.Group>
|
|
235
|
+
</Row>
|
|
178
236
|
<Row>
|
|
179
237
|
<Form.Group
|
|
180
238
|
as={Col}
|
|
@@ -356,3 +414,5 @@ export const EmailTemplateControl = React.forwardRef(
|
|
|
356
414
|
);
|
|
357
415
|
}
|
|
358
416
|
);
|
|
417
|
+
|
|
418
|
+
EmailTemplateControl.displayName = "EmailTemplateControl";
|
|
@@ -219,6 +219,13 @@ Default.args = {
|
|
|
219
219
|
attachableType: "mail",
|
|
220
220
|
},
|
|
221
221
|
],
|
|
222
|
+
type: "confirmation",
|
|
223
|
+
notificationTypes: [
|
|
224
|
+
"confirmation",
|
|
225
|
+
"paymentLink",
|
|
226
|
+
"afterBooking",
|
|
227
|
+
"preliminaryMail",
|
|
228
|
+
],
|
|
222
229
|
},
|
|
223
230
|
};
|
|
224
231
|
|
|
@@ -248,10 +255,24 @@ ServerErrors.args = {
|
|
|
248
255
|
body: "",
|
|
249
256
|
meta: JSON.stringify(DefaultEmailTemplate),
|
|
250
257
|
},
|
|
258
|
+
type: "confirmation",
|
|
259
|
+
notificationTypes: [
|
|
260
|
+
"confirmation",
|
|
261
|
+
"paymentLink",
|
|
262
|
+
"afterBooking",
|
|
263
|
+
"preliminaryMail",
|
|
264
|
+
],
|
|
251
265
|
};
|
|
252
266
|
|
|
253
267
|
Empty.args = {
|
|
254
268
|
onSubmit: (data) => console.log(data),
|
|
255
269
|
isLoading: true,
|
|
256
270
|
placeholders: [],
|
|
271
|
+
type: "confirmation",
|
|
272
|
+
notificationTypes: [
|
|
273
|
+
"confirmation",
|
|
274
|
+
"paymentLink",
|
|
275
|
+
"afterBooking",
|
|
276
|
+
"preliminaryMail",
|
|
277
|
+
],
|
|
257
278
|
};
|
|
@@ -13,12 +13,13 @@ import { ServerError } from "@licklist/plugins/dist/hooks/Api/useHttpQuery";
|
|
|
13
13
|
import FormErrorService from "@licklist/plugins/dist/services/Form/FormErrorService";
|
|
14
14
|
import { AttachmentsWithHash } from "@licklist/plugins/dist/hooks/Media/useAttachments";
|
|
15
15
|
import { UploadPermanentImage } from "@licklist/core/dist/DataMapper/Media/UploadPermanentImageDataMapper";
|
|
16
|
-
|
|
16
|
+
import { NotificationType } from "@licklist/core/dist/DataMapper/Notification/NotificationTypeDataMapper";
|
|
17
17
|
import { NotificationPlaceholders } from "../../components/NotificationPlaceholders";
|
|
18
18
|
import { EmailTemplateControl } from "../control/EmailTemplateControl";
|
|
19
19
|
import { BlockLoader } from "../../../static";
|
|
20
20
|
|
|
21
21
|
export interface EmailTemplateValues extends FormValues {
|
|
22
|
+
id?: number | string;
|
|
22
23
|
name: string;
|
|
23
24
|
subject: string;
|
|
24
25
|
isActive: boolean;
|
|
@@ -29,6 +30,7 @@ export interface EmailTemplateValues extends FormValues {
|
|
|
29
30
|
attachments?: Attachment[];
|
|
30
31
|
templateOptionValues?: TemplateOptionValue[];
|
|
31
32
|
imagesMetadata?: UploadPermanentImage[];
|
|
33
|
+
type?: NotificationType;
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
export interface EmailTemplateProps extends HasPermissionProp {
|
|
@@ -39,6 +41,8 @@ export interface EmailTemplateProps extends HasPermissionProp {
|
|
|
39
41
|
placeholders?: NotificationPlaceholder[];
|
|
40
42
|
options?: TemplateOption[];
|
|
41
43
|
serverErrors?: ServerError;
|
|
44
|
+
notificationTypes?: NotificationType[];
|
|
45
|
+
getDefaultTemplateMetaByType?: (type?: NotificationType | null) => string;
|
|
42
46
|
}
|
|
43
47
|
|
|
44
48
|
export function EmailTemplateForm({
|
|
@@ -49,6 +53,8 @@ export function EmailTemplateForm({
|
|
|
49
53
|
placeholders = [],
|
|
50
54
|
options = [],
|
|
51
55
|
serverErrors,
|
|
56
|
+
notificationTypes = [],
|
|
57
|
+
getDefaultTemplateMetaByType,
|
|
52
58
|
}: EmailTemplateProps) {
|
|
53
59
|
const { t } = useTranslation("Design");
|
|
54
60
|
const [isLoading, setIsLoading] = useState(false);
|
|
@@ -81,6 +87,8 @@ export function EmailTemplateForm({
|
|
|
81
87
|
meta={defaultValues?.meta || null}
|
|
82
88
|
defaultAttachments={defaultValues?.attachments || []}
|
|
83
89
|
options={options}
|
|
90
|
+
notificationTypes={notificationTypes}
|
|
91
|
+
getDefaultTemplateMetaByType={getDefaultTemplateMetaByType}
|
|
84
92
|
/>
|
|
85
93
|
<NotificationPlaceholders placeholders={placeholders} />
|
|
86
94
|
{/* update email template */}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Link } from "react-router-dom";
|
|
3
|
-
import { HasPermissionProp } from "@licklist/plugins/dist/types/permission/Permission";
|
|
4
3
|
import { useTranslation } from "react-i18next";
|
|
5
|
-
|
|
4
|
+
import { HasPermissionProp } from "@licklist/plugins/dist/types/permission/Permission";
|
|
5
|
+
import { NotificationType } from "@licklist/core/dist/DataMapper/Notification/NotificationTypeDataMapper";
|
|
6
6
|
import { ConfirmModal, ConfirmModalType } from "../../../modals";
|
|
7
7
|
import { Icon } from "../../../static";
|
|
8
8
|
|
|
@@ -11,6 +11,7 @@ export interface SmsTemplateCardProps extends HasPermissionProp {
|
|
|
11
11
|
href: string;
|
|
12
12
|
onRemove: () => void;
|
|
13
13
|
isDefault: boolean;
|
|
14
|
+
type: NotificationType;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
export function SmsTemplateCard({
|
|
@@ -19,6 +20,7 @@ export function SmsTemplateCard({
|
|
|
19
20
|
onRemove,
|
|
20
21
|
hasPermission = true,
|
|
21
22
|
isDefault = false,
|
|
23
|
+
type,
|
|
22
24
|
}: SmsTemplateCardProps) {
|
|
23
25
|
const { t } = useTranslation(["Design"]);
|
|
24
26
|
|
|
@@ -51,6 +53,9 @@ export function SmsTemplateCard({
|
|
|
51
53
|
</div>
|
|
52
54
|
<div className="mt-2">
|
|
53
55
|
{Boolean(isDefault) && <p className="mb-1">{t("Design:default")}</p>}
|
|
56
|
+
<p>
|
|
57
|
+
{t(`Design:type`)}: {t(`Design:${type}`)}
|
|
58
|
+
</p>
|
|
54
59
|
</div>
|
|
55
60
|
</div>
|
|
56
61
|
);
|
|
@@ -4,12 +4,18 @@ import { Col, Row, Form } from "react-bootstrap";
|
|
|
4
4
|
import { useFormContext } from "react-hook-form";
|
|
5
5
|
import { useTranslation } from "react-i18next";
|
|
6
6
|
import HookFormService from "@licklist/plugins/dist/services/Form/HookFormService";
|
|
7
|
-
|
|
7
|
+
import { NotificationType } from "@licklist/core/dist/DataMapper/Notification/NotificationTypeDataMapper";
|
|
8
8
|
import { SmsTemplateValues } from "../form";
|
|
9
9
|
|
|
10
10
|
const MAX_SMS_LENGTH = 300;
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
type SmsTemplateControlProps = {
|
|
13
|
+
notificationTypes: NotificationType[];
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const SmsTemplateControl = ({
|
|
17
|
+
notificationTypes = [],
|
|
18
|
+
}: SmsTemplateControlProps) => {
|
|
13
19
|
const { t } = useTranslation(["Design"]);
|
|
14
20
|
const {
|
|
15
21
|
register,
|
|
@@ -23,6 +29,34 @@ export const SmsTemplateControl = () => {
|
|
|
23
29
|
|
|
24
30
|
return (
|
|
25
31
|
<>
|
|
32
|
+
<Row>
|
|
33
|
+
<Form.Group as={Col} controlId="type" xs sm={12} md={8} lg={10} xl={12}>
|
|
34
|
+
<Form.Label>{t("type")}</Form.Label>
|
|
35
|
+
|
|
36
|
+
<Form.Control
|
|
37
|
+
as="select"
|
|
38
|
+
{...register("type", {
|
|
39
|
+
required: t("Validation:fieldRequired", {
|
|
40
|
+
attribute: t("type"),
|
|
41
|
+
}) as string,
|
|
42
|
+
})}
|
|
43
|
+
name="type"
|
|
44
|
+
required
|
|
45
|
+
isInvalid={Boolean(errors.type)}
|
|
46
|
+
placeholder={t("Design:type")}
|
|
47
|
+
>
|
|
48
|
+
<option value="">{t("Design:choose")}</option>
|
|
49
|
+
{notificationTypes.map((key) => (
|
|
50
|
+
<option key={key} value={key}>
|
|
51
|
+
{t(`Design:${key}`)}
|
|
52
|
+
</option>
|
|
53
|
+
))}
|
|
54
|
+
</Form.Control>
|
|
55
|
+
<Form.Control.Feedback type="invalid">
|
|
56
|
+
{errors.type?.message}
|
|
57
|
+
</Form.Control.Feedback>
|
|
58
|
+
</Form.Group>
|
|
59
|
+
</Row>
|
|
26
60
|
<Row>
|
|
27
61
|
<Form.Group
|
|
28
62
|
as={Col}
|
|
@@ -38,12 +38,26 @@ Default.args = {
|
|
|
38
38
|
isDefault: false,
|
|
39
39
|
body: "Some random sms string",
|
|
40
40
|
},
|
|
41
|
+
type: "confirmation",
|
|
42
|
+
notificationTypes: [
|
|
43
|
+
"confirmation",
|
|
44
|
+
"paymentLink",
|
|
45
|
+
"afterBooking",
|
|
46
|
+
"preliminaryMail",
|
|
47
|
+
],
|
|
41
48
|
};
|
|
42
49
|
|
|
43
50
|
Empty.args = {
|
|
44
51
|
onSubmit: (data) => console.log(data),
|
|
45
52
|
isLoading: true,
|
|
46
53
|
placeholders: [],
|
|
54
|
+
type: "confirmation",
|
|
55
|
+
notificationTypes: [
|
|
56
|
+
"confirmation",
|
|
57
|
+
"paymentLink",
|
|
58
|
+
"afterBooking",
|
|
59
|
+
"preliminaryMail",
|
|
60
|
+
],
|
|
47
61
|
};
|
|
48
62
|
|
|
49
63
|
ServerErrors.args = {
|
|
@@ -54,4 +68,11 @@ ServerErrors.args = {
|
|
|
54
68
|
body: ["Body field is required"],
|
|
55
69
|
name: ["Name Field is required"],
|
|
56
70
|
},
|
|
71
|
+
type: "confirmation",
|
|
72
|
+
notificationTypes: [
|
|
73
|
+
"confirmation",
|
|
74
|
+
"paymentLink",
|
|
75
|
+
"afterBooking",
|
|
76
|
+
"preliminaryMail",
|
|
77
|
+
],
|
|
57
78
|
};
|
|
@@ -8,6 +8,7 @@ import { NotificationPlaceholder } from "@licklist/core/dist/DataMapper/Notifica
|
|
|
8
8
|
import { ServerError } from "@licklist/plugins/dist/hooks/Api/useHttpQuery";
|
|
9
9
|
import FormErrorService from "@licklist/plugins/dist/services/Form/FormErrorService";
|
|
10
10
|
|
|
11
|
+
import { NotificationType } from "@licklist/core/dist/DataMapper/Notification/NotificationTypeDataMapper";
|
|
11
12
|
import { NotificationPlaceholders } from "../../components/NotificationPlaceholders";
|
|
12
13
|
import { SmsTemplateControl } from "../control/SmsTemplateControl";
|
|
13
14
|
|
|
@@ -16,6 +17,7 @@ export interface SmsTemplateValues extends FormValues {
|
|
|
16
17
|
isActive: boolean;
|
|
17
18
|
isDefault: boolean;
|
|
18
19
|
body: string;
|
|
20
|
+
type?: NotificationType;
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
export interface SmsTemplateProps extends HasPermissionProp {
|
|
@@ -24,6 +26,7 @@ export interface SmsTemplateProps extends HasPermissionProp {
|
|
|
24
26
|
defaultValues?: SmsTemplateValues;
|
|
25
27
|
placeholders?: NotificationPlaceholder[];
|
|
26
28
|
serverErrors?: ServerError;
|
|
29
|
+
notificationTypes?: NotificationType[];
|
|
27
30
|
}
|
|
28
31
|
|
|
29
32
|
export function SmsTemplateForm({
|
|
@@ -32,6 +35,7 @@ export function SmsTemplateForm({
|
|
|
32
35
|
hasPermission = true,
|
|
33
36
|
placeholders = [],
|
|
34
37
|
serverErrors,
|
|
38
|
+
notificationTypes = [],
|
|
35
39
|
}: SmsTemplateProps) {
|
|
36
40
|
const { t } = useTranslation("Design");
|
|
37
41
|
|
|
@@ -46,7 +50,7 @@ export function SmsTemplateForm({
|
|
|
46
50
|
return (
|
|
47
51
|
<FormProvider {...form}>
|
|
48
52
|
<Form onSubmit={form.handleSubmit(onSubmit)}>
|
|
49
|
-
<SmsTemplateControl />
|
|
53
|
+
<SmsTemplateControl notificationTypes={notificationTypes} />
|
|
50
54
|
<NotificationPlaceholders placeholders={placeholders} />
|
|
51
55
|
|
|
52
56
|
{hasPermission && (
|
|
@@ -39,7 +39,9 @@ export const SelectMenu = ({
|
|
|
39
39
|
) : (
|
|
40
40
|
<>
|
|
41
41
|
{!isLoading && (
|
|
42
|
-
<Form.Label className="bold-text">
|
|
42
|
+
<Form.Label className="bold-text">
|
|
43
|
+
{t("Design:productSets")}
|
|
44
|
+
</Form.Label>
|
|
43
45
|
)}
|
|
44
46
|
|
|
45
47
|
<div className="menu-list-manual-booking">
|