@licklist/design 0.44.468 → 0.44.470

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 (30) hide show
  1. package/dist/iframe/event/event-details/components/number-of-people-input/component/RenderNumberOfPeopleInputComponent.d.ts.map +1 -1
  2. package/dist/iframe/event/event-details/components/number-of-people-input/component/RenderNumberOfPeopleInputComponent.js +1 -1
  3. package/dist/iframe/order-process/components/BookingSummary/BookingSummary.d.ts +2 -2
  4. package/dist/iframe/order-process/components/BookingSummary/BookingSummary.d.ts.map +1 -1
  5. package/dist/iframe/order-process/components/BookingSummary/BookingSummary.js +1 -1
  6. package/dist/iframe/order-process/components/BookingSummary/components/BookingSummaryAccordion/BookingSummaryAccordion.d.ts +2 -1
  7. package/dist/iframe/order-process/components/BookingSummary/components/BookingSummaryAccordion/BookingSummaryAccordion.d.ts.map +1 -1
  8. package/dist/iframe/order-process/components/BookingSummary/components/BookingSummaryAccordion/BookingSummaryAccordion.js +1 -1
  9. package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts +1 -0
  10. package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts.map +1 -1
  11. package/dist/iframe/order-process/components/CategoryProduct/CategoryProduct.d.ts.map +1 -1
  12. package/dist/iframe/order-process/components/CategoryProduct/CategoryProduct.js +1 -1
  13. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.d.ts +24 -0
  14. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.d.ts.map +1 -0
  15. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.js +1 -0
  16. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/index.d.ts +2 -0
  17. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/index.d.ts.map +1 -0
  18. package/dist/styles/iframe-events/Event.scss +44 -14
  19. package/dist/styles/iframe-page/PageBody.scss +3 -0
  20. package/package.json +1 -1
  21. package/src/iframe/event/event-details/components/number-of-people-input/component/RenderNumberOfPeopleInputComponent.tsx +1 -4
  22. package/src/iframe/order-process/OrderProcess.stories.tsx +56 -3
  23. package/src/iframe/order-process/components/BookingSummary/BookingSummary.tsx +2 -1
  24. package/src/iframe/order-process/components/BookingSummary/components/BookingSummaryAccordion/BookingSummaryAccordion.tsx +5 -1
  25. package/src/iframe/order-process/components/BookingSummary/types/index.ts +1 -0
  26. package/src/iframe/order-process/components/CategoryProduct/CategoryProduct.tsx +11 -47
  27. package/src/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.tsx +118 -0
  28. package/src/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/index.ts +1 -0
  29. package/src/styles/iframe-events/Event.scss +44 -14
  30. package/src/styles/iframe-page/PageBody.scss +3 -0
@@ -1 +1 @@
1
- {"version":3,"file":"RenderNumberOfPeopleInputComponent.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/event/event-details/components/number-of-people-input/component/RenderNumberOfPeopleInputComponent.tsx"],"names":[],"mappings":";AAOA,UAAU,uCAAuC;IAC/C,oBAAoB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,kCAAkC,+DAI5C,uCAAuC,gBAuCzC,CAAC"}
1
+ {"version":3,"file":"RenderNumberOfPeopleInputComponent.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/event/event-details/components/number-of-people-input/component/RenderNumberOfPeopleInputComponent.tsx"],"names":[],"mappings":";AAOA,UAAU,uCAAuC;IAC/C,oBAAoB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,kCAAkC,+DAI5C,uCAAuC,gBAoCzC,CAAC"}
@@ -1 +1 @@
1
- "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("react")),r=require("react-i18next"),n=e(require("clsx")),a=require("../../../../../order-process/components/CategoryProduct/components/NumberInput/NumberInput.js");exports.RenderNumberOfPeopleInputComponent=function(e){var o=e.onChangePeopleAmount,u=e.peopleAmount,m=e.peopleAmountError,l=r.useTranslation("Design").t;return t.createElement("div",{id:"numberOfPeople",className:"people-input calendar-people-input pt-5 mb-5"},t.createElement("div",{className:"d-flex align-items-center input-wrapper"},t.createElement("h3",{className:"iframe-event__name"},l("people")),t.createElement(a.NumberInput,{onChange:o,onArrowDown:function(){return o(Number(u)-1)},onArrowUp:function(){return o(Number(u)+1)},min:0,value:Number(u),className:n("iframe-event__product-count")})),t.createElement("div",{className:"iframe-event__message-error"},m&&t.createElement("div",{className:"mt-3"},t.createElement("p",null,t.createElement(r.Trans,{t:l,i18nKey:"pleaseSelectAtLeastFrom",values:{min:1,type:"item",from:"this category"}})))))};
1
+ "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var r=e(require("react")),t=require("react-i18next"),n=e(require("clsx")),a=require("../../../../../order-process/components/CategoryProduct/components/NumberInput/NumberInput.js");exports.RenderNumberOfPeopleInputComponent=function(e){var o=e.onChangePeopleAmount,u=e.peopleAmount,m=e.peopleAmountError,l=t.useTranslation("Design").t;return r.createElement("div",{id:"numberOfPeople",className:"people-input"},r.createElement("div",{className:"d-flex align-items-center input-wrapper"},r.createElement("h3",{className:"iframe-event__name"},l("people")),r.createElement(a.NumberInput,{onChange:o,onArrowDown:function(){return o(Number(u)-1)},onArrowUp:function(){return o(Number(u)+1)},min:0,value:Number(u),className:n("iframe-event__product-count")})),r.createElement("div",{className:"iframe-event__message-error"},m&&r.createElement("div",{className:"mt-3"},r.createElement("p",null,r.createElement(t.Trans,{t:l,i18nKey:"pleaseSelectAtLeastFrom",values:{min:1,type:"item",from:"this category"}})))))};
@@ -1,8 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  import { BookingSummaryProps } from "./types";
3
3
  export declare const BookingSummary: {
4
- ({ date, menuSteps, formValues, isNotShownPeopleAmount, eventName, transactionFee, productsWithErrors, isLoading, }: Omit<BookingSummaryProps, "totallWithDiscount">): JSX.Element;
4
+ ({ date, menuSteps, formValues, isNotShownPeopleAmount, eventName, transactionFee, productsWithErrors, isLoading, hasPeopleInput, }: Omit<BookingSummaryProps, "totallWithDiscount">): JSX.Element;
5
5
  SummaryTotal: ({ formValues, totalWithDiscount, transactionFee, isFreePayment, }: Pick<BookingSummaryProps, "formValues" | "totalWithDiscount" | "transactionFee" | "isFreePayment">) => JSX.Element;
6
- Accordion: ({ children, title, showTitleOnlyOnMobile, }: import("./components/BookingSummaryAccordion").BookingSummaryAccordionProps) => JSX.Element;
6
+ Accordion: ({ children, title, showTitleOnlyOnMobile, hasPeopleInput, }: import("./components/BookingSummaryAccordion").BookingSummaryAccordionProps) => JSX.Element;
7
7
  };
8
8
  //# sourceMappingURL=BookingSummary.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BookingSummary.d.ts","sourceRoot":"","sources":["../../../../../src/iframe/order-process/components/BookingSummary/BookingSummary.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAK9C,eAAO,MAAM,cAAc;yHASxB,KAAK,mBAAmB,EAAE,oBAAoB,CAAC;;;CAgFjD,CAAC"}
1
+ {"version":3,"file":"BookingSummary.d.ts","sourceRoot":"","sources":["../../../../../src/iframe/order-process/components/BookingSummary/BookingSummary.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAK9C,eAAO,MAAM,cAAc;yIAUxB,KAAK,mBAAmB,EAAE,oBAAoB,CAAC;;;CAgFjD,CAAC"}
@@ -1 +1 @@
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("@licklist/core/dist/Config"),m=require("../../../../static/loader/LoaderIndicator.js"),c=require("react-i18next");require("../../../../static/index.js");var o=require("react-intl");require("./components/SummaryTotal/components/SummaryTotalBlock.js");var s=require("./components/ProductsByMenuStep/ProductsByMenuStep.js"),l=require("./utils/index.js"),i=require("./components/SummaryTotal/SummaryTotal.js"),u=require("./components/BookingSummaryAccordion/BookingSummaryAccordion.js"),d=function(e){var i=e.date,d=e.menuSteps,p=e.formValues,y=e.isNotShownPeopleAmount,E=e.eventName,f=e.transactionFee,v=void 0===f?0:f,N=e.productsWithErrors,S=e.isLoading,g=c.useTranslation("Design").t,q=o.useIntl().formatNumber,j=t.__read(r.useMemo((function(){var e=l.sanitizeFormValues(p),r=e.numberOfPeople,a=t.__rest(e,["numberOfPeople"]);return[r,Object.keys(a).map((function(e){return a[e]})).filter((function(e){return 0!==e.quantity}))]}),[p]),2),k=j[0],b=void 0===k?0:k,B=j[1];return S?a.createElement("div",{className:"payment-booking-summary"},a.createElement(m.LoaderIndicator,{isLoaded:!1})):a.createElement("div",{className:"payment-booking-summary"},a.createElement(u.BookingSummaryAccordion,null,a.createElement("div",{className:"event-info"},a.createElement("p",{className:"m-0 title event-name"},E),a.createElement("p",{className:"m-0"},i)),a.createElement("hr",null),B.length>0?a.createElement("div",null,a.createElement("div",{className:"cart-items"},d.map((function(e){return a.createElement(s.ProductsByMenuStep,{key:e.id,orderProducts:B,step:e,productsWithErrors:N})})),!y&&b>0&&a.createElement(a.Fragment,null,a.createElement("hr",null),a.createElement("div",{className:"d-flex justify-content-between mt-3"},a.createElement("p",{className:"m-0"},g("people"),":"),a.createElement("p",{className:"price"},b))),!!v&&a.createElement(a.Fragment,null,a.createElement("hr",null),a.createElement("div",{className:"d-flex justify-content-between mt-3"},a.createElement("p",{className:"m-0"},g("transactionFee"),":"),a.createElement("p",{className:"price"},q(v,{style:"currency",currency:n.Currency.GBP})))))):a.createElement("div",{className:"cart-items"},a.createElement("p",{className:"empty-cart"},g("emptyBasket")))))};d.SummaryTotal=i.SummaryTotal,d.Accordion=u.BookingSummaryAccordion,exports.BookingSummary=d;
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("@licklist/core/dist/Config"),m=require("../../../../static/loader/LoaderIndicator.js"),c=require("react-i18next");require("../../../../static/index.js");var o=require("react-intl");require("./components/SummaryTotal/components/SummaryTotalBlock.js");var s=require("./components/ProductsByMenuStep/ProductsByMenuStep.js"),l=require("./utils/index.js"),i=require("./components/SummaryTotal/SummaryTotal.js"),u=require("./components/BookingSummaryAccordion/BookingSummaryAccordion.js"),d=function(e){var i=e.date,d=e.menuSteps,p=e.formValues,y=e.isNotShownPeopleAmount,E=e.eventName,f=e.transactionFee,v=void 0===f?0:f,N=e.productsWithErrors,S=e.isLoading,g=e.hasPeopleInput,q=c.useTranslation("Design").t,j=o.useIntl().formatNumber,k=t.__read(r.useMemo((function(){var e=l.sanitizeFormValues(p),r=e.numberOfPeople,a=t.__rest(e,["numberOfPeople"]);return[r,Object.keys(a).map((function(e){return a[e]})).filter((function(e){return 0!==e.quantity}))]}),[p]),2),b=k[0],B=void 0===b?0:b,P=k[1];return S?a.createElement("div",{className:"payment-booking-summary"},a.createElement(m.LoaderIndicator,{isLoaded:!1})):a.createElement("div",{className:"payment-booking-summary"},a.createElement(u.BookingSummaryAccordion,{hasPeopleInput:g},a.createElement("div",{className:"event-info"},a.createElement("p",{className:"m-0 title event-name"},E),a.createElement("p",{className:"m-0"},i)),a.createElement("hr",null),P.length>0?a.createElement("div",null,a.createElement("div",{className:"cart-items"},d.map((function(e){return a.createElement(s.ProductsByMenuStep,{key:e.id,orderProducts:P,step:e,productsWithErrors:N})})),!y&&B>0&&a.createElement(a.Fragment,null,a.createElement("hr",null),a.createElement("div",{className:"d-flex justify-content-between mt-3"},a.createElement("p",{className:"m-0"},q("people"),":"),a.createElement("p",{className:"price"},B))),!!v&&a.createElement(a.Fragment,null,a.createElement("hr",null),a.createElement("div",{className:"d-flex justify-content-between mt-3"},a.createElement("p",{className:"m-0"},q("transactionFee"),":"),a.createElement("p",{className:"price"},j(v,{style:"currency",currency:n.Currency.GBP})))))):a.createElement("div",{className:"cart-items"},a.createElement("p",{className:"empty-cart"},q("emptyBasket")))))};d.SummaryTotal=i.SummaryTotal,d.Accordion=u.BookingSummaryAccordion,exports.BookingSummary=d;
@@ -2,6 +2,7 @@ import { PropsWithChildren } from "react";
2
2
  export declare type BookingSummaryAccordionProps = PropsWithChildren<{
3
3
  title?: string;
4
4
  showTitleOnlyOnMobile?: boolean;
5
+ hasPeopleInput?: boolean;
5
6
  }>;
6
- export declare const BookingSummaryAccordion: ({ children, title, showTitleOnlyOnMobile, }: BookingSummaryAccordionProps) => JSX.Element;
7
+ export declare const BookingSummaryAccordion: ({ children, title, showTitleOnlyOnMobile, hasPeopleInput, }: BookingSummaryAccordionProps) => JSX.Element;
7
8
  //# sourceMappingURL=BookingSummaryAccordion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BookingSummaryAccordion.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/order-process/components/BookingSummary/components/BookingSummaryAccordion/BookingSummaryAccordion.tsx"],"names":[],"mappings":"AAAA,OAAc,EAGZ,iBAAiB,EAElB,MAAM,OAAO,CAAC;AAaf,oBAAY,4BAA4B,GAAG,iBAAiB,CAAC;IAC3D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC,CAAC,CAAC;AAEH,eAAO,MAAM,uBAAuB,gDAIjC,4BAA4B,gBA2D9B,CAAC"}
1
+ {"version":3,"file":"BookingSummaryAccordion.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/order-process/components/BookingSummary/components/BookingSummaryAccordion/BookingSummaryAccordion.tsx"],"names":[],"mappings":"AAAA,OAAc,EAGZ,iBAAiB,EAElB,MAAM,OAAO,CAAC;AAaf,oBAAY,4BAA4B,GAAG,iBAAiB,CAAC;IAC3D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC,CAAC;AAEH,eAAO,MAAM,uBAAuB,gEAKjC,4BAA4B,gBA6D9B,CAAC"}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),n=require("react"),o=(e=n)&&"object"==typeof e&&"default"in e?e.default:e,i=require("react-bootstrap"),s=require("@licklist/plugins/dist/hooks/Media/useWindowDimensions"),a=require("../../types/index.js"),r=require("../../../../../page/components/PageBody/constants.js"),c=require("../ToggleHeader/ToggleHeader.js"),l=require("../../../../../page/components/PageBody/hooks/useResizePageBody.js");exports.BookingSummaryAccordion=function(e){var d=e.children,u=e.title,E=e.showTitleOnlyOnMobile,p=void 0!==E&&E,C=s.useWindowDimensions().width,w=t.__read(n.useState(C<=a.MOBILE_WIDTH),2),O=w[0],_=w[1],g=l.useResizePageBody().rightBlockContentStyles,v=C<=a.MOBILE_WIDTH,m=n.useCallback((function(e){_(e===a.ACCORDION_KEY)}),[]),f=n.useCallback((function(){window.dispatchEvent(new Event(r.RIGHT_BLOCK_EXPAND))}),[]),y=n.useCallback((function(){window.dispatchEvent(new Event(r.RIGHT_BLOCK_EXPANDED))}),[]),B=n.useCallback((function(){window.dispatchEvent(new Event(r.RIGHT_BLOCK_COLLAPSE))}),[]),h=n.useCallback((function(){window.dispatchEvent(new Event(r.RIGHT_BLOCK_COLLAPSED))}),[]);n.useEffect((function(){C>a.MOBILE_WIDTH?_(!0):_(!1)}),[C,_]);var I=!p||p&&v;return o.createElement(i.Accordion,{defaultActiveKey:a.ACCORDION_KEY,onSelect:m},o.createElement(c.ToggleHeader,{showExpandButton:v,isExpanded:O,title:u,hideComponent:!I}),o.createElement(i.Accordion.Collapse,{eventKey:a.ACCORDION_KEY,onEnter:f,onEntered:y,onExit:B,onExited:h,className:I&&"has-toggler",style:g},o.createElement("div",{className:"summary-wrapper"},d)))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),n=require("react"),o=(e=n)&&"object"==typeof e&&"default"in e?e.default:e,i=require("react-bootstrap"),a=require("@licklist/plugins/dist/hooks/Media/useWindowDimensions"),s=require("../../types/index.js"),r=require("../../../../../page/components/PageBody/constants.js"),c=require("../ToggleHeader/ToggleHeader.js"),l=require("../../../../../page/components/PageBody/hooks/useResizePageBody.js");exports.BookingSummaryAccordion=function(e){var d=e.children,u=e.title,E=e.showTitleOnlyOnMobile,p=void 0!==E&&E,C=e.hasPeopleInput,w=a.useWindowDimensions().width,O=t.__read(n.useState(w<=s.MOBILE_WIDTH),2),_=O[0],g=O[1],v=l.useResizePageBody().rightBlockContentStyles,h=w<=s.MOBILE_WIDTH,m=n.useCallback((function(e){g(e===s.ACCORDION_KEY)}),[]),f=n.useCallback((function(){window.dispatchEvent(new Event(r.RIGHT_BLOCK_EXPAND))}),[]),y=n.useCallback((function(){window.dispatchEvent(new Event(r.RIGHT_BLOCK_EXPANDED))}),[]),B=n.useCallback((function(){window.dispatchEvent(new Event(r.RIGHT_BLOCK_COLLAPSE))}),[]),I=n.useCallback((function(){window.dispatchEvent(new Event(r.RIGHT_BLOCK_COLLAPSED))}),[]);n.useEffect((function(){w>s.MOBILE_WIDTH?g(!0):g(!1)}),[w,g]);var D=!p||p&&h;return o.createElement(i.Accordion,{defaultActiveKey:s.ACCORDION_KEY,onSelect:m},o.createElement(c.ToggleHeader,{showExpandButton:h,isExpanded:_,title:u,hideComponent:!D}),o.createElement(i.Accordion.Collapse,{eventKey:s.ACCORDION_KEY,onEnter:f,onEntered:y,onExit:B,onExited:I,className:"".concat(D&&"has-toggler"," ").concat(C&&"collapse-with-people-input"),style:v},o.createElement("div",{className:"summary-wrapper"},d)))};
@@ -11,6 +11,7 @@ export declare type BookingSummaryProps = {
11
11
  totalWithDiscount?: number;
12
12
  isNotShownPeopleAmount?: boolean;
13
13
  eventName: string;
14
+ hasPeopleInput?: boolean;
14
15
  transactionFee?: number;
15
16
  isFreePayment?: boolean;
16
17
  productsWithErrors?: ProductQuantityCheckResponse["products"];
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/order-process/components/BookingSummary/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,8CAA8C,CAAC;AAC5F,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAEvD,eAAO,MAAM,YAAY,MAAM,CAAC;AAChC,eAAO,MAAM,aAAa,oBAAoB,CAAC;AAE/C,oBAAY,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,UAAU,EAAE;QACV,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;KAC/B,CAAC;IACF,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,kBAAkB,CAAC,EAAE,4BAA4B,CAAC,UAAU,CAAC,CAAC;IAC9D,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/order-process/components/BookingSummary/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,8CAA8C,CAAC;AAC5F,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAEvD,eAAO,MAAM,YAAY,MAAM,CAAC;AAChC,eAAO,MAAM,aAAa,oBAAoB,CAAC;AAE/C,oBAAY,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,UAAU,EAAE;QACV,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;KAC/B,CAAC;IACF,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,kBAAkB,CAAC,EAAE,4BAA4B,CAAC,UAAU,CAAC,CAAC;IAC9D,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"CategoryProduct.d.ts","sourceRoot":"","sources":["../../../../../src/iframe/order-process/components/CategoryProduct/CategoryProduct.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE7D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,UAAU,oBAAoB;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,kBAAkB,CAAC,EAAE,cAAc,CAAC,oBAAoB,CAAC,CAAC;CAC3D;AAED,eAAO,MAAM,eAAe,qEAKzB,oBAAoB,gBAuMtB,CAAC"}
1
+ {"version":3,"file":"CategoryProduct.d.ts","sourceRoot":"","sources":["../../../../../src/iframe/order-process/components/CategoryProduct/CategoryProduct.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGxD,UAAU,oBAAoB;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,kBAAkB,CAAC,EAAE,cAAc,CAAC,oBAAoB,CAAC,CAAC;CAC3D;AAED,eAAO,MAAM,eAAe,qEAKzB,oBAAoB,gBAmKtB,CAAC"}
@@ -1 +1 @@
1
- "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var r=require("react"),i=e(r),t=require("@licklist/core/dist/Config"),n=require("react-i18next"),a=require("react-hook-form"),o=e(require("@licklist/plugins/dist/services/Form/HookFormService")),c=e(require("clsx")),u=require("react-intl"),d=require("../../../event/ticket-description/TicketDescription.js"),s=require("./components/NumberInput/NumberInput.js");exports.CategoryProduct=function(e){var l=e.product,m=e.category,p=e.canExpandDescription,v=void 0===p||p,y=e.productsWithErrors,f=u.useIntl().formatNumber,g=n.useTranslation(["Design","Validation"]).t,q=a.useFormContext(),E=q.control,N=q.clearErrors,x=q.setError,_=r.useMemo((function(){if(y){var e=y.find((function(e){return e.product_id===l.id}));return null==e?void 0:e.message}}),[y,l.id]),A=r.useMemo((function(){if(m.allowDeposits&&l.deposit&&!(null==l?void 0:l.isSoldOut))return l.deposit}),[m,l]);return r.useEffect((function(){_&&x("".concat(l.id),{message:_,type:"validate"})}),[_,l.id]),i.createElement(a.Controller,{control:E,name:"".concat(l.id),rules:{required:l.isRequired,validate:function(e){if(!e)return!0;var r=l.isRequired,i=void 0!==r&&r,t=l.maxAmount,n=void 0===t?0:t,a=l.minAmount,o=void 0===a?0:a,c=e.quantity,u=void 0===c?0:c;return!u&&!i||(!u&&i?g("Design:pleaseSelectAtLeastFrom",{min:1,type:"item",from:"this category"}):u<o?g("Validation:fieldMinNumber",{min:l.minAmount,attribute:l.name}):!(n&&u>=o&&n<u)||g("Validation:quantityMaxNumber",{max:l.maxAmount}))}},render:function(e){var r=e.field,n=r.onChange,a=r.value,u=void 0===a?{}:a,p=r.ref,y=e.fieldState,q=y.invalid,E=y.error;return i.createElement("div",{id:String(l.id),className:"iframe-event__category-product"},i.createElement("div",{className:c("iframe-event__product",q&&"error")},i.createElement(d.TicketDescription,{title:l.name,description:l.description,className:c("iframe-event__product-description"),images:l.images,isRequired:l.isRequired,canExpand:v})),i.createElement("div",{className:"iframe-event__product-price-wrapper"},i.createElement("span",{className:"product-price"},f(null!=A?A:l.price,{style:"currency",currency:t.Currency.GBP})),l.isSoldOut?i.createElement("div",{className:"iframe-event__sold-out-wrapper"},g("Design:soldOut")):i.createElement(s.NumberInput,{ref:p,onChange:function(e){n({id:l.id,name:l.name,deposit:A,price:l.price,productsCategoryId:m.id,quantity:e}),N("".concat(l.id))},onArrowDown:function(){n({id:l.id,name:l.name,deposit:A,price:l.price,productsCategoryId:m.id,quantity:(null==u?void 0:u.quantity)-1||0}),N("".concat(l.id))},onArrowUp:function(){var e;n({id:l.id,name:l.name,deposit:A,price:l.price,productsCategoryId:m.id,quantity:(null!==(e=null==u?void 0:u.quantity)&&void 0!==e?e:0)+1}),N("".concat(l.id))},min:0,disabled:l.isSoldOut,value:(null==u?void 0:u.quantity)||0,className:c(q&&"error")})),A&&!(null==m?void 0:m.remainderExpireAfter)&&i.createElement("div",{className:"mt-4"},g("Design:payNowAndUponArrival",{deposit:f(A,{style:"currency",currency:t.Currency.GBP}),remainder:f(l.price-A,{style:"currency",currency:t.Currency.GBP})})),A&&(null==m?void 0:m.remainderExpireAfter)>0&&i.createElement("div",{className:"mt-4"},g("Design:payNowAndReminderDays",{deposit:f(A,{style:"currency",currency:t.Currency.GBP}),remainder:f(l.price-A,{style:"currency",currency:t.Currency.GBP}),days:null==m?void 0:m.remainderExpireAfter})),q&&i.createElement("div",{className:"d-flex mt-3 w-100"},i.createElement("p",{className:"iframe-event__message-error"},o.hasError(E,"required")&&g("Design:pleaseSelectAtLeastFrom",{min:1,type:"item",from:"this category"}),o.hasError(E,"validate")&&E.message)))}})};
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("react"),t=e(r),i=require("@licklist/core/dist/Config"),n=require("react-i18next"),a=require("react-hook-form"),c=e(require("@licklist/plugins/dist/services/Form/HookFormService")),o=e(require("clsx")),s=require("react-intl"),u=require("../../../event/ticket-description/TicketDescription.js"),d=require("./components/ProductQuantityInput/ProductQuantityInput.js");exports.CategoryProduct=function(e){var l=e.product,m=e.category,p=e.canExpandDescription,y=void 0===p||p,f=e.productsWithErrors,v=s.useIntl().formatNumber,E=n.useTranslation(["Design","Validation"]).t,g=a.useFormContext(),q=g.control,x=g.clearErrors,N=g.setError,_=r.useMemo((function(){if(f){var e=f.find((function(e){return e.product_id===l.id}));return null==e?void 0:e.message}}),[f,l.id]),A=r.useMemo((function(){if(m.allowDeposits&&l.deposit&&!(null==l?void 0:l.isSoldOut))return l.deposit}),[m,l]);return r.useEffect((function(){_&&N("".concat(l.id),{message:_,type:"validate"})}),[_,l.id]),t.createElement(a.Controller,{control:q,name:"".concat(l.id),rules:{required:l.isRequired,validate:function(e){if(!e)return!0;var r=l.isRequired,t=void 0!==r&&r,i=l.maxAmount,n=void 0===i?0:i,a=l.minAmount,c=void 0===a?0:a,o=e.quantity,s=void 0===o?0:o;return!s&&!t||(!s&&t?E("Design:pleaseSelectAtLeastFrom",{min:1,type:"item",from:"this category"}):s<c?E("Validation:fieldMinNumber",{min:l.minAmount,attribute:l.name}):!(n&&s>=c&&n<s)||E("Validation:quantityMaxNumber",{max:l.maxAmount}))}},render:function(e){var r=e.field,n=r.onChange,a=r.value,s=void 0===a?{}:a,p=r.ref,f=e.fieldState,g=f.invalid,q=f.error;return t.createElement("div",{id:String(l.id),className:"iframe-event__category-product"},t.createElement("div",{className:o("iframe-event__product",g&&"error")},t.createElement(u.TicketDescription,{title:l.name,description:l.description,className:o("iframe-event__product-description"),images:l.images,isRequired:l.isRequired,canExpand:y})),t.createElement("div",{className:"iframe-event__product-price-wrapper"},t.createElement("span",{className:"product-price"},v(null!=A?A:l.price,{style:"currency",currency:i.Currency.GBP})),t.createElement(d.ProductQuantityInput,{onChange:n,productInfo:s,ref:p,clearErrors:x,product:l,category:m,invalid:g,deposit:A})),A&&!(null==m?void 0:m.remainderExpireAfter)&&t.createElement("div",{className:"mt-4"},E("Design:payNowAndUponArrival",{deposit:v(A,{style:"currency",currency:i.Currency.GBP}),remainder:v(l.price-A,{style:"currency",currency:i.Currency.GBP})})),A&&(null==m?void 0:m.remainderExpireAfter)>0&&t.createElement("div",{className:"mt-4"},E("Design:payNowAndReminderDays",{deposit:v(A,{style:"currency",currency:i.Currency.GBP}),remainder:v(l.price-A,{style:"currency",currency:i.Currency.GBP}),days:null==m?void 0:m.remainderExpireAfter})),g&&t.createElement("div",{className:"d-flex mt-3 w-100"},t.createElement("p",{className:"iframe-event__message-error"},c.hasError(q,"required")&&E("Design:pleaseSelectAtLeastFrom",{min:1,type:"item",from:"this category"}),c.hasError(q,"validate")&&q.message)))}})};
@@ -0,0 +1,24 @@
1
+ /// <reference types="react" />
2
+ import { FieldValues, RefCallBack, UseFormClearErrors } from "react-hook-form";
3
+ import { Product, ProductCategory } from "../../../../../../types";
4
+ interface FormOrderItem {
5
+ id: number;
6
+ name: string;
7
+ price: number;
8
+ productsCategoryId: number;
9
+ deposit?: number | null;
10
+ quantity: number;
11
+ }
12
+ interface ProductQuantityInputProps {
13
+ product: Product;
14
+ category: ProductCategory;
15
+ clearErrors: UseFormClearErrors<FieldValues>;
16
+ onChange: (value: FormOrderItem) => void;
17
+ deposit?: number;
18
+ ref: RefCallBack;
19
+ invalid: boolean;
20
+ productInfo: FormOrderItem;
21
+ }
22
+ export declare const ProductQuantityInput: ({ product, category, onChange, clearErrors, ref, productInfo, invalid, deposit, }: ProductQuantityInputProps) => JSX.Element;
23
+ export {};
24
+ //# sourceMappingURL=ProductQuantityInput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProductQuantityInput.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE/E,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAEnE,UAAU,aAAa;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,kBAAkB,EAAE,MAAM,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,yBAAyB;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,WAAW,EAAE,kBAAkB,CAAC,WAAW,CAAC,CAAC;IAC7C,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,WAAW,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,aAAa,CAAC;CAC5B;AAED,eAAO,MAAM,oBAAoB,sFAS9B,yBAAyB,gBAgF3B,CAAC"}
@@ -0,0 +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=e(require("react")),i=require("react-i18next"),n=require("react-bootstrap"),r=e(require("clsx")),o=require("../NumberInput/NumberInput.js");exports.ProductQuantityInput=function(e){var u=e.product,a=e.category,d=e.onChange,c=e.clearErrors,l=e.ref,s=e.productInfo,p=e.invalid,m=e.deposit,y=i.useTranslation("Design").t;return u.isSoldOut?t.createElement("div",{className:"iframe-event__sold-out-wrapper"},y("Design:soldOut")):1===(null==u?void 0:u.maxAmount)?t.createElement(n.Button,{ref:l,disabled:u.isSoldOut,className:r("iframe-event__".concat((null==s?void 0:s.quantity)?"unselect-product":"select-product"),p&&"error"),onClick:function(){d({id:u.id,name:u.name,deposit:m,price:u.price,productsCategoryId:a.id,quantity:(null==s?void 0:s.quantity)?0:1})}},y("Design:".concat((null==s?void 0:s.quantity)?"unselect":"select"))):t.createElement(o.NumberInput,{ref:l,onChange:function(e){d({id:u.id,name:u.name,deposit:m,price:u.price,productsCategoryId:a.id,quantity:e}),c("".concat(u.id))},onArrowDown:function(){d({id:u.id,name:u.name,deposit:m,price:u.price,productsCategoryId:a.id,quantity:(null==s?void 0:s.quantity)-1||0}),c("".concat(u.id))},onArrowUp:function(){var e;d({id:u.id,name:u.name,deposit:m,price:u.price,productsCategoryId:a.id,quantity:(null!==(e=null==s?void 0:s.quantity)&&void 0!==e?e:0)+1}),c("".concat(u.id))},min:0,disabled:u.isSoldOut,value:(null==s?void 0:s.quantity)||0,className:r(p&&"error")})};
@@ -0,0 +1,2 @@
1
+ export { ProductQuantityInput } from "./ProductQuantityInput";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC"}
@@ -65,7 +65,7 @@
65
65
  .iframe-event__category-product {
66
66
  margin-top: 1rem;
67
67
  padding-bottom: 1rem;
68
-
68
+
69
69
  border-bottom: 2px solid $separator-color;
70
70
 
71
71
  &:first-child {
@@ -73,7 +73,7 @@
73
73
  }
74
74
  }
75
75
 
76
- &:not(:first-child){
76
+ &:not(:first-child) {
77
77
  .iframe-event__name {
78
78
  margin: 1rem 0;
79
79
  }
@@ -89,6 +89,24 @@
89
89
  }
90
90
  }
91
91
 
92
+ &__select-product {
93
+ width: 10.5rem !important;
94
+ margin-top: 1rem;
95
+ }
96
+
97
+ &__unselect-product {
98
+ margin-top: 1rem;
99
+ width: 10.5rem !important;
100
+ background-color: $snippet-elements-button-color !important;
101
+ color: $snippet-elements-button-background-color !important;
102
+ border: 1px solid $snippet-elements-button-background-color !important;
103
+ }
104
+
105
+ &__unselect-product.error,
106
+ &__select-product.error {
107
+ border: 1px solid red !important;
108
+ }
109
+
92
110
  &__product-price-wrapper {
93
111
  display: flex;
94
112
  align-items: center;
@@ -143,7 +161,7 @@
143
161
  border-radius: $iframe-border-radius;
144
162
  font-size: 0.875rem;
145
163
  height: 2.25rem;
146
-
164
+
147
165
  &:active,
148
166
  &.active,
149
167
  &:hover,
@@ -156,25 +174,25 @@
156
174
  background-color: $snippet-elements-button-background-color;
157
175
  box-shadow: 0 0 0 $input-btn-focus-width $snippet-elements-button-background-color;
158
176
  }
159
-
177
+
160
178
  &:disabled {
161
179
  border: none;
162
180
  }
163
181
  }
164
-
182
+
165
183
  &:hover,
166
184
  &.hover,
167
185
  &:focus,
168
186
  &.focus {
169
187
  &:not(:disabled) {
170
- opacity: .7;
188
+ opacity: 0.7;
171
189
  }
172
190
  }
173
-
191
+
174
192
  &:active,
175
193
  &.active {
176
194
  &:not(:disabled) {
177
- opacity: .8;
195
+ opacity: 0.8;
178
196
  }
179
197
  }
180
198
  }
@@ -223,19 +241,19 @@
223
241
  &:focus,
224
242
  &.focus {
225
243
  &:not(:disabled) {
226
- opacity: .7;
244
+ opacity: 0.7;
227
245
  }
228
246
  }
229
247
 
230
248
  &:active,
231
249
  &.active {
232
250
  &:not(:disabled) {
233
- opacity: .8;
251
+ opacity: 0.8;
234
252
  }
235
253
  }
236
254
  }
237
255
 
238
- &__book-now{
256
+ &__book-now {
239
257
  margin: 1rem 0;
240
258
  position: fixed;
241
259
  left: 0;
@@ -260,15 +278,23 @@
260
278
  justify-content: center;
261
279
  width: 10.5rem;
262
280
  height: 2rem;
263
- color: #9D9D9D;
264
- background-color: #F3F3F3;
281
+ color: #9d9d9d;
282
+ background-color: #f3f3f3;
265
283
  border-radius: $iframe-border-radius;
266
284
  }
267
285
  }
268
286
 
269
287
  .people-input {
288
+ margin-bottom: 1rem;
289
+ h3 {
290
+ font-size: 1rem;
291
+ }
292
+ input[type="number"] {
293
+ height: 2rem;
294
+ }
295
+
270
296
  .input-wrapper {
271
- justify-content: center
297
+ justify-content: center;
272
298
  }
273
299
 
274
300
  .iframe-event {
@@ -341,6 +367,7 @@
341
367
  }
342
368
 
343
369
  .people-input {
370
+ margin-bottom: 0;
344
371
  .input-wrapper {
345
372
  justify-content: space-between;
346
373
  }
@@ -349,6 +376,9 @@
349
376
  &__name {
350
377
  margin-bottom: 1rem;
351
378
  }
379
+ &__message-error {
380
+ padding-bottom: 0.5rem;
381
+ }
352
382
  }
353
383
  }
354
384
  }
@@ -126,6 +126,9 @@
126
126
  max-height: 7.5rem;
127
127
  }
128
128
  }
129
+ .collapse-with-people-input {
130
+ max-height: calc(100vh - 22rem);
131
+ }
129
132
 
130
133
  .collapsing {
131
134
  transition: none;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@licklist/design",
3
- "version": "0.44.468",
3
+ "version": "0.44.470",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+ssh://git@bitbucket.org/artelogicsoft/licklist_design.git"
@@ -19,10 +19,7 @@ export const RenderNumberOfPeopleInputComponent = ({
19
19
  const { t } = useTranslation("Design");
20
20
 
21
21
  return (
22
- <div
23
- id={NUMBER_OF_PEOPLE}
24
- className="people-input calendar-people-input pt-5 mb-5"
25
- >
22
+ <div id={NUMBER_OF_PEOPLE} className="people-input">
26
23
  <div className="d-flex align-items-center input-wrapper">
27
24
  <h3 className="iframe-event__name">{t("people")}</h3>
28
25
 
@@ -4,6 +4,7 @@ import React, {
4
4
  useContext,
5
5
  createContext,
6
6
  useRef,
7
+ useMemo,
7
8
  } from "react";
8
9
  import { MemoryRouter, Route, useHistory } from "react-router-dom";
9
10
  import { Meta } from "@storybook/react";
@@ -14,6 +15,10 @@ import { StepsForm } from "./components/StepsForm";
14
15
  import { Page, PageBody, PageHeader } from "../page";
15
16
  import { StepsFormRef } from "./components/StepsForm/StepsForm";
16
17
  import { BookingSummaryFooter } from "./components/BookingSummaryFooter";
18
+ import { sanitizeFormValues } from "./components/BookingSummary/utils";
19
+ import { Order } from "../../types";
20
+ // eslint-disable-next-line max-len
21
+ import { RenderNumberOfPeopleInputComponent } from "../event/event-details/components/number-of-people-input/component/RenderNumberOfPeopleInputComponent";
17
22
 
18
23
  const ROUTES = [
19
24
  { pathname: "/step1", key: "/step1", name: "Burger" },
@@ -74,6 +79,9 @@ const productCategories = [
74
79
 
75
80
  price: 1,
76
81
  images: IMAGES,
82
+ maxAmount: 1,
83
+ minAmount: 1,
84
+ isRequired: true,
77
85
  },
78
86
  {
79
87
  id: 5,
@@ -172,7 +180,12 @@ const OrderProcessContextProvider: React.FC = ({ children }) => {
172
180
 
173
181
  return (
174
182
  <OrderProcessContext.Provider
175
- value={{ orderFormValues, setOrderFormValues, formValues, setFormValues }}
183
+ value={{
184
+ orderFormValues,
185
+ setOrderFormValues,
186
+ formValues,
187
+ setFormValues,
188
+ }}
176
189
  >
177
190
  {children}
178
191
  </OrderProcessContext.Provider>
@@ -208,6 +221,8 @@ const TimerWrapper = () => {
208
221
  export function Default() {
209
222
  const externalHistory = useHistory();
210
223
  const formRef = useRef<StepsFormRef | null>(null);
224
+ const [peopleAmount, setPeopleAmount] = useState(0);
225
+ const [peopleAmountError, setPeopleAmountError] = useState(false);
211
226
 
212
227
  return (
213
228
  <MemoryRouter initialEntries={ROUTES} initialIndex={0}>
@@ -228,7 +243,7 @@ export function Default() {
228
243
  formValues,
229
244
  setFormValues,
230
245
  } = useContext(OrderProcessContext);
231
-
246
+ const relyOnPeopleCategoryIds = [4];
232
247
  const onPrevStep = () => {
233
248
  if (formRef.current?.getFormValues()) {
234
249
  setFormValues(formRef.current?.getFormValues());
@@ -251,6 +266,37 @@ export function Default() {
251
266
  }
252
267
  };
253
268
 
269
+ const shouldShowPeopleInput = useMemo(() => {
270
+ const { numberOfPeople, ...orderProducts } =
271
+ sanitizeFormValues(formValues);
272
+
273
+ const values = Object.values(orderProducts).filter(
274
+ Boolean
275
+ ) as Order[];
276
+ const filteredValues = values.filter(
277
+ (product) =>
278
+ relyOnPeopleCategoryIds.includes(
279
+ product.productsCategoryId
280
+ ) && product.quantity > 0
281
+ );
282
+
283
+ return Boolean(filteredValues.length);
284
+ }, [formValues, relyOnPeopleCategoryIds]);
285
+ const onChangePeopleAmount = (value: number) => {
286
+ if (!setPeopleAmount) {
287
+ return;
288
+ }
289
+ setPeopleAmount(value);
290
+ if (value > 0) {
291
+ if (peopleAmountError) {
292
+ setPeopleAmountError(false);
293
+ }
294
+ return;
295
+ }
296
+
297
+ setPeopleAmountError(true);
298
+ };
299
+
254
300
  return (
255
301
  <Page
256
302
  headerBlock={
@@ -274,7 +320,6 @@ export function Default() {
274
320
  setFormValues={setFormValues}
275
321
  defaultValues={orderFormValues}
276
322
  onSubmit={onNextStep}
277
- relyOnPeopleCategoryIds={[4]}
278
323
  ref={formRef}
279
324
  />
280
325
  </PageBody.LeftBlock>
@@ -283,6 +328,13 @@ export function Default() {
283
328
  <PageBody.RightBlock
284
329
  bottomBlock={
285
330
  <BookingSummaryFooter>
331
+ {shouldShowPeopleInput && (
332
+ <RenderNumberOfPeopleInputComponent
333
+ peopleAmount={peopleAmount || 0}
334
+ onChangePeopleAmount={onChangePeopleAmount}
335
+ peopleAmountError={peopleAmountError}
336
+ />
337
+ )}
286
338
  <BookingSummary.SummaryTotal
287
339
  formValues={formValues}
288
340
  totalWithDiscount={5}
@@ -291,6 +343,7 @@ export function Default() {
291
343
  }
292
344
  >
293
345
  <BookingSummary
346
+ hasPeopleInput={shouldShowPeopleInput}
294
347
  date="29 Sept 2022 at 09:00"
295
348
  menuSteps={menuSteps as any}
296
349
  formValues={formValues}
@@ -19,6 +19,7 @@ export const BookingSummary = ({
19
19
  transactionFee = 0,
20
20
  productsWithErrors,
21
21
  isLoading,
22
+ hasPeopleInput,
22
23
  }: Omit<BookingSummaryProps, "totallWithDiscount">) => {
23
24
  const { t } = useTranslation("Design");
24
25
  const { formatNumber } = useIntl();
@@ -46,7 +47,7 @@ export const BookingSummary = ({
46
47
 
47
48
  return (
48
49
  <div className="payment-booking-summary">
49
- <BookingSummaryAccordion>
50
+ <BookingSummaryAccordion hasPeopleInput={hasPeopleInput}>
50
51
  <div className="event-info">
51
52
  <p className="m-0 title event-name">{eventName}</p>
52
53
  <p className="m-0">{date}</p>
@@ -19,12 +19,14 @@ import { useResizePageBody } from "../../../../../page/components/PageBody/hooks
19
19
  export type BookingSummaryAccordionProps = PropsWithChildren<{
20
20
  title?: string;
21
21
  showTitleOnlyOnMobile?: boolean;
22
+ hasPeopleInput?: boolean;
22
23
  }>;
23
24
 
24
25
  export const BookingSummaryAccordion = ({
25
26
  children,
26
27
  title,
27
28
  showTitleOnlyOnMobile = false,
29
+ hasPeopleInput,
28
30
  }: BookingSummaryAccordionProps) => {
29
31
  const { width } = useWindowDimensions();
30
32
  const [isExpanded, setIsExpanded] = useState(width <= MOBILE_WIDTH);
@@ -77,7 +79,9 @@ export const BookingSummaryAccordion = ({
77
79
  onEntered={onExpanded}
78
80
  onExit={onCollapse}
79
81
  onExited={onCollapsed}
80
- className={showToggleHeader && "has-toggler"}
82
+ className={`${showToggleHeader && "has-toggler"} ${
83
+ hasPeopleInput && "collapse-with-people-input"
84
+ }`}
81
85
  style={rightBlockContentStyles}
82
86
  >
83
87
  <div className="summary-wrapper">{children}</div>
@@ -13,6 +13,7 @@ export type BookingSummaryProps = {
13
13
  totalWithDiscount?: number;
14
14
  isNotShownPeopleAmount?: boolean;
15
15
  eventName: string;
16
+ hasPeopleInput?: boolean;
16
17
  transactionFee?: number;
17
18
  isFreePayment?: boolean;
18
19
  productsWithErrors?: ProductQuantityCheckResponse["products"];
@@ -7,8 +7,8 @@ import * as Config from "@licklist/core/dist/Config";
7
7
  import HookFormService from "@licklist/plugins/dist/services/Form/HookFormService";
8
8
  import { TicketDescription } from "../../../event/ticket-description";
9
9
  import { ProductCategory, Product } from "../../../../types";
10
- import { NumberInput } from "./components/NumberInput";
11
10
  import { StepsFormProps } from "../StepsForm/StepsForm";
11
+ import { ProductQuantityInput } from "./components/ProductQuantityInput";
12
12
 
13
13
  interface CategoryProductProps {
14
14
  product: Product;
@@ -126,52 +126,16 @@ export const CategoryProduct = ({
126
126
  currency: Config.Currency.GBP,
127
127
  })}
128
128
  </span>
129
- {product.isSoldOut ? (
130
- <div className="iframe-event__sold-out-wrapper">
131
- {t("Design:soldOut")}
132
- </div>
133
- ) : (
134
- <NumberInput
135
- ref={ref}
136
- onChange={(val) => {
137
- onChange({
138
- id: product.id,
139
- name: product.name,
140
- deposit,
141
- price: product.price,
142
- productsCategoryId: category.id,
143
- quantity: val,
144
- });
145
- clearErrors(`${product.id}` as const);
146
- }}
147
- onArrowDown={() => {
148
- onChange({
149
- id: product.id,
150
- name: product.name,
151
- deposit,
152
- price: product.price,
153
- productsCategoryId: category.id,
154
- quantity: productInfo?.quantity - 1 || 0,
155
- });
156
- clearErrors(`${product.id}` as const);
157
- }}
158
- onArrowUp={() => {
159
- onChange({
160
- id: product.id,
161
- name: product.name,
162
- deposit,
163
- price: product.price,
164
- productsCategoryId: category.id,
165
- quantity: (productInfo?.quantity ?? 0) + 1,
166
- });
167
- clearErrors(`${product.id}` as const);
168
- }}
169
- min={0}
170
- disabled={product.isSoldOut}
171
- value={productInfo?.quantity || 0}
172
- className={clsx(invalid && "error")}
173
- />
174
- )}
129
+ <ProductQuantityInput
130
+ onChange={onChange}
131
+ productInfo={productInfo}
132
+ ref={ref}
133
+ clearErrors={clearErrors}
134
+ product={product}
135
+ category={category}
136
+ invalid={invalid}
137
+ deposit={deposit}
138
+ />
175
139
  </div>
176
140
  {deposit && !category?.remainderExpireAfter && (
177
141
  <div className="mt-4">
@@ -0,0 +1,118 @@
1
+ import React from "react";
2
+ import clsx from "clsx";
3
+ import { Button } from "react-bootstrap";
4
+ import { useTranslation } from "react-i18next";
5
+ import { FieldValues, RefCallBack, UseFormClearErrors } from "react-hook-form";
6
+ import { NumberInput } from "../NumberInput";
7
+ import { Product, ProductCategory } from "../../../../../../types";
8
+
9
+ interface FormOrderItem {
10
+ id: number;
11
+ name: string;
12
+ price: number;
13
+ productsCategoryId: number;
14
+ deposit?: number | null;
15
+ quantity: number;
16
+ }
17
+
18
+ interface ProductQuantityInputProps {
19
+ product: Product;
20
+ category: ProductCategory;
21
+ clearErrors: UseFormClearErrors<FieldValues>;
22
+ onChange: (value: FormOrderItem) => void;
23
+ deposit?: number;
24
+ ref: RefCallBack;
25
+ invalid: boolean;
26
+ productInfo: FormOrderItem;
27
+ }
28
+
29
+ export const ProductQuantityInput = ({
30
+ product,
31
+ category,
32
+ onChange,
33
+ clearErrors,
34
+ ref,
35
+ productInfo,
36
+ invalid,
37
+ deposit,
38
+ }: ProductQuantityInputProps) => {
39
+ const { t } = useTranslation("Design");
40
+
41
+ const onClick = () => {
42
+ onChange({
43
+ id: product.id,
44
+ name: product.name,
45
+ deposit,
46
+ price: product.price,
47
+ productsCategoryId: category.id,
48
+ quantity: productInfo?.quantity ? 0 : 1,
49
+ });
50
+ };
51
+
52
+ if (product.isSoldOut) {
53
+ return (
54
+ <div className="iframe-event__sold-out-wrapper">
55
+ {t("Design:soldOut")}
56
+ </div>
57
+ );
58
+ }
59
+ if (product?.maxAmount === 1) {
60
+ return (
61
+ <Button
62
+ ref={ref}
63
+ disabled={product.isSoldOut}
64
+ className={clsx(
65
+ `iframe-event__${
66
+ productInfo?.quantity ? "unselect-product" : "select-product"
67
+ }`,
68
+ invalid && "error"
69
+ )}
70
+ onClick={onClick}
71
+ >
72
+ {t(`Design:${productInfo?.quantity ? "unselect" : "select"}`)}
73
+ </Button>
74
+ );
75
+ }
76
+ return (
77
+ <NumberInput
78
+ ref={ref}
79
+ onChange={(val) => {
80
+ onChange({
81
+ id: product.id,
82
+ name: product.name,
83
+ deposit,
84
+ price: product.price,
85
+ productsCategoryId: category.id,
86
+ quantity: val,
87
+ });
88
+ clearErrors(`${product.id}` as const);
89
+ }}
90
+ onArrowDown={() => {
91
+ onChange({
92
+ id: product.id,
93
+ name: product.name,
94
+ deposit,
95
+ price: product.price,
96
+ productsCategoryId: category.id,
97
+ quantity: productInfo?.quantity - 1 || 0,
98
+ });
99
+ clearErrors(`${product.id}` as const);
100
+ }}
101
+ onArrowUp={() => {
102
+ onChange({
103
+ id: product.id,
104
+ name: product.name,
105
+ deposit,
106
+ price: product.price,
107
+ productsCategoryId: category.id,
108
+ quantity: (productInfo?.quantity ?? 0) + 1,
109
+ });
110
+ clearErrors(`${product.id}` as const);
111
+ }}
112
+ min={0}
113
+ disabled={product.isSoldOut}
114
+ value={productInfo?.quantity || 0}
115
+ className={clsx(invalid && "error")}
116
+ />
117
+ );
118
+ };
@@ -0,0 +1 @@
1
+ export { ProductQuantityInput } from "./ProductQuantityInput";
@@ -65,7 +65,7 @@
65
65
  .iframe-event__category-product {
66
66
  margin-top: 1rem;
67
67
  padding-bottom: 1rem;
68
-
68
+
69
69
  border-bottom: 2px solid $separator-color;
70
70
 
71
71
  &:first-child {
@@ -73,7 +73,7 @@
73
73
  }
74
74
  }
75
75
 
76
- &:not(:first-child){
76
+ &:not(:first-child) {
77
77
  .iframe-event__name {
78
78
  margin: 1rem 0;
79
79
  }
@@ -89,6 +89,24 @@
89
89
  }
90
90
  }
91
91
 
92
+ &__select-product {
93
+ width: 10.5rem !important;
94
+ margin-top: 1rem;
95
+ }
96
+
97
+ &__unselect-product {
98
+ margin-top: 1rem;
99
+ width: 10.5rem !important;
100
+ background-color: $snippet-elements-button-color !important;
101
+ color: $snippet-elements-button-background-color !important;
102
+ border: 1px solid $snippet-elements-button-background-color !important;
103
+ }
104
+
105
+ &__unselect-product.error,
106
+ &__select-product.error {
107
+ border: 1px solid red !important;
108
+ }
109
+
92
110
  &__product-price-wrapper {
93
111
  display: flex;
94
112
  align-items: center;
@@ -143,7 +161,7 @@
143
161
  border-radius: $iframe-border-radius;
144
162
  font-size: 0.875rem;
145
163
  height: 2.25rem;
146
-
164
+
147
165
  &:active,
148
166
  &.active,
149
167
  &:hover,
@@ -156,25 +174,25 @@
156
174
  background-color: $snippet-elements-button-background-color;
157
175
  box-shadow: 0 0 0 $input-btn-focus-width $snippet-elements-button-background-color;
158
176
  }
159
-
177
+
160
178
  &:disabled {
161
179
  border: none;
162
180
  }
163
181
  }
164
-
182
+
165
183
  &:hover,
166
184
  &.hover,
167
185
  &:focus,
168
186
  &.focus {
169
187
  &:not(:disabled) {
170
- opacity: .7;
188
+ opacity: 0.7;
171
189
  }
172
190
  }
173
-
191
+
174
192
  &:active,
175
193
  &.active {
176
194
  &:not(:disabled) {
177
- opacity: .8;
195
+ opacity: 0.8;
178
196
  }
179
197
  }
180
198
  }
@@ -223,19 +241,19 @@
223
241
  &:focus,
224
242
  &.focus {
225
243
  &:not(:disabled) {
226
- opacity: .7;
244
+ opacity: 0.7;
227
245
  }
228
246
  }
229
247
 
230
248
  &:active,
231
249
  &.active {
232
250
  &:not(:disabled) {
233
- opacity: .8;
251
+ opacity: 0.8;
234
252
  }
235
253
  }
236
254
  }
237
255
 
238
- &__book-now{
256
+ &__book-now {
239
257
  margin: 1rem 0;
240
258
  position: fixed;
241
259
  left: 0;
@@ -260,15 +278,23 @@
260
278
  justify-content: center;
261
279
  width: 10.5rem;
262
280
  height: 2rem;
263
- color: #9D9D9D;
264
- background-color: #F3F3F3;
281
+ color: #9d9d9d;
282
+ background-color: #f3f3f3;
265
283
  border-radius: $iframe-border-radius;
266
284
  }
267
285
  }
268
286
 
269
287
  .people-input {
288
+ margin-bottom: 1rem;
289
+ h3 {
290
+ font-size: 1rem;
291
+ }
292
+ input[type="number"] {
293
+ height: 2rem;
294
+ }
295
+
270
296
  .input-wrapper {
271
- justify-content: center
297
+ justify-content: center;
272
298
  }
273
299
 
274
300
  .iframe-event {
@@ -341,6 +367,7 @@
341
367
  }
342
368
 
343
369
  .people-input {
370
+ margin-bottom: 0;
344
371
  .input-wrapper {
345
372
  justify-content: space-between;
346
373
  }
@@ -349,6 +376,9 @@
349
376
  &__name {
350
377
  margin-bottom: 1rem;
351
378
  }
379
+ &__message-error {
380
+ padding-bottom: 0.5rem;
381
+ }
352
382
  }
353
383
  }
354
384
  }
@@ -126,6 +126,9 @@
126
126
  max-height: 7.5rem;
127
127
  }
128
128
  }
129
+ .collapse-with-people-input {
130
+ max-height: calc(100vh - 22rem);
131
+ }
129
132
 
130
133
  .collapsing {
131
134
  transition: none;