@bpost/bp-address-auto-complete-by-component 1.0.28 → 1.0.29
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.
- package/VERSION.md +3 -0
- package/bpost-bp-address-auto-complete-by-component.metadata.json +1 -1
- package/bundles/bpost-bp-address-auto-complete-by-component.umd.js +33 -5
- package/bundles/bpost-bp-address-auto-complete-by-component.umd.js.map +1 -1
- package/bundles/bpost-bp-address-auto-complete-by-component.umd.min.js +1 -1
- package/bundles/bpost-bp-address-auto-complete-by-component.umd.min.js.map +1 -1
- package/esm2015/lib/lib-address-autocomplete-by-component.component.js +21 -6
- package/esm2015/lib/services/adress.service.js +2 -1
- package/esm2015/lib/services/http.service.js +15 -2
- package/esm5/lib/lib-address-autocomplete-by-component.component.js +21 -6
- package/esm5/lib/services/adress.service.js +2 -1
- package/esm5/lib/services/http.service.js +16 -3
- package/fesm2015/bpost-bp-address-auto-complete-by-component.js +34 -6
- package/fesm2015/bpost-bp-address-auto-complete-by-component.js.map +1 -1
- package/fesm5/bpost-bp-address-auto-complete-by-component.js +35 -7
- package/fesm5/bpost-bp-address-auto-complete-by-component.js.map +1 -1
- package/lib/lib-address-autocomplete-by-component.component.d.ts +5 -1
- package/lib/services/adress.service.d.ts +1 -0
- package/lib/services/http.service.d.ts +4 -1
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { __decorate,
|
|
1
|
+
import { __decorate, __assign, __values } from 'tslib';
|
|
2
2
|
import { ɵɵdefineInjectable, Injectable, ɵɵinject, EventEmitter, ViewChild, Input, Output, Component, Pipe, ElementRef, Renderer2, Directive, NgModule } from '@angular/core';
|
|
3
3
|
import { map, catchError, tap } from 'rxjs/operators';
|
|
4
4
|
import { throwError, BehaviorSubject } from 'rxjs';
|
|
5
|
-
import { HttpClient, HttpClientModule } from '@angular/common/http';
|
|
5
|
+
import { HttpHeaders, HttpClient, HttpClientModule } from '@angular/common/http';
|
|
6
6
|
import { TranslateService, TranslateModule } from '@ngx-translate/core';
|
|
7
7
|
import { CommonModule } from '@angular/common';
|
|
8
8
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
@@ -67,13 +67,26 @@ var HttpService = /** @class */ (function () {
|
|
|
67
67
|
function HttpService(httpClient) {
|
|
68
68
|
this.httpClient = httpClient;
|
|
69
69
|
this.openConnections = 0;
|
|
70
|
+
this.apiKey = 'no-value';
|
|
70
71
|
}
|
|
72
|
+
HttpService.prototype.setApiKey = function (apiKey) {
|
|
73
|
+
this.apiKey = apiKey;
|
|
74
|
+
};
|
|
75
|
+
HttpService.prototype.getHttpHeaders = function () {
|
|
76
|
+
var headers = new HttpHeaders();
|
|
77
|
+
// Attention !
|
|
78
|
+
// Need to reassign as the 'set' is returning a clone of the headera object !!!
|
|
79
|
+
headers = headers.set('x-api-key', /*'bBkvimXYnAaEEKMyGqoWO2XiaZCQyqUi7VReYzPJ'*/ this.apiKey);
|
|
80
|
+
return headers;
|
|
81
|
+
};
|
|
71
82
|
HttpService.prototype.get = function (url, options) {
|
|
72
83
|
return this.request('GET', url, options);
|
|
73
84
|
};
|
|
74
85
|
HttpService.prototype.request = function (method, url, options) {
|
|
75
86
|
var _this = this;
|
|
76
87
|
options = !!options ? options : {};
|
|
88
|
+
options = __assign(__assign({}, options), { headers: this.getHttpHeaders() });
|
|
89
|
+
console.log('options:', JSON.stringify(options));
|
|
77
90
|
this.openConnections++;
|
|
78
91
|
return this.httpClient.request(method, url, options).pipe(map(function (response) { return _this.handleResponse(response); }), catchError(function (error) { return _this.handleError(error); }));
|
|
79
92
|
};
|
|
@@ -204,6 +217,7 @@ var AddressService = /** @class */ (function () {
|
|
|
204
217
|
this.httpService = httpService;
|
|
205
218
|
this.domain = 'http://10.194.73.9:8080';
|
|
206
219
|
this.localityURL = this.domain + '/AddressAutoComplete/autocomplete/locality?IncludeGeographicalSanction=true';
|
|
220
|
+
this.log = true;
|
|
207
221
|
}
|
|
208
222
|
AddressService.prototype.getLocality = function (baseUrl, params) {
|
|
209
223
|
var _this = this;
|
|
@@ -4061,32 +4075,34 @@ var PrefillData // extends PrefilledParameters
|
|
|
4061
4075
|
}());
|
|
4062
4076
|
|
|
4063
4077
|
var LibAddressAutocompleteByComponentComponent = /** @class */ (function () {
|
|
4064
|
-
function LibAddressAutocompleteByComponentComponent() {
|
|
4078
|
+
function LibAddressAutocompleteByComponentComponent(httpService) {
|
|
4079
|
+
this.httpService = httpService;
|
|
4065
4080
|
this.selectedLanguage = null;
|
|
4081
|
+
this.baseUrl = "https://api.mailops.bpost.cloud/roa-info/externalMailingAddressProofingRest/autocomplete/";
|
|
4066
4082
|
this.showDebugMessageToConsole = false;
|
|
4067
4083
|
this.notInListAllowed = true;
|
|
4068
4084
|
this.messageOption = 'Y';
|
|
4069
4085
|
// LOCALITY
|
|
4070
|
-
this.localityUrl = '
|
|
4086
|
+
this.localityUrl = this.baseUrl + 'locality';
|
|
4071
4087
|
this.maxSuggestionLocality = 5;
|
|
4072
4088
|
this.visibleSuggestionLocalityCount = 5;
|
|
4073
4089
|
// localityParams: PrefilledParameters;
|
|
4074
4090
|
this.localityPrefillData = null;
|
|
4075
4091
|
// STREET
|
|
4076
|
-
this.streetUrl = '
|
|
4092
|
+
this.streetUrl = this.baseUrl + 'street';
|
|
4077
4093
|
this.maxSuggestionStreet = 5;
|
|
4078
4094
|
this.visibleSuggestionStreetCount = 5;
|
|
4079
4095
|
// streetParams: PrefilledParameters;
|
|
4080
4096
|
this.streetPrefillData = null;
|
|
4081
4097
|
// STREET NUMBER
|
|
4082
4098
|
// tslint:disable-next-line:max-line-length
|
|
4083
|
-
this.streetNumberUrl = '
|
|
4099
|
+
this.streetNumberUrl = this.baseUrl + 'streetNumber';
|
|
4084
4100
|
this.maxSuggestionStreetNb = 5;
|
|
4085
4101
|
this.visibleSuggestionStreetNbCount = 5;
|
|
4086
4102
|
// streetNumberParams: PrefilledParameters;
|
|
4087
4103
|
this.streetNumberPrefillData = null;
|
|
4088
4104
|
// BOX NUMBER
|
|
4089
|
-
this.boxNumberUrl = '
|
|
4105
|
+
this.boxNumberUrl = this.baseUrl + 'boxNumber';
|
|
4090
4106
|
this.maxSuggestionBoxNb = 5;
|
|
4091
4107
|
this.visibleSuggestionBoxNbCount = 5;
|
|
4092
4108
|
// boxParams: PrefilledParameters;
|
|
@@ -4097,6 +4113,8 @@ var LibAddressAutocompleteByComponentComponent = /** @class */ (function () {
|
|
|
4097
4113
|
this.validationMessageEventEmitter = new EventEmitter();
|
|
4098
4114
|
this.clearInputEventEmitter = new EventEmitter();
|
|
4099
4115
|
this.processingPrefillData = false;
|
|
4116
|
+
// Pass the API key as a property of the library !
|
|
4117
|
+
this.apiKey = 'cyRkKOD73O1DOdgcDLLnsaOiDh6OyOkt3BBT5JU1';
|
|
4100
4118
|
}
|
|
4101
4119
|
Object.defineProperty(LibAddressAutocompleteByComponentComponent.prototype, "inputLang", {
|
|
4102
4120
|
// @ts-ignore
|
|
@@ -4123,6 +4141,7 @@ var LibAddressAutocompleteByComponentComponent = /** @class */ (function () {
|
|
|
4123
4141
|
configurable: true
|
|
4124
4142
|
});
|
|
4125
4143
|
LibAddressAutocompleteByComponentComponent.prototype.ngOnInit = function () {
|
|
4144
|
+
this.httpService.setApiKey(this.apiKey);
|
|
4126
4145
|
if (this.addressParams) {
|
|
4127
4146
|
this.prefillData = this.addressParams;
|
|
4128
4147
|
}
|
|
@@ -4139,6 +4158,9 @@ var LibAddressAutocompleteByComponentComponent = /** @class */ (function () {
|
|
|
4139
4158
|
if (this.showDebugMessageToConsole) {
|
|
4140
4159
|
this.displayParametersChangesToConsole(changes);
|
|
4141
4160
|
}
|
|
4161
|
+
if (changes.hasOwnProperty('apiKey') && !changes.apiKey.firstChange) {
|
|
4162
|
+
this.httpService.setApiKey(this.apiKey);
|
|
4163
|
+
}
|
|
4142
4164
|
if (changes.hasOwnProperty('addressParams') && !changes.addressParams.firstChange) {
|
|
4143
4165
|
// if (changes.hasOwnProperty('addressParams')) {
|
|
4144
4166
|
this.processingPrefillData = true;
|
|
@@ -4999,6 +5021,9 @@ var LibAddressAutocompleteByComponentComponent = /** @class */ (function () {
|
|
|
4999
5021
|
}
|
|
5000
5022
|
this.quitPrefillMode();
|
|
5001
5023
|
};
|
|
5024
|
+
LibAddressAutocompleteByComponentComponent.ctorParameters = function () { return [
|
|
5025
|
+
{ type: HttpService }
|
|
5026
|
+
]; };
|
|
5002
5027
|
__decorate([
|
|
5003
5028
|
ViewChild(LocalityComponent, { static: false })
|
|
5004
5029
|
], LibAddressAutocompleteByComponentComponent.prototype, "autocompleteLocality", void 0);
|
|
@@ -5095,6 +5120,9 @@ var LibAddressAutocompleteByComponentComponent = /** @class */ (function () {
|
|
|
5095
5120
|
__decorate([
|
|
5096
5121
|
Output()
|
|
5097
5122
|
], LibAddressAutocompleteByComponentComponent.prototype, "clearInputEventEmitter", void 0);
|
|
5123
|
+
__decorate([
|
|
5124
|
+
Input()
|
|
5125
|
+
], LibAddressAutocompleteByComponentComponent.prototype, "apiKey", void 0);
|
|
5098
5126
|
LibAddressAutocompleteByComponentComponent = __decorate([
|
|
5099
5127
|
Component({
|
|
5100
5128
|
selector: 'bp-lib-address-autocomplete-by-component',
|