1"use strict";(self.webpackChunkbarn2door_webapp_client=self.webpackChunkbarn2door_webapp_client||[]).push([[203],{40203:(e,t,n)=>{n.r(t),n.d(t,{default:()=>C});var r=n(63696),a=n(20881),o=n(61971),c=n(52821),i=n(44549),l=n(13372),u=n(47435),s=n(20453),p=n(62578),f=n(750),m=n(38796),h=n(32661),y=n(58462),v=n(52308);function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function b(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o=[],c=!0,i=!1;try{for(n=n.call(e);!(c=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);c=!0);}catch(e){i=!0,a=e}finally{try{c||null==n.return||n.return()}finally{if(i)throw a}}return o}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var E=function(e){switch(e){case"paid":return"check-circle";case"pending":return"clock-o";case"overdue":return"bell";default:return"ban"}};const g=function(e){var t=e.invoice,n=e.user,a=e.seller,o=e.handlePay,c=b((0,r.useState)(""),2),i=c[0],l=c[1];t.order.isVoid&&(t.status="voided");var u=function(e){var t=0;return e.order.lineItems.forEach(function(e){t+=parseFloat(e.total)}),t}(t);return r.createElement("div",{className:"invoice-view"},r.createElement("section",{className:"invoice-header"},r.createElement("h1",null,"paid"===t.status?"Viewing":"Reviewing"," Invoice #",a.hashId,"-",t.id),r.createElement("hr",null),r.createElement("h2",null,"Status:",r.createElement("span",{className:"status ".concat(t.status)},"unpaid"!==t.status&&r.createElement("i",{className:"fa fa-".concat(E(t.status))}),t.status)),r.createElement("h3",null,"Billed to: ",n.contactEmail),r.createElement("h3",null,"Payment Due Date:"," ",t.terms===h.Ay.cashOnDelivery?"On Delivery":y.SX(t.due).format("l")),("paid"===t.status||"pending"===t.status)&&r.createElement("h3",null,"paid"===t.status?"Paid on":"Invoice sent on"," ",y.SX(t.updatedAt).format("l")),r.createElement("hr",null)),r.createElement("section",{className:"invoice-payment-methods"},!t.order.isVoid&&t.paymentOptionType!==m.A.paperCheck&&"pending"!==t.status&&"paid"!==t.status&&r.createElement(v.A,{handlePay:o,handlePaymentOptionChange:l,needsSaveCard:!0,paymentText:"Pay Invoice",paymentTotal:u,showPaperCheck:t.paymentOptionType===m.A.multiplePaymentTypes,user:n}),(t.paymentOptionType===m.A.paperCheck||t.paymentOptionType===m.A.multiplePaymentTypes&&"paperCheck"===i)&&"paid"!==t.status&&r.createElement("p",null,"Contact ",a.businessName," about how to submit payment by emailing them at"," ",r.createElement("a",{className:"inline-link",href:"mailto:".concat(a.users[0].contactEmail,"?subject=Invoice%20#").concat(a.hashId,"-").concat(t.id)},a.users[0].contactEmail),".")),r.createElement("embed",{className:"pdf-viewer",height:"100%",src:"/invoice/".concat(t.hashId),width:"100%"}),r.createElement("p",{className:"pdf-help"},"Having trouble viewing the PDF?"," ",r.createElement("a",{className:"inline-link",href:"/invoice/".concat(t.hashId),target:"_blank"},"Download it here"),"."))};var w=n(25290),O=n(1724),P=n(91641);function I(e,t,n){return t=N(t),function(e,t){if(t&&("object"==(n=t,n&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;var n;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,T()?Reflect.construct(t,n||[],N(e).constructor):t.apply(e,n))}function k(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function j(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}
1function N(e){return N=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},N(e)}function S(e,t){return S=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},S(e,t)}function T(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(T=function(){return!!e})()}var A=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),I(this,t,arguments)}var n,c,l;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&S(e,t)}(t,e),n=t,c=[{key:"componentDidMount",value:function(){var e=this.props.location,t=e.search,n=e.pathname,r=(0,o.parse)(t);if(r.invoiceToken)this.props.fetchInvoice(r.invoiceToken);else{var a=n.split("/");a.pop(),this.props.history.replace(a.join("/"))}}},{key:"render",value:function(){var e=this.props,t=e.isInvoiceLoading,n=e.user,o=e.seller,c=e.invoice,l=e.invoiceError,u=e.match,s=e.location,p=null;if(t)p=r.createElement(w.A,{msg:"Loading Invoice...",overlay:!0});else if(!c||l){var f=i.Bb.generatePath(i.am.LOGIN,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){j(e,t,n[t])})}return e}({},u.params));p=r.createElement("div",{className:"invoice-error"},r.createElement("h1",null,"Please login to view this invoice."),r.createElement(P.N,{href:"".concat(f,"?next=").concat(encodeURIComponent("".concat(s.pathname).concat(s.search)))},r.createElement(a.$n,{className:"invoice-error-button",size:a.Mp.STRETCH},"View Invoice")))}else p=r.createElement(g,{handlePay:this.props.handlePayInvoice,invoice:c,seller:o,user:n});return r.createElement("div",{className:"invoice-page"},p,!t&&r.createElement(O.A,null))}}],c&&k(n.prototype,c),l&&k(n,l),t}(r.Component);const C=(0,c.Ng)(function(e){return{user:f.wz(e),invoice:p.Y4(e),isInvoiceLoading:p.aZ(e),invoiceError:p.ie(e),seller:s.XV(e)}},function(e){return{fetchInvoice:function(t){return e(u.T4(t))},handlePayInvoice:function(t){return e(l.xZ(t))}}})(A)}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.