@vergelijkdirect/insurance-transmission-client 1.3.63 → 1.3.65

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 (30) hide show
  1. package/package.json +1 -1
  2. package/src/js/factories/api-service.factory.js +3 -0
  3. package/src/js/interfaces/index.d.ts +1 -0
  4. package/src/js/interfaces/professions.interface.d.ts +8 -0
  5. package/src/js/resources/business-liability.resource.d.ts +6 -0
  6. package/src/js/resources/business-liability.resource.js +34 -0
  7. package/src/js/resources/data.resource.d.ts +2 -1
  8. package/src/js/resources/data.resource.js +7 -0
  9. package/src/js/resources/index.d.ts +1 -0
  10. package/src/js/resources/index.js +3 -1
  11. package/src/js/resources/liability-business.resource.d.ts +6 -0
  12. package/src/js/resources/liability-business.resource.js +35 -0
  13. package/src/js/services/business-liability.service.d.ts +9 -0
  14. package/src/js/services/business-liability.service.js +81 -0
  15. package/src/js/services/comparison.service.js +7 -0
  16. package/src/js/services/data.service.d.ts +2 -1
  17. package/src/js/services/data.service.js +4 -0
  18. package/src/js/services/index.d.ts +1 -0
  19. package/src/js/services/index.js +3 -1
  20. package/src/js/services/liability-business.service.d.ts +9 -0
  21. package/src/js/services/liability-business.service.js +81 -0
  22. package/src/js/services/package.service.js +3 -0
  23. package/src/js/utils/supplierPlacementTracker.util.d.ts +2 -0
  24. package/src/js/utils/supplierPlacementTracker.util.js +53 -0
  25. package/src/js/clients/shopping-card.client.d.ts +0 -27
  26. package/src/js/clients/shopping-card.client.js +0 -96
  27. package/src/js/interfaces/abstract-rate.interface.d.ts +0 -8
  28. package/src/js/maps/nl-insurance.map.d.ts +0 -1
  29. package/src/js/maps/nl-insurance.map.js +0 -18
  30. /package/src/js/interfaces/{abstract-rate.interface.js → professions.interface.js} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vergelijkdirect/insurance-transmission-client",
3
- "version": "1.3.63",
3
+ "version": "1.3.65",
4
4
  "description": "",
5
5
  "main": "./src/js/index.js",
6
6
  "scripts": {
@@ -26,6 +26,9 @@ var ApiServiceFactory = /** @class */ (function () {
26
26
  else if (insuranceCategory === 'household') {
27
27
  return new services_1.HouseholdService();
28
28
  }
29
+ else if (insuranceCategory === 'business-liability') {
30
+ return new services_1.BusinessLiabilityService();
31
+ }
29
32
  else if (insuranceCategory === 'liability') {
30
33
  return new services_1.LiabilityService();
31
34
  }
@@ -6,6 +6,7 @@ export { default as CalculateRatesInterface } from './calculate-rates.interface'
6
6
  export { default as UserInterface } from './user.interface';
7
7
  export { default as NextableInterface } from './nextable.interface';
8
8
  export { default as ConvertedFileInterface } from './file.interface';
9
+ export { default as ProfessionsInterface } from './professions.interface';
9
10
  export * from './comparison';
10
11
  export * from './utils';
11
12
  export * from './requests';
@@ -0,0 +1,8 @@
1
+ type ProfessionsQuestionsType = 'ImportExportGoods' | 'ShowFireHazardousWork';
2
+ export interface ProfessionsInterface {
3
+ id: number;
4
+ name: string;
5
+ sbi_activities: string[];
6
+ questions: ProfessionsQuestionsType[];
7
+ }
8
+ export default ProfessionsInterface;
@@ -0,0 +1,6 @@
1
+ import CategoriesResource from "./categories.resource";
2
+ declare class BusinessLiabilityResource extends CategoriesResource {
3
+ protected getCategory(): string;
4
+ protected getAvailableServices(): string[];
5
+ }
6
+ export default BusinessLiabilityResource;
@@ -0,0 +1,34 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ var categories_resource_1 = require("./categories.resource");
19
+ var BusinessLiabilityResource = /** @class */ (function (_super) {
20
+ __extends(BusinessLiabilityResource, _super);
21
+ function BusinessLiabilityResource() {
22
+ return _super !== null && _super.apply(this, arguments) || this;
23
+ }
24
+ BusinessLiabilityResource.prototype.getCategory = function () {
25
+ return 'business-liability';
26
+ };
27
+ BusinessLiabilityResource.prototype.getAvailableServices = function () {
28
+ return [
29
+ 'vergelijkdirect',
30
+ ];
31
+ };
32
+ return BusinessLiabilityResource;
33
+ }(categories_resource_1.default));
34
+ exports.default = BusinessLiabilityResource;
@@ -1,4 +1,4 @@
1
- import { EnvironmentInterface, ConvertedFileInterface } from "../interfaces";
1
+ import { EnvironmentInterface, ConvertedFileInterface, ProfessionsInterface } from "../interfaces";
2
2
  import BaseResource from "./base.resource";
3
3
  declare class DataResource extends BaseResource {
4
4
  protected getBaseUrl(env: EnvironmentInterface): string;
@@ -19,5 +19,6 @@ declare class DataResource extends BaseResource {
19
19
  getProfileInfo(kvkNumber: number | string): Promise<any>;
20
20
  getSBIInfo(data: any): Promise<any>;
21
21
  sentKickbiteTracking(data: any): Promise<any>;
22
+ getProfessions(sbiCode?: string): Promise<ProfessionsInterface[]>;
22
23
  }
23
24
  export default DataResource;
@@ -123,6 +123,13 @@ var DataResource = /** @class */ (function (_super) {
123
123
  data: data,
124
124
  });
125
125
  };
126
+ DataResource.prototype.getProfessions = function (sbiCode) {
127
+ if (sbiCode === void 0) { sbiCode = ''; }
128
+ return this.http({
129
+ method: 'get',
130
+ url: "/data/professions?sbiCode=".concat(sbiCode),
131
+ });
132
+ };
126
133
  return DataResource;
127
134
  }(base_resource_1.default));
128
135
  exports.default = DataResource;
@@ -11,6 +11,7 @@ export { default as BikeResource } from "./bike.resource";
11
11
  export { default as PackageResource } from "./package.resource";
12
12
  export { default as HouseholdResource } from "./household.resource";
13
13
  export { default as HousingResource } from "./housing.resource";
14
+ export { default as BusinessLiabilityResource } from "./business-liability.resource";
14
15
  export { default as LiabilityResource } from "./liability.resource";
15
16
  export { default as LegalAssistanceResource } from "./legal-assistance.resource";
16
17
  export { default as PartnerResource } from "./partner.resource";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GoogleResource = exports.DataValidationResource = exports.ComparisonResource = exports.DocumentResource = exports.ComparisonModuleResource = exports.PartnerResource = exports.LegalAssistanceResource = exports.LiabilityResource = exports.HousingResource = exports.HouseholdResource = exports.PackageResource = exports.BikeResource = exports.CaravanResource = exports.CarResource = exports.BusinessCarResource = exports.MotorResource = exports.MopedResource = exports.HomeResource = exports.DataResource = exports.LoanResource = exports.PetResource = void 0;
3
+ exports.GoogleResource = exports.DataValidationResource = exports.ComparisonResource = exports.DocumentResource = exports.ComparisonModuleResource = exports.PartnerResource = exports.LegalAssistanceResource = exports.LiabilityResource = exports.BusinessLiabilityResource = exports.HousingResource = exports.HouseholdResource = exports.PackageResource = exports.BikeResource = exports.CaravanResource = exports.CarResource = exports.BusinessCarResource = exports.MotorResource = exports.MopedResource = exports.HomeResource = exports.DataResource = exports.LoanResource = exports.PetResource = void 0;
4
4
  var pet_resource_1 = require("./pet.resource");
5
5
  Object.defineProperty(exports, "PetResource", { enumerable: true, get: function () { return pet_resource_1.default; } });
6
6
  var loan_resource_1 = require("./loan.resource");
@@ -27,6 +27,8 @@ var household_resource_1 = require("./household.resource");
27
27
  Object.defineProperty(exports, "HouseholdResource", { enumerable: true, get: function () { return household_resource_1.default; } });
28
28
  var housing_resource_1 = require("./housing.resource");
29
29
  Object.defineProperty(exports, "HousingResource", { enumerable: true, get: function () { return housing_resource_1.default; } });
30
+ var business_liability_resource_1 = require("./business-liability.resource");
31
+ Object.defineProperty(exports, "BusinessLiabilityResource", { enumerable: true, get: function () { return business_liability_resource_1.default; } });
30
32
  var liability_resource_1 = require("./liability.resource");
31
33
  Object.defineProperty(exports, "LiabilityResource", { enumerable: true, get: function () { return liability_resource_1.default; } });
32
34
  var legal_assistance_resource_1 = require("./legal-assistance.resource");
@@ -0,0 +1,6 @@
1
+ import CategoriesResource from "./categories.resource";
2
+ declare class BusinessLiabilityResource extends CategoriesResource {
3
+ protected getCategory(): string;
4
+ protected getAvailableServices(): string[];
5
+ }
6
+ export default BusinessLiabilityResource;
@@ -0,0 +1,35 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ var categories_resource_1 = require("./categories.resource");
19
+ var BusinessLiabilityResource = /** @class */ (function (_super) {
20
+ __extends(BusinessLiabilityResource, _super);
21
+ function BusinessLiabilityResource() {
22
+ return _super !== null && _super.apply(this, arguments) || this;
23
+ }
24
+ BusinessLiabilityResource.prototype.getCategory = function () {
25
+ // return 'liability-business';
26
+ return 'business-liability';
27
+ };
28
+ BusinessLiabilityResource.prototype.getAvailableServices = function () {
29
+ return [
30
+ 'vergelijkdirect',
31
+ ];
32
+ };
33
+ return BusinessLiabilityResource;
34
+ }(categories_resource_1.default));
35
+ exports.default = BusinessLiabilityResource;
@@ -0,0 +1,9 @@
1
+ import { RateCollection } from "../models";
2
+ import { CalculateRatesInterface } from "../interfaces";
3
+ import { RateService } from "./index";
4
+ declare class BusinessLiabilityService extends RateService implements CalculateRatesInterface {
5
+ private client;
6
+ constructor();
7
+ getRates(data: any): Promise<RateCollection>;
8
+ }
9
+ export default BusinessLiabilityService;
@@ -0,0 +1,81 @@
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 index_1 = require("./index");
58
+ var BusinessLiabilityService = /** @class */ (function (_super) {
59
+ __extends(BusinessLiabilityService, _super);
60
+ function BusinessLiabilityService() {
61
+ var _this = _super.call(this) || this;
62
+ _this.client = new resources_1.BusinessLiabilityResource();
63
+ return _this;
64
+ }
65
+ BusinessLiabilityService.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('business-liability', rates.sort(utils_1.sortBy.price))];
75
+ }
76
+ });
77
+ });
78
+ };
79
+ return BusinessLiabilityService;
80
+ }(index_1.RateService));
81
+ exports.default = BusinessLiabilityService;
@@ -39,6 +39,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  var resources_1 = require("../resources");
40
40
  var factories_1 = require("../factories");
41
41
  var core_1 = require("../core");
42
+ var supplierPlacementTracker_util_1 = require("../utils/supplierPlacementTracker.util");
42
43
  var ComparisonService = /** @class */ (function () {
43
44
  function ComparisonService() {
44
45
  this.client = new resources_1.ComparisonResource();
@@ -56,6 +57,9 @@ var ComparisonService = /** @class */ (function () {
56
57
  if (user !== null) {
57
58
  data.user = user;
58
59
  }
60
+ if (supplierPlacementTracker_util_1.supplierPlacementTracker.getSubId()) {
61
+ data.sub_id = supplierPlacementTracker_util_1.supplierPlacementTracker.getSubId();
62
+ }
59
63
  return [4 /*yield*/, this.client.create(data)];
60
64
  case 1:
61
65
  response = _a.sent();
@@ -71,6 +75,9 @@ var ComparisonService = /** @class */ (function () {
71
75
  switch (_a.label) {
72
76
  case 0:
73
77
  data = comparison.toObject();
78
+ if (supplierPlacementTracker_util_1.supplierPlacementTracker.getSubId()) {
79
+ data.sub_id = supplierPlacementTracker_util_1.supplierPlacementTracker.getSubId();
80
+ }
74
81
  return [4 /*yield*/, this.client.update(data, comparison.getId())];
75
82
  case 1:
76
83
  response = _a.sent();
@@ -1,4 +1,4 @@
1
- import { ConvertedFileInterface } from "../interfaces";
1
+ import { ConvertedFileInterface, ProfessionsInterface } from "../interfaces";
2
2
  declare class DataService {
3
3
  private client;
4
4
  constructor();
@@ -19,5 +19,6 @@ declare class DataService {
19
19
  getProfileInfo(kvkNumber: number | string): Promise<any>;
20
20
  getSBIInfo(data: any): Promise<any>;
21
21
  sentKickbiteTracking(data: any): Promise<any>;
22
+ getProfessions(sbiCode?: string): Promise<ProfessionsInterface[]>;
22
23
  }
23
24
  export default DataService;
@@ -102,6 +102,10 @@ var DataService = /** @class */ (function () {
102
102
  DataService.prototype.sentKickbiteTracking = function (data) {
103
103
  return this.client.sentKickbiteTracking(data);
104
104
  };
105
+ DataService.prototype.getProfessions = function (sbiCode) {
106
+ if (sbiCode === void 0) { sbiCode = ''; }
107
+ return this.client.getProfessions(sbiCode);
108
+ };
105
109
  return DataService;
106
110
  }());
107
111
  exports.default = DataService;
@@ -10,6 +10,7 @@ export { default as BikeService } from "./bike.service";
10
10
  export { default as HouseholdService } from "./household.service";
11
11
  export { default as V1Service } from "./v1.service";
12
12
  export { default as HousingService } from "./housing.service";
13
+ export { default as BusinessLiabilityService } from "./business-liability.service";
13
14
  export { default as LiabilityService } from "./liability.service";
14
15
  export { default as LegalAssistanceService } from "./legal-assistance.service";
15
16
  export { default as PartnerService } from "./partner.service";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GoogleService = exports.UserService = exports.TravelService = exports.CarService = exports.BusinessCarService = exports.DataValidationService = exports.ComparisonService = exports.DocumentService = exports.PackageService = exports.ConfigurationsService = exports.ComparisonModuleService = exports.PartnerService = exports.LegalAssistanceService = exports.LiabilityService = exports.HousingService = exports.V1Service = exports.HouseholdService = exports.BikeService = exports.CaravanService = exports.MotorService = exports.MopedService = exports.HomeService = exports.LoanService = exports.PetService = exports.RateService = exports.DataService = void 0;
3
+ exports.GoogleService = exports.UserService = exports.TravelService = exports.CarService = exports.BusinessCarService = exports.DataValidationService = exports.ComparisonService = exports.DocumentService = exports.PackageService = exports.ConfigurationsService = exports.ComparisonModuleService = exports.PartnerService = exports.LegalAssistanceService = exports.LiabilityService = exports.BusinessLiabilityService = exports.HousingService = exports.V1Service = exports.HouseholdService = exports.BikeService = exports.CaravanService = exports.MotorService = exports.MopedService = exports.HomeService = exports.LoanService = exports.PetService = exports.RateService = exports.DataService = void 0;
4
4
  var data_service_1 = require("./data.service");
5
5
  Object.defineProperty(exports, "DataService", { enumerable: true, get: function () { return data_service_1.default; } });
6
6
  var rate_service_1 = require("./rate.service");
@@ -25,6 +25,8 @@ var v1_service_1 = require("./v1.service");
25
25
  Object.defineProperty(exports, "V1Service", { enumerable: true, get: function () { return v1_service_1.default; } });
26
26
  var housing_service_1 = require("./housing.service");
27
27
  Object.defineProperty(exports, "HousingService", { enumerable: true, get: function () { return housing_service_1.default; } });
28
+ var business_liability_service_1 = require("./business-liability.service");
29
+ Object.defineProperty(exports, "BusinessLiabilityService", { enumerable: true, get: function () { return business_liability_service_1.default; } });
28
30
  var liability_service_1 = require("./liability.service");
29
31
  Object.defineProperty(exports, "LiabilityService", { enumerable: true, get: function () { return liability_service_1.default; } });
30
32
  var legal_assistance_service_1 = require("./legal-assistance.service");
@@ -0,0 +1,9 @@
1
+ import { RateCollection } from "../models";
2
+ import { CalculateRatesInterface } from "../interfaces";
3
+ import { RateService } from "./index";
4
+ declare class BusinessLiabilityService extends RateService implements CalculateRatesInterface {
5
+ private client;
6
+ constructor();
7
+ getRates(data: any): Promise<RateCollection>;
8
+ }
9
+ export default BusinessLiabilityService;
@@ -0,0 +1,81 @@
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 index_1 = require("./index");
58
+ var BusinessLiabilityService = /** @class */ (function (_super) {
59
+ __extends(BusinessLiabilityService, _super);
60
+ function BusinessLiabilityService() {
61
+ var _this = _super.call(this) || this;
62
+ _this.client = new resources_1.BusinessLiabilityResource();
63
+ return _this;
64
+ }
65
+ BusinessLiabilityService.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('liability-business', rates.sort(utils_1.sortBy.price))];
75
+ }
76
+ });
77
+ });
78
+ };
79
+ return BusinessLiabilityService;
80
+ }(index_1.RateService));
81
+ exports.default = BusinessLiabilityService;
@@ -126,6 +126,9 @@ var PackageService = /** @class */ (function () {
126
126
  criteria['SupplierID'] = localStorage.getItem('supplierID');
127
127
  criteria['PlacementID'] = localStorage.getItem('placementID');
128
128
  }
129
+ if (supplierPlacementTracker_util_1.supplierPlacementTracker.getSubId()) {
130
+ criteria['SubID'] = supplierPlacementTracker_util_1.supplierPlacementTracker.getSubId();
131
+ }
129
132
  return [4 /*yield*/, this.client.requestPackage(criteria)];
130
133
  case 1:
131
134
  response = _a.sent();
@@ -1,4 +1,6 @@
1
1
  export declare const supplierPlacementTracker: {
2
2
  setParams(): void;
3
3
  removeParams(): void;
4
+ getSubId(): string;
5
+ getCookie(name: string): string;
4
6
  };
@@ -1,4 +1,31 @@
1
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
+ var __read = (this && this.__read) || function (o, n) {
14
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
15
+ if (!m) return o;
16
+ var i = m.call(o), r, ar = [], e;
17
+ try {
18
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
19
+ }
20
+ catch (error) { e = { error: error }; }
21
+ finally {
22
+ try {
23
+ if (r && !r.done && (m = i["return"])) m.call(i);
24
+ }
25
+ finally { if (e) throw e.error; }
26
+ }
27
+ return ar;
28
+ };
2
29
  Object.defineProperty(exports, "__esModule", { value: true });
3
30
  exports.supplierPlacementTracker = void 0;
4
31
  exports.supplierPlacementTracker = {
@@ -14,5 +41,31 @@ exports.supplierPlacementTracker = {
14
41
  removeParams: function () {
15
42
  localStorage.removeItem('supplierID');
16
43
  localStorage.removeItem('placementID');
44
+ },
45
+ getSubId: function () {
46
+ var urlParams = new URLSearchParams(window.location.search);
47
+ var subID = urlParams.get('subid') || this.getCookie('ivanhoe_id');
48
+ return (subID && subID.includes('ivan')) ? subID : '';
49
+ },
50
+ getCookie: function (name) {
51
+ var e_1, _a;
52
+ var cookies = document.cookie.split(';');
53
+ try {
54
+ for (var cookies_1 = __values(cookies), cookies_1_1 = cookies_1.next(); !cookies_1_1.done; cookies_1_1 = cookies_1.next()) {
55
+ var cookie = cookies_1_1.value;
56
+ var _b = __read(cookie.trim().split('=')), key = _b[0], value = _b.slice(1);
57
+ if (key === name) {
58
+ return decodeURIComponent(value.join('='));
59
+ }
60
+ }
61
+ }
62
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
63
+ finally {
64
+ try {
65
+ if (cookies_1_1 && !cookies_1_1.done && (_a = cookies_1.return)) _a.call(cookies_1);
66
+ }
67
+ finally { if (e_1) throw e_1.error; }
68
+ }
69
+ return '';
17
70
  }
18
71
  };
@@ -1,27 +0,0 @@
1
- import { EnvironmentInterface, RateInterface, StorageInterface } from "../interfaces";
2
- declare class ShoppingCardClient {
3
- private products;
4
- private packageService;
5
- private totalPrice;
6
- private totalDiscount;
7
- private subTotal;
8
- private totalCosts;
9
- private storageManager;
10
- onCalculating: boolean;
11
- constructor(storageManager: StorageInterface, env: EnvironmentInterface);
12
- configure(config: EnvironmentInterface): this;
13
- addProduct(rate: RateInterface): this;
14
- setProducts(products: any): this;
15
- getTotalCosts(): number;
16
- getTotalPrice(): number;
17
- getTotalDiscount(): number;
18
- getSubTotal(): number;
19
- getProducts(): any;
20
- setCalculations(calculations: any): this;
21
- initFromStore(): void;
22
- resetCard(): void;
23
- productsCount(): any;
24
- private commit;
25
- private calculatePackage;
26
- }
27
- export default ShoppingCardClient;
@@ -1,96 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var core_1 = require("../core");
4
- var package_service_1 = require("../services/package.service");
5
- var ShoppingCardClient = /** @class */ (function () {
6
- function ShoppingCardClient(storageManager, env) {
7
- this.products = [];
8
- this.totalPrice = 0;
9
- this.totalDiscount = 0;
10
- this.subTotal = 0;
11
- this.totalCosts = 0;
12
- this.onCalculating = false;
13
- this.storageManager = storageManager;
14
- this.configure(env);
15
- this.packageService = new package_service_1.default();
16
- }
17
- ShoppingCardClient.prototype.configure = function (config) {
18
- var injector = core_1.Injector.instance;
19
- injector.constant('environment', config);
20
- return this;
21
- };
22
- ShoppingCardClient.prototype.addProduct = function (rate) {
23
- var rateData = rate.getData();
24
- this.products.push(rateData);
25
- this.calculatePackage();
26
- return this;
27
- };
28
- ShoppingCardClient.prototype.setProducts = function (products) {
29
- this.products = products;
30
- this.calculatePackage();
31
- return this;
32
- };
33
- ShoppingCardClient.prototype.getTotalCosts = function () {
34
- return this.totalCosts;
35
- };
36
- ShoppingCardClient.prototype.getTotalPrice = function () {
37
- return this.totalPrice;
38
- };
39
- ShoppingCardClient.prototype.getTotalDiscount = function () {
40
- return this.totalDiscount;
41
- };
42
- ShoppingCardClient.prototype.getSubTotal = function () {
43
- return this.subTotal;
44
- };
45
- ShoppingCardClient.prototype.getProducts = function () {
46
- return this.products;
47
- };
48
- ShoppingCardClient.prototype.setCalculations = function (calculations) {
49
- this.subTotal = calculations.NettoPremium;
50
- this.totalPrice = calculations.Premium;
51
- this.totalDiscount = calculations.PackageDiscount;
52
- this.totalCosts = calculations.TotalCosts;
53
- this.commit();
54
- return this;
55
- };
56
- ShoppingCardClient.prototype.initFromStore = function () {
57
- this.products = this.storageManager.get('products');
58
- this.totalPrice = this.storageManager.get('totalPrice');
59
- this.totalDiscount = this.storageManager.get('totalDiscount');
60
- this.subTotal = this.storageManager.get('subTotal');
61
- this.totalCosts = this.storageManager.get('totalCosts');
62
- };
63
- ShoppingCardClient.prototype.resetCard = function () {
64
- this.products = [];
65
- this.totalPrice = 0;
66
- this.totalDiscount = 0;
67
- this.subTotal = 0;
68
- this.commit();
69
- };
70
- ShoppingCardClient.prototype.productsCount = function () {
71
- return this.products.length;
72
- };
73
- ShoppingCardClient.prototype.commit = function () {
74
- this.storageManager.put('products', this.products);
75
- this.storageManager.put('totalPrice', this.totalPrice);
76
- this.storageManager.put('totalDiscount', this.totalDiscount);
77
- this.storageManager.put('subTotal', this.subTotal);
78
- this.storageManager.put('totalCosts', this.totalCosts);
79
- return this;
80
- };
81
- ShoppingCardClient.prototype.calculatePackage = function () {
82
- var _this = this;
83
- this.onCalculating = true;
84
- this.packageService.calculatePackage(this.getProducts())
85
- .then(function (calculations) {
86
- _this.setCalculations(calculations);
87
- _this.onCalculating = false;
88
- })
89
- .catch(function (error) {
90
- console.error(error);
91
- _this.onCalculating = false;
92
- });
93
- };
94
- return ShoppingCardClient;
95
- }());
96
- exports.default = ShoppingCardClient;
@@ -1,8 +0,0 @@
1
- interface AbstractRateInterface {
2
- Price: number;
3
- CompanyName: string;
4
- CompanyLogoUrl: string;
5
- Identifier: string;
6
- Coverage: any;
7
- }
8
- export default AbstractRateInterface;
@@ -1 +0,0 @@
1
- export default function (insuranceCategory: string): any;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- function default_1(insuranceCategory) {
4
- var map = {
5
- 'moped': 'brommer',
6
- 'pet': 'dieren',
7
- 'motor': 'motor',
8
- 'home': 'woon',
9
- 'household': 'woon',
10
- 'liability': 'woon',
11
- 'legal-assistance': 'rechtsbijstand',
12
- 'caravan': 'caravan',
13
- 'bike': 'fiets',
14
- 'car': 'car',
15
- };
16
- return map[insuranceCategory];
17
- }
18
- exports.default = default_1;