@bisondesk/core-sdk 1.0.651 → 1.0.653
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/leasing.d.ts +1 -1
- package/lib/apis/leasing.d.ts.map +1 -1
- package/lib/apis/leasing.js +3 -2
- package/lib/apis/leasing.js.map +1 -1
- package/lib/types/deliveries.d.ts +74 -0
- package/lib/types/deliveries.d.ts.map +1 -0
- package/lib/types/deliveries.js +24 -0
- package/lib/types/deliveries.js.map +1 -0
- package/lib/types/quotes.d.ts +5 -64
- package/lib/types/quotes.d.ts.map +1 -1
- package/lib/types/quotes.js +1 -18
- package/lib/types/quotes.js.map +1 -1
- package/lib/types/reports-arrivals.d.ts +67 -0
- package/lib/types/reports-arrivals.d.ts.map +1 -0
- package/lib/types/reports-arrivals.js +4 -0
- package/lib/types/reports-arrivals.js.map +1 -0
- package/lib/types/reports-sales.d.ts +7 -0
- package/lib/types/reports-sales.d.ts.map +1 -1
- package/lib/types/reports-sales.js.map +1 -1
- package/lib/types/templates.d.ts +22 -0
- package/lib/types/templates.d.ts.map +1 -1
- package/lib/types/templates.js.map +1 -1
- package/lib/types/tenants.d.ts +1 -1
- package/lib/types/tenants.d.ts.map +1 -1
- package/lib/types/tenants.js +1 -1
- package/lib/types/tenants.js.map +1 -1
- package/lib/types/transports.d.ts +15 -16
- package/lib/types/transports.d.ts.map +1 -1
- package/lib/types/transports.js +11 -5
- package/lib/types/transports.js.map +1 -1
- package/lib/types/vehicle-sales.d.ts +3 -2
- package/lib/types/vehicle-sales.d.ts.map +1 -1
- package/lib/types/vehicle-sales.js.map +1 -1
- package/lib/utils/deliveries.d.ts +3 -0
- package/lib/utils/deliveries.d.ts.map +1 -0
- package/lib/utils/deliveries.js +3 -0
- package/lib/utils/deliveries.js.map +1 -0
- package/lib/utils/deliveries.test.d.ts +2 -0
- package/lib/utils/deliveries.test.d.ts.map +1 -0
- package/lib/utils/deliveries.test.js +34 -0
- package/lib/utils/deliveries.test.js.map +1 -0
- package/lib/utils/leasing.d.ts +1 -0
- package/lib/utils/leasing.d.ts.map +1 -1
- package/lib/utils/leasing.js +7 -1
- package/lib/utils/leasing.js.map +1 -1
- package/lib/utils/leasing.test.d.ts +2 -0
- package/lib/utils/leasing.test.d.ts.map +1 -0
- package/lib/utils/leasing.test.js +69 -0
- package/lib/utils/leasing.test.js.map +1 -0
- package/lib/utils/reports-arrivals.d.ts +3 -0
- package/lib/utils/reports-arrivals.d.ts.map +1 -0
- package/lib/utils/reports-arrivals.js +15 -0
- package/lib/utils/reports-arrivals.js.map +1 -0
- package/lib/utils/transports.d.ts +1 -0
- package/lib/utils/transports.d.ts.map +1 -1
- package/lib/utils/transports.js +3 -4
- package/lib/utils/transports.js.map +1 -1
- package/lib/utils/vehicles.d.ts +3 -1
- package/lib/utils/vehicles.d.ts.map +1 -1
- package/lib/utils/vehicles.js +6 -1
- package/lib/utils/vehicles.js.map +1 -1
- package/package.json +1 -1
- package/src/apis/leasing.ts +3 -1
- 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/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/deliveries.ts +92 -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/payments.js +7 -0
- package/src/types/picklists.js +2 -0
- package/src/types/picklists.js.map +1 -0
- package/src/types/quotes.js +42 -0
- package/src/types/quotes.ts +17 -72
- package/src/types/recently-viewed.js +2 -0
- package/src/types/recently-viewed.js.map +1 -0
- package/src/types/reports-arrivals.ts +95 -0
- package/src/types/reports-sales.ts +13 -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/templates.ts +27 -0
- package/src/types/tenants.js +21 -0
- package/src/types/tenants.js.map +1 -0
- package/src/types/tenants.ts +1 -1
- package/src/types/transports.ts +35 -25
- package/src/types/user-performance.js +7 -0
- package/src/types/user-performance.js.map +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/vehicle-sales.ts +3 -2
- package/src/types/vehicles.js +98 -0
- package/src/types/vehicles.js.map +1 -0
- package/src/utils/deliveries.test.ts +50 -0
- package/src/utils/deliveries.ts +13 -0
- package/src/utils/leasing.js +6 -0
- package/src/utils/leasing.js.map +1 -0
- package/src/utils/leasing.test.ts +79 -0
- package/src/utils/leasing.ts +22 -1
- package/src/utils/opportunities.js +48 -0
- package/src/utils/opportunities.js.map +1 -0
- package/src/utils/reports-arrivals.ts +19 -0
- package/src/utils/transports.ts +11 -7
- package/src/utils/vehicles.ts +10 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -35,6 +35,12 @@ export type SalesReportMake = {
|
|
|
35
35
|
units: number;
|
|
36
36
|
yoyPct: number | null;
|
|
37
37
|
};
|
|
38
|
+
export type SalesReportCategory = {
|
|
39
|
+
category: string;
|
|
40
|
+
units: number;
|
|
41
|
+
sharePct: number;
|
|
42
|
+
yoyPct: number | null;
|
|
43
|
+
};
|
|
38
44
|
export type SalesReportTopOrg = {
|
|
39
45
|
id: string;
|
|
40
46
|
name: string;
|
|
@@ -90,6 +96,7 @@ export type SalesReportResponse = {
|
|
|
90
96
|
};
|
|
91
97
|
countries: SalesReportCountry[];
|
|
92
98
|
makes: SalesReportMake[];
|
|
99
|
+
categories: SalesReportCategory[];
|
|
93
100
|
salespeople: SalesReportSalesperson[];
|
|
94
101
|
buyers: SalesReportBuyer[];
|
|
95
102
|
topClients: SalesReportTopOrg[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reports-sales.d.ts","sourceRoot":"/","sources":["types/reports-sales.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,iBAAiB,YAC5B,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,WAAW,EACX,KAAK,EACL,KAAK,EACL,UAAU,EACV,KAAK,CACG,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhE,eAAO,MAAM,oBAAoB,EAAE,cAAsB,CAAC;AAE1D,MAAM,MAAM,kBAAkB,GAAG;IAAE,MAAM,EAAE,cAAc,CAAA;CAAE,CAAC;AAS5D,MAAM,MAAM,SAAS,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AM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IAEF,QAAQ,EAAE;QACR,WAAW,EAAE,SAAS,CAAC;QACvB,UAAU,EAAE,SAAS,CAAC;QACtB,SAAS,EAAE,SAAS,CAAC;QACrB,WAAW,EAAE,SAAS,CAAC;QACvB,SAAS,EAAE,SAAS,CAAC;QACrB,eAAe,EAAE,SAAS,CAAC;KAC5B,CAAC;IAEF,SAAS,EAAE,kBAAkB,EAAE,CAAC;IAEhC,KAAK,EAAE,eAAe,EAAE,CAAC;IAEzB,UAAU,EAAE,mBAAmB,EAAE,CAAC;IAElC,WAAW,EAAE,sBAAsB,EAAE,CAAC;IAEtC,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAE3B,UAAU,EAAE,iBAAiB,EAAE,CAAC;IAEhC,YAAY,EAAE,iBAAiB,EAAE,CAAC;IAElC,SAAS,EAAE,YAAY,EAAE,CAAC;IAC1B,YAAY,EAAE,uBAAuB,CAAC;IAEtC,SAAS,EAAE,0BAA0B,EAAE,CAAC;IAExC,UAAU,EAAE,qBAAqB,CAAC;IAMlC,QAAQ,EAAE,aAAa,EAAE,CAAC;IAM1B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reports-sales.js","sourceRoot":"/","sources":["types/reports-sales.ts"],"names":[],"mappings":"AAiBA,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,WAAW;IACX,KAAK;IACL,KAAK;IACL,UAAU;IACV,KAAK;CACG,CAAC;AAIX,MAAM,CAAC,MAAM,oBAAoB,GAAmB,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"reports-sales.js","sourceRoot":"/","sources":["types/reports-sales.ts"],"names":[],"mappings":"AAiBA,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,WAAW;IACX,KAAK;IACL,KAAK;IACL,UAAU;IACV,KAAK;CACG,CAAC;AAIX,MAAM,CAAC,MAAM,oBAAoB,GAAmB,KAAK,CAAC;AA4H1D,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAU,CAAC","sourcesContent":["/**\n * Sales report — the payload for the `Reports → Sales` tab. Sales-side metrics\n * are computed from the per-tenant `opportunities` OpenSearch index, keyed on\n * `opportunity.reviewedAt` (the moment an opportunity ENTERS Preparation — our\n * \"sale\" event; `preparedAt` is when it leaves Preparation into Delivery). The\n * buyer ranking comes from the vehicles index, keyed on `purchase.purchaseAgreedAt`.\n *\n * The API returns raw numbers only; the client formats (€, %, pp, \"younger\") and\n * colors the deltas.\n */\n\n/**\n * Period presets driving every metric except the fixed 18-month histogram, in\n * selector order. Single source of truth — `SalesPeriodKey` is derived from it.\n * `mtd`/`ytd` are to-date ranges (start of month/year → now); `lastMonth`/`lastYear`\n * are the previous complete calendar month/year.\n */\nexport const SALES_PERIOD_KEYS = [\n '30d',\n '45d',\n '60d',\n '90d',\n 'lastMonth',\n 'mtd',\n 'ytd',\n 'lastYear',\n '12m',\n] as const;\n\nexport type SalesPeriodKey = (typeof SALES_PERIOD_KEYS)[number];\n\nexport const DEFAULT_SALES_PERIOD: SalesPeriodKey = 'mtd';\n\nexport type SalesReportRequest = { period: SalesPeriodKey };\n\n/**\n * A metric for the selected window with its year-over-year counterpart.\n * - `value`: current window (null when undefined, e.g. no data / no median).\n * - `prev`: same metric in the window shifted back exactly one year.\n * - `pct`: fractional change `(value - prev) / prev` (null when prev is 0 or\n * either side is undefined). The client renders/colors the delta.\n */\nexport type YoyMetric = { value: number | null; prev: number | null; pct: number | null };\n\n/** Tenure buckets for returning-customer analysis (share of buyers in the window). */\nexport type TenureBucketKey = '2y' | '1-2y' | '<1y' | 'new';\n\nexport type TenureBucket = {\n bucket: TenureBucketKey;\n /** Share of buyers in this bucket, 0–100. */\n sharePct: number;\n /** Year-over-year change in this share, as a fractional relative change (null when no prior data). */\n yoyPct: number | null;\n};\n\nexport type SalesReportCountry = {\n /** ISO country code (lowercase) from `org.countryCode`. */\n code: string;\n units: number;\n yoyPct: number | null;\n};\n\nexport type SalesReportSalesperson = {\n /** User id from `opportunity.accountManager`; the client resolves name + avatar. */\n id: string;\n units: number;\n yoyPct: number | null;\n};\n\nexport type SalesReportBuyer = {\n /** User id from `purchase.purchasedBy`; the client resolves name + avatar. */\n id: string;\n units: number;\n yoyPct: number | null;\n};\n\nexport type SalesReportMake = {\n /** Vehicle make name from `vehicle.external.general.make` (stored verbatim, e.g. \"DAF\"). */\n make: string;\n units: number;\n yoyPct: number | null;\n};\n\nexport type SalesReportCategory = {\n /** Vehicle category; empty when missing or outside the supported categories. */\n category: string;\n /** Number of opportunities in the current window. */\n units: number;\n /** Share of all opportunities in the current window, 0–100. */\n sharePct: number;\n /** Fractional year-over-year change in opportunity count; 0 when both counts are zero. */\n yoyPct: number | null;\n};\n\n/** A ranked organization row for the top-clients / top-suppliers cards. */\nexport type SalesReportTopOrg = {\n /** Organization id (`org.id` for clients; `purchase.organizationId` for suppliers). */\n id: string;\n /** Organization name (resolved server-side); falls back to the id when missing. */\n name: string;\n /** The org's ISO country code (lowercase); null when not recorded. */\n countryCode: string | null;\n units: number;\n yoyPct: number | null;\n};\n\n/** A conglomerate-flagged organization (there is no group/parent model — each org stands alone). */\nexport type SalesReportConglomerateOrg = {\n /** `org.id`. */\n id: string;\n /** `org.name` (resolved server-side); falls back to the id when missing. */\n name: string;\n units: number;\n yoyPct: number | null;\n};\n\nexport type SalesReportConglomerate = {\n /** Share of units going to conglomerate-flagged customers, 0–100 (null when no sales). */\n sharePct: number | null;\n /** Year-over-year change in that share, as a fractional relative change (null when no prior data). */\n yoyPct: number | null;\n /** The conglomerate share in the year-ago window, 0–100. */\n lastYearPct: number | null;\n /** Top conglomerate-flagged organizations by units in the current window. */\n orgs: SalesReportConglomerateOrg[];\n};\n\nexport type SalesReportHistogramBucket = {\n /** Calendar month, `YYYY-MM`. */\n month: string;\n count: number;\n};\n\n/**\n * Current-month sales projection for the histogram's last bucket: the average sales\n * per business day over the last 5 business days, extended over the business days\n * left in the month. Business days are UTC weekdays (Mon–Fri) — no holiday calendar.\n * Today is excluded on both sides: it is still filling up (its sales land in the\n * month's actual count as they happen).\n */\nexport type SalesReportProjection = {\n /** The projected month, `YYYY-MM` — always the histogram's last bucket. */\n month: string;\n /** Average sales per business day over the last 5 business days. */\n salesPerBusinessDay: number;\n /** Business days (Mon–Fri, UTC) left in the month after today. */\n businessDaysLeft: number;\n /** Expected further sales this month: `salesPerBusinessDay × businessDaysLeft` (unrounded). */\n projectedRemaining: number;\n};\n\n/**\n * Age-of-stock bands, in days of capital tied up. Cut points at 30 / 90 / 180 days,\n * upper bound inclusive; the last band is open-ended, so `180+` means \"181 and over\".\n */\nexport const STOCK_AGE_BANDS = ['0-30', '31-90', '91-180', '180+'] as const;\n\nexport type StockAgeBand = (typeof STOCK_AGE_BANDS)[number];\n\n/**\n * One monthly snapshot on the stock-age charts, measured by capital tied up in\n * inventory. A vehicle counts on `date` when the supplier was fully paid on or before\n * that day and it had not been sold yet; its age is `date − supplierFullyPaidAt` in\n * days. Used vehicles only.\n */\nexport type StockAgePoint = {\n /** Snapshot day — the 1st of a month, `YYYY-MM-DD` (UTC). */\n date: string;\n /** In-stock vehicle count per age band on that day. */\n counts: Record<StockAgeBand, number>;\n /**\n * Sum of those vehicles' purchase costs per age band on that day (`deal.purchase`,\n * excl VAT, tenant currency). A vehicle without a recorded purchase cost still counts\n * in `counts` but contributes 0 here.\n */\n purchaseCosts: Record<StockAgeBand, number>;\n};\n\nexport type SalesReportResponse = {\n period: {\n key: SalesPeriodKey;\n /** Current window, half-open `[start, end)` (ISO strings). */\n start: string;\n end: string;\n /** Number of days in the window (the `salesPerDay` denominator). */\n days: number;\n /** Year-ago window `[yoyStart, yoyEnd)`. */\n yoyStart: string;\n yoyEnd: string;\n };\n /** All-types overview KPIs. `medianAge` is in years (a decrease is good — younger stock). */\n overview: {\n salesPerDay: YoyMetric;\n salesTotal: YoyMetric;\n medianRoi: YoyMetric;\n medianPrice: YoyMetric;\n medianAge: YoyMetric;\n uniqueCustomers: YoyMetric;\n };\n /** Top countries by units in the current window. */\n countries: SalesReportCountry[];\n /** Top vehicle makes by units in the current window (the client slices to its top N). */\n makes: SalesReportMake[];\n /** Every vehicle category, ordered by current units; includes unassigned opportunities. */\n categories: SalesReportCategory[];\n /** All sales people with units in either window (capped; the client list scrolls). */\n salespeople: SalesReportSalesperson[];\n /** All purchasers with vehicles bought in the current window (capped; the client list scrolls). */\n buyers: SalesReportBuyer[];\n /** Top client organizations by units bought from us in the current window. */\n topClients: SalesReportTopOrg[];\n /** Top supplier organizations by used vehicles purchased from them in the current window. */\n topSuppliers: SalesReportTopOrg[];\n /** Returning-customer tenure shares (4 buckets). */\n returning: TenureBucket[];\n conglomerate: SalesReportConglomerate;\n /** Fixed last-18-calendar-months histogram of opps into Preparation (period-independent). */\n histogram: SalesReportHistogramBucket[];\n /** Current-month projection, stacked on the histogram's last bucket by the client. */\n projection: SalesReportProjection;\n /**\n * Stock-age evolution measured as capital tied up in inventory: one snapshot per\n * month-1st of vehicles by days from supplier-fully-paid to sold (used vehicles).\n * Fixed to the last 24 months, period-independent.\n */\n stockAge: StockAgePoint[];\n /**\n * Customer concentration: the 10 largest customers' share of units in the window, as a\n * fraction (0–1); null when there are no sales. A risk signal — over-reliance on a few\n * buyers.\n */\n concentration: number | null;\n};\n"]}
|
package/lib/types/templates.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { EmailContent, EmailRequest } from '@bisondesk/commons-sdk/messages';
|
|
1
2
|
export type TemplateContent = {
|
|
2
3
|
subject: string;
|
|
3
4
|
content: {
|
|
@@ -30,4 +31,25 @@ export type UpdateTemplateInfoRequest = {
|
|
|
30
31
|
name: string;
|
|
31
32
|
tags?: any;
|
|
32
33
|
};
|
|
34
|
+
export type CodeEmailTemplateInfo = Pick<TemplateInfo, 'id' | 'name' | 'countries'> & {
|
|
35
|
+
format: 'react-email';
|
|
36
|
+
};
|
|
37
|
+
export type TemplateCatalogueEntry = (TemplateInfo & {
|
|
38
|
+
format: 'html';
|
|
39
|
+
}) | CodeEmailTemplateInfo;
|
|
40
|
+
export type TemplateEmailRequest<T extends Record<string, unknown> = Record<string, unknown>> = Omit<EmailRequest, 'subject' | 'body'> & {
|
|
41
|
+
templateId: string;
|
|
42
|
+
country: string;
|
|
43
|
+
fallbackCountry?: string;
|
|
44
|
+
data: T;
|
|
45
|
+
subject?: string;
|
|
46
|
+
};
|
|
47
|
+
export type EmailTemplatePreviewRequest = {
|
|
48
|
+
data?: Record<string, unknown>;
|
|
49
|
+
subject?: string;
|
|
50
|
+
};
|
|
51
|
+
export type EmailTemplatePreview = {
|
|
52
|
+
content: EmailContent;
|
|
53
|
+
data: Record<string, unknown>;
|
|
54
|
+
};
|
|
33
55
|
//# sourceMappingURL=templates.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.d.ts","sourceRoot":"/","sources":["types/templates.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,GAAG,CAAC;KACb,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,eAAe,CAAC;AAEpB,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB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"","sourcesContent":["
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"/","sources":["types/templates.ts"],"names":[],"mappings":"","sourcesContent":["import type { EmailContent, EmailRequest } from '@bisondesk/commons-sdk/messages';\n\nexport type TemplateContent = {\n subject: string;\n content: {\n html: string;\n design: any;\n };\n};\n\nexport type NewTemplateRequest = {\n id?: string;\n country: string;\n tags?: any;\n name: string;\n} & TemplateContent;\n\nexport type Template = {\n id: string;\n modifiedAt: string;\n modifiedBy: string;\n tags?: any;\n\n country: string;\n name: string;\n} & TemplateContent;\n\nexport type TemplateInfo = {\n id: string;\n countries: string[];\n modifiedAt: string;\n name: string;\n tags?: any;\n};\n\nexport type UpdateTemplateInfoRequest = {\n name: string;\n tags?: any;\n};\n\nexport type CodeEmailTemplateInfo = Pick<TemplateInfo, 'id' | 'name' | 'countries'> & {\n format: 'react-email';\n};\n\nexport type TemplateCatalogueEntry = (TemplateInfo & { format: 'html' }) | CodeEmailTemplateInfo;\n\nexport type TemplateEmailRequest<T extends Record<string, unknown> = Record<string, unknown>> =\n Omit<EmailRequest, 'subject' | 'body'> & {\n templateId: string;\n country: string;\n fallbackCountry?: string;\n data: T;\n subject?: string;\n };\n\nexport type EmailTemplatePreviewRequest = {\n data?: Record<string, unknown>;\n subject?: string;\n};\n\nexport type EmailTemplatePreview = {\n content: EmailContent;\n data: Record<string, unknown>;\n};\n"]}
|
package/lib/types/tenants.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export declare enum TenantModule {
|
|
|
36
36
|
Reports = "reports",
|
|
37
37
|
Prospects = "prospects"
|
|
38
38
|
}
|
|
39
|
-
export declare const REPORT_TAB_KEYS: readonly ['sales', 'leasing', 'purchases'];
|
|
39
|
+
export declare const REPORT_TAB_KEYS: readonly ['sales', 'leasing', 'purchases', 'arrivals'];
|
|
40
40
|
export type ReportTabKey = (typeof REPORT_TAB_KEYS)[number];
|
|
41
41
|
export type Tenant = PublicTenant & {
|
|
42
42
|
cognito?: CognitoInfo;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tenants.d.ts","sourceRoot":"/","sources":["types/tenants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,MAAM,YAAY,GAAG;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;CAInC,CAAC;AAEF,oBAAY,YAAY;IACtB,cAAc,mBAAmB;IACjC,GAAG,QAAQ;IAOX,UAAU,gBAAgB;IAC1B,GAAG,QAAQ;IACX,IAAI,SAAS;IAMb,UAAU,gBAAgB;IAQ1B,WAAW,iBAAiB;IAC5B,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,yBAAyB,gCAAgC;IACzD,SAAS,cAAc;IACvB,QAAQ,aAAa;IAQrB,YAAY,iBAAiB;IAC7B,aAAa,kBAAkB;IAC/B,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,KAAK,UAAU;IACf,aAAa,oBAAoB;IACjC,SAAS,cAAc;IACvB,aAAa,mBAAmB;IAChC,KAAK,UAAU;IACf,oBAAoB,0BAA0B;IAC9C,SAAS,cAAc;IACvB,OAAO,YAAY;IACnB,SAAS,cAAc;CACxB;AAGD,eAAO,MAAM,eAAe,YAAI,OAAO,EAAE,SAAS,EAAE,WAAW,CAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"tenants.d.ts","sourceRoot":"/","sources":["types/tenants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,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
|
@@ -26,5 +26,5 @@ export var TenantModule;
|
|
|
26
26
|
TenantModule["Reports"] = "reports";
|
|
27
27
|
TenantModule["Prospects"] = "prospects";
|
|
28
28
|
})(TenantModule || (TenantModule = {}));
|
|
29
|
-
export const REPORT_TAB_KEYS = ['sales', 'leasing', 'purchases'];
|
|
29
|
+
export const REPORT_TAB_KEYS = ['sales', 'leasing', 'purchases', 'arrivals'];
|
|
30
30
|
//# sourceMappingURL=tenants.js.map
|
package/lib/types/tenants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tenants.js","sourceRoot":"/","sources":["types/tenants.ts"],"names":[],"mappings":"AAgBA,MAAM,CAAN,IAAY,YAmDX;AAnDD,WAAY,YAAY;IACtB,iDAAiC,CAAA;IACjC,2BAAW,CAAA;IAOX,0CAA0B,CAAA;IAC1B,2BAAW,CAAA;IACX,6BAAa,CAAA;IAMb,0CAA0B,CAAA;IAQ1B,4CAA4B,CAAA;IAC5B,+BAAe,CAAA;IACf,mCAAmB,CAAA;IACnB,yEAAyD,CAAA;IACzD,uCAAuB,CAAA;IACvB,qCAAqB,CAAA;IAQrB,6CAA6B,CAAA;IAC7B,+CAA+B,CAAA;IAC/B,iCAAiB,CAAA;IACjB,qCAAqB,CAAA;IACrB,+BAAe,CAAA;IACf,iDAAiC,CAAA;IACjC,uCAAuB,CAAA;IACvB,gDAAgC,CAAA;IAChC,+BAAe,CAAA;IACf,8DAA8C,CAAA;IAC9C,uCAAuB,CAAA;IACvB,mCAAmB,CAAA;IACnB,uCAAuB,CAAA;AACzB,CAAC,EAnDW,YAAY,KAAZ,YAAY,QAmDvB;AAGD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,WAAW,CAAU,CAAC","sourcesContent":["import { CognitoInfo, LocationValue, Region } from '@bisondesk/commons-sdk/types';\nimport { OpportunityType } from '../constants.js';\n\nexport type PublicTenant = {\n defaultCountry: string;\n defaultCurrency: string;\n defaultLanguage: string;\n id: string; // the id is provided on creation bc we assume tenants will be created by someone on the team\n name: string;\n region: Region;\n subdomains: [string, ...string[]];\n\n // Pay attention to what information is added here since\n // the tenant can be obtained without authentication\n};\n\nexport enum TenantModule {\n Administration = 'administration',\n App = 'app',\n /**\n * The tenant's users can put the app into client mode, hiding the internal-only pages while\n * showing a screen to a customer. Left off for a tenant whose users are themselves the\n * customer: it would hide their sign-out to no purpose, and turning it back off needs a PIN\n * they were never given.\n */\n ClientMode = 'client_mode',\n CRM = 'crm',\n Docs = 'docs',\n /**\n * The app may send email on behalf of this tenant's users, e.g. sharing a vehicle: the\n * sender is the requesting user's own address, so the tenant's email domain must be one we\n * can deliver from. Absent on client tenants — we do not send mail as outsiders.\n */\n EmailShare = 'email_share',\n /**\n * The tenant's users can sign in with Google. It is a tenant fact rather than a user one:\n * `googleEmail` is only filled when the Google address differs from the BisonDesk one, and\n * every pool carries the Google provider regardless, so neither can tell who actually uses it.\n * Absent means password-only, which is what routes those users an emailed invite with a\n * genuine temporary password.\n */\n GoogleLogin = 'google_login',\n Leads = 'leads',\n Leasing = 'leasing',\n LeasingContractGeneration = 'leasing_contract_generation',\n Marketing = 'marketing',\n Insights = 'insights',\n /**\n * The tenant has agreed to exchange deal data through BisonDesk automatically, on top of the\n * bare vehicle distribution: it may be named as the buyer on an intercompany sale, which lets\n * the invoice sync and the purchase reconciliation write a purchase onto its copy. Read on the\n * BUYER only. All group tenants have it today; a supplier or client tenant that wants deal\n * data pushed too joins the exchange by being granted it.\n */\n Intercompany = 'intercompany',\n Opportunities = 'opportunities',\n Offers = 'offers',\n Vehicles = 'vehicles',\n Tasks = 'tasks',\n TrackAndTrace = 'track_and_trace',\n Bootstrap = 'bootstrap',\n WhatsappCrisp = 'whatsapp_crisp',\n Hexon = 'hexon',\n DeliveryConfirmation = 'delivery_confirmation',\n Transport = 'transport',\n Reports = 'reports',\n Prospects = 'prospects',\n}\n\n/** Report tabs a tenant can enable, in canonical order. */\nexport const REPORT_TAB_KEYS = ['sales', 'leasing', 'purchases'] as const;\n\nexport type ReportTabKey = (typeof REPORT_TAB_KEYS)[number];\n\nexport type Tenant = PublicTenant & {\n cognito?: CognitoInfo;\n languages: [string, ...string[]];\n conglomerate?: string;\n emailDomain: string;\n hyperdmsIds?: string[];\n hyperportalId?: string;\n\n /* deprecated */\n exactAccounting?: boolean;\n\n branches: [Branch, ...Branch[]];\n modules: TenantModule[];\n /**\n * Reports page configuration. `tabs` lists the visible tabs in display order;\n * absent or empty means no reports are configured for the tenant (the page\n * shows a notice instead of tabs).\n */\n reports?: {\n tabs: ReportTabKey[];\n };\n test?: boolean;\n opportunities: {\n types: OpportunityType[];\n };\n /**\n * Reservation expiry for this tenant's OWN vehicles (ADR-0026): the truck's owner sets the\n * clock, wherever the deal runs — for a cross-tenant copy the chain origin's policy\n * applies, whatever opportunity type the tenant selling to the end customer uses.\n * Absent = the default\n * business-day tiers; the tier is still picked by the local customer org's\n * trustworthy/conglomerate flags.\n */\n reservationExpiry?: ReservationExpiryPolicy;\n crm?: {\n vatNumberRequiredForCompanies?: boolean;\n };\n accounting?: {\n costCenterPerLine?: boolean;\n };\n // E.164 Twilio caller ID used as a fallback when a user has no own number configured\n defaultTwilioPhoneNumber?: string;\n deliveryEmail?: string;\n};\n\nexport type ReservationExpiryPolicy =\n | { policy: 'disabled' }\n | { policy: 'days'; generic: number; trustworthy: number; conglomerate: number };\n\nexport type AccountingProvider = 'exact' | 'odoo';\n\nexport type Branch = {\n id: string;\n name: string;\n country: string;\n language: string;\n /* deprecated — use `accounting === 'exact'` instead. Kept until prod cutover. */\n exactAccounting?: boolean;\n accounting?: AccountingProvider;\n currency: string;\n adminNumberPrefix: string;\n stockNumberPrefix: string;\n vatNumber: string;\n contactPerson?: { firstName: string; lastName: string };\n vatRates: {\n standard: string; //percentage value (e.g. 21)\n };\n location: LocationValue;\n\n storecoveExternalId?: number;\n // true if the branch is for a company where VAT is due when the invoice\n // is issued not when the payment is collected (e.g. France, Italy, Spain)\n vatOnDebits?: boolean;\n /**\n * The French issuing duties — e-invoicing, e-reporting and the Encaissée status — are switched\n * on for this branch. Receiving is unaffected and always active.\n *\n * Kept separate from `storecoveExternalId` on purpose: registering a Storecove legal entity only\n * makes a branch reachable, it does not mean the French duties have started. As a PME those\n * duties begin 2027-09-01, so this stays off until then or until a deliberate earlier adoption.\n */\n frIssuingEnabled?: boolean;\n externalQuote?: boolean;\n hyperdmsId?: string;\n internalDealsEnabled?: boolean;\n /** The source invoices the end customer directly; this branch collects payment and earns\n * commission. Intercompany source opportunities for this branch's deals take the buyer\n * deal's own client instead of the branch counterparty org. */\n dropshipping?: boolean;\n};\n\nexport type HdmsVehiclesSync = {\n active: boolean;\n};\n\nexport type HdmsCrmSync = {\n active: boolean;\n};\n\nexport type HdmsDocumentSync = {\n active: boolean;\n};\n\nexport type TenantSyncSettings = {\n tenantId: string;\n hdmsVehicles: HdmsVehiclesSync | undefined;\n hdmsCrm: HdmsCrmSync | undefined;\n hdmsDocuments: HdmsDocumentSync | undefined;\n};\n\nexport type WhatsappStateResponse = {\n enabled: boolean;\n};\n\n/**\n * What the login page is told about a tenant before anyone has signed in. Reached by subdomain\n * on the one public tenant endpoint, so it carries only what an anonymous visitor may see —\n * mind that when adding to it.\n *\n * The two booleans are answers the page cannot work out for itself: it has no session, so no\n * modules to read. They say which sign-in options to offer and whether WhatsApp sharing is on.\n */\nexport type TenantInfoResponse = {\n tenant: PublicTenant;\n whatsapp: boolean;\n googleLogin: boolean;\n cognito: CognitoInfo;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"tenants.js","sourceRoot":"/","sources":["types/tenants.ts"],"names":[],"mappings":"AAgBA,MAAM,CAAN,IAAY,YAmDX;AAnDD,WAAY,YAAY;IACtB,iDAAiC,CAAA;IACjC,2BAAW,CAAA;IAOX,0CAA0B,CAAA;IAC1B,2BAAW,CAAA;IACX,6BAAa,CAAA;IAMb,0CAA0B,CAAA;IAQ1B,4CAA4B,CAAA;IAC5B,+BAAe,CAAA;IACf,mCAAmB,CAAA;IACnB,yEAAyD,CAAA;IACzD,uCAAuB,CAAA;IACvB,qCAAqB,CAAA;IAQrB,6CAA6B,CAAA;IAC7B,+CAA+B,CAAA;IAC/B,iCAAiB,CAAA;IACjB,qCAAqB,CAAA;IACrB,+BAAe,CAAA;IACf,iDAAiC,CAAA;IACjC,uCAAuB,CAAA;IACvB,gDAAgC,CAAA;IAChC,+BAAe,CAAA;IACf,8DAA8C,CAAA;IAC9C,uCAAuB,CAAA;IACvB,mCAAmB,CAAA;IACnB,uCAAuB,CAAA;AACzB,CAAC,EAnDW,YAAY,KAAZ,YAAY,QAmDvB;AAGD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,CAAU,CAAC","sourcesContent":["import { CognitoInfo, LocationValue, Region } from '@bisondesk/commons-sdk/types';\nimport { OpportunityType } from '../constants.js';\n\nexport type PublicTenant = {\n defaultCountry: string;\n defaultCurrency: string;\n defaultLanguage: string;\n id: string; // the id is provided on creation bc we assume tenants will be created by someone on the team\n name: string;\n region: Region;\n subdomains: [string, ...string[]];\n\n // Pay attention to what information is added here since\n // the tenant can be obtained without authentication\n};\n\nexport enum TenantModule {\n Administration = 'administration',\n App = 'app',\n /**\n * The tenant's users can put the app into client mode, hiding the internal-only pages while\n * showing a screen to a customer. Left off for a tenant whose users are themselves the\n * customer: it would hide their sign-out to no purpose, and turning it back off needs a PIN\n * they were never given.\n */\n ClientMode = 'client_mode',\n CRM = 'crm',\n Docs = 'docs',\n /**\n * The app may send email on behalf of this tenant's users, e.g. sharing a vehicle: the\n * sender is the requesting user's own address, so the tenant's email domain must be one we\n * can deliver from. Absent on client tenants — we do not send mail as outsiders.\n */\n EmailShare = 'email_share',\n /**\n * The tenant's users can sign in with Google. It is a tenant fact rather than a user one:\n * `googleEmail` is only filled when the Google address differs from the BisonDesk one, and\n * every pool carries the Google provider regardless, so neither can tell who actually uses it.\n * Absent means password-only, which is what routes those users an emailed invite with a\n * genuine temporary password.\n */\n GoogleLogin = 'google_login',\n Leads = 'leads',\n Leasing = 'leasing',\n LeasingContractGeneration = 'leasing_contract_generation',\n Marketing = 'marketing',\n Insights = 'insights',\n /**\n * The tenant has agreed to exchange deal data through BisonDesk automatically, on top of the\n * bare vehicle distribution: it may be named as the buyer on an intercompany sale, which lets\n * the invoice sync and the purchase reconciliation write a purchase onto its copy. Read on the\n * BUYER only. All group tenants have it today; a supplier or client tenant that wants deal\n * data pushed too joins the exchange by being granted it.\n */\n Intercompany = 'intercompany',\n Opportunities = 'opportunities',\n Offers = 'offers',\n Vehicles = 'vehicles',\n Tasks = 'tasks',\n TrackAndTrace = 'track_and_trace',\n Bootstrap = 'bootstrap',\n WhatsappCrisp = 'whatsapp_crisp',\n Hexon = 'hexon',\n DeliveryConfirmation = 'delivery_confirmation',\n Transport = 'transport',\n Reports = 'reports',\n Prospects = 'prospects',\n}\n\n/** Report tabs a tenant can enable, in canonical order. */\nexport const REPORT_TAB_KEYS = ['sales', 'leasing', 'purchases', 'arrivals'] as const;\n\nexport type ReportTabKey = (typeof REPORT_TAB_KEYS)[number];\n\nexport type Tenant = PublicTenant & {\n cognito?: CognitoInfo;\n languages: [string, ...string[]];\n conglomerate?: string;\n emailDomain: string;\n hyperdmsIds?: string[];\n hyperportalId?: string;\n\n /* deprecated */\n exactAccounting?: boolean;\n\n branches: [Branch, ...Branch[]];\n modules: TenantModule[];\n /**\n * Reports page configuration. `tabs` lists the visible tabs in display order;\n * absent or empty means no reports are configured for the tenant (the page\n * shows a notice instead of tabs).\n */\n reports?: {\n tabs: ReportTabKey[];\n };\n test?: boolean;\n opportunities: {\n types: OpportunityType[];\n };\n /**\n * Reservation expiry for this tenant's OWN vehicles (ADR-0026): the truck's owner sets the\n * clock, wherever the deal runs — for a cross-tenant copy the chain origin's policy\n * applies, whatever opportunity type the tenant selling to the end customer uses.\n * Absent = the default\n * business-day tiers; the tier is still picked by the local customer org's\n * trustworthy/conglomerate flags.\n */\n reservationExpiry?: ReservationExpiryPolicy;\n crm?: {\n vatNumberRequiredForCompanies?: boolean;\n };\n accounting?: {\n costCenterPerLine?: boolean;\n };\n // E.164 Twilio caller ID used as a fallback when a user has no own number configured\n defaultTwilioPhoneNumber?: string;\n deliveryEmail?: string;\n};\n\nexport type ReservationExpiryPolicy =\n | { policy: 'disabled' }\n | { policy: 'days'; generic: number; trustworthy: number; conglomerate: number };\n\nexport type AccountingProvider = 'exact' | 'odoo';\n\nexport type Branch = {\n id: string;\n name: string;\n country: string;\n language: string;\n /* deprecated — use `accounting === 'exact'` instead. Kept until prod cutover. */\n exactAccounting?: boolean;\n accounting?: AccountingProvider;\n currency: string;\n adminNumberPrefix: string;\n stockNumberPrefix: string;\n vatNumber: string;\n contactPerson?: { firstName: string; lastName: string };\n vatRates: {\n standard: string; //percentage value (e.g. 21)\n };\n location: LocationValue;\n\n storecoveExternalId?: number;\n // true if the branch is for a company where VAT is due when the invoice\n // is issued not when the payment is collected (e.g. France, Italy, Spain)\n vatOnDebits?: boolean;\n /**\n * The French issuing duties — e-invoicing, e-reporting and the Encaissée status — are switched\n * on for this branch. Receiving is unaffected and always active.\n *\n * Kept separate from `storecoveExternalId` on purpose: registering a Storecove legal entity only\n * makes a branch reachable, it does not mean the French duties have started. As a PME those\n * duties begin 2027-09-01, so this stays off until then or until a deliberate earlier adoption.\n */\n frIssuingEnabled?: boolean;\n externalQuote?: boolean;\n hyperdmsId?: string;\n internalDealsEnabled?: boolean;\n /** The source invoices the end customer directly; this branch collects payment and earns\n * commission. Intercompany source opportunities for this branch's deals take the buyer\n * deal's own client instead of the branch counterparty org. */\n dropshipping?: boolean;\n};\n\nexport type HdmsVehiclesSync = {\n active: boolean;\n};\n\nexport type HdmsCrmSync = {\n active: boolean;\n};\n\nexport type HdmsDocumentSync = {\n active: boolean;\n};\n\nexport type TenantSyncSettings = {\n tenantId: string;\n hdmsVehicles: HdmsVehiclesSync | undefined;\n hdmsCrm: HdmsCrmSync | undefined;\n hdmsDocuments: HdmsDocumentSync | undefined;\n};\n\nexport type WhatsappStateResponse = {\n enabled: boolean;\n};\n\n/**\n * What the login page is told about a tenant before anyone has signed in. Reached by subdomain\n * on the one public tenant endpoint, so it carries only what an anonymous visitor may see —\n * mind that when adding to it.\n *\n * The two booleans are answers the page cannot work out for itself: it has no session, so no\n * modules to read. They say which sign-in options to offer and whether WhatsApp sharing is on.\n */\nexport type TenantInfoResponse = {\n tenant: PublicTenant;\n whatsapp: boolean;\n googleLogin: boolean;\n cognito: CognitoInfo;\n};\n"]}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { GPSCoord, NextList, PaginatedList } from '@bisondesk/commons-sdk/types';
|
|
2
2
|
import { Organization } from './crm.js';
|
|
3
|
+
import { AddressDeliveryType, PickUpDeliveryType, PortDeliverytype, PurchaseDeliveryType, SalesDeliveryTypes } from './deliveries.js';
|
|
3
4
|
import { BaseEvent } from './internal-events.js';
|
|
4
5
|
import { Opportunity, OpportunityPaymentStatus } from './opportunities.js';
|
|
5
|
-
import { AddressDeliveryType, DeliveryTypes, PickUpDeliveryType, PortDeliverytype } from './quotes.js';
|
|
6
6
|
import { BaseSearchRequest, SortOrder } from './search.js';
|
|
7
7
|
import { DataRecord, ReferenceData } from './utils.js';
|
|
8
8
|
import { Vehicle, VehiclePurchase } from './vehicles.js';
|
|
9
9
|
export declare enum TransportType {
|
|
10
10
|
PurchasePickUp = "PURCHASE_PICK_UP",
|
|
11
|
+
PurchaseDropOff = "PURCHASE_DROP_OFF",
|
|
11
12
|
SaleDelivery = "SALE_DELIVERY"
|
|
12
13
|
}
|
|
14
|
+
export type TransportPurchaseType = TransportType.PurchasePickUp | TransportType.PurchaseDropOff;
|
|
15
|
+
export declare const TransportPurchaseTypes: TransportPurchaseType[];
|
|
13
16
|
export declare enum TransportStatus {
|
|
14
17
|
Todo = "TODO",
|
|
15
18
|
Planning = "PLANNING",
|
|
@@ -28,14 +31,8 @@ export declare enum TransportPriority {
|
|
|
28
31
|
High = "HIGH",
|
|
29
32
|
Urgent = "URGENT"
|
|
30
33
|
}
|
|
31
|
-
export declare const TransportSalesDeliveryType: {
|
|
32
|
-
readonly Address: DeliveryTypes.ADDRESS;
|
|
33
|
-
readonly Port: DeliveryTypes.PORT;
|
|
34
|
-
readonly PortAndShip: DeliveryTypes.PORT_AND_SHIP;
|
|
35
|
-
readonly PickUp: DeliveryTypes.PICK_UP;
|
|
36
|
-
};
|
|
37
34
|
export type TransportPickUpDeliveryType = Omit<PickUpDeliveryType, 'dateOfPickUpByCustomer'>;
|
|
38
|
-
|
|
35
|
+
type TransportDeliveryExtras = {
|
|
39
36
|
cleaningNeeded?: boolean;
|
|
40
37
|
driver?: string;
|
|
41
38
|
transportCompany?: string;
|
|
@@ -43,13 +40,13 @@ export type TransportSalesDeliveryType = (PortDeliverytype | AddressDeliveryType
|
|
|
43
40
|
adminCost?: string;
|
|
44
41
|
stackingVehicleCostPrice?: string;
|
|
45
42
|
};
|
|
46
|
-
export type
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
43
|
+
export type TransportSalesDeliveryType = (PortDeliverytype | AddressDeliveryType | TransportPickUpDeliveryType) & TransportDeliveryExtras;
|
|
44
|
+
export type TransportPurchaseDeliveryType = PurchaseDeliveryType & TransportDeliveryExtras;
|
|
45
|
+
export declare const TransportSalesDeliveryType: {
|
|
46
|
+
readonly Address: SalesDeliveryTypes.ADDRESS;
|
|
47
|
+
readonly Port: SalesDeliveryTypes.PORT;
|
|
48
|
+
readonly PortAndShip: SalesDeliveryTypes.PORT_AND_SHIP;
|
|
49
|
+
readonly PickUp: SalesDeliveryTypes.PICK_UP;
|
|
53
50
|
};
|
|
54
51
|
export type Transport = {
|
|
55
52
|
id: string;
|
|
@@ -81,7 +78,7 @@ export type Transport = {
|
|
|
81
78
|
updatedAt: string;
|
|
82
79
|
updatedBy: string;
|
|
83
80
|
} & ({
|
|
84
|
-
type:
|
|
81
|
+
type: TransportPurchaseType;
|
|
85
82
|
delivery: TransportPurchaseDeliveryType;
|
|
86
83
|
} | {
|
|
87
84
|
type: TransportType.SaleDelivery;
|
|
@@ -105,6 +102,7 @@ export declare enum TransportActions {
|
|
|
105
102
|
SetBookingRef = "set_booking_ref"
|
|
106
103
|
}
|
|
107
104
|
export type TransportUpdate = {
|
|
105
|
+
type?: TransportPurchaseType;
|
|
108
106
|
delivery?: TransportSalesDeliveryType | TransportPurchaseDeliveryType;
|
|
109
107
|
notes?: string | null;
|
|
110
108
|
adminApproved?: boolean;
|
|
@@ -131,6 +129,7 @@ export type TransportUpdateEvent = BaseTransportEvent & {
|
|
|
131
129
|
};
|
|
132
130
|
export type TransportEvent = BaseEvent & (TransportCreateEvent | TransportUpdateEvent);
|
|
133
131
|
export declare enum TransportPaymentStatus {
|
|
132
|
+
PaymentNotNeeded = "payment_not_needed",
|
|
134
133
|
NoPayment = "no_payment",
|
|
135
134
|
PartialPaymentReceived = "partial_payment_received",
|
|
136
135
|
FullPaymentReceived = "full_payment_received",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transports.d.ts","sourceRoot":"/","sources":["types/transports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,
|
|
1
|
+
{"version":3,"file":"transports.d.ts","sourceRoot":"/","sources":["types/transports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE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AsB,CAAC;QAStC,QAAQ,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,KAAK,GAAG,KAAK,CAAC,CAAC;QACzC,cAAc,CAAC,EAAE,uBAAuB,CAAC;KAC1C,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,aAAa,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;AAEhF,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,eAAe,CAAC;IACxB,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,MAAM,EAAE,qBAAqB,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG,iBAAiB,GAAG;IAC9D,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IAChD,YAAY,CAAC,EAAE,MAAM,CAAC,eAAe,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,SAAS,CAAA;KAAE,EAAE,CAAC,CAAC;CACjF,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,IAAI,CACzC,QAAQ,CAAC,qBAAqB,EAAE,aAAa,CAAC,EAC9C,WAAW,CACZ,GAAG;IACF,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;CACjD,CAAC"}
|
package/lib/types/transports.js
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SalesDeliveryTypes, } from './deliveries.js';
|
|
2
2
|
export var TransportType;
|
|
3
3
|
(function (TransportType) {
|
|
4
4
|
TransportType["PurchasePickUp"] = "PURCHASE_PICK_UP";
|
|
5
|
+
TransportType["PurchaseDropOff"] = "PURCHASE_DROP_OFF";
|
|
5
6
|
TransportType["SaleDelivery"] = "SALE_DELIVERY";
|
|
6
7
|
})(TransportType || (TransportType = {}));
|
|
8
|
+
export const TransportPurchaseTypes = [
|
|
9
|
+
TransportType.PurchasePickUp,
|
|
10
|
+
TransportType.PurchaseDropOff,
|
|
11
|
+
];
|
|
7
12
|
export var TransportStatus;
|
|
8
13
|
(function (TransportStatus) {
|
|
9
14
|
TransportStatus["Todo"] = "TODO";
|
|
@@ -35,10 +40,10 @@ export var TransportPriority;
|
|
|
35
40
|
TransportPriority["Urgent"] = "URGENT";
|
|
36
41
|
})(TransportPriority || (TransportPriority = {}));
|
|
37
42
|
export const TransportSalesDeliveryType = {
|
|
38
|
-
Address:
|
|
39
|
-
Port:
|
|
40
|
-
PortAndShip:
|
|
41
|
-
PickUp:
|
|
43
|
+
Address: SalesDeliveryTypes.ADDRESS,
|
|
44
|
+
Port: SalesDeliveryTypes.PORT,
|
|
45
|
+
PortAndShip: SalesDeliveryTypes.PORT_AND_SHIP,
|
|
46
|
+
PickUp: SalesDeliveryTypes.PICK_UP,
|
|
42
47
|
};
|
|
43
48
|
export var TransportWarningCode;
|
|
44
49
|
(function (TransportWarningCode) {
|
|
@@ -55,6 +60,7 @@ export var TransportActions;
|
|
|
55
60
|
})(TransportActions || (TransportActions = {}));
|
|
56
61
|
export var TransportPaymentStatus;
|
|
57
62
|
(function (TransportPaymentStatus) {
|
|
63
|
+
TransportPaymentStatus["PaymentNotNeeded"] = "payment_not_needed";
|
|
58
64
|
TransportPaymentStatus["NoPayment"] = "no_payment";
|
|
59
65
|
TransportPaymentStatus["PartialPaymentReceived"] = "partial_payment_received";
|
|
60
66
|
TransportPaymentStatus["FullPaymentReceived"] = "full_payment_received";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transports.js","sourceRoot":"/","sources":["types/transports.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,aAAa,GAGd,MAAM,aAAa,CAAC;AAKrB,MAAM,CAAN,IAAY,aAGX;AAHD,WAAY,aAAa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AN,IAAY,gBAUX;AAVD,WAAY,gBAAgB;IAE1B,gDAA4B,CAAA;IAC5B,0CAAsB,CAAA;IAEtB,gDAA4B,CAAA;IAE5B,4CAAwB,CAAA;IACxB,gDAA4B,CAAA;IAC5B,qDAAiC,CAAA;AACnC,CAAC,EAVW,gBAAgB,KAAhB,gBAAgB,QAU3B;AAuCD,MAAM,CAAN,IAAY,sBAMX;AAND,WAAY,sBAAsB;IAChC,kDAAwB,CAAA;IACxB,6EAAmD,CAAA;IACnD,uEAA6C,CAAA;IAC7C,qEAA2C,CAAA;IAC3C,+DAAqC,CAAA;AACvC,CAAC,EANW,sBAAsB,KAAtB,sBAAsB,QAMjC;AAcD,MAAM,CAAN,IAAY,uBAIX;AAJD,WAAY,uBAAuB;IACjC,+DAAoC,CAAA;IACpC,qDAA0B,CAAA;IAC1B,qDAA0B,CAAA;AAC5B,CAAC,EAJW,uBAAuB,KAAvB,uBAAuB,QAIlC","sourcesContent":["import { GPSCoord, NextList, PaginatedList } from '@bisondesk/commons-sdk/types';\nimport { Organization } from './crm.js';\nimport { BaseEvent } from './internal-events.js';\nimport { Opportunity, OpportunityPaymentStatus } from './opportunities.js';\nimport {\n AddressDeliveryType,\n DeliveryTypes,\n PickUpDeliveryType,\n PortDeliverytype,\n} from './quotes.js';\nimport { BaseSearchRequest, SortOrder } from './search.js';\nimport { DataRecord, ReferenceData } from './utils.js';\nimport { Vehicle, VehiclePurchase } from './vehicles.js';\n\nexport enum TransportType {\n PurchasePickUp = 'PURCHASE_PICK_UP',\n SaleDelivery = 'SALE_DELIVERY',\n}\n\nexport enum TransportStatus {\n Todo = 'TODO',\n Planning = 'PLANNING',\n Ready = 'READY',\n ScheduledExternal = 'SCHEDULED_EXTERNAL',\n OngoingInternal = 'ONGOING_INTERNAL',\n OngoingShip = 'ONGOING_SHIP',\n Done = 'DONE',\n}\n\nexport const TransportStatusOrder: TransportStatus[] = [\n TransportStatus.Todo,\n TransportStatus.Planning,\n TransportStatus.Ready,\n TransportStatus.ScheduledExternal,\n TransportStatus.OngoingInternal,\n TransportStatus.OngoingShip,\n];\n\nexport const TransportDoneColumnId = TransportStatus.Done;\n\nexport const TransportKanbanEndColumns: TransportStatus[] = [TransportDoneColumnId];\nexport const TransportKanbanColumns: TransportStatus[] = [\n ...TransportStatusOrder,\n ...TransportKanbanEndColumns,\n];\n\nexport enum TransportPriority {\n Normal = 'NORMAL',\n High = 'HIGH',\n Urgent = 'URGENT',\n}\n\nexport const TransportSalesDeliveryType = {\n Address: DeliveryTypes.ADDRESS,\n Port: DeliveryTypes.PORT,\n PortAndShip: DeliveryTypes.PORT_AND_SHIP,\n PickUp: DeliveryTypes.PICK_UP,\n} as const;\n\n/**\n * The customer collects the vehicle. Nothing is driven anywhere, but the papers still have to be\n * arranged and paid for — transit plates, technical control, insurance — which is why it is a\n * delivery type administration reviews rather than the absence of one.\n *\n * `dateOfPickUpByCustomer` is dropped from the quote's shape: the transport's own `date` is the\n * collection day, and two fields for one date only ever disagree.\n */\nexport type TransportPickUpDeliveryType = Omit<PickUpDeliveryType, 'dateOfPickUpByCustomer'>;\n\nexport type TransportSalesDeliveryType = (\n | PortDeliverytype\n | AddressDeliveryType\n | TransportPickUpDeliveryType\n) & {\n cleaningNeeded?: boolean;\n driver?: string;\n transportCompany?: string;\n date?: string; // Pick-up (purchase) | Delivery (OPP) (leaves parking)\n adminCost?: string; // user-entered administrative cost summed into totalCostExclVat\n stackingVehicleCostPrice?: string; // overrides the stacking rate from the delivery settings\n};\n\nexport type TransportPurchaseDeliveryType = AddressDeliveryType & {\n cleaningNeeded?: boolean;\n driver?: string;\n transportCompany?: string;\n date?: string; // Pick-up (purchase) | Delivery (OPP) (leaves parking)\n adminCost?: string; // user-entered administrative cost summed into totalCostExclVat\n stackingVehicleCostPrice?: string; // overrides the stacking rate from the delivery settings\n};\n\nexport type Transport = {\n id: string;\n vehicleId: string;\n opportunityId?: string;\n\n status: TransportStatus;\n priority: TransportPriority;\n\n // administrative fields\n adminApproved: boolean;\n adminApprovedAt?: string;\n adminApprovedBy?: string;\n transportWithoutPayment?: boolean;\n notes?: string;\n\n totals: {\n totalRetailAmountExclVat: string;\n totalCostExclVat: string;\n estimatedTotalCostExclVat?: string;\n };\n\n log: Array<{\n status: TransportStatus;\n completedAt: string;\n completedBy: string;\n }>;\n\n doneAt?: string;\n doneBy?: string;\n canceledAt?: string;\n canceledBy?: string;\n\n createdAt: string;\n createdBy: string;\n updatedAt: string;\n updatedBy: string;\n} & (\n | {\n type: TransportType.PurchasePickUp;\n delivery: TransportPurchaseDeliveryType;\n }\n | {\n type: TransportType.SaleDelivery;\n delivery: TransportSalesDeliveryType;\n }\n);\n\nexport enum TransportWarningCode {\n PurchaseLogisticsNotReady = 'purchase_logistics_not_ready',\n}\n\nexport type TransportWarning = {\n code: TransportWarningCode;\n details?: Record<string, string | number | boolean>;\n};\n\nexport type TransportCost = Pick<Transport, 'totals'>;\n\nexport type TransportRecord = DataRecord<Transport>;\n\n/**\n * What a requester may change on a transport, field group by field group. The server filters an\n * update through these and returns the ones granted on the record, so the drawer disables what the\n * user cannot touch instead of deciding for itself from the user's roles.\n */\nexport enum TransportActions {\n /** The route: addresses, ports, dates, costs. */\n SetDelivery = 'set_delivery',\n SetNotes = 'set_notes',\n /** The administrative sign-off, and the clearance to move before the payment. */\n SetApproval = 'set_approval',\n /** The board column. */\n SetStatus = 'set_status',\n SetPriority = 'set_priority',\n SetBookingRef = 'set_booking_ref',\n}\n\n/**\n * Every field a write may set, in one shape. `delivery` is replaced whole when it is sent — there is\n * no partial merge into the stored one — which is why `bookingRef` rides alongside as a scalar the\n * server writes into the delivery it ends up with.\n */\nexport type TransportUpdate = {\n delivery?: TransportSalesDeliveryType | TransportPurchaseDeliveryType;\n notes?: string | null;\n adminApproved?: boolean;\n transportWithoutPayment?: boolean;\n status?: TransportStatus;\n priority?: TransportPriority;\n bookingRef?: string | null;\n};\n\ntype BaseTransportEvent = {\n actionAt: string;\n userId: string;\n tenantId: string;\n transportId: string;\n};\n\nexport type TransportCreateEvent = BaseTransportEvent & {\n action: 'create';\n data: Transport;\n previousData?: undefined;\n};\n\nexport type TransportUpdateEvent = BaseTransportEvent & {\n action: 'update';\n data: Transport;\n previousData: Transport;\n};\n\n/** Published whenever a transport is written. Carries both sides so subscribers judge relevance. */\nexport type TransportEvent = BaseEvent & (TransportCreateEvent | TransportUpdateEvent);\n\nexport enum TransportPaymentStatus {\n NoPayment = 'no_payment',\n PartialPaymentReceived = 'partial_payment_received',\n FullPaymentReceived = 'full_payment_received',\n PartialPaymentSent = 'partial_payment_sent',\n FullPaymentSent = 'full_payment_sent',\n}\n\n/**\n * Where the money stands on the record the transport serves: the customer's payments on the\n * opportunity for a sale delivery, ours to the supplier for a purchase pick-up. Denormalised at\n * indexing time so the board can show it without joining.\n */\nexport type TransportPayment = {\n status: OpportunityPaymentStatus;\n /** Only a sale delivery knows the ratio — a pick-up has milestones, not a running total. */\n percentagePaid?: string;\n};\n\n/** Which address the map pin came from, so the UI can tell an exact pin from an approximate one. */\nexport enum TransportLocationSource {\n DeliveryAddress = 'delivery_address',\n OriginPort = 'origin_port',\n OrgAddress = 'org_address',\n}\n\nexport type SearchTransport = {\n transport: Transport;\n vehicle: Vehicle;\n org: Organization;\n opportunity?: Opportunity;\n purchase: VehiclePurchase;\n tasks: {\n totalTasks: number;\n openTasks: number;\n nextDueAt?: string;\n };\n custom: {\n commercialUserIds: string[];\n warnings: TransportWarning[];\n priorityOrdinal: number;\n payment: TransportPayment;\n paymentStatus: TransportPaymentStatus;\n /**\n * Where the transport happens: the delivery address, or the origin port for a shipped delivery.\n * Denormalised into one field because the map clusters over a single geo_point, and a port\n * delivery carries no address of its own.\n *\n * Deliberately narrower than `GPSCoord`: a geo_point field rejects any key beyond lat/lon, so\n * the map zoom the coordinates picker stores must not reach the index.\n */\n location?: Pick<GPSCoord, 'lat' | 'lon'>;\n locationSource?: TransportLocationSource;\n };\n};\n\nexport type SearchTransportList = PaginatedList<SearchTransport, ReferenceData>;\n\nexport type TransportKanbanColumn = {\n status: TransportStatus;\n results: SearchTransport[];\n totalCount: number;\n};\n\nexport type MSearchTransportsKanbanColumn = {\n column: TransportKanbanColumn;\n nextToken?: string;\n};\n\nexport type KanbanTransportsSearchRequest = BaseSearchRequest & {\n nextTokens?: Record<string, string | undefined>;\n statusSortBy?: Record<TransportStatus, { fieldId: string; order: SortOrder }[]>;\n};\n\nexport type KanbanTransportsNextList = Omit<\n NextList<TransportKanbanColumn, ReferenceData>,\n 'nextToken'\n> & {\n nextTokens?: Record<string, string | undefined>;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"transports.js","sourceRoot":"/","sources":["types/transports.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AAOzB,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,oDAAmC,CAAA;IACnC,sDAAqC,CAAA;IACrC,+CAA8B,CAAA;AAChC,CAAC,EAJW,aAAa,KAAb,aAAa,QAIxB;AAKD,MAAM,CAAC,MAAM,sBAAsB,GAA4B;IAC7D,aAAa,CAAC,cAAc;IAC5B,aAAa,CAAC,eAAe;CAC9B,CAAC;AAEF,MAAM,CAAN,IAAY,eAQX;AARD,WAAY,eAAe;IACzB,gCAAa,CAAA;IACb,wCAAqB,CAAA;IACrB,kCAAe,CAAA;IACf,2DAAwC,CAAA;IACxC,uDAAoC,CAAA;IACpC,+CAA4B,CAAA;IAC5B,gCAAa,CAAA;AACf,CAAC,EARW,eAAe,KAAf,eAAe,QAQ1B;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAsB;IACrD,eAAe,CAAC,IAAI;IACpB,eAAe,CAAC,QAAQ;IACxB,eAAe,CAAC,KAAK;IACrB,eAAe,CAAC,iBAAiB;IACjC,eAAe,CAAC,eAAe;IAC/B,eAAe,CAAC,WAAW;CAC5B,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,eAAe,CAAC,IAAI,CAAC;AAE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CAAC,EAJW,uBAAuB,KAAvB,uBAAuB,QAIlC","sourcesContent":["import { GPSCoord, NextList, PaginatedList } from '@bisondesk/commons-sdk/types';\nimport { Organization } from './crm.js';\nimport {\n AddressDeliveryType,\n PickUpDeliveryType,\n PortDeliverytype,\n PurchaseDeliveryType,\n SalesDeliveryTypes,\n} from './deliveries.js';\nimport { BaseEvent } from './internal-events.js';\nimport { Opportunity, OpportunityPaymentStatus } from './opportunities.js';\nimport { BaseSearchRequest, SortOrder } from './search.js';\nimport { DataRecord, ReferenceData } from './utils.js';\nimport { Vehicle, VehiclePurchase } from './vehicles.js';\n\nexport enum TransportType {\n PurchasePickUp = 'PURCHASE_PICK_UP',\n PurchaseDropOff = 'PURCHASE_DROP_OFF',\n SaleDelivery = 'SALE_DELIVERY',\n}\n\n/** Both inbound journeys, whoever drives them. Mirrors the purchase's own delivery type. */\nexport type TransportPurchaseType = TransportType.PurchasePickUp | TransportType.PurchaseDropOff;\n\nexport const TransportPurchaseTypes: TransportPurchaseType[] = [\n TransportType.PurchasePickUp,\n TransportType.PurchaseDropOff,\n];\n\nexport enum TransportStatus {\n Todo = 'TODO',\n Planning = 'PLANNING',\n Ready = 'READY',\n ScheduledExternal = 'SCHEDULED_EXTERNAL',\n OngoingInternal = 'ONGOING_INTERNAL',\n OngoingShip = 'ONGOING_SHIP',\n Done = 'DONE',\n}\n\nexport const TransportStatusOrder: TransportStatus[] = [\n TransportStatus.Todo,\n TransportStatus.Planning,\n TransportStatus.Ready,\n TransportStatus.ScheduledExternal,\n TransportStatus.OngoingInternal,\n TransportStatus.OngoingShip,\n];\n\nexport const TransportDoneColumnId = TransportStatus.Done;\n\nexport const TransportKanbanEndColumns: TransportStatus[] = [TransportDoneColumnId];\nexport const TransportKanbanColumns: TransportStatus[] = [\n ...TransportStatusOrder,\n ...TransportKanbanEndColumns,\n];\n\nexport enum TransportPriority {\n Normal = 'NORMAL',\n High = 'HIGH',\n Urgent = 'URGENT',\n}\n\n/**\n * The customer collects the vehicle. Nothing is driven anywhere, but the papers still have to be\n * arranged and paid for — transit plates, technical control, insurance — which is why it is a\n * delivery type administration reviews rather than the absence of one.\n *\n * `dateOfPickUpByCustomer` is dropped from the quote's shape: the transport's own `date` is the\n * collection day, and two fields for one date only ever disagree.\n */\nexport type TransportPickUpDeliveryType = Omit<PickUpDeliveryType, 'dateOfPickUpByCustomer'>;\n\ntype TransportDeliveryExtras = {\n cleaningNeeded?: boolean;\n driver?: string;\n transportCompany?: string;\n date?: string; // Pick-up (purchase) | Delivery (OPP) (leaves parking)\n adminCost?: string; // user-entered administrative cost summed into totalCostExclVat\n stackingVehicleCostPrice?: string; // overrides the stacking rate from the delivery settings\n};\n\nexport type TransportSalesDeliveryType = (\n | PortDeliverytype\n | AddressDeliveryType\n | TransportPickUpDeliveryType\n) &\n TransportDeliveryExtras;\n\nexport type TransportPurchaseDeliveryType = PurchaseDeliveryType & TransportDeliveryExtras;\n\n/** @deprecated Use SalesDeliveryTypes from ./deliveries.js. */\nexport const TransportSalesDeliveryType = {\n Address: SalesDeliveryTypes.ADDRESS,\n Port: SalesDeliveryTypes.PORT,\n PortAndShip: SalesDeliveryTypes.PORT_AND_SHIP,\n PickUp: SalesDeliveryTypes.PICK_UP,\n} as const;\n\nexport type Transport = {\n id: string;\n vehicleId: string;\n opportunityId?: string;\n\n status: TransportStatus;\n priority: TransportPriority;\n\n // administrative fields\n adminApproved: boolean;\n adminApprovedAt?: string;\n adminApprovedBy?: string;\n transportWithoutPayment?: boolean;\n notes?: string;\n\n totals: {\n totalRetailAmountExclVat: string;\n totalCostExclVat: string;\n estimatedTotalCostExclVat?: string;\n };\n\n log: Array<{\n status: TransportStatus;\n completedAt: string;\n completedBy: string;\n }>;\n\n doneAt?: string;\n doneBy?: string;\n canceledAt?: string;\n canceledBy?: string;\n\n createdAt: string;\n createdBy: string;\n updatedAt: string;\n updatedBy: string;\n} & (\n | {\n type: TransportPurchaseType;\n delivery: TransportPurchaseDeliveryType;\n }\n | {\n type: TransportType.SaleDelivery;\n delivery: TransportSalesDeliveryType;\n }\n);\n\nexport enum TransportWarningCode {\n PurchaseLogisticsNotReady = 'purchase_logistics_not_ready',\n}\n\nexport type TransportWarning = {\n code: TransportWarningCode;\n details?: Record<string, string | number | boolean>;\n};\n\nexport type TransportCost = Pick<Transport, 'totals'>;\n\nexport type TransportRecord = DataRecord<Transport>;\n\n/**\n * What a requester may change on a transport, field group by field group. The server filters an\n * update through these and returns the ones granted on the record, so the drawer disables what the\n * user cannot touch instead of deciding for itself from the user's roles.\n */\nexport enum TransportActions {\n /** The route: addresses, ports, dates, costs. */\n SetDelivery = 'set_delivery',\n SetNotes = 'set_notes',\n /** The administrative sign-off, and the clearance to move before the payment. */\n SetApproval = 'set_approval',\n /** The board column. */\n SetStatus = 'set_status',\n SetPriority = 'set_priority',\n SetBookingRef = 'set_booking_ref',\n}\n\n/**\n * Every field a write may set, in one shape. `delivery` is replaced whole when it is sent — there is\n * no partial merge into the stored one — which is why `bookingRef` rides alongside as a scalar the\n * server writes into the delivery it ends up with.\n */\nexport type TransportUpdate = {\n /** Changes the purchase method and the purchase agreement together. */\n type?: TransportPurchaseType;\n delivery?: TransportSalesDeliveryType | TransportPurchaseDeliveryType;\n notes?: string | null;\n adminApproved?: boolean;\n transportWithoutPayment?: boolean;\n status?: TransportStatus;\n priority?: TransportPriority;\n bookingRef?: string | null;\n};\n\ntype BaseTransportEvent = {\n actionAt: string;\n userId: string;\n tenantId: string;\n transportId: string;\n};\n\nexport type TransportCreateEvent = BaseTransportEvent & {\n action: 'create';\n data: Transport;\n previousData?: undefined;\n};\n\nexport type TransportUpdateEvent = BaseTransportEvent & {\n action: 'update';\n data: Transport;\n previousData: Transport;\n};\n\n/** Published whenever a transport is written. Carries both sides so subscribers judge relevance. */\nexport type TransportEvent = BaseEvent & (TransportCreateEvent | TransportUpdateEvent);\n\nexport enum TransportPaymentStatus {\n PaymentNotNeeded = 'payment_not_needed',\n NoPayment = 'no_payment',\n PartialPaymentReceived = 'partial_payment_received',\n FullPaymentReceived = 'full_payment_received',\n PartialPaymentSent = 'partial_payment_sent',\n FullPaymentSent = 'full_payment_sent',\n}\n\n/**\n * Where the money stands on the record the transport serves: the customer's payments on the\n * opportunity for a sale delivery, ours to the supplier for a purchase pick-up. Denormalised at\n * indexing time so the board can show it without joining.\n */\nexport type TransportPayment = {\n status: OpportunityPaymentStatus;\n /** Only a sale delivery knows the ratio — a pick-up has milestones, not a running total. */\n percentagePaid?: string;\n};\n\n/** Which address the map pin came from, so the UI can tell an exact pin from an approximate one. */\nexport enum TransportLocationSource {\n DeliveryAddress = 'delivery_address',\n OriginPort = 'origin_port',\n OrgAddress = 'org_address',\n}\n\nexport type SearchTransport = {\n transport: Transport;\n vehicle: Vehicle;\n org: Organization;\n opportunity?: Opportunity;\n purchase: VehiclePurchase;\n tasks: {\n totalTasks: number;\n openTasks: number;\n nextDueAt?: string;\n };\n custom: {\n commercialUserIds: string[];\n warnings: TransportWarning[];\n priorityOrdinal: number;\n payment: TransportPayment;\n paymentStatus: TransportPaymentStatus;\n /**\n * Where the transport happens: the delivery address, or the origin port for a shipped delivery.\n * Denormalised into one field because the map clusters over a single geo_point, and a port\n * delivery carries no address of its own.\n *\n * Deliberately narrower than `GPSCoord`: a geo_point field rejects any key beyond lat/lon, so\n * the map zoom the coordinates picker stores must not reach the index.\n */\n location?: Pick<GPSCoord, 'lat' | 'lon'>;\n locationSource?: TransportLocationSource;\n };\n};\n\nexport type SearchTransportList = PaginatedList<SearchTransport, ReferenceData>;\n\nexport type TransportKanbanColumn = {\n status: TransportStatus;\n results: SearchTransport[];\n totalCount: number;\n};\n\nexport type MSearchTransportsKanbanColumn = {\n column: TransportKanbanColumn;\n nextToken?: string;\n};\n\nexport type KanbanTransportsSearchRequest = BaseSearchRequest & {\n nextTokens?: Record<string, string | undefined>;\n statusSortBy?: Record<TransportStatus, { fieldId: string; order: SortOrder }[]>;\n};\n\nexport type KanbanTransportsNextList = Omit<\n NextList<TransportKanbanColumn, ReferenceData>,\n 'nextToken'\n> & {\n nextTokens?: Record<string, string | undefined>;\n};\n"]}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { LocationValue } from '@bisondesk/commons-sdk/locations';
|
|
2
2
|
import { Organization } from './crm.js';
|
|
3
|
+
import { SalesDeliveryType } from './deliveries.js';
|
|
3
4
|
import { BaseEvent } from './internal-events.js';
|
|
4
5
|
import { Opportunity, VehicleSaleDealStatus, VehicleSaleLogisticsStatus } from './opportunities.js';
|
|
5
|
-
import {
|
|
6
|
+
import { Quote } from './quotes.js';
|
|
6
7
|
import { DataRecord } from './utils.js';
|
|
7
8
|
export declare enum VehicleSaleInfoActions {
|
|
8
9
|
VIEW_COSTS = "canSeeCosts",
|
|
@@ -28,7 +29,7 @@ export type VehicleSaleInfoBff = {
|
|
|
28
29
|
client?: Organization;
|
|
29
30
|
delivery?: {
|
|
30
31
|
address?: LocationValue;
|
|
31
|
-
type:
|
|
32
|
+
type: SalesDeliveryType['type'];
|
|
32
33
|
};
|
|
33
34
|
};
|
|
34
35
|
type BaseExternalVehicleSale = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vehicle-sales.d.ts","sourceRoot":"/","sources":["types/vehicle-sales.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AACpG,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"vehicle-sales.d.ts","sourceRoot":"/","sources":["types/vehicle-sales.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE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,MAAM,MAAM,wBAAwB,GAAG,SAAS,GAC9C,CACI,8BAA8B,GAC9B,8BAA8B,GAC9B,8BAA8B,CACjC,CAAC;AAEJ,KAAK,4BAA4B,GAAG;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG,4BAA4B,GAAG;IAC1E,MAAM,EAAE,QAAQ,CAAC;IACjB,IAAI,EAAE,mBAAmB,CAAC;IAC1B,YAAY,CAAC,EAAE,SAAS,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG,4BAA4B,GAAG;IAC1E,MAAM,EAAE,QAAQ,CAAC;IACjB,IAAI,EAAE,mBAAmB,CAAC;IAC1B,YAAY,EAAE,mBAAmB,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG,4BAA4B,GAAG;IAC1E,MAAM,EAAE,QAAQ,CAAC;IACjB,IAAI,EAAE,SAAS,CAAC;IAChB,YAAY,CAAC,EAAE,mBAAmB,CAAC;CACpC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vehicle-sales.js","sourceRoot":"/","sources":["types/vehicle-sales.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vehicle-sales.js","sourceRoot":"/","sources":["types/vehicle-sales.ts"],"names":[],"mappings":"AAQA,MAAM,CAAN,IAAY,sBAGX;AAHD,WAAY,sBAAsB;IAChC,oDAA0B,CAAA;IAC1B,0DAAgC,CAAA;AAClC,CAAC,EAHW,sBAAsB,KAAtB,sBAAsB,QAGjC","sourcesContent":["import { LocationValue } from '@bisondesk/commons-sdk/locations';\nimport { Organization } from './crm.js';\nimport { SalesDeliveryType } from './deliveries.js';\nimport { BaseEvent } from './internal-events.js';\nimport { Opportunity, VehicleSaleDealStatus, VehicleSaleLogisticsStatus } from './opportunities.js';\nimport { Quote } from './quotes.js';\nimport { DataRecord } from './utils.js';\n\nexport enum VehicleSaleInfoActions {\n VIEW_COSTS = 'canSeeCosts',\n VIEW_CUSTOMER = 'canSeeCustomer',\n}\n\nexport type VehicleSaleInfo = {\n externalSaleId?: string;\n opportunityId?: string;\n sold: true;\n soldAt?: string;\n soldBy?: string;\n sellers: string[];\n dealStatus: VehicleSaleDealStatus;\n logisticStatus: VehicleSaleLogisticsStatus;\n};\n\nexport type VehicleSaleInfoBff = {\n info: DataRecord<VehicleSaleInfo>;\n opportunitySale?: {\n opportunity: Opportunity;\n activeQuote: Quote;\n };\n externalSale?: ExternalVehicleSale;\n client?: Organization;\n delivery?: {\n address?: LocationValue;\n type: SalesDeliveryType['type'];\n };\n};\n\ntype BaseExternalVehicleSale = {\n log?: {\n deliveredDate?: string;\n deliveredReporter?: string;\n saleAgreedDate?: string;\n saleAgreedReporter?: string;\n firstPaymentReceivedDate?: string;\n firstPaymentReceivedReporter?: string;\n fullPaymentReceivedDate?: string;\n fullPaymentReceivedReporter?: string;\n deletedDate?: string;\n deletedReporter?: string;\n };\n source: 'HDMS' | 'Hexon' | 'Bisondesk';\n deleted?: boolean;\n status: VehicleSaleDealStatus;\n vehicleId: string;\n saleAmount?: number;\n totalRevenue?: number;\n vatPercentage?: number;\n logisticsStatus: VehicleSaleLogisticsStatus;\n saleAmountTaxable?: number;\n organizationSummary?: {\n contactId: string;\n organizationId: string;\n };\n deal?: {\n internalTransportCost?: number;\n externalTransportCost?: number;\n internalGarageCost?: number;\n externalGarageCost?: number;\n carwashCost?: number;\n spoilerMountingCost?: number;\n loadStackCost?: number;\n otherCosts?: number;\n };\n};\n\nexport type ExternalVehicleSale = BaseExternalVehicleSale & {\n id: string;\n createdAt: string;\n createdBy: string;\n};\n\nexport type NewExternalVehicleSale = BaseExternalVehicleSale;\n\nexport type ExternalVehicleSaleEvent = BaseEvent &\n (\n | ExternalVehicleSaleCreateEvent\n | ExternalVehicleSaleUpdateEvent\n | ExternalVehicleSaleDeleteEvent\n );\n\ntype BaseExternalVehicleSaleEvent = {\n actionAt: string;\n userId: string;\n tenantId: string;\n};\n\nexport type ExternalVehicleSaleCreateEvent = BaseExternalVehicleSaleEvent & {\n action: 'create';\n data: ExternalVehicleSale;\n previousData?: undefined;\n};\n\nexport type ExternalVehicleSaleUpdateEvent = BaseExternalVehicleSaleEvent & {\n action: 'update';\n data: ExternalVehicleSale;\n previousData: ExternalVehicleSale;\n};\n\nexport type ExternalVehicleSaleDeleteEvent = BaseExternalVehicleSaleEvent & {\n action: 'delete';\n data: undefined;\n previousData?: ExternalVehicleSale;\n};\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { AddressDeliveryType, PurchaseDeliveryType, PurchaseDeliveryTypes, SalesDeliveryType, SalesDeliveryTypes } from '../types/deliveries.js';
|
|
2
|
+
export declare const isAddressDelivery: (delivery?: PurchaseDeliveryType | SalesDeliveryType) => delivery is AddressDeliveryType<PurchaseDeliveryTypes.ADDRESS | SalesDeliveryTypes.ADDRESS>;
|
|
3
|
+
//# sourceMappingURL=deliveries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deliveries.d.ts","sourceRoot":"/","sources":["utils/deliveries.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,wBAAwB,CAAC;AAGhC,eAAO,MAAM,iBAAiB,cACjB,oBAAoB,GAAG,iBAAiB,KAClD,QAAQ,IAAI,mBAAmB,CAAC,qBAAqB,CAAC,OAAO,GAAG,kBAAkB,CAAC,OAAO,CACM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deliveries.js","sourceRoot":"/","sources":["utils/deliveries.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,qBAAqB,EAErB,kBAAkB,GACnB,MAAM,wBAAwB,CAAC;AAGhC,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,QAAmD,EAC0C,EAAE,CAC/F,QAAQ,EAAE,IAAI,KAAK,qBAAqB,CAAC,OAAO,IAAI,QAAQ,EAAE,IAAI,KAAK,kBAAkB,CAAC,OAAO,CAAC","sourcesContent":["import {\n AddressDeliveryType,\n PurchaseDeliveryType,\n PurchaseDeliveryTypes,\n SalesDeliveryType,\n SalesDeliveryTypes,\n} from '../types/deliveries.js';\n\n/** Purchase collection and sales delivery share the same stored address fields. */\nexport const isAddressDelivery = (\n delivery?: PurchaseDeliveryType | SalesDeliveryType,\n): delivery is AddressDeliveryType<PurchaseDeliveryTypes.ADDRESS | SalesDeliveryTypes.ADDRESS> =>\n delivery?.type === PurchaseDeliveryTypes.ADDRESS || delivery?.type === SalesDeliveryTypes.ADDRESS;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deliveries.test.d.ts","sourceRoot":"/","sources":["utils/deliveries.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { DeliveryTypes } from '@bisondesk/core-sdk/types/quotes';
|
|
2
|
+
import { expectTypeOf } from 'vitest';
|
|
3
|
+
import { PurchaseDeliveryTypes, SalesDeliveryTypes, } from '../types/deliveries.js';
|
|
4
|
+
import { isAddressDelivery } from './deliveries.js';
|
|
5
|
+
test('purchase and sales contracts keep supplier drop-off and customer pick-up separate', () => {
|
|
6
|
+
expectTypeOf().not.toMatchTypeOf();
|
|
7
|
+
expectTypeOf().not.toMatchTypeOf();
|
|
8
|
+
expectTypeOf().toMatchTypeOf();
|
|
9
|
+
expectTypeOf().toMatchTypeOf();
|
|
10
|
+
});
|
|
11
|
+
test('the previous quote export keeps its four sales methods', () => {
|
|
12
|
+
expect(DeliveryTypes).toEqual(SalesDeliveryTypes);
|
|
13
|
+
expect(Object.values(DeliveryTypes)).toEqual(['park', 'address', 'port', 'portAndShip']);
|
|
14
|
+
});
|
|
15
|
+
test.each([
|
|
16
|
+
SalesDeliveryTypes.ADDRESS,
|
|
17
|
+
PurchaseDeliveryTypes.ADDRESS,
|
|
18
|
+
])('reads the address fields for %s', (type) => {
|
|
19
|
+
const delivery = {
|
|
20
|
+
type,
|
|
21
|
+
address: { country: 'be', city: 'Gent' },
|
|
22
|
+
distanceKm: '100',
|
|
23
|
+
agreedPrice: '0',
|
|
24
|
+
technicalControlNeeded: false,
|
|
25
|
+
};
|
|
26
|
+
expect(isAddressDelivery(delivery)).toBe(true);
|
|
27
|
+
});
|
|
28
|
+
test('a supplier drop-off has no collection address', () => {
|
|
29
|
+
expect(isAddressDelivery({
|
|
30
|
+
type: PurchaseDeliveryTypes.DROP_OFF,
|
|
31
|
+
agreedPrice: '0',
|
|
32
|
+
})).toBe(false);
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=deliveries.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deliveries.test.js","sourceRoot":"/","sources":["utils/deliveries.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAKL,qBAAqB,EAErB,kBAAkB,GACnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD,IAAI,CAAC,mFAAmF,EAAE,GAAG,EAAE;IAC7F,YAAY,EAAuB,CAAC,GAAG,CAAC,aAAa,EAAqB,CAAC;IAC3E,YAAY,EAAsB,CAAC,GAAG,CAAC,aAAa,EAAwB,CAAC;IAC7E,YAAY,EAAuB,CAAC,aAAa,EAAwB,CAAC;IAC1E,YAAY,EAET,CAAC,aAAa,EAAwB,CAAC;AAC5C,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,wDAAwD,EAAE,GAAG,EAAE;IAClE,MAAM,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAClD,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC;AAC3F,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,IAAI,CAAC;IACR,kBAAkB,CAAC,OAAO;IAC1B,qBAAqB,CAAC,OAAO;CACrB,CAAC,CAAC,iCAAiC,EAAE,CAAC,IAAI,EAAE,EAAE;IACtD,MAAM,QAAQ,GACZ;QACE,IAAI;QACJ,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE;QACxC,UAAU,EAAE,KAAK;QACjB,WAAW,EAAE,GAAG;QAChB,sBAAsB,EAAE,KAAK;KAC9B,CAAC;IACJ,MAAM,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjD,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,+CAA+C,EAAE,GAAG,EAAE;IACzD,MAAM,CACJ,iBAAiB,CAAC;QAChB,IAAI,EAAE,qBAAqB,CAAC,QAAQ;QACpC,WAAW,EAAE,GAAG;KACjB,CAAC,CACH,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAChB,CAAC,CAAC,CAAC","sourcesContent":["import { DeliveryTypes } from '@bisondesk/core-sdk/types/quotes';\nimport { expectTypeOf } from 'vitest';\nimport {\n AddressDeliveryType,\n DropOffDeliveryType,\n PickUpDeliveryType,\n PurchaseDeliveryType,\n PurchaseDeliveryTypes,\n SalesDeliveryType,\n SalesDeliveryTypes,\n} from '../types/deliveries.js';\nimport { isAddressDelivery } from './deliveries.js';\n\ntest('purchase and sales contracts keep supplier drop-off and customer pick-up separate', () => {\n expectTypeOf<DropOffDeliveryType>().not.toMatchTypeOf<SalesDeliveryType>();\n expectTypeOf<PickUpDeliveryType>().not.toMatchTypeOf<PurchaseDeliveryType>();\n expectTypeOf<AddressDeliveryType>().toMatchTypeOf<PurchaseDeliveryType>();\n expectTypeOf<\n AddressDeliveryType<PurchaseDeliveryTypes.ADDRESS>\n >().toMatchTypeOf<PurchaseDeliveryType>();\n});\n\ntest('the previous quote export keeps its four sales methods', () => {\n expect(DeliveryTypes).toEqual(SalesDeliveryTypes);\n expect(Object.values(DeliveryTypes)).toEqual(['park', 'address', 'port', 'portAndShip']);\n});\n\ntest.each([\n SalesDeliveryTypes.ADDRESS,\n PurchaseDeliveryTypes.ADDRESS,\n] as const)('reads the address fields for %s', (type) => {\n const delivery: AddressDeliveryType<SalesDeliveryTypes.ADDRESS | PurchaseDeliveryTypes.ADDRESS> =\n {\n type,\n address: { country: 'be', city: 'Gent' },\n distanceKm: '100',\n agreedPrice: '0',\n technicalControlNeeded: false,\n };\n expect(isAddressDelivery(delivery)).toBe(true);\n});\n\ntest('a supplier drop-off has no collection address', () => {\n expect(\n isAddressDelivery({\n type: PurchaseDeliveryTypes.DROP_OFF,\n agreedPrice: '0',\n }),\n ).toBe(false);\n});\n"]}
|
package/lib/utils/leasing.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { ConditionsRef, LeasingContract, LeasingContractClient, OpportunityRef }
|
|
|
3
3
|
import { CustomLeasingQuoteExtraInput, LeasingItemsPaymentSplit } from '../types/leasing-settings.js';
|
|
4
4
|
export declare const sortContractClients: (clients: LeasingContractClient[]) => LeasingContractClient[];
|
|
5
5
|
export declare const getDealRef: ({ conditions, opportunities, }: Pick<LeasingContract, 'conditions' | 'opportunities'>) => ConditionsRef | OpportunityRef;
|
|
6
|
+
export declare const getDealRefAsOf: ({ conditions, opportunities }: Pick<LeasingContract, 'conditions' | 'opportunities'>, asOfDate: string) => ConditionsRef | OpportunityRef;
|
|
6
7
|
export declare const getItemClientPercentage: (value: LeasingItemsPaymentSplit) => Decimal;
|
|
7
8
|
export declare const getLeasingExtrasTotal: (extras: CustomLeasingQuoteExtraInput[]) => Decimal;
|
|
8
9
|
//# sourceMappingURL=leasing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"leasing.d.ts","sourceRoot":"/","sources":["utils/leasing.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,OAAO,EACL,aAAa,EACb,eAAe,EACf,qBAAqB,EACrB,cAAc,EACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,4BAA4B,EAC5B,wBAAwB,EACzB,MAAM,8BAA8B,CAAC;AAGtC,eAAO,MAAM,mBAAmB,YAAa,qBAAqB,EAAE,KAAG,qBAAqB,EAQzF,CAAC;AAEJ,eAAO,MAAM,UAAU,mCAGpB,IAAI,CAAC,eAAe,EAAE,YAAY,GAAG,eAAe,CAAC,KAAG,aAAa,GAAG,cACjC,CAAC;
|
|
1
|
+
{"version":3,"file":"leasing.d.ts","sourceRoot":"/","sources":["utils/leasing.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,OAAO,EACL,aAAa,EACb,eAAe,EACf,qBAAqB,EACrB,cAAc,EACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,4BAA4B,EAC5B,wBAAwB,EACzB,MAAM,8BAA8B,CAAC;AAGtC,eAAO,MAAM,mBAAmB,YAAa,qBAAqB,EAAE,KAAG,qBAAqB,EAQzF,CAAC;AAEJ,eAAO,MAAM,UAAU,mCAGpB,IAAI,CAAC,eAAe,EAAE,YAAY,GAAG,eAAe,CAAC,KAAG,aAAa,GAAG,cACjC,CAAC;AAc3C,eAAO,MAAM,cAAc,kCACM,IAAI,CAAC,eAAe,EAAE,YAAY,GAAG,eAAe,CAAC,YAC1E,MAAM,KACf,aAAa,GAAG,cAIlB,CAAC;AAEF,eAAO,MAAM,uBAAuB,UAAW,wBAAwB,KAAG,OAUzE,CAAC;AAEF,eAAO,MAAM,qBAAqB,WAAY,4BAA4B,EAAE,YAc3E,CAAC"}
|
package/lib/utils/leasing.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { UTCDate } from '@date-fns/utc';
|
|
2
2
|
import { format } from 'date-fns';
|
|
3
3
|
import { Decimal } from 'decimal.js';
|
|
4
|
-
import { last, map, sortBy, uniqBy } from 'lodash-es';
|
|
4
|
+
import { first, last, map, sortBy, uniqBy } from 'lodash-es';
|
|
5
5
|
import { LeasingItemsPaymentSplit, } from '../types/leasing-settings.js';
|
|
6
6
|
export const sortContractClients = (clients) => sortBy(map(uniqBy(clients, (c) => c.takeoverId), (c) => ({ ...c, since: format(new UTCDate(c.since), 'yyyy-MM-dd') })), (cli) => cli.since, (cli) => (cli.takeoverId ? parseInt(cli.takeoverId.replace(/[^0-9]/g, '')) : 0));
|
|
7
7
|
export const getDealRef = ({ conditions, opportunities, }) => last(conditions) ?? last(opportunities);
|
|
8
|
+
const refEffectiveFrom = (ref) => 'validSince' in ref ? ref.validSince : ref.createdAt;
|
|
9
|
+
export const getDealRefAsOf = ({ conditions, opportunities }, asOfDate) => {
|
|
10
|
+
const refs = conditions ?? opportunities ?? [];
|
|
11
|
+
const inForce = refs.filter((ref) => refEffectiveFrom(ref).slice(0, 10) <= asOfDate.slice(0, 10));
|
|
12
|
+
return last(inForce) ?? first(refs) ?? last(refs);
|
|
13
|
+
};
|
|
8
14
|
export const getItemClientPercentage = (value) => {
|
|
9
15
|
switch (value) {
|
|
10
16
|
case LeasingItemsPaymentSplit.Company:
|