@bisondesk/core-sdk 1.0.631 → 1.0.633
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.d.ts +77 -6
- package/lib/types/leasing.d.ts.map +1 -1
- package/lib/types/leasing.js +1 -0
- package/lib/types/leasing.js.map +1 -1
- package/lib/types/opportunities.d.ts +1 -0
- package/lib/types/opportunities.d.ts.map +1 -1
- package/lib/types/opportunities.js.map +1 -1
- package/lib/types/tenants.d.ts +2 -0
- package/lib/types/tenants.d.ts.map +1 -1
- package/lib/types/tenants.js +2 -0
- package/lib/types/tenants.js.map +1 -1
- package/package.json +1 -1
- package/src/types/crm.ts +6 -0
- package/src/types/leasing.ts +102 -9
- package/src/types/opportunities.ts +1 -0
- package/src/types/tenants.ts +7 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opportunities.js","sourceRoot":"/","sources":["types/opportunities.ts"],"names":[],"mappings":"AA4BA,MAAM,CAAN,IAAY,kBAsBX;AAtBD,WAAY,kBAAkB;IAC5B,iDAA2B,CAAA;IAC3B,mDAA6B,CAAA;IAC7B,mCAAa,CAAA;IACb,uCAAiB,CAAA;IACjB,6DAAuC,CAAA;IACvC,+DAAyC,CAAA;IACzC,uDAAiC,CAAA;IACjC,yDAAmC,CAAA;IACnC,mDAA6B,CAAA;IAC7B,qDAA+B,CAAA;IAC/B,mDAA6B,CAAA;IAC7B,mDAA6B,CAAA;IAC7B,iDAA2B,CAAA;IAC3B,mDAA6B,CAAA;IAC7B,iDAA2B,CAAA;IAC3B,uDAAiC,CAAA;IACjC,yDAAmC,CAAA;IACnC,mEAA6C,CAAA;IAC7C,wDAAkC,CAAA;IAClC,qDAA+B,CAAA;IAC/B,iFAA2D,CAAA;AAC7D,CAAC,EAtBW,kB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CAAC,MAAM,2DAA2D,GACtE,yCAAyC,CAAC;AAC5C,MAAM,CAAC,MAAM,qDAAqD,GAChE,mCAAmC,CAAC;AAEtC,MAAM,CAAC,MAAM,gCAAgC,GAAG,2BAA2B,CAAC;AAE5E,MAAM,CAAC,MAAM,2CAA2C,GAAG,yBAAyB,CAAC;AACrF,MAAM,CAAC,MAAM,mCAAmC,GAAG,iBAAiB,CAAC;AACrE,MAAM,CAAC,MAAM,qCAAqC,GAAG,mBAAmB,CAAC;AACzE,MAAM,CAAC,MAAM,sCAAsC,GAAG,oBAAoB,CAAC;AAC3E,MAAM,CAAC,MAAM,qCAAqC,GAAG,mBAAmB,CAAC;AACzE,MAAM,CAAC,MAAM,yCAAyC,GAAG,uBAAuB,CAAC;AACjF,MAAM,CAAC,MAAM,gCAAgC,GAAG,cAAc,CAAC","sourcesContent":["import { Task } from '@bisondesk/commons-sdk/tasks';\nimport { Document, NextList } from '@bisondesk/commons-sdk/types';\nimport { BusinessEntityIds, OpportunityType, WarningHints } from '../constants.js';\nimport { Contact, Organization } from './crm.js';\nimport type { Interest, InterestBffMeta } from './interests.js';\nimport { BaseEvent } from './internal-events.js';\nimport { OpportunityPayment } from './opportunity-payments.js';\nimport { Quote, QuoteStatus } from './quotes.js';\nimport { OpportunityReservation } from './reservations.js';\nimport { BaseSearchRequest } from './search.js';\nimport { Transport } from './transports.js';\nimport { DataRecord, ReferenceData } from './utils.js';\nimport { Vehicle } from './vehicles.js';\n\nexport type ListOpportunitiesFilters = {\n offset?: number;\n limit?: number;\n organizationId?: string;\n contactId?: string;\n vehicleId?: string;\n vehicleIds?: string[];\n excludeOpportunityId?: string;\n excludeLost?: boolean;\n statuses?: OpportunityStatus[];\n since?: string;\n until?: string;\n};\n\nexport enum OpportunityActions {\n ADD_REMARKS = 'add_remarks',\n CREATE_QUOTE = 'create_quote',\n LOSE = 'lose',\n REOPEN = 'reopen',\n START_PREPARATION = 'start_preparation',\n REVERT_PREPARATION = 'revert_preparation',\n START_DELIVERY = 'start_delivery',\n REVERT_DELIVERY = 'revert_delivery',\n SET_CUSTOMER = 'set_customer',\n SET_DOCUMENTS = 'set_documents',\n SET_INTEREST = 'set_interest',\n SET_METADATA = 'set_metadata',\n SET_VEHICLE = 'set_vehicle',\n ADD_ACTIVITY = 'add_activity',\n ADD_PAYMENT = 'add_payment',\n SWITCH_VEHICLE = 'switch_vehicle',\n DELIVER_VEHICLE = 'deliver_vehicle',\n UNDO_DELIVER_VEHICLE = 'undo_deliver_vehicle',\n SET_DEAL_INFO = 'update_deal_info',\n ISSUE_INVOICE = 'issue_invoice',\n CREATE_MANUAL_SALES_INVOICE = 'create_manual_sales_invoice',\n}\n\nexport enum OpportunityPaymentStatus {\n PARTIAL_PAYMENT = 'partial_payment',\n FULL_PAYMENT = 'full_payment',\n NO_PAYMENT = 'no_payment',\n}\n\nexport enum OpportunityStatus {\n PROSPECTION = 'prospection',\n DISCOVERY = 'discovery',\n EVALUATION = 'evaluation',\n REVIEW = 'review',\n PREPARATION = 'preparation',\n DELIVERY = 'delivery',\n}\n\nexport const OpportunityStatusOrder: OpportunityStatus[] = [\n OpportunityStatus.PROSPECTION,\n OpportunityStatus.DISCOVERY,\n OpportunityStatus.EVALUATION,\n OpportunityStatus.REVIEW,\n OpportunityStatus.PREPARATION,\n OpportunityStatus.DELIVERY,\n];\n\nexport enum OpportunityRequirementsCode {\n VEHICLE_AT_ORIGIN = 'vehicle_at_origin',\n LEASING_SL_ACTION = 'sl_action',\n TECHNICAL_NOTES_CHANGED = 'technical_notes_changed',\n}\n\nexport enum OpportunityWarningsCode {\n QUOTE_PENDING_VALIDATION = 'quote_pending_validation',\n QUOTE_PEDING_MANAGER_APPROVAL = 'quote_pending_manager_approval',\n CONCURRENT_OPPORTUNITIES = 'concurrent_opportunities',\n VEHICLE_RESERVED = 'vehicle_reserved',\n OPPORTUNITY_NEEDS_SWITCH_VEHICLE = 'opportunity_needs_switch_vehicle',\n VEHICLE_RESERVED_DATE_INFO = 'vehicle_reserved_date_info',\n VEHICLE_RESERVED_INDEFINITELY = 'vehicle_reserved_indefinitely',\n QUOTE_MISSING_DELIVERY_DETAILS = 'quote_missing_delivery_details',\n VEHICLE_TECHNICAL_DETAILS_CHANGED = 'vehicle_technical_details_changed',\n QUOTE_MISSING_FINANCING_DETAILS = 'quote_missing_financing_details',\n VEHICLE_BRANCH_MISMATCH = 'vehicle_branch_mismatch',\n VEHICLE_UNAVAILABLE_AT_SOURCE = 'vehicle_unavailable_at_source',\n INTERCOMPANY_LINKED = 'intercompany_linked',\n INTERCOMPANY_SOURCE_OPPORTUNITY = 'intercompany_source_opportunity',\n INTERCOMPANY_SOURCE_UNRESERVED = 'intercompany_source_unreserved',\n}\n\nexport const OpportunityWonColumnId = 'closed_won';\n\nexport const OpportunityKanbanColumns = [...OpportunityStatusOrder, OpportunityWonColumnId];\n\nexport const OpportunityKanbanEndColumns: string[] = [OpportunityWonColumnId];\n\nexport enum OpportunityLostReasonValues {\n Expensive = 'expensive',\n AlreadySold = 'already_sold',\n BadExperience = 'bad_experience',\n IncorrectVehicleCondition = 'incorrect_vehicle_condition',\n NoStock = 'not_enough_stock',\n SlowDelivery = 'slow_delivery',\n HighDeposit = 'deposit_too_high',\n NoAnswer = 'client_not_answered',\n Automatic = 'automatic',\n LeasingDeal = 'sold-via-leasing',\n InvestmentPostponed = 'investment_postponed',\n /** The target-tenant deal released the vehicle (lost, or its reservation expired). */\n IntercompanyReleased = 'intercompany_released',\n}\n\ntype BaseBid = {\n vehicleId: string;\n opportunityId?: string;\n contactId: string;\n amount: string;\n};\n\nexport type NewBid = BaseBid & {};\n\nexport type Bid = BaseBid & {\n id: string;\n createdAt: string;\n createdBy: string;\n};\n\n/**\n * Provenance of a customer deal whose vehicle is fulfilled by a source-tenant intercompany\n * opportunity. Written only by the intercompany coordination\n * (cross-tenant-sync/ico-opportunities);\n * the link table at the source is its mirror. Powers deep links, the payments walk and\n * support digging — never availability decisions.\n */\nexport type OpportunityIntercompanyInfo = {\n sourceTenantId: string;\n sourceBranchId: string;\n sourceOpportunityId: string;\n sourceReservationId: string;\n};\n\ntype BaseOpportunity = {\n accountManager?: string;\n administrativePerson?: string;\n type: OpportunityType;\n organizationId?: string;\n contactId?: string;\n vehicleId?: string;\n source?: string; // e.g. website, autoscout, mobile...\n branch: string;\n inquiry?: string;\n branchCountry: string;\n intercompany?: OpportunityIntercompanyInfo;\n};\n\n// type, branch and branchCountry are optional: when omitted, the server defaults them\n// from the requester's preferred branches/opportunity types, then the tenant defaults.\nexport type NewOpportunity = Omit<BaseOpportunity, 'type' | 'branch' | 'branchCountry'> &\n Partial<Pick<BaseOpportunity, 'type' | 'branch' | 'branchCountry'>> & {\n id?: undefined;\n createdAt?: undefined;\n createdBy?: undefined;\n modifiedAt?: undefined;\n modifiedBy?: undefined;\n };\n\nexport enum VehicleSaleDealStatus {\n SaleAgreed = 'SALE_AGREED',\n FirstPaymentReceived = 'FIRST_PAYMENT_RECEIVED',\n FullPaymentReceived = 'FULL_PAYMENT_RECEIVED',\n}\n\nexport enum VehicleSaleLogisticsStatus {\n AtOrigin = 'AT_ORIGIN',\n Delivered = 'DELIVERED',\n}\n\nexport type Opportunity = BaseOpportunity & {\n id: string;\n createdAt: string;\n createdBy: string;\n modifiedAt: string;\n modifiedBy: string;\n engagedAt?: string;\n engagedBy?: string;\n validatedAt?: string;\n validatedBy?: string;\n acceptedAt?: string;\n acceptedBy?: string;\n firstAcceptedAt?: string;\n lastActivityAt?: string; // last time we reached out to the customer, regardless of medium\n reviewedAt?: string;\n reviewedBy?: string;\n preparedAt?: string;\n preparedBy?: string;\n lastBidAt?: string;\n lostAt?: string;\n lostBy?: string;\n wonAt?: string;\n lostReason?: OpportunityLostReasonValues;\n deliveredAt?: string;\n deliveredBy?: string;\n deliveredMode?: 'CMR' | 'Action' | 'DeliveryConfirmation';\n saleDeliveryTransportEligibleAt?: string;\n status: OpportunityStatus;\n dealStatus?: VehicleSaleDealStatus;\n logisticStatus?: VehicleSaleLogisticsStatus;\n activeQuoteId?: string;\n amount?: string;\n documents?: Document[];\n leasingContractId?: string;\n internalLeasingContractId?: string;\n accountManagerAssistant?: string;\n requirementsOverride?: {\n [code: string]: { override: true; reason?: string; actionAt: string; actionBy: string };\n };\n};\n\nexport type OpportunityUpdate = {\n vehicleId?: string | null;\n accountManager?: string | null;\n accountManagerAssistant?: string | null;\n administrativePerson?: string | null;\n contactId?: string | null;\n activeQuoteId?: string | null;\n reviewed?: boolean;\n prepared?: boolean;\n lost?: boolean;\n delivered?: boolean;\n lostReason?: OpportunityLostReasonValues;\n documents?: Document[];\n branch?: string;\n branchCountry?: string;\n type?: OpportunityType;\n lastActivityAt?: string | null; // null gives the possibility to delete this field if all activities are deleted\n lastBidAt?: string;\n source?: string | null;\n requirementsOverride?: {\n [code: string]: { override: true; reason?: string; actionAt: string; actionBy: string };\n };\n};\n\nexport type OpportunityPaymentSummary = {\n total: string;\n paid: string;\n entries: DataRecord<OpportunityPayment>[];\n};\n\n/** @deprecated Renamed to {@link OpportunityPaymentSummary}. */\nexport type PaymentSummary = OpportunityPaymentSummary;\n\nexport type VehicleBffMetadata = {\n openOpportunities: number;\n otherRelatedVehicleIds: string[];\n};\n\nexport type OpportunityStatusRequirement = { code: OpportunityRequirementsCode; title?: string };\n\ntype OportunityWarningActionLink = {\n businessEntityId: BusinessEntityIds;\n recordId: string;\n /**\n * Absolute URL, set only when the record lives at another tenant — in-app routing cannot\n * reach it, so the client opens it in a new tab. Same shape the intercompany payments walk\n * already hands the client (ADR-0024's `opportunityUrl`).\n */\n url?: string;\n};\n\ntype OportunityWarningActionData = { [key: string]: string | number };\n\nexport type OpportunityWarning = {\n code: OpportunityWarningsCode;\n level: WarningHints;\n link?: OportunityWarningActionLink;\n data?: OportunityWarningActionData;\n showAction?: boolean;\n};\n\nexport type OpportunityBffMeta = ReferenceData & {\n requirements: OpportunityStatusRequirement[];\n warnings: OpportunityWarning[];\n};\n\nexport type ContactMetdata = {\n openOpportunities: number;\n};\n\nexport type OpportunityBFF = {\n opportunity: DataRecord<Opportunity, OpportunityBffMeta>;\n vehicle?: DataRecord<Vehicle, VehicleBffMetadata>;\n interest?: DataRecord<Interest, InterestBffMeta>;\n bids: DataRecord<Bid>[];\n quotes: DataRecord<Quote>[];\n activeQuote?: DataRecord<Quote>;\n payments: OpportunityPaymentSummary | undefined;\n reservation?: DataRecord<OpportunityReservation>;\n tasks: DataRecord<Task>[];\n customer?: {\n contact: DataRecord<Contact, ContactMetdata>;\n org?: DataRecord<Organization>;\n };\n transport?: Transport;\n};\n\ntype BaseOpportunityEvent = BaseEvent & {\n actionAt: string;\n userId: string;\n tenantId: string;\n};\n\nexport type OpportunityCreateEvent = BaseOpportunityEvent & {\n opportunity: Opportunity;\n previousOpportunity?: undefined;\n action: 'create';\n};\n\nexport type OpportunityUpdateEvent = BaseOpportunityEvent & {\n opportunity: Opportunity;\n previousOpportunity: Opportunity;\n action: 'update';\n};\n\nexport type OpportunityEvent = OpportunityCreateEvent | OpportunityUpdateEvent;\n\nexport type QuoteEvent = {\n quote: Quote;\n opportunity: Opportunity;\n action: 'create' | 'update';\n actionAt: string;\n userId: string;\n tenantId: string;\n};\n\n/* Quote summary with information that should be common to different types of quotes */\nexport type QuoteInfo = {\n status: QuoteStatus;\n roi: string;\n id: string;\n // Leasing-only metrics, denormalized from the active leasing quote so the leasing report\n // can take medians without re-reading each quote. Absent on non-leasing quotes.\n /** Leasing term in months (`calculatorInput.leasing.duration`). */\n durationMonths?: number;\n /** Yearly ROI as a percentage 0–100 (`calculatorOutput.roi.perYear`). */\n roiPerYear?: number;\n /** Advance (deposit) as a percentage 0–100 (`calculatorInput.leasing.depositPercentage`). */\n advancePercentage?: number;\n};\n\nexport type SearchOpportunity = {\n contact?: Contact;\n opportunity: Opportunity;\n org?: Organization;\n vehicle?: Vehicle;\n transport?: Transport;\n quote?: QuoteInfo;\n custom: {\n groupKey: string;\n web2Lead: boolean;\n payment: { status: OpportunityPaymentStatus; percentagePaid: string };\n unassigned: boolean;\n lost: boolean;\n assignees: string[];\n accountManagers: string[];\n vehicleCheckedIn: boolean;\n status: OpportunityStatus | 'won';\n // Denormalized at indexing time from VehiclePurchase.log.checkedInAt so the opp index\n // can answer \"how long has this vehicle been visible on the website\" without joining.\n checkedInAt?: string;\n // Calendar days from min(marketingAt, evaluationAt, purchaseAgreedAt) until validatedAt.\n // Mirrors `daysInVirtualInventory` on the vehicle Business Overview page.\n daysAvailable?: number;\n // Operational supplier for reporting. For SLB clones this is the source vehicle supplier,\n // not the bank supplier on the clone purchase.\n realSupplierId?: string;\n // Branch of the associated vehicle, coalesced from the synced original branch then the\n // local branch — mirrors the vehicle index `custom.originalBranchId` facet.\n originalBranchId?: string;\n };\n};\n\nexport const QUOTE_NEEDS_VALIDATION_NOTIFICATION_ORIGIN = 'quote-validation';\nexport const QUOTE_NOT_CREATED_BY_ACCOUNT_MANAGER = 'quote-not-created-by-account-manager';\nexport const QUOTE_VALIDATOR_FEEDBACK_NOTIFICATION_ORIGIN = 'quote-validation-feedback';\n\nexport const OPPORTUNITY_ASSIGNED_NOTIFICATION_ORIGIN = 'opportunity-assigned';\nexport const OPPORTUNITY_VEHICLE_AVAILABLE_NOTIFICATION_ORIGIN = 'opportunity-vehicle-available';\nexport const OPPORTUNITY_VEHICLE_DELIVERY_NOTIFICATION_ORIGIN = 'opportunity-vehicle-delivery';\nexport const OPPORTUNITY_VEHICLE_RESERVATION_ABOUT_TO_EXPIRE_NOTIFICATION_ORIGIN =\n 'opportunity-vehicle-reservation-to-expire';\nexport const OPPORTUNITY_VEHICLE_RESERVATION_EXPIRED_NOTIFICATION_ORIGIN =\n 'opportunity-vehicle-reservation-expired';\nexport const INTERCOMPANY_OPPORTUNITY_RELEASED_NOTIFICATION_ORIGIN =\n 'intercompany-opportunity-released';\n\nexport const OFFER_SET_FINAL_VALUATION_ORIGIN = 'offer-set-final-valuation';\n\nexport const VEHICLE_PRICE_DECREASES_NOTIFICATION_ORIGIN = 'vehicle-price-decreased';\nexport const VEHICLE_ARRIVED_NOTIFICATION_ORIGIN = 'vehicle-arrived';\nexport const VEHICLE_CHECKEDIN_NOTIFICATION_ORIGIN = 'vehicle-checkedin';\nexport const VEHICLE_FULLY_PAID_NOTIFICATION_ORIGIN = 'vehicle-fully-paid';\nexport const VEHICLE_PURCHASED_NOTIFICATION_ORIGIN = 'vehicle-purchased';\nexport const VEHICLE_PRICE_CHANGED_NOTIFICATION_ORIGIN = 'vehicle-price-changed';\nexport const VEHICLE_SOLD_NOTIFICATION_ORIGIN = 'vehicle-sold';\n\nexport type OpportunityNotificationData = {\n quoteVersion?: number;\n snippet?: string;\n};\n\nexport type LeasingQuoteTemplateData = {\n opportunity: {\n id: string;\n };\n currentDate: string;\n expirationDate: string;\n vehicle: {\n make: string;\n model: string;\n type?: string;\n km: string | number;\n vin: string;\n mainImage: string;\n localLicensePlate: boolean;\n description: string;\n year?: string | number;\n stockNumber?: string;\n };\n accountManager: {\n fullName: string;\n email: string;\n phone: string;\n };\n customer: {\n company: string;\n fullName: string;\n vatNumber?: string;\n address?: string;\n };\n settingId: string;\n leasing: {\n deposit: string;\n totalMonthlyAmount: string;\n totalMonthlyAmountExclVat: string;\n depositExclVat: string;\n startupFee: string;\n startupFeeExclVat: string;\n /** Returnable guarantee deposit; VAT-free, so incl and excl VAT are the same amount. */\n guaranteeDeposit?: string;\n totalExtras: string;\n totalExtrasExclVat: string;\n totalBeforeDeliveryExclVat: string;\n totalBeforeDelivery: string;\n installment: string;\n installmentExclVat: string;\n duration: number;\n monthlyInsurance: string;\n monthlyTax: string;\n monthlyTaxesInsurance: string;\n monthlyTaxesInsuranceExclVat: string;\n residual: string;\n residualExclVat: string;\n offerNumber: string;\n extras: { name: string }[];\n };\n};\n\nexport type LineItemPdfTemplate = {\n description: string;\n vat: string;\n quantity: number;\n unitPriceExclVat: string;\n amount: string;\n amountExclVat: string;\n};\n\nexport type LeasingProformaTemplateData = {\n opportunity: {\n id: string;\n offerNumber: string;\n };\n currentDate: string;\n accountManager: {\n fullName: string;\n email: string;\n phone: string;\n };\n vehicle: {\n line1: string;\n line2: string;\n stockNumber: string;\n };\n c: {\n organizationId?: string;\n clientId: string;\n company: string;\n fullName: string;\n vatNumber?: string;\n email?: string;\n phone?: string;\n address?: string;\n };\n i: LineItemPdfTemplate[];\n t: {\n totalExclVat: string;\n vatAmount: string;\n displayVatMessage: boolean;\n total: string;\n /** Returnable guarantee deposit included in the totals; VAT-free. */\n guaranteeDeposit?: string;\n monthly: string;\n monthlyExclVat: string;\n residual: string;\n residualExclVat: string;\n duration: number;\n };\n};\n\nexport type SalesTemplateData = {\n opportunity: {\n id: string;\n offerNumber: string;\n };\n currentDate: string;\n expirationDate: string;\n notes?: string;\n accountManager: {\n fullName: string;\n email: string;\n phone: string;\n };\n vehicle: {\n line1: string;\n line2: string;\n stockNumber: string;\n mainImage: string;\n make: string;\n model: string;\n type?: string;\n km: string | number;\n vin: string;\n year: string;\n parkingLocation: string;\n };\n c: {\n organizationId?: string;\n clientId: string;\n company: string;\n fullName: string;\n vatNumber?: string;\n email?: string;\n phone?: string;\n address?: string;\n country: string;\n };\n iExtended: LineItemPdfTemplate[];\n i: LineItemPdfTemplate[];\n t: {\n totalExclVat: string;\n vatAmount: string;\n total: string;\n displayVatMessage: boolean;\n totalAlternativeCurrency?: string;\n totalAlternativeCurrencyCode?: string;\n totalAlternativeCurrencyExclVat?: string;\n };\n l?: {\n advance: string;\n residual: string;\n duration: number; // in months\n monthlyAmount: string;\n };\n};\n\nexport type KanbanOpportunityGroup = {\n representative: SearchOpportunity;\n items: SearchOpportunity[];\n};\n\nexport type DeliveryConfirmationTemplateData = {\n supplier: {\n company: string;\n contactPerson: string;\n vatNumber?: string;\n };\n customer: {\n company: string;\n contactPerson: string;\n phone?: string;\n };\n vehicle: {\n makeAndModel: string;\n vin: string;\n licensePlate?: string;\n stockNumber?: string;\n };\n opportunity: {\n id: string;\n };\n currentDate: string;\n};\n\nexport type OpportunitiesKanbanColumn = {\n status: string;\n results: SearchOpportunity[];\n groups?: KanbanOpportunityGroup[];\n totalCount: number;\n totalValue: string;\n};\n\nexport type MSearchOpportunitiesKanbanColumn = {\n column: OpportunitiesKanbanColumn;\n nextToken?: string;\n};\n\ntype HpLeasingDealRunDataBase = {\n bisondeskTenantId: string;\n entityOwner: string;\n opportunityId: string;\n};\n\n// Field ids match the hpaci (Mr Lease CI) leasing-deal process definition: the LD is the only\n// Hyperportal process for that tenant (no C flow) and the contract document lives in BisonDesk.\nexport type HpLeasingDealRunDataCi = HpLeasingDealRunDataBase & {\n client?: string;\n vendeur?: string;\n vehicule?: string;\n plaqueDimmatriculation?: string;\n numeroDeContratLeasing: string;\n prixDeVenteHorsTvaXof: string;\n montantDavanceTtcXof: string;\n depotDeGarantieXof?: string;\n dueeDuLeasingEnMois: number;\n travauxHorsNormesNecessaire: boolean;\n descriptionDesTravauxHorsNormes: string;\n};\n\nexport type HpLeasingDealRequest = {\n tenantId: string;\n initiatedBy: 'bisondesk';\n processMetaId: string;\n processRunData: HpLeasingDealRunDataDefault | HpLeasingDealRunDataCi;\n};\n\nexport type HpLeasingDealRunDataDefault = HpLeasingDealRunDataBase & {\n leasingContractOwner?: string;\n foreseenDeliveryDate?: string;\n deliveryAddressLeasing?: string;\n nameSalesPerson: string;\n durationLeasingInMonths: number;\n vanCourier: boolean;\n newVehicle?: boolean;\n newTrailer?: boolean;\n registrationOnTtcoBe?: boolean;\n externalDelivery?: boolean;\n civilLiabilities?: boolean;\n specialTechnicalInsurance?: boolean;\n allRisks?: boolean;\n roadAssistance?: boolean;\n vabAssistanceVan?: boolean;\n yearOfConstruction?: number;\n chassisnumber?: string;\n vehicleModel?: string;\n vehicleCategory2?: string;\n licencePlate?: string;\n vatPercentage?: number;\n\n opportunityContractId: string;\n\n company?: string;\n customerNumber?: number; //bisondesk external id\n slbPartner?: string;\n //MrLease fields\n vehicle?: string;\n vehicleNewReferenceMl?: string;\n referencePurchaserTtcoKleyn?: string;\n salesPriceEur: string;\n depositFullAmountExclVat: string;\n depositToBePrepaidExclVat: string;\n vehicleMake3?: string;\n\n //TTC fields\n vehicleOriginalReference?: string;\n salesPrice: string;\n depositFullAmount: string;\n depositAmountToBePrepaid: string;\n make?: string;\n\n //Extras\n garageExtrasCodes: string[];\n allExtrasDescriptions: string[];\n administrationExtrasCodes: string[];\n logisticExtrasCodes: string[];\n customRequestDescriptions: string[];\n};\n\nexport type HpLeasingDealResponse = {\n entityId: string;\n id: string;\n status: string;\n leasingContractNumber?: string;\n};\n\nexport type HpLeasingContractRequest = {\n tenantId: string;\n initiatedBy: 'bisondesk';\n processMetaId: string;\n processRunData: {\n bisondeskTenantId: string;\n entityOwner: string;\n leasingContractOwner?: string;\n totalLeasingAmount: string;\n company?: string;\n vehicle?: string;\n ldNumber: number;\n vanCourier: boolean;\n startDate: number;\n opportunityContractId: string;\n data: {\n leasingParameter: {\n allRisksPercentage: number;\n allRisksTaxPercentage: number;\n civilLiability: number;\n entityId: string;\n oneTimeRoadTax: number;\n specialInsurance: number;\n yearlyRoadTax: number;\n countries: string[];\n vehicleCategory: string;\n };\n\n calculatorRequest: {\n bankDeposit: number;\n bankDurationInMonths: number;\n bankInterestRatePercentage: number;\n bankResidualValue: number;\n deposit: number;\n durationInMonths: number;\n includesAllRisks: boolean;\n includesCivilLiability: boolean;\n includesOneTimeRoadTax: boolean;\n includesSpecialInsurance: boolean;\n includesYearlyRoadTax: boolean;\n insuranceAmount: number;\n interestRatePercentage: number;\n marginPercentage: number;\n monthlyAdministrationFee: 0;\n purchasePrice: number;\n residualValue: number;\n salesPrice: number;\n startupFeePercentage: number;\n };\n\n calculatorResponse: {\n ROI: number;\n ROIDifference: number;\n ROIPerYear: number;\n ROITarget: number;\n allRisksInsuranceAmount: number;\n bankContractValue: number;\n bankLeasingAmount: number;\n cashDeficit: number;\n financingAmount: number;\n leasingAmount: number;\n leasingContractValue: number;\n leasingProfit: number;\n monthlyTaxRetailPrice: number;\n oneTimeTaxCost: number;\n totalMonthlyPayment: number;\n totalProfit: number;\n vehicleProfit: number;\n };\n\n cashInValues: CashInRow[];\n\n cashOutValues: CashOutRow[];\n };\n };\n};\n\nexport type HpLeasingContractResponse = {\n entityId: string;\n id: string;\n status: string;\n createdAt: string;\n updatedAt: string;\n dateOfFinalSettlement: string;\n startDate: string;\n email: string;\n contractNumber: string;\n};\n\nexport type HpLeasingDealReturnRequest = {\n tenantId: string;\n initiatedBy: 'bisondesk';\n processMetaId: string;\n processRunData: {\n bisondeskTenantId: string;\n entityOwner: string;\n leasingContractNumber2: string;\n leasingContractNumber: string;\n opportunityContractId: string;\n company: string;\n vehicle: string;\n };\n};\n\nexport type HpLeasingDealEndRequest = {\n tenantId: string;\n initiatedBy: 'bisondesk';\n processMetaId: string;\n processRunData: {\n bisondeskTenantId: string;\n entityOwner: string;\n leasingContractOwner: string;\n vehicleOldReference: string;\n leasingContractNumber: string;\n company: string;\n vehicleNewReference: string;\n };\n};\n\nexport type CashInRow = {\n time: number;\n deposit: number;\n monthlyAdministrationFee: 0; //Legacy field - Should always be 0\n residualValue: number;\n startupFee: number;\n leasingAmountWithoutAdminFee: number;\n insurancePayment: number;\n taxPayment: number;\n cashIn: number;\n cumulativeCash: number;\n};\n\nexport type CashOutRow = {\n time: number;\n deposit: number;\n residualValue: number;\n leasingAmount: number;\n insurancePayment: number;\n taxPayment: number;\n cashOut: number;\n cumulativeCash: number;\n};\n\nexport type HpDeliveryFields = {\n detailsOfStacking?: string | null;\n technicalControlNeeded: boolean | null;\n\n //PickUP Delivery\n urgentDelivery?: boolean | null;\n dateOfPickUpByCustomer?: number | null;\n modeOfTransportPickUpByCustomer?: string | null; //entity Id\n detailsOfBorderCrossing?: string | null;\n insuranceNeeded: boolean | null;\n transitPlateNeeded: boolean | null;\n licensePlateNeeded: boolean | null;\n\n //Address Delivery\n address?: string | null;\n kmToAddressOfDelivery?: number | null;\n\n //To Port Delivery\n originPortText?: string | null; //entity Id\n shippingCompany?: string | null; //string Id\n destinationPort?: string | null;\n cleaningDegassingNeeded: boolean | null;\n};\n\nexport type HpIsaProcessRequest = {\n tenantId: string;\n initiatedBy: 'bisondesk';\n processMetaId: string;\n processRunData: HpDeliveryFields & {\n entityOwner: string;\n nameSalesPerson: string;\n\n company?: string; //entityId\n proofOfSaleCustomerAgreement?: string; //entityId\n\n vehicle?: string; //entityId\n bodywork?: string; //entityId\n vehicleCategory: string; //entityId\n\n amountOfCommissionPaid: number;\n opportunityId: string;\n deliveryType: string; //entity Id\n directDelivery?: boolean | null;\n directDeliveryReason?: string | null;\n agreedPrice?: string;\n\n //Extras\n garageExtrasCodes: string[];\n logisticsExtrasCodes: string[];\n administrationExtrasCodes: string[];\n allExtrasDescriptions: string[];\n customRequestDescriptions: string[];\n infoSpoiler: string; // entity Id\n };\n};\n\nexport type HpIsaProcessResponse = {\n entityId: string;\n id: string;\n status: string;\n};\n\nexport type HpWorkOrderProcessRequest = {\n tenantId: string;\n initiatedBy: 'bisondesk';\n processMetaId: string;\n processRunData: {\n entityOwner: string;\n\n opportunityId: string;\n\n //Extras\n garageExtrasCodes: string[];\n allExtrasDescriptions: string[];\n\n customerRequestDescriptions: string[];\n directDeliveryReason?: string | null;\n salesPerson: string; // entityId\n customerName: string;\n referenceNumber: string;\n make?: string; //entityId\n typeTrailer?: string; //entityId\n\n vinNumber?: string;\n foreseenArrivalDateTrailer?: string;\n deadlineRequest?: number;\n locationVehicle2?: string; //entityId\n customer: string; //entityId\n vehicle: string; //entityId\n trailerHasBeenCheckedIn: boolean;\n deliveryDetails?: string | null;\n technicalInspectionNeeded: boolean | null;\n adr: boolean | null;\n };\n};\n\nexport type HpWorkOrderProcessResponse = {\n entityId: string;\n id: string;\n status: string;\n};\n\nexport type SwitchOpportunityVehicleRequest = {\n opportunity: Opportunity;\n newVehicleId: string;\n};\n\nexport type KanbanOpportunitiesSearchRequest = BaseSearchRequest & {\n nextTokens?: Record<string, string | undefined>;\n groupByClient?: boolean;\n};\n\nexport type KanbanOpportunitiesNextList = Omit<\n NextList<OpportunitiesKanbanColumn, ReferenceData>,\n 'nextToken'\n> & {\n nextTokens?: Record<string, string | undefined>;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"opportunities.js","sourceRoot":"/","sources":["types/opportunities.ts"],"names":[],"mappings":"AA4BA,MAAM,CAAN,IAAY,kBAsBX;AAtBD,WAAY,kBAAkB;IAC5B,iDAA2B,CAAA;IAC3B,mDAA6B,CAAA;IAC7B,mCAAa,CAAA;IACb,uCAAiB,CAAA;IACjB,6DAAuC,CAAA;IACvC,+DAAyC,CAAA;IACzC,uDAAiC,CAAA;IACjC,yDAAmC,CAAA;IACnC,mDAA6B,CAAA;IAC7B,qDAA+B,CAAA;IAC/B,mDAA6B,CAAA;IAC7B,mDAA6B,CAAA;IAC7B,iDAA2B,CAAA;IAC3B,mDAA6B,CAAA;IAC7B,iDAA2B,CAAA;IAC3B,uDAAiC,CAAA;IACjC,yDAAmC,CAAA;IACnC,mEAA6C,CAAA;IAC7C,wDAAkC,CAAA;IAClC,qDAA+B,CAAA;IAC/B,iFAA2D,CAAA;AAC7D,CAAC,EAtBW,kBAAkB,KAAlB,kBAAkB,QAsB7B;AAED,MAAM,CAAN,IAAY,wBAIX;AAJD,WAAY,wBAAwB;IAClC,+DAAmC,CAAA;IACnC,yDAA6B,CAAA;IAC7B,qDAAyB,CAAA;AAC3B,CAAC,EAJW,wBAAwB,KAAxB,wBAAwB,QAInC;AAED,MAAM,CAAN,IAAY,iBAOX;AAPD,WAAY,iBAAiB;IAC3B,gDAA2B,CAAA;IAC3B,4CAAuB,CAAA;IACvB,8CAAyB,CAAA;IACzB,sCAAiB,CAAA;IACjB,gDAA2B,CAAA;IAC3B,0CAAqB,CAAA;AACvB,CAAC,EAPW,iBAAiB,KAAjB,iBAAiB,QAO5B;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAwB;IACzD,iBAAiB,CAAC,WAAW;IAC7B,iBAAiB,CAAC,SAAS;IAC3B,iBAAiB,CAAC,UAAU;IAC5B,iBAAiB,CAAC,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nimport { Document, NextList } from '@bisondesk/commons-sdk/types';\nimport { BusinessEntityIds, OpportunityType, WarningHints } from '../constants.js';\nimport { Contact, Organization } from './crm.js';\nimport type { Interest, InterestBffMeta } from './interests.js';\nimport { BaseEvent } from './internal-events.js';\nimport { OpportunityPayment } from './opportunity-payments.js';\nimport { Quote, QuoteStatus } from './quotes.js';\nimport { OpportunityReservation } from './reservations.js';\nimport { BaseSearchRequest } from './search.js';\nimport { Transport } from './transports.js';\nimport { DataRecord, ReferenceData } from './utils.js';\nimport { Vehicle } from './vehicles.js';\n\nexport type ListOpportunitiesFilters = {\n offset?: number;\n limit?: number;\n organizationId?: string;\n contactId?: string;\n vehicleId?: string;\n vehicleIds?: string[];\n excludeOpportunityId?: string;\n excludeLost?: boolean;\n statuses?: OpportunityStatus[];\n since?: string;\n until?: string;\n};\n\nexport enum OpportunityActions {\n ADD_REMARKS = 'add_remarks',\n CREATE_QUOTE = 'create_quote',\n LOSE = 'lose',\n REOPEN = 'reopen',\n START_PREPARATION = 'start_preparation',\n REVERT_PREPARATION = 'revert_preparation',\n START_DELIVERY = 'start_delivery',\n REVERT_DELIVERY = 'revert_delivery',\n SET_CUSTOMER = 'set_customer',\n SET_DOCUMENTS = 'set_documents',\n SET_INTEREST = 'set_interest',\n SET_METADATA = 'set_metadata',\n SET_VEHICLE = 'set_vehicle',\n ADD_ACTIVITY = 'add_activity',\n ADD_PAYMENT = 'add_payment',\n SWITCH_VEHICLE = 'switch_vehicle',\n DELIVER_VEHICLE = 'deliver_vehicle',\n UNDO_DELIVER_VEHICLE = 'undo_deliver_vehicle',\n SET_DEAL_INFO = 'update_deal_info',\n ISSUE_INVOICE = 'issue_invoice',\n CREATE_MANUAL_SALES_INVOICE = 'create_manual_sales_invoice',\n}\n\nexport enum OpportunityPaymentStatus {\n PARTIAL_PAYMENT = 'partial_payment',\n FULL_PAYMENT = 'full_payment',\n NO_PAYMENT = 'no_payment',\n}\n\nexport enum OpportunityStatus {\n PROSPECTION = 'prospection',\n DISCOVERY = 'discovery',\n EVALUATION = 'evaluation',\n REVIEW = 'review',\n PREPARATION = 'preparation',\n DELIVERY = 'delivery',\n}\n\nexport const OpportunityStatusOrder: OpportunityStatus[] = [\n OpportunityStatus.PROSPECTION,\n OpportunityStatus.DISCOVERY,\n OpportunityStatus.EVALUATION,\n OpportunityStatus.REVIEW,\n OpportunityStatus.PREPARATION,\n OpportunityStatus.DELIVERY,\n];\n\nexport enum OpportunityRequirementsCode {\n VEHICLE_AT_ORIGIN = 'vehicle_at_origin',\n LEASING_SL_ACTION = 'sl_action',\n TECHNICAL_NOTES_CHANGED = 'technical_notes_changed',\n}\n\nexport enum OpportunityWarningsCode {\n QUOTE_PENDING_VALIDATION = 'quote_pending_validation',\n QUOTE_PEDING_MANAGER_APPROVAL = 'quote_pending_manager_approval',\n CONCURRENT_OPPORTUNITIES = 'concurrent_opportunities',\n VEHICLE_RESERVED = 'vehicle_reserved',\n OPPORTUNITY_NEEDS_SWITCH_VEHICLE = 'opportunity_needs_switch_vehicle',\n VEHICLE_RESERVED_DATE_INFO = 'vehicle_reserved_date_info',\n VEHICLE_RESERVED_INDEFINITELY = 'vehicle_reserved_indefinitely',\n QUOTE_MISSING_DELIVERY_DETAILS = 'quote_missing_delivery_details',\n VEHICLE_TECHNICAL_DETAILS_CHANGED = 'vehicle_technical_details_changed',\n QUOTE_MISSING_FINANCING_DETAILS = 'quote_missing_financing_details',\n VEHICLE_BRANCH_MISMATCH = 'vehicle_branch_mismatch',\n VEHICLE_UNAVAILABLE_AT_SOURCE = 'vehicle_unavailable_at_source',\n INTERCOMPANY_LINKED = 'intercompany_linked',\n INTERCOMPANY_SOURCE_OPPORTUNITY = 'intercompany_source_opportunity',\n INTERCOMPANY_SOURCE_UNRESERVED = 'intercompany_source_unreserved',\n}\n\nexport const OpportunityWonColumnId = 'closed_won';\n\nexport const OpportunityKanbanColumns = [...OpportunityStatusOrder, OpportunityWonColumnId];\n\nexport const OpportunityKanbanEndColumns: string[] = [OpportunityWonColumnId];\n\nexport enum OpportunityLostReasonValues {\n Expensive = 'expensive',\n AlreadySold = 'already_sold',\n BadExperience = 'bad_experience',\n IncorrectVehicleCondition = 'incorrect_vehicle_condition',\n NoStock = 'not_enough_stock',\n SlowDelivery = 'slow_delivery',\n HighDeposit = 'deposit_too_high',\n NoAnswer = 'client_not_answered',\n Automatic = 'automatic',\n LeasingDeal = 'sold-via-leasing',\n InvestmentPostponed = 'investment_postponed',\n /** The target-tenant deal released the vehicle (lost, or its reservation expired). */\n IntercompanyReleased = 'intercompany_released',\n}\n\ntype BaseBid = {\n vehicleId: string;\n opportunityId?: string;\n contactId: string;\n amount: string;\n};\n\nexport type NewBid = BaseBid & {};\n\nexport type Bid = BaseBid & {\n id: string;\n createdAt: string;\n createdBy: string;\n};\n\n/**\n * Provenance of a customer deal whose vehicle is fulfilled by a source-tenant intercompany\n * opportunity. Written only by the intercompany coordination\n * (cross-tenant-sync/ico-opportunities);\n * the link table at the source is its mirror. Powers deep links, the payments walk and\n * support digging — never availability decisions.\n */\nexport type OpportunityIntercompanyInfo = {\n sourceTenantId: string;\n sourceBranchId: string;\n sourceOpportunityId: string;\n sourceReservationId: string;\n};\n\ntype BaseOpportunity = {\n accountManager?: string;\n administrativePerson?: string;\n type: OpportunityType;\n organizationId?: string;\n contactId?: string;\n vehicleId?: string;\n source?: string; // e.g. website, autoscout, mobile...\n branch: string;\n inquiry?: string;\n branchCountry: string;\n intercompany?: OpportunityIntercompanyInfo;\n};\n\n// type, branch and branchCountry are optional: when omitted, the server defaults them\n// from the requester's preferred branches/opportunity types, then the tenant defaults.\nexport type NewOpportunity = Omit<BaseOpportunity, 'type' | 'branch' | 'branchCountry'> &\n Partial<Pick<BaseOpportunity, 'type' | 'branch' | 'branchCountry'>> & {\n id?: undefined;\n createdAt?: undefined;\n createdBy?: undefined;\n modifiedAt?: undefined;\n modifiedBy?: undefined;\n };\n\nexport enum VehicleSaleDealStatus {\n SaleAgreed = 'SALE_AGREED',\n FirstPaymentReceived = 'FIRST_PAYMENT_RECEIVED',\n FullPaymentReceived = 'FULL_PAYMENT_RECEIVED',\n}\n\nexport enum VehicleSaleLogisticsStatus {\n AtOrigin = 'AT_ORIGIN',\n Delivered = 'DELIVERED',\n}\n\nexport type Opportunity = BaseOpportunity & {\n id: string;\n createdAt: string;\n createdBy: string;\n modifiedAt: string;\n modifiedBy: string;\n engagedAt?: string;\n engagedBy?: string;\n validatedAt?: string;\n validatedBy?: string;\n acceptedAt?: string;\n acceptedBy?: string;\n firstAcceptedAt?: string;\n lastActivityAt?: string; // last time we reached out to the customer, regardless of medium\n reviewedAt?: string;\n reviewedBy?: string;\n preparedAt?: string;\n preparedBy?: string;\n lastBidAt?: string;\n lostAt?: string;\n lostBy?: string;\n wonAt?: string;\n lostReason?: OpportunityLostReasonValues;\n deliveredAt?: string;\n deliveredBy?: string;\n deliveredMode?: 'CMR' | 'Action' | 'DeliveryConfirmation';\n saleDeliveryTransportEligibleAt?: string;\n status: OpportunityStatus;\n dealStatus?: VehicleSaleDealStatus;\n logisticStatus?: VehicleSaleLogisticsStatus;\n activeQuoteId?: string;\n amount?: string;\n documents?: Document[];\n leasingContractId?: string;\n internalLeasingContractId?: string;\n accountManagerAssistant?: string;\n requirementsOverride?: {\n [code: string]: { override: true; reason?: string; actionAt: string; actionBy: string };\n };\n};\n\nexport type OpportunityUpdate = {\n vehicleId?: string | null;\n accountManager?: string | null;\n accountManagerAssistant?: string | null;\n administrativePerson?: string | null;\n contactId?: string | null;\n activeQuoteId?: string | null;\n reviewed?: boolean;\n prepared?: boolean;\n lost?: boolean;\n delivered?: boolean;\n lostReason?: OpportunityLostReasonValues;\n documents?: Document[];\n branch?: string;\n branchCountry?: string;\n type?: OpportunityType;\n lastActivityAt?: string | null; // null gives the possibility to delete this field if all activities are deleted\n lastBidAt?: string;\n source?: string | null;\n requirementsOverride?: {\n [code: string]: { override: true; reason?: string; actionAt: string; actionBy: string };\n };\n};\n\nexport type OpportunityPaymentSummary = {\n total: string;\n paid: string;\n entries: DataRecord<OpportunityPayment>[];\n};\n\n/** @deprecated Renamed to {@link OpportunityPaymentSummary}. */\nexport type PaymentSummary = OpportunityPaymentSummary;\n\nexport type VehicleBffMetadata = {\n openOpportunities: number;\n otherRelatedVehicleIds: string[];\n};\n\nexport type OpportunityStatusRequirement = { code: OpportunityRequirementsCode; title?: string };\n\ntype OportunityWarningActionLink = {\n businessEntityId: BusinessEntityIds;\n recordId: string;\n /**\n * Absolute URL, set only when the record lives at another tenant — in-app routing cannot\n * reach it, so the client opens it in a new tab. Same shape the intercompany payments walk\n * already hands the client (ADR-0024's `opportunityUrl`).\n */\n url?: string;\n};\n\ntype OportunityWarningActionData = { [key: string]: string | number };\n\nexport type OpportunityWarning = {\n code: OpportunityWarningsCode;\n level: WarningHints;\n link?: OportunityWarningActionLink;\n data?: OportunityWarningActionData;\n showAction?: boolean;\n};\n\nexport type OpportunityBffMeta = ReferenceData & {\n requirements: OpportunityStatusRequirement[];\n warnings: OpportunityWarning[];\n};\n\nexport type ContactMetdata = {\n openOpportunities: number;\n};\n\nexport type OpportunityBFF = {\n opportunity: DataRecord<Opportunity, OpportunityBffMeta>;\n vehicle?: DataRecord<Vehicle, VehicleBffMetadata>;\n interest?: DataRecord<Interest, InterestBffMeta>;\n bids: DataRecord<Bid>[];\n quotes: DataRecord<Quote>[];\n activeQuote?: DataRecord<Quote>;\n payments: OpportunityPaymentSummary | undefined;\n reservation?: DataRecord<OpportunityReservation>;\n tasks: DataRecord<Task>[];\n customer?: {\n contact: DataRecord<Contact, ContactMetdata>;\n org?: DataRecord<Organization>;\n };\n transport?: Transport;\n};\n\ntype BaseOpportunityEvent = BaseEvent & {\n actionAt: string;\n userId: string;\n tenantId: string;\n};\n\nexport type OpportunityCreateEvent = BaseOpportunityEvent & {\n opportunity: Opportunity;\n previousOpportunity?: undefined;\n action: 'create';\n};\n\nexport type OpportunityUpdateEvent = BaseOpportunityEvent & {\n opportunity: Opportunity;\n previousOpportunity: Opportunity;\n action: 'update';\n};\n\nexport type OpportunityEvent = OpportunityCreateEvent | OpportunityUpdateEvent;\n\nexport type QuoteEvent = {\n quote: Quote;\n opportunity: Opportunity;\n action: 'create' | 'update';\n actionAt: string;\n userId: string;\n tenantId: string;\n};\n\n/* Quote summary with information that should be common to different types of quotes */\nexport type QuoteInfo = {\n status: QuoteStatus;\n roi: string;\n id: string;\n // Leasing-only metrics, denormalized from the active leasing quote so the leasing report\n // can take medians without re-reading each quote. Absent on non-leasing quotes.\n /** Leasing term in months (`calculatorInput.leasing.duration`). */\n durationMonths?: number;\n /** Yearly ROI as a percentage 0–100 (`calculatorOutput.roi.perYear`). */\n roiPerYear?: number;\n /** Advance (deposit) as a percentage 0–100 (`calculatorInput.leasing.depositPercentage`). */\n advancePercentage?: number;\n};\n\nexport type SearchOpportunity = {\n contact?: Contact;\n opportunity: Opportunity;\n org?: Organization;\n vehicle?: Vehicle;\n transport?: Transport;\n quote?: QuoteInfo;\n custom: {\n groupKey: string;\n web2Lead: boolean;\n payment: { status: OpportunityPaymentStatus; percentagePaid: string };\n unassigned: boolean;\n lost: boolean;\n assignees: string[];\n accountManagers: string[];\n vehicleCheckedIn: boolean;\n status: OpportunityStatus | 'won';\n // Denormalized at indexing time from VehiclePurchase.log.checkedInAt so the opp index\n // can answer \"how long has this vehicle been visible on the website\" without joining.\n checkedInAt?: string;\n // Calendar days from min(marketingAt, evaluationAt, purchaseAgreedAt) until validatedAt.\n // Mirrors `daysInVirtualInventory` on the vehicle Business Overview page.\n daysAvailable?: number;\n // Operational supplier for reporting. For SLB clones this is the source vehicle supplier,\n // not the bank supplier on the clone purchase.\n realSupplierId?: string;\n // Branch of the associated vehicle, coalesced from the synced original branch then the\n // local branch — mirrors the vehicle index `custom.originalBranchId` facet.\n originalBranchId?: string;\n };\n};\n\nexport const QUOTE_NEEDS_VALIDATION_NOTIFICATION_ORIGIN = 'quote-validation';\nexport const QUOTE_NOT_CREATED_BY_ACCOUNT_MANAGER = 'quote-not-created-by-account-manager';\nexport const QUOTE_VALIDATOR_FEEDBACK_NOTIFICATION_ORIGIN = 'quote-validation-feedback';\n\nexport const OPPORTUNITY_ASSIGNED_NOTIFICATION_ORIGIN = 'opportunity-assigned';\nexport const OPPORTUNITY_VEHICLE_AVAILABLE_NOTIFICATION_ORIGIN = 'opportunity-vehicle-available';\nexport const OPPORTUNITY_VEHICLE_DELIVERY_NOTIFICATION_ORIGIN = 'opportunity-vehicle-delivery';\nexport const OPPORTUNITY_VEHICLE_RESERVATION_ABOUT_TO_EXPIRE_NOTIFICATION_ORIGIN =\n 'opportunity-vehicle-reservation-to-expire';\nexport const OPPORTUNITY_VEHICLE_RESERVATION_EXPIRED_NOTIFICATION_ORIGIN =\n 'opportunity-vehicle-reservation-expired';\nexport const INTERCOMPANY_OPPORTUNITY_RELEASED_NOTIFICATION_ORIGIN =\n 'intercompany-opportunity-released';\n\nexport const OFFER_SET_FINAL_VALUATION_ORIGIN = 'offer-set-final-valuation';\n\nexport const VEHICLE_PRICE_DECREASES_NOTIFICATION_ORIGIN = 'vehicle-price-decreased';\nexport const VEHICLE_ARRIVED_NOTIFICATION_ORIGIN = 'vehicle-arrived';\nexport const VEHICLE_CHECKEDIN_NOTIFICATION_ORIGIN = 'vehicle-checkedin';\nexport const VEHICLE_FULLY_PAID_NOTIFICATION_ORIGIN = 'vehicle-fully-paid';\nexport const VEHICLE_PURCHASED_NOTIFICATION_ORIGIN = 'vehicle-purchased';\nexport const VEHICLE_PRICE_CHANGED_NOTIFICATION_ORIGIN = 'vehicle-price-changed';\nexport const VEHICLE_SOLD_NOTIFICATION_ORIGIN = 'vehicle-sold';\n\nexport type OpportunityNotificationData = {\n quoteVersion?: number;\n snippet?: string;\n};\n\nexport type LeasingQuoteTemplateData = {\n opportunity: {\n id: string;\n };\n currentDate: string;\n expirationDate: string;\n vehicle: {\n make: string;\n model: string;\n type?: string;\n km: string | number;\n vin: string;\n mainImage: string;\n localLicensePlate: boolean;\n description: string;\n year?: string | number;\n stockNumber?: string;\n };\n accountManager: {\n fullName: string;\n email: string;\n phone: string;\n };\n customer: {\n company: string;\n fullName: string;\n vatNumber?: string;\n address?: string;\n };\n settingId: string;\n leasing: {\n deposit: string;\n totalMonthlyAmount: string;\n totalMonthlyAmountExclVat: string;\n depositExclVat: string;\n startupFee: string;\n startupFeeExclVat: string;\n /** Returnable guarantee deposit; VAT-free, so incl and excl VAT are the same amount. */\n guaranteeDeposit?: string;\n totalExtras: string;\n totalExtrasExclVat: string;\n totalBeforeDeliveryExclVat: string;\n totalBeforeDelivery: string;\n installment: string;\n installmentExclVat: string;\n duration: number;\n monthlyInsurance: string;\n monthlyTax: string;\n monthlyTaxesInsurance: string;\n monthlyTaxesInsuranceExclVat: string;\n residual: string;\n residualExclVat: string;\n offerNumber: string;\n extras: { name: string }[];\n };\n};\n\nexport type LineItemPdfTemplate = {\n description: string;\n vat: string;\n quantity: number;\n unitPriceExclVat: string;\n amount: string;\n amountExclVat: string;\n};\n\nexport type LeasingProformaTemplateData = {\n opportunity: {\n id: string;\n offerNumber: string;\n };\n currentDate: string;\n accountManager: {\n fullName: string;\n email: string;\n phone: string;\n };\n vehicle: {\n line1: string;\n line2: string;\n stockNumber: string;\n };\n c: {\n organizationId?: string;\n clientId: string;\n company: string;\n fullName: string;\n vatNumber?: string;\n email?: string;\n phone?: string;\n address?: string;\n };\n i: LineItemPdfTemplate[];\n t: {\n totalExclVat: string;\n vatAmount: string;\n displayVatMessage: boolean;\n total: string;\n /** Returnable guarantee deposit included in the totals; VAT-free. */\n guaranteeDeposit?: string;\n monthly: string;\n monthlyExclVat: string;\n residual: string;\n residualExclVat: string;\n duration: number;\n };\n};\n\nexport type SalesTemplateData = {\n opportunity: {\n id: string;\n offerNumber: string;\n };\n currentDate: string;\n expirationDate: string;\n notes?: string;\n accountManager: {\n fullName: string;\n email: string;\n phone: string;\n };\n vehicle: {\n line1: string;\n line2: string;\n stockNumber: string;\n mainImage: string;\n make: string;\n model: string;\n type?: string;\n km: string | number;\n vin: string;\n year: string;\n parkingLocation: string;\n };\n c: {\n organizationId?: string;\n clientId: string;\n company: string;\n fullName: string;\n vatNumber?: string;\n email?: string;\n phone?: string;\n address?: string;\n country: string;\n };\n iExtended: LineItemPdfTemplate[];\n i: LineItemPdfTemplate[];\n t: {\n totalExclVat: string;\n vatAmount: string;\n total: string;\n displayVatMessage: boolean;\n totalAlternativeCurrency?: string;\n totalAlternativeCurrencyCode?: string;\n totalAlternativeCurrencyExclVat?: string;\n };\n l?: {\n advance: string;\n residual: string;\n duration: number; // in months\n monthlyAmount: string;\n };\n};\n\nexport type KanbanOpportunityGroup = {\n representative: SearchOpportunity;\n items: SearchOpportunity[];\n};\n\nexport type DeliveryConfirmationTemplateData = {\n supplier: {\n company: string;\n contactPerson: string;\n vatNumber?: string;\n };\n customer: {\n company: string;\n contactPerson: string;\n phone?: string;\n };\n vehicle: {\n makeAndModel: string;\n vin: string;\n licensePlate?: string;\n stockNumber?: string;\n };\n opportunity: {\n id: string;\n };\n currentDate: string;\n};\n\nexport type OpportunitiesKanbanColumn = {\n status: string;\n results: SearchOpportunity[];\n groups?: KanbanOpportunityGroup[];\n totalCount: number;\n totalValue: string;\n};\n\nexport type MSearchOpportunitiesKanbanColumn = {\n column: OpportunitiesKanbanColumn;\n nextToken?: string;\n};\n\ntype HpLeasingDealRunDataBase = {\n bisondeskTenantId: string;\n entityOwner: string;\n opportunityId: string;\n};\n\n// Field ids match the hpaci (Mr Lease CI) leasing-deal process definition: the LD is the only\n// Hyperportal process for that tenant (no C flow) and the contract document lives in BisonDesk.\nexport type HpLeasingDealRunDataCi = HpLeasingDealRunDataBase & {\n client?: string;\n vendeur?: string;\n vehicule?: string;\n plaqueDimmatriculation?: string;\n numeroDeContratLeasing: string;\n dateDeDebutDuContrat?: number;\n prixDeVenteHorsTvaXof: string;\n montantDavanceTtcXof: string;\n depotDeGarantieXof?: string;\n dueeDuLeasingEnMois: number;\n travauxHorsNormesNecessaire: boolean;\n descriptionDesTravauxHorsNormes: string;\n};\n\nexport type HpLeasingDealRequest = {\n tenantId: string;\n initiatedBy: 'bisondesk';\n processMetaId: string;\n processRunData: HpLeasingDealRunDataDefault | HpLeasingDealRunDataCi;\n};\n\nexport type HpLeasingDealRunDataDefault = HpLeasingDealRunDataBase & {\n leasingContractOwner?: string;\n foreseenDeliveryDate?: string;\n deliveryAddressLeasing?: string;\n nameSalesPerson: string;\n durationLeasingInMonths: number;\n vanCourier: boolean;\n newVehicle?: boolean;\n newTrailer?: boolean;\n registrationOnTtcoBe?: boolean;\n externalDelivery?: boolean;\n civilLiabilities?: boolean;\n specialTechnicalInsurance?: boolean;\n allRisks?: boolean;\n roadAssistance?: boolean;\n vabAssistanceVan?: boolean;\n yearOfConstruction?: number;\n chassisnumber?: string;\n vehicleModel?: string;\n vehicleCategory2?: string;\n licencePlate?: string;\n vatPercentage?: number;\n\n opportunityContractId: string;\n\n company?: string;\n customerNumber?: number; //bisondesk external id\n slbPartner?: string;\n //MrLease fields\n vehicle?: string;\n vehicleNewReferenceMl?: string;\n referencePurchaserTtcoKleyn?: string;\n salesPriceEur: string;\n depositFullAmountExclVat: string;\n depositToBePrepaidExclVat: string;\n vehicleMake3?: string;\n\n //TTC fields\n vehicleOriginalReference?: string;\n salesPrice: string;\n depositFullAmount: string;\n depositAmountToBePrepaid: string;\n make?: string;\n\n //Extras\n garageExtrasCodes: string[];\n allExtrasDescriptions: string[];\n administrationExtrasCodes: string[];\n logisticExtrasCodes: string[];\n customRequestDescriptions: string[];\n};\n\nexport type HpLeasingDealResponse = {\n entityId: string;\n id: string;\n status: string;\n leasingContractNumber?: string;\n};\n\nexport type HpLeasingContractRequest = {\n tenantId: string;\n initiatedBy: 'bisondesk';\n processMetaId: string;\n processRunData: {\n bisondeskTenantId: string;\n entityOwner: string;\n leasingContractOwner?: string;\n totalLeasingAmount: string;\n company?: string;\n vehicle?: string;\n ldNumber: number;\n vanCourier: boolean;\n startDate: number;\n opportunityContractId: string;\n data: {\n leasingParameter: {\n allRisksPercentage: number;\n allRisksTaxPercentage: number;\n civilLiability: number;\n entityId: string;\n oneTimeRoadTax: number;\n specialInsurance: number;\n yearlyRoadTax: number;\n countries: string[];\n vehicleCategory: string;\n };\n\n calculatorRequest: {\n bankDeposit: number;\n bankDurationInMonths: number;\n bankInterestRatePercentage: number;\n bankResidualValue: number;\n deposit: number;\n durationInMonths: number;\n includesAllRisks: boolean;\n includesCivilLiability: boolean;\n includesOneTimeRoadTax: boolean;\n includesSpecialInsurance: boolean;\n includesYearlyRoadTax: boolean;\n insuranceAmount: number;\n interestRatePercentage: number;\n marginPercentage: number;\n monthlyAdministrationFee: 0;\n purchasePrice: number;\n residualValue: number;\n salesPrice: number;\n startupFeePercentage: number;\n };\n\n calculatorResponse: {\n ROI: number;\n ROIDifference: number;\n ROIPerYear: number;\n ROITarget: number;\n allRisksInsuranceAmount: number;\n bankContractValue: number;\n bankLeasingAmount: number;\n cashDeficit: number;\n financingAmount: number;\n leasingAmount: number;\n leasingContractValue: number;\n leasingProfit: number;\n monthlyTaxRetailPrice: number;\n oneTimeTaxCost: number;\n totalMonthlyPayment: number;\n totalProfit: number;\n vehicleProfit: number;\n };\n\n cashInValues: CashInRow[];\n\n cashOutValues: CashOutRow[];\n };\n };\n};\n\nexport type HpLeasingContractResponse = {\n entityId: string;\n id: string;\n status: string;\n createdAt: string;\n updatedAt: string;\n dateOfFinalSettlement: string;\n startDate: string;\n email: string;\n contractNumber: string;\n};\n\nexport type HpLeasingDealReturnRequest = {\n tenantId: string;\n initiatedBy: 'bisondesk';\n processMetaId: string;\n processRunData: {\n bisondeskTenantId: string;\n entityOwner: string;\n leasingContractNumber2: string;\n leasingContractNumber: string;\n opportunityContractId: string;\n company: string;\n vehicle: string;\n };\n};\n\nexport type HpLeasingDealEndRequest = {\n tenantId: string;\n initiatedBy: 'bisondesk';\n processMetaId: string;\n processRunData: {\n bisondeskTenantId: string;\n entityOwner: string;\n leasingContractOwner: string;\n vehicleOldReference: string;\n leasingContractNumber: string;\n company: string;\n vehicleNewReference: string;\n };\n};\n\nexport type CashInRow = {\n time: number;\n deposit: number;\n monthlyAdministrationFee: 0; //Legacy field - Should always be 0\n residualValue: number;\n startupFee: number;\n leasingAmountWithoutAdminFee: number;\n insurancePayment: number;\n taxPayment: number;\n cashIn: number;\n cumulativeCash: number;\n};\n\nexport type CashOutRow = {\n time: number;\n deposit: number;\n residualValue: number;\n leasingAmount: number;\n insurancePayment: number;\n taxPayment: number;\n cashOut: number;\n cumulativeCash: number;\n};\n\nexport type HpDeliveryFields = {\n detailsOfStacking?: string | null;\n technicalControlNeeded: boolean | null;\n\n //PickUP Delivery\n urgentDelivery?: boolean | null;\n dateOfPickUpByCustomer?: number | null;\n modeOfTransportPickUpByCustomer?: string | null; //entity Id\n detailsOfBorderCrossing?: string | null;\n insuranceNeeded: boolean | null;\n transitPlateNeeded: boolean | null;\n licensePlateNeeded: boolean | null;\n\n //Address Delivery\n address?: string | null;\n kmToAddressOfDelivery?: number | null;\n\n //To Port Delivery\n originPortText?: string | null; //entity Id\n shippingCompany?: string | null; //string Id\n destinationPort?: string | null;\n cleaningDegassingNeeded: boolean | null;\n};\n\nexport type HpIsaProcessRequest = {\n tenantId: string;\n initiatedBy: 'bisondesk';\n processMetaId: string;\n processRunData: HpDeliveryFields & {\n entityOwner: string;\n nameSalesPerson: string;\n\n company?: string; //entityId\n proofOfSaleCustomerAgreement?: string; //entityId\n\n vehicle?: string; //entityId\n bodywork?: string; //entityId\n vehicleCategory: string; //entityId\n\n amountOfCommissionPaid: number;\n opportunityId: string;\n deliveryType: string; //entity Id\n directDelivery?: boolean | null;\n directDeliveryReason?: string | null;\n agreedPrice?: string;\n\n //Extras\n garageExtrasCodes: string[];\n logisticsExtrasCodes: string[];\n administrationExtrasCodes: string[];\n allExtrasDescriptions: string[];\n customRequestDescriptions: string[];\n infoSpoiler: string; // entity Id\n };\n};\n\nexport type HpIsaProcessResponse = {\n entityId: string;\n id: string;\n status: string;\n};\n\nexport type HpWorkOrderProcessRequest = {\n tenantId: string;\n initiatedBy: 'bisondesk';\n processMetaId: string;\n processRunData: {\n entityOwner: string;\n\n opportunityId: string;\n\n //Extras\n garageExtrasCodes: string[];\n allExtrasDescriptions: string[];\n\n customerRequestDescriptions: string[];\n directDeliveryReason?: string | null;\n salesPerson: string; // entityId\n customerName: string;\n referenceNumber: string;\n make?: string; //entityId\n typeTrailer?: string; //entityId\n\n vinNumber?: string;\n foreseenArrivalDateTrailer?: string;\n deadlineRequest?: number;\n locationVehicle2?: string; //entityId\n customer: string; //entityId\n vehicle: string; //entityId\n trailerHasBeenCheckedIn: boolean;\n deliveryDetails?: string | null;\n technicalInspectionNeeded: boolean | null;\n adr: boolean | null;\n };\n};\n\nexport type HpWorkOrderProcessResponse = {\n entityId: string;\n id: string;\n status: string;\n};\n\nexport type SwitchOpportunityVehicleRequest = {\n opportunity: Opportunity;\n newVehicleId: string;\n};\n\nexport type KanbanOpportunitiesSearchRequest = BaseSearchRequest & {\n nextTokens?: Record<string, string | undefined>;\n groupByClient?: boolean;\n};\n\nexport type KanbanOpportunitiesNextList = Omit<\n NextList<OpportunitiesKanbanColumn, ReferenceData>,\n 'nextToken'\n> & {\n nextTokens?: Record<string, string | undefined>;\n};\n"]}
|
package/lib/types/tenants.d.ts
CHANGED
|
@@ -15,9 +15,11 @@ export declare enum TenantModule {
|
|
|
15
15
|
ClientMode = "client_mode",
|
|
16
16
|
CRM = "crm",
|
|
17
17
|
Docs = "docs",
|
|
18
|
+
EmailShare = "email_share",
|
|
18
19
|
GoogleLogin = "google_login",
|
|
19
20
|
Leads = "leads",
|
|
20
21
|
Leasing = "leasing",
|
|
22
|
+
LeasingContractGeneration = "leasing_contract_generation",
|
|
21
23
|
Marketing = "marketing",
|
|
22
24
|
Insights = "insights",
|
|
23
25
|
Intercompany = "intercompany",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tenants.d.ts","sourceRoot":"/","sources":["types/tenants.ts"],"names":[],"mappings":"AAAA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O,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,gBAAgB,GAAG,SAAS,CAAC;IAC3C,OAAO,EAAE,WAAW,GAAG,SAAS,CAAC;IACjC,aAAa,EAAE,gBAAgB,GAAG,SAAS,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAUF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,YAAY,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,OAAO,EAAE,WAAW,CAAC;CACtB,CAAC"}
|
package/lib/types/tenants.js
CHANGED
|
@@ -5,9 +5,11 @@ export var TenantModule;
|
|
|
5
5
|
TenantModule["ClientMode"] = "client_mode";
|
|
6
6
|
TenantModule["CRM"] = "crm";
|
|
7
7
|
TenantModule["Docs"] = "docs";
|
|
8
|
+
TenantModule["EmailShare"] = "email_share";
|
|
8
9
|
TenantModule["GoogleLogin"] = "google_login";
|
|
9
10
|
TenantModule["Leads"] = "leads";
|
|
10
11
|
TenantModule["Leasing"] = "leasing";
|
|
12
|
+
TenantModule["LeasingContractGeneration"] = "leasing_contract_generation";
|
|
11
13
|
TenantModule["Marketing"] = "marketing";
|
|
12
14
|
TenantModule["Insights"] = "insights";
|
|
13
15
|
TenantModule["Intercompany"] = "intercompany";
|
package/lib/types/tenants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tenants.js","sourceRoot":"/","sources":["types/tenants.ts"],"names":[],"mappings":"AAgBA,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"tenants.js","sourceRoot":"/","sources":["types/tenants.ts"],"names":[],"mappings":"AAgBA,MAAM,CAAN,IAAY,YAmDX;AAnDD,WAAY,YAAY;IACtB,iDAAiC,CAAA;IACjC,2BAAW,CAAA;IAOX,0CAA0B,CAAA;IAC1B,2BAAW,CAAA;IACX,6BAAa,CAAA;IAMb,0CAA0B,CAAA;IAQ1B,4CAA4B,CAAA;IAC5B,+BAAe,CAAA;IACf,mCAAmB,CAAA;IACnB,yEAAyD,CAAA;IACzD,uCAAuB,CAAA;IACvB,qCAAqB,CAAA;IAQrB,6CAA6B,CAAA;IAC7B,+CAA+B,CAAA;IAC/B,iCAAiB,CAAA;IACjB,qCAAqB,CAAA;IACrB,+BAAe,CAAA;IACf,iDAAiC,CAAA;IACjC,uCAAuB,CAAA;IACvB,gEAAgD,CAAA;IAChD,+BAAe,CAAA;IACf,8DAA8C,CAAA;IAC9C,uCAAuB,CAAA;IACvB,mCAAmB,CAAA;IACnB,uCAAuB,CAAA;AACzB,CAAC,EAnDW,YAAY,KAAZ,YAAY,QAmDvB;AAGD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,WAAW,CAAU,CAAC","sourcesContent":["import { CognitoInfo, LocationValue, Region } from '@bisondesk/commons-sdk/types';\nimport { OpportunityType } from '../constants.js';\n\nexport type PublicTenant = {\n defaultCountry: string;\n defaultCurrency: string;\n defaultLanguage: string;\n id: string; // the id is provided on creation bc we assume tenants will be created by someone on the team\n name: string;\n region: Region;\n subdomains: [string, ...string[]];\n\n // Pay attention to what information is added here since\n // the tenant can be obtained without authentication\n};\n\nexport enum TenantModule {\n Administration = 'administration',\n App = 'app',\n /**\n * The tenant's users can put the app into client mode, hiding the internal-only pages while\n * showing a screen to a customer. Left off for a tenant whose users are themselves the\n * customer: it would hide their sign-out to no purpose, and turning it back off needs a PIN\n * they were never given.\n */\n ClientMode = 'client_mode',\n CRM = 'crm',\n Docs = 'docs',\n /**\n * The app may send email on behalf of this tenant's users, e.g. sharing a vehicle: the\n * sender is the requesting user's own address, so the tenant's email domain must be one we\n * can deliver from. Absent on client tenants — we do not send mail as outsiders.\n */\n EmailShare = 'email_share',\n /**\n * The tenant's users can sign in with Google. It is a tenant fact rather than a user one:\n * `googleEmail` is only filled when the Google address differs from the BisonDesk one, and\n * every pool carries the Google provider regardless, so neither can tell who actually uses it.\n * Absent means password-only, which is what routes those users an emailed invite with a\n * genuine temporary password.\n */\n GoogleLogin = 'google_login',\n Leads = 'leads',\n Leasing = 'leasing',\n LeasingContractGeneration = 'leasing_contract_generation',\n Marketing = 'marketing',\n Insights = 'insights',\n /**\n * The tenant has agreed to exchange deal data through BisonDesk automatically, on top of the\n * bare vehicle distribution: it may be named as the buyer on an intercompany sale, which lets\n * the invoice sync and the purchase reconciliation write a purchase onto its copy. Read on the\n * BUYER only. All group tenants have it today; a supplier or client tenant that wants deal\n * data pushed too joins the exchange by being granted it.\n */\n Intercompany = 'intercompany',\n Opportunities = 'opportunities',\n Offers = 'offers',\n Vehicles = 'vehicles',\n Tasks = 'tasks',\n TrackAndTrace = 'track_and_trace',\n Bootstrap = 'bootstrap',\n WhatsappNotifications = 'whatsapp_notifications',\n Hexon = 'hexon',\n DeliveryConfirmation = 'delivery_confirmation',\n Transport = 'transport',\n Reports = 'reports',\n Prospects = 'prospects',\n}\n\n/** Report tabs a tenant can enable, in canonical order. */\nexport const REPORT_TAB_KEYS = ['sales', 'leasing', 'purchases'] as const;\n\nexport type ReportTabKey = (typeof REPORT_TAB_KEYS)[number];\n\nexport type Tenant = PublicTenant & {\n cognito?: CognitoInfo;\n languages: [string, ...string[]];\n conglomerate?: string;\n emailDomain: string;\n hyperdmsIds?: string[];\n hyperportalId?: string;\n\n /* deprecated */\n exactAccounting?: boolean;\n\n branches: [Branch, ...Branch[]];\n modules: TenantModule[];\n /**\n * Reports page configuration. `tabs` lists the visible tabs in display order;\n * absent or empty means no reports are configured for the tenant (the page\n * shows a notice instead of tabs).\n */\n reports?: {\n tabs: ReportTabKey[];\n };\n test?: boolean;\n opportunities: {\n types: OpportunityType[];\n };\n /**\n * Reservation expiry for this tenant's OWN vehicles (ADR-0026): the truck's owner sets the\n * clock, wherever the deal runs — for a cross-tenant copy the chain origin's policy\n * applies, whatever opportunity type the tenant selling to the end customer uses.\n * Absent = the default\n * business-day tiers; the tier is still picked by the local customer org's\n * trustworthy/conglomerate flags.\n */\n reservationExpiry?: ReservationExpiryPolicy;\n crm?: {\n vatNumberRequiredForCompanies?: boolean;\n };\n accounting?: {\n costCenterPerLine?: boolean;\n };\n // E.164 Twilio caller ID used as a fallback when a user has no own number configured\n defaultTwilioPhoneNumber?: string;\n deliveryEmail?: string;\n};\n\nexport type ReservationExpiryPolicy =\n | { policy: 'disabled' }\n | { policy: 'days'; generic: number; trustworthy: number; conglomerate: number };\n\nexport type AccountingProvider = 'exact' | 'odoo';\n\nexport type Branch = {\n id: string;\n name: string;\n country: string;\n language: string;\n /* deprecated — use `accounting === 'exact'` instead. Kept until prod cutover. */\n exactAccounting?: boolean;\n accounting?: AccountingProvider;\n currency: string;\n adminNumberPrefix: string;\n stockNumberPrefix: string;\n vatNumber: string;\n contactPerson?: { firstName: string; lastName: string };\n vatRates: {\n standard: string; //percentage value (e.g. 21)\n };\n location: LocationValue;\n\n storecoveExternalId?: number;\n externalQuote?: boolean;\n hyperdmsId?: string;\n internalDealsEnabled?: boolean;\n /** The source invoices the end customer directly; this branch collects payment and earns\n * commission. Intercompany source opportunities for this branch's deals take the buyer\n * deal's own client instead of the branch counterparty org. */\n dropshipping?: boolean;\n};\n\nexport type HdmsVehiclesSync = {\n active: boolean;\n};\n\nexport type HdmsCrmSync = {\n active: boolean;\n};\n\nexport type HdmsDocumentSync = {\n active: boolean;\n};\n\nexport type TenantSyncSettings = {\n tenantId: string;\n hdmsVehicles: HdmsVehiclesSync | undefined;\n hdmsCrm: HdmsCrmSync | undefined;\n hdmsDocuments: HdmsDocumentSync | undefined;\n};\n\nexport type WhatsappStateResponse = {\n enabled: boolean;\n};\n\n/**\n * What the login page is told about a tenant before anyone has signed in. Reached by subdomain\n * on the one public tenant endpoint, so it carries only what an anonymous visitor may see —\n * mind that when adding to it.\n *\n * The two booleans are answers the page cannot work out for itself: it has no session, so no\n * modules to read. They say which sign-in options to offer and whether WhatsApp sharing is on.\n */\nexport type TenantInfoResponse = {\n tenant: PublicTenant;\n whatsapp: boolean;\n googleLogin: boolean;\n cognito: CognitoInfo;\n};\n"]}
|
package/package.json
CHANGED
package/src/types/crm.ts
CHANGED
|
@@ -114,6 +114,12 @@ type BaseOrganization = {
|
|
|
114
114
|
subIndustry?: string;
|
|
115
115
|
type?: 'COMPANY' | 'INDIVIDUAL' | 'GOVERNMENT';
|
|
116
116
|
vatNumber?: string;
|
|
117
|
+
/**
|
|
118
|
+
* Registered share capital (capital social), in the currency it was registered in. Registry
|
|
119
|
+
* data like `vatNumber`, kept because the legal documents print it — the Ivory Coast
|
|
120
|
+
* cautionnement names the customer by capital alongside its trade-register number.
|
|
121
|
+
*/
|
|
122
|
+
shareCapital?: string;
|
|
117
123
|
addresses?: {
|
|
118
124
|
legal?: LocationValue;
|
|
119
125
|
transport?: LocationValue;
|
package/src/types/leasing.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AttachmentValue, Document, LinkValue } from '@bisondesk/commons-sdk/types';
|
|
1
|
+
import { AttachmentValue, Document, LinkValue, LocationValue } from '@bisondesk/commons-sdk/types';
|
|
2
2
|
import { BaseEvent } from './internal-events.js';
|
|
3
3
|
import { VehiclePurchaseLogisticsStatus } from './vehicles.js';
|
|
4
4
|
|
|
@@ -11,6 +11,7 @@ export enum LeasingContractActions {
|
|
|
11
11
|
CANCEL_RETAKE_VEHICLE = 'cancel_retake_vehicle',
|
|
12
12
|
CLONE_VEHICLE_FOR_RETAKE = 'clone_vehicle_for_retake',
|
|
13
13
|
SET_PLEDGER = 'set_pledger',
|
|
14
|
+
GENERATE_DOCUMENTS = 'generate_documents',
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
export type LeasingContractDebtInfo = {
|
|
@@ -44,19 +45,22 @@ export type LeasingConditionEvent = {
|
|
|
44
45
|
|
|
45
46
|
/**
|
|
46
47
|
* Personal guarantor (caution personnelle et solidaire) backing a client's obligations on the
|
|
47
|
-
* contract.
|
|
48
|
+
* contract. A client can have several; each signs its own cautionnement. Editable only while the
|
|
49
|
+
* contract status is `draft`.
|
|
48
50
|
*/
|
|
49
51
|
export type LeasingContractPledger = {
|
|
52
|
+
/** Stable id, assigned server-side; identifies the pledger for updates, removal and its document. */
|
|
53
|
+
id: string;
|
|
50
54
|
/** Optional link to the CRM contact the pledger was picked from. */
|
|
51
55
|
contactId?: string;
|
|
52
56
|
/** Printed full name, as it appears on the cautionnement. */
|
|
53
57
|
name: string;
|
|
54
|
-
/** yyyy-mm-dd */
|
|
55
|
-
birthDate
|
|
56
|
-
/** National identity card (CNI) number. */
|
|
57
|
-
nationalId
|
|
58
|
-
/** Private address,
|
|
59
|
-
address?:
|
|
58
|
+
/** yyyy-mm-dd. Required — the cautionnement prints it. */
|
|
59
|
+
birthDate: string;
|
|
60
|
+
/** National identity card (CNI) number. Required — the cautionnement prints it. */
|
|
61
|
+
nationalId: string;
|
|
62
|
+
/** Private address, split by field like the organization and contact addresses. */
|
|
63
|
+
address?: LocationValue;
|
|
60
64
|
/** Qualité — e.g. dirigeant social of the client company. */
|
|
61
65
|
role?: string;
|
|
62
66
|
/** Montant maximal garanti: cap of the pledger's engagement, in the contract currency. */
|
|
@@ -72,7 +76,7 @@ export type LeasingContractClient = {
|
|
|
72
76
|
country: string;
|
|
73
77
|
beEntityType?: 'Legal Person' | 'Natural Person';
|
|
74
78
|
beForeignEntity?: boolean;
|
|
75
|
-
|
|
79
|
+
pledgers?: LeasingContractPledger[];
|
|
76
80
|
|
|
77
81
|
/**
|
|
78
82
|
* Used to overwrite the startDate in the context of a Becris declaration. This might be necessary
|
|
@@ -158,8 +162,34 @@ type BaseLeasingContract<
|
|
|
158
162
|
};
|
|
159
163
|
status: LeasingContractStatus;
|
|
160
164
|
documents: Document[];
|
|
165
|
+
/**
|
|
166
|
+
* Bookkeeping for the server-generated contract documents (filed as administrative documents).
|
|
167
|
+
* `signature` is a hash of the source data used at generation time; comparing it to the current
|
|
168
|
+
* data tells whether a draft's generated documents are stale and should be regenerated.
|
|
169
|
+
*/
|
|
170
|
+
generatedDocuments?: {
|
|
171
|
+
contract?: GeneratedDocumentMeta;
|
|
172
|
+
cautionnement?: GeneratedDocumentMeta;
|
|
173
|
+
};
|
|
161
174
|
} & T;
|
|
162
175
|
|
|
176
|
+
export type GeneratedDocumentMeta = {
|
|
177
|
+
generatedAt: string;
|
|
178
|
+
signature: string;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
/** Per-group generation state returned by the documents-status endpoint. */
|
|
182
|
+
export type GeneratedDocumentStatus = {
|
|
183
|
+
generatedAt: string;
|
|
184
|
+
/** True only while the contract is a draft and the current data differs from what was generated. */
|
|
185
|
+
stale: boolean;
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
export type LeasingContractDocumentsStatus = {
|
|
189
|
+
contract: GeneratedDocumentStatus | null;
|
|
190
|
+
cautionnement: GeneratedDocumentStatus | null;
|
|
191
|
+
};
|
|
192
|
+
|
|
163
193
|
export type LeasingContract<
|
|
164
194
|
T = LeasingContractHyperportal | LeasingContractBisondesk | LeasingContractInternal,
|
|
165
195
|
> = BaseLeasingContract<T> & {
|
|
@@ -450,6 +480,69 @@ export type AmortizationTableTemplateData = {
|
|
|
450
480
|
}[];
|
|
451
481
|
};
|
|
452
482
|
|
|
483
|
+
/**
|
|
484
|
+
* Merge payload for the printable contract conditions documents (Conditions Particulières and
|
|
485
|
+
* Conditions Générales share it; the Générales template consumes a subset). Country-agnostic —
|
|
486
|
+
* first used by MrLease CI. Amounts are display-ready strings without a currency symbol; the
|
|
487
|
+
* currency literals live in the per-branch DOCX templates.
|
|
488
|
+
*/
|
|
489
|
+
export type ContractConditionsTemplateData = {
|
|
490
|
+
contractNumber: string;
|
|
491
|
+
currentDate: string;
|
|
492
|
+
c: {
|
|
493
|
+
company: string;
|
|
494
|
+
address: string;
|
|
495
|
+
};
|
|
496
|
+
v: {
|
|
497
|
+
make: string;
|
|
498
|
+
type: string;
|
|
499
|
+
year: string | number;
|
|
500
|
+
vin: string;
|
|
501
|
+
condition: string;
|
|
502
|
+
};
|
|
503
|
+
leasing: {
|
|
504
|
+
duration: number;
|
|
505
|
+
salesPriceExclVat: string;
|
|
506
|
+
depositExclVat: string;
|
|
507
|
+
depositPercentage: string;
|
|
508
|
+
installmentExclVat: string;
|
|
509
|
+
paymentMode: string;
|
|
510
|
+
guaranteeDeposit: string;
|
|
511
|
+
deliveryDate: string;
|
|
512
|
+
installationLocation: string;
|
|
513
|
+
maxKmPerYear: string;
|
|
514
|
+
startupFee: string;
|
|
515
|
+
residualExclVat: string;
|
|
516
|
+
};
|
|
517
|
+
};
|
|
518
|
+
|
|
519
|
+
/** Merge payload for the cautionnement (personal surety) document. */
|
|
520
|
+
export type CautionnementTemplateData = {
|
|
521
|
+
currentDate: string;
|
|
522
|
+
c: {
|
|
523
|
+
company: string;
|
|
524
|
+
address: string;
|
|
525
|
+
vatNumber: string;
|
|
526
|
+
shareCapital: string;
|
|
527
|
+
};
|
|
528
|
+
v: {
|
|
529
|
+
make: string;
|
|
530
|
+
type: string;
|
|
531
|
+
year: string | number;
|
|
532
|
+
vin: string;
|
|
533
|
+
};
|
|
534
|
+
p: {
|
|
535
|
+
name: string;
|
|
536
|
+
birthDate: string;
|
|
537
|
+
nationalId: string;
|
|
538
|
+
address: string;
|
|
539
|
+
role: string;
|
|
540
|
+
/** Cap of the guarantee: the whole lease incl. VAT. See `computeGuaranteedAmount`. */
|
|
541
|
+
maxGuaranteedAmount: string;
|
|
542
|
+
maxGuaranteedAmountWords: string;
|
|
543
|
+
};
|
|
544
|
+
};
|
|
545
|
+
|
|
453
546
|
export type CmrTemplateData = {
|
|
454
547
|
contractId: string;
|
|
455
548
|
date: string;
|
|
@@ -637,6 +637,7 @@ export type HpLeasingDealRunDataCi = HpLeasingDealRunDataBase & {
|
|
|
637
637
|
vehicule?: string;
|
|
638
638
|
plaqueDimmatriculation?: string;
|
|
639
639
|
numeroDeContratLeasing: string;
|
|
640
|
+
dateDeDebutDuContrat?: number;
|
|
640
641
|
prixDeVenteHorsTvaXof: string;
|
|
641
642
|
montantDavanceTtcXof: string;
|
|
642
643
|
depotDeGarantieXof?: string;
|
package/src/types/tenants.ts
CHANGED
|
@@ -26,6 +26,12 @@ export enum TenantModule {
|
|
|
26
26
|
ClientMode = 'client_mode',
|
|
27
27
|
CRM = 'crm',
|
|
28
28
|
Docs = 'docs',
|
|
29
|
+
/**
|
|
30
|
+
* The app may send email on behalf of this tenant's users, e.g. sharing a vehicle: the
|
|
31
|
+
* sender is the requesting user's own address, so the tenant's email domain must be one we
|
|
32
|
+
* can deliver from. Absent on client tenants — we do not send mail as outsiders.
|
|
33
|
+
*/
|
|
34
|
+
EmailShare = 'email_share',
|
|
29
35
|
/**
|
|
30
36
|
* The tenant's users can sign in with Google. It is a tenant fact rather than a user one:
|
|
31
37
|
* `googleEmail` is only filled when the Google address differs from the BisonDesk one, and
|
|
@@ -36,6 +42,7 @@ export enum TenantModule {
|
|
|
36
42
|
GoogleLogin = 'google_login',
|
|
37
43
|
Leads = 'leads',
|
|
38
44
|
Leasing = 'leasing',
|
|
45
|
+
LeasingContractGeneration = 'leasing_contract_generation',
|
|
39
46
|
Marketing = 'marketing',
|
|
40
47
|
Insights = 'insights',
|
|
41
48
|
/**
|