UNPKG

friday-widgets

Version:

Professional embeddable accounting widgets for vertical SaaS platforms. Layer Financial-inspired design with comprehensive financial reporting capabilities.

833 lines (731 loc) 51.2 kB
var FridayLinkAccountsWidget=function(t){"use strict";function e(t,e,s,r){var i,n=arguments.length,o=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,s,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(o=(n<3?i(o):n>3?i(e,s,o):i(e,s))||o);return n>3&&o&&Object.defineProperty(e,s,o),o}"function"==typeof SuppressedError&&SuppressedError; /** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const s=globalThis,r=s.ShadowRoot&&(void 0===s.ShadyCSS||s.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),n=new WeakMap;let o=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(r&&void 0===t){const s=void 0!==e&&1===e.length;s&&(t=n.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&n.set(e,t))}return t}toString(){return this.cssText}};const a=(t,...e)=>{const s=1===t.length?t[0]:e.reduce((e,s,r)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[r+1],t[0]);return new o(s,t,i)},c=r?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return(t=>new o("string"==typeof t?t:t+"",void 0,i))(e)})(t):t,{is:d,defineProperty:l,getOwnPropertyDescriptor:h,getOwnPropertyNames:u,getOwnPropertySymbols:p,getPrototypeOf:g}=Object,m=globalThis,y=m.trustedTypes,v=y?y.emptyScript:"",f=m.reactiveElementPolyfillSupport,b=(t,e)=>t,_={toAttribute(t,e){switch(e){case Boolean:t=t?v:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let s=t;switch(e){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(t){s=null}}return s}},$=(t,e)=>!d(t,e),x={attribute:!0,type:String,converter:_,reflect:!1,useDefault:!1,hasChanged:$}; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */Symbol.metadata??=Symbol("metadata"),m.litPropertyMetadata??=new WeakMap;let w=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=x){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),r=this.getPropertyDescriptor(t,s,e);void 0!==r&&l(this.prototype,t,r)}}static getPropertyDescriptor(t,e,s){const{get:r,set:i}=h(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:r,set(e){const n=r?.call(this);i?.call(this,e),this.requestUpdate(t,n,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??x}static _$Ei(){if(this.hasOwnProperty(b("elementProperties")))return;const t=g(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(b("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(b("properties"))){const t=this.properties,e=[...u(t),...p(t)];for(const s of e)this.createProperty(s,t[s])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,s]of e)this.elementProperties.set(t,s)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const s=this._$Eu(t,e);void 0!==s&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const t of s)e.unshift(c(t))}else void 0!==t&&e.push(c(t));return e}static _$Eu(t,e){const s=e.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{if(r)t.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const r of e){const e=document.createElement("style"),i=s.litNonce;void 0!==i&&e.setAttribute("nonce",i),e.textContent=r.cssText,t.appendChild(e)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$ET(t,e){const s=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,s);if(void 0!==r&&!0===s.reflect){const i=(void 0!==s.converter?.toAttribute?s.converter:_).toAttribute(e,s.type);this._$Em=t,null==i?this.removeAttribute(r):this.setAttribute(r,i),this._$Em=null}}_$AK(t,e){const s=this.constructor,r=s._$Eh.get(t);if(void 0!==r&&this._$Em!==r){const t=s.getPropertyOptions(r),i="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:_;this._$Em=r;const n=i.fromAttribute(e,t.type);this[r]=n??this._$Ej?.get(r)??n,this._$Em=null}}requestUpdate(t,e,s){if(void 0!==t){const r=this.constructor,i=this[t];if(s??=r.getPropertyOptions(t),!((s.hasChanged??$)(i,e)||s.useDefault&&s.reflect&&i===this._$Ej?.get(t)&&!this.hasAttribute(r._$Eu(t,s))))return;this.C(t,e,s)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:s,reflect:r,wrapped:i},n){s&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,n??e??this[t]),!0!==i||void 0!==n)||(this._$AL.has(t)||(this.hasUpdated||s||(e=void 0),this._$AL.set(t,e)),!0===r&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,s]of t){const{wrapped:t}=s,r=this[e];!0!==t||this._$AL.has(e)||void 0===r||this.C(e,void 0,s,r)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(t){}firstUpdated(t){}};w.elementStyles=[],w.shadowRootOptions={mode:"open"},w[b("elementProperties")]=new Map,w[b("finalized")]=new Map,f?.({ReactiveElement:w}),(m.reactiveElementVersions??=[]).push("2.1.1"); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const A=globalThis,k=A.trustedTypes,S=k?k.createPolicy("lit-html",{createHTML:t=>t}):void 0,E="$lit$",C=`lit$${Math.random().toFixed(9).slice(2)}$`,P="?"+C,O=`<${P}>`,F=document,U=()=>F.createComment(""),T=t=>null===t||"object"!=typeof t&&"function"!=typeof t,q=Array.isArray,N="[ \t\n\f\r]",B=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,I=/-->/g,z=/>/g,L=RegExp(`>|${N}(?:([^\\s"'>=/]+)(${N}*=${N}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),R=/'/g,H=/"/g,M=/^(?:script|style|textarea|title)$/i,D=(t=>(e,...s)=>({_$litType$:t,strings:e,values:s}))(1),j=Symbol.for("lit-noChange"),W=Symbol.for("lit-nothing"),J=new WeakMap,K=F.createTreeWalker(F,129);function V(t,e){if(!q(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==S?S.createHTML(e):e}const Y=(t,e)=>{const s=t.length-1,r=[];let i,n=2===e?"<svg>":3===e?"<math>":"",o=B;for(let e=0;e<s;e++){const s=t[e];let a,c,d=-1,l=0;for(;l<s.length&&(o.lastIndex=l,c=o.exec(s),null!==c);)l=o.lastIndex,o===B?"!--"===c[1]?o=I:void 0!==c[1]?o=z:void 0!==c[2]?(M.test(c[2])&&(i=RegExp("</"+c[2],"g")),o=L):void 0!==c[3]&&(o=L):o===L?">"===c[0]?(o=i??B,d=-1):void 0===c[1]?d=-2:(d=o.lastIndex-c[2].length,a=c[1],o=void 0===c[3]?L:'"'===c[3]?H:R):o===H||o===R?o=L:o===I||o===z?o=B:(o=L,i=void 0);const h=o===L&&t[e+1].startsWith("/>")?" ":"";n+=o===B?s+O:d>=0?(r.push(a),s.slice(0,d)+E+s.slice(d)+C+h):s+C+(-2===d?e:h)}return[V(t,n+(t[s]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),r]};class G{constructor({strings:t,_$litType$:e},s){let r;this.parts=[];let i=0,n=0;const o=t.length-1,a=this.parts,[c,d]=Y(t,e);if(this.el=G.createElement(c,s),K.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(r=K.nextNode())&&a.length<o;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(E)){const e=d[n++],s=r.getAttribute(t).split(C),o=/([.?@])?(.*)/.exec(e);a.push({type:1,index:i,name:o[2],strings:s,ctor:"."===o[1]?et:"?"===o[1]?st:"@"===o[1]?rt:tt}),r.removeAttribute(t)}else t.startsWith(C)&&(a.push({type:6,index:i}),r.removeAttribute(t));if(M.test(r.tagName)){const t=r.textContent.split(C),e=t.length-1;if(e>0){r.textContent=k?k.emptyScript:"";for(let s=0;s<e;s++)r.append(t[s],U()),K.nextNode(),a.push({type:2,index:++i});r.append(t[e],U())}}}else if(8===r.nodeType)if(r.data===P)a.push({type:2,index:i});else{let t=-1;for(;-1!==(t=r.data.indexOf(C,t+1));)a.push({type:7,index:i}),t+=C.length-1}i++}}static createElement(t,e){const s=F.createElement("template");return s.innerHTML=t,s}}function X(t,e,s=t,r){if(e===j)return e;let i=void 0!==r?s._$Co?.[r]:s._$Cl;const n=T(e)?void 0:e._$litDirective$;return i?.constructor!==n&&(i?._$AO?.(!1),void 0===n?i=void 0:(i=new n(t),i._$AT(t,s,r)),void 0!==r?(s._$Co??=[])[r]=i:s._$Cl=i),void 0!==i&&(e=X(t,i._$AS(t,e.values),i,r)),e}class Z{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:s}=this._$AD,r=(t?.creationScope??F).importNode(e,!0);K.currentNode=r;let i=K.nextNode(),n=0,o=0,a=s[0];for(;void 0!==a;){if(n===a.index){let e;2===a.type?e=new Q(i,i.nextSibling,this,t):1===a.type?e=new a.ctor(i,a.name,a.strings,this,t):6===a.type&&(e=new it(i,this,t)),this._$AV.push(e),a=s[++o]}n!==a?.index&&(i=K.nextNode(),n++)}return K.currentNode=F,r}p(t){let e=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class Q{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,r){this.type=2,this._$AH=W,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=X(this,t,e),T(t)?t===W||null==t||""===t?(this._$AH!==W&&this._$AR(),this._$AH=W):t!==this._$AH&&t!==j&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>q(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==W&&T(this._$AH)?this._$AA.nextSibling.data=t:this.T(F.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:s}=t,r="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=G.createElement(V(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===r)this._$AH.p(e);else{const t=new Z(r,this),s=t.u(this.options);t.p(e),this.T(s),this._$AH=t}}_$AC(t){let e=J.get(t.strings);return void 0===e&&J.set(t.strings,e=new G(t)),e}k(t){q(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,r=0;for(const i of t)r===e.length?e.push(s=new Q(this.O(U()),this.O(U()),this,this.options)):s=e[r],s._$AI(i),r++;r<e.length&&(this._$AR(s&&s._$AB.nextSibling,r),e.length=r)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class tt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,r,i){this.type=1,this._$AH=W,this._$AN=void 0,this.element=t,this.name=e,this._$AM=r,this.options=i,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=W}_$AI(t,e=this,s,r){const i=this.strings;let n=!1;if(void 0===i)t=X(this,t,e,0),n=!T(t)||t!==this._$AH&&t!==j,n&&(this._$AH=t);else{const r=t;let o,a;for(t=i[0],o=0;o<i.length-1;o++)a=X(this,r[s+o],e,o),a===j&&(a=this._$AH[o]),n||=!T(a)||a!==this._$AH[o],a===W?t=W:t!==W&&(t+=(a??"")+i[o+1]),this._$AH[o]=a}n&&!r&&this.j(t)}j(t){t===W?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class et extends tt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===W?void 0:t}}class st extends tt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==W)}}class rt extends tt{constructor(t,e,s,r,i){super(t,e,s,r,i),this.type=5}_$AI(t,e=this){if((t=X(this,t,e,0)??W)===j)return;const s=this._$AH,r=t===W&&s!==W||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,i=t!==W&&(s===W||r);r&&this.element.removeEventListener(this.name,this,s),i&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class it{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){X(this,t)}}const nt=A.litHtmlPolyfillSupport;nt?.(G,Q),(A.litHtmlVersions??=[]).push("3.3.1");const ot=globalThis; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */class at extends w{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,s)=>{const r=s?.renderBefore??e;let i=r._$litPart$;if(void 0===i){const t=s?.renderBefore??null;r._$litPart$=i=new Q(e.insertBefore(U(),t),t,void 0,s??{})}return i._$AI(t),i})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return j}}at._$litElement$=!0,at.finalized=!0,ot.litElementHydrateSupport?.({LitElement:at});const ct=ot.litElementPolyfillSupport;ct?.({LitElement:at}),(ot.litElementVersions??=[]).push("4.2.1"); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const dt={attribute:!0,type:String,converter:_,reflect:!1,hasChanged:$},lt=(t=dt,e,s)=>{const{kind:r,metadata:i}=s;let n=globalThis.litPropertyMetadata.get(i);if(void 0===n&&globalThis.litPropertyMetadata.set(i,n=new Map),"setter"===r&&((t=Object.create(t)).wrapped=!0),n.set(s.name,t),"accessor"===r){const{name:r}=s;return{set(s){const i=e.get.call(this);e.set.call(this,s),this.requestUpdate(r,i,t)},init(e){return void 0!==e&&this.C(r,void 0,t,e),e}}}if("setter"===r){const{name:r}=s;return function(s){const i=this[r];e.call(this,s),this.requestUpdate(r,i,t)}}throw Error("Unsupported decorator location: "+r)}; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */function ht(t){return(e,s)=>"object"==typeof s?lt(t,e,s):((t,e,s)=>{const r=e.hasOwnProperty(s);return e.constructor.createProperty(s,t),r?Object.getOwnPropertyDescriptor(e,s):void 0})(t,e,s)} /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */function ut(t){return ht({...t,state:!0,attribute:!1})}class pt{constructor(t){this.config={timeout:3e4,retryAttempts:3,...t},this.defaultHeaders={"Content-Type":"application/json","X-API-Key":t.apiKey}}setBusinessContext(t){this.config.businessId=t}getBusinessContext(){return this.config.businessId}async request(t,e={}){const s=`${this.config.baseURL}${t}`,r={...this.defaultHeaders,...e.headers},i={...e,headers:r,signal:AbortSignal.timeout(this.config.timeout)};try{const t=await fetch(s,i);if(!t.ok){const e=await t.json().catch(()=>({}));return{success:!1,error:e.error||`HTTP ${t.status}: ${t.statusText}`,details:e.details}}return{success:!0,data:await t.json()}}catch(t){return console.error("API Request failed:",t),{success:!1,error:t instanceof Error?t.message:"Network error occurred"}}}async getBusinesses(){return this.request("/v1/businesses/")}async getBusiness(t){return this.request(`/v1/businesses/${t}/`)}async createBusiness(t){return this.request("/v1/businesses/",{method:"POST",body:JSON.stringify(t)})}async updateBusiness(t,e){return this.request(`/v1/businesses/${t}/`,{method:"PUT",body:JSON.stringify(e)})}async getBusinessStats(t){return this.request(`/v1/businesses/${t}/stats/`)}async lookupBusinessByExternalId(t){return this.request(`/v1/businesses/lookup/?external_id=${encodeURIComponent(t)}`)}async getInvoices(t,e){const s=new URLSearchParams({business_id:t});return e?.status&&s.append("status",e.status),e?.customer_id&&s.append("customer_id",e.customer_id),e?.date_from&&s.append("date_from",e.date_from),e?.date_to&&s.append("date_to",e.date_to),e?.overdue&&s.append("overdue","true"),e?.outstanding&&s.append("outstanding","true"),e?.search&&s.append("search",e.search),this.request(`/invoices/?${s.toString()}`)}async getInvoice(t){return this.request(`/invoices/${t}/`)}async createInvoice(t){return this.request("/invoices/",{method:"POST",body:JSON.stringify(t)})}async updateInvoice(t,e){return this.request(`/invoices/${t}/`,{method:"PUT",body:JSON.stringify(e)})}async deleteInvoice(t){return this.request(`/invoices/${t}/`,{method:"DELETE"})}async recordInvoicePayment(t,e){return this.request(`/invoices/${t}/payment/`,{method:"POST",body:JSON.stringify(e)})}async sendInvoice(t){return this.request(`/invoices/${t}/send/`,{method:"POST"})}async getInvoicePayments(t){return this.request(`/invoices/${t}/payments/list/`)}async getCustomers(t){return this.request(`/customers/?business_id=${t}`)}async getCustomer(t){return this.request(`/customers/${t}/`)}async createCustomer(t){return this.request("/customers/",{method:"POST",body:JSON.stringify(t)})}async updateCustomer(t,e){return this.request(`/customers/${t}/`,{method:"PUT",body:JSON.stringify(e)})}async archiveCustomer(t){return this.request(`/customers/${t}/archive/`,{method:"POST"})}async reactivateCustomer(t){return this.request(`/customers/${t}/reactivate/`,{method:"POST"})}async getAccounts(t,e){const s=new URLSearchParams({business_id:t});return e?.account_type&&s.append("account_type",e.account_type),void 0!==e?.is_active&&s.append("is_active",e.is_active.toString()),e?.search&&s.append("search",e.search),this.request(`/accounts/?${s.toString()}`)}async getAccount(t){return this.request(`/accounts/${t}/`)}async createAccount(t){return this.request("/accounts/",{method:"POST",body:JSON.stringify(t)})}async updateAccount(t,e){return this.request(`/accounts/${t}/`,{method:"PUT",body:JSON.stringify(e)})}async deleteAccount(t){return this.request(`/accounts/${t}/`,{method:"DELETE"})}async getBankAccounts(t){return this.request(`/accounts/bank/?business_id=${t}`)}async getAccountHierarchy(t){return this.request(`/accounts/hierarchy/?business_id=${t}`)}async syncAccount(t){return this.request(`/accounts/${t}/sync/`,{method:"POST"})}async getPayments(t,e){const s=new URLSearchParams({business_id:t});return e?.status&&s.append("status",e.status),e?.customer_id&&s.append("customer_id",e.customer_id),e?.date_from&&s.append("date_from",e.date_from),e?.date_to&&s.append("date_to",e.date_to),e?.search&&s.append("search",e.search),this.request(`/payments/?${s.toString()}`)}async getPayment(t){return this.request(`/payments/${t}/`)}async createPayment(t){return this.request("/payments/",{method:"POST",body:JSON.stringify(t)})}async updatePayment(t,e){return this.request(`/payments/${t}/`,{method:"PUT",body:JSON.stringify(e)})}async completePayment(t){return this.request(`/payments/${t}/complete/`,{method:"POST"})}async failPayment(t){return this.request(`/payments/${t}/fail/`,{method:"POST"})}async getBalanceSheet(t,e){const s=new URLSearchParams({business_id:t});return e&&s.append("effective_date",e),this.request(`/reports/balance-sheet/?${s.toString()}`)}async getPnLData(t,e,s){const r=new URLSearchParams({business_id:t,date_from:e,date_to:s});return this.request(`/reports/pnl/?${r.toString()}`)}async getCashFlowData(t,e,s){const r=new URLSearchParams({business_id:t,date_from:e,date_to:s});return this.request(`/reports/cash-flow/?${r.toString()}`)}async healthCheck(){return this.request("/health/")}formatCurrency(t,e="GBP"){const s="number"==typeof t?t:parseFloat(t.toString());return new Intl.NumberFormat("en-GB",{style:"currency",currency:e}).format(s)}formatDate(t){return new Date(t).toLocaleDateString("en-GB",{year:"numeric",month:"short",day:"numeric"})}validateBusinessAccess(t){return this.config.businessId===t||!!t}handleApiError(t){let e="An unexpected error occurred";return 401===t.response?.status?e="Authentication failed. Check your API key.":404===t.response?.status?e="Business not found or not accessible.":403===t.response?.status?e="Permission denied. Business not accessible.":t.response?.data?.error&&(e=t.response.data.error),{success:!1,error:e,details:t.response?.data?.details}}}class gt extends at{constructor(){super(...arguments),this.apiKey="",this.businessId="",this.theme="light",this.baseUrl="http://localhost:8000/api",this.loading=!1,this.error=null,this.apiClient=null}connectedCallback(){super.connectedCallback(),this.initializeApiClient(),this.loadData()}initializeApiClient(){if("undefined"!=typeof window&&window.FridayProvider){const t=window.FridayProvider.getApiClient();if(t)return void(this.apiClient=t);const e=window.FridayProvider.getWidgetConfig();if(e)return void(this.apiClient=new pt({baseURL:e.baseUrl,apiKey:e.apiKey,businessId:e.businessId}))}this.apiKey?this.apiClient=new pt({baseURL:this.baseUrl,apiKey:this.apiKey,businessId:this.businessId||void 0}):this.setError("API key is required. Configure FridayProvider or provide api-key attribute.")}async loadData(){}setError(t){if(this.error=t,this.loading=!1,this.emitEvent("error",{message:t}),"undefined"!=typeof window&&window.FridayProvider)try{window.FridayProvider.handleError(new Error(t))}catch(t){}}clearError(){this.error=null}handleApiError(t,e="API request"){let s=`${e} failed`;t?.error?s=t.error:t?.message?s=t.message:"string"==typeof t&&(s=t),t?.details&&(s+=` (${t.details})`),this.setError(s),this.emitEvent("api-error",{context:e,error:t,message:s})}async makeApiRequest(t,e="Request"){try{if(this.setLoading(!0),!this.apiClient)throw new Error("API client not initialized");const s=await t();return s.success?(this.clearError(),s.data||null):(this.handleApiError(s,e),null)}catch(t){return this.handleApiError(t,e),null}finally{this.setLoading(!1)}}setLoading(t){this.loading=t,t&&this.clearError()}emitEvent(t,e={}){const s={type:t,data:e,timestamp:Date.now()};this.dispatchEvent(new CustomEvent(`friday-${t}`,{detail:s,bubbles:!0,composed:!0}))}renderLoading(){return D` <div class="Friday__loading"> <div class="Friday__spinner"></div> <span>Loading...</span> </div> `}renderError(){return D` <div class="Friday__error"> <span>⚠️ ${this.error}</span> </div> `}static get baseStyles(){return a` @import url('https://rsms.me/inter/inter.css'); :host { display: block; /* Friday Design System - Layer Financial Inspired */ --color-black: #1a1a1a; --color-white: white; --color-info: #0968f8; --color-info-bg: #d6e6ff; --color-info-fg: #0056d7; --color-success: hsl(145deg 45% 42%); --color-success-bg: hsl(145deg 59% 86%); --color-success-fg: hsl(145deg 63% 29%); --color-warning: hsl(43deg 100% 44%); --color-warning-bg: hsl(43deg 100% 84%); --color-warning-fg: hsl(43deg 88% 26%); --color-error: hsl(0deg 76% 50%); --color-error-bg: hsl(0deg 83% 86%); --color-error-fg: hsl(0deg 88% 32%); --color-dark-h: 220; --color-dark-s: 15%; --color-dark-l: 7%; --color-dark: hsl(var(--color-dark-h) var(--color-dark-s) var(--color-dark-l)); --color-base-0: #fff; --color-base-50: hsl(var(--color-dark-h) 5% 98%); --color-base-100: hsl(var(--color-dark-h) 5% 95%); --color-base-200: hsl(var(--color-dark-h) 5% 91%); --color-base-300: hsl(var(--color-dark-h) 6% 85%); --color-base-400: hsl(var(--color-dark-h) 7% 75%); --color-base-500: hsl(var(--color-dark-h) 8% 50%); --color-base-600: hsl(var(--color-dark-h) 10% 40%); --color-base-700: hsl(var(--color-dark-h) 12% 27%); --color-base-800: hsl(var(--color-dark-h) 15% 20%); --color-base-900: hsl(var(--color-dark-h) 18% 14%); --text-color-primary: var(--color-dark); --text-color-secondary: var(--color-base-600); --text-color-muted: var(--color-base-500); --text-color-inverse: var(--color-white); --bg-primary: var(--color-base-0); --bg-secondary: var(--color-base-50); --bg-tertiary: var(--color-base-100); --bg-element-hover: var(--color-base-100); --border-primary: var(--color-base-200); --border-secondary: var(--color-base-300); --border-focus: var(--color-info); --font-family: 'InterVariable', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; --text-2xs: 10px; --text-xs: 11px; --text-sm: 12px; --text-md: 14px; --text-lg: 16px; --text-xl: 18px; --text-2xl: 20px; --text-3xl: 24px; --font-weight-normal: 460; --font-weight-medium: 500; --font-weight-semibold: 540; --font-weight-bold: 600; --spacing-2xs: 6px; --spacing-xs: 8px; --spacing-sm: 12px; --spacing-md: 16px; --spacing-lg: 20px; --spacing-xl: 24px; --spacing-2xl: 32px; --spacing-3xl: 40px; --spacing-4xl: 48px; --radius-sm: 6px; --radius-md: 8px; --radius-lg: 12px; --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06); --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); --transition-fast: 150ms ease; } .Friday__component { font-family: var(--font-family); font-size: var(--text-md); line-height: 1.5; color: var(--text-color-primary); background: var(--bg-primary); border: 1px solid var(--border-primary); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); overflow: hidden; } .Friday__loading { display: flex; align-items: center; justify-content: center; padding: var(--spacing-4xl); color: var(--text-color-muted); font-size: var(--text-sm); gap: var(--spacing-xs); } .Friday__spinner { width: 20px; height: 20px; border: 2px solid var(--border-primary); border-top-color: var(--color-info); border-radius: 50%; animation: Friday__spin 1s linear infinite; } @keyframes Friday__spin { to { transform: rotate(360deg); } } .Friday__error { display: flex; align-items: center; gap: var(--spacing-xs); padding: var(--spacing-md); margin: var(--spacing-md); background: var(--color-error-bg); color: var(--color-error-fg); border: 1px solid var(--color-error); border-radius: var(--radius-sm); font-size: var(--text-sm); } .Friday__header { display: flex; align-items: center; justify-content: space-between; padding: var(--spacing-lg) var(--spacing-xl); border-bottom: 1px solid var(--border-primary); background: var(--bg-secondary); } .Friday__header-title { font-size: var(--text-xl); font-weight: var(--font-weight-semibold); color: var(--text-color-primary); margin: 0; } .Friday__header-actions { display: flex; align-items: center; gap: var(--spacing-sm); } .Friday__content { padding: var(--spacing-xl); } .Friday__button { display: inline-flex; align-items: center; justify-content: center; gap: var(--spacing-xs); padding: var(--spacing-xs) var(--spacing-md); border: 1px solid transparent; border-radius: var(--radius-sm); font-family: var(--font-family); font-size: var(--text-sm); font-weight: var(--font-weight-medium); line-height: 1.5; text-decoration: none; cursor: pointer; transition: all var(--transition-fast); white-space: nowrap; user-select: none; } .Friday__button:disabled { opacity: 0.5; cursor: not-allowed; } .Friday__button--primary { background: var(--color-info); color: var(--text-color-inverse); border-color: var(--color-info); } .Friday__button--primary:hover:not(:disabled) { background: var(--color-info-fg); border-color: var(--color-info-fg); } .Friday__button--secondary { background: var(--bg-primary); color: var(--text-color-primary); border-color: var(--border-primary); } .Friday__button--secondary:hover:not(:disabled) { background: var(--bg-element-hover); border-color: var(--border-secondary); } .Friday__button--success { background: var(--color-success); color: var(--text-color-inverse); border-color: var(--color-success); } .Friday__button--success:hover:not(:disabled) { background: var(--color-success-fg); border-color: var(--color-success-fg); } .Friday__button--error { background: var(--color-error); color: var(--text-color-inverse); border-color: var(--color-error); } .Friday__button--sm { padding: var(--spacing-2xs) var(--spacing-sm); font-size: var(--text-xs); } .Friday__input { display: block; width: 100%; padding: var(--spacing-xs) var(--spacing-sm); border: 1px solid var(--border-primary); border-radius: var(--radius-sm); font-family: var(--font-family); font-size: var(--text-sm); line-height: 1.5; color: var(--text-color-primary); background: var(--bg-primary); transition: all var(--transition-fast); } .Friday__input:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px hsla(217, 100%, 50%, 0.1); } .Friday__select { display: block; width: 100%; padding: var(--spacing-xs) var(--spacing-sm); border: 1px solid var(--border-primary); border-radius: var(--radius-sm); font-family: var(--font-family); font-size: var(--text-sm); color: var(--text-color-primary); background: var(--bg-primary); cursor: pointer; transition: all var(--transition-fast); } .Friday__table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); } .Friday__table th, .Friday__table td { padding: var(--spacing-sm) var(--spacing-md); text-align: left; border-bottom: 1px solid var(--border-primary); } .Friday__table th { font-weight: var(--font-weight-semibold); color: var(--text-color-secondary); background: var(--bg-secondary); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.05em; } .Friday__table tbody tr:hover { background: var(--bg-element-hover); } .Friday__badge { display: inline-flex; align-items: center; padding: 2px var(--spacing-xs); border-radius: 9999px; font-size: var(--text-2xs); font-weight: var(--font-weight-medium); text-transform: uppercase; letter-spacing: 0.05em; } .Friday__badge--success { background: var(--color-success-bg); color: var(--color-success-fg); } .Friday__badge--warning { background: var(--color-warning-bg); color: var(--color-warning-fg); } .Friday__badge--error { background: var(--color-error-bg); color: var(--color-error-fg); } .Friday__badge--info { background: var(--color-info-bg); color: var(--color-info-fg); } /* Typography utilities */ .Friday__text-xs { font-size: var(--text-xs); } .Friday__text-sm { font-size: var(--text-sm); } .Friday__text-md { font-size: var(--text-md); } .Friday__text-lg { font-size: var(--text-lg); } .Friday__text-muted { color: var(--text-color-muted); } .Friday__text-secondary { color: var(--text-color-secondary); } .Friday__font-medium { font-weight: var(--font-weight-medium); } .Friday__font-semibold { font-weight: var(--font-weight-semibold); } .Friday__font-bold { font-weight: var(--font-weight-bold); } @media (max-width: 768px) { .Friday__component { border-radius: 0; border-left: none; border-right: none; box-shadow: none; } .Friday__header { padding: var(--spacing-md) var(--spacing-lg); } .Friday__content { padding: var(--spacing-lg); } .Friday__table th, .Friday__table td { padding: var(--spacing-xs) var(--spacing-sm); } } `}}return e([ht({type:String,attribute:"api-key"})],gt.prototype,"apiKey",void 0),e([ht({type:String,attribute:"business-id"})],gt.prototype,"businessId",void 0),e([ht({type:String})],gt.prototype,"theme",void 0),e([ht({type:String,attribute:"base-url"})],gt.prototype,"baseUrl",void 0),e([ut()],gt.prototype,"loading",void 0),e([ut()],gt.prototype,"error",void 0),t.LinkAccountsWidget=class extends gt{constructor(){super(...arguments),this.showDemo=!1,this.step="connect",this.connections=[],this.currentConnection=null,this.syncProgress=0}static get styles(){return[gt.baseStyles,a` .link-accounts-container { max-width: 600px; margin: 0 auto; } .step-header { text-align: center; padding: 2rem 1.5rem 1rem; } .step-title { font-size: 1.5rem; font-weight: 600; margin-bottom: 0.5rem; color: var(--friday-text); } .step-description { color: var(--friday-text-muted); font-size: 1rem; line-height: 1.5; } .connect-section { padding: 1.5rem; text-align: center; } .bank-connect-btn { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; border: none; padding: 1rem 2rem; border-radius: 8px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; display: inline-flex; align-items: center; gap: 0.75rem; } .bank-connect-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3); } .bank-icon { width: 24px; height: 24px; background: rgba(255, 255, 255, 0.2); border-radius: 4px; display: flex; align-items: center; justify-content: center; } .syncing-section { padding: 2rem 1.5rem; } .sync-progress { background: var(--friday-surface); border-radius: 8px; padding: 1.5rem; margin-bottom: 1.5rem; } .bank-info { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; } .bank-logo { width: 48px; height: 48px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: white; font-weight: 600; font-size: 1.25rem; } .bank-details h3 { margin: 0 0 0.25rem 0; font-size: 1.125rem; font-weight: 600; } .bank-details p { margin: 0; color: var(--friday-text-muted); font-size: 0.875rem; } .progress-bar { width: 100%; height: 8px; background: var(--friday-gray-200); border-radius: 4px; overflow: hidden; margin: 1rem 0; } .progress-fill { height: 100%; background: linear-gradient(90deg, #10b981, #059669); border-radius: 4px; transition: width 0.3s ease; } .progress-text { text-align: center; color: var(--friday-text-muted); font-size: 0.875rem; margin-top: 0.5rem; } .transaction-preview { display: grid; gap: 0.75rem; margin-top: 1.5rem; } .transaction-card { background: white; border: 1px solid var(--friday-border); border-radius: 6px; padding: 1rem; animation: slideIn 0.5s ease forwards; opacity: 0; transform: translateY(20px); } .transaction-card:nth-child(1) { animation-delay: 0.1s; } .transaction-card:nth-child(2) { animation-delay: 0.2s; } .transaction-card:nth-child(3) { animation-delay: 0.3s; } @keyframes slideIn { to { opacity: 1; transform: translateY(0); } } .transaction-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; } .transaction-merchant { font-weight: 600; color: var(--friday-text); } .transaction-amount { font-weight: 600; color: var(--friday-success); } .transaction-date { color: var(--friday-text-muted); font-size: 0.875rem; } .classify-section { padding: 1.5rem; } .accounts-grid { display: grid; gap: 1rem; margin-bottom: 2rem; } .account-card { background: var(--friday-surface); border: 2px solid var(--friday-border); border-radius: 8px; padding: 1.25rem; cursor: pointer; transition: all 0.2s; } .account-card:hover { border-color: var(--friday-primary); background: rgba(37, 99, 235, 0.05); } .account-card.business { border-color: var(--friday-success); background: rgba(16, 185, 129, 0.05); } .account-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.75rem; } .account-info h4 { margin: 0 0 0.25rem 0; font-size: 1rem; font-weight: 600; } .account-info p { margin: 0; color: var(--friday-text-muted); font-size: 0.875rem; } .account-balance { text-align: right; font-weight: 600; color: var(--friday-text); } .account-toggle { display: flex; align-items: center; gap: 0.75rem; font-size: 0.875rem; } .toggle-switch { position: relative; width: 44px; height: 24px; background: var(--friday-gray-300); border-radius: 12px; cursor: pointer; transition: background 0.3s; } .toggle-switch.active { background: var(--friday-success); } .toggle-slider { position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; background: white; border-radius: 50%; transition: transform 0.3s; } .toggle-switch.active .toggle-slider { transform: translateX(20px); } .complete-section { padding: 2rem 1.5rem; text-align: center; } .success-icon { width: 64px; height: 64px; background: var(--friday-success); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 1.5rem; color: white; font-size: 1.5rem; } .actions { display: flex; gap: 1rem; justify-content: center; margin-top: 2rem; } .demo-notice { background: #fef3c7; border: 1px solid #f59e0b; color: #92400e; padding: 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: 0.875rem; text-align: center; } `]}simulateConnection(){this.showDemo?(this.step="syncing",this.currentConnection={id:"demo_bank",institutionName:"Demo Bank",accounts:[{id:"checking_123",name:"Business Checking",type:"checking",mask:"1234",balance:25e3},{id:"savings_456",name:"Business Savings",type:"savings",mask:"5678",balance:5e4}],status:"connecting"},this.animateSync()):this.emitEvent("bank-connect-required",{provider:"plaid"})}animateSync(){this.syncProgress=0;const t=setInterval(()=>{this.syncProgress+=15*Math.random(),this.syncProgress>=100&&(this.syncProgress=100,clearInterval(t),setTimeout(()=>{this.step="classify"},1e3))},200)}toggleBusinessAccount(t){this.currentConnection&&(this.currentConnection.accounts=this.currentConnection.accounts.map(e=>e.id===t?{...e,isBusinessAccount:!e.isBusinessAccount}:e),this.requestUpdate())}async completeSetup(){if(this.apiClient&&this.currentConnection){this.setLoading(!0);try{const t=this.currentConnection.accounts.filter(t=>t.isBusinessAccount);for(const e of t){const t={external_id:e.id,name:e.name,account_type:"checking"===e.type||"savings"===e.type?"asset":"liability",account_subtype:e.type,code:"checking"===e.type?"1100":"1110",is_active:!0,normal_balance:"debit",metadata:{institution:this.currentConnection.institutionName,mask:e.mask,balance:e.balance}};await this.apiClient.createAccount(t)}this.step="complete",this.emitEvent("accounts-linked",{accounts:t,institution:this.currentConnection.institutionName})}catch(t){this.setError("Failed to create accounts")}finally{this.setLoading(!1)}}}renderConnect(){return D` <div class="step-header"> <h2 class="step-title">Connect Your Bank Account</h2> <p class="step-description"> Securely link your business bank account to start tracking transactions and managing your finances. </p> </div> ${this.showDemo?D` <div class="demo-notice"> <strong>Demo Mode:</strong> This will simulate connecting to a demo bank account </div> `:""} <div class="connect-section"> <button class="bank-connect-btn" @click=${this.simulateConnection}> <div class="bank-icon">🏦</div> Connect Bank Account </button> <p style="margin-top: 1rem; color: var(--friday-text-muted); font-size: 0.875rem;"> Your credentials are encrypted and secure. We use bank-level security. </p> </div> `}renderSyncing(){return D` <div class="step-header"> <h2 class="step-title">Syncing Your Account</h2> <p class="step-description"> We're securely importing your transaction history. This may take a few moments. </p> </div> <div class="syncing-section"> <div class="sync-progress"> <div class="bank-info"> <div class="bank-logo">${this.currentConnection?.institutionName?.charAt(0)||"B"}</div> <div class="bank-details"> <h3>${this.currentConnection?.institutionName||"Bank"}</h3> <p>${this.currentConnection?.accounts.length||0} accounts found</p> </div> </div> <div class="progress-bar"> <div class="progress-fill" style="width: ${this.syncProgress}%"></div> </div> <div class="progress-text">${Math.round(this.syncProgress)}% complete</div> </div> ${this.syncProgress>30?D` <div class="transaction-preview"> <div class="transaction-card"> <div class="transaction-header"> <span class="transaction-merchant">Office Supplies Inc</span> <span class="transaction-amount">-£245.67</span> </div> <div class="transaction-date">3 days ago</div> </div> <div class="transaction-card"> <div class="transaction-header"> <span class="transaction-merchant">Client Payment</span> <span class="transaction-amount">+£1,250.00</span> </div> <div class="transaction-date">5 days ago</div> </div> <div class="transaction-card"> <div class="transaction-header"> <span class="transaction-merchant">Software Subscription</span> <span class="transaction-amount">-£89.99</span> </div> <div class="transaction-date">1 week ago</div> </div> </div> `:""} </div> `}renderClassify(){return D` <div class="step-header"> <h2 class="step-title">Classify Your Accounts</h2> <p class="step-description"> Help us identify which accounts are used for business purposes. </p> </div> <div class="classify-section"> <div class="accounts-grid"> ${this.currentConnection?.accounts.map(t=>D` <div class="account-card ${t.isBusinessAccount?"business":""}"> <div class="account-header"> <div class="account-info"> <h4>${t.name}</h4> <p>${t.type} • •••${t.mask}</p> </div> <div class="account-balance"> ${this.apiClient?.formatCurrency(100*(t.balance||0),"GBP")} </div> </div> <div class="account-toggle"> <span>Business Account</span> <div class="toggle-switch ${t.isBusinessAccount?"active":""}" @click=${()=>this.toggleBusinessAccount(t.id)} > <div class="toggle-slider"></div> </div> </div> </div> `)} </div> <div class="actions"> <button class="friday-btn friday-btn-primary" @click=${this.completeSetup} ?disabled=${!this.currentConnection?.accounts.some(t=>t.isBusinessAccount)} > Continue Setup </button> </div> </div> `}renderComplete(){const t=this.currentConnection?.accounts.filter(t=>t.isBusinessAccount)||[];return D` <div class="complete-section"> <div class="success-icon">✓</div> <h2 class="step-title">Accounts Connected Successfully!</h2> <p class="step-description"> ${t.length} business account${1===t.length?"":"s"} connected and ready to use. </p> <div class="actions"> <button class="friday-btn friday-btn-primary" @click=${()=>this.onComplete?.()} > Continue to Dashboar