@licklist/design 0.44.485-dev.21 → 0.44.485-dev.23
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/BookingSummary/utils/index.d.ts +1 -1
- package/dist/iframe/order-process/components/BookingSummary/utils/index.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/utils/index.js +1 -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/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/StepsControl.d.ts.map +1 -1
- package/dist/product-set/form/StepsControl.js +1 -1
- package/package.json +1 -1
- package/src/iframe/order-process/components/BookingSummary/utils/index.ts +6 -2
- package/src/iframe/payment/payment-page/PaymentPage.tsx +4 -3
- package/src/iframe/payment/payment-status-page/PaymentStatusPage.tsx +4 -3
- package/src/product-set/form/StepsControl.tsx +20 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/order-process/components/BookingSummary/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAE7C,eAAO,MAAM,sBAAsB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/order-process/components/BookingSummary/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAE7C,eAAO,MAAM,sBAAsB,mBAAoB,KAAK,EAAE,WAS7D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.cartSumByOrderProducts=function(e){return e.reduce((function(e,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.cartSumByOrderProducts=function(e){return e&&e.length?e.reduce((function(e,t){return e+((null==t?void 0:t.deposit)||(null==t?void 0:t.price))*t.quantity}),0):0};
|
|
@@ -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;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,
|
|
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"),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"]),
|
|
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"]),b=l.useTranslation("Design").t,x=r.useLocation().search,F=o.useContext(s.PaymentSessionContext).isPaymentSessionExpired,C=Boolean(new URLSearchParams(x).get("isIframePayment")),h=function(){window.close()};if(o.useEffect((function(){C&&k&&window.addEventListener("beforeunload",(function(){k()}))}),[]),o.useEffect((function(){F&&C&&P&&P()}),[F]),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,b("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/"}},b("backToSite")))))}));var w=d.cartSumByOrderProducts(v&&(null==v?void 0:v.formValues)?Object.values(null==v?void 0:v.formValues):void 0),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"},b("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:b("total"),amount:j.total||0}),a.createElement(c.SummaryTotalBlock,{label:b("paidSum"),amount:j.paid||0}),a.createElement(c.SummaryTotalBlock,{label:b("remaining"),amount:j.total-j.paid||0})):a.createElement(a.Fragment,null,T&&a.createElement(c.SummaryTotalBlock,{label:b("total"),amount:w+((null==v?void 0:v.transactionFee)||0)}),a.createElement(c.SummaryTotalBlock,{label:b(T?"totalWithDiscount":"total"),amount:(null==E?void 0:E.amount)+((null==v?void 0:v.transactionFee)||0)}))))},a.createElement("h6",null,b("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;AAG9D,eAAO,MAAM,mBAAmB,WAAW,CAAC;AAC5C,eAAO,MAAM,oBAAoB,YAAY,CAAC;AAC9C,eAAO,MAAM,oBAAoB,YAAY,CAAC;AAE9C,MAAM,MAAM,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,
|
|
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,MAAM,MAAM,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,gBA6H7B,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"),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:
|
|
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(j&&(null==j?void 0:j.formValues)?Object.values(null==j?void 0:j.formValues):void 0),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:h.total-h.paid||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":"StepsControl.d.ts","sourceRoot":"","sources":["../../../src/product-set/form/StepsControl.tsx"],"names":[],"mappings":";AAgBA,UAAU,iBAAiB;IACzB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,YAAY,CAAC,EAAE,SAAS,EAAE,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"StepsControl.d.ts","sourceRoot":"","sources":["../../../src/product-set/form/StepsControl.tsx"],"names":[],"mappings":";AAgBA,UAAU,iBAAiB;IACzB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,YAAY,CAAC,EAAE,SAAS,EAAE,EAAE,iBAAiB,eAkI5D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),r=require("react"),
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),r=require("react"),o=e(r),a=require("react-i18next"),n=require("react-hook-form"),s=e(require("@licklist/plugins/dist/services/Form/HookFormService")),i=require("../../sortable-tree/SortableTreeItem.js"),l=require("../../sortable-tree/SortableTree.js"),d=e(require("react-bootstrap/Badge")),u=require("../item/CreateProductSetItem.js"),c=require("../step/StepControl.js"),m=require("./ProductCategoriesControl.js");exports.StepsControl=function(e){var p=e.isLoading,v=n.useFormContext(),g=a.useTranslation("Design").t,f=t.__read(r.useState(!1),2),C=f[0],b=f[1],S=v.control,E=v.formState,q=E.errors,I=E.isSubmitting,N=v.clearErrors,h=v.getValues,y=v.setFocus,j=n.useFieldArray({name:"steps",control:S,keyName:"_id"}),x=j.fields,P=j.append,_=j.remove;r.useEffect((function(){I&&b(!I)}),[I]);var k=1===x.length;return o.createElement(o.Fragment,null,x.map((function(e,t){var r="steps.".concat(t),a=h(r);return o.createElement(n.Controller,{key:"step-".concat(e._id),name:"".concat(r,".name"),control:S,rules:{required:g("Validation:fieldRequired",{attribute:g("name")})},render:function(n){var s,u,v=n.field,f=v.value,b=v.onChange;return o.createElement(l.SortableTree.Item,{id:e._id,title:f,badge:o.createElement(d,{className:"step-badge"},g("step")),isExpanded:k,isInvalid:!!(null===(s=q.steps)||void 0===s?void 0:s[t]),isIconInHeader:!1,modalLabel:g("addNewStep"),modalClass:i.ProductSetModalClasses.step,isNewAdded:C,subTitle:o.createElement("div",{className:"product-set-badges-container"},o.createElement("div",{className:"product-set-subtitle-dot product-set-subtitle-step-dot"}),o.createElement("span",null,null===(u=a.productCategories)||void 0===u?void 0:u.length," ",g("categories"))),treeLineIconColor:"#D52902",body:o.createElement(c.StepControl,{isLoading:p,stepIndex:t,stepName:f,onStepNameChange:b}),onDelete:function(){return _(t)},sortableItems:e.productCategories?e.productCategories.map((function(e){var t=e.id;return String(t)})):[],validate:function(){var e,o,a=null===(o=null===(e=q.steps)||void 0===e?void 0:e[t])||void 0===o?void 0:o.name;return a&&y("".concat(r,".name")),Promise.resolve(!a)}},o.createElement(m.ProductCategoriesControl,{isLoading:p,stepIndex:t}))}})})),o.createElement(u.CreateProductSetItem,{title:g("addStep"),onClick:function(){var e;P({id:null,name:"".concat(g("step")," ").concat(x.length+1),productCategories:[],weight:0,hasMap:!1,venueMapSetId:null}),b(!0),(null===(e=q.steps)||void 0===e?void 0:e.type)===s.manualErrorType&&N("steps")}}),o.createElement("div",{className:"manual-form-error"},q.steps&&q.steps.message))};
|
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { Order } from "../../../../../types";
|
|
2
2
|
|
|
3
|
-
export const cartSumByOrderProducts = (orderProducts
|
|
4
|
-
orderProducts
|
|
3
|
+
export const cartSumByOrderProducts = (orderProducts?: Order[]) => {
|
|
4
|
+
if (!orderProducts || !orderProducts.length) {
|
|
5
|
+
return 0;
|
|
6
|
+
}
|
|
7
|
+
return orderProducts.reduce((prevSumValue: number, product) => {
|
|
5
8
|
return (
|
|
6
9
|
prevSumValue + (product?.deposit || product?.price) * product.quantity
|
|
7
10
|
);
|
|
8
11
|
}, 0);
|
|
12
|
+
};
|
|
@@ -101,7 +101,9 @@ export const PaymentPage = ({
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
const orderTotalAmounByFormValues = cartSumByOrderProducts(
|
|
104
|
-
|
|
104
|
+
bookingSummaryProps && bookingSummaryProps?.formValues
|
|
105
|
+
? Object.values(bookingSummaryProps?.formValues)
|
|
106
|
+
: undefined
|
|
105
107
|
);
|
|
106
108
|
|
|
107
109
|
// User can fill promocode only in iframe appcliation.
|
|
@@ -152,8 +154,7 @@ export const PaymentPage = ({
|
|
|
152
154
|
<SummaryTotalBlock
|
|
153
155
|
label={t("remaining")}
|
|
154
156
|
amount={
|
|
155
|
-
|
|
156
|
-
(bookingSummaryProps?.transactionFee || 0)
|
|
157
|
+
paymentMetadata.total - paymentMetadata.paid || 0
|
|
157
158
|
}
|
|
158
159
|
/>
|
|
159
160
|
</>
|
|
@@ -71,7 +71,9 @@ export const PaymentStatusPage = ({
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
const orderTotalAmounByFormValues = cartSumByOrderProducts(
|
|
74
|
-
|
|
74
|
+
bookingSummaryProps && bookingSummaryProps?.formValues
|
|
75
|
+
? Object.values(bookingSummaryProps?.formValues)
|
|
76
|
+
: undefined
|
|
75
77
|
);
|
|
76
78
|
|
|
77
79
|
// User can fill promocode only in iframe appcliation.
|
|
@@ -130,8 +132,7 @@ export const PaymentStatusPage = ({
|
|
|
130
132
|
<SummaryTotalBlock
|
|
131
133
|
label={t("remaining")}
|
|
132
134
|
amount={
|
|
133
|
-
|
|
134
|
-
(bookingSummaryProps?.transactionFee || 0)
|
|
135
|
+
paymentMetadata.total - paymentMetadata.paid || 0
|
|
135
136
|
}
|
|
136
137
|
/>
|
|
137
138
|
</>
|
|
@@ -28,6 +28,7 @@ export function StepsControl({ isLoading }: StepsControlProps) {
|
|
|
28
28
|
formState: { errors, isSubmitting },
|
|
29
29
|
clearErrors,
|
|
30
30
|
getValues,
|
|
31
|
+
setFocus,
|
|
31
32
|
} = form;
|
|
32
33
|
|
|
33
34
|
const { fields, append, remove } = useFieldArray({
|
|
@@ -57,12 +58,14 @@ export function StepsControl({ isLoading }: StepsControlProps) {
|
|
|
57
58
|
return (
|
|
58
59
|
<>
|
|
59
60
|
{fields.map((step, index) => {
|
|
60
|
-
const
|
|
61
|
+
const stepFieldName = `steps.${index}` as const;
|
|
62
|
+
|
|
63
|
+
const stepData = getValues(stepFieldName);
|
|
61
64
|
|
|
62
65
|
return (
|
|
63
66
|
<Controller
|
|
64
67
|
key={`step-${step._id}`}
|
|
65
|
-
name={
|
|
68
|
+
name={`${stepFieldName}.name` as const}
|
|
66
69
|
control={control}
|
|
67
70
|
rules={{
|
|
68
71
|
required: t("Validation:fieldRequired", {
|
|
@@ -104,6 +107,21 @@ export function StepsControl({ isLoading }: StepsControlProps) {
|
|
|
104
107
|
? step.productCategories.map(({ id }) => String(id))
|
|
105
108
|
: []
|
|
106
109
|
}
|
|
110
|
+
validate={() => {
|
|
111
|
+
// @TODO investigate why form return true in case
|
|
112
|
+
// when required field not filled. Looks like
|
|
113
|
+
// we cann't use default hookForm trigger function
|
|
114
|
+
// because we have venueMap outside this form.
|
|
115
|
+
// So before closing we need to check directly by
|
|
116
|
+
// error on name field. Instead of run trugger.
|
|
117
|
+
const error = errors.steps?.[index]?.name;
|
|
118
|
+
|
|
119
|
+
if (error) {
|
|
120
|
+
setFocus(`${stepFieldName}.name` as const);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return Promise.resolve(!error);
|
|
124
|
+
}}
|
|
107
125
|
>
|
|
108
126
|
<ProductCategoriesControl
|
|
109
127
|
isLoading={isLoading}
|