@bisondesk/core-sdk 1.0.628 → 1.0.630

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.
Files changed (131) hide show
  1. package/lib/apis/activities.d.ts.map +1 -1
  2. package/lib/apis/country-delivery.d.ts.map +1 -1
  3. package/lib/apis/crm.d.ts.map +1 -1
  4. package/lib/apis/crm.js.map +1 -1
  5. package/lib/apis/debtors.d.ts.map +1 -1
  6. package/lib/apis/email-templates.d.ts.map +1 -1
  7. package/lib/apis/exchange-rates.d.ts.map +1 -1
  8. package/lib/apis/insights.d.ts.map +1 -1
  9. package/lib/apis/internet-vehicles.d.ts.map +1 -1
  10. package/lib/apis/leasing-administration.d.ts.map +1 -1
  11. package/lib/apis/leasing.d.ts.map +1 -1
  12. package/lib/apis/offers.d.ts.map +1 -1
  13. package/lib/apis/opportunities.d.ts.map +1 -1
  14. package/lib/apis/opportunities.js.map +1 -1
  15. package/lib/apis/tenants.d.ts.map +1 -1
  16. package/lib/apis/users.d.ts.map +1 -1
  17. package/lib/apis/vehicle-sales.d.ts.map +1 -1
  18. package/lib/apis/vehicles.d.ts.map +1 -1
  19. package/lib/types/interests.d.ts.map +1 -1
  20. package/lib/types/opportunities.d.ts +2 -1
  21. package/lib/types/opportunities.d.ts.map +1 -1
  22. package/lib/types/opportunities.js +1 -0
  23. package/lib/types/opportunities.js.map +1 -1
  24. package/lib/types/reports-leasing.d.ts +1 -1
  25. package/lib/types/reports-leasing.d.ts.map +1 -1
  26. package/lib/types/reports-sales.d.ts +2 -2
  27. package/lib/types/reports-sales.d.ts.map +1 -1
  28. package/lib/types/tenants.d.ts +3 -2
  29. package/lib/types/tenants.d.ts.map +1 -1
  30. package/lib/types/tenants.js +2 -1
  31. package/lib/types/tenants.js.map +1 -1
  32. package/lib/types/transports.d.ts.map +1 -1
  33. package/lib/utils/accounting.d.ts.map +1 -1
  34. package/lib/utils/accounting.test.js.map +1 -1
  35. package/lib/utils/contacts.d.ts.map +1 -1
  36. package/lib/utils/debtors-dossiers.d.ts.map +1 -1
  37. package/lib/utils/exchange-rates.d.ts.map +1 -1
  38. package/lib/utils/forms.d.ts.map +1 -1
  39. package/lib/utils/forms.js.map +1 -1
  40. package/lib/utils/integrations/vehicles.d.ts +1 -1
  41. package/lib/utils/integrations/vehicles.d.ts.map +1 -1
  42. package/lib/utils/interests.d.ts.map +1 -1
  43. package/lib/utils/interests.js.map +1 -1
  44. package/lib/utils/leasing.d.ts +1 -1
  45. package/lib/utils/leasing.d.ts.map +1 -1
  46. package/lib/utils/offers.d.ts.map +1 -1
  47. package/lib/utils/opportunities.d.ts +1 -0
  48. package/lib/utils/opportunities.d.ts.map +1 -1
  49. package/lib/utils/opportunities.js +4 -0
  50. package/lib/utils/opportunities.js.map +1 -1
  51. package/lib/utils/search.d.ts +1 -1
  52. package/lib/utils/search.d.ts.map +1 -1
  53. package/lib/utils/slug.d.ts.map +1 -1
  54. package/lib/utils/tenants.d.ts.map +1 -1
  55. package/lib/utils/vehicles.d.ts +3 -3
  56. package/lib/utils/vehicles.d.ts.map +1 -1
  57. package/package.json +2 -2
  58. package/src/types/activities.js +13 -0
  59. package/src/types/activities.js.map +1 -0
  60. package/src/types/comparables.js +2 -0
  61. package/src/types/comparables.js.map +1 -0
  62. package/src/types/crm.js +58 -0
  63. package/src/types/crm.js.map +1 -0
  64. package/src/types/dashboard.js +2 -0
  65. package/src/types/dashboard.js.map +1 -0
  66. package/src/types/definitions.js +2 -0
  67. package/src/types/definitions.js.map +1 -0
  68. package/src/types/fields.js +2 -0
  69. package/src/types/fields.js.map +1 -0
  70. package/src/types/insights.js +2 -0
  71. package/src/types/insights.js.map +1 -0
  72. package/src/types/interests.js +6 -0
  73. package/src/types/interests.js.map +1 -0
  74. package/src/types/internal-events.js +18 -0
  75. package/src/types/internal-events.js.map +1 -0
  76. package/src/types/internet-opportunities.js +2 -0
  77. package/src/types/internet-opportunities.js.map +1 -0
  78. package/src/types/internet-vehicles.js +2 -0
  79. package/src/types/internet-vehicles.js.map +1 -0
  80. package/src/types/leasing-administration.js +2 -0
  81. package/src/types/leasing-administration.js.map +1 -0
  82. package/src/types/leasing-debtors.js +2 -0
  83. package/src/types/leasing-debtors.js.map +1 -0
  84. package/src/types/leasing-search.js +2 -0
  85. package/src/types/leasing-search.js.map +1 -0
  86. package/src/types/leasing-settings.js +7 -0
  87. package/src/types/leasing-settings.js.map +1 -0
  88. package/src/types/leasing.js +38 -0
  89. package/src/types/leasing.js.map +1 -0
  90. package/src/types/marketing.js +35 -0
  91. package/src/types/marketing.js.map +1 -0
  92. package/src/types/offers.js +56 -0
  93. package/src/types/opportunities.js +107 -0
  94. package/src/types/opportunities.js.map +1 -0
  95. package/src/types/opportunities.ts +1 -0
  96. package/src/types/payments.js +7 -0
  97. package/src/types/picklists.js +2 -0
  98. package/src/types/picklists.js.map +1 -0
  99. package/src/types/quotes.js +42 -0
  100. package/src/types/recently-viewed.js +2 -0
  101. package/src/types/recently-viewed.js.map +1 -0
  102. package/src/types/reservations.js +5 -0
  103. package/src/types/reservations.js.map +1 -0
  104. package/src/types/roi-ratings.js +5 -0
  105. package/src/types/roi-ratings.js.map +1 -0
  106. package/src/types/saved-filters.js +9 -0
  107. package/src/types/saved-filters.js.map +1 -0
  108. package/src/types/search.js +2 -0
  109. package/src/types/search.js.map +1 -0
  110. package/src/types/settings.js +2 -0
  111. package/src/types/settings.js.map +1 -0
  112. package/src/types/templates.js +2 -0
  113. package/src/types/templates.js.map +1 -0
  114. package/src/types/tenants.js +21 -0
  115. package/src/types/tenants.js.map +1 -0
  116. package/src/types/tenants.ts +15 -1
  117. package/src/types/user-performance.js +7 -0
  118. package/src/types/user-performance.js.map +1 -0
  119. package/src/types/utils.js +2 -0
  120. package/src/types/validation.js +2 -0
  121. package/src/types/validation.js.map +1 -0
  122. package/src/types/vehicle-sales.js +6 -0
  123. package/src/types/vehicle-sales.js.map +1 -0
  124. package/src/types/vehicles.js +98 -0
  125. package/src/types/vehicles.js.map +1 -0
  126. package/src/utils/leasing.js +6 -0
  127. package/src/utils/leasing.js.map +1 -0
  128. package/src/utils/opportunities.js +48 -0
  129. package/src/utils/opportunities.js.map +1 -0
  130. package/src/utils/opportunities.ts +13 -1
  131. 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,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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AAC,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}\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,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AA+B,CAAC;AACjG,MAAM,CAAC,MAAM,gDAAgD,GAAG,8BAA8B,CAAC;AAC/F,MAAM,CAAC,MAAM,mEAAmE,GAC9E,2CAA2C,CAAC;AAC9C,MAAM,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,5 +1,5 @@
1
1
  import { YoyMetric } from './reports-sales.js';
2
- export declare const LEASING_PERIOD_KEYS: readonly ["mtd", "ytd", "lastMonth", "last3Months", "last6Months", "last12Months", "lastYear"];
2
+ export declare const LEASING_PERIOD_KEYS: readonly ['mtd', 'ytd', 'lastMonth', 'last3Months', 'last6Months', 'last12Months', 'lastYear'];
3
3
  export type LeasingPeriodKey = (typeof LEASING_PERIOD_KEYS)[number];
4
4
  export declare const DEFAULT_LEASING_PERIOD: LeasingPeriodKey;
5
5
  export type LeasingReportRequest = {
@@ -1 +1 @@
1
- {"version":3,"file":"reports-leasing.d.ts","sourceRoot":"/","sources":["types/reports-leasing.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAS/C,eAAO,MAAM,mBAAmB,gGAQtB,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpE,eAAO,MAAM,sBAAsB,EAAE,gBAAwB,CAAC;AAE9D,MAAM,MAAM,oBAAoB,GAAG;IAAE,MAAM,EAAE,gBAAgB,CAAA;CAAE,CAAC;AAEhE,YAAY,EAAE,SAAS,EAAE,CAAC;AAG1B,MAAM,MAAM,qBAAqB,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,CAAC;AAE3E,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,qBAAqB,CAAC;IAE9B,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IAEjC,QA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AE,kBAAkB,EAAE,CAAC;QAElC,aAAa,EAAE,mBAAmB,EAAE,CAAC;QAErC,SAAS,EAAE,iBAAiB,EAAE,CAAC;KAChC,CAAC;IAGF,IAAI,EAAE;QAQJ,aAAa,EAAE,SAAS,CAAC;QAEzB,aAAa,EAAE,MAAM,CAAC;QAEtB,KAAK,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;KAC1C,CAAC;IAEF,mBAAmB,EAAE,uBAAuB,EAAE,CAAC;IAE/C,cAAc,EAAE,oBAAoB,EAAE,CAAC;IAOvC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IAEjC,eAAe,EAAE,qBAAqB,EAAE,CAAC;IAEzC,KAAK,EAAE;QAKL,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;QAE3B,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;CACH,CAAC"}
@@ -1,4 +1,4 @@
1
- export declare const SALES_PERIOD_KEYS: readonly ["30d", "45d", "60d", "90d", "lastMonth", "mtd", "ytd", "lastYear", "12m"];
1
+ export declare const SALES_PERIOD_KEYS: readonly ['30d', '45d', '60d', '90d', 'lastMonth', 'mtd', 'ytd', 'lastYear', '12m'];
2
2
  export type SalesPeriodKey = (typeof SALES_PERIOD_KEYS)[number];
3
3
  export declare const DEFAULT_SALES_PERIOD: SalesPeriodKey;
4
4
  export type SalesReportRequest = {
@@ -58,7 +58,7 @@ export type SalesReportHistogramBucket = {
58
58
  month: string;
59
59
  count: number;
60
60
  };
61
- export declare const STOCK_AGE_BANDS: readonly ["0-30", "31-90", "91-180", "180+"];
61
+ export declare const STOCK_AGE_BANDS: readonly ['0-30', '31-90', '91-180', '180+'];
62
62
  export type StockAgeBand = (typeof STOCK_AGE_BANDS)[number];
63
63
  export type StockAgePoint = {
64
64
  date: string;
@@ -1 +1 @@
1
- {"version":3,"file":"reports-sales.d.ts","sourceRoot":"/","sources":["types/reports-sales.ts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AEhC,YAAY,EAAE,iBAAiB,EAAE,CAAC;IAElC,SAAS,EAAE,YAAY,EAAE,CAAC;IAC1B,YAAY,EAAE,uBAAuB,CAAC;IAEtC,SAAS,EAAE,0BAA0B,EAAE,CAAC;IAMxC,QAAQ,EAAE,aAAa,EAAE,CAAC;IAM1B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,CAAC"}
@@ -12,15 +12,16 @@ export type PublicTenant = {
12
12
  export declare enum TenantModule {
13
13
  Administration = "administration",
14
14
  App = "app",
15
+ ClientMode = "client_mode",
15
16
  CRM = "crm",
16
17
  Docs = "docs",
17
18
  Leads = "leads",
18
19
  Leasing = "leasing",
19
20
  Marketing = "marketing",
20
21
  Insights = "insights",
22
+ Intercompany = "intercompany",
21
23
  Opportunities = "opportunities",
22
24
  Offers = "offers",
23
- VehiclesMasterData = "vehicles_master_data",
24
25
  Vehicles = "vehicles",
25
26
  Tasks = "tasks",
26
27
  TrackAndTrace = "track_and_trace",
@@ -32,7 +33,7 @@ export declare enum TenantModule {
32
33
  Reports = "reports",
33
34
  Prospects = "prospects"
34
35
  }
35
- export declare const REPORT_TAB_KEYS: readonly ["sales", "leasing", "purchases"];
36
+ export declare const REPORT_TAB_KEYS: readonly ['sales', 'leasing', 'purchases'];
36
37
  export type ReportTabKey = (typeof REPORT_TAB_KEYS)[number];
37
38
  export type Tenant = PublicTenant & {
38
39
  cognito?: CognitoInfo;
@@ -1 +1 @@
1
- {"version":3,"file":"tenants.d.ts","sourceRoot":"/","sources":["types/tenants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,MAAM,YAAY,GAAG;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,EAAE,EAAE,M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GAAG;IACxB,MAAM,EAAE,OAAO,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"}
@@ -2,15 +2,16 @@ export var TenantModule;
2
2
  (function (TenantModule) {
3
3
  TenantModule["Administration"] = "administration";
4
4
  TenantModule["App"] = "app";
5
+ TenantModule["ClientMode"] = "client_mode";
5
6
  TenantModule["CRM"] = "crm";
6
7
  TenantModule["Docs"] = "docs";
7
8
  TenantModule["Leads"] = "leads";
8
9
  TenantModule["Leasing"] = "leasing";
9
10
  TenantModule["Marketing"] = "marketing";
10
11
  TenantModule["Insights"] = "insights";
12
+ TenantModule["Intercompany"] = "intercompany";
11
13
  TenantModule["Opportunities"] = "opportunities";
12
14
  TenantModule["Offers"] = "offers";
13
- TenantModule["VehiclesMasterData"] = "vehicles_master_data";
14
15
  TenantModule["Vehicles"] = "vehicles";
15
16
  TenantModule["Tasks"] = "tasks";
16
17
  TenantModule["TrackAndTrace"] = "track_and_trace";
@@ -1 +1 @@
1
- {"version":3,"file":"tenants.js","sourceRoot":"/","sources":["types/tenants.ts"],"names":[],"mappings":"AAgBA,MAAM,CAAN,IAAY,YAsBX;AAtBD,WAAY,YAAY;IACtB,iDAAiC,CAAA;IACjC,2BAAW,CAAA;IACX,2BAAW,CAAA;IACX,6BAAa,CAAA;IACb,+BAAe,CAAA;IACf,mCAAmB,CAAA;IACnB,uCAAuB,CAAA;IACvB,qCAAqB,CAAA;IACrB,+CAA+B,CAAA;IAC/B,iCAAiB,CAAA;IACjB,2DAA2C,CAAA;IAC3C,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,EAtBW,YAAY,KAAZ,YAAY,QAsBvB;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 CRM = 'crm',\n Docs = 'docs',\n Leads = 'leads',\n Leasing = 'leasing',\n Marketing = 'marketing',\n Insights = 'insights',\n Opportunities = 'opportunities',\n Offers = 'offers',\n VehiclesMasterData = 'vehicles_master_data',\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"]}
1
+ {"version":3,"file":"tenants.js","sourceRoot":"/","sources":["types/tenants.ts"],"names":[],"mappings":"AAgBA,MAAM,CAAN,IAAY,YAoCX;AApCD,WAAY,YAAY;IACtB,iDAAiC,CAAA;IACjC,2BAAW,CAAA;IAOX,0CAA0B,CAAA;IAC1B,2BAAW,CAAA;IACX,6BAAa,CAAA;IACb,+BAAe,CAAA;IACf,mCAAmB,CAAA;IACnB,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,EApCW,YAAY,KAAZ,YAAY,QAoCvB;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 Leads = 'leads',\n Leasing = 'leasing',\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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"transports.d.ts","sourceRoot":"/","sources":["types/transports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AACtF,OAAO,EAAE,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EjC,eAAO,MAAM,mBAAmB,GAAI,QAAQ,MAAM,GAAG,SAAS,KAAG,OAQhE,CAAC;AAQF,eAAO,MAAM,2BAA2B,GACtC,QAAQ,MAAM,GAAG,SAAS,EAC1B,UAAU,MAAM,KACf,OAKF,CAAC"}
1
+ {"version":3,"file":"accounting.d.ts","sourceRoot":"/","sources":["utils/accounting.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAEzE,eAAO,MAAM,cAAc,WAAY,MAAM,GAAG,SAAS,KAAG,kBAAkB,GAAG,SAQhF,CAAC;AAEF,eAAO,MAAM,mBAAmB,WAAY,MAAM,GAAG,SAAS,KAAG,OACjC,CAAC;AAEjC,eAAO,MAAM,mBAAmB,WAAY,MAAM,GAAG,SAAS,KAAG,OAQhE,CAAC;AAQF,eAAO,MAAM,2BAA2B,WAC9B,MAAM,GAAG,SAAS,YAChB,MAAM,KACf,OAKF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"accounting.test.js","sourceRoot":"/","sources":["utils/accounting.test.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EACnB,2BAA2B,EAC3B,cAAc,EACd,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,UAAU,GAAG,CAAC,YAA6B,EAAE,EAAU,EAAE,CAAC,CAAC;IAC/D,EAAE,EAAE,IAAI;IACR,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,IAAI;IACb,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,KAAK;IACf,iBAAiB,EAAE,EAAE;IACrB,iBAAiB,EAAE,EAAE;IACrB,SAAS,EAAE,EAAE;IACb,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC5B,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IAC3B,GAAG,SAAS;CACb,CAAC,CAAC;AAEH,MAAM,UAAU,GAAG,CAAC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E,EAAE,cAAc,EAAE,CAAC,CAAC,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC,CAAC;QAC3F,MAAM,CAAC,2BAA2B,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1E,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE;QAC1D,MAAM,CAAC,2BAA2B,CAAC,UAAU,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACpF,MAAM,CAAC,2BAA2B,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { Branch, Tenant } from '../types/tenants.js';\nimport {\n branchHasAccounting,\n branchHasAccountingInTenant,\n branchProvider,\n tenantHasAccounting,\n} from './accounting.js';\n\nconst makeBranch = (overrides: Partial<Branch> = {}): Branch => ({\n id: 'b1',\n name: 'Branch 1',\n country: 'ci',\n language: 'fr',\n currency: 'XOF',\n adminNumberPrefix: '',\n stockNumberPrefix: '',\n vatNumber: '',\n vatRates: { standard: '18' },\n location: { country: 'ci' },\n ...overrides,\n});\n\nconst makeTenant = (branches: Branch[], overrides: Partial<Tenant> = {}): Tenant =>\n ({\n id: 't',\n name: 't',\n region: 'eu-west-1',\n defaultCountry: 'ci',\n defaultCurrency: 'XOF',\n defaultLanguage: 'fr',\n subdomains: ['t'],\n languages: ['fr'],\n emailDomain: 'example.com',\n branches: branches as [Branch, ...Branch[]],\n modules: [],\n opportunities: { types: [] },\n ...overrides,\n }) as Tenant;\n\ndescribe('branchProvider', () => {\n it('returns undefined for missing branch', () => {\n expect(branchProvider(undefined)).toBeUndefined();\n });\n\n it('prefers the new discriminator over the legacy boolean', () => {\n const branch = makeBranch({ accounting: 'odoo', exactAccounting: true });\n expect(branchProvider(branch)).toBe('odoo');\n });\n\n it('falls back to legacy boolean as exact', () => {\n const branch = makeBranch({ exactAccounting: true });\n expect(branchProvider(branch)).toBe('exact');\n });\n\n it('returns undefined when neither field is set', () => {\n expect(branchProvider(makeBranch())).toBeUndefined();\n });\n\n it('returns undefined when legacy boolean is false', () => {\n expect(branchProvider(makeBranch({ exactAccounting: false }))).toBeUndefined();\n });\n});\n\ndescribe('branchHasAccounting', () => {\n it('is true when accounting is set', () => {\n expect(branchHasAccounting(makeBranch({ accounting: 'odoo' }))).toBe(true);\n });\n\n it('is true when legacy exactAccounting is true', () => {\n expect(branchHasAccounting(makeBranch({ exactAccounting: true }))).toBe(true);\n });\n\n it('is false otherwise', () => {\n expect(branchHasAccounting(makeBranch())).toBe(false);\n expect(branchHasAccounting(undefined)).toBe(false);\n });\n});\n\ndescribe('tenantHasAccounting', () => {\n it('is true when tenant-level legacy flag is set', () => {\n const tenant = makeTenant([makeBranch()], { exactAccounting: true });\n expect(tenantHasAccounting(tenant)).toBe(true);\n });\n\n it('is true when any branch has accounting', () => {\n const tenant = makeTenant([makeBranch(), makeBranch({ id: 'b2', accounting: 'odoo' })]);\n expect(tenantHasAccounting(tenant)).toBe(true);\n });\n\n it('is false when no branch has accounting and tenant flag is not set', () => {\n expect(tenantHasAccounting(makeTenant([makeBranch()]))).toBe(false);\n expect(tenantHasAccounting(undefined)).toBe(false);\n });\n});\n\ndescribe('branchHasAccountingInTenant', () => {\n it('resolves per branch in a mixed tenant', () => {\n const tenant = makeTenant([\n makeBranch({ id: 'odoo-branch', accounting: 'odoo' }),\n makeBranch({ id: 'plain-branch' }),\n ]);\n expect(branchHasAccountingInTenant(tenant, 'odoo-branch')).toBe(true);\n expect(branchHasAccountingInTenant(tenant, 'plain-branch')).toBe(false);\n });\n\n it('ignores the deprecated tenant-wide flag and resolves per branch', () => {\n const tenant = makeTenant([makeBranch({ id: 'plain-branch' })], { exactAccounting: true });\n expect(branchHasAccountingInTenant(tenant, 'plain-branch')).toBe(false);\n });\n\n it('is false for an unknown branch or missing tenant', () => {\n expect(branchHasAccountingInTenant(makeTenant([makeBranch()]), 'nope')).toBe(false);\n expect(branchHasAccountingInTenant(undefined, 'b1')).toBe(false);\n });\n});\n"]}
1
+ {"version":3,"file":"accounting.test.js","sourceRoot":"/","sources":["utils/accounting.test.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EACnB,2BAA2B,EAC3B,cAAc,EACd,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,UAAU,GAAG,CAAC,SAAS,GAAoB,EAAE,EAAU,EAAE,CAAC,CAAC;IAC/D,EAAE,EAAE,IAAI;IACR,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,IAAI;IACb,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,KAAK;IACf,iBAAiB,EAAE,EAAE;IACrB,iBAAiB,EAAE,EAAE;IACrB,SAAS,EAAE,EAAE;IACb,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC5B,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IAC3B,GAAG,SAAS;CACb,CAAC,CAAC;AAEH,MAAM,UAAU,GAAG,CAAC,QAAkB,EAAE,SAAS,GAAoB,EAAE,EAAU,EAAE,CACjF,CAAC;IACC,EAAE,EAAE,GAAG;IACP,IAAI,EAAE,GAAG;IACT,MAAM,EAAE,WAAW;IACnB,cAAc,EAAE,IAAI;IACpB,eAAe,EAAE,KAAK;IACtB,eAAe,EAAE,IAAI;IACrB,UAAU,EAAE,CAAC,GAAG,CAAC;IACjB,SAAS,EAAE,CAAC,IAAI,CAAC;IACjB,WAAW,EAAE,aAAa;IAC1B,QAAQ,EAAE,QAAiC;IAC3C,OAAO,EAAE,EAAE;IACX,aAAa,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;IAC5B,GAAG,SAAS;CACb,CAAW,CAAC;AAEf,QAAQ,CAAC,gBAAgB,EAAE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AI,CAAC,KAAK,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { Branch, Tenant } from '../types/tenants.js';\nimport {\n branchHasAccounting,\n branchHasAccountingInTenant,\n branchProvider,\n tenantHasAccounting,\n} from './accounting.js';\n\nconst makeBranch = (overrides: Partial<Branch> = {}): Branch => ({\n id: 'b1',\n name: 'Branch 1',\n country: 'ci',\n language: 'fr',\n currency: 'XOF',\n adminNumberPrefix: '',\n stockNumberPrefix: '',\n vatNumber: '',\n vatRates: { standard: '18' },\n location: { country: 'ci' },\n ...overrides,\n});\n\nconst makeTenant = (branches: Branch[], overrides: Partial<Tenant> = {}): Tenant =>\n ({\n id: 't',\n name: 't',\n region: 'eu-west-1',\n defaultCountry: 'ci',\n defaultCurrency: 'XOF',\n defaultLanguage: 'fr',\n subdomains: ['t'],\n languages: ['fr'],\n emailDomain: 'example.com',\n branches: branches as [Branch, ...Branch[]],\n modules: [],\n opportunities: { types: [] },\n ...overrides,\n }) as Tenant;\n\ndescribe('branchProvider', () => {\n it('returns undefined for missing branch', () => {\n expect(branchProvider(undefined)).toBeUndefined();\n });\n\n it('prefers the new discriminator over the legacy boolean', () => {\n const branch = makeBranch({ accounting: 'odoo', exactAccounting: true });\n expect(branchProvider(branch)).toBe('odoo');\n });\n\n it('falls back to legacy boolean as exact', () => {\n const branch = makeBranch({ exactAccounting: true });\n expect(branchProvider(branch)).toBe('exact');\n });\n\n it('returns undefined when neither field is set', () => {\n expect(branchProvider(makeBranch())).toBeUndefined();\n });\n\n it('returns undefined when legacy boolean is false', () => {\n expect(branchProvider(makeBranch({ exactAccounting: false }))).toBeUndefined();\n });\n});\n\ndescribe('branchHasAccounting', () => {\n it('is true when accounting is set', () => {\n expect(branchHasAccounting(makeBranch({ accounting: 'odoo' }))).toBe(true);\n });\n\n it('is true when legacy exactAccounting is true', () => {\n expect(branchHasAccounting(makeBranch({ exactAccounting: true }))).toBe(true);\n });\n\n it('is false otherwise', () => {\n expect(branchHasAccounting(makeBranch())).toBe(false);\n expect(branchHasAccounting(undefined)).toBe(false);\n });\n});\n\ndescribe('tenantHasAccounting', () => {\n it('is true when tenant-level legacy flag is set', () => {\n const tenant = makeTenant([makeBranch()], { exactAccounting: true });\n expect(tenantHasAccounting(tenant)).toBe(true);\n });\n\n it('is true when any branch has accounting', () => {\n const tenant = makeTenant([makeBranch(), makeBranch({ id: 'b2', accounting: 'odoo' })]);\n expect(tenantHasAccounting(tenant)).toBe(true);\n });\n\n it('is false when no branch has accounting and tenant flag is not set', () => {\n expect(tenantHasAccounting(makeTenant([makeBranch()]))).toBe(false);\n expect(tenantHasAccounting(undefined)).toBe(false);\n });\n});\n\ndescribe('branchHasAccountingInTenant', () => {\n it('resolves per branch in a mixed tenant', () => {\n const tenant = makeTenant([\n makeBranch({ id: 'odoo-branch', accounting: 'odoo' }),\n makeBranch({ id: 'plain-branch' }),\n ]);\n expect(branchHasAccountingInTenant(tenant, 'odoo-branch')).toBe(true);\n expect(branchHasAccountingInTenant(tenant, 'plain-branch')).toBe(false);\n });\n\n it('ignores the deprecated tenant-wide flag and resolves per branch', () => {\n const tenant = makeTenant([makeBranch({ id: 'plain-branch' })], { exactAccounting: true });\n expect(branchHasAccountingInTenant(tenant, 'plain-branch')).toBe(false);\n });\n\n it('is false for an unknown branch or missing tenant', () => {\n expect(branchHasAccountingInTenant(makeTenant([makeBranch()]), 'nope')).toBe(false);\n expect(branchHasAccountingInTenant(undefined, 'b1')).toBe(false);\n });\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"contacts.d.ts","sourceRoot":"/","sources":["utils/contacts.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,uBAAuB,CAAC;AAO1D,eAAO,MAAM,iBAAiB,GAAI,SAAS;IACzC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,KAAG,MAAM,GAAG,SAKZ,CAAC"}
1
+ {"version":3,"file":"contacts.d.ts","sourceRoot":"/","sources":["utils/contacts.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,uBAAuB,CAAC;AAO1D,eAAO,MAAM,iBAAiB,YAAa;IACzC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,KAAG,MAAM,GAAG,SAKZ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"debtors-dossiers.d.ts","sourceRoot":"/","sources":["utils/debtors-dossiers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjG,eAAO,MAAM,yBAAyB,EAAE,oBAAoB,EAQ3D,CAAC;AAEF,KAAK,YAAY,GAAG;IAClB,aAAa,EAAE,oBAAoB,CAAC;IACpC,eAAe,EAAE,oBAAoB,CAAC;CACvC,CAAC;AAcF,eAAO,MAAM,iBAAiB,GAC5B,eAAe,oBAAoB,KAClC,oBAAoB,GAAG,SAMzB,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,QAAQ,oBAAoB,KAAG,oBAAoB,GAAG,SAMnF,CAAC;AAEF,eAAO,MAAM,0CAA0C,GAAI,OAAO,YAAY,KAAG,OAIhF,CAAC;AAEF,eAAO,MAAM,oCAAoC,GAAI,OAAO,YAAY,KAAG,OAI1E,CAAC;AAEF,eAAO,MAAM,2CAA2C,GAAI,OAAO,YAAY,KAAG,OAIjF,CAAC;AAEF,eAAO,MAAM,qCAAqC,GAAI,OAAO,YAAY,KAAG,OAI3E,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,SAAS,cAAc,KAAG,OACJ,CAAC"}
1
+ {"version":3,"file":"debtors-dossiers.d.ts","sourceRoot":"/","sources":["utils/debtors-dossiers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjG,eAAO,MAAM,yBAAyB,EAAE,oBAAoB,EAQ3D,CAAC;AAEF,KAAK,YAAY,GAAG;IAClB,aAAa,EAAE,oBAAoB,CAAC;IACpC,eAAe,EAAE,oBAAoB,CAAC;CACvC,CAAC;AAcF,eAAO,MAAM,iBAAiB,kBACb,oBAAoB,KAClC,oBAAoB,GAAG,SAMzB,CAAC;AAEF,eAAO,MAAM,aAAa,WAAY,oBAAoB,KAAG,oBAAoB,GAAG,SAMnF,CAAC;AAEF,eAAO,MAAM,0CAA0C,UAAW,YAAY,KAAG,OAIhF,CAAC;AAEF,eAAO,MAAM,oCAAoC,UAAW,YAAY,KAAG,OAI1E,CAAC;AAEF,eAAO,MAAM,2CAA2C,UAAW,YAAY,KAAG,OAIjF,CAAC;AAEF,eAAO,MAAM,qCAAqC,UAAW,YAAY,KAAG,OAI3E,CAAC;AAEF,eAAO,MAAM,iBAAiB,YAAa,cAAc,KAAG,OACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"exchange-rates.d.ts","sourceRoot":"/","sources":["utils/exchange-rates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAU1D,eAAO,MAAM,eAAe,GAC1B,QAAQ,MAAM,EACd,cAAc,MAAM,EACpB,YAAY,MAAM,EAClB,OAAO,YAAY,EAAE,KACpB,MAAM,GAAG,SAgBX,CAAC"}
1
+ {"version":3,"file":"exchange-rates.d.ts","sourceRoot":"/","sources":["utils/exchange-rates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAU1D,eAAO,MAAM,eAAe,WAClB,MAAM,gBACA,MAAM,cACR,MAAM,SACX,YAAY,EAAE,KACpB,MAAM,GAAG,SAgBX,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"forms.d.ts","sourceRoot":"/","sources":["utils/forms.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,eAAO,MAAM,sBAAsB,GACjC,UAAU,MAAM,EAChB,aAAa,MAAM,EACnB,YAAY,MAAM,EAClB,gBAAe,MAAY,EAC3B,OAAM,mBAAoD,KACzD;IAAE,gBAAgB,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAoBpD,CAAC"}
1
+ {"version":3,"file":"forms.d.ts","sourceRoot":"/","sources":["utils/forms.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,eAAO,MAAM,sBAAsB,aACvB,MAAM,eACH,MAAM,cACP,MAAM,kBACH,MAAM,SACf,mBAAmB,KACxB;IAAE,gBAAgB,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAoBpD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"forms.js","sourceRoot":"/","sources":["utils/forms.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,QAAgB,EAChB,WAAmB,EACnB,UAAkB,EAClB,gBAAwB,GAAG,EAC3B,OAA4B,mBAAmB,CAAC,UAAU,EACJ,EAAE;IACxD,MAAM,MAAM,GAAyD;QACnE,gBAAgB,EAAE,UAAU;QAC5B,cAAc,EAAE,aAAa;KAC9B,CAAC;IAEF,IAAI,IAAI,KAAK,mBAAmB,CAAC,UAAU,EAAE,CAAC;QAC5C,MAAM,CAAC,cAAc,GAAG,UAAU,CAAC,QAAQ,EAAE,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;aAC5F,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC;aACrB,QAAQ,EAAE,CAAC;IAChB,CAAC;SAAM,CAAC;QACN,MAAM,CAAC,gBAAgB,GAAG,IAAI,OAAO,CAAC,aAAa,CAAC;aACjD,GAAG,CAAC,GAAG,CAAC;aACR,GAAG,CAAC,WAAW,CAAC;aAChB,eAAe,CAAC,CAAC,CAAC;aAClB,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC;aACb,QAAQ,EAAE,CAAC;IAChB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC","sourcesContent":["import { roundMoney } from '@bisondesk/commons-sdk/money';\nimport { Decimal } from 'decimal.js';\nimport { PricePercentageMode } from '../types/utils.js';\n\nexport const computePricePercentage = (\n currency: string,\n totalAmount: string,\n percentage: string,\n partialAmount: string = '0',\n mode: PricePercentageMode = PricePercentageMode.PERCENTAGE,\n): { percentageAmount: string; currencyAmount: string } => {\n const output: { percentageAmount: string; currencyAmount: string } = {\n percentageAmount: percentage,\n currencyAmount: partialAmount,\n };\n\n if (mode === PricePercentageMode.PERCENTAGE) {\n output.currencyAmount = roundMoney(currency, new Decimal(totalAmount).mul(percentage).div(100))\n .clamp(0, totalAmount)\n .toString();\n } else {\n output.percentageAmount = new Decimal(partialAmount)\n .mul(100)\n .div(totalAmount)\n .toDecimalPlaces(4)\n .clamp(0, 100)\n .toString();\n }\n\n return output;\n};\n"]}
1
+ {"version":3,"file":"forms.js","sourceRoot":"/","sources":["utils/forms.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,QAAgB,EAChB,WAAmB,EACnB,UAAkB,EAClB,aAAa,GAAW,GAAG,EAC3B,IAAI,GAAwB,mBAAmB,CAAC,UAAU,EACJ,EAAE;IACxD,MAAM,MAAM,GAAyD;QACnE,gBAAgB,EAAE,UAAU;QAC5B,cAAc,EAAE,aAAa;KAC9B,CAAC;IAEF,IAAI,IAAI,KAAK,mBAAmB,CAAC,UAAU,EAAE,CAAC;QAC5C,MAAM,CAAC,cAAc,GAAG,UAAU,CAAC,QAAQ,EAAE,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;aAC5F,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC;aACrB,QAAQ,EAAE,CAAC;IAChB,CAAC;SAAM,CAAC;QACN,MAAM,CAAC,gBAAgB,GAAG,IAAI,OAAO,CAAC,aAAa,CAAC;aACjD,GAAG,CAAC,GAAG,CAAC;aACR,GAAG,CAAC,WAAW,CAAC;aAChB,eAAe,CAAC,CAAC,CAAC;aAClB,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC;aACb,QAAQ,EAAE,CAAC;IAChB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC","sourcesContent":["import { roundMoney } from '@bisondesk/commons-sdk/money';\nimport { Decimal } from 'decimal.js';\nimport { PricePercentageMode } from '../types/utils.js';\n\nexport const computePricePercentage = (\n currency: string,\n totalAmount: string,\n percentage: string,\n partialAmount: string = '0',\n mode: PricePercentageMode = PricePercentageMode.PERCENTAGE,\n): { percentageAmount: string; currencyAmount: string } => {\n const output: { percentageAmount: string; currencyAmount: string } = {\n percentageAmount: percentage,\n currencyAmount: partialAmount,\n };\n\n if (mode === PricePercentageMode.PERCENTAGE) {\n output.currencyAmount = roundMoney(currency, new Decimal(totalAmount).mul(percentage).div(100))\n .clamp(0, totalAmount)\n .toString();\n } else {\n output.percentageAmount = new Decimal(partialAmount)\n .mul(100)\n .div(totalAmount)\n .toDecimalPlaces(4)\n .clamp(0, 100)\n .toString();\n }\n\n return output;\n};\n"]}
@@ -1,2 +1,2 @@
1
- export declare const guessDrivingCabFromTitle: (title: string) => "Sleep / Large" | "Sleep / Medium" | "Day" | undefined;
1
+ export declare const guessDrivingCabFromTitle: (title: string) => 'Sleep / Large' | 'Sleep / Medium' | 'Day' | undefined;
2
2
  //# sourceMappingURL=vehicles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"vehicles.d.ts","sourceRoot":"/","sources":["utils/integrations/vehicles.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,GACnC,OAAO,MAAM,KACZ,eAAe,GAAG,gBAAgB,GAAG,KAAK,GAAG,SAsF/C,CAAC"}
1
+ {"version":3,"file":"vehicles.d.ts","sourceRoot":"/","sources":["utils/integrations/vehicles.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,UAC5B,MAAM,KACZ,eAAe,GAAG,gBAAgB,GAAG,KAAK,GAAG,SAsF/C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"interests.d.ts","sourceRoot":"/","sources":["utils/interests.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,eAAO,MAAM,oBAAoB,GAC/B,QAAQ,MAAM,EACd,qBAAqB,mBAAmB,EACxC,gBAAe,IAAoB,KAClC,QA0CF,CAAC"}
1
+ {"version":3,"file":"interests.d.ts","sourceRoot":"/","sources":["utils/interests.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,eAAO,MAAM,oBAAoB,WACvB,MAAM,uBACO,mBAAmB,kBACzB,IAAI,KAClB,QA0CF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"interests.js","sourceRoot":"/","sources":["utils/interests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EA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IAAI,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAEvF,MAAM,eAAe,GAAG,CACtB,mBAAwC,EACxC,UAAkB,EACE,EAAE;IACtB,MAAM,aAAa,GAAG,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,IAAI,IAAI,CAAC;IAChF,MAAM,qBAAqB,GAAG,cAAc,CAAC,mBAAmB,CAAC,CAAC;IAElE,IAAI,aAAa,IAAI,qBAAqB,EAAE,CAAC;QAC3C,OAAO,OAAO,CAAC,CAAC,EAAE,mBAAmB,CAAC,UAAW,CAAC,MAAO,CAAC,KAAM,CAAC,EAAG,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;IAC3F,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,OAAO,GAAG,CAAC,CAAS,EAAE,KAAuB,EAAE,MAAc,QAAQ,EAAE,EAAE,CAC7E,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAE9E,MAAM,OAAO,GAAG,CAAC,KAAc,EAAY,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC","sourcesContent":["import { isoString } from '@bisondesk/commons-sdk/date-utils';\nimport { generateId } from '@bisondesk/commons-sdk/ids';\nimport { UTCDate } from '@date-fns/utc';\nimport { first, range, uniq } from 'lodash-es';\nimport { KM_ROUNDING, MAX_AGE, MAX_KM, MAX_PRICE, PRICE_ROUNDING } from '../constants.js';\nimport { Interest } from '../types/interests.js';\nimport { VehicleExternalInfo } from '../types/vehicles.js';\n\nexport const mapVehicleToInterest = (\n userId: string,\n vehicleExternalInfo: VehicleExternalInfo,\n referenceDate: Date = new UTCDate(),\n): Interest => {\n return {\n id: generateId(),\n createdAt: isoString(),\n createdBy: userId,\n modifiedAt: isoString(),\n modifiedBy: userId,\n bodystyle: vehicleExternalInfo.general.bodystyle,\n cabins: toCabins(toArray(vehicleExternalInfo.body?.cabin?.type)),\n category: vehicleExternalInfo.general.category,\n hydraulicTipperKit: vehicleExternalInfo.accessories.hydraulicTipperKit ? true : undefined,\n retarderIntarder: vehicleExternalInfo.accessories.retarderIntarder ? true : undefined,\n adr: vehicleExternalInfo.accessories.adr,\n damaged: vehicleExternalInfo.condition?.damaged ?? false,\n extended: toArray(vehicleExternalInfo.superstructure?.dimensions?.extended),\n heightened: toArray(vehicleExternalInfo.superstructure?.dimensions?.heightened),\n used: vehicleExternalInfo.condition?.used,\n crane: vehicleExternalInfo.superstructure?.crane?.present,\n tailgate: vehicleExternalInfo.superstructure?.tailgate?.present,\n axleConfigurations: toArray(vehicleExternalInfo.powertrain?.axles?.configuration),\n suspensions: toSuspensions(toArray(vehicleExternalInfo.powertrain?.axles?.suspension)),\n transmissions: toTransmissions(toArray(vehicleExternalInfo.powertrain?.transmission?.type)),\n euronorms: toEuronorms(vehicleExternalInfo),\n kilometers: vehicleExternalInfo.condition?.used\n ? toRound(KM_ROUNDING, vehicleExternalInfo.condition?.odometer?.km, MAX_KM)\n : undefined,\n horsepower: toMinHorsepower(vehicleExternalInfo, -0.1),\n versions:\n vehicleExternalInfo.general.make != null\n ? [\n {\n make: vehicleExternalInfo.general.make,\n models: toArray(vehicleExternalInfo.general.model),\n },\n ]\n : undefined,\n price: toMaxPrice(vehicleExternalInfo.salesConditions.price),\n age: vehicleExternalInfo.condition?.used\n ? toAge(referenceDate, vehicleExternalInfo.history?.advertisingYear)\n : undefined,\n autoGenerated: true,\n };\n};\n\nconst isHeavyVehicle = (vehicleExternalInfo: VehicleExternalInfo) =>\n ['Tractor Head', 'Truck'].includes(vehicleExternalInfo.general.category);\n\nconst toCabins = (values: string[] | undefined): string[] | undefined => {\n if (values == null || values.length === 0) {\n return;\n }\n\n if (values.some((v) => v.startsWith('Sleep'))) {\n // If it allows sleep, then add the two largest sleep options as well\n return uniq([...values, 'Sleep / Medium', 'Sleep / Large']);\n }\n\n return values;\n};\n\nconst toSuspensions = (values: string[] | undefined): string[] | undefined => {\n if (values == null || values.length === 0) {\n return;\n }\n\n if (values.includes('Air/Steel')) {\n // If it allows some axles with air suspension, then allow all\n return uniq([...values, 'Air']);\n }\n\n return values;\n};\n\nconst toTransmissions = (values: string[] | undefined): string[] | undefined => {\n if (values == null || values.length === 0) {\n return;\n }\n\n if (values.includes('Manual')) {\n // ignore transmission restriction\n return;\n }\n\n if (values.includes('Semi-Automatic')) {\n // also consider values that are better\n return uniq([...values, 'Automatic']);\n }\n\n return values;\n};\n\nconst toEuronorms = (vehicleExternalInfo: VehicleExternalInfo): string[] | undefined => {\n const values = toArray(vehicleExternalInfo.powertrain?.emissions?.class);\n if (values == null || values.length === 0 || !isHeavyVehicle(vehicleExternalInfo)) {\n return;\n }\n\n const minEuronorm = 5;\n const maxEuronorm = 6;\n\n const lowestEuronorm = first(values.map((v) => Number(v.charAt(v.length - 1))).sort())!;\n if (lowestEuronorm < minEuronorm) {\n return; // ignore Euronorm restriction\n }\n\n return range(lowestEuronorm, maxEuronorm + 1).map((r) => `Euro ${r}`);\n};\n\nconst toAge = (referenceDate: Date, year?: number) => {\n if (year == null) {\n return;\n }\n\n if (year > referenceDate.getUTCFullYear()) {\n return;\n }\n\n return toRound(1, referenceDate.getUTCFullYear() - year, MAX_AGE);\n};\n\nconst toMaxPrice = (value?: number | string) =>\n value != null ? toRound(PRICE_ROUNDING, Number(value) * 1.15, MAX_PRICE) : undefined;\n\nconst toMinHorsepower = (\n vehicleExternalInfo: VehicleExternalInfo,\n shiftRatio: number,\n): number | undefined => {\n const hasHorsepower = vehicleExternalInfo.powertrain?.engine?.power?.hp != null;\n const isHorsepowerImportant = isHeavyVehicle(vehicleExternalInfo);\n\n if (hasHorsepower && isHorsepowerImportant) {\n return toRound(5, vehicleExternalInfo.powertrain!.engine!.power!.hp! * (1 + shiftRatio));\n }\n};\n\nconst toRound = (r: number, value?: number | string, max: number = Infinity) =>\n value != null ? Math.min(Math.ceil(Number(value) / r) * r, max) : undefined;\n\nconst toArray = (value?: string): string[] => (value ? [value] : []);\n"]}
1
+ {"version":3,"file":"interests.js","sourceRoot":"/","sources":["utils/interests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAI1F,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,MAAc,EACd,mBAAwC,EACxC,aAAa,GAAS,IAAI,OAAO,EAAE,EACzB,EAAE;IACZ,OAAO;QACL,EAAE,EAAE,UAAU,EAAE;QAChB,SAAS,EAAE,SAAS,EAAE;QACtB,SAAS,EAAE,MAAM;QACjB,UAAU,EAAE,SAAS,EAAE;QACvB,UAAU,EAAE,MAAM;QAClB,SAAS,EAAE,mBAAmB,CAAC,OAAO,CAAC,SAAS;QAChD,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,mBAAmB,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QAChE,QAAQ,EAAE,mBAAmB,CAAC,OAAO,CAAC,QAAQ;QAC9C,kBAAkB,EAAE,mBAAmB,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,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KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAE9E,MAAM,OAAO,GAAG,CAAC,KAAc,EAAY,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC","sourcesContent":["import { isoString } from '@bisondesk/commons-sdk/date-utils';\nimport { generateId } from '@bisondesk/commons-sdk/ids';\nimport { UTCDate } from '@date-fns/utc';\nimport { first, range, uniq } from 'lodash-es';\nimport { KM_ROUNDING, MAX_AGE, MAX_KM, MAX_PRICE, PRICE_ROUNDING } from '../constants.js';\nimport { Interest } from '../types/interests.js';\nimport { VehicleExternalInfo } from '../types/vehicles.js';\n\nexport const mapVehicleToInterest = (\n userId: string,\n vehicleExternalInfo: VehicleExternalInfo,\n referenceDate: Date = new UTCDate(),\n): Interest => {\n return {\n id: generateId(),\n createdAt: isoString(),\n createdBy: userId,\n modifiedAt: isoString(),\n modifiedBy: userId,\n bodystyle: vehicleExternalInfo.general.bodystyle,\n cabins: toCabins(toArray(vehicleExternalInfo.body?.cabin?.type)),\n category: vehicleExternalInfo.general.category,\n hydraulicTipperKit: vehicleExternalInfo.accessories.hydraulicTipperKit ? true : undefined,\n retarderIntarder: vehicleExternalInfo.accessories.retarderIntarder ? true : undefined,\n adr: vehicleExternalInfo.accessories.adr,\n damaged: vehicleExternalInfo.condition?.damaged ?? false,\n extended: toArray(vehicleExternalInfo.superstructure?.dimensions?.extended),\n heightened: toArray(vehicleExternalInfo.superstructure?.dimensions?.heightened),\n used: vehicleExternalInfo.condition?.used,\n crane: vehicleExternalInfo.superstructure?.crane?.present,\n tailgate: vehicleExternalInfo.superstructure?.tailgate?.present,\n axleConfigurations: toArray(vehicleExternalInfo.powertrain?.axles?.configuration),\n suspensions: toSuspensions(toArray(vehicleExternalInfo.powertrain?.axles?.suspension)),\n transmissions: toTransmissions(toArray(vehicleExternalInfo.powertrain?.transmission?.type)),\n euronorms: toEuronorms(vehicleExternalInfo),\n kilometers: vehicleExternalInfo.condition?.used\n ? toRound(KM_ROUNDING, vehicleExternalInfo.condition?.odometer?.km, MAX_KM)\n : undefined,\n horsepower: toMinHorsepower(vehicleExternalInfo, -0.1),\n versions:\n vehicleExternalInfo.general.make != null\n ? [\n {\n make: vehicleExternalInfo.general.make,\n models: toArray(vehicleExternalInfo.general.model),\n },\n ]\n : undefined,\n price: toMaxPrice(vehicleExternalInfo.salesConditions.price),\n age: vehicleExternalInfo.condition?.used\n ? toAge(referenceDate, vehicleExternalInfo.history?.advertisingYear)\n : undefined,\n autoGenerated: true,\n };\n};\n\nconst isHeavyVehicle = (vehicleExternalInfo: VehicleExternalInfo) =>\n ['Tractor Head', 'Truck'].includes(vehicleExternalInfo.general.category);\n\nconst toCabins = (values: string[] | undefined): string[] | undefined => {\n if (values == null || values.length === 0) {\n return;\n }\n\n if (values.some((v) => v.startsWith('Sleep'))) {\n // If it allows sleep, then add the two largest sleep options as well\n return uniq([...values, 'Sleep / Medium', 'Sleep / Large']);\n }\n\n return values;\n};\n\nconst toSuspensions = (values: string[] | undefined): string[] | undefined => {\n if (values == null || values.length === 0) {\n return;\n }\n\n if (values.includes('Air/Steel')) {\n // If it allows some axles with air suspension, then allow all\n return uniq([...values, 'Air']);\n }\n\n return values;\n};\n\nconst toTransmissions = (values: string[] | undefined): string[] | undefined => {\n if (values == null || values.length === 0) {\n return;\n }\n\n if (values.includes('Manual')) {\n // ignore transmission restriction\n return;\n }\n\n if (values.includes('Semi-Automatic')) {\n // also consider values that are better\n return uniq([...values, 'Automatic']);\n }\n\n return values;\n};\n\nconst toEuronorms = (vehicleExternalInfo: VehicleExternalInfo): string[] | undefined => {\n const values = toArray(vehicleExternalInfo.powertrain?.emissions?.class);\n if (values == null || values.length === 0 || !isHeavyVehicle(vehicleExternalInfo)) {\n return;\n }\n\n const minEuronorm = 5;\n const maxEuronorm = 6;\n\n const lowestEuronorm = first(values.map((v) => Number(v.charAt(v.length - 1))).sort())!;\n if (lowestEuronorm < minEuronorm) {\n return; // ignore Euronorm restriction\n }\n\n return range(lowestEuronorm, maxEuronorm + 1).map((r) => `Euro ${r}`);\n};\n\nconst toAge = (referenceDate: Date, year?: number) => {\n if (year == null) {\n return;\n }\n\n if (year > referenceDate.getUTCFullYear()) {\n return;\n }\n\n return toRound(1, referenceDate.getUTCFullYear() - year, MAX_AGE);\n};\n\nconst toMaxPrice = (value?: number | string) =>\n value != null ? toRound(PRICE_ROUNDING, Number(value) * 1.15, MAX_PRICE) : undefined;\n\nconst toMinHorsepower = (\n vehicleExternalInfo: VehicleExternalInfo,\n shiftRatio: number,\n): number | undefined => {\n const hasHorsepower = vehicleExternalInfo.powertrain?.engine?.power?.hp != null;\n const isHorsepowerImportant = isHeavyVehicle(vehicleExternalInfo);\n\n if (hasHorsepower && isHorsepowerImportant) {\n return toRound(5, vehicleExternalInfo.powertrain!.engine!.power!.hp! * (1 + shiftRatio));\n }\n};\n\nconst toRound = (r: number, value?: number | string, max: number = Infinity) =>\n value != null ? Math.min(Math.ceil(Number(value) / r) * r, max) : undefined;\n\nconst toArray = (value?: string): string[] => (value ? [value] : []);\n"]}
@@ -2,7 +2,7 @@ import { Decimal } from 'decimal.js';
2
2
  import { ConditionsRef, LeasingContract, LeasingContractClient, OpportunityRef } from '../types/leasing.js';
3
3
  import { CustomLeasingQuoteExtraInput, LeasingItemsPaymentSplit } from '../types/leasing-settings.js';
4
4
  export declare const sortContractClients: (clients: LeasingContractClient[]) => LeasingContractClient[];
5
- export declare const getDealRef: ({ conditions, opportunities, }: Pick<LeasingContract, "conditions" | "opportunities">) => ConditionsRef | OpportunityRef;
5
+ export declare const getDealRef: ({ conditions, opportunities, }: Pick<LeasingContract, 'conditions' | 'opportunities'>) => ConditionsRef | OpportunityRef;
6
6
  export declare const getItemClientPercentage: (value: LeasingItemsPaymentSplit) => Decimal;
7
7
  export declare const getLeasingExtrasTotal: (extras: CustomLeasingQuoteExtraInput[]) => Decimal;
8
8
  //# sourceMappingURL=leasing.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"leasing.d.ts","sourceRoot":"/","sources":["utils/leasing.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,OAAO,EACL,aAAa,EACb,eAAe,EACf,qBAAqB,EACrB,cAAc,EACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,4BAA4B,EAC5B,wBAAwB,EACzB,MAAM,8BAA8B,CAAC;AAGtC,eAAO,MAAM,mBAAmB,GAAI,SAAS,qBAAqB,EAAE,KAAG,qBAAqB,EAQzF,CAAC;AAEJ,eAAO,MAAM,UAAU,GAAI,gCAGxB,IAAI,CAAC,eAAe,EAAE,YAAY,GAAG,eAAe,CAAC,KAAG,aAAa,GAAG,cACjC,CAAC;AAE3C,eAAO,MAAM,uBAAuB,GAAI,OAAO,wBAAwB,KAAG,OAUzE,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,QAAQ,4BAA4B,EAAE,YAc3E,CAAC"}
1
+ {"version":3,"file":"leasing.d.ts","sourceRoot":"/","sources":["utils/leasing.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,OAAO,EACL,aAAa,EACb,eAAe,EACf,qBAAqB,EACrB,cAAc,EACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,4BAA4B,EAC5B,wBAAwB,EACzB,MAAM,8BAA8B,CAAC;AAGtC,eAAO,MAAM,mBAAmB,YAAa,qBAAqB,EAAE,KAAG,qBAAqB,EAQzF,CAAC;AAEJ,eAAO,MAAM,UAAU,mCAGpB,IAAI,CAAC,eAAe,EAAE,YAAY,GAAG,eAAe,CAAC,KAAG,aAAa,GAAG,cACjC,CAAC;AAE3C,eAAO,MAAM,uBAAuB,UAAW,wBAAwB,KAAG,OAUzE,CAAC;AAEF,eAAO,MAAM,qBAAqB,WAAY,4BAA4B,EAAE,YAc3E,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"offers.d.ts","sourceRoot":"/","sources":["utils/offers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAoB,MAAM,oBAAoB,CAAC;AAEnE,KAAK,YAAY,GAAG;IAClB,aAAa,EAAE,WAAW,CAAC;IAC3B,eAAe,EAAE,WAAW,CAAC;CAC9B,CAAC;AAcF,eAAO,MAAM,iCAAiC,GAAI,OAAO,YAAY,KAAG,OAIvE,CAAC;AAEF,eAAO,MAAM,2BAA2B,GAAI,OAAO,YAAY,KAAG,OAIjE,CAAC;AAEF,eAAO,MAAM,kCAAkC,GAAI,OAAO,YAAY,KAAG,OAIxE,CAAC;AAEF,eAAO,MAAM,4BAA4B,GAAI,OAAO,YAAY,KAAG,OAIlE,CAAC"}
1
+ {"version":3,"file":"offers.d.ts","sourceRoot":"/","sources":["utils/offers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAoB,MAAM,oBAAoB,CAAC;AAEnE,KAAK,YAAY,GAAG;IAClB,aAAa,EAAE,WAAW,CAAC;IAC3B,eAAe,EAAE,WAAW,CAAC;CAC9B,CAAC;AAcF,eAAO,MAAM,iCAAiC,UAAW,YAAY,KAAG,OAIvE,CAAC;AAEF,eAAO,MAAM,2BAA2B,UAAW,YAAY,KAAG,OAIjE,CAAC;AAEF,eAAO,MAAM,kCAAkC,UAAW,YAAY,KAAG,OAIxE,CAAC;AAEF,eAAO,MAAM,4BAA4B,UAAW,YAAY,KAAG,OAIlE,CAAC"}
@@ -11,6 +11,7 @@ export declare const isSameOrBeforeReferenceOpportunityStatus: (input: CompareIn
11
11
  export declare const isBeforeReferenceOpportunityStatus: (input: CompareInput) => boolean;
12
12
  export declare const isOpportunityLost: (input: Opportunity) => boolean;
13
13
  export declare const isOpportunityClosed: (input: Opportunity) => boolean;
14
+ export declare const isOpportunityDelivered: (input: Opportunity) => boolean;
14
15
  export declare const getOpportunityReservedStatus: () => OpportunityStatus[];
15
16
  export declare const isOpportunityReserved: (input: Opportunity) => boolean;
16
17
  export declare const isOpportunityReservingVehicle: (input: Opportunity) => boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"opportunities.d.ts","sourceRoot":"/","sources":["utils/opportunities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAA0B,MAAM,2BAA2B,CAAC;AAEnG,KAAK,YAAY,GAAG;IAClB,aAAa,EAAE,iBAAiB,CAAC;IACjC,eAAe,EAAE,iBAAiB,CAAC;CACpC,CAAC;AAcF,eAAO,MAAM,iBAAiB,GAC5B,eAAe,iBAAiB,KAC/B,iBAAiB,GAAG,SAMtB,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,QAAQ,iBAAiB,KAAG,iBAAiB,GAAG,SAM7E,CAAC;AAEF,eAAO,MAAM,uCAAuC,GAAI,OAAO,YAAY,KAAG,OAI7E,CAAC;AAEF,eAAO,MAAM,iCAAiC,GAAI,OAAO,YAAY,KAAG,OAIvE,CAAC;AAEF,eAAO,MAAM,wCAAwC,GAAI,OAAO,YAAY,KAAG,OAI9E,CAAC;AAEF,eAAO,MAAM,kCAAkC,GAAI,OAAO,YAAY,KAAG,OAIxE,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,OAAO,WAAW,KAAG,OAA+B,CAAC;AAEvF,eAAO,MAAM,mBAAmB,GAAI,OAAO,WAAW,KAAG,OACZ,CAAC;AAE9C,eAAO,MAAM,4BAA4B,QAAO,iBAAiB,EAIhE,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,OAAO,WAAW,KAAG,OACJ,CAAC;AASxD,eAAO,MAAM,6BAA6B,GAAI,OAAO,WAAW,KAAG,OACR,CAAC;AAO5D,eAAO,MAAM,+BAA+B,GAC1C,OAAO,WAAW,GAAG,SAAS,KAC7B,MAAM,GAAG,SACyE,CAAC"}
1
+ {"version":3,"file":"opportunities.d.ts","sourceRoot":"/","sources":["utils/opportunities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAA0B,MAAM,2BAA2B,CAAC;AAEnG,KAAK,YAAY,GAAG;IAClB,aAAa,EAAE,iBAAiB,CAAC;IACjC,eAAe,EAAE,iBAAiB,CAAC;CACpC,CAAC;AAcF,eAAO,MAAM,iBAAiB,kBACb,iBAAiB,KAC/B,iBAAiB,GAAG,SAMtB,CAAC;AAEF,eAAO,MAAM,aAAa,WAAY,iBAAiB,KAAG,iBAAiB,GAAG,SAM7E,CAAC;AAEF,eAAO,MAAM,uCAAuC,UAAW,YAAY,KAAG,OAI7E,CAAC;AAEF,eAAO,MAAM,iCAAiC,UAAW,YAAY,KAAG,OAIvE,CAAC;AAEF,eAAO,MAAM,wCAAwC,UAAW,YAAY,KAAG,OAI9E,CAAC;AAEF,eAAO,MAAM,kCAAkC,UAAW,YAAY,KAAG,OAIxE,CAAC;AAEF,eAAO,MAAM,iBAAiB,UAAW,WAAW,KAAG,OAA+B,CAAC;AAEvF,eAAO,MAAM,mBAAmB,UAAW,WAAW,KAAG,OACZ,CAAC;AAO9C,eAAO,MAAM,sBAAsB,UAAW,WAAW,KAAG,OAIxD,CAAC;AAEL,eAAO,MAAM,4BAA4B,QAAO,iBAAiB,EAIhE,CAAC;AAEF,eAAO,MAAM,qBAAqB,UAAW,WAAW,KAAG,OACJ,CAAC;AAUxD,eAAO,MAAM,6BAA6B,UAAW,WAAW,KAAG,OACR,CAAC;AAO5D,eAAO,MAAM,+BAA+B,UACnC,WAAW,GAAG,SAAS,KAC7B,MAAM,GAAG,SACyE,CAAC"}
@@ -40,6 +40,10 @@ export const isBeforeReferenceOpportunityStatus = (input) => {
40
40
  };
41
41
  export const isOpportunityLost = (input) => input.lostAt != null;
42
42
  export const isOpportunityClosed = (input) => input.lostAt != null || input.wonAt != null;
43
+ export const isOpportunityDelivered = (input) => isSameOrAfterReferenceOpportunityStatus({
44
+ currentStatus: input.status,
45
+ referenceStatus: OpportunityStatus.DELIVERY,
46
+ });
43
47
  export const getOpportunityReservedStatus = () => [
44
48
  OpportunityStatus.REVIEW,
45
49
  OpportunityStatus.PREPARATION,
@@ -1 +1 @@
1
- {"version":3,"file":"opportunities.js","sourceRoot":"/","sources":["utils/opportunities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAOnG,MAAM,wBAAwB,GAAG,CAAC,KAAmB,EAAE,EAAE;IACvD,MAAM,EAAE,aAAa,EAAE,eAAe,EAAE,GAAG,KAAK,CAAC;IAEjD,MAAM,gBAAgB,GAAG,sBAAsB,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IACvE,MAAM,kBAAkB,GAAG,sBAAsB,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAE3E,OAAO;QACL,gBAAgB;QAChB,kBAAkB;KACnB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,aAAgC,EACD,EAAE;IACjC,MAAM,YAAY,GAAG,sBAAsB,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IACnE,IAAI,YAAY,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO;IACT,CAAC;IACD,OAAO,sBAAsB,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC;AAClD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAAyB,EAAiC,EAAE;IACxF,MAAM,WAAW,GAAG,sBAAsB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC3D,IAAI,WAAW,IAAI,sBAAsB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrD,OAAO;IACT,CAAC;IACD,OAAO,sBAAsB,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC;AACjD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,uCAAuC,GAAG,CAAC,KAAmB,EAAW,EAAE;IACtF,MAAM,EAAE,gBAAgB,E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AE,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AASxD,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,KAAkB,EAAW,EAAE,CAC3E,qBAAqB,CAAC,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;AAO5D,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAC7C,KAA8B,EACV,EAAE,CACtB,KAAK,IAAI,IAAI,IAAI,6BAA6B,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC","sourcesContent":["import { Opportunity, OpportunityStatus, OpportunityStatusOrder } from '../types/opportunities.js';\n\ntype CompareInput = {\n currentStatus: OpportunityStatus;\n referenceStatus: OpportunityStatus;\n};\n\nconst compareOpportunityStatus = (input: CompareInput) => {\n const { currentStatus, referenceStatus } = input;\n\n const currentStatusIdx = OpportunityStatusOrder.indexOf(currentStatus);\n const referenceStatusIdx = OpportunityStatusOrder.indexOf(referenceStatus);\n\n return {\n currentStatusIdx,\n referenceStatusIdx,\n };\n};\n\nexport const getPreviousStatus = (\n currentStatus: OpportunityStatus,\n): OpportunityStatus | undefined => {\n const currentIndex = OpportunityStatusOrder.indexOf(currentStatus);\n if (currentIndex === 0) {\n return;\n }\n return OpportunityStatusOrder[currentIndex - 1];\n};\n\nexport const getNextStatus = (status: OpportunityStatus): OpportunityStatus | undefined => {\n const statusIndex = OpportunityStatusOrder.indexOf(status);\n if (statusIndex >= OpportunityStatusOrder.length - 1) {\n return;\n }\n return OpportunityStatusOrder[statusIndex + 1];\n};\n\nexport const isSameOrAfterReferenceOpportunityStatus = (input: CompareInput): boolean => {\n const { currentStatusIdx, referenceStatusIdx } = compareOpportunityStatus(input);\n\n return currentStatusIdx >= referenceStatusIdx;\n};\n\nexport const isAfterReferenceOpportunityStatus = (input: CompareInput): boolean => {\n const { currentStatusIdx, referenceStatusIdx } = compareOpportunityStatus(input);\n\n return currentStatusIdx > referenceStatusIdx;\n};\n\nexport const isSameOrBeforeReferenceOpportunityStatus = (input: CompareInput): boolean => {\n const { currentStatusIdx, referenceStatusIdx } = compareOpportunityStatus(input);\n\n return currentStatusIdx <= referenceStatusIdx;\n};\n\nexport const isBeforeReferenceOpportunityStatus = (input: CompareInput): boolean => {\n const { currentStatusIdx, referenceStatusIdx } = compareOpportunityStatus(input);\n\n return currentStatusIdx < referenceStatusIdx;\n};\n\nexport const isOpportunityLost = (input: Opportunity): boolean => input.lostAt != null;\n\nexport const isOpportunityClosed = (input: Opportunity): boolean =>\n input.lostAt != null || input.wonAt != null;\n\nexport const getOpportunityReservedStatus = (): OpportunityStatus[] => [\n OpportunityStatus.REVIEW,\n OpportunityStatus.PREPARATION,\n OpportunityStatus.DELIVERY,\n];\n\nexport const isOpportunityReserved = (input: Opportunity): boolean =>\n getOpportunityReservedStatus().includes(input.status);\n\n/**\n * Whether the opportunity currently reserves the vehicle attached to it: reserved-stage\n * (REVIEW onwards) and not lost — independent of whether a reservation row exists. Query-side\n * twin: `getOpportunityReservingVehicle` in core's opportunities/read.ts. Availability\n * propagation, warnings and guards must share this one definition rather than re-composing\n * the two primitives.\n */\nexport const isOpportunityReservingVehicle = (input: Opportunity): boolean =>\n isOpportunityReserved(input) && !isOpportunityLost(input);\n\n/**\n * The vehicle the opportunity currently reserves, if any — undefined outside the reserved\n * range, when lost, without a vehicle, or for a missing opportunity. Compare this value\n * before/after an update to detect a vehicle being taken or freed.\n */\nexport const getOpportunityReservedVehicleId = (\n input: Opportunity | undefined,\n): string | undefined =>\n input != null && isOpportunityReservingVehicle(input) ? input.vehicleId : undefined;\n"]}
1
+ {"version":3,"file":"opportunities.js","sourceRoot":"/","sources":["utils/opportunities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAOnG,MAAM,wBAAwB,GAAG,CAAC,KAAmB,EAAE,EAAE;IACvD,MAAM,EA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,CAAC,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;AAO5D,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAC7C,KAA8B,EACV,EAAE,CACtB,KAAK,IAAI,IAAI,IAAI,6BAA6B,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC","sourcesContent":["import { Opportunity, OpportunityStatus, OpportunityStatusOrder } from '../types/opportunities.js';\n\ntype CompareInput = {\n currentStatus: OpportunityStatus;\n referenceStatus: OpportunityStatus;\n};\n\nconst compareOpportunityStatus = (input: CompareInput) => {\n const { currentStatus, referenceStatus } = input;\n\n const currentStatusIdx = OpportunityStatusOrder.indexOf(currentStatus);\n const referenceStatusIdx = OpportunityStatusOrder.indexOf(referenceStatus);\n\n return {\n currentStatusIdx,\n referenceStatusIdx,\n };\n};\n\nexport const getPreviousStatus = (\n currentStatus: OpportunityStatus,\n): OpportunityStatus | undefined => {\n const currentIndex = OpportunityStatusOrder.indexOf(currentStatus);\n if (currentIndex === 0) {\n return;\n }\n return OpportunityStatusOrder[currentIndex - 1];\n};\n\nexport const getNextStatus = (status: OpportunityStatus): OpportunityStatus | undefined => {\n const statusIndex = OpportunityStatusOrder.indexOf(status);\n if (statusIndex >= OpportunityStatusOrder.length - 1) {\n return;\n }\n return OpportunityStatusOrder[statusIndex + 1];\n};\n\nexport const isSameOrAfterReferenceOpportunityStatus = (input: CompareInput): boolean => {\n const { currentStatusIdx, referenceStatusIdx } = compareOpportunityStatus(input);\n\n return currentStatusIdx >= referenceStatusIdx;\n};\n\nexport const isAfterReferenceOpportunityStatus = (input: CompareInput): boolean => {\n const { currentStatusIdx, referenceStatusIdx } = compareOpportunityStatus(input);\n\n return currentStatusIdx > referenceStatusIdx;\n};\n\nexport const isSameOrBeforeReferenceOpportunityStatus = (input: CompareInput): boolean => {\n const { currentStatusIdx, referenceStatusIdx } = compareOpportunityStatus(input);\n\n return currentStatusIdx <= referenceStatusIdx;\n};\n\nexport const isBeforeReferenceOpportunityStatus = (input: CompareInput): boolean => {\n const { currentStatusIdx, referenceStatusIdx } = compareOpportunityStatus(input);\n\n return currentStatusIdx < referenceStatusIdx;\n};\n\nexport const isOpportunityLost = (input: Opportunity): boolean => input.lostAt != null;\n\nexport const isOpportunityClosed = (input: Opportunity): boolean =>\n input.lostAt != null || input.wonAt != null;\n\n/**\n * A finished sale: the deal reached delivery. The intercompany coordination reads it as \"the\n * truck already crossed\" — never adopted into (a won deal's link stays live forever), never\n * worth linking after the fact, and nothing left to secure at the source.\n */\nexport const isOpportunityDelivered = (input: Opportunity): boolean =>\n isSameOrAfterReferenceOpportunityStatus({\n currentStatus: input.status,\n referenceStatus: OpportunityStatus.DELIVERY,\n });\n\nexport const getOpportunityReservedStatus = (): OpportunityStatus[] => [\n OpportunityStatus.REVIEW,\n OpportunityStatus.PREPARATION,\n OpportunityStatus.DELIVERY,\n];\n\nexport const isOpportunityReserved = (input: Opportunity): boolean =>\n getOpportunityReservedStatus().includes(input.status);\n\n/**\n * Whether the opportunity currently reserves the vehicle attached to it: reserved-stage\n * (REVIEW onwards) and not lost — independent of whether a reservation row exists. Query-side\n * twin: `getOpportunityReservingVehicle` in core's opportunities/vehicle-reserved/read.ts.\n * Availability\n * propagation, warnings and guards must share this one definition rather than re-composing\n * the two primitives.\n */\nexport const isOpportunityReservingVehicle = (input: Opportunity): boolean =>\n isOpportunityReserved(input) && !isOpportunityLost(input);\n\n/**\n * The vehicle the opportunity currently reserves, if any — undefined outside the reserved\n * range, when lost, without a vehicle, or for a missing opportunity. Compare this value\n * before/after an update to detect a vehicle being taken or freed.\n */\nexport const getOpportunityReservedVehicleId = (\n input: Opportunity | undefined,\n): string | undefined =>\n input != null && isOpportunityReservingVehicle(input) ? input.vehicleId : undefined;\n"]}