@bisondesk/core-sdk 1.0.682 → 1.0.683
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/types/leasing-debtors.d.ts +3 -0
- package/lib/types/leasing-debtors.d.ts.map +1 -1
- package/lib/types/leasing-debtors.js.map +1 -1
- package/lib/types/leasing-search.d.ts +2 -0
- package/lib/types/leasing-search.d.ts.map +1 -1
- package/lib/types/leasing-search.js.map +1 -1
- package/lib/types/mileage.d.ts +38 -0
- package/lib/types/mileage.d.ts.map +1 -0
- package/lib/types/mileage.js +15 -0
- package/lib/types/mileage.js.map +1 -0
- package/lib/types/vehicle-purchase-payments.d.ts +0 -15
- package/lib/types/vehicle-purchase-payments.d.ts.map +1 -1
- package/lib/types/vehicle-purchase-payments.js +0 -6
- package/lib/types/vehicle-purchase-payments.js.map +1 -1
- package/lib/utils/mileage.d.ts +18 -0
- package/lib/utils/mileage.d.ts.map +1 -0
- package/lib/utils/mileage.js +70 -0
- package/lib/utils/mileage.js.map +1 -0
- package/lib/utils/mileage.test.d.ts +2 -0
- package/lib/utils/mileage.test.d.ts.map +1 -0
- package/lib/utils/mileage.test.js +103 -0
- package/lib/utils/mileage.test.js.map +1 -0
- package/package.json +1 -1
- package/src/types/leasing-debtors.ts +4 -0
- package/src/types/leasing-search.ts +2 -0
- package/src/types/mileage.ts +51 -0
- package/src/types/vehicle-purchase-payments.ts +5 -36
- package/src/utils/mileage.test.ts +151 -0
- package/src/utils/mileage.ts +111 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/src/types/activities.js +0 -13
- package/src/types/activities.js.map +0 -1
- package/src/types/comparables.js +0 -2
- package/src/types/comparables.js.map +0 -1
- package/src/types/crm.js +0 -58
- package/src/types/crm.js.map +0 -1
- package/src/types/dashboard.js +0 -2
- package/src/types/dashboard.js.map +0 -1
- package/src/types/definitions.js +0 -2
- package/src/types/definitions.js.map +0 -1
- package/src/types/fields.js +0 -2
- package/src/types/fields.js.map +0 -1
- package/src/types/insights.js +0 -2
- package/src/types/insights.js.map +0 -1
- package/src/types/interests.js +0 -6
- package/src/types/interests.js.map +0 -1
- package/src/types/internal-events.js +0 -18
- package/src/types/internal-events.js.map +0 -1
- package/src/types/internet-opportunities.js +0 -2
- package/src/types/internet-opportunities.js.map +0 -1
- package/src/types/internet-vehicles.js +0 -2
- package/src/types/internet-vehicles.js.map +0 -1
- package/src/types/leasing-administration.js +0 -2
- package/src/types/leasing-administration.js.map +0 -1
- package/src/types/leasing-debtors.js +0 -2
- package/src/types/leasing-debtors.js.map +0 -1
- package/src/types/leasing-search.js +0 -2
- package/src/types/leasing-search.js.map +0 -1
- package/src/types/leasing-settings.js +0 -7
- package/src/types/leasing-settings.js.map +0 -1
- package/src/types/leasing.js +0 -38
- package/src/types/leasing.js.map +0 -1
- package/src/types/marketing.js +0 -35
- package/src/types/marketing.js.map +0 -1
- package/src/types/offers.js +0 -56
- package/src/types/opportunities.js +0 -107
- package/src/types/opportunities.js.map +0 -1
- package/src/types/payments.js +0 -7
- package/src/types/picklists.js +0 -2
- package/src/types/picklists.js.map +0 -1
- package/src/types/quotes.js +0 -42
- package/src/types/recently-viewed.js +0 -2
- package/src/types/recently-viewed.js.map +0 -1
- package/src/types/reservations.js +0 -5
- package/src/types/reservations.js.map +0 -1
- package/src/types/roi-ratings.js +0 -5
- package/src/types/roi-ratings.js.map +0 -1
- package/src/types/saved-filters.js +0 -9
- package/src/types/saved-filters.js.map +0 -1
- package/src/types/search.js +0 -2
- package/src/types/search.js.map +0 -1
- package/src/types/settings.js +0 -2
- package/src/types/settings.js.map +0 -1
- package/src/types/templates.js +0 -2
- package/src/types/templates.js.map +0 -1
- package/src/types/tenants.js +0 -21
- package/src/types/tenants.js.map +0 -1
- package/src/types/user-performance.js +0 -7
- package/src/types/user-performance.js.map +0 -1
- package/src/types/utils.js +0 -2
- package/src/types/validation.js +0 -2
- package/src/types/validation.js.map +0 -1
- package/src/types/vehicle-sales.js +0 -6
- package/src/types/vehicle-sales.js.map +0 -1
- package/src/types/vehicles.js +0 -98
- package/src/types/vehicles.js.map +0 -1
- package/src/utils/leasing.js +0 -6
- package/src/utils/leasing.js.map +0 -1
- package/src/utils/opportunities.js +0 -48
- package/src/utils/opportunities.js.map +0 -1
|
@@ -2,6 +2,7 @@ import { EmailMessage } from '@bisondesk/commons-sdk/messages';
|
|
|
2
2
|
import { NextList, PaginatedList } from '@bisondesk/commons-sdk/types';
|
|
3
3
|
import { Contact, Organization } from './crm.js';
|
|
4
4
|
import { LeasingContract } from './leasing.js';
|
|
5
|
+
import { ContractMileage, MileageSummary } from './mileage.js';
|
|
5
6
|
import { BaseSearchRequest, SortFilter, SortOrder } from './search.js';
|
|
6
7
|
import { DataRecord, ReferenceData } from './utils.js';
|
|
7
8
|
export type MonthData = {
|
|
@@ -257,6 +258,8 @@ export type SearchDebtorsDossier = {
|
|
|
257
258
|
remindersSent: number;
|
|
258
259
|
hasActiveLdrs?: boolean;
|
|
259
260
|
};
|
|
261
|
+
mileage?: ContractMileage[];
|
|
262
|
+
mileageSummary?: MileageSummary;
|
|
260
263
|
};
|
|
261
264
|
export type DebtorsDossierKanbanColumn = {
|
|
262
265
|
status: DebtorsDossierStatus;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"leasing-debtors.d.ts","sourceRoot":"/","sources":["types/leasing-debtors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEvD,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/types';\nimport { Contact, Organization } from './crm.js';\nimport { LeasingContract } from './leasing.js';\nimport { BaseSearchRequest, SortFilter, SortOrder } from './search.js';\nimport { DataRecord, ReferenceData } from './utils.js';\n\nexport type MonthData = {\n activeContractIds: string[];\n date: string; // YYYY-MM\n overdueAmount: string;\n unpaidAmount: string;\n overdueContractIds: string[];\n overdueInvoiceIds: string[];\n riskLevel: number;\n monthlyInvoicedAmount: string;\n // Non-leasing (\"extra\") debt for this month, computed as-of month-end.\n nonLeasingOverdueAmount: string;\n nonLeasingUnpaidAmount: string;\n};\n\nexport type DebtorInfo = {\n clientId: string;\n branchIds: string[];\n months: MonthData[];\n\n // properties related to the current month\n activeContracts: number;\n overdueAmount: string;\n nonLeasingOverdueAmount: string;\n nonLeasingUnpaidAmount: string;\n unpaidAmount: string;\n overdueContracts: number;\n riskLevel: number;\n monthlyInvoicedAmount: string;\n};\n\nexport type SearchDebtorInfo = {\n org: Organization;\n contact?: Contact;\n debtor: DebtorInfo;\n activeDebtorDossier?: {\n dossier: DebtorsDossier;\n hasDossier: boolean;\n lastActivityAt?: string;\n lastActivityBy?: string;\n hasActivitiesLogged: boolean;\n };\n custom: {\n riskLevelLabel: string;\n hasActiveContracts: boolean;\n };\n};\n\nexport enum DebtorsDossierStatus {\n AUTO_REMINDER = 'auto_reminder',\n OVERDUE = 'overdue',\n CONTACT_ATTEMPTED = 'contact_attempted',\n DIALOGUE = 'dialogue',\n PROMISE_TO_PAY = 'promise_to_pay',\n FAILURE = 'failure',\n RESOLVED = 'resolved',\n}\n\nexport const debtorsDossierStatusToDateFieldMap: Record<\n DebtorsDossierStatus,\n { date: keyof DossierStatusLogFields; author: keyof DossierStatusLogFields } | null\n> = {\n [DebtorsDossierStatus.AUTO_REMINDER]: null,\n [DebtorsDossierStatus.OVERDUE]: { date: 'overdueAt', author: 'overdueBy' },\n [DebtorsDossierStatus.CONTACT_ATTEMPTED]: { date: 'contactedAt', author: 'contactedBy' },\n [DebtorsDossierStatus.DIALOGUE]: { date: 'dialogueAt', author: 'dialogueBy' },\n [DebtorsDossierStatus.PROMISE_TO_PAY]: { date: 'promiseToPayAt', author: 'promiseToPayBy' },\n [DebtorsDossierStatus.RESOLVED]: { date: 'resolvedAt', author: 'resolvedBy' },\n [DebtorsDossierStatus.FAILURE]: { date: 'failedAt', author: 'failedBy' },\n};\n\n/******\n * Auto Follow-Up Types\n ******/\n\nexport type ReminderWhatsappAttemptStatus = 'SENT' | 'DELIVERED' | 'FAILED' | 'SKIPPED';\n\n// see docs/adr/0026-whatsapp-leasing-notifications-alongside-email.md\nexport type ReminderWhatsappAttempt = {\n dedupId: string;\n templateId: string;\n phone: string;\n riskLevel: number;\n sentAt: string;\n status: ReminderWhatsappAttemptStatus;\n failureReason?: string;\n};\n\nexport type DebtorAutoFollowUp = {\n id: string;\n organizationId: string;\n organizationName: string;\n status: 'ONGOING' | 'ERROR' | 'SUCCESS' | 'EXPIRED' | 'DISCARDED';\n discardReason?: string;\n emails: EmailMessage[];\n whatsapps?: ReminderWhatsappAttempt[];\n createdAt: string;\n modifiedAt: string;\n completedAt?: string;\n nextActionAt: string;\n riskLevel: number;\n};\n\nexport type ListOverdueRemindersResponse = PaginatedList<DebtorAutoFollowUp, ReferenceData>;\nexport type ListOverdueRemindersRequest = {\n offset: number;\n limit: number;\n sortBy: SortFilter;\n};\n\n/******\n * Debtor Dossier Types\n ******/\n\nexport enum DebtorsDossierActions {\n SET_METADATA = 'set_metadata',\n ADD_ACTIVITY = 'add_activity',\n FINISH = 'finish',\n SET_DOCUMENTS = 'set_documents',\n SET_PAYMENT_PLAN = 'set_payment_plan',\n SET_LEGAL_DOSSIER = 'set_legal_dossier',\n REOPEN = 'reopen',\n}\n\nexport type DossierStatusLogFields = {\n failedAt?: string;\n failedBy?: string;\n resolvedAt?: string;\n contactedAt?: string;\n contactedBy?: string;\n overdueAt?: string;\n overdueBy?: string;\n resolvedBy?: string;\n dialogueAt?: string;\n dialogueBy?: string;\n promiseToPayAt?: string;\n promiseToPayBy?: string;\n};\n\nexport type BaseDebtorsDossier = {\n organizationId: string;\n tags: string[];\n origin: 'manual' | 'auto';\n autoFollowUpId?: string;\n administrativeUserId?: string;\n branchId: string;\n tenantId: string;\n};\nexport type DebtorsDossierStatusAudit = {\n from: DebtorsDossierStatus;\n to: DebtorsDossierStatus;\n changedAt: string;\n changedBy: string;\n};\n\nexport type DebtorsDossier = BaseDebtorsDossier &\n DossierStatusLogFields & {\n id: string;\n createdAt: string;\n createdBy: string;\n updatedAt: string;\n updatedBy: string;\n status: DebtorsDossierStatus;\n statusAudit: DebtorsDossierStatusAudit[];\n };\n\nexport type NewDebtorsDossier = BaseDebtorsDossier & {\n id?: undefined;\n createdBy?: undefined;\n createdAt?: undefined;\n updatedBy?: undefined;\n updatedAt?: undefined;\n};\n\nexport type DebtorsDossierBff = {\n dossier: DataRecord<DebtorsDossier>;\n organization?: Organization;\n leasingContracts: LeasingContract[];\n debt?: DebtorInfo;\n paymentPlan?: DebtorsPaymentPlan;\n legalDossier?: LegalDossier;\n trackAndTraceDevices: {\n /* odometer: TrackAndTraceOdometerData;\n device: TrackAndTraceDevice; */\n }[];\n};\n\nexport type UpdateDebtorsDossier = Partial<\n Pick<DebtorsDossier, 'status' | 'tags' | 'branchId' | 'organizationId'>\n> & {\n overdue?: boolean;\n resolve?: boolean;\n administrativeUserId?: string | null;\n};\n\n/******\n * Payment Plan Types\n ******/\n\nexport type DebtorsPaymentPlan = {\n id: string;\n debtorDossierId: string;\n\n notes: {\n content: string;\n createdAt: string;\n createdBy: string;\n }[];\n\n reminders?: {\n startDate: string; // ISO date string\n frequency: {\n every: number;\n period: 'days' | 'weeks' | 'months';\n };\n endCondition:\n | {\n endDate: string; // ISO date string\n }\n | {\n occurrences: number; // Number of reminders to send\n };\n };\n\n createdAt: string;\n createdBy: string;\n updatedAt: string;\n updatedBy: string;\n};\n\nexport type NewPaymentPlan = Omit<\n DebtorsPaymentPlan,\n 'id' | 'createdAt' | 'updatedAt' | 'createdBy' | 'updatedBy' | 'notes'\n> & { notes?: string };\n\nexport type UpdatePaymentPlan = Partial<Pick<DebtorsPaymentPlan, 'reminders'>> & {\n newNote?: string;\n};\n\n/******\n * Legal Dossier Types\n ******/\n\nexport enum LegalDossierStatus {\n ASSESSMENT = 'assessment',\n PRE_LEGAL_NOTICE = 'pre_legal_notice',\n SENT_TO_LAWYER = 'sent_to_lawyer',\n FILED = 'filed',\n IN_COURT = 'in_court',\n JUDGMENT = 'judgment',\n ENFORCEMENT = 'enforcement',\n SETTLEMENT = 'settlement',\n CLOSED_RECOVERED = 'closed_recovered',\n CLOSED_UNRECOVERABLE = 'closed_unrecoverable',\n ON_HOLD = 'on_hold',\n}\n\nexport type LegalDossier = {\n id: string;\n debtorDossierId: string;\n caseNumber?: string;\n courtDate?: string; // ISO date string (YYYY-MM-DD)\n vehicleReportedToPolice?: boolean;\n vehicleReportedToPoliceAt?: string; // ISO timestamp, stamped server-side\n notes?: string;\n createdAt: string;\n createdBy: string;\n updatedAt: string;\n updatedBy: string;\n status: LegalDossierStatus;\n};\n\nexport type NewLegalDossier = Omit<\n LegalDossier,\n 'id' | 'createdAt' | 'updatedAt' | 'createdBy' | 'updatedBy'\n>;\n\nexport type UpdateLegalDossier = Partial<\n Pick<LegalDossier, 'caseNumber' | 'courtDate' | 'status' | 'notes' | 'vehicleReportedToPolice'>\n>;\n\n/******\n * Debtor Dossier Events\n ******/\n\nexport type DebtorsDossierCreateEvent = {\n action: 'created';\n data: DebtorsDossier;\n previousData?: undefined;\n tenantId: string;\n userId: string;\n};\n\nexport type DebtorsDossierUpdateEvent = {\n action: 'updated';\n data: DebtorsDossier;\n previousData: DebtorsDossier;\n tenantId: string;\n userId: string;\n};\n\nexport type DebtorsDossierDeleteEvent = {\n action: 'deleted';\n data?: undefined;\n previousData: DebtorsDossier;\n tenantId: string;\n userId: string;\n};\n\nexport type DebtorsDossierEvent =\n | DebtorsDossierCreateEvent\n | DebtorsDossierUpdateEvent\n | DebtorsDossierDeleteEvent;\n\n/************\n *\n * Search\n */\n\nexport type SearchDebtorsDossier = {\n contact?: Contact;\n debtorsDossier: DebtorsDossier;\n org?: Organization;\n legalDossier?: LegalDossier;\n paymentPlan?: DebtorsPaymentPlan;\n hasPaymentPlan?: boolean;\n branchIds?: string[];\n tasks: {\n totalTasks: number;\n openTasks: number;\n nextDueAt?: string;\n };\n overdue: {\n riskLevel: number;\n riskLevelLabel?: string;\n remindersSent: number;\n hasActiveLdrs?: boolean;\n };\n};\n\n/************\n *\n * Kanban\n */\n\nexport type DebtorsDossierKanbanColumn = {\n status: DebtorsDossierStatus;\n results: SearchDebtorsDossier[];\n totalCount: number;\n totalValue: string;\n};\n\nexport type MSearchDebtorsDossierKanbanColumn = {\n column: DebtorsDossierKanbanColumn;\n nextToken?: string;\n};\n\nexport type KanbanDebtorsDossierSearchRequest = BaseSearchRequest & {\n nextTokens?: Record<string, string | undefined>;\n statusSortBy?: Record<DebtorsDossierStatus, { fieldId: string; order: SortOrder }[]>;\n};\n\nexport type KanbanDebtorsDossierNextList = Omit<\n NextList<DebtorsDossierKanbanColumn, ReferenceData>,\n 'nextToken'\n> & {\n nextTokens?: Record<string, string | undefined>;\n};\n\nexport const DebtorsDossierStatusOrder: DebtorsDossierStatus[] = [\n DebtorsDossierStatus.AUTO_REMINDER,\n DebtorsDossierStatus.OVERDUE,\n DebtorsDossierStatus.CONTACT_ATTEMPTED,\n DebtorsDossierStatus.DIALOGUE,\n DebtorsDossierStatus.PROMISE_TO_PAY,\n DebtorsDossierStatus.FAILURE,\n];\n\nexport const DebtorsDossierWonColumnId = DebtorsDossierStatus.RESOLVED;\n\nexport const DebtorsDossierKanbanEndColumns: DebtorsDossierStatus[] = [\n DebtorsDossierStatus.RESOLVED,\n];\n\nexport const DebtorsDossierKanbanColumns = [\n ...DebtorsDossierStatusOrder,\n ...DebtorsDossierKanbanEndColumns,\n];\n"]}
|
|
1
|
+
{"version":3,"file":"leasing-debtors.js","sourceRoot":"/","sources":["types/leasing-deb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M,CAAN,IAAY,kBAYX;AAZD,WAAY,kBAAkB;IAC5B,+CAAyB,CAAA;IACzB,2DAAqC,CAAA;IACrC,uDAAiC,CAAA;IACjC,qCAAe,CAAA;IACf,2CAAqB,CAAA;IACrB,2CAAqB,CAAA;IACrB,iDAA2B,CAAA;IAC3B,+CAAyB,CAAA;IACzB,2DAAqC,CAAA;IACrC,mEAA6C,CAAA;IAC7C,yCAAmB,CAAA;AACrB,CAAC,EAZW,kBAAkB,KAAlB,kBAAkB,QAY7B;AAqHD,MAAM,CAAC,MAAM,yBAAyB,GAA2B;IAC/D,oBAAoB,CAAC,aAAa;IAClC,oBAAoB,CAAC,OAAO;IAC5B,oBAAoB,CAAC,iBAAiB;IACtC,oBAAoB,CAAC,QAAQ;IAC7B,oBAAoB,CAAC,cAAc;IACnC,oBAAoB,CAAC,OAAO;CAC7B,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAG,oBAAoB,CAAC,QAAQ,CAAC;AAEvE,MAAM,CAAC,MAAM,8BAA8B,GAA2B;IACpE,oBAAoB,CAAC,QAAQ;CAC9B,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,GAAG,yBAAyB;IAC5B,GAAG,8BAA8B;CAClC,CAAC","sourcesContent":["import { EmailMessage } from '@bisondesk/commons-sdk/messages';\nimport { NextList, PaginatedList } from '@bisondesk/commons-sdk/types';\nimport { Contact, Organization } from './crm.js';\nimport { LeasingContract } from './leasing.js';\nimport { ContractMileage, MileageSummary } from './mileage.js';\nimport { BaseSearchRequest, SortFilter, SortOrder } from './search.js';\nimport { DataRecord, ReferenceData } from './utils.js';\n\nexport type MonthData = {\n activeContractIds: string[];\n date: string; // YYYY-MM\n overdueAmount: string;\n unpaidAmount: string;\n overdueContractIds: string[];\n overdueInvoiceIds: string[];\n riskLevel: number;\n monthlyInvoicedAmount: string;\n // Non-leasing (\"extra\") debt for this month, computed as-of month-end.\n nonLeasingOverdueAmount: string;\n nonLeasingUnpaidAmount: string;\n};\n\nexport type DebtorInfo = {\n clientId: string;\n branchIds: string[];\n months: MonthData[];\n\n // properties related to the current month\n activeContracts: number;\n overdueAmount: string;\n nonLeasingOverdueAmount: string;\n nonLeasingUnpaidAmount: string;\n unpaidAmount: string;\n overdueContracts: number;\n riskLevel: number;\n monthlyInvoicedAmount: string;\n};\n\nexport type SearchDebtorInfo = {\n org: Organization;\n contact?: Contact;\n debtor: DebtorInfo;\n activeDebtorDossier?: {\n dossier: DebtorsDossier;\n hasDossier: boolean;\n lastActivityAt?: string;\n lastActivityBy?: string;\n hasActivitiesLogged: boolean;\n };\n custom: {\n riskLevelLabel: string;\n hasActiveContracts: boolean;\n };\n};\n\nexport enum DebtorsDossierStatus {\n AUTO_REMINDER = 'auto_reminder',\n OVERDUE = 'overdue',\n CONTACT_ATTEMPTED = 'contact_attempted',\n DIALOGUE = 'dialogue',\n PROMISE_TO_PAY = 'promise_to_pay',\n FAILURE = 'failure',\n RESOLVED = 'resolved',\n}\n\nexport const debtorsDossierStatusToDateFieldMap: Record<\n DebtorsDossierStatus,\n { date: keyof DossierStatusLogFields; author: keyof DossierStatusLogFields } | null\n> = {\n [DebtorsDossierStatus.AUTO_REMINDER]: null,\n [DebtorsDossierStatus.OVERDUE]: { date: 'overdueAt', author: 'overdueBy' },\n [DebtorsDossierStatus.CONTACT_ATTEMPTED]: { date: 'contactedAt', author: 'contactedBy' },\n [DebtorsDossierStatus.DIALOGUE]: { date: 'dialogueAt', author: 'dialogueBy' },\n [DebtorsDossierStatus.PROMISE_TO_PAY]: { date: 'promiseToPayAt', author: 'promiseToPayBy' },\n [DebtorsDossierStatus.RESOLVED]: { date: 'resolvedAt', author: 'resolvedBy' },\n [DebtorsDossierStatus.FAILURE]: { date: 'failedAt', author: 'failedBy' },\n};\n\n/******\n * Auto Follow-Up Types\n ******/\n\nexport type ReminderWhatsappAttemptStatus = 'SENT' | 'DELIVERED' | 'FAILED' | 'SKIPPED';\n\n// see docs/adr/0026-whatsapp-leasing-notifications-alongside-email.md\nexport type ReminderWhatsappAttempt = {\n dedupId: string;\n templateId: string;\n phone: string;\n riskLevel: number;\n sentAt: string;\n status: ReminderWhatsappAttemptStatus;\n failureReason?: string;\n};\n\nexport type DebtorAutoFollowUp = {\n id: string;\n organizationId: string;\n organizationName: string;\n status: 'ONGOING' | 'ERROR' | 'SUCCESS' | 'EXPIRED' | 'DISCARDED';\n discardReason?: string;\n emails: EmailMessage[];\n whatsapps?: ReminderWhatsappAttempt[];\n createdAt: string;\n modifiedAt: string;\n completedAt?: string;\n nextActionAt: string;\n riskLevel: number;\n};\n\nexport type ListOverdueRemindersResponse = PaginatedList<DebtorAutoFollowUp, ReferenceData>;\nexport type ListOverdueRemindersRequest = {\n offset: number;\n limit: number;\n sortBy: SortFilter;\n};\n\n/******\n * Debtor Dossier Types\n ******/\n\nexport enum DebtorsDossierActions {\n SET_METADATA = 'set_metadata',\n ADD_ACTIVITY = 'add_activity',\n FINISH = 'finish',\n SET_DOCUMENTS = 'set_documents',\n SET_PAYMENT_PLAN = 'set_payment_plan',\n SET_LEGAL_DOSSIER = 'set_legal_dossier',\n REOPEN = 'reopen',\n}\n\nexport type DossierStatusLogFields = {\n failedAt?: string;\n failedBy?: string;\n resolvedAt?: string;\n contactedAt?: string;\n contactedBy?: string;\n overdueAt?: string;\n overdueBy?: string;\n resolvedBy?: string;\n dialogueAt?: string;\n dialogueBy?: string;\n promiseToPayAt?: string;\n promiseToPayBy?: string;\n};\n\nexport type BaseDebtorsDossier = {\n organizationId: string;\n tags: string[];\n origin: 'manual' | 'auto';\n autoFollowUpId?: string;\n administrativeUserId?: string;\n branchId: string;\n tenantId: string;\n};\nexport type DebtorsDossierStatusAudit = {\n from: DebtorsDossierStatus;\n to: DebtorsDossierStatus;\n changedAt: string;\n changedBy: string;\n};\n\nexport type DebtorsDossier = BaseDebtorsDossier &\n DossierStatusLogFields & {\n id: string;\n createdAt: string;\n createdBy: string;\n updatedAt: string;\n updatedBy: string;\n status: DebtorsDossierStatus;\n statusAudit: DebtorsDossierStatusAudit[];\n };\n\nexport type NewDebtorsDossier = BaseDebtorsDossier & {\n id?: undefined;\n createdBy?: undefined;\n createdAt?: undefined;\n updatedBy?: undefined;\n updatedAt?: undefined;\n};\n\nexport type DebtorsDossierBff = {\n dossier: DataRecord<DebtorsDossier>;\n organization?: Organization;\n leasingContracts: LeasingContract[];\n debt?: DebtorInfo;\n paymentPlan?: DebtorsPaymentPlan;\n legalDossier?: LegalDossier;\n trackAndTraceDevices: {\n /* odometer: TrackAndTraceOdometerData;\n device: TrackAndTraceDevice; */\n }[];\n};\n\nexport type UpdateDebtorsDossier = Partial<\n Pick<DebtorsDossier, 'status' | 'tags' | 'branchId' | 'organizationId'>\n> & {\n overdue?: boolean;\n resolve?: boolean;\n administrativeUserId?: string | null;\n};\n\n/******\n * Payment Plan Types\n ******/\n\nexport type DebtorsPaymentPlan = {\n id: string;\n debtorDossierId: string;\n\n notes: {\n content: string;\n createdAt: string;\n createdBy: string;\n }[];\n\n reminders?: {\n startDate: string; // ISO date string\n frequency: {\n every: number;\n period: 'days' | 'weeks' | 'months';\n };\n endCondition:\n | {\n endDate: string; // ISO date string\n }\n | {\n occurrences: number; // Number of reminders to send\n };\n };\n\n createdAt: string;\n createdBy: string;\n updatedAt: string;\n updatedBy: string;\n};\n\nexport type NewPaymentPlan = Omit<\n DebtorsPaymentPlan,\n 'id' | 'createdAt' | 'updatedAt' | 'createdBy' | 'updatedBy' | 'notes'\n> & { notes?: string };\n\nexport type UpdatePaymentPlan = Partial<Pick<DebtorsPaymentPlan, 'reminders'>> & {\n newNote?: string;\n};\n\n/******\n * Legal Dossier Types\n ******/\n\nexport enum LegalDossierStatus {\n ASSESSMENT = 'assessment',\n PRE_LEGAL_NOTICE = 'pre_legal_notice',\n SENT_TO_LAWYER = 'sent_to_lawyer',\n FILED = 'filed',\n IN_COURT = 'in_court',\n JUDGMENT = 'judgment',\n ENFORCEMENT = 'enforcement',\n SETTLEMENT = 'settlement',\n CLOSED_RECOVERED = 'closed_recovered',\n CLOSED_UNRECOVERABLE = 'closed_unrecoverable',\n ON_HOLD = 'on_hold',\n}\n\nexport type LegalDossier = {\n id: string;\n debtorDossierId: string;\n caseNumber?: string;\n courtDate?: string; // ISO date string (YYYY-MM-DD)\n vehicleReportedToPolice?: boolean;\n vehicleReportedToPoliceAt?: string; // ISO timestamp, stamped server-side\n notes?: string;\n createdAt: string;\n createdBy: string;\n updatedAt: string;\n updatedBy: string;\n status: LegalDossierStatus;\n};\n\nexport type NewLegalDossier = Omit<\n LegalDossier,\n 'id' | 'createdAt' | 'updatedAt' | 'createdBy' | 'updatedBy'\n>;\n\nexport type UpdateLegalDossier = Partial<\n Pick<LegalDossier, 'caseNumber' | 'courtDate' | 'status' | 'notes' | 'vehicleReportedToPolice'>\n>;\n\n/******\n * Debtor Dossier Events\n ******/\n\nexport type DebtorsDossierCreateEvent = {\n action: 'created';\n data: DebtorsDossier;\n previousData?: undefined;\n tenantId: string;\n userId: string;\n};\n\nexport type DebtorsDossierUpdateEvent = {\n action: 'updated';\n data: DebtorsDossier;\n previousData: DebtorsDossier;\n tenantId: string;\n userId: string;\n};\n\nexport type DebtorsDossierDeleteEvent = {\n action: 'deleted';\n data?: undefined;\n previousData: DebtorsDossier;\n tenantId: string;\n userId: string;\n};\n\nexport type DebtorsDossierEvent =\n | DebtorsDossierCreateEvent\n | DebtorsDossierUpdateEvent\n | DebtorsDossierDeleteEvent;\n\n/************\n *\n * Search\n */\n\nexport type SearchDebtorsDossier = {\n contact?: Contact;\n debtorsDossier: DebtorsDossier;\n org?: Organization;\n legalDossier?: LegalDossier;\n paymentPlan?: DebtorsPaymentPlan;\n hasPaymentPlan?: boolean;\n branchIds?: string[];\n tasks: {\n totalTasks: number;\n openTasks: number;\n nextDueAt?: string;\n };\n overdue: {\n riskLevel: number;\n riskLevelLabel?: string;\n remindersSent: number;\n hasActiveLdrs?: boolean;\n };\n /** One entry per tracked contract of the organization, copied from the contracts index. */\n mileage?: ContractMileage[];\n mileageSummary?: MileageSummary;\n};\n\n/************\n *\n * Kanban\n */\n\nexport type DebtorsDossierKanbanColumn = {\n status: DebtorsDossierStatus;\n results: SearchDebtorsDossier[];\n totalCount: number;\n totalValue: string;\n};\n\nexport type MSearchDebtorsDossierKanbanColumn = {\n column: DebtorsDossierKanbanColumn;\n nextToken?: string;\n};\n\nexport type KanbanDebtorsDossierSearchRequest = BaseSearchRequest & {\n nextTokens?: Record<string, string | undefined>;\n statusSortBy?: Record<DebtorsDossierStatus, { fieldId: string; order: SortOrder }[]>;\n};\n\nexport type KanbanDebtorsDossierNextList = Omit<\n NextList<DebtorsDossierKanbanColumn, ReferenceData>,\n 'nextToken'\n> & {\n nextTokens?: Record<string, string | undefined>;\n};\n\nexport const DebtorsDossierStatusOrder: DebtorsDossierStatus[] = [\n DebtorsDossierStatus.AUTO_REMINDER,\n DebtorsDossierStatus.OVERDUE,\n DebtorsDossierStatus.CONTACT_ATTEMPTED,\n DebtorsDossierStatus.DIALOGUE,\n DebtorsDossierStatus.PROMISE_TO_PAY,\n DebtorsDossierStatus.FAILURE,\n];\n\nexport const DebtorsDossierWonColumnId = DebtorsDossierStatus.RESOLVED;\n\nexport const DebtorsDossierKanbanEndColumns: DebtorsDossierStatus[] = [\n DebtorsDossierStatus.RESOLVED,\n];\n\nexport const DebtorsDossierKanbanColumns = [\n ...DebtorsDossierStatusOrder,\n ...DebtorsDossierKanbanEndColumns,\n];\n"]}
|
|
@@ -2,6 +2,7 @@ import { InsuranceEntry } from '@bisondesk/commons-sdk/insurance';
|
|
|
2
2
|
import { Contact, Organization } from './crm.js';
|
|
3
3
|
import { PublicSearchDefinition } from './definitions.js';
|
|
4
4
|
import { LeasingContract } from './leasing.js';
|
|
5
|
+
import { ContractMileage } from './mileage.js';
|
|
5
6
|
import { Vehicle } from './vehicles.js';
|
|
6
7
|
export type LeasingPublicSearchDefinitions = {
|
|
7
8
|
searchLeasingContract: PublicSearchDefinition;
|
|
@@ -24,6 +25,7 @@ export type SearchLeasingContract = {
|
|
|
24
25
|
supplierName?: string;
|
|
25
26
|
hasActiveRecurrence?: boolean;
|
|
26
27
|
lastRecurrenceRunAt?: string;
|
|
28
|
+
mileage?: ContractMileage;
|
|
27
29
|
};
|
|
28
30
|
};
|
|
29
31
|
export type InputSearchLeasingContract = SearchLeasingContract;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"leasing-search.d.ts","sourceRoot":"/","sources":["types/leasing-search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,MAAM,MAAM,8BAA8B,GAAG;IAC3C,qBAAqB,EAAE,sBAAsB,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG;IAC5C,OAAO,EAAE,sBAAsB,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,EAAE,eAAe,CAAC;IAC1B,GAAG,EAAE,YAAY,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE;QACN,MAAM,EAAE,OAAO,CAAC;QAChB,SAAS,CAAC,EAAE,cAAc,CAAC;QAC3B,gBAAgB,CAAC,EAAE,OAAO,CAAC;QAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,qBAAqB,CAAC,EAAE,MAAM,CAAC;QAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,mBAAmB,CAAC,EAAE,OAAO,CAAC;QAC9B,mBAAmB,CAAC,E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3,"file":"leasing-search.js","sourceRoot":"/","sources":["types/leasing-search.ts"],"names":[],"mappings":"","sourcesContent":["import { InsuranceEntry } from '@bisondesk/commons-sdk/insurance';\nimport { Contact, Organization } from './crm.js';\nimport { PublicSearchDefinition } from './definitions.js';\nimport { LeasingContract } from './leasing.js';\nimport { Vehicle } from './vehicles.js';\n\nexport type LeasingPublicSearchDefinitions = {\n searchLeasingContract: PublicSearchDefinition;\n};\n\nexport type LeasingDebtorsSearchDefinitions = {\n debtors: PublicSearchDefinition;\n};\n\nexport type SearchLeasingContract = {\n contract: LeasingContract;\n org: Organization;\n contact?: Contact;\n vehicle: Vehicle;\n custom: {\n active: boolean;\n insurance?: InsuranceEntry;\n externalTracking?: boolean;\n accountManager?: string;\n lastIssuedInvoiceDate?: string;\n dealRating?: number;\n supplierName?: string;\n hasActiveRecurrence?: boolean;\n lastRecurrenceRunAt?: string;\n };\n};\n\nexport type InputSearchLeasingContract = SearchLeasingContract;\n"]}
|
|
1
|
+
{"version":3,"file":"leasing-search.js","sourceRoot":"/","sources":["types/leasing-search.ts"],"names":[],"mappings":"","sourcesContent":["import { InsuranceEntry } from '@bisondesk/commons-sdk/insurance';\nimport { Contact, Organization } from './crm.js';\nimport { PublicSearchDefinition } from './definitions.js';\nimport { LeasingContract } from './leasing.js';\nimport { ContractMileage } from './mileage.js';\nimport { Vehicle } from './vehicles.js';\n\nexport type LeasingPublicSearchDefinitions = {\n searchLeasingContract: PublicSearchDefinition;\n};\n\nexport type LeasingDebtorsSearchDefinitions = {\n debtors: PublicSearchDefinition;\n};\n\nexport type SearchLeasingContract = {\n contract: LeasingContract;\n org: Organization;\n contact?: Contact;\n vehicle: Vehicle;\n custom: {\n active: boolean;\n insurance?: InsuranceEntry;\n externalTracking?: boolean;\n accountManager?: string;\n lastIssuedInvoiceDate?: string;\n dealRating?: number;\n supplierName?: string;\n hasActiveRecurrence?: boolean;\n lastRecurrenceRunAt?: string;\n mileage?: ContractMileage;\n };\n};\n\nexport type InputSearchLeasingContract = SearchLeasingContract;\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export declare enum MileageStatus {
|
|
2
|
+
NoSignal = "no-signal",
|
|
3
|
+
TooEarly = "too-early",
|
|
4
|
+
Low = "low",
|
|
5
|
+
Normal = "normal",
|
|
6
|
+
High = "high"
|
|
7
|
+
}
|
|
8
|
+
export type MileageAlert = MileageStatus.Low | MileageStatus.High | MileageStatus.NoSignal;
|
|
9
|
+
export declare enum MileageTrendDirection {
|
|
10
|
+
Up = "up",
|
|
11
|
+
Down = "down",
|
|
12
|
+
Flat = "flat"
|
|
13
|
+
}
|
|
14
|
+
export type MileageTrend = {
|
|
15
|
+
direction: MileageTrendDirection;
|
|
16
|
+
percent: number;
|
|
17
|
+
};
|
|
18
|
+
export type ContractMileage = {
|
|
19
|
+
contractId: string;
|
|
20
|
+
stockNumber?: string;
|
|
21
|
+
status: MileageStatus;
|
|
22
|
+
alert?: MileageAlert;
|
|
23
|
+
last30DaysKm: number;
|
|
24
|
+
currentYearKm?: number;
|
|
25
|
+
yearAvg30DaysKm?: number;
|
|
26
|
+
trend?: MileageTrend;
|
|
27
|
+
lastReadingAt?: string;
|
|
28
|
+
};
|
|
29
|
+
export type MileageSummary = {
|
|
30
|
+
vehicles: number;
|
|
31
|
+
noSignal: number;
|
|
32
|
+
high: number;
|
|
33
|
+
low: number;
|
|
34
|
+
issues: number;
|
|
35
|
+
last30DaysKm?: number;
|
|
36
|
+
trend?: MileageTrend;
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=mileage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mileage.d.ts","sourceRoot":"/","sources":["types/mileage.ts"],"names":[],"mappings":"AAAA,oBAAY,aAAa;IACvB,QAAQ,cAAc;IACtB,QAAQ,cAAc;IACtB,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,IAAI,SAAS;CACd;AAED,MAAM,MAAM,YAAY,GAAG,aAAa,CAAC,GAAG,GAAG,aAAa,CAAC,IAAI,GAAG,aAAa,CAAC,QAAQ,CAAC;AAE3F,oBAAY,qBAAqB;IAC/B,EAAE,OAAO;IACT,IAAI,SAAS;IACb,IAAI,SAAS;CACd;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,EAAE,qBAAqB,CAAC;IAEjC,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAGF,MAAM,MAAM,eAAe,GAAG;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,aAAa,CAAC;IAEtB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IAErB,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAGF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,MAAM,CAAC;IAEjB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IAEf,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export var MileageStatus;
|
|
2
|
+
(function (MileageStatus) {
|
|
3
|
+
MileageStatus["NoSignal"] = "no-signal";
|
|
4
|
+
MileageStatus["TooEarly"] = "too-early";
|
|
5
|
+
MileageStatus["Low"] = "low";
|
|
6
|
+
MileageStatus["Normal"] = "normal";
|
|
7
|
+
MileageStatus["High"] = "high";
|
|
8
|
+
})(MileageStatus || (MileageStatus = {}));
|
|
9
|
+
export var MileageTrendDirection;
|
|
10
|
+
(function (MileageTrendDirection) {
|
|
11
|
+
MileageTrendDirection["Up"] = "up";
|
|
12
|
+
MileageTrendDirection["Down"] = "down";
|
|
13
|
+
MileageTrendDirection["Flat"] = "flat";
|
|
14
|
+
})(MileageTrendDirection || (MileageTrendDirection = {}));
|
|
15
|
+
//# sourceMappingURL=mileage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mileage.js","sourceRoot":"/","sources":["types/mileage.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,aAMX;AAND,WAAY,aAAa;IACvB,uCAAsB,CAAA;IACtB,uCAAsB,CAAA;IACtB,4BAAW,CAAA;IACX,kCAAiB,CAAA;IACjB,8BAAa,CAAA;AACf,CAAC,EANW,aAAa,KAAb,aAAa,QAMxB;AAID,MAAM,CAAN,IAAY,qBAIX;AAJD,WAAY,qBAAqB;IAC/B,kCAAS,CAAA;IACT,sCAAa,CAAA;IACb,sCAAa,CAAA;AACf,CAAC,EAJW,qBAAqB,KAArB,qBAAqB,QAIhC","sourcesContent":["export enum MileageStatus {\n NoSignal = 'no-signal',\n TooEarly = 'too-early',\n Low = 'low',\n Normal = 'normal',\n High = 'high',\n}\n\nexport type MileageAlert = MileageStatus.Low | MileageStatus.High | MileageStatus.NoSignal;\n\nexport enum MileageTrendDirection {\n Up = 'up',\n Down = 'down',\n Flat = 'flat',\n}\n\nexport type MileageTrend = {\n direction: MileageTrendDirection;\n /** The last 30 days against the 12-month average, in percent. */\n percent: number;\n};\n\n/** Km driven by a contract's vehicle, read from its wired track-and-trace device. */\nexport type ContractMileage = {\n contractId: string;\n stockNumber?: string;\n status: MileageStatus;\n /** The status, when it is outside the limits and the contract has overdue invoices. */\n alert?: MileageAlert;\n last30DaysKm: number;\n /** Absent while the device document predates the yearly figures: unknown, not zero. */\n currentYearKm?: number;\n /** Km per 30 days over the past 12 months; absent under 60 tracked days. */\n yearAvg30DaysKm?: number;\n trend?: MileageTrend;\n lastReadingAt?: string;\n};\n\n/** A debtor dossier's tracked vehicles at a glance, for the dossier lists and boards. */\nexport type MileageSummary = {\n vehicles: number;\n /** Vehicles flagged per alert: outside the limits on a contract with overdue invoices. */\n noSignal: number;\n high: number;\n low: number;\n issues: number;\n /** Km over the last 30 days of the vehicles still reporting; absent when none is. */\n last30DaysKm?: number;\n /** Those vehicles' km against their combined 12-month average. */\n trend?: MileageTrend;\n};\n"]}
|
|
@@ -55,20 +55,6 @@ export declare enum UnpaidPurchaseGroup {
|
|
|
55
55
|
Arrived = "arrived",
|
|
56
56
|
Expected = "expected"
|
|
57
57
|
}
|
|
58
|
-
export declare enum UnpaidPurchaseLogisticStatus {
|
|
59
|
-
Delivered = "delivered",
|
|
60
|
-
Arrived = "arrived",
|
|
61
|
-
Expected = "expected"
|
|
62
|
-
}
|
|
63
|
-
export type UnpaidPurchasesFilters = {
|
|
64
|
-
q?: string;
|
|
65
|
-
sold?: boolean;
|
|
66
|
-
logisticStatus?: UnpaidPurchaseLogisticStatus;
|
|
67
|
-
purchasedBy?: string[];
|
|
68
|
-
branchId?: string;
|
|
69
|
-
used?: boolean;
|
|
70
|
-
group?: UnpaidPurchaseGroup;
|
|
71
|
-
};
|
|
72
58
|
export type UnpaidPurchase = {
|
|
73
59
|
group: UnpaidPurchaseGroup;
|
|
74
60
|
vehicle: SearchVehicle;
|
|
@@ -81,7 +67,6 @@ export type UnpaidPurchase = {
|
|
|
81
67
|
};
|
|
82
68
|
export type UnpaidPurchasesMeta = {
|
|
83
69
|
canAllowPayment: boolean;
|
|
84
|
-
purchasers: string[];
|
|
85
70
|
counts: Record<UnpaidPurchaseGroup, number>;
|
|
86
71
|
};
|
|
87
72
|
export type ExportPaymentsRequest = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vehicle-purchase-payments.d.ts","sourceRoot":"/","sources":["types/vehicle-purchase-payments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,8BAA8B,EAAE,MAAM,iCAAiC,CAAC;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C;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,SAAS,GACjD,CACI,iCAAiC,GACjC,iCAAiC,GACjC,iCAAiC,CACpC,CAAC"}
|
|
@@ -11,10 +11,4 @@ export var UnpaidPurchaseGroup;
|
|
|
11
11
|
UnpaidPurchaseGroup["Arrived"] = "arrived";
|
|
12
12
|
UnpaidPurchaseGroup["Expected"] = "expected";
|
|
13
13
|
})(UnpaidPurchaseGroup || (UnpaidPurchaseGroup = {}));
|
|
14
|
-
export var UnpaidPurchaseLogisticStatus;
|
|
15
|
-
(function (UnpaidPurchaseLogisticStatus) {
|
|
16
|
-
UnpaidPurchaseLogisticStatus["Delivered"] = "delivered";
|
|
17
|
-
UnpaidPurchaseLogisticStatus["Arrived"] = "arrived";
|
|
18
|
-
UnpaidPurchaseLogisticStatus["Expected"] = "expected";
|
|
19
|
-
})(UnpaidPurchaseLogisticStatus || (UnpaidPurchaseLogisticStatus = {}));
|
|
20
14
|
//# sourceMappingURL=vehicle-purchase-payments.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vehicle-purchase-payments.js","sourceRoot":"/","sources":["types/vehicle-purchase-payments.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,oDAAoD,GAC/D,+CAA+C,CAAC;AASlD,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,mCAAmB,CAAA;IACnB,yCAAyB,CAAA;IACzB,qCAAqB,CAAA;AACvB,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB;AA8FD,MAAM,CAAN,IAAY,mBAIX;AAJD,WAAY,mBAAmB;IAC7B,oCAAa,CAAA;IACb,0CAAmB,CAAA;IACnB,4CAAqB,CAAA;AACvB,CAAC,EAJW,mBAAmB,KAAnB,mBAAmB,QAI9B;AAOD,MAAM,CAAN,IAAY,4BAIX;AAJD,WAAY,4BAA4B;IACtC,uDAAuB,CAAA;IACvB,mDAAmB,CAAA;IACnB,qDAAqB,CAAA;AACvB,CAAC,EAJW,4BAA4B,KAA5B,4BAA4B,QAIvC","sourcesContent":["import { BaseEvent } from './internal-events.js';\nimport { OrganizationBankAccountActions } from './organization-bank-accounts.js';\nimport { SearchVehicle } from './vehicles.js';\n\nexport const VEHICLE_PURCHASE_PAYMENT_ALLOWED_NOTIFICATION_ORIGIN =\n 'vehicle-purchase-payment-allowed-notification';\n\n/**\n * The stage a supplier payment sits at, driving the Unpaid/Allowed/Processing/Executed tabs.\n * A payment only ever moves forward: an authorised payment is `allowed`; sending it to processing\n * groups it into a payment batch and hands it to accounting (`processing`), which exports it\n * to the Isabel bank file; marking it paid moves it to `executed`.\n * (`unpaid` is not a stage — it is an agreed purchase with an amount still to authorise.)\n */\nexport enum PaymentStage {\n Allowed = 'allowed',\n Processing = 'processing',\n Executed = 'executed',\n}\n\n/**\n * A payment on a purchase priced in another currency is authorized and paid in that currency.\n * `amount` then holds its value in branch currency: `foreign.amount × foreign.exchangeRate`.\n */\nexport type VehiclePurchasePaymentForeign = {\n amount: string;\n currencyCode: string;\n /** Branch currency units per 1 unit of `currencyCode`, the purchase's rate. */\n exchangeRate: string;\n};\n\nexport type NewVehiclePurchasePayment = {\n vehicleId: string;\n /** Branch currency. Derived from `foreign` when the purchase is priced in another currency. */\n amount: string;\n /** The backend takes the rate from the purchase. */\n foreign?: Pick<VehiclePurchasePaymentForeign, 'amount' | 'currencyCode'>;\n description?: string;\n paidAt?: string;\n paidBy?: string;\n};\n\nexport type VehiclePurchasePayment = Omit<NewVehiclePurchasePayment, 'foreign'> & {\n id: string;\n createdBy: string;\n createdAt: string;\n foreign?: VehiclePurchasePaymentForeign;\n stage: PaymentStage;\n /** Manual settlement priority within the Allowed tab; lower is paid first. */\n priority: number;\n /** Set once the payment has been exported; links it to its payment export. */\n exportId?: string;\n /** The payment batch this payment was sent to processing in; unset while Allowed, and on payments\n * marked paid straight from Allowed. */\n paymentBatchId?: string;\n /**\n * Supplier-facing communication that becomes the SEPA transfer's remittance information (`RmtInf`),\n * so the supplier can reconcile the payment to an invoice. Editable while Processing and not yet\n * exported; prefilled from the latest purchase invoice. This is not the file's per-line\n * `EndToEndId`.\n */\n transferReference?: string;\n /** Who sent the payment to processing, and when — set at the Allowed → Processing step. */\n sentToProcessingBy?: string;\n sentToProcessingAt?: string;\n};\n\n/**\n * One send to processing: the Allowed payments an accountant moved to Processing together, and who\n * sent them. The Processing tab groups its rows by batch. A batch holds no amount of its own; its\n * total is the sum of the payments still in it.\n */\nexport type PaymentBatch = {\n id: string;\n createdAt: string;\n createdBy: string;\n};\n\n/**\n * Whether a payment's supplier can be paid in an export. Mirrors the export gate: a transfer needs a\n * supplier bank account that carries an IBAN and holder name and has been verified. Shown as an\n * export-blocked marker on the Processing rows, where the accountant clears it before exporting.\n * (The invoice / pro-forma document half of the gate is not reflected here — its source is a Q3\n * residual the backend export gate also defers.)\n *\n * The bank account is the supplier's default one, `bankAccountId`, which is the account an export\n * pays. `bankAccountActions` lists what the current user may do on it, so a row can point out the\n * accounts they can verify themselves. Once the account number or holder name changed, verify is\n * left out for accountants, and for whichever Senior Accountant made the change (four-eyes).\n */\nexport type PaymentExportChecks = {\n bankAccountId?: string;\n hasBankAccount: boolean;\n bankAccountVerified: boolean;\n bankAccountActions: OrganizationBankAccountActions[];\n};\n\nexport type VehiclePurchasePaymentBff = {\n payment: VehiclePurchasePayment;\n vehicle: SearchVehicle;\n /** Name of the supplier organisation (`vehicle.purchase.organizationId`), resolved for display. */\n supplierName?: string;\n /** Export checks on the supplier bank account; filled for the Processing list only. */\n exportChecks?: PaymentExportChecks;\n};\n\n/**\n * The group an unpaid purchase falls in, in the order the Unpaid list ranks them: sold to a client\n * (whether or not it has arrived), arrived on our park and not sold, or still expected — neither\n * sold nor arrived. The single Unpaid list filters by `sold` and `logisticStatus` instead; the\n * `group` filter and `meta.counts` serve the client that paged each group on its own.\n */\nexport enum UnpaidPurchaseGroup {\n Sold = 'sold',\n Arrived = 'arrived',\n Expected = 'expected',\n}\n\n/**\n * Where the vehicle behind an unpaid purchase stands, in the order the Unpaid list ranks its sales:\n * delivered to the client, arrived on our park, or still expected from the supplier. Delivered comes\n * from the sale side, so only a sold vehicle is delivered, whether or not it passed our park.\n */\nexport enum UnpaidPurchaseLogisticStatus {\n Delivered = 'delivered',\n Arrived = 'arrived',\n Expected = 'expected',\n}\n\n/** The filters on the Unpaid list. A filter left out keeps every purchase. */\nexport type UnpaidPurchasesFilters = {\n /**\n * Free text, case-insensitive: every word must appear in the stock number, VIN, vehicle title or\n * supplier name.\n */\n q?: string;\n sold?: boolean;\n logisticStatus?: UnpaidPurchaseLogisticStatus;\n /** Purchasers (`purchase.purchasedBy`); a purchase matches any of them. */\n purchasedBy?: string[];\n branchId?: string;\n /** The vehicle's condition (`external.condition.used`); a vehicle without one matches neither. */\n used?: boolean;\n group?: UnpaidPurchaseGroup;\n};\n\n/**\n * A row on the Unpaid tab: an agreed purchase that still has an amount to authorise for payment.\n * Derived from the purchase deal and the payments already authorised, not a payment record.\n */\nexport type UnpaidPurchase = {\n group: UnpaidPurchaseGroup;\n vehicle: SearchVehicle;\n /** The agreed purchase price including VAT (`deal.purchase` grossed up by `deal.purchaseVatRate`),\n * so it matches the VAT-inclusive cost the vehicle purchase tab authorises against. */\n purchaseAmount: string;\n /** Sum of amounts already authorised (payments in any stage) for this vehicle. */\n allowedAmount: string;\n /** Sum of the authorised amounts already settled (payments in Executed) for this vehicle. */\n paidAmount: string;\n /** `purchaseAmount − allowedAmount`; always greater than zero for rows shown here. */\n remainingAmount: string;\n /** Due date of the purchase invoice. */\n invoiceDueDate?: string;\n /** Name of the supplier organisation (`vehicle.purchase.organizationId`), resolved for display. */\n supplierName?: string;\n};\n\n/** What a page of the Unpaid list carries besides its rows. */\nexport type UnpaidPurchasesMeta = {\n /** Whether the requester may authorise a payment, as on the vehicle purchase tab. */\n canAllowPayment: boolean;\n /** Everyone who purchased an unpaid purchase, unfiltered, for the purchaser filter. */\n purchasers: string[];\n /** How many purchases each group holds, unfiltered. */\n counts: Record<UnpaidPurchaseGroup, number>;\n};\n\n/** Body of the export request: the Processing payments to put in one file, the paying account, and the execution date. */\nexport type ExportPaymentsRequest = {\n paymentIds: string[];\n /** The bank account (from documents settings) to pay the file from — the file's debtor. */\n debtorBankAccountId: string;\n /** Single execution date (`yyyy-MM-dd`) written to `ReqdExctnDt`; defaults to today. */\n executionDate?: string;\n};\n\n/** Body of the mark-paid request: the payments (Allowed or Processing) to settle in one call. */\nexport type MarkPaymentsPaidRequest = {\n paymentIds: string[];\n};\n\n/** Body of the send-to-processing request: the Allowed payments to send together as one batch. */\nexport type SendPaymentsToProcessingRequest = {\n paymentIds: string[];\n};\n\n/**\n * How many rows sit behind each payment tab, for the tab counters. Executed is unbounded and has no\n * counter, so it is left out.\n */\nexport type PurchasePaymentCounts = {\n unpaid: number;\n allowed: number;\n processing: number;\n};\n\nexport type VehiclePurchasePaymentCreateEvent = {\n payment: VehiclePurchasePayment;\n previousPayment?: undefined;\n action: 'create';\n actionAt: string;\n userId: string;\n tenantId: string;\n};\n\nexport type VehiclePurchasePaymentUpdateEvent = {\n payment: VehiclePurchasePayment;\n previousPayment: VehiclePurchasePayment;\n action: 'update';\n actionAt: string;\n userId: string;\n tenantId: string;\n};\n\nexport type VehiclePurchasePaymentDeleteEvent = {\n payment?: undefined;\n previousPayment: VehiclePurchasePayment;\n action: 'delete';\n actionAt: string;\n userId: string;\n tenantId: string;\n};\n\nexport type VehiclePurchasePaymentEvent = BaseEvent &\n (\n | VehiclePurchasePaymentCreateEvent\n | VehiclePurchasePaymentUpdateEvent\n | VehiclePurchasePaymentDeleteEvent\n );\n"]}
|
|
1
|
+
{"version":3,"file":"vehicle-purchase-payments.js","sourceRoot":"/","sources":["types/vehicle-purchase-payments.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,oDAAoD,GAC/D,+CAA+C,CAAC;AASlD,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,mCAAmB,CAAA;IACnB,yCAAyB,CAAA;IACzB,qCAAqB,CAAA;AACvB,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB;AA6FD,MAAM,CAAN,IAAY,mBAIX;AAJD,WAAY,mBAAmB;IAC7B,oCAAa,CAAA;IACb,0CAAmB,CAAA;IACnB,4CAAqB,CAAA;AACvB,CAAC,EAJW,mBAAmB,KAAnB,mBAAmB,QAI9B","sourcesContent":["import { BaseEvent } from './internal-events.js';\nimport { OrganizationBankAccountActions } from './organization-bank-accounts.js';\nimport { SearchVehicle } from './vehicles.js';\n\nexport const VEHICLE_PURCHASE_PAYMENT_ALLOWED_NOTIFICATION_ORIGIN =\n 'vehicle-purchase-payment-allowed-notification';\n\n/**\n * The stage a supplier payment sits at, driving the Unpaid/Allowed/Processing/Executed tabs.\n * A payment only ever moves forward: an authorised payment is `allowed`; sending it to processing\n * groups it into a payment batch and hands it to accounting (`processing`), which exports it\n * to the Isabel bank file; marking it paid moves it to `executed`.\n * (`unpaid` is not a stage — it is an agreed purchase with an amount still to authorise.)\n */\nexport enum PaymentStage {\n Allowed = 'allowed',\n Processing = 'processing',\n Executed = 'executed',\n}\n\n/**\n * A payment on a purchase priced in another currency is authorized and paid in that currency.\n * `amount` then holds its value in branch currency: `foreign.amount × foreign.exchangeRate`.\n */\nexport type VehiclePurchasePaymentForeign = {\n amount: string;\n currencyCode: string;\n /** Branch currency units per 1 unit of `currencyCode`, the purchase's rate. */\n exchangeRate: string;\n};\n\nexport type NewVehiclePurchasePayment = {\n vehicleId: string;\n /** Branch currency. Derived from `foreign` when the purchase is priced in another currency. */\n amount: string;\n /** The backend takes the rate from the purchase. */\n foreign?: Pick<VehiclePurchasePaymentForeign, 'amount' | 'currencyCode'>;\n description?: string;\n paidAt?: string;\n paidBy?: string;\n};\n\nexport type VehiclePurchasePayment = Omit<NewVehiclePurchasePayment, 'foreign'> & {\n id: string;\n createdBy: string;\n createdAt: string;\n foreign?: VehiclePurchasePaymentForeign;\n stage: PaymentStage;\n /** Manual settlement priority within the Allowed tab; lower is paid first. */\n priority: number;\n /** Set once the payment has been exported; links it to its payment export. */\n exportId?: string;\n /** The payment batch this payment was sent to processing in; unset while Allowed, and on payments\n * marked paid straight from Allowed. */\n paymentBatchId?: string;\n /**\n * Supplier-facing communication that becomes the SEPA transfer's remittance information (`RmtInf`),\n * so the supplier can reconcile the payment to an invoice. Editable while Processing and not yet\n * exported; prefilled from the latest purchase invoice. This is not the file's per-line\n * `EndToEndId`.\n */\n transferReference?: string;\n /** Who sent the payment to processing, and when — set at the Allowed → Processing step. */\n sentToProcessingBy?: string;\n sentToProcessingAt?: string;\n};\n\n/**\n * One send to processing: the Allowed payments an accountant moved to Processing together, and who\n * sent them. The Processing tab groups its rows by batch. A batch holds no amount of its own; its\n * total is the sum of the payments still in it.\n */\nexport type PaymentBatch = {\n id: string;\n createdAt: string;\n createdBy: string;\n};\n\n/**\n * Whether a payment's supplier can be paid in an export. Mirrors the export gate: a transfer needs a\n * supplier bank account that carries an IBAN and holder name and has been verified. Shown as an\n * export-blocked marker on the Processing rows, where the accountant clears it before exporting.\n * (The invoice / pro-forma document half of the gate is not reflected here — its source is a Q3\n * residual the backend export gate also defers.)\n *\n * The bank account is the supplier's default one, `bankAccountId`, which is the account an export\n * pays. `bankAccountActions` lists what the current user may do on it, so a row can point out the\n * accounts they can verify themselves. Once the account number or holder name changed, verify is\n * left out for accountants, and for whichever Senior Accountant made the change (four-eyes).\n */\nexport type PaymentExportChecks = {\n bankAccountId?: string;\n hasBankAccount: boolean;\n bankAccountVerified: boolean;\n bankAccountActions: OrganizationBankAccountActions[];\n};\n\nexport type VehiclePurchasePaymentBff = {\n payment: VehiclePurchasePayment;\n vehicle: SearchVehicle;\n /** Name of the supplier organisation (`vehicle.purchase.organizationId`), resolved for display. */\n supplierName?: string;\n /** Export checks on the supplier bank account; filled for the Processing list only. */\n exportChecks?: PaymentExportChecks;\n};\n\n/**\n * The group an unpaid purchase is listed under, in the order the Unpaid list shows them: sold to a\n * client (whether or not it has arrived), arrived on our park and not sold, or still expected —\n * neither sold nor arrived.\n */\nexport enum UnpaidPurchaseGroup {\n Sold = 'sold',\n Arrived = 'arrived',\n Expected = 'expected',\n}\n\n/**\n * A row on the Unpaid tab: an agreed purchase that still has an amount to authorise for payment.\n * Derived from the purchase deal and the payments already authorised, not a payment record.\n */\nexport type UnpaidPurchase = {\n group: UnpaidPurchaseGroup;\n vehicle: SearchVehicle;\n /** The agreed purchase price including VAT (`deal.purchase` grossed up by `deal.purchaseVatRate`),\n * so it matches the VAT-inclusive cost the vehicle purchase tab authorises against. */\n purchaseAmount: string;\n /** Sum of amounts already authorised (payments in any stage) for this vehicle. */\n allowedAmount: string;\n /** Sum of the authorised amounts already settled (payments in Executed) for this vehicle. */\n paidAmount: string;\n /** `purchaseAmount − allowedAmount`; always greater than zero for rows shown here. */\n remainingAmount: string;\n /** Due date of the purchase invoice. */\n invoiceDueDate?: string;\n /** Name of the supplier organisation (`vehicle.purchase.organizationId`), resolved for display. */\n supplierName?: string;\n};\n\n/** What a page of one Unpaid group carries besides its rows. */\nexport type UnpaidPurchasesMeta = {\n /** Whether the requester may authorise a payment, as on the vehicle purchase tab. */\n canAllowPayment: boolean;\n /** How many purchases each group holds, for the group headers. */\n counts: Record<UnpaidPurchaseGroup, number>;\n};\n\n/** Body of the export request: the Processing payments to put in one file, the paying account, and the execution date. */\nexport type ExportPaymentsRequest = {\n paymentIds: string[];\n /** The bank account (from documents settings) to pay the file from — the file's debtor. */\n debtorBankAccountId: string;\n /** Single execution date (`yyyy-MM-dd`) written to `ReqdExctnDt`; defaults to today. */\n executionDate?: string;\n};\n\n/** Body of the mark-paid request: the payments (Allowed or Processing) to settle in one call. */\nexport type MarkPaymentsPaidRequest = {\n paymentIds: string[];\n};\n\n/** Body of the send-to-processing request: the Allowed payments to send together as one batch. */\nexport type SendPaymentsToProcessingRequest = {\n paymentIds: string[];\n};\n\n/**\n * How many rows sit behind each payment tab, for the tab counters. Executed is unbounded and has no\n * counter, so it is left out.\n */\nexport type PurchasePaymentCounts = {\n unpaid: number;\n allowed: number;\n processing: number;\n};\n\nexport type VehiclePurchasePaymentCreateEvent = {\n payment: VehiclePurchasePayment;\n previousPayment?: undefined;\n action: 'create';\n actionAt: string;\n userId: string;\n tenantId: string;\n};\n\nexport type VehiclePurchasePaymentUpdateEvent = {\n payment: VehiclePurchasePayment;\n previousPayment: VehiclePurchasePayment;\n action: 'update';\n actionAt: string;\n userId: string;\n tenantId: string;\n};\n\nexport type VehiclePurchasePaymentDeleteEvent = {\n payment?: undefined;\n previousPayment: VehiclePurchasePayment;\n action: 'delete';\n actionAt: string;\n userId: string;\n tenantId: string;\n};\n\nexport type VehiclePurchasePaymentEvent = BaseEvent &\n (\n | VehiclePurchasePaymentCreateEvent\n | VehiclePurchasePaymentUpdateEvent\n | VehiclePurchasePaymentDeleteEvent\n );\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ContractMileage, MileageAlert, MileageStatus, MileageSummary, MileageTrend } from '../types/mileage.js';
|
|
2
|
+
export declare const MILEAGE_LOW_KM_30_DAYS = 250;
|
|
3
|
+
export declare const MILEAGE_TREND_BAND = 0.15;
|
|
4
|
+
export declare const KM_FILTER_MAX = 15000;
|
|
5
|
+
export declare const KM_FILTER_STEP = 250;
|
|
6
|
+
export declare const MILEAGE_HIGH_KM_30_DAYS: {
|
|
7
|
+
[category: string]: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const getMileageStatus: (input: {
|
|
10
|
+
category?: string;
|
|
11
|
+
last30DaysKm: number;
|
|
12
|
+
lastReadingAt?: string;
|
|
13
|
+
trackedSince?: string;
|
|
14
|
+
}, now?: Date) => MileageStatus;
|
|
15
|
+
export declare const getMileageAlert: (status: MileageStatus, overdue: boolean) => MileageAlert | undefined;
|
|
16
|
+
export declare const getMileageTrend: (last30DaysKm: number, yearAvg30DaysKm: number | undefined) => MileageTrend | undefined;
|
|
17
|
+
export declare const getMileageSummary: (mileage: ContractMileage[]) => MileageSummary;
|
|
18
|
+
//# sourceMappingURL=mileage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mileage.d.ts","sourceRoot":"/","sources":["utils/mileage.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,eAAe,EACf,YAAY,EACZ,aAAa,EACb,cAAc,EACd,YAAY,EAEb,MAAM,qBAAqB,CAAC;AAE7B,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAC1C,eAAO,MAAM,kBAAkB,OAAO,CAAC;AACvC,eAAO,MAAM,aAAa,QAAS,CAAC;AACpC,eAAO,MAAM,cAAc,MAAM,CAAC;AAKlC,eAAO,MAAM,uBAAuB,EAAE;IAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAA;CAKjE,CAAC;AAMF,eAAO,MAAM,gBAAgB,UACpB;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,QAC5F,IAAI,KACR,aAqBF,CAAC;AAQF,eAAO,MAAM,eAAe,WAClB,aAAa,WACZ,OAAO,KACf,YAAY,GAAG,SAAsE,CAAC;AAEzF,eAAO,MAAM,eAAe,iBACZ,MAAM,mBACH,MAAM,GAAG,SAAS,KAClC,YAAY,GAAG,SAajB,CAAC;AAMF,eAAO,MAAM,iBAAiB,YAAa,eAAe,EAAE,KAAG,cAoB9D,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { differenceInCalendarDays, parseISO } from 'date-fns';
|
|
2
|
+
import { sumBy } from 'lodash-es';
|
|
3
|
+
import { Categories } from '../constants.js';
|
|
4
|
+
import { MileageStatus, MileageTrendDirection, } from '../types/mileage.js';
|
|
5
|
+
export const MILEAGE_LOW_KM_30_DAYS = 250;
|
|
6
|
+
export const MILEAGE_TREND_BAND = 0.15;
|
|
7
|
+
export const KM_FILTER_MAX = 15_000;
|
|
8
|
+
export const KM_FILTER_STEP = 250;
|
|
9
|
+
const MILEAGE_WINDOW_DAYS = 30;
|
|
10
|
+
const MILEAGE_SIGNAL_LOST_AFTER_DAYS = 3;
|
|
11
|
+
export const MILEAGE_HIGH_KM_30_DAYS = {
|
|
12
|
+
[Categories.Van]: 7_500,
|
|
13
|
+
[Categories.Car]: 7_500,
|
|
14
|
+
[Categories.TractorHead]: 12_000,
|
|
15
|
+
[Categories.Truck]: 12_000,
|
|
16
|
+
};
|
|
17
|
+
export const getMileageStatus = (input, now = new Date()) => {
|
|
18
|
+
if (input.lastReadingAt == null ||
|
|
19
|
+
differenceInCalendarDays(now, parseISO(input.lastReadingAt)) > MILEAGE_SIGNAL_LOST_AFTER_DAYS) {
|
|
20
|
+
return MileageStatus.NoSignal;
|
|
21
|
+
}
|
|
22
|
+
if (input.trackedSince != null &&
|
|
23
|
+
differenceInCalendarDays(now, parseISO(input.trackedSince)) < MILEAGE_WINDOW_DAYS) {
|
|
24
|
+
return MileageStatus.TooEarly;
|
|
25
|
+
}
|
|
26
|
+
if (input.last30DaysKm < MILEAGE_LOW_KM_30_DAYS) {
|
|
27
|
+
return MileageStatus.Low;
|
|
28
|
+
}
|
|
29
|
+
const highLimit = input.category != null ? MILEAGE_HIGH_KM_30_DAYS[input.category] : undefined;
|
|
30
|
+
if (highLimit != null && input.last30DaysKm > highLimit) {
|
|
31
|
+
return MileageStatus.High;
|
|
32
|
+
}
|
|
33
|
+
return MileageStatus.Normal;
|
|
34
|
+
};
|
|
35
|
+
const isOutsideLimits = (status) => status === MileageStatus.Low ||
|
|
36
|
+
status === MileageStatus.High ||
|
|
37
|
+
status === MileageStatus.NoSignal;
|
|
38
|
+
export const getMileageAlert = (status, overdue) => (overdue && isOutsideLimits(status) ? status : undefined);
|
|
39
|
+
export const getMileageTrend = (last30DaysKm, yearAvg30DaysKm) => {
|
|
40
|
+
if (yearAvg30DaysKm == null || yearAvg30DaysKm === 0) {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
const change = (last30DaysKm - yearAvg30DaysKm) / yearAvg30DaysKm;
|
|
44
|
+
const percent = Math.round(change * 100);
|
|
45
|
+
if (change >= MILEAGE_TREND_BAND) {
|
|
46
|
+
return { direction: MileageTrendDirection.Up, percent };
|
|
47
|
+
}
|
|
48
|
+
if (change <= -MILEAGE_TREND_BAND) {
|
|
49
|
+
return { direction: MileageTrendDirection.Down, percent };
|
|
50
|
+
}
|
|
51
|
+
return { direction: MileageTrendDirection.Flat, percent };
|
|
52
|
+
};
|
|
53
|
+
export const getMileageSummary = (mileage) => {
|
|
54
|
+
const countAlert = (alert) => mileage.filter((item) => item.alert === alert).length;
|
|
55
|
+
const noSignal = countAlert(MileageStatus.NoSignal);
|
|
56
|
+
const high = countAlert(MileageStatus.High);
|
|
57
|
+
const low = countAlert(MileageStatus.Low);
|
|
58
|
+
const reporting = mileage.filter((item) => item.status !== MileageStatus.NoSignal);
|
|
59
|
+
const withAverage = reporting.filter((item) => item.yearAvg30DaysKm != null);
|
|
60
|
+
return {
|
|
61
|
+
vehicles: mileage.length,
|
|
62
|
+
noSignal,
|
|
63
|
+
high,
|
|
64
|
+
low,
|
|
65
|
+
issues: noSignal + high + low,
|
|
66
|
+
last30DaysKm: reporting.length > 0 ? sumBy(reporting, (item) => item.last30DaysKm) : undefined,
|
|
67
|
+
trend: getMileageTrend(sumBy(withAverage, (item) => item.last30DaysKm), sumBy(withAverage, (item) => item.yearAvg30DaysKm ?? 0)),
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=mileage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mileage.js","sourceRoot":"/","sources":["utils/mileage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,QAAQ,EAAE,MAAM,UAAU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AAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,EAC/C,KAAK,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,eAAe,IAAI,CAAC,CAAC,CACxD;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { differenceInCalendarDays, parseISO } from 'date-fns';\nimport { sumBy } from 'lodash-es';\nimport { Categories } from '../constants.js';\nimport {\n ContractMileage,\n MileageAlert,\n MileageStatus,\n MileageSummary,\n MileageTrend,\n MileageTrendDirection,\n} from '../types/mileage.js';\n\nexport const MILEAGE_LOW_KM_30_DAYS = 250;\nexport const MILEAGE_TREND_BAND = 0.15;\nexport const KM_FILTER_MAX = 15_000;\nexport const KM_FILTER_STEP = 250;\n\nconst MILEAGE_WINDOW_DAYS = 30;\nconst MILEAGE_SIGNAL_LOST_AFTER_DAYS = 3;\n\nexport const MILEAGE_HIGH_KM_30_DAYS: { [category: string]: number } = {\n [Categories.Van]: 7_500,\n [Categories.Car]: 7_500,\n [Categories.TractorHead]: 12_000,\n [Categories.Truck]: 12_000,\n};\n\n/**\n * A device that has not reported for more than three days, or never did, has no signal: its km\n * figures stop refreshing, so they say nothing about how much the vehicle drives.\n */\nexport const getMileageStatus = (\n input: { category?: string; last30DaysKm: number; lastReadingAt?: string; trackedSince?: string },\n now: Date = new Date(),\n): MileageStatus => {\n if (\n input.lastReadingAt == null ||\n differenceInCalendarDays(now, parseISO(input.lastReadingAt)) > MILEAGE_SIGNAL_LOST_AFTER_DAYS\n ) {\n return MileageStatus.NoSignal;\n }\n if (\n input.trackedSince != null &&\n differenceInCalendarDays(now, parseISO(input.trackedSince)) < MILEAGE_WINDOW_DAYS\n ) {\n return MileageStatus.TooEarly;\n }\n if (input.last30DaysKm < MILEAGE_LOW_KM_30_DAYS) {\n return MileageStatus.Low;\n }\n const highLimit = input.category != null ? MILEAGE_HIGH_KM_30_DAYS[input.category] : undefined;\n if (highLimit != null && input.last30DaysKm > highLimit) {\n return MileageStatus.High;\n }\n return MileageStatus.Normal;\n};\n\nconst isOutsideLimits = (status: MileageStatus): status is MileageAlert =>\n status === MileageStatus.Low ||\n status === MileageStatus.High ||\n status === MileageStatus.NoSignal;\n\n/** Debt follow-up only cares about mileage outside the limits on a contract that is overdue. */\nexport const getMileageAlert = (\n status: MileageStatus,\n overdue: boolean,\n): MileageAlert | undefined => (overdue && isOutsideLimits(status) ? status : undefined);\n\nexport const getMileageTrend = (\n last30DaysKm: number,\n yearAvg30DaysKm: number | undefined,\n): MileageTrend | undefined => {\n if (yearAvg30DaysKm == null || yearAvg30DaysKm === 0) {\n return undefined;\n }\n const change = (last30DaysKm - yearAvg30DaysKm) / yearAvg30DaysKm;\n const percent = Math.round(change * 100);\n if (change >= MILEAGE_TREND_BAND) {\n return { direction: MileageTrendDirection.Up, percent };\n }\n if (change <= -MILEAGE_TREND_BAND) {\n return { direction: MileageTrendDirection.Down, percent };\n }\n return { direction: MileageTrendDirection.Flat, percent };\n};\n\n/**\n * Counts a dossier's flagged vehicles and adds up the km of the ones still reporting. A silent\n * device's figures stay frozen at its last reading, so they are left out of the total and the trend.\n */\nexport const getMileageSummary = (mileage: ContractMileage[]): MileageSummary => {\n const countAlert = (alert: MileageAlert) => mileage.filter((item) => item.alert === alert).length;\n const noSignal = countAlert(MileageStatus.NoSignal);\n const high = countAlert(MileageStatus.High);\n const low = countAlert(MileageStatus.Low);\n const reporting = mileage.filter((item) => item.status !== MileageStatus.NoSignal);\n const withAverage = reporting.filter((item) => item.yearAvg30DaysKm != null);\n\n return {\n vehicles: mileage.length,\n noSignal,\n high,\n low,\n issues: noSignal + high + low,\n last30DaysKm: reporting.length > 0 ? sumBy(reporting, (item) => item.last30DaysKm) : undefined,\n trend: getMileageTrend(\n sumBy(withAverage, (item) => item.last30DaysKm),\n sumBy(withAverage, (item) => item.yearAvg30DaysKm ?? 0),\n ),\n };\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mileage.test.d.ts","sourceRoot":"/","sources":["utils/mileage.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { describe, expect, test } from 'vitest';
|
|
2
|
+
import { Categories } from '../constants.js';
|
|
3
|
+
import { MileageStatus, MileageTrendDirection } from '../types/mileage.js';
|
|
4
|
+
import { getMileageAlert, getMileageStatus, getMileageSummary, getMileageTrend, } from './mileage.js';
|
|
5
|
+
const now = new Date('2026-09-30T12:00:00Z');
|
|
6
|
+
const lastReadingAt = '2026-09-30T06:00:00Z';
|
|
7
|
+
describe('getMileageStatus', () => {
|
|
8
|
+
test.each([
|
|
9
|
+
{ name: 'silent for more than three days', lastReadingAt: '2026-09-26T09:00:00Z' },
|
|
10
|
+
{ name: 'that never reported', lastReadingAt: undefined },
|
|
11
|
+
])('a device $name has no signal, whatever its last figures say', ({ lastReadingAt }) => {
|
|
12
|
+
expect(getMileageStatus({ category: Categories.Van, last30DaysKm: 8_950, lastReadingAt }, now)).toBe(MileageStatus.NoSignal);
|
|
13
|
+
});
|
|
14
|
+
test('a device quiet for three days still has a signal', () => {
|
|
15
|
+
expect(getMileageStatus({ category: Categories.Van, last30DaysKm: 3_000, lastReadingAt: '2026-09-27T09:00:00Z' }, now)).toBe(MileageStatus.Normal);
|
|
16
|
+
});
|
|
17
|
+
test('a device installed less than 30 days ago is too early to judge', () => {
|
|
18
|
+
expect(getMileageStatus({ last30DaysKm: 40, lastReadingAt, trackedSince: '2026-09-15T08:00:00Z' }, now)).toBe(MileageStatus.TooEarly);
|
|
19
|
+
});
|
|
20
|
+
test.each([
|
|
21
|
+
{ category: Categories.Van, last30DaysKm: 249, expected: MileageStatus.Low },
|
|
22
|
+
{ category: Categories.Van, last30DaysKm: 250, expected: MileageStatus.Normal },
|
|
23
|
+
{ category: Categories.Van, last30DaysKm: 7_500, expected: MileageStatus.Normal },
|
|
24
|
+
{ category: Categories.Van, last30DaysKm: 7_501, expected: MileageStatus.High },
|
|
25
|
+
{ category: Categories.Car, last30DaysKm: 7_501, expected: MileageStatus.High },
|
|
26
|
+
{ category: Categories.TractorHead, last30DaysKm: 12_000, expected: MileageStatus.Normal },
|
|
27
|
+
{ category: Categories.TractorHead, last30DaysKm: 12_001, expected: MileageStatus.High },
|
|
28
|
+
{ category: Categories.Truck, last30DaysKm: 12_001, expected: MileageStatus.High },
|
|
29
|
+
{ category: Categories.Machine, last30DaysKm: 50_000, expected: MileageStatus.Normal },
|
|
30
|
+
{ category: undefined, last30DaysKm: 50_000, expected: MileageStatus.Normal },
|
|
31
|
+
])('$category at $last30DaysKm km is $expected', ({ category, last30DaysKm, expected }) => {
|
|
32
|
+
expect(getMileageStatus({ category, last30DaysKm, lastReadingAt, trackedSince: '2025-01-01T00:00:00Z' }, now)).toBe(expected);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
describe('getMileageAlert', () => {
|
|
36
|
+
test.each([
|
|
37
|
+
MileageStatus.Low,
|
|
38
|
+
MileageStatus.High,
|
|
39
|
+
MileageStatus.NoSignal,
|
|
40
|
+
])('%s on an overdue contract is an alert', (status) => {
|
|
41
|
+
expect(getMileageAlert(status, true)).toBe(status);
|
|
42
|
+
});
|
|
43
|
+
test.each([MileageStatus.Normal, MileageStatus.TooEarly])('%s is never an alert', (status) => {
|
|
44
|
+
expect(getMileageAlert(status, true)).toBeUndefined();
|
|
45
|
+
});
|
|
46
|
+
test('a contract without overdue invoices has no alert', () => {
|
|
47
|
+
expect(getMileageAlert(MileageStatus.Low, false)).toBeUndefined();
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
describe('getMileageTrend', () => {
|
|
51
|
+
test('has no trend without a yearly average', () => {
|
|
52
|
+
expect(getMileageTrend(1_000, undefined)).toBeUndefined();
|
|
53
|
+
expect(getMileageTrend(1_000, 0)).toBeUndefined();
|
|
54
|
+
});
|
|
55
|
+
test.each([
|
|
56
|
+
{ last30DaysKm: 13_200, direction: MileageTrendDirection.Up, percent: 32 },
|
|
57
|
+
{ last30DaysKm: 11_500, direction: MileageTrendDirection.Up, percent: 15 },
|
|
58
|
+
{ last30DaysKm: 11_400, direction: MileageTrendDirection.Flat, percent: 14 },
|
|
59
|
+
{ last30DaysKm: 8_600, direction: MileageTrendDirection.Flat, percent: -14 },
|
|
60
|
+
{ last30DaysKm: 8_500, direction: MileageTrendDirection.Down, percent: -15 },
|
|
61
|
+
{ last30DaysKm: 300, direction: MileageTrendDirection.Down, percent: -97 },
|
|
62
|
+
])('$last30DaysKm km against 10 000 is $direction $percent%', ({ last30DaysKm, direction, percent, }) => {
|
|
63
|
+
expect(getMileageTrend(last30DaysKm, 10_000)).toEqual({ direction, percent });
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
describe('getMileageSummary', () => {
|
|
67
|
+
const vehicle = (contractId, status, alert, last30DaysKm, yearAvg30DaysKm) => ({ contractId, status, alert, last30DaysKm, yearAvg30DaysKm });
|
|
68
|
+
test('counts flagged vehicles per alert and leaves silent devices out of the km', () => {
|
|
69
|
+
expect(getMileageSummary([
|
|
70
|
+
vehicle('a', MileageStatus.NoSignal, MileageStatus.NoSignal, 9_000, 9_000),
|
|
71
|
+
vehicle('b', MileageStatus.NoSignal, undefined, 4_000),
|
|
72
|
+
vehicle('c', MileageStatus.High, MileageStatus.High, 13_000, 10_000),
|
|
73
|
+
vehicle('d', MileageStatus.Low, MileageStatus.Low, 100, 2_000),
|
|
74
|
+
vehicle('e', MileageStatus.Low, undefined, 200),
|
|
75
|
+
vehicle('f', MileageStatus.TooEarly, undefined, 1_500),
|
|
76
|
+
])).toEqual({
|
|
77
|
+
vehicles: 6,
|
|
78
|
+
noSignal: 1,
|
|
79
|
+
high: 1,
|
|
80
|
+
low: 1,
|
|
81
|
+
issues: 3,
|
|
82
|
+
last30DaysKm: 14_800,
|
|
83
|
+
trend: { direction: MileageTrendDirection.Flat, percent: 9 },
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
test('has no km and no trend when no device is reporting', () => {
|
|
87
|
+
const summary = getMileageSummary([
|
|
88
|
+
vehicle('a', MileageStatus.NoSignal, MileageStatus.NoSignal, 9_000, 9_000),
|
|
89
|
+
]);
|
|
90
|
+
expect(summary.last30DaysKm).toBeUndefined();
|
|
91
|
+
expect(summary.trend).toBeUndefined();
|
|
92
|
+
});
|
|
93
|
+
test('is all zeros for a dossier without tracked vehicles', () => {
|
|
94
|
+
expect(getMileageSummary([])).toEqual({
|
|
95
|
+
vehicles: 0,
|
|
96
|
+
noSignal: 0,
|
|
97
|
+
high: 0,
|
|
98
|
+
low: 0,
|
|
99
|
+
issues: 0,
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
//# sourceMappingURL=mileage.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mileage.test.js","sourceRoot":"/","sources":["utils/mileage.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAmB,aAAa,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5F,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,GAChB,MAAM,cAAc,CAAC;AAEtB,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,sBAAsB,CAAC,CAAC;AAC7C,MAAM,aAAa,GAAG,sBAAsB,CAAC;AAE7C,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,IAAI,CAAC,IAAI,CAAC;QACR,EAAE,IAAI,EAAE,iCAAiC,EAAE,aAAa,EAAE,sBAAsB,EAAE;QAClF,EAAE,IAAI,EAAE,qBAAqB,EAAE,aAAa,EAAE,SAAS,EAAE;KAC1D,CAAC,CAAC,6DAA6D,EAAE,CAAC,EAAE,aAAa,EAAE,EAAE,EAAE;QACtF,MAAM,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E,SAAS,EAAE,KAAK,CAAC;SACvD,CAAC,CACH,CAAC,OAAO,CAAC;YACR,QAAQ,EAAE,CAAC;YACX,QAAQ,EAAE,CAAC;YACX,IAAI,EAAE,CAAC;YACP,GAAG,EAAE,CAAC;YACN,MAAM,EAAE,CAAC;YACT,YAAY,EAAE,MAAM;YACpB,KAAK,EAAE,EAAE,SAAS,EAAE,qBAAqB,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE;SAC7D,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,oDAAoD,EAAE,GAAG,EAAE;QAC9D,MAAM,OAAO,GAAG,iBAAiB,CAAC;YAChC,OAAO,CAAC,GAAG,EAAE,aAAa,CAAC,QAAQ,EAAE,aAAa,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAC;SAC3E,CAAC,CAAC;QAEH,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,aAAa,EAAE,CAAC;QAC7C,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,aAAa,EAAE,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,qDAAqD,EAAE,GAAG,EAAE;QAC/D,MAAM,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;YACpC,QAAQ,EAAE,CAAC;YACX,QAAQ,EAAE,CAAC;YACX,IAAI,EAAE,CAAC;YACP,GAAG,EAAE,CAAC;YACN,MAAM,EAAE,CAAC;SACV,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, test } from 'vitest';\nimport { Categories } from '../constants.js';\nimport { ContractMileage, MileageStatus, MileageTrendDirection } from '../types/mileage.js';\nimport {\n getMileageAlert,\n getMileageStatus,\n getMileageSummary,\n getMileageTrend,\n} from './mileage.js';\n\nconst now = new Date('2026-09-30T12:00:00Z');\nconst lastReadingAt = '2026-09-30T06:00:00Z';\n\ndescribe('getMileageStatus', () => {\n test.each([\n { name: 'silent for more than three days', lastReadingAt: '2026-09-26T09:00:00Z' },\n { name: 'that never reported', lastReadingAt: undefined },\n ])('a device $name has no signal, whatever its last figures say', ({ lastReadingAt }) => {\n expect(\n getMileageStatus({ category: Categories.Van, last30DaysKm: 8_950, lastReadingAt }, now),\n ).toBe(MileageStatus.NoSignal);\n });\n\n test('a device quiet for three days still has a signal', () => {\n expect(\n getMileageStatus(\n { category: Categories.Van, last30DaysKm: 3_000, lastReadingAt: '2026-09-27T09:00:00Z' },\n now,\n ),\n ).toBe(MileageStatus.Normal);\n });\n\n test('a device installed less than 30 days ago is too early to judge', () => {\n expect(\n getMileageStatus(\n { last30DaysKm: 40, lastReadingAt, trackedSince: '2026-09-15T08:00:00Z' },\n now,\n ),\n ).toBe(MileageStatus.TooEarly);\n });\n\n test.each([\n { category: Categories.Van, last30DaysKm: 249, expected: MileageStatus.Low },\n { category: Categories.Van, last30DaysKm: 250, expected: MileageStatus.Normal },\n { category: Categories.Van, last30DaysKm: 7_500, expected: MileageStatus.Normal },\n { category: Categories.Van, last30DaysKm: 7_501, expected: MileageStatus.High },\n { category: Categories.Car, last30DaysKm: 7_501, expected: MileageStatus.High },\n { category: Categories.TractorHead, last30DaysKm: 12_000, expected: MileageStatus.Normal },\n { category: Categories.TractorHead, last30DaysKm: 12_001, expected: MileageStatus.High },\n { category: Categories.Truck, last30DaysKm: 12_001, expected: MileageStatus.High },\n { category: Categories.Machine, last30DaysKm: 50_000, expected: MileageStatus.Normal },\n { category: undefined, last30DaysKm: 50_000, expected: MileageStatus.Normal },\n ])('$category at $last30DaysKm km is $expected', ({ category, last30DaysKm, expected }) => {\n expect(\n getMileageStatus(\n { category, last30DaysKm, lastReadingAt, trackedSince: '2025-01-01T00:00:00Z' },\n now,\n ),\n ).toBe(expected);\n });\n});\n\ndescribe('getMileageAlert', () => {\n test.each([\n MileageStatus.Low,\n MileageStatus.High,\n MileageStatus.NoSignal,\n ])('%s on an overdue contract is an alert', (status) => {\n expect(getMileageAlert(status, true)).toBe(status);\n });\n\n test.each([MileageStatus.Normal, MileageStatus.TooEarly])('%s is never an alert', (status) => {\n expect(getMileageAlert(status, true)).toBeUndefined();\n });\n\n test('a contract without overdue invoices has no alert', () => {\n expect(getMileageAlert(MileageStatus.Low, false)).toBeUndefined();\n });\n});\n\ndescribe('getMileageTrend', () => {\n test('has no trend without a yearly average', () => {\n expect(getMileageTrend(1_000, undefined)).toBeUndefined();\n expect(getMileageTrend(1_000, 0)).toBeUndefined();\n });\n\n test.each([\n { last30DaysKm: 13_200, direction: MileageTrendDirection.Up, percent: 32 },\n { last30DaysKm: 11_500, direction: MileageTrendDirection.Up, percent: 15 },\n { last30DaysKm: 11_400, direction: MileageTrendDirection.Flat, percent: 14 },\n { last30DaysKm: 8_600, direction: MileageTrendDirection.Flat, percent: -14 },\n { last30DaysKm: 8_500, direction: MileageTrendDirection.Down, percent: -15 },\n { last30DaysKm: 300, direction: MileageTrendDirection.Down, percent: -97 },\n ])('$last30DaysKm km against 10 000 is $direction $percent%', ({\n last30DaysKm,\n direction,\n percent,\n }) => {\n expect(getMileageTrend(last30DaysKm, 10_000)).toEqual({ direction, percent });\n });\n});\n\ndescribe('getMileageSummary', () => {\n const vehicle = (\n contractId: string,\n status: MileageStatus,\n alert: ContractMileage['alert'],\n last30DaysKm: number,\n yearAvg30DaysKm?: number,\n ): ContractMileage => ({ contractId, status, alert, last30DaysKm, yearAvg30DaysKm });\n\n test('counts flagged vehicles per alert and leaves silent devices out of the km', () => {\n expect(\n getMileageSummary([\n vehicle('a', MileageStatus.NoSignal, MileageStatus.NoSignal, 9_000, 9_000),\n vehicle('b', MileageStatus.NoSignal, undefined, 4_000),\n vehicle('c', MileageStatus.High, MileageStatus.High, 13_000, 10_000),\n vehicle('d', MileageStatus.Low, MileageStatus.Low, 100, 2_000),\n vehicle('e', MileageStatus.Low, undefined, 200),\n vehicle('f', MileageStatus.TooEarly, undefined, 1_500),\n ]),\n ).toEqual({\n vehicles: 6,\n noSignal: 1,\n high: 1,\n low: 1,\n issues: 3,\n last30DaysKm: 14_800,\n trend: { direction: MileageTrendDirection.Flat, percent: 9 },\n });\n });\n\n test('has no km and no trend when no device is reporting', () => {\n const summary = getMileageSummary([\n vehicle('a', MileageStatus.NoSignal, MileageStatus.NoSignal, 9_000, 9_000),\n ]);\n\n expect(summary.last30DaysKm).toBeUndefined();\n expect(summary.trend).toBeUndefined();\n });\n\n test('is all zeros for a dossier without tracked vehicles', () => {\n expect(getMileageSummary([])).toEqual({\n vehicles: 0,\n noSignal: 0,\n high: 0,\n low: 0,\n issues: 0,\n });\n });\n});\n"]}
|
package/package.json
CHANGED
|
@@ -2,6 +2,7 @@ import { EmailMessage } from '@bisondesk/commons-sdk/messages';
|
|
|
2
2
|
import { NextList, PaginatedList } from '@bisondesk/commons-sdk/types';
|
|
3
3
|
import { Contact, Organization } from './crm.js';
|
|
4
4
|
import { LeasingContract } from './leasing.js';
|
|
5
|
+
import { ContractMileage, MileageSummary } from './mileage.js';
|
|
5
6
|
import { BaseSearchRequest, SortFilter, SortOrder } from './search.js';
|
|
6
7
|
import { DataRecord, ReferenceData } from './utils.js';
|
|
7
8
|
|
|
@@ -342,6 +343,9 @@ export type SearchDebtorsDossier = {
|
|
|
342
343
|
remindersSent: number;
|
|
343
344
|
hasActiveLdrs?: boolean;
|
|
344
345
|
};
|
|
346
|
+
/** One entry per tracked contract of the organization, copied from the contracts index. */
|
|
347
|
+
mileage?: ContractMileage[];
|
|
348
|
+
mileageSummary?: MileageSummary;
|
|
345
349
|
};
|
|
346
350
|
|
|
347
351
|
/************
|