@licklist/design 0.44.485-dev.12 → 0.44.485-dev.14
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/payment/payment-page/PaymentPage.d.ts.map +1 -1
- package/dist/iframe/payment/payment-page/PaymentPage.js +1 -1
- package/dist/iframe/payment/payment-status-page/PaymentStatusPage.d.ts.map +1 -1
- package/dist/iframe/payment/payment-status-page/PaymentStatusPage.js +1 -1
- package/dist/product-set/form/ProductsControl.d.ts.map +1 -1
- package/dist/product-set/form/ProductsControl.js +1 -1
- package/package.json +1 -1
- package/src/iframe/payment/payment-page/PaymentPage.tsx +44 -7
- package/src/iframe/payment/payment-status-page/PaymentStatusPage.tsx +47 -7
- package/src/product-set/form/ProductsControl.tsx +20 -1
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"PaymentPage.d.ts","sourceRoot":"","sources":["../../../../src/iframe/payment/payment-page/PaymentPage.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AACrF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0DAA0D,CAAC;AAI/F,OAAO,EAEL,oBAAoB,EACrB,MAAM,4BAA4B,CAAC;AAMpC,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,YAAa,SAAQ,oBAAoB;IACjD,oBAAoB,CAAC,EAAE,MAAM,IAAI,CAAC;IAClC,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;IACjC,IAAI,CAAC,EAAE,mBAAmB,CAAC;IAC3B,SAAS,EAAE,OAAO,CAAC;IACnB,mBAAmB,EAAE,IAAI,CAAC,mBAAmB,EAAE,oBAAoB,CAAC,CAAC;IACrE,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC;AAED,eAAO,MAAM,WAAW,kIAQrB,YAAY,gBA0Jd,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
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"),
|
|
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"),l=require("react-i18next"),m=require("react-bootstrap");require("../../../static/index.js"),require("../../order-process/components/NavigationFooter/NavigationFooter.js");var i=require("../../page/components/PageHeader/PageHeader.js"),s=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/utils/index.js"),y=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"),g=require("../../page/components/PageBody/PageBody.js");require("../../order-process/components/CalendarStepsForm/CalendarStepsForm.js");var f=require("./PaymentTimer.js"),B=require("../../page/Page.js");exports.PaymentPage=function(e){var k=e.onCloseIframePayment,P=e.onFailIframePayment,E=e.data,S=e.isLoading,v=e.bookingSummaryProps,j=e.paymentMetadata,q=t.__rest(e,["onCloseIframePayment","onFailIframePayment","data","isLoading","bookingSummaryProps","paymentMetadata"]),F=l.useTranslation("Design").t,b=r.useLocation().search,x=o.useContext(s.PaymentSessionContext).isPaymentSessionExpired,C=Boolean(new URLSearchParams(b).get("isIframePayment")),h=function(){window.close()};if(o.useEffect((function(){C&&k&&window.addEventListener("beforeunload",(function(){k()}))}),[]),o.useEffect((function(){x&&C&&P&&P()}),[x]),S)return a.createElement(n.LoaderIndicator,{isLoaded:!1});if(null===E)return a.createElement(B.Page,null,a.createElement(g.PageBody,{leftBlock:a.createElement(g.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,F("linkNotActiveOrExpired")),a.createElement(m.Col,{xs:12,md:3},a.createElement(m.Button,{className:"mt-5 w-20",onClick:function(){window.location.href="https://booked.it/"}},F("backToSite")))))}));var w=d.cartSumByOrderProducts(Object.values(null==v?void 0:v.formValues)),T=w>(null==E?void 0:E.amount);return a.createElement(B.Page,{className:"payment_link",headerBlock:a.createElement(i.PageHeader,{showBackButton:C,onBackButtonClick:C?h:void 0,showCloseButton:C,onCloseButtonClick:C?h:void 0},a.createElement(f.PaymentTimer,null),a.createElement("div",{className:"d-flex align-items-center justify-content-center w-100"},F("paymentDetails")))},a.createElement(g.PageBody,{leftBlock:a.createElement(g.PageBody.LeftBlock,null,a.createElement(u.RyftPaymentForm,t.__assign({},q))),rightBlock:a.createElement(g.PageBody.RightBlock,{bottomBlock:a.createElement(p.BookingSummaryFooter,{showButton:!1},a.createElement("div",{className:"d-flex flex-column justify-content-between"},j?a.createElement(a.Fragment,null,a.createElement(c.SummaryTotalBlock,{label:F("total"),amount:j.total||0}),a.createElement(c.SummaryTotalBlock,{label:F("paidSum"),amount:j.paid||0}),a.createElement(c.SummaryTotalBlock,{label:F("remaining"),amount:(null==E?void 0:E.amount)+((null==v?void 0:v.transactionFee)||0)})):a.createElement(a.Fragment,null,T&&a.createElement(c.SummaryTotalBlock,{label:F("total"),amount:w+((null==v?void 0:v.transactionFee)||0)}),a.createElement(c.SummaryTotalBlock,{label:F(T?"totalWithDiscount":"total"),amount:(null==E?void 0:E.amount)+((null==v?void 0:v.transactionFee)||0)}))))},a.createElement("h6",null,F("paymentDetails")),a.createElement(y.BookingSummary,t.__assign({},v)))}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaymentStatusPage.d.ts","sourceRoot":"","sources":["../../../../src/iframe/payment/payment-status-page/PaymentStatusPage.tsx"],"names":[],"mappings":"AACA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AASzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,qDAAqD,CAAC;AAC1F,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"PaymentStatusPage.d.ts","sourceRoot":"","sources":["../../../../src/iframe/payment/payment-status-page/PaymentStatusPage.tsx"],"names":[],"mappings":"AACA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AASzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,qDAAqD,CAAC;AAC1F,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,eAAO,MAAM,mBAAmB,WAAW,CAAC;AAC5C,eAAO,MAAM,oBAAoB,YAAY,CAAC;AAC9C,eAAO,MAAM,oBAAoB,YAAY,CAAC;AAE9C,oBAAY,iBAAiB,GACzB,OAAO,oBAAoB,GAC3B,OAAO,mBAAmB,GAC1B,OAAO,oBAAoB,CAAC;AAEhC,UAAU,2BAA2B;IACnC,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,kBAAkB,CAAC,EAAE,SAAS,CAAC;IAC/B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC;AAGD,eAAO,MAAM,iBAAiB,iLAa3B,2BAA2B,gBA4H7B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),o=require("react"),r=(e=o)&&"object"==typeof e&&"default"in e?e.default:e,a=require("../../../static/loader/LoaderIndicator.js"),n=require("react-i18next");require("../../order-process/components/NavigationFooter/NavigationFooter.js"),require("../../page/components/PageHeader/PageHeader.js");var s=require("../payment-status-header/PaymentStatusHeader.js"),m=require("../../order-process/components/BookingSummary/components/SummaryTotal/components/SummaryTotalBlock.js");require("../../order-process/components/BookingSummary/components/SummaryTotal/SummaryTotal.js");var i=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
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),o=require("react"),r=(e=o)&&"object"==typeof e&&"default"in e?e.default:e,a=require("../../../static/loader/LoaderIndicator.js"),n=require("react-i18next");require("../../order-process/components/NavigationFooter/NavigationFooter.js"),require("../../page/components/PageHeader/PageHeader.js");var s=require("../payment-status-header/PaymentStatusHeader.js"),m=require("../../order-process/components/BookingSummary/components/SummaryTotal/components/SummaryTotalBlock.js"),l=require("../../order-process/components/BookingSummary/utils/index.js");require("../../order-process/components/BookingSummary/components/SummaryTotal/SummaryTotal.js");var i=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 u=require("../../order-process/components/BookingSummaryFooter/BookingSummaryFooter.js"),c=require("../../page/components/PageBody/PageBody.js");require("../../order-process/components/CalendarStepsForm/CalendarStepsForm.js");var d=require("../../page/Page.js"),p=require("./component/PaymentStatusBody.js"),y="failed",g="success",S="pending";exports.ORDER_STATUS_FAILED=y,exports.ORDER_STATUS_PENDING=S,exports.ORDER_STATUS_SUCCESS=g,exports.PaymentStatusPage=function(e){var o=e.onCloseWindow,B=e.onBack,E=e.onTryAgain,k=e.isLoading,v=e.status,P=e.isAppUsingInIframe,j=e.bookingSummaryProps,q=e.EventCardComponent,T=e.showCloseButton,f=void 0!==T&&T,F=e.email,C=e.totalAmount,b=void 0===C?0:C,h=e.paymentMetadata,_=n.useTranslation("Design").t,x=function(){switch(v){case g:return _("purchaseSuccessful");case S:return _("pendingPayment");default:return _("purchaseFailed")}}();if(k)return r.createElement(a.LoaderIndicator,{isLoaded:!1});var A=l.cartSumByOrderProducts(Object.values(null==j?void 0:j.formValues)),I=j&&A>b;return r.createElement(d.Page,{className:"payment-status-page",headerBlock:r.createElement(s.PaymentStatusHeader,{success:v!==y,showCloseButton:f,onCloseButtonClick:o,title:v===S?_("pendingPayment"):void 0}),isAppUsingInIframe:P},r.createElement(c.PageBody,{leftBlock:r.createElement(c.PageBody.LeftBlock,{title:x},r.createElement("div",null,q,r.createElement(p.PaymentStatusBody,{status:v,onBack:B||o,onTryAgain:E,email:F}))),rightBlock:r.createElement(c.PageBody.RightBlock,{bottomBlock:r.createElement(u.BookingSummaryFooter,{showButton:!1},r.createElement("div",{className:"d-flex flex-column justify-content-between"},h?r.createElement(r.Fragment,null,r.createElement(m.SummaryTotalBlock,{label:_("total"),amount:h.total||0}),r.createElement(m.SummaryTotalBlock,{label:_("paidSum"),amount:h.paid||0}),r.createElement(m.SummaryTotalBlock,{label:_("remaining"),amount:b+((null==j?void 0:j.transactionFee)||0)})):r.createElement(r.Fragment,null,I&&r.createElement(m.SummaryTotalBlock,{label:_("total"),amount:A+((null==j?void 0:j.transactionFee)||0)}),r.createElement(m.SummaryTotalBlock,{label:_(I?"totalWithDiscount":"total"),amount:b+((null==j?void 0:j.transactionFee)||0)}))))},j?r.createElement(i.BookingSummary,t.__assign({},j)):r.createElement("h6",null,x))}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductsControl.d.ts","sourceRoot":"","sources":["../../../src/product-set/form/ProductsControl.tsx"],"names":[],"mappings":";AAeA,OAAO,EAAE,YAAY,EAAE,MAAM,kEAAkE,CAAC;AAChG,OAAO,EAAkB,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,IAAI,CAAC;AAI/E,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAOjD,UAAU,oBAAqB,SAAQ,aAAa;IAClD,YAAY,EAAE,mBAAmB,CAAC,oBAAoB,CAAC,CAAC,cAAc,CAAC,CAAC;IACxE,SAAS,EAAE,MAAM,CAAC;IAClB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,YAAY,CAAC;CAC5B;AAmCD,wBAAgB,eAAe,CAAC,EAC9B,SAAS,EACT,YAAY,EACZ,SAAS,EACT,oBAAoB,EACpB,SAAS,EACT,YAAY,GACb,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"ProductsControl.d.ts","sourceRoot":"","sources":["../../../src/product-set/form/ProductsControl.tsx"],"names":[],"mappings":";AAeA,OAAO,EAAE,YAAY,EAAE,MAAM,kEAAkE,CAAC;AAChG,OAAO,EAAkB,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,IAAI,CAAC;AAI/E,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAOjD,UAAU,oBAAqB,SAAQ,aAAa;IAClD,YAAY,EAAE,mBAAmB,CAAC,oBAAoB,CAAC,CAAC,cAAc,CAAC,CAAC;IACxE,SAAS,EAAE,MAAM,CAAC;IAClB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,YAAY,CAAC;CAC5B;AAmCD,wBAAgB,eAAe,CAAC,EAC9B,SAAS,EACT,YAAY,EACZ,SAAS,EACT,oBAAoB,EACpB,SAAS,EACT,YAAY,GACb,EAAE,oBAAoB,eAqMtB"}
|
|
@@ -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"),o=e(r),n=require("react-i18next"),a=require("react-bootstrap"),i=require("react-hook-form"),c=e(require("@licklist/plugins/dist/services/Form/HookFormService")),u=require("@dnd-kit/core"),d=require("lodash");require("../elements/DeleteFieldButton.js");var s=require("../../sortable-tree/SortableTreeItem.js"),l=require("../../sortable-tree/SortableTree.js");require("../card/ProductSetCard.js");var p=require("../item/CreateProductSetItem.js");require("../step/StepControl.js"),require("../product-category/ProductCategoryControl.js");var m=require("@licklist/core/dist/DataMapper/Product/ProductDataMapper"),g=require("@licklist/core/dist/Services");require("../product/booking-management/ProductBookingManagementControl.js"),require("../product/deposit/ProductDepositControl.js"),require("../product/quantity/ProductQuantityControl.js"),require("../product/quantity/ProductQuantityConstantControl.js"),require("../product/quantity/ProductQuantityRechargingControl.js");var
|
|
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),n=require("react-i18next"),a=require("react-bootstrap"),i=require("react-hook-form"),c=e(require("@licklist/plugins/dist/services/Form/HookFormService")),u=require("@dnd-kit/core"),d=require("lodash");require("../elements/DeleteFieldButton.js");var s=require("../../sortable-tree/SortableTreeItem.js"),l=require("../../sortable-tree/SortableTree.js");require("../card/ProductSetCard.js");var p=require("../item/CreateProductSetItem.js");require("../step/StepControl.js"),require("../product-category/ProductCategoryControl.js");var m=require("@licklist/core/dist/DataMapper/Product/ProductDataMapper"),g=require("@licklist/core/dist/Services");require("../product/booking-management/ProductBookingManagementControl.js"),require("../product/deposit/ProductDepositControl.js"),require("../product/quantity/ProductQuantityControl.js"),require("../product/quantity/ProductQuantityConstantControl.js"),require("../product/quantity/ProductQuantityRechargingControl.js");var v=require("../product/ProductControl.js"),q=require("./SubProductsControl.js"),y=require("./ProductCategoriesControl.js");require("../control/ProductSetControl.js"),require("../deposit-paid/ProductSetDepositPaidControl.js"),require("./ProductSetForm.js"),require("../popover/ProductSetPopover.js"),require("../tabs/ProductSetTab.js"),require("../tabs/ProductSetTabs.js");exports.ProductsControl=function(e){var f,C,P,b,S=e.isLoading,_=e.quantityType,j=e.stepIndex,T=e.productCategoryIndex,E=e.hasTicket,h=e.categoryType,I=n.useTranslation("Design").t,k=i.useFormContext(),x=t.__read(r.useState(!1),2),D=x[0],N=x[1],A=k.control,F=k.formState.errors,M=k.clearErrors,Q=k.trigger,w=k.setValue,B=k.watch,U=k.getValues,L="steps.".concat(j,".productCategories.").concat(T,".products"),R="steps.".concat(j,".pointProducts"),O=i.useFieldArray({name:L,control:A,keyName:"_id"}),V=O.fields,W=O.append,H=O.remove,z=O.move,G=B("steps.".concat(j,".productCategories.").concat(T,".allowDeposits")),Y=i.useWatch({control:A,name:t.__spreadArray([],t.__read(V.map((function(e,t){return"".concat(L,".").concat(t,".price")}))),!1)}),J=i.useWatch({control:A,name:t.__spreadArray([],t.__read(V.map((function(e,t){return"".concat(L,".").concat(t,".totalQuantity")}))),!1)}),K=i.useWatch({control:A,name:t.__spreadArray([],t.__read(V.map((function(e,t){return"".concat(L,".").concat(t,".isUnlimited")}))),!1)}),X=null===(b=null===(P=null===(C=null===(f=null==F?void 0:F.steps)||void 0===f?void 0:f[j])||void 0===C?void 0:C.productCategories)||void 0===P?void 0:P[T])||void 0===b?void 0:b.products,Z=1===V.length,$=u.useSensor(u.MouseSensor,{activationConstraint:{distance:10}});return o.createElement(o.Fragment,null,o.createElement(l.SortableTree,{items:V.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 o=V.findIndex((function(e){return e._id===t.id})),n=V.findIndex((function(e){return e._id===r.id}));o!==n&&(z(o,n),V.forEach((function(e,t){w("".concat(L,".").concat(t,".sort"),t)})))}},sensors:[$]},V.map((function(e,t){return o.createElement(i.Controller,{key:e._id,control:A,name:"".concat(L,".").concat(t,".name"),rules:{required:I("Validation:fieldRequired",{attribute:I("name")})},render:function(r){var n=r.field,i=n.value,c=n.onChange;return o.createElement(l.SortableTree.Item,{key:"product-".concat(e._id),id:String(e._id),isExpanded:Z,isInvalid:!!X,title:i,badge:o.createElement(a.Badge,{className:"product-badge"},I("product")),isIconInHeader:!1,secondaryBadge:y.getBadgeConfig(h,I(h)),subTitle:o.createElement("div",{className:"product-set-badges-container"},o.createElement("div",{className:"product-set-subtitle-dot product-set-subtitle-product-dot"}),o.createElement("span",null,"£".concat(Y[t]," ").concat(I("each")," - ").concat(I("qty"),":").concat(K[t]?I(" unlimited"):" ".concat(J[t])," ").concat(K[t]?"":" - ".concat(I("possibleRevenue")," £").concat(Y[t]*J[t])," "))),modalLabel:I("addNewProduct"),modalClass:s.ProductSetModalClasses.product,isNewAdded:D,body:o.createElement(v.ProductControl,{isLoading:S,quantityType:_,allowDeposits:G,hasBookingManagement:!1,fieldNamePrefix:"".concat(L,".").concat(t),productName:i,onProductNameChange:c,hasTicket:E,categoryType:h}),onDelete:function(){return function(e){var t=U("".concat(L,".").concat(e)),r=U(R);w(R,(null==r?void 0:r.filter((function(e){return e.productUuid!==t.uuid})))||[]),H(e)}(t)},validate:function(){return Q("".concat(L,".").concat(t))}},o.createElement(q.SubProductsControl,{isLoading:S,quantityType:_,stepIndex:j,productCategoryIndex:T,productIndex:t}))}})}))),o.createElement(p.CreateProductSetItem,{title:I("addProduct"),onClick:function(){var e;W((e=V.length,{id:null,name:"",termsAndConditions:"",productGroupId:null,description:"",price:0,deposit:0,minQuantity:null,maxQuantity:null,totalQuantity:0,capacity:0,duration:0,isAvailable:!0,isSoldOut:!1,isRequired:!1,isUnlimited:!1,quantitySelector:1,hasSpecialNotes:!1,weight:0,type:m.DEFAULT_PRODUCT_TYPE,tierId:Number(d.uniqueId()),zoneId:null,subProducts:[],images:[],uuid:g.generateUuid(),subSlots:null,offset:null,pause:null,serviceTime:null,sort:e})),N(!0),(null==X?void 0:X.type)===c.manualErrorType&&M(L)}}),o.createElement("div",{className:"manual-form-error"},X&&X.message))};
|
package/package.json
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
import { PaymentTimer } from "./PaymentTimer";
|
|
16
16
|
import { Page, PageBody, PageHeader } from "../../page";
|
|
17
17
|
import { BookingSummary, BookingSummaryFooter } from "../../order-process";
|
|
18
|
+
import { cartSumByOrderProducts } from "../../order-process/components/BookingSummary/utils";
|
|
18
19
|
|
|
19
20
|
export interface PaymentMetadata {
|
|
20
21
|
total: number;
|
|
@@ -99,6 +100,17 @@ export const PaymentPage = ({
|
|
|
99
100
|
);
|
|
100
101
|
}
|
|
101
102
|
|
|
103
|
+
const orderTotalAmounByFormValues = cartSumByOrderProducts(
|
|
104
|
+
Object.values(bookingSummaryProps?.formValues)
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
// User can fill promocode only in iframe appcliation.
|
|
108
|
+
// It didn't possible via payment link. This check will
|
|
109
|
+
// be applied when there are no metadata and in case when
|
|
110
|
+
// orderValues sum is greater than amount in order.
|
|
111
|
+
const isCalculatedAmountGreaterThanOrderAmount =
|
|
112
|
+
orderTotalAmounByFormValues > data?.amount;
|
|
113
|
+
|
|
102
114
|
return (
|
|
103
115
|
<Page
|
|
104
116
|
className="payment_link"
|
|
@@ -127,7 +139,7 @@ export const PaymentPage = ({
|
|
|
127
139
|
bottomBlock={
|
|
128
140
|
<BookingSummaryFooter showButton={false}>
|
|
129
141
|
<div className="d-flex flex-column justify-content-between">
|
|
130
|
-
{paymentMetadata
|
|
142
|
+
{paymentMetadata ? (
|
|
131
143
|
<>
|
|
132
144
|
<SummaryTotalBlock
|
|
133
145
|
label={t("total")}
|
|
@@ -137,14 +149,39 @@ export const PaymentPage = ({
|
|
|
137
149
|
label={t("paidSum")}
|
|
138
150
|
amount={paymentMetadata.paid || 0}
|
|
139
151
|
/>
|
|
152
|
+
<SummaryTotalBlock
|
|
153
|
+
label={t("remaining")}
|
|
154
|
+
amount={
|
|
155
|
+
data?.amount +
|
|
156
|
+
(bookingSummaryProps?.transactionFee || 0)
|
|
157
|
+
}
|
|
158
|
+
/>
|
|
159
|
+
</>
|
|
160
|
+
) : (
|
|
161
|
+
<>
|
|
162
|
+
{isCalculatedAmountGreaterThanOrderAmount && (
|
|
163
|
+
<SummaryTotalBlock
|
|
164
|
+
label={t("total")}
|
|
165
|
+
amount={
|
|
166
|
+
orderTotalAmounByFormValues +
|
|
167
|
+
(bookingSummaryProps?.transactionFee || 0)
|
|
168
|
+
}
|
|
169
|
+
/>
|
|
170
|
+
)}
|
|
171
|
+
|
|
172
|
+
<SummaryTotalBlock
|
|
173
|
+
label={t(
|
|
174
|
+
isCalculatedAmountGreaterThanOrderAmount
|
|
175
|
+
? "totalWithDiscount"
|
|
176
|
+
: "total"
|
|
177
|
+
)}
|
|
178
|
+
amount={
|
|
179
|
+
data?.amount +
|
|
180
|
+
(bookingSummaryProps?.transactionFee || 0)
|
|
181
|
+
}
|
|
182
|
+
/>
|
|
140
183
|
</>
|
|
141
184
|
)}
|
|
142
|
-
<SummaryTotalBlock
|
|
143
|
-
label={t(paymentMetadata ? "remaining" : "total")}
|
|
144
|
-
amount={
|
|
145
|
-
data?.amount + (bookingSummaryProps?.transactionFee || 0)
|
|
146
|
-
}
|
|
147
|
-
/>
|
|
148
185
|
</div>
|
|
149
186
|
</BookingSummaryFooter>
|
|
150
187
|
}
|
|
@@ -10,6 +10,7 @@ import { PaymentStatusHeader } from "../payment-status-header/PaymentStatusHeade
|
|
|
10
10
|
import { SummaryTotalBlock } from "../../order-process/components/BookingSummary/components/SummaryTotal";
|
|
11
11
|
import { BookingSummaryProps } from "../../order-process/components/BookingSummary/types";
|
|
12
12
|
import { PaymentMetadata } from "../payment-page/PaymentPage";
|
|
13
|
+
import { cartSumByOrderProducts } from "../../order-process/components/BookingSummary/utils";
|
|
13
14
|
|
|
14
15
|
export const ORDER_STATUS_FAILED = "failed";
|
|
15
16
|
export const ORDER_STATUS_SUCCESS = "success";
|
|
@@ -68,6 +69,20 @@ export const PaymentStatusPage = ({
|
|
|
68
69
|
if (isLoading) {
|
|
69
70
|
return <LoaderIndicator isLoaded={false} />;
|
|
70
71
|
}
|
|
72
|
+
|
|
73
|
+
const orderTotalAmounByFormValues = cartSumByOrderProducts(
|
|
74
|
+
Object.values(bookingSummaryProps?.formValues)
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
// User can fill promocode only in iframe appcliation.
|
|
78
|
+
// It didn't possible via payment link. This check will
|
|
79
|
+
// be applied when there are no metadata and in case when
|
|
80
|
+
// orderValues sum is greater than amount in order.
|
|
81
|
+
// For payment status page booking summary props can be empty
|
|
82
|
+
// so we should also check for them
|
|
83
|
+
const isCalculatedAmountGreaterThanOrderAmount =
|
|
84
|
+
bookingSummaryProps && orderTotalAmounByFormValues > totalAmount;
|
|
85
|
+
|
|
71
86
|
return (
|
|
72
87
|
<Page
|
|
73
88
|
className="payment-status-page"
|
|
@@ -102,7 +117,7 @@ export const PaymentStatusPage = ({
|
|
|
102
117
|
bottomBlock={
|
|
103
118
|
<BookingSummaryFooter showButton={false}>
|
|
104
119
|
<div className="d-flex flex-column justify-content-between">
|
|
105
|
-
{paymentMetadata
|
|
120
|
+
{paymentMetadata ? (
|
|
106
121
|
<>
|
|
107
122
|
<SummaryTotalBlock
|
|
108
123
|
label={t("total")}
|
|
@@ -112,14 +127,39 @@ export const PaymentStatusPage = ({
|
|
|
112
127
|
label={t("paidSum")}
|
|
113
128
|
amount={paymentMetadata.paid || 0}
|
|
114
129
|
/>
|
|
130
|
+
<SummaryTotalBlock
|
|
131
|
+
label={t("remaining")}
|
|
132
|
+
amount={
|
|
133
|
+
totalAmount +
|
|
134
|
+
(bookingSummaryProps?.transactionFee || 0)
|
|
135
|
+
}
|
|
136
|
+
/>
|
|
137
|
+
</>
|
|
138
|
+
) : (
|
|
139
|
+
<>
|
|
140
|
+
{isCalculatedAmountGreaterThanOrderAmount && (
|
|
141
|
+
<SummaryTotalBlock
|
|
142
|
+
label={t("total")}
|
|
143
|
+
amount={
|
|
144
|
+
orderTotalAmounByFormValues +
|
|
145
|
+
(bookingSummaryProps?.transactionFee || 0)
|
|
146
|
+
}
|
|
147
|
+
/>
|
|
148
|
+
)}
|
|
149
|
+
|
|
150
|
+
<SummaryTotalBlock
|
|
151
|
+
label={t(
|
|
152
|
+
isCalculatedAmountGreaterThanOrderAmount
|
|
153
|
+
? "totalWithDiscount"
|
|
154
|
+
: "total"
|
|
155
|
+
)}
|
|
156
|
+
amount={
|
|
157
|
+
totalAmount +
|
|
158
|
+
(bookingSummaryProps?.transactionFee || 0)
|
|
159
|
+
}
|
|
160
|
+
/>
|
|
115
161
|
</>
|
|
116
162
|
)}
|
|
117
|
-
<SummaryTotalBlock
|
|
118
|
-
label={t(paymentMetadata ? "remaining" : "total")}
|
|
119
|
-
amount={
|
|
120
|
-
totalAmount + (bookingSummaryProps?.transactionFee || 0)
|
|
121
|
-
}
|
|
122
|
-
/>
|
|
123
163
|
</div>
|
|
124
164
|
</BookingSummaryFooter>
|
|
125
165
|
}
|
|
@@ -85,11 +85,14 @@ export function ProductsControl({
|
|
|
85
85
|
trigger,
|
|
86
86
|
setValue,
|
|
87
87
|
watch,
|
|
88
|
+
getValues,
|
|
88
89
|
} = form;
|
|
89
90
|
|
|
90
91
|
const productControlFieldName =
|
|
91
92
|
`steps.${stepIndex}.productCategories.${productCategoryIndex}.products` as const;
|
|
92
93
|
|
|
94
|
+
const productPointsKey = `steps.${stepIndex}.pointProducts` as const;
|
|
95
|
+
|
|
93
96
|
const { fields, append, remove, move } = useFieldArray({
|
|
94
97
|
name: productControlFieldName,
|
|
95
98
|
control,
|
|
@@ -156,6 +159,22 @@ export function ProductsControl({
|
|
|
156
159
|
});
|
|
157
160
|
};
|
|
158
161
|
|
|
162
|
+
const onProductRemove = (index: number) => {
|
|
163
|
+
const currentProduct = getValues(
|
|
164
|
+
`${productControlFieldName}.${index}` as const
|
|
165
|
+
);
|
|
166
|
+
|
|
167
|
+
const currentPointProducts = getValues(productPointsKey);
|
|
168
|
+
|
|
169
|
+
setValue(
|
|
170
|
+
productPointsKey,
|
|
171
|
+
currentPointProducts?.filter(
|
|
172
|
+
(product) => product.productUuid !== currentProduct.uuid
|
|
173
|
+
) || []
|
|
174
|
+
);
|
|
175
|
+
remove(index);
|
|
176
|
+
};
|
|
177
|
+
|
|
159
178
|
return (
|
|
160
179
|
<>
|
|
161
180
|
<SortableTree
|
|
@@ -219,7 +238,7 @@ export function ProductsControl({
|
|
|
219
238
|
categoryType={categoryType}
|
|
220
239
|
/>
|
|
221
240
|
}
|
|
222
|
-
onDelete={() =>
|
|
241
|
+
onDelete={() => onProductRemove(index)}
|
|
223
242
|
validate={() => trigger(`${productControlFieldName}.${index}`)}
|
|
224
243
|
// preItem={<Popover className="d-none d-sm-block" />}
|
|
225
244
|
>
|