@bisondesk/core-sdk 1.0.330 → 1.0.332
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/debtors.d.ts +6 -0
- package/lib/apis/debtors.d.ts.map +1 -0
- package/lib/apis/debtors.js +25 -0
- package/lib/apis/debtors.js.map +1 -0
- package/lib/apis/leasing.d.ts +5 -1
- package/lib/apis/leasing.d.ts.map +1 -1
- package/lib/apis/leasing.js +17 -0
- package/lib/apis/leasing.js.map +1 -1
- package/lib/apis/picklists.d.ts +1 -5
- package/lib/apis/picklists.d.ts.map +1 -1
- package/lib/apis/picklists.js +1 -51
- package/lib/apis/picklists.js.map +1 -1
- package/lib/types/definitions.d.ts +1 -37
- package/lib/types/definitions.d.ts.map +1 -1
- package/lib/types/definitions.js +1 -1
- package/lib/types/definitions.js.map +1 -1
- package/lib/types/fields.d.ts +1 -82
- package/lib/types/fields.d.ts.map +1 -1
- package/lib/types/fields.js +1 -25
- package/lib/types/fields.js.map +1 -1
- package/lib/types/opportunities.d.ts +1 -0
- package/lib/types/opportunities.d.ts.map +1 -1
- package/lib/types/opportunities.js.map +1 -1
- package/lib/types/picklists.d.ts +1 -82
- package/lib/types/picklists.d.ts.map +1 -1
- package/lib/types/picklists.js +1 -1
- package/lib/types/picklists.js.map +1 -1
- package/lib/types/search.d.ts +1 -175
- package/lib/types/search.d.ts.map +1 -1
- package/lib/types/search.js +1 -32
- package/lib/types/search.js.map +1 -1
- package/lib/types/utils.d.ts +1 -46
- package/lib/types/utils.d.ts.map +1 -1
- package/lib/types/utils.js +1 -5
- package/lib/types/utils.js.map +1 -1
- package/lib/utils/search.d.ts.map +1 -1
- package/lib/utils/search.js.map +1 -1
- package/package.json +1 -1
- package/src/apis/debtors.ts +37 -0
- package/src/apis/leasing.ts +30 -1
- package/src/apis/picklists.ts +1 -73
- package/src/types/definitions.ts +1 -43
- package/src/types/fields.ts +1 -123
- package/src/types/opportunities.ts +1 -0
- package/src/types/picklists.ts +1 -95
- package/src/types/search.ts +1 -222
- package/src/types/utils.ts +1 -52
- package/src/utils/search.ts +2 -0
- package/tsconfig.deploy.tsbuildinfo +1 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opportunities.js","sourceRoot":"/","sources":["types/opportunities.ts"],"names":[],"mappings":"AAWA,MAAM,CAAN,IAAY,kBAoBX;AApBD,WAAY,kBAAkB;IAC5B,uDAAiC,CAAA;IACjC,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;AACpC,CAAC,EApBW,kBAAkB,KAAlB,kBAAkB,QAoB7B;AAED,MAAM,CAAN,IAAY,qBAIX;AAJD,WAAY,qBAAqB;IAC/B,sDAA6B,CAAA;IAC7B,wDAA+B,CAAA;IAC/B,sDAA6B,CAAA;AAC/B,CAAC,EAJW,qBAAqB,KAArB,qBAAqB,QAIhC;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,0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AAgC,CAAA;IAChC,sDAAuB,CAAA;AACzB,CAAC,EAVW,2BAA2B,KAA3B,2BAA2B,QAUtC;AAkND,MAAM,CAAC,MAAM,0CAA0C,GAAG,kBAAkB,CAAC;AAC7E,MAAM,CAAC,MAAM,oCAAoC,GAAG,sCAAsC,CAAC;AAC3F,MAAM,CAAC,MAAM,4CAA4C,GAAG,2BAA2B,CAAC;AACxF,MAAM,CAAC,MAAM,iDAAiD,GAAG,+BAA+B,CAAC;AACjG,MAAM,CAAC,MAAM,gDAAgD,GAAG,8BAA8B,CAAC","sourcesContent":["import { Document, NextList } from '@bisondesk/commons-sdk/types';\nimport { BusinessEntityIds, OpportunityType, WarningHints } from '../constants.js';\nimport { Contact, Organization } from './crm.js';\nimport type { InterestBffMeta, OpportunityInterest } from './interests.js';\nimport { Payment } from './payments.js';\nimport { Quote, QuoteStatus } from './quotes.js';\nimport { OpportunityReservation } from './reservations.js';\nimport { BaseSearchRequest } from './search.js';\nimport { DataRecord, ReferenceData } from './utils.js';\nimport { Vehicle } from './vehicles.js';\n\nexport enum OpportunityActions {\n ADD_COMMISSION = 'add_commission',\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}\n\nexport enum OpportunityDealStatus {\n SALES_AGREED = 'sales_agreed',\n FIRST_PAYMENT = 'first_payment',\n FULL_PAYMENT = 'full_payment',\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 OpportunityLogisticStatus {\n AT_ORIGIN = 'at_origin',\n DELIVERED = 'delivered',\n}\n\nexport enum OpportunityRequirementsCode {\n VEHICLE_AT_ORIGIN = 'vehicle_at_origin',\n LEASING_SL_ACTION = 'sl_action',\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}\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}\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\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};\n\nexport type NewOpportunity = BaseOpportunity & {\n id?: undefined;\n createdAt?: undefined;\n createdBy?: undefined;\n modifiedAt?: undefined;\n modifiedBy?: undefined;\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 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 status: OpportunityStatus;\n dealStatus?: OpportunityDealStatus;\n logisticStatus?: OpportunityLogisticStatus;\n activeQuoteId?: string;\n amount?: string;\n documents?: Document[];\n leasingContractId?: 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 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 PaymentSummary = {\n total: string;\n paid: string;\n entries: DataRecord<Payment>[];\n};\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\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<OpportunityInterest, InterestBffMeta>;\n bids: DataRecord<Bid>[];\n quotes: DataRecord<Quote>[];\n activeQuote?: DataRecord<Quote>;\n payments: PaymentSummary | undefined;\n reservation?: DataRecord<OpportunityReservation>;\n customer?: {\n contact: DataRecord<Contact, ContactMetdata>;\n org?: DataRecord<Organization>;\n };\n};\n\ntype BaseOpportunityEvent = {\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 OpportunityDeleteEvent = BaseOpportunityEvent & {\n opportunity?: undefined;\n previousOpportunity: Opportunity;\n action: 'delete';\n};\n\nexport type OpportunityEvent =\n | OpportunityCreateEvent\n | OpportunityUpdateEvent\n | OpportunityDeleteEvent;\n\nexport type QuoteEvent = {\n quote: Quote;\n opportunity: Opportunity;\n action: 'create' | 'update' | 'delete';\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};\n\nexport type SearchOpportunity = {\n contact?: Contact;\n opportunity: Opportunity;\n org?: Organization;\n vehicle?: Vehicle;\n quote?: QuoteInfo;\n custom: {\n paymentStatus: OpportunityPaymentStatus;\n unassigned: boolean;\n lost: boolean;\n assignees: string[];\n vehicleCheckedIn: boolean;\n status: OpportunityStatus | 'won';\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';\nexport const OPPORTUNITY_VEHICLE_AVAILABLE_NOTIFICATION_ORIGIN = 'opportunity-vehicle-available';\nexport const OPPORTUNITY_VEHICLE_DELIVERY_NOTIFICATION_ORIGIN = 'opportunity-vehicle-delivery';\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 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 startupFee: string;\n totalExtras: string;\n totalBeforeDeliveryExclVat: string;\n totalBeforeDelivery: string;\n installment: string;\n duration: number;\n monthlyInsurance: string;\n monthlyTax: string;\n monthlyTaxesInsurance: string;\n residual: 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 monthly: string;\n monthlyExclVat: string;\n residual: string;\n residualExclVat: string;\n duration: number;\n };\n};\n\nexport type SalesProformaTemplateData = {\n opportunity: {\n id: string;\n offerNumber: string;\n };\n currentDate: string;\n expirationDate: 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 total: string;\n };\n};\n\nexport type SalesAgreementTemplateData = {\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 total: string;\n };\n};\n\nexport type OpportunitiesKanbanColumn = {\n status: string;\n results: SearchOpportunity[];\n totalCount: number;\n totalValue: string;\n};\n\nexport type MSearchOpportunitiesKanbanColumn = {\n column: OpportunitiesKanbanColumn;\n nextToken?: string;\n};\n\nexport type HpLeasingDealRequest = {\n tenantId: string;\n initiatedBy: 'bisondesk';\n processMetaId: string;\n processRunData: {\n entityOwner: string;\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?: string;\n yearOfConstruction?: number;\n chassisnumber?: string;\n vehicleModel?: string;\n vehicleCategory2?: string;\n licencePlate?: string;\n vatPercentage?: number;\n\n opportunityContractId: string;\n opportunityId: string;\n\n company?: string;\n customerNumber?: number; //bisondesk external id\n //MrLease fields\n vehicle?: string;\n vehicleNewReferenceMl?: 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};\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 entityOwner: 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 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 dealValidated: boolean;\n dealCancelled: boolean;\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 SwitchOpportunityVehicleRequest = {\n opportunityId: string;\n newVehicleId: string;\n};\n\nexport type KanbanOpportunitiesSearchRequest = BaseSearchRequest & {\n nextTokens?: Record<string, string | undefined>;\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":"AAWA,MAAM,CAAN,IAAY,kBAoBX;AApBD,WAAY,kBAAkB;IAC5B,uDAAiC,CAAA;IACjC,mDAA6B,CAAA;IAC7B,mCAAa,CAAA;IACb,uCAAiB,CAAA;IACjB,6DAAuC,CAAA;IACvC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inessEntityIds, OpportunityType, WarningHints } from '../constants.js';\nimport { Contact, Organization } from './crm.js';\nimport type { InterestBffMeta, OpportunityInterest } from './interests.js';\nimport { Payment } from './payments.js';\nimport { Quote, QuoteStatus } from './quotes.js';\nimport { OpportunityReservation } from './reservations.js';\nimport { BaseSearchRequest } from './search.js';\nimport { DataRecord, ReferenceData } from './utils.js';\nimport { Vehicle } from './vehicles.js';\n\nexport enum OpportunityActions {\n ADD_COMMISSION = 'add_commission',\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}\n\nexport enum OpportunityDealStatus {\n SALES_AGREED = 'sales_agreed',\n FIRST_PAYMENT = 'first_payment',\n FULL_PAYMENT = 'full_payment',\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 OpportunityLogisticStatus {\n AT_ORIGIN = 'at_origin',\n DELIVERED = 'delivered',\n}\n\nexport enum OpportunityRequirementsCode {\n VEHICLE_AT_ORIGIN = 'vehicle_at_origin',\n LEASING_SL_ACTION = 'sl_action',\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}\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}\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\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};\n\nexport type NewOpportunity = BaseOpportunity & {\n id?: undefined;\n createdAt?: undefined;\n createdBy?: undefined;\n modifiedAt?: undefined;\n modifiedBy?: undefined;\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 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 status: OpportunityStatus;\n dealStatus?: OpportunityDealStatus;\n logisticStatus?: OpportunityLogisticStatus;\n activeQuoteId?: string;\n amount?: string;\n documents?: Document[];\n leasingContractId?: 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 administrativePerson?: string | null;\n contactId?: string | null;\n activeQuoteId?: string | null;\n reviewed?: boolean;\n prepared?: boolean;\n lost?: boolean;\n delivered?: boolean;\n cmrDeleted?: 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 PaymentSummary = {\n total: string;\n paid: string;\n entries: DataRecord<Payment>[];\n};\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\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<OpportunityInterest, InterestBffMeta>;\n bids: DataRecord<Bid>[];\n quotes: DataRecord<Quote>[];\n activeQuote?: DataRecord<Quote>;\n payments: PaymentSummary | undefined;\n reservation?: DataRecord<OpportunityReservation>;\n customer?: {\n contact: DataRecord<Contact, ContactMetdata>;\n org?: DataRecord<Organization>;\n };\n};\n\ntype BaseOpportunityEvent = {\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 OpportunityDeleteEvent = BaseOpportunityEvent & {\n opportunity?: undefined;\n previousOpportunity: Opportunity;\n action: 'delete';\n};\n\nexport type OpportunityEvent =\n | OpportunityCreateEvent\n | OpportunityUpdateEvent\n | OpportunityDeleteEvent;\n\nexport type QuoteEvent = {\n quote: Quote;\n opportunity: Opportunity;\n action: 'create' | 'update' | 'delete';\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};\n\nexport type SearchOpportunity = {\n contact?: Contact;\n opportunity: Opportunity;\n org?: Organization;\n vehicle?: Vehicle;\n quote?: QuoteInfo;\n custom: {\n paymentStatus: OpportunityPaymentStatus;\n unassigned: boolean;\n lost: boolean;\n assignees: string[];\n vehicleCheckedIn: boolean;\n status: OpportunityStatus | 'won';\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';\nexport const OPPORTUNITY_VEHICLE_AVAILABLE_NOTIFICATION_ORIGIN = 'opportunity-vehicle-available';\nexport const OPPORTUNITY_VEHICLE_DELIVERY_NOTIFICATION_ORIGIN = 'opportunity-vehicle-delivery';\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 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 startupFee: string;\n totalExtras: string;\n totalBeforeDeliveryExclVat: string;\n totalBeforeDelivery: string;\n installment: string;\n duration: number;\n monthlyInsurance: string;\n monthlyTax: string;\n monthlyTaxesInsurance: string;\n residual: 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 monthly: string;\n monthlyExclVat: string;\n residual: string;\n residualExclVat: string;\n duration: number;\n };\n};\n\nexport type SalesProformaTemplateData = {\n opportunity: {\n id: string;\n offerNumber: string;\n };\n currentDate: string;\n expirationDate: 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 total: string;\n };\n};\n\nexport type SalesAgreementTemplateData = {\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 total: string;\n };\n};\n\nexport type OpportunitiesKanbanColumn = {\n status: string;\n results: SearchOpportunity[];\n totalCount: number;\n totalValue: string;\n};\n\nexport type MSearchOpportunitiesKanbanColumn = {\n column: OpportunitiesKanbanColumn;\n nextToken?: string;\n};\n\nexport type HpLeasingDealRequest = {\n tenantId: string;\n initiatedBy: 'bisondesk';\n processMetaId: string;\n processRunData: {\n entityOwner: string;\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?: string;\n yearOfConstruction?: number;\n chassisnumber?: string;\n vehicleModel?: string;\n vehicleCategory2?: string;\n licencePlate?: string;\n vatPercentage?: number;\n\n opportunityContractId: string;\n opportunityId: string;\n\n company?: string;\n customerNumber?: number; //bisondesk external id\n //MrLease fields\n vehicle?: string;\n vehicleNewReferenceMl?: 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};\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 entityOwner: 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 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 dealValidated: boolean;\n dealCancelled: boolean;\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 SwitchOpportunityVehicleRequest = {\n opportunityId: string;\n newVehicleId: string;\n};\n\nexport type KanbanOpportunitiesSearchRequest = BaseSearchRequest & {\n nextTokens?: Record<string, string | undefined>;\n};\n\nexport type KanbanOpportunitiesNextList = Omit<\n NextList<OpportunitiesKanbanColumn, ReferenceData>,\n 'nextToken'\n> & {\n nextTokens?: Record<string, string | undefined>;\n};\n"]}
|
package/lib/types/picklists.d.ts
CHANGED
|
@@ -1,83 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export type PicklistValueUpdateRequest = {
|
|
3
|
-
picklistId: string;
|
|
4
|
-
value: PicklistValue | NewPicklistValue;
|
|
5
|
-
tenantId?: string;
|
|
6
|
-
};
|
|
7
|
-
export type NewPicklistValue<T = Record<string, string>> = {
|
|
8
|
-
color?: string;
|
|
9
|
-
sortPriority?: number;
|
|
10
|
-
titles: MultiLangValue;
|
|
11
|
-
dependency?: PicklistValueDependency;
|
|
12
|
-
meta?: T;
|
|
13
|
-
};
|
|
14
|
-
export type PicklistValue<T = any> = NewPicklistValue<T> & {
|
|
15
|
-
id: string;
|
|
16
|
-
system?: boolean;
|
|
17
|
-
};
|
|
18
|
-
export type PicklistValueListRequest = {
|
|
19
|
-
picklistId: string;
|
|
20
|
-
limit: number;
|
|
21
|
-
offset: number;
|
|
22
|
-
dependencies?: PicklistValueDependency[];
|
|
23
|
-
};
|
|
24
|
-
export type PicklistValueRequest = {
|
|
25
|
-
picklistId: string;
|
|
26
|
-
valueId: string;
|
|
27
|
-
};
|
|
28
|
-
export type AdHocPicklistValues<T = any> = {
|
|
29
|
-
[picklistId: string]: {
|
|
30
|
-
[valueId: string]: PicklistValue<T>;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
export type AdHocPicklistRequest = {
|
|
34
|
-
requests: PicklistValueRequest[];
|
|
35
|
-
preferredLang: string;
|
|
36
|
-
tenantLang: string;
|
|
37
|
-
};
|
|
38
|
-
export type AdHocPicklistValueDisplay = {
|
|
39
|
-
[picklistId: string]: {
|
|
40
|
-
[valueId: string]: {
|
|
41
|
-
color?: string;
|
|
42
|
-
title: string;
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
export type PicklistOptionsRequest = {
|
|
47
|
-
picklistId: string;
|
|
48
|
-
dependencies?: PicklistValueDependency[];
|
|
49
|
-
lang: string;
|
|
50
|
-
};
|
|
51
|
-
export type PicklistUpsertValueRequest = {
|
|
52
|
-
tenantId?: string;
|
|
53
|
-
picklistId: string;
|
|
54
|
-
value: PicklistValue | NewPicklistValue;
|
|
55
|
-
};
|
|
56
|
-
export type QuickAddPicklistValue = {
|
|
57
|
-
sortPriority?: number;
|
|
58
|
-
titles: MultiLangValue;
|
|
59
|
-
};
|
|
60
|
-
export type NewPicklist = {
|
|
61
|
-
id?: undefined;
|
|
62
|
-
titles: MultiLangValue;
|
|
63
|
-
values: QuickAddPicklistValue[];
|
|
64
|
-
customSort?: boolean;
|
|
65
|
-
};
|
|
66
|
-
export type BasePicklist = {
|
|
67
|
-
customSort?: boolean;
|
|
68
|
-
id: string;
|
|
69
|
-
system?: boolean;
|
|
70
|
-
titles: MultiLangValue;
|
|
71
|
-
};
|
|
72
|
-
export type PicklistInfo = BasePicklist & {
|
|
73
|
-
count: number;
|
|
74
|
-
modifiedAt: string;
|
|
75
|
-
};
|
|
76
|
-
export type PicklistValueDependency = {
|
|
77
|
-
picklistId: string;
|
|
78
|
-
values: string[];
|
|
79
|
-
};
|
|
80
|
-
export type PicklistCollection = (BasePicklist & {
|
|
81
|
-
data: PicklistValue[];
|
|
82
|
-
})[];
|
|
1
|
+
export * from '@bisondesk/commons-sdk/picklists';
|
|
83
2
|
//# sourceMappingURL=picklists.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"picklists.d.ts","sourceRoot":"/","sources":["types/picklists.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"picklists.d.ts","sourceRoot":"/","sources":["types/picklists.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC"}
|
package/lib/types/picklists.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from '@bisondesk/commons-sdk/picklists';
|
|
2
2
|
//# sourceMappingURL=picklists.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"picklists.js","sourceRoot":"/","sources":["types/picklists.ts"],"names":[],"mappings":"","sourcesContent":["
|
|
1
|
+
{"version":3,"file":"picklists.js","sourceRoot":"/","sources":["types/picklists.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC","sourcesContent":["export * from '@bisondesk/commons-sdk/picklists';\n"]}
|
package/lib/types/search.d.ts
CHANGED
|
@@ -1,176 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { MultiLangValue } from '@bisondesk/commons-sdk/types';
|
|
3
|
-
import { FieldTypes, NumberMeta } from './fields.js';
|
|
4
|
-
export declare enum ConditionType {
|
|
5
|
-
and = "AND",
|
|
6
|
-
or = "OR"
|
|
7
|
-
}
|
|
8
|
-
export declare enum ElasticsearchOperator {
|
|
9
|
-
empty = "EMPTY",
|
|
10
|
-
notEmpty = "NOT_EMPTY",
|
|
11
|
-
is = "IS",
|
|
12
|
-
isNot = "IS_NOT",
|
|
13
|
-
greaterThanOrEqual = "GTE",
|
|
14
|
-
greaterThan = "GT",
|
|
15
|
-
lessThanEqual = "LTE",
|
|
16
|
-
lessThan = "LT",
|
|
17
|
-
between = "BETWEEN",
|
|
18
|
-
contains = "CONTAINS",
|
|
19
|
-
notContains = "NOT_CONTAINS",
|
|
20
|
-
startsWith = "STARTS_WITH",
|
|
21
|
-
endsWith = "ENDS_WITH"
|
|
22
|
-
}
|
|
23
|
-
export type Filter<OP = ElasticsearchOperator> = {
|
|
24
|
-
data: string;
|
|
25
|
-
fieldId: string;
|
|
26
|
-
operator: OP;
|
|
27
|
-
};
|
|
28
|
-
export type ComplexFilter<OP = ElasticsearchOperator> = {
|
|
29
|
-
condition: ConditionType;
|
|
30
|
-
filters: Array<Filter<OP> | ComplexFilter<OP>>;
|
|
31
|
-
};
|
|
32
|
-
export type SearchResponse<T = any> = {
|
|
33
|
-
took: number;
|
|
34
|
-
timed_out: boolean;
|
|
35
|
-
_scroll_id?: string;
|
|
36
|
-
_shards: unknown;
|
|
37
|
-
hits: {
|
|
38
|
-
total: {
|
|
39
|
-
value: number;
|
|
40
|
-
relation: 'eq' | 'gte';
|
|
41
|
-
};
|
|
42
|
-
max_score: number;
|
|
43
|
-
hits: Array<{
|
|
44
|
-
_index: string;
|
|
45
|
-
_type: string;
|
|
46
|
-
_id: string;
|
|
47
|
-
_score: number;
|
|
48
|
-
_source?: T;
|
|
49
|
-
_version?: number;
|
|
50
|
-
_explanation?: unknown;
|
|
51
|
-
fields?: any;
|
|
52
|
-
highlight?: any;
|
|
53
|
-
inner_hits?: any;
|
|
54
|
-
matched_queries?: string[];
|
|
55
|
-
sort?: Array<string | number>;
|
|
56
|
-
}>;
|
|
57
|
-
};
|
|
58
|
-
aggregations?: {
|
|
59
|
-
[aggName: string]: object;
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
export declare const FILTER_RANGE_SEPARATOR = "__";
|
|
63
|
-
export declare enum SortOrder {
|
|
64
|
-
asc = "asc",
|
|
65
|
-
desc = "desc"
|
|
66
|
-
}
|
|
67
|
-
export type SortFilter = {
|
|
68
|
-
fieldId: string;
|
|
69
|
-
order: SortOrder;
|
|
70
|
-
};
|
|
71
|
-
export type BaseSearchRequest = {
|
|
72
|
-
fullText?: string;
|
|
73
|
-
limit: number;
|
|
74
|
-
query?: ComplexFilter<ElasticsearchOperator>;
|
|
75
|
-
sortBy?: SortFilter[];
|
|
76
|
-
};
|
|
77
|
-
type InfiniteSearchRequest = {
|
|
78
|
-
infinite: true;
|
|
79
|
-
nextToken?: string;
|
|
80
|
-
};
|
|
81
|
-
type PaginatedSearchRequest = {
|
|
82
|
-
infinite?: false;
|
|
83
|
-
offset?: number;
|
|
84
|
-
};
|
|
85
|
-
export type SearchRequest = {
|
|
86
|
-
fullText?: string;
|
|
87
|
-
limit: number;
|
|
88
|
-
query?: ComplexFilter<ElasticsearchOperator>;
|
|
89
|
-
sortBy?: SortFilter[];
|
|
90
|
-
} & (InfiniteSearchRequest | PaginatedSearchRequest);
|
|
91
|
-
export type GlobalSearchRequest = {
|
|
92
|
-
fullText: string;
|
|
93
|
-
limit: number;
|
|
94
|
-
} & {
|
|
95
|
-
entityIds: BusinessEntityIds[];
|
|
96
|
-
} & (InfiniteSearchRequest | PaginatedSearchRequest);
|
|
97
|
-
export type GlobalSearchResult = {
|
|
98
|
-
businessEntityId: BusinessEntityIds;
|
|
99
|
-
recordId: string;
|
|
100
|
-
title: string;
|
|
101
|
-
description: string;
|
|
102
|
-
tags?: string[];
|
|
103
|
-
};
|
|
104
|
-
export type GlobalSearchByIdRequest = {
|
|
105
|
-
ids: {
|
|
106
|
-
businessEntityId: BusinessEntityIds;
|
|
107
|
-
recordId: string;
|
|
108
|
-
}[];
|
|
109
|
-
};
|
|
110
|
-
export type PublicSearchRequest = {
|
|
111
|
-
limit: number;
|
|
112
|
-
offset?: number;
|
|
113
|
-
query?: ComplexFilter;
|
|
114
|
-
sortBy?: SortFilter[];
|
|
115
|
-
};
|
|
116
|
-
export type AggFilterOperator = ElasticsearchOperator.is | ElasticsearchOperator.greaterThan | ElasticsearchOperator.lessThan | ElasticsearchOperator.greaterThanOrEqual | ElasticsearchOperator.lessThanEqual;
|
|
117
|
-
export declare enum AggregationType {
|
|
118
|
-
term = "TERM",
|
|
119
|
-
range = "RANGE"
|
|
120
|
-
}
|
|
121
|
-
export type TermAggregation = {
|
|
122
|
-
titles: MultiLangValue & {
|
|
123
|
-
[local in (typeof SUPPORTED_LANGUAGES)[number]]: string;
|
|
124
|
-
};
|
|
125
|
-
fieldId: string;
|
|
126
|
-
type: AggregationType.term;
|
|
127
|
-
orderBy?: 'count' | 'field';
|
|
128
|
-
} & ({
|
|
129
|
-
fieldType: FieldTypes.picklist;
|
|
130
|
-
picklistId: string;
|
|
131
|
-
} | {
|
|
132
|
-
fieldType: FieldTypes.number;
|
|
133
|
-
meta?: NumberMeta;
|
|
134
|
-
} | {
|
|
135
|
-
fieldType: Exclude<FieldTypes, FieldTypes.picklist | FieldTypes.number>;
|
|
136
|
-
});
|
|
137
|
-
export type Range = {
|
|
138
|
-
start: number;
|
|
139
|
-
end?: number;
|
|
140
|
-
} | {
|
|
141
|
-
start?: number;
|
|
142
|
-
end: number;
|
|
143
|
-
} | {
|
|
144
|
-
start: number;
|
|
145
|
-
end: number;
|
|
146
|
-
};
|
|
147
|
-
export type RangeAggregation = {
|
|
148
|
-
titles: MultiLangValue & {
|
|
149
|
-
[local in (typeof SUPPORTED_LANGUAGES)[number]]: string;
|
|
150
|
-
};
|
|
151
|
-
fieldId: string;
|
|
152
|
-
type: AggregationType.range;
|
|
153
|
-
step: number;
|
|
154
|
-
ranges: Range[];
|
|
155
|
-
format?: NumberMeta;
|
|
156
|
-
};
|
|
157
|
-
export type Aggregation = TermAggregation | RangeAggregation;
|
|
158
|
-
export type AggregationRequest = {
|
|
159
|
-
fullText?: string;
|
|
160
|
-
filters: ComplexFilter<AggFilterOperator>[];
|
|
161
|
-
};
|
|
162
|
-
export type AggregationResult = {
|
|
163
|
-
value: string;
|
|
164
|
-
count: number;
|
|
165
|
-
from?: number;
|
|
166
|
-
to?: number;
|
|
167
|
-
};
|
|
168
|
-
export type AggregationResultSet = {
|
|
169
|
-
[field: string]: AggregationResult[];
|
|
170
|
-
};
|
|
171
|
-
export type AggregationResponse<M = {}> = {
|
|
172
|
-
results: AggregationResultSet;
|
|
173
|
-
meta: M;
|
|
174
|
-
};
|
|
175
|
-
export {};
|
|
1
|
+
export * from '@bisondesk/commons-sdk/search';
|
|
176
2
|
//# sourceMappingURL=search.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"/","sources":["types/search.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"/","sources":["types/search.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC"}
|
package/lib/types/search.js
CHANGED
|
@@ -1,33 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
(function (ConditionType) {
|
|
3
|
-
ConditionType["and"] = "AND";
|
|
4
|
-
ConditionType["or"] = "OR";
|
|
5
|
-
})(ConditionType || (ConditionType = {}));
|
|
6
|
-
export var ElasticsearchOperator;
|
|
7
|
-
(function (ElasticsearchOperator) {
|
|
8
|
-
ElasticsearchOperator["empty"] = "EMPTY";
|
|
9
|
-
ElasticsearchOperator["notEmpty"] = "NOT_EMPTY";
|
|
10
|
-
ElasticsearchOperator["is"] = "IS";
|
|
11
|
-
ElasticsearchOperator["isNot"] = "IS_NOT";
|
|
12
|
-
ElasticsearchOperator["greaterThanOrEqual"] = "GTE";
|
|
13
|
-
ElasticsearchOperator["greaterThan"] = "GT";
|
|
14
|
-
ElasticsearchOperator["lessThanEqual"] = "LTE";
|
|
15
|
-
ElasticsearchOperator["lessThan"] = "LT";
|
|
16
|
-
ElasticsearchOperator["between"] = "BETWEEN";
|
|
17
|
-
ElasticsearchOperator["contains"] = "CONTAINS";
|
|
18
|
-
ElasticsearchOperator["notContains"] = "NOT_CONTAINS";
|
|
19
|
-
ElasticsearchOperator["startsWith"] = "STARTS_WITH";
|
|
20
|
-
ElasticsearchOperator["endsWith"] = "ENDS_WITH";
|
|
21
|
-
})(ElasticsearchOperator || (ElasticsearchOperator = {}));
|
|
22
|
-
export const FILTER_RANGE_SEPARATOR = '__';
|
|
23
|
-
export var SortOrder;
|
|
24
|
-
(function (SortOrder) {
|
|
25
|
-
SortOrder["asc"] = "asc";
|
|
26
|
-
SortOrder["desc"] = "desc";
|
|
27
|
-
})(SortOrder || (SortOrder = {}));
|
|
28
|
-
export var AggregationType;
|
|
29
|
-
(function (AggregationType) {
|
|
30
|
-
AggregationType["term"] = "TERM";
|
|
31
|
-
AggregationType["range"] = "RANGE";
|
|
32
|
-
})(AggregationType || (AggregationType = {}));
|
|
1
|
+
export * from '@bisondesk/commons-sdk/search';
|
|
33
2
|
//# sourceMappingURL=search.js.map
|
package/lib/types/search.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.js","sourceRoot":"/","sources":["types/search.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"/","sources":["types/search.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC","sourcesContent":["export * from '@bisondesk/commons-sdk/search';\n"]}
|
package/lib/types/utils.d.ts
CHANGED
|
@@ -1,47 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { AdHocPicklistValueDisplay } from './picklists.js';
|
|
3
|
-
export type CountryInfo = {
|
|
4
|
-
code: string;
|
|
5
|
-
name: string;
|
|
6
|
-
labels: {
|
|
7
|
-
city: string;
|
|
8
|
-
state: string;
|
|
9
|
-
postalCode?: string;
|
|
10
|
-
};
|
|
11
|
-
required: {
|
|
12
|
-
city: boolean;
|
|
13
|
-
state: boolean;
|
|
14
|
-
postalCode: boolean;
|
|
15
|
-
};
|
|
16
|
-
dialCode: number;
|
|
17
|
-
currencyCode: string;
|
|
18
|
-
states?: {
|
|
19
|
-
[code: string]: string;
|
|
20
|
-
};
|
|
21
|
-
postalCodeFormat?: string;
|
|
22
|
-
postalCodeEx?: string;
|
|
23
|
-
};
|
|
24
|
-
export type Country = {
|
|
25
|
-
code: string;
|
|
26
|
-
name: string;
|
|
27
|
-
dialCode: number;
|
|
28
|
-
};
|
|
29
|
-
export type ReferenceData = {
|
|
30
|
-
recordTitles: AdHocRecordTitles;
|
|
31
|
-
picklistTitles: AdHocPicklistValueDisplay;
|
|
32
|
-
};
|
|
33
|
-
export type AdHocRecordTitles = {
|
|
34
|
-
[businessEntityId: string]: {
|
|
35
|
-
[recordId: string]: string | MultiLangValue;
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
export type DataRecord<T, M = undefined> = {
|
|
39
|
-
record: T;
|
|
40
|
-
meta?: M;
|
|
41
|
-
actions: string[];
|
|
42
|
-
};
|
|
43
|
-
export declare enum PricePercentageMode {
|
|
44
|
-
CURRENCY = "currency",
|
|
45
|
-
PERCENTAGE = "percentage"
|
|
46
|
-
}
|
|
1
|
+
export * from '@bisondesk/commons-sdk/utils';
|
|
47
2
|
//# sourceMappingURL=utils.d.ts.map
|
package/lib/types/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"/","sources":["types/utils.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"/","sources":["types/utils.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC"}
|
package/lib/types/utils.js
CHANGED
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
(function (PricePercentageMode) {
|
|
3
|
-
PricePercentageMode["CURRENCY"] = "currency";
|
|
4
|
-
PricePercentageMode["PERCENTAGE"] = "percentage";
|
|
5
|
-
})(PricePercentageMode || (PricePercentageMode = {}));
|
|
1
|
+
export * from '@bisondesk/commons-sdk/utils';
|
|
6
2
|
//# sourceMappingURL=utils.js.map
|
package/lib/types/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"/","sources":["types/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"/","sources":["types/utils.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC","sourcesContent":["export * from '@bisondesk/commons-sdk/utils';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"/","sources":["utils/search.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE9D,MAAM,MAAM,oBAAoB,GAAG,WAAW,GAAG,OAAO,GAAG,YAAY,GAAG,eAAe,CAAC;AAC1F,MAAM,MAAM,kBAAkB,GAC1B,iBAAiB,GACjB,aAAa,GACb,kBAAkB,GAClB,qBAAqB,CAAC;AAE1B,eAAO,MAAM,sBAAsB,SAAU,YAAY,YAAY,OAAO;;;;;;;;aAe3E,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE;KACpB,GAAG,IAAI,iBAAiB,CAAC,CAAC,EAAE;QAC3B,aAAa,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,oBAAoB,CAAC;QACrD,QAAQ,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,MAAM,CAAC;QAClC,OAAO,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;QACjD,cAAc,CAA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AA4B,EAC5B,EAAE,CAAC,iBAAiB,CAAC,wBAAwB,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC,CAAC;AAE3E,MAAM,CAAC,MAAM,qCAAqC,GAAG,CACnD,gBAAmC,EACnC,MAA0B,EAC1B,EAAE;IACF,OAAO,CACL,UAAU,CAAC,gBAAgB,CAAC,CAAC,cAAc,EAAE,CAAC,MAAM,CAAC;QACrD,+BAA+B,CAC7B,gBAAgB,EAChB,6BAA6B,CAAC,gBAAgB,EAAE,MAAM,CAAC,CACxD,CACF,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAC3C,gBAAmC,EACnC,MAA0B,EAC1B,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;AAExD,MAAM,CAAC,MAAM,yBAAyB,GAAG,CACvC,gBAAmC,EACnC,MAA4B,EAC5B,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAEnD,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAC7C,gBAAmC,EACnC,YAAgC,EAChC,EAAE,CACF,yBAAyB,CACvB,gBAAgB,EAChB,6BAA6B,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAC9D,CAAC","sourcesContent":["import { joinWithSeparator } from '@bisondesk/commons-sdk/formatting';\nimport { BusinessEntityIds } from '../constants.js';\nimport { Contact, Organization, SearchOrganization } from '../types/crm.js';\nimport { SearchLeasingContract } from '../types/leasing-search.js';\nimport { LeasingContract } from '../types/leasing.js';\nimport { Opportunity, SearchOpportunity } from '../types/opportunities.js';\nimport { SearchVehicle, Vehicle } from '../types/vehicles.js';\n\nexport type GlobalBusinessEntity = Opportunity | Vehicle | Organization | LeasingContract;\nexport type GlobalSearchEntity =\n | SearchOpportunity\n | SearchVehicle\n | SearchOrganization\n | SearchLeasingContract;\n\nexport const getCustomerInformation = (org?: Organization, contact?: Contact) => {\n if (org != null) {\n return {\n countryCode: org.countryCode,\n title: org.name,\n code: org.externalId,\n };\n }\n\n if (contact != null) {\n return {\n countryCode: contact.countryCode,\n title: [contact?.firstName, contact?.lastName].filter(Boolean).join(' '),\n };\n }\n};\n\nexport const mappings: {\n [key in BusinessEntityIds]?: {\n getMainEntity: (entity: any) => GlobalBusinessEntity;\n getTitle: (entity: any) => string;\n getTags: (entity: any) => (string | undefined)[];\n getDescription?: (entity: any) => string;\n };\n} = {\n [BusinessEntityIds.Opportunities]: {\n getMainEntity: (entity: SearchOpportunity) => entity.opportunity,\n getTitle: (opp: Opportunity) => opp.id,\n getDescription: (opp: SearchOpportunity) =>\n joinWithSeparator(\n [\n getCustomerInformation(opp.org, opp.contact)?.code,\n opp.vehicle?.external.identification.stockNumber,\n ].filter(Boolean)\n ),\n getTags: (opp: Opportunity) => [opp.id],\n },\n [BusinessEntityIds.Vehicles]: {\n getMainEntity: (entity: SearchVehicle) => entity.vehicle,\n getTitle: (vehicle: Vehicle) => vehicle.internal.description.title,\n getTags: (vehicle: Vehicle) => [\n // the order of the tags here is relevant for exact integration\n // see: packages/exact/src/service/purchase.ts\n vehicle.external.identification?.stockNumber,\n vehicle.internal.identification?.administrativeNumber,\n vehicle.external.identification?.vin,\n ],\n },\n [BusinessEntityIds.Organizations]: {\n getMainEntity: (entity: SearchOrganization) => entity.org,\n getTitle: (org: Organization) => org.name,\n getTags: (org: Organization) => [`${org.externalId}`, org.vatNumber],\n },\n [BusinessEntityIds.LeasingContracts]: {\n getMainEntity: (entity: SearchLeasingContract) => entity.contract,\n getTitle: (contract: LeasingContract) => contract.contractNumber ?? contract.id,\n getTags: (contract: LeasingContract) => [contract.contractNumber, contract.slbPartner],\n },\n};\n\nconst getMapping = (businessEntityId: BusinessEntityIds) => {\n const mapping = mappings[businessEntityId];\n if (!mapping) {\n throw new Error(`Invalid business entity id ${businessEntityId}`);\n }\n return mapping;\n};\n\nexport const getTagsForBusinessEntity = (\n businessEntityId: BusinessEntityIds,\n entity: GlobalBusinessEntity\n): string[] => getMapping(businessEntityId).getTags(entity).filter(Boolean) as string[];\n\nexport const getTagsForSearchBusinessEntity = (\n businessEntityId: BusinessEntityIds,\n entity: GlobalSearchEntity\n) =>\n getTagsForBusinessEntity(\n businessEntityId,\n getMainEntityFromSearchEntity(businessEntityId, entity)\n );\n\nexport const getDescriptionForBusinessEntity = (\n businessEntityId: BusinessEntityIds,\n entity: GlobalBusinessEntity\n) => joinWithSeparator(getTagsForBusinessEntity(businessEntityId, entity));\n\nexport const getDescriptionForSearchBusinessEntity = (\n businessEntityId: BusinessEntityIds,\n entity: GlobalSearchEntity\n) => {\n return (\n getMapping(businessEntityId).getDescription?.(entity) ??\n getDescriptionForBusinessEntity(\n businessEntityId,\n getMainEntityFromSearchEntity(businessEntityId, entity)\n )\n );\n};\n\nexport const getMainEntityFromSearchEntity = (\n businessEntityId: BusinessEntityIds,\n entity: GlobalSearchEntity\n) => getMapping(businessEntityId).getMainEntity(entity);\n\nexport const getTitleForBusinessEntity = (\n businessEntityId: BusinessEntityIds,\n entity: GlobalBusinessEntity\n) => getMapping(businessEntityId).getTitle(entity);\n\nexport const getTitleForSearchBusinessEntity = (\n businessEntityId: BusinessEntityIds,\n searchEntity: GlobalSearchEntity\n) =>\n getTitleForBusinessEntity(\n businessEntityId,\n getMainEntityFromSearchEntity(businessEntityId, searchEntity)\n );\n"]}
|
package/package.json
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { TENANT_ID_ADMIN_HEADER } from '@bisondesk/commons-sdk/constants';
|
|
2
|
+
import { XError } from '@bisondesk/commons-sdk/errors';
|
|
3
|
+
import { getAdminAuth } from '@bisondesk/commons-sdk/fetch';
|
|
4
|
+
import { PaginatedList } from '@bisondesk/commons-sdk/types';
|
|
5
|
+
import { SearchDebtorInfo } from '../types/leasing-debtors.js';
|
|
6
|
+
import { SearchRequest } from '../types/search.js';
|
|
7
|
+
import { ReferenceData } from '../types/utils.js';
|
|
8
|
+
|
|
9
|
+
export const searchDebtorsInfo = async (
|
|
10
|
+
tenantId: string,
|
|
11
|
+
request: SearchRequest
|
|
12
|
+
): Promise<PaginatedList<SearchDebtorInfo, ReferenceData> | undefined> => {
|
|
13
|
+
const auth = await getAdminAuth();
|
|
14
|
+
const response: Response = await fetch(
|
|
15
|
+
`${process.env.CORE_API_ORIGIN}/api/leasing/debtors/search/results`,
|
|
16
|
+
{
|
|
17
|
+
method: 'POST',
|
|
18
|
+
headers: {
|
|
19
|
+
Authorization: auth,
|
|
20
|
+
[TENANT_ID_ADMIN_HEADER]: tenantId,
|
|
21
|
+
},
|
|
22
|
+
body: JSON.stringify(request),
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
if (response.status === 200) {
|
|
27
|
+
return response.json() as any;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const body = await response.text();
|
|
31
|
+
throw new XError('core-sdk.search-debtors-info', {
|
|
32
|
+
tenantId,
|
|
33
|
+
request,
|
|
34
|
+
response: body,
|
|
35
|
+
status: response.status,
|
|
36
|
+
});
|
|
37
|
+
};
|