@esolve/ng-esolve-connect 0.9.1 → 0.10.3
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 +105 -40
- package/esm2020/lib/account/esolve-transaction-list.mjs +4 -0
- package/esm2020/lib/account/esolve-transaction-options.mjs +2 -0
- package/esm2020/lib/account/esolve-transaction-record.mjs +2 -0
- package/esm2020/lib/account/esolve-transaction.mjs +145 -0
- package/esm2020/lib/auth/esolve-auth-interceptor.service.mjs +1 -1
- package/esm2020/lib/auth/esolve-auth.service.mjs +25 -25
- package/esm2020/lib/banners/esolve-banner.service.mjs +26 -26
- package/esm2020/lib/cart/esolve-cart.service.mjs +25 -25
- package/esm2020/lib/category-tree/esolve-category-tree.service.mjs +45 -45
- package/esm2020/lib/locations/esolve-locations.service.mjs +15 -15
- package/esm2020/lib/locations/esolve-stock-location-record.mjs +1 -1
- package/esm2020/lib/locations/esolve-stock-location.mjs +16 -16
- package/esm2020/lib/media/esolve-media.service.mjs +25 -25
- package/esm2020/lib/menu/esolve-menu.service.mjs +1 -1
- package/esm2020/lib/payment/esolve-payment-method-record.mjs +1 -1
- package/esm2020/lib/payment/esolve-payment-method.mjs +1 -5
- package/esm2020/lib/session/esolve-session.service.mjs +10 -7
- package/esm2020/lib/shared/error-handler/esolve-error-handler.service.mjs +5 -3
- package/esm2020/lib/shared/esolve-list.mjs +9 -0
- package/esm2020/lib/topics/esolve-topic.service.mjs +11 -11
- package/esm2020/public-api.mjs +6 -2
- package/fesm2015/esolve-ng-esolve-connect.mjs +544 -328
- package/fesm2015/esolve-ng-esolve-connect.mjs.map +1 -1
- package/fesm2020/esolve-ng-esolve-connect.mjs +546 -327
- package/fesm2020/esolve-ng-esolve-connect.mjs.map +1 -1
- package/lib/account/esolve-account.service.d.ts +11 -4
- package/lib/account/esolve-transaction-list.d.ts +4 -0
- package/lib/account/esolve-transaction-options.d.ts +8 -0
- package/lib/account/esolve-transaction-record.d.ts +98 -0
- package/lib/account/esolve-transaction.d.ts +132 -0
- package/lib/auth/esolve-auth.service.d.ts +1 -1
- package/lib/banners/esolve-banner.service.d.ts +6 -6
- package/lib/cart/esolve-cart.service.d.ts +12 -12
- package/lib/category-tree/esolve-category-tree.service.d.ts +7 -7
- package/lib/locations/esolve-locations.service.d.ts +5 -5
- package/lib/locations/esolve-stock-location-record.d.ts +1 -1
- package/lib/locations/esolve-stock-location.d.ts +7 -8
- package/lib/media/esolve-media.service.d.ts +7 -7
- package/lib/payment/esolve-payment-method-record.d.ts +0 -4
- package/lib/payment/esolve-payment-method.d.ts +0 -4
- package/lib/session/esolve-session.service.d.ts +3 -1
- package/lib/shared/error-handler/esolve-error-handler.service.d.ts +1 -0
- package/lib/shared/esolve-list.d.ts +7 -0
- package/lib/topics/esolve-topic.service.d.ts +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +5 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { InjectionToken, Injectable, Inject, NgModule } from '@angular/core';
|
|
3
3
|
import { CommonModule } from '@angular/common';
|
|
4
|
-
import * as i1$
|
|
4
|
+
import * as i1$2 from '@angular/common/http';
|
|
5
5
|
import { HttpParams, HTTP_INTERCEPTORS, HttpClientModule, HttpErrorResponse, HttpHeaders } from '@angular/common/http';
|
|
6
|
-
import * as
|
|
6
|
+
import * as i1 from 'ngx-cookie-service';
|
|
7
7
|
import { CookieService } from 'ngx-cookie-service';
|
|
8
8
|
import { BehaviorSubject, throwError, iif, of } from 'rxjs';
|
|
9
|
-
import * as i1 from '@angular/platform-browser';
|
|
10
|
-
import {
|
|
9
|
+
import * as i1$1 from '@angular/platform-browser';
|
|
10
|
+
import { tap, catchError, map, switchMap } from 'rxjs/operators';
|
|
11
11
|
|
|
12
12
|
const ESOLVE_CONNECT_CONFIG = new InjectionToken('esolve.connect.config');
|
|
13
13
|
// For future development
|
|
@@ -46,8 +46,9 @@ class EsolveSession {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
class EsolveSessionService {
|
|
49
|
-
constructor(config) {
|
|
49
|
+
constructor(config, cookieService) {
|
|
50
50
|
this.config = config;
|
|
51
|
+
this.cookieService = cookieService;
|
|
51
52
|
this.storage_key = 'ngEslvUserSession';
|
|
52
53
|
this.setStorageKey();
|
|
53
54
|
this._session = new BehaviorSubject(new EsolveSession(0, ''));
|
|
@@ -72,7 +73,7 @@ class EsolveSessionService {
|
|
|
72
73
|
}
|
|
73
74
|
restore(expirationCallback, invalidSessionCallback) {
|
|
74
75
|
if (!this.currentSession.valid) {
|
|
75
|
-
const stored_session_json =
|
|
76
|
+
const stored_session_json = this.cookieService.get(this.storage_key);
|
|
76
77
|
const stored_session = (stored_session_json ? JSON.parse(stored_session_json) : null);
|
|
77
78
|
if (!stored_session) {
|
|
78
79
|
invalidSessionCallback();
|
|
@@ -86,6 +87,7 @@ class EsolveSessionService {
|
|
|
86
87
|
this.startTimer(expirationCallback, expiration_duration);
|
|
87
88
|
}
|
|
88
89
|
else {
|
|
90
|
+
this.cookieService.delete(this.storage_key);
|
|
89
91
|
expirationCallback(loaded_session);
|
|
90
92
|
}
|
|
91
93
|
}
|
|
@@ -93,21 +95,21 @@ class EsolveSessionService {
|
|
|
93
95
|
handleSession(user_id, key, expiry_time, expires, expirationCallback) {
|
|
94
96
|
const expiration_date = new Date(expiry_time * 1000);
|
|
95
97
|
const session = new EsolveSession(user_id, key, expiration_date);
|
|
96
|
-
|
|
98
|
+
this.cookieService.set(this.storage_key, JSON.stringify(session), expiration_date);
|
|
97
99
|
this._session.next(session);
|
|
98
100
|
this.startTimer(expirationCallback, expires * 1000);
|
|
99
101
|
}
|
|
100
102
|
handleUpdateSession(user_id, callback) {
|
|
101
103
|
const current_session = this.currentSession;
|
|
102
104
|
current_session.updateUser(user_id);
|
|
103
|
-
|
|
105
|
+
this.cookieService.set(this.storage_key, JSON.stringify(current_session));
|
|
104
106
|
this._session.next(current_session);
|
|
105
107
|
if (typeof callback === 'function') {
|
|
106
108
|
callback();
|
|
107
109
|
}
|
|
108
110
|
}
|
|
109
111
|
}
|
|
110
|
-
EsolveSessionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveSessionService, deps: [{ token: ESOLVE_CONNECT_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
112
|
+
EsolveSessionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveSessionService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1.CookieService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
111
113
|
EsolveSessionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveSessionService, providedIn: 'root' });
|
|
112
114
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveSessionService, decorators: [{
|
|
113
115
|
type: Injectable,
|
|
@@ -118,7 +120,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
118
120
|
return [{ type: undefined, decorators: [{
|
|
119
121
|
type: Inject,
|
|
120
122
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
121
|
-
}] }];
|
|
123
|
+
}] }, { type: i1.CookieService }];
|
|
122
124
|
} });
|
|
123
125
|
|
|
124
126
|
class EsolveAuthInterceptorService {
|
|
@@ -199,6 +201,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
199
201
|
}]
|
|
200
202
|
}] });
|
|
201
203
|
|
|
204
|
+
class EsolveList {
|
|
205
|
+
constructor(items = [], page = 0, rows = 0, total = 0) {
|
|
206
|
+
this.items = items;
|
|
207
|
+
this.page = page;
|
|
208
|
+
this.rows = rows;
|
|
209
|
+
this.total = total;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
202
213
|
class EsolveResult {
|
|
203
214
|
constructor(status, code, message) {
|
|
204
215
|
this.status = status;
|
|
@@ -217,6 +228,9 @@ class EsolveHttpError {
|
|
|
217
228
|
|
|
218
229
|
class EsolveErrorHandlerService {
|
|
219
230
|
constructor() { }
|
|
231
|
+
emitError(code, message) {
|
|
232
|
+
throw new EsolveHttpError('error', message, code);
|
|
233
|
+
}
|
|
220
234
|
handleHttpPostError(service_type, errorRes) {
|
|
221
235
|
if (!(errorRes instanceof HttpErrorResponse) &&
|
|
222
236
|
!('service_type' in errorRes) &&
|
|
@@ -286,8 +300,7 @@ class EsolveErrorHandlerService {
|
|
|
286
300
|
return error;
|
|
287
301
|
}
|
|
288
302
|
parseDeleteError(result) {
|
|
289
|
-
|
|
290
|
-
return error;
|
|
303
|
+
return new EsolveHttpError('error', result.message, result.code);
|
|
291
304
|
}
|
|
292
305
|
}
|
|
293
306
|
EsolveErrorHandlerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveErrorHandlerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -446,7 +459,7 @@ class EsolveSeoService {
|
|
|
446
459
|
this.setPageKeywordsTags(seoInfo.keywords);
|
|
447
460
|
}
|
|
448
461
|
}
|
|
449
|
-
EsolveSeoService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveSeoService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1.Title }, { token: i1.Meta }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
462
|
+
EsolveSeoService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveSeoService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.Title }, { token: i1$1.Meta }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
450
463
|
EsolveSeoService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveSeoService, providedIn: 'root' });
|
|
451
464
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveSeoService, decorators: [{
|
|
452
465
|
type: Injectable,
|
|
@@ -457,7 +470,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
457
470
|
return [{ type: undefined, decorators: [{
|
|
458
471
|
type: Inject,
|
|
459
472
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
460
|
-
}] }, { type: i1.Title }, { type: i1.Meta }];
|
|
473
|
+
}] }, { type: i1$1.Title }, { type: i1$1.Meta }];
|
|
461
474
|
} });
|
|
462
475
|
|
|
463
476
|
class EsolveAuthService {
|
|
@@ -468,31 +481,6 @@ class EsolveAuthService {
|
|
|
468
481
|
this.errorHandler = errorHandler;
|
|
469
482
|
this.cookieService = cookieService;
|
|
470
483
|
}
|
|
471
|
-
checkAccessToken(session) {
|
|
472
|
-
var _a;
|
|
473
|
-
session = session || this.session.currentSession;
|
|
474
|
-
const token = (_a = session === null || session === void 0 ? void 0 : session.key) !== null && _a !== void 0 ? _a : '';
|
|
475
|
-
const params = new HttpParams({
|
|
476
|
-
fromObject: {
|
|
477
|
-
key: token,
|
|
478
|
-
ws_id: this.config.wsid
|
|
479
|
-
}
|
|
480
|
-
});
|
|
481
|
-
return this.http.get(`${this.config.api_url}/service/get-access-token.php`, {
|
|
482
|
-
params,
|
|
483
|
-
headers: new HttpHeaders({
|
|
484
|
-
'Accept-Language': '*'
|
|
485
|
-
})
|
|
486
|
-
}).pipe(map(responseData => {
|
|
487
|
-
if ((responseData.type === 'error') ||
|
|
488
|
-
(responseData.type === 'exception') ||
|
|
489
|
-
(!responseData.additional_data.key_okay)) {
|
|
490
|
-
throw responseData;
|
|
491
|
-
}
|
|
492
|
-
responseData.additional_data.key = token;
|
|
493
|
-
return responseData;
|
|
494
|
-
})).toPromise();
|
|
495
|
-
}
|
|
496
484
|
getAccessToken(email, password, anonymous = false) {
|
|
497
485
|
let params = new HttpParams();
|
|
498
486
|
if (anonymous) {
|
|
@@ -568,6 +556,31 @@ class EsolveAuthService {
|
|
|
568
556
|
this.cookieService.delete('_ws_id');
|
|
569
557
|
return this.getAccessToken('', '', true).toPromise();
|
|
570
558
|
}
|
|
559
|
+
checkAccessToken(session) {
|
|
560
|
+
var _a;
|
|
561
|
+
session = session || this.session.currentSession;
|
|
562
|
+
const token = (_a = session === null || session === void 0 ? void 0 : session.key) !== null && _a !== void 0 ? _a : '';
|
|
563
|
+
const params = new HttpParams({
|
|
564
|
+
fromObject: {
|
|
565
|
+
key: token,
|
|
566
|
+
ws_id: this.config.wsid
|
|
567
|
+
}
|
|
568
|
+
});
|
|
569
|
+
return this.http.get(`${this.config.api_url}/service/get-access-token.php`, {
|
|
570
|
+
params,
|
|
571
|
+
headers: new HttpHeaders({
|
|
572
|
+
'Accept-Language': '*'
|
|
573
|
+
})
|
|
574
|
+
}).pipe(map(responseData => {
|
|
575
|
+
if ((responseData.type === 'error') ||
|
|
576
|
+
(responseData.type === 'exception') ||
|
|
577
|
+
(!responseData.additional_data.key_okay)) {
|
|
578
|
+
throw responseData;
|
|
579
|
+
}
|
|
580
|
+
responseData.additional_data.key = token;
|
|
581
|
+
return responseData;
|
|
582
|
+
})).toPromise();
|
|
583
|
+
}
|
|
571
584
|
// Handlers
|
|
572
585
|
handleExpiration() {
|
|
573
586
|
return (session) => {
|
|
@@ -602,7 +615,7 @@ class EsolveAuthService {
|
|
|
602
615
|
return throwError(error);
|
|
603
616
|
}
|
|
604
617
|
}
|
|
605
|
-
EsolveAuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAuthService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$
|
|
618
|
+
EsolveAuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAuthService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }, { token: EsolveSessionService }, { token: EsolveErrorHandlerService }, { token: i1.CookieService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
606
619
|
EsolveAuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAuthService, providedIn: 'root' });
|
|
607
620
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAuthService, decorators: [{
|
|
608
621
|
type: Injectable,
|
|
@@ -613,7 +626,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
613
626
|
return [{ type: undefined, decorators: [{
|
|
614
627
|
type: Inject,
|
|
615
628
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
616
|
-
}] }, { type: i1$
|
|
629
|
+
}] }, { type: i1$2.HttpClient }, { type: EsolveSessionService }, { type: EsolveErrorHandlerService }, { type: i1.CookieService }];
|
|
617
630
|
} });
|
|
618
631
|
|
|
619
632
|
class EsolveAddress {
|
|
@@ -682,6 +695,229 @@ class EsolveUserAccountResult extends EsolveResponseResult {
|
|
|
682
695
|
}
|
|
683
696
|
}
|
|
684
697
|
|
|
698
|
+
class EsolveStockLocation {
|
|
699
|
+
constructor(record) {
|
|
700
|
+
this.id = +record.id;
|
|
701
|
+
this.identifier = record.identifier;
|
|
702
|
+
this.description = record.description;
|
|
703
|
+
this.head_office = record.head_office;
|
|
704
|
+
this.erp_identifier = record.erp_identifier;
|
|
705
|
+
this.external_system_code = record.external_system_code;
|
|
706
|
+
this.default_location_for_payment_methods = record.default_location_for_payment_methods;
|
|
707
|
+
this.userid = +record.userid;
|
|
708
|
+
this.importance = +record.importance;
|
|
709
|
+
this.active = record.is_active;
|
|
710
|
+
this.website_url = record.website_url;
|
|
711
|
+
this.address = new EsolveStockLocationAddress(record.street, record.suburb, record.city, record.province, record.country, record.postal_code, +record.latitude, +record.longitude);
|
|
712
|
+
this.pobox_address = new EsolveStockLocationPOBoxAddress(record.pobox, record.pobox_city, record.pobox_postal_code);
|
|
713
|
+
const telnumbers = [];
|
|
714
|
+
if (record.branch_telnumber.length > 0) {
|
|
715
|
+
telnumbers.push(record.branch_telnumber);
|
|
716
|
+
}
|
|
717
|
+
if (record.branch_telnumber_2.length > 0) {
|
|
718
|
+
telnumbers.push(record.branch_telnumber_2);
|
|
719
|
+
}
|
|
720
|
+
if (record.branch_telnumber_3.length > 0) {
|
|
721
|
+
telnumbers.push(record.branch_telnumber_3);
|
|
722
|
+
}
|
|
723
|
+
this.contact_info = new EsolveStockLocationContactInfo(telnumbers, record.branch_cellnumber, record.branch_email, record.branch_fax);
|
|
724
|
+
this.trading_times = new EsolveStockLocationTradingTimes(new EsolveStockLocationTradingTimesDay(record.monday_open_time, record.monday_close_time), new EsolveStockLocationTradingTimesDay(record.tuesday_open_time, record.tuesday_close_time), new EsolveStockLocationTradingTimesDay(record.wednesday_open_time, record.wednesday_close_time), new EsolveStockLocationTradingTimesDay(record.thursday_open_time, record.thursday_close_time), new EsolveStockLocationTradingTimesDay(record.friday_open_time, record.friday_close_time), new EsolveStockLocationTradingTimesDay(record.saturday_open_time, record.saturday_close_time), new EsolveStockLocationTradingTimesDay(record.sunday_open_time, record.sunday_close_time), new EsolveStockLocationTradingTimesDay(record.public_holiday_open_time, record.public_holiday_close_time), record.trading_hours_additional_info);
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
class EsolveStockLocationAddress {
|
|
728
|
+
constructor(street, suburb, city, province, country, postal_code, latitude, longitude) {
|
|
729
|
+
this.street = street;
|
|
730
|
+
this.suburb = suburb;
|
|
731
|
+
this.city = city;
|
|
732
|
+
this.province = province;
|
|
733
|
+
this.country = country;
|
|
734
|
+
this.postal_code = postal_code;
|
|
735
|
+
this.latitude = latitude;
|
|
736
|
+
this.longitude = longitude;
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
class EsolveStockLocationPOBoxAddress {
|
|
740
|
+
constructor(pobox, city, postal_code) {
|
|
741
|
+
this.pobox = pobox;
|
|
742
|
+
this.city = city;
|
|
743
|
+
this.postal_code = postal_code;
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
class EsolveStockLocationContactInfo {
|
|
747
|
+
constructor(telnumber, cellnumber, email, fax) {
|
|
748
|
+
this.telnumber = telnumber;
|
|
749
|
+
this.cellnumber = cellnumber;
|
|
750
|
+
this.email = email;
|
|
751
|
+
this.fax = fax;
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
class EsolveStockLocationTradingTimes {
|
|
755
|
+
constructor(monday, tuesday, wednesday, thursday, friday, saturday, sunday, public_holiday, trading_hours_additional_info = '') {
|
|
756
|
+
this.monday = monday;
|
|
757
|
+
this.tuesday = tuesday;
|
|
758
|
+
this.wednesday = wednesday;
|
|
759
|
+
this.thursday = thursday;
|
|
760
|
+
this.friday = friday;
|
|
761
|
+
this.saturday = saturday;
|
|
762
|
+
this.sunday = sunday;
|
|
763
|
+
this.public_holiday = public_holiday;
|
|
764
|
+
this.trading_hours_additional_info = trading_hours_additional_info;
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
class EsolveStockLocationTradingTimesDay {
|
|
768
|
+
constructor(open, close) {
|
|
769
|
+
this.open = open;
|
|
770
|
+
this.close = close;
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
class EsolveTransaction {
|
|
775
|
+
constructor(record) {
|
|
776
|
+
// Transaction Items
|
|
777
|
+
this.items = [];
|
|
778
|
+
this.id = +record.id;
|
|
779
|
+
this.type = record.transaction_type;
|
|
780
|
+
this.status = record.status;
|
|
781
|
+
this.loyalty_number = record.loyaltynumber;
|
|
782
|
+
this.external_order_number = record.external_order_number;
|
|
783
|
+
this.external_invoice_number = record.external_invoice_number;
|
|
784
|
+
this.date = new Date(+record.txdate_timestamp * 1000);
|
|
785
|
+
this.expected_date = new Date(+record.expected_date_timestamp * 1000);
|
|
786
|
+
this.invoice_amount = +record.invoice_amount;
|
|
787
|
+
this.vat = +record.vat;
|
|
788
|
+
this.discount = +record.discount;
|
|
789
|
+
this.total = +record.total;
|
|
790
|
+
this.shipping_total = +record.shipping_total;
|
|
791
|
+
this.insurance_total = +record.insurance_total;
|
|
792
|
+
this.payment = +record.payment;
|
|
793
|
+
this.payment_reference = record.payment_reference;
|
|
794
|
+
this.payment_description = record.payment_description;
|
|
795
|
+
this.gateway_transaction_id = record.gateway_transaction_id;
|
|
796
|
+
this.address = new EsolveTransactionAddress(record.recipient, record.address_type, record.address_description, record.street_number, record.street, record.suburb, record.city, record.province, record.country, record.postal_code, record.pobox);
|
|
797
|
+
if (record.user) {
|
|
798
|
+
this.user = new EsolveTransactionUser(+record.user.id, record.user.email, record.user.firstname, record.user.surname, record.user.telnumber, record.user.cellnumber);
|
|
799
|
+
}
|
|
800
|
+
if (record.client) {
|
|
801
|
+
this.client = new EsolveTransactionClient(+record.client.id, record.client.account, record.client.company_name, record.client.branch_code, record.client.email, record.client.firstname, record.client.surname, record.client.contact_number);
|
|
802
|
+
}
|
|
803
|
+
if (record.location_details) {
|
|
804
|
+
this.location = new EsolveTransactionLocation(record.location_details);
|
|
805
|
+
}
|
|
806
|
+
if (record.payment_method_details) {
|
|
807
|
+
this.payment_method = new EsolveTransactionPaymentMethod(record.payment_method_details.id, record.payment_method_details.paymethod_name, record.payment_method_details.description, record.payment_method_details.integration_type, record.payment_method_details.service_provider);
|
|
808
|
+
}
|
|
809
|
+
if (record.shipping_method_details) {
|
|
810
|
+
this.shipping_method = new EsolveTransactionShippingMethod(+record.shipping_method_details.id, record.shipping_method_details.carrier_name, record.shipping_method_details.delivery_category, record.shipping_method_details.location, record.shipping_method_details.description, record.shipping_method_details.pricing, !!record.shipping_method_details.client_to_collect);
|
|
811
|
+
}
|
|
812
|
+
this.parseTransactionItems(record.transaction_items);
|
|
813
|
+
}
|
|
814
|
+
parseTransactionItems(record_items) {
|
|
815
|
+
for (const record_item of record_items) {
|
|
816
|
+
const price = new EsolveTransactionItemPrice(+record_item.price_exclusive, +record_item.price_inclusive, +record_item.price_exclusive_after_discount, +record_item.price_inclusive_after_discount);
|
|
817
|
+
const line_total = new EsolveTransactionItemPrice(+record_item.line_total_exclusive, +record_item.line_total_inclusive, +record_item.line_total_exclusive_after_discount, +record_item.line_total_inclusive_after_discount);
|
|
818
|
+
const item = new EsolveTransactionItem(record_item.code, record_item.name, +record_item.qty, +record_item.discount, +record_item.vat_rate, price, line_total);
|
|
819
|
+
this.items.push(item);
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
class EsolveTransactionClient {
|
|
824
|
+
constructor(id, account, company_name, branch_code, email, first_name, last_name, contact_number) {
|
|
825
|
+
this.id = id;
|
|
826
|
+
this.account = account;
|
|
827
|
+
this.company_name = company_name;
|
|
828
|
+
this.branch_code = branch_code;
|
|
829
|
+
this.email = email;
|
|
830
|
+
this.first_name = first_name;
|
|
831
|
+
this.last_name = last_name;
|
|
832
|
+
this.contact_number = contact_number;
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
class EsolveTransactionUser {
|
|
836
|
+
constructor(id, email, first_name, last_name, tel_number, cell_number) {
|
|
837
|
+
this.id = id;
|
|
838
|
+
this.email = email;
|
|
839
|
+
this.first_name = first_name;
|
|
840
|
+
this.last_name = last_name;
|
|
841
|
+
this.tel_number = tel_number;
|
|
842
|
+
this.cell_number = cell_number;
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
class EsolveTransactionLocation extends EsolveStockLocation {
|
|
846
|
+
}
|
|
847
|
+
class EsolveTransactionPaymentMethod {
|
|
848
|
+
constructor(id, name, description, integration_type, service_provider) {
|
|
849
|
+
this.id = id;
|
|
850
|
+
this.name = name;
|
|
851
|
+
this.description = description;
|
|
852
|
+
this.integration_type = integration_type;
|
|
853
|
+
this.service_provider = service_provider;
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
class EsolveTransactionShippingMethod {
|
|
857
|
+
constructor(id, name, delivery_category, location, description, pricing, client_to_collect) {
|
|
858
|
+
this.id = id;
|
|
859
|
+
this.name = name;
|
|
860
|
+
this.delivery_category = delivery_category;
|
|
861
|
+
this.location = location;
|
|
862
|
+
this.description = description;
|
|
863
|
+
this.pricing = pricing;
|
|
864
|
+
this.client_to_collect = client_to_collect;
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
class EsolveTransactionAddress {
|
|
868
|
+
constructor(recipient, address_type, address_description, street_number, street, suburb, city, province, country, postal_code, pobox) {
|
|
869
|
+
this.recipient = recipient;
|
|
870
|
+
this.address_type = address_type;
|
|
871
|
+
this.address_description = address_description;
|
|
872
|
+
this.street_number = street_number;
|
|
873
|
+
this.street = street;
|
|
874
|
+
this.suburb = suburb;
|
|
875
|
+
this.city = city;
|
|
876
|
+
this.province = province;
|
|
877
|
+
this.country = country;
|
|
878
|
+
this.postal_code = postal_code;
|
|
879
|
+
this.pobox = pobox;
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
class EsolveTransactionItem {
|
|
883
|
+
constructor(code, name, qty, discount, vat_rate, price, line_total) {
|
|
884
|
+
this.code = code;
|
|
885
|
+
this.name = name;
|
|
886
|
+
this.qty = qty;
|
|
887
|
+
this.discount = discount;
|
|
888
|
+
this.vat_rate = vat_rate;
|
|
889
|
+
this.price = price;
|
|
890
|
+
this.line_total = line_total;
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
class EsolveTransactionItemPrice {
|
|
894
|
+
constructor(
|
|
895
|
+
/**
|
|
896
|
+
* Price without tax
|
|
897
|
+
*/
|
|
898
|
+
price,
|
|
899
|
+
/**
|
|
900
|
+
* Price with tax
|
|
901
|
+
*/
|
|
902
|
+
price_with_tax,
|
|
903
|
+
/**
|
|
904
|
+
* Price without tax and with discounts applied if appilcable
|
|
905
|
+
*/
|
|
906
|
+
price_discounted,
|
|
907
|
+
/**
|
|
908
|
+
* Price with tax and with discounts applied if appilcable
|
|
909
|
+
*/
|
|
910
|
+
price_with_tax_discounted) {
|
|
911
|
+
this.price = price;
|
|
912
|
+
this.price_with_tax = price_with_tax;
|
|
913
|
+
this.price_discounted = price_discounted;
|
|
914
|
+
this.price_with_tax_discounted = price_with_tax_discounted;
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
class EsolveTransactionList extends EsolveList {
|
|
919
|
+
}
|
|
920
|
+
|
|
685
921
|
class EsolveRegistrationResult extends EsolveResponseResult {
|
|
686
922
|
constructor(response) {
|
|
687
923
|
super(response);
|
|
@@ -732,31 +968,6 @@ class EsolveAccountService {
|
|
|
732
968
|
this._user_id = value;
|
|
733
969
|
}
|
|
734
970
|
}
|
|
735
|
-
processUserAccount(record) {
|
|
736
|
-
if (!record) {
|
|
737
|
-
throw new Error('Invalid record');
|
|
738
|
-
}
|
|
739
|
-
if (+record.userid !== this._user_id) {
|
|
740
|
-
throw new Error('Invalid user account retrieved');
|
|
741
|
-
}
|
|
742
|
-
const user_account = new EsolveUserAccount(+record.userid, record.email, record.registration_type, record.title, record.firstname, record.surname, record.initials, record.gender, record.idnumber);
|
|
743
|
-
user_account.contact_details = new EsolveUserAccountContact(record.telnumber, record.cellnumber, record.fax);
|
|
744
|
-
user_account.business_details = new EsolveUserAccountBusiness(record.busname, record.vatnum, record.busdescript, record.business_type);
|
|
745
|
-
return user_account;
|
|
746
|
-
}
|
|
747
|
-
processUserAddress(records) {
|
|
748
|
-
const user_addresses = [];
|
|
749
|
-
if (!records || (this._user_id === 0)) {
|
|
750
|
-
return user_addresses;
|
|
751
|
-
}
|
|
752
|
-
for (const record of records) {
|
|
753
|
-
if (+record.userid !== this._user_id) {
|
|
754
|
-
continue;
|
|
755
|
-
}
|
|
756
|
-
user_addresses.push(new EsolveAddress(+record.id, record.recipient, record.address_type, record.pobox, record.place_name, record.street_number, record.street, record.suburb, record.city, record.province, record.country, record.postal_code, +record.latitude, +record.longitude));
|
|
757
|
-
}
|
|
758
|
-
return user_addresses;
|
|
759
|
-
}
|
|
760
971
|
updateUserAccount(user_account_data) {
|
|
761
972
|
const body = {
|
|
762
973
|
account: user_account_data
|
|
@@ -806,20 +1017,23 @@ class EsolveAccountService {
|
|
|
806
1017
|
}));
|
|
807
1018
|
}
|
|
808
1019
|
getAddresses() {
|
|
809
|
-
|
|
810
|
-
|
|
1020
|
+
try {
|
|
1021
|
+
this.loginGuard();
|
|
1022
|
+
return this.http.get(`${this.config.api_url}/service/get-addresses.php`, {
|
|
1023
|
+
params: {
|
|
1024
|
+
ws_id: this.config.wsid,
|
|
1025
|
+
user_id: this.user_id
|
|
1026
|
+
}
|
|
1027
|
+
}).pipe(map(response => {
|
|
1028
|
+
if (response.records === undefined) {
|
|
1029
|
+
throw response;
|
|
1030
|
+
}
|
|
1031
|
+
return this.processUserAddress(response.records);
|
|
1032
|
+
}));
|
|
1033
|
+
}
|
|
1034
|
+
catch (error) {
|
|
1035
|
+
return throwError(error);
|
|
811
1036
|
}
|
|
812
|
-
return this.http.get(`${this.config.api_url}/service/get-addresses.php`, {
|
|
813
|
-
params: {
|
|
814
|
-
ws_id: this.config.wsid,
|
|
815
|
-
user_id: this.user_id
|
|
816
|
-
}
|
|
817
|
-
}).pipe(map(response => {
|
|
818
|
-
if (response.records === undefined) {
|
|
819
|
-
throw response;
|
|
820
|
-
}
|
|
821
|
-
return this.processUserAddress(response.records);
|
|
822
|
-
}));
|
|
823
1037
|
}
|
|
824
1038
|
deleteAddress(id) {
|
|
825
1039
|
return this.http.delete(`${this.config.api_url}/service/delete-address.php`, {
|
|
@@ -920,8 +1134,90 @@ class EsolveAccountService {
|
|
|
920
1134
|
return this.errorHandler.handleHttpPostError('set-forgot-password', errorRes);
|
|
921
1135
|
}));
|
|
922
1136
|
}
|
|
1137
|
+
getTransactions(options = {}) {
|
|
1138
|
+
try {
|
|
1139
|
+
this.loginGuard();
|
|
1140
|
+
return this.http.get(`${this.config.api_url}/service/get-transactions.php`, {
|
|
1141
|
+
params: Object.assign({ ws_id: this.config.wsid, user_id: this.user_id }, options)
|
|
1142
|
+
}).pipe(map(response => {
|
|
1143
|
+
var _a, _b;
|
|
1144
|
+
if (response.records === undefined) {
|
|
1145
|
+
throw response;
|
|
1146
|
+
}
|
|
1147
|
+
const items = this.processTransactions(response.records);
|
|
1148
|
+
const total = (_a = +response.additional_data.total_records) !== null && _a !== void 0 ? _a : 0;
|
|
1149
|
+
const rows = (_b = options.rows) !== null && _b !== void 0 ? _b : total;
|
|
1150
|
+
const page = options.page || 1;
|
|
1151
|
+
return new EsolveTransactionList(items, page, rows, total);
|
|
1152
|
+
}));
|
|
1153
|
+
}
|
|
1154
|
+
catch (error) {
|
|
1155
|
+
return throwError(error);
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
getTransaction(id) {
|
|
1159
|
+
try {
|
|
1160
|
+
this.loginGuard();
|
|
1161
|
+
return this.http.get(`${this.config.api_url}/service/get-transactions.php`, {
|
|
1162
|
+
params: {
|
|
1163
|
+
ws_id: this.config.wsid,
|
|
1164
|
+
user_id: this.user_id,
|
|
1165
|
+
transaction_id: id,
|
|
1166
|
+
}
|
|
1167
|
+
}).pipe(map(response => {
|
|
1168
|
+
if ((response.records === undefined) || (response.records.length <= 0)) {
|
|
1169
|
+
throw response;
|
|
1170
|
+
}
|
|
1171
|
+
const items = this.processTransactions(response.records);
|
|
1172
|
+
return items[0];
|
|
1173
|
+
}));
|
|
1174
|
+
}
|
|
1175
|
+
catch (error) {
|
|
1176
|
+
return throwError(error);
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
processUserAccount(record) {
|
|
1180
|
+
if (!record) {
|
|
1181
|
+
throw new Error('Invalid record');
|
|
1182
|
+
}
|
|
1183
|
+
if (+record.userid !== this._user_id) {
|
|
1184
|
+
throw new Error('Invalid user account retrieved');
|
|
1185
|
+
}
|
|
1186
|
+
const user_account = new EsolveUserAccount(+record.userid, record.email, record.registration_type, record.title, record.firstname, record.surname, record.initials, record.gender, record.idnumber);
|
|
1187
|
+
user_account.contact_details = new EsolveUserAccountContact(record.telnumber, record.cellnumber, record.fax);
|
|
1188
|
+
user_account.business_details = new EsolveUserAccountBusiness(record.busname, record.vatnum, record.busdescript, record.business_type);
|
|
1189
|
+
return user_account;
|
|
1190
|
+
}
|
|
1191
|
+
processUserAddress(records) {
|
|
1192
|
+
const user_addresses = [];
|
|
1193
|
+
if (!records || (this._user_id === 0)) {
|
|
1194
|
+
return user_addresses;
|
|
1195
|
+
}
|
|
1196
|
+
for (const record of records) {
|
|
1197
|
+
if (+record.userid !== this._user_id) {
|
|
1198
|
+
continue;
|
|
1199
|
+
}
|
|
1200
|
+
user_addresses.push(new EsolveAddress(+record.id, record.recipient, record.address_type, record.pobox, record.place_name, record.street_number, record.street, record.suburb, record.city, record.province, record.country, record.postal_code, +record.latitude, +record.longitude));
|
|
1201
|
+
}
|
|
1202
|
+
return user_addresses;
|
|
1203
|
+
}
|
|
1204
|
+
processTransactions(records) {
|
|
1205
|
+
const transactions = [];
|
|
1206
|
+
if (records) {
|
|
1207
|
+
for (const record of records) {
|
|
1208
|
+
const transaction = new EsolveTransaction(record);
|
|
1209
|
+
transactions.push(transaction);
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
return transactions;
|
|
1213
|
+
}
|
|
1214
|
+
loginGuard() {
|
|
1215
|
+
if (this.user_id <= 0) {
|
|
1216
|
+
this.errorHandler.emitError('login_required', 'Login is required');
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
923
1219
|
}
|
|
924
|
-
EsolveAccountService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAccountService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$
|
|
1220
|
+
EsolveAccountService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAccountService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }, { token: EsolveSessionService }, { token: EsolveErrorHandlerService }, { token: EsolveResponseHandlerService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
925
1221
|
EsolveAccountService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAccountService, providedIn: 'root' });
|
|
926
1222
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAccountService, decorators: [{
|
|
927
1223
|
type: Injectable,
|
|
@@ -932,7 +1228,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
932
1228
|
return [{ type: undefined, decorators: [{
|
|
933
1229
|
type: Inject,
|
|
934
1230
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
935
|
-
}] }, { type: i1$
|
|
1231
|
+
}] }, { type: i1$2.HttpClient }, { type: EsolveSessionService }, { type: EsolveErrorHandlerService }, { type: EsolveResponseHandlerService }];
|
|
936
1232
|
} });
|
|
937
1233
|
|
|
938
1234
|
class EsolveMediaArticle {
|
|
@@ -973,29 +1269,6 @@ class EsolveMediaService {
|
|
|
973
1269
|
this.config = config;
|
|
974
1270
|
this.http = http;
|
|
975
1271
|
}
|
|
976
|
-
processMediaRecord(record) {
|
|
977
|
-
const tags = [];
|
|
978
|
-
const topics = [];
|
|
979
|
-
if ((record.tags) && (record.tags.length > 0)) {
|
|
980
|
-
for (const tag of record.tags) {
|
|
981
|
-
tags.push(new EsolveTag(+tag.id, tag.tag_phrase, +tag.tag_weight, tag.description));
|
|
982
|
-
}
|
|
983
|
-
}
|
|
984
|
-
if ((record.topics) && (record.topics.length > 0)) {
|
|
985
|
-
for (const topic of record.topics) {
|
|
986
|
-
topics.push(new EsolveTopic(+topic.id, topic.name, topic.short_description, +topic.sort_priority));
|
|
987
|
-
}
|
|
988
|
-
}
|
|
989
|
-
return new EsolveMediaArticle(record.identifier, record.title, record.article, record.image_url, tags, topics, record.seo_page_title, record.seo_keywords, record.seo_description);
|
|
990
|
-
}
|
|
991
|
-
/**
|
|
992
|
-
* Retrieves media records from eSolve instance.
|
|
993
|
-
* @param params Header params
|
|
994
|
-
*/
|
|
995
|
-
getMediaRecords(params) {
|
|
996
|
-
params = params.set('ws_id', this.config.wsid);
|
|
997
|
-
return this.http.get(`${this.config.api_url}/service/get-media.php`, { params });
|
|
998
|
-
}
|
|
999
1272
|
/**
|
|
1000
1273
|
* Retrieves the media record from the eSolve instance using the identifier.
|
|
1001
1274
|
* @param identifier String representing the eSolve media indentifier
|
|
@@ -1040,8 +1313,31 @@ class EsolveMediaService {
|
|
|
1040
1313
|
return mediaArticles;
|
|
1041
1314
|
}));
|
|
1042
1315
|
}
|
|
1316
|
+
processMediaRecord(record) {
|
|
1317
|
+
const tags = [];
|
|
1318
|
+
const topics = [];
|
|
1319
|
+
if ((record.tags) && (record.tags.length > 0)) {
|
|
1320
|
+
for (const tag of record.tags) {
|
|
1321
|
+
tags.push(new EsolveTag(+tag.id, tag.tag_phrase, +tag.tag_weight, tag.description));
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
if ((record.topics) && (record.topics.length > 0)) {
|
|
1325
|
+
for (const topic of record.topics) {
|
|
1326
|
+
topics.push(new EsolveTopic(+topic.id, topic.name, topic.short_description, +topic.sort_priority));
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
return new EsolveMediaArticle(record.identifier, record.title, record.article, record.image_url, tags, topics, record.seo_page_title, record.seo_keywords, record.seo_description);
|
|
1330
|
+
}
|
|
1331
|
+
/**
|
|
1332
|
+
* Retrieves media records from eSolve instance.
|
|
1333
|
+
* @param params Header params
|
|
1334
|
+
*/
|
|
1335
|
+
getMediaRecords(params) {
|
|
1336
|
+
params = params.set('ws_id', this.config.wsid);
|
|
1337
|
+
return this.http.get(`${this.config.api_url}/service/get-media.php`, { params });
|
|
1338
|
+
}
|
|
1043
1339
|
}
|
|
1044
|
-
EsolveMediaService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMediaService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$
|
|
1340
|
+
EsolveMediaService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMediaService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1045
1341
|
EsolveMediaService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMediaService, providedIn: 'root' });
|
|
1046
1342
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMediaService, decorators: [{
|
|
1047
1343
|
type: Injectable,
|
|
@@ -1052,7 +1348,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
1052
1348
|
return [{ type: undefined, decorators: [{
|
|
1053
1349
|
type: Inject,
|
|
1054
1350
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
1055
|
-
}] }, { type: i1$
|
|
1351
|
+
}] }, { type: i1$2.HttpClient }];
|
|
1056
1352
|
} });
|
|
1057
1353
|
|
|
1058
1354
|
class EsolveNewsGroup {
|
|
@@ -1185,7 +1481,7 @@ class EsolveNewsService {
|
|
|
1185
1481
|
return new EsolveNewsArticle(newsRecord.id, newsRecord.title, newsRecord.sef_title, newsRecord.article, newsRecord.short_description, newsRecord.txdate, newsRecord.active, newsRecord.image, newsRecord.featured, author, newsRecord.seo_page_title, newsRecord.seo_keywords);
|
|
1186
1482
|
}
|
|
1187
1483
|
}
|
|
1188
|
-
EsolveNewsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveNewsService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$
|
|
1484
|
+
EsolveNewsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveNewsService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1189
1485
|
EsolveNewsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveNewsService, providedIn: 'root' });
|
|
1190
1486
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveNewsService, decorators: [{
|
|
1191
1487
|
type: Injectable,
|
|
@@ -1196,7 +1492,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
1196
1492
|
return [{ type: undefined, decorators: [{
|
|
1197
1493
|
type: Inject,
|
|
1198
1494
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
1199
|
-
}] }, { type: i1$
|
|
1495
|
+
}] }, { type: i1$2.HttpClient }];
|
|
1200
1496
|
} });
|
|
1201
1497
|
|
|
1202
1498
|
class EsolveBanner {
|
|
@@ -1252,6 +1548,31 @@ class EsolveBannerService {
|
|
|
1252
1548
|
this.config = config;
|
|
1253
1549
|
this.http = http;
|
|
1254
1550
|
}
|
|
1551
|
+
/**
|
|
1552
|
+
* Retrieves banners records from eSolve instance
|
|
1553
|
+
*
|
|
1554
|
+
* @returns An observable of eSolve banners.
|
|
1555
|
+
*/
|
|
1556
|
+
getBanners(identifier, banner_display_container, enable_date_filter = false) {
|
|
1557
|
+
let params = new HttpParams({
|
|
1558
|
+
fromObject: {
|
|
1559
|
+
ws_id: this.config.wsid,
|
|
1560
|
+
enable_date_filter
|
|
1561
|
+
}
|
|
1562
|
+
});
|
|
1563
|
+
if (identifier) {
|
|
1564
|
+
params = params.set('identifier', identifier);
|
|
1565
|
+
}
|
|
1566
|
+
if (banner_display_container) {
|
|
1567
|
+
params = params.set('banner_display_container', banner_display_container);
|
|
1568
|
+
}
|
|
1569
|
+
return this.http.get(`${this.config.api_url}/service/get-banners.php`, { params }).pipe(map(response => {
|
|
1570
|
+
if (response.records === undefined) {
|
|
1571
|
+
throw response;
|
|
1572
|
+
}
|
|
1573
|
+
return this.processBanners(response.records);
|
|
1574
|
+
}));
|
|
1575
|
+
}
|
|
1255
1576
|
processBannerImageHotspots(hotspot_records) {
|
|
1256
1577
|
const hotspots = [];
|
|
1257
1578
|
if (hotspot_records.length > 0) {
|
|
@@ -1298,39 +1619,14 @@ class EsolveBannerService {
|
|
|
1298
1619
|
const banner = new EsolveBanner(+record.id, record.banner_display_container, record.identifier, record.type, record.title, record.article, +record.sort_priority, {
|
|
1299
1620
|
url: record.link.url,
|
|
1300
1621
|
target: record.link.target
|
|
1301
|
-
}, image_sets);
|
|
1302
|
-
banners.push(banner);
|
|
1303
|
-
}
|
|
1304
|
-
}
|
|
1305
|
-
return banners;
|
|
1306
|
-
}
|
|
1307
|
-
/**
|
|
1308
|
-
* Retrieves banners records from eSolve instance
|
|
1309
|
-
*
|
|
1310
|
-
* @returns An observable of eSolve banners.
|
|
1311
|
-
*/
|
|
1312
|
-
getBanners(identifier, banner_display_container, enable_date_filter = false) {
|
|
1313
|
-
let params = new HttpParams({
|
|
1314
|
-
fromObject: {
|
|
1315
|
-
ws_id: this.config.wsid,
|
|
1316
|
-
enable_date_filter
|
|
1317
|
-
}
|
|
1318
|
-
});
|
|
1319
|
-
if (identifier) {
|
|
1320
|
-
params = params.set('identifier', identifier);
|
|
1321
|
-
}
|
|
1322
|
-
if (banner_display_container) {
|
|
1323
|
-
params = params.set('banner_display_container', banner_display_container);
|
|
1324
|
-
}
|
|
1325
|
-
return this.http.get(`${this.config.api_url}/service/get-banners.php`, { params }).pipe(map(response => {
|
|
1326
|
-
if (response.records === undefined) {
|
|
1327
|
-
throw response;
|
|
1622
|
+
}, image_sets);
|
|
1623
|
+
banners.push(banner);
|
|
1328
1624
|
}
|
|
1329
|
-
|
|
1330
|
-
|
|
1625
|
+
}
|
|
1626
|
+
return banners;
|
|
1331
1627
|
}
|
|
1332
1628
|
}
|
|
1333
|
-
EsolveBannerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveBannerService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$
|
|
1629
|
+
EsolveBannerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveBannerService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1334
1630
|
EsolveBannerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveBannerService, providedIn: 'root' });
|
|
1335
1631
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveBannerService, decorators: [{
|
|
1336
1632
|
type: Injectable,
|
|
@@ -1341,7 +1637,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
1341
1637
|
return [{ type: undefined, decorators: [{
|
|
1342
1638
|
type: Inject,
|
|
1343
1639
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
1344
|
-
}] }, { type: i1$
|
|
1640
|
+
}] }, { type: i1$2.HttpClient }];
|
|
1345
1641
|
} });
|
|
1346
1642
|
|
|
1347
1643
|
class EsolveMenuItem {
|
|
@@ -1382,7 +1678,7 @@ class EsolveMenuService {
|
|
|
1382
1678
|
return menu;
|
|
1383
1679
|
}
|
|
1384
1680
|
}
|
|
1385
|
-
EsolveMenuService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMenuService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$
|
|
1681
|
+
EsolveMenuService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMenuService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1386
1682
|
EsolveMenuService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMenuService, providedIn: 'root' });
|
|
1387
1683
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMenuService, decorators: [{
|
|
1388
1684
|
type: Injectable,
|
|
@@ -1393,7 +1689,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
1393
1689
|
return [{ type: undefined, decorators: [{
|
|
1394
1690
|
type: Inject,
|
|
1395
1691
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
1396
|
-
}] }, { type: i1$
|
|
1692
|
+
}] }, { type: i1$2.HttpClient }];
|
|
1397
1693
|
} });
|
|
1398
1694
|
|
|
1399
1695
|
class EsolveTopicService {
|
|
@@ -1401,16 +1697,6 @@ class EsolveTopicService {
|
|
|
1401
1697
|
this.config = config;
|
|
1402
1698
|
this.http = http;
|
|
1403
1699
|
}
|
|
1404
|
-
processTopics(records) {
|
|
1405
|
-
const topics = [];
|
|
1406
|
-
if (records) {
|
|
1407
|
-
for (const record of records) {
|
|
1408
|
-
const topic = new EsolveTopic(+record.id, record.name, record.short_description, +record.sort_priority);
|
|
1409
|
-
topics.push(topic);
|
|
1410
|
-
}
|
|
1411
|
-
}
|
|
1412
|
-
return topics;
|
|
1413
|
-
}
|
|
1414
1700
|
/**
|
|
1415
1701
|
* Retrieves active topics from the list of topic ID's. Note that inactive or expired
|
|
1416
1702
|
* topics will not be retrieved.
|
|
@@ -1433,8 +1719,18 @@ class EsolveTopicService {
|
|
|
1433
1719
|
return this.processTopics(response.records);
|
|
1434
1720
|
}));
|
|
1435
1721
|
}
|
|
1722
|
+
processTopics(records) {
|
|
1723
|
+
const topics = [];
|
|
1724
|
+
if (records) {
|
|
1725
|
+
for (const record of records) {
|
|
1726
|
+
const topic = new EsolveTopic(+record.id, record.name, record.short_description, +record.sort_priority);
|
|
1727
|
+
topics.push(topic);
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1730
|
+
return topics;
|
|
1731
|
+
}
|
|
1436
1732
|
}
|
|
1437
|
-
EsolveTopicService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveTopicService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$
|
|
1733
|
+
EsolveTopicService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveTopicService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1438
1734
|
EsolveTopicService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveTopicService, providedIn: 'root' });
|
|
1439
1735
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveTopicService, decorators: [{
|
|
1440
1736
|
type: Injectable,
|
|
@@ -1445,7 +1741,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
1445
1741
|
return [{ type: undefined, decorators: [{
|
|
1446
1742
|
type: Inject,
|
|
1447
1743
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
1448
|
-
}] }, { type: i1$
|
|
1744
|
+
}] }, { type: i1$2.HttpClient }];
|
|
1449
1745
|
} });
|
|
1450
1746
|
|
|
1451
1747
|
class EsolveStockBadge {
|
|
@@ -1767,7 +2063,7 @@ class EsolveStockService {
|
|
|
1767
2063
|
}));
|
|
1768
2064
|
}
|
|
1769
2065
|
}
|
|
1770
|
-
EsolveStockService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveStockService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$
|
|
2066
|
+
EsolveStockService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveStockService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1771
2067
|
EsolveStockService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveStockService, providedIn: 'root' });
|
|
1772
2068
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveStockService, decorators: [{
|
|
1773
2069
|
type: Injectable,
|
|
@@ -1778,7 +2074,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
1778
2074
|
return [{ type: undefined, decorators: [{
|
|
1779
2075
|
type: Inject,
|
|
1780
2076
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
1781
|
-
}] }, { type: i1$
|
|
2077
|
+
}] }, { type: i1$2.HttpClient }];
|
|
1782
2078
|
} });
|
|
1783
2079
|
|
|
1784
2080
|
class EsolveCategoryTreeItem {
|
|
@@ -1833,50 +2129,6 @@ class EsolveCategoryTreeService {
|
|
|
1833
2129
|
this.config = config;
|
|
1834
2130
|
this.http = http;
|
|
1835
2131
|
}
|
|
1836
|
-
/**
|
|
1837
|
-
* Processes the eSolve tree records and converts them into the correct format.
|
|
1838
|
-
* @param tree_records Records to process
|
|
1839
|
-
*/
|
|
1840
|
-
processTree(tree_records) {
|
|
1841
|
-
const tree_items = [];
|
|
1842
|
-
if (tree_records) {
|
|
1843
|
-
for (const tree_record of tree_records) {
|
|
1844
|
-
let esolve_id = '';
|
|
1845
|
-
let parent_id = '';
|
|
1846
|
-
let children = [];
|
|
1847
|
-
if (tree_record.type === 'category') {
|
|
1848
|
-
children = this.processTree(tree_record.children);
|
|
1849
|
-
esolve_id = tree_record.menu_id;
|
|
1850
|
-
parent_id = tree_record.owner_menu_id;
|
|
1851
|
-
}
|
|
1852
|
-
else {
|
|
1853
|
-
esolve_id = tree_record.id;
|
|
1854
|
-
parent_id = tree_record.menu_id;
|
|
1855
|
-
}
|
|
1856
|
-
tree_items.push(new EsolveCategoryTreeItem(tree_record.type, esolve_id, parent_id, tree_record.description, tree_record.sef_description, tree_record.seo_description, tree_record.sort_priority, tree_record.active, tree_record.display_only, tree_record.image, tree_record.seo_page_title, tree_record.seo_keywords, tree_record.short_description, children));
|
|
1857
|
-
}
|
|
1858
|
-
}
|
|
1859
|
-
return tree_items;
|
|
1860
|
-
}
|
|
1861
|
-
processTreeItem(record) {
|
|
1862
|
-
return new EsolveCategoryTreeItem(record.type, record.id, record.parent_id, record.description, record.sef_description, record.short_description, record.sort_priority, record.active, record.display_only, '', record.seo_page_title, record.seo_keywords, record.seo_description);
|
|
1863
|
-
}
|
|
1864
|
-
processID(id) {
|
|
1865
|
-
let type;
|
|
1866
|
-
let esolve_id;
|
|
1867
|
-
const type_code_regex = /^\<\<(CAT|SUB)\>\>/g;
|
|
1868
|
-
const match_results = id.match(type_code_regex);
|
|
1869
|
-
if (match_results) {
|
|
1870
|
-
const type_code = match_results[0];
|
|
1871
|
-
type = (type_code === '<<CAT>>' ? 'category' : 'subcategory');
|
|
1872
|
-
esolve_id = id.replace(type_code_regex, '');
|
|
1873
|
-
return {
|
|
1874
|
-
type,
|
|
1875
|
-
esolve_id
|
|
1876
|
-
};
|
|
1877
|
-
}
|
|
1878
|
-
return null;
|
|
1879
|
-
}
|
|
1880
2132
|
/**
|
|
1881
2133
|
* Retrieves the category tree from eSolve instance and coverts it to the correct format.
|
|
1882
2134
|
*/
|
|
@@ -1933,8 +2185,52 @@ class EsolveCategoryTreeService {
|
|
|
1933
2185
|
}
|
|
1934
2186
|
return throwError('Invalid options');
|
|
1935
2187
|
}
|
|
2188
|
+
/**
|
|
2189
|
+
* Processes the eSolve tree records and converts them into the correct format.
|
|
2190
|
+
* @param tree_records Records to process
|
|
2191
|
+
*/
|
|
2192
|
+
processTree(tree_records) {
|
|
2193
|
+
const tree_items = [];
|
|
2194
|
+
if (tree_records) {
|
|
2195
|
+
for (const tree_record of tree_records) {
|
|
2196
|
+
let esolve_id = '';
|
|
2197
|
+
let parent_id = '';
|
|
2198
|
+
let children = [];
|
|
2199
|
+
if (tree_record.type === 'category') {
|
|
2200
|
+
children = this.processTree(tree_record.children);
|
|
2201
|
+
esolve_id = tree_record.menu_id;
|
|
2202
|
+
parent_id = tree_record.owner_menu_id;
|
|
2203
|
+
}
|
|
2204
|
+
else {
|
|
2205
|
+
esolve_id = tree_record.id;
|
|
2206
|
+
parent_id = tree_record.menu_id;
|
|
2207
|
+
}
|
|
2208
|
+
tree_items.push(new EsolveCategoryTreeItem(tree_record.type, esolve_id, parent_id, tree_record.description, tree_record.sef_description, tree_record.seo_description, tree_record.sort_priority, tree_record.active, tree_record.display_only, tree_record.image, tree_record.seo_page_title, tree_record.seo_keywords, tree_record.short_description, children));
|
|
2209
|
+
}
|
|
2210
|
+
}
|
|
2211
|
+
return tree_items;
|
|
2212
|
+
}
|
|
2213
|
+
processTreeItem(record) {
|
|
2214
|
+
return new EsolveCategoryTreeItem(record.type, record.id, record.parent_id, record.description, record.sef_description, record.short_description, record.sort_priority, record.active, record.display_only, '', record.seo_page_title, record.seo_keywords, record.seo_description);
|
|
2215
|
+
}
|
|
2216
|
+
processID(id) {
|
|
2217
|
+
let type;
|
|
2218
|
+
let esolve_id;
|
|
2219
|
+
const type_code_regex = /^\<\<(CAT|SUB)\>\>/g;
|
|
2220
|
+
const match_results = id.match(type_code_regex);
|
|
2221
|
+
if (match_results) {
|
|
2222
|
+
const type_code = match_results[0];
|
|
2223
|
+
type = (type_code === '<<CAT>>' ? 'category' : 'subcategory');
|
|
2224
|
+
esolve_id = id.replace(type_code_regex, '');
|
|
2225
|
+
return {
|
|
2226
|
+
type,
|
|
2227
|
+
esolve_id
|
|
2228
|
+
};
|
|
2229
|
+
}
|
|
2230
|
+
return null;
|
|
2231
|
+
}
|
|
1936
2232
|
}
|
|
1937
|
-
EsolveCategoryTreeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCategoryTreeService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$
|
|
2233
|
+
EsolveCategoryTreeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCategoryTreeService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1938
2234
|
EsolveCategoryTreeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCategoryTreeService, providedIn: 'root' });
|
|
1939
2235
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCategoryTreeService, decorators: [{
|
|
1940
2236
|
type: Injectable,
|
|
@@ -1945,7 +2241,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
1945
2241
|
return [{ type: undefined, decorators: [{
|
|
1946
2242
|
type: Inject,
|
|
1947
2243
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
1948
|
-
}] }, { type: i1$
|
|
2244
|
+
}] }, { type: i1$2.HttpClient }];
|
|
1949
2245
|
} });
|
|
1950
2246
|
|
|
1951
2247
|
class EsolveCheckoutResult extends EsolveResponseResult {
|
|
@@ -2070,30 +2366,6 @@ class EsolveCartService {
|
|
|
2070
2366
|
this.responseHandler = responseHandler;
|
|
2071
2367
|
this._cached_tracking = 0;
|
|
2072
2368
|
}
|
|
2073
|
-
/**
|
|
2074
|
-
* Processes the eSolve tree records.
|
|
2075
|
-
* @param cart_item_records Records to process
|
|
2076
|
-
* @returns An array of processed cart items
|
|
2077
|
-
*/
|
|
2078
|
-
processCart(cart_item_records) {
|
|
2079
|
-
const cart_items = [];
|
|
2080
|
-
if (cart_item_records) {
|
|
2081
|
-
for (const cart_item_record of cart_item_records) {
|
|
2082
|
-
const cart_stock_item = new EsolveCartStockItem(cart_item_record.code, cart_item_record.name, cart_item_record.sef_name, cart_item_record.description, cart_item_record.is_active, +cart_item_record.items_in_pack, cart_item_record.delivery_category, cart_item_record.image_name);
|
|
2083
|
-
cart_items.push(new EsolveCartItem(+cart_item_record.id, cart_stock_item, +cart_item_record.qty, cart_item_record.type, +cart_item_record.price, +cart_item_record.discount, +cart_item_record.discount_interval, cart_item_record.vat_rate, cart_item_record.allow_quotes, cart_item_record.allow_orders, cart_item_record.must_collect, cart_item_record.requested_assembly, +cart_item_record.price_incl, +cart_item_record.discount_price, +cart_item_record.discount_price_incl, +cart_item_record.discount_total, +cart_item_record.vat_total, +cart_item_record.line_total, +cart_item_record.line_total_incl));
|
|
2084
|
-
}
|
|
2085
|
-
}
|
|
2086
|
-
return cart_items;
|
|
2087
|
-
}
|
|
2088
|
-
/**
|
|
2089
|
-
* Processes the eSolve cart totals
|
|
2090
|
-
* @param record Data to process
|
|
2091
|
-
* @returns Processed cart totals
|
|
2092
|
-
*/
|
|
2093
|
-
processCartTotals(record) {
|
|
2094
|
-
const cart_totals = new EsolveCartTotals(+record.records, +record.items, +record.total, +record.vat, +record.discount);
|
|
2095
|
-
return cart_totals;
|
|
2096
|
-
}
|
|
2097
2369
|
/**
|
|
2098
2370
|
* Retrieves the current cart
|
|
2099
2371
|
* @returns An `Observable` with an array of cart items
|
|
@@ -2212,8 +2484,32 @@ class EsolveCartService {
|
|
|
2212
2484
|
}));
|
|
2213
2485
|
}));
|
|
2214
2486
|
}
|
|
2487
|
+
/**
|
|
2488
|
+
* Processes the eSolve tree records.
|
|
2489
|
+
* @param cart_item_records Records to process
|
|
2490
|
+
* @returns An array of processed cart items
|
|
2491
|
+
*/
|
|
2492
|
+
processCart(cart_item_records) {
|
|
2493
|
+
const cart_items = [];
|
|
2494
|
+
if (cart_item_records) {
|
|
2495
|
+
for (const cart_item_record of cart_item_records) {
|
|
2496
|
+
const cart_stock_item = new EsolveCartStockItem(cart_item_record.code, cart_item_record.name, cart_item_record.sef_name, cart_item_record.description, cart_item_record.is_active, +cart_item_record.items_in_pack, cart_item_record.delivery_category, cart_item_record.image_name);
|
|
2497
|
+
cart_items.push(new EsolveCartItem(+cart_item_record.id, cart_stock_item, +cart_item_record.qty, cart_item_record.type, +cart_item_record.price, +cart_item_record.discount, +cart_item_record.discount_interval, cart_item_record.vat_rate, cart_item_record.allow_quotes, cart_item_record.allow_orders, cart_item_record.must_collect, cart_item_record.requested_assembly, +cart_item_record.price_incl, +cart_item_record.discount_price, +cart_item_record.discount_price_incl, +cart_item_record.discount_total, +cart_item_record.vat_total, +cart_item_record.line_total, +cart_item_record.line_total_incl));
|
|
2498
|
+
}
|
|
2499
|
+
}
|
|
2500
|
+
return cart_items;
|
|
2501
|
+
}
|
|
2502
|
+
/**
|
|
2503
|
+
* Processes the eSolve cart totals
|
|
2504
|
+
* @param record Data to process
|
|
2505
|
+
* @returns Processed cart totals
|
|
2506
|
+
*/
|
|
2507
|
+
processCartTotals(record) {
|
|
2508
|
+
const cart_totals = new EsolveCartTotals(+record.records, +record.items, +record.total, +record.vat, +record.discount);
|
|
2509
|
+
return cart_totals;
|
|
2510
|
+
}
|
|
2215
2511
|
}
|
|
2216
|
-
EsolveCartService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCartService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$
|
|
2512
|
+
EsolveCartService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCartService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }, { token: EsolveErrorHandlerService }, { token: EsolveResponseHandlerService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2217
2513
|
EsolveCartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCartService, providedIn: 'root' });
|
|
2218
2514
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCartService, decorators: [{
|
|
2219
2515
|
type: Injectable,
|
|
@@ -2224,7 +2520,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
2224
2520
|
return [{ type: undefined, decorators: [{
|
|
2225
2521
|
type: Inject,
|
|
2226
2522
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
2227
|
-
}] }, { type: i1$
|
|
2523
|
+
}] }, { type: i1$2.HttpClient }, { type: EsolveErrorHandlerService }, { type: EsolveResponseHandlerService }];
|
|
2228
2524
|
} });
|
|
2229
2525
|
|
|
2230
2526
|
class EsolveVaultItemResult extends EsolveResponseResult {
|
|
@@ -2295,12 +2591,8 @@ class EsolvePaymentMethod {
|
|
|
2295
2591
|
this.description = record.description;
|
|
2296
2592
|
this.display_banking_details = record.display_banking_details;
|
|
2297
2593
|
this.currency_code = record.currency_code;
|
|
2298
|
-
this.terminal_id = record.terminal_id;
|
|
2299
|
-
this.terminal_id_secondary = record.terminal_id_secondary;
|
|
2300
2594
|
this.merchant_id = record.merchant_id;
|
|
2301
2595
|
this.application_id = record.application_id;
|
|
2302
|
-
this.api_username = record.api_username;
|
|
2303
|
-
this.api_password = record.api_password;
|
|
2304
2596
|
this.api_signature = record.api_signature;
|
|
2305
2597
|
this.is_gateway = record.is_gateway;
|
|
2306
2598
|
this.must_store_card_details = record.must_store_card_details;
|
|
@@ -2509,7 +2801,7 @@ class EsolvePaymentService {
|
|
|
2509
2801
|
}));
|
|
2510
2802
|
}
|
|
2511
2803
|
}
|
|
2512
|
-
EsolvePaymentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolvePaymentService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$
|
|
2804
|
+
EsolvePaymentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolvePaymentService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }, { token: EsolveErrorHandlerService }, { token: EsolveResponseHandlerService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2513
2805
|
EsolvePaymentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolvePaymentService, providedIn: 'root' });
|
|
2514
2806
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolvePaymentService, decorators: [{
|
|
2515
2807
|
type: Injectable,
|
|
@@ -2520,7 +2812,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
2520
2812
|
return [{ type: undefined, decorators: [{
|
|
2521
2813
|
type: Inject,
|
|
2522
2814
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
2523
|
-
}] }, { type: i1$
|
|
2815
|
+
}] }, { type: i1$2.HttpClient }, { type: EsolveErrorHandlerService }, { type: EsolveResponseHandlerService }];
|
|
2524
2816
|
} });
|
|
2525
2817
|
|
|
2526
2818
|
class EsolveShippingMethod {
|
|
@@ -2661,7 +2953,7 @@ class EsolveShippingService {
|
|
|
2661
2953
|
}
|
|
2662
2954
|
}
|
|
2663
2955
|
}
|
|
2664
|
-
EsolveShippingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveShippingService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$
|
|
2956
|
+
EsolveShippingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveShippingService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2665
2957
|
EsolveShippingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveShippingService, providedIn: 'root' });
|
|
2666
2958
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveShippingService, decorators: [{
|
|
2667
2959
|
type: Injectable,
|
|
@@ -2672,104 +2964,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
2672
2964
|
return [{ type: undefined, decorators: [{
|
|
2673
2965
|
type: Inject,
|
|
2674
2966
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
2675
|
-
}] }, { type: i1$
|
|
2967
|
+
}] }, { type: i1$2.HttpClient }];
|
|
2676
2968
|
} });
|
|
2677
2969
|
|
|
2678
|
-
class EsolveStockLocation {
|
|
2679
|
-
constructor(record) {
|
|
2680
|
-
this.id = +record.id;
|
|
2681
|
-
this.identifier = record.identifier;
|
|
2682
|
-
this.description = record.description;
|
|
2683
|
-
this.head_office = record.head_office;
|
|
2684
|
-
this.erp_identifier = record.erp_identifier;
|
|
2685
|
-
this.external_system_code = record.external_system_code;
|
|
2686
|
-
this.default_location_for_payment_methods = record.default_location_for_payment_methods;
|
|
2687
|
-
this.userid = +record.userid;
|
|
2688
|
-
this.importance = +record.importance;
|
|
2689
|
-
this.active = record.is_active;
|
|
2690
|
-
this.website_url = record.website_url;
|
|
2691
|
-
this.address = new EsolveStockLocationAddress(record.street, record.suburb, record.city, record.province, record.country, record.postal_code, +record.latitude, +record.longitude);
|
|
2692
|
-
this.pobox_address = new EsolveStockLocationPOBoxAddress(record.pobox, record.pobox_city, record.pobox_postal_code);
|
|
2693
|
-
const telnumbers = [];
|
|
2694
|
-
if (record.branch_telnumber.length > 0) {
|
|
2695
|
-
telnumbers.push(record.branch_telnumber);
|
|
2696
|
-
}
|
|
2697
|
-
if (record.branch_telnumber_2.length > 0) {
|
|
2698
|
-
telnumbers.push(record.branch_telnumber_2);
|
|
2699
|
-
}
|
|
2700
|
-
if (record.branch_telnumber_3.length > 0) {
|
|
2701
|
-
telnumbers.push(record.branch_telnumber_3);
|
|
2702
|
-
}
|
|
2703
|
-
this.contact_info = new EsolveStockLocationContactInfo(telnumbers, record.branch_cellnumber, record.branch_email, record.branch_fax);
|
|
2704
|
-
this.trading_times = new EsolveStockLocationTradingTimes(record.monday_open_time, record.monday_close_time, record.tuesday_open_time, record.tuesday_close_time, record.wednesday_open_time, record.wednesday_close_time, record.thursday_open_time, record.thursday_close_time, record.friday_open_time, record.friday_close_time, record.saturday_open_time, record.saturday_close_time, record.sunday_open_time, record.sunday_close_time, record.public_holiday_open_time, record.public_holiday_close_time, record.trading_hours_additional_in);
|
|
2705
|
-
}
|
|
2706
|
-
}
|
|
2707
|
-
class EsolveStockLocationAddress {
|
|
2708
|
-
constructor(street, suburb, city, province, country, postal_code, latitude, longitude) {
|
|
2709
|
-
this.street = street;
|
|
2710
|
-
this.suburb = suburb;
|
|
2711
|
-
this.city = city;
|
|
2712
|
-
this.province = province;
|
|
2713
|
-
this.country = country;
|
|
2714
|
-
this.postal_code = postal_code;
|
|
2715
|
-
this.latitude = latitude;
|
|
2716
|
-
this.longitude = longitude;
|
|
2717
|
-
}
|
|
2718
|
-
}
|
|
2719
|
-
class EsolveStockLocationPOBoxAddress {
|
|
2720
|
-
constructor(pobox, city, postal_code) {
|
|
2721
|
-
this.pobox = pobox;
|
|
2722
|
-
this.city = city;
|
|
2723
|
-
this.postal_code = postal_code;
|
|
2724
|
-
}
|
|
2725
|
-
}
|
|
2726
|
-
class EsolveStockLocationContactInfo {
|
|
2727
|
-
constructor(telnumber, cellnumber, email, fax) {
|
|
2728
|
-
this.telnumber = telnumber;
|
|
2729
|
-
this.cellnumber = cellnumber;
|
|
2730
|
-
this.email = email;
|
|
2731
|
-
this.fax = fax;
|
|
2732
|
-
}
|
|
2733
|
-
}
|
|
2734
|
-
class EsolveStockLocationTradingTimes {
|
|
2735
|
-
constructor(monday_open_time, monday_close_time, tuesday_open_time, tuesday_close_time, wednesday_open_time, wednesday_close_time, thursday_open_time, thursday_close_time, friday_open_time, friday_close_time, saturday_open_time, saturday_close_time, sunday_open_time, sunday_close_time, public_holiday_open_time, public_holiday_close_time, trading_hours_additional_info = '') {
|
|
2736
|
-
this.trading_hours_additional_info = trading_hours_additional_info;
|
|
2737
|
-
this.monday = new EsolveStockLocationTradingTimesDay(monday_open_time, monday_close_time);
|
|
2738
|
-
this.tuesday = new EsolveStockLocationTradingTimesDay(tuesday_open_time, tuesday_close_time);
|
|
2739
|
-
this.wednesday = new EsolveStockLocationTradingTimesDay(wednesday_open_time, wednesday_close_time);
|
|
2740
|
-
this.thursday = new EsolveStockLocationTradingTimesDay(thursday_open_time, thursday_close_time);
|
|
2741
|
-
this.friday = new EsolveStockLocationTradingTimesDay(friday_open_time, friday_close_time);
|
|
2742
|
-
this.saturday = new EsolveStockLocationTradingTimesDay(saturday_open_time, saturday_close_time);
|
|
2743
|
-
this.sunday = new EsolveStockLocationTradingTimesDay(sunday_open_time, sunday_close_time);
|
|
2744
|
-
this.public_holiday = new EsolveStockLocationTradingTimesDay(public_holiday_open_time, public_holiday_close_time);
|
|
2745
|
-
}
|
|
2746
|
-
}
|
|
2747
|
-
class EsolveStockLocationTradingTimesDay {
|
|
2748
|
-
constructor(open, close) {
|
|
2749
|
-
this.open = open;
|
|
2750
|
-
this.close = close;
|
|
2751
|
-
}
|
|
2752
|
-
}
|
|
2753
|
-
|
|
2754
2970
|
class EsolveLocationsService {
|
|
2755
2971
|
constructor(config, http) {
|
|
2756
2972
|
this.config = config;
|
|
2757
2973
|
this.http = http;
|
|
2758
2974
|
}
|
|
2759
|
-
/**
|
|
2760
|
-
* Processes the eSolve stock location records.
|
|
2761
|
-
* @param records Records to process
|
|
2762
|
-
* @returns An array of processed stock location records
|
|
2763
|
-
*/
|
|
2764
|
-
processStockLocations(records) {
|
|
2765
|
-
const stock_locations = [];
|
|
2766
|
-
if (records) {
|
|
2767
|
-
for (const record of records) {
|
|
2768
|
-
stock_locations.push(new EsolveStockLocation(record));
|
|
2769
|
-
}
|
|
2770
|
-
}
|
|
2771
|
-
return stock_locations;
|
|
2772
|
-
}
|
|
2773
2975
|
/**
|
|
2774
2976
|
* Retrieves a list of stock locations
|
|
2775
2977
|
* @returns An `Observable` with an array of stock locations
|
|
@@ -2784,8 +2986,22 @@ class EsolveLocationsService {
|
|
|
2784
2986
|
return this.processStockLocations(response.records);
|
|
2785
2987
|
}));
|
|
2786
2988
|
}
|
|
2989
|
+
/**
|
|
2990
|
+
* Processes the eSolve stock location records.
|
|
2991
|
+
* @param records Records to process
|
|
2992
|
+
* @returns An array of processed stock location records
|
|
2993
|
+
*/
|
|
2994
|
+
processStockLocations(records) {
|
|
2995
|
+
const stock_locations = [];
|
|
2996
|
+
if (records) {
|
|
2997
|
+
for (const record of records) {
|
|
2998
|
+
stock_locations.push(new EsolveStockLocation(record));
|
|
2999
|
+
}
|
|
3000
|
+
}
|
|
3001
|
+
return stock_locations;
|
|
3002
|
+
}
|
|
2787
3003
|
}
|
|
2788
|
-
EsolveLocationsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveLocationsService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$
|
|
3004
|
+
EsolveLocationsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveLocationsService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2789
3005
|
EsolveLocationsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveLocationsService, providedIn: 'root' });
|
|
2790
3006
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveLocationsService, decorators: [{
|
|
2791
3007
|
type: Injectable,
|
|
@@ -2796,7 +3012,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
2796
3012
|
return [{ type: undefined, decorators: [{
|
|
2797
3013
|
type: Inject,
|
|
2798
3014
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
2799
|
-
}] }, { type: i1$
|
|
3015
|
+
}] }, { type: i1$2.HttpClient }];
|
|
2800
3016
|
} });
|
|
2801
3017
|
|
|
2802
3018
|
/*
|
|
@@ -2807,5 +3023,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
2807
3023
|
* Generated bundle index. Do not edit.
|
|
2808
3024
|
*/
|
|
2809
3025
|
|
|
2810
|
-
export { EsolveAccountService, EsolveAddress, EsolveAddressResult, EsolveAuthService, EsolveBankingDetails, EsolveBanner, EsolveBannerImage, EsolveBannerImageHotspot, EsolveBannerService, EsolveCartItem, EsolveCartService, EsolveCartTotals, EsolveCategoryTreeItem, EsolveCategoryTreeService, EsolveChangePasswordResult, EsolveCheckoutResult, EsolveErrorHandlerService, EsolveHttpError, EsolveLocationsService, EsolveMediaArticle, EsolveMediaService, EsolveMenuItem, EsolveMenuService, EsolveNewsArticle, EsolveNewsArticleAuthor, EsolveNewsArticleList, EsolveNewsGroup, EsolveNewsService, EsolvePaymentMethod, EsolvePaymentResult, EsolvePaymentService, EsolveRegistrationResult, EsolveResetPasswordResult, EsolveResponseHandlerService, EsolveResponseResult, EsolveResult, EsolveSEOInfo, EsolveSeoService, EsolveSession, EsolveSessionService, EsolveShippingCost, EsolveShippingMethod, EsolveShippingService, EsolveStockBadge, EsolveStockItem, EsolveStockItemList, EsolveStockLocation, EsolveStockPrice, EsolveStockService, EsolveTag, EsolveTopic, EsolveTopicService, EsolveUserAccount, EsolveUserAccountBusiness, EsolveUserAccountContact, EsolveUserAccountResult, EsolveVaultItem, EsolveVaultItemResult, NgEsolveConnectModule };
|
|
3026
|
+
export { EsolveAccountService, EsolveAddress, EsolveAddressResult, EsolveAuthService, EsolveBankingDetails, EsolveBanner, EsolveBannerImage, EsolveBannerImageHotspot, EsolveBannerService, EsolveCartItem, EsolveCartService, EsolveCartTotals, EsolveCategoryTreeItem, EsolveCategoryTreeService, EsolveChangePasswordResult, EsolveCheckoutResult, EsolveErrorHandlerService, EsolveHttpError, EsolveList, EsolveLocationsService, EsolveMediaArticle, EsolveMediaService, EsolveMenuItem, EsolveMenuService, EsolveNewsArticle, EsolveNewsArticleAuthor, EsolveNewsArticleList, EsolveNewsGroup, EsolveNewsService, EsolvePaymentMethod, EsolvePaymentResult, EsolvePaymentService, EsolveRegistrationResult, EsolveResetPasswordResult, EsolveResponseHandlerService, EsolveResponseResult, EsolveResult, EsolveSEOInfo, EsolveSeoService, EsolveSession, EsolveSessionService, EsolveShippingCost, EsolveShippingMethod, EsolveShippingService, EsolveStockBadge, EsolveStockItem, EsolveStockItemList, EsolveStockLocation, EsolveStockLocationAddress, EsolveStockLocationContactInfo, EsolveStockLocationPOBoxAddress, EsolveStockLocationTradingTimes, EsolveStockLocationTradingTimesDay, EsolveStockPrice, EsolveStockService, EsolveTag, EsolveTopic, EsolveTopicService, EsolveTransaction, EsolveTransactionAddress, EsolveTransactionClient, EsolveTransactionItem, EsolveTransactionItemPrice, EsolveTransactionList, EsolveTransactionLocation, EsolveTransactionPaymentMethod, EsolveTransactionShippingMethod, EsolveTransactionUser, EsolveUserAccount, EsolveUserAccountBusiness, EsolveUserAccountContact, EsolveUserAccountResult, EsolveVaultItem, EsolveVaultItemResult, NgEsolveConnectModule };
|
|
2811
3027
|
//# sourceMappingURL=esolve-ng-esolve-connect.mjs.map
|