@esolve/ng-esolve-connect 0.20.9 → 0.21.2
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/esm2020/lib/account/esolve-account.service.mjs +4 -4
- package/esm2020/lib/cart/esolve-cart-additional-where.interface.mjs +1 -1
- package/esm2020/lib/cart/esolve-cart-empty-response.interface.mjs +1 -1
- package/esm2020/lib/cart/esolve-cart.service.mjs +2 -2
- package/esm2020/lib/cart/esolve-empty-cart-result.model.mjs +1 -1
- package/esm2020/lib/cart/index.mjs +3 -1
- package/esm2020/lib/category-tree/esolve-category-tree.service.mjs +22 -2
- package/esm2020/lib/locations/esolve-location-record.interface.mjs +1 -1
- package/esm2020/lib/locations/esolve-locations.service.mjs +3 -2
- package/esm2020/lib/shared/errors/esolve-error-handler.service.mjs +23 -22
- package/esm2020/lib/shared/errors/esolve-http-error.model.mjs +12 -5
- package/esm2020/lib/shared/filters/classes/esolve-multiple-select-filter.model.mjs +30 -0
- package/esm2020/lib/shared/filters/classes/esolve-range-filter.model.mjs +45 -0
- package/esm2020/lib/shared/filters/classes/esolve-single-select-filter.model.mjs +33 -0
- package/esm2020/lib/shared/filters/classes/index.mjs +5 -0
- package/esm2020/lib/shared/filters/esolve-filter-factory.mjs +60 -0
- package/esm2020/lib/shared/filters/index.mjs +5 -0
- package/esm2020/lib/shared/filters/interfaces/esolve-filter-definitions.interface.mjs +2 -0
- package/esm2020/lib/shared/filters/interfaces/esolve-filter-record.interface.mjs +2 -0
- package/esm2020/lib/shared/filters/interfaces/esolve-filter.interface.mjs +2 -0
- package/esm2020/lib/shared/filters/interfaces/esolve-range-filter-record.interface.mjs +2 -0
- package/esm2020/lib/shared/filters/interfaces/esolve-select-filter-record.interface.mjs +2 -0
- package/esm2020/lib/shared/filters/interfaces/esolve-select-filter.interface.mjs +2 -0
- package/esm2020/lib/shared/filters/interfaces/index.mjs +8 -0
- package/esm2020/lib/shared/filters/types/esolve-filter-list.type.mjs +2 -0
- package/esm2020/lib/shared/filters/types/esolve-filter-record-list.type.mjs +2 -0
- package/esm2020/lib/shared/filters/types/esolve-filter-type.type.mjs +2 -0
- package/esm2020/lib/shared/filters/types/esolve-range-filter-type.type.mjs +2 -0
- package/esm2020/lib/shared/filters/types/esolve-select-filter-type.type.mjs +2 -0
- package/esm2020/lib/shared/filters/types/index.mjs +7 -0
- package/esm2020/lib/shared/response/esolve-response-result.model.mjs +3 -3
- package/esm2020/lib/shipping/esolve-shipping.service.mjs +5 -3
- package/esm2020/lib/stock/classes/esolve-stock-item-base.model.mjs +2 -2
- package/esm2020/lib/stock/classes/esolve-stock-price.model.mjs +5 -2
- package/esm2020/lib/stock/esolve-stock.service.mjs +51 -12
- package/esm2020/lib/stock/interfaces/esolve-linked-stock-record.interface.mjs +1 -1
- package/esm2020/lib/stock/interfaces/esolve-recipe-item-record.interface.mjs +1 -1
- package/esm2020/lib/stock/interfaces/esolve-stock-filter-options.interface.mjs +2 -0
- package/esm2020/lib/stock/interfaces/esolve-stock-group-item-record.interface.mjs +1 -1
- package/esm2020/lib/stock/interfaces/esolve-stock-item-options.interface.mjs +1 -1
- package/esm2020/lib/stock/interfaces/index.mjs +2 -1
- package/esm2020/lib/tags/esolve-tags.service.mjs +4 -2
- package/esm2020/lib/topics/esolve-topic.service.mjs +4 -2
- package/esm2020/public-api.mjs +2 -1
- package/fesm2015/esolve-ng-esolve-connect.mjs +298 -51
- package/fesm2015/esolve-ng-esolve-connect.mjs.map +1 -1
- package/fesm2020/esolve-ng-esolve-connect.mjs +300 -51
- package/fesm2020/esolve-ng-esolve-connect.mjs.map +1 -1
- package/lib/cart/index.d.ts +2 -0
- package/lib/category-tree/esolve-category-tree.service.d.ts +9 -0
- package/lib/locations/esolve-locations.service.d.ts +2 -1
- package/lib/shared/errors/esolve-http-error.model.d.ts +3 -3
- package/lib/shared/filters/classes/esolve-multiple-select-filter.model.d.ts +14 -0
- package/lib/shared/filters/classes/esolve-range-filter.model.d.ts +18 -0
- package/lib/shared/filters/classes/esolve-single-select-filter.model.d.ts +15 -0
- package/lib/shared/filters/classes/index.d.ts +3 -0
- package/lib/shared/filters/esolve-filter-factory.d.ts +13 -0
- package/lib/shared/filters/index.d.ts +4 -0
- package/lib/shared/filters/interfaces/esolve-filter-definitions.interface.d.ts +6 -0
- package/lib/shared/filters/interfaces/esolve-filter-record.interface.d.ts +5 -0
- package/lib/shared/filters/interfaces/esolve-filter.interface.d.ts +10 -0
- package/lib/shared/filters/interfaces/esolve-range-filter-record.interface.d.ts +7 -0
- package/lib/shared/filters/interfaces/esolve-select-filter-record.interface.d.ts +6 -0
- package/lib/shared/filters/interfaces/esolve-select-filter.interface.d.ts +4 -0
- package/lib/shared/filters/interfaces/index.d.ts +6 -0
- package/lib/shared/filters/types/esolve-filter-list.type.d.ts +2 -0
- package/lib/shared/filters/types/esolve-filter-record-list.type.d.ts +2 -0
- package/lib/shared/filters/types/esolve-filter-type.type.d.ts +3 -0
- package/lib/shared/filters/types/esolve-range-filter-type.type.d.ts +1 -0
- package/lib/shared/filters/types/esolve-select-filter-type.type.d.ts +1 -0
- package/lib/shared/filters/types/index.d.ts +5 -0
- package/lib/stock/classes/esolve-stock-price.model.d.ts +4 -1
- package/lib/stock/esolve-stock.service.d.ts +3 -1
- package/lib/stock/interfaces/esolve-stock-filter-options.interface.d.ts +7 -0
- package/lib/stock/interfaces/esolve-stock-item-options.interface.d.ts +5 -0
- package/lib/stock/interfaces/index.d.ts +1 -0
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
|
@@ -319,12 +319,185 @@ class EsolveResult {
|
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
321
|
|
|
322
|
+
class EsolveMultipleSelectFilter {
|
|
323
|
+
constructor(field, options) {
|
|
324
|
+
this.field = field;
|
|
325
|
+
this.type = 'multiple';
|
|
326
|
+
this.options = [];
|
|
327
|
+
if (options) {
|
|
328
|
+
this.options = options;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
setValue(values) {
|
|
332
|
+
this.values = values;
|
|
333
|
+
}
|
|
334
|
+
toHttpParams(http_params) {
|
|
335
|
+
if (!this.values) {
|
|
336
|
+
throw new Error('No values set');
|
|
337
|
+
}
|
|
338
|
+
const base_property = `filter[${this.field}]`;
|
|
339
|
+
const type_property = base_property + '[type]';
|
|
340
|
+
const values_property = base_property + '[values][]';
|
|
341
|
+
const params = {
|
|
342
|
+
[type_property]: this.type,
|
|
343
|
+
[values_property]: this.values,
|
|
344
|
+
};
|
|
345
|
+
if (http_params) {
|
|
346
|
+
return http_params.appendAll(params);
|
|
347
|
+
}
|
|
348
|
+
return params;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
class EsolveRangeFilter {
|
|
353
|
+
constructor(field, min = 0, max = 0) {
|
|
354
|
+
this.field = field;
|
|
355
|
+
this.type = 'range';
|
|
356
|
+
this.min = 0;
|
|
357
|
+
this.max = 0;
|
|
358
|
+
this.options = {
|
|
359
|
+
min: 0,
|
|
360
|
+
max: 0,
|
|
361
|
+
};
|
|
362
|
+
this.options.min = min;
|
|
363
|
+
this.options.max = max;
|
|
364
|
+
if ((max > 0) && (min > max)) {
|
|
365
|
+
this.options.min = max;
|
|
366
|
+
this.options.max = min;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
setValue(min, max) {
|
|
370
|
+
this.min = min;
|
|
371
|
+
this.max = max;
|
|
372
|
+
if ((max > 0) && (min > max)) {
|
|
373
|
+
this.min = max;
|
|
374
|
+
this.max = min;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
toHttpParams(http_params) {
|
|
378
|
+
if (this.min <= 0 && this.max <= 0) {
|
|
379
|
+
throw new Error('No values set');
|
|
380
|
+
}
|
|
381
|
+
const base_property = `filter[${this.field}]`;
|
|
382
|
+
const type_property = base_property + '[type]';
|
|
383
|
+
const min_property = base_property + '[min]';
|
|
384
|
+
const max_property = base_property + '[max]';
|
|
385
|
+
const params = {
|
|
386
|
+
[type_property]: this.type,
|
|
387
|
+
[min_property]: this.min,
|
|
388
|
+
[max_property]: this.max,
|
|
389
|
+
};
|
|
390
|
+
if (http_params) {
|
|
391
|
+
return http_params.appendAll(params);
|
|
392
|
+
}
|
|
393
|
+
return params;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
class EsolveSingleSelectFilter {
|
|
398
|
+
constructor(field, options_or_value) {
|
|
399
|
+
this.field = field;
|
|
400
|
+
this.type = 'single';
|
|
401
|
+
this.options = [];
|
|
402
|
+
if (Array.isArray(options_or_value)) {
|
|
403
|
+
this.options = options_or_value;
|
|
404
|
+
}
|
|
405
|
+
else {
|
|
406
|
+
this.setValue(options_or_value);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
setValue(value) {
|
|
410
|
+
this.value = value;
|
|
411
|
+
}
|
|
412
|
+
toHttpParams(http_params) {
|
|
413
|
+
if (!this.value) {
|
|
414
|
+
throw new Error('No values set');
|
|
415
|
+
}
|
|
416
|
+
const base_property = `filter[${this.field}]`;
|
|
417
|
+
const type_property = base_property + '[type]';
|
|
418
|
+
const values_property = base_property + '[value]';
|
|
419
|
+
const params = {
|
|
420
|
+
[type_property]: this.type,
|
|
421
|
+
[values_property]: this.value,
|
|
422
|
+
};
|
|
423
|
+
if (http_params) {
|
|
424
|
+
return http_params.appendAll(params);
|
|
425
|
+
}
|
|
426
|
+
return params;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
// Classes
|
|
431
|
+
|
|
432
|
+
// Interfaces
|
|
433
|
+
|
|
434
|
+
// Types
|
|
435
|
+
|
|
436
|
+
var EsolveFilterFactory;
|
|
437
|
+
(function (EsolveFilterFactory) {
|
|
438
|
+
function createRangeWithValue(field, min = 0, max = 0) {
|
|
439
|
+
const filter = new EsolveRangeFilter(field);
|
|
440
|
+
filter.setValue(min, max);
|
|
441
|
+
return filter;
|
|
442
|
+
}
|
|
443
|
+
EsolveFilterFactory.createRangeWithValue = createRangeWithValue;
|
|
444
|
+
function createSingleSelectWithValue(field, value) {
|
|
445
|
+
const filter = new EsolveSingleSelectFilter(field, value);
|
|
446
|
+
return filter;
|
|
447
|
+
}
|
|
448
|
+
EsolveFilterFactory.createSingleSelectWithValue = createSingleSelectWithValue;
|
|
449
|
+
function createMultipleSelectWithValue(field, value) {
|
|
450
|
+
const filter = new EsolveMultipleSelectFilter(field);
|
|
451
|
+
filter.setValue(value);
|
|
452
|
+
return filter;
|
|
453
|
+
}
|
|
454
|
+
EsolveFilterFactory.createMultipleSelectWithValue = createMultipleSelectWithValue;
|
|
455
|
+
function covertFromObj(obj) {
|
|
456
|
+
const filters = [];
|
|
457
|
+
for (const field in obj) {
|
|
458
|
+
const value = obj[field];
|
|
459
|
+
let filter = null;
|
|
460
|
+
if (Array.isArray(value)) {
|
|
461
|
+
filter = createMultipleSelectWithValue(field, value);
|
|
462
|
+
}
|
|
463
|
+
else if (typeof value === 'object') {
|
|
464
|
+
filter = createRangeWithValue(field, value.min, value.max);
|
|
465
|
+
}
|
|
466
|
+
else {
|
|
467
|
+
filter = createSingleSelectWithValue(field, value);
|
|
468
|
+
}
|
|
469
|
+
if (filter) {
|
|
470
|
+
filters.push(filter);
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
return filters;
|
|
474
|
+
}
|
|
475
|
+
EsolveFilterFactory.covertFromObj = covertFromObj;
|
|
476
|
+
function convertToHttpParams(filters, http_params) {
|
|
477
|
+
if (http_params) {
|
|
478
|
+
for (const filter of filters) {
|
|
479
|
+
http_params = filter.toHttpParams(http_params);
|
|
480
|
+
}
|
|
481
|
+
return http_params;
|
|
482
|
+
}
|
|
483
|
+
let params = {};
|
|
484
|
+
for (const filter of filters) {
|
|
485
|
+
params = {
|
|
486
|
+
...params,
|
|
487
|
+
...filter.toHttpParams(),
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
return params;
|
|
491
|
+
}
|
|
492
|
+
EsolveFilterFactory.convertToHttpParams = convertToHttpParams;
|
|
493
|
+
})(EsolveFilterFactory || (EsolveFilterFactory = {}));
|
|
494
|
+
|
|
322
495
|
class EsolveResponseResult {
|
|
323
496
|
constructor(response) {
|
|
324
497
|
this.success_log = [];
|
|
325
498
|
this.error_log = [];
|
|
326
|
-
this.error_log.push(...response.log.filter(log_item => log_item.type === 'error'));
|
|
327
|
-
this.success_log.push(...response.log.filter(log_item => log_item.type === 'success'));
|
|
499
|
+
this.error_log.push(...response.log.filter((log_item) => log_item.type === 'error'));
|
|
500
|
+
this.success_log.push(...response.log.filter((log_item) => log_item.type === 'success'));
|
|
328
501
|
}
|
|
329
502
|
}
|
|
330
503
|
|
|
@@ -360,11 +533,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
360
533
|
}]
|
|
361
534
|
}], ctorParameters: function () { return []; } });
|
|
362
535
|
|
|
363
|
-
class EsolveHttpError {
|
|
364
|
-
constructor(type, message,
|
|
536
|
+
class EsolveHttpError extends Error {
|
|
537
|
+
constructor(type, code, message, ...params) {
|
|
538
|
+
// Pass remaining arguments (including vendor specific ones) to parent constructor
|
|
539
|
+
super(...[message, ...params]);
|
|
540
|
+
this.http_error = true;
|
|
541
|
+
// Maintains proper stack trace for where our error was thrown (only available on V8)
|
|
542
|
+
if (Error.captureStackTrace) {
|
|
543
|
+
Error.captureStackTrace(this, EsolveHttpError);
|
|
544
|
+
}
|
|
545
|
+
this.name = 'EsolveHttpError';
|
|
365
546
|
this.type = type;
|
|
366
|
-
this.
|
|
367
|
-
this.error_code = error_code;
|
|
547
|
+
this.error_code = code;
|
|
368
548
|
}
|
|
369
549
|
}
|
|
370
550
|
|
|
@@ -374,7 +554,7 @@ class EsolveErrorHandlerService {
|
|
|
374
554
|
throw new EsolveHttpError('error', message, code);
|
|
375
555
|
}
|
|
376
556
|
emitError(code, message) {
|
|
377
|
-
return throwError(new EsolveHttpError('error', message, code));
|
|
557
|
+
return throwError(() => new EsolveHttpError('error', message, code));
|
|
378
558
|
}
|
|
379
559
|
handleHttpPostError(service_type, errorRes) {
|
|
380
560
|
if (!(errorRes instanceof HttpErrorResponse) &&
|
|
@@ -384,7 +564,7 @@ class EsolveErrorHandlerService {
|
|
|
384
564
|
('transaction_type' in errorRes) &&
|
|
385
565
|
('status' in errorRes) &&
|
|
386
566
|
('log' in errorRes))) {
|
|
387
|
-
return throwError(this.parsePostErrors(errorRes));
|
|
567
|
+
return throwError(() => this.parsePostErrors(errorRes));
|
|
388
568
|
}
|
|
389
569
|
return this.handleHttpError(service_type, errorRes);
|
|
390
570
|
}
|
|
@@ -396,32 +576,32 @@ class EsolveErrorHandlerService {
|
|
|
396
576
|
('message' in errorRes) &&
|
|
397
577
|
('code' in errorRes)));
|
|
398
578
|
if (is_not_base) {
|
|
399
|
-
return throwError(this.parseDeleteError(errorRes));
|
|
579
|
+
return throwError(() => this.parseDeleteError(errorRes));
|
|
400
580
|
}
|
|
401
581
|
return this.handleHttpError(service_type, errorRes);
|
|
402
582
|
}
|
|
403
|
-
handleHttpError(service_type,
|
|
404
|
-
if (
|
|
405
|
-
if (
|
|
406
|
-
const server_error =
|
|
583
|
+
handleHttpError(service_type, error_response) {
|
|
584
|
+
if (error_response instanceof HttpErrorResponse) {
|
|
585
|
+
if (error_response.status === 500) {
|
|
586
|
+
const server_error = error_response.error;
|
|
407
587
|
if (('service_type' in server_error) &&
|
|
408
588
|
(server_error.service_type === service_type)) {
|
|
409
|
-
return throwError(this.parseException(server_error));
|
|
589
|
+
return throwError(() => this.parseException(server_error));
|
|
410
590
|
}
|
|
411
591
|
}
|
|
412
592
|
}
|
|
413
593
|
else {
|
|
414
|
-
if (('service_type' in
|
|
415
|
-
(
|
|
416
|
-
if (
|
|
417
|
-
return throwError(this.parseException(
|
|
594
|
+
if (('service_type' in error_response) &&
|
|
595
|
+
(error_response.service_type === service_type)) {
|
|
596
|
+
if (error_response.type === 'exception') {
|
|
597
|
+
return throwError(() => this.parseException(error_response));
|
|
418
598
|
}
|
|
419
|
-
else if (
|
|
420
|
-
return throwError(this.parseResponseError(
|
|
599
|
+
else if (error_response.type === 'error') {
|
|
600
|
+
return throwError(() => this.parseResponseError(error_response));
|
|
421
601
|
}
|
|
422
602
|
}
|
|
423
603
|
}
|
|
424
|
-
return throwError(
|
|
604
|
+
return throwError(() => error_response);
|
|
425
605
|
}
|
|
426
606
|
parseException(exception) {
|
|
427
607
|
const error = new EsolveHttpError('exception', exception.message || 'Unknown exception has occurred', exception.additional_data.exception_type || 'unknown');
|
|
@@ -432,17 +612,18 @@ class EsolveErrorHandlerService {
|
|
|
432
612
|
return error;
|
|
433
613
|
}
|
|
434
614
|
parsePostErrors(response) {
|
|
435
|
-
|
|
615
|
+
let error_code = 'unknown';
|
|
616
|
+
let message = 'Unknown error has occurred';
|
|
436
617
|
if ((response.status.state === 'none') && (response.log.length > 0)) {
|
|
437
|
-
|
|
438
|
-
|
|
618
|
+
error_code = 'no_response';
|
|
619
|
+
message = 'Response was provided';
|
|
439
620
|
}
|
|
440
621
|
else if (response.status.state === 'error') {
|
|
441
622
|
const login_error_log = response.log[0];
|
|
442
|
-
|
|
443
|
-
|
|
623
|
+
error_code = login_error_log.message_code;
|
|
624
|
+
message = login_error_log.message;
|
|
444
625
|
}
|
|
445
|
-
return error;
|
|
626
|
+
return new EsolveHttpError('error', error_code, message);
|
|
446
627
|
}
|
|
447
628
|
parseDeleteError(result) {
|
|
448
629
|
return new EsolveHttpError('error', result.message, result.code);
|
|
@@ -745,6 +926,26 @@ class EsolveCategoryTreeService {
|
|
|
745
926
|
return this.processTree(response.records);
|
|
746
927
|
}));
|
|
747
928
|
}
|
|
929
|
+
/**
|
|
930
|
+
* Retrieve the special tree structure for a specific special from the eSolve
|
|
931
|
+
* instance and converts it into the correct format
|
|
932
|
+
*
|
|
933
|
+
* @param special_id Id of to special to get tree for
|
|
934
|
+
*
|
|
935
|
+
* @returns Observable containing special tree data
|
|
936
|
+
*/
|
|
937
|
+
getSpecialTree(special_id) {
|
|
938
|
+
let params = new HttpParams();
|
|
939
|
+
params = params.set('special_id', special_id);
|
|
940
|
+
return this.http
|
|
941
|
+
.get(`${this.config.api_url}/get-special-tree.php`, { params })
|
|
942
|
+
.pipe(map((response) => {
|
|
943
|
+
if (response.records === undefined) {
|
|
944
|
+
throw response;
|
|
945
|
+
}
|
|
946
|
+
return this.processTree(response.records);
|
|
947
|
+
}));
|
|
948
|
+
}
|
|
748
949
|
/**
|
|
749
950
|
* Retrieve the details of a category tree item from the eSolve instance and
|
|
750
951
|
* converts it to the correct format.
|
|
@@ -790,7 +991,7 @@ class EsolveCategoryTreeService {
|
|
|
790
991
|
return this.processTreeItem(response.records[0]);
|
|
791
992
|
}));
|
|
792
993
|
}
|
|
793
|
-
return throwError('Invalid options');
|
|
994
|
+
return throwError(() => 'Invalid options');
|
|
794
995
|
}
|
|
795
996
|
/**
|
|
796
997
|
* Processes the eSolve tree records and converts them into the correct format.
|
|
@@ -1143,7 +1344,9 @@ class EsolveTagsService {
|
|
|
1143
1344
|
*/
|
|
1144
1345
|
getTags(options) {
|
|
1145
1346
|
const params = this.parseOptions(options);
|
|
1146
|
-
return this.http
|
|
1347
|
+
return this.http
|
|
1348
|
+
.get(`${this.config.api_url}/get-tags.php`, { params })
|
|
1349
|
+
.pipe(map((response) => {
|
|
1147
1350
|
if (response.records === undefined) {
|
|
1148
1351
|
throw response;
|
|
1149
1352
|
}
|
|
@@ -1232,7 +1435,9 @@ class EsolveTopicService {
|
|
|
1232
1435
|
if (topic_id_list.length > 0) {
|
|
1233
1436
|
params = params.append('topic_id', topic_id_list.join(','));
|
|
1234
1437
|
}
|
|
1235
|
-
return this.http
|
|
1438
|
+
return this.http
|
|
1439
|
+
.get(`${this.config.api_url}/get-topics.php`, { params })
|
|
1440
|
+
.pipe(map((response) => {
|
|
1236
1441
|
if (response.records === undefined) {
|
|
1237
1442
|
throw response;
|
|
1238
1443
|
}
|
|
@@ -1859,9 +2064,10 @@ class EsolveLocationsService {
|
|
|
1859
2064
|
* Set the addresses_id to 0 and the gps coordinates in order to retrieve the locations list when the address isn't
|
|
1860
2065
|
* yet saved.
|
|
1861
2066
|
*
|
|
1862
|
-
* @param addresses_id if supplied, the
|
|
2067
|
+
* @param addresses_id if supplied, the latitude and longitude on the address will be used.
|
|
1863
2068
|
* @param latitude if supplied and address_id > 0, the value is ignored.
|
|
1864
2069
|
* @param longitude if supplied and address_id > 0, the value is ignored.
|
|
2070
|
+
*
|
|
1865
2071
|
* @returns An `Observable` with an array of stock locations
|
|
1866
2072
|
*/
|
|
1867
2073
|
getStockLocationsGeo(addresses_id = 0, latitude = 0, longitude = 0) {
|
|
@@ -2116,7 +2322,7 @@ class EsolveAccountService {
|
|
|
2116
2322
|
}));
|
|
2117
2323
|
}
|
|
2118
2324
|
catch (error) {
|
|
2119
|
-
return throwError(error);
|
|
2325
|
+
return throwError(() => error);
|
|
2120
2326
|
}
|
|
2121
2327
|
}
|
|
2122
2328
|
deleteAddress(id) {
|
|
@@ -2254,7 +2460,7 @@ class EsolveAccountService {
|
|
|
2254
2460
|
}));
|
|
2255
2461
|
}
|
|
2256
2462
|
catch (error) {
|
|
2257
|
-
return throwError(error);
|
|
2463
|
+
return throwError(() => error);
|
|
2258
2464
|
}
|
|
2259
2465
|
}
|
|
2260
2466
|
getTransaction(id) {
|
|
@@ -2277,7 +2483,7 @@ class EsolveAccountService {
|
|
|
2277
2483
|
}));
|
|
2278
2484
|
}
|
|
2279
2485
|
catch (error) {
|
|
2280
|
-
return throwError(error);
|
|
2486
|
+
return throwError(() => error);
|
|
2281
2487
|
}
|
|
2282
2488
|
}
|
|
2283
2489
|
processUserAccount(record) {
|
|
@@ -2749,10 +2955,12 @@ class EsolveStockBadge {
|
|
|
2749
2955
|
class EsolveStockPrice {
|
|
2750
2956
|
/**
|
|
2751
2957
|
* Create stock price instance
|
|
2958
|
+
*
|
|
2752
2959
|
* @param base_price Price without tax
|
|
2753
2960
|
* @param base_price_with_tax Price with tax
|
|
2754
2961
|
* @param sell_price Price without tax and with discounts applied if applicable
|
|
2755
2962
|
* @param sell_price_with_tax Price with tax and with discounts applied if applicable
|
|
2963
|
+
* @param taxed Whether tax has been applied
|
|
2756
2964
|
*/
|
|
2757
2965
|
constructor(
|
|
2758
2966
|
/**
|
|
@@ -2770,7 +2978,7 @@ class EsolveStockPrice {
|
|
|
2770
2978
|
/**
|
|
2771
2979
|
* Price with tax and with discounts applied if applicable
|
|
2772
2980
|
*/
|
|
2773
|
-
sell_price_with_tax = 0) {
|
|
2981
|
+
sell_price_with_tax = 0, taxed) {
|
|
2774
2982
|
this.base_price = base_price;
|
|
2775
2983
|
this.base_price_with_tax = base_price_with_tax;
|
|
2776
2984
|
this.sell_price = sell_price;
|
|
@@ -2783,6 +2991,7 @@ class EsolveStockPrice {
|
|
|
2783
2991
|
this.sell_price = this.base_price;
|
|
2784
2992
|
this.sell_price_with_tax = this.base_price_with_tax;
|
|
2785
2993
|
}
|
|
2994
|
+
this.taxed = taxed ?? this.base_price !== this.base_price_with_tax;
|
|
2786
2995
|
}
|
|
2787
2996
|
}
|
|
2788
2997
|
|
|
@@ -3000,7 +3209,7 @@ class EsolveStockItemBase {
|
|
|
3000
3209
|
seo_title = record.seo_page_title ?? '';
|
|
3001
3210
|
seo_keywords = record.seo_keywords ?? '';
|
|
3002
3211
|
}
|
|
3003
|
-
this.price = new EsolveStockPrice(base_price, base_price_with_tax, sell_price, sell_price_with_tax);
|
|
3212
|
+
this.price = new EsolveStockPrice(base_price, base_price_with_tax, sell_price, sell_price_with_tax, record.vat_item);
|
|
3004
3213
|
if (seo_title.trim() === '') {
|
|
3005
3214
|
seo_title = this.name;
|
|
3006
3215
|
}
|
|
@@ -3225,7 +3434,7 @@ class EsolveStockService {
|
|
|
3225
3434
|
code,
|
|
3226
3435
|
},
|
|
3227
3436
|
});
|
|
3228
|
-
return this.getStockRecords(params).pipe(map(response => {
|
|
3437
|
+
return this.getStockRecords(params).pipe(map((response) => {
|
|
3229
3438
|
if ((response.records === undefined) ||
|
|
3230
3439
|
(response.records.length <= 0)) {
|
|
3231
3440
|
throw response;
|
|
@@ -3245,7 +3454,7 @@ class EsolveStockService {
|
|
|
3245
3454
|
sef_name,
|
|
3246
3455
|
},
|
|
3247
3456
|
});
|
|
3248
|
-
return this.getStockRecords(params).pipe(map(response => {
|
|
3457
|
+
return this.getStockRecords(params).pipe(map((response) => {
|
|
3249
3458
|
if ((response.records === undefined) ||
|
|
3250
3459
|
(response.records.length <= 0)) {
|
|
3251
3460
|
throw response;
|
|
@@ -3300,23 +3509,26 @@ class EsolveStockService {
|
|
|
3300
3509
|
if (options.specials_id) {
|
|
3301
3510
|
params = params.set('specials_id', options.specials_id);
|
|
3302
3511
|
}
|
|
3303
|
-
if (options.tag_id_list) {
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3512
|
+
if (options.tag_id_list && options.tag_id_list.length > 0) {
|
|
3513
|
+
params = params.set('tag_id', options.tag_id_list.join(','));
|
|
3514
|
+
}
|
|
3515
|
+
if (options.topic_id_list && options.topic_id_list.length > 0) {
|
|
3516
|
+
params = params.set('topic_id', options.topic_id_list.join(','));
|
|
3307
3517
|
}
|
|
3308
|
-
if (options.
|
|
3309
|
-
|
|
3310
|
-
|
|
3518
|
+
if (options.filters) {
|
|
3519
|
+
let filters = options.filters;
|
|
3520
|
+
if (!Array.isArray(filters)) {
|
|
3521
|
+
filters = EsolveFilterFactory.covertFromObj(filters);
|
|
3311
3522
|
}
|
|
3523
|
+
params = EsolveFilterFactory.convertToHttpParams(filters, params);
|
|
3312
3524
|
}
|
|
3313
|
-
return this.getStockRecords(params).pipe(map(response => {
|
|
3525
|
+
return this.getStockRecords(params).pipe(map((response) => {
|
|
3314
3526
|
if ((response.records === undefined) ||
|
|
3315
3527
|
(response.records.length <= 0)) {
|
|
3316
3528
|
throw response;
|
|
3317
3529
|
}
|
|
3318
3530
|
const stockItems = [];
|
|
3319
|
-
response.records.forEach(stockRecord => {
|
|
3531
|
+
response.records.forEach((stockRecord) => {
|
|
3320
3532
|
stockItems.push(this.processStockItem(stockRecord));
|
|
3321
3533
|
});
|
|
3322
3534
|
return new EsolveStockItemList(stockItems, +response.additional_data.total_records, options.page ?? 0);
|
|
@@ -3430,6 +3642,41 @@ class EsolveStockService {
|
|
|
3430
3642
|
return collection;
|
|
3431
3643
|
}));
|
|
3432
3644
|
}
|
|
3645
|
+
getStockFilters(options) {
|
|
3646
|
+
let params = new HttpParams({
|
|
3647
|
+
fromObject: {
|
|
3648
|
+
category_id: options.category_id ?? '',
|
|
3649
|
+
subcategory_id: options.subcategory_id ?? 0,
|
|
3650
|
+
ranges_id: options.ranges_id ?? 0,
|
|
3651
|
+
manufacturers_id: options.manufacturers_id ?? 0,
|
|
3652
|
+
fields: options.fields.join(','),
|
|
3653
|
+
},
|
|
3654
|
+
});
|
|
3655
|
+
return this.http
|
|
3656
|
+
.get(`${this.config.api_url}/get-item-filters.php`, { params })
|
|
3657
|
+
.pipe(map((response) => {
|
|
3658
|
+
if (response.records === undefined) {
|
|
3659
|
+
throw response;
|
|
3660
|
+
}
|
|
3661
|
+
const filters = [];
|
|
3662
|
+
for (const record of response.records) {
|
|
3663
|
+
let filter = null;
|
|
3664
|
+
if (record.type === 'range') {
|
|
3665
|
+
filter = new EsolveRangeFilter(record.field, +record.min, +record.max);
|
|
3666
|
+
}
|
|
3667
|
+
else if (record.type === 'single') {
|
|
3668
|
+
filter = new EsolveSingleSelectFilter(record.field, record.values);
|
|
3669
|
+
}
|
|
3670
|
+
else if (record.type === 'multiple') {
|
|
3671
|
+
filter = new EsolveMultipleSelectFilter(record.field, record.values);
|
|
3672
|
+
}
|
|
3673
|
+
if (filter) {
|
|
3674
|
+
filters.push(filter);
|
|
3675
|
+
}
|
|
3676
|
+
}
|
|
3677
|
+
return filters;
|
|
3678
|
+
}));
|
|
3679
|
+
}
|
|
3433
3680
|
/**
|
|
3434
3681
|
* Processes the eSolve stock item record and converts it to an object.
|
|
3435
3682
|
*
|
|
@@ -3820,7 +4067,7 @@ class EsolveCartService {
|
|
|
3820
4067
|
responseType: 'json',
|
|
3821
4068
|
observe: 'body',
|
|
3822
4069
|
})
|
|
3823
|
-
.pipe(map(response => {
|
|
4070
|
+
.pipe(map((response) => {
|
|
3824
4071
|
if (response.responses === undefined) {
|
|
3825
4072
|
throw response;
|
|
3826
4073
|
}
|
|
@@ -4378,7 +4625,9 @@ class EsolveShippingService {
|
|
|
4378
4625
|
params = params.set('location_id', options.location_id);
|
|
4379
4626
|
}
|
|
4380
4627
|
}
|
|
4381
|
-
return this.http
|
|
4628
|
+
return this.http
|
|
4629
|
+
.get(`${this.config.api_url}/get-shipping-methods.php`, { params })
|
|
4630
|
+
.pipe(map((response) => {
|
|
4382
4631
|
if (response.records === undefined) {
|
|
4383
4632
|
throw response;
|
|
4384
4633
|
}
|
|
@@ -4422,7 +4671,7 @@ class EsolveShippingService {
|
|
|
4422
4671
|
}));
|
|
4423
4672
|
}
|
|
4424
4673
|
catch (err) {
|
|
4425
|
-
return throwError(err);
|
|
4674
|
+
return throwError(() => err);
|
|
4426
4675
|
}
|
|
4427
4676
|
}
|
|
4428
4677
|
/**
|
|
@@ -4515,5 +4764,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
4515
4764
|
* Generated bundle index. Do not edit.
|
|
4516
4765
|
*/
|
|
4517
4766
|
|
|
4518
|
-
export { ESOLVE_CONNECT_CONFIG, EsolveAccountService, EsolveAdditionalStockImage, EsolveAddress, EsolveAddressResult, EsolveAsset, EsolveAssetsService, EsolveAuthService, EsolveBankingDetails, EsolveBanner, EsolveBannerImage, EsolveBannerImageHotspot, EsolveBannerService, EsolveCartItem, EsolveCartService, EsolveCartStockItem, EsolveCartTotals, EsolveCategoryTreeItem, EsolveCategoryTreeService, EsolveChangePasswordResult, EsolveCheckoutResult, EsolveColour, EsolveCookieService, EsolveEnquiryResult, EsolveEnquiryService, EsolveErrorHandlerService, EsolveGeocodeAddressResult, EsolveGeocodeCoordsResult, EsolveGeocodeResult, EsolveGeocoderService, EsolveHttpError, EsolveLinkedAsset, EsolveLinkedStockItem, EsolveList, EsolveLocation, EsolveLocationAddress, EsolveLocationContactInfo, EsolveLocationPOBoxAddress, EsolveLocationTradingDay, EsolveLocationTradingTimes, EsolveLocationsService, EsolveManufacturer, EsolveManufacturersService, EsolveMediaStockItem, EsolveMenuItem, EsolveMenuService, EsolveNewsArticle, EsolveNewsArticleAuthor, EsolveNewsArticleList, EsolveNewsGroup, EsolveNewsService, EsolvePaymentMethod, EsolvePaymentResult, EsolvePaymentService, EsolveRange, EsolveRangesService, EsolveRecipeStockItem, EsolveRegistrationResult, EsolveResetPasswordResult, EsolveResponseHandlerService, EsolveResponseResult, EsolveResult, EsolveSeoInfo, EsolveSeoService, EsolveSession, EsolveSessionService, EsolveShippingCost, EsolveShippingMethod, EsolveShippingService, EsolveShippingTotals, EsolveSpecial, EsolveSpecialDates, EsolveSpecialImage, EsolveSpecialImageCollection, EsolveSpecialsService, EsolveStockBadge, EsolveStockGroup, EsolveStockGroupItem, EsolveStockImage, EsolveStockImageCollection, EsolveStockItem, EsolveStockItemBase, EsolveStockItemList, EsolveStockLeadTimes, EsolveStockPrice, EsolveStockService, EsolveTag, EsolveTagsService, EsolveTopic, EsolveTopicService, EsolveTransaction, EsolveTransactionAddress, EsolveTransactionClient, EsolveTransactionItem, EsolveTransactionItemPrice, EsolveTransactionList, EsolveTransactionLocation, EsolveTransactionPaymentMethod, EsolveTransactionShippingMethod, EsolveTransactionUser, EsolveUserAccount, EsolveUserAccountBusiness, EsolveUserAccountContact, EsolveUserAccountResult, EsolveVaultItem, EsolveVaultItemResult, NgEsolveConnectModule };
|
|
4767
|
+
export { ESOLVE_CONNECT_CONFIG, EsolveAccountService, EsolveAdditionalStockImage, EsolveAddress, EsolveAddressResult, EsolveAsset, EsolveAssetsService, EsolveAuthService, EsolveBankingDetails, EsolveBanner, EsolveBannerImage, EsolveBannerImageHotspot, EsolveBannerService, EsolveCartItem, EsolveCartService, EsolveCartStockItem, EsolveCartTotals, EsolveCategoryTreeItem, EsolveCategoryTreeService, EsolveChangePasswordResult, EsolveCheckoutResult, EsolveColour, EsolveCookieService, EsolveEmptyCartResult, EsolveEnquiryResult, EsolveEnquiryService, EsolveErrorHandlerService, EsolveFilterFactory, EsolveGeocodeAddressResult, EsolveGeocodeCoordsResult, EsolveGeocodeResult, EsolveGeocoderService, EsolveHttpError, EsolveLinkedAsset, EsolveLinkedStockItem, EsolveList, EsolveLocation, EsolveLocationAddress, EsolveLocationContactInfo, EsolveLocationPOBoxAddress, EsolveLocationTradingDay, EsolveLocationTradingTimes, EsolveLocationsService, EsolveManufacturer, EsolveManufacturersService, EsolveMediaStockItem, EsolveMenuItem, EsolveMenuService, EsolveMultipleSelectFilter, EsolveNewsArticle, EsolveNewsArticleAuthor, EsolveNewsArticleList, EsolveNewsGroup, EsolveNewsService, EsolvePaymentMethod, EsolvePaymentResult, EsolvePaymentService, EsolveRange, EsolveRangeFilter, EsolveRangesService, EsolveRecipeStockItem, EsolveRegistrationResult, EsolveResetPasswordResult, EsolveResponseHandlerService, EsolveResponseResult, EsolveResult, EsolveSeoInfo, EsolveSeoService, EsolveSession, EsolveSessionService, EsolveShippingCost, EsolveShippingMethod, EsolveShippingService, EsolveShippingTotals, EsolveSingleSelectFilter, EsolveSpecial, EsolveSpecialDates, EsolveSpecialImage, EsolveSpecialImageCollection, EsolveSpecialsService, EsolveStockBadge, EsolveStockGroup, EsolveStockGroupItem, EsolveStockImage, EsolveStockImageCollection, EsolveStockItem, EsolveStockItemBase, EsolveStockItemList, EsolveStockLeadTimes, EsolveStockPrice, EsolveStockService, EsolveTag, EsolveTagsService, EsolveTopic, EsolveTopicService, EsolveTransaction, EsolveTransactionAddress, EsolveTransactionClient, EsolveTransactionItem, EsolveTransactionItemPrice, EsolveTransactionList, EsolveTransactionLocation, EsolveTransactionPaymentMethod, EsolveTransactionShippingMethod, EsolveTransactionUser, EsolveUserAccount, EsolveUserAccountBusiness, EsolveUserAccountContact, EsolveUserAccountResult, EsolveVaultItem, EsolveVaultItemResult, NgEsolveConnectModule };
|
|
4519
4768
|
//# sourceMappingURL=esolve-ng-esolve-connect.mjs.map
|