@bisondesk/website-commons-sdk 1.0.43 → 1.0.45

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.
@@ -0,0 +1,207 @@
1
+ import { z } from 'zod';
2
+ declare const ComparableSpecVersion: z.ZodObject<{
3
+ make: z.ZodString;
4
+ models: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
5
+ }, "strip", z.ZodTypeAny, {
6
+ make: string;
7
+ models?: string[] | undefined;
8
+ }, {
9
+ make: string;
10
+ models?: string[] | undefined;
11
+ }>;
12
+ export type ComparableSpecVersion = z.infer<typeof ComparableSpecVersion>;
13
+ declare const ComparableSpecRange: z.ZodObject<{
14
+ min: z.ZodOptional<z.ZodNumber>;
15
+ max: z.ZodOptional<z.ZodNumber>;
16
+ }, "strip", z.ZodTypeAny, {
17
+ min?: number | undefined;
18
+ max?: number | undefined;
19
+ }, {
20
+ min?: number | undefined;
21
+ max?: number | undefined;
22
+ }>;
23
+ export type ComparableSpecRange = z.infer<typeof ComparableSpecRange>;
24
+ declare const ComparableSpecs: z.ZodObject<z.objectUtil.extendShape<{
25
+ adr: z.ZodOptional<z.ZodBoolean>;
26
+ axleConfigurations: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
27
+ bodystyle: z.ZodOptional<z.ZodString>;
28
+ cabins: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
29
+ category: z.ZodString;
30
+ crane: z.ZodOptional<z.ZodBoolean>;
31
+ damaged: z.ZodOptional<z.ZodBoolean>;
32
+ euronorms: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
33
+ extended: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
34
+ heightened: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
35
+ horsepower: z.ZodOptional<z.ZodObject<{
36
+ min: z.ZodOptional<z.ZodNumber>;
37
+ max: z.ZodOptional<z.ZodNumber>;
38
+ }, "strip", z.ZodTypeAny, {
39
+ min?: number | undefined;
40
+ max?: number | undefined;
41
+ }, {
42
+ min?: number | undefined;
43
+ max?: number | undefined;
44
+ }>>;
45
+ kilometers: z.ZodOptional<z.ZodObject<{
46
+ min: z.ZodOptional<z.ZodNumber>;
47
+ max: z.ZodOptional<z.ZodNumber>;
48
+ }, "strip", z.ZodTypeAny, {
49
+ min?: number | undefined;
50
+ max?: number | undefined;
51
+ }, {
52
+ min?: number | undefined;
53
+ max?: number | undefined;
54
+ }>>;
55
+ leasing: z.ZodOptional<z.ZodBoolean>;
56
+ lowDeck: z.ZodOptional<z.ZodBoolean>;
57
+ price: z.ZodOptional<z.ZodObject<{
58
+ min: z.ZodOptional<z.ZodNumber>;
59
+ max: z.ZodOptional<z.ZodNumber>;
60
+ }, "strip", z.ZodTypeAny, {
61
+ min?: number | undefined;
62
+ max?: number | undefined;
63
+ }, {
64
+ min?: number | undefined;
65
+ max?: number | undefined;
66
+ }>>;
67
+ year: z.ZodOptional<z.ZodObject<{
68
+ min: z.ZodOptional<z.ZodNumber>;
69
+ max: z.ZodOptional<z.ZodNumber>;
70
+ }, "strip", z.ZodTypeAny, {
71
+ min?: number | undefined;
72
+ max?: number | undefined;
73
+ }, {
74
+ min?: number | undefined;
75
+ max?: number | undefined;
76
+ }>>;
77
+ retarderIntarder: z.ZodOptional<z.ZodBoolean>;
78
+ suspensions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
79
+ tailgate: z.ZodOptional<z.ZodBoolean>;
80
+ transmissions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
81
+ used: z.ZodOptional<z.ZodBoolean>;
82
+ versions: z.ZodOptional<z.ZodArray<z.ZodObject<{
83
+ make: z.ZodString;
84
+ models: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
85
+ }, "strip", z.ZodTypeAny, {
86
+ make: string;
87
+ models?: string[] | undefined;
88
+ }, {
89
+ make: string;
90
+ models?: string[] | undefined;
91
+ }>, "many">>;
92
+ }, {
93
+ id: z.ZodString;
94
+ createdAt: z.ZodString;
95
+ createdBy: z.ZodString;
96
+ modifiedAt: z.ZodString;
97
+ modifiedBy: z.ZodString;
98
+ autoGenerated: z.ZodOptional<z.ZodBoolean>;
99
+ }>, "strip", z.ZodTypeAny, {
100
+ category: string;
101
+ id: string;
102
+ createdAt: string;
103
+ createdBy: string;
104
+ modifiedAt: string;
105
+ modifiedBy: string;
106
+ adr?: boolean | undefined;
107
+ axleConfigurations?: string[] | undefined;
108
+ bodystyle?: string | undefined;
109
+ cabins?: string[] | undefined;
110
+ crane?: boolean | undefined;
111
+ damaged?: boolean | undefined;
112
+ euronorms?: string[] | undefined;
113
+ extended?: string[] | undefined;
114
+ heightened?: string[] | undefined;
115
+ horsepower?: {
116
+ min?: number | undefined;
117
+ max?: number | undefined;
118
+ } | undefined;
119
+ kilometers?: {
120
+ min?: number | undefined;
121
+ max?: number | undefined;
122
+ } | undefined;
123
+ leasing?: boolean | undefined;
124
+ lowDeck?: boolean | undefined;
125
+ price?: {
126
+ min?: number | undefined;
127
+ max?: number | undefined;
128
+ } | undefined;
129
+ year?: {
130
+ min?: number | undefined;
131
+ max?: number | undefined;
132
+ } | undefined;
133
+ retarderIntarder?: boolean | undefined;
134
+ suspensions?: string[] | undefined;
135
+ tailgate?: boolean | undefined;
136
+ transmissions?: string[] | undefined;
137
+ used?: boolean | undefined;
138
+ versions?: {
139
+ make: string;
140
+ models?: string[] | undefined;
141
+ }[] | undefined;
142
+ autoGenerated?: boolean | undefined;
143
+ }, {
144
+ category: string;
145
+ id: string;
146
+ createdAt: string;
147
+ createdBy: string;
148
+ modifiedAt: string;
149
+ modifiedBy: string;
150
+ adr?: boolean | undefined;
151
+ axleConfigurations?: string[] | undefined;
152
+ bodystyle?: string | undefined;
153
+ cabins?: string[] | undefined;
154
+ crane?: boolean | undefined;
155
+ damaged?: boolean | undefined;
156
+ euronorms?: string[] | undefined;
157
+ extended?: string[] | undefined;
158
+ heightened?: string[] | undefined;
159
+ horsepower?: {
160
+ min?: number | undefined;
161
+ max?: number | undefined;
162
+ } | undefined;
163
+ kilometers?: {
164
+ min?: number | undefined;
165
+ max?: number | undefined;
166
+ } | undefined;
167
+ leasing?: boolean | undefined;
168
+ lowDeck?: boolean | undefined;
169
+ price?: {
170
+ min?: number | undefined;
171
+ max?: number | undefined;
172
+ } | undefined;
173
+ year?: {
174
+ min?: number | undefined;
175
+ max?: number | undefined;
176
+ } | undefined;
177
+ retarderIntarder?: boolean | undefined;
178
+ suspensions?: string[] | undefined;
179
+ tailgate?: boolean | undefined;
180
+ transmissions?: string[] | undefined;
181
+ used?: boolean | undefined;
182
+ versions?: {
183
+ make: string;
184
+ models?: string[] | undefined;
185
+ }[] | undefined;
186
+ autoGenerated?: boolean | undefined;
187
+ }>;
188
+ export type ComparableSpecs = z.infer<typeof ComparableSpecs>;
189
+ export declare const SimilarVehiclesRequest: z.ZodObject<{
190
+ excludeVehicleIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
191
+ limit: z.ZodNumber;
192
+ nextToken: z.ZodOptional<z.ZodString>;
193
+ }, "strip", z.ZodTypeAny, {
194
+ limit: number;
195
+ excludeVehicleIds?: string[] | undefined;
196
+ nextToken?: string | undefined;
197
+ }, {
198
+ limit: number;
199
+ excludeVehicleIds?: string[] | undefined;
200
+ nextToken?: string | undefined;
201
+ }>;
202
+ export type SimilarVehiclesRequest = z.infer<typeof SimilarVehiclesRequest>;
203
+ export type InsightsVehicleComparableResponse = {
204
+ comparable: ComparableSpecs;
205
+ };
206
+ export {};
207
+ //# sourceMappingURL=comparables.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"comparables.d.ts","sourceRoot":"/","sources":["types/comparables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,QAAA,MAAM,qBAAqB;;;;;;;;;EAGzB,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE1E,QAAA,MAAM,mBAAmB;;;;;;;;;EAGvB,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AA6BtE,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQnB,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D,eAAO,MAAM,sBAAsB;;;;;;;;;;;;EAIjC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE5E,MAAM,MAAM,iCAAiC,GAAG;IAC9C,UAAU,EAAE,eAAe,CAAC;CAC7B,CAAC"}
@@ -0,0 +1,47 @@
1
+ import { z } from 'zod';
2
+ const ComparableSpecVersion = z.object({
3
+ make: z.string(),
4
+ models: z.array(z.string()).optional(),
5
+ });
6
+ const ComparableSpecRange = z.object({
7
+ min: z.number().optional(),
8
+ max: z.number().optional(),
9
+ });
10
+ const BaseComparableSpecs = z.object({
11
+ adr: z.boolean().optional(),
12
+ axleConfigurations: z.array(z.string()).optional(),
13
+ bodystyle: z.string().optional(),
14
+ cabins: z.array(z.string()).optional(),
15
+ category: z.string(),
16
+ crane: z.boolean().optional(),
17
+ damaged: z.boolean().optional(),
18
+ euronorms: z.array(z.string()).optional(),
19
+ extended: z.array(z.string()).optional(),
20
+ heightened: z.array(z.string()).optional(),
21
+ horsepower: ComparableSpecRange.optional(),
22
+ kilometers: ComparableSpecRange.optional(),
23
+ leasing: z.boolean().optional(),
24
+ lowDeck: z.boolean().optional(),
25
+ price: ComparableSpecRange.optional(),
26
+ year: ComparableSpecRange.optional(),
27
+ retarderIntarder: z.boolean().optional(),
28
+ suspensions: z.array(z.string()).optional(),
29
+ tailgate: z.boolean().optional(),
30
+ transmissions: z.array(z.string()).optional(),
31
+ used: z.boolean().optional(),
32
+ versions: z.array(ComparableSpecVersion).optional(),
33
+ });
34
+ const ComparableSpecs = BaseComparableSpecs.extend({
35
+ id: z.string(),
36
+ createdAt: z.string(),
37
+ createdBy: z.string(),
38
+ modifiedAt: z.string(),
39
+ modifiedBy: z.string(),
40
+ autoGenerated: z.boolean().optional(),
41
+ });
42
+ export const SimilarVehiclesRequest = z.object({
43
+ excludeVehicleIds: z.array(z.string()).optional(),
44
+ limit: z.number().min(1),
45
+ nextToken: z.string().optional(),
46
+ });
47
+ //# sourceMappingURL=comparables.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"comparables.js","sourceRoot":"/","sources":["types/comparables.ts"],"names":[],"mappings":"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","sourcesContent":["import { z } from 'zod';\n\nconst ComparableSpecVersion = z.object({\n make: z.string(),\n models: z.array(z.string()).optional(),\n});\n\nexport type ComparableSpecVersion = z.infer<typeof ComparableSpecVersion>;\n\nconst ComparableSpecRange = z.object({\n min: z.number().optional(),\n max: z.number().optional(),\n});\n\nexport type ComparableSpecRange = z.infer<typeof ComparableSpecRange>;\n\nconst BaseComparableSpecs = z.object({\n adr: z.boolean().optional(),\n axleConfigurations: z.array(z.string()).optional(),\n bodystyle: z.string().optional(),\n cabins: z.array(z.string()).optional(),\n category: z.string(),\n crane: z.boolean().optional(),\n damaged: z.boolean().optional(),\n euronorms: z.array(z.string()).optional(),\n extended: z.array(z.string()).optional(),\n heightened: z.array(z.string()).optional(),\n horsepower: ComparableSpecRange.optional(),\n kilometers: ComparableSpecRange.optional(),\n leasing: z.boolean().optional(), // only if manually enabled\n lowDeck: z.boolean().optional(),\n price: ComparableSpecRange.optional(),\n year: ComparableSpecRange.optional(),\n retarderIntarder: z.boolean().optional(),\n suspensions: z.array(z.string()).optional(),\n tailgate: z.boolean().optional(),\n transmissions: z.array(z.string()).optional(),\n used: z.boolean().optional(),\n versions: z.array(ComparableSpecVersion).optional(),\n});\n\ntype BaseComparableSpecs = z.infer<typeof BaseComparableSpecs>;\n\nconst ComparableSpecs = BaseComparableSpecs.extend({\n id: z.string(),\n createdAt: z.string(),\n createdBy: z.string(),\n modifiedAt: z.string(),\n modifiedBy: z.string(),\n\n autoGenerated: z.boolean().optional(),\n});\n\nexport type ComparableSpecs = z.infer<typeof ComparableSpecs>;\n\nexport const SimilarVehiclesRequest = z.object({\n excludeVehicleIds: z.array(z.string()).optional(),\n limit: z.number().min(1),\n nextToken: z.string().optional(),\n});\n\nexport type SimilarVehiclesRequest = z.infer<typeof SimilarVehiclesRequest>;\n\nexport type InsightsVehicleComparableResponse = {\n comparable: ComparableSpecs;\n};\n"]}
@@ -1,15 +1,41 @@
1
+ import { z } from 'zod';
1
2
  import { WebsiteVehicle } from './vehicle.js';
2
- export type WebsiteEvent = {
3
- action: 'delete';
3
+ export declare const WebsiteEvent: z.ZodDiscriminatedUnion<"action", [z.ZodObject<{
4
+ action: z.ZodLiteral<"delete">;
5
+ vehicleId: z.ZodString;
6
+ vehicle: z.ZodOptional<z.ZodUndefined>;
7
+ tenantId: z.ZodString;
8
+ stockNumber: z.ZodString;
9
+ }, "strip", z.ZodTypeAny, {
10
+ action: "delete";
4
11
  vehicleId: string;
12
+ tenantId: string;
13
+ stockNumber: string;
5
14
  vehicle?: undefined;
15
+ }, {
16
+ action: "delete";
17
+ vehicleId: string;
6
18
  tenantId: string;
7
19
  stockNumber: string;
8
- } | {
9
- action: 'upsert';
20
+ vehicle?: undefined;
21
+ }>, z.ZodObject<{
22
+ action: z.ZodLiteral<"upsert">;
23
+ vehicleId: z.ZodString;
24
+ tenantId: z.ZodString;
25
+ vehicle: z.ZodType<WebsiteVehicle, z.ZodTypeDef, WebsiteVehicle>;
26
+ stockNumber: z.ZodString;
27
+ }, "strip", z.ZodTypeAny, {
28
+ action: "upsert";
10
29
  vehicleId: string;
30
+ vehicle: WebsiteVehicle;
11
31
  tenantId: string;
32
+ stockNumber: string;
33
+ }, {
34
+ action: "upsert";
35
+ vehicleId: string;
12
36
  vehicle: WebsiteVehicle;
37
+ tenantId: string;
13
38
  stockNumber: string;
14
- };
39
+ }>]>;
40
+ export type WebsiteEvent = z.infer<typeof WebsiteEvent>;
15
41
  //# sourceMappingURL=events.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"/","sources":["types/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,MAAM,YAAY,GACpB;IACE,MAAM,EAAE,QAAQ,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB,GACD;IACE,MAAM,EAAE,QAAQ,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,cAAc,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC"}
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"/","sources":["types/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAiBvB,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC"}
@@ -1,2 +1,18 @@
1
- export {};
1
+ import { z } from 'zod';
2
+ export const WebsiteEvent = z.discriminatedUnion('action', [
3
+ z.object({
4
+ action: z.literal('delete'),
5
+ vehicleId: z.string(),
6
+ vehicle: z.undefined().optional(),
7
+ tenantId: z.string(),
8
+ stockNumber: z.string(),
9
+ }),
10
+ z.object({
11
+ action: z.literal('upsert'),
12
+ vehicleId: z.string(),
13
+ tenantId: z.string(),
14
+ vehicle: z.custom((val) => typeof val === 'object' && val !== null),
15
+ stockNumber: z.string(),
16
+ }),
17
+ ]);
2
18
  //# sourceMappingURL=events.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"events.js","sourceRoot":"/","sources":["types/events.ts"],"names":[],"mappings":"","sourcesContent":["import { WebsiteVehicle } from './vehicle.js';\n\nexport type WebsiteEvent =\n | {\n action: 'delete';\n vehicleId: string;\n vehicle?: undefined;\n tenantId: string;\n stockNumber: string;\n }\n | {\n action: 'upsert';\n vehicleId: string;\n tenantId: string;\n vehicle: WebsiteVehicle;\n stockNumber: string;\n };\n"]}
1
+ {"version":3,"file":"events.js","sourceRoot":"/","sources":["types/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,kBAAkB,CAAC,QAAQ,EAAE;IACzD,CAAC,CAAC,MAAM,CAAC;QACP,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;QAC3B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;QACrB,OAAO,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC,QAAQ,EAAE;QACjC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;QACpB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;KACxB,CAAC;IACF,CAAC,CAAC,MAAM,CAAC;QACP,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;QAC3B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;QACrB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;QACpB,OAAO,EAAE,CAAC,CAAC,MAAM,CACf,CAAC,GAAG,EAAyB,EAAE,CAAC,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,CACxE;QACD,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;KACxB,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\nimport { WebsiteVehicle } from './vehicle.js';\n\nexport const WebsiteEvent = z.discriminatedUnion('action', [\n z.object({\n action: z.literal('delete'),\n vehicleId: z.string(),\n vehicle: z.undefined().optional(),\n tenantId: z.string(),\n stockNumber: z.string(),\n }),\n z.object({\n action: z.literal('upsert'),\n vehicleId: z.string(),\n tenantId: z.string(),\n vehicle: z.custom<WebsiteVehicle>(\n (val): val is WebsiteVehicle => typeof val === 'object' && val !== null\n ),\n stockNumber: z.string(),\n }),\n]);\n\nexport type WebsiteEvent = z.infer<typeof WebsiteEvent>;\n"]}
@@ -4,8 +4,9 @@ export declare enum MarketingChannel {
4
4
  Sms = "sms",
5
5
  Phone = "phone"
6
6
  }
7
- export type NextList<T> = {
7
+ export type NextList<T, M = {}> = {
8
8
  results: T[];
9
+ meta?: M;
9
10
  nextToken?: string;
10
11
  totalCount?: number;
11
12
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["types/index.ts"],"names":[],"mappings":"AAAA,oBAAY,gBAAgB;IAC1B,KAAK,UAAU;IACf,QAAQ,aAAa;IACrB,GAAG,QAAQ;IACX,KAAK,UAAU;CAChB;AAED,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI;IACxB,OAAO,EAAE,CAAC,EAAE,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["types/index.ts"],"names":[],"mappings":"AAAA,oBAAY,gBAAgB;IAC1B,KAAK,UAAU;IACf,QAAQ,aAAa;IACrB,GAAG,QAAQ;IACX,KAAK,UAAU;CAChB;AAED,MAAM,MAAM,QAAQ,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI;IAChC,OAAO,EAAE,CAAC,EAAE,CAAC;IACb,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["types/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,mCAAe,CAAA;IACf,yCAAqB,CAAA;IACrB,+BAAW,CAAA;IACX,mCAAe,CAAA;AACjB,CAAC,EALW,gBAAgB,KAAhB,gBAAgB,QAK3B","sourcesContent":["export enum MarketingChannel {\n Email = 'email',\n Whatsapp = 'whatsapp',\n Sms = 'sms',\n Phone = 'phone',\n}\n\nexport type NextList<T> = {\n results: T[];\n nextToken?: string;\n totalCount?: number;\n};\n\nexport type PaginatedRequest = {\n limit?: number;\n offset?: number;\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["types/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,mCAAe,CAAA;IACf,yCAAqB,CAAA;IACrB,+BAAW,CAAA;IACX,mCAAe,CAAA;AACjB,CAAC,EALW,gBAAgB,KAAhB,gBAAgB,QAK3B","sourcesContent":["export enum MarketingChannel {\n Email = 'email',\n Whatsapp = 'whatsapp',\n Sms = 'sms',\n Phone = 'phone',\n}\n\nexport type NextList<T, M = {}> = {\n results: T[];\n meta?: M;\n nextToken?: string;\n totalCount?: number;\n};\n\nexport type PaginatedRequest = {\n limit?: number;\n offset?: number;\n};\n"]}
@@ -0,0 +1,39 @@
1
+ import { WebsiteLeasingContract, WebsiteLeasingContractStatus } from '@bisondesk/websites-sdk/types/contracts';
2
+ import { WebsiteFinanceDocument } from '@bisondesk/websites-sdk/types/documents';
3
+ import { z } from 'zod';
4
+ import { WebsiteVehicle } from './vehicle.js';
5
+ export type LeasingContractBFF = {
6
+ contract: WebsiteLeasingContract;
7
+ vehicle: WebsiteVehicle | undefined | WebsiteLeasingContract['vehicle'];
8
+ };
9
+ export declare const ListLeasingContractsQueryParams: z.ZodObject<z.objectUtil.extendShape<{
10
+ limit: z.ZodNumber;
11
+ offset: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
12
+ }, {
13
+ status: z.ZodOptional<z.ZodNativeEnum<typeof WebsiteLeasingContractStatus>>;
14
+ overdue: z.ZodOptional<z.ZodBoolean>;
15
+ }>, "strip", z.ZodTypeAny, {
16
+ limit: number;
17
+ offset: number;
18
+ status?: WebsiteLeasingContractStatus | undefined;
19
+ overdue?: boolean | undefined;
20
+ }, {
21
+ limit: number;
22
+ status?: WebsiteLeasingContractStatus | undefined;
23
+ offset?: number | undefined;
24
+ overdue?: boolean | undefined;
25
+ }>;
26
+ export type ListLeasingContractsQueryParams = z.input<typeof ListLeasingContractsQueryParams>;
27
+ export type { WebsiteFinanceDocument };
28
+ export declare const ListFinanceDocumentsQueryParams: z.ZodObject<{
29
+ limit: z.ZodNumber;
30
+ offset: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
31
+ }, "strip", z.ZodTypeAny, {
32
+ limit: number;
33
+ offset: number;
34
+ }, {
35
+ limit: number;
36
+ offset?: number | undefined;
37
+ }>;
38
+ export type ListFinanceDocumentsQueryParams = z.input<typeof ListFinanceDocumentsQueryParams>;
39
+ //# sourceMappingURL=leasing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"leasing.d.ts","sourceRoot":"/","sources":["types/leasing.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,4BAA4B,EAC7B,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,sBAAsB,CAAC;IACjC,OAAO,EAAE,cAAc,GAAG,SAAS,GAAG,sBAAsB,CAAC,SAAS,CAAC,CAAC;CACzE,CAAC;AAOF,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;EAG1C,CAAC;AAEH,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AAE9F,YAAY,EAAE,sBAAsB,EAAE,CAAC;AAEvC,eAAO,MAAM,+BAA+B;;;;;;;;;EAAmB,CAAC;AAEhE,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { WebsiteLeasingContractStatus, } from '@bisondesk/websites-sdk/types/contracts';
2
+ import { z } from 'zod';
3
+ const paginationSchema = z.object({
4
+ limit: z.number().int().nonnegative(),
5
+ offset: z.number().int().nonnegative().optional().default(0),
6
+ });
7
+ export const ListLeasingContractsQueryParams = paginationSchema.extend({
8
+ status: z.nativeEnum(WebsiteLeasingContractStatus).optional(),
9
+ overdue: z.boolean().optional(),
10
+ });
11
+ export const ListFinanceDocumentsQueryParams = paginationSchema;
12
+ //# sourceMappingURL=leasing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"leasing.js","sourceRoot":"/","sources":["types/leasing.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,4BAA4B,GAC7B,MAAM,yCAAyC,CAAC;AAEjD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IACrC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;CAC7D,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,+BAA+B,GAAG,gBAAgB,CAAC,MAAM,CAAC;IACrE,MAAM,EAAE,CAAC,CAAC,UAAU,CAAC,4BAA4B,CAAC,CAAC,QAAQ,EAAE;IAC7D,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CAChC,CAAC,CAAC;AAMH,MAAM,CAAC,MAAM,+BAA+B,GAAG,gBAAgB,CAAC","sourcesContent":["import {\n WebsiteLeasingContract,\n WebsiteLeasingContractStatus,\n} from '@bisondesk/websites-sdk/types/contracts';\nimport { WebsiteFinanceDocument } from '@bisondesk/websites-sdk/types/documents';\nimport { z } from 'zod';\nimport { WebsiteVehicle } from './vehicle.js';\n\nexport type LeasingContractBFF = {\n contract: WebsiteLeasingContract;\n vehicle: WebsiteVehicle | undefined | WebsiteLeasingContract['vehicle'];\n};\n\nconst paginationSchema = z.object({\n limit: z.number().int().nonnegative(),\n offset: z.number().int().nonnegative().optional().default(0),\n});\n\nexport const ListLeasingContractsQueryParams = paginationSchema.extend({\n status: z.nativeEnum(WebsiteLeasingContractStatus).optional(),\n overdue: z.boolean().optional(),\n});\n\nexport type ListLeasingContractsQueryParams = z.input<typeof ListLeasingContractsQueryParams>;\n\nexport type { WebsiteFinanceDocument };\n\nexport const ListFinanceDocumentsQueryParams = paginationSchema;\n\nexport type ListFinanceDocumentsQueryParams = z.input<typeof ListFinanceDocumentsQueryParams>;\n"]}
@@ -13,24 +13,24 @@ export declare const UserSearch: z.ZodObject<z.objectUtil.extendShape<{
13
13
  createdBy: z.ZodString;
14
14
  createdAt: z.ZodString;
15
15
  }>, "strict", z.ZodTypeAny, {
16
+ id: string;
17
+ createdAt: string;
18
+ createdBy: string;
16
19
  filters: Record<string, unknown>;
17
20
  queryString: string;
18
21
  resultCount: number;
19
- id: string;
20
- createdBy: string;
21
- createdAt: string;
22
22
  language?: string | undefined;
23
23
  sessionId?: string | undefined;
24
24
  countryCode?: string | undefined;
25
25
  browserLocale?: string | undefined;
26
26
  origin?: string | undefined;
27
27
  }, {
28
+ id: string;
29
+ createdAt: string;
30
+ createdBy: string;
28
31
  filters: Record<string, unknown>;
29
32
  queryString: string;
30
33
  resultCount: number;
31
- id: string;
32
- createdBy: string;
33
- createdAt: string;
34
34
  language?: string | undefined;
35
35
  sessionId?: string | undefined;
36
36
  countryCode?: string | undefined;
@@ -8,11 +8,45 @@ export declare enum FleetSize {
8
8
  Medium = "2-5",
9
9
  Large = "6+"
10
10
  }
11
- export declare const VatSchema: z.ZodString;
11
+ export declare const VatSchema: z.ZodEffects<z.ZodString, string | undefined, string>;
12
12
  export declare const isValidVatForCountry: ({ vat, country, }: {
13
13
  vat: string;
14
14
  country: string;
15
15
  }) => boolean;
16
+ export declare const CompanySchema: z.ZodObject<{
17
+ country: z.ZodOptional<z.ZodString>;
18
+ city: z.ZodOptional<z.ZodString>;
19
+ name: z.ZodOptional<z.ZodString>;
20
+ vat: z.ZodOptional<z.ZodEffects<z.ZodString, string | undefined, string>>;
21
+ postalCode: z.ZodOptional<z.ZodString>;
22
+ }, "strip", z.ZodTypeAny, {
23
+ country?: string | undefined;
24
+ vat?: string | undefined;
25
+ city?: string | undefined;
26
+ name?: string | undefined;
27
+ postalCode?: string | undefined;
28
+ }, {
29
+ country?: string | undefined;
30
+ vat?: string | undefined;
31
+ city?: string | undefined;
32
+ name?: string | undefined;
33
+ postalCode?: string | undefined;
34
+ }>;
35
+ export declare function refineCompanySchema(schema: z.ZodRawShape): z.ZodEffects<z.ZodObject<z.objectUtil.extendShape<{
36
+ country: z.ZodOptional<z.ZodString>;
37
+ city: z.ZodOptional<z.ZodString>;
38
+ name: z.ZodOptional<z.ZodString>;
39
+ vat: z.ZodOptional<z.ZodEffects<z.ZodString, string | undefined, string>>;
40
+ postalCode: z.ZodOptional<z.ZodString>;
41
+ }, z.ZodRawShape>, "strip", z.ZodTypeAny, {
42
+ [x: string]: any;
43
+ }, {
44
+ [x: string]: any;
45
+ }>, {
46
+ [x: string]: any;
47
+ }, {
48
+ [x: string]: any;
49
+ }>;
16
50
  export declare const UserDetails: z.ZodObject<{
17
51
  firstName: z.ZodOptional<z.ZodString>;
18
52
  lastName: z.ZodOptional<z.ZodString>;
@@ -21,46 +55,26 @@ export declare const UserDetails: z.ZodObject<{
21
55
  fleetSize: z.ZodOptional<z.ZodNativeEnum<typeof FleetSize>>;
22
56
  trader: z.ZodOptional<z.ZodBoolean>;
23
57
  email: z.ZodString;
24
- company: z.ZodEffects<z.ZodObject<{
58
+ company: z.ZodEffects<z.ZodObject<z.objectUtil.extendShape<{
25
59
  country: z.ZodOptional<z.ZodString>;
26
60
  city: z.ZodOptional<z.ZodString>;
27
61
  name: z.ZodOptional<z.ZodString>;
28
- vat: z.ZodOptional<z.ZodString>;
62
+ vat: z.ZodOptional<z.ZodEffects<z.ZodString, string | undefined, string>>;
29
63
  postalCode: z.ZodOptional<z.ZodString>;
30
- }, "strip", z.ZodTypeAny, {
31
- country?: string | undefined;
32
- vat?: string | undefined;
33
- city?: string | undefined;
34
- name?: string | undefined;
35
- postalCode?: string | undefined;
64
+ }, z.ZodRawShape>, "strip", z.ZodTypeAny, {
65
+ [x: string]: any;
36
66
  }, {
37
- country?: string | undefined;
38
- vat?: string | undefined;
39
- city?: string | undefined;
40
- name?: string | undefined;
41
- postalCode?: string | undefined;
67
+ [x: string]: any;
42
68
  }>, {
43
- country?: string | undefined;
44
- vat?: string | undefined;
45
- city?: string | undefined;
46
- name?: string | undefined;
47
- postalCode?: string | undefined;
69
+ [x: string]: any;
48
70
  }, {
49
- country?: string | undefined;
50
- vat?: string | undefined;
51
- city?: string | undefined;
52
- name?: string | undefined;
53
- postalCode?: string | undefined;
71
+ [x: string]: any;
54
72
  }>;
55
73
  marketingChannels: z.ZodArray<z.ZodNativeEnum<typeof MarketingChannel>, "many">;
56
74
  }, "strip", z.ZodTypeAny, {
57
75
  email: string;
58
76
  company: {
59
- country?: string | undefined;
60
- vat?: string | undefined;
61
- city?: string | undefined;
62
- name?: string | undefined;
63
- postalCode?: string | undefined;
77
+ [x: string]: any;
64
78
  };
65
79
  marketingChannels: MarketingChannel[];
66
80
  phone?: string | undefined;
@@ -72,11 +86,7 @@ export declare const UserDetails: z.ZodObject<{
72
86
  }, {
73
87
  email: string;
74
88
  company: {
75
- country?: string | undefined;
76
- vat?: string | undefined;
77
- city?: string | undefined;
78
- name?: string | undefined;
79
- postalCode?: string | undefined;
89
+ [x: string]: any;
80
90
  };
81
91
  marketingChannels: MarketingChannel[];
82
92
  phone?: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"user.d.ts","sourceRoot":"/","sources":["types/user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,oBAAY,SAAS;IACnB,KAAK,MAAM;IACX,MAAM,QAAQ;IACd,KAAK,OAAO;CACb;AAED,eAAO,MAAM,SAAS,aAA2B,CAAC;AAiDlD,eAAO,MAAM,oBAAoB,GAAI,mBAGlC;IACD,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;CACjB,KAAG,OAMH,CAAC;AAWF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmCtB,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC"}
1
+ {"version":3,"file":"user.d.ts","sourceRoot":"/","sources":["types/user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,oBAAY,SAAS;IACnB,KAAK,MAAM;IACX,MAAM,QAAQ;IACd,KAAK,OAAO;CACb;AAED,eAAO,MAAM,SAAS,uDAGa,CAAC;AAiDpC,eAAO,MAAM,oBAAoB,GAAI,mBAGlC;IACD,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;CACjB,KAAG,OAMH,CAAC;AAWF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;EAMxB,CAAC;AAMH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,CAAC,CAAC,WAAW;;;;;;;;;;;;;;GAcxD;AAED,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUtB,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC"}
package/lib/types/user.js CHANGED
@@ -6,7 +6,10 @@ export var FleetSize;
6
6
  FleetSize["Medium"] = "2-5";
7
7
  FleetSize["Large"] = "6+";
8
8
  })(FleetSize || (FleetSize = {}));
9
- export const VatSchema = z.string().toUpperCase();
9
+ export const VatSchema = z
10
+ .string()
11
+ .toUpperCase()
12
+ .transform((v) => v || undefined);
10
13
  const VAT_PATTERNS = {
11
14
  AT: /^AT.+/,
12
15
  BE: /^BE.+/,
@@ -55,23 +58,15 @@ const getVatPrefix = (country) => {
55
58
  const match = pattern.toString().match(/\^(\w+)/);
56
59
  return match ? match[1] : '';
57
60
  };
58
- export const UserDetails = z.object({
59
- firstName: z.string().optional(),
60
- lastName: z.string().optional(),
61
- phone: z.string().optional(),
62
- preferredLanguage: z.string().optional(),
63
- fleetSize: z.nativeEnum(FleetSize).optional(),
64
- trader: z.boolean().optional(),
65
- email: z.string().email().toLowerCase(),
66
- company: z
67
- .object({
68
- country: z.string().optional(),
69
- city: z.string().optional(),
70
- name: z.string().optional(),
71
- vat: VatSchema.optional(),
72
- postalCode: z.string().optional(),
73
- })
74
- .superRefine((data, ctx) => {
61
+ export const CompanySchema = z.object({
62
+ country: z.string().optional(),
63
+ city: z.string().optional(),
64
+ name: z.string().optional(),
65
+ vat: VatSchema.optional(),
66
+ postalCode: z.string().optional(),
67
+ });
68
+ export function refineCompanySchema(schema) {
69
+ return CompanySchema.extend(schema).superRefine((data, ctx) => {
75
70
  if (!data.vat || !data.country) {
76
71
  return;
77
72
  }
@@ -83,7 +78,17 @@ export const UserDetails = z.object({
83
78
  params: { prefix, messageKey: 'vat.invalidFormat' },
84
79
  });
85
80
  }
86
- }),
81
+ });
82
+ }
83
+ export const UserDetails = z.object({
84
+ firstName: z.string().optional(),
85
+ lastName: z.string().optional(),
86
+ phone: z.string().optional(),
87
+ preferredLanguage: z.string().optional(),
88
+ fleetSize: z.nativeEnum(FleetSize).optional(),
89
+ trader: z.boolean().optional(),
90
+ email: z.string().email().toLowerCase(),
91
+ company: refineCompanySchema({}),
87
92
  marketingChannels: z.array(z.nativeEnum(MarketingChannel)),
88
93
  });
89
94
  //# sourceMappingURL=user.js.map