@licklist/design 0.44.515 → 0.44.516
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/IntervalInput.d.ts.map +1 -1
- package/dist/events/edit-event-modal/IntervalInput.js +1 -1
- package/dist/product-set/hooks/useSortableTreeFunctions.d.ts.map +1 -1
- package/dist/product-set/hooks/useSortableTreeFunctions.js +1 -1
- package/dist/product-set/product/quantity/ProductQuantityRechargingControl.d.ts.map +1 -1
- package/dist/product-set/product/quantity/ProductQuantityRechargingControl.js +1 -1
- package/dist/provider/constants.d.ts +2 -0
- package/dist/provider/constants.d.ts.map +1 -0
- package/dist/provider/constants.js +1 -0
- 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/coupon/control/CouponFormControl.d.ts.map +1 -1
- package/dist/sales/coupon/control/CouponFormControl.js +1 -1
- package/dist/styles/events/EventVenueMap.scss +1 -1
- package/dist/typeahead/Typeahead.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/events/edit-event-modal/IntervalInput.tsx +7 -1
- package/src/product-set/hooks/useSortableTreeFunctions.tsx +4 -2
- package/src/product-set/product/quantity/ProductQuantityRechargingControl.tsx +29 -3
- package/src/provider/constants.ts +1 -0
- package/src/provider/provider-details-input/ProviderDetailsInput.tsx +28 -2
- package/src/sales/coupon/control/CouponFormControl.tsx +5 -0
- package/src/sortable-tree/SortableTreeItem.tsx +1 -1
- package/src/styles/events/EventVenueMap.scss +1 -1
- package/src/typeahead/Typeahead.tsx +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntervalInput.d.ts","sourceRoot":"","sources":["../../../src/events/edit-event-modal/IntervalInput.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,6DAA6D,CAAC;AAIzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,UAAU,kBAAkB;IAC1B,gBAAgB,CAAC,EAAE,oBAAoB,CAAC;IACxC,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,wBAAgB,aAAa,CAAC,EAC5B,QAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,WAAW,GACZ,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"IntervalInput.d.ts","sourceRoot":"","sources":["../../../src/events/edit-event-modal/IntervalInput.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,6DAA6D,CAAC;AAIzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,UAAU,kBAAkB;IAC1B,gBAAgB,CAAC,EAAE,oBAAoB,CAAC;IACxC,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,wBAAgB,aAAa,CAAC,EAC5B,QAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,WAAW,GACZ,EAAE,kBAAkB,eAkJpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),r=require("react"),n=(e=r)&&"object"==typeof e&&"default"in e?e.default:e,a=require("react-i18next"),o=require("react-bootstrap"),i=require("react-hook-form"),l=require("@react-aria/utils"),u=require("../../static/WarningMessage.js"),d=require("luxon");require("../../static/index.js");var s=require("react-intl"),c=require("../../recurrence-input/RecurrenceInput.js");var m=function(){var e=i.useFormContext().watch,n=e("start"),a=e("end"),o=s.useIntl(),l=o.formatList,u=o.formatNumber;return r.useMemo((function(){var e=d.Interval.fromDateTimes(d.DateTime.fromISO(n),d.DateTime.fromISO(a)).toDuration(["days","hours","minutes"]);if(e.isValid){var r=function(e,t){return u(e,{style:"unit",unit:t,unitDisplay:"long"})},o=[[e.days,"day"],[e.hours,"hour"],[e.minutes,"minute"]].filter((function(e){return t.__read(e,1)[0]}));return l(o.map((function(e){return r.apply(void 0,t.__spreadArray([],t.__read(e),!1))})),{style:"long",type:"unit"})}}),[n,a])},f=function(){var e=i.useFormContext().watch,t=a.useTranslation(["Design","Validation"]).t,n=e("start"),o=e("end");return{start:r.useMemo((function(){return{required:t("Validation:fieldRequired",{attribute:t("start")}),validate:function(e){return d.DateTime.fromISO(e).diffNow().toMillis()>0||t("Validation:fieldValidEventStart")}}}),[]),end:r.useMemo((function(){return{validate:function(e){return!e||(d.DateTime.fromISO(e).diff(d.DateTime.fromISO(n)).toMillis()>0||t("Validation:fieldValidEventEnd"))}}}),[n,o])}};exports.IntervalInput=function(e){var s,v,p=e.disabled,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),r=require("react"),n=(e=r)&&"object"==typeof e&&"default"in e?e.default:e,a=require("react-i18next"),o=require("react-bootstrap"),i=require("react-hook-form"),l=require("@react-aria/utils"),u=require("../../static/WarningMessage.js"),d=require("luxon");require("../../static/index.js");var s=require("react-intl"),c=require("../../recurrence-input/RecurrenceInput.js");var m=function(){var e=i.useFormContext().watch,n=e("start"),a=e("end"),o=s.useIntl(),l=o.formatList,u=o.formatNumber;return r.useMemo((function(){var e=d.Interval.fromDateTimes(d.DateTime.fromISO(n),d.DateTime.fromISO(a)).toDuration(["days","hours","minutes"]);if(e.isValid){var r=function(e,t){return u(e,{style:"unit",unit:t,unitDisplay:"long"})},o=[[e.days,"day"],[e.hours,"hour"],[e.minutes,"minute"]].filter((function(e){return t.__read(e,1)[0]}));return l(o.map((function(e){return r.apply(void 0,t.__spreadArray([],t.__read(e),!1))})),{style:"long",type:"unit"})}}),[n,a])},f=function(){var e=i.useFormContext().watch,t=a.useTranslation(["Design","Validation"]).t,n=e("start"),o=e("end");return{start:r.useMemo((function(){return{required:t("Validation:fieldRequired",{attribute:t("start")}),validate:function(e){return d.DateTime.fromISO(e).diffNow().toMillis()>0||t("Validation:fieldValidEventStart")}}}),[]),end:r.useMemo((function(){return{validate:function(e){return!e||(d.DateTime.fromISO(e).diff(d.DateTime.fromISO(n)).toMillis()>0||t("Validation:fieldValidEventEnd"))}}}),[n,o])}};exports.IntervalInput=function(e){var s,v,p=e.disabled,g=void 0!==p&&p,E=e.editedProductSet,I=e.productSetId,F=e.productSets,C=a.useTranslation(["Design","Validation"]).t,h=i.useFormContext(),b=h.register,_=h.formState.errors,y=h.watch,q=h.control,S=h.trigger,D=h.setValue,T=m(),k=f(),x=y("rrule"),M=y("start"),O=y("end"),V=t.__read(r.useState(Boolean(x)),2),w=V[0],R=V[1],B=t.__read(r.useState(!1),2),j=B[0],G=B[1],P=l.useId(),L=r.useRef(null),N=r.useRef(null);return r.useEffect((function(){E&&R(!1)}),[E]),r.useEffect((function(){if(F){var e=F.find((function(e){return E&&(null==e?void 0:e.id)===(null==E?void 0:E.id)||Boolean(null==e?void 0:e.parentMenuId)&&(null==e?void 0:e.id)===I}));G(Boolean(e))}}),[F,I,G,E]),n.createElement(n.Fragment,null,n.createElement(o.Form.Row,{className:"interval-container"},n.createElement(o.Form.Group,{as:o.Col,controlId:"start"},n.createElement(o.Form.Label,null,C("start")),n.createElement(o.Form.Control,t.__assign({type:"datetime-local"},b("start",k.start),{value:M,name:"start",required:!0,isInvalid:Boolean(_.start),onChange:function(e){var t=e.target.value;R(!1),D("start",t),d.DateTime.fromISO(O).diff(d.DateTime.fromISO(t)).toMillis()<0&&D("end",t)},onClick:function(){var e;return null===(e=null==L?void 0:L.current)||void 0===e?void 0:e.showPicker()},ref:L,disabled:g})),n.createElement(o.Form.Control.Feedback,{type:"invalid"},null===(s=_.start)||void 0===s?void 0:s.message)),n.createElement(o.Form.Group,{as:o.Col,controlId:"end"},n.createElement(o.Form.Label,null,C("end")),n.createElement(o.Form.Control,t.__assign({type:"datetime-local"},b("end",k.end),{value:O,name:"end",onChange:function(e){return function(e){D("end",e),S("end")}(e.target.value)},min:M,isInvalid:Boolean(_.end),onClick:function(){var e;return null===(e=null==N?void 0:N.current)||void 0===e?void 0:e.showPicker()},ref:N,disabled:g})),n.createElement(o.Form.Control.Feedback,{type:"invalid"},null===(v=_.end)||void 0===v?void 0:v.message),n.createElement(o.Form.Text,{muted:!0},T&&"lasts ".concat(T)))),M&&n.createElement(o.Form.Group,{controlId:P},n.createElement(o.Form.Check,{label:"Recurrent",custom:!0,checked:w,onChange:function(e){var t=e.target.checked;R(t)},disabled:g||Boolean(E)}),!w&&n.createElement(o.Form.Text,{muted:!0},C("reccurentDescription",{item:C("event")}))),j&&n.createElement(u.default,{message:C("recurrentOverridesWarining")}),w&&M&&n.createElement(o.Form.Group,null,n.createElement(i.Controller,{control:q,name:"rrule",render:function(e){var t=e.field,r=t.value,a=t.onChange;return n.createElement(c.RecurrenceInput,{value:r,onChange:a,date:M,disabled:g})}})))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSortableTreeFunctions.d.ts","sourceRoot":"","sources":["../../../src/product-set/hooks/useSortableTreeFunctions.tsx"],"names":[],"mappings":"AAGA,UAAU,6BAA6B;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,IAAI,CAAC;CAC7C;AACD,eAAO,MAAM,wBAAwB,2BAGlC,6BAA6B;kBAIT,MAAM;2BAMG,MAAM;;
|
|
1
|
+
{"version":3,"file":"useSortableTreeFunctions.d.ts","sourceRoot":"","sources":["../../../src/product-set/hooks/useSortableTreeFunctions.tsx"],"names":[],"mappings":"AAGA,UAAU,6BAA6B;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,IAAI,CAAC;CAC7C;AACD,eAAO,MAAM,wBAAwB,2BAGlC,6BAA6B;kBAIT,MAAM;2BAMG,MAAM;;CAkBrC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),r=require("react"),n=((e=r)&&"object"==typeof e&&"default"in e&&e.default,require("react-hook-form"));exports.useSortableTreeFunctions=function(e){var u=e.fieldName,o=e.remove,a=n.useFormContext(),c=a.getValues,l=a.setValue,i=t.__read(r.useState(null),2),s=i[0],d=i[1];return{edit:function(e){var t=c("".concat(u,".").concat(e)),r=structuredClone(t);d(r)},cancelChanges:function(e){return s?l("".concat(u,".").concat(e),s):o(e)},saveValidField:function(){d(null)}}};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),r=require("react"),n=((e=r)&&"object"==typeof e&&"default"in e&&e.default,require("react-hook-form"));exports.useSortableTreeFunctions=function(e){var u=e.fieldName,o=e.remove,a=n.useFormContext(),c=a.getValues,l=a.setValue,i=t.__read(r.useState(null),2),s=i[0],d=i[1];return{edit:function(e){var t=c("".concat(u,".").concat(e)),r=structuredClone(t);d(r)},cancelChanges:function(e){return s?(l("".concat(u,".").concat(e),s),d(null)):o(e)},saveValidField:function(){d(null)}}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductQuantityRechargingControl.d.ts","sourceRoot":"","sources":["../../../../src/product-set/product/quantity/ProductQuantityRechargingControl.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EACL,mBAAmB,EACnB,UAAU,EACX,MAAM,8DAA8D,CAAC;AAStE,MAAM,WAAW,sCAAuC,SAAQ,UAAU;IACxE,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,qCAAqC,CAAC,CAAC,CACtD,SAAQ,mBAAmB,CAAC,CAAC,CAAC;IAC9B,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,cAAc,KAAK,IAAI,CAAC;CAC7C;AAED,wBAAgB,gCAAgC,CAAC,CAAC,SAAS,UAAU,EACnE,KAAK,EAAE,qCAAqC,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"ProductQuantityRechargingControl.d.ts","sourceRoot":"","sources":["../../../../src/product-set/product/quantity/ProductQuantityRechargingControl.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EACL,mBAAmB,EACnB,UAAU,EACX,MAAM,8DAA8D,CAAC;AAStE,MAAM,WAAW,sCAAuC,SAAQ,UAAU;IACxE,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,qCAAqC,CAAC,CAAC,CACtD,SAAQ,mBAAmB,CAAC,CAAC,CAAC;IAC9B,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,cAAc,KAAK,IAAI,CAAC;CAC7C;AAED,wBAAgB,gCAAgC,CAAC,CAAC,SAAS,UAAU,EACnE,KAAK,EAAE,qCAAqC,CAAC,CAAC,CAAC,eA8GhD"}
|
|
@@ -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("
|
|
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"),a=e(r),n=require("react-i18next"),i=require("react-bootstrap"),o=require("react-hook-form"),l=e(require("@licklist/plugins/dist/services/Form/HookFormService")),u=require("@react-aria/utils"),c=require("../../../assets/dashboard/increment.svg.js"),s=e(require("react-bootstrap/InputGroup"));exports.ProductQuantityRechargingControl=function(e){var m=e.isLoading,d=void 0!==m&&m,f=e.fieldNamePrefix,b=e.disabled,y=void 0!==b&&b,p=e.onFocus,v=o.useFormContext(),g=v.control,Q=v.trigger,q=v.watch,E=v.register,F=v.formState.errors,x=n.useTranslation("Design").t,C=u.useId(),h=q("".concat(f,".maxQuantity")),N=q("".concat(f,".isUnlimited"));return r.useEffect((function(){Q("".concat(f,".totalQuantity"))}),[h,N]),a.createElement(a.Fragment,null,a.createElement(i.Form.Group,{controlId:C},a.createElement(i.Form.Label,null,x("totalQuantity")),a.createElement(s,{hasValidation:!0},a.createElement(s.Prepend,null,a.createElement(s.Text,{className:"py-0 px-3"},a.createElement(c.ReactComponent,null))),a.createElement(o.Controller,{render:function(e){var r=e.field,n=r.value,o=r.onChange,u=r.ref;return a.createElement(i.Form.Control,t.__assign({ref:u,type:"number",min:0,step:1},E("".concat(f,".totalQuantity"),{validate:function(e){if(N)return!0;var t=Number(h),r=Number(e);return r<1?x("Validation:fieldMinNumber",{attribute:x("totalQuantity"),min:1}):!(r<t)||x("Validation:fieldTotalNumber",{attribute:x("totalQuantity"),max:x("maxOrderQuantity")})}}),{value:n,onFocus:p,onChange:o,isInvalid:l.isInvalid("".concat(f,".totalQuantity"),F),disabled:d||y}))},control:g,name:"".concat(f,".totalQuantity"),rules:y?{required:!1,min:0}:{required:x("Validation:fieldRequired",{attribute:x("totalQuantity")}),min:{value:1,message:x("Validation:fieldMinNumber",{attribute:x("totalQuantity"),min:1})}}}),a.createElement(i.Form.Control.Feedback,{type:"invalid"},l.getErrors("".concat(f,".totalQuantity"),F)))))};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/provider/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iCAAiC,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.MAX_DESCRIPTION_CHARACTERS_LENGTH=25500;
|
|
@@ -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;
|
|
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;AAE9D,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,eAwJ3B"}
|
|
@@ -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=
|
|
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"),i=e(t),n=require("react-i18next"),a=require("react-bootstrap"),o=require("react-hook-form"),l=e(require("@licklist/plugins/dist/services/Form/HookFormService")),s=require("@react-aria/utils"),d=require("../../typeahead/Typeahead.js"),m=require("../constants.js"),u=require("../provider-links-input/ProviderLinksInput.js");exports.ProviderDetailsInput=function(e){var c,p,E,v,g,F,b=e.companiesOptions,I=void 0===b?[]:b,h=e.linkTypes,C=void 0===h?[]:h,_=o.useFormContext(),q=_.register,y=_.watch,f=_.trigger,D=_.formState.errors,T=n.useTranslation(["App","Design","Validation"]).t,k=s.useId(),A=s.useId(),R=s.useId(),S=s.useId(),L=s.useId(),M=s.useId(),w=y("description");return t.useEffect((function(){m.MAX_DESCRIPTION_CHARACTERS_LENGTH>w.length||f("description")}),[w.length]),i.createElement(i.Fragment,null,i.createElement(a.Form.Group,{controlId:k},i.createElement(a.Form.Label,null,T("Design:name")),i.createElement(a.Form.Control,r.__assign({},q("name",{required:T("Validation:fieldRequired",{attribute:T("Design:name")})}),{name:"name",required:!0,isInvalid:Boolean(D.name)})),i.createElement(a.Form.Control.Feedback,{type:"invalid"},l.hasError(D.name,"required")&&(null===(c=D.name)||void 0===c?void 0:c.message))),i.createElement(a.Form.Group,{controlId:A},i.createElement(a.Form.Label,null,T("Design:description")),i.createElement(a.Form.Control,r.__assign({},q("description",{validate:function(e){return!(e.length>m.MAX_DESCRIPTION_CHARACTERS_LENGTH)||T("Validation:descriptionTooManyCharactersMessage",{max:m.MAX_DESCRIPTION_CHARACTERS_LENGTH})}}),{as:"textarea",name:"description",rows:6,isInvalid:Boolean(D.description)})),i.createElement(a.Form.Control.Feedback,{type:"invalid"},l.hasError(D.description,"validate")&&(null===(p=D.description)||void 0===p?void 0:p.message))),i.createElement(a.Form.Group,{controlId:R},i.createElement(a.Form.Label,null,T("Design:email")),i.createElement(a.Form.Control,r.__assign({},q("email",{required:T("Validation:fieldRequired",{attribute:T("Design:email")}),pattern:{value:/^\S+@\S+$/,message:T("Validation:fieldValidEmail",{attribute:T("Design:email")})}}),{name:"email",type:"email",inputMode:"email",isInvalid:Boolean(D.email)})),i.createElement(a.Form.Control.Feedback,{type:"invalid"},l.hasError(D.email,"required")&&(null===(E=D.email)||void 0===E?void 0:E.message),l.hasError(D.email,"pattern")&&(null===(v=D.email)||void 0===v?void 0:v.message))),i.createElement(a.Form.Group,{controlId:S},i.createElement(a.Form.Label,null,T("Design:phone")),i.createElement(a.Form.Control,r.__assign({},q("phone",{required:T("Validation:fieldRequired",{attribute:T("Design:phone")})}),{name:"phone",type:"tel",inputMode:"tel",isInvalid:Boolean(D.phone)})),i.createElement(a.Form.Control.Feedback,{type:"invalid"},l.hasError(D.phone,"required")&&(null===(g=D.phone)||void 0===g?void 0:g.message))),i.createElement(a.Form.Group,{controlId:L},i.createElement(a.Form.Label,null,T("Design:website")),i.createElement(a.Form.Control,r.__assign({},q("website",{pattern:{value:/\S+\.\S+/,message:T("Validation:fieldInvalid",{attribute:T("Design:website")})}}),{name:"website",type:"url",inputMode:"url",isInvalid:Boolean(D.website)})),i.createElement(a.Form.Control.Feedback,{type:"invalid"},l.hasError(D.website,"pattern")&&(null===(F=D.website)||void 0===F?void 0:F.message))),I.length>1&&i.createElement(a.Form.Group,{controlId:M},i.createElement(a.Form.Label,null,T("Design:company")),i.createElement(d.Typeahead,{name:"company",options:I,placeholder:T("App:select"),noOptionsMessage:T("App:noMatchesFound")})),C.length>0&&i.createElement(u.ProviderLinksInput,{linkTypes:C}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CouponFormControl.d.ts","sourceRoot":"","sources":["../../../../src/sales/coupon/control/CouponFormControl.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,+DAA+D,CAAC;AAC7F,OAAO,EAOL,eAAe,EACf,UAAU,EACX,MAAM,yDAAyD,CAAC;
|
|
1
|
+
{"version":3,"file":"CouponFormControl.d.ts","sourceRoot":"","sources":["../../../../src/sales/coupon/control/CouponFormControl.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,+DAA+D,CAAC;AAC7F,OAAO,EAOL,eAAe,EACf,UAAU,EACX,MAAM,yDAAyD,CAAC;AAajE,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,UAAU,CAAC;IACzB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,eAAe,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,iBAAiB,kCAG3B,eAAe,gBAgXjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";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 t=require("tslib"),l=require("react"),n=e(l),r=require("react-i18next"),o=require("react-bootstrap"),a=require("react-hook-form"),i=require("luxon"),m=require("@licklist/core/dist/DataMapper/Product/CouponDataMapper"),u=e(require("@licklist/plugins/dist/validation/Rules/couponCodeRules"));exports.CouponFormControl=function(e){var s,d,c,E,p,g,v,F,C,_=e.isLoading,b=void 0!==_&&_,f=e.productGroups,D=a.useFormContext(),y=D.register,T=D.setValue,P=D.getValues,x=D.formState.errors,O=D.watch,G=r.useTranslation(["Design","Notification","App"]).t,R=t.__read(l.useState([]),2),N=R[0],k=R[1],L=O("startFrom"),A=O("validTill"),h=l.useRef(null),w=l.useRef(null),q=((s={})[m.COUPON_TYPE_FIXED]=G("Design:fixed"),s[m.COUPON_TYPE_FIXED_PER_PERSON]=G("Design:fixedPerPerson"),s[m.COUPON_TYPE_PERCENTAGE]=G("Design:percentage"),s[m.COUPON_TYPE_PERCENTAGE_PER_PERSON]=G("Design:percentagePerPerson"),s),S=((d={})[m.COUPON_TOTAL_TYPE_GROSS]=G("Design:grossTotal"),d[m.COUPON_TOTAL_TYPE_TOTAL]=G("Design:depositTotal"),d);return l.useEffect((function(){k(P("productGroupIds"))}),[P]),l.useEffect((function(){T("productGroupIds",N)}),[P,T,N]),n.createElement(o.Row,null,n.createElement(o.Col,{md:5},n.createElement("h2",{className:"mb-5"},G("Design:coupon")),n.createElement(o.Row,null,n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,G("Design:name")),n.createElement(o.Form.Control,t.__assign({isInvalid:void 0!==x.name},y("name",{required:G("Validation:fieldRequired",{attribute:G("Design:name")})}),{disabled:b})),n.createElement(o.Form.Control.Feedback,{type:"invalid"},null===(c=null==x?void 0:x.name)||void 0===c?void 0:c.message))),n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,G("Design:couponCode")),n.createElement(o.Form.Control,t.__assign({isInvalid:void 0!==x.code},y("code",{required:G("Validation:fieldRequired",{attribute:G("Design:code")}),pattern:{message:"".concat(G("Validation:fieldCouponCode")),value:u}}),{disabled:b})),n.createElement(o.Form.Control.Feedback,{type:"invalid"},null===(E=null==x?void 0:x.code)||void 0===E?void 0:E.message)))),n.createElement(o.Row,null,n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,G("Design:discountType")),n.createElement(o.Form.Control,t.__assign({},y("discountType",{required:!0}),{as:"select",defaultValue:null!==(p=P("discountType"))&&void 0!==p?p:1,disabled:b}),Object.keys(q).map((function(e){return n.createElement("option",{value:e,key:e},q[e])}))))),n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,G("Design:discount")),n.createElement(o.Form.Control,t.__assign({type:"number",isInvalid:void 0!==x.discount},y("discount",{required:G("Validation:fieldRequired",{attribute:G("Design:discount")})}),{disabled:b})),n.createElement(o.Form.Control.Feedback,{type:"invalid"},null===(g=null==x?void 0:x.discount)||void 0===g?void 0:g.message)))),n.createElement(o.Row,null,n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,G("Design:applyOn")),n.createElement(o.Form.Control,t.__assign({},y("totalType",{required:!0}),{as:"select",defaultValue:null!==(v=P("totalType"))&&void 0!==v?v:1,disabled:b}),Object.keys(S).map((function(e){return n.createElement("option",{value:e,key:e},S[e])}))))))),n.createElement(o.Col,{md:{span:5,offset:1}},n.createElement("h2",{className:"mb-5"},G("Design:limitations")),n.createElement(o.Row,null,n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,G("Design:startFrom")),n.createElement(o.Form.Control,t.__assign({type:"date"},y("startFrom"),{value:L,isInvalid:void 0!==x.startFrom,onChange:function(e){var t=i.DateTime.fromSQL(e.target.value).toISODate();T("startFrom",t)},className:L&&"date-input-with-value",ref:h,onClick:function(){var e;return null===(e=null==h?void 0:h.current)||void 0===e?void 0:e.showPicker()},disabled:b})),n.createElement(o.Form.Control.Feedback,{type:"invalid"},null===(F=null==x?void 0:x.startFrom)||void 0===F?void 0:F.message))),n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,G("Design:validTill")),n.createElement(o.Form.Control,t.__assign({type:"date"},y("validTill"),{value:A,onChange:function(e){var t=i.DateTime.fromSQL(e.target.value).toISODate();T("validTill",t)},ref:w,className:A&&"date-input-with-value",onClick:function(){var e;return null===(e=null==w?void 0:w.current)||void 0===e?void 0:e.showPicker()},disabled:b}))))),f&&(null==f?void 0:f.length)>0&&n.createElement(o.Row,null,n.createElement(o.Col,{md:12},n.createElement("h5",{className:"mt-4"},G("Design:productGroups")),n.createElement(o.Form.Group,{className:"d-flex flex-wrap justify-content-between mt-4 mb-5"},null==f?void 0:f.map((function(e){var l,r,a=null!==(r=null===(l=P("productGroupIds"))||void 0===l?void 0:l.includes(String(e.id)))&&void 0!==r&&r;return n.createElement(o.Form.Check,{key:e.id,label:e.name,defaultChecked:a,disabled:b,onChange:function(l){l.target.checked?k((function(l){return Array.from(new Set(t.__spreadArray(t.__spreadArray([],t.__read(l),!1),[String(e.id)],!1)))})):k((function(t){return t.filter((function(t){return String(e.id)!==t}))}))}})})),n.createElement(o.Form.Control,t.__assign({},y("productGroupIds"),{hidden:!0,value:N,disabled:b}))))),n.createElement(o.Row,null,n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,G("Design:totalCoupons")),n.createElement(o.Form.Control,t.__assign({},y("totalCoupons"),{type:"number",isInvalid:void 0!==x.totalCoupons,disabled:b})),n.createElement(o.Form.Control.Feedback,{type:"invalid"},null===(C=null==x?void 0:x.totalCoupons)||void 0===C?void 0:C.message))),n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,G("Design:usesPerUser")),n.createElement(o.Form.Control,t.__assign({type:"number"},y("usesPerUser"),{disabled:b}))))),n.createElement(o.Row,null,n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,G("Design:useAgain")),n.createElement(o.Form.Control,t.__assign({type:"number"},y("useAgain"),{disabled:b})),n.createElement(o.Form.Text,{className:"text-muted"},G("Design:useAgainExplanation")))),n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,G("Design:usesPerUserDay")),n.createElement(o.Form.Control,t.__assign({type:"number"},y("usesPerUserDay"),{disabled:b})),n.createElement(o.Form.Text,{className:"text-muted"},G("Design:usesPerUserDayExplanation"))))),n.createElement(o.Row,null,n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,G("Design:minAmount")),n.createElement(o.Form.Control,t.__assign({type:"number"},y("minAmount"),{disabled:b})),n.createElement(o.Form.Text,{className:"text-muted"},G("Design:minAmountExplanation")))),n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,G("Design:maxAmount")),n.createElement(o.Form.Control,t.__assign({type:"number"},y("maxAmount"),{disabled:b})),n.createElement(o.Form.Text,{className:"text-muted"},G("Design:maxAmountExplanation")))))))};
|
|
@@ -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,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;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,iBAAS,SAAS,CAAC,EACjB,OAAO,EACP,WAAW,EACX,UAAkB,EAClB,gBAAgB,EAChB,IAAS,EACT,gBAAqB,EACrB,SAAS,GACV,EAAE,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;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,iBAAS,SAAS,CAAC,EACjB,OAAO,EACP,WAAW,EACX,UAAkB,EAClB,gBAAgB,EAChB,IAAS,EACT,gBAAqB,EACrB,SAAS,GACV,EAAE,cAAc,eAiChB;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -37,6 +37,7 @@ export function IntervalInput({
|
|
|
37
37
|
formState: { errors },
|
|
38
38
|
watch,
|
|
39
39
|
control,
|
|
40
|
+
trigger,
|
|
40
41
|
setValue,
|
|
41
42
|
} = useFormContext<IntervalInputValues>();
|
|
42
43
|
|
|
@@ -84,6 +85,11 @@ export function IntervalInput({
|
|
|
84
85
|
setIsOverriden(Boolean(isOverridenProductSet));
|
|
85
86
|
}, [productSets, productSetId, setIsOverriden, editedProductSet]);
|
|
86
87
|
|
|
88
|
+
const onChangeEndDate = (nextEndtDate: string) => {
|
|
89
|
+
setValue("end", nextEndtDate);
|
|
90
|
+
trigger("end");
|
|
91
|
+
};
|
|
92
|
+
|
|
87
93
|
return (
|
|
88
94
|
<>
|
|
89
95
|
<Form.Row className="interval-container">
|
|
@@ -114,7 +120,7 @@ export function IntervalInput({
|
|
|
114
120
|
value={end}
|
|
115
121
|
name="end"
|
|
116
122
|
onChange={({ target: { value: nextEndtDate } }) =>
|
|
117
|
-
|
|
123
|
+
onChangeEndDate(nextEndtDate)
|
|
118
124
|
}
|
|
119
125
|
min={start}
|
|
120
126
|
isInvalid={Boolean(errors.end)}
|
|
@@ -22,7 +22,9 @@ export const useSortableTreeFunctions = ({
|
|
|
22
22
|
if (!previousValue) {
|
|
23
23
|
return remove(index);
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
|
|
26
|
+
setValue(`${fieldName}.${index}` as const, previousValue);
|
|
27
|
+
return setEditValue(null);
|
|
26
28
|
};
|
|
27
29
|
|
|
28
30
|
const saveValidField = () => {
|
|
@@ -34,4 +36,4 @@ export const useSortableTreeFunctions = ({
|
|
|
34
36
|
cancelChanges,
|
|
35
37
|
saveValidField,
|
|
36
38
|
};
|
|
37
|
-
};
|
|
39
|
+
};
|
|
@@ -33,18 +33,23 @@ export function ProductQuantityRechargingControl<T extends FormValues>(
|
|
|
33
33
|
onFocus,
|
|
34
34
|
} = props;
|
|
35
35
|
const {
|
|
36
|
-
trigger,
|
|
37
36
|
control,
|
|
37
|
+
trigger,
|
|
38
|
+
watch,
|
|
39
|
+
register,
|
|
38
40
|
formState: { errors },
|
|
39
41
|
} = useFormContext<T>();
|
|
40
42
|
const { t } = useTranslation("Design");
|
|
41
43
|
|
|
42
44
|
const totalQuantityId = useId();
|
|
43
45
|
|
|
44
|
-
|
|
46
|
+
const maxQuantityValue = watch(`${fieldNamePrefix}.maxQuantity` as Path<T>);
|
|
47
|
+
const unlimited = watch(`${fieldNamePrefix}.isUnlimited` as Path<T>);
|
|
48
|
+
|
|
45
49
|
useEffect(() => {
|
|
46
50
|
trigger(`${fieldNamePrefix}.totalQuantity` as Path<T>);
|
|
47
|
-
|
|
51
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
52
|
+
}, [maxQuantityValue, unlimited]);
|
|
48
53
|
|
|
49
54
|
return (
|
|
50
55
|
<>
|
|
@@ -65,6 +70,27 @@ export function ProductQuantityRechargingControl<T extends FormValues>(
|
|
|
65
70
|
type="number"
|
|
66
71
|
min={0}
|
|
67
72
|
step={1}
|
|
73
|
+
{...register(`${fieldNamePrefix}.totalQuantity` as Path<T>, {
|
|
74
|
+
validate: (value) => {
|
|
75
|
+
if (unlimited) return true;
|
|
76
|
+
const min = 1;
|
|
77
|
+
const maxQuantity = Number(maxQuantityValue);
|
|
78
|
+
const totalQuantity = Number(value);
|
|
79
|
+
if (totalQuantity < min) {
|
|
80
|
+
return t("Validation:fieldMinNumber", {
|
|
81
|
+
attribute: t("totalQuantity"),
|
|
82
|
+
min: 1,
|
|
83
|
+
}) as string;
|
|
84
|
+
}
|
|
85
|
+
if (totalQuantity < maxQuantity) {
|
|
86
|
+
return t("Validation:fieldTotalNumber", {
|
|
87
|
+
attribute: t("totalQuantity"),
|
|
88
|
+
max: t("maxOrderQuantity"),
|
|
89
|
+
}) as string;
|
|
90
|
+
}
|
|
91
|
+
return true;
|
|
92
|
+
},
|
|
93
|
+
})}
|
|
68
94
|
value={value as string}
|
|
69
95
|
onFocus={onFocus}
|
|
70
96
|
onChange={onChange}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const MAX_DESCRIPTION_CHARACTERS_LENGTH = 25500;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useEffect } from "react";
|
|
2
2
|
import { Form } from "react-bootstrap";
|
|
3
3
|
import { useFormContext } from "react-hook-form";
|
|
4
4
|
import { useTranslation } from "react-i18next";
|
|
@@ -6,6 +6,7 @@ import { useId } from "@react-aria/utils";
|
|
|
6
6
|
import { Image } from "@licklist/core/dist/DataMapper/Media/ImageDataMapper";
|
|
7
7
|
import HookFormService from "@licklist/plugins/dist/services/Form/HookFormService";
|
|
8
8
|
import { Typeahead, TypeaheadOptions } from "../../typeahead";
|
|
9
|
+
import { MAX_DESCRIPTION_CHARACTERS_LENGTH } from "../constants";
|
|
9
10
|
import {
|
|
10
11
|
ProviderLinksInput,
|
|
11
12
|
ProviderLinksInputProps,
|
|
@@ -33,6 +34,8 @@ export function ProviderDetailsInput({
|
|
|
33
34
|
}: ProviderDetailsInputProps) {
|
|
34
35
|
const {
|
|
35
36
|
register,
|
|
37
|
+
watch,
|
|
38
|
+
trigger,
|
|
36
39
|
formState: { errors },
|
|
37
40
|
} = useFormContext<ProviderDetailsInputValues>();
|
|
38
41
|
const { t } = useTranslation(["App", "Design", "Validation"]);
|
|
@@ -44,6 +47,14 @@ export function ProviderDetailsInput({
|
|
|
44
47
|
const websiteId = useId();
|
|
45
48
|
const companyId = useId();
|
|
46
49
|
|
|
50
|
+
const description = watch("description");
|
|
51
|
+
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
if (MAX_DESCRIPTION_CHARACTERS_LENGTH > description.length) return;
|
|
54
|
+
trigger("description");
|
|
55
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
56
|
+
}, [description.length]);
|
|
57
|
+
|
|
47
58
|
return (
|
|
48
59
|
<>
|
|
49
60
|
<Form.Group controlId={nameId}>
|
|
@@ -67,11 +78,26 @@ export function ProviderDetailsInput({
|
|
|
67
78
|
<Form.Group controlId={descriptionId}>
|
|
68
79
|
<Form.Label>{t("Design:description")}</Form.Label>
|
|
69
80
|
<Form.Control
|
|
70
|
-
{...register("description"
|
|
81
|
+
{...register("description", {
|
|
82
|
+
validate: (value) => {
|
|
83
|
+
const descriptionLength = value.length;
|
|
84
|
+
if (descriptionLength > MAX_DESCRIPTION_CHARACTERS_LENGTH) {
|
|
85
|
+
return t("Validation:descriptionTooManyCharactersMessage", {
|
|
86
|
+
max: MAX_DESCRIPTION_CHARACTERS_LENGTH,
|
|
87
|
+
}) as string;
|
|
88
|
+
}
|
|
89
|
+
return true;
|
|
90
|
+
},
|
|
91
|
+
})}
|
|
71
92
|
as="textarea"
|
|
72
93
|
name="description"
|
|
73
94
|
rows={6}
|
|
95
|
+
isInvalid={Boolean(errors.description)}
|
|
74
96
|
/>
|
|
97
|
+
<Form.Control.Feedback type="invalid">
|
|
98
|
+
{HookFormService.hasError(errors.description, "validate") &&
|
|
99
|
+
errors.description?.message}
|
|
100
|
+
</Form.Control.Feedback>
|
|
75
101
|
</Form.Group>
|
|
76
102
|
|
|
77
103
|
<Form.Group controlId={emailId}>
|
|
@@ -14,6 +14,7 @@ import { DateTime } from "luxon";
|
|
|
14
14
|
import { Col, Form, Row } from "react-bootstrap";
|
|
15
15
|
import { useFormContext } from "react-hook-form";
|
|
16
16
|
import { useTranslation } from "react-i18next";
|
|
17
|
+
import couponCodeRules from "@licklist/plugins/dist/validation/Rules/couponCodeRules";
|
|
17
18
|
/* TODO: Show Recurrent date, when reccurent date bugs are fixed */
|
|
18
19
|
// import { Frequency } from "rrule";
|
|
19
20
|
// import { RecurrenceInput } from "../../../recurrence-input";
|
|
@@ -132,6 +133,10 @@ export const CouponFormControl = ({
|
|
|
132
133
|
required: t("Validation:fieldRequired", {
|
|
133
134
|
attribute: t("Design:code"),
|
|
134
135
|
}) as string,
|
|
136
|
+
pattern: {
|
|
137
|
+
message: `${t("Validation:fieldCouponCode")}`,
|
|
138
|
+
value: couponCodeRules,
|
|
139
|
+
},
|
|
135
140
|
})}
|
|
136
141
|
disabled={isLoading}
|
|
137
142
|
/>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import Select from "react-select";
|
|
2
|
+
import Select, { CSSObjectWithLabel } from "react-select";
|
|
3
3
|
import { Controller, useFormContext } from "react-hook-form";
|
|
4
4
|
|
|
5
5
|
export type TypeaheadOptions = {
|
|
@@ -29,7 +29,8 @@ function Typeahead({
|
|
|
29
29
|
}: TypeaheadProps) {
|
|
30
30
|
const { control } = useFormContext();
|
|
31
31
|
|
|
32
|
-
const getErrorStyle = ()
|
|
32
|
+
const getErrorStyle = (): CSSObjectWithLabel =>
|
|
33
|
+
isInvalid ? { borderColor: "red" } : {};
|
|
33
34
|
|
|
34
35
|
return (
|
|
35
36
|
<>
|