@esolve/ng-esolve-connect 0.10.2 → 0.11.0

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.
Files changed (50) hide show
  1. package/esm2020/lib/account/esolve-account.service.mjs +52 -61
  2. package/esm2020/lib/auth/esolve-auth-interceptor.service.mjs +7 -6
  3. package/esm2020/lib/auth/esolve-auth.service.mjs +36 -37
  4. package/esm2020/lib/banners/esolve-banner.service.mjs +9 -10
  5. package/esm2020/lib/cart/esolve-cart.service.mjs +30 -31
  6. package/esm2020/lib/category-tree/esolve-category-tree.service.mjs +20 -15
  7. package/esm2020/lib/locations/esolve-locations.service.mjs +10 -9
  8. package/esm2020/lib/media/esolve-heading-record.mjs +2 -0
  9. package/esm2020/lib/media/esolve-heading.mjs +7 -0
  10. package/esm2020/lib/media/esolve-media.service.mjs +58 -23
  11. package/esm2020/lib/menu/esolve-menu.service.mjs +8 -10
  12. package/esm2020/lib/news/esolve-news.service.mjs +14 -18
  13. package/esm2020/lib/ng-esolve-connect.module.mjs +4 -4
  14. package/esm2020/lib/payment/esolve-payment.service.mjs +65 -76
  15. package/esm2020/lib/session/esolve-session.mjs +8 -11
  16. package/esm2020/lib/session/esolve-session.service.mjs +42 -30
  17. package/esm2020/lib/session/esolve-stored-session.mjs +1 -1
  18. package/esm2020/lib/shared/cookie/esolve-cookie.service.mjs +106 -0
  19. package/esm2020/lib/shared/error-handler/esolve-error-handler.service.mjs +3 -3
  20. package/esm2020/lib/shared/response-handler/esolve-response-handler.service.mjs +3 -3
  21. package/esm2020/lib/shared/seo/esolve-seo.service.mjs +4 -4
  22. package/esm2020/lib/shipping/esolve-shipping.service.mjs +39 -39
  23. package/esm2020/lib/stock/esolve-stock-item.mjs +6 -1
  24. package/esm2020/lib/stock/esolve-stock-record.mjs +1 -1
  25. package/esm2020/lib/stock/esolve-stock.service.mjs +38 -39
  26. package/esm2020/lib/topics/esolve-topic.service.mjs +6 -10
  27. package/esm2020/public-api.mjs +3 -1
  28. package/fesm2015/esolve-ng-esolve-connect.mjs +570 -436
  29. package/fesm2015/esolve-ng-esolve-connect.mjs.map +1 -1
  30. package/fesm2020/esolve-ng-esolve-connect.mjs +566 -436
  31. package/fesm2020/esolve-ng-esolve-connect.mjs.map +1 -1
  32. package/lib/auth/esolve-auth.service.d.ts +2 -2
  33. package/lib/cart/esolve-cart.service.d.ts +8 -1
  34. package/lib/category-tree/esolve-category-tree.service.d.ts +4 -1
  35. package/lib/locations/esolve-locations.service.d.ts +2 -0
  36. package/lib/media/esolve-heading-record.d.ts +5 -0
  37. package/lib/media/esolve-heading.d.ts +5 -0
  38. package/lib/media/esolve-media.service.d.ts +25 -4
  39. package/lib/news/esolve-news.service.d.ts +1 -1
  40. package/lib/payment/esolve-payment.service.d.ts +16 -14
  41. package/lib/session/esolve-session.d.ts +3 -4
  42. package/lib/session/esolve-session.service.d.ts +7 -3
  43. package/lib/session/esolve-stored-session.d.ts +2 -2
  44. package/lib/shared/cookie/esolve-cookie.service.d.ts +36 -0
  45. package/lib/shipping/esolve-shipping.service.d.ts +11 -11
  46. package/lib/stock/esolve-stock-item.d.ts +8 -0
  47. package/lib/stock/esolve-stock-record.d.ts +1 -0
  48. package/lib/stock/esolve-stock.service.d.ts +10 -10
  49. package/package.json +5 -4
  50. package/public-api.d.ts +2 -0
@@ -1,12 +1,12 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, Injectable, Inject, NgModule } from '@angular/core';
3
- import { CommonModule } from '@angular/common';
4
- import * as i1$1 from '@angular/common/http';
2
+ import { InjectionToken, PLATFORM_ID, Injectable, Inject, Optional, NgModule } from '@angular/core';
3
+ import { isPlatformBrowser, CommonModule } from '@angular/common';
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 i4 from 'ngx-cookie-service';
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';
9
+ import * as i1$1 from '@angular/platform-browser';
10
10
  import { tap, catchError, map, switchMap } from 'rxjs/operators';
11
11
 
12
12
  const ESOLVE_CONNECT_CONFIG = new InjectionToken('esolve.connect.config');
@@ -19,25 +19,22 @@ const ESOLVE_CONNECT_CONFIG = new InjectionToken('esolve.connect.config');
19
19
  // };
20
20
 
21
21
  class EsolveSession {
22
- constructor(id = -1, _key = '', _key_expiration_date) {
22
+ constructor(id = -1, key = '', expiration_date) {
23
23
  this.id = id;
24
- this._key = _key;
25
- this._key_expiration_date = _key_expiration_date;
26
- }
27
- get key() {
28
- return this._key;
24
+ this.key = key;
25
+ this.expiration_date = expiration_date;
29
26
  }
30
27
  get expired() {
31
28
  const current_date = new Date();
32
- return ((this._key_expiration_date === undefined) ||
33
- (current_date >= this._key_expiration_date));
29
+ return ((this.expiration_date === undefined) ||
30
+ (current_date >= this.expiration_date));
34
31
  }
35
32
  get authenticated() {
36
33
  return (this.id > 0);
37
34
  }
38
35
  get valid() {
39
- return ((this._key !== '') &&
40
- (this._key_expiration_date !== undefined) &&
36
+ return ((this.key !== '') &&
37
+ (this.expiration_date !== undefined) &&
41
38
  (this.id >= 0));
42
39
  }
43
40
  updateUser(user_id) {
@@ -45,13 +42,119 @@ class EsolveSession {
45
42
  }
46
43
  }
47
44
 
45
+ class EsolveCookieService {
46
+ constructor(ngxCookies, platformId, request, response) {
47
+ this.ngxCookies = ngxCookies;
48
+ this.platformId = platformId;
49
+ this.request = request;
50
+ this.response = response;
51
+ this.is_browser = isPlatformBrowser(this.platformId);
52
+ }
53
+ check(name) {
54
+ if (this.is_browser) {
55
+ return this.ngxCookies.check(name);
56
+ }
57
+ const server_cookies = this.request.headers.cookie;
58
+ if (!server_cookies) {
59
+ return false;
60
+ }
61
+ name = encodeURIComponent(name);
62
+ const regExp = this.getCookieRegExp(name);
63
+ return regExp.test(server_cookies);
64
+ }
65
+ get(name) {
66
+ if (this.is_browser) {
67
+ return this.ngxCookies.get(name);
68
+ }
69
+ if (!this.check(name)) {
70
+ return '';
71
+ }
72
+ const server_cookies = this.request.headers.cookie ?? '';
73
+ const regExp = this.getCookieRegExp(name);
74
+ const result = regExp.exec(server_cookies);
75
+ return result && result[1] ? this.safeDecodeURIComponent(result[1]) : '';
76
+ }
77
+ set(name, value, expires, path, domain, secure) {
78
+ if (this.is_browser) {
79
+ this.ngxCookies.set(name, value, expires, path, domain, secure);
80
+ return;
81
+ }
82
+ this.response.cookie(name, value, { domain, path, expires, secure });
83
+ }
84
+ delete(name, path, domain, secure) {
85
+ if (this.is_browser) {
86
+ this.ngxCookies.delete(name, path, domain, secure);
87
+ return;
88
+ }
89
+ this.response.clearCookie(name, { path, domain, secure });
90
+ }
91
+ /*
92
+ * Following functions come from ngx-cookie-service project since they are primarily the same
93
+ */
94
+ /**
95
+ * Get cookie Regular Expression
96
+ *
97
+ * @param name Cookie name
98
+ * @returns property RegExp
99
+ *
100
+ * @link https://github.com/stevermeister/ngx-cookie-service/blob/bcb6ac203487c487fcd126896bffaa14981c709c/projects/ngx-cookie-service/src/lib/cookie.service.ts#L31
101
+ */
102
+ getCookieRegExp(name) {
103
+ const escapedName = name.replace(/([\[\]\{\}\(\)\|\=\;\+\?\,\.\*\^\$])/gi, '\\$1');
104
+ return new RegExp('(?:^' + escapedName + '|;\\s*' + escapedName + ')=(.*?)(?:;|$)', 'g');
105
+ }
106
+ /**
107
+ * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI).
108
+ *
109
+ * @param encodedURIComponent A value representing an encoded URI component.
110
+ *
111
+ * @returns The unencoded version of an encoded component of a Uniform Resource Identifier (URI).
112
+ *
113
+ * @link https://github.com/stevermeister/ngx-cookie-service/blob/bcb6ac203487c487fcd126896bffaa14981c709c/projects/ngx-cookie-service/src/lib/cookie.service.ts#L47
114
+ */
115
+ safeDecodeURIComponent(encodedURIComponent) {
116
+ try {
117
+ return decodeURIComponent(encodedURIComponent);
118
+ }
119
+ catch {
120
+ // probably it is not uri encoded. return as is
121
+ return encodedURIComponent;
122
+ }
123
+ }
124
+ }
125
+ EsolveCookieService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveCookieService, deps: [{ token: i1.CookieService }, { token: PLATFORM_ID }, { token: 'REQUEST', optional: true }, { token: 'RESPONSE', optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
126
+ EsolveCookieService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveCookieService, providedIn: 'root' });
127
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveCookieService, decorators: [{
128
+ type: Injectable,
129
+ args: [{
130
+ providedIn: 'root',
131
+ }]
132
+ }], ctorParameters: function () { return [{ type: i1.CookieService }, { type: Object, decorators: [{
133
+ type: Inject,
134
+ args: [PLATFORM_ID]
135
+ }] }, { type: undefined, decorators: [{
136
+ type: Optional
137
+ }, {
138
+ type: Inject,
139
+ args: ['REQUEST']
140
+ }] }, { type: undefined, decorators: [{
141
+ type: Optional
142
+ }, {
143
+ type: Inject,
144
+ args: ['RESPONSE']
145
+ }] }]; } });
146
+
147
+ // TODO: Rewrite session manager to use a pure rxjs solution.
48
148
  class EsolveSessionService {
49
- constructor(config) {
149
+ constructor(platformId, config, cookieService) {
150
+ this.platformId = platformId;
50
151
  this.config = config;
152
+ this.cookieService = cookieService;
51
153
  this.storage_key = 'ngEslvUserSession';
52
154
  this.setStorageKey();
53
- this._session = new BehaviorSubject(new EsolveSession(0, ''));
155
+ this._session = new BehaviorSubject(new EsolveSession());
54
156
  this.session = this._session.asObservable();
157
+ this.is_browser = isPlatformBrowser(this.platformId);
55
158
  }
56
159
  get currentSession() {
57
160
  return this._session.value;
@@ -63,7 +166,9 @@ class EsolveSessionService {
63
166
  }
64
167
  }
65
168
  startTimer(callback, duration) {
66
- this.key_expiration_timer = setTimeout(callback, duration);
169
+ if (this.is_browser) {
170
+ this.key_expiration_timer = setTimeout(callback, duration);
171
+ }
67
172
  }
68
173
  clearTimer() {
69
174
  if (this.key_expiration_timer) {
@@ -71,53 +176,57 @@ class EsolveSessionService {
71
176
  }
72
177
  }
73
178
  restore(expirationCallback, invalidSessionCallback) {
74
- if (!this.currentSession.valid) {
75
- const stored_session_json = localStorage.getItem(this.storage_key);
76
- const stored_session = (stored_session_json ? JSON.parse(stored_session_json) : null);
77
- if (!stored_session) {
78
- invalidSessionCallback();
79
- return;
80
- }
81
- const expiration_date = new Date(stored_session._key_expiration_date);
82
- const loaded_session = new EsolveSession(stored_session.id, stored_session._key, expiration_date);
83
- if (!loaded_session.expired) {
84
- this._session.next(loaded_session);
85
- const expiration_duration = expiration_date.getTime() - new Date().getTime();
86
- this.startTimer(expirationCallback, expiration_duration);
87
- }
88
- else {
89
- expirationCallback(loaded_session);
90
- }
179
+ if (this.currentSession.valid) {
180
+ return;
181
+ }
182
+ const stored_session_json = this.cookieService.get(this.storage_key);
183
+ const stored_session = (stored_session_json ? JSON.parse(stored_session_json) : null);
184
+ if (!stored_session) {
185
+ invalidSessionCallback();
186
+ return;
187
+ }
188
+ const expiration_date = new Date(stored_session.expiration_date);
189
+ const loaded_session = new EsolveSession(stored_session.id, stored_session.key, expiration_date);
190
+ if (!loaded_session.expired) {
191
+ this._session.next(loaded_session);
192
+ const expiration_duration = expiration_date.getTime() - new Date().getTime();
193
+ this.startTimer(expirationCallback, expiration_duration);
194
+ }
195
+ else {
196
+ expirationCallback(loaded_session);
91
197
  }
92
198
  }
93
199
  handleSession(user_id, key, expiry_time, expires, expirationCallback) {
94
200
  const expiration_date = new Date(expiry_time * 1000);
95
201
  const session = new EsolveSession(user_id, key, expiration_date);
96
- localStorage.setItem(this.storage_key, JSON.stringify(session));
202
+ this.cookieService.set(this.storage_key, JSON.stringify(session), expiration_date, '/');
97
203
  this._session.next(session);
98
204
  this.startTimer(expirationCallback, expires * 1000);
99
205
  }
100
206
  handleUpdateSession(user_id, callback) {
101
207
  const current_session = this.currentSession;
102
208
  current_session.updateUser(user_id);
103
- localStorage.setItem(this.storage_key, JSON.stringify(current_session));
209
+ this.cookieService.set(this.storage_key, JSON.stringify(current_session), current_session.expiration_date, '/');
104
210
  this._session.next(current_session);
105
211
  if (typeof callback === 'function') {
106
212
  callback();
107
213
  }
108
214
  }
109
215
  }
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 });
111
- EsolveSessionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveSessionService, providedIn: 'root' });
112
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveSessionService, decorators: [{
216
+ EsolveSessionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveSessionService, deps: [{ token: PLATFORM_ID }, { token: ESOLVE_CONNECT_CONFIG }, { token: EsolveCookieService }], target: i0.ɵɵFactoryTarget.Injectable });
217
+ EsolveSessionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveSessionService, providedIn: 'root' });
218
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveSessionService, decorators: [{
113
219
  type: Injectable,
114
220
  args: [{
115
- providedIn: 'root'
221
+ providedIn: 'root',
116
222
  }]
117
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
223
+ }], ctorParameters: function () { return [{ type: Object, decorators: [{
224
+ type: Inject,
225
+ args: [PLATFORM_ID]
226
+ }] }, { type: undefined, decorators: [{
118
227
  type: Inject,
119
228
  args: [ESOLVE_CONNECT_CONFIG]
120
- }] }]; } });
229
+ }] }, { type: EsolveCookieService }]; } });
121
230
 
122
231
  class EsolveAuthInterceptorService {
123
232
  constructor(config, session) {
@@ -125,8 +234,8 @@ class EsolveAuthInterceptorService {
125
234
  this.session = session;
126
235
  }
127
236
  intercept(req, next) {
128
- if (req.url.startsWith(`${this.config.api_url}/service/`)) {
129
- const service_identifier = req.url.replace(`${this.config.api_url}/service/`, '');
237
+ if (req.url.startsWith(`${this.config.api_url}/`)) {
238
+ const service_identifier = req.url.replace(`${this.config.api_url}/`, '');
130
239
  const old_params_keys = req.params.keys();
131
240
  const modified_url = req.url;
132
241
  let params = new HttpParams();
@@ -136,6 +245,7 @@ class EsolveAuthInterceptorService {
136
245
  params = params.set('key', session.key);
137
246
  }
138
247
  }
248
+ params = params.set('ws_id', this.config.wsid);
139
249
  old_params_keys.forEach(key => {
140
250
  params = params.set(key, req.params.get(key) || '');
141
251
  });
@@ -148,9 +258,9 @@ class EsolveAuthInterceptorService {
148
258
  return next.handle(req);
149
259
  }
150
260
  }
151
- EsolveAuthInterceptorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAuthInterceptorService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: EsolveSessionService }], target: i0.ɵɵFactoryTarget.Injectable });
152
- EsolveAuthInterceptorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAuthInterceptorService });
153
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAuthInterceptorService, decorators: [{
261
+ EsolveAuthInterceptorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveAuthInterceptorService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: EsolveSessionService }], target: i0.ɵɵFactoryTarget.Injectable });
262
+ EsolveAuthInterceptorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveAuthInterceptorService });
263
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveAuthInterceptorService, decorators: [{
154
264
  type: Injectable
155
265
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
156
266
  type: Inject,
@@ -175,14 +285,14 @@ class NgEsolveConnectModule {
175
285
  };
176
286
  }
177
287
  }
178
- NgEsolveConnectModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: NgEsolveConnectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
179
- NgEsolveConnectModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: NgEsolveConnectModule, imports: [CommonModule,
288
+ NgEsolveConnectModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: NgEsolveConnectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
289
+ NgEsolveConnectModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: NgEsolveConnectModule, imports: [CommonModule,
180
290
  HttpClientModule] });
181
- NgEsolveConnectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: NgEsolveConnectModule, providers: [CookieService], imports: [[
291
+ NgEsolveConnectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: NgEsolveConnectModule, providers: [CookieService], imports: [[
182
292
  CommonModule,
183
293
  HttpClientModule
184
294
  ]] });
185
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: NgEsolveConnectModule, decorators: [{
295
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: NgEsolveConnectModule, decorators: [{
186
296
  type: NgModule,
187
297
  args: [{
188
298
  declarations: [],
@@ -297,9 +407,9 @@ class EsolveErrorHandlerService {
297
407
  return new EsolveHttpError('error', result.message, result.code);
298
408
  }
299
409
  }
300
- EsolveErrorHandlerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveErrorHandlerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
301
- EsolveErrorHandlerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveErrorHandlerService, providedIn: 'root' });
302
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveErrorHandlerService, decorators: [{
410
+ EsolveErrorHandlerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveErrorHandlerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
411
+ EsolveErrorHandlerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveErrorHandlerService, providedIn: 'root' });
412
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveErrorHandlerService, decorators: [{
303
413
  type: Injectable,
304
414
  args: [{
305
415
  providedIn: 'root'
@@ -336,9 +446,9 @@ class EsolveResponseHandlerService {
336
446
  return resultHandler(response);
337
447
  }
338
448
  }
339
- EsolveResponseHandlerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveResponseHandlerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
340
- EsolveResponseHandlerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveResponseHandlerService, providedIn: 'root' });
341
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveResponseHandlerService, decorators: [{
449
+ EsolveResponseHandlerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveResponseHandlerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
450
+ EsolveResponseHandlerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveResponseHandlerService, providedIn: 'root' });
451
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveResponseHandlerService, decorators: [{
342
452
  type: Injectable,
343
453
  args: [{
344
454
  providedIn: 'root'
@@ -453,9 +563,9 @@ class EsolveSeoService {
453
563
  this.setPageKeywordsTags(seoInfo.keywords);
454
564
  }
455
565
  }
456
- 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 });
457
- EsolveSeoService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveSeoService, providedIn: 'root' });
458
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveSeoService, decorators: [{
566
+ EsolveSeoService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveSeoService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.Title }, { token: i1$1.Meta }], target: i0.ɵɵFactoryTarget.Injectable });
567
+ EsolveSeoService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveSeoService, providedIn: 'root' });
568
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveSeoService, decorators: [{
459
569
  type: Injectable,
460
570
  args: [{
461
571
  providedIn: 'root'
@@ -463,7 +573,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
463
573
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
464
574
  type: Inject,
465
575
  args: [ESOLVE_CONNECT_CONFIG]
466
- }] }, { type: i1.Title }, { type: i1.Meta }]; } });
576
+ }] }, { type: i1$1.Title }, { type: i1$1.Meta }]; } });
467
577
 
468
578
  class EsolveAuthService {
469
579
  constructor(config, http, session, errorHandler, cookieService) {
@@ -476,7 +586,7 @@ class EsolveAuthService {
476
586
  getAccessToken(email, password, anonymous = false) {
477
587
  let params = new HttpParams();
478
588
  if (anonymous) {
479
- params = params.set('anonymous', '1');
589
+ params = params.set('anonymous', true);
480
590
  }
481
591
  if (email !== '') {
482
592
  params = params.set('email', email);
@@ -484,25 +594,26 @@ class EsolveAuthService {
484
594
  if (password !== '') {
485
595
  params = params.set('password', password);
486
596
  }
487
- params = params.set('ws_id', this.config.wsid);
488
- return this.http.get(`${this.config.api_url}/service/get-access-token.php`, {
597
+ return this.http
598
+ .get(`${this.config.api_url}/get-access-token.php`, {
489
599
  params,
490
600
  headers: new HttpHeaders({
491
- 'Accept-Language': '*'
492
- })
493
- }).pipe(tap(responseData => {
601
+ 'Accept-Language': '*',
602
+ }),
603
+ })
604
+ .pipe(tap((responseData) => {
494
605
  if ((responseData.type === 'error') ||
495
606
  (responseData.type === 'exception')) {
496
607
  throw responseData;
497
608
  }
498
- }), catchError(this.handleError), tap(responseData => {
609
+ }), catchError(this.handleError), tap((responseData) => {
499
610
  this.handleAuthentication(responseData);
500
611
  }));
501
612
  }
502
613
  autoLogin() {
503
614
  this.session.restore(this.handleExpiration(), () => {
504
- this.getAccessToken('', '', true).toPromise().then(_ => { }, error => {
505
- console.log(error);
615
+ this.getAccessToken('', '', true).toPromise().then(() => { }, (error) => {
616
+ console.error(error);
506
617
  });
507
618
  });
508
619
  }
@@ -513,16 +624,15 @@ class EsolveAuthService {
513
624
  password
514
625
  }
515
626
  };
516
- return this.http.post(`${this.config.api_url}/service/set-login.php`, body, {
627
+ return this.http
628
+ .post(`${this.config.api_url}/set-login.php`, body, {
517
629
  headers: {
518
630
  'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
519
631
  },
520
- params: {
521
- ws_id: this.config.wsid
522
- },
523
632
  responseType: 'json',
524
633
  observe: 'body'
525
- }).pipe(map(response => {
634
+ })
635
+ .pipe(map((response) => {
526
636
  if ((response.responses === undefined) ||
527
637
  (response.responses.length <= 0)) {
528
638
  throw response;
@@ -533,7 +643,8 @@ class EsolveAuthService {
533
643
  throw login_response;
534
644
  }
535
645
  for (const response_log of login_response.log) {
536
- if ((response_log.type === 'success') && (response_log.message_code === 'login_success')) {
646
+ if ((response_log.type === 'success') &&
647
+ (response_log.message_code === 'login_success')) {
537
648
  this.session.handleUpdateSession(login_response.esolve_id);
538
649
  return login_response.esolve_id;
539
650
  }
@@ -551,18 +662,14 @@ class EsolveAuthService {
551
662
  checkAccessToken(session) {
552
663
  session = session || this.session.currentSession;
553
664
  const token = session?.key ?? '';
554
- const params = new HttpParams({
555
- fromObject: {
556
- key: token,
557
- ws_id: this.config.wsid
558
- }
559
- });
560
- return this.http.get(`${this.config.api_url}/service/get-access-token.php`, {
561
- params,
665
+ return this.http
666
+ .get(`${this.config.api_url}/get-access-token.php`, {
667
+ params: { key: token },
562
668
  headers: new HttpHeaders({
563
669
  'Accept-Language': '*'
564
- })
565
- }).pipe(map(responseData => {
670
+ }),
671
+ })
672
+ .pipe(map((responseData) => {
566
673
  if ((responseData.type === 'error') ||
567
674
  (responseData.type === 'exception') ||
568
675
  (!responseData.additional_data.key_okay)) {
@@ -570,7 +677,8 @@ class EsolveAuthService {
570
677
  }
571
678
  responseData.additional_data.key = token;
572
679
  return responseData;
573
- })).toPromise();
680
+ }))
681
+ .toPromise();
574
682
  }
575
683
  // Handlers
576
684
  handleExpiration() {
@@ -583,14 +691,15 @@ class EsolveAuthService {
583
691
  };
584
692
  }
585
693
  handleAuthentication(responseData) {
586
- if (responseData.additional_data.key) {
587
- this.session.handleSession(responseData.additional_data.user_id, responseData.additional_data.key, +responseData.additional_data.expiry_time, +responseData.additional_data.expires, this.handleExpiration());
694
+ if (!responseData.additional_data.key) {
695
+ return;
588
696
  }
697
+ this.session.handleSession(responseData.additional_data.user_id, responseData.additional_data.key, +responseData.additional_data.expiry_time, +responseData.additional_data.expires, this.handleExpiration());
589
698
  }
590
699
  handleError(errorRes) {
591
700
  const error = {
592
701
  message: 'An unknown error occurred',
593
- data: {}
702
+ data: {},
594
703
  };
595
704
  if ((!errorRes.type) ||
596
705
  (!errorRes.service_type) ||
@@ -606,17 +715,17 @@ class EsolveAuthService {
606
715
  return throwError(error);
607
716
  }
608
717
  }
609
- EsolveAuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAuthService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }, { token: EsolveSessionService }, { token: EsolveErrorHandlerService }, { token: i4.CookieService }], target: i0.ɵɵFactoryTarget.Injectable });
610
- EsolveAuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAuthService, providedIn: 'root' });
611
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAuthService, decorators: [{
718
+ EsolveAuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveAuthService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }, { token: EsolveSessionService }, { token: EsolveErrorHandlerService }, { token: EsolveCookieService }], target: i0.ɵɵFactoryTarget.Injectable });
719
+ EsolveAuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveAuthService, providedIn: 'root' });
720
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveAuthService, decorators: [{
612
721
  type: Injectable,
613
722
  args: [{
614
- providedIn: 'root'
723
+ providedIn: 'root',
615
724
  }]
616
725
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
617
726
  type: Inject,
618
727
  args: [ESOLVE_CONNECT_CONFIG]
619
- }] }, { type: i1$1.HttpClient }, { type: EsolveSessionService }, { type: EsolveErrorHandlerService }, { type: i4.CookieService }]; } });
728
+ }] }, { type: i1$2.HttpClient }, { type: EsolveSessionService }, { type: EsolveErrorHandlerService }, { type: EsolveCookieService }]; } });
620
729
 
621
730
  class EsolveAddress {
622
731
  constructor(id, recipient, address_type, pobox, place_name, street_number, street, suburb, city, province, country, postal_code, latitude, longitude) {
@@ -961,25 +1070,22 @@ class EsolveAccountService {
961
1070
  const body = {
962
1071
  account: user_account_data
963
1072
  };
964
- return this.http.post(`${this.config.api_url}/service/set-user-account.php`, body, {
1073
+ return this.http
1074
+ .post(`${this.config.api_url}/set-user-account.php`, body, {
965
1075
  headers: {
966
1076
  'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
967
1077
  },
968
- params: {
969
- ws_id: this.config.wsid
970
- },
971
1078
  responseType: 'json',
972
1079
  observe: 'body'
973
- }).pipe(map((http_response) => this.responseHandler.validateSingleHttpResponse(http_response, (response) => new EsolveUserAccountResult(response))), catchError((errorRes) => {
1080
+ })
1081
+ .pipe(map((http_response) => this.responseHandler.validateSingleHttpResponse(http_response, (response) => new EsolveUserAccountResult(response))), catchError((errorRes) => {
974
1082
  return this.errorHandler.handleHttpPostError('set-user-account', errorRes);
975
1083
  }));
976
1084
  }
977
1085
  getUserAccount() {
978
- return this.http.get(`${this.config.api_url}/service/get-account.php`, {
979
- params: {
980
- ws_id: this.config.wsid
981
- }
982
- }).pipe(map(response => {
1086
+ return this.http
1087
+ .get(`${this.config.api_url}/get-account.php`)
1088
+ .pipe(map((response) => {
983
1089
  if ((response.records === undefined) ||
984
1090
  (response.records.length === 0)) {
985
1091
  throw response;
@@ -992,28 +1098,26 @@ class EsolveAccountService {
992
1098
  const body = {
993
1099
  address: address_post_data
994
1100
  };
995
- return this.http.post(`${this.config.api_url}/service/set-address.php`, body, {
1101
+ return this.http
1102
+ .post(`${this.config.api_url}/set-address.php`, body, {
996
1103
  headers: {
997
- 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
998
- },
999
- params: {
1000
- ws_id: this.config.wsid
1104
+ 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;',
1001
1105
  },
1002
1106
  responseType: 'json',
1003
- observe: 'body'
1004
- }).pipe(map((http_response) => this.responseHandler.validateSingleHttpResponse(http_response, (response) => new EsolveAddressResult(response))), catchError((errorRes) => {
1107
+ observe: 'body',
1108
+ })
1109
+ .pipe(map((http_response) => this.responseHandler.validateSingleHttpResponse(http_response, (response) => new EsolveAddressResult(response))), catchError((errorRes) => {
1005
1110
  return this.errorHandler.handleHttpPostError('set-registration', errorRes);
1006
1111
  }));
1007
1112
  }
1008
1113
  getAddresses() {
1009
1114
  try {
1010
1115
  this.loginGuard();
1011
- return this.http.get(`${this.config.api_url}/service/get-addresses.php`, {
1012
- params: {
1013
- ws_id: this.config.wsid,
1014
- user_id: this.user_id
1015
- }
1016
- }).pipe(map(response => {
1116
+ return this.http
1117
+ .get(`${this.config.api_url}/get-addresses.php`, {
1118
+ params: { user_id: this.user_id }
1119
+ })
1120
+ .pipe(map((response) => {
1017
1121
  if (response.records === undefined) {
1018
1122
  throw response;
1019
1123
  }
@@ -1025,14 +1129,13 @@ class EsolveAccountService {
1025
1129
  }
1026
1130
  }
1027
1131
  deleteAddress(id) {
1028
- return this.http.delete(`${this.config.api_url}/service/delete-address.php`, {
1029
- params: {
1030
- ws_id: this.config.wsid,
1031
- id: id
1032
- },
1132
+ return this.http
1133
+ .delete(`${this.config.api_url}/delete-address.php`, {
1134
+ params: { id },
1033
1135
  responseType: 'json',
1034
1136
  observe: 'body'
1035
- }).pipe(map(http_response => {
1137
+ })
1138
+ .pipe(map((http_response) => {
1036
1139
  if ((http_response.result === undefined) ||
1037
1140
  (http_response.result === null) ||
1038
1141
  (http_response.result.status !== 'success')) {
@@ -1047,16 +1150,15 @@ class EsolveAccountService {
1047
1150
  const body = {
1048
1151
  user: user_registration
1049
1152
  };
1050
- return this.http.post(`${this.config.api_url}/service/set-registration.php`, body, {
1153
+ return this.http
1154
+ .post(`${this.config.api_url}/set-registration.php`, body, {
1051
1155
  headers: {
1052
1156
  'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
1053
1157
  },
1054
- params: {
1055
- ws_id: this.config.wsid
1056
- },
1057
1158
  responseType: 'json',
1058
1159
  observe: 'body'
1059
- }).pipe(map(http_response => this.responseHandler.validateSingleHttpResponse(http_response, (response) => {
1160
+ })
1161
+ .pipe(map((http_response) => this.responseHandler.validateSingleHttpResponse(http_response, (response) => {
1060
1162
  if (response.auto_login) {
1061
1163
  this.sessionService.handleUpdateSession(response.esolve_id);
1062
1164
  }
@@ -1070,28 +1172,24 @@ class EsolveAccountService {
1070
1172
  password,
1071
1173
  confirm_password
1072
1174
  };
1073
- return this.http.post(`${this.config.api_url}/service/set-change-password.php`, body, {
1175
+ return this.http
1176
+ .post(`${this.config.api_url}/set-change-password.php`, body, {
1074
1177
  headers: {
1075
1178
  'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
1076
1179
  },
1077
- params: {
1078
- ws_id: this.config.wsid
1079
- },
1080
1180
  responseType: 'json',
1081
1181
  observe: 'body'
1082
- }).pipe(map(http_response => this.responseHandler.validateSingleHttpResponse(http_response, (response) => {
1182
+ })
1183
+ .pipe(map((http_response) => this.responseHandler.validateSingleHttpResponse(http_response, (response) => {
1083
1184
  return new EsolveChangePasswordResult(response);
1084
1185
  })), catchError((errorRes) => {
1085
1186
  return this.errorHandler.handleHttpPostError('set-change-password', errorRes);
1086
1187
  }));
1087
1188
  }
1088
1189
  sendForgotPasswordRequest(email) {
1089
- return this.http.get(`${this.config.api_url}/service/get-forgot-password.php`, {
1090
- params: {
1091
- ws_id: this.config.wsid,
1092
- email: email
1093
- }
1094
- }).pipe(map(response => {
1190
+ return this.http
1191
+ .get(`${this.config.api_url}/get-forgot-password.php`, { params: { email } })
1192
+ .pipe(map((response) => {
1095
1193
  if ((response.records === undefined) ||
1096
1194
  !('reset_link_sent' in response.records)) {
1097
1195
  throw response;
@@ -1100,7 +1198,8 @@ class EsolveAccountService {
1100
1198
  }));
1101
1199
  }
1102
1200
  resetPassword(reset_key, password, confirm_password, auto_login = true) {
1103
- return this.http.post(`${this.config.api_url}/service/set-forgot-password.php`, {
1201
+ return this.http
1202
+ .post(`${this.config.api_url}/set-forgot-password.php`, {
1104
1203
  reset_key,
1105
1204
  password,
1106
1205
  confirm_password,
@@ -1109,12 +1208,10 @@ class EsolveAccountService {
1109
1208
  headers: {
1110
1209
  'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
1111
1210
  },
1112
- params: {
1113
- ws_id: this.config.wsid
1114
- },
1115
1211
  responseType: 'json',
1116
1212
  observe: 'body'
1117
- }).pipe(map(http_response => this.responseHandler.validateSingleHttpResponse(http_response, (response) => {
1213
+ })
1214
+ .pipe(map((http_response) => this.responseHandler.validateSingleHttpResponse(http_response, (response) => {
1118
1215
  if (!response.login_required) {
1119
1216
  this.sessionService.handleUpdateSession(response.esolve_id);
1120
1217
  }
@@ -1126,13 +1223,14 @@ class EsolveAccountService {
1126
1223
  getTransactions(options = {}) {
1127
1224
  try {
1128
1225
  this.loginGuard();
1129
- return this.http.get(`${this.config.api_url}/service/get-transactions.php`, {
1226
+ return this.http
1227
+ .get(`${this.config.api_url}/get-transactions.php`, {
1130
1228
  params: {
1131
- ws_id: this.config.wsid,
1132
1229
  user_id: this.user_id,
1133
1230
  ...options,
1134
1231
  }
1135
- }).pipe(map(response => {
1232
+ })
1233
+ .pipe(map((response) => {
1136
1234
  if (response.records === undefined) {
1137
1235
  throw response;
1138
1236
  }
@@ -1150,14 +1248,16 @@ class EsolveAccountService {
1150
1248
  getTransaction(id) {
1151
1249
  try {
1152
1250
  this.loginGuard();
1153
- return this.http.get(`${this.config.api_url}/service/get-transactions.php`, {
1251
+ return this.http
1252
+ .get(`${this.config.api_url}/get-transactions.php`, {
1154
1253
  params: {
1155
- ws_id: this.config.wsid,
1156
1254
  user_id: this.user_id,
1157
1255
  transaction_id: id,
1158
1256
  }
1159
- }).pipe(map(response => {
1160
- if ((response.records === undefined) || (response.records.length <= 0)) {
1257
+ })
1258
+ .pipe(map((response) => {
1259
+ if ((response.records === undefined) ||
1260
+ (response.records.length <= 0)) {
1161
1261
  throw response;
1162
1262
  }
1163
1263
  const items = this.processTransactions(response.records);
@@ -1209,9 +1309,9 @@ class EsolveAccountService {
1209
1309
  }
1210
1310
  }
1211
1311
  }
1212
- EsolveAccountService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAccountService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }, { token: EsolveSessionService }, { token: EsolveErrorHandlerService }, { token: EsolveResponseHandlerService }], target: i0.ɵɵFactoryTarget.Injectable });
1213
- EsolveAccountService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAccountService, providedIn: 'root' });
1214
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAccountService, decorators: [{
1312
+ EsolveAccountService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveAccountService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }, { token: EsolveSessionService }, { token: EsolveErrorHandlerService }, { token: EsolveResponseHandlerService }], target: i0.ɵɵFactoryTarget.Injectable });
1313
+ EsolveAccountService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveAccountService, providedIn: 'root' });
1314
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveAccountService, decorators: [{
1215
1315
  type: Injectable,
1216
1316
  args: [{
1217
1317
  providedIn: 'root'
@@ -1219,7 +1319,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
1219
1319
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1220
1320
  type: Inject,
1221
1321
  args: [ESOLVE_CONNECT_CONFIG]
1222
- }] }, { type: i1$1.HttpClient }, { type: EsolveSessionService }, { type: EsolveErrorHandlerService }, { type: EsolveResponseHandlerService }]; } });
1322
+ }] }, { type: i1$2.HttpClient }, { type: EsolveSessionService }, { type: EsolveErrorHandlerService }, { type: EsolveResponseHandlerService }]; } });
1323
+
1324
+ class EsolveHeading {
1325
+ constructor(identifier, value) {
1326
+ this.identifier = identifier;
1327
+ this.value = value;
1328
+ }
1329
+ }
1223
1330
 
1224
1331
  class EsolveMediaArticle {
1225
1332
  constructor(identifier, title, article, image_url = '', tags = [], topics = [], seo_title = '', seo_keywords = '', seo_description = '') {
@@ -1260,18 +1367,16 @@ class EsolveMediaService {
1260
1367
  this.http = http;
1261
1368
  }
1262
1369
  /**
1263
- * Retrieves the media record from the eSolve instance using the identifier.
1264
- * @param identifier String representing the eSolve media indentifier
1370
+ * Retrieves the media record from the eSolve instance using the identifier
1371
+ *
1372
+ * @param identifier String representing the eSolve media identifier
1265
1373
  */
1266
1374
  getMediaArticle(identifier) {
1267
- const params = new HttpParams({
1268
- fromObject: {
1269
- identifier
1270
- }
1271
- });
1375
+ const params = new HttpParams({ fromObject: { identifier } });
1272
1376
  // TODO: Error Handling
1273
- return this.getMediaRecords(params).pipe(map(response => {
1274
- if ((response.records === undefined) || (response.records.length <= 0)) {
1377
+ return this.getMediaRecords(params).pipe(map((response) => {
1378
+ if ((response.records === undefined) ||
1379
+ (response.records.length <= 0)) {
1275
1380
  throw response;
1276
1381
  }
1277
1382
  const mediaRecord = response.records[0];
@@ -1282,18 +1387,18 @@ class EsolveMediaService {
1282
1387
  }));
1283
1388
  }
1284
1389
  /**
1285
- * Retrieves a group of media records from the eSolve instance linked to a group.
1390
+ * Retrieves a group of media records from the eSolve instance linked to a group
1391
+ *
1286
1392
  * @param media_group String representing the eSolve media group
1287
1393
  */
1288
1394
  getGroupedMediaArticles(media_group) {
1289
1395
  const params = new HttpParams({
1290
- fromObject: {
1291
- media_group_sef: media_group
1292
- }
1396
+ fromObject: { media_group_sef: media_group }
1293
1397
  });
1294
- return this.getMediaRecords(params).pipe(map(response => {
1398
+ return this.getMediaRecords(params).pipe(map((response) => {
1295
1399
  const mediaArticles = [];
1296
- if ((response.records !== undefined) && (response.records.length > 0)) {
1400
+ if ((response.records !== undefined) &&
1401
+ (response.records.length > 0)) {
1297
1402
  for (const mediaRecord of response.records) {
1298
1403
  if (mediaRecord.active) {
1299
1404
  mediaArticles.push(this.processMediaRecord(mediaRecord));
@@ -1303,6 +1408,34 @@ class EsolveMediaService {
1303
1408
  return mediaArticles;
1304
1409
  }));
1305
1410
  }
1411
+ /**
1412
+ * Retrieves the media heading records from the eSolve instance using the identifiers
1413
+ *
1414
+ * @param identifiers Array of strings representing the eSolve heading identifiers
1415
+ */
1416
+ getHeadings(identifiers) {
1417
+ return this.http
1418
+ .get(`${this.config.api_url}/get-headings.php`, {
1419
+ params: {
1420
+ identifier: identifiers.join(','),
1421
+ },
1422
+ })
1423
+ .pipe(map((response) => {
1424
+ const headings = [];
1425
+ if ((response.records !== undefined) &&
1426
+ (response.records.length > 0)) {
1427
+ for (const heading_record of response.records) {
1428
+ headings.push(this.processHeadingRecord(heading_record));
1429
+ }
1430
+ }
1431
+ return headings;
1432
+ }));
1433
+ }
1434
+ /**
1435
+ * Processes media article record
1436
+ *
1437
+ * @param record Record from eSolve instance
1438
+ */
1306
1439
  processMediaRecord(record) {
1307
1440
  const tags = [];
1308
1441
  const topics = [];
@@ -1318,26 +1451,34 @@ class EsolveMediaService {
1318
1451
  }
1319
1452
  return new EsolveMediaArticle(record.identifier, record.title, record.article, record.image_url, tags, topics, record.seo_page_title, record.seo_keywords, record.seo_description);
1320
1453
  }
1454
+ /**
1455
+ * Processes media heading record
1456
+ *
1457
+ * @param record Record from eSolve instance
1458
+ */
1459
+ processHeadingRecord(record) {
1460
+ return new EsolveHeading(record.identifier, record.value);
1461
+ }
1321
1462
  /**
1322
1463
  * Retrieves media records from eSolve instance.
1323
- * @param params Header params
1464
+ *
1465
+ * @param params HTTP params
1324
1466
  */
1325
1467
  getMediaRecords(params) {
1326
- params = params.set('ws_id', this.config.wsid);
1327
- return this.http.get(`${this.config.api_url}/service/get-media.php`, { params });
1468
+ return this.http.get(`${this.config.api_url}/get-media.php`, { params });
1328
1469
  }
1329
1470
  }
1330
- EsolveMediaService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMediaService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
1331
- EsolveMediaService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMediaService, providedIn: 'root' });
1332
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMediaService, decorators: [{
1471
+ EsolveMediaService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveMediaService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
1472
+ EsolveMediaService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveMediaService, providedIn: 'root' });
1473
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveMediaService, decorators: [{
1333
1474
  type: Injectable,
1334
1475
  args: [{
1335
- providedIn: 'root'
1476
+ providedIn: 'root',
1336
1477
  }]
1337
1478
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1338
1479
  type: Inject,
1339
1480
  args: [ESOLVE_CONNECT_CONFIG]
1340
- }] }, { type: i1$1.HttpClient }]; } });
1481
+ }] }, { type: i1$2.HttpClient }]; } });
1341
1482
 
1342
1483
  class EsolveNewsGroup {
1343
1484
  constructor(id, name, description, sef_name) {
@@ -1389,18 +1530,11 @@ class EsolveNewsService {
1389
1530
  this.config = config;
1390
1531
  this.http = http;
1391
1532
  }
1392
- getNewsRecords(params) {
1393
- params = params.set('ws_id', this.config.wsid);
1394
- return this.http.get(`${this.config.api_url}/service/get-news.php`, { params });
1395
- }
1396
1533
  getNewsArticle(identifier) {
1397
- const params = new HttpParams({
1398
- fromObject: {
1399
- sef_title: identifier
1400
- }
1401
- });
1534
+ const params = new HttpParams({ fromObject: { sef_title: identifier } });
1402
1535
  return this.getNewsRecords(params).pipe(map(response => {
1403
- if ((response.records === undefined) || (response.records.length <= 0)) {
1536
+ if ((response.records === undefined) ||
1537
+ (response.records.length <= 0)) {
1404
1538
  throw response;
1405
1539
  }
1406
1540
  const newsRecord = response.records[0];
@@ -1451,9 +1585,9 @@ class EsolveNewsService {
1451
1585
  }));
1452
1586
  }
1453
1587
  getNewsGroups() {
1454
- let params = new HttpParams();
1455
- params = params.set('ws_id', this.config.wsid);
1456
- return this.http.get(`${this.config.api_url}/service/get-news-groups.php`, { params }).pipe(map(response => {
1588
+ return this.http
1589
+ .get(`${this.config.api_url}/get-news-groups.php`)
1590
+ .pipe(map((response) => {
1457
1591
  if (response.records === undefined) {
1458
1592
  throw response;
1459
1593
  }
@@ -1468,18 +1602,21 @@ class EsolveNewsService {
1468
1602
  const author = new EsolveNewsArticleAuthor(newsRecord.user.userid, newsRecord.user.email, newsRecord.user.firstname, newsRecord.user.surname);
1469
1603
  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);
1470
1604
  }
1605
+ getNewsRecords(params) {
1606
+ return this.http.get(`${this.config.api_url}/get-news.php`, { params });
1607
+ }
1471
1608
  }
1472
- EsolveNewsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveNewsService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
1473
- EsolveNewsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveNewsService, providedIn: 'root' });
1474
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveNewsService, decorators: [{
1609
+ EsolveNewsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveNewsService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
1610
+ EsolveNewsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveNewsService, providedIn: 'root' });
1611
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveNewsService, decorators: [{
1475
1612
  type: Injectable,
1476
1613
  args: [{
1477
- providedIn: 'root'
1614
+ providedIn: 'root',
1478
1615
  }]
1479
1616
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1480
1617
  type: Inject,
1481
1618
  args: [ESOLVE_CONNECT_CONFIG]
1482
- }] }, { type: i1$1.HttpClient }]; } });
1619
+ }] }, { type: i1$2.HttpClient }]; } });
1483
1620
 
1484
1621
  class EsolveBanner {
1485
1622
  constructor(id, banner_display_container, identifier, type, title, article, sort_priority, link, images) {
@@ -1541,10 +1678,7 @@ class EsolveBannerService {
1541
1678
  */
1542
1679
  getBanners(identifier, banner_display_container, enable_date_filter = false) {
1543
1680
  let params = new HttpParams({
1544
- fromObject: {
1545
- ws_id: this.config.wsid,
1546
- enable_date_filter
1547
- }
1681
+ fromObject: { enable_date_filter }
1548
1682
  });
1549
1683
  if (identifier) {
1550
1684
  params = params.set('identifier', identifier);
@@ -1552,7 +1686,9 @@ class EsolveBannerService {
1552
1686
  if (banner_display_container) {
1553
1687
  params = params.set('banner_display_container', banner_display_container);
1554
1688
  }
1555
- return this.http.get(`${this.config.api_url}/service/get-banners.php`, { params }).pipe(map(response => {
1689
+ return this.http
1690
+ .get(`${this.config.api_url}/get-banners.php`, { params })
1691
+ .pipe(map((response) => {
1556
1692
  if (response.records === undefined) {
1557
1693
  throw response;
1558
1694
  }
@@ -1612,17 +1748,17 @@ class EsolveBannerService {
1612
1748
  return banners;
1613
1749
  }
1614
1750
  }
1615
- EsolveBannerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveBannerService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
1616
- EsolveBannerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveBannerService, providedIn: 'root' });
1617
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveBannerService, decorators: [{
1751
+ EsolveBannerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveBannerService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
1752
+ EsolveBannerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveBannerService, providedIn: 'root' });
1753
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveBannerService, decorators: [{
1618
1754
  type: Injectable,
1619
1755
  args: [{
1620
- providedIn: 'root'
1756
+ providedIn: 'root',
1621
1757
  }]
1622
1758
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1623
1759
  type: Inject,
1624
1760
  args: [ESOLVE_CONNECT_CONFIG]
1625
- }] }, { type: i1$1.HttpClient }]; } });
1761
+ }] }, { type: i1$2.HttpClient }]; } });
1626
1762
 
1627
1763
  class EsolveMenuItem {
1628
1764
  constructor(url, name, target, children = []) {
@@ -1639,10 +1775,9 @@ class EsolveMenuService {
1639
1775
  this.http = http;
1640
1776
  }
1641
1777
  getMenuTree(identifier) {
1642
- let menuParams = new HttpParams();
1643
- menuParams = menuParams.set('identifier', identifier);
1644
- menuParams = menuParams.set('ws_id', this.config.wsid);
1645
- return this.http.get(`${this.config.api_url}/service/get-menu-tree.php`, { params: menuParams }).pipe(map(response => {
1778
+ return this.http
1779
+ .get(`${this.config.api_url}/get-menu-tree.php`, { params: { identifier } })
1780
+ .pipe(map((response) => {
1646
1781
  if ((!response) || (response.records === undefined)) {
1647
1782
  throw response;
1648
1783
  }
@@ -1662,17 +1797,17 @@ class EsolveMenuService {
1662
1797
  return menu;
1663
1798
  }
1664
1799
  }
1665
- EsolveMenuService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMenuService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
1666
- EsolveMenuService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMenuService, providedIn: 'root' });
1667
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMenuService, decorators: [{
1800
+ EsolveMenuService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveMenuService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
1801
+ EsolveMenuService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveMenuService, providedIn: 'root' });
1802
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveMenuService, decorators: [{
1668
1803
  type: Injectable,
1669
1804
  args: [{
1670
- providedIn: 'root'
1805
+ providedIn: 'root',
1671
1806
  }]
1672
1807
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1673
1808
  type: Inject,
1674
1809
  args: [ESOLVE_CONNECT_CONFIG]
1675
- }] }, { type: i1$1.HttpClient }]; } });
1810
+ }] }, { type: i1$2.HttpClient }]; } });
1676
1811
 
1677
1812
  class EsolveTopicService {
1678
1813
  constructor(config, http) {
@@ -1686,15 +1821,11 @@ class EsolveTopicService {
1686
1821
  * @param topic_id_list List of topic ID's that need to be retrieved
1687
1822
  */
1688
1823
  getTopics(topic_id_list = []) {
1689
- let params = new HttpParams({
1690
- fromObject: {
1691
- ws_id: this.config.wsid
1692
- }
1693
- });
1824
+ let params = new HttpParams();
1694
1825
  if (topic_id_list.length > 0) {
1695
1826
  params = params.append('topic_id', topic_id_list.join(','));
1696
1827
  }
1697
- return this.http.get(`${this.config.api_url}/service/get-topics.php`, { params }).pipe(map(response => {
1828
+ return this.http.get(`${this.config.api_url}/get-topics.php`, { params }).pipe(map(response => {
1698
1829
  if (response.records === undefined) {
1699
1830
  throw response;
1700
1831
  }
@@ -1712,9 +1843,9 @@ class EsolveTopicService {
1712
1843
  return topics;
1713
1844
  }
1714
1845
  }
1715
- EsolveTopicService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveTopicService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
1716
- EsolveTopicService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveTopicService, providedIn: 'root' });
1717
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveTopicService, decorators: [{
1846
+ EsolveTopicService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveTopicService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
1847
+ EsolveTopicService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveTopicService, providedIn: 'root' });
1848
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveTopicService, decorators: [{
1718
1849
  type: Injectable,
1719
1850
  args: [{
1720
1851
  providedIn: 'root'
@@ -1722,7 +1853,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
1722
1853
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1723
1854
  type: Inject,
1724
1855
  args: [ESOLVE_CONNECT_CONFIG]
1725
- }] }, { type: i1$1.HttpClient }]; } });
1856
+ }] }, { type: i1$2.HttpClient }]; } });
1726
1857
 
1727
1858
  class EsolveStockBadge {
1728
1859
  constructor(id, text, identifier, font_colour, badge_colour, sort_priority) {
@@ -1820,6 +1951,10 @@ class EsolveStockItem {
1820
1951
  * Short description of stock item
1821
1952
  */
1822
1953
  description,
1954
+ /**
1955
+ * Full description of stock item
1956
+ */
1957
+ extended_description,
1823
1958
  /**
1824
1959
  * Active state
1825
1960
  */
@@ -1861,6 +1996,7 @@ class EsolveStockItem {
1861
1996
  this.name = name;
1862
1997
  this.sef_name = sef_name;
1863
1998
  this.description = description;
1999
+ this.extended_description = extended_description;
1864
2000
  this.active = active;
1865
2001
  this.featured = featured;
1866
2002
  this.image_name = image_name;
@@ -1923,40 +2059,6 @@ class EsolveStockService {
1923
2059
  this.config = config;
1924
2060
  this.http = http;
1925
2061
  }
1926
- /**
1927
- * Processes the eSolve stock item record and converts it to StockItem object.
1928
- * @param record eSolve stock item record
1929
- */
1930
- processStockItem(record) {
1931
- const tags = [];
1932
- const topics = [];
1933
- const badges = [];
1934
- if ((record.tags) && (record.tags.length > 0)) {
1935
- for (const tag of record.tags) {
1936
- tags.push(new EsolveTag(+tag.id, tag.tag_phrase, +tag.tag_weight, tag.description));
1937
- }
1938
- }
1939
- if ((record.topics) && (record.topics.length > 0)) {
1940
- for (const topic of record.topics) {
1941
- topics.push(new EsolveTopic(+topic.id, topic.name, topic.short_description, +topic.sort_priority));
1942
- }
1943
- }
1944
- if ((record.badges) && (record.badges.length > 0)) {
1945
- for (const badge of record.badges) {
1946
- badges.push(new EsolveStockBadge(+badge.id, badge.text, badge.identifier, badge.font_colour, badge.badge_colour, +badge.sort_priority));
1947
- }
1948
- }
1949
- const price = new EsolveStockPrice(record.regular_sellprice, record.regular_sellprice_inclusive, record.sellprice, record.sellprice_inclusive);
1950
- return new EsolveStockItem(+record.id, record.code, record.name, record.sef_name, record.description, !!+record.is_active, !!+record.is_featured, record.image_name, price, tags, topics, badges, record.category_id, +record.subcategory_id, record.seo_page_title, record.seo_keywords);
1951
- }
1952
- /**
1953
- * Retrieves stock records from HTTP params.
1954
- * @param params HTTP client parameters
1955
- */
1956
- getStockRecords(params) {
1957
- params = params.set('ws_id', this.config.wsid);
1958
- return this.http.get(`${this.config.api_url}/service/get-items.php`, { params });
1959
- }
1960
2062
  /**
1961
2063
  * Retrieves the stock record from the eSolve instance using the code.
1962
2064
  * @param code eSolve stock code
@@ -2041,18 +2143,51 @@ class EsolveStockService {
2041
2143
  return new EsolveStockItemList(stockItems, +response.additional_data.total_records, options.page ?? 0);
2042
2144
  }));
2043
2145
  }
2146
+ /**
2147
+ * Processes the eSolve stock item record and converts it to StockItem object.
2148
+ * @param record eSolve stock item record
2149
+ */
2150
+ processStockItem(record) {
2151
+ const tags = [];
2152
+ const topics = [];
2153
+ const badges = [];
2154
+ if ((record.tags) && (record.tags.length > 0)) {
2155
+ for (const tag of record.tags) {
2156
+ tags.push(new EsolveTag(+tag.id, tag.tag_phrase, +tag.tag_weight, tag.description));
2157
+ }
2158
+ }
2159
+ if ((record.topics) && (record.topics.length > 0)) {
2160
+ for (const topic of record.topics) {
2161
+ topics.push(new EsolveTopic(+topic.id, topic.name, topic.short_description, +topic.sort_priority));
2162
+ }
2163
+ }
2164
+ if ((record.badges) && (record.badges.length > 0)) {
2165
+ for (const badge of record.badges) {
2166
+ badges.push(new EsolveStockBadge(+badge.id, badge.text, badge.identifier, badge.font_colour, badge.badge_colour, +badge.sort_priority));
2167
+ }
2168
+ }
2169
+ const price = new EsolveStockPrice(record.regular_sellprice, record.regular_sellprice_inclusive, record.sellprice, record.sellprice_inclusive);
2170
+ return new EsolveStockItem(+record.id, record.code, record.name, record.sef_name, record.description, record.extended_description, !!+record.is_active, !!+record.is_featured, record.image_name, price, tags, topics, badges, record.category_id, +record.subcategory_id, record.seo_page_title, record.seo_keywords);
2171
+ }
2172
+ /**
2173
+ * Retrieves stock records from HTTP params.
2174
+ * @param params HTTP client parameters
2175
+ */
2176
+ getStockRecords(params) {
2177
+ return this.http.get(`${this.config.api_url}/get-items.php`, { params });
2178
+ }
2044
2179
  }
2045
- EsolveStockService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveStockService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
2046
- EsolveStockService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveStockService, providedIn: 'root' });
2047
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveStockService, decorators: [{
2180
+ EsolveStockService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveStockService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
2181
+ EsolveStockService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveStockService, providedIn: 'root' });
2182
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveStockService, decorators: [{
2048
2183
  type: Injectable,
2049
2184
  args: [{
2050
- providedIn: 'root'
2185
+ providedIn: 'root',
2051
2186
  }]
2052
2187
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
2053
2188
  type: Inject,
2054
2189
  args: [ESOLVE_CONNECT_CONFIG]
2055
- }] }, { type: i1$1.HttpClient }]; } });
2190
+ }] }, { type: i1$2.HttpClient }]; } });
2056
2191
 
2057
2192
  class EsolveCategoryTreeItem {
2058
2193
  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) {
@@ -2110,9 +2245,9 @@ class EsolveCategoryTreeService {
2110
2245
  * Retrieves the category tree from eSolve instance and coverts it to the correct format.
2111
2246
  */
2112
2247
  getCategoryTree() {
2113
- let params = new HttpParams();
2114
- params = params.set('ws_id', this.config.wsid);
2115
- return this.http.get(`${this.config.api_url}/service/get-tree.php`, { params }).pipe(map(response => {
2248
+ return this.http
2249
+ .get(`${this.config.api_url}/get-tree.php`)
2250
+ .pipe(map((response) => {
2116
2251
  if (response.records === undefined) {
2117
2252
  throw response;
2118
2253
  }
@@ -2120,7 +2255,9 @@ class EsolveCategoryTreeService {
2120
2255
  }));
2121
2256
  }
2122
2257
  /**
2123
- * Retrieve the details of a category tree item from the eSolve instance and converts it to the correct format.
2258
+ * Retrieve the details of a category tree item from the eSolve instance and
2259
+ * converts it to the correct format.
2260
+ *
2124
2261
  * @param options Filter options
2125
2262
  */
2126
2263
  getCategoryTreeItem(options) {
@@ -2145,16 +2282,18 @@ class EsolveCategoryTreeService {
2145
2282
  }
2146
2283
  if (type && (esolve_id || sef_description)) {
2147
2284
  let params = new HttpParams();
2148
- params = params.set('ws_id', this.config.wsid.toString());
2149
- params = params.set('type', type.toString());
2285
+ params = params.set('type', type);
2150
2286
  if (esolve_id) {
2151
- params = params.set('id', esolve_id.toString());
2287
+ params = params.set('id', esolve_id);
2152
2288
  }
2153
2289
  if (sef_description) {
2154
- params = params.set('sef_description', sef_description.toString());
2290
+ params = params.set('sef_description', sef_description);
2155
2291
  }
2156
- return this.http.get(`${this.config.api_url}/service/get-tree-item.php`, { params }).pipe(map(response => {
2157
- if ((response.records === undefined) || (response.records.length <= 0)) {
2292
+ return this.http
2293
+ .get(`${this.config.api_url}/get-tree-item.php`, { params })
2294
+ .pipe(map((response) => {
2295
+ if ((response.records === undefined) ||
2296
+ (response.records.length <= 0)) {
2158
2297
  throw response;
2159
2298
  }
2160
2299
  return this.processTreeItem(response.records[0]);
@@ -2164,6 +2303,7 @@ class EsolveCategoryTreeService {
2164
2303
  }
2165
2304
  /**
2166
2305
  * Processes the eSolve tree records and converts them into the correct format.
2306
+ *
2167
2307
  * @param tree_records Records to process
2168
2308
  */
2169
2309
  processTree(tree_records) {
@@ -2207,17 +2347,17 @@ class EsolveCategoryTreeService {
2207
2347
  return null;
2208
2348
  }
2209
2349
  }
2210
- EsolveCategoryTreeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCategoryTreeService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
2211
- EsolveCategoryTreeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCategoryTreeService, providedIn: 'root' });
2212
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCategoryTreeService, decorators: [{
2350
+ EsolveCategoryTreeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveCategoryTreeService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
2351
+ EsolveCategoryTreeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveCategoryTreeService, providedIn: 'root' });
2352
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveCategoryTreeService, decorators: [{
2213
2353
  type: Injectable,
2214
2354
  args: [{
2215
- providedIn: 'root'
2355
+ providedIn: 'root',
2216
2356
  }]
2217
2357
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
2218
2358
  type: Inject,
2219
2359
  args: [ESOLVE_CONNECT_CONFIG]
2220
- }] }, { type: i1$1.HttpClient }]; } });
2360
+ }] }, { type: i1$2.HttpClient }]; } });
2221
2361
 
2222
2362
  class EsolveCheckoutResult extends EsolveResponseResult {
2223
2363
  constructor(response) {
@@ -2343,14 +2483,13 @@ class EsolveCartService {
2343
2483
  }
2344
2484
  /**
2345
2485
  * Retrieves the current cart
2486
+ *
2346
2487
  * @returns An `Observable` with an array of cart items
2347
2488
  */
2348
2489
  getCart() {
2349
- return this.http.get(`${this.config.api_url}/service/get-cart.php`, {
2350
- params: {
2351
- ws_id: this.config.wsid
2352
- }
2353
- }).pipe(map(response => {
2490
+ return this.http
2491
+ .get(`${this.config.api_url}/get-cart.php`)
2492
+ .pipe(map((response) => {
2354
2493
  if (response.records === undefined) {
2355
2494
  throw response;
2356
2495
  }
@@ -2359,6 +2498,7 @@ class EsolveCartService {
2359
2498
  }
2360
2499
  /**
2361
2500
  * Updates the cart by preforming various actions, such as adding, editing or removing items from the cart.
2501
+ *
2362
2502
  * @param items An array of options to update the cart
2363
2503
  * @param action The default action to preform
2364
2504
  * @returns An `Observable` with an array of responses that gives feedback on the requested changes
@@ -2368,16 +2508,15 @@ class EsolveCartService {
2368
2508
  items,
2369
2509
  action
2370
2510
  };
2371
- return this.http.post(`${this.config.api_url}/service/set-cart-item.php`, body, {
2511
+ return this.http
2512
+ .post(`${this.config.api_url}/set-cart-item.php`, body, {
2372
2513
  headers: {
2373
2514
  'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
2374
2515
  },
2375
- params: {
2376
- ws_id: this.config.wsid
2377
- },
2378
2516
  responseType: 'json',
2379
2517
  observe: 'body'
2380
- }).pipe(map(response => {
2518
+ })
2519
+ .pipe(map(response => {
2381
2520
  if (response.responses === undefined) {
2382
2521
  throw response;
2383
2522
  }
@@ -2386,14 +2525,13 @@ class EsolveCartService {
2386
2525
  }
2387
2526
  /**
2388
2527
  * Retrieves the totals of the cart with all the totals calculated
2528
+ *
2389
2529
  * @returns An `Observable` with an object containing cart totals
2390
2530
  */
2391
2531
  getTotals() {
2392
- return this.http.get(`${this.config.api_url}/service/get-cart-totals.php`, {
2393
- params: {
2394
- ws_id: this.config.wsid
2395
- }
2396
- }).pipe(map(response => {
2532
+ return this.http
2533
+ .get(`${this.config.api_url}/get-cart-totals.php`)
2534
+ .pipe(map((response) => {
2397
2535
  if (response.records === undefined) {
2398
2536
  throw response;
2399
2537
  }
@@ -2402,14 +2540,13 @@ class EsolveCartService {
2402
2540
  }
2403
2541
  /**
2404
2542
  * Retrieves a tracking code for the cart
2543
+ *
2405
2544
  * @returns An `Observable` with the cart tracking code
2406
2545
  */
2407
2546
  getTrackingCode() {
2408
- return iif(() => this._cached_tracking > 0, of(this._cached_tracking), this.http.get(`${this.config.api_url}/service/get-checkout-tracking.php`, {
2409
- params: {
2410
- ws_id: this.config.wsid
2411
- }
2412
- }).pipe(map(response => {
2547
+ return iif(() => this._cached_tracking > 0, of(this._cached_tracking), this.http
2548
+ .get(`${this.config.api_url}/get-checkout-tracking.php`)
2549
+ .pipe(map((response) => {
2413
2550
  if (response.records === undefined) {
2414
2551
  throw response;
2415
2552
  }
@@ -2419,6 +2556,7 @@ class EsolveCartService {
2419
2556
  }
2420
2557
  /**
2421
2558
  * Initiates checkout of the cart items
2559
+ *
2422
2560
  * @param type The cart type that needs to be checked out
2423
2561
  * @param addresses_id The ID of the delivery address
2424
2562
  * @param shipping_id The ID of the shipping method
@@ -2442,16 +2580,15 @@ class EsolveCartService {
2442
2580
  throw tracking;
2443
2581
  }
2444
2582
  body.tracking = tracking;
2445
- return this.http.post(`${this.config.api_url}/service/set-checkout.php`, body, {
2583
+ return this.http
2584
+ .post(`${this.config.api_url}/set-checkout.php`, body, {
2446
2585
  headers: {
2447
2586
  'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
2448
2587
  },
2449
- params: {
2450
- ws_id: this.config.wsid
2451
- },
2452
2588
  responseType: 'json',
2453
2589
  observe: 'body'
2454
- }).pipe(map(http_response => this.responseHandler.validateSingleHttpResponse(http_response, (response) => {
2590
+ })
2591
+ .pipe(map((http_response) => this.responseHandler.validateSingleHttpResponse(http_response, (response) => {
2455
2592
  this._cached_tracking = 0;
2456
2593
  return new EsolveCheckoutResult(response);
2457
2594
  })), catchError((errorRes) => {
@@ -2460,7 +2597,8 @@ class EsolveCartService {
2460
2597
  }));
2461
2598
  }
2462
2599
  /**
2463
- * Processes the eSolve tree records.
2600
+ * Processes the eSolve tree records
2601
+ *
2464
2602
  * @param cart_item_records Records to process
2465
2603
  * @returns An array of processed cart items
2466
2604
  */
@@ -2476,6 +2614,7 @@ class EsolveCartService {
2476
2614
  }
2477
2615
  /**
2478
2616
  * Processes the eSolve cart totals
2617
+ *
2479
2618
  * @param record Data to process
2480
2619
  * @returns Processed cart totals
2481
2620
  */
@@ -2484,17 +2623,17 @@ class EsolveCartService {
2484
2623
  return cart_totals;
2485
2624
  }
2486
2625
  }
2487
- EsolveCartService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCartService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }, { token: EsolveErrorHandlerService }, { token: EsolveResponseHandlerService }], target: i0.ɵɵFactoryTarget.Injectable });
2488
- EsolveCartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCartService, providedIn: 'root' });
2489
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCartService, decorators: [{
2626
+ EsolveCartService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveCartService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }, { token: EsolveErrorHandlerService }, { token: EsolveResponseHandlerService }], target: i0.ɵɵFactoryTarget.Injectable });
2627
+ EsolveCartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveCartService, providedIn: 'root' });
2628
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveCartService, decorators: [{
2490
2629
  type: Injectable,
2491
2630
  args: [{
2492
- providedIn: 'root'
2631
+ providedIn: 'root',
2493
2632
  }]
2494
2633
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
2495
2634
  type: Inject,
2496
2635
  args: [ESOLVE_CONNECT_CONFIG]
2497
- }] }, { type: i1$1.HttpClient }, { type: EsolveErrorHandlerService }, { type: EsolveResponseHandlerService }]; } });
2636
+ }] }, { type: i1$2.HttpClient }, { type: EsolveErrorHandlerService }, { type: EsolveResponseHandlerService }]; } });
2498
2637
 
2499
2638
  class EsolveVaultItemResult extends EsolveResponseResult {
2500
2639
  constructor(response) {
@@ -2608,61 +2747,15 @@ class EsolvePaymentService {
2608
2747
  this.errorHandler = errorHandler;
2609
2748
  this.responseHandler = responseHandler;
2610
2749
  }
2611
- /**
2612
- * Processes the eSolve payment method records.
2613
- * @param records Records to process
2614
- * @returns An array of processed payment methods.
2615
- */
2616
- processPaymentMethods(records) {
2617
- const payment_methods = [];
2618
- if (records) {
2619
- for (const record of records) {
2620
- const payment_method = new EsolvePaymentMethod(record);
2621
- payment_methods.push(payment_method);
2622
- }
2623
- }
2624
- return payment_methods;
2625
- }
2626
- /**
2627
- * Processes the eSolve vault records.
2628
- * @param records Records to process
2629
- * @returns An array of processed vault items (a.k.a. cards)
2630
- */
2631
- processVaultItems(records) {
2632
- const vault = [];
2633
- if (records) {
2634
- for (const record of records) {
2635
- const vault_item = new EsolveVaultItem(+record.id, +record.payment_methods_id, record.last4, record.brand, record.expiry_timestamp);
2636
- vault.push(vault_item);
2637
- }
2638
- }
2639
- return vault;
2640
- }
2641
- generateExpiry(card_data) {
2642
- const month_string = card_data.expiry_month.padStart(2, '0');
2643
- const year_string = card_data.expiry_year.padStart(4, '0');
2644
- return `${month_string}${year_string}`;
2645
- }
2646
2750
  /**
2647
2751
  * Retrieves a list of payment methods.
2648
2752
  * @param options Filter options
2649
2753
  * @returns An `Observable` with an array of payment methods
2650
2754
  */
2651
2755
  getPaymentMethods(options) {
2652
- let params = new HttpParams();
2653
- params = params.set('ws_id', this.config.wsid);
2654
- if (options) {
2655
- if (typeof options.live !== 'undefined') {
2656
- params = params.set('live', options.live);
2657
- }
2658
- if (typeof options.location_id !== 'undefined') {
2659
- params = params.set('location_id', options.location_id);
2660
- }
2661
- if (typeof options.is_gateway !== 'undefined') {
2662
- params = params.set('is_gateway', options.is_gateway);
2663
- }
2664
- }
2665
- return this.http.get(`${this.config.api_url}/service/get-payment-methods.php`, { params }).pipe(map(response => {
2756
+ return this.http
2757
+ .get(`${this.config.api_url}/get-payment-methods.php`, { params: { ...options } })
2758
+ .pipe(map((response) => {
2666
2759
  if (response.records === undefined) {
2667
2760
  throw response;
2668
2761
  }
@@ -2676,11 +2769,12 @@ class EsolvePaymentService {
2676
2769
  */
2677
2770
  getVault(payment_methods_id) {
2678
2771
  let params = new HttpParams();
2679
- params = params.set('ws_id', this.config.wsid);
2680
2772
  if (typeof payment_methods_id !== 'undefined') {
2681
2773
  params = params.set('payment_methods_id', payment_methods_id);
2682
2774
  }
2683
- return this.http.get(`${this.config.api_url}/service/get-vault.php`, { params }).pipe(map(response => {
2775
+ return this.http
2776
+ .get(`${this.config.api_url}/get-vault.php`, { params })
2777
+ .pipe(map((response) => {
2684
2778
  if (response.records === undefined) {
2685
2779
  throw response;
2686
2780
  }
@@ -2703,28 +2797,26 @@ class EsolvePaymentService {
2703
2797
  card_expiry: this.generateExpiry(card_data)
2704
2798
  }
2705
2799
  };
2706
- return this.http.post(`${this.config.api_url}/service/set-vault.php`, body, {
2800
+ return this.http
2801
+ .post(`${this.config.api_url}/set-vault.php`, body, {
2707
2802
  headers: {
2708
2803
  'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
2709
2804
  },
2710
- params: {
2711
- ws_id: this.config.wsid
2712
- },
2713
2805
  responseType: 'json',
2714
- observe: 'body'
2715
- }).pipe(map(http_response => this.responseHandler.validateSingleHttpResponse(http_response, (response) => new EsolveVaultItemResult(response))), catchError((errorRes) => {
2806
+ observe: 'body',
2807
+ })
2808
+ .pipe(map((http_response) => this.responseHandler.validateSingleHttpResponse(http_response, (response) => new EsolveVaultItemResult(response))), catchError((errorRes) => {
2716
2809
  return this.errorHandler.handleHttpPostError('set-vault', errorRes);
2717
2810
  }));
2718
2811
  }
2719
2812
  deleteVaultItem(id) {
2720
- return this.http.delete(`${this.config.api_url}/service/delete-vault.php`, {
2721
- params: {
2722
- ws_id: this.config.wsid,
2723
- id: id
2724
- },
2813
+ return this.http
2814
+ .delete(`${this.config.api_url}/delete-vault.php`, {
2815
+ params: { id },
2725
2816
  responseType: 'json',
2726
- observe: 'body'
2727
- }).pipe(map(http_response => {
2817
+ observe: 'body',
2818
+ })
2819
+ .pipe(map((http_response) => {
2728
2820
  if ((http_response.result === undefined) ||
2729
2821
  (http_response.result === null) ||
2730
2822
  (http_response.result.status !== 'success')) {
@@ -2736,7 +2828,9 @@ class EsolvePaymentService {
2736
2828
  }));
2737
2829
  }
2738
2830
  /**
2739
- * Sets the payment for the specified transaction using selected payment method.
2831
+ * Sets the payment for the specified transaction using selected payment
2832
+ * method.
2833
+ *
2740
2834
  * @param transaction_id eSolve ID to the transaction
2741
2835
  * @param payment_methods_id eSolve ID to the selected payment method
2742
2836
  * @param card ID of selected card from the vault or information to a brand new card
@@ -2760,31 +2854,65 @@ class EsolvePaymentService {
2760
2854
  card_expiry: this.generateExpiry(card)
2761
2855
  };
2762
2856
  }
2763
- return this.http.post(`${this.config.api_url}/service/set-payment.php`, body, {
2857
+ return this.http
2858
+ .post(`${this.config.api_url}/set-payment.php`, body, {
2764
2859
  headers: {
2765
2860
  'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
2766
2861
  },
2767
- params: {
2768
- ws_id: this.config.wsid
2769
- },
2770
2862
  responseType: 'json',
2771
- observe: 'body'
2772
- }).pipe(map(http_response => this.responseHandler.validateSingleHttpResponse(http_response, (response) => new EsolvePaymentResult(response))), catchError((errorRes) => {
2863
+ observe: 'body',
2864
+ })
2865
+ .pipe(map((http_response) => this.responseHandler.validateSingleHttpResponse(http_response, (response) => new EsolvePaymentResult(response))), catchError((errorRes) => {
2773
2866
  return this.errorHandler.handleHttpPostError('set-payment', errorRes);
2774
2867
  }));
2775
2868
  }
2869
+ /**
2870
+ * Processes the eSolve payment method records.
2871
+ * @param records Records to process
2872
+ * @returns An array of processed payment methods.
2873
+ */
2874
+ processPaymentMethods(records) {
2875
+ const payment_methods = [];
2876
+ if (records) {
2877
+ for (const record of records) {
2878
+ const payment_method = new EsolvePaymentMethod(record);
2879
+ payment_methods.push(payment_method);
2880
+ }
2881
+ }
2882
+ return payment_methods;
2883
+ }
2884
+ /**
2885
+ * Processes the eSolve vault records.
2886
+ * @param records Records to process
2887
+ * @returns An array of processed vault items (a.k.a. cards)
2888
+ */
2889
+ processVaultItems(records) {
2890
+ const vault = [];
2891
+ if (records) {
2892
+ for (const record of records) {
2893
+ const vault_item = new EsolveVaultItem(+record.id, +record.payment_methods_id, record.last4, record.brand, record.expiry_timestamp);
2894
+ vault.push(vault_item);
2895
+ }
2896
+ }
2897
+ return vault;
2898
+ }
2899
+ generateExpiry(card_data) {
2900
+ const month_string = card_data.expiry_month.padStart(2, '0');
2901
+ const year_string = card_data.expiry_year.padStart(4, '0');
2902
+ return `${month_string}${year_string}`;
2903
+ }
2776
2904
  }
2777
- EsolvePaymentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolvePaymentService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }, { token: EsolveErrorHandlerService }, { token: EsolveResponseHandlerService }], target: i0.ɵɵFactoryTarget.Injectable });
2778
- EsolvePaymentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolvePaymentService, providedIn: 'root' });
2779
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolvePaymentService, decorators: [{
2905
+ EsolvePaymentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolvePaymentService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }, { token: EsolveErrorHandlerService }, { token: EsolveResponseHandlerService }], target: i0.ɵɵFactoryTarget.Injectable });
2906
+ EsolvePaymentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolvePaymentService, providedIn: 'root' });
2907
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolvePaymentService, decorators: [{
2780
2908
  type: Injectable,
2781
2909
  args: [{
2782
- providedIn: 'root'
2910
+ providedIn: 'root',
2783
2911
  }]
2784
2912
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
2785
2913
  type: Inject,
2786
2914
  args: [ESOLVE_CONNECT_CONFIG]
2787
- }] }, { type: i1$1.HttpClient }, { type: EsolveErrorHandlerService }, { type: EsolveResponseHandlerService }]; } });
2915
+ }] }, { type: i1$2.HttpClient }, { type: EsolveErrorHandlerService }, { type: EsolveResponseHandlerService }]; } });
2788
2916
 
2789
2917
  class EsolveShippingMethod {
2790
2918
  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) {
@@ -2842,37 +2970,12 @@ class EsolveShippingService {
2842
2970
  this.config = config;
2843
2971
  this.http = http;
2844
2972
  }
2845
- /**
2846
- * Processes the eSolve shipping method records.
2847
- * @param records Records to process
2848
- * @returns An array of processed shipping methods
2849
- */
2850
- processShippingMethods(records) {
2851
- const shipping_methods = [];
2852
- if (records) {
2853
- for (const record of records) {
2854
- const shipping_method = new EsolveShippingMethod(+record.id, record.carrier_name, record.delivery_category, record.description, record.location, record.pricing, record.link_to_carrier_website, +record.days_to_deliver, record.shipping_cost_calculation_method, record.insurance_cost_calculation_method, +record.insurance_cost_percentage, +record.metric_factor, record.allow_immediate_payment_processing, record.allow_postal_address, record.allow_physical_address, record.client_to_collect, record.is_default_shipping_method, +record.location_id, record.use_zones, +record.min_distance, +record.max_distance, +record.shipping_surge_condition, +record.shipping_surge_percentage, +record.sort_priority, record.shipping_group, record.shipping_slot_identifier, +record.shipping_slot_delay_hours, record.image_url);
2855
- shipping_methods.push(shipping_method);
2856
- }
2857
- }
2858
- return shipping_methods;
2859
- }
2860
- /**
2861
- * Processes the eSolve shipping costs record.
2862
- * @param record Data to process
2863
- * @returns Processed shipping costs
2864
- */
2865
- processShippingCost(record) {
2866
- const shipping_cost = new EsolveShippingCost(+record.shipping_total, +record.vat_on_shipping, +record.total_saving_on_shipping, +record.insurance_total, +record.vat_on_insurance, +record.total_saving_on_insurance);
2867
- return shipping_cost;
2868
- }
2869
2973
  /**
2870
2974
  * Retrieves a list of shipping methods
2871
2975
  * @returns An `Observable` with an array of shipping methods
2872
2976
  */
2873
2977
  getShippingMethods(options) {
2874
2978
  let params = new HttpParams();
2875
- params = params.set('ws_id', this.config.wsid);
2876
2979
  if (options) {
2877
2980
  if (typeof options.addresses_id !== 'undefined') {
2878
2981
  params = params.set('addresses_id', options.addresses_id);
@@ -2881,7 +2984,7 @@ class EsolveShippingService {
2881
2984
  params = params.set('location_id', options.location_id);
2882
2985
  }
2883
2986
  }
2884
- return this.http.get(`${this.config.api_url}/service/get-shipping-methods.php`, { params }).pipe(map(response => {
2987
+ return this.http.get(`${this.config.api_url}/get-shipping-methods.php`, { params }).pipe(map(response => {
2885
2988
  if (response.records === undefined) {
2886
2989
  throw response;
2887
2990
  }
@@ -2896,23 +2999,24 @@ class EsolveShippingService {
2896
2999
  getShippingCost(shipping_id, addresses_id, location_id) {
2897
3000
  try {
2898
3001
  let params = new HttpParams();
2899
- params = params.set('ws_id', this.config.wsid);
2900
- if (typeof shipping_id !== 'undefined') {
2901
- params = params.set('shipping_id', shipping_id);
3002
+ if (typeof shipping_id === 'undefined') {
3003
+ throw new Error('Shipping ID is required');
2902
3004
  }
2903
3005
  else {
2904
- throw new Error('Shipping ID is required');
3006
+ params = params.set('shipping_id', shipping_id);
2905
3007
  }
2906
- if (typeof addresses_id !== 'undefined') {
2907
- params = params.set('addresses_id', addresses_id);
3008
+ if (typeof addresses_id === 'undefined') {
3009
+ throw new Error('Address ID is required');
2908
3010
  }
2909
3011
  else {
2910
- throw new Error('Address ID is required');
3012
+ params = params.set('addresses_id', addresses_id);
2911
3013
  }
2912
3014
  if (typeof location_id !== 'undefined') {
2913
3015
  params = params.set('location_id', location_id);
2914
3016
  }
2915
- return this.http.get(`${this.config.api_url}/service/get-shipping-cost.php`, { params }).pipe(map(response => {
3017
+ return this.http
3018
+ .get(`${this.config.api_url}/get-shipping-cost.php`, { params })
3019
+ .pipe(map((response) => {
2916
3020
  if (response.records === undefined) {
2917
3021
  throw response;
2918
3022
  }
@@ -2923,18 +3027,42 @@ class EsolveShippingService {
2923
3027
  return throwError(err);
2924
3028
  }
2925
3029
  }
3030
+ /**
3031
+ * Processes the eSolve shipping method records.
3032
+ * @param records Records to process
3033
+ * @returns An array of processed shipping methods
3034
+ */
3035
+ processShippingMethods(records) {
3036
+ const shipping_methods = [];
3037
+ if (records) {
3038
+ for (const record of records) {
3039
+ const shipping_method = new EsolveShippingMethod(+record.id, record.carrier_name, record.delivery_category, record.description, record.location, record.pricing, record.link_to_carrier_website, +record.days_to_deliver, record.shipping_cost_calculation_method, record.insurance_cost_calculation_method, +record.insurance_cost_percentage, +record.metric_factor, record.allow_immediate_payment_processing, record.allow_postal_address, record.allow_physical_address, record.client_to_collect, record.is_default_shipping_method, +record.location_id, record.use_zones, +record.min_distance, +record.max_distance, +record.shipping_surge_condition, +record.shipping_surge_percentage, +record.sort_priority, record.shipping_group, record.shipping_slot_identifier, +record.shipping_slot_delay_hours, record.image_url);
3040
+ shipping_methods.push(shipping_method);
3041
+ }
3042
+ }
3043
+ return shipping_methods;
3044
+ }
3045
+ /**
3046
+ * Processes the eSolve shipping costs record.
3047
+ * @param record Data to process
3048
+ * @returns Processed shipping costs
3049
+ */
3050
+ processShippingCost(record) {
3051
+ const shipping_cost = new EsolveShippingCost(+record.shipping_total, +record.vat_on_shipping, +record.total_saving_on_shipping, +record.insurance_total, +record.vat_on_insurance, +record.total_saving_on_insurance);
3052
+ return shipping_cost;
3053
+ }
2926
3054
  }
2927
- EsolveShippingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveShippingService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
2928
- EsolveShippingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveShippingService, providedIn: 'root' });
2929
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveShippingService, decorators: [{
3055
+ EsolveShippingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveShippingService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
3056
+ EsolveShippingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveShippingService, providedIn: 'root' });
3057
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveShippingService, decorators: [{
2930
3058
  type: Injectable,
2931
3059
  args: [{
2932
- providedIn: 'root'
3060
+ providedIn: 'root',
2933
3061
  }]
2934
3062
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
2935
3063
  type: Inject,
2936
3064
  args: [ESOLVE_CONNECT_CONFIG]
2937
- }] }, { type: i1$1.HttpClient }]; } });
3065
+ }] }, { type: i1$2.HttpClient }]; } });
2938
3066
 
2939
3067
  class EsolveLocationsService {
2940
3068
  constructor(config, http) {
@@ -2943,12 +3071,13 @@ class EsolveLocationsService {
2943
3071
  }
2944
3072
  /**
2945
3073
  * Retrieves a list of stock locations
3074
+ *
2946
3075
  * @returns An `Observable` with an array of stock locations
2947
3076
  */
2948
3077
  getStockLocations() {
2949
- let params = new HttpParams();
2950
- params = params.set('ws_id', this.config.wsid);
2951
- return this.http.get(`${this.config.api_url}/service/get-locations.php`, { params }).pipe(map(response => {
3078
+ return this.http
3079
+ .get(`${this.config.api_url}/get-locations.php`)
3080
+ .pipe(map((response) => {
2952
3081
  if (response.records === undefined) {
2953
3082
  throw response;
2954
3083
  }
@@ -2957,6 +3086,7 @@ class EsolveLocationsService {
2957
3086
  }
2958
3087
  /**
2959
3088
  * Processes the eSolve stock location records.
3089
+ *
2960
3090
  * @param records Records to process
2961
3091
  * @returns An array of processed stock location records
2962
3092
  */
@@ -2970,17 +3100,17 @@ class EsolveLocationsService {
2970
3100
  return stock_locations;
2971
3101
  }
2972
3102
  }
2973
- EsolveLocationsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveLocationsService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
2974
- EsolveLocationsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveLocationsService, providedIn: 'root' });
2975
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveLocationsService, decorators: [{
3103
+ EsolveLocationsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveLocationsService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
3104
+ EsolveLocationsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveLocationsService, providedIn: 'root' });
3105
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveLocationsService, decorators: [{
2976
3106
  type: Injectable,
2977
3107
  args: [{
2978
- providedIn: 'root'
3108
+ providedIn: 'root',
2979
3109
  }]
2980
3110
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
2981
3111
  type: Inject,
2982
3112
  args: [ESOLVE_CONNECT_CONFIG]
2983
- }] }, { type: i1$1.HttpClient }]; } });
3113
+ }] }, { type: i1$2.HttpClient }]; } });
2984
3114
 
2985
3115
  /*
2986
3116
  * Public API Surface of ng-esolve-connect
@@ -2990,5 +3120,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
2990
3120
  * Generated bundle index. Do not edit.
2991
3121
  */
2992
3122
 
2993
- 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 };
3123
+ export { EsolveAccountService, EsolveAddress, EsolveAddressResult, EsolveAuthService, EsolveBankingDetails, EsolveBanner, EsolveBannerImage, EsolveBannerImageHotspot, EsolveBannerService, EsolveCartItem, EsolveCartService, EsolveCartTotals, EsolveCategoryTreeItem, EsolveCategoryTreeService, EsolveChangePasswordResult, EsolveCheckoutResult, EsolveCookieService, EsolveErrorHandlerService, EsolveHeading, 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 };
2994
3124
  //# sourceMappingURL=esolve-ng-esolve-connect.mjs.map