@esolve/ng-esolve-connect 0.11.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/esm2020/lib/account/esolve-account.service.mjs +26 -4
  2. package/esm2020/lib/account/esolve-forgot-password-response.mjs +1 -1
  3. package/esm2020/lib/account/esolve-location-update-result.mjs +8 -0
  4. package/esm2020/lib/account/esolve-registration-post-response-item.mjs +1 -1
  5. package/esm2020/lib/account/esolve-registration-result.mjs +2 -1
  6. package/esm2020/lib/auth/esolve-auth-response.mjs +4 -0
  7. package/esm2020/lib/auth/esolve-auth.service.mjs +22 -9
  8. package/esm2020/lib/auth/esolve-login-post-response-item.mjs +2 -0
  9. package/esm2020/lib/manufacturers/esolve-manufacturer-options.mjs +2 -0
  10. package/esm2020/lib/manufacturers/esolve-manufacturer-record.mjs +2 -0
  11. package/esm2020/lib/manufacturers/esolve-manufacturer.mjs +38 -0
  12. package/esm2020/lib/manufacturers/esolve-manufacturers.service.mjs +73 -0
  13. package/esm2020/lib/ranges/esolve-range-options.mjs +2 -0
  14. package/esm2020/lib/ranges/esolve-range-record.mjs +2 -0
  15. package/esm2020/lib/ranges/esolve-range.mjs +33 -0
  16. package/esm2020/lib/ranges/esolve-ranges.service.mjs +76 -0
  17. package/esm2020/lib/session/esolve-session-data.mjs +2 -0
  18. package/esm2020/lib/session/esolve-session.mjs +6 -2
  19. package/esm2020/lib/session/esolve-session.service.mjs +22 -18
  20. package/esm2020/lib/session/esolve-stored-session.mjs +1 -1
  21. package/esm2020/lib/shared/assets/esolve-asset-type.mjs +2 -0
  22. package/esm2020/lib/shared/assets/esolve-linked-asset-record.mjs +2 -0
  23. package/esm2020/lib/shared/assets/esolve-linked-asset.mjs +10 -0
  24. package/esm2020/lib/shared/assets/index.mjs +4 -0
  25. package/esm2020/lib/shared/geocoder/esolve-geocode-address-record.mjs +2 -0
  26. package/esm2020/lib/shared/geocoder/esolve-geocode-address-result.mjs +12 -0
  27. package/esm2020/lib/shared/geocoder/esolve-geocode-coords-result.mjs +7 -0
  28. package/esm2020/lib/shared/geocoder/esolve-geocode-result-record.mjs +2 -0
  29. package/esm2020/lib/shared/geocoder/esolve-geocode-result.mjs +11 -0
  30. package/esm2020/lib/shared/geocoder/esolve-geocoder.service.mjs +69 -0
  31. package/esm2020/lib/specials/esolve-special-image-collection-record.mjs +2 -0
  32. package/esm2020/lib/specials/esolve-special-image-collection.mjs +25 -0
  33. package/esm2020/lib/specials/esolve-special-image-record.mjs +2 -0
  34. package/esm2020/lib/specials/esolve-special-image.mjs +9 -0
  35. package/esm2020/lib/specials/esolve-special-options.mjs +2 -0
  36. package/esm2020/lib/specials/esolve-special-record.mjs +2 -0
  37. package/esm2020/lib/specials/esolve-special.mjs +38 -0
  38. package/esm2020/lib/specials/esolve-specials.service.mjs +82 -0
  39. package/esm2020/lib/specials/index.mjs +9 -0
  40. package/esm2020/lib/stock/esolve-stock-item-options.mjs +1 -1
  41. package/esm2020/lib/stock/esolve-stock-item.mjs +4 -2
  42. package/esm2020/lib/stock/esolve-stock-record.mjs +1 -1
  43. package/esm2020/lib/stock/esolve-stock.service.mjs +11 -2
  44. package/esm2020/public-api.mjs +18 -1
  45. package/fesm2015/esolve-ng-esolve-connect.mjs +547 -33
  46. package/fesm2015/esolve-ng-esolve-connect.mjs.map +1 -1
  47. package/fesm2020/esolve-ng-esolve-connect.mjs +539 -33
  48. package/fesm2020/esolve-ng-esolve-connect.mjs.map +1 -1
  49. package/lib/account/esolve-account.service.d.ts +2 -0
  50. package/lib/account/esolve-forgot-password-response.d.ts +2 -0
  51. package/lib/account/esolve-location-update-result.d.ts +6 -0
  52. package/lib/account/esolve-registration-post-response-item.d.ts +2 -0
  53. package/lib/account/esolve-registration-result.d.ts +1 -0
  54. package/lib/auth/esolve-auth-response.d.ts +25 -0
  55. package/lib/auth/esolve-auth.service.d.ts +3 -15
  56. package/lib/auth/esolve-login-post-response-item.d.ts +6 -0
  57. package/lib/manufacturers/esolve-manufacturer-options.d.ts +3 -0
  58. package/lib/manufacturers/esolve-manufacturer-record.d.ts +16 -0
  59. package/lib/manufacturers/esolve-manufacturer.d.ts +19 -0
  60. package/lib/manufacturers/esolve-manufacturers.service.d.ts +19 -0
  61. package/lib/ranges/esolve-range-options.d.ts +4 -0
  62. package/lib/ranges/esolve-range-record.d.ts +17 -0
  63. package/lib/ranges/esolve-range.d.ts +18 -0
  64. package/lib/ranges/esolve-ranges.service.d.ts +19 -0
  65. package/lib/session/esolve-session-data.d.ts +3 -0
  66. package/lib/session/esolve-session.d.ts +5 -2
  67. package/lib/session/esolve-session.service.d.ts +9 -4
  68. package/lib/session/esolve-stored-session.d.ts +2 -1
  69. package/lib/shared/assets/esolve-asset-type.d.ts +1 -0
  70. package/lib/shared/assets/esolve-linked-asset-record.d.ts +8 -0
  71. package/lib/shared/assets/esolve-linked-asset.d.ts +10 -0
  72. package/lib/shared/assets/index.d.ts +3 -0
  73. package/lib/shared/geocoder/esolve-geocode-address-record.d.ts +9 -0
  74. package/lib/shared/geocoder/esolve-geocode-address-result.d.ts +10 -0
  75. package/lib/shared/geocoder/esolve-geocode-coords-result.d.ts +5 -0
  76. package/lib/shared/geocoder/esolve-geocode-result-record.d.ts +10 -0
  77. package/lib/shared/geocoder/esolve-geocode-result.d.ts +11 -0
  78. package/lib/shared/geocoder/esolve-geocoder.service.d.ts +15 -0
  79. package/lib/specials/esolve-special-image-collection-record.d.ts +6 -0
  80. package/lib/specials/esolve-special-image-collection.d.ts +9 -0
  81. package/lib/specials/esolve-special-image-record.d.ts +6 -0
  82. package/lib/specials/esolve-special-image.d.ts +8 -0
  83. package/lib/specials/esolve-special-options.d.ts +6 -0
  84. package/lib/specials/esolve-special-record.d.ts +24 -0
  85. package/lib/specials/esolve-special.d.ts +20 -0
  86. package/lib/specials/esolve-specials.service.d.ts +19 -0
  87. package/lib/specials/index.d.ts +8 -0
  88. package/lib/stock/esolve-stock-item-options.d.ts +3 -0
  89. package/lib/stock/esolve-stock-item.d.ts +3 -1
  90. package/lib/stock/esolve-stock-record.d.ts +2 -0
  91. package/package.json +1 -1
  92. package/public-api.d.ts +12 -0
@@ -5,9 +5,9 @@ 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
- import { BehaviorSubject, throwError, iif, of } from 'rxjs';
8
+ import { BehaviorSubject, throwError, of, iif } 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,8 +19,9 @@ const ESOLVE_CONNECT_CONFIG = new InjectionToken('esolve.connect.config');
19
19
  // };
20
20
 
21
21
  class EsolveSession {
22
- constructor(id = -1, key = '', expiration_date) {
22
+ constructor(id = -1, location_id = 0, key = '', expiration_date) {
23
23
  this.id = id;
24
+ this.location_id = location_id;
24
25
  this.key = key;
25
26
  this.expiration_date = expiration_date;
26
27
  }
@@ -40,6 +41,9 @@ class EsolveSession {
40
41
  updateUser(user_id) {
41
42
  this.id = user_id;
42
43
  }
44
+ updateLocation(location_id) {
45
+ this.location_id = location_id;
46
+ }
43
47
  }
44
48
 
45
49
  class EsolveCookieService {
@@ -147,7 +151,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
147
151
  }] }];
148
152
  } });
149
153
 
150
- // TODO: Rewrite session manager to use a pure rxjs solution.
151
154
  class EsolveSessionService {
152
155
  constructor(platformId, config, cookieService) {
153
156
  this.platformId = platformId;
@@ -162,17 +165,6 @@ class EsolveSessionService {
162
165
  get currentSession() {
163
166
  return this._session.value;
164
167
  }
165
- setStorageKey() {
166
- if ((typeof this.config.user_session_storage_key === 'string') &&
167
- (this.config.user_session_storage_key !== '')) {
168
- this.storage_key = this.config.user_session_storage_key;
169
- }
170
- }
171
- startTimer(callback, duration) {
172
- if (this.is_browser) {
173
- this.key_expiration_timer = setTimeout(callback, duration);
174
- }
175
- }
176
168
  clearTimer() {
177
169
  if (this.key_expiration_timer) {
178
170
  clearTimeout(this.key_expiration_timer);
@@ -189,7 +181,7 @@ class EsolveSessionService {
189
181
  return;
190
182
  }
191
183
  const expiration_date = new Date(stored_session.expiration_date);
192
- const loaded_session = new EsolveSession(stored_session.id, stored_session.key, expiration_date);
184
+ const loaded_session = new EsolveSession(stored_session.id, stored_session.location_id, stored_session.key, expiration_date);
193
185
  if (!loaded_session.expired) {
194
186
  this._session.next(loaded_session);
195
187
  const expiration_duration = expiration_date.getTime() - new Date().getTime();
@@ -199,22 +191,38 @@ class EsolveSessionService {
199
191
  expirationCallback(loaded_session);
200
192
  }
201
193
  }
202
- handleSession(user_id, key, expiry_time, expires, expirationCallback) {
194
+ handleSession(user_id, location_id, key, expiry_time, expires, expirationCallback) {
203
195
  const expiration_date = new Date(expiry_time * 1000);
204
- const session = new EsolveSession(user_id, key, expiration_date);
196
+ const session = new EsolveSession(user_id, location_id, key, expiration_date);
205
197
  this.cookieService.set(this.storage_key, JSON.stringify(session), expiration_date, '/');
206
198
  this._session.next(session);
207
199
  this.startTimer(expirationCallback, expires * 1000);
208
200
  }
209
- handleUpdateSession(user_id, callback) {
201
+ handleUpdateSession({ user_id, location_id, }, callback) {
210
202
  const current_session = this.currentSession;
211
- current_session.updateUser(user_id);
203
+ if (typeof user_id !== 'undefined') {
204
+ current_session.updateUser(user_id);
205
+ }
206
+ if (typeof location_id !== 'undefined') {
207
+ current_session.updateLocation(location_id);
208
+ }
212
209
  this.cookieService.set(this.storage_key, JSON.stringify(current_session), current_session.expiration_date, '/');
213
210
  this._session.next(current_session);
214
211
  if (typeof callback === 'function') {
215
212
  callback();
216
213
  }
217
214
  }
215
+ setStorageKey() {
216
+ if ((typeof this.config.user_session_storage_key === 'string') &&
217
+ (this.config.user_session_storage_key !== '')) {
218
+ this.storage_key = this.config.user_session_storage_key;
219
+ }
220
+ }
221
+ startTimer(callback, duration) {
222
+ if (this.is_browser) {
223
+ this.key_expiration_timer = setTimeout(callback, duration);
224
+ }
225
+ }
218
226
  }
219
227
  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 });
220
228
  EsolveSessionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveSessionService, providedIn: 'root' });
@@ -584,6 +592,109 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
584
592
  }] }, { type: i1$1.Title }, { type: i1$1.Meta }];
585
593
  } });
586
594
 
595
+ class EsolveGeocodeAddressResult {
596
+ constructor(street_number, street, suburb, city, province, country, postal_code) {
597
+ this.street_number = street_number;
598
+ this.street = street;
599
+ this.suburb = suburb;
600
+ this.city = city;
601
+ this.province = province;
602
+ this.country = country;
603
+ this.postal_code = postal_code;
604
+ }
605
+ }
606
+
607
+ class EsolveGeocodeCoordsResult {
608
+ constructor(latitude, longitude) {
609
+ this.latitude = latitude;
610
+ this.longitude = longitude;
611
+ }
612
+ }
613
+
614
+ class EsolveGeocodeResult {
615
+ constructor(formatted_address, address, coords, status, checksum, cached) {
616
+ this.formatted_address = formatted_address;
617
+ this.address = address;
618
+ this.coords = coords;
619
+ this.status = status;
620
+ this.checksum = checksum;
621
+ this.cached = cached;
622
+ }
623
+ }
624
+
625
+ class EsolveGeocoderService {
626
+ constructor(config, http) {
627
+ this.config = config;
628
+ this.http = http;
629
+ }
630
+ geocode(street_number, street, suburb, city, province, country, postal_code) {
631
+ return this.http
632
+ .get(`${this.config.api_url}/get-geocode.php`, {
633
+ params: {
634
+ street_number,
635
+ street,
636
+ suburb,
637
+ city,
638
+ province,
639
+ country,
640
+ postal_code,
641
+ }
642
+ })
643
+ .pipe(map((response) => {
644
+ if (response.records === undefined) {
645
+ throw response;
646
+ }
647
+ const record = response.records;
648
+ return this.processGeocodeResult(record);
649
+ }));
650
+ }
651
+ reverseGeocode(latitude, longitude) {
652
+ return this.http
653
+ .get(`${this.config.api_url}/get-geocode.php`, {
654
+ params: {
655
+ latitude: latitude,
656
+ longitude: longitude,
657
+ }
658
+ })
659
+ .pipe(map((response) => {
660
+ if (response.records === undefined) {
661
+ throw response;
662
+ }
663
+ const record = response.records;
664
+ return this.processGeocodeResult(record);
665
+ }));
666
+ }
667
+ processGeocodeResult(record) {
668
+ 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);
669
+ const geocode_coords = new EsolveGeocodeCoordsResult(record.latitude, record.longitude);
670
+ const geocode_result = new EsolveGeocodeResult(record.formatted_address, geocode_address, geocode_coords, record.status, record.checksum, record.cached);
671
+ return geocode_result;
672
+ }
673
+ }
674
+ 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 });
675
+ EsolveGeocoderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveGeocoderService, providedIn: 'root' });
676
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveGeocoderService, decorators: [{
677
+ type: Injectable,
678
+ args: [{
679
+ providedIn: 'root',
680
+ }]
681
+ }], ctorParameters: function () {
682
+ return [{ type: undefined, decorators: [{
683
+ type: Inject,
684
+ args: [ESOLVE_CONNECT_CONFIG]
685
+ }] }, { type: i1$2.HttpClient }];
686
+ } });
687
+
688
+ class EsolveLinkedAsset {
689
+ constructor(record) {
690
+ this.id = +record.id;
691
+ this.name = record.name;
692
+ this.type = record.type;
693
+ this.description = record.description;
694
+ this.src = record.src;
695
+ }
696
+ }
697
+
587
698
  class EsolveAuthService {
588
699
  constructor(config, http, session, errorHandler, cookieService) {
589
700
  this.config = config;
@@ -616,7 +727,7 @@ class EsolveAuthService {
616
727
  throw responseData;
617
728
  }
618
729
  }), catchError(this.handleError), tap((responseData) => {
619
- this.handleAuthentication(responseData);
730
+ this.handleAuthentication(responseData.additional_data);
620
731
  }));
621
732
  }
622
733
  autoLogin() {
@@ -654,8 +765,14 @@ class EsolveAuthService {
654
765
  for (const response_log of login_response.log) {
655
766
  if ((response_log.type === 'success') &&
656
767
  (response_log.message_code === 'login_success')) {
657
- this.session.handleUpdateSession(login_response.esolve_id);
658
- return login_response.esolve_id;
768
+ const session_data = login_response.session_data;
769
+ const user_id = +login_response.esolve_id;
770
+ const location_id = +session_data.location_id;
771
+ this.session.handleUpdateSession({
772
+ user_id: user_id,
773
+ location_id: location_id
774
+ });
775
+ return user_id;
659
776
  }
660
777
  }
661
778
  throw login_response;
@@ -685,8 +802,15 @@ class EsolveAuthService {
685
802
  (!responseData.additional_data.key_okay)) {
686
803
  throw responseData;
687
804
  }
688
- responseData.additional_data.key = token;
689
- return responseData;
805
+ const additional_data = responseData.additional_data;
806
+ const result = {
807
+ key: token,
808
+ expires: additional_data.expires,
809
+ expiry_time: additional_data.expiry_time,
810
+ location_id: additional_data.location_id,
811
+ user_id: additional_data.user_id,
812
+ };
813
+ return result;
690
814
  }))
691
815
  .toPromise();
692
816
  }
@@ -700,11 +824,11 @@ class EsolveAuthService {
700
824
  });
701
825
  };
702
826
  }
703
- handleAuthentication(responseData) {
704
- if (!responseData.additional_data.key) {
827
+ handleAuthentication(result) {
828
+ if (!result.key) {
705
829
  return;
706
830
  }
707
- this.session.handleSession(responseData.additional_data.user_id, responseData.additional_data.key, +responseData.additional_data.expiry_time, +responseData.additional_data.expires, this.handleExpiration());
831
+ this.session.handleSession(+result.user_id, +result.location_id, result.key, +result.expiry_time, +result.expires, this.handleExpiration());
708
832
  }
709
833
  handleError(errorRes) {
710
834
  const error = {
@@ -1035,6 +1159,7 @@ class EsolveRegistrationResult extends EsolveResponseResult {
1035
1159
  this.guest = response.guest;
1036
1160
  this.auto_login = response.auto_login;
1037
1161
  this.authentication_required = response.authentication_required;
1162
+ this.location_id = response.session_data.location_id;
1038
1163
  }
1039
1164
  }
1040
1165
 
@@ -1055,6 +1180,13 @@ class EsolveResetPasswordResult extends EsolveResponseResult {
1055
1180
  }
1056
1181
  }
1057
1182
 
1183
+ class EsolveLocationUpdateResult extends EsolveResponseResult {
1184
+ constructor(response) {
1185
+ super(response);
1186
+ this.location_updated = (response.esolve_id > 0);
1187
+ }
1188
+ }
1189
+
1058
1190
  class EsolveAccountService {
1059
1191
  constructor(config, http, sessionService, errorHandler, responseHandler) {
1060
1192
  this.config = config;
@@ -1172,7 +1304,10 @@ class EsolveAccountService {
1172
1304
  })
1173
1305
  .pipe(map((http_response) => this.responseHandler.validateSingleHttpResponse(http_response, (response) => {
1174
1306
  if (response.auto_login) {
1175
- this.sessionService.handleUpdateSession(response.esolve_id);
1307
+ this.sessionService.handleUpdateSession({
1308
+ user_id: +response.esolve_id,
1309
+ location_id: +response.session_data.location_id,
1310
+ });
1176
1311
  }
1177
1312
  return new EsolveRegistrationResult(response);
1178
1313
  })), catchError((errorRes) => {
@@ -1225,13 +1360,31 @@ class EsolveAccountService {
1225
1360
  })
1226
1361
  .pipe(map((http_response) => this.responseHandler.validateSingleHttpResponse(http_response, (response) => {
1227
1362
  if (!response.login_required) {
1228
- this.sessionService.handleUpdateSession(response.esolve_id);
1363
+ this.sessionService.handleUpdateSession({
1364
+ user_id: +response.esolve_id,
1365
+ location_id: +response.session_data.location_id,
1366
+ });
1229
1367
  }
1230
1368
  return new EsolveResetPasswordResult(response);
1231
1369
  })), catchError((errorRes) => {
1232
1370
  return this.errorHandler.handleHttpPostError('set-forgot-password', errorRes);
1233
1371
  }));
1234
1372
  }
1373
+ updateLocation(location_id) {
1374
+ const body = { location_id };
1375
+ return this.http
1376
+ .post(`${this.config.api_url}/set-session-location.php`, body, {
1377
+ headers: {
1378
+ 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
1379
+ },
1380
+ responseType: 'json',
1381
+ observe: 'body',
1382
+ })
1383
+ .pipe(map((http_response) => this.responseHandler.validateSingleHttpResponse(http_response, (response) => {
1384
+ this.sessionService.handleUpdateSession({ location_id });
1385
+ return new EsolveLocationUpdateResult(response);
1386
+ })));
1387
+ }
1235
1388
  getTransactions(options = {}) {
1236
1389
  try {
1237
1390
  this.loginGuard();
@@ -2012,7 +2165,7 @@ class EsolveStockItem {
2012
2165
  /**
2013
2166
  * ID of default subcategory linked to the stock item
2014
2167
  */
2015
- subcategory_id, seo_title = '', seo_keywords = '') {
2168
+ subcategory_id, manufacturers_id, ranges_id, seo_title = '', seo_keywords = '') {
2016
2169
  this.id = id;
2017
2170
  this.code = code;
2018
2171
  this.name = name;
@@ -2028,6 +2181,8 @@ class EsolveStockItem {
2028
2181
  this.badges = badges;
2029
2182
  this.category_id = category_id;
2030
2183
  this.subcategory_id = subcategory_id;
2184
+ this.manufacturers_id = manufacturers_id;
2185
+ this.ranges_id = ranges_id;
2031
2186
  if (seo_title.trim() === '') {
2032
2187
  seo_title = this.name;
2033
2188
  }
@@ -2144,6 +2299,15 @@ class EsolveStockService {
2144
2299
  if (options.subcategory_id) {
2145
2300
  params = params.set('subcategory_id', options.subcategory_id);
2146
2301
  }
2302
+ if (options.manufacturers_id) {
2303
+ params = params.set('manufacturers_id', options.manufacturers_id);
2304
+ }
2305
+ if (options.ranges_id) {
2306
+ params = params.set('ranges_id', options.ranges_id);
2307
+ }
2308
+ if (options.specials_id) {
2309
+ params = params.set('specials_id', options.specials_id);
2310
+ }
2147
2311
  if (options.tag_id_list) {
2148
2312
  if (options.tag_id_list.length > 0) {
2149
2313
  params = params.set('tag_id', options.tag_id_list.join(','));
@@ -2190,7 +2354,7 @@ class EsolveStockService {
2190
2354
  }
2191
2355
  }
2192
2356
  const price = new EsolveStockPrice(record.regular_sellprice, record.regular_sellprice_inclusive, record.sellprice, record.sellprice_inclusive);
2193
- 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);
2357
+ 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.manufacturers_id, +record.ranges_id, record.seo_page_title, record.seo_keywords);
2194
2358
  }
2195
2359
  /**
2196
2360
  * Retrieves stock records from HTTP params.
@@ -2386,6 +2550,356 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
2386
2550
  }] }, { type: i1$2.HttpClient }];
2387
2551
  } });
2388
2552
 
2553
+ class EsolveManufacturer {
2554
+ constructor(id, manufacturer, sef_manufacturer, title, article, sort_priority, is_active, featured, image_name, seo_title = '', seo_keywords = '', seo_description = '') {
2555
+ this.id = id;
2556
+ this.manufacturer = manufacturer;
2557
+ this.sef_manufacturer = sef_manufacturer;
2558
+ this.title = title;
2559
+ this.article = article;
2560
+ this.sort_priority = sort_priority;
2561
+ this.is_active = is_active;
2562
+ this.featured = featured;
2563
+ this.image_name = image_name;
2564
+ this.image_path = '/images/manufacturers/';
2565
+ if (this.title.trim() === '') {
2566
+ this.title = this.manufacturer;
2567
+ }
2568
+ if (seo_title.trim() === '') {
2569
+ seo_title = this.title;
2570
+ }
2571
+ this.seo_details = new EsolveSEOInfo(seo_title, seo_description, seo_keywords);
2572
+ }
2573
+ get small_image_src() {
2574
+ return this.generateImagePath('small');
2575
+ }
2576
+ get thumbnail_image_src() {
2577
+ return this.generateImagePath('thumb');
2578
+ }
2579
+ get tiny_image_src() {
2580
+ return this.generateImagePath('tiny');
2581
+ }
2582
+ generateImagePath(image_size) {
2583
+ if (this.image_name !== '') {
2584
+ return `${this.image_path}${image_size}/${this.image_name}`;
2585
+ }
2586
+ return '';
2587
+ }
2588
+ }
2589
+
2590
+ class EsolveManufacturersService {
2591
+ constructor(config, http) {
2592
+ this.config = config;
2593
+ this.http = http;
2594
+ }
2595
+ getManufacturer(id) {
2596
+ const params = new HttpParams({
2597
+ fromObject: { manufacturers_id: id }
2598
+ });
2599
+ return this.getManufacturerSingle(params);
2600
+ }
2601
+ getManufacturerFromSEF(sef_manufacturer) {
2602
+ const params = new HttpParams({
2603
+ fromObject: { sef_manufacturer }
2604
+ });
2605
+ return this.getManufacturerSingle(params);
2606
+ }
2607
+ getManufacturers(options) {
2608
+ let params = new HttpParams();
2609
+ if (options === null || options === void 0 ? void 0 : options.featured_only) {
2610
+ params = params.set('featured_only', options.featured_only);
2611
+ }
2612
+ return this.getManufacturerRecords(params).pipe(map((records) => {
2613
+ const manufacturers = [];
2614
+ for (const record of records) {
2615
+ manufacturers.push(this.processManufacturer(record));
2616
+ }
2617
+ return manufacturers;
2618
+ }), catchError(() => {
2619
+ return of([]);
2620
+ }));
2621
+ }
2622
+ getManufacturerSingle(params) {
2623
+ return this.getManufacturerRecords(params).pipe(map((records) => {
2624
+ const record = records[0];
2625
+ return this.processManufacturer(record);
2626
+ }));
2627
+ }
2628
+ getManufacturerRecords(params) {
2629
+ return this.http
2630
+ .get(`${this.config.api_url}/get-manufacturers.php`, { params })
2631
+ .pipe(map((response) => {
2632
+ if ((response.records === undefined) ||
2633
+ (response.records.length <= 0)) {
2634
+ throw response;
2635
+ }
2636
+ return response.records;
2637
+ }));
2638
+ }
2639
+ processManufacturer(record) {
2640
+ return new EsolveManufacturer(+record.id, record.manufacturer, record.sef_manufacturer, record.title, record.article, +record.sort_priority, !!+record.is_active, !!+record.featured, record.image_name, record.seo_page_title, record.seo_keywords, record.seo_description);
2641
+ }
2642
+ }
2643
+ EsolveManufacturersService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveManufacturersService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
2644
+ EsolveManufacturersService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveManufacturersService, providedIn: 'root' });
2645
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveManufacturersService, decorators: [{
2646
+ type: Injectable,
2647
+ args: [{
2648
+ providedIn: 'root',
2649
+ }]
2650
+ }], ctorParameters: function () {
2651
+ return [{ type: undefined, decorators: [{
2652
+ type: Inject,
2653
+ args: [ESOLVE_CONNECT_CONFIG]
2654
+ }] }, { type: i1$2.HttpClient }];
2655
+ } });
2656
+
2657
+ class EsolveSpecialImage {
2658
+ constructor(record) {
2659
+ this.id = +record.id;
2660
+ this.width = +record.width;
2661
+ this.height = +record.height;
2662
+ this.src = record.src;
2663
+ }
2664
+ }
2665
+
2666
+ class EsolveSpecialImageCollection {
2667
+ constructor(image_container, images) {
2668
+ this.image_container = image_container;
2669
+ if (images.thumb && images.thumb.length > 0) {
2670
+ this.thumb = [];
2671
+ for (const image_record of images.thumb) {
2672
+ this.thumb.push(new EsolveSpecialImage(image_record));
2673
+ }
2674
+ }
2675
+ if (images.banner && images.banner.length > 0) {
2676
+ this.banner = [];
2677
+ for (const image_record of images.banner) {
2678
+ this.banner.push(new EsolveSpecialImage(image_record));
2679
+ }
2680
+ }
2681
+ if (images.banner_mobile && images.banner_mobile.length > 0) {
2682
+ this.banner_mobile = [];
2683
+ for (const image_record of images.banner_mobile) {
2684
+ this.banner_mobile.push(new EsolveSpecialImage(image_record));
2685
+ }
2686
+ }
2687
+ }
2688
+ }
2689
+
2690
+ class EsolveSpecial {
2691
+ constructor(record) {
2692
+ this.id = +record.id;
2693
+ this.identifier = record.identifier;
2694
+ this.sort_priority = +record.sort_priority;
2695
+ this.name = record.name;
2696
+ this.description = record.description;
2697
+ this.discount_type = +record.discount_type;
2698
+ this.special_type = record.special_type;
2699
+ this.location_id = +record.location_id;
2700
+ this.active = !!+record.active;
2701
+ this.featured = !!+record.featured;
2702
+ this.assets = [];
2703
+ if (record.assets.length > 0) {
2704
+ for (const asset_record of record.assets) {
2705
+ this.assets.push(new EsolveLinkedAsset(asset_record));
2706
+ }
2707
+ }
2708
+ if (record.images &&
2709
+ ((record.images.thumb &&
2710
+ record.images.thumb.length > 0) ||
2711
+ (record.images.banner &&
2712
+ record.images.banner.length > 0) ||
2713
+ (record.images.banner_mobile &&
2714
+ record.images.banner_mobile.length > 0)) &&
2715
+ record.image_container.trim() !== '') {
2716
+ this.images = new EsolveSpecialImageCollection(record.image_container, record.images);
2717
+ }
2718
+ if (record.seo_page_title.trim() === '') {
2719
+ record.seo_page_title = this.name;
2720
+ }
2721
+ this.seo_details = new EsolveSEOInfo(record.seo_page_title, record.seo_description, record.seo_keywords);
2722
+ }
2723
+ }
2724
+
2725
+ class EsolveSpecialsService {
2726
+ constructor(config, http) {
2727
+ this.config = config;
2728
+ this.http = http;
2729
+ }
2730
+ getSpecial(specials_id) {
2731
+ const params = new HttpParams({
2732
+ fromObject: { specials_id }
2733
+ });
2734
+ return this.getSpecialSingle(params);
2735
+ }
2736
+ getSpecialFromIdentifier(identifier) {
2737
+ const params = new HttpParams({
2738
+ fromObject: { identifier }
2739
+ });
2740
+ return this.getSpecialSingle(params);
2741
+ }
2742
+ getSpecials(options) {
2743
+ let params = new HttpParams();
2744
+ if (options === null || options === void 0 ? void 0 : options.featured_only) {
2745
+ params = params.set('featured_only', options.featured_only);
2746
+ }
2747
+ if (options === null || options === void 0 ? void 0 : options.image_container) {
2748
+ params = params.set('image_container', options.image_container);
2749
+ }
2750
+ if (options === null || options === void 0 ? void 0 : options.location_id) {
2751
+ params = params.set('location_id', options.location_id);
2752
+ }
2753
+ if (options === null || options === void 0 ? void 0 : options.special_type) {
2754
+ params = params.set('special_type', options.special_type);
2755
+ }
2756
+ return this.getSpecialRecords(params).pipe(map((records) => {
2757
+ const specials = [];
2758
+ for (const record of records) {
2759
+ specials.push(this.processSpecial(record));
2760
+ }
2761
+ return specials;
2762
+ }), catchError(() => {
2763
+ return of([]);
2764
+ }));
2765
+ }
2766
+ getSpecialSingle(params) {
2767
+ return this.getSpecialRecords(params).pipe(map((records) => {
2768
+ const record = records[0];
2769
+ return this.processSpecial(record);
2770
+ }));
2771
+ }
2772
+ getSpecialRecords(params) {
2773
+ return this.http
2774
+ .get(`${this.config.api_url}/get-specials.php`, { params })
2775
+ .pipe(map((response) => {
2776
+ if ((response.records === undefined) ||
2777
+ (response.records.length <= 0)) {
2778
+ throw response;
2779
+ }
2780
+ return response.records;
2781
+ }));
2782
+ }
2783
+ processSpecial(record) {
2784
+ return new EsolveSpecial(record);
2785
+ }
2786
+ }
2787
+ EsolveSpecialsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveSpecialsService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
2788
+ EsolveSpecialsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveSpecialsService, providedIn: 'root' });
2789
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveSpecialsService, decorators: [{
2790
+ type: Injectable,
2791
+ args: [{
2792
+ providedIn: 'root'
2793
+ }]
2794
+ }], ctorParameters: function () {
2795
+ return [{ type: undefined, decorators: [{
2796
+ type: Inject,
2797
+ args: [ESOLVE_CONNECT_CONFIG]
2798
+ }] }, { type: i1$2.HttpClient }];
2799
+ } });
2800
+
2801
+ class EsolveRange {
2802
+ constructor(id, range, sef_range, manufacturers_id, title, article, is_active, featured, sort_priority, image_name, seo_title = '', seo_keywords = '', seo_description = '') {
2803
+ this.id = id;
2804
+ this.range = range;
2805
+ this.sef_range = sef_range;
2806
+ this.manufacturers_id = manufacturers_id;
2807
+ this.title = title;
2808
+ this.article = article;
2809
+ this.is_active = is_active;
2810
+ this.featured = featured;
2811
+ this.sort_priority = sort_priority;
2812
+ this.image_name = image_name;
2813
+ this.image_path = '/images/ranges/';
2814
+ if (this.title.trim() === '') {
2815
+ this.title = this.range;
2816
+ }
2817
+ if (seo_title.trim() === '') {
2818
+ seo_title = this.title;
2819
+ }
2820
+ this.seo_details = new EsolveSEOInfo(seo_title, seo_description, seo_keywords);
2821
+ }
2822
+ get image_src() {
2823
+ return this.generateImagePath();
2824
+ }
2825
+ generateImagePath() {
2826
+ if (this.image_name !== '') {
2827
+ return `${this.image_path}${this.image_name}`;
2828
+ }
2829
+ return '';
2830
+ }
2831
+ }
2832
+
2833
+ class EsolveRangesService {
2834
+ constructor(config, http) {
2835
+ this.config = config;
2836
+ this.http = http;
2837
+ }
2838
+ getRange(id) {
2839
+ const params = new HttpParams({
2840
+ fromObject: { ranges_id: id }
2841
+ });
2842
+ return this.getRangeSingle(params);
2843
+ }
2844
+ getRangeFromSEF(sef_range) {
2845
+ const params = new HttpParams({
2846
+ fromObject: { sef_range }
2847
+ });
2848
+ return this.getRangeSingle(params);
2849
+ }
2850
+ getRanges(options) {
2851
+ let params = new HttpParams();
2852
+ if (options === null || options === void 0 ? void 0 : options.featured_only) {
2853
+ params = params.set('featured_only', options.featured_only);
2854
+ }
2855
+ if (options === null || options === void 0 ? void 0 : options.manufacturers_id) {
2856
+ params = params.set('manufacturers_id', options.manufacturers_id);
2857
+ }
2858
+ return this.getRangeRecords(params).pipe(map((records) => {
2859
+ const ranges = [];
2860
+ for (const record of records) {
2861
+ ranges.push(this.processRange(record));
2862
+ }
2863
+ return ranges;
2864
+ }), catchError(() => {
2865
+ return of([]);
2866
+ }));
2867
+ }
2868
+ getRangeSingle(params) {
2869
+ return this.getRangeRecords(params).pipe(map((records) => {
2870
+ const record = records[0];
2871
+ return this.processRange(record);
2872
+ }));
2873
+ }
2874
+ getRangeRecords(params) {
2875
+ return this.http
2876
+ .get(`${this.config.api_url}/get-ranges.php`, { params })
2877
+ .pipe(map((response) => {
2878
+ if ((response.records === undefined) ||
2879
+ (response.records.length <= 0)) {
2880
+ throw response;
2881
+ }
2882
+ return response.records;
2883
+ }));
2884
+ }
2885
+ processRange(record) {
2886
+ return new EsolveRange(+record.id, record.range, record.sef_range, record.manufacturers_id, record.title, record.article, !!+record.is_active, !!+record.featured, +record.sort_priority, record.image_name, record.seo_page_title, record.seo_keywords, record.seo_description);
2887
+ }
2888
+ }
2889
+ EsolveRangesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveRangesService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
2890
+ EsolveRangesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveRangesService, providedIn: 'root' });
2891
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveRangesService, decorators: [{
2892
+ type: Injectable,
2893
+ args: [{
2894
+ providedIn: 'root'
2895
+ }]
2896
+ }], ctorParameters: function () {
2897
+ return [{ type: undefined, decorators: [{
2898
+ type: Inject,
2899
+ args: [ESOLVE_CONNECT_CONFIG]
2900
+ }] }, { type: i1$2.HttpClient }];
2901
+ } });
2902
+
2389
2903
  class EsolveCheckoutResult extends EsolveResponseResult {
2390
2904
  constructor(response) {
2391
2905
  super(response);
@@ -3155,5 +3669,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
3155
3669
  * Generated bundle index. Do not edit.
3156
3670
  */
3157
3671
 
3158
- export { EsolveAccountService, EsolveAddress, EsolveAddressResult, EsolveAuthService, EsolveBankingDetails, EsolveBanner, EsolveBannerImage, EsolveBannerImageHotspot, EsolveBannerService, EsolveCartItem, EsolveCartService, EsolveCartTotals, EsolveCategoryTreeItem, EsolveCategoryTreeService, EsolveChangePasswordResult, EsolveCheckoutResult, EsolveCookieService, EsolveErrorHandlerService, EsolveHeading, EsolveHttpError, EsolveList, EsolveLocationsService, EsolveMediaArticle, EsolveMediaService, EsolveMenuItem, EsolveMenuService, EsolveNewsArticle, EsolveNewsArticleAuthor, EsolveNewsArticleList, EsolveNewsGroup, EsolveNewsService, EsolvePaymentMethod, EsolvePaymentResult, EsolvePaymentService, EsolveRegistrationResult, EsolveResetPasswordResult, EsolveResponseHandlerService, EsolveResponseResult, EsolveResult, EsolveSEOInfo, EsolveSeoService, EsolveSession, EsolveSessionService, EsolveShippingCost, EsolveShippingMethod, EsolveShippingService, EsolveStockBadge, EsolveStockItem, EsolveStockItemList, EsolveStockLocation, EsolveStockLocationAddress, EsolveStockLocationContactInfo, EsolveStockLocationPOBoxAddress, EsolveStockLocationTradingTimes, EsolveStockLocationTradingTimesDay, EsolveStockPrice, EsolveStockService, EsolveTag, EsolveTopic, EsolveTopicService, EsolveTransaction, EsolveTransactionAddress, EsolveTransactionClient, EsolveTransactionItem, EsolveTransactionItemPrice, EsolveTransactionList, EsolveTransactionLocation, EsolveTransactionPaymentMethod, EsolveTransactionShippingMethod, EsolveTransactionUser, EsolveUserAccount, EsolveUserAccountBusiness, EsolveUserAccountContact, EsolveUserAccountResult, EsolveVaultItem, EsolveVaultItemResult, NgEsolveConnectModule };
3672
+ 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, EsolveLinkedAsset, EsolveList, EsolveLocationsService, EsolveManufacturer, EsolveManufacturersService, EsolveMediaArticle, EsolveMediaService, EsolveMenuItem, EsolveMenuService, EsolveNewsArticle, EsolveNewsArticleAuthor, EsolveNewsArticleList, EsolveNewsGroup, EsolveNewsService, EsolvePaymentMethod, EsolvePaymentResult, EsolvePaymentService, EsolveRange, EsolveRangesService, EsolveRegistrationResult, EsolveResetPasswordResult, EsolveResponseHandlerService, EsolveResponseResult, EsolveResult, EsolveSEOInfo, EsolveSeoService, EsolveSession, EsolveSessionService, EsolveShippingCost, EsolveShippingMethod, EsolveShippingService, EsolveSpecial, EsolveSpecialImage, EsolveSpecialImageCollection, EsolveSpecialsService, 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 };
3159
3673
  //# sourceMappingURL=esolve-ng-esolve-connect.mjs.map