@esolve/ng-esolve-connect 0.27.5 → 0.28.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.
@@ -5,7 +5,7 @@ import * as i1$2 from '@angular/common/http';
5
5
  import { HTTP_INTERCEPTORS, HttpClientModule, HttpErrorResponse, HttpParams, 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, of, Subject, firstValueFrom, iif } from 'rxjs';
8
+ import { BehaviorSubject, throwError, of, firstValueFrom, Subject, iif } from 'rxjs';
9
9
  import * as i1$1 from '@angular/platform-browser';
10
10
  import { map, catchError, tap, switchMap } from 'rxjs/operators';
11
11
 
@@ -1698,7 +1698,7 @@ class EsolveAuthService {
1698
1698
  }
1699
1699
  autoLogin() {
1700
1700
  this.session.restore(this.handleExpiration(), () => {
1701
- this.getAccessToken('', '', true).toPromise().then(() => { }, (error) => {
1701
+ firstValueFrom(this.getAccessToken('', '', true)).then(() => { }, (error) => {
1702
1702
  console.error(error);
1703
1703
  });
1704
1704
  });
@@ -1749,7 +1749,7 @@ class EsolveAuthService {
1749
1749
  async logout() {
1750
1750
  this.session.clearTimer();
1751
1751
  this.cookieService.delete('_ws_id');
1752
- const response = await this.getAccessToken('', '', true).toPromise();
1752
+ const response = await firstValueFrom(this.getAccessToken('', '', true));
1753
1753
  if (response) {
1754
1754
  return response;
1755
1755
  }
@@ -1785,7 +1785,7 @@ class EsolveAuthService {
1785
1785
  // Handlers
1786
1786
  handleExpiration() {
1787
1787
  return (session) => {
1788
- this.checkAccessToken(session).toPromise().then((response) => {
1788
+ firstValueFrom(this.checkAccessToken(session)).then((response) => {
1789
1789
  if (response) {
1790
1790
  this.handleAuthentication(response);
1791
1791
  }
@@ -3020,6 +3020,23 @@ class EsolveAccountService {
3020
3020
  return this.processUserAccount(record);
3021
3021
  }));
3022
3022
  }
3023
+ deleteUserAccount() {
3024
+ return this.http
3025
+ .delete(`${this.config.api_url}/delete-account.php`, {
3026
+ responseType: 'json',
3027
+ observe: 'body',
3028
+ })
3029
+ .pipe(map((http_response) => {
3030
+ if ((http_response.result === undefined) ||
3031
+ (http_response.result === null) ||
3032
+ (http_response.result.status !== 'success')) {
3033
+ throw http_response;
3034
+ }
3035
+ return new EsolveResult(http_response.result.status, http_response.result.code, http_response.result.message);
3036
+ }), catchError((errorRes) => {
3037
+ return this.errorHandler.handleHttpDeleteError('delete-account', errorRes);
3038
+ }));
3039
+ }
3023
3040
  setAddress(address_post_data) {
3024
3041
  const body = {
3025
3042
  address: address_post_data,
@@ -3927,6 +3944,10 @@ class EsolveStockItemBase {
3927
3944
  * Image filename
3928
3945
  */
3929
3946
  this.image_name = '';
3947
+ /**
3948
+ * Image Last modified
3949
+ */
3950
+ this.image_last_modified = '';
3930
3951
  let seo_title = '';
3931
3952
  let seo_keywords = '';
3932
3953
  let base_price = 0;
@@ -3941,6 +3962,7 @@ class EsolveStockItemBase {
3941
3962
  this.description = record.description ?? '';
3942
3963
  this.extended_description = record.extended_description ?? '';
3943
3964
  this.image_name = record.image_name ?? '';
3965
+ this.image_last_modified = record.image_last_modified ?? '';
3944
3966
  this.category_id = record.category_id ?? '';
3945
3967
  this.subcategory_id = +(record.subcategory_id ?? 0);
3946
3968
  this.manufacturers_id = +(record.manufacturers_id ?? 0);
@@ -4052,7 +4074,11 @@ class EsolveStockItemBase {
4052
4074
  }
4053
4075
  getImagePath(image_size) {
4054
4076
  if (this.image_name !== '') {
4055
- return `/images/stock/${image_size}/${this.image_name}`;
4077
+ let param = '';
4078
+ if (this.image_last_modified !== '') {
4079
+ param = `?t=${this.image_last_modified}`;
4080
+ }
4081
+ return `/images/stock/${image_size}/${this.image_name}${param}`;
4056
4082
  }
4057
4083
  return '';
4058
4084
  }
@@ -4141,8 +4167,9 @@ class EsolveMediaStockItem extends EsolveStockItemBase {
4141
4167
  }
4142
4168
 
4143
4169
  class EsolveStockImage {
4144
- constructor(image_name) {
4170
+ constructor(image_name, last_modified = '') {
4145
4171
  this.image_name = image_name;
4172
+ this.last_modified = last_modified;
4146
4173
  if (this.image_name === 'no_image.jpg') {
4147
4174
  this.image_name = '';
4148
4175
  }
@@ -4179,7 +4206,11 @@ class EsolveStockImage {
4179
4206
  }
4180
4207
  getImagePath(image_size) {
4181
4208
  if (this.image_name !== '') {
4182
- return `/images/stock/${image_size}/${this.image_name}`;
4209
+ let param = '';
4210
+ if (this.last_modified !== '') {
4211
+ param = `?t=${this.last_modified}`;
4212
+ }
4213
+ return `/images/stock/${image_size}/${this.image_name}${param}`;
4183
4214
  }
4184
4215
  return '';
4185
4216
  }
@@ -4210,7 +4241,7 @@ class EsolveStockImageCollection {
4210
4241
  constructor(record) {
4211
4242
  this.alt_images = [];
4212
4243
  this.additional_images = [];
4213
- this.default_image = new EsolveStockImage(record?.default_image ?? '');
4244
+ this.default_image = new EsolveStockImage(record?.default_image ?? '', record?.default_image_last_modified ?? '');
4214
4245
  if (!record) {
4215
4246
  return;
4216
4247
  }