@bisondesk/core-sdk 1.0.308 → 1.0.310

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 (149) hide show
  1. package/lib/apis/crm.js +198 -0
  2. package/lib/apis/crm.js.map +1 -0
  3. package/lib/apis/documents.js +54 -0
  4. package/lib/apis/documents.js.map +1 -0
  5. package/lib/apis/internet-vehicles.js +24 -0
  6. package/lib/apis/internet-vehicles.js.map +1 -0
  7. package/lib/apis/leasing-administration.js +46 -0
  8. package/lib/apis/leasing-administration.js.map +1 -0
  9. package/lib/apis/leasing.js +166 -0
  10. package/lib/apis/leasing.js.map +1 -0
  11. package/lib/apis/opportunities.js +66 -0
  12. package/lib/apis/opportunities.js.map +1 -0
  13. package/lib/apis/picklists.js +41 -0
  14. package/lib/apis/picklists.js.map +1 -0
  15. package/lib/apis/tenants.js +77 -0
  16. package/lib/apis/tenants.js.map +1 -0
  17. package/lib/apis/users.js +23 -0
  18. package/lib/apis/users.js.map +1 -0
  19. package/lib/apis/vehicles.js +182 -0
  20. package/lib/apis/vehicles.js.map +1 -0
  21. package/lib/cjs/apis/opportunities.js.map +1 -1
  22. package/lib/cjs/types/leasing-settings.js.map +1 -1
  23. package/lib/cjs/types/opportunities.js.map +1 -1
  24. package/lib/cjs/types/payments.js +2 -1
  25. package/lib/cjs/types/payments.js.map +1 -1
  26. package/lib/cjs/types/quote-settings.js +3 -0
  27. package/lib/cjs/types/quote-settings.js.map +1 -0
  28. package/lib/cjs/types/quotes.js.map +1 -1
  29. package/lib/cjs/types/vehicles.js.map +1 -1
  30. package/lib/constants.js +937 -0
  31. package/lib/constants.js.map +1 -0
  32. package/lib/ddb-entities.js +5 -0
  33. package/lib/ddb-entities.js.map +1 -0
  34. package/lib/esm/apis/opportunities.js.map +1 -1
  35. package/lib/esm/types/leasing-settings.js.map +1 -1
  36. package/lib/esm/types/opportunities.js.map +1 -1
  37. package/lib/esm/types/payments.js +1 -0
  38. package/lib/esm/types/payments.js.map +1 -1
  39. package/lib/esm/types/quote-settings.js +2 -0
  40. package/lib/esm/types/quote-settings.js.map +1 -0
  41. package/lib/esm/types/quotes.js.map +1 -1
  42. package/lib/esm/types/vehicles.js.map +1 -1
  43. package/lib/tsconfig.cjs.tsbuildinfo +1 -1
  44. package/lib/tsconfig.esm.tsbuildinfo +1 -1
  45. package/lib/types/activities.js +16 -0
  46. package/lib/types/activities.js.map +1 -0
  47. package/lib/types/apis/opportunities.d.ts +1 -1
  48. package/lib/types/apis/opportunities.d.ts.map +1 -1
  49. package/lib/types/comparables.js +3 -0
  50. package/lib/types/comparables.js.map +1 -0
  51. package/lib/types/crm.js +19 -0
  52. package/lib/types/crm.js.map +1 -0
  53. package/lib/types/definitions.js +3 -0
  54. package/lib/types/definitions.js.map +1 -0
  55. package/lib/types/delivery-settings.js +9 -0
  56. package/lib/types/delivery-settings.js.map +1 -0
  57. package/lib/types/documents.js +9 -0
  58. package/lib/types/documents.js.map +1 -0
  59. package/lib/types/events.js +10 -0
  60. package/lib/types/events.js.map +1 -0
  61. package/lib/types/fields.js +29 -0
  62. package/lib/types/fields.js.map +1 -0
  63. package/lib/types/insights.js +3 -0
  64. package/lib/types/insights.js.map +1 -0
  65. package/lib/types/interests.js +10 -0
  66. package/lib/types/interests.js.map +1 -0
  67. package/lib/types/internet-vehicles.js +3 -0
  68. package/lib/types/internet-vehicles.js.map +1 -0
  69. package/lib/types/leasing-administration.js +3 -0
  70. package/lib/types/leasing-administration.js.map +1 -0
  71. package/lib/types/leasing-debtors.js +3 -0
  72. package/lib/types/leasing-debtors.js.map +1 -0
  73. package/lib/types/leasing-search.js +3 -0
  74. package/lib/types/leasing-search.js.map +1 -0
  75. package/lib/types/leasing-settings.js +10 -0
  76. package/lib/types/leasing-settings.js.map +1 -0
  77. package/lib/types/leasing.js +33 -0
  78. package/lib/types/leasing.js.map +1 -0
  79. package/lib/types/machines.js +3 -0
  80. package/lib/types/machines.js.map +1 -0
  81. package/lib/types/opportunities.js +89 -0
  82. package/lib/types/opportunities.js.map +1 -0
  83. package/lib/types/payments.js +10 -0
  84. package/lib/types/payments.js.map +1 -0
  85. package/lib/types/picklists.js +3 -0
  86. package/lib/types/picklists.js.map +1 -0
  87. package/lib/types/quote-settings.js +3 -0
  88. package/lib/types/quote-settings.js.map +1 -0
  89. package/lib/types/quotes.js +45 -0
  90. package/lib/types/quotes.js.map +1 -0
  91. package/lib/types/recently-viewed.js +3 -0
  92. package/lib/types/recently-viewed.js.map +1 -0
  93. package/lib/types/reservations.js +8 -0
  94. package/lib/types/reservations.js.map +1 -0
  95. package/lib/types/roi-ratings.js +8 -0
  96. package/lib/types/roi-ratings.js.map +1 -0
  97. package/lib/types/saved-filters.js +12 -0
  98. package/lib/types/saved-filters.js.map +1 -0
  99. package/lib/types/search.js +36 -0
  100. package/lib/types/search.js.map +1 -0
  101. package/lib/types/settings.js +3 -0
  102. package/lib/types/settings.js.map +1 -0
  103. package/lib/types/storage.js +4 -0
  104. package/lib/types/storage.js.map +1 -0
  105. package/lib/types/templates.js +3 -0
  106. package/lib/types/templates.js.map +1 -0
  107. package/lib/types/tenants.js +19 -0
  108. package/lib/types/tenants.js.map +1 -0
  109. package/lib/types/types/leasing-settings.d.ts +0 -71
  110. package/lib/types/types/leasing-settings.d.ts.map +1 -1
  111. package/lib/types/types/opportunities.d.ts +2 -0
  112. package/lib/types/types/opportunities.d.ts.map +1 -1
  113. package/lib/types/types/payments.d.ts +1 -0
  114. package/lib/types/types/payments.d.ts.map +1 -1
  115. package/lib/types/types/quote-settings.d.ts +89 -0
  116. package/lib/types/types/quote-settings.d.ts.map +1 -0
  117. package/lib/types/types/quotes.d.ts +8 -14
  118. package/lib/types/types/quotes.d.ts.map +1 -1
  119. package/lib/types/types/vehicles.d.ts +18 -0
  120. package/lib/types/types/vehicles.d.ts.map +1 -1
  121. package/lib/types/users.js +3 -0
  122. package/lib/types/users.js.map +1 -0
  123. package/lib/types/utils.js +9 -0
  124. package/lib/types/utils.js.map +1 -0
  125. package/lib/types/vehicles.js +63 -0
  126. package/lib/types/vehicles.js.map +1 -0
  127. package/lib/types/website.js +3 -0
  128. package/lib/types/website.js.map +1 -0
  129. package/lib/utils/forms.js +30 -0
  130. package/lib/utils/forms.js.map +1 -0
  131. package/lib/utils/leasing.js +8 -0
  132. package/lib/utils/leasing.js.map +1 -0
  133. package/lib/utils/opportunities.js +60 -0
  134. package/lib/utils/opportunities.js.map +1 -0
  135. package/lib/utils/slug.js +20 -0
  136. package/lib/utils/slug.js.map +1 -0
  137. package/lib/utils/tenants.js +21 -0
  138. package/lib/utils/tenants.js.map +1 -0
  139. package/lib/utils/vehicles.js +60 -0
  140. package/lib/utils/vehicles.js.map +1 -0
  141. package/package.json +1 -1
  142. package/src/apis/opportunities.ts +1 -1
  143. package/src/types/leasing-settings.ts +0 -76
  144. package/src/types/opportunities.ts +2 -0
  145. package/src/types/payments.ts +2 -0
  146. package/src/types/quote-settings.ts +93 -0
  147. package/src/types/quotes.ts +7 -16
  148. package/src/types/vehicles.ts +22 -0
  149. package/tsconfig.tsbuildinfo +1 -0
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getQuoteById = exports.getLeasingQuoteParams = exports.createOpportunity = exports.updateOpportunity = exports.getOpportunityBff = void 0;
4
+ const constants_1 = require("@bisondesk/commons-sdk/constants");
5
+ const fetch_1 = require("@bisondesk/commons-sdk/fetch");
6
+ const fetch_2 = require("@bisondesk/commons-sdk/fetch");
7
+ const getOpportunityBff = async (tenantId, opportunityId) => {
8
+ const auth = await (0, fetch_2.getAdminAuth)();
9
+ return (0, fetch_1.fetchJson)(`${process.env.CORE_API_ORIGIN}/api/opportunities/${opportunityId}/bff`, {
10
+ headers: (0, fetch_2.cleanHeaders)({
11
+ Authorization: auth,
12
+ [constants_1.TENANT_ID_ADMIN_HEADER]: tenantId,
13
+ }),
14
+ });
15
+ };
16
+ exports.getOpportunityBff = getOpportunityBff;
17
+ const updateOpportunity = async (tenantId, opportunity, opportunityId) => {
18
+ const auth = await (0, fetch_2.getAdminAuth)();
19
+ return (0, fetch_1.fetchJson)(`${process.env.CORE_API_ORIGIN}/api/opportunities/${opportunityId}`, {
20
+ method: 'PATCH',
21
+ headers: (0, fetch_2.cleanHeaders)({
22
+ Authorization: auth,
23
+ [constants_1.TENANT_ID_ADMIN_HEADER]: tenantId,
24
+ }),
25
+ body: JSON.stringify(opportunity),
26
+ });
27
+ };
28
+ exports.updateOpportunity = updateOpportunity;
29
+ const createOpportunity = async (tenantId, opportunity) => {
30
+ const auth = await (0, fetch_2.getAdminAuth)();
31
+ const response = await (0, fetch_1.fetchJson)(`${process.env.CORE_API_ORIGIN}/api/opportunities`, {
32
+ method: 'POST',
33
+ headers: (0, fetch_2.cleanHeaders)({
34
+ Authorization: auth,
35
+ [constants_1.TENANT_ID_ADMIN_HEADER]: tenantId,
36
+ 'Content-Type': 'application/json',
37
+ }),
38
+ body: JSON.stringify(opportunity),
39
+ });
40
+ if (response == null) {
41
+ throw new Error('Opportunity not created');
42
+ }
43
+ return response;
44
+ };
45
+ exports.createOpportunity = createOpportunity;
46
+ const getLeasingQuoteParams = async (tenantId, settingId) => {
47
+ const auth = await (0, fetch_2.getAdminAuth)();
48
+ return (0, fetch_1.fetchJson)(`${process.env.CORE_API_ORIGIN}/api/leasing/administration/settings/quote-params/${settingId}`, {
49
+ headers: (0, fetch_2.cleanHeaders)({
50
+ Authorization: auth,
51
+ [constants_1.TENANT_ID_ADMIN_HEADER]: tenantId,
52
+ }),
53
+ });
54
+ };
55
+ exports.getLeasingQuoteParams = getLeasingQuoteParams;
56
+ const getQuoteById = async (tenantId, quoteId) => {
57
+ const auth = await (0, fetch_2.getAdminAuth)();
58
+ return (0, fetch_1.fetchJson)(`${process.env.CORE_API_ORIGIN}/api/quotes/${quoteId}`, {
59
+ headers: (0, fetch_2.cleanHeaders)({
60
+ Authorization: auth,
61
+ [constants_1.TENANT_ID_ADMIN_HEADER]: tenantId,
62
+ }),
63
+ });
64
+ };
65
+ exports.getQuoteById = getQuoteById;
66
+ //# sourceMappingURL=opportunities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opportunities.js","sourceRoot":"/","sources":["apis/opportunities.ts"],"names":[],"mappings":";;;AAAA,gEAA0E;AAC1E,wDAAyD;AAEzD,wDAA0E;AAUnE,MAAM,iBAAiB,GAAG,KAAK,EACpC,QAAgB,EAChB,aAAqB,EACgB,EAAE;IACvC,MAAM,IAAI,GAAG,MAAM,IAAA,oBAAY,GAAE,CAAC;IAClC,OAAO,IAAA,iBAAS,EAAC,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,sBAAsB,aAAa,MAAM,EAAE;QACxF,OAAO,EAAE,IAAA,oBAAY,EAAC;YACpB,aAAa,EAAE,IAAI;YACnB,CAAC,kCAAsB,CAAC,EAAE,QAAQ;SACnC,CAAC;KACH,CAAC,CAAC;AACL,CAAC,CAAC;AAXW,QAAA,iBAAiB,qBAW5B;AAEK,MAAM,iBAAiB,GAAG,KAAK,EACpC,QAAgB,EAChB,WAA8B,EAC9B,aAAqB,EACgB,EAAE;IACvC,MAAM,IAAI,GAAG,MAAM,IAAA,oBAAY,GAAE,CAAC;IAClC,OAAO,IAAA,iBAAS,EAAC,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,sBAAsB,aAAa,EAAE,EAAE;QACpF,MAAM,EAAE,OAAO;QACf,OAAO,EAAE,IAAA,oBAAY,EAAC;YACpB,aAAa,EAAE,IAAI;YACnB,CAAC,kCAAsB,CAAC,EAAE,QAAQ;SACnC,CAAC;QACF,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;KAClC,CAAC,CAAC;AACL,CAAC,CAAC;AAdW,QAAA,iBAAiB,qBAc5B;AAEK,MAAM,iBAAiB,GAAG,KAAK,EACpC,QAAgB,EAChB,WAA2B,EACL,EAAE;IACxB,MAAM,IAAI,GAAG,MAAM,IAAA,oBAAY,GAAE,CAAC;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AC,CAAC;AACL,CAAC,CAAC;AAXW,QAAA,YAAY,gBAWvB","sourcesContent":["import { TENANT_ID_ADMIN_HEADER } from '@bisondesk/commons-sdk/constants';\nimport { fetchJson } from '@bisondesk/commons-sdk/fetch';\n\nimport { cleanHeaders, getAdminAuth } from '@bisondesk/commons-sdk/fetch';\nimport {\n NewOpportunity,\n Opportunity,\n OpportunityBFF,\n OpportunityUpdate,\n} from '../types/opportunities';\nimport { LeasingQuoteParams } from '../types/quote-settings';\nimport { Quote } from '../types/quotes';\n\nexport const getOpportunityBff = async (\n tenantId: string,\n opportunityId: string\n): Promise<OpportunityBFF | undefined> => {\n const auth = await getAdminAuth();\n return fetchJson(`${process.env.CORE_API_ORIGIN}/api/opportunities/${opportunityId}/bff`, {\n headers: cleanHeaders({\n Authorization: auth,\n [TENANT_ID_ADMIN_HEADER]: tenantId,\n }),\n });\n};\n\nexport const updateOpportunity = async (\n tenantId: string,\n opportunity: OpportunityUpdate,\n opportunityId: string\n): Promise<OpportunityBFF | undefined> => {\n const auth = await getAdminAuth();\n return fetchJson(`${process.env.CORE_API_ORIGIN}/api/opportunities/${opportunityId}`, {\n method: 'PATCH',\n headers: cleanHeaders({\n Authorization: auth,\n [TENANT_ID_ADMIN_HEADER]: tenantId,\n }),\n body: JSON.stringify(opportunity),\n });\n};\n\nexport const createOpportunity = async (\n tenantId: string,\n opportunity: NewOpportunity\n): Promise<Opportunity> => {\n const auth = await getAdminAuth();\n const response: Opportunity | undefined = await fetchJson(\n `${process.env.CORE_API_ORIGIN}/api/opportunities`,\n {\n method: 'POST',\n headers: cleanHeaders({\n Authorization: auth,\n [TENANT_ID_ADMIN_HEADER]: tenantId,\n 'Content-Type': 'application/json',\n }),\n body: JSON.stringify(opportunity),\n }\n );\n\n if (response == null) {\n throw new Error('Opportunity not created');\n }\n\n return response;\n};\n\nexport const getLeasingQuoteParams = async (\n tenantId: string,\n settingId: string\n): Promise<LeasingQuoteParams | undefined> => {\n const auth = await getAdminAuth();\n return fetchJson(\n `${process.env.CORE_API_ORIGIN}/api/leasing/administration/settings/quote-params/${settingId}`,\n {\n headers: cleanHeaders({\n Authorization: auth,\n [TENANT_ID_ADMIN_HEADER]: tenantId,\n }),\n }\n );\n};\n\n//\n// Quotes\n//\nexport const getQuoteById = async (\n tenantId: string,\n quoteId: string\n): Promise<Quote | undefined> => {\n const auth = await getAdminAuth();\n return fetchJson(`${process.env.CORE_API_ORIGIN}/api/quotes/${quoteId}`, {\n headers: cleanHeaders({\n Authorization: auth,\n [TENANT_ID_ADMIN_HEADER]: tenantId,\n }),\n });\n};\n"]}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPicklistOptions = exports.getMultiplePicklistValues = void 0;
4
+ const errors_1 = require("@bisondesk/commons-sdk/errors");
5
+ const fetch_1 = require("@bisondesk/commons-sdk/fetch");
6
+ const node_fetch_1 = __importDefault(require("node-fetch"));
7
+ const getMultiplePicklistValues = async (request) => {
8
+ const auth = await (0, fetch_1.getAdminAuth)();
9
+ const response = await (0, node_fetch_1.default)(`${process.env.CORE_API_ORIGIN}/api/picklists/bulk/read`, {
10
+ method: 'POST',
11
+ headers: {
12
+ Authorization: auth,
13
+ 'Content-Type': 'application/json',
14
+ },
15
+ body: JSON.stringify(request),
16
+ });
17
+ if (response.ok) {
18
+ return response.json();
19
+ }
20
+ const body = await response.text();
21
+ throw new errors_1.XError(response.statusText, { body });
22
+ };
23
+ exports.getMultiplePicklistValues = getMultiplePicklistValues;
24
+ const getPicklistOptions = async (req) => {
25
+ const auth = await (0, fetch_1.getAdminAuth)();
26
+ const response = await (0, node_fetch_1.default)(`${process.env.CORE_API_ORIGIN}/api/picklists/options`, {
27
+ method: 'POST',
28
+ headers: (0, fetch_1.cleanHeaders)({
29
+ Authorization: auth,
30
+ 'Content-Type': 'application/json',
31
+ }),
32
+ body: JSON.stringify(req),
33
+ });
34
+ if (response.ok) {
35
+ return response.json();
36
+ }
37
+ const body = await response.text();
38
+ throw new errors_1.XError(response.statusText, { body, req });
39
+ };
40
+ exports.getPicklistOptions = getPicklistOptions;
41
+ //# sourceMappingURL=picklists.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"picklists.js","sourceRoot":"/","sources":["apis/picklists.ts"],"names":[],"mappings":";;;AAAA,0DAAuD;AACvD,wDAA0E;AAE1E,4DAA6C;AAOtC,MAAM,yBAAyB,GAAG,KAAK,EAC5C,OAA6B,EACO,EAAE;IACtC,MAAM,IAAI,GAAG,MAAM,IAAA,oBAAY,GAAE,CAAC;IAClC,MAAM,QAAQ,GAAa,MAAM,IAAA,oBAAK,EAAC,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,0BAA0B,EAAE;QAC/F,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,aAAa,EAAE,IAAI;YACnB,cAAc,EAAE,kBAAkB;SACnC;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;KAC9B,CAAC,CAAC;IAEH,IAAI,QAAQ,CAAC,EAAE,EAAE;QACf,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;KACxB;IAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IACnC,MAAM,IAAI,eAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;AAClD,CAAC,CAAC;AAnBW,QAAA,yBAAyB,6BAmBpC;AAEK,MAAM,kBAAkB,GAAG,KAAK,EAAE,GAA2B,EAAqB,EAAE;IACzF,MAAM,IAAI,GAAG,MAAM,IAAA,oBAAY,GAAE,CAAC;IAElC,MAAM,QAAQ,GAAa,MAAM,IAAA,oBAAK,EAAC,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,wBAAwB,EAAE;QAC7F,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,IAAA,oBAAY,EAAC;YACpB,aAAa,EAAE,IAAI;YACnB,cAAc,EAAE,kBAAkB;SACnC,CAAC;QACF,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC;KAC1B,CAAC,CAAC;IAEH,IAAI,QAAQ,CAAC,EAAE,EAAE;QACf,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;KACxB;IAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IACnC,MAAM,IAAI,eAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;AACvD,CAAC,CAAC;AAlBW,QAAA,kBAAkB,sBAkB7B","sourcesContent":["import { XError } from '@bisondesk/commons-sdk/errors';\nimport { cleanHeaders, getAdminAuth } from '@bisondesk/commons-sdk/fetch';\nimport { Option } from '@bisondesk/commons-sdk/types';\nimport fetch, { Response } from 'node-fetch';\nimport {\n AdHocPicklistRequest,\n AdHocPicklistValueDisplay,\n PicklistOptionsRequest,\n} from '../types/picklists';\n\nexport const getMultiplePicklistValues = async (\n request: AdHocPicklistRequest\n): Promise<AdHocPicklistValueDisplay> => {\n const auth = await getAdminAuth();\n const response: Response = await fetch(`${process.env.CORE_API_ORIGIN}/api/picklists/bulk/read`, {\n method: 'POST',\n headers: {\n Authorization: auth,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(request),\n });\n\n if (response.ok) {\n return response.json();\n }\n\n const body = await response.text();\n throw new XError(response.statusText, { body });\n};\n\nexport const getPicklistOptions = async (req: PicklistOptionsRequest): Promise<Option[]> => {\n const auth = await getAdminAuth();\n\n const response: Response = await fetch(`${process.env.CORE_API_ORIGIN}/api/picklists/options`, {\n method: 'POST',\n headers: cleanHeaders({\n Authorization: auth,\n 'Content-Type': 'application/json',\n }),\n body: JSON.stringify(req),\n });\n\n if (response.ok) {\n return response.json();\n }\n\n const body = await response.text();\n throw new XError(response.statusText, { body, req });\n};\n"]}
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTenantByHyperportalId = exports.getTenantByHyperdmsId = exports.getTenant = exports.listTenantsSyncSettings = exports.listTenants = void 0;
4
+ const errors_1 = require("@bisondesk/commons-sdk/errors");
5
+ const fetch_1 = require("@bisondesk/commons-sdk/fetch");
6
+ const node_fetch_1 = __importDefault(require("node-fetch"));
7
+ const listTenants = async () => {
8
+ const auth = await (0, fetch_1.getAdminAuth)();
9
+ const response = await (0, node_fetch_1.default)(`${process.env.CORE_API_ORIGIN}/admin/tenants`, {
10
+ headers: {
11
+ Authorization: auth,
12
+ },
13
+ });
14
+ if (response.ok) {
15
+ return response.json();
16
+ }
17
+ const body = await response.text();
18
+ throw new errors_1.XError(response.statusText, { body });
19
+ };
20
+ exports.listTenants = listTenants;
21
+ const listTenantsSyncSettings = async () => {
22
+ const auth = await (0, fetch_1.getAdminAuth)();
23
+ const response = await (0, node_fetch_1.default)(`${process.env.CORE_API_ORIGIN}/admin/tenants/settings/sync`, {
24
+ headers: {
25
+ Authorization: auth,
26
+ },
27
+ });
28
+ if (response.ok) {
29
+ return response.json();
30
+ }
31
+ const body = await response.text();
32
+ throw new errors_1.XError(response.statusText, { body });
33
+ };
34
+ exports.listTenantsSyncSettings = listTenantsSyncSettings;
35
+ const getTenant = async (tenantId) => {
36
+ const auth = await (0, fetch_1.getAdminAuth)();
37
+ const response = await (0, node_fetch_1.default)(`${process.env.CORE_API_ORIGIN}/admin/tenants/${tenantId}`, {
38
+ headers: {
39
+ Authorization: auth,
40
+ },
41
+ });
42
+ if (response.ok) {
43
+ return response.status === 200 ? response.json() : undefined;
44
+ }
45
+ const body = await response.text();
46
+ throw new errors_1.XError(response.statusText, { body });
47
+ };
48
+ exports.getTenant = getTenant;
49
+ const getTenantByHyperdmsId = async (hyperdmsTenantId) => {
50
+ const auth = await (0, fetch_1.getAdminAuth)();
51
+ const response = await (0, node_fetch_1.default)(`${process.env.CORE_API_ORIGIN}/admin/tenants/hyperdms/${hyperdmsTenantId}`, {
52
+ headers: {
53
+ Authorization: auth,
54
+ },
55
+ });
56
+ if (response.ok) {
57
+ return response.status === 200 ? response.json() : undefined;
58
+ }
59
+ const body = await response.text();
60
+ throw new errors_1.XError(response.statusText, { body });
61
+ };
62
+ exports.getTenantByHyperdmsId = getTenantByHyperdmsId;
63
+ const getTenantByHyperportalId = async (hyperportalTenantId) => {
64
+ const auth = await (0, fetch_1.getAdminAuth)();
65
+ const response = await (0, node_fetch_1.default)(`${process.env.CORE_API_ORIGIN}/admin/tenants/hyperportal/${hyperportalTenantId}`, {
66
+ headers: {
67
+ Authorization: auth,
68
+ },
69
+ });
70
+ if (response.ok) {
71
+ return response.status === 200 ? response.json() : undefined;
72
+ }
73
+ const body = await response.text();
74
+ throw new errors_1.XError(response.statusText, { body });
75
+ };
76
+ exports.getTenantByHyperportalId = getTenantByHyperportalId;
77
+ //# sourceMappingURL=tenants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tenants.js","sourceRoot":"/","sources":["apis/tenants.ts"],"names":[],"mappings":";;;AAAA,0DAAuD;AACvD,wDAA4D;AAC5D,4DAA6C;AAGtC,MAAM,WAAW,GAAG,KAAK,IAAuB,EAAE;IACvD,MAAM,IAAI,GAAG,MAAM,IAAA,oBAAY,GAAE,CAAC;IAClC,MAAM,QAAQ,GAAa,MAAM,IAAA,oBAAK,EAAC,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,gBAAgB,EAAE;QACrF,OAAO,EAAE;YACP,aAAa,EAAE,IAAI;SACpB;KACF,CAAC,CAAC;IAEH,IAAI,QAAQ,CAAC,EAAE,EAAE;QACf,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;KACxB;IAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IACnC,MAAM,IAAI,eAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;AAClD,CAAC,CAAC;AAdW,QAAA,WAAW,eActB;AAEK,MAAM,uBAAuB,GAAG,KAAK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Error } from '@bisondesk/commons-sdk/errors';\nimport { getAdminAuth } from '@bisondesk/commons-sdk/fetch';\nimport fetch, { Response } from 'node-fetch';\nimport { Tenant, TenantSyncSettings } from '../types/tenants';\n\nexport const listTenants = async (): Promise<Tenant[]> => {\n const auth = await getAdminAuth();\n const response: Response = await fetch(`${process.env.CORE_API_ORIGIN}/admin/tenants`, {\n headers: {\n Authorization: auth,\n },\n });\n\n if (response.ok) {\n return response.json();\n }\n\n const body = await response.text();\n throw new XError(response.statusText, { body });\n};\n\nexport const listTenantsSyncSettings = async (): Promise<TenantSyncSettings[]> => {\n const auth = await getAdminAuth();\n const response: Response = await fetch(\n `${process.env.CORE_API_ORIGIN}/admin/tenants/settings/sync`,\n {\n headers: {\n Authorization: auth,\n },\n }\n );\n\n if (response.ok) {\n return response.json();\n }\n\n const body = await response.text();\n throw new XError(response.statusText, { body });\n};\n\nexport const getTenant = async (tenantId: string): Promise<Tenant | undefined> => {\n const auth = await getAdminAuth();\n const response: Response = await fetch(\n `${process.env.CORE_API_ORIGIN}/admin/tenants/${tenantId}`,\n {\n headers: {\n Authorization: auth,\n },\n }\n );\n\n if (response.ok) {\n return response.status === 200 ? response.json() : undefined;\n }\n\n const body = await response.text();\n throw new XError(response.statusText, { body });\n};\n\nexport const getTenantByHyperdmsId = async (\n hyperdmsTenantId: string\n): Promise<Tenant | undefined> => {\n const auth = await getAdminAuth();\n const response: Response = await fetch(\n `${process.env.CORE_API_ORIGIN}/admin/tenants/hyperdms/${hyperdmsTenantId}`,\n {\n headers: {\n Authorization: auth,\n },\n }\n );\n\n if (response.ok) {\n return response.status === 200 ? response.json() : undefined;\n }\n\n const body = await response.text();\n throw new XError(response.statusText, { body });\n};\n\nexport const getTenantByHyperportalId = async (\n hyperportalTenantId: string\n): Promise<Tenant | undefined> => {\n const auth = await getAdminAuth();\n const response: Response = await fetch(\n `${process.env.CORE_API_ORIGIN}/admin/tenants/hyperportal/${hyperportalTenantId}`,\n {\n headers: {\n Authorization: auth,\n },\n }\n );\n\n if (response.ok) {\n return response.status === 200 ? response.json() : undefined;\n }\n\n const body = await response.text();\n throw new XError(response.statusText, { body });\n};\n"]}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getUser = void 0;
4
+ const constants_1 = require("@bisondesk/commons-sdk/constants");
5
+ const errors_1 = require("@bisondesk/commons-sdk/errors");
6
+ const fetch_1 = require("@bisondesk/commons-sdk/fetch");
7
+ const node_fetch_1 = __importDefault(require("node-fetch"));
8
+ const getUser = async (tenantId, userId) => {
9
+ const auth = await (0, fetch_1.getAdminAuth)();
10
+ const response = await (0, node_fetch_1.default)(`${process.env.CORE_API_ORIGIN}/api/users/${userId}`, {
11
+ headers: (0, fetch_1.cleanHeaders)({
12
+ Authorization: auth,
13
+ [constants_1.TENANT_ID_ADMIN_HEADER]: tenantId,
14
+ }),
15
+ });
16
+ if (response.ok) {
17
+ return response.status === 200 ? response.json() : undefined;
18
+ }
19
+ const body = await response.text();
20
+ throw new errors_1.XError(response.statusText, { body, tenantId, userId });
21
+ };
22
+ exports.getUser = getUser;
23
+ //# sourceMappingURL=users.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"users.js","sourceRoot":"/","sources":["apis/users.ts"],"names":[],"mappings":";;;AAAA,gEAA0E;AAC1E,0DAAuD;AACvD,wDAA0E;AAC1E,4DAA6C;AAGtC,MAAM,OAAO,GAAG,KAAK,EAAE,QAAgB,EAAE,MAAc,EAA6B,EAAE;IAC3F,MAAM,IAAI,GAAG,MAAM,IAAA,oBAAY,GAAE,CAAC;IAClC,MAAM,QAAQ,GAAa,MAAM,IAAA,oBAAK,EAAC,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,cAAc,MAAM,EAAE,EAAE;QAC3F,OAAO,EAAE,IAAA,oBAAY,EAAC;YACpB,aAAa,EAAE,IAAI;YACnB,CAAC,kCAAsB,CAAC,EAAE,QAAQ;SACnC,CAAC;KACH,CAAC,CAAC;IAEH,IAAI,QAAQ,CAAC,EAAE,EAAE;QACf,OAAO,QAAQ,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;KAC9D;IAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IACnC,MAAM,IAAI,eAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;AACpE,CAAC,CAAC;AAfW,QAAA,OAAO,WAelB","sourcesContent":["import { TENANT_ID_ADMIN_HEADER } from '@bisondesk/commons-sdk/constants';\nimport { XError } from '@bisondesk/commons-sdk/errors';\nimport { cleanHeaders, getAdminAuth } from '@bisondesk/commons-sdk/fetch';\nimport fetch, { Response } from 'node-fetch';\nimport { User } from '../types/users';\n\nexport const getUser = async (tenantId: string, userId: string): Promise<User | undefined> => {\n const auth = await getAdminAuth();\n const response: Response = await fetch(`${process.env.CORE_API_ORIGIN}/api/users/${userId}`, {\n headers: cleanHeaders({\n Authorization: auth,\n [TENANT_ID_ADMIN_HEADER]: tenantId,\n }),\n });\n\n if (response.ok) {\n return response.status === 200 ? response.json() : undefined;\n }\n\n const body = await response.text();\n throw new XError(response.statusText, { body, tenantId, userId });\n};\n"]}
@@ -0,0 +1,182 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deleteVehicle = exports.saveVehicle = exports.saveVehiclePurchase = exports.saveMarketing = exports.getVehicleMarketing = exports.listVehiclesMarketing = exports.getVehicleByPurchaseStockNumber = exports.getVehicleByStockNumber = exports.getVehiclePurchase = exports.getVehicleByChassisNumber = exports.getVehicle = void 0;
4
+ const constants_1 = require("@bisondesk/commons-sdk/constants");
5
+ const errors_1 = require("@bisondesk/commons-sdk/errors");
6
+ const fetch_1 = require("@bisondesk/commons-sdk/fetch");
7
+ const node_fetch_1 = __importDefault(require("node-fetch"));
8
+ const getVehicle = async (tenantId, vehicleId) => {
9
+ const auth = await (0, fetch_1.getAdminAuth)();
10
+ const response = await (0, node_fetch_1.default)(`${process.env.CORE_API_ORIGIN}/api/vehicles/${vehicleId}`, {
11
+ headers: {
12
+ Authorization: auth,
13
+ [constants_1.TENANT_ID_ADMIN_HEADER]: tenantId,
14
+ },
15
+ });
16
+ if (response.ok) {
17
+ return response.status === 200 ? response.json() : undefined;
18
+ }
19
+ const body = await response.text();
20
+ throw new errors_1.XError(response.statusText, { body });
21
+ };
22
+ exports.getVehicle = getVehicle;
23
+ const getVehicleByChassisNumber = async (tenantId, vin) => {
24
+ const auth = await (0, fetch_1.getAdminAuth)();
25
+ return (0, fetch_1.fetchJson)(`${process.env.CORE_API_ORIGIN}/api/vehicles/vin/${vin}`, {
26
+ headers: {
27
+ Authorization: auth,
28
+ [constants_1.TENANT_ID_ADMIN_HEADER]: tenantId,
29
+ },
30
+ });
31
+ };
32
+ exports.getVehicleByChassisNumber = getVehicleByChassisNumber;
33
+ const getVehiclePurchase = async (tenantId, vehicleId) => {
34
+ const auth = await (0, fetch_1.getAdminAuth)();
35
+ const response = await (0, node_fetch_1.default)(`${process.env.CORE_API_ORIGIN}/api/vehicles/${vehicleId}/purchase`, {
36
+ headers: {
37
+ Authorization: auth,
38
+ [constants_1.TENANT_ID_ADMIN_HEADER]: tenantId,
39
+ },
40
+ });
41
+ if (response.ok) {
42
+ return response.status === 200 ? response.json() : undefined;
43
+ }
44
+ const body = await response.text();
45
+ throw new errors_1.XError(response.statusText, { body });
46
+ };
47
+ exports.getVehiclePurchase = getVehiclePurchase;
48
+ const getVehicleByStockNumber = async (tenantId, stockNumber) => {
49
+ const auth = await (0, fetch_1.getAdminAuth)();
50
+ const response = await (0, node_fetch_1.default)(`${process.env.CORE_API_ORIGIN}/api/vehicles/stock-number/${stockNumber}`, {
51
+ headers: {
52
+ Authorization: auth,
53
+ [constants_1.TENANT_ID_ADMIN_HEADER]: tenantId,
54
+ },
55
+ });
56
+ if (response.ok) {
57
+ return response.status === 200 ? response.json() : undefined;
58
+ }
59
+ const body = await response.text();
60
+ throw new errors_1.XError(response.statusText, { body });
61
+ };
62
+ exports.getVehicleByStockNumber = getVehicleByStockNumber;
63
+ const getVehicleByPurchaseStockNumber = async (tenantId, stockNumber) => {
64
+ const auth = await (0, fetch_1.getAdminAuth)();
65
+ const response = await (0, node_fetch_1.default)(`${process.env.CORE_API_ORIGIN}/api/vehicles/purchase-stock-number/${stockNumber}`, {
66
+ headers: {
67
+ Authorization: auth,
68
+ [constants_1.TENANT_ID_ADMIN_HEADER]: tenantId,
69
+ },
70
+ });
71
+ if (response.ok) {
72
+ return response.status === 200 ? response.json() : undefined;
73
+ }
74
+ const body = await response.text();
75
+ throw new errors_1.XError(response.statusText, { body });
76
+ };
77
+ exports.getVehicleByPurchaseStockNumber = getVehicleByPurchaseStockNumber;
78
+ const listVehiclesMarketing = async (tenantId, offset, limit, opts) => {
79
+ const auth = await (0, fetch_1.getAdminAuth)();
80
+ const response = await (0, node_fetch_1.default)(`${process.env.CORE_API_ORIGIN}/api/vehicles/marketing/list?offset=${offset}&limit=${limit}`, {
81
+ headers: (0, fetch_1.cleanHeaders)({
82
+ Authorization: auth,
83
+ [constants_1.TENANT_ID_ADMIN_HEADER]: tenantId,
84
+ [constants_1.SERVICE_ID_ADMIN_HEADER]: opts?.serviceId,
85
+ }),
86
+ });
87
+ if (response.ok) {
88
+ return response.status === 200 ? response.json() : undefined;
89
+ }
90
+ const body = await response.text();
91
+ throw new errors_1.XError(response.statusText, { tenantId, body, offset, limit });
92
+ };
93
+ exports.listVehiclesMarketing = listVehiclesMarketing;
94
+ const getVehicleMarketing = async (tenantId, vehicleId) => {
95
+ const auth = await (0, fetch_1.getAdminAuth)();
96
+ const response = await (0, node_fetch_1.default)(`${process.env.CORE_API_ORIGIN}/api/vehicles/${vehicleId}/marketing`, {
97
+ headers: {
98
+ Authorization: auth,
99
+ [constants_1.TENANT_ID_ADMIN_HEADER]: tenantId,
100
+ },
101
+ });
102
+ if (response.ok) {
103
+ return response.status === 200 ? response.json() : undefined;
104
+ }
105
+ const body = await response.text();
106
+ throw new errors_1.XError(response.statusText, { body });
107
+ };
108
+ exports.getVehicleMarketing = getVehicleMarketing;
109
+ const saveMarketing = async (tenantId, vehicleId, marketing) => {
110
+ const auth = await (0, fetch_1.getAdminAuth)();
111
+ const response = await (0, node_fetch_1.default)(`${process.env.CORE_API_ORIGIN}/api/vehicles/${vehicleId}/marketing`, {
112
+ method: 'POST',
113
+ headers: (0, fetch_1.cleanHeaders)({
114
+ Authorization: auth,
115
+ 'Content-Type': 'application/json',
116
+ [constants_1.TENANT_ID_ADMIN_HEADER]: tenantId,
117
+ }),
118
+ body: JSON.stringify(marketing),
119
+ });
120
+ if (response.ok) {
121
+ return response.json();
122
+ }
123
+ const body = await response.text();
124
+ throw new errors_1.XError(response.statusText, { body, tenantId, vehicleId, marketing });
125
+ };
126
+ exports.saveMarketing = saveMarketing;
127
+ const saveVehiclePurchase = async (tenantId, vehicleId, purchase, opts) => {
128
+ const auth = await (0, fetch_1.getAdminAuth)();
129
+ const response = await (0, node_fetch_1.default)(`${process.env.CORE_API_ORIGIN}/api/vehicles/${vehicleId}/purchase`, {
130
+ method: 'POST',
131
+ headers: (0, fetch_1.cleanHeaders)({
132
+ Authorization: auth,
133
+ 'Content-Type': 'application/json',
134
+ [constants_1.TENANT_ID_ADMIN_HEADER]: tenantId,
135
+ [constants_1.SERVICE_ID_ADMIN_HEADER]: opts?.serviceId,
136
+ }),
137
+ body: JSON.stringify(purchase),
138
+ });
139
+ if (response.ok) {
140
+ return response.json();
141
+ }
142
+ const body = await response.text();
143
+ throw new errors_1.XError(response.statusText, { body, tenantId, vehicleId, purchase, opts });
144
+ };
145
+ exports.saveVehiclePurchase = saveVehiclePurchase;
146
+ const saveVehicle = async (tenantId, vehicle, opts) => {
147
+ const auth = await (0, fetch_1.getAdminAuth)();
148
+ const response = await (0, node_fetch_1.default)(`${process.env.CORE_API_ORIGIN}/api/vehicles`, {
149
+ method: 'POST',
150
+ headers: (0, fetch_1.cleanHeaders)({
151
+ Authorization: auth,
152
+ 'Content-Type': 'application/json',
153
+ [constants_1.TENANT_ID_ADMIN_HEADER]: tenantId,
154
+ [constants_1.SERVICE_ID_ADMIN_HEADER]: opts?.serviceId,
155
+ }),
156
+ body: JSON.stringify(vehicle),
157
+ });
158
+ if (response.ok) {
159
+ return response.json();
160
+ }
161
+ const body = await response.text();
162
+ throw new errors_1.XError(response.statusText, { body, tenantId, vehicle, opts });
163
+ };
164
+ exports.saveVehicle = saveVehicle;
165
+ const deleteVehicle = async (tenantId, vehicleId, opts) => {
166
+ const auth = await (0, fetch_1.getAdminAuth)();
167
+ const response = await (0, node_fetch_1.default)(`${process.env.CORE_API_ORIGIN}/api/vehicles/${vehicleId}`, {
168
+ method: 'DELETE',
169
+ headers: (0, fetch_1.cleanHeaders)({
170
+ Authorization: auth,
171
+ [constants_1.TENANT_ID_ADMIN_HEADER]: tenantId,
172
+ [constants_1.SERVICE_ID_ADMIN_HEADER]: opts?.serviceId,
173
+ }),
174
+ });
175
+ if (response.ok) {
176
+ return;
177
+ }
178
+ const body = await response.text();
179
+ throw new errors_1.XError(response.statusText, { body, tenantId, vehicleId, opts });
180
+ };
181
+ exports.deleteVehicle = deleteVehicle;
182
+ //# sourceMappingURL=vehicles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vehicles.js","sourceRoot":"/","sources":["apis/vehicles.ts"],"names":[],"mappings":";;;AAAA,gEAAmG;AACnG,0DAAuD;AACvD,wDAAqF;AACrF,4DAA6C;AAItC,MAAM,UAAU,GAAG,KAAK,EAC7B,QAAgB,EAChB,SAAiB,EACyB,EAAE;IAC5C,MAAM,IAAI,GAAG,MAAM,IAAA,oBAAY,GAAE,CAAC;IAClC,MAAM,QAAQ,GAAa,MAAM,IAAA,oBAAK,EACpC,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,iBAAiB,SAAS,EAAE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AS;SAC3C,CAAC;KACH,CACF,CAAC;IAEF,IAAI,QAAQ,CAAC,EAAE,EAAE;QACf,OAAO;KACR;IAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IACnC,MAAM,IAAI,eAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAC7E,CAAC,CAAC;AAxBW,QAAA,aAAa,iBAwBxB","sourcesContent":["import { SERVICE_ID_ADMIN_HEADER, TENANT_ID_ADMIN_HEADER } from '@bisondesk/commons-sdk/constants';\nimport { XError } from '@bisondesk/commons-sdk/errors';\nimport { cleanHeaders, fetchJson, getAdminAuth } from '@bisondesk/commons-sdk/fetch';\nimport fetch, { Response } from 'node-fetch';\nimport { DataRecord } from '../types/utils';\nimport { NewVehicle, Vehicle, VehicleMarketing, VehiclePurchase } from '../types/vehicles';\n\nexport const getVehicle = async (\n tenantId: string,\n vehicleId: string\n): Promise<DataRecord<Vehicle> | undefined> => {\n const auth = await getAdminAuth();\n const response: Response = await fetch(\n `${process.env.CORE_API_ORIGIN}/api/vehicles/${vehicleId}`,\n {\n headers: {\n Authorization: auth,\n [TENANT_ID_ADMIN_HEADER]: tenantId,\n },\n }\n );\n\n if (response.ok) {\n return response.status === 200 ? response.json() : undefined;\n }\n\n const body = await response.text();\n throw new XError(response.statusText, { body });\n};\n\nexport const getVehicleByChassisNumber = async (\n tenantId: string,\n vin: string\n): Promise<DataRecord<Vehicle> | undefined> => {\n const auth = await getAdminAuth();\n return fetchJson(`${process.env.CORE_API_ORIGIN}/api/vehicles/vin/${vin}`, {\n headers: {\n Authorization: auth,\n [TENANT_ID_ADMIN_HEADER]: tenantId,\n },\n });\n};\n\nexport const getVehiclePurchase = async (\n tenantId: string,\n vehicleId: string\n): Promise<DataRecord<VehiclePurchase> | undefined> => {\n const auth = await getAdminAuth();\n const response: Response = await fetch(\n `${process.env.CORE_API_ORIGIN}/api/vehicles/${vehicleId}/purchase`,\n {\n headers: {\n Authorization: auth,\n [TENANT_ID_ADMIN_HEADER]: tenantId,\n },\n }\n );\n\n if (response.ok) {\n return response.status === 200 ? response.json() : undefined;\n }\n\n const body = await response.text();\n throw new XError(response.statusText, { body });\n};\n\nexport const getVehicleByStockNumber = async (\n tenantId: string,\n stockNumber: string\n): Promise<Vehicle | undefined> => {\n const auth = await getAdminAuth();\n const response: Response = await fetch(\n `${process.env.CORE_API_ORIGIN}/api/vehicles/stock-number/${stockNumber}`,\n {\n headers: {\n Authorization: auth,\n [TENANT_ID_ADMIN_HEADER]: tenantId,\n },\n }\n );\n\n if (response.ok) {\n return response.status === 200 ? response.json() : undefined;\n }\n\n const body = await response.text();\n throw new XError(response.statusText, { body });\n};\n\nexport const getVehicleByPurchaseStockNumber = async (\n tenantId: string,\n stockNumber: string\n): Promise<Vehicle | undefined> => {\n const auth = await getAdminAuth();\n const response: Response = await fetch(\n `${process.env.CORE_API_ORIGIN}/api/vehicles/purchase-stock-number/${stockNumber}`,\n {\n headers: {\n Authorization: auth,\n [TENANT_ID_ADMIN_HEADER]: tenantId,\n },\n }\n );\n\n if (response.ok) {\n return response.status === 200 ? response.json() : undefined;\n }\n\n const body = await response.text();\n throw new XError(response.statusText, { body });\n};\n\nexport const listVehiclesMarketing = async (\n tenantId: string,\n offset: number,\n limit: number,\n opts?: { serviceId: string }\n): Promise<{ id: string; data: VehicleMarketing }[]> => {\n const auth = await getAdminAuth();\n const response: Response = await fetch(\n `${process.env.CORE_API_ORIGIN}/api/vehicles/marketing/list?offset=${offset}&limit=${limit}`,\n {\n headers: cleanHeaders({\n Authorization: auth,\n [TENANT_ID_ADMIN_HEADER]: tenantId,\n [SERVICE_ID_ADMIN_HEADER]: opts?.serviceId,\n }),\n }\n );\n\n if (response.ok) {\n return response.status === 200 ? response.json() : undefined;\n }\n\n const body = await response.text();\n throw new XError(response.statusText, { tenantId, body, offset, limit });\n};\n\nexport const getVehicleMarketing = async (\n tenantId: string,\n vehicleId: string\n): Promise<VehicleMarketing | undefined> => {\n const auth = await getAdminAuth();\n const response: Response = await fetch(\n `${process.env.CORE_API_ORIGIN}/api/vehicles/${vehicleId}/marketing`,\n {\n headers: {\n Authorization: auth,\n [TENANT_ID_ADMIN_HEADER]: tenantId,\n },\n }\n );\n\n if (response.ok) {\n return response.status === 200 ? response.json() : undefined;\n }\n\n const body = await response.text();\n throw new XError(response.statusText, { body });\n};\n\nexport const saveMarketing = async (\n tenantId: string,\n vehicleId: string,\n marketing: VehicleMarketing\n): Promise<VehicleMarketing> => {\n const auth = await getAdminAuth();\n\n const response: Response = await fetch(\n `${process.env.CORE_API_ORIGIN}/api/vehicles/${vehicleId}/marketing`,\n {\n method: 'POST',\n headers: cleanHeaders({\n Authorization: auth,\n 'Content-Type': 'application/json',\n [TENANT_ID_ADMIN_HEADER]: tenantId,\n }),\n body: JSON.stringify(marketing),\n }\n );\n\n if (response.ok) {\n return response.json();\n }\n const body = await response.text();\n throw new XError(response.statusText, { body, tenantId, vehicleId, marketing });\n};\n\nexport const saveVehiclePurchase = async (\n tenantId: string,\n vehicleId: string,\n purchase: VehiclePurchase,\n opts?: { serviceId: string }\n): Promise<Vehicle> => {\n const auth = await getAdminAuth();\n const response: Response = await fetch(\n `${process.env.CORE_API_ORIGIN}/api/vehicles/${vehicleId}/purchase`,\n {\n method: 'POST',\n headers: cleanHeaders({\n Authorization: auth,\n 'Content-Type': 'application/json',\n [TENANT_ID_ADMIN_HEADER]: tenantId,\n [SERVICE_ID_ADMIN_HEADER]: opts?.serviceId,\n }),\n body: JSON.stringify(purchase),\n }\n );\n\n if (response.ok) {\n return response.json();\n }\n const body = await response.text();\n throw new XError(response.statusText, { body, tenantId, vehicleId, purchase, opts });\n};\n\nexport const saveVehicle = async (\n tenantId: string,\n vehicle: NewVehicle | Vehicle,\n opts?: { serviceId: string }\n): Promise<Vehicle> => {\n const auth = await getAdminAuth();\n const response: Response = await fetch(`${process.env.CORE_API_ORIGIN}/api/vehicles`, {\n method: 'POST',\n headers: cleanHeaders({\n Authorization: auth,\n 'Content-Type': 'application/json',\n [TENANT_ID_ADMIN_HEADER]: tenantId,\n [SERVICE_ID_ADMIN_HEADER]: opts?.serviceId,\n }),\n body: JSON.stringify(vehicle),\n });\n\n if (response.ok) {\n return response.json();\n }\n const body = await response.text();\n throw new XError(response.statusText, { body, tenantId, vehicle, opts });\n};\n\nexport const deleteVehicle = async (\n tenantId: string,\n vehicleId: string,\n opts?: { serviceId: string }\n): Promise<void> => {\n const auth = await getAdminAuth();\n const response: Response = await fetch(\n `${process.env.CORE_API_ORIGIN}/api/vehicles/${vehicleId}`,\n {\n method: 'DELETE',\n headers: cleanHeaders({\n Authorization: auth,\n [TENANT_ID_ADMIN_HEADER]: tenantId,\n [SERVICE_ID_ADMIN_HEADER]: opts?.serviceId,\n }),\n }\n );\n\n if (response.ok) {\n return;\n }\n\n const body = await response.text();\n throw new XError(response.statusText, { body, tenantId, vehicleId, opts });\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"opportunities.js","sourceRoot":"/","sources":["apis/opportunities.ts"],"names":[],"mappings":";;;AAAA,gEAA0E;AAC1E,wDAAyD;AAEzD,wDAA0E;AAUnE,MAAM,iBAAiB,GAAG,KAAK,EACpC,QAAgB,EAChB,aAAqB,EACgB,EAAE;IACvC,MAAM,IAAI,GAAG,MAAM,IAAA,oBAAY,GAAE,CAAC;IAClC,OAAO,IAAA,iBAAS,EAAC,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,sBAAsB,aAAa,MAAM,EAAE;QACxF,OAAO,EAAE,IAAA,oBAAY,EAAC;YACpB,aAAa,EAAE,IAAI;YACnB,CAAC,kCAAsB,CAAC,EAAE,QAAQ;SACnC,CAAC;KACH,CAAC,CAAC;AACL,CAAC,CAAC;AAXW,QAAA,iBAAiB,qBAW5B;AAEK,MAAM,iBAAiB,GAAG,KAAK,EACpC,QAAgB,EAChB,WAA8B,EAC9B,aAAqB,EAC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qDAAqD,SAAS,EAAE,EAC9F;QACE,OAAO,EAAE,IAAA,oBAAY,EAAC;YACpB,aAAa,EAAE,IAAI;YACnB,CAAC,kCAAsB,CAAC,EAAE,QAAQ;SACnC,CAAC;KACH,CACF,CAAC;AACJ,CAAC,CAAC;AAdW,QAAA,qBAAqB,yBAchC;AAKK,MAAM,YAAY,GAAG,KAAK,EAC/B,QAAgB,EAChB,OAAe,EACa,EAAE;IAC9B,MAAM,IAAI,GAAG,MAAM,IAAA,oBAAY,GAAE,CAAC;IAClC,OAAO,IAAA,iBAAS,EAAC,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,eAAe,OAAO,EAAE,EAAE;QACvE,OAAO,EAAE,IAAA,oBAAY,EAAC;YACpB,aAAa,EAAE,IAAI;YACnB,CAAC,kCAAsB,CAAC,EAAE,QAAQ;SACnC,CAAC;KACH,CAAC,CAAC;AACL,CAAC,CAAC;AAXW,QAAA,YAAY,gBAWvB","sourcesContent":["import { TENANT_ID_ADMIN_HEADER } from '@bisondesk/commons-sdk/constants';\nimport { fetchJson } from '@bisondesk/commons-sdk/fetch';\n\nimport { cleanHeaders, getAdminAuth } from '@bisondesk/commons-sdk/fetch';\nimport { LeasingQuoteParams } from '../types/leasing-settings';\nimport {\n NewOpportunity,\n Opportunity,\n OpportunityBFF,\n OpportunityUpdate,\n} from '../types/opportunities';\nimport { Quote } from '../types/quotes';\n\nexport const getOpportunityBff = async (\n tenantId: string,\n opportunityId: string\n): Promise<OpportunityBFF | undefined> => {\n const auth = await getAdminAuth();\n return fetchJson(`${process.env.CORE_API_ORIGIN}/api/opportunities/${opportunityId}/bff`, {\n headers: cleanHeaders({\n Authorization: auth,\n [TENANT_ID_ADMIN_HEADER]: tenantId,\n }),\n });\n};\n\nexport const updateOpportunity = async (\n tenantId: string,\n opportunity: OpportunityUpdate,\n opportunityId: string\n): Promise<OpportunityBFF | undefined> => {\n const auth = await getAdminAuth();\n return fetchJson(`${process.env.CORE_API_ORIGIN}/api/opportunities/${opportunityId}`, {\n method: 'PATCH',\n headers: cleanHeaders({\n Authorization: auth,\n [TENANT_ID_ADMIN_HEADER]: tenantId,\n }),\n body: JSON.stringify(opportunity),\n });\n};\n\nexport const createOpportunity = async (\n tenantId: string,\n opportunity: NewOpportunity\n): Promise<Opportunity> => {\n const auth = await getAdminAuth();\n const response: Opportunity | undefined = await fetchJson(\n `${process.env.CORE_API_ORIGIN}/api/opportunities`,\n {\n method: 'POST',\n headers: cleanHeaders({\n Authorization: auth,\n [TENANT_ID_ADMIN_HEADER]: tenantId,\n 'Content-Type': 'application/json',\n }),\n body: JSON.stringify(opportunity),\n }\n );\n\n if (response == null) {\n throw new Error('Opportunity not created');\n }\n\n return response;\n};\n\nexport const getLeasingQuoteParams = async (\n tenantId: string,\n settingId: string\n): Promise<LeasingQuoteParams | undefined> => {\n const auth = await getAdminAuth();\n return fetchJson(\n `${process.env.CORE_API_ORIGIN}/api/leasing/administration/settings/quote-params/${settingId}`,\n {\n headers: cleanHeaders({\n Authorization: auth,\n [TENANT_ID_ADMIN_HEADER]: tenantId,\n }),\n }\n );\n};\n\n//\n// Quotes\n//\nexport const getQuoteById = async (\n tenantId: string,\n quoteId: string\n): Promise<Quote | undefined> => {\n const auth = await getAdminAuth();\n return fetchJson(`${process.env.CORE_API_ORIGIN}/api/quotes/${quoteId}`, {\n headers: cleanHeaders({\n Authorization: auth,\n [TENANT_ID_ADMIN_HEADER]: tenantId,\n }),\n });\n};\n"]}
1
+ {"version":3,"file":"opportunities.js","sourceRoot":"/","sources":["apis/opportunities.ts"],"names":[],"mappings":";;;AAAA,gEAA0E;AAC1E,wDAAyD;AAEzD,wDAA0E;AAUnE,MAAM,iBAAiB,GAAG,KAAK,EACpC,QAAgB,EAChB,aAAqB,EACgB,EAAE;IACvC,MAAM,IAAI,GAAG,MAAM,IAAA,oBAAY,GAAE,CAAC;IAClC,OAAO,IAAA,iBAAS,EAAC,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,sBAAsB,aAA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AED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAvBW,QAAA,iBAAiB,qBAuB5B;AAEK,MAAM,qBAAqB,GAAG,KAAK,EACxC,QAAgB,EAChB,SAAiB,EACwB,EAAE;IAC3C,MAAM,IAAI,GAAG,MAAM,IAAA,oBAAY,GAAE,CAAC;IAClC,OAAO,IAAA,iBAAS,EACd,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,qDAAqD,SAAS,EAAE,EAC9F;QACE,OAAO,EAAE,IAAA,oBAAY,EAAC;YACpB,aAAa,EAAE,IAAI;YACnB,CAAC,kCAAsB,CAAC,EAAE,QAAQ;SACnC,CAAC;KACH,CACF,CAAC;AACJ,CAAC,CAAC;AAdW,QAAA,qBAAqB,yBAchC;AAKK,MAAM,YAAY,GAAG,KAAK,EAC/B,QAAgB,EAChB,OAAe,EACa,EAAE;IAC9B,MAAM,IAAI,GAAG,MAAM,IAAA,oBAAY,GAAE,CAAC;IAClC,OAAO,IAAA,iBAAS,EAAC,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,eAAe,OAAO,EAAE,EAAE;QACvE,OAAO,EAAE,IAAA,oBAAY,EAAC;YACpB,aAAa,EAAE,IAAI;YACnB,CAAC,kCAAsB,CAAC,EAAE,QAAQ;SACnC,CAAC;KACH,CAAC,CAAC;AACL,CAAC,CAAC;AAXW,QAAA,YAAY,gBAWvB","sourcesContent":["import { TENANT_ID_ADMIN_HEADER } from '@bisondesk/commons-sdk/constants';\nimport { fetchJson } from '@bisondesk/commons-sdk/fetch';\n\nimport { cleanHeaders, getAdminAuth } from '@bisondesk/commons-sdk/fetch';\nimport {\n NewOpportunity,\n Opportunity,\n OpportunityBFF,\n OpportunityUpdate,\n} from '../types/opportunities';\nimport { LeasingQuoteParams } from '../types/quote-settings';\nimport { Quote } from '../types/quotes';\n\nexport const getOpportunityBff = async (\n tenantId: string,\n opportunityId: string\n): Promise<OpportunityBFF | undefined> => {\n const auth = await getAdminAuth();\n return fetchJson(`${process.env.CORE_API_ORIGIN}/api/opportunities/${opportunityId}/bff`, {\n headers: cleanHeaders({\n Authorization: auth,\n [TENANT_ID_ADMIN_HEADER]: tenantId,\n }),\n });\n};\n\nexport const updateOpportunity = async (\n tenantId: string,\n opportunity: OpportunityUpdate,\n opportunityId: string\n): Promise<OpportunityBFF | undefined> => {\n const auth = await getAdminAuth();\n return fetchJson(`${process.env.CORE_API_ORIGIN}/api/opportunities/${opportunityId}`, {\n method: 'PATCH',\n headers: cleanHeaders({\n Authorization: auth,\n [TENANT_ID_ADMIN_HEADER]: tenantId,\n }),\n body: JSON.stringify(opportunity),\n });\n};\n\nexport const createOpportunity = async (\n tenantId: string,\n opportunity: NewOpportunity\n): Promise<Opportunity> => {\n const auth = await getAdminAuth();\n const response: Opportunity | undefined = await fetchJson(\n `${process.env.CORE_API_ORIGIN}/api/opportunities`,\n {\n method: 'POST',\n headers: cleanHeaders({\n Authorization: auth,\n [TENANT_ID_ADMIN_HEADER]: tenantId,\n 'Content-Type': 'application/json',\n }),\n body: JSON.stringify(opportunity),\n }\n );\n\n if (response == null) {\n throw new Error('Opportunity not created');\n }\n\n return response;\n};\n\nexport const getLeasingQuoteParams = async (\n tenantId: string,\n settingId: string\n): Promise<LeasingQuoteParams | undefined> => {\n const auth = await getAdminAuth();\n return fetchJson(\n `${process.env.CORE_API_ORIGIN}/api/leasing/administration/settings/quote-params/${settingId}`,\n {\n headers: cleanHeaders({\n Authorization: auth,\n [TENANT_ID_ADMIN_HEADER]: tenantId,\n }),\n }\n );\n};\n\n//\n// Quotes\n//\nexport const getQuoteById = async (\n tenantId: string,\n quoteId: string\n): Promise<Quote | undefined> => {\n const auth = await getAdminAuth();\n return fetchJson(`${process.env.CORE_API_ORIGIN}/api/quotes/${quoteId}`, {\n headers: cleanHeaders({\n Authorization: auth,\n [TENANT_ID_ADMIN_HEADER]: tenantId,\n }),\n });\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"leasing-settings.js","sourceRoot":"/","sources":["types/leasing-settings.ts"],"names":[],"mappings":";;;AAoHA,IAAY,wBAIX;AAJD,WAAY,wBAAwB;IAClC,iDAAqB,CAAA;IACrB,2CAAe,CAAA;IACf,+CAAmB,CAAA;AACrB,CAAC,EAJW,wBAAwB,GAAxB,gCAAwB,KAAxB,gCAAwB,QAInC","sourcesContent":["import { MultiLangValue } from '@bisondesk/commons-sdk/types';\nimport { Categories, OpportunityType } from '../constants';\nimport { SortFilter } from './search';\n\nexport type BeSpecificQuoteParams = {\n countryCode: 'be';\n other: {\n leasingStartupFeePercentage: string;\n };\n insurance: {\n allRisksCost: string;\n allRisksTax: string;\n allRisksFees: string;\n allRisksMinimumCost: string;\n specialTechnicalInsuranceCost: string;\n specialTechnicalInsuranceTax: string;\n specialTechnicalInsuranceFees: string;\n civilLiabilitiesCost: string;\n civilLiabilitiesTax: string;\n civilLiabilitiesFees: string;\n roadAssistanceMonthlySalesPrice: string; // monthly Price\n roadAssistanceMonthlyCostPrice: string; // monthly Price\n margin: string;\n allRisksCheckedForLocalClients: boolean;\n specialTechnicalInsuranceCheckedForLocalClients: boolean;\n civilLiabilitiesCheckedForLocalClients: boolean;\n roadAssistanceCheckedForLocalClients: boolean;\n };\n track: {\n trackAndTrace24Cost: string;\n trackAndTrace36Cost: string;\n trackAndTrace48Cost: string;\n trackAndTraceMaxCost: string;\n };\n taxes: {\n oneTimeRoadTax: string;\n yearlyRoadTax: string;\n oneTimeRoadCheckedForLocalClients: boolean;\n yearlyRoadCheckedForLocalClients: boolean;\n margin: string;\n };\n};\n\nexport type BoSpecificQuoteParams = {\n countryCode: 'bo';\n insurance: {\n allRisksCost: string;\n margin: string;\n };\n other: {\n administrativeFee: string;\n };\n track: {\n installationCost: string;\n monthlyCost: string;\n monthlyFee: string;\n deviceCost: string;\n };\n};\n\nexport type CountrySpecificQuoteParams = BeSpecificQuoteParams | BoSpecificQuoteParams;\n\nexport type LeasingQuoteParams<P extends CountrySpecificQuoteParams = CountrySpecificQuoteParams> =\n {\n id: string;\n name: string;\n modifiedAt: string;\n leasing: {\n leasingInterestRate: string;\n leasingDuration: number;\n leasingDepositPercentage: string;\n leasingResidualValuePercentage: string;\n };\n costs: {\n bankDepositPercentage: string;\n bankInterestRate: string;\n bankResidualValuePercentage: string;\n };\n } & P;\n\ntype BaseQuoteExtraSettings = {\n referenceCode: string;\n active: boolean;\n costPrice: string;\n countryCode: string;\n deliveryPackage: boolean;\n displayByDefault: boolean;\n hint?: MultiLangValue;\n name: MultiLangValue;\n salesPrice: string;\n vehicleCategoryRestrictions: Categories[];\n departments: string[];\n departmentTitles?: { [department: string]: string };\n opportunityTypeRestrictions: OpportunityType[];\n};\n\nexport type BaseQuoteExtraInput = {\n agreedPrice: string;\n costPrice: string;\n hint?: MultiLangValue;\n name: MultiLangValue;\n referenceCode: string;\n quantity: number;\n id: string;\n departments: string[];\n departmentTitles?: { [department: string]: string };\n};\n\nexport type NewQuoteExtraSettings = BaseQuoteExtraSettings & {\n id?: undefined;\n};\n\nexport type QuoteExtraSettings = BaseQuoteExtraSettings & {\n id: string;\n};\n\nexport enum LeasingItemsPaymentSplit {\n Customer = 'customer',\n Split = 'split',\n Company = 'company',\n}\n\nexport type LeasingDeliveryPackageInput = BaseQuoteExtraInput & { salesPrice: string };\n\nexport type CustomLeasingQuoteExtraInput = BaseQuoteExtraInput & {\n paymentSplit: LeasingItemsPaymentSplit;\n leasingPercentage: string;\n};\n\nexport type LeasingQuoteExtraInput = BaseQuoteExtraInput & {\n salesPrice: string;\n paymentSplit: LeasingItemsPaymentSplit;\n leasingPercentage: string;\n};\n\nexport type QuoteExtrasRequest = {\n deliveryPackage?: boolean;\n displayByDefault?: boolean;\n vehicleCategory?: Categories;\n country: string;\n name?: string;\n active?: boolean;\n offset?: number;\n limit?: number;\n sortBy?: SortFilter;\n opportunityType?: OpportunityType;\n};\n\nexport type SalesQuoteExtraInput = BaseQuoteExtraInput & {\n salesPrice: string;\n};\n\nexport type CustomSalesQuoteExtraInput = BaseQuoteExtraInput & {};\n"]}
1
+ {"version":3,"file":"leasing-settings.js","sourceRoot":"/","sources":["types/leasing-settings.ts"],"names":[],"mappings":";;;AAwCA,IAAY,wBAIX;AAJD,WAAY,wBAAwB;IAClC,iDAAqB,CAAA;IACrB,2CAAe,CAAA;IACf,+CAAmB,CAAA;AACrB,CAAC,EAJW,wBAAwB,GAAxB,gCAAwB,KAAxB,gCAAwB,QAInC","sourcesContent":["import { MultiLangValue } from '@bisondesk/commons-sdk/types';\nimport { Categories, OpportunityType } from '../constants';\nimport { SortFilter } from './search';\n\ntype BaseQuoteExtraSettings = {\n referenceCode: string;\n active: boolean;\n costPrice: string;\n countryCode: string;\n deliveryPackage: boolean;\n displayByDefault: boolean;\n hint?: MultiLangValue;\n name: MultiLangValue;\n salesPrice: string;\n vehicleCategoryRestrictions: Categories[];\n departments: string[];\n departmentTitles?: { [department: string]: string };\n opportunityTypeRestrictions: OpportunityType[];\n};\n\nexport type BaseQuoteExtraInput = {\n agreedPrice: string;\n costPrice: string;\n hint?: MultiLangValue;\n name: MultiLangValue;\n referenceCode: string;\n quantity: number;\n id: string;\n departments: string[];\n departmentTitles?: { [department: string]: string };\n};\n\nexport type NewQuoteExtraSettings = BaseQuoteExtraSettings & {\n id?: undefined;\n};\n\nexport type QuoteExtraSettings = BaseQuoteExtraSettings & {\n id: string;\n};\n\nexport enum LeasingItemsPaymentSplit {\n Customer = 'customer',\n Split = 'split',\n Company = 'company',\n}\n\nexport type LeasingDeliveryPackageInput = BaseQuoteExtraInput & { salesPrice: string };\n\nexport type CustomLeasingQuoteExtraInput = BaseQuoteExtraInput & {\n paymentSplit: LeasingItemsPaymentSplit;\n leasingPercentage: string;\n};\n\nexport type LeasingQuoteExtraInput = BaseQuoteExtraInput & {\n salesPrice: string;\n paymentSplit: LeasingItemsPaymentSplit;\n leasingPercentage: string;\n};\n\nexport type QuoteExtrasRequest = {\n deliveryPackage?: boolean;\n displayByDefault?: boolean;\n vehicleCategory?: Categories;\n country: string;\n name?: string;\n active?: boolean;\n offset?: number;\n limit?: number;\n sortBy?: SortFilter;\n opportunityType?: OpportunityType;\n};\n\nexport type SalesQuoteExtraInput = BaseQuoteExtraInput & {\n salesPrice: string;\n};\n\nexport type CustomSalesQuoteExtraInput = BaseQuoteExtraInput & {};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"opportunities.js","sourceRoot":"/","sources":["types/opportunities.ts"],"names":[],"mappings":";;;AAWA,IAAY,kBAoBX;AApBD,WAAY,kBAAkB;IAC5B,uDAAiC,CAAA;IACjC,mDAA6B,CAAA;IAC7B,mCAAa,CAAA;IACb,uCAAiB,CAAA;IACjB,6DAAuC,CAAA;IACvC,+DAAyC,CAAA;IACzC,uDAAiC,CAAA;IACjC,yDAAmC,CAAA;IACnC,mDAA6B,CAAA;IAC7B,qDAA+B,CAAA;IAC/B,mDAA6B,CAAA;IAC7B,mDAA6B,CAAA;IAC7B,iDAA2B,CAAA;IAC3B,mDAA6B,CAAA;IAC7B,iDAA2B,CAAA;IAC3B,uDAAiC,CAAA;IACjC,yDAAmC,CAAA;IACnC,mEAA6C,CAAA;IAC7C,wDAAkC,CAAA;AACpC,CAAC,EApBW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAoB7B;AAED,IAAY,qBAIX;AAJD,WAAY,qBAAqB;IAC/B,sDAA6B,CAAA;IAC7B,wDAA+B,CAAA;IAC/B,sDAA6B,CAAA;AAC/B,CAAC,EAJW,qBAAqB,GAArB,6BAAqB,KAArB,6BAAqB,QAIhC;AAED,IAAY,iBAOX;AAPD,WAAY,iBAAiB;IAC3B,gDAA2B,CAAA;IAC3B,4CAAuB,CAAA;IACvB,8CAAyB,CAAA;IACzB,sCAAiB,CAAA;IACjB,gDAA2B,CAAA;IAC3B,0CAAqB,CAAA;AACvB,CAAC,EAPW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAO5B;AAEY,QAAA,sBAAsB,GAAwB;IACzD,iBAAiB,CAAC,WAAW;IAC7B,iBAAiB,C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AAC3E,QAAA,iDAAiD,GAAG,+BAA+B,CAAC;AACpF,QAAA,gDAAgD,GAAG,8BAA8B,CAAC","sourcesContent":["import { Document, NextList } from '@bisondesk/commons-sdk/types';\nimport { BusinessEntityIds, OpportunityType, WarningHints } from '../constants';\nimport { Contact, Organization } from './crm';\nimport type { InterestBffMeta, OpportunityInterest } from './interests';\nimport { Payment } from './payments';\nimport { Quote, QuoteStatus } from './quotes';\nimport { OpportunityReservation } from './reservations';\nimport { BaseSearchRequest } from './search';\nimport { DataRecord, ReferenceData } from './utils';\nimport { Vehicle } from './vehicles';\n\nexport enum OpportunityActions {\n ADD_COMMISSION = 'add_commission',\n CREATE_QUOTE = 'create_quote',\n LOSE = 'lose',\n REOPEN = 'reopen',\n START_PREPARATION = 'start_preparation',\n REVERT_PREPARATION = 'revert_preparation',\n START_DELIVERY = 'start_delivery',\n REVERT_DELIVERY = 'revert_delivery',\n SET_CUSTOMER = 'set_customer',\n SET_DOCUMENTS = 'set_documents',\n SET_INTEREST = 'set_interest',\n SET_METADATA = 'set_metadata',\n SET_VEHICLE = 'set_vehicle',\n ADD_ACTIVITY = 'add_activity',\n ADD_PAYMENT = 'add_payment',\n SWITCH_VEHICLE = 'switch_vehicle',\n DELIVER_VEHICLE = 'deliver_vehicle',\n UNDO_DELIVER_VEHICLE = 'undo_deliver_vehicle',\n SET_DEAL_INFO = 'update_deal_info',\n}\n\nexport enum OpportunityDealStatus {\n SALES_AGREED = 'sales_agreed',\n FIRST_PAYMENT = 'first_payment',\n FULL_PAYMENT = 'full_payment',\n}\n\nexport enum OpportunityStatus {\n PROSPECTION = 'prospection',\n DISCOVERY = 'discovery',\n EVALUATION = 'evaluation',\n REVIEW = 'review',\n PREPARATION = 'preparation',\n DELIVERY = 'delivery',\n}\n\nexport const OpportunityStatusOrder: OpportunityStatus[] = [\n OpportunityStatus.PROSPECTION,\n OpportunityStatus.DISCOVERY,\n OpportunityStatus.EVALUATION,\n OpportunityStatus.REVIEW,\n OpportunityStatus.PREPARATION,\n OpportunityStatus.DELIVERY,\n];\n\nexport enum OpportunityLogisticStatus {\n AT_ORIGIN = 'at_origin',\n DELIVERED = 'delivered',\n}\n\nexport enum OpportunityRequirementsCode {\n VEHICLE_AT_ORIGIN = 'vehicle_at_origin',\n LEASING_SL_ACTION = 'sl_action',\n}\n\nexport enum OpportunityWarningsCode {\n QUOTE_PENDING_VALIDATION = 'quote_pending_validation',\n QUOTE_PEDING_MANAGER_APPROVAL = 'quote_pending_manager_approval',\n CONCURRENT_OPPORTUNITIES = 'concurrent_opportunities',\n VEHICLE_RESERVED = 'vehicle_reserved',\n OPPORTUNITY_NEEDS_SWITCH_VEHICLE = 'opportunity_needs_switch_vehicle',\n VEHICLE_RESERVED_DATE_INFO = 'vehicle_reserved_date_info',\n VEHICLE_RESERVED_INDEFINITELY = 'vehicle_reserved_indefinitely',\n QUOTE_MISSING_DELIVERY_DETAILS = 'quote_missing_delivery_details',\n}\n\nexport const OpportunityWonColumnId = 'closed_won';\n\nexport const OpportunityKanbanColumns = [...OpportunityStatusOrder, OpportunityWonColumnId];\n\nexport const OpportunityKanbanEndColumns: string[] = [OpportunityWonColumnId];\n\nexport enum OpportunityLostReasonValues {\n Expensive = 'expensive',\n AlreadySold = 'already_sold',\n BadExperience = 'bad_experience',\n IncorrectVehicleCondition = 'incorrect_vehicle_condition',\n NoStock = 'not_enough_stock',\n SlowDelivery = 'slow_delivery',\n HighDeposit = 'deposit_too_high',\n NoAnswer = 'client_not_answered',\n Automatic = 'automatic',\n}\n\ntype BaseBid = {\n vehicleId: string;\n opportunityId?: string;\n contactId: string;\n amount: string;\n};\n\nexport type NewBid = BaseBid & {};\n\nexport type Bid = BaseBid & {\n id: string;\n createdAt: string;\n createdBy: string;\n};\n\ntype BaseOpportunity = {\n accountManager?: string;\n administrativePerson?: string;\n type: OpportunityType;\n organizationId?: string;\n contactId?: string;\n vehicleId?: string;\n source?: string; // e.g. website, autoscout, mobile...\n branch: string;\n inquiry?: string;\n branchCountry: string;\n};\n\nexport type NewOpportunity = BaseOpportunity & {\n id?: undefined;\n createdAt?: undefined;\n createdBy?: undefined;\n modifiedAt?: undefined;\n modifiedBy?: undefined;\n};\n\nexport type Opportunity = BaseOpportunity & {\n id: string;\n createdAt: string;\n createdBy: string;\n modifiedAt: string;\n modifiedBy: string;\n engagedAt?: string;\n engagedBy?: string;\n validatedAt?: string;\n validatedBy?: string;\n acceptedAt?: string;\n acceptedBy?: string;\n lastActivityAt?: string; // last time we reached out to the customer, regardless of medium\n reviewedAt?: string;\n reviewedBy?: string;\n preparedAt?: string;\n preparedBy?: string;\n lastBidAt?: string;\n lostAt?: string;\n lostBy?: string;\n wonAt?: string;\n lostReason?: OpportunityLostReasonValues;\n deliveredAt?: string;\n deliveredBy?: string;\n status: OpportunityStatus;\n dealStatus?: OpportunityDealStatus;\n logisticStatus?: OpportunityLogisticStatus;\n activeQuoteId?: string;\n amount?: string;\n documents?: Document[];\n leasingContractId?: string;\n requirementsOverride?: {\n [code: string]: { override: true; reason?: string; actionAt: string; actionBy: string };\n };\n};\n\nexport type OpportunityUpdate = {\n vehicleId?: string | null;\n accountManager?: string | null;\n administrativePerson?: string | null;\n contactId?: string | null;\n activeQuoteId?: string | null;\n reviewed?: boolean;\n prepared?: boolean;\n lost?: boolean;\n delivered?: boolean;\n lostReason?: OpportunityLostReasonValues;\n documents?: Document[];\n branch?: string;\n branchCountry?: string;\n type?: OpportunityType;\n lastActivityAt?: string | null; // null gives the possibility to delete this field if all activities are deleted\n lastBidAt?: string;\n source?: string | null;\n requirementsOverride?: {\n [code: string]: { override: true; reason?: string; actionAt: string; actionBy: string };\n };\n};\n\nexport type PaymentSummary = {\n total: string;\n paid: string;\n entries: DataRecord<Payment>[];\n};\n\nexport type VehicleBffMetadata = {\n openOpportunities: number;\n otherRelatedVehicleIds: string[];\n};\n\nexport type OpportunityStatusRequirement = { code: OpportunityRequirementsCode; title?: string };\n\ntype OportunityWarningActionLink = {\n businessEntityId: BusinessEntityIds;\n recordId: string;\n};\n\ntype OportunityWarningActionData = { [key: string]: string | number };\n\nexport type OpportunityWarning = {\n code: OpportunityWarningsCode;\n level: WarningHints;\n link?: OportunityWarningActionLink;\n data?: OportunityWarningActionData;\n showAction?: boolean;\n};\n\nexport type OpportunityBffMeta = ReferenceData & {\n requirements: OpportunityStatusRequirement[];\n warnings: OpportunityWarning[];\n};\n\nexport type OpportunityBFF = {\n opportunity: DataRecord<Opportunity, OpportunityBffMeta>;\n vehicle?: DataRecord<Vehicle, VehicleBffMetadata>;\n interest?: DataRecord<OpportunityInterest, InterestBffMeta>;\n bids: DataRecord<Bid>[];\n quotes: DataRecord<Quote>[];\n activeQuote?: DataRecord<Quote>;\n payments: PaymentSummary | undefined;\n reservation?: DataRecord<OpportunityReservation>;\n customer?: {\n contact: DataRecord<Contact>;\n org?: DataRecord<Organization>;\n };\n};\n\ntype BaseOpportunityEvent = {\n actionAt: string;\n userId: string;\n tenantId: string;\n};\n\nexport type OpportunityCreateEvent = BaseOpportunityEvent & {\n opportunity: Opportunity;\n previousOpportunity?: undefined;\n action: 'create';\n};\n\nexport type OpportunityUpdateEvent = BaseOpportunityEvent & {\n opportunity: Opportunity;\n previousOpportunity: Opportunity;\n action: 'update';\n};\n\nexport type OpportunityDeleteEvent = BaseOpportunityEvent & {\n opportunity?: undefined;\n previousOpportunity: Opportunity;\n action: 'delete';\n};\n\nexport type OpportunityEvent =\n | OpportunityCreateEvent\n | OpportunityUpdateEvent\n | OpportunityDeleteEvent;\n\nexport type QuoteEvent = {\n quote: Quote;\n opportunity: Opportunity;\n action: 'create' | 'update' | 'delete';\n actionAt: string;\n userId: string;\n tenantId: string;\n};\n\n/* Quote summary with information that should be common to different types of quotes */\nexport type QuoteInfo = {\n status: QuoteStatus;\n roi: string;\n id: string;\n};\n\nexport type SearchOpportunity = {\n contact?: Contact;\n opportunity: Opportunity;\n org?: Organization;\n vehicle?: Vehicle;\n quote?: QuoteInfo;\n custom: {\n unassigned: boolean;\n lost: boolean;\n assignees: string[];\n };\n};\n\nexport const QUOTE_NEEDS_VALIDATION_NOTIFICATION_ORIGIN = 'quote-validation';\nexport const QUOTE_VALIDATOR_FEEDBACK_NOTIFICATION_ORIGIN = 'quote-validation-feedback';\nexport const OPPORTUNITY_VEHICLE_AVAILABLE_NOTIFICATION_ORIGIN = 'opportunity-vehicle-available';\nexport const OPPORTUNITY_VEHICLE_DELIVERY_NOTIFICATION_ORIGIN = 'opportunity-vehicle-delivery';\n\nexport type OpportunityNotificationData = {\n quoteVersion?: number;\n snippet?: string;\n};\n\nexport type LeasingQuoteTemplateData = {\n opportunity: {\n id: string;\n };\n currentDate: string;\n vehicle: {\n make: string;\n model: string;\n type?: string;\n km: string | number;\n vin: string;\n mainImage: string;\n localLicensePlate: boolean;\n description: string;\n year?: string | number;\n stockNumber?: string;\n };\n accountManager: {\n fullName: string;\n email: string;\n phone: string;\n };\n customer: {\n company: string;\n fullName: string;\n vatNumber?: string;\n address?: string;\n };\n settingId: string;\n leasing: {\n deposit: string;\n startupFee: string;\n totalExtras: string;\n totalBeforeDeliveryExclVat: string;\n totalBeforeDelivery: string;\n installment: string;\n duration: number;\n monthlyInsurance: string;\n monthlyTax: string;\n monthlyTaxesInsurance: string;\n residual: string;\n offerNumber: string;\n extras: { name: string }[];\n };\n};\n\nexport type LineItemPdfTemplate = {\n description: string;\n vat: string;\n quantity: number;\n unitPriceExclVat: string;\n amount: string;\n amountExclVat: string;\n};\n\nexport type LeasingProformaTemplateData = {\n opportunity: {\n id: string;\n offerNumber: string;\n };\n currentDate: string;\n accountManager: {\n fullName: string;\n email: string;\n phone: string;\n };\n vehicle: {\n line1: string;\n line2: string;\n stockNumber: string;\n };\n c: {\n organizationId?: string;\n clientId: string;\n company: string;\n fullName: string;\n vatNumber?: string;\n email?: string;\n phone?: string;\n address?: string;\n };\n i: LineItemPdfTemplate[];\n t: {\n totalExclVat: string;\n vatAmount: string;\n displayVatMessage: boolean;\n total: string;\n monthly: string;\n monthlyExclVat: string;\n residual: string;\n residualExclVat: string;\n duration: number;\n };\n};\n\nexport type SalesProformaTemplateData = {\n opportunity: {\n id: string;\n offerNumber: string;\n };\n currentDate: string;\n expirationDate: string;\n accountManager: {\n fullName: string;\n email: string;\n phone: string;\n };\n vehicle: {\n line1: string;\n line2: string;\n stockNumber: string;\n };\n c: {\n organizationId?: string;\n clientId: string;\n company: string;\n fullName: string;\n vatNumber?: string;\n email?: string;\n phone?: string;\n address?: string;\n };\n i: LineItemPdfTemplate[];\n t: {\n totalExclVat: string;\n vatAmount: string;\n total: string;\n };\n};\n\nexport type SalesAgreementTemplateData = {\n opportunity: {\n id: string;\n offerNumber: string;\n };\n currentDate: string;\n accountManager: {\n fullName: string;\n email: string;\n phone: string;\n };\n vehicle: {\n line1: string;\n line2: string;\n stockNumber: string;\n };\n c: {\n organizationId?: string;\n clientId: string;\n company: string;\n fullName: string;\n vatNumber?: string;\n email?: string;\n phone?: string;\n address?: string;\n };\n i: LineItemPdfTemplate[];\n t: {\n totalExclVat: string;\n vatAmount: string;\n total: string;\n };\n};\n\nexport type OpportunitiesKanbanColumn = {\n status: string;\n results: SearchOpportunity[];\n totalCount: number;\n totalValue: string;\n};\n\nexport type MSearchOpportunitiesKanbanColumn = {\n column: OpportunitiesKanbanColumn;\n nextToken?: string;\n};\n\nexport type HpLeasingDealRequest = {\n tenantId: string;\n initiatedBy: 'bisondesk';\n processMetaId: string;\n processRunData: {\n entityOwner: string;\n leasingContractOwner: string;\n foreseenDeliveryDate?: string;\n deliveryAddressLeasing?: string;\n nameSalesPerson: string;\n durationLeasingInMonths: number;\n vanCourier: boolean;\n newVehicle?: boolean;\n newTrailer?: boolean;\n registrationOnTtcoBe?: string;\n yearOfConstruction?: number;\n chassisnumber?: string;\n vehicleModel?: string;\n vehicleCategory2?: string;\n licencePlate?: string;\n vatPercentage?: number;\n\n opportunityContractId: string;\n opportunityId: string;\n\n company?: string;\n customerNumber?: number; //bisondesk external id\n //MrLease fields\n vehicle?: string;\n salesPriceEur: string;\n depositFullAmountExclVat: string;\n depositToBePrepaidExclVat: string;\n vehicleMake3?: string;\n\n //TTC fields\n vehicleOriginalReference?: string;\n salesPrice: string;\n depositFullAmount: string;\n depositAmountToBePrepaid: string;\n make?: string;\n\n //Extras\n garageExtrasCodes: string[];\n allExtrasDescriptions: string[];\n administrationExtrasCodes: string[];\n logisticExtrasCodes: string[];\n customRequestDescriptions: string[];\n };\n};\n\nexport type HpLeasingDealResponse = {\n entityId: string;\n id: string;\n status: string;\n leasingContractNumber?: string;\n};\n\nexport type HpLeasingContractRequest = {\n tenantId: string;\n initiatedBy: 'bisondesk';\n processMetaId: string;\n processRunData: {\n entityOwner: string;\n company?: string;\n vehicle?: string;\n ldNumber: number;\n vanCourier: boolean;\n startDate: number;\n opportunityContractId: string;\n data: {\n leasingParameter: {\n allRisksPercentage: number;\n allRisksTaxPercentage: number;\n civilLiability: number;\n entityId: string;\n oneTimeRoadTax: number;\n specialInsurance: number;\n yearlyRoadTax: number;\n countries: string[];\n vehicleCategory: string;\n };\n\n calculatorRequest: {\n bankDeposit: number;\n bankDurationInMonths: number;\n bankInterestRatePercentage: number;\n bankResidualValue: number;\n deposit: number;\n durationInMonths: number;\n includesAllRisks: boolean;\n includesCivilLiability: boolean;\n includesOneTimeRoadTax: boolean;\n includesSpecialInsurance: boolean;\n includesYearlyRoadTax: boolean;\n insuranceAmount: number;\n interestRatePercentage: number;\n marginPercentage: number;\n monthlyAdministrationFee: 0;\n purchasePrice: number;\n residualValue: number;\n salesPrice: number;\n startupFeePercentage: number;\n };\n\n calculatorResponse: {\n ROI: number;\n ROIDifference: number;\n ROIPerYear: number;\n ROITarget: number;\n allRisksInsuranceAmount: number;\n bankContractValue: number;\n bankLeasingAmount: number;\n cashDeficit: number;\n financingAmount: number;\n leasingAmount: number;\n leasingContractValue: number;\n leasingProfit: number;\n monthlyTaxRetailPrice: number;\n oneTimeTaxCost: number;\n totalMonthlyPayment: number;\n totalProfit: number;\n vehicleProfit: number;\n };\n\n cashInValues: CashInRow[];\n\n cashOutValues: CashOutRow[];\n };\n };\n};\n\nexport type HpLeasingContractResponse = {\n entityId: string;\n id: string;\n status: string;\n createdAt: string;\n updatedAt: string;\n dateOfFinalSettlement: string;\n startDate: string;\n email: string;\n contractNumber: string;\n};\n\nexport type CashInRow = {\n time: number;\n deposit: number;\n monthlyAdministrationFee: 0; //Legacy field - Should always be 0\n residualValue: number;\n startupFee: number;\n leasingAmountWithoutAdminFee: number;\n insurancePayment: number;\n taxPayment: number;\n cashIn: number;\n cumulativeCash: number;\n};\n\nexport type CashOutRow = {\n time: number;\n deposit: number;\n residualValue: number;\n leasingAmount: number;\n insurancePayment: number;\n taxPayment: number;\n cashOut: number;\n cumulativeCash: number;\n};\n\nexport type HpDeliveryFields = {\n detailsOfStacking?: string | null;\n technicalControlNeeded: boolean | null;\n\n //PickUP Delivery\n urgentDelivery?: boolean | null;\n dateOfPickUpByCustomer?: number | null;\n modeOfTransportPickUpByCustomer?: string | null; //entity Id\n detailsOfBorderCrossing?: string | null;\n insuranceNeeded: boolean | null;\n transitPlateNeeded: boolean | null;\n licensePlateNeeded: boolean | null;\n\n //Address Delivery\n address?: string | null;\n kmToAddressOfDelivery?: number | null;\n\n //To Port Delivery\n originPortText?: string | null; //entity Id\n shippingCompany?: string | null; //string Id\n destinationPort?: string | null;\n cleaningDegassingNeeded: boolean | null;\n};\n\nexport type HpIsaProcessRequest = {\n tenantId: string;\n initiatedBy: 'bisondesk';\n processMetaId: string;\n processRunData: HpDeliveryFields & {\n entityOwner: string;\n nameSalesPerson: string;\n\n company?: string; //entityId\n proofOfSaleCustomerAgreement?: string; //entityId\n\n vehicle?: string; //entityId\n bodywork?: string; //entityId\n vehicleCategory: string; //entityId\n\n amountOfCommissionPaid: number;\n dealValidated: boolean;\n dealCancelled: boolean;\n opportunityId: string;\n deliveryType: string; //entity Id\n directDelivery?: boolean | null;\n directDeliveryReason?: string | null;\n agreedPrice?: string;\n\n //Extras\n garageExtrasCodes: string[];\n logisticsExtrasCodes: string[];\n administrationExtrasCodes: string[];\n allExtrasDescriptions: string[];\n customRequestDescriptions: string[];\n infoSpoiler: string; // entity Id\n };\n};\n\nexport type HpIsaProcessResponse = {\n entityId: string;\n id: string;\n status: string;\n};\n\nexport type SwitchOpportunityVehicleRequest = {\n opportunityId: string;\n newVehicleId: string;\n};\n\nexport type KanbanOpportunitiesSearchRequest = BaseSearchRequest & {\n nextTokens?: Record<string, string | undefined>;\n};\n\nexport type KanbanOpportunitiesNextList = Omit<\n NextList<OpportunitiesKanbanColumn, ReferenceData>,\n 'nextToken'\n> & {\n nextTokens?: Record<string, string | undefined>;\n};\n"]}
1
+ {"version":3,"file":"opportunities.js","sourceRoot":"/","sources":["types/opportunities.ts"],"names":[],"mappings":";;;AAWA,IAAY,kBAoBX;AApBD,WAAY,kBAAkB;IAC5B,uDAAiC,CAAA;IACjC,mDAA6B,CAAA;IAC7B,mCAAa,CAAA;IACb,uCAAiB,CAAA;IACjB,6DAAuC,CAAA;IACvC,+DAAyC,CAAA;IACzC,uDAAiC,CAAA;IACjC,yDAAmC,CAAA;IACnC,mDAA6B,CAAA;IAC7B,qDAA+B,CAAA;IAC/B,mDAA6B,CAAA;IAC7B,mDAA6B,CAAA;IAC7B,iDAA2B,CAAA;IAC3B,mDAA6B,CAAA;IAC7B,iDAA2B,CAAA;IAC3B,uDAAiC,CAAA;IACjC,yDAAmC,CAAA;IACnC,mEAA6C,CAAA;IAC7C,wDAAkC,CAAA;AACpC,CAAC,EApBW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAoB7B;AAED,IAAY,qBAIX;AAJD,WAAY,qBAAqB;IAC/B,sDAA6B,CAAA;IAC7B,wDAA+B,CAAA;IAC/B,sDAA6B,CAAA;AAC/B,CAAC,EAJW,qBAAqB,GAArB,6BAAqB,KAArB,6BAAqB,QAIhC;AAED,IAAY,iBAOX;AAPD,WAAY,iBAAiB;IAC3B,gDAA2B,CAAA;IAC3B,4CAAuB,CAAA;I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,CAAA;IAC9B,+DAAgC,CAAA;IAChC,+DAAgC,CAAA;IAChC,sDAAuB,CAAA;AACzB,CAAC,EAVW,2BAA2B,GAA3B,mCAA2B,KAA3B,mCAA2B,QAUtC;AA6MY,QAAA,0CAA0C,GAAG,kBAAkB,CAAC;AAChE,QAAA,4CAA4C,GAAG,2BAA2B,CAAC;AAC3E,QAAA,iDAAiD,GAAG,+BAA+B,CAAC;AACpF,QAAA,gDAAgD,GAAG,8BAA8B,CAAC","sourcesContent":["import { Document, NextList } from '@bisondesk/commons-sdk/types';\nimport { BusinessEntityIds, OpportunityType, WarningHints } from '../constants';\nimport { Contact, Organization } from './crm';\nimport type { InterestBffMeta, OpportunityInterest } from './interests';\nimport { Payment } from './payments';\nimport { Quote, QuoteStatus } from './quotes';\nimport { OpportunityReservation } from './reservations';\nimport { BaseSearchRequest } from './search';\nimport { DataRecord, ReferenceData } from './utils';\nimport { Vehicle } from './vehicles';\n\nexport enum OpportunityActions {\n ADD_COMMISSION = 'add_commission',\n CREATE_QUOTE = 'create_quote',\n LOSE = 'lose',\n REOPEN = 'reopen',\n START_PREPARATION = 'start_preparation',\n REVERT_PREPARATION = 'revert_preparation',\n START_DELIVERY = 'start_delivery',\n REVERT_DELIVERY = 'revert_delivery',\n SET_CUSTOMER = 'set_customer',\n SET_DOCUMENTS = 'set_documents',\n SET_INTEREST = 'set_interest',\n SET_METADATA = 'set_metadata',\n SET_VEHICLE = 'set_vehicle',\n ADD_ACTIVITY = 'add_activity',\n ADD_PAYMENT = 'add_payment',\n SWITCH_VEHICLE = 'switch_vehicle',\n DELIVER_VEHICLE = 'deliver_vehicle',\n UNDO_DELIVER_VEHICLE = 'undo_deliver_vehicle',\n SET_DEAL_INFO = 'update_deal_info',\n}\n\nexport enum OpportunityDealStatus {\n SALES_AGREED = 'sales_agreed',\n FIRST_PAYMENT = 'first_payment',\n FULL_PAYMENT = 'full_payment',\n}\n\nexport enum OpportunityStatus {\n PROSPECTION = 'prospection',\n DISCOVERY = 'discovery',\n EVALUATION = 'evaluation',\n REVIEW = 'review',\n PREPARATION = 'preparation',\n DELIVERY = 'delivery',\n}\n\nexport const OpportunityStatusOrder: OpportunityStatus[] = [\n OpportunityStatus.PROSPECTION,\n OpportunityStatus.DISCOVERY,\n OpportunityStatus.EVALUATION,\n OpportunityStatus.REVIEW,\n OpportunityStatus.PREPARATION,\n OpportunityStatus.DELIVERY,\n];\n\nexport enum OpportunityLogisticStatus {\n AT_ORIGIN = 'at_origin',\n DELIVERED = 'delivered',\n}\n\nexport enum OpportunityRequirementsCode {\n VEHICLE_AT_ORIGIN = 'vehicle_at_origin',\n LEASING_SL_ACTION = 'sl_action',\n}\n\nexport enum OpportunityWarningsCode {\n QUOTE_PENDING_VALIDATION = 'quote_pending_validation',\n QUOTE_PEDING_MANAGER_APPROVAL = 'quote_pending_manager_approval',\n CONCURRENT_OPPORTUNITIES = 'concurrent_opportunities',\n VEHICLE_RESERVED = 'vehicle_reserved',\n OPPORTUNITY_NEEDS_SWITCH_VEHICLE = 'opportunity_needs_switch_vehicle',\n VEHICLE_RESERVED_DATE_INFO = 'vehicle_reserved_date_info',\n VEHICLE_RESERVED_INDEFINITELY = 'vehicle_reserved_indefinitely',\n QUOTE_MISSING_DELIVERY_DETAILS = 'quote_missing_delivery_details',\n}\n\nexport const OpportunityWonColumnId = 'closed_won';\n\nexport const OpportunityKanbanColumns = [...OpportunityStatusOrder, OpportunityWonColumnId];\n\nexport const OpportunityKanbanEndColumns: string[] = [OpportunityWonColumnId];\n\nexport enum OpportunityLostReasonValues {\n Expensive = 'expensive',\n AlreadySold = 'already_sold',\n BadExperience = 'bad_experience',\n IncorrectVehicleCondition = 'incorrect_vehicle_condition',\n NoStock = 'not_enough_stock',\n SlowDelivery = 'slow_delivery',\n HighDeposit = 'deposit_too_high',\n NoAnswer = 'client_not_answered',\n Automatic = 'automatic',\n}\n\ntype BaseBid = {\n vehicleId: string;\n opportunityId?: string;\n contactId: string;\n amount: string;\n};\n\nexport type NewBid = BaseBid & {};\n\nexport type Bid = BaseBid & {\n id: string;\n createdAt: string;\n createdBy: string;\n};\n\ntype BaseOpportunity = {\n accountManager?: string;\n administrativePerson?: string;\n type: OpportunityType;\n organizationId?: string;\n contactId?: string;\n vehicleId?: string;\n source?: string; // e.g. website, autoscout, mobile...\n branch: string;\n inquiry?: string;\n branchCountry: string;\n};\n\nexport type NewOpportunity = BaseOpportunity & {\n id?: undefined;\n createdAt?: undefined;\n createdBy?: undefined;\n modifiedAt?: undefined;\n modifiedBy?: undefined;\n};\n\nexport type Opportunity = BaseOpportunity & {\n id: string;\n createdAt: string;\n createdBy: string;\n modifiedAt: string;\n modifiedBy: string;\n engagedAt?: string;\n engagedBy?: string;\n validatedAt?: string;\n validatedBy?: string;\n acceptedAt?: string;\n acceptedBy?: string;\n lastActivityAt?: string; // last time we reached out to the customer, regardless of medium\n reviewedAt?: string;\n reviewedBy?: string;\n preparedAt?: string;\n preparedBy?: string;\n lastBidAt?: string;\n lostAt?: string;\n lostBy?: string;\n wonAt?: string;\n lostReason?: OpportunityLostReasonValues;\n deliveredAt?: string;\n deliveredBy?: string;\n status: OpportunityStatus;\n dealStatus?: OpportunityDealStatus;\n logisticStatus?: OpportunityLogisticStatus;\n activeQuoteId?: string;\n amount?: string;\n documents?: Document[];\n leasingContractId?: string;\n requirementsOverride?: {\n [code: string]: { override: true; reason?: string; actionAt: string; actionBy: string };\n };\n};\n\nexport type OpportunityUpdate = {\n vehicleId?: string | null;\n accountManager?: string | null;\n administrativePerson?: string | null;\n contactId?: string | null;\n activeQuoteId?: string | null;\n reviewed?: boolean;\n prepared?: boolean;\n lost?: boolean;\n delivered?: boolean;\n lostReason?: OpportunityLostReasonValues;\n documents?: Document[];\n branch?: string;\n branchCountry?: string;\n type?: OpportunityType;\n lastActivityAt?: string | null; // null gives the possibility to delete this field if all activities are deleted\n lastBidAt?: string;\n source?: string | null;\n requirementsOverride?: {\n [code: string]: { override: true; reason?: string; actionAt: string; actionBy: string };\n };\n};\n\nexport type PaymentSummary = {\n total: string;\n paid: string;\n entries: DataRecord<Payment>[];\n};\n\nexport type VehicleBffMetadata = {\n openOpportunities: number;\n otherRelatedVehicleIds: string[];\n};\n\nexport type OpportunityStatusRequirement = { code: OpportunityRequirementsCode; title?: string };\n\ntype OportunityWarningActionLink = {\n businessEntityId: BusinessEntityIds;\n recordId: string;\n};\n\ntype OportunityWarningActionData = { [key: string]: string | number };\n\nexport type OpportunityWarning = {\n code: OpportunityWarningsCode;\n level: WarningHints;\n link?: OportunityWarningActionLink;\n data?: OportunityWarningActionData;\n showAction?: boolean;\n};\n\nexport type OpportunityBffMeta = ReferenceData & {\n requirements: OpportunityStatusRequirement[];\n warnings: OpportunityWarning[];\n};\n\nexport type OpportunityBFF = {\n opportunity: DataRecord<Opportunity, OpportunityBffMeta>;\n vehicle?: DataRecord<Vehicle, VehicleBffMetadata>;\n interest?: DataRecord<OpportunityInterest, InterestBffMeta>;\n bids: DataRecord<Bid>[];\n quotes: DataRecord<Quote>[];\n activeQuote?: DataRecord<Quote>;\n payments: PaymentSummary | undefined;\n reservation?: DataRecord<OpportunityReservation>;\n customer?: {\n contact: DataRecord<Contact>;\n org?: DataRecord<Organization>;\n };\n};\n\ntype BaseOpportunityEvent = {\n actionAt: string;\n userId: string;\n tenantId: string;\n};\n\nexport type OpportunityCreateEvent = BaseOpportunityEvent & {\n opportunity: Opportunity;\n previousOpportunity?: undefined;\n action: 'create';\n};\n\nexport type OpportunityUpdateEvent = BaseOpportunityEvent & {\n opportunity: Opportunity;\n previousOpportunity: Opportunity;\n action: 'update';\n};\n\nexport type OpportunityDeleteEvent = BaseOpportunityEvent & {\n opportunity?: undefined;\n previousOpportunity: Opportunity;\n action: 'delete';\n};\n\nexport type OpportunityEvent =\n | OpportunityCreateEvent\n | OpportunityUpdateEvent\n | OpportunityDeleteEvent;\n\nexport type QuoteEvent = {\n quote: Quote;\n opportunity: Opportunity;\n action: 'create' | 'update' | 'delete';\n actionAt: string;\n userId: string;\n tenantId: string;\n};\n\n/* Quote summary with information that should be common to different types of quotes */\nexport type QuoteInfo = {\n status: QuoteStatus;\n roi: string;\n id: string;\n};\n\nexport type SearchOpportunity = {\n contact?: Contact;\n opportunity: Opportunity;\n org?: Organization;\n vehicle?: Vehicle;\n quote?: QuoteInfo;\n custom: {\n anyPaymentCollected: boolean;\n unassigned: boolean;\n lost: boolean;\n assignees: string[];\n vehicleCheckedIn: boolean;\n };\n};\n\nexport const QUOTE_NEEDS_VALIDATION_NOTIFICATION_ORIGIN = 'quote-validation';\nexport const QUOTE_VALIDATOR_FEEDBACK_NOTIFICATION_ORIGIN = 'quote-validation-feedback';\nexport const OPPORTUNITY_VEHICLE_AVAILABLE_NOTIFICATION_ORIGIN = 'opportunity-vehicle-available';\nexport const OPPORTUNITY_VEHICLE_DELIVERY_NOTIFICATION_ORIGIN = 'opportunity-vehicle-delivery';\n\nexport type OpportunityNotificationData = {\n quoteVersion?: number;\n snippet?: string;\n};\n\nexport type LeasingQuoteTemplateData = {\n opportunity: {\n id: string;\n };\n currentDate: string;\n vehicle: {\n make: string;\n model: string;\n type?: string;\n km: string | number;\n vin: string;\n mainImage: string;\n localLicensePlate: boolean;\n description: string;\n year?: string | number;\n stockNumber?: string;\n };\n accountManager: {\n fullName: string;\n email: string;\n phone: string;\n };\n customer: {\n company: string;\n fullName: string;\n vatNumber?: string;\n address?: string;\n };\n settingId: string;\n leasing: {\n deposit: string;\n startupFee: string;\n totalExtras: string;\n totalBeforeDeliveryExclVat: string;\n totalBeforeDelivery: string;\n installment: string;\n duration: number;\n monthlyInsurance: string;\n monthlyTax: string;\n monthlyTaxesInsurance: string;\n residual: string;\n offerNumber: string;\n extras: { name: string }[];\n };\n};\n\nexport type LineItemPdfTemplate = {\n description: string;\n vat: string;\n quantity: number;\n unitPriceExclVat: string;\n amount: string;\n amountExclVat: string;\n};\n\nexport type LeasingProformaTemplateData = {\n opportunity: {\n id: string;\n offerNumber: string;\n };\n currentDate: string;\n accountManager: {\n fullName: string;\n email: string;\n phone: string;\n };\n vehicle: {\n line1: string;\n line2: string;\n stockNumber: string;\n };\n c: {\n organizationId?: string;\n clientId: string;\n company: string;\n fullName: string;\n vatNumber?: string;\n email?: string;\n phone?: string;\n address?: string;\n };\n i: LineItemPdfTemplate[];\n t: {\n totalExclVat: string;\n vatAmount: string;\n displayVatMessage: boolean;\n total: string;\n monthly: string;\n monthlyExclVat: string;\n residual: string;\n residualExclVat: string;\n duration: number;\n };\n};\n\nexport type SalesProformaTemplateData = {\n opportunity: {\n id: string;\n offerNumber: string;\n };\n currentDate: string;\n expirationDate: string;\n accountManager: {\n fullName: string;\n email: string;\n phone: string;\n };\n vehicle: {\n line1: string;\n line2: string;\n stockNumber: string;\n };\n c: {\n organizationId?: string;\n clientId: string;\n company: string;\n fullName: string;\n vatNumber?: string;\n email?: string;\n phone?: string;\n address?: string;\n };\n i: LineItemPdfTemplate[];\n t: {\n totalExclVat: string;\n vatAmount: string;\n total: string;\n };\n};\n\nexport type SalesAgreementTemplateData = {\n opportunity: {\n id: string;\n offerNumber: string;\n };\n currentDate: string;\n accountManager: {\n fullName: string;\n email: string;\n phone: string;\n };\n vehicle: {\n line1: string;\n line2: string;\n stockNumber: string;\n };\n c: {\n organizationId?: string;\n clientId: string;\n company: string;\n fullName: string;\n vatNumber?: string;\n email?: string;\n phone?: string;\n address?: string;\n };\n i: LineItemPdfTemplate[];\n t: {\n totalExclVat: string;\n vatAmount: string;\n total: string;\n };\n};\n\nexport type OpportunitiesKanbanColumn = {\n status: string;\n results: SearchOpportunity[];\n totalCount: number;\n totalValue: string;\n};\n\nexport type MSearchOpportunitiesKanbanColumn = {\n column: OpportunitiesKanbanColumn;\n nextToken?: string;\n};\n\nexport type HpLeasingDealRequest = {\n tenantId: string;\n initiatedBy: 'bisondesk';\n processMetaId: string;\n processRunData: {\n entityOwner: string;\n leasingContractOwner: string;\n foreseenDeliveryDate?: string;\n deliveryAddressLeasing?: string;\n nameSalesPerson: string;\n durationLeasingInMonths: number;\n vanCourier: boolean;\n newVehicle?: boolean;\n newTrailer?: boolean;\n registrationOnTtcoBe?: string;\n yearOfConstruction?: number;\n chassisnumber?: string;\n vehicleModel?: string;\n vehicleCategory2?: string;\n licencePlate?: string;\n vatPercentage?: number;\n\n opportunityContractId: string;\n opportunityId: string;\n\n company?: string;\n customerNumber?: number; //bisondesk external id\n //MrLease fields\n vehicle?: string;\n salesPriceEur: string;\n depositFullAmountExclVat: string;\n depositToBePrepaidExclVat: string;\n vehicleMake3?: string;\n\n //TTC fields\n vehicleOriginalReference?: string;\n salesPrice: string;\n depositFullAmount: string;\n depositAmountToBePrepaid: string;\n make?: string;\n\n //Extras\n garageExtrasCodes: string[];\n allExtrasDescriptions: string[];\n administrationExtrasCodes: string[];\n logisticExtrasCodes: string[];\n customRequestDescriptions: string[];\n };\n};\n\nexport type HpLeasingDealResponse = {\n entityId: string;\n id: string;\n status: string;\n leasingContractNumber?: string;\n};\n\nexport type HpLeasingContractRequest = {\n tenantId: string;\n initiatedBy: 'bisondesk';\n processMetaId: string;\n processRunData: {\n entityOwner: string;\n company?: string;\n vehicle?: string;\n ldNumber: number;\n vanCourier: boolean;\n startDate: number;\n opportunityContractId: string;\n data: {\n leasingParameter: {\n allRisksPercentage: number;\n allRisksTaxPercentage: number;\n civilLiability: number;\n entityId: string;\n oneTimeRoadTax: number;\n specialInsurance: number;\n yearlyRoadTax: number;\n countries: string[];\n vehicleCategory: string;\n };\n\n calculatorRequest: {\n bankDeposit: number;\n bankDurationInMonths: number;\n bankInterestRatePercentage: number;\n bankResidualValue: number;\n deposit: number;\n durationInMonths: number;\n includesAllRisks: boolean;\n includesCivilLiability: boolean;\n includesOneTimeRoadTax: boolean;\n includesSpecialInsurance: boolean;\n includesYearlyRoadTax: boolean;\n insuranceAmount: number;\n interestRatePercentage: number;\n marginPercentage: number;\n monthlyAdministrationFee: 0;\n purchasePrice: number;\n residualValue: number;\n salesPrice: number;\n startupFeePercentage: number;\n };\n\n calculatorResponse: {\n ROI: number;\n ROIDifference: number;\n ROIPerYear: number;\n ROITarget: number;\n allRisksInsuranceAmount: number;\n bankContractValue: number;\n bankLeasingAmount: number;\n cashDeficit: number;\n financingAmount: number;\n leasingAmount: number;\n leasingContractValue: number;\n leasingProfit: number;\n monthlyTaxRetailPrice: number;\n oneTimeTaxCost: number;\n totalMonthlyPayment: number;\n totalProfit: number;\n vehicleProfit: number;\n };\n\n cashInValues: CashInRow[];\n\n cashOutValues: CashOutRow[];\n };\n };\n};\n\nexport type HpLeasingContractResponse = {\n entityId: string;\n id: string;\n status: string;\n createdAt: string;\n updatedAt: string;\n dateOfFinalSettlement: string;\n startDate: string;\n email: string;\n contractNumber: string;\n};\n\nexport type CashInRow = {\n time: number;\n deposit: number;\n monthlyAdministrationFee: 0; //Legacy field - Should always be 0\n residualValue: number;\n startupFee: number;\n leasingAmountWithoutAdminFee: number;\n insurancePayment: number;\n taxPayment: number;\n cashIn: number;\n cumulativeCash: number;\n};\n\nexport type CashOutRow = {\n time: number;\n deposit: number;\n residualValue: number;\n leasingAmount: number;\n insurancePayment: number;\n taxPayment: number;\n cashOut: number;\n cumulativeCash: number;\n};\n\nexport type HpDeliveryFields = {\n detailsOfStacking?: string | null;\n technicalControlNeeded: boolean | null;\n\n //PickUP Delivery\n urgentDelivery?: boolean | null;\n dateOfPickUpByCustomer?: number | null;\n modeOfTransportPickUpByCustomer?: string | null; //entity Id\n detailsOfBorderCrossing?: string | null;\n insuranceNeeded: boolean | null;\n transitPlateNeeded: boolean | null;\n licensePlateNeeded: boolean | null;\n\n //Address Delivery\n address?: string | null;\n kmToAddressOfDelivery?: number | null;\n\n //To Port Delivery\n originPortText?: string | null; //entity Id\n shippingCompany?: string | null; //string Id\n destinationPort?: string | null;\n cleaningDegassingNeeded: boolean | null;\n};\n\nexport type HpIsaProcessRequest = {\n tenantId: string;\n initiatedBy: 'bisondesk';\n processMetaId: string;\n processRunData: HpDeliveryFields & {\n entityOwner: string;\n nameSalesPerson: string;\n\n company?: string; //entityId\n proofOfSaleCustomerAgreement?: string; //entityId\n\n vehicle?: string; //entityId\n bodywork?: string; //entityId\n vehicleCategory: string; //entityId\n\n amountOfCommissionPaid: number;\n dealValidated: boolean;\n dealCancelled: boolean;\n opportunityId: string;\n deliveryType: string; //entity Id\n directDelivery?: boolean | null;\n directDeliveryReason?: string | null;\n agreedPrice?: string;\n\n //Extras\n garageExtrasCodes: string[];\n logisticsExtrasCodes: string[];\n administrationExtrasCodes: string[];\n allExtrasDescriptions: string[];\n customRequestDescriptions: string[];\n infoSpoiler: string; // entity Id\n };\n};\n\nexport type HpIsaProcessResponse = {\n entityId: string;\n id: string;\n status: string;\n};\n\nexport type SwitchOpportunityVehicleRequest = {\n opportunityId: string;\n newVehicleId: string;\n};\n\nexport type KanbanOpportunitiesSearchRequest = BaseSearchRequest & {\n nextTokens?: Record<string, string | undefined>;\n};\n\nexport type KanbanOpportunitiesNextList = Omit<\n NextList<OpportunitiesKanbanColumn, ReferenceData>,\n 'nextToken'\n> & {\n nextTokens?: Record<string, string | undefined>;\n};\n"]}