@bpost/bp-address-auto-complete-by-component 1.0.25 → 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 +17 -0
- package/bpost-bp-address-auto-complete-by-component.metadata.json +1 -1
- package/bundles/bpost-bp-address-auto-complete-by-component.umd.js +56 -8
- 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/locality/locality.component.js +21 -3
- package/esm2015/lib/model/query-parameters.model.js +2 -2
- package/esm2015/lib/services/adress.service.js +2 -1
- package/esm2015/lib/services/http.service.js +15 -2
- package/esm2015/lib/utils/prefill-data.js +3 -1
- package/esm5/lib/lib-address-autocomplete-by-component.component.js +21 -6
- package/esm5/lib/locality/locality.component.js +21 -3
- package/esm5/lib/model/query-parameters.model.js +2 -2
- package/esm5/lib/services/adress.service.js +2 -1
- package/esm5/lib/services/http.service.js +16 -3
- package/esm5/lib/utils/prefill-data.js +3 -1
- package/fesm2015/bpost-bp-address-auto-complete-by-component.js +57 -9
- package/fesm2015/bpost-bp-address-auto-complete-by-component.js.map +1 -1
- package/fesm5/bpost-bp-address-auto-complete-by-component.js +58 -10
- 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/model/query-parameters.model.d.ts +1 -1
- package/lib/services/adress.service.d.ts +1 -0
- package/lib/services/http.service.d.ts +4 -1
- package/lib/utils/prefill-data.d.ts +1 -0
- package/package.json +1 -1
|
@@ -273,7 +273,7 @@
|
|
|
273
273
|
this.sortByStreetNumber = enable;
|
|
274
274
|
};
|
|
275
275
|
QueryParameters.prototype.sortByBox = function (enable) {
|
|
276
|
-
this.
|
|
276
|
+
this.sortByBoxNumber = enable;
|
|
277
277
|
};
|
|
278
278
|
return QueryParameters;
|
|
279
279
|
}());
|
|
@@ -282,13 +282,26 @@
|
|
|
282
282
|
function HttpService(httpClient) {
|
|
283
283
|
this.httpClient = httpClient;
|
|
284
284
|
this.openConnections = 0;
|
|
285
|
+
this.apiKey = 'no-value';
|
|
285
286
|
}
|
|
287
|
+
HttpService.prototype.setApiKey = function (apiKey) {
|
|
288
|
+
this.apiKey = apiKey;
|
|
289
|
+
};
|
|
290
|
+
HttpService.prototype.getHttpHeaders = function () {
|
|
291
|
+
var headers = new http.HttpHeaders();
|
|
292
|
+
// Attention !
|
|
293
|
+
// Need to reassign as the 'set' is returning a clone of the headera object !!!
|
|
294
|
+
headers = headers.set('x-api-key', /*'bBkvimXYnAaEEKMyGqoWO2XiaZCQyqUi7VReYzPJ'*/ this.apiKey);
|
|
295
|
+
return headers;
|
|
296
|
+
};
|
|
286
297
|
HttpService.prototype.get = function (url, options) {
|
|
287
298
|
return this.request('GET', url, options);
|
|
288
299
|
};
|
|
289
300
|
HttpService.prototype.request = function (method, url, options) {
|
|
290
301
|
var _this = this;
|
|
291
302
|
options = !!options ? options : {};
|
|
303
|
+
options = __assign(__assign({}, options), { headers: this.getHttpHeaders() });
|
|
304
|
+
console.log('options:', JSON.stringify(options));
|
|
292
305
|
this.openConnections++;
|
|
293
306
|
return this.httpClient.request(method, url, options).pipe(operators.map(function (response) { return _this.handleResponse(response); }), operators.catchError(function (error) { return _this.handleError(error); }));
|
|
294
307
|
};
|
|
@@ -419,6 +432,7 @@
|
|
|
419
432
|
this.httpService = httpService;
|
|
420
433
|
this.domain = 'http://10.194.73.9:8080';
|
|
421
434
|
this.localityURL = this.domain + '/AddressAutoComplete/autocomplete/locality?IncludeGeographicalSanction=true';
|
|
435
|
+
this.log = true;
|
|
422
436
|
}
|
|
423
437
|
AddressService.prototype.getLocality = function (baseUrl, params) {
|
|
424
438
|
var _this = this;
|
|
@@ -1418,11 +1432,29 @@
|
|
|
1418
1432
|
var suggestionMunicipality = this.transformMunicipalityInLowercaseAndWithoutDiacritics(sugAddress.municipalityName);
|
|
1419
1433
|
if (suggestionLocality === this.prefillData.prefillMunicipalityName
|
|
1420
1434
|
|| suggestionMunicipality === this.prefillData.prefillMunicipalityName) {
|
|
1435
|
+
if (this.prefillData.prefillMunicipalityAndLocalityPerfectMatchFound === true) {
|
|
1436
|
+
if (this.showDebugMessageToConsole) {
|
|
1437
|
+
console.log('LOCALITY - PREFILL - skipping suggestion:', suggestion);
|
|
1438
|
+
}
|
|
1439
|
+
if (this.showDebugMessageToConsole) {
|
|
1440
|
+
console.log('LOCALITY - PREFILL - keeping suggestion:', this.prefillData.prefillMunicipalityPerfectMatchSuggestion);
|
|
1441
|
+
}
|
|
1442
|
+
return;
|
|
1443
|
+
}
|
|
1421
1444
|
this.prefillData.prefillMunicipalityPerfectMatchFound = true;
|
|
1422
1445
|
this.prefillData.prefillMunicipalityPerfectMatchSuggestion = suggestion;
|
|
1423
1446
|
this.searchText = sugAddress.postalCode + ' ' + sugAddress.localityName;
|
|
1424
|
-
|
|
1425
|
-
|
|
1447
|
+
this.prefillData.prefillMunicipalityAndLocalityPerfectMatchFound = (suggestionLocality === this.prefillData.prefillMunicipalityName
|
|
1448
|
+
&& suggestionMunicipality === this.prefillData.prefillMunicipalityName) ? true : false;
|
|
1449
|
+
if (this.prefillData.prefillMunicipalityAndLocalityPerfectMatchFound === true) {
|
|
1450
|
+
if (this.showDebugMessageToConsole) {
|
|
1451
|
+
console.log('LOCALITY - PREFILL - Perfect match - Municipality & location:', suggestion);
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
else {
|
|
1455
|
+
if (this.showDebugMessageToConsole) {
|
|
1456
|
+
console.log('LOCALITY - PREFILL - Perfect match:', suggestion);
|
|
1457
|
+
}
|
|
1426
1458
|
}
|
|
1427
1459
|
}
|
|
1428
1460
|
}
|
|
@@ -4240,6 +4272,8 @@
|
|
|
4240
4272
|
this.prefillMunicipalityName = null;
|
|
4241
4273
|
this.prefillMunicipalityPerfectMatchFound = false;
|
|
4242
4274
|
this.prefillMunicipalityPerfectMatchSuggestion = null;
|
|
4275
|
+
// This is a working field, do not document
|
|
4276
|
+
this.prefillMunicipalityAndLocalityPerfectMatchFound = false;
|
|
4243
4277
|
this.prefillStreetName = null;
|
|
4244
4278
|
this.prefillStreetPerfectMatchFound = false;
|
|
4245
4279
|
this.prefillStreetPerfectMatchSuggestion = null;
|
|
@@ -4256,32 +4290,34 @@
|
|
|
4256
4290
|
}());
|
|
4257
4291
|
|
|
4258
4292
|
var LibAddressAutocompleteByComponentComponent = /** @class */ (function () {
|
|
4259
|
-
function LibAddressAutocompleteByComponentComponent() {
|
|
4293
|
+
function LibAddressAutocompleteByComponentComponent(httpService) {
|
|
4294
|
+
this.httpService = httpService;
|
|
4260
4295
|
this.selectedLanguage = null;
|
|
4296
|
+
this.baseUrl = "https://api.mailops.bpost.cloud/roa-info/externalMailingAddressProofingRest/autocomplete/";
|
|
4261
4297
|
this.showDebugMessageToConsole = false;
|
|
4262
4298
|
this.notInListAllowed = true;
|
|
4263
4299
|
this.messageOption = 'Y';
|
|
4264
4300
|
// LOCALITY
|
|
4265
|
-
this.localityUrl = '
|
|
4301
|
+
this.localityUrl = this.baseUrl + 'locality';
|
|
4266
4302
|
this.maxSuggestionLocality = 5;
|
|
4267
4303
|
this.visibleSuggestionLocalityCount = 5;
|
|
4268
4304
|
// localityParams: PrefilledParameters;
|
|
4269
4305
|
this.localityPrefillData = null;
|
|
4270
4306
|
// STREET
|
|
4271
|
-
this.streetUrl = '
|
|
4307
|
+
this.streetUrl = this.baseUrl + 'street';
|
|
4272
4308
|
this.maxSuggestionStreet = 5;
|
|
4273
4309
|
this.visibleSuggestionStreetCount = 5;
|
|
4274
4310
|
// streetParams: PrefilledParameters;
|
|
4275
4311
|
this.streetPrefillData = null;
|
|
4276
4312
|
// STREET NUMBER
|
|
4277
4313
|
// tslint:disable-next-line:max-line-length
|
|
4278
|
-
this.streetNumberUrl = '
|
|
4314
|
+
this.streetNumberUrl = this.baseUrl + 'streetNumber';
|
|
4279
4315
|
this.maxSuggestionStreetNb = 5;
|
|
4280
4316
|
this.visibleSuggestionStreetNbCount = 5;
|
|
4281
4317
|
// streetNumberParams: PrefilledParameters;
|
|
4282
4318
|
this.streetNumberPrefillData = null;
|
|
4283
4319
|
// BOX NUMBER
|
|
4284
|
-
this.boxNumberUrl = '
|
|
4320
|
+
this.boxNumberUrl = this.baseUrl + 'boxNumber';
|
|
4285
4321
|
this.maxSuggestionBoxNb = 5;
|
|
4286
4322
|
this.visibleSuggestionBoxNbCount = 5;
|
|
4287
4323
|
// boxParams: PrefilledParameters;
|
|
@@ -4292,6 +4328,8 @@
|
|
|
4292
4328
|
this.validationMessageEventEmitter = new core.EventEmitter();
|
|
4293
4329
|
this.clearInputEventEmitter = new core.EventEmitter();
|
|
4294
4330
|
this.processingPrefillData = false;
|
|
4331
|
+
// Pass the API key as a property of the library !
|
|
4332
|
+
this.apiKey = 'cyRkKOD73O1DOdgcDLLnsaOiDh6OyOkt3BBT5JU1';
|
|
4295
4333
|
}
|
|
4296
4334
|
Object.defineProperty(LibAddressAutocompleteByComponentComponent.prototype, "inputLang", {
|
|
4297
4335
|
// @ts-ignore
|
|
@@ -4318,6 +4356,7 @@
|
|
|
4318
4356
|
configurable: true
|
|
4319
4357
|
});
|
|
4320
4358
|
LibAddressAutocompleteByComponentComponent.prototype.ngOnInit = function () {
|
|
4359
|
+
this.httpService.setApiKey(this.apiKey);
|
|
4321
4360
|
if (this.addressParams) {
|
|
4322
4361
|
this.prefillData = this.addressParams;
|
|
4323
4362
|
}
|
|
@@ -4334,6 +4373,9 @@
|
|
|
4334
4373
|
if (this.showDebugMessageToConsole) {
|
|
4335
4374
|
this.displayParametersChangesToConsole(changes);
|
|
4336
4375
|
}
|
|
4376
|
+
if (changes.hasOwnProperty('apiKey') && !changes.apiKey.firstChange) {
|
|
4377
|
+
this.httpService.setApiKey(this.apiKey);
|
|
4378
|
+
}
|
|
4337
4379
|
if (changes.hasOwnProperty('addressParams') && !changes.addressParams.firstChange) {
|
|
4338
4380
|
// if (changes.hasOwnProperty('addressParams')) {
|
|
4339
4381
|
this.processingPrefillData = true;
|
|
@@ -5194,6 +5236,9 @@
|
|
|
5194
5236
|
}
|
|
5195
5237
|
this.quitPrefillMode();
|
|
5196
5238
|
};
|
|
5239
|
+
LibAddressAutocompleteByComponentComponent.ctorParameters = function () { return [
|
|
5240
|
+
{ type: HttpService }
|
|
5241
|
+
]; };
|
|
5197
5242
|
__decorate([
|
|
5198
5243
|
core.ViewChild(LocalityComponent, { static: false })
|
|
5199
5244
|
], LibAddressAutocompleteByComponentComponent.prototype, "autocompleteLocality", void 0);
|
|
@@ -5290,6 +5335,9 @@
|
|
|
5290
5335
|
__decorate([
|
|
5291
5336
|
core.Output()
|
|
5292
5337
|
], LibAddressAutocompleteByComponentComponent.prototype, "clearInputEventEmitter", void 0);
|
|
5338
|
+
__decorate([
|
|
5339
|
+
core.Input()
|
|
5340
|
+
], LibAddressAutocompleteByComponentComponent.prototype, "apiKey", void 0);
|
|
5293
5341
|
LibAddressAutocompleteByComponentComponent = __decorate([
|
|
5294
5342
|
core.Component({
|
|
5295
5343
|
selector: 'bp-lib-address-autocomplete-by-component',
|