@bisondesk/core-sdk 1.0.432 → 1.0.433

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.
@@ -2,6 +2,7 @@ import { Document, NextList } from '@bisondesk/commons-sdk/types';
2
2
  import { BusinessEntityIds, OpportunityType, WarningHints } from '../constants.js';
3
3
  import { Contact, Organization } from './crm.js';
4
4
  import type { InterestBffMeta, OpportunityInterest } from './interests.js';
5
+ import { BaseEvent } from './internal-events.js';
5
6
  import { Payment } from './payments.js';
6
7
  import { Quote, QuoteStatus } from './quotes.js';
7
8
  import { OpportunityReservation } from './reservations.js';
@@ -251,7 +252,7 @@ export type OpportunityBFF = {
251
252
  };
252
253
  };
253
254
 
254
- type BaseOpportunityEvent = {
255
+ type BaseOpportunityEvent = BaseEvent & {
255
256
  actionAt: string;
256
257
  userId: string;
257
258
  tenantId: string;
@@ -269,21 +270,12 @@ export type OpportunityUpdateEvent = BaseOpportunityEvent & {
269
270
  action: 'update';
270
271
  };
271
272
 
272
- export type OpportunityDeleteEvent = BaseOpportunityEvent & {
273
- opportunity?: undefined;
274
- previousOpportunity: Opportunity;
275
- action: 'delete';
276
- };
277
-
278
- export type OpportunityEvent =
279
- | OpportunityCreateEvent
280
- | OpportunityUpdateEvent
281
- | OpportunityDeleteEvent;
273
+ export type OpportunityEvent = OpportunityCreateEvent | OpportunityUpdateEvent;
282
274
 
283
275
  export type QuoteEvent = {
284
276
  quote: Quote;
285
277
  opportunity: Opportunity;
286
- action: 'create' | 'update' | 'delete';
278
+ action: 'create' | 'update';
287
279
  actionAt: string;
288
280
  userId: string;
289
281
  tenantId: string;
@@ -315,6 +307,7 @@ export type SearchOpportunity = {
315
307
  export const QUOTE_NEEDS_VALIDATION_NOTIFICATION_ORIGIN = 'quote-validation';
316
308
  export const QUOTE_NOT_CREATED_BY_ACCOUNT_MANAGER = 'quote-not-created-by-account-manager';
317
309
  export const QUOTE_VALIDATOR_FEEDBACK_NOTIFICATION_ORIGIN = 'quote-validation-feedback';
310
+
318
311
  export const OPPORTUNITY_VEHICLE_AVAILABLE_NOTIFICATION_ORIGIN = 'opportunity-vehicle-available';
319
312
  export const OPPORTUNITY_VEHICLE_DELIVERY_NOTIFICATION_ORIGIN = 'opportunity-vehicle-delivery';
320
313
  export const OPPORTUNITY_VEHICLE_RESERVATION_ABOUT_TO_EXPIRE_NOTIFICATION_ORIGIN =
@@ -322,6 +315,15 @@ export const OPPORTUNITY_VEHICLE_RESERVATION_ABOUT_TO_EXPIRE_NOTIFICATION_ORIGIN
322
315
  export const OPPORTUNITY_VEHICLE_RESERVATION_EXPIRED_NOTIFICATION_ORIGIN =
323
316
  'opportunity-vehicle-reservation-expired';
324
317
 
318
+ export const OFFER_SET_FINAL_VALUATION_ORIGIN = 'offer-set-final-valuation';
319
+
320
+ export const VEHICLE_PRICE_DECREASES_NOTIFICATION_ORIGIN = 'vehicle-price-decreased';
321
+ export const VEHICLE_ARRIVED_NOTIFICATION_ORIGIN = 'vehicle-arrived';
322
+ export const VEHICLE_CHECKEDIN_NOTIFICATION_ORIGIN = 'vehicle-checkedin';
323
+ export const VEHICLE_PURCHASED_NOTIFICATION_ORIGIN = 'vehicle-purchased';
324
+ export const VEHICLE_PRICE_CHANGED_NOTIFICATION_ORIGIN = 'vehicle-price-changed';
325
+ export const VEHICLE_SOLD_NOTIFICATION_ORIGIN = 'vehicle-sold';
326
+
325
327
  export type OpportunityNotificationData = {
326
328
  quoteVersion?: number;
327
329
  snippet?: string;
@@ -662,6 +664,18 @@ export type HpLeasingContractResponse = {
662
664
  contractNumber: string;
663
665
  };
664
666
 
667
+ export type HpLeasingDealReturnRequest = {
668
+ tenantId: string;
669
+ initiatedBy: 'bisondesk';
670
+ processMetaId: string;
671
+ processRunData: {
672
+ entityOwner: string;
673
+ leasingContractNumber2: string;
674
+ company: string;
675
+ vehicle: string;
676
+ };
677
+ };
678
+
665
679
  export type HpLeasingDealEndRequest = {
666
680
  tenantId: string;
667
681
  initiatedBy: 'bisondesk';
@@ -763,7 +777,7 @@ export type HpIsaProcessResponse = {
763
777
  };
764
778
 
765
779
  export type SwitchOpportunityVehicleRequest = {
766
- opportunityId: string;
780
+ opportunity: Opportunity;
767
781
  newVehicleId: string;
768
782
  };
769
783
 
@@ -1,3 +1,5 @@
1
+ import { BaseEvent } from './internal-events.js';
2
+
1
3
  export enum PaymentActions {
2
4
  DELETE = 'delete',
3
5
  EDIT = 'edit',
@@ -71,4 +73,5 @@ export type PaymentDeleteEvent = {
71
73
  branchId: string;
72
74
  };
73
75
 
74
- export type PaymentEvent = PaymentCreateEvent | PaymentUpdateEvent | PaymentDeleteEvent;
76
+ export type PaymentEvent = BaseEvent &
77
+ (PaymentCreateEvent | PaymentUpdateEvent | PaymentDeleteEvent);
@@ -50,7 +50,7 @@ export enum VehicleTachoTypes {
50
50
  SmartTacho2 = 'SMART_TACHO_2',
51
51
  }
52
52
 
53
- type BaseVehicleEvent = {
53
+ type BaseVehicleEvent = BaseEvent & {
54
54
  id: string;
55
55
  actionAt: string;
56
56
  userId: string;
@@ -250,6 +250,7 @@ export type SearchVehicle = {
250
250
  dealStatus?: VehiclePurchaseDealStatus;
251
251
  logisticsStatus?: VehiclePurchaseLogisticsStatus;
252
252
  purchasedBy?: string;
253
+ parkingName?: string;
253
254
  };
254
255
  reservation?: Pick<OpportunityReservation, 'expiresAt' | 'opportunityId' | 'createdBy'>;
255
256
  vehicle: Vehicle;
@@ -462,7 +463,6 @@ export type VehicleExternalInfo = {
462
463
  };
463
464
  salesConditions: {
464
465
  leasing?: boolean;
465
- expected?: boolean;
466
466
  price?: string | undefined;
467
467
  currency?: string | undefined;
468
468
  marginScheme?: boolean;
@@ -100,16 +100,16 @@ export const convertLettersToNumber = (letters: string): number => {
100
100
  };
101
101
 
102
102
  export const getNextRelatedStockNumber = (stockNumber: string): string => {
103
- const counterPattern = /^([A-Z]{2,4}\d{5})([A-Z]{0,2})$/;
103
+ const counterPattern = /^([A-Z]+\d{5})([A-Z]{0,2})$/;
104
104
  const match = stockNumber.match(counterPattern);
105
105
  if (match == null) {
106
106
  throw new XError('core-sdk.vehicles.bad-stock-number', { stockNumber });
107
107
  }
108
108
 
109
- const baseNumber = match[1];
110
- const counter = match[2];
111
- const counterNumber = convertLettersToNumber(counter);
109
+ const baseStockNumber = match[1];
110
+ const counterLetters = match[2];
111
+ const counterNumber = convertLettersToNumber(counterLetters);
112
112
  const nextCounterNumber = counterNumber + 1;
113
- const nextCounter = convertNumberToLetters(nextCounterNumber);
114
- return `${baseNumber}${nextCounter}`;
113
+ const nextCounterLetters = convertNumberToLetters(nextCounterNumber);
114
+ return `${baseStockNumber}${nextCounterLetters}`;
115
115
  };