@bisondesk/core-sdk 1.0.21 → 1.0.23-B

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.
Files changed (225) hide show
  1. package/lib/apis/crm.d.ts +39 -0
  2. package/lib/apis/crm.d.ts.map +1 -0
  3. package/lib/apis/crm.js +201 -0
  4. package/lib/apis/crm.js.map +1 -0
  5. package/lib/apis/documents.d.ts +4 -0
  6. package/lib/apis/documents.d.ts.map +1 -0
  7. package/lib/apis/documents.js +47 -0
  8. package/lib/apis/documents.js.map +1 -0
  9. package/lib/apis/internet-vehicles.d.ts +3 -0
  10. package/lib/apis/internet-vehicles.d.ts.map +1 -0
  11. package/lib/apis/internet-vehicles.js +27 -0
  12. package/lib/apis/internet-vehicles.js.map +1 -0
  13. package/lib/apis/leasing-administration.d.ts +8 -0
  14. package/lib/apis/leasing-administration.d.ts.map +1 -0
  15. package/lib/apis/leasing-administration.js +49 -0
  16. package/lib/apis/leasing-administration.js.map +1 -0
  17. package/lib/apis/leasing.d.ts +19 -0
  18. package/lib/apis/leasing.d.ts.map +1 -0
  19. package/lib/apis/leasing.js +168 -0
  20. package/lib/apis/leasing.js.map +1 -0
  21. package/lib/apis/opportunities.d.ts +9 -0
  22. package/lib/apis/opportunities.d.ts.map +1 -0
  23. package/lib/apis/opportunities.js +94 -0
  24. package/lib/apis/opportunities.js.map +1 -0
  25. package/lib/apis/picklists.d.ts +5 -0
  26. package/lib/apis/picklists.d.ts.map +1 -0
  27. package/lib/apis/picklists.js +44 -0
  28. package/lib/apis/picklists.js.map +1 -0
  29. package/lib/apis/tenants.d.ts +7 -0
  30. package/lib/apis/tenants.d.ts.map +1 -0
  31. package/lib/apis/tenants.js +80 -0
  32. package/lib/apis/tenants.js.map +1 -0
  33. package/lib/apis/users.d.ts +3 -0
  34. package/lib/apis/users.d.ts.map +1 -0
  35. package/lib/apis/users.js +26 -0
  36. package/lib/apis/users.js.map +1 -0
  37. package/lib/apis/utils.d.ts +9 -0
  38. package/lib/apis/utils.d.ts.map +1 -0
  39. package/lib/apis/utils.js +23 -0
  40. package/lib/apis/utils.js.map +1 -0
  41. package/lib/apis/vehicles.d.ts +18 -0
  42. package/lib/apis/vehicles.d.ts.map +1 -0
  43. package/lib/apis/vehicles.js +159 -0
  44. package/lib/apis/vehicles.js.map +1 -0
  45. package/lib/constants.d.ts +77 -0
  46. package/lib/constants.d.ts.map +1 -1
  47. package/lib/constants.js +924 -1
  48. package/lib/constants.js.map +1 -1
  49. package/lib/ddb-entities.d.ts +2 -0
  50. package/lib/ddb-entities.d.ts.map +1 -0
  51. package/lib/ddb-entities.js +5 -0
  52. package/lib/ddb-entities.js.map +1 -0
  53. package/lib/types/activities.d.ts +38 -0
  54. package/lib/types/activities.d.ts.map +1 -0
  55. package/lib/types/activities.js +16 -0
  56. package/lib/types/activities.js.map +1 -0
  57. package/lib/types/crm.d.ts +103 -30
  58. package/lib/types/crm.d.ts.map +1 -1
  59. package/lib/types/crm.js +16 -0
  60. package/lib/types/crm.js.map +1 -1
  61. package/lib/types/definitions.d.ts +15 -13
  62. package/lib/types/definitions.d.ts.map +1 -1
  63. package/lib/types/documents.d.ts +105 -0
  64. package/lib/types/documents.d.ts.map +1 -0
  65. package/lib/types/{interests.js → documents.js} +1 -1
  66. package/lib/types/documents.js.map +1 -0
  67. package/lib/types/fields.d.ts +26 -25
  68. package/lib/types/fields.d.ts.map +1 -1
  69. package/lib/types/fields.js +4 -0
  70. package/lib/types/fields.js.map +1 -1
  71. package/lib/types/internet-vehicles.d.ts +64 -0
  72. package/lib/types/internet-vehicles.d.ts.map +1 -0
  73. package/lib/types/internet-vehicles.js +3 -0
  74. package/lib/types/internet-vehicles.js.map +1 -0
  75. package/lib/types/leads.d.ts +134 -0
  76. package/lib/types/leads.d.ts.map +1 -0
  77. package/lib/types/leads.js +3 -0
  78. package/lib/types/leads.js.map +1 -0
  79. package/lib/types/leasing-administration.d.ts +107 -0
  80. package/lib/types/leasing-administration.d.ts.map +1 -0
  81. package/lib/types/leasing-administration.js +3 -0
  82. package/lib/types/leasing-administration.js.map +1 -0
  83. package/lib/types/leasing-search.d.ts +22 -0
  84. package/lib/types/leasing-search.d.ts.map +1 -0
  85. package/lib/types/leasing-search.js +3 -0
  86. package/lib/types/leasing-search.js.map +1 -0
  87. package/lib/types/leasing-settings.d.ts +113 -0
  88. package/lib/types/leasing-settings.d.ts.map +1 -0
  89. package/lib/types/leasing-settings.js +10 -0
  90. package/lib/types/leasing-settings.js.map +1 -0
  91. package/lib/types/leasing.d.ts +322 -0
  92. package/lib/types/leasing.d.ts.map +1 -0
  93. package/lib/types/leasing.js +24 -0
  94. package/lib/types/leasing.js.map +1 -0
  95. package/lib/types/machines.d.ts +38 -0
  96. package/lib/types/machines.d.ts.map +1 -0
  97. package/lib/types/machines.js +3 -0
  98. package/lib/types/machines.js.map +1 -0
  99. package/lib/types/opportunities.d.ts +448 -0
  100. package/lib/types/opportunities.d.ts.map +1 -0
  101. package/lib/types/opportunities.js +68 -0
  102. package/lib/types/opportunities.js.map +1 -0
  103. package/lib/types/payments.d.ts +38 -0
  104. package/lib/types/payments.d.ts.map +1 -0
  105. package/lib/types/payments.js +9 -0
  106. package/lib/types/payments.js.map +1 -0
  107. package/lib/types/picklists.d.ts +15 -4
  108. package/lib/types/picklists.d.ts.map +1 -1
  109. package/lib/types/quotes.d.ts +173 -0
  110. package/lib/types/quotes.d.ts.map +1 -0
  111. package/lib/types/quotes.js +26 -0
  112. package/lib/types/quotes.js.map +1 -0
  113. package/lib/types/recently-viewed.d.ts +33 -0
  114. package/lib/types/recently-viewed.d.ts.map +1 -0
  115. package/lib/types/recently-viewed.js +3 -0
  116. package/lib/types/recently-viewed.js.map +1 -0
  117. package/lib/types/saved-filters.d.ts +20 -0
  118. package/lib/types/saved-filters.d.ts.map +1 -0
  119. package/lib/types/saved-filters.js +3 -0
  120. package/lib/types/saved-filters.js.map +1 -0
  121. package/lib/types/search.d.ts +26 -4
  122. package/lib/types/search.d.ts.map +1 -1
  123. package/lib/types/search.js.map +1 -1
  124. package/lib/types/settings.d.ts +50 -0
  125. package/lib/types/settings.d.ts.map +1 -0
  126. package/lib/types/settings.js +3 -0
  127. package/lib/types/settings.js.map +1 -0
  128. package/lib/types/storage.d.ts +1 -11
  129. package/lib/types/storage.d.ts.map +1 -1
  130. package/lib/types/storage.js +15 -0
  131. package/lib/types/storage.js.map +1 -1
  132. package/lib/types/templates.d.ts +35 -0
  133. package/lib/types/templates.d.ts.map +1 -0
  134. package/lib/types/templates.js +9 -0
  135. package/lib/types/templates.js.map +1 -0
  136. package/lib/types/tenants.d.ts +32 -9
  137. package/lib/types/tenants.d.ts.map +1 -1
  138. package/lib/types/tenants.js +11 -0
  139. package/lib/types/tenants.js.map +1 -1
  140. package/lib/types/users.d.ts +11 -3
  141. package/lib/types/users.d.ts.map +1 -1
  142. package/lib/types/utils.d.ts +20 -0
  143. package/lib/types/utils.d.ts.map +1 -1
  144. package/lib/types/utils.js +6 -0
  145. package/lib/types/utils.js.map +1 -1
  146. package/lib/types/vehicles.d.ts +406 -92
  147. package/lib/types/vehicles.d.ts.map +1 -1
  148. package/lib/types/vehicles.js +54 -1
  149. package/lib/types/vehicles.js.map +1 -1
  150. package/lib/types/website.d.ts +24 -0
  151. package/lib/types/website.d.ts.map +1 -0
  152. package/lib/types/website.js +3 -0
  153. package/lib/types/website.js.map +1 -0
  154. package/lib/utils/forms.d.ts +6 -0
  155. package/lib/utils/forms.d.ts.map +1 -0
  156. package/lib/utils/forms.js +33 -0
  157. package/lib/utils/forms.js.map +1 -0
  158. package/lib/utils/leasing.d.ts +3 -0
  159. package/lib/utils/leasing.d.ts.map +1 -0
  160. package/lib/utils/leasing.js +10 -0
  161. package/lib/utils/leasing.js.map +1 -0
  162. package/lib/utils/slug.d.ts +3 -0
  163. package/lib/utils/slug.d.ts.map +1 -0
  164. package/lib/utils/slug.js +23 -0
  165. package/lib/utils/slug.js.map +1 -0
  166. package/lib/utils/tenants.d.ts +4 -0
  167. package/lib/utils/tenants.d.ts.map +1 -0
  168. package/lib/utils/tenants.js +16 -0
  169. package/lib/utils/tenants.js.map +1 -0
  170. package/lib/utils/vehicles.d.ts +12 -0
  171. package/lib/utils/vehicles.d.ts.map +1 -0
  172. package/lib/utils/vehicles.js +73 -0
  173. package/lib/utils/vehicles.js.map +1 -0
  174. package/package.json +8 -6
  175. package/src/apis/crm.ts +302 -0
  176. package/src/apis/documents.ts +54 -0
  177. package/src/apis/internet-vehicles.ts +23 -0
  178. package/src/apis/leasing-administration.ts +70 -0
  179. package/src/apis/leasing.ts +257 -0
  180. package/src/apis/opportunities.ts +133 -0
  181. package/src/apis/picklists.ts +50 -0
  182. package/src/apis/tenants.ts +100 -0
  183. package/src/apis/users.ts +22 -0
  184. package/src/apis/utils.ts +23 -0
  185. package/src/apis/vehicles.ts +229 -0
  186. package/src/constants.ts +930 -1
  187. package/src/ddb-entities.ts +1 -0
  188. package/src/environment.d.ts +6 -0
  189. package/src/types/activities.ts +41 -0
  190. package/src/types/crm.ts +118 -30
  191. package/src/types/definitions.ts +19 -12
  192. package/src/types/documents.ts +110 -0
  193. package/src/types/fields.ts +72 -31
  194. package/src/types/internet-vehicles.ts +67 -0
  195. package/src/types/leads.ts +144 -0
  196. package/src/types/leasing-administration.ts +131 -0
  197. package/src/types/leasing-search.ts +24 -0
  198. package/src/types/leasing-settings.ts +111 -0
  199. package/src/types/leasing.ts +360 -0
  200. package/src/types/machines.ts +40 -0
  201. package/src/types/opportunities.ts +496 -0
  202. package/src/types/payments.ts +40 -0
  203. package/src/types/picklists.ts +26 -7
  204. package/src/types/quotes.ts +186 -0
  205. package/src/types/recently-viewed.ts +45 -0
  206. package/src/types/saved-filters.ts +21 -0
  207. package/src/types/search.ts +34 -4
  208. package/src/types/settings.ts +51 -0
  209. package/src/types/storage.ts +1 -12
  210. package/src/types/templates.ts +40 -0
  211. package/src/types/tenants.ts +37 -11
  212. package/src/types/users.ts +17 -3
  213. package/src/types/utils.ts +25 -0
  214. package/src/types/vehicles.ts +461 -93
  215. package/src/types/website.ts +28 -0
  216. package/src/utils/forms.ts +32 -0
  217. package/src/utils/leasing.ts +14 -0
  218. package/src/utils/slug.ts +19 -0
  219. package/src/utils/tenants.ts +14 -0
  220. package/src/utils/vehicles.ts +92 -0
  221. package/tsconfig.tsbuildinfo +1 -2995
  222. package/lib/types/interests.d.ts +0 -23
  223. package/lib/types/interests.d.ts.map +0 -1
  224. package/lib/types/interests.js.map +0 -1
  225. package/src/types/interests.ts +0 -20
@@ -0,0 +1 @@
1
+ export const ITEM_VIEWS_KEY = 'views';
@@ -0,0 +1,6 @@
1
+ declare namespace NodeJS {
2
+ interface ProcessEnv {
3
+ ADMIN_KEY: string;
4
+ CORE_API_ORIGIN: string;
5
+ }
6
+ }
@@ -0,0 +1,41 @@
1
+ export enum ActivityType {
2
+ CALL = 'call',
3
+ MEETING = 'meeting',
4
+ EMAIL = 'email',
5
+ CHAT = 'chat',
6
+ }
7
+
8
+ export enum ActivityActions {
9
+ DELETE = 'delete',
10
+ EDIT = 'edit',
11
+ }
12
+
13
+ type BaseActivity = {
14
+ type: ActivityType;
15
+ opportunityId: string;
16
+ description?: string;
17
+ };
18
+
19
+ export type NewActivity = BaseActivity & {
20
+ id?: undefined;
21
+ createdAt?: undefined;
22
+ createdBy?: undefined;
23
+ modifiedAt?: undefined;
24
+ modifiedBy?: undefined;
25
+ activityAt?: string;
26
+ };
27
+
28
+ export type Activity = BaseActivity & {
29
+ id: string;
30
+ createdAt: string;
31
+ createdBy: string;
32
+ modifiedAt: string;
33
+ modifiedBy: string;
34
+ activityAt: string;
35
+ };
36
+
37
+ export type ActivityUpdate = {
38
+ description?: string;
39
+ type?: ActivityType;
40
+ activityAt?: string;
41
+ };
package/src/types/crm.ts CHANGED
@@ -1,53 +1,141 @@
1
- import { PhoneNumberValue } from './fields';
2
- import { Interest } from './interests';
1
+ import {
2
+ LocationValue,
3
+ PhoneNumberRawValue,
4
+ PhoneNumberValue,
5
+ SearchPermissions,
6
+ } from '@bisondesk/commons-sdk/lib/types';
7
+ import { PublicSearchDefinition } from './definitions';
8
+ import { LeasingContract } from './leasing';
9
+ import { ReferenceData } from './utils';
3
10
 
4
- export type Organization = {
11
+ export type CrmEvent = CrmOrganizationEvent | CrmContactEvent;
12
+
13
+ export type CrmContactEvent = {
14
+ contactId: string;
15
+ organizationId?: string;
16
+ action: 'upsert' | 'delete';
17
+ actionAt: string;
18
+ userId: string;
19
+ tenantId: string;
20
+ };
21
+
22
+ export type CrmOrganizationEvent = {
23
+ organizationId: string;
24
+ action: 'upsert' | 'delete';
25
+ actionAt: string;
26
+ userId: string;
27
+ tenantId: string;
28
+ };
29
+
30
+ type BaseOrganization = {
31
+ inUse: boolean;
5
32
  countryCode: string;
6
- createdAt: string;
7
- createdBy: string;
8
- externalId: number;
9
- id: string;
33
+ syncedAt: string;
10
34
  name: string;
11
35
  segment?: string;
12
36
  type?: 'COMPANY' | 'INDIVIDUAL';
13
37
  vatNumber?: string;
38
+ addresses?: {
39
+ legal?: LocationValue;
40
+ transport?: LocationValue;
41
+ };
42
+ accountManagers: string[];
43
+ billingEmails?: string[];
44
+ skipPaymentReminders?: boolean;
45
+ trustworthy?: boolean;
46
+ };
47
+
48
+ export type NewOrganization = BaseOrganization & {
49
+ id?: undefined;
50
+ externalId?: undefined;
51
+ createdAt?: undefined;
52
+ createdBy?: undefined;
53
+ };
54
+
55
+ export type Organization = BaseOrganization & {
56
+ createdAt: string;
57
+ externalId: number;
58
+ createdBy: string;
59
+ id: string;
60
+ debt?: OrganizationDebtInfo;
61
+ blocked?: boolean;
62
+ blockedAt?: string;
63
+ blockedBy?: string;
64
+ blockedReason?: string;
65
+ };
66
+
67
+ export type OrganizationDebtInfo = {
68
+ overdueSince?: string;
69
+ overdueInvoices: number;
70
+ overdueAmount: string;
71
+ unpaidInvoices: number;
72
+ unpaidAmount: string;
14
73
  };
15
74
 
16
75
  export type SearchOrganization = {
17
- org: Partial<Organization>;
76
+ org: Organization;
77
+ contract: LeasingContract[]; // important for the logic regarding leasing overdue reminders
78
+ };
79
+
80
+ export type PotentialDuplicatesReferenceData = ReferenceData & { blockIgnore?: boolean };
81
+
82
+ export type InputSearchOrganization = SearchOrganization & {
83
+ permissions: SearchPermissions;
18
84
  };
19
85
 
20
86
  export type SearchContact = {
21
- org: Partial<Organization>;
22
- contact: Partial<Contact>;
87
+ contact: Contact;
88
+ org?: Organization;
23
89
  };
24
90
 
25
- export type Contact = {
26
- id: string;
27
- organizationId: string;
91
+ export type InputSearchContact = SearchContact & {
92
+ permissions: SearchPermissions;
93
+ };
94
+
95
+ export type CrmPublicSearchDefinitions = {
96
+ searchOrg: PublicSearchDefinition;
97
+ searchContact: PublicSearchDefinition;
98
+ };
99
+
100
+ type BaseContact = {
28
101
  accountManager?: string;
102
+ countryCode?: string;
29
103
  language?: string;
30
- firstName?: string;
31
- lastName: string;
32
- createdAt: string;
33
- createdBy: string;
34
- phones: PhoneNumberValue[];
35
104
  emails: string[];
36
105
  job?: string;
106
+ /** either firstName or lastName should be filled in */
107
+ firstName?: string;
108
+ lastName?: string;
109
+ organizationId?: string;
110
+ /** will not be filled if organizationId is present */
111
+ orgName?: string;
37
112
  };
38
113
 
39
- export type LeadContact = {
40
- accountManager: string;
41
- companyName?: string;
42
- country: string;
43
- email?: string;
44
- language?: string;
45
- name: string;
46
- phone?: PhoneNumberValue;
47
- remarks?: string;
114
+ export type NewContact = BaseContact & {
115
+ id?: undefined;
116
+ createdAt?: undefined;
117
+ createdBy?: undefined;
118
+ phones: Array<PhoneNumberValue | PhoneNumberRawValue>;
48
119
  };
49
120
 
50
- export type Lead = {
51
- contact: LeadContact;
52
- interests: Interest[];
121
+ export type Contact = BaseContact & {
122
+ id: string;
123
+ createdAt: string;
124
+ createdBy: string;
125
+ phones: PhoneNumberValue[];
53
126
  };
127
+
128
+ export enum SaveContactResolution {
129
+ IgnoreDuplicates = 'IGNORE_DUPLICATES',
130
+ BlockDuplicates = 'BLOCK_DUPLICATES',
131
+ }
132
+
133
+ export enum SaveOrgResolution {
134
+ IgnoreDuplicates = 'IGNORE_DUPLICATES',
135
+ BlockDuplicates = 'BLOCK_DUPLICATES',
136
+ }
137
+
138
+ export enum CrmSearchScope {
139
+ Tenant = 'tenant',
140
+ Conglomerate = 'conglomerate',
141
+ }
@@ -5,28 +5,35 @@ import { Aggregation } from './search';
5
5
  // These definitions are sent to the UI
6
6
  //
7
7
  export type PublicSearchDefinition = {
8
- name: string;
9
- fields: { [fieldId: string]: PublicSearchField };
8
+ fields: { [fieldId: string]: SearchField };
9
+ aggs: Aggregation[];
10
10
  };
11
11
 
12
- export type PublicSearchField = {
13
- id: string;
14
- titles: { [lang: string]: string };
15
- agg?: Aggregation;
16
- } & FieldTypeInfo;
17
-
18
12
  //
19
13
  // These definitions are for internal consumption
20
14
  //
21
15
  export type SearchDefinition = {
22
- name: string;
23
16
  fields: { [fieldId: string]: SearchField };
24
17
  };
25
18
 
26
19
  export type SearchField = {
27
20
  id: string;
28
- esMapping: unknown;
29
21
  titles: { [lang: string]: string };
30
- fullText?: boolean | ((lang: string) => string);
31
- agg?: Aggregation;
32
22
  } & FieldTypeInfo;
23
+
24
+ export type EsDefinitionField = {
25
+ esMapping: unknown;
26
+ sortKey?: string;
27
+ };
28
+
29
+ export type EsDefinition = {
30
+ name: string;
31
+ nestedEsPaths: string[];
32
+ fields: {
33
+ [fieldId: string]: EsDefinitionField;
34
+ };
35
+ };
36
+
37
+ export type EsFullTextSearchDefinition = ((lang: string) => string)[];
38
+
39
+ export type EsAggregationsDefinition = Aggregation[];
@@ -0,0 +1,110 @@
1
+ import { AttachmentValue, SearchPermissions } from '@bisondesk/commons-sdk/lib/types';
2
+ import { Organization } from './crm';
3
+ import { PublicSearchDefinition } from './definitions';
4
+
5
+ export type FinanceLine = {
6
+ associations: {
7
+ others: { vehicleId: string; label: string }[];
8
+ sales: { id: string; vehicleId: string; label: string }[];
9
+ purchases: { id: string; vehicleId: string; label: string }[];
10
+ };
11
+ description: string;
12
+ id: string;
13
+ lineCode: string;
14
+ quantity: string;
15
+ unitPriceExclusive: string;
16
+ vatCode: string;
17
+ vatCoefficient: string;
18
+ };
19
+
20
+ export type FinanceDocument = {
21
+ id: string;
22
+ branchId: string;
23
+
24
+ type: 'Sale Finance' | 'Purchase Finance';
25
+ subtype: 'Invoice' | 'Credit Note' | 'Proforma' | 'Purchase Order';
26
+ reference: string;
27
+
28
+ attachment: AttachmentValue;
29
+ lines: FinanceLine[];
30
+ notes?: string;
31
+
32
+ createdAt: string;
33
+ createdBy: string;
34
+ issueDate: string;
35
+
36
+ organizationSummary?: {
37
+ id: string;
38
+ code: string;
39
+ name: string;
40
+ country: string;
41
+ vatNumber?: string;
42
+
43
+ addressLine1?: string;
44
+ addressLine2?: string;
45
+ addressLine3?: string;
46
+ postcode?: string;
47
+ city?: string;
48
+
49
+ email?: string;
50
+ phone?: string;
51
+ fax?: string;
52
+ };
53
+ };
54
+
55
+ export type FinanceDocumentEvent = {
56
+ id: string;
57
+ actionAt: string;
58
+ userId: string;
59
+ tenantId: string;
60
+ type: 'Sale Finance' | 'Purchase Finance';
61
+ subtype: string; // Invoice, Credit Note, etc.
62
+ };
63
+
64
+ export type FinanceBookingEvent = {
65
+ id: string;
66
+ branchId: string;
67
+ actionAt: string;
68
+ userId: string;
69
+ tenantId: string;
70
+ type: 'Sale Finance' | 'Purchase Finance';
71
+ };
72
+
73
+ export type FinanceBooking = {
74
+ branchId: string; // same tenantId can have different companies
75
+ bookingNumber: string; // same booking number can and will exist across different "branches"
76
+ documentId: string;
77
+
78
+ booked: true;
79
+ journal?: string;
80
+ amount?: string;
81
+ reportingPeriod?: number;
82
+ reportingYear?: number;
83
+ paid: boolean;
84
+
85
+ createdAt: string;
86
+ createdBy: string;
87
+ modifiedAt: string;
88
+ modifiedBy: string;
89
+ };
90
+
91
+ export type SearchDocumentVehicleRef = {
92
+ id: string;
93
+ stockNumber: string;
94
+ administrativeNumber?: string;
95
+ };
96
+
97
+ export type SearchFinanceDocument = {
98
+ org?: Organization;
99
+ doc: FinanceDocument;
100
+ booking?: FinanceBooking;
101
+ vehicle?: SearchDocumentVehicleRef[];
102
+ };
103
+
104
+ export type InputSearchFinanceDocument = SearchFinanceDocument & {
105
+ permissions: SearchPermissions;
106
+ };
107
+
108
+ export type DocsSearchDefinitions = {
109
+ searchFinanceDoc: PublicSearchDefinition;
110
+ };
@@ -1,10 +1,12 @@
1
- import { MultiLangValue } from '@bisondesk/commons-sdk/lib/types';
2
-
3
1
  export enum FieldTypes {
2
+ attachment = 'attachment',
4
3
  checkbox = 'checkbox',
4
+ collaborator = 'collaborator',
5
5
  date = 'date',
6
6
  email = 'email',
7
7
  image = 'image',
8
+ link = 'link',
9
+ location = 'location',
8
10
  multilang = 'multilang',
9
11
  multiline = 'multiline',
10
12
  number = 'number',
@@ -24,41 +26,72 @@ export enum DateGranularity {
24
26
  yearMonthDayTime = 'yearMonthDayTime',
25
27
  }
26
28
 
27
- export type PhoneNumberValue = {
28
- country?: string;
29
- e164: string;
30
- international: string;
31
- national: string;
32
- };
33
-
34
- export type PhoneNumberRawValue = {
35
- defaultCountry?: string;
36
- input: string;
37
- };
38
-
39
- export type AttachmentValue = {
40
- contentType: string;
41
- fileName: string;
42
- id: string;
43
- size: number;
44
- uploadedAt: string;
45
- uploadedBy: string;
46
- url: string;
47
- descriptions?: string | MultiLangValue;
48
- };
49
-
50
29
  //
51
30
  // Field metas
52
31
  //
53
32
  type BaseMeta = {};
54
33
 
55
- export type NumberMeta = BaseMeta & {
56
- style?: 'currency' | 'decimal' | 'unit' | 'percent';
34
+ type NumberUnit =
35
+ | 'acre'
36
+ | 'bit'
37
+ | 'byte'
38
+ | 'celsius'
39
+ | 'centimeter'
40
+ | 'day'
41
+ | 'degree'
42
+ | 'fahrenheit'
43
+ | 'fluid-ounce'
44
+ | 'foot'
45
+ | 'gallon'
46
+ | 'gigabit'
47
+ | 'gigabyte'
48
+ | 'gram'
49
+ | 'hectare'
50
+ | 'hour'
51
+ | 'inch'
52
+ | 'kilobit'
53
+ | 'kilobyte'
54
+ | 'kilogram'
55
+ | 'kilometer'
56
+ | 'liter'
57
+ | 'megabit'
58
+ | 'megabyte'
59
+ | 'meter'
60
+ | 'mile'
61
+ | 'mile-scandinavian'
62
+ | 'milliliter'
63
+ | 'millimeter'
64
+ | 'millisecond'
65
+ | 'minute'
66
+ | 'month'
67
+ | 'ounce'
68
+ | 'percent'
69
+ | 'petabyte'
70
+ | 'pound'
71
+ | 'second'
72
+ | 'stone'
73
+ | 'terabit'
74
+ | 'terabyte'
75
+ | 'week'
76
+ | 'yard'
77
+ | 'year';
78
+
79
+ type BaseNumberMeta = {
57
80
  minimumFractionDigits?: number;
58
81
  maximumFractionDigits?: number;
59
- unit?: string; // see full list https://github.com/unicode-org/cldr/blob/master/common/validity/unit.xml
60
82
  useGrouping?: boolean;
61
- };
83
+ } & (
84
+ | {
85
+ style: 'unit';
86
+ unit: NumberUnit;
87
+ }
88
+ | {
89
+ style?: 'currency' | 'decimal' | 'percent';
90
+ unit?: NumberUnit;
91
+ }
92
+ );
93
+
94
+ export type NumberMeta = BaseMeta & BaseNumberMeta;
62
95
 
63
96
  export type DateMeta = BaseMeta & {
64
97
  granularity: DateGranularity;
@@ -68,15 +101,23 @@ export type RatingMeta = BaseMeta & {
68
101
  max: number;
69
102
  };
70
103
 
104
+ export type PicklistMeta = BaseMeta & {
105
+ picklistId: string;
106
+ };
107
+
71
108
  export type FieldTypeInfo =
109
+ | { type: FieldTypes.attachment }
72
110
  | { type: FieldTypes.checkbox }
73
111
  | { type: FieldTypes.date; meta: DateMeta }
74
112
  | { type: FieldTypes.email }
75
113
  | { type: FieldTypes.image }
114
+ | { type: FieldTypes.link }
115
+ | { type: FieldTypes.location }
76
116
  | { type: FieldTypes.multilang }
77
117
  | { type: FieldTypes.multiline }
78
118
  | { type: FieldTypes.number; meta: NumberMeta }
79
119
  | { type: FieldTypes.phoneNumber }
80
- | { type: FieldTypes.picklist }
120
+ | { type: FieldTypes.picklist; meta: PicklistMeta }
81
121
  | { type: FieldTypes.rating; meta: RatingMeta }
82
- | { type: FieldTypes.text };
122
+ | { type: FieldTypes.text }
123
+ | { type: FieldTypes.collaborator };
@@ -0,0 +1,67 @@
1
+ import { LocationValue, PhoneNumberValue } from '@bisondesk/commons-sdk/lib/types';
2
+ import { PublicSearchDefinition } from './definitions';
3
+ import { AggregationRequest } from './search';
4
+ import { Vehicle } from './vehicles';
5
+
6
+ export type InternetVehicleInternalInfo = {
7
+ createdAt: string;
8
+ updatedAt: string;
9
+ description: {
10
+ title: string;
11
+ remarks?: string;
12
+ };
13
+ };
14
+
15
+ export type InternetVehiclePublicSearchDefinitions = {
16
+ searchInternetVehicle: PublicSearchDefinition;
17
+ };
18
+
19
+ export type InternetVehicleSellerType = 'Dealer' | 'Private';
20
+
21
+ export type PriceChange = {
22
+ price: string | undefined;
23
+ priceAt: string;
24
+ };
25
+
26
+ export type InternetVehiclePortal = {
27
+ name: string;
28
+ originalUrl: string;
29
+ pingedAt: string;
30
+ available: boolean;
31
+ };
32
+
33
+ export type InternetVehicleSeller = {
34
+ id: string;
35
+ name?: string;
36
+ address: LocationValue;
37
+ type?: InternetVehicleSellerType;
38
+ gps?: {
39
+ lat: number;
40
+ lon: number;
41
+ };
42
+ phones: PhoneNumberValue[];
43
+ };
44
+
45
+ export type InternetVehicle = Vehicle<InternetVehicleInternalInfo>;
46
+
47
+ export type SearchInternetVehicle = {
48
+ vehicle: InternetVehicle;
49
+ seller: InternetVehicleSeller;
50
+ alternativeIds: string[];
51
+ priceEvolution: PriceChange[];
52
+ portal: InternetVehiclePortal;
53
+ custom: {
54
+ features: string[];
55
+ };
56
+ };
57
+
58
+ export type AnalysisResponse = {
59
+ [sellerId: string]: { x: string; y: number }[];
60
+ all: { x: string; y: number }[];
61
+ };
62
+
63
+ export type AnalysisRequest = AggregationRequest & {
64
+ sellerIds: string[];
65
+ range: '1M' | '3M' | '6M' | '1y';
66
+ granularity: '1w' | '1M';
67
+ };