umwd-components 0.1.527 → 0.1.529

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.
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- import{__exports as r}from"../../_virtual/index7.js";var t;function e(){if(t)return r;t=1,r.byteLength=function(r){var t=i(r),e=t[0],n=t[1];return 3*(e+n)/4-n},r.toByteArray=function(r){var t,e,a=i(r),u=a[0],h=a[1],c=new o(function(r,t,e){return 3*(t+e)/4-e}(0,u,h)),f=0,d=h>0?u-4:u;for(e=0;e<d;e+=4)t=n[r.charCodeAt(e)]<<18|n[r.charCodeAt(e+1)]<<12|n[r.charCodeAt(e+2)]<<6|n[r.charCodeAt(e+3)],c[f++]=t>>16&255,c[f++]=t>>8&255,c[f++]=255&t;2===h&&(t=n[r.charCodeAt(e)]<<2|n[r.charCodeAt(e+1)]>>4,c[f++]=255&t);1===h&&(t=n[r.charCodeAt(e)]<<10|n[r.charCodeAt(e+1)]<<4|n[r.charCodeAt(e+2)]>>2,c[f++]=t>>8&255,c[f++]=255&t);return c},r.fromByteArray=function(r){for(var t,n=r.length,o=n%3,a=[],u=16383,i=0,c=n-o;i<c;i+=u)a.push(h(r,i,i+u>c?c:i+u));1===o?(t=r[n-1],a.push(e[t>>2]+e[t<<4&63]+"==")):2===o&&(t=(r[n-2]<<8)+r[n-1],a.push(e[t>>10]+e[t>>4&63]+e[t<<2&63]+"="));return a.join("")};for(var e=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0;u<64;++u)e[u]=a[u],n[a.charCodeAt(u)]=u;function i(r){var t=r.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=r.indexOf("=");return-1===e&&(e=t),[e,e===t?0:4-e%4]}function h(r,t,n){for(var o,a,u=[],i=t;i<n;i+=3)o=(r[i]<<16&16711680)+(r[i+1]<<8&65280)+(255&r[i+2]),u.push(e[(a=o)>>18&63]+e[a>>12&63]+e[a>>6&63]+e[63&a]);return u.join("")}return n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63,r}export{e as __require};
6
+ import{__exports as r}from"../../_virtual/index8.js";var t;function e(){if(t)return r;t=1,r.byteLength=function(r){var t=i(r),e=t[0],n=t[1];return 3*(e+n)/4-n},r.toByteArray=function(r){var t,e,a=i(r),u=a[0],h=a[1],c=new o(function(r,t,e){return 3*(t+e)/4-e}(0,u,h)),f=0,d=h>0?u-4:u;for(e=0;e<d;e+=4)t=n[r.charCodeAt(e)]<<18|n[r.charCodeAt(e+1)]<<12|n[r.charCodeAt(e+2)]<<6|n[r.charCodeAt(e+3)],c[f++]=t>>16&255,c[f++]=t>>8&255,c[f++]=255&t;2===h&&(t=n[r.charCodeAt(e)]<<2|n[r.charCodeAt(e+1)]>>4,c[f++]=255&t);1===h&&(t=n[r.charCodeAt(e)]<<10|n[r.charCodeAt(e+1)]<<4|n[r.charCodeAt(e+2)]>>2,c[f++]=t>>8&255,c[f++]=255&t);return c},r.fromByteArray=function(r){for(var t,n=r.length,o=n%3,a=[],u=16383,i=0,c=n-o;i<c;i+=u)a.push(h(r,i,i+u>c?c:i+u));1===o?(t=r[n-1],a.push(e[t>>2]+e[t<<4&63]+"==")):2===o&&(t=(r[n-2]<<8)+r[n-1],a.push(e[t>>10]+e[t>>4&63]+e[t<<2&63]+"="));return a.join("")};for(var e=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0;u<64;++u)e[u]=a[u],n[a.charCodeAt(u)]=u;function i(r){var t=r.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=r.indexOf("=");return-1===e&&(e=t),[e,e===t?0:4-e%4]}function h(r,t,n){for(var o,a,u=[],i=t;i<n;i+=3)o=(r[i]<<16&16711680)+(r[i+1]<<8&65280)+(255&r[i+2]),u.push(e[(a=o)>>18&63]+e[a>>12&63]+e[a>>6&63]+e[63&a]);return u.join("")}return n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63,r}export{e as __require};
@@ -3,5 +3,5 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- import{__exports as a}from"../../_virtual/index8.js";
6
+ import{__exports as a}from"../../_virtual/index7.js";
7
7
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */var t;function o(){return t||(t=1,a.read=function(a,t,o,r,h){var M,e,i=8*h-r-1,p=(1<<i)-1,f=p>>1,n=-7,w=o?h-1:0,s=o?-1:1,u=a[t+w];for(w+=s,M=u&(1<<-n)-1,u>>=-n,n+=i;n>0;M=256*M+a[t+w],w+=s,n-=8);for(e=M&(1<<-n)-1,M>>=-n,n+=r;n>0;e=256*e+a[t+w],w+=s,n-=8);if(0===M)M=1-f;else{if(M===p)return e?NaN:1/0*(u?-1:1);e+=Math.pow(2,r),M-=f}return(u?-1:1)*e*Math.pow(2,M-r)},a.write=function(a,t,o,r,h,M){var e,i,p,f=8*M-h-1,n=(1<<f)-1,w=n>>1,s=23===h?Math.pow(2,-24)-Math.pow(2,-77):0,u=r?0:M-1,N=r?1:-1,_=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(i=isNaN(t)?1:0,e=n):(e=Math.floor(Math.log(t)/Math.LN2),t*(p=Math.pow(2,-e))<1&&(e--,p*=2),(t+=e+w>=1?s/p:s*Math.pow(2,1-w))*p>=2&&(e++,p/=2),e+w>=n?(i=0,e=n):e+w>=1?(i=(t*p-1)*Math.pow(2,h),e+=w):(i=t*Math.pow(2,w-1)*Math.pow(2,h),e=0));h>=8;a[o+u]=255&i,u+=N,i/=256,h-=8);for(e=e<<h|i,f+=h;f>0;a[o+u]=255&e,u+=N,e/=256,f-=8);a[o+u-N]|=128*_}),a}export{o as __require};
@@ -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 d}from"react";import s from"@mui/material/IconButton";import E from"@mui/material/Dialog";import y from"@mui/material/DialogContent";import p from"@mui/material/DialogActions";import S from"@mui/material/Button";import v from"@mui/icons-material/PictureAsPdf";var f=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 _(e){var l,n,o,u,s=e.props.invoice;console.log("invoice from invoicePDF",s);var E=s.seller_business_credentials,y=s.seller_company_address,p=s.buyer_company_address,S=s.buyer_business_credentials;return m.createElement(r,null,m.createElement(c,{size:"A4",style:f.page},m.createElement(i,{style:f.header},m.createElement(a,{style:f.h1},null==E?void 0:E.company_name)),m.createElement(i,{style:f.section},m.createElement(a,{style:f.h2},"INVOICE")),m.createElement(i,{style:f.section},m.createElement(i,{style:f.row},m.createElement(i,{style:f.rowSection},m.createElement(a,{style:f.h3},"BILLING DETAILS"),m.createElement(a,null,null==S?void 0:S.company_name),m.createElement(a,null,null==s?void 0:s.buyer_first_name," ",null==s?void 0:s.buyer_last_name),m.createElement(a,null,null==p?void 0:p.street," ",null==p?void 0:p.street_number," ",null==p?void 0:p.street_number_addition),m.createElement(a,null,null==p?void 0:p.postal_code," ",null==p?void 0:p.city)),m.createElement(i,{style:f.rowSection},m.createElement(a,{style:f.h3},"FROM"),m.createElement(a,null,null==E?void 0:E.company_name),m.createElement(a,null,null==y?void 0:y.street," ",null==y?void 0:y.street_number," ",null==y?void 0:y.street_number_addition),m.createElement(a,null,null==y?void 0:y.postal_code," ",null==y?void 0:y.city),m.createElement(a,{style:{fontStyle:"bold",marginTop:10}},"CoC Number"),m.createElement(a,null,null==E?void 0:E.coc_number),m.createElement(a,{style:{fontStyle:"bold",marginTop:10}},"VAT Number"),m.createElement(a,null,null==E?void 0:E.vat_number)))),m.createElement(i,{style:f.section},m.createElement(i,{style:f.row},m.createElement(i,{style:f.rowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Invoice number: "),m.createElement(a,null,null==s?void 0:s.invoice_number)),(null==s?void 0:s.customer_internal_reference)&&m.createElement(i,{style:f.rowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Your reference: "),m.createElement(a,null,null==s?void 0:s.customer_internal_reference)),m.createElement(i,{style:f.rowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Invoice date"),m.createElement(a,null,null==s?void 0:s.invoice_date)))),m.createElement(i,{style:f.section},m.createElement(a,{style:f.h3},"SUMMARY"),m.createElement(i,{style:f.row},(null===(l=null==s?void 0:s.admin_items)||void 0===l?void 0:l.length)>0&&m.createElement(i,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Line Item Number")),m.createElement(i,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Title")),m.createElement(i,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Amount")),m.createElement(i,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"VAT rate")),m.createElement(i,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"VAT")),m.createElement(i,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Excl. VAT")),m.createElement(i,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Incl. VAT"))),null===(n=null==s?void 0:s.items)||void 0===n?void 0:n.map((function(e,t){var l,n;return m.createElement(d,{key:t},m.createElement(i,{style:f.row},m.createElement(i,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"product_title"in e&&e.product_title,"item_description"in e&&e.item_description)),m.createElement(i,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.quantity)),m.createElement(i,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.vat_rate," %")," "),m.createElement(i,{style:f.productRowSection},e.price_excl_vat&&e.price_incl_vat&&m.createElement(a,{style:{fontSize:"10px"}},"€"," ",(e.price_incl_vat-e.price_excl_vat).toFixed(2))),m.createElement(i,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(l=e.price_excl_vat)||void 0===l?void 0:l.toFixed(2))),m.createElement(i,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(n=e.price_incl_vat)||void 0===n?void 0:n.toFixed(2)))))})),null===(o=null==s?void 0:s.admin_items)||void 0===o?void 0:o.map((function(e,t){return m.createElement(d,{key:t},m.createElement(i,{style:f.row},m.createElement(i,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.line_item_number)),m.createElement(i,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.description)),m.createElement(i,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.quantity)),m.createElement(i,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.price.vat_rate," %")),m.createElement(i,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",e.price.vat.toFixed(2))),m.createElement(i,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",e.price.price.toFixed(2))),m.createElement(i,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",e.price.price_incl_vat.toFixed(2)))))}))),m.createElement(i,{style:f.section},m.createElement(a,{style:f.h3},"TOTALS"),m.createElement(i,{style:f.row},m.createElement(i,{style:f.productRowSection}),m.createElement(i,{style:f.productRowSection}),m.createElement(i,{style:f.productRowSection}),m.createElement(i,{style:f.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"VAT")),m.createElement(i,{style:f.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Excl. VAT")),m.createElement(i,{style:f.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Incl. VAT"))),m.createElement(i,{style:f.row},m.createElement(i,{style:f.productRowSection}),m.createElement(i,{style:f.productRowSection}),m.createElement(i,{style:f.productRowSection}),m.createElement(i,{style:f.productRowSection},m.createElement(a,null,"€ ",null===(u=null==s?void 0:s.VAT_total)||void 0===u?void 0:u.toFixed(2))),m.createElement(i,{style:f.productRowSection},m.createElement(a,null,"€ ",null==s?void 0:s.total_excl_vat.toFixed(2))),m.createElement(i,{style:f.productRowSection},m.createElement(a,null,"€ ",null==s?void 0:s.total_incl_vat.toFixed(2))))),m.createElement(i,{style:f.section},m.createElement(a,{style:t(t({},f.h3),{border:"2px solid black",padding:10})},"Total Due: € ",null==s?void 0:s.total_incl_vat.toFixed(2)))))}function w(e){var t=e.invoice;return m.createElement(n,{document:m.createElement(_,{props:{invoice:t}}),fileName:"invoice_".concat(null==t?void 0:t.invoice_number)},m.createElement(s,null,m.createElement(v,null)))}function x(t){var l=t.invoice,n=e(u(!1),2),r=n[0],c=n[1];return m.createElement(m.Fragment,null,m.createElement(s,{onClick:function(){return c(!0)}},m.createElement(v,null)),m.createElement(E,{open:r,fullWidth:!0,maxWidth:"lg"},m.createElement(y,null,m.createElement(o,{style:{width:"100%",minHeight:"70vh"}},m.createElement(_,{props:{invoice:l}}))),m.createElement(p,null,m.createElement(S,{variant:"contained",onClick:function(){return c(!1)}},"Close"))))}export{w as InvoiceDownloadLink,x as InvoicePDFViewer};
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 i,View as c,Text as a}from"@react-pdf/renderer";import m,{useState as d,Fragment as u}from"react";import s 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 S from"@mui/icons-material/PictureAsPdf";var f=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 _(e){var l,n,o,d,s,E,y,p=e.props.invoice;console.log("invoice from invoicePDF",p);var v=p.seller_business_credentials,S=p.seller_company_address,_=p.buyer_company_address,w=p.buyer_business_credentials;return m.createElement(r,null,m.createElement(i,{size:"A4",style:f.page},m.createElement(c,{style:f.header},m.createElement(a,{style:f.h1},null==v?void 0:v.company_name)),m.createElement(c,{style:f.section},m.createElement(a,{style:f.h2},"INVOICE")),m.createElement(c,{style:f.section},m.createElement(c,{style:f.row},m.createElement(c,{style:f.rowSection},m.createElement(a,{style:f.h3},"BILLING DETAILS"),m.createElement(a,null,null==w?void 0:w.company_name),m.createElement(a,null,null==p?void 0:p.buyer_first_name," ",null==p?void 0:p.buyer_last_name),m.createElement(a,null,null==_?void 0:_.street," ",null==_?void 0:_.street_number," ",null==_?void 0:_.street_number_addition),m.createElement(a,null,null==_?void 0:_.postal_code," ",null==_?void 0:_.city)),m.createElement(c,{style:f.rowSection},m.createElement(a,{style:f.h3},"FROM"),m.createElement(a,null,null==v?void 0:v.company_name),m.createElement(a,null,null==S?void 0:S.street," ",null==S?void 0:S.street_number," ",null==S?void 0:S.street_number_addition),m.createElement(a,null,null==S?void 0:S.postal_code," ",null==S?void 0:S.city),m.createElement(a,{style:{fontStyle:"bold",marginTop:10}},"CoC Number"),m.createElement(a,null,null==v?void 0:v.coc_number),m.createElement(a,{style:{fontStyle:"bold",marginTop:10}},"VAT Number"),m.createElement(a,null,null==v?void 0:v.vat_number)))),m.createElement(c,{style:f.section},m.createElement(c,{style:f.row},m.createElement(c,{style:f.rowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Invoice number: "),m.createElement(a,null,null==p?void 0:p.invoice_number)),(null==p?void 0:p.customer_internal_reference)&&m.createElement(c,{style:f.rowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Your reference: "),m.createElement(a,null,null==p?void 0:p.customer_internal_reference)),m.createElement(c,{style:f.rowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Invoice date"),m.createElement(a,null,null==p?void 0:p.invoice_date)))),m.createElement(c,{style:f.section},m.createElement(a,{style:f.h3},"SUMMARY"),m.createElement(c,{style:f.row},(null===(l=null==p?void 0:p.admin_items)||void 0===l?void 0:l.length)>0&&m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Line Item Number")),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Title")),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Amount")),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"VAT rate")),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"VAT")),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Excl. VAT")),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Incl. VAT"))),null===(n=null==p?void 0:p.items)||void 0===n?void 0:n.map((function(e,t){var l,n,o;return m.createElement(u,{key:t},m.createElement(c,{style:f.row},m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"product_title"in e&&e.product_title,"item_description"in e&&e.item_description)),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.quantity)),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.vat_rate," %")," "),m.createElement(c,{style:f.productRowSection},e.price_excl_vat&&e.price_incl_vat&&m.createElement(a,{style:{fontSize:"10px"}},"€"," ",null===(l=e.price_incl_vat-e.price_excl_vat)||void 0===l?void 0:l.toFixed(2))),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(n=e.price_excl_vat)||void 0===n?void 0:n.toFixed(2))),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(o=e.price_incl_vat)||void 0===o?void 0:o.toFixed(2)))))})),null===(o=null==p?void 0:p.admin_items)||void 0===o?void 0:o.map((function(e,t){var l,n,o,r,i,d,s;return m.createElement(u,{key:t},m.createElement(c,{style:f.row},m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.line_item_number)),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.description)),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.quantity)),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},null===(l=null==e?void 0:e.price)||void 0===l?void 0:l.vat_rate," %")),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(o=null===(n=null==e?void 0:e.price)||void 0===n?void 0:n.vat)||void 0===o?void 0:o.toFixed(2))),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(i=null===(r=null==e?void 0:e.price)||void 0===r?void 0:r.price)||void 0===i?void 0:i.toFixed(2))),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(s=null===(d=null==e?void 0:e.price)||void 0===d?void 0:d.price_incl_vat)||void 0===s?void 0:s.toFixed(2)))))}))),m.createElement(c,{style:f.section},m.createElement(a,{style:f.h3},"TOTALS"),m.createElement(c,{style:f.row},m.createElement(c,{style:f.productRowSection}),m.createElement(c,{style:f.productRowSection}),m.createElement(c,{style:f.productRowSection}),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"VAT")),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Excl. VAT")),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Incl. VAT"))),m.createElement(c,{style:f.row},m.createElement(c,{style:f.productRowSection}),m.createElement(c,{style:f.productRowSection}),m.createElement(c,{style:f.productRowSection}),m.createElement(c,{style:f.productRowSection},m.createElement(a,null,"€ ",null===(d=null==p?void 0:p.VAT_total)||void 0===d?void 0:d.toFixed(2))),m.createElement(c,{style:f.productRowSection},m.createElement(a,null,"€ ",null===(s=null==p?void 0:p.total_excl_vat)||void 0===s?void 0:s.toFixed(2))),m.createElement(c,{style:f.productRowSection},m.createElement(a,null,"€ ",null===(E=null==p?void 0:p.total_incl_vat)||void 0===E?void 0:E.toFixed(2))))),m.createElement(c,{style:f.section},m.createElement(a,{style:t(t({},f.h3),{border:"2px solid black",padding:10})},"Total Due: € ",null===(y=null==p?void 0:p.total_incl_vat)||void 0===y?void 0:y.toFixed(2)))))}function w(e){var t=e.invoice;return m.createElement(n,{document:m.createElement(_,{props:{invoice:t}}),fileName:"invoice_".concat(null==t?void 0:t.invoice_number)},m.createElement(s,null,m.createElement(S,null)))}function x(t){var l=t.invoice,n=e(d(!1),2),r=n[0],i=n[1];return m.createElement(m.Fragment,null,m.createElement(s,{onClick:function(){return i(!0)}},m.createElement(S,null)),m.createElement(E,{open:r,fullWidth:!0,maxWidth:"lg"},m.createElement(y,null,m.createElement(o,{style:{width:"100%",minHeight:"70vh"}},m.createElement(_,{props:{invoice:l}}))),m.createElement(p,null,m.createElement(v,{variant:"contained",onClick:function(){return i(!1)}},"Close"))))}export{w as InvoiceDownloadLink,x 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 l,useEffect as i,useContext as o,createContext as n}from"react";import{isCustomerProfileCompleteV2 as t}from"../../../lib/isCustomerProfileCompleteV2.js";import{isAddressComplete as d}from"../../../lib/isAddressComplete.js";import{areBusinessCredentailsComplete as a}from"../../../lib/areBusinessCredentialsComplete.js";import{useClientSideCart as u}from"../../../components/e-commerce/cart/hooks.js";import{useSession as m}from"../../auth/SessionContext.js";import p from"../../../lib/isVATValid.js";import c from"../../../lib/isEORIValid.js";var f={confirmations:{itemsInCart:!1,customerProfileComplete:!1,companyAddressComplete:!1,deliveryAddressComplete:!1,billingAddressComplete:!1,businessCredentailsComplete:!1,hasVAT:!1,hasEORI:!1,hasValidatedVAT:!1,hasValidatedEORI:!1},delivery_options:[{id:1,label:"ptt"}],payment_options:[{id:1,label:"ideal"}],prefersBillingAddress:!0,prefersDeliveryAddress:!0,customer_internal_reference:""},_=n({state:f,runAllChecks:function(){},togglePrefersBillingAddress:function(){},togglePrefersDeliveryAddress:function(){},setCustomerInternalReference:function(){}}),v=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}},E=function(r){var o=r.children,n=e(l(v,f),2),E=n[0],A=n[1],R=m(),C=R.user;R.loading,R.error;var y=u(),S=function(){var e,r,s,l,i,o,n,u,m,f,_=y.state.items.length>0,v=Object.values(t(null==C?void 0:C.customer_profile)).every((function(e){return!0===e})),E=d(null===(e=null==C?void 0:C.customer_profile)||void 0===e?void 0:e.company_address),R=d(null===(r=null==C?void 0:C.customer_profile)||void 0===r?void 0:r.delivery_address),S=d(null===(s=null==C?void 0:C.customer_profile)||void 0===s?void 0:s.billing_address),b=a(null===(l=null==C?void 0:C.customer_profile)||void 0===l?void 0:l.business_credentials),I=Boolean(null===(o=null===(i=null==C?void 0:C.customer_profile)||void 0===i?void 0:i.business_credentials)||void 0===o?void 0:o.VAT_number),g=Boolean(null===(u=null===(n=null==C?void 0:C.customer_profile)||void 0===n?void 0:n.business_credentials)||void 0===u?void 0:u.EORI_number),T=p(null===(m=null==C?void 0:C.customer_profile)||void 0===m?void 0:m.business_credentials),D=c(null===(f=null==C?void 0:C.customer_profile)||void 0===f?void 0:f.business_credentials);A({type:"UPDATE_CONFIRMATIONS",payload:{itemsInCart:_,customerProfileComplete:v,companyAddressComplete:E,deliveryAddressComplete:R,billingAddressComplete:S,businessCredentailsComplete:b,hasVAT:I,hasEORI:g,hasValidatedVAT:T,hasValidatedEORI:D}})};i((function(){C&&S()}),[C]);var b={state:E,runAllChecks:S,togglePrefersBillingAddress:function(){A({type:"SET_PREFERS_BILLING_ADDRESS",payload:{prefersBillingAddress:!E.prefersBillingAddress}})},togglePrefersDeliveryAddress:function(){A({type:"SET_PREFERS_DELIVERY_ADDRESS",payload:{prefersDeliveryAddress:!E.prefersDeliveryAddress}})},setCustomerInternalReference:function(e){A({type:"SET_CUSTOMER_INTERNAL_REFERENCE",payload:{customer_internal_reference:e}})}};return s.createElement(_.Provider,{value:b},o)},A=function(){return o(_)};export{E as CheckoutProvider,A as useCheckout};
7
+ import{__read as e,__assign as r}from"../../../../node_modules/tslib/tslib.es6.js";import s,{useReducer as l,useEffect as i,useContext as o,createContext as n}from"react";import{isCustomerProfileCompleteV2 as t}from"../../../lib/isCustomerProfileCompleteV2.js";import{isAddressComplete as d}from"../../../lib/isAddressComplete.js";import{areBusinessCredentailsComplete as a}from"../../../lib/areBusinessCredentialsComplete.js";import{useClientSideCart as u}from"../../../components/e-commerce/cart/hooks.js";import{useSession as m}from"../../auth/SessionContext.js";import p from"../../../lib/isVATValid.js";import c from"../../../lib/isEORIValid.js";var f={confirmations:{itemsInCart:!1,customerProfileComplete:!1,companyAddressComplete:!1,deliveryAddressComplete:!1,billingAddressComplete:!1,businessCredentailsComplete:!1,hasVAT:!1,hasEORI:!1,hasValidatedVAT:!1,hasValidatedEORI:!1},delivery_options:[{id:1,label:"ptt"}],payment_options:[{id:1,label:"ideal"}],prefersBillingAddress:!0,prefersDeliveryAddress:!0,customer_internal_reference:""},_=n({state:f,runAllChecks:function(){},togglePrefersBillingAddress:function(){},togglePrefersDeliveryAddress:function(){},setCustomerInternalReference:function(){}}),v=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}},E=function(r){var o=r.children,n=e(l(v,f),2),E=n[0],A=n[1],R=m(),C=R.user;R.loading,R.error;var y=u(),S=function(){var e,r,s,l,i,o,n,u,m,f,_=y.state.items.length>0,v=!!(null==C?void 0:C.customer_profile)&&Object.values(t(null==C?void 0:C.customer_profile)).every((function(e){return!0===e})),E=d(null===(e=null==C?void 0:C.customer_profile)||void 0===e?void 0:e.company_address),R=d(null===(r=null==C?void 0:C.customer_profile)||void 0===r?void 0:r.delivery_address),S=d(null===(s=null==C?void 0:C.customer_profile)||void 0===s?void 0:s.billing_address),b=a(null===(l=null==C?void 0:C.customer_profile)||void 0===l?void 0:l.business_credentials),I=Boolean(null===(o=null===(i=null==C?void 0:C.customer_profile)||void 0===i?void 0:i.business_credentials)||void 0===o?void 0:o.VAT_number),g=Boolean(null===(u=null===(n=null==C?void 0:C.customer_profile)||void 0===n?void 0:n.business_credentials)||void 0===u?void 0:u.EORI_number),T=p(null===(m=null==C?void 0:C.customer_profile)||void 0===m?void 0:m.business_credentials),D=c(null===(f=null==C?void 0:C.customer_profile)||void 0===f?void 0:f.business_credentials);A({type:"UPDATE_CONFIRMATIONS",payload:{itemsInCart:_,customerProfileComplete:v,companyAddressComplete:E,deliveryAddressComplete:R,billingAddressComplete:S,businessCredentailsComplete:b,hasVAT:I,hasEORI:g,hasValidatedVAT:T,hasValidatedEORI:D}})};i((function(){C&&S()}),[C]);var b={state:E,runAllChecks:S,togglePrefersBillingAddress:function(){A({type:"SET_PREFERS_BILLING_ADDRESS",payload:{prefersBillingAddress:!E.prefersBillingAddress}})},togglePrefersDeliveryAddress:function(){A({type:"SET_PREFERS_DELIVERY_ADDRESS",payload:{prefersDeliveryAddress:!E.prefersDeliveryAddress}})},setCustomerInternalReference:function(e){A({type:"SET_CUSTOMER_INTERNAL_REFERENCE",payload:{customer_internal_reference:e}})}};return s.createElement(_.Provider,{value:b},o)},A=function(){return o(_)};export{E as CheckoutProvider,A as useCheckout};