@licklist/design 0.44.509 → 0.44.511

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.
Files changed (25) hide show
  1. package/dist/iframe/order-process/components/Timer/utils/index.d.ts +1 -1
  2. package/dist/iframe/order-process/components/Timer/utils/index.d.ts.map +1 -1
  3. package/dist/iframe/order-process/components/Timer/utils/index.js +1 -1
  4. package/dist/iframe/payment/payment-page/PaymentPage.d.ts +1 -1
  5. package/dist/iframe/payment/payment-page/PaymentPage.d.ts.map +1 -1
  6. package/dist/iframe/payment/payment-page/PaymentTimer.d.ts +1 -0
  7. package/dist/iframe/payment/payment-page/PaymentTimer.d.ts.map +1 -1
  8. package/dist/iframe/payment/payment-page/PaymentTimer.js +1 -1
  9. package/dist/product-set/product/ProductControl.d.ts.map +1 -1
  10. package/dist/product-set/product/ProductControl.js +1 -1
  11. package/dist/sales/booking/filter/components/AdditionalFIlterSection.js +1 -1
  12. package/dist/sales/coupon/control/CouponFormControl.d.ts.map +1 -1
  13. package/dist/sales/coupon/control/CouponFormControl.js +1 -1
  14. package/dist/sales/manual-booking/create-user/CreateUser.js +1 -1
  15. package/dist/styles/sales/BookingFilter.scss +43 -11
  16. package/package.json +1 -1
  17. package/src/iframe/order-process/OrderProcess.stories.tsx +2 -2
  18. package/src/iframe/order-process/components/Timer/Timer.stories.tsx +1 -1
  19. package/src/iframe/order-process/components/Timer/utils/index.ts +4 -4
  20. package/src/iframe/payment/payment-page/PaymentPage.tsx +1 -1
  21. package/src/iframe/payment/payment-page/PaymentTimer.tsx +31 -6
  22. package/src/product-set/product/ProductControl.tsx +3 -4
  23. package/src/sales/booking/filter/components/AdditionalFIlterSection.tsx +2 -2
  24. package/src/sales/coupon/control/CouponFormControl.tsx +2 -0
  25. package/src/styles/sales/BookingFilter.scss +43 -11
@@ -1,2 +1,2 @@
1
- export declare const fancyTimeFormat: (duration: number) => string;
1
+ export declare const fancyTimeFormat: (miliseconds: number) => string;
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/order-process/components/Timer/utils/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,aAAc,MAAM,WAS/C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/order-process/components/Timer/utils/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,gBAAiB,MAAM,WASlD,CAAC"}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.fancyTimeFormat=function(t){var o=Math.floor(t%3600/60),e=Math.floor(t)%60,r="";return r+="".concat(o,":").concat(e<10?"0":""),r+="".concat(e)};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.fancyTimeFormat=function(e){var t=new Date(e),c=t.getMinutes(),n=t.getSeconds(),o="";return o+="".concat(c,":").concat(n<10?"0":""),o+="".concat(n)};
@@ -9,7 +9,7 @@ export interface PaymentMetadata {
9
9
  interface PaymentProps extends RyftPaymentFormProps {
10
10
  onCloseIframePayment?: () => void;
11
11
  onFailIframePayment?: () => void;
12
- data?: PaymentLinkResponse;
12
+ data?: PaymentLinkResponse | null;
13
13
  isLoading: boolean;
14
14
  bookingSummaryProps: Omit<BookingSummaryProps, "totallWithDiscount">;
15
15
  paymentMetadata?: PaymentMetadata;
@@ -1 +1 @@
1
- {"version":3,"file":"PaymentPage.d.ts","sourceRoot":"","sources":["../../../../src/iframe/payment/payment-page/PaymentPage.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AACrF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0DAA0D,CAAC;AAI/F,OAAO,EAEL,oBAAoB,EACrB,MAAM,4BAA4B,CAAC;AAMpC,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,YAAa,SAAQ,oBAAoB;IACjD,oBAAoB,CAAC,EAAE,MAAM,IAAI,CAAC;IAClC,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;IACjC,IAAI,CAAC,EAAE,mBAAmB,CAAC;IAC3B,SAAS,EAAE,OAAO,CAAC;IACnB,mBAAmB,EAAE,IAAI,CAAC,mBAAmB,EAAE,oBAAoB,CAAC,CAAC;IACrE,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC;AAED,eAAO,MAAM,WAAW,kIAQrB,YAAY,gBA4Jd,CAAC"}
1
+ {"version":3,"file":"PaymentPage.d.ts","sourceRoot":"","sources":["../../../../src/iframe/payment/payment-page/PaymentPage.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AACrF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0DAA0D,CAAC;AAI/F,OAAO,EAEL,oBAAoB,EACrB,MAAM,4BAA4B,CAAC;AAMpC,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,YAAa,SAAQ,oBAAoB;IACjD,oBAAoB,CAAC,EAAE,MAAM,IAAI,CAAC;IAClC,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;IACjC,IAAI,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAClC,SAAS,EAAE,OAAO,CAAC;IACnB,mBAAmB,EAAE,IAAI,CAAC,mBAAmB,EAAE,oBAAoB,CAAC,CAAC;IACrE,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC;AAED,eAAO,MAAM,WAAW,kIAQrB,YAAY,gBA4Jd,CAAC"}
@@ -1,3 +1,4 @@
1
1
  /// <reference types="react" />
2
+ export declare const PAYMENT_TIMER_TOTAL_TIME = 600000;
2
3
  export declare const PaymentTimer: () => JSX.Element;
3
4
  //# sourceMappingURL=PaymentTimer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PaymentTimer.d.ts","sourceRoot":"","sources":["../../../../src/iframe/payment/payment-page/PaymentTimer.tsx"],"names":[],"mappings":";AAIA,eAAO,MAAM,YAAY,mBAaxB,CAAC"}
1
+ {"version":3,"file":"PaymentTimer.d.ts","sourceRoot":"","sources":["../../../../src/iframe/payment/payment-page/PaymentTimer.tsx"],"names":[],"mappings":";AAMA,eAAO,MAAM,wBAAwB,SAAS,CAAC;AAE/C,eAAO,MAAM,YAAY,mBAkCxB,CAAC"}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=require("react"),o=(e=r)&&"object"==typeof e&&"default"in e?e.default:e;require("../../order-process/components/NavigationFooter/NavigationFooter.js");var t=require("@licklist/plugins/dist/context/payment/PaymentSessionContext");require("../../order-process/components/BookingSummary/BookingSummary.js"),require("../../order-process/components/NavigationSteps/NavigationSteps.js"),require("../../order-process/components/StepsForm/StepsForm.js");var s=require("../../order-process/components/Timer/Timer.js");require("../../order-process/components/PaymentCard/PaymentCard.js"),require("../../order-process/components/BookingSummaryFooter/BookingSummaryFooter.js"),require("../../order-process/components/CalendarStepsForm/CalendarStepsForm.js");exports.PaymentTimer=function(){var e=r.useContext(t.PaymentSessionContext),n=e.timer,i=e.startPaymentSessionTimer,a=e.isTimerStarted,m=e.setTimer;return r.useLayoutEffect((function(){m(600),a||i()}),[]),o.createElement(s.Timer,{timer:n})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=require("react"),o=(e=r)&&"object"==typeof e&&"default"in e?e.default:e;require("../../order-process/components/NavigationFooter/NavigationFooter.js");var t=require("@licklist/plugins/dist/context/payment/PaymentSessionContext"),s=require("@licklist/plugins/dist");require("../../order-process/components/BookingSummary/BookingSummary.js"),require("../../order-process/components/NavigationSteps/NavigationSteps.js"),require("../../order-process/components/StepsForm/StepsForm.js");var i=require("../../order-process/components/Timer/Timer.js");require("../../order-process/components/PaymentCard/PaymentCard.js"),require("../../order-process/components/BookingSummaryFooter/BookingSummaryFooter.js"),require("../../order-process/components/CalendarStepsForm/CalendarStepsForm.js");var n=6e5;exports.PAYMENT_TIMER_TOTAL_TIME=n,exports.PaymentTimer=function(){var e=s.useTimer({timerTime:n}),m=e.timer,a=e.startTimer,u=e.isTimerStarted,c=e.resetTimer,p=r.useContext(t.PaymentSessionContext),d=p.setIsPaymentSessionExpired,T=p.isResetTimer;return r.useEffect((function(){T&&c()}),[T]),r.useEffect((function(){m>1e3||(d(!0),c())}),[m]),r.useLayoutEffect((function(){u||a()}),[]),o.createElement(i.Timer,{timer:m})};
@@ -1 +1 @@
1
- {"version":3,"file":"ProductControl.d.ts","sourceRoot":"","sources":["../../../src/product-set/product/ProductControl.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,YAAY,EAMb,MAAM,kEAAkE,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,0DAA0D,CAAC;AAEvF,OAAO,EACL,mBAAmB,EACnB,UAAU,EACX,MAAM,8DAA8D,CAAC;AAEtE,OAAc,EACZ,WAAW,EAKZ,MAAM,OAAO,CAAC;AAef,OAAO,EACL,KAAK,EAEN,MAAM,sDAAsD,CAAC;AAO9D,OAAO,EAEL,oCAAoC,EACpC,qCAAqC,EACtC,MAAM,sDAAsD,CAAC;AAC9D,OAAO,EAEL,2BAA2B,EAC5B,MAAM,iCAAiC,CAAC;AAOzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAO5C,MAAM,WAAW,oBACf,SAAQ,UAAU,EAChB,2BAA2B,EAC3B,qCAAqC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,mBAAmB,CAAC,CAAC,CACpC,SAAQ,gBAAgB,EACtB,mBAAmB,CAAC,CAAC,CAAC,EACtB,oCAAoC,CAAC,CAAC,CAAC;IACzC,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,YAAY,CAAC;IAC3B,aAAa,EAAE,OAAO,CAAC;IACvB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,mBAAmB,EAAE,CAAC,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAChE,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,UAAU,EAAE,EACnD,SAAiB,EACjB,eAAe,EACf,aAAqB,EACrB,oBAA4B,EAC5B,QAAa,EACb,MAAM,EACN,mBAAmB,EACnB,WAAW,EACX,SAAS,EACT,YAAY,GACb,EAAE,mBAAmB,CAAC,CAAC,CAAC,eAigBxB"}
1
+ {"version":3,"file":"ProductControl.d.ts","sourceRoot":"","sources":["../../../src/product-set/product/ProductControl.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,YAAY,EAMb,MAAM,kEAAkE,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,0DAA0D,CAAC;AAEvF,OAAO,EACL,mBAAmB,EACnB,UAAU,EACX,MAAM,8DAA8D,CAAC;AAEtE,OAAc,EACZ,WAAW,EAKZ,MAAM,OAAO,CAAC;AAef,OAAO,EACL,KAAK,EAEN,MAAM,sDAAsD,CAAC;AAO9D,OAAO,EAEL,oCAAoC,EACpC,qCAAqC,EACtC,MAAM,sDAAsD,CAAC;AAC9D,OAAO,EAEL,2BAA2B,EAC5B,MAAM,iCAAiC,CAAC;AAOzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAO5C,MAAM,WAAW,oBACf,SAAQ,UAAU,EAChB,2BAA2B,EAC3B,qCAAqC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,mBAAmB,CAAC,CAAC,CACpC,SAAQ,gBAAgB,EACtB,mBAAmB,CAAC,CAAC,CAAC,EACtB,oCAAoC,CAAC,CAAC,CAAC;IACzC,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,YAAY,CAAC;IAC3B,aAAa,EAAE,OAAO,CAAC;IACvB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,mBAAmB,EAAE,CAAC,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAChE,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,UAAU,EAAE,EACnD,SAAiB,EACjB,eAAe,EACf,aAAqB,EACrB,oBAA4B,EAC5B,QAAa,EACb,MAAM,EACN,mBAAmB,EACnB,WAAW,EACX,SAAS,EACT,YAAY,GACb,EAAE,mBAAmB,CAAC,CAAC,CAAC,eAggBxB"}
@@ -1 +1 @@
1
- "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),a=require("react"),n=e(a),r=require("react-i18next"),o=e(require("react-bootstrap/Row")),l=e(require("react-bootstrap/Col")),i=require("react-bootstrap"),c=require("../../static/Icon.js"),s=require("react-hook-form"),m=e(require("@licklist/plugins/dist/services/Form/HookFormService")),d=require("@react-aria/utils"),u=require("../../static/switch/BooleanSwitch.js"),E=require("../../static/form-number-input/FormNumberInput.js");require("../../static/index.js");var p=require("../form/context.js"),g=require("@licklist/core/dist/DataMapper/Product/ProductCategoryDataMapper"),f=require("./booking-management/ProductBookingManagementControl.js"),C=require("./deposit/ProductDepositControl.js"),v=require("./quantity/ProductQuantityControl.js"),b=require("./quantity/ProductQuantityConstantControl.js"),h=require("./quantity/ProductQuantityRechargingControl.js"),F=e(require("react-bootstrap/Collapse")),I=require("@licklist/plugins/dist/hooks/Media/useImages"),P=require("@licklist/core/dist/DataMapper/Media/ImageDataMapper"),N=require("../../file-upload/FileUpload.js"),q=require("../../tiptap-editor/TipTapEditor.js"),y=require("./fixed-duration-fields/FixedDurationOptions.js"),k=require("./duration/ProductDurationControl.js"),x=require("./price/ProductPriceControl.js");exports.ProductControl=function(e){var T=e.isLoading,_=void 0!==T&&T,L=e.fieldNamePrefix,S=e.allowDeposits,w=void 0!==S&&S,j=e.hasBookingManagement,A=void 0!==j&&j,D=e.zoneList,G=void 0===D?[]:D,M=e.onCopy,B=e.onProductNameChange,R=e.productName,O=e.hasTicket,U=e.categoryType,Y=s.useFormContext(),Q=Y.register,V=Y.control,H=Y.formState.errors,z=Y.setValue,X=Y.getValues,W=Y.watch,Z=a.useContext(p.ProductSetLoadingContext),J=Z.setLoading,K=Z.providerHasBookingManagement,$=r.useTranslation("Design").t,ee=t.__read(a.useState(!1),2),te=ee[0],ae=ee[1],ne=t.__read(a.useState(null),2),re=ne[0],oe=ne[1],le=Boolean(W("".concat(L,".isUnlimited"))),ie=d.useId(),ce=d.useId(),se=d.useId(),me=d.useId(),de=d.useId(),ue=d.useId(),Ee=d.useId(),pe=d.useId(),ge=d.useId(),fe=d.useId(),Ce=d.useId(),ve=[{id:1,value:$("quantitySelector")},{id:2,value:$("stockControl")}],be=a.useCallback((function(){return ae((function(e){return!e}))}),[]),he=s.useWatch({control:V,name:"".concat(L,".quantitySelector")}),Fe=I.useImages(re),Ie=Fe.images,Pe=Fe.handleImageRemove,Ne=Fe.handleImageUploading,qe=Fe.isLoading,ye=a.useCallback((function(e){Ne(e,P.IMAGE_TYPE_IMAGE)}),[Ne]),ke=a.useCallback((function(e,t){Pe(String(e),t)}),[Pe]),xe=function(e){return e.target.select()};a.useEffect((function(){J(qe)}),[J,qe]),a.useEffect((function(){var e=X("".concat(L,".images"));oe(e)}),[X,oe,L]),a.useEffect((function(){Array.isArray(Ie)&&z("".concat(L,".images"),Ie)}),[Ie,L,z]);var Te=null!=he?he:"1",_e=g.QUANTITY_TYPE_LIST_DTO[Te];return n.createElement(n.Fragment,null,n.createElement(o,null,n.createElement(l,{lg:8,md:8},n.createElement(i.Form.Group,{controlId:ce},n.createElement(i.Form.Label,null,$("name")),n.createElement(i.Form.Control,t.__assign({},Q("".concat(L,".name")),{value:R,onChange:B,isInvalid:m.isInvalid("".concat(L,".name"),H),disabled:_,placeholder:$("name")})),n.createElement(i.Form.Control.Feedback,{type:"invalid"},m.getErrors("".concat(L,".name"),H))),n.createElement(i.Form.Group,{controlId:se},n.createElement(i.Form.Label,null,$("description")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange;return n.createElement(q.TipTapEditor,{withEmoji:!1,viewMode:!1,onUpdate:r,content:a,disabled:_})},control:V,name:"".concat(L,".description")}),n.createElement(i.Form.Control.Feedback,{type:"invalid"},m.getErrors("".concat(L,".description"),H))),w?n.createElement(o,null,n.createElement(C.ProductDepositControl,{isLoading:_,fieldNamePrefix:L}),n.createElement(x.ProductPriceControl,{isLoading:_,fieldNamePrefix:"".concat(L,".price"),title:$("totalPrice"),allowDeposits:w})):n.createElement(x.ProductPriceControl,{isLoading:_,fieldNamePrefix:"".concat(L,".price")}),n.createElement("div",null,n.createElement(v.ProductQuantityControl,{isLoading:_,fieldNamePrefix:L,onFocus:xe}),_e===g.QUANTITY_TYPE_CONSTANT&&n.createElement(b.ProductQuantityConstantControl,{isLoading:_,fieldNamePrefix:L,onFocus:xe,disabled:le}),_e===g.QUANTITY_TYPE_RECHARGING&&n.createElement(h.ProductQuantityRechargingControl,{isLoading:_,fieldNamePrefix:L,onFocus:xe,disabled:le}),n.createElement(i.Form.Group,{controlId:fe,className:"custom-checkbox"},n.createElement(i.Form.Check,t.__assign({custom:!0,type:"checkbox"},Q("".concat(L,".isUnlimited")),{name:"".concat(L,".isUnlimited"),disabled:_})),n.createElement(i.Form.Check.Label,null,$("isUnlimited")))),n.createElement(i.Form.Group,{controlId:pe},n.createElement(i.Form.Label,null,$("quantitySelectorType")),n.createElement(i.Form.Control,t.__assign({as:"select",defaultValue:O?ve[0].id:void 0},Q("".concat(L,".quantitySelector")),{isInvalid:m.isInvalid("".concat(L,".quantitySelector"),H),disabled:_||O}),ve.map((function(e){return n.createElement("option",{value:e.id,key:e.id},e.value)}))),n.createElement(i.Form.Control.Feedback,{type:"invalid"},m.getErrors("".concat(L,".quantitySelector"),H))))),U===g.CATEGORY_TYPE_FIXED_DURATION&&n.createElement(o,{className:"align-items-start"},n.createElement(k.ProductDurationControl,{fieldNamePrefix:L,providerHasBookingManagement:K}),n.createElement(l,{lg:4,md:4},n.createElement(E.FormNumberInput,{fieldName:"".concat(L,".capacity"),label:$("capacity")}))),U===g.CATEGORY_TYPE_GAME&&n.createElement(o,{className:"align-items-start"},n.createElement(l,{lg:4,md:4},n.createElement(E.FormNumberInput,{fieldName:"".concat(L,".capacity"),label:$("capacity"),rules:{min:{value:1,message:$("Validation:fieldRequired",{attribute:$("capacity")})}}})),n.createElement(l,{lg:4,md:4},n.createElement(E.FormNumberInput,{fieldName:"".concat(L,".duration"),label:$("durationMinutes"),rules:{min:{value:1,message:$("Validation:fieldRequired",{attribute:$("duration")})}}}))),n.createElement(o,null,n.createElement(l,{lg:8,md:8},n.createElement(i.Form.Group,{controlId:me},n.createElement(i.Form.Label,null,$("productTermsConditions")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name,l=t.ref;return n.createElement(i.Form.Control,{ref:l,as:"textarea",rows:3,value:a,onChange:r,isInvalid:m.isInvalid("".concat(L,".termsAndConditions"),H),disabled:_,name:o})},control:V,name:"".concat(L,".termsAndConditions")}),n.createElement(i.Form.Control.Feedback,{type:"invalid"},m.getErrors("".concat(L,".termsAndConditions"),H)))),n.createElement(l,{lg:4,md:4,className:"licklist-file-upload-wrapper"},n.createElement(N.FileUpload,{onFilesChange:ye,allowedExtensions:["jpeg","jpg","png"],subTitle:".jpeg .jpg .png",enablePreview:!0,onFileRemove:ke,defaultFiles:Ie,isLoading:qe,withIcon:!0,title:$("addImage")}))),n.createElement(l,{lg:12,md:12,xl:!0,className:"p-0"},n.createElement(i.Form.Group,{controlId:de,className:"advanced-switch-container"},n.createElement(i.Form.Label,null,$("isAvailable")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(u.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:_})},control:V,name:"".concat(L,".isAvailable")})),n.createElement(i.Form.Group,{controlId:ue,className:"advanced-switch-container"},n.createElement(i.Form.Label,null,$("isSoldOut")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(u.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:_})},control:V,name:"".concat(L,".isSoldOut")})),n.createElement(i.Form.Group,{controlId:ie,className:"custom-checkbox"},n.createElement(i.Form.Check,{custom:!0,type:"checkbox",name:ie,disabled:_},n.createElement(i.Form.Check.Input,{checked:te,onChange:be,type:"checkbox"}),n.createElement(i.Form.Check.Label,null,$("showAdvancedOptions"))))),n.createElement(l,{lg:12,md:12,xl:!0,className:"p-0"},n.createElement(F,{in:te},n.createElement("div",null,n.createElement(i.Form.Group,{controlId:Ee,className:"advanced-switch-container"},n.createElement(i.Form.Label,null,$("isRequired")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(u.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:_})},control:V,name:"".concat(L,".isRequired")})),n.createElement(i.Form.Group,{controlId:ge,className:"advanced-switch-container"},n.createElement(i.Form.Label,null,$("hasSpecialNotes")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(u.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:_})},control:V,name:"".concat(L,".hasSpecialNotes")})),U===g.CATEGORY_TYPE_FIXED_DURATION&&n.createElement(y.FixedDurationOptions,{fieldNamePrefix:L}),n.createElement(i.Form.Group,{controlId:Ce,className:"advanced-switch-container"},n.createElement(x.ProductPriceControl,{title:$("minSpend"),isRequired:!1,isMoreThanZero:!0,allowDeposits:!1,isLoading:_,fieldNamePrefix:"".concat(L,".minSpend")})))),n.createElement(o,null,n.createElement(l,{xs:12},A&&n.createElement(f.ProductBookingManagementControl,{isLoading:_,zoneList:G,fieldNamePrefix:L})))),n.createElement(o,null,n.createElement(l,{xs:!0},n.createElement("div",{className:"d-flex justify-content-end mt-4"},Boolean(M)&&n.createElement(i.Button,{onClick:M,variant:"link",className:"d-flex align-items-center"},n.createElement(c.default,{type:"clipboard",height:"1rem",className:"mr-2"})," ",$("copy"))))))};
1
+ "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),a=require("react"),n=e(a),r=require("react-i18next"),o=e(require("react-bootstrap/Row")),l=e(require("react-bootstrap/Col")),i=require("react-bootstrap"),c=require("../../static/Icon.js"),s=require("react-hook-form"),m=e(require("@licklist/plugins/dist/services/Form/HookFormService")),d=require("@react-aria/utils"),u=require("../../static/switch/BooleanSwitch.js"),E=require("../../static/form-number-input/FormNumberInput.js");require("../../static/index.js");var p=require("../form/context.js"),g=require("@licklist/core/dist/DataMapper/Product/ProductCategoryDataMapper"),f=require("./booking-management/ProductBookingManagementControl.js"),C=require("./deposit/ProductDepositControl.js"),v=require("./quantity/ProductQuantityControl.js"),b=require("./quantity/ProductQuantityConstantControl.js"),h=require("./quantity/ProductQuantityRechargingControl.js"),F=e(require("react-bootstrap/Collapse")),I=require("@licklist/plugins/dist/hooks/Media/useImages"),P=require("@licklist/core/dist/DataMapper/Media/ImageDataMapper"),N=require("../../file-upload/FileUpload.js"),q=require("../../tiptap-editor/TipTapEditor.js"),y=require("./fixed-duration-fields/FixedDurationOptions.js"),k=require("./duration/ProductDurationControl.js"),x=require("./price/ProductPriceControl.js");exports.ProductControl=function(e){var T=e.isLoading,_=void 0!==T&&T,L=e.fieldNamePrefix,S=e.allowDeposits,w=void 0!==S&&S,j=e.hasBookingManagement,A=void 0!==j&&j,G=e.zoneList,D=void 0===G?[]:G,M=e.onCopy,R=e.onProductNameChange,B=e.productName,Y=e.hasTicket,O=e.categoryType,U=s.useFormContext(),Q=U.register,V=U.control,H=U.formState.errors,z=U.setValue,X=U.getValues,W=U.watch,Z=a.useContext(p.ProductSetLoadingContext),J=Z.setLoading,K=Z.providerHasBookingManagement,$=r.useTranslation("Design").t,ee=t.__read(a.useState(!1),2),te=ee[0],ae=ee[1],ne=t.__read(a.useState(null),2),re=ne[0],oe=ne[1],le=Boolean(W("".concat(L,".isUnlimited"))),ie=d.useId(),ce=d.useId(),se=d.useId(),me=d.useId(),de=d.useId(),ue=d.useId(),Ee=d.useId(),pe=d.useId(),ge=d.useId(),fe=d.useId(),Ce=d.useId(),ve=[{id:1,value:$("quantitySelector")},{id:2,value:$("stockControl")}],be=a.useCallback((function(){return ae((function(e){return!e}))}),[]),he=s.useWatch({control:V,name:"".concat(L,".quantitySelector")}),Fe=I.useImages(re),Ie=Fe.images,Pe=Fe.handleImageRemove,Ne=Fe.handleImageUploading,qe=Fe.isLoading,ye=a.useCallback((function(e){Ne(e,P.IMAGE_TYPE_IMAGE)}),[Ne]),ke=a.useCallback((function(e,t){Pe(String(e),t)}),[Pe]),xe=function(e){return e.target.select()};a.useEffect((function(){J(qe)}),[J,qe]),a.useEffect((function(){var e=X("".concat(L,".images"));oe(e)}),[X,oe,L]),a.useEffect((function(){Array.isArray(Ie)&&z("".concat(L,".images"),Ie)}),[Ie,L,z]);var Te=null!=he?he:"1",_e=g.QUANTITY_TYPE_LIST_DTO[Te];return n.createElement(n.Fragment,null,n.createElement(o,null,n.createElement(l,{lg:8,md:8},n.createElement(i.Form.Group,{controlId:ce},n.createElement(i.Form.Label,null,$("name")),n.createElement(i.Form.Control,t.__assign({},Q("".concat(L,".name")),{value:B,onChange:R,isInvalid:m.isInvalid("".concat(L,".name"),H),disabled:_,placeholder:$("name")})),n.createElement(i.Form.Control.Feedback,{type:"invalid"},m.getErrors("".concat(L,".name"),H))),n.createElement(i.Form.Group,{controlId:se},n.createElement(i.Form.Label,null,$("description")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange;return n.createElement(q.TipTapEditor,{withEmoji:!1,viewMode:!1,onUpdate:r,content:a,disabled:_})},control:V,name:"".concat(L,".description")}),n.createElement(i.Form.Control.Feedback,{type:"invalid"},m.getErrors("".concat(L,".description"),H))),w?n.createElement(o,null,n.createElement(C.ProductDepositControl,{isLoading:_,fieldNamePrefix:L}),n.createElement(x.ProductPriceControl,{isLoading:_,fieldNamePrefix:"".concat(L,".price"),title:$("totalPrice"),allowDeposits:w})):n.createElement(x.ProductPriceControl,{isLoading:_,fieldNamePrefix:"".concat(L,".price")}),n.createElement("div",null,n.createElement(v.ProductQuantityControl,{isLoading:_,fieldNamePrefix:L,onFocus:xe}),_e===g.QUANTITY_TYPE_CONSTANT&&n.createElement(b.ProductQuantityConstantControl,{isLoading:_,fieldNamePrefix:L,onFocus:xe,disabled:le}),_e===g.QUANTITY_TYPE_RECHARGING&&n.createElement(h.ProductQuantityRechargingControl,{isLoading:_,fieldNamePrefix:L,onFocus:xe,disabled:le}),n.createElement(i.Form.Group,{controlId:fe,className:"custom-checkbox"},n.createElement(i.Form.Check,t.__assign({custom:!0,type:"checkbox"},Q("".concat(L,".isUnlimited")),{name:"".concat(L,".isUnlimited"),disabled:_})),n.createElement(i.Form.Check.Label,null,$("isUnlimited")))),n.createElement(i.Form.Group,{controlId:pe},n.createElement(i.Form.Label,null,$("quantitySelectorType")),n.createElement(i.Form.Control,t.__assign({as:"select",defaultValue:Y?ve[0].id:void 0},Q("".concat(L,".quantitySelector")),{isInvalid:m.isInvalid("".concat(L,".quantitySelector"),H),disabled:_||Y}),ve.map((function(e){return n.createElement("option",{value:e.id,key:e.id},e.value)}))),n.createElement(i.Form.Control.Feedback,{type:"invalid"},m.getErrors("".concat(L,".quantitySelector"),H))))),O===g.CATEGORY_TYPE_FIXED_DURATION&&n.createElement(o,{className:"align-items-start"},n.createElement(k.ProductDurationControl,{fieldNamePrefix:L,providerHasBookingManagement:K}),n.createElement(l,{lg:4,md:4},n.createElement(E.FormNumberInput,{fieldName:"".concat(L,".capacity"),label:$("capacity")}))),O===g.CATEGORY_TYPE_GAME&&n.createElement(o,{className:"align-items-start"},n.createElement(l,{lg:4,md:4},n.createElement(E.FormNumberInput,{fieldName:"".concat(L,".capacity"),label:$("capacity"),rules:{min:{value:1,message:$("Validation:fieldRequired",{attribute:$("capacity")})}}})),n.createElement(l,{lg:4,md:4},n.createElement(E.FormNumberInput,{fieldName:"".concat(L,".duration"),label:$("durationMinutes"),rules:{min:{value:1,message:$("Validation:fieldRequired",{attribute:$("duration")})}}}))),n.createElement(o,null,n.createElement(l,{lg:8,md:8},n.createElement(i.Form.Group,{controlId:me},n.createElement(i.Form.Label,null,$("productTermsConditions")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name,l=t.ref;return n.createElement(i.Form.Control,{ref:l,as:"textarea",rows:3,value:a,onChange:r,isInvalid:m.isInvalid("".concat(L,".termsAndConditions"),H),disabled:_,name:o})},control:V,name:"".concat(L,".termsAndConditions")}),n.createElement(i.Form.Control.Feedback,{type:"invalid"},m.getErrors("".concat(L,".termsAndConditions"),H)))),n.createElement(l,{lg:4,md:4,className:"licklist-file-upload-wrapper"},n.createElement(N.FileUpload,{onFilesChange:ye,allowedExtensions:["jpeg","jpg","png"],subTitle:".jpeg .jpg .png",enablePreview:!0,onFileRemove:ke,defaultFiles:Ie,isLoading:qe,withIcon:!0,title:$("addImage")}))),n.createElement(l,{lg:12,md:12,xl:!0,className:"p-0"},n.createElement(i.Form.Group,{controlId:de,className:"advanced-switch-container"},n.createElement(i.Form.Label,null,$("isAvailable")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(u.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:_})},control:V,name:"".concat(L,".isAvailable")})),n.createElement(i.Form.Group,{controlId:ue,className:"advanced-switch-container"},n.createElement(i.Form.Label,null,$("isSoldOut")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(u.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:_})},control:V,name:"".concat(L,".isSoldOut")})),n.createElement(i.Form.Group,{controlId:ie,className:"custom-checkbox"},n.createElement(i.Form.Check,{custom:!0,type:"checkbox",name:ie,disabled:_},n.createElement(i.Form.Check.Input,{checked:te,onChange:be,type:"checkbox"}),n.createElement(i.Form.Check.Label,null,$("showAdvancedOptions"))))),n.createElement(l,{lg:12,md:12,xl:!0,className:"p-0"},n.createElement(F,{in:te},n.createElement("div",null,n.createElement(i.Form.Group,{controlId:Ee,className:"advanced-switch-container"},n.createElement(i.Form.Label,null,$("isRequired")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(u.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:_})},control:V,name:"".concat(L,".isRequired")})),n.createElement(i.Form.Group,{controlId:ge,className:"advanced-switch-container"},n.createElement(i.Form.Label,null,$("hasSpecialNotes")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(u.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:_})},control:V,name:"".concat(L,".hasSpecialNotes")})),[g.CATEGORY_TYPE_GAME,g.CATEGORY_TYPE_FIXED_DURATION].includes(O)&&n.createElement(y.FixedDurationOptions,{fieldNamePrefix:L}),n.createElement(i.Form.Group,{controlId:Ce,className:"advanced-switch-container"},n.createElement(x.ProductPriceControl,{title:$("minSpend"),isRequired:!1,isMoreThanZero:!0,allowDeposits:!1,isLoading:_,fieldNamePrefix:"".concat(L,".minSpend")})))),n.createElement(o,null,n.createElement(l,{xs:12},A&&n.createElement(f.ProductBookingManagementControl,{isLoading:_,zoneList:D,fieldNamePrefix:L})))),n.createElement(o,null,n.createElement(l,{xs:!0},n.createElement("div",{className:"d-flex justify-content-end mt-4"},Boolean(M)&&n.createElement(i.Button,{onClick:M,variant:"link",className:"d-flex align-items-center"},n.createElement(c.default,{type:"clipboard",height:"1rem",className:"mr-2"})," ",$("copy"))))))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),r=require("react"),l=(e=r)&&"object"==typeof e&&"default"in e?e.default:e,n=require("react-i18next"),o=require("react-bootstrap"),a=require("react-hook-form"),i=require("@licklist/core/dist/DataMapper/Order/OrderDataMapper"),s=require("@licklist/plugins/dist/context/booking/BookingContext"),c=[i.ORDER_STATUS_PENDING,i.ORDER_STATUS_CANCELLED,i.ORDER_STATUS_COMPLETED,i.ORDER_STATUS_ACTION_REQUIRED];exports.AdditionalFilterSection=function(){var e=n.useTranslation("Design").t,i=r.useContext(s.BookingContext),m=i.filters,u=i.setFilters,E=a.useForm({defaultValues:m}),d=E.handleSubmit,p=E.register,f=E.reset;return r.useEffect((function(){f(m)}),[m,f]),l.createElement("div",{className:"additional-filter-section"},l.createElement(o.Form,{onSubmit:d((function(e){u(e)}))},l.createElement(o.Row,null,l.createElement(o.Col,{md:"3"},l.createElement(o.Form.Group,null,l.createElement(o.Form.Label,null,e("staffMember")),l.createElement(o.Form.Control,t.__assign({},p("staffMember"),{as:"select"}),l.createElement("option",{value:""},e("Design:choose"))))),l.createElement(o.Col,{md:"3"},l.createElement(o.Form.Group,null,l.createElement(o.Form.Label,null,e("bookingStatus")),l.createElement(o.Form.Control,t.__assign({},p("status"),{as:"select"}),l.createElement("option",{value:""},e("Design:choose")),Object.keys(c).map((function(t){return l.createElement("option",{key:c[t],value:c[t]},e("Design:".concat(c[t])))}))))),l.createElement(o.Col,{md:"3"},l.createElement(o.Form.Group,null,l.createElement(o.Form.Label,null,e("date")),l.createElement(o.Form.Control,t.__assign({},p("date"),{type:"date"})))),l.createElement(o.Col,{md:"3",className:"d-flex align-items-end"},l.createElement(o.Form.Group,null,l.createElement(o.Button,{type:"submit",className:"shadow-none"},e("apply")))))))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),r=require("react"),a=(e=r)&&"object"==typeof e&&"default"in e?e.default:e,n=require("react-i18next"),l=require("react-bootstrap"),o=require("react-hook-form"),i=require("@licklist/core/dist/DataMapper/Order/OrderDataMapper"),s=require("@licklist/plugins/dist/context/booking/BookingContext"),c=[i.ORDER_STATUS_PENDING,i.ORDER_STATUS_CANCELLED,i.ORDER_STATUS_COMPLETED,i.ORDER_STATUS_ACTION_REQUIRED];exports.AdditionalFilterSection=function(){var e=n.useTranslation("Design").t,i=r.useContext(s.BookingContext),m=i.filters,u=i.setFilters,E=o.useForm({defaultValues:m}),d=E.handleSubmit,p=E.register,f=E.reset;return r.useEffect((function(){f(m)}),[m,f]),a.createElement("div",{className:"additional-filter-section"},a.createElement(l.Form,{onSubmit:d((function(e){u(e)}))},a.createElement(l.Row,{className:"additional-filter-container"},a.createElement(l.Col,{md:"3"},a.createElement(l.Form.Group,null,a.createElement(l.Form.Label,null,e("staffMember")),a.createElement(l.Form.Control,t.__assign({},p("staffMember"),{as:"select"}),a.createElement("option",{value:""},e("Design:choose"))))),a.createElement(l.Col,{md:"3"},a.createElement(l.Form.Group,null,a.createElement(l.Form.Label,null,e("bookingStatus")),a.createElement(l.Form.Control,t.__assign({},p("status"),{as:"select"}),a.createElement("option",{value:""},e("Design:choose")),Object.keys(c).map((function(t){return a.createElement("option",{key:c[t],value:c[t]},e("Design:".concat(c[t])))}))))),a.createElement(l.Col,{className:"date-container"},a.createElement(l.Form.Group,null,a.createElement(l.Form.Label,null,e("date")),a.createElement(l.Form.Control,t.__assign({},p("date"),{type:"date"})))),a.createElement(l.Col,{md:"3",className:"d-flex align-items-end"},a.createElement(l.Form.Group,null,a.createElement(l.Button,{type:"submit",className:"shadow-none"},e("apply")))))))};
@@ -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;AAYjE,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,gBA0WjB,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;AAYjE,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,gBA4WjB,CAAC"}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),l=require("react"),n=(e=l)&&"object"==typeof e&&"default"in e?e.default:e,r=require("react-i18next"),o=require("react-bootstrap"),a=require("react-hook-form"),i=require("luxon"),m=require("@licklist/core/dist/DataMapper/Product/CouponDataMapper");exports.CouponFormControl=function(e){var u,s,d,c,E,p,g,F,v,C=e.isLoading,b=void 0!==C&&C,_=e.productGroups,f=a.useFormContext(),D=f.register,y=f.setValue,T=f.getValues,P=f.formState.errors,x=f.watch,O=r.useTranslation(["Design","Notification","App"]).t,G=t.__read(l.useState([]),2),N=G[0],R=G[1],k=x("startFrom"),L=x("validTill"),A=l.useRef(null),h=l.useRef(null),w=((u={})[m.COUPON_TYPE_FIXED]=O("Design:fixed"),u[m.COUPON_TYPE_FIXED_PER_PERSON]=O("Design:fixedPerPerson"),u[m.COUPON_TYPE_PERCENTAGE]=O("Design:percentage"),u[m.COUPON_TYPE_PERCENTAGE_PER_PERSON]=O("Design:percentagePerPerson"),u),q=((s={})[m.COUPON_TOTAL_TYPE_GROSS]=O("Design:grossTotal"),s[m.COUPON_TOTAL_TYPE_TOTAL]=O("Design:depositTotal"),s);return l.useEffect((function(){R(T("productGroupIds"))}),[T]),l.useEffect((function(){y("productGroupIds",N)}),[T,y,N]),n.createElement(o.Row,null,n.createElement(o.Col,{md:5},n.createElement("h2",{className:"mb-5"},O("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,O("Design:name")),n.createElement(o.Form.Control,t.__assign({isInvalid:void 0!==P.name},D("name",{required:O("Validation:fieldRequired",{attribute:O("Design:name")})}),{disabled:b})),n.createElement(o.Form.Control.Feedback,{type:"invalid"},null===(d=null==P?void 0:P.name)||void 0===d?void 0:d.message))),n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:couponCode")),n.createElement(o.Form.Control,t.__assign({isInvalid:void 0!==P.code},D("code",{required:O("Validation:fieldRequired",{attribute:O("Design:code")})}),{disabled:b})),n.createElement(o.Form.Control.Feedback,{type:"invalid"},null===(c=null==P?void 0:P.code)||void 0===c?void 0:c.message)))),n.createElement(o.Row,null,n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:discountType")),n.createElement(o.Form.Control,t.__assign({},D("discountType",{required:!0}),{as:"select",defaultValue:null!==(E=T("discountType"))&&void 0!==E?E:1,disabled:b}),Object.keys(w).map((function(e){return n.createElement("option",{value:e,key:e},w[e])}))))),n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:discount")),n.createElement(o.Form.Control,t.__assign({type:"number",isInvalid:void 0!==P.discount},D("discount",{required:O("Validation:fieldRequired",{attribute:O("Design:discount")})}),{disabled:b})),n.createElement(o.Form.Control.Feedback,{type:"invalid"},null===(p=null==P?void 0:P.discount)||void 0===p?void 0:p.message)))),n.createElement(o.Row,null,n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:applyOn")),n.createElement(o.Form.Control,t.__assign({},D("totalType",{required:!0}),{as:"select",defaultValue:null!==(g=T("totalType"))&&void 0!==g?g:1,disabled:b}),Object.keys(q).map((function(e){return n.createElement("option",{value:e,key:e},q[e])}))))))),n.createElement(o.Col,{md:{span:5,offset:1}},n.createElement("h2",{className:"mb-5"},O("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,O("Design:startFrom")),n.createElement(o.Form.Control,t.__assign({type:"date"},D("startFrom"),{value:k,isInvalid:void 0!==P.startFrom,onChange:function(e){var t=i.DateTime.fromSQL(e.target.value).toISODate();y("startFrom",t)},className:k&&"date-input-with-value",ref:A,onClick:function(){var e;return null===(e=null==A?void 0:A.current)||void 0===e?void 0:e.showPicker()},disabled:b})),n.createElement(o.Form.Control.Feedback,{type:"invalid"},null===(F=null==P?void 0:P.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,O("Design:validTill")),n.createElement(o.Form.Control,t.__assign({type:"date"},D("validTill"),{onChange:function(e){var t=i.DateTime.fromSQL(e.target.value).toISODate();y("validTill",t)},ref:h,className:L&&"date-input-with-value",onClick:function(){var e;return null===(e=null==h?void 0:h.current)||void 0===e?void 0:e.showPicker()},disabled:b}))))),_&&(null==_?void 0:_.length)>0&&n.createElement(o.Row,null,n.createElement(o.Col,{md:12},n.createElement("h5",{className:"mt-4"},O("Design:productGroups")),n.createElement(o.Form.Group,{className:"d-flex flex-wrap justify-content-between mt-4 mb-5"},null==_?void 0:_.map((function(e){var l,r,a=null!==(r=null===(l=T("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?R((function(l){return Array.from(new Set(t.__spreadArray(t.__spreadArray([],t.__read(l),!1),[String(e.id)],!1)))})):R((function(t){return t.filter((function(t){return String(e.id)!==t}))}))}})})),n.createElement(o.Form.Control,t.__assign({},D("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,O("Design:totalCoupons")),n.createElement(o.Form.Control,{type:"number",isInvalid:void 0!==P.totalCoupons,disabled:b}),n.createElement(o.Form.Control.Feedback,{type:"invalid"},null===(v=null==P?void 0:P.totalCoupons)||void 0===v?void 0:v.message))),n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:usesPerUser")),n.createElement(o.Form.Control,t.__assign({type:"number"},D("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,O("Design:useAgain")),n.createElement(o.Form.Control,t.__assign({type:"number"},D("useAgain"),{disabled:b})),n.createElement(o.Form.Text,{className:"text-muted"},O("Design:useAgainExplanation")))),n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:usesPerUserDay")),n.createElement(o.Form.Control,t.__assign({type:"number"},D("usesPerUserDay"),{disabled:b})),n.createElement(o.Form.Text,{className:"text-muted"},O("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,O("Design:minAmount")),n.createElement(o.Form.Control,t.__assign({type:"number"},D("minAmount"),{disabled:b})),n.createElement(o.Form.Text,{className:"text-muted"},O("Design:minAmountExplanation")))),n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:maxAmount")),n.createElement(o.Form.Control,t.__assign({type:"number"},D("maxAmount"),{disabled:b})),n.createElement(o.Form.Text,{className:"text-muted"},O("Design:maxAmountExplanation")))))))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),l=require("react"),n=(e=l)&&"object"==typeof e&&"default"in e?e.default:e,r=require("react-i18next"),o=require("react-bootstrap"),a=require("react-hook-form"),i=require("luxon"),m=require("@licklist/core/dist/DataMapper/Product/CouponDataMapper");exports.CouponFormControl=function(e){var u,s,d,c,E,p,g,F,v,C=e.isLoading,_=void 0!==C&&C,b=e.productGroups,f=a.useFormContext(),D=f.register,y=f.setValue,T=f.getValues,P=f.formState.errors,x=f.watch,O=r.useTranslation(["Design","Notification","App"]).t,G=t.__read(l.useState([]),2),N=G[0],R=G[1],k=x("startFrom"),L=x("validTill"),A=l.useRef(null),h=l.useRef(null),w=((u={})[m.COUPON_TYPE_FIXED]=O("Design:fixed"),u[m.COUPON_TYPE_FIXED_PER_PERSON]=O("Design:fixedPerPerson"),u[m.COUPON_TYPE_PERCENTAGE]=O("Design:percentage"),u[m.COUPON_TYPE_PERCENTAGE_PER_PERSON]=O("Design:percentagePerPerson"),u),q=((s={})[m.COUPON_TOTAL_TYPE_GROSS]=O("Design:grossTotal"),s[m.COUPON_TOTAL_TYPE_TOTAL]=O("Design:depositTotal"),s);return l.useEffect((function(){R(T("productGroupIds"))}),[T]),l.useEffect((function(){y("productGroupIds",N)}),[T,y,N]),n.createElement(o.Row,null,n.createElement(o.Col,{md:5},n.createElement("h2",{className:"mb-5"},O("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,O("Design:name")),n.createElement(o.Form.Control,t.__assign({isInvalid:void 0!==P.name},D("name",{required:O("Validation:fieldRequired",{attribute:O("Design:name")})}),{disabled:_})),n.createElement(o.Form.Control.Feedback,{type:"invalid"},null===(d=null==P?void 0:P.name)||void 0===d?void 0:d.message))),n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:couponCode")),n.createElement(o.Form.Control,t.__assign({isInvalid:void 0!==P.code},D("code",{required:O("Validation:fieldRequired",{attribute:O("Design:code")})}),{disabled:_})),n.createElement(o.Form.Control.Feedback,{type:"invalid"},null===(c=null==P?void 0:P.code)||void 0===c?void 0:c.message)))),n.createElement(o.Row,null,n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:discountType")),n.createElement(o.Form.Control,t.__assign({},D("discountType",{required:!0}),{as:"select",defaultValue:null!==(E=T("discountType"))&&void 0!==E?E:1,disabled:_}),Object.keys(w).map((function(e){return n.createElement("option",{value:e,key:e},w[e])}))))),n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:discount")),n.createElement(o.Form.Control,t.__assign({type:"number",isInvalid:void 0!==P.discount},D("discount",{required:O("Validation:fieldRequired",{attribute:O("Design:discount")})}),{disabled:_})),n.createElement(o.Form.Control.Feedback,{type:"invalid"},null===(p=null==P?void 0:P.discount)||void 0===p?void 0:p.message)))),n.createElement(o.Row,null,n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:applyOn")),n.createElement(o.Form.Control,t.__assign({},D("totalType",{required:!0}),{as:"select",defaultValue:null!==(g=T("totalType"))&&void 0!==g?g:1,disabled:_}),Object.keys(q).map((function(e){return n.createElement("option",{value:e,key:e},q[e])}))))))),n.createElement(o.Col,{md:{span:5,offset:1}},n.createElement("h2",{className:"mb-5"},O("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,O("Design:startFrom")),n.createElement(o.Form.Control,t.__assign({type:"date"},D("startFrom"),{value:k,isInvalid:void 0!==P.startFrom,onChange:function(e){var t=i.DateTime.fromSQL(e.target.value).toISODate();y("startFrom",t)},className:k&&"date-input-with-value",ref:A,onClick:function(){var e;return null===(e=null==A?void 0:A.current)||void 0===e?void 0:e.showPicker()},disabled:_})),n.createElement(o.Form.Control.Feedback,{type:"invalid"},null===(F=null==P?void 0:P.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,O("Design:validTill")),n.createElement(o.Form.Control,t.__assign({type:"date"},D("validTill"),{value:L,onChange:function(e){var t=i.DateTime.fromSQL(e.target.value).toISODate();y("validTill",t)},ref:h,className:L&&"date-input-with-value",onClick:function(){var e;return null===(e=null==h?void 0:h.current)||void 0===e?void 0:e.showPicker()},disabled:_}))))),b&&(null==b?void 0:b.length)>0&&n.createElement(o.Row,null,n.createElement(o.Col,{md:12},n.createElement("h5",{className:"mt-4"},O("Design:productGroups")),n.createElement(o.Form.Group,{className:"d-flex flex-wrap justify-content-between mt-4 mb-5"},null==b?void 0:b.map((function(e){var l,r,a=null!==(r=null===(l=T("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:_,onChange:function(l){l.target.checked?R((function(l){return Array.from(new Set(t.__spreadArray(t.__spreadArray([],t.__read(l),!1),[String(e.id)],!1)))})):R((function(t){return t.filter((function(t){return String(e.id)!==t}))}))}})})),n.createElement(o.Form.Control,t.__assign({},D("productGroupIds"),{hidden:!0,value:N,disabled:_}))))),n.createElement(o.Row,null,n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:totalCoupons")),n.createElement(o.Form.Control,t.__assign({},D("totalCoupons"),{type:"number",isInvalid:void 0!==P.totalCoupons,disabled:_})),n.createElement(o.Form.Control.Feedback,{type:"invalid"},null===(v=null==P?void 0:P.totalCoupons)||void 0===v?void 0:v.message))),n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:usesPerUser")),n.createElement(o.Form.Control,t.__assign({type:"number"},D("usesPerUser"),{disabled:_}))))),n.createElement(o.Row,null,n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:useAgain")),n.createElement(o.Form.Control,t.__assign({type:"number"},D("useAgain"),{disabled:_})),n.createElement(o.Form.Text,{className:"text-muted"},O("Design:useAgainExplanation")))),n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:usesPerUserDay")),n.createElement(o.Form.Control,t.__assign({type:"number"},D("usesPerUserDay"),{disabled:_})),n.createElement(o.Form.Text,{className:"text-muted"},O("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,O("Design:minAmount")),n.createElement(o.Form.Control,t.__assign({type:"number"},D("minAmount"),{disabled:_})),n.createElement(o.Form.Text,{className:"text-muted"},O("Design:minAmountExplanation")))),n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:maxAmount")),n.createElement(o.Form.Control,t.__assign({type:"number"},D("maxAmount"),{disabled:_})),n.createElement(o.Form.Text,{className:"text-muted"},O("Design:maxAmountExplanation")))))))};
@@ -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"),i=e(a),r=require("react-i18next"),l=e(require("@licklist/plugins/dist/context/app/hooks/useNotification")),n=require("react-bootstrap"),s=require("../../../static/Icon.js"),o=require("react-hook-form"),d=e(require("clsx")),u=require("../../../static/manual-date-picker/utils/index.js"),m=require("../../../static/manual-date-picker/ManualDatePicker.js");require("../../../static/index.js");var c=require("../../../static/manual-date-picker/hooks/useManualDatePicker.js"),v=e(require("@licklist/plugins/dist/validation/Rules/lettersRule")),p=require("@licklist/plugins/dist"),h=require("@licklist/core/dist/Config/DefaultUser");exports.CreateUser=function(e){var f,b=e.goToSearchUsers,N=e.providerId,g=r.useTranslation(["Sale","Design","App","Validation"]).t,E=l(),_=p.useDashboardUserApi(N).create,k=o.useFormContext(),y=k.formState,D=y.errors,F=y.isSubmitted,S=k.register,q=k.setValue,x=k.watch,C=k.getValues,I=x("birthdate"),V=x("firstName"),A=t.__read(c.useManualDatePicker({isRequired:!1,isSubmitted:F,fieldName:"birthdate",value:I,fieldErrors:p.HookFormService.getErrors("birthdate",D)}),2),L=A[0],R=A[1],j=R.isChoosedDateValid,U=R.fieldErrors,M=L.day,T=L.year,w=L.month;a.useEffect((function(){M&&w&&T&&j()&&q("birthdate",u.dateToSqlDate(M,w,T),{shouldValidate:!0})}),[M,w,T]);return i.createElement(i.Fragment,null,i.createElement(n.Button,{as:"button",type:"button",onClick:b,variant:"primary",className:"mb-4 mt-4 align-items-center d-flex"},g("Design:search"),i.createElement(s.default,{type:"search",height:"1.4rem",width:"1.4rem",className:"ml-3"})),i.createElement("div",{className:"input-label"},g("Design:firstName"),i.createElement("span",{className:"text-danger"},"*")),i.createElement(n.Form.Control,t.__assign({type:"text",isInvalid:!!(null==D?void 0:D.firstName)},S("firstName",{pattern:v,maxLength:255,required:!0}))),i.createElement(n.Form.Control.Feedback,{type:"invalid"},p.HookFormService.hasError(null==D?void 0:D.firstName,"required")&&g("Validation:fieldRequired",{attribute:g("Design:firstName")}),p.HookFormService.hasError(null==D?void 0:D.firstName,"pattern")&&g("Sale:fieldIsNotValid",{attribute:g("Design:firstName")})),i.createElement("div",{className:"input-label"},g("Design:lastName")),i.createElement(n.Form.Control,t.__assign({type:"text",isInvalid:!!(null==D?void 0:D.lastName)},S("lastName",{pattern:v,maxLength:255}))),i.createElement(n.Form.Control.Feedback,{type:"invalid"},(null==D?void 0:D.lastName)&&g("Sale:fieldIsNotValid",{attribute:g("Design:lastName")})),i.createElement("div",{className:"input-label"},g("Design:email")),i.createElement(n.Form.Control,t.__assign({type:"text",isInvalid:p.HookFormService.isInvalid("email",D)},S("email",{pattern:p.emailRule,maxLength:255}))),i.createElement(n.Form.Control.Feedback,{type:"invalid"},(null==D?void 0:D.email)&&g("Sale:fieldIsNotValid",{attribute:g("Design:email")})),i.createElement("div",{className:"input-label"},g("Design:phone")),i.createElement(n.Form.Control,t.__assign({type:"number"},S("phone",{pattern:p.phoneRule,maxLength:255}),{isInvalid:!!(null==D?void 0:D.phone)})),i.createElement(n.Form.Control.Feedback,{type:"invalid"},(null==D?void 0:D.phone)&&g("Sale:fieldIsNotValid",{attribute:"phone number"})),i.createElement("div",{className:"input-label"},g("Design:dayOfBirthShort")),i.createElement(n.Form.Control,t.__assign({type:"hidden"},S("birthdate",{validate:function(e){return!e||(!!p.checkIsValidBirthday(e)||"".concat(g("Sale:fieldIsNotValid",{attribute:g("App:birthday")})))}}),{isInvalid:!!D.birthdate,className:d("datetime-form-picker",I&&"date-input-with-value")})),i.createElement("div",{className:"d-flex"},i.createElement(m.ManualDatePicker,t.__assign({},L,{isRequred:!1}))),i.createElement(n.Form.Control.Feedback,{type:"invalid"},(null===(f=null==D?void 0:D.birthdate)||void 0===f?void 0:f.message)||U()),i.createElement(n.Button,{as:"button",type:"button",onClick:function(){return t.__awaiter(void 0,void 0,void 0,(function(){var e,a,i,r,l,n,s;return t.__generator(this,(function(o){switch(o.label){case 0:return e=C(),[4,_.execute({first_name:e.firstName,last_name:e.lastName,email:e.email,user_detail:{phone:e.phone,birthday:e.birthdate}})];case 1:return(a=o.sent())?(i={userId:String(a.id),firstName:a.firstName,lastName:a.lastName===h.DEFAULT_USER_LAST_NAME?null:a.lastName,email:a.email===h.DEFAULT_USER_EMAIL?null:a.email,phone:(null==a?void 0:a.userDetail)&&(null===(r=null==a?void 0:a.userDetail)||void 0===r?void 0:r.phone)?String(null===(l=null==a?void 0:a.userDetail)||void 0===l?void 0:l.phone):void 0,birthdate:(null==a?void 0:a.userDetail)&&(null===(n=a.userDetail)||void 0===n?void 0:n.birthday)?null===(s=a.userDetail)||void 0===s?void 0:s.birthday:void 0},Object.entries(i).forEach((function(e){var a=t.__read(e,2),i=a[0],r=a[1];q(i,r)})),E.success({title:g("App:success"),message:g("Notification:customerAddedSuccessfully")}),[2]):[2]}}))}))},variant:"primary",className:"mb-4",disabled:!V||(null==D?void 0:D.firstName)||(null==D?void 0:D.lastName)||(null==D?void 0:D.email)||(null==D?void 0:D.phone)||(null==D?void 0:D.birthday)||_.isLoading},g("Sale:addCustomer")))};
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"),i=e(a),r=require("react-i18next"),l=e(require("@licklist/plugins/dist/context/app/hooks/useNotification")),n=require("react-bootstrap"),s=require("../../../static/Icon.js"),o=require("react-hook-form"),d=e(require("clsx")),u=require("../../../static/manual-date-picker/utils/index.js"),m=require("../../../static/manual-date-picker/ManualDatePicker.js");require("../../../static/index.js");var c=require("@licklist/plugins/dist"),v=require("../../../static/manual-date-picker/hooks/useManualDatePicker.js"),p=e(require("@licklist/plugins/dist/validation/Rules/lettersRule")),h=require("@licklist/core/dist/Config/DefaultUser");exports.CreateUser=function(e){var f,b=e.goToSearchUsers,N=e.providerId,g=r.useTranslation(["Sale","Design","App","Validation"]).t,E=l(),_=c.useDashboardUserApi(N).create,k=o.useFormContext(),y=k.formState,D=y.errors,F=y.isSubmitted,S=k.register,q=k.setValue,x=k.watch,C=k.getValues,I=x("birthdate"),V=x("firstName"),A=t.__read(v.useManualDatePicker({isRequired:!1,isSubmitted:F,fieldName:"birthdate",value:I,fieldErrors:c.HookFormService.getErrors("birthdate",D)}),2),L=A[0],R=A[1],j=R.isChoosedDateValid,U=R.fieldErrors,M=L.day,T=L.year,w=L.month;a.useEffect((function(){M&&w&&T&&j()&&q("birthdate",u.dateToSqlDate(M,w,T),{shouldValidate:!0})}),[M,w,T]);return i.createElement(i.Fragment,null,i.createElement(n.Button,{as:"button",type:"button",onClick:b,variant:"primary",className:"mb-4 mt-4 align-items-center d-flex"},g("Design:search"),i.createElement(s.default,{type:"search",height:"1.4rem",width:"1.4rem",className:"ml-3"})),i.createElement("div",{className:"input-label"},g("Design:firstName"),i.createElement("span",{className:"text-danger"},"*")),i.createElement(n.Form.Control,t.__assign({type:"text",isInvalid:!!(null==D?void 0:D.firstName)},S("firstName",{pattern:p,maxLength:255,required:!0}))),i.createElement(n.Form.Control.Feedback,{type:"invalid"},c.HookFormService.hasError(null==D?void 0:D.firstName,"required")&&g("Validation:fieldRequired",{attribute:g("Design:firstName")}),c.HookFormService.hasError(null==D?void 0:D.firstName,"pattern")&&g("Sale:fieldIsNotValid",{attribute:g("Design:firstName")})),i.createElement("div",{className:"input-label"},g("Design:lastName")),i.createElement(n.Form.Control,t.__assign({type:"text",isInvalid:!!(null==D?void 0:D.lastName)},S("lastName",{pattern:p,maxLength:255}))),i.createElement(n.Form.Control.Feedback,{type:"invalid"},(null==D?void 0:D.lastName)&&g("Sale:fieldIsNotValid",{attribute:g("Design:lastName")})),i.createElement("div",{className:"input-label"},g("Design:email")),i.createElement(n.Form.Control,t.__assign({type:"text",isInvalid:c.HookFormService.isInvalid("email",D)},S("email",{pattern:c.emailRule,maxLength:255}))),i.createElement(n.Form.Control.Feedback,{type:"invalid"},(null==D?void 0:D.email)&&g("Sale:fieldIsNotValid",{attribute:g("Design:email")})),i.createElement("div",{className:"input-label"},g("Design:phone")),i.createElement(n.Form.Control,t.__assign({type:"number"},S("phone",{pattern:c.phoneRule,maxLength:255}),{isInvalid:!!(null==D?void 0:D.phone)})),i.createElement(n.Form.Control.Feedback,{type:"invalid"},(null==D?void 0:D.phone)&&g("Sale:fieldIsNotValid",{attribute:"phone number"})),i.createElement("div",{className:"input-label"},g("Design:dayOfBirthShort")),i.createElement(n.Form.Control,t.__assign({type:"hidden"},S("birthdate",{validate:function(e){return!e||(!!c.checkIsValidBirthday(e)||"".concat(g("Sale:fieldIsNotValid",{attribute:g("App:birthday")})))}}),{isInvalid:!!D.birthdate,className:d("datetime-form-picker",I&&"date-input-with-value")})),i.createElement("div",{className:"d-flex"},i.createElement(m.ManualDatePicker,t.__assign({},L,{isRequred:!1}))),i.createElement(n.Form.Control.Feedback,{type:"invalid"},(null===(f=null==D?void 0:D.birthdate)||void 0===f?void 0:f.message)||U()),i.createElement(n.Button,{as:"button",type:"button",onClick:function(){return t.__awaiter(void 0,void 0,void 0,(function(){var e,a,i,r,l,n,s;return t.__generator(this,(function(o){switch(o.label){case 0:return e=C(),[4,_.execute({first_name:e.firstName,last_name:e.lastName,email:e.email,user_detail:{phone:e.phone,birthday:e.birthdate}})];case 1:return(a=o.sent())?(i={userId:String(a.id),firstName:a.firstName,lastName:a.lastName===h.DEFAULT_USER_LAST_NAME?null:a.lastName,email:a.email===h.DEFAULT_USER_EMAIL?null:a.email,phone:(null==a?void 0:a.userDetail)&&(null===(r=null==a?void 0:a.userDetail)||void 0===r?void 0:r.phone)?String(null===(l=null==a?void 0:a.userDetail)||void 0===l?void 0:l.phone):void 0,birthdate:(null==a?void 0:a.userDetail)&&(null===(n=a.userDetail)||void 0===n?void 0:n.birthday)?null===(s=a.userDetail)||void 0===s?void 0:s.birthday:void 0},Object.entries(i).forEach((function(e){var a=t.__read(e,2),i=a[0],r=a[1];q(i,r)})),E.success({title:g("App:success"),message:g("Notification:customerAddedSuccessfully")}),[2]):[2]}}))}))},variant:"primary",className:"mb-4",disabled:!V||(null==D?void 0:D.firstName)||(null==D?void 0:D.lastName)||(null==D?void 0:D.email)||(null==D?void 0:D.phone)||(null==D?void 0:D.birthday)||_.isLoading},g("Sale:addCustomer")))};
@@ -33,7 +33,7 @@
33
33
  margin: 0.875rem;
34
34
  z-index: 3;
35
35
  }
36
-
36
+
37
37
  .form-control {
38
38
  height: 2.75rem;
39
39
  color: $blue;
@@ -57,7 +57,11 @@
57
57
  margin-right: 0.5rem;
58
58
  }
59
59
 
60
- .cancel-button, .add-filters-button, .refresh-button, .fullscreen-button, .minimize-button {
60
+ .cancel-button,
61
+ .add-filters-button,
62
+ .refresh-button,
63
+ .fullscreen-button,
64
+ .minimize-button {
61
65
  display: flex;
62
66
  color: $gray-800;
63
67
 
@@ -92,11 +96,14 @@
92
96
  }
93
97
  }
94
98
 
95
- .fullscreen-button, .minimize-button {
99
+ .fullscreen-button,
100
+ .minimize-button {
96
101
  min-width: 7.25rem;
97
102
  }
98
103
 
99
- .refresh-button, .fullscreen-button, .minimize-button {
104
+ .refresh-button,
105
+ .fullscreen-button,
106
+ .minimize-button {
100
107
  .icon {
101
108
  background-color: transparent;
102
109
 
@@ -145,13 +152,37 @@
145
152
  .additional-filter-section {
146
153
  margin-top: 1.25rem;
147
154
 
148
- @include media-breakpoint-up(md){
155
+ @include media-breakpoint-up(md) {
149
156
  .form-group {
150
157
  margin-bottom: 0;
151
158
  }
152
159
  }
153
160
  }
154
161
 
162
+ .additional-filter-container {
163
+ flex-wrap: nowrap;
164
+
165
+ @include media-breakpoint-down(md) {
166
+ flex-wrap: wrap;
167
+ .date-container {
168
+ width: 100%;
169
+ flex: 1;
170
+ }
171
+ .btn-primary {
172
+ margin-top: 1rem;
173
+ }
174
+ }
175
+
176
+ @include media-breakpoint-between(md, lg) {
177
+ flex-wrap: nowrap;
178
+
179
+ .date-container {
180
+ width: auto;
181
+ flex: 0 0 35%;
182
+ }
183
+ }
184
+ }
185
+
155
186
  .searching-for-section {
156
187
  .tags {
157
188
  display: flex;
@@ -161,8 +192,9 @@
161
192
  p {
162
193
  margin: 0;
163
194
  }
164
-
165
- .label, .search-query-param {
195
+
196
+ .label,
197
+ .search-query-param {
166
198
  font-size: 1.125rem;
167
199
  font-weight: 600;
168
200
  }
@@ -175,8 +207,8 @@
175
207
  .result-tag {
176
208
  display: flex;
177
209
  align-items: center;
178
- border: 1px solid #DCDCDC;
179
- background-color: #F5F5F5;
210
+ border: 1px solid #dcdcdc;
211
+ background-color: #f5f5f5;
180
212
  padding: 0.5rem 0.75rem;
181
213
  font-size: 0.75rem;
182
214
  text-transform: capitalize;
@@ -186,7 +218,7 @@
186
218
  cursor: pointer;
187
219
  width: 1.125rem;
188
220
  height: 1.125rem;
189
- background-color: #DCDCDC;
221
+ background-color: #dcdcdc;
190
222
  border-radius: 1rem;
191
223
  display: flex;
192
224
  align-items: center;
@@ -196,4 +228,4 @@
196
228
  }
197
229
  }
198
230
  }
199
- }
231
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@licklist/design",
3
- "version": "0.44.509",
3
+ "version": "0.44.511",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+ssh://git@bitbucket.org/artelogicsoft/licklist_design.git"
@@ -198,14 +198,14 @@ export default {
198
198
  } as Meta;
199
199
 
200
200
  const TimerWrapper = () => {
201
- const [timer, setTimer] = useState(60);
201
+ const [timer, setTimer] = useState(120000);
202
202
  const updateTimerState = () => {
203
203
  setTimer((prevValue) => {
204
204
  if (prevValue <= 0) {
205
205
  return 0;
206
206
  }
207
207
 
208
- const nexValue = prevValue - 1;
208
+ const nexValue = prevValue - 1000;
209
209
 
210
210
  return nexValue;
211
211
  });
@@ -11,7 +11,7 @@ export function Default() {
11
11
  return (
12
12
  <div className="payment-process">
13
13
  <div className="col-lg-4">
14
- <Timer timer={300} />
14
+ <Timer timer={120000} />
15
15
  </div>
16
16
  </div>
17
17
  );
@@ -1,7 +1,7 @@
1
- export const fancyTimeFormat = (duration: number) => {
2
- const mins = Math.floor((duration % 3600) / 60);
3
- const secs = Math.floor(duration) % 60;
4
-
1
+ export const fancyTimeFormat = (miliseconds: number) => {
2
+ const date = new Date(miliseconds);
3
+ const mins = date.getMinutes();
4
+ const secs = date.getSeconds();
5
5
  let timerString = "";
6
6
 
7
7
  timerString += `${mins}:${secs < 10 ? "0" : ""}`;
@@ -25,7 +25,7 @@ export interface PaymentMetadata {
25
25
  interface PaymentProps extends RyftPaymentFormProps {
26
26
  onCloseIframePayment?: () => void;
27
27
  onFailIframePayment?: () => void;
28
- data?: PaymentLinkResponse;
28
+ data?: PaymentLinkResponse | null;
29
29
  isLoading: boolean;
30
30
  bookingSummaryProps: Omit<BookingSummaryProps, "totallWithDiscount">;
31
31
  paymentMetadata?: PaymentMetadata;
@@ -1,16 +1,41 @@
1
- import React, { useContext, useLayoutEffect } from "react";
1
+ import React, { useContext, useEffect, useLayoutEffect } from "react";
2
2
  import { PaymentSessionContext } from "@licklist/plugins/dist/context/payment/PaymentSessionContext";
3
+ import { useTimer } from "@licklist/plugins/dist";
3
4
  import { Timer } from "../../order-process";
4
5
 
6
+ // 10 minutes in ms
7
+ export const PAYMENT_TIMER_TOTAL_TIME = 600000;
8
+
5
9
  export const PaymentTimer = () => {
6
- const { timer, startPaymentSessionTimer, isTimerStarted, setTimer } =
7
- useContext(PaymentSessionContext);
10
+ const { timer, startTimer, isTimerStarted, resetTimer } = useTimer({
11
+ timerTime: PAYMENT_TIMER_TOTAL_TIME,
12
+ });
13
+
14
+ const { setIsPaymentSessionExpired, isResetTimer } = useContext(
15
+ PaymentSessionContext
16
+ );
17
+
18
+ useEffect(() => {
19
+ if (!isResetTimer) {
20
+ return;
21
+ }
22
+ resetTimer();
23
+ // eslint-disable-next-line react-hooks/exhaustive-deps
24
+ }, [isResetTimer]);
25
+
26
+ useEffect(() => {
27
+ // Sometimes we can get not round time in ms
28
+ if (timer > 1000) {
29
+ return;
30
+ }
31
+ setIsPaymentSessionExpired(true);
32
+ resetTimer();
33
+ // eslint-disable-next-line react-hooks/exhaustive-deps
34
+ }, [timer]);
8
35
 
9
36
  useLayoutEffect(() => {
10
- setTimer(600);
11
37
  if (isTimerStarted) return;
12
-
13
- startPaymentSessionTimer();
38
+ startTimer();
14
39
  // eslint-disable-next-line react-hooks/exhaustive-deps
15
40
  }, []);
16
41
 
@@ -555,10 +555,9 @@ export function ProductControl<T extends FormValues>({
555
555
  name={`${fieldNamePrefix}.hasSpecialNotes` as Path<T>}
556
556
  />
557
557
  </Form.Group>
558
-
559
- {categoryType === CATEGORY_TYPE_FIXED_DURATION && (
560
- <FixedDurationOptions fieldNamePrefix={fieldNamePrefix} />
561
- )}
558
+ {[CATEGORY_TYPE_GAME, CATEGORY_TYPE_FIXED_DURATION].includes(
559
+ categoryType
560
+ ) && <FixedDurationOptions fieldNamePrefix={fieldNamePrefix} />}
562
561
  <Form.Group
563
562
  controlId={minSpendId}
564
563
  className="advanced-switch-container"
@@ -47,7 +47,7 @@ export const AdditionalFilterSection = () => {
47
47
  return (
48
48
  <div className="additional-filter-section">
49
49
  <Form onSubmit={handleSubmit(onFormSubmit)}>
50
- <Row>
50
+ <Row className="additional-filter-container">
51
51
  <Col md="3">
52
52
  <Form.Group>
53
53
  <Form.Label>{t("staffMember")}</Form.Label>
@@ -74,7 +74,7 @@ export const AdditionalFilterSection = () => {
74
74
  </Form.Group>
75
75
  </Col>
76
76
 
77
- <Col md="3">
77
+ <Col className="date-container">
78
78
  <Form.Group>
79
79
  <Form.Label>{t("date")}</Form.Label>
80
80
  <Form.Control {...register("date")} type="date" />
@@ -233,6 +233,7 @@ export const CouponFormControl = ({
233
233
  <Form.Control
234
234
  type="date"
235
235
  {...register("validTill")}
236
+ value={validTillValue}
236
237
  onChange={(e) => {
237
238
  const date = DateTime.fromSQL(e.target.value).toISODate();
238
239
  setValue("validTill", date);
@@ -331,6 +332,7 @@ export const CouponFormControl = ({
331
332
  <Form.Group>
332
333
  <Form.Label>{t("Design:totalCoupons")}</Form.Label>
333
334
  <Form.Control
335
+ {...register("totalCoupons")}
334
336
  type="number"
335
337
  isInvalid={errors.totalCoupons !== undefined}
336
338
  disabled={isLoading}
@@ -33,7 +33,7 @@
33
33
  margin: 0.875rem;
34
34
  z-index: 3;
35
35
  }
36
-
36
+
37
37
  .form-control {
38
38
  height: 2.75rem;
39
39
  color: $blue;
@@ -57,7 +57,11 @@
57
57
  margin-right: 0.5rem;
58
58
  }
59
59
 
60
- .cancel-button, .add-filters-button, .refresh-button, .fullscreen-button, .minimize-button {
60
+ .cancel-button,
61
+ .add-filters-button,
62
+ .refresh-button,
63
+ .fullscreen-button,
64
+ .minimize-button {
61
65
  display: flex;
62
66
  color: $gray-800;
63
67
 
@@ -92,11 +96,14 @@
92
96
  }
93
97
  }
94
98
 
95
- .fullscreen-button, .minimize-button {
99
+ .fullscreen-button,
100
+ .minimize-button {
96
101
  min-width: 7.25rem;
97
102
  }
98
103
 
99
- .refresh-button, .fullscreen-button, .minimize-button {
104
+ .refresh-button,
105
+ .fullscreen-button,
106
+ .minimize-button {
100
107
  .icon {
101
108
  background-color: transparent;
102
109
 
@@ -145,13 +152,37 @@
145
152
  .additional-filter-section {
146
153
  margin-top: 1.25rem;
147
154
 
148
- @include media-breakpoint-up(md){
155
+ @include media-breakpoint-up(md) {
149
156
  .form-group {
150
157
  margin-bottom: 0;
151
158
  }
152
159
  }
153
160
  }
154
161
 
162
+ .additional-filter-container {
163
+ flex-wrap: nowrap;
164
+
165
+ @include media-breakpoint-down(md) {
166
+ flex-wrap: wrap;
167
+ .date-container {
168
+ width: 100%;
169
+ flex: 1;
170
+ }
171
+ .btn-primary {
172
+ margin-top: 1rem;
173
+ }
174
+ }
175
+
176
+ @include media-breakpoint-between(md, lg) {
177
+ flex-wrap: nowrap;
178
+
179
+ .date-container {
180
+ width: auto;
181
+ flex: 0 0 35%;
182
+ }
183
+ }
184
+ }
185
+
155
186
  .searching-for-section {
156
187
  .tags {
157
188
  display: flex;
@@ -161,8 +192,9 @@
161
192
  p {
162
193
  margin: 0;
163
194
  }
164
-
165
- .label, .search-query-param {
195
+
196
+ .label,
197
+ .search-query-param {
166
198
  font-size: 1.125rem;
167
199
  font-weight: 600;
168
200
  }
@@ -175,8 +207,8 @@
175
207
  .result-tag {
176
208
  display: flex;
177
209
  align-items: center;
178
- border: 1px solid #DCDCDC;
179
- background-color: #F5F5F5;
210
+ border: 1px solid #dcdcdc;
211
+ background-color: #f5f5f5;
180
212
  padding: 0.5rem 0.75rem;
181
213
  font-size: 0.75rem;
182
214
  text-transform: capitalize;
@@ -186,7 +218,7 @@
186
218
  cursor: pointer;
187
219
  width: 1.125rem;
188
220
  height: 1.125rem;
189
- background-color: #DCDCDC;
221
+ background-color: #dcdcdc;
190
222
  border-radius: 1rem;
191
223
  display: flex;
192
224
  align-items: center;
@@ -196,4 +228,4 @@
196
228
  }
197
229
  }
198
230
  }
199
- }
231
+ }