@licklist/design 0.44.505 → 0.44.506
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/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.d.ts.map +1 -1
- package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.js +1 -1
- package/dist/events/edit-event-modal/utils/getDefaultProductSet.d.ts.map +1 -1
- package/dist/events/edit-event-modal/utils/getDefaultProductSet.js +1 -1
- package/dist/index.js +1 -1
- package/dist/notification/email-template/card/EmailTemplateCard.d.ts +4 -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 +7 -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/hooks/useTranslatedParameters.d.ts +7 -0
- package/dist/notification/hooks/useTranslatedParameters.d.ts.map +1 -0
- package/dist/notification/hooks/useTranslatedParameters.js +1 -0
- package/dist/notification/sms-template/card/SmsTemplateCard.d.ts +4 -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 +5 -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/product-set/control/ProductSetControl.d.ts +15 -4
- package/dist/product-set/control/ProductSetControl.d.ts.map +1 -1
- package/dist/product-set/control/ProductSetControl.js +1 -1
- package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
- package/dist/product-set/form/ProductSetForm.js +1 -1
- package/dist/product-set/utils/index.d.ts +4 -0
- package/dist/product-set/utils/index.d.ts.map +1 -1
- package/dist/product-set/utils/index.js +1 -1
- package/dist/provider/provider-details-input/ProviderDetailsInput.d.ts.map +1 -1
- package/dist/provider/provider-details-input/ProviderDetailsInput.js +1 -1
- package/dist/sales/manual-booking/select-menu/SelectMenu.d.ts.map +1 -1
- package/dist/styles/snippet-templates/SnippetTemplateCard.scss +16 -0
- package/dist/typeahead/Typeahead.d.ts +4 -11
- package/dist/typeahead/Typeahead.d.ts.map +1 -1
- package/dist/typeahead/Typeahead.js +1 -1
- package/package.json +1 -1
- package/src/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.tsx +11 -2
- package/src/events/edit-event-modal/utils/getDefaultProductSet.ts +5 -4
- package/src/notification/email-template/card/EmailTemplateCard.stories.tsx +4 -2
- package/src/notification/email-template/card/EmailTemplateCard.tsx +15 -3
- package/src/notification/email-template/control/EmailTemplateControl.tsx +90 -6
- package/src/notification/email-template/form/EmailTemplateForm.stories.tsx +34 -0
- package/src/notification/email-template/form/EmailTemplateForm.tsx +23 -5
- package/src/notification/hooks/useTranslatedParameters.ts +27 -0
- package/src/notification/sms-template/card/SmsTemplateCard.stories.tsx +3 -1
- package/src/notification/sms-template/card/SmsTemplateCard.tsx +13 -3
- package/src/notification/sms-template/control/SmsTemplateControl.tsx +40 -2
- package/src/notification/sms-template/form/SmsTemplateForm.stories.tsx +28 -0
- package/src/notification/sms-template/form/SmsTemplateForm.tsx +6 -1
- package/src/product-set/control/ProductSetControl.tsx +38 -33
- package/src/product-set/form/ProductSetForm.stories.tsx +41 -2
- package/src/product-set/form/ProductSetForm.tsx +11 -0
- package/src/product-set/utils/index.ts +28 -0
- package/src/provider/provider-details-input/ProviderDetailsInput.tsx +0 -2
- package/src/sales/manual-booking/select-menu/SelectMenu.tsx +3 -1
- package/src/styles/snippet-templates/SnippetTemplateCard.scss +16 -0
- package/src/typeahead/Typeahead.stories.tsx +9 -6
- package/src/typeahead/Typeahead.tsx +9 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductSetForm.d.ts","sourceRoot":"","sources":["../../../src/product-set/form/ProductSetForm.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,8DAA8D,CAAC;AAI1F,OAAO,EAAE,WAAW,EAAE,MAAM,8DAA8D,CAAC;AAC3F,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAK5E,OAAO,EAAE,gCAAgC,EAAE,MAAM,oFAAoF,CAAC;AACtI,OAAO,EAAE,IAAI,EAAE,MAAM,wDAAwD,CAAC;AAE9E,OAAO,EAEL,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"ProductSetForm.d.ts","sourceRoot":"","sources":["../../../src/product-set/form/ProductSetForm.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,8DAA8D,CAAC;AAI1F,OAAO,EAAE,WAAW,EAAE,MAAM,8DAA8D,CAAC;AAC3F,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAK5E,OAAO,EAAE,gCAAgC,EAAE,MAAM,oFAAoF,CAAC;AACtI,OAAO,EAAE,IAAI,EAAE,MAAM,wDAAwD,CAAC;AAE9E,OAAO,EAEL,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAG5D,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,OAAO,CAAC;CACpB;AACD,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAC;CACZ;AACD,MAAM,WAAW,oBACf,SAAQ,UAAU,EAChB,MAAM,EACN,uBAAuB;IACzB,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;CAChB;AAED,MAAM,WAAW,mBACf,SAAQ,aAAa,EACnB,uBAAuB;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,oBAAoB,CAAC;IACrC,mBAAmB,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAC5D,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAC5D,gBAAgB,CAAC,EAAE,UAAU,EAAE,CAAC;IAChC,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;IAC7B,4BAA4B,CAAC,EAAE,gCAAgC,CAAC,sBAAsB,CAAC,CAAC;IACxF,KAAK,CAAC,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IACtB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,wBAAgB,cAAc,CAAC,EAC7B,WAAW,EACX,SAAS,EACT,aAAa,EACb,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,cAAsB,EACtB,YAAiB,EACjB,4BAA4B,EAC5B,KAAK,EACL,cAAc,EACd,GAAG,MAAM,EACV,EAAE,mBAAmB,eAwHrB"}
|
|
@@ -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"),o=require("react"),r=e(o),n=require("react-i18next"),a=require("react-bootstrap"),i=require("react-hook-form"),s=e(require("@licklist/plugins/dist/services/Form/FormErrorService")),
|
|
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"),o=require("react"),r=e(o),n=require("react-i18next"),a=require("react-bootstrap"),i=require("react-hook-form"),s=e(require("@licklist/plugins/dist/services/Form/FormErrorService")),l=require("lodash"),d=require("../../modals/dialog/Dialog.js"),u=require("../../modals/dialog/DialogContext.js"),m=require("./context.js"),c=require("../utils/index.js"),p=require("../control/ProductSetControl.js");exports.ProductSetForm=function(e){var v=e.companyName,g=e.isLoading,E=e.defaultValues,f=e.onSubmitAndRedirect,S=e.onSubmitNoRedirect,b=e.productGroupList,w=e.serverErrors,C=e.providerHasMap,h=void 0!==C&&C,q=e.venueMapSets,T=void 0===q?[]:q,D=e.providerHasBookingManagement,L=e.zones,x=e.isCreateAction,M=t.__rest(e,["companyName","isLoading","defaultValues","onSubmitAndRedirect","onSubmitNoRedirect","productGroupList","serverErrors","providerHasMap","venueMapSets","providerHasBookingManagement","zones","isCreateAction"]),P=n.useTranslation("Design").t,A=u.useDialogContext(),F=A.isShownDialog,N=A.onBeforeUnload,k=A.onPopState,_=A.onApproveDialog,j=A.onDeclineDialog,y=i.useForm({defaultValues:E,mode:"onChange"}),B=y.setError,H=y.reset,R=y.watch();return o.useEffect((function(){E&&!l.isEqual(E,R)&&H(E)}),[E]),o.useEffect((function(){w&&s.handleServerErrors(w,B)}),[w,B]),o.useEffect((function(){return window.history.pushState(null,"",window.location.pathname),window.addEventListener("beforeunload",N),window.addEventListener("popstate",k),function(){window.removeEventListener("beforeunload",N),window.removeEventListener("popstate",k)}}),[]),r.createElement(m.ProductSetContextProvider,{productGroupList:b,providerHasMap:h,venueMapSets:T,providerHasBookingManagement:D,zones:L},r.createElement(d.Dialog,{isActive:F,title:P("Design:leavePage"),content:P("Design:changesNotBeSaved"),onApprove:_,onDecline:j}),r.createElement(i.FormProvider,t.__assign({},y),r.createElement(a.Form,{onSubmit:y.handleSubmit(f)},r.createElement(m.ProductSetLoadingContext.Consumer,null,(function(e){var o=e.isLoading;return r.createElement(r.Fragment,null,r.createElement(p.ProductSetControl,t.__assign({},M,{smsTemplates:c.getFilteredTemplates(null==M?void 0:M.smsTemplates,null==R?void 0:R.smsTemplates),emailTemplates:c.getFilteredTemplates(null==M?void 0:M.emailTemplates,null==R?void 0:R.emailTemplates),showEmailTemplate:!!(null==M?void 0:M.emailTemplates),showSmsTemplate:!!(null==M?void 0:M.smsTemplates),isLoading:g,isCreateAction:x,companyName:v})),r.createElement(a.Row,null,r.createElement(a.Col,{md:6,sm:12}),r.createElement(a.Col,{className:"product-set-save-btn-wrapper p-0 pl-4 d-flex mw-100",md:6,sm:12},S&&r.createElement(a.Button,{className:"product-set-save-btn mt-5 ml-5 d-no dne d-md-block",onClick:y.handleSubmit(S),disabled:g||o||!R.name},P("save")),r.createElement(a.Button,{className:"product-set-save-btn mt-5 ml-5 d-no dne d-md-block",type:"submit",disabled:g||o||!R.name},P("saveAndClose")))))})))))};
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import { EmailTemplate } from "@licklist/core/dist/DataMapper/Notification/EmailTemplateDataMapper";
|
|
2
|
+
import { SmsTemplate } from "@licklist/core/dist/DataMapper/Notification/SmsTemplateDataMapper";
|
|
3
|
+
import { TemplateItem } from "../control/ProductSetControl";
|
|
1
4
|
export declare const moveArrayElements: <T>(array: T[], prevIndex: number, nextIndex: number) => T[];
|
|
2
5
|
export declare const sortArrayByIndex: <T>(array: T[]) => (T & {
|
|
3
6
|
sort: number;
|
|
4
7
|
})[];
|
|
8
|
+
export declare const getFilteredTemplates: (templates?: EmailTemplate[] | SmsTemplate[], formTemplates?: TemplateItem[]) => TemplateItem[] | undefined;
|
|
5
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/product-set/utils/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,6BAEjB,MAAM,aACN,MAAM,QAQlB,CAAC;AAEF,eAAO,MAAM,gBAAgB;;IAE5B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/product-set/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAC;AACpG,OAAO,EAAE,WAAW,EAAE,MAAM,mEAAmE,CAAC;AAChG,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,eAAO,MAAM,iBAAiB,6BAEjB,MAAM,aACN,MAAM,QAQlB,CAAC;AAEF,eAAO,MAAM,gBAAgB;;IAE5B,CAAC;AAEF,eAAO,MAAM,oBAAoB,eACnB,aAAa,EAAE,GAAG,WAAW,EAAE,kBAC3B,YAAY,EAAE,KAC7B,YAAY,EAAE,GAAG,SAmBnB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var i=require("tslib");exports.getFilteredTemplates=function(i,e){var n;if(i)return null===(n=null==i?void 0:i.filter((function(i){return i.notification.isActive&&!(null==e?void 0:e.find((function(e){return e.value.notification.type===i.notification.type})))})))||void 0===n?void 0:n.map((function(i){var e;return{id:null==i?void 0:i.id,value:i,label:null===(e=null==i?void 0:i.notification)||void 0===e?void 0:e.name}}))},exports.moveArrayElements=function(e,n,t){var r=i.__spreadArray([],i.__read(e),!1);return r.splice(t,0,r.splice(n,1)[0]),r},exports.sortArrayByIndex=function(e){return e.map((function(e,n){return i.__assign(i.__assign({},e),{sort:n})}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProviderDetailsInput.d.ts","sourceRoot":"","sources":["../../../src/provider/provider-details-input/ProviderDetailsInput.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,KAAK,EAAE,MAAM,sDAAsD,CAAC;AAE7E,OAAO,EAAa,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAEL,uBAAuB,EACvB,wBAAwB,EACzB,MAAM,yBAAyB,CAAC;AAEjC,oBAAY,0BAA0B,GAAG;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IACzB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;CACxB,GAAG,wBAAwB,CAAC;AAE7B,oBAAY,yBAAyB,GAAG;IACtC,gBAAgB,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACtC,SAAS,CAAC,EAAE,uBAAuB,CAAC,WAAW,CAAC,CAAC;CAClD,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,EACnC,gBAAqB,EACrB,SAAc,GACf,EAAE,yBAAyB,
|
|
1
|
+
{"version":3,"file":"ProviderDetailsInput.d.ts","sourceRoot":"","sources":["../../../src/provider/provider-details-input/ProviderDetailsInput.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,KAAK,EAAE,MAAM,sDAAsD,CAAC;AAE7E,OAAO,EAAa,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAEL,uBAAuB,EACvB,wBAAwB,EACzB,MAAM,yBAAyB,CAAC;AAEjC,oBAAY,0BAA0B,GAAG;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IACzB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;CACxB,GAAG,wBAAwB,CAAC;AAE7B,oBAAY,yBAAyB,GAAG;IACtC,gBAAgB,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACtC,SAAS,CAAC,EAAE,uBAAuB,CAAC,WAAW,CAAC,CAAC;CAClD,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,EACnC,gBAAqB,EACrB,SAAc,GACf,EAAE,yBAAyB,eA+H3B"}
|
|
@@ -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=e(require("react")),n=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 r=require("tslib"),t=e(require("react")),n=require("react-i18next"),i=require("react-bootstrap"),a=require("react-hook-form"),o=e(require("@licklist/plugins/dist/services/Form/HookFormService")),l=require("@react-aria/utils"),s=require("../../typeahead/Typeahead.js"),m=require("../provider-links-input/ProviderLinksInput.js");exports.ProviderDetailsInput=function(e){var d,u,p,c,v,g=e.companiesOptions,E=void 0===g?[]:g,F=e.linkTypes,b=void 0===F?[]:F,h=a.useFormContext(),I=h.register,q=h.formState.errors,y=n.useTranslation(["App","Design","Validation"]).t,f=l.useId(),D=l.useId(),k=l.useId(),_=l.useId(),C=l.useId(),w=l.useId();return t.createElement(t.Fragment,null,t.createElement(i.Form.Group,{controlId:f},t.createElement(i.Form.Label,null,y("Design:name")),t.createElement(i.Form.Control,r.__assign({},I("name",{required:y("Validation:fieldRequired",{attribute:y("Design:name")})}),{name:"name",required:!0,isInvalid:Boolean(q.name)})),t.createElement(i.Form.Control.Feedback,{type:"invalid"},o.hasError(q.name,"required")&&(null===(d=q.name)||void 0===d?void 0:d.message))),t.createElement(i.Form.Group,{controlId:D},t.createElement(i.Form.Label,null,y("Design:description")),t.createElement(i.Form.Control,r.__assign({},I("description"),{as:"textarea",name:"description",rows:6}))),t.createElement(i.Form.Group,{controlId:k},t.createElement(i.Form.Label,null,y("Design:email")),t.createElement(i.Form.Control,r.__assign({},I("email",{required:y("Validation:fieldRequired",{attribute:y("Design:email")}),pattern:{value:/^\S+@\S+$/,message:y("Validation:fieldValidEmail",{attribute:y("Design:email")})}}),{name:"email",type:"email",inputMode:"email",isInvalid:Boolean(q.email)})),t.createElement(i.Form.Control.Feedback,{type:"invalid"},o.hasError(q.email,"required")&&(null===(u=q.email)||void 0===u?void 0:u.message),o.hasError(q.email,"pattern")&&(null===(p=q.email)||void 0===p?void 0:p.message))),t.createElement(i.Form.Group,{controlId:_},t.createElement(i.Form.Label,null,y("Design:phone")),t.createElement(i.Form.Control,r.__assign({},I("phone",{required:y("Validation:fieldRequired",{attribute:y("Design:phone")})}),{name:"phone",type:"tel",inputMode:"tel",isInvalid:Boolean(q.phone)})),t.createElement(i.Form.Control.Feedback,{type:"invalid"},o.hasError(q.phone,"required")&&(null===(c=q.phone)||void 0===c?void 0:c.message))),t.createElement(i.Form.Group,{controlId:C},t.createElement(i.Form.Label,null,y("Design:website")),t.createElement(i.Form.Control,r.__assign({},I("website",{pattern:{value:/\S+\.\S+/,message:y("Validation:fieldInvalid",{attribute:y("Design:website")})}}),{name:"website",type:"url",inputMode:"url",isInvalid:Boolean(q.website)})),t.createElement(i.Form.Control.Feedback,{type:"invalid"},o.hasError(q.website,"pattern")&&(null===(v=q.website)||void 0===v?void 0:v.message))),E.length>1&&t.createElement(i.Form.Group,{controlId:w},t.createElement(i.Form.Label,null,y("Design:company")),t.createElement(s.Typeahead,{name:"company",options:E,placeholder:y("App:select"),noOptionsMessage:y("App:noMatchesFound")})),b.length>0&&t.createElement(m.ProviderLinksInput,{linkTypes:b}))};
|
|
@@ -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,oBAAY,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,oBAAY,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"}
|
|
@@ -45,6 +45,22 @@ $snippet-template-card-button-transition: $product-set-card-transition !default;
|
|
|
45
45
|
display: flex;
|
|
46
46
|
justify-content: space-between;
|
|
47
47
|
align-items: center;
|
|
48
|
+
|
|
49
|
+
a {
|
|
50
|
+
white-space: nowrap;
|
|
51
|
+
display: inline-block;
|
|
52
|
+
text-overflow: ellipsis;
|
|
53
|
+
width: 85%;
|
|
54
|
+
overflow: hidden;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.snippet-template-card-subject {
|
|
59
|
+
white-space: nowrap;
|
|
60
|
+
display: inline-block;
|
|
61
|
+
text-overflow: ellipsis;
|
|
62
|
+
width: 100%;
|
|
63
|
+
overflow: hidden;
|
|
48
64
|
}
|
|
49
65
|
|
|
50
66
|
.snippet-template-card-button {
|
|
@@ -1,24 +1,17 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare type TypeaheadOptions = {
|
|
3
|
-
id: number;
|
|
4
|
-
value:
|
|
3
|
+
id: number | string;
|
|
4
|
+
value: any;
|
|
5
5
|
label: string;
|
|
6
6
|
};
|
|
7
7
|
export interface TypeaheadProps {
|
|
8
8
|
options: TypeaheadOptions[];
|
|
9
|
-
setValue: (value: string | any) => void;
|
|
10
9
|
placeholder: string;
|
|
11
10
|
isRequired?: boolean;
|
|
12
11
|
name: string;
|
|
12
|
+
isMultipleChoise?: boolean;
|
|
13
13
|
noOptionsMessage: string;
|
|
14
14
|
}
|
|
15
|
-
declare function Typeahead({ options,
|
|
16
|
-
options: any;
|
|
17
|
-
setValue: any;
|
|
18
|
-
placeholder: any;
|
|
19
|
-
isRequired?: boolean;
|
|
20
|
-
name?: string;
|
|
21
|
-
noOptionsMessage?: string;
|
|
22
|
-
}): JSX.Element;
|
|
15
|
+
declare function Typeahead({ options, placeholder, isRequired, isMultipleChoise, name, noOptionsMessage, }: TypeaheadProps): JSX.Element;
|
|
23
16
|
export { Typeahead };
|
|
24
17
|
//# sourceMappingURL=Typeahead.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Typeahead.d.ts","sourceRoot":"","sources":["../../src/typeahead/Typeahead.tsx"],"names":[],"mappings":";AAIA,oBAAY,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"Typeahead.d.ts","sourceRoot":"","sources":["../../src/typeahead/Typeahead.tsx"],"names":[],"mappings":";AAIA,oBAAY,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,KAAK,EAAE,GAAG,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,iBAAS,SAAS,CAAC,EACjB,OAAO,EACP,WAAW,EACX,UAAkB,EAClB,gBAAgB,EAChB,IAAS,EACT,gBAAqB,GACtB,EAAE,cAAc,eAwBhB;AAED,OAAO,EAAE,SAAS,EAAE,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
|
|
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=e(require("react")),t=require("react-hook-form"),n=e(require("react-select"));exports.Typeahead=function(e){var o=e.options,l=e.placeholder,a=e.isRequired,i=void 0!==a&&a,u=e.isMultipleChoise,s=e.name,c=void 0===s?"":s,d=e.noOptionsMessage,p=void 0===d?"":d,f=t.useFormContext().control;return r.createElement(r.Fragment,null,r.createElement(t.Controller,{name:c,control:f,rules:{required:i},render:function(e){var t=e.field;return r.createElement(n,{placeholder:l,value:t.value,isMulti:u,onChange:function(e){t.onChange(e)},options:o,noOptionsMessage:function(){return r.createElement("span",null,p)}})}}))};
|
package/package.json
CHANGED
|
@@ -11,6 +11,7 @@ import { ProductSetControl } from "../../../../../product-set";
|
|
|
11
11
|
import { ProductSetContextProvider } from "../../../../../product-set/form/context";
|
|
12
12
|
import { getDefaultValues } from "../../../utils/getDefaultProductSet";
|
|
13
13
|
import { EditEventFormValues } from "../../EditEventForm";
|
|
14
|
+
import { getFilteredTemplates } from "../../../../../product-set/utils/index";
|
|
14
15
|
|
|
15
16
|
export const DEFAULT_FEE = 5;
|
|
16
17
|
|
|
@@ -109,8 +110,16 @@ export const EditEventProductSet = ({
|
|
|
109
110
|
<FormProvider {...form}>
|
|
110
111
|
<Form className="mt-6">
|
|
111
112
|
<ProductSetControl
|
|
112
|
-
|
|
113
|
-
|
|
113
|
+
smsTemplates={getFilteredTemplates(
|
|
114
|
+
smsTemplates,
|
|
115
|
+
formValues?.smsTemplates
|
|
116
|
+
)}
|
|
117
|
+
emailTemplates={getFilteredTemplates(
|
|
118
|
+
emailTemplates,
|
|
119
|
+
formValues?.emailTemplates
|
|
120
|
+
)}
|
|
121
|
+
showEmailTemplate={!!emailTemplates}
|
|
122
|
+
showSmsTemplate={!!smsTemplates}
|
|
114
123
|
fieldSets={fieldSetsData}
|
|
115
124
|
isLoading={isLoading}
|
|
116
125
|
companyName={selectedCompany?.title}
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
DEFAULT_PRODUCT_SET_TYPE,
|
|
4
4
|
ProductSet,
|
|
5
5
|
} from "@licklist/core/dist/DataMapper/Product/ProductSetDataMapper";
|
|
6
|
+
import { getFilteredTemplates } from "../../../product-set/utils/index";
|
|
6
7
|
import { ProductSetFormValues } from "../../../product-set/form/ProductSetForm";
|
|
7
8
|
|
|
8
9
|
export const getDefaultValues = (
|
|
@@ -17,13 +18,13 @@ export const getDefaultValues = (
|
|
|
17
18
|
thankYouPageUrl: productSet?.thankYouPageUrl ?? "",
|
|
18
19
|
isDefault: productSet?.isDefault ?? false,
|
|
19
20
|
fieldSetId: productSet?.fieldSetId,
|
|
20
|
-
|
|
21
|
+
emailTemplates:
|
|
21
22
|
productSet?.mailTemplates && productSet?.mailTemplates?.length > 0
|
|
22
|
-
? productSet?.mailTemplates
|
|
23
|
+
? getFilteredTemplates(productSet?.mailTemplates)
|
|
23
24
|
: undefined,
|
|
24
|
-
|
|
25
|
+
smsTemplates:
|
|
25
26
|
productSet?.smsTemplates && productSet?.smsTemplates?.length > 0
|
|
26
|
-
? productSet?.
|
|
27
|
+
? getFilteredTemplates(productSet?.mailTemplates)
|
|
27
28
|
: undefined,
|
|
28
29
|
steps:
|
|
29
30
|
productSet?.steps?.map(({ productCategories, ...step }) => ({
|
|
@@ -14,8 +14,10 @@ export const Default: Story<EmailTemplateCardProps> = (args) => (
|
|
|
14
14
|
|
|
15
15
|
Default.args = {
|
|
16
16
|
href: "#",
|
|
17
|
-
name: "Default Email Template",
|
|
18
|
-
subject: "Confirmation",
|
|
17
|
+
name: "Default Email Template with very long name",
|
|
18
|
+
subject: "Confirmation with looong subject text",
|
|
19
19
|
hasPermission: true,
|
|
20
20
|
isDefault: true,
|
|
21
|
+
templateType: "confirmation",
|
|
22
|
+
isActive: true,
|
|
21
23
|
};
|
|
@@ -2,16 +2,19 @@ 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
|
+
import { useTranslatedParameters } from "../../hooks/useTranslatedParameters";
|
|
8
9
|
|
|
9
10
|
export interface EmailTemplateCardProps extends HasPermissionProp {
|
|
10
11
|
name: string;
|
|
11
12
|
subject: string;
|
|
12
13
|
href: string;
|
|
13
14
|
isDefault: boolean;
|
|
15
|
+
isActive: boolean;
|
|
14
16
|
onRemove: () => void;
|
|
17
|
+
type: NotificationType;
|
|
15
18
|
}
|
|
16
19
|
|
|
17
20
|
export function EmailTemplateCard({
|
|
@@ -20,10 +23,14 @@ export function EmailTemplateCard({
|
|
|
20
23
|
subject,
|
|
21
24
|
onRemove,
|
|
22
25
|
isDefault = false,
|
|
26
|
+
isActive = false,
|
|
23
27
|
hasPermission = true,
|
|
28
|
+
type,
|
|
24
29
|
}: EmailTemplateCardProps) {
|
|
25
30
|
const { t } = useTranslation(["Design"]);
|
|
26
31
|
|
|
32
|
+
const texts = useTranslatedParameters({ isDefault, isActive });
|
|
33
|
+
|
|
27
34
|
return (
|
|
28
35
|
<>
|
|
29
36
|
<div className="snippet-template-card">
|
|
@@ -53,8 +60,13 @@ export function EmailTemplateCard({
|
|
|
53
60
|
)}
|
|
54
61
|
</div>
|
|
55
62
|
<div className={`mt-${isDefault ? "3" : "4"}`}>
|
|
56
|
-
{
|
|
57
|
-
<
|
|
63
|
+
{!!texts.length && <p className="mb-1">{texts}</p>}
|
|
64
|
+
<div className="d-flex flex-column">
|
|
65
|
+
<span className="snippet-template-card-subject">{subject}</span>
|
|
66
|
+
<p className="mb-0">
|
|
67
|
+
{t(`Design:type`)}: {t(`Design:${type}`)}
|
|
68
|
+
</p>
|
|
69
|
+
</div>
|
|
58
70
|
</div>
|
|
59
71
|
</div>
|
|
60
72
|
</>
|
|
@@ -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,12 +70,29 @@ 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]);
|
|
70
92
|
|
|
71
93
|
useEffect(() => {
|
|
72
94
|
if (!permanentImages.length) return;
|
|
95
|
+
|
|
73
96
|
setValue("imagesMetadata", permanentImages);
|
|
74
97
|
}, [permanentImages, setValue]);
|
|
75
98
|
|
|
@@ -85,13 +108,15 @@ export const EmailTemplateControl = React.forwardRef(
|
|
|
85
108
|
}, [defaultAttachments]);
|
|
86
109
|
|
|
87
110
|
useEffect(() => {
|
|
88
|
-
if (!options
|
|
111
|
+
if (!options?.length) return;
|
|
112
|
+
|
|
89
113
|
const fileSelectorOptions = options.find(
|
|
90
114
|
(option) => option.type === OPTION_TYPE.files_selector
|
|
91
115
|
);
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
116
|
+
|
|
117
|
+
if (!fileSelectorOptions?.selectedValue) return;
|
|
118
|
+
|
|
119
|
+
setIsIncludePDF(true);
|
|
95
120
|
}, [options]);
|
|
96
121
|
|
|
97
122
|
const handleDeleteEmailImage = (content) => {
|
|
@@ -175,6 +200,42 @@ export const EmailTemplateControl = React.forwardRef(
|
|
|
175
200
|
|
|
176
201
|
return (
|
|
177
202
|
<>
|
|
203
|
+
<Row>
|
|
204
|
+
<Form.Group
|
|
205
|
+
as={Col}
|
|
206
|
+
controlId="type"
|
|
207
|
+
xs
|
|
208
|
+
sm={12}
|
|
209
|
+
md={8}
|
|
210
|
+
lg={10}
|
|
211
|
+
xl={12}
|
|
212
|
+
>
|
|
213
|
+
<Form.Label>{t("type")}</Form.Label>
|
|
214
|
+
<Form.Control
|
|
215
|
+
as="select"
|
|
216
|
+
{...register("type", {
|
|
217
|
+
required: t("Validation:fieldRequired", {
|
|
218
|
+
attribute: t("type"),
|
|
219
|
+
}) as string,
|
|
220
|
+
})}
|
|
221
|
+
name="type"
|
|
222
|
+
required
|
|
223
|
+
isInvalid={Boolean(errors.type)}
|
|
224
|
+
placeholder={t("Design:type")}
|
|
225
|
+
disabled={!!id}
|
|
226
|
+
>
|
|
227
|
+
<option value="">{t("Design:choose")}</option>
|
|
228
|
+
{notificationTypes.map((key) => (
|
|
229
|
+
<option key={key} value={key}>
|
|
230
|
+
{t(`Design:${key}`)}
|
|
231
|
+
</option>
|
|
232
|
+
))}
|
|
233
|
+
</Form.Control>
|
|
234
|
+
<Form.Control.Feedback type="invalid">
|
|
235
|
+
{errors.type?.message}
|
|
236
|
+
</Form.Control.Feedback>
|
|
237
|
+
</Form.Group>
|
|
238
|
+
</Row>
|
|
178
239
|
<Row>
|
|
179
240
|
<Form.Group
|
|
180
241
|
as={Col}
|
|
@@ -279,7 +340,7 @@ export const EmailTemplateControl = React.forwardRef(
|
|
|
279
340
|
isLoading={isAttachmentLoading}
|
|
280
341
|
/>
|
|
281
342
|
</Row>
|
|
282
|
-
{options
|
|
343
|
+
{options?.length > 0 && (
|
|
283
344
|
<Row>
|
|
284
345
|
<Form.Group as={Col}>
|
|
285
346
|
{options.map((option) => {
|
|
@@ -347,6 +408,27 @@ export const EmailTemplateControl = React.forwardRef(
|
|
|
347
408
|
</>
|
|
348
409
|
);
|
|
349
410
|
}
|
|
411
|
+
|
|
412
|
+
if (option.type === OPTION_TYPE.days_reminder) {
|
|
413
|
+
return (
|
|
414
|
+
<>
|
|
415
|
+
<Form.Label className="mt-4">
|
|
416
|
+
{t(`Design:${option.name}`)}
|
|
417
|
+
</Form.Label>
|
|
418
|
+
<Form.Control
|
|
419
|
+
{...register(
|
|
420
|
+
`templateOptionValues.${option?.id}.value` as any
|
|
421
|
+
)}
|
|
422
|
+
type="number"
|
|
423
|
+
placeholder={t(`Design:${option.name}`)}
|
|
424
|
+
id={option.name + option.id}
|
|
425
|
+
defaultValue={option.selectedValue || ""}
|
|
426
|
+
/>
|
|
427
|
+
<Form.Text>{option.description}</Form.Text>
|
|
428
|
+
</>
|
|
429
|
+
);
|
|
430
|
+
}
|
|
431
|
+
|
|
350
432
|
return null;
|
|
351
433
|
})}
|
|
352
434
|
</Form.Group>
|
|
@@ -356,3 +438,5 @@ export const EmailTemplateControl = React.forwardRef(
|
|
|
356
438
|
);
|
|
357
439
|
}
|
|
358
440
|
);
|
|
441
|
+
|
|
442
|
+
EmailTemplateControl.displayName = "EmailTemplateControl";
|
|
@@ -185,6 +185,7 @@ Default.args = {
|
|
|
185
185
|
notificationType: "confirmation",
|
|
186
186
|
type: "checkbox",
|
|
187
187
|
defaultValue: "true",
|
|
188
|
+
descrption: "",
|
|
188
189
|
},
|
|
189
190
|
{
|
|
190
191
|
id: 12,
|
|
@@ -192,6 +193,7 @@ Default.args = {
|
|
|
192
193
|
notificationType: "confirmation",
|
|
193
194
|
type: "checkbox",
|
|
194
195
|
defaultValue: "false",
|
|
196
|
+
descrption: "",
|
|
195
197
|
},
|
|
196
198
|
{
|
|
197
199
|
selectedValue: "invoice",
|
|
@@ -201,6 +203,17 @@ Default.args = {
|
|
|
201
203
|
type: "files_selector",
|
|
202
204
|
defaultValue:
|
|
203
205
|
'{"confirmation":"Confirmation / Function Sheet","invoice":"Invoice"}',
|
|
206
|
+
descrption: "",
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
id: 13,
|
|
210
|
+
name: "days_reminder",
|
|
211
|
+
notificationType: "confirmation",
|
|
212
|
+
type: "days_reminder",
|
|
213
|
+
defaultValue: "",
|
|
214
|
+
description: `N.B. Add positive integer for days before the event, or negative for days after the event.
|
|
215
|
+
E.g. if you want this remainder to be send 2 days before the event, enter 2.
|
|
216
|
+
If you want this to be send 3 days after the event enter -3.`,
|
|
204
217
|
},
|
|
205
218
|
],
|
|
206
219
|
defaultValues: {
|
|
@@ -219,6 +232,13 @@ Default.args = {
|
|
|
219
232
|
attachableType: "mail",
|
|
220
233
|
},
|
|
221
234
|
],
|
|
235
|
+
type: "confirmation",
|
|
236
|
+
notificationTypes: [
|
|
237
|
+
"confirmation",
|
|
238
|
+
"paymentLink",
|
|
239
|
+
"afterBooking",
|
|
240
|
+
"preliminaryMail",
|
|
241
|
+
],
|
|
222
242
|
},
|
|
223
243
|
};
|
|
224
244
|
|
|
@@ -248,10 +268,24 @@ ServerErrors.args = {
|
|
|
248
268
|
body: "",
|
|
249
269
|
meta: JSON.stringify(DefaultEmailTemplate),
|
|
250
270
|
},
|
|
271
|
+
type: "confirmation",
|
|
272
|
+
notificationTypes: [
|
|
273
|
+
"confirmation",
|
|
274
|
+
"paymentLink",
|
|
275
|
+
"afterBooking",
|
|
276
|
+
"preliminaryMail",
|
|
277
|
+
],
|
|
251
278
|
};
|
|
252
279
|
|
|
253
280
|
Empty.args = {
|
|
254
281
|
onSubmit: (data) => console.log(data),
|
|
255
282
|
isLoading: true,
|
|
256
283
|
placeholders: [],
|
|
284
|
+
type: "confirmation",
|
|
285
|
+
notificationTypes: [
|
|
286
|
+
"confirmation",
|
|
287
|
+
"paymentLink",
|
|
288
|
+
"afterBooking",
|
|
289
|
+
"preliminaryMail",
|
|
290
|
+
],
|
|
257
291
|
};
|
|
@@ -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,9 +41,12 @@ 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;
|
|
46
|
+
onTypeChange?: (type?: NotificationType | null) => void;
|
|
42
47
|
}
|
|
43
48
|
|
|
44
|
-
export
|
|
49
|
+
export const EmailTemplateForm = ({
|
|
45
50
|
defaultValues,
|
|
46
51
|
onSubmitSave,
|
|
47
52
|
onSubmitSaveAndSend,
|
|
@@ -49,7 +54,10 @@ export function EmailTemplateForm({
|
|
|
49
54
|
placeholders = [],
|
|
50
55
|
options = [],
|
|
51
56
|
serverErrors,
|
|
52
|
-
|
|
57
|
+
notificationTypes = [],
|
|
58
|
+
getDefaultTemplateMetaByType,
|
|
59
|
+
onTypeChange,
|
|
60
|
+
}: EmailTemplateProps) => {
|
|
53
61
|
const { t } = useTranslation("Design");
|
|
54
62
|
const [isLoading, setIsLoading] = useState(false);
|
|
55
63
|
const emailEditorRef = useRef(null);
|
|
@@ -59,12 +67,20 @@ export function EmailTemplateForm({
|
|
|
59
67
|
defaultValues,
|
|
60
68
|
});
|
|
61
69
|
|
|
62
|
-
const { setError } = form;
|
|
70
|
+
const { setError, watch } = form;
|
|
71
|
+
const type = watch("type");
|
|
63
72
|
|
|
64
73
|
useEffect(() => {
|
|
65
74
|
FormErrorService.handleServerErrors(serverErrors, setError);
|
|
66
75
|
}, [serverErrors, setError]);
|
|
67
76
|
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
if (!onTypeChange) return;
|
|
79
|
+
|
|
80
|
+
onTypeChange(type);
|
|
81
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
82
|
+
}, [type]);
|
|
83
|
+
|
|
68
84
|
return (
|
|
69
85
|
<FormProvider {...form}>
|
|
70
86
|
{isLoading && <BlockLoader />}
|
|
@@ -81,6 +97,8 @@ export function EmailTemplateForm({
|
|
|
81
97
|
meta={defaultValues?.meta || null}
|
|
82
98
|
defaultAttachments={defaultValues?.attachments || []}
|
|
83
99
|
options={options}
|
|
100
|
+
notificationTypes={notificationTypes}
|
|
101
|
+
getDefaultTemplateMetaByType={getDefaultTemplateMetaByType}
|
|
84
102
|
/>
|
|
85
103
|
<NotificationPlaceholders placeholders={placeholders} />
|
|
86
104
|
{/* update email template */}
|
|
@@ -106,4 +124,4 @@ export function EmailTemplateForm({
|
|
|
106
124
|
</Form>
|
|
107
125
|
</FormProvider>
|
|
108
126
|
);
|
|
109
|
-
}
|
|
127
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useTranslation } from "react-i18next";
|
|
2
|
+
|
|
3
|
+
type UseTranslatedParametersProps = {
|
|
4
|
+
isDefault: boolean;
|
|
5
|
+
isActive: boolean;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const useTranslatedParameters = ({
|
|
9
|
+
isActive,
|
|
10
|
+
isDefault,
|
|
11
|
+
}: UseTranslatedParametersProps) => {
|
|
12
|
+
const { t } = useTranslation(["Design"]);
|
|
13
|
+
|
|
14
|
+
const translatedParameters = () => {
|
|
15
|
+
const texts: string[] = [];
|
|
16
|
+
if (isDefault) {
|
|
17
|
+
texts.push(t("Design:default"));
|
|
18
|
+
}
|
|
19
|
+
if (isActive) {
|
|
20
|
+
texts.push(t("Design:active"));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return texts.join(", ");
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
return translatedParameters();
|
|
27
|
+
};
|
|
@@ -14,7 +14,9 @@ export const Default: Story<SmsTemplateCardProps> = (args) => (
|
|
|
14
14
|
|
|
15
15
|
Default.args = {
|
|
16
16
|
href: "#",
|
|
17
|
-
name: "Default Sms Template",
|
|
17
|
+
name: "Default Sms Template with Long name",
|
|
18
18
|
hasPermission: true,
|
|
19
19
|
isDefault: true,
|
|
20
|
+
templateType: "confirmation",
|
|
21
|
+
isActive: true,
|
|
20
22
|
};
|