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AAM,cAEvB,CAEOK,OAAc,CACnBC,EAAAA,MAAa,KAAM,EAAK,CAC1B,CAEOC,aAAaC,EAAU,CAC5B,OAAI,KAAKL,gBACP,KAAKA,eAAe,EACpBG,EAAAA,MAAa,KAAM,EAAI,EAChB,KAGTA,EAAAA,MAAa,KAAM,EAAI,EAChB,GACT,CAEA,OAAcrD,KAAKgD,EAA6C,CAC9D,OAAOK,EAAAA,KAAY,IAAIX,EAAYM,CAAM,CAAC,CAC5C,CACF,CAEA,QAAeN,C","sources":["webpack:///./features/accounting-software/api/constants.ts","webpack:///./features/accounting-software/types/CodatEvents.ts","webpack:///./features/accounting-software/utils/setupPopupWindow.ts","webpack:///./features/accounting-software/services/BaseAccountingSoftwarePackage.ts","webpack:///./features/accounting-software/services/NetSuiteAccountingPackage.ts","webpack:///./features/accounting-software/types/QBWCFileLink.ts","webpack:///./features/accounting-software/services/QuickBooksDesktopAccountingPackage.ts","webpack:///./features/accounting-software/services/QuickBooksOnlineAccountingPackage.ts","webpack:///./features/accounting-software/services/XeroAccountingPackage.ts","webpack:///./features/accounting-software/services/accountingSoftware.ts","webpack:///./features/accounting-software/types/Bill.ts","webpack:///./features/accounting-software/types/CodatSync.ts","webpack:///./features/accounting-software/types/Invoice.ts","webpack:///./features/accounting-software/types/SupportedAccountingSoftware.ts","webpack:///./features/accounting-software/utils/getAccountingSoftwareNameByType.ts","webpack:///./features/accounting-software/utils/getAccountingSoftwareShortNameByType.ts","webpack:///./legacy/modals/styled/titleMessageLink.ts"],"sourcesContent":["/**\n * API prefix for accounting software API endpoints\n */\nexport const API_PREFIX = 'v1';\n","enum CodatEvents {\n DataSync = 'realtime:codat:dataSync',\n}\n\nexport default CodatEvents;\n","interface PopupWindowOptions {\n /** Width of the popup window */\n width?: number;\n /** Height of the popup window */\n height?: number;\n /** Whether to center the popup on the screen */\n centered?: boolean;\n}\n\ninterface PopupParameters {\n location: number;\n width: number;\n height: number;\n left?: number;\n top?: number;\n}\n\n/**\n * Creates a popup window with the given parameters\n * @param options {@link PopupWindowOptions}\n * @returns The popup window\n */\nfunction setupPopupWindow({\n width = 1000,\n height = 650,\n centered = true,\n}: PopupWindowOptions = {}) {\n const parameters: PopupParameters = {\n location: 1,\n width,\n height,\n };\n\n if (centered) {\n parameters.left = (window.screen.width - width) / 2;\n parameters.top = (window.screen.height - height) / 2;\n }\n\n const features = Object.keys(parameters)\n .map((k) => `${k}=${parameters[k]}`)\n .join(',');\n\n const popup = window.open('', '', features);\n\n if (popup?.document) {\n popup.document.write('Connecting...');\n }\n\n return popup;\n}\n\nexport type { PopupParameters };\nexport default setupPopupWindow;\n","import * as ko from 'knockout';\n\nimport { CodatDataType } from '@/features/accounting-software/types/CodatSync';\nimport { AccountingSoftwareIntegrationEventsServiceEventType } from '@/legacy/features/companies/accountingSoftware/analytics/helper';\nimport * as companyService from '@/legacy/services/company';\nimport CompanyEventService from '@/legacy/services/companyEventService';\n\nimport AccountingSoftwareCompany from '../types/AccountingSoftwareCompany';\nimport AccountingSoftwareContact from '../types/AccountingSoftwareContact';\nimport Bill from '../types/Bill';\nimport IAccount from '../types/IAccount';\nimport IAccountingSoftwareAddAccount from '../types/IAccountingSoftwareAddAccount';\nimport IAccountingSoftwarePackage from '../types/IAccountingSoftwarePackage';\nimport IBillAttachmentDetails from '../types/IBillAttachmentDetails';\nimport Invoice from '../types/Invoice';\nimport type { SupportedAccountingSoftwareType as AccountingSoftwareType } from '../types/SupportedAccountingSoftware';\nimport SyncType from '../types/SyncType';\nimport { getAccountingSoftwareNameByType } from '../utils/getAccountingSoftwareNameByType';\nimport { getAccountingSoftwareShortNameByType } from '../utils/getAccountingSoftwareShortNameByType';\n\nconst NoSyncProgress = ko.pureComputed(() => undefined);\n\nabstract class BaseAccountingSoftwarePackage implements IAccountingSoftwarePackage {\n protected companyService: companyService.CompanyService;\n\n readonly id: AccountingSoftwareType;\n\n readonly name: string;\n\n readonly shortName: string;\n\n abstract readonly logoUrl: string;\n\n abstract readonly icon: string;\n\n abstract readonly supportsInvoices: boolean;\n\n readonly usesCodat: boolean = false;\n\n constructor(id: AccountingSoftwareType) {\n this.companyService = companyService.Instance;\n\n this.id = id;\n this.name = getAccountingSoftwareNameByType(id);\n this.shortName = getAccountingSoftwareShortNameByType(id);\n }\n\n getSyncProgress(_syncDataTypes: ReadonlyArray) {\n return NoSyncProgress;\n }\n\n abstract AddAccount(account: IAccountingSoftwareAddAccount): Promise;\n\n abstract Connect(): Promise;\n\n abstract ConnectConnectIcon(): string;\n\n abstract Connected(info: any): Promise;\n\n abstract FilterResolutions(conflictingAccountName: string): string;\n\n abstract GenerateConnectButton($target: JQuery): void;\n\n abstract GetAccounts(): Promise>;\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n GetBillAttachment(attachment: IBillAttachmentDetails) {}\n\n abstract GetBills(): Promise>;\n\n abstract fetchCompany(): Promise;\n\n abstract GetContacts(): Promise>;\n\n GetId(): AccountingSoftwareType {\n return this.id;\n }\n\n abstract GetInvoices(): Promise>;\n\n GetName(): string {\n return this.name;\n }\n\n abstract GetReconciliationStatus(): Promise;\n\n GetShortName(): string {\n return this.shortName;\n }\n\n SupportsInvoices(): boolean {\n return this.supportsInvoices;\n }\n\n SyncData(syncType: SyncType, syncDataTypes: ReadonlyArray): Promise {\n return Promise.resolve();\n }\n\n async getFullVendorDetails(vendorDetails: any): Promise {\n return vendorDetails;\n }\n\n async getFullCustomerDetails(customerDetails: any): Promise {\n return customerDetails;\n }\n\n protected fireAccountingSoftwareConnectingEvent(context?: string) {\n CompanyEventService.emit(\n AccountingSoftwareIntegrationEventsServiceEventType.AccountingPlatformConnectionInitiated,\n {\n accountingPlatform: this.id,\n context,\n }\n );\n }\n\n protected fireAccountingSoftwareConnectedEvent() {\n CompanyEventService.emit(\n AccountingSoftwareIntegrationEventsServiceEventType.AccountingPlatformConnected,\n {\n accountingPlatform: this.id,\n }\n );\n }\n}\n\nexport default BaseAccountingSoftwarePackage;\n","import * as ko from 'knockout';\nimport * as analytics from 'analytics';\nimport { identity, memoize, sortBy } from 'lodash-es';\n\nimport { ApiService } from '@/features/api';\nimport eventsService, { SubscribedEvent } from '@/legacy/services/eventsService';\n\nimport { API_PREFIX } from '../api/constants';\nimport NetSuiteLogo from '../assets/netsuite-logo.svg';\nimport AccountingSoftwareCompany from '../types/AccountingSoftwareCompany';\nimport AccountingSoftwareContact from '../types/AccountingSoftwareContact';\nimport Bill from '../types/Bill';\nimport BillData from '../types/BillData';\nimport CodatConnection from '../types/CodatConnection';\nimport CodatEvents from '../types/CodatEvents';\nimport { CodatDataType, CodatSyncMessage } from '../types/CodatSync';\nimport IAccount from '../types/IAccount';\nimport IAccountingSoftwareAddAccount from '../types/IAccountingSoftwareAddAccount';\nimport IBillAttachmentDetails from '../types/IBillAttachmentDetails';\nimport Invoice from '../types/Invoice';\nimport InvoiceData from '../types/InvoiceData';\nimport { SupportedAccountingSoftware } from '../types/SupportedAccountingSoftware';\nimport SyncCodatDataResponse from '../types/SyncCodatDataResponse';\nimport SyncType from '../types/SyncType';\nimport setupPopupWindow from '../utils/setupPopupWindow';\n\nimport BaseAccountingSoftwarePackage from './BaseAccountingSoftwarePackage';\n\nconst syncTimeoutError = new Error('Timed out waiting for NetSuite data sync');\n\n/** This is a special sync state for the global state of this package. */\nenum SyncState {\n None,\n Pending,\n Completed,\n}\n\nclass NetSuiteAccountingPackage extends BaseAccountingSoftwarePackage {\n private readonly connectIcon = 'third_party_netsuite_connect';\n\n // TODO: remove vendor logo from public dir once we fully migrate to the new UI\n readonly logoUrl = `${import.meta.env.APP_STATIC_APP_ROOT_URL}/img/vendor/netsuite-icon.svg`;\n\n readonly icon = NetSuiteLogo;\n\n private readonly maxWaitTimeForDataSyncInMilliseconds = 1000 * 60 * 10;\n\n supportsInvoices = true;\n\n usesCodat = true;\n\n private syncState: KnockoutObservable> = ko.observable(\n new Map(Object.values(CodatDataType).map((dataType) => [dataType, SyncState.None]))\n );\n\n getSyncProgress = memoize(\n (syncDataTypes: ReadonlyArray) =>\n ko.pureComputed(() => {\n if (syncDataTypes == null) {\n return undefined;\n }\n const syncState = this.syncState();\n const completed = syncDataTypes.filter(\n (dataType) => syncState.get(dataType) === SyncState.Completed\n );\n return (100 * completed.length) / syncDataTypes.length;\n }),\n (syncDataTypes) => String(sortBy(syncDataTypes, identity))\n );\n\n constructor() {\n super(SupportedAccountingSoftware.NetSuite);\n }\n\n /**\n * Get NetSuite integration accounts from Codat.\n *\n * In order to behave like other packages, this method has to wait for synced data signals\n * before fetching the accounts from the associated API endpoint; otherwise, it will return an\n * empty response.\n */\n async GetAccounts(): Promise> {\n const companyId: string = this.companyService.CompanyId();\n\n const url = new URL(\n `${import.meta.env.APP_URLS_API_URL}/${API_PREFIX}/companies/${companyId}/codat/accounts`\n );\n const accounts = await ApiService.get>(url.toString());\n return accounts;\n }\n\n async AddAccount(account: IAccountingSoftwareAddAccount): Promise {\n const companyId: string = this.companyService.CompanyId();\n\n const url = new URL(\n `${import.meta.env.APP_URLS_API_URL}/${API_PREFIX}/companies/${companyId}/codat/accounts`\n );\n\n const response = await ApiService.post(url.toString(), { body: account });\n\n return response;\n }\n\n async Connect(): Promise {\n const companyId: string = this.companyService.CompanyId();\n\n const codatConnection = await ApiService.post(\n `${import.meta.env.APP_URLS_API_URL}/v1/companies/${companyId}/codat/connections`,\n undefined,\n true\n );\n\n const popup = setupPopupWindow();\n if (popup) {\n popup.location.href = codatConnection.connectionLink;\n }\n }\n\n ConnectConnectIcon(): string {\n return this.connectIcon;\n }\n\n async Connected(info: any): Promise {\n console.log('connected');\n }\n\n FilterResolutions(conflictingAccountName: string): string {\n return conflictingAccountName;\n }\n\n GenerateConnectButton($target: JQuery): void {\n $('', {\n href: '#',\n class: this.connectIcon,\n })\n .appendTo($target)\n .click(() => {\n this.Connect();\n return false;\n });\n }\n\n /**\n * Get NetSuite bills from Codat.\n *\n * In order to behave like other packages, this method has to wait for synced data signals\n * before fetching the bills from the associated API endpoint; otherwise, it will return an\n * empty response.\n */\n async GetBills(): Promise> {\n await this.waitForSyncedDataTypes([CodatDataType.Bills]);\n\n const companyId: string = this.companyService.CompanyId();\n\n const billData = await ApiService.get>(\n `${import.meta.env.APP_URLS_API_URL}/${API_PREFIX}/companies/${companyId}/codat/bills`\n );\n\n if (companyId !== this.companyService.CompanyId()) {\n throw new Error('Company switched while fetching bills');\n }\n\n return billData.map((data) => new Bill(data));\n }\n\n /** Get company associated with NetSuite integration from Codat. */\n async fetchCompany(): Promise {\n const companyId: string = this.companyService.CompanyId();\n const codatConnection = await ApiService.get(\n `${import.meta.env.APP_URLS_API_URL}/${API_PREFIX}/companies/${companyId}/codat/connections`,\n undefined,\n true\n );\n return { name: codatConnection?.codatCompanyName };\n }\n\n async GetContacts(): Promise> {\n return [];\n }\n\n /**\n * Get NetSuite invoices from Codat.\n *\n * In order to behave like other packages, this method has to wait for synced data signals\n * before fetching the invoices from the associated API endpoint; otherwise, it will return an\n * empty response.\n */\n async GetInvoices(): Promise> {\n await this.waitForSyncedDataTypes([CodatDataType.Invoices]);\n\n const companyId: string = this.companyService.CompanyId();\n\n const invoiceData = await ApiService.get>(\n `${import.meta.env.APP_URLS_API_URL}/${API_PREFIX}/companies/${companyId}/codat/invoices`\n );\n\n if (companyId !== this.companyService.CompanyId()) {\n throw new Error('Company switched while fetching invoices');\n }\n\n return invoiceData.map((data) => new Invoice(data));\n }\n\n async GetReconciliationStatus(): Promise {\n return 'Reconciled';\n }\n\n GetBillAttachment(attachment: IBillAttachmentDetails) {\n const popup = setupPopupWindow({ width: 800, height: 650 });\n if (popup) {\n popup.location.href = attachment.url;\n }\n }\n\n private async waitForSyncedDataTypes(dataTypes: ReadonlyArray): Promise {\n await this.syncState.skipUntil((syncState) =>\n dataTypes.every((dataType) => syncState.get(dataType) === SyncState.Completed)\n );\n }\n\n private updateSyncState(dataTypes: ReadonlyArray, state: SyncState) {\n const next = new Map(this.syncState());\n dataTypes.forEach((dataType) => {\n next.set(dataType, state);\n });\n this.syncState(next);\n }\n\n private dataSyncSubscription: SubscribedEvent;\n\n private startSyncListener() {\n if (this.dataSyncSubscription != null) {\n return;\n }\n\n let lastTimeDataTypeWasSynced: number = Date.now();\n const syncStartTime: number = Date.now();\n\n // This event is triggered by the RealtimeService when Codat has finished syncing data\n this.dataSyncSubscription = eventsService.on(\n CodatEvents.DataSync,\n ({ detail: { dataTypes } }: CustomEvent) => {\n this.updateSyncState(dataTypes, SyncState.Completed);\n\n const now = Date.now();\n const elapsedTime = now - lastTimeDataTypeWasSynced;\n const elapsedTimeInSeconds = (elapsedTime / 1000).toFixed(2);\n const totalTime = now - syncStartTime;\n const totalTimeInSeconds = Math.ceil(totalTime / 1000);\n\n dataTypes.forEach((dataType) => {\n // Intentional logging.\n // eslint-disable-next-line no-console\n console.log(`[NetSuite] synced ${dataType} data type.`);\n });\n // Intentional logging.\n // eslint-disable-next-line no-console\n console.log(\n `[NetSuite] Synced data types in ${elapsedTimeInSeconds}s (total time: ${totalTimeInSeconds}s)`\n );\n\n lastTimeDataTypeWasSynced = Date.now();\n\n this.maybeStopSyncListener();\n }\n );\n }\n\n private stopSyncListener() {\n if (this.dataSyncSubscription == null) {\n return;\n }\n\n eventsService.off(this.dataSyncSubscription);\n this.dataSyncSubscription = null;\n }\n\n private maybeStopSyncListener() {\n if (this.dataSyncSubscription == null) {\n return;\n }\n\n const hasPendingStates = Array.from(this.syncState().values()).some(\n (state) => state === SyncState.Pending\n );\n if (hasPendingStates) {\n return;\n }\n\n this.stopSyncListener();\n }\n\n /**\n * Trigger the data synchronization process\n *\n * This method kicks off the data synchronization process with Codat, then awaits\n * data sync signals from the RealtimeService before resolving.\n */\n SyncData(syncType: SyncType, syncDataTypes: ReadonlyArray): Promise {\n this.fireAccountingSoftwareConnectingEvent();\n const companyId: string = this.companyService.CompanyId();\n\n this.updateSyncState(syncDataTypes, SyncState.Pending);\n this.startSyncListener();\n\n const syncPromise = ApiService.post(\n `${import.meta.env.APP_URLS_API_URL}/v1/companies/${companyId}/codat/sync`,\n {\n body: { syncType, syncDataTypes },\n }\n )\n .then(async (response) => {\n // When isSyncRequestSent is true, the backend will sync ALL data types, which are already\n // in the pending state.Otherwise, the backend will sync NONE of the data types, which we\n // should move to the completed state ourselves.\n if (response.isSyncRequestSent) {\n syncDataTypes?.forEach((dataType) => {\n // Intentional logging.\n // eslint-disable-next-line no-console\n console.log(`[NetSuite] requesting sync for ${dataType}`);\n });\n await this.waitForSyncedDataTypes(syncDataTypes);\n } else {\n this.updateSyncState(syncDataTypes, SyncState.Completed);\n }\n\n this.fireAccountingSoftwareConnectedEvent();\n analytics.send('event', 'Company-AccountingSoftware', 'Connect', this.shortName);\n })\n .finally(() => {\n this.maybeStopSyncListener();\n });\n const timeoutPromise = new Promise((_resolve, reject) => {\n setTimeout(reject, this.maxWaitTimeForDataSyncInMilliseconds, syncTimeoutError);\n });\n\n return Promise.race([syncPromise, timeoutPromise]);\n }\n}\n\nexport type { CodatSyncMessage as NetSuiteSyncMessage };\nexport default NetSuiteAccountingPackage;\n","// eslint-disable-next-line @cspell/spellchecker\nimport IQBWCFile from './IQBWCFile';\n\nclass QBWCFileLink {\n file: IQBWCFile;\n\n link: string;\n\n constructor(file: IQBWCFile, link: string) {\n this.file = file;\n this.link = link;\n }\n}\n\nexport default QBWCFileLink;\n","import * as router from 'plugins/router';\nimport * as analytics from 'analytics';\n\nimport { ApiService } from '@/features/api';\n\nimport { API_PREFIX } from '../api/constants';\nimport QuickBooksIcon from '../assets/quickbooks-icon.svg';\nimport AccountingSoftwareCompany from '../types/AccountingSoftwareCompany';\nimport AccountingSoftwareContact from '../types/AccountingSoftwareContact';\nimport Bill from '../types/Bill';\nimport BillData from '../types/BillData';\nimport IAccount from '../types/IAccount';\nimport Invoice from '../types/Invoice';\nimport InvoiceData from '../types/InvoiceData';\n// eslint-disable-next-line @cspell/spellchecker\nimport IQBWCFile from '../types/IQBWCFile';\nimport QBWCFileLink from '../types/QBWCFileLink';\nimport { SupportedAccountingSoftware } from '../types/SupportedAccountingSoftware';\n\nimport BaseAccountingSoftwarePackage from './BaseAccountingSoftwarePackage';\n\nclass QuickBooksDesktopAccountingPackage extends BaseAccountingSoftwarePackage {\n // TODO: remove vendor logo from public dir once we fully migrate to the new UI\n readonly logoUrl = `${import.meta.env.APP_STATIC_APP_ROOT_URL}/img/vendor/quickbooks-icon.svg`;\n\n readonly icon = QuickBooksIcon;\n\n supportsInvoices = true;\n\n constructor() {\n super(SupportedAccountingSoftware.QuickBooksDesktop);\n }\n\n ConnectConnectIcon(): string {\n return 'third_party_quickbooks_desktop_connect';\n }\n\n FilterResolutions(conflictingAccountName: string): string {\n // The name for Plooto Instant in US is too long. We have a shorter name\n if (conflictingAccountName == 'Plooto Instant (United States - USD)') {\n return 'Plooto Instant (US - USD)';\n }\n let newAccountName = conflictingAccountName;\n newAccountName = newAccountName\n .replace(':', '')\n .replace(';', '')\n // eslint-disable-next-line no-control-regex\n .replace(/[^\\x00-\\xFF]/g, '')\n .trim();\n if (newAccountName.length > 31) {\n newAccountName = newAccountName.substring(0, 31);\n }\n return newAccountName;\n }\n\n // callback that is called via pop-up when OAuth has been completed\n async Connected(info: any): Promise {\n const companyId: string = this.companyService.CompanyId();\n\n await ApiService.put(\n `${\n import.meta.env.APP_URLS_API_URL\n }/${API_PREFIX}/companies/${companyId}/quickbooksonline/oauth`,\n { body: info }\n );\n\n this.fireAccountingSoftwareConnectedEvent();\n analytics.send('event', 'Company-AccountingSoftware', 'Connect', 'QBD');\n }\n\n // called via callback once user clicks on \"connect\" button\n async Connect(): Promise {\n router.navigate('user/integrations/quickbooksDesktop');\n }\n\n // generates a clickable link that starts connection process\n GenerateConnectButton($target: JQuery, context?: string): void {\n $('', {\n href: '#',\n class: 'third_party_quickbooks_desktop_connect',\n })\n .appendTo($target)\n .click(() => {\n this.fireAccountingSoftwareConnectingEvent(context);\n this.Connect();\n return false;\n });\n }\n\n async DownloadQBWC(): Promise {\n const companyId: string = this.companyService.CompanyId();\n\n const qbwcFile = await ApiService.get(\n `${\n import.meta.env.APP_URLS_API_URL\n }/${API_PREFIX}/companies/${companyId}/quickbooksdesktop/generateQBWC`\n );\n\n const downloadUrl = `${\n import.meta.env.APP_URLS_API_URL\n }/${API_PREFIX}/companies/${companyId}/quickbooksdesktop/downloadQBWC/${qbwcFile.templateId}`;\n\n return new QBWCFileLink(qbwcFile, downloadUrl);\n }\n\n async AddAccount(account: any): Promise {\n const companyId: string = this.companyService.CompanyId();\n\n const response = await ApiService.put(\n `${\n import.meta.env.APP_URLS_API_URL\n }/${API_PREFIX}/companies/${companyId}/quickbooksdesktop/accounts`,\n { body: account }\n );\n\n return response;\n }\n\n async GetContacts(): Promise> {\n const companyId: string = this.companyService.CompanyId();\n\n const contacts = await ApiService.get>(\n `${\n import.meta.env.APP_URLS_API_URL\n }/${API_PREFIX}/companies/${companyId}/quickbooksdesktop/contacts`\n );\n\n return contacts;\n }\n\n async GetAccounts(): Promise> {\n const companyId: string = this.companyService.CompanyId();\n\n const accounts = await ApiService.get>(\n `${\n import.meta.env.APP_URLS_API_URL\n }/${API_PREFIX}/companies/${companyId}/quickbooksdesktop/accounts`\n );\n\n return accounts;\n }\n\n async fetchCompany(): Promise {\n const companyId: string = this.companyService.CompanyId();\n\n const company = await ApiService.get(\n `${\n import.meta.env.APP_URLS_API_URL\n }/${API_PREFIX}/companies/${companyId}/quickbooksdesktop/company`\n );\n\n return company;\n }\n\n async GetBills(): Promise> {\n const companyId: string = this.companyService.CompanyId();\n\n const billData = await ApiService.get>(\n `${\n import.meta.env.APP_URLS_API_URL\n }/${API_PREFIX}/companies/${companyId}/quickbooksdesktop/bills`\n );\n\n if (companyId !== this.companyService.CompanyId()) {\n throw new Error('Company switched while fetching bills');\n }\n\n return billData.map((data) => new Bill(data));\n }\n\n async GetInvoices(): Promise> {\n const companyId: string = this.companyService.CompanyId();\n\n const invoiceData = await ApiService.get>(\n `${\n import.meta.env.APP_URLS_API_URL\n }/${API_PREFIX}/companies/${companyId}/quickbooksdesktop/invoices`\n );\n\n if (companyId !== this.companyService.CompanyId()) {\n throw new Error('Company switched while fetching invoices');\n }\n\n return invoiceData.map((data) => new Invoice(data));\n }\n\n async GetReconciliationStatus(): Promise {\n const companyId: string = this.companyService.CompanyId();\n\n const reconciliationStatus = await ApiService.get(\n `${\n import.meta.env.APP_URLS_API_URL\n }/${API_PREFIX}/companies/${companyId}/quickbooksdesktop/reconciliationStatus`\n );\n\n return reconciliationStatus;\n }\n}\n\nexport default QuickBooksDesktopAccountingPackage;\n","import * as analytics from 'analytics';\n\nimport { ApiService } from '@/features/api';\n\nimport { API_PREFIX } from '../api/constants';\nimport QuickBooksIcon from '../assets/quickbooks-icon.svg';\nimport AccountingSoftwareCompany from '../types/AccountingSoftwareCompany';\nimport AccountingSoftwareContact from '../types/AccountingSoftwareContact';\nimport Bill from '../types/Bill';\nimport BillData from '../types/BillData';\nimport IAccount from '../types/IAccount';\nimport IBillAttachmentDetails from '../types/IBillAttachmentDetails';\nimport Invoice from '../types/Invoice';\nimport InvoiceData from '../types/InvoiceData';\nimport IOAuthAccessToken from '../types/IOAuthAccessToken';\nimport IOAuthRequest from '../types/IOAuthRequest';\nimport IOAuthVerifiedToken from '../types/IOAuthVerifiedToken';\nimport { SupportedAccountingSoftware as AccountingSoftware } from '../types/SupportedAccountingSoftware';\nimport setupPopupWindow from '../utils/setupPopupWindow';\n\nimport BaseAccountingSoftwarePackage from './BaseAccountingSoftwarePackage';\n\nclass QuickBooksOnlineAccountingPackage extends BaseAccountingSoftwarePackage {\n // TODO: remove vendor logo from public dir once we fully migrate to the new UI\n readonly logoUrl = `${import.meta.env.APP_STATIC_APP_ROOT_URL}/img/vendor/quickbooks-icon.svg`;\n\n readonly icon = QuickBooksIcon;\n\n supportsInvoices = true;\n\n constructor() {\n super(AccountingSoftware.QuickBooksOnline);\n }\n\n ConnectConnectIcon(): string {\n return 'third_party_quickbooks_connect';\n }\n\n FilterResolutions(conflictingAccountName: string): string {\n return conflictingAccountName;\n }\n\n // callback that is called via pop-up when OAuth has been completed\n async Connected(info: any): Promise {\n // we would get error if user hit 'No' on Intuit confirmation popup\n if (info.error != undefined) {\n return;\n }\n\n const companyId: string = this.companyService.CompanyId();\n\n await ApiService.put(\n `${\n import.meta.env.APP_URLS_API_URL\n }/${API_PREFIX}/companies/${companyId}/quickbooksonline/oauth`,\n { body: info }\n );\n\n this.fireAccountingSoftwareConnectedEvent();\n analytics.send('event', 'action', 'completed', 'Connected Quickbooks');\n analytics.send('event', 'Company-AccountingSoftware', 'Connect', 'QBO');\n }\n\n // called via callback once user clicks on \"connect\" button\n async Connect(): Promise {\n const connectUrl = `${import.meta.env.APP_URLS_API_URL}/${API_PREFIX}/quickbooksonline/oauth`;\n\n const oauthData = await ApiService.get(connectUrl);\n\n // set global variable for window so it can be accessed via \"window.opener\" by callback url\n // @ts-expect-error: Property 'QuickBooksAccountingPackage' does not exist on type 'Window & typeof globalThis'.\n window.QuickBooksAccountingPackage = this;\n\n const popup = setupPopupWindow({ width: 800, height: 650 });\n if (popup) {\n popup.location.href = oauthData.url;\n }\n }\n\n async LinkSession(verifiedToken: IOAuthVerifiedToken): Promise {\n const token = await ApiService.post(\n `${import.meta.env.APP_URLS_API_URL}/${API_PREFIX}/quickbooksonline/link`,\n { body: verifiedToken }\n );\n return token;\n }\n\n async GetToken(accessToken: IOAuthAccessToken): Promise {\n const token = await ApiService.post(\n `${import.meta.env.APP_URLS_API_URL}/${API_PREFIX}/quickbooksonline/verify`,\n { body: accessToken }\n );\n return token;\n }\n\n // generates a clickable link that starts connection process\n GenerateConnectButton($target: JQuery, context?: string): void {\n $('', {\n href: '#',\n class: 'third_party_quickbooks_connect',\n })\n .appendTo($target)\n .click(() => {\n this.fireAccountingSoftwareConnectingEvent(context);\n this.Connect();\n return false;\n });\n }\n\n async AddAccount(account: IAccount): Promise {\n const companyId: string = this.companyService.CompanyId();\n\n const response = await ApiService.put(\n `${\n import.meta.env.APP_URLS_API_URL\n }/${API_PREFIX}/companies/${companyId}/quickbooksonline/accounts`,\n { body: account }\n );\n\n return response;\n }\n\n async GetAccounts(): Promise> {\n const companyId: string = this.companyService.CompanyId();\n\n const accounts = await ApiService.get>(\n `${\n import.meta.env.APP_URLS_API_URL\n }/${API_PREFIX}/companies/${companyId}/quickbooksonline/accounts`\n );\n\n return accounts;\n }\n\n async fetchCompany(): Promise {\n const companyId: string = this.companyService.CompanyId();\n\n const response = await ApiService.get(\n `${\n import.meta.env.APP_URLS_API_URL\n }/${API_PREFIX}/companies/${companyId}/quickbooksonline/company`\n );\n\n return response;\n }\n\n async GetBills(): Promise> {\n const companyId: string = this.companyService.CompanyId();\n\n const billData = await ApiService.get>(\n `${\n import.meta.env.APP_URLS_API_URL\n }/${API_PREFIX}/companies/${companyId}/quickbooksonline/bills`\n );\n\n if (companyId !== this.companyService.CompanyId()) {\n throw new Error('Company switched while fetching bills');\n }\n\n return billData.map((data) => new Bill(data));\n }\n\n async GetContacts(): Promise> {\n const companyId: string = this.companyService.CompanyId();\n\n const contacts = await ApiService.get>(\n `${\n import.meta.env.APP_URLS_API_URL\n }/${API_PREFIX}/companies/${companyId}/quickbooksonline/contacts`\n );\n\n return contacts;\n }\n\n async GetInvoices(): Promise> {\n const companyId: string = this.companyService.CompanyId();\n\n const invoiceData = await ApiService.get>(\n `${\n import.meta.env.APP_URLS_API_URL\n }/${API_PREFIX}/companies/${companyId}/quickbooksonline/invoices`\n );\n\n if (companyId !== this.companyService.CompanyId()) {\n throw new Error('Company switched while fetching invoices');\n }\n\n return invoiceData.map((data) => new Invoice(data));\n }\n\n async GetBillAttachment(attachment: IBillAttachmentDetails): Promise {\n const popup = setupPopupWindow({ width: 800, height: 650 });\n if (popup) {\n popup.location.href = attachment.url;\n }\n }\n\n async GetReconciliationStatus(): Promise {\n return 'Reconciled';\n }\n}\n\nexport default QuickBooksOnlineAccountingPackage;\n","import * as analytics from 'analytics';\n\nimport { ApiErrorResponse, ApiService } from '@/features/api';\nimport titleMessageLinkModal from '@/legacy/modals/styled/titleMessageLink';\nimport * as companyService from '@/legacy/services/company';\n\nimport { API_PREFIX } from '../api/constants';\nimport XeroLogo from '../assets/xero-logo.svg';\nimport AccountingSoftwareCompany from '../types/AccountingSoftwareCompany';\nimport AccountingSoftwareContact from '../types/AccountingSoftwareContact';\nimport Bill from '../types/Bill';\nimport BillData from '../types/BillData';\nimport IAccount from '../types/IAccount';\nimport IBillAttachmentDetails from '../types/IBillAttachmentDetails';\nimport Invoice from '../types/Invoice';\nimport InvoiceData from '../types/InvoiceData';\nimport IOAuthRequest from '../types/IOAuthRequest';\nimport { SupportedAccountingSoftware } from '../types/SupportedAccountingSoftware';\nimport XeroAccountingSoftwareSettings from '../types/XeroAccountingSoftwareSettings';\nimport setupPopupWindow from '../utils/setupPopupWindow';\n\nimport BaseAccountingSoftwarePackage from './BaseAccountingSoftwarePackage';\n\nclass XeroAccountingPackage extends BaseAccountingSoftwarePackage {\n // TODO: remove vendor logo from public dir once we fully migrate to the new UI\n readonly logoUrl = `${import.meta.env.APP_STATIC_APP_ROOT_URL}/img/vendor/xero-icon.svg`;\n\n readonly icon = XeroLogo;\n\n supportsInvoices = true;\n\n constructor() {\n super(SupportedAccountingSoftware.Xero);\n }\n\n FilterResolutions(conflictingAccountName: string): string {\n return conflictingAccountName;\n }\n\n ConnectConnectIcon(): string {\n return 'third_party_xero_connect';\n }\n\n // callback that is called via pop-up when OAuth has been completed\n async Connected(info: any): Promise {\n const companyId: string = this.companyService.CompanyId();\n\n try {\n await ApiService.put(\n `${import.meta.env.APP_URLS_API_URL}/${API_PREFIX}/companies/${companyId}/xero/oauth`,\n { body: info }\n );\n } catch (error) {\n if ((error as ApiErrorResponse).type === 'invalid.companySelection') {\n // This will show if you don't select a new organisation\n titleMessageLinkModal.show({\n title: 'Please Select An Organisation',\n optionText: 'View \"Reconnecting to Xero\" Article',\n optionLink:\n 'https://www.plooto.com/support/s/article/connect-xero-to-your-plooto-account',\n message:\n 'You must select a new Xero organisation to connect to. Each Xero organisation can only be connected to ONE Plooto company. ' +\n 'If your organisation was previously connected or is not selectable, disconnect your Xero company and connect it again. ' +\n 'Please read the \"Reconnecting to Xero\" section in the \"Connect Xero to Plooto\" help article below.',\n svgIconSymbolLarge: 'svg-warning-large',\n });\n }\n return;\n }\n\n this.fireAccountingSoftwareConnectedEvent();\n\n analytics.send('event', 'action', 'completed', 'Connected Xero');\n analytics.send('event', 'Company-AccountingSoftware', 'Connect', 'Xero');\n\n // if accounting software has re-connected manually trigger mutation\n this.companyService.membership().company().accountingSoftware.valueHasMutated?.();\n }\n\n // called via callback once user clicks on \"connect\" button\n async Connect(): Promise {\n const companyId: string = this.companyService.CompanyId();\n\n const oauthData = await ApiService.get(\n `${import.meta.env.APP_URLS_API_URL}/${API_PREFIX}/companies/${companyId}/xero/oauth`\n );\n\n // set global variable for window so it can be accessed via \"window.opener\" by callback url\n // @ts-expect-error: Property 'XeroAccountingPackage' does not exist on type 'Window & typeof globalThis'.\n window.XeroAccountingPackage = this;\n\n const popup = setupPopupWindow({ width: 750, height: 810 });\n if (popup) {\n popup.location.href = oauthData.url;\n }\n }\n\n // generates a clickable link that starts connection process\n GenerateConnectButton($target: JQuery, context?: string): void {\n $('', {\n href: '#',\n class: 'third_party_xero_connect',\n })\n .appendTo($target)\n .click(() => {\n this.fireAccountingSoftwareConnectingEvent(context);\n this.Connect();\n return false;\n });\n }\n\n async AddAccount(account: IAccount): Promise {\n const companyId: string = this.companyService.CompanyId();\n\n const response = await ApiService.put(\n `${import.meta.env.APP_URLS_API_URL}/${API_PREFIX}/companies/${companyId}/xero/accounts`,\n { body: account }\n );\n\n return response;\n }\n\n async PostSettings(\n xeroAccountingSoftwareSettings: XeroAccountingSoftwareSettings\n ): Promise {\n const companyId: string = this.companyService.CompanyId();\n\n const data = await ApiService.post(\n `${import.meta.env.APP_URLS_API_URL}/${API_PREFIX}/companies/${companyId}/xero/settings`,\n { body: xeroAccountingSoftwareSettings }\n );\n\n return data;\n }\n\n async GetContacts(): Promise> {\n const companyId: string = this.companyService.CompanyId();\n\n const contacts = await ApiService.get>(\n `${import.meta.env.APP_URLS_API_URL}/${API_PREFIX}/companies/${companyId}/xero/contacts`\n );\n\n return contacts;\n }\n\n async GetAccounts(): Promise> {\n const companyId: string = this.companyService.CompanyId();\n\n const accounts = await ApiService.get>(\n `${import.meta.env.APP_URLS_API_URL}/${API_PREFIX}/companies/${companyId}/xero/accounts`\n );\n\n return accounts;\n }\n\n async fetchCompany(): Promise {\n const companyId: string = this.companyService.CompanyId();\n\n const response = await ApiService.get(\n `${import.meta.env.APP_URLS_API_URL}/${API_PREFIX}/companies/${companyId}/xero/company`\n );\n\n return response;\n }\n\n async GetBills(): Promise> {\n const companyId: string = this.companyService.CompanyId();\n\n const billData = await ApiService.get>(\n `${import.meta.env.APP_URLS_API_URL}/${API_PREFIX}/companies/${companyId}/xero/bills`\n );\n\n if (companyId !== this.companyService.CompanyId()) {\n throw new Error('Company switched while fetching bills');\n }\n\n return billData.map((data) => new Bill(data));\n }\n\n async GetInvoices(): Promise> {\n const companyId: string = this.companyService.CompanyId();\n\n const invoiceData = await ApiService.get>(\n `${import.meta.env.APP_URLS_API_URL}/${API_PREFIX}/companies/${companyId}/xero/invoices`\n );\n\n if (companyId !== this.companyService.CompanyId()) {\n throw new Error('Company switched while fetching invoices');\n }\n\n return invoiceData.map((data) => new Invoice(data));\n }\n\n GetBillAttachment(attachment: IBillAttachmentDetails) {\n const popup = setupPopupWindow({ width: 800, height: 650 });\n if (popup) {\n popup.location.href = attachment.url;\n }\n }\n\n async GetReconciliationStatus(): Promise {\n return 'Reconciled';\n }\n\n async getFullVendorDetails(vendorDetails: any): Promise {\n // Xero requires an additional call to fetch full vendor details\n const url = `${\n import.meta.env.APP_URLS_API_URL\n }/${API_PREFIX}/companies/${companyService.Instance.CompanyId()}/xero/vendors/${\n vendorDetails.id\n }`;\n const data = ApiService.get(url);\n return data;\n }\n\n async getFullCustomerDetails(customerDetails: any): Promise {\n // Xero requires an additional call to fetch full vendor details\n const url = `${\n import.meta.env.APP_URLS_API_URL\n }/${API_PREFIX}/companies/${companyService.Instance.CompanyId()}/xero/customers/${\n customerDetails.id\n }`;\n const data = await ApiService.get(url);\n return data;\n }\n}\n\nexport default XeroAccountingPackage;\n","import * as ko from 'knockout';\n\nimport IAccountingSoftwarePackage from '../types/IAccountingSoftwarePackage';\nimport { SupportedAccountingSoftwareType } from '../types/SupportedAccountingSoftware';\n\nimport NetSuiteAccountingPackage from './NetSuiteAccountingPackage';\nimport QuickBooksDesktopAccountingPackage from './QuickBooksDesktopAccountingPackage';\nimport QuickBooksOnlineAccountingPackage from './QuickBooksOnlineAccountingPackage';\nimport XeroAccountingPackage from './XeroAccountingPackage';\n\nclass AccountingSoftwareService {\n /** All accounting software packages available to the current company */\n public packages = ko.observable([\n new QuickBooksOnlineAccountingPackage(),\n new QuickBooksDesktopAccountingPackage(),\n new XeroAccountingPackage(),\n new NetSuiteAccountingPackage(),\n ] as Array);\n\n /** Get all accounting software packages available for the current company */\n public GetPackages(): Array {\n return this.packages();\n }\n\n /** Get a specific (available) accounting software package */\n public GetPackage(id: SupportedAccountingSoftwareType): IAccountingSoftwarePackage | undefined {\n return this.packages().find((p) => p.id === id);\n }\n}\n\nconst Instance = new AccountingSoftwareService();\n\nexport { AccountingSoftwareService };\nexport { Instance };\n","import * as ko from 'knockout';\nimport XDate from 'xdate';\n\nimport BillData from '@/features/accounting-software/types/BillData';\nimport BillTrackingCategories from '@/features/accounting-software/types/BillTrackingCategories';\nimport IBillAttachmentDetails from '@/features/accounting-software/types/IBillAttachmentDetails';\nimport IBillVendorDetails from '@/features/accounting-software/types/IBillVendorDetails';\n\nclass Bill {\n public amount: number;\n\n public memo: string;\n\n public billNumber: string;\n\n public id: string;\n\n public currency: string;\n\n public date: Date;\n\n public pay: KnockoutObservable = ko.observable(false);\n\n public vendor: IBillVendorDetails;\n\n public attachments = ko.observableArray([]);\n\n public hasAttachments: boolean;\n\n public attachmentStatus = ko.observable('loadRequired');\n\n public trackingCategories: BillTrackingCategories;\n\n constructor(data: BillData) {\n this.vendor = data.vendor;\n\n const utcDate = new XDate(data.date, true); // Date comes in this format: \"2019-01-01T00:00:00Z\" (Parse it in UTC format)\n this.date = new Date(utcDate.getFullYear(), utcDate.getMonth(), utcDate.getDate()); // re-create the date to base it users browser timezone\n\n this.amount = data.amount;\n this.billNumber = data.billNumber;\n this.id = data.id;\n this.currency = data.currency;\n this.hasAttachments = data.hasAttachments;\n this.trackingCategories = data.trackingCategories;\n\n if (data.attachments?.length > 0) {\n this.attachmentStatus('loaded');\n\n data.attachments.forEach((attachment: IBillAttachmentDetails) => {\n this.attachments.push(attachment);\n });\n }\n\n if (data.memo) {\n this.memo = data.memo;\n }\n }\n}\n\nexport default Bill;\n","/** Transmitted Codat SignalR web socket message data types */\nexport enum CodatDataType {\n /** Only transmitted during the initial accounting software connection process. Signals completion of the initial connection process (but not the sync process). */\n Company = 'company',\n /** Only transmitted during the initial accounting software connection process. Signals completion of the initial connection process (but not the sync process). */\n Currencies = 'currencies',\n /** Transmitted during sync process */\n Bills = 'bills',\n /** Transmitted during sync process */\n Customers = 'customers',\n /** Transmitted during sync process */\n Invoices = 'invoices',\n /** Transmitted during sync process */\n Suppliers = 'suppliers',\n BankAccounts = 'bankAccounts',\n CreditNotes = 'creditNotes',\n TrackingCategories = 'trackingCategories',\n TaxRates = 'taxRates',\n ChartOfAccounts = 'chartOfAccounts',\n BillCreditNotes = 'billCreditNotes',\n Payments = 'payments',\n Items = 'items',\n}\n\n/** Codat web socket sync messages */\nexport type CodatSyncMessage = {\n dataTypes: Array;\n companyId: string;\n};\n","import * as ko from 'knockout';\nimport XDate from 'xdate';\n\nimport IBillAttachmentDetails from '@/features/accounting-software/types/IBillAttachmentDetails';\nimport IInvoiceCustomerDetails from '@/features/accounting-software/types/IInvoiceCustomerDetails';\nimport InvoiceData from '@/features/accounting-software/types/InvoiceData';\n\n// @todo just a copy of bill for now\nclass Invoice {\n public amount: number;\n\n public memo: string;\n\n public invoiceNumber: string;\n\n public id: string;\n\n public currency: string;\n\n public date: Date;\n\n public pay: KnockoutObservable = ko.observable(false);\n\n public customer: IInvoiceCustomerDetails;\n\n public inProgress: boolean;\n\n public attachments = ko.observableArray([]);\n\n public hasAttachments: boolean;\n\n public isPadAgreementCompleted: boolean;\n\n public attachmentStatus = ko.observable('loadRequired');\n\n constructor(data: InvoiceData) {\n // This pulls in customer prefill data like address details, print name on check as, etc...\n this.customer = data.customer;\n\n const utcDate = new XDate(data.date, true); // Date comes in this format: \"2019-01-01T00:00:00Z\" (Parse it in UTC format)\n this.date = new Date(utcDate.getFullYear(), utcDate.getMonth(), utcDate.getDate()); // re-create the date to base it users browser timezone\n\n this.amount = data.amount;\n this.invoiceNumber = data.invoiceNumber;\n this.id = data.id;\n this.currency = data.currency;\n this.inProgress = data.inProgress;\n this.hasAttachments = data.hasAttachments;\n this.isPadAgreementCompleted = data.isPadAgreementCompleted;\n\n if (data.memo) {\n this.memo = data.memo;\n }\n }\n}\n\nexport default Invoice;\n","/**\n * Supported accounting software types for syncing with Plooto\n * @constant\n */\nconst SupportedAccountingSoftware = {\n NetSuite: 'netsuite',\n QuickBooksDesktop: 'quickbooksdesktop',\n QuickBooksOnline: 'quickbooksonline',\n Xero: 'xero',\n} as const;\n\ntype SupportedAccountingSoftwareType =\n (typeof SupportedAccountingSoftware)[keyof typeof SupportedAccountingSoftware];\n\nexport type { SupportedAccountingSoftwareType };\nexport { SupportedAccountingSoftware };\n","import {\n SupportedAccountingSoftware,\n SupportedAccountingSoftwareType,\n} from '../types/SupportedAccountingSoftware';\n\nconst getAccountingSoftwareNameByType = (type: SupportedAccountingSoftwareType) => {\n switch (type) {\n case SupportedAccountingSoftware.NetSuite:\n return 'Oracle NetSuite';\n case SupportedAccountingSoftware.QuickBooksDesktop:\n return 'QuickBooks Desktop';\n case SupportedAccountingSoftware.QuickBooksOnline:\n return 'QuickBooks Online';\n case SupportedAccountingSoftware.Xero:\n return 'Xero';\n default:\n return '';\n }\n};\n\nexport { getAccountingSoftwareNameByType };\n","import {\n SupportedAccountingSoftware,\n SupportedAccountingSoftwareType,\n} from '../types/SupportedAccountingSoftware';\n\nconst getAccountingSoftwareShortNameByType = (type: SupportedAccountingSoftwareType) => {\n switch (type) {\n case SupportedAccountingSoftware.NetSuite:\n return 'NetSuite';\n case SupportedAccountingSoftware.QuickBooksDesktop:\n return 'QBD';\n case SupportedAccountingSoftware.QuickBooksOnline:\n return 'QBO';\n case SupportedAccountingSoftware.Xero:\n return 'Xero';\n default:\n return '';\n }\n};\n\nexport { getAccountingSoftwareShortNameByType };\n","import * as dialog from 'plugins/dialog';\n\nimport BaseModal from '@/legacy/modals/BaseModal';\n\ndeclareModules({\n 'modals/styled/titleMessageLink.html': () =>\n import('@/legacy/modals/styled/titleMessageLink.html'),\n});\n\ninterface ViewModelParams {\n title: string;\n\n message?: string;\n messageHtml?: string;\n\n continueText?: string;\n\n optionText?: string;\n optionLink: string;\n /**\n * Displayed as a button by default\n */\n optionAsLink?: boolean;\n /**\n * If specified do not navigate to optionLink and instead call this callback\n **/\n optionCallback?: () => void;\n\n svgIcon?: string;\n svgIconSymbol?: string;\n svgIconSymbolLarge?: string;\n}\n\nclass StyledModal extends BaseModal {\n view = 'modals/styled/titleMessageLink';\n\n public params: ViewModelParams;\n\n public continueText: string;\n\n public optionText: string;\n\n public optionLink: string;\n\n public optionCallback: () => void;\n\n public classes = {\n option: 'btn btn-block btn-lg btn-primary',\n cta: 'btn-secondary',\n };\n\n constructor(params: ViewModelParams) {\n super();\n this.params = params;\n this.continueText = params.continueText ? params.continueText : 'Close';\n this.optionText = params.optionText ? params.optionText : 'Continue';\n this.optionLink = params.optionLink;\n this.optionCallback = params.optionCallback;\n\n if (params.optionAsLink) {\n this.classes.option = '';\n this.classes.cta = 'btn-primary';\n }\n }\n\n public close(): void {\n dialog.close(this, false);\n }\n\n public selectOption(e: Event) {\n if (this.optionCallback) {\n this.optionCallback();\n dialog.close(this, true);\n return false; // Don't follow the link href\n }\n\n dialog.close(this, true);\n return true;\n }\n\n public static show(params: ViewModelParams): JQueryPromise {\n return dialog.show(new StyledModal(params));\n }\n}\n\nexport default StyledModal;\n"],"names":["API_PREFIX","CodatEvents","setupPopupWindow","width","height","centered","parameters","location","left","window","screen","top","features","Object","keys","map","k","join","popup","open","document","write","NoSyncProgress","ko","BaseAccountingSoftwarePackage","usesCodat","constructor","id","companyService","name","getAccountingSoftwareNameByType","shortName","getAccountingSoftwareShortNameByType","getSyncProgress","_syncDataTypes","GetBillAttachment","attachment","GetId","GetName","GetShortName","SupportsInvoices","supportsInvoices","SyncData","syncType","syncDataTypes","Promise","resolve","getFullVendorDetails","vendorDetails","getFullCustomerDetails","customerDetails","fireAccountingSoftwareConnectingEvent","context","CompanyEventService","emit","AccountingSoftwareIntegrationEventsServiceEventType","AccountingPlatformConnectionInitiated","accountingPlatform","fireAccountingSoftwareConnectedEvent","AccountingPlatformConnected","syncTimeoutError","Error","SyncState","NetSuiteAccountingPackage","connectIcon","logoUrl","create","globalThis","import_meta_env","APP_STATIC_APP_ROOT_URL","icon","NetSuiteLogo","maxWaitTimeForDataSyncInMilliseconds","syncState","Map","values","CodatDataType","dataType","None","_memoize","filter","get","Completed","length","String","_sortBy","_identity","SupportedAccountingSoftware","NetSuite","GetAccounts","companyId","CompanyId","url","URL","APP_URLS_API_URL","ApiService","toString","AddAccount","account","post","body","Connect","codatConnection","undefined","href","connectionLink","ConnectConnectIcon","Connected","info","console","log","FilterResolutions","conflictingAccountName","GenerateConnectButton","$target","$","class","appendTo","click","GetBills","waitForSyncedDataTypes","Bills","billData","data","Bill","fetchCompany","codatCompanyName","GetContacts","GetInvoices","Invoices","invoiceData","Invoice","GetReconciliationStatus","dataTypes","skipUntil","every","updateSyncState","state","next","forEach","set","startSyncListener","dataSyncSubscription","lastTimeDataTypeWasSynced","Date","now","syncStartTime","eventsService","on","DataSync","detail","elapsedTimeInSeconds","toFixed","totalTime","totalTimeInSeconds","Math","ceil","maybeStopSyncListener","stopSyncListener","off","Array","from","some","Pending","syncPromise","then","response","isSyncRequestSent","analytics","finally","timeoutPromise","_resolve","reject","setTimeout","race","QBWCFileLink","file","link","QuickBooksDesktopAccountingPackage","QuickBooksIcon","QuickBooksDesktop","newAccountName","replace","trim","substring","put","router","DownloadQBWC","qbwcFile","downloadUrl","templateId","QuickBooksOnlineAccountingPackage","AccountingSoftware","QuickBooksOnline","error","connectUrl","oauthData","QuickBooksAccountingPackage","LinkSession","verifiedToken","GetToken","accessToken","XeroAccountingPackage","XeroLogo","Xero","type","titleMessageLinkModal","show","title","optionText","optionLink","message","svgIconSymbolLarge","membership","company","accountingSoftware","valueHasMutated","PostSettings","xeroAccountingSoftwareSettings","AccountingSoftwareService","packages","GetPackages","GetPackage","find","p","Instance","pay","attachments","attachmentStatus","vendor","utcDate","XDate","date","getFullYear","getMonth","getDate","amount","billNumber","currency","hasAttachments","trackingCategories","push","memo","customer","invoiceNumber","inProgress","isPadAgreementCompleted","declareModules","modals/styled/titleMessageLink.html","StyledModal","BaseModal","view","classes","option","cta","params","continueText","optionCallback","optionAsLink","close","dialog","selectOption","e"],"sourceRoot":""}