@bisondesk/core-sdk 1.0.594 → 1.0.597
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/apis/country-delivery.d.ts +3 -0
- package/lib/apis/country-delivery.d.ts.map +1 -0
- package/lib/apis/{country-pricing.js → country-delivery.js} +3 -3
- package/lib/apis/country-delivery.js.map +1 -0
- package/lib/types/country-delivery.d.ts +18 -0
- package/lib/types/country-delivery.d.ts.map +1 -0
- package/lib/types/country-delivery.js +2 -0
- package/lib/types/country-delivery.js.map +1 -0
- package/lib/types/exchange-rates.d.ts +6 -0
- package/lib/types/exchange-rates.d.ts.map +1 -0
- package/lib/types/exchange-rates.js +2 -0
- package/lib/types/exchange-rates.js.map +1 -0
- package/lib/types/opportunities.d.ts +2 -0
- package/lib/types/opportunities.d.ts.map +1 -1
- package/lib/types/opportunities.js.map +1 -1
- package/lib/types/quote-settings.d.ts +4 -0
- package/lib/types/quote-settings.d.ts.map +1 -1
- package/lib/types/quote-settings.js.map +1 -1
- package/lib/types/user-performance.d.ts +1 -0
- package/lib/types/user-performance.d.ts.map +1 -1
- package/lib/types/user-performance.js.map +1 -1
- package/lib/types/vehicles.d.ts +12 -7
- package/lib/types/vehicles.d.ts.map +1 -1
- package/lib/types/vehicles.js.map +1 -1
- package/lib/utils/exchange-rates.d.ts +3 -0
- package/lib/utils/exchange-rates.d.ts.map +1 -0
- package/lib/utils/exchange-rates.js +15 -0
- package/lib/utils/exchange-rates.js.map +1 -0
- package/lib/utils/exchange-rates.test.d.ts +2 -0
- package/lib/utils/exchange-rates.test.d.ts.map +1 -0
- package/lib/utils/exchange-rates.test.js +23 -0
- package/lib/utils/exchange-rates.test.js.map +1 -0
- package/lib/utils/vehicles.d.ts.map +1 -1
- package/lib/utils/vehicles.js +8 -0
- package/lib/utils/vehicles.js.map +1 -1
- package/package.json +1 -1
- package/src/apis/{country-pricing.ts → country-delivery.ts} +5 -3
- package/src/types/activities.js +13 -0
- package/src/types/activities.js.map +1 -0
- package/src/types/comparables.js +2 -0
- package/src/types/comparables.js.map +1 -0
- package/src/types/country-delivery.ts +42 -0
- package/src/types/crm.js +58 -0
- package/src/types/crm.js.map +1 -0
- package/src/types/dashboard.js +2 -0
- package/src/types/dashboard.js.map +1 -0
- package/src/types/definitions.js +2 -0
- package/src/types/definitions.js.map +1 -0
- package/src/types/exchange-rates.ts +10 -0
- package/src/types/fields.js +2 -0
- package/src/types/fields.js.map +1 -0
- package/src/types/insights.js +2 -0
- package/src/types/insights.js.map +1 -0
- package/src/types/interests.js +6 -0
- package/src/types/interests.js.map +1 -0
- package/src/types/internal-events.js +18 -0
- package/src/types/internal-events.js.map +1 -0
- package/src/types/internet-opportunities.js +2 -0
- package/src/types/internet-opportunities.js.map +1 -0
- package/src/types/internet-vehicles.js +2 -0
- package/src/types/internet-vehicles.js.map +1 -0
- package/src/types/leasing-administration.js +2 -0
- package/src/types/leasing-administration.js.map +1 -0
- package/src/types/leasing-debtors.js +2 -0
- package/src/types/leasing-debtors.js.map +1 -0
- package/src/types/leasing-search.js +2 -0
- package/src/types/leasing-search.js.map +1 -0
- package/src/types/leasing-settings.js +7 -0
- package/src/types/leasing-settings.js.map +1 -0
- package/src/types/leasing.js +38 -0
- package/src/types/leasing.js.map +1 -0
- package/src/types/marketing.js +35 -0
- package/src/types/marketing.js.map +1 -0
- package/src/types/offers.js +56 -0
- package/src/types/opportunities.js +107 -0
- package/src/types/opportunities.js.map +1 -0
- package/src/types/opportunities.ts +6 -0
- package/src/types/payments.js +7 -0
- package/src/types/picklists.js +2 -0
- package/src/types/picklists.js.map +1 -0
- package/src/types/quote-settings.ts +4 -0
- package/src/types/quotes.js +42 -0
- package/src/types/recently-viewed.js +2 -0
- package/src/types/recently-viewed.js.map +1 -0
- package/src/types/reservations.js +5 -0
- package/src/types/reservations.js.map +1 -0
- package/src/types/roi-ratings.js +5 -0
- package/src/types/roi-ratings.js.map +1 -0
- package/src/types/saved-filters.js +9 -0
- package/src/types/saved-filters.js.map +1 -0
- package/src/types/search.js +2 -0
- package/src/types/search.js.map +1 -0
- package/src/types/settings.js +2 -0
- package/src/types/settings.js.map +1 -0
- package/src/types/templates.js +2 -0
- package/src/types/templates.js.map +1 -0
- package/src/types/tenants.js +21 -0
- package/src/types/tenants.js.map +1 -0
- package/src/types/user-performance.js +7 -0
- package/src/types/user-performance.js.map +1 -0
- package/src/types/user-performance.ts +1 -0
- package/src/types/utils.js +2 -0
- package/src/types/validation.js +2 -0
- package/src/types/validation.js.map +1 -0
- package/src/types/vehicle-sales.js +6 -0
- package/src/types/vehicle-sales.js.map +1 -0
- package/src/types/vehicles.js +98 -0
- package/src/types/vehicles.js.map +1 -0
- package/src/types/vehicles.ts +40 -4
- package/src/utils/exchange-rates.test.ts +29 -0
- package/src/utils/exchange-rates.ts +32 -0
- package/src/utils/leasing.js +6 -0
- package/src/utils/leasing.js.map +1 -0
- package/src/utils/opportunities.js +48 -0
- package/src/utils/opportunities.js.map +1 -0
- package/src/utils/vehicles.ts +8 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/lib/apis/country-pricing.d.ts +0 -3
- package/lib/apis/country-pricing.d.ts.map +0 -1
- package/lib/apis/country-pricing.js.map +0 -1
- package/lib/types/country-pricing.d.ts +0 -16
- package/lib/types/country-pricing.d.ts.map +0 -1
- package/lib/types/country-pricing.js +0 -2
- package/lib/types/country-pricing.js.map +0 -1
- package/lib/utils/country-pricing.d.ts +0 -5
- package/lib/utils/country-pricing.d.ts.map +0 -1
- package/lib/utils/country-pricing.js +0 -17
- package/lib/utils/country-pricing.js.map +0 -1
- package/lib/utils/country-pricing.test.d.ts +0 -2
- package/lib/utils/country-pricing.test.d.ts.map +0 -1
- package/lib/utils/country-pricing.test.js +0 -65
- package/lib/utils/country-pricing.test.js.map +0 -1
- package/src/types/country-pricing.ts +0 -25
- package/src/utils/country-pricing.test.ts +0 -82
- package/src/utils/country-pricing.ts +0 -44
|
@@ -1 +1 @@
|
|
|
1
|
-
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;IACxC,iEAA+B,CAAA;AACjC,CAAC,EAFW,8BAA8B,KAA9B,8BAA8B,QAEzC","sourcesContent":["import {\n AttachmentValue,\n Document,\n LocationValue,\n MultiLangValue,\n PaginatedRequest,\n SearchPermissions,\n ShareEmailRequest,\n ShareWhatsappRequest,\n} from '@bisondesk/commons-sdk/types';\nimport { ReferenceData } from '@bisondesk/commons-sdk/utils';\nimport { BaseEvent } from './internal-events.js';\nimport { VehicleSaleLogisticsStatus } from './opportunities.js';\nimport { OpportunityReservation } from './reservations.js';\nimport { ComplexFilter, Filter } from './search.js';\nimport { Transport } from './transports.js';\nimport { DataRecord } from './utils.js';\nimport { VehicleBusinessOverviewXL } from './vehicle-performance.js';\nimport { VehicleSaleInfo } from './vehicle-sales.js';\n\nexport enum VehicleRoles {\n SALE = 'SALE',\n OWN_USE = 'OWN_USE',\n RENTAL = 'RENTAL',\n BUILD = 'BUILD',\n UNKNOWN = 'UNKNOWN',\n BANK_FINANCE = 'BANK_FINANCE',\n}\n\nexport enum VehicleFuelType {\n Petrol = 'PETROL',\n Diesel = 'DIESEL',\n LPG = 'LPG',\n LPG_G3 = 'LPG_G3',\n Electric = 'ELECTRIC',\n CNG = 'CNG',\n Hydrogen = 'HYDROGEN',\n BioEthanol = 'BIO_ETHANOL',\n BioDiesel = 'BIO_DIESEL',\n E85 = 'E85',\n HCNG = 'HCNG',\n LPG_Petrol = 'LPG_PETROL',\n LPG_Diesel = 'LPG_DIESEL',\n LPG_G3_Petrol = 'LPG_G3_PETROL',\n LPG_G3_Diesel = 'LPG_G3_DIESEL',\n Electric_Diesel = 'ELECTRIC_DIESEL',\n Electric_Petrol = 'ELECTRIC_PETROL',\n Hybrid = 'HYBRID',\n Other = 'OTHER',\n}\n\nexport enum VehicleTachoTypes {\n Analog = 'ANALOG',\n Digital = 'DIGITAL',\n SmartTacho1 = 'SMART_TACHO_1',\n SmartTacho2 = 'SMART_TACHO_2',\n}\n\ntype BaseVehicleEvent = BaseEvent & {\n id: string;\n actionAt: string;\n userId: string;\n tenantId: string;\n};\n\ntype VehicleSuperstructure = {\n carCapacity?: number;\n compartmentCount?: number;\n counter?: boolean;\n crane?: {\n make?: string;\n model?: string;\n position?: 'Behind the cabin' | 'Rear';\n present?: boolean;\n year?: number;\n };\n dimensions?: {\n height?: number;\n length?: number;\n width?: number;\n extended?: string; // L1, L2, ...\n heightened?: string; // H1, H2, ...\n };\n baseVehicle?: SuperstructureBaseVehicle;\n extendable?: boolean;\n highPressurePump?: boolean;\n loadingPlatformHeight?: number;\n pump?: boolean;\n slidingRoof?: boolean;\n tailgate?: {\n capacity?: number;\n make?: string;\n model?: string;\n present?: boolean;\n type?: 'slider_lift' | 'cantilever' | 'column_lift';\n };\n tank?: {\n capacity: number; //litters\n volume?: number; //m3\n };\n temperatureControl?: {\n engineType?: 'diesel' | 'electric' | 'diesel+electric' | 'engine';\n make?: string;\n runningHours?: {\n diesel?: number;\n electric?: number;\n };\n };\n tipper?: {\n tipsBack?: boolean;\n tipsLeft?: boolean;\n tipsRight?: boolean;\n };\n};\n\nexport type NewVehicleRequest = {\n branch: string;\n count: number;\n specs: VehicleExternalInfo;\n description: {\n remarks?: string;\n technicalRemarks?: string;\n };\n salesConditions?: {\n marginScheme?: boolean;\n manufacturerWarranty?: {\n remarks?: string;\n available?: boolean;\n };\n };\n logistics: {\n parking?: string;\n deliveryType?: VehiclePurchaseDeliveryType;\n pickupAddress?: LocationValue;\n status: VehiclePurchaseLogisticsStatus;\n };\n prices: {\n minimum?: string;\n premium?: string;\n internet?: string;\n };\n media: {\n internalPictures: AttachmentValue[];\n pictures: AttachmentValue[];\n videos: AttachmentValue[];\n docs: Document[];\n engineeringDocs: Document[];\n };\n vinList?: string;\n deal: {\n offerId?: string;\n stockNumber?: string;\n contactId: string;\n orgId: string;\n purchasedBy: string;\n purchaseAssistedBy?: string;\n readyToDeliver?: boolean;\n dealStatus: VehiclePurchaseDealStatus;\n costs: {\n purchase: string;\n purchaseVatPercentage: string;\n commission?: string;\n externalTransport?: string;\n internalTransport?: string;\n externalGarage?: string;\n internalGarage?: string;\n other?: string;\n bonus?: string;\n };\n logistics: {\n availableDate?: string;\n vehicleRole: VehicleRoles;\n };\n };\n};\n\nexport type VehicleCreateEvent = BaseVehicleEvent & {\n action: 'create';\n vehicle: Vehicle;\n previousVehicle?: undefined;\n};\n\nexport type VehicleUpdateEvent = BaseVehicleEvent & {\n action: 'update';\n vehicle: Vehicle;\n previousVehicle: Vehicle;\n};\n\nexport type VehicleDeleteEvent = BaseVehicleEvent & {\n action: 'delete';\n vehicle?: undefined;\n previousVehicle: Vehicle;\n};\n\nexport type VehicleEvent = VehicleCreateEvent | VehicleUpdateEvent | VehicleDeleteEvent;\n\ntype BaseVehiclePurchaseEvent = {\n actionAt: string;\n userId: string;\n tenantId: string;\n branchId: string;\n vehicleId: string;\n};\n\nexport type VehiclePurchaseCreateEvent = BaseVehiclePurchaseEvent & {\n action: 'create';\n data: VehiclePurchase;\n previousData?: undefined;\n};\n\nexport type VehiclePurchaseUpdateEvent = BaseVehiclePurchaseEvent & {\n action: 'update';\n data: VehiclePurchase;\n previousData: VehiclePurchase;\n};\n\nexport type VehiclePurchaseEvent = BaseEvent &\n (VehiclePurchaseCreateEvent | VehiclePurchaseUpdateEvent);\n\nexport type UpdateVehiclesPricesEvent = {\n id: string;\n actionAt: string;\n userId: string;\n tenantId: string;\n priceList: AttachmentValue;\n};\n\nexport type PublicVehicle = Pick<Vehicle, 'external' | 'id'>;\n\nexport type PublicSearchVehicle = {\n vehicle: PublicVehicle;\n};\n\nexport enum SearchVehicleSaleDealStatus {\n NotSold = 'NOT_SOLD',\n Reserved = 'RESERVED',\n Sold = 'SOLD',\n}\n\nexport type SearchVehicle = {\n custom: {\n features: string[];\n sold: boolean;\n isReserved: boolean;\n hasPayments: boolean;\n listedOnWebsite: boolean;\n publishedOnWebsiteAt?: string;\n originalBranchId: string;\n };\n customSortableFields: {\n priceChangedAt?: string;\n checkedInAt?: string;\n saleAgreementAt?: string;\n };\n purchase?: {\n supplierStockNumber?: string;\n readyToDeliver: boolean;\n dealStatus?: VehiclePurchaseDealStatus;\n logisticsStatus?: VehiclePurchaseLogisticsStatus;\n purchasedBy?: string;\n parkingName?: string;\n organizationId: string;\n organizationExternalId?: number;\n fullPaymentSentAt?: string;\n marketingStartedAt?: string;\n arrivedAt?: string;\n };\n reservation?: Pick<OpportunityReservation, 'expiresAt' | 'opportunityId' | 'createdBy'>;\n transports: Transport[];\n vehicle: Vehicle;\n sale: {\n opportunityId?: string;\n externalSaleId?: string;\n soldAt?: string;\n soldBy?: string;\n sellers?: string[]; // opportunity account manager [+ assistant]\n dealStatus: SearchVehicleSaleDealStatus;\n logisticStatus?: VehicleSaleLogisticsStatus;\n };\n};\n\nexport type InputSearchVehicle = SearchVehicle & {\n permissions?: SearchPermissions;\n};\n\nexport type VehicleSearchMeta = ReferenceData & {\n matchingOffers?: {\n count: number;\n filters: {\n conditions: Array<Filter | ComplexFilter>;\n fullText?: string;\n };\n };\n};\n\nexport type PriceChangeEvent = BaseEvent & {\n tenantId: string;\n userId: string;\n vehicleId: string;\n input: {\n previousPrices: VehiclePricingHistoryInput;\n currentPrices: VehiclePricingHistoryInput;\n };\n};\n\nexport type VehiclePricingHistory = {\n pricing: VehiclePricingHistoryInput;\n createdAt: string;\n createdBy: string;\n};\n\nexport type VehiclePricingHistoryInput = VehiclePricing & { internet?: string };\n\nexport type VehiclePricing = {\n premium?: string;\n minimum?: string;\n currency?: string;\n};\n\nexport type RelatedVehicle = {\n vehicleId: string;\n description: string;\n stockNumber: string;\n};\n\nexport type VehicleInternalInfo = {\n createdAt: string;\n description: {\n title: string;\n remarks?: string;\n technicalRemarks?: string;\n };\n identification: {\n administrativeNumber?: string;\n stockNumber: string;\n branch: string;\n\n offerId?: string;\n licensePlateHistory?: {\n licensePlate: string;\n changedAt: string;\n }[];\n\n /**\n * This ID is used to link different vehicle objects that represent the same real world asset.\n * Ideally the chassis number could be used, but in some cases it is not available yet.\n */\n metaId: string;\n };\n documents: Document[];\n pictures: AttachmentValue[];\n engineeringDocs: Document[];\n pricing: VehiclePricing;\n role: VehicleRoles;\n status: VehicleStatus;\n updatedAt: string;\n /* use this property to store additional terms that you want the vehicle to be found with when doing a full text search */\n keywords?: string[];\n relatedVehicles: RelatedVehicle[];\n};\n\nexport type VehicleOriginalInfo = {\n /** IMMEDIATE source tenant (the predecessor in a sync chain). */\n tenantId: string;\n tenantChain?: string[];\n identification: {\n id: string;\n branchId: string;\n stockNumber: string;\n metaId?: string;\n country: string;\n };\n salesConditions: {\n leasing?: boolean;\n price?: string;\n currency?: string;\n marginScheme?: boolean;\n manufacturerWarranty?: {\n remarks?: string;\n available?: boolean;\n };\n };\n /**\n * Deepest-origin tenant/branch in a multi-hop sync chain. Carries forward\n * verbatim across hops so consumers can answer \"where did this vehicle\n * actually originate?\" without walking the chain.\n */\n owner: {\n tenantId: string;\n branchId: string;\n country: string;\n };\n};\n\nexport type VehicleAxlesInfo = {\n details?: VehicleAxle[];\n configuration?: string;\n count?: number;\n poweredAxlesCount?: number;\n wheelbase?: number;\n suspension?: 'Air' | 'Air/Steel' | 'Steel';\n loadCapacity?: number;\n};\n\nexport type SuperstructureBaseVehicle = {\n category: string;\n make: string;\n model?: string;\n type?: string;\n axlesConfiguration?: string;\n emissionsClass?: string;\n transmissionType?: 'Automatic' | 'Manual' | 'Semi-Automatic';\n vin?: string;\n currentRegistration?: {\n country?: string;\n };\n suspension?: 'Air' | 'Air/Steel' | 'Steel';\n constructionYear?: number;\n firstRegistration?: string;\n odometerKm?: number;\n powerHp?: number;\n bodystyle?: string;\n accessories: VehicleExternalInfo['accessories'];\n superstructure?: Pick<VehicleSuperstructure, 'crane' | 'tailgate'>;\n};\n\n// mostly inspired by the Hexon data model\nexport type VehicleExternalInfo = {\n body?: {\n cabin?: {\n type: 'Day' | 'Sleep / Small' | 'Sleep / Medium' | 'Sleep / Large';\n model?: string;\n };\n colour?: string;\n dimensions?: {\n height?: number;\n length?: number;\n width?: number;\n };\n doorCount?: number;\n interior?: {\n bedCount?: number;\n seatCount?: number;\n };\n internalDimensions?: {\n //for Trailers/Semi-trailers of type reefers, box, curtainsides\n height?: number;\n length?: number;\n width?: number;\n };\n kingpin?: {\n //for Trailers/Semi-trailers\n size?: number; // in inches\n capacity?: number; // in kg\n };\n fifthWheelHeight?: number; //for new trailers in mm\n };\n mainPicture?: AttachmentValue;\n pictures?: AttachmentValue[];\n videos?: AttachmentValue[];\n condition?: {\n damaged?: boolean;\n odometer?: {\n km?: number;\n };\n used?: boolean;\n };\n general: {\n bodystyle?: string;\n category: string;\n make?: string;\n model?: string;\n modelName?: string;\n type?: string;\n typeName?: string;\n tacho?: VehicleTachoTypes;\n color?: {\n mainColorHex?: string; //Hex color code\n chassisColorReferenceCode?: string; //Maker reference code. For now, mainly relevant for new trailers\n upperStructureColorReferenceCode?: string; //Maker reference code. For now, mainly relevant for new trailers\n };\n };\n history?: {\n advertisingYear?: number;\n constructionYear?: number;\n currentRegistration?: {\n country?: string;\n technicalInspectionEndDate?: string;\n carpassUrl?: string;\n carpassAvailable?: boolean;\n };\n firstRegistration?: string;\n cocPvg?: string;\n };\n identification: {\n licensePlate?: string;\n stockNumber?: string;\n vin?: string;\n buildStockNumber?: string;\n engineNumber?: string;\n };\n trailers?: {\n cooler?: {\n hasCooler?: boolean;\n make?: string;\n };\n };\n powertrain?: {\n axles?: VehicleAxlesInfo;\n emissions?: {\n class?: string;\n subclass?: string;\n };\n engine?: {\n cylinderCount?: number;\n energy?: { type?: VehicleFuelType };\n power?: {\n hp?: number;\n };\n displacement?: number;\n };\n transmission?: {\n gearCount?: number;\n make?: string;\n model?: string;\n type?: 'Automatic' | 'Manual' | 'Semi-Automatic';\n };\n };\n salesConditions: {\n leasing?: boolean;\n price?: string | undefined;\n currency?: string | undefined;\n marginScheme?: boolean;\n manufacturerWarranty?: {\n remarks?: string;\n available?: boolean;\n };\n } & (\n | { deliveryCost: number; deliveryLocation: string }\n | { deliveryCost?: never; deliveryLocation?: never }\n );\n superstructure?: VehicleSuperstructure;\n weights?: {\n gvw?: number;\n massEmpty?: number;\n };\n accessories: {\n abs?: boolean;\n jumbo?: boolean;\n adr?: boolean;\n airco?: boolean;\n alloyWheels?: boolean;\n aluminiumFuelTank?: boolean;\n cdPlayer?: boolean;\n coil?: boolean;\n centralLocking?: boolean;\n centralLubrication?: boolean;\n cruiseControl?: boolean;\n electricDoorMirrors?: boolean;\n electricWindows?: boolean;\n engineBrake?: boolean;\n forklift?: boolean;\n navigationSystem?: boolean;\n hydraulicTipperKit?: boolean;\n lowDeck?: boolean;\n lowNoise?: boolean;\n parkingHeater?: boolean;\n particleFilter?: boolean;\n powerTakeOff?: boolean;\n refrigerator?: boolean;\n retarderIntarder?: boolean;\n reversingCamera?: boolean;\n roofSpoiler?: boolean;\n sideSkirts?: boolean;\n spareKey?: boolean;\n spareWheel?: boolean;\n speedLimiter?: boolean;\n spoilers?: boolean;\n spotlights?: boolean;\n stabilityControl?: boolean;\n standardAirco?: boolean;\n television?: boolean;\n toolbox?: boolean;\n trailerCoupling?: boolean;\n twinFuelTank?: boolean;\n visor?: boolean;\n xenonLights?: boolean;\n };\n publicLink?: string;\n};\n\ntype BaseVehicle<I = VehicleInternalInfo, E = VehicleExternalInfo> = {\n internal: I;\n external: E;\n original?: VehicleOriginalInfo;\n};\n\nexport type NewVehicle<I = VehicleInternalInfo, E = VehicleExternalInfo> = BaseVehicle<I, E> & {\n id?: undefined;\n};\n\nexport type Vehicle<I = VehicleInternalInfo, E = VehicleExternalInfo> = BaseVehicle<I, E> & {\n id: string;\n};\n\nexport type VehicleBffMetadata = {\n openOpportunities: number;\n};\n\nexport type VehicleBff = {\n vehicle: DataRecord<Vehicle, VehicleBffMetadata>;\n sale?: VehicleSaleInfo;\n purchase?: VehiclePurchase;\n overview?: VehicleBusinessOverviewXL;\n marketing?: {\n titles?: MultiLangValue;\n listed: boolean;\n sharable: boolean;\n publishedOnWebsiteAt?: string;\n numPlatformsPublished: number;\n };\n};\n\nexport type VehiclesByChassisNumberRequest = {\n tenantIds: string[];\n chassisNumber: string;\n};\n\nexport type VehiclesByMetaIdRequest = {\n tenantIds: string[];\n metaId: string;\n};\n\nexport type VehicleAxle = {\n make?: string;\n alloyWheels?: boolean;\n brakes?: 'Disc' | 'Drum';\n differentialLock?: boolean;\n liftAxle?: boolean;\n maxLoad?: number;\n nr: number;\n position?: string;\n powered?: boolean;\n reduction?: string;\n steering?: boolean;\n suspension?: 'Steel' | 'Air' | 'Hydraulic';\n twinWheels?: boolean;\n tyreSize?: string;\n tyreConditionType?: 'mm' | '%';\n\n tyreConditionMmLeftInside?: number;\n tyreConditionMmLeftOutside?: number;\n tyreConditionMmRightInside?: number;\n tyreConditionMmRightOutside?: number;\n\n tyreConditionPercLeftInside?: number;\n tyreConditionPercLeftOutside?: number;\n tyreConditionPercRightInside?: number;\n tyreConditionPercRightOutside?: number;\n\n steeringType?: 'fixed' | 'self_steering' | 'hydraulic';\n};\n\nexport enum VehiclePurchaseDealStatus {\n Marketing = 'MARKETING',\n PurchaseEvaluation = 'PURCHASE_EVALUATION', // used for vehicle consignation\n PurchaseAgreed = 'PURCHASE_AGREED',\n FirstPaymentAllowed = 'FIRST_PAYMENT_ALLOWED',\n FirstPaymentSent = 'FIRST_PAYMENT_SENT',\n FullPaymentAllowed = 'FULL_PAYMENT_ALLOWED',\n FullPaymentSent = 'FULL_PAYMENT_SENT',\n}\n\nexport enum VehiclePurchaseLogisticsStatus {\n AtOrigin = 'AT_ORIGIN',\n Arrived = 'ARRIVED',\n CheckedIn = 'CHECKED_IN',\n NotApplicable = 'NOT_APPLICABLE',\n}\n\nexport enum VehiclePurchaseDeliveryType {\n PickUp = 'PICK_UP',\n DropOff = 'DROP_OFF',\n}\n\nexport type VehicleStatus = {\n deleted?: boolean;\n deletedReason?: string;\n};\n\nexport type VehiclePriceList = {\n uploadedAt: string;\n uploadedBy: string;\n priceList: AttachmentValue;\n id: string;\n};\n\nexport type UpdateVehiclesPricesRequest = {\n priceList: AttachmentValue;\n};\n\nexport type VehiclePriceListLine = {\n reference: string;\n internet?: string;\n premium?: string;\n minimum?: string;\n};\n\nexport type VehiclePriceUpdateError = {\n data: VehiclePriceListLine;\n line: number;\n error: {\n fieldId: keyof VehiclePriceListLine;\n msg: string;\n };\n};\n\nexport type VehiclePriceUpdateResponse =\n | {\n success: true;\n }\n | {\n success: false;\n errors: VehiclePriceUpdateError[];\n };\n\nexport type VehiclePurchase = {\n organizationId: string;\n contactId: string;\n supplierStockNumber?: string;\n purchasedBy: string;\n purchaseAssistedBy?: string;\n\n log: {\n // computed automatically by the backend\n marketingStartedAt?: string;\n marketingStartedBy?: string;\n\n evaluationStartedAt?: string;\n evaluationStartedBy?: string;\n\n purchaseAgreedAt?: string;\n purchaseAgreedBy?: string;\n\n firstPaymentAllowedAt?: string;\n firstPaymentAllowedBy?: string;\n firstPaymentSentAt?: string;\n firstPaymentSentBy?: string;\n\n fullPaymentAllowedAt?: string;\n fullPaymentAllowedBy?: string;\n fullPaymentSentAt?: string;\n fullPaymentSentBy?: string;\n\n arrivedAt?: string;\n arrivedBy?: string;\n\n checkedInAt?: string;\n checkedInBy?: string;\n };\n\n deal: {\n status: VehiclePurchaseDealStatus; // partially set by the user, if there are payments then it is set automatically by the backend\n readyToDeliver?: boolean;\n\n purchaseVatRate?: string;\n purchase?: string; // exclusive VAT\n\n bonus?: string; // sometimes manufacturers pay us a bonus when we reach a target\n\n // estimated costs, real costs come from actual invoices\n commission?: string;\n externalTransport?: string;\n internalTransport?: string;\n externalGarage?: string;\n internalGarage?: string;\n other?: string;\n\n totalCosts?: string; // exclusive VAT\n };\n\n logistics: {\n parkingName?: string;\n status: VehiclePurchaseLogisticsStatus; // manually set by the user\n deliveryType?: VehiclePurchaseDeliveryType;\n pickupAddress?: LocationValue;\n availableWeek?: string; // ISOWEEK, e.g. 2016-W02\n };\n};\n\nexport type PurchaseRecordMeta = ReferenceData & {\n allowedLogisticsTransitions?: VehiclePurchaseLogisticsStatus[];\n};\n\nexport type SaveVehiclePurchaseOpts = {\n skipTransportValidation?: boolean;\n};\n\nexport enum VehicleActions {\n EditAdminDocs = 'edit_admin_docs',\n EditEngineeringDocs = 'edit_engineering_docs',\n EditMarketing = 'edit_marketing',\n EditMedia = 'edit_media',\n EditPictures = 'edit_pictures',\n EditPrices = 'edit_prices',\n EditPurchaseDeal = 'edit_purchase_deal',\n EditPurchaseLogistics = 'edit_purchase_logistics',\n EditSpecs = 'edit_specs',\n EditVideos = 'edit_videos',\n ViewLeads = 'view_leads',\n ViewBusinessOverview = 'view_business_overview',\n ViewSimilarOnline = 'view_similar_online',\n ViewPurchase = 'view_purchase',\n ViewPriceHistory = 'view_price_history',\n DeleteVehicle = 'delete_vehicle',\n}\n\nexport enum PurchaseActions {\n ViewDeal = 'view_deal',\n ViewSupplierOrganization = 'view_supplier_organization',\n ViewContact = 'view_contact',\n ViewLegalAddress = 'view_legal_address',\n ViewPickupAddress = 'view_pickup_address',\n ViewEstimatedCosts = 'view_estimated_costs',\n ViewFinanceDocuments = 'view_finance_documents',\n AddPayment = 'add_payment',\n EditPayment = 'edit_payment',\n MarkPaymentDone = 'mark_payment_done',\n AddRemarks = 'add_remarks',\n}\n\nexport enum VehicleBusinessOverviewActions {\n View = 'view_business_overview',\n}\n\nexport type VehicleShareEmailRequest = ShareEmailRequest & {\n pictures: AttachmentValue[];\n};\n\nexport type VehicleShareData = {\n title: string;\n mainPicture?: string;\n pictures: {\n picture: string;\n }[];\n message: string;\n specs: {\n name: string;\n value: string;\n }[];\n features: {\n name: string;\n }[];\n stockNumber: string;\n price?: string;\n description?: string;\n publicLink?: string;\n};\n\nexport type MarketingEmailData = {\n message: string;\n vehicles: VehicleShareData[];\n vehiclePairs: { first: VehicleShareData; second?: VehicleShareData }[];\n lastVehicle?: VehicleShareData;\n unsubscribeUrl?: string;\n};\n\nexport type VehicleReservationCreateEvent = BaseVehicleEvent & {\n action: 'create';\n reservation: OpportunityReservation;\n previousReservation?: undefined;\n};\n\nexport type VehicleReservationUpdateEvent = BaseVehicleEvent & {\n action: 'update';\n reservation: OpportunityReservation;\n previousReservation: OpportunityReservation;\n};\n\nexport type VehicleReservationDeleteEvent = BaseVehicleEvent & {\n action: 'delete';\n reservation?: undefined;\n previousReservation: OpportunityReservation;\n};\n\nexport type VehicleReservationEvent =\n | VehicleReservationCreateEvent\n | VehicleReservationUpdateEvent\n | VehicleReservationDeleteEvent;\n\nexport type ShareVehicleViaWahtsappRequest = {\n data: ShareWhatsappRequest;\n vehicleId: string;\n};\n\ntype RecordChange = {\n modifiedAt: string;\n modifiedBy: string;\n};\n\nexport type VehicleChange = RecordChange & {\n vehicle: Vehicle;\n};\n\nexport type PurchaseChange = RecordChange & {\n purchase: VehiclePurchase;\n};\n\nexport type RecordChangeRequest = PaginatedRequest & {\n fieldPath?: string;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"vehicles.js","sourceRoot":"/","sources":["types/vehicles.ts"],"names":[],"mappings":"AAoBA,MAAM,CAAN,IAAY,YAOX;AAPD,WAAY,YAAY;IACtB,6BAAa,CAAA;IACb,mCAAmB,CAAA;IACnB,iCAAiB,CAAA;IACjB,+BAAe,CAAA;IACf,mCAAmB,CAAA;IACnB,6CAA6B,CAAA;AAC/B,CAAC,EAPW,YAAY,KAAZ,YAAY,QAOvB;AAED,MAAM,CAAN,IAAY,eAoBX;AApBD,WAAY,eAAe;IACzB,oCAAiB,CAAA;IACjB,oCAAiB,CAAA;IACjB,8BAAW,CAAA;IACX,oCAAiB,CAAA;IACjB,wCAAqB,CAAA;IACrB,8BAAW,CAAA;IACX,wCAAqB,CAAA;IACrB,6CAA0B,CAAA;IAC1B,2CAAwB,CAAA;IACxB,8BAAW,CAAA;IACX,gCAAa,CAAA;IACb,4CAAyB,CAAA;IACzB,4CAAyB,CAAA;IACzB,kDAA+B,CAAA;IAC/B,kDAA+B,CAAA;IAC/B,sDAAmC,CAAA;IACnC,sDAAmC,CAAA;IACnC,oCAAiB,CAAA;I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IAC1B,0CAAwB,CAAA;IACxB,iEAA+C,CAAA;IAC/C,2DAAyC,CAAA;IACzC,gDAA8B,CAAA;IAC9B,yDAAuC,CAAA;IACvC,kDAAgC,CAAA;AAClC,CAAC,EAjBW,cAAc,KAAd,cAAc,QAiBzB;AAED,MAAM,CAAN,IAAY,eAYX;AAZD,WAAY,eAAe;IACzB,yCAAsB,CAAA;IACtB,0EAAuD,CAAA;IACvD,+CAA4B,CAAA;IAC5B,0DAAuC,CAAA;IACvC,4DAAyC,CAAA;IACzC,8DAA2C,CAAA;IAC3C,kEAA+C,CAAA;IAC/C,6CAA0B,CAAA;IAC1B,+CAA4B,CAAA;IAC5B,wDAAqC,CAAA;IACrC,6CAA0B,CAAA;AAC5B,CAAC,EAZW,eAAe,KAAf,eAAe,QAY1B;AAED,MAAM,CAAN,IAAY,8BAEX;AAFD,WAAY,8BAA8B;IACxC,iEAA+B,CAAA;AACjC,CAAC,EAFW,8BAA8B,KAA9B,8BAA8B,QAEzC","sourcesContent":["import {\n AttachmentValue,\n Document,\n LocationValue,\n MultiLangValue,\n PaginatedRequest,\n SearchPermissions,\n ShareEmailRequest,\n ShareWhatsappRequest,\n} from '@bisondesk/commons-sdk/types';\nimport { ReferenceData } from '@bisondesk/commons-sdk/utils';\nimport { BaseEvent } from './internal-events.js';\nimport { VehicleSaleLogisticsStatus } from './opportunities.js';\nimport { OpportunityReservation } from './reservations.js';\nimport { ComplexFilter, Filter } from './search.js';\nimport { Transport } from './transports.js';\nimport { DataRecord } from './utils.js';\nimport { VehicleBusinessOverviewXL } from './vehicle-performance.js';\nimport { VehicleSaleInfo } from './vehicle-sales.js';\n\nexport enum VehicleRoles {\n SALE = 'SALE',\n OWN_USE = 'OWN_USE',\n RENTAL = 'RENTAL',\n BUILD = 'BUILD',\n UNKNOWN = 'UNKNOWN',\n BANK_FINANCE = 'BANK_FINANCE',\n}\n\nexport enum VehicleFuelType {\n Petrol = 'PETROL',\n Diesel = 'DIESEL',\n LPG = 'LPG',\n LPG_G3 = 'LPG_G3',\n Electric = 'ELECTRIC',\n CNG = 'CNG',\n Hydrogen = 'HYDROGEN',\n BioEthanol = 'BIO_ETHANOL',\n BioDiesel = 'BIO_DIESEL',\n E85 = 'E85',\n HCNG = 'HCNG',\n LPG_Petrol = 'LPG_PETROL',\n LPG_Diesel = 'LPG_DIESEL',\n LPG_G3_Petrol = 'LPG_G3_PETROL',\n LPG_G3_Diesel = 'LPG_G3_DIESEL',\n Electric_Diesel = 'ELECTRIC_DIESEL',\n Electric_Petrol = 'ELECTRIC_PETROL',\n Hybrid = 'HYBRID',\n Other = 'OTHER',\n}\n\nexport enum VehicleTachoTypes {\n Analog = 'ANALOG',\n Digital = 'DIGITAL',\n SmartTacho1 = 'SMART_TACHO_1',\n SmartTacho2 = 'SMART_TACHO_2',\n}\n\ntype BaseVehicleEvent = BaseEvent & {\n id: string;\n actionAt: string;\n userId: string;\n tenantId: string;\n};\n\ntype VehicleSuperstructure = {\n carCapacity?: number;\n compartmentCount?: number;\n counter?: boolean;\n crane?: {\n make?: string;\n model?: string;\n position?: 'Behind the cabin' | 'Rear';\n present?: boolean;\n year?: number;\n };\n dimensions?: {\n height?: number;\n length?: number;\n width?: number;\n extended?: string; // L1, L2, ...\n heightened?: string; // H1, H2, ...\n };\n baseVehicle?: SuperstructureBaseVehicle;\n extendable?: boolean;\n highPressurePump?: boolean;\n loadingPlatformHeight?: number;\n pump?: boolean;\n slidingRoof?: boolean;\n tailgate?: {\n capacity?: number;\n make?: string;\n model?: string;\n present?: boolean;\n type?: 'slider_lift' | 'cantilever' | 'column_lift';\n };\n tank?: {\n capacity: number; //litters\n volume?: number; //m3\n };\n temperatureControl?: {\n engineType?: 'diesel' | 'electric' | 'diesel+electric' | 'engine';\n make?: string;\n runningHours?: {\n diesel?: number;\n electric?: number;\n };\n };\n tipper?: {\n tipsBack?: boolean;\n tipsLeft?: boolean;\n tipsRight?: boolean;\n };\n};\n\nexport type NewVehicleRequest = {\n branch: string;\n count: number;\n specs: VehicleExternalInfo;\n description: {\n remarks?: string;\n technicalRemarks?: string;\n };\n salesConditions?: {\n marginScheme?: boolean;\n manufacturerWarranty?: {\n remarks?: string;\n available?: boolean;\n };\n };\n logistics: {\n parking?: string;\n deliveryType?: VehiclePurchaseDeliveryType;\n pickupAddress?: LocationValue;\n status: VehiclePurchaseLogisticsStatus;\n };\n prices: {\n minimum?: string;\n premium?: string;\n internet?: string;\n };\n media: {\n internalPictures: AttachmentValue[];\n pictures: AttachmentValue[];\n videos: AttachmentValue[];\n docs: Document[];\n engineeringDocs: Document[];\n };\n vinList?: string;\n deal: {\n offerId?: string;\n stockNumber?: string;\n contactId: string;\n orgId: string;\n purchasedBy: string;\n purchaseAssistedBy?: string;\n readyToDeliver?: boolean;\n dealStatus: VehiclePurchaseDealStatus;\n costs: {\n purchase: string;\n purchaseVatPercentage: string;\n commission?: string;\n externalTransport?: string;\n internalTransport?: string;\n externalGarage?: string;\n internalGarage?: string;\n other?: string;\n bonus?: string;\n };\n logistics: {\n availableDate?: string;\n vehicleRole: VehicleRoles;\n };\n };\n};\n\nexport type VehicleCreateEvent = BaseVehicleEvent & {\n action: 'create';\n vehicle: Vehicle;\n previousVehicle?: undefined;\n};\n\nexport type VehicleUpdateEvent = BaseVehicleEvent & {\n action: 'update';\n vehicle: Vehicle;\n previousVehicle: Vehicle;\n};\n\nexport type VehicleDeleteEvent = BaseVehicleEvent & {\n action: 'delete';\n vehicle?: undefined;\n previousVehicle: Vehicle;\n};\n\nexport type VehicleEvent = VehicleCreateEvent | VehicleUpdateEvent | VehicleDeleteEvent;\n\ntype BaseVehiclePurchaseEvent = {\n actionAt: string;\n userId: string;\n tenantId: string;\n branchId: string;\n vehicleId: string;\n};\n\nexport type VehiclePurchaseCreateEvent = BaseVehiclePurchaseEvent & {\n action: 'create';\n data: VehiclePurchase;\n previousData?: undefined;\n};\n\nexport type VehiclePurchaseUpdateEvent = BaseVehiclePurchaseEvent & {\n action: 'update';\n data: VehiclePurchase;\n previousData: VehiclePurchase;\n};\n\nexport type VehiclePurchaseEvent = BaseEvent &\n (VehiclePurchaseCreateEvent | VehiclePurchaseUpdateEvent);\n\nexport type UpdateVehiclesPricesEvent = {\n id: string;\n actionAt: string;\n userId: string;\n tenantId: string;\n priceList: AttachmentValue;\n};\n\nexport type PublicVehicle = Pick<Vehicle, 'external' | 'id'>;\n\nexport type PublicSearchVehicle = {\n vehicle: PublicVehicle;\n};\n\nexport enum SearchVehicleSaleDealStatus {\n NotSold = 'NOT_SOLD',\n Reserved = 'RESERVED',\n Sold = 'SOLD',\n}\n\nexport type SearchVehicle = {\n custom: {\n features: string[];\n sold: boolean;\n isReserved: boolean;\n hasPayments: boolean;\n listedOnWebsite: boolean;\n publishedOnWebsiteAt?: string;\n originalBranchId: string;\n };\n customSortableFields: {\n priceChangedAt?: string;\n checkedInAt?: string;\n saleAgreementAt?: string;\n };\n purchase?: {\n supplierStockNumber?: string;\n readyToDeliver: boolean;\n dealStatus?: VehiclePurchaseDealStatus;\n logisticsStatus?: VehiclePurchaseLogisticsStatus;\n purchasedBy?: string;\n parkingName?: string;\n organizationId: string;\n organizationExternalId?: number;\n fullPaymentSentAt?: string;\n marketingStartedAt?: string;\n arrivedAt?: string;\n };\n reservation?: Pick<OpportunityReservation, 'expiresAt' | 'opportunityId' | 'createdBy'>;\n transports: Transport[];\n vehicle: Vehicle;\n sale: {\n opportunityId?: string;\n externalSaleId?: string;\n soldAt?: string;\n soldBy?: string;\n sellers?: string[]; // opportunity account manager [+ assistant]\n dealStatus: SearchVehicleSaleDealStatus;\n logisticStatus?: VehicleSaleLogisticsStatus;\n };\n};\n\nexport type InputSearchVehicle = SearchVehicle & {\n permissions?: SearchPermissions;\n};\n\nexport type VehicleSearchMeta = ReferenceData & {\n matchingOffers?: {\n count: number;\n filters: {\n conditions: Array<Filter | ComplexFilter>;\n fullText?: string;\n };\n };\n};\n\nexport type PriceChangeEvent = BaseEvent & {\n tenantId: string;\n userId: string;\n vehicleId: string;\n input: {\n previousPrices: VehiclePricingHistoryInput;\n currentPrices: VehiclePricingHistoryInput;\n };\n};\n\nexport type VehiclePricingHistory = {\n pricing: VehiclePricingHistoryInput;\n createdAt: string;\n createdBy: string;\n};\n\nexport type VehiclePricingHistoryInput = VehiclePricing & { internet?: string };\n\nexport type VehiclePricing = {\n premium?: string;\n minimum?: string;\n currency?: string;\n};\n\nexport type RelatedVehicle = {\n vehicleId: string;\n description: string;\n stockNumber: string;\n};\n\nexport type VehicleInternalInfo = {\n createdAt: string;\n description: {\n title: string;\n remarks?: string;\n technicalRemarks?: string;\n };\n identification: {\n administrativeNumber?: string;\n stockNumber: string;\n branch: string;\n\n offerId?: string;\n licensePlateHistory?: {\n licensePlate: string;\n changedAt: string;\n }[];\n\n /**\n * This ID is used to link different vehicle objects that represent the same real world asset.\n * Ideally the chassis number could be used, but in some cases it is not available yet.\n */\n metaId: string;\n };\n documents: Document[];\n pictures: AttachmentValue[];\n engineeringDocs: Document[];\n pricing: VehiclePricing;\n role: VehicleRoles;\n status: VehicleStatus;\n updatedAt: string;\n /* use this property to store additional terms that you want the vehicle to be found with when doing a full text search */\n keywords?: string[];\n relatedVehicles: RelatedVehicle[];\n};\n\nexport type VehicleOriginalInfo = {\n /** IMMEDIATE source tenant (the predecessor in a sync chain). */\n tenantId: string;\n tenantChain?: string[];\n identification: {\n id: string;\n branchId: string;\n stockNumber: string;\n metaId?: string;\n country: string;\n };\n salesConditions: {\n leasing?: boolean;\n price?: string;\n currency?: string;\n marginScheme?: boolean;\n manufacturerWarranty?: {\n remarks?: string;\n available?: boolean;\n };\n };\n /**\n * Deepest-origin tenant/branch in a multi-hop sync chain. Carries forward\n * verbatim across hops so consumers can answer \"where did this vehicle\n * actually originate?\" without walking the chain.\n */\n owner: {\n tenantId: string;\n branchId: string;\n country: string;\n };\n};\n\nexport type VehicleAxlesInfo = {\n details?: VehicleAxle[];\n configuration?: string;\n count?: number;\n poweredAxlesCount?: number;\n wheelbase?: number;\n suspension?: 'Air' | 'Air/Steel' | 'Steel';\n loadCapacity?: number;\n};\n\nexport type SuperstructureBaseVehicle = {\n category: string;\n make: string;\n model?: string;\n type?: string;\n axlesConfiguration?: string;\n emissionsClass?: string;\n transmissionType?: 'Automatic' | 'Manual' | 'Semi-Automatic';\n vin?: string;\n currentRegistration?: {\n country?: string;\n };\n suspension?: 'Air' | 'Air/Steel' | 'Steel';\n constructionYear?: number;\n firstRegistration?: string;\n odometerKm?: number;\n powerHp?: number;\n bodystyle?: string;\n accessories: VehicleExternalInfo['accessories'];\n superstructure?: Pick<VehicleSuperstructure, 'crane' | 'tailgate'>;\n};\n\n// mostly inspired by the Hexon data model\nexport type VehicleExternalInfo = {\n body?: {\n cabin?: {\n type: 'Day' | 'Sleep / Small' | 'Sleep / Medium' | 'Sleep / Large';\n model?: string;\n };\n colour?: string;\n dimensions?: {\n height?: number;\n length?: number;\n width?: number;\n };\n doorCount?: number;\n interior?: {\n bedCount?: number;\n seatCount?: number;\n };\n internalDimensions?: {\n //for Trailers/Semi-trailers of type reefers, box, curtainsides\n height?: number;\n length?: number;\n width?: number;\n };\n kingpin?: {\n //for Trailers/Semi-trailers\n size?: number; // in inches\n capacity?: number; // in kg\n };\n fifthWheelHeight?: number; //for new trailers in mm\n };\n mainPicture?: AttachmentValue;\n pictures?: AttachmentValue[];\n videos?: AttachmentValue[];\n condition?: {\n damaged?: boolean;\n odometer?: {\n km?: number;\n };\n used?: boolean;\n };\n general: {\n bodystyle?: string;\n category: string;\n make?: string;\n model?: string;\n modelName?: string;\n type?: string;\n typeName?: string;\n tacho?: VehicleTachoTypes;\n color?: {\n mainColorHex?: string; //Hex color code\n chassisColorReferenceCode?: string; //Maker reference code. For now, mainly relevant for new trailers\n upperStructureColorReferenceCode?: string; //Maker reference code. For now, mainly relevant for new trailers\n };\n };\n history?: {\n advertisingYear?: number;\n constructionYear?: number;\n currentRegistration?: {\n country?: string;\n technicalInspectionEndDate?: string;\n carpassUrl?: string;\n carpassAvailable?: boolean;\n };\n firstRegistration?: string;\n cocPvg?: string;\n };\n identification: {\n licensePlate?: string;\n stockNumber?: string;\n vin?: string;\n buildStockNumber?: string;\n engineNumber?: string;\n };\n trailers?: {\n cooler?: {\n hasCooler?: boolean;\n make?: string;\n };\n };\n powertrain?: {\n axles?: VehicleAxlesInfo;\n emissions?: {\n class?: string;\n subclass?: string;\n };\n engine?: {\n cylinderCount?: number;\n energy?: { type?: VehicleFuelType };\n power?: {\n hp?: number;\n };\n displacement?: number;\n };\n transmission?: {\n gearCount?: number;\n make?: string;\n model?: string;\n type?: 'Automatic' | 'Manual' | 'Semi-Automatic';\n };\n };\n salesConditions: {\n leasing?: boolean;\n price?: string | undefined;\n currency?: string | undefined;\n /**\n * Read-only field maintained by `fillReadOnlyFields` on every vehicle save:\n * the value of `price` immediately before the most recent price change. Stays\n * unchanged when `price` does not change between saves. Same currency as\n * `price`. Useful for storefront \"was/now\" price-drop labels and for the AI\n * assistant's negotiation context.\n */\n previousPrice?: string;\n marginScheme?: boolean;\n manufacturerWarranty?: {\n remarks?: string;\n available?: boolean;\n };\n /**\n * Per-country snapshot computed by the owning tenant's `fillReadOnlyFields`.\n * Every field on this snapshot is public — `vehicle.external` rides through\n * to the storefront via cross-tenant sync, so internal-only values (e.g. the\n * owner's freight cost) must not appear here. Cross-tenant sync derives the\n * internal `externalTransport` figure directly from the owner's country-\n * delivery rule at sync time.\n *\n * Each entry exposes:\n * - `price` — bare currency conversion for the rule's country.\n * - `previousPrice` — bare conversion of `salesConditions.previousPrice`\n * when set.\n * - `deliveryPrice` — customer-facing delivery fee (when the rule covers\n * the vehicle's category). Storefront consumers sum\n * `price + (deliveryPrice ?? 0)` at the display layer.\n * - `deliveryLocation` — human-readable label, present whenever the rule\n * declared a location for this country.\n *\n * Only the original owner recomputes on save; cross-tenant copies preserve\n * the array.\n */\n localizedPricing?: Array<{\n countryCode: string;\n currency: string;\n price: number;\n previousPrice?: number;\n deliveryPrice?: number;\n deliveryLocation?: string;\n }>;\n };\n superstructure?: VehicleSuperstructure;\n weights?: {\n gvw?: number;\n massEmpty?: number;\n };\n accessories: {\n abs?: boolean;\n jumbo?: boolean;\n adr?: boolean;\n airco?: boolean;\n alloyWheels?: boolean;\n aluminiumFuelTank?: boolean;\n cdPlayer?: boolean;\n coil?: boolean;\n doubleStock?: boolean;\n centralLocking?: boolean;\n centralLubrication?: boolean;\n cruiseControl?: boolean;\n electricDoorMirrors?: boolean;\n electricWindows?: boolean;\n engineBrake?: boolean;\n forklift?: boolean;\n navigationSystem?: boolean;\n hydraulicTipperKit?: boolean;\n lowDeck?: boolean;\n lowNoise?: boolean;\n mega?: boolean;\n parkingHeater?: boolean;\n particleFilter?: boolean;\n powerTakeOff?: boolean;\n refrigerator?: boolean;\n retarderIntarder?: boolean;\n reversingCamera?: boolean;\n roofSpoiler?: boolean;\n sideSkirts?: boolean;\n spareKey?: boolean;\n spareWheel?: boolean;\n speedLimiter?: boolean;\n spoilers?: boolean;\n spotlights?: boolean;\n stabilityControl?: boolean;\n standardAirco?: boolean;\n television?: boolean;\n toolbox?: boolean;\n trailerCoupling?: boolean;\n twinFuelTank?: boolean;\n visor?: boolean;\n xenonLights?: boolean;\n };\n publicLink?: string;\n};\n\ntype BaseVehicle<I = VehicleInternalInfo, E = VehicleExternalInfo> = {\n internal: I;\n external: E;\n original?: VehicleOriginalInfo;\n};\n\nexport type NewVehicle<I = VehicleInternalInfo, E = VehicleExternalInfo> = BaseVehicle<I, E> & {\n id?: undefined;\n};\n\nexport type Vehicle<I = VehicleInternalInfo, E = VehicleExternalInfo> = BaseVehicle<I, E> & {\n id: string;\n};\n\nexport type VehicleBffMetadata = {\n openOpportunities: number;\n};\n\nexport type VehicleBff = {\n vehicle: DataRecord<Vehicle, VehicleBffMetadata>;\n sale?: VehicleSaleInfo;\n purchase?: VehiclePurchase;\n overview?: VehicleBusinessOverviewXL;\n marketing?: {\n titles?: MultiLangValue;\n listed: boolean;\n sharable: boolean;\n publishedOnWebsiteAt?: string;\n numPlatformsPublished: number;\n };\n};\n\nexport type VehiclesByChassisNumberRequest = {\n tenantIds: string[];\n chassisNumber: string;\n};\n\nexport type VehiclesByMetaIdRequest = {\n tenantIds: string[];\n metaId: string;\n};\n\nexport type VehicleAxle = {\n make?: string;\n alloyWheels?: boolean;\n brakes?: 'Disc' | 'Drum';\n differentialLock?: boolean;\n liftAxle?: boolean;\n maxLoad?: number;\n nr: number;\n position?: string;\n powered?: boolean;\n reduction?: string;\n steering?: boolean;\n suspension?: 'Steel' | 'Air' | 'Hydraulic';\n twinWheels?: boolean;\n tyreSize?: string;\n tyreConditionType?: 'mm' | '%';\n\n tyreConditionMmLeftInside?: number;\n tyreConditionMmLeftOutside?: number;\n tyreConditionMmRightInside?: number;\n tyreConditionMmRightOutside?: number;\n\n tyreConditionPercLeftInside?: number;\n tyreConditionPercLeftOutside?: number;\n tyreConditionPercRightInside?: number;\n tyreConditionPercRightOutside?: number;\n\n steeringType?: 'fixed' | 'self_steering' | 'hydraulic';\n};\n\nexport enum VehiclePurchaseDealStatus {\n Marketing = 'MARKETING',\n PurchaseEvaluation = 'PURCHASE_EVALUATION', // used for vehicle consignation\n PurchaseAgreed = 'PURCHASE_AGREED',\n FirstPaymentAllowed = 'FIRST_PAYMENT_ALLOWED',\n FirstPaymentSent = 'FIRST_PAYMENT_SENT',\n FullPaymentAllowed = 'FULL_PAYMENT_ALLOWED',\n FullPaymentSent = 'FULL_PAYMENT_SENT',\n}\n\nexport enum VehiclePurchaseLogisticsStatus {\n AtOrigin = 'AT_ORIGIN',\n Arrived = 'ARRIVED',\n CheckedIn = 'CHECKED_IN',\n NotApplicable = 'NOT_APPLICABLE',\n}\n\nexport enum VehiclePurchaseDeliveryType {\n PickUp = 'PICK_UP',\n DropOff = 'DROP_OFF',\n}\n\nexport type VehicleStatus = {\n deleted?: boolean;\n deletedReason?: string;\n};\n\nexport type VehiclePriceList = {\n uploadedAt: string;\n uploadedBy: string;\n priceList: AttachmentValue;\n id: string;\n};\n\nexport type UpdateVehiclesPricesRequest = {\n priceList: AttachmentValue;\n};\n\nexport type VehiclePriceListLine = {\n reference: string;\n internet?: string;\n premium?: string;\n minimum?: string;\n};\n\nexport type VehiclePriceUpdateError = {\n data: VehiclePriceListLine;\n line: number;\n error: {\n fieldId: keyof VehiclePriceListLine;\n msg: string;\n };\n};\n\nexport type VehiclePriceUpdateResponse =\n | {\n success: true;\n }\n | {\n success: false;\n errors: VehiclePriceUpdateError[];\n };\n\nexport type VehiclePurchase = {\n organizationId: string;\n contactId: string;\n supplierStockNumber?: string;\n purchasedBy: string;\n purchaseAssistedBy?: string;\n\n log: {\n // computed automatically by the backend\n marketingStartedAt?: string;\n marketingStartedBy?: string;\n\n evaluationStartedAt?: string;\n evaluationStartedBy?: string;\n\n purchaseAgreedAt?: string;\n purchaseAgreedBy?: string;\n\n firstPaymentAllowedAt?: string;\n firstPaymentAllowedBy?: string;\n firstPaymentSentAt?: string;\n firstPaymentSentBy?: string;\n\n fullPaymentAllowedAt?: string;\n fullPaymentAllowedBy?: string;\n fullPaymentSentAt?: string;\n fullPaymentSentBy?: string;\n\n arrivedAt?: string;\n arrivedBy?: string;\n\n checkedInAt?: string;\n checkedInBy?: string;\n };\n\n deal: {\n status: VehiclePurchaseDealStatus; // partially set by the user, if there are payments then it is set automatically by the backend\n readyToDeliver?: boolean;\n\n purchaseVatRate?: string;\n purchase?: string; // exclusive VAT\n\n bonus?: string; // sometimes manufacturers pay us a bonus when we reach a target\n\n // estimated costs, real costs come from actual invoices\n commission?: string;\n externalTransport?: string;\n internalTransport?: string;\n externalGarage?: string;\n internalGarage?: string;\n other?: string;\n\n totalCosts?: string; // exclusive VAT\n };\n\n logistics: {\n parkingName?: string;\n status: VehiclePurchaseLogisticsStatus; // manually set by the user\n deliveryType?: VehiclePurchaseDeliveryType;\n pickupAddress?: LocationValue;\n availableWeek?: string; // ISOWEEK, e.g. 2016-W02\n };\n};\n\nexport type PurchaseRecordMeta = ReferenceData & {\n allowedLogisticsTransitions?: VehiclePurchaseLogisticsStatus[];\n};\n\nexport type SaveVehiclePurchaseOpts = {\n skipTransportValidation?: boolean;\n};\n\nexport enum VehicleActions {\n EditAdminDocs = 'edit_admin_docs',\n EditEngineeringDocs = 'edit_engineering_docs',\n EditMarketing = 'edit_marketing',\n EditMedia = 'edit_media',\n EditPictures = 'edit_pictures',\n EditPrices = 'edit_prices',\n EditPurchaseDeal = 'edit_purchase_deal',\n EditPurchaseLogistics = 'edit_purchase_logistics',\n EditSpecs = 'edit_specs',\n EditVideos = 'edit_videos',\n ViewLeads = 'view_leads',\n ViewBusinessOverview = 'view_business_overview',\n ViewSimilarOnline = 'view_similar_online',\n ViewPurchase = 'view_purchase',\n ViewPriceHistory = 'view_price_history',\n DeleteVehicle = 'delete_vehicle',\n}\n\nexport enum PurchaseActions {\n ViewDeal = 'view_deal',\n ViewSupplierOrganization = 'view_supplier_organization',\n ViewContact = 'view_contact',\n ViewLegalAddress = 'view_legal_address',\n ViewPickupAddress = 'view_pickup_address',\n ViewEstimatedCosts = 'view_estimated_costs',\n ViewFinanceDocuments = 'view_finance_documents',\n AddPayment = 'add_payment',\n EditPayment = 'edit_payment',\n MarkPaymentDone = 'mark_payment_done',\n AddRemarks = 'add_remarks',\n}\n\nexport enum VehicleBusinessOverviewActions {\n View = 'view_business_overview',\n}\n\nexport type VehicleShareEmailRequest = ShareEmailRequest & {\n pictures: AttachmentValue[];\n};\n\nexport type VehicleShareData = {\n title: string;\n mainPicture?: string;\n pictures: {\n picture: string;\n }[];\n message: string;\n specs: {\n name: string;\n value: string;\n }[];\n features: {\n name: string;\n }[];\n stockNumber: string;\n price?: string;\n description?: string;\n publicLink?: string;\n};\n\nexport type MarketingEmailData = {\n message: string;\n vehicles: VehicleShareData[];\n vehiclePairs: { first: VehicleShareData; second?: VehicleShareData }[];\n lastVehicle?: VehicleShareData;\n unsubscribeUrl?: string;\n};\n\nexport type VehicleReservationCreateEvent = BaseVehicleEvent & {\n action: 'create';\n reservation: OpportunityReservation;\n previousReservation?: undefined;\n};\n\nexport type VehicleReservationUpdateEvent = BaseVehicleEvent & {\n action: 'update';\n reservation: OpportunityReservation;\n previousReservation: OpportunityReservation;\n};\n\nexport type VehicleReservationDeleteEvent = BaseVehicleEvent & {\n action: 'delete';\n reservation?: undefined;\n previousReservation: OpportunityReservation;\n};\n\nexport type VehicleReservationEvent =\n | VehicleReservationCreateEvent\n | VehicleReservationUpdateEvent\n | VehicleReservationDeleteEvent;\n\nexport type ShareVehicleViaWahtsappRequest = {\n data: ShareWhatsappRequest;\n vehicleId: string;\n};\n\ntype RecordChange = {\n modifiedAt: string;\n modifiedBy: string;\n};\n\nexport type VehicleChange = RecordChange & {\n vehicle: Vehicle;\n};\n\nexport type PurchaseChange = RecordChange & {\n purchase: VehiclePurchase;\n};\n\nexport type RecordChangeRequest = PaginatedRequest & {\n fieldPath?: string;\n};\n"]}
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const convertCurrency = (amount, fromCurrency, toCurrency, rates) => {
|
|
2
|
+
if (fromCurrency === toCurrency) {
|
|
3
|
+
return Math.ceil(amount);
|
|
4
|
+
}
|
|
5
|
+
const direct = rates.find((r) => r.fromCurrency === fromCurrency && r.toCurrency === toCurrency);
|
|
6
|
+
if (direct != null) {
|
|
7
|
+
return Math.ceil(amount * direct.rate);
|
|
8
|
+
}
|
|
9
|
+
const inverse = rates.find((r) => r.fromCurrency === toCurrency && r.toCurrency === fromCurrency);
|
|
10
|
+
if (inverse != null && inverse.rate > 0) {
|
|
11
|
+
return Math.ceil(amount / inverse.rate);
|
|
12
|
+
}
|
|
13
|
+
return undefined;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=exchange-rates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exchange-rates.js","sourceRoot":"/","sources":["utils/exchange-rates.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,MAAc,EACd,YAAoB,EACpB,UAAkB,EAClB,KAAqB,EACD,EAAE;IACtB,IAAI,YAAY,KAAK,UAAU,EAAE,CAAC;QAChC,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;IAED,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,KAAK,YAAY,IAAI,CAAC,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC;IACjG,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;IAED,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,KAAK,UAAU,IAAI,CAAC,CAAC,UAAU,KAAK,YAAY,CAAC,CAAC;IAClG,IAAI,OAAO,IAAI,IAAI,IAAI,OAAO,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;QACxC,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC","sourcesContent":["import { ExchangeRate } from '../types/exchange-rates.js';\n\n/**\n * Convert `amount` from `fromCurrency` to `toCurrency` using a direction-agnostic\n * rate lookup. If a rate exists in either direction it is applied (inverted when\n * needed). Returns `undefined` if no matching pair is configured.\n *\n * `Math.ceil` is applied on the result so the seller is never undersold by a\n * partial unit of rounding.\n */\nexport const convertCurrency = (\n amount: number,\n fromCurrency: string,\n toCurrency: string,\n rates: ExchangeRate[],\n): number | undefined => {\n if (fromCurrency === toCurrency) {\n return Math.ceil(amount);\n }\n\n const direct = rates.find((r) => r.fromCurrency === fromCurrency && r.toCurrency === toCurrency);\n if (direct != null) {\n return Math.ceil(amount * direct.rate);\n }\n\n const inverse = rates.find((r) => r.fromCurrency === toCurrency && r.toCurrency === fromCurrency);\n if (inverse != null && inverse.rate > 0) {\n return Math.ceil(amount / inverse.rate);\n }\n\n return undefined;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exchange-rates.test.d.ts","sourceRoot":"/","sources":["utils/exchange-rates.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { convertCurrency } from './exchange-rates.js';
|
|
2
|
+
const rates = [
|
|
3
|
+
{ fromCurrency: 'EUR', toCurrency: 'USD', rate: 1.2 },
|
|
4
|
+
{ fromCurrency: 'EUR', toCurrency: 'XOF', rate: 655.96 },
|
|
5
|
+
];
|
|
6
|
+
describe('convertCurrency', () => {
|
|
7
|
+
test('passthrough when from and to are equal', () => {
|
|
8
|
+
expect(convertCurrency(10000, 'EUR', 'EUR', rates)).toBe(10000);
|
|
9
|
+
});
|
|
10
|
+
test('uses the direct rate', () => {
|
|
11
|
+
expect(convertCurrency(10000, 'EUR', 'USD', rates)).toBe(12000);
|
|
12
|
+
});
|
|
13
|
+
test('uses the inverse rate when only the reverse is configured', () => {
|
|
14
|
+
expect(convertCurrency(12000, 'USD', 'EUR', rates)).toBe(Math.ceil(12000 / 1.2));
|
|
15
|
+
});
|
|
16
|
+
test('returns undefined when no pair matches', () => {
|
|
17
|
+
expect(convertCurrency(10000, 'BRL', 'USD', rates)).toBeUndefined();
|
|
18
|
+
});
|
|
19
|
+
test('uses Math.ceil to avoid underselling on partial units', () => {
|
|
20
|
+
expect(convertCurrency(999.5, 'EUR', 'USD', rates)).toBe(Math.ceil(999.5 * 1.2));
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=exchange-rates.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exchange-rates.test.js","sourceRoot":"/","sources":["utils/exchange-rates.test.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,KAAK,GAAmB;IAC5B,EAAE,YAAY,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE;IACrD,EAAE,YAAY,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE;CACzD,CAAC;AAEF,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,IAAI,CAAC,wCAAwC,EAAE,GAAG,EAAE;QAClD,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAClE,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,sBAAsB,EAAE,GAAG,EAAE;QAChC,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAClE,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,2DAA2D,EAAE,GAAG,EAAE;QACrE,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC;IACnF,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,wCAAwC,EAAE,GAAG,EAAE;QAClD,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,uDAAuD,EAAE,GAAG,EAAE;QACjE,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC;IACnF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { ExchangeRate } from '../types/exchange-rates.js';\nimport { convertCurrency } from './exchange-rates.js';\n\nconst rates: ExchangeRate[] = [\n { fromCurrency: 'EUR', toCurrency: 'USD', rate: 1.2 },\n { fromCurrency: 'EUR', toCurrency: 'XOF', rate: 655.96 },\n];\n\ndescribe('convertCurrency', () => {\n test('passthrough when from and to are equal', () => {\n expect(convertCurrency(10000, 'EUR', 'EUR', rates)).toBe(10000);\n });\n\n test('uses the direct rate', () => {\n expect(convertCurrency(10000, 'EUR', 'USD', rates)).toBe(12000);\n });\n\n test('uses the inverse rate when only the reverse is configured', () => {\n expect(convertCurrency(12000, 'USD', 'EUR', rates)).toBe(Math.ceil(12000 / 1.2));\n });\n\n test('returns undefined when no pair matches', () => {\n expect(convertCurrency(10000, 'BRL', 'USD', rates)).toBeUndefined();\n });\n\n test('uses Math.ceil to avoid underselling on partial units', () => {\n expect(convertCurrency(999.5, 'EUR', 'USD', rates)).toBe(Math.ceil(999.5 * 1.2));\n });\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vehicles.d.ts","sourceRoot":"/","sources":["utils/vehicles.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,eAAO,MAAM,qBAAqB,GAAI,SAAS,mBAAmB,KAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"vehicles.d.ts","sourceRoot":"/","sources":["utils/vehicles.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,eAAO,MAAM,qBAAqB,GAAI,SAAS,mBAAmB,KAAG,MAAM,EA+C1E,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,yDAM9B;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,KAAG,MAcH,CAAC;AAKF,eAAO,MAAM,sBAAsB,GAAI,KAAK,MAAM,KAAG,MAiBpD,CAAC;AAGF,eAAO,MAAM,sBAAsB,GAAI,SAAS,MAAM,KAAG,MAWxD,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,aAAa,MAAM,KAAG,MAa/D,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,UAAU,mBAAmB,EAC7B,mDAIG;IACD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,WAyBF,CAAC"}
|
package/lib/utils/vehicles.js
CHANGED
|
@@ -28,6 +28,14 @@ export const extractCustomFeatures = (vehicle) => {
|
|
|
28
28
|
getValue: (vehicle) => vehicle.accessories.coil,
|
|
29
29
|
picklistValueId: 'coil',
|
|
30
30
|
},
|
|
31
|
+
{
|
|
32
|
+
getValue: (vehicle) => vehicle.accessories.doubleStock,
|
|
33
|
+
picklistValueId: 'doubleStock',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
getValue: (vehicle) => vehicle.accessories.mega,
|
|
37
|
+
picklistValueId: 'mega',
|
|
38
|
+
},
|
|
31
39
|
{
|
|
32
40
|
getValue: (vehicle) => vehicle.salesConditions?.manufacturerW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E,SAAS,EAAE,QAAQ,IAAI,QAAQ,CAAC,UAAU,EAAE,SAAS,EAAE,KAAK;QACjF,UAAU;QACV,qBAAqB,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,SAAS;KAC9E,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACd,CAAC,CAAC","sourcesContent":["import { XError } from '@bisondesk/commons-sdk/errors';\nimport { joinWithSeparator } from '@bisondesk/commons-sdk/formatting';\nimport { Categories } from '../constants.js';\nimport { VehicleExternalInfo } from '../types/vehicles.js';\n\nexport const extractCustomFeatures = (vehicle: VehicleExternalInfo): string[] => {\n const features: {\n getValue: (vehicle: VehicleExternalInfo) => any;\n picklistValueId: string;\n }[] = [\n {\n getValue: (vehicle) => vehicle.superstructure?.crane?.present,\n picklistValueId: 'crane',\n },\n {\n getValue: (vehicle) => vehicle.superstructure?.tailgate?.present,\n picklistValueId: 'tailgate',\n },\n { getValue: (vehicle) => vehicle.accessories.adr, picklistValueId: 'adr' },\n {\n getValue: (vehicle) => vehicle.accessories.retarderIntarder,\n picklistValueId: 'retarderIntarder',\n },\n {\n getValue: (vehicle) => vehicle.accessories.hydraulicTipperKit,\n picklistValueId: 'hydraulicTipperKit',\n },\n {\n getValue: (vehicle) => vehicle.accessories.lowDeck,\n picklistValueId: 'lowDeck',\n },\n {\n getValue: (vehicle) => vehicle.accessories.coil,\n picklistValueId: 'coil',\n },\n {\n getValue: (vehicle) => vehicle.salesConditions?.manufacturerWarranty?.available,\n picklistValueId: 'warranty',\n },\n ];\n\n return features\n .filter((feature) => !!feature.getValue(vehicle))\n .map((feature) => feature.picklistValueId);\n};\n\nexport const getInternalTitle = ({\n make,\n category,\n modelName,\n bodywork,\n modelTypeName,\n}: {\n category: string;\n make?: string;\n modelName?: string;\n modelTypeName?: string;\n bodywork?: string;\n}): string => {\n if (category === Categories.Trailer || category === Categories.SemiTrailer) {\n return [make, modelName, modelTypeName, bodywork]\n .filter((v): v is string => !!v)\n .map((v) => v.trim())\n .join(' ')\n .trim();\n }\n\n return [make, modelName, modelTypeName]\n .filter((v): v is string => !!v)\n .map((v) => v.trim())\n .join(' ')\n .trim();\n};\n\nconst ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';\n\n// example: 1 -> A, 2 -> B, 26 -> Z, 27 -> AA, 28 -> AB, 52 -> AZ, 53 -> BA, 54 -> BB, 702 -> ZZ\nexport const convertNumberToLetters = (num: number): string => {\n const lettersLength = ALPHABET.length;\n\n if (num < 1) {\n return '';\n }\n\n let remainder = num % lettersLength;\n let quotient = Math.floor(num / lettersLength);\n\n // If remainder is 0, it means we should map it to 'Z' and reduce the quotient by 1\n if (remainder === 0) {\n remainder = lettersLength;\n quotient -= 1;\n }\n\n return convertNumberToLetters(quotient) + ALPHABET.charAt(remainder - 1);\n};\n\n// example: A -> 1, B -> 2, Z -> 26, AA -> 27, AB -> 28, AZ -> 52, BA -> 53, BB -> 54, ZZ -> 702\nexport const convertLettersToNumber = (letters: string): number => {\n const base = ALPHABET.length;\n\n let result = 0;\n\n for (let i = 0; i < letters.length; i++) {\n const charValue = ALPHABET.indexOf(letters[i]) + 1;\n result = result * base + charValue;\n }\n\n return result;\n};\n\nexport const getNextRelatedStockNumber = (stockNumber: string): string => {\n const counterPattern = /^([A-Z]+\\d{5})([A-Z]{0,2})$/;\n const match = stockNumber.match(counterPattern);\n if (match == null) {\n throw new XError('core-sdk.vehicles.bad-stock-number', { stockNumber });\n }\n\n const baseStockNumber = match[1];\n const counterLetters = match[2];\n const counterNumber = convertLettersToNumber(counterLetters);\n const nextCounterNumber = counterNumber + 1;\n const nextCounterLetters = convertNumberToLetters(nextCounterNumber);\n return `${baseStockNumber}${nextCounterLetters}`;\n};\n\nexport const getVehicleDescription = (\n external: VehicleExternalInfo,\n {\n showStockNumber = false,\n showAxleConfiguration = false,\n lang,\n }: {\n showStockNumber?: boolean;\n showAxleConfiguration?: boolean;\n lang?: string;\n },\n) => {\n const dimensions = [\n external.superstructure?.dimensions?.extended,\n external.superstructure?.dimensions?.heightened,\n ]\n .filter((value) => !!value)\n .join('');\n const kmFormatter = Intl.NumberFormat(lang, {\n style: 'unit',\n unit: 'kilometer',\n });\n\n const text = joinWithSeparator([\n showStockNumber ? external.identification.stockNumber : undefined,\n external.history?.advertisingYear,\n external.condition?.odometer?.km != null\n ? kmFormatter.format(external.condition.odometer.km)\n : undefined,\n external.powertrain?.emissions?.subclass ?? external.powertrain?.emissions?.class,\n dimensions,\n showAxleConfiguration ? external.powertrain?.axles?.configuration : undefined,\n ]);\n\n return text;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"vehicles.js","sourceRoot":"/","sources":["utils/vehicles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,OAA4B,EAAY,EAAE;IAC9E,MAAM,QAAQ,GAGR;QACJ;YACE,QAAQ,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,cAAc,EAAE,KAAK,EAAE,OAAO;YAC7D,eAAe,EAAE,OAAO;SACzB;QACD;YACE,QAAQ,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,cAAc,EAAE,QAAQ,EAAE,OAAO;YAChE,eAAe,EAAE,UAAU;SAC5B;QACD,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,EAAE,eAAe,EAAE,KAAK,EAAE;QAC1E;YACE,QAAQ,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,gBAAgB;YAC3D,eAAe,EAAE,kBAAkB;SACpC;QACD;YACE,QAAQ,EAAE,CAAC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C,CAAC,CAAC,KAAK,CAAC;SAC1B,IAAI,CAAC,EAAE,CAAC,CAAC;IACZ,MAAM,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE;QAC1C,KAAK,EAAE,MAAM;QACb,IAAI,EAAE,WAAW;KAClB,CAAC,CAAC;IAEH,MAAM,IAAI,GAAG,iBAAiB,CAAC;QAC7B,eAAe,CAAC,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS;QACjE,QAAQ,CAAC,OAAO,EAAE,eAAe;QACjC,QAAQ,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,IAAI,IAAI;YACtC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC;YACpD,CAAC,CAAC,SAAS;QACb,QAAQ,CAAC,UAAU,EAAE,SAAS,EAAE,QAAQ,IAAI,QAAQ,CAAC,UAAU,EAAE,SAAS,EAAE,KAAK;QACjF,UAAU;QACV,qBAAqB,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,SAAS;KAC9E,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACd,CAAC,CAAC","sourcesContent":["import { XError } from '@bisondesk/commons-sdk/errors';\nimport { joinWithSeparator } from '@bisondesk/commons-sdk/formatting';\nimport { Categories } from '../constants.js';\nimport { VehicleExternalInfo } from '../types/vehicles.js';\n\nexport const extractCustomFeatures = (vehicle: VehicleExternalInfo): string[] => {\n const features: {\n getValue: (vehicle: VehicleExternalInfo) => any;\n picklistValueId: string;\n }[] = [\n {\n getValue: (vehicle) => vehicle.superstructure?.crane?.present,\n picklistValueId: 'crane',\n },\n {\n getValue: (vehicle) => vehicle.superstructure?.tailgate?.present,\n picklistValueId: 'tailgate',\n },\n { getValue: (vehicle) => vehicle.accessories.adr, picklistValueId: 'adr' },\n {\n getValue: (vehicle) => vehicle.accessories.retarderIntarder,\n picklistValueId: 'retarderIntarder',\n },\n {\n getValue: (vehicle) => vehicle.accessories.hydraulicTipperKit,\n picklistValueId: 'hydraulicTipperKit',\n },\n {\n getValue: (vehicle) => vehicle.accessories.lowDeck,\n picklistValueId: 'lowDeck',\n },\n {\n getValue: (vehicle) => vehicle.accessories.coil,\n picklistValueId: 'coil',\n },\n {\n getValue: (vehicle) => vehicle.accessories.doubleStock,\n picklistValueId: 'doubleStock',\n },\n {\n getValue: (vehicle) => vehicle.accessories.mega,\n picklistValueId: 'mega',\n },\n {\n getValue: (vehicle) => vehicle.salesConditions?.manufacturerWarranty?.available,\n picklistValueId: 'warranty',\n },\n ];\n\n return features\n .filter((feature) => !!feature.getValue(vehicle))\n .map((feature) => feature.picklistValueId);\n};\n\nexport const getInternalTitle = ({\n make,\n category,\n modelName,\n bodywork,\n modelTypeName,\n}: {\n category: string;\n make?: string;\n modelName?: string;\n modelTypeName?: string;\n bodywork?: string;\n}): string => {\n if (category === Categories.Trailer || category === Categories.SemiTrailer) {\n return [make, modelName, modelTypeName, bodywork]\n .filter((v): v is string => !!v)\n .map((v) => v.trim())\n .join(' ')\n .trim();\n }\n\n return [make, modelName, modelTypeName]\n .filter((v): v is string => !!v)\n .map((v) => v.trim())\n .join(' ')\n .trim();\n};\n\nconst ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';\n\n// example: 1 -> A, 2 -> B, 26 -> Z, 27 -> AA, 28 -> AB, 52 -> AZ, 53 -> BA, 54 -> BB, 702 -> ZZ\nexport const convertNumberToLetters = (num: number): string => {\n const lettersLength = ALPHABET.length;\n\n if (num < 1) {\n return '';\n }\n\n let remainder = num % lettersLength;\n let quotient = Math.floor(num / lettersLength);\n\n // If remainder is 0, it means we should map it to 'Z' and reduce the quotient by 1\n if (remainder === 0) {\n remainder = lettersLength;\n quotient -= 1;\n }\n\n return convertNumberToLetters(quotient) + ALPHABET.charAt(remainder - 1);\n};\n\n// example: A -> 1, B -> 2, Z -> 26, AA -> 27, AB -> 28, AZ -> 52, BA -> 53, BB -> 54, ZZ -> 702\nexport const convertLettersToNumber = (letters: string): number => {\n const base = ALPHABET.length;\n\n let result = 0;\n\n for (let i = 0; i < letters.length; i++) {\n const charValue = ALPHABET.indexOf(letters[i]) + 1;\n result = result * base + charValue;\n }\n\n return result;\n};\n\nexport const getNextRelatedStockNumber = (stockNumber: string): string => {\n const counterPattern = /^([A-Z]+\\d{5})([A-Z]{0,2})$/;\n const match = stockNumber.match(counterPattern);\n if (match == null) {\n throw new XError('core-sdk.vehicles.bad-stock-number', { stockNumber });\n }\n\n const baseStockNumber = match[1];\n const counterLetters = match[2];\n const counterNumber = convertLettersToNumber(counterLetters);\n const nextCounterNumber = counterNumber + 1;\n const nextCounterLetters = convertNumberToLetters(nextCounterNumber);\n return `${baseStockNumber}${nextCounterLetters}`;\n};\n\nexport const getVehicleDescription = (\n external: VehicleExternalInfo,\n {\n showStockNumber = false,\n showAxleConfiguration = false,\n lang,\n }: {\n showStockNumber?: boolean;\n showAxleConfiguration?: boolean;\n lang?: string;\n },\n) => {\n const dimensions = [\n external.superstructure?.dimensions?.extended,\n external.superstructure?.dimensions?.heightened,\n ]\n .filter((value) => !!value)\n .join('');\n const kmFormatter = Intl.NumberFormat(lang, {\n style: 'unit',\n unit: 'kilometer',\n });\n\n const text = joinWithSeparator([\n showStockNumber ? external.identification.stockNumber : undefined,\n external.history?.advertisingYear,\n external.condition?.odometer?.km != null\n ? kmFormatter.format(external.condition.odometer.km)\n : undefined,\n external.powertrain?.emissions?.subclass ?? external.powertrain?.emissions?.class,\n dimensions,\n showAxleConfiguration ? external.powertrain?.axles?.configuration : undefined,\n ]);\n\n return text;\n};\n"]}
|
package/package.json
CHANGED
|
@@ -2,11 +2,13 @@ import { TENANT_ID_ADMIN_HEADER } from '@bisondesk/commons-sdk/constants';
|
|
|
2
2
|
import { XError } from '@bisondesk/commons-sdk/errors';
|
|
3
3
|
import { getAdminAuth } from '@bisondesk/commons-sdk/fetch';
|
|
4
4
|
import fetch, { Response } from 'node-fetch';
|
|
5
|
-
import {
|
|
5
|
+
import { CountryDeliveryRule } from '../types/country-delivery.js';
|
|
6
6
|
|
|
7
|
-
export const
|
|
7
|
+
export const listCountryDeliveryRules = async (
|
|
8
|
+
tenantId: string,
|
|
9
|
+
): Promise<CountryDeliveryRule[]> => {
|
|
8
10
|
const auth = await getAdminAuth();
|
|
9
|
-
const url = `${process.env.CORE_API_ORIGIN}/api/settings/country-
|
|
11
|
+
const url = `${process.env.CORE_API_ORIGIN}/api/settings/country-delivery`;
|
|
10
12
|
const response: Response = await fetch(url, {
|
|
11
13
|
headers: {
|
|
12
14
|
Authorization: auth,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export var ActivityType;
|
|
2
|
+
(function (ActivityType) {
|
|
3
|
+
ActivityType["CALL"] = "call";
|
|
4
|
+
ActivityType["MEETING"] = "meeting";
|
|
5
|
+
ActivityType["EMAIL"] = "email";
|
|
6
|
+
ActivityType["CHAT"] = "chat";
|
|
7
|
+
})(ActivityType || (ActivityType = {}));
|
|
8
|
+
export var ActivityActions;
|
|
9
|
+
(function (ActivityActions) {
|
|
10
|
+
ActivityActions["DELETE"] = "delete";
|
|
11
|
+
ActivityActions["EDIT"] = "edit";
|
|
12
|
+
})(ActivityActions || (ActivityActions = {}));
|
|
13
|
+
//# sourceMappingURL=activities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activities.js","sourceRoot":"","sources":["activities.ts"],"names":[],"mappings":"AAGA,MAAM,CAAN,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,6BAAa,CAAA;IACb,mCAAmB,CAAA;IACnB,+BAAe,CAAA;IACf,6BAAa,CAAA;AACf,CAAC,EALW,YAAY,KAAZ,YAAY,QAKvB;AAED,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,oCAAiB,CAAA;IACjB,gCAAa,CAAA;AACf,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comparables.js","sourceRoot":"","sources":["comparables.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Categories } from '../constants.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Per-category freight figures. The two figures are paired by design — for any
|
|
5
|
+
* category covered by the rule, both must be set:
|
|
6
|
+
*
|
|
7
|
+
* - `cost` — internal freight cost. Feeds `externalTransport` on the cross-tenant
|
|
8
|
+
* purchase deal of the receiving tenant. Not customer-facing.
|
|
9
|
+
* - `price` — customer-facing delivery price. Surfaced on the storefront via
|
|
10
|
+
* `salesConditions.localizedPricing[i].deliveryPrice`. May exceed `cost` —
|
|
11
|
+
* the difference is the operator's margin on transport.
|
|
12
|
+
*/
|
|
13
|
+
export type CategoryDelivery = {
|
|
14
|
+
cost: number;
|
|
15
|
+
price: number;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
type DeliveryFields =
|
|
19
|
+
| {
|
|
20
|
+
/**
|
|
21
|
+
* Paired `{ cost, price }` per vehicle category. Categories not present in
|
|
22
|
+
* the map have no freight quote in this rule.
|
|
23
|
+
*/
|
|
24
|
+
deliveryByCategory?: Partial<Record<Categories, CategoryDelivery>>;
|
|
25
|
+
/** Human-readable, e.g., "Iquique (Chile)". */
|
|
26
|
+
deliveryLocation: string;
|
|
27
|
+
}
|
|
28
|
+
| {
|
|
29
|
+
deliveryByCategory?: never;
|
|
30
|
+
deliveryLocation?: never;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Per-destination delivery rule. The owning tenant declares, for each destination country,
|
|
35
|
+
* which currency that country's pricing is quoted in, the per-category paired
|
|
36
|
+
* `{ cost, price }` freight figures, and a human-readable delivery location label.
|
|
37
|
+
* Currency conversion no longer lives here — see the shared `public.exchange_rates` table.
|
|
38
|
+
*/
|
|
39
|
+
export type CountryDeliveryRule = {
|
|
40
|
+
countryCode: string; // lower-cased ISO 3166-1 alpha-2 (e.g., "cl")
|
|
41
|
+
currency: string; // ISO 4217 (e.g., "USD")
|
|
42
|
+
} & DeliveryFields;
|
package/src/types/crm.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export var OrganizatioRiskTags;
|
|
2
|
+
(function (OrganizatioRiskTags) {
|
|
3
|
+
OrganizatioRiskTags["BAD_FINANCIAL_INFO"] = "BAD_FINANCIAL_INFO";
|
|
4
|
+
OrganizatioRiskTags["VAT_NUMBER_INVALID"] = "VAT_NUMBER_INVALID";
|
|
5
|
+
OrganizatioRiskTags["INSTINCT"] = "INSTINCT";
|
|
6
|
+
OrganizatioRiskTags["NEW_CUSTOMER"] = "NEW_CUSTOMER";
|
|
7
|
+
OrganizatioRiskTags["BANK_ACCOUNT_BLOCKED"] = "BANK_ACCOUNT_BLOCKED";
|
|
8
|
+
OrganizatioRiskTags["NO_GPS"] = "NO_GPS";
|
|
9
|
+
})(OrganizatioRiskTags || (OrganizatioRiskTags = {}));
|
|
10
|
+
export var ContactActions;
|
|
11
|
+
(function (ContactActions) {
|
|
12
|
+
ContactActions["UPSERT"] = "upsert";
|
|
13
|
+
ContactActions["DELETE"] = "delete";
|
|
14
|
+
})(ContactActions || (ContactActions = {}));
|
|
15
|
+
export var OrganizationActions;
|
|
16
|
+
(function (OrganizationActions) {
|
|
17
|
+
OrganizationActions["ADD_ACTIVITY"] = "add_activity";
|
|
18
|
+
OrganizationActions["UPSERT"] = "upsert";
|
|
19
|
+
OrganizationActions["DELETE"] = "delete";
|
|
20
|
+
OrganizationActions["SELL_TO_ORGANIZATION"] = "sell_to_organization";
|
|
21
|
+
})(OrganizationActions || (OrganizationActions = {}));
|
|
22
|
+
export var MarketingChannel;
|
|
23
|
+
(function (MarketingChannel) {
|
|
24
|
+
MarketingChannel["Email"] = "email";
|
|
25
|
+
MarketingChannel["Whatsapp"] = "whatsapp";
|
|
26
|
+
MarketingChannel["Sms"] = "sms";
|
|
27
|
+
MarketingChannel["Phone"] = "phone";
|
|
28
|
+
})(MarketingChannel || (MarketingChannel = {}));
|
|
29
|
+
export var PartnerLevel;
|
|
30
|
+
(function (PartnerLevel) {
|
|
31
|
+
PartnerLevel["Internal"] = "05-internal";
|
|
32
|
+
PartnerLevel["Gold"] = "10-gold";
|
|
33
|
+
PartnerLevel["Silver"] = "20-silver";
|
|
34
|
+
PartnerLevel["Bronze"] = "30-bronze";
|
|
35
|
+
})(PartnerLevel || (PartnerLevel = {}));
|
|
36
|
+
export var SaveContactResolution;
|
|
37
|
+
(function (SaveContactResolution) {
|
|
38
|
+
SaveContactResolution["IgnoreDuplicates"] = "IGNORE_DUPLICATES";
|
|
39
|
+
SaveContactResolution["BlockDuplicates"] = "BLOCK_DUPLICATES";
|
|
40
|
+
})(SaveContactResolution || (SaveContactResolution = {}));
|
|
41
|
+
export var SaveOrgResolution;
|
|
42
|
+
(function (SaveOrgResolution) {
|
|
43
|
+
SaveOrgResolution["IgnoreDuplicates"] = "IGNORE_DUPLICATES";
|
|
44
|
+
SaveOrgResolution["BlockDuplicates"] = "BLOCK_DUPLICATES";
|
|
45
|
+
})(SaveOrgResolution || (SaveOrgResolution = {}));
|
|
46
|
+
export var CrmSearchScope;
|
|
47
|
+
(function (CrmSearchScope) {
|
|
48
|
+
CrmSearchScope["Tenant"] = "tenant";
|
|
49
|
+
CrmSearchScope["Conglomerate"] = "conglomerate";
|
|
50
|
+
})(CrmSearchScope || (CrmSearchScope = {}));
|
|
51
|
+
export var OrgEngagementType;
|
|
52
|
+
(function (OrgEngagementType) {
|
|
53
|
+
OrgEngagementType["offers"] = "offers";
|
|
54
|
+
OrgEngagementType["purchases"] = "purchases";
|
|
55
|
+
OrgEngagementType["opportunities"] = "opportunities";
|
|
56
|
+
OrgEngagementType["sales"] = "sales";
|
|
57
|
+
})(OrgEngagementType || (OrgEngagementType = {}));
|
|
58
|
+
//# sourceMappingURL=crm.js.map
|
|
@@ -0,0 +1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B,iBAAiB,QAG5B;AAED,MAAM,CAAN,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,mCAAiB,CAAA;IACjB,+CAA6B,CAAA;AAC/B,CAAC,EAHW,cAAc,KAAd,cAAc,QAGzB;AAED,MAAM,CAAN,IAAY,iBAKX;AALD,WAAY,iBAAiB;IAC3B,sCAAiB,CAAA;IACjB,4CAAuB,CAAA;IACvB,oDAA+B,CAAA;IAC/B,oCAAe,CAAA;AACjB,CAAC,EALW,iBAAiB,KAAjB,iBAAiB,QAK5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dashboard.js","sourceRoot":"","sources":["dashboard.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["definitions.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One row in the shared `public.exchange_rates` table. Direction-agnostic: an
|
|
3
|
+
* `EUR → USD` row at rate `1.2` also defines the reverse `USD → EUR` at
|
|
4
|
+
* `1 / 1.2 ≈ 0.833`. Operators only need to store one direction per pair.
|
|
5
|
+
*/
|
|
6
|
+
export type ExchangeRate = {
|
|
7
|
+
fromCurrency: string; // ISO 4217 (e.g., "EUR")
|
|
8
|
+
toCurrency: string; // ISO 4217 (e.g., "USD")
|
|
9
|
+
rate: number; // positive, amount in `toCurrency` per 1 unit of `fromCurrency`
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["fields.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insights.js","sourceRoot":"","sources":["insights.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export var InterestActions;
|
|
2
|
+
(function (InterestActions) {
|
|
3
|
+
InterestActions["SET_INTEREST"] = "set_interest";
|
|
4
|
+
})(InterestActions || (InterestActions = {}));
|
|
5
|
+
export const isOpportunityInterest = (interest) => 'opportunityId' in interest;
|
|
6
|
+
//# sourceMappingURL=interests.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interests.js","sourceRoot":"","sources":["interests.ts"],"names":[],"mappings":"AAGA,MAAM,CAAN,IAAY,eAEX;AAFD,WAAY,eAAe;IACzB,gDAA6B,CAAA;AAC/B,CAAC,EAFW,eAAe,KAAf,eAAe,QAE1B;AAwBD,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,QAAkB,EAAmC,EAAE,CAC3F,eAAe,IAAI,QAAQ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export var InternalEventTypes;
|
|
2
|
+
(function (InternalEventTypes) {
|
|
3
|
+
InternalEventTypes["VEHICLE_PURCHASE"] = "vehicle-purchases";
|
|
4
|
+
InternalEventTypes["ORGANIZATION"] = "organizations";
|
|
5
|
+
InternalEventTypes["CONTACT"] = "contacts";
|
|
6
|
+
InternalEventTypes["FINANCE_DOCUMENT"] = "finance-documents";
|
|
7
|
+
InternalEventTypes["OPPORTUNITY"] = "opportunities";
|
|
8
|
+
InternalEventTypes["VEHICLE"] = "vehicles";
|
|
9
|
+
InternalEventTypes["SALE_PAYMENT"] = "sale-payments";
|
|
10
|
+
InternalEventTypes["PURCHASE_PAYMENT"] = "vehicle-purchase-payments";
|
|
11
|
+
InternalEventTypes["OFFER"] = "offers";
|
|
12
|
+
})(InternalEventTypes || (InternalEventTypes = {}));
|
|
13
|
+
export var InternalNotificationChannels;
|
|
14
|
+
(function (InternalNotificationChannels) {
|
|
15
|
+
InternalNotificationChannels["APP"] = "app";
|
|
16
|
+
InternalNotificationChannels["EMAIL"] = "email";
|
|
17
|
+
})(InternalNotificationChannels || (InternalNotificationChannels = {}));
|
|
18
|
+
//# sourceMappingURL=internal-events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal-events.js","sourceRoot":"","sources":["internal-events.ts"],"names":[],"mappings":"AASA,MAAM,CAAN,IAAY,kBAUX;AAVD,WAAY,kBAAkB;IAC5B,4DAAsC,CAAA;IACtC,oDAA8B,CAAA;IAC9B,0CAAoB,CAAA;IACpB,4DAAsC,CAAA;IACtC,mDAA6B,CAAA;IAC7B,0CAAoB,CAAA;IACpB,oDAA8B,CAAA;IAC9B,oEAA8C,CAAA;IAC9C,sCAAgB,CAAA;AAClB,CAAC,EAVW,kBAAkB,KAAlB,kBAAkB,QAU7B;AAED,MAAM,CAAN,IAAY,4BAGX;AAHD,WAAY,4BAA4B;IACtC,2CAAW,CAAA;IACX,+CAAe,CAAA;AACjB,CAAC,EAHW,4BAA4B,KAA5B,4BAA4B,QAGvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internet-opportunities.js","sourceRoot":"","sources":["internet-opportunities.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internet-vehicles.js","sourceRoot":"","sources":["internet-vehicles.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"leasing-administration.js","sourceRoot":"","sources":["leasing-administration.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"leasing-debtors.js","sourceRoot":"","sources":["leasing-debtors.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"leasing-search.js","sourceRoot":"","sources":["leasing-search.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export var LeasingItemsPaymentSplit;
|
|
2
|
+
(function (LeasingItemsPaymentSplit) {
|
|
3
|
+
LeasingItemsPaymentSplit["Customer"] = "customer";
|
|
4
|
+
LeasingItemsPaymentSplit["Split"] = "split";
|
|
5
|
+
LeasingItemsPaymentSplit["Company"] = "company";
|
|
6
|
+
})(LeasingItemsPaymentSplit || (LeasingItemsPaymentSplit = {}));
|
|
7
|
+
//# sourceMappingURL=leasing-settings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"leasing-settings.js","sourceRoot":"","sources":["leasing-settings.ts"],"names":[],"mappings":"AAwCA,MAAM,CAAN,IAAY,wBAIX;AAJD,WAAY,wBAAwB;IAClC,iDAAqB,CAAA;IACrB,2CAAe,CAAA;IACf,+CAAmB,CAAA;AACrB,CAAC,EAJW,wBAAwB,KAAxB,wBAAwB,QAInC"}
|