1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[461],{70090:function(e,t,r){Promise.resolve().then(r.bind(r,92413))},92413:function(e,t,r){"use strict";r.r(t);var n=r(57437),s=r(2265),a=r(24033),l=r(23611),o=r(29172),i=r(59185),c=r(69584),d=r(54829),u=r(44556),f=r(24086),m=r(7532);t.default=()=>{let e=(0,a.useRouter)();(0,s.useEffect)(()=>{let checkLogin=async()=>{let t=await (0,u.ts)();t||e.push("/auth")};checkLogin()},[e]);let[t,r]=(0,s.useState)(!1),[p,h]=(0,s.useState)(!1),[x,g]=(0,s.useState)([]),[b,y]=(0,s.useState)(0),[j,v]=(0,s.useState)(""),[w,N]=(0,s.useState)(!1),[k,O]=(0,s.useState)(!1),[S,C]=(0,s.useState)(""),[_,P]=(0,s.useState)(""),[U,I]=(0,s.useState)(""),[E,D]=(0,s.useState)(!1),[B,F]=(0,s.useState)(!1),[z,A]=(0,s.useState)("asap"),[T,R]=(0,s.useState)(""),exchangeAuthCodeForTokens=async e=>{try{let t=await (0,u.ts)();if(t){let r=await t.getIdToken(),n=await d.Z.post("/api/exchange_token",{code:e},{headers:{Authorization:"Bearer ".concat(r)}});if(200===n.status){let e=n.data,t=e.access_token,r=e.refresh_token;P(t),I(r)}}else console.error("No user is logged in")}catch(e){console.error("Error exchanging auth code for tokens:",e)}};(0,s.useEffect)(()=>{let e=new URLSearchParams(window.location.search),t=e.get("code"),n=e.get("state"),s=e.get("realmId");t&&n&&s&&(O(!0),exchangeAuthCodeForTokens(t)),"true"===e.get("actionCompleted")&&r(!0)},[]);let handleFiles=e=>{let t=Array.from(e);g(t),v("")},handleFileUpload=async()=>{if(0===x.length)return;N(!0),v("Uploading...");let e=await (0,u.ts)();if(!e){alert("No user is logged in. Please log in to upload files."),N(!1);return}let t=e.uid;for(let e of x){let n=(0,c.iH)(i.tO,"uploads/".concat(t,"/").concat(e.name)),s=(0,c.B0)(n,e);s.on("state_changed",e=>{let t=e.bytesTransferred/e.totalBytes*100;y(t),v("Uploading: ".concat(Math.round(t),"%"))},e=>{console.error(e),v("Upload failed. Please try again."),N(!1)},()=>{v("Upload succeeded. You can upload more or confirm."),r(!0),N(!1)})}},handleConfirm=async()=>{try{let e=await (0,u.ts)();if(e){let r=e.uid;await (0,f.pl)((0,f.JU)(i.db,"settings",r),{useEmail:E,usePhone:B,scheduleOption:z,specificDate:"specific"===z?T:null,isQuickBooksConnected:k,selectedChartOfAccount:S,actionCompleted:t},{merge:!0}),console.log("Settings saved successfully!")}else console.warn("No user logged in, cannot save settings.")}catch(e){console.error("Error saving settings:",e)}e.push("/dashboard")};return(0,n.jsx)("div",{className:"flex items-center justify-center p-6 min-h-screen bg-gray-100",children:(0,n.jsxs)("div",{className:"w-full max-w-4xl p-8 bg-white rounded-lg shadow-lg",children:[(0,n.jsx)("h1",{className:"mb-6 text-2xl font-bold text-center",children:"Onboarding"}),(0,n.jsx)("div",{className:"mb-8 text-center text-sm text-gray-600",children:(0,n.jsxs)("p",{children:["To start, upload your invoices or set your system to cc"," ",(0,n.jsx)("strong",{children:"[email protected]"})," ","for your outbound invoices in your TMS/Accounting system."]})}),(0,n.jsxs)("div",{className:"grid gap-6 grid-cols-1 md:grid-cols-2",children:[(0,n.jsxs)("div",{className:"flex flex-col items-center p-6 bg-gray-50 rounded-lg",children:[(0,n.jsxs)("div",{className:"flex mb-4 space-x-4",children:[(0,n.jsx)(o.l7t,{className:"text-4xl text-green-600"}),(0,n.jsx)(o.GzT,{className:"text-4xl text-green-700"}),(0,n.jsx)(o.yRW,{className:"text-4xl text-red-600"})]}),(0,n.jsx)("h2",{className:"mb-2 text-xl font-semibold",children:"Upload Data"}),(0,n.jsx)("p",{className:"mb-4 text-sm text-center",children:"Upload CSV, Excel, or PDF files to add your data manually."}),(0,n.jsx)(l.z,{className:"px-4 py-2 text-white bg-gray-600 rounded",onClick:()=>{h(!0)},children:"Upload Files"}),p&&(0,n.jsxs)("div",{className:"w-full p-4 mt-4 text-center items-center border-2 border-dashed border-gray-400 rounded-lg",onDrop:e=>{e.preventDefault();let t=e.dataTransfer.files;handleFiles(t)},onDragOver:e=>{e.preventDefault()},children:[(0,n.jsx)("p",{className:"mb-2",children:"Drag and drop files here, or click to select files"}),(0,n.jsx)("input",{type:"file",multiple:!0,onChange:e=>{let t=e.target.files;t&&handleFiles(t)},className:"hidden",id:"fileInput"}),(0,n.jsx)("label",{htmlFor:"fileInput",className:"cursor-pointer",children:(0,n.jsx)("div",{className:"inline-block px-4 py-2 text-white bg-blue-600 rounded",children:"Browse Files"})}),x.length>0&&(0,n.jsxs)("div",{className:"w-full mt-4 text-center",children:[(0,n.jsx)("p",{className:"font-semibold",children:"Selected Files:"}),(0,n.jsx)("ul",{className:"list-inside list-disc",children:x.map((e,t)=>(0,n.jsx)("li",{children:e.name},t))}),(0,n.jsx)("div",{className:"flex justify-center mt-4",children:(0,n.jsx)(l.z,{className:"px-4 py-2 mt-4 text-white rounded ".concat(w?"bg-gray-400 cursor-not-allowed":"bg-green-600"),onClick:handleFileUpload,disabled:w,children:w?"Uploading...":"Upload"})}),(0,n.jsx)("div",{className:"mt-2 text-center text-sm text-green-600 font-semibold",children:j})]})]})]}),(0,n.jsxs)("div",{className:"flex flex-col items-center p-6 bg-gray-50 rounded-lg",children:[(0,n.jsx)("div",{className:"mb-4 text-4xl font-bold text-green-600",children:"QB"}),(0,n.jsx)("h2",{className:"mb-2 text-xl font-semibold",children:"Connect QuickBooks"}),(0,n.jsx)("p",{className:"mb-4 text-sm text-center",children:"Integrate your QuickBooks account to import financial data seamlessly."}),(0,n.jsx)(l.z,{className:"px-4 py-2 text-white bg-green-600 rounded",onClick:()=>{let e=encodeURIComponent("com.intuit.quickbooks.accounting"),t=encodeURIComponent("https://billflow.ai/onboarding"),r=encodeURIComponent("random_state_string"),n="https://appcenter.intuit.com/connect/oauth2?client_id=".concat("ABhPLHVxOljswTVfrk3c5Hra1of40lLHv62YHKIH4gM9TwvlDc","&redirect_uri=").concat(t,"&response_type=code&scope=").concat(e,"&state=").concat(r);window.location.href=n},disabled:k,children:k?"Connected":"Connect QuickBooks"}),k&&(0,n.jsxs)("div",{className:"mt-6 w-full text-center",children:[(0,n.jsx)("label",{htmlFor:"chartOfAccountSelect",className:"block mb-2 font-semibold",children:"Select Chart of Account to Sync:"}),(0,n.jsxs)(m.Ph,{value:S,onValueChange:e=>C(e),disabled:!k,children:[(0,n.jsx)(m.i4,{className:"w-full px-4 py-2 border rounded-lg",children:(0,n.jsx)("span",{children:S||"Select an account"})}),(0,n.jsx)(m.Bw,{children:["Checking","Saving","Undeposited Funds"].map((e,t)=>(0,n.jsx)(m.Ql,{value:e,children:e},t))})]})]})]})]}),(0,n.jsxs)("div",{className:"mt-8 p-6 bg-gray-50 rounded-lg",children:[(0,n.jsx)("h2",{className:"mb-4 text-xl font-semibold text-center",children:"Settings"}),(0,n.jsxs)("div",{className:"mb-6",children:[(0,n.jsx)("p",{className:"mb-2 font-semibold",children:"Communication Method:"}),(0,n.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,n.jsxs)("label",{className:"flex items-center space-x-2",children:[(0,n.jsx)("input",{type:"checkbox",checked:E,onChange:()=>D(!E)}),(0,n.jsx)("span",{children:"Email"})]}),(0,n.jsxs)("label",{className:"flex items-center space-x-2",children:[(0,n.jsx)("input",{type:"checkbox",checked:B,onChange:()=>F(!B)}),(0,n.jsx)("span",{children:"Phone"})]})]})]}),(0,n.jsxs)("div",{className:"mb-6",children:[(0,n.jsx)("p",{className:"mb-2 font-semibold",children:"Schedule:"}),(0,n.jsxs)(m.Ph,{value:z,onValueChange:e=>A(e),children:[(0,n.jsx)(m.i4,{className:"w-full px-4 py-2 border rounded-lg",children:(0,n.jsx)("span",{children:"asap"===z?"As soon as possible":"afterDue"===z?"After the due date":"specific"===z?"Specific date":"Select a schedule option"})}),(0,n.jsxs)(m.Bw,{children:[(0,n.jsx)(m.Ql,{value:"asap",children:"As soon as possible"}),(0,n.jsx)(m.Ql,{value:"afterDue",children:"After the due date"}),(0,n.jsx)(m.Ql,{value:"specific",children:"Specific date"})]})]}),"specific"===z&&(0,n.jsxs)("div",{className:"mt-4",children:[(0,n.jsx)("label",{className:"block mb-1 font-semibold",htmlFor:"specificDate",children:"Choose a Date:"}),(0,n.jsx)("input",{type:"date",id:"specificDate",value:T,onChange:e=>R(e.target.value),className:"p-2 border border-gray-400 rounded-lg"})]})]})]}),(0,n.jsx)("div",{className:"mt-8 text-center",children:(0,n.jsx)("button",{onClick:handleConfirm,disabled:!(t||k),className:"".concat((0,l.d)()," px-6 py-2 bg-blue-600 text-white rounded-lg ").concat(t||k?"":"opacity-50 cursor-not-allowed"),children:"Confirm"})})]})})}},44556:function(e,t,r){"use strict";r.d(t,{Ib:function(){return logIn},ni:function(){return logOut},ts:function(){return getCurrentUser},y1:function(){return signUp}});var n=r(53085),s=r(59185);let signUp=(e,t)=>{let r=(0,n.v0)(s.l2);return(0,n.Xb)(r,e,t)},logIn=(e,t)=>{let r=(0,n.v0)(s.l2);return(0,n.e5)(r,e,t).then(e=>(console.log("User ID:",e.user.uid),e)).catch(e=>{throw console.error("Error logging in:",e),e})},logOut=()=>{let e=(0,n.v0)(s.l2);return(0,n.w7)(e)},getCurrentUser=()=>{let e=(0,n.v0)(s.l2);return new Promise((t,r)=>{let s=(0,n.Aj)(e,e=>{s(),t(e)},r)})}},23611:function(e,t,r){"use strict";r.d(t,{d:function(){return i},z:function(){return c}});
1var n=r(57437),s=r(2265),a=r(67256),l=r(7404),o=r(81628);let i=(0,l.j)("inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none ring-offset-background mb-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"underline-offset-4 hover:underline text-primary"},size:{default:"h-10 py-2 px-4",sm:"h-9 px-3 rounded-md",lg:"h-11 px-8 rounded-md",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),c=s.forwardRef((e,t)=>{let{className:r,variant:s,size:l,asChild:c=!1,...d}=e,u=c?a.g7:"button";return(0,n.jsx)(u,{className:(0,o.cn)(i({variant:s,size:l,className:r})),ref:t,...d})});c.displayName="Button"},7532:function(e,t,r){"use strict";r.d(t,{Bw:function(){return p},Ph:function(){return d},Ql:function(){return x},i4:function(){return u}});var n=r(57437),s=r(2265),a=r(12372),l=r(83523),o=r(9224),i=r(62442),c=r(81628);let d=a.fC;a.ZA,a.B4;let u=s.forwardRef((e,t)=>{let{className:r,children:s,...o}=e;return(0,n.jsxs)(a.xz,{ref:t,className:(0,c.cn)("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",r),...o,children:[s,(0,n.jsx)(a.JO,{asChild:!0,children:(0,n.jsx)(l.Z,{className:"h-4 w-4 opacity-50"})})]})});u.displayName=a.xz.displayName;let f=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,n.jsx)(a.u_,{ref:t,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",r),...s,children:(0,n.jsx)(o.Z,{className:"h-4 w-4"})})});f.displayName=a.u_.displayName;let m=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,n.jsx)(a.$G,{ref:t,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",r),...s,children:(0,n.jsx)(l.Z,{className:"h-4 w-4"})})});m.displayName=a.$G.displayName;let p=s.forwardRef((e,t)=>{let{className:r,children:s,position:l="popper",...o}=e;return(0,n.jsx)(a.h_,{children:(0,n.jsxs)(a.VY,{ref:t,className:(0,c.cn)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===l&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",r),position:l,...o,children:[(0,n.jsx)(f,{}),(0,n.jsx)(a.l_,{className:(0,c.cn)("p-1","popper"===l&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),(0,n.jsx)(m,{})]})})});p.displayName=a.VY.displayName;let h=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,n.jsx)(a.__,{ref:t,className:(0,c.cn)("px-2 py-1.5 text-sm font-semibold",r),...s})});h.displayName=a.__.displayName;let x=s.forwardRef((e,t)=>{let{className:r,children:s,...l}=e;return(0,n.jsxs)(a.ck,{ref:t,className:(0,c.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r),...l,children:[(0,n.jsx)("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,n.jsx)(a.wU,{children:(0,n.jsx)(i.Z,{className:"h-4 w-4"})})}),(0,n.jsx)(a.eT,{children:s})]})});x.displayName=a.ck.displayName;let g=s.forwardRef((e,t)=>
1{let{className:r,...s}=e;return(0,n.jsx)(a.Z0,{ref:t,className:(0,c.cn)("-mx-1 my-1 h-px bg-muted",r),...s})});g.displayName=a.Z0.displayName},59185:function(e,t,r){"use strict";r.d(t,{db:function(){return i},l2:function(){return o},tO:function(){return c}});var n=r(20994),s=r(53085),a=r(24086),l=r(69584);let o=(0,n.ZF)({apiKey:"AIzaSyBGu1ZZ8exh3iaFMA-irfQa-xUNdnKBEXo",authDomain:"billflow-f3cb4.firebaseapp.com",projectId:"billflow-f3cb4",storageBucket:"billflow-f3cb4.appspot.com",messagingSenderId:"894797460790",appId:"1:894797460790:web:deda87754c3827498baf97",measurementId:"G-00QHGNKT0K"});(0,s.v0)(o);let i=(0,a.ad)(o),c=(0,l.cF)(o)},81628:function(e,t,r){"use strict";r.d(t,{cn:function(){return cn}});var n=r(50348),s=r(23986);function cn(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,s.m)((0,n.W)(t))}},24033:function(e,t,r){e.exports=r(50094)},43118:function(e,t,r){"use strict";r.d(t,{w_:function(){return GenIcon}});var n=r(2265),s={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},a=n.createContext&&n.createContext(s),l=["attr","size","title"];function _extends(){return(_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach(function(t){var n,s;n=t,s=r[t],(n=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(n))in e?Object.defineProperty(e,n,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[n]=s}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function GenIcon(e){return t=>n.createElement(IconBase,_extends({attr:_objectSpread({},e.attr)},t),function Tree2Element(e){return e&&e.map((e,t)=>n.createElement(e.tag,_objectSpread({key:t},e.attr),Tree2Element(e.child)))}(e.child))}function IconBase(e){var elem=t=>{var r,{attr:s,size:a,title:o}=e,i=function(e,t){if(null==e)return{};var r,n,s=function(e,t){if(null==e)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}(e,l),c=a||t.size||"1em";return t.className&&(r=t.className),e.className&&(r=(r?r+" ":"")+e.className),n.createElement("svg",_extends({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,s,i,{className:r,style:_objectSpread(_objectSpread({color:e.color||t.color},t.style),e.style),height:c,width:c,xmlns:"http://www.w3.org/2000/svg"}),o&&n.createElement("title",null,o),e.children)};return void 0!==a?n.createElement(a.Consumer,null,e=>elem(e)):elem(s)}}},function(e){e.O(0,[358,67,699,951,996,421,468,829,397,971,472,744],function(){return e(e.s=70090)}),_N_E=e.O()}]);
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.