@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,
|
|
@@ -117,7 +119,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
117
119
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
118
120
|
type: Inject,
|
|
119
121
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
120
|
-
}] }]; } });
|
|
122
|
+
}] }, { type: i1.CookieService }]; } });
|
|
121
123
|
|
|
122
124
|
class EsolveAuthInterceptorService {
|
|
123
125
|
constructor(config, session) {
|
|
@@ -195,6 +197,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
195
197
|
}]
|
|
196
198
|
}] });
|
|
197
199
|
|
|
200
|
+
class EsolveList {
|
|
201
|
+
constructor(items = [], page = 0, rows = 0, total = 0) {
|
|
202
|
+
this.items = items;
|
|
203
|
+
this.page = page;
|
|
204
|
+
this.rows = rows;
|
|
205
|
+
this.total = total;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
198
209
|
class EsolveResult {
|
|
199
210
|
constructor(status, code, message) {
|
|
200
211
|
this.status = status;
|
|
@@ -213,6 +224,9 @@ class EsolveHttpError {
|
|
|
213
224
|
|
|
214
225
|
class EsolveErrorHandlerService {
|
|
215
226
|
constructor() { }
|
|
227
|
+
emitError(code, message) {
|
|
228
|
+
throw new EsolveHttpError('error', message, code);
|
|
229
|
+
}
|
|
216
230
|
handleHttpPostError(service_type, errorRes) {
|
|
217
231
|
if (!(errorRes instanceof HttpErrorResponse) &&
|
|
218
232
|
!('service_type' in errorRes) &&
|
|
@@ -282,8 +296,7 @@ class EsolveErrorHandlerService {
|
|
|
282
296
|
return error;
|
|
283
297
|
}
|
|
284
298
|
parseDeleteError(result) {
|
|
285
|
-
|
|
286
|
-
return error;
|
|
299
|
+
return new EsolveHttpError('error', result.message, result.code);
|
|
287
300
|
}
|
|
288
301
|
}
|
|
289
302
|
EsolveErrorHandlerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveErrorHandlerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -442,7 +455,7 @@ class EsolveSeoService {
|
|
|
442
455
|
this.setPageKeywordsTags(seoInfo.keywords);
|
|
443
456
|
}
|
|
444
457
|
}
|
|
445
|
-
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 });
|
|
458
|
+
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 });
|
|
446
459
|
EsolveSeoService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveSeoService, providedIn: 'root' });
|
|
447
460
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveSeoService, decorators: [{
|
|
448
461
|
type: Injectable,
|
|
@@ -452,7 +465,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
452
465
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
453
466
|
type: Inject,
|
|
454
467
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
455
|
-
}] }, { type: i1.Title }, { type: i1.Meta }]; } });
|
|
468
|
+
}] }, { type: i1$1.Title }, { type: i1$1.Meta }]; } });
|
|
456
469
|
|
|
457
470
|
class EsolveAuthService {
|
|
458
471
|
constructor(config, http, session, errorHandler, cookieService) {
|
|
@@ -462,30 +475,6 @@ class EsolveAuthService {
|
|
|
462
475
|
this.errorHandler = errorHandler;
|
|
463
476
|
this.cookieService = cookieService;
|
|
464
477
|
}
|
|
465
|
-
checkAccessToken(session) {
|
|
466
|
-
session = session || this.session.currentSession;
|
|
467
|
-
const token = session?.key ?? '';
|
|
468
|
-
const params = new HttpParams({
|
|
469
|
-
fromObject: {
|
|
470
|
-
key: token,
|
|
471
|
-
ws_id: this.config.wsid
|
|
472
|
-
}
|
|
473
|
-
});
|
|
474
|
-
return this.http.get(`${this.config.api_url}/service/get-access-token.php`, {
|
|
475
|
-
params,
|
|
476
|
-
headers: new HttpHeaders({
|
|
477
|
-
'Accept-Language': '*'
|
|
478
|
-
})
|
|
479
|
-
}).pipe(map(responseData => {
|
|
480
|
-
if ((responseData.type === 'error') ||
|
|
481
|
-
(responseData.type === 'exception') ||
|
|
482
|
-
(!responseData.additional_data.key_okay)) {
|
|
483
|
-
throw responseData;
|
|
484
|
-
}
|
|
485
|
-
responseData.additional_data.key = token;
|
|
486
|
-
return responseData;
|
|
487
|
-
})).toPromise();
|
|
488
|
-
}
|
|
489
478
|
getAccessToken(email, password, anonymous = false) {
|
|
490
479
|
let params = new HttpParams();
|
|
491
480
|
if (anonymous) {
|
|
@@ -561,6 +550,30 @@ class EsolveAuthService {
|
|
|
561
550
|
this.cookieService.delete('_ws_id');
|
|
562
551
|
return this.getAccessToken('', '', true).toPromise();
|
|
563
552
|
}
|
|
553
|
+
checkAccessToken(session) {
|
|
554
|
+
session = session || this.session.currentSession;
|
|
555
|
+
const token = session?.key ?? '';
|
|
556
|
+
const params = new HttpParams({
|
|
557
|
+
fromObject: {
|
|
558
|
+
key: token,
|
|
559
|
+
ws_id: this.config.wsid
|
|
560
|
+
}
|
|
561
|
+
});
|
|
562
|
+
return this.http.get(`${this.config.api_url}/service/get-access-token.php`, {
|
|
563
|
+
params,
|
|
564
|
+
headers: new HttpHeaders({
|
|
565
|
+
'Accept-Language': '*'
|
|
566
|
+
})
|
|
567
|
+
}).pipe(map(responseData => {
|
|
568
|
+
if ((responseData.type === 'error') ||
|
|
569
|
+
(responseData.type === 'exception') ||
|
|
570
|
+
(!responseData.additional_data.key_okay)) {
|
|
571
|
+
throw responseData;
|
|
572
|
+
}
|
|
573
|
+
responseData.additional_data.key = token;
|
|
574
|
+
return responseData;
|
|
575
|
+
})).toPromise();
|
|
576
|
+
}
|
|
564
577
|
// Handlers
|
|
565
578
|
handleExpiration() {
|
|
566
579
|
return (session) => {
|
|
@@ -595,7 +608,7 @@ class EsolveAuthService {
|
|
|
595
608
|
return throwError(error);
|
|
596
609
|
}
|
|
597
610
|
}
|
|
598
|
-
EsolveAuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAuthService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$
|
|
611
|
+
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 });
|
|
599
612
|
EsolveAuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAuthService, providedIn: 'root' });
|
|
600
613
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAuthService, decorators: [{
|
|
601
614
|
type: Injectable,
|
|
@@ -605,7 +618,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
605
618
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
606
619
|
type: Inject,
|
|
607
620
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
608
|
-
}] }, { type: i1$
|
|
621
|
+
}] }, { type: i1$2.HttpClient }, { type: EsolveSessionService }, { type: EsolveErrorHandlerService }, { type: i1.CookieService }]; } });
|
|
609
622
|
|
|
610
623
|
class EsolveAddress {
|
|
611
624
|
constructor(id, recipient, address_type, pobox, place_name, street_number, street, suburb, city, province, country, postal_code, latitude, longitude) {
|
|
@@ -673,6 +686,229 @@ class EsolveUserAccountResult extends EsolveResponseResult {
|
|
|
673
686
|
}
|
|
674
687
|
}
|
|
675
688
|
|
|
689
|
+
class EsolveStockLocation {
|
|
690
|
+
constructor(record) {
|
|
691
|
+
this.id = +record.id;
|
|
692
|
+
this.identifier = record.identifier;
|
|
693
|
+
this.description = record.description;
|
|
694
|
+
this.head_office = record.head_office;
|
|
695
|
+
this.erp_identifier = record.erp_identifier;
|
|
696
|
+
this.external_system_code = record.external_system_code;
|
|
697
|
+
this.default_location_for_payment_methods = record.default_location_for_payment_methods;
|
|
698
|
+
this.userid = +record.userid;
|
|
699
|
+
this.importance = +record.importance;
|
|
700
|
+
this.active = record.is_active;
|
|
701
|
+
this.website_url = record.website_url;
|
|
702
|
+
this.address = new EsolveStockLocationAddress(record.street, record.suburb, record.city, record.province, record.country, record.postal_code, +record.latitude, +record.longitude);
|
|
703
|
+
this.pobox_address = new EsolveStockLocationPOBoxAddress(record.pobox, record.pobox_city, record.pobox_postal_code);
|
|
704
|
+
const telnumbers = [];
|
|
705
|
+
if (record.branch_telnumber.length > 0) {
|
|
706
|
+
telnumbers.push(record.branch_telnumber);
|
|
707
|
+
}
|
|
708
|
+
if (record.branch_telnumber_2.length > 0) {
|
|
709
|
+
telnumbers.push(record.branch_telnumber_2);
|
|
710
|
+
}
|
|
711
|
+
if (record.branch_telnumber_3.length > 0) {
|
|
712
|
+
telnumbers.push(record.branch_telnumber_3);
|
|
713
|
+
}
|
|
714
|
+
this.contact_info = new EsolveStockLocationContactInfo(telnumbers, record.branch_cellnumber, record.branch_email, record.branch_fax);
|
|
715
|
+
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);
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
class EsolveStockLocationAddress {
|
|
719
|
+
constructor(street, suburb, city, province, country, postal_code, latitude, longitude) {
|
|
720
|
+
this.street = street;
|
|
721
|
+
this.suburb = suburb;
|
|
722
|
+
this.city = city;
|
|
723
|
+
this.province = province;
|
|
724
|
+
this.country = country;
|
|
725
|
+
this.postal_code = postal_code;
|
|
726
|
+
this.latitude = latitude;
|
|
727
|
+
this.longitude = longitude;
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
class EsolveStockLocationPOBoxAddress {
|
|
731
|
+
constructor(pobox, city, postal_code) {
|
|
732
|
+
this.pobox = pobox;
|
|
733
|
+
this.city = city;
|
|
734
|
+
this.postal_code = postal_code;
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
class EsolveStockLocationContactInfo {
|
|
738
|
+
constructor(telnumber, cellnumber, email, fax) {
|
|
739
|
+
this.telnumber = telnumber;
|
|
740
|
+
this.cellnumber = cellnumber;
|
|
741
|
+
this.email = email;
|
|
742
|
+
this.fax = fax;
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
class EsolveStockLocationTradingTimes {
|
|
746
|
+
constructor(monday, tuesday, wednesday, thursday, friday, saturday, sunday, public_holiday, trading_hours_additional_info = '') {
|
|
747
|
+
this.monday = monday;
|
|
748
|
+
this.tuesday = tuesday;
|
|
749
|
+
this.wednesday = wednesday;
|
|
750
|
+
this.thursday = thursday;
|
|
751
|
+
this.friday = friday;
|
|
752
|
+
this.saturday = saturday;
|
|
753
|
+
this.sunday = sunday;
|
|
754
|
+
this.public_holiday = public_holiday;
|
|
755
|
+
this.trading_hours_additional_info = trading_hours_additional_info;
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
class EsolveStockLocationTradingTimesDay {
|
|
759
|
+
constructor(open, close) {
|
|
760
|
+
this.open = open;
|
|
761
|
+
this.close = close;
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
class EsolveTransaction {
|
|
766
|
+
constructor(record) {
|
|
767
|
+
// Transaction Items
|
|
768
|
+
this.items = [];
|
|
769
|
+
this.id = +record.id;
|
|
770
|
+
this.type = record.transaction_type;
|
|
771
|
+
this.status = record.status;
|
|
772
|
+
this.loyalty_number = record.loyaltynumber;
|
|
773
|
+
this.external_order_number = record.external_order_number;
|
|
774
|
+
this.external_invoice_number = record.external_invoice_number;
|
|
775
|
+
this.date = new Date(+record.txdate_timestamp * 1000);
|
|
776
|
+
this.expected_date = new Date(+record.expected_date_timestamp * 1000);
|
|
777
|
+
this.invoice_amount = +record.invoice_amount;
|
|
778
|
+
this.vat = +record.vat;
|
|
779
|
+
this.discount = +record.discount;
|
|
780
|
+
this.total = +record.total;
|
|
781
|
+
this.shipping_total = +record.shipping_total;
|
|
782
|
+
this.insurance_total = +record.insurance_total;
|
|
783
|
+
this.payment = +record.payment;
|
|
784
|
+
this.payment_reference = record.payment_reference;
|
|
785
|
+
this.payment_description = record.payment_description;
|
|
786
|
+
this.gateway_transaction_id = record.gateway_transaction_id;
|
|
787
|
+
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);
|
|
788
|
+
if (record.user) {
|
|
789
|
+
this.user = new EsolveTransactionUser(+record.user.id, record.user.email, record.user.firstname, record.user.surname, record.user.telnumber, record.user.cellnumber);
|
|
790
|
+
}
|
|
791
|
+
if (record.client) {
|
|
792
|
+
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);
|
|
793
|
+
}
|
|
794
|
+
if (record.location_details) {
|
|
795
|
+
this.location = new EsolveTransactionLocation(record.location_details);
|
|
796
|
+
}
|
|
797
|
+
if (record.payment_method_details) {
|
|
798
|
+
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);
|
|
799
|
+
}
|
|
800
|
+
if (record.shipping_method_details) {
|
|
801
|
+
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);
|
|
802
|
+
}
|
|
803
|
+
this.parseTransactionItems(record.transaction_items);
|
|
804
|
+
}
|
|
805
|
+
parseTransactionItems(record_items) {
|
|
806
|
+
for (const record_item of record_items) {
|
|
807
|
+
const price = new EsolveTransactionItemPrice(+record_item.price_exclusive, +record_item.price_inclusive, +record_item.price_exclusive_after_discount, +record_item.price_inclusive_after_discount);
|
|
808
|
+
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);
|
|
809
|
+
const item = new EsolveTransactionItem(record_item.code, record_item.name, +record_item.qty, +record_item.discount, +record_item.vat_rate, price, line_total);
|
|
810
|
+
this.items.push(item);
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
class EsolveTransactionClient {
|
|
815
|
+
constructor(id, account, company_name, branch_code, email, first_name, last_name, contact_number) {
|
|
816
|
+
this.id = id;
|
|
817
|
+
this.account = account;
|
|
818
|
+
this.company_name = company_name;
|
|
819
|
+
this.branch_code = branch_code;
|
|
820
|
+
this.email = email;
|
|
821
|
+
this.first_name = first_name;
|
|
822
|
+
this.last_name = last_name;
|
|
823
|
+
this.contact_number = contact_number;
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
class EsolveTransactionUser {
|
|
827
|
+
constructor(id, email, first_name, last_name, tel_number, cell_number) {
|
|
828
|
+
this.id = id;
|
|
829
|
+
this.email = email;
|
|
830
|
+
this.first_name = first_name;
|
|
831
|
+
this.last_name = last_name;
|
|
832
|
+
this.tel_number = tel_number;
|
|
833
|
+
this.cell_number = cell_number;
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
class EsolveTransactionLocation extends EsolveStockLocation {
|
|
837
|
+
}
|
|
838
|
+
class EsolveTransactionPaymentMethod {
|
|
839
|
+
constructor(id, name, description, integration_type, service_provider) {
|
|
840
|
+
this.id = id;
|
|
841
|
+
this.name = name;
|
|
842
|
+
this.description = description;
|
|
843
|
+
this.integration_type = integration_type;
|
|
844
|
+
this.service_provider = service_provider;
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
class EsolveTransactionShippingMethod {
|
|
848
|
+
constructor(id, name, delivery_category, location, description, pricing, client_to_collect) {
|
|
849
|
+
this.id = id;
|
|
850
|
+
this.name = name;
|
|
851
|
+
this.delivery_category = delivery_category;
|
|
852
|
+
this.location = location;
|
|
853
|
+
this.description = description;
|
|
854
|
+
this.pricing = pricing;
|
|
855
|
+
this.client_to_collect = client_to_collect;
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
class EsolveTransactionAddress {
|
|
859
|
+
constructor(recipient, address_type, address_description, street_number, street, suburb, city, province, country, postal_code, pobox) {
|
|
860
|
+
this.recipient = recipient;
|
|
861
|
+
this.address_type = address_type;
|
|
862
|
+
this.address_description = address_description;
|
|
863
|
+
this.street_number = street_number;
|
|
864
|
+
this.street = street;
|
|
865
|
+
this.suburb = suburb;
|
|
866
|
+
this.city = city;
|
|
867
|
+
this.province = province;
|
|
868
|
+
this.country = country;
|
|
869
|
+
this.postal_code = postal_code;
|
|
870
|
+
this.pobox = pobox;
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
class EsolveTransactionItem {
|
|
874
|
+
constructor(code, name, qty, discount, vat_rate, price, line_total) {
|
|
875
|
+
this.code = code;
|
|
876
|
+
this.name = name;
|
|
877
|
+
this.qty = qty;
|
|
878
|
+
this.discount = discount;
|
|
879
|
+
this.vat_rate = vat_rate;
|
|
880
|
+
this.price = price;
|
|
881
|
+
this.line_total = line_total;
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
class EsolveTransactionItemPrice {
|
|
885
|
+
constructor(
|
|
886
|
+
/**
|
|
887
|
+
* Price without tax
|
|
888
|
+
*/
|
|
889
|
+
price,
|
|
890
|
+
/**
|
|
891
|
+
* Price with tax
|
|
892
|
+
*/
|
|
893
|
+
price_with_tax,
|
|
894
|
+
/**
|
|
895
|
+
* Price without tax and with discounts applied if appilcable
|
|
896
|
+
*/
|
|
897
|
+
price_discounted,
|
|
898
|
+
/**
|
|
899
|
+
* Price with tax and with discounts applied if appilcable
|
|
900
|
+
*/
|
|
901
|
+
price_with_tax_discounted) {
|
|
902
|
+
this.price = price;
|
|
903
|
+
this.price_with_tax = price_with_tax;
|
|
904
|
+
this.price_discounted = price_discounted;
|
|
905
|
+
this.price_with_tax_discounted = price_with_tax_discounted;
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
class EsolveTransactionList extends EsolveList {
|
|
910
|
+
}
|
|
911
|
+
|
|
676
912
|
class EsolveRegistrationResult extends EsolveResponseResult {
|
|
677
913
|
constructor(response) {
|
|
678
914
|
super(response);
|
|
@@ -723,31 +959,6 @@ class EsolveAccountService {
|
|
|
723
959
|
this._user_id = value;
|
|
724
960
|
}
|
|
725
961
|
}
|
|
726
|
-
processUserAccount(record) {
|
|
727
|
-
if (!record) {
|
|
728
|
-
throw new Error('Invalid record');
|
|
729
|
-
}
|
|
730
|
-
if (+record.userid !== this._user_id) {
|
|
731
|
-
throw new Error('Invalid user account retrieved');
|
|
732
|
-
}
|
|
733
|
-
const user_account = new EsolveUserAccount(+record.userid, record.email, record.registration_type, record.title, record.firstname, record.surname, record.initials, record.gender, record.idnumber);
|
|
734
|
-
user_account.contact_details = new EsolveUserAccountContact(record.telnumber, record.cellnumber, record.fax);
|
|
735
|
-
user_account.business_details = new EsolveUserAccountBusiness(record.busname, record.vatnum, record.busdescript, record.business_type);
|
|
736
|
-
return user_account;
|
|
737
|
-
}
|
|
738
|
-
processUserAddress(records) {
|
|
739
|
-
const user_addresses = [];
|
|
740
|
-
if (!records || (this._user_id === 0)) {
|
|
741
|
-
return user_addresses;
|
|
742
|
-
}
|
|
743
|
-
for (const record of records) {
|
|
744
|
-
if (+record.userid !== this._user_id) {
|
|
745
|
-
continue;
|
|
746
|
-
}
|
|
747
|
-
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));
|
|
748
|
-
}
|
|
749
|
-
return user_addresses;
|
|
750
|
-
}
|
|
751
962
|
updateUserAccount(user_account_data) {
|
|
752
963
|
const body = {
|
|
753
964
|
account: user_account_data
|
|
@@ -797,20 +1008,23 @@ class EsolveAccountService {
|
|
|
797
1008
|
}));
|
|
798
1009
|
}
|
|
799
1010
|
getAddresses() {
|
|
800
|
-
|
|
801
|
-
|
|
1011
|
+
try {
|
|
1012
|
+
this.loginGuard();
|
|
1013
|
+
return this.http.get(`${this.config.api_url}/service/get-addresses.php`, {
|
|
1014
|
+
params: {
|
|
1015
|
+
ws_id: this.config.wsid,
|
|
1016
|
+
user_id: this.user_id
|
|
1017
|
+
}
|
|
1018
|
+
}).pipe(map(response => {
|
|
1019
|
+
if (response.records === undefined) {
|
|
1020
|
+
throw response;
|
|
1021
|
+
}
|
|
1022
|
+
return this.processUserAddress(response.records);
|
|
1023
|
+
}));
|
|
1024
|
+
}
|
|
1025
|
+
catch (error) {
|
|
1026
|
+
return throwError(error);
|
|
802
1027
|
}
|
|
803
|
-
return this.http.get(`${this.config.api_url}/service/get-addresses.php`, {
|
|
804
|
-
params: {
|
|
805
|
-
ws_id: this.config.wsid,
|
|
806
|
-
user_id: this.user_id
|
|
807
|
-
}
|
|
808
|
-
}).pipe(map(response => {
|
|
809
|
-
if (response.records === undefined) {
|
|
810
|
-
throw response;
|
|
811
|
-
}
|
|
812
|
-
return this.processUserAddress(response.records);
|
|
813
|
-
}));
|
|
814
1028
|
}
|
|
815
1029
|
deleteAddress(id) {
|
|
816
1030
|
return this.http.delete(`${this.config.api_url}/service/delete-address.php`, {
|
|
@@ -911,8 +1125,93 @@ class EsolveAccountService {
|
|
|
911
1125
|
return this.errorHandler.handleHttpPostError('set-forgot-password', errorRes);
|
|
912
1126
|
}));
|
|
913
1127
|
}
|
|
1128
|
+
getTransactions(options = {}) {
|
|
1129
|
+
try {
|
|
1130
|
+
this.loginGuard();
|
|
1131
|
+
return this.http.get(`${this.config.api_url}/service/get-transactions.php`, {
|
|
1132
|
+
params: {
|
|
1133
|
+
ws_id: this.config.wsid,
|
|
1134
|
+
user_id: this.user_id,
|
|
1135
|
+
...options,
|
|
1136
|
+
}
|
|
1137
|
+
}).pipe(map(response => {
|
|
1138
|
+
if (response.records === undefined) {
|
|
1139
|
+
throw response;
|
|
1140
|
+
}
|
|
1141
|
+
const items = this.processTransactions(response.records);
|
|
1142
|
+
const total = +response.additional_data.total_records ?? 0;
|
|
1143
|
+
const rows = options.rows ?? total;
|
|
1144
|
+
const page = options.page || 1;
|
|
1145
|
+
return new EsolveTransactionList(items, page, rows, total);
|
|
1146
|
+
}));
|
|
1147
|
+
}
|
|
1148
|
+
catch (error) {
|
|
1149
|
+
return throwError(error);
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
getTransaction(id) {
|
|
1153
|
+
try {
|
|
1154
|
+
this.loginGuard();
|
|
1155
|
+
return this.http.get(`${this.config.api_url}/service/get-transactions.php`, {
|
|
1156
|
+
params: {
|
|
1157
|
+
ws_id: this.config.wsid,
|
|
1158
|
+
user_id: this.user_id,
|
|
1159
|
+
transaction_id: id,
|
|
1160
|
+
}
|
|
1161
|
+
}).pipe(map(response => {
|
|
1162
|
+
if ((response.records === undefined) || (response.records.length <= 0)) {
|
|
1163
|
+
throw response;
|
|
1164
|
+
}
|
|
1165
|
+
const items = this.processTransactions(response.records);
|
|
1166
|
+
return items[0];
|
|
1167
|
+
}));
|
|
1168
|
+
}
|
|
1169
|
+
catch (error) {
|
|
1170
|
+
return throwError(error);
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
processUserAccount(record) {
|
|
1174
|
+
if (!record) {
|
|
1175
|
+
throw new Error('Invalid record');
|
|
1176
|
+
}
|
|
1177
|
+
if (+record.userid !== this._user_id) {
|
|
1178
|
+
throw new Error('Invalid user account retrieved');
|
|
1179
|
+
}
|
|
1180
|
+
const user_account = new EsolveUserAccount(+record.userid, record.email, record.registration_type, record.title, record.firstname, record.surname, record.initials, record.gender, record.idnumber);
|
|
1181
|
+
user_account.contact_details = new EsolveUserAccountContact(record.telnumber, record.cellnumber, record.fax);
|
|
1182
|
+
user_account.business_details = new EsolveUserAccountBusiness(record.busname, record.vatnum, record.busdescript, record.business_type);
|
|
1183
|
+
return user_account;
|
|
1184
|
+
}
|
|
1185
|
+
processUserAddress(records) {
|
|
1186
|
+
const user_addresses = [];
|
|
1187
|
+
if (!records || (this._user_id === 0)) {
|
|
1188
|
+
return user_addresses;
|
|
1189
|
+
}
|
|
1190
|
+
for (const record of records) {
|
|
1191
|
+
if (+record.userid !== this._user_id) {
|
|
1192
|
+
continue;
|
|
1193
|
+
}
|
|
1194
|
+
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));
|
|
1195
|
+
}
|
|
1196
|
+
return user_addresses;
|
|
1197
|
+
}
|
|
1198
|
+
processTransactions(records) {
|
|
1199
|
+
const transactions = [];
|
|
1200
|
+
if (records) {
|
|
1201
|
+
for (const record of records) {
|
|
1202
|
+
const transaction = new EsolveTransaction(record);
|
|
1203
|
+
transactions.push(transaction);
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
return transactions;
|
|
1207
|
+
}
|
|
1208
|
+
loginGuard() {
|
|
1209
|
+
if (this.user_id <= 0) {
|
|
1210
|
+
this.errorHandler.emitError('login_required', 'Login is required');
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
914
1213
|
}
|
|
915
|
-
EsolveAccountService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAccountService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$
|
|
1214
|
+
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 });
|
|
916
1215
|
EsolveAccountService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAccountService, providedIn: 'root' });
|
|
917
1216
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAccountService, decorators: [{
|
|
918
1217
|
type: Injectable,
|
|
@@ -922,7 +1221,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
922
1221
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
923
1222
|
type: Inject,
|
|
924
1223
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
925
|
-
}] }, { type: i1$
|
|
1224
|
+
}] }, { type: i1$2.HttpClient }, { type: EsolveSessionService }, { type: EsolveErrorHandlerService }, { type: EsolveResponseHandlerService }]; } });
|
|
926
1225
|
|
|
927
1226
|
class EsolveMediaArticle {
|
|
928
1227
|
constructor(identifier, title, article, image_url = '', tags = [], topics = [], seo_title = '', seo_keywords = '', seo_description = '') {
|
|
@@ -962,29 +1261,6 @@ class EsolveMediaService {
|
|
|
962
1261
|
this.config = config;
|
|
963
1262
|
this.http = http;
|
|
964
1263
|
}
|
|
965
|
-
processMediaRecord(record) {
|
|
966
|
-
const tags = [];
|
|
967
|
-
const topics = [];
|
|
968
|
-
if ((record.tags) && (record.tags.length > 0)) {
|
|
969
|
-
for (const tag of record.tags) {
|
|
970
|
-
tags.push(new EsolveTag(+tag.id, tag.tag_phrase, +tag.tag_weight, tag.description));
|
|
971
|
-
}
|
|
972
|
-
}
|
|
973
|
-
if ((record.topics) && (record.topics.length > 0)) {
|
|
974
|
-
for (const topic of record.topics) {
|
|
975
|
-
topics.push(new EsolveTopic(+topic.id, topic.name, topic.short_description, +topic.sort_priority));
|
|
976
|
-
}
|
|
977
|
-
}
|
|
978
|
-
return new EsolveMediaArticle(record.identifier, record.title, record.article, record.image_url, tags, topics, record.seo_page_title, record.seo_keywords, record.seo_description);
|
|
979
|
-
}
|
|
980
|
-
/**
|
|
981
|
-
* Retrieves media records from eSolve instance.
|
|
982
|
-
* @param params Header params
|
|
983
|
-
*/
|
|
984
|
-
getMediaRecords(params) {
|
|
985
|
-
params = params.set('ws_id', this.config.wsid);
|
|
986
|
-
return this.http.get(`${this.config.api_url}/service/get-media.php`, { params });
|
|
987
|
-
}
|
|
988
1264
|
/**
|
|
989
1265
|
* Retrieves the media record from the eSolve instance using the identifier.
|
|
990
1266
|
* @param identifier String representing the eSolve media indentifier
|
|
@@ -1029,8 +1305,31 @@ class EsolveMediaService {
|
|
|
1029
1305
|
return mediaArticles;
|
|
1030
1306
|
}));
|
|
1031
1307
|
}
|
|
1308
|
+
processMediaRecord(record) {
|
|
1309
|
+
const tags = [];
|
|
1310
|
+
const topics = [];
|
|
1311
|
+
if ((record.tags) && (record.tags.length > 0)) {
|
|
1312
|
+
for (const tag of record.tags) {
|
|
1313
|
+
tags.push(new EsolveTag(+tag.id, tag.tag_phrase, +tag.tag_weight, tag.description));
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
if ((record.topics) && (record.topics.length > 0)) {
|
|
1317
|
+
for (const topic of record.topics) {
|
|
1318
|
+
topics.push(new EsolveTopic(+topic.id, topic.name, topic.short_description, +topic.sort_priority));
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
return new EsolveMediaArticle(record.identifier, record.title, record.article, record.image_url, tags, topics, record.seo_page_title, record.seo_keywords, record.seo_description);
|
|
1322
|
+
}
|
|
1323
|
+
/**
|
|
1324
|
+
* Retrieves media records from eSolve instance.
|
|
1325
|
+
* @param params Header params
|
|
1326
|
+
*/
|
|
1327
|
+
getMediaRecords(params) {
|
|
1328
|
+
params = params.set('ws_id', this.config.wsid);
|
|
1329
|
+
return this.http.get(`${this.config.api_url}/service/get-media.php`, { params });
|
|
1330
|
+
}
|
|
1032
1331
|
}
|
|
1033
|
-
EsolveMediaService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMediaService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$
|
|
1332
|
+
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 });
|
|
1034
1333
|
EsolveMediaService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMediaService, providedIn: 'root' });
|
|
1035
1334
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMediaService, decorators: [{
|
|
1036
1335
|
type: Injectable,
|
|
@@ -1040,7 +1339,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
1040
1339
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1041
1340
|
type: Inject,
|
|
1042
1341
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
1043
|
-
}] }, { type: i1$
|
|
1342
|
+
}] }, { type: i1$2.HttpClient }]; } });
|
|
1044
1343
|
|
|
1045
1344
|
class EsolveNewsGroup {
|
|
1046
1345
|
constructor(id, name, description, sef_name) {
|
|
@@ -1172,7 +1471,7 @@ class EsolveNewsService {
|
|
|
1172
1471
|
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);
|
|
1173
1472
|
}
|
|
1174
1473
|
}
|
|
1175
|
-
EsolveNewsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveNewsService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$
|
|
1474
|
+
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 });
|
|
1176
1475
|
EsolveNewsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveNewsService, providedIn: 'root' });
|
|
1177
1476
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveNewsService, decorators: [{
|
|
1178
1477
|
type: Injectable,
|
|
@@ -1182,7 +1481,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
1182
1481
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1183
1482
|
type: Inject,
|
|
1184
1483
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
1185
|
-
}] }, { type: i1$
|
|
1484
|
+
}] }, { type: i1$2.HttpClient }]; } });
|
|
1186
1485
|
|
|
1187
1486
|
class EsolveBanner {
|
|
1188
1487
|
constructor(id, banner_display_container, identifier, type, title, article, sort_priority, link, images) {
|
|
@@ -1237,6 +1536,31 @@ class EsolveBannerService {
|
|
|
1237
1536
|
this.config = config;
|
|
1238
1537
|
this.http = http;
|
|
1239
1538
|
}
|
|
1539
|
+
/**
|
|
1540
|
+
* Retrieves banners records from eSolve instance
|
|
1541
|
+
*
|
|
1542
|
+
* @returns An observable of eSolve banners.
|
|
1543
|
+
*/
|
|
1544
|
+
getBanners(identifier, banner_display_container, enable_date_filter = false) {
|
|
1545
|
+
let params = new HttpParams({
|
|
1546
|
+
fromObject: {
|
|
1547
|
+
ws_id: this.config.wsid,
|
|
1548
|
+
enable_date_filter
|
|
1549
|
+
}
|
|
1550
|
+
});
|
|
1551
|
+
if (identifier) {
|
|
1552
|
+
params = params.set('identifier', identifier);
|
|
1553
|
+
}
|
|
1554
|
+
if (banner_display_container) {
|
|
1555
|
+
params = params.set('banner_display_container', banner_display_container);
|
|
1556
|
+
}
|
|
1557
|
+
return this.http.get(`${this.config.api_url}/service/get-banners.php`, { params }).pipe(map(response => {
|
|
1558
|
+
if (response.records === undefined) {
|
|
1559
|
+
throw response;
|
|
1560
|
+
}
|
|
1561
|
+
return this.processBanners(response.records);
|
|
1562
|
+
}));
|
|
1563
|
+
}
|
|
1240
1564
|
processBannerImageHotspots(hotspot_records) {
|
|
1241
1565
|
const hotspots = [];
|
|
1242
1566
|
if (hotspot_records.length > 0) {
|
|
@@ -1283,39 +1607,14 @@ class EsolveBannerService {
|
|
|
1283
1607
|
const banner = new EsolveBanner(+record.id, record.banner_display_container, record.identifier, record.type, record.title, record.article, +record.sort_priority, {
|
|
1284
1608
|
url: record.link.url,
|
|
1285
1609
|
target: record.link.target
|
|
1286
|
-
}, image_sets);
|
|
1287
|
-
banners.push(banner);
|
|
1288
|
-
}
|
|
1289
|
-
}
|
|
1290
|
-
return banners;
|
|
1291
|
-
}
|
|
1292
|
-
/**
|
|
1293
|
-
* Retrieves banners records from eSolve instance
|
|
1294
|
-
*
|
|
1295
|
-
* @returns An observable of eSolve banners.
|
|
1296
|
-
*/
|
|
1297
|
-
getBanners(identifier, banner_display_container, enable_date_filter = false) {
|
|
1298
|
-
let params = new HttpParams({
|
|
1299
|
-
fromObject: {
|
|
1300
|
-
ws_id: this.config.wsid,
|
|
1301
|
-
enable_date_filter
|
|
1302
|
-
}
|
|
1303
|
-
});
|
|
1304
|
-
if (identifier) {
|
|
1305
|
-
params = params.set('identifier', identifier);
|
|
1306
|
-
}
|
|
1307
|
-
if (banner_display_container) {
|
|
1308
|
-
params = params.set('banner_display_container', banner_display_container);
|
|
1309
|
-
}
|
|
1310
|
-
return this.http.get(`${this.config.api_url}/service/get-banners.php`, { params }).pipe(map(response => {
|
|
1311
|
-
if (response.records === undefined) {
|
|
1312
|
-
throw response;
|
|
1610
|
+
}, image_sets);
|
|
1611
|
+
banners.push(banner);
|
|
1313
1612
|
}
|
|
1314
|
-
|
|
1315
|
-
|
|
1613
|
+
}
|
|
1614
|
+
return banners;
|
|
1316
1615
|
}
|
|
1317
1616
|
}
|
|
1318
|
-
EsolveBannerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveBannerService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$
|
|
1617
|
+
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 });
|
|
1319
1618
|
EsolveBannerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveBannerService, providedIn: 'root' });
|
|
1320
1619
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveBannerService, decorators: [{
|
|
1321
1620
|
type: Injectable,
|
|
@@ -1325,7 +1624,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
1325
1624
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1326
1625
|
type: Inject,
|
|
1327
1626
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
1328
|
-
}] }, { type: i1$
|
|
1627
|
+
}] }, { type: i1$2.HttpClient }]; } });
|
|
1329
1628
|
|
|
1330
1629
|
class EsolveMenuItem {
|
|
1331
1630
|
constructor(url, name, target, children = []) {
|
|
@@ -1365,7 +1664,7 @@ class EsolveMenuService {
|
|
|
1365
1664
|
return menu;
|
|
1366
1665
|
}
|
|
1367
1666
|
}
|
|
1368
|
-
EsolveMenuService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMenuService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$
|
|
1667
|
+
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 });
|
|
1369
1668
|
EsolveMenuService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMenuService, providedIn: 'root' });
|
|
1370
1669
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMenuService, decorators: [{
|
|
1371
1670
|
type: Injectable,
|
|
@@ -1375,23 +1674,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
1375
1674
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1376
1675
|
type: Inject,
|
|
1377
1676
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
1378
|
-
}] }, { type: i1$
|
|
1677
|
+
}] }, { type: i1$2.HttpClient }]; } });
|
|
1379
1678
|
|
|
1380
1679
|
class EsolveTopicService {
|
|
1381
1680
|
constructor(config, http) {
|
|
1382
1681
|
this.config = config;
|
|
1383
1682
|
this.http = http;
|
|
1384
1683
|
}
|
|
1385
|
-
processTopics(records) {
|
|
1386
|
-
const topics = [];
|
|
1387
|
-
if (records) {
|
|
1388
|
-
for (const record of records) {
|
|
1389
|
-
const topic = new EsolveTopic(+record.id, record.name, record.short_description, +record.sort_priority);
|
|
1390
|
-
topics.push(topic);
|
|
1391
|
-
}
|
|
1392
|
-
}
|
|
1393
|
-
return topics;
|
|
1394
|
-
}
|
|
1395
1684
|
/**
|
|
1396
1685
|
* Retrieves active topics from the list of topic ID's. Note that inactive or expired
|
|
1397
1686
|
* topics will not be retrieved.
|
|
@@ -1414,8 +1703,18 @@ class EsolveTopicService {
|
|
|
1414
1703
|
return this.processTopics(response.records);
|
|
1415
1704
|
}));
|
|
1416
1705
|
}
|
|
1706
|
+
processTopics(records) {
|
|
1707
|
+
const topics = [];
|
|
1708
|
+
if (records) {
|
|
1709
|
+
for (const record of records) {
|
|
1710
|
+
const topic = new EsolveTopic(+record.id, record.name, record.short_description, +record.sort_priority);
|
|
1711
|
+
topics.push(topic);
|
|
1712
|
+
}
|
|
1713
|
+
}
|
|
1714
|
+
return topics;
|
|
1715
|
+
}
|
|
1417
1716
|
}
|
|
1418
|
-
EsolveTopicService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveTopicService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$
|
|
1717
|
+
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 });
|
|
1419
1718
|
EsolveTopicService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveTopicService, providedIn: 'root' });
|
|
1420
1719
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveTopicService, decorators: [{
|
|
1421
1720
|
type: Injectable,
|
|
@@ -1425,7 +1724,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
1425
1724
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1426
1725
|
type: Inject,
|
|
1427
1726
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
1428
|
-
}] }, { type: i1$
|
|
1727
|
+
}] }, { type: i1$2.HttpClient }]; } });
|
|
1429
1728
|
|
|
1430
1729
|
class EsolveStockBadge {
|
|
1431
1730
|
constructor(id, text, identifier, font_colour, badge_colour, sort_priority) {
|
|
@@ -1745,7 +2044,7 @@ class EsolveStockService {
|
|
|
1745
2044
|
}));
|
|
1746
2045
|
}
|
|
1747
2046
|
}
|
|
1748
|
-
EsolveStockService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveStockService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$
|
|
2047
|
+
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 });
|
|
1749
2048
|
EsolveStockService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveStockService, providedIn: 'root' });
|
|
1750
2049
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveStockService, decorators: [{
|
|
1751
2050
|
type: Injectable,
|
|
@@ -1755,7 +2054,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
1755
2054
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1756
2055
|
type: Inject,
|
|
1757
2056
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
1758
|
-
}] }, { type: i1$
|
|
2057
|
+
}] }, { type: i1$2.HttpClient }]; } });
|
|
1759
2058
|
|
|
1760
2059
|
class EsolveCategoryTreeItem {
|
|
1761
2060
|
constructor(type, esolve_id, parent_id, description, sef_description, short_description, sort_priority, active, display_only, image_name, seo_title, seo_keywords, seo_description, children) {
|
|
@@ -1809,50 +2108,6 @@ class EsolveCategoryTreeService {
|
|
|
1809
2108
|
this.config = config;
|
|
1810
2109
|
this.http = http;
|
|
1811
2110
|
}
|
|
1812
|
-
/**
|
|
1813
|
-
* Processes the eSolve tree records and converts them into the correct format.
|
|
1814
|
-
* @param tree_records Records to process
|
|
1815
|
-
*/
|
|
1816
|
-
processTree(tree_records) {
|
|
1817
|
-
const tree_items = [];
|
|
1818
|
-
if (tree_records) {
|
|
1819
|
-
for (const tree_record of tree_records) {
|
|
1820
|
-
let esolve_id = '';
|
|
1821
|
-
let parent_id = '';
|
|
1822
|
-
let children = [];
|
|
1823
|
-
if (tree_record.type === 'category') {
|
|
1824
|
-
children = this.processTree(tree_record.children);
|
|
1825
|
-
esolve_id = tree_record.menu_id;
|
|
1826
|
-
parent_id = tree_record.owner_menu_id;
|
|
1827
|
-
}
|
|
1828
|
-
else {
|
|
1829
|
-
esolve_id = tree_record.id;
|
|
1830
|
-
parent_id = tree_record.menu_id;
|
|
1831
|
-
}
|
|
1832
|
-
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));
|
|
1833
|
-
}
|
|
1834
|
-
}
|
|
1835
|
-
return tree_items;
|
|
1836
|
-
}
|
|
1837
|
-
processTreeItem(record) {
|
|
1838
|
-
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);
|
|
1839
|
-
}
|
|
1840
|
-
processID(id) {
|
|
1841
|
-
let type;
|
|
1842
|
-
let esolve_id;
|
|
1843
|
-
const type_code_regex = /^\<\<(CAT|SUB)\>\>/g;
|
|
1844
|
-
const match_results = id.match(type_code_regex);
|
|
1845
|
-
if (match_results) {
|
|
1846
|
-
const type_code = match_results[0];
|
|
1847
|
-
type = (type_code === '<<CAT>>' ? 'category' : 'subcategory');
|
|
1848
|
-
esolve_id = id.replace(type_code_regex, '');
|
|
1849
|
-
return {
|
|
1850
|
-
type,
|
|
1851
|
-
esolve_id
|
|
1852
|
-
};
|
|
1853
|
-
}
|
|
1854
|
-
return null;
|
|
1855
|
-
}
|
|
1856
2111
|
/**
|
|
1857
2112
|
* Retrieves the category tree from eSolve instance and coverts it to the correct format.
|
|
1858
2113
|
*/
|
|
@@ -1909,8 +2164,52 @@ class EsolveCategoryTreeService {
|
|
|
1909
2164
|
}
|
|
1910
2165
|
return throwError('Invalid options');
|
|
1911
2166
|
}
|
|
2167
|
+
/**
|
|
2168
|
+
* Processes the eSolve tree records and converts them into the correct format.
|
|
2169
|
+
* @param tree_records Records to process
|
|
2170
|
+
*/
|
|
2171
|
+
processTree(tree_records) {
|
|
2172
|
+
const tree_items = [];
|
|
2173
|
+
if (tree_records) {
|
|
2174
|
+
for (const tree_record of tree_records) {
|
|
2175
|
+
let esolve_id = '';
|
|
2176
|
+
let parent_id = '';
|
|
2177
|
+
let children = [];
|
|
2178
|
+
if (tree_record.type === 'category') {
|
|
2179
|
+
children = this.processTree(tree_record.children);
|
|
2180
|
+
esolve_id = tree_record.menu_id;
|
|
2181
|
+
parent_id = tree_record.owner_menu_id;
|
|
2182
|
+
}
|
|
2183
|
+
else {
|
|
2184
|
+
esolve_id = tree_record.id;
|
|
2185
|
+
parent_id = tree_record.menu_id;
|
|
2186
|
+
}
|
|
2187
|
+
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));
|
|
2188
|
+
}
|
|
2189
|
+
}
|
|
2190
|
+
return tree_items;
|
|
2191
|
+
}
|
|
2192
|
+
processTreeItem(record) {
|
|
2193
|
+
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);
|
|
2194
|
+
}
|
|
2195
|
+
processID(id) {
|
|
2196
|
+
let type;
|
|
2197
|
+
let esolve_id;
|
|
2198
|
+
const type_code_regex = /^\<\<(CAT|SUB)\>\>/g;
|
|
2199
|
+
const match_results = id.match(type_code_regex);
|
|
2200
|
+
if (match_results) {
|
|
2201
|
+
const type_code = match_results[0];
|
|
2202
|
+
type = (type_code === '<<CAT>>' ? 'category' : 'subcategory');
|
|
2203
|
+
esolve_id = id.replace(type_code_regex, '');
|
|
2204
|
+
return {
|
|
2205
|
+
type,
|
|
2206
|
+
esolve_id
|
|
2207
|
+
};
|
|
2208
|
+
}
|
|
2209
|
+
return null;
|
|
2210
|
+
}
|
|
1912
2211
|
}
|
|
1913
|
-
EsolveCategoryTreeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCategoryTreeService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$
|
|
2212
|
+
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 });
|
|
1914
2213
|
EsolveCategoryTreeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCategoryTreeService, providedIn: 'root' });
|
|
1915
2214
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCategoryTreeService, decorators: [{
|
|
1916
2215
|
type: Injectable,
|
|
@@ -1920,7 +2219,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
1920
2219
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1921
2220
|
type: Inject,
|
|
1922
2221
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
1923
|
-
}] }, { type: i1$
|
|
2222
|
+
}] }, { type: i1$2.HttpClient }]; } });
|
|
1924
2223
|
|
|
1925
2224
|
class EsolveCheckoutResult extends EsolveResponseResult {
|
|
1926
2225
|
constructor(response) {
|
|
@@ -2044,30 +2343,6 @@ class EsolveCartService {
|
|
|
2044
2343
|
this.responseHandler = responseHandler;
|
|
2045
2344
|
this._cached_tracking = 0;
|
|
2046
2345
|
}
|
|
2047
|
-
/**
|
|
2048
|
-
* Processes the eSolve tree records.
|
|
2049
|
-
* @param cart_item_records Records to process
|
|
2050
|
-
* @returns An array of processed cart items
|
|
2051
|
-
*/
|
|
2052
|
-
processCart(cart_item_records) {
|
|
2053
|
-
const cart_items = [];
|
|
2054
|
-
if (cart_item_records) {
|
|
2055
|
-
for (const cart_item_record of cart_item_records) {
|
|
2056
|
-
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);
|
|
2057
|
-
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));
|
|
2058
|
-
}
|
|
2059
|
-
}
|
|
2060
|
-
return cart_items;
|
|
2061
|
-
}
|
|
2062
|
-
/**
|
|
2063
|
-
* Processes the eSolve cart totals
|
|
2064
|
-
* @param record Data to process
|
|
2065
|
-
* @returns Processed cart totals
|
|
2066
|
-
*/
|
|
2067
|
-
processCartTotals(record) {
|
|
2068
|
-
const cart_totals = new EsolveCartTotals(+record.records, +record.items, +record.total, +record.vat, +record.discount);
|
|
2069
|
-
return cart_totals;
|
|
2070
|
-
}
|
|
2071
2346
|
/**
|
|
2072
2347
|
* Retrieves the current cart
|
|
2073
2348
|
* @returns An `Observable` with an array of cart items
|
|
@@ -2186,8 +2461,32 @@ class EsolveCartService {
|
|
|
2186
2461
|
}));
|
|
2187
2462
|
}));
|
|
2188
2463
|
}
|
|
2464
|
+
/**
|
|
2465
|
+
* Processes the eSolve tree records.
|
|
2466
|
+
* @param cart_item_records Records to process
|
|
2467
|
+
* @returns An array of processed cart items
|
|
2468
|
+
*/
|
|
2469
|
+
processCart(cart_item_records) {
|
|
2470
|
+
const cart_items = [];
|
|
2471
|
+
if (cart_item_records) {
|
|
2472
|
+
for (const cart_item_record of cart_item_records) {
|
|
2473
|
+
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);
|
|
2474
|
+
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));
|
|
2475
|
+
}
|
|
2476
|
+
}
|
|
2477
|
+
return cart_items;
|
|
2478
|
+
}
|
|
2479
|
+
/**
|
|
2480
|
+
* Processes the eSolve cart totals
|
|
2481
|
+
* @param record Data to process
|
|
2482
|
+
* @returns Processed cart totals
|
|
2483
|
+
*/
|
|
2484
|
+
processCartTotals(record) {
|
|
2485
|
+
const cart_totals = new EsolveCartTotals(+record.records, +record.items, +record.total, +record.vat, +record.discount);
|
|
2486
|
+
return cart_totals;
|
|
2487
|
+
}
|
|
2189
2488
|
}
|
|
2190
|
-
EsolveCartService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCartService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$
|
|
2489
|
+
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 });
|
|
2191
2490
|
EsolveCartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCartService, providedIn: 'root' });
|
|
2192
2491
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCartService, decorators: [{
|
|
2193
2492
|
type: Injectable,
|
|
@@ -2197,7 +2496,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
2197
2496
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
2198
2497
|
type: Inject,
|
|
2199
2498
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
2200
|
-
}] }, { type: i1$
|
|
2499
|
+
}] }, { type: i1$2.HttpClient }, { type: EsolveErrorHandlerService }, { type: EsolveResponseHandlerService }]; } });
|
|
2201
2500
|
|
|
2202
2501
|
class EsolveVaultItemResult extends EsolveResponseResult {
|
|
2203
2502
|
constructor(response) {
|
|
@@ -2267,12 +2566,8 @@ class EsolvePaymentMethod {
|
|
|
2267
2566
|
this.description = record.description;
|
|
2268
2567
|
this.display_banking_details = record.display_banking_details;
|
|
2269
2568
|
this.currency_code = record.currency_code;
|
|
2270
|
-
this.terminal_id = record.terminal_id;
|
|
2271
|
-
this.terminal_id_secondary = record.terminal_id_secondary;
|
|
2272
2569
|
this.merchant_id = record.merchant_id;
|
|
2273
2570
|
this.application_id = record.application_id;
|
|
2274
|
-
this.api_username = record.api_username;
|
|
2275
|
-
this.api_password = record.api_password;
|
|
2276
2571
|
this.api_signature = record.api_signature;
|
|
2277
2572
|
this.is_gateway = record.is_gateway;
|
|
2278
2573
|
this.must_store_card_details = record.must_store_card_details;
|
|
@@ -2481,7 +2776,7 @@ class EsolvePaymentService {
|
|
|
2481
2776
|
}));
|
|
2482
2777
|
}
|
|
2483
2778
|
}
|
|
2484
|
-
EsolvePaymentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolvePaymentService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$
|
|
2779
|
+
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 });
|
|
2485
2780
|
EsolvePaymentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolvePaymentService, providedIn: 'root' });
|
|
2486
2781
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolvePaymentService, decorators: [{
|
|
2487
2782
|
type: Injectable,
|
|
@@ -2491,7 +2786,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
2491
2786
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
2492
2787
|
type: Inject,
|
|
2493
2788
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
2494
|
-
}] }, { type: i1$
|
|
2789
|
+
}] }, { type: i1$2.HttpClient }, { type: EsolveErrorHandlerService }, { type: EsolveResponseHandlerService }]; } });
|
|
2495
2790
|
|
|
2496
2791
|
class EsolveShippingMethod {
|
|
2497
2792
|
constructor(id, carrier_name, delivery_category, description, location, pricing, link_to_carrier_website, days_to_deliver, shipping_cost_calculation_method, insurance_cost_calculation_method, insurance_cost_percentage, metric_factor, allow_immediate_payment_processing, allow_postal_address, allow_physical_address, client_to_collect, is_default, location_id, use_zones, min_distance, max_distance, shipping_surge_condition, shipping_surge_percentage, sort_priority, shipping_group, shipping_slot_identifier, shipping_slot_delay_hours, image_url) {
|
|
@@ -2631,7 +2926,7 @@ class EsolveShippingService {
|
|
|
2631
2926
|
}
|
|
2632
2927
|
}
|
|
2633
2928
|
}
|
|
2634
|
-
EsolveShippingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveShippingService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$
|
|
2929
|
+
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 });
|
|
2635
2930
|
EsolveShippingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveShippingService, providedIn: 'root' });
|
|
2636
2931
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveShippingService, decorators: [{
|
|
2637
2932
|
type: Injectable,
|
|
@@ -2641,103 +2936,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
2641
2936
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
2642
2937
|
type: Inject,
|
|
2643
2938
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
2644
|
-
}] }, { type: i1$
|
|
2645
|
-
|
|
2646
|
-
class EsolveStockLocation {
|
|
2647
|
-
constructor(record) {
|
|
2648
|
-
this.id = +record.id;
|
|
2649
|
-
this.identifier = record.identifier;
|
|
2650
|
-
this.description = record.description;
|
|
2651
|
-
this.head_office = record.head_office;
|
|
2652
|
-
this.erp_identifier = record.erp_identifier;
|
|
2653
|
-
this.external_system_code = record.external_system_code;
|
|
2654
|
-
this.default_location_for_payment_methods = record.default_location_for_payment_methods;
|
|
2655
|
-
this.userid = +record.userid;
|
|
2656
|
-
this.importance = +record.importance;
|
|
2657
|
-
this.active = record.is_active;
|
|
2658
|
-
this.website_url = record.website_url;
|
|
2659
|
-
this.address = new EsolveStockLocationAddress(record.street, record.suburb, record.city, record.province, record.country, record.postal_code, +record.latitude, +record.longitude);
|
|
2660
|
-
this.pobox_address = new EsolveStockLocationPOBoxAddress(record.pobox, record.pobox_city, record.pobox_postal_code);
|
|
2661
|
-
const telnumbers = [];
|
|
2662
|
-
if (record.branch_telnumber.length > 0) {
|
|
2663
|
-
telnumbers.push(record.branch_telnumber);
|
|
2664
|
-
}
|
|
2665
|
-
if (record.branch_telnumber_2.length > 0) {
|
|
2666
|
-
telnumbers.push(record.branch_telnumber_2);
|
|
2667
|
-
}
|
|
2668
|
-
if (record.branch_telnumber_3.length > 0) {
|
|
2669
|
-
telnumbers.push(record.branch_telnumber_3);
|
|
2670
|
-
}
|
|
2671
|
-
this.contact_info = new EsolveStockLocationContactInfo(telnumbers, record.branch_cellnumber, record.branch_email, record.branch_fax);
|
|
2672
|
-
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);
|
|
2673
|
-
}
|
|
2674
|
-
}
|
|
2675
|
-
class EsolveStockLocationAddress {
|
|
2676
|
-
constructor(street, suburb, city, province, country, postal_code, latitude, longitude) {
|
|
2677
|
-
this.street = street;
|
|
2678
|
-
this.suburb = suburb;
|
|
2679
|
-
this.city = city;
|
|
2680
|
-
this.province = province;
|
|
2681
|
-
this.country = country;
|
|
2682
|
-
this.postal_code = postal_code;
|
|
2683
|
-
this.latitude = latitude;
|
|
2684
|
-
this.longitude = longitude;
|
|
2685
|
-
}
|
|
2686
|
-
}
|
|
2687
|
-
class EsolveStockLocationPOBoxAddress {
|
|
2688
|
-
constructor(pobox, city, postal_code) {
|
|
2689
|
-
this.pobox = pobox;
|
|
2690
|
-
this.city = city;
|
|
2691
|
-
this.postal_code = postal_code;
|
|
2692
|
-
}
|
|
2693
|
-
}
|
|
2694
|
-
class EsolveStockLocationContactInfo {
|
|
2695
|
-
constructor(telnumber, cellnumber, email, fax) {
|
|
2696
|
-
this.telnumber = telnumber;
|
|
2697
|
-
this.cellnumber = cellnumber;
|
|
2698
|
-
this.email = email;
|
|
2699
|
-
this.fax = fax;
|
|
2700
|
-
}
|
|
2701
|
-
}
|
|
2702
|
-
class EsolveStockLocationTradingTimes {
|
|
2703
|
-
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 = '') {
|
|
2704
|
-
this.trading_hours_additional_info = trading_hours_additional_info;
|
|
2705
|
-
this.monday = new EsolveStockLocationTradingTimesDay(monday_open_time, monday_close_time);
|
|
2706
|
-
this.tuesday = new EsolveStockLocationTradingTimesDay(tuesday_open_time, tuesday_close_time);
|
|
2707
|
-
this.wednesday = new EsolveStockLocationTradingTimesDay(wednesday_open_time, wednesday_close_time);
|
|
2708
|
-
this.thursday = new EsolveStockLocationTradingTimesDay(thursday_open_time, thursday_close_time);
|
|
2709
|
-
this.friday = new EsolveStockLocationTradingTimesDay(friday_open_time, friday_close_time);
|
|
2710
|
-
this.saturday = new EsolveStockLocationTradingTimesDay(saturday_open_time, saturday_close_time);
|
|
2711
|
-
this.sunday = new EsolveStockLocationTradingTimesDay(sunday_open_time, sunday_close_time);
|
|
2712
|
-
this.public_holiday = new EsolveStockLocationTradingTimesDay(public_holiday_open_time, public_holiday_close_time);
|
|
2713
|
-
}
|
|
2714
|
-
}
|
|
2715
|
-
class EsolveStockLocationTradingTimesDay {
|
|
2716
|
-
constructor(open, close) {
|
|
2717
|
-
this.open = open;
|
|
2718
|
-
this.close = close;
|
|
2719
|
-
}
|
|
2720
|
-
}
|
|
2939
|
+
}] }, { type: i1$2.HttpClient }]; } });
|
|
2721
2940
|
|
|
2722
2941
|
class EsolveLocationsService {
|
|
2723
2942
|
constructor(config, http) {
|
|
2724
2943
|
this.config = config;
|
|
2725
2944
|
this.http = http;
|
|
2726
2945
|
}
|
|
2727
|
-
/**
|
|
2728
|
-
* Processes the eSolve stock location records.
|
|
2729
|
-
* @param records Records to process
|
|
2730
|
-
* @returns An array of processed stock location records
|
|
2731
|
-
*/
|
|
2732
|
-
processStockLocations(records) {
|
|
2733
|
-
const stock_locations = [];
|
|
2734
|
-
if (records) {
|
|
2735
|
-
for (const record of records) {
|
|
2736
|
-
stock_locations.push(new EsolveStockLocation(record));
|
|
2737
|
-
}
|
|
2738
|
-
}
|
|
2739
|
-
return stock_locations;
|
|
2740
|
-
}
|
|
2741
2946
|
/**
|
|
2742
2947
|
* Retrieves a list of stock locations
|
|
2743
2948
|
* @returns An `Observable` with an array of stock locations
|
|
@@ -2752,8 +2957,22 @@ class EsolveLocationsService {
|
|
|
2752
2957
|
return this.processStockLocations(response.records);
|
|
2753
2958
|
}));
|
|
2754
2959
|
}
|
|
2960
|
+
/**
|
|
2961
|
+
* Processes the eSolve stock location records.
|
|
2962
|
+
* @param records Records to process
|
|
2963
|
+
* @returns An array of processed stock location records
|
|
2964
|
+
*/
|
|
2965
|
+
processStockLocations(records) {
|
|
2966
|
+
const stock_locations = [];
|
|
2967
|
+
if (records) {
|
|
2968
|
+
for (const record of records) {
|
|
2969
|
+
stock_locations.push(new EsolveStockLocation(record));
|
|
2970
|
+
}
|
|
2971
|
+
}
|
|
2972
|
+
return stock_locations;
|
|
2973
|
+
}
|
|
2755
2974
|
}
|
|
2756
|
-
EsolveLocationsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveLocationsService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$
|
|
2975
|
+
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 });
|
|
2757
2976
|
EsolveLocationsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveLocationsService, providedIn: 'root' });
|
|
2758
2977
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveLocationsService, decorators: [{
|
|
2759
2978
|
type: Injectable,
|
|
@@ -2763,7 +2982,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
2763
2982
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
2764
2983
|
type: Inject,
|
|
2765
2984
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
2766
|
-
}] }, { type: i1$
|
|
2985
|
+
}] }, { type: i1$2.HttpClient }]; } });
|
|
2767
2986
|
|
|
2768
2987
|
/*
|
|
2769
2988
|
* Public API Surface of ng-esolve-connect
|
|
@@ -2773,5 +2992,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
2773
2992
|
* Generated bundle index. Do not edit.
|
|
2774
2993
|
*/
|
|
2775
2994
|
|
|
2776
|
-
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 };
|
|
2995
|
+
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 };
|
|
2777
2996
|
//# sourceMappingURL=esolve-ng-esolve-connect.mjs.map
|