@bisondesk/core-sdk 1.0.676 → 1.0.677

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 (130) hide show
  1. package/lib/apis/exchange-rates.d.ts +3 -0
  2. package/lib/apis/exchange-rates.d.ts.map +1 -1
  3. package/lib/apis/exchange-rates.js +29 -0
  4. package/lib/apis/exchange-rates.js.map +1 -1
  5. package/lib/types/intercompany-payments.d.ts.map +1 -1
  6. package/lib/types/intercompany-payments.js.map +1 -1
  7. package/lib/types/offers.d.ts +2 -1
  8. package/lib/types/offers.d.ts.map +1 -1
  9. package/lib/types/offers.js.map +1 -1
  10. package/lib/types/opportunities.d.ts +9 -0
  11. package/lib/types/opportunities.d.ts.map +1 -1
  12. package/lib/types/opportunities.js.map +1 -1
  13. package/lib/types/opportunity-payments.d.ts +9 -0
  14. package/lib/types/opportunity-payments.d.ts.map +1 -1
  15. package/lib/types/opportunity-payments.js.map +1 -1
  16. package/lib/types/quote-settings.d.ts +1 -0
  17. package/lib/types/quote-settings.d.ts.map +1 -1
  18. package/lib/types/quote-settings.js.map +1 -1
  19. package/lib/types/quotes.d.ts +1 -0
  20. package/lib/types/quotes.d.ts.map +1 -1
  21. package/lib/types/quotes.js.map +1 -1
  22. package/lib/types/tenants.d.ts +1 -0
  23. package/lib/types/tenants.d.ts.map +1 -1
  24. package/lib/types/tenants.js.map +1 -1
  25. package/lib/types/vehicle-purchase-payments.d.ts +8 -1
  26. package/lib/types/vehicle-purchase-payments.d.ts.map +1 -1
  27. package/lib/types/vehicle-purchase-payments.js.map +1 -1
  28. package/lib/types/vehicles.d.ts +7 -0
  29. package/lib/types/vehicles.d.ts.map +1 -1
  30. package/lib/types/vehicles.js.map +1 -1
  31. package/lib/utils/opportunity-payments.d.ts +3 -0
  32. package/lib/utils/opportunity-payments.d.ts.map +1 -0
  33. package/lib/utils/opportunity-payments.js +5 -0
  34. package/lib/utils/opportunity-payments.js.map +1 -0
  35. package/lib/utils/opportunity-payments.test.d.ts +2 -0
  36. package/lib/utils/opportunity-payments.test.d.ts.map +1 -0
  37. package/lib/utils/opportunity-payments.test.js +23 -0
  38. package/lib/utils/opportunity-payments.test.js.map +1 -0
  39. package/lib/utils/tenants.d.ts +4 -0
  40. package/lib/utils/tenants.d.ts.map +1 -1
  41. package/lib/utils/tenants.js +8 -0
  42. package/lib/utils/tenants.js.map +1 -1
  43. package/lib/utils/tenants.test.js +44 -1
  44. package/lib/utils/tenants.test.js.map +1 -1
  45. package/package.json +1 -1
  46. package/src/apis/exchange-rates.ts +49 -0
  47. package/src/types/activities.js +13 -0
  48. package/src/types/activities.js.map +1 -0
  49. package/src/types/comparables.js +2 -0
  50. package/src/types/comparables.js.map +1 -0
  51. package/src/types/crm.js +58 -0
  52. package/src/types/crm.js.map +1 -0
  53. package/src/types/dashboard.js +2 -0
  54. package/src/types/dashboard.js.map +1 -0
  55. package/src/types/definitions.js +2 -0
  56. package/src/types/definitions.js.map +1 -0
  57. package/src/types/fields.js +2 -0
  58. package/src/types/fields.js.map +1 -0
  59. package/src/types/insights.js +2 -0
  60. package/src/types/insights.js.map +1 -0
  61. package/src/types/intercompany-payments.ts +4 -3
  62. package/src/types/interests.js +6 -0
  63. package/src/types/interests.js.map +1 -0
  64. package/src/types/internal-events.js +18 -0
  65. package/src/types/internal-events.js.map +1 -0
  66. package/src/types/internet-opportunities.js +2 -0
  67. package/src/types/internet-opportunities.js.map +1 -0
  68. package/src/types/internet-vehicles.js +2 -0
  69. package/src/types/internet-vehicles.js.map +1 -0
  70. package/src/types/leasing-administration.js +2 -0
  71. package/src/types/leasing-administration.js.map +1 -0
  72. package/src/types/leasing-debtors.js +2 -0
  73. package/src/types/leasing-debtors.js.map +1 -0
  74. package/src/types/leasing-search.js +2 -0
  75. package/src/types/leasing-search.js.map +1 -0
  76. package/src/types/leasing-settings.js +7 -0
  77. package/src/types/leasing-settings.js.map +1 -0
  78. package/src/types/leasing.js +38 -0
  79. package/src/types/leasing.js.map +1 -0
  80. package/src/types/marketing.js +35 -0
  81. package/src/types/marketing.js.map +1 -0
  82. package/src/types/offers.js +56 -0
  83. package/src/types/offers.ts +2 -0
  84. package/src/types/opportunities.js +107 -0
  85. package/src/types/opportunities.js.map +1 -0
  86. package/src/types/opportunities.ts +16 -0
  87. package/src/types/opportunity-payments.ts +23 -0
  88. package/src/types/payments.js +7 -0
  89. package/src/types/picklists.js +2 -0
  90. package/src/types/picklists.js.map +1 -0
  91. package/src/types/quote-settings.ts +2 -0
  92. package/src/types/quotes.js +42 -0
  93. package/src/types/quotes.ts +2 -0
  94. package/src/types/recently-viewed.js +2 -0
  95. package/src/types/recently-viewed.js.map +1 -0
  96. package/src/types/reservations.js +5 -0
  97. package/src/types/reservations.js.map +1 -0
  98. package/src/types/roi-ratings.js +5 -0
  99. package/src/types/roi-ratings.js.map +1 -0
  100. package/src/types/saved-filters.js +9 -0
  101. package/src/types/saved-filters.js.map +1 -0
  102. package/src/types/search.js +2 -0
  103. package/src/types/search.js.map +1 -0
  104. package/src/types/settings.js +2 -0
  105. package/src/types/settings.js.map +1 -0
  106. package/src/types/templates.js +2 -0
  107. package/src/types/templates.js.map +1 -0
  108. package/src/types/tenants.js +21 -0
  109. package/src/types/tenants.js.map +1 -0
  110. package/src/types/tenants.ts +6 -0
  111. package/src/types/user-performance.js +7 -0
  112. package/src/types/user-performance.js.map +1 -0
  113. package/src/types/utils.js +2 -0
  114. package/src/types/validation.js +2 -0
  115. package/src/types/validation.js.map +1 -0
  116. package/src/types/vehicle-purchase-payments.ts +16 -1
  117. package/src/types/vehicle-sales.js +6 -0
  118. package/src/types/vehicle-sales.js.map +1 -0
  119. package/src/types/vehicles.js +98 -0
  120. package/src/types/vehicles.js.map +1 -0
  121. package/src/types/vehicles.ts +15 -1
  122. package/src/utils/leasing.js +6 -0
  123. package/src/utils/leasing.js.map +1 -0
  124. package/src/utils/opportunities.js +48 -0
  125. package/src/utils/opportunities.js.map +1 -0
  126. package/src/utils/opportunity-payments.test.ts +31 -0
  127. package/src/utils/opportunity-payments.ts +15 -0
  128. package/src/utils/tenants.test.ts +60 -2
  129. package/src/utils/tenants.ts +28 -0
  130. package/tsconfig.tsbuildinfo +1 -1
@@ -0,0 +1,23 @@
1
+ import { isPaidInAlternativeCurrency } from './opportunity-payments.js';
2
+ const dollarPayment = {
3
+ foreign: { amount: '30000', currencyCode: 'USD', exchangeRate: '0.861804' },
4
+ };
5
+ const euroPayment = {};
6
+ describe('isPaidInAlternativeCurrency', () => {
7
+ it('shows the alternative currency before any payment arrived', () => {
8
+ expect(isPaidInAlternativeCurrency('USD', [])).toBe(true);
9
+ });
10
+ it('shows the alternative currency while every payment arrived in it', () => {
11
+ expect(isPaidInAlternativeCurrency('USD', [dollarPayment, dollarPayment])).toBe(true);
12
+ });
13
+ it('switches to branch currency once one payment arrived in branch currency', () => {
14
+ expect(isPaidInAlternativeCurrency('USD', [dollarPayment, euroPayment])).toBe(false);
15
+ });
16
+ it('leaves deleted payments out', () => {
17
+ expect(isPaidInAlternativeCurrency('USD', [dollarPayment, { deletedAt: '2026-09-30T10:00:00Z' }])).toBe(true);
18
+ });
19
+ it('shows branch currency when the quote has no alternative currency', () => {
20
+ expect(isPaidInAlternativeCurrency(undefined, [dollarPayment])).toBe(false);
21
+ });
22
+ });
23
+ //# sourceMappingURL=opportunity-payments.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opportunity-payments.test.js","sourceRoot":"/","sources":["utils/opportunity-payments.test.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAExE,MAAM,aAAa,GAAsD;IACvE,OAAO,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE;CAC5E,CAAC;AACF,MAAM,WAAW,GAAsD,EAAE,CAAC;AAE1E,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAC3C,EAAE,CAAC,2DAA2D,EAAE,GAAG,EAAE;QACnE,MAAM,CAAC,2BAA2B,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kEAAkE,EAAE,GAAG,EAAE;QAC1E,MAAM,CAAC,2BAA2B,CAAC,KAAK,EAAE,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yEAAyE,EAAE,GAAG,EAAE;QACjF,MAAM,CAAC,2BAA2B,CAAC,KAAK,EAAE,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACvF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;QACrC,MAAM,CACJ,2BAA2B,CAAC,KAAK,EAAE,CAAC,aAAa,EAAE,EAAE,SAAS,EAAE,sBAAsB,EAAE,CAAC,CAAC,CAC3F,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACf,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kEAAkE,EAAE,GAAG,EAAE;QAC1E,MAAM,CAAC,2BAA2B,CAAC,SAAS,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC9E,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { OpportunityPayment } from '../types/opportunity-payments.js';\nimport { isPaidInAlternativeCurrency } from './opportunity-payments.js';\n\nconst dollarPayment: Pick<OpportunityPayment, 'foreign' | 'deletedAt'> = {\n foreign: { amount: '30000', currencyCode: 'USD', exchangeRate: '0.861804' },\n};\nconst euroPayment: Pick<OpportunityPayment, 'foreign' | 'deletedAt'> = {};\n\ndescribe('isPaidInAlternativeCurrency', () => {\n it('shows the alternative currency before any payment arrived', () => {\n expect(isPaidInAlternativeCurrency('USD', [])).toBe(true);\n });\n\n it('shows the alternative currency while every payment arrived in it', () => {\n expect(isPaidInAlternativeCurrency('USD', [dollarPayment, dollarPayment])).toBe(true);\n });\n\n it('switches to branch currency once one payment arrived in branch currency', () => {\n expect(isPaidInAlternativeCurrency('USD', [dollarPayment, euroPayment])).toBe(false);\n });\n\n it('leaves deleted payments out', () => {\n expect(\n isPaidInAlternativeCurrency('USD', [dollarPayment, { deletedAt: '2026-09-30T10:00:00Z' }]),\n ).toBe(true);\n });\n\n it('shows branch currency when the quote has no alternative currency', () => {\n expect(isPaidInAlternativeCurrency(undefined, [dollarPayment])).toBe(false);\n });\n});\n"]}
@@ -1,6 +1,10 @@
1
1
  import { Branch, Tenant } from '../types/tenants.js';
2
2
  export declare const getBranch: (tenant: Tenant, branchId: string) => Branch;
3
3
  export declare const getDefaultBranch: (tenant: Tenant) => Branch;
4
+ export declare const getBranchAskingVies: (tenant: Tenant, branchId?: string) => Branch | undefined;
5
+ export declare const getBranchPaymentCurrencies: (branch: Branch) => string[];
6
+ export declare const isForeignPaymentCurrency: (branch: Branch, currencyCode: string) => boolean;
7
+ export declare const hasForeignPaymentCurrency: (branch: Branch) => boolean;
4
8
  export declare const isDropshippingBranch: (branch: Branch) => boolean;
5
9
  export declare const getBranchStandardVatRate: (tenant: Tenant, branchId: string) => string;
6
10
  export declare const areBranchesQuoteCompatible: (a: Branch, b: Branch) => boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"tenants.d.ts","sourceRoot":"/","sources":["utils/tenants.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAErD,eAAO,MAAM,SAAS,WAAY,MAAM,YAAY,MAAM,KAAG,MAO5D,CAAC;AAEF,eAAO,MAAM,gBAAgB,WAAY,MAAM,KAAG,MAAiC,CAAC;AAIpF,eAAO,MAAM,oBAAoB,WAAY,MAAM,KAAG,OAAuC,CAAC;AAE9F,eAAO,MAAM,wBAAwB,WAAY,MAAM,YAAY,MAAM,KAAG,MAG3E,CAAC;AAOF,eAAO,MAAM,0BAA0B,MAAO,MAAM,KAAK,MAAM,KAAG,OAIP,CAAC"}
1
+ {"version":3,"file":"tenants.d.ts","sourceRoot":"/","sources":["utils/tenants.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAErD,eAAO,MAAM,SAAS,WAAY,MAAM,YAAY,MAAM,KAAG,MAO5D,CAAC;AAEF,eAAO,MAAM,gBAAgB,WAAY,MAAM,KAAG,MAAiC,CAAC;AAOpF,eAAO,MAAM,mBAAmB,WAAY,MAAM,aAAa,MAAM,KAAG,MAAM,GAAG,SAGhF,CAAC;AAGF,eAAO,MAAM,0BAA0B,WAAY,MAAM,KAAG,MAAM,EACnB,CAAC;AAMhD,eAAO,MAAM,wBAAwB,WAAY,MAAM,gBAAgB,MAAM,KAAG,OACe,CAAC;AAGhG,eAAO,MAAM,yBAAyB,WAAY,MAAM,KAAG,OAGxD,CAAC;AAIJ,eAAO,MAAM,oBAAoB,WAAY,MAAM,KAAG,OAAuC,CAAC;AAE9F,eAAO,MAAM,wBAAwB,WAAY,MAAM,YAAY,MAAM,KAAG,MAG3E,CAAC;AAOF,eAAO,MAAM,0BAA0B,MAAO,MAAM,KAAK,MAAM,KAAG,OAIP,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { XError } from '@bisondesk/commons-sdk/errors';
2
+ import { isEUCountry } from '@bisondesk/commons-sdk/locations';
2
3
  import { first } from 'lodash-es';
3
4
  export const getBranch = (tenant, branchId) => {
4
5
  const branch = tenant.branches.find((branch) => branch.id === branchId);
@@ -8,6 +9,13 @@ export const getBranch = (tenant, branchId) => {
8
9
  return branch;
9
10
  };
10
11
  export const getDefaultBranch = (tenant) => first(tenant.branches);
12
+ export const getBranchAskingVies = (tenant, branchId) => {
13
+ const europeanBranches = tenant.branches.filter((branch) => isEUCountry(branch.country));
14
+ return europeanBranches.find((branch) => branch.id === branchId) ?? europeanBranches.at(0);
15
+ };
16
+ export const getBranchPaymentCurrencies = (branch) => branch.paymentCurrencies ?? [branch.currency];
17
+ export const isForeignPaymentCurrency = (branch, currencyCode) => currencyCode !== branch.currency && getBranchPaymentCurrencies(branch).includes(currencyCode);
18
+ export const hasForeignPaymentCurrency = (branch) => getBranchPaymentCurrencies(branch).some((currencyCode) => isForeignPaymentCurrency(branch, currencyCode));
11
19
  export const isDropshippingBranch = (branch) => branch.dropshipping === true;
12
20
  export const getBranchStandardVatRate = (tenant, branchId) => {
13
21
  const branch = getBranch(tenant, branchId);
@@ -1 +1 @@
1
- {"version":3,"file":"tenants.js","sourceRoot":"/","sources":["utils/tenants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAGlC,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,MAAc,EAAE,QAAgB,EAAU,EAAE;IACpE,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,MAAc,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAC;IAChF,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;QACnB,MAAM,IAAI,MAAM,CAAC,0BAA0B,EAAE,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;IAClF,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAc,EAAU,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAE,CAAC;AAIpF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,MAAc,EAAW,EAAE,CAAC,MAAM,CAAC,YAAY,KAAK,IAAI,CAAC;AAE9F,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,MAAc,EAAE,QAAgB,EAAU,EAAE;IACnF,MAAM,MAAM,GAAW,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACnD,OAAO,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC;AAClC,CAAC,CAAC;AAOF,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAS,EAAE,CAAS,EAAW,EAAE,CAC1E,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,OAAO;IACvB,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,QAAQ;IACzB,CAAC,CAAC,QAAQ,CAAC,QAAQ,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ;IAC3C,CAAC,CAAC,CAAC,aAAa,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,IAAI,KAAK,CAAC,CAAC","sourcesContent":["import { XError } from '@bisondesk/commons-sdk/errors';\nimport { first } from 'lodash-es';\nimport { Branch, Tenant } from '../types/tenants.js';\n\nexport const getBranch = (tenant: Tenant, branchId: string): Branch => {\n const branch = tenant.branches.find((branch: Branch) => branch.id === branchId);\n if (branch == null) {\n throw new XError('tenants.branch-not-found', { tenantId: tenant.id, branchId });\n }\n\n return branch;\n};\n\nexport const getDefaultBranch = (tenant: Tenant): Branch => first(tenant.branches)!;\n\n/** The source invoices the end customer directly; this branch collects payment and earns\n * commission (see {@link Branch.dropshipping}). */\nexport const isDropshippingBranch = (branch: Branch): boolean => branch.dropshipping === true;\n\nexport const getBranchStandardVatRate = (tenant: Tenant, branchId: string): string => {\n const branch: Branch = getBranch(tenant, branchId);\n return branch.vatRates.standard;\n};\n\n/**\n * Whether a quote computed for one branch is still right for the other. A quote's VAT regime,\n * currency, calculator strategy and conditions all come from these four fields, so when they\n * agree the quote can move with its deal; otherwise the deal needs a new one.\n */\nexport const areBranchesQuoteCompatible = (a: Branch, b: Branch): boolean =>\n a.country === b.country &&\n a.currency === b.currency &&\n a.vatRates.standard === b.vatRates.standard &&\n (a.externalQuote ?? false) === (b.externalQuote ?? false);\n"]}
1
+ {"version":3,"file":"tenants.js","sourceRoot":"/","sources":["utils/tenants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAGlC,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,MAAc,EAAE,QAAgB,EAAU,EAAE;IACpE,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,MAAc,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAC;IAChF,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;QACnB,MAAM,IAAI,MAAM,CAAC,0BAA0B,EAAE,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;IAClF,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAc,EAAU,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAE,CAAC;AAOpF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,MAAc,EAAE,QAAiB,EAAsB,EAAE;IAC3F,MAAM,gBAAgB,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IACzF,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,QAAQ,CAAC,IAAI,gBAAgB,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAC7F,CAAC,CAAC;AAGF,MAAM,C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ondesk/commons-sdk/locations';\nimport { first } from 'lodash-es';\nimport { Branch, Tenant } from '../types/tenants.js';\n\nexport const getBranch = (tenant: Tenant, branchId: string): Branch => {\n const branch = tenant.branches.find((branch: Branch) => branch.id === branchId);\n if (branch == null) {\n throw new XError('tenants.branch-not-found', { tenantId: tenant.id, branchId });\n }\n\n return branch;\n};\n\nexport const getDefaultBranch = (tenant: Tenant): Branch => first(tenant.branches)!;\n\n/**\n * The branch whose VAT number VIES records as the requester of a VAT check, which earns a\n * consultation number: the branch the check is made for when it is European, else the tenant's\n * first European branch. A tenant without a European branch asks VIES anonymously.\n */\nexport const getBranchAskingVies = (tenant: Tenant, branchId?: string): Branch | undefined => {\n const europeanBranches = tenant.branches.filter((branch) => isEUCountry(branch.country));\n return europeanBranches.find((branch) => branch.id === branchId) ?? europeanBranches.at(0);\n};\n\n/** The currencies money moves in at the branch, its own currency included. */\nexport const getBranchPaymentCurrencies = (branch: Branch): string[] =>\n branch.paymentCurrencies ?? [branch.currency];\n\n/**\n * Whether the branch can be paid, price a purchase or receive a supplier invoice in a currency\n * other than its own. Its own currency is never a foreign one.\n */\nexport const isForeignPaymentCurrency = (branch: Branch, currencyCode: string): boolean =>\n currencyCode !== branch.currency && getBranchPaymentCurrencies(branch).includes(currencyCode);\n\n/** Whether the branch lists any payment currency other than its own. */\nexport const hasForeignPaymentCurrency = (branch: Branch): boolean =>\n getBranchPaymentCurrencies(branch).some((currencyCode) =>\n isForeignPaymentCurrency(branch, currencyCode),\n );\n\n/** The source invoices the end customer directly; this branch collects payment and earns\n * commission (see {@link Branch.dropshipping}). */\nexport const isDropshippingBranch = (branch: Branch): boolean => branch.dropshipping === true;\n\nexport const getBranchStandardVatRate = (tenant: Tenant, branchId: string): string => {\n const branch: Branch = getBranch(tenant, branchId);\n return branch.vatRates.standard;\n};\n\n/**\n * Whether a quote computed for one branch is still right for the other. A quote's VAT regime,\n * currency, calculator strategy and conditions all come from these four fields, so when they\n * agree the quote can move with its deal; otherwise the deal needs a new one.\n */\nexport const areBranchesQuoteCompatible = (a: Branch, b: Branch): boolean =>\n a.country === b.country &&\n a.currency === b.currency &&\n a.vatRates.standard === b.vatRates.standard &&\n (a.externalQuote ?? false) === (b.externalQuote ?? false);\n"]}
@@ -1,4 +1,4 @@
1
- import { areBranchesQuoteCompatible } from './tenants.js';
1
+ import { areBranchesQuoteCompatible, getBranchAskingVies, getBranchPaymentCurrencies, hasForeignPaymentCurrency, isForeignPaymentCurrency, } from './tenants.js';
2
2
  const createBranch = (override) => ({
3
3
  id: 'TTC',
4
4
  name: 'TTC Belgium',
@@ -36,4 +36,47 @@ describe('areBranchesQuoteCompatible', () => {
36
36
  expect(areBranchesQuoteCompatible(implicit, explicit)).toBe(true);
37
37
  });
38
38
  });
39
+ describe('getBranchAskingVies', () => {
40
+ const bolivia = createBranch({ id: 'BO', country: 'bo', vatNumber: '387032026' });
41
+ const belgium = createBranch({ id: 'BE', country: 'be', vatNumber: 'BE0405567886' });
42
+ const france = createBranch({ id: 'FR', country: 'fr', vatNumber: 'FR10821739638' });
43
+ const tenantOf = (branches) => ({ branches });
44
+ test.each([
45
+ ['the European branch the check is made for', 'FR', 'FR'],
46
+ ['the first European branch when no branch is given', undefined, 'BE'],
47
+ ['the first European branch when the given branch is outside the EU', 'BO', 'BE'],
48
+ ['the first European branch when the given branch is unknown', 'GONE', 'BE'],
49
+ ])('picks %s', (_label, branchId, expected) => {
50
+ expect(getBranchAskingVies(tenantOf([bolivia, belgium, france]), branchId)?.id).toBe(expected);
51
+ });
52
+ test('asks anonymously for a tenant without a European branch', () => {
53
+ expect(getBranchAskingVies(tenantOf([bolivia]), 'BO')).toBeUndefined();
54
+ });
55
+ });
56
+ describe('payment currencies of a branch', () => {
57
+ const southAmerica = createBranch({
58
+ id: 'HPA South America',
59
+ paymentCurrencies: ['EUR', 'USD'],
60
+ });
61
+ test('a branch without a list is paid in its own currency only', () => {
62
+ expect(getBranchPaymentCurrencies(createBranch())).toEqual(['EUR']);
63
+ });
64
+ test('a branch with a list is paid in the currencies it lists', () => {
65
+ expect(getBranchPaymentCurrencies(southAmerica)).toEqual(['EUR', 'USD']);
66
+ });
67
+ test.each([
68
+ ['a listed currency other than its own', 'USD', true],
69
+ ['its own currency', 'EUR', false],
70
+ ['a currency it does not list', 'BOB', false],
71
+ ])('%s is a foreign payment currency: %s', (_label, currencyCode, expected) => {
72
+ expect(isForeignPaymentCurrency(southAmerica, currencyCode)).toBe(expected);
73
+ });
74
+ test('a branch without a list has no foreign payment currency', () => {
75
+ expect(isForeignPaymentCurrency(createBranch(), 'USD')).toBe(false);
76
+ expect(hasForeignPaymentCurrency(createBranch())).toBe(false);
77
+ });
78
+ test('a branch listing another currency has a foreign payment currency', () => {
79
+ expect(hasForeignPaymentCurrency(southAmerica)).toBe(true);
80
+ });
81
+ });
39
82
  //# sourceMappingURL=tenants.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tenants.test.js","sourceRoot":"/","sources":["utils/tenants.test.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAE1D,MAAM,YAAY,GAAG,CAAC,QAA0B,EAAU,EAAE,CAAC,CAAC;IAC5D,EAAE,EAAE,KAAK;IACT,IAAI,EAAE,aAAa;IACnB,OAAO,EAAE,IAAI;IACb,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,KAAK;IACf,iBAAiB,EAAE,IAAI;IACvB,iBAAiB,EAAE,IAAI;IACvB,SAAS,EAAE,cAAc;IACzB,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC5B,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IAC3B,GAAG,QAAQ;CACZ,CAAC,CAAC;AAEH,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;IAC1C,EAAE,CAAC,+EAA+E,EAAE,GAAG,EAAE;QACvF,MAAM,CAAC,GAAG,YAAY,EAAE,CAAC;QACzB,MAAM,CAAC,GAAG,YAAY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AC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { Branch } from '../types/tenants.js';\nimport { areBranchesQuoteCompatible } from './tenants.js';\n\nconst createBranch = (override?: Partial<Branch>): Branch => ({\n id: 'TTC',\n name: 'TTC Belgium',\n country: 'be',\n language: 'nl',\n currency: 'EUR',\n adminNumberPrefix: 'AT',\n stockNumberPrefix: 'TC',\n vatNumber: 'BE0123456789',\n vatRates: { standard: '21' },\n location: { country: 'be' },\n ...override,\n});\n\ndescribe('areBranchesQuoteCompatible', () => {\n it('accepts two branches that agree on country, currency, vat rate and quote mode', () => {\n const a = createBranch();\n const b = createBranch({ id: 'TTC2', name: 'TTC Antwerp', stockNumberPrefix: 'TA' });\n\n expect(areBranchesQuoteCompatible(a, b)).toBe(true);\n });\n\n it('is true for a branch compared with itself', () => {\n const branch = createBranch();\n\n expect(areBranchesQuoteCompatible(branch, branch)).toBe(true);\n });\n\n it.each([\n ['country', { country: 'fr' }],\n ['currency', { currency: 'USD' }],\n ['vat rate', { vatRates: { standard: '20' } }],\n ['external quote mode', { externalQuote: true }],\n ])('rejects branches that differ in %s', (_label, override) => {\n expect(areBranchesQuoteCompatible(createBranch(), createBranch(override))).toBe(false);\n });\n\n it('treats a missing externalQuote as false rather than as a difference', () => {\n const implicit = createBranch();\n const explicit = createBranch({ externalQuote: false });\n\n expect(areBranchesQuoteCompatible(implicit, explicit)).toBe(true);\n });\n});\n"]}
1
+ {"version":3,"file":"tenants.test.js","sourceRoot":"/","sources":["utils/tenants.test.ts"],"names":[],"mappings":"AACA,OAAO,EACL,0BAA0B,EAC1B,mBAAmB,EACnB,0BAA0B,EAC1B,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,cAAc,CAAC;AAEtB,MAAM,YAAY,GAAG,CAAC,QAA0B,EAAU,EAAE,CAAC,CAAC;IAC5D,EAAE,EAAE,KAAK;IACT,IAAI,EAAE,aAAa;IACnB,OAAO,EAAE,IAAI;IACb,QAAQ,EAAE,IAAI;IACd,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;QAC5E,MAAM,CAAC,wBAAwB,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC9E,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,yDAAyD,EAAE,GAAG,EAAE;QACnE,MAAM,CAAC,wBAAwB,CAAC,YAAY,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACpE,MAAM,CAAC,yBAAyB,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,kEAAkE,EAAE,GAAG,EAAE;QAC5E,MAAM,CAAC,yBAAyB,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { Branch, Tenant } from '../types/tenants.js';\nimport {\n areBranchesQuoteCompatible,\n getBranchAskingVies,\n getBranchPaymentCurrencies,\n hasForeignPaymentCurrency,\n isForeignPaymentCurrency,\n} from './tenants.js';\n\nconst createBranch = (override?: Partial<Branch>): Branch => ({\n id: 'TTC',\n name: 'TTC Belgium',\n country: 'be',\n language: 'nl',\n currency: 'EUR',\n adminNumberPrefix: 'AT',\n stockNumberPrefix: 'TC',\n vatNumber: 'BE0123456789',\n vatRates: { standard: '21' },\n location: { country: 'be' },\n ...override,\n});\n\ndescribe('areBranchesQuoteCompatible', () => {\n it('accepts two branches that agree on country, currency, vat rate and quote mode', () => {\n const a = createBranch();\n const b = createBranch({ id: 'TTC2', name: 'TTC Antwerp', stockNumberPrefix: 'TA' });\n\n expect(areBranchesQuoteCompatible(a, b)).toBe(true);\n });\n\n it('is true for a branch compared with itself', () => {\n const branch = createBranch();\n\n expect(areBranchesQuoteCompatible(branch, branch)).toBe(true);\n });\n\n it.each([\n ['country', { country: 'fr' }],\n ['currency', { currency: 'USD' }],\n ['vat rate', { vatRates: { standard: '20' } }],\n ['external quote mode', { externalQuote: true }],\n ])('rejects branches that differ in %s', (_label, override) => {\n expect(areBranchesQuoteCompatible(createBranch(), createBranch(override))).toBe(false);\n });\n\n it('treats a missing externalQuote as false rather than as a difference', () => {\n const implicit = createBranch();\n const explicit = createBranch({ externalQuote: false });\n\n expect(areBranchesQuoteCompatible(implicit, explicit)).toBe(true);\n });\n});\n\ndescribe('getBranchAskingVies', () => {\n const bolivia = createBranch({ id: 'BO', country: 'bo', vatNumber: '387032026' });\n const belgium = createBranch({ id: 'BE', country: 'be', vatNumber: 'BE0405567886' });\n const france = createBranch({ id: 'FR', country: 'fr', vatNumber: 'FR10821739638' });\n const tenantOf = (branches: Branch[]) => ({ branches }) as Tenant;\n\n test.each([\n ['the European branch the check is made for', 'FR', 'FR'],\n ['the first European branch when no branch is given', undefined, 'BE'],\n ['the first European branch when the given branch is outside the EU', 'BO', 'BE'],\n ['the first European branch when the given branch is unknown', 'GONE', 'BE'],\n ])('picks %s', (_label, branchId, expected) => {\n expect(getBranchAskingVies(tenantOf([bolivia, belgium, france]), branchId)?.id).toBe(expected);\n });\n\n test('asks anonymously for a tenant without a European branch', () => {\n expect(getBranchAskingVies(tenantOf([bolivia]), 'BO')).toBeUndefined();\n });\n});\n\ndescribe('payment currencies of a branch', () => {\n const southAmerica = createBranch({\n id: 'HPA South America',\n paymentCurrencies: ['EUR', 'USD'],\n });\n\n test('a branch without a list is paid in its own currency only', () => {\n expect(getBranchPaymentCurrencies(createBranch())).toEqual(['EUR']);\n });\n\n test('a branch with a list is paid in the currencies it lists', () => {\n expect(getBranchPaymentCurrencies(southAmerica)).toEqual(['EUR', 'USD']);\n });\n\n test.each([\n ['a listed currency other than its own', 'USD', true],\n ['its own currency', 'EUR', false],\n ['a currency it does not list', 'BOB', false],\n ])('%s is a foreign payment currency: %s', (_label, currencyCode, expected) => {\n expect(isForeignPaymentCurrency(southAmerica, currencyCode)).toBe(expected);\n });\n\n test('a branch without a list has no foreign payment currency', () => {\n expect(isForeignPaymentCurrency(createBranch(), 'USD')).toBe(false);\n expect(hasForeignPaymentCurrency(createBranch())).toBe(false);\n });\n\n test('a branch listing another currency has a foreign payment currency', () => {\n expect(hasForeignPaymentCurrency(southAmerica)).toBe(true);\n });\n});\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bisondesk/core-sdk",
3
- "version": "1.0.676",
3
+ "version": "1.0.677",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "author": "TheTruckCompany",
@@ -1,5 +1,9 @@
1
1
  import { XError } from '@bisondesk/commons-sdk/errors';
2
2
  import { getAdminAuth } from '@bisondesk/commons-sdk/fetch';
3
+ import {
4
+ CurrencyConversionRequest,
5
+ CurrencyConversionResponse,
6
+ } from '@bisondesk/commons-sdk/types';
3
7
  import fetch, { Response } from 'node-fetch';
4
8
  import { ExchangeRate } from '../types/exchange-rates.js';
5
9
 
@@ -46,6 +50,51 @@ export const getExchangeRate = async (
46
50
  throw new XError(response.statusText, { url, body, fromCurrency, toCurrency });
47
51
  };
48
52
 
53
+ /** The daily rates of the rate provider, as the quote and invoice forms get them. */
54
+ export const getCurrencyConversionRates = async (
55
+ request: CurrencyConversionRequest,
56
+ ): Promise<CurrencyConversionResponse> => {
57
+ const auth = await getAdminAuth();
58
+ const url = `${process.env.CORE_API_ORIGIN}/api/currency/rates`;
59
+ const response: Response = await fetch(url, {
60
+ method: 'POST',
61
+ headers: {
62
+ Authorization: auth,
63
+ 'Content-Type': 'application/json',
64
+ },
65
+ body: JSON.stringify(request),
66
+ });
67
+
68
+ if (response.ok) {
69
+ return response.json() as any;
70
+ }
71
+
72
+ const body = await response.text();
73
+ throw new XError(response.statusText, { url, body, request });
74
+ };
75
+
76
+ /**
77
+ * The plain daily rate of `date`: how many units of `toCurrency` equal 1 unit of `fromCurrency`,
78
+ * without the bank-fee markup. Undefined when the provider has no rate for the pair.
79
+ */
80
+ export const getDailyConversionRate = async (
81
+ fromCurrency: string,
82
+ toCurrency: string,
83
+ date?: string,
84
+ ): Promise<string | undefined> => {
85
+ if (fromCurrency === toCurrency) {
86
+ return '1';
87
+ }
88
+
89
+ const { rates } = await getCurrencyConversionRates({
90
+ sourceCurrency: fromCurrency,
91
+ targetCurrency: toCurrency,
92
+ date,
93
+ bankFeeMarkup: false,
94
+ });
95
+ return rates[toCurrency];
96
+ };
97
+
49
98
  /**
50
99
  * Direction-agnostic conversion multiplier: how many units of `toCurrency`
51
100
  * equal 1 unit of `fromCurrency`. Tries a direct pair first, then falls back
@@ -0,0 +1,13 @@
1
+ export var ActivityType;
2
+ (function (ActivityType) {
3
+ ActivityType["CALL"] = "call";
4
+ ActivityType["MEETING"] = "meeting";
5
+ ActivityType["EMAIL"] = "email";
6
+ ActivityType["CHAT"] = "chat";
7
+ })(ActivityType || (ActivityType = {}));
8
+ export var ActivityActions;
9
+ (function (ActivityActions) {
10
+ ActivityActions["DELETE"] = "delete";
11
+ ActivityActions["EDIT"] = "edit";
12
+ })(ActivityActions || (ActivityActions = {}));
13
+ //# sourceMappingURL=activities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activities.js","sourceRoot":"","sources":["activities.ts"],"names":[],"mappings":"AAGA,MAAM,CAAN,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,6BAAa,CAAA;IACb,mCAAmB,CAAA;IACnB,+BAAe,CAAA;IACf,6BAAa,CAAA;AACf,CAAC,EALW,YAAY,KAAZ,YAAY,QAKvB;AAED,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,oCAAiB,CAAA;IACjB,gCAAa,CAAA;AACf,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=comparables.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"comparables.js","sourceRoot":"","sources":["comparables.ts"],"names":[],"mappings":""}
@@ -0,0 +1,58 @@
1
+ export var OrganizatioRiskTags;
2
+ (function (OrganizatioRiskTags) {
3
+ OrganizatioRiskTags["BAD_FINANCIAL_INFO"] = "BAD_FINANCIAL_INFO";
4
+ OrganizatioRiskTags["VAT_NUMBER_INVALID"] = "VAT_NUMBER_INVALID";
5
+ OrganizatioRiskTags["INSTINCT"] = "INSTINCT";
6
+ OrganizatioRiskTags["NEW_CUSTOMER"] = "NEW_CUSTOMER";
7
+ OrganizatioRiskTags["BANK_ACCOUNT_BLOCKED"] = "BANK_ACCOUNT_BLOCKED";
8
+ OrganizatioRiskTags["NO_GPS"] = "NO_GPS";
9
+ })(OrganizatioRiskTags || (OrganizatioRiskTags = {}));
10
+ export var ContactActions;
11
+ (function (ContactActions) {
12
+ ContactActions["UPSERT"] = "upsert";
13
+ ContactActions["DELETE"] = "delete";
14
+ })(ContactActions || (ContactActions = {}));
15
+ export var OrganizationActions;
16
+ (function (OrganizationActions) {
17
+ OrganizationActions["ADD_ACTIVITY"] = "add_activity";
18
+ OrganizationActions["UPSERT"] = "upsert";
19
+ OrganizationActions["DELETE"] = "delete";
20
+ OrganizationActions["SELL_TO_ORGANIZATION"] = "sell_to_organization";
21
+ })(OrganizationActions || (OrganizationActions = {}));
22
+ export var MarketingChannel;
23
+ (function (MarketingChannel) {
24
+ MarketingChannel["Email"] = "email";
25
+ MarketingChannel["Whatsapp"] = "whatsapp";
26
+ MarketingChannel["Sms"] = "sms";
27
+ MarketingChannel["Phone"] = "phone";
28
+ })(MarketingChannel || (MarketingChannel = {}));
29
+ export var PartnerLevel;
30
+ (function (PartnerLevel) {
31
+ PartnerLevel["Internal"] = "05-internal";
32
+ PartnerLevel["Gold"] = "10-gold";
33
+ PartnerLevel["Silver"] = "20-silver";
34
+ PartnerLevel["Bronze"] = "30-bronze";
35
+ })(PartnerLevel || (PartnerLevel = {}));
36
+ export var SaveContactResolution;
37
+ (function (SaveContactResolution) {
38
+ SaveContactResolution["IgnoreDuplicates"] = "IGNORE_DUPLICATES";
39
+ SaveContactResolution["BlockDuplicates"] = "BLOCK_DUPLICATES";
40
+ })(SaveContactResolution || (SaveContactResolution = {}));
41
+ export var SaveOrgResolution;
42
+ (function (SaveOrgResolution) {
43
+ SaveOrgResolution["IgnoreDuplicates"] = "IGNORE_DUPLICATES";
44
+ SaveOrgResolution["BlockDuplicates"] = "BLOCK_DUPLICATES";
45
+ })(SaveOrgResolution || (SaveOrgResolution = {}));
46
+ export var CrmSearchScope;
47
+ (function (CrmSearchScope) {
48
+ CrmSearchScope["Tenant"] = "tenant";
49
+ CrmSearchScope["Conglomerate"] = "conglomerate";
50
+ })(CrmSearchScope || (CrmSearchScope = {}));
51
+ export var OrgEngagementType;
52
+ (function (OrgEngagementType) {
53
+ OrgEngagementType["offers"] = "offers";
54
+ OrgEngagementType["purchases"] = "purchases";
55
+ OrgEngagementType["opportunities"] = "opportunities";
56
+ OrgEngagementType["sales"] = "sales";
57
+ })(OrgEngagementType || (OrgEngagementType = {}));
58
+ //# sourceMappingURL=crm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crm.js","sourceRoot":"","sources":["crm.ts"],"names":[],"mappings":"AAUA,MAAM,CAAN,IAAY,mBAOX;AAPD,WAAY,mBAAmB;IAC7B,gEAAyC,CAAA;IACzC,gEAAyC,CAAA;IACzC,4CAAqB,CAAA;IACrB,oDAA6B,CAAA;IAC7B,oEAA6C,CAAA;IAC7C,wCAAiB,CAAA;AACnB,CAAC,EAPW,mBAAmB,KAAnB,mBAAmB,QAO9B;AAED,MAAM,CAAN,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,mCAAiB,CAAA;IACjB,mCAAiB,CAAA;AACnB,CAAC,EAHW,cAAc,KAAd,cAAc,QAGzB;AAED,MAAM,CAAN,IAAY,mBAKX;AALD,WAAY,mBAAmB;IAC7B,oDAA6B,CAAA;IAC7B,wCAAiB,CAAA;IACjB,wCAAiB,CAAA;IACjB,oEAA6C,CAAA;AAC/C,CAAC,EALW,mBAAmB,KAAnB,mBAAmB,QAK9B;AAgKD,MAAM,CAAN,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,mCAAe,CAAA;IACf,yCAAqB,CAAA;IACrB,+BAAW,CAAA;IACX,mCAAe,CAAA;AACjB,CAAC,EALW,gBAAgB,KAAhB,gBAAgB,QAK3B;AAWD,MAAM,CAAN,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,wCAAwB,CAAA;IACxB,gCAAgB,CAAA;IAChB,oCAAoB,CAAA;IACpB,oCAAoB,CAAA;AACtB,CAAC,EALW,YAAY,KAAZ,YAAY,QAKvB;AA6CD,MAAM,CAAN,IAAY,qBAGX;AAHD,WAAY,qBAAqB;IAC/B,+DAAsC,CAAA;IACtC,6DAAoC,CAAA;AACtC,CAAC,EAHW,qBAAqB,KAArB,qBAAqB,QAGhC;AAED,MAAM,CAAN,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,2DAAsC,CAAA;IACtC,yDAAoC,CAAA;AACtC,CAAC,EAHW,iBAAiB,KAAjB,iBAAiB,QAG5B;AAED,MAAM,CAAN,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,mCAAiB,CAAA;IACjB,+CAA6B,CAAA;AAC/B,CAAC,EAHW,cAAc,KAAd,cAAc,QAGzB;AAED,MAAM,CAAN,IAAY,iBAKX;AALD,WAAY,iBAAiB;IAC3B,sCAAiB,CAAA;IACjB,4CAAuB,CAAA;IACvB,oDAA+B,CAAA;IAC/B,oCAAe,CAAA;AACjB,CAAC,EALW,iBAAiB,KAAjB,iBAAiB,QAK5B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=dashboard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dashboard.js","sourceRoot":"","sources":["dashboard.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export * from '@bisondesk/commons-sdk/definitions';
2
+ //# sourceMappingURL=definitions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["definitions.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from '@bisondesk/commons-sdk/fields';
2
+ //# sourceMappingURL=fields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fields.js","sourceRoot":"","sources":["fields.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=insights.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"insights.js","sourceRoot":"","sources":["insights.ts"],"names":[],"mappings":""}
@@ -13,8 +13,9 @@ export type IntercompanyPaymentHop = {
13
13
  /** Deep link to the hop opportunity on the target tenant's own subdomain. */
14
14
  opportunityUrl: string;
15
15
  /**
16
- * Currency of the amounts: the hop opportunity's quote currency. A reserved-stage
17
- * opportunity always carries a quote; hops missing one (malformed) are skipped.
16
+ * Currency of the amounts: the hop opportunity's quote currency, or the quote's alternative
17
+ * currency when every payment of the hop arrived in it. A reserved-stage opportunity always
18
+ * carries a quote; hops missing one (malformed) are skipped.
18
19
  */
19
20
  currency: string;
20
21
  vehicle: {
@@ -32,7 +33,7 @@ export type IntercompanyPaymentHop = {
32
33
  * total payment before delivery). Absent until that hop's quote is manager-accepted.
33
34
  */
34
35
  expectedTotal?: string;
35
- /** Sum of the hop opportunity's non-deleted payment amounts. */
36
+ /** Sum of the hop opportunity's non-deleted payment amounts, in `currency`. */
36
37
  paid: string;
37
38
  };
38
39
 
@@ -0,0 +1,6 @@
1
+ export var InterestActions;
2
+ (function (InterestActions) {
3
+ InterestActions["SET_INTEREST"] = "set_interest";
4
+ })(InterestActions || (InterestActions = {}));
5
+ export const isOpportunityInterest = (interest) => 'opportunityId' in interest;
6
+ //# sourceMappingURL=interests.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interests.js","sourceRoot":"","sources":["interests.ts"],"names":[],"mappings":"AAGA,MAAM,CAAN,IAAY,eAEX;AAFD,WAAY,eAAe;IACzB,gDAA6B,CAAA;AAC/B,CAAC,EAFW,eAAe,KAAf,eAAe,QAE1B;AAwBD,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,QAAkB,EAAmC,EAAE,CAC3F,eAAe,IAAI,QAAQ,CAAC"}
@@ -0,0 +1,18 @@
1
+ export var InternalEventTypes;
2
+ (function (InternalEventTypes) {
3
+ InternalEventTypes["VEHICLE_PURCHASE"] = "vehicle-purchases";
4
+ InternalEventTypes["ORGANIZATION"] = "organizations";
5
+ InternalEventTypes["CONTACT"] = "contacts";
6
+ InternalEventTypes["FINANCE_DOCUMENT"] = "finance-documents";
7
+ InternalEventTypes["OPPORTUNITY"] = "opportunities";
8
+ InternalEventTypes["VEHICLE"] = "vehicles";
9
+ InternalEventTypes["SALE_PAYMENT"] = "sale-payments";
10
+ InternalEventTypes["PURCHASE_PAYMENT"] = "vehicle-purchase-payments";
11
+ InternalEventTypes["OFFER"] = "offers";
12
+ })(InternalEventTypes || (InternalEventTypes = {}));
13
+ export var InternalNotificationChannels;
14
+ (function (InternalNotificationChannels) {
15
+ InternalNotificationChannels["APP"] = "app";
16
+ InternalNotificationChannels["EMAIL"] = "email";
17
+ })(InternalNotificationChannels || (InternalNotificationChannels = {}));
18
+ //# sourceMappingURL=internal-events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal-events.js","sourceRoot":"","sources":["internal-events.ts"],"names":[],"mappings":"AASA,MAAM,CAAN,IAAY,kBAUX;AAVD,WAAY,kBAAkB;IAC5B,4DAAsC,CAAA;IACtC,oDAA8B,CAAA;IAC9B,0CAAoB,CAAA;IACpB,4DAAsC,CAAA;IACtC,mDAA6B,CAAA;IAC7B,0CAAoB,CAAA;IACpB,oDAA8B,CAAA;IAC9B,oEAA8C,CAAA;IAC9C,sCAAgB,CAAA;AAClB,CAAC,EAVW,kBAAkB,KAAlB,kBAAkB,QAU7B;AAED,MAAM,CAAN,IAAY,4BAGX;AAHD,WAAY,4BAA4B;IACtC,2CAAW,CAAA;IACX,+CAAe,CAAA;AACjB,CAAC,EAHW,4BAA4B,KAA5B,4BAA4B,QAGvC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=internet-opportunities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internet-opportunities.js","sourceRoot":"","sources":["internet-opportunities.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=internet-vehicles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internet-vehicles.js","sourceRoot":"","sources":["internet-vehicles.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=leasing-administration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"leasing-administration.js","sourceRoot":"","sources":["leasing-administration.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=leasing-debtors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"leasing-debtors.js","sourceRoot":"","sources":["leasing-debtors.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=leasing-search.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"leasing-search.js","sourceRoot":"","sources":["leasing-search.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ export var LeasingItemsPaymentSplit;
2
+ (function (LeasingItemsPaymentSplit) {
3
+ LeasingItemsPaymentSplit["Customer"] = "customer";
4
+ LeasingItemsPaymentSplit["Split"] = "split";
5
+ LeasingItemsPaymentSplit["Company"] = "company";
6
+ })(LeasingItemsPaymentSplit || (LeasingItemsPaymentSplit = {}));
7
+ //# sourceMappingURL=leasing-settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"leasing-settings.js","sourceRoot":"","sources":["leasing-settings.ts"],"names":[],"mappings":"AAwCA,MAAM,CAAN,IAAY,wBAIX;AAJD,WAAY,wBAAwB;IAClC,iDAAqB,CAAA;IACrB,2CAAe,CAAA;IACf,+CAAmB,CAAA;AACrB,CAAC,EAJW,wBAAwB,KAAxB,wBAAwB,QAInC"}
@@ -0,0 +1,38 @@
1
+ export var LeasingContractActions;
2
+ (function (LeasingContractActions) {
3
+ LeasingContractActions["CREATE_FINANCE_DOCUMENT"] = "create_finance_document";
4
+ LeasingContractActions["START_RETAKE_VEHICLE"] = "start_retake_vehicle";
5
+ LeasingContractActions["END_RETAKE_VEHICLE"] = "end_retake_vehicle";
6
+ LeasingContractActions["START_CONTRACT_END"] = "start_contract_end";
7
+ LeasingContractActions["END_CONTRACT"] = "end_contract";
8
+ LeasingContractActions["CANCEL_RETAKE_VEHICLE"] = "cancel_retake_vehicle";
9
+ })(LeasingContractActions || (LeasingContractActions = {}));
10
+ export var LeasingContractSource;
11
+ (function (LeasingContractSource) {
12
+ LeasingContractSource["HYPERPORTAL"] = "hyperportal";
13
+ LeasingContractSource["BISONDESK"] = "bisondesk";
14
+ })(LeasingContractSource || (LeasingContractSource = {}));
15
+ export var LeasingContractStatus;
16
+ (function (LeasingContractStatus) {
17
+ LeasingContractStatus["DRAFT"] = "draft";
18
+ LeasingContractStatus["DISCARDED"] = "discarded";
19
+ LeasingContractStatus["PAUSED"] = "paused";
20
+ LeasingContractStatus["ACTIVE"] = "active";
21
+ LeasingContractStatus["LEASING_RETURN"] = "leasing_return";
22
+ LeasingContractStatus["RECOVERED"] = "recovered";
23
+ LeasingContractStatus["ENDING"] = "ending";
24
+ LeasingContractStatus["ENDED"] = "ended";
25
+ })(LeasingContractStatus || (LeasingContractStatus = {}));
26
+ export var LeasingRemindersSortableColumns;
27
+ (function (LeasingRemindersSortableColumns) {
28
+ LeasingRemindersSortableColumns["NextActionAt"] = "next_action_at";
29
+ LeasingRemindersSortableColumns["OrganizationName"] = "organization_name";
30
+ LeasingRemindersSortableColumns["RemindersCount"] = "reminders_count";
31
+ LeasingRemindersSortableColumns["Status"] = "status";
32
+ })(LeasingRemindersSortableColumns || (LeasingRemindersSortableColumns = {}));
33
+ export var LEASING_EXPORT_TYPES;
34
+ (function (LEASING_EXPORT_TYPES) {
35
+ LEASING_EXPORT_TYPES["RENTAL_SOLUTIONS"] = "rental-solutions";
36
+ LEASING_EXPORT_TYPES["DEFAULT"] = "default";
37
+ })(LEASING_EXPORT_TYPES || (LEASING_EXPORT_TYPES = {}));
38
+ //# sourceMappingURL=leasing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"leasing.js","sourceRoot":"","sources":["leasing.ts"],"names":[],"mappings":"AAKA,MAAM,CAAN,IAAY,sBAOX;AAPD,WAAY,sBAAsB;IAChC,6EAAmD,CAAA;IACnD,uEAA6C,CAAA;IAC7C,mEAAyC,CAAA;IACzC,mEAAyC,CAAA;IACzC,uDAA6B,CAAA;IAC7B,yEAA+C,CAAA;AACjD,CAAC,EAPW,sBAAsB,KAAtB,sBAAsB,QAOjC;AA8DD,MAAM,CAAN,IAAY,qBAGX;AAHD,WAAY,qBAAqB;IAC/B,oDAA2B,CAAA;IAC3B,gDAAuB,CAAA;AACzB,CAAC,EAHW,qBAAqB,KAArB,qBAAqB,QAGhC;AAED,MAAM,CAAN,IAAY,qBASX;AATD,WAAY,qBAAqB;IAC/B,wCAAe,CAAA;IACf,gDAAuB,CAAA;IACvB,0CAAiB,CAAA;IACjB,0CAAiB,CAAA;IACjB,0DAAiC,CAAA;IACjC,gDAAuB,CAAA;IACvB,0CAAiB,CAAA;IACjB,wCAAe,CAAA;AACjB,CAAC,EATW,qBAAqB,KAArB,qBAAqB,QAShC;AAuQD,MAAM,CAAN,IAAY,+BAKX;AALD,WAAY,+BAA+B;IACzC,kEAA+B,CAAA;IAC/B,yEAAsC,CAAA;IACtC,qEAAkC,CAAA;IAClC,oDAAiB,CAAA;AACnB,CAAC,EALW,+BAA+B,KAA/B,+BAA+B,QAK1C;AAgGD,MAAM,CAAN,IAAY,oBAGX;AAHD,WAAY,oBAAoB;IAC9B,6DAAqC,CAAA;IACrC,2CAAmB,CAAA;AACrB,CAAC,EAHW,oBAAoB,KAApB,oBAAoB,QAG/B"}
@@ -0,0 +1,35 @@
1
+ export var MarketingPlatform;
2
+ (function (MarketingPlatform) {
3
+ MarketingPlatform["autoscout24"] = "autoscout24";
4
+ MarketingPlatform["autoline"] = "autoline";
5
+ MarketingPlatform["exportseller"] = "exportseller";
6
+ MarketingPlatform["machineryplanet"] = "machineryplanet";
7
+ MarketingPlatform["machinetrack"] = "machinetrack";
8
+ MarketingPlatform["marktnet"] = "marktnet";
9
+ MarketingPlatform["mobile"] = "mobile";
10
+ MarketingPlatform["truck1st"] = "truck1st";
11
+ MarketingPlatform["trucks"] = "trucks";
12
+ MarketingPlatform["truckscout"] = "truckscout24";
13
+ MarketingPlatform["tweedehandsbe"] = "2ehandsbe";
14
+ MarketingPlatform["viamobilis"] = "planettrucks";
15
+ MarketingPlatform["youtube"] = "youtube";
16
+ })(MarketingPlatform || (MarketingPlatform = {}));
17
+ export var MarketingEventStatus;
18
+ (function (MarketingEventStatus) {
19
+ MarketingEventStatus["Scheduled"] = "scheduled";
20
+ MarketingEventStatus["Processing"] = "processing";
21
+ MarketingEventStatus["Skipped"] = "skipped";
22
+ MarketingEventStatus["Error"] = "error";
23
+ MarketingEventStatus["Sent"] = "processed";
24
+ })(MarketingEventStatus || (MarketingEventStatus = {}));
25
+ export var MarketingEventType;
26
+ (function (MarketingEventType) {
27
+ MarketingEventType["PriceDrop"] = "price-drop";
28
+ MarketingEventType["PartnerOffer"] = "partner-offer";
29
+ })(MarketingEventType || (MarketingEventType = {}));
30
+ export var MarketingMessageChannelType;
31
+ (function (MarketingMessageChannelType) {
32
+ MarketingMessageChannelType["Whatsapp"] = "whatsapp";
33
+ MarketingMessageChannelType["Email"] = "email";
34
+ })(MarketingMessageChannelType || (MarketingMessageChannelType = {}));
35
+ //# sourceMappingURL=marketing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"marketing.js","sourceRoot":"","sources":["marketing.ts"],"names":[],"mappings":"AAEA,MAAM,CAAN,IAAY,iBAcX;AAdD,WAAY,iBAAiB;IAC3B,gDAA2B,CAAA;IAC3B,0CAAqB,CAAA;IACrB,kDAA6B,CAAA;IAC7B,wDAAmC,CAAA;IACnC,kDAA6B,CAAA;IAC7B,0CAAqB,CAAA;IACrB,sCAAiB,CAAA;IACjB,0CAAqB,CAAA;IACrB,sCAAiB,CAAA;IACjB,gDAA2B,CAAA;IAC3B,gDAA2B,CAAA;IAC3B,gDAA2B,CAAA;IAC3B,wCAAmB,CAAA;AACrB,CAAC,EAdW,iBAAiB,KAAjB,iBAAiB,QAc5B;AA8DD,MAAM,CAAN,IAAY,oBAMX;AAND,WAAY,oBAAoB;IAC9B,+CAAuB,CAAA;IACvB,iDAAyB,CAAA;IACzB,2CAAmB,CAAA;IACnB,uCAAe,CAAA;IACf,0CAAkB,CAAA;AACpB,CAAC,EANW,oBAAoB,KAApB,oBAAoB,QAM/B;AAED,MAAM,CAAN,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC5B,8CAAwB,CAAA;IACxB,oDAA8B,CAAA;AAChC,CAAC,EAHW,kBAAkB,KAAlB,kBAAkB,QAG7B;AAED,MAAM,CAAN,IAAY,2BAGX;AAHD,WAAY,2BAA2B;IACrC,oDAAqB,CAAA;IACrB,8CAAe,CAAA;AACjB,CAAC,EAHW,2BAA2B,KAA3B,2BAA2B,QAGtC"}