@licklist/design 0.44.473 → 0.44.474
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/components/MapPoint/MapPoint.d.ts +3 -1
- package/dist/events/event-venue-map/components/MapPoint/MapPoint.d.ts.map +1 -1
- package/dist/events/event-venue-map/components/MapPoint/MapPoint.js +1 -1
- 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/order-process/components/CalendarStepsForm/CalendarStepsForm.d.ts.map +1 -1
- package/dist/iframe/order-process/components/CalendarStepsForm/CalendarStepsForm.js +1 -1
- package/package.json +1 -1
- package/src/events/event-venue-map/components/MapPoint/MapPoint.tsx +4 -1
- package/src/events/event-venue-map/components/VenueMap/VenueMap.tsx +16 -0
- package/src/iframe/event/event-venue-map/IframeEventVenueMap.stories.tsx +44 -0
- package/src/iframe/order-process/components/CalendarStepsForm/CalendarStepsForm.tsx +18 -0
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Point } from "@licklist/plugins/dist/types/context/event/point";
|
|
3
3
|
import { ImageOffset } from "../../types";
|
|
4
|
+
import { Product } from "../../../../types";
|
|
4
5
|
declare type MapPointProps = Partial<Point> & ImageOffset & {
|
|
5
6
|
changeCursorType: (type?: CSSStyleDeclaration["cursor"]) => void;
|
|
6
7
|
usedInIframe: boolean;
|
|
7
8
|
choosedProductUuids?: string[];
|
|
8
9
|
errorOnChoosedProductUuids?: string[];
|
|
10
|
+
isSoldOut?: Product["isSoldOut"];
|
|
9
11
|
};
|
|
10
|
-
export declare const MapPoint: ({ xCoordinate: x, yCoordinate: y, id, imageOffsetX, imageOffsetY, imageScale, localId, pointNumber, changeCursorType, usedInIframe, choosedProductUuids, errorOnChoosedProductUuids, }: MapPointProps) => JSX.Element;
|
|
12
|
+
export declare const MapPoint: ({ xCoordinate: x, yCoordinate: y, id, imageOffsetX, imageOffsetY, imageScale, localId, pointNumber, changeCursorType, usedInIframe, choosedProductUuids, errorOnChoosedProductUuids, isSoldOut, }: MapPointProps) => JSX.Element;
|
|
11
13
|
export {};
|
|
12
14
|
//# sourceMappingURL=MapPoint.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapPoint.d.ts","sourceRoot":"","sources":["../../../../../src/events/event-venue-map/components/MapPoint/MapPoint.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,kDAAkD,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"MapPoint.d.ts","sourceRoot":"","sources":["../../../../../src/events/event-venue-map/components/MapPoint/MapPoint.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,kDAAkD,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAO1C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,aAAK,aAAa,GAAG,OAAO,CAAC,KAAK,CAAC,GACjC,WAAW,GAAG;IACZ,gBAAgB,EAAE,CAAC,IAAI,CAAC,EAAE,mBAAmB,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC;IACjE,YAAY,EAAE,OAAO,CAAC;IACtB,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,0BAA0B,CAAC,EAAE,MAAM,EAAE,CAAC;IACtC,SAAS,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;CAClC,CAAC;AAEJ,eAAO,MAAM,QAAQ,sMAclB,aAAa,gBAmHf,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,o=require("tslib"),n=require("react"),t=(e=n)&&"object"==typeof e&&"default"in e?e.default:e,i=require("@licklist/plugins/dist/context/event/EventVenueMapContext"),r=require("react-konva"),u=require("../../utils/index.js"),c=require("./components/PointIcon/PointIcon.js"),d=require("./components/ProductIcon/ProductIcon.js");exports.MapPoint=function(e){var s=e.xCoordinate,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,o=require("tslib"),n=require("react"),t=(e=n)&&"object"==typeof e&&"default"in e?e.default:e,i=require("@licklist/plugins/dist/context/event/EventVenueMapContext"),r=require("react-konva"),u=require("../../utils/index.js"),c=require("./components/PointIcon/PointIcon.js"),d=require("./components/ProductIcon/ProductIcon.js");exports.MapPoint=function(e){var s=e.xCoordinate,l=e.yCoordinate,a=e.id,f=e.imageOffsetX,p=e.imageOffsetY,v=e.imageScale,P=e.localId,m=e.pointNumber,I=e.changeCursorType,x=e.usedInIframe,C=e.choosedProductUuids,M=void 0===C?[]:C,g=e.errorOnChoosedProductUuids,E=void 0===g?[]:g,O=e.isSoldOut,h=n.useContext(i.EventVenueMapContext),y=h.setActiveElementKey,b=h.activeElementKey,q=h.setMapPoints,U=h.editMode,j=h.mapPointProducts,B=o.__read(u.calculatePointsCoordinates(s,l,{imageScale:v,imageOffsetX:f,imageOffsetY:p}),2),S=B[0],_=B[1],k=String(a||P),A=k===b,K=j.find((function(e){return a&&e.pointId&&e.pointId===a})),N=Boolean(j.find((function(e){return M.includes(null==e?void 0:e.productUuid)&&M.includes(null==K?void 0:K.productUuid)}))),T=Boolean(j.find((function(e){return E.includes(null==e?void 0:e.productUuid)&&E.includes(null==K?void 0:K.productUuid)}))),V=function(e){e.cancelBubble=!0,A||O||(y(k),q((function(e){var o=e.slice(),n=o.find((function(e){return e.id===a||(null==e?void 0:e.localId)===P})),t=o.indexOf(n);return o.splice(t,1),o.push(n),o})))};return t.createElement(r.Group,{onClick:V,onTap:V,onMouseEnter:function(){I("pointer")},onMouseLeave:function(){I()}},x?t.createElement(d.ProductIcon,{x:S,y:_,hasProduct:Boolean(K),isActive:A,isProductChoosed:N,isErrorOnChoosedProduct:T}):t.createElement(c.PointIcon,{x:S,y:_,isActive:A,hasProduct:Boolean(K),pointNumber:m,onDelete:function(){y(),I(),q((function(e){return u.removeMapPointFromPoints(e,a,P)}))},editMode:U}))};
|
|
@@ -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;AAQnE,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;CACvC,CAAC;AAEF,eAAO,MAAM,QAAQ,
|
|
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;AAQnE,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;CACvC,CAAC;AAEF,eAAO,MAAM,QAAQ,mFA2JpB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),
|
|
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"),i=require("react-konva"),o=require("../../hooks/useImage.js"),u=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,h=e.height,v=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=n.useContext(a.EventVenueMapContext),q=S.mapPoints,I=S.stage,M=I.x,_=I.y,w=I.scale,O=S.setMapPoints,b=S.products,j=S.mapPointProducts,k=S.activeElementKey,N=S.setActiveElementKey,U=n.useRef(null),V=n.useRef(null),A=n.useRef(null),K=t.__read(o.useImage(f,{width:p,height:h}),2),B=K[0],D=K[1],T=D.x,W=D.y,X=D.scaledWidth,Y=D.scaledHeight,Z=D.imageScale,H=u.useStageActions({stageRef:V.current,imageRef:A.current,layerRef:U.current,imageScale:Z}),z=H.onWheel,L=H.onClick,F=H.changeCursorType;n.useImperativeHandle(m,(function(){return{activeElementKey:k,setActiveElementKey:N}})),n.useEffect((function(){O((function(e){return e.map((function(e,n){return t.__assign(t.__assign({},e),{pointNumber:n+1})}))}))}),[]),n.useEffect((function(){v&&v(k?Number(k):void 0)}),[v,k]);var G=function(e){var t,n=j.find((function(t){return t.pointId===e}));return n&&(null===(t=b.find((function(e){return e.uuid===n.productUuid})))||void 0===t?void 0:t.isSoldOut)||!1};return r.createElement("div",{className:"venue-map",style:{width:p,height:h}},r.createElement("div",{className:"zone-name"},r.createElement("h6",null,g)),r.createElement(l.ZoomButtons,{stageRef:V.current,imageRef:A.current}),r.createElement(c.Scrollbars,{stageRef:V.current,imageRef:A.current,layerRef:U.current}),r.createElement(a.EventVenueMapContext.Consumer,null,(function(e){return r.createElement(i.Stage,{width:p,height:h,className:"canvas-map",onClick:L,onTap:L,ref:V,x:M,y:_,scale:{x:w,y:w},onWheel:z},r.createElement(a.EventVenueMapContext.Provider,{value:e},r.createElement(i.Layer,{ref:U},r.createElement(i.Image,{image:B,x:T,y:W,width:X,height:Y,ref:A}),q.map((function(e){return r.createElement(s.MapPoint,t.__assign({},e,{imageOffsetX:T,imageOffsetY:W,imageScale:Z,key:e.id||e.localId,isSoldOut:G(e.id),scale:w,changeCursorType:F,usedInIframe:y,choosedProductUuids:x,errorOnChoosedProductUuids:R}))})))))})),!y&&r.createElement(d.Dropdown,{imageOffsetX:T,imageOffsetY:W,imageScale:Z,scale:w,stageX:M,stageY:_}))}));exports.VenueMap=m;
|
|
@@ -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;AAI7E,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;CAC5B;AAED,oBAAY,YAAY,GAAG;IACzB,aAAa,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC1C,CAAC;AAEF,eAAO,MAAM,iBAAiB,6FAkT7B,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"),a=require("lodash"),s=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,h=e.defaultValues,M=e.onSubmit,P=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=i.useForm({defaultValues:h}),A=r.useRef(null),B=v.useCategory().verifyCategoryItems,O=I.control,T=I.formState.errors,x=I.formState,K=I.getValues,L=I.reset,N=I.setError,R=I.clearErrors,U=i.useWatch({control:O}),D=s.usePreviousValue(T),W=o.useTranslation("Design").t,w=t.__read(r.useState(""),2),H=w[0],z=w[1],G=t.__read(r.useState(F),2),J=G[0],Q=G[1],X=t.__read(r.useState(void 0),2),Y=X[0],Z=X[1],$=t.__read(r.useState([]),2),ee=$[0],te=$[1];r.useImperativeHandle(_,(function(){return{getFormValues:function(){return K()}}}));var re=function(){var e;null===(e=A.current)||void 0===e||e.setActiveElementKey(void 0)},ne=r.useMemo((function(){var e;return null===(e=null==k?void 0:k.venueMapSet)||void 0===e?void 0:e.venueMaps}),[k]),oe=r.useMemo((function(){return ne&&k?ne.find((function(e){return String(e.id)===String(J)})):null}),[ne,J,k]),ue=r.useMemo((function(){if(!ne||!ne.length||!k)return[];var e=k.pointProducts.map((function(e){return e.pointId}));return ne.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}}))}),[ne,k]),ie=r.useMemo((function(){return oe?oe.points.filter((function(e){return Boolean(k.pointProducts.find((function(t){return t.pointId===e.id})))})):[]}),[k,oe]),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]),se=r.useCallback((function(e){Q(e),j&&j(e)}),[j]),le=r.useMemo((function(){return ae(Object.keys(U).filter((function(e){var t,r;return Boolean(null===(t=U[e])||void 0===t?void 0:t.id)&&(null===(r=U[e])||void 0===r?void 0:r.quantity)>=1})).map((function(e){return String(e)})))}),[U,ae,T]),ce=r.useMemo((function(){return Object.keys(T).length?ae(Object.keys(T).map((function(e){return String(e)}))):[]}),[T,ae,x]);return r.useEffect((function(){te(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(){ne.length&&!J&&Q(String(ne[0].id))}),[ne,J]),r.useEffect((function(){C(U),T&&setTimeout(R,0)}),[U]),r.useEffect((function(){c.isFormValuesEmpty(U)||z("")}),[U]),r.useEffect((function(){L(h)}),[h]),r.useEffect((function(){!a.isEqual(T,D)&&P&&P(T)}),[T,D,P]),r.useEffect((function(){J!==F&&Q(F)}),[F,J]),r.useEffect((function(){Z(void 0),re()}),[J,Z]),n.createElement(n.Fragment,null,n.createElement(E.PageBody.LeftBlock,{title:b,component:ue.length>1&&n.createElement(d.CalendarSelect,{value:F,onChange:se,options:ue}),childrenClassName:"bordered"},n.createElement(p.ErrorModal,{isOpen:Boolean(H),messageKey:H,onClose:function(){return z("")}}),n.createElement(u.Form,{onSubmit:I.handleSubmit((function(e){if(S&&c.isFormValuesEmpty(e))z(W("pleaseSelectAtLeastFrom",{min:1,type:"item",from:"those categories"}));else{var t=B(e,y);if(t)return z(t.message),void N("category_".concat(t.id),{message:t.message});M(e)}}),(function(e){l.scrollToError(c.getFirstErrorKey(e)),z(W("pleaseCheckSelectedProducts"))})),id:V,className:"category-steps-form"},n.createElement(i.FormProvider,t.__assign({},I),n.createElement("div",{className:"position-relative"},oe&&n.createElement(n.Fragment,null,n.createElement(f.IframeEventVenueMap,{url:oe.image.url,usedInIframe:!0,onPointClick:Z,products:ee,points:ie,pointProducts:k.pointProducts,ref:A,choosedProductUuids:le,errorOnChoosedProductUuids:ce}),n.createElement(g.Category,{productCategories:null==y?void 0:y.productCategories,activePointId:Y,pointProducts:k.pointProducts,onCloseModal:re})))))))}));exports.CalendarStepsForm=_;
|
package/package.json
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
calculatePointsCoordinates,
|
|
11
11
|
} from "../../utils";
|
|
12
12
|
import { ProductIcon } from "./components/ProductIcon";
|
|
13
|
+
import { Product } from "../../../../types";
|
|
13
14
|
|
|
14
15
|
type MapPointProps = Partial<Point> &
|
|
15
16
|
ImageOffset & {
|
|
@@ -17,6 +18,7 @@ type MapPointProps = Partial<Point> &
|
|
|
17
18
|
usedInIframe: boolean;
|
|
18
19
|
choosedProductUuids?: string[];
|
|
19
20
|
errorOnChoosedProductUuids?: string[];
|
|
21
|
+
isSoldOut?: Product["isSoldOut"];
|
|
20
22
|
};
|
|
21
23
|
|
|
22
24
|
export const MapPoint = ({
|
|
@@ -32,6 +34,7 @@ export const MapPoint = ({
|
|
|
32
34
|
usedInIframe,
|
|
33
35
|
choosedProductUuids = [],
|
|
34
36
|
errorOnChoosedProductUuids = [],
|
|
37
|
+
isSoldOut,
|
|
35
38
|
}: MapPointProps) => {
|
|
36
39
|
const {
|
|
37
40
|
setActiveElementKey,
|
|
@@ -95,7 +98,7 @@ export const MapPoint = ({
|
|
|
95
98
|
// eslint-disable-next-line no-param-reassign
|
|
96
99
|
event.cancelBubble = true;
|
|
97
100
|
|
|
98
|
-
if (isActive) return;
|
|
101
|
+
if (isActive || isSoldOut) return;
|
|
99
102
|
|
|
100
103
|
setActiveElementKey(pointKey);
|
|
101
104
|
|
|
@@ -52,6 +52,8 @@ export const VenueMap = forwardRef<VenueMapRef, VenueMapProps>(
|
|
|
52
52
|
mapPoints,
|
|
53
53
|
stage: { x: stageX, y: stageY, scale },
|
|
54
54
|
setMapPoints,
|
|
55
|
+
products,
|
|
56
|
+
mapPointProducts,
|
|
55
57
|
activeElementKey,
|
|
56
58
|
setActiveElementKey,
|
|
57
59
|
} = useContext(EventVenueMapContext);
|
|
@@ -104,6 +106,19 @@ export const VenueMap = forwardRef<VenueMapRef, VenueMapProps>(
|
|
|
104
106
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
105
107
|
}, [onPointClick, activeElementKey]);
|
|
106
108
|
|
|
109
|
+
const isProductSoldOut = (pointId: number): boolean => {
|
|
110
|
+
const currentProduct = mapPointProducts.find(
|
|
111
|
+
(point) => point.pointId === pointId
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
if (!currentProduct) return false;
|
|
115
|
+
|
|
116
|
+
return (
|
|
117
|
+
products.find((product) => product.uuid === currentProduct.productUuid)
|
|
118
|
+
?.isSoldOut || false
|
|
119
|
+
);
|
|
120
|
+
};
|
|
121
|
+
|
|
107
122
|
return (
|
|
108
123
|
<div className="venue-map" style={{ width, height }}>
|
|
109
124
|
<div className="zone-name">
|
|
@@ -147,6 +162,7 @@ export const VenueMap = forwardRef<VenueMapRef, VenueMapProps>(
|
|
|
147
162
|
imageOffsetY={imageOffsetY}
|
|
148
163
|
imageScale={imageScale}
|
|
149
164
|
key={point.id || point.localId}
|
|
165
|
+
isSoldOut={isProductSoldOut(point.id)}
|
|
150
166
|
scale={scale}
|
|
151
167
|
changeCursorType={changeCursorType}
|
|
152
168
|
usedInIframe={usedInIframe}
|
|
@@ -94,6 +94,35 @@ const MENU_STEPS = [
|
|
|
94
94
|
productCategory: null,
|
|
95
95
|
uuid: "beb6393c-2fdd-40f7-bb92-8800685b203a",
|
|
96
96
|
},
|
|
97
|
+
{
|
|
98
|
+
id: 150,
|
|
99
|
+
productCategoryId: 5345,
|
|
100
|
+
productGroupId: null,
|
|
101
|
+
availableQuantity: 54,
|
|
102
|
+
zoneId: null,
|
|
103
|
+
name: "Candy",
|
|
104
|
+
description: "",
|
|
105
|
+
price: 13,
|
|
106
|
+
deposit: 0,
|
|
107
|
+
minQuantity: 1,
|
|
108
|
+
maxQuantity: 15,
|
|
109
|
+
totalQuantity: 54,
|
|
110
|
+
type: "sale",
|
|
111
|
+
capacity: 0,
|
|
112
|
+
duration: 30,
|
|
113
|
+
weight: 0,
|
|
114
|
+
isAvailable: true,
|
|
115
|
+
isSoldOut: true,
|
|
116
|
+
isRequired: false,
|
|
117
|
+
isUnlimited: false,
|
|
118
|
+
quantitySelector: 1,
|
|
119
|
+
hasSpecialNotes: false,
|
|
120
|
+
termsAndConditions: null,
|
|
121
|
+
subProducts: [],
|
|
122
|
+
images: null,
|
|
123
|
+
productCategory: null,
|
|
124
|
+
uuid: "beb6393c-2fdd-40f7-bb92-8800685b203b",
|
|
125
|
+
},
|
|
97
126
|
],
|
|
98
127
|
},
|
|
99
128
|
],
|
|
@@ -169,6 +198,15 @@ const MENU_STEPS = [
|
|
|
169
198
|
xCoordinate: 1980.65,
|
|
170
199
|
yCoordinate: 288.7,
|
|
171
200
|
},
|
|
201
|
+
{
|
|
202
|
+
id: 219,
|
|
203
|
+
venueMapId: 7,
|
|
204
|
+
createdAt: null,
|
|
205
|
+
updatedAt: null,
|
|
206
|
+
deletedAt: null,
|
|
207
|
+
xCoordinate: 980.65,
|
|
208
|
+
yCoordinate: 268.7,
|
|
209
|
+
},
|
|
172
210
|
],
|
|
173
211
|
},
|
|
174
212
|
],
|
|
@@ -180,6 +218,12 @@ const MENU_STEPS = [
|
|
|
180
218
|
pointId: 21,
|
|
181
219
|
productUuid: "beb6393c-2fdd-40f7-bb92-8800685b203a",
|
|
182
220
|
},
|
|
221
|
+
{
|
|
222
|
+
id: 11,
|
|
223
|
+
menuStepId: 75,
|
|
224
|
+
pointId: 219,
|
|
225
|
+
productUuid: "beb6393c-2fdd-40f7-bb92-8800685b203b",
|
|
226
|
+
},
|
|
183
227
|
{
|
|
184
228
|
id: 10,
|
|
185
229
|
menuStepId: 75,
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
} from "@licklist/plugins/dist/utils/FormValues";
|
|
19
19
|
import { Step } from "@licklist/core/dist/DataMapper/Product/StepDataMapper";
|
|
20
20
|
import { useTranslation } from "react-i18next";
|
|
21
|
+
import { Product } from "@licklist/core/dist/DataMapper/Product/ProductDataMapper";
|
|
21
22
|
import { Category } from "./components/Category";
|
|
22
23
|
import { MenuStep } from "../../../../types";
|
|
23
24
|
import { STEP_FORM_ID } from "../../constants";
|
|
@@ -89,6 +90,7 @@ export const CalendarStepsForm = forwardRef<
|
|
|
89
90
|
const [activeVenueMap, setActiveVenueMap] =
|
|
90
91
|
useState<string>(activeVenueMapId);
|
|
91
92
|
const [activePointId, setActivePointId] = useState<number>(undefined);
|
|
93
|
+
const [products, setProducts] = useState<Partial<Product>[]>([]);
|
|
92
94
|
|
|
93
95
|
useImperativeHandle(ref, () => {
|
|
94
96
|
return {
|
|
@@ -241,6 +243,21 @@ export const CalendarStepsForm = forwardRef<
|
|
|
241
243
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
242
244
|
}, [errors, getProductsUuids, formState]);
|
|
243
245
|
|
|
246
|
+
const getStepProducts = (): Partial<Product>[] => {
|
|
247
|
+
if (!step.productCategories || !step.productCategories.length) {
|
|
248
|
+
return [];
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
return step.productCategories.reduce((prevProducts, currentCategory) => {
|
|
252
|
+
return [...prevProducts, ...(currentCategory.products || [])];
|
|
253
|
+
}, []);
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
useEffect(() => {
|
|
257
|
+
setProducts(getStepProducts());
|
|
258
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
259
|
+
}, [step]);
|
|
260
|
+
|
|
244
261
|
useEffect(() => {
|
|
245
262
|
if (!venueMaps.length || activeVenueMap) return;
|
|
246
263
|
|
|
@@ -317,6 +334,7 @@ export const CalendarStepsForm = forwardRef<
|
|
|
317
334
|
url={selectedVenueMap.image.url}
|
|
318
335
|
usedInIframe
|
|
319
336
|
onPointClick={setActivePointId}
|
|
337
|
+
products={products}
|
|
320
338
|
points={filteredPoint}
|
|
321
339
|
pointProducts={menuStepWithVenueMap.pointProducts}
|
|
322
340
|
ref={canvasRef}
|