@licklist/design 0.44.470 → 0.44.472
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/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/payment/payment-page/PaymentPage.d.ts +6 -1
- package/dist/iframe/payment/payment-page/PaymentPage.d.ts.map +1 -1
- package/dist/iframe/payment/payment-page/PaymentPage.js +1 -1
- package/dist/product-set/form/ProductCategoriesControl.d.ts.map +1 -1
- package/dist/product-set/form/ProductCategoriesControl.js +1 -1
- package/dist/product-set/form/context.d.ts +4 -2
- package/dist/product-set/form/context.d.ts.map +1 -1
- package/dist/product-set/form/context.js +1 -1
- package/dist/product-set/product-category/ProductCategoryControl.d.ts +1 -1
- package/dist/product-set/utils/index.d.ts +5 -0
- package/dist/product-set/utils/index.d.ts.map +1 -0
- package/dist/product-set/utils/index.js +1 -0
- package/dist/sortable-tree/SortableTreeItem.d.ts +2 -1
- package/dist/sortable-tree/SortableTreeItem.d.ts.map +1 -1
- package/dist/sortable-tree/SortableTreeItem.js +1 -1
- package/package.json +1 -1
- package/src/iframe/order-process/components/CategoryProduct/CategoryProduct.tsx +6 -1
- package/src/iframe/payment/payment-page/PaymentPage.tsx +20 -1
- package/src/product-set/form/ProductCategoriesControl.tsx +67 -18
- package/src/product-set/form/context.tsx +18 -1
- package/src/product-set/product-category/ProductCategoryControl.tsx +1 -1
- package/src/product-set/utils/index.ts +16 -0
- package/src/sortable-tree/SortableTreeItem.tsx +13 -2
|
@@ -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;CAC3D;AAED,eAAO,MAAM,eAAe,qEAKzB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"CategoryProduct.d.ts","sourceRoot":"","sources":["../../../../../src/iframe/order-process/components/CategoryProduct/CategoryProduct.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGxD,UAAU,oBAAoB;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,kBAAkB,CAAC,EAAE,cAAc,CAAC,oBAAoB,CAAC,CAAC;CAC3D;AAED,eAAO,MAAM,eAAe,qEAKzB,oBAAoB,gBAwKtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var r=require("react"),t=e(r),i=require("@licklist/core/dist/Config"),n=require("react-i18next"),a=require("react-hook-form"),c=e(require("@licklist/plugins/dist/services/Form/HookFormService")),o=e(require("clsx")),s=require("react-intl"),u=require("../../../event/ticket-description/TicketDescription.js"),d=require("./components/ProductQuantityInput/ProductQuantityInput.js");exports.CategoryProduct=function(e){var l=e.product,m=e.category,p=e.canExpandDescription,y=void 0===p||p,f=e.productsWithErrors,v=s.useIntl().formatNumber,E=n.useTranslation(["Design","Validation"]).t,g=a.useFormContext(),q=g.control,x=g.clearErrors,N=g.setError,_=r.useMemo((function(){if(f){var e=f.find((function(e){return e.product_id===l.id}));return null==e?void 0:e.message}}),[f,l.id]),A=r.useMemo((function(){if(m.allowDeposits&&l.deposit&&!(null==l?void 0:l.isSoldOut))return l.deposit}),[m,l]);return r.useEffect((function(){_&&N("".concat(l.id),{message:_,type:"validate"})}),[_,l.id]),t.createElement(a.Controller,{control:q,name:"".concat(l.id),rules:{required:l.isRequired,validate:function(e){if(!e)return!0;var r=l.isRequired,t=void 0!==r&&r,i=l.maxAmount,n=void 0===i?0:i,a=l.minAmount,c=void 0===a?0:a,o=e.quantity,s=void 0===o?0:o;return!s&&!t||(!s&&t?E("Design:pleaseSelectAtLeastFrom",{min:1,type:"item",from:"this category"}):s<c?E("Validation:fieldMinNumber",{min:l.minAmount,attribute:l.name}):!(n&&s>=c&&n<s)||E("Validation:quantityMaxNumber",{max:l.maxAmount}))}},render:function(e){var r=e.field,n=r.onChange,a=r.value,s=void 0===a?{}:a,p=r.ref,f=e.fieldState,g=f.invalid,q=f.error;return t.createElement("div",{id:String(l.id),className:"iframe-event__category-product"},t.createElement("div",{className:o("iframe-event__product",g&&"error")},t.createElement(u.TicketDescription,{title:l.name,description:l.description,className:o("iframe-event__product-description"),images:l.images,isRequired:l.isRequired,canExpand:y})),t.createElement("div",{className:"iframe-event__product-price-wrapper"},t.createElement("span",{className:"product-price"},v(null!=A?A:l.price,{style:"currency",currency:i.Currency.GBP})),t.createElement(d.ProductQuantityInput,{onChange:n,productInfo:s,ref:p,clearErrors:x,product:l,category:m,invalid:g,deposit:A})),A&&!(null==m?void 0:m.remainderExpireAfter)&&t.createElement("div",{className:"mt-4"},E("Design:payNowAndUponArrival",{deposit:v(A,{style:"currency",currency:i.Currency.GBP}),remainder:v(l.price-A,{style:"currency",currency:i.Currency.GBP})})),A&&(null==m?void 0:m.remainderExpireAfter)>0&&t.createElement("div",{className:"mt-4"},E("Design:payNowAndReminderDays",{deposit:v(A,{style:"currency",currency:i.Currency.GBP}),remainder:v(l.price-A,{style:"currency",currency:i.Currency.GBP}),days:null==m?void 0:m.remainderExpireAfter})),g&&t.createElement("div",{className:"d-flex mt-3 w-100"},t.createElement("p",{className:"iframe-event__message-error"},c.hasError(q,"required")&&E("Design:pleaseSelectAtLeastFrom",{min:1,type:"item",from:"this category"}),c.hasError(q,"validate")&&q.message)))}})};
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var r=require("react"),t=e(r),i=require("@licklist/core/dist/Config"),n=require("react-i18next"),a=require("react-hook-form"),c=e(require("@licklist/plugins/dist/services/Form/HookFormService")),o=e(require("clsx")),s=require("react-intl"),u=require("../../../event/ticket-description/TicketDescription.js"),d=require("./components/ProductQuantityInput/ProductQuantityInput.js");exports.CategoryProduct=function(e){var l=e.product,m=e.category,p=e.canExpandDescription,y=void 0===p||p,f=e.productsWithErrors,v=s.useIntl().formatNumber,E=n.useTranslation(["Design","Validation"]).t,g=a.useFormContext(),q=g.control,x=g.clearErrors,N=g.setError,_=r.useMemo((function(){if(f){var e=f.find((function(e){return e.product_id===l.id}));return null==e?void 0:e.message}}),[f,l.id]),A=r.useMemo((function(){if(m.allowDeposits&&l.deposit&&!(null==l?void 0:l.isSoldOut)&&!(l.deposit>=l.price))return l.deposit}),[m,l]);return r.useEffect((function(){_&&N("".concat(l.id),{message:_,type:"validate"})}),[_,l.id]),t.createElement(a.Controller,{control:q,name:"".concat(l.id),rules:{required:l.isRequired,validate:function(e){if(!e)return!0;var r=l.isRequired,t=void 0!==r&&r,i=l.maxAmount,n=void 0===i?0:i,a=l.minAmount,c=void 0===a?0:a,o=e.quantity,s=void 0===o?0:o;return!s&&!t||(!s&&t?E("Design:pleaseSelectAtLeastFrom",{min:1,type:"item",from:"this category"}):s<c?E("Validation:fieldMinNumber",{min:l.minAmount,attribute:l.name}):!(n&&s>=c&&n<s)||E("Validation:quantityMaxNumber",{max:l.maxAmount}))}},render:function(e){var r=e.field,n=r.onChange,a=r.value,s=void 0===a?{}:a,p=r.ref,f=e.fieldState,g=f.invalid,q=f.error;return t.createElement("div",{id:String(l.id),className:"iframe-event__category-product"},t.createElement("div",{className:o("iframe-event__product",g&&"error")},t.createElement(u.TicketDescription,{title:l.name,description:l.description,className:o("iframe-event__product-description"),images:l.images,isRequired:l.isRequired,canExpand:y})),t.createElement("div",{className:"iframe-event__product-price-wrapper"},t.createElement("span",{className:"product-price"},v(null!=A?A:l.price,{style:"currency",currency:i.Currency.GBP})),t.createElement(d.ProductQuantityInput,{onChange:n,productInfo:s,ref:p,clearErrors:x,product:l,category:m,invalid:g,deposit:A})),A&&!(null==m?void 0:m.remainderExpireAfter)&&t.createElement("div",{className:"mt-4"},E("Design:payNowAndUponArrival",{deposit:v(A,{style:"currency",currency:i.Currency.GBP}),remainder:v(l.price-A,{style:"currency",currency:i.Currency.GBP})})),A&&(null==m?void 0:m.remainderExpireAfter)>0&&t.createElement("div",{className:"mt-4"},E("Design:payNowAndReminderDays",{deposit:v(A,{style:"currency",currency:i.Currency.GBP}),remainder:v(l.price-A,{style:"currency",currency:i.Currency.GBP}),days:null==m?void 0:m.remainderExpireAfter})),g&&t.createElement("div",{className:"d-flex mt-3 w-100"},t.createElement("p",{className:"iframe-event__message-error"},c.hasError(q,"required")&&E("Design:pleaseSelectAtLeastFrom",{min:1,type:"item",from:"this category"}),c.hasError(q,"validate")&&q.message)))}})};
|
|
@@ -2,13 +2,18 @@
|
|
|
2
2
|
import { PaymentLinkResponse } from "@licklist/plugins/dist/hooks/Api/usePaymentApi";
|
|
3
3
|
import { BookingSummaryProps } from "src/iframe/order-process/components/BookingSummary/types";
|
|
4
4
|
import { RyftPaymentFormProps } from "../../ryft/RyftPaymentForm";
|
|
5
|
+
export interface PaymentMetadata {
|
|
6
|
+
total: number;
|
|
7
|
+
paid: number;
|
|
8
|
+
}
|
|
5
9
|
interface PaymentProps extends RyftPaymentFormProps {
|
|
6
10
|
onCloseIframePayment?: () => void;
|
|
7
11
|
onFailIframePayment?: () => void;
|
|
8
12
|
data?: PaymentLinkResponse;
|
|
9
13
|
isLoading: boolean;
|
|
10
14
|
bookingSummaryProps: Omit<BookingSummaryProps, "totallWithDiscount">;
|
|
15
|
+
paymentMetadata?: PaymentMetadata;
|
|
11
16
|
}
|
|
12
|
-
export declare const PaymentPage: ({ onCloseIframePayment, onFailIframePayment, data, isLoading, bookingSummaryProps, ...ryftPaymentFormProps }: PaymentProps) => JSX.Element;
|
|
17
|
+
export declare const PaymentPage: ({ onCloseIframePayment, onFailIframePayment, data, isLoading, bookingSummaryProps, paymentMetadata, ...ryftPaymentFormProps }: PaymentProps) => JSX.Element;
|
|
13
18
|
export {};
|
|
14
19
|
//# sourceMappingURL=PaymentPage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaymentPage.d.ts","sourceRoot":"","sources":["../../../../src/iframe/payment/payment-page/PaymentPage.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AACrF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0DAA0D,CAAC;AAI/F,OAAO,EAEL,oBAAoB,EACrB,MAAM,4BAA4B,CAAC;AAKpC,UAAU,YAAa,SAAQ,oBAAoB;IACjD,oBAAoB,CAAC,EAAE,MAAM,IAAI,CAAC;IAClC,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;IACjC,IAAI,CAAC,EAAE,mBAAmB,CAAC;IAC3B,SAAS,EAAE,OAAO,CAAC;IACnB,mBAAmB,EAAE,IAAI,CAAC,mBAAmB,EAAE,oBAAoB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"PaymentPage.d.ts","sourceRoot":"","sources":["../../../../src/iframe/payment/payment-page/PaymentPage.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AACrF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0DAA0D,CAAC;AAI/F,OAAO,EAEL,oBAAoB,EACrB,MAAM,4BAA4B,CAAC;AAKpC,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,YAAa,SAAQ,oBAAoB;IACjD,oBAAoB,CAAC,EAAE,MAAM,IAAI,CAAC;IAClC,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;IACjC,IAAI,CAAC,EAAE,mBAAmB,CAAC;IAC3B,SAAS,EAAE,OAAO,CAAC;IACnB,mBAAmB,EAAE,IAAI,CAAC,mBAAmB,EAAE,oBAAoB,CAAC,CAAC;IACrE,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC;AAED,eAAO,MAAM,WAAW,kIAQrB,YAAY,gBAqHd,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),o=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),o=require("react"),a=(e=o)&&"object"==typeof e&&"default"in e?e.default:e,r=require("react-router-dom"),n=require("../../../static/loader/LoaderIndicator.js"),m=require("react-i18next"),s=require("react-bootstrap");require("../../../static/index.js"),require("../../order-process/components/NavigationFooter/NavigationFooter.js");var i=require("../../page/components/PageHeader/PageHeader.js"),l=require("@licklist/plugins/dist/context/payment/PaymentSessionContext"),c=require("../../order-process/components/BookingSummary/components/SummaryTotal/components/SummaryTotalBlock.js"),u=require("../../ryft/RyftPaymentForm.js"),d=require("../../order-process/components/BookingSummary/BookingSummary.js");require("../../order-process/components/NavigationSteps/NavigationSteps.js"),require("../../order-process/components/StepsForm/StepsForm.js"),require("../../order-process/components/Timer/Timer.js"),require("../../order-process/components/PaymentCard/PaymentCard.js");var p=require("../../order-process/components/BookingSummaryFooter/BookingSummaryFooter.js"),y=require("../../page/components/PageBody/PageBody.js");require("../../order-process/components/CalendarStepsForm/CalendarStepsForm.js");var g=require("./PaymentTimer.js"),f=require("../../page/Page.js");exports.PaymentPage=function(e){var B=e.onCloseIframePayment,P=e.onFailIframePayment,k=e.data,E=e.isLoading,S=e.bookingSummaryProps,q=e.paymentMetadata,j=t.__rest(e,["onCloseIframePayment","onFailIframePayment","data","isLoading","bookingSummaryProps","paymentMetadata"]),v=m.useTranslation("Design").t,x=r.useLocation().search,C=o.useContext(l.PaymentSessionContext).isPaymentSessionExpired,b=Boolean(new URLSearchParams(x).get("isIframePayment")),w=function(){window.close()};return o.useEffect((function(){b&&B&&window.addEventListener("beforeunload",(function(){B()}))}),[]),o.useEffect((function(){C&&b&&P&&P()}),[C]),E?a.createElement(n.LoaderIndicator,{isLoaded:!1}):null===k?a.createElement(f.Page,null,a.createElement(y.PageBody,{leftBlock:a.createElement(y.PageBody.LeftBlock,null,a.createElement("div",{className:"d-flex h-100 w-100 justify-content-center align-items-center flex-column"},a.createElement("h6",null,v("linkNotActiveOrExpired")),a.createElement(s.Col,{xs:12,md:3},a.createElement(s.Button,{className:"mt-5 w-20",onClick:function(){window.location.href="https://booked.it/"}},v("backToSite")))))})):a.createElement(f.Page,{className:"payment_link",headerBlock:a.createElement(i.PageHeader,{showBackButton:b,onBackButtonClick:b?w:void 0,showCloseButton:b,onCloseButtonClick:b?w:void 0},b&&a.createElement(g.PaymentTimer,null),a.createElement("div",{className:"d-flex align-items-center justify-content-center w-100"},v("paymentDetails")))},a.createElement(y.PageBody,{leftBlock:a.createElement(y.PageBody.LeftBlock,null,a.createElement(u.RyftPaymentForm,t.__assign({},j))),rightBlock:a.createElement(y.PageBody.RightBlock,{bottomBlock:a.createElement(p.BookingSummaryFooter,{showButton:!1},a.createElement("div",{className:"d-flex flex-column justify-content-between"},q&&a.createElement(a.Fragment,null,a.createElement(c.SummaryTotalBlock,{label:v("total"),amount:q.total||0}),a.createElement(c.SummaryTotalBlock,{label:v("paidSum"),amount:q.paid||0})),a.createElement(c.SummaryTotalBlock,{label:v(q?"remaining":"total"),amount:(null==k?void 0:k.amount)||0})))},a.createElement("h6",null,v("paymentDetails")),a.createElement(d.BookingSummary,t.__assign({},S)))}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductCategoriesControl.d.ts","sourceRoot":"","sources":["../../../src/product-set/form/ProductCategoriesControl.tsx"],"names":[],"mappings":";AAYA,OAAO,EAKL,YAAY,EACb,MAAM,kEAAkE,CAAC;AAQ1E,OAAO,EAAwB,aAAa,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"ProductCategoriesControl.d.ts","sourceRoot":"","sources":["../../../src/product-set/form/ProductCategoriesControl.tsx"],"names":[],"mappings":";AAYA,OAAO,EAKL,YAAY,EACb,MAAM,kEAAkE,CAAC;AAQ1E,OAAO,EAAwB,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAQvE,UAAU,6BAA8B,SAAQ,aAAa;IAC3D,SAAS,EAAE,MAAM,CAAC;CACnB;AA4BD,wBAAgB,wBAAwB,CAAC,EACvC,SAAS,EACT,SAAS,GACV,EAAE,6BAA6B,eAqR/B;AAED,eAAO,MAAM,cAAc,iBACX,YAAY,SACnB,MAAM;WACH,MAAM;eAAa,MAAM;CAcpC,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=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"),n=e(r),o=require("react-i18next"),i=require("react-bootstrap"),a=require("react-hook-form"),u=e(require("@licklist/plugins/dist/services/Form/HookFormService")),d=e(require("clsx")),l=require("@dnd-kit/core"),s=require("lodash"),c=require("../../sortable-tree/SortableTreeItem.js"),m=require("../../sortable-tree/SortableTree.js"),p=require("../item/CreateProductSetItem.js"),v=require("./context.js"),g=require("@licklist/core/dist/DataMapper/Product/ProductCategoryDataMapper"),f=require("../product-category/ProductCategoryControl.js"),y=require("./ProductsControl.js"),C=require("./SelectCategoryModal.js"),E=require("./VenueMapSetModal.js"),b=require("../utils/index.js");var I=function(e,t){return e===g.CATEGORY_TYPE_GAME?{className:"game-badge",label:t}:e===g.CATEGORY_TYPE_FIXED_DURATION?{className:"fixed-duration-badge",label:t}:null};exports.ProductCategoriesControl=function(e){var _,S,q,T,x,P,N=e.isLoading,M=e.stepIndex,A=o.useTranslation("Design").t,h=r.useContext(v.ProductSetLoadingContext),k=h.providerHasMap,j=h.expandedProductCategories,D=h.setExpandedProductCategories,R=a.useFormContext(),V=t.__read(r.useState(!1),2),Y=V[0],F=V[1],O=t.__read(r.useState(!1),2),B=O[0],L=O[1],w=t.__read(r.useState(!1),2),G=w[0],H=w[1],Q=R.control,U=R.formState.errors,K=R.clearErrors,z=R.watch,W=R.trigger,X=R.getValues,J=R.setValue,Z=z("steps.".concat(M,".hasMap"))||!1,$="steps.".concat(M,".productCategories"),ee=a.useFieldArray({name:$,control:Q,keyName:"_id"}),te=ee.fields,re=ee.append,ne=ee.remove,oe=t.__read(r.useState([]),2),ie=oe[0],ae=oe[1],ue=a.useWatch({control:Q,name:$}),de=null===(S=null===(_=null==U?void 0:U.steps)||void 0===_?void 0:_[M])||void 0===S?void 0:S.productCategories,le=null===(T=null===(q=null==U?void 0:U.steps)||void 0===q?void 0:q[M])||void 0===T?void 0:T.venueMapSetId,se=null===(P=null===(x=null==U?void 0:U.steps)||void 0===x?void 0:x[M])||void 0===P?void 0:P.pointProducts,ce=Boolean(le||se),me=l.useSensor(l.MouseSensor,{activationConstraint:{distance:10}});return r.useEffect((function(){ue&&ue.length&&ue.forEach((function(e){var t,r,n,o=null===(r=e.products)||void 0===r?void 0:r.reduce((function(e,t){return e+Number(t.price)*Number(t.totalQuantity)}),0),i=null===(n=e.products)||void 0===n?void 0:n.reduce((function(e,t){return e+Number(t.totalQuantity)}),0);ae(((t={})[(null==e?void 0:e.id)||e.uniqueId]={price:o,quantity:i},t))}))}),[ue]),r.useEffect((function(){1===te.length&&D((function(e){var r,n,o;return t.__assign(t.__assign({},e),((r={})[String((null===(n=te[0])||void 0===n?void 0:n.id)||(null===(o=te[0])||void 0===o?void 0:o.uniqueId))]=!0,r))}))}),[te]),n.createElement(n.Fragment,null,n.createElement(m.SortableTree,{sensors:[me],items:te.map((function(e){return String(e._id)})),onDragEnd:function(e){var t=e.active,r=e.over;if(t&&r&&(null==t?void 0:t.id)&&(null==r?void 0:r.id)){var n=te.findIndex((function(e){return e._id===t.id})),o=te.findIndex((function(e){return e._id===r.id}));if(n!==o){var i=X($);if(i){var a=b.sortArrayByIndex(b.moveArrayElements(i,n,o));J($,a)}}}}},te.map((function(e,r){var o=(null==e?void 0:e.id)?String(e.id):e.uniqueId,u=function(){!function(e){D((function(r){var n;return t.__assign(t.__assign({},r),((n={})[e]=!r[e],n))}))}(o)};return n.createElement(a.Controller,{key:"product-category-".concat(e._id),name:"".concat($,".").concat(r,".name"),control:Q,rules:{required:A("Validation:fieldRequired",{attribute:A("name")})},render:function(t){var a,d,l,s=t.field,p=s.value,v=s.onChange;return n.createElement(m.SortableTree.Item,{id:e._id,title:p,isExpanded:j[o],setIsExpanded:u,isInvalid:!!de,badge:n.createElement(i.Badge,{className:"category-badge"},A("productCategory")),isIconInHeader:!1,subTitle:n.createElement("div",{className:"product-set-badges-container"},n.createElement("div",{className:"product-set-subtitle-dot product-set-subtitle-category-dot"}),n.createElement("span",null,null!==(l=null===(d=ie[null!==(a=null==e?void 0:e.id)&&void 0!==a?a:e.uniqueId])||void 0===d?void 0:d.quantity)&&void 0!==l?l:"N/A"," ",A("products"))),treeLineIconColor:"#1A93AA",modalLabel:A("addNewCategory"),secondaryBadge:I(e.type,A(e.type)),modalClass:c.ProductSetModalClasses.category,isNewAdded:G,body:n.createElement(f.ProductCategoryControl,{isLoading:N,onCategoryNameChange:v,categoryName:p,stepIndex:M,productCategoryIndex:r}),onDelete:function(){return ne(r)},validate:function(){return W("steps.".concat(M,".productCategories.").concat(r))},sortableItems:e.products?e.products.filter((function(e){return e.id})).map((function(e){var t=e.id;return String(t)})):[]},n.createElement(y.ProductsControl,{isLoading:N,quantityType:e.quantityType,hasTicket:null==e?void 0:e.hasTicket,stepIndex:M,productCategoryIndex:r,categoryType:e.type}))}})}))),n.createElement(p.CreateProductSetItem,{title:A("addCategory"),onClick:function(){F(!0)}}),n.createElement(C.SelectCategoryModal,{isVisible:Y,onHide:function(){return F(!1)},onCategorySelect:function(e){re(function(e,t){return{id:null,uniqueId:s.uniqueId("product-category"),name:"",minSubItems:null,maxSubItems:null,quantityType:g.QUANTITY_TYPE_STANDARD,type:e,isRelyOnPeople:e===g.CATEGORY_TYPE_TICKETS,isTimeRelated:!1,collectUserInfo:!1,hasTicket:e===g.CATEGORY_TYPE_TICKETS,allowDeposits:!1,remainderExpireAfter:void 0,hasBookingManagement:!1,weight:0,isReusable:!1,hasSubEvents:!1,products:[],zoneId:null,sort:t}}(e,te.length)),H(!0),(null==de?void 0:de.type)===u.manualErrorType&&K($)}}),k&&Z&&n.createElement(n.Fragment,null,n.createElement(p.CreateProductSetItem,{title:A("editMap"),onClick:function(){L(!0)},className:d("mt-3",ce&&"mb-3",ce&&"is-invalid")}),ce&&n.createElement("div",{className:"manual-form-error"},le&&A("Validation:fieldRequired",{attribute:A("Design:venueMapSet")}),se&&A("Validation:fieldMinNumber",{attribute:A("pointProduct"),min:1})),n.createElement(E.VenueMapSetModal,{isVisible:B,setIsVisible:L,stepIndex:M})),n.createElement("div",{className:"manual-form-error"},de&&de.message))},exports.getBadgeConfig=I;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { PropsWithChildren } from "react";
|
|
1
|
+
import React, { PropsWithChildren, SetStateAction, Dispatch } from "react";
|
|
2
2
|
import { VenueMapSet } from "@licklist/core/dist/DataMapper/Product/VenueMapSetDataMapper";
|
|
3
3
|
import { ProviderBookingManagementSetting } from "@licklist/core/dist/DataMapper/Provider/ProviderBookingManagementSettingDataMapper";
|
|
4
4
|
import { Zone } from "@licklist/core/dist/DataMapper/Provider/ZoneDataMapper";
|
|
@@ -11,9 +11,11 @@ interface LoadingContext {
|
|
|
11
11
|
venueMapSets?: VenueMapSet[];
|
|
12
12
|
providerHasBookingManagement?: ProviderBookingManagementSetting["hasBookingManagement"];
|
|
13
13
|
zones?: Zone[] | null;
|
|
14
|
+
expandedProductCategories: Record<string, boolean>;
|
|
15
|
+
setExpandedProductCategories: Dispatch<SetStateAction<Record<string, boolean>>>;
|
|
14
16
|
}
|
|
15
17
|
export declare const ProductSetLoadingContext: React.Context<LoadingContext>;
|
|
16
|
-
declare type ProductSetContextProviderProps = PropsWithChildren<Omit<LoadingContext, "isLoading" | "setLoading">>;
|
|
18
|
+
declare type ProductSetContextProviderProps = PropsWithChildren<Omit<LoadingContext, "isLoading" | "setLoading" | "expandedProductCategories" | "setExpandedProductCategories">>;
|
|
17
19
|
export declare function ProductSetContextProvider({ children, productGroupList, providerHasMap, venueMapSets, providerHasBookingManagement, zones, }: ProductSetContextProviderProps): JSX.Element;
|
|
18
20
|
export {};
|
|
19
21
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/product-set/form/context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,iBAAiB,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/product-set/form/context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,iBAAiB,EACjB,cAAc,EAId,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,8DAA8D,CAAC;AAE3F,OAAO,EAAE,gCAAgC,EAAE,MAAM,oFAAoF,CAAC;AACtI,OAAO,EAAE,IAAI,EAAE,MAAM,wDAAwD,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAE5D,UAAU,cAAc;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,gBAAgB,CAAC,EAAE,UAAU,EAAE,CAAC;IAChC,cAAc,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAChC,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;IAC7B,4BAA4B,CAAC,EAAE,gCAAgC,CAAC,sBAAsB,CAAC,CAAC;IACxF,KAAK,CAAC,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IACtB,yBAAyB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnD,4BAA4B,EAAE,QAAQ,CACpC,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CACxC,CAAC;CACH;AAED,eAAO,MAAM,wBAAwB,+BAEpC,CAAC;AAEF,aAAK,8BAA8B,GAAG,iBAAiB,CACrD,IAAI,CACF,cAAc,EACZ,WAAW,GACX,YAAY,GACZ,2BAA2B,GAC3B,8BAA8B,CACjC,CACF,CAAC;AAEF,wBAAgB,yBAAyB,CAAC,EACxC,QAAQ,EACR,gBAAqB,EACrB,cAAsB,EACtB,YAAiB,EACjB,4BAA4B,EAC5B,KAAK,GACN,EAAE,8BAA8B,eA0BhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),r=require("react"),o=(e=r)&&"object"==typeof e&&"default"in e?e.default:e,a=r.createContext(null);exports.ProductSetContextProvider=function(e){var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),r=require("react"),o=(e=r)&&"object"==typeof e&&"default"in e?e.default:e,a=r.createContext(null);exports.ProductSetContextProvider=function(e){var d=e.children,i=e.productGroupList,n=void 0===i?[]:i,u=e.providerHasMap,s=void 0!==u&&u,p=e.venueMapSets,c=void 0===p?[]:p,v=e.providerHasBookingManagement,l=e.zones,g=t.__read(r.useState(void 0),2),f=g[0],x=g[1],_=t.__read(r.useState(!1),2),M=_[0],P=_[1],S=t.__read(r.useState({}),2),C=S[0],L=S[1];return r.useEffect((function(){return x(l)}),[l]),o.createElement(a.Provider,{value:{isLoading:M,setLoading:P,productGroupList:n,providerHasMap:s,venueMapSets:c,providerHasBookingManagement:v,zones:f,expandedProductCategories:C,setExpandedProductCategories:L}},d)},exports.ProductSetLoadingContext=a;
|
|
@@ -5,7 +5,7 @@ import { Zone } from "@licklist/core/dist/DataMapper/Provider/ZoneDataMapper";
|
|
|
5
5
|
import { IsDeletableEvent } from "../types";
|
|
6
6
|
export interface ProductCategoryControlValues extends FormValues {
|
|
7
7
|
id: number;
|
|
8
|
-
uniqueId?:
|
|
8
|
+
uniqueId?: string;
|
|
9
9
|
name: string;
|
|
10
10
|
minSubItems: number | null;
|
|
11
11
|
maxSubItems: number | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/product-set/utils/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,6BAEjB,MAAM,aACN,MAAM,QAQlB,CAAC;AAEF,eAAO,MAAM,gBAAgB;;IAE5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("tslib");exports.moveArrayElements=function(e,s,t){var n=r.__spreadArray([],r.__read(e),!1);return n.splice(t,0,n.splice(s,1)[0]),n},exports.sortArrayByIndex=function(e){return e.map((function(e,s){return r.__assign(r.__assign({},e),{sort:s})}))};
|
|
@@ -28,6 +28,7 @@ export interface SortableTreeItemProps {
|
|
|
28
28
|
label: string;
|
|
29
29
|
className: string;
|
|
30
30
|
};
|
|
31
|
+
setIsExpanded?: () => void;
|
|
31
32
|
}
|
|
32
|
-
export declare function SortableTreeItem({ id, title, badge, subTitle, body, children, preItem, postItem, sortableItems, isExpanded, isInvalid, isIconInHeader, treeLineIconColor, modalLabel, modalClass, isNewAdded, onDelete, validate, secondaryBadge, }: SortableTreeItemProps): JSX.Element;
|
|
33
|
+
export declare function SortableTreeItem({ id, title, badge, subTitle, body, children, preItem, postItem, sortableItems, isExpanded, isInvalid, isIconInHeader, treeLineIconColor, modalLabel, modalClass, isNewAdded, onDelete, validate, secondaryBadge, setIsExpanded, }: SortableTreeItemProps): JSX.Element;
|
|
33
34
|
//# sourceMappingURL=SortableTreeItem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SortableTreeItem.d.ts","sourceRoot":"","sources":["../../src/sortable-tree/SortableTreeItem.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"SortableTreeItem.d.ts","sourceRoot":"","sources":["../../src/sortable-tree/SortableTreeItem.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAoC,MAAM,OAAO,CAAC;AAkB3E,eAAO,MAAM,sBAAsB;;;;CAIzB,CAAC;AAEX,oBAAY,0BAA0B,GACpC,OAAO,sBAAsB,CAAC,MAAM,OAAO,sBAAsB,CAAC,CAAC;AAErE,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,0BAA0B,CAAC;IACxC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IAClC,cAAc,CAAC,EAAE;QACf,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;CAC5B;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,EAAE,EACF,KAAK,EACL,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,aAAa,EACb,UAAkB,EAClB,SAAiB,EACjB,cAAqB,EACrB,iBAAsB,EACtB,UAAe,EACf,UAAU,EACV,UAAkB,EAClB,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,aAAa,GACd,EAAE,qBAAqB,eA6RvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),a=require("react"),
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),a=require("react"),n=e(a),r=require("react-i18next"),l=require("react-bootstrap"),o=require("../static/Icon.js"),s=e(require("clsx")),i=require("@dnd-kit/core"),c=require("@dnd-kit/sortable"),d=require("@dnd-kit/utilities"),m=require("../modals/confirmation/ConfirmModal.js");require("../modals/dialog/Dialog.js"),require("../modals/dialog/DialogContext.js");var u=require("../product-set/elements/DeleteFieldButton.js"),p={step:"edit-product-step",category:"edit-product-category",product:"edit-product"};exports.ProductSetModalClasses=p,exports.SortableTreeItem=function(e){var b=this,g=e.id,v=e.title,E=e.badge,f=e.subTitle,N=e.body,y=e.children,h=e.preItem,w=e.postItem,C=e.sortableItems,_=e.isExpanded,x=void 0!==_&&_,D=e.isInvalid,S=void 0!==D&&D,q=e.isIconInHeader,M=void 0===q||q,k=e.treeLineIconColor,I=void 0===k?"":k,B=e.modalLabel,j=void 0===B?"":B,P=e.modalClass,T=e.isNewAdded,X=void 0!==T&&T,Y=e.onDelete,A=e.validate,L=e.secondaryBadge,R=e.setIsExpanded,U=t.__read(a.useState(x),2),z=U[0],F=U[1],H=t.__read(a.useState(X),2),K=H[0],V=H[1],O=r.useTranslation("Design").t,G=c.useSortable({id:g}),J=G.attributes,Q=G.listeners,W=G.setNodeRef,Z=G.transform,$=G.transition,ee=t.__read(a.useState({pageX:0,pageY:0}),2),te=ee[0],ae=ee[1],ne=i.useDraggable({id:g}),re=ne.isDragging,le=ne.attributes,oe=ne.listeners,se=ne.setNodeRef,ie=ne.transform,ce=a.useCallback((function(e){var t=e.pageX-te.pageX,a=e.pageY-te.pageY;Math.sqrt(t*t+a*a)>5||(R?R():F((function(e){return!e})))}),[te,R]),de=a.useCallback((function(e){ae({pageX:e.pageX,pageY:e.pageY})}),[]),me=function(){return t.__awaiter(b,void 0,void 0,(function(){return t.__generator(this,(function(e){switch(e.label){case 0:return A||V(!1),[4,null==A?void 0:A()];case 1:return e.sent()&&V(!1),[2]}}))}))};return a.useEffect((function(){F(x)}),[x]),n.createElement("div",t.__assign({className:"sortable-tree-root",style:{transform:d.CSS.Translate.toString(Z),transition:$}},le,oe,{ref:W}),n.createElement("div",t.__assign({className:"sortable-tree-wrapper",ref:se},le,oe,{onKeyDown:function(e){return e.stopPropagation()},onMouseDown:function(e){K&&e.stopPropagation()},onMouseUp:function(e){K&&e.stopPropagation()},role:"button",tabIndex:0,style:P===p.step?{transform:d.CSS.Translate.toString(ie),opacity:re?.7:1}:null}),n.createElement("div",{className:"sortable-tree-line"},n.createElement(l.Button,{variant:"link",size:"sm",onMouseDown:de,onMouseUp:ce},z?n.createElement(o.default,{type:"minus",width:".7rem"}):n.createElement("div",{className:"expand-icon-container"},n.createElement("div",null),n.createElement("div",null),n.createElement("div",null))),z&&n.createElement("svg",{className:"sortable-tree-line-icon",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",viewBox:"0 0 100 100",preserveAspectRatio:"none"},n.createElement("g",null,n.createElement("path",{className:s("sortable-tree-line-icon-path",I&&"sortable-tree-line-product-element"),style:{stroke:I},d:"M 50 0 V 100"})))),n.createElement("div",{className:"sortable-tree-item-wrapper"},n.createElement("div",{className:s("sortable-tree-item",S?"invalid":"")},n.createElement("div",{className:"sortable-tree-item-header"},M&&n.createElement(l.Button,t.__assign({variant:"link",className:"sortable-tree-item-handle"},J,Q),n.createElement(o.default,{type:"grip-vertical"})),n.createElement(l.Button,{className:"sortable-tree-item-toggle",variant:"link",onMouseDown:de,onMouseUp:ce},E&&n.createElement("span",{className:"sortable-tree-item-badge"},E),n.createElement("div",{className:s(j?"sortable-tree-product-set-title-container":"sortable-tree-title-container")},n.createElement("span",{className:s("sortable-tree-item-title",j&&"sortable-tree-product-set-element-title")},v),!z&&n.createElement("span",{className:"sortable-tree-item-subtitle"},f)),n.createElement("div",{className:"border-0 open-edit-right-modal-button",role:"button",tabIndex:0,onClick:function(e){e.stopPropagation(),V(!0)},onKeyDown:function(e){return e.stopPropagation()}},n.createElement(o.default,{type:"ellipsis-h",color:"#0E8CE2",height:"1rem"})))),M?n.createElement(l.Collapse,{in:z},n.createElement("div",null,n.createElement("div",{className:"sortable-tree-item-body"},N))):n.createElement(l.Modal,{size:"lg",show:K,className:s("m-0 edit-product-set-element-modal edit-right-form-modal h-100",P),dialogClassName:"edit-event-dialog edit-step-dialog",onHide:me},n.createElement("div",{className:"edit-step-modal-header"},n.createElement("button",{className:"p-0 cancel-add-step-btn border-0",type:"button",onClick:me},n.createElement("span",null,O("Design:cancel"))),L&&n.createElement("div",{className:"secondary-badge ".concat(null==L?void 0:L.className)},null==L?void 0:L.label)),n.createElement(l.Modal.Body,{as:"form",noValidate:!0},n.createElement("div",{className:"top-label-container"},n.createElement("span",null,j)),N,n.createElement("div",{className:"d-flex product-set-element-control-btns justify-content-between"},n.createElement(l.Button,{className:"step-save-btn mt-4",type:"button",onClick:me},O("saveAndAdd")),n.createElement("div",{className:"d-flex justify-content-end mt-4 delete-btn"},Boolean(Y)&&n.createElement(m.ConfirmModal,null,(function(e){return n.createElement(u.DeleteFieldButton,{onDelete:function(){return e(Y)}})}))))))),C&&n.createElement("div",{className:"sortable-tree-subitems"},h,n.createElement(i.DndContext,null,n.createElement(c.SortableContext,{items:C,strategy:c.verticalListSortingStrategy},n.createElement(l.Collapse,{in:z},n.createElement("div",{className:"ml-0"},y)))),w))))};
|
package/package.json
CHANGED
|
@@ -38,7 +38,12 @@ export const CategoryProduct = ({
|
|
|
38
38
|
}, [productsWithErrors, product.id]);
|
|
39
39
|
|
|
40
40
|
const deposit = useMemo(() => {
|
|
41
|
-
if (
|
|
41
|
+
if (
|
|
42
|
+
!category.allowDeposits ||
|
|
43
|
+
!product.deposit ||
|
|
44
|
+
product?.isSoldOut ||
|
|
45
|
+
product.deposit >= product.price
|
|
46
|
+
) {
|
|
42
47
|
return undefined;
|
|
43
48
|
}
|
|
44
49
|
return product.deposit;
|
|
@@ -16,12 +16,18 @@ import { PaymentTimer } from "./PaymentTimer";
|
|
|
16
16
|
import { Page, PageBody, PageHeader } from "../../page";
|
|
17
17
|
import { BookingSummary, BookingSummaryFooter } from "../../order-process";
|
|
18
18
|
|
|
19
|
+
export interface PaymentMetadata {
|
|
20
|
+
total: number;
|
|
21
|
+
paid: number;
|
|
22
|
+
}
|
|
23
|
+
|
|
19
24
|
interface PaymentProps extends RyftPaymentFormProps {
|
|
20
25
|
onCloseIframePayment?: () => void;
|
|
21
26
|
onFailIframePayment?: () => void;
|
|
22
27
|
data?: PaymentLinkResponse;
|
|
23
28
|
isLoading: boolean;
|
|
24
29
|
bookingSummaryProps: Omit<BookingSummaryProps, "totallWithDiscount">;
|
|
30
|
+
paymentMetadata?: PaymentMetadata;
|
|
25
31
|
}
|
|
26
32
|
|
|
27
33
|
export const PaymentPage = ({
|
|
@@ -30,6 +36,7 @@ export const PaymentPage = ({
|
|
|
30
36
|
data,
|
|
31
37
|
isLoading,
|
|
32
38
|
bookingSummaryProps,
|
|
39
|
+
paymentMetadata,
|
|
33
40
|
...ryftPaymentFormProps
|
|
34
41
|
}: PaymentProps) => {
|
|
35
42
|
const { t } = useTranslation("Design");
|
|
@@ -121,8 +128,20 @@ export const PaymentPage = ({
|
|
|
121
128
|
bottomBlock={
|
|
122
129
|
<BookingSummaryFooter showButton={false}>
|
|
123
130
|
<div className="d-flex flex-column justify-content-between">
|
|
131
|
+
{paymentMetadata && (
|
|
132
|
+
<>
|
|
133
|
+
<SummaryTotalBlock
|
|
134
|
+
label={t("total")}
|
|
135
|
+
amount={paymentMetadata.total || 0}
|
|
136
|
+
/>
|
|
137
|
+
<SummaryTotalBlock
|
|
138
|
+
label={t("paidSum")}
|
|
139
|
+
amount={paymentMetadata.paid || 0}
|
|
140
|
+
/>
|
|
141
|
+
</>
|
|
142
|
+
)}
|
|
124
143
|
<SummaryTotalBlock
|
|
125
|
-
label={t("total")}
|
|
144
|
+
label={t(paymentMetadata ? "remaining" : "total")}
|
|
126
145
|
amount={data?.amount || 0}
|
|
127
146
|
/>
|
|
128
147
|
</div>
|
|
@@ -28,6 +28,7 @@ import { ProductSetFormValues, WithIsLoading } from "./ProductSetForm";
|
|
|
28
28
|
import { SelectCategoryModal } from "./SelectCategoryModal";
|
|
29
29
|
import { ProductSetLoadingContext } from "./context";
|
|
30
30
|
import { VenueMapSetModal } from "./VenueMapSetModal";
|
|
31
|
+
import { moveArrayElements, sortArrayByIndex } from "../utils";
|
|
31
32
|
// @TODO not for first release
|
|
32
33
|
// import Popover from "./ProductSetFormPopover";
|
|
33
34
|
|
|
@@ -40,7 +41,7 @@ const getCategoryDefaultValue = (
|
|
|
40
41
|
sort: number
|
|
41
42
|
): ProductCategory => ({
|
|
42
43
|
id: null,
|
|
43
|
-
uniqueId:
|
|
44
|
+
uniqueId: uniqueId("product-category"),
|
|
44
45
|
name: "",
|
|
45
46
|
minSubItems: null,
|
|
46
47
|
maxSubItems: null,
|
|
@@ -66,7 +67,11 @@ export function ProductCategoriesControl({
|
|
|
66
67
|
stepIndex,
|
|
67
68
|
}: ProductCategoriesControlProps) {
|
|
68
69
|
const { t } = useTranslation("Design");
|
|
69
|
-
const {
|
|
70
|
+
const {
|
|
71
|
+
providerHasMap,
|
|
72
|
+
expandedProductCategories,
|
|
73
|
+
setExpandedProductCategories,
|
|
74
|
+
} = useContext(ProductSetLoadingContext);
|
|
70
75
|
const form = useFormContext<ProductSetFormValues>();
|
|
71
76
|
const [isSelectCategoryVisible, setIsSelectCategoryVisible] = useState(false);
|
|
72
77
|
const [isVenueMapSetModalVisible, setIsVenueMapSetModalVisible] =
|
|
@@ -78,6 +83,8 @@ export function ProductCategoriesControl({
|
|
|
78
83
|
clearErrors,
|
|
79
84
|
watch,
|
|
80
85
|
trigger,
|
|
86
|
+
getValues,
|
|
87
|
+
setValue,
|
|
81
88
|
} = form;
|
|
82
89
|
|
|
83
90
|
const hasMap: boolean = watch(`steps.${stepIndex}.hasMap` as const) || false;
|
|
@@ -94,8 +101,6 @@ export function ProductCategoriesControl({
|
|
|
94
101
|
Record<number, { price: number; quantity: number }>
|
|
95
102
|
>([]);
|
|
96
103
|
|
|
97
|
-
const isFirstCategoryAdded = fields.length === 1;
|
|
98
|
-
|
|
99
104
|
const productCategories: ProductCategory[] = useWatch({
|
|
100
105
|
control,
|
|
101
106
|
name: productCategoriesFieldName,
|
|
@@ -117,17 +122,39 @@ export function ProductCategoriesControl({
|
|
|
117
122
|
},
|
|
118
123
|
});
|
|
119
124
|
|
|
120
|
-
const handleDragEnd = (
|
|
125
|
+
const handleDragEnd = (event) => {
|
|
121
126
|
// @TODO uncomment when will be fix for change sort index
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
const { active, over } = event;
|
|
128
|
+
|
|
129
|
+
if (!active || !over || !active?.id || !over?.id) return;
|
|
130
|
+
|
|
131
|
+
const prevIndex = fields.findIndex((field) => field._id === active.id);
|
|
132
|
+
const nextIndex = fields.findIndex((field) => field._id === over.id);
|
|
133
|
+
|
|
134
|
+
if (prevIndex === nextIndex) return;
|
|
135
|
+
|
|
136
|
+
const productCategories = getValues(productCategoriesFieldName);
|
|
137
|
+
|
|
138
|
+
if (!productCategories) return;
|
|
139
|
+
|
|
140
|
+
const nextProductCategories = sortArrayByIndex<ProductCategory>(
|
|
141
|
+
moveArrayElements<ProductCategory>(
|
|
142
|
+
productCategories,
|
|
143
|
+
prevIndex,
|
|
144
|
+
nextIndex
|
|
145
|
+
)
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
setValue(productCategoriesFieldName, nextProductCategories);
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
const setIsExpanded = (productCategoryId: string) => {
|
|
152
|
+
setExpandedProductCategories((prevValues: Record<string, any>) => {
|
|
153
|
+
return {
|
|
154
|
+
...prevValues,
|
|
155
|
+
[productCategoryId]: !prevValues[productCategoryId],
|
|
156
|
+
};
|
|
157
|
+
});
|
|
131
158
|
};
|
|
132
159
|
|
|
133
160
|
useEffect(() => {
|
|
@@ -142,7 +169,9 @@ export function ProductCategoriesControl({
|
|
|
142
169
|
}, 0);
|
|
143
170
|
|
|
144
171
|
setProductCategoryState({
|
|
145
|
-
|
|
172
|
+
// New added categories will have uniqueId
|
|
173
|
+
// but existing have already assigned Id.
|
|
174
|
+
[productCategory?.id || productCategory.uniqueId]: {
|
|
146
175
|
price,
|
|
147
176
|
quantity,
|
|
148
177
|
},
|
|
@@ -150,6 +179,16 @@ export function ProductCategoriesControl({
|
|
|
150
179
|
});
|
|
151
180
|
}, [productCategories]);
|
|
152
181
|
|
|
182
|
+
useEffect(() => {
|
|
183
|
+
if (fields.length !== 1) return;
|
|
184
|
+
|
|
185
|
+
setExpandedProductCategories((prevValues) => ({
|
|
186
|
+
...prevValues,
|
|
187
|
+
[String(fields[0]?.id || fields[0]?.uniqueId)]: true,
|
|
188
|
+
}));
|
|
189
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
190
|
+
}, [fields]);
|
|
191
|
+
|
|
153
192
|
return (
|
|
154
193
|
<>
|
|
155
194
|
<SortableTree
|
|
@@ -158,6 +197,14 @@ export function ProductCategoriesControl({
|
|
|
158
197
|
onDragEnd={handleDragEnd}
|
|
159
198
|
>
|
|
160
199
|
{fields.map((productCategory, index) => {
|
|
200
|
+
const productCategoryId = productCategory?.id
|
|
201
|
+
? String(productCategory.id)
|
|
202
|
+
: productCategory.uniqueId;
|
|
203
|
+
|
|
204
|
+
const onSetIsExpanded = () => {
|
|
205
|
+
setIsExpanded(productCategoryId);
|
|
206
|
+
};
|
|
207
|
+
|
|
161
208
|
return (
|
|
162
209
|
<Controller
|
|
163
210
|
key={`product-category-${productCategory._id}`}
|
|
@@ -172,7 +219,8 @@ export function ProductCategoriesControl({
|
|
|
172
219
|
<SortableTree.Item
|
|
173
220
|
id={productCategory._id}
|
|
174
221
|
title={value}
|
|
175
|
-
isExpanded={
|
|
222
|
+
isExpanded={expandedProductCategories[productCategoryId]}
|
|
223
|
+
setIsExpanded={onSetIsExpanded}
|
|
176
224
|
isInvalid={!!productCategoriesErrors}
|
|
177
225
|
badge={
|
|
178
226
|
<Badge className="category-badge">
|
|
@@ -184,8 +232,9 @@ export function ProductCategoriesControl({
|
|
|
184
232
|
<div className="product-set-badges-container">
|
|
185
233
|
<div className="product-set-subtitle-dot product-set-subtitle-category-dot" />
|
|
186
234
|
<span>
|
|
187
|
-
{productCategoryState[
|
|
188
|
-
?.
|
|
235
|
+
{productCategoryState[
|
|
236
|
+
productCategory?.id ?? productCategory.uniqueId
|
|
237
|
+
]?.quantity ?? "N/A"}{" "}
|
|
189
238
|
{t("products")}
|
|
190
239
|
</span>
|
|
191
240
|
</div>
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React, {
|
|
2
2
|
PropsWithChildren,
|
|
3
|
+
SetStateAction,
|
|
3
4
|
createContext,
|
|
4
5
|
useEffect,
|
|
5
6
|
useState,
|
|
7
|
+
Dispatch,
|
|
6
8
|
} from "react";
|
|
7
9
|
import { VenueMapSet } from "@licklist/core/dist/DataMapper/Product/VenueMapSetDataMapper";
|
|
8
10
|
// eslint-disable-next-line max-len
|
|
@@ -18,6 +20,10 @@ interface LoadingContext {
|
|
|
18
20
|
venueMapSets?: VenueMapSet[];
|
|
19
21
|
providerHasBookingManagement?: ProviderBookingManagementSetting["hasBookingManagement"];
|
|
20
22
|
zones?: Zone[] | null;
|
|
23
|
+
expandedProductCategories: Record<string, boolean>;
|
|
24
|
+
setExpandedProductCategories: Dispatch<
|
|
25
|
+
SetStateAction<Record<string, boolean>>
|
|
26
|
+
>;
|
|
21
27
|
}
|
|
22
28
|
|
|
23
29
|
export const ProductSetLoadingContext = createContext<LoadingContext | null>(
|
|
@@ -25,7 +31,13 @@ export const ProductSetLoadingContext = createContext<LoadingContext | null>(
|
|
|
25
31
|
);
|
|
26
32
|
|
|
27
33
|
type ProductSetContextProviderProps = PropsWithChildren<
|
|
28
|
-
Omit<
|
|
34
|
+
Omit<
|
|
35
|
+
LoadingContext,
|
|
36
|
+
| "isLoading"
|
|
37
|
+
| "setLoading"
|
|
38
|
+
| "expandedProductCategories"
|
|
39
|
+
| "setExpandedProductCategories"
|
|
40
|
+
>
|
|
29
41
|
>;
|
|
30
42
|
|
|
31
43
|
export function ProductSetContextProvider({
|
|
@@ -38,6 +50,9 @@ export function ProductSetContextProvider({
|
|
|
38
50
|
}: ProductSetContextProviderProps) {
|
|
39
51
|
const [zonesState, setZonesState] = useState<Zone[] | undefined>(undefined);
|
|
40
52
|
const [loading, setLoading] = useState(false);
|
|
53
|
+
const [expandedProductCategories, setExpandedProductCategories] = useState<
|
|
54
|
+
Record<string, boolean>
|
|
55
|
+
>({});
|
|
41
56
|
|
|
42
57
|
useEffect(() => setZonesState(zones), [zones]);
|
|
43
58
|
|
|
@@ -51,6 +66,8 @@ export function ProductSetContextProvider({
|
|
|
51
66
|
venueMapSets,
|
|
52
67
|
providerHasBookingManagement,
|
|
53
68
|
zones: zonesState,
|
|
69
|
+
expandedProductCategories,
|
|
70
|
+
setExpandedProductCategories,
|
|
54
71
|
}}
|
|
55
72
|
>
|
|
56
73
|
{children}
|
|
@@ -22,7 +22,7 @@ import { ProductSetLoadingContext } from "../form/context";
|
|
|
22
22
|
|
|
23
23
|
export interface ProductCategoryControlValues extends FormValues {
|
|
24
24
|
id: number;
|
|
25
|
-
uniqueId?:
|
|
25
|
+
uniqueId?: string;
|
|
26
26
|
name: string;
|
|
27
27
|
minSubItems: number | null;
|
|
28
28
|
maxSubItems: number | null;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const moveArrayElements = <T>(
|
|
2
|
+
array: T[],
|
|
3
|
+
prevIndex: number,
|
|
4
|
+
nextIndex: number
|
|
5
|
+
) => {
|
|
6
|
+
const nextArray = [...array];
|
|
7
|
+
// We move there elements in array
|
|
8
|
+
// by set and change indexes
|
|
9
|
+
nextArray.splice(nextIndex, 0, nextArray.splice(prevIndex, 1)[0]);
|
|
10
|
+
|
|
11
|
+
return nextArray;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const sortArrayByIndex = <T>(array: T[]) => {
|
|
15
|
+
return array.map((element: T, index) => ({ ...element, sort: index }));
|
|
16
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { ReactNode, useCallback, useState } from "react";
|
|
1
|
+
import React, { ReactNode, useCallback, useEffect, useState } from "react";
|
|
2
2
|
import { DndContext, useDraggable } from "@dnd-kit/core";
|
|
3
3
|
import {
|
|
4
4
|
SortableContext,
|
|
@@ -48,6 +48,7 @@ export interface SortableTreeItemProps {
|
|
|
48
48
|
label: string;
|
|
49
49
|
className: string;
|
|
50
50
|
};
|
|
51
|
+
setIsExpanded?: () => void;
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
export function SortableTreeItem({
|
|
@@ -70,6 +71,7 @@ export function SortableTreeItem({
|
|
|
70
71
|
onDelete,
|
|
71
72
|
validate,
|
|
72
73
|
secondaryBadge,
|
|
74
|
+
setIsExpanded,
|
|
73
75
|
}: SortableTreeItemProps) {
|
|
74
76
|
const [expanded, setExpanded] = useState(isExpanded);
|
|
75
77
|
const [isModalVisible, setIsModalVisible] = useState(isNewAdded);
|
|
@@ -102,9 +104,14 @@ export function SortableTreeItem({
|
|
|
102
104
|
return;
|
|
103
105
|
}
|
|
104
106
|
|
|
107
|
+
if (setIsExpanded) {
|
|
108
|
+
setIsExpanded();
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
|
|
105
112
|
setExpanded((expanded) => !expanded);
|
|
106
113
|
},
|
|
107
|
-
[position]
|
|
114
|
+
[position, setIsExpanded]
|
|
108
115
|
);
|
|
109
116
|
|
|
110
117
|
const onButtonMouseDown = useCallback((event) => {
|
|
@@ -118,6 +125,10 @@ export function SortableTreeItem({
|
|
|
118
125
|
if (success) setIsModalVisible(false);
|
|
119
126
|
};
|
|
120
127
|
|
|
128
|
+
useEffect(() => {
|
|
129
|
+
setExpanded(isExpanded);
|
|
130
|
+
}, [isExpanded]);
|
|
131
|
+
|
|
121
132
|
return (
|
|
122
133
|
<div
|
|
123
134
|
className="sortable-tree-root"
|