@licklist/design 0.44.491 → 0.44.493
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/events/event-venue-map/EventVenueMap.d.ts +3 -0
- package/dist/events/event-venue-map/EventVenueMap.d.ts.map +1 -1
- package/dist/events/event-venue-map/EventVenueMap.js +1 -1
- package/dist/events/event-venue-map/components/VenueMap/VenueMap.d.ts +2 -0
- package/dist/events/event-venue-map/components/VenueMap/VenueMap.d.ts.map +1 -1
- package/dist/events/event-venue-map/components/VenueMap/VenueMap.js +1 -1
- package/dist/iframe/event/event-card/IframeEventCard.js +1 -1
- package/dist/iframe/event/event-order-short-summary/components/Summary/Summary.d.ts +4 -5
- package/dist/iframe/event/event-order-short-summary/components/Summary/Summary.d.ts.map +1 -1
- package/dist/iframe/event/event-order-short-summary/components/Summary/Summary.js +1 -1
- package/dist/iframe/event/event-venue-map/IframeEventVenueMap.d.ts +4 -0
- package/dist/iframe/event/event-venue-map/IframeEventVenueMap.d.ts.map +1 -1
- package/dist/iframe/order-process/components/CalendarStepsForm/CalendarStepsForm.d.ts +2 -0
- package/dist/iframe/order-process/components/CalendarStepsForm/CalendarStepsForm.d.ts.map +1 -1
- package/dist/iframe/order-process/components/CalendarStepsForm/CalendarStepsForm.js +1 -1
- package/dist/iframe/order-process/components/CalendarStepsForm/components/Category.d.ts +3 -1
- package/dist/iframe/order-process/components/CalendarStepsForm/components/Category.d.ts.map +1 -1
- package/dist/iframe/order-process/components/CalendarStepsForm/components/Category.js +1 -1
- package/dist/iframe/order-process/components/CalendarStepsForm/components/CategoryProductModal.d.ts +3 -1
- package/dist/iframe/order-process/components/CalendarStepsForm/components/CategoryProductModal.d.ts.map +1 -1
- package/dist/iframe/order-process/components/CalendarStepsForm/components/CategoryProductModal.js +1 -1
- package/dist/iframe/order-process/components/Category/Category.d.ts +2 -1
- package/dist/iframe/order-process/components/Category/Category.d.ts.map +1 -1
- package/dist/iframe/order-process/components/Category/Category.js +1 -1
- package/dist/iframe/order-process/components/CategoryProduct/CategoryProduct.d.ts +2 -1
- package/dist/iframe/order-process/components/CategoryProduct/CategoryProduct.d.ts.map +1 -1
- package/dist/iframe/order-process/components/CategoryProduct/CategoryProduct.js +1 -1
- package/dist/iframe/order-process/components/StepsForm/StepsForm.d.ts +1 -0
- package/dist/iframe/order-process/components/StepsForm/StepsForm.d.ts.map +1 -1
- package/dist/iframe/order-process/components/StepsForm/StepsForm.js +1 -1
- package/dist/iframe/payment/order-items-table/hooks/useTableData.d.ts +5 -0
- package/dist/iframe/payment/order-items-table/hooks/useTableData.d.ts.map +1 -1
- package/dist/iframe/payment/order-items-table/hooks/useTableData.js +1 -1
- package/dist/iframe/payment/order-items-table/utils/index.d.ts +6 -1
- package/dist/iframe/payment/order-items-table/utils/index.d.ts.map +1 -1
- package/dist/iframe/payment/order-items-table/utils/index.js +1 -1
- package/dist/product-set/form/StepsControl.d.ts.map +1 -1
- package/dist/product-set/form/StepsControl.js +1 -1
- package/dist/sales/booking/filter/components/AdditionalFIlterSection.js +1 -1
- package/package.json +1 -1
- package/src/events/event-venue-map/EventVenueMap.tsx +4 -0
- package/src/events/event-venue-map/components/VenueMap/VenueMap.tsx +12 -4
- package/src/iframe/event/event-card/IframeEventCard.tsx +1 -1
- package/src/iframe/event/event-order-short-summary/components/Summary/Summary.tsx +20 -20
- package/src/iframe/order-process/components/CalendarStepsForm/CalendarStepsForm.stories.tsx +1 -0
- package/src/iframe/order-process/components/CalendarStepsForm/CalendarStepsForm.tsx +5 -0
- package/src/iframe/order-process/components/CalendarStepsForm/components/Category.tsx +4 -0
- package/src/iframe/order-process/components/CalendarStepsForm/components/CategoryProductModal.tsx +4 -0
- package/src/iframe/order-process/components/Category/Category.tsx +3 -0
- package/src/iframe/order-process/components/CategoryProduct/CategoryProduct.tsx +16 -1
- package/src/iframe/order-process/components/StepsForm/StepsForm.tsx +3 -0
- package/src/iframe/payment/order-items-table/OrderItemsTable.stories.tsx +2 -0
- package/src/iframe/payment/order-items-table/hooks/useTableData.tsx +21 -14
- package/src/iframe/payment/order-items-table/utils/index.ts +55 -15
- package/src/product-set/form/StepsControl.tsx +20 -2
|
@@ -2,6 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { Point } from "@licklist/plugins/dist/types/context/event/point";
|
|
3
3
|
import { PointProduct } from "@licklist/core/dist/DataMapper/Product/PointProductDataMapper";
|
|
4
4
|
import { Product } from "@licklist/core/dist/DataMapper/Product/ProductDataMapper";
|
|
5
|
+
import { ProductQuantityCheckResponse } from "@licklist/plugins/dist/types/Api/verifyStock";
|
|
5
6
|
import { VenueMapRef } from "./components/VenueMap";
|
|
6
7
|
export declare type EventVenueMapIframeProps = {
|
|
7
8
|
width?: number;
|
|
@@ -20,6 +21,7 @@ export declare type EventVenueMapProps = {
|
|
|
20
21
|
products?: Partial<Product>[];
|
|
21
22
|
pointProducts?: Partial<PointProduct>[];
|
|
22
23
|
onPointProductsChange?: (values: Partial<PointProduct>[]) => void;
|
|
24
|
+
soldOutProducts?: ProductQuantityCheckResponse["products"];
|
|
23
25
|
} & EventVenueMapIframeProps;
|
|
24
26
|
export declare const EventVenueMap: React.ForwardRefExoticComponent<{
|
|
25
27
|
url: string;
|
|
@@ -30,5 +32,6 @@ export declare const EventVenueMap: React.ForwardRefExoticComponent<{
|
|
|
30
32
|
products?: Partial<Product>[];
|
|
31
33
|
pointProducts?: Partial<PointProduct>[];
|
|
32
34
|
onPointProductsChange?: (values: Partial<PointProduct>[]) => void;
|
|
35
|
+
soldOutProducts?: ProductQuantityCheckResponse["products"];
|
|
33
36
|
} & EventVenueMapIframeProps & React.RefAttributes<VenueMapRef>>;
|
|
34
37
|
//# sourceMappingURL=EventVenueMap.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventVenueMap.d.ts","sourceRoot":"","sources":["../../../src/events/event-venue-map/EventVenueMap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,KAAK,EAAE,MAAM,kDAAkD,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,+DAA+D,CAAC;AAC7F,OAAO,EAAE,OAAO,EAAE,MAAM,0DAA0D,CAAC;AACnF,OAAO,EAAY,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAG9D,oBAAY,wBAAwB,GAAG;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,0BAA0B,CAAC,EAAE,MAAM,EAAE,CAAC;CACvC,CAAC;AAEF,oBAAY,kBAAkB,GAAG;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,KAAK,IAAI,CAAC;IACnD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;IAC9B,aAAa,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;IACxC,qBAAqB,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,EAAE,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"EventVenueMap.d.ts","sourceRoot":"","sources":["../../../src/events/event-venue-map/EventVenueMap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,KAAK,EAAE,MAAM,kDAAkD,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,+DAA+D,CAAC;AAC7F,OAAO,EAAE,OAAO,EAAE,MAAM,0DAA0D,CAAC;AACnF,OAAO,EAAE,4BAA4B,EAAE,MAAM,8CAA8C,CAAC;AAC5F,OAAO,EAAY,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAG9D,oBAAY,wBAAwB,GAAG;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,0BAA0B,CAAC,EAAE,MAAM,EAAE,CAAC;CACvC,CAAC;AAEF,oBAAY,kBAAkB,GAAG;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,KAAK,IAAI,CAAC;IACnD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;IAC9B,aAAa,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;IACxC,qBAAqB,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,EAAE,KAAK,IAAI,CAAC;IAClE,eAAe,CAAC,EAAE,4BAA4B,CAAC,UAAU,CAAC,CAAC;CAC5D,GAAG,wBAAwB,CAAC;AAE7B,eAAO,MAAM,aAAa;SAXnB,MAAM;aACF,QAAQ,KAAK,CAAC,EAAE;WAClB,MAAM;6BACY,QAAQ,KAAK,CAAC,EAAE,KAAK,IAAI;eACvC,OAAO;eACP,QAAQ,OAAO,CAAC,EAAE;oBACb,QAAQ,YAAY,CAAC,EAAE;qCACN,QAAQ,YAAY,CAAC,EAAE,KAAK,IAAI;sBAC/C,4BAA4B,CAAC,UAAU,CAAC;gEAiD3D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,o=require("tslib"),t=require("react"),n=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,r=require("@licklist/plugins/dist/context/event/EventVenueMapContext"),i=require("./components/VenueMap/VenueMap.js"),s=require("./hooks/useCanvasSize.js"),u=t.forwardRef((function(e,t){var u=e.url,d=e.points,a=e.editMode,c=void 0!==a&&a,p=e.name,P=e.onPointsChange,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,o=require("tslib"),t=require("react"),n=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,r=require("@licklist/plugins/dist/context/event/EventVenueMapContext"),i=require("./components/VenueMap/VenueMap.js"),s=require("./hooks/useCanvasSize.js"),u=t.forwardRef((function(e,t){var u=e.url,d=e.points,a=e.editMode,c=void 0!==a&&a,p=e.name,P=e.onPointsChange,l=e.products,h=e.pointProducts,v=e.onPointProductsChange,C=e.width,f=e.height,M=e.onPointClick,g=e.usedInIframe,m=void 0!==g&&g,V=e.choosedProductUuids,q=void 0===V?[]:V,E=e.errorOnChoosedProductUuids,O=void 0===E?[]:E,j=e.soldOutProducts,k=s.useCanvasSize({width:C,height:f});return n.createElement(r.EventVenueMapProvider,{points:d,editMode:c,onPointsChange:P,products:l,pointProducts:h,onPointProductsChange:v},n.createElement(i.VenueMap,o.__assign({url:u,name:p},k,{onPointClick:M,usedInIframe:m,ref:t,choosedProductUuids:q,errorOnChoosedProductUuids:O,soldOutProducts:j})))}));exports.EventVenueMap=u;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { EventVenueMapContextProps } from "@licklist/plugins/dist/context/event/EventVenueMapContext";
|
|
3
|
+
import { ProductQuantityCheckResponse } from "@licklist/plugins/dist/types/Api/verifyStock";
|
|
3
4
|
export declare type VenueMapRef = Pick<EventVenueMapContextProps, "activeElementKey" | "setActiveElementKey">;
|
|
4
5
|
export declare type VenueMapProps = {
|
|
5
6
|
url: string;
|
|
@@ -10,6 +11,7 @@ export declare type VenueMapProps = {
|
|
|
10
11
|
usedInIframe?: boolean;
|
|
11
12
|
choosedProductUuids?: string[];
|
|
12
13
|
errorOnChoosedProductUuids?: string[];
|
|
14
|
+
soldOutProducts?: ProductQuantityCheckResponse["products"];
|
|
13
15
|
};
|
|
14
16
|
export declare const VenueMap: React.ForwardRefExoticComponent<VenueMapProps & React.RefAttributes<VenueMapRef>>;
|
|
15
17
|
//# sourceMappingURL=VenueMap.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VenueMap.d.ts","sourceRoot":"","sources":["../../../../../src/events/event-venue-map/components/VenueMap/VenueMap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAMN,MAAM,OAAO,CAAC;AAGf,OAAO,EAEL,yBAAyB,EAC1B,MAAM,2DAA2D,CAAC;
|
|
1
|
+
{"version":3,"file":"VenueMap.d.ts","sourceRoot":"","sources":["../../../../../src/events/event-venue-map/components/VenueMap/VenueMap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAMN,MAAM,OAAO,CAAC;AAGf,OAAO,EAEL,yBAAyB,EAC1B,MAAM,2DAA2D,CAAC;AACnE,OAAO,EAAE,4BAA4B,EAAE,MAAM,8CAA8C,CAAC;AAQ5F,oBAAY,WAAW,GAAG,IAAI,CAC5B,yBAAyB,EACzB,kBAAkB,GAAG,qBAAqB,CAC3C,CAAC;AAEF,oBAAY,aAAa,GAAG;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,0BAA0B,CAAC,EAAE,MAAM,EAAE,CAAC;IACtC,eAAe,CAAC,EAAE,4BAA4B,CAAC,UAAU,CAAC,CAAC;CAC5D,CAAC;AAEF,eAAO,MAAM,QAAQ,mFAiKpB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),n=require("react"),r=(e=n)&&"object"==typeof e&&"default"in e?e.default:e,a=require("@licklist/plugins/dist/context/event/EventVenueMapContext"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),n=require("react"),r=(e=n)&&"object"==typeof e&&"default"in e?e.default:e,a=require("@licklist/plugins/dist/context/event/EventVenueMapContext"),u=require("react-konva"),i=require("../../hooks/useImage.js"),o=require("../../hooks/useStageActions.js"),s=require("../MapPoint/MapPoint.js"),c=require("../Scrollbars/Scrollbars.js"),l=require("../ZoomButtons/ZoomButtons.js"),d=require("../Dropdown/Dropdown.js"),m=n.forwardRef((function(e,m){var f=e.url,g=e.name,p=e.width,v=e.height,h=e.onPointClick,E=e.usedInIframe,y=void 0!==E&&E,P=e.choosedProductUuids,x=void 0===P?[]:P,C=e.errorOnChoosedProductUuids,R=void 0===C?[]:C,S=e.soldOutProducts,_=n.useContext(a.EventVenueMapContext),q=_.mapPoints,I=_.stage,M=I.x,O=I.y,w=I.scale,b=_.setMapPoints,j=_.products,k=_.mapPointProducts,N=_.activeElementKey,U=_.setActiveElementKey,V=n.useRef(null),A=n.useRef(null),K=n.useRef(null),B=t.__read(i.useImage(f,{width:p,height:v}),2),D=B[0],T=B[1],W=T.x,X=T.y,Y=T.scaledWidth,Z=T.scaledHeight,H=T.imageScale,z=o.useStageActions({stageRef:A.current,imageRef:K.current,layerRef:V.current,imageScale:H}),L=z.onWheel,F=z.onClick,G=z.changeCursorType;n.useImperativeHandle(m,(function(){return{activeElementKey:N,setActiveElementKey:U}})),n.useEffect((function(){b((function(e){return e.map((function(e,n){return t.__assign(t.__assign({},e),{pointNumber:n+1})}))}))}),[]),n.useEffect((function(){h&&h(N?Number(N):void 0)}),[h,N]);var J=function(e){var t=k.find((function(t){return t.pointId===e}));if(!t)return!1;var n=j.find((function(e){return e.uuid===t.productUuid}));return(null==n?void 0:n.isSoldOut)||n&&!!(null==S?void 0:S.find((function(e){return(null==e?void 0:e.product_id)===(null==n?void 0:n.id)})))||!1};return r.createElement("div",{className:"venue-map",style:{width:p,height:v}},r.createElement("div",{className:"zone-name"},r.createElement("h6",null,g)),r.createElement(l.ZoomButtons,{stageRef:A.current,imageRef:K.current}),r.createElement(c.Scrollbars,{stageRef:A.current,imageRef:K.current,layerRef:V.current}),r.createElement(a.EventVenueMapContext.Consumer,null,(function(e){return r.createElement(u.Stage,{width:p,height:v,className:"canvas-map",onClick:F,onTap:F,ref:A,x:M,y:O,scale:{x:w,y:w},onWheel:L},r.createElement(a.EventVenueMapContext.Provider,{value:e},r.createElement(u.Layer,{ref:V},r.createElement(u.Image,{image:D,x:W,y:X,width:Y,height:Z,ref:K}),q.map((function(e){return r.createElement(s.MapPoint,t.__assign({},e,{imageOffsetX:W,imageOffsetY:X,imageScale:H,key:e.id||e.localId,isSoldOut:J(e.id),scale:w,changeCursorType:G,usedInIframe:y,choosedProductUuids:x,errorOnChoosedProductUuids:R}))})))))})),!y&&r.createElement(d.Dropdown,{imageOffsetX:W,imageOffsetY:X,imageScale:H,scale:w,stageX:M,stageY:O}))}));exports.VenueMap=m;
|
|
@@ -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")),a=require("react-i18next"),r=require("react-bootstrap"),i=e(require("clsx")),s=require("react-intl"),l=require("../../../tiptap-editor/TipTapEditor.js"),c=require("../../../events/event-card/utils.js"),n=require("../../../assets/iframe/clock.svg.js"),d=require("../../../assets/iframe/calendar.svg.js"),m=require("../../../assets/iframe/ticket.svg.js");exports.IframeEventCard=function(e){var o=e.title,p=e.type,v=e.cost,u=e.date,f=e.imageSrc,E=e.snippetSetting,N=void 0===E?{displayType:!0,displayCost:!0,displayDescription:!0}:E,
|
|
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")),a=require("react-i18next"),r=require("react-bootstrap"),i=e(require("clsx")),s=require("react-intl"),l=require("../../../tiptap-editor/TipTapEditor.js"),c=require("../../../events/event-card/utils.js"),n=require("../../../assets/iframe/clock.svg.js"),d=require("../../../assets/iframe/calendar.svg.js"),m=require("../../../assets/iframe/ticket.svg.js");exports.IframeEventCard=function(e){var o=e.title,p=e.type,v=e.cost,u=e.date,f=e.imageSrc,E=e.snippetSetting,N=void 0===E?{displayType:!0,displayCost:!0,displayDescription:!0}:E,y=e.colour,g=e.goToDetails,C=e.description,b=e.isListView,x=void 0!==b&&b,_=e.className,T=e.shortDate,w=e.titleId,q=e.descriptionId,j=s.useIntl().formatNumber,I=a.useTranslation("Design").t;return t.createElement(r.Card,{style:{"--card-colour":y},className:i("iframe-event-card",{"list-view":x},_),onClick:g?function(){g&&g()}:void 0},f&&t.createElement(r.Card.Img,{className:"card-image",variant:"top",as:"div",style:{backgroundImage:'url("'.concat(f,'")')}}),t.createElement(r.Card.Body,{className:i("d-flex","flex-column",!f&&"no-image")},t.createElement(r.Card.Title,{className:"iframe-event-card__title",id:w},o),t.createElement("div",{className:"flex-grow-1 iframe-event-card__description"},t.createElement(r.Card.Text,{as:"div"},t.createElement("div",{className:"d-flex align-items-center mb-3"},t.createElement("div",{className:"icon-wrapper"},t.createElement(d.ReactComponent,null)),t.createElement("p",{className:"iframe-event-card__bold m-0 list-view-hided"},u),t.createElement("p",{className:"iframe-event-card__bold m-0 grid-view-hided"},T))),p&&!!N.displayType&&t.createElement(r.Card.Text,{as:"div",className:"list-view-hided"},t.createElement("div",{className:"d-flex align-items-center mb-3"},t.createElement("div",{className:"icon-wrapper"},t.createElement(n.ReactComponent,null)),t.createElement("p",{className:"iframe-event-card__bold m-0"},p))),"number"==typeof v&&!!N.displayCost&&t.createElement(r.Card.Text,{as:"div"},t.createElement("div",{className:"d-flex align-items-center mb-3"},t.createElement("div",{className:"icon-wrapper"},t.createElement(m.ReactComponent,null)),t.createElement("p",{className:"iframe-event-card__bold m-0"},I("from")," ",j(v,{style:"currency",currency:"GBP"})))),C&&!!N.displayDescription&&t.createElement(r.Card.Text,{as:"div",className:"list-view-hided"},t.createElement(l.TipTapEditor,{viewMode:!0,disabled:!0,content:c.formatContent(C,150),id:q})))))};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
export declare type SummaryDataType = {
|
|
3
3
|
title: string;
|
|
4
4
|
name: string;
|
|
5
5
|
image?: string;
|
|
6
6
|
quantity?: number;
|
|
7
7
|
}[];
|
|
8
|
-
export declare
|
|
9
|
-
data:
|
|
10
|
-
}) =>
|
|
11
|
-
export declare const Summary: SummaryProps;
|
|
8
|
+
export declare const Summary: ({ data }: {
|
|
9
|
+
data: SummaryDataType;
|
|
10
|
+
}) => JSX.Element;
|
|
12
11
|
//# sourceMappingURL=Summary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Summary.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/event/event-order-short-summary/components/Summary/Summary.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Summary.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/event/event-order-short-summary/components/Summary/Summary.tsx"],"names":[],"mappings":";AAGA,oBAAY,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,EAAE,CAAC;AAEJ,eAAO,MAAM,OAAO;;iBAqBnB,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")),a=e(require("clsx"));exports.Summary=function(e){var r=e.data
|
|
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")),a=e(require("clsx"));exports.Summary=function(e){var r=e.data,m=void 0===r?[]:r;return t.createElement(t.Fragment,null,m.map((function(e){var r=e.name,m=e.image,n=e.quantity,l=e.title,c=a("name","mb-4",m&&"align-items-center");return t.createElement("div",{key:r,className:"summary"},t.createElement("p",{className:"title mb-1"},l),t.createElement("div",{className:c},m&&t.createElement("img",{className:"image mr-3",src:m,alt:r}),n&&n>1&&t.createElement("span",{className:"quantity mr-3"},n,"x"),r))})))};
|
|
@@ -11,5 +11,9 @@ export declare const IframeEventVenueMap: React.ForwardRefExoticComponent<{
|
|
|
11
11
|
products?: Partial<import("@licklist/core/dist/DataMapper/Product/ProductDataMapper").Product>[];
|
|
12
12
|
pointProducts?: Partial<import("@licklist/core/dist/DataMapper/Product/PointProductDataMapper").PointProduct>[];
|
|
13
13
|
onPointProductsChange?: (values: Partial<import("@licklist/core/dist/DataMapper/Product/PointProductDataMapper").PointProduct>[]) => void;
|
|
14
|
+
soldOutProducts?: {
|
|
15
|
+
product_id: number;
|
|
16
|
+
message: string;
|
|
17
|
+
}[];
|
|
14
18
|
} & import("../../../events/event-venue-map/EventVenueMap").EventVenueMapIframeProps & React.RefAttributes<VenueMapRef>>;
|
|
15
19
|
//# sourceMappingURL=IframeEventVenueMap.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IframeEventVenueMap.d.ts","sourceRoot":"","sources":["../../../../src/iframe/event/event-venue-map/IframeEventVenueMap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiC,MAAM,OAAO,CAAC;AAEtD,OAAO,EAEL,kBAAkB,EACnB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,qDAAqD,CAAC;AAElF,oBAAY,wBAAwB,GAAG,kBAAkB,CAAC;AAE1D,eAAO,MAAM,mBAAmB
|
|
1
|
+
{"version":3,"file":"IframeEventVenueMap.d.ts","sourceRoot":"","sources":["../../../../src/iframe/event/event-venue-map/IframeEventVenueMap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiC,MAAM,OAAO,CAAC;AAEtD,OAAO,EAEL,kBAAkB,EACnB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,qDAAqD,CAAC;AAElF,oBAAY,wBAAwB,GAAG,kBAAkB,CAAC;AAE1D,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;wHAa9B,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Step } from "@licklist/core/dist/DataMapper/Product/StepDataMapper";
|
|
3
|
+
import { ProductQuantityCheckResponse } from "@licklist/plugins/dist/types/Api/verifyStock";
|
|
3
4
|
import { MenuStep } from "../../../../types";
|
|
4
5
|
export interface CalendarStepsFormProps {
|
|
5
6
|
step: MenuStep;
|
|
@@ -13,6 +14,7 @@ export interface CalendarStepsFormProps {
|
|
|
13
14
|
onActiveVenueMapChange?: (nextVenueMapId: string) => void;
|
|
14
15
|
title: string;
|
|
15
16
|
menuStepWithVenueMap: Step;
|
|
17
|
+
soldOutProducts?: ProductQuantityCheckResponse["products"];
|
|
16
18
|
}
|
|
17
19
|
export declare type StepsFormRef = {
|
|
18
20
|
getFormValues: () => Record<string, any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CalendarStepsForm.d.ts","sourceRoot":"","sources":["../../../../../src/iframe/order-process/components/CalendarStepsForm/CalendarStepsForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;AAUf,OAAO,EAAE,IAAI,EAAE,MAAM,uDAAuD,CAAC;
|
|
1
|
+
{"version":3,"file":"CalendarStepsForm.d.ts","sourceRoot":"","sources":["../../../../../src/iframe/order-process/components/CalendarStepsForm/CalendarStepsForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;AAUf,OAAO,EAAE,IAAI,EAAE,MAAM,uDAAuD,CAAC;AAG7E,OAAO,EAAE,4BAA4B,EAAE,MAAM,8CAA8C,CAAC;AAE5F,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAY7C,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,QAAQ,CAAC;IACf,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;IAChD,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;IACrD,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACnC,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;IACtD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,sBAAsB,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1D,KAAK,EAAE,MAAM,CAAC;IACd,oBAAoB,EAAE,IAAI,CAAC;IAC3B,eAAe,CAAC,EAAE,4BAA4B,CAAC,UAAU,CAAC,CAAC;CAC5D;AAED,oBAAY,YAAY,GAAG;IACzB,aAAa,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC1C,CAAC;AAEF,eAAO,MAAM,iBAAiB,6FAqT7B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),r=require("react"),n=(e=r)&&"object"==typeof e&&"default"in e?e.default:e,o=require("react-i18next"),u=require("react-bootstrap"),i=require("react-hook-form"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),r=require("react"),n=(e=r)&&"object"==typeof e&&"default"in e?e.default:e,o=require("react-i18next"),u=require("react-bootstrap"),i=require("react-hook-form"),s=require("lodash"),a=require("@licklist/plugins/dist/hooks/Value/usePreviousValue"),l=require("@licklist/plugins/dist/utils/ScrollUtils"),c=require("@licklist/plugins/dist/utils/FormValues"),d=require("../../../event/event-calendar/components/CalendarSelect/CalendarSelect.js"),f=require("../../../event/event-venue-map/IframeEventVenueMap.js"),m=require("../../constants.js"),p=require("./components/ErrorModal.js"),v=require("../utils/category.js"),g=require("./components/Category.js"),E=require("../../../page/components/PageBody/PageBody.js"),_=r.forwardRef((function(e,_){var y=e.step,S=e.isLastMenuStep,C=e.setFormValues,P=e.defaultValues,h=e.onSubmit,M=e.setFormErrors,q=e.id,V=void 0===q?m.STEP_FORM_ID:q,F=e.activeVenueMapId,b=e.title,k=e.menuStepWithVenueMap,j=e.onActiveVenueMapChange,I=e.soldOutProducts,O=i.useForm({defaultValues:P}),A=r.useRef(null),B=v.useCategory().verifyCategoryItems,T=O.control,x=O.formState.errors,K=O.formState,L=O.getValues,N=O.reset,R=O.setError,U=O.clearErrors,D=i.useWatch({control:T}),W=a.usePreviousValue(x),w=o.useTranslation("Design").t,H=t.__read(r.useState(""),2),z=H[0],G=H[1],J=t.__read(r.useState(F),2),Q=J[0],X=J[1],Y=t.__read(r.useState(void 0),2),Z=Y[0],$=Y[1],ee=t.__read(r.useState([]),2),te=ee[0],re=ee[1];r.useImperativeHandle(_,(function(){return{getFormValues:function(){return L()}}}));var ne=function(){var e;null===(e=A.current)||void 0===e||e.setActiveElementKey(void 0)},oe=r.useMemo((function(){var e;return null===(e=null==k?void 0:k.venueMapSet)||void 0===e?void 0:e.venueMaps}),[k]),ue=r.useMemo((function(){return oe&&k?oe.find((function(e){return String(e.id)===String(Q)})):null}),[oe,Q,k]),ie=r.useMemo((function(){if(!oe||!oe.length||!k)return[];var e=k.pointProducts.map((function(e){return e.pointId}));return oe.filter((function(t){var r=t.points;return r.length&&r.some((function(t){var r=t.id;return e.includes(r)}))})).map((function(e){return{label:e.name,value:e.id}}))}),[oe,k]),se=r.useMemo((function(){return ue?ue.points.filter((function(e){return Boolean(k.pointProducts.find((function(t){return t.pointId===e.id})))})):[]}),[k,ue]),ae=r.useCallback((function(e){var r;return y&&(null===(r=null==y?void 0:y.productCategories)||void 0===r?void 0:r.length)?null==y?void 0:y.productCategories.reduce((function(r,n){var o=n.products.filter((function(t){return e.includes(String(t.id))}));return o.length?t.__spreadArray(t.__spreadArray([],t.__read(r),!1),t.__read(o.map((function(e){return e.uuid}))),!1):r}),[]):[]}),[y]),le=r.useCallback((function(e){X(e),j&&j(e)}),[j]),ce=r.useMemo((function(){return ae(Object.keys(D).filter((function(e){var t,r;return Boolean(null===(t=D[e])||void 0===t?void 0:t.id)&&(null===(r=D[e])||void 0===r?void 0:r.quantity)>=1})).map((function(e){return String(e)})))}),[D,ae,x]),de=r.useMemo((function(){return Object.keys(x).length?ae(Object.keys(x).map((function(e){return String(e)}))):[]}),[x,ae,K]);return r.useEffect((function(){re(y.productCategories&&y.productCategories.length?y.productCategories.reduce((function(e,r){return t.__spreadArray(t.__spreadArray([],t.__read(e),!1),t.__read(r.products||[]),!1)}),[]):[])}),[y]),r.useEffect((function(){oe.length&&!Q&&X(String(oe[0].id))}),[oe,Q]),r.useEffect((function(){C(D),x&&setTimeout(U,0)}),[D]),r.useEffect((function(){c.isFormValuesEmpty(D)||G("")}),[D]),r.useEffect((function(){N(P)}),[P]),r.useEffect((function(){!s.isEqual(x,W)&&M&&M(x)}),[x,W,M]),r.useEffect((function(){Q!==F&&X(F)}),[F,Q]),r.useEffect((function(){$(void 0),ne()}),[Q,$]),n.createElement(n.Fragment,null,n.createElement(E.PageBody.LeftBlock,{title:b,component:ie.length>1&&n.createElement(d.CalendarSelect,{value:F,onChange:le,options:ie}),childrenClassName:"bordered"},n.createElement(p.ErrorModal,{isOpen:Boolean(z),messageKey:z,onClose:function(){return G("")}}),n.createElement(u.Form,{onSubmit:O.handleSubmit((function(e){if(S&&c.isFormValuesEmpty(e))G(w("pleaseSelectAtLeastFrom",{min:1,type:"item",from:"those categories"}));else{var t=B(e,y);if(t)return G(t.message),void R("category_".concat(t.id),{message:t.message});h(e)}}),(function(e){l.scrollToError(c.getFirstErrorKey(e)),G(w("pleaseCheckSelectedProducts"))})),id:V,className:"category-steps-form"},n.createElement(i.FormProvider,t.__assign({},O),n.createElement("div",{className:"position-relative"},ue&&n.createElement(n.Fragment,null,n.createElement(f.IframeEventVenueMap,{url:ue.image.url,usedInIframe:!0,onPointClick:$,products:te,points:se,pointProducts:k.pointProducts,ref:A,choosedProductUuids:ce,errorOnChoosedProductUuids:de,soldOutProducts:I}),n.createElement(g.Category,{productCategories:null==y?void 0:y.productCategories,activePointId:Z,pointProducts:k.pointProducts,onCloseModal:ne,soldOutProducts:I})))))))}));exports.CalendarStepsForm=_;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { PointProduct } from "@licklist/core/dist/DataMapper/Product/PointProductDataMapper";
|
|
3
|
+
import { ProductQuantityCheckResponse } from "@licklist/plugins/dist/types/Api/verifyStock";
|
|
3
4
|
import { ProductCategory } from "../../../../../types";
|
|
4
5
|
export declare type CategoryProps = {
|
|
5
6
|
productCategories: ProductCategory[];
|
|
6
7
|
activePointId?: number;
|
|
7
8
|
pointProducts: PointProduct[];
|
|
8
9
|
onCloseModal: () => void;
|
|
10
|
+
soldOutProducts?: ProductQuantityCheckResponse["products"];
|
|
9
11
|
};
|
|
10
|
-
export declare const Category: ({ productCategories, activePointId, pointProducts, onCloseModal, }: CategoryProps) => JSX.Element;
|
|
12
|
+
export declare const Category: ({ productCategories, activePointId, pointProducts, onCloseModal, soldOutProducts, }: CategoryProps) => JSX.Element;
|
|
11
13
|
//# sourceMappingURL=Category.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Category.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/order-process/components/CalendarStepsForm/components/Category.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,+DAA+D,CAAC;AAC7F,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGvD,oBAAY,aAAa,GAAG;IAC1B,iBAAiB,EAAE,eAAe,EAAE,CAAC;IACrC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,YAAY,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"Category.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/order-process/components/CalendarStepsForm/components/Category.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,+DAA+D,CAAC;AAC7F,OAAO,EAAE,4BAA4B,EAAE,MAAM,8CAA8C,CAAC;AAC5F,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGvD,oBAAY,aAAa,GAAG;IAC1B,iBAAiB,EAAE,eAAe,EAAE,CAAC;IACrC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,eAAe,CAAC,EAAE,4BAA4B,CAAC,UAAU,CAAC,CAAC;CAC5D,CAAC;AAEF,eAAO,MAAM,QAAQ,wFAMlB,aAAa,gBAyBf,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),o=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,r=require("./CategoryProductModal.js");exports.Category=function(e){var t=e.productCategories,a=e.activePointId,u=e.pointProducts,c=e.onCloseModal,d=e.soldOutProducts;return o.createElement(o.Fragment,null,0!==t.length&&t.map((function(e){return o.createElement("div",{key:e.id,className:"iframe-event__category"},e.products.map((function(t){return o.createElement(r.CategoryProductModal,{key:t.id,product:t,category:e,activePointId:a,pointProducts:u,onCloseModal:c,soldOutProducts:d})})))})))};
|
package/dist/iframe/order-process/components/CalendarStepsForm/components/CategoryProductModal.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { PointProduct } from "@licklist/core/dist/DataMapper/Product/PointProductDataMapper";
|
|
3
|
+
import { ProductQuantityCheckResponse } from "@licklist/plugins/dist/types/Api/verifyStock";
|
|
3
4
|
import { ProductCategory, Product } from "../../../../../types";
|
|
4
5
|
export declare type CategoryProductModalProps = {
|
|
5
6
|
activePointId?: number;
|
|
@@ -7,6 +8,7 @@ export declare type CategoryProductModalProps = {
|
|
|
7
8
|
category: ProductCategory;
|
|
8
9
|
pointProducts: PointProduct[];
|
|
9
10
|
onCloseModal: () => void;
|
|
11
|
+
soldOutProducts?: ProductQuantityCheckResponse["products"];
|
|
10
12
|
};
|
|
11
|
-
export declare const CategoryProductModal: ({ activePointId, product, category, pointProducts, onCloseModal, }: CategoryProductModalProps) => JSX.Element;
|
|
13
|
+
export declare const CategoryProductModal: ({ activePointId, product, category, pointProducts, onCloseModal, soldOutProducts, }: CategoryProductModalProps) => JSX.Element;
|
|
12
14
|
//# sourceMappingURL=CategoryProductModal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CategoryProductModal.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/order-process/components/CalendarStepsForm/components/CategoryProductModal.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,+DAA+D,CAAC;AAC7F,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAIhE,oBAAY,yBAAyB,GAAG;IACtC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,YAAY,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"CategoryProductModal.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/order-process/components/CalendarStepsForm/components/CategoryProductModal.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,+DAA+D,CAAC;AAC7F,OAAO,EAAE,4BAA4B,EAAE,MAAM,8CAA8C,CAAC;AAC5F,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAIhE,oBAAY,yBAAyB,GAAG;IACtC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,eAAe,CAAC,EAAE,4BAA4B,CAAC,UAAU,CAAC,CAAC;CAC5D,CAAC;AAEF,eAAO,MAAM,oBAAoB,wFAO9B,yBAAyB,gBAmC3B,CAAC"}
|
package/dist/iframe/order-process/components/CalendarStepsForm/components/CategoryProductModal.js
CHANGED
|
@@ -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("react"),r=e(t),o=require("react-bootstrap"),
|
|
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("react"),r=e(t),o=require("react-bootstrap"),c=require("../../../../../static/Icon.js"),u=e(require("clsx")),a=require("../../CategoryProduct/CategoryProduct.js");exports.CategoryProductModal=function(e){var n=e.activePointId,d=e.product,i=e.category,s=e.pointProducts,l=e.onCloseModal,m=e.soldOutProducts,p=t.useMemo((function(){return s.find((function(e){return String(e.pointId)===String(n)}))}),[n,s]);return r.createElement("div",{className:u("category-product-modal",p&&p.productUuid===d.uuid&&"d-block")},r.createElement(a.CategoryProduct,{product:d,category:i,canExpandDescription:!1,soldOutProducts:m}),r.createElement("div",{className:"close-modal-button"},r.createElement(o.Button,{variant:"danger",className:"btn-sm rounded",onClick:l},r.createElement(c.default,{type:"times",height:"1rem"}))))};
|
|
@@ -5,8 +5,9 @@ import { StepsFormProps } from "../StepsForm/StepsForm";
|
|
|
5
5
|
interface CategoryProps {
|
|
6
6
|
productCategories: ProductCategory[];
|
|
7
7
|
productsWithErrors?: StepsFormProps["productsWithErrors"];
|
|
8
|
+
soldOutProducts?: StepsFormProps["productsWithErrors"];
|
|
8
9
|
errors?: DeepMap<Record<string, any>, FieldError>;
|
|
9
10
|
}
|
|
10
|
-
export declare function Category({ productCategories, productsWithErrors, errors, }: CategoryProps): JSX.Element;
|
|
11
|
+
export declare function Category({ productCategories, productsWithErrors, errors, soldOutProducts, }: CategoryProps): JSX.Element;
|
|
11
12
|
export {};
|
|
12
13
|
//# sourceMappingURL=Category.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Category.d.ts","sourceRoot":"","sources":["../../../../../src/iframe/order-process/components/Category/Category.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,UAAU,aAAa;IACrB,iBAAiB,EAAE,eAAe,EAAE,CAAC;IACrC,kBAAkB,CAAC,EAAE,cAAc,CAAC,oBAAoB,CAAC,CAAC;IAC1D,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,UAAU,CAAC,CAAC;CACnD;AAED,wBAAgB,QAAQ,CAAC,EACvB,iBAAiB,EACjB,kBAAkB,EAClB,MAAM,
|
|
1
|
+
{"version":3,"file":"Category.d.ts","sourceRoot":"","sources":["../../../../../src/iframe/order-process/components/Category/Category.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,UAAU,aAAa;IACrB,iBAAiB,EAAE,eAAe,EAAE,CAAC;IACrC,kBAAkB,CAAC,EAAE,cAAc,CAAC,oBAAoB,CAAC,CAAC;IAC1D,eAAe,CAAC,EAAE,cAAc,CAAC,oBAAoB,CAAC,CAAC;IACvD,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,UAAU,CAAC,CAAC;CACnD;AAED,wBAAgB,QAAQ,CAAC,EACvB,iBAAiB,EACjB,kBAAkB,EAClB,MAAM,EACN,eAAe,GAChB,EAAE,aAAa,eA+Bf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=require("react"),t=(e=r)&&"object"==typeof e&&"default"in e?e.default:e,a=require("../CategoryProduct/CategoryProduct.js");exports.Category=function(e){var r=e.productCategories,o=e.productsWithErrors,c=e.errors;return t.createElement(t.Fragment,null,0!==r.length&&r.map((function(e){var r=null==c?void 0:c["category_".concat(e.id)];return t.createElement("div",{key:e.id,className:"iframe-event__category"},t.createElement("h4",{className:"iframe-event__name"},e.name),r&&t.createElement("div",{className:"iframe-event__message-error"},null==r?void 0:r.message),e.products.map((function(r){return t.createElement(a.CategoryProduct,{key:r.id,product:r,category:e,productsWithErrors:o})})))})))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=require("react"),t=(e=r)&&"object"==typeof e&&"default"in e?e.default:e,a=require("../CategoryProduct/CategoryProduct.js");exports.Category=function(e){var r=e.productCategories,o=e.productsWithErrors,c=e.errors,u=e.soldOutProducts;return t.createElement(t.Fragment,null,0!==r.length&&r.map((function(e){var r=null==c?void 0:c["category_".concat(e.id)];return t.createElement("div",{key:e.id,className:"iframe-event__category"},t.createElement("h4",{className:"iframe-event__name"},e.name),r&&t.createElement("div",{className:"iframe-event__message-error"},null==r?void 0:r.message),e.products.map((function(r){return t.createElement(a.CategoryProduct,{key:r.id,product:r,category:e,productsWithErrors:o,soldOutProducts:u})})))})))};
|
|
@@ -6,7 +6,8 @@ interface CategoryProductProps {
|
|
|
6
6
|
category: ProductCategory;
|
|
7
7
|
canExpandDescription?: boolean;
|
|
8
8
|
productsWithErrors?: StepsFormProps["productsWithErrors"];
|
|
9
|
+
soldOutProducts?: StepsFormProps["productsWithErrors"];
|
|
9
10
|
}
|
|
10
|
-
export declare const CategoryProduct: ({ product, category, canExpandDescription, productsWithErrors, }: CategoryProductProps) => JSX.Element;
|
|
11
|
+
export declare const CategoryProduct: ({ product, category, canExpandDescription, productsWithErrors, soldOutProducts, }: CategoryProductProps) => JSX.Element;
|
|
11
12
|
export {};
|
|
12
13
|
//# sourceMappingURL=CategoryProduct.d.ts.map
|
|
@@ -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;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;
|
|
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;IAC1D,eAAe,CAAC,EAAE,cAAc,CAAC,oBAAoB,CAAC,CAAC;CACxD;AAED,eAAO,MAAM,eAAe,sFAMzB,oBAAoB,gBAqLtB,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("
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var r=require("tslib"),t=require("react"),i=e(t),n=require("@licklist/core/dist/Config"),a=require("react-i18next"),o=require("react-hook-form"),c=e(require("@licklist/plugins/dist/services/Form/HookFormService")),u=e(require("clsx")),s=require("react-intl"),d=require("../../../event/ticket-description/TicketDescription.js"),l=require("./components/ProductQuantityInput/ProductQuantityInput.js");exports.CategoryProduct=function(e){var m=e.product,p=e.category,f=e.canExpandDescription,v=void 0===f||f,y=e.productsWithErrors,g=e.soldOutProducts,E=s.useIntl().formatNumber,q=a.useTranslation(["Design","Validation"]).t,_=o.useFormContext(),x=_.control,N=_.clearErrors,A=_.setError,C=t.useMemo((function(){if(y){var e=y.find((function(e){return e.product_id===m.id}));return null==e?void 0:e.message}}),[y,m.id]),P=t.useMemo((function(){if(p.allowDeposits&&m.deposit&&!(null==m?void 0:m.isSoldOut)&&!(m.deposit>=m.price))return m.deposit}),[p,m]),D=function(){if(g&&!(null==m?void 0:m.isSoldOut)){var e=g.find((function(e){return e.product_id===m.id}));return!!(null==e?void 0:e.message)}};return t.useEffect((function(){C&&A("".concat(m.id),{message:C,type:"validate"})}),[C,m.id]),i.createElement(o.Controller,{control:x,name:"".concat(m.id),rules:{required:m.isRequired,validate:function(e){if(!e)return!0;var r=m.isRequired,t=void 0!==r&&r,i=m.maxAmount,n=void 0===i?0:i,a=m.minAmount,o=void 0===a?0:a,c=e.quantity,u=void 0===c?0:c;return!u&&!t||(!u&&t?q("Design:pleaseSelectAtLeastFrom",{min:1,type:"item",from:"this category"}):u<o?q("Validation:fieldMinNumber",{min:m.minAmount,attribute:m.name}):!(n&&u>=o&&n<u)||q("Validation:quantityMaxNumber",{max:m.maxAmount}))}},render:function(e){var t=e.field,a=t.onChange,o=t.value,s=void 0===o?{}:o,f=t.ref,y=e.fieldState,g=y.invalid,_=y.error;return i.createElement("div",{id:String(m.id),className:"iframe-event__category-product"},i.createElement("div",{className:u("iframe-event__product",g&&"error")},i.createElement(d.TicketDescription,{title:m.name,description:m.description,className:u("iframe-event__product-description"),images:m.images,isRequired:m.isRequired,canExpand:v})),i.createElement("div",{className:"iframe-event__product-price-wrapper"},i.createElement("span",{className:"product-price"},E(null!=P?P:m.price,{style:"currency",currency:n.Currency.GBP})),i.createElement(l.ProductQuantityInput,{onChange:a,productInfo:s,ref:f,clearErrors:N,product:r.__assign(r.__assign({},m),{isSoldOut:(null==m?void 0:m.isSoldOut)||D()}),category:p,invalid:g,deposit:P})),P&&!(null==p?void 0:p.remainderExpireAfter)&&i.createElement("div",{className:"mt-4"},q("Design:payNowAndUponArrival",{deposit:E(P,{style:"currency",currency:n.Currency.GBP}),remainder:E(m.price-P,{style:"currency",currency:n.Currency.GBP})})),P&&(null==p?void 0:p.remainderExpireAfter)>0&&i.createElement("div",{className:"mt-4"},q("Design:payNowAndReminderDays",{deposit:E(P,{style:"currency",currency:n.Currency.GBP}),remainder:E(m.price-P,{style:"currency",currency:n.Currency.GBP}),days:null==p?void 0:p.remainderExpireAfter})),g&&i.createElement("div",{className:"d-flex mt-3 w-100"},i.createElement("p",{className:"iframe-event__message-error"},c.hasError(_,"required")&&q("Design:pleaseSelectAtLeastFrom",{min:1,type:"item",from:"this category"}),c.hasError(_,"validate")&&_.message)))}})};
|
|
@@ -10,6 +10,7 @@ export interface StepsFormProps {
|
|
|
10
10
|
setFormErrors?: (errors: Record<string, any>) => void;
|
|
11
11
|
id?: string;
|
|
12
12
|
productsWithErrors?: ProductQuantityCheckResponse["products"];
|
|
13
|
+
soldOutProducts?: ProductQuantityCheckResponse["products"];
|
|
13
14
|
}
|
|
14
15
|
export declare type StepsFormRef = {
|
|
15
16
|
getFormValues: () => Record<string, any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StepsForm.d.ts","sourceRoot":"","sources":["../../../../../src/iframe/order-process/components/StepsForm/StepsForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAKN,MAAM,OAAO,CAAC;AAWf,OAAO,EAAE,4BAA4B,EAAE,MAAM,8CAA8C,CAAC;AAE5F,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAO7C,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,QAAQ,CAAC;IACf,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;IAChD,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;IACrD,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACnC,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;IACtD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,kBAAkB,CAAC,EAAE,4BAA4B,CAAC,UAAU,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"StepsForm.d.ts","sourceRoot":"","sources":["../../../../../src/iframe/order-process/components/StepsForm/StepsForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAKN,MAAM,OAAO,CAAC;AAWf,OAAO,EAAE,4BAA4B,EAAE,MAAM,8CAA8C,CAAC;AAE5F,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAO7C,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,QAAQ,CAAC;IACf,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;IAChD,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;IACrD,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACnC,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;IACtD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,kBAAkB,CAAC,EAAE,4BAA4B,CAAC,UAAU,CAAC,CAAC;IAC9D,eAAe,CAAC,EAAE,4BAA4B,CAAC,UAAU,CAAC,CAAC;CAC5D;AAED,oBAAY,YAAY,GAAG;IACzB,aAAa,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC1C,CAAC;AAEF,eAAO,MAAM,SAAS,qFAsIrB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=require("tslib"),t=require("react"),s=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,o=require("react-i18next"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=require("tslib"),t=require("react"),s=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,o=require("react-i18next"),u=require("react-bootstrap"),i=require("react-hook-form"),a=require("lodash"),l=require("@licklist/plugins/dist/hooks/Value/usePreviousValue"),n=require("@licklist/plugins/dist/utils/ScrollUtils"),c=require("@licklist/plugins/dist/utils/FormValues"),d=require("../Category/Category.js"),m=require("../../constants.js"),f=require("../CalendarStepsForm/components/ErrorModal.js"),E=require("../utils/category.js"),p="NO_ORDER_ITEMS_ERROR",g=t.forwardRef((function(e,g){var v=e.step,y=e.isLastMenuStep,q=e.setFormValues,F=e.defaultValues,S=e.onSubmit,V=e.setFormErrors,_=e.id,C=void 0===_?m.STEP_FORM_ID:_,h=e.productsWithErrors,O=e.soldOutProducts,P=i.useForm({defaultValues:F}),b=o.useTranslation(["Design","Validation"]).t,j=r.__read(t.useState(""),2),R=j[0],T=j[1],k=E.useCategory().verifyCategoryItems,M=P.control,x=P.formState.errors,I=P.getValues,D=P.setError,K=P.clearErrors,N=P.reset,W=i.useWatch({control:M}),L=l.usePreviousValue(x);t.useImperativeHandle(g,(function(){return{getFormValues:function(){return I()}}})),t.useEffect((function(){h&&T(b("soldOutProduct"))}),[h]);return t.useEffect((function(){x&&setTimeout(K,0),q(W)}),[W]),t.useEffect((function(){c.isFormValuesEmpty(W)||K(p)}),[W,K]),t.useEffect((function(){N(F)}),[F]),t.useEffect((function(){!a.isEqual(x,L)&&V&&V(x)}),[x,L,V]),s.createElement(u.Form,{onSubmit:P.handleSubmit((function(e){if(y&&c.isFormValuesEmpty(e))return D(p,{}),void n.scrollToError(p);var r=k(e,v);if(r)return T(r.message),void D("category_".concat(r.id),{message:r.message});S(e)}),(function(e){n.scrollToError(c.getFirstErrorKey(e)),T(b("pleaseCheckSelectedProducts"))})),id:C},s.createElement(i.FormProvider,r.__assign({},P),s.createElement(f.ErrorModal,{isOpen:Boolean(R),messageKey:R,onClose:function(){return T("")}}),s.createElement("div",null,s.createElement("div",{className:"iframe-event"},s.createElement(d.Category,{productCategories:null==v?void 0:v.productCategories,productsWithErrors:h,errors:x,soldOutProducts:O}),x[p]&&s.createElement("div",{className:"d-flex m-5 justify-content-center form-error",id:p},s.createElement(o.Trans,{t:b,i18nKey:"pleaseSelectAtLeastFrom",values:{min:1,type:"item",from:"those categories"}}))))))}));exports.StepsForm=g;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { StaticTableData } from "../../../../table";
|
|
2
2
|
import { OrderItemsTableProps } from "../types";
|
|
3
|
+
export declare const PAYMENT_TYPE_TRANSLATE_KEYS: {
|
|
4
|
+
"net profit": string;
|
|
5
|
+
fee: string;
|
|
6
|
+
VAT: string;
|
|
7
|
+
};
|
|
3
8
|
export declare const useTableData: ({ order, externalDiscount, isPaymentProcessed, paymentDetail, }: OrderItemsTableProps) => StaticTableData[];
|
|
4
9
|
//# sourceMappingURL=useTableData.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTableData.d.ts","sourceRoot":"","sources":["../../../../../src/iframe/payment/order-items-table/hooks/useTableData.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AASpD,OAAO,EAAE,oBAAoB,EAAe,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"useTableData.d.ts","sourceRoot":"","sources":["../../../../../src/iframe/payment/order-items-table/hooks/useTableData.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AASpD,OAAO,EAAE,oBAAoB,EAAe,MAAM,UAAU,CAAC;AAG7D,eAAO,MAAM,2BAA2B;;;;CAIvC,CAAC;AAEF,eAAO,MAAM,YAAY,oEAKtB,oBAAoB,sBAuMtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r,t=require("tslib"),a=require("react"),n=(e=a)&&"object"==typeof e&&"default"in e?e.default:e,u=require("react-i18next"),i=require("lodash"),o=require("react-intl"),c=require("@licklist/core/dist/DataMapper/Order/PaymentDataMapper"),l=require("../utils/index.js"),s=((r={})[c.PAYMENT_TYPE_NET_PROFIT]="netAmount",r[c.PAYMENT_TYPE_FEE]="bookeditFee",r[c.PAYMENT_TYPE_VAT]="vat",r);exports.useTableData=function(e){var r=e.order,c=e.externalDiscount,d=e.isPaymentProcessed,_=void 0!==d&&d,y=e.paymentDetail,p=o.useIntl().formatNumber,m=u.useTranslation("Design").t,P=function(e){return p(e,{style:"currency",currency:"GBP"})},
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r,t=require("tslib"),a=require("react"),n=(e=a)&&"object"==typeof e&&"default"in e?e.default:e,u=require("react-i18next"),i=require("lodash"),o=require("react-intl"),c=require("@licklist/core/dist/DataMapper/Order/PaymentDataMapper"),l=require("../utils/index.js"),s=((r={})[c.PAYMENT_TYPE_NET_PROFIT]="netAmount",r[c.PAYMENT_TYPE_FEE]="bookeditFee",r[c.PAYMENT_TYPE_VAT]="vat",r);exports.PAYMENT_TYPE_TRANSLATE_KEYS=s,exports.useTableData=function(e){var r=e.order,c=e.externalDiscount,d=e.isPaymentProcessed,_=void 0!==d&&d,y=e.paymentDetail,p=o.useIntl().formatNumber,m=u.useTranslation("Design").t,P=function(e){return p(e,{style:"currency",currency:"GBP"})},A=function(e){return n.createElement("div",{className:"label"},e)},T=function(e){var t,a;return{key:i.uniqueId("category-id-"),name:A(null!==(a=null===(t=e[0].productCategory)||void 0===t?void 0:t.name)&&void 0!==a?a:""),quantity:"",price:A("".concat(m("total"),": ").concat(P(l.getTotalSumByCategory(r.orderProducts,e))))}},f=function(e){var t=l.getProductQuantityAndPrice(r.orderProducts,e),a=t.quantity,u=t.price;return 0===a?null:{key:e.id,name:e.name,quantity:n.createElement("div",{className:"quantity"},n.createElement("div",{className:"multiplier"},"x"),a),price:P(u)}},v=function(){return _?function(){var e=y&&!r.payments.length?l.getExternalPaymentDetail(y):Object.keys(s).map((function(e){return{translateKey:s[e],price:l.getPaymentValueByType(r.payments,e)}})),a=l.calculateTotalPrice(r,e),n=l.calculateTotalDiscount(r.payments),u=a-Number(n),i=[{translateKey:"amountTotal",price:a}];return n&&i.push({translateKey:"amountWithDiscount",price:u<0?0:u}),y&&!r.payments.length?t.__spreadArray(t.__spreadArray([],t.__read(i),!1),t.__read(e),!1):(i.push({translateKey:"totalPaid",price:u<=0?0:r.totalAmount}),u<=0||(i=t.__spreadArray(t.__spreadArray([],t.__read(i),!1),t.__read(e),!1),u>r.totalAmount&&i.push({translateKey:"remainingToPay",price:u-r.totalAmount})),i)}():(e=y?l.getExternalPaymentDetail(y):void 0,a=[{translateKey:"amountTotal",price:l.calculateTotalPrice(r,e)}],c&&a.push({price:c,translateKey:"amountWithDiscount"}),e?t.__spreadArray(t.__spreadArray([],t.__read(a),!1),t.__read(l.getExternalPaymentDetail(y)),!1):a);var e,a},E=a.useMemo((function(){return r?t.__spreadArray(t.__spreadArray([],t.__read(t.__spreadArray([],t.__read(new Set(r.products.map((function(e){return e.productCategoryId})))),!1).reduce((function(e,a){var n=r.products.filter((function(e){return e.productCategoryId===a}));if(!n.length)return e;var u=n.map(f).filter(Boolean);return u.length?t.__spreadArray(t.__spreadArray(t.__spreadArray([],t.__read(e),!1),[T(n)],!1),t.__read(u),!1):e}),[])),!1),t.__read(v().map((function(e){var r=e.translateKey,t=e.price;return{key:i.uniqueId("summary-info-".concat(r)),name:A(m(r)),quantity:"",price:A(P(t))}}))),!1):[]}),[r,c,_]);return E};
|
|
@@ -6,7 +6,11 @@ export declare enum PAYMENT_TYPE_TITLES {
|
|
|
6
6
|
NET_PROFIT = "net profit",
|
|
7
7
|
VAT = "VAT"
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
interface ExternalPaymnetDetail {
|
|
10
|
+
translateKey: string;
|
|
11
|
+
price: number;
|
|
12
|
+
}
|
|
13
|
+
export declare const calculateTotalPrice: (order: Order, externalPaymentDetails?: ExternalPaymnetDetail[]) => number;
|
|
10
14
|
export declare const calculateTotalDiscount: (payments: Order["payments"]) => number;
|
|
11
15
|
export declare const getProductQuantityAndPrice: (orderProducts: Order["orderProducts"], product: Product) => {
|
|
12
16
|
price: number;
|
|
@@ -18,4 +22,5 @@ export declare const getExternalPaymentDetail: (paymentDetail: PaymentDetail) =>
|
|
|
18
22
|
price: any;
|
|
19
23
|
}[];
|
|
20
24
|
export declare const getTotalSumByCategory: (orderProducts: Order["orderProducts"], products: Product[]) => number;
|
|
25
|
+
export {};
|
|
21
26
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/iframe/payment/order-items-table/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/iframe/payment/order-items-table/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EAEN,MAAM,sDAAsD,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,0DAA0D,CAAC;AAEnF,OAAO,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAC;AAS7F,oBAAY,mBAAmB;IAC7B,GAAG,QAAQ;IACX,UAAU,eAAe;IACzB,GAAG,QAAQ;CACZ;AAED,UAAU,qBAAqB;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,mBAAmB,UACvB,KAAK,2BACa,qBAAqB,EAAE,WAsBjD,CAAC;AAEF,eAAO,MAAM,sBAAsB,aAAc,KAAK,CAAC,UAAU,CAAC,WAUjE,CAAC;AAEF,eAAO,MAAM,0BAA0B,kBACtB,KAAK,CAAC,eAAe,CAAC,WAC5B,OAAO;;;CAMjB,CAAC;AAEF,eAAO,MAAM,qBAAqB,aACtB,KAAK,CAAC,UAAU,CAAC,oBACT,MAAM,KACvB,MAgCF,CAAC;AAEF,eAAO,MAAM,wBAAwB,kBAAmB,aAAa;;;GAOpE,CAAC;AAEF,eAAO,MAAM,qBAAqB,kBACjB,KAAK,CAAC,eAAe,CAAC,YAC3B,OAAO,EAAE,WAUpB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("@licklist/core/dist/DataMapper/Order/PaymentDataMapper"),r=require("@licklist/core/dist/DataMapper/Order/OrderDataMapper"),n=require("../hooks/useTableData.js"),u={totalAmount:"totalPaid",netAmount:"netAmount",fee:"bookeditFee"};(e=exports.PAYMENT_TYPE_TITLES||(exports.PAYMENT_TYPE_TITLES={})).FEE="fee",e.NET_PROFIT="net profit",e.VAT="VAT";var o=function(e,t){var r,n=e.find((function(e){return e.productId===t.id}));return{price:null==n?void 0:n.price,quantity:null!==(r=null==n?void 0:n.quantity)&&void 0!==r?r:1}};exports.calculateTotalDiscount=function(e){var r,n=null!==(r=null==e?void 0:e.reduce((function(e,r){var n;return(null===(n=null==r?void 0:r.paymentType)||void 0===n?void 0:n.title)===t.PAYMENT_TYPE_DISCOUNT?e+Number(null==r?void 0:r.amount):e}),0))&&void 0!==r?r:0;return Math.abs(Number(n))},exports.calculateTotalPrice=function(e,t){var u,o,i,l=null!==(o=null===(u=null==e?void 0:e.orderProducts)||void 0===u?void 0:u.reduce((function(e,t){var r;return e+(null!==(r=null==t?void 0:t.quantity)&&void 0!==r?r:1)*t.price}),0))&&void 0!==o?o:0;return(null==e?void 0:e.feeChargeType)===r.ORDER_FEE_CHARGE_TYPE_CLIENT&&t?l+((null===(i=t.find((function(e){return e.translateKey===n.PAYMENT_TYPE_TRANSLATE_KEYS.fee})))||void 0===i?void 0:i.price)||0):l},exports.getExternalPaymentDetail=function(e){return Object.keys(u).map((function(t){return{translateKey:u[t],price:e[t]}}))},exports.getPaymentValueByType=function(e,t){var r,n,u;if(!e||!e.length)return 0;if(t===exports.PAYMENT_TYPE_TITLES.FEE){var o=null!==(r=null==e?void 0:e.reduce((function(e,t){var r;return t.paymentType.title!==exports.PAYMENT_TYPE_TITLES.FEE?e:e+(null!==(r=null==t?void 0:t.amount)&&void 0!==r?r:0)}),0))&&void 0!==r?r:0,i=null!==(n=null==e?void 0:e.reduce((function(e,t){var r;return t.paymentType.title!==exports.PAYMENT_TYPE_TITLES.VAT?e:e+(null!==(r=null==t?void 0:t.amount)&&void 0!==r?r:0)}),0))&&void 0!==n?n:0;return o+i}return null!==(u=null==e?void 0:e.reduce((function(e,r){var n;return r.paymentType.title!==t?e:e+(null!==(n=null==r?void 0:r.amount)&&void 0!==n?n:0)}),0))&&void 0!==u?u:0},exports.getProductQuantityAndPrice=o,exports.getTotalSumByCategory=function(e,t){return t.reduce((function(t,r){var n=o(e,r),u=n.quantity;return t+n.price*u}),0)};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StepsControl.d.ts","sourceRoot":"","sources":["../../../src/product-set/form/StepsControl.tsx"],"names":[],"mappings":";AAgBA,UAAU,iBAAiB;IACzB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,YAAY,CAAC,EAAE,SAAS,EAAE,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"StepsControl.d.ts","sourceRoot":"","sources":["../../../src/product-set/form/StepsControl.tsx"],"names":[],"mappings":";AAgBA,UAAU,iBAAiB;IACzB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,YAAY,CAAC,EAAE,SAAS,EAAE,EAAE,iBAAiB,eAkI5D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),r=require("react"),
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),r=require("react"),o=e(r),a=require("react-i18next"),n=require("react-hook-form"),s=e(require("@licklist/plugins/dist/services/Form/HookFormService")),i=require("../../sortable-tree/SortableTreeItem.js"),l=require("../../sortable-tree/SortableTree.js"),d=e(require("react-bootstrap/Badge")),u=require("../item/CreateProductSetItem.js"),c=require("../step/StepControl.js"),m=require("./ProductCategoriesControl.js");exports.StepsControl=function(e){var p=e.isLoading,v=n.useFormContext(),g=a.useTranslation("Design").t,f=t.__read(r.useState(!1),2),C=f[0],b=f[1],S=v.control,E=v.formState,q=E.errors,I=E.isSubmitting,N=v.clearErrors,h=v.getValues,y=v.setFocus,j=n.useFieldArray({name:"steps",control:S,keyName:"_id"}),x=j.fields,P=j.append,_=j.remove;r.useEffect((function(){I&&b(!I)}),[I]);var k=1===x.length;return o.createElement(o.Fragment,null,x.map((function(e,t){var r="steps.".concat(t),a=h(r);return o.createElement(n.Controller,{key:"step-".concat(e._id),name:"".concat(r,".name"),control:S,rules:{required:g("Validation:fieldRequired",{attribute:g("name")})},render:function(n){var s,u,v=n.field,f=v.value,b=v.onChange;return o.createElement(l.SortableTree.Item,{id:e._id,title:f,badge:o.createElement(d,{className:"step-badge"},g("step")),isExpanded:k,isInvalid:!!(null===(s=q.steps)||void 0===s?void 0:s[t]),isIconInHeader:!1,modalLabel:g("addNewStep"),modalClass:i.ProductSetModalClasses.step,isNewAdded:C,subTitle:o.createElement("div",{className:"product-set-badges-container"},o.createElement("div",{className:"product-set-subtitle-dot product-set-subtitle-step-dot"}),o.createElement("span",null,null===(u=a.productCategories)||void 0===u?void 0:u.length," ",g("categories"))),treeLineIconColor:"#D52902",body:o.createElement(c.StepControl,{isLoading:p,stepIndex:t,stepName:f,onStepNameChange:b}),onDelete:function(){return _(t)},sortableItems:e.productCategories?e.productCategories.map((function(e){var t=e.id;return String(t)})):[],validate:function(){var e,o,a=null===(o=null===(e=q.steps)||void 0===e?void 0:e[t])||void 0===o?void 0:o.name;return a&&y("".concat(r,".name")),Promise.resolve(!a)}},o.createElement(m.ProductCategoriesControl,{isLoading:p,stepIndex:t}))}})})),o.createElement(u.CreateProductSetItem,{title:g("addStep"),onClick:function(){var e;P({id:null,name:"".concat(g("step")," ").concat(x.length+1),productCategories:[],weight:0,hasMap:!1,venueMapSetId:null}),b(!0),(null===(e=q.steps)||void 0===e?void 0:e.type)===s.manualErrorType&&N("steps")}}),o.createElement("div",{className:"manual-form-error"},q.steps&&q.steps.message))};
|
|
@@ -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/
|
|
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")))))))};
|
package/package.json
CHANGED
|
@@ -3,6 +3,7 @@ import { EventVenueMapProvider } from "@licklist/plugins/dist/context/event/Even
|
|
|
3
3
|
import { Point } from "@licklist/plugins/dist/types/context/event/point";
|
|
4
4
|
import { PointProduct } from "@licklist/core/dist/DataMapper/Product/PointProductDataMapper";
|
|
5
5
|
import { Product } from "@licklist/core/dist/DataMapper/Product/ProductDataMapper";
|
|
6
|
+
import { ProductQuantityCheckResponse } from "@licklist/plugins/dist/types/Api/verifyStock";
|
|
6
7
|
import { VenueMap, VenueMapRef } from "./components/VenueMap";
|
|
7
8
|
import { useCanvasSize } from "./hooks/useCanvasSize";
|
|
8
9
|
|
|
@@ -24,6 +25,7 @@ export type EventVenueMapProps = {
|
|
|
24
25
|
products?: Partial<Product>[];
|
|
25
26
|
pointProducts?: Partial<PointProduct>[];
|
|
26
27
|
onPointProductsChange?: (values: Partial<PointProduct>[]) => void;
|
|
28
|
+
soldOutProducts?: ProductQuantityCheckResponse["products"];
|
|
27
29
|
} & EventVenueMapIframeProps;
|
|
28
30
|
|
|
29
31
|
export const EventVenueMap = forwardRef<VenueMapRef, EventVenueMapProps>(
|
|
@@ -43,6 +45,7 @@ export const EventVenueMap = forwardRef<VenueMapRef, EventVenueMapProps>(
|
|
|
43
45
|
usedInIframe = false,
|
|
44
46
|
choosedProductUuids = [],
|
|
45
47
|
errorOnChoosedProductUuids = [],
|
|
48
|
+
soldOutProducts,
|
|
46
49
|
},
|
|
47
50
|
ref
|
|
48
51
|
) => {
|
|
@@ -66,6 +69,7 @@ export const EventVenueMap = forwardRef<VenueMapRef, EventVenueMapProps>(
|
|
|
66
69
|
ref={ref}
|
|
67
70
|
choosedProductUuids={choosedProductUuids}
|
|
68
71
|
errorOnChoosedProductUuids={errorOnChoosedProductUuids}
|
|
72
|
+
soldOutProducts={soldOutProducts}
|
|
69
73
|
/>
|
|
70
74
|
</EventVenueMapProvider>
|
|
71
75
|
);
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
EventVenueMapContext,
|
|
12
12
|
EventVenueMapContextProps,
|
|
13
13
|
} from "@licklist/plugins/dist/context/event/EventVenueMapContext";
|
|
14
|
+
import { ProductQuantityCheckResponse } from "@licklist/plugins/dist/types/Api/verifyStock";
|
|
14
15
|
import { useImage } from "../../hooks/useImage";
|
|
15
16
|
import { useStageActions } from "../../hooks/useStageActions";
|
|
16
17
|
import { MapPoint } from "../MapPoint";
|
|
@@ -32,6 +33,7 @@ export type VenueMapProps = {
|
|
|
32
33
|
usedInIframe?: boolean;
|
|
33
34
|
choosedProductUuids?: string[];
|
|
34
35
|
errorOnChoosedProductUuids?: string[];
|
|
36
|
+
soldOutProducts?: ProductQuantityCheckResponse["products"];
|
|
35
37
|
};
|
|
36
38
|
|
|
37
39
|
export const VenueMap = forwardRef<VenueMapRef, VenueMapProps>(
|
|
@@ -45,6 +47,7 @@ export const VenueMap = forwardRef<VenueMapRef, VenueMapProps>(
|
|
|
45
47
|
usedInIframe = false,
|
|
46
48
|
choosedProductUuids = [],
|
|
47
49
|
errorOnChoosedProductUuids = [],
|
|
50
|
+
soldOutProducts,
|
|
48
51
|
},
|
|
49
52
|
ref
|
|
50
53
|
) => {
|
|
@@ -112,13 +115,18 @@ export const VenueMap = forwardRef<VenueMapRef, VenueMapProps>(
|
|
|
112
115
|
);
|
|
113
116
|
|
|
114
117
|
if (!currentProduct) return false;
|
|
115
|
-
|
|
118
|
+
const selectedProduct = products.find(
|
|
119
|
+
(product) => product.uuid === currentProduct.productUuid
|
|
120
|
+
);
|
|
116
121
|
return (
|
|
117
|
-
|
|
118
|
-
|
|
122
|
+
selectedProduct?.isSoldOut ||
|
|
123
|
+
(selectedProduct &&
|
|
124
|
+
!!soldOutProducts?.find(
|
|
125
|
+
(product) => product?.product_id === selectedProduct?.id
|
|
126
|
+
)) ||
|
|
127
|
+
false
|
|
119
128
|
);
|
|
120
129
|
};
|
|
121
|
-
|
|
122
130
|
return (
|
|
123
131
|
<div className="venue-map" style={{ width, height }}>
|
|
124
132
|
<div className="zone-name">
|
|
@@ -113,7 +113,7 @@ export function IframeEventCard({
|
|
|
113
113
|
</Card.Text>
|
|
114
114
|
)}
|
|
115
115
|
|
|
116
|
-
{cost && !!snippetSetting.displayCost && (
|
|
116
|
+
{typeof cost === "number" && !!snippetSetting.displayCost && (
|
|
117
117
|
<Card.Text as="div">
|
|
118
118
|
<div className="d-flex align-items-center mb-3">
|
|
119
119
|
<div className="icon-wrapper">
|
|
@@ -8,25 +8,25 @@ export type SummaryDataType = {
|
|
|
8
8
|
quantity?: number;
|
|
9
9
|
}[];
|
|
10
10
|
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
export const Summary = ({ data = [] }: { data: SummaryDataType }) => {
|
|
12
|
+
return (
|
|
13
|
+
<>
|
|
14
|
+
{data.map(({ name, image, quantity, title }) => {
|
|
15
|
+
const classNames = clsx("name", "mb-4", image && "align-items-center");
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
);
|
|
31
|
-
});
|
|
17
|
+
return (
|
|
18
|
+
<div key={name} className="summary">
|
|
19
|
+
<p className="title mb-1">{title}</p>
|
|
20
|
+
<div className={classNames}>
|
|
21
|
+
{image && <img className="image mr-3" src={image} alt={name} />}
|
|
22
|
+
{quantity && quantity > 1 && (
|
|
23
|
+
<span className="quantity mr-3">{quantity}x</span>
|
|
24
|
+
)}
|
|
25
|
+
{name}
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
})}
|
|
30
|
+
</>
|
|
31
|
+
);
|
|
32
32
|
};
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
import { Step } from "@licklist/core/dist/DataMapper/Product/StepDataMapper";
|
|
20
20
|
import { useTranslation } from "react-i18next";
|
|
21
21
|
import { Product } from "@licklist/core/dist/DataMapper/Product/ProductDataMapper";
|
|
22
|
+
import { ProductQuantityCheckResponse } from "@licklist/plugins/dist/types/Api/verifyStock";
|
|
22
23
|
import { Category } from "./components/Category";
|
|
23
24
|
import { MenuStep } from "../../../../types";
|
|
24
25
|
import { STEP_FORM_ID } from "../../constants";
|
|
@@ -44,6 +45,7 @@ export interface CalendarStepsFormProps {
|
|
|
44
45
|
onActiveVenueMapChange?: (nextVenueMapId: string) => void;
|
|
45
46
|
title: string;
|
|
46
47
|
menuStepWithVenueMap: Step;
|
|
48
|
+
soldOutProducts?: ProductQuantityCheckResponse["products"];
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
export type StepsFormRef = {
|
|
@@ -67,6 +69,7 @@ export const CalendarStepsForm = forwardRef<
|
|
|
67
69
|
title,
|
|
68
70
|
menuStepWithVenueMap,
|
|
69
71
|
onActiveVenueMapChange,
|
|
72
|
+
soldOutProducts,
|
|
70
73
|
},
|
|
71
74
|
ref
|
|
72
75
|
) => {
|
|
@@ -340,12 +343,14 @@ export const CalendarStepsForm = forwardRef<
|
|
|
340
343
|
ref={canvasRef}
|
|
341
344
|
choosedProductUuids={choosedProductUuids}
|
|
342
345
|
errorOnChoosedProductUuids={errorOnChoosedProductUuids}
|
|
346
|
+
soldOutProducts={soldOutProducts}
|
|
343
347
|
/>
|
|
344
348
|
<Category
|
|
345
349
|
productCategories={step?.productCategories}
|
|
346
350
|
activePointId={activePointId}
|
|
347
351
|
pointProducts={menuStepWithVenueMap.pointProducts}
|
|
348
352
|
onCloseModal={onCloseProductModal}
|
|
353
|
+
soldOutProducts={soldOutProducts}
|
|
349
354
|
/>
|
|
350
355
|
</>
|
|
351
356
|
)}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { PointProduct } from "@licklist/core/dist/DataMapper/Product/PointProductDataMapper";
|
|
3
|
+
import { ProductQuantityCheckResponse } from "@licklist/plugins/dist/types/Api/verifyStock";
|
|
3
4
|
import { ProductCategory } from "../../../../../types";
|
|
4
5
|
import { CategoryProductModal } from "./CategoryProductModal";
|
|
5
6
|
|
|
@@ -8,6 +9,7 @@ export type CategoryProps = {
|
|
|
8
9
|
activePointId?: number;
|
|
9
10
|
pointProducts: PointProduct[];
|
|
10
11
|
onCloseModal: () => void;
|
|
12
|
+
soldOutProducts?: ProductQuantityCheckResponse["products"];
|
|
11
13
|
};
|
|
12
14
|
|
|
13
15
|
export const Category = ({
|
|
@@ -15,6 +17,7 @@ export const Category = ({
|
|
|
15
17
|
activePointId,
|
|
16
18
|
pointProducts,
|
|
17
19
|
onCloseModal,
|
|
20
|
+
soldOutProducts,
|
|
18
21
|
}: CategoryProps) => {
|
|
19
22
|
return (
|
|
20
23
|
<>
|
|
@@ -31,6 +34,7 @@ export const Category = ({
|
|
|
31
34
|
activePointId={activePointId}
|
|
32
35
|
pointProducts={pointProducts}
|
|
33
36
|
onCloseModal={onCloseModal}
|
|
37
|
+
soldOutProducts={soldOutProducts}
|
|
34
38
|
/>
|
|
35
39
|
);
|
|
36
40
|
})}
|
package/src/iframe/order-process/components/CalendarStepsForm/components/CategoryProductModal.tsx
CHANGED
|
@@ -2,6 +2,7 @@ import React, { useMemo } from "react";
|
|
|
2
2
|
import clsx from "clsx";
|
|
3
3
|
import { Button } from "react-bootstrap";
|
|
4
4
|
import { PointProduct } from "@licklist/core/dist/DataMapper/Product/PointProductDataMapper";
|
|
5
|
+
import { ProductQuantityCheckResponse } from "@licklist/plugins/dist/types/Api/verifyStock";
|
|
5
6
|
import { ProductCategory, Product } from "../../../../../types";
|
|
6
7
|
import { CategoryProduct } from "../../CategoryProduct";
|
|
7
8
|
import Icon from "../../../../../static/Icon";
|
|
@@ -12,6 +13,7 @@ export type CategoryProductModalProps = {
|
|
|
12
13
|
category: ProductCategory;
|
|
13
14
|
pointProducts: PointProduct[];
|
|
14
15
|
onCloseModal: () => void;
|
|
16
|
+
soldOutProducts?: ProductQuantityCheckResponse["products"];
|
|
15
17
|
};
|
|
16
18
|
|
|
17
19
|
export const CategoryProductModal = ({
|
|
@@ -20,6 +22,7 @@ export const CategoryProductModal = ({
|
|
|
20
22
|
category,
|
|
21
23
|
pointProducts,
|
|
22
24
|
onCloseModal,
|
|
25
|
+
soldOutProducts,
|
|
23
26
|
}: CategoryProductModalProps) => {
|
|
24
27
|
const activePointProduct = useMemo(
|
|
25
28
|
() =>
|
|
@@ -42,6 +45,7 @@ export const CategoryProductModal = ({
|
|
|
42
45
|
product={product}
|
|
43
46
|
category={category}
|
|
44
47
|
canExpandDescription={false}
|
|
48
|
+
soldOutProducts={soldOutProducts}
|
|
45
49
|
/>
|
|
46
50
|
<div className="close-modal-button">
|
|
47
51
|
<Button
|
|
@@ -8,6 +8,7 @@ import { StepsFormProps } from "../StepsForm/StepsForm";
|
|
|
8
8
|
interface CategoryProps {
|
|
9
9
|
productCategories: ProductCategory[];
|
|
10
10
|
productsWithErrors?: StepsFormProps["productsWithErrors"];
|
|
11
|
+
soldOutProducts?: StepsFormProps["productsWithErrors"];
|
|
11
12
|
errors?: DeepMap<Record<string, any>, FieldError>;
|
|
12
13
|
}
|
|
13
14
|
|
|
@@ -15,6 +16,7 @@ export function Category({
|
|
|
15
16
|
productCategories,
|
|
16
17
|
productsWithErrors,
|
|
17
18
|
errors,
|
|
19
|
+
soldOutProducts,
|
|
18
20
|
}: CategoryProps) {
|
|
19
21
|
return (
|
|
20
22
|
<>
|
|
@@ -37,6 +39,7 @@ export function Category({
|
|
|
37
39
|
product={product}
|
|
38
40
|
category={category}
|
|
39
41
|
productsWithErrors={productsWithErrors}
|
|
42
|
+
soldOutProducts={soldOutProducts}
|
|
40
43
|
/>
|
|
41
44
|
);
|
|
42
45
|
})}
|
|
@@ -15,6 +15,7 @@ interface CategoryProductProps {
|
|
|
15
15
|
category: ProductCategory;
|
|
16
16
|
canExpandDescription?: boolean;
|
|
17
17
|
productsWithErrors?: StepsFormProps["productsWithErrors"];
|
|
18
|
+
soldOutProducts?: StepsFormProps["productsWithErrors"];
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
export const CategoryProduct = ({
|
|
@@ -22,6 +23,7 @@ export const CategoryProduct = ({
|
|
|
22
23
|
category,
|
|
23
24
|
canExpandDescription = true,
|
|
24
25
|
productsWithErrors,
|
|
26
|
+
soldOutProducts,
|
|
25
27
|
}: CategoryProductProps) => {
|
|
26
28
|
const { formatNumber } = useIntl();
|
|
27
29
|
const { t } = useTranslation(["Design", "Validation"]);
|
|
@@ -49,6 +51,16 @@ export const CategoryProduct = ({
|
|
|
49
51
|
return product.deposit;
|
|
50
52
|
}, [category, product]);
|
|
51
53
|
|
|
54
|
+
const checkIfSoldOutProduct = () => {
|
|
55
|
+
if (!soldOutProducts || product?.isSoldOut) {
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
const error = soldOutProducts.find(
|
|
59
|
+
(productWithError) => productWithError.product_id === product.id
|
|
60
|
+
);
|
|
61
|
+
return !!error?.message;
|
|
62
|
+
};
|
|
63
|
+
|
|
52
64
|
useEffect(() => {
|
|
53
65
|
if (!productQuantityError) {
|
|
54
66
|
return;
|
|
@@ -136,7 +148,10 @@ export const CategoryProduct = ({
|
|
|
136
148
|
productInfo={productInfo}
|
|
137
149
|
ref={ref}
|
|
138
150
|
clearErrors={clearErrors}
|
|
139
|
-
product={
|
|
151
|
+
product={{
|
|
152
|
+
...product,
|
|
153
|
+
isSoldOut: product?.isSoldOut || checkIfSoldOutProduct(),
|
|
154
|
+
}}
|
|
140
155
|
category={category}
|
|
141
156
|
invalid={invalid}
|
|
142
157
|
deposit={deposit}
|
|
@@ -32,6 +32,7 @@ export interface StepsFormProps {
|
|
|
32
32
|
setFormErrors?: (errors: Record<string, any>) => void;
|
|
33
33
|
id?: string;
|
|
34
34
|
productsWithErrors?: ProductQuantityCheckResponse["products"];
|
|
35
|
+
soldOutProducts?: ProductQuantityCheckResponse["products"];
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
export type StepsFormRef = {
|
|
@@ -49,6 +50,7 @@ export const StepsForm = forwardRef<StepsFormRef, StepsFormProps>(
|
|
|
49
50
|
setFormErrors,
|
|
50
51
|
id = STEP_FORM_ID,
|
|
51
52
|
productsWithErrors,
|
|
53
|
+
soldOutProducts,
|
|
52
54
|
},
|
|
53
55
|
ref
|
|
54
56
|
) => {
|
|
@@ -150,6 +152,7 @@ export const StepsForm = forwardRef<StepsFormRef, StepsFormProps>(
|
|
|
150
152
|
productCategories={step?.productCategories}
|
|
151
153
|
productsWithErrors={productsWithErrors}
|
|
152
154
|
errors={errors}
|
|
155
|
+
soldOutProducts={soldOutProducts}
|
|
153
156
|
/>
|
|
154
157
|
|
|
155
158
|
{errors[NO_ORDER_ITEMS_ERROR] && (
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Meta } from "@storybook/react";
|
|
3
3
|
import { boolean } from "@storybook/addon-knobs";
|
|
4
|
+
import { ORDER_FEE_CHARGE_TYPE_CLIENT } from "@licklist/core/dist/DataMapper/Order/OrderDataMapper";
|
|
4
5
|
import { OrderItemsTable } from "./OrderItemsTable";
|
|
5
6
|
|
|
6
7
|
export default {
|
|
@@ -24,6 +25,7 @@ export function Default(args) {
|
|
|
24
25
|
|
|
25
26
|
Default.args = {
|
|
26
27
|
order: {
|
|
28
|
+
feeChargeType: ORDER_FEE_CHARGE_TYPE_CLIENT,
|
|
27
29
|
products: [
|
|
28
30
|
{
|
|
29
31
|
id: 1,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
import { OrderItemsTableProps, SummaryItem } from "../types";
|
|
21
21
|
|
|
22
22
|
const CURRENCY_DEFAULT = "GBP";
|
|
23
|
-
const
|
|
23
|
+
export const PAYMENT_TYPE_TRANSLATE_KEYS = {
|
|
24
24
|
[PAYMENT_TYPE_NET_PROFIT]: "netAmount",
|
|
25
25
|
[PAYMENT_TYPE_FEE]: "bookeditFee",
|
|
26
26
|
[PAYMENT_TYPE_VAT]: "vat",
|
|
@@ -128,7 +128,11 @@ export const useTableData = ({
|
|
|
128
128
|
};
|
|
129
129
|
|
|
130
130
|
const paymentNotProcessedSummary = () => {
|
|
131
|
-
const
|
|
131
|
+
const externalPaymentDetail = paymentDetail
|
|
132
|
+
? getExternalPaymentDetail(paymentDetail)
|
|
133
|
+
: undefined;
|
|
134
|
+
|
|
135
|
+
const total = calculateTotalPrice(order, externalPaymentDetail);
|
|
132
136
|
|
|
133
137
|
const summaryItems: SummaryItem[] = [
|
|
134
138
|
{
|
|
@@ -144,7 +148,7 @@ export const useTableData = ({
|
|
|
144
148
|
});
|
|
145
149
|
}
|
|
146
150
|
|
|
147
|
-
if (
|
|
151
|
+
if (externalPaymentDetail) {
|
|
148
152
|
return [...summaryItems, ...getExternalPaymentDetail(paymentDetail)];
|
|
149
153
|
}
|
|
150
154
|
|
|
@@ -152,7 +156,18 @@ export const useTableData = ({
|
|
|
152
156
|
};
|
|
153
157
|
|
|
154
158
|
const processedPaymentSummary = () => {
|
|
155
|
-
const
|
|
159
|
+
const externalPaymentDetail =
|
|
160
|
+
paymentDetail && !order.payments.length
|
|
161
|
+
? getExternalPaymentDetail(paymentDetail)
|
|
162
|
+
: Object.keys(PAYMENT_TYPE_TRANSLATE_KEYS).map((key) => {
|
|
163
|
+
return {
|
|
164
|
+
translateKey: PAYMENT_TYPE_TRANSLATE_KEYS[key],
|
|
165
|
+
price: getPaymentValueByType(order.payments, key),
|
|
166
|
+
};
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
const total = calculateTotalPrice(order, externalPaymentDetail);
|
|
170
|
+
|
|
156
171
|
const totalDiscount = calculateTotalDiscount(order.payments);
|
|
157
172
|
const totalWithDiscount = total - Number(totalDiscount);
|
|
158
173
|
let summaryItems: SummaryItem[] = [
|
|
@@ -170,7 +185,7 @@ export const useTableData = ({
|
|
|
170
185
|
}
|
|
171
186
|
|
|
172
187
|
if (paymentDetail && !order.payments.length) {
|
|
173
|
-
return [...summaryItems, ...
|
|
188
|
+
return [...summaryItems, ...externalPaymentDetail];
|
|
174
189
|
}
|
|
175
190
|
|
|
176
191
|
summaryItems.push({
|
|
@@ -180,15 +195,7 @@ export const useTableData = ({
|
|
|
180
195
|
if (totalWithDiscount <= 0) {
|
|
181
196
|
return summaryItems;
|
|
182
197
|
}
|
|
183
|
-
summaryItems = [
|
|
184
|
-
...summaryItems,
|
|
185
|
-
...Object.keys(TRANSLATE_KEYS).map((key) => {
|
|
186
|
-
return {
|
|
187
|
-
translateKey: TRANSLATE_KEYS[key],
|
|
188
|
-
price: getPaymentValueByType(order.payments, key),
|
|
189
|
-
};
|
|
190
|
-
}),
|
|
191
|
-
];
|
|
198
|
+
summaryItems = [...summaryItems, ...externalPaymentDetail];
|
|
192
199
|
|
|
193
200
|
if (totalWithDiscount > order.totalAmount) {
|
|
194
201
|
summaryItems.push({
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Order,
|
|
3
|
+
ORDER_FEE_CHARGE_TYPE_CLIENT,
|
|
4
|
+
} from "@licklist/core/dist/DataMapper/Order/OrderDataMapper";
|
|
2
5
|
import { Product } from "@licklist/core/dist/DataMapper/Product/ProductDataMapper";
|
|
3
6
|
import { PAYMENT_TYPE_DISCOUNT } from "@licklist/core/dist/DataMapper/Order/PaymentDataMapper";
|
|
4
7
|
import { PaymentDetail } from "@licklist/core/dist/DataMapper/Order/PaymentDetailDataMapper";
|
|
8
|
+
import { PAYMENT_TYPE_TRANSLATE_KEYS } from "../hooks/useTableData";
|
|
5
9
|
|
|
6
10
|
const TRANSLATE_KEYS = {
|
|
7
11
|
totalAmount: "totalPaid",
|
|
8
12
|
netAmount: "netAmount",
|
|
9
13
|
fee: "bookeditFee",
|
|
10
|
-
remainingToPay: "remainingToPay",
|
|
11
14
|
};
|
|
12
15
|
|
|
13
16
|
export enum PAYMENT_TYPE_TITLES {
|
|
@@ -16,14 +19,35 @@ export enum PAYMENT_TYPE_TITLES {
|
|
|
16
19
|
VAT = "VAT",
|
|
17
20
|
}
|
|
18
21
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
interface ExternalPaymnetDetail {
|
|
23
|
+
translateKey: string;
|
|
24
|
+
price: number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const calculateTotalPrice = (
|
|
28
|
+
order: Order,
|
|
29
|
+
externalPaymentDetails?: ExternalPaymnetDetail[]
|
|
30
|
+
) => {
|
|
31
|
+
const totalPrice =
|
|
32
|
+
order?.orderProducts?.reduce(
|
|
22
33
|
(total: number, product) =>
|
|
23
34
|
total + (product?.quantity ?? 1) * product.price,
|
|
24
35
|
0
|
|
25
|
-
) ?? 0
|
|
26
|
-
|
|
36
|
+
) ?? 0;
|
|
37
|
+
|
|
38
|
+
if (
|
|
39
|
+
order?.feeChargeType !== ORDER_FEE_CHARGE_TYPE_CLIENT ||
|
|
40
|
+
!externalPaymentDetails
|
|
41
|
+
) {
|
|
42
|
+
return totalPrice;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const fee =
|
|
46
|
+
externalPaymentDetails.find(
|
|
47
|
+
(externalPayment) =>
|
|
48
|
+
externalPayment.translateKey === PAYMENT_TYPE_TRANSLATE_KEYS.fee
|
|
49
|
+
)?.price || 0;
|
|
50
|
+
return totalPrice + fee;
|
|
27
51
|
};
|
|
28
52
|
|
|
29
53
|
export const calculateTotalDiscount = (payments: Order["payments"]) => {
|
|
@@ -51,21 +75,37 @@ export const getProductQuantityAndPrice = (
|
|
|
51
75
|
export const getPaymentValueByType = (
|
|
52
76
|
payments: Order["payments"],
|
|
53
77
|
paymentTypeTitle: string
|
|
54
|
-
) => {
|
|
78
|
+
): number => {
|
|
79
|
+
if (!payments || !payments.length) {
|
|
80
|
+
return 0;
|
|
81
|
+
}
|
|
55
82
|
if (paymentTypeTitle === PAYMENT_TYPE_TITLES.FEE) {
|
|
56
83
|
const feeWithoutVatValue =
|
|
57
|
-
payments
|
|
58
|
-
|
|
84
|
+
payments?.reduce((sumOfPayments, payment) => {
|
|
85
|
+
if (payment.paymentType.title !== PAYMENT_TYPE_TITLES.FEE) {
|
|
86
|
+
return sumOfPayments;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return sumOfPayments + (payment?.amount ?? 0);
|
|
90
|
+
}, 0) ?? 0;
|
|
59
91
|
|
|
60
92
|
const vatValue =
|
|
61
|
-
payments
|
|
62
|
-
(payment
|
|
63
|
-
|
|
93
|
+
payments?.reduce((sumOfPayments, payment) => {
|
|
94
|
+
if (payment.paymentType.title !== PAYMENT_TYPE_TITLES.VAT) {
|
|
95
|
+
return sumOfPayments;
|
|
96
|
+
}
|
|
97
|
+
return sumOfPayments + (payment?.amount ?? 0);
|
|
98
|
+
}, 0) ?? 0;
|
|
64
99
|
return feeWithoutVatValue + vatValue;
|
|
65
100
|
}
|
|
101
|
+
|
|
66
102
|
return (
|
|
67
|
-
payments
|
|
68
|
-
|
|
103
|
+
payments?.reduce((sumOfPayments, payment) => {
|
|
104
|
+
if (payment.paymentType.title !== paymentTypeTitle) {
|
|
105
|
+
return sumOfPayments;
|
|
106
|
+
}
|
|
107
|
+
return sumOfPayments + (payment?.amount ?? 0);
|
|
108
|
+
}, 0) ?? 0
|
|
69
109
|
);
|
|
70
110
|
};
|
|
71
111
|
|
|
@@ -28,6 +28,7 @@ export function StepsControl({ isLoading }: StepsControlProps) {
|
|
|
28
28
|
formState: { errors, isSubmitting },
|
|
29
29
|
clearErrors,
|
|
30
30
|
getValues,
|
|
31
|
+
setFocus,
|
|
31
32
|
} = form;
|
|
32
33
|
|
|
33
34
|
const { fields, append, remove } = useFieldArray({
|
|
@@ -57,12 +58,14 @@ export function StepsControl({ isLoading }: StepsControlProps) {
|
|
|
57
58
|
return (
|
|
58
59
|
<>
|
|
59
60
|
{fields.map((step, index) => {
|
|
60
|
-
const
|
|
61
|
+
const stepFieldName = `steps.${index}` as const;
|
|
62
|
+
|
|
63
|
+
const stepData = getValues(stepFieldName);
|
|
61
64
|
|
|
62
65
|
return (
|
|
63
66
|
<Controller
|
|
64
67
|
key={`step-${step._id}`}
|
|
65
|
-
name={
|
|
68
|
+
name={`${stepFieldName}.name` as const}
|
|
66
69
|
control={control}
|
|
67
70
|
rules={{
|
|
68
71
|
required: t("Validation:fieldRequired", {
|
|
@@ -104,6 +107,21 @@ export function StepsControl({ isLoading }: StepsControlProps) {
|
|
|
104
107
|
? step.productCategories.map(({ id }) => String(id))
|
|
105
108
|
: []
|
|
106
109
|
}
|
|
110
|
+
validate={() => {
|
|
111
|
+
// @TODO investigate why form return true in case
|
|
112
|
+
// when required field not filled. Looks like
|
|
113
|
+
// we cann't use default hookForm trigger function
|
|
114
|
+
// because we have venueMap outside this form.
|
|
115
|
+
// So before closing we need to check directly by
|
|
116
|
+
// error on name field. Instead of run trugger.
|
|
117
|
+
const error = errors.steps?.[index]?.name;
|
|
118
|
+
|
|
119
|
+
if (error) {
|
|
120
|
+
setFocus(`${stepFieldName}.name` as const);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return Promise.resolve(!error);
|
|
124
|
+
}}
|
|
107
125
|
>
|
|
108
126
|
<ProductCategoriesControl
|
|
109
127
|
isLoading={isLoading}
|