simpo-component-library 2.0.19 → 2.0.22

Sign up to get free protection for your applications and to get access to all the features.
@@ -3603,12 +3603,11 @@ var cartType;
3603
3603
  })(cartType || (cartType = {}));
3604
3604
 
3605
3605
  class StorageServiceService {
3606
- constructor(eventService, cookieService, restService, router, messageService) {
3606
+ constructor(eventService, cookieService, restService, router) {
3607
3607
  this.eventService = eventService;
3608
3608
  this.cookieService = cookieService;
3609
3609
  this.restService = restService;
3610
3610
  this.router = router;
3611
- this.messageService = messageService;
3612
3611
  this.totalCartItems = 0;
3613
3612
  this.databaseName = "USER";
3614
3613
  this.databaseVersion = 1;
@@ -3780,6 +3779,7 @@ class StorageServiceService {
3780
3779
  serverDBProduct.push(localProduct);
3781
3780
  }
3782
3781
  }
3782
+ this.totalCartItems = serverDBProduct?.length || 0;
3783
3783
  resolve(serverDBProduct);
3784
3784
  }
3785
3785
  catch (error) {
@@ -3788,6 +3788,7 @@ class StorageServiceService {
3788
3788
  }
3789
3789
  }
3790
3790
  else {
3791
+ this.totalCartItems = indexDBProduct?.length || 0;
3791
3792
  resolve(indexDBProduct);
3792
3793
  }
3793
3794
  };
@@ -3879,7 +3880,7 @@ class StorageServiceService {
3879
3880
  storePaymentFor(paymentFor) {
3880
3881
  this.cookieService.set("paymentFor", paymentFor, 7);
3881
3882
  }
3882
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: StorageServiceService, deps: [{ token: EventsService }, { token: i2$2.CookieService }, { token: RestService }, { token: i2$3.Router }, { token: i5$1.MessageService }], target: i0.ɵɵFactoryTarget.Injectable }); }
3883
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: StorageServiceService, deps: [{ token: EventsService }, { token: i2$2.CookieService }, { token: RestService }, { token: i2$3.Router }], target: i0.ɵɵFactoryTarget.Injectable }); }
3883
3884
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: StorageServiceService, providedIn: 'root' }); }
3884
3885
  }
3885
3886
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: StorageServiceService, decorators: [{
@@ -3887,7 +3888,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImpor
3887
3888
  args: [{
3888
3889
  providedIn: 'root'
3889
3890
  }]
3890
- }], ctorParameters: () => [{ type: EventsService }, { type: i2$2.CookieService }, { type: RestService }, { type: i2$3.Router }, { type: i5$1.MessageService }] });
3891
+ }], ctorParameters: () => [{ type: EventsService }, { type: i2$2.CookieService }, { type: RestService }, { type: i2$3.Router }] });
3891
3892
 
3892
3893
  class UserBasicInfoComponent {
3893
3894
  constructor(restService, router, dialogRef, storageService, messageService) {
@@ -4589,10 +4590,9 @@ class OrderedItems {
4589
4590
  }
4590
4591
 
4591
4592
  class CartService {
4592
- constructor(storageService, restService, messageService) {
4593
+ constructor(storageService, restService) {
4593
4594
  this.storageService = storageService;
4594
4595
  this.restService = restService;
4595
- this.messageService = messageService;
4596
4596
  }
4597
4597
  addItemFromCartPage(product, userCart) {
4598
4598
  if (product.quantity) {
@@ -4669,10 +4669,10 @@ class CartService {
4669
4669
  this.storageService.clearUserCart();
4670
4670
  }
4671
4671
  addItemToLocalCart(product, type) {
4672
- if (this.isItemOutOfStock(product)) {
4673
- this.messageService.add({ severity: 'warn', summary: 'Cart', detail: 'Item is not available as of now. We will notify you once available' });
4674
- return;
4675
- }
4672
+ // if (this.isItemOutOfStock(product)) {
4673
+ // // this.messageService.add({ severity: 'warn', summary: 'Cart', detail: 'Item is not available as of now. We will notify you once available' });
4674
+ // return;
4675
+ // }
4676
4676
  if (!product?.quantity)
4677
4677
  product.quantity = 0;
4678
4678
  if (type == 'ADD') {
@@ -4739,7 +4739,7 @@ class CartService {
4739
4739
  // this.restService.addItemToDB(UserFavourites)
4740
4740
  // ]);
4741
4741
  }
4742
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: CartService, deps: [{ token: StorageServiceService }, { token: RestService }, { token: i5$1.MessageService }], target: i0.ɵɵFactoryTarget.Injectable }); }
4742
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: CartService, deps: [{ token: StorageServiceService }, { token: RestService }], target: i0.ɵɵFactoryTarget.Injectable }); }
4743
4743
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: CartService, providedIn: 'root' }); }
4744
4744
  }
4745
4745
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: CartService, decorators: [{
@@ -4747,7 +4747,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImpor
4747
4747
  args: [{
4748
4748
  providedIn: 'root',
4749
4749
  }]
4750
- }], ctorParameters: () => [{ type: StorageServiceService }, { type: RestService }, { type: i5$1.MessageService }] });
4750
+ }], ctorParameters: () => [{ type: StorageServiceService }, { type: RestService }] });
4751
4751
 
4752
4752
  class CartComponent extends BaseSection {
4753
4753
  constructor(_eventService, cartService, router, restService, matDialog, storageService, messageService, bottomSheet, matDialogData, dialogRef) {
@@ -4922,6 +4922,7 @@ class CartComponent extends BaseSection {
4922
4922
  const restResponse = this.restService.addItemToDB(this.cartInfo).toPromise();
4923
4923
  restResponse.then((cartResponse) => {
4924
4924
  this.cartInfo = cartResponse.data;
4925
+ this.responseData = this.cartInfo;
4925
4926
  this.storageService.clearUserCart();
4926
4927
  });
4927
4928
  }
@@ -4939,6 +4940,7 @@ class CartComponent extends BaseSection {
4939
4940
  this.cartInfo.billdetails.totalNetValue = this.cartInfo.billdetails.totalGrossValue - this.cartInfo.billdetails.deliveryCharges;
4940
4941
  this.cartInfo.totalAmount = this.cartInfo.billdetails.totalNetValue + this.getTaxAmount();
4941
4942
  +this.cartInfo.billdetails.deliveryCharges;
4943
+ this.responseData = this.cartInfo;
4942
4944
  }
4943
4945
  });
4944
4946
  }
@@ -7850,6 +7852,10 @@ class FeaturedProductsComponent extends BaseSection {
7850
7852
  });
7851
7853
  }
7852
7854
  addItemToCart(product, type) {
7855
+ if (this.isItemOutOfStock(product)) {
7856
+ this.messageService.add({ severity: 'warn', summary: 'Cart', detail: 'Item is not available as of now. We will notify you once available' });
7857
+ return;
7858
+ }
7853
7859
  this.cartService.addItemToLocalCart(product, type);
7854
7860
  }
7855
7861
  // addItemToCart(product: Product, type: 'ADD' | 'SUBSTRACT') {