@vergelijkdirect/insurance-transmission-client 1.3.21

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 (246) hide show
  1. package/README.md +79 -0
  2. package/package.json +33 -0
  3. package/src/js/adapters/index.d.ts +1 -0
  4. package/src/js/adapters/index.js +5 -0
  5. package/src/js/adapters/local-storage.adapter.d.ts +15 -0
  6. package/src/js/adapters/local-storage.adapter.js +56 -0
  7. package/src/js/clients/index.d.ts +1 -0
  8. package/src/js/clients/index.js +5 -0
  9. package/src/js/clients/insurance-transmission.client.d.ts +14 -0
  10. package/src/js/clients/insurance-transmission.client.js +88 -0
  11. package/src/js/core/http.client.d.ts +32 -0
  12. package/src/js/core/http.client.js +146 -0
  13. package/src/js/core/index.d.ts +2 -0
  14. package/src/js/core/index.js +7 -0
  15. package/src/js/core/injector.d.ts +17 -0
  16. package/src/js/core/injector.js +67 -0
  17. package/src/js/factories/api-service.factory.d.ts +4 -0
  18. package/src/js/factories/api-service.factory.js +50 -0
  19. package/src/js/factories/comparison.factory.d.ts +32 -0
  20. package/src/js/factories/comparison.factory.js +23 -0
  21. package/src/js/factories/index.d.ts +3 -0
  22. package/src/js/factories/index.js +9 -0
  23. package/src/js/factories/rate.factory.d.ts +6 -0
  24. package/src/js/factories/rate.factory.js +92 -0
  25. package/src/js/handlers/error.handler.d.ts +7 -0
  26. package/src/js/handlers/error.handler.js +12 -0
  27. package/src/js/handlers/index.d.ts +3 -0
  28. package/src/js/handlers/index.js +9 -0
  29. package/src/js/handlers/rate-handler.d.ts +10 -0
  30. package/src/js/handlers/rate-handler.js +70 -0
  31. package/src/js/handlers/response.handler.d.ts +7 -0
  32. package/src/js/handlers/response.handler.js +12 -0
  33. package/src/js/index.d.ts +5 -0
  34. package/src/js/index.js +21 -0
  35. package/src/js/interfaces/additional-coverage.interface.d.ts +8 -0
  36. package/src/js/interfaces/additional-coverage.interface.js +2 -0
  37. package/src/js/interfaces/calculate-rates.interface.d.ts +5 -0
  38. package/src/js/interfaces/calculate-rates.interface.js +2 -0
  39. package/src/js/interfaces/comparison/comparison-data-collection.interface.d.ts +16 -0
  40. package/src/js/interfaces/comparison/comparison-data-collection.interface.js +2 -0
  41. package/src/js/interfaces/comparison/comparison-insurance-data.interface.d.ts +8 -0
  42. package/src/js/interfaces/comparison/comparison-insurance-data.interface.js +2 -0
  43. package/src/js/interfaces/comparison/comparison-insurance.interface.d.ts +11 -0
  44. package/src/js/interfaces/comparison/comparison-insurance.interface.js +2 -0
  45. package/src/js/interfaces/comparison/comparison.interface.d.ts +8 -0
  46. package/src/js/interfaces/comparison/comparison.interface.js +2 -0
  47. package/src/js/interfaces/comparison/index.d.ts +4 -0
  48. package/src/js/interfaces/comparison/index.js +2 -0
  49. package/src/js/interfaces/environment.interface.d.ts +7 -0
  50. package/src/js/interfaces/environment.interface.js +2 -0
  51. package/src/js/interfaces/index.d.ts +10 -0
  52. package/src/js/interfaces/index.js +19 -0
  53. package/src/js/interfaces/moped-rate.interface.d.ts +38 -0
  54. package/src/js/interfaces/moped-rate.interface.js +2 -0
  55. package/src/js/interfaces/nextable.interface.d.ts +4 -0
  56. package/src/js/interfaces/nextable.interface.js +2 -0
  57. package/src/js/interfaces/rate.interface.d.ts +12 -0
  58. package/src/js/interfaces/rate.interface.js +2 -0
  59. package/src/js/interfaces/requests/additional-coverages-request.interface.d.ts +5 -0
  60. package/src/js/interfaces/requests/additional-coverages-request.interface.js +2 -0
  61. package/src/js/interfaces/requests/index.d.ts +2 -0
  62. package/src/js/interfaces/requests/index.js +2 -0
  63. package/src/js/interfaces/requests/moped-rate-request.interface.d.ts +21 -0
  64. package/src/js/interfaces/requests/moped-rate-request.interface.js +2 -0
  65. package/src/js/interfaces/storage.interface.d.ts +8 -0
  66. package/src/js/interfaces/storage.interface.js +2 -0
  67. package/src/js/interfaces/user.interface.d.ts +23 -0
  68. package/src/js/interfaces/user.interface.js +2 -0
  69. package/src/js/interfaces/utils/index.d.ts +2 -0
  70. package/src/js/interfaces/utils/index.js +2 -0
  71. package/src/js/interfaces/utils/timestampable.interface.d.ts +5 -0
  72. package/src/js/interfaces/utils/timestampable.interface.js +2 -0
  73. package/src/js/interfaces/utils/to-object.interface.d.ts +4 -0
  74. package/src/js/interfaces/utils/to-object.interface.js +2 -0
  75. package/src/js/maps/index.d.ts +2 -0
  76. package/src/js/maps/index.js +7 -0
  77. package/src/js/maps/insurance-key.config.d.ts +2 -0
  78. package/src/js/maps/insurance-key.config.js +13 -0
  79. package/src/js/maps/risk-insurance.map.d.ts +1 -0
  80. package/src/js/maps/risk-insurance.map.js +24 -0
  81. package/src/js/models/comparison/comparison-data-collection.model.d.ts +23 -0
  82. package/src/js/models/comparison/comparison-data-collection.model.js +149 -0
  83. package/src/js/models/comparison/comparison-insurance-data.model.d.ts +15 -0
  84. package/src/js/models/comparison/comparison-insurance-data.model.js +85 -0
  85. package/src/js/models/comparison/comparison-insurance.model.d.ts +17 -0
  86. package/src/js/models/comparison/comparison-insurance.model.js +43 -0
  87. package/src/js/models/comparison/comparison.model.d.ts +20 -0
  88. package/src/js/models/comparison/comparison.model.js +47 -0
  89. package/src/js/models/comparison/index.d.ts +4 -0
  90. package/src/js/models/comparison/index.js +11 -0
  91. package/src/js/models/configuration/configuration.model.d.ts +18 -0
  92. package/src/js/models/configuration/configuration.model.js +52 -0
  93. package/src/js/models/configuration/default-configuration.model.d.ts +5 -0
  94. package/src/js/models/configuration/default-configuration.model.js +34 -0
  95. package/src/js/models/configuration/index.d.ts +2 -0
  96. package/src/js/models/configuration/index.js +7 -0
  97. package/src/js/models/dkm-rate.model.d.ts +4 -0
  98. package/src/js/models/dkm-rate.model.js +26 -0
  99. package/src/js/models/documents.model.d.ts +9 -0
  100. package/src/js/models/documents.model.js +16 -0
  101. package/src/js/models/enra-model.d.ts +7 -0
  102. package/src/js/models/enra-model.js +30 -0
  103. package/src/js/models/index.d.ts +15 -0
  104. package/src/js/models/index.js +45 -0
  105. package/src/js/models/laka-rate.model.d.ts +7 -0
  106. package/src/js/models/laka-rate.model.js +29 -0
  107. package/src/js/models/moneyview-rate.model.d.ts +7 -0
  108. package/src/js/models/moneyview-rate.model.js +30 -0
  109. package/src/js/models/package-rate.model.d.ts +11 -0
  110. package/src/js/models/package-rate.model.js +109 -0
  111. package/src/js/models/pet/index.d.ts +1 -0
  112. package/src/js/models/pet/index.js +5 -0
  113. package/src/js/models/pet/petsecur-rate.model.d.ts +6 -0
  114. package/src/js/models/pet/petsecur-rate.model.js +29 -0
  115. package/src/js/models/rate-collection.model.d.ts +16 -0
  116. package/src/js/models/rate-collection.model.js +91 -0
  117. package/src/js/models/rate.model.d.ts +21 -0
  118. package/src/js/models/rate.model.js +108 -0
  119. package/src/js/models/risk-rate.model.d.ts +6 -0
  120. package/src/js/models/risk-rate.model.js +30 -0
  121. package/src/js/models/rolls-rate.model.d.ts +6 -0
  122. package/src/js/models/rolls-rate.model.js +30 -0
  123. package/src/js/models/undefined-rate.model.d.ts +7 -0
  124. package/src/js/models/undefined-rate.model.js +29 -0
  125. package/src/js/models/user.model.d.ts +36 -0
  126. package/src/js/models/user.model.js +115 -0
  127. package/src/js/models/vergelijkdirect-rate.model.d.ts +6 -0
  128. package/src/js/models/vergelijkdirect-rate.model.js +30 -0
  129. package/src/js/resources/base.resource.d.ts +9 -0
  130. package/src/js/resources/base.resource.js +12 -0
  131. package/src/js/resources/bike.resource.d.ts +8 -0
  132. package/src/js/resources/bike.resource.js +47 -0
  133. package/src/js/resources/car.resource.d.ts +12 -0
  134. package/src/js/resources/car.resource.js +70 -0
  135. package/src/js/resources/caravan.resource.d.ts +12 -0
  136. package/src/js/resources/caravan.resource.js +64 -0
  137. package/src/js/resources/categories.resource.d.ts +13 -0
  138. package/src/js/resources/categories.resource.js +123 -0
  139. package/src/js/resources/comparison-module.resource.d.ts +8 -0
  140. package/src/js/resources/comparison-module.resource.js +41 -0
  141. package/src/js/resources/comparison.resource.d.ts +9 -0
  142. package/src/js/resources/comparison.resource.js +48 -0
  143. package/src/js/resources/data-validation.resource.d.ts +9 -0
  144. package/src/js/resources/data-validation.resource.js +59 -0
  145. package/src/js/resources/data.resource.d.ts +10 -0
  146. package/src/js/resources/data.resource.js +80 -0
  147. package/src/js/resources/document.resource.d.ts +7 -0
  148. package/src/js/resources/document.resource.js +36 -0
  149. package/src/js/resources/home.resource.d.ts +10 -0
  150. package/src/js/resources/home.resource.js +57 -0
  151. package/src/js/resources/household.resource.d.ts +8 -0
  152. package/src/js/resources/household.resource.js +43 -0
  153. package/src/js/resources/housing.resource.d.ts +8 -0
  154. package/src/js/resources/housing.resource.js +44 -0
  155. package/src/js/resources/index.d.ts +19 -0
  156. package/src/js/resources/index.js +41 -0
  157. package/src/js/resources/legal-assistance.resource.d.ts +10 -0
  158. package/src/js/resources/legal-assistance.resource.js +57 -0
  159. package/src/js/resources/liability.resource.d.ts +6 -0
  160. package/src/js/resources/liability.resource.js +35 -0
  161. package/src/js/resources/loan.resource.d.ts +7 -0
  162. package/src/js/resources/loan.resource.js +35 -0
  163. package/src/js/resources/moped.resource.d.ts +13 -0
  164. package/src/js/resources/moped.resource.js +78 -0
  165. package/src/js/resources/motor.resource.d.ts +12 -0
  166. package/src/js/resources/motor.resource.js +70 -0
  167. package/src/js/resources/package.resource.d.ts +14 -0
  168. package/src/js/resources/package.resource.js +84 -0
  169. package/src/js/resources/partner.resource.d.ts +8 -0
  170. package/src/js/resources/partner.resource.js +42 -0
  171. package/src/js/resources/pet.resource.d.ts +8 -0
  172. package/src/js/resources/pet.resource.js +41 -0
  173. package/src/js/resources/travel.resource.d.ts +9 -0
  174. package/src/js/resources/travel.resource.js +49 -0
  175. package/src/js/resources/user.resource.d.ts +7 -0
  176. package/src/js/resources/user.resource.js +35 -0
  177. package/src/js/resources/v1.resource.d.ts +22 -0
  178. package/src/js/resources/v1.resource.js +119 -0
  179. package/src/js/services/bike.service.d.ts +10 -0
  180. package/src/js/services/bike.service.js +97 -0
  181. package/src/js/services/car.service.d.ts +14 -0
  182. package/src/js/services/car.service.js +108 -0
  183. package/src/js/services/caravan.service.d.ts +15 -0
  184. package/src/js/services/caravan.service.js +130 -0
  185. package/src/js/services/comparison-module.service.d.ts +7 -0
  186. package/src/js/services/comparison-module.service.js +16 -0
  187. package/src/js/services/comparison.service.d.ts +9 -0
  188. package/src/js/services/comparison.service.js +102 -0
  189. package/src/js/services/configurations.service.d.ts +12 -0
  190. package/src/js/services/configurations.service.js +81 -0
  191. package/src/js/services/data-validation.service.d.ts +8 -0
  192. package/src/js/services/data-validation.service.js +20 -0
  193. package/src/js/services/data.service.d.ts +9 -0
  194. package/src/js/services/data.service.js +74 -0
  195. package/src/js/services/document.service.d.ts +8 -0
  196. package/src/js/services/document.service.js +86 -0
  197. package/src/js/services/home.service.d.ts +12 -0
  198. package/src/js/services/home.service.js +90 -0
  199. package/src/js/services/household.service.d.ts +10 -0
  200. package/src/js/services/household.service.js +84 -0
  201. package/src/js/services/housing.service.d.ts +10 -0
  202. package/src/js/services/housing.service.js +97 -0
  203. package/src/js/services/index.d.ts +24 -0
  204. package/src/js/services/index.js +51 -0
  205. package/src/js/services/legal-assistance.service.d.ts +12 -0
  206. package/src/js/services/legal-assistance.service.js +90 -0
  207. package/src/js/services/liability.service.d.ts +9 -0
  208. package/src/js/services/liability.service.js +81 -0
  209. package/src/js/services/loan.service.d.ts +9 -0
  210. package/src/js/services/loan.service.js +80 -0
  211. package/src/js/services/moped.service.d.ts +16 -0
  212. package/src/js/services/moped.service.js +129 -0
  213. package/src/js/services/motor.service.d.ts +16 -0
  214. package/src/js/services/motor.service.js +128 -0
  215. package/src/js/services/package.service.d.ts +15 -0
  216. package/src/js/services/package.service.js +160 -0
  217. package/src/js/services/partner.service.d.ts +7 -0
  218. package/src/js/services/partner.service.js +17 -0
  219. package/src/js/services/pet.service.d.ts +10 -0
  220. package/src/js/services/pet.service.js +84 -0
  221. package/src/js/services/rate.service.d.ts +5 -0
  222. package/src/js/services/rate.service.js +43 -0
  223. package/src/js/services/travel.service.d.ts +11 -0
  224. package/src/js/services/travel.service.js +95 -0
  225. package/src/js/services/user.service.d.ts +6 -0
  226. package/src/js/services/user.service.js +13 -0
  227. package/src/js/services/v1.service.d.ts +19 -0
  228. package/src/js/services/v1.service.js +52 -0
  229. package/src/js/types/common/condition-url.type.d.ts +6 -0
  230. package/src/js/types/common/condition-url.type.js +2 -0
  231. package/src/js/types/common/index.d.ts +2 -0
  232. package/src/js/types/common/index.js +2 -0
  233. package/src/js/types/common/timestamps.type.d.ts +6 -0
  234. package/src/js/types/common/timestamps.type.js +2 -0
  235. package/src/js/types/index.d.ts +1 -0
  236. package/src/js/types/index.js +17 -0
  237. package/src/js/utils/compare-rate-by-coverage.util.d.ts +4 -0
  238. package/src/js/utils/compare-rate-by-coverage.util.js +64 -0
  239. package/src/js/utils/index.d.ts +2 -0
  240. package/src/js/utils/index.js +7 -0
  241. package/src/js/utils/range.util.d.ts +2 -0
  242. package/src/js/utils/range.util.js +5 -0
  243. package/src/js/utils/sorting.util.d.ts +5 -0
  244. package/src/js/utils/sorting.util.js +11 -0
  245. package/src/js/utils/supplierPlacementTracker.util.d.ts +4 -0
  246. package/src/js/utils/supplierPlacementTracker.util.js +18 -0
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
+ return new (P || (P = Promise))(function (resolve, reject) {
20
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
24
+ });
25
+ };
26
+ var __generator = (this && this.__generator) || function (thisArg, body) {
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
+ function verb(n) { return function (v) { return step([n, v]); }; }
30
+ function step(op) {
31
+ if (f) throw new TypeError("Generator is already executing.");
32
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
+ if (y = 0, t) op = [op[0] & 2, t.value];
35
+ switch (op[0]) {
36
+ case 0: case 1: t = op; break;
37
+ case 4: _.label++; return { value: op[1], done: false };
38
+ case 5: _.label++; y = op[1]; op = [0]; continue;
39
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
+ default:
41
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
+ if (t[2]) _.ops.pop();
46
+ _.trys.pop(); continue;
47
+ }
48
+ op = body.call(thisArg, _);
49
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
+ }
52
+ };
53
+ Object.defineProperty(exports, "__esModule", { value: true });
54
+ var resources_1 = require("../resources");
55
+ var models_1 = require("../models");
56
+ var utils_1 = require("../utils");
57
+ var services_1 = require("../services");
58
+ var MotorService = /** @class */ (function (_super) {
59
+ __extends(MotorService, _super);
60
+ function MotorService() {
61
+ var _this = _super.call(this) || this;
62
+ _this.client = new resources_1.MotorResource();
63
+ return _this;
64
+ }
65
+ MotorService.prototype.findMotor = function (licensePlate) {
66
+ return this.client.findMotor(licensePlate);
67
+ };
68
+ MotorService.prototype.checkValidity = function (data) {
69
+ return this.client.checkValidity(data);
70
+ };
71
+ MotorService.prototype.getRates = function (data) {
72
+ return __awaiter(this, void 0, void 0, function () {
73
+ var services, rates;
74
+ return __generator(this, function (_a) {
75
+ switch (_a.label) {
76
+ case 0: return [4 /*yield*/, this.client.getRates(data)];
77
+ case 1:
78
+ services = _a.sent();
79
+ rates = this.handleRates(services);
80
+ return [2 /*return*/, new models_1.RateCollection('motor', rates.sort(utils_1.sortBy.price))];
81
+ }
82
+ });
83
+ });
84
+ };
85
+ MotorService.prototype.getCoverageRateComparison = function (data) {
86
+ return __awaiter(this, void 0, void 0, function () {
87
+ var services, rates;
88
+ return __generator(this, function (_a) {
89
+ switch (_a.label) {
90
+ case 0: return [4 /*yield*/, this.client.getCoverageRateComparison(data)];
91
+ case 1:
92
+ services = _a.sent();
93
+ rates = this.handleRates(services);
94
+ return [2 /*return*/, new models_1.RateCollection('motor', (0, utils_1.compareRateByCoverage)(rates))];
95
+ }
96
+ });
97
+ });
98
+ };
99
+ MotorService.prototype.getCoverageRateComparisonForCoverage = function (coverage, data) {
100
+ return __awaiter(this, void 0, void 0, function () {
101
+ var services, rates;
102
+ return __generator(this, function (_a) {
103
+ switch (_a.label) {
104
+ case 0: return [4 /*yield*/, this.client.getCoverageRateComparison(data, coverage)];
105
+ case 1:
106
+ services = _a.sent();
107
+ rates = this.handleRates(services);
108
+ return [2 /*return*/, new models_1.RateCollection('motor', (0, utils_1.compareRateByCoverage)(rates))];
109
+ }
110
+ });
111
+ });
112
+ };
113
+ MotorService.prototype.getRiskAdditionalCoverages = function (data) {
114
+ return this.client.getRiskAdditionalCoverages(data);
115
+ };
116
+ MotorService.prototype.getMoneyviewAdditionalCoverages = function (data) {
117
+ return this.client.getMoneyviewAdditionalCoverages(data);
118
+ };
119
+ MotorService.prototype.getRollsAdditionalCoverages = function (data) {
120
+ return __awaiter(this, void 0, void 0, function () {
121
+ return __generator(this, function (_a) {
122
+ return [2 /*return*/, this.client.getRollsAdditionalCoverages(data)];
123
+ });
124
+ });
125
+ };
126
+ return MotorService;
127
+ }(services_1.RateService));
128
+ exports.default = MotorService;
@@ -0,0 +1,15 @@
1
+ import { RateCollection } from "../models";
2
+ declare class PackageService {
3
+ private client;
4
+ constructor();
5
+ calculatePackage(criteria: any): Promise<any>;
6
+ calculateAdditionalCoverages(criteria: any): Promise<any>;
7
+ calculatePackages(id: string): Promise<RateCollection>;
8
+ calculateCompanyDiscount(companyName: string, packageRate: any): Promise<any>;
9
+ requestPackage(criteria: any): Promise<any>;
10
+ savePackage(criteria: any): Promise<any>;
11
+ addAdditionalUserInfo(criteria: any): Promise<any>;
12
+ annualDiscount(criteria: any): Promise<any>;
13
+ getRequest(products: any): any;
14
+ }
15
+ export default PackageService;
@@ -0,0 +1,160 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ var __values = (this && this.__values) || function(o) {
39
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
40
+ if (m) return m.call(o);
41
+ if (o && typeof o.length === "number") return {
42
+ next: function () {
43
+ if (o && i >= o.length) o = void 0;
44
+ return { value: o && o[i++], done: !o };
45
+ }
46
+ };
47
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
48
+ };
49
+ Object.defineProperty(exports, "__esModule", { value: true });
50
+ var resources_1 = require("../resources");
51
+ var maps_1 = require("../maps");
52
+ var models_1 = require("../models");
53
+ var utils_1 = require("../utils");
54
+ var supplierPlacementTracker_util_1 = require("../utils/supplierPlacementTracker.util");
55
+ var core_1 = require("../core");
56
+ var PackageService = /** @class */ (function () {
57
+ function PackageService() {
58
+ this.client = new resources_1.PackageResource();
59
+ }
60
+ PackageService.prototype.calculatePackage = function (criteria) {
61
+ return this.client.calculatePackage(criteria);
62
+ };
63
+ PackageService.prototype.calculateAdditionalCoverages = function (criteria) {
64
+ return this.client.calculateAdditionalCoverages(criteria);
65
+ };
66
+ PackageService.prototype.calculatePackages = function (id) {
67
+ return __awaiter(this, void 0, void 0, function () {
68
+ var emptySet, ratesArray, e_1, comparisonData, promises, ratesArray_1, ratesArray_1_1, rateObject;
69
+ var e_2, _a;
70
+ return __generator(this, function (_b) {
71
+ switch (_b.label) {
72
+ case 0:
73
+ emptySet = new models_1.RateCollection();
74
+ ratesArray = [];
75
+ _b.label = 1;
76
+ case 1:
77
+ _b.trys.push([1, 3, , 4]);
78
+ return [4 /*yield*/, this.client.calculatePackages(id)];
79
+ case 2:
80
+ ratesArray = _b.sent();
81
+ if (ratesArray.length === 0) {
82
+ return [2 /*return*/, emptySet];
83
+ }
84
+ return [3 /*break*/, 4];
85
+ case 3:
86
+ e_1 = _b.sent();
87
+ return [2 /*return*/, emptySet];
88
+ case 4:
89
+ comparisonData = core_1.Injector.instance.get(id);
90
+ promises = [];
91
+ // in this case we dont need to calculate discounts
92
+ if (comparisonData.funnel != 'package') {
93
+ return [2 /*return*/, new models_1.RateCollection('package', ratesArray.filter(Boolean).sort(utils_1.sortBy.price))];
94
+ }
95
+ try {
96
+ for (ratesArray_1 = __values(ratesArray), ratesArray_1_1 = ratesArray_1.next(); !ratesArray_1_1.done; ratesArray_1_1 = ratesArray_1.next()) {
97
+ rateObject = ratesArray_1_1.value;
98
+ promises.push(this.client.calculatePackageDiscount(rateObject['CompanyName'], rateObject)
99
+ .catch(function (e) { return null; }));
100
+ }
101
+ }
102
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
103
+ finally {
104
+ try {
105
+ if (ratesArray_1_1 && !ratesArray_1_1.done && (_a = ratesArray_1.return)) _a.call(ratesArray_1);
106
+ }
107
+ finally { if (e_2) throw e_2.error; }
108
+ }
109
+ return [2 /*return*/, Promise.all(promises).then(function (rates) {
110
+ return new models_1.RateCollection('package', rates.filter(Boolean).sort(utils_1.sortBy.price));
111
+ })];
112
+ }
113
+ });
114
+ });
115
+ };
116
+ PackageService.prototype.calculateCompanyDiscount = function (companyName, packageRate) {
117
+ return this.client.calculatePackageDiscount(companyName, packageRate);
118
+ };
119
+ PackageService.prototype.requestPackage = function (criteria) {
120
+ return __awaiter(this, void 0, void 0, function () {
121
+ var response;
122
+ return __generator(this, function (_a) {
123
+ switch (_a.label) {
124
+ case 0:
125
+ if (localStorage.getItem('supplierID') && localStorage.getItem('placementID')) {
126
+ criteria['SupplierID'] = localStorage.getItem('supplierID');
127
+ criteria['PlacementID'] = localStorage.getItem('placementID');
128
+ }
129
+ return [4 /*yield*/, this.client.requestPackage(criteria)];
130
+ case 1:
131
+ response = _a.sent();
132
+ supplierPlacementTracker_util_1.supplierPlacementTracker.removeParams();
133
+ return [2 /*return*/, response];
134
+ }
135
+ });
136
+ });
137
+ };
138
+ PackageService.prototype.savePackage = function (criteria) {
139
+ return this.client.savePackage(criteria);
140
+ };
141
+ PackageService.prototype.addAdditionalUserInfo = function (criteria) {
142
+ return this.client.addAdditionalUserInfo(criteria);
143
+ };
144
+ PackageService.prototype.annualDiscount = function (criteria) {
145
+ return this.client.annualDiscount(criteria);
146
+ };
147
+ PackageService.prototype.getRequest = function (products) {
148
+ var request = {};
149
+ for (var i = 0; i < products.length; i++) {
150
+ var category = (0, maps_1.mapRiskInsurances)(products[i]['Category']);
151
+ if (!request.hasOwnProperty(category)) {
152
+ request[category] = [];
153
+ }
154
+ request[category].push(products[i]);
155
+ }
156
+ return request;
157
+ };
158
+ return PackageService;
159
+ }());
160
+ exports.default = PackageService;
@@ -0,0 +1,7 @@
1
+ declare class PartnerService {
2
+ private client;
3
+ constructor();
4
+ getPartnerInfo(id?: number | null): Promise<any>;
5
+ getPartnerVersion(): Promise<any>;
6
+ }
7
+ export default PartnerService;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var resources_1 = require("../resources");
4
+ var PartnerService = /** @class */ (function () {
5
+ function PartnerService() {
6
+ this.client = new resources_1.PartnerResource();
7
+ }
8
+ PartnerService.prototype.getPartnerInfo = function (id) {
9
+ if (id === void 0) { id = null; }
10
+ return this.client.getPartnerInfo(id);
11
+ };
12
+ PartnerService.prototype.getPartnerVersion = function () {
13
+ return this.client.getPartnerVersion();
14
+ };
15
+ return PartnerService;
16
+ }());
17
+ exports.default = PartnerService;
@@ -0,0 +1,10 @@
1
+ import { AdditionalCoverageInterface, AdditionalCoveragesRequestInterface, CalculateRatesInterface } from "../interfaces";
2
+ import { RateCollection } from "../models";
3
+ import { RateService } from "../services";
4
+ declare class PetService extends RateService implements CalculateRatesInterface {
5
+ private client;
6
+ constructor();
7
+ getRates(data: any): Promise<RateCollection>;
8
+ getPetsecureAdditionalCoverages(data: AdditionalCoveragesRequestInterface): Promise<AdditionalCoverageInterface[] | []>;
9
+ }
10
+ export default PetService;
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
+ return new (P || (P = Promise))(function (resolve, reject) {
20
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
24
+ });
25
+ };
26
+ var __generator = (this && this.__generator) || function (thisArg, body) {
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
+ function verb(n) { return function (v) { return step([n, v]); }; }
30
+ function step(op) {
31
+ if (f) throw new TypeError("Generator is already executing.");
32
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
+ if (y = 0, t) op = [op[0] & 2, t.value];
35
+ switch (op[0]) {
36
+ case 0: case 1: t = op; break;
37
+ case 4: _.label++; return { value: op[1], done: false };
38
+ case 5: _.label++; y = op[1]; op = [0]; continue;
39
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
+ default:
41
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
+ if (t[2]) _.ops.pop();
46
+ _.trys.pop(); continue;
47
+ }
48
+ op = body.call(thisArg, _);
49
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
+ }
52
+ };
53
+ Object.defineProperty(exports, "__esModule", { value: true });
54
+ var resources_1 = require("../resources");
55
+ var models_1 = require("../models");
56
+ var utils_1 = require("../utils");
57
+ var services_1 = require("../services");
58
+ var PetService = /** @class */ (function (_super) {
59
+ __extends(PetService, _super);
60
+ function PetService() {
61
+ var _this = _super.call(this) || this;
62
+ _this.client = new resources_1.PetResource();
63
+ return _this;
64
+ }
65
+ PetService.prototype.getRates = function (data) {
66
+ return __awaiter(this, void 0, void 0, function () {
67
+ var services, rates;
68
+ return __generator(this, function (_a) {
69
+ switch (_a.label) {
70
+ case 0: return [4 /*yield*/, this.client.getRates(data)];
71
+ case 1:
72
+ services = _a.sent();
73
+ rates = this.handleRates(services);
74
+ return [2 /*return*/, new models_1.RateCollection('pet', rates.sort(utils_1.sortBy.price))];
75
+ }
76
+ });
77
+ });
78
+ };
79
+ PetService.prototype.getPetsecureAdditionalCoverages = function (data) {
80
+ return this.client.getPetsecurAdditionalCoverages(data);
81
+ };
82
+ return PetService;
83
+ }(services_1.RateService));
84
+ exports.default = PetService;
@@ -0,0 +1,5 @@
1
+ import { NextableInterface } from "../interfaces";
2
+ declare class RateService {
3
+ protected handleRates(services: NextableInterface[]): any;
4
+ }
5
+ export default RateService;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __values = (this && this.__values) || function(o) {
3
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
4
+ if (m) return m.call(o);
5
+ if (o && typeof o.length === "number") return {
6
+ next: function () {
7
+ if (o && i >= o.length) o = void 0;
8
+ return { value: o && o[i++], done: !o };
9
+ }
10
+ };
11
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ var handlers_1 = require("../handlers");
15
+ var RateService = /** @class */ (function () {
16
+ function RateService() {
17
+ }
18
+ RateService.prototype.handleRates = function (services) {
19
+ var e_1, _a;
20
+ var rateHandlersPull = [new handlers_1.RateHandler()];
21
+ var index = 0;
22
+ try {
23
+ for (var services_1 = __values(services), services_1_1 = services_1.next(); !services_1_1.done; services_1_1 = services_1.next()) {
24
+ var service = services_1_1.value;
25
+ if (service !== undefined) {
26
+ rateHandlersPull
27
+ .push(rateHandlersPull[index].setNext(new handlers_1.RateHandler(service)));
28
+ index++;
29
+ }
30
+ }
31
+ }
32
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
33
+ finally {
34
+ try {
35
+ if (services_1_1 && !services_1_1.done && (_a = services_1.return)) _a.call(services_1);
36
+ }
37
+ finally { if (e_1) throw e_1.error; }
38
+ }
39
+ return rateHandlersPull[0].handle();
40
+ };
41
+ return RateService;
42
+ }());
43
+ exports.default = RateService;
@@ -0,0 +1,11 @@
1
+ import { RateCollection } from "../models";
2
+ import { AdditionalCoverageInterface, CalculateRatesInterface } from "../interfaces";
3
+ import RateService from "./rate.service";
4
+ declare class TravelService extends RateService implements CalculateRatesInterface {
5
+ private client;
6
+ constructor();
7
+ getRates(data: any): Promise<RateCollection>;
8
+ getRiskAdditionalCoverages(data: any): Promise<AdditionalCoverageInterface[] | []>;
9
+ getVergelijkdirectAdditionalCoverages(data: any): Promise<AdditionalCoverageInterface[] | []>;
10
+ }
11
+ export default TravelService;
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
+ return new (P || (P = Promise))(function (resolve, reject) {
20
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
24
+ });
25
+ };
26
+ var __generator = (this && this.__generator) || function (thisArg, body) {
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
+ function verb(n) { return function (v) { return step([n, v]); }; }
30
+ function step(op) {
31
+ if (f) throw new TypeError("Generator is already executing.");
32
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
+ if (y = 0, t) op = [op[0] & 2, t.value];
35
+ switch (op[0]) {
36
+ case 0: case 1: t = op; break;
37
+ case 4: _.label++; return { value: op[1], done: false };
38
+ case 5: _.label++; y = op[1]; op = [0]; continue;
39
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
+ default:
41
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
+ if (t[2]) _.ops.pop();
46
+ _.trys.pop(); continue;
47
+ }
48
+ op = body.call(thisArg, _);
49
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
+ }
52
+ };
53
+ Object.defineProperty(exports, "__esModule", { value: true });
54
+ var models_1 = require("../models");
55
+ var utils_1 = require("../utils");
56
+ var rate_service_1 = require("./rate.service");
57
+ var travel_resource_1 = require("../resources/travel.resource");
58
+ var TravelService = /** @class */ (function (_super) {
59
+ __extends(TravelService, _super);
60
+ function TravelService() {
61
+ var _this = _super.call(this) || this;
62
+ _this.client = new travel_resource_1.default();
63
+ return _this;
64
+ }
65
+ TravelService.prototype.getRates = function (data) {
66
+ return __awaiter(this, void 0, void 0, function () {
67
+ var services, rates;
68
+ return __generator(this, function (_a) {
69
+ switch (_a.label) {
70
+ case 0: return [4 /*yield*/, this.client.getRates(data)];
71
+ case 1:
72
+ services = _a.sent();
73
+ rates = this.handleRates(services);
74
+ return [2 /*return*/, new models_1.RateCollection('travel', rates.sort(utils_1.sortBy.price))];
75
+ }
76
+ });
77
+ });
78
+ };
79
+ TravelService.prototype.getRiskAdditionalCoverages = function (data) {
80
+ return __awaiter(this, void 0, void 0, function () {
81
+ return __generator(this, function (_a) {
82
+ return [2 /*return*/, this.client.getRiskAdditionalCoverages(data)];
83
+ });
84
+ });
85
+ };
86
+ TravelService.prototype.getVergelijkdirectAdditionalCoverages = function (data) {
87
+ return __awaiter(this, void 0, void 0, function () {
88
+ return __generator(this, function (_a) {
89
+ return [2 /*return*/, this.client.getVergelijkdirectAdditionalCoverages(data)];
90
+ });
91
+ });
92
+ };
93
+ return TravelService;
94
+ }(rate_service_1.default));
95
+ exports.default = TravelService;
@@ -0,0 +1,6 @@
1
+ declare class UserService {
2
+ private client;
3
+ constructor();
4
+ create(data: any): Promise<any>;
5
+ }
6
+ export default UserService;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var user_resource_1 = require("../resources/user.resource");
4
+ var UserService = /** @class */ (function () {
5
+ function UserService() {
6
+ this.client = new user_resource_1.default();
7
+ }
8
+ UserService.prototype.create = function (data) {
9
+ return this.client.create(data);
10
+ };
11
+ return UserService;
12
+ }());
13
+ exports.default = UserService;
@@ -0,0 +1,19 @@
1
+ declare class V1Service {
2
+ private client;
3
+ constructor();
4
+ getDog(): Promise<any>;
5
+ getCat(): Promise<any>;
6
+ getDogsRates(data: any): Promise<any>;
7
+ getCatsRates(data: any): Promise<any>;
8
+ getPetFilters(): Promise<any>;
9
+ getHealthPackageInfo(packageId: number, extraPackageId: number, data: any): Promise<any>;
10
+ getHealthRates(data: any): Promise<any>;
11
+ getBikeRates(data: any): Promise<any>;
12
+ getBikesFilters(): Promise<any>;
13
+ getBikesTermins(): Promise<any>;
14
+ getCarCoverages(): Promise<any>;
15
+ getCarsRates(license_plate: string, data: any): Promise<any>;
16
+ getExtraOptions(auto_category_id: number): Promise<any>;
17
+ getVergelijkdirectAdditionalCoverages(data: any): Promise<any>;
18
+ }
19
+ export default V1Service;