@esolve/ng-esolve-connect 0.10.3 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) 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 +41 -32
  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/geocoder/esolve-geocode-address-record.mjs +2 -0
  21. package/esm2020/lib/shared/geocoder/esolve-geocode-address-result.mjs +12 -0
  22. package/esm2020/lib/shared/geocoder/esolve-geocode-coords-result.mjs +7 -0
  23. package/esm2020/lib/shared/geocoder/esolve-geocode-result-record.mjs +2 -0
  24. package/esm2020/lib/shared/geocoder/esolve-geocode-result.mjs +11 -0
  25. package/esm2020/lib/shared/geocoder/esolve-geocoder.service.mjs +69 -0
  26. package/esm2020/lib/shared/response-handler/esolve-response-handler.service.mjs +3 -3
  27. package/esm2020/lib/shared/seo/esolve-seo.service.mjs +4 -4
  28. package/esm2020/lib/shipping/esolve-shipping.service.mjs +39 -39
  29. package/esm2020/lib/stock/esolve-stock-item.mjs +6 -1
  30. package/esm2020/lib/stock/esolve-stock-record.mjs +1 -1
  31. package/esm2020/lib/stock/esolve-stock.service.mjs +38 -39
  32. package/esm2020/lib/topics/esolve-topic.service.mjs +6 -10
  33. package/esm2020/public-api.mjs +8 -1
  34. package/fesm2015/esolve-ng-esolve-connect.mjs +647 -422
  35. package/fesm2015/esolve-ng-esolve-connect.mjs.map +1 -1
  36. package/fesm2020/esolve-ng-esolve-connect.mjs +641 -422
  37. package/fesm2020/esolve-ng-esolve-connect.mjs.map +1 -1
  38. package/lib/auth/esolve-auth.service.d.ts +2 -2
  39. package/lib/cart/esolve-cart.service.d.ts +8 -1
  40. package/lib/category-tree/esolve-category-tree.service.d.ts +4 -1
  41. package/lib/locations/esolve-locations.service.d.ts +2 -0
  42. package/lib/media/esolve-heading-record.d.ts +5 -0
  43. package/lib/media/esolve-heading.d.ts +5 -0
  44. package/lib/media/esolve-media.service.d.ts +25 -4
  45. package/lib/news/esolve-news.service.d.ts +1 -1
  46. package/lib/payment/esolve-payment.service.d.ts +16 -14
  47. package/lib/session/esolve-session.d.ts +3 -4
  48. package/lib/session/esolve-session.service.d.ts +6 -4
  49. package/lib/session/esolve-stored-session.d.ts +2 -2
  50. package/lib/shared/cookie/esolve-cookie.service.d.ts +36 -0
  51. package/lib/shared/geocoder/esolve-geocode-address-record.d.ts +9 -0
  52. package/lib/shared/geocoder/esolve-geocode-address-result.d.ts +10 -0
  53. package/lib/shared/geocoder/esolve-geocode-coords-result.d.ts +5 -0
  54. package/lib/shared/geocoder/esolve-geocode-result-record.d.ts +10 -0
  55. package/lib/shared/geocoder/esolve-geocode-result.d.ts +11 -0
  56. package/lib/shared/geocoder/esolve-geocoder.service.d.ts +15 -0
  57. package/lib/shipping/esolve-shipping.service.d.ts +11 -11
  58. package/lib/stock/esolve-stock-item.d.ts +8 -0
  59. package/lib/stock/esolve-stock-record.d.ts +1 -0
  60. package/lib/stock/esolve-stock.service.d.ts +10 -10
  61. package/package.json +5 -4
  62. package/public-api.d.ts +6 -0
@@ -1,13 +1,13 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, Injectable, Inject, NgModule } from '@angular/core';
3
- import { CommonModule } from '@angular/common';
2
+ import { InjectionToken, PLATFORM_ID, Injectable, Inject, Optional, NgModule } from '@angular/core';
3
+ import { isPlatformBrowser, CommonModule } from '@angular/common';
4
4
  import * as i1$2 from '@angular/common/http';
5
5
  import { HttpParams, HTTP_INTERCEPTORS, HttpClientModule, HttpErrorResponse, HttpHeaders } from '@angular/common/http';
6
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
9
  import * as i1$1 from '@angular/platform-browser';
10
- import { tap, catchError, map, switchMap } from 'rxjs/operators';
10
+ import { map, tap, catchError, switchMap } from 'rxjs/operators';
11
11
 
12
12
  const ESOLVE_CONNECT_CONFIG = new InjectionToken('esolve.connect.config');
13
13
  // For future development
@@ -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,14 +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, cookieService) {
149
+ constructor(platformId, config, cookieService) {
150
+ this.platformId = platformId;
50
151
  this.config = config;
51
152
  this.cookieService = cookieService;
52
153
  this.storage_key = 'ngEslvUserSession';
53
154
  this.setStorageKey();
54
- this._session = new BehaviorSubject(new EsolveSession(0, ''));
155
+ this._session = new BehaviorSubject(new EsolveSession());
55
156
  this.session = this._session.asObservable();
157
+ this.is_browser = isPlatformBrowser(this.platformId);
56
158
  }
57
159
  get currentSession() {
58
160
  return this._session.value;
@@ -64,7 +166,9 @@ class EsolveSessionService {
64
166
  }
65
167
  }
66
168
  startTimer(callback, duration) {
67
- this.key_expiration_timer = setTimeout(callback, duration);
169
+ if (this.is_browser) {
170
+ this.key_expiration_timer = setTimeout(callback, duration);
171
+ }
68
172
  }
69
173
  clearTimer() {
70
174
  if (this.key_expiration_timer) {
@@ -72,54 +176,57 @@ class EsolveSessionService {
72
176
  }
73
177
  }
74
178
  restore(expirationCallback, invalidSessionCallback) {
75
- if (!this.currentSession.valid) {
76
- const stored_session_json = this.cookieService.get(this.storage_key);
77
- const stored_session = (stored_session_json ? JSON.parse(stored_session_json) : null);
78
- if (!stored_session) {
79
- invalidSessionCallback();
80
- return;
81
- }
82
- const expiration_date = new Date(stored_session._key_expiration_date);
83
- const loaded_session = new EsolveSession(stored_session.id, stored_session._key, expiration_date);
84
- if (!loaded_session.expired) {
85
- this._session.next(loaded_session);
86
- const expiration_duration = expiration_date.getTime() - new Date().getTime();
87
- this.startTimer(expirationCallback, expiration_duration);
88
- }
89
- else {
90
- this.cookieService.delete(this.storage_key);
91
- expirationCallback(loaded_session);
92
- }
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);
93
197
  }
94
198
  }
95
199
  handleSession(user_id, key, expiry_time, expires, expirationCallback) {
96
200
  const expiration_date = new Date(expiry_time * 1000);
97
201
  const session = new EsolveSession(user_id, key, expiration_date);
98
- this.cookieService.set(this.storage_key, JSON.stringify(session), expiration_date);
202
+ this.cookieService.set(this.storage_key, JSON.stringify(session), expiration_date, '/');
99
203
  this._session.next(session);
100
204
  this.startTimer(expirationCallback, expires * 1000);
101
205
  }
102
206
  handleUpdateSession(user_id, callback) {
103
207
  const current_session = this.currentSession;
104
208
  current_session.updateUser(user_id);
105
- this.cookieService.set(this.storage_key, JSON.stringify(current_session));
209
+ this.cookieService.set(this.storage_key, JSON.stringify(current_session), current_session.expiration_date, '/');
106
210
  this._session.next(current_session);
107
211
  if (typeof callback === 'function') {
108
212
  callback();
109
213
  }
110
214
  }
111
215
  }
112
- EsolveSessionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveSessionService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1.CookieService }], target: i0.ɵɵFactoryTarget.Injectable });
113
- EsolveSessionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveSessionService, providedIn: 'root' });
114
- 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: [{
115
219
  type: Injectable,
116
220
  args: [{
117
- providedIn: 'root'
221
+ providedIn: 'root',
118
222
  }]
119
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
223
+ }], ctorParameters: function () { return [{ type: Object, decorators: [{
224
+ type: Inject,
225
+ args: [PLATFORM_ID]
226
+ }] }, { type: undefined, decorators: [{
120
227
  type: Inject,
121
228
  args: [ESOLVE_CONNECT_CONFIG]
122
- }] }, { type: i1.CookieService }]; } });
229
+ }] }, { type: EsolveCookieService }]; } });
123
230
 
124
231
  class EsolveAuthInterceptorService {
125
232
  constructor(config, session) {
@@ -127,8 +234,8 @@ class EsolveAuthInterceptorService {
127
234
  this.session = session;
128
235
  }
129
236
  intercept(req, next) {
130
- if (req.url.startsWith(`${this.config.api_url}/service/`)) {
131
- 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}/`, '');
132
239
  const old_params_keys = req.params.keys();
133
240
  const modified_url = req.url;
134
241
  let params = new HttpParams();
@@ -138,6 +245,7 @@ class EsolveAuthInterceptorService {
138
245
  params = params.set('key', session.key);
139
246
  }
140
247
  }
248
+ params = params.set('ws_id', this.config.wsid);
141
249
  old_params_keys.forEach(key => {
142
250
  params = params.set(key, req.params.get(key) || '');
143
251
  });
@@ -150,9 +258,9 @@ class EsolveAuthInterceptorService {
150
258
  return next.handle(req);
151
259
  }
152
260
  }
153
- 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 });
154
- EsolveAuthInterceptorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAuthInterceptorService });
155
- 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: [{
156
264
  type: Injectable
157
265
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
158
266
  type: Inject,
@@ -177,14 +285,14 @@ class NgEsolveConnectModule {
177
285
  };
178
286
  }
179
287
  }
180
- NgEsolveConnectModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: NgEsolveConnectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
181
- 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,
182
290
  HttpClientModule] });
183
- 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: [[
184
292
  CommonModule,
185
293
  HttpClientModule
186
294
  ]] });
187
- 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: [{
188
296
  type: NgModule,
189
297
  args: [{
190
298
  declarations: [],
@@ -299,9 +407,9 @@ class EsolveErrorHandlerService {
299
407
  return new EsolveHttpError('error', result.message, result.code);
300
408
  }
301
409
  }
302
- EsolveErrorHandlerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveErrorHandlerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
303
- EsolveErrorHandlerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveErrorHandlerService, providedIn: 'root' });
304
- 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: [{
305
413
  type: Injectable,
306
414
  args: [{
307
415
  providedIn: 'root'
@@ -338,9 +446,9 @@ class EsolveResponseHandlerService {
338
446
  return resultHandler(response);
339
447
  }
340
448
  }
341
- EsolveResponseHandlerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveResponseHandlerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
342
- EsolveResponseHandlerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveResponseHandlerService, providedIn: 'root' });
343
- 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: [{
344
452
  type: Injectable,
345
453
  args: [{
346
454
  providedIn: 'root'
@@ -455,9 +563,9 @@ class EsolveSeoService {
455
563
  this.setPageKeywordsTags(seoInfo.keywords);
456
564
  }
457
565
  }
458
- EsolveSeoService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveSeoService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.Title }, { token: i1$1.Meta }], target: i0.ɵɵFactoryTarget.Injectable });
459
- EsolveSeoService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveSeoService, providedIn: 'root' });
460
- 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: [{
461
569
  type: Injectable,
462
570
  args: [{
463
571
  providedIn: 'root'
@@ -467,6 +575,97 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
467
575
  args: [ESOLVE_CONNECT_CONFIG]
468
576
  }] }, { type: i1$1.Title }, { type: i1$1.Meta }]; } });
469
577
 
578
+ class EsolveGeocodeAddressResult {
579
+ constructor(street_number, street, suburb, city, province, country, postal_code) {
580
+ this.street_number = street_number;
581
+ this.street = street;
582
+ this.suburb = suburb;
583
+ this.city = city;
584
+ this.province = province;
585
+ this.country = country;
586
+ this.postal_code = postal_code;
587
+ }
588
+ }
589
+
590
+ class EsolveGeocodeCoordsResult {
591
+ constructor(latitude, longitude) {
592
+ this.latitude = latitude;
593
+ this.longitude = longitude;
594
+ }
595
+ }
596
+
597
+ class EsolveGeocodeResult {
598
+ constructor(formatted_address, address, coords, status, checksum, cached) {
599
+ this.formatted_address = formatted_address;
600
+ this.address = address;
601
+ this.coords = coords;
602
+ this.status = status;
603
+ this.checksum = checksum;
604
+ this.cached = cached;
605
+ }
606
+ }
607
+
608
+ class EsolveGeocoderService {
609
+ constructor(config, http) {
610
+ this.config = config;
611
+ this.http = http;
612
+ }
613
+ geocode(street_number, street, suburb, city, province, country, postal_code) {
614
+ return this.http
615
+ .get(`${this.config.api_url}/get-geocode.php`, {
616
+ params: {
617
+ street_number,
618
+ street,
619
+ suburb,
620
+ city,
621
+ province,
622
+ country,
623
+ postal_code,
624
+ }
625
+ })
626
+ .pipe(map((response) => {
627
+ if (response.records === undefined) {
628
+ throw response;
629
+ }
630
+ const record = response.records;
631
+ return this.processGeocodeResult(record);
632
+ }));
633
+ }
634
+ reverseGeocode(latitude, longitude) {
635
+ return this.http
636
+ .get(`${this.config.api_url}/get-geocode.php`, {
637
+ params: {
638
+ latitude: latitude,
639
+ longitude: longitude,
640
+ }
641
+ })
642
+ .pipe(map((response) => {
643
+ if (response.records === undefined) {
644
+ throw response;
645
+ }
646
+ const record = response.records;
647
+ return this.processGeocodeResult(record);
648
+ }));
649
+ }
650
+ processGeocodeResult(record) {
651
+ const geocode_address = new EsolveGeocodeAddressResult(record.address.street_number, record.address.street, record.address.suburb, record.address.city, record.address.province, record.address.country, record.address.postal_code);
652
+ const geocode_coords = new EsolveGeocodeCoordsResult(record.latitude, record.longitude);
653
+ const geocode_result = new EsolveGeocodeResult(record.formatted_address, geocode_address, geocode_coords, record.status, record.checksum, record.cached);
654
+ return geocode_result;
655
+ }
656
+ }
657
+ EsolveGeocoderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveGeocoderService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
658
+ EsolveGeocoderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveGeocoderService, providedIn: 'root' });
659
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveGeocoderService, decorators: [{
660
+ type: Injectable,
661
+ args: [{
662
+ providedIn: 'root',
663
+ }]
664
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
665
+ type: Inject,
666
+ args: [ESOLVE_CONNECT_CONFIG]
667
+ }] }, { type: i1$2.HttpClient }]; } });
668
+
470
669
  class EsolveAuthService {
471
670
  constructor(config, http, session, errorHandler, cookieService) {
472
671
  this.config = config;
@@ -478,7 +677,7 @@ class EsolveAuthService {
478
677
  getAccessToken(email, password, anonymous = false) {
479
678
  let params = new HttpParams();
480
679
  if (anonymous) {
481
- params = params.set('anonymous', '1');
680
+ params = params.set('anonymous', true);
482
681
  }
483
682
  if (email !== '') {
484
683
  params = params.set('email', email);
@@ -486,25 +685,26 @@ class EsolveAuthService {
486
685
  if (password !== '') {
487
686
  params = params.set('password', password);
488
687
  }
489
- params = params.set('ws_id', this.config.wsid);
490
- return this.http.get(`${this.config.api_url}/service/get-access-token.php`, {
688
+ return this.http
689
+ .get(`${this.config.api_url}/get-access-token.php`, {
491
690
  params,
492
691
  headers: new HttpHeaders({
493
- 'Accept-Language': '*'
494
- })
495
- }).pipe(tap(responseData => {
692
+ 'Accept-Language': '*',
693
+ }),
694
+ })
695
+ .pipe(tap((responseData) => {
496
696
  if ((responseData.type === 'error') ||
497
697
  (responseData.type === 'exception')) {
498
698
  throw responseData;
499
699
  }
500
- }), catchError(this.handleError), tap(responseData => {
700
+ }), catchError(this.handleError), tap((responseData) => {
501
701
  this.handleAuthentication(responseData);
502
702
  }));
503
703
  }
504
704
  autoLogin() {
505
705
  this.session.restore(this.handleExpiration(), () => {
506
- this.getAccessToken('', '', true).toPromise().then(_ => { }, error => {
507
- console.log(error);
706
+ this.getAccessToken('', '', true).toPromise().then(() => { }, (error) => {
707
+ console.error(error);
508
708
  });
509
709
  });
510
710
  }
@@ -515,16 +715,15 @@ class EsolveAuthService {
515
715
  password
516
716
  }
517
717
  };
518
- return this.http.post(`${this.config.api_url}/service/set-login.php`, body, {
718
+ return this.http
719
+ .post(`${this.config.api_url}/set-login.php`, body, {
519
720
  headers: {
520
721
  'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
521
722
  },
522
- params: {
523
- ws_id: this.config.wsid
524
- },
525
723
  responseType: 'json',
526
724
  observe: 'body'
527
- }).pipe(map(response => {
725
+ })
726
+ .pipe(map((response) => {
528
727
  if ((response.responses === undefined) ||
529
728
  (response.responses.length <= 0)) {
530
729
  throw response;
@@ -535,7 +734,8 @@ class EsolveAuthService {
535
734
  throw login_response;
536
735
  }
537
736
  for (const response_log of login_response.log) {
538
- if ((response_log.type === 'success') && (response_log.message_code === 'login_success')) {
737
+ if ((response_log.type === 'success') &&
738
+ (response_log.message_code === 'login_success')) {
539
739
  this.session.handleUpdateSession(login_response.esolve_id);
540
740
  return login_response.esolve_id;
541
741
  }
@@ -553,18 +753,14 @@ class EsolveAuthService {
553
753
  checkAccessToken(session) {
554
754
  session = session || this.session.currentSession;
555
755
  const token = session?.key ?? '';
556
- const params = new HttpParams({
557
- fromObject: {
558
- key: token,
559
- ws_id: this.config.wsid
560
- }
561
- });
562
- return this.http.get(`${this.config.api_url}/service/get-access-token.php`, {
563
- params,
756
+ return this.http
757
+ .get(`${this.config.api_url}/get-access-token.php`, {
758
+ params: { key: token },
564
759
  headers: new HttpHeaders({
565
760
  'Accept-Language': '*'
566
- })
567
- }).pipe(map(responseData => {
761
+ }),
762
+ })
763
+ .pipe(map((responseData) => {
568
764
  if ((responseData.type === 'error') ||
569
765
  (responseData.type === 'exception') ||
570
766
  (!responseData.additional_data.key_okay)) {
@@ -572,7 +768,8 @@ class EsolveAuthService {
572
768
  }
573
769
  responseData.additional_data.key = token;
574
770
  return responseData;
575
- })).toPromise();
771
+ }))
772
+ .toPromise();
576
773
  }
577
774
  // Handlers
578
775
  handleExpiration() {
@@ -585,14 +782,15 @@ class EsolveAuthService {
585
782
  };
586
783
  }
587
784
  handleAuthentication(responseData) {
588
- if (responseData.additional_data.key) {
589
- this.session.handleSession(responseData.additional_data.user_id, responseData.additional_data.key, +responseData.additional_data.expiry_time, +responseData.additional_data.expires, this.handleExpiration());
785
+ if (!responseData.additional_data.key) {
786
+ return;
590
787
  }
788
+ this.session.handleSession(responseData.additional_data.user_id, responseData.additional_data.key, +responseData.additional_data.expiry_time, +responseData.additional_data.expires, this.handleExpiration());
591
789
  }
592
790
  handleError(errorRes) {
593
791
  const error = {
594
792
  message: 'An unknown error occurred',
595
- data: {}
793
+ data: {},
596
794
  };
597
795
  if ((!errorRes.type) ||
598
796
  (!errorRes.service_type) ||
@@ -608,17 +806,17 @@ class EsolveAuthService {
608
806
  return throwError(error);
609
807
  }
610
808
  }
611
- EsolveAuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAuthService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }, { token: EsolveSessionService }, { token: EsolveErrorHandlerService }, { token: i1.CookieService }], target: i0.ɵɵFactoryTarget.Injectable });
612
- EsolveAuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAuthService, providedIn: 'root' });
613
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAuthService, decorators: [{
809
+ 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 });
810
+ EsolveAuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveAuthService, providedIn: 'root' });
811
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveAuthService, decorators: [{
614
812
  type: Injectable,
615
813
  args: [{
616
- providedIn: 'root'
814
+ providedIn: 'root',
617
815
  }]
618
816
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
619
817
  type: Inject,
620
818
  args: [ESOLVE_CONNECT_CONFIG]
621
- }] }, { type: i1$2.HttpClient }, { type: EsolveSessionService }, { type: EsolveErrorHandlerService }, { type: i1.CookieService }]; } });
819
+ }] }, { type: i1$2.HttpClient }, { type: EsolveSessionService }, { type: EsolveErrorHandlerService }, { type: EsolveCookieService }]; } });
622
820
 
623
821
  class EsolveAddress {
624
822
  constructor(id, recipient, address_type, pobox, place_name, street_number, street, suburb, city, province, country, postal_code, latitude, longitude) {
@@ -963,25 +1161,22 @@ class EsolveAccountService {
963
1161
  const body = {
964
1162
  account: user_account_data
965
1163
  };
966
- return this.http.post(`${this.config.api_url}/service/set-user-account.php`, body, {
1164
+ return this.http
1165
+ .post(`${this.config.api_url}/set-user-account.php`, body, {
967
1166
  headers: {
968
1167
  'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
969
1168
  },
970
- params: {
971
- ws_id: this.config.wsid
972
- },
973
1169
  responseType: 'json',
974
1170
  observe: 'body'
975
- }).pipe(map((http_response) => this.responseHandler.validateSingleHttpResponse(http_response, (response) => new EsolveUserAccountResult(response))), catchError((errorRes) => {
1171
+ })
1172
+ .pipe(map((http_response) => this.responseHandler.validateSingleHttpResponse(http_response, (response) => new EsolveUserAccountResult(response))), catchError((errorRes) => {
976
1173
  return this.errorHandler.handleHttpPostError('set-user-account', errorRes);
977
1174
  }));
978
1175
  }
979
1176
  getUserAccount() {
980
- return this.http.get(`${this.config.api_url}/service/get-account.php`, {
981
- params: {
982
- ws_id: this.config.wsid
983
- }
984
- }).pipe(map(response => {
1177
+ return this.http
1178
+ .get(`${this.config.api_url}/get-account.php`)
1179
+ .pipe(map((response) => {
985
1180
  if ((response.records === undefined) ||
986
1181
  (response.records.length === 0)) {
987
1182
  throw response;
@@ -994,28 +1189,26 @@ class EsolveAccountService {
994
1189
  const body = {
995
1190
  address: address_post_data
996
1191
  };
997
- return this.http.post(`${this.config.api_url}/service/set-address.php`, body, {
1192
+ return this.http
1193
+ .post(`${this.config.api_url}/set-address.php`, body, {
998
1194
  headers: {
999
- 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
1000
- },
1001
- params: {
1002
- ws_id: this.config.wsid
1195
+ 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;',
1003
1196
  },
1004
1197
  responseType: 'json',
1005
- observe: 'body'
1006
- }).pipe(map((http_response) => this.responseHandler.validateSingleHttpResponse(http_response, (response) => new EsolveAddressResult(response))), catchError((errorRes) => {
1198
+ observe: 'body',
1199
+ })
1200
+ .pipe(map((http_response) => this.responseHandler.validateSingleHttpResponse(http_response, (response) => new EsolveAddressResult(response))), catchError((errorRes) => {
1007
1201
  return this.errorHandler.handleHttpPostError('set-registration', errorRes);
1008
1202
  }));
1009
1203
  }
1010
1204
  getAddresses() {
1011
1205
  try {
1012
1206
  this.loginGuard();
1013
- return this.http.get(`${this.config.api_url}/service/get-addresses.php`, {
1014
- params: {
1015
- ws_id: this.config.wsid,
1016
- user_id: this.user_id
1017
- }
1018
- }).pipe(map(response => {
1207
+ return this.http
1208
+ .get(`${this.config.api_url}/get-addresses.php`, {
1209
+ params: { user_id: this.user_id }
1210
+ })
1211
+ .pipe(map((response) => {
1019
1212
  if (response.records === undefined) {
1020
1213
  throw response;
1021
1214
  }
@@ -1027,14 +1220,13 @@ class EsolveAccountService {
1027
1220
  }
1028
1221
  }
1029
1222
  deleteAddress(id) {
1030
- return this.http.delete(`${this.config.api_url}/service/delete-address.php`, {
1031
- params: {
1032
- ws_id: this.config.wsid,
1033
- id: id
1034
- },
1223
+ return this.http
1224
+ .delete(`${this.config.api_url}/delete-address.php`, {
1225
+ params: { id },
1035
1226
  responseType: 'json',
1036
1227
  observe: 'body'
1037
- }).pipe(map(http_response => {
1228
+ })
1229
+ .pipe(map((http_response) => {
1038
1230
  if ((http_response.result === undefined) ||
1039
1231
  (http_response.result === null) ||
1040
1232
  (http_response.result.status !== 'success')) {
@@ -1049,16 +1241,15 @@ class EsolveAccountService {
1049
1241
  const body = {
1050
1242
  user: user_registration
1051
1243
  };
1052
- return this.http.post(`${this.config.api_url}/service/set-registration.php`, body, {
1244
+ return this.http
1245
+ .post(`${this.config.api_url}/set-registration.php`, body, {
1053
1246
  headers: {
1054
1247
  'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
1055
1248
  },
1056
- params: {
1057
- ws_id: this.config.wsid
1058
- },
1059
1249
  responseType: 'json',
1060
1250
  observe: 'body'
1061
- }).pipe(map(http_response => this.responseHandler.validateSingleHttpResponse(http_response, (response) => {
1251
+ })
1252
+ .pipe(map((http_response) => this.responseHandler.validateSingleHttpResponse(http_response, (response) => {
1062
1253
  if (response.auto_login) {
1063
1254
  this.sessionService.handleUpdateSession(response.esolve_id);
1064
1255
  }
@@ -1072,28 +1263,24 @@ class EsolveAccountService {
1072
1263
  password,
1073
1264
  confirm_password
1074
1265
  };
1075
- return this.http.post(`${this.config.api_url}/service/set-change-password.php`, body, {
1266
+ return this.http
1267
+ .post(`${this.config.api_url}/set-change-password.php`, body, {
1076
1268
  headers: {
1077
1269
  'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
1078
1270
  },
1079
- params: {
1080
- ws_id: this.config.wsid
1081
- },
1082
1271
  responseType: 'json',
1083
1272
  observe: 'body'
1084
- }).pipe(map(http_response => this.responseHandler.validateSingleHttpResponse(http_response, (response) => {
1273
+ })
1274
+ .pipe(map((http_response) => this.responseHandler.validateSingleHttpResponse(http_response, (response) => {
1085
1275
  return new EsolveChangePasswordResult(response);
1086
1276
  })), catchError((errorRes) => {
1087
1277
  return this.errorHandler.handleHttpPostError('set-change-password', errorRes);
1088
1278
  }));
1089
1279
  }
1090
1280
  sendForgotPasswordRequest(email) {
1091
- return this.http.get(`${this.config.api_url}/service/get-forgot-password.php`, {
1092
- params: {
1093
- ws_id: this.config.wsid,
1094
- email: email
1095
- }
1096
- }).pipe(map(response => {
1281
+ return this.http
1282
+ .get(`${this.config.api_url}/get-forgot-password.php`, { params: { email } })
1283
+ .pipe(map((response) => {
1097
1284
  if ((response.records === undefined) ||
1098
1285
  !('reset_link_sent' in response.records)) {
1099
1286
  throw response;
@@ -1102,7 +1289,8 @@ class EsolveAccountService {
1102
1289
  }));
1103
1290
  }
1104
1291
  resetPassword(reset_key, password, confirm_password, auto_login = true) {
1105
- return this.http.post(`${this.config.api_url}/service/set-forgot-password.php`, {
1292
+ return this.http
1293
+ .post(`${this.config.api_url}/set-forgot-password.php`, {
1106
1294
  reset_key,
1107
1295
  password,
1108
1296
  confirm_password,
@@ -1111,12 +1299,10 @@ class EsolveAccountService {
1111
1299
  headers: {
1112
1300
  'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
1113
1301
  },
1114
- params: {
1115
- ws_id: this.config.wsid
1116
- },
1117
1302
  responseType: 'json',
1118
1303
  observe: 'body'
1119
- }).pipe(map(http_response => this.responseHandler.validateSingleHttpResponse(http_response, (response) => {
1304
+ })
1305
+ .pipe(map((http_response) => this.responseHandler.validateSingleHttpResponse(http_response, (response) => {
1120
1306
  if (!response.login_required) {
1121
1307
  this.sessionService.handleUpdateSession(response.esolve_id);
1122
1308
  }
@@ -1128,13 +1314,14 @@ class EsolveAccountService {
1128
1314
  getTransactions(options = {}) {
1129
1315
  try {
1130
1316
  this.loginGuard();
1131
- return this.http.get(`${this.config.api_url}/service/get-transactions.php`, {
1317
+ return this.http
1318
+ .get(`${this.config.api_url}/get-transactions.php`, {
1132
1319
  params: {
1133
- ws_id: this.config.wsid,
1134
1320
  user_id: this.user_id,
1135
1321
  ...options,
1136
1322
  }
1137
- }).pipe(map(response => {
1323
+ })
1324
+ .pipe(map((response) => {
1138
1325
  if (response.records === undefined) {
1139
1326
  throw response;
1140
1327
  }
@@ -1152,14 +1339,16 @@ class EsolveAccountService {
1152
1339
  getTransaction(id) {
1153
1340
  try {
1154
1341
  this.loginGuard();
1155
- return this.http.get(`${this.config.api_url}/service/get-transactions.php`, {
1342
+ return this.http
1343
+ .get(`${this.config.api_url}/get-transactions.php`, {
1156
1344
  params: {
1157
- ws_id: this.config.wsid,
1158
1345
  user_id: this.user_id,
1159
1346
  transaction_id: id,
1160
1347
  }
1161
- }).pipe(map(response => {
1162
- if ((response.records === undefined) || (response.records.length <= 0)) {
1348
+ })
1349
+ .pipe(map((response) => {
1350
+ if ((response.records === undefined) ||
1351
+ (response.records.length <= 0)) {
1163
1352
  throw response;
1164
1353
  }
1165
1354
  const items = this.processTransactions(response.records);
@@ -1211,9 +1400,9 @@ class EsolveAccountService {
1211
1400
  }
1212
1401
  }
1213
1402
  }
1214
- EsolveAccountService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAccountService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }, { token: EsolveSessionService }, { token: EsolveErrorHandlerService }, { token: EsolveResponseHandlerService }], target: i0.ɵɵFactoryTarget.Injectable });
1215
- EsolveAccountService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAccountService, providedIn: 'root' });
1216
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAccountService, decorators: [{
1403
+ 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 });
1404
+ EsolveAccountService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveAccountService, providedIn: 'root' });
1405
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveAccountService, decorators: [{
1217
1406
  type: Injectable,
1218
1407
  args: [{
1219
1408
  providedIn: 'root'
@@ -1223,6 +1412,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
1223
1412
  args: [ESOLVE_CONNECT_CONFIG]
1224
1413
  }] }, { type: i1$2.HttpClient }, { type: EsolveSessionService }, { type: EsolveErrorHandlerService }, { type: EsolveResponseHandlerService }]; } });
1225
1414
 
1415
+ class EsolveHeading {
1416
+ constructor(identifier, value) {
1417
+ this.identifier = identifier;
1418
+ this.value = value;
1419
+ }
1420
+ }
1421
+
1226
1422
  class EsolveMediaArticle {
1227
1423
  constructor(identifier, title, article, image_url = '', tags = [], topics = [], seo_title = '', seo_keywords = '', seo_description = '') {
1228
1424
  this.identifier = identifier;
@@ -1262,18 +1458,16 @@ class EsolveMediaService {
1262
1458
  this.http = http;
1263
1459
  }
1264
1460
  /**
1265
- * Retrieves the media record from the eSolve instance using the identifier.
1266
- * @param identifier String representing the eSolve media indentifier
1461
+ * Retrieves the media record from the eSolve instance using the identifier
1462
+ *
1463
+ * @param identifier String representing the eSolve media identifier
1267
1464
  */
1268
1465
  getMediaArticle(identifier) {
1269
- const params = new HttpParams({
1270
- fromObject: {
1271
- identifier
1272
- }
1273
- });
1466
+ const params = new HttpParams({ fromObject: { identifier } });
1274
1467
  // TODO: Error Handling
1275
- return this.getMediaRecords(params).pipe(map(response => {
1276
- if ((response.records === undefined) || (response.records.length <= 0)) {
1468
+ return this.getMediaRecords(params).pipe(map((response) => {
1469
+ if ((response.records === undefined) ||
1470
+ (response.records.length <= 0)) {
1277
1471
  throw response;
1278
1472
  }
1279
1473
  const mediaRecord = response.records[0];
@@ -1284,18 +1478,18 @@ class EsolveMediaService {
1284
1478
  }));
1285
1479
  }
1286
1480
  /**
1287
- * Retrieves a group of media records from the eSolve instance linked to a group.
1481
+ * Retrieves a group of media records from the eSolve instance linked to a group
1482
+ *
1288
1483
  * @param media_group String representing the eSolve media group
1289
1484
  */
1290
1485
  getGroupedMediaArticles(media_group) {
1291
1486
  const params = new HttpParams({
1292
- fromObject: {
1293
- media_group_sef: media_group
1294
- }
1487
+ fromObject: { media_group_sef: media_group }
1295
1488
  });
1296
- return this.getMediaRecords(params).pipe(map(response => {
1489
+ return this.getMediaRecords(params).pipe(map((response) => {
1297
1490
  const mediaArticles = [];
1298
- if ((response.records !== undefined) && (response.records.length > 0)) {
1491
+ if ((response.records !== undefined) &&
1492
+ (response.records.length > 0)) {
1299
1493
  for (const mediaRecord of response.records) {
1300
1494
  if (mediaRecord.active) {
1301
1495
  mediaArticles.push(this.processMediaRecord(mediaRecord));
@@ -1305,6 +1499,34 @@ class EsolveMediaService {
1305
1499
  return mediaArticles;
1306
1500
  }));
1307
1501
  }
1502
+ /**
1503
+ * Retrieves the media heading records from the eSolve instance using the identifiers
1504
+ *
1505
+ * @param identifiers Array of strings representing the eSolve heading identifiers
1506
+ */
1507
+ getHeadings(identifiers) {
1508
+ return this.http
1509
+ .get(`${this.config.api_url}/get-headings.php`, {
1510
+ params: {
1511
+ identifier: identifiers.join(','),
1512
+ },
1513
+ })
1514
+ .pipe(map((response) => {
1515
+ const headings = [];
1516
+ if ((response.records !== undefined) &&
1517
+ (response.records.length > 0)) {
1518
+ for (const heading_record of response.records) {
1519
+ headings.push(this.processHeadingRecord(heading_record));
1520
+ }
1521
+ }
1522
+ return headings;
1523
+ }));
1524
+ }
1525
+ /**
1526
+ * Processes media article record
1527
+ *
1528
+ * @param record Record from eSolve instance
1529
+ */
1308
1530
  processMediaRecord(record) {
1309
1531
  const tags = [];
1310
1532
  const topics = [];
@@ -1320,21 +1542,29 @@ class EsolveMediaService {
1320
1542
  }
1321
1543
  return new EsolveMediaArticle(record.identifier, record.title, record.article, record.image_url, tags, topics, record.seo_page_title, record.seo_keywords, record.seo_description);
1322
1544
  }
1545
+ /**
1546
+ * Processes media heading record
1547
+ *
1548
+ * @param record Record from eSolve instance
1549
+ */
1550
+ processHeadingRecord(record) {
1551
+ return new EsolveHeading(record.identifier, record.value);
1552
+ }
1323
1553
  /**
1324
1554
  * Retrieves media records from eSolve instance.
1325
- * @param params Header params
1555
+ *
1556
+ * @param params HTTP params
1326
1557
  */
1327
1558
  getMediaRecords(params) {
1328
- params = params.set('ws_id', this.config.wsid);
1329
- return this.http.get(`${this.config.api_url}/service/get-media.php`, { params });
1559
+ return this.http.get(`${this.config.api_url}/get-media.php`, { params });
1330
1560
  }
1331
1561
  }
1332
- EsolveMediaService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMediaService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
1333
- EsolveMediaService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMediaService, providedIn: 'root' });
1334
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMediaService, decorators: [{
1562
+ 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 });
1563
+ EsolveMediaService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveMediaService, providedIn: 'root' });
1564
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveMediaService, decorators: [{
1335
1565
  type: Injectable,
1336
1566
  args: [{
1337
- providedIn: 'root'
1567
+ providedIn: 'root',
1338
1568
  }]
1339
1569
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1340
1570
  type: Inject,
@@ -1391,18 +1621,11 @@ class EsolveNewsService {
1391
1621
  this.config = config;
1392
1622
  this.http = http;
1393
1623
  }
1394
- getNewsRecords(params) {
1395
- params = params.set('ws_id', this.config.wsid);
1396
- return this.http.get(`${this.config.api_url}/service/get-news.php`, { params });
1397
- }
1398
1624
  getNewsArticle(identifier) {
1399
- const params = new HttpParams({
1400
- fromObject: {
1401
- sef_title: identifier
1402
- }
1403
- });
1625
+ const params = new HttpParams({ fromObject: { sef_title: identifier } });
1404
1626
  return this.getNewsRecords(params).pipe(map(response => {
1405
- if ((response.records === undefined) || (response.records.length <= 0)) {
1627
+ if ((response.records === undefined) ||
1628
+ (response.records.length <= 0)) {
1406
1629
  throw response;
1407
1630
  }
1408
1631
  const newsRecord = response.records[0];
@@ -1453,9 +1676,9 @@ class EsolveNewsService {
1453
1676
  }));
1454
1677
  }
1455
1678
  getNewsGroups() {
1456
- let params = new HttpParams();
1457
- params = params.set('ws_id', this.config.wsid);
1458
- return this.http.get(`${this.config.api_url}/service/get-news-groups.php`, { params }).pipe(map(response => {
1679
+ return this.http
1680
+ .get(`${this.config.api_url}/get-news-groups.php`)
1681
+ .pipe(map((response) => {
1459
1682
  if (response.records === undefined) {
1460
1683
  throw response;
1461
1684
  }
@@ -1470,13 +1693,16 @@ class EsolveNewsService {
1470
1693
  const author = new EsolveNewsArticleAuthor(newsRecord.user.userid, newsRecord.user.email, newsRecord.user.firstname, newsRecord.user.surname);
1471
1694
  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);
1472
1695
  }
1696
+ getNewsRecords(params) {
1697
+ return this.http.get(`${this.config.api_url}/get-news.php`, { params });
1698
+ }
1473
1699
  }
1474
- EsolveNewsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveNewsService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
1475
- EsolveNewsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveNewsService, providedIn: 'root' });
1476
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveNewsService, decorators: [{
1700
+ 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 });
1701
+ EsolveNewsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveNewsService, providedIn: 'root' });
1702
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveNewsService, decorators: [{
1477
1703
  type: Injectable,
1478
1704
  args: [{
1479
- providedIn: 'root'
1705
+ providedIn: 'root',
1480
1706
  }]
1481
1707
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1482
1708
  type: Inject,
@@ -1543,10 +1769,7 @@ class EsolveBannerService {
1543
1769
  */
1544
1770
  getBanners(identifier, banner_display_container, enable_date_filter = false) {
1545
1771
  let params = new HttpParams({
1546
- fromObject: {
1547
- ws_id: this.config.wsid,
1548
- enable_date_filter
1549
- }
1772
+ fromObject: { enable_date_filter }
1550
1773
  });
1551
1774
  if (identifier) {
1552
1775
  params = params.set('identifier', identifier);
@@ -1554,7 +1777,9 @@ class EsolveBannerService {
1554
1777
  if (banner_display_container) {
1555
1778
  params = params.set('banner_display_container', banner_display_container);
1556
1779
  }
1557
- return this.http.get(`${this.config.api_url}/service/get-banners.php`, { params }).pipe(map(response => {
1780
+ return this.http
1781
+ .get(`${this.config.api_url}/get-banners.php`, { params })
1782
+ .pipe(map((response) => {
1558
1783
  if (response.records === undefined) {
1559
1784
  throw response;
1560
1785
  }
@@ -1614,12 +1839,12 @@ class EsolveBannerService {
1614
1839
  return banners;
1615
1840
  }
1616
1841
  }
1617
- EsolveBannerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveBannerService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
1618
- EsolveBannerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveBannerService, providedIn: 'root' });
1619
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveBannerService, decorators: [{
1842
+ 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 });
1843
+ EsolveBannerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveBannerService, providedIn: 'root' });
1844
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveBannerService, decorators: [{
1620
1845
  type: Injectable,
1621
1846
  args: [{
1622
- providedIn: 'root'
1847
+ providedIn: 'root',
1623
1848
  }]
1624
1849
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1625
1850
  type: Inject,
@@ -1641,10 +1866,9 @@ class EsolveMenuService {
1641
1866
  this.http = http;
1642
1867
  }
1643
1868
  getMenuTree(identifier) {
1644
- let menuParams = new HttpParams();
1645
- menuParams = menuParams.set('identifier', identifier);
1646
- menuParams = menuParams.set('ws_id', this.config.wsid);
1647
- return this.http.get(`${this.config.api_url}/service/get-menu-tree.php`, { params: menuParams }).pipe(map(response => {
1869
+ return this.http
1870
+ .get(`${this.config.api_url}/get-menu-tree.php`, { params: { identifier } })
1871
+ .pipe(map((response) => {
1648
1872
  if ((!response) || (response.records === undefined)) {
1649
1873
  throw response;
1650
1874
  }
@@ -1664,12 +1888,12 @@ class EsolveMenuService {
1664
1888
  return menu;
1665
1889
  }
1666
1890
  }
1667
- EsolveMenuService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMenuService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
1668
- EsolveMenuService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMenuService, providedIn: 'root' });
1669
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMenuService, decorators: [{
1891
+ 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 });
1892
+ EsolveMenuService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveMenuService, providedIn: 'root' });
1893
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveMenuService, decorators: [{
1670
1894
  type: Injectable,
1671
1895
  args: [{
1672
- providedIn: 'root'
1896
+ providedIn: 'root',
1673
1897
  }]
1674
1898
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1675
1899
  type: Inject,
@@ -1688,15 +1912,11 @@ class EsolveTopicService {
1688
1912
  * @param topic_id_list List of topic ID's that need to be retrieved
1689
1913
  */
1690
1914
  getTopics(topic_id_list = []) {
1691
- let params = new HttpParams({
1692
- fromObject: {
1693
- ws_id: this.config.wsid
1694
- }
1695
- });
1915
+ let params = new HttpParams();
1696
1916
  if (topic_id_list.length > 0) {
1697
1917
  params = params.append('topic_id', topic_id_list.join(','));
1698
1918
  }
1699
- return this.http.get(`${this.config.api_url}/service/get-topics.php`, { params }).pipe(map(response => {
1919
+ return this.http.get(`${this.config.api_url}/get-topics.php`, { params }).pipe(map(response => {
1700
1920
  if (response.records === undefined) {
1701
1921
  throw response;
1702
1922
  }
@@ -1714,9 +1934,9 @@ class EsolveTopicService {
1714
1934
  return topics;
1715
1935
  }
1716
1936
  }
1717
- EsolveTopicService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveTopicService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
1718
- EsolveTopicService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveTopicService, providedIn: 'root' });
1719
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveTopicService, decorators: [{
1937
+ 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 });
1938
+ EsolveTopicService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveTopicService, providedIn: 'root' });
1939
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveTopicService, decorators: [{
1720
1940
  type: Injectable,
1721
1941
  args: [{
1722
1942
  providedIn: 'root'
@@ -1822,6 +2042,10 @@ class EsolveStockItem {
1822
2042
  * Short description of stock item
1823
2043
  */
1824
2044
  description,
2045
+ /**
2046
+ * Full description of stock item
2047
+ */
2048
+ extended_description,
1825
2049
  /**
1826
2050
  * Active state
1827
2051
  */
@@ -1863,6 +2087,7 @@ class EsolveStockItem {
1863
2087
  this.name = name;
1864
2088
  this.sef_name = sef_name;
1865
2089
  this.description = description;
2090
+ this.extended_description = extended_description;
1866
2091
  this.active = active;
1867
2092
  this.featured = featured;
1868
2093
  this.image_name = image_name;
@@ -1925,40 +2150,6 @@ class EsolveStockService {
1925
2150
  this.config = config;
1926
2151
  this.http = http;
1927
2152
  }
1928
- /**
1929
- * Processes the eSolve stock item record and converts it to StockItem object.
1930
- * @param record eSolve stock item record
1931
- */
1932
- processStockItem(record) {
1933
- const tags = [];
1934
- const topics = [];
1935
- const badges = [];
1936
- if ((record.tags) && (record.tags.length > 0)) {
1937
- for (const tag of record.tags) {
1938
- tags.push(new EsolveTag(+tag.id, tag.tag_phrase, +tag.tag_weight, tag.description));
1939
- }
1940
- }
1941
- if ((record.topics) && (record.topics.length > 0)) {
1942
- for (const topic of record.topics) {
1943
- topics.push(new EsolveTopic(+topic.id, topic.name, topic.short_description, +topic.sort_priority));
1944
- }
1945
- }
1946
- if ((record.badges) && (record.badges.length > 0)) {
1947
- for (const badge of record.badges) {
1948
- badges.push(new EsolveStockBadge(+badge.id, badge.text, badge.identifier, badge.font_colour, badge.badge_colour, +badge.sort_priority));
1949
- }
1950
- }
1951
- const price = new EsolveStockPrice(record.regular_sellprice, record.regular_sellprice_inclusive, record.sellprice, record.sellprice_inclusive);
1952
- 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);
1953
- }
1954
- /**
1955
- * Retrieves stock records from HTTP params.
1956
- * @param params HTTP client parameters
1957
- */
1958
- getStockRecords(params) {
1959
- params = params.set('ws_id', this.config.wsid);
1960
- return this.http.get(`${this.config.api_url}/service/get-items.php`, { params });
1961
- }
1962
2153
  /**
1963
2154
  * Retrieves the stock record from the eSolve instance using the code.
1964
2155
  * @param code eSolve stock code
@@ -2043,13 +2234,46 @@ class EsolveStockService {
2043
2234
  return new EsolveStockItemList(stockItems, +response.additional_data.total_records, options.page ?? 0);
2044
2235
  }));
2045
2236
  }
2237
+ /**
2238
+ * Processes the eSolve stock item record and converts it to StockItem object.
2239
+ * @param record eSolve stock item record
2240
+ */
2241
+ processStockItem(record) {
2242
+ const tags = [];
2243
+ const topics = [];
2244
+ const badges = [];
2245
+ if ((record.tags) && (record.tags.length > 0)) {
2246
+ for (const tag of record.tags) {
2247
+ tags.push(new EsolveTag(+tag.id, tag.tag_phrase, +tag.tag_weight, tag.description));
2248
+ }
2249
+ }
2250
+ if ((record.topics) && (record.topics.length > 0)) {
2251
+ for (const topic of record.topics) {
2252
+ topics.push(new EsolveTopic(+topic.id, topic.name, topic.short_description, +topic.sort_priority));
2253
+ }
2254
+ }
2255
+ if ((record.badges) && (record.badges.length > 0)) {
2256
+ for (const badge of record.badges) {
2257
+ badges.push(new EsolveStockBadge(+badge.id, badge.text, badge.identifier, badge.font_colour, badge.badge_colour, +badge.sort_priority));
2258
+ }
2259
+ }
2260
+ const price = new EsolveStockPrice(record.regular_sellprice, record.regular_sellprice_inclusive, record.sellprice, record.sellprice_inclusive);
2261
+ 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);
2262
+ }
2263
+ /**
2264
+ * Retrieves stock records from HTTP params.
2265
+ * @param params HTTP client parameters
2266
+ */
2267
+ getStockRecords(params) {
2268
+ return this.http.get(`${this.config.api_url}/get-items.php`, { params });
2269
+ }
2046
2270
  }
2047
- EsolveStockService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveStockService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
2048
- EsolveStockService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveStockService, providedIn: 'root' });
2049
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveStockService, decorators: [{
2271
+ 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 });
2272
+ EsolveStockService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveStockService, providedIn: 'root' });
2273
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveStockService, decorators: [{
2050
2274
  type: Injectable,
2051
2275
  args: [{
2052
- providedIn: 'root'
2276
+ providedIn: 'root',
2053
2277
  }]
2054
2278
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
2055
2279
  type: Inject,
@@ -2112,9 +2336,9 @@ class EsolveCategoryTreeService {
2112
2336
  * Retrieves the category tree from eSolve instance and coverts it to the correct format.
2113
2337
  */
2114
2338
  getCategoryTree() {
2115
- let params = new HttpParams();
2116
- params = params.set('ws_id', this.config.wsid);
2117
- return this.http.get(`${this.config.api_url}/service/get-tree.php`, { params }).pipe(map(response => {
2339
+ return this.http
2340
+ .get(`${this.config.api_url}/get-tree.php`)
2341
+ .pipe(map((response) => {
2118
2342
  if (response.records === undefined) {
2119
2343
  throw response;
2120
2344
  }
@@ -2122,7 +2346,9 @@ class EsolveCategoryTreeService {
2122
2346
  }));
2123
2347
  }
2124
2348
  /**
2125
- * Retrieve the details of a category tree item from the eSolve instance and converts it to the correct format.
2349
+ * Retrieve the details of a category tree item from the eSolve instance and
2350
+ * converts it to the correct format.
2351
+ *
2126
2352
  * @param options Filter options
2127
2353
  */
2128
2354
  getCategoryTreeItem(options) {
@@ -2147,16 +2373,18 @@ class EsolveCategoryTreeService {
2147
2373
  }
2148
2374
  if (type && (esolve_id || sef_description)) {
2149
2375
  let params = new HttpParams();
2150
- params = params.set('ws_id', this.config.wsid.toString());
2151
- params = params.set('type', type.toString());
2376
+ params = params.set('type', type);
2152
2377
  if (esolve_id) {
2153
- params = params.set('id', esolve_id.toString());
2378
+ params = params.set('id', esolve_id);
2154
2379
  }
2155
2380
  if (sef_description) {
2156
- params = params.set('sef_description', sef_description.toString());
2381
+ params = params.set('sef_description', sef_description);
2157
2382
  }
2158
- return this.http.get(`${this.config.api_url}/service/get-tree-item.php`, { params }).pipe(map(response => {
2159
- if ((response.records === undefined) || (response.records.length <= 0)) {
2383
+ return this.http
2384
+ .get(`${this.config.api_url}/get-tree-item.php`, { params })
2385
+ .pipe(map((response) => {
2386
+ if ((response.records === undefined) ||
2387
+ (response.records.length <= 0)) {
2160
2388
  throw response;
2161
2389
  }
2162
2390
  return this.processTreeItem(response.records[0]);
@@ -2166,6 +2394,7 @@ class EsolveCategoryTreeService {
2166
2394
  }
2167
2395
  /**
2168
2396
  * Processes the eSolve tree records and converts them into the correct format.
2397
+ *
2169
2398
  * @param tree_records Records to process
2170
2399
  */
2171
2400
  processTree(tree_records) {
@@ -2209,12 +2438,12 @@ class EsolveCategoryTreeService {
2209
2438
  return null;
2210
2439
  }
2211
2440
  }
2212
- EsolveCategoryTreeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCategoryTreeService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
2213
- EsolveCategoryTreeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCategoryTreeService, providedIn: 'root' });
2214
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCategoryTreeService, decorators: [{
2441
+ 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 });
2442
+ EsolveCategoryTreeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveCategoryTreeService, providedIn: 'root' });
2443
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveCategoryTreeService, decorators: [{
2215
2444
  type: Injectable,
2216
2445
  args: [{
2217
- providedIn: 'root'
2446
+ providedIn: 'root',
2218
2447
  }]
2219
2448
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
2220
2449
  type: Inject,
@@ -2345,14 +2574,13 @@ class EsolveCartService {
2345
2574
  }
2346
2575
  /**
2347
2576
  * Retrieves the current cart
2577
+ *
2348
2578
  * @returns An `Observable` with an array of cart items
2349
2579
  */
2350
2580
  getCart() {
2351
- return this.http.get(`${this.config.api_url}/service/get-cart.php`, {
2352
- params: {
2353
- ws_id: this.config.wsid
2354
- }
2355
- }).pipe(map(response => {
2581
+ return this.http
2582
+ .get(`${this.config.api_url}/get-cart.php`)
2583
+ .pipe(map((response) => {
2356
2584
  if (response.records === undefined) {
2357
2585
  throw response;
2358
2586
  }
@@ -2361,6 +2589,7 @@ class EsolveCartService {
2361
2589
  }
2362
2590
  /**
2363
2591
  * Updates the cart by preforming various actions, such as adding, editing or removing items from the cart.
2592
+ *
2364
2593
  * @param items An array of options to update the cart
2365
2594
  * @param action The default action to preform
2366
2595
  * @returns An `Observable` with an array of responses that gives feedback on the requested changes
@@ -2370,16 +2599,15 @@ class EsolveCartService {
2370
2599
  items,
2371
2600
  action
2372
2601
  };
2373
- return this.http.post(`${this.config.api_url}/service/set-cart-item.php`, body, {
2602
+ return this.http
2603
+ .post(`${this.config.api_url}/set-cart-item.php`, body, {
2374
2604
  headers: {
2375
2605
  'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
2376
2606
  },
2377
- params: {
2378
- ws_id: this.config.wsid
2379
- },
2380
2607
  responseType: 'json',
2381
2608
  observe: 'body'
2382
- }).pipe(map(response => {
2609
+ })
2610
+ .pipe(map(response => {
2383
2611
  if (response.responses === undefined) {
2384
2612
  throw response;
2385
2613
  }
@@ -2388,14 +2616,13 @@ class EsolveCartService {
2388
2616
  }
2389
2617
  /**
2390
2618
  * Retrieves the totals of the cart with all the totals calculated
2619
+ *
2391
2620
  * @returns An `Observable` with an object containing cart totals
2392
2621
  */
2393
2622
  getTotals() {
2394
- return this.http.get(`${this.config.api_url}/service/get-cart-totals.php`, {
2395
- params: {
2396
- ws_id: this.config.wsid
2397
- }
2398
- }).pipe(map(response => {
2623
+ return this.http
2624
+ .get(`${this.config.api_url}/get-cart-totals.php`)
2625
+ .pipe(map((response) => {
2399
2626
  if (response.records === undefined) {
2400
2627
  throw response;
2401
2628
  }
@@ -2404,14 +2631,13 @@ class EsolveCartService {
2404
2631
  }
2405
2632
  /**
2406
2633
  * Retrieves a tracking code for the cart
2634
+ *
2407
2635
  * @returns An `Observable` with the cart tracking code
2408
2636
  */
2409
2637
  getTrackingCode() {
2410
- return iif(() => this._cached_tracking > 0, of(this._cached_tracking), this.http.get(`${this.config.api_url}/service/get-checkout-tracking.php`, {
2411
- params: {
2412
- ws_id: this.config.wsid
2413
- }
2414
- }).pipe(map(response => {
2638
+ return iif(() => this._cached_tracking > 0, of(this._cached_tracking), this.http
2639
+ .get(`${this.config.api_url}/get-checkout-tracking.php`)
2640
+ .pipe(map((response) => {
2415
2641
  if (response.records === undefined) {
2416
2642
  throw response;
2417
2643
  }
@@ -2421,6 +2647,7 @@ class EsolveCartService {
2421
2647
  }
2422
2648
  /**
2423
2649
  * Initiates checkout of the cart items
2650
+ *
2424
2651
  * @param type The cart type that needs to be checked out
2425
2652
  * @param addresses_id The ID of the delivery address
2426
2653
  * @param shipping_id The ID of the shipping method
@@ -2444,16 +2671,15 @@ class EsolveCartService {
2444
2671
  throw tracking;
2445
2672
  }
2446
2673
  body.tracking = tracking;
2447
- return this.http.post(`${this.config.api_url}/service/set-checkout.php`, body, {
2674
+ return this.http
2675
+ .post(`${this.config.api_url}/set-checkout.php`, body, {
2448
2676
  headers: {
2449
2677
  'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
2450
2678
  },
2451
- params: {
2452
- ws_id: this.config.wsid
2453
- },
2454
2679
  responseType: 'json',
2455
2680
  observe: 'body'
2456
- }).pipe(map(http_response => this.responseHandler.validateSingleHttpResponse(http_response, (response) => {
2681
+ })
2682
+ .pipe(map((http_response) => this.responseHandler.validateSingleHttpResponse(http_response, (response) => {
2457
2683
  this._cached_tracking = 0;
2458
2684
  return new EsolveCheckoutResult(response);
2459
2685
  })), catchError((errorRes) => {
@@ -2462,7 +2688,8 @@ class EsolveCartService {
2462
2688
  }));
2463
2689
  }
2464
2690
  /**
2465
- * Processes the eSolve tree records.
2691
+ * Processes the eSolve tree records
2692
+ *
2466
2693
  * @param cart_item_records Records to process
2467
2694
  * @returns An array of processed cart items
2468
2695
  */
@@ -2478,6 +2705,7 @@ class EsolveCartService {
2478
2705
  }
2479
2706
  /**
2480
2707
  * Processes the eSolve cart totals
2708
+ *
2481
2709
  * @param record Data to process
2482
2710
  * @returns Processed cart totals
2483
2711
  */
@@ -2486,12 +2714,12 @@ class EsolveCartService {
2486
2714
  return cart_totals;
2487
2715
  }
2488
2716
  }
2489
- EsolveCartService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCartService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }, { token: EsolveErrorHandlerService }, { token: EsolveResponseHandlerService }], target: i0.ɵɵFactoryTarget.Injectable });
2490
- EsolveCartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCartService, providedIn: 'root' });
2491
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCartService, decorators: [{
2717
+ 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 });
2718
+ EsolveCartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveCartService, providedIn: 'root' });
2719
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveCartService, decorators: [{
2492
2720
  type: Injectable,
2493
2721
  args: [{
2494
- providedIn: 'root'
2722
+ providedIn: 'root',
2495
2723
  }]
2496
2724
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
2497
2725
  type: Inject,
@@ -2610,61 +2838,15 @@ class EsolvePaymentService {
2610
2838
  this.errorHandler = errorHandler;
2611
2839
  this.responseHandler = responseHandler;
2612
2840
  }
2613
- /**
2614
- * Processes the eSolve payment method records.
2615
- * @param records Records to process
2616
- * @returns An array of processed payment methods.
2617
- */
2618
- processPaymentMethods(records) {
2619
- const payment_methods = [];
2620
- if (records) {
2621
- for (const record of records) {
2622
- const payment_method = new EsolvePaymentMethod(record);
2623
- payment_methods.push(payment_method);
2624
- }
2625
- }
2626
- return payment_methods;
2627
- }
2628
- /**
2629
- * Processes the eSolve vault records.
2630
- * @param records Records to process
2631
- * @returns An array of processed vault items (a.k.a. cards)
2632
- */
2633
- processVaultItems(records) {
2634
- const vault = [];
2635
- if (records) {
2636
- for (const record of records) {
2637
- const vault_item = new EsolveVaultItem(+record.id, +record.payment_methods_id, record.last4, record.brand, record.expiry_timestamp);
2638
- vault.push(vault_item);
2639
- }
2640
- }
2641
- return vault;
2642
- }
2643
- generateExpiry(card_data) {
2644
- const month_string = card_data.expiry_month.padStart(2, '0');
2645
- const year_string = card_data.expiry_year.padStart(4, '0');
2646
- return `${month_string}${year_string}`;
2647
- }
2648
2841
  /**
2649
2842
  * Retrieves a list of payment methods.
2650
2843
  * @param options Filter options
2651
2844
  * @returns An `Observable` with an array of payment methods
2652
2845
  */
2653
2846
  getPaymentMethods(options) {
2654
- let params = new HttpParams();
2655
- params = params.set('ws_id', this.config.wsid);
2656
- if (options) {
2657
- if (typeof options.live !== 'undefined') {
2658
- params = params.set('live', options.live);
2659
- }
2660
- if (typeof options.location_id !== 'undefined') {
2661
- params = params.set('location_id', options.location_id);
2662
- }
2663
- if (typeof options.is_gateway !== 'undefined') {
2664
- params = params.set('is_gateway', options.is_gateway);
2665
- }
2666
- }
2667
- return this.http.get(`${this.config.api_url}/service/get-payment-methods.php`, { params }).pipe(map(response => {
2847
+ return this.http
2848
+ .get(`${this.config.api_url}/get-payment-methods.php`, { params: { ...options } })
2849
+ .pipe(map((response) => {
2668
2850
  if (response.records === undefined) {
2669
2851
  throw response;
2670
2852
  }
@@ -2678,11 +2860,12 @@ class EsolvePaymentService {
2678
2860
  */
2679
2861
  getVault(payment_methods_id) {
2680
2862
  let params = new HttpParams();
2681
- params = params.set('ws_id', this.config.wsid);
2682
2863
  if (typeof payment_methods_id !== 'undefined') {
2683
2864
  params = params.set('payment_methods_id', payment_methods_id);
2684
2865
  }
2685
- return this.http.get(`${this.config.api_url}/service/get-vault.php`, { params }).pipe(map(response => {
2866
+ return this.http
2867
+ .get(`${this.config.api_url}/get-vault.php`, { params })
2868
+ .pipe(map((response) => {
2686
2869
  if (response.records === undefined) {
2687
2870
  throw response;
2688
2871
  }
@@ -2705,28 +2888,26 @@ class EsolvePaymentService {
2705
2888
  card_expiry: this.generateExpiry(card_data)
2706
2889
  }
2707
2890
  };
2708
- return this.http.post(`${this.config.api_url}/service/set-vault.php`, body, {
2891
+ return this.http
2892
+ .post(`${this.config.api_url}/set-vault.php`, body, {
2709
2893
  headers: {
2710
2894
  'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
2711
2895
  },
2712
- params: {
2713
- ws_id: this.config.wsid
2714
- },
2715
2896
  responseType: 'json',
2716
- observe: 'body'
2717
- }).pipe(map(http_response => this.responseHandler.validateSingleHttpResponse(http_response, (response) => new EsolveVaultItemResult(response))), catchError((errorRes) => {
2897
+ observe: 'body',
2898
+ })
2899
+ .pipe(map((http_response) => this.responseHandler.validateSingleHttpResponse(http_response, (response) => new EsolveVaultItemResult(response))), catchError((errorRes) => {
2718
2900
  return this.errorHandler.handleHttpPostError('set-vault', errorRes);
2719
2901
  }));
2720
2902
  }
2721
2903
  deleteVaultItem(id) {
2722
- return this.http.delete(`${this.config.api_url}/service/delete-vault.php`, {
2723
- params: {
2724
- ws_id: this.config.wsid,
2725
- id: id
2726
- },
2904
+ return this.http
2905
+ .delete(`${this.config.api_url}/delete-vault.php`, {
2906
+ params: { id },
2727
2907
  responseType: 'json',
2728
- observe: 'body'
2729
- }).pipe(map(http_response => {
2908
+ observe: 'body',
2909
+ })
2910
+ .pipe(map((http_response) => {
2730
2911
  if ((http_response.result === undefined) ||
2731
2912
  (http_response.result === null) ||
2732
2913
  (http_response.result.status !== 'success')) {
@@ -2738,7 +2919,9 @@ class EsolvePaymentService {
2738
2919
  }));
2739
2920
  }
2740
2921
  /**
2741
- * Sets the payment for the specified transaction using selected payment method.
2922
+ * Sets the payment for the specified transaction using selected payment
2923
+ * method.
2924
+ *
2742
2925
  * @param transaction_id eSolve ID to the transaction
2743
2926
  * @param payment_methods_id eSolve ID to the selected payment method
2744
2927
  * @param card ID of selected card from the vault or information to a brand new card
@@ -2762,26 +2945,60 @@ class EsolvePaymentService {
2762
2945
  card_expiry: this.generateExpiry(card)
2763
2946
  };
2764
2947
  }
2765
- return this.http.post(`${this.config.api_url}/service/set-payment.php`, body, {
2948
+ return this.http
2949
+ .post(`${this.config.api_url}/set-payment.php`, body, {
2766
2950
  headers: {
2767
2951
  'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
2768
2952
  },
2769
- params: {
2770
- ws_id: this.config.wsid
2771
- },
2772
2953
  responseType: 'json',
2773
- observe: 'body'
2774
- }).pipe(map(http_response => this.responseHandler.validateSingleHttpResponse(http_response, (response) => new EsolvePaymentResult(response))), catchError((errorRes) => {
2954
+ observe: 'body',
2955
+ })
2956
+ .pipe(map((http_response) => this.responseHandler.validateSingleHttpResponse(http_response, (response) => new EsolvePaymentResult(response))), catchError((errorRes) => {
2775
2957
  return this.errorHandler.handleHttpPostError('set-payment', errorRes);
2776
2958
  }));
2777
2959
  }
2960
+ /**
2961
+ * Processes the eSolve payment method records.
2962
+ * @param records Records to process
2963
+ * @returns An array of processed payment methods.
2964
+ */
2965
+ processPaymentMethods(records) {
2966
+ const payment_methods = [];
2967
+ if (records) {
2968
+ for (const record of records) {
2969
+ const payment_method = new EsolvePaymentMethod(record);
2970
+ payment_methods.push(payment_method);
2971
+ }
2972
+ }
2973
+ return payment_methods;
2974
+ }
2975
+ /**
2976
+ * Processes the eSolve vault records.
2977
+ * @param records Records to process
2978
+ * @returns An array of processed vault items (a.k.a. cards)
2979
+ */
2980
+ processVaultItems(records) {
2981
+ const vault = [];
2982
+ if (records) {
2983
+ for (const record of records) {
2984
+ const vault_item = new EsolveVaultItem(+record.id, +record.payment_methods_id, record.last4, record.brand, record.expiry_timestamp);
2985
+ vault.push(vault_item);
2986
+ }
2987
+ }
2988
+ return vault;
2989
+ }
2990
+ generateExpiry(card_data) {
2991
+ const month_string = card_data.expiry_month.padStart(2, '0');
2992
+ const year_string = card_data.expiry_year.padStart(4, '0');
2993
+ return `${month_string}${year_string}`;
2994
+ }
2778
2995
  }
2779
- EsolvePaymentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolvePaymentService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }, { token: EsolveErrorHandlerService }, { token: EsolveResponseHandlerService }], target: i0.ɵɵFactoryTarget.Injectable });
2780
- EsolvePaymentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolvePaymentService, providedIn: 'root' });
2781
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolvePaymentService, decorators: [{
2996
+ 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 });
2997
+ EsolvePaymentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolvePaymentService, providedIn: 'root' });
2998
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolvePaymentService, decorators: [{
2782
2999
  type: Injectable,
2783
3000
  args: [{
2784
- providedIn: 'root'
3001
+ providedIn: 'root',
2785
3002
  }]
2786
3003
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
2787
3004
  type: Inject,
@@ -2844,37 +3061,12 @@ class EsolveShippingService {
2844
3061
  this.config = config;
2845
3062
  this.http = http;
2846
3063
  }
2847
- /**
2848
- * Processes the eSolve shipping method records.
2849
- * @param records Records to process
2850
- * @returns An array of processed shipping methods
2851
- */
2852
- processShippingMethods(records) {
2853
- const shipping_methods = [];
2854
- if (records) {
2855
- for (const record of records) {
2856
- 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);
2857
- shipping_methods.push(shipping_method);
2858
- }
2859
- }
2860
- return shipping_methods;
2861
- }
2862
- /**
2863
- * Processes the eSolve shipping costs record.
2864
- * @param record Data to process
2865
- * @returns Processed shipping costs
2866
- */
2867
- processShippingCost(record) {
2868
- 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);
2869
- return shipping_cost;
2870
- }
2871
3064
  /**
2872
3065
  * Retrieves a list of shipping methods
2873
3066
  * @returns An `Observable` with an array of shipping methods
2874
3067
  */
2875
3068
  getShippingMethods(options) {
2876
3069
  let params = new HttpParams();
2877
- params = params.set('ws_id', this.config.wsid);
2878
3070
  if (options) {
2879
3071
  if (typeof options.addresses_id !== 'undefined') {
2880
3072
  params = params.set('addresses_id', options.addresses_id);
@@ -2883,7 +3075,7 @@ class EsolveShippingService {
2883
3075
  params = params.set('location_id', options.location_id);
2884
3076
  }
2885
3077
  }
2886
- return this.http.get(`${this.config.api_url}/service/get-shipping-methods.php`, { params }).pipe(map(response => {
3078
+ return this.http.get(`${this.config.api_url}/get-shipping-methods.php`, { params }).pipe(map(response => {
2887
3079
  if (response.records === undefined) {
2888
3080
  throw response;
2889
3081
  }
@@ -2898,23 +3090,24 @@ class EsolveShippingService {
2898
3090
  getShippingCost(shipping_id, addresses_id, location_id) {
2899
3091
  try {
2900
3092
  let params = new HttpParams();
2901
- params = params.set('ws_id', this.config.wsid);
2902
- if (typeof shipping_id !== 'undefined') {
2903
- params = params.set('shipping_id', shipping_id);
3093
+ if (typeof shipping_id === 'undefined') {
3094
+ throw new Error('Shipping ID is required');
2904
3095
  }
2905
3096
  else {
2906
- throw new Error('Shipping ID is required');
3097
+ params = params.set('shipping_id', shipping_id);
2907
3098
  }
2908
- if (typeof addresses_id !== 'undefined') {
2909
- params = params.set('addresses_id', addresses_id);
3099
+ if (typeof addresses_id === 'undefined') {
3100
+ throw new Error('Address ID is required');
2910
3101
  }
2911
3102
  else {
2912
- throw new Error('Address ID is required');
3103
+ params = params.set('addresses_id', addresses_id);
2913
3104
  }
2914
3105
  if (typeof location_id !== 'undefined') {
2915
3106
  params = params.set('location_id', location_id);
2916
3107
  }
2917
- return this.http.get(`${this.config.api_url}/service/get-shipping-cost.php`, { params }).pipe(map(response => {
3108
+ return this.http
3109
+ .get(`${this.config.api_url}/get-shipping-cost.php`, { params })
3110
+ .pipe(map((response) => {
2918
3111
  if (response.records === undefined) {
2919
3112
  throw response;
2920
3113
  }
@@ -2925,13 +3118,37 @@ class EsolveShippingService {
2925
3118
  return throwError(err);
2926
3119
  }
2927
3120
  }
3121
+ /**
3122
+ * Processes the eSolve shipping method records.
3123
+ * @param records Records to process
3124
+ * @returns An array of processed shipping methods
3125
+ */
3126
+ processShippingMethods(records) {
3127
+ const shipping_methods = [];
3128
+ if (records) {
3129
+ for (const record of records) {
3130
+ 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);
3131
+ shipping_methods.push(shipping_method);
3132
+ }
3133
+ }
3134
+ return shipping_methods;
3135
+ }
3136
+ /**
3137
+ * Processes the eSolve shipping costs record.
3138
+ * @param record Data to process
3139
+ * @returns Processed shipping costs
3140
+ */
3141
+ processShippingCost(record) {
3142
+ 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);
3143
+ return shipping_cost;
3144
+ }
2928
3145
  }
2929
- EsolveShippingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveShippingService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
2930
- EsolveShippingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveShippingService, providedIn: 'root' });
2931
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveShippingService, decorators: [{
3146
+ 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 });
3147
+ EsolveShippingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveShippingService, providedIn: 'root' });
3148
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveShippingService, decorators: [{
2932
3149
  type: Injectable,
2933
3150
  args: [{
2934
- providedIn: 'root'
3151
+ providedIn: 'root',
2935
3152
  }]
2936
3153
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
2937
3154
  type: Inject,
@@ -2945,12 +3162,13 @@ class EsolveLocationsService {
2945
3162
  }
2946
3163
  /**
2947
3164
  * Retrieves a list of stock locations
3165
+ *
2948
3166
  * @returns An `Observable` with an array of stock locations
2949
3167
  */
2950
3168
  getStockLocations() {
2951
- let params = new HttpParams();
2952
- params = params.set('ws_id', this.config.wsid);
2953
- return this.http.get(`${this.config.api_url}/service/get-locations.php`, { params }).pipe(map(response => {
3169
+ return this.http
3170
+ .get(`${this.config.api_url}/get-locations.php`)
3171
+ .pipe(map((response) => {
2954
3172
  if (response.records === undefined) {
2955
3173
  throw response;
2956
3174
  }
@@ -2959,6 +3177,7 @@ class EsolveLocationsService {
2959
3177
  }
2960
3178
  /**
2961
3179
  * Processes the eSolve stock location records.
3180
+ *
2962
3181
  * @param records Records to process
2963
3182
  * @returns An array of processed stock location records
2964
3183
  */
@@ -2972,12 +3191,12 @@ class EsolveLocationsService {
2972
3191
  return stock_locations;
2973
3192
  }
2974
3193
  }
2975
- EsolveLocationsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveLocationsService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
2976
- EsolveLocationsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveLocationsService, providedIn: 'root' });
2977
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveLocationsService, decorators: [{
3194
+ 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 });
3195
+ EsolveLocationsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveLocationsService, providedIn: 'root' });
3196
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveLocationsService, decorators: [{
2978
3197
  type: Injectable,
2979
3198
  args: [{
2980
- providedIn: 'root'
3199
+ providedIn: 'root',
2981
3200
  }]
2982
3201
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
2983
3202
  type: Inject,
@@ -2992,5 +3211,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
2992
3211
  * Generated bundle index. Do not edit.
2993
3212
  */
2994
3213
 
2995
- export { EsolveAccountService, EsolveAddress, EsolveAddressResult, EsolveAuthService, EsolveBankingDetails, EsolveBanner, EsolveBannerImage, EsolveBannerImageHotspot, EsolveBannerService, EsolveCartItem, EsolveCartService, EsolveCartTotals, EsolveCategoryTreeItem, EsolveCategoryTreeService, EsolveChangePasswordResult, EsolveCheckoutResult, EsolveErrorHandlerService, EsolveHttpError, EsolveList, EsolveLocationsService, EsolveMediaArticle, EsolveMediaService, EsolveMenuItem, EsolveMenuService, EsolveNewsArticle, EsolveNewsArticleAuthor, EsolveNewsArticleList, EsolveNewsGroup, EsolveNewsService, EsolvePaymentMethod, EsolvePaymentResult, EsolvePaymentService, EsolveRegistrationResult, EsolveResetPasswordResult, EsolveResponseHandlerService, EsolveResponseResult, EsolveResult, EsolveSEOInfo, EsolveSeoService, EsolveSession, EsolveSessionService, EsolveShippingCost, EsolveShippingMethod, EsolveShippingService, EsolveStockBadge, EsolveStockItem, EsolveStockItemList, EsolveStockLocation, EsolveStockLocationAddress, EsolveStockLocationContactInfo, EsolveStockLocationPOBoxAddress, EsolveStockLocationTradingTimes, EsolveStockLocationTradingTimesDay, EsolveStockPrice, EsolveStockService, EsolveTag, EsolveTopic, EsolveTopicService, EsolveTransaction, EsolveTransactionAddress, EsolveTransactionClient, EsolveTransactionItem, EsolveTransactionItemPrice, EsolveTransactionList, EsolveTransactionLocation, EsolveTransactionPaymentMethod, EsolveTransactionShippingMethod, EsolveTransactionUser, EsolveUserAccount, EsolveUserAccountBusiness, EsolveUserAccountContact, EsolveUserAccountResult, EsolveVaultItem, EsolveVaultItemResult, NgEsolveConnectModule };
3214
+ export { EsolveAccountService, EsolveAddress, EsolveAddressResult, EsolveAuthService, EsolveBankingDetails, EsolveBanner, EsolveBannerImage, EsolveBannerImageHotspot, EsolveBannerService, EsolveCartItem, EsolveCartService, EsolveCartTotals, EsolveCategoryTreeItem, EsolveCategoryTreeService, EsolveChangePasswordResult, EsolveCheckoutResult, EsolveCookieService, EsolveErrorHandlerService, EsolveGeocodeAddressResult, EsolveGeocodeCoordsResult, EsolveGeocodeResult, EsolveGeocoderService, 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 };
2996
3215
  //# sourceMappingURL=esolve-ng-esolve-connect.mjs.map