@bisondesk/core-sdk 1.0.682 → 1.0.684
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/crm.d.ts +1 -0
- package/lib/types/crm.d.ts.map +1 -1
- package/lib/types/crm.js.map +1 -1
- package/lib/types/leasing-debtors.d.ts +5 -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 +10 -0
- package/lib/types/vehicle-purchase-payments.d.ts.map +1 -1
- package/lib/types/vehicle-purchase-payments.js +7 -0
- 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/crm.ts +1 -0
- package/src/types/leasing-debtors.ts +7 -0
- package/src/types/leasing-search.ts +2 -0
- package/src/types/mileage.ts +51 -0
- package/src/types/vehicle-purchase-payments.ts +27 -4
- package/src/utils/mileage.test.ts +151 -0
- package/src/utils/mileage.ts +111 -0
- package/tsconfig.tsbuildinfo +1 -1
package/lib/types/crm.d.ts
CHANGED
package/lib/types/crm.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crm.d.ts","sourceRoot":"/","sources":["types/crm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL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,QAI3B;AAGD,MAAM,CAAN,IAAY,qBAWX;AAXD,WAAY,qBAAqB;IAE/B,wCAAe,CAAA;IAEf,oDAA2B,CAAA;IAE3B,gDAAuB,CAAA;IAEvB,2DAAkC,CAAA;IAElC,uDAA8B,CAAA;AAChC,CAAC,EAXW,qBAAqB,KAArB,qBAAqB,QAWhC;AAoBD,MAAM,CAAN,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,wCAAwB,CAAA;IACxB,gCAAgB,CAAA;IAChB,oCAAoB,CAAA;IACpB,oCAAoB,CAAA;AACtB,CAAC,EALW,YAAY,KAAZ,YAAY,QAKvB;AA8DD,MAAM,CAAN,IAAY,qBAGX;AAHD,WAAY,qBAAqB;IAC/B,+DAAsC,CAAA;IACtC,6DAAoC,CAAA;AACtC,CAAC,EAHW,qBAAqB,KAArB,qBAAqB,QAGhC;AAED,MAAM,CAAN,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,2DAAsC,CAAA;IACtC,yDAAoC,CAAA;AACtC,CAAC,EAHW,iBAAiB,KAAjB,iBAAiB,QAG5B;AAED,MAAM,CAAN,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,mCAAiB,CAAA;IACjB,+CAA6B,CAAA;AAC/B,CAAC,EAHW,cAAc,KAAd,cAAc,QAGzB;AAED,MAAM,CAAN,IAAY,iBAKX;AALD,WAAY,iBAAiB;IAC3B,sCAAiB,CAAA;IACjB,4CAAuB,CAAA;IACvB,oDAA+B,CAAA;IAC/B,oCAAe,CAAA;AACjB,CAAC,EALW,iBAAiB,KAAjB,iBAAiB,QAK5B","sourcesContent":["import {\n LocationValue,\n PhoneNumberRawValue,\n PhoneNumberValue,\n SearchPermissions,\n} from '@bisondesk/commons-sdk/types';\nimport { PublicSearchDefinition } from './definitions.js';\nimport { Interest } from './interests.js';\nimport { BaseEvent } from './internal-events.js';\nimport { ReferenceData } from './utils.js';\n\nexport enum OrganizatioRiskTags {\n BAD_FINANCIAL_INFO = 'BAD_FINANCIAL_INFO',\n WRITE_OFF = 'WRITE_OFF',\n VAT_NUMBER_INVALID = 'VAT_NUMBER_INVALID',\n INSTINCT = 'INSTINCT',\n INVALID_ADDRESS = 'INVALID_ADDRESS',\n NEW_CUSTOMER = 'NEW_CUSTOMER',\n BANK_ACCOUNT_BLOCKED = 'BANK_ACCOUNT_BLOCKED',\n NO_GPS = 'NO_GPS',\n BANKRUPTCY = 'BANKRUPTCY',\n JUDICIAL_REORGANISATION_WCO = 'JUDICIAL_REORGANISATION_WCO',\n NO_DRIVING_LICENSE = 'NO_DRIVING_LICENSE',\n}\n\nexport enum ContactActions {\n UPSERT = 'upsert',\n DELETE = 'delete',\n}\n\nexport enum OrganizationActions {\n ADD_ACTIVITY = 'add_activity',\n UPSERT = 'upsert',\n DELETE = 'delete',\n SELL_TO_ORGANIZATION = 'sell_to_organization',\n}\n\nexport type CrmEvent = CrmOrganizationEvent | CrmContactEvent;\n\ntype BaseContactEvent = BaseEvent & {\n contactId: string;\n organizationId?: string;\n actionAt: string;\n userId: string;\n tenantId: string;\n};\n\nexport type ContactCreateEvent = BaseContactEvent & {\n action: 'create';\n contact: Contact;\n previousContact?: undefined;\n};\n\nexport type ContactUpdateEvent = BaseContactEvent & {\n action: 'update';\n contact: Contact;\n previousContact: Contact;\n};\n\nexport type ContactDeleteEvent = BaseContactEvent & {\n action: 'delete';\n contact?: undefined;\n previousContact: Contact;\n};\n\nexport type CrmContactEvent = ContactCreateEvent | ContactUpdateEvent | ContactDeleteEvent;\n\ntype BaseOrgEvent = BaseEvent & {\n organizationId: string;\n actionAt: string;\n userId: string;\n tenantId: string;\n};\n\nexport type OrgCreateEvent = BaseOrgEvent & {\n action: 'create';\n org: Organization;\n previousOrg?: undefined;\n};\n\nexport type OrgUpdateEvent = BaseOrgEvent & {\n action: 'update';\n org: Organization;\n previousOrg: Organization;\n};\n\nexport type OrgDeleteEvent = BaseOrgEvent & {\n action: 'delete';\n org?: undefined;\n previousOrg: Organization;\n};\n\nexport type CrmOrganizationEvent = OrgCreateEvent | OrgUpdateEvent | OrgDeleteEvent;\n\ntype BaseOrganization = {\n usages: {\n [tenantId: string]: string[]; // branchIds that are using this organization\n };\n countryCode: string;\n name: string;\n segment?: string;\n /**\n * Client sector — Tier 1 of the industry taxonomy (what business the client is in).\n * Free string validated against the `ORG_INDUSTRY_PICKLIST_ID` picklist. Orthogonal to\n * `segment`, which records the client's ROLE (end customer, trader, dealer, …).\n */\n industry?: string;\n /**\n * Sub-industry — Tier 2 of the industry taxonomy: a finer classification within the chosen\n * `industry`. Generic and reusable across industries; each picklist value\n * (`SUB_INDUSTRY_PICKLIST_ID`) declares which parent `industry` it belongs to. Today only\n * `transport-logistics` has sub-values (the cargo type: reefer, tanker, tipper, …).\n */\n subIndustry?: string;\n type?: 'COMPANY' | 'INDIVIDUAL' | 'GOVERNMENT';\n vatNumber?: string;\n /**\n * Registered share capital (capital social), in the currency it was registered in. Registry\n * data like `vatNumber`, kept because the legal documents print it — the Ivory Coast\n * cautionnement names the customer by capital alongside its trade-register number.\n */\n shareCapital?: string;\n /**\n * National business registration number. For FR orgs this is a SIREN (9 digits) or a SIRET\n * (14 digits = SIREN + 5-digit NIC) — whichever is available; needed for annuaire routing of\n * FR B2B e-invoices. A SIREN is derivable from a valid FR VAT (digits 3–11).\n */\n registrationNumber?: string;\n addresses?: {\n legal?: LocationValue;\n transport?: LocationValue;\n };\n conglomerate?: boolean;\n riskTags?: string[];\n\n // general contact — main switchboard / info address, distinct from billing\n generalEmail?: string;\n\n // billing\n billingEmails?: string[];\n skipPaymentReminders?: boolean;\n skipInvoiceEmails?: boolean;\n trustworthy?: boolean;\n // meta\n slbPartner?: boolean;\n\n tags?: string[]; // custom tags for the organization\n};\n\nexport type NewOrganization = BaseOrganization & {\n id?: undefined;\n externalId?: undefined;\n createdAt?: undefined;\n createdBy?: undefined;\n billingPhone?: PhoneNumberValue | PhoneNumberRawValue;\n generalPhone?: PhoneNumberValue | PhoneNumberRawValue;\n};\n\nexport type ValidatedNewOrganization = Omit<NewOrganization, 'billingPhone' | 'generalPhone'> & {\n billingPhone?: PhoneNumberValue;\n generalPhone?: PhoneNumberValue;\n};\n\nexport type Organization = BaseOrganization & {\n createdAt: string;\n externalId: number;\n createdBy: string;\n id: string;\n\n debt?: OrganizationDebtInfo;\n\n billingPhone?: PhoneNumberValue;\n generalPhone?: PhoneNumberValue;\n\n disabled?: boolean;\n disabledAt?: string;\n disabledBy?: string;\n disabledReason?: string;\n};\n\nexport type OrganizationDebtInfo = {\n overdueSince?: string;\n overdueInvoices: number;\n overdueAmount: string;\n unpaidInvoices: number;\n unpaidAmount: string;\n};\n\nexport type OrgLeasingContract = {\n id: string;\n contractNumber?: string;\n vehicle: {\n id: string;\n stockNumber: string;\n administrativeNumber?: string;\n };\n};\n\nexport type SearchOrganization = {\n org: Organization;\n contract: OrgLeasingContract[]; // important for the logic regarding leasing overdue reminders\n interests?: Interest[];\n custom: {\n inUse: boolean; // is this organization in use by any of the branches of this tenant, or is it an organization from another tenant.\n lastActivityAt: string | undefined; // last activity at this organization\n lastActivityBy: string | undefined; // user that did the last activity at this organization\n engagementTypes: OrgEngagementType[] | undefined; // types of engagements this organization has in the tenant\n\n accountManagers: string[]; // dynamically determined account managers for this organization\n };\n};\n\nexport type PotentialDuplicatesReferenceData = ReferenceData & { blockIgnore?: boolean };\n\nexport type InputSearchOrganization = SearchOrganization & {\n permissions: SearchPermissions | undefined;\n};\n\nexport type SearchContact = {\n contact: Contact;\n org?: Organization;\n interests?: Interest[];\n custom: {\n accountManagers: string[]; // dynamically determined account managers for this contact\n classification: 'prospect' | 'customer';\n hasOrganization: boolean;\n lastActivityAt: string | undefined;\n lastActivityBy: string | undefined;\n };\n};\n\nexport type InputSearchContact = SearchContact & {\n permissions: SearchPermissions | undefined;\n};\n\nexport type CrmPublicSearchDefinitions = {\n searchOrg: PublicSearchDefinition;\n searchContact: PublicSearchDefinition;\n};\n\nexport enum MarketingChannel {\n Email = 'email',\n /** Calls, WhatsApp and SMS to a phone number. */\n Phone = 'phone',\n}\n\n/** Why an address stopped receiving marketing. */\nexport enum MarketingOptOutReason {\n /** A user switched the address off in the CRM. */\n Human = 'human',\n /** The recipient used the unsubscribe link in a campaign email. */\n Unsubscribe = 'unsubscribe',\n /** The recipient reported a campaign email as spam. */\n Complaint = 'complaint',\n /** SES Auto Validation dropped the address before sending because it expected a bounce. */\n AutoValidation = 'auto-validation',\n /** The recipient asked WhatsApp marketing to stop. */\n WhatsappStop = 'whatsapp-stop',\n}\n\n/**\n * An opted-out address in a tenant: an email address, or a phone number in E.164. The row exists\n * only while the address is opted out; switching it back on deletes it.\n */\nexport type MarketingOptOut = {\n channel: MarketingChannel;\n address: string;\n reason: MarketingOptOutReason;\n updatedAt: string;\n /**\n * The user who switched it off, or `system` for the automatic reasons. Absent on opt-outs\n * carried over from the old per-contact switches, which never recorded who set them.\n */\n updatedBy?: string;\n /** The campaign whose email led to it, for `unsubscribe`, `complaint` and `auto-validation`. */\n campaignId?: string;\n};\n\nexport enum PartnerLevel {\n Internal = '05-internal',\n Gold = '10-gold',\n Silver = '20-silver',\n Bronze = '30-bronze',\n}\n\ntype BaseContact = {\n accountManager?: string;\n countryCode?: string; // TODO review if this should be required (UI says it is)\n language?: string;\n emails: string[];\n job?: string;\n /** free-text job title; only meaningful when `job === JOB_CATEGORY_OTHER_ID` */\n jobOther?: string;\n /** either firstName or lastName should be filled in */\n firstName?: string;\n lastName?: string;\n /** yyyy-mm-dd */\n birthDate?: string;\n /** National identity document number (e.g. CNI in Côte d'Ivoire). */\n nationalId?: string;\n organizationId?: string;\n /** will not be filled if organizationId is present */\n orgName?: string;\n clientLevel?: PartnerLevel;\n\n disabledAt?: string;\n disabledBy?: string;\n disabledReason?: string;\n\n tags?: string[]; // custom tags for the contact\n\n channels?: {\n telegram?: MessagingChannelEntry;\n whatsapp?: MessagingChannelEntry;\n };\n};\n\nexport type MessagingChannelEntry = {\n id: string;\n sessionId?: string;\n};\n\nexport type NewContact = BaseContact & {\n id?: undefined;\n createdAt?: undefined;\n createdBy?: undefined;\n phones: Array<PhoneNumberValue | PhoneNumberRawValue>;\n organizationId?: string;\n};\n\nexport type NewContactValidated = BaseContact & {\n id?: undefined;\n createdAt?: undefined;\n createdBy?: undefined;\n organizationId?: string;\n phones: PhoneNumberValue[];\n};\n\nexport type Contact = BaseContact & {\n id: string;\n createdAt: string;\n createdBy: string;\n phones: PhoneNumberValue[];\n};\n\nexport enum SaveContactResolution {\n IgnoreDuplicates = 'IGNORE_DUPLICATES',\n BlockDuplicates = 'BLOCK_DUPLICATES',\n}\n\nexport enum SaveOrgResolution {\n IgnoreDuplicates = 'IGNORE_DUPLICATES',\n BlockDuplicates = 'BLOCK_DUPLICATES',\n}\n\nexport enum CrmSearchScope {\n Tenant = 'tenant',\n Conglomerate = 'conglomerate',\n}\n\nexport enum OrgEngagementType {\n offers = 'offers',\n purchases = 'purchases',\n opportunities = 'opportunities',\n sales = 'sales',\n}\n"]}
|
|
1
|
+
{"version":3,"file":"crm.js","sourceRoot":"/","sources":["types/crm.ts"],"names":[],"mappings":"AAWA,MAAM,CAAN,IAAY,mBAYX;AAZD,WAAY,mBAAmB;IAC7B,gEAAyC,CAAA;IACzC,8CAAuB,CAAA;IACvB,gEAAyC,CAAA;IACzC,4CAAqB,CAAA;IACrB,0DAAmC,CAAA;IACnC,oDAA6B,CAAA;IAC7B,oEAA6C,CAAA;IAC7C,wCAAiB,CAAA;IACjB,gDAAyB,CAAA;IACzB,kFAA2D,CAAA;IAC3D,gEAAyC,CAAA;AAC3C,CAAC,EAZW,mBAAmB,KAAnB,mBAAmB,QAY9B;AAED,MAAM,CAAN,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,mCAAiB,CAAA;IACjB,mCAAiB,CAAA;AACnB,CAAC,EAHW,cAAc,KAAd,cAAc,QAGzB;AAED,MAAM,CAAN,IAAY,mBAKX;AALD,WAAY,mBAAmB;IAC7B,oDAA6B,CAAA;IAC7B,wCAAiB,CAAA;IACjB,wCAA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Value,\n PhoneNumberValue,\n SearchPermissions,\n} from '@bisondesk/commons-sdk/types';\nimport { PublicSearchDefinition } from './definitions.js';\nimport { Interest } from './interests.js';\nimport { BaseEvent } from './internal-events.js';\nimport { ReferenceData } from './utils.js';\n\nexport enum OrganizatioRiskTags {\n BAD_FINANCIAL_INFO = 'BAD_FINANCIAL_INFO',\n WRITE_OFF = 'WRITE_OFF',\n VAT_NUMBER_INVALID = 'VAT_NUMBER_INVALID',\n INSTINCT = 'INSTINCT',\n INVALID_ADDRESS = 'INVALID_ADDRESS',\n NEW_CUSTOMER = 'NEW_CUSTOMER',\n BANK_ACCOUNT_BLOCKED = 'BANK_ACCOUNT_BLOCKED',\n NO_GPS = 'NO_GPS',\n BANKRUPTCY = 'BANKRUPTCY',\n JUDICIAL_REORGANISATION_WCO = 'JUDICIAL_REORGANISATION_WCO',\n NO_DRIVING_LICENSE = 'NO_DRIVING_LICENSE',\n}\n\nexport enum ContactActions {\n UPSERT = 'upsert',\n DELETE = 'delete',\n}\n\nexport enum OrganizationActions {\n ADD_ACTIVITY = 'add_activity',\n UPSERT = 'upsert',\n DELETE = 'delete',\n SELL_TO_ORGANIZATION = 'sell_to_organization',\n}\n\nexport type CrmEvent = CrmOrganizationEvent | CrmContactEvent;\n\ntype BaseContactEvent = BaseEvent & {\n contactId: string;\n organizationId?: string;\n actionAt: string;\n userId: string;\n tenantId: string;\n};\n\nexport type ContactCreateEvent = BaseContactEvent & {\n action: 'create';\n contact: Contact;\n previousContact?: undefined;\n};\n\nexport type ContactUpdateEvent = BaseContactEvent & {\n action: 'update';\n contact: Contact;\n previousContact: Contact;\n};\n\nexport type ContactDeleteEvent = BaseContactEvent & {\n action: 'delete';\n contact?: undefined;\n previousContact: Contact;\n};\n\nexport type CrmContactEvent = ContactCreateEvent | ContactUpdateEvent | ContactDeleteEvent;\n\ntype BaseOrgEvent = BaseEvent & {\n organizationId: string;\n actionAt: string;\n userId: string;\n tenantId: string;\n};\n\nexport type OrgCreateEvent = BaseOrgEvent & {\n action: 'create';\n org: Organization;\n previousOrg?: undefined;\n};\n\nexport type OrgUpdateEvent = BaseOrgEvent & {\n action: 'update';\n org: Organization;\n previousOrg: Organization;\n};\n\nexport type OrgDeleteEvent = BaseOrgEvent & {\n action: 'delete';\n org?: undefined;\n previousOrg: Organization;\n};\n\nexport type CrmOrganizationEvent = OrgCreateEvent | OrgUpdateEvent | OrgDeleteEvent;\n\ntype BaseOrganization = {\n usages: {\n [tenantId: string]: string[]; // branchIds that are using this organization\n };\n countryCode: string;\n name: string;\n segment?: string;\n /**\n * Client sector — Tier 1 of the industry taxonomy (what business the client is in).\n * Free string validated against the `ORG_INDUSTRY_PICKLIST_ID` picklist. Orthogonal to\n * `segment`, which records the client's ROLE (end customer, trader, dealer, …).\n */\n industry?: string;\n /**\n * Sub-industry — Tier 2 of the industry taxonomy: a finer classification within the chosen\n * `industry`. Generic and reusable across industries; each picklist value\n * (`SUB_INDUSTRY_PICKLIST_ID`) declares which parent `industry` it belongs to. Today only\n * `transport-logistics` has sub-values (the cargo type: reefer, tanker, tipper, …).\n */\n subIndustry?: string;\n type?: 'COMPANY' | 'INDIVIDUAL' | 'GOVERNMENT';\n vatNumber?: string;\n /**\n * Registered share capital (capital social), in the currency it was registered in. Registry\n * data like `vatNumber`, kept because the legal documents print it — the Ivory Coast\n * cautionnement names the customer by capital alongside its trade-register number.\n */\n shareCapital?: string;\n /**\n * National business registration number. For FR orgs this is a SIREN (9 digits) or a SIRET\n * (14 digits = SIREN + 5-digit NIC) — whichever is available; needed for annuaire routing of\n * FR B2B e-invoices. A SIREN is derivable from a valid FR VAT (digits 3–11).\n */\n registrationNumber?: string;\n addresses?: {\n legal?: LocationValue;\n transport?: LocationValue;\n };\n conglomerate?: boolean;\n riskTags?: string[];\n\n // general contact — main switchboard / info address, distinct from billing\n generalEmail?: string;\n\n // billing\n billingEmails?: string[];\n skipPaymentReminders?: boolean;\n skipInvoiceEmails?: boolean;\n trustworthy?: boolean;\n // meta\n slbPartner?: boolean;\n\n tags?: string[]; // custom tags for the organization\n};\n\nexport type NewOrganization = BaseOrganization & {\n id?: undefined;\n externalId?: undefined;\n createdAt?: undefined;\n createdBy?: undefined;\n billingPhone?: PhoneNumberValue | PhoneNumberRawValue;\n generalPhone?: PhoneNumberValue | PhoneNumberRawValue;\n};\n\nexport type ValidatedNewOrganization = Omit<NewOrganization, 'billingPhone' | 'generalPhone'> & {\n billingPhone?: PhoneNumberValue;\n generalPhone?: PhoneNumberValue;\n};\n\nexport type Organization = BaseOrganization & {\n createdAt: string;\n externalId: number;\n createdBy: string;\n id: string;\n\n debt?: OrganizationDebtInfo;\n\n billingPhone?: PhoneNumberValue;\n generalPhone?: PhoneNumberValue;\n\n disabled?: boolean;\n disabledAt?: string;\n disabledBy?: string;\n disabledReason?: string;\n};\n\nexport type OrganizationDebtInfo = {\n overdueSince?: string;\n overdueInvoices: number;\n overdueAmount: string;\n unpaidInvoices: number;\n unpaidAmount: string;\n};\n\nexport type OrgLeasingContract = {\n id: string;\n contractNumber?: string;\n vehicle: {\n id: string;\n stockNumber: string;\n administrativeNumber?: string;\n };\n};\n\nexport type SearchOrganization = {\n org: Organization;\n contract: OrgLeasingContract[]; // important for the logic regarding leasing overdue reminders\n interests?: Interest[];\n custom: {\n inUse: boolean; // is this organization in use by any of the branches of this tenant, or is it an organization from another tenant.\n lastActivityAt: string | undefined; // last activity at this organization\n lastActivityBy: string | undefined; // user that did the last activity at this organization\n contactedBy: string[]; // users who logged any activity tagged with this organization\n engagementTypes: OrgEngagementType[] | undefined; // types of engagements this organization has in the tenant\n\n accountManagers: string[]; // dynamically determined account managers for this organization\n };\n};\n\nexport type PotentialDuplicatesReferenceData = ReferenceData & { blockIgnore?: boolean };\n\nexport type InputSearchOrganization = SearchOrganization & {\n permissions: SearchPermissions | undefined;\n};\n\nexport type SearchContact = {\n contact: Contact;\n org?: Organization;\n interests?: Interest[];\n custom: {\n accountManagers: string[]; // dynamically determined account managers for this contact\n classification: 'prospect' | 'customer';\n hasOrganization: boolean;\n lastActivityAt: string | undefined;\n lastActivityBy: string | undefined;\n };\n};\n\nexport type InputSearchContact = SearchContact & {\n permissions: SearchPermissions | undefined;\n};\n\nexport type CrmPublicSearchDefinitions = {\n searchOrg: PublicSearchDefinition;\n searchContact: PublicSearchDefinition;\n};\n\nexport enum MarketingChannel {\n Email = 'email',\n /** Calls, WhatsApp and SMS to a phone number. */\n Phone = 'phone',\n}\n\n/** Why an address stopped receiving marketing. */\nexport enum MarketingOptOutReason {\n /** A user switched the address off in the CRM. */\n Human = 'human',\n /** The recipient used the unsubscribe link in a campaign email. */\n Unsubscribe = 'unsubscribe',\n /** The recipient reported a campaign email as spam. */\n Complaint = 'complaint',\n /** SES Auto Validation dropped the address before sending because it expected a bounce. */\n AutoValidation = 'auto-validation',\n /** The recipient asked WhatsApp marketing to stop. */\n WhatsappStop = 'whatsapp-stop',\n}\n\n/**\n * An opted-out address in a tenant: an email address, or a phone number in E.164. The row exists\n * only while the address is opted out; switching it back on deletes it.\n */\nexport type MarketingOptOut = {\n channel: MarketingChannel;\n address: string;\n reason: MarketingOptOutReason;\n updatedAt: string;\n /**\n * The user who switched it off, or `system` for the automatic reasons. Absent on opt-outs\n * carried over from the old per-contact switches, which never recorded who set them.\n */\n updatedBy?: string;\n /** The campaign whose email led to it, for `unsubscribe`, `complaint` and `auto-validation`. */\n campaignId?: string;\n};\n\nexport enum PartnerLevel {\n Internal = '05-internal',\n Gold = '10-gold',\n Silver = '20-silver',\n Bronze = '30-bronze',\n}\n\ntype BaseContact = {\n accountManager?: string;\n countryCode?: string; // TODO review if this should be required (UI says it is)\n language?: string;\n emails: string[];\n job?: string;\n /** free-text job title; only meaningful when `job === JOB_CATEGORY_OTHER_ID` */\n jobOther?: string;\n /** either firstName or lastName should be filled in */\n firstName?: string;\n lastName?: string;\n /** yyyy-mm-dd */\n birthDate?: string;\n /** National identity document number (e.g. CNI in Côte d'Ivoire). */\n nationalId?: string;\n organizationId?: string;\n /** will not be filled if organizationId is present */\n orgName?: string;\n clientLevel?: PartnerLevel;\n\n disabledAt?: string;\n disabledBy?: string;\n disabledReason?: string;\n\n tags?: string[]; // custom tags for the contact\n\n channels?: {\n telegram?: MessagingChannelEntry;\n whatsapp?: MessagingChannelEntry;\n };\n};\n\nexport type MessagingChannelEntry = {\n id: string;\n sessionId?: string;\n};\n\nexport type NewContact = BaseContact & {\n id?: undefined;\n createdAt?: undefined;\n createdBy?: undefined;\n phones: Array<PhoneNumberValue | PhoneNumberRawValue>;\n organizationId?: string;\n};\n\nexport type NewContactValidated = BaseContact & {\n id?: undefined;\n createdAt?: undefined;\n createdBy?: undefined;\n organizationId?: string;\n phones: PhoneNumberValue[];\n};\n\nexport type Contact = BaseContact & {\n id: string;\n createdAt: string;\n createdBy: string;\n phones: PhoneNumberValue[];\n};\n\nexport enum SaveContactResolution {\n IgnoreDuplicates = 'IGNORE_DUPLICATES',\n BlockDuplicates = 'BLOCK_DUPLICATES',\n}\n\nexport enum SaveOrgResolution {\n IgnoreDuplicates = 'IGNORE_DUPLICATES',\n BlockDuplicates = 'BLOCK_DUPLICATES',\n}\n\nexport enum CrmSearchScope {\n Tenant = 'tenant',\n Conglomerate = 'conglomerate',\n}\n\nexport enum OrgEngagementType {\n offers = 'offers',\n purchases = 'purchases',\n opportunities = 'opportunities',\n sales = 'sales',\n}\n"]}
|
|
@@ -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 = {
|
|
@@ -44,6 +45,8 @@ export type SearchDebtorInfo = {
|
|
|
44
45
|
riskLevelLabel: string;
|
|
45
46
|
hasActiveContracts: boolean;
|
|
46
47
|
};
|
|
48
|
+
mileage?: ContractMileage[];
|
|
49
|
+
mileageSummary?: MileageSummary;
|
|
47
50
|
};
|
|
48
51
|
export declare enum DebtorsDossierStatus {
|
|
49
52
|
AUTO_REMINDER = "auto_reminder",
|
|
@@ -257,6 +260,8 @@ export type SearchDebtorsDossier = {
|
|
|
257
260
|
remindersSent: number;
|
|
258
261
|
hasActiveLdrs?: boolean;
|
|
259
262
|
};
|
|
263
|
+
mileage?: ContractMileage[];
|
|
264
|
+
mileageSummary?: MileageSummary;
|
|
260
265
|
};
|
|
261
266
|
export type DebtorsDossierKanbanColumn = {
|
|
262
267
|
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,MAAM,MAAM,SAAS,GAAG;IACtB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,qBAAqB,EAAE,MAAM,CAAC;IAE9B,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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 { 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-debtors.ts"],"names":[],"mappings":"AA0DA,MAAM,CAAN,IAAY,oBAQX;AARD,WAAY,oBAAoB;IAC9B,uDAA+B,CAAA;IAC/B,2CAAmB,CAAA;IACnB,+DAAuC,CAAA;IACvC,6CAAqB,CAAA;IACrB,yDAAiC,CAAA;IACjC,2CAAmB,CAAA;IACnB,6CAAqB,CAAA;AACvB,CAAC,EARW,oBAAoB,KAApB,oBAAoB,QAQ/B;AAED,MAAM,CAAC,MAAM,kCAAkC,GAG3C;IACF,CAAC,oBAAoB,CAAC,aAAa,CAAC,EAAE,IAAI;IAC1C,CAAC,oBAAoB,CAAC,OAAO,CAAC,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE;IAC1E,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa,EAAE;IACxF,CAAC,oBAAoB,CAAC,QAAQ,CAAC,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE;IAC7E,CAAC,oBAAoB,CAAC,cAAc,CAAC,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,gBAAgB,EAAE;IAC3F,CAAC,oBAAoB,CAAC,QAAQ,CAAC,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,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/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 /** One entry per tracked contract of the organization, copied from the contracts index. */\n mileage?: ContractMileage[];\n mileageSummary?: MileageSummary;\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,QA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;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,EAAE,MAAM,CAAC;QAC7B,OAAO,CAAC,EAAE,eAAe,CAAC;KAC3B,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,qBAAqB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
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 { 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"]}
|
|
@@ -49,6 +49,8 @@ export type VehiclePurchasePaymentBff = {
|
|
|
49
49
|
vehicle: SearchVehicle;
|
|
50
50
|
supplierName?: string;
|
|
51
51
|
exportChecks?: PaymentExportChecks;
|
|
52
|
+
documents?: UnpaidPurchaseDocument[];
|
|
53
|
+
invoiceDueDate?: string;
|
|
52
54
|
};
|
|
53
55
|
export declare enum UnpaidPurchaseGroup {
|
|
54
56
|
Sold = "sold",
|
|
@@ -58,8 +60,14 @@ export declare enum UnpaidPurchaseGroup {
|
|
|
58
60
|
export declare enum UnpaidPurchaseLogisticStatus {
|
|
59
61
|
Delivered = "delivered",
|
|
60
62
|
Arrived = "arrived",
|
|
63
|
+
DirectDelivery = "directDelivery",
|
|
61
64
|
Expected = "expected"
|
|
62
65
|
}
|
|
66
|
+
export declare enum UnpaidPurchaseDocument {
|
|
67
|
+
PurchaseInvoice = "purchase_invoice",
|
|
68
|
+
Registration = "registration",
|
|
69
|
+
RegistrationCopy = "registration_copy"
|
|
70
|
+
}
|
|
63
71
|
export type UnpaidPurchasesFilters = {
|
|
64
72
|
q?: string;
|
|
65
73
|
sold?: boolean;
|
|
@@ -67,6 +75,7 @@ export type UnpaidPurchasesFilters = {
|
|
|
67
75
|
purchasedBy?: string[];
|
|
68
76
|
branchId?: string;
|
|
69
77
|
used?: boolean;
|
|
78
|
+
documents?: UnpaidPurchaseDocument[];
|
|
70
79
|
group?: UnpaidPurchaseGroup;
|
|
71
80
|
};
|
|
72
81
|
export type UnpaidPurchase = {
|
|
@@ -77,6 +86,7 @@ export type UnpaidPurchase = {
|
|
|
77
86
|
paidAmount: string;
|
|
78
87
|
remainingAmount: string;
|
|
79
88
|
invoiceDueDate?: string;
|
|
89
|
+
documents: UnpaidPurchaseDocument[];
|
|
80
90
|
supplierName?: string;
|
|
81
91
|
};
|
|
82
92
|
export type UnpaidPurchasesMeta = {
|
|
@@ -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;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,eAAO,MAAM,oDAAoD,kDAChB,CAAC;AASlD,oBAAY,YAAY;IACtB,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,QAAQ,aAAa;CACtB;AAMD,MAAM,MAAM,6BAA6B,GAAG;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IAErB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,SAAS,EAAE,MAAM,CAAC;IAElB,MAAM,EAAE,MAAM,CAAC;IAEf,OAAO,CAAC,EAAE,I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,CAAC;IACxC,MAAM,EAAE,QAAQ,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG;IAC9C,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,eAAe,EAAE,sBAAsB,CAAC;IACxC,MAAM,EAAE,QAAQ,CAAC;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"}
|
|
@@ -15,6 +15,13 @@ export var UnpaidPurchaseLogisticStatus;
|
|
|
15
15
|
(function (UnpaidPurchaseLogisticStatus) {
|
|
16
16
|
UnpaidPurchaseLogisticStatus["Delivered"] = "delivered";
|
|
17
17
|
UnpaidPurchaseLogisticStatus["Arrived"] = "arrived";
|
|
18
|
+
UnpaidPurchaseLogisticStatus["DirectDelivery"] = "directDelivery";
|
|
18
19
|
UnpaidPurchaseLogisticStatus["Expected"] = "expected";
|
|
19
20
|
})(UnpaidPurchaseLogisticStatus || (UnpaidPurchaseLogisticStatus = {}));
|
|
21
|
+
export var UnpaidPurchaseDocument;
|
|
22
|
+
(function (UnpaidPurchaseDocument) {
|
|
23
|
+
UnpaidPurchaseDocument["PurchaseInvoice"] = "purchase_invoice";
|
|
24
|
+
UnpaidPurchaseDocument["Registration"] = "registration";
|
|
25
|
+
UnpaidPurchaseDocument["RegistrationCopy"] = "registration_copy";
|
|
26
|
+
})(UnpaidPurchaseDocument || (UnpaidPurchaseDocument = {}));
|
|
20
27
|
//# 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;AAkGD,MAAM,CAAN,IAAY,mBAIX;AAJD,WAAY,mBAAmB;IAC7B,oCAAa,CAAA;IACb,0CAAmB,CAAA;IACnB,4CAAqB,CAAA;AACvB,CAAC,EAJW,mBAAmB,KAAnB,mBAAmB,QAI9B;AAQD,MAAM,CAAN,IAAY,4BAKX;AALD,WAAY,4BAA4B;IACtC,uDAAuB,CAAA;IACvB,mDAAmB,CAAA;IACnB,iEAAiC,CAAA;IACjC,qDAAqB,CAAA;AACvB,CAAC,EALW,4BAA4B,KAA5B,4BAA4B,QAKvC;AASD,MAAM,CAAN,IAAY,sBAIX;AAJD,WAAY,sBAAsB;IAChC,8DAAoC,CAAA;IACpC,uDAA6B,CAAA;IAC7B,gEAAsC,CAAA;AACxC,CAAC,EAJW,sBAAsB,KAAtB,sBAAsB,QAIjC","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 /** The documents the vehicle already has, as on the Unpaid list; filled for the Allowed list only. */\n documents?: UnpaidPurchaseDocument[];\n /** Due date of the vehicle's latest main purchase invoice; filled for the Allowed list only. */\n invoiceDueDate?: string;\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 them:\n * delivered to the client, arrived on our park, going straight from the supplier to the client\n * (`deal.readyToDeliver`), or still expected from the supplier. Delivered comes from the sale side,\n * 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 DirectDelivery = 'directDelivery',\n Expected = 'expected',\n}\n\n/**\n * A document the payments page tracks for the vehicle behind a purchase: the main purchase invoice (a\n * purchase invoice with a vehicle line, the Purchase Invoice of the vehicle's Document Checks; invoices\n * for transport or repairs do not count), and the vehicle's registration, the original or a copy. The\n * registration values are the administrative document types, and only documents filed on the vehicle\n * count.\n */\nexport enum UnpaidPurchaseDocument {\n PurchaseInvoice = 'purchase_invoice',\n Registration = 'registration',\n RegistrationCopy = 'registration_copy',\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 /** Documents the vehicle must have, every one of them. */\n documents?: UnpaidPurchaseDocument[];\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 vehicle's latest main purchase invoice, latest by issue date. */\n invoiceDueDate?: string;\n /** The documents the vehicle already has. */\n documents: UnpaidPurchaseDocument[];\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"]}
|
|
@@ -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,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAGL,aAAa,EAGb,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAC1C,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC;AACvC,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC;AACpC,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAC;AAElC,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAC/B,MAAM,8BAA8B,GAAG,CAAC,CAAC;AAEzC,MAAM,CA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AC,QAAQ,CAAC,CAAC;IACpD,MAAM,IAAI,GAAG,UAAU,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAC5C,MAAM,GAAG,GAAG,UAAU,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IAC1C,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,KAAK,aAAa,CAAC,QAAQ,CAAC,CAAC;IACnF,MAAM,WAAW,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,CAAC;IAE7E,OAAO;QACL,QAAQ,EAAE,OAAO,CAAC,MAAM;QACxB,QAAQ;QACR,IAAI;QACJ,GAAG;QACH,MAAM,EAAE,QAAQ,GAAG,IAAI,GAAG,GAAG;QAC7B,YAAY,EAAE,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS;QAC9F,KAAK,EAAE,eAAe,CACpB,KAAK,CAAC,WAAW,EAAE,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":""}
|