@esolve/ng-esolve-connect 0.21.1 → 0.22.1
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.service.mjs +2 -2
- package/esm2020/lib/category-tree/esolve-category-tree.service.mjs +2 -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/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 +11 -2
- package/esm2020/lib/stock/esolve-stock.service.mjs +6 -6
- 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-group-item-record.interface.mjs +1 -1
- package/esm2020/lib/tags/esolve-tags.service.mjs +4 -2
- package/esm2020/lib/topics/esolve-topic.service.mjs +4 -2
- package/esm2020/lib/wishlist/classes/esolve-empty-wishlist-result.model.mjs +4 -0
- package/esm2020/lib/wishlist/classes/esolve-wishlist-item.model.mjs +14 -0
- package/esm2020/lib/wishlist/classes/index.mjs +3 -0
- package/esm2020/lib/wishlist/esolve-wishlist.service.mjs +113 -0
- package/esm2020/lib/wishlist/index.mjs +6 -0
- package/esm2020/lib/wishlist/interfaces/esolve-wishlist-item-record.interface.mjs +2 -0
- package/esm2020/lib/wishlist/interfaces/esolve-wishlist-item-response.interface.mjs +2 -0
- package/esm2020/lib/wishlist/interfaces/esolve-wishlist-set-item.interface.mjs +2 -0
- package/esm2020/lib/wishlist/interfaces/index.mjs +4 -0
- package/esm2020/lib/wishlist/types/esolve-wishlist-set-action.type.mjs +2 -0
- package/esm2020/lib/wishlist/types/esolve-wishlist.type.mjs +2 -0
- package/esm2020/lib/wishlist/types/index.mjs +3 -0
- package/esm2020/public-api.mjs +3 -1
- package/fesm2015/esolve-ng-esolve-connect.mjs +191 -44
- package/fesm2015/esolve-ng-esolve-connect.mjs.map +1 -1
- package/fesm2020/esolve-ng-esolve-connect.mjs +189 -44
- package/fesm2020/esolve-ng-esolve-connect.mjs.map +1 -1
- package/lib/locations/esolve-locations.service.d.ts +2 -1
- package/lib/shared/errors/esolve-http-error.model.d.ts +3 -3
- package/lib/stock/classes/esolve-stock-price.model.d.ts +13 -1
- package/lib/stock/esolve-stock.service.d.ts +1 -2
- package/lib/wishlist/classes/esolve-empty-wishlist-result.model.d.ts +3 -0
- package/lib/wishlist/classes/esolve-wishlist-item.model.d.ts +13 -0
- package/lib/wishlist/classes/index.d.ts +2 -0
- package/lib/wishlist/esolve-wishlist.service.d.ts +51 -0
- package/lib/wishlist/index.d.ts +4 -0
- package/lib/wishlist/interfaces/esolve-wishlist-item-record.interface.d.ts +13 -0
- package/lib/wishlist/interfaces/esolve-wishlist-item-response.interface.d.ts +6 -0
- package/lib/wishlist/interfaces/esolve-wishlist-set-item.interface.d.ts +7 -0
- package/lib/wishlist/interfaces/index.d.ts +3 -0
- package/lib/wishlist/types/esolve-wishlist-set-action.type.d.ts +1 -0
- package/lib/wishlist/types/esolve-wishlist.type.d.ts +2 -0
- package/lib/wishlist/types/index.d.ts +2 -0
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
|
@@ -496,8 +496,8 @@ class EsolveResponseResult {
|
|
|
496
496
|
constructor(response) {
|
|
497
497
|
this.success_log = [];
|
|
498
498
|
this.error_log = [];
|
|
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'));
|
|
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'));
|
|
501
501
|
}
|
|
502
502
|
}
|
|
503
503
|
|
|
@@ -533,11 +533,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
533
533
|
}]
|
|
534
534
|
}], ctorParameters: function () { return []; } });
|
|
535
535
|
|
|
536
|
-
class EsolveHttpError {
|
|
537
|
-
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';
|
|
538
546
|
this.type = type;
|
|
539
|
-
this.
|
|
540
|
-
this.error_code = error_code;
|
|
547
|
+
this.error_code = code;
|
|
541
548
|
}
|
|
542
549
|
}
|
|
543
550
|
|
|
@@ -547,7 +554,7 @@ class EsolveErrorHandlerService {
|
|
|
547
554
|
throw new EsolveHttpError('error', message, code);
|
|
548
555
|
}
|
|
549
556
|
emitError(code, message) {
|
|
550
|
-
return throwError(new EsolveHttpError('error', message, code));
|
|
557
|
+
return throwError(() => new EsolveHttpError('error', message, code));
|
|
551
558
|
}
|
|
552
559
|
handleHttpPostError(service_type, errorRes) {
|
|
553
560
|
if (!(errorRes instanceof HttpErrorResponse) &&
|
|
@@ -557,7 +564,7 @@ class EsolveErrorHandlerService {
|
|
|
557
564
|
('transaction_type' in errorRes) &&
|
|
558
565
|
('status' in errorRes) &&
|
|
559
566
|
('log' in errorRes))) {
|
|
560
|
-
return throwError(this.parsePostErrors(errorRes));
|
|
567
|
+
return throwError(() => this.parsePostErrors(errorRes));
|
|
561
568
|
}
|
|
562
569
|
return this.handleHttpError(service_type, errorRes);
|
|
563
570
|
}
|
|
@@ -569,32 +576,32 @@ class EsolveErrorHandlerService {
|
|
|
569
576
|
('message' in errorRes) &&
|
|
570
577
|
('code' in errorRes)));
|
|
571
578
|
if (is_not_base) {
|
|
572
|
-
return throwError(this.parseDeleteError(errorRes));
|
|
579
|
+
return throwError(() => this.parseDeleteError(errorRes));
|
|
573
580
|
}
|
|
574
581
|
return this.handleHttpError(service_type, errorRes);
|
|
575
582
|
}
|
|
576
|
-
handleHttpError(service_type,
|
|
577
|
-
if (
|
|
578
|
-
if (
|
|
579
|
-
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;
|
|
580
587
|
if (('service_type' in server_error) &&
|
|
581
588
|
(server_error.service_type === service_type)) {
|
|
582
|
-
return throwError(this.parseException(server_error));
|
|
589
|
+
return throwError(() => this.parseException(server_error));
|
|
583
590
|
}
|
|
584
591
|
}
|
|
585
592
|
}
|
|
586
593
|
else {
|
|
587
|
-
if (('service_type' in
|
|
588
|
-
(
|
|
589
|
-
if (
|
|
590
|
-
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));
|
|
591
598
|
}
|
|
592
|
-
else if (
|
|
593
|
-
return throwError(this.parseResponseError(
|
|
599
|
+
else if (error_response.type === 'error') {
|
|
600
|
+
return throwError(() => this.parseResponseError(error_response));
|
|
594
601
|
}
|
|
595
602
|
}
|
|
596
603
|
}
|
|
597
|
-
return throwError(
|
|
604
|
+
return throwError(() => error_response);
|
|
598
605
|
}
|
|
599
606
|
parseException(exception) {
|
|
600
607
|
const error = new EsolveHttpError('exception', exception.message || 'Unknown exception has occurred', exception.additional_data.exception_type || 'unknown');
|
|
@@ -605,17 +612,18 @@ class EsolveErrorHandlerService {
|
|
|
605
612
|
return error;
|
|
606
613
|
}
|
|
607
614
|
parsePostErrors(response) {
|
|
608
|
-
|
|
615
|
+
let error_code = 'unknown';
|
|
616
|
+
let message = 'Unknown error has occurred';
|
|
609
617
|
if ((response.status.state === 'none') && (response.log.length > 0)) {
|
|
610
|
-
|
|
611
|
-
|
|
618
|
+
error_code = 'no_response';
|
|
619
|
+
message = 'Response was provided';
|
|
612
620
|
}
|
|
613
621
|
else if (response.status.state === 'error') {
|
|
614
622
|
const login_error_log = response.log[0];
|
|
615
|
-
|
|
616
|
-
|
|
623
|
+
error_code = login_error_log.message_code;
|
|
624
|
+
message = login_error_log.message;
|
|
617
625
|
}
|
|
618
|
-
return error;
|
|
626
|
+
return new EsolveHttpError('error', error_code, message);
|
|
619
627
|
}
|
|
620
628
|
parseDeleteError(result) {
|
|
621
629
|
return new EsolveHttpError('error', result.message, result.code);
|
|
@@ -983,7 +991,7 @@ class EsolveCategoryTreeService {
|
|
|
983
991
|
return this.processTreeItem(response.records[0]);
|
|
984
992
|
}));
|
|
985
993
|
}
|
|
986
|
-
return throwError('Invalid options');
|
|
994
|
+
return throwError(() => 'Invalid options');
|
|
987
995
|
}
|
|
988
996
|
/**
|
|
989
997
|
* Processes the eSolve tree records and converts them into the correct format.
|
|
@@ -1336,7 +1344,9 @@ class EsolveTagsService {
|
|
|
1336
1344
|
*/
|
|
1337
1345
|
getTags(options) {
|
|
1338
1346
|
const params = this.parseOptions(options);
|
|
1339
|
-
return this.http
|
|
1347
|
+
return this.http
|
|
1348
|
+
.get(`${this.config.api_url}/get-tags.php`, { params })
|
|
1349
|
+
.pipe(map((response) => {
|
|
1340
1350
|
if (response.records === undefined) {
|
|
1341
1351
|
throw response;
|
|
1342
1352
|
}
|
|
@@ -1425,7 +1435,9 @@ class EsolveTopicService {
|
|
|
1425
1435
|
if (topic_id_list.length > 0) {
|
|
1426
1436
|
params = params.append('topic_id', topic_id_list.join(','));
|
|
1427
1437
|
}
|
|
1428
|
-
return this.http
|
|
1438
|
+
return this.http
|
|
1439
|
+
.get(`${this.config.api_url}/get-topics.php`, { params })
|
|
1440
|
+
.pipe(map((response) => {
|
|
1429
1441
|
if (response.records === undefined) {
|
|
1430
1442
|
throw response;
|
|
1431
1443
|
}
|
|
@@ -2052,9 +2064,10 @@ class EsolveLocationsService {
|
|
|
2052
2064
|
* Set the addresses_id to 0 and the gps coordinates in order to retrieve the locations list when the address isn't
|
|
2053
2065
|
* yet saved.
|
|
2054
2066
|
*
|
|
2055
|
-
* @param addresses_id if supplied, the
|
|
2067
|
+
* @param addresses_id if supplied, the latitude and longitude on the address will be used.
|
|
2056
2068
|
* @param latitude if supplied and address_id > 0, the value is ignored.
|
|
2057
2069
|
* @param longitude if supplied and address_id > 0, the value is ignored.
|
|
2070
|
+
*
|
|
2058
2071
|
* @returns An `Observable` with an array of stock locations
|
|
2059
2072
|
*/
|
|
2060
2073
|
getStockLocationsGeo(addresses_id = 0, latitude = 0, longitude = 0) {
|
|
@@ -2309,7 +2322,7 @@ class EsolveAccountService {
|
|
|
2309
2322
|
}));
|
|
2310
2323
|
}
|
|
2311
2324
|
catch (error) {
|
|
2312
|
-
return throwError(error);
|
|
2325
|
+
return throwError(() => error);
|
|
2313
2326
|
}
|
|
2314
2327
|
}
|
|
2315
2328
|
deleteAddress(id) {
|
|
@@ -2447,7 +2460,7 @@ class EsolveAccountService {
|
|
|
2447
2460
|
}));
|
|
2448
2461
|
}
|
|
2449
2462
|
catch (error) {
|
|
2450
|
-
return throwError(error);
|
|
2463
|
+
return throwError(() => error);
|
|
2451
2464
|
}
|
|
2452
2465
|
}
|
|
2453
2466
|
getTransaction(id) {
|
|
@@ -2470,7 +2483,7 @@ class EsolveAccountService {
|
|
|
2470
2483
|
}));
|
|
2471
2484
|
}
|
|
2472
2485
|
catch (error) {
|
|
2473
|
-
return throwError(error);
|
|
2486
|
+
return throwError(() => error);
|
|
2474
2487
|
}
|
|
2475
2488
|
}
|
|
2476
2489
|
processUserAccount(record) {
|
|
@@ -2942,10 +2955,13 @@ class EsolveStockBadge {
|
|
|
2942
2955
|
class EsolveStockPrice {
|
|
2943
2956
|
/**
|
|
2944
2957
|
* Create stock price instance
|
|
2958
|
+
*
|
|
2945
2959
|
* @param base_price Price without tax
|
|
2946
2960
|
* @param base_price_with_tax Price with tax
|
|
2947
2961
|
* @param sell_price Price without tax and with discounts applied if applicable
|
|
2948
2962
|
* @param sell_price_with_tax Price with tax and with discounts applied if applicable
|
|
2963
|
+
* @param tax_rate Tax rate of the item
|
|
2964
|
+
* @param taxed Whether tax has been applied
|
|
2949
2965
|
*/
|
|
2950
2966
|
constructor(
|
|
2951
2967
|
/**
|
|
@@ -2963,11 +2979,16 @@ class EsolveStockPrice {
|
|
|
2963
2979
|
/**
|
|
2964
2980
|
* Price with tax and with discounts applied if applicable
|
|
2965
2981
|
*/
|
|
2966
|
-
sell_price_with_tax = 0
|
|
2982
|
+
sell_price_with_tax = 0,
|
|
2983
|
+
/**
|
|
2984
|
+
* Vat Rate for the item
|
|
2985
|
+
*/
|
|
2986
|
+
tax_rate = 0, taxed) {
|
|
2967
2987
|
this.base_price = base_price;
|
|
2968
2988
|
this.base_price_with_tax = base_price_with_tax;
|
|
2969
2989
|
this.sell_price = sell_price;
|
|
2970
2990
|
this.sell_price_with_tax = sell_price_with_tax;
|
|
2991
|
+
this.tax_rate = tax_rate;
|
|
2971
2992
|
if ((this.base_price === 0) && (this.sell_price > 0)) {
|
|
2972
2993
|
this.base_price = this.sell_price;
|
|
2973
2994
|
this.base_price_with_tax = this.sell_price_with_tax;
|
|
@@ -2976,6 +2997,7 @@ class EsolveStockPrice {
|
|
|
2976
2997
|
this.sell_price = this.base_price;
|
|
2977
2998
|
this.sell_price_with_tax = this.base_price_with_tax;
|
|
2978
2999
|
}
|
|
3000
|
+
this.taxed = taxed ?? this.base_price !== this.base_price_with_tax;
|
|
2979
3001
|
}
|
|
2980
3002
|
}
|
|
2981
3003
|
|
|
@@ -3193,7 +3215,7 @@ class EsolveStockItemBase {
|
|
|
3193
3215
|
seo_title = record.seo_page_title ?? '';
|
|
3194
3216
|
seo_keywords = record.seo_keywords ?? '';
|
|
3195
3217
|
}
|
|
3196
|
-
this.price = new EsolveStockPrice(base_price, base_price_with_tax, sell_price, sell_price_with_tax);
|
|
3218
|
+
this.price = new EsolveStockPrice(base_price, base_price_with_tax, sell_price, sell_price_with_tax, record.vat_rate, record.vat_item);
|
|
3197
3219
|
if (seo_title.trim() === '') {
|
|
3198
3220
|
seo_title = this.name;
|
|
3199
3221
|
}
|
|
@@ -3418,7 +3440,7 @@ class EsolveStockService {
|
|
|
3418
3440
|
code,
|
|
3419
3441
|
},
|
|
3420
3442
|
});
|
|
3421
|
-
return this.getStockRecords(params).pipe(map(response => {
|
|
3443
|
+
return this.getStockRecords(params).pipe(map((response) => {
|
|
3422
3444
|
if ((response.records === undefined) ||
|
|
3423
3445
|
(response.records.length <= 0)) {
|
|
3424
3446
|
throw response;
|
|
@@ -3438,7 +3460,7 @@ class EsolveStockService {
|
|
|
3438
3460
|
sef_name,
|
|
3439
3461
|
},
|
|
3440
3462
|
});
|
|
3441
|
-
return this.getStockRecords(params).pipe(map(response => {
|
|
3463
|
+
return this.getStockRecords(params).pipe(map((response) => {
|
|
3442
3464
|
if ((response.records === undefined) ||
|
|
3443
3465
|
(response.records.length <= 0)) {
|
|
3444
3466
|
throw response;
|
|
@@ -3506,13 +3528,13 @@ class EsolveStockService {
|
|
|
3506
3528
|
}
|
|
3507
3529
|
params = EsolveFilterFactory.convertToHttpParams(filters, params);
|
|
3508
3530
|
}
|
|
3509
|
-
return this.getStockRecords(params).pipe(map(response => {
|
|
3531
|
+
return this.getStockRecords(params).pipe(map((response) => {
|
|
3510
3532
|
if ((response.records === undefined) ||
|
|
3511
3533
|
(response.records.length <= 0)) {
|
|
3512
3534
|
throw response;
|
|
3513
3535
|
}
|
|
3514
3536
|
const stockItems = [];
|
|
3515
|
-
response.records.forEach(stockRecord => {
|
|
3537
|
+
response.records.forEach((stockRecord) => {
|
|
3516
3538
|
stockItems.push(this.processStockItem(stockRecord));
|
|
3517
3539
|
});
|
|
3518
3540
|
return new EsolveStockItemList(stockItems, +response.additional_data.total_records, options.page ?? 0);
|
|
@@ -4051,7 +4073,7 @@ class EsolveCartService {
|
|
|
4051
4073
|
responseType: 'json',
|
|
4052
4074
|
observe: 'body',
|
|
4053
4075
|
})
|
|
4054
|
-
.pipe(map(response => {
|
|
4076
|
+
.pipe(map((response) => {
|
|
4055
4077
|
if (response.responses === undefined) {
|
|
4056
4078
|
throw response;
|
|
4057
4079
|
}
|
|
@@ -4609,7 +4631,9 @@ class EsolveShippingService {
|
|
|
4609
4631
|
params = params.set('location_id', options.location_id);
|
|
4610
4632
|
}
|
|
4611
4633
|
}
|
|
4612
|
-
return this.http
|
|
4634
|
+
return this.http
|
|
4635
|
+
.get(`${this.config.api_url}/get-shipping-methods.php`, { params })
|
|
4636
|
+
.pipe(map((response) => {
|
|
4613
4637
|
if (response.records === undefined) {
|
|
4614
4638
|
throw response;
|
|
4615
4639
|
}
|
|
@@ -4653,7 +4677,7 @@ class EsolveShippingService {
|
|
|
4653
4677
|
}));
|
|
4654
4678
|
}
|
|
4655
4679
|
catch (err) {
|
|
4656
|
-
return throwError(err);
|
|
4680
|
+
return throwError(() => err);
|
|
4657
4681
|
}
|
|
4658
4682
|
}
|
|
4659
4683
|
/**
|
|
@@ -4738,6 +4762,127 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
4738
4762
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
4739
4763
|
}] }, { type: i1$2.HttpClient }, { type: EsolveErrorHandlerService }, { type: EsolveResponseHandlerService }]; } });
|
|
4740
4764
|
|
|
4765
|
+
class EsolveWishlistItem {
|
|
4766
|
+
constructor(id, qty, vat_rate, price, price_incl, vat_total, total, total_incl, stock_item) {
|
|
4767
|
+
this.id = id;
|
|
4768
|
+
this.qty = qty;
|
|
4769
|
+
this.vat_rate = vat_rate;
|
|
4770
|
+
this.price = price;
|
|
4771
|
+
this.price_incl = price_incl;
|
|
4772
|
+
this.vat_total = vat_total;
|
|
4773
|
+
this.total = total;
|
|
4774
|
+
this.total_incl = total_incl;
|
|
4775
|
+
this.stock_item = stock_item;
|
|
4776
|
+
}
|
|
4777
|
+
}
|
|
4778
|
+
|
|
4779
|
+
class EsolveEmptyWishlistResult extends EsolveResponseResult {
|
|
4780
|
+
}
|
|
4781
|
+
|
|
4782
|
+
class EsolveWishlistService {
|
|
4783
|
+
constructor(config, http, errorHandler, responseHandler) {
|
|
4784
|
+
this.config = config;
|
|
4785
|
+
this.http = http;
|
|
4786
|
+
this.errorHandler = errorHandler;
|
|
4787
|
+
this.responseHandler = responseHandler;
|
|
4788
|
+
}
|
|
4789
|
+
/**
|
|
4790
|
+
* Retrieves the current wishlist
|
|
4791
|
+
*
|
|
4792
|
+
* @returns An `Observable` with an array of cart items
|
|
4793
|
+
*/
|
|
4794
|
+
getWishlist() {
|
|
4795
|
+
return this.getWishlistRecords().pipe(map((response) => {
|
|
4796
|
+
if (response.records === undefined) {
|
|
4797
|
+
throw response;
|
|
4798
|
+
}
|
|
4799
|
+
return this.processWishlist(response.records);
|
|
4800
|
+
}));
|
|
4801
|
+
}
|
|
4802
|
+
/**
|
|
4803
|
+
* Updates the wishlist by preforming various actions, such as adding, editing or removing items from the list.
|
|
4804
|
+
*
|
|
4805
|
+
* @param items An array of options to update the wishlist
|
|
4806
|
+
* @param action The default action to preform
|
|
4807
|
+
* @returns An `Observable` with an array of responses that gives feedback on the requested changes
|
|
4808
|
+
*/
|
|
4809
|
+
setWishlist(items, default_action = 'add') {
|
|
4810
|
+
const body = {
|
|
4811
|
+
items,
|
|
4812
|
+
default_action,
|
|
4813
|
+
};
|
|
4814
|
+
return this.http
|
|
4815
|
+
.post(`${this.config.api_url}/set-wishlist-item.php`, body, {
|
|
4816
|
+
headers: {
|
|
4817
|
+
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;',
|
|
4818
|
+
},
|
|
4819
|
+
responseType: 'json',
|
|
4820
|
+
observe: 'body',
|
|
4821
|
+
})
|
|
4822
|
+
.pipe(map((response) => {
|
|
4823
|
+
if (response.responses === undefined) {
|
|
4824
|
+
throw response;
|
|
4825
|
+
}
|
|
4826
|
+
return response.responses;
|
|
4827
|
+
}));
|
|
4828
|
+
}
|
|
4829
|
+
/**
|
|
4830
|
+
* Empties the wishlist for the logged in user.
|
|
4831
|
+
*
|
|
4832
|
+
* @returns Observable of type EsolveEmptyWishlistResult
|
|
4833
|
+
*/
|
|
4834
|
+
setWishlistEmpty() {
|
|
4835
|
+
return this.http
|
|
4836
|
+
.post(`${this.config.api_url}/set-wishlist-empty.php`, {
|
|
4837
|
+
headers: {
|
|
4838
|
+
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;',
|
|
4839
|
+
},
|
|
4840
|
+
responseType: 'json',
|
|
4841
|
+
observe: 'body',
|
|
4842
|
+
})
|
|
4843
|
+
.pipe(map((http_response) => this.responseHandler.validateSingleHttpResponse(http_response, (response) => {
|
|
4844
|
+
return new EsolveEmptyWishlistResult(response);
|
|
4845
|
+
})), catchError((errorRes) => {
|
|
4846
|
+
return this.errorHandler.handleHttpPostError('set-wishlist-empty', errorRes);
|
|
4847
|
+
}));
|
|
4848
|
+
}
|
|
4849
|
+
/**
|
|
4850
|
+
* Processes the eSolve wishlist records
|
|
4851
|
+
*
|
|
4852
|
+
* @param wishlist_item_records Records to process
|
|
4853
|
+
* @returns An array of processed cart items
|
|
4854
|
+
*/
|
|
4855
|
+
processWishlist(wishlist_item_records) {
|
|
4856
|
+
const wishlist_items = [];
|
|
4857
|
+
if (wishlist_item_records) {
|
|
4858
|
+
for (const item of wishlist_item_records) {
|
|
4859
|
+
const stock_item = new EsolveStockItem(item.stock_item);
|
|
4860
|
+
const wishlist_item = new EsolveWishlistItem(+item.id, +item.qty, +item.vat_rate, +item.price, +item.price_incl, +item.vat_total, +item.line_total, +item.line_total_incl, stock_item);
|
|
4861
|
+
wishlist_items.push(wishlist_item);
|
|
4862
|
+
}
|
|
4863
|
+
}
|
|
4864
|
+
return wishlist_items;
|
|
4865
|
+
}
|
|
4866
|
+
/**
|
|
4867
|
+
* Retrieves stock records from HTTP params.
|
|
4868
|
+
* @param params HTTP client parameters
|
|
4869
|
+
*/
|
|
4870
|
+
getWishlistRecords(params) {
|
|
4871
|
+
return this.http.get(`${this.config.api_url}/get-wishlist.php`, { params });
|
|
4872
|
+
}
|
|
4873
|
+
}
|
|
4874
|
+
EsolveWishlistService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: EsolveWishlistService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }, { token: EsolveErrorHandlerService }, { token: EsolveResponseHandlerService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4875
|
+
EsolveWishlistService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: EsolveWishlistService, providedIn: 'root' });
|
|
4876
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: EsolveWishlistService, decorators: [{
|
|
4877
|
+
type: Injectable,
|
|
4878
|
+
args: [{
|
|
4879
|
+
providedIn: 'root',
|
|
4880
|
+
}]
|
|
4881
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
4882
|
+
type: Inject,
|
|
4883
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
4884
|
+
}] }, { type: i1$2.HttpClient }, { type: EsolveErrorHandlerService }, { type: EsolveResponseHandlerService }]; } });
|
|
4885
|
+
|
|
4741
4886
|
/*
|
|
4742
4887
|
* Public API Surface of ng-esolve-connect
|
|
4743
4888
|
*/
|
|
@@ -4746,5 +4891,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
4746
4891
|
* Generated bundle index. Do not edit.
|
|
4747
4892
|
*/
|
|
4748
4893
|
|
|
4749
|
-
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 };
|
|
4894
|
+
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, EsolveEmptyWishlistResult, 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, EsolveWishlistItem, EsolveWishlistService, NgEsolveConnectModule };
|
|
4750
4895
|
//# sourceMappingURL=esolve-ng-esolve-connect.mjs.map
|