@licklist/design 0.44.496 → 0.44.498

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.
@@ -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,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,gBAuHd,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,gBA2Jd,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"),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,F=Boolean(new URLSearchParams(x).get("isIframePayment")),b=function(){window.close()};return o.useEffect((function(){F&&B&&window.addEventListener("beforeunload",(function(){B()}))}),[]),o.useEffect((function(){C&&F&&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:F,onBackButtonClick:F?b:void 0,showCloseButton:F,onCloseButtonClick:F?b:void 0},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)+((null==S?void 0:S.transactionFee)||0)})))},a.createElement("h6",null,v("paymentDetails")),a.createElement(d.BookingSummary,t.__assign({},S)))}))};
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;AAE9D,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,gBAqF7B,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 c=require("../../order-process/components/BookingSummaryFooter/BookingSummaryFooter.js"),l=require("../../page/components/PageBody/PageBody.js");require("../../order-process/components/CalendarStepsForm/CalendarStepsForm.js");var u=require("../../page/Page.js"),p=require("./component/PaymentStatusBody.js"),d="failed",g="success",y="pending";exports.ORDER_STATUS_FAILED=d,exports.ORDER_STATUS_PENDING=y,exports.ORDER_STATUS_SUCCESS=g,exports.PaymentStatusPage=function(e){var o=e.onCloseWindow,S=e.onBack,B=e.onTryAgain,E=e.isLoading,k=e.status,P=e.isAppUsingInIframe,j=e.bookingSummaryProps,q=e.EventCardComponent,v=e.showCloseButton,T=void 0!==v&&v,f=e.email,C=e.totalAmount,F=void 0===C?0:C,h=e.paymentMetadata,_=n.useTranslation("Design").t,b=function(){switch(k){case g:return _("purchaseSuccessful");case y:return _("pendingPayment");default:return _("purchaseFailed")}}();return E?r.createElement(a.LoaderIndicator,{isLoaded:!1}):r.createElement(u.Page,{className:"payment-status-page",headerBlock:r.createElement(s.PaymentStatusHeader,{success:k!==d,showCloseButton:T,onCloseButtonClick:o,title:k===y?_("pendingPayment"):void 0}),isAppUsingInIframe:P},r.createElement(l.PageBody,{leftBlock:r.createElement(l.PageBody.LeftBlock,{title:b},r.createElement("div",null,q,r.createElement(p.PaymentStatusBody,{status:k,onBack:S||o,onTryAgain:B,email:f}))),rightBlock:r.createElement(l.PageBody.RightBlock,{bottomBlock:r.createElement(c.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:_(h?"remaining":"total"),amount:F+((null==j?void 0:j.transactionFee)||0)})))},j?r.createElement(i.BookingSummary,t.__assign({},j)):r.createElement("h6",null,b))}))};
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
- "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"),o=e(require("react-bootstrap/Row")),l=e(require("react-bootstrap/Col")),i=require("react-bootstrap"),c=require("../../static/Icon.js"),s=require("react-hook-form"),m=e(require("@licklist/plugins/dist/services/Form/HookFormService")),u=require("@react-aria/utils"),d=require("../../static/switch/BooleanSwitch.js"),E=require("../../static/form-number-input/FormNumberInput.js");require("../../static/index.js");var p=require("../form/context.js"),g=require("@licklist/core/dist/DataMapper/Product/ProductCategoryDataMapper"),f=require("./booking-management/ProductBookingManagementControl.js"),C=require("./deposit/ProductDepositControl.js"),v=require("./quantity/ProductQuantityControl.js"),b=require("./quantity/ProductQuantityConstantControl.js"),h=require("./quantity/ProductQuantityRechargingControl.js"),F=e(require("react-bootstrap/Collapse")),I=require("@licklist/plugins/dist/hooks/Media/useImages"),N=require("@licklist/core/dist/DataMapper/Media/ImageDataMapper"),P=require("../../file-upload/FileUpload.js"),q=require("../../tiptap-editor/TipTapEditor.js"),y=require("./fixed-duration-fields/FixedDurationOptions.js"),k=require("./duration/ProductDurationControl.js"),x=require("./price/ProductPriceControl.js");exports.ProductControl=function(e){var T=e.isLoading,_=void 0!==T&&T,L=e.fieldNamePrefix,j=e.allowDeposits,w=void 0!==j&&j,S=e.hasBookingManagement,A=void 0!==S&&S,D=e.zoneList,G=void 0===D?[]:D,B=e.onCopy,M=e.onProductNameChange,R=e.productName,O=e.hasTicket,U=e.categoryType,Y=s.useFormContext(),Q=Y.register,V=Y.control,H=Y.formState.errors,z=Y.setValue,X=Y.getValues,W=Y.watch,J=a.useContext(p.ProductSetLoadingContext),K=J.setLoading,Z=J.providerHasBookingManagement,$=r.useTranslation("Design").t,ee=t.__read(a.useState(!1),2),te=ee[0],ae=ee[1],ne=t.__read(a.useState(null),2),re=ne[0],oe=ne[1],le=Boolean(W("".concat(L,".isUnlimited"))),ie=u.useId(),ce=u.useId(),se=u.useId(),me=u.useId(),ue=u.useId(),de=u.useId(),Ee=u.useId(),pe=u.useId(),ge=u.useId(),fe=u.useId(),Ce=[{id:1,value:$("quantitySelector")},{id:2,value:$("stockControl")}],ve=a.useCallback((function(){return ae((function(e){return!e}))}),[]),be=s.useWatch({control:V,name:"".concat(L,".quantitySelector")}),he=I.useImages(re),Fe=he.images,Ie=he.handleImageRemove,Ne=he.handleImageUploading,Pe=he.isLoading,qe=a.useCallback((function(e){Ne(e,N.IMAGE_TYPE_IMAGE)}),[Ne]),ye=a.useCallback((function(e,t){Ie(e,t)}),[Ie]),ke=function(e){return e.target.select()};a.useEffect((function(){K(Pe)}),[K,Pe]),a.useEffect((function(){Array.isArray(Fe)&&(null==Fe?void 0:Fe.length)>0&&z("".concat(L,".images"),Fe)}),[Fe,L,z]),a.useEffect((function(){var e=X("".concat(L,".images"));oe(e)}),[X,oe,L]);var xe=null!=be?be:"1",Te=g.QUANTITY_TYPE_LIST_DTO[xe];return n.createElement(n.Fragment,null,n.createElement(o,null,n.createElement(l,{lg:8,md:8},n.createElement(i.Form.Group,{controlId:ce},n.createElement(i.Form.Label,null,$("name")),n.createElement(i.Form.Control,t.__assign({},Q("".concat(L,".name")),{value:R,onChange:M,isInvalid:m.isInvalid("".concat(L,".name"),H),disabled:_,placeholder:$("name")})),n.createElement(i.Form.Control.Feedback,{type:"invalid"},m.getErrors("".concat(L,".name"),H))),n.createElement(i.Form.Group,{controlId:se},n.createElement(i.Form.Label,null,$("description")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange;return n.createElement(q.TipTapEditor,{withEmoji:!1,viewMode:!1,onUpdate:r,content:a,disabled:_})},control:V,name:"".concat(L,".description")}),n.createElement(i.Form.Control.Feedback,{type:"invalid"},m.getErrors("".concat(L,".description"),H))),w?n.createElement(o,null,n.createElement(C.ProductDepositControl,{isLoading:_,fieldNamePrefix:L}),n.createElement(x.ProductPriceControl,{isLoading:_,fieldNamePrefix:L,title:$("totalPrice"),allowDeposits:w})):n.createElement(x.ProductPriceControl,{isLoading:_,fieldNamePrefix:L}),n.createElement("div",null,n.createElement(v.ProductQuantityControl,{isLoading:_,fieldNamePrefix:L,onFocus:ke}),Te===g.QUANTITY_TYPE_CONSTANT&&n.createElement(b.ProductQuantityConstantControl,{isLoading:_,fieldNamePrefix:L,onFocus:ke,disabled:le}),Te===g.QUANTITY_TYPE_RECHARGING&&n.createElement(h.ProductQuantityRechargingControl,{isLoading:_,fieldNamePrefix:L,onFocus:ke,disabled:le}),n.createElement(i.Form.Group,{controlId:fe,className:"custom-checkbox"},n.createElement(i.Form.Check,t.__assign({custom:!0,type:"checkbox"},Q("".concat(L,".isUnlimited")),{name:"".concat(L,".isUnlimited"),disabled:_})),n.createElement(i.Form.Check.Label,null,$("isUnlimited")))),n.createElement(i.Form.Group,{controlId:pe},n.createElement(i.Form.Label,null,$("quantitySelectorType")),n.createElement(i.Form.Control,t.__assign({as:"select",defaultValue:O?Ce[0].id:void 0},Q("".concat(L,".quantitySelector")),{isInvalid:m.isInvalid("".concat(L,".quantitySelector"),H),disabled:_||O}),Ce.map((function(e){return n.createElement("option",{value:e.id,key:e.id},e.value)}))),n.createElement(i.Form.Control.Feedback,{type:"invalid"},m.getErrors("".concat(L,".quantitySelector"),H))))),U===g.CATEGORY_TYPE_FIXED_DURATION&&n.createElement(o,{className:"align-items-start"},n.createElement(k.ProductDurationControl,{fieldNamePrefix:L,providerHasBookingManagement:Z}),n.createElement(l,{lg:4,md:4},n.createElement(E.FormNumberInput,{fieldName:"".concat(L,".capacity"),label:$("capacity")}))),U===g.CATEGORY_TYPE_GAME&&n.createElement(o,{className:"align-items-start"},n.createElement(l,{lg:4,md:4},n.createElement(E.FormNumberInput,{fieldName:"".concat(L,".capacity"),label:$("capacity"),rules:{min:{value:1,message:$("Validation:fieldRequired",{attribute:$("capacity")})}}})),n.createElement(l,{lg:4,md:4},n.createElement(E.FormNumberInput,{fieldName:"".concat(L,".duration"),label:$("durationMinutes"),rules:{min:{value:1,message:$("Validation:fieldRequired",{attribute:$("duration")})}}}))),n.createElement(o,null,n.createElement(l,{lg:8,md:8},n.createElement(i.Form.Group,{controlId:me},n.createElement(i.Form.Label,null,$("productTermsConditions")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name,l=t.ref;return n.createElement(i.Form.Control,{ref:l,as:"textarea",rows:3,value:a,onChange:r,isInvalid:m.isInvalid("".concat(L,".termsAndConditions"),H),disabled:_,name:o})},control:V,name:"".concat(L,".termsAndConditions")}),n.createElement(i.Form.Control.Feedback,{type:"invalid"},m.getErrors("".concat(L,".termsAndConditions"),H)))),n.createElement(l,{lg:4,md:4,className:"licklist-file-upload-wrapper"},n.createElement(P.FileUpload,{onFilesChange:qe,allowedExtensions:["jpeg","jpg","png"],subTitle:".jpeg .jpg .png",enablePreview:!0,onFileRemove:ye,defaultFiles:Fe,isLoading:Pe,withIcon:!0,title:$("addImage")}))),n.createElement(l,{lg:12,md:12,xl:!0,className:"p-0"},n.createElement(i.Form.Group,{controlId:ue,className:"advanced-switch-container"},n.createElement(i.Form.Label,null,$("isAvailable")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(d.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:_})},control:V,name:"".concat(L,".isAvailable")})),n.createElement(i.Form.Group,{controlId:de,className:"advanced-switch-container"},n.createElement(i.Form.Label,null,$("isSoldOut")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(d.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:_})},control:V,name:"".concat(L,".isSoldOut")})),n.createElement(i.Form.Group,{controlId:ie,className:"custom-checkbox"},n.createElement(i.Form.Check,{custom:!0,type:"checkbox",name:ie,disabled:_},n.createElement(i.Form.Check.Input,{checked:te,onChange:ve,type:"checkbox"}),n.createElement(i.Form.Check.Label,null,$("showAdvancedOptions"))))),n.createElement(l,{lg:12,md:12,xl:!0,className:"p-0"},n.createElement(F,{in:te},n.createElement("div",null,n.createElement(i.Form.Group,{controlId:Ee,className:"advanced-switch-container"},n.createElement(i.Form.Label,null,$("isRequired")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(d.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:_})},control:V,name:"".concat(L,".isRequired")})),n.createElement(i.Form.Group,{controlId:ge,className:"advanced-switch-container"},n.createElement(i.Form.Label,null,$("hasSpecialNotes")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(d.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:_})},control:V,name:"".concat(L,".hasSpecialNotes")})),U===g.CATEGORY_TYPE_FIXED_DURATION&&n.createElement(y.FixedDurationOptions,{fieldNamePrefix:L}))),n.createElement(o,null,n.createElement(l,{xs:12},A&&n.createElement(f.ProductBookingManagementControl,{isLoading:_,zoneList:G,fieldNamePrefix:L})))),n.createElement(o,null,n.createElement(l,{xs:!0},n.createElement("div",{className:"d-flex justify-content-end mt-4"},Boolean(B)&&n.createElement(i.Button,{onClick:B,variant:"link",className:"d-flex align-items-center"},n.createElement(c.default,{type:"clipboard",height:"1rem",className:"mr-2"})," ",$("copy"))))))};
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"),o=e(require("react-bootstrap/Row")),l=e(require("react-bootstrap/Col")),i=require("react-bootstrap"),c=require("../../static/Icon.js"),s=require("react-hook-form"),m=e(require("@licklist/plugins/dist/services/Form/HookFormService")),u=require("@react-aria/utils"),d=require("../../static/switch/BooleanSwitch.js"),E=require("../../static/form-number-input/FormNumberInput.js");require("../../static/index.js");var p=require("../form/context.js"),g=require("@licklist/core/dist/DataMapper/Product/ProductCategoryDataMapper"),f=require("./booking-management/ProductBookingManagementControl.js"),C=require("./deposit/ProductDepositControl.js"),v=require("./quantity/ProductQuantityControl.js"),b=require("./quantity/ProductQuantityConstantControl.js"),h=require("./quantity/ProductQuantityRechargingControl.js"),F=e(require("react-bootstrap/Collapse")),I=require("@licklist/plugins/dist/hooks/Media/useImages"),N=require("@licklist/core/dist/DataMapper/Media/ImageDataMapper"),P=require("../../file-upload/FileUpload.js"),q=require("../../tiptap-editor/TipTapEditor.js"),y=require("./fixed-duration-fields/FixedDurationOptions.js"),k=require("./duration/ProductDurationControl.js"),x=require("./price/ProductPriceControl.js");exports.ProductControl=function(e){var T=e.isLoading,_=void 0!==T&&T,L=e.fieldNamePrefix,j=e.allowDeposits,S=void 0!==j&&j,w=e.hasBookingManagement,A=void 0!==w&&w,D=e.zoneList,G=void 0===D?[]:D,B=e.onCopy,M=e.onProductNameChange,R=e.productName,O=e.hasTicket,U=e.categoryType,Y=s.useFormContext(),Q=Y.register,V=Y.control,H=Y.formState.errors,z=Y.setValue,X=Y.getValues,W=Y.watch,J=a.useContext(p.ProductSetLoadingContext),K=J.setLoading,Z=J.providerHasBookingManagement,$=r.useTranslation("Design").t,ee=t.__read(a.useState(!1),2),te=ee[0],ae=ee[1],ne=t.__read(a.useState(null),2),re=ne[0],oe=ne[1],le=Boolean(W("".concat(L,".isUnlimited"))),ie=u.useId(),ce=u.useId(),se=u.useId(),me=u.useId(),ue=u.useId(),de=u.useId(),Ee=u.useId(),pe=u.useId(),ge=u.useId(),fe=u.useId(),Ce=[{id:1,value:$("quantitySelector")},{id:2,value:$("stockControl")}],ve=a.useCallback((function(){return ae((function(e){return!e}))}),[]),be=s.useWatch({control:V,name:"".concat(L,".quantitySelector")}),he=I.useImages(re),Fe=he.images,Ie=he.handleImageRemove,Ne=he.handleImageUploading,Pe=he.isLoading,qe=a.useCallback((function(e){Ne(e,N.IMAGE_TYPE_IMAGE)}),[Ne]),ye=a.useCallback((function(e,t){Ie(String(e),t)}),[Ie]),ke=function(e){return e.target.select()};a.useEffect((function(){K(Pe)}),[K,Pe]),a.useEffect((function(){var e=X("".concat(L,".images"));oe(e)}),[X,oe,L]),a.useEffect((function(){Array.isArray(Fe)&&z("".concat(L,".images"),Fe)}),[Fe,L,z]);var xe=null!=be?be:"1",Te=g.QUANTITY_TYPE_LIST_DTO[xe];return n.createElement(n.Fragment,null,n.createElement(o,null,n.createElement(l,{lg:8,md:8},n.createElement(i.Form.Group,{controlId:ce},n.createElement(i.Form.Label,null,$("name")),n.createElement(i.Form.Control,t.__assign({},Q("".concat(L,".name")),{value:R,onChange:M,isInvalid:m.isInvalid("".concat(L,".name"),H),disabled:_,placeholder:$("name")})),n.createElement(i.Form.Control.Feedback,{type:"invalid"},m.getErrors("".concat(L,".name"),H))),n.createElement(i.Form.Group,{controlId:se},n.createElement(i.Form.Label,null,$("description")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange;return n.createElement(q.TipTapEditor,{withEmoji:!1,viewMode:!1,onUpdate:r,content:a,disabled:_})},control:V,name:"".concat(L,".description")}),n.createElement(i.Form.Control.Feedback,{type:"invalid"},m.getErrors("".concat(L,".description"),H))),S?n.createElement(o,null,n.createElement(C.ProductDepositControl,{isLoading:_,fieldNamePrefix:L}),n.createElement(x.ProductPriceControl,{isLoading:_,fieldNamePrefix:L,title:$("totalPrice"),allowDeposits:S})):n.createElement(x.ProductPriceControl,{isLoading:_,fieldNamePrefix:L}),n.createElement("div",null,n.createElement(v.ProductQuantityControl,{isLoading:_,fieldNamePrefix:L,onFocus:ke}),Te===g.QUANTITY_TYPE_CONSTANT&&n.createElement(b.ProductQuantityConstantControl,{isLoading:_,fieldNamePrefix:L,onFocus:ke,disabled:le}),Te===g.QUANTITY_TYPE_RECHARGING&&n.createElement(h.ProductQuantityRechargingControl,{isLoading:_,fieldNamePrefix:L,onFocus:ke,disabled:le}),n.createElement(i.Form.Group,{controlId:fe,className:"custom-checkbox"},n.createElement(i.Form.Check,t.__assign({custom:!0,type:"checkbox"},Q("".concat(L,".isUnlimited")),{name:"".concat(L,".isUnlimited"),disabled:_})),n.createElement(i.Form.Check.Label,null,$("isUnlimited")))),n.createElement(i.Form.Group,{controlId:pe},n.createElement(i.Form.Label,null,$("quantitySelectorType")),n.createElement(i.Form.Control,t.__assign({as:"select",defaultValue:O?Ce[0].id:void 0},Q("".concat(L,".quantitySelector")),{isInvalid:m.isInvalid("".concat(L,".quantitySelector"),H),disabled:_||O}),Ce.map((function(e){return n.createElement("option",{value:e.id,key:e.id},e.value)}))),n.createElement(i.Form.Control.Feedback,{type:"invalid"},m.getErrors("".concat(L,".quantitySelector"),H))))),U===g.CATEGORY_TYPE_FIXED_DURATION&&n.createElement(o,{className:"align-items-start"},n.createElement(k.ProductDurationControl,{fieldNamePrefix:L,providerHasBookingManagement:Z}),n.createElement(l,{lg:4,md:4},n.createElement(E.FormNumberInput,{fieldName:"".concat(L,".capacity"),label:$("capacity")}))),U===g.CATEGORY_TYPE_GAME&&n.createElement(o,{className:"align-items-start"},n.createElement(l,{lg:4,md:4},n.createElement(E.FormNumberInput,{fieldName:"".concat(L,".capacity"),label:$("capacity"),rules:{min:{value:1,message:$("Validation:fieldRequired",{attribute:$("capacity")})}}})),n.createElement(l,{lg:4,md:4},n.createElement(E.FormNumberInput,{fieldName:"".concat(L,".duration"),label:$("durationMinutes"),rules:{min:{value:1,message:$("Validation:fieldRequired",{attribute:$("duration")})}}}))),n.createElement(o,null,n.createElement(l,{lg:8,md:8},n.createElement(i.Form.Group,{controlId:me},n.createElement(i.Form.Label,null,$("productTermsConditions")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name,l=t.ref;return n.createElement(i.Form.Control,{ref:l,as:"textarea",rows:3,value:a,onChange:r,isInvalid:m.isInvalid("".concat(L,".termsAndConditions"),H),disabled:_,name:o})},control:V,name:"".concat(L,".termsAndConditions")}),n.createElement(i.Form.Control.Feedback,{type:"invalid"},m.getErrors("".concat(L,".termsAndConditions"),H)))),n.createElement(l,{lg:4,md:4,className:"licklist-file-upload-wrapper"},n.createElement(P.FileUpload,{onFilesChange:qe,allowedExtensions:["jpeg","jpg","png"],subTitle:".jpeg .jpg .png",enablePreview:!0,onFileRemove:ye,defaultFiles:Fe,isLoading:Pe,withIcon:!0,title:$("addImage")}))),n.createElement(l,{lg:12,md:12,xl:!0,className:"p-0"},n.createElement(i.Form.Group,{controlId:ue,className:"advanced-switch-container"},n.createElement(i.Form.Label,null,$("isAvailable")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(d.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:_})},control:V,name:"".concat(L,".isAvailable")})),n.createElement(i.Form.Group,{controlId:de,className:"advanced-switch-container"},n.createElement(i.Form.Label,null,$("isSoldOut")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(d.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:_})},control:V,name:"".concat(L,".isSoldOut")})),n.createElement(i.Form.Group,{controlId:ie,className:"custom-checkbox"},n.createElement(i.Form.Check,{custom:!0,type:"checkbox",name:ie,disabled:_},n.createElement(i.Form.Check.Input,{checked:te,onChange:ve,type:"checkbox"}),n.createElement(i.Form.Check.Label,null,$("showAdvancedOptions"))))),n.createElement(l,{lg:12,md:12,xl:!0,className:"p-0"},n.createElement(F,{in:te},n.createElement("div",null,n.createElement(i.Form.Group,{controlId:Ee,className:"advanced-switch-container"},n.createElement(i.Form.Label,null,$("isRequired")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(d.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:_})},control:V,name:"".concat(L,".isRequired")})),n.createElement(i.Form.Group,{controlId:ge,className:"advanced-switch-container"},n.createElement(i.Form.Label,null,$("hasSpecialNotes")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(d.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:_})},control:V,name:"".concat(L,".hasSpecialNotes")})),U===g.CATEGORY_TYPE_FIXED_DURATION&&n.createElement(y.FixedDurationOptions,{fieldNamePrefix:L}))),n.createElement(o,null,n.createElement(l,{xs:12},A&&n.createElement(f.ProductBookingManagementControl,{isLoading:_,zoneList:G,fieldNamePrefix:L})))),n.createElement(o,null,n.createElement(l,{xs:!0},n.createElement("div",{className:"d-flex justify-content-end mt-4"},Boolean(B)&&n.createElement(i.Button,{onClick:B,variant:"link",className:"d-flex align-items-center"},n.createElement(c.default,{type:"clipboard",height:"1rem",className:"mr-2"})," ",$("copy"))))))};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@licklist/design",
3
- "version": "0.44.496",
3
+ "version": "0.44.498",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+ssh://git@bitbucket.org/artelogicsoft/licklist_design.git"
@@ -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"
@@ -128,7 +140,7 @@ export const PaymentPage = ({
128
140
  bottomBlock={
129
141
  <BookingSummaryFooter showButton={false}>
130
142
  <div className="d-flex flex-column justify-content-between">
131
- {paymentMetadata && (
143
+ {paymentMetadata ? (
132
144
  <>
133
145
  <SummaryTotalBlock
134
146
  label={t("total")}
@@ -138,14 +150,39 @@ export const PaymentPage = ({
138
150
  label={t("paidSum")}
139
151
  amount={paymentMetadata.paid || 0}
140
152
  />
153
+ <SummaryTotalBlock
154
+ label={t("remaining")}
155
+ amount={
156
+ data?.amount +
157
+ (bookingSummaryProps?.transactionFee || 0)
158
+ }
159
+ />
160
+ </>
161
+ ) : (
162
+ <>
163
+ {isCalculatedAmountGreaterThanOrderAmount && (
164
+ <SummaryTotalBlock
165
+ label={t("total")}
166
+ amount={
167
+ orderTotalAmounByFormValues +
168
+ (bookingSummaryProps?.transactionFee || 0)
169
+ }
170
+ />
171
+ )}
172
+
173
+ <SummaryTotalBlock
174
+ label={t(
175
+ isCalculatedAmountGreaterThanOrderAmount
176
+ ? "totalWithDiscount"
177
+ : "total"
178
+ )}
179
+ amount={
180
+ data?.amount +
181
+ (bookingSummaryProps?.transactionFee || 0)
182
+ }
183
+ />
141
184
  </>
142
185
  )}
143
- <SummaryTotalBlock
144
- label={t(paymentMetadata ? "remaining" : "total")}
145
- amount={
146
- data?.amount + (bookingSummaryProps?.transactionFee || 0)
147
- }
148
- />
149
186
  </div>
150
187
  </BookingSummaryFooter>
151
188
  }
@@ -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
  }
@@ -189,7 +189,7 @@ export function ProductControl<T extends FormValues>({
189
189
 
190
190
  const onImageRemove = useCallback(
191
191
  (id, path) => {
192
- handleImageRemove(id, path);
192
+ handleImageRemove(String(id), path);
193
193
  },
194
194
  [handleImageRemove]
195
195
  );
@@ -200,7 +200,13 @@ export function ProductControl<T extends FormValues>({
200
200
  }, [setLoading, isImageUploading]);
201
201
 
202
202
  useEffect(() => {
203
- if (Array.isArray(images) && images?.length > 0) {
203
+ const formImages = getValues(`${fieldNamePrefix}.images` as Path<T>);
204
+
205
+ setInitialImages(formImages as Image[]);
206
+ }, [getValues, setInitialImages, fieldNamePrefix]);
207
+
208
+ useEffect(() => {
209
+ if (Array.isArray(images)) {
204
210
  setValue(
205
211
  `${fieldNamePrefix}.images` as Path<T>,
206
212
  images as UnpackNestedValue<PathValue<T, Path<T>>>
@@ -208,12 +214,6 @@ export function ProductControl<T extends FormValues>({
208
214
  }
209
215
  }, [images, fieldNamePrefix, setValue]);
210
216
 
211
- useEffect(() => {
212
- const formImages = getValues(`${fieldNamePrefix}.images` as Path<T>);
213
-
214
- setInitialImages(formImages as Image[]);
215
- }, [getValues, setInitialImages, fieldNamePrefix]);
216
-
217
217
  const quantitySelector = quantityValue ?? "1";
218
218
  const quantity = QUANTITY_TYPE_LIST_DTO[quantitySelector as string];
219
219