umwd-components 0.1.450 → 0.1.452
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/src/components/e-commerce/checkout/CheckoutForm.js +1 -1
- package/dist/src/components/e-commerce/checkout/Step3.js +1 -1
- package/dist/src/components/e-commerce/checkout/Step4.js +1 -1
- package/dist/src/components/e-commerce/invoice/InvoicePDF.js +1 -1
- package/dist/src/context/e-commerce/checkout/CheckoutContext.js +1 -1
- package/dist/src/data/actions/e-commerce/checkout-action.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/components/e-commerce/checkout/Step3.d.ts +2 -1
- package/dist/types/components/e-commerce/checkout/Step4.d.ts +4 -1
- package/dist/types/context/e-commerce/checkout/CheckoutContext.d.ts +1 -0
- package/dist/types/types/e-commerce/checkout/types.d.ts +6 -0
- package/dist/types/types/e-commerce/invoice/types.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/e-commerce/checkout/CheckoutForm.tsx +9 -3
- package/src/components/e-commerce/checkout/Step3.tsx +5 -0
- package/src/components/e-commerce/checkout/Step4.tsx +12 -2
- package/src/components/e-commerce/invoice/InvoicePDF.tsx +2 -2
- package/src/context/e-commerce/checkout/CheckoutContext.tsx +22 -0
- package/src/data/actions/e-commerce/checkout-action.ts +3 -0
- package/src/types/e-commerce/checkout/types.ts +5 -0
- package/src/types/e-commerce/invoice/types.ts +1 -1
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{extends as e}from"../../../../_virtual/_rollupPluginBabelHelpers.js";import{__read as t}from"../../../../node_modules/tslib/tslib.es6.js";import r from"@mui/material/Typography";import n from"@mui/material/Container";import a from"@mui/material/Stack";import l from"@mui/material/Grid";import i from"@mui/material/Paper";import o from"@mui/material/Box";import m from"@mui/material/Button";import c from"@mui/material/Stepper";import s from"@mui/material/Step";import p from"@mui/material/StepLabel";import u from"@mui/material/MobileStepper";import d from"@mui/material/Alert";import f from"@mui/material/useMediaQuery";import{useTheme as E}from"@mui/material/styles";import x,{useState as g,useEffect as b}from"react";import v from"next/link";import{useSearchParams as h}from"next/navigation";import{useSession as k}from"../../../context/auth/SessionContext.js";import y from"@mui/icons-material/KeyboardArrowLeft";import B from"@mui/icons-material/KeyboardArrowRight";import C from"./Step1.js";import S from"./Step2.js";import
|
|
7
|
+
import{extends as e}from"../../../../_virtual/_rollupPluginBabelHelpers.js";import{__read as t}from"../../../../node_modules/tslib/tslib.es6.js";import r from"@mui/material/Typography";import n from"@mui/material/Container";import a from"@mui/material/Stack";import l from"@mui/material/Grid";import i from"@mui/material/Paper";import o from"@mui/material/Box";import m from"@mui/material/Button";import c from"@mui/material/Stepper";import s from"@mui/material/Step";import p from"@mui/material/StepLabel";import u from"@mui/material/MobileStepper";import d from"@mui/material/Alert";import f from"@mui/material/useMediaQuery";import{useTheme as E}from"@mui/material/styles";import x,{useState as g,useEffect as b}from"react";import v from"next/link";import{useSearchParams as h}from"next/navigation";import{useSession as k}from"../../../context/auth/SessionContext.js";import y from"@mui/icons-material/KeyboardArrowLeft";import B from"@mui/icons-material/KeyboardArrowRight";import C from"./Step1.js";import S from"./Step2.js";import _ from"./Step3.js";import A from"./Step4.js";import N from"./Step5.js";import{useCheckout as j}from"../../../context/e-commerce/checkout/CheckoutContext.js";import{useCart as D}from"../../../context/e-commerce/cart/CartContext.js";function P(P){var w=P.shopUrl,z=void 0===w?"/shop":w,I=E(),O=f(I.breakpoints.down("sm")),T=j(),H=T.state,L=T.runAllChecks,M=T.togglePrefersBillingAddress,R=T.togglePrefersDeliveryAddress,V=T.setCustomerInternalReference,F=D().dispatch,K=k(),G=K.loading;K.error;var Q=K.user;K.login;var U=K.logout,q=t(g(0),2),J=q[0],W=q[1],X=function(){W((function(e){return e+1}))},Y=function(){W((function(e){return e-1}))},Z=h();b((function(){null!==Z&&(Z.get("order")&&(W(4),localStorage.removeItem("cart"),F({type:"SET_ITEMS",payload:[]})))}),[Z]),b((function(){L()}),[Q]);var $=!H.confirmations.itemsInCart,ee=!H.confirmations.customerProfileComplete,te=[{label:"Login or register",children:x.createElement(C,{user:Q,logout:U}),backButton:x.createElement(m,{variant:O?"text":"outlined",disabled:0===J,onClick:Y,sx:{mr:1}},"Back",O&&x.createElement(y,null)),nextButton:x.createElement(m,{variant:O?"text":"contained",onClick:X,sx:{ml:1},disabled:(!Q||$)&&"production"===process.env.NODE_ENV,size:O?"small":"large"},"Next",O&&x.createElement(B,null))},{label:"Provide us with your address",children:x.createElement(S,null),backButton:x.createElement(m,{size:O?"small":"large",onClick:Y,disabled:0===J,variant:O?"text":"outlined"},"Back",O&&x.createElement(y,null)),nextButton:x.createElement(m,{size:O?"small":"large",variant:O?"text":"contained",onClick:function(){X()},disabled:(!Q||$||ee)&&"production"===process.env.NODE_ENV},"Next",O&&x.createElement(B,null))},{label:"Set up mailing options",children:x.createElement(_,{user:Q,prefersBillingAddress:H.prefersBillingAddress,prefersDeliveryAddress:H.prefersDeliveryAddress,delivery_options:H.delivery_options,payment_options:H.payment_options,togglePrefersBillingAddress:M,togglePrefersDeliveryAddress:R,setCustomerInternalReference:V}),backButton:x.createElement(m,{size:O?"small":"large",variant:O?"text":"outlined",onClick:Y,disabled:0===J},"Back",O&&x.createElement(y,null)),nextButton:x.createElement(m,{size:O?"small":"large",variant:O?"text":"contained",onClick:function(){X()},disabled:(!Q||$||ee)&&"production"===process.env.NODE_ENV},"Next",O&&x.createElement(B,null))},{label:"Confirm and make a payment",children:x.createElement(A,{customer_internal_reference:H.customer_internal_reference}),nextButton:x.createElement(x.Fragment,null,x.createElement(m,{size:O?"small":"large",variant:O?"text":"contained",onClick:function(){X()},disabled:!0},"Next",O&&x.createElement(B,null))),backButton:x.createElement(m,{size:O?"small":"large",variant:O?"text":"outlined",onClick:Y,disabled:0===J},"Back",O&&x.createElement(y,null))},{label:"Done!",children:x.createElement(N,null)}];return x.createElement(n,{sx:{py:2,minHeight:"100vh"}},x.createElement(l,{container:!0,spacing:2,sx:{py:3,minHeight:"60vh"}},x.createElement(l,{item:!0,xs:12},x.createElement(r,{variant:"h4",align:"center"},"Check Out")),$&&4!=J&&x.createElement(l,{item:!0,xs:12},x.createElement(d,{severity:"error"},x.createElement(r,{variant:"h5"},"No products in cart"),x.createElement(r,{variant:"body1"},"There are no products selected to order, please visit the shop befor continuing"))),x.createElement(l,{item:!0,xs:12},x.createElement(o,{width:"100%"},x.createElement(i,{sx:{p:2,mb:2,display:{xs:"block",sm:"none"}}},x.createElement(a,{direction:"row",spacing:2,alignItems:"center"},x.createElement(r,{variant:"body2"},"".concat(J+1," / ").concat(te.length)),x.createElement(r,null,"".concat(te[J].label)))),x.createElement(i,{sx:{px:2,pt:2,mb:2,display:{xs:"none",sm:"block"}}},x.createElement(c,{activeStep:J},te.map((function(t,r){var n={};return x.createElement(s,e({key:r},{},{sx:{pb:"20px"}}),x.createElement(p,n,t.label))})))),!G&&x.createElement(x.Fragment,null,te[J].children,x.createElement(i,{sx:{p:2,mt:2,display:{xs:"none",sm:"block"}}},x.createElement(a,{direction:"row",spacing:2},te[J].backButton,x.createElement(m,{variant:"outlined",sx:{ml:1}},x.createElement(v,{href:z},"continue shopping")),x.createElement(o,{sx:{flex:"1 1 auto"}}),te[J].nextButton))))),x.createElement(l,{item:!0,xs:12},x.createElement(u,{sx:{display:{xs:"flex",sm:"none"}},variant:"text",steps:te.length,position:"static",activeStep:J,nextButton:te[J].nextButton,backButton:te[J].backButton}))))}export{P as default};
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
import{extends as e}from"../../../../_virtual/_rollupPluginBabelHelpers.js";import t from"react";import r from"@mui/material/Paper";import n from"@mui/material/Stack";import a from"@mui/material/Typography";import l from"@mui/material/Autocomplete";import i from"@mui/material/Grid";import o from"@mui/material/Checkbox";import m from"@mui/material/TextField";import s from"../../common/Address.js";function c(c){var d,p,u=c.user,f=c.prefersBillingAddress,E=void 0===f||f,v=c.prefersDeliveryAddress,g=void 0===v||v,_=c.delivery_options,y=c.payment_options,h=c.togglePrefersBillingAddress,b=c.togglePrefersDeliveryAddress;return t.createElement(r,{sx:{p:2}},t.createElement(n,{spacing:2},null!==u&&t.createElement("form",null,t.createElement(i,{container:!0,spacing:2},t.createElement(i,{item:!0,xs:12,md:6},t.createElement(n,{spacing:2,justifyContent:"space-between"},t.createElement(a,{variant:"h5"},"Delivery Options"),t.createElement(a,{variant:"body1"},"Your order will be delivered at this address"),g&&u.customer_profile.delivery_address?t.createElement(s,{data:u.customer_profile.delivery_address}):t.createElement(s,{data:u.customer_profile.company_address}),null!=(null===(d=null==u?void 0:u.customer_profile)||void 0===d?void 0:d.delivery_address)&&t.createElement(n,{direction:"row",spacing:2,alignItems:"center"},t.createElement(o,{checked:!g,onChange:b}),t.createElement(a,null,"Use company address instead")),_&&_.length>0&&t.createElement(l,{options:_,renderInput:function(r){return t.createElement(m,e({},r,{label:"Delivery Options"}))}}))),t.createElement(i,{item:!0,xs:12,md:6},t.createElement(n,{spacing:2,justifyContent:"space-between"},t.createElement(a,{variant:"h5"},"Payment Options"),t.createElement(a,{variant:"body1"},"Your invoice will be shipped to this address"),E&&u.customer_profile.billing_address?t.createElement(s,{data:u.customer_profile.billing_address}):t.createElement(s,{data:u.customer_profile.company_address}),null!=(null===(p=null==u?void 0:u.customer_profile)||void 0===p?void 0:p.billing_address)&&t.createElement(n,{direction:"row",spacing:2,alignItems:"center"},t.createElement(o,{checked:!E,onChange:h}),t.createElement(a,null,"Use company address instead")),y&&y.length>0&&t.createElement(l,{options:y,renderInput:function(r){return t.createElement(m,e({},r,{label:"Payment Options"}))}}))),t.createElement(i,{item:!0,xs:12},t.createElement(n,{spacing:2},t.createElement(a,{variant:"h5"},"Internal Reference"),t.createElement(a,{variant:"body1"},"Optionaly attach an internal reference to this order"),t.createElement(m,{id:"customer_internal_reference",name:"customer_internal_reference",label:"Internal Reference"})))))))}export{c as default};
|
|
6
|
+
import{extends as e}from"../../../../_virtual/_rollupPluginBabelHelpers.js";import t from"react";import r from"@mui/material/Paper";import n from"@mui/material/Stack";import a from"@mui/material/Typography";import l from"@mui/material/Autocomplete";import i from"@mui/material/Grid";import o from"@mui/material/Checkbox";import m from"@mui/material/TextField";import s from"../../common/Address.js";function c(c){var d,p,u=c.user,f=c.prefersBillingAddress,E=void 0===f||f,v=c.prefersDeliveryAddress,g=void 0===v||v,_=c.delivery_options,y=c.payment_options,h=c.togglePrefersBillingAddress,b=c.togglePrefersDeliveryAddress,x=c.setCustomerInternalReference;return t.createElement(r,{sx:{p:2}},t.createElement(n,{spacing:2},null!==u&&t.createElement("form",null,t.createElement(i,{container:!0,spacing:2},t.createElement(i,{item:!0,xs:12,md:6},t.createElement(n,{spacing:2,justifyContent:"space-between"},t.createElement(a,{variant:"h5"},"Delivery Options"),t.createElement(a,{variant:"body1"},"Your order will be delivered at this address"),g&&u.customer_profile.delivery_address?t.createElement(s,{data:u.customer_profile.delivery_address}):t.createElement(s,{data:u.customer_profile.company_address}),null!=(null===(d=null==u?void 0:u.customer_profile)||void 0===d?void 0:d.delivery_address)&&t.createElement(n,{direction:"row",spacing:2,alignItems:"center"},t.createElement(o,{checked:!g,onChange:b}),t.createElement(a,null,"Use company address instead")),_&&_.length>0&&t.createElement(l,{options:_,renderInput:function(r){return t.createElement(m,e({},r,{label:"Delivery Options"}))}}))),t.createElement(i,{item:!0,xs:12,md:6},t.createElement(n,{spacing:2,justifyContent:"space-between"},t.createElement(a,{variant:"h5"},"Payment Options"),t.createElement(a,{variant:"body1"},"Your invoice will be shipped to this address"),E&&u.customer_profile.billing_address?t.createElement(s,{data:u.customer_profile.billing_address}):t.createElement(s,{data:u.customer_profile.company_address}),null!=(null===(p=null==u?void 0:u.customer_profile)||void 0===p?void 0:p.billing_address)&&t.createElement(n,{direction:"row",spacing:2,alignItems:"center"},t.createElement(o,{checked:!E,onChange:h}),t.createElement(a,null,"Use company address instead")),y&&y.length>0&&t.createElement(l,{options:y,renderInput:function(r){return t.createElement(m,e({},r,{label:"Payment Options"}))}}))),t.createElement(i,{item:!0,xs:12},t.createElement(n,{spacing:2},t.createElement(a,{variant:"h5"},"Internal Reference"),t.createElement(a,{variant:"body1"},"Optionaly attach an internal reference to this order"),t.createElement(m,{id:"customer_internal_reference",name:"customer_internal_reference",label:"Internal Reference",onChange:function(e){return x(e.target.value)}})))))))}export{c as default};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__read as e}from"../../../../node_modules/tslib/tslib.es6.js";import t,{Fragment as r}from"react";import a from"@mui/material/Paper";import o from"@mui/material/Stack";import m from"@mui/material/Alert";import
|
|
7
|
+
import{__read as e}from"../../../../node_modules/tslib/tslib.es6.js";import t,{Fragment as r}from"react";import a from"@mui/material/Paper";import o from"@mui/material/Stack";import m from"@mui/material/Alert";import n from"@mui/material/Button";import i from"@mui/material/Typography";import{useClientSideCart as l}from"../cart/hooks.js";import c from"../cart/CartSummary.js";import{useFormState as s}from"react-dom";import{checkoutAction as p}from"../../../data/actions/e-commerce/checkout-action.js";import{StrapiErrors as u}from"../../StrapiErrors.js";function d(d){var y=d.customer_internal_reference,f=l(),E=f.state;f.isClient;var h=e(s(p,{zodErrors:null,strapiErrors:null,data:null,message:null}),2),v=h[0],_=h[1];return t.createElement(a,{sx:{p:2}},t.createElement(o,{spacing:2},t.createElement(c,null),t.createElement(u,{error:null==v?void 0:v.strapiErrors}),(null==v?void 0:v.message)&&t.createElement(m,{severity:"error"},null==v?void 0:v.message),t.createElement(i,null,"Please double check all details prior to payment."," ",y),t.createElement(i,null,"Is this order compleet?"),t.createElement("form",{id:"paymentform",action:_},E.items&&E.items.map((function(e,a){return t.createElement(r,{key:a},t.createElement("input",{type:"hidden",name:"opo_items[".concat(a,"].product"),value:e.id}),t.createElement("input",{type:"hidden",name:"opo_items[".concat(a,"].ordered_quantity"),value:e.quantity}))})),t.createElement("input",{type:"hidden",name:"customer_internal_reference",value:y}),t.createElement(i,null,"Please click 'Proceed to payment' to proceed to the secure payment page. After completing the payment, you will automatically return to our shop. For any updates on this order, you can always access the latest information in your personal details."),t.createElement(n,{variant:"contained",form:"paymentform",type:"submit"},"Proceed to payment"))))}export{d as default};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__read as e,__assign as t}from"../../../../node_modules/tslib/tslib.es6.js";import{StyleSheet as l,PDFDownloadLink as n,PDFViewer as o,Document as r,Page as c,View as i,Text as a}from"@react-pdf/renderer";import m,{useState as u,Fragment as
|
|
7
|
+
import{__read as e,__assign as t}from"../../../../node_modules/tslib/tslib.es6.js";import{StyleSheet as l,PDFDownloadLink as n,PDFViewer as o,Document as r,Page as c,View as i,Text as a}from"@react-pdf/renderer";import m,{useState as u,Fragment as s}from"react";import d from"@mui/material/IconButton";import E from"@mui/material/Dialog";import y from"@mui/material/DialogContent";import p from"@mui/material/DialogActions";import v from"@mui/material/Button";import _ from"@mui/icons-material/PictureAsPdf";var S=l.create({page:{flexDirection:"column",backgroundColor:"#E4E4E4"},header:{padding:10,flexDirection:"row",alignItems:"center"},logo:{width:24,height:24,marginRight:10},section:{margin:10,padding:10,fontSize:12},row:{flexDirection:"row"},rowSection:{flex:1},productRowSection:{flex:1,width:1/6},h1:{fontSize:28},h2:{fontSize:24,fontStyle:"bold"},h3:{fontSize:16,fontStyle:"bold"}});function f(e){var l,n,o=e.props.invoice,u=o.seller_business_credentials,d=o.seller_company_address,E=o.buyer_company_address,y=o.buyer_business_credentials;return m.createElement(r,null,m.createElement(c,{size:"A4",style:S.page},m.createElement(i,{style:S.header},m.createElement(a,{style:S.h1},null==u?void 0:u.company_name)),m.createElement(i,{style:S.section},m.createElement(a,{style:S.h2},"INVOICE")),m.createElement(i,{style:S.section},m.createElement(i,{style:S.row},m.createElement(i,{style:S.rowSection},m.createElement(a,{style:S.h3},"BILLING DETAILS"),m.createElement(a,null,null==y?void 0:y.company_name),m.createElement(a,null,null==o?void 0:o.buyer_first_name," ",null==o?void 0:o.buyer_last_name),m.createElement(a,null,null==E?void 0:E.street," ",null==E?void 0:E.street_number," ",null==E?void 0:E.street_number_addition),m.createElement(a,null,null==E?void 0:E.postal_code," ",null==E?void 0:E.city)),m.createElement(i,{style:S.rowSection},m.createElement(a,{style:S.h3},"FROM"),m.createElement(a,null,null==u?void 0:u.company_name),m.createElement(a,null,null==d?void 0:d.street," ",null==d?void 0:d.street_number," ",null==d?void 0:d.street_number_addition),m.createElement(a,null,null==d?void 0:d.postal_code," ",null==d?void 0:d.city),m.createElement(a,{style:{fontStyle:"bold",marginTop:10}},"CoC Number"),m.createElement(a,null,null==u?void 0:u.coc_number),m.createElement(a,{style:{fontStyle:"bold",marginTop:10}},"VAT Number"),m.createElement(a,null,null==u?void 0:u.vat_number)))),m.createElement(i,{style:S.section},m.createElement(i,{style:S.row},m.createElement(i,{style:S.rowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Invoice number: "),m.createElement(a,null,null==o?void 0:o.invoice_number)),(null==o?void 0:o.customer_internal_reference)&&m.createElement(i,{style:S.rowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Your reference: "),m.createElement(a,null,null==o?void 0:o.customer_internal_reference)),m.createElement(i,{style:S.rowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Invoice date"),m.createElement(a,null,null==o?void 0:o.invoice_date)))),m.createElement(i,{style:S.section},m.createElement(a,{style:S.h3},"SUMMARY"),m.createElement(i,{style:S.row},m.createElement(i,{style:S.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Title")),m.createElement(i,{style:S.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Amount")),m.createElement(i,{style:S.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"VAT rate")),m.createElement(i,{style:S.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"VAT")),m.createElement(i,{style:S.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Excl. VAT")),m.createElement(i,{style:S.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Incl. VAT"))),null===(l=null==o?void 0:o.items)||void 0===l?void 0:l.map((function(e,t){return m.createElement(s,{key:t},m.createElement(i,{style:S.row},m.createElement(i,{style:S.productRowSection},m.createElement(a,null,"product_title"in e&&e.product_title,"item_description"in e&&e.item_description)),m.createElement(i,{style:S.productRowSection},m.createElement(a,null,e.quantity)),m.createElement(i,{style:S.productRowSection},m.createElement(a,null,e.vat_rate," %")," "),m.createElement(i,{style:S.productRowSection},e.price_excl_vat&&e.price_incl_vat&&m.createElement(a,null,"€"," ",(e.price_incl_vat-e.price_excl_vat).toFixed(2))),m.createElement(i,{style:S.productRowSection},m.createElement(a,null,"€ ",e.price_excl_vat)),m.createElement(i,{style:S.productRowSection},m.createElement(a,null,"€ ",e.price_incl_vat))))}))),m.createElement(i,{style:S.section},m.createElement(a,{style:S.h3},"TOTALS"),m.createElement(i,{style:S.row},m.createElement(i,{style:S.productRowSection}),m.createElement(i,{style:S.productRowSection}),m.createElement(i,{style:S.productRowSection}),m.createElement(i,{style:S.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"VAT")),m.createElement(i,{style:S.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Excl. VAT")),m.createElement(i,{style:S.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Incl. VAT"))),m.createElement(i,{style:S.row},m.createElement(i,{style:S.productRowSection}),m.createElement(i,{style:S.productRowSection}),m.createElement(i,{style:S.productRowSection}),m.createElement(i,{style:S.productRowSection},m.createElement(a,null,"€ ",null===(n=null==o?void 0:o.VAT_total)||void 0===n?void 0:n.toFixed(2))),m.createElement(i,{style:S.productRowSection},m.createElement(a,null,"€ ",null==o?void 0:o.total_excl_vat)),m.createElement(i,{style:S.productRowSection},m.createElement(a,null,"€ ",null==o?void 0:o.total_incl_vat)))),m.createElement(i,{style:S.section},m.createElement(a,{style:t(t({},S.h3),{border:"2px solid black",padding:10})},"Total Due: € ",null==o?void 0:o.total_incl_vat))))}function w(e){var t=e.invoice;return m.createElement(n,{document:m.createElement(f,{props:{invoice:t}}),fileName:"invoice_".concat(null==t?void 0:t.invoice_number)},m.createElement(d,null,m.createElement(_,null)))}function b(t){var l=t.invoice,n=e(u(!1),2),r=n[0],c=n[1];return m.createElement(m.Fragment,null,m.createElement(d,{onClick:function(){return c(!0)}},m.createElement(_,null)),m.createElement(E,{open:r,fullWidth:!0,maxWidth:"lg"},m.createElement(y,null,m.createElement(o,{style:{width:"100%",minHeight:"70vh"}},m.createElement(f,{props:{invoice:l}}))),m.createElement(p,null,m.createElement(v,{variant:"contained",onClick:function(){return c(!1)}},"Close"))))}export{w as InvoiceDownloadLink,b as InvoicePDFViewer};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__read as e,__assign as r}from"../../../../node_modules/tslib/tslib.es6.js";import s,{useReducer as i,
|
|
7
|
+
import{__read as e,__assign as r}from"../../../../node_modules/tslib/tslib.es6.js";import s,{useReducer as i,useEffect as l,useContext as o,createContext as t}from"react";import{isCustomerProfileComplete as n}from"../../../lib/isCustomerProfileComplete.js";import{isAddressComplete as d}from"../../../lib/isAddressComplete.js";import{areBusinessCredentailsComplete as a}from"../../../lib/areBusinessCredentialsComplete.js";import{useClientSideCart as m}from"../../../components/e-commerce/cart/hooks.js";import{useSession as p}from"../../auth/SessionContext.js";import u from"../../../lib/isVATValid.js";import f from"../../../lib/isEORIValid.js";var c={confirmations:{itemsInCart:!1,customerProfileComplete:!1,companyAddressComplete:!1,deliveryAddressComplete:!1,billingAddressComplete:!1,businessCredentailsComplete:!1,hasValidatedVAT:!1,hasValidatedEORI:!1},delivery_options:[{id:1,label:"ptt"}],payment_options:[{id:1,label:"ideal"}],prefersBillingAddress:!0,prefersDeliveryAddress:!0,customer_internal_reference:""},_=t({state:c,runAllChecks:function(){},togglePrefersBillingAddress:function(){},togglePrefersDeliveryAddress:function(){},setCustomerInternalReference:function(){}}),E=function(e,s){switch(s.type){case"UPDATE_CONFIRMATIONS":return r(r({},e),{confirmations:r(r({},e.confirmations),s.payload)});case"SET_PREFERS_BILLING_ADDRESS":return r(r({},e),{prefersBillingAddress:s.payload.prefersBillingAddress});case"SET_PREFERS_DELIVERY_ADDRESS":return r(r({},e),{prefersDeliveryAddress:s.payload.prefersDeliveryAddress});case"SET_CUSTOMER_INTERNAL_REFERENCE":return r(r({},e),{customer_internal_reference:s.payload.customer_internal_reference});default:return e}},v=function(r){var o=r.children,t=e(i(E,c),2),v=t[0],A=t[1],C=p(),R=C.user;C.loading,C.error;var y=m(),S=function(){var e,r,s,i,l,o,t=y.state.items.length>0,m=n(null==R?void 0:R.customer_profile),p=d(null===(e=null==R?void 0:R.customer_profile)||void 0===e?void 0:e.company_address),c=d(null===(r=null==R?void 0:R.customer_profile)||void 0===r?void 0:r.delivery_address),_=d(null===(s=null==R?void 0:R.customer_profile)||void 0===s?void 0:s.billing_address),E=a(null===(i=null==R?void 0:R.customer_profile)||void 0===i?void 0:i.business_credentials),v=u(null===(l=null==R?void 0:R.customer_profile)||void 0===l?void 0:l.business_credentials),C=f(null===(o=null==R?void 0:R.customer_profile)||void 0===o?void 0:o.business_credentials);A({type:"UPDATE_CONFIRMATIONS",payload:{itemsInCart:t,customerProfileComplete:m,companyAddressComplete:p,deliveryAddressComplete:c,billingAddressComplete:_,businessCredentailsComplete:E,hasValidatedVAT:v,hasValidatedEORI:C}})};l((function(){R&&S()}),[R]);var g={state:v,runAllChecks:S,togglePrefersBillingAddress:function(){A({type:"SET_PREFERS_BILLING_ADDRESS",payload:{prefersBillingAddress:!v.prefersBillingAddress}})},togglePrefersDeliveryAddress:function(){A({type:"SET_PREFERS_DELIVERY_ADDRESS",payload:{prefersDeliveryAddress:!v.prefersDeliveryAddress}})},setCustomerInternalReference:function(e){A({type:"SET_CUSTOMER_INTERNAL_REFERENCE",payload:{customer_internal_reference:e}})}};return s.createElement(_.Provider,{value:g},o)},A=function(){return o(_)};export{v as CheckoutProvider,A as useCheckout};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__awaiter as
|
|
7
|
+
import{__awaiter as e,__generator as r,__assign as s}from"../../../../node_modules/tslib/tslib.es6.js";import{mutateData as t}from"../../services/mutate-data.js";import{parseFormData as o}from"../../../lib/parseFormData.js";import{createMolliePayment as a}from"../../../lib/molliePaymentProvider.js";import{redirect as n}from"next/navigation";function i(i,p){return e(this,void 0,void 0,(function(){var e,c,l,m,u,d;return r(this,(function(r){switch(r.label){case 0:return e=o(p),console.log("parsedFormData",e),[4,t("POST","/api/opos/",e)];case 1:return c=r.sent(),console.log("responseData",c),c?c.error?[2,s(s({},i),{strapiErrors:c.error,message:"Failed to create order."})]:"production"!==process.env.NODE_ENV?[3,3]:[4,a(c)]:[2,s(s({},i),{strapiErrors:null,message:"Ops! Something went wrong. Please try again."})];case 2:return m=r.sent(),[3,4];case 3:m=null,r.label=4;case 4:return"string"==typeof(l=m)?[2,s(s({},i),{strapiErrors:null,message:l})]:"production"===process.env.NODE_ENV&&l?[4,t("POST","api/payments/",{data:{opo:c.id,payment_status:l.status,provider_id:l.id,provider_response:l}})]:[3,6];case 5:return d=r.sent(),[3,8];case 6:return[4,t("POST","api/payments/",{data:{opo:c.id,payment_status:"open"}})];case 7:d=r.sent(),r.label=8;case 8:return(u=d).error?[2,s(s({},i),{strapiErrors:u.error,message:"Failed to create payment."})]:("production"===process.env.NODE_ENV&&l?n("".concat(l.getCheckoutUrl())):n("/shop/check-out"),[2])}}))}))}export{i as checkoutAction};
|